From owner-svn-src-all@freebsd.org Sun Dec 18 00:39:05 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id AAFE6C71817; Sun, 18 Dec 2016 00:39:05 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 7A53E1BE0; Sun, 18 Dec 2016 00:39:05 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBI0d43o067975; Sun, 18 Dec 2016 00:39:04 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBI0d4Gr067974; Sun, 18 Dec 2016 00:39:04 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201612180039.uBI0d4Gr067974@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Sun, 18 Dec 2016 00:39:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r310195 - stable/11/sys/x86/acpica X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Dec 2016 00:39:05 -0000 Author: kib Date: Sun Dec 18 00:39:04 2016 New Revision: 310195 URL: https://svnweb.freebsd.org/changeset/base/310195 Log: MFC r309854: Prefix hex memory addresses with 0x in diagnostic messages from the SRAT parser. Modified: stable/11/sys/x86/acpica/srat.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/x86/acpica/srat.c ============================================================================== --- stable/11/sys/x86/acpica/srat.c Sat Dec 17 22:34:19 2016 (r310194) +++ stable/11/sys/x86/acpica/srat.c Sun Dec 18 00:39:04 2016 (r310195) @@ -228,7 +228,7 @@ srat_parse_entry(ACPI_SUBTABLE_HEADER *e mem = (ACPI_SRAT_MEM_AFFINITY *)entry; if (bootverbose) printf( - "SRAT: Found memory domain %d addr %jx len %jx: %s\n", + "SRAT: Found memory domain %d addr 0x%jx len 0x%jx: %s\n", mem->ProximityDomain, (uintmax_t)mem->BaseAddress, (uintmax_t)mem->Length, (mem->Flags & ACPI_SRAT_MEM_ENABLED) ? @@ -237,7 +237,7 @@ srat_parse_entry(ACPI_SUBTABLE_HEADER *e break; if (!overlaps_phys_avail(mem->BaseAddress, mem->BaseAddress + mem->Length)) { - printf("SRAT: Ignoring memory at addr %jx\n", + printf("SRAT: Ignoring memory at addr 0x%jx\n", (uintmax_t)mem->BaseAddress); break; } @@ -334,7 +334,7 @@ check_phys_avail(void) address = mem_info[i].end + 1; } } - printf("SRAT: No memory region found for %jx - %jx\n", + printf("SRAT: No memory region found for 0x%jx - 0x%jx\n", (uintmax_t)phys_avail[j], (uintmax_t)phys_avail[j + 1]); return (ENXIO); } From owner-svn-src-all@freebsd.org Sun Dec 18 00:44:44 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id BF258C71D15; Sun, 18 Dec 2016 00:44:44 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 75CB4228; Sun, 18 Dec 2016 00:44:44 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBI0ihsk072198; Sun, 18 Dec 2016 00:44:43 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBI0ihWr072197; Sun, 18 Dec 2016 00:44:43 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201612180044.uBI0ihWr072197@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Ngie Cooper Date: Sun, 18 Dec 2016 00:44:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310196 - head/usr.sbin/bsnmpd/modules/snmp_bridge X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Dec 2016 00:44:44 -0000 Author: ngie Date: Sun Dec 18 00:44:43 2016 New Revision: 310196 URL: https://svnweb.freebsd.org/changeset/base/310196 Log: Fix some minor typos with begemotBridgeTpLearnedEntryDiscards and begemotBridgeTpMaxAddresses Bump LAST-UPDATED for the MIB, per the change MFC after: 1 week Modified: head/usr.sbin/bsnmpd/modules/snmp_bridge/BEGEMOT-BRIDGE-MIB.txt Modified: head/usr.sbin/bsnmpd/modules/snmp_bridge/BEGEMOT-BRIDGE-MIB.txt ============================================================================== --- head/usr.sbin/bsnmpd/modules/snmp_bridge/BEGEMOT-BRIDGE-MIB.txt Sun Dec 18 00:39:04 2016 (r310195) +++ head/usr.sbin/bsnmpd/modules/snmp_bridge/BEGEMOT-BRIDGE-MIB.txt Sun Dec 18 00:44:43 2016 (r310196) @@ -41,7 +41,7 @@ IMPORTS FROM BEGEMOT-MIB; begemotBridge MODULE-IDENTITY - LAST-UPDATED "200708060000Z" + LAST-UPDATED "201612170000Z" ORGANIZATION "Sofia University St. Kliment Ohridski" CONTACT-INFO " Shteryana Shopova @@ -56,6 +56,9 @@ begemotBridge MODULE-IDENTITY E-Mail: syrinx@FreeBSD.org" DESCRIPTION "The Begemot MIB for managing bridge interfaces." + REVISION "201612170000Z" + DESCRIPTION + "Address some minor typos and grammar mistakes." REVISION "200708060000Z" DESCRIPTION "Third revision adds begemotBridgeBasePortPrivate @@ -856,7 +859,7 @@ begemotBridgeTpLearnedEntryDiscards OBJE DESCRIPTION "The total number of Forwarding Database entries that would have been learnt, but have been discarded due to Forwarding - Address Table having reached it's maximum entries limit." + Address Table having reached its maximum entries limit." ::= { begemotBridgeTpEntry 1 } begemotBridgeTpAgingTime OBJECT-TYPE @@ -874,7 +877,7 @@ begemotBridgeTpMaxAddresses OBJECT-TYPE MAX-ACCESS read-write STATUS current DESCRIPTION - "The maximum number of entires that this bridge can + "The maximum number of entries that this bridge can learn in its Forwarding Address Table and use for making forwarding decisions." ::= { begemotBridgeTpEntry 3 } From owner-svn-src-all@freebsd.org Sun Dec 18 01:52:18 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5739EC71192; Sun, 18 Dec 2016 01:52:18 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 19BEA1260; Sun, 18 Dec 2016 01:52:18 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBI1qHK5099022; Sun, 18 Dec 2016 01:52:17 GMT (envelope-from bapt@FreeBSD.org) Received: (from bapt@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBI1qHJr099019; Sun, 18 Dec 2016 01:52:17 GMT (envelope-from bapt@FreeBSD.org) Message-Id: <201612180152.uBI1qHJr099019@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bapt set sender to bapt@FreeBSD.org using -f From: Baptiste Daroussin Date: Sun, 18 Dec 2016 01:52:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310197 - in head/tools/tools/locale: . etc X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Dec 2016 01:52:18 -0000 Author: bapt Date: Sun Dec 18 01:52:16 2016 New Revision: 310197 URL: https://svnweb.freebsd.org/changeset/base/310197 Log: Prepare import of CLDR v30.3 and unicode 9.0.0 Upstream kk_Cyrl_KZ has been renamed kk_KZ Upstream mn_Cyrl_MN has been renamed mn_MN For ru_RU: the default currency for unicode is now ₽ which is not mapped to other encoding, add charmaps entries to be able to generate them Modified: head/tools/tools/locale/Makefile head/tools/tools/locale/etc/charmaps.xml head/tools/tools/locale/etc/unicode.conf Modified: head/tools/tools/locale/Makefile ============================================================================== --- head/tools/tools/locale/Makefile Sun Dec 18 00:44:43 2016 (r310196) +++ head/tools/tools/locale/Makefile Sun Dec 18 01:52:16 2016 (r310197) @@ -118,7 +118,7 @@ BASE_LOCALES_OF_INTEREST?= \ nb_NO nl_BE nl_NL nn_NO pl_PL pt_BR pt_PT ro_RO \ ru_RU se_FI se_NO sk_SK sl_SI sv_FI sv_SE tr_TR \ uk_UA \ - kk_Cyrl_KZ mn_Cyrl_MN sr_Cyrl_RS sr_Latn_RS \ + kk_KZ mn_MN sr_Cyrl_RS sr_Latn_RS \ zh_Hans_CN zh_Hant_HK zh_Hant_TW \ bn_IN gu_IN or_IN ta_IN te_IN kn_IN ml_IN si_LK \ th_TH lo_LA bo_IN my_MM pa_Guru_IN ka_GE chr_US \ Modified: head/tools/tools/locale/etc/charmaps.xml ============================================================================== --- head/tools/tools/locale/etc/charmaps.xml Sun Dec 18 00:44:43 2016 (r310196) +++ head/tools/tools/locale/etc/charmaps.xml Sun Dec 18 01:52:16 2016 (r310197) @@ -117,7 +117,6 @@ encoding="SJIS eucJP" countries="JP" /> + + + + Modified: head/tools/tools/locale/etc/unicode.conf ============================================================================== --- head/tools/tools/locale/etc/unicode.conf Sun Dec 18 00:44:43 2016 (r310196) +++ head/tools/tools/locale/etc/unicode.conf Sun Dec 18 01:52:16 2016 (r310197) @@ -1,2 +1,4 @@ -cldr ~/unicode/cldr/27.0.1 -unidata ~/unicode/UNIDATA/8.0.0 +# $FreeBSD$ + +cldr ~/unicode/cldr/30.0.3 +unidata ~/unicode/UNIDATA/9.0.0 From owner-svn-src-all@freebsd.org Sun Dec 18 02:02:34 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id CF5CFC71629; Sun, 18 Dec 2016 02:02:34 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 9F07D1A50; Sun, 18 Dec 2016 02:02:34 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBI22XmX005423; Sun, 18 Dec 2016 02:02:33 GMT (envelope-from bapt@FreeBSD.org) Received: (from bapt@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBI22XCu005422; Sun, 18 Dec 2016 02:02:33 GMT (envelope-from bapt@FreeBSD.org) Message-Id: <201612180202.uBI22XCu005422@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bapt set sender to bapt@FreeBSD.org using -f From: Baptiste Daroussin Date: Sun, 18 Dec 2016 02:02:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310198 - head/tools/tools/locale/tools X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Dec 2016 02:02:34 -0000 Author: bapt Date: Sun Dec 18 02:02:33 2016 New Revision: 310198 URL: https://svnweb.freebsd.org/changeset/base/310198 Log: Simplify extraction of static collation definition Modified: head/tools/tools/locale/tools/extract-colldef.awk Modified: head/tools/tools/locale/tools/extract-colldef.awk ============================================================================== --- head/tools/tools/locale/tools/extract-colldef.awk Sun Dec 18 01:52:16 2016 (r310197) +++ head/tools/tools/locale/tools/extract-colldef.awk Sun Dec 18 02:02:33 2016 (r310198) @@ -5,14 +5,8 @@ BEGIN { print "# from CLDR project data, obtained from http://cldr.unicode.org/" print "# -----------------------------------------------------------------------------" } -$1 == "comment_char" { print $0 } -$1 == "escape_char" { print $0 } -$1 == "LC_COLLATE" { - print $0 - while (getline line) { - print line - if (line == "END LC_COLLATE") { - break - } - } -} +$1 == "comment_char" { print } +$1 == "escape_char" { print } +$1 == "LC_COLLATE" { doprint = 1 } +doprint == 1 { print } +$1 == "END" && $2 == "LC_COLLATE" { exit 0 } From owner-svn-src-all@freebsd.org Sun Dec 18 03:08:47 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7A661C8499E; Sun, 18 Dec 2016 03:08:47 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail108.syd.optusnet.com.au (mail108.syd.optusnet.com.au [211.29.132.59]) by mx1.freebsd.org (Postfix) with ESMTP id 026BB9A3; Sun, 18 Dec 2016 03:08:47 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from besplex.bde.org (c122-106-153-191.carlnfd1.nsw.optusnet.com.au [122.106.153.191]) by mail108.syd.optusnet.com.au (Postfix) with ESMTPS id CD1141A0706; Sun, 18 Dec 2016 14:08:36 +1100 (AEDT) Date: Sun, 18 Dec 2016 14:08:35 +1100 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Dimitry Andric cc: David Chisnall , Baptiste Daroussin , "Conrad E. Meyer" , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r310138 - head/lib/libc/stdio In-Reply-To: <0BDD9ECA-AF91-4CA7-AA5D-DC7AD36AE531@FreeBSD.org> Message-ID: <20161218134740.L955@besplex.bde.org> References: <201612160144.uBG1ipjW016736@repo.freebsd.org> <20161216193128.wgskqt4vc44vdd7o@ivaldir.etoilebsd.net> <00BFA847-B26A-453A-87DB-D5A55C1FAA38@FreeBSD.org> <0BDD9ECA-AF91-4CA7-AA5D-DC7AD36AE531@FreeBSD.org> MIME-Version: 1.0 X-Optus-CM-Score: 0 X-Optus-CM-Analysis: v=2.2 cv=cZeiljLM c=1 sm=1 tr=0 a=Tj3pCpwHnMupdyZSltBt7Q==:117 a=Tj3pCpwHnMupdyZSltBt7Q==:17 a=nlC_4_pT8q9DhB4Ho9EA:9 a=6I5d2MoRAAAA:8 a=NMMmldDwOF9AJvgmeHMA:9 a=45ClL6m2LaAA:10 a=IjZwj45LgO3ly-622nXo:22 Content-Type: TEXT/PLAIN; charset=X-UNKNOWN; format=flowed Content-Transfer-Encoding: QUOTED-PRINTABLE X-Content-Filtered-By: Mailman/MimeDel 2.1.23 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Dec 2016 03:08:47 -0000 On Sat, 17 Dec 2016, Dimitry Andric wrote: > On 17 Dec 2016, at 12:46, David Chisnall wrote: >> >> On 16 Dec 2016, at 19:31, Baptiste Daroussin wrote: >>> >>> Other than that, it makes more difficult to use vanilla gcc with out us= erland. >>> and it is adding more complexity to be able to build freebsd from a non= freebsd >>> system which some people are working on. >> >> Why? You=E2=80=99ll get some spurious warnings about printf, but that= =E2=80=99s all. > > Unfortunately, we compile large parts of the tree with -Werror. Thus, > "spurious warnings" will break the build, leaving the user two options: > disabling -Wformat warnings, or disabling -Werror altogether, neither of > which are very recommendable. > > As far as I know, there is no -Wno-error-on-undefined-printf-specifiers. > It would also be hard to implement, since after any undefined specifiers > have been encountered, you cannot reason about the following ones > anymore either. > > IMHO, if people want to use non-standard specifiers, let them define > their own almost_printf_but_not_quite() functions, and forgo any format > checking. That would be worse than breaking format checking for the selected set of printf()s. It gives even more unportability. %b is a BSDism that would be detected at compile time on systems without support for %b in printf(). almost_printf_but_not_quite() is a FreeBSDism that would be detected at compile time on systems without the function. Using it breaks portability even to other BSD systems including previous versions of FreeBSD. People who want to use non-standard specifiers added support to check them the compiler. Bruce From owner-svn-src-all@freebsd.org Sun Dec 18 04:11:14 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 36E82C8644C; Sun, 18 Dec 2016 04:11:14 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 11A9AC8E; Sun, 18 Dec 2016 04:11:13 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBI4BDng057417; Sun, 18 Dec 2016 04:11:13 GMT (envelope-from bapt@FreeBSD.org) Received: (from bapt@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBI4BDML057416; Sun, 18 Dec 2016 04:11:13 GMT (envelope-from bapt@FreeBSD.org) Message-Id: <201612180411.uBI4BDML057416@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bapt set sender to bapt@FreeBSD.org using -f From: Baptiste Daroussin Date: Sun, 18 Dec 2016 04:11:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310199 - head/tools/tools/locale/tools X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Dec 2016 04:11:14 -0000 Author: bapt Date: Sun Dec 18 04:11:13 2016 New Revision: 310199 URL: https://svnweb.freebsd.org/changeset/base/310199 Log: Better handle posix names for locales Modified: head/tools/tools/locale/tools/finalize Modified: head/tools/tools/locale/tools/finalize ============================================================================== --- head/tools/tools/locale/tools/finalize Sun Dec 18 02:02:33 2016 (r310198) +++ head/tools/tools/locale/tools/finalize Sun Dec 18 04:11:13 2016 (r310199) @@ -41,20 +41,29 @@ AWKCMD="/## PLACEHOLDER/ { \ # Rename the sources with 3 components name into the POSIX version of the name using @modifier cd $old +pwd for i in *_*_*.*.src; do + if [ "$i" = "*_*_*.*.src" ]; then + break + fi oldname=${i%.*} nname=`echo $oldname | awk '{ split($0, a, "_"); print a[1]"_"a[3]"@"a[2];} '` - mv -i ${oldname}.src ${nname}.src + mv -f ${oldname}.src ${nname}.src + sed -i '' -e "s/${oldname}/${nname}/g" Makefile + COLLATIONS_SPECIAL=$(echo ${COLLATIONS_SPECIAL} | sed -e "s/${oldname}/${nname}/g") done - sed -i '' -Ee "s/([a-zA-Z]{2})_([a-zA-Z]+)_([a-zA-Z]{2}).([a-zA-Z0-9-]+)/\1_\3.\4@\2/g" ${old}/Makefile # For variable without @modifier ambiguity do not keep the @modifier for i in *@*.src; do + if [ "$i" = "*@*.src" ]; then + break + fi oldname=${i%.*} shortname=${oldname%@*} - if [ $(ls ${shortname}@* | wc -l) -eq 1 -a ! -f ${shortname}.src ] ; then - mv -i $i ${shortname}.src - sed -i '' -e "s/${oldname}/${shortname}/g" ${old}/Makefile + if [ $(ls ${shortname}@* | wc -l) -eq 1 ] ; then + mv -f $i ${shortname}.src + sed -i '' -e "s/${oldname}/${shortname}/g" Makefile + COLLATIONS_SPECIAL=$(echo ${COLLATIONS_SPECIAL} | sed -e "s/${oldname}/${shortname}/g") fi done @@ -63,16 +72,19 @@ for i in *@Latn.src; do if [ "$i" = "*@Latn.src" ]; then break fi - mv ${i} ${i%@*}@latin.src + mv -f ${i} ${i%@*}@latin.src + sed -i '' -e "s/${i%.*}/${i%@*}@latin/g" Makefile + COLLATIONS_SPECIAL=$(echo ${COLLATIONS_SPECIAL} | sed -e "s/${i%.*}/${i%@*}@latin/g") done - sed -i '' -e "s/@Latn/@latin/g" ${old}/Makefile + for i in *@Cyrl.src; do if [ "$i" = "*@Cyrl.src" ]; then break fi - mv ${i} ${i%@*}@cyrillic.src + mv -f ${i} ${i%@*}@cyrillic.src + sed -i '' -e "s/${i%.*}/${i%@*}@cyrillic/g" Makefile + COLLATIONS_SPECIAL=$(echo ${COLLATIONS_SPECIAL} | sed -e "s/${i%.*}/${i%@*}@cyrillic/g") done - sed -i '' -e "s/@Cyrl/@cyrillic/g" ${old}/Makefile # On locales with multiple modifiers rename the "default" version without the @modifier default_locales="sr_RS@cyrillic" @@ -83,8 +95,8 @@ for i in ${default_locales}; do if [ "$l" = "${localename}.*@${mod}.src" ]; then break fi - mv ${l} ${l%@*}.src - sed -i '' -e "s/${l%.*}/${l%@*}/g" ${old}/Makefile + mv -f ${l} ${l%@*}.src + sed -i '' -e "s/${l%.*}/${l%@*}/g" Makefile done done cd - @@ -146,13 +158,12 @@ then done echo "" >> ${TEMP4} for enc in ${COLLATIONS_SPECIAL}; do - nname=`echo $enc | sed -e 's/_Hans//g'` - sed -i '' "/^.*${nname}$/d" ${TEMP4} - echo "LOCALES+= ${nname}" >> ${TEMP4} + sed -i '' "/^.*${enc}$/d" ${TEMP4} + echo "LOCALES+= ${enc}" >> ${TEMP4} done keep=$(cat ${TEMP} | awk '{ print $2 }') - for original in ${keep} + for original in ${keep} ${COLLATIONS_SPECIAL} do cp ${old}/${original}.src ${new}/ done From owner-svn-src-all@freebsd.org Sun Dec 18 04:12:46 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 95E0AC86559; Sun, 18 Dec 2016 04:12:46 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 6559110B4; Sun, 18 Dec 2016 04:12:46 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBI4CjEf058338; Sun, 18 Dec 2016 04:12:45 GMT (envelope-from bapt@FreeBSD.org) Received: (from bapt@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBI4CjhI058337; Sun, 18 Dec 2016 04:12:45 GMT (envelope-from bapt@FreeBSD.org) Message-Id: <201612180412.uBI4CjhI058337@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bapt set sender to bapt@FreeBSD.org using -f From: Baptiste Daroussin Date: Sun, 18 Dec 2016 04:12:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310200 - head/tools/tools/locale X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Dec 2016 04:12:46 -0000 Author: bapt Date: Sun Dec 18 04:12:45 2016 New Revision: 310200 URL: https://svnweb.freebsd.org/changeset/base/310200 Log: In order to prepare cldr v30.0.3 and unicode 9.0.0, more locales are removed from automatic mapping from unicode as their encoding does not supports new characters available in unicode Modified: head/tools/tools/locale/Makefile Modified: head/tools/tools/locale/Makefile ============================================================================== --- head/tools/tools/locale/Makefile Sun Dec 18 04:11:13 2016 (r310199) +++ head/tools/tools/locale/Makefile Sun Dec 18 04:12:45 2016 (r310200) @@ -31,8 +31,16 @@ COLLATION_SPECIAL?= \ nb_NO ISO8859-1 \ nb_NO ISO8859-15 \ sk_SK ISO8859-2 \ + sr_Latn_RS ISO8859-2 \ + sr_Cyrl_RS ISO8859-5 \ zh_Hans_CN GB2312 \ zh_Hans_CN eucCN \ + zh_Hant_TW Big5 \ + zh_Hans_CN GB18030 \ + zh_Hans_CN GBK \ + ja_JP eucJP \ + nn_NO ISO8859-15 \ + nn_NO ISO8859-1 .for area enc in ${COLLATION_SPECIAL} COLLATIONS_SPECIAL_ENV+= ${area}.${enc} @@ -91,7 +99,7 @@ build-colldef: static-colldef static-colldef: .for area enc in ${COLLATION_SPECIAL} - awk -f tools/extract-colldef.awk ${CLDRDIR}/posix/${area}.${enc}.src > colldef/${area}.${enc}.src + awk -f tools/extract-colldef.awk ${CLDRDIR}/posix/${area}.${enc}.src > colldef.draft/${area}.${enc}.src .endfor transfer-rollup: From owner-svn-src-all@freebsd.org Sun Dec 18 04:17:14 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id F2193C866AB; Sun, 18 Dec 2016 04:17:14 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 9688E135B; Sun, 18 Dec 2016 04:17:14 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBI4HDJm058567; Sun, 18 Dec 2016 04:17:13 GMT (envelope-from bapt@FreeBSD.org) Received: (from bapt@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBI4HDDL058563; Sun, 18 Dec 2016 04:17:13 GMT (envelope-from bapt@FreeBSD.org) Message-Id: <201612180417.uBI4HDDL058563@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bapt set sender to bapt@FreeBSD.org using -f From: Baptiste Daroussin Date: Sun, 18 Dec 2016 04:17:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310201 - in head: share/colldef share/ctypedef share/monetdef share/msgdef share/numericdef tools/tools/locale/etc tools/tools/locale/etc/final-maps X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Dec 2016 04:17:15 -0000 Author: bapt Date: Sun Dec 18 04:17:13 2016 New Revision: 310201 URL: https://svnweb.freebsd.org/changeset/base/310201 Log: Update locales cldr to v30.0.3 and unicode to 9.0.0 MFC after: 1 month Relnotes: yes Added: head/share/colldef/fr_CA.UTF-8.src (contents, props changed) head/share/colldef/ja_JP.eucJP.src (contents, props changed) head/share/colldef/nn_NO.ISO8859-1.src (contents, props changed) head/share/colldef/nn_NO.ISO8859-15.src (contents, props changed) head/share/colldef/nn_NO.UTF-8.src (contents, props changed) head/share/colldef/sr_RS.ISO8859-2.src (contents, props changed) head/share/colldef/sr_RS.ISO8859-5.src (contents, props changed) head/share/colldef/sr_RS.UTF-8.src (contents, props changed) head/share/colldef/sr_RS.UTF-8@latin.src (contents, props changed) head/share/colldef/zh_CN.GB18030.src (contents, props changed) head/share/colldef/zh_CN.GBK.src (contents, props changed) head/share/colldef/zh_TW.Big5.src (contents, props changed) head/share/ctypedef/ja_JP.eucJP.src (contents, props changed) head/share/ctypedef/zh_CN.eucCN.src (contents, props changed) head/share/monetdef/nl_BE.UTF-8.src (contents, props changed) head/tools/tools/locale/etc/final-maps/map.CP949 - copied unchanged from r303786, head/tools/tools/locale/etc/final-maps/map.eucKR Deleted: head/share/colldef/hr_HR.UTF-8.src head/share/colldef/nb_NO.UTF-8.src head/share/ctypedef/ja_JP.SJIS.src head/share/ctypedef/zh_CN.GB18030.src head/share/monetdef/be_BY.CP1251.src head/share/monetdef/lv_LV.ISO8859-13.src head/share/monetdef/lv_LV.UTF-8.src head/share/monetdef/ru_RU.CP1251.src head/share/msgdef/he_IL.UTF-8.src head/share/numericdef/hy_AM.UTF-8.src Modified: head/share/colldef/Makefile head/share/colldef/af_ZA.UTF-8.src head/share/colldef/am_ET.UTF-8.src head/share/colldef/ar_SA.UTF-8.src head/share/colldef/be_BY.UTF-8.src head/share/colldef/ca_AD.UTF-8.src head/share/colldef/cs_CZ.ISO8859-2.src head/share/colldef/cs_CZ.UTF-8.src head/share/colldef/da_DK.ISO8859-1.src head/share/colldef/da_DK.ISO8859-15.src head/share/colldef/da_DK.UTF-8.src head/share/colldef/el_GR.UTF-8.src head/share/colldef/en_US.UTF-8.src head/share/colldef/es_MX.UTF-8.src head/share/colldef/et_EE.UTF-8.src head/share/colldef/fi_FI.UTF-8.src head/share/colldef/he_IL.UTF-8.src head/share/colldef/hi_IN.UTF-8.src head/share/colldef/hr_HR.ISO8859-2.src head/share/colldef/hu_HU.ISO8859-2.src head/share/colldef/hu_HU.UTF-8.src head/share/colldef/hy_AM.UTF-8.src head/share/colldef/is_IS.UTF-8.src head/share/colldef/ja_JP.UTF-8.src head/share/colldef/kk_KZ.UTF-8.src head/share/colldef/ko_KR.UTF-8.src head/share/colldef/lt_LT.UTF-8.src head/share/colldef/lv_LV.UTF-8.src head/share/colldef/nb_NO.ISO8859-1.src head/share/colldef/nb_NO.ISO8859-15.src head/share/colldef/pl_PL.UTF-8.src head/share/colldef/ro_RO.UTF-8.src head/share/colldef/ru_RU.UTF-8.src head/share/colldef/se_NO.UTF-8.src head/share/colldef/sk_SK.ISO8859-2.src head/share/colldef/sk_SK.UTF-8.src head/share/colldef/sl_SI.UTF-8.src head/share/colldef/sv_SE.UTF-8.src head/share/colldef/tr_TR.UTF-8.src head/share/colldef/uk_UA.UTF-8.src head/share/colldef/zh_CN.GB2312.src head/share/colldef/zh_CN.UTF-8.src head/share/colldef/zh_CN.eucCN.src head/share/colldef/zh_TW.UTF-8.src head/share/ctypedef/Makefile head/share/ctypedef/be_BY.CP1131.src head/share/ctypedef/ca_IT.ISO8859-1.src head/share/ctypedef/en_US.ISO8859-1.src head/share/ctypedef/en_US.UTF-8.src head/share/ctypedef/hi_IN.ISCII-DEV.src head/share/ctypedef/uk_UA.CP1251.src head/share/monetdef/Makefile head/share/monetdef/ar_AE.UTF-8.src head/share/monetdef/ar_EG.UTF-8.src head/share/monetdef/ar_JO.UTF-8.src head/share/monetdef/ar_QA.UTF-8.src head/share/monetdef/ar_SA.UTF-8.src head/share/monetdef/be_BY.CP1131.src head/share/monetdef/be_BY.ISO8859-5.src head/share/monetdef/be_BY.UTF-8.src head/share/monetdef/bg_BG.CP1251.src head/share/monetdef/bg_BG.UTF-8.src head/share/monetdef/es_AR.UTF-8.src head/share/monetdef/es_CR.UTF-8.src head/share/monetdef/hu_HU.ISO8859-2.src head/share/monetdef/hu_HU.UTF-8.src head/share/monetdef/hy_AM.ARMSCII-8.src head/share/monetdef/hy_AM.UTF-8.src head/share/monetdef/ru_RU.CP866.src head/share/monetdef/ru_RU.ISO8859-5.src head/share/monetdef/ru_RU.KOI8-R.src head/share/monetdef/ru_RU.UTF-8.src head/share/monetdef/sl_SI.UTF-8.src head/share/monetdef/tr_TR.ISO8859-9.src head/share/monetdef/tr_TR.UTF-8.src head/share/monetdef/zh_CN.GB2312.src head/share/monetdef/zh_CN.GBK.src head/share/monetdef/zh_CN.UTF-8.src head/share/monetdef/zh_CN.eucCN.src head/share/monetdef/zh_TW.Big5.src head/share/monetdef/zh_TW.UTF-8.src head/share/msgdef/Makefile head/share/msgdef/ja_JP.SJIS.src head/share/msgdef/ja_JP.UTF-8.src head/share/msgdef/ja_JP.eucJP.src head/share/msgdef/tr_TR.ISO8859-9.src head/share/msgdef/tr_TR.UTF-8.src head/share/numericdef/Makefile head/tools/tools/locale/etc/common.UTF-8.src (contents, props changed) head/tools/tools/locale/etc/final-maps/map.GB2312 head/tools/tools/locale/etc/final-maps/map.UTF-8 (contents, props changed) Modified: head/share/colldef/Makefile ============================================================================== --- head/share/colldef/Makefile Sun Dec 18 04:12:45 2016 (r310200) +++ head/share/colldef/Makefile Sun Dec 18 04:17:13 2016 (r310201) @@ -23,9 +23,9 @@ LOCALES+= en_US.UTF-8 LOCALES+= es_MX.UTF-8 LOCALES+= et_EE.UTF-8 LOCALES+= fi_FI.UTF-8 +LOCALES+= fr_CA.UTF-8 LOCALES+= he_IL.UTF-8 LOCALES+= hi_IN.UTF-8 -LOCALES+= hr_HR.UTF-8 LOCALES+= hu_HU.UTF-8 LOCALES+= hy_AM.UTF-8 LOCALES+= is_IS.UTF-8 @@ -34,13 +34,15 @@ LOCALES+= kk_KZ.UTF-8 LOCALES+= ko_KR.UTF-8 LOCALES+= lt_LT.UTF-8 LOCALES+= lv_LV.UTF-8 -LOCALES+= nb_NO.UTF-8 +LOCALES+= nn_NO.UTF-8 LOCALES+= pl_PL.UTF-8 LOCALES+= ro_RO.UTF-8 LOCALES+= ru_RU.UTF-8 LOCALES+= se_NO.UTF-8 LOCALES+= sk_SK.UTF-8 LOCALES+= sl_SI.UTF-8 +LOCALES+= sr_RS.UTF-8 +LOCALES+= sr_RS.UTF-8@latin LOCALES+= sv_SE.UTF-8 LOCALES+= tr_TR.UTF-8 LOCALES+= uk_UA.UTF-8 @@ -52,7 +54,6 @@ LOCALES_MAPPED+= af_ZA.UTF-8 af_ZA.ISO88 LOCALES_MAPPED+= be_BY.UTF-8 be_BY.ISO8859-5 LOCALES_MAPPED+= be_BY.UTF-8 be_BY.CP1251 LOCALES_MAPPED+= be_BY.UTF-8 be_BY.CP1131 -LOCALES_MAPPED+= ru_RU.UTF-8 sr_RS.ISO8859-5 LOCALES_MAPPED+= ru_RU.UTF-8 ru_RU.KOI8-R LOCALES_MAPPED+= ru_RU.UTF-8 ru_RU.ISO8859-5 LOCALES_MAPPED+= ru_RU.UTF-8 ru_RU.CP866 @@ -66,13 +67,9 @@ LOCALES_MAPPED+= ca_AD.UTF-8 ca_ES.ISO88 LOCALES_MAPPED+= ca_AD.UTF-8 ca_ES.ISO8859-1 LOCALES_MAPPED+= ca_AD.UTF-8 ca_AD.ISO8859-15 LOCALES_MAPPED+= ca_AD.UTF-8 ca_AD.ISO8859-1 -LOCALES_MAPPED+= en_US.UTF-8 sr_RS.UTF-8@latin -LOCALES_MAPPED+= en_US.UTF-8 sr_RS.ISO8859-2 LOCALES_MAPPED+= en_US.UTF-8 pt_PT.ISO8859-15 LOCALES_MAPPED+= en_US.UTF-8 pt_PT.ISO8859-1 LOCALES_MAPPED+= en_US.UTF-8 pt_BR.ISO8859-1 -LOCALES_MAPPED+= en_US.UTF-8 nn_NO.ISO8859-15 -LOCALES_MAPPED+= en_US.UTF-8 nn_NO.ISO8859-1 LOCALES_MAPPED+= en_US.UTF-8 nl_NL.ISO8859-15 LOCALES_MAPPED+= en_US.UTF-8 nl_NL.ISO8859-1 LOCALES_MAPPED+= en_US.UTF-8 nl_BE.ISO8859-15 @@ -85,8 +82,6 @@ LOCALES_MAPPED+= en_US.UTF-8 fr_FR.ISO88 LOCALES_MAPPED+= en_US.UTF-8 fr_FR.ISO8859-1 LOCALES_MAPPED+= en_US.UTF-8 fr_CH.ISO8859-15 LOCALES_MAPPED+= en_US.UTF-8 fr_CH.ISO8859-1 -LOCALES_MAPPED+= en_US.UTF-8 fr_CA.ISO8859-15 -LOCALES_MAPPED+= en_US.UTF-8 fr_CA.ISO8859-1 LOCALES_MAPPED+= en_US.UTF-8 fr_BE.ISO8859-15 LOCALES_MAPPED+= en_US.UTF-8 fr_BE.ISO8859-1 LOCALES_MAPPED+= en_US.UTF-8 eu_ES.ISO8859-15 @@ -128,12 +123,14 @@ LOCALES_MAPPED+= et_EE.UTF-8 et_EE.ISO88 LOCALES_MAPPED+= et_EE.UTF-8 et_EE.ISO8859-1 LOCALES_MAPPED+= fi_FI.UTF-8 fi_FI.ISO8859-15 LOCALES_MAPPED+= fi_FI.UTF-8 fi_FI.ISO8859-1 +LOCALES_MAPPED+= fr_CA.UTF-8 fr_CA.ISO8859-15 +LOCALES_MAPPED+= fr_CA.UTF-8 fr_CA.ISO8859-1 LOCALES_MAPPED+= hi_IN.UTF-8 hi_IN.ISCII-DEV +LOCALES_MAPPED+= sr_RS.UTF-8@latin hr_HR.UTF-8 LOCALES_MAPPED+= hy_AM.UTF-8 hy_AM.ARMSCII-8 LOCALES_MAPPED+= is_IS.UTF-8 is_IS.ISO8859-15 LOCALES_MAPPED+= is_IS.UTF-8 is_IS.ISO8859-1 LOCALES_MAPPED+= ja_JP.UTF-8 ja_JP.SJIS -LOCALES_MAPPED+= ja_JP.UTF-8 ja_JP.eucJP LOCALES_MAPPED+= ko_KR.UTF-8 ko_KR.eucKR LOCALES_MAPPED+= lt_LT.UTF-8 lt_LT.ISO8859-13 LOCALES_MAPPED+= lv_LV.UTF-8 lv_LV.ISO8859-13 @@ -148,9 +145,6 @@ LOCALES_MAPPED+= tr_TR.UTF-8 tr_TR.ISO88 LOCALES_MAPPED+= uk_UA.UTF-8 uk_UA.KOI8-U LOCALES_MAPPED+= uk_UA.UTF-8 uk_UA.ISO8859-5 LOCALES_MAPPED+= uk_UA.UTF-8 uk_UA.CP1251 -LOCALES_MAPPED+= zh_CN.UTF-8 zh_CN.GBK -LOCALES_MAPPED+= zh_CN.UTF-8 zh_CN.GB18030 -LOCALES_MAPPED+= zh_TW.UTF-8 zh_TW.Big5 LOCALES+= cs_CZ.ISO8859-2 LOCALES+= da_DK.ISO8859-1 @@ -160,8 +154,16 @@ LOCALES+= hu_HU.ISO8859-2 LOCALES+= nb_NO.ISO8859-1 LOCALES+= nb_NO.ISO8859-15 LOCALES+= sk_SK.ISO8859-2 +LOCALES+= sr_RS.ISO8859-2 +LOCALES+= sr_RS.ISO8859-5 LOCALES+= zh_CN.GB2312 LOCALES+= zh_CN.eucCN +LOCALES+= zh_TW.Big5 +LOCALES+= zh_CN.GB18030 +LOCALES+= zh_CN.GBK +LOCALES+= ja_JP.eucJP +LOCALES+= nn_NO.ISO8859-15 +LOCALES+= nn_NO.ISO8859-1 SAME+= ar_SA.UTF-8 ar_QA.UTF-8 @@ -169,7 +171,6 @@ SAME+= ar_SA.UTF-8 ar_MA.UTF-8 SAME+= ar_SA.UTF-8 ar_JO.UTF-8 SAME+= ar_SA.UTF-8 ar_EG.UTF-8 SAME+= ar_SA.UTF-8 ar_AE.UTF-8 -SAME+= ru_RU.UTF-8 sr_RS.UTF-8 SAME+= ru_RU.UTF-8 mn_MN.UTF-8 SAME+= ru_RU.UTF-8 bg_BG.UTF-8 SAME+= ca_AD.UTF-8 ca_IT.UTF-8 @@ -177,14 +178,12 @@ SAME+= ca_AD.UTF-8 ca_FR.UTF-8 SAME+= ca_AD.UTF-8 ca_ES.UTF-8 SAME+= en_US.UTF-8 pt_PT.UTF-8 SAME+= en_US.UTF-8 pt_BR.UTF-8 -SAME+= en_US.UTF-8 nn_NO.UTF-8 SAME+= en_US.UTF-8 nl_NL.UTF-8 SAME+= en_US.UTF-8 nl_BE.UTF-8 SAME+= en_US.UTF-8 it_IT.UTF-8 SAME+= en_US.UTF-8 it_CH.UTF-8 SAME+= en_US.UTF-8 fr_FR.UTF-8 SAME+= en_US.UTF-8 fr_CH.UTF-8 -SAME+= en_US.UTF-8 fr_CA.UTF-8 SAME+= en_US.UTF-8 fr_BE.UTF-8 SAME+= en_US.UTF-8 eu_ES.UTF-8 SAME+= en_US.UTF-8 en_ZA.UTF-8 @@ -202,6 +201,7 @@ SAME+= en_US.UTF-8 de_AT.UTF-8 SAME+= es_MX.UTF-8 es_ES.UTF-8 SAME+= es_MX.UTF-8 es_CR.UTF-8 SAME+= es_MX.UTF-8 es_AR.UTF-8 +SAME+= nn_NO.UTF-8 nb_NO.UTF-8 SAME+= se_NO.UTF-8 se_FI.UTF-8 SAME+= sv_SE.UTF-8 sv_FI.UTF-8 SAME+= zh_TW.UTF-8 zh_HK.UTF-8 Modified: head/share/colldef/af_ZA.UTF-8.src ============================================================================== --- head/share/colldef/af_ZA.UTF-8.src Sun Dec 18 04:12:45 2016 (r310200) +++ head/share/colldef/af_ZA.UTF-8.src Sun Dec 18 04:17:13 2016 (r310201) @@ -42,7 +42,6 @@ collating-symbol collating-symbol collating-symbol collating-symbol -collating-symbol collating-symbol collating-symbol collating-symbol @@ -76,36 +75,36 @@ collating-symbol collating-symbol collating-symbol collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol collating-symbol collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol collating-symbol collating-symbol collating-symbol @@ -139,6 +138,7 @@ collating-symbol collating-symbol collating-symbol collating-symbol +collating-symbol collating-symbol collating-symbol collating-symbol @@ -312,6 +312,8 @@ collating-symbol collating-symbol collating-symbol collating-symbol +collating-symbol +collating-symbol collating-symbol collating-symbol collating-symbol @@ -471,14 +473,14 @@ collating-symbol collating-symbol collating-symbol collating-symbol -collating-symbol -collating-symbol -collating-symbol +collating-symbol +collating-symbol +collating-symbol collating-symbol +collating-symbol +collating-symbol collating-symbol collating-symbol -collating-symbol -collating-symbol collating-symbol collating-symbol collating-symbol @@ -489,6 +491,10 @@ collating-symbol collating-symbol collating-symbol collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol order_start forward;forward;forward;forward @@ -526,7 +532,6 @@ order_start forward;forward;forward;forw - @@ -560,36 +565,36 @@ order_start forward;forward;forward;forw - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + - - - - - - - - - - - - - + + + + + + + + + + + + + @@ -623,6 +628,7 @@ order_start forward;forward;forward;forw + @@ -796,6 +802,8 @@ order_start forward;forward;forward;forw + + @@ -955,14 +963,14 @@ order_start forward;forward;forward;forw - - - + + + + + - - @@ -973,6 +981,10 @@ order_start forward;forward;forward;forw + + + + * assignment of characters to weights @@ -1018,36 +1030,36 @@ order_start forward;forward;forward;forw ;;; ;;; ;;; - ;;; - ;;; - ;;; - ;;; - ;;; - ;;; - ;;; - ;;; - ;;; - ;;; - ;;; - ;;; - ;;; - ;;; - ;;; + ;;; + ;;; + ;;; + ;;; + ;;; + ;;; + ;;; + ;;; + ;;; + ;;; + ;;; + ;;; + ;;; + ;;; + ;;; ;;; ;;; - ;;; - ;;; - ;;; - ;;; - ;;; - ;;; - ;;; - ;;; - ;;; - ;;; - ;;; - ;;; - ;;; + ;;; + ;;; + ;;; + ;;; + ;;; + ;;; + ;;; + ;;; + ;;; + ;;; + ;;; + ;;; + ;;; ;;; ;;; ;;; @@ -1147,7 +1159,7 @@ order_start forward;forward;forward;forw "";"";""; "";"";""; "";"";""; - "";"";""; + "";"";""; ;;; ;;; ;;; @@ -1193,6 +1205,8 @@ order_start forward;forward;forward;forw ;;; ;;; ;;; + ;;; + ;;; ;;; ;;; ;;; @@ -1528,7 +1542,8 @@ order_start forward;forward;forward;forw "";"";""; ;;; ;;; - ;;; + ;;; + ;;; ;;; ;;; ;;; @@ -1558,7 +1573,8 @@ order_start forward;forward;forward;forw ;;; ;;; ;;; - ;;; + ;;; + ;;; ;;; ;;; ;;; @@ -1621,8 +1637,8 @@ order_start forward;forward;forward;forw ;"";""; ;"";""; ;"";""; - ;"";""; - ;"";""; + ;"";""; + ;"";""; "";"";""; "";"";""; "";"";""; @@ -1846,23 +1862,26 @@ order_start forward;forward;forward;forw ;;; ;;; ;;; - ;;; - ;;; - ;;; - ;;; - ;;; - ;;; - ;;; - ;;; - ;;; - ;;; - ;;; - ;;; - ;;; - ;;; - ;;; - ;;; - ;;; + ;;; + ;;; + ;;; + ;;; + ;;; + ;;; + ;;; + ;;; + ;;; + ;;; + ;;; + ;;; + ;;; + ;;; + ;;; + ;;; + ;;; + ;;; + ;;; + ;;;

;;;

;;;

;;;

@@ -2252,6 +2271,7 @@ order_start forward;forward;forward;forw ;;; ;;; ;;; + ;;; ;;; ;;; ;;; @@ -2344,52 +2364,56 @@ order_start forward;forward;forward;forw ;;; ;;; ;;; - ;;; - ;;; - ;;; - ;;; - ;;; - ;;; - ;;; - ;;; - ;;; - ;;; - ;;; - ;;; - ;;; - ;;; - ;;; - ;;; - ;;; - ;;; - ;;; - ;;; - ;;; - ;;; - ;;; - ;;; - ;;; - ;;; - ;;; - ;;; - ;;; - ;;; - ;;; - ;;; - ;;; - ;;; - ;;; - ;;; - ;;; - ;;; - ;;; - ;;; - ;;; - ;;; - ;;; - ;;; - ;;; - ;;; + ;;; + ;;; + ;;; + ;;; + ;;; + ;;; + ;;; + ;;; + ;;; + ;;; + ;;; + ;;; + ;;; + ;;; + ;;; + ;;; + ;;; + ;;; + ;;; + ;;; + ;;; + ;;; + ;;; + ;;; + ;;; + ;;; + ;;; + ;;; + ;;; + ;;; + ;;; + ;;; + ;;; + ;;; + ;;; + ;;; + ;;; + ;;; + ;;; + ;;; + ;;; + ;;; + ;;; + ;;; + ;;; + ;;; + ;;; + ;;; + ;;; + ;;; UNDEFINED IGNORE;IGNORE;IGNORE;... order_end Modified: head/share/colldef/am_ET.UTF-8.src ============================================================================== --- head/share/colldef/am_ET.UTF-8.src Sun Dec 18 04:12:45 2016 (r310200) +++ head/share/colldef/am_ET.UTF-8.src Sun Dec 18 04:17:13 2016 (r310201) @@ -13,13 +13,13 @@ LC_COLLATE collating-symbol collating-symbol -collating-symbol -collating-symbol +collating-symbol +collating-symbol +collating-symbol collating-symbol collating-symbol -collating-symbol collating-symbol -collating-symbol +collating-symbol collating-symbol collating-symbol collating-symbol @@ -46,51 +46,51 @@ collating-symbol collating-symbol collating-symbol collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol collating-symbol collating-symbol collating-symbol collating-symbol collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol collating-symbol -collating-symbol +collating-symbol collating-symbol collating-symbol collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol collating-symbol collating-symbol collating-symbol @@ -176,20 +176,20 @@ collating-symbol collating-symbol collating-symbol collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol +collating-symbol collating-symbol collating-symbol collating-symbol @@ -351,13 +351,13 @@ order_start forward;forward;forward;forw - - + + + - - + @@ -384,51 +384,51 @@ order_start forward;forward;forward;forw - - - - - - - - - - + + + + + + + + + + - - - - - - - + + + + + + + - - - - - - + + + + + + - + - - - - - - - - - - + + + + + + + + + + @@ -514,20 +514,20 @@ order_start forward;forward;forward;forw - - - - - - - - - - - - - + + + + + + + + + + + + + @@ -712,9 +712,9 @@ order_start forward;forward;forward;forw IGNORE;IGNORE;IGNORE; IGNORE;IGNORE;IGNORE; IGNORE;IGNORE;IGNORE; - IGNORE;"";""; - IGNORE;"";""; - IGNORE;"";""; + IGNORE;"";""; + IGNORE;"";""; + IGNORE;"";""; ;;; ;;; ;;; @@ -736,23 +736,23 @@ order_start forward;forward;forward;forw ;;; ;;; ;;; - ;;; - ;;; - ;;; - ;;; - ;;; - ;;; - ;;; - ;;; - ;;; - ;;; - ;;; - ;;; - ;;; - ;;; - ;;; - ;;; - ;;; + ;;; + ;;; + ;;; + ;;; + ;;; + ;;; + ;;; + ;;; + ;;; + ;;; + ;;; + ;;; + ;;; + ;;; + ;;; + ;;; + ;;; ;;; ;;; "";;""; @@ -765,24 +765,24 @@ order_start forward;forward;forward;forw "";;""; "";;""; "";;""; - ;;; - ;;; - ;;; - ;;; - ;;; - ;;; - ;;; - ;;; - ;;; - ;;; - ;;; - ;;; - ;;; - ;;; - ;;; - ;;; *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@freebsd.org Sun Dec 18 05:31:55 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A8BDAC8609E; Sun, 18 Dec 2016 05:31:55 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 6AFA01FAA; Sun, 18 Dec 2016 05:31:55 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBI5VsE9090666; Sun, 18 Dec 2016 05:31:54 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBI5VsIa090665; Sun, 18 Dec 2016 05:31:54 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201612180531.uBI5VsIa090665@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Ngie Cooper Date: Sun, 18 Dec 2016 05:31:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310202 - head/contrib/bsnmp/lib X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Dec 2016 05:31:55 -0000 Author: ngie Date: Sun Dec 18 05:31:54 2016 New Revision: 310202 URL: https://svnweb.freebsd.org/changeset/base/310202 Log: Clean up trailing and leading whitespace Fix variable type alignment in snmp_dialog(..) MFC after: 1 week Modified: head/contrib/bsnmp/lib/snmpclient.c Modified: head/contrib/bsnmp/lib/snmpclient.c ============================================================================== --- head/contrib/bsnmp/lib/snmpclient.c Sun Dec 18 04:17:13 2016 (r310201) +++ head/contrib/bsnmp/lib/snmpclient.c Sun Dec 18 05:31:54 2016 (r310202) @@ -8,7 +8,7 @@ * * Author: Harti Brandt * Kendy Kutzner - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: @@ -17,7 +17,7 @@ * 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 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 @@ -1236,23 +1236,23 @@ snmp_send_packet(struct snmp_pdu * pdu) return (-1); } - pdu->request_id = snmp_next_reqid(&snmp_client); + pdu->request_id = snmp_next_reqid(&snmp_client); - b.asn_ptr = buf; - b.asn_len = snmp_client.txbuflen; - if (snmp_pdu_encode(pdu, &b)) { + b.asn_ptr = buf; + b.asn_len = snmp_client.txbuflen; + if (snmp_pdu_encode(pdu, &b)) { seterr(&snmp_client, "%s", strerror(errno)); free(buf); return (-1); } - if (snmp_client.dump_pdus) - snmp_pdu_dump(pdu); + if (snmp_client.dump_pdus) + snmp_pdu_dump(pdu); - if ((ret = send(snmp_client.fd, buf, b.asn_ptr - buf, 0)) == -1) { + if ((ret = send(snmp_client.fd, buf, b.asn_ptr - buf, 0)) == -1) { seterr(&snmp_client, "%s", strerror(errno)); free(buf); - return (-1); + return (-1); } free(buf); @@ -1269,7 +1269,7 @@ snmp_timeout(void * listentry_ptr) #if 0 warnx("snmp request %i timed out, attempt (%i/%i)", - listentry->reqid, listentry->retrycount, snmp_client.retries); + listentry->reqid, listentry->retrycount, snmp_client.retries); #endif listentry->retrycount++; @@ -1314,7 +1314,7 @@ snmp_pdu_send(struct snmp_pdu *pdu, snmp listentry->callback = func; listentry->arg = arg; listentry->retrycount=1; - listentry->timeout_id = + listentry->timeout_id = snmp_client.timeout_start(&snmp_client.timeout, snmp_timeout, listentry); @@ -1463,7 +1463,7 @@ snmp_receive_packet(struct snmp_pdu *pdu return (+1); } -static int +static int snmp_deliver_packet(struct snmp_pdu * resp) { struct sent_pdu *listentry; @@ -1548,7 +1548,7 @@ ok_getnext(const struct snmp_pdu * req, &resp->bindings[i].var)) { if (i != 0) warnx("SNMP GETNEXT: inconsistent table " - "response"); + "response"); return (0); } if (resp->version != SNMP_V1 && @@ -1654,7 +1654,7 @@ ok_set(const struct snmp_pdu * req, cons /* * Simple checks for response PDUs against request PDUs. Return values: 1=ok, - * 0=nosuchname or similar, -1=failure, -2=no response at all + * 0=nosuchname or similar, -1=failure, -2=no response at all */ int snmp_pdu_check(const struct snmp_pdu *req, @@ -1681,12 +1681,12 @@ snmp_pdu_check(const struct snmp_pdu *re int snmp_dialog(struct snmp_v1_pdu *req, struct snmp_v1_pdu *resp) { - u_int i; - int32_t reqid; - int ret; - struct timeval tv = snmp_client.timeout; + struct timeval tv = snmp_client.timeout; struct timeval end; struct snmp_pdu pdu; + u_int i; + int32_t reqid; + int ret; /* * Make a copy of the request and replace the syntaxes by NULL @@ -1698,11 +1698,11 @@ snmp_dialog(struct snmp_v1_pdu *req, str for (i = 0; i < pdu.nbindings; i++) pdu.bindings[i].syntax = SNMP_SYNTAX_NULL; } - - for (i = 0; i <= snmp_client.retries; i++) { + + for (i = 0; i <= snmp_client.retries; i++) { (void)gettimeofday(&end, NULL); timeradd(&end, &snmp_client.timeout, &end); - if ((reqid = snmp_send_packet(&pdu)) == -1) + if ((reqid = snmp_send_packet(&pdu)) == -1) return (-1); for (;;) { (void)gettimeofday(&tv, NULL); @@ -1717,16 +1717,16 @@ snmp_dialog(struct snmp_v1_pdu *req, str if (reqid == resp->request_id) return (0); /* not for us */ - (void)snmp_deliver_packet(resp); + (void)snmp_deliver_packet(resp); } if (ret < 0 && errno == EPIPE) /* stream closed */ return (-1); } - } + } errno = ETIMEDOUT; seterr(&snmp_client, "retry count exceeded"); - return (-1); + return (-1); } int From owner-svn-src-all@freebsd.org Sun Dec 18 05:36:05 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 756A4C861EF; Sun, 18 Dec 2016 05:36:05 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 451216C2; Sun, 18 Dec 2016 05:36:05 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBI5a4DK091013; Sun, 18 Dec 2016 05:36:04 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBI5a4Ci091012; Sun, 18 Dec 2016 05:36:04 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201612180536.uBI5a4Ci091012@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Ngie Cooper Date: Sun, 18 Dec 2016 05:36:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310203 - head/usr.sbin/bsnmpd/tools/bsnmptools X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Dec 2016 05:36:05 -0000 Author: ngie Date: Sun Dec 18 05:36:04 2016 New Revision: 310203 URL: https://svnweb.freebsd.org/changeset/base/310203 Log: Clean up parse_ip(..) - Clean up trailing whitespace - Fix variable alignment MFC after: 1 week Modified: head/usr.sbin/bsnmpd/tools/bsnmptools/bsnmpget.c Modified: head/usr.sbin/bsnmpd/tools/bsnmptools/bsnmpget.c ============================================================================== --- head/usr.sbin/bsnmpd/tools/bsnmptools/bsnmpget.c Sun Dec 18 05:31:54 2016 (r310202) +++ head/usr.sbin/bsnmpd/tools/bsnmptools/bsnmpget.c Sun Dec 18 05:36:04 2016 (r310203) @@ -603,9 +603,9 @@ parse_oid_string(struct snmp_toolinfo *s static int32_t parse_ip(struct snmp_value * value, char * val) { - uint32_t v; - int32_t i; char *endptr, *str; + int32_t i; + uint32_t v; str = val; for (i = 0; i < 4; i++) { @@ -617,8 +617,8 @@ parse_ip(struct snmp_value * value, char str = endptr + 1; value->v.ipaddress[i] = (uint8_t) v; } - value->syntax = SNMP_SYNTAX_IPADDRESS; + return (0); } From owner-svn-src-all@freebsd.org Sun Dec 18 08:31:03 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 42ACAC86A6F; Sun, 18 Dec 2016 08:31:03 +0000 (UTC) (envelope-from jchandra@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id F09BB18BE; Sun, 18 Dec 2016 08:31:02 +0000 (UTC) (envelope-from jchandra@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBI8V2XZ059889; Sun, 18 Dec 2016 08:31:02 GMT (envelope-from jchandra@FreeBSD.org) Received: (from jchandra@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBI8V1VZ059886; Sun, 18 Dec 2016 08:31:01 GMT (envelope-from jchandra@FreeBSD.org) Message-Id: <201612180831.uBI8V1VZ059886@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jchandra set sender to jchandra@FreeBSD.org using -f From: "Jayachandran C." Date: Sun, 18 Dec 2016 08:31:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310204 - in head/sys: arm/arm arm64/arm64 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Dec 2016 08:31:03 -0000 Author: jchandra Date: Sun Dec 18 08:31:01 2016 New Revision: 310204 URL: https://svnweb.freebsd.org/changeset/base/310204 Log: Initialize GIC[DR]_IGROUPRn registers for GICv3 In case where GICD_CTLR.DS is 1, the IGROUPR registers are RW in non-secure state and has to be initialized to 1 for the corresponding interrupts to be delivered as Group 1 interrupts. Update gic_v3_dist_init() and gic_v3_redist_init() to initialize GICD_IGROUPRn and GICR_IGROUPRn respectively to address this. The registers can be set unconditionally since the writes are ignored in non-secure state when GICD_CTLR.DS is 0. This fixes the hang on boot seen when running qemu-system-aarch64 with machine virt,gic-version=3 Modified: head/sys/arm/arm/gic_common.h head/sys/arm64/arm64/gic_v3.c head/sys/arm64/arm64/gic_v3_reg.h Modified: head/sys/arm/arm/gic_common.h ============================================================================== --- head/sys/arm/arm/gic_common.h Sun Dec 18 05:36:04 2016 (r310203) +++ head/sys/arm/arm/gic_common.h Sun Dec 18 08:31:01 2016 (r310204) @@ -66,6 +66,7 @@ __BUS_ACCESSOR(gic, bus, GIC, BUS, u_int #define GICD_IIDR_IMPL(x) \ (((x) & GICD_IIDR_IMPL_MASK) >> GICD_IIDR_IMPL_SHIFT) #define GICD_IGROUPR(n) (0x0080 + (((n) >> 5) * 4)) /* v1 ICDISER */ +#define GICD_I_PER_IGROUPRn 32 #define GICD_ISENABLER(n) (0x0100 + (((n) >> 5) * 4)) /* v1 ICDISER */ #define GICD_I_MASK(n) (1ul << ((n) & 0x1f)) #define GICD_I_PER_ISENABLERn 32 Modified: head/sys/arm64/arm64/gic_v3.c ============================================================================== --- head/sys/arm64/arm64/gic_v3.c Sun Dec 18 05:36:04 2016 (r310203) +++ head/sys/arm64/arm64/gic_v3.c Sun Dec 18 08:31:01 2016 (r310204) @@ -1040,6 +1040,10 @@ gic_v3_dist_init(struct gic_v3_softc *sc /* * 2. Configure the Distributor */ + /* Set all SPIs to be Group 1 Non-secure */ + for (i = GIC_FIRST_SPI; i < sc->gic_nirqs; i += GICD_I_PER_IGROUPRn) + gic_d_write(sc, 4, GICD_IGROUPR(i), 0xFFFFFFFF); + /* Set all global interrupts to be level triggered, active low. */ for (i = GIC_FIRST_SPI; i < sc->gic_nirqs; i += GICD_I_PER_ICFGRn) gic_d_write(sc, 4, GICD_ICFGR(i), 0x00000000); @@ -1206,6 +1210,10 @@ gic_v3_redist_init(struct gic_v3_softc * if (err != 0) return (err); + /* Configure SGIs and PPIs to be Group1 Non-secure */ + gic_r_write(sc, 4, GICR_SGI_BASE_SIZE + GICR_IGROUPR0, + 0xFFFFFFFF); + /* Disable SPIs */ gic_r_write(sc, 4, GICR_SGI_BASE_SIZE + GICR_ICENABLER0, GICR_I_ENABLER_PPI_MASK); Modified: head/sys/arm64/arm64/gic_v3_reg.h ============================================================================== --- head/sys/arm64/arm64/gic_v3_reg.h Sun Dec 18 05:36:04 2016 (r310203) +++ head/sys/arm64/arm64/gic_v3_reg.h Sun Dec 18 08:31:01 2016 (r310204) @@ -194,6 +194,7 @@ #define GICR_VLPI_BASE_SIZE PAGE_SIZE_64K #define GICR_RESERVED_SIZE PAGE_SIZE_64K +#define GICR_IGROUPR0 (0x0080) #define GICR_ISENABLER0 (0x0100) #define GICR_ICENABLER0 (0x0180) #define GICR_I_ENABLER_SGI_MASK (0x0000FFFF) From owner-svn-src-all@freebsd.org Sun Dec 18 09:32:24 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 81296C85541; Sun, 18 Dec 2016 09:32:24 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 50F02199F; Sun, 18 Dec 2016 09:32:24 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBI9WNFI087470; Sun, 18 Dec 2016 09:32:23 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBI9WNiE087469; Sun, 18 Dec 2016 09:32:23 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201612180932.uBI9WNiE087469@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Sun, 18 Dec 2016 09:32:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310205 - head/sys/amd64/amd64 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Dec 2016 09:32:24 -0000 Author: kib Date: Sun Dec 18 09:32:23 2016 New Revision: 310205 URL: https://svnweb.freebsd.org/changeset/base/310205 Log: Fix typo. Remove spurious blank line. MFC after: 3 days Modified: head/sys/amd64/amd64/trap.c Modified: head/sys/amd64/amd64/trap.c ============================================================================== --- head/sys/amd64/amd64/trap.c Sun Dec 18 08:31:01 2016 (r310204) +++ head/sys/amd64/amd64/trap.c Sun Dec 18 09:32:23 2016 (r310205) @@ -914,7 +914,7 @@ amd64_syscall(struct thread *td, int tra } KASSERT(PCB_USER_FPU(td->td_pcb), - ("System call %s returing with kernel FPU ctx leaked", + ("System call %s returning with kernel FPU ctx leaked", syscallname(td->td_proc, sa.code))); KASSERT(td->td_pcb->pcb_save == get_pcb_user_save_td(td), ("System call %s returning with mangled pcb_save", @@ -923,7 +923,6 @@ amd64_syscall(struct thread *td, int tra ("System call %s returning with leaked invl_gen %lu", syscallname(td->td_proc, sa.code), td->td_md.md_invl_gen.gen)); - syscallret(td, error, &sa); /* From owner-svn-src-all@freebsd.org Sun Dec 18 11:15:32 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 57B7FC8681A; Sun, 18 Dec 2016 11:15:32 +0000 (UTC) (envelope-from jchandra@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 27183F68; Sun, 18 Dec 2016 11:15:32 +0000 (UTC) (envelope-from jchandra@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBIBFVI4027870; Sun, 18 Dec 2016 11:15:31 GMT (envelope-from jchandra@FreeBSD.org) Received: (from jchandra@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBIBFV3P027869; Sun, 18 Dec 2016 11:15:31 GMT (envelope-from jchandra@FreeBSD.org) Message-Id: <201612181115.uBIBFV3P027869@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jchandra set sender to jchandra@FreeBSD.org using -f From: "Jayachandran C." Date: Sun, 18 Dec 2016 11:15:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310206 - head/sys/arm64/conf X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Dec 2016 11:15:32 -0000 Author: jchandra Date: Sun Dec 18 11:15:31 2016 New Revision: 310206 URL: https://svnweb.freebsd.org/changeset/base/310206 Log: Add virtio_pci to GENERIC arm64 conf virtio_pci was missing from the GENERIC arm64 configuration, while other virtio devices are present. Adding it will allow us to boot the GENERIC kernel on QEMU with virtio storage and networking. Modified: head/sys/arm64/conf/GENERIC Modified: head/sys/arm64/conf/GENERIC ============================================================================== --- head/sys/arm64/conf/GENERIC Sun Dec 18 09:32:23 2016 (r310205) +++ head/sys/arm64/conf/GENERIC Sun Dec 18 11:15:31 2016 (r310206) @@ -101,6 +101,7 @@ device al_udma # Universal DMA # VirtIO support device virtio +device virtio_pci device virtio_mmio device virtio_blk device vtnet From owner-svn-src-all@freebsd.org Sun Dec 18 11:54:11 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8933EC86332; Sun, 18 Dec 2016 11:54:11 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 5858332A; Sun, 18 Dec 2016 11:54:11 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBIBsAS1045809; Sun, 18 Dec 2016 11:54:10 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBIBsAh2045808; Sun, 18 Dec 2016 11:54:10 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201612181154.uBIBsAh2045808@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Sun, 18 Dec 2016 11:54:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r310207 - stable/11/sys/netinet X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Dec 2016 11:54:11 -0000 Author: tuexen Date: Sun Dec 18 11:54:10 2016 New Revision: 310207 URL: https://svnweb.freebsd.org/changeset/base/310207 Log: MFC r305810: Ensure that the IPPROTO_TCP level socket options * TCP_KEEPINIT * TCP_KEEPINTVL * TCP_KEEPIDLE * TCP_KEEPCNT always always report the values currently used when getsockopt() is used. This wasn't the case when the sysctl-inherited default values where used. Ensure that the IPPROTO_TCP level socket option TCP_INFO has the TCPI_OPT_ECN flag set in the tcpi_options field when ECN support has been negotiated successfully. Sponsored by: Netflix, Inc. Modified: stable/11/sys/netinet/tcp_usrreq.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/netinet/tcp_usrreq.c ============================================================================== --- stable/11/sys/netinet/tcp_usrreq.c Sun Dec 18 11:15:31 2016 (r310206) +++ stable/11/sys/netinet/tcp_usrreq.c Sun Dec 18 11:54:10 2016 (r310207) @@ -1346,6 +1346,8 @@ tcp_fill_info(struct tcpcb *tp, struct t ti->tcpi_snd_wscale = tp->snd_scale; ti->tcpi_rcv_wscale = tp->rcv_scale; } + if (tp->t_flags & TF_ECN_PERMIT) + ti->tcpi_options |= TCPI_OPT_ECN; ti->tcpi_rto = tp->t_rxtcur * tick; ti->tcpi_last_data_recv = (long)(ticks - (int)tp->t_rcvtime) * tick; @@ -1815,16 +1817,16 @@ unlock_and_done: case TCP_KEEPCNT: switch (sopt->sopt_name) { case TCP_KEEPIDLE: - ui = tp->t_keepidle / hz; + ui = TP_KEEPIDLE(tp) / hz; break; case TCP_KEEPINTVL: - ui = tp->t_keepintvl / hz; + ui = TP_KEEPINTVL(tp) / hz; break; case TCP_KEEPINIT: - ui = tp->t_keepinit / hz; + ui = TP_KEEPINIT(tp) / hz; break; case TCP_KEEPCNT: - ui = tp->t_keepcnt; + ui = TP_KEEPCNT(tp); break; } INP_WUNLOCK(inp); From owner-svn-src-all@freebsd.org Sun Dec 18 12:12:51 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 08249C710D9; Sun, 18 Dec 2016 12:12:51 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D6F501098; Sun, 18 Dec 2016 12:12:50 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBICCoi8053867; Sun, 18 Dec 2016 12:12:50 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBICCnmg053863; Sun, 18 Dec 2016 12:12:49 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201612181212.uBICCnmg053863@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Sun, 18 Dec 2016 12:12:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r310208 - in stable/11/sys: netinet netinet6 X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Dec 2016 12:12:51 -0000 Author: tuexen Date: Sun Dec 18 12:12:49 2016 New Revision: 310208 URL: https://svnweb.freebsd.org/changeset/base/310208 Log: MFC r307726: Make ICMPv6 hard error handling for TCP consistent with the ICMPv4 handling. Ensure that: * Protocol unreachable errors are handled by indicating ECONNREFUSED to the TCP user for both IPv4 and IPv6. These were ignored for IPv6. * Communication prohibited errors are handled by indicating ECONNREFUSED to the TCP user for both IPv4 and IPv6. These were ignored for IPv6. * Hop Limited exceeded errors are handled by indicating EHOSTUNREACH to the TCP user for both IPv4 and IPv6. For IPv6 the TCP connected was dropped but errno wasn't set. Sponsored by: Netflix, Inc. Modified: stable/11/sys/netinet/ip_icmp.c stable/11/sys/netinet/tcp_subr.c stable/11/sys/netinet6/icmp6.c stable/11/sys/netinet6/ip6_input.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/netinet/ip_icmp.c ============================================================================== --- stable/11/sys/netinet/ip_icmp.c Sun Dec 18 11:54:10 2016 (r310207) +++ stable/11/sys/netinet/ip_icmp.c Sun Dec 18 12:12:49 2016 (r310208) @@ -457,6 +457,8 @@ icmp_input(struct mbuf **mp, int *offp, * Treat subcodes 2,3 as immediate RST */ case ICMP_UNREACH_PROTOCOL: + code = PRC_UNREACH_PROTOCOL; + break; case ICMP_UNREACH_PORT: code = PRC_UNREACH_PORT; break; Modified: stable/11/sys/netinet/tcp_subr.c ============================================================================== --- stable/11/sys/netinet/tcp_subr.c Sun Dec 18 11:54:10 2016 (r310207) +++ stable/11/sys/netinet/tcp_subr.c Sun Dec 18 12:12:49 2016 (r310208) @@ -1949,7 +1949,8 @@ tcp_ctlinput(int cmd, struct sockaddr *s if (cmd == PRC_MSGSIZE) notify = tcp_mtudisc_notify; else if (V_icmp_may_rst && (cmd == PRC_UNREACH_ADMIN_PROHIB || - cmd == PRC_UNREACH_PORT || cmd == PRC_TIMXCEED_INTRANS) && ip) + cmd == PRC_UNREACH_PORT || cmd == PRC_UNREACH_PROTOCOL || + cmd == PRC_TIMXCEED_INTRANS) && ip) notify = tcp_drop_syn_sent; /* @@ -2081,8 +2082,8 @@ tcp6_ctlinput(int cmd, struct sockaddr * if (cmd == PRC_MSGSIZE) notify = tcp_mtudisc_notify; else if (V_icmp_may_rst && (cmd == PRC_UNREACH_ADMIN_PROHIB || - cmd == PRC_UNREACH_PORT || cmd == PRC_TIMXCEED_INTRANS) && - ip6 != NULL) + cmd == PRC_UNREACH_PORT || cmd == PRC_UNREACH_PROTOCOL || + cmd == PRC_TIMXCEED_INTRANS) && ip6 != NULL) notify = tcp_drop_syn_sent; /* Modified: stable/11/sys/netinet6/icmp6.c ============================================================================== --- stable/11/sys/netinet6/icmp6.c Sun Dec 18 11:54:10 2016 (r310207) +++ stable/11/sys/netinet6/icmp6.c Sun Dec 18 12:12:49 2016 (r310208) @@ -490,7 +490,7 @@ icmp6_input(struct mbuf **mp, int *offp, break; case ICMP6_DST_UNREACH_ADMIN: icmp6_ifstat_inc(ifp, ifs6_in_adminprohib); - code = PRC_UNREACH_PROTOCOL; /* is this a good code? */ + code = PRC_UNREACH_ADMIN_PROHIB; break; case ICMP6_DST_UNREACH_BEYONDSCOPE: /* I mean "source address was incorrect." */ Modified: stable/11/sys/netinet6/ip6_input.c ============================================================================== --- stable/11/sys/netinet6/ip6_input.c Sun Dec 18 11:54:10 2016 (r310207) +++ stable/11/sys/netinet6/ip6_input.c Sun Dec 18 12:12:49 2016 (r310208) @@ -1772,6 +1772,6 @@ u_char inet6ctlerrmap[PRC_NCMDS] = { 0, EMSGSIZE, EHOSTDOWN, EHOSTUNREACH, EHOSTUNREACH, EHOSTUNREACH, ECONNREFUSED, ECONNREFUSED, EMSGSIZE, EHOSTUNREACH, 0, 0, - 0, 0, 0, 0, - ENOPROTOOPT + 0, 0, EHOSTUNREACH, 0, + ENOPROTOOPT, ECONNREFUSED }; From owner-svn-src-all@freebsd.org Sun Dec 18 12:15:12 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 343E1C711F4; Sun, 18 Dec 2016 12:15:12 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 036A61335; Sun, 18 Dec 2016 12:15:11 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBICFBtn054126; Sun, 18 Dec 2016 12:15:11 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBICFBmc054125; Sun, 18 Dec 2016 12:15:11 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201612181215.uBICFBmc054125@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Sun, 18 Dec 2016 12:15:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r310209 - stable/11/share/man/man4 X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Dec 2016 12:15:12 -0000 Author: tuexen Date: Sun Dec 18 12:15:10 2016 New Revision: 310209 URL: https://svnweb.freebsd.org/changeset/base/310209 Log: MFC r307727, r307746: Document the TCP sysctl variables insecure_rst and insecure_syn. Sponsored by: Netflix, Inc. Modified: stable/11/share/man/man4/tcp.4 Directory Properties: stable/11/ (props changed) Modified: stable/11/share/man/man4/tcp.4 ============================================================================== --- stable/11/share/man/man4/tcp.4 Sun Dec 18 12:12:49 2016 (r310208) +++ stable/11/share/man/man4/tcp.4 Sun Dec 18 12:15:10 2016 (r310209) @@ -34,7 +34,7 @@ .\" From: @(#)tcp.4 8.1 (Berkeley) 6/5/93 .\" $FreeBSD$ .\" -.Dd June 28, 2016 +.Dd October 21, 2016 .Dt TCP 4 .Os .Sh NAME @@ -586,6 +586,12 @@ downshift. List of available TCP function blocks (TCP stacks). .It Va functions_default The default TCP function block (TCP stack). +.It Va insecure_rst +Use criteria defined in RFC793 instead of RFC5961 for accepting RST segments. +Default is false. +.It Va insecure_syn +Use criteria defined in RFC793 instead of RFC5961 for accepting SYN segments. +Default is false. .El .Sh ERRORS A socket operation may fail with one of the following errors returned: From owner-svn-src-all@freebsd.org Sun Dec 18 12:16:48 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 72E57C7127B; Sun, 18 Dec 2016 12:16:48 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 420DB150C; Sun, 18 Dec 2016 12:16:48 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBICGlxQ054234; Sun, 18 Dec 2016 12:16:47 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBICGlHq054233; Sun, 18 Dec 2016 12:16:47 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201612181216.uBICGlHq054233@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Sun, 18 Dec 2016 12:16:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r310210 - stable/11/usr.sbin/bhyvectl X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Dec 2016 12:16:48 -0000 Author: tuexen Date: Sun Dec 18 12:16:47 2016 New Revision: 310210 URL: https://svnweb.freebsd.org/changeset/base/310210 Log: MFC r308616: Fix typo. Sponsored by: Netflix, Inc. Modified: stable/11/usr.sbin/bhyvectl/bhyvectl.8 Directory Properties: stable/11/ (props changed) Modified: stable/11/usr.sbin/bhyvectl/bhyvectl.8 ============================================================================== --- stable/11/usr.sbin/bhyvectl/bhyvectl.8 Sun Dec 18 12:15:10 2016 (r310209) +++ stable/11/usr.sbin/bhyvectl/bhyvectl.8 Sun Dec 18 12:16:47 2016 (r310210) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd January 12, 2016 +.Dd November 13, 2016 .Dt BHYVECTL 8 .Os .Sh NAME @@ -64,7 +64,7 @@ Operate on the virtual machine Create the specified VM. .It Fl -destroy Destroy the specified VM. -.It Fl -get-state +.It Fl -get-stats Retrieve statistics for the specified VM. .It Fl -inject-nmi Inject a non-maskable interrupt (NMI) into the VM. From owner-svn-src-all@freebsd.org Sun Dec 18 12:20:23 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A25F8C71803; Sun, 18 Dec 2016 12:20:23 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 6D56A1886; Sun, 18 Dec 2016 12:20:23 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBICKMIW054423; Sun, 18 Dec 2016 12:20:22 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBICKMC0054421; Sun, 18 Dec 2016 12:20:22 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201612181220.uBICKMC0054421@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Sun, 18 Dec 2016 12:20:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r310211 - in stable/11/sys/netinet: . tcp_stacks X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Dec 2016 12:20:23 -0000 Author: tuexen Date: Sun Dec 18 12:20:22 2016 New Revision: 310211 URL: https://svnweb.freebsd.org/changeset/base/310211 Log: MFC r308745: Notify the user via setting errno when a TCP RST segment is received either in the CLOSING or LAST-ACK state. Sponsored by: Netflix, Inc. Modified: stable/11/sys/netinet/tcp_input.c stable/11/sys/netinet/tcp_stacks/fastpath.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/netinet/tcp_input.c ============================================================================== --- stable/11/sys/netinet/tcp_input.c Sun Dec 18 12:16:47 2016 (r310210) +++ stable/11/sys/netinet/tcp_input.c Sun Dec 18 12:20:22 2016 (r310211) @@ -2185,6 +2185,8 @@ tcp_do_segment(struct mbuf *m, struct tc case TCPS_FIN_WAIT_1: case TCPS_FIN_WAIT_2: case TCPS_CLOSE_WAIT: + case TCPS_CLOSING: + case TCPS_LAST_ACK: so->so_error = ECONNRESET; close: tcp_state_change(tp, TCPS_CLOSED); Modified: stable/11/sys/netinet/tcp_stacks/fastpath.c ============================================================================== --- stable/11/sys/netinet/tcp_stacks/fastpath.c Sun Dec 18 12:16:47 2016 (r310210) +++ stable/11/sys/netinet/tcp_stacks/fastpath.c Sun Dec 18 12:20:22 2016 (r310211) @@ -734,6 +734,8 @@ tcp_do_slowpath(struct mbuf *m, struct t case TCPS_FIN_WAIT_1: case TCPS_FIN_WAIT_2: case TCPS_CLOSE_WAIT: + case TCPS_CLOSING: + case TCPS_LAST_ACK: so->so_error = ECONNRESET; close: tcp_state_change(tp, TCPS_CLOSED); From owner-svn-src-all@freebsd.org Sun Dec 18 12:23:50 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 74173C71C04; Sun, 18 Dec 2016 12:23:50 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4B7041D2E; Sun, 18 Dec 2016 12:23:50 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBICNnlB058092; Sun, 18 Dec 2016 12:23:49 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBICNn7s058088; Sun, 18 Dec 2016 12:23:49 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201612181223.uBICNn7s058088@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Sun, 18 Dec 2016 12:23:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r310212 - in stable/11/sys/netinet: . tcp_stacks X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Dec 2016 12:23:50 -0000 Author: tuexen Date: Sun Dec 18 12:23:48 2016 New Revision: 310212 URL: https://svnweb.freebsd.org/changeset/base/310212 Log: MFC r308832: Ensure that TCP state changes to state-closing are reported via dtrace. This does not cover state changes from TIME-WAIT. Sponsored by: Netflix, Inc. Modified: stable/11/sys/netinet/tcp_input.c stable/11/sys/netinet/tcp_stacks/fastpath.c stable/11/sys/netinet/tcp_subr.c stable/11/sys/netinet/tcp_timewait.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/netinet/tcp_input.c ============================================================================== --- stable/11/sys/netinet/tcp_input.c Sun Dec 18 12:20:22 2016 (r310211) +++ stable/11/sys/netinet/tcp_input.c Sun Dec 18 12:23:48 2016 (r310212) @@ -2189,7 +2189,6 @@ tcp_do_segment(struct mbuf *m, struct tc case TCPS_LAST_ACK: so->so_error = ECONNRESET; close: - tcp_state_change(tp, TCPS_CLOSED); /* FALLTHROUGH */ default: tp = tcp_close(tp); Modified: stable/11/sys/netinet/tcp_stacks/fastpath.c ============================================================================== --- stable/11/sys/netinet/tcp_stacks/fastpath.c Sun Dec 18 12:20:22 2016 (r310211) +++ stable/11/sys/netinet/tcp_stacks/fastpath.c Sun Dec 18 12:23:48 2016 (r310212) @@ -738,7 +738,6 @@ tcp_do_slowpath(struct mbuf *m, struct t case TCPS_LAST_ACK: so->so_error = ECONNRESET; close: - tcp_state_change(tp, TCPS_CLOSED); /* FALLTHROUGH */ default: tp = tcp_close(tp); Modified: stable/11/sys/netinet/tcp_subr.c ============================================================================== --- stable/11/sys/netinet/tcp_subr.c Sun Dec 18 12:20:22 2016 (r310211) +++ stable/11/sys/netinet/tcp_subr.c Sun Dec 18 12:23:48 2016 (r310212) @@ -1483,6 +1483,7 @@ tcp_discardcb(struct tcpcb *tp) inp->inp_ppcb = NULL; if (tp->t_timers->tt_draincnt == 0) { /* We own the last reference on tcpcb, let's free it. */ + TCPSTATES_DEC(tp->t_state); if (tp->t_fb->tfb_tcp_fb_fini) (*tp->t_fb->tfb_tcp_fb_fini)(tp); refcount_release(&tp->t_fb->tfb_refcnt); @@ -1512,6 +1513,7 @@ tcp_timer_discard(void *ptp) tp->t_timers->tt_draincnt--; if (tp->t_timers->tt_draincnt == 0) { /* We own the last reference on this tcpcb, let's free it. */ + TCPSTATES_DEC(tp->t_state); if (tp->t_fb->tfb_tcp_fb_fini) (*tp->t_fb->tfb_tcp_fb_fini)(tp); refcount_release(&tp->t_fb->tfb_refcnt); @@ -1558,7 +1560,8 @@ tcp_close(struct tcpcb *tp) #endif in_pcbdrop(inp); TCPSTAT_INC(tcps_closed); - TCPSTATES_DEC(tp->t_state); + if (tp->t_state != TCPS_CLOSED) + tcp_state_change(tp, TCPS_CLOSED); KASSERT(inp->inp_socket != NULL, ("tcp_close: inp_socket NULL")); so = inp->inp_socket; soisdisconnected(so); Modified: stable/11/sys/netinet/tcp_timewait.c ============================================================================== --- stable/11/sys/netinet/tcp_timewait.c Sun Dec 18 12:20:22 2016 (r310211) +++ stable/11/sys/netinet/tcp_timewait.c Sun Dec 18 12:23:48 2016 (r310212) @@ -340,6 +340,7 @@ tcp_twstart(struct tcpcb *tp) tcp_twrespond(tw, TH_ACK); inp->inp_ppcb = tw; inp->inp_flags |= INP_TIMEWAIT; + TCPSTATES_INC(TCPS_TIME_WAIT); tcp_tw_2msl_reset(tw, 0); /* From owner-svn-src-all@freebsd.org Sun Dec 18 12:27:36 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B7268C71D48; Sun, 18 Dec 2016 12:27:36 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 866E51EF0; Sun, 18 Dec 2016 12:27:36 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBICRZOY058273; Sun, 18 Dec 2016 12:27:35 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBICRZQJ058272; Sun, 18 Dec 2016 12:27:35 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201612181227.uBICRZQJ058272@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Sun, 18 Dec 2016 12:27:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r310213 - stable/11/sys/netinet X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Dec 2016 12:27:36 -0000 Author: tuexen Date: Sun Dec 18 12:27:35 2016 New Revision: 310213 URL: https://svnweb.freebsd.org/changeset/base/310213 Log: MFC r309397: Fix the handling of TCP FIN-segments in the CLOSED state When a TCP segment with the FIN bit set was received in the CLOSED state, a TCP RST-ACK-segment is sent. When computing SEG.ACK for this, the FIN counts as one byte. This accounting was missing and is fixed by this patch. Sponsored by: Netflix, Inc. Modified: stable/11/sys/netinet/tcp_input.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/netinet/tcp_input.c ============================================================================== --- stable/11/sys/netinet/tcp_input.c Sun Dec 18 12:23:48 2016 (r310212) +++ stable/11/sys/netinet/tcp_input.c Sun Dec 18 12:27:35 2016 (r310213) @@ -3316,6 +3316,8 @@ tcp_dropwithreset(struct mbuf *m, struct } else { if (th->th_flags & TH_SYN) tlen++; + if (th->th_flags & TH_FIN) + tlen++; tcp_respond(tp, mtod(m, void *), th, m, th->th_seq+tlen, (tcp_seq)0, TH_RST|TH_ACK); } From owner-svn-src-all@freebsd.org Sun Dec 18 12:45:38 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6EC27C85291; Sun, 18 Dec 2016 12:45:38 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 37C55B26; Sun, 18 Dec 2016 12:45:38 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBICjbbn066389; Sun, 18 Dec 2016 12:45:37 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBICjbcg066388; Sun, 18 Dec 2016 12:45:37 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201612181245.uBICjbcg066388@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Sun, 18 Dec 2016 12:45:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r310214 - stable/11/sys/netinet X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Dec 2016 12:45:38 -0000 Author: tuexen Date: Sun Dec 18 12:45:37 2016 New Revision: 310214 URL: https://svnweb.freebsd.org/changeset/base/310214 Log: MFC r306082: Fix the handling of unordered fragmented user messages using DATA chunks. There were two bugs: * There was an accounting bug resulting in reporting a too small a_rwnd. * There are a bug when abandoning messages in the reassembly queue. Modified: stable/11/sys/netinet/sctp_indata.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/netinet/sctp_indata.c ============================================================================== --- stable/11/sys/netinet/sctp_indata.c Sun Dec 18 12:27:35 2016 (r310213) +++ stable/11/sys/netinet/sctp_indata.c Sun Dec 18 12:45:37 2016 (r310214) @@ -809,6 +809,8 @@ restart: tchk = TAILQ_FIRST(&control->reasm); if (tchk->rec.data.rcv_flags & SCTP_DATA_FIRST_FRAG) { TAILQ_REMOVE(&control->reasm, tchk, sctp_next); + asoc->size_on_reasm_queue -= tchk->send_size; + sctp_ucount_decr(asoc->cnt_on_reasm_queue); nc->first_frag_seen = 1; nc->fsn_included = tchk->rec.data.fsn_num; nc->data = tchk->data; @@ -5322,6 +5324,9 @@ sctp_flush_reassm_for_str_seq(struct sct /* Not found */ return; } + if (old && !ordered && SCTP_TSN_GT(control->fsn_included, cumtsn)) { + return; + } TAILQ_FOREACH_SAFE(chk, &control->reasm, sctp_next, nchk) { /* Purge hanging chunks */ if (old && (ordered == 0)) { From owner-svn-src-all@freebsd.org Sun Dec 18 12:49:26 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0AE0EC853AD; Sun, 18 Dec 2016 12:49:26 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D97DACBB; Sun, 18 Dec 2016 12:49:25 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBICnPYv066556; Sun, 18 Dec 2016 12:49:25 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBICnPNB066555; Sun, 18 Dec 2016 12:49:25 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201612181249.uBICnPNB066555@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Sun, 18 Dec 2016 12:49:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r310215 - stable/11/sys/netinet X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Dec 2016 12:49:26 -0000 Author: tuexen Date: Sun Dec 18 12:49:24 2016 New Revision: 310215 URL: https://svnweb.freebsd.org/changeset/base/310215 Log: MFC r307216: Whitespace changes. Modified: stable/11/sys/netinet/sctp_pcb.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/netinet/sctp_pcb.c ============================================================================== --- stable/11/sys/netinet/sctp_pcb.c Sun Dec 18 12:45:37 2016 (r310214) +++ stable/11/sys/netinet/sctp_pcb.c Sun Dec 18 12:49:24 2016 (r310215) @@ -77,7 +77,6 @@ SCTP6_ARE_ADDR_EQUAL(struct sockaddr_in6 } return (IN6_ARE_ADDR_EQUAL(&tmp_a.sin6_addr, &tmp_b.sin6_addr)); } - #endif void @@ -837,14 +836,11 @@ static int sctp_does_stcb_own_this_addr(struct sctp_tcb *stcb, struct sockaddr *to) { int loopback_scope; - #if defined(INET) int ipv4_local_scope, ipv4_addr_legal; - #endif #if defined(INET6) int local_scope, site_scope, ipv6_addr_legal; - #endif struct sctp_vrf *vrf; struct sctp_ifn *sctp_ifn; @@ -1216,10 +1212,8 @@ sctp_tcb_special_locate(struct sctp_inpc if (netp != NULL) { *netp = net; } - /* - * Update the endpoint - * pointer - */ + /* Update the endpoint + * pointer */ *inp_p = inp; SCTP_INP_RUNLOCK(inp); return (stcb); @@ -1240,10 +1234,8 @@ sctp_tcb_special_locate(struct sctp_inpc if (netp != NULL) { *netp = net; } - /* - * Update the endpoint - * pointer - */ + /* Update the endpoint + * pointer */ *inp_p = inp; SCTP_INP_RUNLOCK(inp); return (stcb); @@ -1622,15 +1614,12 @@ sctp_endpoint_probe(struct sockaddr *nam { struct sctp_inpcb *inp; struct sctp_laddr *laddr; - #ifdef INET struct sockaddr_in *sin; - #endif #ifdef INET6 struct sockaddr_in6 *sin6; struct sockaddr_in6 *intf_addr6; - #endif int fnd; @@ -1673,10 +1662,8 @@ sctp_endpoint_probe(struct sockaddr *nam case AF_INET: if ((inp->sctp_flags & SCTP_PCB_FLAGS_BOUND_V6) && SCTP_IPV6_V6ONLY(inp)) { - /* - * IPv4 on a IPv6 socket with ONLY - * IPv6 set - */ + /* IPv4 on a IPv6 socket with ONLY + * IPv6 set */ SCTP_INP_RUNLOCK(inp); continue; } @@ -1689,10 +1676,8 @@ sctp_endpoint_probe(struct sockaddr *nam #endif #ifdef INET6 case AF_INET6: - /* - * A V6 address and the endpoint is NOT - * bound V6 - */ + /* A V6 address and the endpoint is NOT + * bound V6 */ if ((inp->sctp_flags & SCTP_PCB_FLAGS_BOUND_V6) == 0) { SCTP_INP_RUNLOCK(inp); continue; @@ -1926,14 +1911,11 @@ sctp_pcb_findep(struct sockaddr *nam, in struct sctppcbhead *head; int lport; unsigned int i; - #ifdef INET struct sockaddr_in *sin; - #endif #ifdef INET6 struct sockaddr_in6 *sin6; - #endif switch (nam->sa_family) { @@ -2057,21 +2039,16 @@ sctp_findassociation_special_addr(struct struct sockaddr *dst) { struct sctp_paramhdr *phdr, parm_buf; - #if defined(INET) || defined(INET6) struct sctp_tcb *stcb; uint16_t ptype; - #endif uint16_t plen; - #ifdef INET struct sockaddr_in sin4; - #endif #ifdef INET6 struct sockaddr_in6 sin6; - #endif #ifdef INET @@ -2198,10 +2175,8 @@ sctp_findassoc_by_vtag(struct sockaddr * continue; } if (remote_tag) { - /* - * If we have both vtags that's all we match - * on - */ + /* If we have both vtags that's all we match + * on */ if (stcb->asoc.peer_vtag == remote_tag) { /* * If both tags match we consider it @@ -2319,14 +2294,11 @@ sctp_findassociation_ep_asconf(struct mb struct sctp_paramhdr parm_buf, *phdr; int ptype; int zero_address = 0; - #ifdef INET struct sockaddr_in *sin; - #endif #ifdef INET6 struct sockaddr_in6 *sin6; - #endif memset(&remote_store, 0, sizeof(remote_store)); @@ -2897,10 +2869,8 @@ sctp_inpcb_bind(struct socket *so, struc #ifdef INET6 case AF_INET6: { - /* - * Only for pure IPv6 Address. (No IPv4 - * Mapped!) - */ + /* Only for pure IPv6 Address. (No IPv4 + * Mapped!) */ struct sockaddr_in6 *sin6; sin6 = (struct sockaddr_in6 *)addr; @@ -2977,10 +2947,8 @@ sctp_inpcb_bind(struct socket *so, struc /* unlock info */ if ((sctp_is_feature_on(inp, SCTP_PCB_FLAGS_PORTREUSE)) && (sctp_is_feature_on(inp_tmp, SCTP_PCB_FLAGS_PORTREUSE))) { - /* - * Ok, must be one-2-one and - * allowing port re-use - */ + /* Ok, must be one-2-one and + * allowing port re-use */ port_reuse_active = 1; goto continue_anyway; } @@ -3003,10 +2971,8 @@ sctp_inpcb_bind(struct socket *so, struc /* unlock info */ if ((sctp_is_feature_on(inp, SCTP_PCB_FLAGS_PORTREUSE)) && (sctp_is_feature_on(inp_tmp, SCTP_PCB_FLAGS_PORTREUSE))) { - /* - * Ok, must be one-2-one and - * allowing port re-use - */ + /* Ok, must be one-2-one and + * allowing port re-use */ port_reuse_active = 1; goto continue_anyway; } @@ -3146,11 +3112,11 @@ continue_anyway: * bind specific, make sure flags is off and add a new * address structure to the sctp_addr_list inside the ep * structure. - * - * We will need to allocate one and insert it at the head. The - * socketopt call can just insert new addresses in there as - * well. It will also have to do the embed scope kame hack - * too (before adding). + * + * We will need to allocate one and insert it at the head. + * The socketopt call can just insert new addresses in there + * as well. It will also have to do the embed scope kame + * hack too (before adding). */ struct sctp_ifa *ifa; union sctp_sockstore store; @@ -3268,11 +3234,11 @@ sctp_iterator_inp_being_freed(struct sct * from happening. But of course the iterator has a * reference on the stcb and inp. We can mark it and it will * stop. - * - * If its a single iterator situation, we set the end iterator - * flag. Otherwise we set the iterator to go to the next - * inp. - * + * + * If its a single iterator situation, we set the end + * iterator flag. Otherwise we set the iterator to go to the + * next inp. + * */ if (it->iterator_flags & SCTP_ITERATOR_DO_SINGLE_INP) { sctp_it_ctl.iterator_flags |= SCTP_ITERATOR_STOP_CUR_IT; @@ -3305,10 +3271,8 @@ sctp_iterator_inp_being_freed(struct sct SCTP_INP_INCR_REF(it->inp); } } - /* - * When its put in the refcnt is incremented so decr - * it - */ + /* When its put in the refcnt is incremented so decr + * it */ SCTP_INP_DECR_REF(inp); } } @@ -3991,10 +3955,8 @@ sctp_add_remote_addr(struct sctp_tcb *st rmtu = SCTP_GATHER_MTU_FROM_ROUTE(net->ro._s_addr, &net->ro._l_addr.sa, net->ro.ro_rt); if (rmtu == 0) { - /* - * Start things off to match mtu of - * interface please. - */ + /* Start things off to match mtu of + * interface please. */ SCTP_SET_MTU_OF_ROUTE(&net->ro._l_addr.sa, net->ro.ro_rt, net->mtu); } else { @@ -5484,10 +5446,8 @@ sctp_del_local_addr_ep(struct sctp_inpcb if (stcb->asoc.last_used_address == laddr) /* delete this address */ stcb->asoc.last_used_address = NULL; - /* - * Now spin through all the nets and purge any ref - * to laddr - */ + /* Now spin through all the nets and purge any ref + * to laddr */ TAILQ_FOREACH(net, &stcb->asoc.nets, sctp_next) { if (net->ro._s_addr == laddr->ifa) { /* Yep, purge src address selected */ @@ -5755,7 +5715,6 @@ sctp_startup_mcore_threads(void) } } - #endif void @@ -6097,14 +6056,11 @@ sctp_load_addresses_from_init(struct sct uint8_t peer_supports_nrsack; uint8_t peer_supports_pktdrop; uint8_t peer_supports_idata; - #ifdef INET struct sockaddr_in sin; - #endif #ifdef INET6 struct sockaddr_in6 sin6; - #endif /* First get the destination address setup too. */ @@ -6267,10 +6223,8 @@ sctp_load_addresses_from_init(struct sct struct mbuf *op_err; char msg[SCTP_DIAG_INFO_LEN]; - /* - * in setup state we - * abort this guy - */ + /* in setup state we + * abort this guy */ snprintf(msg, sizeof(msg), "%s:%d at %s", __FILE__, __LINE__, __func__); op_err = sctp_generate_cause(SCTP_BASE_SYSCTL(sctp_diag_info_code), @@ -6312,10 +6266,8 @@ sctp_load_addresses_from_init(struct sct goto next_param; } if (IN6_IS_ADDR_LINKLOCAL(&sin6.sin6_addr)) { - /* - * Link local make no sense without - * scope - */ + /* Link local make no sense without + * scope */ goto next_param; } sa = (struct sockaddr *)&sin6; @@ -6366,10 +6318,8 @@ sctp_load_addresses_from_init(struct sct struct mbuf *op_err; char msg[SCTP_DIAG_INFO_LEN]; - /* - * in setup state we - * abort this guy - */ + /* in setup state we + * abort this guy */ snprintf(msg, sizeof(msg), "%s:%d at %s", __FILE__, __LINE__, __func__); op_err = sctp_generate_cause(SCTP_BASE_SYSCTL(sctp_diag_info_code), @@ -6409,10 +6359,8 @@ sctp_load_addresses_from_init(struct sct struct sctp_asconf_addr_param lstore, *fee; int lptype; struct sockaddr *lsa = NULL; - #ifdef INET struct sctp_asconf_addrv4_param *fii; - #endif if (stcb->asoc.asconf_supported == 0) { From owner-svn-src-all@freebsd.org Sun Dec 18 12:52:54 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2B063C85573; Sun, 18 Dec 2016 12:52:54 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E8ABD10AF; Sun, 18 Dec 2016 12:52:53 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBICqrQR070208; Sun, 18 Dec 2016 12:52:53 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBICqrLm070207; Sun, 18 Dec 2016 12:52:53 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201612181252.uBICqrLm070207@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Sun, 18 Dec 2016 12:52:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r310216 - stable/11/sys/netinet X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Dec 2016 12:52:54 -0000 Author: tuexen Date: Sun Dec 18 12:52:52 2016 New Revision: 310216 URL: https://svnweb.freebsd.org/changeset/base/310216 Log: MFC r307217: Mark the socket as un-writable when it is 1-to-1 and the SCTP association is freed. Modified: stable/11/sys/netinet/sctp_pcb.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/netinet/sctp_pcb.c ============================================================================== --- stable/11/sys/netinet/sctp_pcb.c Sun Dec 18 12:49:24 2016 (r310215) +++ stable/11/sys/netinet/sctp_pcb.c Sun Dec 18 12:52:52 2016 (r310216) @@ -4870,6 +4870,7 @@ sctp_free_assoc(struct sctp_inpcb *inp, SS_ISCONNECTED); } socantrcvmore_locked(so); + socantsendmore(so); sctp_sowwakeup(inp, so); sctp_sorwakeup(inp, so); SCTP_SOWAKEUP(so); From owner-svn-src-all@freebsd.org Sun Dec 18 12:56:15 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6405DC85664; Sun, 18 Dec 2016 12:56:15 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 31F33136D; Sun, 18 Dec 2016 12:56:15 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBICuEMX070396; Sun, 18 Dec 2016 12:56:14 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBICuEja070394; Sun, 18 Dec 2016 12:56:14 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201612181256.uBICuEja070394@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Sun, 18 Dec 2016 12:56:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r310217 - stable/11/sys/netinet X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Dec 2016 12:56:15 -0000 Author: tuexen Date: Sun Dec 18 12:56:14 2016 New Revision: 310217 URL: https://svnweb.freebsd.org/changeset/base/310217 Log: MFC r307779: No functional changes, mostly getting the whitespace changes resulting from an updated formatting tool chain. Modified: stable/11/sys/netinet/sctp_bsd_addr.c stable/11/sys/netinet/sctp_output.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/netinet/sctp_bsd_addr.c ============================================================================== --- stable/11/sys/netinet/sctp_bsd_addr.c Sun Dec 18 12:52:52 2016 (r310216) +++ stable/11/sys/netinet/sctp_bsd_addr.c Sun Dec 18 12:56:14 2016 (r310217) @@ -140,7 +140,6 @@ sctp_gather_internal_ifa_flags(struct sc ifa->localifa_flags &= ~SCTP_ADDR_IFA_UNUSEABLE; } } - #endif /* INET6 */ @@ -201,10 +200,8 @@ sctp_init_ifns_for_vrf(int vrfid) struct ifaddr *ifa; struct sctp_ifa *sctp_ifa; uint32_t ifa_flags; - #ifdef INET6 struct in6_ifaddr *ifa6; - #endif IFNET_RLOCK(); Modified: stable/11/sys/netinet/sctp_output.c ============================================================================== --- stable/11/sys/netinet/sctp_output.c Sun Dec 18 12:52:52 2016 (r310216) +++ stable/11/sys/netinet/sctp_output.c Sun Dec 18 12:56:14 2016 (r310217) @@ -1943,7 +1943,6 @@ sctp_add_addr_to_mbuf(struct mbuf *m, st struct sctp_paramhdr *parmh; struct mbuf *mret; uint16_t plen; - #endif switch (ifa->address.sa.sa_family) { @@ -2139,10 +2138,8 @@ skip_count: cnt++; total_count++; if (cnt >= 2) { - /* - * two from each - * address - */ + /* two from each + * address */ break; } if (total_count > SCTP_ADDRESS_LIMIT) { @@ -2784,7 +2781,6 @@ sctp_select_nth_preferred_addr_from_ifn_ { struct sctp_ifa *ifa, *sifa; int num_eligible_addr = 0; - #ifdef INET6 struct sockaddr_in6 sin6, lsa6; @@ -2829,10 +2825,8 @@ sctp_select_nth_preferred_addr_from_ifn_ if (fam == AF_INET6 && IN6_IS_ADDR_LINKLOCAL(&sifa->address.sin6.sin6_addr) && IN6_IS_ADDR_LINKLOCAL(&sin6.sin6_addr)) { - /* - * link-local <-> link-local must belong to the same - * scope. - */ + /* link-local <-> link-local must belong to the same + * scope. */ memcpy(&lsa6, &sifa->address.sin6, sizeof(struct sockaddr_in6)); (void)sa6_recoverscope(&lsa6); if (sin6.sin6_scope_id != lsa6.sin6_scope_id) { @@ -2966,10 +2960,8 @@ sctp_choose_boundall(struct sctp_inpcb * struct sctp_ifa *sctp_ifa, *sifa; uint32_t ifn_index; struct sctp_vrf *vrf; - #ifdef INET int retried = 0; - #endif /*- @@ -3315,14 +3307,11 @@ sctp_source_address_selection(struct sct struct sctp_ifa *answer; uint8_t dest_is_priv, dest_is_loop; sa_family_t fam; - #ifdef INET struct sockaddr_in *to = (struct sockaddr_in *)&ro->ro_dst; - #endif #ifdef INET6 struct sockaddr_in6 *to6 = (struct sockaddr_in6 *)&ro->ro_dst; - #endif /** @@ -3570,14 +3559,11 @@ sctp_process_cmsgs_for_init(struct sctp_ struct cmsghdr cmh; int tlen, at; struct sctp_initmsg initmsg; - #ifdef INET struct sockaddr_in sin; - #endif #ifdef INET6 struct sockaddr_in6 sin6; - #endif tlen = SCTP_BUF_LEN(control); @@ -3618,10 +3604,8 @@ sctp_process_cmsgs_for_init(struct sctp_ if (stcb->asoc.streamoutcnt < stcb->asoc.pre_open_streams) { struct sctp_stream_out *tmp_str; unsigned int i; - #if defined(SCTP_DETAILED_STR_STATS) int j; - #endif /* Default is NOT correct */ @@ -3744,14 +3728,11 @@ sctp_findassociation_cmsgs(struct sctp_i int tlen, at; struct sctp_tcb *stcb; struct sockaddr *addr; - #ifdef INET struct sockaddr_in sin; - #endif #ifdef INET6 struct sockaddr_in6 sin6; - #endif tlen = SCTP_BUF_LEN(control); @@ -3970,7 +3951,6 @@ sctp_handle_no_route(struct sctp_tcb *st } } } - #endif static int @@ -4016,22 +3996,17 @@ sctp_lowlevel_chunk_output(struct sctp_i struct sctphdr *sctphdr; int packet_length; int ret; - #if defined(INET) || defined(INET6) uint32_t vrf_id; - #endif #if defined(INET) || defined(INET6) struct mbuf *o_pak; sctp_route_t *ro = NULL; struct udphdr *udp = NULL; - #endif uint8_t tos_value; - #if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING) struct socket *so = NULL; - #endif if ((net) && (net->dest_state & SCTP_ADDR_OUT_OF_SCOPE)) { @@ -4289,10 +4264,8 @@ sctp_lowlevel_chunk_output(struct sctp_i /* free tempy routes */ RO_RTFREE(ro); } else { - /* - * PMTU check versus smallest asoc MTU goes - * here - */ + /* PMTU check versus smallest asoc MTU goes + * here */ if ((ro->ro_rt != NULL) && (net->ro._s_addr)) { uint32_t mtu; @@ -4567,10 +4540,8 @@ sctp_lowlevel_chunk_output(struct sctp_i SCTPDBG_ADDR(SCTP_DEBUG_OUTPUT3, (struct sockaddr *)sin6); if (net) { sin6 = (struct sockaddr_in6 *)&net->ro._l_addr; - /* - * preserve the port and scope for link - * local send - */ + /* preserve the port and scope for link + * local send */ prev_scope = sin6->sin6_scope_id; prev_port = sin6->sin6_port; } @@ -4636,10 +4607,8 @@ sctp_lowlevel_chunk_output(struct sctp_i /* Now if we had a temp route free it */ RO_RTFREE(ro); } else { - /* - * PMTU check versus smallest asoc MTU goes - * here - */ + /* PMTU check versus smallest asoc MTU goes + * here */ if (ro->ro_rt == NULL) { /* Route was freed */ if (net->ro._s_addr && @@ -4969,11 +4938,11 @@ sctp_arethere_unrecognized_parameters(st * being equal to the beginning of the params i.e. (iphlen + * sizeof(struct sctp_init_msg) parse through the parameters to the * end of the mbuf verifying that all parameters are known. - * + * * For unknown parameters build and return a mbuf with * UNRECOGNIZED_PARAMETER errors. If the flags indicate to stop * processing this chunk stop, and set *abort_processing to 1. - * + * * By having param_offset be pre-set to where parameters begin it is * hoped that this routine may be reused in the future by new * features. @@ -5260,7 +5229,6 @@ invalid_size: *abort_processing = 1; if ((op_err == NULL) && phdr) { int l_len; - #ifdef INET6 l_len = SCTP_MIN_OVERHEAD; #else @@ -5318,14 +5286,11 @@ sctp_are_there_new_addresses(struct sctp uint8_t fnd; struct sctp_nets *net; int check_src; - #ifdef INET struct sockaddr_in sin4, *sa4; - #endif #ifdef INET6 struct sockaddr_in6 sin6, *sa6; - #endif #ifdef INET @@ -5509,18 +5474,15 @@ sctp_send_initiate_ack(struct sctp_inpcb struct sctp_paramhdr *ph; union sctp_sockstore *over_addr; struct sctp_scoping scp; - #ifdef INET struct sockaddr_in *dst4 = (struct sockaddr_in *)dst; struct sockaddr_in *src4 = (struct sockaddr_in *)src; struct sockaddr_in *sin; - #endif #ifdef INET6 struct sockaddr_in6 *dst6 = (struct sockaddr_in6 *)dst; struct sockaddr_in6 *src6 = (struct sockaddr_in6 *)src; struct sockaddr_in6 *sin6; - #endif struct sockaddr *to; struct sctp_state_cookie stc; @@ -5544,10 +5506,10 @@ sctp_send_initiate_ack(struct sctp_inpcb /* * new addresses, out of here in non-cookie-wait * states - * - * Send an ABORT, without the new address error cause. - * This looks no different than if no listener was - * present. + * + * Send an ABORT, without the new address error + * cause. This looks no different than if no + * listener was present. */ op_err = sctp_generate_cause(SCTP_BASE_SYSCTL(sctp_diag_info_code), "Address added"); @@ -5560,9 +5522,9 @@ sctp_send_initiate_ack(struct sctp_inpcb /* * change of remote encapsulation port, out of here * in non-cookie-wait states - * - * Send an ABORT, without an specific error cause. This - * looks no different than if no listener was + * + * Send an ABORT, without an specific error cause. + * This looks no different than if no listener was * present. */ op_err = sctp_generate_cause(SCTP_BASE_SYSCTL(sctp_diag_info_code), @@ -5716,10 +5678,8 @@ do_a_abort: * show up in our scoped count. */ cnt_inits_to = 1; - /* - * pull out the scope_id from - * incoming pkt - */ + /* pull out the scope_id from + * incoming pkt */ } else if (IN6_IS_ADDR_SITELOCAL(&src6->sin6_addr) || IN6_IS_ADDR_SITELOCAL(&dst6->sin6_addr)) { /* @@ -5744,7 +5704,6 @@ do_a_abort: #ifdef INET6 struct sctp_nets *lnet; - #endif stc.loopback_scope = asoc->scope.loopback_scope; @@ -6206,9 +6165,9 @@ sctp_prune_prsctp(struct sctp_tcb *stcb, if (freed_spc >= dataout) { return; } - } /* if chunk was present */ - } /* if of sufficient priority */ - } /* if chunk has enabled */ + } /* if chunk was present */ + } /* if of sufficient priority */ + } /* if chunk has enabled */ } /* tailqforeach */ TAILQ_FOREACH_SAFE(chk, &asoc->send_queue, sctp_next, nchk) { @@ -6229,11 +6188,11 @@ sctp_prune_prsctp(struct sctp_tcb *stcb, if (freed_spc >= dataout) { return; } - } /* end if chk->data */ - } /* end if right class */ - } /* end if chk pr-sctp */ + } /* end if chk->data */ + } /* end if right class */ + } /* end if chk pr-sctp */ } /* tailqforeachsafe (chk) */ - } /* if enabled in asoc */ + } /* if enabled in asoc */ } int @@ -6476,10 +6435,8 @@ error_out: /* get the prepend space */ SCTP_BUF_RESV_UF(outchain, (SCTP_FIRST_MBUF_RESV + 4)); } else { - /* - * We really should not get a NULL - * in endofchain - */ + /* We really should not get a NULL + * in endofchain */ /* find end */ m = outchain; while (m) { @@ -6491,10 +6448,8 @@ error_out: } /* sanity */ if (*endofchain == NULL) { - /* - * huh, TSNH XXX maybe we - * should panic - */ + /* huh, TSNH XXX maybe we + * should panic */ sctp_m_freem(outchain); goto new_mbuf; } @@ -6693,17 +6648,13 @@ sctp_sendall_iterator(struct sctp_inpcb if ((*asoc->ss_functions.sctp_ss_is_user_msgs_incomplete) (stcb, asoc)) { goto abort_anyway; } - /* - * there is nothing queued to send, so I'm - * done... - */ + /* there is nothing queued to send, so I'm + * done... */ if ((SCTP_GET_STATE(asoc) != SCTP_STATE_SHUTDOWN_SENT) && (SCTP_GET_STATE(asoc) != SCTP_STATE_SHUTDOWN_RECEIVED) && (SCTP_GET_STATE(asoc) != SCTP_STATE_SHUTDOWN_ACK_SENT)) { - /* - * only send SHUTDOWN the first time - * through - */ + /* only send SHUTDOWN the first time + * through */ if (SCTP_GET_STATE(asoc) == SCTP_STATE_OPEN) { SCTP_STAT_DECR_GAUGE32(sctps_currestab); } @@ -7334,10 +7285,8 @@ re_look: SCTP_TCB_SEND_LOCK(stcb); send_lock_up = 1; if (sp->msg_is_complete) { - /* - * the sender finished the - * msg - */ + /* the sender finished the + * msg */ goto re_look; } } @@ -7955,9 +7904,9 @@ nothing_to_send: * (when CMT is off) then it calls * sctp_fill_outqueue for the net. This gets data on * the send queue for that network. - * - * In sctp_fill_outqueue TSN's are assigned and data is - * copied out of the stream buffers. Note mostly + * + * In sctp_fill_outqueue TSN's are assigned and data + * is copied out of the stream buffers. Note mostly * copy by reference (we hope). */ net->window_probe = 0; @@ -8226,10 +8175,8 @@ again_one_more_time: net->port, NULL, 0, 0, so_locked))) { - /* - * error, we could not - * output - */ + /* error, we could not + * output */ SCTPDBG(SCTP_DEBUG_OUTPUT3, "Gak send error %d\n", error); if (from_where == 0) { SCTP_STAT_INCR(sctps_lowlevelerrusr); @@ -8302,16 +8249,12 @@ again_one_more_time: * to where the sack is going.. */ if (chk->whoTo == net) { - /* - * Don't transmit it to where its - * going (current net) - */ + /* Don't transmit it to where its + * going (current net) */ continue; } else if (sack_goes_to == net) { - /* - * But do transmit it to this - * address - */ + /* But do transmit it to this + * address */ goto skip_net_check; } } @@ -8504,10 +8447,8 @@ again_one_more_time: net->port, NULL, 0, 0, so_locked))) { - /* - * error, we could not - * output - */ + /* error, we could not + * output */ SCTPDBG(SCTP_DEBUG_OUTPUT3, "Gak send error %d\n", error); if (from_where == 0) { SCTP_STAT_INCR(sctps_lowlevelerrusr); @@ -8704,17 +8645,13 @@ again_one_more_time: override_ok = 0; SCTP_STAT_INCR_COUNTER64(sctps_outcontrolchunks); } else if (override_ok) { - /* - * use this data's - * keyid - */ + /* use this data's + * keyid */ auth_keyid = chk->auth_keyid; override_ok = 0; } else if (auth_keyid != chk->auth_keyid) { - /* - * different keyid, - * so done bundling - */ + /* different keyid, + * so done bundling */ break; } } @@ -8793,8 +8730,7 @@ again_one_more_time: break; } } /* for (chunk gather loop for this net) */ - } /* if asoc.state OPEN */ -no_data_fill: +} /* if asoc.state OPEN */ no_data_fill: /* Is there something to send for this destination? */ if (outchain) { /* We may need to start a control timer or two */ @@ -9734,10 +9670,8 @@ one_chunk_around: auth_keyid = fwd->auth_keyid; override_ok = 0; } else if (fwd->auth_keyid != auth_keyid) { - /* - * different keyid, - * so done bundling - */ + /* different keyid, + * so done bundling */ break; } } @@ -10113,11 +10047,9 @@ do_it_again: if (asoc->max_burst > 0) { if (SCTP_BASE_SYSCTL(sctp_use_cwnd_based_maxburst)) { if ((net->flight_size + (asoc->max_burst * net->mtu)) < net->cwnd) { - /* - * JRS - Use the congestion + /* JRS - Use the congestion * control given in the - * congestion control module - */ + * congestion control module */ asoc->cc_functions.sctp_cwnd_update_after_output(stcb, net, asoc->max_burst); if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_LOG_MAXBURST_ENABLE) { sctp_log_maxburst(stcb, net, 0, asoc->max_burst, SCTP_MAX_BURST_APPLIED); @@ -10127,10 +10059,8 @@ do_it_again: net->fast_retran_ip = 0; } else { if (net->flight_size == 0) { - /* - * Should be decaying the - * cwnd here - */ + /* Should be decaying the + * cwnd here */ ; } } @@ -11017,23 +10947,18 @@ sctp_send_resp_msg(struct sockaddr *src, struct mbuf *mout; struct sctphdr *shout; struct sctp_chunkhdr *ch; - #if defined(INET) || defined(INET6) struct udphdr *udp; int ret; - #endif int len, cause_len, padding_len; - #ifdef INET struct sockaddr_in *src_sin, *dst_sin; struct ip *ip; - #endif #ifdef INET6 struct sockaddr_in6 *src_sin6, *dst_sin6; struct ip6_hdr *ip6; - #endif /* Compute the length of the cause and add final padding. */ @@ -11622,10 +11547,8 @@ sctp_send_cwr(struct sctp_tcb *stcb, str asoc = &stcb->asoc; TAILQ_FOREACH(chk, &asoc->control_send_queue, sctp_next) { if ((chk->rec.chunk_id.id == SCTP_ECN_CWR) && (net == chk->whoTo)) { - /* - * found a previous CWR queued to same destination - * update it if needed - */ + /* found a previous CWR queued to same destination + * update it if needed */ uint32_t ctsn; cwr = mtod(chk->data, struct sctp_cwr_chunk *); @@ -12169,10 +12092,8 @@ sctp_send_str_reset_req(struct sctp_tcb struct sctp_stream_out *oldstream; struct sctp_stream_queue_pending *sp, *nsp; int i; - #if defined(SCTP_DETAILED_STR_STATS) int j; - #endif oldstream = stcb->asoc.strmout; @@ -12204,10 +12125,8 @@ sctp_send_str_reset_req(struct sctp_tcb stcb->asoc.strmout[i].stream_no = i; stcb->asoc.strmout[i].state = oldstream[i].state; /* FIX ME FIX ME */ - /* - * This should be a SS_COPY operation FIX ME STREAM - * SCHEDULER EXPERT - */ + /* This should be a SS_COPY operation FIX ME STREAM + * SCHEDULER EXPERT */ stcb->asoc.ss_functions.sctp_ss_init_stream(stcb, &stcb->asoc.strmout[i], &oldstream[i]); /* now anything on those queues? */ TAILQ_FOREACH_SAFE(sp, &oldstream[i].outqueue, next, nsp) { @@ -12451,10 +12370,8 @@ sctp_sosend(struct socket *so, int error, use_sndinfo = 0; struct sctp_sndrcvinfo sndrcvninfo; struct sockaddr *addr_to_use; - #if defined(INET) && defined(INET6) struct sockaddr_in sin; - #endif if (control) { @@ -12739,10 +12656,8 @@ sctp_lower_sosend(struct socket *so, } if (stcb->sctp_ep->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) { stcb->sctp_ep->sctp_flags |= SCTP_PCB_FLAGS_CONNECTED; - /* - * Set the connected flag so we can queue - * data - */ + /* Set the connected flag so we can queue + * data */ soisconnecting(so); } hold_tcblock = 1; @@ -12752,10 +12667,8 @@ sctp_lower_sosend(struct socket *so, } else { SCTP_PRINTF("Huh-3? create lock should have been on??\n"); } - /* - * Turn on queue only flag to prevent data from - * being sent - */ + /* Turn on queue only flag to prevent data from + * being sent */ queue_only = 1; asoc = &stcb->asoc; SCTP_SET_STATE(asoc, SCTP_STATE_COOKIE_WAIT); @@ -13248,10 +13161,8 @@ skip_preblock: } /* PR-SCTP? */ if ((asoc->prsctp_supported) && (asoc->sent_queue_cnt_removeable > 0)) { - /* - * This is ugly but we must assure locking - * order - */ + /* This is ugly but we must assure locking + * order */ if (hold_tcblock == 0) { SCTP_TCB_LOCK(stcb); hold_tcblock = 1; @@ -13528,10 +13439,8 @@ dataless_eof: msg); sctp_abort_an_association(stcb->sctp_ep, stcb, op_err, SCTP_SO_LOCKED); - /* - * now relock the stcb so everything - * is sane - */ + /* now relock the stcb so everything + * is sane */ hold_tcblock = 0; stcb = NULL; goto out; @@ -13605,10 +13514,8 @@ skip_out_eof: if ((queue_only == 0) && (nagle_applies == 0) && (stcb->asoc.peers_rwnd && un_sent)) { /* we can attempt to send too. */ if (hold_tcblock == 0) { - /* - * If there is activity recv'ing sacks no need to - * send - */ + /* If there is activity recv'ing sacks no need to + * send */ if (SCTP_TCB_TRYLOCK(stcb)) { sctp_chunk_output(inp, stcb, SCTP_OUTPUT_FROM_USR_SEND, SCTP_SO_LOCKED); hold_tcblock = 1; @@ -13774,8 +13681,8 @@ sctp_v6src_match_nexthop(struct sockaddr SCTPDBG_ADDR(SCTP_DEBUG_OUTPUT2, (struct sockaddr *)&gw6); SCTPDBG(SCTP_DEBUG_OUTPUT2, "installed router is "); SCTPDBG_ADDR(SCTP_DEBUG_OUTPUT2, ro->ro_rt->rt_gateway); - if (sctp_cmpaddr((struct sockaddr *)&gw6, - ro->ro_rt->rt_gateway)) { + if (sctp_cmpaddr((struct sockaddr *)&gw6, ro->ro_rt->rt_gateway)) { + ND6_RUNLOCK(); SCTPDBG(SCTP_DEBUG_OUTPUT2, "pfxrouter is installed\n"); return (1); } @@ -13783,7 +13690,6 @@ sctp_v6src_match_nexthop(struct sockaddr SCTPDBG(SCTP_DEBUG_OUTPUT2, "pfxrouter is not installed\n"); return (0); } - #endif int From owner-svn-src-all@freebsd.org Sun Dec 18 13:00:13 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 212C7C8576D; Sun, 18 Dec 2016 13:00:13 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id DD0D115EE; Sun, 18 Dec 2016 13:00:12 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBID0CCF070624; Sun, 18 Dec 2016 13:00:12 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBID0BjG070614; Sun, 18 Dec 2016 13:00:11 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201612181300.uBID0BjG070614@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Sun, 18 Dec 2016 13:00:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r310218 - in stable/11/sys: netinet netinet6 X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Dec 2016 13:00:13 -0000 Author: tuexen Date: Sun Dec 18 13:00:11 2016 New Revision: 310218 URL: https://svnweb.freebsd.org/changeset/base/310218 Log: MFC r309607: Whitespace changes. The tools using to generate the sources has been updated and produces different whitespaces. Commit this seperately to avoid intermixing these with real code changes. Modified: stable/11/sys/netinet/sctp_asconf.c stable/11/sys/netinet/sctp_asconf.h stable/11/sys/netinet/sctp_bsd_addr.h stable/11/sys/netinet/sctp_cc_functions.c stable/11/sys/netinet/sctp_crc32.c stable/11/sys/netinet/sctp_crc32.h stable/11/sys/netinet/sctp_header.h stable/11/sys/netinet/sctp_indata.c stable/11/sys/netinet/sctp_input.c stable/11/sys/netinet/sctp_os_bsd.h stable/11/sys/netinet/sctp_pcb.h stable/11/sys/netinet/sctp_peeloff.h stable/11/sys/netinet/sctp_ss_functions.c stable/11/sys/netinet/sctp_structs.h stable/11/sys/netinet/sctp_sysctl.c stable/11/sys/netinet/sctp_timer.c stable/11/sys/netinet/sctp_uio.h stable/11/sys/netinet/sctp_usrreq.c stable/11/sys/netinet/sctp_var.h stable/11/sys/netinet/sctputil.c stable/11/sys/netinet/sctputil.h stable/11/sys/netinet6/sctp6_usrreq.c stable/11/sys/netinet6/sctp6_var.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/netinet/sctp_asconf.c ============================================================================== --- stable/11/sys/netinet/sctp_asconf.c Sun Dec 18 12:56:14 2016 (r310217) +++ stable/11/sys/netinet/sctp_asconf.c Sun Dec 18 13:00:11 2016 (r310218) @@ -151,24 +151,19 @@ sctp_process_asconf_add_ip(struct sockad union sctp_sockstore store; struct sctp_paramhdr *ph; uint16_t param_type, aparam_length; - #if defined(INET) || defined(INET6) uint16_t param_length; - #endif struct sockaddr *sa; int zero_address = 0; int bad_address = 0; - #ifdef INET struct sockaddr_in *sin; struct sctp_ipv4addr_param *v4addr; - #endif #ifdef INET6 struct sockaddr_in6 *sin6; struct sctp_ipv6addr_param *v6addr; - #endif aparam_length = ntohs(aph->ph.param_length); @@ -306,24 +301,19 @@ sctp_process_asconf_delete_ip(struct soc union sctp_sockstore store; struct sctp_paramhdr *ph; uint16_t param_type, aparam_length; - #if defined(INET) || defined(INET6) uint16_t param_length; - #endif struct sockaddr *sa; int zero_address = 0; int result; - #ifdef INET struct sockaddr_in *sin; struct sctp_ipv4addr_param *v4addr; - #endif #ifdef INET6 struct sockaddr_in6 *sin6; struct sctp_ipv6addr_param *v6addr; - #endif aparam_length = ntohs(aph->ph.param_length); @@ -441,23 +431,18 @@ sctp_process_asconf_set_primary(struct s union sctp_sockstore store; struct sctp_paramhdr *ph; uint16_t param_type, aparam_length; - #if defined(INET) || defined(INET6) uint16_t param_length; - #endif struct sockaddr *sa; int zero_address = 0; - #ifdef INET struct sockaddr_in *sin; struct sctp_ipv4addr_param *v4addr; - #endif #ifdef INET6 struct sockaddr_in6 *sin6; struct sctp_ipv6addr_param *v6addr; - #endif aparam_length = ntohs(aph->ph.param_length); @@ -1785,7 +1770,7 @@ sctp_handle_asconf_ack(struct mbuf *m, i * if there are any "sent" params still on the queue, these are * implicitly "success", or "failed" (if we got an error back) ... * so process these appropriately - * + * * we assume that the correlation_id's are monotonically increasing * beginning from 1 and that we don't have *that* many outstanding * at any given time @@ -1861,7 +1846,6 @@ sctp_is_scopeid_in_nets(struct sctp_tcb /* didn't find one */ return (0); } - #endif /* @@ -2435,10 +2419,8 @@ sctp_is_addr_pending(struct sctp_tcb *st } } - /* - * we want to find the sequences which consist of ADD -> DEL -> ADD - * or DEL -> ADD - */ + /* we want to find the sequences which consist of ADD -> DEL -> ADD + * or DEL -> ADD */ if (add_cnt > del_cnt || (add_cnt == del_cnt && last_param_type == SCTP_ADD_IP_ADDRESS)) { return (1); @@ -2490,10 +2472,8 @@ sctp_find_valid_localaddr(struct sctp_tc if (sctp_is_addr_restricted(stcb, sctp_ifa) && (!sctp_is_addr_pending(stcb, sctp_ifa))) continue; - /* - * found a valid local v4 address to - * use - */ + /* found a valid local v4 address to + * use */ if (addr_locked == SCTP_ADDR_NOT_LOCKED) SCTP_IPI_ADDR_RUNLOCK(); return (&sctp_ifa->address.sa); @@ -2510,10 +2490,8 @@ sctp_find_valid_localaddr(struct sctp_tc } sin6 = &sctp_ifa->address.sin6; if (IN6_IS_ADDR_UNSPECIFIED(&sin6->sin6_addr)) { - /* - * we skip unspecifed - * addresses - */ + /* we skip unspecifed + * addresses */ continue; } if (prison_check_ip6(stcb->sctp_ep->ip_inp.inp.inp_cred, @@ -2530,10 +2508,8 @@ sctp_find_valid_localaddr(struct sctp_tc if (sctp_is_addr_restricted(stcb, sctp_ifa) && (!sctp_is_addr_pending(stcb, sctp_ifa))) continue; - /* - * found a valid local v6 address to - * use - */ + /* found a valid local v6 address to + * use */ if (addr_locked == SCTP_ADDR_NOT_LOCKED) SCTP_IPI_ADDR_RUNLOCK(); return (&sctp_ifa->address.sa); @@ -2781,14 +2757,11 @@ sctp_process_initack_addresses(struct sc uint16_t plen, ptype; struct sctp_ifa *sctp_ifa; union sctp_sockstore store; - #ifdef INET6 struct sctp_ipv6addr_param addr6_store; - #endif #ifdef INET struct sctp_ipv4addr_param addr4_store; - #endif SCTPDBG(SCTP_DEBUG_ASCONF2, "processing init-ack addresses\n"); @@ -2915,19 +2888,16 @@ sctp_addr_in_initack(struct mbuf *m, uin { struct sctp_paramhdr tmp_param, *ph; uint16_t plen, ptype; - #ifdef INET struct sockaddr_in *sin; struct sctp_ipv4addr_param *a4p; struct sctp_ipv6addr_param addr4_store; - #endif #ifdef INET6 struct sockaddr_in6 *sin6; struct sctp_ipv6addr_param *a6p; struct sctp_ipv6addr_param addr6_store; struct sockaddr_in6 sin6_tmp; - #endif switch (sa->sa_family) { @@ -3079,14 +3049,11 @@ sctp_check_address_list_all(struct sctp_ struct sctp_ifn *sctp_ifn; struct sctp_ifa *sctp_ifa; uint32_t vrf_id; - #ifdef INET struct sockaddr_in *sin; - #endif #ifdef INET6 struct sockaddr_in6 *sin6; - #endif if (stcb) { @@ -3301,14 +3268,11 @@ sctp_asconf_send_nat_state_update(struct struct sctp_asconf_addr *aa; struct sctp_ifa *sctp_ifap; struct sctp_asconf_tag_param *vtag; - #ifdef INET struct sockaddr_in *to; - #endif #ifdef INET6 struct sockaddr_in6 *to6; - #endif if (net == NULL) { SCTPDBG(SCTP_DEBUG_ASCONF1, "sctp_asconf_send_nat_state_update: Missing net\n"); Modified: stable/11/sys/netinet/sctp_asconf.h ============================================================================== --- stable/11/sys/netinet/sctp_asconf.h Sun Dec 18 12:56:14 2016 (r310217) +++ stable/11/sys/netinet/sctp_asconf.h Sun Dec 18 13:00:11 2016 (r310218) @@ -90,7 +90,6 @@ sctp_asconf_send_nat_state_update(struct extern int sctp_is_addr_pending(struct sctp_tcb *, struct sctp_ifa *); - #endif /* _KERNEL */ #endif /* !_NETINET_SCTP_ASCONF_H_ */ Modified: stable/11/sys/netinet/sctp_bsd_addr.h ============================================================================== --- stable/11/sys/netinet/sctp_bsd_addr.h Sun Dec 18 12:56:14 2016 (r310217) +++ stable/11/sys/netinet/sctp_bsd_addr.h Sun Dec 18 13:00:11 2016 (r310218) @@ -48,7 +48,6 @@ void sctp_startup_iterator(void); #ifdef INET6 void sctp_gather_internal_ifa_flags(struct sctp_ifa *ifa); - #endif #ifdef SCTP_PACKET_LOGGING Modified: stable/11/sys/netinet/sctp_cc_functions.c ============================================================================== --- stable/11/sys/netinet/sctp_cc_functions.c Sun Dec 18 12:56:14 2016 (r310217) +++ stable/11/sys/netinet/sctp_cc_functions.c Sun Dec 18 13:00:11 2016 (r310218) @@ -160,17 +160,13 @@ sctp_cwnd_update_after_fr(struct sctp_tc uint32_t srtt; srtt = net->lastsa; - /* - * lastsa>>3; we don't need - * to devide ... - */ + /* lastsa>>3; we don't need + * to devide ... */ if (srtt == 0) { srtt = 1; } - /* - * Short Version => Equal to - * Contel Version MBe - */ + /* Short Version => Equal to + * Contel Version MBe */ net->ssthresh = (uint32_t) (((uint64_t) 4 * (uint64_t) net->mtu * (uint64_t) net->cwnd) / @@ -405,10 +401,8 @@ cc_bw_decrease(struct sctp_tcb *stcb, st net->flight_size, probepoint); if (net->cc_mod.rtcc.ret_from_eq) { - /* - * Switch over to CA if we are less - * aggressive - */ + /* Switch over to CA if we are less + * aggressive */ net->ssthresh = net->cwnd - 1; net->partial_bytes_acked = 0; } @@ -784,9 +778,9 @@ sctp_cwnd_update_after_sack_common(struc /* * At this point our bw_bytes has been updated by * incoming sack information. - * + * * But our bw may not yet be set. - * + * */ if ((net->cc_mod.rtcc.new_tot_time / 1000) > 0) { nbw = net->cc_mod.rtcc.bw_bytes / (net->cc_mod.rtcc.new_tot_time / 1000); @@ -851,10 +845,8 @@ sctp_cwnd_update_after_sack_common(struc } break; case SCTP_CMT_RPV2: - /* - * lastsa>>3; we don't need - * to divide ... - */ + /* lastsa>>3; we don't need + * to divide ... */ srtt = net->lastsa; if (srtt == 0) { srtt = 1; @@ -938,10 +930,8 @@ sctp_cwnd_update_after_sack_common(struc } break; case SCTP_CMT_RPV2: - /* - * lastsa>>3; we don't need - * to divide ... - */ + /* lastsa>>3; we don't need + * to divide ... */ srtt = net->lastsa; if (srtt == 0) { srtt = 1; @@ -1108,10 +1098,8 @@ sctp_cwnd_update_after_ecn_echo_common(s sctp_log_cwnd(stcb, net, (net->cwnd - old_cwnd), SCTP_CWND_LOG_FROM_SAT); } } else { - /* - * Further tuning down required over the drastic - * original cut - */ + /* Further tuning down required over the drastic + * original cut */ net->ssthresh -= (net->mtu * num_pkt_lost); net->cwnd -= (net->mtu * num_pkt_lost); if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_CWND_MONITOR_ENABLE) { @@ -1125,10 +1113,8 @@ sctp_cwnd_update_after_ecn_echo_common(s net->ssthresh = net->cwnd / 2; if (net->ssthresh < net->mtu) { net->ssthresh = net->mtu; - /* - * here back off the timer as well, to slow - * us down - */ + /* here back off the timer as well, to slow + * us down */ net->RTO <<= 1; } net->cwnd = net->ssthresh; @@ -1375,10 +1361,8 @@ sctp_cwnd_new_rtcc_transmission_begins(s cwnd_in_mtu = SCTP_BASE_SYSCTL(sctp_initial_cwnd); if (cwnd_in_mtu == 0) { - /* - * Using 0 means that the value of RFC 4960 - * is used. - */ + /* Using 0 means that the value of RFC 4960 + * is used. */ cwnd = min((net->mtu * 4), max((2 * net->mtu), SCTP_INITIAL_CWND)); } else { /* @@ -1390,10 +1374,8 @@ sctp_cwnd_new_rtcc_transmission_begins(s cwnd = (net->mtu - sizeof(struct sctphdr)) * cwnd_in_mtu; } if (net->cwnd > cwnd) { - /* - * Only set if we are not a timeout (i.e. - * down to 1 mtu) - */ + /* Only set if we are not a timeout (i.e. + * down to 1 mtu) */ net->cwnd = cwnd; } } @@ -2023,10 +2005,8 @@ htcp_param_update(struct sctp_nets *net) htcp_beta_update(&net->cc_mod.htcp_ca, minRTT, maxRTT); htcp_alpha_update(&net->cc_mod.htcp_ca); - /* - * add slowly fading memory for maxRTT to accommodate routing - * changes etc - */ + /* add slowly fading memory for maxRTT to accommodate routing + * changes etc */ if (minRTT > 0 && maxRTT > minRTT) net->cc_mod.htcp_ca.maxRTT = minRTT + ((maxRTT - minRTT) * 95) / 100; } @@ -2109,7 +2089,6 @@ htcp_min_cwnd(struct sctp_tcb *stcb, str { return (net->ssthresh); } - #endif static void Modified: stable/11/sys/netinet/sctp_crc32.c ============================================================================== --- stable/11/sys/netinet/sctp_crc32.c Sun Dec 18 12:56:14 2016 (r310217) +++ stable/11/sys/netinet/sctp_crc32.c Sun Dec 18 13:00:11 2016 (r310218) @@ -113,7 +113,6 @@ sctp_calculate_cksum(struct mbuf *m, uin base = sctp_finalize_crc32c(base); return (base); } - #endif /* !defined(SCTP_WITH_NO_CSUM) */ Modified: stable/11/sys/netinet/sctp_crc32.h ============================================================================== --- stable/11/sys/netinet/sctp_crc32.h Sun Dec 18 12:56:14 2016 (r310217) +++ stable/11/sys/netinet/sctp_crc32.h Sun Dec 18 13:00:11 2016 (r310218) @@ -39,9 +39,7 @@ __FBSDID("$FreeBSD$"); #if defined(_KERNEL) #if !defined(SCTP_WITH_NO_CSUM) uint32_t sctp_calculate_cksum(struct mbuf *, uint32_t); - #endif void sctp_delayed_cksum(struct mbuf *, uint32_t offset); - #endif /* _KERNEL */ #endif /* __crc32c_h__ */ Modified: stable/11/sys/netinet/sctp_header.h ============================================================================== --- stable/11/sys/netinet/sctp_header.h Sun Dec 18 12:56:14 2016 (r310217) +++ stable/11/sys/netinet/sctp_header.h Sun Dec 18 13:00:11 2016 (r310218) @@ -182,7 +182,6 @@ struct sctp_init { uint32_t initial_tsn; /* I-TSN */ /* optional param's follow */ } SCTP_PACKED; - #define SCTP_IDENTIFICATION_SIZE 16 #define SCTP_ADDRESS_SIZE 4 #define SCTP_RESERVE_SPACE 6 Modified: stable/11/sys/netinet/sctp_indata.c ============================================================================== --- stable/11/sys/netinet/sctp_indata.c Sun Dec 18 12:56:14 2016 (r310217) +++ stable/11/sys/netinet/sctp_indata.c Sun Dec 18 13:00:11 2016 (r310218) @@ -341,10 +341,8 @@ sctp_place_control_in_stream(struct sctp q = &strm->uno_inqueue; if (asoc->idata_supported == 0) { if (!TAILQ_EMPTY(q)) { - /* - * Only one stream can be here in old style - * -- abort - */ + /* Only one stream can be here in old style + * -- abort */ return (-1); } TAILQ_INSERT_TAIL(q, control, next_instrm); @@ -487,13 +485,13 @@ sctp_queue_data_to_stream(struct sctp_tc * has wrapped but not in the stream. Is this worth worrying about * or should we just change our queue sort at the bottom to be by * TSN. - * - * Could it also be legal for a peer to send ssn 1 with TSN 2 and ssn 2 - * with TSN 1? If the peer is doing some sort of funky TSN/SSN + * + * Could it also be legal for a peer to send ssn 1 with TSN 2 and + * ssn 2 with TSN 1? If the peer is doing some sort of funky TSN/SSN * assignment this could happen... and I don't see how this would be * a violation. So for now I am undecided an will leave the sort by * SSN alone. Maybe a hybred approach is the answer - * + * */ struct sctp_queued_to_read *at; int queue_needed; @@ -828,10 +826,8 @@ restart: TAILQ_INSERT_TAIL(&nc->reasm, tchk, sctp_next); tchk = TAILQ_FIRST(&control->reasm); } - /* - * Now lets add it to the queue - * after removing control - */ + /* Now lets add it to the queue + * after removing control */ TAILQ_INSERT_TAIL(&strm->uno_inqueue, nc, next_instrm); nc->on_strm_q = SCTP_ON_UNORDERED; if (control->on_strm_q) { @@ -855,10 +851,8 @@ restart: } sctp_wakeup_the_read_socket(stcb->sctp_ep, stcb, SCTP_SO_NOT_LOCKED); if ((nc->first_frag_seen) && !TAILQ_EMPTY(&nc->reasm)) { - /* - * Switch to the new guy and - * continue - */ + /* Switch to the new guy and + * continue */ control = nc; goto restart; } else { @@ -918,10 +912,8 @@ sctp_inject_old_unordered_data(struct sc uint32_t tmp; if (SCTP_TSN_GT(chk->rec.data.fsn_num, control->fsn_included)) { - /* - * Easy way the start of a new guy beyond - * the lowest - */ + /* Easy way the start of a new guy beyond + * the lowest */ goto place_chunk; } if ((chk->rec.data.fsn_num == control->fsn_included) || @@ -931,10 +923,10 @@ sctp_inject_old_unordered_data(struct sc * started the pd-api on the higher TSN * (since the equals part is a TSN failure * it must be that). - * - * We are completly hosed in that case since I - * have no way to recover. This really will - * only happen if we can get more TSN's + * + * We are completly hosed in that case since + * I have no way to recover. This really + * will only happen if we can get more TSN's * higher before the pd-api-point. */ sctp_abort_in_reasm(stcb, control, chk, @@ -1136,10 +1128,8 @@ done_un: } } if (strm->pd_api_started) { - /* - * Can't add more must have gotten an un-ordered above being - * partially delivered. - */ + /* Can't add more must have gotten an un-ordered above being + * partially delivered. */ return (0); } deliver_more: @@ -1171,21 +1161,15 @@ deliver_more: ret++; } if (((control->sinfo_flags >> 8) & SCTP_DATA_NOT_FRAG) == SCTP_DATA_NOT_FRAG) { - /* - * A singleton now slipping through - mark - * it non-revokable too - */ + /* A singleton now slipping through - mark + * it non-revokable too */ sctp_mark_non_revokable(asoc, control->sinfo_tsn); } else if (control->end_added == 0) { - /* - * Check if we can defer adding until its - * all there - */ + /* Check if we can defer adding until its + * all there */ if ((control->length < pd_point) || (strm->pd_api_started)) { - /* - * Don't need it or cannot add more - * (one being delivered that way) - */ + /* Don't need it or cannot add more + * (one being delivered that way) */ goto out; } } @@ -1387,10 +1371,8 @@ sctp_queue_data_for_reasm(struct sctp_tc * we know the first FSN (which is the TSN). */ if (SCTP_TSN_GE(control->fsn_included, chk->rec.data.fsn_num)) { - /* - * We have already delivered up to - * this so its a dup - */ + /* We have already delivered up to + * this so its a dup */ sctp_abort_in_reasm(stcb, control, chk, abort_flag, SCTP_FROM_SCTP_INDATA + SCTP_LOC_9); @@ -1417,10 +1399,8 @@ sctp_queue_data_for_reasm(struct sctp_tc */ if (SCTP_TSN_GE(control->fsn_included, chk->rec.data.fsn_num)) { - /* - * We have already delivered up to - * this so its a dup - */ + /* We have already delivered up to + * this so its a dup */ SCTPDBG(SCTP_DEBUG_XXX, "New fsn: %u is already seen in included_fsn: %u -- abort\n", chk->rec.data.fsn_num, control->fsn_included); @@ -1430,10 +1410,8 @@ sctp_queue_data_for_reasm(struct sctp_tc return; } } - /* - * validate not beyond top FSN if we have seen last - * one - */ + /* validate not beyond top FSN if we have seen last + * one */ if (SCTP_TSN_GT(chk->rec.data.fsn_num, control->top_fsn)) { SCTPDBG(SCTP_DEBUG_XXX, "New fsn: %u is beyond or at top_fsn: %u -- abort\n", @@ -1467,10 +1445,8 @@ sctp_queue_data_for_reasm(struct sctp_tc inserted = 1; break; } else if (at->rec.data.fsn_num == chk->rec.data.fsn_num) { - /* - * Gak, He sent me a duplicate str seq - * number - */ + /* Gak, He sent me a duplicate str seq + * number */ /* * foo bar, I guess I will just free this * new guy, should we abort too? FIX ME @@ -1778,19 +1754,15 @@ sctp_process_a_data_chunk(struct sctp_tc return (0); } if (ordered && ((control->sinfo_flags >> 8) & SCTP_DATA_UNORDERED)) { - /* - * We can't have a switched order with an - * unordered chunk - */ + /* We can't have a switched order with an + * unordered chunk */ snprintf(msg, sizeof(msg), "All fragments of a user message must be ordered or unordered (TSN=%8.8x)", tsn); goto err_out; } if (!ordered && (((control->sinfo_flags >> 8) & SCTP_DATA_UNORDERED) == 0)) { - /* - * We can't have a switched unordered with a - * ordered chunk - */ + /* We can't have a switched unordered with a + * ordered chunk */ snprintf(msg, sizeof(msg), "All fragments of a user message must be ordered or unordered (TSN=%8.8x)", tsn); goto err_out; @@ -2086,7 +2058,7 @@ sctp_process_a_data_chunk(struct sctp_tc * if it is not being reset.. that way we would not create a * HOLB when amongst streams being reset and those not being * reset. - * + * */ if (((liste = TAILQ_FIRST(&asoc->resetHead)) != NULL) && SCTP_TSN_GT(tsn, liste->tsn)) { @@ -2284,10 +2256,10 @@ sctp_slide_mapping_arrays(struct sctp_tc /* * Now we also need to check the mapping array in a couple of ways. * 1) Did we move the cum-ack point? - * - * When you first glance at this you might think that all entries that - * make up the position of the cum-ack would be in the nr-mapping - * array only.. i.e. things up to the cum-ack are always + * + * When you first glance at this you might think that all entries + * that make up the position of the cum-ack would be in the + * nr-mapping array only.. i.e. things up to the cum-ack are always * deliverable. Thats true with one exception, when its a fragmented * message we may not deliver the data until some threshold (or all * of it) is in place. So we must OR the nr_mapping_array and @@ -2346,10 +2318,8 @@ sctp_slide_mapping_arrays(struct sctp_tc /* The complete array was completed by a single FR */ /* highest becomes the cum-ack */ int clr; - #ifdef INVARIANTS unsigned int i; - #endif /* clear the array */ @@ -2497,8 +2467,7 @@ sctp_sack_check(struct sctp_tcb *stcb, i (stcb->asoc.numduptsns) || /* we have dup's */ (is_a_gap) || /* is still a gap */ (stcb->asoc.delayed_ack == 0) || /* Delayed sack disabled */ - (stcb->asoc.data_pkts_seen >= stcb->asoc.sack_freq) /* hit limit of pkts */ - ) { + (stcb->asoc.data_pkts_seen >= stcb->asoc.sack_freq) /* hit limit of pkts */ ) { if ((stcb->asoc.sctp_cmt_on_off > 0) && (SCTP_BASE_SYSCTL(sctp_cmt_use_dac)) && @@ -2510,9 +2479,9 @@ sctp_sack_check(struct sctp_tcb *stcb, i /* * CMT DAC algorithm: With CMT, delay acks * even in the face of - * - * reordering. Therefore, if acks that do not - * have to be sent because of the above + * + * reordering. Therefore, if acks that do + * not have to be sent because of the above * reasons, will be delayed. That is, acks * that would have been sent due to gap * reports will be delayed with DAC. Start @@ -2719,7 +2688,7 @@ sctp_process_data(struct mbuf **mm, int * Now, what do we do with KNOWN * chunks that are NOT in the right * place? - * + * * For now, I do nothing but ignore * them. We may later want to add * sysctl stuff to switch out and do @@ -2761,8 +2730,7 @@ sctp_process_data(struct mbuf **mm, int /* discard the rest of this packet */ stop_proc = 1; } /* else skip this bad chunk and - * continue... */ - break; + * continue... */ break; } /* switch of chunk type */ } *offset += SCTP_SIZE32(chk_length); @@ -3019,10 +2987,8 @@ sctp_process_segment_range(struct sctp_t } tp1->sent = SCTP_DATAGRAM_NR_ACKED; if (tp1->data) { - /* - * sa_ignore - * NO_NULL_CHK - */ + /* sa_ignore + * NO_NULL_CHK */ sctp_free_bufspace(stcb, &stcb->asoc, tp1, 1); sctp_m_freem(tp1->data); tp1->data = NULL; @@ -3031,8 +2997,7 @@ sctp_process_segment_range(struct sctp_t } } break; - } /* if (tp1->TSN_seq == theTSN) */ - if (SCTP_TSN_GT(tp1->rec.data.TSN_seq, theTSN)) { + } /* if (tp1->TSN_seq == theTSN) */ if (SCTP_TSN_GT(tp1->rec.data.TSN_seq, theTSN)) { break; } tp1 = TAILQ_NEXT(tp1, sctp_next); @@ -3483,10 +3448,8 @@ sctp_strike_gap_ack_chunks(struct sctp_t if ((stcb->asoc.prsctp_supported) && (PR_SCTP_RTX_ENABLED(tp1->flags))) { - /* - * Has it been retransmitted tv_sec times? - - * we store the retran count there. - */ + /* Has it been retransmitted tv_sec times? - + * we store the retran count there. */ if (tp1->snd_count > tp1->rec.data.timetodrop.tv_sec) { /* Yes, so drop it */ if (tp1->data != NULL) { @@ -3498,10 +3461,8 @@ sctp_strike_gap_ack_chunks(struct sctp_t continue; } } - /* - * SCTP_PRINTF("OK, we are now ready to FR this - * guy\n"); - */ + /* SCTP_PRINTF("OK, we are now ready to FR this + * guy\n"); */ if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_FR_LOGGING_ENABLE) { sctp_log_fr(tp1->rec.data.TSN_seq, tp1->snd_count, 0, SCTP_FR_MARKED); @@ -3521,18 +3482,14 @@ sctp_strike_gap_ack_chunks(struct sctp_t alt = tp1->whoTo; /* sa_ignore NO_NULL_CHK */ if (asoc->sctp_cmt_pf > 0) { - /* - * JRS 5/18/07 - If CMT PF is on, + /* JRS 5/18/07 - If CMT PF is on, * use the PF version of - * find_alt_net() - */ + * find_alt_net() */ alt = sctp_find_alternate_net(stcb, alt, 2); } else { - /* - * JRS 5/18/07 - If only CMT is on, + /* JRS 5/18/07 - If only CMT is on, * use the CMT version of - * find_alt_net() - */ + * find_alt_net() */ /* sa_ignore NO_NULL_CHK */ alt = sctp_find_alternate_net(stcb, alt, 1); } @@ -3713,10 +3670,8 @@ sctp_fs_audit(struct sctp_association *a struct sctp_tmit_chunk *chk; int inflight = 0, resend = 0, inbetween = 0, acked = 0, above = 0; int ret; - #ifndef INVARIANTS int entry_flight, entry_cnt; - #endif ret = 0; @@ -3933,8 +3888,7 @@ sctp_express_handle_sack(struct sctp_tcb tp1->whoTo->RTO = /* * sa_ignore - * NO_NULL_CH - * K + * NO_NULL_CHK */ sctp_calculate_rto(stcb, asoc, tp1->whoTo, @@ -4066,10 +4020,8 @@ sctp_express_handle_sack(struct sctp_tcb } if (net == stcb->asoc.primary_destination) { if (stcb->asoc.alternate) { - /* - * release the alternate, - * primary is good - */ + /* release the alternate, + * primary is good */ sctp_free_remote_addr(stcb->asoc.alternate); stcb->asoc.alternate = NULL; } @@ -4152,10 +4104,8 @@ again: } } else { if (net->window_probe) { - /* - * In window probes we must assure a timer - * is still running there - */ + /* In window probes we must assure a timer + * is still running there */ net->window_probe = 0; if (!SCTP_OS_TIMER_PENDING(&net->rxt_timer.timer)) { SCTP_OS_TIMER_START(&net->rxt_timer.timer, to_ticks, @@ -4775,7 +4725,7 @@ hopeless_peer: } /* * Check for revoked fragments: - * + * * if Previous sack - Had no frags then we can't have any revoked if * Previous sack - Had frag's then - If we now have frags aka * num_seg > 0 call sctp_check_for_revoked() to tell if peer revoked @@ -4840,10 +4790,8 @@ hopeless_peer: } if (net == stcb->asoc.primary_destination) { if (stcb->asoc.alternate) { - /* - * release the alternate, - * primary is good - */ + /* release the alternate, + * primary is good */ sctp_free_remote_addr(stcb->asoc.alternate); stcb->asoc.alternate = NULL; } @@ -5054,10 +5002,8 @@ again: } } else { if (net->window_probe) { - /* - * In window probes we must assure a timer - * is still running there - */ + /* In window probes we must assure a timer + * is still running there */ if (!SCTP_OS_TIMER_PENDING(&net->rxt_timer.timer)) { sctp_timer_start(SCTP_TIMER_TYPE_SEND, stcb->sctp_ep, stcb, net); @@ -5213,10 +5159,8 @@ sctp_kick_prsctp_reorder_queue(struct sc } else { /* Its a fragmented message */ if (ctl->first_frag_seen) { - /* - * Make it so this is next to - * deliver, we restore later - */ + /* Make it so this is next to + * deliver, we restore later */ strmin->last_sequence_delivered = ctl->sinfo_ssn - 1; need_reasm_check = 1; break; @@ -5280,10 +5224,8 @@ sctp_kick_prsctp_reorder_queue(struct sc } else { /* Its a fragmented message */ if (ctl->first_frag_seen) { - /* - * Make it so this is next to - * deliver - */ + /* Make it so this is next to + * deliver */ strmin->last_sequence_delivered = ctl->sinfo_ssn - 1; need_reasm_check = 1; break; @@ -5392,11 +5334,11 @@ sctp_handle_forward_tsn(struct sctp_tcb /* * here we will perform all the data receiver side steps for * processing FwdTSN, as required in by pr-sctp draft: - * + * * Assume we get FwdTSN(x): - * - * 1) update local cumTSN to x 2) try to further advance cumTSN to x + - * others we have 3) examine and update re-ordering queue on + * + * 1) update local cumTSN to x 2) try to further advance cumTSN to x + * + others we have 3) examine and update re-ordering queue on * pr-in-streams 4) clean up re-assembly queue 5) Send a sack to * report where we are. */ Modified: stable/11/sys/netinet/sctp_input.c ============================================================================== --- stable/11/sys/netinet/sctp_input.c Sun Dec 18 12:56:14 2016 (r310217) +++ stable/11/sys/netinet/sctp_input.c Sun Dec 18 13:00:11 2016 (r310218) @@ -161,10 +161,8 @@ sctp_handle_init(struct mbuf *m, int iph *abort_no_unlock = 1; goto outnow; } - /* - * We are only accepting if we have a socket with positive - * so_qlimit. - */ + /* We are only accepting if we have a socket with positive + * so_qlimit. */ if ((stcb == NULL) && ((inp->sctp_flags & SCTP_PCB_FLAGS_SOCKET_GONE) || (inp->sctp_flags & SCTP_PCB_FLAGS_SOCKET_ALLGONE) || @@ -709,10 +707,8 @@ sctp_handle_nat_colliding_state(struct s LIST_REMOVE(stcb, sctp_asocs); stcb->asoc.my_vtag = sctp_select_a_tag(stcb->sctp_ep, stcb->sctp_ep->sctp_lport, stcb->rport, 1); head = &SCTP_BASE_INFO(sctp_asochash)[SCTP_PCBHASH_ASOC(stcb->asoc.my_vtag, SCTP_BASE_INFO(hashasocmark))]; - /* - * put it in the bucket in the vtag hash of assoc's for the - * system - */ + /* put it in the bucket in the vtag hash of assoc's for the + * system */ LIST_INSERT_HEAD(head, stcb, sctp_asocs); sctp_send_initiate(stcb->sctp_ep, stcb, SCTP_SO_NOT_LOCKED); return (1); @@ -730,10 +726,8 @@ sctp_handle_nat_colliding_state(struct s sctp_toss_old_cookies(stcb, &stcb->asoc); stcb->asoc.my_vtag = sctp_select_a_tag(stcb->sctp_ep, stcb->sctp_ep->sctp_lport, stcb->rport, 1); head = &SCTP_BASE_INFO(sctp_asochash)[SCTP_PCBHASH_ASOC(stcb->asoc.my_vtag, SCTP_BASE_INFO(hashasocmark))]; - /* - * put it in the bucket in the vtag hash of assoc's for the - * system - */ + /* put it in the bucket in the vtag hash of assoc's for the + * system */ LIST_INSERT_HEAD(head, stcb, sctp_asocs); sctp_send_initiate(stcb->sctp_ep, stcb, SCTP_SO_NOT_LOCKED); return (1); @@ -764,7 +758,6 @@ sctp_handle_abort(struct sctp_abort_chun { #if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING) struct socket *so; - #endif uint16_t len; uint16_t error; @@ -866,10 +859,8 @@ sctp_handle_shutdown(struct sctp_shutdow struct sctp_association *asoc; int some_on_streamwheel; int old_state; - #if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING) struct socket *so; - #endif SCTPDBG(SCTP_DEBUG_INPUT2, @@ -946,10 +937,8 @@ sctp_handle_shutdown(struct sctp_shutdow (SCTP_GET_STATE(asoc) != SCTP_STATE_SHUTDOWN_SENT)) { SCTP_SET_STATE(asoc, SCTP_STATE_SHUTDOWN_RECEIVED); SCTP_CLEAR_SUBSTATE(asoc, SCTP_STATE_SHUTDOWN_PENDING); - /* - * notify upper layer that peer has initiated a - * shutdown - */ + /* notify upper layer that peer has initiated a + * shutdown */ sctp_ulp_notify(SCTP_NOTIFY_PEER_SHUTDOWN, stcb, 0, NULL, SCTP_SO_NOT_LOCKED); /* reset time */ @@ -999,7 +988,6 @@ sctp_handle_shutdown_ack(struct sctp_shu struct sctp_nets *net) { struct sctp_association *asoc; - #if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING) struct socket *so; @@ -1169,10 +1157,8 @@ sctp_handle_error(struct sctp_chunkhdr * uint16_t error_len; struct sctp_association *asoc; int adjust; - #if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING) struct socket *so; - #endif /* parse through all of the errors and process */ @@ -1492,10 +1478,8 @@ sctp_process_cookie_existing(struct mbuf int retval; int spec_flag = 0; uint32_t how_indx; - #if defined(SCTP_DETAILED_STR_STATS) int j; - #endif net = *netp; @@ -1619,7 +1603,6 @@ sctp_process_cookie_existing(struct mbuf ) { #if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING) struct socket *so; - #endif /* * Here is where collision would go if we @@ -1820,7 +1803,6 @@ sctp_process_cookie_existing(struct mbuf (inp->sctp_socket->so_qlimit == 0)) { *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@freebsd.org Sun Dec 18 13:04:31 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 35778C8596D; Sun, 18 Dec 2016 13:04:31 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id F1B901A2C; Sun, 18 Dec 2016 13:04:30 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBID4Uig074287; Sun, 18 Dec 2016 13:04:30 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBID4TXK074282; Sun, 18 Dec 2016 13:04:29 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201612181304.uBID4TXK074282@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Sun, 18 Dec 2016 13:04:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r310219 - stable/11/sys/netinet X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Dec 2016 13:04:31 -0000 Author: tuexen Date: Sun Dec 18 13:04:29 2016 New Revision: 310219 URL: https://svnweb.freebsd.org/changeset/base/310219 Log: MFC r309682: Cleanup the names of SSN, SID, TSN, FSN, PPID and MID. This made a couple of bugs visible in handling SSN wrap-arounds when using DATA chunks. Now bulk transfer seems to work fine... This fixes the issue reported in https://github.com/sctplab/usrsctp/issues/111 Modified: stable/11/sys/netinet/sctp_cc_functions.c stable/11/sys/netinet/sctp_constants.h stable/11/sys/netinet/sctp_header.h stable/11/sys/netinet/sctp_indata.c stable/11/sys/netinet/sctp_indata.h stable/11/sys/netinet/sctp_input.c stable/11/sys/netinet/sctp_output.c stable/11/sys/netinet/sctp_pcb.c stable/11/sys/netinet/sctp_ss_functions.c stable/11/sys/netinet/sctp_structs.h stable/11/sys/netinet/sctp_timer.c stable/11/sys/netinet/sctp_usrreq.c stable/11/sys/netinet/sctp_var.h stable/11/sys/netinet/sctputil.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/netinet/sctp_cc_functions.c ============================================================================== --- stable/11/sys/netinet/sctp_cc_functions.c Sun Dec 18 13:00:11 2016 (r310218) +++ stable/11/sys/netinet/sctp_cc_functions.c Sun Dec 18 13:04:29 2016 (r310219) @@ -205,7 +205,7 @@ sctp_cwnd_update_after_fr(struct sctp_tc /* Mark end of the window */ asoc->fast_recovery_tsn = asoc->sending_seq - 1; } else { - asoc->fast_recovery_tsn = lchk->rec.data.TSN_seq - 1; + asoc->fast_recovery_tsn = lchk->rec.data.tsn - 1; } /* @@ -218,7 +218,7 @@ sctp_cwnd_update_after_fr(struct sctp_tc /* Mark end of the window */ net->fast_recovery_tsn = asoc->sending_seq - 1; } else { - net->fast_recovery_tsn = lchk->rec.data.TSN_seq - 1; + net->fast_recovery_tsn = lchk->rec.data.tsn - 1; } sctp_timer_stop(SCTP_TIMER_TYPE_SEND, @@ -1698,7 +1698,7 @@ sctp_hs_cwnd_update_after_fr(struct sctp /* Mark end of the window */ asoc->fast_recovery_tsn = asoc->sending_seq - 1; } else { - asoc->fast_recovery_tsn = lchk->rec.data.TSN_seq - 1; + asoc->fast_recovery_tsn = lchk->rec.data.tsn - 1; } /* @@ -1711,7 +1711,7 @@ sctp_hs_cwnd_update_after_fr(struct sctp /* Mark end of the window */ net->fast_recovery_tsn = asoc->sending_seq - 1; } else { - net->fast_recovery_tsn = lchk->rec.data.TSN_seq - 1; + net->fast_recovery_tsn = lchk->rec.data.tsn - 1; } sctp_timer_stop(SCTP_TIMER_TYPE_SEND, @@ -2228,7 +2228,7 @@ sctp_htcp_cwnd_update_after_fr(struct sc /* Mark end of the window */ asoc->fast_recovery_tsn = asoc->sending_seq - 1; } else { - asoc->fast_recovery_tsn = lchk->rec.data.TSN_seq - 1; + asoc->fast_recovery_tsn = lchk->rec.data.tsn - 1; } /* @@ -2241,7 +2241,7 @@ sctp_htcp_cwnd_update_after_fr(struct sc /* Mark end of the window */ net->fast_recovery_tsn = asoc->sending_seq - 1; } else { - net->fast_recovery_tsn = lchk->rec.data.TSN_seq - 1; + net->fast_recovery_tsn = lchk->rec.data.tsn - 1; } sctp_timer_stop(SCTP_TIMER_TYPE_SEND, Modified: stable/11/sys/netinet/sctp_constants.h ============================================================================== --- stable/11/sys/netinet/sctp_constants.h Sun Dec 18 13:00:11 2016 (r310218) +++ stable/11/sys/netinet/sctp_constants.h Sun Dec 18 13:04:29 2016 (r310219) @@ -898,8 +898,9 @@ __FBSDID("$FreeBSD$"); #define SCTP_SSN_GE(a, b) SCTP_UINT16_GE(a, b) #define SCTP_TSN_GT(a, b) SCTP_UINT32_GT(a, b) #define SCTP_TSN_GE(a, b) SCTP_UINT32_GE(a, b) -#define SCTP_MSGID_GT(o, a, b) ((o == 1) ? SCTP_UINT16_GT((uint16_t)a, (uint16_t)b) : SCTP_UINT32_GT(a, b)) -#define SCTP_MSGID_GE(o, a, b) ((o == 1) ? SCTP_UINT16_GE((uint16_t)a, (uint16_t)b) : SCTP_UINT32_GE(a, b)) +#define SCTP_MID_GT(i, a, b) (((i) == 1) ? SCTP_UINT32_GT(a, b) : SCTP_UINT16_GT((uint16_t)a, (uint16_t)b)) +#define SCTP_MID_GE(i, a, b) (((i) == 1) ? SCTP_UINT32_GE(a, b) : SCTP_UINT16_GE((uint16_t)a, (uint16_t)b)) +#define SCTP_MID_EQ(i, a, b) (((i) == 1) ? a == b : (uint16_t)a == (uint16_t)b) /* Mapping array manipulation routines */ #define SCTP_IS_TSN_PRESENT(arry, gap) ((arry[(gap >> 3)] >> (gap & 0x07)) & 0x01) Modified: stable/11/sys/netinet/sctp_header.h ============================================================================== --- stable/11/sys/netinet/sctp_header.h Sun Dec 18 13:00:11 2016 (r310218) +++ stable/11/sys/netinet/sctp_header.h Sun Dec 18 13:04:29 2016 (r310219) @@ -141,9 +141,9 @@ struct sctp_supported_chunk_types_param */ struct sctp_data { uint32_t tsn; - uint16_t stream_id; - uint16_t stream_sequence; - uint32_t protocol_id; + uint16_t sid; + uint16_t ssn; + uint32_t ppid; /* user data follows */ } SCTP_PACKED; @@ -154,11 +154,11 @@ struct sctp_data_chunk { struct sctp_idata { uint32_t tsn; - uint16_t stream_id; + uint16_t sid; uint16_t reserved; /* Where does the SSN go? */ - uint32_t msg_id; + uint32_t mid; union { - uint32_t protocol_id; + uint32_t ppid; uint32_t fsn; /* Fragment Sequence Number */ } ppid_fsn; /* user data follows */ @@ -390,14 +390,14 @@ struct sctp_forward_tsn_chunk { } SCTP_PACKED; struct sctp_strseq { - uint16_t stream; - uint16_t sequence; + uint16_t sid; + uint16_t ssn; } SCTP_PACKED; struct sctp_strseq_mid { - uint16_t stream; + uint16_t sid; uint16_t flags; - uint32_t msg_id; + uint32_t mid; }; struct sctp_forward_tsn_msg { Modified: stable/11/sys/netinet/sctp_indata.c ============================================================================== --- stable/11/sys/netinet/sctp_indata.c Sun Dec 18 13:00:11 2016 (r310218) +++ stable/11/sys/netinet/sctp_indata.c Sun Dec 18 13:04:29 2016 (r310219) @@ -130,8 +130,8 @@ struct sctp_queued_to_read * sctp_build_readq_entry(struct sctp_tcb *stcb, struct sctp_nets *net, uint32_t tsn, uint32_t ppid, - uint32_t context, uint16_t stream_no, - uint32_t stream_seq, uint8_t flags, + uint32_t context, uint16_t sid, + uint32_t mid, uint8_t flags, struct mbuf *dm) { struct sctp_queued_to_read *read_queue_e = NULL; @@ -141,14 +141,14 @@ sctp_build_readq_entry(struct sctp_tcb * goto failed_build; } memset(read_queue_e, 0, sizeof(struct sctp_queued_to_read)); - read_queue_e->sinfo_stream = stream_no; - read_queue_e->sinfo_ssn = stream_seq; + read_queue_e->sinfo_stream = sid; read_queue_e->sinfo_flags = (flags << 8); read_queue_e->sinfo_ppid = ppid; read_queue_e->sinfo_context = context; read_queue_e->sinfo_tsn = tsn; read_queue_e->sinfo_cumtsn = tsn; read_queue_e->sinfo_assoc_id = sctp_get_associd(stcb); + read_queue_e->mid = mid; read_queue_e->top_fsn = read_queue_e->fsn_included = 0xffffffff; TAILQ_INIT(&read_queue_e->reasm); read_queue_e->whoFrom = net; @@ -366,7 +366,7 @@ sctp_place_control_in_stream(struct sctp return (0); } else { TAILQ_FOREACH(at, q, next_instrm) { - if (SCTP_TSN_GT(at->msg_id, control->msg_id)) { + if (SCTP_MID_GT(asoc->idata_supported, at->mid, control->mid)) { /* * one in queue is bigger than the new one, * insert before this one @@ -378,7 +378,7 @@ sctp_place_control_in_stream(struct sctp control->on_strm_q = SCTP_ON_ORDERED; } break; - } else if (at->msg_id == control->msg_id) { + } else if (SCTP_MID_EQ(asoc->idata_supported, at->mid, control->mid)) { /* * Gak, He sent me a duplicate msg id * number?? return -1 to abort. @@ -423,18 +423,18 @@ sctp_abort_in_reasm(struct sctp_tcb *stc "Reass %x,CF:%x,TSN=%8.8x,SID=%4.4x,FSN=%8.8x,MID:%8.8x", opspot, control->fsn_included, - chk->rec.data.TSN_seq, - chk->rec.data.stream_number, - chk->rec.data.fsn_num, chk->rec.data.stream_seq); + chk->rec.data.tsn, + chk->rec.data.sid, + chk->rec.data.fsn, chk->rec.data.mid); } else { snprintf(msg, sizeof(msg), "Reass %x,CI:%x,TSN=%8.8x,SID=%4.4x,FSN=%4.4x,SSN:%4.4x", opspot, control->fsn_included, - chk->rec.data.TSN_seq, - chk->rec.data.stream_number, - chk->rec.data.fsn_num, - (uint16_t) chk->rec.data.stream_seq); + chk->rec.data.tsn, + chk->rec.data.sid, + chk->rec.data.fsn, + (uint16_t) chk->rec.data.mid); } oper = sctp_generate_cause(SCTP_CAUSE_PROTOCOL_VIOLATION, msg); sctp_m_freem(chk->data); @@ -502,19 +502,27 @@ sctp_queue_data_to_stream(struct sctp_tc if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_STR_LOGGING_ENABLE) { sctp_log_strm_del(control, NULL, SCTP_STR_LOG_FROM_INTO_STRD); } - if (SCTP_MSGID_GT((!asoc->idata_supported), strm->last_sequence_delivered, control->sinfo_ssn)) { + if (SCTP_MID_GT((asoc->idata_supported), strm->last_mid_delivered, control->mid)) { /* The incoming sseq is behind where we last delivered? */ SCTPDBG(SCTP_DEBUG_INDATA1, "Duplicate S-SEQ: %u delivered: %u from peer, Abort association\n", - control->sinfo_ssn, strm->last_sequence_delivered); + control->mid, strm->last_mid_delivered); protocol_error: /* * throw it in the stream so it gets cleaned up in * association destruction */ TAILQ_INSERT_HEAD(&strm->inqueue, control, next_instrm); - snprintf(msg, sizeof(msg), "Delivered SSN=%4.4x, got TSN=%8.8x, SID=%4.4x, SSN=%4.4x", - strm->last_sequence_delivered, control->sinfo_tsn, - control->sinfo_stream, control->sinfo_ssn); + if (asoc->idata_supported) { + snprintf(msg, sizeof(msg), "Delivered MID=%8.8x, got TSN=%8.8x, SID=%4.4x, MID=%8.8x", + strm->last_mid_delivered, control->sinfo_tsn, + control->sinfo_stream, control->mid); + } else { + snprintf(msg, sizeof(msg), "Delivered SSN=%4.4x, got TSN=%8.8x, SID=%4.4x, SSN=%4.4x", + (uint16_t) strm->last_mid_delivered, + control->sinfo_tsn, + control->sinfo_stream, + (uint16_t) control->mid); + } op_err = sctp_generate_cause(SCTP_CAUSE_PROTOCOL_VIOLATION, msg); stcb->sctp_ep->last_abort_code = SCTP_FROM_SCTP_INDATA + SCTP_LOC_2; sctp_abort_an_association(stcb->sctp_ep, stcb, op_err, SCTP_SO_NOT_LOCKED); @@ -528,8 +536,8 @@ protocol_error: queue_needed = 1; asoc->size_on_all_streams += control->length; sctp_ucount_incr(asoc->cnt_on_all_streams); - nxt_todel = strm->last_sequence_delivered + 1; - if (nxt_todel == control->sinfo_ssn) { + nxt_todel = strm->last_mid_delivered + 1; + if (SCTP_MID_EQ(asoc->idata_supported, nxt_todel, control->mid)) { #if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING) struct socket *so; @@ -552,7 +560,7 @@ protocol_error: queue_needed = 0; asoc->size_on_all_streams -= control->length; sctp_ucount_decr(asoc->cnt_on_all_streams); - strm->last_sequence_delivered++; + strm->last_mid_delivered++; sctp_mark_non_revokable(asoc, control->sinfo_tsn); sctp_add_to_readq(stcb->sctp_ep, stcb, control, @@ -560,8 +568,8 @@ protocol_error: SCTP_READ_LOCK_NOT_HELD, SCTP_SO_LOCKED); TAILQ_FOREACH_SAFE(control, &strm->inqueue, next_instrm, at) { /* all delivered */ - nxt_todel = strm->last_sequence_delivered + 1; - if ((nxt_todel == control->sinfo_ssn) && + nxt_todel = strm->last_mid_delivered + 1; + if (SCTP_MID_EQ(asoc->idata_supported, nxt_todel, control->mid) && (((control->sinfo_flags >> 8) & SCTP_DATA_NOT_FRAG) == SCTP_DATA_NOT_FRAG)) { asoc->size_on_all_streams -= control->length; sctp_ucount_decr(asoc->cnt_on_all_streams); @@ -574,7 +582,7 @@ protocol_error: #endif } control->on_strm_q = 0; - strm->last_sequence_delivered++; + strm->last_mid_delivered++; /* * We ignore the return of deliver_data here * since we always can hold the chunk on the @@ -592,7 +600,7 @@ protocol_error: SCTP_READ_LOCK_NOT_HELD, SCTP_SO_LOCKED); continue; - } else if (nxt_todel == control->sinfo_ssn) { + } else if (SCTP_MID_EQ(asoc->idata_supported, nxt_todel, control->mid)) { *need_reasm = 1; } break; @@ -608,8 +616,8 @@ protocol_error: */ if (sctp_place_control_in_stream(strm, asoc, control)) { snprintf(msg, sizeof(msg), - "Queue to str msg_id: %u duplicate", - control->msg_id); + "Queue to str MID: %u duplicate", + control->mid); sctp_clean_up_control(stcb, control); op_err = sctp_generate_cause(SCTP_CAUSE_PROTOCOL_VIOLATION, msg); stcb->sctp_ep->last_abort_code = SCTP_FROM_SCTP_INDATA + SCTP_LOC_3; @@ -720,10 +728,10 @@ sctp_build_readq_entry_from_ctl(struct s { memset(nc, 0, sizeof(struct sctp_queued_to_read)); nc->sinfo_stream = control->sinfo_stream; - nc->sinfo_ssn = control->sinfo_ssn; + nc->mid = control->mid; TAILQ_INIT(&nc->reasm); nc->top_fsn = control->top_fsn; - nc->msg_id = control->msg_id; + nc->mid = control->mid; nc->sinfo_flags = control->sinfo_flags; nc->sinfo_ppid = control->sinfo_ppid; nc->sinfo_context = control->sinfo_context; @@ -762,11 +770,11 @@ sctp_handle_old_unordered_data(struct sc { /* * Special handling for the old un-ordered data chunk. All the - * chunks/TSN's go to msg_id 0. So we have to do the old style - * watching to see if we have it all. If you return one, no other - * control entries on the un-ordered queue will be looked at. In - * theory there should be no others entries in reality, unless the - * guy is sending both unordered NDATA and unordered DATA... + * chunks/TSN's go to mid 0. So we have to do the old style watching + * to see if we have it all. If you return one, no other control + * entries on the un-ordered queue will be looked at. In theory + * there should be no others entries in reality, unless the guy is + * sending both unordered NDATA and unordered DATA... */ struct sctp_tmit_chunk *chk, *lchk, *tchk; uint32_t fsn; @@ -783,7 +791,7 @@ restart: fsn = control->fsn_included + 1; /* Now what can we add? */ TAILQ_FOREACH_SAFE(chk, &control->reasm, sctp_next, lchk) { - if (chk->rec.data.fsn_num == fsn) { + if (chk->rec.data.fsn == fsn) { /* Ok lets add it */ sctp_alloc_a_readq(stcb, nc); if (nc == NULL) { @@ -810,11 +818,11 @@ restart: asoc->size_on_reasm_queue -= tchk->send_size; sctp_ucount_decr(asoc->cnt_on_reasm_queue); nc->first_frag_seen = 1; - nc->fsn_included = tchk->rec.data.fsn_num; + nc->fsn_included = tchk->rec.data.fsn; nc->data = tchk->data; - nc->sinfo_ppid = tchk->rec.data.payloadtype; - nc->sinfo_tsn = tchk->rec.data.TSN_seq; - sctp_mark_non_revokable(asoc, tchk->rec.data.TSN_seq); + nc->sinfo_ppid = tchk->rec.data.ppid; + nc->sinfo_tsn = tchk->rec.data.tsn; + sctp_mark_non_revokable(asoc, tchk->rec.data.tsn); tchk->data = NULL; sctp_free_a_chunk(stcb, tchk, SCTP_SO_NOT_LOCKED); sctp_setup_tail_pointer(nc); @@ -900,7 +908,7 @@ sctp_inject_old_unordered_data(struct sc /* Its the very first one. */ SCTPDBG(SCTP_DEBUG_XXX, "chunk is a first fsn: %u becomes fsn_included\n", - chk->rec.data.fsn_num); + chk->rec.data.fsn); if (control->first_frag_seen) { /* * In old un-ordered we can reassembly on one @@ -911,12 +919,12 @@ sctp_inject_old_unordered_data(struct sc struct mbuf *tdata; uint32_t tmp; - if (SCTP_TSN_GT(chk->rec.data.fsn_num, control->fsn_included)) { + if (SCTP_TSN_GT(chk->rec.data.fsn, control->fsn_included)) { /* Easy way the start of a new guy beyond * the lowest */ goto place_chunk; } - if ((chk->rec.data.fsn_num == control->fsn_included) || + if ((chk->rec.data.fsn == control->fsn_included) || (control->pdapi_started)) { /* * Ok this should not happen, if it does we @@ -950,25 +958,25 @@ sctp_inject_old_unordered_data(struct sc sctp_setup_tail_pointer(control); /* Fix the FSN included */ tmp = control->fsn_included; - control->fsn_included = chk->rec.data.fsn_num; - chk->rec.data.fsn_num = tmp; + control->fsn_included = chk->rec.data.fsn; + chk->rec.data.fsn = tmp; /* Fix the TSN included */ tmp = control->sinfo_tsn; - control->sinfo_tsn = chk->rec.data.TSN_seq; - chk->rec.data.TSN_seq = tmp; + control->sinfo_tsn = chk->rec.data.tsn; + chk->rec.data.tsn = tmp; /* Fix the PPID included */ tmp = control->sinfo_ppid; - control->sinfo_ppid = chk->rec.data.payloadtype; - chk->rec.data.payloadtype = tmp; + control->sinfo_ppid = chk->rec.data.ppid; + chk->rec.data.ppid = tmp; /* Fix tail pointer */ goto place_chunk; } control->first_frag_seen = 1; - control->top_fsn = control->fsn_included = chk->rec.data.fsn_num; - control->sinfo_tsn = chk->rec.data.TSN_seq; - control->sinfo_ppid = chk->rec.data.payloadtype; + control->top_fsn = control->fsn_included = chk->rec.data.fsn; + control->sinfo_tsn = chk->rec.data.tsn; + control->sinfo_ppid = chk->rec.data.ppid; control->data = chk->data; - sctp_mark_non_revokable(asoc, chk->rec.data.TSN_seq); + sctp_mark_non_revokable(asoc, chk->rec.data.tsn); chk->data = NULL; sctp_free_a_chunk(stcb, chk, SCTP_SO_NOT_LOCKED); sctp_setup_tail_pointer(control); @@ -977,7 +985,7 @@ sctp_inject_old_unordered_data(struct sc place_chunk: inserted = 0; TAILQ_FOREACH(at, &control->reasm, sctp_next) { - if (SCTP_TSN_GT(at->rec.data.fsn_num, chk->rec.data.fsn_num)) { + if (SCTP_TSN_GT(at->rec.data.fsn, chk->rec.data.fsn)) { /* * This one in queue is bigger than the new one, * insert the new one before at. @@ -987,7 +995,7 @@ place_chunk: inserted = 1; TAILQ_INSERT_BEFORE(at, chk, sctp_next); break; - } else if (at->rec.data.fsn_num == chk->rec.data.fsn_num) { + } else if (at->rec.data.fsn == chk->rec.data.fsn) { /* * They sent a duplicate fsn number. This really * should not happen since the FSN is a TSN and it @@ -1003,7 +1011,7 @@ place_chunk: /* Its at the end */ asoc->size_on_reasm_queue += chk->send_size; sctp_ucount_incr(asoc->cnt_on_reasm_queue); - control->top_fsn = chk->rec.data.fsn_num; + control->top_fsn = chk->rec.data.fsn; TAILQ_INSERT_TAIL(&control->reasm, chk, sctp_next); } } @@ -1044,7 +1052,7 @@ sctp_deliver_reasm_check(struct sctp_tcb } while (control) { SCTPDBG(SCTP_DEBUG_XXX, "Looking at control: %p e(%d) ssn: %u top_fsn: %u inc_fsn: %u -uo\n", - control, control->end_added, control->sinfo_ssn, control->top_fsn, control->fsn_included); + control, control->end_added, control->mid, control->top_fsn, control->fsn_included); nctl = TAILQ_NEXT(control, next_instrm); if (control->end_added) { /* We just put the last bit on */ @@ -1089,7 +1097,7 @@ done_un: if (control == NULL) { return (ret); } - if (strm->last_sequence_delivered == control->sinfo_ssn) { + if (SCTP_MID_EQ(asoc->idata_supported, strm->last_mid_delivered, control->mid)) { /* * Ok the guy at the top was being partially delivered * completed, so we remove it. Note the pd_api flag was @@ -1099,9 +1107,9 @@ done_un: nctl = TAILQ_NEXT(control, next_instrm); SCTPDBG(SCTP_DEBUG_XXX, "Looking at control: %p e(%d) ssn: %u top_fsn: %u inc_fsn: %u (lastdel: %u)- o\n", - control, control->end_added, control->sinfo_ssn, + control, control->end_added, control->mid, control->top_fsn, control->fsn_included, - strm->last_sequence_delivered); + strm->last_mid_delivered); if (control->end_added) { if (control->on_strm_q) { #ifdef INVARIANTS @@ -1133,14 +1141,14 @@ done_un: return (0); } deliver_more: - next_to_del = strm->last_sequence_delivered + 1; + next_to_del = strm->last_mid_delivered + 1; if (control) { SCTPDBG(SCTP_DEBUG_XXX, "Looking at control: %p e(%d) ssn: %u top_fsn: %u inc_fsn: %u (nxtdel: %u)- o\n", - control, control->end_added, control->sinfo_ssn, control->top_fsn, control->fsn_included, + control, control->end_added, control->mid, control->top_fsn, control->fsn_included, next_to_del); nctl = TAILQ_NEXT(control, next_instrm); - if ((control->sinfo_ssn == next_to_del) && + if (SCTP_MID_EQ(asoc->idata_supported, control->mid, next_to_del) && (control->first_frag_seen)) { int done; @@ -1180,7 +1188,7 @@ deliver_more: &stcb->sctp_socket->so_rcv, control->end_added, inp_read_lock_held, SCTP_SO_NOT_LOCKED); } - strm->last_sequence_delivered = next_to_del; + strm->last_mid_delivered = next_to_del; if (done) { control = nctl; goto deliver_more; @@ -1221,10 +1229,10 @@ sctp_add_chk_to_control(struct sctp_queu } else { sctp_add_to_tail_pointer(control, chk->data); } - control->fsn_included = chk->rec.data.fsn_num; + control->fsn_included = chk->rec.data.fsn; asoc->size_on_reasm_queue -= chk->send_size; sctp_ucount_decr(asoc->cnt_on_reasm_queue); - sctp_mark_non_revokable(asoc, chk->rec.data.TSN_seq); + sctp_mark_non_revokable(asoc, chk->rec.data.tsn); chk->data = NULL; if (chk->rec.data.rcv_flags & SCTP_DATA_FIRST_FRAG) { control->first_frag_seen = 1; @@ -1325,7 +1333,7 @@ sctp_queue_data_for_reasm(struct sctp_tc /* Its the very first one. */ SCTPDBG(SCTP_DEBUG_XXX, "chunk is a first fsn: %u becomes fsn_included\n", - chk->rec.data.fsn_num); + chk->rec.data.fsn); if (control->first_frag_seen) { /* * Error on senders part, they either sent us two @@ -1339,9 +1347,9 @@ sctp_queue_data_for_reasm(struct sctp_tc return; } control->first_frag_seen = 1; - control->fsn_included = chk->rec.data.fsn_num; + control->fsn_included = chk->rec.data.fsn; control->data = chk->data; - sctp_mark_non_revokable(asoc, chk->rec.data.TSN_seq); + sctp_mark_non_revokable(asoc, chk->rec.data.tsn); chk->data = NULL; sctp_free_a_chunk(stcb, chk, SCTP_SO_NOT_LOCKED); sctp_setup_tail_pointer(control); @@ -1351,16 +1359,16 @@ sctp_queue_data_for_reasm(struct sctp_tc if (control->last_frag_seen == 0) { /* Still willing to raise highest FSN seen */ - if (SCTP_TSN_GT(chk->rec.data.fsn_num, control->top_fsn)) { + if (SCTP_TSN_GT(chk->rec.data.fsn, control->top_fsn)) { SCTPDBG(SCTP_DEBUG_XXX, "We have a new top_fsn: %u\n", - chk->rec.data.fsn_num); - control->top_fsn = chk->rec.data.fsn_num; + chk->rec.data.fsn); + control->top_fsn = chk->rec.data.fsn; } if (chk->rec.data.rcv_flags & SCTP_DATA_LAST_FRAG) { SCTPDBG(SCTP_DEBUG_XXX, "The last fsn is now in place fsn: %u\n", - chk->rec.data.fsn_num); + chk->rec.data.fsn); control->last_frag_seen = 1; } if (asoc->idata_supported || control->first_frag_seen) { @@ -1370,7 +1378,7 @@ sctp_queue_data_for_reasm(struct sctp_tc * DATA we have to receive the first before * we know the first FSN (which is the TSN). */ - if (SCTP_TSN_GE(control->fsn_included, chk->rec.data.fsn_num)) { + if (SCTP_TSN_GE(control->fsn_included, chk->rec.data.fsn)) { /* We have already delivered up to * this so its a dup */ sctp_abort_in_reasm(stcb, control, chk, @@ -1384,7 +1392,7 @@ sctp_queue_data_for_reasm(struct sctp_tc /* Second last? huh? */ SCTPDBG(SCTP_DEBUG_XXX, "Duplicate last fsn: %u (top: %u) -- abort\n", - chk->rec.data.fsn_num, control->top_fsn); + chk->rec.data.fsn, control->top_fsn); sctp_abort_in_reasm(stcb, control, chk, abort_flag, SCTP_FROM_SCTP_INDATA + SCTP_LOC_10); @@ -1398,12 +1406,12 @@ sctp_queue_data_for_reasm(struct sctp_tc * we know the first FSN (which is the TSN). */ - if (SCTP_TSN_GE(control->fsn_included, chk->rec.data.fsn_num)) { + if (SCTP_TSN_GE(control->fsn_included, chk->rec.data.fsn)) { /* We have already delivered up to * this so its a dup */ SCTPDBG(SCTP_DEBUG_XXX, "New fsn: %u is already seen in included_fsn: %u -- abort\n", - chk->rec.data.fsn_num, control->fsn_included); + chk->rec.data.fsn, control->fsn_included); sctp_abort_in_reasm(stcb, control, chk, abort_flag, SCTP_FROM_SCTP_INDATA + SCTP_LOC_11); @@ -1412,10 +1420,10 @@ sctp_queue_data_for_reasm(struct sctp_tc } /* validate not beyond top FSN if we have seen last * one */ - if (SCTP_TSN_GT(chk->rec.data.fsn_num, control->top_fsn)) { + if (SCTP_TSN_GT(chk->rec.data.fsn, control->top_fsn)) { SCTPDBG(SCTP_DEBUG_XXX, "New fsn: %u is beyond or at top_fsn: %u -- abort\n", - chk->rec.data.fsn_num, + chk->rec.data.fsn, control->top_fsn); sctp_abort_in_reasm(stcb, control, chk, abort_flag, @@ -1429,22 +1437,22 @@ sctp_queue_data_for_reasm(struct sctp_tc */ SCTPDBG(SCTP_DEBUG_XXX, "chunk is a not first fsn: %u needs to be inserted\n", - chk->rec.data.fsn_num); + chk->rec.data.fsn); TAILQ_FOREACH(at, &control->reasm, sctp_next) { - if (SCTP_TSN_GT(at->rec.data.fsn_num, chk->rec.data.fsn_num)) { + if (SCTP_TSN_GT(at->rec.data.fsn, chk->rec.data.fsn)) { /* * This one in queue is bigger than the new * one, insert the new one before at. */ SCTPDBG(SCTP_DEBUG_XXX, "Insert it before fsn: %u\n", - at->rec.data.fsn_num); + at->rec.data.fsn); asoc->size_on_reasm_queue += chk->send_size; sctp_ucount_incr(asoc->cnt_on_reasm_queue); TAILQ_INSERT_BEFORE(at, chk, sctp_next); inserted = 1; break; - } else if (at->rec.data.fsn_num == chk->rec.data.fsn_num) { + } else if (at->rec.data.fsn == chk->rec.data.fsn) { /* Gak, He sent me a duplicate str seq * number */ /* @@ -1457,7 +1465,7 @@ sctp_queue_data_for_reasm(struct sctp_tc */ SCTPDBG(SCTP_DEBUG_XXX, "Duplicate to fsn: %u -- abort\n", - at->rec.data.fsn_num); + at->rec.data.fsn); sctp_abort_in_reasm(stcb, control, chk, abort_flag, SCTP_FROM_SCTP_INDATA + SCTP_LOC_13); @@ -1467,7 +1475,7 @@ sctp_queue_data_for_reasm(struct sctp_tc if (inserted == 0) { /* Goes on the end */ SCTPDBG(SCTP_DEBUG_XXX, "Inserting at tail of list fsn: %u\n", - chk->rec.data.fsn_num); + chk->rec.data.fsn); asoc->size_on_reasm_queue += chk->send_size; sctp_ucount_incr(asoc->cnt_on_reasm_queue); TAILQ_INSERT_TAIL(&control->reasm, chk, sctp_next); @@ -1485,12 +1493,12 @@ sctp_queue_data_for_reasm(struct sctp_tc if (control->first_frag_seen) { next_fsn = control->fsn_included + 1; TAILQ_FOREACH_SAFE(at, &control->reasm, sctp_next, nat) { - if (at->rec.data.fsn_num == next_fsn) { + if (at->rec.data.fsn == next_fsn) { /* We can add this one now to the control */ SCTPDBG(SCTP_DEBUG_XXX, "Adding more to control: %p at: %p fsn: %u next_fsn: %u included: %u\n", control, at, - at->rec.data.fsn_num, + at->rec.data.fsn, next_fsn, control->fsn_included); TAILQ_REMOVE(&control->reasm, at, sctp_next); sctp_add_chk_to_control(control, strm, stcb, asoc, at, SCTP_READ_LOCK_NOT_HELD); @@ -1524,25 +1532,25 @@ sctp_queue_data_for_reasm(struct sctp_tc } static struct sctp_queued_to_read * -sctp_find_reasm_entry(struct sctp_stream_in *strm, uint32_t msg_id, int ordered, int old) +sctp_find_reasm_entry(struct sctp_stream_in *strm, uint32_t mid, int ordered, int idata_supported) { struct sctp_queued_to_read *control; if (ordered) { TAILQ_FOREACH(control, &strm->inqueue, next_instrm) { - if (control->msg_id == msg_id) { + if (SCTP_MID_EQ(idata_supported, control->mid, mid)) { break; } } } else { - if (old) { - control = TAILQ_FIRST(&strm->uno_inqueue); - return (control); - } - TAILQ_FOREACH(control, &strm->uno_inqueue, next_instrm) { - if (control->msg_id == msg_id) { - break; + if (idata_supported) { + TAILQ_FOREACH(control, &strm->uno_inqueue, next_instrm) { + if (SCTP_MID_EQ(idata_supported, control->mid, mid)) { + break; + } } + } else { + control = TAILQ_FIRST(&strm->uno_inqueue); } } return (control); @@ -1559,22 +1567,21 @@ sctp_process_a_data_chunk(struct sctp_tc struct sctp_data_chunk *ch; struct sctp_idata_chunk *nch, chunk_buf; struct sctp_tmit_chunk *chk; - uint32_t tsn, fsn, gap, msg_id; + uint32_t tsn, fsn, gap, mid; struct mbuf *dmbuf; int the_len; int need_reasm_check = 0; - uint16_t strmno; + uint16_t sid; struct mbuf *op_err; char msg[SCTP_DIAG_INFO_LEN]; struct sctp_queued_to_read *control = NULL; - uint32_t protocol_id; + uint32_t ppid; uint8_t chunk_flags; struct sctp_stream_reset_list *liste; struct sctp_stream_in *strm; int ordered; size_t clen; int created_control = 0; - uint8_t old_data; chk = NULL; if (chtype == SCTP_IDATA) { @@ -1583,23 +1590,21 @@ sctp_process_a_data_chunk(struct sctp_tc ch = (struct sctp_data_chunk *)nch; clen = sizeof(struct sctp_idata_chunk); tsn = ntohl(ch->dp.tsn); - msg_id = ntohl(nch->dp.msg_id); - protocol_id = nch->dp.ppid_fsn.protocol_id; + mid = ntohl(nch->dp.mid); + ppid = nch->dp.ppid_fsn.ppid; if (ch->ch.chunk_flags & SCTP_DATA_FIRST_FRAG) fsn = 0; else fsn = ntohl(nch->dp.ppid_fsn.fsn); - old_data = 0; } else { ch = (struct sctp_data_chunk *)sctp_m_getptr(*m, offset, sizeof(struct sctp_data_chunk), (uint8_t *) & chunk_buf); tsn = ntohl(ch->dp.tsn); - protocol_id = ch->dp.protocol_id; + ppid = ch->dp.ppid; clen = sizeof(struct sctp_data_chunk); fsn = tsn; - msg_id = (uint32_t) (ntohs(ch->dp.stream_sequence)); + mid = (uint32_t) (ntohs(ch->dp.ssn)); nch = NULL; - old_data = 1; } chunk_flags = ch->ch.chunk_flags; if ((size_t)chk_length == clen) { @@ -1685,9 +1690,9 @@ sctp_process_a_data_chunk(struct sctp_tc */ /* Is the stream valid? */ - strmno = ntohs(ch->dp.stream_id); + sid = ntohs(ch->dp.sid); - if (strmno >= asoc->streamincnt) { + if (sid >= asoc->streamincnt) { struct sctp_error_invalid_stream *cause; op_err = sctp_get_mbuf_for_msg(sizeof(struct sctp_error_invalid_stream), @@ -1704,7 +1709,7 @@ sctp_process_a_data_chunk(struct sctp_tc SCTP_BUF_LEN(op_err) = sizeof(struct sctp_error_invalid_stream); cause->cause.code = htons(SCTP_CAUSE_INVALID_STREAM); cause->cause.length = htons(sizeof(struct sctp_error_invalid_stream)); - cause->stream_id = ch->dp.stream_id; + cause->stream_id = ch->dp.sid; cause->reserved = htons(0); sctp_queue_op_err(stcb, op_err); } @@ -1720,7 +1725,7 @@ sctp_process_a_data_chunk(struct sctp_tc } return (0); } - strm = &asoc->strmin[strmno]; + strm = &asoc->strmin[sid]; /* * If its a fragmented message, lets see if we can find the control * on the reassembly queues. @@ -1734,18 +1739,18 @@ sctp_process_a_data_chunk(struct sctp_tc * wrap around. Ignore is for now. */ snprintf(msg, sizeof(msg), "FSN zero for MID=%8.8x, but flags=%2.2x", - msg_id, chunk_flags); + mid, chunk_flags); goto err_out; } - control = sctp_find_reasm_entry(strm, msg_id, ordered, old_data); + control = sctp_find_reasm_entry(strm, mid, ordered, asoc->idata_supported); SCTPDBG(SCTP_DEBUG_XXX, "chunk_flags:0x%x look for control on queues %p\n", chunk_flags, control); if ((chunk_flags & SCTP_DATA_NOT_FRAG) != SCTP_DATA_NOT_FRAG) { /* See if we can find the re-assembly entity */ if (control != NULL) { /* We found something, does it belong? */ - if (ordered && (msg_id != control->sinfo_ssn)) { - snprintf(msg, sizeof(msg), "Reassembly problem (MID=%8.8x)", msg_id); + if (ordered && (mid != control->mid)) { + snprintf(msg, sizeof(msg), "Reassembly problem (MID=%8.8x)", mid); err_out: op_err = sctp_generate_cause(SCTP_CAUSE_PROTOCOL_VIOLATION, msg); stcb->sctp_ep->last_abort_code = SCTP_FROM_SCTP_INDATA + SCTP_LOC_15; @@ -1775,10 +1780,10 @@ sctp_process_a_data_chunk(struct sctp_tc * ordered) or in the same Stream for unordered. */ if (control != NULL) { - if (ordered || (old_data == 0)) { - SCTPDBG(SCTP_DEBUG_XXX, "chunk_flags: 0x%x dup detected on msg_id: %u\n", - chunk_flags, msg_id); - snprintf(msg, sizeof(msg), "Duplicate MID=%8.8x detected.", msg_id); + if (ordered || asoc->idata_supported) { + SCTPDBG(SCTP_DEBUG_XXX, "chunk_flags: 0x%x dup detected on MID: %u\n", + chunk_flags, mid); + snprintf(msg, sizeof(msg), "Duplicate MID=%8.8x detected.", mid); goto err_out; } else { if ((tsn == control->fsn_included + 1) && @@ -1855,8 +1860,8 @@ sctp_process_a_data_chunk(struct sctp_tc asoc->tsn_in_wrapped = 1; } asoc->in_tsnlog[asoc->tsn_in_at].tsn = tsn; - asoc->in_tsnlog[asoc->tsn_in_at].strm = strmno; - asoc->in_tsnlog[asoc->tsn_in_at].seq = msg_id; + asoc->in_tsnlog[asoc->tsn_in_at].strm = sid; + asoc->in_tsnlog[asoc->tsn_in_at].seq = mid; asoc->in_tsnlog[asoc->tsn_in_at].sz = chk_length; asoc->in_tsnlog[asoc->tsn_in_at].flgs = chunk_flags; asoc->in_tsnlog[asoc->tsn_in_at].stcb = (void *)stcb; @@ -1874,14 +1879,24 @@ sctp_process_a_data_chunk(struct sctp_tc if ((chunk_flags & SCTP_DATA_FIRST_FRAG) && (TAILQ_EMPTY(&asoc->resetHead)) && (chunk_flags & SCTP_DATA_UNORDERED) == 0 && - SCTP_MSGID_GE(old_data, asoc->strmin[strmno].last_sequence_delivered, msg_id)) { + SCTP_MID_GE(asoc->idata_supported, asoc->strmin[sid].last_mid_delivered, mid)) { /* The incoming sseq is behind where we last delivered? */ SCTPDBG(SCTP_DEBUG_INDATA1, "EVIL/Broken-Dup S-SEQ: %u delivered: %u from peer, Abort!\n", - msg_id, asoc->strmin[strmno].last_sequence_delivered); + mid, asoc->strmin[sid].last_mid_delivered); - snprintf(msg, sizeof(msg), "Delivered SSN=%4.4x, got TSN=%8.8x, SID=%4.4x, SSN=%4.4x", - asoc->strmin[strmno].last_sequence_delivered, - tsn, strmno, msg_id); + if (asoc->idata_supported) { + snprintf(msg, sizeof(msg), "Delivered MID=%8.8x, got TSN=%8.8x, SID=%4.4x, MID=%8.8x", + asoc->strmin[sid].last_mid_delivered, + tsn, + sid, + mid); + } else { + snprintf(msg, sizeof(msg), "Delivered SSN=%4.4x, got TSN=%8.8x, SID=%4.4x, SSN=%4.4x", + (uint16_t) asoc->strmin[sid].last_mid_delivered, + tsn, + sid, + (uint16_t) mid); + } op_err = sctp_generate_cause(SCTP_CAUSE_PROTOCOL_VIOLATION, msg); stcb->sctp_ep->last_abort_code = SCTP_FROM_SCTP_INDATA + SCTP_LOC_16; sctp_abort_an_association(stcb->sctp_ep, stcb, op_err, SCTP_SO_NOT_LOCKED); @@ -1954,10 +1969,10 @@ sctp_process_a_data_chunk(struct sctp_tc if (control == NULL) { sctp_alloc_a_readq(stcb, control); sctp_build_readq_entry_mac(control, stcb, asoc->context, net, tsn, - protocol_id, - strmno, msg_id, + ppid, + sid, chunk_flags, - NULL, fsn, msg_id); + NULL, fsn, mid); if (control == NULL) { SCTP_STAT_INCR(sctps_nomem); return (0); @@ -1970,13 +1985,13 @@ sctp_process_a_data_chunk(struct sctp_tc } created_control = 1; } - SCTPDBG(SCTP_DEBUG_XXX, "chunk_flags: 0x%x ordered: %d msgid: %u control: %p\n", - chunk_flags, ordered, msg_id, control); + SCTPDBG(SCTP_DEBUG_XXX, "chunk_flags: 0x%x ordered: %d MID: %u control: %p\n", + chunk_flags, ordered, mid, control); if ((chunk_flags & SCTP_DATA_NOT_FRAG) == SCTP_DATA_NOT_FRAG && TAILQ_EMPTY(&asoc->resetHead) && ((ordered == 0) || - ((uint16_t) (asoc->strmin[strmno].last_sequence_delivered + 1) == msg_id && - TAILQ_EMPTY(&asoc->strmin[strmno].inqueue)))) { + (SCTP_MID_EQ(asoc->idata_supported, asoc->strmin[sid].last_mid_delivered + 1, mid) && + TAILQ_EMPTY(&asoc->strmin[sid].inqueue)))) { /* Candidate for express delivery */ /* * Its not fragmented, No PD-API is up, Nothing in the @@ -1989,8 +2004,8 @@ sctp_process_a_data_chunk(struct sctp_tc if (SCTP_TSN_GT(tsn, asoc->highest_tsn_inside_nr_map)) { asoc->highest_tsn_inside_nr_map = tsn; } - SCTPDBG(SCTP_DEBUG_XXX, "Injecting control: %p to be read (msg_id: %u)\n", - control, msg_id); + SCTPDBG(SCTP_DEBUG_XXX, "Injecting control: %p to be read (MID: %u)\n", + control, mid); sctp_add_to_readq(stcb->sctp_ep, stcb, control, &stcb->sctp_socket->so_rcv, @@ -1998,11 +2013,11 @@ sctp_process_a_data_chunk(struct sctp_tc if ((chunk_flags & SCTP_DATA_UNORDERED) == 0) { /* for ordered, bump what we delivered */ - strm->last_sequence_delivered++; + strm->last_mid_delivered++; } SCTP_STAT_INCR(sctps_recvexpress); if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_STR_LOGGING_ENABLE) { - sctp_log_strm_del_alt(stcb, tsn, msg_id, strmno, + sctp_log_strm_del_alt(stcb, tsn, mid, sid, SCTP_STR_LOG_FROM_EXPRS_DEL); } control = NULL; @@ -2020,21 +2035,21 @@ sctp_process_a_data_chunk(struct sctp_tc } return (0); } - chk->rec.data.TSN_seq = tsn; + chk->rec.data.tsn = tsn; chk->no_fr_allowed = 0; - chk->rec.data.fsn_num = fsn; - chk->rec.data.stream_seq = msg_id; - chk->rec.data.stream_number = strmno; - chk->rec.data.payloadtype = protocol_id; + chk->rec.data.fsn = fsn; + chk->rec.data.mid = mid; + chk->rec.data.sid = sid; + chk->rec.data.ppid = ppid; chk->rec.data.context = stcb->asoc.context; chk->rec.data.doing_fast_retransmit = 0; chk->rec.data.rcv_flags = chunk_flags; chk->asoc = asoc; chk->send_size = the_len; chk->whoTo = net; - SCTPDBG(SCTP_DEBUG_XXX, "Building ck: %p for control: %p to be read (msg_id: %u)\n", + SCTPDBG(SCTP_DEBUG_XXX, "Building ck: %p for control: %p to be read (MID: %u)\n", chk, - control, msg_id); + control, mid); atomic_add_int(&net->ref_count, 1); chk->data = dmbuf; } @@ -2097,8 +2112,8 @@ sctp_process_a_data_chunk(struct sctp_tc } if (chunk_flags & SCTP_DATA_UNORDERED) { /* queue directly into socket buffer */ - SCTPDBG(SCTP_DEBUG_XXX, "Unordered data to be read control: %p msg_id: %u\n", - control, msg_id); + SCTPDBG(SCTP_DEBUG_XXX, "Unordered data to be read control: %p MID: %u\n", + control, mid); sctp_mark_non_revokable(asoc, control->sinfo_tsn); sctp_add_to_readq(stcb->sctp_ep, stcb, control, @@ -2106,8 +2121,8 @@ sctp_process_a_data_chunk(struct sctp_tc SCTP_READ_LOCK_NOT_HELD, SCTP_SO_NOT_LOCKED); } else { - SCTPDBG(SCTP_DEBUG_XXX, "Queue control: %p for reordering msg_id: %u\n", control, - msg_id); + SCTPDBG(SCTP_DEBUG_XXX, "Queue control: %p for reordering MID: %u\n", control, + mid); sctp_queue_data_to_stream(stcb, strm, asoc, control, abort_flag, &need_reasm_check); if (*abort_flag) { if (last_chunk) { @@ -2121,8 +2136,8 @@ sctp_process_a_data_chunk(struct sctp_tc /* If we reach here its a reassembly */ need_reasm_check = 1; SCTPDBG(SCTP_DEBUG_XXX, - "Queue data to stream for reasm control: %p msg_id: %u\n", - control, msg_id); + "Queue data to stream for reasm control: %p MID: %u\n", + control, mid); sctp_queue_data_for_reasm(stcb, asoc, strm, control, chk, created_control, abort_flag, tsn); if (*abort_flag) { /* @@ -2151,7 +2166,7 @@ finish_express_del: SCTP_STAT_INCR(sctps_recvdata); /* Set it present please */ if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_STR_LOGGING_ENABLE) { - sctp_log_strm_del_alt(stcb, tsn, msg_id, strmno, SCTP_STR_LOG_FROM_MARK_TSN); + sctp_log_strm_del_alt(stcb, tsn, mid, sid, SCTP_STR_LOG_FROM_MARK_TSN); } if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_MAP_LOGGING_ENABLE) { sctp_log_map(asoc->mapping_array_base_tsn, asoc->cumulative_tsn, @@ -2813,16 +2828,16 @@ sctp_process_segment_range(struct sctp_t if ((tp1->sent < SCTP_DATAGRAM_RESEND) && (tp1->whoTo->find_pseudo_cumack == 1) && (tp1->snd_count == 1)) { - tp1->whoTo->pseudo_cumack = tp1->rec.data.TSN_seq; + tp1->whoTo->pseudo_cumack = tp1->rec.data.tsn; tp1->whoTo->find_pseudo_cumack = 0; } if ((tp1->sent < SCTP_DATAGRAM_RESEND) && (tp1->whoTo->find_rtx_pseudo_cumack == 1) && (tp1->snd_count > 1)) { - tp1->whoTo->rtx_pseudo_cumack = tp1->rec.data.TSN_seq; + tp1->whoTo->rtx_pseudo_cumack = tp1->rec.data.tsn; tp1->whoTo->find_rtx_pseudo_cumack = 0; } - if (tp1->rec.data.TSN_seq == theTSN) { + if (tp1->rec.data.tsn == theTSN) { if (tp1->sent != SCTP_DATAGRAM_UNSENT) { /*- * must be held until @@ -2836,9 +2851,9 @@ sctp_process_segment_range(struct sctp_t * via previous Gap Ack Blocks... * i.e. ACKED or RESEND. */ - if (SCTP_TSN_GT(tp1->rec.data.TSN_seq, + if (SCTP_TSN_GT(tp1->rec.data.tsn, *biggest_newly_acked_tsn)) { - *biggest_newly_acked_tsn = tp1->rec.data.TSN_seq; *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@freebsd.org Sun Dec 18 13:05:44 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2F91BC85A29; Sun, 18 Dec 2016 13:05:44 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id F2C471BD0; Sun, 18 Dec 2016 13:05:43 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBID5hXg074383; Sun, 18 Dec 2016 13:05:43 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBID5hAu074382; Sun, 18 Dec 2016 13:05:43 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201612181305.uBID5hAu074382@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Sun, 18 Dec 2016 13:05:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r310220 - stable/11/lib/libc/net X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Dec 2016 13:05:44 -0000 Author: tuexen Date: Sun Dec 18 13:05:42 2016 New Revision: 310220 URL: https://svnweb.freebsd.org/changeset/base/310220 Log: MFC r309683: Fix a bug in sctp_sendmsgx(), where the sid provided by the user was hot honored. Modified: stable/11/lib/libc/net/sctp_sys_calls.c Directory Properties: stable/11/ (props changed) Modified: stable/11/lib/libc/net/sctp_sys_calls.c ============================================================================== --- stable/11/lib/libc/net/sctp_sys_calls.c Sun Dec 18 13:04:29 2016 (r310219) +++ stable/11/lib/libc/net/sctp_sys_calls.c Sun Dec 18 13:05:42 2016 (r310220) @@ -797,7 +797,7 @@ sctp_sendmsgx(int sd, memset((void *)&sinfo, 0, sizeof(struct sctp_sndrcvinfo)); sinfo.sinfo_ppid = ppid; sinfo.sinfo_flags = flags; - sinfo.sinfo_ssn = stream_no; + sinfo.sinfo_stream = stream_no; sinfo.sinfo_timetolive = timetolive; sinfo.sinfo_context = context; return (sctp_sendx(sd, msg, len, addrs, addrcnt, &sinfo, 0)); From owner-svn-src-all@freebsd.org Sun Dec 18 13:10:08 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C7001C85AD6; Sun, 18 Dec 2016 13:10:08 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 8F4DF1D71; Sun, 18 Dec 2016 13:10:08 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBIDA7VA074596; Sun, 18 Dec 2016 13:10:07 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBIDA73g074595; Sun, 18 Dec 2016 13:10:07 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201612181310.uBIDA73g074595@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Sun, 18 Dec 2016 13:10:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r310221 - stable/11/sys/netinet X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Dec 2016 13:10:08 -0000 Author: tuexen Date: Sun Dec 18 13:10:07 2016 New Revision: 310221 URL: https://svnweb.freebsd.org/changeset/base/310221 Log: MFC r309685: Silence a warning produced by newer versions of gcc. Modified: stable/11/sys/netinet/sctp_output.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/netinet/sctp_output.c ============================================================================== --- stable/11/sys/netinet/sctp_output.c Sun Dec 18 13:05:42 2016 (r310220) +++ stable/11/sys/netinet/sctp_output.c Sun Dec 18 13:10:07 2016 (r310221) @@ -10350,8 +10350,10 @@ sctp_fill_in_rest: */ if (asoc->idata_supported) { strseq_m = (struct sctp_strseq_mid *)fwdtsn; + strseq = NULL; } else { strseq = (struct sctp_strseq *)fwdtsn; + strseq_m = NULL; } /*- * Now populate the strseq list. This is done blindly From owner-svn-src-all@freebsd.org Sun Dec 18 13:13:11 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2CE5EC85D38; Sun, 18 Dec 2016 13:13:11 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 078621C9; Sun, 18 Dec 2016 13:13:10 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBIDDAg4078349; Sun, 18 Dec 2016 13:13:10 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBIDDAZk078348; Sun, 18 Dec 2016 13:13:10 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201612181313.uBIDDAZk078348@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Sun, 18 Dec 2016 13:13:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r310222 - stable/11/sys/netinet X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Dec 2016 13:13:11 -0000 Author: tuexen Date: Sun Dec 18 13:13:09 2016 New Revision: 310222 URL: https://svnweb.freebsd.org/changeset/base/310222 Log: MFC r309743: Don't send multiple SHUTDOWN chunks in a single packet. Thanks to Felix Weinrank for making me aware of this issue. Modified: stable/11/sys/netinet/sctp_output.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/netinet/sctp_output.c ============================================================================== --- stable/11/sys/netinet/sctp_output.c Sun Dec 18 13:10:07 2016 (r310221) +++ stable/11/sys/netinet/sctp_output.c Sun Dec 18 13:13:09 2016 (r310222) @@ -9164,40 +9164,61 @@ sctp_send_shutdown(struct sctp_tcb *stcb struct sctp_shutdown_chunk *shutdown_cp; struct sctp_tmit_chunk *chk; - m_shutdown = sctp_get_mbuf_for_msg(sizeof(struct sctp_shutdown_chunk), 0, M_NOWAIT, 1, MT_HEADER); - if (m_shutdown == NULL) { - /* no mbuf's */ - return; + TAILQ_FOREACH(chk, &stcb->asoc.control_send_queue, sctp_next) { + if (chk->rec.chunk_id.id == SCTP_SHUTDOWN) { + /* We already have a SHUTDOWN queued. Reuse it. */ + if (chk->whoTo) { + sctp_free_remote_addr(chk->whoTo); + chk->whoTo = NULL; + } + break; + } } - SCTP_BUF_RESV_UF(m_shutdown, SCTP_MIN_OVERHEAD); - sctp_alloc_a_chunk(stcb, chk); if (chk == NULL) { - /* no memory */ - sctp_m_freem(m_shutdown); - return; - } - chk->copy_by_ref = 0; - chk->rec.chunk_id.id = SCTP_SHUTDOWN; - chk->rec.chunk_id.can_take_data = 1; - chk->flags = 0; - chk->send_size = sizeof(struct sctp_shutdown_chunk); - chk->sent = SCTP_DATAGRAM_UNSENT; - chk->snd_count = 0; - chk->flags = 0; - chk->asoc = &stcb->asoc; - chk->data = m_shutdown; - chk->whoTo = net; - if (chk->whoTo) { - atomic_add_int(&chk->whoTo->ref_count, 1); + m_shutdown = sctp_get_mbuf_for_msg(sizeof(struct sctp_shutdown_chunk), 0, M_NOWAIT, 1, MT_HEADER); + if (m_shutdown == NULL) { + /* no mbuf's */ + return; + } + SCTP_BUF_RESV_UF(m_shutdown, SCTP_MIN_OVERHEAD); + sctp_alloc_a_chunk(stcb, chk); + if (chk == NULL) { + /* no memory */ + sctp_m_freem(m_shutdown); + return; + } + chk->copy_by_ref = 0; + chk->rec.chunk_id.id = SCTP_SHUTDOWN; + chk->rec.chunk_id.can_take_data = 1; + chk->flags = 0; + chk->send_size = sizeof(struct sctp_shutdown_chunk); + chk->sent = SCTP_DATAGRAM_UNSENT; + chk->snd_count = 0; + chk->flags = 0; + chk->asoc = &stcb->asoc; + chk->data = m_shutdown; + chk->whoTo = net; + if (chk->whoTo) { + atomic_add_int(&chk->whoTo->ref_count, 1); + } + shutdown_cp = mtod(m_shutdown, struct sctp_shutdown_chunk *); + shutdown_cp->ch.chunk_type = SCTP_SHUTDOWN; + shutdown_cp->ch.chunk_flags = 0; + shutdown_cp->ch.chunk_length = htons(chk->send_size); + shutdown_cp->cumulative_tsn_ack = htonl(stcb->asoc.cumulative_tsn); + SCTP_BUF_LEN(m_shutdown) = chk->send_size; + TAILQ_INSERT_TAIL(&chk->asoc->control_send_queue, chk, sctp_next); + chk->asoc->ctrl_queue_cnt++; + } else { + TAILQ_REMOVE(&stcb->asoc.control_send_queue, chk, sctp_next); + chk->whoTo = net; + if (chk->whoTo) { + atomic_add_int(&chk->whoTo->ref_count, 1); + } + shutdown_cp = mtod(chk->data, struct sctp_shutdown_chunk *); + shutdown_cp->cumulative_tsn_ack = htonl(stcb->asoc.cumulative_tsn); + TAILQ_INSERT_TAIL(&stcb->asoc.control_send_queue, chk, sctp_next); } - shutdown_cp = mtod(m_shutdown, struct sctp_shutdown_chunk *); - shutdown_cp->ch.chunk_type = SCTP_SHUTDOWN; - shutdown_cp->ch.chunk_flags = 0; - shutdown_cp->ch.chunk_length = htons(chk->send_size); - shutdown_cp->cumulative_tsn_ack = htonl(stcb->asoc.cumulative_tsn); - SCTP_BUF_LEN(m_shutdown) = chk->send_size; - TAILQ_INSERT_TAIL(&chk->asoc->control_send_queue, chk, sctp_next); - chk->asoc->ctrl_queue_cnt++; return; } From owner-svn-src-all@freebsd.org Sun Dec 18 13:45:06 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id F4216C86C4A; Sun, 18 Dec 2016 13:45:05 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C350112EC; Sun, 18 Dec 2016 13:45:05 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBIDj4Et090747; Sun, 18 Dec 2016 13:45:04 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBIDj4nx090746; Sun, 18 Dec 2016 13:45:04 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201612181345.uBIDj4nx090746@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Sun, 18 Dec 2016 13:45:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r310223 - stable/11/sys/netinet X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Dec 2016 13:45:06 -0000 Author: tuexen Date: Sun Dec 18 13:45:04 2016 New Revision: 310223 URL: https://svnweb.freebsd.org/changeset/base/310223 Log: MFC r309744: Don't bundle a SACK chunk with a SHUTDOWN chunk if it is not required. Modified: stable/11/sys/netinet/sctp_indata.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/netinet/sctp_indata.c ============================================================================== --- stable/11/sys/netinet/sctp_indata.c Sun Dec 18 13:13:09 2016 (r310222) +++ stable/11/sys/netinet/sctp_indata.c Sun Dec 18 13:45:04 2016 (r310223) @@ -2437,13 +2437,17 @@ sctp_sack_check(struct sctp_tcb *stcb, i { struct sctp_association *asoc; uint32_t highest_tsn; + int is_a_gap; + sctp_slide_mapping_arrays(stcb); asoc = &stcb->asoc; if (SCTP_TSN_GT(asoc->highest_tsn_inside_nr_map, asoc->highest_tsn_inside_map)) { highest_tsn = asoc->highest_tsn_inside_nr_map; } else { highest_tsn = asoc->highest_tsn_inside_map; } + /* Is there a gap now? */ + is_a_gap = SCTP_TSN_GT(highest_tsn, stcb->asoc.cumulative_tsn); /* * Now we need to see if we need to queue a sack or just start the @@ -2462,13 +2466,10 @@ sctp_sack_check(struct sctp_tcb *stcb, i } sctp_send_shutdown(stcb, ((stcb->asoc.alternate) ? stcb->asoc.alternate : stcb->asoc.primary_destination)); - sctp_send_sack(stcb, SCTP_SO_NOT_LOCKED); + if (is_a_gap) { + sctp_send_sack(stcb, SCTP_SO_NOT_LOCKED); + } } else { - int is_a_gap; - - /* is there a gap now ? */ - is_a_gap = SCTP_TSN_GT(highest_tsn, stcb->asoc.cumulative_tsn); - /* * CMT DAC algorithm: increase number of packets received * since last ack From owner-svn-src-all@freebsd.org Sun Dec 18 13:48:29 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id EDA99C86DBF; Sun, 18 Dec 2016 13:48:29 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id BC6DE163C; Sun, 18 Dec 2016 13:48:29 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBIDmSeD090996; Sun, 18 Dec 2016 13:48:28 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBIDmSha090994; Sun, 18 Dec 2016 13:48:28 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201612181348.uBIDmSha090994@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Sun, 18 Dec 2016 13:48:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r310224 - stable/11/sys/netinet X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Dec 2016 13:48:30 -0000 Author: tuexen Date: Sun Dec 18 13:48:28 2016 New Revision: 310224 URL: https://svnweb.freebsd.org/changeset/base/310224 Log: MFC r309851: Ensure that the reported ppid and tsn are taken from the first fragment. This fixes a bug where the wrong ppid was reported, if * I-DATA was used on the first fragement was not received first * DATA was used and different ppids where used. Thanks to Julian Cordes for making me aware of the issue. Modified: stable/11/sys/netinet/sctp_indata.c stable/11/sys/netinet/sctputil.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/netinet/sctp_indata.c ============================================================================== --- stable/11/sys/netinet/sctp_indata.c Sun Dec 18 13:45:04 2016 (r310223) +++ stable/11/sys/netinet/sctp_indata.c Sun Dec 18 13:48:28 2016 (r310224) @@ -333,10 +333,10 @@ sctp_place_control_in_stream(struct sctp { struct sctp_queued_to_read *at; struct sctp_readhead *q; - uint8_t bits, unordered; + uint8_t flags, unordered; - bits = (control->sinfo_flags >> 8); - unordered = bits & SCTP_DATA_UNORDERED; + flags = (control->sinfo_flags >> 8); + unordered = flags & SCTP_DATA_UNORDERED; if (unordered) { q = &strm->uno_inqueue; if (asoc->idata_supported == 0) { @@ -352,8 +352,10 @@ sctp_place_control_in_stream(struct sctp } else { q = &strm->inqueue; } - if ((bits & SCTP_DATA_NOT_FRAG) == SCTP_DATA_NOT_FRAG) { - control->end_added = control->last_frag_seen = control->first_frag_seen = 1; + if ((flags & SCTP_DATA_NOT_FRAG) == SCTP_DATA_NOT_FRAG) { + control->end_added = 1; + control->first_frag_seen = 1; + control->last_frag_seen = 1; } if (TAILQ_EMPTY(q)) { /* Empty queue */ @@ -394,8 +396,7 @@ sctp_place_control_in_stream(struct sctp sctp_log_strm_del(control, at, SCTP_STR_LOG_FROM_INSERT_TL); } - TAILQ_INSERT_AFTER(q, - at, control, next_instrm); + TAILQ_INSERT_AFTER(q, at, control, next_instrm); if (unordered) { control->on_strm_q = SCTP_ON_UNORDERED; } else { @@ -972,7 +973,8 @@ sctp_inject_old_unordered_data(struct sc goto place_chunk; } control->first_frag_seen = 1; - control->top_fsn = control->fsn_included = chk->rec.data.fsn; + control->fsn_included = chk->rec.data.fsn; + control->top_fsn = chk->rec.data.fsn; control->sinfo_tsn = chk->rec.data.tsn; control->sinfo_ppid = chk->rec.data.ppid; control->data = chk->data; @@ -1236,6 +1238,8 @@ sctp_add_chk_to_control(struct sctp_queu chk->data = NULL; if (chk->rec.data.rcv_flags & SCTP_DATA_FIRST_FRAG) { control->first_frag_seen = 1; + control->sinfo_tsn = chk->rec.data.tsn; + control->sinfo_ppid = chk->rec.data.ppid; } if (chk->rec.data.rcv_flags & SCTP_DATA_LAST_FRAG) { /* Its complete */ @@ -1347,6 +1351,8 @@ sctp_queue_data_for_reasm(struct sctp_tc return; } control->first_frag_seen = 1; + control->sinfo_ppid = chk->rec.data.ppid; + control->sinfo_tsn = chk->rec.data.tsn; control->fsn_included = chk->rec.data.fsn; control->data = chk->data; sctp_mark_non_revokable(asoc, chk->rec.data.tsn); @@ -1560,12 +1566,10 @@ static int sctp_process_a_data_chunk(struct sctp_tcb *stcb, struct sctp_association *asoc, struct mbuf **m, int offset, int chk_length, struct sctp_nets *net, uint32_t * high_tsn, int *abort_flag, - int *break_flag, int last_chunk, uint8_t chtype) + int *break_flag, int last_chunk, uint8_t chk_type) { /* Process a data chunk */ /* struct sctp_tmit_chunk *chk; */ - struct sctp_data_chunk *ch; - struct sctp_idata_chunk *nch, chunk_buf; struct sctp_tmit_chunk *chk; uint32_t tsn, fsn, gap, mid; struct mbuf *dmbuf; @@ -1576,58 +1580,64 @@ sctp_process_a_data_chunk(struct sctp_tc char msg[SCTP_DIAG_INFO_LEN]; struct sctp_queued_to_read *control = NULL; uint32_t ppid; - uint8_t chunk_flags; + uint8_t chk_flags; struct sctp_stream_reset_list *liste; struct sctp_stream_in *strm; int ordered; size_t clen; int created_control = 0; - chk = NULL; - if (chtype == SCTP_IDATA) { - nch = (struct sctp_idata_chunk *)sctp_m_getptr(*m, offset, + if (chk_type == SCTP_IDATA) { + struct sctp_idata_chunk *chunk, chunk_buf; + + chunk = (struct sctp_idata_chunk *)sctp_m_getptr(*m, offset, sizeof(struct sctp_idata_chunk), (uint8_t *) & chunk_buf); - ch = (struct sctp_data_chunk *)nch; + chk_flags = chunk->ch.chunk_flags; clen = sizeof(struct sctp_idata_chunk); - tsn = ntohl(ch->dp.tsn); - mid = ntohl(nch->dp.mid); - ppid = nch->dp.ppid_fsn.ppid; - if (ch->ch.chunk_flags & SCTP_DATA_FIRST_FRAG) + tsn = ntohl(chunk->dp.tsn); + sid = ntohs(chunk->dp.sid); + mid = ntohl(chunk->dp.mid); + if (chk_flags & SCTP_DATA_FIRST_FRAG) { fsn = 0; - else - fsn = ntohl(nch->dp.ppid_fsn.fsn); + ppid = chunk->dp.ppid_fsn.ppid; + } else { + fsn = ntohl(chunk->dp.ppid_fsn.fsn); + ppid = 0xffffffff; /* Use as an invalid value. */ + } } else { - ch = (struct sctp_data_chunk *)sctp_m_getptr(*m, offset, + struct sctp_data_chunk *chunk, chunk_buf; + + chunk = (struct sctp_data_chunk *)sctp_m_getptr(*m, offset, sizeof(struct sctp_data_chunk), (uint8_t *) & chunk_buf); - tsn = ntohl(ch->dp.tsn); - ppid = ch->dp.ppid; + chk_flags = chunk->ch.chunk_flags; clen = sizeof(struct sctp_data_chunk); + tsn = ntohl(chunk->dp.tsn); + sid = ntohs(chunk->dp.sid); + mid = (uint32_t) (ntohs(chunk->dp.ssn)); fsn = tsn; - mid = (uint32_t) (ntohs(ch->dp.ssn)); - nch = NULL; + ppid = chunk->dp.ppid; } - chunk_flags = ch->ch.chunk_flags; if ((size_t)chk_length == clen) { /* * Need to send an abort since we had a empty data chunk. */ - op_err = sctp_generate_no_user_data_cause(ch->dp.tsn); + op_err = sctp_generate_no_user_data_cause(tsn); stcb->sctp_ep->last_abort_code = SCTP_FROM_SCTP_INDATA + SCTP_LOC_14; sctp_abort_an_association(stcb->sctp_ep, stcb, op_err, SCTP_SO_NOT_LOCKED); *abort_flag = 1; return (0); } - if ((chunk_flags & SCTP_DATA_SACK_IMMEDIATELY) == SCTP_DATA_SACK_IMMEDIATELY) { + if ((chk_flags & SCTP_DATA_SACK_IMMEDIATELY) == SCTP_DATA_SACK_IMMEDIATELY) { asoc->send_sack = 1; } - ordered = ((chunk_flags & SCTP_DATA_UNORDERED) == 0); + ordered = ((chk_flags & SCTP_DATA_UNORDERED) == 0); if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_MAP_LOGGING_ENABLE) { sctp_log_map(tsn, asoc->cumulative_tsn, asoc->highest_tsn_inside_map, SCTP_MAP_TSN_ENTERS); } if (stcb == NULL) { return (0); } - SCTP_LTRACE_CHK(stcb->sctp_ep, stcb, ch->ch.chunk_type, tsn); + SCTP_LTRACE_CHK(stcb->sctp_ep, stcb, chk_type, tsn); if (SCTP_TSN_GE(asoc->cumulative_tsn, tsn)) { /* It is a duplicate */ SCTP_STAT_INCR(sctps_recvdupdata); @@ -1690,8 +1700,6 @@ sctp_process_a_data_chunk(struct sctp_tc */ /* Is the stream valid? */ - sid = ntohs(ch->dp.sid); - if (sid >= asoc->streamincnt) { struct sctp_error_invalid_stream *cause; @@ -1709,7 +1717,7 @@ sctp_process_a_data_chunk(struct sctp_tc SCTP_BUF_LEN(op_err) = sizeof(struct sctp_error_invalid_stream); cause->cause.code = htons(SCTP_CAUSE_INVALID_STREAM); cause->cause.length = htons(sizeof(struct sctp_error_invalid_stream)); - cause->stream_id = ch->dp.sid; + cause->stream_id = htons(sid); cause->reserved = htons(0); sctp_queue_op_err(stcb, op_err); } @@ -1730,8 +1738,8 @@ sctp_process_a_data_chunk(struct sctp_tc * If its a fragmented message, lets see if we can find the control * on the reassembly queues. */ - if ((chtype == SCTP_IDATA) && - ((chunk_flags & SCTP_DATA_FIRST_FRAG) == 0) && + if ((chk_type == SCTP_IDATA) && + ((chk_flags & SCTP_DATA_FIRST_FRAG) == 0) && (fsn == 0)) { /* * The first *must* be fsn 0, and other (middle/end) pieces @@ -1739,13 +1747,13 @@ sctp_process_a_data_chunk(struct sctp_tc * wrap around. Ignore is for now. */ snprintf(msg, sizeof(msg), "FSN zero for MID=%8.8x, but flags=%2.2x", - mid, chunk_flags); + mid, chk_flags); goto err_out; } control = sctp_find_reasm_entry(strm, mid, ordered, asoc->idata_supported); SCTPDBG(SCTP_DEBUG_XXX, "chunk_flags:0x%x look for control on queues %p\n", - chunk_flags, control); - if ((chunk_flags & SCTP_DATA_NOT_FRAG) != SCTP_DATA_NOT_FRAG) { + chk_flags, control); + if ((chk_flags & SCTP_DATA_NOT_FRAG) != SCTP_DATA_NOT_FRAG) { /* See if we can find the re-assembly entity */ if (control != NULL) { /* We found something, does it belong? */ @@ -1782,7 +1790,7 @@ sctp_process_a_data_chunk(struct sctp_tc if (control != NULL) { if (ordered || asoc->idata_supported) { SCTPDBG(SCTP_DEBUG_XXX, "chunk_flags: 0x%x dup detected on MID: %u\n", - chunk_flags, mid); + chk_flags, mid); snprintf(msg, sizeof(msg), "Duplicate MID=%8.8x detected.", mid); goto err_out; } else { @@ -1828,7 +1836,7 @@ sctp_process_a_data_chunk(struct sctp_tc #endif } /* now is it in the mapping array of what we have accepted? */ - if (nch == NULL) { + if (chk_type == SCTP_DATA) { if (SCTP_TSN_GT(tsn, asoc->highest_tsn_inside_map) && SCTP_TSN_GT(tsn, asoc->highest_tsn_inside_nr_map)) { /* Nope not in the valid range dump it */ @@ -1876,9 +1884,9 @@ sctp_process_a_data_chunk(struct sctp_tc * way our stream sequence numbers could have wrapped. We of course * only validate the FIRST fragment so the bit must be set. */ - if ((chunk_flags & SCTP_DATA_FIRST_FRAG) && + if ((chk_flags & SCTP_DATA_FIRST_FRAG) && (TAILQ_EMPTY(&asoc->resetHead)) && - (chunk_flags & SCTP_DATA_UNORDERED) == 0 && + (chk_flags & SCTP_DATA_UNORDERED) == 0 && SCTP_MID_GE(asoc->idata_supported, asoc->strmin[sid].last_mid_delivered, mid)) { /* The incoming sseq is behind where we last delivered? */ SCTPDBG(SCTP_DEBUG_INDATA1, "EVIL/Broken-Dup S-SEQ: %u delivered: %u from peer, Abort!\n", @@ -1903,17 +1911,13 @@ sctp_process_a_data_chunk(struct sctp_tc *abort_flag = 1; return (0); } - /************************************ - * From here down we may find ch-> invalid - * so its a good idea NOT to use it. - *************************************/ - if (nch) { + if (chk_type == SCTP_IDATA) { the_len = (chk_length - sizeof(struct sctp_idata_chunk)); } else { the_len = (chk_length - sizeof(struct sctp_data_chunk)); } if (last_chunk == 0) { - if (nch) { + if (chk_type == SCTP_IDATA) { dmbuf = SCTP_M_COPYM(*m, (offset + sizeof(struct sctp_idata_chunk)), the_len, M_NOWAIT); @@ -1933,7 +1937,7 @@ sctp_process_a_data_chunk(struct sctp_tc dmbuf = *m; /* lop off the top part */ - if (nch) { + if (chk_type == SCTP_IDATA) { m_adj(dmbuf, (offset + sizeof(struct sctp_idata_chunk))); } else { m_adj(dmbuf, (offset + sizeof(struct sctp_data_chunk))); @@ -1962,7 +1966,7 @@ sctp_process_a_data_chunk(struct sctp_tc return (0); } /* - * Now no matter what we need a control, get one if we don't have + * Now no matter what, we need a control, get one if we don't have * one (we may have gotten it above when we found the message was * fragmented */ @@ -1971,23 +1975,26 @@ sctp_process_a_data_chunk(struct sctp_tc sctp_build_readq_entry_mac(control, stcb, asoc->context, net, tsn, ppid, sid, - chunk_flags, + chk_flags, NULL, fsn, mid); if (control == NULL) { SCTP_STAT_INCR(sctps_nomem); return (0); } - if ((chunk_flags & SCTP_DATA_NOT_FRAG) == SCTP_DATA_NOT_FRAG) { + if ((chk_flags & SCTP_DATA_NOT_FRAG) == SCTP_DATA_NOT_FRAG) { control->data = dmbuf; control->tail_mbuf = NULL; - control->end_added = control->last_frag_seen = control->first_frag_seen = 1; - control->top_fsn = control->fsn_included = fsn; + control->end_added = 1; + control->last_frag_seen = 1; + control->first_frag_seen = 1; + control->fsn_included = fsn; + control->top_fsn = fsn; } created_control = 1; } SCTPDBG(SCTP_DEBUG_XXX, "chunk_flags: 0x%x ordered: %d MID: %u control: %p\n", - chunk_flags, ordered, mid, control); - if ((chunk_flags & SCTP_DATA_NOT_FRAG) == SCTP_DATA_NOT_FRAG && + chk_flags, ordered, mid, control); + if ((chk_flags & SCTP_DATA_NOT_FRAG) == SCTP_DATA_NOT_FRAG && TAILQ_EMPTY(&asoc->resetHead) && ((ordered == 0) || (SCTP_MID_EQ(asoc->idata_supported, asoc->strmin[sid].last_mid_delivered + 1, mid) && @@ -2011,7 +2018,7 @@ sctp_process_a_data_chunk(struct sctp_tc control, &stcb->sctp_socket->so_rcv, 1, SCTP_READ_LOCK_NOT_HELD, SCTP_SO_NOT_LOCKED); - if ((chunk_flags & SCTP_DATA_UNORDERED) == 0) { + if ((chk_flags & SCTP_DATA_UNORDERED) == 0) { /* for ordered, bump what we delivered */ strm->last_mid_delivered++; } @@ -2024,7 +2031,7 @@ sctp_process_a_data_chunk(struct sctp_tc goto finish_express_del; } /* Now will we need a chunk too? */ - if ((chunk_flags & SCTP_DATA_NOT_FRAG) != SCTP_DATA_NOT_FRAG) { + if ((chk_flags & SCTP_DATA_NOT_FRAG) != SCTP_DATA_NOT_FRAG) { sctp_alloc_a_chunk(stcb, chk); if (chk == NULL) { /* No memory so we drop the chunk */ @@ -2043,7 +2050,7 @@ sctp_process_a_data_chunk(struct sctp_tc chk->rec.data.ppid = ppid; chk->rec.data.context = stcb->asoc.context; chk->rec.data.doing_fast_retransmit = 0; - chk->rec.data.rcv_flags = chunk_flags; + chk->rec.data.rcv_flags = chk_flags; chk->asoc = asoc; chk->send_size = the_len; chk->whoTo = net; @@ -2066,7 +2073,7 @@ sctp_process_a_data_chunk(struct sctp_tc } } /* Now is it complete (i.e. not fragmented)? */ - if ((chunk_flags & SCTP_DATA_NOT_FRAG) == SCTP_DATA_NOT_FRAG) { + if ((chk_flags & SCTP_DATA_NOT_FRAG) == SCTP_DATA_NOT_FRAG) { /* * Special check for when streams are resetting. We could be * more smart about this and check the actual stream to see @@ -2110,7 +2117,7 @@ sctp_process_a_data_chunk(struct sctp_tc } goto finish_express_del; } - if (chunk_flags & SCTP_DATA_UNORDERED) { + if (chk_flags & SCTP_DATA_UNORDERED) { /* queue directly into socket buffer */ SCTPDBG(SCTP_DEBUG_XXX, "Unordered data to be read control: %p MID: %u\n", control, mid); Modified: stable/11/sys/netinet/sctputil.c ============================================================================== --- stable/11/sys/netinet/sctputil.c Sun Dec 18 13:45:04 2016 (r310223) +++ stable/11/sys/netinet/sctputil.c Sun Dec 18 13:48:28 2016 (r310224) @@ -4639,7 +4639,7 @@ sctp_generate_no_user_data_cause(uint32_ no_user_data_cause = mtod(m, struct sctp_error_no_user_data *); no_user_data_cause->cause.code = htons(SCTP_CAUSE_NO_USER_DATA); no_user_data_cause->cause.length = htons(len); - no_user_data_cause->tsn = tsn; /* tsn is passed in as NBO */ + no_user_data_cause->tsn = htonl(tsn); } return (m); } From owner-svn-src-all@freebsd.org Sun Dec 18 13:57:26 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 59883C85271; Sun, 18 Dec 2016 13:57:26 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 32AF11F6D; Sun, 18 Dec 2016 13:57:26 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBIDvPCv095199; Sun, 18 Dec 2016 13:57:25 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBIDvOSl095186; Sun, 18 Dec 2016 13:57:24 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201612181357.uBIDvOSl095186@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Sun, 18 Dec 2016 13:57:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310225 - in head/sys/boot: common efi/loader i386/loader mips/beri/loader ofw/common pc98/loader powerpc/kboot powerpc/ps3 sparc64/loader uboot/common userboot/userboot X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Dec 2016 13:57:26 -0000 Author: emaste Date: Sun Dec 18 13:57:23 2016 New Revision: 310225 URL: https://svnweb.freebsd.org/changeset/base/310225 Log: Reduce boot loader version string duplication Instead of repeating "%s, Revision %s" "(%s %s)" in each loader, just create the full version string in vers.c Reviewed by: bapt MFC after: 1 month Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D8823 Modified: head/sys/boot/common/interp_forth.c head/sys/boot/common/newvers.sh head/sys/boot/efi/loader/main.c head/sys/boot/i386/loader/main.c head/sys/boot/mips/beri/loader/loader.h head/sys/boot/mips/beri/loader/main.c head/sys/boot/ofw/common/main.c head/sys/boot/pc98/loader/main.c head/sys/boot/powerpc/kboot/main.c head/sys/boot/powerpc/ps3/main.c head/sys/boot/sparc64/loader/main.c head/sys/boot/uboot/common/main.c head/sys/boot/userboot/userboot/main.c Modified: head/sys/boot/common/interp_forth.c ============================================================================== --- head/sys/boot/common/interp_forth.c Sun Dec 18 13:48:28 2016 (r310224) +++ head/sys/boot/common/interp_forth.c Sun Dec 18 13:57:23 2016 (r310225) @@ -33,7 +33,7 @@ __FBSDID("$FreeBSD$"); #include "bootstrap.h" #include "ficl.h" -extern char bootprog_rev[]; +extern unsigned bootprog_rev; /* #define BFORTH_DEBUG */ @@ -277,8 +277,7 @@ bf_init(const char *rc) /* Export some version numbers so that code can detect the loader/host version */ ficlSetEnv(bf_sys, "FreeBSD_version", __FreeBSD_version); - ficlSetEnv(bf_sys, "loader_version", - (bootprog_rev[0] - '0') * 10 + (bootprog_rev[2] - '0')); + ficlSetEnv(bf_sys, "loader_version", bootprog_rev); /* try to load and run init file if present */ if (rc == NULL) Modified: head/sys/boot/common/newvers.sh ============================================================================== --- head/sys/boot/common/newvers.sh Sun Dec 18 13:48:28 2016 (r310224) +++ head/sys/boot/common/newvers.sh Sun Dec 18 13:57:23 2016 (r310225) @@ -40,8 +40,6 @@ u=${USER-root} h=${HOSTNAME-`hostname`} #r=`head -n 6 $1 | tail -n 1 | awk -F: ' { print $1 } '` r=`awk -F: ' /^[0-9]\.[0-9]+:/ { print $1; exit }' $1` -echo "char bootprog_name[] = \"FreeBSD/${3} ${2}\";" > $tempfile -echo "char bootprog_rev[] = \"${r}\";" >> $tempfile -echo "char bootprog_date[] = \"${t}\";" >> $tempfile -echo "char bootprog_maker[] = \"${u}@${h}\";" >> $tempfile +echo "char bootprog_info[] = \"FreeBSD/${3} ${2}, Revision ${r}\\n(${t} ${u}@${h})\\n\";" > $tempfile +echo "unsigned bootprog_rev = ${r%%.*}${r##*.};" >> $tempfile mv $tempfile vers.c Modified: head/sys/boot/efi/loader/main.c ============================================================================== --- head/sys/boot/efi/loader/main.c Sun Dec 18 13:48:28 2016 (r310224) +++ head/sys/boot/efi/loader/main.c Sun Dec 18 13:57:23 2016 (r310225) @@ -50,10 +50,7 @@ __FBSDID("$FreeBSD$"); #include "loader_efi.h" -extern char bootprog_name[]; -extern char bootprog_rev[]; -extern char bootprog_date[]; -extern char bootprog_maker[]; +extern char bootprog_info[]; #ifdef BOOT_FORTH /* @@ -409,9 +406,7 @@ main(int argc, CHAR16 *argv[]) printf("EFI Firmware: %S (rev %d.%02d)\n", ST->FirmwareVendor, ST->FirmwareRevision >> 16, ST->FirmwareRevision & 0xffff); - printf("\n"); - printf("%s, Revision %s\n", bootprog_name, bootprog_rev); - printf("(%s, %s)\n", bootprog_maker, bootprog_date); + printf("\n%s", bootprog_info); /* * Disable the watchdog timer. By default the boot manager sets Modified: head/sys/boot/i386/loader/main.c ============================================================================== --- head/sys/boot/i386/loader/main.c Sun Dec 18 13:48:28 2016 (r310224) +++ head/sys/boot/i386/loader/main.c Sun Dec 18 13:57:23 2016 (r310225) @@ -77,7 +77,7 @@ static void i386_zfs_probe(void); #endif /* from vers.c */ -extern char bootprog_name[], bootprog_rev[], bootprog_date[], bootprog_maker[]; +extern char bootprog_info[]; /* XXX debugging */ extern char end[]; @@ -215,9 +215,7 @@ main(void) /* detect PCI BIOS for future reference */ biospci_detect(); - printf("\n"); - printf("%s, Revision %s\n", bootprog_name, bootprog_rev); - printf("(%s, %s)\n", bootprog_maker, bootprog_date); + printf("\n%s", bootprog_info); extract_currdev(); /* set $currdev and $loaddev */ setenv("LINES", "24", 1); /* optional */ Modified: head/sys/boot/mips/beri/loader/loader.h ============================================================================== --- head/sys/boot/mips/beri/loader/loader.h Sun Dec 18 13:48:28 2016 (r310224) +++ head/sys/boot/mips/beri/loader/loader.h Sun Dec 18 13:57:23 2016 (r310225) @@ -58,7 +58,6 @@ extern struct bootinfo boot2_bootinfo; int md_load64(char *args, vm_offset_t *modulep); /* vers.c */ -extern char bootprog_name[], bootprog_rev[]; -extern char bootprog_date[], bootprog_maker[]; +extern char bootprog_info[]; #endif /* !_BOOT_LOADER_H_ */ Modified: head/sys/boot/mips/beri/loader/main.c ============================================================================== --- head/sys/boot/mips/beri/loader/main.c Sun Dec 18 13:48:28 2016 (r310224) +++ head/sys/boot/mips/beri/loader/main.c Sun Dec 18 13:57:23 2016 (r310225) @@ -144,9 +144,7 @@ main(int argc, char *argv[], char *envv[ } extract_currdev(bootinfop); - printf("\n"); - printf("%s, Revision %s\n", bootprog_name, bootprog_rev); - printf("(%s, %s)\n", bootprog_maker, bootprog_date); + printf("\n%s", bootprog_info); #if 0 printf("bootpath=\"%s\"\n", bootpath); #endif Modified: head/sys/boot/ofw/common/main.c ============================================================================== --- head/sys/boot/ofw/common/main.c Sun Dec 18 13:48:28 2016 (r310224) +++ head/sys/boot/ofw/common/main.c Sun Dec 18 13:57:23 2016 (r310225) @@ -36,10 +36,7 @@ __FBSDID("$FreeBSD$"); struct arch_switch archsw; /* MI/MD interface boundary */ extern char end[]; -extern char bootprog_name[]; -extern char bootprog_rev[]; -extern char bootprog_date[]; -extern char bootprog_maker[]; +extern char bootprog_info[]; u_int32_t acells, scells; @@ -127,9 +124,7 @@ main(int (*openfirm)(void *)) if (devsw[i]->dv_init != NULL) (devsw[i]->dv_init)(); - printf("\n"); - printf("%s, Revision %s\n", bootprog_name, bootprog_rev); - printf("(%s, %s)\n", bootprog_maker, bootprog_date); + printf("\n%s", bootprog_info); printf("Memory: %lldKB\n", memsize() / 1024); OF_getprop(chosen, "bootpath", bootpath, 64); Modified: head/sys/boot/pc98/loader/main.c ============================================================================== --- head/sys/boot/pc98/loader/main.c Sun Dec 18 13:48:28 2016 (r310224) +++ head/sys/boot/pc98/loader/main.c Sun Dec 18 13:57:23 2016 (r310225) @@ -66,7 +66,7 @@ static void isa_outb(int port, int valu void exit(int code); /* from vers.c */ -extern char bootprog_name[], bootprog_rev[], bootprog_date[], bootprog_maker[]; +extern char bootprog_info[]; /* XXX debugging */ extern char end[]; @@ -186,9 +186,7 @@ main(void) initial_bootinfo->bi_extmem = bios_extmem / 1024; } - printf("\n"); - printf("%s, Revision %s\n", bootprog_name, bootprog_rev); - printf("(%s, %s)\n", bootprog_maker, bootprog_date); + printf("\n%s", bootprog_info); extract_currdev(); /* set $currdev and $loaddev */ setenv("LINES", "24", 1); /* optional */ Modified: head/sys/boot/powerpc/kboot/main.c ============================================================================== --- head/sys/boot/powerpc/kboot/main.c Sun Dec 18 13:48:28 2016 (r310224) +++ head/sys/boot/powerpc/kboot/main.c Sun Dec 18 13:57:23 2016 (r310225) @@ -38,10 +38,7 @@ __FBSDID("$FreeBSD$"); struct arch_switch archsw; extern void *_end; -extern char bootprog_name[]; -extern char bootprog_rev[]; -extern char bootprog_date[]; -extern char bootprog_maker[]; +extern char bootprog_info[]; int kboot_getdev(void **vdev, const char *devspec, const char **path); ssize_t kboot_copyin(const void *src, vm_offset_t dest, const size_t len); @@ -119,9 +116,7 @@ main(int argc, const char **argv) archsw.arch_autoload = kboot_autoload; archsw.arch_loadaddr = kboot_loadaddr; - printf("\n"); - printf("%s, Revision %s\n", bootprog_name, bootprog_rev); - printf("(%s, %s)\n", bootprog_maker, bootprog_date); + printf("\n%s", bootprog_info); setenv("currdev", bootdev, 1); setenv("loaddev", bootdev, 1); Modified: head/sys/boot/powerpc/ps3/main.c ============================================================================== --- head/sys/boot/powerpc/ps3/main.c Sun Dec 18 13:48:28 2016 (r310224) +++ head/sys/boot/powerpc/ps3/main.c Sun Dec 18 13:57:23 2016 (r310225) @@ -41,10 +41,7 @@ __FBSDID("$FreeBSD$"); struct arch_switch archsw; extern void *_end; -extern char bootprog_name[]; -extern char bootprog_rev[]; -extern char bootprog_date[]; -extern char bootprog_maker[]; +extern char bootprog_info[]; int ps3_getdev(void **vdev, const char *devspec, const char **path); ssize_t ps3_copyin(const void *src, vm_offset_t dest, const size_t len); @@ -133,9 +130,7 @@ main(void) archsw.arch_readin = ps3_readin; archsw.arch_autoload = ps3_autoload; - printf("\n"); - printf("%s, Revision %s\n", bootprog_name, bootprog_rev); - printf("(%s, %s)\n", bootprog_maker, bootprog_date); + printf("\n%s", bootprog_info); printf("Memory: %lldKB\n", maxmem / 1024); env_setenv("currdev", EV_VOLATILE, ps3_fmtdev(&currdev), Modified: head/sys/boot/sparc64/loader/main.c ============================================================================== --- head/sys/boot/sparc64/loader/main.c Sun Dec 18 13:48:28 2016 (r310224) +++ head/sys/boot/sparc64/loader/main.c Sun Dec 18 13:57:23 2016 (r310225) @@ -75,7 +75,7 @@ __FBSDID("$FreeBSD$"); #include "libofw.h" #include "dev_net.h" -extern char bootprog_name[], bootprog_rev[], bootprog_date[], bootprog_maker[]; +extern char bootprog_info[]; enum { HEAPVA = 0x800000, @@ -891,9 +891,7 @@ main(int (*openfirm)(void *)) env_setenv("loaddev", EV_VOLATILE, bootpath, env_noset, env_nounset); - printf("\n"); - printf("%s, Revision %s\n", bootprog_name, bootprog_rev); - printf("(%s, %s)\n", bootprog_maker, bootprog_date); + printf("\n%s", bootprog_info); printf("bootpath=\"%s\"\n", bootpath); /* Give control to the machine independent loader code. */ Modified: head/sys/boot/uboot/common/main.c ============================================================================== --- head/sys/boot/uboot/common/main.c Sun Dec 18 13:48:28 2016 (r310224) +++ head/sys/boot/uboot/common/main.c Sun Dec 18 13:57:23 2016 (r310225) @@ -62,10 +62,7 @@ struct device_type { }; extern char end[]; -extern char bootprog_name[]; -extern char bootprog_rev[]; -extern char bootprog_date[]; -extern char bootprog_maker[]; +extern char bootprog_info[]; extern unsigned char _etext[]; extern unsigned char _edata[]; @@ -431,9 +428,7 @@ main(int argc, char **argv) cons_probe(); printf("Compatible U-Boot API signature found @%p\n", sig); - printf("\n"); - printf("%s, Revision %s\n", bootprog_name, bootprog_rev); - printf("(%s, %s)\n", bootprog_maker, bootprog_date); + printf("\n%s", bootprog_info); printf("\n"); dump_sig(sig); Modified: head/sys/boot/userboot/userboot/main.c ============================================================================== --- head/sys/boot/userboot/userboot/main.c Sun Dec 18 13:48:28 2016 (r310224) +++ head/sys/boot/userboot/userboot/main.c Sun Dec 18 13:57:23 2016 (r310225) @@ -51,10 +51,7 @@ static int userboot_zfs_found; struct loader_callbacks *callbacks; void *callbacks_arg; -extern char bootprog_name[]; -extern char bootprog_rev[]; -extern char bootprog_date[]; -extern char bootprog_maker[]; +extern char bootprog_info[]; static jmp_buf jb; struct arch_switch archsw; /* MI/MD interface boundary */ @@ -101,9 +98,7 @@ loader_main(struct loader_callbacks *cb, */ cons_probe(); - printf("\n"); - printf("%s, Revision %s\n", bootprog_name, bootprog_rev); - printf("(%s, %s)\n", bootprog_maker, bootprog_date); + printf("\n%s", bootprog_info); #if 0 printf("Memory: %ld k\n", memsize() / 1024); #endif From owner-svn-src-all@freebsd.org Sun Dec 18 14:04:18 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6F455C85561; Sun, 18 Dec 2016 14:04:18 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 3ECC66A3; Sun, 18 Dec 2016 14:04:18 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBIE4H7N099363; Sun, 18 Dec 2016 14:04:17 GMT (envelope-from bapt@FreeBSD.org) Received: (from bapt@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBIE4HlC099362; Sun, 18 Dec 2016 14:04:17 GMT (envelope-from bapt@FreeBSD.org) Message-Id: <201612181404.uBIE4HlC099362@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bapt set sender to bapt@FreeBSD.org using -f From: Baptiste Daroussin Date: Sun, 18 Dec 2016 14:04:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310226 - head/tools/tools/locale X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Dec 2016 14:04:18 -0000 Author: bapt Date: Sun Dec 18 14:04:17 2016 New Revision: 310226 URL: https://svnweb.freebsd.org/changeset/base/310226 Log: Disable timedef generation, cldr data are too far from freebsd extensions Modified: head/tools/tools/locale/Makefile Modified: head/tools/tools/locale/Makefile ============================================================================== --- head/tools/tools/locale/Makefile Sun Dec 18 13:57:23 2016 (r310225) +++ head/tools/tools/locale/Makefile Sun Dec 18 14:04:17 2016 (r310226) @@ -18,7 +18,7 @@ PASSON= CLDRDIR="${CLDRDIR}" UNIDATADIR ETCDIR= ${.CURDIR}/etc -KNOWN= monetdef numericdef msgdef timedef colldef ctypedef +KNOWN= monetdef numericdef msgdef colldef ctypedef # timedef TYPES?= ${KNOWN} LOCALE_DESTDIR?= /tmp/generated-locales/ From owner-svn-src-all@freebsd.org Sun Dec 18 14:10:26 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 05344C85765; Sun, 18 Dec 2016 14:10:26 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C8C6198C; Sun, 18 Dec 2016 14:10:25 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBIEAOCN099629; Sun, 18 Dec 2016 14:10:24 GMT (envelope-from bapt@FreeBSD.org) Received: (from bapt@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBIEAORg099628; Sun, 18 Dec 2016 14:10:24 GMT (envelope-from bapt@FreeBSD.org) Message-Id: <201612181410.uBIEAORg099628@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bapt set sender to bapt@FreeBSD.org using -f From: Baptiste Daroussin Date: Sun, 18 Dec 2016 14:10:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310227 - head/tools/tools/locale X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Dec 2016 14:10:26 -0000 Author: bapt Date: Sun Dec 18 14:10:24 2016 New Revision: 310227 URL: https://svnweb.freebsd.org/changeset/base/310227 Log: Document the fact that cldr tools are not working by default and should be rebuilt Modified: head/tools/tools/locale/README Modified: head/tools/tools/locale/README ============================================================================== --- head/tools/tools/locale/README Sun Dec 18 14:04:17 2016 (r310226) +++ head/tools/tools/locale/README Sun Dec 18 14:10:24 2016 (r310227) @@ -6,13 +6,18 @@ Tools needed: java, perl, devel/p5-Tie-I textproc/p5-XML-Parser fetch cldr data from: http://cldr.unicode.org -extract in a directory ~/unicode/cldr/v27.0.1 for example +extract in a directory ~/unicode/cldr/v30.0.3 for example fetch unidata from http://www.unicode.org/Public/zipped/ (latest version) -extract in a directory ~/unicode/UNIDATA/8.0.0 for example +extract in a directory ~/unicode/UNIDATA/9.0.0 for example + +Note that the prebuilt cldr tools are not working on freebsd, it needs to +be rebuilt: +cd $CLDRDIR/tools/java +ant build either modify tools/tools/locales/etc/unicode.conf or export variables: -CLDRDIR="~/unicode/cldr/v27.0.1" -UNIDATADIR="~/unicode/UNIDATA/8.0.0" +CLDRDIR="~/unicode/cldr/v30.0.3" +UNIDATADIR="~/unicode/UNIDATA/9.0.0" run: make POSIX From owner-svn-src-all@freebsd.org Sun Dec 18 14:31:12 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id BBF9EC871A1; Sun, 18 Dec 2016 14:31:12 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 6B6AE1927; Sun, 18 Dec 2016 14:31:12 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBIEVBqi007829; Sun, 18 Dec 2016 14:31:11 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBIEVBgn007828; Sun, 18 Dec 2016 14:31:11 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201612181431.uBIEVBgn007828@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Sun, 18 Dec 2016 14:31:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r310228 - in stable: 10/sys/dev/xen/blkfront 11/sys/dev/xen/blkfront 9/sys/dev/xen/blkfront X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Dec 2016 14:31:12 -0000 Author: dim Date: Sun Dec 18 14:31:11 2016 New Revision: 310228 URL: https://svnweb.freebsd.org/changeset/base/310228 Log: MFC r310013 (by cperciva): Check that blkfront devices have a non-zero number of sectors and a non-zero sector size. Such a device would be a virtual disk of zero bytes; clearly not useful, and not something we should try to attach. As a fortuitous side effect, checking that these values are non-zero here results in them not *becoming* zero later on the function. This odd behaviour began with r309124 (clang 3.9.0) but is challenging to debug; making any changes to this function whatsoever seems to affect the llvm optimizer behaviour enough to make the unexpected zeroing of the sector_size variable cease. PR: 215209 Security: The potential for variables to unexpectedly become zero has worrying consequences for security in general, but not so much in this particular context. MFC r310086: In xbd_connect(), use correct scanf conversion specifiers for the feature_barrier and feature_flush variables. Otherwise, adjacent variables on the stack, such as sector_size, may be overwritten, with disastrous results. Note that I did not see a good reason to revert the addition of zero checks introduced in r310013. Better safe than sorry. PR: 215209 Tested by: royger Modified: stable/9/sys/dev/xen/blkfront/blkfront.c Directory Properties: stable/9/ (props changed) stable/9/sys/ (props changed) Changes in other areas also in this revision: Modified: stable/10/sys/dev/xen/blkfront/blkfront.c stable/11/sys/dev/xen/blkfront/blkfront.c Directory Properties: stable/10/ (props changed) stable/11/ (props changed) Modified: stable/9/sys/dev/xen/blkfront/blkfront.c ============================================================================== --- stable/9/sys/dev/xen/blkfront/blkfront.c Sun Dec 18 14:10:24 2016 (r310227) +++ stable/9/sys/dev/xen/blkfront/blkfront.c Sun Dec 18 14:31:11 2016 (r310228) @@ -933,8 +933,16 @@ blkfront_connect(struct xb_softc *sc) xenbus_get_otherend_path(dev)); return; } + if ((sectors == 0) || (sector_size == 0)) { + xenbus_dev_fatal(dev, 0, + "invalid parameters from %s:" + " sectors = %lu, sector_size = %lu", + xenbus_get_otherend_path(dev), + sectors, sector_size); + return; + } err = xs_gather(XST_NIL, xenbus_get_otherend_path(dev), - "feature-barrier", "%lu", &feature_barrier, + "feature-barrier", "%d", &feature_barrier, NULL); if (!err || feature_barrier) sc->xb_flags |= XB_BARRIER; From owner-svn-src-all@freebsd.org Sun Dec 18 14:31:12 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E73F5C871A5; Sun, 18 Dec 2016 14:31:12 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A11DE1929; Sun, 18 Dec 2016 14:31:12 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBIEVBO2007835; Sun, 18 Dec 2016 14:31:11 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBIEVBnx007834; Sun, 18 Dec 2016 14:31:11 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201612181431.uBIEVBnx007834@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Sun, 18 Dec 2016 14:31:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r310228 - in stable: 10/sys/dev/xen/blkfront 11/sys/dev/xen/blkfront 9/sys/dev/xen/blkfront X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Dec 2016 14:31:13 -0000 Author: dim Date: Sun Dec 18 14:31:11 2016 New Revision: 310228 URL: https://svnweb.freebsd.org/changeset/base/310228 Log: MFC r310013 (by cperciva): Check that blkfront devices have a non-zero number of sectors and a non-zero sector size. Such a device would be a virtual disk of zero bytes; clearly not useful, and not something we should try to attach. As a fortuitous side effect, checking that these values are non-zero here results in them not *becoming* zero later on the function. This odd behaviour began with r309124 (clang 3.9.0) but is challenging to debug; making any changes to this function whatsoever seems to affect the llvm optimizer behaviour enough to make the unexpected zeroing of the sector_size variable cease. PR: 215209 Security: The potential for variables to unexpectedly become zero has worrying consequences for security in general, but not so much in this particular context. MFC r310086: In xbd_connect(), use correct scanf conversion specifiers for the feature_barrier and feature_flush variables. Otherwise, adjacent variables on the stack, such as sector_size, may be overwritten, with disastrous results. Note that I did not see a good reason to revert the addition of zero checks introduced in r310013. Better safe than sorry. PR: 215209 Tested by: royger Modified: stable/11/sys/dev/xen/blkfront/blkfront.c Directory Properties: stable/11/ (props changed) Changes in other areas also in this revision: Modified: stable/10/sys/dev/xen/blkfront/blkfront.c stable/9/sys/dev/xen/blkfront/blkfront.c Directory Properties: stable/10/ (props changed) stable/9/ (props changed) stable/9/sys/ (props changed) Modified: stable/11/sys/dev/xen/blkfront/blkfront.c ============================================================================== --- stable/11/sys/dev/xen/blkfront/blkfront.c Sun Dec 18 14:10:24 2016 (r310227) +++ stable/11/sys/dev/xen/blkfront/blkfront.c Sun Dec 18 14:31:11 2016 (r310228) @@ -1245,19 +1245,27 @@ xbd_connect(struct xbd_softc *sc) xenbus_get_otherend_path(dev)); return; } + if ((sectors == 0) || (sector_size == 0)) { + xenbus_dev_fatal(dev, 0, + "invalid parameters from %s:" + " sectors = %lu, sector_size = %lu", + xenbus_get_otherend_path(dev), + sectors, sector_size); + return; + } err = xs_gather(XST_NIL, xenbus_get_otherend_path(dev), "physical-sector-size", "%lu", &phys_sector_size, NULL); if (err || phys_sector_size <= sector_size) phys_sector_size = 0; err = xs_gather(XST_NIL, xenbus_get_otherend_path(dev), - "feature-barrier", "%lu", &feature_barrier, + "feature-barrier", "%d", &feature_barrier, NULL); if (err == 0 && feature_barrier != 0) sc->xbd_flags |= XBDF_BARRIER; err = xs_gather(XST_NIL, xenbus_get_otherend_path(dev), - "feature-flush-cache", "%lu", &feature_flush, + "feature-flush-cache", "%d", &feature_flush, NULL); if (err == 0 && feature_flush != 0) sc->xbd_flags |= XBDF_FLUSH; From owner-svn-src-all@freebsd.org Sun Dec 18 14:31:13 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 21486C871AA; Sun, 18 Dec 2016 14:31:13 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D7B1E192B; Sun, 18 Dec 2016 14:31:12 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBIEVCKI007841; Sun, 18 Dec 2016 14:31:12 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBIEVC98007840; Sun, 18 Dec 2016 14:31:12 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201612181431.uBIEVC98007840@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Sun, 18 Dec 2016 14:31:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r310228 - in stable: 10/sys/dev/xen/blkfront 11/sys/dev/xen/blkfront 9/sys/dev/xen/blkfront X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Dec 2016 14:31:13 -0000 Author: dim Date: Sun Dec 18 14:31:11 2016 New Revision: 310228 URL: https://svnweb.freebsd.org/changeset/base/310228 Log: MFC r310013 (by cperciva): Check that blkfront devices have a non-zero number of sectors and a non-zero sector size. Such a device would be a virtual disk of zero bytes; clearly not useful, and not something we should try to attach. As a fortuitous side effect, checking that these values are non-zero here results in them not *becoming* zero later on the function. This odd behaviour began with r309124 (clang 3.9.0) but is challenging to debug; making any changes to this function whatsoever seems to affect the llvm optimizer behaviour enough to make the unexpected zeroing of the sector_size variable cease. PR: 215209 Security: The potential for variables to unexpectedly become zero has worrying consequences for security in general, but not so much in this particular context. MFC r310086: In xbd_connect(), use correct scanf conversion specifiers for the feature_barrier and feature_flush variables. Otherwise, adjacent variables on the stack, such as sector_size, may be overwritten, with disastrous results. Note that I did not see a good reason to revert the addition of zero checks introduced in r310013. Better safe than sorry. PR: 215209 Tested by: royger Modified: stable/10/sys/dev/xen/blkfront/blkfront.c Directory Properties: stable/10/ (props changed) Changes in other areas also in this revision: Modified: stable/11/sys/dev/xen/blkfront/blkfront.c stable/9/sys/dev/xen/blkfront/blkfront.c Directory Properties: stable/11/ (props changed) stable/9/ (props changed) stable/9/sys/ (props changed) Modified: stable/10/sys/dev/xen/blkfront/blkfront.c ============================================================================== --- stable/10/sys/dev/xen/blkfront/blkfront.c Sun Dec 18 14:10:24 2016 (r310227) +++ stable/10/sys/dev/xen/blkfront/blkfront.c Sun Dec 18 14:31:11 2016 (r310228) @@ -1239,19 +1239,27 @@ xbd_connect(struct xbd_softc *sc) xenbus_get_otherend_path(dev)); return; } + if ((sectors == 0) || (sector_size == 0)) { + xenbus_dev_fatal(dev, 0, + "invalid parameters from %s:" + " sectors = %lu, sector_size = %lu", + xenbus_get_otherend_path(dev), + sectors, sector_size); + return; + } err = xs_gather(XST_NIL, xenbus_get_otherend_path(dev), "physical-sector-size", "%lu", &phys_sector_size, NULL); if (err || phys_sector_size <= sector_size) phys_sector_size = 0; err = xs_gather(XST_NIL, xenbus_get_otherend_path(dev), - "feature-barrier", "%lu", &feature_barrier, + "feature-barrier", "%d", &feature_barrier, NULL); if (err == 0 && feature_barrier != 0) sc->xbd_flags |= XBDF_BARRIER; err = xs_gather(XST_NIL, xenbus_get_otherend_path(dev), - "feature-flush-cache", "%lu", &feature_flush, + "feature-flush-cache", "%d", &feature_flush, NULL); if (err == 0 && feature_flush != 0) sc->xbd_flags |= XBDF_FLUSH; From owner-svn-src-all@freebsd.org Sun Dec 18 14:54:23 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6238FC879C0; Sun, 18 Dec 2016 14:54:23 +0000 (UTC) (envelope-from manu@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 2349CD49; Sun, 18 Dec 2016 14:54:23 +0000 (UTC) (envelope-from manu@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBIEsMRX019616; Sun, 18 Dec 2016 14:54:22 GMT (envelope-from manu@FreeBSD.org) Received: (from manu@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBIEsKkd019602; Sun, 18 Dec 2016 14:54:20 GMT (envelope-from manu@FreeBSD.org) Message-Id: <201612181454.uBIEsKkd019602@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: manu set sender to manu@FreeBSD.org using -f From: Emmanuel Vadot Date: Sun, 18 Dec 2016 14:54:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310229 - in head/sys: arm/at91 arm/broadcom/bcm2835 arm/freescale/vybrid arm/lpc arm/samsung/exynos arm/ti dev/spibus dev/xilinx mips/atheros mips/atheros/ar531x mips/mediatek mips/rt305x X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Dec 2016 14:54:23 -0000 Author: manu Date: Sun Dec 18 14:54:20 2016 New Revision: 310229 URL: https://svnweb.freebsd.org/changeset/base/310229 Log: ofw_spi: Parse property for the SPI mode and CS polarity. As cs is stored in a uint32_t, use the last bit to store the active high flag as it's unlikely that we will have that much CS. Reviewed by: loos MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D8614 Modified: head/sys/arm/at91/at91_spi.c head/sys/arm/broadcom/bcm2835/bcm2835_spi.c head/sys/arm/freescale/vybrid/vf_spi.c head/sys/arm/lpc/lpc_spi.c head/sys/arm/samsung/exynos/exynos5_spi.c head/sys/arm/ti/ti_spi.c head/sys/dev/spibus/ofw_spibus.c head/sys/dev/spibus/spibusvar.h head/sys/dev/xilinx/axi_quad_spi.c head/sys/mips/atheros/ar531x/ar5315_spi.c head/sys/mips/atheros/ar71xx_spi.c head/sys/mips/mediatek/mtk_spi_v1.c head/sys/mips/mediatek/mtk_spi_v2.c head/sys/mips/rt305x/rt305x_spi.c Modified: head/sys/arm/at91/at91_spi.c ============================================================================== --- head/sys/arm/at91/at91_spi.c Sun Dec 18 14:31:11 2016 (r310228) +++ head/sys/arm/at91/at91_spi.c Sun Dec 18 14:54:20 2016 (r310229) @@ -301,6 +301,8 @@ at91_spi_transfer(device_t dev, device_t /* get the proper chip select */ spibus_get_cs(child, &cs); + cs &= ~SPIBUS_CS_HIGH; + sc = device_get_softc(dev); i = 0; Modified: head/sys/arm/broadcom/bcm2835/bcm2835_spi.c ============================================================================== --- head/sys/arm/broadcom/bcm2835/bcm2835_spi.c Sun Dec 18 14:31:11 2016 (r310228) +++ head/sys/arm/broadcom/bcm2835/bcm2835_spi.c Sun Dec 18 14:54:20 2016 (r310229) @@ -433,6 +433,9 @@ bcm_spi_transfer(device_t dev, device_t /* Get the proper chip select for this child. */ spibus_get_cs(child, &cs); + + cs &= ~SPIBUS_CS_HIGH; + if (cs > 2) { device_printf(dev, "Invalid chip select %d requested by %s\n", cs, Modified: head/sys/arm/freescale/vybrid/vf_spi.c ============================================================================== --- head/sys/arm/freescale/vybrid/vf_spi.c Sun Dec 18 14:31:11 2016 (r310228) +++ head/sys/arm/freescale/vybrid/vf_spi.c Sun Dec 18 14:54:20 2016 (r310229) @@ -262,6 +262,8 @@ spi_transfer(device_t dev, device_t chil /* get the proper chip select */ spibus_get_cs(child, &cs); + cs &= ~SPIBUS_CS_HIGH; + /* Command */ spi_txrx(sc, cmd->tx_cmd, cmd->rx_cmd, cmd->tx_cmd_sz, cs); Modified: head/sys/arm/lpc/lpc_spi.c ============================================================================== --- head/sys/arm/lpc/lpc_spi.c Sun Dec 18 14:31:11 2016 (r310228) +++ head/sys/arm/lpc/lpc_spi.c Sun Dec 18 14:54:20 2016 (r310229) @@ -147,6 +147,8 @@ lpc_spi_transfer(device_t dev, device_t spibus_get_cs(child, &cs); + cs &= ~SPIBUS_CS_HIGH; + /* Set CS active */ lpc_gpio_set_state(child, cs, 0); Modified: head/sys/arm/samsung/exynos/exynos5_spi.c ============================================================================== --- head/sys/arm/samsung/exynos/exynos5_spi.c Sun Dec 18 14:31:11 2016 (r310228) +++ head/sys/arm/samsung/exynos/exynos5_spi.c Sun Dec 18 14:54:20 2016 (r310229) @@ -204,6 +204,8 @@ spi_transfer(device_t dev, device_t chil /* get the proper chip select */ spibus_get_cs(child, &cs); + cs &= ~SPIBUS_CS_HIGH; + /* Command */ spi_txrx(sc, cmd->tx_cmd, cmd->rx_cmd, cmd->tx_cmd_sz, cs); Modified: head/sys/arm/ti/ti_spi.c ============================================================================== --- head/sys/arm/ti/ti_spi.c Sun Dec 18 14:31:11 2016 (r310228) +++ head/sys/arm/ti/ti_spi.c Sun Dec 18 14:54:20 2016 (r310229) @@ -457,6 +457,9 @@ ti_spi_transfer(device_t dev, device_t c /* Get the proper chip select for this child. */ spibus_get_cs(child, &cs); + + cs &= ~SPIBUS_CS_HIGH; + if (cs > sc->sc_numcs) { device_printf(dev, "Invalid chip select %d requested by %s\n", cs, device_get_nameunit(child)); Modified: head/sys/dev/spibus/ofw_spibus.c ============================================================================== --- head/sys/dev/spibus/ofw_spibus.c Sun Dec 18 14:31:11 2016 (r310228) +++ head/sys/dev/spibus/ofw_spibus.c Sun Dec 18 14:54:20 2016 (r310229) @@ -80,6 +80,7 @@ ofw_spibus_attach(device_t dev) phandle_t child; pcell_t clock, paddr; device_t childdev; + uint32_t mode = SPIBUS_MODE_NONE; sc->dev = dev; @@ -103,6 +104,24 @@ ofw_spibus_attach(device_t dev) } /* + * Try to get the cpol/cpha mode + */ + if (OF_hasprop(child, "spi-cpol")) + mode = SPIBUS_MODE_CPOL; + if (OF_hasprop(child, "spi-cpha")) { + if (mode == SPIBUS_MODE_CPOL) + mode = SPIBUS_MODE_CPOL_CPHA; + else + mode = SPIBUS_MODE_CPHA; + } + + /* + * Try to get the CS polarity + */ + if (OF_hasprop(child, "spi-cs-high")) + paddr |= SPIBUS_CS_HIGH; + + /* * Get the maximum clock frequency for device, zero means * use the default bus speed. */ @@ -120,6 +139,7 @@ ofw_spibus_attach(device_t dev) continue; dinfo->opd_dinfo.cs = paddr; dinfo->opd_dinfo.clock = clock; + dinfo->opd_dinfo.mode = mode; if (ofw_bus_gen_setup_devinfo(&dinfo->opd_obdinfo, child) != 0) { free(dinfo, M_DEVBUF); Modified: head/sys/dev/spibus/spibusvar.h ============================================================================== --- head/sys/dev/spibus/spibusvar.h Sun Dec 18 14:31:11 2016 (r310228) +++ head/sys/dev/spibus/spibusvar.h Sun Dec 18 14:54:20 2016 (r310229) @@ -46,6 +46,8 @@ struct spibus_ivar uint32_t clock; }; +#define SPIBUS_CS_HIGH (1U << 31) + enum { SPIBUS_IVAR_CS, /* chip select that we're on */ SPIBUS_IVAR_MODE, /* SPI mode (0-3) */ Modified: head/sys/dev/xilinx/axi_quad_spi.c ============================================================================== --- head/sys/dev/xilinx/axi_quad_spi.c Sun Dec 18 14:31:11 2016 (r310228) +++ head/sys/dev/xilinx/axi_quad_spi.c Sun Dec 18 14:54:20 2016 (r310229) @@ -193,6 +193,8 @@ spi_transfer(device_t dev, device_t chil /* get the proper chip select */ spibus_get_cs(child, &cs); + cs &= ~SPIBUS_CS_HIGH; + /* Assert CS */ reg = READ4(sc, SPI_SSR); reg &= ~(1 << cs); Modified: head/sys/mips/atheros/ar531x/ar5315_spi.c ============================================================================== --- head/sys/mips/atheros/ar531x/ar5315_spi.c Sun Dec 18 14:31:11 2016 (r310228) +++ head/sys/mips/atheros/ar531x/ar5315_spi.c Sun Dec 18 14:54:20 2016 (r310229) @@ -166,6 +166,8 @@ ar5315_spi_transfer(device_t dev, device spibus_get_cs(child, &cs); + cs &= ~SPIBUS_CS_HIGH; + /* Open SPI controller interface */ ar5315_spi_chip_activate(sc, cs); Modified: head/sys/mips/atheros/ar71xx_spi.c ============================================================================== --- head/sys/mips/atheros/ar71xx_spi.c Sun Dec 18 14:31:11 2016 (r310228) +++ head/sys/mips/atheros/ar71xx_spi.c Sun Dec 18 14:54:20 2016 (r310229) @@ -212,6 +212,8 @@ ar71xx_spi_transfer(device_t dev, device spibus_get_cs(child, &cs); + cs &= ~SPIBUS_CS_HIGH; + ar71xx_spi_chip_activate(sc, cs); KASSERT(cmd->tx_cmd_sz == cmd->rx_cmd_sz, Modified: head/sys/mips/mediatek/mtk_spi_v1.c ============================================================================== --- head/sys/mips/mediatek/mtk_spi_v1.c Sun Dec 18 14:31:11 2016 (r310228) +++ head/sys/mips/mediatek/mtk_spi_v1.c Sun Dec 18 14:54:20 2016 (r310229) @@ -231,6 +231,8 @@ mtk_spi_transfer(device_t dev, device_t spibus_get_cs(child, &cs); + cs &= ~SPIBUS_CS_HIGH; + if (cs != 0) /* Only 1 CS */ return (ENXIO); Modified: head/sys/mips/mediatek/mtk_spi_v2.c ============================================================================== --- head/sys/mips/mediatek/mtk_spi_v2.c Sun Dec 18 14:31:11 2016 (r310228) +++ head/sys/mips/mediatek/mtk_spi_v2.c Sun Dec 18 14:54:20 2016 (r310229) @@ -236,6 +236,8 @@ mtk_spi_transfer(device_t dev, device_t spibus_get_cs(child, &cs); + cs &= ~SPIBUS_CS_HIGH; + if (cs != 0) /* Only 1 CS */ return (ENXIO); Modified: head/sys/mips/rt305x/rt305x_spi.c ============================================================================== --- head/sys/mips/rt305x/rt305x_spi.c Sun Dec 18 14:31:11 2016 (r310228) +++ head/sys/mips/rt305x/rt305x_spi.c Sun Dec 18 14:54:20 2016 (r310229) @@ -226,6 +226,8 @@ rt305x_spi_transfer(device_t dev, device spibus_get_cs(child, &cs); + cs &= ~SPIBUS_CS_HIGH; + if (cs != 0) /* Only 1 CS */ return (ENXIO); From owner-svn-src-all@freebsd.org Sun Dec 18 15:02:51 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6D8D3C87D6B; Sun, 18 Dec 2016 15:02:51 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 35E1C1396; Sun, 18 Dec 2016 15:02:51 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBIF2o3g023449; Sun, 18 Dec 2016 15:02:50 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBIF2o4a023448; Sun, 18 Dec 2016 15:02:50 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201612181502.uBIF2o4a023448@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Sun, 18 Dec 2016 15:02:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310230 - head/sys/cam/scsi X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Dec 2016 15:02:51 -0000 Author: mav Date: Sun Dec 18 15:02:50 2016 New Revision: 310230 URL: https://svnweb.freebsd.org/changeset/base/310230 Log: Don't treat informational exceptions (warnings and impending failures) a.k.a. SCSI SMART events as errors. Log them to console and continue. MFC after: 2 weeks Modified: head/sys/cam/scsi/scsi_all.c Modified: head/sys/cam/scsi/scsi_all.c ============================================================================== --- head/sys/cam/scsi/scsi_all.c Sun Dec 18 14:54:20 2016 (r310229) +++ head/sys/cam/scsi/scsi_all.c Sun Dec 18 15:02:50 2016 (r310230) @@ -1233,58 +1233,58 @@ static struct asc_table_entry asc_table[ { SST(0x0A, 0x00, SS_FATAL | ENOSPC, "Error log overflow") }, /* DTLPWROMAEBKVF */ - { SST(0x0B, 0x00, SS_RDEF, + { SST(0x0B, 0x00, SS_NOP | SSQ_PRINT_SENSE, "Warning") }, /* DTLPWROMAEBKVF */ - { SST(0x0B, 0x01, SS_RDEF, + { SST(0x0B, 0x01, SS_NOP | SSQ_PRINT_SENSE, "Warning - specified temperature exceeded") }, /* DTLPWROMAEBKVF */ - { SST(0x0B, 0x02, SS_RDEF, + { SST(0x0B, 0x02, SS_NOP | SSQ_PRINT_SENSE, "Warning - enclosure degraded") }, /* DTLPWROMAEBKVF */ - { SST(0x0B, 0x03, SS_RDEF, /* XXX TBD */ + { SST(0x0B, 0x03, SS_NOP | SSQ_PRINT_SENSE, "Warning - background self-test failed") }, /* DTLPWRO AEBKVF */ - { SST(0x0B, 0x04, SS_RDEF, /* XXX TBD */ + { SST(0x0B, 0x04, SS_NOP | SSQ_PRINT_SENSE, "Warning - background pre-scan detected medium error") }, /* DTLPWRO AEBKVF */ - { SST(0x0B, 0x05, SS_RDEF, /* XXX TBD */ + { SST(0x0B, 0x05, SS_NOP | SSQ_PRINT_SENSE, "Warning - background medium scan detected medium error") }, /* DTLPWROMAEBKVF */ - { SST(0x0B, 0x06, SS_RDEF, /* XXX TBD */ + { SST(0x0B, 0x06, SS_NOP | SSQ_PRINT_SENSE, "Warning - non-volatile cache now volatile") }, /* DTLPWROMAEBKVF */ - { SST(0x0B, 0x07, SS_RDEF, /* XXX TBD */ + { SST(0x0B, 0x07, SS_NOP | SSQ_PRINT_SENSE, "Warning - degraded power to non-volatile cache") }, /* DTLPWROMAEBKVF */ - { SST(0x0B, 0x08, SS_RDEF, /* XXX TBD */ + { SST(0x0B, 0x08, SS_NOP | SSQ_PRINT_SENSE, "Warning - power loss expected") }, /* D */ - { SST(0x0B, 0x09, SS_RDEF, /* XXX TBD */ + { SST(0x0B, 0x09, SS_NOP | SSQ_PRINT_SENSE, "Warning - device statistics notification available") }, /* DTLPWROMAEBKVF */ - { SST(0x0B, 0x0A, SS_RDEF, /* XXX TBD */ + { SST(0x0B, 0x0A, SS_NOP | SSQ_PRINT_SENSE, "Warning - High critical temperature limit exceeded") }, /* DTLPWROMAEBKVF */ - { SST(0x0B, 0x0B, SS_RDEF, /* XXX TBD */ + { SST(0x0B, 0x0B, SS_NOP | SSQ_PRINT_SENSE, "Warning - Low critical temperature limit exceeded") }, /* DTLPWROMAEBKVF */ - { SST(0x0B, 0x0C, SS_RDEF, /* XXX TBD */ + { SST(0x0B, 0x0C, SS_NOP | SSQ_PRINT_SENSE, "Warning - High operating temperature limit exceeded") }, /* DTLPWROMAEBKVF */ - { SST(0x0B, 0x0D, SS_RDEF, /* XXX TBD */ + { SST(0x0B, 0x0D, SS_NOP | SSQ_PRINT_SENSE, "Warning - Low operating temperature limit exceeded") }, /* DTLPWROMAEBKVF */ - { SST(0x0B, 0x0E, SS_RDEF, /* XXX TBD */ + { SST(0x0B, 0x0E, SS_NOP | SSQ_PRINT_SENSE, "Warning - High citical humidity limit exceeded") }, /* DTLPWROMAEBKVF */ - { SST(0x0B, 0x0F, SS_RDEF, /* XXX TBD */ + { SST(0x0B, 0x0F, SS_NOP | SSQ_PRINT_SENSE, "Warning - Low citical humidity limit exceeded") }, /* DTLPWROMAEBKVF */ - { SST(0x0B, 0x10, SS_RDEF, /* XXX TBD */ + { SST(0x0B, 0x10, SS_NOP | SSQ_PRINT_SENSE, "Warning - High operating humidity limit exceeded") }, /* DTLPWROMAEBKVF */ - { SST(0x0B, 0x11, SS_RDEF, /* XXX TBD */ + { SST(0x0B, 0x11, SS_NOP | SSQ_PRINT_SENSE, "Warning - Low operating humidity limit exceeded") }, /* T R */ { SST(0x0C, 0x00, SS_RDEF, @@ -2613,253 +2613,259 @@ static struct asc_table_entry asc_table[ { SST(0x5C, 0x02, SS_RDEF, "Spindles not synchronized") }, /* DTLPWROMAEBKVF */ - { SST(0x5D, 0x00, SS_RDEF, + { SST(0x5D, 0x00, SS_NOP | SSQ_PRINT_SENSE, "Failure prediction threshold exceeded") }, /* R B */ - { SST(0x5D, 0x01, SS_RDEF, /* XXX TBD */ + { SST(0x5D, 0x01, SS_NOP | SSQ_PRINT_SENSE, "Media failure prediction threshold exceeded") }, /* R */ - { SST(0x5D, 0x02, SS_RDEF, /* XXX TBD */ + { SST(0x5D, 0x02, SS_NOP | SSQ_PRINT_SENSE, "Logical unit failure prediction threshold exceeded") }, /* R */ - { SST(0x5D, 0x03, SS_RDEF, /* XXX TBD */ + { SST(0x5D, 0x03, SS_NOP | SSQ_PRINT_SENSE, "Spare area exhaustion prediction threshold exceeded") }, /* D B */ - { SST(0x5D, 0x10, SS_RDEF, /* XXX TBD */ + { SST(0x5D, 0x10, SS_NOP | SSQ_PRINT_SENSE, "Hardware impending failure general hard drive failure") }, /* D B */ - { SST(0x5D, 0x11, SS_RDEF, /* XXX TBD */ + { SST(0x5D, 0x11, SS_NOP | SSQ_PRINT_SENSE, "Hardware impending failure drive error rate too high") }, /* D B */ - { SST(0x5D, 0x12, SS_RDEF, /* XXX TBD */ + { SST(0x5D, 0x12, SS_NOP | SSQ_PRINT_SENSE, "Hardware impending failure data error rate too high") }, /* D B */ - { SST(0x5D, 0x13, SS_RDEF, /* XXX TBD */ + { SST(0x5D, 0x13, SS_NOP | SSQ_PRINT_SENSE, "Hardware impending failure seek error rate too high") }, /* D B */ - { SST(0x5D, 0x14, SS_RDEF, /* XXX TBD */ + { SST(0x5D, 0x14, SS_NOP | SSQ_PRINT_SENSE, "Hardware impending failure too many block reassigns") }, /* D B */ - { SST(0x5D, 0x15, SS_RDEF, /* XXX TBD */ + { SST(0x5D, 0x15, SS_NOP | SSQ_PRINT_SENSE, "Hardware impending failure access times too high") }, /* D B */ - { SST(0x5D, 0x16, SS_RDEF, /* XXX TBD */ + { SST(0x5D, 0x16, SS_NOP | SSQ_PRINT_SENSE, "Hardware impending failure start unit times too high") }, /* D B */ - { SST(0x5D, 0x17, SS_RDEF, /* XXX TBD */ + { SST(0x5D, 0x17, SS_NOP | SSQ_PRINT_SENSE, "Hardware impending failure channel parametrics") }, /* D B */ - { SST(0x5D, 0x18, SS_RDEF, /* XXX TBD */ + { SST(0x5D, 0x18, SS_NOP | SSQ_PRINT_SENSE, "Hardware impending failure controller detected") }, /* D B */ - { SST(0x5D, 0x19, SS_RDEF, /* XXX TBD */ + { SST(0x5D, 0x19, SS_NOP | SSQ_PRINT_SENSE, "Hardware impending failure throughput performance") }, /* D B */ - { SST(0x5D, 0x1A, SS_RDEF, /* XXX TBD */ + { SST(0x5D, 0x1A, SS_NOP | SSQ_PRINT_SENSE, "Hardware impending failure seek time performance") }, /* D B */ - { SST(0x5D, 0x1B, SS_RDEF, /* XXX TBD */ + { SST(0x5D, 0x1B, SS_NOP | SSQ_PRINT_SENSE, "Hardware impending failure spin-up retry count") }, /* D B */ - { SST(0x5D, 0x1C, SS_RDEF, /* XXX TBD */ + { SST(0x5D, 0x1C, SS_NOP | SSQ_PRINT_SENSE, "Hardware impending failure drive calibration retry count") }, /* D B */ - { SST(0x5D, 0x20, SS_RDEF, /* XXX TBD */ + { SST(0x5D, 0x1D, SS_NOP | SSQ_PRINT_SENSE, + "Hardware impending failure power loss protection circuit") }, + /* D B */ + { SST(0x5D, 0x20, SS_NOP | SSQ_PRINT_SENSE, "Controller impending failure general hard drive failure") }, /* D B */ - { SST(0x5D, 0x21, SS_RDEF, /* XXX TBD */ + { SST(0x5D, 0x21, SS_NOP | SSQ_PRINT_SENSE, "Controller impending failure drive error rate too high") }, /* D B */ - { SST(0x5D, 0x22, SS_RDEF, /* XXX TBD */ + { SST(0x5D, 0x22, SS_NOP | SSQ_PRINT_SENSE, "Controller impending failure data error rate too high") }, /* D B */ - { SST(0x5D, 0x23, SS_RDEF, /* XXX TBD */ + { SST(0x5D, 0x23, SS_NOP | SSQ_PRINT_SENSE, "Controller impending failure seek error rate too high") }, /* D B */ - { SST(0x5D, 0x24, SS_RDEF, /* XXX TBD */ + { SST(0x5D, 0x24, SS_NOP | SSQ_PRINT_SENSE, "Controller impending failure too many block reassigns") }, /* D B */ - { SST(0x5D, 0x25, SS_RDEF, /* XXX TBD */ + { SST(0x5D, 0x25, SS_NOP | SSQ_PRINT_SENSE, "Controller impending failure access times too high") }, /* D B */ - { SST(0x5D, 0x26, SS_RDEF, /* XXX TBD */ + { SST(0x5D, 0x26, SS_NOP | SSQ_PRINT_SENSE, "Controller impending failure start unit times too high") }, /* D B */ - { SST(0x5D, 0x27, SS_RDEF, /* XXX TBD */ + { SST(0x5D, 0x27, SS_NOP | SSQ_PRINT_SENSE, "Controller impending failure channel parametrics") }, /* D B */ - { SST(0x5D, 0x28, SS_RDEF, /* XXX TBD */ + { SST(0x5D, 0x28, SS_NOP | SSQ_PRINT_SENSE, "Controller impending failure controller detected") }, /* D B */ - { SST(0x5D, 0x29, SS_RDEF, /* XXX TBD */ + { SST(0x5D, 0x29, SS_NOP | SSQ_PRINT_SENSE, "Controller impending failure throughput performance") }, /* D B */ - { SST(0x5D, 0x2A, SS_RDEF, /* XXX TBD */ + { SST(0x5D, 0x2A, SS_NOP | SSQ_PRINT_SENSE, "Controller impending failure seek time performance") }, /* D B */ - { SST(0x5D, 0x2B, SS_RDEF, /* XXX TBD */ + { SST(0x5D, 0x2B, SS_NOP | SSQ_PRINT_SENSE, "Controller impending failure spin-up retry count") }, /* D B */ - { SST(0x5D, 0x2C, SS_RDEF, /* XXX TBD */ + { SST(0x5D, 0x2C, SS_NOP | SSQ_PRINT_SENSE, "Controller impending failure drive calibration retry count") }, /* D B */ - { SST(0x5D, 0x30, SS_RDEF, /* XXX TBD */ + { SST(0x5D, 0x30, SS_NOP | SSQ_PRINT_SENSE, "Data channel impending failure general hard drive failure") }, /* D B */ - { SST(0x5D, 0x31, SS_RDEF, /* XXX TBD */ + { SST(0x5D, 0x31, SS_NOP | SSQ_PRINT_SENSE, "Data channel impending failure drive error rate too high") }, /* D B */ - { SST(0x5D, 0x32, SS_RDEF, /* XXX TBD */ + { SST(0x5D, 0x32, SS_NOP | SSQ_PRINT_SENSE, "Data channel impending failure data error rate too high") }, /* D B */ - { SST(0x5D, 0x33, SS_RDEF, /* XXX TBD */ + { SST(0x5D, 0x33, SS_NOP | SSQ_PRINT_SENSE, "Data channel impending failure seek error rate too high") }, /* D B */ - { SST(0x5D, 0x34, SS_RDEF, /* XXX TBD */ + { SST(0x5D, 0x34, SS_NOP | SSQ_PRINT_SENSE, "Data channel impending failure too many block reassigns") }, /* D B */ - { SST(0x5D, 0x35, SS_RDEF, /* XXX TBD */ + { SST(0x5D, 0x35, SS_NOP | SSQ_PRINT_SENSE, "Data channel impending failure access times too high") }, /* D B */ - { SST(0x5D, 0x36, SS_RDEF, /* XXX TBD */ + { SST(0x5D, 0x36, SS_NOP | SSQ_PRINT_SENSE, "Data channel impending failure start unit times too high") }, /* D B */ - { SST(0x5D, 0x37, SS_RDEF, /* XXX TBD */ + { SST(0x5D, 0x37, SS_NOP | SSQ_PRINT_SENSE, "Data channel impending failure channel parametrics") }, /* D B */ - { SST(0x5D, 0x38, SS_RDEF, /* XXX TBD */ + { SST(0x5D, 0x38, SS_NOP | SSQ_PRINT_SENSE, "Data channel impending failure controller detected") }, /* D B */ - { SST(0x5D, 0x39, SS_RDEF, /* XXX TBD */ + { SST(0x5D, 0x39, SS_NOP | SSQ_PRINT_SENSE, "Data channel impending failure throughput performance") }, /* D B */ - { SST(0x5D, 0x3A, SS_RDEF, /* XXX TBD */ + { SST(0x5D, 0x3A, SS_NOP | SSQ_PRINT_SENSE, "Data channel impending failure seek time performance") }, /* D B */ - { SST(0x5D, 0x3B, SS_RDEF, /* XXX TBD */ + { SST(0x5D, 0x3B, SS_NOP | SSQ_PRINT_SENSE, "Data channel impending failure spin-up retry count") }, /* D B */ - { SST(0x5D, 0x3C, SS_RDEF, /* XXX TBD */ + { SST(0x5D, 0x3C, SS_NOP | SSQ_PRINT_SENSE, "Data channel impending failure drive calibration retry count") }, /* D B */ - { SST(0x5D, 0x40, SS_RDEF, /* XXX TBD */ + { SST(0x5D, 0x40, SS_NOP | SSQ_PRINT_SENSE, "Servo impending failure general hard drive failure") }, /* D B */ - { SST(0x5D, 0x41, SS_RDEF, /* XXX TBD */ + { SST(0x5D, 0x41, SS_NOP | SSQ_PRINT_SENSE, "Servo impending failure drive error rate too high") }, /* D B */ - { SST(0x5D, 0x42, SS_RDEF, /* XXX TBD */ + { SST(0x5D, 0x42, SS_NOP | SSQ_PRINT_SENSE, "Servo impending failure data error rate too high") }, /* D B */ - { SST(0x5D, 0x43, SS_RDEF, /* XXX TBD */ + { SST(0x5D, 0x43, SS_NOP | SSQ_PRINT_SENSE, "Servo impending failure seek error rate too high") }, /* D B */ - { SST(0x5D, 0x44, SS_RDEF, /* XXX TBD */ + { SST(0x5D, 0x44, SS_NOP | SSQ_PRINT_SENSE, "Servo impending failure too many block reassigns") }, /* D B */ - { SST(0x5D, 0x45, SS_RDEF, /* XXX TBD */ + { SST(0x5D, 0x45, SS_NOP | SSQ_PRINT_SENSE, "Servo impending failure access times too high") }, /* D B */ - { SST(0x5D, 0x46, SS_RDEF, /* XXX TBD */ + { SST(0x5D, 0x46, SS_NOP | SSQ_PRINT_SENSE, "Servo impending failure start unit times too high") }, /* D B */ - { SST(0x5D, 0x47, SS_RDEF, /* XXX TBD */ + { SST(0x5D, 0x47, SS_NOP | SSQ_PRINT_SENSE, "Servo impending failure channel parametrics") }, /* D B */ - { SST(0x5D, 0x48, SS_RDEF, /* XXX TBD */ + { SST(0x5D, 0x48, SS_NOP | SSQ_PRINT_SENSE, "Servo impending failure controller detected") }, /* D B */ - { SST(0x5D, 0x49, SS_RDEF, /* XXX TBD */ + { SST(0x5D, 0x49, SS_NOP | SSQ_PRINT_SENSE, "Servo impending failure throughput performance") }, /* D B */ - { SST(0x5D, 0x4A, SS_RDEF, /* XXX TBD */ + { SST(0x5D, 0x4A, SS_NOP | SSQ_PRINT_SENSE, "Servo impending failure seek time performance") }, /* D B */ - { SST(0x5D, 0x4B, SS_RDEF, /* XXX TBD */ + { SST(0x5D, 0x4B, SS_NOP | SSQ_PRINT_SENSE, "Servo impending failure spin-up retry count") }, /* D B */ - { SST(0x5D, 0x4C, SS_RDEF, /* XXX TBD */ + { SST(0x5D, 0x4C, SS_NOP | SSQ_PRINT_SENSE, "Servo impending failure drive calibration retry count") }, /* D B */ - { SST(0x5D, 0x50, SS_RDEF, /* XXX TBD */ + { SST(0x5D, 0x50, SS_NOP | SSQ_PRINT_SENSE, "Spindle impending failure general hard drive failure") }, /* D B */ - { SST(0x5D, 0x51, SS_RDEF, /* XXX TBD */ + { SST(0x5D, 0x51, SS_NOP | SSQ_PRINT_SENSE, "Spindle impending failure drive error rate too high") }, /* D B */ - { SST(0x5D, 0x52, SS_RDEF, /* XXX TBD */ + { SST(0x5D, 0x52, SS_NOP | SSQ_PRINT_SENSE, "Spindle impending failure data error rate too high") }, /* D B */ - { SST(0x5D, 0x53, SS_RDEF, /* XXX TBD */ + { SST(0x5D, 0x53, SS_NOP | SSQ_PRINT_SENSE, "Spindle impending failure seek error rate too high") }, /* D B */ - { SST(0x5D, 0x54, SS_RDEF, /* XXX TBD */ + { SST(0x5D, 0x54, SS_NOP | SSQ_PRINT_SENSE, "Spindle impending failure too many block reassigns") }, /* D B */ - { SST(0x5D, 0x55, SS_RDEF, /* XXX TBD */ + { SST(0x5D, 0x55, SS_NOP | SSQ_PRINT_SENSE, "Spindle impending failure access times too high") }, /* D B */ - { SST(0x5D, 0x56, SS_RDEF, /* XXX TBD */ + { SST(0x5D, 0x56, SS_NOP | SSQ_PRINT_SENSE, "Spindle impending failure start unit times too high") }, /* D B */ - { SST(0x5D, 0x57, SS_RDEF, /* XXX TBD */ + { SST(0x5D, 0x57, SS_NOP | SSQ_PRINT_SENSE, "Spindle impending failure channel parametrics") }, /* D B */ - { SST(0x5D, 0x58, SS_RDEF, /* XXX TBD */ + { SST(0x5D, 0x58, SS_NOP | SSQ_PRINT_SENSE, "Spindle impending failure controller detected") }, /* D B */ - { SST(0x5D, 0x59, SS_RDEF, /* XXX TBD */ + { SST(0x5D, 0x59, SS_NOP | SSQ_PRINT_SENSE, "Spindle impending failure throughput performance") }, /* D B */ - { SST(0x5D, 0x5A, SS_RDEF, /* XXX TBD */ + { SST(0x5D, 0x5A, SS_NOP | SSQ_PRINT_SENSE, "Spindle impending failure seek time performance") }, /* D B */ - { SST(0x5D, 0x5B, SS_RDEF, /* XXX TBD */ + { SST(0x5D, 0x5B, SS_NOP | SSQ_PRINT_SENSE, "Spindle impending failure spin-up retry count") }, /* D B */ - { SST(0x5D, 0x5C, SS_RDEF, /* XXX TBD */ + { SST(0x5D, 0x5C, SS_NOP | SSQ_PRINT_SENSE, "Spindle impending failure drive calibration retry count") }, /* D B */ - { SST(0x5D, 0x60, SS_RDEF, /* XXX TBD */ + { SST(0x5D, 0x60, SS_NOP | SSQ_PRINT_SENSE, "Firmware impending failure general hard drive failure") }, /* D B */ - { SST(0x5D, 0x61, SS_RDEF, /* XXX TBD */ + { SST(0x5D, 0x61, SS_NOP | SSQ_PRINT_SENSE, "Firmware impending failure drive error rate too high") }, /* D B */ - { SST(0x5D, 0x62, SS_RDEF, /* XXX TBD */ + { SST(0x5D, 0x62, SS_NOP | SSQ_PRINT_SENSE, "Firmware impending failure data error rate too high") }, /* D B */ - { SST(0x5D, 0x63, SS_RDEF, /* XXX TBD */ + { SST(0x5D, 0x63, SS_NOP | SSQ_PRINT_SENSE, "Firmware impending failure seek error rate too high") }, /* D B */ - { SST(0x5D, 0x64, SS_RDEF, /* XXX TBD */ + { SST(0x5D, 0x64, SS_NOP | SSQ_PRINT_SENSE, "Firmware impending failure too many block reassigns") }, /* D B */ - { SST(0x5D, 0x65, SS_RDEF, /* XXX TBD */ + { SST(0x5D, 0x65, SS_NOP | SSQ_PRINT_SENSE, "Firmware impending failure access times too high") }, /* D B */ - { SST(0x5D, 0x66, SS_RDEF, /* XXX TBD */ + { SST(0x5D, 0x66, SS_NOP | SSQ_PRINT_SENSE, "Firmware impending failure start unit times too high") }, /* D B */ - { SST(0x5D, 0x67, SS_RDEF, /* XXX TBD */ + { SST(0x5D, 0x67, SS_NOP | SSQ_PRINT_SENSE, "Firmware impending failure channel parametrics") }, /* D B */ - { SST(0x5D, 0x68, SS_RDEF, /* XXX TBD */ + { SST(0x5D, 0x68, SS_NOP | SSQ_PRINT_SENSE, "Firmware impending failure controller detected") }, /* D B */ - { SST(0x5D, 0x69, SS_RDEF, /* XXX TBD */ + { SST(0x5D, 0x69, SS_NOP | SSQ_PRINT_SENSE, "Firmware impending failure throughput performance") }, /* D B */ - { SST(0x5D, 0x6A, SS_RDEF, /* XXX TBD */ + { SST(0x5D, 0x6A, SS_NOP | SSQ_PRINT_SENSE, "Firmware impending failure seek time performance") }, /* D B */ - { SST(0x5D, 0x6B, SS_RDEF, /* XXX TBD */ + { SST(0x5D, 0x6B, SS_NOP | SSQ_PRINT_SENSE, "Firmware impending failure spin-up retry count") }, /* D B */ - { SST(0x5D, 0x6C, SS_RDEF, /* XXX TBD */ + { SST(0x5D, 0x6C, SS_NOP | SSQ_PRINT_SENSE, "Firmware impending failure drive calibration retry count") }, + /* D B */ + { SST(0x5D, 0x73, SS_NOP | SSQ_PRINT_SENSE, + "Media impending failure endurance limit met") }, /* DTLPWROMAEBKVF */ - { SST(0x5D, 0xFF, SS_RDEF, + { SST(0x5D, 0xFF, SS_NOP | SSQ_PRINT_SENSE, "Failure prediction threshold exceeded (false)") }, /* DTLPWRO A K */ { SST(0x5E, 0x00, SS_RDEF, From owner-svn-src-all@freebsd.org Sun Dec 18 15:10:09 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D8BB1C87E99; Sun, 18 Dec 2016 15:10:09 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A1F27171D; Sun, 18 Dec 2016 15:10:09 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBIFA8H1024036; Sun, 18 Dec 2016 15:10:08 GMT (envelope-from jilles@FreeBSD.org) Received: (from jilles@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBIFA8HA024035; Sun, 18 Dec 2016 15:10:08 GMT (envelope-from jilles@FreeBSD.org) Message-Id: <201612181510.uBIFA8HA024035@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jilles set sender to jilles@FreeBSD.org using -f From: Jilles Tjoelker Date: Sun, 18 Dec 2016 15:10:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r310231 - stable/11/tests/sys/kern X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Dec 2016 15:10:10 -0000 Author: jilles Date: Sun Dec 18 15:10:08 2016 New Revision: 310231 URL: https://svnweb.freebsd.org/changeset/base/310231 Log: MFC r309836: Add some tests for reaper functionality (in procctl()). Added: stable/11/tests/sys/kern/reaper.c - copied unchanged from r309836, head/tests/sys/kern/reaper.c Modified: stable/11/tests/sys/kern/Makefile Directory Properties: stable/11/ (props changed) Modified: stable/11/tests/sys/kern/Makefile ============================================================================== --- stable/11/tests/sys/kern/Makefile Sun Dec 18 15:02:50 2016 (r310230) +++ stable/11/tests/sys/kern/Makefile Sun Dec 18 15:10:08 2016 (r310231) @@ -8,6 +8,7 @@ TESTSDIR= ${TESTSBASE}/sys/kern ATF_TESTS_C+= kern_copyin ATF_TESTS_C+= kern_descrip_test ATF_TESTS_C+= ptrace_test +ATF_TESTS_C+= reaper PLAIN_TESTS_C+= subr_unit_test ATF_TESTS_C+= unix_seqpacket_test ATF_TESTS_C+= unix_passfd_test Copied: stable/11/tests/sys/kern/reaper.c (from r309836, head/tests/sys/kern/reaper.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/11/tests/sys/kern/reaper.c Sun Dec 18 15:10:08 2016 (r310231, copy of r309836, head/tests/sys/kern/reaper.c) @@ -0,0 +1,494 @@ +/*- + * Copyright (c) 2016 Jilles Tjoelker + * 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. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include + +#include +#include +#include +#include + +ATF_TC_WITHOUT_HEAD(reaper_wait_child_first); +ATF_TC_BODY(reaper_wait_child_first, tc) +{ + pid_t parent, child, grandchild, pid; + int status, r; + int pip[2]; + + /* Be paranoid. */ + pid = waitpid(-1, NULL, WNOHANG); + ATF_REQUIRE(pid == -1 && errno == ECHILD); + + parent = getpid(); + r = procctl(P_PID, parent, PROC_REAP_ACQUIRE, NULL); + ATF_REQUIRE_EQ(0, r); + + r = pipe(pip); + ATF_REQUIRE_EQ(0, r); + + child = fork(); + ATF_REQUIRE(child != -1); + if (child == 0) { + if (close(pip[1]) != 0) + _exit(100); + grandchild = fork(); + if (grandchild == -1) + _exit(101); + else if (grandchild == 0) { + if (read(pip[0], &(uint8_t){ 0 }, 1) != 0) + _exit(102); + if (getppid() != parent) + _exit(103); + _exit(2); + } else + _exit(3); + } + + pid = waitpid(child, &status, 0); + ATF_REQUIRE_EQ(child, pid); + r = WIFEXITED(status) ? WEXITSTATUS(status) : -1; + ATF_CHECK_EQ(3, r); + + r = close(pip[1]); + ATF_REQUIRE_EQ(0, r); + + pid = waitpid(-1, &status, 0); + ATF_REQUIRE(pid > 0 && pid != child); + r = WIFEXITED(status) ? WEXITSTATUS(status) : -1; + ATF_CHECK_EQ(2, r); + + r = close(pip[0]); + ATF_REQUIRE_EQ(0, r); +} + +ATF_TC_WITHOUT_HEAD(reaper_wait_grandchild_first); +ATF_TC_BODY(reaper_wait_grandchild_first, tc) +{ + pid_t parent, child, grandchild, pid; + int status, r; + + /* Be paranoid. */ + pid = waitpid(-1, NULL, WNOHANG); + ATF_REQUIRE(pid == -1 && errno == ECHILD); + + parent = getpid(); + r = procctl(P_PID, parent, PROC_REAP_ACQUIRE, NULL); + ATF_REQUIRE_EQ(0, r); + + child = fork(); + ATF_REQUIRE(child != -1); + if (child == 0) { + grandchild = fork(); + if (grandchild == -1) + _exit(101); + else if (grandchild == 0) + _exit(2); + else { + if (waitid(P_PID, grandchild, NULL, + WNOWAIT | WEXITED) != 0) + _exit(102); + _exit(3); + } + } + + pid = waitpid(child, &status, 0); + ATF_REQUIRE_EQ(child, pid); + r = WIFEXITED(status) ? WEXITSTATUS(status) : -1; + ATF_CHECK_EQ(3, r); + + pid = waitpid(-1, &status, 0); + ATF_REQUIRE(pid > 0 && pid != child); + r = WIFEXITED(status) ? WEXITSTATUS(status) : -1; + ATF_CHECK_EQ(2, r); +} + +ATF_TC_WITHOUT_HEAD(reaper_status); +ATF_TC_BODY(reaper_status, tc) +{ + struct procctl_reaper_status st; + ssize_t sr; + pid_t parent, child, pid; + int r, status; + int pip[2]; + + parent = getpid(); + r = procctl(P_PID, parent, PROC_REAP_STATUS, &st); + ATF_REQUIRE_EQ(0, r); + ATF_CHECK_EQ(0, st.rs_flags & REAPER_STATUS_OWNED); + ATF_CHECK(st.rs_children > 0); + ATF_CHECK(st.rs_descendants > 0); + ATF_CHECK(st.rs_descendants >= st.rs_children); + ATF_CHECK(st.rs_reaper != parent); + ATF_CHECK(st.rs_reaper > 0); + + r = procctl(P_PID, parent, PROC_REAP_ACQUIRE, NULL); + ATF_REQUIRE_EQ(0, r); + + r = procctl(P_PID, parent, PROC_REAP_STATUS, &st); + ATF_REQUIRE_EQ(0, r); + ATF_CHECK_EQ(REAPER_STATUS_OWNED, + st.rs_flags & (REAPER_STATUS_OWNED | REAPER_STATUS_REALINIT)); + ATF_CHECK_EQ(0, st.rs_children); + ATF_CHECK_EQ(0, st.rs_descendants); + ATF_CHECK(st.rs_reaper == parent); + ATF_CHECK_EQ(-1, st.rs_pid); + + r = pipe(pip); + ATF_REQUIRE_EQ(0, r); + child = fork(); + ATF_REQUIRE(child != -1); + if (child == 0) { + if (close(pip[0]) != 0) + _exit(100); + if (procctl(P_PID, parent, PROC_REAP_STATUS, &st) != 0) + _exit(101); + if (write(pip[1], &st, sizeof(st)) != (ssize_t)sizeof(st)) + _exit(102); + if (procctl(P_PID, getpid(), PROC_REAP_STATUS, &st) != 0) + _exit(103); + if (write(pip[1], &st, sizeof(st)) != (ssize_t)sizeof(st)) + _exit(104); + _exit(0); + } + r = close(pip[1]); + ATF_REQUIRE_EQ(0, r); + + sr = read(pip[0], &st, sizeof(st)); + ATF_REQUIRE_EQ((ssize_t)sizeof(st), sr); + ATF_CHECK_EQ(REAPER_STATUS_OWNED, + st.rs_flags & (REAPER_STATUS_OWNED | REAPER_STATUS_REALINIT)); + ATF_CHECK_EQ(1, st.rs_children); + ATF_CHECK_EQ(1, st.rs_descendants); + ATF_CHECK(st.rs_reaper == parent); + ATF_CHECK_EQ(child, st.rs_pid); + sr = read(pip[0], &st, sizeof(st)); + ATF_REQUIRE_EQ((ssize_t)sizeof(st), sr); + ATF_CHECK_EQ(0, + st.rs_flags & (REAPER_STATUS_OWNED | REAPER_STATUS_REALINIT)); + ATF_CHECK_EQ(1, st.rs_children); + ATF_CHECK_EQ(1, st.rs_descendants); + ATF_CHECK(st.rs_reaper == parent); + ATF_CHECK_EQ(child, st.rs_pid); + + r = close(pip[0]); + ATF_REQUIRE_EQ(0, r); + pid = waitpid(child, &status, 0); + ATF_REQUIRE_EQ(child, pid); + ATF_CHECK_EQ(0, status); + + r = procctl(P_PID, parent, PROC_REAP_STATUS, &st); + ATF_REQUIRE_EQ(0, r); + ATF_CHECK_EQ(REAPER_STATUS_OWNED, + st.rs_flags & (REAPER_STATUS_OWNED | REAPER_STATUS_REALINIT)); + ATF_CHECK_EQ(0, st.rs_children); + ATF_CHECK_EQ(0, st.rs_descendants); + ATF_CHECK(st.rs_reaper == parent); + ATF_CHECK_EQ(-1, st.rs_pid); +} + +ATF_TC_WITHOUT_HEAD(reaper_getpids); +ATF_TC_BODY(reaper_getpids, tc) +{ + struct procctl_reaper_pidinfo info[10]; + ssize_t sr; + pid_t parent, child, grandchild, pid; + int r, status, childidx; + int pipa[2], pipb[2]; + + parent = getpid(); + r = procctl(P_PID, parent, PROC_REAP_ACQUIRE, NULL); + ATF_REQUIRE_EQ(0, r); + + memset(info, '\0', sizeof(info)); + r = procctl(P_PID, parent, PROC_REAP_GETPIDS, + &(struct procctl_reaper_pids){ + .rp_count = sizeof(info) / sizeof(info[0]), + .rp_pids = info + }); + ATF_CHECK_EQ(0, r); + ATF_CHECK_EQ(0, info[0].pi_flags & REAPER_PIDINFO_VALID); + + r = pipe(pipa); + ATF_REQUIRE_EQ(0, r); + r = pipe(pipb); + ATF_REQUIRE_EQ(0, r); + child = fork(); + ATF_REQUIRE(child != -1); + if (child == 0) { + if (close(pipa[1]) != 0) + _exit(100); + if (close(pipb[0]) != 0) + _exit(100); + if (read(pipa[0], &(uint8_t){ 0 }, 1) != 1) + _exit(101); + grandchild = fork(); + if (grandchild == -1) + _exit(102); + if (grandchild == 0) { + if (write(pipb[1], &(uint8_t){ 0 }, 1) != 1) + _exit(103); + if (read(pipa[0], &(uint8_t){ 0 }, 1) != 1) + _exit(104); + _exit(0); + } + for (;;) + pause(); + } + r = close(pipa[0]); + ATF_REQUIRE_EQ(0, r); + r = close(pipb[1]); + ATF_REQUIRE_EQ(0, r); + + memset(info, '\0', sizeof(info)); + r = procctl(P_PID, parent, PROC_REAP_GETPIDS, + &(struct procctl_reaper_pids){ + .rp_count = sizeof(info) / sizeof(info[0]), + .rp_pids = info + }); + ATF_CHECK_EQ(0, r); + ATF_CHECK_EQ(REAPER_PIDINFO_VALID | REAPER_PIDINFO_CHILD, + info[0].pi_flags & (REAPER_PIDINFO_VALID | REAPER_PIDINFO_CHILD)); + ATF_CHECK_EQ(child, info[0].pi_pid); + ATF_CHECK_EQ(child, info[0].pi_subtree); + ATF_CHECK_EQ(0, info[1].pi_flags & REAPER_PIDINFO_VALID); + + sr = write(pipa[1], &(uint8_t){ 0 }, 1); + ATF_REQUIRE_EQ(1, sr); + sr = read(pipb[0], &(uint8_t){ 0 }, 1); + ATF_REQUIRE_EQ(1, sr); + + memset(info, '\0', sizeof(info)); + r = procctl(P_PID, parent, PROC_REAP_GETPIDS, + &(struct procctl_reaper_pids){ + .rp_count = sizeof(info) / sizeof(info[0]), + .rp_pids = info + }); + ATF_CHECK_EQ(0, r); + ATF_CHECK_EQ(REAPER_PIDINFO_VALID, + info[0].pi_flags & REAPER_PIDINFO_VALID); + ATF_CHECK_EQ(REAPER_PIDINFO_VALID, + info[1].pi_flags & REAPER_PIDINFO_VALID); + ATF_CHECK_EQ(0, info[2].pi_flags & REAPER_PIDINFO_VALID); + ATF_CHECK_EQ(child, info[0].pi_subtree); + ATF_CHECK_EQ(child, info[1].pi_subtree); + childidx = info[1].pi_pid == child ? 1 : 0; + ATF_CHECK_EQ(REAPER_PIDINFO_CHILD, + info[childidx].pi_flags & REAPER_PIDINFO_CHILD); + ATF_CHECK_EQ(0, info[childidx ^ 1].pi_flags & REAPER_PIDINFO_CHILD); + ATF_CHECK(info[childidx].pi_pid == child); + grandchild = info[childidx ^ 1].pi_pid; + ATF_CHECK(grandchild > 0); + ATF_CHECK(grandchild != child); + ATF_CHECK(grandchild != parent); + + r = kill(child, SIGTERM); + ATF_REQUIRE_EQ(0, r); + + pid = waitpid(child, &status, 0); + ATF_REQUIRE_EQ(child, pid); + ATF_CHECK(WIFSIGNALED(status) && WTERMSIG(status) == SIGTERM); + + memset(info, '\0', sizeof(info)); + r = procctl(P_PID, parent, PROC_REAP_GETPIDS, + &(struct procctl_reaper_pids){ + .rp_count = sizeof(info) / sizeof(info[0]), + .rp_pids = info + }); + ATF_CHECK_EQ(0, r); + ATF_CHECK_EQ(REAPER_PIDINFO_VALID, + info[0].pi_flags & REAPER_PIDINFO_VALID); + ATF_CHECK_EQ(0, info[1].pi_flags & REAPER_PIDINFO_VALID); + ATF_CHECK_EQ(child, info[0].pi_subtree); + ATF_CHECK_EQ(REAPER_PIDINFO_CHILD, + info[0].pi_flags & REAPER_PIDINFO_CHILD); + ATF_CHECK_EQ(grandchild, info[0].pi_pid); + + sr = write(pipa[1], &(uint8_t){ 0 }, 1); + ATF_REQUIRE_EQ(1, sr); + + memset(info, '\0', sizeof(info)); + r = procctl(P_PID, parent, PROC_REAP_GETPIDS, + &(struct procctl_reaper_pids){ + .rp_count = sizeof(info) / sizeof(info[0]), + .rp_pids = info + }); + ATF_CHECK_EQ(0, r); + ATF_CHECK_EQ(REAPER_PIDINFO_VALID, + info[0].pi_flags & REAPER_PIDINFO_VALID); + ATF_CHECK_EQ(0, info[1].pi_flags & REAPER_PIDINFO_VALID); + ATF_CHECK_EQ(child, info[0].pi_subtree); + ATF_CHECK_EQ(REAPER_PIDINFO_CHILD, + info[0].pi_flags & REAPER_PIDINFO_CHILD); + ATF_CHECK_EQ(grandchild, info[0].pi_pid); + + pid = waitpid(grandchild, &status, 0); + ATF_REQUIRE_EQ(grandchild, pid); + ATF_CHECK_EQ(0, status); + + memset(info, '\0', sizeof(info)); + r = procctl(P_PID, parent, PROC_REAP_GETPIDS, + &(struct procctl_reaper_pids){ + .rp_count = sizeof(info) / sizeof(info[0]), + .rp_pids = info + }); + ATF_CHECK_EQ(0, r); + ATF_CHECK_EQ(0, info[0].pi_flags & REAPER_PIDINFO_VALID); + + r = close(pipa[1]); + ATF_REQUIRE_EQ(0, r); + r = close(pipb[0]); + ATF_REQUIRE_EQ(0, r); +} + +ATF_TC_WITHOUT_HEAD(reaper_kill_badsig); +ATF_TC_BODY(reaper_kill_badsig, tc) +{ + struct procctl_reaper_kill params; + pid_t parent; + int r; + + parent = getpid(); + r = procctl(P_PID, parent, PROC_REAP_ACQUIRE, NULL); + ATF_REQUIRE_EQ(0, r); + + params.rk_sig = -1; + params.rk_flags = 0; + r = procctl(P_PID, parent, PROC_REAP_KILL, ¶ms); + ATF_CHECK(r == -1 && errno == EINVAL); +} + +ATF_TC_WITHOUT_HEAD(reaper_kill_sigzero); +ATF_TC_BODY(reaper_kill_sigzero, tc) +{ + struct procctl_reaper_kill params; + pid_t parent; + int r; + + parent = getpid(); + r = procctl(P_PID, parent, PROC_REAP_ACQUIRE, NULL); + ATF_REQUIRE_EQ(0, r); + + params.rk_sig = 0; + params.rk_flags = 0; + r = procctl(P_PID, parent, PROC_REAP_KILL, ¶ms); + ATF_CHECK(r == -1 && errno == EINVAL); +} + +ATF_TC_WITHOUT_HEAD(reaper_kill_empty); +ATF_TC_BODY(reaper_kill_empty, tc) +{ + struct procctl_reaper_kill params; + pid_t parent; + int r; + + parent = getpid(); + r = procctl(P_PID, parent, PROC_REAP_ACQUIRE, NULL); + ATF_REQUIRE_EQ(0, r); + + params.rk_sig = SIGTERM; + params.rk_flags = 0; + params.rk_killed = 77; + r = procctl(P_PID, parent, PROC_REAP_KILL, ¶ms); + ATF_CHECK(r == -1 && errno == ESRCH); + ATF_CHECK_EQ(0, params.rk_killed); +} + +ATF_TC_WITHOUT_HEAD(reaper_kill_normal); +ATF_TC_BODY(reaper_kill_normal, tc) +{ + struct procctl_reaper_kill params; + ssize_t sr; + pid_t parent, child, grandchild, pid; + int r, status; + int pip[2]; + + parent = getpid(); + r = procctl(P_PID, parent, PROC_REAP_ACQUIRE, NULL); + ATF_REQUIRE_EQ(0, r); + + r = pipe(pip); + ATF_REQUIRE_EQ(0, r); + child = fork(); + ATF_REQUIRE(child != -1); + if (child == 0) { + if (close(pip[0]) != 0) + _exit(100); + grandchild = fork(); + if (grandchild == -1) + _exit(101); + if (grandchild == 0) { + if (write(pip[1], &(uint8_t){ 0 }, 1) != 1) + _exit(102); + for (;;) + pause(); + } + for (;;) + pause(); + } + r = close(pip[1]); + ATF_REQUIRE_EQ(0, r); + + sr = read(pip[0], &(uint8_t){ 0 }, 1); + ATF_REQUIRE_EQ(1, sr); + + params.rk_sig = SIGTERM; + params.rk_flags = 0; + params.rk_killed = 77; + r = procctl(P_PID, parent, PROC_REAP_KILL, ¶ms); + ATF_CHECK_EQ(0, r); + ATF_CHECK_EQ(2, params.rk_killed); + + pid = waitpid(child, &status, 0); + ATF_REQUIRE_EQ(child, pid); + ATF_CHECK(WIFSIGNALED(status) && WTERMSIG(status) == SIGTERM); + + pid = waitpid(-1, &status, 0); + ATF_REQUIRE(pid > 0); + ATF_CHECK(pid != parent); + ATF_CHECK(pid != child); + ATF_CHECK(WIFSIGNALED(status) && WTERMSIG(status) == SIGTERM); + + r = close(pip[0]); + ATF_REQUIRE_EQ(0, r); +} + +ATF_TP_ADD_TCS(tp) +{ + + ATF_TP_ADD_TC(tp, reaper_wait_child_first); + ATF_TP_ADD_TC(tp, reaper_wait_grandchild_first); + ATF_TP_ADD_TC(tp, reaper_status); + ATF_TP_ADD_TC(tp, reaper_getpids); + ATF_TP_ADD_TC(tp, reaper_kill_badsig); + ATF_TP_ADD_TC(tp, reaper_kill_sigzero); + ATF_TP_ADD_TC(tp, reaper_kill_empty); + ATF_TP_ADD_TC(tp, reaper_kill_normal); + return (atf_no_error()); +} From owner-svn-src-all@freebsd.org Sun Dec 18 15:21:39 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9E2DDC865DC; Sun, 18 Dec 2016 15:21:39 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 6AFF137F; Sun, 18 Dec 2016 15:21:39 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBIFLc0k030384; Sun, 18 Dec 2016 15:21:38 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBIFLcB3030383; Sun, 18 Dec 2016 15:21:38 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201612181521.uBIFLcB3030383@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Sun, 18 Dec 2016 15:21:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310232 - head/sys/dev/mlx4/mlx4_ib X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Dec 2016 15:21:39 -0000 Author: dim Date: Sun Dec 18 15:21:38 2016 New Revision: 310232 URL: https://svnweb.freebsd.org/changeset/base/310232 Log: After r310171, the kernel version of sscanf() has format string checking enabled. This results in a -Werror warning in mlx4ib: sys/dev/mlx4/mlx4_ib/mlx4_ib_sysfs.c:90:22: error: format specifies type 'unsigned long long *' but the argument has type 'u64 *' (aka 'unsigned long *') [-Werror,-Wformat] sscanf(buf, "%llx", &sysadmin_ag_val); ~~~~ ^~~~~~~~~~~~~~~~ Change sysadmin_ag_val to unsigned long long to avoid the warning. Reviewed by: hselasky MFC after: 3 days Differential Revision: https://reviews.freebsd.org/D8831 Modified: head/sys/dev/mlx4/mlx4_ib/mlx4_ib_sysfs.c Modified: head/sys/dev/mlx4/mlx4_ib/mlx4_ib_sysfs.c ============================================================================== --- head/sys/dev/mlx4/mlx4_ib/mlx4_ib_sysfs.c Sun Dec 18 15:10:08 2016 (r310231) +++ head/sys/dev/mlx4/mlx4_ib/mlx4_ib_sysfs.c Sun Dec 18 15:21:38 2016 (r310232) @@ -79,7 +79,7 @@ static ssize_t store_admin_alias_guid(st container_of(attr, struct mlx4_ib_iov_sysfs_attr, dentry); struct mlx4_ib_iov_port *port = mlx4_ib_iov_dentry->ctx; struct mlx4_ib_dev *mdev = port->dev; - u64 sysadmin_ag_val; + unsigned long long sysadmin_ag_val; record_num = mlx4_ib_iov_dentry->entry_num / 8; guid_index_in_rec = mlx4_ib_iov_dentry->entry_num % 8; From owner-svn-src-all@freebsd.org Sun Dec 18 16:37:58 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 52E9AC875AA for ; Sun, 18 Dec 2016 16:37:58 +0000 (UTC) (envelope-from ed@nuxi.nl) Received: from mail-yb0-x236.google.com (mail-yb0-x236.google.com [IPv6:2607:f8b0:4002:c09::236]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 1CCAA1475 for ; Sun, 18 Dec 2016 16:37:57 +0000 (UTC) (envelope-from ed@nuxi.nl) Received: by mail-yb0-x236.google.com with SMTP id d128so51636802ybh.2 for ; Sun, 18 Dec 2016 08:37:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nuxi-nl.20150623.gappssmtp.com; s=20150623; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=V9VPVfZ2/rS2BlPLwsEc2Kj12IW23+dGaopDD6ExIJU=; b=DfzHuFIj5hOE/Xpcd1O/oeRFEB2KuwHWzf7tJ8BOukxYzWF1n785kVDxaO2denZxEA 2C3K/6M1UjbPvV9N3n4mUoD/fOQz9cawuNrXoBYPnv5tNsyQHBsicUSn+g8xqcwmRPeo 9dZTLeBEibccE3n7cScDkZzNGZmcQh6ZRJO+yb03Nbqf/4AyJD1+EG5nYerqkAbJAz7i c7Shcu08GMw254twkXaQ9ME/9dkZImnEnFRP61WBDbTGfhnYDWMMgIzpADOHuE/Ei2M4 gdzd6uC713EXk70thYTvdvDOuGixtJ1FDg38GucD7yxkXi1vunTHEjvbNFjVe4cC22r1 EQBg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=V9VPVfZ2/rS2BlPLwsEc2Kj12IW23+dGaopDD6ExIJU=; b=LQXRU8sL7MA0GQKiSYFCjlo9GrPlhD+BoitUqASleZhxmfa+qbyZAejiciEa8EGT8g QxjDtv0LDHiZ+XOqZcygaVgsF272u8CySgoQ/fGiCjbizeV39zVx5rFfHP9YB4YbVqiB SPjrlXHWmCuaAQQyjyTEwpwBCz8xxmh+Iu/DOV7mQJ4c4PKhshHqBU5Xs6zsZwGmRSc9 Q0KiEigW9lFjcAz6xvqed9VyTsVRrMMXganGtH8A7sisfmAqdF1gl9Njm8gpbcLnw3/Q YenJ3op0fA/omkuoydCg1g0OLiYr8rk4/zZHqz00BP8nR/Rv68TeZae2/5uHwNPzTGg5 QRdw== X-Gm-Message-State: AIkVDXJTIwvvyqjW+t8iBw5gq9zqTjGcSl2UrUp7dPmF0OYQP7PReSG63kqMu0WNc4LM+6tsJmR14ZaTvdvPAg== X-Received: by 10.37.163.33 with SMTP id d30mr2300ybi.54.1482079077048; Sun, 18 Dec 2016 08:37:57 -0800 (PST) MIME-Version: 1.0 Received: by 10.129.2.139 with HTTP; Sun, 18 Dec 2016 08:37:26 -0800 (PST) In-Reply-To: <201612181521.uBIFLcB3030383@repo.freebsd.org> References: <201612181521.uBIFLcB3030383@repo.freebsd.org> From: Ed Schouten Date: Sun, 18 Dec 2016 17:37:26 +0100 Message-ID: Subject: Re: svn commit: r310232 - head/sys/dev/mlx4/mlx4_ib To: Dimitry Andric Cc: src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset=UTF-8 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Dec 2016 16:37:58 -0000 2016-12-18 16:21 GMT+01:00 Dimitry Andric : > Modified: head/sys/dev/mlx4/mlx4_ib/mlx4_ib_sysfs.c > ============================================================================== > --- head/sys/dev/mlx4/mlx4_ib/mlx4_ib_sysfs.c Sun Dec 18 15:10:08 2016 (r310231) > +++ head/sys/dev/mlx4/mlx4_ib/mlx4_ib_sysfs.c Sun Dec 18 15:21:38 2016 (r310232) > @@ -79,7 +79,7 @@ static ssize_t store_admin_alias_guid(st > container_of(attr, struct mlx4_ib_iov_sysfs_attr, dentry); > struct mlx4_ib_iov_port *port = mlx4_ib_iov_dentry->ctx; > struct mlx4_ib_dev *mdev = port->dev; > - u64 sysadmin_ag_val; > + unsigned long long sysadmin_ag_val; > > record_num = mlx4_ib_iov_dentry->entry_num / 8; > guid_index_in_rec = mlx4_ib_iov_dentry->entry_num % 8; Looking at the code, the intent is that an actual 64-bit integer is parsed; not an unsigned long long. What's wrong with using inttypes.h's SCNx64? -- Ed Schouten Nuxi, 's-Hertogenbosch, the Netherlands KvK-nr.: 62051717 From owner-svn-src-all@freebsd.org Sun Dec 18 16:49:22 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id F1FE1C87952; Sun, 18 Dec 2016 16:49:22 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from tensor.andric.com (tensor.andric.com [IPv6:2001:7b8:3a7:1:2d0:b7ff:fea0:8c26]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "tensor.andric.com", Issuer "COMODO RSA Domain Validation Secure Server CA" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id BA439910; Sun, 18 Dec 2016 16:49:22 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from [IPv6:2001:7b8:3a7::584d:b4f3:ff81:8b6c] (unknown [IPv6:2001:7b8:3a7:0:584d:b4f3:ff81:8b6c]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by tensor.andric.com (Postfix) with ESMTPSA id A97D53F4D3; Sun, 18 Dec 2016 17:49:19 +0100 (CET) Content-Type: multipart/signed; boundary="Apple-Mail=_9BFE0C23-B76B-4587-880F-2EE1087660E7"; protocol="application/pgp-signature"; micalg=pgp-sha1 Mime-Version: 1.0 (Mac OS X Mail 9.3 \(3124\)) Subject: Re: svn commit: r310232 - head/sys/dev/mlx4/mlx4_ib From: Dimitry Andric In-Reply-To: Date: Sun, 18 Dec 2016 17:49:07 +0100 Cc: src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Message-Id: References: <201612181521.uBIFLcB3030383@repo.freebsd.org> To: Ed Schouten X-Mailer: Apple Mail (2.3124) X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Dec 2016 16:49:23 -0000 --Apple-Mail=_9BFE0C23-B76B-4587-880F-2EE1087660E7 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=us-ascii On 18 Dec 2016, at 17:37, Ed Schouten wrote: >=20 > 2016-12-18 16:21 GMT+01:00 Dimitry Andric : >> Modified: head/sys/dev/mlx4/mlx4_ib/mlx4_ib_sysfs.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 >> --- head/sys/dev/mlx4/mlx4_ib/mlx4_ib_sysfs.c Sun Dec 18 15:10:08 = 2016 (r310231) >> +++ head/sys/dev/mlx4/mlx4_ib/mlx4_ib_sysfs.c Sun Dec 18 15:21:38 = 2016 (r310232) >> @@ -79,7 +79,7 @@ static ssize_t store_admin_alias_guid(st >> container_of(attr, struct mlx4_ib_iov_sysfs_attr, = dentry); >> struct mlx4_ib_iov_port *port =3D mlx4_ib_iov_dentry->ctx; >> struct mlx4_ib_dev *mdev =3D port->dev; >> - u64 sysadmin_ag_val; >> + unsigned long long sysadmin_ag_val; >>=20 >> record_num =3D mlx4_ib_iov_dentry->entry_num / 8; >> guid_index_in_rec =3D mlx4_ib_iov_dentry->entry_num % 8; >=20 > Looking at the code, the intent is that an actual 64-bit integer is > parsed; not an unsigned long long. What's wrong with using > inttypes.h's SCNx64? That is how I originally submitted it in the review, though with , as it is most often used in kernel sources. However, see Hans's comment in the review here: https://reviews.freebsd.org/D8831#182872 I don't mind either way. -Dimitry --Apple-Mail=_9BFE0C23-B76B-4587-880F-2EE1087660E7 Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=signature.asc Content-Type: application/pgp-signature; name=signature.asc Content-Description: Message signed with OpenPGP using GPGMail -----BEGIN PGP SIGNATURE----- Version: GnuPG/MacGPG2 v2.0.30 iEYEARECAAYFAlhWvg8ACgkQsF6jCi4glqNdGACgqVHhTleeOATnuSWQbK+kIaE0 ti8AoJhwK0REdVCFsAEzsQ1v+GFsWJ5z =WPK8 -----END PGP SIGNATURE----- --Apple-Mail=_9BFE0C23-B76B-4587-880F-2EE1087660E7-- From owner-svn-src-all@freebsd.org Sun Dec 18 17:10:52 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D560DC874AB; Sun, 18 Dec 2016 17:10:52 +0000 (UTC) (envelope-from freebsd-rwg@pdx.rh.CN85.dnsmgr.net) Received: from pdx.rh.CN85.dnsmgr.net (br1.CN84in.dnsmgr.net [69.59.192.140]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A671010D5; Sun, 18 Dec 2016 17:10:52 +0000 (UTC) (envelope-from freebsd-rwg@pdx.rh.CN85.dnsmgr.net) Received: from pdx.rh.CN85.dnsmgr.net (localhost [127.0.0.1]) by pdx.rh.CN85.dnsmgr.net (8.13.3/8.13.3) with ESMTP id uBIHAjQj054061; Sun, 18 Dec 2016 09:10:45 -0800 (PST) (envelope-from freebsd-rwg@pdx.rh.CN85.dnsmgr.net) Received: (from freebsd-rwg@localhost) by pdx.rh.CN85.dnsmgr.net (8.13.3/8.13.3/Submit) id uBIHAjR2054060; Sun, 18 Dec 2016 09:10:45 -0800 (PST) (envelope-from freebsd-rwg) From: "Rodney W. Grimes" Message-Id: <201612181710.uBIHAjR2054060@pdx.rh.CN85.dnsmgr.net> Subject: Re: svn commit: r310217 - stable/11/sys/netinet In-Reply-To: <201612181256.uBICuEja070394@repo.freebsd.org> To: Michael Tuexen Date: Sun, 18 Dec 2016 09:10:45 -0800 (PST) CC: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org X-Mailer: ELM [version 2.4ME+ PL121h (25)] MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Dec 2016 17:10:52 -0000 > Author: tuexen > Date: Sun Dec 18 12:56:14 2016 > New Revision: 310217 > URL: https://svnweb.freebsd.org/changeset/base/310217 ... > > Log: > MFC r307779: > > No functional changes, mostly getting the whitespace changes resulting > from an updated formatting tool chain. I think there might be an issue with this tool, it is reformatting KNF multiline comment format to the wrong format, unless KNF has been changed at some recent point. ... > - /* > - * two from each > - * address > - */ ... > + /* two from each > + * address */ > - /* > - * link-local <-> link-local must belong to the same > - * scope. > - */ > + /* link-local <-> link-local must belong to the same > + * scope. */ > - /* > - * PMTU check versus smallest asoc MTU goes > - * here > - */ > + /* PMTU check versus smallest asoc MTU goes > + * here */ etc... -- Rod Grimes rgrimes@freebsd.org From owner-svn-src-all@freebsd.org Sun Dec 18 18:00:12 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A78E6C85A6C; Sun, 18 Dec 2016 18:00:12 +0000 (UTC) (envelope-from tuexen@freebsd.org) Received: from drew.franken.de (drew.ipv6.franken.de [IPv6:2001:638:a02:a001:20e:cff:fe4a:feaa]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "*.franken.de", Issuer "COMODO RSA Domain Validation Secure Server CA" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 6E3B2111E; Sun, 18 Dec 2016 18:00:12 +0000 (UTC) (envelope-from tuexen@freebsd.org) Received: from [192.168.1.102] (p508F1073.dip0.t-ipconnect.de [80.143.16.115]) (Authenticated sender: macmic) by mail-n.franken.de (Postfix) with ESMTPSA id 9317D721E282E; Sun, 18 Dec 2016 19:00:07 +0100 (CET) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 10.2 \(3259\)) Subject: Re: svn commit: r310217 - stable/11/sys/netinet From: Michael Tuexen In-Reply-To: <201612181710.uBIHAjR2054060@pdx.rh.CN85.dnsmgr.net> Date: Sun, 18 Dec 2016 19:00:05 +0100 Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Content-Transfer-Encoding: quoted-printable Message-Id: <6FD04AC1-6BEC-4B6D-8F64-CC3D8C11902D@freebsd.org> References: <201612181710.uBIHAjR2054060@pdx.rh.CN85.dnsmgr.net> To: "Rodney W. Grimes" X-Mailer: Apple Mail (2.3259) X-Spam-Status: No, score=-2.9 required=5.0 tests=ALL_TRUSTED,BAYES_00 autolearn=disabled version=3.4.1 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on mail-n.franken.de X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Dec 2016 18:00:12 -0000 > On 18 Dec 2016, at 18:10, Rodney W. Grimes = wrote: >=20 >> Author: tuexen >> Date: Sun Dec 18 12:56:14 2016 >> New Revision: 310217 >> URL: https://svnweb.freebsd.org/changeset/base/310217 > ... >>=20 >> Log: >> MFC r307779: >>=20 >> No functional changes, mostly getting the whitespace changes = resulting >> from an updated formatting tool chain. >=20 > I think there might be an issue with this tool, it is reformatting KNF = multiline > comment format to the wrong format, unless KNF has been changed at = some recent > point. Possibly it is related to change/bug in indent, which seems to be fixed in a later version of indent. pstef@ contacted me and is looking into = it. Using the current version, I get back the old behaviour. Once pstef@ has confirmed that the current version is fine, I regenerate the SCTP sources and commit the result... Best regards Michael >=20 > ... >> - /* >> - * two from each >> - * address >> - */ > ... >> + /* two from each >> + * address */ >> - /* >> - * link-local <-> link-local must belong to the = same >> - * scope. >> - */ >> + /* link-local <-> link-local must belong to the = same >> + * scope. */ >=20 >=20 >> - /* >> - * PMTU check versus smallest asoc MTU = goes >> - * here >> - */ >> + /* PMTU check versus smallest asoc MTU = goes >> + * here */ >=20 > etc... >=20 > --=20 > Rod Grimes = rgrimes@freebsd.org From owner-svn-src-all@freebsd.org Sun Dec 18 20:40:23 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 556BEC87682; Sun, 18 Dec 2016 20:40:23 +0000 (UTC) (envelope-from avos@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 24EC01599; Sun, 18 Dec 2016 20:40:23 +0000 (UTC) (envelope-from avos@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBIKeMfP062804; Sun, 18 Dec 2016 20:40:22 GMT (envelope-from avos@FreeBSD.org) Received: (from avos@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBIKeMCq062803; Sun, 18 Dec 2016 20:40:22 GMT (envelope-from avos@FreeBSD.org) Message-Id: <201612182040.uBIKeMCq062803@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avos set sender to avos@FreeBSD.org using -f From: Andriy Voskoboinyk Date: Sun, 18 Dec 2016 20:40:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r310233 - stable/11/etc X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Dec 2016 20:40:23 -0000 Author: avos Date: Sun Dec 18 20:40:22 2016 New Revision: 310233 URL: https://svnweb.freebsd.org/changeset/base/310233 Log: MFC r309534: Do not try to recreate wlan(4) interface if it already exists. This should fix error messages caused by devd(8) during startup: Starting Network: lo0 wlan0. ... Starting devd. ifconfig: SIOCS80211: Device busy wpa_supplicant already running? (pid=323). Modified: stable/11/etc/pccard_ether Modified: stable/11/etc/pccard_ether ============================================================================== --- stable/11/etc/pccard_ether Sun Dec 18 15:21:38 2016 (r310232) +++ stable/11/etc/pccard_ether Sun Dec 18 20:40:22 2016 (r310233) @@ -120,6 +120,9 @@ pccard_ether_restart() pccard_ether_startchildren() { for child in `get_if_var $ifn wlans_IF`; do + if ifexists $child; then + continue + fi /etc/rc.d/netif quietstart $child done } From owner-svn-src-all@freebsd.org Sun Dec 18 20:56:16 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 07C0CC87AED; Sun, 18 Dec 2016 20:56:16 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B022110CD; Sun, 18 Dec 2016 20:56:15 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBIKuEYD070796; Sun, 18 Dec 2016 20:56:14 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBIKuElT070792; Sun, 18 Dec 2016 20:56:14 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201612182056.uBIKuElT070792@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Sun, 18 Dec 2016 20:56:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310234 - head/sys/vm X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Dec 2016 20:56:16 -0000 Author: kib Date: Sun Dec 18 20:56:14 2016 New Revision: 310234 URL: https://svnweb.freebsd.org/changeset/base/310234 Log: Improve vm_object_scan_all_shadowed() to also check swap backing objects. As noted in the removed comment, it is possible and not prohibitively costly to look up the swap blocks for the given page index. Implement a swap_pager_find_least() function to do that, and use it to iterate simultaneously over both backing object page queue and swap allocations when looking for shadowed pages. Testing shows that number of new succesful scans, enabled by this addition, is small but non-zero. When worked out, the change both further reduces the depth of the shadow object chain, and frees unused but allocated swap and memory. Suggested and reviewed by: alc Tested by: pho (previous version) Sponsored by: The FreeBSD Foundation MFC after: 2 weeks Modified: head/sys/vm/swap_pager.c head/sys/vm/swap_pager.h head/sys/vm/vm_object.c Modified: head/sys/vm/swap_pager.c ============================================================================== --- head/sys/vm/swap_pager.c Sun Dec 18 20:40:22 2016 (r310233) +++ head/sys/vm/swap_pager.c Sun Dec 18 20:56:14 2016 (r310234) @@ -2013,6 +2013,44 @@ swp_pager_meta_ctl(vm_object_t object, v } /* + * Returns the least page index which is greater than or equal to the + * parameter pindex and for which there is a swap block allocated. + * Returns object's size if the object's type is not swap or if there + * are no allocated swap blocks for the object after the requested + * pindex. + */ +vm_pindex_t +swap_pager_find_least(vm_object_t object, vm_pindex_t pindex) +{ + struct swblock **pswap, *swap; + vm_pindex_t i, j, lim; + int idx; + + VM_OBJECT_ASSERT_LOCKED(object); + if (object->type != OBJT_SWAP || object->un_pager.swp.swp_bcount == 0) + return (object->size); + + mtx_lock(&swhash_mtx); + for (j = pindex; j < object->size; j = lim) { + pswap = swp_pager_hash(object, j); + lim = rounddown2(j + SWAP_META_PAGES, SWAP_META_PAGES); + if (lim > object->size) + lim = object->size; + if ((swap = *pswap) != NULL) { + for (idx = j & SWAP_META_MASK, i = j; i < lim; + i++, idx++) { + if (swap->swb_pages[idx] != SWAPBLK_NONE) + goto found; + } + } + } + i = object->size; +found: + mtx_unlock(&swhash_mtx); + return (i); +} + +/* * System call swapon(name) enables swapping on device name, * which must be in the swdevsw. Return EBUSY * if already swapping on this device. Modified: head/sys/vm/swap_pager.h ============================================================================== --- head/sys/vm/swap_pager.h Sun Dec 18 20:40:22 2016 (r310233) +++ head/sys/vm/swap_pager.h Sun Dec 18 20:56:14 2016 (r310234) @@ -79,6 +79,7 @@ extern int swap_pager_avail; struct xswdev; int swap_dev_info(int name, struct xswdev *xs, char *devname, size_t len); void swap_pager_copy(vm_object_t, vm_object_t, vm_pindex_t, int); +vm_pindex_t swap_pager_find_least(vm_object_t object, vm_pindex_t pindex); void swap_pager_freespace(vm_object_t, vm_pindex_t, vm_size_t); void swap_pager_swap_init(void); int swap_pager_isswapped(vm_object_t, struct swdevt *); Modified: head/sys/vm/vm_object.c ============================================================================== --- head/sys/vm/vm_object.c Sun Dec 18 20:40:22 2016 (r310233) +++ head/sys/vm/vm_object.c Sun Dec 18 20:56:14 2016 (r310234) @@ -1436,36 +1436,40 @@ vm_object_scan_all_shadowed(vm_object_t { vm_object_t backing_object; vm_page_t p, pp; - vm_pindex_t backing_offset_index, new_pindex; + vm_pindex_t backing_offset_index, new_pindex, pi, ps; VM_OBJECT_ASSERT_WLOCKED(object); VM_OBJECT_ASSERT_WLOCKED(object->backing_object); backing_object = object->backing_object; - /* - * Initial conditions: - * - * We do not want to have to test for the existence of swap - * pages in the backing object. XXX but with the new swapper this - * would be pretty easy to do. - */ - if (backing_object->type != OBJT_DEFAULT) + if (backing_object->type != OBJT_DEFAULT && + backing_object->type != OBJT_SWAP) return (false); - backing_offset_index = OFF_TO_IDX(object->backing_object_offset); + pi = backing_offset_index = OFF_TO_IDX(object->backing_object_offset); + p = vm_page_find_least(backing_object, pi); + ps = swap_pager_find_least(backing_object, pi); - for (p = TAILQ_FIRST(&backing_object->memq); p != NULL; - p = TAILQ_NEXT(p, listq)) { - new_pindex = p->pindex - backing_offset_index; + /* + * Only check pages inside the parent object's range and + * inside the parent object's mapping of the backing object. + */ + for (;; pi++) { + if (p != NULL && p->pindex < pi) + p = TAILQ_NEXT(p, listq); + if (ps < pi) + ps = swap_pager_find_least(backing_object, pi); + if (p == NULL && ps >= backing_object->size) + break; + else if (p == NULL) + pi = ps; + else + pi = MIN(p->pindex, ps); - /* - * Ignore pages outside the parent object's range and outside - * the parent object's mapping of the backing object. - */ - if (p->pindex < backing_offset_index || - new_pindex >= object->size) - continue; + new_pindex = pi - backing_offset_index; + if (new_pindex >= object->size) + break; /* * See if the parent has the page or if the parent's object From owner-svn-src-all@freebsd.org Sun Dec 18 20:59:25 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5FFFEC87BAD; Sun, 18 Dec 2016 20:59:25 +0000 (UTC) (envelope-from avos@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 2F337161A; Sun, 18 Dec 2016 20:59:25 +0000 (UTC) (envelope-from avos@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBIKxO6J070928; Sun, 18 Dec 2016 20:59:24 GMT (envelope-from avos@FreeBSD.org) Received: (from avos@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBIKxOWW070927; Sun, 18 Dec 2016 20:59:24 GMT (envelope-from avos@FreeBSD.org) Message-Id: <201612182059.uBIKxOWW070927@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avos set sender to avos@FreeBSD.org using -f From: Andriy Voskoboinyk Date: Sun, 18 Dec 2016 20:59:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r310235 - stable/11/sbin/ifconfig X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Dec 2016 20:59:25 -0000 Author: avos Date: Sun Dec 18 20:59:24 2016 New Revision: 310235 URL: https://svnweb.freebsd.org/changeset/base/310235 Log: MFC r310089: ifconfig: do not truncate SSID in verbose mode. Fix 32-character SSID abbreviation for 'ifconfig -v wlan0 scan' command. PR: 215301 Submitted by: Modified: stable/11/sbin/ifconfig/ifieee80211.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sbin/ifconfig/ifieee80211.c ============================================================================== --- stable/11/sbin/ifconfig/ifieee80211.c Sun Dec 18 20:56:14 2016 (r310234) +++ stable/11/sbin/ifconfig/ifieee80211.c Sun Dec 18 20:59:24 2016 (r310235) @@ -3311,7 +3311,7 @@ list_scan(int s) getchaninfo(s); - ssidmax = verbose ? IEEE80211_NWID_LEN - 1 : 14; + ssidmax = verbose ? IEEE80211_NWID_LEN : 14; printf("%-*.*s %-17.17s %4s %4s %-7s %3s %4s\n" , ssidmax, ssidmax, "SSID/MESH ID" , "BSSID" From owner-svn-src-all@freebsd.org Sun Dec 18 22:24:05 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3E424C875C7; Sun, 18 Dec 2016 22:24:05 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 0D4671D28; Sun, 18 Dec 2016 22:24:04 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBIMO4Ij007342; Sun, 18 Dec 2016 22:24:04 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBIMO41Z007341; Sun, 18 Dec 2016 22:24:04 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201612182224.uBIMO41Z007341@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Sun, 18 Dec 2016 22:24:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310236 - head/sys/boot/common X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Dec 2016 22:24:05 -0000 Author: emaste Date: Sun Dec 18 22:24:04 2016 New Revision: 310236 URL: https://svnweb.freebsd.org/changeset/base/310236 Log: Renumber license clauses to avoid skipping #3 Modified: head/sys/boot/common/newvers.sh Modified: head/sys/boot/common/newvers.sh ============================================================================== --- head/sys/boot/common/newvers.sh Sun Dec 18 20:59:24 2016 (r310235) +++ head/sys/boot/common/newvers.sh Sun Dec 18 22:24:04 2016 (r310236) @@ -14,7 +14,7 @@ # 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. -# 4. Neither the name of the University nor the names of its contributors +# 3. Neither the name of the University nor the names of its contributors # may be used to endorse or promote products derived from this software # without specific prior written permission. # From owner-svn-src-all@freebsd.org Mon Dec 19 00:26:26 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B2306C72660; Mon, 19 Dec 2016 00:26:26 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 816EA1BDA; Mon, 19 Dec 2016 00:26:26 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBJ0QPW9056096; Mon, 19 Dec 2016 00:26:25 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBJ0QPt2056095; Mon, 19 Dec 2016 00:26:25 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201612190026.uBJ0QPt2056095@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Mon, 19 Dec 2016 00:26:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r310237 - stable/11/libexec/rtld-elf X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Dec 2016 00:26:26 -0000 Author: kib Date: Mon Dec 19 00:26:25 2016 New Revision: 310237 URL: https://svnweb.freebsd.org/changeset/base/310237 Log: MFC r310155: Fix typo. Modified: stable/11/libexec/rtld-elf/rtld.c Directory Properties: stable/11/ (props changed) Modified: stable/11/libexec/rtld-elf/rtld.c ============================================================================== --- stable/11/libexec/rtld-elf/rtld.c Sun Dec 18 22:24:04 2016 (r310236) +++ stable/11/libexec/rtld-elf/rtld.c Mon Dec 19 00:26:25 2016 (r310237) @@ -2494,7 +2494,7 @@ objlist_call_init(Objlist *list, RtldLoc continue; /* * Race: other thread might try to use this object before current - * one completes the initilization. Not much can be done here + * one completes the initialization. Not much can be done here * without better locking. */ elm->obj->init_done = true; From owner-svn-src-all@freebsd.org Mon Dec 19 00:28:05 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 97601C7272A; Mon, 19 Dec 2016 00:28:05 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 669021EC2; Mon, 19 Dec 2016 00:28:05 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBJ0S49T056208; Mon, 19 Dec 2016 00:28:04 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBJ0S47T056206; Mon, 19 Dec 2016 00:28:04 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201612190028.uBJ0S47T056206@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Mon, 19 Dec 2016 00:28:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r310238 - stable/10/libexec/rtld-elf X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Dec 2016 00:28:05 -0000 Author: kib Date: Mon Dec 19 00:28:04 2016 New Revision: 310238 URL: https://svnweb.freebsd.org/changeset/base/310238 Log: MFC r310155: Fix typo. Modified: stable/10/libexec/rtld-elf/rtld.c Directory Properties: stable/10/ (props changed) Modified: stable/10/libexec/rtld-elf/rtld.c ============================================================================== --- stable/10/libexec/rtld-elf/rtld.c Mon Dec 19 00:26:25 2016 (r310237) +++ stable/10/libexec/rtld-elf/rtld.c Mon Dec 19 00:28:04 2016 (r310238) @@ -2469,7 +2469,7 @@ objlist_call_init(Objlist *list, RtldLoc continue; /* * Race: other thread might try to use this object before current - * one completes the initilization. Not much can be done here + * one completes the initialization. Not much can be done here * without better locking. */ elm->obj->init_done = true; From owner-svn-src-all@freebsd.org Mon Dec 19 07:02:59 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id EFC37C878AE; Mon, 19 Dec 2016 07:02:59 +0000 (UTC) (envelope-from sepherosa@gmail.com) Received: from mail-vk0-x243.google.com (mail-vk0-x243.google.com [IPv6:2607:f8b0:400c:c05::243]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id AF67D6DE; Mon, 19 Dec 2016 07:02:59 +0000 (UTC) (envelope-from sepherosa@gmail.com) Received: by mail-vk0-x243.google.com with SMTP id l126so12871025vkh.0; Sun, 18 Dec 2016 23:02:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=A3+z2/uJNRMi8lw6ufAyvTNiBxWxdGMoLLxYsD8hR2s=; b=VnAz8k//4fado4WOKz7b3d+XrcrNTvsrzRV0YOrVHVgleM5ljiGXEv2h7wR0Gz4Ee5 AdeCXaejS7wzaBQ5yuc+NovOq0qbQeyuMCcYsFbB3f5w3MwEVItQuDDbAyIe8J/IT35/ LqBrlkbF47u29iOFXIrJG/8AdDapEdKIztAMk3dsQSa/Q6xj0ANSlgkvD8Ol1xG81iSQ aV0ZUj8VzjJe1pQzEU22HDbJobzkn3MAg1C5izSKzpt/qoXV3p3w265CSPsjtecdppQr 55hnPS9I4SyvQewMipec09ixmq6oJ/1EJTFs86+Nfk5i8ClBiLK4mc1qkVKQigUkxycb DAKw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=A3+z2/uJNRMi8lw6ufAyvTNiBxWxdGMoLLxYsD8hR2s=; b=tTUpifyG3/XPmfTME7WxjIM365KBr1r6dFtetilIjaMbcXw9hlkeSg/3CtO8xiqjtx I66wJl8mHCEqKGxv7MOq1KFllET2rrn9pK8VDTbAvV3ac8/+0I3iDeCJ/LVLBAq7eeOx +RYOgTIjZ/Iyp/p+CmDcpmAbX4QfegBexUsk4Xki5z9epYxuue4DHalfxNEv0iCpXUhR Zv4kfs7NzFDAushLvWXzbGe6ykpb2CSNFA1nwAFFAZevys2HvpRcCQxct80Q916XgYaL +88lNrtZsxVnA0tlvlhglahPIOLv8smp2QC8JaqjNkiOczcoBth5E2xpiOa0azB6iGKv j82A== X-Gm-Message-State: AIkVDXIaXWAlKB/ykvGMyD+juApfro7qAE/6k3vtVIC26smIu/1qDsTX/hVyTTDznE4Yd4yptUXEcMwySWv+GA== X-Received: by 10.31.168.7 with SMTP id r7mr5320361vke.148.1482130978422; Sun, 18 Dec 2016 23:02:58 -0800 (PST) MIME-Version: 1.0 Received: by 10.176.5.198 with HTTP; Sun, 18 Dec 2016 23:02:57 -0800 (PST) In-Reply-To: <201612161949.uBGJnMol059217@repo.freebsd.org> References: <201612161949.uBGJnMol059217@repo.freebsd.org> From: Sepherosa Ziehau Date: Mon, 19 Dec 2016 15:02:57 +0800 Message-ID: Subject: Re: svn commit: r310171 - head/sys/sys To: Dimitry Andric Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset=UTF-8 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Dec 2016 07:03:00 -0000 The following patch unbreaks the LINT builds on amd64 for me after this commit: https://people.freebsd.org/~sephe/geom_sscanf.diff Please review it. Thanks, sephe On Sat, Dec 17, 2016 at 3:49 AM, Dimitry Andric wrote: > Author: dim > Date: Fri Dec 16 19:49:22 2016 > New Revision: 310171 > URL: https://svnweb.freebsd.org/changeset/base/310171 > > Log: > Add __scanflike attributes to the kernel's sscanf() and vsscanf() > declarations. This should help to catch future mismatches between > format strings and arguments. > > MFC after: 1 week > > Modified: > head/sys/sys/systm.h > > Modified: head/sys/sys/systm.h > ============================================================================== > --- head/sys/sys/systm.h Fri Dec 16 19:09:57 2016 (r310170) > +++ head/sys/sys/systm.h Fri Dec 16 19:49:22 2016 (r310171) > @@ -227,8 +227,8 @@ int vsnprintf(char *, size_t, const char > int vsnrprintf(char *, size_t, int, const char *, __va_list) __printflike(4, 0); > int vsprintf(char *buf, const char *, __va_list) __printflike(2, 0); > int ttyprintf(struct tty *, const char *, ...) __printflike(2, 3); > -int sscanf(const char *, char const *, ...) __nonnull(1) __nonnull(2); > -int vsscanf(const char *, char const *, __va_list) __nonnull(1) __nonnull(2); > +int sscanf(const char *, char const *, ...) __nonnull(1) __nonnull(2) __scanflike(2, 3); > +int vsscanf(const char *, char const *, __va_list) __nonnull(1) __nonnull(2) __scanflike(2, 0); > long strtol(const char *, char **, int) __nonnull(1); > u_long strtoul(const char *, char **, int) __nonnull(1); > quad_t strtoq(const char *, char **, int) __nonnull(1); > _______________________________________________ > svn-src-all@freebsd.org mailing list > https://lists.freebsd.org/mailman/listinfo/svn-src-all > To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org" -- Tomorrow Will Never Die From owner-svn-src-all@freebsd.org Mon Dec 19 07:40:47 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7171BC871DD; Mon, 19 Dec 2016 07:40:47 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 3211C1C94; Mon, 19 Dec 2016 07:40:47 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBJ7ektI034656; Mon, 19 Dec 2016 07:40:46 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBJ7ekkY034652; Mon, 19 Dec 2016 07:40:46 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201612190740.uBJ7ekkY034652@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Mon, 19 Dec 2016 07:40:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310239 - in head: lib/libc/x86/sys sys/dev/hyperv/vmbus/amd64 sys/sys sys/x86/include X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Dec 2016 07:40:47 -0000 Author: sephe Date: Mon Dec 19 07:40:45 2016 New Revision: 310239 URL: https://svnweb.freebsd.org/changeset/base/310239 Log: hyperv: Implement userspace gettimeofday(2) with Hyper-V reference TSC This 6 times gettimeofday performance, as measured by tools/tools/syscall_timing Reviewed by: kib MFC after: 1 week Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D8789 Modified: head/lib/libc/x86/sys/__vdso_gettc.c head/sys/dev/hyperv/vmbus/amd64/hyperv_machdep.c head/sys/sys/vdso.h head/sys/x86/include/vdso.h Modified: head/lib/libc/x86/sys/__vdso_gettc.c ============================================================================== --- head/lib/libc/x86/sys/__vdso_gettc.c Mon Dec 19 00:28:04 2016 (r310238) +++ head/lib/libc/x86/sys/__vdso_gettc.c Mon Dec 19 07:40:45 2016 (r310239) @@ -45,6 +45,10 @@ __FBSDID("$FreeBSD$"); #include #include #include +#ifdef __amd64__ +#include +#include +#endif #include "libc_private.h" static void @@ -144,6 +148,67 @@ __vdso_init_hpet(uint32_t u) _close(fd); } +#ifdef __amd64__ + +#define HYPERV_REFTSC_DEVPATH "/dev/" HYPERV_REFTSC_DEVNAME + +/* + * NOTE: + * We use 'NULL' for this variable to indicate that initialization + * is required. And if this variable is 'MAP_FAILED', then Hyper-V + * reference TSC can not be used, e.g. in misconfigured jail. + */ +static struct hyperv_reftsc *hyperv_ref_tsc; + +static void +__vdso_init_hyperv_tsc(void) +{ + int fd; + + fd = _open(HYPERV_REFTSC_DEVPATH, O_RDONLY); + if (fd < 0) { + /* Prevent the caller from re-entering. */ + hyperv_ref_tsc = MAP_FAILED; + return; + } + hyperv_ref_tsc = mmap(NULL, sizeof(*hyperv_ref_tsc), PROT_READ, + MAP_SHARED, fd, 0); + _close(fd); +} + +static int +__vdso_hyperv_tsc(struct hyperv_reftsc *tsc_ref, u_int *tc) +{ + uint64_t disc, ret, tsc, scale; + uint32_t seq; + int64_t ofs; + + while ((seq = atomic_load_acq_int(&tsc_ref->tsc_seq)) != 0) { + scale = tsc_ref->tsc_scale; + ofs = tsc_ref->tsc_ofs; + + lfence_mb(); + tsc = rdtsc(); + + /* ret = ((tsc * scale) >> 64) + ofs */ + __asm__ __volatile__ ("mulq %3" : + "=d" (ret), "=a" (disc) : + "a" (tsc), "r" (scale)); + ret += ofs; + + atomic_thread_fence_acq(); + if (tsc_ref->tsc_seq == seq) { + *tc = ret; + return (0); + } + + /* Sequence changed; re-sync. */ + } + return (ENOSYS); +} + +#endif /* __amd64__ */ + #pragma weak __vdso_gettc int __vdso_gettc(const struct vdso_timehands *th, u_int *tc) @@ -165,6 +230,14 @@ __vdso_gettc(const struct vdso_timehands return (ENOSYS); *tc = *(volatile uint32_t *)(hpet_dev_map + HPET_MAIN_COUNTER); return (0); +#ifdef __amd64__ + case VDSO_TH_ALGO_X86_HVTSC: + if (hyperv_ref_tsc == NULL) + __vdso_init_hyperv_tsc(); + if (hyperv_ref_tsc == MAP_FAILED) + return (ENOSYS); + return (__vdso_hyperv_tsc(hyperv_ref_tsc, tc)); +#endif default: return (ENOSYS); } Modified: head/sys/dev/hyperv/vmbus/amd64/hyperv_machdep.c ============================================================================== --- head/sys/dev/hyperv/vmbus/amd64/hyperv_machdep.c Mon Dec 19 00:28:04 2016 (r310238) +++ head/sys/dev/hyperv/vmbus/amd64/hyperv_machdep.c Mon Dec 19 07:40:45 2016 (r310239) @@ -33,6 +33,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include @@ -52,18 +53,20 @@ struct hyperv_reftsc_ctx { struct hyperv_dma tsc_ref_dma; }; +static uint32_t hyperv_tsc_vdso_timehands( + struct vdso_timehands *, + struct timecounter *); + static d_open_t hyperv_tsc_open; static d_mmap_t hyperv_tsc_mmap; static struct timecounter hyperv_tsc_timecounter = { .tc_get_timecount = NULL, /* based on CPU vendor. */ - .tc_poll_pps = NULL, .tc_counter_mask = 0xffffffff, .tc_frequency = HYPERV_TIMER_FREQ, .tc_name = "Hyper-V-TSC", .tc_quality = 3000, - .tc_flags = 0, - .tc_priv = NULL + .tc_fill_vdso_timehands = hyperv_tsc_vdso_timehands, }; static struct cdevsw hyperv_tsc_cdevsw = { @@ -117,6 +120,18 @@ hyperv_tsc_mmap(struct cdev *dev __unuse return (0); } +static uint32_t +hyperv_tsc_vdso_timehands(struct vdso_timehands *vdso_th, + struct timecounter *tc __unused) +{ + + vdso_th->th_algo = VDSO_TH_ALGO_X86_HVTSC; + vdso_th->th_x86_shift = 0; + vdso_th->th_x86_hpet_idx = 0; + bzero(vdso_th->th_res, sizeof(vdso_th->th_res)); + return (1); +} + #define HYPERV_TSC_TIMECOUNT(fence) \ static u_int \ hyperv_tsc_timecount_##fence(struct timecounter *tc) \ Modified: head/sys/sys/vdso.h ============================================================================== --- head/sys/sys/vdso.h Mon Dec 19 00:28:04 2016 (r310238) +++ head/sys/sys/vdso.h Mon Dec 19 07:40:45 2016 (r310239) @@ -54,6 +54,8 @@ struct vdso_timekeep { #define VDSO_TK_VER_CURR VDSO_TK_VER_1 #define VDSO_TH_ALGO_1 0x1 #define VDSO_TH_ALGO_2 0x2 +#define VDSO_TH_ALGO_3 0x3 +#define VDSO_TH_ALGO_4 0x4 #ifndef _KERNEL Modified: head/sys/x86/include/vdso.h ============================================================================== --- head/sys/x86/include/vdso.h Mon Dec 19 00:28:04 2016 (r310238) +++ head/sys/x86/include/vdso.h Mon Dec 19 07:40:45 2016 (r310239) @@ -39,6 +39,7 @@ #define VDSO_TH_ALGO_X86_TSC VDSO_TH_ALGO_1 #define VDSO_TH_ALGO_X86_HPET VDSO_TH_ALGO_2 +#define VDSO_TH_ALGO_X86_HVTSC VDSO_TH_ALGO_3 /* Hyper-V ref. TSC */ #ifdef _KERNEL #ifdef COMPAT_FREEBSD32 From owner-svn-src-all@freebsd.org Mon Dec 19 07:46:21 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E7676C87388; Mon, 19 Dec 2016 07:46:21 +0000 (UTC) (envelope-from cperciva@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B67D2784; Mon, 19 Dec 2016 07:46:21 +0000 (UTC) (envelope-from cperciva@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBJ7kKuk037722; Mon, 19 Dec 2016 07:46:20 GMT (envelope-from cperciva@FreeBSD.org) Received: (from cperciva@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBJ7kKoL037721; Mon, 19 Dec 2016 07:46:20 GMT (envelope-from cperciva@FreeBSD.org) Message-Id: <201612190746.uBJ7kKoL037721@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cperciva set sender to cperciva@FreeBSD.org using -f From: Colin Percival Date: Mon, 19 Dec 2016 07:46:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r310240 - stable/11/usr.sbin/portsnap/portsnap X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Dec 2016 07:46:22 -0000 Author: cperciva Date: Mon Dec 19 07:46:20 2016 New Revision: 310240 URL: https://svnweb.freebsd.org/changeset/base/310240 Log: MFC r310179: Avoid division by zero in the rare case that portsnap needs to fetch zero patches. (This avoids two "dc: divide by zero" warnings.) Modified: stable/11/usr.sbin/portsnap/portsnap/portsnap.sh Directory Properties: stable/11/ (props changed) Modified: stable/11/usr.sbin/portsnap/portsnap/portsnap.sh ============================================================================== --- stable/11/usr.sbin/portsnap/portsnap/portsnap.sh Mon Dec 19 07:40:45 2016 (r310239) +++ stable/11/usr.sbin/portsnap/portsnap/portsnap.sh Mon Dec 19 07:46:20 2016 (r310240) @@ -619,8 +619,10 @@ fetch_progress() { pct_fmt() { - printf " \r" - printf "($1/$2) %02.2f%% " `echo "scale=4;$LNC / $TOTAL * 100"|bc` + if [ $TOTAL -gt 0 ]; then + printf " \r" + printf "($1/$2) %02.2f%% " `echo "scale=4;$LNC / $TOTAL * 100"|bc` + fi } fetch_progress_percent() { From owner-svn-src-all@freebsd.org Mon Dec 19 07:48:06 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 30AAAC87478; Mon, 19 Dec 2016 07:48:06 +0000 (UTC) (envelope-from cperciva@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id DBD90B02; Mon, 19 Dec 2016 07:48:05 +0000 (UTC) (envelope-from cperciva@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBJ7m5NW037831; Mon, 19 Dec 2016 07:48:05 GMT (envelope-from cperciva@FreeBSD.org) Received: (from cperciva@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBJ7m5kD037830; Mon, 19 Dec 2016 07:48:05 GMT (envelope-from cperciva@FreeBSD.org) Message-Id: <201612190748.uBJ7m5kD037830@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cperciva set sender to cperciva@FreeBSD.org using -f From: Colin Percival Date: Mon, 19 Dec 2016 07:48:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r310241 - stable/11/sys/fs/nfs X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Dec 2016 07:48:06 -0000 Author: cperciva Date: Mon Dec 19 07:48:04 2016 New Revision: 310241 URL: https://svnweb.freebsd.org/changeset/base/310241 Log: MFC r308708: Reduce verbosity of warnings about truncating NFS fileids to 32-bit inode numbers. Modified: stable/11/sys/fs/nfs/nfs_commonsubs.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/fs/nfs/nfs_commonsubs.c ============================================================================== --- stable/11/sys/fs/nfs/nfs_commonsubs.c Mon Dec 19 07:46:20 2016 (r310240) +++ stable/11/sys/fs/nfs/nfs_commonsubs.c Mon Dec 19 07:48:04 2016 (r310241) @@ -827,6 +827,12 @@ nfsv4_loadattr(struct nfsrv_descript *nd struct dqblk dqb; uid_t savuid; #endif + static struct timeval last64fileid; + static size_t count64fileid; + static struct timeval last64mountfileid; + static size_t count64mountfileid; + static struct timeval warninterval = { 60, 0 }; + if (compare) { retnotsup = 0; error = nfsrv_getattrbits(nd, &attrbits, NULL, &retnotsup); @@ -1202,8 +1208,14 @@ nfsv4_loadattr(struct nfsrv_descript *nd *retcmpp = NFSERR_NOTSAME; } } else if (nap != NULL) { - if (*tl++) - printf("NFSv4 fileid > 32bits\n"); + if (*tl++) { + count64fileid++; + if (ratecheck(&last64fileid, &warninterval)) { + printf("NFSv4 fileid > 32bits (%zu occurrences)\n", + count64fileid); + count64fileid = 0; + } + } nap->na_fileid = thyp; } attrsum += NFSX_HYPER; @@ -1740,8 +1752,14 @@ nfsv4_loadattr(struct nfsrv_descript *nd } } } else if (nap != NULL) { - if (*tl++) - printf("NFSv4 mounted on fileid > 32bits\n"); + if (*tl++) { + count64mountfileid++; + if (ratecheck(&last64mountfileid, &warninterval)) { + printf("NFSv4 mounted on fileid > 32bits (%zu occurrences)\n", + count64mountfileid); + count64mountfileid = 0; + } + } nap->na_mntonfileno = thyp; } attrsum += NFSX_HYPER; From owner-svn-src-all@freebsd.org Mon Dec 19 09:28:14 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5C34DC86271; Mon, 19 Dec 2016 09:28:14 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 131E0AE1; Mon, 19 Dec 2016 09:28:14 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBJ9SDnS078378; Mon, 19 Dec 2016 09:28:13 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBJ9SDFc078376; Mon, 19 Dec 2016 09:28:13 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201612190928.uBJ9SDFc078376@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Mon, 19 Dec 2016 09:28:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310242 - head/sys/dev/usb X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Dec 2016 09:28:14 -0000 Author: hselasky Date: Mon Dec 19 09:28:12 2016 New Revision: 310242 URL: https://svnweb.freebsd.org/changeset/base/310242 Log: Defer USB enumeration until the SI_SUB_KICK_SCHEDULER is executed to avoid boot panics in conjunction with the recently added EARLY_AP_STARTUP feature. The panics happen due to using kernel facilities like callouts too early. Tested by: jhb @ MFC after: 1 week Modified: head/sys/dev/usb/usb_hub.c head/sys/dev/usb/usb_process.c Modified: head/sys/dev/usb/usb_hub.c ============================================================================== --- head/sys/dev/usb/usb_hub.c Mon Dec 19 07:48:04 2016 (r310241) +++ head/sys/dev/usb/usb_hub.c Mon Dec 19 09:28:12 2016 (r310242) @@ -2261,6 +2261,11 @@ usb_needs_explore(struct usb_bus *bus, u DPRINTF("\n"); + if (cold != 0) { + DPRINTF("Cold\n"); + return; + } + if (bus == NULL) { DPRINTF("No bus pointer!\n"); return; @@ -2326,6 +2331,26 @@ usb_needs_explore_all(void) } /*------------------------------------------------------------------------* + * usb_needs_explore_init + * + * This function will ensure that the USB controllers are not enumerated + * until the "cold" variable is cleared. + *------------------------------------------------------------------------*/ +static void +usb_needs_explore_init(void *arg) +{ + /* + * The cold variable should be cleared prior to this function + * being called: + */ + if (cold == 0) + usb_needs_explore_all(); + else + DPRINTFN(-1, "Cold variable is still set!\n"); +} +SYSINIT(usb_needs_explore_init, SI_SUB_KICK_SCHEDULER, SI_ORDER_SECOND, usb_needs_explore_init, NULL); + +/*------------------------------------------------------------------------* * usb_bus_power_update * * This function will ensure that all USB devices on the given bus are Modified: head/sys/dev/usb/usb_process.c ============================================================================== --- head/sys/dev/usb/usb_process.c Mon Dec 19 07:48:04 2016 (r310241) +++ head/sys/dev/usb/usb_process.c Mon Dec 19 09:28:12 2016 (r310242) @@ -455,14 +455,15 @@ usb_proc_drain(struct usb_process *up) up->up_csleep = 0; cv_signal(&up->up_cv); } +#ifndef EARLY_AP_STARTUP /* Check if we are still cold booted */ - if (cold) { USB_THREAD_SUSPEND(up->up_ptr); printf("WARNING: A USB process has " "been left suspended\n"); break; } +#endif cv_wait(&up->up_cv, up->up_mtx); } /* Check if someone is waiting - should not happen */ From owner-svn-src-all@freebsd.org Mon Dec 19 09:32:31 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0EC9BC86475; Mon, 19 Dec 2016 09:32:31 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D9EB4F03; Mon, 19 Dec 2016 09:32:30 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBJ9WUj0082276; Mon, 19 Dec 2016 09:32:30 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBJ9WTWp082274; Mon, 19 Dec 2016 09:32:29 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201612190932.uBJ9WTWp082274@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Mon, 19 Dec 2016 09:32:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r310243 - stable/11/sys/dev/mlx5/mlx5_en X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Dec 2016 09:32:31 -0000 Author: hselasky Date: Mon Dec 19 09:32:29 2016 New Revision: 310243 URL: https://svnweb.freebsd.org/changeset/base/310243 Log: MFC r309406: Remove useless NULL checks. NULL is not returned when allocating memory passing the M_WAITOK flag. Submitted by: trasz @ Differential Revision: https://reviews.freebsd.org/D5772 Sponsored by: Mellanox Technologies Modified: stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_flow_table.c stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_flow_table.c ============================================================================== --- stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_flow_table.c Mon Dec 19 09:28:12 2016 (r310242) +++ stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_flow_table.c Mon Dec 19 09:32:29 2016 (r310243) @@ -854,8 +854,6 @@ mlx5e_create_main_flow_table(struct mlx5 u8 *dmac; g = malloc(9 * sizeof(*g), M_MLX5EN, M_WAITOK | M_ZERO); - if (g == NULL) - return (-ENOMEM); g[0].log_sz = 2; g[0].match_criteria_enable = MLX5_MATCH_OUTER_HEADERS; @@ -939,8 +937,6 @@ mlx5e_create_vlan_flow_table(struct mlx5 struct mlx5_flow_table_group *g; g = malloc(2 * sizeof(*g), M_MLX5EN, M_WAITOK | M_ZERO); - if (g == NULL) - return (-ENOMEM); g[0].log_sz = 12; g[0].match_criteria_enable = MLX5_MATCH_OUTER_HEADERS; Modified: stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_main.c ============================================================================== --- stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Mon Dec 19 09:28:12 2016 (r310242) +++ stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Mon Dec 19 09:32:29 2016 (r310243) @@ -656,10 +656,6 @@ mlx5e_create_rq(struct mlx5e_channel *c, goto err_rq_wq_destroy; rq->mbuf = malloc(wq_sz * sizeof(rq->mbuf[0]), M_MLX5EN, M_WAITOK | M_ZERO); - if (rq->mbuf == NULL) { - err = -ENOMEM; - goto err_lro_init; - } for (i = 0; i != wq_sz; i++) { struct mlx5e_rx_wqe *wqe = mlx5_wq_ll_get_wqe(&rq->wq, i); uint32_t byte_count = rq->wqe_sz - MLX5E_NET_IP_ALIGN; @@ -686,7 +682,6 @@ mlx5e_create_rq(struct mlx5e_channel *c, err_rq_mbuf_free: free(rq->mbuf, M_MLX5EN); -err_lro_init: tcp_lro_free(&rq->lro); err_rq_wq_destroy: mlx5_wq_destroy(&rq->wq_ctrl); @@ -897,8 +892,6 @@ mlx5e_alloc_sq_db(struct mlx5e_sq *sq) int x; sq->mbuf = malloc(wq_sz * sizeof(sq->mbuf[0]), M_MLX5EN, M_WAITOK | M_ZERO); - if (sq->mbuf == NULL) - return (-ENOMEM); /* Create DMA descriptor MAPs */ for (x = 0; x != wq_sz; x++) { @@ -1486,9 +1479,6 @@ mlx5e_open_channel(struct mlx5e_priv *pr int err; c = malloc(sizeof(*c), M_MLX5EN, M_WAITOK | M_ZERO); - if (c == NULL) - return (-ENOMEM); - c->priv = priv; c->ix = ix; c->cpu = 0; @@ -1699,8 +1689,6 @@ mlx5e_open_channels(struct mlx5e_priv *p priv->channel = malloc(priv->params.num_channels * sizeof(struct mlx5e_channel *), M_MLX5EN, M_WAITOK | M_ZERO); - if (priv->channel == NULL) - return (-ENOMEM); mlx5e_build_channel_param(priv, &cparam); for (i = 0; i < priv->params.num_channels; i++) { @@ -2879,10 +2867,6 @@ mlx5e_create_ifp(struct mlx5_core_dev *m return (NULL); } priv = malloc(sizeof(*priv), M_MLX5EN, M_WAITOK | M_ZERO); - if (priv == NULL) { - mlx5_core_err(mdev, "malloc() failed\n"); - return (NULL); - } mlx5e_priv_mtx_init(priv); ifp = priv->ifp = if_alloc(IFT_ETHER); From owner-svn-src-all@freebsd.org Mon Dec 19 09:38:36 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2BF7DC8655B; Mon, 19 Dec 2016 09:38:36 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id ED44010C3; Mon, 19 Dec 2016 09:38:35 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBJ9cZg2082559; Mon, 19 Dec 2016 09:38:35 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBJ9cZBx082557; Mon, 19 Dec 2016 09:38:35 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201612190938.uBJ9cZBx082557@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Mon, 19 Dec 2016 09:38:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r310244 - stable/10/sys/dev/mlx5/mlx5_en X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Dec 2016 09:38:36 -0000 Author: hselasky Date: Mon Dec 19 09:38:34 2016 New Revision: 310244 URL: https://svnweb.freebsd.org/changeset/base/310244 Log: MFC r309406: Remove useless NULL checks. NULL is not returned when allocating memory passing the M_WAITOK flag. Submitted by: trasz @ Differential Revision: https://reviews.freebsd.org/D5772 Sponsored by: Mellanox Technologies Modified: stable/10/sys/dev/mlx5/mlx5_en/mlx5_en_flow_table.c stable/10/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/mlx5/mlx5_en/mlx5_en_flow_table.c ============================================================================== --- stable/10/sys/dev/mlx5/mlx5_en/mlx5_en_flow_table.c Mon Dec 19 09:32:29 2016 (r310243) +++ stable/10/sys/dev/mlx5/mlx5_en/mlx5_en_flow_table.c Mon Dec 19 09:38:34 2016 (r310244) @@ -854,8 +854,6 @@ mlx5e_create_main_flow_table(struct mlx5 u8 *dmac; g = malloc(9 * sizeof(*g), M_MLX5EN, M_WAITOK | M_ZERO); - if (g == NULL) - return (-ENOMEM); g[0].log_sz = 2; g[0].match_criteria_enable = MLX5_MATCH_OUTER_HEADERS; @@ -939,8 +937,6 @@ mlx5e_create_vlan_flow_table(struct mlx5 struct mlx5_flow_table_group *g; g = malloc(2 * sizeof(*g), M_MLX5EN, M_WAITOK | M_ZERO); - if (g == NULL) - return (-ENOMEM); g[0].log_sz = 12; g[0].match_criteria_enable = MLX5_MATCH_OUTER_HEADERS; Modified: stable/10/sys/dev/mlx5/mlx5_en/mlx5_en_main.c ============================================================================== --- stable/10/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Mon Dec 19 09:32:29 2016 (r310243) +++ stable/10/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Mon Dec 19 09:38:34 2016 (r310244) @@ -651,10 +651,6 @@ mlx5e_create_rq(struct mlx5e_channel *c, wq_sz = mlx5_wq_ll_get_size(&rq->wq); rq->mbuf = malloc(wq_sz * sizeof(rq->mbuf[0]), M_MLX5EN, M_WAITOK | M_ZERO); - if (rq->mbuf == NULL) { - err = -ENOMEM; - goto err_rq_wq_destroy; - } for (i = 0; i != wq_sz; i++) { struct mlx5e_rx_wqe *wqe = mlx5_wq_ll_get_wqe(&rq->wq, i); uint32_t byte_count = rq->wqe_sz - MLX5E_NET_IP_ALIGN; @@ -903,8 +899,6 @@ mlx5e_alloc_sq_db(struct mlx5e_sq *sq) int x; sq->mbuf = malloc(wq_sz * sizeof(sq->mbuf[0]), M_MLX5EN, M_WAITOK | M_ZERO); - if (sq->mbuf == NULL) - return (-ENOMEM); /* Create DMA descriptor MAPs */ for (x = 0; x != wq_sz; x++) { @@ -1492,9 +1486,6 @@ mlx5e_open_channel(struct mlx5e_priv *pr int err; c = malloc(sizeof(*c), M_MLX5EN, M_WAITOK | M_ZERO); - if (c == NULL) - return (-ENOMEM); - c->priv = priv; c->ix = ix; c->cpu = 0; @@ -1705,8 +1696,6 @@ mlx5e_open_channels(struct mlx5e_priv *p priv->channel = malloc(priv->params.num_channels * sizeof(struct mlx5e_channel *), M_MLX5EN, M_WAITOK | M_ZERO); - if (priv->channel == NULL) - return (-ENOMEM); mlx5e_build_channel_param(priv, &cparam); for (i = 0; i < priv->params.num_channels; i++) { @@ -2885,10 +2874,6 @@ mlx5e_create_ifp(struct mlx5_core_dev *m return (NULL); } priv = malloc(sizeof(*priv), M_MLX5EN, M_WAITOK | M_ZERO); - if (priv == NULL) { - mlx5_core_err(mdev, "malloc() failed\n"); - return (NULL); - } mlx5e_priv_mtx_init(priv); ifp = priv->ifp = if_alloc(IFT_ETHER); From owner-svn-src-all@freebsd.org Mon Dec 19 09:40:12 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2A464C8661F; Mon, 19 Dec 2016 09:40:12 +0000 (UTC) (envelope-from rpokala@mac.com) Received: from mr11p00im-asmtp003.me.com (mr11p00im-asmtp003.me.com [17.110.69.254]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 0EC5012CD; Mon, 19 Dec 2016 09:40:12 +0000 (UTC) (envelope-from rpokala@mac.com) Received: from process-dkim-sign-daemon.mr11p00im-asmtp003.me.com by mr11p00im-asmtp003.me.com (Oracle Communications Messaging Server 7.0.5.38.0 64bit (built Feb 26 2016)) id <0OIF00300BWVNJ00@mr11p00im-asmtp003.me.com>; Mon, 19 Dec 2016 08:39:56 +0000 (GMT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mac.com; s=4d515a; t=1482136796; bh=MtVuqjl3AT7wgrtdIY0AEZjpCpyxf57iyFl24/W5b3k=; h=Date:Subject:From:To:Message-id:MIME-version:Content-type; b=lPs8JhtXLqRyuDUNwtV4d4AMN1H2KYOQX16lvlOas/R5Ejjdgrf97wF2T7tb0tLan nEudVgJq0+Mrhdt+P4t/gngjK0zYJbGFufD8TXdcvQ98dZtWL9YGQo12VvcAZU0WKV jK7ybFX+sDfPL+LxFN3Nx0wLhEnOOrcZnfa7537VfcE69ccdl5F2ZZAJr3yoixPkyZ cVYkVB6xEyqDHQw2a2F+cgv0PgGNUBiSoOYSHTnCzAhqGg56DZ9pgJm1kTLBcYRjGY YkBkt+bukYo9DUhwBo2QCJNGdn1fPWr7R9QqFUCGZCdEimCH26mEQDzar0Ca4d/elo /BMXcFUBolQ6g== Received: from [192.168.1.4] (c-67-188-225-23.hsd1.ca.comcast.net [67.188.225.23]) by mr11p00im-asmtp003.me.com (Oracle Communications Messaging Server 7.0.5.38.0 64bit (built Feb 26 2016)) with ESMTPSA id <0OIF007S6C2IUQ30@mr11p00im-asmtp003.me.com>; Mon, 19 Dec 2016 08:39:55 +0000 (GMT) X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2016-12-19_06:,, signatures=0 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 clxscore=1034 suspectscore=2 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1603290000 definitions=main-1612190140 User-Agent: Microsoft-MacOutlook/f.1d.0.161209 Date: Mon, 19 Dec 2016 00:39:54 -0800 Subject: Re: svn commit: r310171 - head/sys/sys From: Ravi Pokala Sender: "Pokala, Ravi" To: Sepherosa Ziehau , Dimitry Andric Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Message-id: <9BD5034F-55A6-48F6-A391-A0877FF49702@panasas.com> Thread-topic: svn commit: r310171 - head/sys/sys References: <201612161949.uBGJnMol059217@repo.freebsd.org> In-reply-to: MIME-version: 1.0 Content-type: text/plain; charset=UTF-8 Content-transfer-encoding: 7bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Dec 2016 09:40:12 -0000 -----Original Message----- > From: on behalf of Sepherosa Ziehau > Date: 2016-12-18, Sunday at 23:02 > To: Dimitry Andric > Cc: , , > Subject: Re: svn commit: r310171 - head/sys/sys > > The following patch unbreaks the LINT builds on amd64 for me after this commit: > https://people.freebsd.org/~sephe/geom_sscanf.diff Wouldn't it be better to use the SCN macros? -Ravi (rpokala@) > Please review it. > > Thanks, > sephe > > > On Sat, Dec 17, 2016 at 3:49 AM, Dimitry Andric wrote: >> Author: dim >> Date: Fri Dec 16 19:49:22 2016 >> New Revision: 310171 >> URL: https://svnweb.freebsd.org/changeset/base/310171 >> >> Log: >> Add __scanflike attributes to the kernel's sscanf() and vsscanf() >> declarations. This should help to catch future mismatches between >> format strings and arguments. >> >> MFC after: 1 week >> >> Modified: >> head/sys/sys/systm.h >> >> Modified: head/sys/sys/systm.h >> ============================================================================== >> --- head/sys/sys/systm.h Fri Dec 16 19:09:57 2016 (r310170) >> +++ head/sys/sys/systm.h Fri Dec 16 19:49:22 2016 (r310171) >> @@ -227,8 +227,8 @@ int vsnprintf(char *, size_t, const char >> int vsnrprintf(char *, size_t, int, const char *, __va_list) __printflike(4, 0); >> int vsprintf(char *buf, const char *, __va_list) __printflike(2, 0); >> int ttyprintf(struct tty *, const char *, ...) __printflike(2, 3); >> -int sscanf(const char *, char const *, ...) __nonnull(1) __nonnull(2); >> -int vsscanf(const char *, char const *, __va_list) __nonnull(1) __nonnull(2); >> +int sscanf(const char *, char const *, ...) __nonnull(1) __nonnull(2) __scanflike(2, 3); >> +int vsscanf(const char *, char const *, __va_list) __nonnull(1) __nonnull(2) __scanflike(2, 0); >> long strtol(const char *, char **, int) __nonnull(1); >> u_long strtoul(const char *, char **, int) __nonnull(1); >> quad_t strtoq(const char *, char **, int) __nonnull(1); >> _______________________________________________ >> svn-src-all@freebsd.org mailing list >> https://lists.freebsd.org/mailman/listinfo/svn-src-all >> To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org" > > -- > Tomorrow Will Never Die From owner-svn-src-all@freebsd.org Mon Dec 19 09:40:30 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 79B18C86660; Mon, 19 Dec 2016 09:40:30 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 2FDDF1440; Mon, 19 Dec 2016 09:40:30 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBJ9eTnX082699; Mon, 19 Dec 2016 09:40:29 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBJ9eThw082697; Mon, 19 Dec 2016 09:40:29 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201612190940.uBJ9eThw082697@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Mon, 19 Dec 2016 09:40:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r310245 - stable/11/sys/compat/linuxkpi/common/include/linux X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Dec 2016 09:40:30 -0000 Author: hselasky Date: Mon Dec 19 09:40:29 2016 New Revision: 310245 URL: https://svnweb.freebsd.org/changeset/base/310245 Log: MFC r309734: Avoid malloc() warnings when using the LinuxKPI by zero-checking the allocation flags. Obtained from: kmacy @ Sponsored by: Mellanox Technologies Modified: stable/11/sys/compat/linuxkpi/common/include/linux/gfp.h stable/11/sys/compat/linuxkpi/common/include/linux/slab.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/compat/linuxkpi/common/include/linux/gfp.h ============================================================================== --- stable/11/sys/compat/linuxkpi/common/include/linux/gfp.h Mon Dec 19 09:38:34 2016 (r310244) +++ stable/11/sys/compat/linuxkpi/common/include/linux/gfp.h Mon Dec 19 09:40:29 2016 (r310245) @@ -64,7 +64,7 @@ #define GFP_IOFS M_NOWAIT #define GFP_NOIO M_NOWAIT #define GFP_DMA32 0 -#define GFP_TEMPORARY 0 +#define GFP_TEMPORARY M_NOWAIT static inline void * page_address(struct page *page) Modified: stable/11/sys/compat/linuxkpi/common/include/linux/slab.h ============================================================================== --- stable/11/sys/compat/linuxkpi/common/include/linux/slab.h Mon Dec 19 09:38:34 2016 (r310244) +++ stable/11/sys/compat/linuxkpi/common/include/linux/slab.h Mon Dec 19 09:40:29 2016 (r310245) @@ -43,7 +43,7 @@ MALLOC_DECLARE(M_KMALLOC); #define kmalloc(size, flags) malloc((size), M_KMALLOC, (flags)) #define kvmalloc(size) kmalloc((size), 0) -#define kzalloc(size, flags) kmalloc((size), (flags) | M_ZERO) +#define kzalloc(size, flags) kmalloc((size), M_ZERO | ((flags) ? (flags) : M_NOWAIT)) #define kzalloc_node(size, flags, node) kzalloc(size, flags) #define kfree(ptr) free(__DECONST(void *, (ptr)), M_KMALLOC) #define kfree_const(ptr) kfree(ptr) From owner-svn-src-all@freebsd.org Mon Dec 19 09:41:16 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 050CEC86701; Mon, 19 Dec 2016 09:41:16 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from citapm.icyb.net.ua (citapm.icyb.net.ua [212.40.38.140]) by mx1.freebsd.org (Postfix) with ESMTP id B75AB16AC; Mon, 19 Dec 2016 09:41:14 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from porto.starpoint.kiev.ua (porto-e.starpoint.kiev.ua [212.40.38.100]) by citapm.icyb.net.ua (8.8.8p3/ICyb-2.3exp) with ESMTP id LAA05949; Mon, 19 Dec 2016 11:41:06 +0200 (EET) (envelope-from avg@FreeBSD.org) Received: from localhost ([127.0.0.1]) by porto.starpoint.kiev.ua with esmtp (Exim 4.34 (FreeBSD)) id 1cIuRN-0009Cz-V6; Mon, 19 Dec 2016 11:41:05 +0200 Subject: Re: svn commit: r310172 - in head/sys/mips: conf ingenic To: Jared McNeill , src-committers@FreeBSD.org, svn-src-all@FreeBSD.org, svn-src-head@FreeBSD.org References: <201612162004.uBGK4uHI066983@repo.freebsd.org> From: Andriy Gapon Message-ID: <99ab694b-5cc8-f485-9028-4158caaa337a@FreeBSD.org> Date: Mon, 19 Dec 2016 11:40:29 +0200 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:45.0) Gecko/20100101 Thunderbird/45.5.1 MIME-Version: 1.0 In-Reply-To: <201612162004.uBGK4uHI066983@repo.freebsd.org> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Dec 2016 09:41:16 -0000 On 16/12/2016 22:04, Jared McNeill wrote: > Log: > Add support for Ingenic JZ4780 SMBus controller. Just a note that it looks, swims and quacks like an I²C (I2C / IIC) controller :-) > Reviewed by: kan > Relnotes: yes > Differential Revision: https://reviews.freebsd.org/D8793 > > Added: > head/sys/mips/ingenic/jz4780_smb.c (contents, props changed) > head/sys/mips/ingenic/jz4780_smb.h (contents, props changed) > Modified: > head/sys/mips/conf/JZ4780 > head/sys/mips/ingenic/files.jz4780 -- Andriy Gapon From owner-svn-src-all@freebsd.org Mon Dec 19 09:41:51 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 14BB2C868E2; Mon, 19 Dec 2016 09:41:51 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D360D197E; Mon, 19 Dec 2016 09:41:50 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBJ9fopj086270; Mon, 19 Dec 2016 09:41:50 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBJ9fn5i086268; Mon, 19 Dec 2016 09:41:49 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201612190941.uBJ9fn5i086268@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Mon, 19 Dec 2016 09:41:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r310246 - in stable/11/sys/compat/linuxkpi/common: include/linux src X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Dec 2016 09:41:51 -0000 Author: hselasky Date: Mon Dec 19 09:41:49 2016 New Revision: 310246 URL: https://svnweb.freebsd.org/changeset/base/310246 Log: MFC r309733: MSIX can support more than 256 IRQs. Make sure the invalid IRQ number set in the LinuxKPI is big enough. Sponsored by: Mellanox Technologies Modified: stable/11/sys/compat/linuxkpi/common/include/linux/device.h stable/11/sys/compat/linuxkpi/common/src/linux_pci.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/compat/linuxkpi/common/include/linux/device.h ============================================================================== --- stable/11/sys/compat/linuxkpi/common/include/linux/device.h Mon Dec 19 09:40:29 2016 (r310245) +++ stable/11/sys/compat/linuxkpi/common/include/linux/device.h Mon Dec 19 09:41:49 2016 (r310246) @@ -70,6 +70,7 @@ struct device { uint64_t *dma_mask; void *driver_data; unsigned int irq; +#define LINUX_IRQ_INVALID 65535 unsigned int msix; unsigned int msix_max; const struct attribute_group **groups; Modified: stable/11/sys/compat/linuxkpi/common/src/linux_pci.c ============================================================================== --- stable/11/sys/compat/linuxkpi/common/src/linux_pci.c Mon Dec 19 09:40:29 2016 (r310245) +++ stable/11/sys/compat/linuxkpi/common/src/linux_pci.c Mon Dec 19 09:41:49 2016 (r310246) @@ -144,7 +144,7 @@ linux_pci_attach(device_t dev) if (rle) pdev->dev.irq = rle->start; else - pdev->dev.irq = 255; + pdev->dev.irq = LINUX_IRQ_INVALID; pdev->irq = pdev->dev.irq; DROP_GIANT(); spin_lock(&pci_lock); From owner-svn-src-all@freebsd.org Mon Dec 19 09:42:44 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id EC314C869A9; Mon, 19 Dec 2016 09:42:44 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id AE2C61C58; Mon, 19 Dec 2016 09:42:44 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBJ9ghCM086358; Mon, 19 Dec 2016 09:42:43 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBJ9ghji086357; Mon, 19 Dec 2016 09:42:43 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201612190942.uBJ9ghji086357@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Mon, 19 Dec 2016 09:42:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r310247 - stable/11/sys/compat/linuxkpi/common/include/linux X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Dec 2016 09:42:45 -0000 Author: hselasky Date: Mon Dec 19 09:42:43 2016 New Revision: 310247 URL: https://svnweb.freebsd.org/changeset/base/310247 Log: MFC r309731: Prefix the Linux KPI's kmem_xxx() functions with linux_ to avoid conflict with the opensolaris kernel module. This patch solves a problem where the kernel linker will incorrectly resolve opensolaris kmem_xxx() functions as linuxkpi ones, which leads to a panic when these functions are used. Submitted by: gallatin @ Sponsored by: Mellanox Technologies Modified: stable/11/sys/compat/linuxkpi/common/include/linux/slab.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/compat/linuxkpi/common/include/linux/slab.h ============================================================================== --- stable/11/sys/compat/linuxkpi/common/include/linux/slab.h Mon Dec 19 09:41:49 2016 (r310246) +++ stable/11/sys/compat/linuxkpi/common/include/linux/slab.h Mon Dec 19 09:42:43 2016 (r310247) @@ -55,7 +55,18 @@ MALLOC_DECLARE(M_KMALLOC); #define vmalloc(size) kmalloc(size, GFP_KERNEL) #define vmalloc_node(size, node) kmalloc(size, GFP_KERNEL) -struct kmem_cache { + +/* + * Prefix some functions with linux_ to avoid namespace conflict + * with the OpenSolaris code in the kernel. + */ +#define kmem_cache linux_kmem_cache +#define kmem_cache_create(...) linux_kmem_cache_create(__VA_ARGS__) +#define kmem_cache_alloc(...) linux_kmem_cache_alloc(__VA_ARGS__) +#define kmem_cache_free(...) linux_kmem_cache_free(__VA_ARGS__) +#define kmem_cache_destroy(...) linux_kmem_cache_destroy(__VA_ARGS__) + +struct linux_kmem_cache { uma_zone_t cache_zone; void (*cache_ctor)(void *); }; @@ -63,7 +74,7 @@ struct kmem_cache { #define SLAB_HWCACHE_ALIGN 0x0001 static inline int -kmem_ctor(void *mem, int size, void *arg, int flags) +linux_kmem_ctor(void *mem, int size, void *arg, int flags) { void (*ctor)(void *); @@ -74,7 +85,7 @@ kmem_ctor(void *mem, int size, void *arg } static inline struct kmem_cache * -kmem_cache_create(char *name, size_t size, size_t align, u_long flags, +linux_kmem_cache_create(char *name, size_t size, size_t align, u_long flags, void (*ctor)(void *)) { struct kmem_cache *c; @@ -84,7 +95,7 @@ kmem_cache_create(char *name, size_t siz align--; if (flags & SLAB_HWCACHE_ALIGN) align = UMA_ALIGN_CACHE; - c->cache_zone = uma_zcreate(name, size, ctor ? kmem_ctor : NULL, + c->cache_zone = uma_zcreate(name, size, ctor ? linux_kmem_ctor : NULL, NULL, NULL, NULL, align, 0); c->cache_ctor = ctor; @@ -92,19 +103,19 @@ kmem_cache_create(char *name, size_t siz } static inline void * -kmem_cache_alloc(struct kmem_cache *c, int flags) +linux_kmem_cache_alloc(struct kmem_cache *c, int flags) { return uma_zalloc_arg(c->cache_zone, c->cache_ctor, flags); } static inline void -kmem_cache_free(struct kmem_cache *c, void *m) +linux_kmem_cache_free(struct kmem_cache *c, void *m) { uma_zfree(c->cache_zone, m); } static inline void -kmem_cache_destroy(struct kmem_cache *c) +linux_kmem_cache_destroy(struct kmem_cache *c) { uma_zdestroy(c->cache_zone); free(c, M_KMALLOC); From owner-svn-src-all@freebsd.org Mon Dec 19 09:44:15 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 97F2FC86A48; Mon, 19 Dec 2016 09:44:15 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 5F91E1E64; Mon, 19 Dec 2016 09:44:15 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBJ9iEU2086483; Mon, 19 Dec 2016 09:44:14 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBJ9iE4m086482; Mon, 19 Dec 2016 09:44:14 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201612190944.uBJ9iE4m086482@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Mon, 19 Dec 2016 09:44:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r310248 - stable/11/sys/netgraph X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Dec 2016 09:44:15 -0000 Author: hselasky Date: Mon Dec 19 09:44:14 2016 New Revision: 310248 URL: https://svnweb.freebsd.org/changeset/base/310248 Log: MFC r309404: Fix return value from ng_uncallout(). callout_stop() recently started returning -1 when the callout is already stopped, which is not handled by the netgraph code. Properly filter the return value. Netgraph callers only want to know if the callout was cancelled and not draining or already stopped. Discussed with: julian, glebius Modified: stable/11/sys/netgraph/ng_base.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/netgraph/ng_base.c ============================================================================== --- stable/11/sys/netgraph/ng_base.c Mon Dec 19 09:42:43 2016 (r310247) +++ stable/11/sys/netgraph/ng_base.c Mon Dec 19 09:44:14 2016 (r310248) @@ -3825,7 +3825,11 @@ ng_uncallout(struct callout *c, node_p n } c->c_arg = NULL; - return (rval); + /* + * Callers only want to know if the callout was cancelled and + * not draining or stopped. + */ + return (rval > 0); } /* From owner-svn-src-all@freebsd.org Mon Dec 19 09:45:25 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 00CD9C86ACF; Mon, 19 Dec 2016 09:45:25 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C3F8D309; Mon, 19 Dec 2016 09:45:24 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBJ9jNWt086588; Mon, 19 Dec 2016 09:45:23 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBJ9jNZ5086587; Mon, 19 Dec 2016 09:45:23 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201612190945.uBJ9jNZ5086587@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Mon, 19 Dec 2016 09:45:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r310249 - stable/10/sys/netgraph X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Dec 2016 09:45:25 -0000 Author: hselasky Date: Mon Dec 19 09:45:23 2016 New Revision: 310249 URL: https://svnweb.freebsd.org/changeset/base/310249 Log: MFC r309404: Fix return value from ng_uncallout(). callout_stop() recently started returning -1 when the callout is already stopped, which is not handled by the netgraph code. Properly filter the return value. Netgraph callers only want to know if the callout was cancelled and not draining or already stopped. Discussed with: julian, glebius Modified: stable/10/sys/netgraph/ng_base.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/netgraph/ng_base.c ============================================================================== --- stable/10/sys/netgraph/ng_base.c Mon Dec 19 09:44:14 2016 (r310248) +++ stable/10/sys/netgraph/ng_base.c Mon Dec 19 09:45:23 2016 (r310249) @@ -3823,7 +3823,11 @@ ng_uncallout(struct callout *c, node_p n } c->c_arg = NULL; - return (rval); + /* + * Callers only want to know if the callout was cancelled and + * not draining or stopped. + */ + return (rval > 0); } /* From owner-svn-src-all@freebsd.org Mon Dec 19 09:47:36 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0231BC86B9D; Mon, 19 Dec 2016 09:47:36 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B8C196DC; Mon, 19 Dec 2016 09:47:35 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBJ9lYCf086812; Mon, 19 Dec 2016 09:47:34 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBJ9lYBj086809; Mon, 19 Dec 2016 09:47:34 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201612190947.uBJ9lYBj086809@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Mon, 19 Dec 2016 09:47:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r310250 - in stable/11/sys/compat/linuxkpi/common: include/linux src X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Dec 2016 09:47:36 -0000 Author: hselasky Date: Mon Dec 19 09:47:34 2016 New Revision: 310250 URL: https://svnweb.freebsd.org/changeset/base/310250 Log: MFC r309732: Prefix some _pci_xxx() functions in the Linux KPI with linux_ and make sure the IRQ number used by these functions is unsigned. Sponsored by: Mellanox Technologies Modified: stable/11/sys/compat/linuxkpi/common/include/linux/interrupt.h stable/11/sys/compat/linuxkpi/common/include/linux/pci.h stable/11/sys/compat/linuxkpi/common/src/linux_pci.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/compat/linuxkpi/common/include/linux/interrupt.h ============================================================================== --- stable/11/sys/compat/linuxkpi/common/include/linux/interrupt.h Mon Dec 19 09:45:23 2016 (r310249) +++ stable/11/sys/compat/linuxkpi/common/include/linux/interrupt.h Mon Dec 19 09:47:34 2016 (r310250) @@ -50,11 +50,11 @@ struct irq_ent { void *arg; irqreturn_t (*handler)(int, void *); void *tag; - int irq; + unsigned int irq; }; static inline int -linux_irq_rid(struct device *dev, int irq) +linux_irq_rid(struct device *dev, unsigned int irq) { if (irq == dev->irq) return (0); @@ -64,7 +64,7 @@ linux_irq_rid(struct device *dev, int ir extern void linux_irq_handler(void *); static inline struct irq_ent * -linux_irq_ent(struct device *dev, int irq) +linux_irq_ent(struct device *dev, unsigned int irq) { struct irq_ent *irqe; @@ -85,7 +85,7 @@ request_irq(unsigned int irq, irq_handle int error; int rid; - dev = _pci_find_irq_dev(irq); + dev = linux_pci_find_irq_dev(irq); if (dev == NULL) return -ENXIO; rid = linux_irq_rid(dev, irq); @@ -117,7 +117,7 @@ bind_irq_to_cpu(unsigned int irq, int cp struct irq_ent *irqe; struct device *dev; - dev = _pci_find_irq_dev(irq); + dev = linux_pci_find_irq_dev(irq); if (dev == NULL) return (-ENOENT); @@ -135,7 +135,7 @@ free_irq(unsigned int irq, void *device) struct device *dev; int rid; - dev = _pci_find_irq_dev(irq); + dev = linux_pci_find_irq_dev(irq); if (dev == NULL) return; rid = linux_irq_rid(dev, irq); Modified: stable/11/sys/compat/linuxkpi/common/include/linux/pci.h ============================================================================== --- stable/11/sys/compat/linuxkpi/common/include/linux/pci.h Mon Dec 19 09:45:23 2016 (r310249) +++ stable/11/sys/compat/linuxkpi/common/include/linux/pci.h Mon Dec 19 09:47:34 2016 (r310250) @@ -171,7 +171,7 @@ struct pci_dev { }; static inline struct resource_list_entry * -_pci_get_rle(struct pci_dev *pdev, int type, int rid) +linux_pci_get_rle(struct pci_dev *pdev, int type, int rid) { struct pci_devinfo *dinfo; struct resource_list *rl; @@ -182,18 +182,18 @@ _pci_get_rle(struct pci_dev *pdev, int t } static inline struct resource_list_entry * -_pci_get_bar(struct pci_dev *pdev, int bar) +linux_pci_get_bar(struct pci_dev *pdev, int bar) { struct resource_list_entry *rle; bar = PCIR_BAR(bar); - if ((rle = _pci_get_rle(pdev, SYS_RES_MEMORY, bar)) == NULL) - rle = _pci_get_rle(pdev, SYS_RES_IOPORT, bar); + if ((rle = linux_pci_get_rle(pdev, SYS_RES_MEMORY, bar)) == NULL) + rle = linux_pci_get_rle(pdev, SYS_RES_IOPORT, bar); return (rle); } static inline struct device * -_pci_find_irq_dev(unsigned int irq) +linux_pci_find_irq_dev(unsigned int irq) { struct pci_dev *pdev; @@ -215,7 +215,7 @@ pci_resource_start(struct pci_dev *pdev, { struct resource_list_entry *rle; - if ((rle = _pci_get_bar(pdev, bar)) == NULL) + if ((rle = linux_pci_get_bar(pdev, bar)) == NULL) return (0); return rle->start; } @@ -225,7 +225,7 @@ pci_resource_len(struct pci_dev *pdev, i { struct resource_list_entry *rle; - if ((rle = _pci_get_bar(pdev, bar)) == NULL) + if ((rle = linux_pci_get_bar(pdev, bar)) == NULL) return (0); return rle->count; } @@ -331,7 +331,7 @@ pci_release_region(struct pci_dev *pdev, { struct resource_list_entry *rle; - if ((rle = _pci_get_bar(pdev, bar)) == NULL) + if ((rle = linux_pci_get_bar(pdev, bar)) == NULL) return; bus_release_resource(pdev->dev.bsddev, rle->type, rle->rid, rle->res); } @@ -477,7 +477,7 @@ pci_enable_msix(struct pci_dev *pdev, st pci_release_msi(pdev->dev.bsddev); return avail; } - rle = _pci_get_rle(pdev, SYS_RES_IRQ, 1); + rle = linux_pci_get_rle(pdev, SYS_RES_IRQ, 1); pdev->dev.msix = rle->start; pdev->dev.msix_max = rle->start + avail; for (i = 0; i < nreq; i++) Modified: stable/11/sys/compat/linuxkpi/common/src/linux_pci.c ============================================================================== --- stable/11/sys/compat/linuxkpi/common/src/linux_pci.c Mon Dec 19 09:45:23 2016 (r310249) +++ stable/11/sys/compat/linuxkpi/common/src/linux_pci.c Mon Dec 19 09:47:34 2016 (r310250) @@ -140,8 +140,8 @@ linux_pci_attach(device_t dev) kobject_set_name(&pdev->dev.kobj, device_get_nameunit(dev)); kobject_add(&pdev->dev.kobj, &linux_root_device.kobj, kobject_name(&pdev->dev.kobj)); - rle = _pci_get_rle(pdev, SYS_RES_IRQ, 0); - if (rle) + rle = linux_pci_get_rle(pdev, SYS_RES_IRQ, 0); + if (rle != NULL) pdev->dev.irq = rle->start; else pdev->dev.irq = LINUX_IRQ_INVALID; From owner-svn-src-all@freebsd.org Mon Dec 19 09:48:30 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id DBFF8C86C4E; Mon, 19 Dec 2016 09:48:30 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id AABE8984; Mon, 19 Dec 2016 09:48:30 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBJ9mTuR086900; Mon, 19 Dec 2016 09:48:29 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBJ9mTVN086899; Mon, 19 Dec 2016 09:48:29 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201612190948.uBJ9mTVN086899@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Mon, 19 Dec 2016 09:48:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r310251 - stable/11/sys/compat/linuxkpi/common/include/linux X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Dec 2016 09:48:31 -0000 Author: hselasky Date: Mon Dec 19 09:48:29 2016 New Revision: 310251 URL: https://svnweb.freebsd.org/changeset/base/310251 Log: MFC r309736: Prefer function macros over regular macros in the LinuxKPI. Sponsored by: Mellanox Technologies Modified: stable/11/sys/compat/linuxkpi/common/include/linux/pci.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/compat/linuxkpi/common/include/linux/pci.h ============================================================================== --- stable/11/sys/compat/linuxkpi/common/include/linux/pci.h Mon Dec 19 09:47:34 2016 (r310250) +++ stable/11/sys/compat/linuxkpi/common/include/linux/pci.h Mon Dec 19 09:48:29 2016 (r310251) @@ -537,9 +537,9 @@ static inline void pci_disable_sriov(str #define PCI_DMA_NONE 3 #define pci_pool dma_pool -#define pci_pool_destroy dma_pool_destroy -#define pci_pool_alloc dma_pool_alloc -#define pci_pool_free dma_pool_free +#define pci_pool_destroy(...) dma_pool_destroy(__VA_ARGS__) +#define pci_pool_alloc(...) dma_pool_alloc(__VA_ARGS__) +#define pci_pool_free(...) dma_pool_free(__VA_ARGS__) #define pci_pool_create(_name, _pdev, _size, _align, _alloc) \ dma_pool_create(_name, &(_pdev)->dev, _size, _align, _alloc) #define pci_free_consistent(_hwdev, _size, _vaddr, _dma_handle) \ From owner-svn-src-all@freebsd.org Mon Dec 19 09:49:18 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 38D7BC86CEF; Mon, 19 Dec 2016 09:49:18 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id EDDA0AF2; Mon, 19 Dec 2016 09:49:17 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBJ9nHEF086985; Mon, 19 Dec 2016 09:49:17 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBJ9nHZA086984; Mon, 19 Dec 2016 09:49:17 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201612190949.uBJ9nHZA086984@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Mon, 19 Dec 2016 09:49:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r310252 - stable/11/sys/compat/linuxkpi/common/include/linux X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Dec 2016 09:49:18 -0000 Author: hselasky Date: Mon Dec 19 09:49:16 2016 New Revision: 310252 URL: https://svnweb.freebsd.org/changeset/base/310252 Log: MFC r309737: Add more LinuxKPI PCI definitions. Obtained from: kmacy @ Sponsored by: Mellanox Technologies Modified: stable/11/sys/compat/linuxkpi/common/include/linux/pci.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/compat/linuxkpi/common/include/linux/pci.h ============================================================================== --- stable/11/sys/compat/linuxkpi/common/include/linux/pci.h Mon Dec 19 09:48:29 2016 (r310251) +++ stable/11/sys/compat/linuxkpi/common/include/linux/pci.h Mon Dec 19 09:49:16 2016 (r310252) @@ -64,8 +64,18 @@ struct pci_device_id { #define MODULE_DEVICE_TABLE(bus, table) #define PCI_ANY_ID (-1) +#define PCI_VENDOR_ID_APPLE 0x106b +#define PCI_VENDOR_ID_ASUSTEK 0x1043 +#define PCI_VENDOR_ID_ATI 0x1002 +#define PCI_VENDOR_ID_DELL 0x1028 +#define PCI_VENDOR_ID_HP 0x103c +#define PCI_VENDOR_ID_IBM 0x1014 +#define PCI_VENDOR_ID_INTEL 0x8086 #define PCI_VENDOR_ID_MELLANOX 0x15b3 +#define PCI_VENDOR_ID_SERVERWORKS 0x1166 +#define PCI_VENDOR_ID_SONY 0x104d #define PCI_VENDOR_ID_TOPSPIN 0x1867 +#define PCI_VENDOR_ID_VIA 0x1106 #define PCI_DEVICE_ID_MELLANOX_TAVOR 0x5a44 #define PCI_DEVICE_ID_MELLANOX_TAVOR_BRIDGE 0x5a46 #define PCI_DEVICE_ID_MELLANOX_ARBEL_COMPAT 0x6278 @@ -121,6 +131,10 @@ struct pci_device_id { #define PCI_EXP_LNKCAP2_SLS_5_0GB 0x04 /* Supported Link Speed 5.0GT/s */ #define PCI_EXP_LNKCAP2_SLS_8_0GB 0x08 /* Supported Link Speed 8.0GT/s */ +#define PCI_EXP_LNKCTL_HAWD PCIEM_LINK_CTL_HAWD +#define PCI_EXP_LNKCAP_CLKPM 0x00040000 +#define PCI_EXP_DEVSTA_TRPND 0x0020 + #define IORESOURCE_MEM (1 << SYS_RES_MEMORY) #define IORESOURCE_IO (1 << SYS_RES_IOPORT) #define IORESOURCE_IRQ (1 << SYS_RES_IRQ) @@ -133,9 +147,19 @@ enum pci_bus_speed { }; enum pcie_link_width { - PCIE_LNK_WIDTH_UNKNOWN = -1, + PCIE_LNK_WIDTH_UNKNOWN = 0xFF, }; +typedef int pci_power_t; + +#define PCI_D0 PCI_POWERSTATE_D0 +#define PCI_D1 PCI_POWERSTATE_D1 +#define PCI_D2 PCI_POWERSTATE_D2 +#define PCI_D3hot PCI_POWERSTATE_D3 +#define PCI_D3cold 4 + +#define PCI_POWER_ERROR PCI_POWERSTATE_UNKNOWN + struct pci_dev; struct pci_driver { @@ -303,6 +327,14 @@ pci_set_master(struct pci_dev *pdev) } static inline int +pci_set_power_state(struct pci_dev *pdev, int state) +{ + + pci_set_powerstate(pdev->dev.bsddev, state); + return (0); +} + +static inline int pci_clear_master(struct pci_dev *pdev) { @@ -368,9 +400,23 @@ pci_disable_msix(struct pci_dev *pdev) pci_release_msi(pdev->dev.bsddev); } +static inline bus_addr_t +pci_bus_address(struct pci_dev *pdev, int bar) +{ + + return (pci_resource_start(pdev, bar)); +} + #define PCI_CAP_ID_EXP PCIY_EXPRESS #define PCI_CAP_ID_PCIX PCIY_PCIX +#define PCI_CAP_ID_AGP PCIY_AGP +#define PCI_CAP_ID_PM PCIY_PMG +#define PCI_EXP_DEVCTL PCIER_DEVICE_CTL +#define PCI_EXP_DEVCTL_PAYLOAD PCIEM_CTL_MAX_PAYLOAD +#define PCI_EXP_DEVCTL_READRQ PCIEM_CTL_MAX_READ_REQUEST +#define PCI_EXP_LNKCTL PCIER_LINK_CTL +#define PCI_EXP_LNKSTA PCIER_LINK_STA static inline int pci_find_capability(struct pci_dev *pdev, int capid) @@ -410,7 +456,7 @@ pci_read_config_dword(struct pci_dev *pd *val = (u32)pci_read_config(pdev->dev.bsddev, where, 4); return (0); -} +} static inline int pci_write_config_byte(struct pci_dev *pdev, int where, u8 val) @@ -430,7 +476,7 @@ pci_write_config_word(struct pci_dev *pd static inline int pci_write_config_dword(struct pci_dev *pdev, int where, u32 val) -{ +{ pci_write_config(pdev->dev.bsddev, where, val, 4); return (0); @@ -708,7 +754,8 @@ static bool pcie_capability_reg_implemen } } -static inline int pcie_capability_read_dword(struct pci_dev *dev, int pos, u32 *dst) +static inline int +pcie_capability_read_dword(struct pci_dev *dev, int pos, u32 *dst) { if (pos & 3) return -EINVAL; @@ -719,7 +766,20 @@ static inline int pcie_capability_read_d return pci_read_config_dword(dev, pci_pcie_cap(dev) + pos, dst); } -static inline int pcie_capability_write_word(struct pci_dev *dev, int pos, u16 val) +static inline int +pcie_capability_read_word(struct pci_dev *dev, int pos, u16 *dst) +{ + if (pos & 3) + return -EINVAL; + + if (!pcie_capability_reg_implemented(dev, pos)) + return -EINVAL; + + return pci_read_config_word(dev, pci_pcie_cap(dev) + pos, dst); +} + +static inline int +pcie_capability_write_word(struct pci_dev *dev, int pos, u16 val) { if (pos & 1) return -EINVAL; From owner-svn-src-all@freebsd.org Mon Dec 19 09:51:18 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id EBE41C87231; Mon, 19 Dec 2016 09:51:18 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C6743FF9; Mon, 19 Dec 2016 09:51:18 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBJ9pHwv088101; Mon, 19 Dec 2016 09:51:17 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBJ9pHU4088100; Mon, 19 Dec 2016 09:51:17 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201612190951.uBJ9pHU4088100@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Mon, 19 Dec 2016 09:51:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r310253 - stable/11/sys/dev/acpica X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Dec 2016 09:51:19 -0000 Author: hselasky Date: Mon Dec 19 09:51:17 2016 New Revision: 310253 URL: https://svnweb.freebsd.org/changeset/base/310253 Log: MFC r309400: Fix for endless recursion in the ACPI GPE handler during boot. When handling a GPE ACPI interrupt object the EcSpaceHandler() function can be called which checks the EC_EVENT_SCI bit and then recurse on the EcGpeQueryHandler() function. If there are multiple GPE events pending the EC_EVENT_SCI bit will be set at the next call to EcSpaceHandler() causing it to recurse again via the EcGpeQueryHandler() function. This leads to a slow never ending recursion during boot which prevents proper system startup, because the EC_EVENT_SCI bit never gets cleared in this scenario. The behaviour is reproducible with the ALASKA AMI in combination with a newer Skylake based mainboard in the following way: Enter BIOS and adjust the clock one hour forward. Save and exit the BIOS. System fails to boot due to the above mentioned bug in EcGpeQueryHandler() which was observed recursing multiple times. This patch adds a simple recursion guard to the EcGpeQueryHandler() function and also also adds logic to detect if new GPE events occurred during the execution of EcGpeQueryHandler() and then loop on this function instead of recursing. Reviewed by: jhb Modified: stable/11/sys/dev/acpica/acpi_ec.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/acpica/acpi_ec.c ============================================================================== --- stable/11/sys/dev/acpica/acpi_ec.c Mon Dec 19 09:49:16 2016 (r310252) +++ stable/11/sys/dev/acpica/acpi_ec.c Mon Dec 19 09:51:17 2016 (r310253) @@ -613,16 +613,14 @@ EcCheckStatus(struct acpi_ec_softc *sc, } static void -EcGpeQueryHandler(void *Context) +EcGpeQueryHandlerSub(struct acpi_ec_softc *sc) { - struct acpi_ec_softc *sc = (struct acpi_ec_softc *)Context; UINT8 Data; ACPI_STATUS Status; int retry; char qxx[5]; ACPI_FUNCTION_TRACE((char *)(uintptr_t)__func__); - KASSERT(Context != NULL, ("EcGpeQueryHandler called with NULL")); /* Serialize user access with EcSpaceHandler(). */ Status = EcLock(sc); @@ -647,7 +645,6 @@ EcGpeQueryHandler(void *Context) EC_EVENT_INPUT_BUFFER_EMPTY))) break; } - sc->ec_sci_pend = FALSE; if (ACPI_FAILURE(Status)) { EcUnlock(sc); device_printf(sc->ec_dev, "GPE query failed: %s\n", @@ -678,6 +675,29 @@ EcGpeQueryHandler(void *Context) } } +static void +EcGpeQueryHandler(void *Context) +{ + struct acpi_ec_softc *sc = (struct acpi_ec_softc *)Context; + int pending; + + KASSERT(Context != NULL, ("EcGpeQueryHandler called with NULL")); + + do { + /* Read the current pending count */ + pending = atomic_load_acq_int(&sc->ec_sci_pend); + + /* Call GPE handler function */ + EcGpeQueryHandlerSub(sc); + + /* + * Try to reset the pending count to zero. If this fails we + * know another GPE event has occurred while handling the + * current GPE event and need to loop. + */ + } while (!atomic_cmpset_int(&sc->ec_sci_pend, pending, 0)); +} + /* * The GPE handler is called when IBE/OBF or SCI events occur. We are * called from an unknown lock context. @@ -706,13 +726,14 @@ EcGpeHandler(ACPI_HANDLE GpeDevice, UINT * It will run the query and _Qxx method later, under the lock. */ EcStatus = EC_GET_CSR(sc); - if ((EcStatus & EC_EVENT_SCI) && !sc->ec_sci_pend) { + if ((EcStatus & EC_EVENT_SCI) && + atomic_fetchadd_int(&sc->ec_sci_pend, 1) == 0) { CTR0(KTR_ACPI, "ec gpe queueing query handler"); Status = AcpiOsExecute(OSL_GPE_HANDLER, EcGpeQueryHandler, Context); - if (ACPI_SUCCESS(Status)) - sc->ec_sci_pend = TRUE; - else + if (ACPI_FAILURE(Status)) { printf("EcGpeHandler: queuing GPE query handler failed\n"); + atomic_store_rel_int(&sc->ec_sci_pend, 0); + } } return (ACPI_REENABLE_GPE); } @@ -759,7 +780,8 @@ EcSpaceHandler(UINT32 Function, ACPI_PHY * we call it directly here since our thread taskq is not active yet. */ if (cold || rebooting || sc->ec_suspending) { - if ((EC_GET_CSR(sc) & EC_EVENT_SCI)) { + if ((EC_GET_CSR(sc) & EC_EVENT_SCI) && + atomic_fetchadd_int(&sc->ec_sci_pend, 1) == 0) { CTR0(KTR_ACPI, "ec running gpe handler directly"); EcGpeQueryHandler(sc); } From owner-svn-src-all@freebsd.org Mon Dec 19 09:52:33 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3D6C0C872D6; Mon, 19 Dec 2016 09:52:33 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 18082129C; Mon, 19 Dec 2016 09:52:33 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBJ9qWpu091156; Mon, 19 Dec 2016 09:52:32 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBJ9qW2A091155; Mon, 19 Dec 2016 09:52:32 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201612190952.uBJ9qW2A091155@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Mon, 19 Dec 2016 09:52:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r310254 - stable/10/sys/dev/acpica X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Dec 2016 09:52:33 -0000 Author: hselasky Date: Mon Dec 19 09:52:32 2016 New Revision: 310254 URL: https://svnweb.freebsd.org/changeset/base/310254 Log: MFC r309400: Fix for endless recursion in the ACPI GPE handler during boot. When handling a GPE ACPI interrupt object the EcSpaceHandler() function can be called which checks the EC_EVENT_SCI bit and then recurse on the EcGpeQueryHandler() function. If there are multiple GPE events pending the EC_EVENT_SCI bit will be set at the next call to EcSpaceHandler() causing it to recurse again via the EcGpeQueryHandler() function. This leads to a slow never ending recursion during boot which prevents proper system startup, because the EC_EVENT_SCI bit never gets cleared in this scenario. The behaviour is reproducible with the ALASKA AMI in combination with a newer Skylake based mainboard in the following way: Enter BIOS and adjust the clock one hour forward. Save and exit the BIOS. System fails to boot due to the above mentioned bug in EcGpeQueryHandler() which was observed recursing multiple times. This patch adds a simple recursion guard to the EcGpeQueryHandler() function and also also adds logic to detect if new GPE events occurred during the execution of EcGpeQueryHandler() and then loop on this function instead of recursing. Reviewed by: jhb Modified: stable/10/sys/dev/acpica/acpi_ec.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/acpica/acpi_ec.c ============================================================================== --- stable/10/sys/dev/acpica/acpi_ec.c Mon Dec 19 09:51:17 2016 (r310253) +++ stable/10/sys/dev/acpica/acpi_ec.c Mon Dec 19 09:52:32 2016 (r310254) @@ -618,16 +618,14 @@ EcCheckStatus(struct acpi_ec_softc *sc, } static void -EcGpeQueryHandler(void *Context) +EcGpeQueryHandlerSub(struct acpi_ec_softc *sc) { - struct acpi_ec_softc *sc = (struct acpi_ec_softc *)Context; UINT8 Data; ACPI_STATUS Status; int retry; char qxx[5]; ACPI_FUNCTION_TRACE((char *)(uintptr_t)__func__); - KASSERT(Context != NULL, ("EcGpeQueryHandler called with NULL")); /* Serialize user access with EcSpaceHandler(). */ Status = EcLock(sc); @@ -652,7 +650,6 @@ EcGpeQueryHandler(void *Context) EC_EVENT_INPUT_BUFFER_EMPTY))) break; } - sc->ec_sci_pend = FALSE; if (ACPI_FAILURE(Status)) { EcUnlock(sc); device_printf(sc->ec_dev, "GPE query failed: %s\n", @@ -683,6 +680,29 @@ EcGpeQueryHandler(void *Context) } } +static void +EcGpeQueryHandler(void *Context) +{ + struct acpi_ec_softc *sc = (struct acpi_ec_softc *)Context; + int pending; + + KASSERT(Context != NULL, ("EcGpeQueryHandler called with NULL")); + + do { + /* Read the current pending count */ + pending = atomic_load_acq_int(&sc->ec_sci_pend); + + /* Call GPE handler function */ + EcGpeQueryHandlerSub(sc); + + /* + * Try to reset the pending count to zero. If this fails we + * know another GPE event has occurred while handling the + * current GPE event and need to loop. + */ + } while (!atomic_cmpset_int(&sc->ec_sci_pend, pending, 0)); +} + /* * The GPE handler is called when IBE/OBF or SCI events occur. We are * called from an unknown lock context. @@ -711,13 +731,14 @@ EcGpeHandler(ACPI_HANDLE GpeDevice, UINT * It will run the query and _Qxx method later, under the lock. */ EcStatus = EC_GET_CSR(sc); - if ((EcStatus & EC_EVENT_SCI) && !sc->ec_sci_pend) { + if ((EcStatus & EC_EVENT_SCI) && + atomic_fetchadd_int(&sc->ec_sci_pend, 1) == 0) { CTR0(KTR_ACPI, "ec gpe queueing query handler"); Status = AcpiOsExecute(OSL_GPE_HANDLER, EcGpeQueryHandler, Context); - if (ACPI_SUCCESS(Status)) - sc->ec_sci_pend = TRUE; - else + if (ACPI_FAILURE(Status)) { printf("EcGpeHandler: queuing GPE query handler failed\n"); + atomic_store_rel_int(&sc->ec_sci_pend, 0); + } } return (ACPI_REENABLE_GPE); } @@ -764,7 +785,8 @@ EcSpaceHandler(UINT32 Function, ACPI_PHY * we call it directly here since our thread taskq is not active yet. */ if (cold || rebooting || sc->ec_suspending) { - if ((EC_GET_CSR(sc) & EC_EVENT_SCI)) { + if ((EC_GET_CSR(sc) & EC_EVENT_SCI) && + atomic_fetchadd_int(&sc->ec_sci_pend, 1) == 0) { CTR0(KTR_ACPI, "ec running gpe handler directly"); EcGpeQueryHandler(sc); } From owner-svn-src-all@freebsd.org Mon Dec 19 09:55:01 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2642CC8738F; Mon, 19 Dec 2016 09:55:01 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 00D2B146B; Mon, 19 Dec 2016 09:55:00 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBJ9t0Z5091319; Mon, 19 Dec 2016 09:55:00 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBJ9t0l8091318; Mon, 19 Dec 2016 09:55:00 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201612190955.uBJ9t0l8091318@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Mon, 19 Dec 2016 09:55:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r310255 - stable/9/sys/dev/acpica X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Dec 2016 09:55:01 -0000 Author: hselasky Date: Mon Dec 19 09:54:59 2016 New Revision: 310255 URL: https://svnweb.freebsd.org/changeset/base/310255 Log: MFC r309400: Fix for endless recursion in the ACPI GPE handler during boot. When handling a GPE ACPI interrupt object the EcSpaceHandler() function can be called which checks the EC_EVENT_SCI bit and then recurse on the EcGpeQueryHandler() function. If there are multiple GPE events pending the EC_EVENT_SCI bit will be set at the next call to EcSpaceHandler() causing it to recurse again via the EcGpeQueryHandler() function. This leads to a slow never ending recursion during boot which prevents proper system startup, because the EC_EVENT_SCI bit never gets cleared in this scenario. The behaviour is reproducible with the ALASKA AMI in combination with a newer Skylake based mainboard in the following way: Enter BIOS and adjust the clock one hour forward. Save and exit the BIOS. System fails to boot due to the above mentioned bug in EcGpeQueryHandler() which was observed recursing multiple times. This patch adds a simple recursion guard to the EcGpeQueryHandler() function and also also adds logic to detect if new GPE events occurred during the execution of EcGpeQueryHandler() and then loop on this function instead of recursing. Reviewed by: jhb Modified: stable/9/sys/dev/acpica/acpi_ec.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/dev/acpica/acpi_ec.c ============================================================================== --- stable/9/sys/dev/acpica/acpi_ec.c Mon Dec 19 09:52:32 2016 (r310254) +++ stable/9/sys/dev/acpica/acpi_ec.c Mon Dec 19 09:54:59 2016 (r310255) @@ -618,16 +618,14 @@ EcCheckStatus(struct acpi_ec_softc *sc, } static void -EcGpeQueryHandler(void *Context) +EcGpeQueryHandlerSub(struct acpi_ec_softc *sc) { - struct acpi_ec_softc *sc = (struct acpi_ec_softc *)Context; UINT8 Data; ACPI_STATUS Status; int retry; char qxx[5]; ACPI_FUNCTION_TRACE((char *)(uintptr_t)__func__); - KASSERT(Context != NULL, ("EcGpeQueryHandler called with NULL")); /* Serialize user access with EcSpaceHandler(). */ Status = EcLock(sc); @@ -654,7 +652,6 @@ EcGpeQueryHandler(void *Context) else break; } - sc->ec_sci_pend = FALSE; if (ACPI_FAILURE(Status)) { EcUnlock(sc); device_printf(sc->ec_dev, "GPE query failed: %s\n", @@ -685,6 +682,29 @@ EcGpeQueryHandler(void *Context) } } +static void +EcGpeQueryHandler(void *Context) +{ + struct acpi_ec_softc *sc = (struct acpi_ec_softc *)Context; + int pending; + + KASSERT(Context != NULL, ("EcGpeQueryHandler called with NULL")); + + do { + /* Read the current pending count */ + pending = atomic_load_acq_int(&sc->ec_sci_pend); + + /* Call GPE handler function */ + EcGpeQueryHandlerSub(sc); + + /* + * Try to reset the pending count to zero. If this fails we + * know another GPE event has occurred while handling the + * current GPE event and need to loop. + */ + } while (!atomic_cmpset_int(&sc->ec_sci_pend, pending, 0)); +} + /* * The GPE handler is called when IBE/OBF or SCI events occur. We are * called from an unknown lock context. @@ -713,13 +733,14 @@ EcGpeHandler(ACPI_HANDLE GpeDevice, UINT * It will run the query and _Qxx method later, under the lock. */ EcStatus = EC_GET_CSR(sc); - if ((EcStatus & EC_EVENT_SCI) && !sc->ec_sci_pend) { + if ((EcStatus & EC_EVENT_SCI) && + atomic_fetchadd_int(&sc->ec_sci_pend, 1) == 0) { CTR0(KTR_ACPI, "ec gpe queueing query handler"); Status = AcpiOsExecute(OSL_GPE_HANDLER, EcGpeQueryHandler, Context); - if (ACPI_SUCCESS(Status)) - sc->ec_sci_pend = TRUE; - else + if (ACPI_FAILURE(Status)) { printf("EcGpeHandler: queuing GPE query handler failed\n"); + atomic_store_rel_int(&sc->ec_sci_pend, 0); + } } return (ACPI_REENABLE_GPE); } @@ -766,7 +787,8 @@ EcSpaceHandler(UINT32 Function, ACPI_PHY * we call it directly here since our thread taskq is not active yet. */ if (cold || rebooting || sc->ec_suspending) { - if ((EC_GET_CSR(sc) & EC_EVENT_SCI)) { + if ((EC_GET_CSR(sc) & EC_EVENT_SCI) && + atomic_fetchadd_int(&sc->ec_sci_pend, 1) == 0) { CTR0(KTR_ACPI, "ec running gpe handler directly"); EcGpeQueryHandler(sc); } From owner-svn-src-all@freebsd.org Mon Dec 19 10:00:57 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6F1D4C87438; Mon, 19 Dec 2016 10:00:57 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 49CD416AD; Mon, 19 Dec 2016 10:00:57 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBJA0uKM091593; Mon, 19 Dec 2016 10:00:56 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBJA0uvS091592; Mon, 19 Dec 2016 10:00:56 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201612191000.uBJA0uvS091592@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Mon, 19 Dec 2016 10:00:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r310256 - stable/8/sys/dev/acpica X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Dec 2016 10:00:57 -0000 Author: hselasky Date: Mon Dec 19 10:00:56 2016 New Revision: 310256 URL: https://svnweb.freebsd.org/changeset/base/310256 Log: MFC r309400: Fix for endless recursion in the ACPI GPE handler during boot. When handling a GPE ACPI interrupt object the EcSpaceHandler() function can be called which checks the EC_EVENT_SCI bit and then recurse on the EcGpeQueryHandler() function. If there are multiple GPE events pending the EC_EVENT_SCI bit will be set at the next call to EcSpaceHandler() causing it to recurse again via the EcGpeQueryHandler() function. This leads to a slow never ending recursion during boot which prevents proper system startup, because the EC_EVENT_SCI bit never gets cleared in this scenario. The behaviour is reproducible with the ALASKA AMI in combination with a newer Skylake based mainboard in the following way: Enter BIOS and adjust the clock one hour forward. Save and exit the BIOS. System fails to boot due to the above mentioned bug in EcGpeQueryHandler() which was observed recursing multiple times. This patch adds a simple recursion guard to the EcGpeQueryHandler() function and also also adds logic to detect if new GPE events occurred during the execution of EcGpeQueryHandler() and then loop on this function instead of recursing. Reviewed by: jhb Modified: stable/8/sys/dev/acpica/acpi_ec.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/dev/ (props changed) stable/8/sys/dev/acpica/ (props changed) Modified: stable/8/sys/dev/acpica/acpi_ec.c ============================================================================== --- stable/8/sys/dev/acpica/acpi_ec.c Mon Dec 19 09:54:59 2016 (r310255) +++ stable/8/sys/dev/acpica/acpi_ec.c Mon Dec 19 10:00:56 2016 (r310256) @@ -618,16 +618,14 @@ EcCheckStatus(struct acpi_ec_softc *sc, } static void -EcGpeQueryHandler(void *Context) +EcGpeQueryHandlerSub(struct acpi_ec_softc *sc) { - struct acpi_ec_softc *sc = (struct acpi_ec_softc *)Context; UINT8 Data; ACPI_STATUS Status; int retry; char qxx[5]; ACPI_FUNCTION_TRACE((char *)(uintptr_t)__func__); - KASSERT(Context != NULL, ("EcGpeQueryHandler called with NULL")); /* Serialize user access with EcSpaceHandler(). */ Status = EcLock(sc); @@ -654,7 +652,6 @@ EcGpeQueryHandler(void *Context) else break; } - sc->ec_sci_pend = FALSE; if (ACPI_FAILURE(Status)) { EcUnlock(sc); device_printf(sc->ec_dev, "GPE query failed: %s\n", @@ -685,6 +682,29 @@ EcGpeQueryHandler(void *Context) } } +static void +EcGpeQueryHandler(void *Context) +{ + struct acpi_ec_softc *sc = (struct acpi_ec_softc *)Context; + int pending; + + KASSERT(Context != NULL, ("EcGpeQueryHandler called with NULL")); + + do { + /* Read the current pending count */ + pending = atomic_load_acq_int(&sc->ec_sci_pend); + + /* Call GPE handler function */ + EcGpeQueryHandlerSub(sc); + + /* + * Try to reset the pending count to zero. If this fails we + * know another GPE event has occurred while handling the + * current GPE event and need to loop. + */ + } while (!atomic_cmpset_int(&sc->ec_sci_pend, pending, 0)); +} + /* * The GPE handler is called when IBE/OBF or SCI events occur. We are * called from an unknown lock context. @@ -713,13 +733,14 @@ EcGpeHandler(void *Context) * It will run the query and _Qxx method later, under the lock. */ EcStatus = EC_GET_CSR(sc); - if ((EcStatus & EC_EVENT_SCI) && !sc->ec_sci_pend) { + if ((EcStatus & EC_EVENT_SCI) && + atomic_fetchadd_int(&sc->ec_sci_pend, 1) == 0) { CTR0(KTR_ACPI, "ec gpe queueing query handler"); Status = AcpiOsExecute(OSL_GPE_HANDLER, EcGpeQueryHandler, Context); - if (ACPI_SUCCESS(Status)) - sc->ec_sci_pend = TRUE; - else + if (ACPI_FAILURE(Status)) { printf("EcGpeHandler: queuing GPE query handler failed\n"); + atomic_store_rel_int(&sc->ec_sci_pend, 0); + } } return (0); } @@ -766,7 +787,8 @@ EcSpaceHandler(UINT32 Function, ACPI_PHY * we call it directly here since our thread taskq is not active yet. */ if (cold || rebooting || sc->ec_suspending) { - if ((EC_GET_CSR(sc) & EC_EVENT_SCI)) { + if ((EC_GET_CSR(sc) & EC_EVENT_SCI) && + atomic_fetchadd_int(&sc->ec_sci_pend, 1) == 0) { CTR0(KTR_ACPI, "ec running gpe handler directly"); EcGpeQueryHandler(sc); } From owner-svn-src-all@freebsd.org Mon Dec 19 10:25:49 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4AB4BC87D18; Mon, 19 Dec 2016 10:25:49 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 19DE9158B; Mon, 19 Dec 2016 10:25:49 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBJAPm2M003688; Mon, 19 Dec 2016 10:25:48 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBJAPleQ003682; Mon, 19 Dec 2016 10:25:47 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201612191025.uBJAPleQ003682@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Mon, 19 Dec 2016 10:25:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310257 - in head/sys/cam: ctl scsi X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Dec 2016 10:25:49 -0000 Author: mav Date: Mon Dec 19 10:25:47 2016 New Revision: 310257 URL: https://svnweb.freebsd.org/changeset/base/310257 Log: Improve support for informational exceptions. While CTL still has no real events to report in this way (like SMART), it is possible to trigger false event by manually setting TEST bit in Informational Exceptions Control mode page, that can be useful for initiator testing. This code supports all flavours of IE reporting: UNIT ATTENTION, RECOVERED ERROR and NO SENSE sense keys, REQUEST SENSE command and Informational Exceptions log page. MFC after: 2 weeks Sponsored by: iXsystems, Inc. Modified: head/sys/cam/ctl/ctl.c head/sys/cam/ctl/ctl.h head/sys/cam/ctl/ctl_error.c head/sys/cam/ctl/ctl_private.h head/sys/cam/scsi/scsi_all.h head/sys/cam/scsi/scsi_da.h Modified: head/sys/cam/ctl/ctl.c ============================================================================== --- head/sys/cam/ctl/ctl.c Mon Dec 19 10:00:56 2016 (r310256) +++ head/sys/cam/ctl/ctl.c Mon Dec 19 10:25:47 2016 (r310257) @@ -93,25 +93,6 @@ struct ctl_softc *control_softc = NULL; * Note that these are default values only. The actual values will be * filled in when the user does a mode sense. */ -const static struct copan_debugconf_subpage debugconf_page_default = { - DBGCNF_PAGE_CODE | SMPH_SPF, /* page_code */ - DBGCNF_SUBPAGE_CODE, /* subpage */ - {(sizeof(struct copan_debugconf_subpage) - 4) >> 8, - (sizeof(struct copan_debugconf_subpage) - 4) >> 0}, /* page_length */ - DBGCNF_VERSION, /* page_version */ - {CTL_TIME_IO_DEFAULT_SECS>>8, - CTL_TIME_IO_DEFAULT_SECS>>0}, /* ctl_time_io_secs */ -}; - -const static struct copan_debugconf_subpage debugconf_page_changeable = { - DBGCNF_PAGE_CODE | SMPH_SPF, /* page_code */ - DBGCNF_SUBPAGE_CODE, /* subpage */ - {(sizeof(struct copan_debugconf_subpage) - 4) >> 8, - (sizeof(struct copan_debugconf_subpage) - 4) >> 0}, /* page_length */ - 0, /* page_version */ - {0xff,0xff}, /* ctl_time_io_secs */ -}; - const static struct scsi_da_rw_recovery_page rw_er_page_default = { /*page_code*/SMS_RW_ERROR_RECOVERY_PAGE, /*page_length*/sizeof(struct scsi_da_rw_recovery_page) - 2, @@ -129,12 +110,12 @@ const static struct scsi_da_rw_recovery_ const static struct scsi_da_rw_recovery_page rw_er_page_changeable = { /*page_code*/SMS_RW_ERROR_RECOVERY_PAGE, /*page_length*/sizeof(struct scsi_da_rw_recovery_page) - 2, - /*byte3*/0, + /*byte3*/SMS_RWER_PER, /*read_retry_count*/0, /*correction_span*/0, /*head_offset_count*/0, /*data_strobe_offset_cnt*/0, - /*byte8*/0, + /*byte8*/SMS_RWER_LBPERE, /*write_retry_count*/0, /*reserved2*/0, /*recovery_time_limit*/{0, 0}, @@ -206,6 +187,24 @@ const static struct scsi_rigid_disk_page /*reserved2*/ {0, 0} }; +const static struct scsi_da_verify_recovery_page verify_er_page_default = { + /*page_code*/SMS_VERIFY_ERROR_RECOVERY_PAGE, + /*page_length*/sizeof(struct scsi_da_verify_recovery_page) - 2, + /*byte3*/0, + /*read_retry_count*/0, + /*reserved*/{ 0, 0, 0, 0, 0, 0 }, + /*recovery_time_limit*/{0, 0}, +}; + +const static struct scsi_da_verify_recovery_page verify_er_page_changeable = { + /*page_code*/SMS_VERIFY_ERROR_RECOVERY_PAGE, + /*page_length*/sizeof(struct scsi_da_verify_recovery_page) - 2, + /*byte3*/SMS_VER_PER, + /*read_retry_count*/0, + /*reserved*/{ 0, 0, 0, 0, 0, 0 }, + /*recovery_time_limit*/{0, 0}, +}; + const static struct scsi_caching_page caching_page_default = { /*page_code*/SMS_CACHING_PAGE, /*page_length*/sizeof(struct scsi_caching_page) - 2, @@ -285,19 +284,20 @@ const static struct scsi_control_ext_pag const static struct scsi_info_exceptions_page ie_page_default = { /*page_code*/SMS_INFO_EXCEPTIONS_PAGE, /*page_length*/sizeof(struct scsi_info_exceptions_page) - 2, - /*info_flags*/SIEP_FLAGS_DEXCPT, - /*mrie*/0, + /*info_flags*/SIEP_FLAGS_EWASC, + /*mrie*/SIEP_MRIE_NO, /*interval_timer*/{0, 0, 0, 0}, - /*report_count*/{0, 0, 0, 0} + /*report_count*/{0, 0, 0, 1} }; const static struct scsi_info_exceptions_page ie_page_changeable = { /*page_code*/SMS_INFO_EXCEPTIONS_PAGE, /*page_length*/sizeof(struct scsi_info_exceptions_page) - 2, - /*info_flags*/0, - /*mrie*/0, - /*interval_timer*/{0, 0, 0, 0}, - /*report_count*/{0, 0, 0, 0} + /*info_flags*/SIEP_FLAGS_EWASC | SIEP_FLAGS_DEXCPT | SIEP_FLAGS_TEST | + SIEP_FLAGS_LOGERR, + /*mrie*/0x0f, + /*interval_timer*/{0xff, 0xff, 0xff, 0xff}, + /*report_count*/{0xff, 0xff, 0xff, 0xff} }; #define CTL_LBPM_LEN (sizeof(struct ctl_logical_block_provisioning_page) - 4) @@ -4070,6 +4070,26 @@ ctl_init_page_index(struct ctl_lun *lun) (uint8_t *)lun->mode_pages.rigid_disk_page; break; } + case SMS_VERIFY_ERROR_RECOVERY_PAGE: { + KASSERT(page_index->subpage == SMS_SUBPAGE_PAGE_0, + ("subpage %#x for page %#x is incorrect!", + page_index->subpage, page_code)); + memcpy(&lun->mode_pages.verify_er_page[CTL_PAGE_CURRENT], + &verify_er_page_default, + sizeof(verify_er_page_default)); + memcpy(&lun->mode_pages.verify_er_page[CTL_PAGE_CHANGEABLE], + &verify_er_page_changeable, + sizeof(verify_er_page_changeable)); + memcpy(&lun->mode_pages.verify_er_page[CTL_PAGE_DEFAULT], + &verify_er_page_default, + sizeof(verify_er_page_default)); + memcpy(&lun->mode_pages.verify_er_page[CTL_PAGE_SAVED], + &verify_er_page_default, + sizeof(verify_er_page_default)); + page_index->page_data = + (uint8_t *)lun->mode_pages.verify_er_page; + break; + } case SMS_CACHING_PAGE: { struct scsi_caching_page *caching_page; @@ -4280,35 +4300,6 @@ ctl_init_page_index(struct ctl_lun *lun) (uint8_t *)lun->mode_pages.cddvd_page; break; } - case SMS_VENDOR_SPECIFIC_PAGE:{ - switch (page_index->subpage) { - case DBGCNF_SUBPAGE_CODE: { - memcpy(&lun->mode_pages.debugconf_subpage[ - CTL_PAGE_CURRENT], - &debugconf_page_default, - sizeof(debugconf_page_default)); - memcpy(&lun->mode_pages.debugconf_subpage[ - CTL_PAGE_CHANGEABLE], - &debugconf_page_changeable, - sizeof(debugconf_page_changeable)); - memcpy(&lun->mode_pages.debugconf_subpage[ - CTL_PAGE_DEFAULT], - &debugconf_page_default, - sizeof(debugconf_page_default)); - memcpy(&lun->mode_pages.debugconf_subpage[ - CTL_PAGE_SAVED], - &debugconf_page_default, - sizeof(debugconf_page_default)); - page_index->page_data = - (uint8_t *)lun->mode_pages.debugconf_subpage; - break; - } - default: - panic("subpage %#x for page %#x is incorrect!", - page_index->subpage, page_code); - } - break; - } default: panic("invalid page code value %#x", page_code); } @@ -4361,6 +4352,8 @@ ctl_init_log_page_index(struct ctl_lun * lun->log_pages.index[2].page_len = 12*CTL_NUM_LBP_PARAMS; lun->log_pages.index[3].page_data = (uint8_t *)&lun->log_pages.stat_page; lun->log_pages.index[3].page_len = sizeof(lun->log_pages.stat_page); + lun->log_pages.index[4].page_data = (uint8_t *)&lun->log_pages.ie_page; + lun->log_pages.index[4].page_len = sizeof(lun->log_pages.ie_page); return (CTL_RETVAL_COMPLETE); } @@ -4591,6 +4584,8 @@ ctl_alloc_lun(struct ctl_softc *ctl_soft TAILQ_INIT(&lun->ooa_queue); TAILQ_INIT(&lun->blocked_queue); STAILQ_INIT(&lun->error_list); + lun->ie_reported = 1; + callout_init_mtx(&lun->ie_callout, &lun->lun_lock, 0); ctl_tpc_lun_init(lun); /* @@ -4664,6 +4659,9 @@ ctl_free_lun(struct ctl_lun *lun) atomic_subtract_int(&lun->be_lun->be->num_luns, 1); lun->be_lun->lun_shutdown(lun->be_lun->be_lun); + lun->ie_reportcnt = UINT32_MAX; + callout_drain(&lun->ie_callout); + ctl_tpc_lun_shutdown(lun); mtx_destroy(&lun->lun_lock); free(lun->lun_devid, M_CTL); @@ -5832,25 +5830,12 @@ done: return (CTL_RETVAL_COMPLETE); } -/* - * Note that this function currently doesn't actually do anything inside - * CTL to enforce things if the DQue bit is turned on. - * - * Also note that this function can't be used in the default case, because - * the DQue bit isn't set in the changeable mask for the control mode page - * anyway. This is just here as an example for how to implement a page - * handler, and a placeholder in case we want to allow the user to turn - * tagged queueing on and off. - * - * The D_SENSE bit handling is functional, however, and will turn - * descriptor sense on and off for a given LUN. - */ int -ctl_control_page_handler(struct ctl_scsiio *ctsio, +ctl_default_page_handler(struct ctl_scsiio *ctsio, struct ctl_page_index *page_index, uint8_t *page_ptr) { - struct scsi_control_page *current_cp, *saved_cp, *user_cp; struct ctl_lun *lun; + uint8_t *current_cp, *saved_cp; int set_ua; uint32_t initidx; @@ -5858,50 +5843,15 @@ ctl_control_page_handler(struct ctl_scsi initidx = ctl_get_initindex(&ctsio->io_hdr.nexus); set_ua = 0; - user_cp = (struct scsi_control_page *)page_ptr; - current_cp = (struct scsi_control_page *) - (page_index->page_data + (page_index->page_len * - CTL_PAGE_CURRENT)); - saved_cp = (struct scsi_control_page *) - (page_index->page_data + (page_index->page_len * - CTL_PAGE_SAVED)); + current_cp = (page_index->page_data + (page_index->page_len * + CTL_PAGE_CURRENT)); + saved_cp = (page_index->page_data + (page_index->page_len * + CTL_PAGE_SAVED)); mtx_lock(&lun->lun_lock); - if (((current_cp->rlec & SCP_DSENSE) == 0) - && ((user_cp->rlec & SCP_DSENSE) != 0)) { - /* - * Descriptor sense is currently turned off and the user - * wants to turn it on. - */ - current_cp->rlec |= SCP_DSENSE; - saved_cp->rlec |= SCP_DSENSE; - lun->flags |= CTL_LUN_SENSE_DESC; - set_ua = 1; - } else if (((current_cp->rlec & SCP_DSENSE) != 0) - && ((user_cp->rlec & SCP_DSENSE) == 0)) { - /* - * Descriptor sense is currently turned on, and the user - * wants to turn it off. - */ - current_cp->rlec &= ~SCP_DSENSE; - saved_cp->rlec &= ~SCP_DSENSE; - lun->flags &= ~CTL_LUN_SENSE_DESC; - set_ua = 1; - } - if ((current_cp->queue_flags & SCP_QUEUE_ALG_MASK) != - (user_cp->queue_flags & SCP_QUEUE_ALG_MASK)) { - current_cp->queue_flags &= ~SCP_QUEUE_ALG_MASK; - current_cp->queue_flags |= user_cp->queue_flags & SCP_QUEUE_ALG_MASK; - saved_cp->queue_flags &= ~SCP_QUEUE_ALG_MASK; - saved_cp->queue_flags |= user_cp->queue_flags & SCP_QUEUE_ALG_MASK; - set_ua = 1; - } - if ((current_cp->eca_and_aen & SCP_SWP) != - (user_cp->eca_and_aen & SCP_SWP)) { - current_cp->eca_and_aen &= ~SCP_SWP; - current_cp->eca_and_aen |= user_cp->eca_and_aen & SCP_SWP; - saved_cp->eca_and_aen &= ~SCP_SWP; - saved_cp->eca_and_aen |= user_cp->eca_and_aen & SCP_SWP; + if (memcmp(current_cp, page_ptr, page_index->page_len)) { + memcpy(current_cp, page_ptr, page_index->page_len); + memcpy(saved_cp, page_ptr, page_index->page_len); set_ua = 1; } if (set_ua != 0) @@ -5912,101 +5862,78 @@ ctl_control_page_handler(struct ctl_scsi ctl_get_initindex(&ctsio->io_hdr.nexus), page_index->page_code, page_index->subpage); } - return (0); + return (CTL_RETVAL_COMPLETE); } -int -ctl_caching_sp_handler(struct ctl_scsiio *ctsio, - struct ctl_page_index *page_index, uint8_t *page_ptr) +static void +ctl_ie_timer(void *arg) { - struct scsi_caching_page *current_cp, *saved_cp, *user_cp; - struct ctl_lun *lun; - int set_ua; - uint32_t initidx; + struct ctl_lun *lun = arg; + struct scsi_info_exceptions_page *pg; + uint64_t t; - lun = (struct ctl_lun *)ctsio->io_hdr.ctl_private[CTL_PRIV_LUN].ptr; - initidx = ctl_get_initindex(&ctsio->io_hdr.nexus); - set_ua = 0; + if (lun->ie_asc == 0) + return; - user_cp = (struct scsi_caching_page *)page_ptr; - current_cp = (struct scsi_caching_page *) - (page_index->page_data + (page_index->page_len * - CTL_PAGE_CURRENT)); - saved_cp = (struct scsi_caching_page *) - (page_index->page_data + (page_index->page_len * - CTL_PAGE_SAVED)); + pg = &lun->mode_pages.ie_page[CTL_PAGE_CURRENT]; + if (pg->mrie == SIEP_MRIE_UA) + ctl_est_ua_all(lun, -1, CTL_UA_IE); + else + lun->ie_reported = 0; - mtx_lock(&lun->lun_lock); - if ((current_cp->flags1 & (SCP_WCE | SCP_RCD)) != - (user_cp->flags1 & (SCP_WCE | SCP_RCD))) { - current_cp->flags1 &= ~(SCP_WCE | SCP_RCD); - current_cp->flags1 |= user_cp->flags1 & (SCP_WCE | SCP_RCD); - saved_cp->flags1 &= ~(SCP_WCE | SCP_RCD); - saved_cp->flags1 |= user_cp->flags1 & (SCP_WCE | SCP_RCD); - set_ua = 1; + if (lun->ie_reportcnt < scsi_4btoul(pg->report_count)) { + lun->ie_reportcnt++; + t = scsi_4btoul(pg->interval_timer); + if (t == 0 || t == UINT32_MAX) + t = 3000; /* 5 min */ + callout_schedule(&lun->ie_callout, t * hz / 10); } - if (set_ua != 0) - ctl_est_ua_all(lun, initidx, CTL_UA_MODE_CHANGE); - mtx_unlock(&lun->lun_lock); - if (set_ua) { - ctl_isc_announce_mode(lun, - ctl_get_initindex(&ctsio->io_hdr.nexus), - page_index->page_code, page_index->subpage); - } - return (0); } int -ctl_debugconf_sp_select_handler(struct ctl_scsiio *ctsio, - struct ctl_page_index *page_index, - uint8_t *page_ptr) -{ - uint8_t *c; - int i; - - c = ((struct copan_debugconf_subpage *)page_ptr)->ctl_time_io_secs; - ctl_time_io_secs = - (c[0] << 8) | - (c[1] << 0) | - 0; - CTL_DEBUG_PRINT(("set ctl_time_io_secs to %d\n", ctl_time_io_secs)); - printf("set ctl_time_io_secs to %d\n", ctl_time_io_secs); - printf("page data:"); - for (i=0; i<8; i++) - printf(" %.2x",page_ptr[i]); - printf("\n"); - return (0); -} - -int -ctl_debugconf_sp_sense_handler(struct ctl_scsiio *ctsio, - struct ctl_page_index *page_index, - int pc) +ctl_ie_page_handler(struct ctl_scsiio *ctsio, + struct ctl_page_index *page_index, uint8_t *page_ptr) { - struct copan_debugconf_subpage *page; + struct scsi_info_exceptions_page *pg; + struct ctl_lun *lun; + uint64_t t; - page = (struct copan_debugconf_subpage *)page_index->page_data + - (page_index->page_len * pc); + (void)ctl_default_page_handler(ctsio, page_index, page_ptr); - switch (pc) { - case SMS_PAGE_CTRL_CHANGEABLE >> 6: - case SMS_PAGE_CTRL_DEFAULT >> 6: - case SMS_PAGE_CTRL_SAVED >> 6: - /* - * We don't update the changeable or default bits for this page. - */ - break; - case SMS_PAGE_CTRL_CURRENT >> 6: - page->ctl_time_io_secs[0] = ctl_time_io_secs >> 8; - page->ctl_time_io_secs[1] = ctl_time_io_secs >> 0; - break; - default: - break; + lun = (struct ctl_lun *)ctsio->io_hdr.ctl_private[CTL_PRIV_LUN].ptr; + pg = (struct scsi_info_exceptions_page *)page_ptr; + mtx_lock(&lun->lun_lock); + if (pg->info_flags & SIEP_FLAGS_TEST) { + lun->ie_asc = 0x5d; + lun->ie_ascq = 0xff; + if (pg->mrie == SIEP_MRIE_UA) { + ctl_est_ua_all(lun, -1, CTL_UA_IE); + lun->ie_reported = 1; + } else { + ctl_clr_ua_all(lun, -1, CTL_UA_IE); + lun->ie_reported = -1; + } + lun->ie_reportcnt = 1; + if (lun->ie_reportcnt < scsi_4btoul(pg->report_count)) { + lun->ie_reportcnt++; + t = scsi_4btoul(pg->interval_timer); + if (t == 0 || t == UINT32_MAX) + t = 3000; /* 5 min */ + callout_reset(&lun->ie_callout, t * hz / 10, + ctl_ie_timer, lun); + } + } else { + lun->ie_asc = 0; + lun->ie_ascq = 0; + lun->ie_reported = 1; + ctl_clr_ua_all(lun, -1, CTL_UA_IE); + lun->ie_reportcnt = UINT32_MAX; + callout_stop(&lun->ie_callout); } - return (0); + mtx_unlock(&lun->lun_lock); + return (CTL_RETVAL_COMPLETE); } - static int ctl_do_mode_select(union ctl_io *io) { @@ -6824,8 +6751,27 @@ ctl_sap_log_sense_handler(struct ctl_scs sizeof(struct scsi_log_param_header); scsi_ulto4b(3, data->ti.exponent); scsi_ulto4b(1, data->ti.integer); + return (0); +} - page_index->page_len = sizeof(*data); +int +ctl_ie_log_sense_handler(struct ctl_scsiio *ctsio, + struct ctl_page_index *page_index, + int pc) +{ + struct ctl_lun *lun; + struct scsi_log_informational_exceptions *data; + + lun = (struct ctl_lun *)ctsio->io_hdr.ctl_private[CTL_PRIV_LUN].ptr; + data = (struct scsi_log_informational_exceptions *)page_index->page_data; + + scsi_ulto2b(SLP_IE_GEN, data->hdr.param_code); + data->hdr.param_control = SLP_LBIN; + data->hdr.param_len = sizeof(struct scsi_log_informational_exceptions) - + sizeof(struct scsi_log_param_header); + data->ie_asc = lun->ie_asc; + data->ie_ascq = lun->ie_ascq; + data->temperature = 0xff; return (0); } @@ -9265,6 +9211,7 @@ ctl_request_sense(struct ctl_scsiio *cts int have_error; scsi_sense_data_type sense_format; ctl_ua_type ua_type; + uint8_t asc = 0, ascq = 0; cdb = (struct scsi_request_sense *)ctsio->cdb; @@ -9383,19 +9330,23 @@ ctl_request_sense(struct ctl_scsiio *cts return (CTL_RETVAL_COMPLETE); } -no_sense: - /* * No sense information to report, so we report that everything is - * okay. + * okay, unless we have allowed Informational Exception. */ + if (lun->mode_pages.ie_page[CTL_PAGE_CURRENT].mrie != SIEP_MRIE_NO) { + asc = lun->ie_asc; + ascq = lun->ie_ascq; + } + +no_sense: ctl_set_sense_data(sense_ptr, lun, sense_format, /*current_error*/ 1, /*sense_key*/ SSD_KEY_NO_SENSE, - /*asc*/ 0x00, - /*ascq*/ 0x00, + /*asc*/ asc, + /*ascq*/ ascq, SSD_ELEM_NONE); /* @@ -13265,6 +13216,37 @@ ctl_process_done(union ctl_io *io) mtx_lock(&lun->lun_lock); /* + * Check to see if we have any informational exception and status + * of this command can be modified to report it in form of either + * RECOVERED ERROR or NO SENSE, depending on MRIE mode page field. + */ + if (lun->ie_reported == 0 && lun->ie_asc != 0 && + io->io_hdr.status == CTL_SUCCESS && + (io->io_hdr.flags & CTL_FLAG_STATUS_SENT) == 0) { + uint8_t mrie = lun->mode_pages.ie_page[CTL_PAGE_CURRENT].mrie; + uint8_t per = + ((lun->mode_pages.rw_er_page[CTL_PAGE_CURRENT].byte3 & + SMS_RWER_PER) || + (lun->mode_pages.verify_er_page[CTL_PAGE_CURRENT].byte3 & + SMS_VER_PER)); + if (((mrie == SIEP_MRIE_REC_COND && per) || + mrie == SIEP_MRIE_REC_UNCOND || + mrie == SIEP_MRIE_NO_SENSE) && + (ctl_get_cmd_entry(&io->scsiio, NULL)->flags & + CTL_CMD_FLAG_NO_SENSE) == 0) { + ctl_set_sense(&io->scsiio, + /*current_error*/ 1, + /*sense_key*/ (mrie == SIEP_MRIE_NO_SENSE) ? + SSD_KEY_NO_SENSE : SSD_KEY_RECOVERED_ERROR, + /*asc*/ lun->ie_asc, + /*ascq*/ lun->ie_ascq, + SSD_ELEM_NONE); + lun->ie_reported = 1; + } + } else if (lun->ie_reported < 0) + lun->ie_reported = 0; + + /* * Check to see if we have any errors to inject here. We only * inject errors for commands that don't already have errors set. */ @@ -13537,10 +13519,6 @@ ctl_done(union ctl_io *io) #ifdef CTL_IO_DELAY if (io->io_hdr.flags & CTL_FLAG_DELAY_DONE) { - struct ctl_lun *lun; - - lun =(struct ctl_lun *)io->io_hdr.ctl_private[CTL_PRIV_LUN].ptr; - io->io_hdr.flags &= ~CTL_FLAG_DELAY_DONE; } else { struct ctl_lun *lun; Modified: head/sys/cam/ctl/ctl.h ============================================================================== --- head/sys/cam/ctl/ctl.h Mon Dec 19 10:00:56 2016 (r310256) +++ head/sys/cam/ctl/ctl.h Mon Dec 19 10:25:47 2016 (r310257) @@ -127,7 +127,8 @@ typedef enum { CTL_UA_ASYM_ACC_CHANGE = 0x2000, CTL_UA_CAPACITY_CHANGE = 0x4000, CTL_UA_THIN_PROV_THRES = 0x8000, - CTL_UA_MEDIUM_CHANGE = 0x10000 + CTL_UA_MEDIUM_CHANGE = 0x10000, + CTL_UA_IE = 0x20000 } ctl_ua_type; #ifdef _KERNEL @@ -154,23 +155,21 @@ int ctl_ffz(uint32_t *mask, uint32_t fir int ctl_set_mask(uint32_t *mask, uint32_t bit); int ctl_clear_mask(uint32_t *mask, uint32_t bit); int ctl_is_set(uint32_t *mask, uint32_t bit); -int ctl_caching_sp_handler(struct ctl_scsiio *ctsio, - struct ctl_page_index *page_index, uint8_t *page_ptr); -int ctl_control_page_handler(struct ctl_scsiio *ctsio, +int ctl_default_page_handler(struct ctl_scsiio *ctsio, struct ctl_page_index *page_index, uint8_t *page_ptr); -int ctl_debugconf_sp_sense_handler(struct ctl_scsiio *ctsio, - struct ctl_page_index *page_index, - int pc); -int ctl_debugconf_sp_select_handler(struct ctl_scsiio *ctsio, - struct ctl_page_index *page_index, - uint8_t *page_ptr); +int ctl_ie_page_handler(struct ctl_scsiio *ctsio, + struct ctl_page_index *page_index, + uint8_t *page_ptr); int ctl_lbp_log_sense_handler(struct ctl_scsiio *ctsio, struct ctl_page_index *page_index, int pc); int ctl_sap_log_sense_handler(struct ctl_scsiio *ctsio, struct ctl_page_index *page_index, int pc); +int ctl_ie_log_sense_handler(struct ctl_scsiio *ctsio, + struct ctl_page_index *page_index, + int pc); int ctl_config_move_done(union ctl_io *io); void ctl_datamove(union ctl_io *io); void ctl_serseq_done(union ctl_io *io); Modified: head/sys/cam/ctl/ctl_error.c ============================================================================== --- head/sys/cam/ctl/ctl_error.c Mon Dec 19 10:00:56 2016 (r310256) +++ head/sys/cam/ctl/ctl_error.c Mon Dec 19 10:25:47 2016 (r310257) @@ -84,7 +84,8 @@ ctl_set_sense_data_va(struct scsi_sense_ * on for that LUN. */ if ((lun != NULL) - && (lun->flags & CTL_LUN_SENSE_DESC)) + && (lun->mode_pages.control_page[CTL_PAGE_CURRENT].rlec & + SCP_DSENSE)) sense_format = SSD_TYPE_DESC; else sense_format = SSD_TYPE_FIXED; @@ -461,6 +462,11 @@ ctl_ua_to_acsq(struct ctl_lun *lun, ctl_ *asc = 0x28; *ascq = 0x00; break; + case CTL_UA_IE: + /* Informational exception */ + *asc = lun->ie_asc; + *ascq = lun->ie_ascq; + break; default: panic("%s: Unknown UA %x", __func__, ua_to_build); } Modified: head/sys/cam/ctl/ctl_private.h ============================================================================== --- head/sys/cam/ctl/ctl_private.h Mon Dec 19 10:00:56 2016 (r310256) +++ head/sys/cam/ctl/ctl_private.h Mon Dec 19 10:25:47 2016 (r310257) @@ -151,7 +151,6 @@ typedef enum { CTL_LUN_EJECTED = 0x080, CTL_LUN_PR_RESERVED = 0x100, CTL_LUN_PRIMARY_SC = 0x200, - CTL_LUN_SENSE_DESC = 0x400, CTL_LUN_READONLY = 0x800, CTL_LUN_PEER_SC_PRIMARY = 0x1000, CTL_LUN_REMOVABLE = 0x2000 @@ -272,30 +271,29 @@ struct ctl_logical_block_provisioning_pa static const struct ctl_page_index page_index_template[] = { {SMS_RW_ERROR_RECOVERY_PAGE, 0, sizeof(struct scsi_da_rw_recovery_page), NULL, - CTL_PAGE_FLAG_DIRECT | CTL_PAGE_FLAG_CDROM, NULL, NULL}, + CTL_PAGE_FLAG_DIRECT | CTL_PAGE_FLAG_CDROM, NULL, ctl_default_page_handler}, {SMS_FORMAT_DEVICE_PAGE, 0, sizeof(struct scsi_format_page), NULL, CTL_PAGE_FLAG_DIRECT, NULL, NULL}, {SMS_RIGID_DISK_PAGE, 0, sizeof(struct scsi_rigid_disk_page), NULL, CTL_PAGE_FLAG_DIRECT, NULL, NULL}, + {SMS_VERIFY_ERROR_RECOVERY_PAGE, 0, sizeof(struct scsi_da_verify_recovery_page), NULL, + CTL_PAGE_FLAG_DIRECT | CTL_PAGE_FLAG_CDROM, NULL, ctl_default_page_handler}, {SMS_CACHING_PAGE, 0, sizeof(struct scsi_caching_page), NULL, CTL_PAGE_FLAG_DIRECT | CTL_PAGE_FLAG_CDROM, - NULL, ctl_caching_sp_handler}, + NULL, ctl_default_page_handler}, {SMS_CONTROL_MODE_PAGE, 0, sizeof(struct scsi_control_page), NULL, - CTL_PAGE_FLAG_ALL, NULL, ctl_control_page_handler}, + CTL_PAGE_FLAG_ALL, NULL, ctl_default_page_handler}, {SMS_CONTROL_MODE_PAGE | SMPH_SPF, 0x01, sizeof(struct scsi_control_ext_page), NULL, CTL_PAGE_FLAG_ALL, NULL, NULL}, {SMS_INFO_EXCEPTIONS_PAGE, 0, sizeof(struct scsi_info_exceptions_page), NULL, - CTL_PAGE_FLAG_ALL, NULL, NULL}, + CTL_PAGE_FLAG_ALL, NULL, ctl_ie_page_handler}, {SMS_INFO_EXCEPTIONS_PAGE | SMPH_SPF, 0x02, sizeof(struct ctl_logical_block_provisioning_page), NULL, CTL_PAGE_FLAG_DIRECT, NULL, NULL}, {SMS_CDDVD_CAPS_PAGE, 0, sizeof(struct scsi_cddvd_capabilities_page), NULL, CTL_PAGE_FLAG_CDROM, NULL, NULL}, - {SMS_VENDOR_SPECIFIC_PAGE | SMPH_SPF, DBGCNF_SUBPAGE_CODE, - sizeof(struct copan_debugconf_subpage), NULL, CTL_PAGE_FLAG_ALL, - ctl_debugconf_sp_sense_handler, ctl_debugconf_sp_select_handler}, }; #define CTL_NUM_MODE_PAGES sizeof(page_index_template)/ \ @@ -305,13 +303,13 @@ struct ctl_mode_pages { struct scsi_da_rw_recovery_page rw_er_page[4]; struct scsi_format_page format_page[4]; struct scsi_rigid_disk_page rigid_disk_page[4]; + struct scsi_da_verify_recovery_page verify_er_page[4]; struct scsi_caching_page caching_page[4]; struct scsi_control_page control_page[4]; struct scsi_control_ext_page control_ext_page[4]; struct scsi_info_exceptions_page ie_page[4]; struct ctl_logical_block_provisioning_page lbp_page[4]; struct scsi_cddvd_capabilities_page cddvd_page[4]; - struct copan_debugconf_subpage debugconf_subpage[4]; struct ctl_page_index index[CTL_NUM_MODE_PAGES]; }; @@ -324,6 +322,8 @@ static const struct ctl_page_index log_p CTL_PAGE_FLAG_DIRECT, ctl_lbp_log_sense_handler, NULL}, {SLS_STAT_AND_PERF, 0, 0, NULL, CTL_PAGE_FLAG_ALL, ctl_sap_log_sense_handler, NULL}, + {SLS_IE_PAGE, 0, 0, NULL, + CTL_PAGE_FLAG_ALL, ctl_ie_log_sense_handler, NULL}, }; #define CTL_NUM_LOG_PAGES sizeof(log_page_index_template)/ \ @@ -338,6 +338,7 @@ struct ctl_log_pages { struct scsi_log_idle_time it; struct scsi_log_time_interval ti; } stat_page; + struct scsi_log_informational_exceptions ie_page; struct ctl_page_index index[CTL_NUM_LOG_PAGES]; }; @@ -385,6 +386,11 @@ struct ctl_lun { ctl_ua_type *pending_ua[CTL_MAX_PORTS]; uint8_t ua_tpt_info[8]; time_t lasttpt; + uint8_t ie_asc; /* Informational exceptions */ + uint8_t ie_ascq; + int ie_reported; /* Already reported */ + uint32_t ie_reportcnt; /* REPORT COUNT */ + struct callout ie_callout; /* INTERVAL TIMER */ struct ctl_mode_pages mode_pages; struct ctl_log_pages log_pages; struct ctl_lun_io_stats stats; Modified: head/sys/cam/scsi/scsi_all.h ============================================================================== --- head/sys/cam/scsi/scsi_all.h Mon Dec 19 10:00:56 2016 (r310256) +++ head/sys/cam/scsi/scsi_all.h Mon Dec 19 10:25:47 2016 (r310257) @@ -662,6 +662,14 @@ struct scsi_log_fua_stat_and_perf { uint8_t fuanv_write_int[8]; }; +struct scsi_log_informational_exceptions { + struct scsi_log_param_header hdr; +#define SLP_IE_GEN 0x0000 + uint8_t ie_asc; + uint8_t ie_ascq; + uint8_t temperature; +}; + struct scsi_control_page { u_int8_t page_code; u_int8_t page_length; @@ -765,21 +773,6 @@ struct scsi_caching_page { uint8_t non_cache_seg_size[3]; }; -/* - * XXX KDM move this off to a vendor shim. - */ -struct copan_debugconf_subpage { - uint8_t page_code; -#define DBGCNF_PAGE_CODE 0x00 - uint8_t subpage; -#define DBGCNF_SUBPAGE_CODE 0xF0 - uint8_t page_length[2]; - uint8_t page_version; -#define DBGCNF_VERSION 0x00 - uint8_t ctl_time_io_secs[2]; -}; - - struct scsi_info_exceptions_page { u_int8_t page_code; #define SIEP_PAGE_SAVABLE 0x80 /* Page is savable */ @@ -793,6 +786,12 @@ struct scsi_info_exceptions_page { #define SIEP_FLAGS_EBACKERR 0x02 #define SIEP_FLAGS_LOGERR 0x01 u_int8_t mrie; +#define SIEP_MRIE_NO 0x00 +#define SIEP_MRIE_UA 0x02 +#define SIEP_MRIE_REC_COND 0x03 +#define SIEP_MRIE_REC_UNCOND 0x04 +#define SIEP_MRIE_NO_SENSE 0x05 +#define SIEP_MRIE_ON_REQ 0x06 u_int8_t interval_timer[4]; u_int8_t report_count[4]; }; Modified: head/sys/cam/scsi/scsi_da.h ============================================================================== --- head/sys/cam/scsi/scsi_da.h Mon Dec 19 10:00:56 2016 (r310256) +++ head/sys/cam/scsi/scsi_da.h Mon Dec 19 10:25:47 2016 (r310257) @@ -634,6 +634,20 @@ struct scsi_da_rw_recovery_page { u_int8_t recovery_time_limit[2]; }; +struct scsi_da_verify_recovery_page { + u_int8_t page_code; +#define SMS_VERIFY_ERROR_RECOVERY_PAGE 0x07 + u_int8_t page_length; + u_int8_t byte3; +#define SMS_VER_EER 0x08 +#define SMS_VER_PER 0x04 +#define SMS_VER_DTE 0x02 +#define SMS_VER_DCR 0x01 + u_int8_t read_retry_count; + u_int8_t reserved[6]; + u_int8_t recovery_time_limit[2]; +}; + __BEGIN_DECLS /* * XXX These are only left out of the kernel build to silence warnings. If, From owner-svn-src-all@freebsd.org Mon Dec 19 11:02:51 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 22652C8784D; Mon, 19 Dec 2016 11:02:51 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id F11A594A; Mon, 19 Dec 2016 11:02:50 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBJB2oow020337; Mon, 19 Dec 2016 11:02:50 GMT (envelope-from ae@FreeBSD.org) Received: (from ae@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBJB2oS7020335; Mon, 19 Dec 2016 11:02:50 GMT (envelope-from ae@FreeBSD.org) Message-Id: <201612191102.uBJB2oS7020335@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ae set sender to ae@FreeBSD.org using -f From: "Andrey V. Elsukov" Date: Mon, 19 Dec 2016 11:02:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310258 - in head/sys: netinet netinet6 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Dec 2016 11:02:51 -0000 Author: ae Date: Mon Dec 19 11:02:49 2016 New Revision: 310258 URL: https://svnweb.freebsd.org/changeset/base/310258 Log: ip[6]_tryforward does inbound and outbound packet firewall processing. This can lead to change of mbuf pointer (packet filter could do m_pullup(), NAT, etc). Also in case of change of destination address, tryforward can decide that packet should be handled by local system. In this case modified mbuf can be returned to the ip[6]_input(). To handle this correctly, check M_FASTFWD_OURS flag after return from ip[6]_tryforward. And if it is present, update variables that depend from mbuf pointer and skip another inbound firewall processing. No objection from: #network MFC after: 3 weeks Sponsored by: Yandex LLC Differential Revision: https://reviews.freebsd.org/D8764 Modified: head/sys/netinet/ip_input.c head/sys/netinet6/ip6_input.c Modified: head/sys/netinet/ip_input.c ============================================================================== --- head/sys/netinet/ip_input.c Mon Dec 19 10:25:47 2016 (r310257) +++ head/sys/netinet/ip_input.c Mon Dec 19 11:02:49 2016 (r310258) @@ -550,24 +550,35 @@ tooshort: m_adj(m, ip_len - m->m_pkthdr.len); } - /* Try to forward the packet, but if we fail continue */ + /* + * Try to forward the packet, but if we fail continue. + * ip_tryforward() does inbound and outbound packet firewall + * processing. If firewall has decided that destination becomes + * our local address, it sets M_FASTFWD_OURS flag. In this + * case skip another inbound firewall processing and update + * ip pointer. + */ + if (V_ipforwarding != 0 #ifdef IPSEC - /* For now we do not handle IPSEC in tryforward. */ - if (!key_havesp(IPSEC_DIR_INBOUND) && !key_havesp(IPSEC_DIR_OUTBOUND) && - (V_ipforwarding == 1)) - if (ip_tryforward(m) == NULL) + && !key_havesp(IPSEC_DIR_INBOUND) + && !key_havesp(IPSEC_DIR_OUTBOUND) +#endif + ) { + if ((m = ip_tryforward(m)) == NULL) return; + if (m->m_flags & M_FASTFWD_OURS) { + m->m_flags &= ~M_FASTFWD_OURS; + ip = mtod(m, struct ip *); + goto ours; + } + } +#ifdef IPSEC /* * Bypass packet filtering for packets previously handled by IPsec. */ if (ip_ipsec_filtertunnel(m)) goto passin; -#else - if (V_ipforwarding == 1) - if (ip_tryforward(m) == NULL) - return; -#endif /* IPSEC */ - +#endif /* * Run through list of hooks for input packets. * Modified: head/sys/netinet6/ip6_input.c ============================================================================== --- head/sys/netinet6/ip6_input.c Mon Dec 19 10:25:47 2016 (r310257) +++ head/sys/netinet6/ip6_input.c Mon Dec 19 11:02:49 2016 (r310258) @@ -726,23 +726,36 @@ ip6_input(struct mbuf *m) goto bad; } #endif - /* Try to forward the packet, but if we fail continue */ + /* + * Try to forward the packet, but if we fail continue. + * ip6_tryforward() does inbound and outbound packet firewall + * processing. If firewall has decided that destination becomes + * our local address, it sets M_FASTFWD_OURS flag. In this + * case skip another inbound firewall processing and update + * ip6 pointer. + */ + if (V_ip6_forwarding != 0 #ifdef IPSEC - if (V_ip6_forwarding != 0 && !key_havesp(IPSEC_DIR_INBOUND) && - !key_havesp(IPSEC_DIR_OUTBOUND)) - if (ip6_tryforward(m) == NULL) + && !key_havesp(IPSEC_DIR_INBOUND) + && !key_havesp(IPSEC_DIR_OUTBOUND) +#endif + ) { + if ((m = ip6_tryforward(m)) == NULL) return; + if (m->m_flags & M_FASTFWD_OURS) { + m->m_flags &= ~M_FASTFWD_OURS; + ours = 1; + ip6 = mtod(m, struct ip6_hdr *); + goto hbhcheck; + } + } +#ifdef IPSEC /* * Bypass packet filtering for packets previously handled by IPsec. */ if (ip6_ipsec_filtertunnel(m)) goto passin; -#else - if (V_ip6_forwarding != 0) - if (ip6_tryforward(m) == NULL) - return; -#endif /* IPSEC */ - +#endif /* * Run through list of hooks for input packets. * @@ -750,12 +763,12 @@ ip6_input(struct mbuf *m) * (e.g. by NAT rewriting). When this happens, * tell ip6_forward to do the right thing. */ - odst = ip6->ip6_dst; /* Jump over all PFIL processing if hooks are not active. */ if (!PFIL_HOOKED(&V_inet6_pfil_hook)) goto passin; + odst = ip6->ip6_dst; if (pfil_run_hooks(&V_inet6_pfil_hook, &m, m->m_pkthdr.rcvif, PFIL_IN, NULL)) return; From owner-svn-src-all@freebsd.org Mon Dec 19 11:44:43 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 22D78C87235; Mon, 19 Dec 2016 11:44:43 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id F19381D6F; Mon, 19 Dec 2016 11:44:42 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBJBigDl037569; Mon, 19 Dec 2016 11:44:42 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBJBigpN037568; Mon, 19 Dec 2016 11:44:42 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201612191144.uBJBigpN037568@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Mon, 19 Dec 2016 11:44:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310259 - head/sys/cam/ctl X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Dec 2016 11:44:43 -0000 Author: mav Date: Mon Dec 19 11:44:41 2016 New Revision: 310259 URL: https://svnweb.freebsd.org/changeset/base/310259 Log: Following SPC-5, make REQUEST SENSE report "Logical unit not supported" in returned parameter data for not accessible LUNs. MFC after: 2 weeks Modified: head/sys/cam/ctl/ctl.c Modified: head/sys/cam/ctl/ctl.c ============================================================================== --- head/sys/cam/ctl/ctl.c Mon Dec 19 11:02:49 2016 (r310258) +++ head/sys/cam/ctl/ctl.c Mon Dec 19 11:44:41 2016 (r310259) @@ -9205,7 +9205,7 @@ ctl_request_sense(struct ctl_scsiio *cts { struct scsi_request_sense *cdb; struct scsi_sense_data *sense_ptr; - struct ctl_softc *ctl_softc; + struct ctl_softc *softc; struct ctl_lun *lun; uint32_t initidx; int have_error; @@ -9215,7 +9215,7 @@ ctl_request_sense(struct ctl_scsiio *cts cdb = (struct scsi_request_sense *)ctsio->cdb; - ctl_softc = control_softc; + softc = control_softc; lun = (struct ctl_lun *)ctsio->io_hdr.ctl_private[CTL_PRIV_LUN].ptr; CTL_DEBUG_PRINT(("ctl_request_sense\n")); @@ -9248,8 +9248,18 @@ ctl_request_sense(struct ctl_scsiio *cts /* * If we don't have a LUN, we don't have any pending sense. */ - if (lun == NULL) - goto no_sense; + if (lun == NULL || + ((lun->flags & CTL_LUN_PRIMARY_SC) == 0 && + softc->ha_link < CTL_HA_LINK_UNKNOWN)) { + /* "Logical unit not supported" */ + ctl_set_sense_data(sense_ptr, NULL, sense_format, + /*current_error*/ 1, + /*sense_key*/ SSD_KEY_ILLEGAL_REQUEST, + /*asc*/ 0x25, + /*ascq*/ 0x00, + SSD_ELEM_NONE); + goto send; + } have_error = 0; initidx = ctl_get_initindex(&ctsio->io_hdr.nexus); @@ -9297,61 +9307,39 @@ ctl_request_sense(struct ctl_scsiio *cts have_error = 1; } else #endif - { + if (have_error == 0) { ua_type = ctl_build_ua(lun, initidx, sense_ptr, sense_format); if (ua_type != CTL_UA_NONE) have_error = 1; if (ua_type == CTL_UA_LUN_CHANGE) { mtx_unlock(&lun->lun_lock); - mtx_lock(&ctl_softc->ctl_lock); - ctl_clr_ua_allluns(ctl_softc, initidx, ua_type); - mtx_unlock(&ctl_softc->ctl_lock); + mtx_lock(&softc->ctl_lock); + ctl_clr_ua_allluns(softc, initidx, ua_type); + mtx_unlock(&softc->ctl_lock); mtx_lock(&lun->lun_lock); } - } - mtx_unlock(&lun->lun_lock); - - /* - * We already have a pending error, return it. - */ - if (have_error != 0) { + if (have_error == 0) { /* - * We report the SCSI status as OK, since the status of the - * request sense command itself is OK. - * We report 0 for the sense length, because we aren't doing - * autosense in this case. We're reporting sense as - * parameter data. + * Report informational exception if have one and allowed. */ - ctl_set_success(ctsio); - ctsio->io_hdr.flags |= CTL_FLAG_ALLOCATED; - ctsio->be_move_done = ctl_config_move_done; - ctl_datamove((union ctl_io *)ctsio); - return (CTL_RETVAL_COMPLETE); + if (lun->mode_pages.ie_page[CTL_PAGE_CURRENT].mrie != SIEP_MRIE_NO) { + asc = lun->ie_asc; + ascq = lun->ie_ascq; + } + ctl_set_sense_data(sense_ptr, lun, sense_format, + /*current_error*/ 1, + /*sense_key*/ SSD_KEY_NO_SENSE, + /*asc*/ asc, + /*ascq*/ ascq, + SSD_ELEM_NONE); } + mtx_unlock(&lun->lun_lock); +send: /* - * No sense information to report, so we report that everything is - * okay, unless we have allowed Informational Exception. - */ - if (lun->mode_pages.ie_page[CTL_PAGE_CURRENT].mrie != SIEP_MRIE_NO) { - asc = lun->ie_asc; - ascq = lun->ie_ascq; - } - -no_sense: - ctl_set_sense_data(sense_ptr, - lun, - sense_format, - /*current_error*/ 1, - /*sense_key*/ SSD_KEY_NO_SENSE, - /*asc*/ asc, - /*ascq*/ ascq, - SSD_ELEM_NONE); - - /* - * We report 0 for the sense length, because we aren't doing - * autosense in this case. We're reporting sense as parameter data. + * We report the SCSI status as OK, since the status of the command + * itself is OK. We're reporting sense as parameter data. */ ctl_set_success(ctsio); ctsio->io_hdr.flags |= CTL_FLAG_ALLOCATED; From owner-svn-src-all@freebsd.org Mon Dec 19 12:20:59 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E7265C86664; Mon, 19 Dec 2016 12:20:59 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A90F51599; Mon, 19 Dec 2016 12:20:59 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBJCKwWS050326; Mon, 19 Dec 2016 12:20:58 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBJCKwO6050325; Mon, 19 Dec 2016 12:20:58 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <201612191220.uBJCKwO6050325@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Mon, 19 Dec 2016 12:20:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r310260 - stable/11/share/man/man9 X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Dec 2016 12:21:00 -0000 Author: trasz Date: Mon Dec 19 12:20:58 2016 New Revision: 310260 URL: https://svnweb.freebsd.org/changeset/base/310260 Log: MFC r308637: Fix function prototypes in usbdi(9) man page, and tweak it a little. Modified: stable/11/share/man/man9/usbdi.9 Directory Properties: stable/11/ (props changed) Modified: stable/11/share/man/man9/usbdi.9 ============================================================================== --- stable/11/share/man/man9/usbdi.9 Mon Dec 19 11:44:41 2016 (r310259) +++ stable/11/share/man/man9/usbdi.9 Mon Dec 19 12:20:58 2016 (r310260) @@ -24,7 +24,7 @@ .\" SUCH DAMAGE. .\" .\" $FreeBSD$ -.Dd June 24, 2009 +.Dd November 14, 2016 .Dt USBDI 9 .Os .Sh NAME @@ -84,60 +84,40 @@ .In dev/usb/usb.h .In dev/usb/usbdi.h .In dev/usb/usbdi_util.h -.Sh DESCRIPTION -The Universal Serial Bus (USB) driver programming interface provides -USB peripheral drivers with a host controller independent API for -controlling and communicating with USB peripherals. -The -.Nm usb -module supports both USB Host and USB Device side mode. -. -.Sh USB KERNEL PROGRAMMING -Here is a list of commonly used functions: -.Pp -. .Ft "usb_error_t" .Fo "usbd_transfer_setup" -.Fa "udev" -.Fa "ifaces" -.Fa "pxfer" -.Fa "setup_start" -.Fa "n_setup" -.Fa "priv_sc" -.Fa "priv_mtx" +.Fa "struct usb_device *udev" +.Fa "const uint8_t *ifaces" +.Fa "struct usb_xfer **pxfer" +.Fa "const struct usb_config *setup_start" +.Fa "uint16_t n_setup" +.Fa "void *priv_sc" +.Fa "struct mtx *priv_mtx" .Fc -. -.Pp -. .Ft "void" .Fo "usbd_transfer_unsetup" -.Fa "pxfer" -.Fa "n_setup" +.Fa "struct usb_xfer **pxfer" +.Fa "uint16_t n_setup" .Fc -. -.Pp -. .Ft "void" .Fo "usbd_transfer_start" -.Fa "xfer" +.Fa "struct usb_xfer *xfer" .Fc -. -.Pp -. .Ft "void" .Fo "usbd_transfer_stop" -.Fa "xfer" +.Fa "struct usb_xfer *xfer" .Fc -. -.Pp -. .Ft "void" .Fo "usbd_transfer_drain" -.Fa "xfer" +.Fa "struct usb_xfer *xfer" .Fc -. -. -. +.Sh DESCRIPTION +The Universal Serial Bus (USB) driver programming interface provides +USB peripheral drivers with a host controller independent API for +controlling and communicating with USB peripherals. +The +.Nm usb +module supports both USB Host and USB Device side mode. .Sh USB TRANSFER MANAGEMENT FUNCTIONS The USB standard defines four types of USB transfers. . @@ -552,7 +532,7 @@ for the 8-bytes of SETUP header. These 8-bytes are not counted by the "xfer->max_data_length" variable. . -This flag can not be changed during operation. +This flag cannot be changed during operation. . . .It ext_buffer @@ -561,7 +541,7 @@ allocated. . Instead the USB client must supply a data buffer. . -This flag can not be changed during operation. +This flag cannot be changed during operation. . . .It manual_status @@ -579,7 +559,7 @@ This flag can be changed during operatio . .It no_pipe_ok Setting this flag causes the USB_ERR_NO_PIPE error to be ignored. -This flag can not be changed during operation. +This flag cannot be changed during operation. . . .It stall_pipe From owner-svn-src-all@freebsd.org Mon Dec 19 12:22:33 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 94B22C86874; Mon, 19 Dec 2016 12:22:33 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 5D172193A; Mon, 19 Dec 2016 12:22:33 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBJCMW8W054110; Mon, 19 Dec 2016 12:22:32 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBJCMW9g054109; Mon, 19 Dec 2016 12:22:32 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <201612191222.uBJCMW9g054109@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Mon, 19 Dec 2016 12:22:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r310261 - stable/11/sys/fs/autofs X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Dec 2016 12:22:33 -0000 Author: trasz Date: Mon Dec 19 12:22:32 2016 New Revision: 310261 URL: https://svnweb.freebsd.org/changeset/base/310261 Log: MFC r308611: Remove spurious space. Modified: stable/11/sys/fs/autofs/autofs.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/fs/autofs/autofs.c ============================================================================== --- stable/11/sys/fs/autofs/autofs.c Mon Dec 19 12:20:58 2016 (r310260) +++ stable/11/sys/fs/autofs/autofs.c Mon Dec 19 12:22:32 2016 (r310261) @@ -61,7 +61,7 @@ */ #include - __FBSDID("$FreeBSD$"); +__FBSDID("$FreeBSD$"); #include #include From owner-svn-src-all@freebsd.org Mon Dec 19 12:25:32 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1E38FC86917; Mon, 19 Dec 2016 12:25:32 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E13DF1AE3; Mon, 19 Dec 2016 12:25:31 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBJCPVOO054263; Mon, 19 Dec 2016 12:25:31 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBJCPV3M054262; Mon, 19 Dec 2016 12:25:31 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <201612191225.uBJCPV3M054262@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Mon, 19 Dec 2016 12:25:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r310262 - stable/11/lib/libc/sys X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Dec 2016 12:25:32 -0000 Author: trasz Date: Mon Dec 19 12:25:30 2016 New Revision: 310262 URL: https://svnweb.freebsd.org/changeset/base/310262 Log: MFC r308386: Document that getfsstat(2) called with MNT_NOWAIT skips file systems that are in the process of being unmounted. Modified: stable/11/lib/libc/sys/getfsstat.2 Directory Properties: stable/11/ (props changed) Modified: stable/11/lib/libc/sys/getfsstat.2 ============================================================================== --- stable/11/lib/libc/sys/getfsstat.2 Mon Dec 19 12:22:32 2016 (r310261) +++ stable/11/lib/libc/sys/getfsstat.2 Mon Dec 19 12:25:30 2016 (r310262) @@ -28,7 +28,7 @@ .\" @(#)getfsstat.2 8.3 (Berkeley) 5/25/95 .\" $FreeBSD$ .\" -.Dd November 20, 2003 +.Dd November 6, 2016 .Dt GETFSSTAT 2 .Os .Sh NAME @@ -88,6 +88,8 @@ Thus, some of the information will be ou .Fn getfsstat will not block waiting for information from a file system that is unable to respond. +It will also skip any file system that is in the process of being +unmounted, even if the unmount would eventually fail. .Sh RETURN VALUES Upon successful completion, the number of .Fa statfs From owner-svn-src-all@freebsd.org Mon Dec 19 12:27:02 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C1EB3C869B6; Mon, 19 Dec 2016 12:27:02 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 90EDD1C66; Mon, 19 Dec 2016 12:27:02 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBJCR1SM054372; Mon, 19 Dec 2016 12:27:01 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBJCR13v054371; Mon, 19 Dec 2016 12:27:01 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <201612191227.uBJCR13v054371@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Mon, 19 Dec 2016 12:27:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r310263 - stable/11/usr.sbin/iostat X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Dec 2016 12:27:02 -0000 Author: trasz Date: Mon Dec 19 12:27:01 2016 New Revision: 310263 URL: https://svnweb.freebsd.org/changeset/base/310263 Log: MFC r306095: Make the "r/s" and "w/s" fields in "iostat -x" a little bit wider; five chars is way too narrow for todays disks. Modified: stable/11/usr.sbin/iostat/iostat.c Directory Properties: stable/11/ (props changed) Modified: stable/11/usr.sbin/iostat/iostat.c ============================================================================== --- stable/11/usr.sbin/iostat/iostat.c Mon Dec 19 12:25:30 2016 (r310262) +++ stable/11/usr.sbin/iostat/iostat.c Mon Dec 19 12:27:01 2016 (r310263) @@ -807,7 +807,7 @@ devstats(int perf_select, long double et printf(" cpu "); printf("\n"); if (Iflag == 0) { - printf("device r/s w/s kr/s kw/s " + printf("device r/s w/s kr/s kw/s " " ms/r ms/w ms/o ms/t qlen %%b "); } else { printf("device r/i w/i kr/i" @@ -884,7 +884,7 @@ devstats(int perf_select, long double et mb_per_second_write > ((long double).0005)/1024 || busy_pct > 0.5) { if (Iflag == 0) - printf("%-8.8s %5d %5d %8.1Lf " + printf("%-8.8s %7d %7d %8.1Lf " "%8.1Lf %5d %5d %5d %5d " "%4" PRIu64 " %3.0Lf ", devicename, From owner-svn-src-all@freebsd.org Mon Dec 19 13:14:40 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C532AC87776; Mon, 19 Dec 2016 13:14:40 +0000 (UTC) (envelope-from kadesai@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 6187D6CB; Mon, 19 Dec 2016 13:14:40 +0000 (UTC) (envelope-from kadesai@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBJDEdMq074996; Mon, 19 Dec 2016 13:14:39 GMT (envelope-from kadesai@FreeBSD.org) Received: (from kadesai@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBJDEdM2074992; Mon, 19 Dec 2016 13:14:39 GMT (envelope-from kadesai@FreeBSD.org) Message-Id: <201612191314.uBJDEdM2074992@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kadesai set sender to kadesai@FreeBSD.org using -f From: Kashyap D Desai Date: Mon, 19 Dec 2016 13:14:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r310264 - stable/10/sys/dev/mrsas X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Dec 2016 13:14:40 -0000 Author: kadesai Date: Mon Dec 19 13:14:39 2016 New Revision: 310264 URL: https://svnweb.freebsd.org/changeset/base/310264 Log: MFC r309284-r309294 r309294 This patch upgrades driver version to 06.712.04.00-fbsd r309293 This patch will add code to refire IOCTL commands after OCR. r309292 This patch will unblock SYNCHRONIZE_CACHE command to firmware, i.e. don't block the SYNCHRONIZE_CACHE command at driver instead of passing it to firmware for all Gen3 controllers. r309291 Wait for AEN task to be completed(if in queue) before resetting the controller and return without processing event in AEN thread, if controller reset is in progress. r309290 This patch will add task management support in driver. Below is high level description: If a SCSI IO times out, then before initiating OCR, now the driver will try to send a target reset to the particular target for which the IO is timed out. If that also fails, then the driver will initiate OCR. r309289 Process outstanding reply descriptors from all the reply descriptor post queues before initiating OCR. r309288 Clean up reference to AEN command if abort AEN is succesful as the command is aborted. Did the same by setting sc->aen_cmd = NULL when aborting AEN is successful. r309287 Update controller properties(read OCR capability bit) when MR_EVT_CTRL_PROP_CHANGED recieved. r309286 Add sanity check in IO and IOCTL path not to process command further if controller is in HW_CRITICAL_ERROR. r309285 Use a variable to indicate Gen3 controllers and remove all PCI ids based checks used for gen3 controllers. r309284 High level description of new solution - Free MFI and MPT command from same context. Free both the command either from process (from where mfi-mpt pass-through was called) or from ISR context. Do not split freeing of MFI and MPT, because it creates the race condition which will do MFI/MPT list. Modified: stable/10/sys/dev/mrsas/mrsas.c stable/10/sys/dev/mrsas/mrsas.h stable/10/sys/dev/mrsas/mrsas_cam.c stable/10/sys/dev/mrsas/mrsas_fp.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/mrsas/mrsas.c ============================================================================== --- stable/10/sys/dev/mrsas/mrsas.c Mon Dec 19 12:27:01 2016 (r310263) +++ stable/10/sys/dev/mrsas/mrsas.c Mon Dec 19 13:14:39 2016 (r310264) @@ -110,6 +110,7 @@ int mrsas_issue_polled(struct mrsas_soft int mrsas_reset_ctrl(struct mrsas_softc *sc, u_int8_t reset_reason); int mrsas_wait_for_outstanding(struct mrsas_softc *sc, u_int8_t check_reason); int mrsas_complete_cmd(struct mrsas_softc *sc, u_int32_t MSIxIndex); +int mrsas_reset_targets(struct mrsas_softc *sc); int mrsas_issue_blocked_cmd(struct mrsas_softc *sc, struct mrsas_mfi_cmd *cmd); @@ -153,7 +154,6 @@ extern void mrsas_cam_detach(struct mrsa extern void mrsas_cmd_done(struct mrsas_softc *sc, struct mrsas_mpt_cmd *cmd); extern void mrsas_free_frame(struct mrsas_softc *sc, struct mrsas_mfi_cmd *cmd); extern int mrsas_alloc_mfi_cmds(struct mrsas_softc *sc); -extern void mrsas_release_mpt_cmd(struct mrsas_mpt_cmd *cmd); extern struct mrsas_mpt_cmd *mrsas_get_mpt_cmd(struct mrsas_softc *sc); extern int mrsas_passthru(struct mrsas_softc *sc, void *arg, u_long ioctlCmd); extern uint8_t MR_ValidateMapInfo(struct mrsas_softc *sc); @@ -307,28 +307,11 @@ mrsas_enable_intr(struct mrsas_softc *sc static int mrsas_clear_intr(struct mrsas_softc *sc) { - u_int32_t status, fw_status, fw_state; + u_int32_t status; /* Read received interrupt */ status = mrsas_read_reg(sc, offsetof(mrsas_reg_set, outbound_intr_status)); - /* - * If FW state change interrupt is received, write to it again to - * clear - */ - if (status & MRSAS_FW_STATE_CHNG_INTERRUPT) { - fw_status = mrsas_read_reg(sc, offsetof(mrsas_reg_set, - outbound_scratch_pad)); - fw_state = fw_status & MFI_STATE_MASK; - if (fw_state == MFI_STATE_FAULT) { - device_printf(sc->mrsas_dev, "FW is in FAULT state!\n"); - if (sc->ocr_thread_active) - wakeup(&sc->ocr_chan); - } - mrsas_write_reg(sc, offsetof(mrsas_reg_set, outbound_intr_status), status); - mrsas_read_reg(sc, offsetof(mrsas_reg_set, outbound_intr_status)); - return (1); - } /* Not our interrupt, so just return */ if (!(status & MFI_FUSION_ENABLE_INTERRUPT_MASK)) return (0); @@ -449,6 +432,11 @@ mrsas_setup_sysctl(struct mrsas_softc *s OID_AUTO, "reset_in_progress", CTLFLAG_RD, &sc->reset_in_progress, 0, "ocr in progress status"); + SYSCTL_ADD_UINT(sysctl_ctx, SYSCTL_CHILDREN(sysctl_tree), + OID_AUTO, "block_sync_cache", CTLFLAG_RW, + &sc->block_sync_cache, 0, + "Block SYNC CACHE at driver. "); + } /* @@ -468,6 +456,7 @@ mrsas_get_tunables(struct mrsas_softc *s sc->mrsas_fw_fault_check_delay = 1; sc->reset_count = 0; sc->reset_in_progress = 0; + sc->block_sync_cache = 0; /* * Grab the global variables. @@ -674,16 +663,15 @@ mrsas_register_aen(struct mrsas_softc *s sc->aen_cmd); if (ret_val) { - printf("mrsas: Failed to abort " - "previous AEN command\n"); + printf("mrsas: Failed to abort previous AEN command\n"); return ret_val; - } + } else + sc->aen_cmd = NULL; } } cmd = mrsas_get_mfi_cmd(sc); - if (!cmd) - return -ENOMEM; + return ENOMEM; dcmd = &cmd->frame->dcmd; @@ -835,6 +823,15 @@ mrsas_attach(device_t dev) sc->mrsas_dev = dev; sc->device_id = pci_get_device(dev); + if ((sc->device_id == MRSAS_INVADER) || + (sc->device_id == MRSAS_FURY) || + (sc->device_id == MRSAS_INTRUDER) || + (sc->device_id == MRSAS_INTRUDER_24) || + (sc->device_id == MRSAS_CUTLASS_52) || + (sc->device_id == MRSAS_CUTLASS_53)) { + sc->mrsas_gen3_ctrl = 1; + } + mrsas_get_tunables(sc); /* @@ -875,6 +872,7 @@ mrsas_attach(device_t dev) TAILQ_INIT(&sc->mrsas_mfi_cmd_list_head); mrsas_atomic_set(&sc->fw_outstanding, 0); + mrsas_atomic_set(&sc->target_reset_outstanding, 0); sc->io_cmds_highwater = 0; @@ -953,8 +951,7 @@ mrsas_ich_startup(void *arg) /* * Intialize a counting Semaphore to take care no. of concurrent IOCTLs */ - sema_init(&sc->ioctl_count_sema, - MRSAS_MAX_MFI_CMDS - 5, + sema_init(&sc->ioctl_count_sema, MRSAS_MAX_IOCTL_CMDS, IOCTL_SEMA_DESCRIPTION); /* Create a /dev entry for mrsas controller. */ @@ -1070,7 +1067,7 @@ mrsas_detach(device_t dev) mtx_destroy(&sc->raidmap_lock); /* Wait for all the semaphores to be released */ - while (sema_value(&sc->ioctl_count_sema) != (MRSAS_MAX_MFI_CMDS - 5)) + while (sema_value(&sc->ioctl_count_sema) != MRSAS_MAX_IOCTL_CMDS) pause("mr_shutdown", hz); /* Destroy the counting semaphore created for Ioctl */ @@ -1353,9 +1350,11 @@ mrsas_ioctl(struct cdev *dev, u_long cmd if (!sc) return ENOENT; - if (sc->remove_in_progress) { + if (sc->remove_in_progress || + (sc->adprecovery == MRSAS_HW_CRITICAL_ERROR)) { mrsas_dprint(sc, MRSAS_INFO, - "Driver remove or shutdown called.\n"); + "Either driver remove or shutdown called or " + "HW is in unrecoverable critical error state.\n"); return ENOENT; } mtx_lock_spin(&sc->ioctl_lock); @@ -1547,7 +1546,10 @@ mrsas_complete_cmd(struct mrsas_softc *s PLD_LOAD_BALANCE_INFO lbinfo; u_int32_t device_id; int threshold_reply_count = 0; - +#if TM_DEBUG + MR_TASK_MANAGE_REQUEST *mr_tm_req; + MPI2_SCSI_TASK_MANAGE_REQUEST *mpi_tm_req; +#endif /* If we have a hardware error, not need to continue */ if (sc->adprecovery == MRSAS_HW_CRITICAL_ERROR) @@ -1574,6 +1576,16 @@ mrsas_complete_cmd(struct mrsas_softc *s extStatus = scsi_io_req->RaidContext.exStatus; switch (scsi_io_req->Function) { + case MPI2_FUNCTION_SCSI_TASK_MGMT: +#if TM_DEBUG + mr_tm_req = (MR_TASK_MANAGE_REQUEST *) cmd_mpt->io_request; + mpi_tm_req = (MPI2_SCSI_TASK_MANAGE_REQUEST *) + &mr_tm_req->TmRequest; + device_printf(sc->mrsas_dev, "TM completion type 0x%X, " + "TaskMID: 0x%X", mpi_tm_req->TaskType, mpi_tm_req->TaskMID); +#endif + wakeup_one((void *)&sc->ocr_chan); + break; case MPI2_FUNCTION_SCSI_IO_REQUEST: /* Fast Path IO. */ device_id = cmd_mpt->ccb_ptr->ccb_h.target_id; lbinfo = &sc->load_balance_info[device_id]; @@ -1591,9 +1603,16 @@ mrsas_complete_cmd(struct mrsas_softc *s break; case MRSAS_MPI2_FUNCTION_PASSTHRU_IO_REQUEST: /* MFI command */ cmd_mfi = sc->mfi_cmd_list[cmd_mpt->sync_cmd_idx]; - mrsas_complete_mptmfi_passthru(sc, cmd_mfi, status); - cmd_mpt->flags = 0; - mrsas_release_mpt_cmd(cmd_mpt); + /* + * Make sure NOT TO release the mfi command from the called + * function's context if it is fired with issue_polled call. + * And also make sure that the issue_polled call should only be + * used if INTERRUPT IS DISABLED. + */ + if (cmd_mfi->frame->hdr.flags & MFI_FRAME_DONT_POST_IN_REPLY_QUEUE) + mrsas_release_mfi_cmd(cmd_mfi); + else + mrsas_complete_mptmfi_passthru(sc, cmd_mfi, status); break; } @@ -1628,12 +1647,7 @@ mrsas_complete_cmd(struct mrsas_softc *s */ if (threshold_reply_count >= THRESHOLD_REPLY_COUNT) { if (sc->msix_enable) { - if ((sc->device_id == MRSAS_INVADER) || - (sc->device_id == MRSAS_FURY) || - (sc->device_id == MRSAS_INTRUDER) || - (sc->device_id == MRSAS_INTRUDER_24) || - (sc->device_id == MRSAS_CUTLASS_52) || - (sc->device_id == MRSAS_CUTLASS_53)) + if (sc->mrsas_gen3_ctrl) mrsas_write_reg(sc, sc->msix_reg_offset[MSIxIndex / 8], ((MSIxIndex & 0x7) << 24) | sc->last_reply_idx[MSIxIndex]); @@ -1654,12 +1668,7 @@ mrsas_complete_cmd(struct mrsas_softc *s /* Clear response interrupt */ if (sc->msix_enable) { - if ((sc->device_id == MRSAS_INVADER) || - (sc->device_id == MRSAS_FURY) || - (sc->device_id == MRSAS_INTRUDER) || - (sc->device_id == MRSAS_INTRUDER_24) || - (sc->device_id == MRSAS_CUTLASS_52) || - (sc->device_id == MRSAS_CUTLASS_53)) { + if (sc->mrsas_gen3_ctrl) { mrsas_write_reg(sc, sc->msix_reg_offset[MSIxIndex / 8], ((MSIxIndex & 0x7) << 24) | sc->last_reply_idx[MSIxIndex]); @@ -2434,12 +2443,21 @@ mrsas_ioc_init(struct mrsas_softc *sc) u_int8_t max_wait = MRSAS_IOC_INIT_WAIT_TIME; bus_addr_t phys_addr; int i, retcode = 0; + u_int32_t scratch_pad_2; /* Allocate memory for the IOC INIT command */ if (mrsas_alloc_ioc_cmd(sc)) { device_printf(sc->mrsas_dev, "Cannot allocate IOC command.\n"); return (1); } + + if (!sc->block_sync_cache) { + scratch_pad_2 = mrsas_read_reg(sc, offsetof(mrsas_reg_set, + outbound_scratch_pad_2)); + sc->fw_sync_cache_support = (scratch_pad_2 & + MR_CAN_HANDLE_SYNC_CACHE_OFFSET) ? 1 : 0; + } + IOCInitMsg = (pMpi2IOCInitRequest_t)(((char *)sc->ioc_init_mem) + 1024); IOCInitMsg->Function = MPI2_FUNCTION_IOC_INIT; IOCInitMsg->WhoInit = MPI2_WHOINIT_HOST_DRIVER; @@ -2457,12 +2475,7 @@ mrsas_ioc_init(struct mrsas_softc *sc) init_frame->flags |= MFI_FRAME_DONT_POST_IN_REPLY_QUEUE; /* driver support Extended MSIX */ - if ((sc->device_id == MRSAS_INVADER) || - (sc->device_id == MRSAS_FURY) || - (sc->device_id == MRSAS_INTRUDER) || - (sc->device_id == MRSAS_INTRUDER_24) || - (sc->device_id == MRSAS_CUTLASS_52) || - (sc->device_id == MRSAS_CUTLASS_53)) { + if (sc->mrsas_gen3_ctrl) { init_frame->driver_operations. mfi_capabilities.support_additional_msix = 1; } @@ -2584,7 +2597,7 @@ mrsas_alloc_mpt_cmds(struct mrsas_softc memset(cmd, 0, sizeof(struct mrsas_mpt_cmd)); cmd->index = i + 1; cmd->ccb_ptr = NULL; - callout_init(&cmd->cm_callout, 0); + callout_init_mtx(&cmd->cm_callout, &sc->sim_lock, 0); cmd->sync_cmd_idx = (u_int32_t)MRSAS_ULONG_MAX; cmd->sc = sc; cmd->io_request = (MRSAS_RAID_SCSI_IO_REQUEST *) (io_req_base + offset); @@ -2779,6 +2792,7 @@ mrsas_ocr_thread(void *arg) { struct mrsas_softc *sc; u_int32_t fw_status, fw_state; + u_int8_t tm_target_reset_failed = 0; sc = (struct mrsas_softc *)arg; @@ -2801,20 +2815,66 @@ mrsas_ocr_thread(void *arg) fw_status = mrsas_read_reg(sc, offsetof(mrsas_reg_set, outbound_scratch_pad)); fw_state = fw_status & MFI_STATE_MASK; - if (fw_state == MFI_STATE_FAULT || sc->do_timedout_reset) { - device_printf(sc->mrsas_dev, "%s started due to %s!\n", - sc->disableOnlineCtrlReset ? "Kill Adapter" : "OCR", - sc->do_timedout_reset ? "IO Timeout" : - "FW fault detected"); - mtx_lock_spin(&sc->ioctl_lock); - sc->reset_in_progress = 1; - sc->reset_count++; - mtx_unlock_spin(&sc->ioctl_lock); + if (fw_state == MFI_STATE_FAULT || sc->do_timedout_reset || + mrsas_atomic_read(&sc->target_reset_outstanding)) { + + /* First, freeze further IOs to come to the SIM */ mrsas_xpt_freeze(sc); - mrsas_reset_ctrl(sc, sc->do_timedout_reset); - mrsas_xpt_release(sc); - sc->reset_in_progress = 0; - sc->do_timedout_reset = 0; + + /* If this is an IO timeout then go for target reset */ + if (mrsas_atomic_read(&sc->target_reset_outstanding)) { + device_printf(sc->mrsas_dev, "Initiating Target RESET " + "because of SCSI IO timeout!\n"); + + /* Let the remaining IOs to complete */ + msleep(&sc->ocr_chan, &sc->sim_lock, PRIBIO, + "mrsas_reset_targets", 5 * hz); + + /* Try to reset the target device */ + if (mrsas_reset_targets(sc) == FAIL) + tm_target_reset_failed = 1; + } + + /* If this is a DCMD timeout or FW fault, + * then go for controller reset + */ + if (fw_state == MFI_STATE_FAULT || tm_target_reset_failed || + (sc->do_timedout_reset == MFI_DCMD_TIMEOUT_OCR)) { + if (tm_target_reset_failed) + device_printf(sc->mrsas_dev, "Initiaiting OCR because of " + "TM FAILURE!\n"); + else + device_printf(sc->mrsas_dev, "Initiaiting OCR " + "because of %s!\n", sc->do_timedout_reset ? + "DCMD IO Timeout" : "FW fault"); + + mtx_lock_spin(&sc->ioctl_lock); + sc->reset_in_progress = 1; + mtx_unlock_spin(&sc->ioctl_lock); + sc->reset_count++; + + /* + * Wait for the AEN task to be completed if it is running. + */ + mtx_unlock(&sc->sim_lock); + taskqueue_drain(sc->ev_tq, &sc->ev_task); + mtx_lock(&sc->sim_lock); + + taskqueue_block(sc->ev_tq); + /* Try to reset the controller */ + mrsas_reset_ctrl(sc, sc->do_timedout_reset); + + sc->do_timedout_reset = 0; + sc->reset_in_progress = 0; + tm_target_reset_failed = 0; + mrsas_atomic_set(&sc->target_reset_outstanding, 0); + memset(sc->target_reset_pool, 0, + sizeof(sc->target_reset_pool)); + taskqueue_unblock(sc->ev_tq); + } + + /* Now allow IOs to come to the SIM */ + mrsas_xpt_release(sc); } } mtx_unlock(&sc->sim_lock); @@ -2866,6 +2926,7 @@ mrsas_reset_ctrl(struct mrsas_softc *sc, struct mrsas_mfi_cmd *mfi_cmd; struct mrsas_mpt_cmd *mpt_cmd; union mrsas_evt_class_locale class_locale; + MRSAS_REQUEST_DESCRIPTOR_UNION *req_desc; if (sc->adprecovery == MRSAS_HW_CRITICAL_ERROR) { device_printf(sc->mrsas_dev, @@ -2993,13 +3054,25 @@ mrsas_reset_ctrl(struct mrsas_softc *sc, mpt_cmd = sc->mpt_cmd_list[j]; if (mpt_cmd->sync_cmd_idx != (u_int32_t)MRSAS_ULONG_MAX) { mfi_cmd = sc->mfi_cmd_list[mpt_cmd->sync_cmd_idx]; - mrsas_release_mfi_cmd(mfi_cmd); - mrsas_release_mpt_cmd(mpt_cmd); + /* If not an IOCTL then release the command else re-fire */ + if (!mfi_cmd->sync_cmd) { + mrsas_release_mfi_cmd(mfi_cmd); + } else { + req_desc = mrsas_get_request_desc(sc, + mfi_cmd->cmd_id.context.smid - 1); + mrsas_dprint(sc, MRSAS_OCR, + "Re-fire command DCMD opcode 0x%x index %d\n ", + mfi_cmd->frame->dcmd.opcode, j); + if (!req_desc) + device_printf(sc->mrsas_dev, + "Cannot build MPT cmd.\n"); + else + mrsas_fire_cmd(sc, req_desc->addr.u.low, + req_desc->addr.u.high); + } } } - sc->aen_cmd = NULL; - /* Reset load balance info */ memset(sc->load_balance_info, 0, sizeof(LD_LOAD_BALANCE_INFO) * MAX_LOGICAL_DRIVES_EXT); @@ -3014,17 +3087,6 @@ mrsas_reset_ctrl(struct mrsas_softc *sc, megasas_setup_jbod_map(sc); - memset(sc->pd_list, 0, - MRSAS_MAX_PD * sizeof(struct mrsas_pd_list)); - if (mrsas_get_pd_list(sc) != SUCCESS) { - device_printf(sc->mrsas_dev, "Get PD list failed from OCR.\n" - "Will get the latest PD LIST after OCR on event.\n"); - } - memset(sc->ld_ids, 0xff, MRSAS_MAX_LD_IDS); - if (mrsas_get_ld_list(sc) != SUCCESS) { - device_printf(sc->mrsas_dev, "Get LD lsit failed from OCR.\n" - "Will get the latest LD LIST after OCR on event.\n"); - } mrsas_clear_bit(MRSAS_FUSION_IN_RESET, &sc->reset_flags); mrsas_enable_intr(sc); sc->adprecovery = MRSAS_HBA_OPERATIONAL; @@ -3034,6 +3096,7 @@ mrsas_reset_ctrl(struct mrsas_softc *sc, class_locale.members.locale = MR_EVT_LOCALE_ALL; class_locale.members.class = MR_EVT_CLASS_DEBUG; + mtx_unlock(&sc->sim_lock); if (mrsas_register_aen(sc, sc->last_seq_num, class_locale.word)) { device_printf(sc->mrsas_dev, @@ -3043,6 +3106,8 @@ mrsas_reset_ctrl(struct mrsas_softc *sc, "or the controller does not support AEN.\n" "Please contact to the SUPPORT TEAM if the problem persists\n"); } + mtx_lock(&sc->sim_lock); + /* Adapter reset completed successfully */ device_printf(sc->mrsas_dev, "Reset successful\n"); retval = SUCCESS; @@ -3139,6 +3204,11 @@ mrsas_wait_for_outstanding(struct mrsas_ if (fw_state == MFI_STATE_FAULT) { mrsas_dprint(sc, MRSAS_OCR, "Found FW in FAULT state, will reset adapter.\n"); + count = sc->msix_vectors > 0 ? sc->msix_vectors : 1; + mtx_unlock(&sc->sim_lock); + for (MSIxIndex = 0; MSIxIndex < count; MSIxIndex++) + mrsas_complete_cmd(sc, MSIxIndex); + mtx_lock(&sc->sim_lock); retval = 1; goto out; } @@ -3156,8 +3226,10 @@ mrsas_wait_for_outstanding(struct mrsas_ mrsas_dprint(sc, MRSAS_OCR, "[%2d]waiting for %d " "commands to complete\n", i, outstanding); count = sc->msix_vectors > 0 ? sc->msix_vectors : 1; + mtx_unlock(&sc->sim_lock); for (MSIxIndex = 0; MSIxIndex < count; MSIxIndex++) mrsas_complete_cmd(sc, MSIxIndex); + mtx_lock(&sc->sim_lock); } DELAY(1000 * 1000); } @@ -3176,17 +3248,33 @@ out: * mrsas_release_mfi_cmd: Return a cmd to free command pool * input: Command packet for return to free cmd pool * - * This function returns the MFI command to the command list. + * This function returns the MFI & MPT command to the command list. */ void -mrsas_release_mfi_cmd(struct mrsas_mfi_cmd *cmd) +mrsas_release_mfi_cmd(struct mrsas_mfi_cmd *cmd_mfi) { - struct mrsas_softc *sc = cmd->sc; + struct mrsas_softc *sc = cmd_mfi->sc; + struct mrsas_mpt_cmd *cmd_mpt; + mtx_lock(&sc->mfi_cmd_pool_lock); - cmd->ccb_ptr = NULL; - cmd->cmd_id.frame_count = 0; - TAILQ_INSERT_TAIL(&(sc->mrsas_mfi_cmd_list_head), cmd, next); + /* + * Release the mpt command (if at all it is allocated + * associated with the mfi command + */ + if (cmd_mfi->cmd_id.context.smid) { + mtx_lock(&sc->mpt_cmd_pool_lock); + /* Get the mpt cmd from mfi cmd frame's smid value */ + cmd_mpt = sc->mpt_cmd_list[cmd_mfi->cmd_id.context.smid-1]; + cmd_mpt->flags = 0; + cmd_mpt->sync_cmd_idx = (u_int32_t)MRSAS_ULONG_MAX; + TAILQ_INSERT_HEAD(&(sc->mrsas_mpt_cmd_list_head), cmd_mpt, next); + mtx_unlock(&sc->mpt_cmd_pool_lock); + } + /* Release the mfi command */ + cmd_mfi->ccb_ptr = NULL; + cmd_mfi->cmd_id.frame_count = 0; + TAILQ_INSERT_HEAD(&(sc->mrsas_mfi_cmd_list_head), cmd_mfi, next); mtx_unlock(&sc->mfi_cmd_pool_lock); return; @@ -3235,7 +3323,11 @@ mrsas_get_ctrl_info(struct mrsas_softc * dcmd->sgl.sge32[0].phys_addr = sc->ctlr_info_phys_addr; dcmd->sgl.sge32[0].length = sizeof(struct mrsas_ctrl_info); - retcode = mrsas_issue_polled(sc, cmd); + if (!sc->mask_interrupts) + retcode = mrsas_issue_blocked_cmd(sc, cmd); + else + retcode = mrsas_issue_polled(sc, cmd); + if (retcode == ETIMEDOUT) goto dcmd_timeout; else @@ -3246,13 +3338,16 @@ mrsas_get_ctrl_info(struct mrsas_softc * sc->use_seqnum_jbod_fp = sc->ctrl_info->adapterOperations3.useSeqNumJbodFP; + sc->disableOnlineCtrlReset = + sc->ctrl_info->properties.OnOffProperties.disableOnlineCtrlReset; dcmd_timeout: mrsas_free_ctlr_info_cmd(sc); if (do_ocr) sc->do_timedout_reset = MFI_DCMD_TIMEOUT_OCR; - else + + if (!sc->mask_interrupts) mrsas_release_mfi_cmd(cmd); return (retcode); @@ -3495,12 +3590,7 @@ mrsas_build_mptmfi_passthru(struct mrsas io_req = mpt_cmd->io_request; - if ((sc->device_id == MRSAS_INVADER) || - (sc->device_id == MRSAS_FURY) || - (sc->device_id == MRSAS_INTRUDER) || - (sc->device_id == MRSAS_INTRUDER_24) || - (sc->device_id == MRSAS_CUTLASS_52) || - (sc->device_id == MRSAS_CUTLASS_53)) { + if (sc->mrsas_gen3_ctrl) { pMpi25IeeeSgeChain64_t sgl_ptr_end = (pMpi25IeeeSgeChain64_t)&io_req->SGL; sgl_ptr_end += sc->max_sge_in_main_msg - 1; @@ -3868,8 +3958,6 @@ megasas_sync_pd_seq_num(struct mrsas_sof dcmd_timeout: if (do_ocr) sc->do_timedout_reset = MFI_DCMD_TIMEOUT_OCR; - else - mrsas_release_mfi_cmd(cmd); return (retcode); } @@ -3946,8 +4034,6 @@ mrsas_get_ld_map_info(struct mrsas_softc retcode = mrsas_issue_polled(sc, cmd); if (retcode == ETIMEDOUT) sc->do_timedout_reset = MFI_DCMD_TIMEOUT_OCR; - else - mrsas_release_mfi_cmd(cmd); return (retcode); } @@ -3974,9 +4060,8 @@ mrsas_sync_map_info(struct mrsas_softc * cmd = mrsas_get_mfi_cmd(sc); if (!cmd) { - device_printf(sc->mrsas_dev, - "Cannot alloc for sync map info cmd\n"); - return 1; + device_printf(sc->mrsas_dev, "Cannot alloc for sync map info cmd\n"); + return ENOMEM; } map = sc->ld_drv_map[sc->map_id & 1]; num_lds = map->raidMap.ldCount; @@ -4076,7 +4161,11 @@ mrsas_get_pd_list(struct mrsas_softc *sc dcmd->sgl.sge32[0].phys_addr = pd_list_phys_addr; dcmd->sgl.sge32[0].length = MRSAS_MAX_PD * sizeof(struct MR_PD_LIST); - retcode = mrsas_issue_polled(sc, cmd); + if (!sc->mask_interrupts) + retcode = mrsas_issue_blocked_cmd(sc, cmd); + else + retcode = mrsas_issue_polled(sc, cmd); + if (retcode == ETIMEDOUT) goto dcmd_timeout; @@ -4107,7 +4196,8 @@ dcmd_timeout: if (do_ocr) sc->do_timedout_reset = MFI_DCMD_TIMEOUT_OCR; - else + + if (!sc->mask_interrupts) mrsas_release_mfi_cmd(cmd); return (retcode); @@ -4169,7 +4259,11 @@ mrsas_get_ld_list(struct mrsas_softc *sc dcmd->sgl.sge32[0].length = sizeof(struct MR_LD_LIST); dcmd->pad_0 = 0; - retcode = mrsas_issue_polled(sc, cmd); + if (!sc->mask_interrupts) + retcode = mrsas_issue_blocked_cmd(sc, cmd); + else + retcode = mrsas_issue_polled(sc, cmd); + if (retcode == ETIMEDOUT) goto dcmd_timeout; @@ -4195,7 +4289,7 @@ dcmd_timeout: if (do_ocr) sc->do_timedout_reset = MFI_DCMD_TIMEOUT_OCR; - else + if (!sc->mask_interrupts) mrsas_release_mfi_cmd(cmd); return (retcode); @@ -4359,6 +4453,11 @@ mrsas_aen_handler(struct mrsas_softc *sc printf("invalid instance!\n"); return; } + if (sc->remove_in_progress || sc->reset_in_progress) { + device_printf(sc->mrsas_dev, "Returning from %s, line no %d\n", + __func__, __LINE__); + return; + } if (sc->evt_detail_mem) { switch (sc->evt_detail_mem->code) { case MR_EVT_PD_INSERTED: @@ -4367,7 +4466,6 @@ mrsas_aen_handler(struct mrsas_softc *sc mrsas_bus_scan_sim(sc, sc->sim_1); else goto skip_register_aen; - doscan = 0; break; case MR_EVT_PD_REMOVED: fail_aen = mrsas_get_pd_list(sc); @@ -4375,13 +4473,11 @@ mrsas_aen_handler(struct mrsas_softc *sc mrsas_bus_scan_sim(sc, sc->sim_1); else goto skip_register_aen; - doscan = 0; break; case MR_EVT_LD_OFFLINE: case MR_EVT_CFG_CLEARED: case MR_EVT_LD_DELETED: mrsas_bus_scan_sim(sc, sc->sim_0); - doscan = 0; break; case MR_EVT_LD_CREATED: fail_aen = mrsas_get_ld_list(sc); @@ -4389,15 +4485,18 @@ mrsas_aen_handler(struct mrsas_softc *sc mrsas_bus_scan_sim(sc, sc->sim_0); else goto skip_register_aen; - doscan = 0; break; case MR_EVT_CTRL_HOST_BUS_SCAN_REQUESTED: case MR_EVT_FOREIGN_CFG_IMPORTED: case MR_EVT_LD_STATE_CHANGE: doscan = 1; break; + case MR_EVT_CTRL_PROP_CHANGED: + fail_aen = mrsas_get_ctrl_info(sc); + if (fail_aen) + goto skip_register_aen; + break; default: - doscan = 0; break; } } else { @@ -4473,8 +4572,7 @@ mrsas_complete_aen(struct mrsas_softc *s sc->aen_cmd = NULL; mrsas_release_mfi_cmd(cmd); - if (!sc->remove_in_progress) - taskqueue_enqueue(sc->ev_tq, &sc->ev_task); + taskqueue_enqueue(sc->ev_tq, &sc->ev_task); return; } Modified: stable/10/sys/dev/mrsas/mrsas.h ============================================================================== --- stable/10/sys/dev/mrsas/mrsas.h Mon Dec 19 12:27:01 2016 (r310263) +++ stable/10/sys/dev/mrsas/mrsas.h Mon Dec 19 13:14:39 2016 (r310264) @@ -106,7 +106,7 @@ __FBSDID("$FreeBSD$"); */ #define BYTE_ALIGNMENT 1 #define MRSAS_MAX_NAME_LENGTH 32 -#define MRSAS_VERSION "06.709.07.00-fbsd" +#define MRSAS_VERSION "06.712.04.00-fbsd" #define MRSAS_ULONG_MAX 0xFFFFFFFFFFFFFFFF #define MRSAS_DEFAULT_TIMEOUT 0x14 /* Temporarily set */ #define DONE 0 @@ -205,7 +205,9 @@ typedef struct _RAID_CONTEXT { #define MPI2_SCSIIO_EEDPFLAGS_CHECK_GUARD (0x0100) #define MPI2_SCSIIO_EEDPFLAGS_INSERT_OP (0x0004) #define MPI2_FUNCTION_SCSI_IO_REQUEST (0x00) /* SCSI IO */ -#define MPI2_REQ_DESCRIPT_FLAGS_HIGH_PRIORITY (0x06) +#define MPI2_FUNCTION_SCSI_TASK_MGMT (0x01) +#define MPI2_REQ_DESCRIPT_FLAGS_HIGH_PRIORITY (0x03) +#define MPI2_REQ_DESCRIPT_FLAGS_FP_IO (0x06) #define MPI2_REQ_DESCRIPT_FLAGS_SCSI_IO (0x00) #define MPI2_SGE_FLAGS_64_BIT_ADDRESSING (0x02) #define MPI2_SCSIIO_CONTROL_WRITE (0x01000000) @@ -314,6 +316,91 @@ typedef union { } MPI2_SCSI_IO_CDB_UNION, MPI2_POINTER PTR_MPI2_SCSI_IO_CDB_UNION, Mpi2ScsiIoCdb_t, MPI2_POINTER pMpi2ScsiIoCdb_t; +/**************************************************************************** + * * SCSI Task Management messages + * ****************************************************************************/ + +/*SCSI Task Management Request Message */ +typedef struct _MPI2_SCSI_TASK_MANAGE_REQUEST { + u_int16_t DevHandle; /*0x00 */ + u_int8_t ChainOffset; /*0x02 */ + u_int8_t Function; /*0x03 */ + u_int8_t Reserved1; /*0x04 */ + u_int8_t TaskType; /*0x05 */ + u_int8_t Reserved2; /*0x06 */ + u_int8_t MsgFlags; /*0x07 */ + u_int8_t VP_ID; /*0x08 */ + u_int8_t VF_ID; /*0x09 */ + u_int16_t Reserved3; /*0x0A */ + u_int8_t LUN[8]; /*0x0C */ + u_int32_t Reserved4[7]; /*0x14 */ + u_int16_t TaskMID; /*0x30 */ + u_int16_t Reserved5; /*0x32 */ +} MPI2_SCSI_TASK_MANAGE_REQUEST; + +/*SCSI Task Management Reply Message */ +typedef struct _MPI2_SCSI_TASK_MANAGE_REPLY { + u_int16_t DevHandle; /*0x00 */ + u_int8_t MsgLength; /*0x02 */ + u_int8_t Function; /*0x03 */ + u_int8_t ResponseCode; /*0x04 */ + u_int8_t TaskType; /*0x05 */ + u_int8_t Reserved1; /*0x06 */ + u_int8_t MsgFlags; /*0x07 */ + u_int8_t VP_ID; /*0x08 */ + u_int8_t VF_ID; /*0x09 */ + u_int16_t Reserved2; /*0x0A */ + u_int16_t Reserved3; /*0x0C */ + u_int16_t IOCStatus; /*0x0E */ + u_int32_t IOCLogInfo; /*0x10 */ + u_int32_t TerminationCount; /*0x14 */ + u_int32_t ResponseInfo; /*0x18 */ +} MPI2_SCSI_TASK_MANAGE_REPLY; + +typedef struct _MR_TM_REQUEST { + char request[128]; +} MR_TM_REQUEST; + +typedef struct _MR_TM_REPLY { + char reply[128]; +} MR_TM_REPLY; + +/* SCSI Task Management Request Message */ +typedef struct _MR_TASK_MANAGE_REQUEST { + /*To be type casted to struct MPI2_SCSI_TASK_MANAGE_REQUEST */ + MR_TM_REQUEST TmRequest; + union { + struct { + u_int32_t isTMForLD:1; + u_int32_t isTMForPD:1; + u_int32_t reserved1:30; + u_int32_t reserved2; + } tmReqFlags; + MR_TM_REPLY TMReply; + } uTmReqReply; +} MR_TASK_MANAGE_REQUEST; + +/* TaskType values */ +#define MPI2_SCSITASKMGMT_TASKTYPE_ABORT_TASK (0x01) +#define MPI2_SCSITASKMGMT_TASKTYPE_ABRT_TASK_SET (0x02) +#define MPI2_SCSITASKMGMT_TASKTYPE_TARGET_RESET (0x03) +#define MPI2_SCSITASKMGMT_TASKTYPE_LOGICAL_UNIT_RESET (0x05) +#define MPI2_SCSITASKMGMT_TASKTYPE_CLEAR_TASK_SET (0x06) +#define MPI2_SCSITASKMGMT_TASKTYPE_QUERY_TASK (0x07) +#define MPI2_SCSITASKMGMT_TASKTYPE_CLR_ACA (0x08) +#define MPI2_SCSITASKMGMT_TASKTYPE_QRY_TASK_SET (0x09) +#define MPI2_SCSITASKMGMT_TASKTYPE_QRY_ASYNC_EVENT (0x0A) + +/* ResponseCode values */ +#define MPI2_SCSITASKMGMT_RSP_TM_COMPLETE (0x00) +#define MPI2_SCSITASKMGMT_RSP_INVALID_FRAME (0x02) +#define MPI2_SCSITASKMGMT_RSP_TM_NOT_SUPPORTED (0x04) +#define MPI2_SCSITASKMGMT_RSP_TM_FAILED (0x05) +#define MPI2_SCSITASKMGMT_RSP_TM_SUCCEEDED (0x08) +#define MPI2_SCSITASKMGMT_RSP_TM_INVALID_LUN (0x09) +#define MPI2_SCSITASKMGMT_RSP_TM_OVERLAPPED_TAG (0x0A) +#define MPI2_SCSITASKMGMT_RSP_IO_QUEUED_ON_IOC (0x80) + /* * RAID SCSI IO Request Message Total SGE count will be one less than * _MPI2_SCSI_IO_REQUEST @@ -584,7 +671,7 @@ Mpi2IOCInitRequest_t, MPI2_POINTER pMpi2 #define MAX_RAIDMAP_PHYSICAL_DEVICES (MAX_PHYSICAL_DEVICES) #define MR_DCMD_LD_MAP_GET_INFO 0x0300e101 #define MR_DCMD_SYSTEM_PD_MAP_GET_INFO 0x0200e102 - +#define MR_DCMD_PD_MFI_TASK_MGMT 0x0200e100 #define MRSAS_MAX_PD_CHANNELS 1 #define MRSAS_MAX_LD_CHANNELS 1 @@ -599,7 +686,7 @@ Mpi2IOCInitRequest_t, MPI2_POINTER pMpi2 #define VD_EXT_DEBUG 0 - +#define TM_DEBUG 1 /******************************************************************* * RAID map related structures @@ -659,7 +746,8 @@ typedef struct _MR_LD_RAID { u_int32_t fpWriteAcrossStripe:1; u_int32_t fpReadAcrossStripe:1; u_int32_t fpNonRWCapable:1; - u_int32_t reserved4:7; + u_int32_t tmCapable:1; + u_int32_t reserved4:6; } capability; u_int32_t reserved6; u_int64_t size; @@ -876,7 +964,11 @@ struct IO_REQUEST_INFO { struct MR_PD_CFG_SEQ { u_int16_t seqNum; u_int16_t devHandle; - u_int8_t reserved[4]; + struct { + u_int8_t tmCapable:1; + u_int8_t reserved:7; + } capability; + u_int8_t reserved[3]; } __packed; struct MR_PD_CFG_SEQ_NUM_SYNC { @@ -1242,7 +1334,6 @@ enum MR_EVT_ARGS { MR_EVT_ARGS_GENERIC, }; - /* * Thunderbolt (and later) Defines */ @@ -1256,7 +1347,8 @@ enum MR_EVT_ARGS { #define HOST_DIAG_WRITE_ENABLE 0x80 #define HOST_DIAG_RESET_ADAPTER 0x4 #define MRSAS_TBOLT_MAX_RESET_TRIES 3 -#define MRSAS_MAX_MFI_CMDS 32 +#define MRSAS_MAX_MFI_CMDS 16 +#define MRSAS_MAX_IOCTL_CMDS 3 /* * Invader Defines @@ -1395,6 +1487,7 @@ struct mrsas_mpt_cmd { union ccb *ccb_ptr; struct callout cm_callout; struct mrsas_softc *sc; + boolean_t tmCapable; TAILQ_ENTRY(mrsas_mpt_cmd) next; }; @@ -1448,6 +1541,7 @@ enum MR_PD_QUERY_TYPE { #define MR_EVT_LD_DELETED 0x008b #define MR_EVT_FOREIGN_CFG_IMPORTED 0x00db #define MR_EVT_LD_OFFLINE 0x00fc +#define MR_EVT_CTRL_PROP_CHANGED 0x012f #define MR_EVT_CTRL_HOST_BUS_SCAN_REQUESTED 0x0152 enum MR_PD_STATE { @@ -1990,6 +2084,11 @@ struct mrsas_ctrl_info { #define MR_MAX_MSIX_REG_ARRAY 16 /* + * SYNC CACHE offset define + */ +#define MR_CAN_HANDLE_SYNC_CACHE_OFFSET 0X01000000 + +/* * FW reports the maximum of number of commands that it can accept (maximum * commands that can be outstanding) at any time. The driver must report a * lower number to the mid layer because it can issue a few internal commands @@ -2470,8 +2569,7 @@ struct mrsas_irq_context { enum MEGASAS_OCR_REASON { FW_FAULT_OCR = 0, - SCSIIO_TIMEOUT_OCR = 1, - MFI_DCMD_TIMEOUT_OCR = 2, + MFI_DCMD_TIMEOUT_OCR = 1, }; /* Controller management info added to support Linux Emulator */ @@ -2746,6 +2844,11 @@ struct mrsas_softc { u_int8_t do_timedout_reset; u_int32_t reset_in_progress; u_int32_t reset_count; + u_int32_t block_sync_cache; + u_int8_t fw_sync_cache_support; + mrsas_atomic_t target_reset_outstanding; +#define MRSAS_MAX_TM_TARGETS (MRSAS_MAX_PD + MRSAS_MAX_LD_IDS) + struct mrsas_mpt_cmd *target_reset_pool[MRSAS_MAX_TM_TARGETS]; bus_dma_tag_t jbodmap_tag[2]; bus_dmamap_t jbodmap_dmamap[2]; @@ -2794,6 +2897,7 @@ struct mrsas_softc { LD_LOAD_BALANCE_INFO load_balance_info[MAX_LOGICAL_DRIVES_EXT]; LD_SPAN_INFO log_to_span[MAX_LOGICAL_DRIVES_EXT]; + u_int8_t mrsas_gen3_ctrl; u_int8_t secure_jbod_support; u_int8_t use_seqnum_jbod_fp; u_int8_t max256vdSupport; Modified: stable/10/sys/dev/mrsas/mrsas_cam.c ============================================================================== --- stable/10/sys/dev/mrsas/mrsas_cam.c Mon Dec 19 12:27:01 2016 (r310263) +++ stable/10/sys/dev/mrsas/mrsas_cam.c Mon Dec 19 13:14:39 2016 (r310264) @@ -95,6 +95,11 @@ static void mrsas_freeze_simq(struct mrs static void mrsas_cam_poll(struct cam_sim *sim); static void mrsas_action(struct cam_sim *sim, union ccb *ccb); static void mrsas_scsiio_timeout(void *data); +static int mrsas_track_scsiio(struct mrsas_softc *sc, target_id_t id, u_int32_t bus_id); +static void mrsas_tm_response_code(struct mrsas_softc *sc, + MPI2_SCSI_TASK_MANAGE_REPLY *mpi_reply); +static int mrsas_issue_tm(struct mrsas_softc *sc, + MRSAS_REQUEST_DESCRIPTOR_UNION *req_desc); static void mrsas_data_load_cb(void *arg, bus_dma_segment_t *segs, int nseg, int error); @@ -105,6 +110,10 @@ struct mrsas_mpt_cmd *mrsas_get_mpt_cmd( MRSAS_REQUEST_DESCRIPTOR_UNION * mrsas_get_request_desc(struct mrsas_softc *sc, u_int16_t index); +extern void +mrsas_map_mpt_cmd_status(struct mrsas_mpt_cmd *cmd, u_int8_t status, + u_int8_t extStatus); +extern int mrsas_reset_targets(struct mrsas_softc *sc); extern u_int16_t MR_TargetIdToLdGet(u_int32_t ldTgtId, MR_DRV_RAID_MAP_ALL * map); extern u_int32_t MR_LdBlockSizeGet(u_int32_t ldTgtId, MR_DRV_RAID_MAP_ALL * map, @@ -125,6 +134,9 @@ extern u_int8_t megasas_get_best_arm(PLD_LOAD_BALANCE_INFO lbInfo, u_int8_t arm, u_int64_t block, u_int32_t count); extern int mrsas_complete_cmd(struct mrsas_softc *sc, u_int32_t MSIxIndex); +extern MR_LD_RAID *MR_LdRaidGet(u_int32_t ld, MR_DRV_RAID_MAP_ALL * map); +extern void mrsas_disable_intr(struct mrsas_softc *sc); +extern void mrsas_enable_intr(struct mrsas_softc *sc); /* @@ -260,6 +272,17 @@ mrsas_action(struct cam_sim *sim, union struct ccb_hdr *ccb_h = &(ccb->ccb_h); u_int32_t device_id; + /* + * Check if the system going down + * or the adapter is in unrecoverable critical error + */ + if (sc->remove_in_progress || + (sc->adprecovery == MRSAS_HW_CRITICAL_ERROR)) { + ccb->ccb_h.status |= CAM_DEV_NOT_THERE; + xpt_done(ccb); + return; + } + switch (ccb->ccb_h.func_code) { case XPT_SCSI_IO: { @@ -375,6 +398,10 @@ mrsas_scsiio_timeout(void *data) { struct mrsas_mpt_cmd *cmd; struct mrsas_softc *sc; + u_int32_t target_id; + + if (!data) + return; cmd = (struct mrsas_mpt_cmd *)data; sc = cmd->sc; @@ -383,6 +410,7 @@ mrsas_scsiio_timeout(void *data) printf("command timeout with NULL ccb\n"); return; } + /* * Below callout is dummy entry so that it will be cancelled from * mrsas_cmd_done(). Now Controller will go to OCR/Kill Adapter based @@ -390,15 +418,25 @@ mrsas_scsiio_timeout(void *data) * context. */ #if (__FreeBSD_version >= 1000510) - callout_reset_sbt(&cmd->cm_callout, SBT_1S * 600, 0, + callout_reset_sbt(&cmd->cm_callout, SBT_1S * 180, 0, mrsas_scsiio_timeout, cmd, 0); #else - callout_reset(&cmd->cm_callout, (600000 * hz) / 1000, + callout_reset(&cmd->cm_callout, (180000 * hz) / 1000, mrsas_scsiio_timeout, cmd); #endif - sc->do_timedout_reset = SCSIIO_TIMEOUT_OCR; - if (sc->ocr_thread_active) - wakeup(&sc->ocr_chan); + + if (cmd->ccb_ptr->cpi.bus_id == 0) + target_id = cmd->ccb_ptr->ccb_h.target_id; + else + target_id = (cmd->ccb_ptr->ccb_h.target_id + (MRSAS_MAX_PD - 1)); *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@freebsd.org Mon Dec 19 13:25:54 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B2376C87D69; Mon, 19 Dec 2016 13:25:54 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 7323DF66; Mon, 19 Dec 2016 13:25:54 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBJDPr0H079367; Mon, 19 Dec 2016 13:25:53 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBJDPr8h079364; Mon, 19 Dec 2016 13:25:53 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201612191325.uBJDPr8h079364@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Mon, 19 Dec 2016 13:25:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310265 - head/sys/cam/ctl X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Dec 2016 13:25:54 -0000 Author: mav Date: Mon Dec 19 13:25:53 2016 New Revision: 310265 URL: https://svnweb.freebsd.org/changeset/base/310265 Log: Add set of macros to simplify code access to mode pages fields. MFC after: 2 weeks Modified: head/sys/cam/ctl/ctl.c head/sys/cam/ctl/ctl_error.c head/sys/cam/ctl/ctl_private.h Modified: head/sys/cam/ctl/ctl.c ============================================================================== --- head/sys/cam/ctl/ctl.c Mon Dec 19 13:14:39 2016 (r310264) +++ head/sys/cam/ctl/ctl.c Mon Dec 19 13:25:53 2016 (r310265) @@ -5869,21 +5869,19 @@ static void ctl_ie_timer(void *arg) { struct ctl_lun *lun = arg; - struct scsi_info_exceptions_page *pg; uint64_t t; if (lun->ie_asc == 0) return; - pg = &lun->mode_pages.ie_page[CTL_PAGE_CURRENT]; - if (pg->mrie == SIEP_MRIE_UA) + if (lun->MODE_IE.mrie == SIEP_MRIE_UA) ctl_est_ua_all(lun, -1, CTL_UA_IE); else lun->ie_reported = 0; - if (lun->ie_reportcnt < scsi_4btoul(pg->report_count)) { + if (lun->ie_reportcnt < scsi_4btoul(lun->MODE_IE.report_count)) { lun->ie_reportcnt++; - t = scsi_4btoul(pg->interval_timer); + t = scsi_4btoul(lun->MODE_IE.interval_timer); if (t == 0 || t == UINT32_MAX) t = 3000; /* 5 min */ callout_schedule(&lun->ie_callout, t * hz / 10); @@ -6477,9 +6475,8 @@ ctl_mode_sense(struct ctl_scsiio *ctsio) if (lun->be_lun->lun_type == T_DIRECT) { header->dev_specific = 0x10; /* DPOFUA */ if ((lun->be_lun->flags & CTL_LUN_FLAG_READONLY) || - (lun->mode_pages.control_page[CTL_PAGE_CURRENT] - .eca_and_aen & SCP_SWP) != 0) - header->dev_specific |= 0x80; /* WP */ + (lun->MODE_CTRL.eca_and_aen & SCP_SWP) != 0) + header->dev_specific |= 0x80; /* WP */ } if (dbd) header->block_descr_len = 0; @@ -6500,9 +6497,8 @@ ctl_mode_sense(struct ctl_scsiio *ctsio) if (lun->be_lun->lun_type == T_DIRECT) { header->dev_specific = 0x10; /* DPOFUA */ if ((lun->be_lun->flags & CTL_LUN_FLAG_READONLY) || - (lun->mode_pages.control_page[CTL_PAGE_CURRENT] - .eca_and_aen & SCP_SWP) != 0) - header->dev_specific |= 0x80; /* WP */ + (lun->MODE_CTRL.eca_and_aen & SCP_SWP) != 0) + header->dev_specific |= 0x80; /* WP */ } if (dbd) scsi_ulto2b(0, header->block_descr_len); @@ -8807,12 +8803,10 @@ ctl_read_write(struct ctl_scsiio *ctsio) /* Set FUA and/or DPO if caches are disabled. */ if (isread) { - if ((lun->mode_pages.caching_page[CTL_PAGE_CURRENT].flags1 & - SCP_RCD) != 0) + if ((lun->MODE_CACHING.flags1 & SCP_RCD) != 0) flags |= CTL_LLF_FUA | CTL_LLF_DPO; } else { - if ((lun->mode_pages.caching_page[CTL_PAGE_CURRENT].flags1 & - SCP_WCE) == 0) + if ((lun->MODE_CACHING.flags1 & SCP_WCE) == 0) flags |= CTL_LLF_FUA; } @@ -8915,8 +8909,7 @@ ctl_cnw(struct ctl_scsiio *ctsio) } /* Set FUA if write cache is disabled. */ - if ((lun->mode_pages.caching_page[CTL_PAGE_CURRENT].flags1 & - SCP_WCE) == 0) + if ((lun->MODE_CACHING.flags1 & SCP_WCE) == 0) flags |= CTL_LLF_FUA; ctsio->kern_total_len = 2 * num_blocks * lun->be_lun->blocksize; @@ -9323,7 +9316,7 @@ ctl_request_sense(struct ctl_scsiio *cts /* * Report informational exception if have one and allowed. */ - if (lun->mode_pages.ie_page[CTL_PAGE_CURRENT].mrie != SIEP_MRIE_NO) { + if (lun->MODE_IE.mrie != SIEP_MRIE_NO) { asc = lun->ie_asc; ascq = lun->ie_ascq; } @@ -11088,8 +11081,8 @@ ctl_check_for_blockage(struct ctl_lun *l return (ctl_extent_check(ooa_io, pending_io, (lun->be_lun && lun->be_lun->serseq == CTL_LUN_SERSEQ_ON))); case CTL_SER_EXTENTOPT: - if ((lun->mode_pages.control_page[CTL_PAGE_CURRENT].queue_flags - & SCP_QUEUE_ALG_MASK) != SCP_QUEUE_ALG_UNRESTRICTED) + if ((lun->MODE_CTRL.queue_flags & SCP_QUEUE_ALG_MASK) != + SCP_QUEUE_ALG_UNRESTRICTED) return (ctl_extent_check(ooa_io, pending_io, (lun->be_lun && lun->be_lun->serseq == CTL_LUN_SERSEQ_ON))); @@ -11101,8 +11094,8 @@ ctl_check_for_blockage(struct ctl_lun *l case CTL_SER_PASS: return (CTL_ACTION_PASS); case CTL_SER_BLOCKOPT: - if ((lun->mode_pages.control_page[CTL_PAGE_CURRENT].queue_flags - & SCP_QUEUE_ALG_MASK) != SCP_QUEUE_ALG_UNRESTRICTED) + if ((lun->MODE_CTRL.queue_flags & SCP_QUEUE_ALG_MASK) != + SCP_QUEUE_ALG_UNRESTRICTED) return (CTL_ACTION_BLOCK); return (CTL_ACTION_PASS); case CTL_SER_SKIP: @@ -11343,8 +11336,7 @@ ctl_scsiio_lun_check(struct ctl_lun *lun retval = 1; goto bailout; } - if ((lun->mode_pages.control_page[CTL_PAGE_CURRENT] - .eca_and_aen & SCP_SWP) != 0) { + if ((lun->MODE_CTRL.eca_and_aen & SCP_SWP) != 0) { ctl_set_sense(ctsio, /*current_error*/ 1, /*sense_key*/ SSD_KEY_DATA_PROTECT, /*asc*/ 0x27, /*ascq*/ 0x02, SSD_ELEM_NONE); @@ -13211,12 +13203,9 @@ ctl_process_done(union ctl_io *io) if (lun->ie_reported == 0 && lun->ie_asc != 0 && io->io_hdr.status == CTL_SUCCESS && (io->io_hdr.flags & CTL_FLAG_STATUS_SENT) == 0) { - uint8_t mrie = lun->mode_pages.ie_page[CTL_PAGE_CURRENT].mrie; - uint8_t per = - ((lun->mode_pages.rw_er_page[CTL_PAGE_CURRENT].byte3 & - SMS_RWER_PER) || - (lun->mode_pages.verify_er_page[CTL_PAGE_CURRENT].byte3 & - SMS_VER_PER)); + uint8_t mrie = lun->MODE_IE.mrie; + uint8_t per = ((lun->MODE_RWER.byte3 & SMS_RWER_PER) || + (lun->MODE_VER.byte3 & SMS_VER_PER)); if (((mrie == SIEP_MRIE_REC_COND && per) || mrie == SIEP_MRIE_REC_UNCOND || mrie == SIEP_MRIE_NO_SENSE) && @@ -13622,7 +13611,6 @@ ctl_thresh_thread(void *arg) { struct ctl_softc *softc = (struct ctl_softc *)arg; struct ctl_lun *lun; - struct scsi_da_rw_recovery_page *rwpage; struct ctl_logical_block_provisioning_page *page; const char *attr; union ctl_ha_msg msg; @@ -13641,11 +13629,10 @@ ctl_thresh_thread(void *arg) if ((lun->flags & CTL_LUN_PRIMARY_SC) == 0 && softc->ha_mode == CTL_HA_MODE_XFER) continue; - rwpage = &lun->mode_pages.rw_er_page[CTL_PAGE_CURRENT]; - if ((rwpage->byte8 & SMS_RWER_LBPERE) == 0) + if ((lun->MODE_RWER.byte8 & SMS_RWER_LBPERE) == 0) continue; e = 0; - page = &lun->mode_pages.lbp_page[CTL_PAGE_CURRENT]; + page = &lun->MODE_LBP; for (i = 0; i < CTL_NUM_LBP_THRESH; i++) { if ((page->descr[i].flags & SLBPPD_ENABLED) == 0) continue; Modified: head/sys/cam/ctl/ctl_error.c ============================================================================== --- head/sys/cam/ctl/ctl_error.c Mon Dec 19 13:14:39 2016 (r310264) +++ head/sys/cam/ctl/ctl_error.c Mon Dec 19 13:25:53 2016 (r310265) @@ -83,9 +83,7 @@ ctl_set_sense_data_va(struct scsi_sense_ * sense if the LUN exists and descriptor sense is turned * on for that LUN. */ - if ((lun != NULL) - && (lun->mode_pages.control_page[CTL_PAGE_CURRENT].rlec & - SCP_DSENSE)) + if ((lun != NULL) && (lun->MODE_CTRL.rlec & SCP_DSENSE)) sense_format = SSD_TYPE_DESC; else sense_format = SSD_TYPE_FIXED; Modified: head/sys/cam/ctl/ctl_private.h ============================================================================== --- head/sys/cam/ctl/ctl_private.h Mon Dec 19 13:14:39 2016 (r310264) +++ head/sys/cam/ctl/ctl_private.h Mon Dec 19 13:25:53 2016 (r310265) @@ -313,6 +313,17 @@ struct ctl_mode_pages { struct ctl_page_index index[CTL_NUM_MODE_PAGES]; }; +#define MODE_RWER mode_pages.rw_er_page[CTL_PAGE_CURRENT] +#define MODE_FMT mode_pages.format_page[CTL_PAGE_CURRENT] +#define MODE_RDISK mode_pages.rigid_disk_page[CTL_PAGE_CURRENT] +#define MODE_VER mode_pages.verify_er_page[CTL_PAGE_CURRENT] +#define MODE_CACHING mode_pages.caching_page[CTL_PAGE_CURRENT] +#define MODE_CTRL mode_pages.control_page[CTL_PAGE_CURRENT] +#define MODE_CTRLE mode_pages.control_ext_page[CTL_PAGE_CURRENT] +#define MODE_IE mode_pages.ie_page[CTL_PAGE_CURRENT] +#define MODE_LBP mode_pages.lbp_page[CTL_PAGE_CURRENT] +#define MODE_CDDVD mode_pages.cddvd_page[CTL_PAGE_CURRENT] + static const struct ctl_page_index log_page_index_template[] = { {SLS_SUPPORTED_PAGES_PAGE, 0, 0, NULL, CTL_PAGE_FLAG_ALL, NULL, NULL}, From owner-svn-src-all@freebsd.org Mon Dec 19 14:19:54 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4686BC88082; Mon, 19 Dec 2016 14:19:54 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id F08A51EBA; Mon, 19 Dec 2016 14:19:53 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBJEJrlo099317; Mon, 19 Dec 2016 14:19:53 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBJEJra4099316; Mon, 19 Dec 2016 14:19:53 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201612191419.uBJEJra4099316@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Mon, 19 Dec 2016 14:19:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310266 - head/sys/cam/ctl X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Dec 2016 14:19:54 -0000 Author: mav Date: Mon Dec 19 14:19:52 2016 New Revision: 310266 URL: https://svnweb.freebsd.org/changeset/base/310266 Log: Add support for NUAR bit in Control mode page. MFC after: 2 weeks Modified: head/sys/cam/ctl/ctl.c Modified: head/sys/cam/ctl/ctl.c ============================================================================== --- head/sys/cam/ctl/ctl.c Mon Dec 19 13:25:53 2016 (r310265) +++ head/sys/cam/ctl/ctl.c Mon Dec 19 14:19:52 2016 (r310266) @@ -253,7 +253,7 @@ const static struct scsi_control_page co /*page_code*/SMS_CONTROL_MODE_PAGE, /*page_length*/sizeof(struct scsi_control_page) - 2, /*rlec*/SCP_DSENSE, - /*queue_flags*/SCP_QUEUE_ALG_MASK, + /*queue_flags*/SCP_QUEUE_ALG_MASK | SCP_NUAR, /*eca_and_aen*/SCP_SWP, /*flags4*/0, /*aen_holdoff_period*/{0, 0}, @@ -8440,12 +8440,11 @@ ctl_persistent_reserve_out(struct ctl_sc lun->pr_res_type = 0; /* - * if this isn't an exclusive access - * res generate UA for all other - * registrants. + * If this isn't an exclusive access reservation and NUAR + * is not set, generate UA for all other registrants. */ - if (type != SPR_TYPE_EX_AC - && type != SPR_TYPE_WR_EX) { + if (type != SPR_TYPE_EX_AC && type != SPR_TYPE_WR_EX && + (lun->MODE_CTRL.queue_flags & SCP_NUAR) == 0) { for (i = softc->init_min; i < softc->init_max; i++) { if (i == residx || ctl_get_prkey(lun, i) == 0) continue; @@ -8595,11 +8594,12 @@ ctl_hndl_per_res_out_on_other_sc(union c case CTL_PR_RELEASE: /* - * if this isn't an exclusive access res generate UA for all - * other registrants. + * If this isn't an exclusive access reservation and NUAR + * is not set, generate UA for all other registrants. */ if (lun->pr_res_type != SPR_TYPE_EX_AC && - lun->pr_res_type != SPR_TYPE_WR_EX) { + lun->pr_res_type != SPR_TYPE_WR_EX && + (lun->MODE_CTRL.queue_flags & SCP_NUAR) == 0) { for (i = softc->init_min; i < softc->init_max; i++) if (i == residx || ctl_get_prkey(lun, i) == 0) continue; From owner-svn-src-all@freebsd.org Mon Dec 19 14:41:01 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9F506C88711; Mon, 19 Dec 2016 14:41:01 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 65B8D1CC8; Mon, 19 Dec 2016 14:41:01 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBJEf0fC008582; Mon, 19 Dec 2016 14:41:00 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBJEexcV008565; Mon, 19 Dec 2016 14:40:59 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201612191440.uBJEexcV008565@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Mon, 19 Dec 2016 14:40:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310267 - in head/sys/boot: arm/uboot common efi/loader i386/loader mips/beri/loader mips/uboot pc98/loader powerpc/kboot powerpc/ofw powerpc/ps3 powerpc/uboot sparc64/loader userboot/u... X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Dec 2016 14:41:01 -0000 Author: emaste Date: Mon Dec 19 14:40:59 2016 New Revision: 310267 URL: https://svnweb.freebsd.org/changeset/base/310267 Log: Deduplicate loader vers.c Makefile rules The Makefile rule to create vers.c for loader version info was previously duplicated in each of the various loader Makefiles. Instead, share a common rule in Makefile.inc. Reviewed by: bapt MFC after: 1 month Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D8841 Modified: head/sys/boot/arm/uboot/Makefile head/sys/boot/common/Makefile.inc head/sys/boot/efi/loader/Makefile head/sys/boot/i386/loader/Makefile head/sys/boot/mips/beri/loader/Makefile head/sys/boot/mips/uboot/Makefile head/sys/boot/pc98/loader/Makefile head/sys/boot/powerpc/kboot/Makefile head/sys/boot/powerpc/ofw/Makefile head/sys/boot/powerpc/ps3/Makefile head/sys/boot/powerpc/uboot/Makefile head/sys/boot/sparc64/loader/Makefile head/sys/boot/userboot/userboot/Makefile Modified: head/sys/boot/arm/uboot/Makefile ============================================================================== --- head/sys/boot/arm/uboot/Makefile Mon Dec 19 14:19:52 2016 (r310266) +++ head/sys/boot/arm/uboot/Makefile Mon Dec 19 14:40:59 2016 (r310267) @@ -90,7 +90,7 @@ LIBFICL= ${.OBJDIR}/../../ficl/libficl.a CFLAGS+= -I${.CURDIR}/../../common CFLAGS+= -I. -CLEANFILES+= vers.c loader.help +CLEANFILES+= loader.help CFLAGS+= -ffreestanding -msoft-float @@ -119,9 +119,6 @@ LDADD= ${LIBFICL} ${LIBUBOOT} ${LIBFDT} OBJS+= ${SRCS:N*.h:R:S/$/.o/g} -vers.c: ${.CURDIR}/../../common/newvers.sh ${.CURDIR}/version - sh ${.CURDIR}/../../common/newvers.sh ${.CURDIR}/version ${NEWVERSWHAT} - loader.help: help.common help.uboot ${.CURDIR}/../../fdt/help.fdt cat ${.ALLSRC} | \ awk -f ${.CURDIR}/../../common/merge_help.awk > ${.TARGET} Modified: head/sys/boot/common/Makefile.inc ============================================================================== --- head/sys/boot/common/Makefile.inc Mon Dec 19 14:19:52 2016 (r310266) +++ head/sys/boot/common/Makefile.inc Mon Dec 19 14:40:59 2016 (r310267) @@ -71,3 +71,8 @@ CFLAGS+= -DBOOT_PROMPT_123 SRCS+= install.c CFLAGS+=-I${.CURDIR}/../../../../lib/libstand .endif + +CLEANFILES+= vers.c +VERSION_FILE?= ${.CURDIR}/version +vers.c: ${SRCTOP}/sys/boot/common/newvers.sh ${VERSION_FILE} + sh ${SRCTOP}/sys/boot/common/newvers.sh ${VERSION_FILE} ${NEWVERSWHAT} Modified: head/sys/boot/efi/loader/Makefile ============================================================================== --- head/sys/boot/efi/loader/Makefile Mon Dec 19 14:19:52 2016 (r310266) +++ head/sys/boot/efi/loader/Makefile Mon Dec 19 14:40:59 2016 (r310267) @@ -115,13 +115,10 @@ FILESMODE_loader.efi= ${BINMODE} LDSCRIPT= ${.CURDIR}/arch/${MACHINE}/ldscript.${MACHINE} LDFLAGS+= -Wl,-T${LDSCRIPT} -Wl,-Bsymbolic -shared -CLEANFILES+= vers.c loader.efi +CLEANFILES+= loader.efi NEWVERSWHAT= "EFI loader" ${MACHINE} -vers.c: ${.CURDIR}/../../common/newvers.sh ${.CURDIR}/../../efi/loader/version - sh ${.CURDIR}/../../common/newvers.sh ${.CURDIR}/version ${NEWVERSWHAT} - NM?= nm OBJCOPY?= objcopy Modified: head/sys/boot/i386/loader/Makefile ============================================================================== --- head/sys/boot/i386/loader/Makefile Mon Dec 19 14:19:52 2016 (r310266) +++ head/sys/boot/i386/loader/Makefile Mon Dec 19 14:40:59 2016 (r310267) @@ -8,6 +8,7 @@ PROG= ${LOADER}.sym MAN= INTERNALPROG= NEWVERSWHAT?= "bootstrap loader" x86 +VERSION_FILE= ${.CURDIR}/../loader/version # architecture-specific loader code SRCS= main.c conf.c vers.c @@ -72,7 +73,7 @@ CFLAGS+= -I${.CURDIR}/../../.. -D_STAND CFLAGS+= -I${.CURDIR}/../../common CFLAGS+= -I. -CLEANFILES= vers.c ${LOADER} ${LOADER}.bin loader.help +CLEANFILES= ${LOADER} ${LOADER}.bin loader.help CFLAGS+= -Wall LDFLAGS= -static -Ttext 0x0 @@ -93,10 +94,6 @@ CFLAGS+= -I${.CURDIR}/../btx/lib # Pick up ../Makefile.inc early. .include -vers.c: ${.CURDIR}/../../common/newvers.sh ${.CURDIR}/../loader/version - sh ${.CURDIR}/../../common/newvers.sh ${.CURDIR}/../loader/version \ - ${NEWVERSWHAT} - ${LOADER}: ${LOADER}.bin ${BTXLDR} ${BTXKERN} btxld -v -f aout -e ${LOADER_ADDRESS} -o ${.TARGET} -l ${BTXLDR} \ -b ${BTXKERN} ${LOADER}.bin Modified: head/sys/boot/mips/beri/loader/Makefile ============================================================================== --- head/sys/boot/mips/beri/loader/Makefile Mon Dec 19 14:19:52 2016 (r310266) +++ head/sys/boot/mips/beri/loader/Makefile Mon Dec 19 14:40:59 2016 (r310267) @@ -92,7 +92,7 @@ CFLAGS+= -I${.CURDIR}/../common # Loader-specific MD headers CFLAGS+= -I${.CURDIR} -CLEANFILES+= vers.c loader.help +CLEANFILES+= loader.help # Generate code appropriate for the loader environment CFLAGS+= -G0 \ @@ -114,10 +114,6 @@ LIBSTAND= ${.OBJDIR}/../../../../../lib/ DPADD= ${LIBFICL} ${LIBSTAND} LDADD= ${LIBFICL} ${LIBSTAND} -vers.c: ${.CURDIR}/../../../common/newvers.sh ${.CURDIR}/version - sh ${.CURDIR}/../../../common/newvers.sh ${.CURDIR}/version \ - ${NEWVERSWHAT} - loader.help: help.common help.mips cat ${.ALLSRC} | \ awk -f ${.CURDIR}/../../../common/merge_help.awk > ${.TARGET} Modified: head/sys/boot/mips/uboot/Makefile ============================================================================== --- head/sys/boot/mips/uboot/Makefile Mon Dec 19 14:19:52 2016 (r310266) +++ head/sys/boot/mips/uboot/Makefile Mon Dec 19 14:40:59 2016 (r310267) @@ -99,7 +99,7 @@ LIBFICL= ${.OBJDIR}/../../ficl/libficl.a CFLAGS+= -I${.CURDIR}/../../common CFLAGS+= -I. -CLEANFILES+= vers.c loader.help +CLEANFILES+= loader.help CFLAGS+= -ffreestanding -msoft-float -g @@ -128,9 +128,6 @@ LDADD= ${LIBFICL} ${LIBUBOOT} ${LIBFDT} OBJS+= ${SRCS:N*.h:R:S/$/.o/g} -vers.c: ${.CURDIR}/../../common/newvers.sh ${.CURDIR}/version - sh ${.CURDIR}/../../common/newvers.sh ${.CURDIR}/version ${NEWVERSWHAT} - loader.help: help.common help.uboot ${.CURDIR}/../../fdt/help.fdt cat ${.ALLSRC} | \ awk -f ${.CURDIR}/../../common/merge_help.awk > ${.TARGET} Modified: head/sys/boot/pc98/loader/Makefile ============================================================================== --- head/sys/boot/pc98/loader/Makefile Mon Dec 19 14:19:52 2016 (r310266) +++ head/sys/boot/pc98/loader/Makefile Mon Dec 19 14:40:59 2016 (r310267) @@ -8,6 +8,7 @@ LOADER?= loader PROG= ${LOADER}.sym INTERNALPROG= NEWVERSWHAT= "bootstrap loader" pc98 +VERSION_FILE= ${.CURDIR}/../../i386/loader/version # architecture-specific loader code SRCS= main.c conf.c vers.c @@ -48,7 +49,7 @@ CFLAGS+= -I${.CURDIR}/../../common CFLAGS+= -I${.CURDIR}/../../i386 CFLAGS+= -I. -CLEANFILES= vers.c ${LOADER} ${LOADER}.bin loader.help +CLEANFILES= ${LOADER} ${LOADER}.bin loader.help CFLAGS+= -Wall LDFLAGS= -static -Ttext 0x0 @@ -69,9 +70,6 @@ CFLAGS+= -I${.CURDIR}/../btx/lib # Pick up ../Makefile.inc early. .include -vers.c: ${.CURDIR}/../../common/newvers.sh ${.CURDIR}/../../i386/loader/version - sh ${.CURDIR}/../../common/newvers.sh ${.CURDIR}/../../i386/loader/version ${NEWVERSWHAT} - ${LOADER}: ${LOADER}.bin ${BTXLDR} ${BTXKERN} btxld -v -f aout -e ${LOADER_ADDRESS} -o ${.TARGET} -l ${BTXLDR} \ -b ${BTXKERN} ${LOADER}.bin Modified: head/sys/boot/powerpc/kboot/Makefile ============================================================================== --- head/sys/boot/powerpc/kboot/Makefile Mon Dec 19 14:19:52 2016 (r310266) +++ head/sys/boot/powerpc/kboot/Makefile Mon Dec 19 14:40:59 2016 (r310267) @@ -76,7 +76,7 @@ CFLAGS+= -mcpu=powerpc64 CFLAGS+= -I${.CURDIR}/../../common -I${.CURDIR}/../../.. CFLAGS+= -I. -CLEANFILES+= vers.c loader.help +CLEANFILES+= loader.help CFLAGS+= -Wall -ffreestanding -msoft-float -DAIM # load address. set in linker script @@ -99,9 +99,6 @@ CFLAGS+= -I${.CURDIR}/../../../../lib/li DPADD= ${LIBFICL} ${LIBOFW} ${LIBFDT} ${LIBSTAND} LDADD= ${LIBFICL} ${LIBOFW} ${LIBFDT} ${LIBSTAND} -vers.c: ${.CURDIR}/../../common/newvers.sh ${.CURDIR}/version - sh ${.CURDIR}/../../common/newvers.sh ${.CURDIR}/version ${NEWVERSWHAT} - loader.help: help.common help.kboot ${.CURDIR}/../../fdt/help.fdt cat ${.ALLSRC} | \ awk -f ${.CURDIR}/../../common/merge_help.awk > ${.TARGET} Modified: head/sys/boot/powerpc/ofw/Makefile ============================================================================== --- head/sys/boot/powerpc/ofw/Makefile Mon Dec 19 14:19:52 2016 (r310266) +++ head/sys/boot/powerpc/ofw/Makefile Mon Dec 19 14:40:59 2016 (r310267) @@ -73,7 +73,7 @@ LIBFICL= ${.OBJDIR}/../../ficl/libficl.a CFLAGS+= -I${.CURDIR}/../../common -I${.CURDIR}/../../.. CFLAGS+= -I. -CLEANFILES+= vers.c loader.help +CLEANFILES+= loader.help CFLAGS+= -ffreestanding -msoft-float # load address. set in linker script @@ -97,9 +97,6 @@ CFLAGS+= -I${.CURDIR}/../../../../lib/li DPADD= ${LIBFICL} ${LIBOFW} ${LIBFDT} ${LIBSTAND} LDADD= ${LIBFICL} ${LIBOFW} ${LIBFDT} ${LIBSTAND} -vers.c: ${.CURDIR}/../../common/newvers.sh ${.CURDIR}/version - sh ${.CURDIR}/../../common/newvers.sh ${.CURDIR}/version ${NEWVERSWHAT} - loader.help: help.common help.ofw ${.CURDIR}/../../fdt/help.fdt cat ${.ALLSRC} | \ awk -f ${.CURDIR}/../../common/merge_help.awk > ${.TARGET} Modified: head/sys/boot/powerpc/ps3/Makefile ============================================================================== --- head/sys/boot/powerpc/ps3/Makefile Mon Dec 19 14:19:52 2016 (r310266) +++ head/sys/boot/powerpc/ps3/Makefile Mon Dec 19 14:40:59 2016 (r310267) @@ -76,7 +76,7 @@ CFLAGS+= -mcpu=powerpc64 CFLAGS+= -I${.CURDIR}/../../common -I${.CURDIR}/../../.. CFLAGS+= -I. -CLEANFILES+= vers.c loader.help +CLEANFILES+= loader.help CFLAGS+= -Wall -ffreestanding -msoft-float -DAIM # load address. set in linker script @@ -101,9 +101,6 @@ SC_DFLT_FONT=cp437 font.h: uudecode < /usr/share/syscons/fonts/${SC_DFLT_FONT}-8x16.fnt && file2c 'u_char dflt_font_16[16*256] = {' '};' < ${SC_DFLT_FONT}-8x16 > font.h && uudecode < /usr/share/syscons/fonts/${SC_DFLT_FONT}-8x14.fnt && file2c 'u_char dflt_font_14[14*256] = {' '};' < ${SC_DFLT_FONT}-8x14 >> font.h && uudecode < /usr/share/syscons/fonts/${SC_DFLT_FONT}-8x8.fnt && file2c 'u_char dflt_font_8[8*256] = {' '};' < ${SC_DFLT_FONT}-8x8 >> font.h -vers.c: ${.CURDIR}/../../common/newvers.sh ${.CURDIR}/version - sh ${.CURDIR}/../../common/newvers.sh ${.CURDIR}/version ${NEWVERSWHAT} - loader.help: help.common help.ps3 ${.CURDIR}/../../fdt/help.fdt cat ${.ALLSRC} | \ awk -f ${.CURDIR}/../../common/merge_help.awk > ${.TARGET} Modified: head/sys/boot/powerpc/uboot/Makefile ============================================================================== --- head/sys/boot/powerpc/uboot/Makefile Mon Dec 19 14:19:52 2016 (r310266) +++ head/sys/boot/powerpc/uboot/Makefile Mon Dec 19 14:40:59 2016 (r310267) @@ -79,7 +79,7 @@ LIBFICL= ${.OBJDIR}/../../ficl/libficl.a CFLAGS+= -I${.CURDIR}/../../common -I${.CURDIR}/../../.. CFLAGS+= -I. -CLEANFILES+= vers.c ${PROG}.help +CLEANFILES+= ${PROG}.help CFLAGS+= -ffreestanding @@ -102,9 +102,6 @@ CFLAGS+= -I${.CURDIR}/../../../../lib/li DPADD= ${LIBFICL} ${LIBUBOOT} ${LIBFDT} ${LIBUBOOT_FDT} ${LIBSTAND} LDADD= ${LIBFICL} ${LIBUBOOT} ${LIBFDT} ${LIBUBOOT_FDT} ${LIBSTAND} -vers.c: ${.CURDIR}/../../common/newvers.sh ${.CURDIR}/version - sh ${.CURDIR}/../../common/newvers.sh ${.CURDIR}/version ${NEWVERSWHAT} - loader.help: help.common help.uboot ${.CURDIR}/../../fdt/help.fdt cat ${.ALLSRC} | \ awk -f ${.CURDIR}/../../common/merge_help.awk > ${.TARGET} Modified: head/sys/boot/sparc64/loader/Makefile ============================================================================== --- head/sys/boot/sparc64/loader/Makefile Mon Dec 19 14:19:52 2016 (r310266) +++ head/sys/boot/sparc64/loader/Makefile Mon Dec 19 14:40:59 2016 (r310267) @@ -6,6 +6,7 @@ MAN= PROG?= loader NEWVERSWHAT?= "bootstrap loader" sparc64 +VERSION_FILE= ${.CURDIR}/../loader/version INSTALLFLAGS= -b # Architecture-specific loader code @@ -70,7 +71,7 @@ LIBFICL= ${.OBJDIR}/../../ficl/libficl.a CFLAGS+= -I${.CURDIR}/../../common CFLAGS+= -I. -CLEANFILES+= vers.c loader.help +CLEANFILES+= loader.help LDFLAGS= -static @@ -84,10 +85,6 @@ CFLAGS+= -I${.CURDIR}/../../../../lib/li DPADD= ${LIBFICL} ${LIBZFSBOOT} ${LIBOFW} ${LIBSTAND} LDADD= ${LIBFICL} ${LIBZFSBOOT} ${LIBOFW} -lstand -vers.c: ${.CURDIR}/../../common/newvers.sh ${.CURDIR}/../loader/version - sh ${.CURDIR}/../../common/newvers.sh ${.CURDIR}/../loader/version \ - ${NEWVERSWHAT} - loader.help: help.common help.sparc64 cat ${.ALLSRC} | \ awk -f ${.CURDIR}/../../common/merge_help.awk > ${.TARGET} Modified: head/sys/boot/userboot/userboot/Makefile ============================================================================== --- head/sys/boot/userboot/userboot/Makefile Mon Dec 19 14:19:52 2016 (r310266) +++ head/sys/boot/userboot/userboot/Makefile Mon Dec 19 14:40:59 2016 (r310267) @@ -41,11 +41,6 @@ LDFLAGS+= -nostdlib -Wl,-Bsymbolic NEWVERSWHAT= "User boot" ${MACHINE_CPUARCH} -vers.c: ${.CURDIR}/../../common/newvers.sh ${.CURDIR}/version - sh ${.CURDIR}/../../common/newvers.sh ${.CURDIR}/version ${NEWVERSWHAT} - -CLEANFILES= vers.c - .if ${MK_FORTH} != "no" BOOT_FORTH= yes CFLAGS+= -DBOOT_FORTH -I${.CURDIR}/../../ficl -I${.CURDIR}/../../ficl/i386 From owner-svn-src-all@freebsd.org Mon Dec 19 14:46:00 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8BED5C88976; Mon, 19 Dec 2016 14:46:00 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 5ED8E1FE0; Mon, 19 Dec 2016 14:46:00 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBJEjxPg011604; Mon, 19 Dec 2016 14:45:59 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBJEjxhD011600; Mon, 19 Dec 2016 14:45:59 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201612191445.uBJEjxhD011600@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Mon, 19 Dec 2016 14:45:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310268 - in head: share/mk sys/boot/common tools/build/options X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Dec 2016 14:46:00 -0000 Author: emaste Date: Mon Dec 19 14:45:59 2016 New Revision: 310268 URL: https://svnweb.freebsd.org/changeset/base/310268 Log: Build loaders reproducibly when WITH_REPRODUCIBLE_BUILD When WITH_REPRODUCIBLE_BUILD=yes is set in src.conf(5), eliminate the time, user, and host from the loader's version information. This allows builds to produce bit-for-bit identical output. Reviewed by: bapt MFC after: 1 month Relnotes: yes Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D8842 Modified: head/share/mk/src.opts.mk head/sys/boot/common/Makefile.inc head/sys/boot/common/newvers.sh head/tools/build/options/WITH_REPRODUCIBLE_BUILD Modified: head/share/mk/src.opts.mk ============================================================================== --- head/share/mk/src.opts.mk Mon Dec 19 14:40:59 2016 (r310267) +++ head/share/mk/src.opts.mk Mon Dec 19 14:45:59 2016 (r310268) @@ -190,6 +190,7 @@ __DEFAULT_NO_OPTIONS = \ OFED \ OPENLDAP \ RCS \ + REPRODUCIBLE_BUILD \ SHARED_TOOLCHAIN \ SORT_THREADS \ SVN \ Modified: head/sys/boot/common/Makefile.inc ============================================================================== --- head/sys/boot/common/Makefile.inc Mon Dec 19 14:40:59 2016 (r310267) +++ head/sys/boot/common/Makefile.inc Mon Dec 19 14:45:59 2016 (r310268) @@ -74,5 +74,9 @@ CFLAGS+=-I${.CURDIR}/../../../../lib/lib CLEANFILES+= vers.c VERSION_FILE?= ${.CURDIR}/version +.if ${MK_REPRODUCIBLE_BUILD} != no +REPRO_FLAG= -r +.endif vers.c: ${SRCTOP}/sys/boot/common/newvers.sh ${VERSION_FILE} - sh ${SRCTOP}/sys/boot/common/newvers.sh ${VERSION_FILE} ${NEWVERSWHAT} + sh ${SRCTOP}/sys/boot/common/newvers.sh ${REPRO_FLAG} ${VERSION_FILE} \ + ${NEWVERSWHAT} Modified: head/sys/boot/common/newvers.sh ============================================================================== --- head/sys/boot/common/newvers.sh Mon Dec 19 14:40:59 2016 (r310267) +++ head/sys/boot/common/newvers.sh Mon Dec 19 14:45:59 2016 (r310268) @@ -35,11 +35,26 @@ tempfile=$(mktemp tmp.XXXXXX) || exit trap "rm -f $tempfile" EXIT INT TERM +include_metadata=true +while getopts r opt; do + case "$opt" in + r) + include_metadata= + ;; + esac +done +shift $((OPTIND - 1)) + LC_ALL=C; export LC_ALL u=${USER-root} h=${HOSTNAME-`hostname`} t=`date` #r=`head -n 6 $1 | tail -n 1 | awk -F: ' { print $1 } '` r=`awk -F: ' /^[0-9]\.[0-9]+:/ { print $1; exit }' $1` -echo "char bootprog_info[] = \"FreeBSD/${3} ${2}, Revision ${r}\\n(${t} ${u}@${h})\\n\";" > $tempfile +bootprog_info="FreeBSD/${3} ${2}, Revision ${r}\\n" +if [ -n "${include_metadata}" ]; then + bootprog_info="$bootprog_info(${t} ${u}@${h})\\n" +fi + +echo "char bootprog_info[] = \"$bootprog_info\";" > $tempfile echo "unsigned bootprog_rev = ${r%%.*}${r##*.};" >> $tempfile mv $tempfile vers.c Modified: head/tools/build/options/WITH_REPRODUCIBLE_BUILD ============================================================================== --- head/tools/build/options/WITH_REPRODUCIBLE_BUILD Mon Dec 19 14:40:59 2016 (r310267) +++ head/tools/build/options/WITH_REPRODUCIBLE_BUILD Mon Dec 19 14:45:59 2016 (r310268) @@ -1,3 +1,4 @@ $FreeBSD$ -Set to exclude build metadata (build time, user, host and path) from the -kernel and uname output. +Set to exclude build metadata (such as the build time, user, or host) +from the kernel, boot loaders, and uname output, so that builds produce +bit-for-bit identical output. From owner-svn-src-all@freebsd.org Mon Dec 19 14:54:07 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id ACB62C88B3C; Mon, 19 Dec 2016 14:54:07 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 714DE163B; Mon, 19 Dec 2016 14:54:07 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBJEs6q7015807; Mon, 19 Dec 2016 14:54:06 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBJEs6aO015806; Mon, 19 Dec 2016 14:54:06 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201612191454.uBJEs6aO015806@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Mon, 19 Dec 2016 14:54:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310269 - head/share/man/man5 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Dec 2016 14:54:07 -0000 Author: emaste Date: Mon Dec 19 14:54:06 2016 New Revision: 310269 URL: https://svnweb.freebsd.org/changeset/base/310269 Log: src.conf.5: regen after r310268 (WITH_REPRODUCIBLE_BUILD) Modified: head/share/man/man5/src.conf.5 Modified: head/share/man/man5/src.conf.5 ============================================================================== --- head/share/man/man5/src.conf.5 Mon Dec 19 14:45:59 2016 (r310268) +++ head/share/man/man5/src.conf.5 Mon Dec 19 14:54:06 2016 (r310269) @@ -1,7 +1,7 @@ .\" DO NOT EDIT-- this file is automatically generated. .\" from FreeBSD: head/tools/build/options/makeman 306729 2016-10-05 20:12:00Z emaste .\" $FreeBSD$ -.Dd December 10, 2016 +.Dd December 19, 2016 .Dt SRC.CONF 5 .Os .Sh NAME @@ -1368,6 +1368,11 @@ This includes .Xr rlogin 1 , .Xr rsh 1 , etc. +.It Va WITH_REPRODUCIBLE_BUILD +from FreeBSD: head/tools/build/options/WITH_REPRODUCIBLE_BUILD 310268 2016-12-19 14:45:59Z emaste +Set to exclude build metadata (such as the build time, user, or host) +from the kernel, boot loaders, and uname output, so that builds produce +bit-for-bit identical output. .It Va WITHOUT_RESCUE .\" from FreeBSD: head/tools/build/options/WITHOUT_RESCUE 156932 2006-03-21 07:50:50Z ru Set to not build From owner-svn-src-all@freebsd.org Mon Dec 19 15:05:47 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 60A3CC88E69; Mon, 19 Dec 2016 15:05:47 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 254FA1F17; Mon, 19 Dec 2016 15:05:47 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBJF5kTB020204; Mon, 19 Dec 2016 15:05:46 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBJF5km6020203; Mon, 19 Dec 2016 15:05:46 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201612191505.uBJF5km6020203@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Mon, 19 Dec 2016 15:05:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310270 - head/share/man/man5 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Dec 2016 15:05:47 -0000 Author: emaste Date: Mon Dec 19 15:05:46 2016 New Revision: 310270 URL: https://svnweb.freebsd.org/changeset/base/310270 Log: Restore missing comment in src.conf.5 I'm not sure how I managed to generate src.conf.5 without the comment; add it manually while looking into that. Reported by: gjb Modified: head/share/man/man5/src.conf.5 Modified: head/share/man/man5/src.conf.5 ============================================================================== --- head/share/man/man5/src.conf.5 Mon Dec 19 14:54:06 2016 (r310269) +++ head/share/man/man5/src.conf.5 Mon Dec 19 15:05:46 2016 (r310270) @@ -1369,7 +1369,7 @@ This includes .Xr rsh 1 , etc. .It Va WITH_REPRODUCIBLE_BUILD -from FreeBSD: head/tools/build/options/WITH_REPRODUCIBLE_BUILD 310268 2016-12-19 14:45:59Z emaste +.\" from FreeBSD: head/tools/build/options/WITH_REPRODUCIBLE_BUILD 310268 2016-12-19 14:45:59Z emaste Set to exclude build metadata (such as the build time, user, or host) from the kernel, boot loaders, and uname output, so that builds produce bit-for-bit identical output. From owner-svn-src-all@freebsd.org Mon Dec 19 15:09:31 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D4507C88F3F; Mon, 19 Dec 2016 15:09:31 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A40BF11F1; Mon, 19 Dec 2016 15:09:31 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBJF9Uqd020365; Mon, 19 Dec 2016 15:09:30 GMT (envelope-from gjb@FreeBSD.org) Received: (from gjb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBJF9UwU020364; Mon, 19 Dec 2016 15:09:30 GMT (envelope-from gjb@FreeBSD.org) Message-Id: <201612191509.uBJF9UwU020364@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gjb set sender to gjb@FreeBSD.org using -f From: Glen Barber Date: Mon, 19 Dec 2016 15:09:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310271 - head/tools/build/options X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Dec 2016 15:09:31 -0000 Author: gjb Date: Mon Dec 19 15:09:30 2016 New Revision: 310271 URL: https://svnweb.freebsd.org/changeset/base/310271 Log: Comment the RCSID. Sponsored by: The FreeBSD Foundation Modified: head/tools/build/options/WITH_REPRODUCIBLE_BUILD Modified: head/tools/build/options/WITH_REPRODUCIBLE_BUILD ============================================================================== --- head/tools/build/options/WITH_REPRODUCIBLE_BUILD Mon Dec 19 15:05:46 2016 (r310270) +++ head/tools/build/options/WITH_REPRODUCIBLE_BUILD Mon Dec 19 15:09:30 2016 (r310271) @@ -1,4 +1,4 @@ -$FreeBSD$ +.\" $FreeBSD$ Set to exclude build metadata (such as the build time, user, or host) from the kernel, boot loaders, and uname output, so that builds produce bit-for-bit identical output. From owner-svn-src-all@freebsd.org Mon Dec 19 15:18:33 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 59206C880C5; Mon, 19 Dec 2016 15:18:33 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 0EE7C16F0; Mon, 19 Dec 2016 15:18:32 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBJFIWGA024401; Mon, 19 Dec 2016 15:18:32 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBJFIWNr024399; Mon, 19 Dec 2016 15:18:32 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201612191518.uBJFIWNr024399@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Mon, 19 Dec 2016 15:18:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310272 - in head/sys/cam: ctl scsi X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Dec 2016 15:18:33 -0000 Author: mav Date: Mon Dec 19 15:18:31 2016 New Revision: 310272 URL: https://svnweb.freebsd.org/changeset/base/310272 Log: Add new bits into Extended Inquiry VPD page. MFC after: 2 weeks Modified: head/sys/cam/ctl/ctl.c head/sys/cam/scsi/scsi_all.h Modified: head/sys/cam/ctl/ctl.c ============================================================================== --- head/sys/cam/ctl/ctl.c Mon Dec 19 15:09:30 2016 (r310271) +++ head/sys/cam/ctl/ctl.c Mon Dec 19 15:18:31 2016 (r310272) @@ -9542,7 +9542,7 @@ ctl_inquiry_evpd_eid(struct ctl_scsiio * * attention for a particular IT nexus on all LUNs once we report * it to that nexus once. This bit is required as of SPC-4. */ - eid_ptr->flags4 = SVPD_EID_LUICLT; + eid_ptr->flags4 = SVPD_EID_LUICLR; /* * XXX KDM in order to correctly answer this, we would need Modified: head/sys/cam/scsi/scsi_all.h ============================================================================== --- head/sys/cam/scsi/scsi_all.h Mon Dec 19 15:09:30 2016 (r310271) +++ head/sys/cam/scsi/scsi_all.h Mon Dec 19 15:18:31 2016 (r310272) @@ -2476,10 +2476,17 @@ struct scsi_vpd_extended_inquiry_data #define SVPD_EID_NV_SUP 0x02 #define SVPD_EID_V_SUP 0x01 uint8_t flags4; +#define SVPD_EID_NO_PI_CHK 0x20 #define SVPD_EID_P_I_I_SUP 0x10 -#define SVPD_EID_LUICLT 0x01 +#define SVPD_EID_LUICLR 0x01 uint8_t flags5; +#define SVPD_EID_LUCT_MASK 0xe0 +#define SVPD_EID_LUCT_NOT_REP 0x00 +#define SVPD_EID_LUCT_CONGL 0x20 +#define SVPD_EID_LUCT_GROUP 0x40 #define SVPD_EID_R_SUP 0x10 +#define SVPD_EID_RTD_SUP 0x08 +#define SVPD_EID_HSSRELEF 0x02 #define SVPD_EID_CBCS 0x01 uint8_t flags6; #define SVPD_EID_MULTI_I_T_FW 0x0F @@ -2490,10 +2497,16 @@ struct scsi_vpd_extended_inquiry_data uint8_t est[2]; uint8_t flags7; #define SVPD_EID_POA_SUP 0x80 -#define SVPD_EID_HRA_SUP 0x80 -#define SVPD_EID_VSA_SUP 0x80 +#define SVPD_EID_HRA_SUP 0x40 +#define SVPD_EID_VSA_SUP 0x20 uint8_t max_sense_length; - uint8_t reserved2[50]; + uint8_t bind_flags; +#define SVPD_EID_IBS 0x80 +#define SVPD_EID_IAS 0x40 +#define SVPD_EID_SAC 0x04 +#define SVPD_EID_NRD1 0x02 +#define SVPD_EID_NRD0 0x01 + uint8_t reserved2[49]; }; struct scsi_vpd_mode_page_policy_descr From owner-svn-src-all@freebsd.org Mon Dec 19 15:19:45 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 77B9BC8811D; Mon, 19 Dec 2016 15:19:45 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4758B1890; Mon, 19 Dec 2016 15:19:45 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBJFJit3024485; Mon, 19 Dec 2016 15:19:44 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBJFJiQk024484; Mon, 19 Dec 2016 15:19:44 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201612191519.uBJFJiQk024484@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Mon, 19 Dec 2016 15:19:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310273 - head/sys/conf X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Dec 2016 15:19:45 -0000 Author: emaste Date: Mon Dec 19 15:19:44 2016 New Revision: 310273 URL: https://svnweb.freebsd.org/changeset/base/310273 Log: newvers.sh: add -R option to include metadata only for unmodified src tree Sponsored by: The FreeBSD Foundation Modified: head/sys/conf/newvers.sh Modified: head/sys/conf/newvers.sh ============================================================================== --- head/sys/conf/newvers.sh Mon Dec 19 15:18:31 2016 (r310272) +++ head/sys/conf/newvers.sh Mon Dec 19 15:19:44 2016 (r310273) @@ -37,6 +37,10 @@ # the output file. This is intended to allow two builds # done at different times and even by different people on # different hosts to produce identical output. +# +# -R Reproducible build if the tree represents an unmodified +# checkout from a version control system. Metadata is +# included if the tree is modified. TYPE="FreeBSD" REVISION="12.0" @@ -193,6 +197,9 @@ fi if [ -n "$svnversion" ] ; then svn=`cd ${SYSDIR} && $svnversion 2>/dev/null` + if expr "$svn" : ".*M" >/dev/null; then + modified=true + fi case "$svn" in [0-9]*) svn=" r${svn}" ;; *) unset svn ;; @@ -227,6 +234,7 @@ if [ -n "$git_cmd" ] ; then if $git_cmd --work-tree=${VCSDIR}/.. diff-index \ --name-only HEAD | read dummy; then git="${git}-dirty" + modified=true fi fi @@ -239,7 +247,10 @@ if [ -n "$p4_cmd" ] ; then p4opened=`cd ${SYSDIR} && $p4_cmd opened ./... 2>&1` case "$p4opened" in File*) ;; - //*) p4version="${p4version}+edit" ;; + //*) + p4version="${p4version}+edit" + modified=true + ;; esac ;; *) unset p4version ;; @@ -264,6 +275,10 @@ while getopts r opt; do r) include_metadata= ;; + R) + if [ -z "${modified}" ]; then + include_metadata= + fi esac done shift $((OPTIND - 1)) From owner-svn-src-all@freebsd.org Mon Dec 19 15:23:26 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3449CC88294; Mon, 19 Dec 2016 15:23:26 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 00E511D15; Mon, 19 Dec 2016 15:23:25 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBJFNPQ4028155; Mon, 19 Dec 2016 15:23:25 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBJFNPP9028154; Mon, 19 Dec 2016 15:23:25 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201612191523.uBJFNPP9028154@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Mon, 19 Dec 2016 15:23:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310274 - head X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Dec 2016 15:23:26 -0000 Author: emaste Date: Mon Dec 19 15:23:24 2016 New Revision: 310274 URL: https://svnweb.freebsd.org/changeset/base/310274 Log: Add ld.debug to ObsoleteFiles.inc After r293285 GNU ld is installed as /usr/bin/ld.bfd, and linked as /usr/bin/ld. The debug file is /usr/lib/debug/usr/bin/ld.bfd.debug. MFC after: 1 week Sponsored by: The FreeBSD Foundation Modified: head/ObsoleteFiles.inc Modified: head/ObsoleteFiles.inc ============================================================================== --- head/ObsoleteFiles.inc Mon Dec 19 15:19:44 2016 (r310273) +++ head/ObsoleteFiles.inc Mon Dec 19 15:23:24 2016 (r310274) @@ -642,6 +642,8 @@ OLD_FILES+=usr/share/mdocml/style.css OLD_DIRS+=usr/share/mdocml # 20160114: SA-16:06.snmpd OLD_FILES+=usr/share/examples/etc/snmpd.config +# 20160107: GNU ld installed as ld.bfd and linked as ld +OLD_FILES+=usr/lib/debug/usr/bin/ld.debug # 20151225: new clang import which bumps version from 3.7.0 to 3.7.1. OLD_FILES+=usr/lib/clang/3.7.0/include/sanitizer/allocator_interface.h OLD_FILES+=usr/lib/clang/3.7.0/include/sanitizer/asan_interface.h From owner-svn-src-all@freebsd.org Mon Dec 19 15:48:15 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1D3BBC88A8A; Mon, 19 Dec 2016 15:48:15 +0000 (UTC) (envelope-from ken@kdm.org) Received: from mithlond.kdm.org (mithlond.kdm.org [96.89.93.250]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "A1-33714", Issuer "A1-33714" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id B95B61B48; Mon, 19 Dec 2016 15:48:14 +0000 (UTC) (envelope-from ken@kdm.org) Received: from mithlond.kdm.org (localhost [127.0.0.1]) by mithlond.kdm.org (8.15.2/8.14.9) with ESMTPS id uBJFm6Uv043171 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Mon, 19 Dec 2016 10:48:06 -0500 (EST) (envelope-from ken@mithlond.kdm.org) Received: (from ken@localhost) by mithlond.kdm.org (8.15.2/8.14.9/Submit) id uBJFm62k043170; Mon, 19 Dec 2016 10:48:06 -0500 (EST) (envelope-from ken) Date: Mon, 19 Dec 2016 10:48:06 -0500 From: "Kenneth D. Merry" To: Oliver Pinter Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r307684 - head/sbin/camcontrol Message-ID: <20161219154806.GA43009@mithlond.kdm.org> References: <201610201942.u9KJgQOR062772@repo.freebsd.org> <20161212223354.GA16028@mithlond.kdm.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.23 (2014-03-12) X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.4.3 (mithlond.kdm.org [127.0.0.1]); Mon, 19 Dec 2016 10:48:06 -0500 (EST) X-Spam-Status: No, score=-2.9 required=5.0 tests=ALL_TRUSTED,BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS autolearn=ham autolearn_force=no version=3.4.1 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on mithlond.kdm.org X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Dec 2016 15:48:15 -0000 On Sat, Dec 17, 2016 at 20:50:15 +0100, Oliver Pinter wrote: > On 12/12/16, Kenneth D. Merry wrote: > > On Sun, Dec 11, 2016 at 00:49:12 +0100, Oliver Pinter wrote: > >> On 10/20/16, Kenneth D. Merry wrote: > >> > Author: ken > >> > Date: Thu Oct 20 19:42:26 2016 > >> > New Revision: 307684 > >> > URL: https://svnweb.freebsd.org/changeset/base/307684 > >> > > >> > Log: > >> > For CCBs allocated on the stack, we need to clear the entire CCB, not > >> > just > >> > the header. Otherwise stack garbage can lead to random flags getting > >> > set. > >> > > >> > This showed up as 'camcontrol rescan all' failing with EINVAL because > >> > the > >> > address type wasn't CAM_DATA_VADDR. > >> > > >> > sbin/camcontrol/camcontrol.c: > >> > In rescan_or_reset_bus(), bzero the stack-allocated CCBs before > >> > use instead of clearing the body. > >> > > >> > MFC after: 3 days > >> > Sponsored by: Spectra Logic > >> > >> The MFC of this commit is missed both for 10-STABLE and 11-STABLE. Is > >> this still in plan to do? > > > > Done, thanks for the reminder! > > Thanks! > > Slightly related problem what I found on one of my INVARIANTS enabled > kernel is the following: > https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=215356 . A similar > change what this is required in smartmontools too. Ahh, yes, sounds like the same basic issue. Thanks for submitting it upstream! Ken -- Kenneth Merry ken@FreeBSD.ORG From owner-svn-src-all@freebsd.org Mon Dec 19 15:50:00 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id ADEDEC88BAD; Mon, 19 Dec 2016 15:50:00 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 7D8B81D1E; Mon, 19 Dec 2016 15:50:00 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBJFnxf8037142; Mon, 19 Dec 2016 15:49:59 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBJFnxwE037141; Mon, 19 Dec 2016 15:49:59 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201612191549.uBJFnxwE037141@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Mon, 19 Dec 2016 15:49:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310275 - head/sys/cam/ctl X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Dec 2016 15:50:00 -0000 Author: mav Date: Mon Dec 19 15:49:59 2016 New Revision: 310275 URL: https://svnweb.freebsd.org/changeset/base/310275 Log: Fix typo in function name. Modified: head/sys/cam/ctl/ctl_error.c Modified: head/sys/cam/ctl/ctl_error.c ============================================================================== --- head/sys/cam/ctl/ctl_error.c Mon Dec 19 15:23:24 2016 (r310274) +++ head/sys/cam/ctl/ctl_error.c Mon Dec 19 15:49:59 2016 (r310275) @@ -366,7 +366,7 @@ ctl_set_ua(struct ctl_scsiio *ctsio, int } static void -ctl_ua_to_acsq(struct ctl_lun *lun, ctl_ua_type ua_to_build, int *asc, +ctl_ua_to_ascq(struct ctl_lun *lun, ctl_ua_type ua_to_build, int *asc, int *ascq, ctl_ua_type *ua_to_clear, uint8_t **info) { @@ -492,7 +492,7 @@ ctl_build_qae(struct ctl_lun *lun, uint3 ua_to_build = (1 << (ffs(ua) - 1)); ua_to_clear = ua_to_build; info = NULL; - ctl_ua_to_acsq(lun, ua_to_build, &asc, &ascq, &ua_to_clear, &info); + ctl_ua_to_ascq(lun, ua_to_build, &asc, &ascq, &ua_to_clear, &info); resp[0] = SSD_KEY_UNIT_ATTENTION; if (ua_to_build == ua) @@ -537,7 +537,7 @@ ctl_build_ua(struct ctl_lun *lun, uint32 ua_to_build = (1 << (ffs(ua[i]) - 1)); ua_to_clear = ua_to_build; info = NULL; - ctl_ua_to_acsq(lun, ua_to_build, &asc, &ascq, &ua_to_clear, &info); + ctl_ua_to_ascq(lun, ua_to_build, &asc, &ascq, &ua_to_clear, &info); ctl_set_sense_data(sense, lun, sense_format, /*current_error*/ 1, /*sense_key*/ SSD_KEY_UNIT_ATTENTION, asc, ascq, From owner-svn-src-all@freebsd.org Mon Dec 19 17:02:27 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9811DC8838F; Mon, 19 Dec 2016 17:02:27 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from mail.baldwin.cx (bigwig.baldwin.cx [IPv6:2001:470:1f11:75::1]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 70C141013; Mon, 19 Dec 2016 17:02:27 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from ralph.baldwin.cx (c-73-231-226-104.hsd1.ca.comcast.net [73.231.226.104]) by mail.baldwin.cx (Postfix) with ESMTPSA id 2EBC010A76C; Mon, 19 Dec 2016 12:02:26 -0500 (EST) From: John Baldwin To: Hans Petter Selasky Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r310242 - head/sys/dev/usb Date: Mon, 19 Dec 2016 08:13:18 -0800 Message-ID: <2058091.PnquSlH0qI@ralph.baldwin.cx> User-Agent: KMail/4.14.10 (FreeBSD/11.0-PRERELEASE; KDE/4.14.10; amd64; ; ) In-Reply-To: <201612190928.uBJ9SDFc078376@repo.freebsd.org> References: <201612190928.uBJ9SDFc078376@repo.freebsd.org> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.4.3 (mail.baldwin.cx); Mon, 19 Dec 2016 12:02:26 -0500 (EST) X-Virus-Scanned: clamav-milter 0.99.2 at mail.baldwin.cx X-Virus-Status: Clean X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Dec 2016 17:02:27 -0000 On Monday, December 19, 2016 09:28:13 AM Hans Petter Selasky wrote: > Author: hselasky > Date: Mon Dec 19 09:28:12 2016 > New Revision: 310242 > URL: https://svnweb.freebsd.org/changeset/base/310242 > > Log: > Defer USB enumeration until the SI_SUB_KICK_SCHEDULER is executed to avoid > boot panics in conjunction with the recently added EARLY_AP_STARTUP feature. > The panics happen due to using kernel facilities like callouts too early. > > Tested by: jhb @ > MFC after: 1 week As mentioned in the thread, the patches to usb_hub.c weren't needed and the block in usb_process.c can just be removed unconditionally since it should never execute in the non-EARLY_AP_STARTUP case. -- John Baldwin From owner-svn-src-all@freebsd.org Mon Dec 19 17:02:29 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 536D7C88393; Mon, 19 Dec 2016 17:02:29 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from mail.baldwin.cx (bigwig.baldwin.cx [IPv6:2001:470:1f11:75::1]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 1371C101E; Mon, 19 Dec 2016 17:02:29 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from ralph.baldwin.cx (c-73-231-226-104.hsd1.ca.comcast.net [73.231.226.104]) by mail.baldwin.cx (Postfix) with ESMTPSA id 9587D10A746; Mon, 19 Dec 2016 12:02:27 -0500 (EST) From: John Baldwin To: Eric van Gyzen Cc: Warner Losh , Dimitry Andric , Baptiste Daroussin , "Conrad E. Meyer" , src-committers , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" Subject: Re: svn commit: r310138 - head/lib/libc/stdio Date: Sat, 17 Dec 2016 12:33:33 -0800 Message-ID: <49460793.UcUNovQMDa@ralph.baldwin.cx> User-Agent: KMail/4.14.10 (FreeBSD/11.0-PRERELEASE; KDE/4.14.10; amd64; ; ) In-Reply-To: References: <201612160144.uBG1ipjW016736@repo.freebsd.org> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.4.3 (mail.baldwin.cx); Mon, 19 Dec 2016 12:02:27 -0500 (EST) X-Virus-Scanned: clamav-milter 0.99.2 at mail.baldwin.cx X-Virus-Status: Clean X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Dec 2016 17:02:29 -0000 On Friday, December 16, 2016 07:31:28 PM Eric van Gyzen wrote: > On 12/16/2016 17:44, Warner Losh wrote: > > On Fri, Dec 16, 2016 at 3:07 PM, John Baldwin wrote: > >> On Friday, December 16, 2016 04:53:04 PM Eric van Gyzen wrote: > >>> On 12/16/2016 16:45, John Baldwin wrote: > >>>> On Friday, December 16, 2016 08:53:26 PM Dimitry Andric wrote: > >>>>> On 16 Dec 2016, at 20:31, Baptiste Daroussin wrote: > >>>>>> > >>>>>> On Fri, Dec 16, 2016 at 01:44:51AM +0000, Conrad E. Meyer wrote: > >>>>>>> Author: cem > >>>>>>> Date: Fri Dec 16 01:44:50 2016 > >>>>>>> New Revision: 310138 > >>>>>>> URL: https://svnweb.freebsd.org/changeset/base/310138 > >>>>>>> > >>>>>>> Log: > >>>>>>> vfprintf(3): Add support for kernel %b format > >>>>>>> > >>>>>>> This is a direct port of the kernel %b format. > >>>>>>> > >>>>>>> I'm unclear on if (more) non-portable printf extensions will be a > >>>>>>> problem. I think it's desirable to have userspace formats include all > >>>>>>> kernel formats, but there may be competing goals I'm not aware of. > >>>>>>> > >>>>>>> Reviewed by: no one, unfortunately > >>>>>>> Sponsored by: Dell EMC Isilon > >>>>>>> Differential Revision: https://reviews.freebsd.org/D8426 > >>>>>>> > >>>>>> > >>>>>> I really don't think it is a good idea, if used in userland it would be make > >>>>>> more of our code difficult to port elsewhere. > >>>>> > >>>>> Indeed, this is a bad idea. These custom format specifiers should be > >>>>> eliminated, not multiplied. :-) > >>>>> > >>>>> > >>>>>> Other than that, it makes more difficult to use vanilla gcc with out userland. > >>>>>> and it is adding more complexity to be able to build freebsd from a non freebsd > >>>>>> system which some people are working on. > >>>>>> > >>>>>> Personnaly I would prefer to see those extensions removed from the kernel rather > >>>>>> than see them available in userland. > >>>>> > >>>>> Same here. > >>>>> > >>>>> > >>>>>> Can't we use simple helper function instead? > >>>>> > >>>>> Yes, please. Just take the snprintb(3) function from NetBSD: > >>>>> > >>>>> http://netbsd.gw.com/cgi-bin/man-cgi?snprintb+3+NetBSD-current > >>>> > >>>> In general I agree with something like this instead, but it is quite a bit more > >>>> tedious to use as you have to run it once to determine the length, allocate a > >>>> buffer, and then run it again. Calling malloc() for that buffer isn't always > >>>> convenient in the kernel (though it should be fine in userland). Having it live > >>>> in printf() itself means the output is generated to the stream without having to > >>>> manage a variable-sized intermediate buffer. > >>> > >>> I imagine most callers can simply use a char[sizeof(fmt)+C] on the stack, where > >>> C is some constant that I haven't taken the time to calculate, at the risk of > >>> making myself look foolish and unprofessional. > >> > >> Hmm, that might work, but it is still cumbersome. Probably to make things readable > >> we'd end up with a wrapper: > >> > >> printb(uint val, const char *fmt) > >> { > >> char buf[strlen(fmt) + C]; > >> > >> snprintb(...); > >> printf("%s", buf); > >> } > > > > Sadly this "cure" is worse than the disease. > > How about this cure? > > printf("reg=%b\n", value, FORMAT); > > // versus > > char buf[BITMASK_BUFFER_SIZE(FORMAT)]; > printf("reg=%s\n", format_bitmask(buf, sizeof(buf), value, FORMAT)); > > That doesn't seem so bad. The trick here is giving FORMAT twice. For code that often uses %b that is untenable. You would have to make it a macro (or use printb which only accepts it once which is why I suggested that approach instead). But a macro moves its definition out of context. Here's an example to think about: /* * Here we should probably set up flags indicating * whether or not various features are available. * The interesting ones are probably VME, PSE, PAE, * and PGE. The code already assumes without bothering * to check that all CPUs >= Pentium have a TSC and * MSRs. */ printf("\n Features=0x%b", cpu_feature, "\020" "\001FPU" /* Integral FPU */ "\002VME" /* Extended VM86 mode support */ "\003DE" /* Debugging Extensions (CR4.DE) */ "\004PSE" /* 4MByte page tables */ "\005TSC" /* Timestamp counter */ "\006MSR" /* Machine specific registers */ "\007PAE" /* Physical address extension */ "\010MCE" /* Machine Check support */ "\011CX8" /* CMPEXCH8 instruction */ "\012APIC" /* SMP local APIC */ "\013oldMTRR" /* Previous implementation of MTRR */ "\014SEP" /* Fast System Call */ "\015MTRR" /* Memory Type Range Registers */ "\016PGE" /* PG_G (global bit) support */ "\017MCA" /* Machine Check Architecture */ "\020CMOV" /* CMOV instruction */ "\021PAT" /* Page attributes table */ "\022PSE36" /* 36 bit address space support */ "\023PN" /* Processor Serial number */ "\024CLFLUSH" /* Has the CLFLUSH instruction */ "\025" "\026DTS" /* Debug Trace Store */ "\027ACPI" /* ACPI support */ "\030MMX" /* MMX instructions */ "\031FXSR" /* FXSAVE/FXRSTOR */ "\032SSE" /* Streaming SIMD Extensions */ "\033SSE2" /* Streaming SIMD Extensions #2 */ "\034SS" /* Self snoop */ "\035HTT" /* Hyperthreading (see EBX bit 16-23) */ "\036TM" /* Thermal Monitor clock slowdown */ "\037IA64" /* CPU can execute IA64 instructions */ "\040PBE" /* Pending Break Enable */ ); if (cpu_feature2 != 0) { printf("\n Features2=0x%b", cpu_feature2, "\020" "\001SSE3" /* SSE3 */ "\002PCLMULQDQ" /* Carry-Less Mul Quadword */ "\003DTES64" /* 64-bit Debug Trace */ "\004MON" /* MONITOR/MWAIT Instructions */ "\005DS_CPL" /* CPL Qualified Debug Store */ "\006VMX" /* Virtual Machine Extensions */ "\007SMX" /* Safer Mode Extensions */ "\010EST" /* Enhanced SpeedStep */ "\011TM2" /* Thermal Monitor 2 */ "\012SSSE3" /* SSSE3 */ "\013CNXT-ID" /* L1 context ID available */ "\014SDBG" /* IA32 silicon debug */ "\015FMA" /* Fused Multiply Add */ "\016CX16" /* CMPXCHG16B Instruction */ "\017xTPR" /* Send Task Priority Messages*/ "\020PDCM" /* Perf/Debug Capability MSR */ "\021" "\022PCID" /* Process-context Identifiers*/ "\023DCA" /* Direct Cache Access */ "\024SSE4.1" /* SSE 4.1 */ "\025SSE4.2" /* SSE 4.2 */ "\026x2APIC" /* xAPIC Extensions */ "\027MOVBE" /* MOVBE Instruction */ "\030POPCNT" /* POPCNT Instruction */ "\031TSCDLT" /* TSC-Deadline Timer */ "\032AESNI" /* AES Crypto */ "\033XSAVE" /* XSAVE/XRSTOR States */ "\034OSXSAVE" /* OS-Enabled State Management*/ "\035AVX" /* Advanced Vector Extensions */ "\036F16C" /* Half-precision conversions */ "\037RDRAND" /* RDRAND Instruction */ "\040HV" /* Hypervisor */ ); } (and several more of these) -- John Baldwin From owner-svn-src-all@freebsd.org Mon Dec 19 17:02:33 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A73E3C884CB; Mon, 19 Dec 2016 17:02:33 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from mail.baldwin.cx (bigwig.baldwin.cx [96.47.65.170]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 7D8D3106C; Mon, 19 Dec 2016 17:02:32 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from ralph.baldwin.cx (c-73-231-226-104.hsd1.ca.comcast.net [73.231.226.104]) by mail.baldwin.cx (Postfix) with ESMTPSA id D6B4E10A761; Mon, 19 Dec 2016 12:02:24 -0500 (EST) From: John Baldwin To: Andriy Gapon Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: Re: svn commit: r308371 - in stable/10: share/man/man4 sys/conf sys/dev/jedec_ts sys/modules/i2c sys/modules/i2c/jedec_ts Date: Mon, 19 Dec 2016 08:55:26 -0800 Message-ID: <2547422.gn4y6NaJ31@ralph.baldwin.cx> User-Agent: KMail/4.14.10 (FreeBSD/11.0-PRERELEASE; KDE/4.14.10; amd64; ; ) In-Reply-To: <912ba7fd-353c-006e-ef65-faa12b83de9f@FreeBSD.org> References: <201611061356.uA6DuYcO079294@repo.freebsd.org> <1625245.4edrXav981@ralph.baldwin.cx> <912ba7fd-353c-006e-ef65-faa12b83de9f@FreeBSD.org> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.4.3 (mail.baldwin.cx); Mon, 19 Dec 2016 12:02:24 -0500 (EST) X-Virus-Scanned: clamav-milter 0.99.2 at mail.baldwin.cx X-Virus-Status: Clean X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Dec 2016 17:02:33 -0000 On Wednesday, December 14, 2016 05:41:47 PM Andriy Gapon wrote: > On 05/12/2016 23:49, John Baldwin wrote: > > On Sunday, November 06, 2016 01:56:34 PM Andriy Gapon wrote: > >> Author: avg > >> Date: Sun Nov 6 13:56:34 2016 > >> New Revision: 308371 > >> URL: https://svnweb.freebsd.org/changeset/base/308371 > >> > >> Log: > >> MFC r307768: jedec_ts: a driver for thermal sensors on memory modules > >> > >> Added: > >> stable/10/share/man/man4/jedec_ts.4 > >> - copied unchanged from r307768, head/share/man/man4/jedec_ts.4 > >> stable/10/sys/dev/jedec_ts/ > >> - copied from r307768, head/sys/dev/jedec_ts/ > >> stable/10/sys/modules/i2c/jedec_ts/ > >> - copied from r307768, head/sys/modules/i2c/jedec_ts/ > >> Modified: > >> stable/10/sys/conf/NOTES > >> stable/10/sys/conf/files > >> stable/10/sys/modules/i2c/Makefile > >> Directory Properties: > >> stable/10/ (props changed) > > > > FYI, this doesn't work and has broken tinderbox builds on stable/10. > > smbus_get_addr() doesn't exist on 10. It was originally a hand-rolled > > ivar wrapper that was removed in r93023 in 2002. The function prototype > > was not removed, so the compile works, but linking fails. The stale > > prototype is still present in smbconf.h in HEAD (and should be removed). > > The "real" smbus_get_addr() was added back to smbconf.h along with an > > implementation of smbus_read_ivar() in r281985. Parts of that commit > > probably need to be MFC'd to 10. > > > > John, > > thank you for catching this and sorry for the trouble. > Could you please check if r310062 really fixes the problem? Yes. Well, it fixes linking of kernels at least. Now make tinderbox on 10 fails for the following kernels: _.ia64.GENERIC: Maxmem is not available on ia64. It is spelled paddr_max instead. The firewire code is trying to use Maxmem. _.ia64.LINT: Same. _.arm.LINT: Many link errors and warnings, though lack of 'kbd_*' symbols seems to be the only actual errors. I suspect you recently MFC'd changes to fwohci.c that are using Maxmem. However, I'm not sure it is worth fixing fwohci on ia64. -- John Baldwin From owner-svn-src-all@freebsd.org Mon Dec 19 17:02:56 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D3225C88584; Mon, 19 Dec 2016 17:02:56 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 981431348; Mon, 19 Dec 2016 17:02:56 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBJH2tv0073763; Mon, 19 Dec 2016 17:02:55 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBJH2tLM073762; Mon, 19 Dec 2016 17:02:55 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <201612191702.uBJH2tLM073762@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Mon, 19 Dec 2016 17:02:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r310276 - stable/11/lib/libusb X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Dec 2016 17:02:57 -0000 Author: trasz Date: Mon Dec 19 17:02:55 2016 New Revision: 310276 URL: https://svnweb.freebsd.org/changeset/base/310276 Log: MFC r307774: Fix libusb20_dev_get_desc(3) to use the "vendor product" order, not "product vendor". This is consistent with how it's generally done. The ordering is visible eg in usbconfig(8) output. Modified: stable/11/lib/libusb/libusb20_ugen20.c Directory Properties: stable/11/ (props changed) Modified: stable/11/lib/libusb/libusb20_ugen20.c ============================================================================== --- stable/11/lib/libusb/libusb20_ugen20.c Mon Dec 19 15:49:59 2016 (r310275) +++ stable/11/lib/libusb/libusb20_ugen20.c Mon Dec 19 17:02:55 2016 (r310276) @@ -214,8 +214,8 @@ ugen20_enumerate(struct libusb20_device snprintf(pdev->usb_desc, sizeof(pdev->usb_desc), USB_GENERIC_NAME "%u.%u: <%s %s> at usbus%u", pdev->bus_number, - pdev->device_address, devinfo.udi_product, - devinfo.udi_vendor, pdev->bus_number); + pdev->device_address, devinfo.udi_vendor, + devinfo.udi_product, pdev->bus_number); error = 0; done: From owner-svn-src-all@freebsd.org Mon Dec 19 17:05:26 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0A9CAC886F2; Mon, 19 Dec 2016 17:05:26 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id CE11F17A7; Mon, 19 Dec 2016 17:05:25 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBJH5PoM073899; Mon, 19 Dec 2016 17:05:25 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBJH5Pm6073898; Mon, 19 Dec 2016 17:05:25 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <201612191705.uBJH5Pm6073898@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Mon, 19 Dec 2016 17:05:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r310277 - stable/11/sys/dev/usb X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Dec 2016 17:05:26 -0000 Author: trasz Date: Mon Dec 19 17:05:24 2016 New Revision: 310277 URL: https://svnweb.freebsd.org/changeset/base/310277 Log: MFC r307902: Make the USB attach strings in dmesg include product name. Modified: stable/11/sys/dev/usb/usb_device.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/usb/usb_device.c ============================================================================== --- stable/11/sys/dev/usb/usb_device.c Mon Dec 19 17:02:55 2016 (r310276) +++ stable/11/sys/dev/usb/usb_device.c Mon Dec 19 17:05:24 2016 (r310277) @@ -1938,8 +1938,8 @@ config_done: udev->ugen_symlink = usb_alloc_symlink(udev->ugen_name); /* Announce device */ - printf("%s: <%s> at %s\n", udev->ugen_name, - usb_get_manufacturer(udev), + printf("%s: <%s %s> at %s\n", udev->ugen_name, + usb_get_manufacturer(udev), usb_get_product(udev), device_get_nameunit(udev->bus->bdev)); #endif @@ -2148,8 +2148,9 @@ usb_free_device(struct usb_device *udev, #if USB_HAVE_UGEN if (!rebooting) { - printf("%s: <%s> at %s (disconnected)\n", udev->ugen_name, - usb_get_manufacturer(udev), device_get_nameunit(bus->bdev)); + printf("%s: <%s %s> at %s (disconnected)\n", udev->ugen_name, + usb_get_manufacturer(udev), usb_get_product(udev), + device_get_nameunit(bus->bdev)); } /* Destroy UGEN symlink, if any */ From owner-svn-src-all@freebsd.org Mon Dec 19 17:10:31 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id EFE82C887B3; Mon, 19 Dec 2016 17:10:31 +0000 (UTC) (envelope-from hrs@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B0A9819B4; Mon, 19 Dec 2016 17:10:31 +0000 (UTC) (envelope-from hrs@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBJHAUw2074235; Mon, 19 Dec 2016 17:10:30 GMT (envelope-from hrs@FreeBSD.org) Received: (from hrs@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBJHAUZL074234; Mon, 19 Dec 2016 17:10:30 GMT (envelope-from hrs@FreeBSD.org) Message-Id: <201612191710.uBJHAUZL074234@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hrs set sender to hrs@FreeBSD.org using -f From: Hiroki Sato Date: Mon, 19 Dec 2016 17:10:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310278 - head/usr.sbin/syslogd X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Dec 2016 17:10:32 -0000 Author: hrs Date: Mon Dec 19 17:10:30 2016 New Revision: 310278 URL: https://svnweb.freebsd.org/changeset/base/310278 Log: Add a missing STAILQ_INSERT_TAIL() for allowaddr rule. Modified: head/usr.sbin/syslogd/syslogd.c Modified: head/usr.sbin/syslogd/syslogd.c ============================================================================== --- head/usr.sbin/syslogd/syslogd.c Mon Dec 19 17:05:24 2016 (r310277) +++ head/usr.sbin/syslogd/syslogd.c Mon Dec 19 17:10:30 2016 (r310278) @@ -2303,7 +2303,7 @@ static int allowaddr(char *s) { char *cp1, *cp2; - struct allowedpeer ap; + struct allowedpeer *ap; struct servent *se; int masklen = -1; struct addrinfo hints, *res; @@ -2314,6 +2314,10 @@ allowaddr(char *s) #endif char ip[NI_MAXHOST]; + ap = calloc(1, sizeof(*ap)); + if (ap == NULL) + err(1, "malloc failed"); + #ifdef INET6 if (*s != '[' || (cp1 = strchr(s + 1, ']')) == NULL) #endif @@ -2323,20 +2327,20 @@ allowaddr(char *s) *cp1++ = '\0'; if (strlen(cp1) == 1 && *cp1 == '*') /* any port allowed */ - ap.port = 0; + ap->port = 0; else if ((se = getservbyname(cp1, "udp"))) { - ap.port = ntohs(se->s_port); + ap->port = ntohs(se->s_port); } else { - ap.port = strtol(cp1, &cp2, 0); + ap->port = strtol(cp1, &cp2, 0); if (*cp2 != '\0') return (-1); /* port not numeric */ } } else { if ((se = getservbyname("syslog", "udp"))) - ap.port = ntohs(se->s_port); + ap->port = ntohs(se->s_port); else /* sanity, should not happen */ - ap.port = 514; + ap->port = 514; } if ((cp1 = strchr(s, '/')) != NULL && @@ -2363,14 +2367,14 @@ allowaddr(char *s) hints.ai_socktype = SOCK_DGRAM; hints.ai_flags = AI_PASSIVE | AI_NUMERICHOST; if (getaddrinfo(s, NULL, &hints, &res) == 0) { - ap.isnumeric = 1; - memcpy(&ap.a_addr, res->ai_addr, res->ai_addrlen); - memset(&ap.a_mask, 0, sizeof(ap.a_mask)); - ap.a_mask.ss_family = res->ai_family; + ap->isnumeric = 1; + memcpy(&ap->a_addr, res->ai_addr, res->ai_addrlen); + memset(&ap->a_mask, 0, sizeof(ap->a_mask)); + ap->a_mask.ss_family = res->ai_family; if (res->ai_family == AF_INET) { - ap.a_mask.ss_len = sizeof(struct sockaddr_in); - maskp = &((struct sockaddr_in *)&ap.a_mask)->sin_addr; - addrp = &((struct sockaddr_in *)&ap.a_addr)->sin_addr; + ap->a_mask.ss_len = sizeof(struct sockaddr_in); + maskp = &((struct sockaddr_in *)&ap->a_mask)->sin_addr; + addrp = &((struct sockaddr_in *)&ap->a_addr)->sin_addr; if (masklen < 0) { /* use default netmask */ if (IN_CLASSA(ntohl(addrp->s_addr))) @@ -2394,10 +2398,10 @@ allowaddr(char *s) } #ifdef INET6 else if (res->ai_family == AF_INET6 && masklen <= 128) { - ap.a_mask.ss_len = sizeof(struct sockaddr_in6); + ap->a_mask.ss_len = sizeof(struct sockaddr_in6); if (masklen < 0) masklen = 128; - mask6p = (u_int32_t *)&((struct sockaddr_in6 *)&ap.a_mask)->sin6_addr; + mask6p = (u_int32_t *)&((struct sockaddr_in6 *)&ap->a_mask)->sin6_addr; /* convert masklen to netmask */ while (masklen > 0) { if (masklen < 32) { @@ -2408,8 +2412,8 @@ allowaddr(char *s) masklen -= 32; } /* Lose any host bits in the network number. */ - mask6p = (u_int32_t *)&((struct sockaddr_in6 *)&ap.a_mask)->sin6_addr; - addr6p = (u_int32_t *)&((struct sockaddr_in6 *)&ap.a_addr)->sin6_addr; + mask6p = (u_int32_t *)&((struct sockaddr_in6 *)&ap->a_mask)->sin6_addr; + addr6p = (u_int32_t *)&((struct sockaddr_in6 *)&ap->a_addr)->sin6_addr; for (i = 0; i < 4; i++) addr6p[i] &= mask6p[i]; } @@ -2421,8 +2425,8 @@ allowaddr(char *s) freeaddrinfo(res); } else { /* arg `s' is domain name */ - ap.isnumeric = 0; - ap.a_name = s; + ap->isnumeric = 0; + ap->a_name = s; if (cp1) *cp1 = '/'; #ifdef INET6 @@ -2432,23 +2436,24 @@ allowaddr(char *s) } #endif } + STAILQ_INSERT_TAIL(&aphead, ap, next); if (Debug) { printf("allowaddr: rule "); - if (ap.isnumeric) { + if (ap->isnumeric) { printf("numeric, "); - getnameinfo((struct sockaddr *)&ap.a_addr, - ((struct sockaddr *)&ap.a_addr)->sa_len, + getnameinfo((struct sockaddr *)&ap->a_addr, + ((struct sockaddr *)&ap->a_addr)->sa_len, ip, sizeof ip, NULL, 0, NI_NUMERICHOST); printf("addr = %s, ", ip); - getnameinfo((struct sockaddr *)&ap.a_mask, - ((struct sockaddr *)&ap.a_mask)->sa_len, + getnameinfo((struct sockaddr *)&ap->a_mask, + ((struct sockaddr *)&ap->a_mask)->sa_len, ip, sizeof ip, NULL, 0, NI_NUMERICHOST); printf("mask = %s; ", ip); } else { - printf("domainname = %s; ", ap.a_name); + printf("domainname = %s; ", ap->a_name); } - printf("port = %d\n", ap.port); + printf("port = %d\n", ap->port); } return (0); } From owner-svn-src-all@freebsd.org Mon Dec 19 17:31:36 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 24CD1C88CEA; Mon, 19 Dec 2016 17:31:36 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E88DB1527; Mon, 19 Dec 2016 17:31:35 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBJHVZIR083760; Mon, 19 Dec 2016 17:31:35 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBJHVZHA083759; Mon, 19 Dec 2016 17:31:35 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201612191731.uBJHVZHA083759@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Mon, 19 Dec 2016 17:31:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310279 - head/sys/conf X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Dec 2016 17:31:36 -0000 Author: emaste Date: Mon Dec 19 17:31:34 2016 New Revision: 310279 URL: https://svnweb.freebsd.org/changeset/base/310279 Log: newvers.sh: consider as modified SVN mixed revision and other cases The newvers -R option is intended to include build metadata (e.g. user, host, time) if the build is from an unmodified VCS tree. For subversion it considered a trailing 'M' as an indication of a modified tree, and any other version string as modified. Also include mixed revision checkouts (e.g. 123:126), switched (123S) and partial (123P) working copies as modified: the revision number is insufficient to uniquely determine which source was used for the build. Reported by: gjb Reviewed by: gjb MFC after: 1 month Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D8853 Modified: head/sys/conf/newvers.sh Modified: head/sys/conf/newvers.sh ============================================================================== --- head/sys/conf/newvers.sh Mon Dec 19 17:10:30 2016 (r310278) +++ head/sys/conf/newvers.sh Mon Dec 19 17:31:34 2016 (r310279) @@ -197,12 +197,17 @@ fi if [ -n "$svnversion" ] ; then svn=`cd ${SYSDIR} && $svnversion 2>/dev/null` - if expr "$svn" : ".*M" >/dev/null; then - modified=true - fi case "$svn" in - [0-9]*) svn=" r${svn}" ;; - *) unset svn ;; + [0-9]*[MSP]|*:*) + svn=" r${svn}" + modified=true + ;; + [0-9]*) + svn=" r${svn}" + ;; + *) + unset svn + ;; esac fi @@ -270,7 +275,7 @@ if [ -n "$hg_cmd" ] ; then fi include_metadata=true -while getopts r opt; do +while getopts rR opt; do case "$opt" in r) include_metadata= From owner-svn-src-all@freebsd.org Mon Dec 19 17:34:33 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 92BEEC88DA7; Mon, 19 Dec 2016 17:34:33 +0000 (UTC) (envelope-from etnapierala@gmail.com) Received: from mail-wm0-x242.google.com (mail-wm0-x242.google.com [IPv6:2a00:1450:400c:c09::242]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 250F017AA; Mon, 19 Dec 2016 17:34:33 +0000 (UTC) (envelope-from etnapierala@gmail.com) Received: by mail-wm0-x242.google.com with SMTP id a20so19944104wme.2; Mon, 19 Dec 2016 09:34:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:date:from:to:cc:subject:message-id:mail-followup-to :references:mime-version:content-disposition:in-reply-to:user-agent; bh=55jvvjegnbyVqwBnjSbboejmPelXdGafZr4VViIfnGA=; b=E9UxuS+zIk5OwzbTA+egezd3YMGxzNESfYCTg7SP4OofVtNHpHusQGbmFjk9X6ydWM dlNMlgLZCFk04OEf0cxWvVq7MYLDT7R74v3ox/bfGKVVlsjdzRJuyXFRGLjbyhMEwZsp h4+bnz0Ns5F/XOH9V0jmLAofT+SL5hqwlzUEs5FlJK8ieuf4wxPEDTWbvfV5Q5mEZH8W zVySQnN5L0Fo3Xd/WSYAOSoHOBzNmru7C678Z8NIeb+jq+Kjpp/H+mz36YtTD1Be4Bgo qI9lvSG+x3mwIA1MQKoaE+GrjZ2BzyX8yfY2C2aKlyPLUsRcoWJ5NmJHzpHi083rgqj1 6wkg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:from:to:cc:subject:message-id :mail-followup-to:references:mime-version:content-disposition :in-reply-to:user-agent; bh=55jvvjegnbyVqwBnjSbboejmPelXdGafZr4VViIfnGA=; b=GN2nWSnVgk8erhGJwlvDrVweDZPPMoxMIe4DerkQxj3Qet8okO90Qv5C1xYmA/zfb6 q/y5wpAXREXQMiTSXm6JnOpB/oNzYRReWW1SPKSDwGB9K1pj7AR7TmjeDt96b/5JTgDX eKQpAN66AfR2oaD3z6Ifor+TaX9hhlaK0mosaBmLGiJWj+ZxPNP/RbFB1wS0/5sgmfw9 MwcUJ4eI502zq2kS8pHfw1DYlLx5ipxlZJsfHqDmQZwooQgrrcdJT8by442dJZHiUXOz Vcz28CbWaH3BH1hyXLAB2jY/WeUuZS8jbyRSXEGvnSsp2C9QS96KdwlHnDJl59P0J9U4 ULvA== X-Gm-Message-State: AIkVDXKQ6AzrWoQ6W+UtWzlp7YKhu7dKsejtjQhh/LJBHq/os6SDZ2KlVbsDQ5qBbvfkKQ== X-Received: by 10.28.138.135 with SMTP id m129mr13879917wmd.36.1482168871550; Mon, 19 Dec 2016 09:34:31 -0800 (PST) Received: from brick (acyx46.neoplus.adsl.tpnet.pl. [83.11.207.46]) by smtp.gmail.com with ESMTPSA id w197sm18165736wmd.11.2016.12.19.09.34.29 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 19 Dec 2016 09:34:30 -0800 (PST) Sender: =?UTF-8?Q?Edward_Tomasz_Napiera=C5=82a?= Date: Mon, 19 Dec 2016 18:34:27 +0100 From: Edward Tomasz Napierala To: Oliver Pinter Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r307774 - head/lib/libusb Message-ID: <20161219173427.GA3586@brick> Mail-Followup-To: Oliver Pinter , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201610221437.u9MEbDLR070111@repo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.7.1 (2016-10-04) X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Dec 2016 17:34:33 -0000 On 1211T0110, Oliver Pinter wrote: > On 10/22/16, Edward Tomasz Napierala wrote: > > Author: trasz > > Date: Sat Oct 22 14:37:13 2016 > > New Revision: 307774 > > URL: https://svnweb.freebsd.org/changeset/base/307774 > > > > Log: > > Fix libusb20_dev_get_desc(3) to use the "vendor product" order, not > > "product vendor". This is consistent with how it's generally done. > > The ordering is visible eg in usbconfig(8) output. > > > > Note to self: MFC this to 9 and 8. > > > > Reviewed by: hselasky@ > > MFC after: 1 month > > Is this MFC still valid? I can't see them in 10-STABLE nor in 11-STABLE. Working on it, thanks for the reminder :-) From owner-svn-src-all@freebsd.org Mon Dec 19 17:37:50 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id ABD74C88FF8; Mon, 19 Dec 2016 17:37:50 +0000 (UTC) (envelope-from hps@selasky.org) Received: from mail.turbocat.net (turbocat.net [88.99.82.50]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 74B211C29; Mon, 19 Dec 2016 17:37:49 +0000 (UTC) (envelope-from hps@selasky.org) Received: from hps2016.home.selasky.org (unknown [62.141.129.119]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.turbocat.net (Postfix) with ESMTPSA id 3FBD51FE1B5; Mon, 19 Dec 2016 18:37:47 +0100 (CET) Subject: Re: svn commit: r310242 - head/sys/dev/usb To: John Baldwin References: <201612190928.uBJ9SDFc078376@repo.freebsd.org> <2058091.PnquSlH0qI@ralph.baldwin.cx> Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org From: Hans Petter Selasky Message-ID: <57d2d5e2-1b2d-09d5-41e2-92b6f22fb229@selasky.org> Date: Mon, 19 Dec 2016 18:37:17 +0100 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:45.0) Gecko/20100101 Thunderbird/45.4.0 MIME-Version: 1.0 In-Reply-To: <2058091.PnquSlH0qI@ralph.baldwin.cx> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Dec 2016 17:37:50 -0000 On 12/19/16 17:13, John Baldwin wrote: > On Monday, December 19, 2016 09:28:13 AM Hans Petter Selasky wrote: >> Author: hselasky >> Date: Mon Dec 19 09:28:12 2016 >> New Revision: 310242 >> URL: https://svnweb.freebsd.org/changeset/base/310242 >> >> Log: >> Defer USB enumeration until the SI_SUB_KICK_SCHEDULER is executed to avoid >> boot panics in conjunction with the recently added EARLY_AP_STARTUP feature. >> The panics happen due to using kernel facilities like callouts too early. >> >> Tested by: jhb @ >> MFC after: 1 week > > As mentioned in the thread, the patches to usb_hub.c weren't needed and the block > in usb_process.c can just be removed unconditionally since it should never execute > in the non-EARLY_AP_STARTUP case. > Hi John, The checks in usb_process.c are needed in case attaching a USB controller fails for some unknown reason. Then there is a problem that thread0 cannot wait/sleep for the process to exit, so that it doesn't access freed memory. Did I miss anything? --HPS From owner-svn-src-all@freebsd.org Mon Dec 19 18:26:27 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A8BD7C88F7E; Mon, 19 Dec 2016 18:26:27 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 7761415FF; Mon, 19 Dec 2016 18:26:27 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBJIQQRb007292; Mon, 19 Dec 2016 18:26:26 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBJIQQXV007291; Mon, 19 Dec 2016 18:26:26 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <201612191826.uBJIQQXV007291@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Mon, 19 Dec 2016 18:26:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r310280 - stable/10/lib/libusb X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Dec 2016 18:26:27 -0000 Author: trasz Date: Mon Dec 19 18:26:26 2016 New Revision: 310280 URL: https://svnweb.freebsd.org/changeset/base/310280 Log: MFC r307774: Fix libusb20_dev_get_desc(3) to use the "vendor product" order, not "product vendor". This is consistent with how it's generally done. The ordering is visible eg in usbconfig(8) output. Modified: stable/10/lib/libusb/libusb20_ugen20.c Directory Properties: stable/10/ (props changed) Modified: stable/10/lib/libusb/libusb20_ugen20.c ============================================================================== --- stable/10/lib/libusb/libusb20_ugen20.c Mon Dec 19 17:31:34 2016 (r310279) +++ stable/10/lib/libusb/libusb20_ugen20.c Mon Dec 19 18:26:26 2016 (r310280) @@ -214,8 +214,8 @@ ugen20_enumerate(struct libusb20_device snprintf(pdev->usb_desc, sizeof(pdev->usb_desc), USB_GENERIC_NAME "%u.%u: <%s %s> at usbus%u", pdev->bus_number, - pdev->device_address, devinfo.udi_product, - devinfo.udi_vendor, pdev->bus_number); + pdev->device_address, devinfo.udi_vendor, + devinfo.udi_product, pdev->bus_number); error = 0; done: From owner-svn-src-all@freebsd.org Mon Dec 19 18:27:23 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 476C0C88008; Mon, 19 Dec 2016 18:27:23 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 16A14179A; Mon, 19 Dec 2016 18:27:23 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBJIRMBt007392; Mon, 19 Dec 2016 18:27:22 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBJIRMNg007391; Mon, 19 Dec 2016 18:27:22 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <201612191827.uBJIRMNg007391@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Mon, 19 Dec 2016 18:27:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r310281 - stable/10/sys/dev/usb X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Dec 2016 18:27:23 -0000 Author: trasz Date: Mon Dec 19 18:27:22 2016 New Revision: 310281 URL: https://svnweb.freebsd.org/changeset/base/310281 Log: MFC r307902: Make the USB attach strings in dmesg include product name. MFC after: 1 month Modified: stable/10/sys/dev/usb/usb_device.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/usb/usb_device.c ============================================================================== --- stable/10/sys/dev/usb/usb_device.c Mon Dec 19 18:26:26 2016 (r310280) +++ stable/10/sys/dev/usb/usb_device.c Mon Dec 19 18:27:22 2016 (r310281) @@ -1941,8 +1941,8 @@ config_done: udev->ugen_symlink = usb_alloc_symlink(udev->ugen_name); /* Announce device */ - printf("%s: <%s> at %s\n", udev->ugen_name, - usb_get_manufacturer(udev), + printf("%s: <%s %s> at %s\n", udev->ugen_name, + usb_get_manufacturer(udev), usb_get_product(udev), device_get_nameunit(udev->bus->bdev)); #endif @@ -2148,8 +2148,9 @@ usb_free_device(struct usb_device *udev, #if USB_HAVE_UGEN if (!rebooting) { - printf("%s: <%s> at %s (disconnected)\n", udev->ugen_name, - usb_get_manufacturer(udev), device_get_nameunit(bus->bdev)); + printf("%s: <%s %s> at %s (disconnected)\n", udev->ugen_name, + usb_get_manufacturer(udev), usb_get_product(udev), + device_get_nameunit(bus->bdev)); } /* Destroy UGEN symlink, if any */ From owner-svn-src-all@freebsd.org Mon Dec 19 18:31:24 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 288C9C88212; Mon, 19 Dec 2016 18:31:24 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id DE8A519F0; Mon, 19 Dec 2016 18:31:23 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBJIVNBJ008522; Mon, 19 Dec 2016 18:31:23 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBJIVN9b008521; Mon, 19 Dec 2016 18:31:23 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <201612191831.uBJIVN9b008521@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Mon, 19 Dec 2016 18:31:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r310282 - stable/9/lib/libusb X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Dec 2016 18:31:24 -0000 Author: trasz Date: Mon Dec 19 18:31:22 2016 New Revision: 310282 URL: https://svnweb.freebsd.org/changeset/base/310282 Log: MFC r307774: Fix libusb20_dev_get_desc(3) to use the "vendor product" order, not "product vendor". This is consistent with how it's generally done. The ordering is visible eg in usbconfig(8) output. Modified: stable/9/lib/libusb/libusb20_ugen20.c Directory Properties: stable/9/lib/libusb/ (props changed) Modified: stable/9/lib/libusb/libusb20_ugen20.c ============================================================================== --- stable/9/lib/libusb/libusb20_ugen20.c Mon Dec 19 18:27:22 2016 (r310281) +++ stable/9/lib/libusb/libusb20_ugen20.c Mon Dec 19 18:31:22 2016 (r310282) @@ -206,8 +206,8 @@ ugen20_enumerate(struct libusb20_device snprintf(pdev->usb_desc, sizeof(pdev->usb_desc), USB_GENERIC_NAME "%u.%u: <%s %s> at usbus%u", pdev->bus_number, - pdev->device_address, devinfo.udi_product, - devinfo.udi_vendor, pdev->bus_number); + pdev->device_address, devinfo.udi_vendor, + devinfo.udi_product, pdev->bus_number); error = 0; done: From owner-svn-src-all@freebsd.org Mon Dec 19 18:32:27 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D9BE8C8827D; Mon, 19 Dec 2016 18:32:27 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A1E571D2A; Mon, 19 Dec 2016 18:32:27 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBJIWQ6L011535; Mon, 19 Dec 2016 18:32:26 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBJIWQIR011534; Mon, 19 Dec 2016 18:32:26 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <201612191832.uBJIWQIR011534@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Mon, 19 Dec 2016 18:32:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r310283 - stable/9/sys/dev/usb X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Dec 2016 18:32:28 -0000 Author: trasz Date: Mon Dec 19 18:32:26 2016 New Revision: 310283 URL: https://svnweb.freebsd.org/changeset/base/310283 Log: MFC r307902: Make the USB attach strings in dmesg include product name. Modified: stable/9/sys/dev/usb/usb_device.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/dev/usb/usb_device.c ============================================================================== --- stable/9/sys/dev/usb/usb_device.c Mon Dec 19 18:31:22 2016 (r310282) +++ stable/9/sys/dev/usb/usb_device.c Mon Dec 19 18:32:26 2016 (r310283) @@ -1904,8 +1904,8 @@ config_done: udev->ugen_symlink = usb_alloc_symlink(udev->ugen_name); /* Announce device */ - printf("%s: <%s> at %s\n", udev->ugen_name, - usb_get_manufacturer(udev), + printf("%s: <%s %s> at %s\n", udev->ugen_name, + usb_get_manufacturer(udev), usb_get_product(udev), device_get_nameunit(udev->bus->bdev)); #endif @@ -2111,8 +2111,9 @@ usb_free_device(struct usb_device *udev, #if USB_HAVE_UGEN if (!rebooting) { - printf("%s: <%s> at %s (disconnected)\n", udev->ugen_name, - usb_get_manufacturer(udev), device_get_nameunit(bus->bdev)); + printf("%s: <%s %s> at %s (disconnected)\n", udev->ugen_name, + usb_get_manufacturer(udev), usb_get_product(udev), + device_get_nameunit(bus->bdev)); } /* Destroy UGEN symlink, if any */ From owner-svn-src-all@freebsd.org Mon Dec 19 18:55:11 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 80256C88968; Mon, 19 Dec 2016 18:55:11 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4FC4919B1; Mon, 19 Dec 2016 18:55:11 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBJItArR019724; Mon, 19 Dec 2016 18:55:10 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBJItANu019723; Mon, 19 Dec 2016 18:55:10 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201612191855.uBJItANu019723@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Mon, 19 Dec 2016 18:55:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310284 - head/sys/cam/scsi X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Dec 2016 18:55:11 -0000 Author: mav Date: Mon Dec 19 18:55:10 2016 New Revision: 310284 URL: https://svnweb.freebsd.org/changeset/base/310284 Log: When writing fixed format sense data, set VALID bit only if provided value for INFORMATION field fit into available 4 bytes (has no non-zero bytes except last 4), as explicitly required by SPC-5 specification. MFC after: 2 weeks Modified: head/sys/cam/scsi/scsi_all.c Modified: head/sys/cam/scsi/scsi_all.c ============================================================================== --- head/sys/cam/scsi/scsi_all.c Mon Dec 19 18:32:26 2016 (r310283) +++ head/sys/cam/scsi/scsi_all.c Mon Dec 19 18:55:10 2016 (r310284) @@ -4020,11 +4020,17 @@ scsi_set_sense_data_va(struct scsi_sense data_dest = &sense->info[0]; len_to_copy = MIN(sense_len, sizeof(sense->info)); - /* - * We're setting the info field, so - * set the valid bit. - */ - sense->error_code |= SSD_ERRCODE_VALID; + + /* Set VALID bit only if no overflow. */ + for (i = 0; i < sense_len - len_to_copy; + i++) { + if (data[i] != 0) + break; + } + if (i >= sense_len - len_to_copy) { + sense->error_code |= + SSD_ERRCODE_VALID; + } } /* From owner-svn-src-all@freebsd.org Mon Dec 19 18:58:44 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 15D8EC88A7C for ; Mon, 19 Dec 2016 18:58:44 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-io0-x244.google.com (mail-io0-x244.google.com [IPv6:2607:f8b0:4001:c06::244]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id D4FEC1CE4 for ; Mon, 19 Dec 2016 18:58:43 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-io0-x244.google.com with SMTP id f73so20010620ioe.2 for ; Mon, 19 Dec 2016 10:58:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20150623.gappssmtp.com; s=20150623; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=P/ci+APtB4GbDjWcAW4TODiPAZc9Dl/8ICnDOqU4ZTA=; b=H5y6y9iNktDIpYTs+YL08tBbL2xAxRtdDehBcO4OupdZmqONSu0zjoONzmn0n13Svh 8OEKbV7JXt+n7+RpnKUb87meppIZUdK6g9mJjr2grlo8FNImdW17gvgRIW05GUUuAGOz s4f8OWvjVqj4A+W2DnbF3A+MRKWpEXu3NWqoSQxZ9h2mBPaGGUMWbfXUywSRgmKXgbXO lYtjBCJxVgdO+MLMe5Ehacm11Df3T5IRpsYLmUMQZkcT5FVzeDiX0js/IDtyZA2SkwcD buIlvJIWxLx3gqAT7byfxmRaD5l9hujQZvwHud0q4i3daAeVD0XGizqQD66Dyv6VQv38 5fzA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=P/ci+APtB4GbDjWcAW4TODiPAZc9Dl/8ICnDOqU4ZTA=; b=drSaHQGWCo4uFUNlHW6unoRYmdsaEP3Dw+u/SZBeYhi3xJQD1CBeBvXEm+LUdslY3l dbzS7ekZxyHiohq+jyWVgqu6Vj6S01Bx5X762cDpA62KCkxjOnKz0eybThdK4vs7s0/6 bjwc8POUi8SqhvjY3uuiM9wrF6NS2vJq0gLR7ay9pklk8LsDxGxQX84GOxoowPwta/Ys CnY8p9PeBg0YgiZxtDjm/kh60K3BSH/zimS+ljPvhkZKsYjdWb8FFRjxviy4Tfl7y+/m U9zUu0obvoXVsouW67/wgMWKdkPFjvDRO/mjU89+wSFvAFzTnQK//bPePCX8nt0AR3D7 oFNg== X-Gm-Message-State: AIkVDXLUY3d5GCa2RsiPU7fulTtXL+xC/Hkzx1Wk48bA1mfd6yCq9KpoCP1g8X03wer4t4S6kPbeLZeEB67VTg== X-Received: by 10.107.132.74 with SMTP id g71mr16685192iod.19.1482173923157; Mon, 19 Dec 2016 10:58:43 -0800 (PST) MIME-Version: 1.0 Sender: wlosh@bsdimp.com Received: by 10.79.22.135 with HTTP; Mon, 19 Dec 2016 10:58:42 -0800 (PST) X-Originating-IP: [69.53.245.200] In-Reply-To: <9BD5034F-55A6-48F6-A391-A0877FF49702@panasas.com> References: <201612161949.uBGJnMol059217@repo.freebsd.org> <9BD5034F-55A6-48F6-A391-A0877FF49702@panasas.com> From: Warner Losh Date: Mon, 19 Dec 2016 11:58:42 -0700 X-Google-Sender-Auth: fpAmNcP9Tg6kZ06GkJhovOIRnoc Message-ID: Subject: Re: svn commit: r310171 - head/sys/sys To: Ravi Pokala Cc: Sepherosa Ziehau , Dimitry Andric , src-committers , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" Content-Type: text/plain; charset=UTF-8 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Dec 2016 18:58:44 -0000 On Mon, Dec 19, 2016 at 1:39 AM, Ravi Pokala wrote: > -----Original Message----- >> From: on behalf of Sepherosa Ziehau >> Date: 2016-12-18, Sunday at 23:02 >> To: Dimitry Andric >> Cc: , , >> Subject: Re: svn commit: r310171 - head/sys/sys >> >> The following patch unbreaks the LINT builds on amd64 for me after this commit: >> https://people.freebsd.org/~sephe/geom_sscanf.diff > > Wouldn't it be better to use the SCN macros? Are there other precedence for avoiding the SCN macros in the tree as well, or is this new art? Warner >> Thanks, >> sephe >> >> >> On Sat, Dec 17, 2016 at 3:49 AM, Dimitry Andric wrote: >>> Author: dim >>> Date: Fri Dec 16 19:49:22 2016 >>> New Revision: 310171 >>> URL: https://svnweb.freebsd.org/changeset/base/310171 >>> >>> Log: >>> Add __scanflike attributes to the kernel's sscanf() and vsscanf() >>> declarations. This should help to catch future mismatches between >>> format strings and arguments. >>> >>> MFC after: 1 week >>> >>> Modified: >>> head/sys/sys/systm.h >>> >>> Modified: head/sys/sys/systm.h >>> ============================================================================== >>> --- head/sys/sys/systm.h Fri Dec 16 19:09:57 2016 (r310170) >>> +++ head/sys/sys/systm.h Fri Dec 16 19:49:22 2016 (r310171) >>> @@ -227,8 +227,8 @@ int vsnprintf(char *, size_t, const char >>> int vsnrprintf(char *, size_t, int, const char *, __va_list) __printflike(4, 0); >>> int vsprintf(char *buf, const char *, __va_list) __printflike(2, 0); >>> int ttyprintf(struct tty *, const char *, ...) __printflike(2, 3); >>> -int sscanf(const char *, char const *, ...) __nonnull(1) __nonnull(2); >>> -int vsscanf(const char *, char const *, __va_list) __nonnull(1) __nonnull(2); >>> +int sscanf(const char *, char const *, ...) __nonnull(1) __nonnull(2) __scanflike(2, 3); >>> +int vsscanf(const char *, char const *, __va_list) __nonnull(1) __nonnull(2) __scanflike(2, 0); >>> long strtol(const char *, char **, int) __nonnull(1); >>> u_long strtoul(const char *, char **, int) __nonnull(1); >>> quad_t strtoq(const char *, char **, int) __nonnull(1); >>> _______________________________________________ >>> svn-src-all@freebsd.org mailing list >>> https://lists.freebsd.org/mailman/listinfo/svn-src-all >>> To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org" >> >> -- >> Tomorrow Will Never Die > > > > From owner-svn-src-all@freebsd.org Mon Dec 19 19:00:05 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0F87CC88BA6; Mon, 19 Dec 2016 19:00:05 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id DE5861F9E; Mon, 19 Dec 2016 19:00:04 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBJJ04LS020206; Mon, 19 Dec 2016 19:00:04 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBJJ037h020202; Mon, 19 Dec 2016 19:00:03 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201612191900.uBJJ037h020202@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Mon, 19 Dec 2016 19:00:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310285 - head/sys/cam/ctl X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Dec 2016 19:00:05 -0000 Author: mav Date: Mon Dec 19 19:00:03 2016 New Revision: 310285 URL: https://svnweb.freebsd.org/changeset/base/310285 Log: When reporting "Logical block address out of range" error, report the LBA in sense data INFORMATION field. MFC after: 2 weeks Modified: head/sys/cam/ctl/ctl.c head/sys/cam/ctl/ctl_error.c head/sys/cam/ctl/ctl_error.h head/sys/cam/ctl/ctl_tpc.c Modified: head/sys/cam/ctl/ctl.c ============================================================================== --- head/sys/cam/ctl/ctl.c Mon Dec 19 18:55:10 2016 (r310284) +++ head/sys/cam/ctl/ctl.c Mon Dec 19 19:00:03 2016 (r310285) @@ -5362,7 +5362,8 @@ ctl_sync_cache(struct ctl_scsiio *ctsio) * to see an error for an out of range LBA. */ if ((starting_lba + block_count) > (lun->be_lun->maxlba + 1)) { - ctl_set_lba_out_of_range(ctsio); + ctl_set_lba_out_of_range(ctsio, + MAX(starting_lba, lun->be_lun->maxlba + 1)); ctl_done((union ctl_io *)ctsio); goto bailout; } @@ -5678,7 +5679,8 @@ ctl_write_same(struct ctl_scsiio *ctsio) */ if (((lba + num_blocks) > (lun->be_lun->maxlba + 1)) || ((lba + num_blocks) < lba)) { - ctl_set_lba_out_of_range(ctsio); + ctl_set_lba_out_of_range(ctsio, + MAX(lba, lun->be_lun->maxlba + 1)); ctl_done((union ctl_io *)ctsio); return (CTL_RETVAL_COMPLETE); } @@ -5791,7 +5793,8 @@ ctl_unmap(struct ctl_scsiio *ctsio) num_blocks = scsi_4btoul(range->length); if (((lba + num_blocks) > (lun->be_lun->maxlba + 1)) || ((lba + num_blocks) < lba)) { - ctl_set_lba_out_of_range(ctsio); + ctl_set_lba_out_of_range(ctsio, + MAX(lba, lun->be_lun->maxlba + 1)); ctl_done((union ctl_io *)ctsio); return (CTL_RETVAL_COMPLETE); } @@ -6995,7 +6998,7 @@ ctl_get_lba_status(struct ctl_scsiio *ct alloc_len = scsi_4btoul(cdb->alloc_len); if (lba > lun->be_lun->maxlba) { - ctl_set_lba_out_of_range(ctsio); + ctl_set_lba_out_of_range(ctsio, lba); ctl_done((union ctl_io *)ctsio); return (CTL_RETVAL_COMPLETE); } @@ -8785,7 +8788,8 @@ ctl_read_write(struct ctl_scsiio *ctsio) */ if (((lba + num_blocks) > (lun->be_lun->maxlba + 1)) || ((lba + num_blocks) < lba)) { - ctl_set_lba_out_of_range(ctsio); + ctl_set_lba_out_of_range(ctsio, + MAX(lba, lun->be_lun->maxlba + 1)); ctl_done((union ctl_io *)ctsio); return (CTL_RETVAL_COMPLETE); } @@ -8894,7 +8898,8 @@ ctl_cnw(struct ctl_scsiio *ctsio) */ if (((lba + num_blocks) > (lun->be_lun->maxlba + 1)) || ((lba + num_blocks) < lba)) { - ctl_set_lba_out_of_range(ctsio); + ctl_set_lba_out_of_range(ctsio, + MAX(lba, lun->be_lun->maxlba + 1)); ctl_done((union ctl_io *)ctsio); return (CTL_RETVAL_COMPLETE); } @@ -9005,7 +9010,8 @@ ctl_verify(struct ctl_scsiio *ctsio) */ if (((lba + num_blocks) > (lun->be_lun->maxlba + 1)) || ((lba + num_blocks) < lba)) { - ctl_set_lba_out_of_range(ctsio); + ctl_set_lba_out_of_range(ctsio, + MAX(lba, lun->be_lun->maxlba + 1)); ctl_done((union ctl_io *)ctsio); return (CTL_RETVAL_COMPLETE); } Modified: head/sys/cam/ctl/ctl_error.c ============================================================================== --- head/sys/cam/ctl/ctl_error.c Mon Dec 19 18:55:10 2016 (r310284) +++ head/sys/cam/ctl/ctl_error.c Mon Dec 19 19:00:03 2016 (r310285) @@ -181,8 +181,8 @@ ctl_sense_to_desc(struct scsi_sense_data /*asc*/ sense_src->add_sense_code, /*ascq*/ sense_src->add_sense_code_qual, - /* Information Bytes */ - (scsi_4btoul(sense_src->info) != 0) ? + /* Information Bytes */ + (sense_src->error_code & SSD_ERRCODE_VALID) ? SSD_ELEM_INFO : SSD_ELEM_SKIP, sizeof(sense_src->info), sense_src->info, @@ -727,14 +727,20 @@ ctl_set_aborted(struct ctl_scsiio *ctsio } void -ctl_set_lba_out_of_range(struct ctl_scsiio *ctsio) +ctl_set_lba_out_of_range(struct ctl_scsiio *ctsio, uint64_t lba) { + uint8_t info[8]; + + scsi_u64to8b(lba, info); + /* "Logical block address out of range" */ ctl_set_sense(ctsio, /*current_error*/ 1, /*sense_key*/ SSD_KEY_ILLEGAL_REQUEST, /*asc*/ 0x21, /*ascq*/ 0x00, + /*type*/ (lba != 0) ? SSD_ELEM_INFO : SSD_ELEM_SKIP, + /*size*/ sizeof(info), /*data*/ &info, SSD_ELEM_NONE); } Modified: head/sys/cam/ctl/ctl_error.h ============================================================================== --- head/sys/cam/ctl/ctl_error.h Mon Dec 19 18:55:10 2016 (r310284) +++ head/sys/cam/ctl/ctl_error.h Mon Dec 19 19:00:03 2016 (r310285) @@ -76,7 +76,7 @@ void ctl_set_internal_failure(struct ctl uint16_t retry_count); void ctl_set_medium_error(struct ctl_scsiio *ctsio, int read); void ctl_set_aborted(struct ctl_scsiio *ctsio); -void ctl_set_lba_out_of_range(struct ctl_scsiio *ctsio); +void ctl_set_lba_out_of_range(struct ctl_scsiio *ctsio, uint64_t lba); void ctl_set_lun_stopped(struct ctl_scsiio *ctsio); void ctl_set_lun_int_reqd(struct ctl_scsiio *ctsio); void ctl_set_lun_ejected(struct ctl_scsiio *ctsio); Modified: head/sys/cam/ctl/ctl_tpc.c ============================================================================== --- head/sys/cam/ctl/ctl_tpc.c Mon Dec 19 18:55:10 2016 (r310284) +++ head/sys/cam/ctl/ctl_tpc.c Mon Dec 19 19:00:03 2016 (r310285) @@ -1104,7 +1104,8 @@ tpc_ranges_length(struct scsi_range_desc } static int -tpc_check_ranges_l(struct scsi_range_desc *range, int nrange, uint64_t maxlba) +tpc_check_ranges_l(struct scsi_range_desc *range, int nrange, uint64_t maxlba, + uint64_t *lba) { uint64_t b1; uint32_t l1; @@ -1113,8 +1114,10 @@ tpc_check_ranges_l(struct scsi_range_des for (i = 0; i < nrange; i++) { b1 = scsi_8btou64(range[i].lba); l1 = scsi_4btoul(range[i].length); - if (b1 + l1 < b1 || b1 + l1 > maxlba + 1) + if (b1 + l1 < b1 || b1 + l1 > maxlba + 1) { + *lba = MAX(b1, maxlba + 1); return (-1); + } } return (0); } @@ -1952,6 +1955,7 @@ ctl_populate_token(struct ctl_scsiio *ct struct ctl_port *port; struct tpc_list *list, *tlist; struct tpc_token *token; + uint64_t lba; int len, lendata, lendesc; CTL_DEBUG_PRINT(("ctl_populate_token\n")); @@ -2032,8 +2036,8 @@ ctl_populate_token(struct ctl_scsiio *ct if (tpc_check_ranges_l(&data->desc[0], scsi_2btoul(data->range_descriptor_length) / sizeof(struct scsi_range_desc), - lun->be_lun->maxlba) != 0) { - ctl_set_lba_out_of_range(ctsio); + lun->be_lun->maxlba, &lba) != 0) { + ctl_set_lba_out_of_range(ctsio, lba); goto done; } if (tpc_check_ranges_x(&data->desc[0], @@ -2118,6 +2122,7 @@ ctl_write_using_token(struct ctl_scsiio struct ctl_lun *lun; struct tpc_list *list, *tlist; struct tpc_token *token; + uint64_t lba; int len, lendata, lendesc; CTL_DEBUG_PRINT(("ctl_write_using_token\n")); @@ -2180,8 +2185,8 @@ ctl_write_using_token(struct ctl_scsiio if (tpc_check_ranges_l(&data->desc[0], scsi_2btoul(data->range_descriptor_length) / sizeof(struct scsi_range_desc), - lun->be_lun->maxlba) != 0) { - ctl_set_lba_out_of_range(ctsio); + lun->be_lun->maxlba, &lba) != 0) { + ctl_set_lba_out_of_range(ctsio, lba); goto done; } if (tpc_check_ranges_x(&data->desc[0], From owner-svn-src-all@freebsd.org Mon Dec 19 19:02:54 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3307EC88D8E; Mon, 19 Dec 2016 19:02:54 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from tensor.andric.com (tensor.andric.com [IPv6:2001:7b8:3a7:1:2d0:b7ff:fea0:8c26]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "tensor.andric.com", Issuer "COMODO RSA Domain Validation Secure Server CA" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id ECC581567; Mon, 19 Dec 2016 19:02:53 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from [IPv6:2001:7b8:3a7::edad:7930:572d:abe] (unknown [IPv6:2001:7b8:3a7:0:edad:7930:572d:abe]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by tensor.andric.com (Postfix) with ESMTPSA id B8E5441D4E; Mon, 19 Dec 2016 20:02:50 +0100 (CET) Content-Type: multipart/signed; boundary="Apple-Mail=_D7AC963E-59B0-4A18-8480-32507CCD267D"; protocol="application/pgp-signature"; micalg=pgp-sha1 Mime-Version: 1.0 (Mac OS X Mail 9.3 \(3124\)) Subject: Re: svn commit: r310171 - head/sys/sys From: Dimitry Andric In-Reply-To: Date: Mon, 19 Dec 2016 20:02:42 +0100 Cc: Ravi Pokala , Sepherosa Ziehau , src-committers , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" Message-Id: <0C6B935C-496B-4EF4-963F-95286CBA45BA@FreeBSD.org> References: <201612161949.uBGJnMol059217@repo.freebsd.org> <9BD5034F-55A6-48F6-A391-A0877FF49702@panasas.com> To: Warner Losh X-Mailer: Apple Mail (2.3124) X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Dec 2016 19:02:54 -0000 --Apple-Mail=_D7AC963E-59B0-4A18-8480-32507CCD267D Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=us-ascii On 19 Dec 2016, at 19:58, Warner Losh wrote: >=20 > On Mon, Dec 19, 2016 at 1:39 AM, Ravi Pokala wrote: >> -----Original Message----- >>> From: on behalf of Sepherosa = Ziehau >>> Date: 2016-12-18, Sunday at 23:02 >>> To: Dimitry Andric >>> Cc: , , = >>> Subject: Re: svn commit: r310171 - head/sys/sys >>>=20 >>> The following patch unbreaks the LINT builds on amd64 for me after = this commit: >>> https://people.freebsd.org/~sephe/geom_sscanf.diff >>=20 >> Wouldn't it be better to use the SCN macros? >=20 > Are there other precedence for avoiding the SCN macros in the tree as > well, or is this new art? I personally don't have anything against using the PRI or SCN macros, but traditionally there has been some backlash against it, if I recall correctly. It also requires including either or , depending on circumstance or preference. -Dimitry --Apple-Mail=_D7AC963E-59B0-4A18-8480-32507CCD267D Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=signature.asc Content-Type: application/pgp-signature; name=signature.asc Content-Description: Message signed with OpenPGP using GPGMail -----BEGIN PGP SIGNATURE----- Version: GnuPG/MacGPG2 v2.0.30 iEYEARECAAYFAlhYLtoACgkQsF6jCi4glqMQSQCgh5lW/6sUOUx9BCZdXXCtkqaI hLQAnRonSXarpfNVM5K65bvhxOQji+2j =yv1T -----END PGP SIGNATURE----- --Apple-Mail=_D7AC963E-59B0-4A18-8480-32507CCD267D-- From owner-svn-src-all@freebsd.org Mon Dec 19 19:20:18 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E6A52C88668 for ; Mon, 19 Dec 2016 19:20:18 +0000 (UTC) (envelope-from ian@freebsd.org) Received: from pmta2.delivery6.ore.mailhop.org (pmta2.delivery6.ore.mailhop.org [54.200.129.228]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C8AE51045 for ; Mon, 19 Dec 2016 19:20:18 +0000 (UTC) (envelope-from ian@freebsd.org) X-MHO-User: 28e3e9aa-c620-11e6-acc0-c7e6c9ad01d6 X-Report-Abuse-To: https://support.duocircle.com/support/solutions/articles/5000540958-duocircle-standard-smtp-abuse-information X-Originating-IP: 73.78.92.27 X-Mail-Handler: DuoCircle Outbound SMTP Received: from ilsoft.org (unknown [73.78.92.27]) by outbound2.ore.mailhop.org (Halon) with ESMTPSA id 28e3e9aa-c620-11e6-acc0-c7e6c9ad01d6; Mon, 19 Dec 2016 19:20:11 +0000 (UTC) Received: from rev (rev [172.22.42.240]) by ilsoft.org (8.15.2/8.15.2) with ESMTP id uBJJK9Fb001639; Mon, 19 Dec 2016 12:20:09 -0700 (MST) (envelope-from ian@freebsd.org) Message-ID: <1482175209.48539.9.camel@freebsd.org> Subject: Re: svn commit: r310171 - head/sys/sys From: Ian Lepore To: Warner Losh , Ravi Pokala Cc: Sepherosa Ziehau , Dimitry Andric , src-committers , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" Date: Mon, 19 Dec 2016 12:20:09 -0700 In-Reply-To: References: <201612161949.uBGJnMol059217@repo.freebsd.org> <9BD5034F-55A6-48F6-A391-A0877FF49702@panasas.com> Content-Type: text/plain; charset="ISO-8859-1" X-Mailer: Evolution 3.18.5.1 FreeBSD GNOME Team Port Mime-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Dec 2016 19:20:19 -0000 On Mon, 2016-12-19 at 11:58 -0700, Warner Losh wrote: > On Mon, Dec 19, 2016 at 1:39 AM, Ravi Pokala wrote: > > > > -----Original Message----- > > > > > > From: on behalf of Sepherosa > > > Ziehau > > > Date: 2016-12-18, Sunday at 23:02 > > > To: Dimitry Andric > > > Cc: , , > > -src-head@freebsd.org> > > > Subject: Re: svn commit: r310171 - head/sys/sys > > > > > > The following patch unbreaks the LINT builds on amd64 for me > > > after this commit: > > > https://people.freebsd.org/~sephe/geom_sscanf.diff > > Wouldn't it be better to use the SCN macros? > Are there other precedence for avoiding the SCN macros in the tree as > well, or is this new art? > > Warner There was another commit recently the fixed the same kind of scanf error by making the variable fit the scanf type (changing uint64_t to an explicit long long unsigned, iirc).  I don't know if that alone counts as a precedent, but IMO it's a more palatible fix than the SCN/PRI ugliness. -- Ian From owner-svn-src-all@freebsd.org Mon Dec 19 19:21:29 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 59F34C88789; Mon, 19 Dec 2016 19:21:29 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 297421303; Mon, 19 Dec 2016 19:21:29 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBJJLSUf028991; Mon, 19 Dec 2016 19:21:28 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBJJLSEc028990; Mon, 19 Dec 2016 19:21:28 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201612191921.uBJJLSEc028990@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Mon, 19 Dec 2016 19:21:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310286 - head/sys/netinet6 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Dec 2016 19:21:29 -0000 Author: markj Date: Mon Dec 19 19:21:28 2016 New Revision: 310286 URL: https://svnweb.freebsd.org/changeset/base/310286 Log: Remove a bogus KASSERT from nd6_prefix_unlink(). The caller may unlink a prefix before purging referencing addresses. An identical assertion in nd6_prefix_del() verifies that the addresses are purged before the prefix is freed. PR: 215372 X-MFC With: r306829 Modified: head/sys/netinet6/nd6_rtr.c Modified: head/sys/netinet6/nd6_rtr.c ============================================================================== --- head/sys/netinet6/nd6_rtr.c Mon Dec 19 19:00:03 2016 (r310285) +++ head/sys/netinet6/nd6_rtr.c Mon Dec 19 19:21:28 2016 (r310286) @@ -1122,8 +1122,6 @@ void nd6_prefix_unlink(struct nd_prefix *pr, struct nd_prhead *list) { - KASSERT(pr->ndpr_addrcnt == 0, - ("prefix %p has referencing addresses", pr)); ND6_WLOCK_ASSERT(); LIST_REMOVE(pr, ndpr_entry); From owner-svn-src-all@freebsd.org Mon Dec 19 19:37:56 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4AA9EC87415; Mon, 19 Dec 2016 19:37:56 +0000 (UTC) (envelope-from lifanov@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 19BB01503; Mon, 19 Dec 2016 19:37:56 +0000 (UTC) (envelope-from lifanov@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBJJbt76036100; Mon, 19 Dec 2016 19:37:55 GMT (envelope-from lifanov@FreeBSD.org) Received: (from lifanov@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBJJbtMt036099; Mon, 19 Dec 2016 19:37:55 GMT (envelope-from lifanov@FreeBSD.org) Message-Id: <201612191937.uBJJbtMt036099@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: lifanov set sender to lifanov@FreeBSD.org using -f From: Nikolai Lifanov Date: Mon, 19 Dec 2016 19:37:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r310287 - stable/11 X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Dec 2016 19:37:56 -0000 Author: lifanov (ports committer) Date: Mon Dec 19 19:37:55 2016 New Revision: 310287 URL: https://svnweb.freebsd.org/changeset/base/310287 Log: MFC r310160 retain cc.4.gz man page for Chelsio T6 NICs This man page was removed in r225583 when cc.4 was renamed to mod_cc.4 With reintroduction of cc.4 "make installworld; make delete-old" was no longer convergent. Reviewed by: matthew Approved by: jhb (implicit), matthew (mentor) Differential Revision: https://reviews.freebsd.org/D8828 Modified: stable/11/ObsoleteFiles.inc Directory Properties: stable/11/ (props changed) Modified: stable/11/ObsoleteFiles.inc ============================================================================== --- stable/11/ObsoleteFiles.inc Mon Dec 19 19:21:28 2016 (r310286) +++ stable/11/ObsoleteFiles.inc Mon Dec 19 19:37:55 2016 (r310287) @@ -2777,7 +2777,6 @@ OLD_FILES+=usr/lib32/libftpio_p.a OLD_FILES+=usr/include/ftpio.h OLD_FILES+=usr/share/man/man3/ftpio.3.gz # 20110915: rename congestion control manpages -OLD_FILES+=usr/share/man/man4/cc.4.gz OLD_FILES+=usr/share/man/man9/cc.9.gz # 20110831: atomic page flags operations OLD_FILES+=usr/share/man/man9/vm_page_flag.9.gz From owner-svn-src-all@freebsd.org Mon Dec 19 19:39:03 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7D5D2C874A7; Mon, 19 Dec 2016 19:39:03 +0000 (UTC) (envelope-from lifanov@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4AA5D1693; Mon, 19 Dec 2016 19:39:03 +0000 (UTC) (envelope-from lifanov@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBJJd2D2036183; Mon, 19 Dec 2016 19:39:02 GMT (envelope-from lifanov@FreeBSD.org) Received: (from lifanov@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBJJd2Tt036182; Mon, 19 Dec 2016 19:39:02 GMT (envelope-from lifanov@FreeBSD.org) Message-Id: <201612191939.uBJJd2Tt036182@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: lifanov set sender to lifanov@FreeBSD.org using -f From: Nikolai Lifanov Date: Mon, 19 Dec 2016 19:39:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r310288 - stable/10 X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Dec 2016 19:39:03 -0000 Author: lifanov (ports committer) Date: Mon Dec 19 19:39:02 2016 New Revision: 310288 URL: https://svnweb.freebsd.org/changeset/base/310288 Log: MFC r310160 retain cc.4.gz man page for Chelsio T6 NICs This man page was removed in r225583 when cc.4 was renamed to mod_cc.4 With reintroduction of cc.4 "make installworld; make delete-old" was no longer convergent. Reviewed by: matthew Approved by: jhb (implicit), matthew (mentor) Differential Revision: https://reviews.freebsd.org/D8829 Modified: stable/10/ObsoleteFiles.inc Directory Properties: stable/10/ (props changed) Modified: stable/10/ObsoleteFiles.inc ============================================================================== --- stable/10/ObsoleteFiles.inc Mon Dec 19 19:37:55 2016 (r310287) +++ stable/10/ObsoleteFiles.inc Mon Dec 19 19:39:02 2016 (r310288) @@ -937,7 +937,6 @@ OLD_FILES+=usr/lib32/libftpio_p.a OLD_FILES+=usr/include/ftpio.h OLD_FILES+=usr/share/man/man3/ftpio.3.gz # 20110915: rename congestion control manpages -OLD_FILES+=usr/share/man/man4/cc.4.gz OLD_FILES+=usr/share/man/man9/cc.9.gz # 20110831: atomic page flags operations OLD_FILES+=usr/share/man/man9/vm_page_flag.9.gz From owner-svn-src-all@freebsd.org Mon Dec 19 19:40:13 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 509AAC8767C; Mon, 19 Dec 2016 19:40:13 +0000 (UTC) (envelope-from jchandra@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 05D6C1A7B; Mon, 19 Dec 2016 19:40:12 +0000 (UTC) (envelope-from jchandra@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBJJeCaY036286; Mon, 19 Dec 2016 19:40:12 GMT (envelope-from jchandra@FreeBSD.org) Received: (from jchandra@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBJJeCSB036285; Mon, 19 Dec 2016 19:40:12 GMT (envelope-from jchandra@FreeBSD.org) Message-Id: <201612191940.uBJJeCSB036285@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jchandra set sender to jchandra@FreeBSD.org using -f From: "Jayachandran C." Date: Mon, 19 Dec 2016 19:40:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310289 - head/sys/dev/uart X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Dec 2016 19:40:13 -0000 Author: jchandra Date: Mon Dec 19 19:40:11 2016 New Revision: 310289 URL: https://svnweb.freebsd.org/changeset/base/310289 Log: Fix whitespace issues in pl011 uart driver Fix up trailing whitespace introduced by r310190. While there, fix a couple of earlier whitespace errors as well. Modified: head/sys/dev/uart/uart_dev_pl011.c Modified: head/sys/dev/uart/uart_dev_pl011.c ============================================================================== --- head/sys/dev/uart/uart_dev_pl011.c Mon Dec 19 19:39:02 2016 (r310288) +++ head/sys/dev/uart/uart_dev_pl011.c Mon Dec 19 19:40:11 2016 (r310289) @@ -173,7 +173,7 @@ uart_pl011_param(struct uart_bas *bas, i line &= ~LCR_H_PEN; /* Configure the rest */ - line &= ~LCR_H_FEN; + line &= ~LCR_H_FEN; ctrl |= (CR_RXE | CR_TXE | CR_UARTEN); if (bas->rclk != 0 && baudrate != 0) { @@ -196,7 +196,7 @@ uart_pl011_init(struct uart_bas *bas, in /* Mask all interrupts */ __uart_setreg(bas, UART_IMSC, __uart_getreg(bas, UART_IMSC) & ~IMSC_MASK_ALL); - + uart_pl011_param(bas, baudrate, databits, stopbits, parity); } @@ -307,7 +307,7 @@ uart_pl011_bus_attach(struct uart_softc struct uart_pl011_softc *psc; struct uart_bas *bas; - psc = (struct uart_pl011_softc *)sc; + psc = (struct uart_pl011_softc *)sc; bas = &sc->sc_bas; /* Enable interrupts */ @@ -373,7 +373,7 @@ uart_pl011_bus_ipend(struct uart_softc * uint32_t ints; int ipend; - psc = (struct uart_pl011_softc *)sc; + psc = (struct uart_pl011_softc *)sc; bas = &sc->sc_bas; uart_lock(sc->sc_hwmtx); @@ -472,7 +472,7 @@ uart_pl011_bus_transmit(struct uart_soft struct uart_bas *bas; int i; - psc = (struct uart_pl011_softc *)sc; + psc = (struct uart_pl011_softc *)sc; bas = &sc->sc_bas; uart_lock(sc->sc_hwmtx); @@ -504,7 +504,7 @@ uart_pl011_bus_grab(struct uart_softc *s struct uart_pl011_softc *psc; struct uart_bas *bas; - psc = (struct uart_pl011_softc *)sc; + psc = (struct uart_pl011_softc *)sc; bas = &sc->sc_bas; /* Disable interrupts on switch to polling */ @@ -519,7 +519,7 @@ uart_pl011_bus_ungrab(struct uart_softc struct uart_pl011_softc *psc; struct uart_bas *bas; - psc = (struct uart_pl011_softc *) sc; + psc = (struct uart_pl011_softc *)sc; bas = &sc->sc_bas; /* Switch to using interrupts while not grabbed */ From owner-svn-src-all@freebsd.org Mon Dec 19 20:08:01 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 03E99C87F02; Mon, 19 Dec 2016 20:08:01 +0000 (UTC) (envelope-from landonf@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 9502D1953; Mon, 19 Dec 2016 20:08:00 +0000 (UTC) (envelope-from landonf@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBJK7xAk048345; Mon, 19 Dec 2016 20:07:59 GMT (envelope-from landonf@FreeBSD.org) Received: (from landonf@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBJK7wDh048330; Mon, 19 Dec 2016 20:07:58 GMT (envelope-from landonf@FreeBSD.org) Message-Id: <201612192007.uBJK7wDh048330@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: landonf set sender to landonf@FreeBSD.org using -f From: "Landon J. Fuller" Date: Mon, 19 Dec 2016 20:07:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310290 - in head/sys: dev/bhnd/nvram mips/broadcom X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Dec 2016 20:08:01 -0000 Author: landonf Date: Mon Dec 19 20:07:58 2016 New Revision: 310290 URL: https://svnweb.freebsd.org/changeset/base/310290 Log: bhnd(4): minor style(9) fixes Approved by: adrian (mentor) Differential Revision: https://reviews.freebsd.org/D8755 Modified: head/sys/dev/bhnd/nvram/bhnd_nvram_data.c head/sys/dev/bhnd/nvram/bhnd_nvram_data.h head/sys/dev/bhnd/nvram/bhnd_nvram_data_sprom.c head/sys/dev/bhnd/nvram/bhnd_nvram_datavar.h head/sys/dev/bhnd/nvram/bhnd_nvram_private.h head/sys/dev/bhnd/nvram/bhnd_nvram_store.c head/sys/dev/bhnd/nvram/bhnd_nvram_store.h head/sys/dev/bhnd/nvram/bhnd_nvram_subr.c head/sys/dev/bhnd/nvram/bhnd_nvram_value.c head/sys/dev/bhnd/nvram/bhnd_nvram_value.h head/sys/dev/bhnd/nvram/bhnd_nvram_value_fmts.c head/sys/dev/bhnd/nvram/bhnd_nvram_value_prf.c head/sys/dev/bhnd/nvram/bhnd_nvram_valuevar.h head/sys/mips/broadcom/bcm_nvram_cfe.c Modified: head/sys/dev/bhnd/nvram/bhnd_nvram_data.c ============================================================================== --- head/sys/dev/bhnd/nvram/bhnd_nvram_data.c Mon Dec 19 19:40:11 2016 (r310289) +++ head/sys/dev/bhnd/nvram/bhnd_nvram_data.c Mon Dec 19 20:07:58 2016 (r310290) @@ -59,7 +59,7 @@ __FBSDID("$FreeBSD$"); * @param cls The NVRAM class. */ const char * -bhnd_nvram_data_class_desc(bhnd_nvram_data_class_t *cls) +bhnd_nvram_data_class_desc(bhnd_nvram_data_class *cls) { return (cls->desc); } @@ -80,7 +80,7 @@ bhnd_nvram_data_class_desc(bhnd_nvram_da * code should be returned. */ int -bhnd_nvram_data_probe(bhnd_nvram_data_class_t *cls, struct bhnd_nvram_io *io) +bhnd_nvram_data_probe(bhnd_nvram_data_class *cls, struct bhnd_nvram_io *io) { return (cls->op_probe(io)); } @@ -106,10 +106,10 @@ bhnd_nvram_data_probe(bhnd_nvram_data_cl */ int bhnd_nvram_data_probe_classes(struct bhnd_nvram_data **data, - struct bhnd_nvram_io *io, bhnd_nvram_data_class_t *classes[], + struct bhnd_nvram_io *io, bhnd_nvram_data_class *classes[], size_t num_classes) { - bhnd_nvram_data_class_t *cls; + bhnd_nvram_data_class *cls; int error, prio, result; cls = NULL; @@ -124,7 +124,7 @@ bhnd_nvram_data_probe_classes(struct bhn /* Try to find the best data class capable of parsing io */ for (size_t i = 0; i < num_classes; i++) { - bhnd_nvram_data_class_t *next_cls; + bhnd_nvram_data_class *next_cls; next_cls = classes[i]; @@ -196,8 +196,8 @@ bhnd_nvram_data_probe_classes(struct bhn * regular unix error code will be returned. */ int -bhnd_nvram_data_new(bhnd_nvram_data_class_t *cls, - struct bhnd_nvram_data **nv, struct bhnd_nvram_io *io) +bhnd_nvram_data_new(bhnd_nvram_data_class *cls, struct bhnd_nvram_data **nv, + struct bhnd_nvram_io *io) { struct bhnd_nvram_data *data; int error; @@ -263,8 +263,8 @@ bhnd_nvram_data_release(struct bhnd_nvra * * @param nv The NVRAM data instance to be queried. */ -bhnd_nvram_data_class_t * -bhnd_nvram_data_class(struct bhnd_nvram_data *nv) +bhnd_nvram_data_class * +bhnd_nvram_data_get_class(struct bhnd_nvram_data *nv) { return (nv->cls); } @@ -423,6 +423,7 @@ bhnd_nvram_data_getvar(struct bhnd_nvram return (nv->cls->op_getvar(nv, cookiep, buf, len, type)); } + /** * A generic implementation of bhnd_nvram_data_getvar(). * @@ -438,9 +439,9 @@ int bhnd_nvram_data_generic_rp_getvar(struct bhnd_nvram_data *nv, void *cookiep, void *outp, size_t *olen, bhnd_nvram_type otype) { - bhnd_nvram_val_t val; + bhnd_nvram_val val; const struct bhnd_nvram_vardefn *vdefn; - const bhnd_nvram_val_fmt_t *fmt; + const bhnd_nvram_val_fmt *fmt; const char *name; const void *vptr; bhnd_nvram_type vtype; Modified: head/sys/dev/bhnd/nvram/bhnd_nvram_data.h ============================================================================== --- head/sys/dev/bhnd/nvram/bhnd_nvram_data.h Mon Dec 19 19:40:11 2016 (r310289) +++ head/sys/dev/bhnd/nvram/bhnd_nvram_data.h Mon Dec 19 20:07:58 2016 (r310290) @@ -46,7 +46,7 @@ #include "bhnd_nvram_io.h" /* NVRAM data class */ -typedef struct bhnd_nvram_data_class bhnd_nvram_data_class_t; +typedef struct bhnd_nvram_data_class bhnd_nvram_data_class; /* NVRAM data instance */ struct bhnd_nvram_data; @@ -88,25 +88,24 @@ enum { parsing */ }; -const char *bhnd_nvram_data_class_desc( - bhnd_nvram_data_class_t *cls); +const char *bhnd_nvram_data_class_desc(bhnd_nvram_data_class *cls); -int bhnd_nvram_data_probe(bhnd_nvram_data_class_t *cls, +int bhnd_nvram_data_probe(bhnd_nvram_data_class *cls, struct bhnd_nvram_io *io); int bhnd_nvram_data_probe_classes( struct bhnd_nvram_data **data, struct bhnd_nvram_io *io, - bhnd_nvram_data_class_t *classes[], + bhnd_nvram_data_class *classes[], size_t num_classes); -int bhnd_nvram_data_new(bhnd_nvram_data_class_t *cls, +int bhnd_nvram_data_new(bhnd_nvram_data_class *cls, struct bhnd_nvram_data **nv, struct bhnd_nvram_io *io); struct bhnd_nvram_data *bhnd_nvram_data_retain(struct bhnd_nvram_data *nv); void bhnd_nvram_data_release(struct bhnd_nvram_data *nv); -bhnd_nvram_data_class_t *bhnd_nvram_data_class(struct bhnd_nvram_data *nv); +bhnd_nvram_data_class *bhnd_nvram_data_get_class(struct bhnd_nvram_data *nv); size_t bhnd_nvram_data_count(struct bhnd_nvram_data *nv); Modified: head/sys/dev/bhnd/nvram/bhnd_nvram_data_sprom.c ============================================================================== --- head/sys/dev/bhnd/nvram/bhnd_nvram_data_sprom.c Mon Dec 19 19:40:11 2016 (r310289) +++ head/sys/dev/bhnd/nvram/bhnd_nvram_data_sprom.c Mon Dec 19 20:07:58 2016 (r310290) @@ -670,7 +670,7 @@ static int bhnd_nvram_sprom_getvar(struct bhnd_nvram_data *nv, void *cookiep, void *buf, size_t *len, bhnd_nvram_type otype) { - bhnd_nvram_val_t val; + bhnd_nvram_val val; struct bhnd_nvram_sprom *sp; struct sprom_opcode_idx *idx; const struct bhnd_nvram_vardefn *var; Modified: head/sys/dev/bhnd/nvram/bhnd_nvram_datavar.h ============================================================================== --- head/sys/dev/bhnd/nvram/bhnd_nvram_datavar.h Mon Dec 19 19:40:11 2016 (r310289) +++ head/sys/dev/bhnd/nvram/bhnd_nvram_datavar.h Mon Dec 19 20:07:58 2016 (r310290) @@ -41,7 +41,7 @@ #include "bhnd_nvram_data.h" /** Registered NVRAM parser class instances. */ -SET_DECLARE(bhnd_nvram_data_class_set, bhnd_nvram_data_class_t); +SET_DECLARE(bhnd_nvram_data_class_set, bhnd_nvram_data_class); void *bhnd_nvram_data_generic_find(struct bhnd_nvram_data *nv, const char *name); Modified: head/sys/dev/bhnd/nvram/bhnd_nvram_private.h ============================================================================== --- head/sys/dev/bhnd/nvram/bhnd_nvram_private.h Mon Dec 19 19:40:11 2016 (r310289) +++ head/sys/dev/bhnd/nvram/bhnd_nvram_private.h Mon Dec 19 20:07:58 2016 (r310290) @@ -258,7 +258,7 @@ struct bhnd_nvram_vardefn { bhnd_nvram_type type; /**< variable type */ uint8_t nelem; /**< element count, or 1 if not an array-typed variable */ - const bhnd_nvram_val_fmt_t *fmt; /**< value format, or NULL */ + const bhnd_nvram_val_fmt *fmt; /**< value format, or NULL */ uint32_t flags; /**< flags (BHND_NVRAM_VF_*) */ }; Modified: head/sys/dev/bhnd/nvram/bhnd_nvram_store.c ============================================================================== --- head/sys/dev/bhnd/nvram/bhnd_nvram_store.c Mon Dec 19 19:40:11 2016 (r310289) +++ head/sys/dev/bhnd/nvram/bhnd_nvram_store.c Mon Dec 19 20:07:58 2016 (r310290) @@ -140,7 +140,7 @@ cleanup: */ int bhnd_nvram_store_parse_new(struct bhnd_nvram_store **store, - struct bhnd_nvram_io *io, bhnd_nvram_data_class_t *cls) + struct bhnd_nvram_io *io, bhnd_nvram_data_class *cls) { struct bhnd_nvram_data *data; int error; Modified: head/sys/dev/bhnd/nvram/bhnd_nvram_store.h ============================================================================== --- head/sys/dev/bhnd/nvram/bhnd_nvram_store.h Mon Dec 19 19:40:11 2016 (r310289) +++ head/sys/dev/bhnd/nvram/bhnd_nvram_store.h Mon Dec 19 20:07:58 2016 (r310290) @@ -56,7 +56,7 @@ int bhnd_nvram_store_new(struct bhnd_nvr struct bhnd_nvram_data *data); int bhnd_nvram_store_parse_new(struct bhnd_nvram_store **store, - struct bhnd_nvram_io *io, bhnd_nvram_data_class_t *cls); + struct bhnd_nvram_io *io, bhnd_nvram_data_class *cls); void bhnd_nvram_store_free(struct bhnd_nvram_store *store); Modified: head/sys/dev/bhnd/nvram/bhnd_nvram_subr.c ============================================================================== --- head/sys/dev/bhnd/nvram/bhnd_nvram_subr.c Mon Dec 19 19:40:11 2016 (r310289) +++ head/sys/dev/bhnd/nvram/bhnd_nvram_subr.c Mon Dec 19 20:07:58 2016 (r310290) @@ -698,8 +698,8 @@ int bhnd_nvram_value_vprintf(const char *fmt, const void *inp, size_t ilen, bhnd_nvram_type itype, char *outp, size_t *olen, va_list ap) { - bhnd_nvram_val_t val; - int error; + bhnd_nvram_val val; + int error; /* Map input buffer as a value instance */ error = bhnd_nvram_val_init(&val, NULL, inp, ilen, itype, @@ -848,8 +848,8 @@ int bhnd_nvram_value_coerce(const void *inp, size_t ilen, bhnd_nvram_type itype, void *outp, size_t *olen, bhnd_nvram_type otype) { - bhnd_nvram_val_t val; - int error; + bhnd_nvram_val val; + int error; /* Wrap input buffer in a value instance */ error = bhnd_nvram_val_init(&val, NULL, inp, ilen, Modified: head/sys/dev/bhnd/nvram/bhnd_nvram_value.c ============================================================================== --- head/sys/dev/bhnd/nvram/bhnd_nvram_value.c Mon Dec 19 19:40:11 2016 (r310289) +++ head/sys/dev/bhnd/nvram/bhnd_nvram_value.c Mon Dec 19 20:07:58 2016 (r310290) @@ -55,17 +55,15 @@ __FBSDID("$FreeBSD$"); #include "bhnd_nvram_valuevar.h" -static void *bhnd_nvram_val_alloc_bytes(bhnd_nvram_val_t *value, - size_t ilen, bhnd_nvram_type itype, - uint32_t flags); -static int bhnd_nvram_val_set(bhnd_nvram_val_t *value, const void *inp, - size_t ilen, bhnd_nvram_type itype, - uint32_t flags); -static int bhnd_nvram_val_set_inline(bhnd_nvram_val_t *value, +static void *bhnd_nvram_val_alloc_bytes(bhnd_nvram_val *value, size_t ilen, + bhnd_nvram_type itype, uint32_t flags); +static int bhnd_nvram_val_set(bhnd_nvram_val *value, const void *inp, + size_t ilen, bhnd_nvram_type itype, uint32_t flags); +static int bhnd_nvram_val_set_inline(bhnd_nvram_val *value, const void *inp, size_t ilen, bhnd_nvram_type itype); #define BHND_NVRAM_VAL_INITIALIZER(_fmt, _storage) \ - (bhnd_nvram_val_t) { \ + (bhnd_nvram_val) { \ .refs = 1, \ .val_storage = _storage, \ .fmt = _fmt, \ @@ -85,9 +83,9 @@ static int bhnd_nvram_val_set_inline(bh /* Common initialization support for bhnd_nvram_val_init() and * bhnd_nvram_val_new() */ static int -bhnd_nvram_val_init_common(bhnd_nvram_val_t *value, bhnd_nvram_val_storage_t - val_storage, const bhnd_nvram_val_fmt_t *fmt, const void *inp, size_t ilen, - bhnd_nvram_type itype, uint32_t flags) +bhnd_nvram_val_init_common(bhnd_nvram_val *value, + bhnd_nvram_val_storage val_storage, const bhnd_nvram_val_fmt *fmt, + const void *inp, size_t ilen, bhnd_nvram_type itype, uint32_t flags) { void *outp; bhnd_nvram_type otype; @@ -97,7 +95,7 @@ bhnd_nvram_val_init_common(bhnd_nvram_va /* Determine expected data type, and allow the format to delegate to * a new format instance */ if (fmt != NULL && fmt->op_filter != NULL) { - const bhnd_nvram_val_fmt_t *nfmt = fmt; + const bhnd_nvram_val_fmt *nfmt = fmt; /* Use the filter function to determine whether direct * initialization from is itype permitted */ @@ -181,7 +179,7 @@ bhnd_nvram_val_init_common(bhnd_nvram_va * @p fmt representation. */ int -bhnd_nvram_val_init(bhnd_nvram_val_t *value, const bhnd_nvram_val_fmt_t *fmt, +bhnd_nvram_val_init(bhnd_nvram_val *value, const bhnd_nvram_val_fmt *fmt, const void *inp, size_t ilen, bhnd_nvram_type itype, uint32_t flags) { int error; @@ -218,7 +216,7 @@ bhnd_nvram_val_init(bhnd_nvram_val_t *va * @p fmt representation. */ int -bhnd_nvram_val_new(bhnd_nvram_val_t **value, const bhnd_nvram_val_fmt_t *fmt, +bhnd_nvram_val_new(bhnd_nvram_val **value, const bhnd_nvram_val_fmt *fmt, const void *inp, size_t ilen, bhnd_nvram_type itype, uint32_t flags) { int error; @@ -246,13 +244,13 @@ bhnd_nvram_val_new(bhnd_nvram_val_t **va * * @param value The value to be copied (or retained). * - * @retval bhnd_nvram_val_t if @p value was successfully copied or retained. + * @retval bhnd_nvram_val if @p value was successfully copied or retained. * @retval NULL if allocation failed. */ -bhnd_nvram_val_t * -bhnd_nvram_val_copy(bhnd_nvram_val_t *value) +bhnd_nvram_val * +bhnd_nvram_val_copy(bhnd_nvram_val *value) { - bhnd_nvram_val_t *result; + bhnd_nvram_val *result; const void *bytes; bhnd_nvram_type type; size_t len; @@ -306,7 +304,7 @@ bhnd_nvram_val_copy(bhnd_nvram_val_t *va * @param value The value to be released. */ void -bhnd_nvram_val_release(bhnd_nvram_val_t *value) +bhnd_nvram_val_release(bhnd_nvram_val *value) { BHND_NV_ASSERT(value->refs >= 1, ("value over-released")); @@ -720,7 +718,7 @@ bhnd_nvram_val_encode_int(void *outp, si * a @p otype representation. */ int -bhnd_nvram_val_encode(bhnd_nvram_val_t *value, void *outp, size_t *olen, +bhnd_nvram_val_encode(bhnd_nvram_val *value, void *outp, size_t *olen, bhnd_nvram_type otype) { /* Prefer format implementation */ @@ -755,7 +753,7 @@ bhnd_nvram_val_encode(bhnd_nvram_val_t * * a @p otype representation. */ int -bhnd_nvram_val_encode_elem(bhnd_nvram_val_t *value, const void *inp, +bhnd_nvram_val_encode_elem(bhnd_nvram_val *value, const void *inp, size_t ilen, void *outp, size_t *olen, bhnd_nvram_type otype) { /* Prefer format implementation */ @@ -777,7 +775,7 @@ bhnd_nvram_val_encode_elem(bhnd_nvram_va * @param[out] otype Data type. */ const void * -bhnd_nvram_val_bytes(bhnd_nvram_val_t *value, size_t *olen, +bhnd_nvram_val_bytes(bhnd_nvram_val *value, size_t *olen, bhnd_nvram_type *otype) { /* Provide type and length */ @@ -819,7 +817,7 @@ bhnd_nvram_val_bytes(bhnd_nvram_val_t *v * @retval NULL If the end of the element array is reached. */ const void * -bhnd_nvram_val_next(bhnd_nvram_val_t *value, const void *prev, size_t *len) +bhnd_nvram_val_next(bhnd_nvram_val *value, const void *prev, size_t *len) { /* Prefer the format implementation */ if (value->fmt != NULL && value->fmt->op_next != NULL) @@ -834,7 +832,7 @@ bhnd_nvram_val_next(bhnd_nvram_val_t *va * @param value The value to be queried. */ bhnd_nvram_type -bhnd_nvram_val_elem_type(bhnd_nvram_val_t *value) +bhnd_nvram_val_elem_type(bhnd_nvram_val *value) { return (bhnd_nvram_base_type(value->data_type)); } @@ -843,7 +841,7 @@ bhnd_nvram_val_elem_type(bhnd_nvram_val_ * Return the total number of elements represented by @p value. */ size_t -bhnd_nvram_val_nelem(bhnd_nvram_val_t *value) +bhnd_nvram_val_nelem(bhnd_nvram_val *value) { const void *bytes; bhnd_nvram_type type; @@ -890,7 +888,7 @@ bhnd_nvram_val_nelem(bhnd_nvram_val_t *v * all supported NVRAM data types. */ int -bhnd_nvram_val_generic_encode(bhnd_nvram_val_t *value, void *outp, size_t *olen, +bhnd_nvram_val_generic_encode(bhnd_nvram_val *value, void *outp, size_t *olen, bhnd_nvram_type otype) { const void *inp; @@ -1003,7 +1001,7 @@ bhnd_nvram_val_generic_encode(bhnd_nvram * all supported NVRAM data types. */ int -bhnd_nvram_val_generic_encode_elem(bhnd_nvram_val_t *value, const void *inp, +bhnd_nvram_val_generic_encode_elem(bhnd_nvram_val *value, const void *inp, size_t ilen, void *outp, size_t *olen, bhnd_nvram_type otype) { bhnd_nvram_type itype; @@ -1037,7 +1035,7 @@ bhnd_nvram_val_generic_encode_elem(bhnd_ * all supported NVRAM data types. */ const void * -bhnd_nvram_val_generic_next(bhnd_nvram_val_t *value, const void *prev, +bhnd_nvram_val_generic_next(bhnd_nvram_val *value, const void *prev, size_t *len) { const uint8_t *inp; @@ -1101,7 +1099,7 @@ bhnd_nvram_val_generic_next(bhnd_nvram_v * @p itype. */ static int -bhnd_nvram_val_set(bhnd_nvram_val_t *value, const void *inp, size_t ilen, +bhnd_nvram_val_set(bhnd_nvram_val *value, const void *inp, size_t ilen, bhnd_nvram_type itype, uint32_t flags) { void *bytes; @@ -1154,7 +1152,7 @@ bhnd_nvram_val_set(bhnd_nvram_val_t *val * @p itype. */ static int -bhnd_nvram_val_set_inline(bhnd_nvram_val_t *value, const void *inp, size_t ilen, +bhnd_nvram_val_set_inline(bhnd_nvram_val *value, const void *inp, size_t ilen, bhnd_nvram_type itype) { BHND_NVRAM_VAL_ASSERT_EMPTY(value); @@ -1278,7 +1276,7 @@ bhnd_nvram_val_set_inline(bhnd_nvram_val * @retval NULL If @p value is an externally allocated instance. */ static void * -bhnd_nvram_val_alloc_bytes(bhnd_nvram_val_t *value, size_t ilen, +bhnd_nvram_val_alloc_bytes(bhnd_nvram_val *value, size_t ilen, bhnd_nvram_type itype, uint32_t flags) { void *ptr; Modified: head/sys/dev/bhnd/nvram/bhnd_nvram_value.h ============================================================================== --- head/sys/dev/bhnd/nvram/bhnd_nvram_value.h Mon Dec 19 19:40:11 2016 (r310289) +++ head/sys/dev/bhnd/nvram/bhnd_nvram_value.h Mon Dec 19 20:07:58 2016 (r310290) @@ -42,51 +42,51 @@ #include "bhnd_nvram.h" -typedef struct bhnd_nvram_val_fmt bhnd_nvram_val_fmt_t; -typedef struct bhnd_nvram_val bhnd_nvram_val_t; +typedef struct bhnd_nvram_val_fmt bhnd_nvram_val_fmt; +typedef struct bhnd_nvram_val bhnd_nvram_val; -int bhnd_nvram_val_init(bhnd_nvram_val_t *value, - const bhnd_nvram_val_fmt_t *fmt, +int bhnd_nvram_val_init(bhnd_nvram_val *value, + const bhnd_nvram_val_fmt *fmt, const void *inp, size_t ilen, bhnd_nvram_type itype, uint32_t flags); -int bhnd_nvram_val_new(bhnd_nvram_val_t **value, - const bhnd_nvram_val_fmt_t *fmt, +int bhnd_nvram_val_new(bhnd_nvram_val **value, + const bhnd_nvram_val_fmt *fmt, const void *inp, size_t ilen, bhnd_nvram_type itype, uint32_t flags); -bhnd_nvram_val_t *bhnd_nvram_val_copy(bhnd_nvram_val_t *value); +bhnd_nvram_val *bhnd_nvram_val_copy(bhnd_nvram_val *value); void bhnd_nvram_val_release( - bhnd_nvram_val_t *value); + bhnd_nvram_val *value); -int bhnd_nvram_val_encode(bhnd_nvram_val_t *value, +int bhnd_nvram_val_encode(bhnd_nvram_val *value, void *outp, size_t *olen, bhnd_nvram_type otype); int bhnd_nvram_val_encode_elem( - bhnd_nvram_val_t *value, const void *inp, + bhnd_nvram_val *value, const void *inp, size_t ilen, void *outp, size_t *olen, bhnd_nvram_type otype); -int bhnd_nvram_val_printf(bhnd_nvram_val_t *value, +int bhnd_nvram_val_printf(bhnd_nvram_val *value, const char *fmt, char *outp, size_t *olen, ...); -int bhnd_nvram_val_vprintf(bhnd_nvram_val_t *value, +int bhnd_nvram_val_vprintf(bhnd_nvram_val *value, const char *fmt, char *outp, size_t *olen, va_list ap); -const void *bhnd_nvram_val_bytes(bhnd_nvram_val_t *value, +const void *bhnd_nvram_val_bytes(bhnd_nvram_val *value, size_t *len, bhnd_nvram_type *itype); bhnd_nvram_type bhnd_nvram_val_elem_type( - bhnd_nvram_val_t *value); + bhnd_nvram_val *value); -const void *bhnd_nvram_val_next(bhnd_nvram_val_t *value, +const void *bhnd_nvram_val_next(bhnd_nvram_val *value, const void *prev, size_t *len); -size_t bhnd_nvram_val_nelem(bhnd_nvram_val_t *value); +size_t bhnd_nvram_val_nelem(bhnd_nvram_val *value); /** * NVRAM value flags @@ -152,7 +152,7 @@ typedef enum { * as-is. */ BHND_NVRAM_VAL_STORAGE_DYNAMIC = 2, -} bhnd_nvram_val_storage_t; +} bhnd_nvram_val_storage; /** * @internal @@ -183,16 +183,16 @@ typedef enum { * when deallocating the value */ BHND_NVRAM_VAL_DATA_EXT_ALLOC = 4, -} bhnd_nvram_val_data_storage_t; +} bhnd_nvram_val_data_storage; /** * NVRAM value */ struct bhnd_nvram_val { volatile u_int refs; /**< reference count */ - bhnd_nvram_val_storage_t val_storage; /**< value structure storage */ - const bhnd_nvram_val_fmt_t *fmt; /**< value format, or NULL for default behavior */ - bhnd_nvram_val_data_storage_t data_storage; /**< data storage */ + bhnd_nvram_val_storage val_storage; /**< value structure storage */ + const bhnd_nvram_val_fmt *fmt; /**< value format, or NULL for default behavior */ + bhnd_nvram_val_data_storage data_storage; /**< data storage */ bhnd_nvram_type data_type; /**< data type */ size_t data_len; /**< data size */ @@ -213,7 +213,7 @@ struct bhnd_nvram_val { /** Declare a bhnd_nvram_val_fmt with name @p _n */ #define BHND_NVRAM_VAL_TYPE_DECL(_n) \ - extern const bhnd_nvram_val_fmt_t bhnd_nvram_val_ ## _n ## _fmt; + extern const bhnd_nvram_val_fmt bhnd_nvram_val_ ## _n ## _fmt; BHND_NVRAM_VAL_TYPE_DECL(bcm_decimal); BHND_NVRAM_VAL_TYPE_DECL(bcm_hex); Modified: head/sys/dev/bhnd/nvram/bhnd_nvram_value_fmts.c ============================================================================== --- head/sys/dev/bhnd/nvram/bhnd_nvram_value_fmts.c Mon Dec 19 19:40:11 2016 (r310289) +++ head/sys/dev/bhnd/nvram/bhnd_nvram_value_fmts.c Mon Dec 19 20:07:58 2016 (r310290) @@ -63,61 +63,61 @@ static bool bhnd_nvram_ident_num_strin size_t ilen, u_int base, u_int *obase); static int bhnd_nvram_val_bcm_macaddr_filter( - const bhnd_nvram_val_fmt_t **fmt, const void *inp, + const bhnd_nvram_val_fmt **fmt, const void *inp, size_t ilen, bhnd_nvram_type itype); static int bhnd_nvram_val_bcm_macaddr_encode( - bhnd_nvram_val_t *value, void *outp, size_t *olen, + bhnd_nvram_val *value, void *outp, size_t *olen, bhnd_nvram_type otype); static int bhnd_nvram_val_bcm_macaddr_string_filter( - const bhnd_nvram_val_fmt_t **fmt, const void *inp, + const bhnd_nvram_val_fmt **fmt, const void *inp, size_t ilen, bhnd_nvram_type itype); static int bhnd_nvram_val_bcm_macaddr_string_encode_elem( - bhnd_nvram_val_t *value, const void *inp, + bhnd_nvram_val *value, const void *inp, size_t ilen, void *outp, size_t *olen, bhnd_nvram_type otype); static const void *bhnd_nvram_val_bcm_macaddr_string_next( - bhnd_nvram_val_t *value, const void *prev, + bhnd_nvram_val *value, const void *prev, size_t *len); static int bhnd_nvram_val_bcm_int_filter( - const bhnd_nvram_val_fmt_t **fmt, const void *inp, + const bhnd_nvram_val_fmt **fmt, const void *inp, size_t ilen, bhnd_nvram_type itype); -static int bhnd_nvram_val_bcm_int_encode(bhnd_nvram_val_t *value, +static int bhnd_nvram_val_bcm_int_encode(bhnd_nvram_val *value, void *outp, size_t *olen, bhnd_nvram_type otype); static int bhnd_nvram_val_bcm_decimal_encode_elem( - bhnd_nvram_val_t *value, const void *inp, + bhnd_nvram_val *value, const void *inp, size_t ilen, void *outp, size_t *olen, bhnd_nvram_type otype); static int bhnd_nvram_val_bcm_hex_encode_elem( - bhnd_nvram_val_t *value, const void *inp, + bhnd_nvram_val *value, const void *inp, size_t ilen, void *outp, size_t *olen, bhnd_nvram_type otype); static int bhnd_nvram_val_bcm_leddc_filter( - const bhnd_nvram_val_fmt_t **fmt, const void *inp, + const bhnd_nvram_val_fmt **fmt, const void *inp, size_t ilen, bhnd_nvram_type itype); static int bhnd_nvram_val_bcm_leddc_encode_elem( - bhnd_nvram_val_t *value, const void *inp, + bhnd_nvram_val *value, const void *inp, size_t ilen, void *outp, size_t *olen, bhnd_nvram_type otype); -static int bhnd_nvram_val_bcmstr_encode(bhnd_nvram_val_t *value, +static int bhnd_nvram_val_bcmstr_encode(bhnd_nvram_val *value, void *outp, size_t *olen, bhnd_nvram_type otype); static int bhnd_nvram_val_bcmstr_csv_filter( - const bhnd_nvram_val_fmt_t **fmt, const void *inp, + const bhnd_nvram_val_fmt **fmt, const void *inp, size_t ilen, bhnd_nvram_type itype); -static const void *bhnd_nvram_val_bcmstr_csv_next(bhnd_nvram_val_t *value, +static const void *bhnd_nvram_val_bcmstr_csv_next(bhnd_nvram_val *value, const void *prev, size_t *len); /** * Broadcom NVRAM MAC address format. */ -const bhnd_nvram_val_fmt_t bhnd_nvram_val_bcm_macaddr_fmt = { +const bhnd_nvram_val_fmt bhnd_nvram_val_bcm_macaddr_fmt = { .name = "bcm-macaddr", .native_type = BHND_NVRAM_TYPE_UINT8_ARRAY, .op_filter = bhnd_nvram_val_bcm_macaddr_filter, @@ -125,7 +125,7 @@ const bhnd_nvram_val_fmt_t bhnd_nvram_va }; /** Broadcom NVRAM MAC address string format. */ -static const bhnd_nvram_val_fmt_t bhnd_nvram_val_bcm_macaddr_string_fmt = { +static const bhnd_nvram_val_fmt bhnd_nvram_val_bcm_macaddr_string_fmt = { .name = "bcm-macaddr-string", .native_type = BHND_NVRAM_TYPE_STRING, .op_filter = bhnd_nvram_val_bcm_macaddr_string_filter, @@ -136,7 +136,7 @@ static const bhnd_nvram_val_fmt_t bhnd_n /** * Broadcom NVRAM LED duty-cycle format. */ -const bhnd_nvram_val_fmt_t bhnd_nvram_val_bcm_leddc_fmt = { +const bhnd_nvram_val_fmt bhnd_nvram_val_bcm_leddc_fmt = { .name = "bcm-leddc", .native_type = BHND_NVRAM_TYPE_UINT32, .op_filter = bhnd_nvram_val_bcm_leddc_filter, @@ -152,7 +152,7 @@ const bhnd_nvram_val_fmt_t bhnd_nvram_va * - Positive values will be string-encoded without a prefix. * - Negative values will be string-encoded with a leading '-' sign. */ -const bhnd_nvram_val_fmt_t bhnd_nvram_val_bcm_decimal_fmt = { +const bhnd_nvram_val_fmt bhnd_nvram_val_bcm_decimal_fmt = { .name = "bcm-decimal", .native_type = BHND_NVRAM_TYPE_UINT64, .op_filter = bhnd_nvram_val_bcm_int_filter, @@ -171,7 +171,7 @@ const bhnd_nvram_val_fmt_t bhnd_nvram_va * both signed and negative, it will be string encoded as a negative decimal * value, not as a twos-complement hexadecimal value. */ -const bhnd_nvram_val_fmt_t bhnd_nvram_val_bcm_hex_fmt = { +const bhnd_nvram_val_fmt bhnd_nvram_val_bcm_hex_fmt = { .name = "bcm-hex", .native_type = BHND_NVRAM_TYPE_UINT64, .op_filter = bhnd_nvram_val_bcm_int_filter, @@ -185,14 +185,14 @@ const bhnd_nvram_val_fmt_t bhnd_nvram_va * Handles standard, comma-delimited, and octet-string values as used in * Broadcom NVRAM data. */ -const bhnd_nvram_val_fmt_t bhnd_nvram_val_bcm_string_fmt = { +const bhnd_nvram_val_fmt bhnd_nvram_val_bcm_string_fmt = { .name = "bcm-string", .native_type = BHND_NVRAM_TYPE_STRING, .op_encode = bhnd_nvram_val_bcmstr_encode, }; /** Broadcom comma-delimited string. */ -static const bhnd_nvram_val_fmt_t bhnd_nvram_val_bcm_string_csv_fmt = { +static const bhnd_nvram_val_fmt bhnd_nvram_val_bcm_string_csv_fmt = { .name = "bcm-string[]", .native_type = BHND_NVRAM_TYPE_STRING, .op_filter = bhnd_nvram_val_bcmstr_csv_filter, @@ -203,7 +203,7 @@ static const bhnd_nvram_val_fmt_t bhnd_n * Common hex/decimal integer filter implementation. */ static int -bhnd_nvram_val_bcm_int_filter(const bhnd_nvram_val_fmt_t **fmt, const void *inp, +bhnd_nvram_val_bcm_int_filter(const bhnd_nvram_val_fmt **fmt, const void *inp, size_t ilen, bhnd_nvram_type itype) { bhnd_nvram_type itype_base; @@ -233,7 +233,7 @@ bhnd_nvram_val_bcm_int_filter(const bhnd * Broadcom hex/decimal integer encode implementation. */ static int -bhnd_nvram_val_bcm_int_encode(bhnd_nvram_val_t *value, void *outp, size_t *olen, +bhnd_nvram_val_bcm_int_encode(bhnd_nvram_val *value, void *outp, size_t *olen, bhnd_nvram_type otype) { /* If encoding to a string, format multiple elements (if any) with a @@ -248,7 +248,7 @@ bhnd_nvram_val_bcm_int_encode(bhnd_nvram * Broadcom hex integer encode_elem implementation. */ static int -bhnd_nvram_val_bcm_hex_encode_elem(bhnd_nvram_val_t *value, const void *inp, +bhnd_nvram_val_bcm_hex_encode_elem(bhnd_nvram_val *value, const void *inp, size_t ilen, void *outp, size_t *olen, bhnd_nvram_type otype) { bhnd_nvram_type itype; @@ -303,7 +303,7 @@ bhnd_nvram_val_bcm_hex_encode_elem(bhnd_ * Broadcom decimal integer encode_elem implementation. */ static int -bhnd_nvram_val_bcm_decimal_encode_elem(bhnd_nvram_val_t *value, const void *inp, +bhnd_nvram_val_bcm_decimal_encode_elem(bhnd_nvram_val *value, const void *inp, size_t ilen, void *outp, size_t *olen, bhnd_nvram_type otype) { const char *sfmt; @@ -325,7 +325,7 @@ bhnd_nvram_val_bcm_decimal_encode_elem(b * Broadcom LED duty-cycle filter. */ static int -bhnd_nvram_val_bcm_leddc_filter(const bhnd_nvram_val_fmt_t **fmt, +bhnd_nvram_val_bcm_leddc_filter(const bhnd_nvram_val_fmt **fmt, const void *inp, size_t ilen, bhnd_nvram_type itype) { const char *p; @@ -356,7 +356,7 @@ bhnd_nvram_val_bcm_leddc_filter(const bh * Broadcom LED duty-cycle encode. */ static int -bhnd_nvram_val_bcm_leddc_encode_elem(bhnd_nvram_val_t *value, const void *inp, +bhnd_nvram_val_bcm_leddc_encode_elem(bhnd_nvram_val *value, const void *inp, size_t ilen, void *outp, size_t *olen, bhnd_nvram_type otype) { bhnd_nvram_type itype; @@ -536,11 +536,11 @@ bhnd_nvram_val_bcm_leddc_encode_elem(bhn * Broadcom NVRAM string encoding. */ static int -bhnd_nvram_val_bcmstr_encode(bhnd_nvram_val_t *value, void *outp, - size_t *olen, bhnd_nvram_type otype) +bhnd_nvram_val_bcmstr_encode(bhnd_nvram_val *value, void *outp, size_t *olen, + bhnd_nvram_type otype) { - bhnd_nvram_val_t array; - const bhnd_nvram_val_fmt_t *array_fmt; + bhnd_nvram_val array; + const bhnd_nvram_val_fmt *array_fmt; const void *inp; bhnd_nvram_type itype; size_t ilen; @@ -588,7 +588,7 @@ bhnd_nvram_val_bcmstr_encode(bhnd_nvram_ * Broadcom NVRAM comma-delimited string filter. */ static int -bhnd_nvram_val_bcmstr_csv_filter(const bhnd_nvram_val_fmt_t **fmt, +bhnd_nvram_val_bcmstr_csv_filter(const bhnd_nvram_val_fmt **fmt, const void *inp, size_t ilen, bhnd_nvram_type itype) { switch (itype) { @@ -604,7 +604,7 @@ bhnd_nvram_val_bcmstr_csv_filter(const b * Broadcom NVRAM comma-delimited string iteration. */ static const void * -bhnd_nvram_val_bcmstr_csv_next(bhnd_nvram_val_t *value, const void *prev, +bhnd_nvram_val_bcmstr_csv_next(bhnd_nvram_val *value, const void *prev, size_t *len) { const char *next; @@ -671,7 +671,7 @@ bhnd_nvram_val_bcmstr_csv_next(bhnd_nvra * MAC address filter. */ static int -bhnd_nvram_val_bcm_macaddr_filter(const bhnd_nvram_val_fmt_t **fmt, +bhnd_nvram_val_bcm_macaddr_filter(const bhnd_nvram_val_fmt **fmt, const void *inp, size_t ilen, bhnd_nvram_type itype) { switch (itype) { @@ -690,7 +690,7 @@ bhnd_nvram_val_bcm_macaddr_filter(const * MAC address encoding. */ static int -bhnd_nvram_val_bcm_macaddr_encode(bhnd_nvram_val_t *value, void *outp, +bhnd_nvram_val_bcm_macaddr_encode(bhnd_nvram_val *value, void *outp, size_t *olen, bhnd_nvram_type otype) { const void *inp; @@ -714,7 +714,7 @@ bhnd_nvram_val_bcm_macaddr_encode(bhnd_n * MAC address string filter. */ static int -bhnd_nvram_val_bcm_macaddr_string_filter(const bhnd_nvram_val_fmt_t **fmt, +bhnd_nvram_val_bcm_macaddr_string_filter(const bhnd_nvram_val_fmt **fmt, const void *inp, size_t ilen, bhnd_nvram_type itype) { switch (itype) { @@ -735,7 +735,7 @@ bhnd_nvram_val_bcm_macaddr_string_filter * MAC address string octet encoding. */ static int -bhnd_nvram_val_bcm_macaddr_string_encode_elem(bhnd_nvram_val_t *value, +bhnd_nvram_val_bcm_macaddr_string_encode_elem(bhnd_nvram_val *value, const void *inp, size_t ilen, void *outp, size_t *olen, bhnd_nvram_type otype) { @@ -765,7 +765,7 @@ bhnd_nvram_val_bcm_macaddr_string_encode * MAC address string octet iteration. */ static const void * -bhnd_nvram_val_bcm_macaddr_string_next(bhnd_nvram_val_t *value, const void *prev, +bhnd_nvram_val_bcm_macaddr_string_next(bhnd_nvram_val *value, const void *prev, size_t *len) { const char *next; Modified: head/sys/dev/bhnd/nvram/bhnd_nvram_value_prf.c ============================================================================== --- head/sys/dev/bhnd/nvram/bhnd_nvram_value_prf.c Mon Dec 19 19:40:11 2016 (r310289) +++ head/sys/dev/bhnd/nvram/bhnd_nvram_value_prf.c Mon Dec 19 20:07:58 2016 (r310290) @@ -98,7 +98,7 @@ static char const bhnd_nv_hex2ascii[] = * underflow) the representation defined by @p fmt. */ int -bhnd_nvram_val_printf(bhnd_nvram_val_t *value, const char *fmt, char *outp, +bhnd_nvram_val_printf(bhnd_nvram_val *value, const char *fmt, char *outp, size_t *olen, ...) { va_list ap; @@ -209,7 +209,7 @@ bhnd_nvram_val_printf(bhnd_nvram_val_t * * underflow) the representation defined by @p fmt. */ int -bhnd_nvram_val_vprintf(bhnd_nvram_val_t *value, const char *fmt, char *outp, +bhnd_nvram_val_vprintf(bhnd_nvram_val *value, const char *fmt, char *outp, size_t *olen, va_list ap) { const void *elem; Modified: head/sys/dev/bhnd/nvram/bhnd_nvram_valuevar.h ============================================================================== --- head/sys/dev/bhnd/nvram/bhnd_nvram_valuevar.h Mon Dec 19 19:40:11 2016 (r310289) +++ head/sys/dev/bhnd/nvram/bhnd_nvram_valuevar.h Mon Dec 19 20:07:58 2016 (r310290) @@ -34,12 +34,12 @@ #include "bhnd_nvram_value.h" -int bhnd_nvram_val_generic_encode(bhnd_nvram_val_t *value, +int bhnd_nvram_val_generic_encode(bhnd_nvram_val *value, void *outp, size_t *olen, bhnd_nvram_type otype); -int bhnd_nvram_val_generic_encode_elem(bhnd_nvram_val_t *value, +int bhnd_nvram_val_generic_encode_elem(bhnd_nvram_val *value, const void *inp, size_t ilen, void *outp, size_t *olen, bhnd_nvram_type otype); -const void *bhnd_nvram_val_generic_next(bhnd_nvram_val_t *value, +const void *bhnd_nvram_val_generic_next(bhnd_nvram_val *value, const void *prev, size_t *len); /** * Filter input data prior to initialization. @@ -60,24 +60,24 @@ const void *bhnd_nvram_val_generic_next( * @retval EFAULT if @p ilen is not correctly aligned for elements of * @p itype. */ -typedef int (bhnd_nvram_val_op_filter)(const bhnd_nvram_val_fmt_t **fmt, +typedef int (bhnd_nvram_val_op_filter)(const bhnd_nvram_val_fmt **fmt, const void *inp, size_t ilen, bhnd_nvram_type itype); /** @see bhnd_nvram_val_encode() */ -typedef int (bhnd_nvram_val_op_encode)(bhnd_nvram_val_t *value, void *outp, +typedef int (bhnd_nvram_val_op_encode)(bhnd_nvram_val *value, void *outp, size_t *olen, bhnd_nvram_type otype); /** @see bhnd_nvram_val_encode_elem() */ -typedef int (bhnd_nvram_val_op_encode_elem)(bhnd_nvram_val_t *value, +typedef int (bhnd_nvram_val_op_encode_elem)(bhnd_nvram_val *value, const void *inp, size_t ilen, void *outp, size_t *olen, bhnd_nvram_type otype); /** @see bhnd_nvram_val_next() */ -typedef const void *(bhnd_nvram_val_op_next)(bhnd_nvram_val_t *value, +typedef const void *(bhnd_nvram_val_op_next)(bhnd_nvram_val *value, const void *prev, size_t *len); /** @see bhnd_nvram_val_nelem() */ -typedef size_t (bhnd_nvram_val_op_nelem)(bhnd_nvram_val_t *value); +typedef size_t (bhnd_nvram_val_op_nelem)(bhnd_nvram_val *value); /** * NVRAM value format. Modified: head/sys/mips/broadcom/bcm_nvram_cfe.c ============================================================================== --- head/sys/mips/broadcom/bcm_nvram_cfe.c Mon Dec 19 19:40:11 2016 (r310289) +++ head/sys/mips/broadcom/bcm_nvram_cfe.c Mon Dec 19 20:07:58 2016 (r310290) @@ -83,8 +83,7 @@ static int bhnd_nvram_iocfe_new(struc char *dname); static struct bhnd_nvram_io *bhnd_nvram_find_cfedev(device_t dev, - char **dname, - bhnd_nvram_data_class_t **cls); + char **dname, bhnd_nvram_data_class **cls); /** Known CFE NVRAM device names, in probe order. */ static char *nvram_cfe_devs[] = { @@ -95,7 +94,7 @@ static char *nvram_cfe_devs[] = { }; /** Supported CFE NVRAM formats, in probe order. */ -static bhnd_nvram_data_class_t * const nvram_cfe_fmts[] = { +static bhnd_nvram_data_class * const nvram_cfe_fmts[] = { &bhnd_nvram_bcm_class, &bhnd_nvram_tlv_class }; @@ -105,7 +104,7 @@ static int bhnd_nvram_cfe_probe(device_t dev) { struct bhnd_nvram_io *io; - bhnd_nvram_data_class_t *cls; + bhnd_nvram_data_class *cls; const char *cls_desc; char *dname; char *desc; @@ -135,7 +134,7 @@ static int bhnd_nvram_cfe_attach(device_t dev) { struct bhnd_nvram_cfe_softc *sc; - bhnd_nvram_data_class_t *cls; + bhnd_nvram_data_class *cls; struct bhnd_nvram_io *io; char *dname; int error; @@ -215,8 +214,7 @@ bhnd_nvram_cfe_setvar(device_t dev, cons * @retval NULL if no usable CFE NVRAM device could be found. */ static struct bhnd_nvram_io * -bhnd_nvram_find_cfedev(device_t dev, char **dname, - bhnd_nvram_data_class_t **cls) +bhnd_nvram_find_cfedev(device_t dev, char **dname, bhnd_nvram_data_class **cls) { struct bhnd_nvram_io *io; int devinfo; From owner-svn-src-all@freebsd.org Mon Dec 19 20:11:50 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 26836C88137; Mon, 19 Dec 2016 20:11:50 +0000 (UTC) (envelope-from landonf@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id DC4061D43; Mon, 19 Dec 2016 20:11:49 +0000 (UTC) (envelope-from landonf@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBJKBnBL051384; Mon, 19 Dec 2016 20:11:49 GMT (envelope-from landonf@FreeBSD.org) Received: (from landonf@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBJKBmYt051380; Mon, 19 Dec 2016 20:11:48 GMT (envelope-from landonf@FreeBSD.org) Message-Id: <201612192011.uBJKBmYt051380@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: landonf set sender to landonf@FreeBSD.org using -f From: "Landon J. Fuller" Date: Mon, 19 Dec 2016 20:11:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310291 - in head/sys: conf dev/bhnd/nvram modules/bhnd X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Dec 2016 20:11:50 -0000 Author: landonf Date: Mon Dec 19 20:11:48 2016 New Revision: 310291 URL: https://svnweb.freebsd.org/changeset/base/310291 Log: bhnd(4): Implement a new bhnd_nvram_plist and bhnd_nvram_prop API for representing arbitrary Broadcom NVRAM key/value pairs. This will be used to track pending changes in bhnd_nvram_store, and provide support for exporting all or a device subpath for NVRAM (as required by some fullmac wifi chipsets). Approved by: adrian (mentor) Differential Revision: https://reviews.freebsd.org/D8756 Added: head/sys/dev/bhnd/nvram/bhnd_nvram_plist.c (contents, props changed) head/sys/dev/bhnd/nvram/bhnd_nvram_plist.h (contents, props changed) head/sys/dev/bhnd/nvram/bhnd_nvram_plistvar.h (contents, props changed) Modified: head/sys/conf/files head/sys/dev/bhnd/nvram/bhnd_nvram_private.h head/sys/dev/bhnd/nvram/bhnd_nvram_value.c head/sys/dev/bhnd/nvram/bhnd_nvram_value.h head/sys/modules/bhnd/Makefile Modified: head/sys/conf/files ============================================================================== --- head/sys/conf/files Mon Dec 19 20:07:58 2016 (r310290) +++ head/sys/conf/files Mon Dec 19 20:11:48 2016 (r310291) @@ -1241,6 +1241,7 @@ dev/bhnd/nvram/bhnd_nvram_if.m optional dev/bhnd/nvram/bhnd_nvram_io.c optional bhnd dev/bhnd/nvram/bhnd_nvram_iobuf.c optional bhnd dev/bhnd/nvram/bhnd_nvram_iores.c optional bhnd +dev/bhnd/nvram/bhnd_nvram_plist.c optional bhnd dev/bhnd/nvram/bhnd_nvram_store.c optional bhnd dev/bhnd/nvram/bhnd_nvram_subr.c optional bhnd dev/bhnd/nvram/bhnd_nvram_value.c optional bhnd Added: head/sys/dev/bhnd/nvram/bhnd_nvram_plist.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/dev/bhnd/nvram/bhnd_nvram_plist.c Mon Dec 19 20:11:48 2016 (r310291) @@ -0,0 +1,947 @@ +/*- + * Copyright (c) 2015-2016 Landon Fuller + * 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, + * without modification. + * 2. Redistributions in binary form must reproduce at minimum a disclaimer + * similar to the "NO WARRANTY" disclaimer below ("Disclaimer") and any + * redistribution must be conditioned upon including a substantially + * similar Disclaimer requirement for further binary redistribution. + * + * NO WARRANTY + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF NONINFRINGEMENT, MERCHANTIBILITY + * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL + * THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR 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 DAMAGES. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include + +#ifdef _KERNEL + +#include + +#else /* !_KERNEL */ + +#include +#include +#include +#include + +#endif /* _KERNEL */ + +#include "bhnd_nvram_plistvar.h" +#include "bhnd_nvram_private.h" + +static bhnd_nvram_plist_entry *bhnd_nvram_plist_get_entry( + bhnd_nvram_plist *plist, const char *name); + +/** + * Allocate and initialize a new, empty property list. + * + * The caller is responsible for releasing the returned property value + * via bhnd_nvram_plist_release(). + * + * @retval non-NULL success + * @retval NULL if allocation fails. + */ +bhnd_nvram_plist * +bhnd_nvram_plist_new(void) +{ + bhnd_nvram_plist *plist; + + plist = bhnd_nv_calloc(1, sizeof(*plist)); + if (plist == NULL) + return NULL; + + /* Implicit caller-owned reference */ + plist->refs = 1; + + /* Initialize entry list */ + plist->num_entries = 0; + TAILQ_INIT(&plist->entries); + + /* Initialize entry hash table */ + for (size_t i = 0; i < nitems(plist->names); i++) + LIST_INIT(&plist->names[i]); + + return (plist); +} + +/** + * Retain a reference and return @p plist to the caller. + * + * The caller is responsible for releasing their reference ownership via + * bhnd_nvram_plist_release(). + * + * @param plist The property list to be retained. + */ +bhnd_nvram_plist * +bhnd_nvram_plist_retain(bhnd_nvram_plist *plist) +{ + BHND_NV_ASSERT(plist->refs >= 1, ("plist over-released")); + + refcount_acquire(&plist->refs); + return (plist); +} + +/** + * Release a reference to @p plist. + * + * If this is the last reference, all associated resources will be freed. + * + * @param plist The property list to be released. + */ +void +bhnd_nvram_plist_release(bhnd_nvram_plist *plist) +{ + bhnd_nvram_plist_entry *ple, *ple_next; + + BHND_NV_ASSERT(plist->refs >= 1, ("plist over-released")); + + /* Drop reference */ + if (!refcount_release(&plist->refs)) + return; + + /* Free all property entries */ + TAILQ_FOREACH_SAFE(ple, &plist->entries, pl_link, ple_next) { + bhnd_nvram_prop_release(ple->prop); + bhnd_nv_free(ple); + } + + /* Free plist instance */ + bhnd_nv_free(plist); +} + +/** + * Return a shallow copy of @p plist. + * + * The caller is responsible for releasing the returned property value + * via bhnd_nvram_plist_release(). + * + * @retval non-NULL success + * @retval NULL if allocation fails. + */ +bhnd_nvram_plist * +bhnd_nvram_plist_copy(bhnd_nvram_plist *plist) +{ + bhnd_nvram_plist *copy; + bhnd_nvram_prop *prop; + int error; + + /* Allocate new, empty plist */ + if ((copy = bhnd_nvram_plist_new()) == NULL) + return (NULL); + + /* Append all properties */ + prop = NULL; + while ((prop = bhnd_nvram_plist_next(plist, prop)) != NULL) { + error = bhnd_nvram_plist_append(copy, prop); + if (error) { + if (error != ENOMEM) { + BHND_NV_LOG("error copying property: %d\n", + error); + } + + bhnd_nvram_plist_release(copy); + return (NULL); + } + } + + /* Return ownership of the copy to our caller */ + return (copy); +} + +/** + * Return the number of properties in @p plist. + */ +size_t +bhnd_nvram_plist_count(bhnd_nvram_plist *plist) +{ + return (plist->num_entries); +} + +/** + * Return true if @p plist contains a property name @p name, false otherwise. + * + * @param plist The property list to be queried. + * @param name The property name to be queried. + */ +bool +bhnd_nvram_plist_contains(bhnd_nvram_plist *plist, const char *name) +{ + if (bhnd_nvram_plist_get_entry(plist, name) != NULL) + return (true); + + return (false); +} + +/** + * Replace the current property value for a property matching the name + * of @p prop, maintaining the property's current order in @p plist. + * + * If a matching property is not found in @p plist, @p prop will instead be + * appended. + * + * @param plist The property list to be modified. + * @param prop The replacement property. + * + * @retval 0 success + * @retval ENOMEM if allocation fails. + * @retval non-zero if modifying @p plist otherwise fails, a regular unix + * error code will be returned. + */ +int +bhnd_nvram_plist_replace(bhnd_nvram_plist *plist, bhnd_nvram_prop *prop) +{ + bhnd_nvram_plist_entry *entry; + + /* Fetch current entry */ + entry = bhnd_nvram_plist_get_entry(plist, prop->name); + if (entry == NULL) { + /* Not found -- append property instead */ + return (bhnd_nvram_plist_append(plist, prop)); + } + + /* Replace the current entry's property reference */ + bhnd_nvram_prop_release(entry->prop); + entry->prop = bhnd_nvram_prop_retain(prop); + + return (0); +} + +/** + * Replace the current property value for a property matching @p name, + * maintaining the property's order in @p plist. + * + * If @p name is not found in @p plist, a new property will be appended. + * + * @param plist The property list to be modified. + * @param name The name of the property to be replaced. + * @param val The replacement value for @p name. + * + * @retval 0 success + * @retval ENOMEM if allocation fails. + * @retval non-zero if modifying @p plist otherwise fails, a regular unix + * error code will be returned. + */ +int +bhnd_nvram_plist_replace_val(bhnd_nvram_plist *plist, const char *name, + bhnd_nvram_val *val) +{ + bhnd_nvram_prop *prop; + int error; + + /* Construct a new property instance for the name and value */ + if ((prop = bhnd_nvram_prop_new(name, val)) == NULL) + return (ENOMEM); + + /* Attempt replace */ + error = bhnd_nvram_plist_replace(plist, prop); + bhnd_nvram_prop_release(prop); + + return (error); +} + +/** + * Replace the current property value for a property matching @p name, copying + * the new property value from the given @p inp buffer of @p itype and @p ilen. + * + * The current property order of @p name in @p plist will be maintained. + * + * If @p name is not found in @p plist, a new property will be appended. + * + * @param plist The property list to be modified. + * @param name The name of the property to be replaced. + * @param inp Input buffer. + * @param ilen Input buffer length. + * @param itype Input buffer type. + * + * @retval 0 success + * @retval ENOMEM if allocation fails. + * @retval non-zero if modifying @p plist otherwise fails, a regular unix + * error code will be returned. + */ +int +bhnd_nvram_plist_replace_bytes(bhnd_nvram_plist *plist, const char *name, + const void *inp, size_t ilen, bhnd_nvram_type itype) +{ + bhnd_nvram_prop *prop; + int error; + + if ((prop = bhnd_nvram_prop_bytes_new(name, inp, ilen, itype)) == NULL) + return (ENOMEM); + + error = bhnd_nvram_plist_replace(plist, prop); + bhnd_nvram_prop_release(prop); + + return (error); +} + +/** + * Replace the current property value for a property matching @p name, copying + * the new property value from @p val. + * + * The current property order of @p name in @p plist will be maintained. + * + * If @p name is not found in @p plist, a new property will be appended. + * + * @param plist The property list to be modified. + * @param name The name of the property to be replaced. + * @param val The property's replacement string value. + * + * @retval 0 success + * @retval ENOMEM if allocation fails. + * @retval non-zero if modifying @p plist otherwise fails, a regular unix + * error code will be returned. + */ +int +bhnd_nvram_plist_replace_string(bhnd_nvram_plist *plist, const char *name, + const char *val) +{ + return (bhnd_nvram_plist_replace_bytes(plist, name, val, strlen(val)+1, + BHND_NVRAM_TYPE_STRING)); +} + +/** + * Remove the property entry for the property @p name, if any. + * + * @param plist The property list to be modified. + * @param name The name of the property to be removed. + */ +void +bhnd_nvram_plist_remove(bhnd_nvram_plist *plist, const char *name) +{ + bhnd_nvram_plist_entry *entry; + + /* Fetch entry */ + entry = bhnd_nvram_plist_get_entry(plist, name); + if (entry == NULL) + return; + + /* Remove from entry list and hash table */ + TAILQ_REMOVE(&plist->entries, entry, pl_link); + LIST_REMOVE(entry, pl_hash_link); + + /* Free plist entry */ + bhnd_nvram_prop_release(entry->prop); + bhnd_nv_free(entry); + + /* Decrement entry count */ + BHND_NV_ASSERT(plist->num_entries > 0, ("entry count over-release")); + plist->num_entries--; +} + +/** + * Fetch the property list entry for @p name, if any. + * + * @param plist The property list to be queried. + * @param name The property name to be queried. + * + * @retval non-NULL if @p name is found. + * @retval NULL if @p name is not found. + */ +static bhnd_nvram_plist_entry * +bhnd_nvram_plist_get_entry(bhnd_nvram_plist *plist, const char *name) +{ + bhnd_nvram_plist_entry_list *hash_list; + bhnd_nvram_plist_entry *entry; + uint32_t h; + + h = hash32_str(name, HASHINIT); + hash_list = &plist->names[h % nitems(plist->names)]; + + LIST_FOREACH(entry, hash_list, pl_hash_link) { + if (strcmp(entry->prop->name, name) == 0) + return (entry); + }; + + /* Not found */ + return (NULL); +} + +/** + * Append all properties from @p tail to @p plist. + * + * @param plist The property list to be modified. + * @param tail The property list to append. + * + * @retval 0 success + * @retval ENOMEM if allocation fails. + * @retval EEXIST an existing property from @p tail was found in @p plist. + */ +int +bhnd_nvram_plist_append_list(bhnd_nvram_plist *plist, bhnd_nvram_plist *tail) +{ + bhnd_nvram_prop *p; + int error; + + p = NULL; + while ((p = bhnd_nvram_plist_next(tail, p)) != NULL) { + if ((error = bhnd_nvram_plist_append(plist, p))) + return (error); + } + + return (0); +} + +/** + * Append @p prop to @p plist. + * + * @param plist The property list to be modified. + * @param prop The property to append. + * + * @retval 0 success + * @retval ENOMEM if allocation fails. + * @retval EEXIST an existing property with @p name was found in @p plist. + */ +int +bhnd_nvram_plist_append(bhnd_nvram_plist *plist, bhnd_nvram_prop *prop) +{ + bhnd_nvram_plist_entry_list *hash_list; + bhnd_nvram_plist_entry *entry; + uint32_t h; + + if (bhnd_nvram_plist_contains(plist, prop->name)) + return (EEXIST); + + /* Have we hit the maximum representable entry count? */ + if (plist->num_entries == SIZE_MAX) + return (ENOMEM); + + /* Allocate new entry */ + entry = bhnd_nv_malloc(sizeof(*entry)); + if (entry == NULL) + return (ENOMEM); + + entry->prop = bhnd_nvram_prop_retain(prop); + + /* Append to entry list */ + TAILQ_INSERT_TAIL(&plist->entries, entry, pl_link); + + /* Add to name-based hash table */ + h = hash32_str(prop->name, HASHINIT); + hash_list = &plist->names[h % nitems(plist->names)]; + LIST_INSERT_HEAD(hash_list, entry, pl_hash_link); + + /* Increment entry count */ + plist->num_entries++; + + return (0); +} + +/** + * Append a new property to @p plist with @p name and @p val. + * + * @param plist The property list to be modified. + * @param name The name of the property to be appended. + * @param val The value of the property to be appended. + * + * @retval 0 success + * @retval ENOMEM if allocation fails. + * @retval EEXIST an existing property with @p name was found in @p plist. + */ +int +bhnd_nvram_plist_append_val(bhnd_nvram_plist *plist, const char *name, + bhnd_nvram_val *val) +{ + bhnd_nvram_prop *prop; + int error; + + if ((prop = bhnd_nvram_prop_new(name, val)) == NULL) + return (ENOMEM); + + error = bhnd_nvram_plist_append(plist, prop); + bhnd_nvram_prop_release(prop); + + return (error); +} + +/** + * Append a new property to @p plist, copying the property value from the + * given @p inp buffer of @p itype and @p ilen. + * + * @param plist The property list to be modified. + * @param name The name of the property to be appended. + * @param inp Input buffer. + * @param ilen Input buffer length. + * @param itype Input buffer type. + * + * @retval 0 success + * @retval ENOMEM if allocation fails. + * @retval EEXIST an existing property with @p name was found in @p plist. + */ +int +bhnd_nvram_plist_append_bytes(bhnd_nvram_plist *plist, const char *name, + const void *inp, size_t ilen, bhnd_nvram_type itype) +{ + bhnd_nvram_prop *prop; + int error; + + if ((prop = bhnd_nvram_prop_bytes_new(name, inp, ilen, itype)) == NULL) + return (ENOMEM); + + error = bhnd_nvram_plist_append(plist, prop); + bhnd_nvram_prop_release(prop); + + return (error); +} + +/** + * Append a new string property to @p plist, copying the property value from + * @p val. + * + * @param plist The property list to be modified. + * @param name The name of the property to be appended. + * @param val The new property's string value. + * + * @retval 0 success + * @retval ENOMEM if allocation fails. + * @retval EEXIST an existing property with @p name was found in @p plist. + */ +int +bhnd_nvram_plist_append_string(bhnd_nvram_plist *plist, const char *name, + const char *val) +{ + return (bhnd_nvram_plist_append_bytes(plist, name, val, strlen(val)+1, + BHND_NVRAM_TYPE_STRING)); +} + +/** + * Iterate over all properties in @p plist. + * + * @param plist The property list to be iterated. + * @param prop A property in @p plist, or NULL to return the first + * property in @p plist. + * + * @retval non-NULL A borrowed reference to the next property in @p plist. + * @retval NULL If the end of the property list is reached or @p prop + * is not found in @p plist. + */ +bhnd_nvram_prop * +bhnd_nvram_plist_next(bhnd_nvram_plist *plist, bhnd_nvram_prop *prop) +{ + bhnd_nvram_plist_entry *entry; + + if (prop == NULL) { + if ((entry = TAILQ_FIRST(&plist->entries)) == NULL) + return (NULL); + + return (entry->prop); + } + + /* Look up previous property entry by name */ + if ((entry = bhnd_nvram_plist_get_entry(plist, prop->name)) == NULL) + return (NULL); + + /* The property instance must be identical */ + if (entry->prop != prop) + return (NULL); + + /* Fetch next entry */ + if ((entry = TAILQ_NEXT(entry, pl_link)) == NULL) + return (NULL); + + return (entry->prop); +} + +/** + * Return a borrowed reference to a named property, or NULL if @p name is + * not found in @p plist. + * + * @param plist The property list to be queried. + * @param name The name of the property to be returned. + * + * @retval non-NULL if @p name is found. + * @retval NULL if @p name is not found. + */ +bhnd_nvram_prop * +bhnd_nvram_plist_get_prop(bhnd_nvram_plist *plist, const char *name) +{ + bhnd_nvram_plist_entry *entry; + + if ((entry = bhnd_nvram_plist_get_entry(plist, name)) == NULL) + return (NULL); + + return (entry->prop); +} + +/** + * Return a borrowed reference to the named property's value, or NULL if + * @p name is not found in @p plist. + * + * @param plist The property list to be queried. + * @param name The name of the property to be returned. + * + * @retval non-NULL if @p name is found. + * @retval NULL if @p name is not found. + */ +bhnd_nvram_val * +bhnd_nvram_plist_get_val(bhnd_nvram_plist *plist, const char *name) +{ + bhnd_nvram_prop *prop; + + if ((prop = bhnd_nvram_plist_get_prop(plist, name)) == NULL) + return (NULL); + + return (bhnd_nvram_prop_val(prop)); +} + +/** + * Attempt to encode a named property's value as @p otype, writing the result + * to @p outp. + * + * @param plist The property list to be queried. + * @param name The name of the property value to be returned. + * @param[out] outp On success, the value will be written to this + * buffer. This argment may be NULL if the value is + * not desired. + * @param[in,out] olen The capacity of @p outp. On success, will be set + * to the actual size of the requested value. + * @param otype The data type to be written to @p outp. + * + * @retval 0 success + * @retval ENOENT If @p name is not found in @p plist. + * @retval ENOMEM If the @p outp is non-NULL, and the provided @p olen + * is too small to hold the encoded value. + * @retval EFTYPE If value coercion from @p prop to @p otype is + * impossible. + * @retval ERANGE If value coercion would overflow (or underflow) the + * a @p otype representation. + */ +int +bhnd_nvram_plist_get_encoded(bhnd_nvram_plist *plist, const char *name, + void *outp, size_t olen, bhnd_nvram_type otype) +{ + bhnd_nvram_prop *prop; + + if ((prop = bhnd_nvram_plist_get_prop(plist, name)) == NULL) + return (ENOENT); + + return (bhnd_nvram_prop_encode(prop, outp, &olen, otype)); +} + +/** + * Return the character representation of a named property's value. + * + * @param plist The property list to be queried. + * @param name The name of the property value to be returned. + * @param[out] val On success, the character value of @p name. + * + * @retval 0 success + * @retval ENOENT If @p name is not found in @p plist. + * @retval EFTYPE If coercion of the property's value to @p val. + * @retval ERANGE If coercion of the property's value would overflow + * (or underflow) @p val. + */ +int +bhnd_nvram_plist_get_char(bhnd_nvram_plist *plist, const char *name, + u_char *val) +{ + return (bhnd_nvram_plist_get_encoded(plist, name, val, sizeof(*val), + BHND_NVRAM_TYPE_CHAR)); +} + +/** + * Return the uint8 representation of a named property's value. + * + * @param plist The property list to be queried. + * @param name The name of the property value to be returned. + * @param[out] val On success, the uint8 value of @p name. + * + * @retval 0 success + * @retval ENOENT If @p name is not found in @p plist. + * @retval EFTYPE If coercion of the property's value to @p val. + * @retval ERANGE If coercion of the property's value would overflow + * (or underflow) @p val. + */ +int +bhnd_nvram_plist_get_uint8(bhnd_nvram_plist *plist, const char *name, + uint8_t *val) +{ + return (bhnd_nvram_plist_get_encoded(plist, name, val, sizeof(*val), + BHND_NVRAM_TYPE_UINT8)); +} + +/** + * Return the uint16 representation of a named property's value. + * + * @param plist The property list to be queried. + * @param name The name of the property value to be returned. + * @param[out] val On success, the uint16 value of @p name. + * + * @retval 0 success + * @retval ENOENT If @p name is not found in @p plist. + * @retval EFTYPE If coercion of the property's value to @p val. + * @retval ERANGE If coercion of the property's value would overflow + * (or underflow) @p val. + */ +int +bhnd_nvram_plist_get_uint16(bhnd_nvram_plist *plist, const char *name, + uint16_t *val) +{ + return (bhnd_nvram_plist_get_encoded(plist, name, val, sizeof(*val), + BHND_NVRAM_TYPE_UINT16)); +} + +/** + * Return the uint32 representation of a named property's value. + * + * @param plist The property list to be queried. + * @param name The name of the property value to be returned. + * @param[out] val On success, the uint32 value of @p name. + * + * @retval 0 success + * @retval ENOENT If @p name is not found in @p plist. + * @retval EFTYPE If coercion of the property's value to @p val. + * @retval ERANGE If coercion of the property's value would overflow + * (or underflow) @p val. + */ +int +bhnd_nvram_plist_get_uint32(bhnd_nvram_plist *plist, const char *name, + uint32_t *val) +{ + return (bhnd_nvram_plist_get_encoded(plist, name, val, sizeof(*val), + BHND_NVRAM_TYPE_UINT32)); +} + +/** + * Return the uint64 representation of a named property's value. + * + * @param plist The property list to be queried. + * @param name The name of the property value to be returned. + * @param[out] val On success, the uint64 value of @p name. + * + * @retval 0 success + * @retval ENOENT If @p name is not found in @p plist. + * @retval EFTYPE If coercion of the property's value to @p val. + * @retval ERANGE If coercion of the property's value would overflow + * (or underflow) @p val. + */ +int +bhnd_nvram_plist_get_uint64(bhnd_nvram_plist *plist, const char *name, + uint64_t *val) +{ + return (bhnd_nvram_plist_get_encoded(plist, name, val, sizeof(*val), + BHND_NVRAM_TYPE_UINT64)); +} + +/** + * Allocate and initialize a new property value. + * + * The caller is responsible for releasing the returned property value + * via bhnd_nvram_prop_release(). + * + * @param name Property name. + * @param val Property value. + * + * @retval non-NULL success + * @retval NULL if allocation fails. + */ +struct bhnd_nvram_prop * +bhnd_nvram_prop_new(const char *name, bhnd_nvram_val *val) +{ + struct bhnd_nvram_prop *prop; + + prop = bhnd_nv_calloc(1, sizeof(*prop)); + if (prop == NULL) + return NULL; + + /* Implicit caller-owned reference */ + prop->refs = 1; + + if ((prop->name = bhnd_nv_strdup(name)) == NULL) + goto failed; + + if ((prop->val = bhnd_nvram_val_copy(val)) == NULL) + goto failed; + + return (prop); + +failed: + if (prop->name != NULL) + bhnd_nv_free(prop->name); + + if (prop->val != NULL) + bhnd_nvram_val_release(prop->val); + + bhnd_nv_free(prop); + return (NULL); +} + +/** + * Allocate a new property value and attempt to initialize its value from + * the given @p inp buffer of @p itype and @p ilen. + * + * The caller is responsible for releasing the returned property value + * via bhnd_nvram_prop_release(). + * + * @param name Property name. + * @param inp Input buffer. + * @param ilen Input buffer length. + * @param itype Input buffer type. + * + * @retval non-NULL success + * @retval NULL if allocation or initialization fails. + */ +bhnd_nvram_prop * +bhnd_nvram_prop_bytes_new(const char *name, const void *inp, size_t ilen, + bhnd_nvram_type itype) +{ + bhnd_nvram_prop *prop; + bhnd_nvram_val *val; + int error; + + /* Construct new value instance */ + error = bhnd_nvram_val_new(&val, NULL, inp, ilen, itype, + BHND_NVRAM_VAL_DYNAMIC); + if (error) { + if (error != ENOMEM) { + BHND_NV_LOG("invalid input data; initialization " + "failed: %d\n", error); + } + + return (NULL); + } + + /* Delegate to default implementation */ + prop = bhnd_nvram_prop_new(name, val); + + /* Clean up */ + bhnd_nvram_val_release(val); + return (prop); +} + +/** + * Retain a reference and return @p prop to the caller. + * + * The caller is responsible for releasing their reference ownership via + * bhnd_nvram_prop_release(). + * + * @param prop The property to be retained. + */ +bhnd_nvram_prop * +bhnd_nvram_prop_retain(bhnd_nvram_prop *prop) +{ + BHND_NV_ASSERT(prop->refs >= 1, ("prop over-released")); + + refcount_acquire(&prop->refs); + return (prop); +} + +/** + * Release a reference to @p prop. + * + * If this is the last reference, all associated resources will be freed. + * + * @param prop The property to be released. + */ +void +bhnd_nvram_prop_release(bhnd_nvram_prop *prop) +{ + BHND_NV_ASSERT(prop->refs >= 1, ("prop over-released")); + + /* Drop reference */ + if (!refcount_release(&prop->refs)) + return; + + /* Free property data */ + bhnd_nvram_val_release(prop->val); + bhnd_nv_free(prop->name); + bhnd_nv_free(prop); +} + +/** + * Return a borrowed reference to the property's name. + * + * @param prop The property to query. + */ +const char * +bhnd_nvram_prop_name(bhnd_nvram_prop *prop) +{ + return (prop->name); +} + +/** + * Return a borrowed reference to the property's value. + * + * @param prop The property to query. + */ +bhnd_nvram_val * +bhnd_nvram_prop_val(bhnd_nvram_prop *prop) +{ + return (prop->val); +} + +/** + * Return the property's value type. + * + * @param prop The property to query. + */ +bhnd_nvram_type +bhnd_nvram_prop_type(bhnd_nvram_prop *prop) +{ + return (bhnd_nvram_val_type(prop->val)); +} + +/** + * Return a borrowed reference to the property's internal value representation. + * + * @param prop The property to query. + * @param[out] olen The returned data's size, in bytes. + * @param[out] otype The returned data's type. + */ +const void * +bhnd_nvram_prop_bytes(bhnd_nvram_prop *prop, size_t *olen, + bhnd_nvram_type *otype) +{ + const void *bytes; + + bytes = bhnd_nvram_val_bytes(prop->val, olen, otype); + BHND_NV_ASSERT(*otype == bhnd_nvram_prop_type(prop), ("type mismatch")); + + return (bytes); +} + +/** + * Attempt to encode the property's value as @p otype, writing the result + * to @p outp. + * + * @param prop The property to be encoded. + * @param[out] outp On success, the value will be written to this + * buffer. This argment may be NULL if the value is + * not desired. + * @param[in,out] olen The capacity of @p outp. On success, will be set + * to the actual size of the requested value. + * @param otype The data type to be written to @p outp. + * + * @retval 0 success + * @retval ENOMEM If the @p outp is non-NULL, and the provided @p olen + * is too small to hold the encoded value. + * @retval EFTYPE If value coercion from @p prop to @p otype is + * impossible. + * @retval ERANGE If value coercion would overflow (or underflow) the + * a @p otype representation. + */ +int +bhnd_nvram_prop_encode(bhnd_nvram_prop *prop, void *outp, size_t *olen, + bhnd_nvram_type otype) +{ + return (bhnd_nvram_val_encode(prop->val, outp, olen, otype)); +} Added: head/sys/dev/bhnd/nvram/bhnd_nvram_plist.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/dev/bhnd/nvram/bhnd_nvram_plist.h Mon Dec 19 20:11:48 2016 (r310291) @@ -0,0 +1,126 @@ +/*- + * Copyright (c) 2015-2016 Landon Fuller + * 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, + * without modification. + * 2. Redistributions in binary form must reproduce at minimum a disclaimer + * similar to the "NO WARRANTY" disclaimer below ("Disclaimer") and any + * redistribution must be conditioned upon including a substantially + * similar Disclaimer requirement for further binary redistribution. + * + * NO WARRANTY + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF NONINFRINGEMENT, MERCHANTIBILITY + * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL + * THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR 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 DAMAGES. + * + * $FreeBSD$ + */ + +#ifndef _BHND_NVRAM_BHND_NVRAM_PLIST_H_ +#define _BHND_NVRAM_BHND_NVRAM_PLIST_H_ + +#ifdef _KERNEL +#include +#else /* !_KERNEL */ *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@freebsd.org Mon Dec 19 20:20:35 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D4CF7C885D4; Mon, 19 Dec 2016 20:20:35 +0000 (UTC) (envelope-from landonf@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 9CED911A7; Mon, 19 Dec 2016 20:20:35 +0000 (UTC) (envelope-from landonf@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBJKKYT1052386; Mon, 19 Dec 2016 20:20:34 GMT (envelope-from landonf@FreeBSD.org) Received: (from landonf@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBJKKY0O052377; Mon, 19 Dec 2016 20:20:34 GMT (envelope-from landonf@FreeBSD.org) Message-Id: <201612192020.uBJKKY0O052377@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: landonf set sender to landonf@FreeBSD.org using -f From: "Landon J. Fuller" Date: Mon, 19 Dec 2016 20:20:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310292 - in head/sys: conf dev/bhnd/nvram modules/bhnd X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Dec 2016 20:20:35 -0000 Author: landonf Date: Mon Dec 19 20:20:33 2016 New Revision: 310292 URL: https://svnweb.freebsd.org/changeset/base/310292 Log: bhnd(4): support direct conversion of bhnd_nvram_val This adds support for bhnd_nvram_val_convert_init() and bhnd_nvram_val_convert_new(), which may be used to perform value format-aware encoding of an NVRAM value to a new target format/type. This will be used to simplify converting to/from serialized format-specific NVRAM value representations to common external representations. Approved by: adrian (mentor) Differential Revision: https://reviews.freebsd.org/D8757 Added: head/sys/dev/bhnd/nvram/bhnd_nvram_value_subr.c (contents, props changed) Modified: head/sys/conf/files head/sys/dev/bhnd/nvram/bhnd_nvram.h head/sys/dev/bhnd/nvram/bhnd_nvram_data_bcm.c head/sys/dev/bhnd/nvram/bhnd_nvram_data_sprom.c head/sys/dev/bhnd/nvram/bhnd_nvram_private.h head/sys/dev/bhnd/nvram/bhnd_nvram_store.c head/sys/dev/bhnd/nvram/bhnd_nvram_subr.c head/sys/dev/bhnd/nvram/bhnd_nvram_value.c head/sys/dev/bhnd/nvram/bhnd_nvram_value.h head/sys/dev/bhnd/nvram/bhnd_nvram_value_fmts.c head/sys/dev/bhnd/nvram/bhnd_nvram_value_prf.c head/sys/dev/bhnd/nvram/bhnd_nvram_valuevar.h head/sys/modules/bhnd/Makefile Modified: head/sys/conf/files ============================================================================== --- head/sys/conf/files Mon Dec 19 20:11:48 2016 (r310291) +++ head/sys/conf/files Mon Dec 19 20:20:33 2016 (r310292) @@ -1247,6 +1247,7 @@ dev/bhnd/nvram/bhnd_nvram_subr.c optiona dev/bhnd/nvram/bhnd_nvram_value.c optional bhnd dev/bhnd/nvram/bhnd_nvram_value_fmts.c optional bhnd dev/bhnd/nvram/bhnd_nvram_value_prf.c optional bhnd +dev/bhnd/nvram/bhnd_nvram_value_subr.c optional bhnd dev/bhnd/nvram/bhnd_sprom.c optional bhnd dev/bhnd/siba/siba.c optional siba bhnd dev/bhnd/siba/siba_bhndb.c optional siba bhnd bhndb Modified: head/sys/dev/bhnd/nvram/bhnd_nvram.h ============================================================================== --- head/sys/dev/bhnd/nvram/bhnd_nvram.h Mon Dec 19 20:11:48 2016 (r310291) +++ head/sys/dev/bhnd/nvram/bhnd_nvram.h Mon Dec 19 20:20:33 2016 (r310292) @@ -111,14 +111,16 @@ typedef enum { NUL-terminated strings */ } bhnd_nvram_type; -const char *bhnd_nvram_string_array_next(const char *inp, size_t ilen, - const char *prev); - bool bhnd_nvram_is_signed_type(bhnd_nvram_type type); bool bhnd_nvram_is_unsigned_type(bhnd_nvram_type type); bool bhnd_nvram_is_int_type(bhnd_nvram_type type); bool bhnd_nvram_is_array_type(bhnd_nvram_type type); bhnd_nvram_type bhnd_nvram_base_type(bhnd_nvram_type type); const char *bhnd_nvram_type_name(bhnd_nvram_type type); +size_t bhnd_nvram_type_width(bhnd_nvram_type type); +size_t bhnd_nvram_type_host_align(bhnd_nvram_type type); + +const char *bhnd_nvram_string_array_next(const char *inp, size_t ilen, + const char *prev, size_t *olen); #endif /* _BHND_NVRAM_BHND_NVRAM_H_ */ Modified: head/sys/dev/bhnd/nvram/bhnd_nvram_data_bcm.c ============================================================================== --- head/sys/dev/bhnd/nvram/bhnd_nvram_data_bcm.c Mon Dec 19 20:11:48 2016 (r310291) +++ head/sys/dev/bhnd/nvram/bhnd_nvram_data_bcm.c Mon Dec 19 20:20:33 2016 (r310292) @@ -647,10 +647,8 @@ bhnd_nvram_bcm_getvar_ptr(struct bhnd_nv /* Handle header variables */ if ((hvar = bhnd_nvram_bcm_to_hdrvar(bcm, cookiep)) != NULL) { - BHND_NV_ASSERT( - hvar->len % bhnd_nvram_value_size(hvar->type, NULL, 0, - hvar->nelem) == 0, - ("length is not aligned to type width")); + BHND_NV_ASSERT(bhnd_nvram_value_check_aligned(&hvar->value, + hvar->len, hvar->type) == 0, ("value misaligned")); *type = hvar->type; *len = hvar->len; Modified: head/sys/dev/bhnd/nvram/bhnd_nvram_data_sprom.c ============================================================================== --- head/sys/dev/bhnd/nvram/bhnd_nvram_data_sprom.c Mon Dec 19 20:11:48 2016 (r310291) +++ head/sys/dev/bhnd/nvram/bhnd_nvram_data_sprom.c Mon Dec 19 20:20:33 2016 (r310292) @@ -597,7 +597,7 @@ bhnd_nvram_sprom_read_offset(struct bhnd } sp_value; /* Determine type width */ - sp_width = bhnd_nvram_value_size(type, NULL, 0, 1); + sp_width = bhnd_nvram_type_width(type); if (sp_width == 0) { /* Variable-width types are unsupported */ BHND_NV_LOG("invalid %s SPROM offset type %d\n", var->name, @@ -716,7 +716,7 @@ bhnd_nvram_sprom_getvar(struct bhnd_nvra var_btype = bhnd_nvram_base_type(var->type); /* Calculate total byte length of the native encoding */ - if ((iwidth = bhnd_nvram_value_size(var_btype, NULL, 0, 1)) == 0) { + if ((iwidth = bhnd_nvram_value_size(NULL, 0, var_btype, 1)) == 0) { /* SPROM does not use (and we do not support) decoding of * variable-width data types */ BHND_NV_LOG("invalid SPROM data type: %d", var->type); @@ -1219,7 +1219,7 @@ sprom_opcode_set_type(struct sprom_opcod } /* Fetch type width for use as our scale value */ - width = bhnd_nvram_value_size(type, NULL, 0, 1); + width = bhnd_nvram_type_width(type); if (width == 0) { SPROM_OP_BAD(state, "unsupported variable-width type: %d\n", type); Modified: head/sys/dev/bhnd/nvram/bhnd_nvram_private.h ============================================================================== --- head/sys/dev/bhnd/nvram/bhnd_nvram_private.h Mon Dec 19 20:11:48 2016 (r310291) +++ head/sys/dev/bhnd/nvram/bhnd_nvram_private.h Mon Dec 19 20:20:33 2016 (r310292) @@ -167,11 +167,15 @@ int bhnd_nvram_value_coerce(const vo void *outp, size_t *olen, bhnd_nvram_type otype); -int bhnd_nvram_value_nelem(bhnd_nvram_type type, - const void *data, size_t len, +int bhnd_nvram_value_check_aligned(const void *inp, + size_t ilen, bhnd_nvram_type itype); + +int bhnd_nvram_value_nelem(const void *inp, + size_t ilen, bhnd_nvram_type itype, size_t *nelem); -size_t bhnd_nvram_value_size(bhnd_nvram_type type, - const void *data, size_t nbytes, + +size_t bhnd_nvram_value_size(const void *inp, + size_t ilen, bhnd_nvram_type itype, size_t nelem); int bhnd_nvram_value_printf(const char *fmt, @@ -183,6 +187,10 @@ int bhnd_nvram_value_vprintf(const c bhnd_nvram_type itype, char *outp, size_t *olen, va_list ap); +const void *bhnd_nvram_value_array_next(const void *inp, + size_t ilen, bhnd_nvram_type itype, + const void *prev, size_t *olen); + const struct bhnd_nvram_vardefn *bhnd_nvram_find_vardefn(const char *varname); const struct bhnd_nvram_vardefn *bhnd_nvram_get_vardefn(size_t id); size_t bhnd_nvram_get_vardefn_id( Modified: head/sys/dev/bhnd/nvram/bhnd_nvram_store.c ============================================================================== --- head/sys/dev/bhnd/nvram/bhnd_nvram_store.c Mon Dec 19 20:11:48 2016 (r310291) +++ head/sys/dev/bhnd/nvram/bhnd_nvram_store.c Mon Dec 19 20:20:33 2016 (r310292) @@ -288,7 +288,7 @@ bhnd_nvram_store_setvar(struct bhnd_nvra /* Verify buffer size alignment for the given type. If this is a * variable width type, a width of 0 will always pass this check */ - if (len % bhnd_nvram_value_size(type, buf, len, 1) != 0) + if (len % bhnd_nvram_value_size(buf, len, type, 1) != 0) return (EINVAL); /* Determine string format (or directly add variable, if a C string) */ Modified: head/sys/dev/bhnd/nvram/bhnd_nvram_subr.c ============================================================================== --- head/sys/dev/bhnd/nvram/bhnd_nvram_subr.c Mon Dec 19 20:11:48 2016 (r310291) +++ head/sys/dev/bhnd/nvram/bhnd_nvram_subr.c Mon Dec 19 20:20:33 2016 (r310292) @@ -71,12 +71,6 @@ __FBSDID("$FreeBSD$"); MALLOC_DEFINE(M_BHND_NVRAM, "bhnd_nvram", "bhnd nvram data"); #endif -/** signed/unsigned 32-bit integer value storage */ -union bhnd_nvram_int_storage { - uint32_t u32; - int32_t s32; -}; - /* * CRC-8 lookup table used to checksum SPROM and NVRAM data via * bhnd_nvram_crc8(). @@ -343,112 +337,44 @@ bhnd_nvram_base_type(bhnd_nvram_type typ } /** - * Calculate the number of elements represented by a value of @p len bytes - * with @p type. - * - * @param type The value type. - * @param data The actual data to be queried, or NULL if unknown. - * @param len The length in bytes of @p data, or if @p data is NULL, - * the expected length in bytes. - * @param[out] nelem On success, the number of elements. If @p type is not - * a fixed width type (e.g. BHND_NVRAM_TYPE_STRING_ARRAY), - * and @p data is NULL, an @p nelem value of 0 will be - * returned. - * - * @retval 0 success - * @retval EFTYPE if @p type is not an array type, and @p len is not - * equal to the size of a single element of @p type. - * @retval EFAULT if @p len is not correctly aligned for elements of - * @p type. + * Return the size, in bytes, of a single element of @p type, or 0 + * if @p type is a variable-width type. + * + * @param type The type to query. */ -int -bhnd_nvram_value_nelem(bhnd_nvram_type type, const void *data, size_t len, - size_t *nelem) +size_t +bhnd_nvram_type_width(bhnd_nvram_type type) { - bhnd_nvram_type base_type; - size_t base_size; - - /* Length must be aligned to the element size */ - base_type = bhnd_nvram_base_type(type); - base_size = bhnd_nvram_value_size(base_type, NULL, 0, 1); - if (base_size != 0 && len % base_size != 0) - return (EFAULT); - switch (type) { case BHND_NVRAM_TYPE_STRING: - case BHND_NVRAM_TYPE_STRING_ARRAY: { - const char *p; - size_t nleft; - - /* Cannot determine the element count without parsing - * the actual data */ - if (data == NULL) { - *nelem = 0; - return (0); - } - - /* Iterate over the NUL-terminated strings to calculate - * total element count */ - p = data; - nleft = len; - *nelem = 0; - while (nleft > 0) { - size_t slen; - - /* Increment element count */ - (*nelem)++; - - /* If not a string array, data must not contain more - * than one entry. */ - if (!bhnd_nvram_is_array_type(type) && *nelem > 1) - return (EFTYPE); - - /* Determine string length */ - slen = strnlen(p, nleft); - nleft -= slen; - - /* Advance input */ - p += slen; - - /* Account for trailing NUL, if we haven't hit the end - * of the input */ - if (nleft > 0) { - nleft--; - p++; - } - } - - return (0); - } - case BHND_NVRAM_TYPE_INT8: - case BHND_NVRAM_TYPE_UINT8: - case BHND_NVRAM_TYPE_CHAR: - case BHND_NVRAM_TYPE_INT16: - case BHND_NVRAM_TYPE_UINT16: - case BHND_NVRAM_TYPE_INT32: - case BHND_NVRAM_TYPE_UINT32: - case BHND_NVRAM_TYPE_INT64: - case BHND_NVRAM_TYPE_UINT64: - /* Length must be equal to the size of exactly one - * element (arrays can represent zero elements -- non-array - * types cannot) */ - if (len != base_size) - return (EFTYPE); - *nelem = 1; + case BHND_NVRAM_TYPE_STRING_ARRAY: return (0); + case BHND_NVRAM_TYPE_CHAR: + case BHND_NVRAM_TYPE_CHAR_ARRAY: + case BHND_NVRAM_TYPE_UINT8: case BHND_NVRAM_TYPE_UINT8_ARRAY: - case BHND_NVRAM_TYPE_UINT16_ARRAY: - case BHND_NVRAM_TYPE_UINT32_ARRAY: - case BHND_NVRAM_TYPE_UINT64_ARRAY: + case BHND_NVRAM_TYPE_INT8: case BHND_NVRAM_TYPE_INT8_ARRAY: + return (sizeof(uint8_t)); + + case BHND_NVRAM_TYPE_UINT16: + case BHND_NVRAM_TYPE_UINT16_ARRAY: + case BHND_NVRAM_TYPE_INT16: case BHND_NVRAM_TYPE_INT16_ARRAY: + return (sizeof(uint16_t)); + + case BHND_NVRAM_TYPE_UINT32: + case BHND_NVRAM_TYPE_UINT32_ARRAY: + case BHND_NVRAM_TYPE_INT32: case BHND_NVRAM_TYPE_INT32_ARRAY: + return (sizeof(uint32_t)); + + case BHND_NVRAM_TYPE_UINT64: + case BHND_NVRAM_TYPE_UINT64_ARRAY: + case BHND_NVRAM_TYPE_INT64: case BHND_NVRAM_TYPE_INT64_ARRAY: - case BHND_NVRAM_TYPE_CHAR_ARRAY: - BHND_NV_ASSERT(base_size != 0, ("invalid base size")); - *nelem = len / base_size; - return (0); + return (sizeof(uint64_t)); } /* Quiesce gcc4.2 */ @@ -456,130 +382,43 @@ bhnd_nvram_value_nelem(bhnd_nvram_type t } /** - * Return the size, in bytes, of a value of @p type with @p nelem elements. + * Return the native host alignment for values of @p type. * - * @param type The value type. - * @param data The actual data to be queried, or NULL if unknown. If - * NULL and the base type is not a fixed width type - * (e.g. BHND_NVRAM_TYPE_STRING), 0 will be returned. - * @param nbytes The size of @p data, in bytes, or 0 if @p data is NULL. - * @param nelem The number of elements. If @p type is not an array type, - * this value must be 1. - * - * @retval 0 If @p type has a variable width, and @p data is NULL. - * @retval 0 If a @p nelem value greater than 1 is provided for a - * non-array @p type. - * @retval 0 If a @p nelem value of 0 is provided. - * @retval 0 If the result would exceed the maximum value - * representable by size_t. - * @retval non-zero The size, in bytes, of @p type with @p nelem elements. + * @param type The type to query. */ size_t -bhnd_nvram_value_size(bhnd_nvram_type type, const void *data, size_t nbytes, - size_t nelem) +bhnd_nvram_type_host_align(bhnd_nvram_type type) { - /* If nelem 0, nothing to do */ - if (nelem == 0) - return (0); - - /* Non-array types must have an nelem value of 1 */ - if (!bhnd_nvram_is_array_type(type) && nelem != 1) - return (0); - switch (type) { + case BHND_NVRAM_TYPE_CHAR: + case BHND_NVRAM_TYPE_CHAR_ARRAY: + case BHND_NVRAM_TYPE_STRING: + case BHND_NVRAM_TYPE_STRING_ARRAY: + return (_Alignof(uint8_t)); + case BHND_NVRAM_TYPE_UINT8: case BHND_NVRAM_TYPE_UINT8_ARRAY: + return (_Alignof(uint8_t)); + case BHND_NVRAM_TYPE_UINT16: case BHND_NVRAM_TYPE_UINT16_ARRAY: + return (_Alignof(uint16_t)); + case BHND_NVRAM_TYPE_UINT32: case BHND_NVRAM_TYPE_UINT32_ARRAY: + return (_Alignof(uint32_t)); + case BHND_NVRAM_TYPE_UINT64: case BHND_NVRAM_TYPE_UINT64_ARRAY: - case BHND_NVRAM_TYPE_INT8_ARRAY: - case BHND_NVRAM_TYPE_INT16_ARRAY: - case BHND_NVRAM_TYPE_INT32_ARRAY: - case BHND_NVRAM_TYPE_INT64_ARRAY: - case BHND_NVRAM_TYPE_CHAR_ARRAY: { - bhnd_nvram_type base_type; - size_t base_size; - - base_type = bhnd_nvram_base_type(type); - base_size = bhnd_nvram_value_size(base_type, NULL, 0, 1); - - /* Would nelem * base_size overflow? */ - if (SIZE_MAX / nelem < base_size) { - BHND_NV_LOG("cannot represent size %s * %zu\n", - bhnd_nvram_type_name(base_type), nelem); - return (0); - } - - return (nelem * base_size); - } - - case BHND_NVRAM_TYPE_STRING_ARRAY: { - const char *p; - size_t total_size; - - if (data == NULL) - return (0); - - /* Iterate over the NUL-terminated strings to calculate - * total byte length */ - p = data; - total_size = 0; - for (size_t i = 0; i < nelem; i++) { - size_t elem_size; - - elem_size = strnlen(p, nbytes - total_size); - p += elem_size; - - /* Check for (and skip) terminating NUL */ - if (total_size < nbytes && *p == '\0') { - elem_size++; - p++; - } - - /* Would total_size + elem_size overflow? - * - * A memory range larger than SIZE_MAX shouldn't be, - * possible, but include the check for completeness */ - if (SIZE_MAX - total_size < elem_size) - return (0); - - total_size += elem_size; - } - - return (total_size); - } - - case BHND_NVRAM_TYPE_STRING: { - size_t size; - - if (data == NULL) - return (0); - - /* Find length */ - size = strnlen(data, nbytes); - - /* Is there a terminating NUL, or did we just hit the - * end of the string input */ - if (size < nbytes) - size++; - - return (size); - } + return (_Alignof(uint64_t)); case BHND_NVRAM_TYPE_INT8: - case BHND_NVRAM_TYPE_UINT8: - case BHND_NVRAM_TYPE_CHAR: - return (sizeof(uint8_t)); - + case BHND_NVRAM_TYPE_INT8_ARRAY: + return (_Alignof(int8_t)); case BHND_NVRAM_TYPE_INT16: - case BHND_NVRAM_TYPE_UINT16: - return (sizeof(uint16_t)); - + case BHND_NVRAM_TYPE_INT16_ARRAY: + return (_Alignof(int16_t)); case BHND_NVRAM_TYPE_INT32: - case BHND_NVRAM_TYPE_UINT32: - return (sizeof(uint32_t)); - - case BHND_NVRAM_TYPE_UINT64: + case BHND_NVRAM_TYPE_INT32_ARRAY: + return (_Alignof(int32_t)); case BHND_NVRAM_TYPE_INT64: - return (sizeof(uint64_t)); + case BHND_NVRAM_TYPE_INT64_ARRAY: + return (_Alignof(int64_t)); } /* Quiesce gcc4.2 */ @@ -587,132 +426,30 @@ bhnd_nvram_value_size(bhnd_nvram_type ty } /** - * Iterate over all strings in the @p inp string array. + * Iterate over all strings in the @p inp string array (@see + * BHNF_NVRAM_TYPE_STRING_ARRAY). * - * @param inp The string array to be iterated. This must be a buffer - * of one or more NUL-terminated strings -- - * @see BHND_NVRAM_TYPE_STRING_ARRAY. - * @param ilen The size, in bytes, of @p inp, including any - * terminating NUL character(s). - * @param prev The value previously returned by - * bhnd_nvram_string_array_next(), or NULL to begin - * iteration. + * @param inp The string array to be iterated. This must be a + * buffer of one or more NUL-terminated strings. + * @param ilen The size, in bytes, of @p inp, including any + * terminating NUL character(s). + * @param prev The pointer previously returned by + * bhnd_nvram_string_array_next(), or NULL to begin + * iteration. +* @param[in,out] olen If @p prev is non-NULL, @p olen must be a + * pointer to the length previously returned by + * bhnd_nvram_string_array_next(). On success, will + * be set to the next element's length, in bytes. * * @retval non-NULL A reference to the next NUL-terminated string * @retval NULL If the end of the string array is reached. */ const char * -bhnd_nvram_string_array_next(const char *inp, size_t ilen, const char *prev) +bhnd_nvram_string_array_next(const char *inp, size_t ilen, const char *prev, + size_t *olen) { - size_t nremain, plen; - - if (ilen == 0) - return (NULL); - - if (prev == NULL) - return (inp); - - /* Advance to next value */ - BHND_NV_ASSERT(prev >= inp, ("invalid prev pointer")); - BHND_NV_ASSERT(prev < (inp+ilen), ("invalid prev pointer")); - - nremain = ilen - (size_t)(prev - inp); - plen = strnlen(prev, nremain); - nremain -= plen; - - /* Only a trailing NUL remains? */ - if (nremain <= 1) - return (NULL); - - return (prev + plen + 1); -} - -/** - * Format a string representation of @p inp using @p fmt, with, writing the - * result to @p outp. - * - * Refer to bhnd_nvram_val_vprintf() for full format string documentation. - * - * @param fmt The format string. - * @param inp The value to be formatted. - * @param ilen The size of @p inp, in bytes. - * @param itype The type of @p inp. - * @param[out] outp On success, the string value will be written to - * this buffer. This argment may be NULL if the - * value is not desired. - * @param[in,out] olen The capacity of @p outp. On success, will be set - * to the actual size of the formatted string. - * - * @retval 0 success - * @retval EINVAL If @p fmt contains unrecognized format string - * specifiers. - * @retval ENOMEM If the @p outp is non-NULL, and the provided @p olen - * is too small to hold the encoded value. - * @retval EFTYPE If value coercion from @p inp to a string value via - * @p fmt is unsupported. - * @retval ERANGE If value coercion of @p value would overflow (or - * underflow) the representation defined by @p fmt. - */ -int -bhnd_nvram_value_printf(const char *fmt, const void *inp, size_t ilen, - bhnd_nvram_type itype, char *outp, size_t *olen, ...) -{ - va_list ap; - int error; - - va_start(ap, olen); - error = bhnd_nvram_value_vprintf(fmt, inp, ilen, itype, outp, olen, ap); - va_end(ap); - - return (error); -} - -/** - * Format a string representation of @p inp using @p fmt, with, writing the - * result to @p outp. - * - * Refer to bhnd_nvram_val_vprintf() for full format string documentation. - * - * @param fmt The format string. - * @param inp The value to be formatted. - * @param ilen The size of @p inp, in bytes. - * @param itype The type of @p inp. - * @param[out] outp On success, the string value will be written to - * this buffer. This argment may be NULL if the - * value is not desired. - * @param[in,out] olen The capacity of @p outp. On success, will be set - * to the actual size of the formatted string. - * @param ap Argument list. - * - * @retval 0 success - * @retval EINVAL If @p fmt contains unrecognized format string - * specifiers. - * @retval ENOMEM If the @p outp is non-NULL, and the provided @p olen - * is too small to hold the encoded value. - * @retval EFTYPE If value coercion from @p inp to a string value via - * @p fmt is unsupported. - * @retval ERANGE If value coercion of @p value would overflow (or - * underflow) the representation defined by @p fmt. - */ -int -bhnd_nvram_value_vprintf(const char *fmt, const void *inp, size_t ilen, - bhnd_nvram_type itype, char *outp, size_t *olen, va_list ap) -{ - bhnd_nvram_val val; - int error; - - /* Map input buffer as a value instance */ - error = bhnd_nvram_val_init(&val, NULL, inp, ilen, itype, - BHND_NVRAM_VAL_BORROW_DATA); - if (error) - return (error); - - /* Attempt to format the value */ - error = bhnd_nvram_val_vprintf(&val, fmt, outp, olen, ap); - - /* Clean up */ - bhnd_nvram_val_release(&val); - return (error); + return (bhnd_nvram_value_array_next(inp, ilen, + BHND_NVRAM_TYPE_STRING_ARRAY, prev, olen)); } /* used by bhnd_nvram_find_vardefn() */ @@ -825,47 +562,6 @@ bhnd_nvram_validate_name(const char *nam } /** - * Coerce value @p inp of type @p itype to @p otype, writing the - * result to @p outp. - * - * @param inp The value to be coerced. - * @param ilen The size of @p inp, in bytes. - * @param itype The base data type of @p inp. - * @param[out] outp On success, the value will be written to this - * buffer. This argment may be NULL if the value - * is not desired. - * @param[in,out] olen The capacity of @p outp. On success, will be set - * to the actual size of the requested value. - * @param otype The data type to be written to @p outp. - * - * @retval 0 success - * @retval ENOMEM If @p outp is non-NULL and a buffer of @p olen is too - * small to hold the requested value. - * @retval EFTYPE If the variable data cannot be coerced to @p otype. - * @retval ERANGE If value coercion would overflow @p otype. - */ -int -bhnd_nvram_value_coerce(const void *inp, size_t ilen, bhnd_nvram_type itype, - void *outp, size_t *olen, bhnd_nvram_type otype) -{ - bhnd_nvram_val val; - int error; - - /* Wrap input buffer in a value instance */ - error = bhnd_nvram_val_init(&val, NULL, inp, ilen, - itype, BHND_NVRAM_VAL_BORROW_DATA|BHND_NVRAM_VAL_FIXED); - if (error) - return (error); - - /* Try to encode as requested type */ - error = bhnd_nvram_val_encode(&val, outp, olen, otype); - - /* Clean up and return error */ - bhnd_nvram_val_release(&val); - return (error); -} - -/** * Parses the string in the optionally NUL-terminated @p str to as an integer * value of @p otype, accepting any integer format supported by the standard * strtoul(). @@ -1114,7 +810,7 @@ bhnd_nvram_parse_int(const char *str, si value = -value; /* Provide (and verify) required length */ - *olen = bhnd_nvram_value_size(otype, NULL, 0, 1); + *olen = bhnd_nvram_type_width(otype); if (outp == NULL) return (0); else if (limit < *olen) Modified: head/sys/dev/bhnd/nvram/bhnd_nvram_value.c ============================================================================== --- head/sys/dev/bhnd/nvram/bhnd_nvram_value.c Mon Dec 19 20:11:48 2016 (r310291) +++ head/sys/dev/bhnd/nvram/bhnd_nvram_value.c Mon Dec 19 20:20:33 2016 (r310292) @@ -35,6 +35,7 @@ __FBSDID("$FreeBSD$"); #ifdef _KERNEL +#include #include #include #include @@ -43,6 +44,7 @@ __FBSDID("$FreeBSD$"); #else /* !_KERNEL */ +#include #include #include #include @@ -54,6 +56,8 @@ __FBSDID("$FreeBSD$"); #include "bhnd_nvram_valuevar.h" +static int bhnd_nvram_val_fmt_filter(const bhnd_nvram_val_fmt **fmt, + const void *inp, size_t ilen, bhnd_nvram_type itype); static void *bhnd_nvram_val_alloc_bytes(bhnd_nvram_val *value, size_t ilen, bhnd_nvram_type itype, uint32_t flags); @@ -62,6 +66,15 @@ static int bhnd_nvram_val_set(bhnd_nvra static int bhnd_nvram_val_set_inline(bhnd_nvram_val *value, const void *inp, size_t ilen, bhnd_nvram_type itype); +static int bhnd_nvram_val_encode_int(const void *inp, size_t ilen, + bhnd_nvram_type itype, void *outp, size_t *olen, + bhnd_nvram_type otype); +static int bhnd_nvram_val_encode_string(const void *inp, size_t ilen, + bhnd_nvram_type itype, void *outp, size_t *olen, + bhnd_nvram_type otype); + +/** Initialize an empty value instance with @p _fmt, @p _storage, and + * an implicit callee-owned reference */ #define BHND_NVRAM_VAL_INITIALIZER(_fmt, _storage) \ (bhnd_nvram_val) { \ .refs = 1, \ @@ -80,6 +93,156 @@ static int bhnd_nvram_val_set_inline(bh value->data.ptr == NULL, \ ("previously initialized value")) +/** Return true if BHND_NVRAM_VAL_BORROW_DATA or BHND_NVRAM_VAL_STATIC_DATA is + * set in @p _flags (e.g. we should attempt to directly reference external + * data */ +#define BHND_NVRAM_VAL_EXTREF_BORROWED_DATA(_flags) \ + (((_flags) & BHND_NVRAM_VAL_BORROW_DATA) || \ + ((_flags) & BHND_NVRAM_VAL_STATIC_DATA)) + +/** Flags permitted when performing val-based initialization via + * bhnd_nvram_val_convert_init() or bhnd_nvram_val_convert_new() */ +#define BHND_NVRAM_VALID_CONV_FLAGS \ + (BHND_NVRAM_VAL_FIXED | \ + BHND_NVRAM_VAL_DYNAMIC | \ + BHND_NVRAM_VAL_COPY_DATA) + +/** Returns true if @p _val must be copied in bhnd_nvram_val_copy(), false + * if its reference count may be safely incremented */ +#define BHND_NVRAM_VAL_NEED_COPY(_val) \ + ((_val)->val_storage == BHND_NVRAM_VAL_STORAGE_AUTO || \ + (_val)->data_storage == BHND_NVRAM_VAL_DATA_EXT_WEAK) + +volatile u_int refs; /**< reference count */ +bhnd_nvram_val_storage val_storage; /**< value structure storage */ +const bhnd_nvram_val_fmt *fmt; /**< value format */ +bhnd_nvram_val_data_storage data_storage; /**< data storage */ +bhnd_nvram_type data_type; /**< data type */ +size_t data_len; /**< data size */ + +/** + * Return the human-readable name of @p fmt. + */ +const char * +bhnd_nvram_val_fmt_name(const bhnd_nvram_val_fmt *fmt) +{ + return (fmt->name); +} + +/** + * Return the default format for values of @p type. + */ +const bhnd_nvram_val_fmt * +bhnd_nvram_val_default_fmt(bhnd_nvram_type type) +{ + switch (type) { + case BHND_NVRAM_TYPE_UINT8: + return (&bhnd_nvram_val_uint8_fmt); + case BHND_NVRAM_TYPE_UINT16: + return (&bhnd_nvram_val_uint16_fmt); + case BHND_NVRAM_TYPE_UINT32: + return (&bhnd_nvram_val_uint32_fmt); + case BHND_NVRAM_TYPE_UINT64: + return (&bhnd_nvram_val_uint64_fmt); + case BHND_NVRAM_TYPE_INT8: + return (&bhnd_nvram_val_int8_fmt); + case BHND_NVRAM_TYPE_INT16: + return (&bhnd_nvram_val_int16_fmt); + case BHND_NVRAM_TYPE_INT32: + return (&bhnd_nvram_val_int32_fmt); + case BHND_NVRAM_TYPE_INT64: + return (&bhnd_nvram_val_int64_fmt); + case BHND_NVRAM_TYPE_CHAR: + return (&bhnd_nvram_val_char_fmt); + case BHND_NVRAM_TYPE_STRING: + return (&bhnd_nvram_val_string_fmt); + case BHND_NVRAM_TYPE_UINT8_ARRAY: + return (&bhnd_nvram_val_uint8_array_fmt); + case BHND_NVRAM_TYPE_UINT16_ARRAY: + return (&bhnd_nvram_val_uint16_array_fmt); + case BHND_NVRAM_TYPE_UINT32_ARRAY: + return (&bhnd_nvram_val_uint32_array_fmt); + case BHND_NVRAM_TYPE_UINT64_ARRAY: + return (&bhnd_nvram_val_uint64_array_fmt); + case BHND_NVRAM_TYPE_INT8_ARRAY: + return (&bhnd_nvram_val_int8_array_fmt); + case BHND_NVRAM_TYPE_INT16_ARRAY: + return (&bhnd_nvram_val_int16_array_fmt); + case BHND_NVRAM_TYPE_INT32_ARRAY: + return (&bhnd_nvram_val_int32_array_fmt); + case BHND_NVRAM_TYPE_INT64_ARRAY: + return (&bhnd_nvram_val_int64_array_fmt); + case BHND_NVRAM_TYPE_CHAR_ARRAY: + return (&bhnd_nvram_val_char_array_fmt); + case BHND_NVRAM_TYPE_STRING_ARRAY: + return (&bhnd_nvram_val_string_array_fmt); + } + + /* Quiesce gcc4.2 */ + BHND_NV_PANIC("bhnd nvram type %u unknown", type); +} + +/** + * Determine whether @p fmt (or new format delegated to by @p fmt) is + * capable of direct initialization from buffer @p inp. + * + * @param[in,out] fmt Indirect pointer to the NVRAM value format. If + * the format instance cannot handle the data type + * directly, it may delegate to a new format + * instance. On success, this parameter will be + * set to the format that should be used when + * performing initialization from @p inp. + * @param inp Input data. + * @param ilen Input data length. + * @param itype Input data type. + * + * @retval 0 If initialization from @p inp is supported. + * @retval EFTYPE If initialization from @p inp is unsupported. + * @retval EFAULT if @p ilen is not correctly aligned for elements of + * @p itype. + */ +static int +bhnd_nvram_val_fmt_filter(const bhnd_nvram_val_fmt **fmt, const void *inp, + size_t ilen, bhnd_nvram_type itype) +{ + const bhnd_nvram_val_fmt *ofmt, *nfmt; + int error; + + nfmt = ofmt = *fmt; + + /* Validate alignment */ + if ((error = bhnd_nvram_value_check_aligned(inp, ilen, itype))) + return (error); + + /* If the format does not provide a filter function, it only supports + * direct initialization from its native type */ + if (ofmt->op_filter == NULL) { + if (itype == ofmt->native_type) + return (0); + + return (EFTYPE); + } + + /* Use the filter function to determine whether direct initialization + * from itype is permitted */ + error = ofmt->op_filter(&nfmt, inp, ilen, itype); + if (error) + return (error); + + /* Retry filter with new format? */ + if (ofmt != nfmt) { + error = bhnd_nvram_val_fmt_filter(&nfmt, inp, ilen, itype); + if (error) + return (error); + + /* Success -- provide delegated format to caller */ + *fmt = nfmt; + } + + /* Value can be initialized with provided format and input type */ + return (0); +} + /* Common initialization support for bhnd_nvram_val_init() and * bhnd_nvram_val_new() */ static int @@ -92,35 +255,20 @@ bhnd_nvram_val_init_common(bhnd_nvram_va size_t olen; int error; + /* If the value format is unspecified, we use the default format + * for the input data type */ + if (fmt == NULL) + fmt = bhnd_nvram_val_default_fmt(itype); + /* Determine expected data type, and allow the format to delegate to * a new format instance */ - if (fmt != NULL && fmt->op_filter != NULL) { - const bhnd_nvram_val_fmt *nfmt = fmt; - - /* Use the filter function to determine whether direct - * initialization from is itype permitted */ - error = fmt->op_filter(&nfmt, inp, ilen, itype); - if (error) - return (error); - - /* Retry initialization with new format? */ - if (nfmt != fmt) { - return (bhnd_nvram_val_init_common(value, val_storage, - nfmt, inp, ilen, itype, flags)); - } - - /* Value can be initialized with provided input type */ - otype = itype; - - } else if (fmt != NULL) { - /* Value must be initialized with the format's native - * type */ + if ((error = bhnd_nvram_val_fmt_filter(&fmt, inp, ilen, itype))) { + /* Direct initialization from the provided input type is + * not supported; alue must be initialized with the format's + * native type */ otype = fmt->native_type; - } else { - /* No format specified; we can initialize directly from the - * input data, and we'll handle all format operations - * internally. */ + /* Value can be initialized with provided input type */ otype = itype; } @@ -236,6 +384,145 @@ bhnd_nvram_val_new(bhnd_nvram_val **valu return (error); } + +/* Common initialization support for bhnd_nvram_val_convert_init() and + * bhnd_nvram_val_convert_new() */ +static int +bhnd_nvram_val_convert_common(bhnd_nvram_val *value, + bhnd_nvram_val_storage val_storage, const bhnd_nvram_val_fmt *fmt, + bhnd_nvram_val *src, uint32_t flags) +{ + const void *inp; + void *outp; + bhnd_nvram_type itype, otype; + size_t ilen, olen; + int error; + + /* Determine whether direct initialization from the source value's + * existing data type is supported by the new format */ + inp = bhnd_nvram_val_bytes(src, &ilen, &itype); + if (bhnd_nvram_val_fmt_filter(&fmt, inp, ilen, itype) == 0) { + /* Adjust value flags based on the source data storage */ + switch (src->data_storage) { + case BHND_NVRAM_VAL_DATA_NONE: + case BHND_NVRAM_VAL_DATA_INLINE: + case BHND_NVRAM_VAL_DATA_EXT_WEAK: + case BHND_NVRAM_VAL_DATA_EXT_ALLOC: + break; + + case BHND_NVRAM_VAL_DATA_EXT_STATIC: + /* If the source data has static storage duration, + * we should apply that transitively */ + if (flags & BHND_NVRAM_VAL_BORROW_DATA) + flags |= BHND_NVRAM_VAL_STATIC_DATA; + + break; + } + + /* Delegate to standard initialization */ + return (bhnd_nvram_val_init_common(value, val_storage, fmt, inp, + ilen, itype, flags)); + } + + /* Value must be initialized with the format's native type */ + otype = fmt->native_type; + + /* Initialize value instance */ + *value = BHND_NVRAM_VAL_INITIALIZER(fmt, val_storage); + + /* Determine size when encoded in native format */ + if ((error = bhnd_nvram_val_encode(src, NULL, &olen, otype))) + return (error); + + /* Fetch reference to (or allocate) an appropriately sized buffer */ + outp = bhnd_nvram_val_alloc_bytes(value, olen, otype, flags); + if (outp == NULL) + return (ENOMEM); + + /* Perform encode */ + if ((error = bhnd_nvram_val_encode(src, outp, &olen, otype))) + return (error); + + return (0); +} + +/** + * Initialize an externally allocated instance of @p value with @p fmt, and + * attempt to initialize its internal representation from the given @p src + * value. + * + * On success, the caller owns a reference to @p value, and is responsible for + * freeing any resources allocated for @p value via bhnd_nvram_val_release(). + * + * @param value The externally allocated value instance to be + * initialized. + * @param fmt The value's format. + * @param src Input value to be converted. + * @param flags Value flags (see BHND_NVRAM_VAL_*). + * + * @retval 0 success + * @retval ENOMEM If allocation fails. + * @retval EFTYPE If @p fmt initialization from @p src is unsupported. + * @retval EFAULT if @p ilen is not correctly aligned for elements of + * @p itype. + * @retval ERANGE If value coercion of @p src would overflow + * (or underflow) the @p fmt representation. + */ +int +bhnd_nvram_val_convert_init(bhnd_nvram_val *value, + const bhnd_nvram_val_fmt *fmt, bhnd_nvram_val *src, uint32_t flags) +{ + int error; + + error = bhnd_nvram_val_convert_common(value, + BHND_NVRAM_VAL_STORAGE_AUTO, fmt, src, flags); + if (error) + bhnd_nvram_val_release(value); + + return (error); +} + +/** + * Allocate a value instance with @p fmt, and attempt to initialize its internal + * representation from the given @p src value. + * + * On success, the caller owns a reference to @p value, and is responsible for + * freeing any resources allocated for @p value via bhnd_nvram_val_release(). + * + * @param[out] value On success, the allocated value instance. + * @param fmt The value's format. + * @param src Input value to be converted. + * @param flags Value flags (see BHND_NVRAM_VAL_*). + * + * @retval 0 success + * @retval ENOMEM If allocation fails. + * @retval EFTYPE If @p fmt initialization from @p src is unsupported. *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@freebsd.org Mon Dec 19 20:23:21 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4A2C6C88791; Mon, 19 Dec 2016 20:23:21 +0000 (UTC) (envelope-from landonf@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id ECCE41604; Mon, 19 Dec 2016 20:23:20 +0000 (UTC) (envelope-from landonf@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBJKNKpv056331; Mon, 19 Dec 2016 20:23:20 GMT (envelope-from landonf@FreeBSD.org) Received: (from landonf@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBJKNJ12056321; Mon, 19 Dec 2016 20:23:19 GMT (envelope-from landonf@FreeBSD.org) Message-Id: <201612192023.uBJKNJ12056321@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: landonf set sender to landonf@FreeBSD.org using -f From: "Landon J. Fuller" Date: Mon, 19 Dec 2016 20:23:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310293 - head/sys/dev/bhnd/nvram X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Dec 2016 20:23:21 -0000 Author: landonf Date: Mon Dec 19 20:23:19 2016 New Revision: 310293 URL: https://svnweb.freebsd.org/changeset/base/310293 Log: bhnd(4): Add support for three new NVRAM value types; booleans, NULL (which we'll use to denote deleted values in bhnd_nvram_store), and opaque data (aka octet-strings). Approved by: adrian (mentor) Differential Revision: https://reviews.freebsd.org/D8758 Modified: head/sys/dev/bhnd/nvram/bhnd_nvram.h head/sys/dev/bhnd/nvram/bhnd_nvram_plist.c head/sys/dev/bhnd/nvram/bhnd_nvram_plist.h head/sys/dev/bhnd/nvram/bhnd_nvram_store.c head/sys/dev/bhnd/nvram/bhnd_nvram_subr.c head/sys/dev/bhnd/nvram/bhnd_nvram_value.c head/sys/dev/bhnd/nvram/bhnd_nvram_value.h head/sys/dev/bhnd/nvram/bhnd_nvram_value_fmts.c head/sys/dev/bhnd/nvram/bhnd_nvram_value_subr.c Modified: head/sys/dev/bhnd/nvram/bhnd_nvram.h ============================================================================== --- head/sys/dev/bhnd/nvram/bhnd_nvram.h Mon Dec 19 20:20:33 2016 (r310292) +++ head/sys/dev/bhnd/nvram/bhnd_nvram.h Mon Dec 19 20:23:19 2016 (r310293) @@ -40,6 +40,14 @@ #endif /* _KERNEL */ /** + * BHND NVRAM boolean type; guaranteed to be exactly 8-bits, representing + * true as integer constant 1, and false as integer constant 0. + * + * Compatible with stdbool constants (true, false). + */ +typedef uint8_t bhnd_nvram_bool_t; + +/** * NVRAM data sources supported by bhnd(4) devices. */ typedef enum { @@ -94,6 +102,10 @@ typedef enum { BHND_NVRAM_TYPE_CHAR = 8, /**< ASCII/UTF-8 character */ BHND_NVRAM_TYPE_STRING = 9, /**< ASCII/UTF-8 NUL-terminated string */ + BHND_NVRAM_TYPE_BOOL = 10, /**< uint8 boolean value. see + bhnd_nvram_bool_t. */ + BHND_NVRAM_TYPE_NULL = 11, /**< NULL (empty) value */ + BHND_NVRAM_TYPE_DATA = 12, /**< opaque octet string */ /* 10-15 reserved for primitive (non-array) types */ @@ -109,13 +121,17 @@ typedef enum { characters */ BHND_NVRAM_TYPE_STRING_ARRAY = 25, /**< array of ASCII/UTF-8 NUL-terminated strings */ + BHND_NVRAM_TYPE_BOOL_ARRAY = 26, /**< array of uint8 boolean + values */ } bhnd_nvram_type; + bool bhnd_nvram_is_signed_type(bhnd_nvram_type type); bool bhnd_nvram_is_unsigned_type(bhnd_nvram_type type); bool bhnd_nvram_is_int_type(bhnd_nvram_type type); bool bhnd_nvram_is_array_type(bhnd_nvram_type type); bhnd_nvram_type bhnd_nvram_base_type(bhnd_nvram_type type); +bhnd_nvram_type bhnd_nvram_raw_type(bhnd_nvram_type type); const char *bhnd_nvram_type_name(bhnd_nvram_type type); size_t bhnd_nvram_type_width(bhnd_nvram_type type); size_t bhnd_nvram_type_host_align(bhnd_nvram_type type); Modified: head/sys/dev/bhnd/nvram/bhnd_nvram_plist.c ============================================================================== --- head/sys/dev/bhnd/nvram/bhnd_nvram_plist.c Mon Dec 19 20:20:33 2016 (r310292) +++ head/sys/dev/bhnd/nvram/bhnd_nvram_plist.c Mon Dec 19 20:23:19 2016 (r310293) @@ -743,6 +743,27 @@ bhnd_nvram_plist_get_uint64(bhnd_nvram_p } /** + * Return the boolean representation of a named property's value. + * + * @param plist The property list to be queried. + * @param name The name of the property value to be returned. + * @param[out] val On success, the boolean value of @p name. + * + * @retval 0 success + * @retval ENOENT If @p name is not found in @p plist. + * @retval EFTYPE If coercion of the property's value to @p val. + * @retval ERANGE If coercion of the property's value would overflow + * (or underflow) @p val. + */ +int +bhnd_nvram_plist_get_bool(bhnd_nvram_plist *plist, const char *name, + bool *val) +{ + return (bhnd_nvram_plist_get_encoded(plist, name, val, sizeof(*val), + BHND_NVRAM_TYPE_BOOL)); +} + +/** * Allocate and initialize a new property value. * * The caller is responsible for releasing the returned property value @@ -901,6 +922,18 @@ bhnd_nvram_prop_type(bhnd_nvram_prop *pr } /** + * Return true if @p prop has a NULL value type (BHND_NVRAM_TYPE_NULL), false + * otherwise. + * + * @param prop The property to query. + */ +bool +bhnd_nvram_prop_is_null(bhnd_nvram_prop *prop) +{ + return (bhnd_nvram_prop_type(prop) == BHND_NVRAM_TYPE_NULL); +} + +/** * Return a borrowed reference to the property's internal value representation. * * @param prop The property to query. Modified: head/sys/dev/bhnd/nvram/bhnd_nvram_plist.h ============================================================================== --- head/sys/dev/bhnd/nvram/bhnd_nvram_plist.h Mon Dec 19 20:20:33 2016 (r310292) +++ head/sys/dev/bhnd/nvram/bhnd_nvram_plist.h Mon Dec 19 20:23:19 2016 (r310293) @@ -104,6 +104,8 @@ int bhnd_nvram_plist_get_uint64(bhnd_ const char *name, uint64_t *val); int bhnd_nvram_plist_get_string(bhnd_nvram_plist *plist, const char *name, const char **val); +int bhnd_nvram_plist_get_bool(bhnd_nvram_plist *plist, + const char *name, bool *val); bhnd_nvram_prop *bhnd_nvram_prop_new(const char *name, bhnd_nvram_val *val); @@ -118,6 +120,8 @@ const char *bhnd_nvram_prop_name(bhnd_n bhnd_nvram_val *bhnd_nvram_prop_val(bhnd_nvram_prop *prop); bhnd_nvram_type bhnd_nvram_prop_type(bhnd_nvram_prop *prop); +bool bhnd_nvram_prop_is_null(bhnd_nvram_prop *prop); + const void *bhnd_nvram_prop_bytes(bhnd_nvram_prop *prop, size_t *olen, bhnd_nvram_type *otype); int bhnd_nvram_prop_encode(bhnd_nvram_prop *prop, Modified: head/sys/dev/bhnd/nvram/bhnd_nvram_store.c ============================================================================== --- head/sys/dev/bhnd/nvram/bhnd_nvram_store.c Mon Dec 19 20:20:33 2016 (r310292) +++ head/sys/dev/bhnd/nvram/bhnd_nvram_store.c Mon Dec 19 20:23:19 2016 (r310293) @@ -301,6 +301,9 @@ bhnd_nvram_store_setvar(struct bhnd_nvra case BHND_NVRAM_TYPE_INT16: case BHND_NVRAM_TYPE_INT32: case BHND_NVRAM_TYPE_INT64: + case BHND_NVRAM_TYPE_NULL: + case BHND_NVRAM_TYPE_DATA: + case BHND_NVRAM_TYPE_BOOL: case BHND_NVRAM_TYPE_UINT8_ARRAY: case BHND_NVRAM_TYPE_UINT16_ARRAY: case BHND_NVRAM_TYPE_UINT32_ARRAY: @@ -311,6 +314,7 @@ bhnd_nvram_store_setvar(struct bhnd_nvra case BHND_NVRAM_TYPE_INT64_ARRAY: case BHND_NVRAM_TYPE_CHAR_ARRAY: case BHND_NVRAM_TYPE_STRING_ARRAY: + case BHND_NVRAM_TYPE_BOOL_ARRAY: // TODO: non-char/string value support return (EOPNOTSUPP); Modified: head/sys/dev/bhnd/nvram/bhnd_nvram_subr.c ============================================================================== --- head/sys/dev/bhnd/nvram/bhnd_nvram_subr.c Mon Dec 19 20:20:33 2016 (r310292) +++ head/sys/dev/bhnd/nvram/bhnd_nvram_subr.c Mon Dec 19 20:23:19 2016 (r310293) @@ -136,6 +136,12 @@ bhnd_nvram_type_name(bhnd_nvram_type typ return ("int64"); case BHND_NVRAM_TYPE_STRING: return ("string"); + case BHND_NVRAM_TYPE_BOOL: + return ("bool"); + case BHND_NVRAM_TYPE_NULL: + return ("null"); + case BHND_NVRAM_TYPE_DATA: + return ("data"); case BHND_NVRAM_TYPE_UINT8_ARRAY: return ("uint8[]"); case BHND_NVRAM_TYPE_UINT16_ARRAY: @@ -156,6 +162,8 @@ bhnd_nvram_type_name(bhnd_nvram_type typ return ("char[]"); case BHND_NVRAM_TYPE_STRING_ARRAY: return ("string[]"); + case BHND_NVRAM_TYPE_BOOL_ARRAY: + return ("bool[]"); } /* Quiesce gcc4.2 */ @@ -186,6 +194,9 @@ bhnd_nvram_is_signed_type(bhnd_nvram_typ case BHND_NVRAM_TYPE_UINT32: case BHND_NVRAM_TYPE_UINT64: case BHND_NVRAM_TYPE_STRING: + case BHND_NVRAM_TYPE_BOOL: + case BHND_NVRAM_TYPE_NULL: + case BHND_NVRAM_TYPE_DATA: case BHND_NVRAM_TYPE_UINT8_ARRAY: case BHND_NVRAM_TYPE_UINT16_ARRAY: case BHND_NVRAM_TYPE_UINT32_ARRAY: @@ -196,6 +207,7 @@ bhnd_nvram_is_signed_type(bhnd_nvram_typ case BHND_NVRAM_TYPE_INT64_ARRAY: case BHND_NVRAM_TYPE_CHAR_ARRAY: case BHND_NVRAM_TYPE_STRING_ARRAY: + case BHND_NVRAM_TYPE_BOOL_ARRAY: return (false); } @@ -243,6 +255,9 @@ bhnd_nvram_is_int_type(bhnd_nvram_type t case BHND_NVRAM_TYPE_CHAR: case BHND_NVRAM_TYPE_STRING: + case BHND_NVRAM_TYPE_BOOL: + case BHND_NVRAM_TYPE_NULL: + case BHND_NVRAM_TYPE_DATA: case BHND_NVRAM_TYPE_UINT8_ARRAY: case BHND_NVRAM_TYPE_UINT16_ARRAY: case BHND_NVRAM_TYPE_UINT32_ARRAY: @@ -253,6 +268,7 @@ bhnd_nvram_is_int_type(bhnd_nvram_type t case BHND_NVRAM_TYPE_INT64_ARRAY: case BHND_NVRAM_TYPE_CHAR_ARRAY: case BHND_NVRAM_TYPE_STRING_ARRAY: + case BHND_NVRAM_TYPE_BOOL_ARRAY: return (false); } @@ -279,6 +295,9 @@ bhnd_nvram_is_array_type(bhnd_nvram_type case BHND_NVRAM_TYPE_INT64: case BHND_NVRAM_TYPE_CHAR: case BHND_NVRAM_TYPE_STRING: + case BHND_NVRAM_TYPE_BOOL: + case BHND_NVRAM_TYPE_NULL: + case BHND_NVRAM_TYPE_DATA: return (false); case BHND_NVRAM_TYPE_UINT8_ARRAY: @@ -291,6 +310,7 @@ bhnd_nvram_is_array_type(bhnd_nvram_type case BHND_NVRAM_TYPE_INT64_ARRAY: case BHND_NVRAM_TYPE_CHAR_ARRAY: case BHND_NVRAM_TYPE_STRING_ARRAY: + case BHND_NVRAM_TYPE_BOOL_ARRAY: return (true); } @@ -318,6 +338,9 @@ bhnd_nvram_base_type(bhnd_nvram_type typ case BHND_NVRAM_TYPE_INT64: case BHND_NVRAM_TYPE_CHAR: case BHND_NVRAM_TYPE_STRING: + case BHND_NVRAM_TYPE_BOOL: + case BHND_NVRAM_TYPE_NULL: + case BHND_NVRAM_TYPE_DATA: return (type); case BHND_NVRAM_TYPE_UINT8_ARRAY: return (BHND_NVRAM_TYPE_UINT8); @@ -330,6 +353,63 @@ bhnd_nvram_base_type(bhnd_nvram_type typ case BHND_NVRAM_TYPE_INT64_ARRAY: return (BHND_NVRAM_TYPE_INT64); case BHND_NVRAM_TYPE_CHAR_ARRAY: return (BHND_NVRAM_TYPE_CHAR); case BHND_NVRAM_TYPE_STRING_ARRAY: return (BHND_NVRAM_TYPE_STRING); + case BHND_NVRAM_TYPE_BOOL_ARRAY: return (BHND_NVRAM_TYPE_BOOL); + } + + /* Quiesce gcc4.2 */ + BHND_NV_PANIC("bhnd nvram type %u unknown", type); +} + +/** + * Return the raw data type used to represent values of @p type, or return + * @p type is @p type is not a complex type. + * + * @param type The type to query. + */ +bhnd_nvram_type +bhnd_nvram_raw_type(bhnd_nvram_type type) +{ + switch (type) { + case BHND_NVRAM_TYPE_CHAR: + return (BHND_NVRAM_TYPE_UINT8); + + case BHND_NVRAM_TYPE_CHAR_ARRAY: + return (BHND_NVRAM_TYPE_UINT8_ARRAY); + + case BHND_NVRAM_TYPE_BOOL: { + _Static_assert(sizeof(bhnd_nvram_bool_t) == sizeof(uint8_t), + "bhnd_nvram_bool_t must be uint8-representable"); + return (BHND_NVRAM_TYPE_UINT8); + } + + case BHND_NVRAM_TYPE_BOOL_ARRAY: + return (BHND_NVRAM_TYPE_UINT8_ARRAY); + + case BHND_NVRAM_TYPE_DATA: + return (BHND_NVRAM_TYPE_UINT8_ARRAY); + + case BHND_NVRAM_TYPE_STRING: + case BHND_NVRAM_TYPE_STRING_ARRAY: + return (BHND_NVRAM_TYPE_UINT8_ARRAY); + + case BHND_NVRAM_TYPE_UINT8: + case BHND_NVRAM_TYPE_UINT16: + case BHND_NVRAM_TYPE_UINT32: + case BHND_NVRAM_TYPE_UINT64: + case BHND_NVRAM_TYPE_INT8: + case BHND_NVRAM_TYPE_INT16: + case BHND_NVRAM_TYPE_INT32: + case BHND_NVRAM_TYPE_INT64: + case BHND_NVRAM_TYPE_NULL: + case BHND_NVRAM_TYPE_UINT8_ARRAY: + case BHND_NVRAM_TYPE_UINT16_ARRAY: + case BHND_NVRAM_TYPE_UINT32_ARRAY: + case BHND_NVRAM_TYPE_UINT64_ARRAY: + case BHND_NVRAM_TYPE_INT8_ARRAY: + case BHND_NVRAM_TYPE_INT16_ARRAY: + case BHND_NVRAM_TYPE_INT32_ARRAY: + case BHND_NVRAM_TYPE_INT64_ARRAY: + return (type); } /* Quiesce gcc4.2 */ @@ -348,8 +428,16 @@ bhnd_nvram_type_width(bhnd_nvram_type ty switch (type) { case BHND_NVRAM_TYPE_STRING: case BHND_NVRAM_TYPE_STRING_ARRAY: + case BHND_NVRAM_TYPE_DATA: return (0); + case BHND_NVRAM_TYPE_NULL: + return (0); + + case BHND_NVRAM_TYPE_BOOL: + case BHND_NVRAM_TYPE_BOOL_ARRAY: + return (sizeof(bhnd_nvram_bool_t)); + case BHND_NVRAM_TYPE_CHAR: case BHND_NVRAM_TYPE_CHAR_ARRAY: case BHND_NVRAM_TYPE_UINT8: @@ -392,9 +480,18 @@ bhnd_nvram_type_host_align(bhnd_nvram_ty switch (type) { case BHND_NVRAM_TYPE_CHAR: case BHND_NVRAM_TYPE_CHAR_ARRAY: + case BHND_NVRAM_TYPE_DATA: case BHND_NVRAM_TYPE_STRING: case BHND_NVRAM_TYPE_STRING_ARRAY: return (_Alignof(uint8_t)); + case BHND_NVRAM_TYPE_BOOL: + case BHND_NVRAM_TYPE_BOOL_ARRAY: { + _Static_assert(sizeof(bhnd_nvram_bool_t) == sizeof(uint8_t), + "bhnd_nvram_bool_t must be uint8-representable"); + return (_Alignof(uint8_t)); + } + case BHND_NVRAM_TYPE_NULL: + return (1); case BHND_NVRAM_TYPE_UINT8: case BHND_NVRAM_TYPE_UINT8_ARRAY: return (_Alignof(uint8_t)); Modified: head/sys/dev/bhnd/nvram/bhnd_nvram_value.c ============================================================================== --- head/sys/dev/bhnd/nvram/bhnd_nvram_value.c Mon Dec 19 20:20:33 2016 (r310292) +++ head/sys/dev/bhnd/nvram/bhnd_nvram_value.c Mon Dec 19 20:23:19 2016 (r310293) @@ -66,9 +66,19 @@ static int bhnd_nvram_val_set(bhnd_nvra static int bhnd_nvram_val_set_inline(bhnd_nvram_val *value, const void *inp, size_t ilen, bhnd_nvram_type itype); + +static int bhnd_nvram_val_encode_data(const void *inp, size_t ilen, + bhnd_nvram_type itype, void *outp, size_t *olen, + bhnd_nvram_type otype); static int bhnd_nvram_val_encode_int(const void *inp, size_t ilen, bhnd_nvram_type itype, void *outp, size_t *olen, bhnd_nvram_type otype); +static int bhnd_nvram_val_encode_null(const void *inp, size_t ilen, + bhnd_nvram_type itype, void *outp, size_t *olen, + bhnd_nvram_type otype); +static int bhnd_nvram_val_encode_bool(const void *inp, size_t ilen, + bhnd_nvram_type itype, void *outp, size_t *olen, + bhnd_nvram_type otype); static int bhnd_nvram_val_encode_string(const void *inp, size_t ilen, bhnd_nvram_type itype, void *outp, size_t *olen, bhnd_nvram_type otype); @@ -83,7 +93,6 @@ static int bhnd_nvram_val_encode_string .data_storage = BHND_NVRAM_VAL_DATA_NONE, \ }; - /** Assert that @p value's backing representation state has initialized * as empty. */ #define BHND_NVRAM_VAL_ASSERT_EMPTY(_value) \ @@ -120,6 +129,16 @@ bhnd_nvram_val_data_storage data_storag bhnd_nvram_type data_type; /**< data type */ size_t data_len; /**< data size */ +/* Shared NULL value instance */ +bhnd_nvram_val bhnd_nvram_val_null = { + .refs = 1, + .val_storage = BHND_NVRAM_VAL_STORAGE_STATIC, + .fmt = &bhnd_nvram_val_null_fmt, + .data_storage = BHND_NVRAM_VAL_DATA_INLINE, + .data_type = BHND_NVRAM_TYPE_NULL, + .data_len = 0, +}; + /** * Return the human-readable name of @p fmt. */ @@ -156,6 +175,12 @@ bhnd_nvram_val_default_fmt(bhnd_nvram_ty return (&bhnd_nvram_val_char_fmt); case BHND_NVRAM_TYPE_STRING: return (&bhnd_nvram_val_string_fmt); + case BHND_NVRAM_TYPE_BOOL: + return (&bhnd_nvram_val_bool_fmt); + case BHND_NVRAM_TYPE_NULL: + return (&bhnd_nvram_val_null_fmt); + case BHND_NVRAM_TYPE_DATA: + return (&bhnd_nvram_val_data_fmt); case BHND_NVRAM_TYPE_UINT8_ARRAY: return (&bhnd_nvram_val_uint8_array_fmt); case BHND_NVRAM_TYPE_UINT16_ARRAY: @@ -176,6 +201,8 @@ bhnd_nvram_val_default_fmt(bhnd_nvram_ty return (&bhnd_nvram_val_char_array_fmt); case BHND_NVRAM_TYPE_STRING_ARRAY: return (&bhnd_nvram_val_string_array_fmt); + case BHND_NVRAM_TYPE_BOOL_ARRAY: + return (&bhnd_nvram_val_bool_array_fmt); } /* Quiesce gcc4.2 */ @@ -635,6 +662,156 @@ bhnd_nvram_val_release(bhnd_nvram_val *v } /** + * Standard BHND_NVRAM_TYPE_NULL encoding implementation. + */ +static int +bhnd_nvram_val_encode_null(const void *inp, size_t ilen, bhnd_nvram_type itype, + void *outp, size_t *olen, bhnd_nvram_type otype) +{ + size_t limit, nbytes; + + BHND_NV_ASSERT(itype == BHND_NVRAM_TYPE_NULL, + ("unsupported type: %d", itype)); + + /* Determine output byte limit */ + if (outp != NULL) + limit = *olen; + else + limit = 0; + + nbytes = 0; + + /* Write to output */ + switch (otype) { + case BHND_NVRAM_TYPE_NULL: + /* Can be directly encoded as a zero-length NULL value */ + nbytes = 0; + break; + default: + /* Not representable */ + return (EFTYPE); + } + + /* Provide required length */ + *olen = nbytes; + if (limit < *olen) { + if (outp == NULL) + return (0); + + return (ENOMEM); + } + + return (0); +} + +/** + * Standard BHND_NVRAM_TYPE_BOOL encoding implementation. + */ +static int +bhnd_nvram_val_encode_bool(const void *inp, size_t ilen, bhnd_nvram_type itype, + void *outp, size_t *olen, bhnd_nvram_type otype) +{ + bhnd_nvram_bool_t bval; + size_t limit, nbytes, nelem; + int error; + + BHND_NV_ASSERT(itype == BHND_NVRAM_TYPE_BOOL, + ("unsupported type: %d", itype)); + + /* Determine output byte limit */ + if (outp != NULL) + limit = *olen; + else + limit = 0; + + /* Must be exactly one element in input */ + if ((error = bhnd_nvram_value_nelem(inp, ilen, itype, &nelem))) + return (error); + + if (nelem != 1) + return (EFTYPE); + + /* Fetch (and normalize) boolean value */ + bval = (*(const bhnd_nvram_bool_t *)inp != 0) ? true : false; + + /* Write to output */ + switch (otype) { + case BHND_NVRAM_TYPE_NULL: + /* False can be directly encoded as a zero-length NULL value */ + if (bval != false) + return (EFTYPE); + + nbytes = 0; + break; + + case BHND_NVRAM_TYPE_STRING: + case BHND_NVRAM_TYPE_STRING_ARRAY: { + /* Can encode as "true" or "false" */ + const char *str = bval ? "true" : "false"; + + nbytes = strlen(str) + 1; + if (limit > nbytes) + strcpy(outp, str); + + break; + } + + default: + /* If output type is an integer, we can delegate to standard + * integer encoding to encode as zero or one. */ + if (bhnd_nvram_is_int_type(otype)) { + uint8_t ival = bval ? 1 : 0; + + return (bhnd_nvram_val_encode_int(&ival, sizeof(ival), + BHND_NVRAM_TYPE_UINT8, outp, olen, otype)); + } + + /* Otherwise not representable */ + return (EFTYPE); + } + + /* Provide required length */ + *olen = nbytes; + if (limit < *olen) { + if (outp == NULL) + return (0); + + return (ENOMEM); + } + + return (0); +} + +/** + * Standard BHND_NVRAM_TYPE_DATA encoding implementation. + */ +static int +bhnd_nvram_val_encode_data(const void *inp, size_t ilen, bhnd_nvram_type itype, + void *outp, size_t *olen, bhnd_nvram_type otype) +{ + BHND_NV_ASSERT(itype == BHND_NVRAM_TYPE_DATA, + ("unsupported type: %d", itype)); + + /* Write to output */ + switch (otype) { + case BHND_NVRAM_TYPE_STRING: + case BHND_NVRAM_TYPE_STRING_ARRAY: + /* If encoding as a string, produce an EFI-style hexadecimal + * byte array (HF1F...) by interpreting the octet string + * as an array of uint8 values */ + return (bhnd_nvram_value_printf("H%[]02hhX", inp, ilen, + BHND_NVRAM_TYPE_UINT8_ARRAY, outp, olen, "")); + + default: + /* Fall back on direct interpretation as an array of 8-bit + * integers array */ + return (bhnd_nvram_value_coerce(inp, ilen, + BHND_NVRAM_TYPE_UINT8_ARRAY, outp, olen, otype)); + } +} + + +/** * Standard string/char array/char encoding implementation. * * Input type must be one of: @@ -673,6 +850,14 @@ bhnd_nvram_val_encode_string(const void /* Parse the string data and write to output */ switch (otype) { + case BHND_NVRAM_TYPE_NULL: + /* Only an empty string may be represented as a NULL value */ + if (cstr_len != 0) + return (EFTYPE); + + *olen = 0; + return (0); + case BHND_NVRAM_TYPE_CHAR: case BHND_NVRAM_TYPE_CHAR_ARRAY: /* String must contain exactly 1 non-terminating-NUL character @@ -696,6 +881,99 @@ bhnd_nvram_val_encode_string(const void return (0); + case BHND_NVRAM_TYPE_BOOL: + case BHND_NVRAM_TYPE_BOOL_ARRAY: { + const char *p; + size_t plen; + bhnd_nvram_bool_t bval; + + /* Trim leading/trailing whitespace */ + p = cstr; + plen = bhnd_nvram_trim_field(&p, cstr_len, '\0'); + + /* Parse string representation */ + if (strncasecmp(p, "true", plen) == 0 || + strncasecmp(p, "yes", plen) == 0 || + strncmp(p, "1", plen) == 0) + { + bval = true; + } else if (strncasecmp(p, "false", plen) == 0 || + strncasecmp(p, "no", plen) == 0 || + strncmp(p, "0", plen) == 0) + { + bval = false; + } else { + /* Not a recognized boolean string */ + return (EFTYPE); + } + + /* Write to output */ + nbytes = sizeof(bhnd_nvram_bool_t); + if (limit >= nbytes) + *((bhnd_nvram_bool_t *)outp) = bval; + + /* Provide required length */ + *olen = nbytes; + if (limit < *olen && outp != NULL) + return (ENOMEM); + + return (0); + } + + case BHND_NVRAM_TYPE_DATA: { + const char *p; + size_t plen, parsed_len; + int error; + + /* Trim leading/trailing whitespace */ + p = cstr; + plen = bhnd_nvram_trim_field(&p, cstr_len, '\0'); + + /* Check for EFI-style hexadecimal byte array string format. + * Must have a 'H' prefix */ + if (plen < 1 || bhnd_nv_toupper(*p) != 'H') + return (EFTYPE); + + /* Skip leading 'H' */ + p++; + plen--; + + /* Parse the input string's two-char octets until the end + * of input is reached. The last octet may contain only + * one char */ + while (plen > 0) { + uint8_t byte; + size_t byte_len = sizeof(byte); + + /* Parse next two-character hex octet */ + error = bhnd_nvram_parse_int(p, bhnd_nv_ummin(plen, 2), + 16, &parsed_len, &byte, &byte_len, otype_base); + if (error) { + BHND_NV_DEBUG("error parsing '%.*s' as " + "integer: %d\n", BHND_NV_PRINT_WIDTH(plen), + p, error); + + return (error); + } + + /* Write to output */ + if (limit > nbytes) + *((uint8_t *)outp + nbytes) = byte; + nbytes++; + + /* Advance input */ + p += parsed_len; + plen -= parsed_len; + } + + /* Provide required length */ + *olen = nbytes; + if (limit < *olen && outp != NULL) + return (ENOMEM); + + return (0); + } + case BHND_NVRAM_TYPE_UINT8: case BHND_NVRAM_TYPE_UINT8_ARRAY: case BHND_NVRAM_TYPE_UINT16: @@ -896,8 +1174,30 @@ bhnd_nvram_val_encode_int(const void *in /* Write output */ switch (otype) { + case BHND_NVRAM_TYPE_NULL: + /* Cannot encode an integer value as NULL */ + return (EFTYPE); + + case BHND_NVRAM_TYPE_BOOL: { + bhnd_nvram_bool_t bval; + + if (intv.u64 == 0 || intv.u64 == 1) { + bval = intv.u64; + } else { + /* Encoding as a bool would lose information */ + return (ERANGE); + } + + nbytes = sizeof(bhnd_nvram_bool_t); + if (limit >= nbytes) + *((bhnd_nvram_bool_t *)outp) = bval; + + break; + } + case BHND_NVRAM_TYPE_CHAR: case BHND_NVRAM_TYPE_CHAR_ARRAY: + case BHND_NVRAM_TYPE_DATA: case BHND_NVRAM_TYPE_UINT8: case BHND_NVRAM_TYPE_UINT8_ARRAY: if (intv.u64 > UINT8_MAX) @@ -1335,11 +1635,23 @@ bhnd_nvram_val_generic_encode_elem(bhnd_ itype = bhnd_nvram_val_elem_type(value); switch (itype) { + case BHND_NVRAM_TYPE_NULL: + return (bhnd_nvram_val_encode_null(inp, ilen, itype, outp, olen, + otype)); + + case BHND_NVRAM_TYPE_DATA: + return (bhnd_nvram_val_encode_data(inp, ilen, itype, outp, + olen, otype)); + case BHND_NVRAM_TYPE_STRING: case BHND_NVRAM_TYPE_CHAR: return (bhnd_nvram_val_encode_string(inp, ilen, itype, outp, olen, otype)); + case BHND_NVRAM_TYPE_BOOL: + return (bhnd_nvram_val_encode_bool(inp, ilen, itype, outp, olen, + otype)); + case BHND_NVRAM_TYPE_UINT8: case BHND_NVRAM_TYPE_UINT16: case BHND_NVRAM_TYPE_UINT32: @@ -1486,10 +1798,22 @@ bhnd_nvram_val_set_inline(bhnd_nvram_val /* Attempt to copy to inline storage */ switch (itype) { + case BHND_NVRAM_TYPE_NULL: + if (ilen != 0) + return (EFAULT); + + /* Nothing to copy */ + NV_STORE_INIT_INLINE(); + return (0); + case BHND_NVRAM_TYPE_CHAR: NV_STORE_INLINE(uint8_t, ch); return (0); + case BHND_NVRAM_TYPE_BOOL: + NV_STORE_INLINE(bhnd_nvram_bool_t, b); + return(0); + case BHND_NVRAM_TYPE_UINT8: case BHND_NVRAM_TYPE_INT8: NV_STORE_INLINE(uint8_t, u8); @@ -1514,6 +1838,7 @@ bhnd_nvram_val_set_inline(bhnd_nvram_val NV_COPY_ARRRAY_INLINE(uint8_t, ch); return (0); + case BHND_NVRAM_TYPE_DATA: case BHND_NVRAM_TYPE_UINT8_ARRAY: case BHND_NVRAM_TYPE_INT8_ARRAY: NV_COPY_ARRRAY_INLINE(uint8_t, u8); @@ -1534,6 +1859,10 @@ bhnd_nvram_val_set_inline(bhnd_nvram_val NV_COPY_ARRRAY_INLINE(uint64_t, u64); return (0); + case BHND_NVRAM_TYPE_BOOL_ARRAY: + NV_COPY_ARRRAY_INLINE(bhnd_nvram_bool_t, b); + return(0); + case BHND_NVRAM_TYPE_STRING: case BHND_NVRAM_TYPE_STRING_ARRAY: if (ilen > sizeof(value->data.ch)) Modified: head/sys/dev/bhnd/nvram/bhnd_nvram_value.h ============================================================================== --- head/sys/dev/bhnd/nvram/bhnd_nvram_value.h Mon Dec 19 20:20:33 2016 (r310292) +++ head/sys/dev/bhnd/nvram/bhnd_nvram_value.h Mon Dec 19 20:23:19 2016 (r310293) @@ -235,6 +235,7 @@ struct bhnd_nvram_val { int32_t i32[2]; /**< 32-bit signed data */ int64_t i64[1]; /**< 64-bit signed data */ unsigned char ch[8]; /**< 8-bit character data */ + bhnd_nvram_bool_t b[8]; /**< 8-bit boolean data */ const void *ptr; /**< external data */ } data; }; @@ -258,7 +259,10 @@ BHND_NVRAM_VAL_FMT_DECL(int16); BHND_NVRAM_VAL_FMT_DECL(int32); BHND_NVRAM_VAL_FMT_DECL(int64); BHND_NVRAM_VAL_FMT_DECL(char); +BHND_NVRAM_VAL_FMT_DECL(bool); BHND_NVRAM_VAL_FMT_DECL(string); +BHND_NVRAM_VAL_FMT_DECL(data); +BHND_NVRAM_VAL_FMT_DECL(null); BHND_NVRAM_VAL_FMT_DECL(uint8_array); BHND_NVRAM_VAL_FMT_DECL(uint16_array); @@ -269,6 +273,11 @@ BHND_NVRAM_VAL_FMT_DECL(int16_array); BHND_NVRAM_VAL_FMT_DECL(int32_array); BHND_NVRAM_VAL_FMT_DECL(int64_array); BHND_NVRAM_VAL_FMT_DECL(char_array); +BHND_NVRAM_VAL_FMT_DECL(bool_array); BHND_NVRAM_VAL_FMT_DECL(string_array); +/** Shared NULL value instance */ +#define BHND_NVRAM_VAL_NULL (&bhnd_nvram_val_null) +extern bhnd_nvram_val bhnd_nvram_val_null; + #endif /* _BHND_NVRAM_BHND_NVRAM_VALUE_H_ */ Modified: head/sys/dev/bhnd/nvram/bhnd_nvram_value_fmts.c ============================================================================== --- head/sys/dev/bhnd/nvram/bhnd_nvram_value_fmts.c Mon Dec 19 20:20:33 2016 (r310292) +++ head/sys/dev/bhnd/nvram/bhnd_nvram_value_fmts.c Mon Dec 19 20:23:19 2016 (r310293) @@ -215,7 +215,10 @@ BHND_NVRAM_VAL_FMT_NATIVE(int16, INT16); BHND_NVRAM_VAL_FMT_NATIVE(int32, INT32); BHND_NVRAM_VAL_FMT_NATIVE(int64, INT64); BHND_NVRAM_VAL_FMT_NATIVE(char, CHAR); +BHND_NVRAM_VAL_FMT_NATIVE(bool, BOOL); BHND_NVRAM_VAL_FMT_NATIVE(string, STRING); +BHND_NVRAM_VAL_FMT_NATIVE(data, DATA); +BHND_NVRAM_VAL_FMT_NATIVE(null, NULL); BHND_NVRAM_VAL_FMT_NATIVE(uint8_array, UINT8_ARRAY); BHND_NVRAM_VAL_FMT_NATIVE(uint16_array, UINT16_ARRAY); @@ -226,6 +229,7 @@ BHND_NVRAM_VAL_FMT_NATIVE(int16_array, I BHND_NVRAM_VAL_FMT_NATIVE(int32_array, INT32_ARRAY); BHND_NVRAM_VAL_FMT_NATIVE(int64_array, INT64_ARRAY); BHND_NVRAM_VAL_FMT_NATIVE(char_array, CHAR_ARRAY); +BHND_NVRAM_VAL_FMT_NATIVE(bool_array, BOOL_ARRAY); BHND_NVRAM_VAL_FMT_NATIVE(string_array, STRING_ARRAY); /** Modified: head/sys/dev/bhnd/nvram/bhnd_nvram_value_subr.c ============================================================================== --- head/sys/dev/bhnd/nvram/bhnd_nvram_value_subr.c Mon Dec 19 20:20:33 2016 (r310292) +++ head/sys/dev/bhnd/nvram/bhnd_nvram_value_subr.c Mon Dec 19 20:23:19 2016 (r310293) @@ -66,6 +66,15 @@ bhnd_nvram_value_check_aligned(const voi { size_t align, width; + /* As a special case, NULL values have no alignment, but must + * always have a length of zero */ + if (itype == BHND_NVRAM_TYPE_NULL) { + if (ilen != 0) + return (EFAULT); + + return (0); + } + /* Check pointer alignment against the required host alignment */ align = bhnd_nvram_type_host_align(itype); BHND_NV_ASSERT(align != 0, ("invalid zero alignment")); @@ -119,6 +128,20 @@ bhnd_nvram_value_nelem(const void *inp, return (error); switch (itype) { + case BHND_NVRAM_TYPE_DATA: + /* Always exactly one element */ + *nelem = 1; + return (0); + + case BHND_NVRAM_TYPE_NULL: + /* Must be zero length */ + if (ilen != 0) + return (EFAULT); + + /* Always exactly one element */ + *nelem = 1; + return (0); + case BHND_NVRAM_TYPE_STRING: /* Always exactly one element */ *nelem = 1; @@ -165,7 +188,8 @@ bhnd_nvram_value_nelem(const void *inp, case BHND_NVRAM_TYPE_INT16_ARRAY: case BHND_NVRAM_TYPE_INT32_ARRAY: case BHND_NVRAM_TYPE_INT64_ARRAY: - case BHND_NVRAM_TYPE_CHAR_ARRAY: { + case BHND_NVRAM_TYPE_CHAR_ARRAY: + case BHND_NVRAM_TYPE_BOOL_ARRAY: { size_t width = bhnd_nvram_type_width(itype); BHND_NV_ASSERT(width != 0, ("invalid width")); @@ -182,6 +206,7 @@ bhnd_nvram_value_nelem(const void *inp, case BHND_NVRAM_TYPE_UINT32: case BHND_NVRAM_TYPE_INT64: case BHND_NVRAM_TYPE_UINT64: + case BHND_NVRAM_TYPE_BOOL: /* Length must be equal to the size of exactly one * element (arrays can represent zero elements -- non-array * types cannot) */ @@ -236,7 +261,8 @@ bhnd_nvram_value_size(const void *inp, s case BHND_NVRAM_TYPE_INT16_ARRAY: case BHND_NVRAM_TYPE_INT32_ARRAY: case BHND_NVRAM_TYPE_INT64_ARRAY: - case BHND_NVRAM_TYPE_CHAR_ARRAY: { + case BHND_NVRAM_TYPE_CHAR_ARRAY: + case BHND_NVRAM_TYPE_BOOL_ARRAY:{ size_t width; width = bhnd_nvram_type_width(itype); @@ -305,6 +331,18 @@ bhnd_nvram_value_size(const void *inp, s return (size); } + case BHND_NVRAM_TYPE_NULL: + return (0); + + case BHND_NVRAM_TYPE_DATA: + if (inp == NULL) + return (0); + + return (ilen); + + case BHND_NVRAM_TYPE_BOOL: + return (sizeof(bhnd_nvram_bool_t)); + case BHND_NVRAM_TYPE_INT8: case BHND_NVRAM_TYPE_UINT8: case BHND_NVRAM_TYPE_CHAR: From owner-svn-src-all@freebsd.org Mon Dec 19 20:26:12 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 437AAC8888F; Mon, 19 Dec 2016 20:26:12 +0000 (UTC) (envelope-from landonf@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 1B4EB17DC; Mon, 19 Dec 2016 20:26:12 +0000 (UTC) (envelope-from landonf@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBJKQBos056480; Mon, 19 Dec 2016 20:26:11 GMT (envelope-from landonf@FreeBSD.org) Received: (from landonf@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBJKQAHj056476; Mon, 19 Dec 2016 20:26:10 GMT (envelope-from landonf@FreeBSD.org) Message-Id: <201612192026.uBJKQAHj056476@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: landonf set sender to landonf@FreeBSD.org using -f From: "Landon J. Fuller" Date: Mon, 19 Dec 2016 20:26:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310294 - in head/sys: conf dev/bhnd/nvram modules/bhnd X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Dec 2016 20:26:12 -0000 Author: landonf Date: Mon Dec 19 20:26:10 2016 New Revision: 310294 URL: https://svnweb.freebsd.org/changeset/base/310294 Log: bhnd(4): add support for wrapping arbitrary pointers in an NVRAM I/O context. Approved by: adrian (mentor) Differential Revision: https://reviews.freebsd.org/D8759 Added: head/sys/dev/bhnd/nvram/bhnd_nvram_ioptr.c (contents, props changed) Modified: head/sys/conf/files head/sys/dev/bhnd/nvram/bhnd_nvram_io.h head/sys/modules/bhnd/Makefile Modified: head/sys/conf/files ============================================================================== --- head/sys/conf/files Mon Dec 19 20:23:19 2016 (r310293) +++ head/sys/conf/files Mon Dec 19 20:26:10 2016 (r310294) @@ -1240,6 +1240,7 @@ dev/bhnd/nvram/bhnd_nvram_data_tlv.c opt dev/bhnd/nvram/bhnd_nvram_if.m optional bhnd dev/bhnd/nvram/bhnd_nvram_io.c optional bhnd dev/bhnd/nvram/bhnd_nvram_iobuf.c optional bhnd +dev/bhnd/nvram/bhnd_nvram_ioptr.c optional bhnd dev/bhnd/nvram/bhnd_nvram_iores.c optional bhnd dev/bhnd/nvram/bhnd_nvram_plist.c optional bhnd dev/bhnd/nvram/bhnd_nvram_store.c optional bhnd Modified: head/sys/dev/bhnd/nvram/bhnd_nvram_io.h ============================================================================== --- head/sys/dev/bhnd/nvram/bhnd_nvram_io.h Mon Dec 19 20:23:19 2016 (r310293) +++ head/sys/dev/bhnd/nvram/bhnd_nvram_io.h Mon Dec 19 20:26:10 2016 (r310294) @@ -52,6 +52,9 @@ struct bhnd_nvram_io *bhnd_nvram_iobuf_c struct bhnd_nvram_io *bhnd_nvram_iobuf_copy_range(struct bhnd_nvram_io *src, size_t offset, size_t size); +struct bhnd_nvram_io *bhnd_nvram_ioptr_new(const void *ptr, size_t size, + size_t capacity, uint32_t flags); + #ifdef _KERNEL struct bhnd_nvram_io *bhnd_nvram_iores_new(struct bhnd_resource *r, bus_size_t offset, bus_size_t size, @@ -76,4 +79,12 @@ int bhnd_nvram_io_write_ptr(struct bh void bhnd_nvram_io_free(struct bhnd_nvram_io *io); +/** + * bhnd_nvram_ioptr flags + */ +enum { + BHND_NVRAM_IOPTR_RDONLY = (1<<0), /**< read-only */ + BHND_NVRAM_IOPTR_RDWR = (1<<1), /**< read/write */ +}; + #endif /* _BHND_NVRAM_BHND_NVRAM_IO_H_ */ Added: head/sys/dev/bhnd/nvram/bhnd_nvram_ioptr.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/dev/bhnd/nvram/bhnd_nvram_ioptr.c Mon Dec 19 20:26:10 2016 (r310294) @@ -0,0 +1,228 @@ +/*- + * Copyright (c) 2016 Landon Fuller + * 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, + * without modification. + * 2. Redistributions in binary form must reproduce at minimum a disclaimer + * similar to the "NO WARRANTY" disclaimer below ("Disclaimer") and any + * redistribution must be conditioned upon including a substantially + * similar Disclaimer requirement for further binary redistribution. + * + * NO WARRANTY + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF NONINFRINGEMENT, MERCHANTIBILITY + * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL + * THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR 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 DAMAGES. + */ + +#include +__FBSDID("$FreeBSD$"); + +#ifdef _KERNEL +#include +#include +#include +#else /* !_KERNEL */ +#include +#include +#include +#include +#endif /* _KERNEL */ + +#include "bhnd_nvram_private.h" + +#include "bhnd_nvram_io.h" +#include "bhnd_nvram_iovar.h" + +/** + * Memory-backed NVRAM I/O context. + * + * ioptr instances are gauranteed to provide persistent references to its + * backing contigious memory via bhnd_nvram_io_read_ptr() and + * bhnd_nvram_io_write_ptr(). + */ +struct bhnd_nvram_ioptr { + struct bhnd_nvram_io io; /**< common I/O instance state */ + void *ptr; /**< backing memory */ + size_t size; /**< size at @p ptr */ + size_t capacity; /**< capacity at @p ptr */ + uint32_t flags; /**< flags (see BHND_NVRAM_IOPTR_*) */ +}; + +BHND_NVRAM_IOPS_DEFN(ioptr) + +/** + * Allocate and return a new I/O context, mapping @p size bytes at @p ptr. + + * The caller is responsible for deallocating the returned I/O context via + * bhnd_nvram_io_free(). + * + * @param ptr The pointer to be mapped by the returned I/O + * context. Must remain valid for the lifetime of + * the returned I/O context. + * @param size The total number of bytes mapped at @p ptr. + * @param capacity The maximum number of bytes that may be mapped + * at @p ptr via bhnd_nvram_ioptr_setsize(). + * @param flags Access flags (see BHND_NVRAM_IOPTR_*). + * + * @retval bhnd_nvram_io success. + * @retval NULL allocation failed. + * @retval NULL the requested @p capacity is less than @p size. + */ +struct bhnd_nvram_io * +bhnd_nvram_ioptr_new(const void *ptr, size_t size, size_t capacity, + uint32_t flags) +{ + struct bhnd_nvram_ioptr *ioptr; + + /* Sanity check the capacity */ + if (size > capacity) + return (NULL); + + /* Allocate I/O context */ + ioptr = bhnd_nv_malloc(sizeof(*ioptr)); + if (ioptr == NULL) + return (NULL); + + ioptr->io.iops = &bhnd_nvram_ioptr_ops; + ioptr->ptr = __DECONST(void *, ptr); + ioptr->size = size; + ioptr->capacity = capacity; + ioptr->flags = flags; + + return (&ioptr->io); +} + +static void +bhnd_nvram_ioptr_free(struct bhnd_nvram_io *io) +{ + bhnd_nv_free(io); +} + +static size_t +bhnd_nvram_ioptr_getsize(struct bhnd_nvram_io *io) +{ + struct bhnd_nvram_ioptr *ioptr = (struct bhnd_nvram_ioptr *)io; + return (ioptr->size); +} + +static int +bhnd_nvram_ioptr_setsize(struct bhnd_nvram_io *io, size_t size) +{ + struct bhnd_nvram_ioptr *ioptr = (struct bhnd_nvram_ioptr *)io; + + /* Must be writable */ + if (!(ioptr->flags & BHND_NVRAM_IOPTR_RDWR)) + return (ENODEV); + + /* Can't exceed the actual capacity */ + if (size > ioptr->capacity) + return (ENXIO); + + ioptr->size = size; + return (0); +} + +/* Common ioptr_(read|write)_ptr implementation */ +static int +bhnd_nvram_ioptr_ptr(struct bhnd_nvram_ioptr *ioptr, size_t offset, void **ptr, + size_t nbytes, size_t *navail) +{ + size_t avail; + + /* Verify offset+nbytes fall within the buffer range */ + if (offset > ioptr->size) + return (ENXIO); + + avail = ioptr->size - offset; + if (avail < nbytes) + return (ENXIO); + + /* Valid I/O range, provide a pointer to the buffer and the + * total count of available bytes */ + *ptr = ((uint8_t *)ioptr->ptr) + offset; + if (navail != NULL) + *navail = avail; + + return (0); +} + +static int +bhnd_nvram_ioptr_read_ptr(struct bhnd_nvram_io *io, size_t offset, + const void **ptr, size_t nbytes, size_t *navail) +{ + struct bhnd_nvram_ioptr *ioptr; + void *writep; + int error; + + ioptr = (struct bhnd_nvram_ioptr *) io; + + /* Return a pointer into our backing buffer */ + error = bhnd_nvram_ioptr_ptr(ioptr, offset, &writep, nbytes, navail); + if (error) + return (error); + + *ptr = writep; + + return (0); +} + +static int +bhnd_nvram_ioptr_write_ptr(struct bhnd_nvram_io *io, size_t offset, + void **ptr, size_t nbytes, size_t *navail) +{ + struct bhnd_nvram_ioptr *ioptr; + + ioptr = (struct bhnd_nvram_ioptr *) io; + + /* Must be writable */ + if (!(ioptr->flags & BHND_NVRAM_IOPTR_RDWR)) + return (ENODEV); + + /* Return a pointer into our backing buffer */ + return (bhnd_nvram_ioptr_ptr(ioptr, offset, ptr, nbytes, navail)); +} + +static int +bhnd_nvram_ioptr_read(struct bhnd_nvram_io *io, size_t offset, void *buffer, + size_t nbytes) +{ + const void *ptr; + int error; + + /* Try to fetch a direct pointer for at least nbytes */ + if ((error = bhnd_nvram_io_read_ptr(io, offset, &ptr, nbytes, NULL))) + return (error); + + /* Copy out the requested data */ + memcpy(buffer, ptr, nbytes); + return (0); +} + +static int +bhnd_nvram_ioptr_write(struct bhnd_nvram_io *io, size_t offset, + void *buffer, size_t nbytes) +{ + void *ptr; + int error; + + /* Try to fetch a direct pointer for at least nbytes */ + if ((error = bhnd_nvram_io_write_ptr(io, offset, &ptr, nbytes, NULL))) + return (error); + + /* Copy in the provided data */ + memcpy(ptr, buffer, nbytes); + return (0); +} Modified: head/sys/modules/bhnd/Makefile ============================================================================== --- head/sys/modules/bhnd/Makefile Mon Dec 19 20:23:19 2016 (r310293) +++ head/sys/modules/bhnd/Makefile Mon Dec 19 20:26:10 2016 (r310294) @@ -35,6 +35,7 @@ SRCS+= bhnd_nvram_data.c \ bhnd_nvram_data_tlv.c \ bhnd_nvram_io.c \ bhnd_nvram_iobuf.c \ + bhnd_nvram_ioptr.c \ bhnd_nvram_iores.c \ bhnd_nvram_plist.c \ bhnd_nvram_store.c \ From owner-svn-src-all@freebsd.org Mon Dec 19 20:28:29 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id AD0B5C88A27; Mon, 19 Dec 2016 20:28:29 +0000 (UTC) (envelope-from landonf@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 755991BE9; Mon, 19 Dec 2016 20:28:29 +0000 (UTC) (envelope-from landonf@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBJKSS30056599; Mon, 19 Dec 2016 20:28:28 GMT (envelope-from landonf@FreeBSD.org) Received: (from landonf@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBJKSRs4056590; Mon, 19 Dec 2016 20:28:27 GMT (envelope-from landonf@FreeBSD.org) Message-Id: <201612192028.uBJKSRs4056590@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: landonf set sender to landonf@FreeBSD.org using -f From: "Landon J. Fuller" Date: Mon, 19 Dec 2016 20:28:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310295 - in head/sys: conf dev/bhnd/nvram modules/bhnd X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Dec 2016 20:28:29 -0000 Author: landonf Date: Mon Dec 19 20:28:27 2016 New Revision: 310295 URL: https://svnweb.freebsd.org/changeset/base/310295 Log: bhnd(4): NVRAM device path support. Implements bhnd_nvram_store support for parsing and operating over NVRAM device paths, and device path aliases, as well as tracking per-path NVRAM variable writes. Approved by: adrian (mentor) Differential Revision: https://reviews.freebsd.org/D8760 Added: head/sys/dev/bhnd/nvram/bhnd_nvram_store_subr.c (contents, props changed) Modified: head/sys/conf/files head/sys/dev/bhnd/nvram/bhnd_nvram_data.c head/sys/dev/bhnd/nvram/bhnd_nvram_data.h head/sys/dev/bhnd/nvram/bhnd_nvram_data_bcm.c head/sys/dev/bhnd/nvram/bhnd_nvram_data_bcmraw.c head/sys/dev/bhnd/nvram/bhnd_nvram_data_btxt.c head/sys/dev/bhnd/nvram/bhnd_nvram_data_sprom.c head/sys/dev/bhnd/nvram/bhnd_nvram_data_tlv.c head/sys/dev/bhnd/nvram/bhnd_nvram_datavar.h head/sys/dev/bhnd/nvram/bhnd_nvram_private.h head/sys/dev/bhnd/nvram/bhnd_nvram_store.c head/sys/dev/bhnd/nvram/bhnd_nvram_store.h head/sys/dev/bhnd/nvram/bhnd_nvram_storevar.h head/sys/dev/bhnd/nvram/bhnd_nvram_subr.c head/sys/modules/bhnd/Makefile Modified: head/sys/conf/files ============================================================================== --- head/sys/conf/files Mon Dec 19 20:26:10 2016 (r310294) +++ head/sys/conf/files Mon Dec 19 20:28:27 2016 (r310295) @@ -1244,6 +1244,7 @@ dev/bhnd/nvram/bhnd_nvram_ioptr.c option dev/bhnd/nvram/bhnd_nvram_iores.c optional bhnd dev/bhnd/nvram/bhnd_nvram_plist.c optional bhnd dev/bhnd/nvram/bhnd_nvram_store.c optional bhnd +dev/bhnd/nvram/bhnd_nvram_store_subr.c optional bhnd dev/bhnd/nvram/bhnd_nvram_subr.c optional bhnd dev/bhnd/nvram/bhnd_nvram_value.c optional bhnd dev/bhnd/nvram/bhnd_nvram_value_fmts.c optional bhnd Modified: head/sys/dev/bhnd/nvram/bhnd_nvram_data.c ============================================================================== --- head/sys/dev/bhnd/nvram/bhnd_nvram_data.c Mon Dec 19 20:26:10 2016 (r310294) +++ head/sys/dev/bhnd/nvram/bhnd_nvram_data.c Mon Dec 19 20:28:27 2016 (r310295) @@ -350,7 +350,26 @@ bhnd_nvram_data_caps(struct bhnd_nvram_d const char * bhnd_nvram_data_next(struct bhnd_nvram_data *nv, void **cookiep) { - return (nv->cls->op_next(nv, cookiep)); + const char *name; +#ifdef BHND_NV_INVARIANTS + void *prev = *cookiep; +#endif + + /* Fetch next */ + if ((name = nv->cls->op_next(nv, cookiep)) == NULL) + return (NULL); + + /* Enforce precedence ordering invariant between bhnd_nvram_data_next() + * and bhnd_nvram_data_getvar_order() */ +#ifdef BHND_NV_INVARIANTS + if (prev != NULL && + bhnd_nvram_data_getvar_order(nv, prev, *cookiep) > 0) + { + BHND_NV_PANIC("%s: returned out-of-order entry", __FUNCTION__); + } +#endif + + return (name); } /** @@ -388,7 +407,7 @@ bhnd_nvram_data_generic_find(struct bhnd cookiep = NULL; while ((next = bhnd_nvram_data_next(nv, &cookiep))) { - if (strcasecmp(name, next) == 0) + if (strcmp(name, next) == 0) return (cookiep); } @@ -397,6 +416,37 @@ bhnd_nvram_data_generic_find(struct bhnd } /** + * Compare the declaration order of two NVRAM variables. + * + * Variable declaration order is used to determine the current order of + * the variables in the source data, as well as to determine the precedence + * of variable declarations in data sources that define duplicate names. + * + * The comparison order will match the order of variables returned via + * bhnd_nvstore_path_data_next(). + * + * @param nv The NVRAM data. + * @param cookiep1 An NVRAM variable cookie previously + * returned via bhnd_nvram_data_next() or + * bhnd_nvram_data_find(). + * @param cookiep2 An NVRAM variable cookie previously + * returned via bhnd_nvram_data_next() or + * bhnd_nvram_data_find(). + * + * @retval <= -1 If @p cookiep1 has an earlier declaration order than + * @p cookiep2. + * @retval 0 If @p cookiep1 and @p cookiep2 are identical. + * @retval >= 1 If @p cookiep has a later declaration order than + * @p cookiep2. + */ +int +bhnd_nvram_data_getvar_order(struct bhnd_nvram_data *nv, void *cookiep1, + void *cookiep2) +{ + return (nv->cls->op_getvar_order(nv, cookiep1, cookiep2)); +} + +/** * Read a variable and decode as @p type. * * @param nv The NVRAM data. @@ -423,6 +473,58 @@ bhnd_nvram_data_getvar(struct bhnd_nvram return (nv->cls->op_getvar(nv, cookiep, buf, len, type)); } +/* + * Common bhnd_nvram_data_getvar_ptr() wrapper used by + * bhnd_nvram_data_generic_rp_getvar() and + * bhnd_nvram_data_generic_rp_copy_val(). + * + * If a variable definition for the requested variable is found via + * bhnd_nvram_find_vardefn(), the definition will be used to populate fmt. + */ +static const void * +bhnd_nvram_data_getvar_ptr_info(struct bhnd_nvram_data *nv, void *cookiep, + size_t *len, bhnd_nvram_type *type, const bhnd_nvram_val_fmt **fmt) +{ + const struct bhnd_nvram_vardefn *vdefn; + const char *name; + const void *vptr; + + BHND_NV_ASSERT(bhnd_nvram_data_caps(nv) & BHND_NVRAM_DATA_CAP_READ_PTR, + ("instance does not advertise READ_PTR support")); + + /* Fetch pointer to variable data */ + vptr = bhnd_nvram_data_getvar_ptr(nv, cookiep, len, type); + if (vptr == NULL) + return (NULL); + + /* Select a default value format implementation */ + + + /* Fetch the reference variable name */ + name = bhnd_nvram_data_getvar_name(nv, cookiep); + + /* Trim path prefix, if any; the Broadcom NVRAM format assumes a global + * namespace for all variable definitions */ + if (bhnd_nvram_data_caps(nv) & BHND_NVRAM_DATA_CAP_DEVPATHS) + name = bhnd_nvram_trim_path_name(name); + + /* Check the variable definition table for a matching entry; if + * it exists, use it to populate the value format. */ + vdefn = bhnd_nvram_find_vardefn(name); + if (vdefn != NULL) { + BHND_NV_ASSERT(vdefn->fmt != NULL, + ("NULL format for %s", name)); + *fmt = vdefn->fmt; + } else if (*type == BHND_NVRAM_TYPE_STRING) { + /* Default to Broadcom-specific string interpretation */ + *fmt = &bhnd_nvram_val_bcm_string_fmt; + } else { + /* Fall back on native formatting */ + *fmt = bhnd_nvram_val_default_fmt(*type); + } + + return (vptr); +} /** * A generic implementation of bhnd_nvram_data_getvar(). @@ -432,17 +534,15 @@ bhnd_nvram_data_getvar(struct bhnd_nvram * of the caller. * * If a variable definition for the requested variable is available via - * bhnd_nvram_find_vardefn(), the definition will be used to provide - * formatting hints to bhnd_nvram_coerce_value(). + * bhnd_nvram_find_vardefn(), the definition will be used to provide a + * formatting instance to bhnd_nvram_val_init(). */ int bhnd_nvram_data_generic_rp_getvar(struct bhnd_nvram_data *nv, void *cookiep, void *outp, size_t *olen, bhnd_nvram_type otype) { bhnd_nvram_val val; - const struct bhnd_nvram_vardefn *vdefn; const bhnd_nvram_val_fmt *fmt; - const char *name; const void *vptr; bhnd_nvram_type vtype; size_t vlen; @@ -451,28 +551,12 @@ bhnd_nvram_data_generic_rp_getvar(struct BHND_NV_ASSERT(bhnd_nvram_data_caps(nv) & BHND_NVRAM_DATA_CAP_READ_PTR, ("instance does not advertise READ_PTR support")); - /* Fetch pointer to our variable data */ - vptr = bhnd_nvram_data_getvar_ptr(nv, cookiep, &vlen, &vtype); + /* Fetch variable data and value format*/ + vptr = bhnd_nvram_data_getvar_ptr_info(nv, cookiep, &vlen, &vtype, + &fmt); if (vptr == NULL) return (EINVAL); - /* Use the NVRAM string support */ - switch (vtype) { - case BHND_NVRAM_TYPE_STRING: - case BHND_NVRAM_TYPE_STRING_ARRAY: - fmt = &bhnd_nvram_val_bcm_string_fmt; - break; - default: - fmt = NULL; - } - - /* Check the variable definition table for a matching entry; if - * it exists, use it to populate the value format. */ - name = bhnd_nvram_data_getvar_name(nv, cookiep); - vdefn = bhnd_nvram_find_vardefn(name); - if (vdefn != NULL) - fmt = vdefn->fmt; - /* Attempt value coercion */ error = bhnd_nvram_val_init(&val, fmt, vptr, vlen, vtype, BHND_NVRAM_VAL_BORROW_DATA); @@ -487,6 +571,63 @@ bhnd_nvram_data_generic_rp_getvar(struct } /** + * Return a caller-owned copy of an NVRAM entry's variable data. + * + * The caller is responsible for deallocating the returned value via + * bhnd_nvram_val_release(). + * + * @param nv The NVRAM data. + * @param cookiep An NVRAM variable cookie previously returned + * via bhnd_nvram_data_next() or bhnd_nvram_data_find(). + * @param[out] value On success, the caller-owned value instance. + * + * @retval 0 success + * @retval ENOMEM If allocation fails. + * @retval non-zero If initialization of the value otherwise fails, a + * regular unix error code will be returned. + */ +int +bhnd_nvram_data_copy_val(struct bhnd_nvram_data *nv, void *cookiep, + bhnd_nvram_val **value) +{ + return (nv->cls->op_copy_val(nv, cookiep, value)); +} + +/** + * A generic implementation of bhnd_nvram_data_copy_val(). + * + * This implementation will call bhnd_nvram_data_getvar_ptr() to fetch + * a pointer to the variable data and perform data coercion on behalf + * of the caller. + * + * If a variable definition for the requested variable is available via + * bhnd_nvram_find_vardefn(), the definition will be used to provide a + * formatting instance to bhnd_nvram_val_init(). + */ +int +bhnd_nvram_data_generic_rp_copy_val(struct bhnd_nvram_data *nv, + void *cookiep, bhnd_nvram_val **value) +{ + const bhnd_nvram_val_fmt *fmt; + const void *vptr; + bhnd_nvram_type vtype; + size_t vlen; + + BHND_NV_ASSERT(bhnd_nvram_data_caps(nv) & BHND_NVRAM_DATA_CAP_READ_PTR, + ("instance does not advertise READ_PTR support")); + + /* Fetch variable data and value format*/ + vptr = bhnd_nvram_data_getvar_ptr_info(nv, cookiep, &vlen, &vtype, + &fmt); + if (vptr == NULL) + return (EINVAL); + + /* Allocate and return the new value instance */ + return (bhnd_nvram_val_new(value, fmt, vptr, vlen, vtype, + BHND_NVRAM_VAL_DYNAMIC)); +} + +/** * If available and supported by the NVRAM data instance, return a reference * to the internal buffer containing an entry's variable data, * @@ -526,3 +667,44 @@ bhnd_nvram_data_getvar_name(struct bhnd_ { return (nv->cls->op_getvar_name(nv, cookiep)); } + +/** + * Filter a request to set variable @p name with @p value. + * + * On success, the caller owns a reference to @p result, and must release + * any held resources via bhnd_nvram_val_release(). + * + * @param nv The NVRAM data instance. + * @param name The name of the variable to be set. + * @param value The proposed value to be set. + * @param[out] result On success, a caller-owned reference to the filtered + * value to be set. + * + * @retval 0 success + * @retval ENOENT if @p name is unrecognized by @p nv. + * @retval EINVAL if @p name is read-only. + * @retval EINVAL if @p value cannot be converted to the required value + * type. + */ +int +bhnd_nvram_data_filter_setvar(struct bhnd_nvram_data *nv, const char *name, + bhnd_nvram_val *value, bhnd_nvram_val **result) +{ + return (nv->cls->op_filter_setvar(nv, name, value, result)); +} + +/** + * Filter a request to delete variable @p name. + * + * @param nv The NVRAM data instance. + * @param name The name of the variable to be deleted. + * + * @retval 0 success + * @retval ENOENT if @p name is unrecognized by @p nv. + * @retval EINVAL if @p name is read-only. + */ +int +bhnd_nvram_data_filter_unsetvar(struct bhnd_nvram_data *nv, const char *name) +{ + return (nv->cls->op_filter_unsetvar(nv, name)); +} Modified: head/sys/dev/bhnd/nvram/bhnd_nvram_data.h ============================================================================== --- head/sys/dev/bhnd/nvram/bhnd_nvram_data.h Mon Dec 19 20:26:10 2016 (r310294) +++ head/sys/dev/bhnd/nvram/bhnd_nvram_data.h Mon Dec 19 20:28:27 2016 (r310295) @@ -44,6 +44,7 @@ #include "bhnd_nvram.h" #include "bhnd_nvram_io.h" +#include "bhnd_nvram_value.h" /* NVRAM data class */ typedef struct bhnd_nvram_data_class bhnd_nvram_data_class; @@ -108,7 +109,6 @@ void bhnd_nvram_data_release(struct b bhnd_nvram_data_class *bhnd_nvram_data_get_class(struct bhnd_nvram_data *nv); size_t bhnd_nvram_data_count(struct bhnd_nvram_data *nv); - int bhnd_nvram_data_size(struct bhnd_nvram_data *nv, size_t *size); @@ -119,10 +119,13 @@ uint32_t bhnd_nvram_data_caps(struct b const char *bhnd_nvram_data_next(struct bhnd_nvram_data *nv, void **cookiep); - void *bhnd_nvram_data_find(struct bhnd_nvram_data *nv, const char *name); +int bhnd_nvram_data_getvar_order( + struct bhnd_nvram_data *nv, void *cookiep1, + void *cookiep2); + int bhnd_nvram_data_getvar(struct bhnd_nvram_data *nv, void *cookiep, void *buf, size_t *len, bhnd_nvram_type type); @@ -133,4 +136,13 @@ const void *bhnd_nvram_data_getvar_ptr( const char *bhnd_nvram_data_getvar_name(struct bhnd_nvram_data *nv, void *cookiep); +int bhnd_nvram_data_copy_val(struct bhnd_nvram_data *nv, + void *cookiep, bhnd_nvram_val **val); + +int bhnd_nvram_data_filter_setvar( + struct bhnd_nvram_data *nv, const char *name, + bhnd_nvram_val *value, bhnd_nvram_val **result); +int bhnd_nvram_data_filter_unsetvar( + struct bhnd_nvram_data *nv, const char *name); + #endif /* _BHND_NVRAM_BHND_NVRAM_DATA_H_ */ Modified: head/sys/dev/bhnd/nvram/bhnd_nvram_data_bcm.c ============================================================================== --- head/sys/dev/bhnd/nvram/bhnd_nvram_data_bcm.c Mon Dec 19 20:26:10 2016 (r310294) +++ head/sys/dev/bhnd/nvram/bhnd_nvram_data_bcm.c Mon Dec 19 20:28:27 2016 (r310295) @@ -618,7 +618,7 @@ bhnd_nvram_bcm_next(struct bhnd_nvram_da return (NULL); } - *cookiep = (void *)(uintptr_t)envp; + *cookiep = __DECONST(void *, envp); return (envp); } @@ -629,12 +629,52 @@ bhnd_nvram_bcm_find(struct bhnd_nvram_da } static int +bhnd_nvram_bcm_getvar_order(struct bhnd_nvram_data *nv, void *cookiep1, + void *cookiep2) +{ + struct bhnd_nvram_bcm *bcm; + struct bhnd_nvram_bcm_hvar *hvar1, *hvar2; + + bcm = (struct bhnd_nvram_bcm *)nv; + + hvar1 = bhnd_nvram_bcm_to_hdrvar(bcm, cookiep1); + hvar2 = bhnd_nvram_bcm_to_hdrvar(bcm, cookiep2); + + /* Header variables are always ordered below any variables defined + * in the BCM data */ + if (hvar1 != NULL && hvar2 == NULL) { + return (1); /* hvar follows non-hvar */ + } else if (hvar1 == NULL && hvar2 != NULL) { + return (-1); /* non-hvar precedes hvar */ + } + + /* Otherwise, both cookies are either hvars or non-hvars. We can + * safely fall back on pointer order, which will provide a correct + * ordering matching the behavior of bhnd_nvram_data_next() for + * both cases */ + if (cookiep1 < cookiep2) + return (-1); + + if (cookiep1 > cookiep2) + return (1); + + return (0); +} + +static int bhnd_nvram_bcm_getvar(struct bhnd_nvram_data *nv, void *cookiep, void *buf, size_t *len, bhnd_nvram_type type) { return (bhnd_nvram_data_generic_rp_getvar(nv, cookiep, buf, len, type)); } +static int +bhnd_nvram_bcm_copy_val(struct bhnd_nvram_data *nv, void *cookiep, + bhnd_nvram_val **value) +{ + return (bhnd_nvram_data_generic_rp_copy_val(nv, cookiep, value)); +} + static const void * bhnd_nvram_bcm_getvar_ptr(struct bhnd_nvram_data *nv, void *cookiep, size_t *len, bhnd_nvram_type *type) @@ -683,6 +723,35 @@ bhnd_nvram_bcm_getvar_name(struct bhnd_n return (cookiep); } +static int +bhnd_nvram_bcm_filter_setvar(struct bhnd_nvram_data *nv, const char *name, + bhnd_nvram_val *value, bhnd_nvram_val **result) +{ + bhnd_nvram_val *str; + int error; + + /* Name (trimmed of any path prefix) must be valid */ + if (!bhnd_nvram_validate_name(bhnd_nvram_trim_path_name(name))) + return (EINVAL); + + /* Value must be bcm-formatted string */ + error = bhnd_nvram_val_convert_new(&str, &bhnd_nvram_val_bcm_string_fmt, + value, BHND_NVRAM_VAL_DYNAMIC); + if (error) + return (error); + + /* Success. Transfer result ownership to the caller. */ + *result = str; + return (0); +} + +static int +bhnd_nvram_bcm_filter_unsetvar(struct bhnd_nvram_data *nv, const char *name) +{ + /* We permit deletion of any variable */ + return (0); +} + /** * Return the internal BCM data reference for a header-defined variable * with @p name, or NULL if none exists. Modified: head/sys/dev/bhnd/nvram/bhnd_nvram_data_bcmraw.c ============================================================================== --- head/sys/dev/bhnd/nvram/bhnd_nvram_data_bcmraw.c Mon Dec 19 20:26:10 2016 (r310294) +++ head/sys/dev/bhnd/nvram/bhnd_nvram_data_bcmraw.c Mon Dec 19 20:28:27 2016 (r310295) @@ -351,12 +351,32 @@ bhnd_nvram_bcmraw_find(struct bhnd_nvram } static int +bhnd_nvram_bcmraw_getvar_order(struct bhnd_nvram_data *nv, void *cookiep1, + void *cookiep2) +{ + if (cookiep1 < cookiep2) + return (-1); + + if (cookiep1 > cookiep2) + return (1); + + return (0); +} + +static int bhnd_nvram_bcmraw_getvar(struct bhnd_nvram_data *nv, void *cookiep, void *buf, size_t *len, bhnd_nvram_type type) { return (bhnd_nvram_data_generic_rp_getvar(nv, cookiep, buf, len, type)); } +static int +bhnd_nvram_bcmraw_copy_val(struct bhnd_nvram_data *nv, void *cookiep, + bhnd_nvram_val **value) +{ + return (bhnd_nvram_data_generic_rp_copy_val(nv, cookiep, value)); +} + static const void * bhnd_nvram_bcmraw_getvar_ptr(struct bhnd_nvram_data *nv, void *cookiep, size_t *len, bhnd_nvram_type *type) @@ -378,3 +398,32 @@ bhnd_nvram_bcmraw_getvar_name(struct bhn /* Cookie points to key\0value\0 */ return (cookiep); } + +static int +bhnd_nvram_bcmraw_filter_setvar(struct bhnd_nvram_data *nv, const char *name, + bhnd_nvram_val *value, bhnd_nvram_val **result) +{ + bhnd_nvram_val *str; + int error; + + /* Name (trimmed of any path prefix) must be valid */ + if (!bhnd_nvram_validate_name(bhnd_nvram_trim_path_name(name))) + return (EINVAL); + + /* Value must be bcm-formatted string */ + error = bhnd_nvram_val_convert_new(&str, &bhnd_nvram_val_bcm_string_fmt, + value, BHND_NVRAM_VAL_DYNAMIC); + if (error) + return (error); + + /* Success. Transfer result ownership to the caller. */ + *result = str; + return (0); +} + +static int +bhnd_nvram_bcmraw_filter_unsetvar(struct bhnd_nvram_data *nv, const char *name) +{ + /* We permit deletion of any variable */ + return (0); +} Modified: head/sys/dev/bhnd/nvram/bhnd_nvram_data_btxt.c ============================================================================== --- head/sys/dev/bhnd/nvram/bhnd_nvram_data_btxt.c Mon Dec 19 20:26:10 2016 (r310294) +++ head/sys/dev/bhnd/nvram/bhnd_nvram_data_btxt.c Mon Dec 19 20:28:27 2016 (r310295) @@ -77,8 +77,10 @@ union bhnd_nvram_btxt_ident { char btxt[8]; }; -static size_t bhnd_nvram_btxt_io_offset(struct bhnd_nvram_btxt *btxt, - void *cookiep); +static void *bhnd_nvram_btxt_offset_to_cookiep(struct bhnd_nvram_btxt *btxt, + size_t io_offset); +static size_t bhnd_nvram_btxt_cookiep_to_offset(struct bhnd_nvram_btxt *btxt, + void *cookiep); static int bhnd_nvram_btxt_entry_len(struct bhnd_nvram_io *io, size_t offset, size_t *line_len, size_t *env_len); @@ -322,35 +324,40 @@ bhnd_nvram_btxt_next(struct bhnd_nvram_d btxt = (struct bhnd_nvram_btxt *)nv; io_size = bhnd_nvram_io_getsize(btxt->data); - io_offset = bhnd_nvram_btxt_io_offset(btxt, *cookiep); + + if (*cookiep == NULL) { + /* Start search at initial file offset */ + io_offset = 0x0; + } else { + /* Start search after the current entry */ + io_offset = bhnd_nvram_btxt_cookiep_to_offset(btxt, *cookiep); + + /* Scan past the current entry by finding the next newline */ + error = bhnd_nvram_btxt_seek_eol(btxt->data, &io_offset); + if (error) { + BHND_NV_LOG("unexpected error in seek_eol(): %d\n", + error); + return (NULL); + } + } /* Already at EOF? */ if (io_offset == io_size) return (NULL); - /* Seek to the next entry (if any) */ - if ((error = bhnd_nvram_btxt_seek_eol(btxt->data, &io_offset))) { - BHND_NV_LOG("unexpected error in seek_eol(): %d\n", error); - return (NULL); - } - + /* Seek to the first valid entry, or EOF */ if ((error = bhnd_nvram_btxt_seek_next(btxt->data, &io_offset))) { BHND_NV_LOG("unexpected error in seek_next(): %d\n", error); return (NULL); } - /* Provide the new cookie for this offset */ - if (io_offset > UINTPTR_MAX) { - BHND_NV_LOG("io_offset > UINPTR_MAX!\n"); - return (NULL); - } - - *cookiep = (void *)(uintptr_t)io_offset; - /* Hit EOF? */ if (io_offset == io_size) return (NULL); + /* Provide the new cookie for this offset */ + *cookiep = bhnd_nvram_btxt_offset_to_cookiep(btxt, io_offset); + /* Fetch the name pointer; it must be at least 1 byte long */ error = bhnd_nvram_io_read_ptr(btxt->data, io_offset, &nptr, 1, NULL); if (error) { @@ -363,12 +370,32 @@ bhnd_nvram_btxt_next(struct bhnd_nvram_d } static int +bhnd_nvram_btxt_getvar_order(struct bhnd_nvram_data *nv, void *cookiep1, + void *cookiep2) +{ + if (cookiep1 < cookiep2) + return (-1); + + if (cookiep1 > cookiep2) + return (1); + + return (0); +} + +static int bhnd_nvram_btxt_getvar(struct bhnd_nvram_data *nv, void *cookiep, void *buf, size_t *len, bhnd_nvram_type type) { return (bhnd_nvram_data_generic_rp_getvar(nv, cookiep, buf, len, type)); } +static int +bhnd_nvram_btxt_copy_val(struct bhnd_nvram_data *nv, void *cookiep, + bhnd_nvram_val **value) +{ + return (bhnd_nvram_data_generic_rp_copy_val(nv, cookiep, value)); +} + const void * bhnd_nvram_btxt_getvar_ptr(struct bhnd_nvram_data *nv, void *cookiep, size_t *len, bhnd_nvram_type *type) @@ -383,7 +410,7 @@ bhnd_nvram_btxt_getvar_ptr(struct bhnd_n btxt = (struct bhnd_nvram_btxt *)nv; io_size = bhnd_nvram_io_getsize(btxt->data); - io_offset = bhnd_nvram_btxt_io_offset(btxt, cookiep); + io_offset = bhnd_nvram_btxt_cookiep_to_offset(btxt, cookiep); /* At EOF? */ if (io_offset == io_size) @@ -429,7 +456,7 @@ bhnd_nvram_btxt_getvar_name(struct bhnd_ btxt = (struct bhnd_nvram_btxt *)nv; io_size = bhnd_nvram_io_getsize(btxt->data); - io_offset = bhnd_nvram_btxt_io_offset(btxt, cookiep); + io_offset = bhnd_nvram_btxt_cookiep_to_offset(btxt, cookiep); /* At EOF? */ if (io_offset == io_size) @@ -444,20 +471,51 @@ bhnd_nvram_btxt_getvar_name(struct bhnd_ return (ptr); } -/* Convert cookie back to an I/O offset */ +/** + * Return a cookiep for the given I/O offset. + */ +static void * +bhnd_nvram_btxt_offset_to_cookiep(struct bhnd_nvram_btxt *btxt, + size_t io_offset) +{ + const void *ptr; + int error; + + BHND_NV_ASSERT(io_offset < bhnd_nvram_io_getsize(btxt->data), + ("io_offset %zu out-of-range", io_offset)); + BHND_NV_ASSERT(io_offset < UINTPTR_MAX, + ("io_offset %#zx exceeds UINTPTR_MAX", io_offset)); + + error = bhnd_nvram_io_read_ptr(btxt->data, 0x0, &ptr, io_offset, NULL); + if (error) + BHND_NV_PANIC("error mapping offset %zu: %d", io_offset, error); + + ptr = (const uint8_t *)ptr + io_offset; + return (__DECONST(void *, ptr)); +} + +/* Convert a cookiep back to an I/O offset */ static size_t -bhnd_nvram_btxt_io_offset(struct bhnd_nvram_btxt *btxt, void *cookiep) +bhnd_nvram_btxt_cookiep_to_offset(struct bhnd_nvram_btxt *btxt, void *cookiep) { - size_t io_size; - uintptr_t cval; + const void *ptr; + intptr_t offset; + size_t io_size; + int error; + + BHND_NV_ASSERT(cookiep != NULL, ("null cookiep")); io_size = bhnd_nvram_io_getsize(btxt->data); - cval = (uintptr_t)cookiep; + error = bhnd_nvram_io_read_ptr(btxt->data, 0x0, &ptr, io_size, NULL); + if (error) + BHND_NV_PANIC("error mapping offset %zu: %d", io_size, error); - BHND_NV_ASSERT(cval < SIZE_MAX, ("cookie > SIZE_MAX)")); - BHND_NV_ASSERT(cval <= io_size, ("cookie > io_size)")); + offset = (const uint8_t *)cookiep - (const uint8_t *)ptr; + BHND_NV_ASSERT(offset >= 0, ("invalid cookiep")); + BHND_NV_ASSERT((uintptr_t)offset < SIZE_MAX, ("cookiep > SIZE_MAX)")); + BHND_NV_ASSERT((uintptr_t)offset <= io_size, ("cookiep > io_size)")); - return ((size_t)cval); + return ((size_t)offset); } /* Determine the entry length and env 'key=value' string length of the entry @@ -584,3 +642,50 @@ bhnd_nvram_btxt_seek_next(struct bhnd_nv *offset += (p - baseptr); return (0); } + +static int +bhnd_nvram_btxt_filter_setvar(struct bhnd_nvram_data *nv, const char *name, + bhnd_nvram_val *value, bhnd_nvram_val **result) +{ + bhnd_nvram_val *str; + const char *inp; + bhnd_nvram_type itype; + size_t ilen; + int error; + + /* Name (trimmed of any path prefix) must be valid */ + if (!bhnd_nvram_validate_name(bhnd_nvram_trim_path_name(name))) + return (EINVAL); + + /* Value must be bcm-formatted string */ + error = bhnd_nvram_val_convert_new(&str, &bhnd_nvram_val_bcm_string_fmt, + value, BHND_NVRAM_VAL_DYNAMIC); + if (error) + return (error); + + /* Value string must not contain our record delimiter character ('\n'), + * or our comment character ('#') */ + inp = bhnd_nvram_val_bytes(str, &ilen, &itype); + BHND_NV_ASSERT(itype == BHND_NVRAM_TYPE_STRING, ("non-string value")); + for (size_t i = 0; i < ilen; i++) { + switch (inp[i]) { + case '\n': + case '#': + BHND_NV_LOG("invalid character (%#hhx) in value\n", + inp[i]); + bhnd_nvram_val_release(str); + return (EINVAL); + } + } + + /* Success. Transfer result ownership to the caller. */ + *result = str; + return (0); +} + +static int +bhnd_nvram_btxt_filter_unsetvar(struct bhnd_nvram_data *nv, const char *name) +{ + /* We permit deletion of any variable */ + return (0); +} Modified: head/sys/dev/bhnd/nvram/bhnd_nvram_data_sprom.c ============================================================================== --- head/sys/dev/bhnd/nvram/bhnd_nvram_data_sprom.c Mon Dec 19 20:26:10 2016 (r310294) +++ head/sys/dev/bhnd/nvram/bhnd_nvram_data_sprom.c Mon Dec 19 20:28:27 2016 (r310295) @@ -666,25 +666,34 @@ bhnd_nvram_sprom_read_offset(struct bhnd return (0); } +/** + * Common variable decoding; fetches and decodes variable to @p val, + * using @p storage for actual data storage. + * + * The returned @p val instance will hold a borrowed reference to @p storage, + * and must be copied via bhnd_nvram_val_copy() if it will be referenced beyond + * the lifetime of @p storage. + * + * The caller is responsible for releasing any allocated value state + * via bhnd_nvram_val_release(). + */ static int -bhnd_nvram_sprom_getvar(struct bhnd_nvram_data *nv, void *cookiep, void *buf, - size_t *len, bhnd_nvram_type otype) +bhnd_nvram_sprom_getvar_common(struct bhnd_nvram_data *nv, void *cookiep, + union bhnd_nvram_sprom_storage *storage, bhnd_nvram_val *val) { - bhnd_nvram_val val; struct bhnd_nvram_sprom *sp; - struct sprom_opcode_idx *idx; + struct sprom_opcode_idx *entry; const struct bhnd_nvram_vardefn *var; - union bhnd_nvram_sprom_storage storage; union bhnd_nvram_sprom_storage *inp; - union bhnd_nvram_sprom_intv intv; bhnd_nvram_type var_btype; + union bhnd_nvram_sprom_intv intv; size_t ilen, ipos, iwidth; size_t nelem; bool all_bits_set; int error; sp = (struct bhnd_nvram_sprom *)nv; - idx = cookiep; + entry = cookiep; BHND_NV_ASSERT(cookiep != NULL, ("NULL variable cookiep")); @@ -699,7 +708,7 @@ bhnd_nvram_sprom_getvar(struct bhnd_nvra * canonical NVRAM variable definition, but some SPROM layouts may * define a smaller element count. */ - if ((error = sprom_opcode_parse_var(&sp->state, idx))) { + if ((error = sprom_opcode_parse_var(&sp->state, entry))) { BHND_NV_LOG("variable evaluation failed: %d\n", error); return (error); } @@ -724,9 +733,9 @@ bhnd_nvram_sprom_getvar(struct bhnd_nvra } ilen = nelem * iwidth; - /* Decode into our own local storage. */ - inp = &storage; - if (ilen > sizeof(storage)) { + /* Decode into our caller's local storage */ + inp = storage; + if (ilen > sizeof(*storage)) { BHND_NV_LOG("error decoding '%s', SPROM_ARRAY_MAXLEN " "incorrect\n", var->name); return (EFTYPE); @@ -739,7 +748,7 @@ bhnd_nvram_sprom_getvar(struct bhnd_nvra /* * Decode the SPROM data, iteratively decoding up to nelem values. */ - if ((error = sprom_opcode_state_seek(&sp->state, idx))) { + if ((error = sprom_opcode_state_seek(&sp->state, entry))) { BHND_NV_LOG("variable seek failed: %d\n", error); return (error); } @@ -840,8 +849,9 @@ bhnd_nvram_sprom_getvar(struct bhnd_nvra /* Perform coercion of the array element */ nbyte = iwidth; - error = bhnd_nvram_value_coerce(&intv, sizeof(intv), - intv_type, ptr, &nbyte, var_btype); + error = bhnd_nvram_value_coerce(&intv.u32, + sizeof(intv.u32), intv_type, ptr, &nbyte, + var_btype); if (error) return (error); @@ -871,13 +881,45 @@ bhnd_nvram_sprom_getvar(struct bhnd_nvra if ((var->flags & BHND_NVRAM_VF_IGNALL1) && all_bits_set) return (ENOENT); + /* Provide value wrapper */ + return (bhnd_nvram_val_init(val, var->fmt, inp, ilen, var->type, + BHND_NVRAM_VAL_BORROW_DATA)); + return (error); +} + +static int +bhnd_nvram_sprom_getvar_order(struct bhnd_nvram_data *nv, void *cookiep1, + void *cookiep2) +{ + struct sprom_opcode_idx_entry *e1, *e2; + + e1 = cookiep1; + e2 = cookiep2; - /* Perform value coercion from our local representation */ - error = bhnd_nvram_val_init(&val, var->fmt, inp, ilen, var->type, - BHND_NVRAM_VAL_BORROW_DATA); + /* Use the index entry order; this matches the order of variables + * returned via bhnd_nvram_sprom_next() */ + if (e1 < e2) + return (-1); + else if (e1 > e2) + return (1); + + return (0); +} + +static int +bhnd_nvram_sprom_getvar(struct bhnd_nvram_data *nv, void *cookiep, void *buf, + size_t *len, bhnd_nvram_type otype) +{ + bhnd_nvram_val val; + union bhnd_nvram_sprom_storage storage; + int error; + + /* Decode variable to a new value instance */ + error = bhnd_nvram_sprom_getvar_common(nv, cookiep, &storage, &val); if (error) return (error); + /* Perform value coercion */ error = bhnd_nvram_val_encode(&val, buf, len, otype); /* Clean up */ @@ -885,6 +927,29 @@ bhnd_nvram_sprom_getvar(struct bhnd_nvra return (error); } +static int +bhnd_nvram_sprom_copy_val(struct bhnd_nvram_data *nv, void *cookiep, + bhnd_nvram_val **value) +{ + bhnd_nvram_val val; + union bhnd_nvram_sprom_storage storage; + int error; + + /* Decode variable to a new value instance */ + error = bhnd_nvram_sprom_getvar_common(nv, cookiep, &storage, &val); + if (error) + return (error); + + /* Attempt to copy to heap */ + *value = bhnd_nvram_val_copy(&val); + bhnd_nvram_val_release(&val); + + if (*value == NULL) + return (ENOMEM); + + return (0); +} + static const void * bhnd_nvram_sprom_getvar_ptr(struct bhnd_nvram_data *nv, void *cookiep, size_t *len, bhnd_nvram_type *type) @@ -906,6 +971,21 @@ bhnd_nvram_sprom_getvar_name(struct bhnd return (var->name); } +static int +bhnd_nvram_sprom_filter_setvar(struct bhnd_nvram_data *nv, const char *name, + bhnd_nvram_val *value, bhnd_nvram_val **result) +{ + // XXX TODO + return (ENXIO); +} + +static int +bhnd_nvram_sprom_filter_unsetvar(struct bhnd_nvram_data *nv, const char *name) +{ + // XXX TODO + return (ENXIO); +} + /** * Initialize SPROM opcode evaluation state. * Modified: head/sys/dev/bhnd/nvram/bhnd_nvram_data_tlv.c ============================================================================== --- head/sys/dev/bhnd/nvram/bhnd_nvram_data_tlv.c Mon Dec 19 20:26:10 2016 (r310294) +++ head/sys/dev/bhnd/nvram/bhnd_nvram_data_tlv.c Mon Dec 19 20:28:27 2016 (r310295) @@ -82,6 +82,10 @@ struct bhnd_nvram_tlv_env { (((_env)->hdr.size < sizeof((_env)->flags)) ? 0 : \ ((_env)->hdr.size - sizeof((_env)->flags))) +/* Maximum supported length of the envp data field, in bytes */ +#define NVRAM_TLV_ENVP_DATA_MAX_LEN \ + (UINT8_MAX - sizeof(uint8_t) /* flags */) + static int bhnd_nvram_tlv_parse_size( struct bhnd_nvram_io *io, @@ -368,12 +372,32 @@ bhnd_nvram_tlv_find(struct bhnd_nvram_da } static int +bhnd_nvram_tlv_getvar_order(struct bhnd_nvram_data *nv, void *cookiep1, + void *cookiep2) +{ + if (cookiep1 < cookiep2) + return (-1); + + if (cookiep1 > cookiep2) + return (1); + + return (0); +} + +static int bhnd_nvram_tlv_getvar(struct bhnd_nvram_data *nv, void *cookiep, void *buf, size_t *len, bhnd_nvram_type type) { return (bhnd_nvram_data_generic_rp_getvar(nv, cookiep, buf, len, type)); } +static int +bhnd_nvram_tlv_copy_val(struct bhnd_nvram_data *nv, void *cookiep, + bhnd_nvram_val **value) +{ + return (bhnd_nvram_data_generic_rp_copy_val(nv, cookiep, value)); +} + static const void * bhnd_nvram_tlv_getvar_ptr(struct bhnd_nvram_data *nv, void *cookiep, size_t *len, bhnd_nvram_type *type) @@ -417,6 +441,61 @@ bhnd_nvram_tlv_getvar_name(struct bhnd_n return (&env->envp[0]); } +static int +bhnd_nvram_tlv_filter_setvar(struct bhnd_nvram_data *nv, const char *name, + bhnd_nvram_val *value, bhnd_nvram_val **result) +{ + bhnd_nvram_val *str; + const char *inp; + bhnd_nvram_type itype; *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@freebsd.org Mon Dec 19 20:31:30 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 886C7C88DF8; Mon, 19 Dec 2016 20:31:30 +0000 (UTC) (envelope-from landonf@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 24EFC122E; Mon, 19 Dec 2016 20:31:30 +0000 (UTC) (envelope-from landonf@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBJKVTm5057615; Mon, 19 Dec 2016 20:31:29 GMT (envelope-from landonf@FreeBSD.org) Received: (from landonf@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBJKVSkP057602; Mon, 19 Dec 2016 20:31:28 GMT (envelope-from landonf@FreeBSD.org) Message-Id: <201612192031.uBJKVSkP057602@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: landonf set sender to landonf@FreeBSD.org using -f From: "Landon J. Fuller" Date: Mon, 19 Dec 2016 20:31:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310296 - head/sys/dev/bhnd/nvram X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Dec 2016 20:31:30 -0000 Author: landonf Date: Mon Dec 19 20:31:27 2016 New Revision: 310296 URL: https://svnweb.freebsd.org/changeset/base/310296 Log: bhnd(4): Add support for exporting all (or a subtree) of NVRAM properties backed by an NVRAM store. This will be used to support: - Serializing the current NVRAM state for writing back to flash. - Exporting subsidiary device paths for serialization and upload to fullmac chipsets. Additionally, this includes an improvement to BCM-RAW format detection to avoid matching on BCM-TEXT NVRAM data. Approved by: adrian (mentor) Differential Revision: https://reviews.freebsd.org/D8761 Modified: head/sys/dev/bhnd/nvram/bhnd_nvram_data.c head/sys/dev/bhnd/nvram/bhnd_nvram_data.h head/sys/dev/bhnd/nvram/bhnd_nvram_data_bcm.c head/sys/dev/bhnd/nvram/bhnd_nvram_data_bcmraw.c head/sys/dev/bhnd/nvram/bhnd_nvram_data_bcmvar.h head/sys/dev/bhnd/nvram/bhnd_nvram_data_btxt.c head/sys/dev/bhnd/nvram/bhnd_nvram_data_sprom.c head/sys/dev/bhnd/nvram/bhnd_nvram_data_tlv.c head/sys/dev/bhnd/nvram/bhnd_nvram_datavar.h head/sys/dev/bhnd/nvram/bhnd_nvram_store.c head/sys/dev/bhnd/nvram/bhnd_nvram_store.h head/sys/dev/bhnd/nvram/bhnd_nvram_store_subr.c head/sys/dev/bhnd/nvram/bhnd_nvram_storevar.h Modified: head/sys/dev/bhnd/nvram/bhnd_nvram_data.c ============================================================================== --- head/sys/dev/bhnd/nvram/bhnd_nvram_data.c Mon Dec 19 20:28:27 2016 (r310295) +++ head/sys/dev/bhnd/nvram/bhnd_nvram_data.c Mon Dec 19 20:31:27 2016 (r310296) @@ -281,6 +281,18 @@ bhnd_nvram_data_count(struct bhnd_nvram_ } /** + * Return a borrowed reference to the serialization options for @p nv, + * suitable for use with bhnd_nvram_data_serialize(), or NULL if none. + * + * @param nv The NVRAM data to be queried. + */ +bhnd_nvram_plist * +bhnd_nvram_data_options(struct bhnd_nvram_data *nv) +{ + return (nv->cls->op_options(nv)); +} + +/** * Compute the size of the serialized form of @p nv. * * Serialization may be performed via bhnd_nvram_data_serialize(). Modified: head/sys/dev/bhnd/nvram/bhnd_nvram_data.h ============================================================================== --- head/sys/dev/bhnd/nvram/bhnd_nvram_data.h Mon Dec 19 20:28:27 2016 (r310295) +++ head/sys/dev/bhnd/nvram/bhnd_nvram_data.h Mon Dec 19 20:31:27 2016 (r310296) @@ -44,6 +44,7 @@ #include "bhnd_nvram.h" #include "bhnd_nvram_io.h" +#include "bhnd_nvram_plist.h" #include "bhnd_nvram_value.h" /* NVRAM data class */ @@ -115,6 +116,7 @@ int bhnd_nvram_data_size(struct bhnd_ int bhnd_nvram_data_serialize(struct bhnd_nvram_data *nv, void *buf, size_t *len); +bhnd_nvram_plist *bhnd_nvram_data_options(struct bhnd_nvram_data *nv); uint32_t bhnd_nvram_data_caps(struct bhnd_nvram_data *nv); const char *bhnd_nvram_data_next(struct bhnd_nvram_data *nv, Modified: head/sys/dev/bhnd/nvram/bhnd_nvram_data_bcm.c ============================================================================== --- head/sys/dev/bhnd/nvram/bhnd_nvram_data_bcm.c Mon Dec 19 20:28:27 2016 (r310295) +++ head/sys/dev/bhnd/nvram/bhnd_nvram_data_bcm.c Mon Dec 19 20:31:27 2016 (r310296) @@ -121,6 +121,7 @@ static const struct bhnd_nvram_bcm_hvar struct bhnd_nvram_bcm { struct bhnd_nvram_data nv; /**< common instance state */ struct bhnd_nvram_io *data; /**< backing buffer */ + bhnd_nvram_plist *opts; /**< serialization options */ /** BCM header values */ struct bhnd_nvram_bcm_hvar hvars[nitems(bhnd_nvram_bcm_hvars)]; @@ -157,7 +158,7 @@ bhnd_nvram_bcm_init(struct bhnd_nvram_bc uint8_t *p; void *ptr; size_t io_offset, io_size; - uint8_t crc, valid; + uint8_t crc, valid, bcm_ver; int error; if ((error = bhnd_nvram_io_read(src, 0x0, &hdr, sizeof(hdr)))) @@ -344,6 +345,14 @@ bhnd_nvram_bcm_init(struct bhnd_nvram_bc bcm->count++; } + /* Populate serialization options from our header */ + bcm_ver = BCM_NVRAM_GET_BITS(hdr.cfg0, BCM_NVRAM_CFG0_VER); + error = bhnd_nvram_plist_append_bytes(bcm->opts, + BCM_NVRAM_ENCODE_OPT_VERSION, &bcm_ver, sizeof(bcm_ver), + BHND_NVRAM_TYPE_UINT8); + if (error) + return (error); + return (0); } @@ -360,6 +369,12 @@ bhnd_nvram_bcm_new(struct bhnd_nvram_dat "hvar declarations must match bhnd_nvram_bcm_hvars template"); memcpy(bcm->hvars, bhnd_nvram_bcm_hvars, sizeof(bcm->hvars)); + /* Allocate (empty) option list, to be populated by + * bhnd_nvram_bcm_init() */ + bcm->opts = bhnd_nvram_plist_new(); + if (bcm->opts == NULL) + return (ENOMEM); + /* Parse the BCM input data and initialize our backing * data representation */ if ((error = bhnd_nvram_bcm_init(bcm, io))) { @@ -377,6 +392,9 @@ bhnd_nvram_bcm_free(struct bhnd_nvram_da if (bcm->data != NULL) bhnd_nvram_io_free(bcm->data); + + if (bcm->opts != NULL) + bhnd_nvram_plist_release(bcm->opts); } size_t @@ -386,6 +404,13 @@ bhnd_nvram_bcm_count(struct bhnd_nvram_d return (bcm->count); } +static bhnd_nvram_plist * +bhnd_nvram_bcm_options(struct bhnd_nvram_data *nv) +{ + struct bhnd_nvram_bcm *bcm = (struct bhnd_nvram_bcm *)nv; + return (bcm->opts); +} + static int bhnd_nvram_bcm_size(struct bhnd_nvram_data *nv, size_t *size) { Modified: head/sys/dev/bhnd/nvram/bhnd_nvram_data_bcmraw.c ============================================================================== --- head/sys/dev/bhnd/nvram/bhnd_nvram_data_bcmraw.c Mon Dec 19 20:28:27 2016 (r310295) +++ head/sys/dev/bhnd/nvram/bhnd_nvram_data_bcmraw.c Mon Dec 19 20:31:27 2016 (r310296) @@ -79,19 +79,19 @@ bhnd_nvram_bcmraw_probe(struct bhnd_nvra { char envp[16]; size_t envp_len; + size_t io_size; int error; + io_size = bhnd_nvram_io_getsize(io); + /* - * Fetch the initial bytes to try to identify BCM data. - * - * We always assert a low probe priority, as we only scan the initial - * bytes of the file. + * Fetch initial bytes */ - envp_len = bhnd_nv_ummin(sizeof(envp), bhnd_nvram_io_getsize(io)); + envp_len = bhnd_nv_ummin(sizeof(envp), io_size); if ((error = bhnd_nvram_io_read(io, 0x0, envp, envp_len))) return (error); - /* A zero-length BCM-RAW buffer should contain a single terminating + /* An empty BCM-RAW buffer should still contain a single terminating * NUL */ if (envp_len == 0) return (ENXIO); @@ -103,21 +103,33 @@ bhnd_nvram_bcmraw_probe(struct bhnd_nvra return (BHND_NVRAM_DATA_PROBE_MAYBE); } - /* Don't match on non-ASCII, non-printable data */ + /* Must contain only printable ASCII characters delimited + * by NUL record delimiters */ for (size_t i = 0; i < envp_len; i++) { char c = envp[i]; - if (envp[i] == '\0') - break; - if (!bhnd_nv_isprint(c)) + /* If we hit a newline, this is probably BCM-TXT */ + if (c == '\n') return (ENXIO); + + if (c == '\0' && !bhnd_nv_isprint(c)) + continue; } - /* The first character should be a valid key char */ - if (!bhnd_nv_isalpha(envp[0])) + /* A valid BCM-RAW buffer should contain a terminating NUL for + * the last record, followed by a final empty record terminated by + * NUL */ + envp_len = 2; + if (io_size < envp_len) + return (ENXIO); + + if ((error = bhnd_nvram_io_read(io, io_size-envp_len, envp, envp_len))) + return (error); + + if (envp[0] != '\0' || envp[1] != '\0') return (ENXIO); - return (BHND_NVRAM_DATA_PROBE_MAYBE); + return (BHND_NVRAM_DATA_PROBE_MAYBE + 1); } /** @@ -245,6 +257,12 @@ bhnd_nvram_bcmraw_count(struct bhnd_nvra return (bcm->count); } +static bhnd_nvram_plist * +bhnd_nvram_bcmraw_options(struct bhnd_nvram_data *nv) +{ + return (NULL); +} + static int bhnd_nvram_bcmraw_size(struct bhnd_nvram_data *nv, size_t *size) { Modified: head/sys/dev/bhnd/nvram/bhnd_nvram_data_bcmvar.h ============================================================================== --- head/sys/dev/bhnd/nvram/bhnd_nvram_data_bcmvar.h Mon Dec 19 20:28:27 2016 (r310295) +++ head/sys/dev/bhnd/nvram/bhnd_nvram_data_bcmvar.h Mon Dec 19 20:31:27 2016 (r310296) @@ -32,6 +32,8 @@ #ifndef _BHND_NVRAM_BHND_NVRAM_BCMVAR_H_ #define _BHND_NVRAM_BHND_NVRAM_BCMVAR_H_ +#define BCM_NVRAM_ENCODE_OPT_VERSION "bcm_version" + /** * BCM NVRAM header value data. */ Modified: head/sys/dev/bhnd/nvram/bhnd_nvram_data_btxt.c ============================================================================== --- head/sys/dev/bhnd/nvram/bhnd_nvram_data_btxt.c Mon Dec 19 20:28:27 2016 (r310295) +++ head/sys/dev/bhnd/nvram/bhnd_nvram_data_btxt.c Mon Dec 19 20:31:27 2016 (r310296) @@ -255,6 +255,12 @@ bhnd_nvram_btxt_count(struct bhnd_nvram_ return (btxt->count); } +static bhnd_nvram_plist * +bhnd_nvram_btxt_options(struct bhnd_nvram_data *nv) +{ + return (NULL); +} + static int bhnd_nvram_btxt_size(struct bhnd_nvram_data *nv, size_t *size) { Modified: head/sys/dev/bhnd/nvram/bhnd_nvram_data_sprom.c ============================================================================== --- head/sys/dev/bhnd/nvram/bhnd_nvram_data_sprom.c Mon Dec 19 20:28:27 2016 (r310295) +++ head/sys/dev/bhnd/nvram/bhnd_nvram_data_sprom.c Mon Dec 19 20:31:27 2016 (r310296) @@ -416,6 +416,12 @@ bhnd_nvram_sprom_free(struct bhnd_nvram_ bhnd_nv_free(sp->idx); } +static bhnd_nvram_plist * +bhnd_nvram_sprom_options(struct bhnd_nvram_data *nv) +{ + return (NULL); +} + size_t bhnd_nvram_sprom_count(struct bhnd_nvram_data *nv) { Modified: head/sys/dev/bhnd/nvram/bhnd_nvram_data_tlv.c ============================================================================== --- head/sys/dev/bhnd/nvram/bhnd_nvram_data_tlv.c Mon Dec 19 20:28:27 2016 (r310295) +++ head/sys/dev/bhnd/nvram/bhnd_nvram_data_tlv.c Mon Dec 19 20:31:27 2016 (r310296) @@ -256,6 +256,12 @@ bhnd_nvram_tlv_count(struct bhnd_nvram_d return (tlv->count); } +static bhnd_nvram_plist * +bhnd_nvram_tlv_options(struct bhnd_nvram_data *nv) +{ + return (NULL); +} + static int bhnd_nvram_tlv_size(struct bhnd_nvram_data *nv, size_t *size) { @@ -350,17 +356,26 @@ bhnd_nvram_tlv_next(struct bhnd_nvram_da tlv = (struct bhnd_nvram_tlv *)nv; - /* Seek past the TLV_ENV record referenced by cookiep */ - io_offset = bhnd_nvram_tlv_to_offset(tlv, *cookiep); - if (bhnd_nvram_tlv_next_env(tlv, &io_offset, NULL) == NULL) - BHND_NV_PANIC("invalid cookiep: %p\n", cookiep); - - /* Fetch the next TLV_ENV record */ - if ((env = bhnd_nvram_tlv_next_env(tlv, &io_offset, cookiep)) == NULL) { - /* No remaining ENV records */ - return (NULL); + /* Find next readable TLV record */ + if (*cookiep == NULL) { + /* Start search at offset 0x0 */ + io_offset = 0x0; + env = bhnd_nvram_tlv_next_env(tlv, &io_offset, cookiep); + } else { + /* Seek past the previous env record */ + io_offset = bhnd_nvram_tlv_to_offset(tlv, *cookiep); + env = bhnd_nvram_tlv_next_env(tlv, &io_offset, NULL); + if (env == NULL) + BHND_NV_PANIC("invalid cookiep; record missing"); + + /* Advance to next env record, update the caller's cookiep */ + env = bhnd_nvram_tlv_next_env(tlv, &io_offset, cookiep); } + /* Check for EOF */ + if (env == NULL) + return (NULL); + /* Return the NUL terminated name */ return (env->envp); } Modified: head/sys/dev/bhnd/nvram/bhnd_nvram_datavar.h ============================================================================== --- head/sys/dev/bhnd/nvram/bhnd_nvram_datavar.h Mon Dec 19 20:28:27 2016 (r310295) +++ head/sys/dev/bhnd/nvram/bhnd_nvram_datavar.h Mon Dec 19 20:31:27 2016 (r310296) @@ -75,6 +75,10 @@ typedef int (bhnd_nvram_data_op_serial struct bhnd_nvram_data *nv, void *buf, size_t *len); +/** @see bhnd_nvram_data_options() */ +typedef bhnd_nvram_plist*(bhnd_nvram_data_op_options)( + struct bhnd_nvram_data *nv); + /** @see bhnd_nvram_data_caps() */ typedef uint32_t (bhnd_nvram_data_op_caps)(struct bhnd_nvram_data *nv); @@ -133,6 +137,7 @@ struct bhnd_nvram_data_class { bhnd_nvram_data_op_count *op_count; bhnd_nvram_data_op_size *op_size; bhnd_nvram_data_op_serialize *op_serialize; + bhnd_nvram_data_op_options *op_options; bhnd_nvram_data_op_caps *op_caps; bhnd_nvram_data_op_next *op_next; bhnd_nvram_data_op_find *op_find; @@ -186,6 +191,7 @@ struct bhnd_nvram_data { _macro(_cname, count) \ _macro(_cname, size) \ _macro(_cname, serialize) \ + _macro(_cname, options) \ _macro(_cname, caps) \ _macro(_cname, next) \ _macro(_cname, find) \ Modified: head/sys/dev/bhnd/nvram/bhnd_nvram_store.c ============================================================================== --- head/sys/dev/bhnd/nvram/bhnd_nvram_store.c Mon Dec 19 20:28:27 2016 (r310295) +++ head/sys/dev/bhnd/nvram/bhnd_nvram_store.c Mon Dec 19 20:31:27 2016 (r310296) @@ -71,6 +71,26 @@ static int bhnd_nvstore_parse_data( static int bhnd_nvstore_parse_path_entries( struct bhnd_nvram_store *sc); +static int bhnd_nvram_store_export_child( + struct bhnd_nvram_store *sc, + bhnd_nvstore_path *top, + bhnd_nvstore_path *child, + bhnd_nvram_plist *plist, + uint32_t flags); + +static int bhnd_nvstore_export_merge( + struct bhnd_nvram_store *sc, + bhnd_nvstore_path *path, + bhnd_nvram_plist *merged, + uint32_t flags); + +static int bhnd_nvstore_export_devpath_alias( + struct bhnd_nvram_store *sc, + bhnd_nvstore_path *path, + const char *devpath, + bhnd_nvram_plist *plist, + u_long *alias_val); + /** * Allocate and initialize a new NVRAM data store instance. * @@ -114,6 +134,16 @@ bhnd_nvram_store_new(struct bhnd_nvram_s /* Retain the NVRAM data */ sc->data = bhnd_nvram_data_retain(data); sc->data_caps = bhnd_nvram_data_caps(data); + sc->data_opts = bhnd_nvram_data_options(data); + if (sc->data_opts != NULL) { + bhnd_nvram_plist_retain(sc->data_opts); + } else { + sc->data_opts = bhnd_nvram_plist_new(); + if (sc->data_opts == NULL) { + error = ENOMEM; + goto cleanup; + } + } /* Register required root path */ error = bhnd_nvstore_register_path(sc, BHND_NVSTORE_ROOT_PATH, @@ -207,6 +237,8 @@ bhnd_nvram_store_free(struct bhnd_nvram_ if (sc->data != NULL) bhnd_nvram_data_release(sc->data); + if (sc->data_opts != NULL) + bhnd_nvram_plist_release(sc->data_opts); BHND_NVSTORE_LOCK_DESTROY(sc); bhnd_nv_free(sc); @@ -400,6 +432,571 @@ bhnd_nvstore_parse_path_entries(struct b return (0); } + + +/** + * Merge exported per-path variables (uncommitted, committed, or both) into + * the empty @p merged property list. + * + * @param sc The NVRAM store instance. + * @param path The NVRAM path to be exported. + * @param merged The property list to populate with the merged results. + * @param flags Export flags. See BHND_NVSTORE_EXPORT_*. + * + * @retval 0 success + * @retval ENOMEM If allocation fails. + * @retval non-zero If merging the variables defined in @p path otherwise + * fails, a regular unix error code will be returned. + */ +static int +bhnd_nvstore_export_merge(struct bhnd_nvram_store *sc, + bhnd_nvstore_path *path, bhnd_nvram_plist *merged, uint32_t flags) +{ + void *cookiep, *idxp; + int error; + + /* Populate merged list with all pending variables */ + if (BHND_NVSTORE_GET_FLAG(flags, EXPORT_UNCOMMITTED)) { + bhnd_nvram_prop *prop; + + prop = NULL; + while ((prop = bhnd_nvram_plist_next(path->pending, prop))) { + /* Skip variables marked for deletion */ + if (!BHND_NVSTORE_GET_FLAG(flags, EXPORT_DELETED)) { + if (bhnd_nvram_prop_is_null(prop)) + continue; + } + + /* Append to merged list */ + error = bhnd_nvram_plist_append(merged, prop); + if (error) + return (error); + } + } + + /* Skip merging committed variables? */ + if (!BHND_NVSTORE_GET_FLAG(flags, EXPORT_COMMITTED)) + return (0); + + /* Merge in the committed NVRAM variables */ + idxp = NULL; + while ((cookiep = bhnd_nvstore_path_data_next(sc, path, &idxp))) { + const char *name; + bhnd_nvram_val *val; + + /* Fetch the variable name */ + name = bhnd_nvram_data_getvar_name(sc->data, cookiep); + + /* Trim device path prefix */ + if (sc->data_caps & BHND_NVRAM_DATA_CAP_DEVPATHS) + name = bhnd_nvram_trim_path_name(name); + + /* Skip if already defined in pending updates */ + if (BHND_NVSTORE_GET_FLAG(flags, EXPORT_UNCOMMITTED)) { + if (bhnd_nvram_plist_contains(path->pending, name)) + continue; + } + + /* Skip if higher precedence value was already defined. This + * may occur if the underlying data store contains duplicate + * keys; iteration will always return the definition with + * the highest precedence first */ + if (bhnd_nvram_plist_contains(merged, name)) + continue; + + /* Fetch the variable's value representation */ + if ((error = bhnd_nvram_data_copy_val(sc->data, cookiep, &val))) + return (error); + + /* Add to path variable list */ + error = bhnd_nvram_plist_append_val(merged, name, val); + bhnd_nvram_val_release(val); + if (error) + return (error); + } + + return (0); +} + +/** + * Find a free alias value for @p path, and append the devpathXX alias + * declaration to @p plist. + * + * @param sc The NVRAM store instance. + * @param path The NVRAM path for which a devpath alias + * variable should be produced. + * @param devpath The devpathXX path value for @p path. + * @param plist The property list to which @p path's devpath + * variable will be appended. + * @param[out] alias_val On success, will be set to the alias value + * allocated for @p path. + * + * @retval 0 success + * @retval ENOMEM If allocation fails. + * @retval non-zero If merging the variables defined in @p path otherwise + * fails, a regular unix error code will be returned. + */ +static int +bhnd_nvstore_export_devpath_alias(struct bhnd_nvram_store *sc, + bhnd_nvstore_path *path, const char *devpath, bhnd_nvram_plist *plist, + u_long *alias_val) +{ + bhnd_nvstore_alias *alias; + char *pathvar; + int error; + + *alias_val = 0; + + /* Prefer alias value already reserved for this path. */ + alias = bhnd_nvstore_find_alias(sc, path->path_str); + if (alias != NULL) { + *alias_val = alias->alias; + + /* Allocate devpathXX variable name */ + bhnd_nv_asprintf(&pathvar, "devpath%lu", *alias_val); + if (pathvar == NULL) + return (ENOMEM); + + /* Append alias variable to property list */ + error = bhnd_nvram_plist_append_string(plist, pathvar, devpath); + + BHND_NV_ASSERT(error != EEXIST, ("reserved alias %lu:%s in use", + * alias_val, path->path_str)); + + bhnd_nv_free(pathvar); + return (error); + } + + /* Find the next free devpathXX alias entry */ + while (1) { + /* Skip existing reserved alias values */ + while (bhnd_nvstore_get_alias(sc, *alias_val) != NULL) { + if (*alias_val == ULONG_MAX) + return (ENOMEM); + + (*alias_val)++; + } + + /* Allocate devpathXX variable name */ + bhnd_nv_asprintf(&pathvar, "devpath%lu", *alias_val); + if (pathvar == NULL) + return (ENOMEM); + + /* If not in-use, we can terminate the search */ + if (!bhnd_nvram_plist_contains(plist, pathvar)) + break; + + /* Keep searching */ + bhnd_nv_free(pathvar); + + if (*alias_val == ULONG_MAX) + return (ENOMEM); + + (*alias_val)++; + } + + /* Append alias variable to property list */ + error = bhnd_nvram_plist_append_string(plist, pathvar, devpath); + + bhnd_nv_free(pathvar); + return (error); +} + +/** + * Export a single @p child path's properties, appending the result to @p plist. + * + * @param sc The NVRAM store instance. + * @param top The root NVRAM path being exported. + * @param child The NVRAM path to be exported. + * @param plist The property list to which @p child's exported + * properties should be appended. + * @param flags Export flags. See BHND_NVSTORE_EXPORT_*. + * + * @retval 0 success + * @retval ENOMEM If allocation fails. + * @retval non-zero If merging the variables defined in @p path otherwise + * fails, a regular unix error code will be returned. + */ +static int +bhnd_nvram_store_export_child(struct bhnd_nvram_store *sc, + bhnd_nvstore_path *top, bhnd_nvstore_path *child, bhnd_nvram_plist *plist, + uint32_t flags) +{ + bhnd_nvram_plist *path_vars; + bhnd_nvram_prop *prop; + const char *relpath; + char *prefix, *namebuf; + size_t prefix_len, relpath_len; + size_t namebuf_size, num_props; + bool emit_compact_devpath; + int error; + + BHND_NVSTORE_LOCK_ASSERT(sc, MA_OWNED); + + prefix = NULL; + num_props = 0; + path_vars = NULL; + namebuf = NULL; + + /* Determine the path relative to the top-level path */ + relpath = bhnd_nvstore_parse_relpath(top->path_str, child->path_str); + if (relpath == NULL) { + /* Skip -- not a child of the root path */ + return (0); + } + relpath_len = strlen(relpath); + + /* Skip sub-path if export of children was not requested, */ + if (!BHND_NVSTORE_GET_FLAG(flags, EXPORT_CHILDREN) && relpath_len > 0) + return (0); + + /* Collect all variables to be included in the export */ + if ((path_vars = bhnd_nvram_plist_new()) == NULL) + return (ENOMEM); + + if ((error = bhnd_nvstore_export_merge(sc, child, path_vars, flags))) { + bhnd_nvram_plist_release(path_vars); + return (error); + } + + /* Skip if no children are to be exported */ + if (bhnd_nvram_plist_count(path_vars) == 0) { + bhnd_nvram_plist_release(path_vars); + return (0); + } + + /* Determine appropriate device path encoding */ + emit_compact_devpath = false; + if (BHND_NVSTORE_GET_FLAG(flags, EXPORT_COMPACT_DEVPATHS)) { + /* Re-encode as compact (if non-empty path) */ + if (relpath_len > 0) + emit_compact_devpath = true; + } else if (BHND_NVSTORE_GET_FLAG(flags, EXPORT_EXPAND_DEVPATHS)) { + /* Re-encode with fully expanded device path */ + emit_compact_devpath = false; + } else if (BHND_NVSTORE_GET_FLAG(flags, EXPORT_PRESERVE_DEVPATHS)) { + /* Preserve existing encoding of this path */ + if (bhnd_nvstore_find_alias(sc, child->path_str) != NULL) + emit_compact_devpath = true; + } else { + BHND_NV_LOG("invalid device path flag: %#" PRIx32, flags); + error = EINVAL; + goto finished; + } + + /* Allocate variable device path prefix to use for all property names, + * and if using compact encoding, emit the devpathXX= variable */ + prefix = NULL; + prefix_len = 0; + if (emit_compact_devpath) { + u_long alias_val; + int len; + + /* Reserve an alias value and append the devpathXX= variable to + * the property list */ + error = bhnd_nvstore_export_devpath_alias(sc, child, relpath, + plist, &alias_val); + if (error) + goto finished; + + /* Allocate variable name prefix */ + len = bhnd_nv_asprintf(&prefix, "%lu:", alias_val); + if (prefix == NULL) { + error = ENOMEM; + goto finished; + } + + prefix_len = len; + } else if (relpath_len > 0) { + int len; + + /* Allocate the variable name prefix, appending '/' to the + * relative path */ + len = bhnd_nv_asprintf(&prefix, "%s/", relpath); + if (prefix == NULL) { + error = ENOMEM; + goto finished; + } + + prefix_len = len; + } + + /* If prefixing of variable names is required, allocate a name + * formatting buffer */ + namebuf_size = 0; + if (prefix != NULL) { + size_t maxlen; + + /* Find the maximum name length */ + maxlen = 0; + prop = NULL; + while ((prop = bhnd_nvram_plist_next(path_vars, prop))) { + const char *name; + + name = bhnd_nvram_prop_name(prop); + maxlen = bhnd_nv_ummax(strlen(name), maxlen); + } + + /* Allocate name buffer (path-prefix + name + '\0') */ + namebuf_size = prefix_len + maxlen + 1; + namebuf = bhnd_nv_malloc(namebuf_size); + if (namebuf == NULL) { + error = ENOMEM; + goto finished; + } + } + + /* Append all path variables to the export plist, prepending the + * device-path prefix to the variable names, if required */ + prop = NULL; + while ((prop = bhnd_nvram_plist_next(path_vars, prop)) != NULL) { + const char *name; + + /* Prepend device prefix to the variable name */ + name = bhnd_nvram_prop_name(prop); + if (prefix != NULL) { + int len; + + /* + * Write prefixed variable name to our name buffer. + * + * We precalcuate the size when scanning all names + * above, so this should always succeed. + */ + len = snprintf(namebuf, namebuf_size, "%s%s", prefix, + name); + if (len < 0 || (size_t)len >= namebuf_size) + BHND_NV_PANIC("invalid max_name_len"); + + name = namebuf; + } + + /* Add property to export plist */ + error = bhnd_nvram_plist_append_val(plist, name, + bhnd_nvram_prop_val(prop)); + if (error) + goto finished; + } + + /* Success */ + error = 0; + +finished: + if (prefix != NULL) + bhnd_nv_free(prefix); + + if (namebuf != NULL) + bhnd_nv_free(namebuf); + + if (path_vars != NULL) + bhnd_nvram_plist_release(path_vars); + + return (error); +} + +/** + * Export a flat, ordered NVRAM property list representation of all NVRAM + * properties at @p path. + * + * @param sc The NVRAM store instance. + * @param path The NVRAM path to export, or NULL to select the root + * path. + * @param[out] cls On success, will be set to the backing data class + * of @p sc. If the data class is are not desired, + * a NULL pointer may be provided. + * @param[out] props On success, will be set to a caller-owned property + * list containing the exported properties. The caller is + * responsible for releasing this value via + * bhnd_nvram_plist_release(). + * @param[out] options On success, will be set to a caller-owned property + * list containing the current NVRAM serialization options + * for @p sc. The caller is responsible for releasing this + * value via bhnd_nvram_plist_release(). + * @param flags Export flags. See BHND_NVSTORE_EXPORT_*. + * + * @retval 0 success + * @retval EINVAL If @p flags is invalid. + * @retval ENOENT The requested path was not found. + * @retval ENOMEM If allocation fails. + * @retval non-zero If export of @p path otherwise fails, a regular unix + * error code will be returned. + */ +int +bhnd_nvram_store_export(struct bhnd_nvram_store *sc, const char *path, + bhnd_nvram_data_class **cls, bhnd_nvram_plist **props, + bhnd_nvram_plist **options, uint32_t flags) +{ + bhnd_nvram_plist *unordered; + bhnd_nvstore_path *top; + bhnd_nvram_prop *prop; + const char *name; + void *cookiep; + size_t num_dpath_flags; + int error; + + *props = NULL; + unordered = NULL; + num_dpath_flags = 0; + if (options != NULL) + *options = NULL; + + /* Default to exporting root path */ + if (path == NULL) + path = BHND_NVSTORE_ROOT_PATH; + + /* Default to exporting all properties */ + if (!BHND_NVSTORE_GET_FLAG(flags, EXPORT_COMMITTED) && + !BHND_NVSTORE_GET_FLAG(flags, EXPORT_UNCOMMITTED)) + { + flags |= BHND_NVSTORE_EXPORT_ALL_VARS; + } + + /* Default to preserving the current device path encoding */ + if (!BHND_NVSTORE_GET_FLAG(flags, EXPORT_COMPACT_DEVPATHS) && + !BHND_NVSTORE_GET_FLAG(flags, EXPORT_EXPAND_DEVPATHS)) + { + flags |= BHND_NVSTORE_EXPORT_PRESERVE_DEVPATHS; + } + + /* Exactly one device path encoding flag must be set */ + if (BHND_NVSTORE_GET_FLAG(flags, EXPORT_COMPACT_DEVPATHS)) + num_dpath_flags++; + + if (BHND_NVSTORE_GET_FLAG(flags, EXPORT_EXPAND_DEVPATHS)) + num_dpath_flags++; + + if (BHND_NVSTORE_GET_FLAG(flags, EXPORT_PRESERVE_DEVPATHS)) + num_dpath_flags++; + + if (num_dpath_flags != 1) + return (EINVAL); + + /* If EXPORT_DELETED is set, EXPORT_UNCOMMITTED must be set too */ + if (BHND_NVSTORE_GET_FLAG(flags, EXPORT_DELETED) && + !BHND_NVSTORE_GET_FLAG(flags, EXPORT_DELETED)) + { + return (EINVAL); + } + + /* Lock internal state before querying paths/properties */ + BHND_NVSTORE_LOCK(sc); + + /* Fetch referenced path */ + top = bhnd_nvstore_get_path(sc, path, strlen(path)); + if (top == NULL) { + error = ENOENT; + goto failed; + } + + /* Allocate new, empty property list */ + if ((unordered = bhnd_nvram_plist_new()) == NULL) { + error = ENOMEM; + goto failed; + } + + /* Export the top-level path first */ + error = bhnd_nvram_store_export_child(sc, top, top, unordered, flags); + if (error) + goto failed; + + /* Attempt to export any children of the root path */ + for (size_t i = 0; i < nitems(sc->paths); i++) { + bhnd_nvstore_path *child; + + LIST_FOREACH(child, &sc->paths[i], np_link) { + /* Top-level path was already exported */ + if (child == top) + continue; + + error = bhnd_nvram_store_export_child(sc, top, + child, unordered, flags); + if (error) + goto failed; + } + } + + /* If requested, provide the current class and serialization options */ + if (cls != NULL) + *cls = bhnd_nvram_data_get_class(sc->data); + + if (options != NULL) + *options = bhnd_nvram_plist_retain(sc->data_opts); + + /* + * If we're re-encoding device paths, don't bother preserving the + * existing NVRAM variable order; our variable names will not match + * the existing backing NVRAM data. + */ + if (!BHND_NVSTORE_GET_FLAG(flags, EXPORT_PRESERVE_DEVPATHS)) { + *props = unordered; + unordered = NULL; + + goto finished; + } + + /* + * Re-order the flattened output to match the existing NVRAM variable + * ordering. + * + * We append all new variables at the end of the input; this should + * reduce the delta that needs to be written (e.g. to flash) when + * committing NVRAM updates, and should result in a serialization + * identical to the input serialization if uncommitted updates are + * excluded from the export. + */ + if ((*props = bhnd_nvram_plist_new()) == NULL) { + error = ENOMEM; + goto failed; + } + + /* Using the backing NVRAM data ordering to order all variables + * currently defined in the backing store */ + cookiep = NULL; + while ((name = bhnd_nvram_data_next(sc->data, &cookiep))) { + prop = bhnd_nvram_plist_get_prop(unordered, name); + if (prop == NULL) + continue; + + /* Append to ordered result */ + if ((error = bhnd_nvram_plist_append(*props, prop))) + goto failed; + + /* Remove from unordered list */ + bhnd_nvram_plist_remove(unordered, name); + } + + /* Any remaining variables are new, and should be appended to the + * end of the export list */ + prop = NULL; + while ((prop = bhnd_nvram_plist_next(unordered, prop)) != NULL) { + if ((error = bhnd_nvram_plist_append(*props, prop))) + goto failed; + } + + /* Export complete */ +finished: + BHND_NVSTORE_UNLOCK(sc); + + if (unordered != NULL) + bhnd_nvram_plist_release(unordered); + + return (0); + +failed: + BHND_NVSTORE_UNLOCK(sc); + + if (unordered != NULL) + bhnd_nvram_plist_release(unordered); + + if (options != NULL && *options != NULL) + bhnd_nvram_plist_release(*options); + + if (*props != NULL) + bhnd_nvram_plist_release(*props); + + return (error); +} + /** * Read an NVRAM variable. * Modified: head/sys/dev/bhnd/nvram/bhnd_nvram_store.h ============================================================================== --- head/sys/dev/bhnd/nvram/bhnd_nvram_store.h Mon Dec 19 20:28:27 2016 (r310295) +++ head/sys/dev/bhnd/nvram/bhnd_nvram_store.h Mon Dec 19 20:31:27 2016 (r310296) @@ -45,10 +45,24 @@ #include "bhnd_nvram_data.h" #include "bhnd_nvram_io.h" -#include "bhnd_nvram_value.h" struct bhnd_nvram_store; +/** + * NVRAM export flags. + */ +enum { + BHND_NVSTORE_EXPORT_CHILDREN = (1<<0), /**< Include all subpaths */ + BHND_NVSTORE_EXPORT_PRESERVE_DEVPATHS = (1<<1), /**< Preserve existing device path definitions (default) */ + BHND_NVSTORE_EXPORT_COMPACT_DEVPATHS = (1<<2), /**< Re-encode all device paths using compact syntax */ + BHND_NVSTORE_EXPORT_EXPAND_DEVPATHS = (1<<3), /**< Re-encode all device paths using non-compact syntax */ + BHND_NVSTORE_EXPORT_ALL_VARS = (1<<6|1<<7), /**< Include all variables (default) */ + BHND_NVSTORE_EXPORT_COMMITTED = (1<<6), /**< Include all committed changes */ + BHND_NVSTORE_EXPORT_UNCOMMITTED = (1<<7), /**< Include all uncommitted changes (not including deletions) */ + BHND_NVSTORE_EXPORT_DELETED = (1<<8), /**< Include all uncommitted deltions (as + properties of type BHND_NVRAM_TYPE_NULL) */ +}; + int bhnd_nvram_store_new(struct bhnd_nvram_store **store, struct bhnd_nvram_data *data); @@ -57,6 +71,10 @@ int bhnd_nvram_store_parse_new(struct bh void bhnd_nvram_store_free(struct bhnd_nvram_store *store); +int bhnd_nvram_store_export(struct bhnd_nvram_store *store, + const char *path, bhnd_nvram_data_class **cls, + bhnd_nvram_plist **props, bhnd_nvram_plist **options, + uint32_t flags); int bhnd_nvram_store_getvar(struct bhnd_nvram_store *sc, const char *name, void *outp, size_t *olen, bhnd_nvram_type otype); Modified: head/sys/dev/bhnd/nvram/bhnd_nvram_store_subr.c ============================================================================== --- head/sys/dev/bhnd/nvram/bhnd_nvram_store_subr.c Mon Dec 19 20:28:27 2016 (r310295) +++ head/sys/dev/bhnd/nvram/bhnd_nvram_store_subr.c Mon Dec 19 20:31:27 2016 (r310296) @@ -342,7 +342,7 @@ bhnd_nvstore_path_register_update(struct /* Determine whether the variable is currently defined in the * backing NVRAM data, and derive its full path-prefixed name */ nvram_committed = false; - cookiep = bhnd_nvstore_index_lookup(sc, path->index, name); + cookiep = bhnd_nvstore_path_data_lookup(sc, path, name); if (cookiep != NULL) { /* Variable is defined in the backing data */ nvram_committed = true; Modified: head/sys/dev/bhnd/nvram/bhnd_nvram_storevar.h ============================================================================== --- head/sys/dev/bhnd/nvram/bhnd_nvram_storevar.h Mon Dec 19 20:28:27 2016 (r310295) +++ head/sys/dev/bhnd/nvram/bhnd_nvram_storevar.h Mon Dec 19 20:31:27 2016 (r310296) @@ -271,6 +271,7 @@ struct bhnd_nvram_store { #endif struct bhnd_nvram_data *data; /**< backing data */ uint32_t data_caps; /**< data capability flags */ + bhnd_nvram_plist *data_opts; /**< data serialization options */ bhnd_nvstore_alias_list aliases[4]; /**< path alias hash table */ size_t num_aliases; /**< alias count */ *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@freebsd.org Mon Dec 19 20:34:07 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2142FC88FC0; Mon, 19 Dec 2016 20:34:07 +0000 (UTC) (envelope-from landonf@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B23AC16F9; Mon, 19 Dec 2016 20:34:06 +0000 (UTC) (envelope-from landonf@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBJKY6u5060696; Mon, 19 Dec 2016 20:34:06 GMT (envelope-from landonf@FreeBSD.org) Received: (from landonf@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBJKY52T060687; Mon, 19 Dec 2016 20:34:05 GMT (envelope-from landonf@FreeBSD.org) Message-Id: <201612192034.uBJKY52T060687@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: landonf set sender to landonf@FreeBSD.org using -f From: "Landon J. Fuller" Date: Mon, 19 Dec 2016 20:34:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310297 - in head/sys: conf dev/bhnd/nvram dev/bhnd/tools modules/bhnd X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Dec 2016 20:34:07 -0000 Author: landonf Date: Mon Dec 19 20:34:05 2016 New Revision: 310297 URL: https://svnweb.freebsd.org/changeset/base/310297 Log: bhnd(4): NVRAM serialization support. This adds support for: - Serializing an bhnd_nvram_plist (as exported from bhnd_nvram_store, etc) to an arbitrary NVRAM data format. - Generating a serialized representation of the current NVRAM store's state suitable for writing back to flash, or re-encoding for upload to a FullMAC device. Approved by: adrian (mentor) Differential Revision: https://reviews.freebsd.org/D8762 Added: head/sys/dev/bhnd/nvram/bhnd_nvram_data_sprom_subr.c (contents, props changed) Modified: head/sys/conf/files head/sys/dev/bhnd/nvram/bhnd_nvram_data.c head/sys/dev/bhnd/nvram/bhnd_nvram_data.h head/sys/dev/bhnd/nvram/bhnd_nvram_data_bcm.c head/sys/dev/bhnd/nvram/bhnd_nvram_data_bcmraw.c head/sys/dev/bhnd/nvram/bhnd_nvram_data_bcmreg.h head/sys/dev/bhnd/nvram/bhnd_nvram_data_btxt.c head/sys/dev/bhnd/nvram/bhnd_nvram_data_sprom.c head/sys/dev/bhnd/nvram/bhnd_nvram_data_spromvar.h head/sys/dev/bhnd/nvram/bhnd_nvram_data_tlv.c head/sys/dev/bhnd/nvram/bhnd_nvram_datavar.h head/sys/dev/bhnd/nvram/bhnd_nvram_private.h head/sys/dev/bhnd/nvram/bhnd_nvram_store.c head/sys/dev/bhnd/nvram/bhnd_nvram_store.h head/sys/dev/bhnd/tools/nvram_map_gen.awk head/sys/modules/bhnd/Makefile Modified: head/sys/conf/files ============================================================================== --- head/sys/conf/files Mon Dec 19 20:31:27 2016 (r310296) +++ head/sys/conf/files Mon Dec 19 20:34:05 2016 (r310297) @@ -1236,6 +1236,7 @@ dev/bhnd/nvram/bhnd_nvram_data_bcm.c opt dev/bhnd/nvram/bhnd_nvram_data_bcmraw.c optional bhnd dev/bhnd/nvram/bhnd_nvram_data_btxt.c optional bhnd dev/bhnd/nvram/bhnd_nvram_data_sprom.c optional bhnd +dev/bhnd/nvram/bhnd_nvram_data_sprom_subr.c optional bhnd dev/bhnd/nvram/bhnd_nvram_data_tlv.c optional bhnd dev/bhnd/nvram/bhnd_nvram_if.m optional bhnd dev/bhnd/nvram/bhnd_nvram_io.c optional bhnd Modified: head/sys/dev/bhnd/nvram/bhnd_nvram_data.c ============================================================================== --- head/sys/dev/bhnd/nvram/bhnd_nvram_data.c Mon Dec 19 20:31:27 2016 (r310296) +++ head/sys/dev/bhnd/nvram/bhnd_nvram_data.c Mon Dec 19 20:34:05 2016 (r310297) @@ -65,6 +65,54 @@ bhnd_nvram_data_class_desc(bhnd_nvram_da } /** + * Return the class-level capability flags (@see BHND_NVRAM_DATA_CAP_*) for + * of @p cls. + * + * @param cls The NVRAM class. + */ +uint32_t +bhnd_nvram_data_class_caps(bhnd_nvram_data_class *cls) +{ + return (cls->caps); +} + +/** + * Serialize all NVRAM properties in @p plist using @p cls's NVRAM data + * format, writing the result to @p outp. + * + * @param cls The NVRAM data class to be used to perform + * serialization. + * @param props The raw property values to be serialized to + * @p outp, in serialization order. + * @param options Serialization options for @p cls, or NULL. + * @param[out] outp On success, the serialed NVRAM data will be + * written to this buffer. This argment may be + * NULL if the value is not desired. + * @param[in,out] olen The capacity of @p buf. On success, will be set + * to the actual length of the serialized data. + * + * @retval 0 success + * + * @retval ENOMEM If @p outp is non-NULL and a buffer of @p olen is too + * small to hold the serialized data. + * @retval EINVAL If a property value required by @p cls is not found in + * @p plist. + * @retval EFTYPE If a property value in @p plist cannot be represented + * as the data type required by @p cls. + * @retval ERANGE If a property value in @p plist would would overflow + * (or underflow) the data type required by @p cls. + * @retval non-zero If serialization otherwise fails, a regular unix error + * code will be returned. + */ +int +bhnd_nvram_data_serialize(bhnd_nvram_data_class *cls, + bhnd_nvram_plist *props, bhnd_nvram_plist *options, void *outp, + size_t *olen) +{ + return (cls->op_serialize(cls, props, options, outp, olen)); +} + +/** * Probe to see if this NVRAM data class class supports the data mapped by the * given I/O context, returning a BHND_NVRAM_DATA_PROBE probe result. * @@ -293,51 +341,6 @@ bhnd_nvram_data_options(struct bhnd_nvra } /** - * Compute the size of the serialized form of @p nv. - * - * Serialization may be performed via bhnd_nvram_data_serialize(). - * - * @param nv The NVRAM data to be queried. - * @param[out] len On success, will be set to the computed size. - * - * @retval 0 success - * @retval non-zero if computing the serialized size otherwise fails, a - * regular unix error code will be returned. - */ -int -bhnd_nvram_data_size(struct bhnd_nvram_data *nv, size_t *len) -{ - return (nv->cls->op_size(nv, len)); -} - -/** - * Serialize the NVRAM data to @p buf, using the NVRAM data class' native - * format. - * - * The resulting serialization may be reparsed with @p nv's BHND NVRAM data - * class. - * - * @param nv The NVRAM data to be serialized. - * @param[out] buf On success, the serialed NVRAM data will be - * written to this buffer. This argment may be - * NULL if the value is not desired. - * @param[in,out] len The capacity of @p buf. On success, will be set - * to the actual length of the serialized data. - * - * @retval 0 success - * @retval ENOMEM If @p buf is non-NULL and a buffer of @p len is too - * small to hold the serialized data. - * @retval non-zero If serialization otherwise fails, a regular unix error - * code will be returned. - */ -int -bhnd_nvram_data_serialize(struct bhnd_nvram_data *nv, - void *buf, size_t *len) -{ - return (nv->cls->op_serialize(nv, buf, len)); -} - -/** * Return the capability flags (@see BHND_NVRAM_DATA_CAP_*) for @p nv. * * @param nv The NVRAM data to be queried. Modified: head/sys/dev/bhnd/nvram/bhnd_nvram_data.h ============================================================================== --- head/sys/dev/bhnd/nvram/bhnd_nvram_data.h Mon Dec 19 20:31:27 2016 (r310296) +++ head/sys/dev/bhnd/nvram/bhnd_nvram_data.h Mon Dec 19 20:34:05 2016 (r310297) @@ -91,6 +91,11 @@ enum { }; const char *bhnd_nvram_data_class_desc(bhnd_nvram_data_class *cls); +uint32_t bhnd_nvram_data_class_caps(bhnd_nvram_data_class *cls); + +int bhnd_nvram_data_serialize(bhnd_nvram_data_class *cls, + bhnd_nvram_plist *props, bhnd_nvram_plist *options, + void *outp, size_t *olen); int bhnd_nvram_data_probe(bhnd_nvram_data_class *cls, struct bhnd_nvram_io *io); @@ -110,12 +115,6 @@ void bhnd_nvram_data_release(struct b bhnd_nvram_data_class *bhnd_nvram_data_get_class(struct bhnd_nvram_data *nv); size_t bhnd_nvram_data_count(struct bhnd_nvram_data *nv); -int bhnd_nvram_data_size(struct bhnd_nvram_data *nv, - size_t *size); - -int bhnd_nvram_data_serialize(struct bhnd_nvram_data *nv, - void *buf, size_t *len); - bhnd_nvram_plist *bhnd_nvram_data_options(struct bhnd_nvram_data *nv); uint32_t bhnd_nvram_data_caps(struct bhnd_nvram_data *nv); Modified: head/sys/dev/bhnd/nvram/bhnd_nvram_data_bcm.c ============================================================================== --- head/sys/dev/bhnd/nvram/bhnd_nvram_data_bcm.c Mon Dec 19 20:31:27 2016 (r310296) +++ head/sys/dev/bhnd/nvram/bhnd_nvram_data_bcm.c Mon Dec 19 20:34:05 2016 (r310297) @@ -129,7 +129,8 @@ struct bhnd_nvram_bcm { size_t count; /**< total variable count */ }; -BHND_NVRAM_DATA_CLASS_DEFN(bcm, "Broadcom", sizeof(struct bhnd_nvram_bcm)) +BHND_NVRAM_DATA_CLASS_DEFN(bcm, "Broadcom", BHND_NVRAM_DATA_CAP_DEVPATHS, + sizeof(struct bhnd_nvram_bcm)) static int bhnd_nvram_bcm_probe(struct bhnd_nvram_io *io) @@ -146,6 +147,190 @@ bhnd_nvram_bcm_probe(struct bhnd_nvram_i return (BHND_NVRAM_DATA_PROBE_DEFAULT); } +static int +bhnd_nvram_bcm_serialize(bhnd_nvram_data_class *cls, bhnd_nvram_plist *props, + bhnd_nvram_plist *options, void *outp, size_t *olen) +{ + struct bhnd_nvram_bcmhdr hdr; + bhnd_nvram_prop *prop; + size_t limit, nbytes; + uint32_t sdram_ncdl; + uint16_t sdram_init, sdram_cfg, sdram_refresh; + uint8_t bcm_ver, crc8; + int error; + + /* Determine output byte limit */ + if (outp != NULL) + limit = *olen; + else + limit = 0; + + /* Fetch required header variables */ +#define PROPS_GET_HDRVAR(_name, _dest, _type) do { \ + const char *name = BCM_NVRAM_ ## _name ## _VAR; \ + if (!bhnd_nvram_plist_contains(props, name)) { \ + BHND_NV_LOG("missing required property: %s\n", \ + name); \ + return (EFTYPE); \ + } \ + \ + error = bhnd_nvram_plist_get_encoded(props, name, \ + (_dest), sizeof(*(_dest)), \ + BHND_NVRAM_TYPE_ ##_type); \ + if (error) { \ + BHND_NV_LOG("error reading required header " \ + "%s property: %d\n", name, error); \ + return (EFTYPE); \ + } \ +} while (0) + + PROPS_GET_HDRVAR(SDRAM_NCDL, &sdram_ncdl, UINT32); + PROPS_GET_HDRVAR(CFG0_SDRAM_INIT, &sdram_init, UINT16); + PROPS_GET_HDRVAR(CFG1_SDRAM_CFG, &sdram_cfg, UINT16); + PROPS_GET_HDRVAR(CFG1_SDRAM_REFRESH, &sdram_refresh, UINT16); + +#undef PROPS_GET_HDRVAR + + /* Fetch BCM nvram version from options */ + if (options != NULL && + bhnd_nvram_plist_contains(options, BCM_NVRAM_ENCODE_OPT_VERSION)) + { + error = bhnd_nvram_plist_get_uint8(options, + BCM_NVRAM_ENCODE_OPT_VERSION, &bcm_ver); + if (error) { + BHND_NV_LOG("error reading %s uint8 option value: %d\n", + BCM_NVRAM_ENCODE_OPT_VERSION, error); + return (EINVAL); + } + } else { + bcm_ver = BCM_NVRAM_CFG0_VER_DEFAULT; + } + + /* Construct our header */ + hdr = (struct bhnd_nvram_bcmhdr) { + .magic = htole32(BCM_NVRAM_MAGIC), + .size = 0, + .cfg0 = 0, + .cfg1 = 0, + .sdram_ncdl = htole32(sdram_ncdl) + }; + + hdr.cfg0 = BCM_NVRAM_SET_BITS(hdr.cfg0, BCM_NVRAM_CFG0_CRC, 0x0); + hdr.cfg0 = BCM_NVRAM_SET_BITS(hdr.cfg0, BCM_NVRAM_CFG0_VER, bcm_ver); + hdr.cfg0 = BCM_NVRAM_SET_BITS(hdr.cfg0, BCM_NVRAM_CFG0_SDRAM_INIT, + htole16(sdram_init)); + + hdr.cfg1 = BCM_NVRAM_SET_BITS(hdr.cfg1, BCM_NVRAM_CFG1_SDRAM_CFG, + htole16(sdram_cfg)); + hdr.cfg1 = BCM_NVRAM_SET_BITS(hdr.cfg1, BCM_NVRAM_CFG1_SDRAM_REFRESH, + htole16(sdram_refresh)); + + /* Write the header */ + nbytes = sizeof(hdr); + if (limit >= nbytes) + memcpy(outp, &hdr, sizeof(hdr)); + + /* Write all properties */ + prop = NULL; + while ((prop = bhnd_nvram_plist_next(props, prop)) != NULL) { + const char *name; + char *p; + size_t prop_limit; + size_t name_len, value_len; + + if (outp == NULL || limit < nbytes) { + p = NULL; + prop_limit = 0; + } else { + p = ((char *)outp) + nbytes; + prop_limit = limit - nbytes; + } + + /* Fetch and write name + '=' to output */ + name = bhnd_nvram_prop_name(prop); + name_len = strlen(name) + 1; + + if (prop_limit > name_len) { + memcpy(p, name, name_len - 1); + p[name_len - 1] = '='; + + prop_limit -= name_len; + p += name_len; + } else { + prop_limit = 0; + p = NULL; + } + + /* Advance byte count */ + if (SIZE_MAX - nbytes < name_len) + return (EFTYPE); /* would overflow size_t */ + + nbytes += name_len; + + /* Attempt to write NUL-terminated value to output */ + value_len = prop_limit; + error = bhnd_nvram_prop_encode(prop, p, &value_len, + BHND_NVRAM_TYPE_STRING); + + /* If encoding failed for any reason other than ENOMEM (which + * we'll detect and report after encoding all properties), + * return immediately */ + if (error && error != ENOMEM) { + BHND_NV_LOG("error serializing %s to required type " + "%s: %d\n", name, + bhnd_nvram_type_name(BHND_NVRAM_TYPE_STRING), + error); + return (error); + } + + /* Advance byte count */ + if (SIZE_MAX - nbytes < value_len) + return (EFTYPE); /* would overflow size_t */ + + nbytes += value_len; + } + + /* Write terminating '\0' */ + if (limit > nbytes) + *((char *)outp + nbytes) = '\0'; + + if (nbytes == SIZE_MAX) + return (EFTYPE); /* would overflow size_t */ + else + nbytes++; + + /* Update header length; this must fit within the header's 32-bit size + * field */ + if (nbytes <= UINT32_MAX) { + hdr.size = (uint32_t)nbytes; + } else { + BHND_NV_LOG("size %zu exceeds maximum supported size of %u " + "bytes\n", nbytes, UINT32_MAX); + return (EFTYPE); + } + + /* Provide required length */ + *olen = nbytes; + if (limit < *olen) { + if (outp == NULL) + return (0); + + return (ENOMEM); + } + + /* Calculate the CRC value */ + BHND_NV_ASSERT(nbytes >= BCM_NVRAM_CRC_SKIP, ("invalid output size")); + crc8 = bhnd_nvram_crc8((uint8_t *)outp + BCM_NVRAM_CRC_SKIP, + nbytes - BCM_NVRAM_CRC_SKIP, BHND_NVRAM_CRC8_INITIAL); + + /* Update CRC and write the finalized header */ + BHND_NV_ASSERT(nbytes >= sizeof(hdr), ("invalid output size")); + hdr.cfg0 = BCM_NVRAM_SET_BITS(hdr.cfg0, BCM_NVRAM_CFG0_CRC, crc8); + memcpy(outp, &hdr, sizeof(hdr)); + + return (0); +} + /** * Initialize @p bcm with the provided NVRAM data mapped by @p src. * @@ -411,127 +596,6 @@ bhnd_nvram_bcm_options(struct bhnd_nvram return (bcm->opts); } -static int -bhnd_nvram_bcm_size(struct bhnd_nvram_data *nv, size_t *size) -{ - return (bhnd_nvram_bcm_serialize(nv, NULL, size)); -} - -static int -bhnd_nvram_bcm_serialize(struct bhnd_nvram_data *nv, void *buf, size_t *len) -{ - struct bhnd_nvram_bcm *bcm; - struct bhnd_nvram_bcmhdr hdr; - void *cookiep; - const char *name; - size_t nbytes, limit; - uint8_t crc; - int error; - - bcm = (struct bhnd_nvram_bcm *)nv; - nbytes = 0; - - /* Save the output buffer limit */ - if (buf == NULL) - limit = 0; - else - limit = *len; - - /* Reserve space for the NVRAM header */ - nbytes += sizeof(struct bhnd_nvram_bcmhdr); - - /* Write all variables to the output buffer */ - cookiep = NULL; - while ((name = bhnd_nvram_data_next(nv, &cookiep))) { - uint8_t *outp; - size_t olen; - size_t name_len, val_len; - - if (limit > nbytes) { - outp = (uint8_t *)buf + nbytes; - olen = limit - nbytes; - } else { - outp = NULL; - olen = 0; - } - - /* Determine length of variable name */ - name_len = strlen(name) + 1; - - /* Write the variable name and '=' delimiter */ - if (olen >= name_len) { - /* Copy name */ - memcpy(outp, name, name_len - 1); - - /* Append '=' */ - *(outp + name_len - 1) = '='; - } - - /* Adjust byte counts */ - if (SIZE_MAX - name_len < nbytes) - return (ERANGE); - - nbytes += name_len; - - /* Reposition output */ - if (limit > nbytes) { - outp = (uint8_t *)buf + nbytes; - olen = limit - nbytes; - } else { - outp = NULL; - olen = 0; - } - - /* Coerce to NUL-terminated C string, writing to the output - * buffer (or just calculating the length if outp is NULL) */ - val_len = olen; - error = bhnd_nvram_data_getvar(nv, cookiep, outp, &val_len, - BHND_NVRAM_TYPE_STRING); - - if (error && error != ENOMEM) - return (error); - - /* Adjust byte counts */ - if (SIZE_MAX - val_len < nbytes) - return (ERANGE); - - nbytes += val_len; - } - - /* Write terminating NUL */ - if (nbytes < limit) - *((uint8_t *)buf + nbytes) = '\0'; - nbytes++; - - /* Provide actual size */ - *len = nbytes; - if (buf == NULL || nbytes > limit) { - if (buf != NULL) - return (ENOMEM); - - return (0); - } - - /* Fetch current NVRAM header */ - if ((error = bhnd_nvram_io_read(bcm->data, 0x0, &hdr, sizeof(hdr)))) - return (error); - - /* Update values covered by CRC and write to output buffer */ - hdr.size = htole32(*len); - memcpy(buf, &hdr, sizeof(hdr)); - - /* Calculate new CRC */ - crc = bhnd_nvram_crc8((uint8_t *)buf + BCM_NVRAM_CRC_SKIP, - *len - BCM_NVRAM_CRC_SKIP, BHND_NVRAM_CRC8_INITIAL); - - /* Update header with valid CRC */ - hdr.cfg0 &= ~BCM_NVRAM_CFG0_CRC_MASK; - hdr.cfg0 |= (crc << BCM_NVRAM_CFG0_CRC_SHIFT); - memcpy(buf, &hdr, sizeof(hdr)); - - return (0); -} - static uint32_t bhnd_nvram_bcm_caps(struct bhnd_nvram_data *nv) { Modified: head/sys/dev/bhnd/nvram/bhnd_nvram_data_bcmraw.c ============================================================================== --- head/sys/dev/bhnd/nvram/bhnd_nvram_data_bcmraw.c Mon Dec 19 20:31:27 2016 (r310296) +++ head/sys/dev/bhnd/nvram/bhnd_nvram_data_bcmraw.c Mon Dec 19 20:34:05 2016 (r310297) @@ -72,7 +72,7 @@ struct bhnd_nvram_bcmraw { }; BHND_NVRAM_DATA_CLASS_DEFN(bcmraw, "Broadcom (RAW)", - sizeof(struct bhnd_nvram_bcmraw)) + BHND_NVRAM_DATA_CAP_DEVPATHS, sizeof(struct bhnd_nvram_bcmraw)) static int bhnd_nvram_bcmraw_probe(struct bhnd_nvram_io *io) @@ -132,6 +132,103 @@ bhnd_nvram_bcmraw_probe(struct bhnd_nvra return (BHND_NVRAM_DATA_PROBE_MAYBE + 1); } +static int +bhnd_nvram_bcmraw_serialize(bhnd_nvram_data_class *cls, bhnd_nvram_plist *props, + bhnd_nvram_plist *options, void *outp, size_t *olen) +{ + bhnd_nvram_prop *prop; + size_t limit, nbytes; + int error; + + /* Determine output byte limit */ + if (outp != NULL) + limit = *olen; + else + limit = 0; + + nbytes = 0; + + /* Write all properties */ + prop = NULL; + while ((prop = bhnd_nvram_plist_next(props, prop)) != NULL) { + const char *name; + char *p; + size_t prop_limit; + size_t name_len, value_len; + + if (outp == NULL || limit < nbytes) { + p = NULL; + prop_limit = 0; + } else { + p = ((char *)outp) + nbytes; + prop_limit = limit - nbytes; + } + + /* Fetch and write name + '=' to output */ + name = bhnd_nvram_prop_name(prop); + name_len = strlen(name) + 1; + + if (prop_limit > name_len) { + memcpy(p, name, name_len - 1); + p[name_len - 1] = '='; + + prop_limit -= name_len; + p += name_len; + } else { + prop_limit = 0; + p = NULL; + } + + /* Advance byte count */ + if (SIZE_MAX - nbytes < name_len) + return (EFTYPE); /* would overflow size_t */ + + nbytes += name_len; + + /* Attempt to write NUL-terminated value to output */ + value_len = prop_limit; + error = bhnd_nvram_prop_encode(prop, p, &value_len, + BHND_NVRAM_TYPE_STRING); + + /* If encoding failed for any reason other than ENOMEM (which + * we'll detect and report after encoding all properties), + * return immediately */ + if (error && error != ENOMEM) { + BHND_NV_LOG("error serializing %s to required type " + "%s: %d\n", name, + bhnd_nvram_type_name(BHND_NVRAM_TYPE_STRING), + error); + return (error); + } + + /* Advance byte count */ + if (SIZE_MAX - nbytes < value_len) + return (EFTYPE); /* would overflow size_t */ + + nbytes += value_len; + } + + /* Write terminating '\0' */ + if (limit > nbytes) + *((char *)outp + nbytes) = '\0'; + + if (nbytes == SIZE_MAX) + return (EFTYPE); /* would overflow size_t */ + else + nbytes++; + + /* Provide required length */ + *olen = nbytes; + if (limit < *olen) { + if (outp == NULL) + return (0); + + return (ENOMEM); + } + + return (0); +} + /** * Initialize @p bcm with the provided NVRAM data mapped by @p src. * @@ -249,85 +346,18 @@ bhnd_nvram_bcmraw_free(struct bhnd_nvram bhnd_nv_free(bcm->data); } -static size_t -bhnd_nvram_bcmraw_count(struct bhnd_nvram_data *nv) -{ - struct bhnd_nvram_bcmraw *bcm = (struct bhnd_nvram_bcmraw *)nv; - - return (bcm->count); -} - static bhnd_nvram_plist * bhnd_nvram_bcmraw_options(struct bhnd_nvram_data *nv) { return (NULL); } -static int -bhnd_nvram_bcmraw_size(struct bhnd_nvram_data *nv, size_t *size) -{ - return (bhnd_nvram_bcmraw_serialize(nv, NULL, size)); -} - -static int -bhnd_nvram_bcmraw_serialize(struct bhnd_nvram_data *nv, void *buf, size_t *len) +static size_t +bhnd_nvram_bcmraw_count(struct bhnd_nvram_data *nv) { - struct bhnd_nvram_bcmraw *bcm; - char * const p = (char *)buf; - size_t limit; - size_t offset; - - bcm = (struct bhnd_nvram_bcmraw *)nv; - - /* Save the output buffer limit */ - if (buf == NULL) - limit = 0; - else - limit = *len; - - /* The serialized form will be exactly the length - * of our backing buffer representation */ - *len = bcm->size; - - /* Skip serialization if not requested, or report ENOMEM if - * buffer is too small */ - if (buf == NULL) { - return (0); - } else if (*len > limit) { - return (ENOMEM); - } - - /* Write all variables to the output buffer */ - memcpy(buf, bcm->data, *len); - - /* Rewrite all '\0' delimiters back to '=' */ - offset = 0; - while (offset < bcm->size) { - size_t name_len, value_len; - - name_len = strlen(p + offset); - - /* EOF? */ - if (name_len == 0) { - BHND_NV_ASSERT(*(p + offset) == '\0', - ("no NUL terminator")); - - offset++; - break; - } - - /* Rewrite 'name\0' to 'name=' */ - offset += name_len; - BHND_NV_ASSERT(*(p + offset) == '\0', ("incorrect offset")); - - *(p + offset) = '='; - offset++; - - value_len = strlen(p + offset); - offset += value_len + 1; - } + struct bhnd_nvram_bcmraw *bcm = (struct bhnd_nvram_bcmraw *)nv; - return (0); + return (bcm->count); } static uint32_t Modified: head/sys/dev/bhnd/nvram/bhnd_nvram_data_bcmreg.h ============================================================================== --- head/sys/dev/bhnd/nvram/bhnd_nvram_data_bcmreg.h Mon Dec 19 20:31:27 2016 (r310296) +++ head/sys/dev/bhnd/nvram/bhnd_nvram_data_bcmreg.h Mon Dec 19 20:34:05 2016 (r310297) @@ -32,9 +32,13 @@ #ifndef _BHND_NVRAM_BHND_NVRAM_BCMREG_H_ #define _BHND_NVRAM_BHND_NVRAM_BCMREG_H_ -#define BCM_NVRAM_GET_BITS(_value, _field) \ +#define BCM_NVRAM_GET_BITS(_value, _field) \ ((_value & _field ## _MASK) >> _field ## _SHIFT) +#define BCM_NVRAM_SET_BITS(_value, _field, _bits) \ + ((_value & ~(_field ## _MASK)) | \ + (((_bits) << _field ## _SHIFT) & _field ## _MASK)) + /* BCM NVRAM header fields */ #define BCM_NVRAM_MAGIC 0x48534C46 /* 'FLSH' */ #define BCM_NVRAM_VERSION 1 @@ -45,6 +49,7 @@ #define BCM_NVRAM_CFG0_CRC_SHIFT 0 #define BCM_NVRAM_CFG0_VER_MASK 0x0000FF00 #define BCM_NVRAM_CFG0_VER_SHIFT 8 +#define BCM_NVRAM_CFG0_VER_DEFAULT 1 /* default version */ #define BCM_NVRAM_CFG0_SDRAM_INIT_FIELD cfg0 #define BCM_NVRAM_CFG0_SDRAM_INIT_MASK 0xFFFF0000 Modified: head/sys/dev/bhnd/nvram/bhnd_nvram_data_btxt.c ============================================================================== --- head/sys/dev/bhnd/nvram/bhnd_nvram_data_btxt.c Mon Dec 19 20:31:27 2016 (r310296) +++ head/sys/dev/bhnd/nvram/bhnd_nvram_data_btxt.c Mon Dec 19 20:34:05 2016 (r310297) @@ -69,7 +69,7 @@ struct bhnd_nvram_btxt { }; BHND_NVRAM_DATA_CLASS_DEFN(btxt, "Broadcom Board Text", - sizeof(struct bhnd_nvram_btxt)) + BHND_NVRAM_DATA_CAP_DEVPATHS, sizeof(struct bhnd_nvram_btxt)) /** Minimal identification header */ union bhnd_nvram_btxt_ident { @@ -124,6 +124,100 @@ bhnd_nvram_btxt_probe(struct bhnd_nvram_ return (BHND_NVRAM_DATA_PROBE_MAYBE); } +static int +bhnd_nvram_btxt_serialize(bhnd_nvram_data_class *cls, bhnd_nvram_plist *props, + bhnd_nvram_plist *options, void *outp, size_t *olen) +{ + bhnd_nvram_prop *prop; + size_t limit, nbytes; + int error; + + /* Determine output byte limit */ + if (outp != NULL) + limit = *olen; + else + limit = 0; + + nbytes = 0; + + /* Write all properties */ + prop = NULL; + while ((prop = bhnd_nvram_plist_next(props, prop)) != NULL) { + const char *name; + char *p; + size_t prop_limit; + size_t name_len, value_len; + + if (outp == NULL || limit < nbytes) { + p = NULL; + prop_limit = 0; + } else { + p = ((char *)outp) + nbytes; + prop_limit = limit - nbytes; + } + + /* Fetch and write 'name=' to output */ + name = bhnd_nvram_prop_name(prop); + name_len = strlen(name) + 1; + + if (prop_limit > name_len) { + memcpy(p, name, name_len - 1); + p[name_len - 1] = '='; + + prop_limit -= name_len; + p += name_len; + } else { + prop_limit = 0; + p = NULL; + } + + /* Advance byte count */ + if (SIZE_MAX - nbytes < name_len) + return (EFTYPE); /* would overflow size_t */ + + nbytes += name_len; + + /* Write NUL-terminated value to output, rewrite NUL as + * '\n' record delimiter */ + value_len = prop_limit; + error = bhnd_nvram_prop_encode(prop, p, &value_len, + BHND_NVRAM_TYPE_STRING); + if (p != NULL && error == 0) { + /* Replace trailing '\0' with newline */ + BHND_NV_ASSERT(value_len > 0, ("string length missing " + "minimum required trailing NUL")); + + *(p + (value_len - 1)) = '\n'; + } else if (error && error != ENOMEM) { + /* If encoding failed for any reason other than ENOMEM + * (which we'll detect and report after encoding all + * properties), return immediately */ + BHND_NV_LOG("error serializing %s to required type " + "%s: %d\n", name, + bhnd_nvram_type_name(BHND_NVRAM_TYPE_STRING), + error); + return (error); + } + + /* Advance byte count */ + if (SIZE_MAX - nbytes < value_len) + return (EFTYPE); /* would overflow size_t */ + + nbytes += value_len; + } + + /* Provide required length */ + *olen = nbytes; + if (limit < *olen) { + if (outp == NULL) + return (0); + + return (ENOMEM); + } + + return (0); +} + /** * Initialize @p btxt with the provided board text data mapped by @p src. * @@ -261,52 +355,6 @@ bhnd_nvram_btxt_options(struct bhnd_nvra return (NULL); } -static int -bhnd_nvram_btxt_size(struct bhnd_nvram_data *nv, size_t *size) -{ - struct bhnd_nvram_btxt *btxt = (struct bhnd_nvram_btxt *)nv; - - /* The serialized form will be identical in length - * to our backing buffer representation */ - *size = bhnd_nvram_io_getsize(btxt->data); - return (0); -} - -static int -bhnd_nvram_btxt_serialize(struct bhnd_nvram_data *nv, void *buf, size_t *len) -{ - struct bhnd_nvram_btxt *btxt; - size_t limit; - int error; - - btxt = (struct bhnd_nvram_btxt *)nv; - - limit = *len; - - /* Provide actual output size */ - if ((error = bhnd_nvram_data_size(nv, len))) - return (error); - - if (buf == NULL) { - return (0); - } else if (limit < *len) { - return (ENOMEM); - } - - /* Copy our internal representation to the output buffer */ - if ((error = bhnd_nvram_io_read(btxt->data, 0x0, buf, *len))) - return (error); - - /* Restore the original key=value format, rewriting all '\0' - * key\0value delimiters back to '=' */ - for (char *p = buf; (size_t)(p - (char *)buf) < *len; p++) { - if (*p == '\0') - *p = '='; - } - - return (0); -} - static uint32_t bhnd_nvram_btxt_caps(struct bhnd_nvram_data *nv) { Modified: head/sys/dev/bhnd/nvram/bhnd_nvram_data_sprom.c ============================================================================== --- head/sys/dev/bhnd/nvram/bhnd_nvram_data_sprom.c Mon Dec 19 20:31:27 2016 (r310296) +++ head/sys/dev/bhnd/nvram/bhnd_nvram_data_sprom.c Mon Dec 19 20:34:05 2016 (r310297) @@ -49,8 +49,9 @@ __FBSDID("$FreeBSD$"); #include #endif /* _KERNEL */ -#include "bhnd_nvram_private.h" +#include "bhnd_nvram_map.h" +#include "bhnd_nvram_private.h" #include "bhnd_nvram_datavar.h" #include "bhnd_nvram_data_spromvar.h" @@ -62,44 +63,45 @@ __FBSDID("$FreeBSD$"); * used on Broadcom wireless and wired adapters, that provides a subset of the * variables defined by Broadcom SoC NVRAM formats. */ -BHND_NVRAM_DATA_CLASS_DEFN(sprom, "Broadcom SPROM", - sizeof(struct bhnd_nvram_sprom)) -static int sprom_sort_idx(const void *lhs, const void *rhs); +static const bhnd_sprom_layout *bhnd_nvram_sprom_get_layout(uint8_t sromrev); + +static int bhnd_nvram_sprom_ident( + struct bhnd_nvram_io *io, + const bhnd_sprom_layout **ident, + struct bhnd_nvram_io **shadow); + +static int bhnd_nvram_sprom_write_var( + bhnd_sprom_opcode_state *state, + bhnd_sprom_opcode_idx_entry *entry, + bhnd_nvram_val *value, + struct bhnd_nvram_io *io); + +static int bhnd_nvram_sprom_write_offset( + const struct bhnd_nvram_vardefn *var, + struct bhnd_nvram_io *data, + bhnd_nvram_type type, size_t offset, + uint32_t mask, int8_t shift, + uint32_t value); + +static int bhnd_nvram_sprom_read_offset( + const struct bhnd_nvram_vardefn *var, + struct bhnd_nvram_io *data, + bhnd_nvram_type type, size_t offset, + uint32_t mask, int8_t shift, + uint32_t *value); -static int sprom_opcode_state_init(struct sprom_opcode_state *state, - const struct bhnd_sprom_layout *layout); -static int sprom_opcode_state_reset(struct sprom_opcode_state *state); -static int sprom_opcode_state_seek(struct sprom_opcode_state *state, - struct sprom_opcode_idx *indexed); - -static int sprom_opcode_next_var(struct sprom_opcode_state *state); -static int sprom_opcode_parse_var(struct sprom_opcode_state *state, - struct sprom_opcode_idx *indexed); - -static int sprom_opcode_next_binding(struct sprom_opcode_state *state); - -static int sprom_opcode_set_type(struct sprom_opcode_state *state, - bhnd_nvram_type type); - -static int sprom_opcode_set_var(struct sprom_opcode_state *state, - size_t vid); -static int sprom_opcode_clear_var(struct sprom_opcode_state *state); -static int sprom_opcode_flush_bind(struct sprom_opcode_state *state); -static int sprom_opcode_read_opval32(struct sprom_opcode_state *state, - uint8_t type, uint32_t *opval); -static int sprom_opcode_apply_scale(struct sprom_opcode_state *state, - uint32_t *value); - -static int sprom_opcode_step(struct sprom_opcode_state *state, - uint8_t *opcode); - -#define SPROM_OP_BAD(_state, _fmt, ...) \ - BHND_NV_LOG("bad encoding at %td: " _fmt, \ - (_state)->input - (_state)->layout->bindings, ##__VA_ARGS__) +static bool bhnd_sprom_is_external_immutable( + const char *name); -#define SPROM_COOKIE_TO_NVRAM(_cookie) \ - bhnd_nvram_get_vardefn(((struct sprom_opcode_idx *)_cookie)->vid) +BHND_NVRAM_DATA_CLASS_DEFN(sprom, "Broadcom SPROM", + BHND_NVRAM_DATA_CAP_DEVPATHS, sizeof(struct bhnd_nvram_sprom)) + +#define SPROM_COOKIE_TO_VID(_cookie) \ + (((struct bhnd_sprom_opcode_idx_entry *)(_cookie))->vid) + +#define SPROM_COOKIE_TO_NVRAM_VAR(_cookie) \ + bhnd_nvram_get_vardefn(SPROM_COOKIE_TO_VID(_cookie)) /** * Read the magic value from @p io, and verify that it matches @@ -118,7 +120,7 @@ static int sprom_opcode_step(struct spro */ static int bhnd_nvram_sprom_check_magic(struct bhnd_nvram_io *io, - const struct bhnd_sprom_layout *layout, uint16_t *magic) + const bhnd_sprom_layout *layout, uint16_t *magic) { int error; @@ -162,7 +164,7 @@ bhnd_nvram_sprom_check_magic(struct bhnd */ static int bhnd_nvram_sprom_ident(struct bhnd_nvram_io *io, - const struct bhnd_sprom_layout **ident, struct bhnd_nvram_io **shadow) + const bhnd_sprom_layout **ident, struct bhnd_nvram_io **shadow) { struct bhnd_nvram_io *buf; uint8_t crc; @@ -185,13 +187,13 @@ bhnd_nvram_sprom_ident(struct bhnd_nvram /* We iterate the SPROM layouts smallest to largest, allowing us to * perform incremental checksum calculation */ for (size_t i = 0; i < bhnd_sprom_num_layouts; i++) { - const struct bhnd_sprom_layout *layout; - void *ptr; - size_t nbytes, nr; - uint16_t magic; - uint8_t srev; - bool crc_valid; - bool have_magic; + const bhnd_sprom_layout *layout; + void *ptr; + size_t nbytes, nr; + uint16_t magic; + uint8_t srev; *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@freebsd.org Mon Dec 19 20:37:31 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 78370C880AE; Mon, 19 Dec 2016 20:37:31 +0000 (UTC) (envelope-from rpokala@mac.com) Received: from mr11p00im-asmtp002.me.com (mr11p00im-asmtp002.me.com [17.110.69.253]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 59F6018EE; Mon, 19 Dec 2016 20:37:31 +0000 (UTC) (envelope-from rpokala@mac.com) Received: from process-dkim-sign-daemon.mr11p00im-asmtp002.me.com by mr11p00im-asmtp002.me.com (Oracle Communications Messaging Server 7.0.5.38.0 64bit (built Feb 26 2016)) id <0OIG003008O33O00@mr11p00im-asmtp002.me.com>; Mon, 19 Dec 2016 20:37:25 +0000 (GMT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mac.com; s=4d515a; t=1482179845; bh=FwV5vsw81ZWur8RlonKYHLZMbxfOHoFRL23cvRJxKfk=; h=Date:Subject:From:To:Message-id:MIME-version:Content-type; b=sWeroYH2Db+8PQcEOb5uMzEB1zIFBsRbC+G9MwxTPPhHnQNH/lq8bFBdW8eEu+Jxr e9Ec7Xl+b9BYFQNKQsLCkjmlQIZNLOaCuKWxaTezOBRVLFS5IPwHvPs0ESWIkEZgtu zrTsW5IE4QC7nPdkxr/NnmzGtQOMuEI4hBqy6gMYp5AEuyT6axXKG8cHuiGL9RAmG7 aPBhsQAuP6tPdaBLg+ubmac8r4ozGVC73IeA1uxFZJXjo1QtTYxc0FE7/XnBFJSMqM 694E+BaKNVdnY+GzPp8aSlblWJoHTTuQZSuG6mvuZiS3ZSy+xSuN+JYFS444NcD4Fy 11xRX8+vluclw== Received: from [172.17.133.77] (dip-cali.panasas.com [64.80.217.3]) by mr11p00im-asmtp002.me.com (Oracle Communications Messaging Server 7.0.5.38.0 64bit (built Feb 26 2016)) with ESMTPSA id <0OIG00ET89ABKI10@mr11p00im-asmtp002.me.com>; Mon, 19 Dec 2016 20:37:25 +0000 (GMT) X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2016-12-19_14:,, signatures=0 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 clxscore=1034 suspectscore=0 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1603290000 definitions=main-1612190230 User-Agent: Microsoft-MacOutlook/f.1d.0.161209 Date: Mon, 19 Dec 2016 12:37:27 -0800 Subject: Re: svn commit: r310171 - head/sys/sys From: Ravi Pokala Sender: "Pokala, Ravi" To: Ian Lepore , Warner Losh Cc: Sepherosa Ziehau , Dimitry Andric , src-committers , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" Message-id: Thread-topic: svn commit: r310171 - head/sys/sys References: <201612161949.uBGJnMol059217@repo.freebsd.org> <9BD5034F-55A6-48F6-A391-A0877FF49702@panasas.com> <1482175209.48539.9.camel@freebsd.org> In-reply-to: <1482175209.48539.9.camel@freebsd.org> MIME-version: 1.0 Content-type: text/plain; charset=UTF-8 Content-transfer-encoding: 7bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Dec 2016 20:37:31 -0000 -----Original Message----- > From: on behalf of Ian Lepore > Date: 2016-12-19, Monday at 11:20 > To: Warner Losh , Ravi Pokala > Cc: Sepherosa Ziehau , Dimitry Andric , src-committers , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" > Subject: Re: svn commit: r310171 - head/sys/sys > > On Mon, 2016-12-19 at 11:58 -0700, Warner Losh wrote: >> >> ... >> >> Are there other precedence for avoiding the SCN macros in the tree as >> well, or is this new art? >> >> Warner > > There was another commit recently the fixed the same kind of scanf > error by making the variable fit the scanf type (changing uint64_t to > an explicit long long unsigned, iirc). I don't know if that alone > counts as a precedent, but IMO it's a more palatible fix than the > SCN/PRI ugliness. With all apologies to Churchill, SCN/PRI are the worst way to address this in a machine-independent way, except for all the other ways that have been tried from time to time. :-P -Ravi (rpokala@) > -- Ian From owner-svn-src-all@freebsd.org Mon Dec 19 20:48:20 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A3029C884C6 for ; Mon, 19 Dec 2016 20:48:20 +0000 (UTC) (envelope-from joerg@bec.de) Received: from relay3-d.mail.gandi.net (relay3-d.mail.gandi.net [217.70.183.195]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 6C0411149 for ; Mon, 19 Dec 2016 20:48:19 +0000 (UTC) (envelope-from joerg@bec.de) Received: from britannica.bec.de (p200300D2ABCF63104639C4FFFE599710.dip0.t-ipconnect.de [IPv6:2003:d2:abcf:6310:4639:c4ff:fe59:9710]) (Authenticated sender: joerg@bec.de) by relay3-d.mail.gandi.net (Postfix) with ESMTPSA id EF37EA80CE for ; Mon, 19 Dec 2016 21:48:11 +0100 (CET) Date: Mon, 19 Dec 2016 21:48:10 +0100 From: Joerg Sonnenberger To: svn-src-all@freebsd.org Subject: Re: svn commit: r310171 - head/sys/sys Message-ID: <20161219204810.GA16225@britannica.bec.de> References: <201612161949.uBGJnMol059217@repo.freebsd.org> <9BD5034F-55A6-48F6-A391-A0877FF49702@panasas.com> <1482175209.48539.9.camel@freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.7.1 (2016-10-04) X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Dec 2016 20:48:20 -0000 On Mon, Dec 19, 2016 at 12:37:27PM -0800, Ravi Pokala wrote: > With all apologies to Churchill, SCN/PRI are the worst way to address > this in a machine-independent way, except for all the other ways that > have been tried from time to time. :-P They can't be the worst as they at least don't involve additional variables or using larger than necessary types. Joerg From owner-svn-src-all@freebsd.org Mon Dec 19 21:27:19 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 965D7C88169; Mon, 19 Dec 2016 21:27:19 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 6530415AF; Mon, 19 Dec 2016 21:27:19 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBJLRIDQ080684; Mon, 19 Dec 2016 21:27:18 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBJLRIcj080683; Mon, 19 Dec 2016 21:27:18 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201612192127.uBJLRIcj080683@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Mon, 19 Dec 2016 21:27:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310298 - head/sys/cam/ctl X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Dec 2016 21:27:19 -0000 Author: mav Date: Mon Dec 19 21:27:18 2016 New Revision: 310298 URL: https://svnweb.freebsd.org/changeset/base/310298 Log: Improve error handling when I/O split between several BIOs. If we get several error codes, handle one with lowest offset. MFC after: 2 weeks Modified: head/sys/cam/ctl/ctl_backend_block.c Modified: head/sys/cam/ctl/ctl_backend_block.c ============================================================================== --- head/sys/cam/ctl/ctl_backend_block.c Mon Dec 19 20:34:05 2016 (r310297) +++ head/sys/cam/ctl/ctl_backend_block.c Mon Dec 19 21:27:18 2016 (r310298) @@ -201,7 +201,8 @@ struct ctl_be_block_io { int num_bios_sent; int num_bios_done; int send_complete; - int num_errors; + int first_error; + uint64_t first_error_offset; struct bintime ds_t0; devstat_tag_type ds_tag_type; devstat_trans_flags ds_trans_type; @@ -486,8 +487,12 @@ ctl_be_block_biodone(struct bio *bio) error = bio->bio_error; mtx_lock(&be_lun->io_lock); - if (error != 0) - beio->num_errors++; + if (error != 0 && + (beio->first_error == 0 || + bio->bio_offset < beio->first_error_offset)) { + beio->first_error = error; + beio->first_error_offset = bio->bio_offset; + } beio->num_bios_done++; @@ -520,7 +525,8 @@ ctl_be_block_biodone(struct bio *bio) * If there are any errors from the backing device, we fail the * entire I/O with a medium error. */ - if (beio->num_errors > 0) { + error = beio->first_error; + if (error != 0) { if (error == EOPNOTSUPP) { ctl_set_invalid_opcode(&io->scsiio); } else if (error == ENOSPC || error == EDQUOT) { From owner-svn-src-all@freebsd.org Mon Dec 19 21:51:02 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 71270C88B33; Mon, 19 Dec 2016 21:51:02 +0000 (UTC) (envelope-from sjg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 39AD71348; Mon, 19 Dec 2016 21:51:02 +0000 (UTC) (envelope-from sjg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBJLp16D089737; Mon, 19 Dec 2016 21:51:01 GMT (envelope-from sjg@FreeBSD.org) Received: (from sjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBJLoxW2089716; Mon, 19 Dec 2016 21:50:59 GMT (envelope-from sjg@FreeBSD.org) Message-Id: <201612192150.uBJLoxW2089716@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sjg set sender to sjg@FreeBSD.org using -f From: "Simon J. Gerraty" Date: Mon, 19 Dec 2016 21:50:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r310299 - in vendor/NetBSD/bmake/dist: . mk X-SVN-Group: vendor MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Dec 2016 21:51:02 -0000 Author: sjg Date: Mon Dec 19 21:50:59 2016 New Revision: 310299 URL: https://svnweb.freebsd.org/changeset/base/310299 Log: Import bmake-20161212 From ChangeLog 2016-12-12 Simon J. Gerraty * Makefile (_MAKE_VERSION): 20161212 Merge with NetBSD make, pick up o main.c: look for obj.${MACHINE}-${MACHINE_ARCH} too. 2016-12-09 Simon J. Gerraty * Makefile (_MAKE_VERSION): 20161209 Merge with NetBSD make, pick up o main.c: cleanup setting of .OBJDIR o parse.c: avoid coredump from (var)=val 2016-11-26 Simon J. Gerraty * Makefile (_MAKE_VERSION): 20161126 Merge with NetBSD make, pick up o make.c: Make_OODate: report src node name if path not set 2016-09-26 Simon J. Gerraty * Makefile (_MAKE_VERSION): 20160926 Merge with NetBSD make, pick up o support for .DELETE_ON_ERROR: (remove targets that fail) 2016-09-26 Simon J. Gerraty * Makefile MAN: tweak .Dt to match ${PROG} mk/ChangeLog 2016-12-12 Simon J. Gerraty * install-mk (MK_VERSION): 20161212 * meta2deps.py: set pid_cwd[pid] when we process 'C'hdir, rather than when we detect pid change. 2016-12-07 Simon J. Gerraty * install-mk (MK_VERSION): 20161207 * meta.stage.mk: add stage_as_and_symlink for staging packages. We build foo.tgz stage_as foo-${VERSION}.tgz but want to be able to use foo.tgz to reference the latest staged version - so we make foo.tgz a symlink to it. Using a target to do both operations ensures we stay in sync. 2016-11-26 Simon J. Gerraty * install-mk (MK_VERSION): 20161126 * dirdeps.mk: set DIRDEPS_CACHE before we include local.dirdeps.mk so it can add dependencies. 2016-10-10 Simon J. Gerraty * dirdeps.mk: set DEP_* before we expand .MAKE.DEPENDFILE_PREFERENCE do that they can influence the result correctly. * dirdeps.mk (${DIRDEPS_CACHE}): make sure we pass on TARGET_SPEC * dirdeps.mk: Add ONLY_TARGET_SPEC_LIST and NOT_TARGET_SPEC_LIST similar to ONLY_MACHINE_LIST and NOT_MACHINE_LIST 2016-10-05 Simon J. Gerraty * dirdeps.mk: remove dependence on jot (normal situations anyway). Before we read another Makefile.depend* set DEP_* vars from _DEP_TARGET_SPEC in case it uses any of them with := When bootstrapping, trim any ,* from extention of chosen _src Makefile.depend* to get the machine value we subst for. 2016-09-30 Simon J. Gerraty * dirdeps.mk: use TARGET_SPEC_VARS to qualify components added to DEP_SKIP_DIR and DEP_DIRDEPS_FILTER * sys.mk: extract some bits to sys.{debug,vars}.mk for easier re-use by others. 2016-09-23 Simon Gerraty * lib.mk: Use ${PICO} for extension for PIC objects. default to .pico (like NetBSD) safe on case insensitive filesystem. 2016-08-19 Simon J. Gerraty * meta.sys.mk (META_COOKIE_TOUCH): use ${.OBJDIR}/${.TARGET:T} as default Added: vendor/NetBSD/bmake/dist/mk/sys.debug.mk (contents, props changed) vendor/NetBSD/bmake/dist/mk/sys.vars.mk (contents, props changed) Modified: vendor/NetBSD/bmake/dist/ChangeLog vendor/NetBSD/bmake/dist/Makefile vendor/NetBSD/bmake/dist/bmake.1 vendor/NetBSD/bmake/dist/bmake.cat1 vendor/NetBSD/bmake/dist/compat.c vendor/NetBSD/bmake/dist/job.c vendor/NetBSD/bmake/dist/main.c vendor/NetBSD/bmake/dist/make.1 vendor/NetBSD/bmake/dist/make.c vendor/NetBSD/bmake/dist/make.h vendor/NetBSD/bmake/dist/mk/ChangeLog vendor/NetBSD/bmake/dist/mk/FILES vendor/NetBSD/bmake/dist/mk/dirdeps.mk vendor/NetBSD/bmake/dist/mk/gendirdeps.mk vendor/NetBSD/bmake/dist/mk/install-mk vendor/NetBSD/bmake/dist/mk/lib.mk vendor/NetBSD/bmake/dist/mk/meta.stage.mk vendor/NetBSD/bmake/dist/mk/meta.sys.mk vendor/NetBSD/bmake/dist/mk/meta2deps.py vendor/NetBSD/bmake/dist/mk/meta2deps.sh vendor/NetBSD/bmake/dist/mk/sys.mk vendor/NetBSD/bmake/dist/nonints.h vendor/NetBSD/bmake/dist/parse.c Modified: vendor/NetBSD/bmake/dist/ChangeLog ============================================================================== --- vendor/NetBSD/bmake/dist/ChangeLog Mon Dec 19 21:27:18 2016 (r310298) +++ vendor/NetBSD/bmake/dist/ChangeLog Mon Dec 19 21:50:59 2016 (r310299) @@ -1,3 +1,32 @@ +2016-12-12 Simon J. Gerraty + + * Makefile (_MAKE_VERSION): 20161212 + Merge with NetBSD make, pick up + o main.c: look for obj.${MACHINE}-${MACHINE_ARCH} too. + +2016-12-09 Simon J. Gerraty + + * Makefile (_MAKE_VERSION): 20161209 + Merge with NetBSD make, pick up + o main.c: cleanup setting of .OBJDIR + o parse.c: avoid coredump from (var)=val + +2016-11-26 Simon J. Gerraty + + * Makefile (_MAKE_VERSION): 20161126 + Merge with NetBSD make, pick up + o make.c: Make_OODate: report src node name if path not set + +2016-09-26 Simon J. Gerraty + + * Makefile (_MAKE_VERSION): 20160926 + Merge with NetBSD make, pick up + o support for .DELETE_ON_ERROR: (remove targets that fail) + +2016-09-26 Simon J. Gerraty + + * Makefile MAN: tweak .Dt to match ${PROG} + 2016-08-18 Simon J. Gerraty * Makefile (_MAKE_VERSION): 20160818 Modified: vendor/NetBSD/bmake/dist/Makefile ============================================================================== --- vendor/NetBSD/bmake/dist/Makefile Mon Dec 19 21:27:18 2016 (r310298) +++ vendor/NetBSD/bmake/dist/Makefile Mon Dec 19 21:50:59 2016 (r310299) @@ -1,7 +1,7 @@ -# $Id: Makefile,v 1.72 2016/08/18 23:02:26 sjg Exp $ +# $Id: Makefile,v 1.77 2016/12/12 07:34:19 sjg Exp $ # Base version on src date -_MAKE_VERSION= 20160818 +_MAKE_VERSION= 20161212 PROG= bmake @@ -156,7 +156,10 @@ my.history: ${MAKEFILE} .NOPATH: ${MAN} ${MAN}: make.1 my.history @echo making $@ - @sed -e 's/^.Nx/NetBSD/' -e '/^.Nm/s/make/${PROG}/' \ + @sed \ + -e '/^.Dt/s/MAKE/${PROG:tu}/' \ + -e 's/^.Nx/NetBSD/' \ + -e '/^.Nm/s/make/${PROG}/' \ -e '/^.Sh HISTORY/rmy.history' \ -e '/^.Sh HISTORY/,$$s,^.Nm,make,' ${srcdir}/make.1 > $@ Modified: vendor/NetBSD/bmake/dist/bmake.1 ============================================================================== --- vendor/NetBSD/bmake/dist/bmake.1 Mon Dec 19 21:27:18 2016 (r310298) +++ vendor/NetBSD/bmake/dist/bmake.1 Mon Dec 19 21:50:59 2016 (r310299) @@ -1,4 +1,4 @@ -.\" $NetBSD: make.1,v 1.262 2016/08/18 19:23:20 wiz Exp $ +.\" $NetBSD: make.1,v 1.263 2016/08/26 23:37:54 dholland Exp $ .\" .\" Copyright (c) 1990, 1993 .\" The Regents of the University of California. All rights reserved. @@ -29,8 +29,8 @@ .\" .\" from: @(#)make.1 8.4 (Berkeley) 3/19/94 .\" -.Dd August 15, 2016 -.Dt MAKE 1 +.Dd August 26, 2016 +.Dt BMAKE 1 .Os .Sh NAME .Nm bmake @@ -2011,6 +2011,14 @@ variable of a target that inherits .Ic .DEFAULT Ns 's commands is set to the target's own name. +.It Ic .DELETE_ON_ERROR +If this target is present in the makefile, it globally causes make to +delete targets whose commands fail. +(By default, only targets whose commands are interrupted during +execution are deleted. +This is the historical behavior.) +This setting can be used to help prevent half-finished or malformed +targets from being left around and corrupting future rebuilds. .It Ic .END Any command lines attached to this target are executed after everything else is done. Modified: vendor/NetBSD/bmake/dist/bmake.cat1 ============================================================================== --- vendor/NetBSD/bmake/dist/bmake.cat1 Mon Dec 19 21:27:18 2016 (r310298) +++ vendor/NetBSD/bmake/dist/bmake.cat1 Mon Dec 19 21:50:59 2016 (r310299) @@ -1,4 +1,4 @@ -MAKE(1) NetBSD General Commands Manual MAKE(1) +BMAKE(1) NetBSD General Commands Manual BMAKE(1) NNAAMMEE bbmmaakkee -- maintain program dependencies @@ -1285,6 +1285,14 @@ SSPPEECCIIAALL TTAARRGGEETT target that inherits ..DDEEFFAAUULLTT's commands is set to the target's own name. + ..DDEELLEETTEE__OONN__EERRRROORR + If this target is present in the makefile, it globally causes + make to delete targets whose commands fail. (By default, only + targets whose commands are interrupted during execution are + deleted. This is the historical behavior.) This setting can be + used to help prevent half-finished or malformed targets from + being left around and corrupting future rebuilds. + ..EENNDD Any command lines attached to this target are executed after everything else is done. @@ -1498,4 +1506,4 @@ BBUUGGSS There is no way of escaping a space character in a filename. -NetBSD 5.1 August 15, 2016 NetBSD 5.1 +NetBSD 5.1 August 26, 2016 NetBSD 5.1 Modified: vendor/NetBSD/bmake/dist/compat.c ============================================================================== --- vendor/NetBSD/bmake/dist/compat.c Mon Dec 19 21:27:18 2016 (r310298) +++ vendor/NetBSD/bmake/dist/compat.c Mon Dec 19 21:50:59 2016 (r310299) @@ -1,4 +1,4 @@ -/* $NetBSD: compat.c,v 1.105 2016/05/12 20:28:34 sjg Exp $ */ +/* $NetBSD: compat.c,v 1.106 2016/08/26 23:28:39 dholland Exp $ */ /* * Copyright (c) 1988, 1989, 1990 The Regents of the University of California. @@ -70,14 +70,14 @@ */ #ifndef MAKE_NATIVE -static char rcsid[] = "$NetBSD: compat.c,v 1.105 2016/05/12 20:28:34 sjg Exp $"; +static char rcsid[] = "$NetBSD: compat.c,v 1.106 2016/08/26 23:28:39 dholland Exp $"; #else #include #ifndef lint #if 0 static char sccsid[] = "@(#)compat.c 8.2 (Berkeley) 3/19/94"; #else -__RCSID("$NetBSD: compat.c,v 1.105 2016/05/12 20:28:34 sjg Exp $"); +__RCSID("$NetBSD: compat.c,v 1.106 2016/08/26 23:28:39 dholland Exp $"); #endif #endif /* not lint */ #endif @@ -119,6 +119,25 @@ static GNode *curTarg = NULL; static GNode *ENDNode; static void CompatInterrupt(int); +/* + * CompatDeleteTarget -- delete a failed, interrupted, or otherwise + * duffed target if not inhibited by .PRECIOUS. + */ +static void +CompatDeleteTarget(GNode *gn) +{ + if ((gn != NULL) && !Targ_Precious (gn)) { + char *p1; + char *file = Var_Value(TARGET, gn, &p1); + + if (!noExecute && eunlink(file) != -1) { + Error("*** %s removed", file); + } + + free(p1); + } +} + /*- *----------------------------------------------------------------------- * CompatInterrupt -- @@ -132,6 +151,9 @@ static void CompatInterrupt(int); * The target is removed and the process exits. If .INTERRUPT exists, * its commands are run first WITH INTERRUPTS IGNORED.. * + * XXX: is .PRECIOUS supposed to inhibit .INTERRUPT? I doubt it, but I've + * left the logic alone for now. - dholland 20160826 + * *----------------------------------------------------------------------- */ static void @@ -139,16 +161,9 @@ CompatInterrupt(int signo) { GNode *gn; - if ((curTarg != NULL) && !Targ_Precious (curTarg)) { - char *p1; - char *file = Var_Value(TARGET, curTarg, &p1); - - if (!noExecute && eunlink(file) != -1) { - Error("*** %s removed", file); - } - - free(p1); + CompatDeleteTarget(curTarg); + if ((curTarg != NULL) && !Targ_Precious (curTarg)) { /* * Run .INTERRUPT only if hit with interrupt signal */ @@ -158,7 +173,6 @@ CompatInterrupt(int signo) Compat_Make(gn, gn); } } - } if (signo == SIGQUIT) _exit(signo); @@ -447,6 +461,11 @@ again: * continue. */ printf(" (continuing)\n"); + } else { + printf("\n"); + } + if (deleteOnError) { + CompatDeleteTarget(gn); } } else { /* @@ -607,7 +626,7 @@ Compat_Make(void *gnp, void *pgnp) } else if (keepgoing) { pgn->flags &= ~REMAKE; } else { - PrintOnError(gn, "\n\nStop."); + PrintOnError(gn, "\nStop."); exit(1); } } else if (gn->made == ERROR) { @@ -698,7 +717,7 @@ Compat_Run(Lst targs) if (gn != NULL) { Compat_Make(gn, gn); if (gn->made == ERROR) { - PrintOnError(gn, "\n\nStop."); + PrintOnError(gn, "\nStop."); exit(1); } } @@ -739,7 +758,7 @@ Compat_Run(Lst targs) if (errors == 0) { Compat_Make(ENDNode, ENDNode); if (gn->made == ERROR) { - PrintOnError(gn, "\n\nStop."); + PrintOnError(gn, "\nStop."); exit(1); } } Modified: vendor/NetBSD/bmake/dist/job.c ============================================================================== --- vendor/NetBSD/bmake/dist/job.c Mon Dec 19 21:27:18 2016 (r310298) +++ vendor/NetBSD/bmake/dist/job.c Mon Dec 19 21:50:59 2016 (r310299) @@ -1,4 +1,4 @@ -/* $NetBSD: job.c,v 1.187 2016/05/12 20:28:34 sjg Exp $ */ +/* $NetBSD: job.c,v 1.188 2016/08/26 23:28:39 dholland Exp $ */ /* * Copyright (c) 1988, 1989, 1990 The Regents of the University of California. @@ -70,14 +70,14 @@ */ #ifndef MAKE_NATIVE -static char rcsid[] = "$NetBSD: job.c,v 1.187 2016/05/12 20:28:34 sjg Exp $"; +static char rcsid[] = "$NetBSD: job.c,v 1.188 2016/08/26 23:28:39 dholland Exp $"; #else #include #ifndef lint #if 0 static char sccsid[] = "@(#)job.c 8.2 (Berkeley) 3/19/94"; #else -__RCSID("$NetBSD: job.c,v 1.187 2016/05/12 20:28:34 sjg Exp $"); +__RCSID("$NetBSD: job.c,v 1.188 2016/08/26 23:28:39 dholland Exp $"); #endif #endif /* not lint */ #endif @@ -388,6 +388,21 @@ job_table_dump(const char *where) } /* + * Delete the target of a failed, interrupted, or otherwise + * unsuccessful job unless inhibited by .PRECIOUS. + */ +static void +JobDeleteTarget(GNode *gn) +{ + if ((gn->type & (OP_JOIN|OP_PHONY)) == 0 && !Targ_Precious(gn)) { + char *file = (gn->path == NULL ? gn->name : gn->path); + if (!noExecute && eunlink(file) != -1) { + Error("*** %s removed", file); + } + } +} + +/* * JobSigLock/JobSigUnlock * * Signal lock routines to get exclusive access. Currently used to @@ -1033,6 +1048,9 @@ JobFinish (Job *job, WAIT_T status) if (job->flags & JOB_IGNERR) { WAIT_STATUS(status) = 0; } else { + if (deleteOnError) { + JobDeleteTarget(job->node); + } PrintOnError(job->node, NULL); } } else if (DEBUG(JOB)) { @@ -1050,6 +1068,9 @@ JobFinish (Job *job, WAIT_T status) } (void)printf("*** [%s] Signal %d\n", job->node->name, WTERMSIG(status)); + if (deleteOnError) { + JobDeleteTarget(job->node); + } } (void)fflush(stdout); } @@ -2578,12 +2599,7 @@ JobInterrupt(int runINTERRUPT, int signo gn = job->node; - if ((gn->type & (OP_JOIN|OP_PHONY)) == 0 && !Targ_Precious(gn)) { - char *file = (gn->path == NULL ? gn->name : gn->path); - if (!noExecute && eunlink(file) != -1) { - Error("*** %s removed", file); - } - } + JobDeleteTarget(gn); if (job->pid) { if (DEBUG(JOB)) { (void)fprintf(debug_file, Modified: vendor/NetBSD/bmake/dist/main.c ============================================================================== --- vendor/NetBSD/bmake/dist/main.c Mon Dec 19 21:27:18 2016 (r310298) +++ vendor/NetBSD/bmake/dist/main.c Mon Dec 19 21:50:59 2016 (r310299) @@ -1,4 +1,4 @@ -/* $NetBSD: main.c,v 1.250 2016/08/11 19:53:17 sjg Exp $ */ +/* $NetBSD: main.c,v 1.254 2016/12/10 23:12:39 christos Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -69,7 +69,7 @@ */ #ifndef MAKE_NATIVE -static char rcsid[] = "$NetBSD: main.c,v 1.250 2016/08/11 19:53:17 sjg Exp $"; +static char rcsid[] = "$NetBSD: main.c,v 1.254 2016/12/10 23:12:39 christos Exp $"; #else #include #ifndef lint @@ -81,7 +81,7 @@ __COPYRIGHT("@(#) Copyright (c) 1988, 19 #if 0 static char sccsid[] = "@(#)main.c 8.3 (Berkeley) 3/19/94"; #else -__RCSID("$NetBSD: main.c,v 1.250 2016/08/11 19:53:17 sjg Exp $"); +__RCSID("$NetBSD: main.c,v 1.254 2016/12/10 23:12:39 christos Exp $"); #endif #endif /* not lint */ #endif @@ -155,6 +155,7 @@ Lst create; /* Targets to be made */ time_t now; /* Time at start of make */ GNode *DEFAULT; /* .DEFAULT node */ Boolean allPrecious; /* .PRECIOUS given on line by itself */ +Boolean deleteOnError; /* .DELETE_ON_ERROR: set */ static Boolean noBuiltins; /* -r flag */ static Lst makefiles; /* ordered list of makefiles to read */ @@ -711,18 +712,24 @@ Main_ParseArgLine(const char *line) } Boolean -Main_SetObjdir(const char *path) +Main_SetObjdir(const char *fmt, ...) { struct stat sb; - char *p = NULL; - char buf[MAXPATHLEN + 1]; + char *p, *path; + char buf[MAXPATHLEN + 1], pbuf[MAXPATHLEN + 1]; Boolean rc = FALSE; + va_list ap; + + va_start(ap, fmt); + vsnprintf(path = pbuf, MAXPATHLEN, fmt, ap); + va_end(ap); /* expand variable substitutions */ if (strchr(path, '$') != 0) { snprintf(buf, MAXPATHLEN, "%s", path); path = p = Var_Subst(NULL, buf, VAR_GLOBAL, VARF_WANTRES); - } + } else + p = NULL; if (path[0] != '/') { snprintf(buf, MAXPATHLEN, "%s/%s", curdir, path); @@ -749,6 +756,18 @@ Main_SetObjdir(const char *path) return rc; } +static Boolean +Main_SetVarObjdir(const char *var, const char *suffix) +{ + char *p1, *path; + if ((path = Var_Value(var, VAR_CMD, &p1)) == NULL) + return FALSE; + + (void)Main_SetObjdir("%s%s", path, suffix); + free(p1); + return TRUE; +} + /*- * ReadAllMakefiles -- * wrapper around ReadMakefile() to read all. @@ -979,6 +998,7 @@ main(int argc, char **argv) noRecursiveExecute = FALSE; /* Execute all .MAKE targets */ keepgoing = FALSE; /* Stop on error */ allPrecious = FALSE; /* Remove targets when interrupted */ + deleteOnError = FALSE; /* Historical default behavior */ queryFlag = FALSE; /* This is not just a check-run */ noBuiltins = FALSE; /* Read the built-in rules */ touchFlag = FALSE; /* Actually update targets */ @@ -1128,28 +1148,19 @@ main(int argc, char **argv) * MAKEOBJDIR is set in the environment, try only that value * and fall back to .CURDIR if it does not exist. * - * Otherwise, try _PATH_OBJDIR.MACHINE, _PATH_OBJDIR, and - * finally _PATH_OBJDIRPREFIX`pwd`, in that order. If none + * Otherwise, try _PATH_OBJDIR.MACHINE-MACHINE_ARCH, _PATH_OBJDIR.MACHINE, + * and * finally _PATH_OBJDIRPREFIX`pwd`, in that order. If none * of these paths exist, just use .CURDIR. */ Dir_Init(curdir); - (void)Main_SetObjdir(curdir); + (void)Main_SetObjdir("%s", curdir); - if ((path = Var_Value("MAKEOBJDIRPREFIX", VAR_CMD, &p1)) != NULL) { - (void)snprintf(mdpath, MAXPATHLEN, "%s%s", path, curdir); - (void)Main_SetObjdir(mdpath); - free(p1); - } else if ((path = Var_Value("MAKEOBJDIR", VAR_CMD, &p1)) != NULL) { - (void)Main_SetObjdir(path); - free(p1); - } else { - (void)snprintf(mdpath, MAXPATHLEN, "%s.%s", _PATH_OBJDIR, machine); - if (!Main_SetObjdir(mdpath) && !Main_SetObjdir(_PATH_OBJDIR)) { - (void)snprintf(mdpath, MAXPATHLEN, "%s%s", - _PATH_OBJDIRPREFIX, curdir); - (void)Main_SetObjdir(mdpath); - } - } + if (!Main_SetVarObjdir("MAKEOBJDIRPREFIX", curdir) && + !Main_SetVarObjdir("MAKEOBJDIR", "") && + !Main_SetObjdir("%s.%s-%s", _PATH_OBJDIR, machine, machine_arch) && + !Main_SetObjdir("%s.%s", _PATH_OBJDIR, machine) && + !Main_SetObjdir("%s", _PATH_OBJDIR)) + (void)Main_SetObjdir("%s%s", _PATH_OBJDIRPREFIX, curdir); /* * Initialize archive, target and suffix modules in preparation for Modified: vendor/NetBSD/bmake/dist/make.1 ============================================================================== --- vendor/NetBSD/bmake/dist/make.1 Mon Dec 19 21:27:18 2016 (r310298) +++ vendor/NetBSD/bmake/dist/make.1 Mon Dec 19 21:50:59 2016 (r310299) @@ -1,4 +1,4 @@ -.\" $NetBSD: make.1,v 1.262 2016/08/18 19:23:20 wiz Exp $ +.\" $NetBSD: make.1,v 1.263 2016/08/26 23:37:54 dholland Exp $ .\" .\" Copyright (c) 1990, 1993 .\" The Regents of the University of California. All rights reserved. @@ -29,7 +29,7 @@ .\" .\" from: @(#)make.1 8.4 (Berkeley) 3/19/94 .\" -.Dd August 15, 2016 +.Dd August 26, 2016 .Dt MAKE 1 .Os .Sh NAME @@ -2011,6 +2011,14 @@ variable of a target that inherits .Ic .DEFAULT Ns 's commands is set to the target's own name. +.It Ic .DELETE_ON_ERROR +If this target is present in the makefile, it globally causes make to +delete targets whose commands fail. +(By default, only targets whose commands are interrupted during +execution are deleted. +This is the historical behavior.) +This setting can be used to help prevent half-finished or malformed +targets from being left around and corrupting future rebuilds. .It Ic .END Any command lines attached to this target are executed after everything else is done. Modified: vendor/NetBSD/bmake/dist/make.c ============================================================================== --- vendor/NetBSD/bmake/dist/make.c Mon Dec 19 21:27:18 2016 (r310298) +++ vendor/NetBSD/bmake/dist/make.c Mon Dec 19 21:50:59 2016 (r310299) @@ -1,4 +1,4 @@ -/* $NetBSD: make.c,v 1.95 2016/02/18 18:29:14 christos Exp $ */ +/* $NetBSD: make.c,v 1.96 2016/11/10 23:41:58 sjg Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -69,14 +69,14 @@ */ #ifndef MAKE_NATIVE -static char rcsid[] = "$NetBSD: make.c,v 1.95 2016/02/18 18:29:14 christos Exp $"; +static char rcsid[] = "$NetBSD: make.c,v 1.96 2016/11/10 23:41:58 sjg Exp $"; #else #include #ifndef lint #if 0 static char sccsid[] = "@(#)make.c 8.1 (Berkeley) 6/6/93"; #else -__RCSID("$NetBSD: make.c,v 1.95 2016/02/18 18:29:14 christos Exp $"); +__RCSID("$NetBSD: make.c,v 1.96 2016/11/10 23:41:58 sjg Exp $"); #endif #endif /* not lint */ #endif @@ -308,7 +308,7 @@ Make_OODate(GNode *gn) if (DEBUG(MAKE)) { if (gn->cmgn != NULL && gn->mtime < gn->cmgn->mtime) { fprintf(debug_file, "modified before source %s...", - gn->cmgn->path); + gn->cmgn->path ? gn->cmgn->path : gn->cmgn->name); } else if (gn->mtime == 0) { fprintf(debug_file, "non-existent and no sources..."); } else { Modified: vendor/NetBSD/bmake/dist/make.h ============================================================================== --- vendor/NetBSD/bmake/dist/make.h Mon Dec 19 21:27:18 2016 (r310298) +++ vendor/NetBSD/bmake/dist/make.h Mon Dec 19 21:50:59 2016 (r310299) @@ -1,4 +1,4 @@ -/* $NetBSD: make.h,v 1.100 2016/06/07 00:40:00 sjg Exp $ */ +/* $NetBSD: make.h,v 1.102 2016/12/07 15:00:46 christos Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -389,6 +389,7 @@ extern Boolean beSilent; /* True if extern Boolean noExecute; /* True if should execute nothing */ extern Boolean noRecursiveExecute; /* True if should execute nothing */ extern Boolean allPrecious; /* True if every target is precious */ +extern Boolean deleteOnError; /* True if failed targets should be deleted */ extern Boolean keepgoing; /* True if should continue on unaffected * portions of the graph when have an error * in one portion */ @@ -503,7 +504,7 @@ char * Check_Cwd_Cmd(const char *); void Check_Cwd(const char **); void PrintOnError(GNode *, const char *); void Main_ExportMAKEFLAGS(Boolean); -Boolean Main_SetObjdir(const char *); +Boolean Main_SetObjdir(const char *, ...) MAKE_ATTR_PRINTFLIKE(1, 2); int mkTempFile(const char *, char **); int str2Lst_Append(Lst, char *, const char *); int cached_lstat(const char *, void *); Modified: vendor/NetBSD/bmake/dist/mk/ChangeLog ============================================================================== --- vendor/NetBSD/bmake/dist/mk/ChangeLog Mon Dec 19 21:27:18 2016 (r310298) +++ vendor/NetBSD/bmake/dist/mk/ChangeLog Mon Dec 19 21:50:59 2016 (r310299) @@ -1,3 +1,62 @@ +2016-12-12 Simon J. Gerraty + + * install-mk (MK_VERSION): 20161212 + + * meta2deps.py: set pid_cwd[pid] when we process 'C'hdir, + rather than when we detect pid change. + +2016-12-07 Simon J. Gerraty + + * install-mk (MK_VERSION): 20161207 + + * meta.stage.mk: add stage_as_and_symlink for staging packages. + We build foo.tgz stage_as foo-${VERSION}.tgz but want to be able + to use foo.tgz to reference the latest staged version - so we + make foo.tgz a symlink to it. + Using a target to do both operations ensures we stay in sync. + +2016-11-26 Simon J. Gerraty + + * install-mk (MK_VERSION): 20161126 + + * dirdeps.mk: set DIRDEPS_CACHE before we include local.dirdeps.mk + so it can add dependencies. + +2016-10-10 Simon J. Gerraty + + * dirdeps.mk: set DEP_* before we expand .MAKE.DEPENDFILE_PREFERENCE + do that they can influence the result correctly. + + * dirdeps.mk (${DIRDEPS_CACHE}): make sure we pass on TARGET_SPEC + + * dirdeps.mk: Add ONLY_TARGET_SPEC_LIST and NOT_TARGET_SPEC_LIST + similar to ONLY_MACHINE_LIST and NOT_MACHINE_LIST + +2016-10-05 Simon J. Gerraty + + * dirdeps.mk: remove dependence on jot (normal situations anyway). + Before we read another Makefile.depend* set DEP_* vars from + _DEP_TARGET_SPEC in case it uses any of them with := + When bootstrapping, trim any ,* from extention of chosen _src + Makefile.depend* to get the machine value we subst for. + +2016-09-30 Simon J. Gerraty + + * dirdeps.mk: use TARGET_SPEC_VARS to qualify components added to + DEP_SKIP_DIR and DEP_DIRDEPS_FILTER + + * sys.mk: extract some bits to sys.{debug,vars}.mk + for easier re-use by others. + +2016-09-23 Simon Gerraty + + * lib.mk: Use ${PICO} for extension for PIC objects. + default to .pico (like NetBSD) safe on case insensitive filesystem. + +2016-08-19 Simon J. Gerraty + + * meta.sys.mk (META_COOKIE_TOUCH): use ${.OBJDIR}/${.TARGET:T} as default + 2016-08-15 Simon J. Gerraty * install-mk (MK_VERSION): 20160815 Modified: vendor/NetBSD/bmake/dist/mk/FILES ============================================================================== --- vendor/NetBSD/bmake/dist/mk/FILES Mon Dec 19 21:27:18 2016 (r310298) +++ vendor/NetBSD/bmake/dist/mk/FILES Mon Dec 19 21:50:59 2016 (r310299) @@ -38,7 +38,9 @@ stage-install.sh subdir.mk sys.mk sys.clean-env.mk +sys.debug.mk sys.dependfile.mk +sys.vars.mk sys/AIX.mk sys/Darwin.mk sys/Generic.mk Modified: vendor/NetBSD/bmake/dist/mk/dirdeps.mk ============================================================================== --- vendor/NetBSD/bmake/dist/mk/dirdeps.mk Mon Dec 19 21:27:18 2016 (r310298) +++ vendor/NetBSD/bmake/dist/mk/dirdeps.mk Mon Dec 19 21:50:59 2016 (r310299) @@ -1,4 +1,4 @@ -# $Id: dirdeps.mk,v 1.73 2016/08/15 19:28:13 sjg Exp $ +# $Id: dirdeps.mk,v 1.84 2016/11/27 02:44:34 sjg Exp $ # Copyright (c) 2010-2013, Juniper Networks, Inc. # All rights reserved. @@ -56,9 +56,12 @@ # .MAKE.DEPENDFILE_PREFIX) to refer to these makefiles to # distinguish them from others. # -# Each Makefile.depend file sets DEP_RELDIR to be the -# the RELDIR (path relative to SRCTOP) for its directory, and -# since each Makefile.depend file includes dirdeps.mk, this +# Before each Makefile.depend file is read, we set +# DEP_RELDIR to be the the RELDIR (path relative to SRCTOP) for +# its directory, and DEP_MACHINE etc according to the . +# represented by the suffix of the corresponding target. +# +# Since each Makefile.depend file includes dirdeps.mk, this # processing is recursive and results in .MAKE.LEVEL 0 learning the # dependencies of the tree wrt the initial directory (_DEP_RELDIR). # @@ -110,6 +113,29 @@ # # as we may need it to find Makefile.depend* # TARGET_SPEC = ${TARGET_SPEC_VARS:@v@${$v:U}@:ts,} # +# The following variables can influence the initial DIRDEPS +# computation with regard to the TARGET_SPECs that will be +# built. +# Most should also be considered by init.mk +# +# ONLY_TARGET_SPEC_LIST +# Defines a list of TARGET_SPECs for which the current +# directory can be built. +# If ALL_MACHINES is defined, we build for all the +# TARGET_SPECs listed. +# +# ONLY_MACHINE_LIST +# As for ONLY_TARGET_SPEC_LIST but only specifies +# MACHINEs. +# +# NOT_TARGET_SPEC_LIST +# A list of TARGET_SPECs for which the current +# directory should not be built. +# +# NOT_MACHINE_LIST +# A list of MACHINEs the current directory should not be +# built for. +# # touch this at your peril _DIRDEP_USE_LEVEL?= 0 @@ -171,9 +197,13 @@ DEP_$v ?= ${$v} # we compute below are fully qualified wrt DEP_TARGET_SPEC. # The makefiles may only partially specify (eg. MACHINE only), # so we need to construct a set of modifiers to fill in the gaps. -# jot 10 should output 1 2 3 .. 10 -JOT ?= jot -_tspec_x := ${${JOT} ${TARGET_SPEC_VARS:[#]}:L:sh} +.if ${TARGET_SPEC_VARS:[#]} > 10 +# seriously? better have jot(1) or equivalent to produce suitable sequence +_tspec_x := ${${JOT:Ujot} ${TARGET_SPEC_VARS:[#]}:L:sh} +.else +# we can provide the sequence ourselves +_tspec_x := ${1 2 3 4 5 6 7 8 9 10:L:[1..${TARGET_SPEC_VARS:[#]}]} +.endif # this handles unqualified entries M_dep_qual_fixes = C;(/[^/.,]+)$$;\1.$${DEP_TARGET_SPEC}; # there needs to be at least one item missing for these to make sense @@ -287,6 +317,18 @@ _DEP_RELDIR := ${DEP_RELDIR} .endif +# DIRDEPS_CACHE can be very handy for debugging. +# Also if repeatedly building the same target, +# we can avoid the overhead of re-computing the tree dependencies. +MK_DIRDEPS_CACHE ?= no +BUILD_DIRDEPS_CACHE ?= no +BUILD_DIRDEPS ?= yes + +.if ${MK_DIRDEPS_CACHE} == "yes" +# this is where we will cache all our work +DIRDEPS_CACHE ?= ${_OBJDIR:tA}/dirdeps.cache${.TARGETS:Nall:O:u:ts-:S,/,_,g:S,^,.,:N.} +.endif + # pickup customizations # as below you can use !target(_DIRDEP_USE) to protect things # which should only be done once. @@ -305,8 +347,10 @@ SKIP_DIR.host += ${SKIP_HOSTDIR} DEP_SKIP_DIR = ${SKIP_DIR} \ ${SKIP_DIR.${DEP_TARGET_SPEC}:U} \ - ${SKIP_DIR.${DEP_MACHINE}:U} \ - ${SKIP_DIRDEPS.${DEP_MACHINE}:U} + ${TARGET_SPEC_VARS:@v@${SKIP_DIR.${DEP_$v}:U}@} \ + ${SKIP_DIRDEPS.${DEP_TARGET_SPEC}:U} \ + ${TARGET_SPEC_VARS:@v@${SKIP_DIRDEPS.${DEP_$v}:U}@} + NSkipDir = ${DEP_SKIP_DIR:${M_ListToSkip}} @@ -344,7 +388,7 @@ _DIRDEP_USE: .USE .MAKE .ifdef ALL_MACHINES # this is how you limit it to only the machines we have been built for # previously. -.if empty(ONLY_MACHINE_LIST) +.if empty(ONLY_TARGET_SPEC_LIST) && empty(ONLY_MACHINE_LIST) .if !empty(ALL_MACHINE_LIST) # ALL_MACHINE_LIST is the list of all legal machines - ignore anything else _machine_list != cd ${_CURDIR} && 'ls' -1 ${ALL_MACHINE_LIST:O:u:@m@${.MAKE.DEPENDFILE:T:R}.$m@} 2> /dev/null; echo @@ -353,7 +397,7 @@ _machine_list != 'ls' -1 ${_CURDIR}/${.M .endif _only_machines := ${_machine_list:${NIgnoreFiles:UN*.bak}:E:O:u} .else -_only_machines := ${ONLY_MACHINE_LIST} +_only_machines := ${ONLY_TARGET_SPEC_LIST:U} ${ONLY_MACHINE_LIST:U} .endif .if empty(_only_machines) @@ -362,30 +406,35 @@ _only_machines := ${TARGET_MACHINE:U${AL .endif .else # ! ALL_MACHINES -# if ONLY_MACHINE_LIST is set, we are limited to that +# if ONLY_TARGET_SPEC_LIST or ONLY_MACHINE_LIST is set, we are limited to that. +# Note that ONLY_TARGET_SPEC_LIST should be fully qualified. # if TARGET_MACHINE is set - it is really the same as ONLY_MACHINE_LIST # otherwise DEP_MACHINE is it - so DEP_MACHINE will match. +_only_machines := ${ONLY_TARGET_SPEC_LIST:U:M${DEP_MACHINE},*} +.if empty(_only_machines) _only_machines := ${ONLY_MACHINE_LIST:U${TARGET_MACHINE:U${DEP_MACHINE}}:M${DEP_MACHINE}} .endif +.endif .if !empty(NOT_MACHINE_LIST) _only_machines := ${_only_machines:${NOT_MACHINE_LIST:${M_ListToSkip}}} .endif +.if !empty(NOT_TARGET_SPEC_LIST) +# we must first qualify +_dm := ${DEP_MACHINE} +_only_machines := ${_only_machines:M*,*} ${_only_machines:N*,*:@DEP_MACHINE@${DEP_TARGET_SPEC}@:S,^,.,:${M_dep_qual_fixes:ts:}:O:u:S,^.,,} +DEP_MACHINE := ${_dm} +_only_machines := ${_only_machines:${NOT_TARGET_SPEC_LIST:${M_ListToSkip}}} +.endif +# clean up +_only_machines := ${_only_machines:O:u} # make sure we have a starting place? DIRDEPS ?= ${RELDIR} .endif # target -# if repeatedly building the same target, -# we can avoid the overhead of re-computing the tree dependencies. -MK_DIRDEPS_CACHE ?= no -BUILD_DIRDEPS_CACHE ?= no -BUILD_DIRDEPS ?= yes - .if !defined(NO_DIRDEPS) && !defined(NO_DIRDEPS_BELOW) .if ${MK_DIRDEPS_CACHE} == "yes" -# this is where we will cache all our work -DIRDEPS_CACHE?= ${_OBJDIR:tA}/dirdeps.cache${.TARGETS:Nall:O:u:ts-:S,/,_,g:S,^,.,:N.} # just ensure this exists build-dirdeps: @@ -420,6 +469,7 @@ ${DIRDEPS_CACHE}: .META .NOMETA_CMP } > ${.TARGET}.new +@MAKELEVEL=${.MAKE.LEVEL} DIRDEPS_CACHE=${DIRDEPS_CACHE} \ DIRDEPS="${DIRDEPS}" \ + TARGET_SPEC=${TARGET_SPEC} \ MAKEFLAGS= ${.MAKE} -C ${_CURDIR} -f ${BUILD_DIRDEPS_MAKEFILE} \ ${BUILD_DIRDEPS_TARGETS} BUILD_DIRDEPS_CACHE=yes \ .MAKE.DEPENDFILE=.none \ @@ -489,8 +539,10 @@ _machines := ${_machines:O:u} _dm := ${DEP_MACHINE} # apply the same filtering that we do when qualifying DIRDEPS. # M_dep_qual_fixes expects .${MACHINE}* so add (and remove) '.' -_machines := ${_machines:@DEP_MACHINE@${DEP_TARGET_SPEC}@:S,^,.,:${M_dep_qual_fixes:ts:}:O:u:S,^.,,} +# Again we expect that any already qualified machines are fully qualified. +_machines := ${_machines:M*,*} ${_machines:N*,*:@DEP_MACHINE@${DEP_TARGET_SPEC}@:S,^,.,:${M_dep_qual_fixes:ts:}:O:u:S,^.,,} DEP_MACHINE := ${_dm} +_machines := ${_machines:O:u} .endif # reset each time through @@ -522,7 +574,7 @@ _build_dirs += ${_machines:N${DEP_TARGET # these we reset each time through as they can depend on DEP_MACHINE DEP_DIRDEPS_FILTER = \ ${DIRDEPS_FILTER.${DEP_TARGET_SPEC}:U} \ - ${DIRDEPS_FILTER.${DEP_MACHINE}:U} \ + ${TARGET_SPEC_VARS:@v@${DIRDEPS_FILTER.${DEP_$v}:U}@} \ ${DIRDEPS_FILTER:U} .if empty(DEP_DIRDEPS_FILTER) # something harmless @@ -621,6 +673,19 @@ _dirdeps_checked.$d: .endif # Note: _build_all_dirs is fully qualifed so d:R is always the directory .if exists(${d:R}) +# we pass _DEP_TARGET_SPEC to tell the next step what we want +_DEP_TARGET_SPEC := ${d:E} +# some makefiles may still look at this +_DEP_MACHINE := ${d:E:C/,.*//} +# set these too in case Makefile.depend* uses them +.if ${TARGET_SPEC_VARS:[#]} > 1 +_dtspec := ${_DEP_TARGET_SPEC:S/,/ /g} +.for i in ${_tspec_x} +DEP_${TARGET_SPEC_VARS:[$i]} := ${_dtspec:[$i]} +.endfor +.else +DEP_MACHINE := ${_DEP_MACHINE} +.endif # Warning: there is an assumption here that MACHINE is always # the first entry in TARGET_SPEC_VARS. # If TARGET_SPEC and MACHINE are insufficient, you have a problem. @@ -631,10 +696,6 @@ _qm := ${_m:C;(\.depend)$;\1.${d:E};:${M .if ${_debug_search} .info Looking for ${_qm} .endif -# we pass _DEP_TARGET_SPEC to tell the next step what we want -_DEP_TARGET_SPEC := ${d:E} -# some makefiles may still look at this -_DEP_MACHINE := ${d:E:C/,.*//} # set this "just in case" # we can skip :tA since we computed the path above DEP_RELDIR := ${_m:H:S,${SRCTOP}/,,} @@ -687,7 +748,7 @@ _src != cd ${.CURDIR} && for m in ${.MAK _src?= ${.MAKE.DEPENDFILE} -.MAKE.DEPENDFILE_BOOTSTRAP_SED+= -e 's,${_src:E},${MACHINE},g' +.MAKE.DEPENDFILE_BOOTSTRAP_SED+= -e 's/${_src:E:C/,.*//}/${MACHINE}/g' # just create Makefile.depend* for this dir bootstrap-this: .NOTMAIN @@ -696,7 +757,7 @@ bootstrap-this: .NOTMAIN .if ${_src:T} != ${.MAKE.DEPENDFILE_PREFIX:T} (cd ${.CURDIR} && sed ${.MAKE.DEPENDFILE_BOOTSTRAP_SED} ${_src} > ${_want}) .else - cp ${.CURDIR}/${_src} ${_want} + cp ${.CURDIR}/${_src:T} ${_want} .endif # create Makefile.depend* for this dir and its dependencies Modified: vendor/NetBSD/bmake/dist/mk/gendirdeps.mk ============================================================================== --- vendor/NetBSD/bmake/dist/mk/gendirdeps.mk Mon Dec 19 21:27:18 2016 (r310298) +++ vendor/NetBSD/bmake/dist/mk/gendirdeps.mk Mon Dec 19 21:50:59 2016 (r310299) @@ -1,4 +1,4 @@ -# $Id: gendirdeps.mk,v 1.32 2016/04/05 15:58:37 sjg Exp $ +# $Id: gendirdeps.mk,v 1.33 2016/10/11 22:37:28 sjg Exp $ # Copyright (c) 2010-2013, Juniper Networks, Inc. # All rights reserved. @@ -146,6 +146,9 @@ M2D_OBJROOTS += ${OBJTOP} ${_OBJROOT} ${ .if defined(SB_OBJROOT) M2D_OBJROOTS += ${SB_OBJROOT} .endif +.if defined(STAGE_ROOT) +M2D_OBJROOTS += ${STAGE_ROOT} +.endif .if ${.MAKE.DEPENDFILE_PREFERENCE:U${.MAKE.DEPENDFILE}:M*.${MACHINE}} == "" # meta2deps.py only groks objroot # so we need to give it what it expects Modified: vendor/NetBSD/bmake/dist/mk/install-mk ============================================================================== --- vendor/NetBSD/bmake/dist/mk/install-mk Mon Dec 19 21:27:18 2016 (r310298) +++ vendor/NetBSD/bmake/dist/mk/install-mk Mon Dec 19 21:50:59 2016 (r310299) @@ -55,7 +55,7 @@ # Simon J. Gerraty # RCSid: -# $Id: install-mk,v 1.130 2016/08/15 19:28:13 sjg Exp $ +# $Id: install-mk,v 1.135 2016/12/12 19:07:42 sjg Exp $ # # @(#) Copyright (c) 1994 Simon J. Gerraty # @@ -70,7 +70,7 @@ # sjg@crufty.net # -MK_VERSION=20160815 +MK_VERSION=20161212 OWNER= GROUP= MODE=444 Modified: vendor/NetBSD/bmake/dist/mk/lib.mk ============================================================================== --- vendor/NetBSD/bmake/dist/mk/lib.mk Mon Dec 19 21:27:18 2016 (r310298) +++ vendor/NetBSD/bmake/dist/mk/lib.mk Mon Dec 19 21:50:59 2016 (r310299) @@ -1,4 +1,4 @@ -# $Id: lib.mk,v 1.54 2016/08/02 20:52:17 sjg Exp $ +# $Id: lib.mk,v 1.55 2016/09/23 23:04:51 sjg Exp $ .if !target(__${.PARSEFILE}__) __${.PARSEFILE}__: @@ -9,39 +9,30 @@ __${.PARSEFILE}__: NEED_SOLINKS?= yes .endif -.if exists(${.CURDIR}/shlib_version) -SHLIB_MAJOR != . ${.CURDIR}/shlib_version ; echo $$major -SHLIB_MINOR != . ${.CURDIR}/shlib_version ; echo $$minor -.endif - -print-shlib-major: -.if defined(SHLIB_MAJOR) && ${MK_PIC} != "no" - @echo ${SHLIB_MAJOR} -.else - @false +SHLIB_VERSION_FILE?= ${.CURDIR}/shlib_version +.if !defined(SHLIB_MAJOR) && exists(${SHLIB_VERSION_FILE}) +SHLIB_MAJOR != . ${SHLIB_VERSION_FILE} ; echo $$major +SHLIB_MINOR != . ${SHLIB_VERSION_FILE} ; echo $$minor +SHLIB_TEENY != . ${SHLIB_VERSION_FILE} ; echo $$teeny .endif -print-shlib-minor: -.if defined(SHLIB_MINOR) && ${MK_PIC} != "no" - @echo ${SHLIB_MINOR} -.else - @false -.endif - -print-shlib-teeny: -.if defined(SHLIB_TEENY) && ${MK_PIC} != "no" - @echo ${SHLIB_TEENY} +.for x in major minor teeny +print-shlib-$x: +.if defined(SHLIB_${x:tu}) && ${MK_PIC} != "no" + @echo ${SHLIB_${x:tu}} .else @false .endif +.endfor SHLIB_FULLVERSION ?= ${${SHLIB_MAJOR} ${SHLIB_MINOR} ${SHLIB_TEENY}:L:ts.} SHLIB_FULLVERSION := ${SHLIB_FULLVERSION} # add additional suffixes not exported. # .po is used for profiling object files. -# .So is used for PIC object files. -.SUFFIXES: .out .a .ln .So .po .o .s .S .c .cc .C .m .F .f .r .y .l .cl .p .h +# ${PICO} is used for PIC object files. +PICO?= .pico +.SUFFIXES: .out .a .ln ${PICO} .po .o .s .S .c .cc .C .m .F .f .r .y .l .cl .p .h .SUFFIXES: .sh .m4 .m CFLAGS+= ${COPTS} @@ -62,12 +53,12 @@ CFLAGS+= ${COPTS} # with ELF, also set shared-lib version for ld.so. # SHLIB_LDSTARTFILE: support .o file, call C++ file-level constructors # SHLIB_LDENDFILE: support .o file, call C++ file-level destructors -# FPICFLAGS: flags for ${FC} to compile .[fF] files to .So objects. +# FPICFLAGS: flags for ${FC} to compile .[fF] files to ${PICO} objects. # CPPICFLAGS: flags for ${CPP} to preprocess .[sS] files for ${AS} -# CPICFLAGS: flags for ${CC} to compile .[cC] files to .So objects. +# CPICFLAGS: flags for ${CC} to compile .[cC] files to ${PICO} objects. # CAPICFLAGS flags for {$CC} to compiling .[Ss] files # (usually just ${CPPPICFLAGS} ${CPICFLAGS}) -# APICFLAGS: flags for ${AS} to assemble .[sS] to .So objects. +# APICFLAGS: flags for ${AS} to assemble .[sS] to ${PICO} objects. .if ${TARGET_OSNAME} == "NetBSD" .if ${MACHINE_ARCH} == "alpha" @@ -162,14 +153,14 @@ LD_shared=-b LD_so=sl DLLIB= # HPsUX lorder does not grok anything but .o -LD_sobjs=`${LORDER} ${OBJS} | ${TSORT} | sed 's,\.o,.So,'` +LD_sobjs=`${LORDER} ${OBJS} | ${TSORT} | sed 's,\.o,${PICO},'` LD_pobjs=`${LORDER} ${OBJS} | ${TSORT} | sed 's,\.o,.po,'` .elif ${TARGET_OSNAME} == "OSF1" LD_shared= -msym -shared -expect_unresolved '*' LD_solib= -all lib${LIB}_pic.a DLLIB= # lorder does not grok anything but .o -LD_sobjs=`${LORDER} ${OBJS} | ${TSORT} | sed 's,\.o,.So,'` +LD_sobjs=`${LORDER} ${OBJS} | ${TSORT} | sed 's,\.o,${PICO},'` LD_pobjs=`${LORDER} ${OBJS} | ${TSORT} | sed 's,\.o,.po,'` *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@freebsd.org Mon Dec 19 21:51:15 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 242BCC88B76; Mon, 19 Dec 2016 21:51:15 +0000 (UTC) (envelope-from sjg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id CCBB41447; Mon, 19 Dec 2016 21:51:14 +0000 (UTC) (envelope-from sjg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBJLpDjQ089791; Mon, 19 Dec 2016 21:51:13 GMT (envelope-from sjg@FreeBSD.org) Received: (from sjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBJLpD6U089790; Mon, 19 Dec 2016 21:51:13 GMT (envelope-from sjg@FreeBSD.org) Message-Id: <201612192151.uBJLpD6U089790@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sjg set sender to sjg@FreeBSD.org using -f From: "Simon J. Gerraty" Date: Mon, 19 Dec 2016 21:51:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r310300 - vendor/NetBSD/bmake/20161212 X-SVN-Group: vendor MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Dec 2016 21:51:15 -0000 Author: sjg Date: Mon Dec 19 21:51:13 2016 New Revision: 310300 URL: https://svnweb.freebsd.org/changeset/base/310300 Log: tag bmake-20161212 Added: vendor/NetBSD/bmake/20161212/ - copied from r310299, vendor/NetBSD/bmake/dist/ From owner-svn-src-all@freebsd.org Mon Dec 19 22:15:30 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id BD9DBC88237; Mon, 19 Dec 2016 22:15:30 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 97A8E13C1; Mon, 19 Dec 2016 22:15:30 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBJMFTvq001085; Mon, 19 Dec 2016 22:15:29 GMT (envelope-from rmacklem@FreeBSD.org) Received: (from rmacklem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBJMFTbY001084; Mon, 19 Dec 2016 22:15:29 GMT (envelope-from rmacklem@FreeBSD.org) Message-Id: <201612192215.uBJMFTbY001084@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rmacklem set sender to rmacklem@FreeBSD.org using -f From: Rick Macklem Date: Mon, 19 Dec 2016 22:15:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r310301 - stable/11/sys/fs/nfsserver X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Dec 2016 22:15:30 -0000 Author: rmacklem Date: Mon Dec 19 22:15:29 2016 New Revision: 310301 URL: https://svnweb.freebsd.org/changeset/base/310301 Log: MFC: r309566 Fix the NFSv4.1 server for Open reclaim after a reboot. The NFSv4.1 server failed to update the nfs-stablerestart file for a client when the client was issued its first Open. As such, recovery of Opens after a server reboot failed with NFSERR_NOGRACE. This patch fixes this. It also changes the code so that it malloc()'s the 1024 byte array instead of allocating it on the kernel stack for both NFSv4.0 and NFSv4.1. Note that this bug only affected NFSv4.1 and only when clients attempted to reclaim Opens after a server reboot. Modified: stable/11/sys/fs/nfsserver/nfs_nfsdstate.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/fs/nfsserver/nfs_nfsdstate.c ============================================================================== --- stable/11/sys/fs/nfsserver/nfs_nfsdstate.c Mon Dec 19 21:51:13 2016 (r310300) +++ stable/11/sys/fs/nfsserver/nfs_nfsdstate.c Mon Dec 19 22:15:29 2016 (r310301) @@ -2501,6 +2501,8 @@ nfsrv_openctrl(struct nfsrv_descript *nd struct nfsclient *clp; int error = 0, haslock = 0, ret, delegate = 1, writedeleg = 1; int readonly = 0, cbret = 1, getfhret = 0; + int gotstate = 0, len = 0; + u_char *clidp = NULL; if ((new_stp->ls_flags & NFSLCK_SHAREBITS) == NFSLCK_READACCESS) readonly = 1; @@ -2519,6 +2521,7 @@ nfsrv_openctrl(struct nfsrv_descript *nd goto out; } + clidp = malloc(NFSV4_OPAQUELIMIT, M_TEMP, M_WAITOK); tryagain: MALLOC(new_lfp, struct nfslockfile *, sizeof (struct nfslockfile), M_NFSDLOCKFILE, M_WAITOK); @@ -3181,6 +3184,16 @@ tryagain: nfsrv_openpluslock++; nfsrv_delegatecnt++; } + /* + * Since NFSv4.1 never does an OpenConfirm, the first + * open state will be acquired here. + */ + if (!(clp->lc_flags & LCL_STAMPEDSTABLE)) { + clp->lc_flags |= LCL_STAMPEDSTABLE; + len = clp->lc_idlen; + NFSBCOPY(clp->lc_id, clidp, len); + gotstate = 1; + } } else { *rflagsp |= NFSV4OPEN_RESULTCONFIRM; new_stp->ls_flags = NFSLCK_NEEDSCONFIRM; @@ -3217,7 +3230,17 @@ tryagain: if (new_deleg) FREE((caddr_t)new_deleg, M_NFSDSTATE); + /* + * If the NFSv4.1 client just acquired its first open, write a timestamp + * to the stable storage file. + */ + if (gotstate != 0) { + nfsrv_writestable(clidp, len, NFSNST_NEWSTATE, p); + nfsrv_backupstable(); + } + out: + free(clidp, M_TEMP); NFSEXITCODE2(error, nd); return (error); } @@ -3234,7 +3257,7 @@ nfsrv_openupdate(vnode_t vp, struct nfss struct nfslockfile *lfp; u_int32_t bits; int error = 0, gotstate = 0, len = 0; - u_char client[NFSV4_OPAQUELIMIT]; + u_char *clidp = NULL; /* * Check for restart conditions (client and server). @@ -3244,6 +3267,7 @@ nfsrv_openupdate(vnode_t vp, struct nfss if (error) goto out; + clidp = malloc(NFSV4_OPAQUELIMIT, M_TEMP, M_WAITOK); NFSLOCKSTATE(); /* * Get the open structure via clientid and stateid. @@ -3322,7 +3346,7 @@ nfsrv_openupdate(vnode_t vp, struct nfss if (!(clp->lc_flags & LCL_STAMPEDSTABLE)) { clp->lc_flags |= LCL_STAMPEDSTABLE; len = clp->lc_idlen; - NFSBCOPY(clp->lc_id, client, len); + NFSBCOPY(clp->lc_id, clidp, len); gotstate = 1; } NFSUNLOCKSTATE(); @@ -3369,11 +3393,12 @@ nfsrv_openupdate(vnode_t vp, struct nfss * to the stable storage file. */ if (gotstate != 0) { - nfsrv_writestable(client, len, NFSNST_NEWSTATE, p); + nfsrv_writestable(clidp, len, NFSNST_NEWSTATE, p); nfsrv_backupstable(); } out: + free(clidp, M_TEMP); NFSEXITCODE2(error, nd); return (error); } From owner-svn-src-all@freebsd.org Mon Dec 19 22:18:37 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A73E3C88441; Mon, 19 Dec 2016 22:18:37 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 5D2341771; Mon, 19 Dec 2016 22:18:37 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBJMIacY001228; Mon, 19 Dec 2016 22:18:36 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBJMIa1p001227; Mon, 19 Dec 2016 22:18:36 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201612192218.uBJMIa1p001227@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Mon, 19 Dec 2016 22:18:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310302 - head/sys/kern X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Dec 2016 22:18:37 -0000 Author: kib Date: Mon Dec 19 22:18:36 2016 New Revision: 310302 URL: https://svnweb.freebsd.org/changeset/base/310302 Log: Do not clear KN_INFLUX when not owning influx state. For notes in KN_INFLUX|KN_SCAN state, the influx bit is set by a parallel scan. When knote() reports event for the vnode filters, which require kqueue unlocked, it unconditionally sets and then clears influx to keep note around kqueue unlock. There, do not clear influx flag if a scan set it, since we do not own it, instead we prevent scan from executing by holding knlist lock. The knote_fork() function has somewhat similar problem, it might set KN_INFLUX for scanned note, drop kqueue and list locks, and then clear the flag after relock. A solution there would be different enough, as well as the test program, so close the reported issue first. Reported and test case provided by: yjh0502@gmail.com PR: 214923 Tested by: pho Sponsored by: The FreeBSD Foundation MFC after: 1 week Modified: head/sys/kern/kern_event.c Modified: head/sys/kern/kern_event.c ============================================================================== --- head/sys/kern/kern_event.c Mon Dec 19 22:15:29 2016 (r310301) +++ head/sys/kern/kern_event.c Mon Dec 19 22:18:36 2016 (r310302) @@ -2006,6 +2006,7 @@ knote(struct knlist *list, long hint, in struct kqueue *kq; struct knote *kn, *tkn; int error; + bool own_influx; if (list == NULL) return; @@ -2036,11 +2037,14 @@ knote(struct knlist *list, long hint, in */ KQ_UNLOCK(kq); } else if ((lockflags & KNF_NOKQLOCK) != 0) { - kn->kn_status |= KN_INFLUX; + own_influx = (kn->kn_status & KN_INFLUX) == 0; + if (own_influx) + kn->kn_status |= KN_INFLUX; KQ_UNLOCK(kq); error = kn->kn_fop->f_event(kn, hint); KQ_LOCK(kq); - kn->kn_status &= ~KN_INFLUX; + if (own_influx) + kn->kn_status &= ~KN_INFLUX; if (error) KNOTE_ACTIVATE(kn, 1); KQ_UNLOCK_FLUX(kq); From owner-svn-src-all@freebsd.org Mon Dec 19 22:23:11 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D5E2EC88700; Mon, 19 Dec 2016 22:23:11 +0000 (UTC) (envelope-from adrian.chadd@gmail.com) Received: from mail-wj0-x241.google.com (mail-wj0-x241.google.com [IPv6:2a00:1450:400c:c01::241]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 7E3FA1D74; Mon, 19 Dec 2016 22:23:11 +0000 (UTC) (envelope-from adrian.chadd@gmail.com) Received: by mail-wj0-x241.google.com with SMTP id xy5so25386084wjc.1; Mon, 19 Dec 2016 14:23:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=aR7oBwbyESPZtWFsR0tE7gQpYXZ2YRLi0yd7bAV6R9c=; b=j9HsmKNyZKzW0CskXSZjsKAi9njWwKCJfjYSvzz6g5b2o99HDTgoBiR6/ODGyUBH3D 9nGRzvPkkNOg9itdRAd3WnaQKW9QXCwvwAeYQi6+TC0Cycy/6d0xyc6dCuKKIolgiX82 DPPwTMvIlUYe16kq5n+y9HArSfxO7byKul3C0/Vt7KdUupUeKzFethEJ9Pgivl3YWrKZ zhMaVwIRXmr44eeM3ML12uu5tAilyOO0+FZEIB7tabn/BL2TSgQOWhmkSrNWsCXBr2j5 f2RWb+5KjhmwZeyGwAKEofPRYotyzECwHwPsKSV6zbl+8xt/flwLrNc7qxfEsZnwd7zA Szzw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=aR7oBwbyESPZtWFsR0tE7gQpYXZ2YRLi0yd7bAV6R9c=; b=PSPe8EW/255o8XOu8bx4+n+hELkmF7JP4qU2vb7LdFPalNFqEfjk9MO9D5t21lxmOj jV6QH/h9hHHbXJjxQxxHtJubF6Vsc/ZLHPRtjYC55DlTC242JR86BWAQUua2oTdKQkSl JQo05c/PFzmNQmrUMDYFNiFraNikGX2bqOOB51WXTxSwCGiqehd8vSOCpB4m5J87egFK KnPPqoskqUD1KTNLfoF5eNj+NbVDyc4c3mii9xBk97Ue5Num+QbzdRR7lvqkvYEChmAX bKxU6ek44pldHotWAnB16viSzQZmRn7BSPIeSbRCaWR1wpi9pxZp7JdpzIyIDoGaQXih EzSw== X-Gm-Message-State: AIkVDXKi1TOFhPytSzEDgUE/797Yy1YE5KSEd3SAbiHHfcwFRlWpipd72WXTJGxizHcVoCCcRVtQczsQKeeOCw== X-Received: by 10.194.201.133 with SMTP id ka5mr17218670wjc.151.1482186189756; Mon, 19 Dec 2016 14:23:09 -0800 (PST) MIME-Version: 1.0 Received: by 10.194.44.1 with HTTP; Mon, 19 Dec 2016 14:23:08 -0800 (PST) In-Reply-To: <49460793.UcUNovQMDa@ralph.baldwin.cx> References: <201612160144.uBG1ipjW016736@repo.freebsd.org> <49460793.UcUNovQMDa@ralph.baldwin.cx> From: Adrian Chadd Date: Mon, 19 Dec 2016 14:23:08 -0800 Message-ID: Subject: Re: svn commit: r310138 - head/lib/libc/stdio To: John Baldwin Cc: Eric van Gyzen , Warner Losh , Dimitry Andric , Baptiste Daroussin , "Conrad E. Meyer" , src-committers , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" Content-Type: text/plain; charset=UTF-8 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Dec 2016 22:23:11 -0000 [snip] tl;dr - can we revert it from stdio for now so we don't end up having people use this? -adrian From owner-svn-src-all@freebsd.org Mon Dec 19 22:28:29 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 63E90C887F6; Mon, 19 Dec 2016 22:28:29 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 3E7561F29; Mon, 19 Dec 2016 22:28:29 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBJMSSZm005661; Mon, 19 Dec 2016 22:28:28 GMT (envelope-from rmacklem@FreeBSD.org) Received: (from rmacklem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBJMSSWR005660; Mon, 19 Dec 2016 22:28:28 GMT (envelope-from rmacklem@FreeBSD.org) Message-Id: <201612192228.uBJMSSWR005660@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rmacklem set sender to rmacklem@FreeBSD.org using -f From: Rick Macklem Date: Mon, 19 Dec 2016 22:28:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r310303 - stable/10/sys/fs/nfsserver X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Dec 2016 22:28:29 -0000 Author: rmacklem Date: Mon Dec 19 22:28:28 2016 New Revision: 310303 URL: https://svnweb.freebsd.org/changeset/base/310303 Log: MFC: r309566 Fix the NFSv4.1 server for Open reclaim after a reboot. The NFSv4.1 server failed to update the nfs-stablerestart file for a client when the client was issued its first Open. As such, recovery of Opens after a server reboot failed with NFSERR_NOGRACE. This patch fixes this. It also changes the code so that it malloc()'s the 1024 byte array instead of allocating it on the kernel stack for both NFSv4.0 and NFSv4.1. Note that this bug only affected NFSv4.1 and only when clients attempted to reclaim Opens after a server reboot. Modified: stable/10/sys/fs/nfsserver/nfs_nfsdstate.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/fs/nfsserver/nfs_nfsdstate.c ============================================================================== --- stable/10/sys/fs/nfsserver/nfs_nfsdstate.c Mon Dec 19 22:18:36 2016 (r310302) +++ stable/10/sys/fs/nfsserver/nfs_nfsdstate.c Mon Dec 19 22:28:28 2016 (r310303) @@ -2498,6 +2498,8 @@ nfsrv_openctrl(struct nfsrv_descript *nd struct nfsclient *clp; int error = 0, haslock = 0, ret, delegate = 1, writedeleg = 1; int readonly = 0, cbret = 1, getfhret = 0; + int gotstate = 0, len = 0; + u_char *clidp = NULL; if ((new_stp->ls_flags & NFSLCK_SHAREBITS) == NFSLCK_READACCESS) readonly = 1; @@ -2516,6 +2518,7 @@ nfsrv_openctrl(struct nfsrv_descript *nd goto out; } + clidp = malloc(NFSV4_OPAQUELIMIT, M_TEMP, M_WAITOK); tryagain: MALLOC(new_lfp, struct nfslockfile *, sizeof (struct nfslockfile), M_NFSDLOCKFILE, M_WAITOK); @@ -3178,6 +3181,16 @@ tryagain: nfsrv_openpluslock++; nfsrv_delegatecnt++; } + /* + * Since NFSv4.1 never does an OpenConfirm, the first + * open state will be acquired here. + */ + if (!(clp->lc_flags & LCL_STAMPEDSTABLE)) { + clp->lc_flags |= LCL_STAMPEDSTABLE; + len = clp->lc_idlen; + NFSBCOPY(clp->lc_id, clidp, len); + gotstate = 1; + } } else { *rflagsp |= NFSV4OPEN_RESULTCONFIRM; new_stp->ls_flags = NFSLCK_NEEDSCONFIRM; @@ -3214,7 +3227,17 @@ tryagain: if (new_deleg) FREE((caddr_t)new_deleg, M_NFSDSTATE); + /* + * If the NFSv4.1 client just acquired its first open, write a timestamp + * to the stable storage file. + */ + if (gotstate != 0) { + nfsrv_writestable(clidp, len, NFSNST_NEWSTATE, p); + nfsrv_backupstable(); + } + out: + free(clidp, M_TEMP); NFSEXITCODE2(error, nd); return (error); } @@ -3231,7 +3254,7 @@ nfsrv_openupdate(vnode_t vp, struct nfss struct nfslockfile *lfp; u_int32_t bits; int error = 0, gotstate = 0, len = 0; - u_char client[NFSV4_OPAQUELIMIT]; + u_char *clidp = NULL; /* * Check for restart conditions (client and server). @@ -3241,6 +3264,7 @@ nfsrv_openupdate(vnode_t vp, struct nfss if (error) goto out; + clidp = malloc(NFSV4_OPAQUELIMIT, M_TEMP, M_WAITOK); NFSLOCKSTATE(); /* * Get the open structure via clientid and stateid. @@ -3319,7 +3343,7 @@ nfsrv_openupdate(vnode_t vp, struct nfss if (!(clp->lc_flags & LCL_STAMPEDSTABLE)) { clp->lc_flags |= LCL_STAMPEDSTABLE; len = clp->lc_idlen; - NFSBCOPY(clp->lc_id, client, len); + NFSBCOPY(clp->lc_id, clidp, len); gotstate = 1; } NFSUNLOCKSTATE(); @@ -3366,11 +3390,12 @@ nfsrv_openupdate(vnode_t vp, struct nfss * to the stable storage file. */ if (gotstate != 0) { - nfsrv_writestable(client, len, NFSNST_NEWSTATE, p); + nfsrv_writestable(clidp, len, NFSNST_NEWSTATE, p); nfsrv_backupstable(); } out: + free(clidp, M_TEMP); NFSEXITCODE2(error, nd); return (error); } From owner-svn-src-all@freebsd.org Mon Dec 19 23:38:10 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 50DB9C88AEA; Mon, 19 Dec 2016 23:38:10 +0000 (UTC) (envelope-from sjg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C68B51E9F; Mon, 19 Dec 2016 23:38:09 +0000 (UTC) (envelope-from sjg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBJNc9dE034933; Mon, 19 Dec 2016 23:38:09 GMT (envelope-from sjg@FreeBSD.org) Received: (from sjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBJNc7Rs034916; Mon, 19 Dec 2016 23:38:07 GMT (envelope-from sjg@FreeBSD.org) Message-Id: <201612192338.uBJNc7Rs034916@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sjg set sender to sjg@FreeBSD.org using -f From: "Simon J. Gerraty" Date: Mon, 19 Dec 2016 23:38:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310304 - in head: contrib/bmake contrib/bmake/mk usr.bin/bmake X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Dec 2016 23:38:10 -0000 Author: sjg Date: Mon Dec 19 23:38:07 2016 New Revision: 310304 URL: https://svnweb.freebsd.org/changeset/base/310304 Log: Merge bmake-20161212 Added: head/contrib/bmake/mk/sys.debug.mk - copied unchanged from r310300, vendor/NetBSD/bmake/dist/mk/sys.debug.mk head/contrib/bmake/mk/sys.vars.mk - copied unchanged from r310300, vendor/NetBSD/bmake/dist/mk/sys.vars.mk Modified: head/contrib/bmake/ChangeLog head/contrib/bmake/Makefile head/contrib/bmake/bmake.1 head/contrib/bmake/bmake.cat1 head/contrib/bmake/compat.c head/contrib/bmake/job.c head/contrib/bmake/main.c head/contrib/bmake/make.1 head/contrib/bmake/make.c head/contrib/bmake/make.h head/contrib/bmake/mk/ChangeLog head/contrib/bmake/mk/FILES head/contrib/bmake/mk/dirdeps.mk head/contrib/bmake/mk/gendirdeps.mk head/contrib/bmake/mk/install-mk head/contrib/bmake/mk/lib.mk head/contrib/bmake/mk/meta.stage.mk head/contrib/bmake/mk/meta.sys.mk head/contrib/bmake/mk/meta2deps.py head/contrib/bmake/mk/meta2deps.sh head/contrib/bmake/mk/sys.mk head/contrib/bmake/nonints.h head/contrib/bmake/parse.c head/usr.bin/bmake/Makefile Directory Properties: head/contrib/bmake/ (props changed) Modified: head/contrib/bmake/ChangeLog ============================================================================== --- head/contrib/bmake/ChangeLog Mon Dec 19 22:28:28 2016 (r310303) +++ head/contrib/bmake/ChangeLog Mon Dec 19 23:38:07 2016 (r310304) @@ -1,3 +1,32 @@ +2016-12-12 Simon J. Gerraty + + * Makefile (_MAKE_VERSION): 20161212 + Merge with NetBSD make, pick up + o main.c: look for obj.${MACHINE}-${MACHINE_ARCH} too. + +2016-12-09 Simon J. Gerraty + + * Makefile (_MAKE_VERSION): 20161209 + Merge with NetBSD make, pick up + o main.c: cleanup setting of .OBJDIR + o parse.c: avoid coredump from (var)=val + +2016-11-26 Simon J. Gerraty + + * Makefile (_MAKE_VERSION): 20161126 + Merge with NetBSD make, pick up + o make.c: Make_OODate: report src node name if path not set + +2016-09-26 Simon J. Gerraty + + * Makefile (_MAKE_VERSION): 20160926 + Merge with NetBSD make, pick up + o support for .DELETE_ON_ERROR: (remove targets that fail) + +2016-09-26 Simon J. Gerraty + + * Makefile MAN: tweak .Dt to match ${PROG} + 2016-08-18 Simon J. Gerraty * Makefile (_MAKE_VERSION): 20160818 Modified: head/contrib/bmake/Makefile ============================================================================== --- head/contrib/bmake/Makefile Mon Dec 19 22:28:28 2016 (r310303) +++ head/contrib/bmake/Makefile Mon Dec 19 23:38:07 2016 (r310304) @@ -1,7 +1,7 @@ -# $Id: Makefile,v 1.72 2016/08/18 23:02:26 sjg Exp $ +# $Id: Makefile,v 1.77 2016/12/12 07:34:19 sjg Exp $ # Base version on src date -_MAKE_VERSION= 20160818 +_MAKE_VERSION= 20161212 PROG= bmake @@ -156,7 +156,10 @@ my.history: ${MAKEFILE} .NOPATH: ${MAN} ${MAN}: make.1 my.history @echo making $@ - @sed -e 's/^.Nx/NetBSD/' -e '/^.Nm/s/make/${PROG}/' \ + @sed \ + -e '/^.Dt/s/MAKE/${PROG:tu}/' \ + -e 's/^.Nx/NetBSD/' \ + -e '/^.Nm/s/make/${PROG}/' \ -e '/^.Sh HISTORY/rmy.history' \ -e '/^.Sh HISTORY/,$$s,^.Nm,make,' ${srcdir}/make.1 > $@ Modified: head/contrib/bmake/bmake.1 ============================================================================== --- head/contrib/bmake/bmake.1 Mon Dec 19 22:28:28 2016 (r310303) +++ head/contrib/bmake/bmake.1 Mon Dec 19 23:38:07 2016 (r310304) @@ -1,4 +1,4 @@ -.\" $NetBSD: make.1,v 1.262 2016/08/18 19:23:20 wiz Exp $ +.\" $NetBSD: make.1,v 1.263 2016/08/26 23:37:54 dholland Exp $ .\" .\" Copyright (c) 1990, 1993 .\" The Regents of the University of California. All rights reserved. @@ -29,8 +29,8 @@ .\" .\" from: @(#)make.1 8.4 (Berkeley) 3/19/94 .\" -.Dd August 15, 2016 -.Dt MAKE 1 +.Dd August 26, 2016 +.Dt BMAKE 1 .Os .Sh NAME .Nm bmake @@ -2011,6 +2011,14 @@ variable of a target that inherits .Ic .DEFAULT Ns 's commands is set to the target's own name. +.It Ic .DELETE_ON_ERROR +If this target is present in the makefile, it globally causes make to +delete targets whose commands fail. +(By default, only targets whose commands are interrupted during +execution are deleted. +This is the historical behavior.) +This setting can be used to help prevent half-finished or malformed +targets from being left around and corrupting future rebuilds. .It Ic .END Any command lines attached to this target are executed after everything else is done. Modified: head/contrib/bmake/bmake.cat1 ============================================================================== --- head/contrib/bmake/bmake.cat1 Mon Dec 19 22:28:28 2016 (r310303) +++ head/contrib/bmake/bmake.cat1 Mon Dec 19 23:38:07 2016 (r310304) @@ -1,4 +1,4 @@ -MAKE(1) NetBSD General Commands Manual MAKE(1) +BMAKE(1) NetBSD General Commands Manual BMAKE(1) NNAAMMEE bbmmaakkee -- maintain program dependencies @@ -1285,6 +1285,14 @@ SSPPEECCIIAALL TTAARRGGEETT target that inherits ..DDEEFFAAUULLTT's commands is set to the target's own name. + ..DDEELLEETTEE__OONN__EERRRROORR + If this target is present in the makefile, it globally causes + make to delete targets whose commands fail. (By default, only + targets whose commands are interrupted during execution are + deleted. This is the historical behavior.) This setting can be + used to help prevent half-finished or malformed targets from + being left around and corrupting future rebuilds. + ..EENNDD Any command lines attached to this target are executed after everything else is done. @@ -1498,4 +1506,4 @@ BBUUGGSS There is no way of escaping a space character in a filename. -NetBSD 5.1 August 15, 2016 NetBSD 5.1 +NetBSD 5.1 August 26, 2016 NetBSD 5.1 Modified: head/contrib/bmake/compat.c ============================================================================== --- head/contrib/bmake/compat.c Mon Dec 19 22:28:28 2016 (r310303) +++ head/contrib/bmake/compat.c Mon Dec 19 23:38:07 2016 (r310304) @@ -1,4 +1,4 @@ -/* $NetBSD: compat.c,v 1.105 2016/05/12 20:28:34 sjg Exp $ */ +/* $NetBSD: compat.c,v 1.106 2016/08/26 23:28:39 dholland Exp $ */ /* * Copyright (c) 1988, 1989, 1990 The Regents of the University of California. @@ -70,14 +70,14 @@ */ #ifndef MAKE_NATIVE -static char rcsid[] = "$NetBSD: compat.c,v 1.105 2016/05/12 20:28:34 sjg Exp $"; +static char rcsid[] = "$NetBSD: compat.c,v 1.106 2016/08/26 23:28:39 dholland Exp $"; #else #include #ifndef lint #if 0 static char sccsid[] = "@(#)compat.c 8.2 (Berkeley) 3/19/94"; #else -__RCSID("$NetBSD: compat.c,v 1.105 2016/05/12 20:28:34 sjg Exp $"); +__RCSID("$NetBSD: compat.c,v 1.106 2016/08/26 23:28:39 dholland Exp $"); #endif #endif /* not lint */ #endif @@ -119,6 +119,25 @@ static GNode *curTarg = NULL; static GNode *ENDNode; static void CompatInterrupt(int); +/* + * CompatDeleteTarget -- delete a failed, interrupted, or otherwise + * duffed target if not inhibited by .PRECIOUS. + */ +static void +CompatDeleteTarget(GNode *gn) +{ + if ((gn != NULL) && !Targ_Precious (gn)) { + char *p1; + char *file = Var_Value(TARGET, gn, &p1); + + if (!noExecute && eunlink(file) != -1) { + Error("*** %s removed", file); + } + + free(p1); + } +} + /*- *----------------------------------------------------------------------- * CompatInterrupt -- @@ -132,6 +151,9 @@ static void CompatInterrupt(int); * The target is removed and the process exits. If .INTERRUPT exists, * its commands are run first WITH INTERRUPTS IGNORED.. * + * XXX: is .PRECIOUS supposed to inhibit .INTERRUPT? I doubt it, but I've + * left the logic alone for now. - dholland 20160826 + * *----------------------------------------------------------------------- */ static void @@ -139,16 +161,9 @@ CompatInterrupt(int signo) { GNode *gn; - if ((curTarg != NULL) && !Targ_Precious (curTarg)) { - char *p1; - char *file = Var_Value(TARGET, curTarg, &p1); - - if (!noExecute && eunlink(file) != -1) { - Error("*** %s removed", file); - } - - free(p1); + CompatDeleteTarget(curTarg); + if ((curTarg != NULL) && !Targ_Precious (curTarg)) { /* * Run .INTERRUPT only if hit with interrupt signal */ @@ -158,7 +173,6 @@ CompatInterrupt(int signo) Compat_Make(gn, gn); } } - } if (signo == SIGQUIT) _exit(signo); @@ -447,6 +461,11 @@ again: * continue. */ printf(" (continuing)\n"); + } else { + printf("\n"); + } + if (deleteOnError) { + CompatDeleteTarget(gn); } } else { /* @@ -607,7 +626,7 @@ Compat_Make(void *gnp, void *pgnp) } else if (keepgoing) { pgn->flags &= ~REMAKE; } else { - PrintOnError(gn, "\n\nStop."); + PrintOnError(gn, "\nStop."); exit(1); } } else if (gn->made == ERROR) { @@ -698,7 +717,7 @@ Compat_Run(Lst targs) if (gn != NULL) { Compat_Make(gn, gn); if (gn->made == ERROR) { - PrintOnError(gn, "\n\nStop."); + PrintOnError(gn, "\nStop."); exit(1); } } @@ -739,7 +758,7 @@ Compat_Run(Lst targs) if (errors == 0) { Compat_Make(ENDNode, ENDNode); if (gn->made == ERROR) { - PrintOnError(gn, "\n\nStop."); + PrintOnError(gn, "\nStop."); exit(1); } } Modified: head/contrib/bmake/job.c ============================================================================== --- head/contrib/bmake/job.c Mon Dec 19 22:28:28 2016 (r310303) +++ head/contrib/bmake/job.c Mon Dec 19 23:38:07 2016 (r310304) @@ -1,4 +1,4 @@ -/* $NetBSD: job.c,v 1.187 2016/05/12 20:28:34 sjg Exp $ */ +/* $NetBSD: job.c,v 1.188 2016/08/26 23:28:39 dholland Exp $ */ /* * Copyright (c) 1988, 1989, 1990 The Regents of the University of California. @@ -70,14 +70,14 @@ */ #ifndef MAKE_NATIVE -static char rcsid[] = "$NetBSD: job.c,v 1.187 2016/05/12 20:28:34 sjg Exp $"; +static char rcsid[] = "$NetBSD: job.c,v 1.188 2016/08/26 23:28:39 dholland Exp $"; #else #include #ifndef lint #if 0 static char sccsid[] = "@(#)job.c 8.2 (Berkeley) 3/19/94"; #else -__RCSID("$NetBSD: job.c,v 1.187 2016/05/12 20:28:34 sjg Exp $"); +__RCSID("$NetBSD: job.c,v 1.188 2016/08/26 23:28:39 dholland Exp $"); #endif #endif /* not lint */ #endif @@ -404,6 +404,21 @@ job_table_dump(const char *where) } /* + * Delete the target of a failed, interrupted, or otherwise + * unsuccessful job unless inhibited by .PRECIOUS. + */ +static void +JobDeleteTarget(GNode *gn) +{ + if ((gn->type & (OP_JOIN|OP_PHONY)) == 0 && !Targ_Precious(gn)) { + char *file = (gn->path == NULL ? gn->name : gn->path); + if (!noExecute && eunlink(file) != -1) { + Error("*** %s removed", file); + } + } +} + +/* * JobSigLock/JobSigUnlock * * Signal lock routines to get exclusive access. Currently used to @@ -1049,6 +1064,9 @@ JobFinish (Job *job, WAIT_T status) if (job->flags & JOB_IGNERR) { WAIT_STATUS(status) = 0; } else { + if (deleteOnError) { + JobDeleteTarget(job->node); + } PrintOnError(job->node, NULL); } } else if (DEBUG(JOB)) { @@ -1066,6 +1084,9 @@ JobFinish (Job *job, WAIT_T status) } (void)printf("*** [%s] Signal %d\n", job->node->name, WTERMSIG(status)); + if (deleteOnError) { + JobDeleteTarget(job->node); + } } (void)fflush(stdout); } @@ -2601,12 +2622,7 @@ JobInterrupt(int runINTERRUPT, int signo gn = job->node; - if ((gn->type & (OP_JOIN|OP_PHONY)) == 0 && !Targ_Precious(gn)) { - char *file = (gn->path == NULL ? gn->name : gn->path); - if (!noExecute && eunlink(file) != -1) { - Error("*** %s removed", file); - } - } + JobDeleteTarget(gn); if (job->pid) { if (DEBUG(JOB)) { (void)fprintf(debug_file, Modified: head/contrib/bmake/main.c ============================================================================== --- head/contrib/bmake/main.c Mon Dec 19 22:28:28 2016 (r310303) +++ head/contrib/bmake/main.c Mon Dec 19 23:38:07 2016 (r310304) @@ -1,4 +1,4 @@ -/* $NetBSD: main.c,v 1.250 2016/08/11 19:53:17 sjg Exp $ */ +/* $NetBSD: main.c,v 1.254 2016/12/10 23:12:39 christos Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -69,7 +69,7 @@ */ #ifndef MAKE_NATIVE -static char rcsid[] = "$NetBSD: main.c,v 1.250 2016/08/11 19:53:17 sjg Exp $"; +static char rcsid[] = "$NetBSD: main.c,v 1.254 2016/12/10 23:12:39 christos Exp $"; #else #include #ifndef lint @@ -81,7 +81,7 @@ __COPYRIGHT("@(#) Copyright (c) 1988, 19 #if 0 static char sccsid[] = "@(#)main.c 8.3 (Berkeley) 3/19/94"; #else -__RCSID("$NetBSD: main.c,v 1.250 2016/08/11 19:53:17 sjg Exp $"); +__RCSID("$NetBSD: main.c,v 1.254 2016/12/10 23:12:39 christos Exp $"); #endif #endif /* not lint */ #endif @@ -155,6 +155,7 @@ Lst create; /* Targets to be made */ time_t now; /* Time at start of make */ GNode *DEFAULT; /* .DEFAULT node */ Boolean allPrecious; /* .PRECIOUS given on line by itself */ +Boolean deleteOnError; /* .DELETE_ON_ERROR: set */ static Boolean noBuiltins; /* -r flag */ static Lst makefiles; /* ordered list of makefiles to read */ @@ -711,18 +712,24 @@ Main_ParseArgLine(const char *line) } Boolean -Main_SetObjdir(const char *path) +Main_SetObjdir(const char *fmt, ...) { struct stat sb; - char *p = NULL; - char buf[MAXPATHLEN + 1]; + char *p, *path; + char buf[MAXPATHLEN + 1], pbuf[MAXPATHLEN + 1]; Boolean rc = FALSE; + va_list ap; + + va_start(ap, fmt); + vsnprintf(path = pbuf, MAXPATHLEN, fmt, ap); + va_end(ap); /* expand variable substitutions */ if (strchr(path, '$') != 0) { snprintf(buf, MAXPATHLEN, "%s", path); path = p = Var_Subst(NULL, buf, VAR_GLOBAL, VARF_WANTRES); - } + } else + p = NULL; if (path[0] != '/') { snprintf(buf, MAXPATHLEN, "%s/%s", curdir, path); @@ -749,6 +756,18 @@ Main_SetObjdir(const char *path) return rc; } +static Boolean +Main_SetVarObjdir(const char *var, const char *suffix) +{ + char *p1, *path; + if ((path = Var_Value(var, VAR_CMD, &p1)) == NULL) + return FALSE; + + (void)Main_SetObjdir("%s%s", path, suffix); + free(p1); + return TRUE; +} + /*- * ReadAllMakefiles -- * wrapper around ReadMakefile() to read all. @@ -979,6 +998,7 @@ main(int argc, char **argv) noRecursiveExecute = FALSE; /* Execute all .MAKE targets */ keepgoing = FALSE; /* Stop on error */ allPrecious = FALSE; /* Remove targets when interrupted */ + deleteOnError = FALSE; /* Historical default behavior */ queryFlag = FALSE; /* This is not just a check-run */ noBuiltins = FALSE; /* Read the built-in rules */ touchFlag = FALSE; /* Actually update targets */ @@ -1128,28 +1148,19 @@ main(int argc, char **argv) * MAKEOBJDIR is set in the environment, try only that value * and fall back to .CURDIR if it does not exist. * - * Otherwise, try _PATH_OBJDIR.MACHINE, _PATH_OBJDIR, and - * finally _PATH_OBJDIRPREFIX`pwd`, in that order. If none + * Otherwise, try _PATH_OBJDIR.MACHINE-MACHINE_ARCH, _PATH_OBJDIR.MACHINE, + * and * finally _PATH_OBJDIRPREFIX`pwd`, in that order. If none * of these paths exist, just use .CURDIR. */ Dir_Init(curdir); - (void)Main_SetObjdir(curdir); + (void)Main_SetObjdir("%s", curdir); - if ((path = Var_Value("MAKEOBJDIRPREFIX", VAR_CMD, &p1)) != NULL) { - (void)snprintf(mdpath, MAXPATHLEN, "%s%s", path, curdir); - (void)Main_SetObjdir(mdpath); - free(p1); - } else if ((path = Var_Value("MAKEOBJDIR", VAR_CMD, &p1)) != NULL) { - (void)Main_SetObjdir(path); - free(p1); - } else { - (void)snprintf(mdpath, MAXPATHLEN, "%s.%s", _PATH_OBJDIR, machine); - if (!Main_SetObjdir(mdpath) && !Main_SetObjdir(_PATH_OBJDIR)) { - (void)snprintf(mdpath, MAXPATHLEN, "%s%s", - _PATH_OBJDIRPREFIX, curdir); - (void)Main_SetObjdir(mdpath); - } - } + if (!Main_SetVarObjdir("MAKEOBJDIRPREFIX", curdir) && + !Main_SetVarObjdir("MAKEOBJDIR", "") && + !Main_SetObjdir("%s.%s-%s", _PATH_OBJDIR, machine, machine_arch) && + !Main_SetObjdir("%s.%s", _PATH_OBJDIR, machine) && + !Main_SetObjdir("%s", _PATH_OBJDIR)) + (void)Main_SetObjdir("%s%s", _PATH_OBJDIRPREFIX, curdir); /* * Initialize archive, target and suffix modules in preparation for Modified: head/contrib/bmake/make.1 ============================================================================== --- head/contrib/bmake/make.1 Mon Dec 19 22:28:28 2016 (r310303) +++ head/contrib/bmake/make.1 Mon Dec 19 23:38:07 2016 (r310304) @@ -1,4 +1,4 @@ -.\" $NetBSD: make.1,v 1.262 2016/08/18 19:23:20 wiz Exp $ +.\" $NetBSD: make.1,v 1.263 2016/08/26 23:37:54 dholland Exp $ .\" .\" Copyright (c) 1990, 1993 .\" The Regents of the University of California. All rights reserved. @@ -29,7 +29,7 @@ .\" .\" from: @(#)make.1 8.4 (Berkeley) 3/19/94 .\" -.Dd August 15, 2016 +.Dd August 26, 2016 .Dt MAKE 1 .Os .Sh NAME @@ -2022,6 +2022,14 @@ variable of a target that inherits .Ic .DEFAULT Ns 's commands is set to the target's own name. +.It Ic .DELETE_ON_ERROR +If this target is present in the makefile, it globally causes make to +delete targets whose commands fail. +(By default, only targets whose commands are interrupted during +execution are deleted. +This is the historical behavior.) +This setting can be used to help prevent half-finished or malformed +targets from being left around and corrupting future rebuilds. .It Ic .END Any command lines attached to this target are executed after everything else is done. Modified: head/contrib/bmake/make.c ============================================================================== --- head/contrib/bmake/make.c Mon Dec 19 22:28:28 2016 (r310303) +++ head/contrib/bmake/make.c Mon Dec 19 23:38:07 2016 (r310304) @@ -1,4 +1,4 @@ -/* $NetBSD: make.c,v 1.95 2016/02/18 18:29:14 christos Exp $ */ +/* $NetBSD: make.c,v 1.96 2016/11/10 23:41:58 sjg Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -69,14 +69,14 @@ */ #ifndef MAKE_NATIVE -static char rcsid[] = "$NetBSD: make.c,v 1.95 2016/02/18 18:29:14 christos Exp $"; +static char rcsid[] = "$NetBSD: make.c,v 1.96 2016/11/10 23:41:58 sjg Exp $"; #else #include #ifndef lint #if 0 static char sccsid[] = "@(#)make.c 8.1 (Berkeley) 6/6/93"; #else -__RCSID("$NetBSD: make.c,v 1.95 2016/02/18 18:29:14 christos Exp $"); +__RCSID("$NetBSD: make.c,v 1.96 2016/11/10 23:41:58 sjg Exp $"); #endif #endif /* not lint */ #endif @@ -308,7 +308,7 @@ Make_OODate(GNode *gn) if (DEBUG(MAKE)) { if (gn->cmgn != NULL && gn->mtime < gn->cmgn->mtime) { fprintf(debug_file, "modified before source %s...", - gn->cmgn->path); + gn->cmgn->path ? gn->cmgn->path : gn->cmgn->name); } else if (gn->mtime == 0) { fprintf(debug_file, "non-existent and no sources..."); } else { Modified: head/contrib/bmake/make.h ============================================================================== --- head/contrib/bmake/make.h Mon Dec 19 22:28:28 2016 (r310303) +++ head/contrib/bmake/make.h Mon Dec 19 23:38:07 2016 (r310304) @@ -1,4 +1,4 @@ -/* $NetBSD: make.h,v 1.100 2016/06/07 00:40:00 sjg Exp $ */ +/* $NetBSD: make.h,v 1.102 2016/12/07 15:00:46 christos Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -389,6 +389,7 @@ extern Boolean beSilent; /* True if extern Boolean noExecute; /* True if should execute nothing */ extern Boolean noRecursiveExecute; /* True if should execute nothing */ extern Boolean allPrecious; /* True if every target is precious */ +extern Boolean deleteOnError; /* True if failed targets should be deleted */ extern Boolean keepgoing; /* True if should continue on unaffected * portions of the graph when have an error * in one portion */ @@ -503,7 +504,7 @@ char * Check_Cwd_Cmd(const char *); void Check_Cwd(const char **); void PrintOnError(GNode *, const char *); void Main_ExportMAKEFLAGS(Boolean); -Boolean Main_SetObjdir(const char *); +Boolean Main_SetObjdir(const char *, ...) MAKE_ATTR_PRINTFLIKE(1, 2); int mkTempFile(const char *, char **); int str2Lst_Append(Lst, char *, const char *); int cached_lstat(const char *, void *); Modified: head/contrib/bmake/mk/ChangeLog ============================================================================== --- head/contrib/bmake/mk/ChangeLog Mon Dec 19 22:28:28 2016 (r310303) +++ head/contrib/bmake/mk/ChangeLog Mon Dec 19 23:38:07 2016 (r310304) @@ -1,3 +1,62 @@ +2016-12-12 Simon J. Gerraty + + * install-mk (MK_VERSION): 20161212 + + * meta2deps.py: set pid_cwd[pid] when we process 'C'hdir, + rather than when we detect pid change. + +2016-12-07 Simon J. Gerraty + + * install-mk (MK_VERSION): 20161207 + + * meta.stage.mk: add stage_as_and_symlink for staging packages. + We build foo.tgz stage_as foo-${VERSION}.tgz but want to be able + to use foo.tgz to reference the latest staged version - so we + make foo.tgz a symlink to it. + Using a target to do both operations ensures we stay in sync. + +2016-11-26 Simon J. Gerraty + + * install-mk (MK_VERSION): 20161126 + + * dirdeps.mk: set DIRDEPS_CACHE before we include local.dirdeps.mk + so it can add dependencies. + +2016-10-10 Simon J. Gerraty + + * dirdeps.mk: set DEP_* before we expand .MAKE.DEPENDFILE_PREFERENCE + do that they can influence the result correctly. + + * dirdeps.mk (${DIRDEPS_CACHE}): make sure we pass on TARGET_SPEC + + * dirdeps.mk: Add ONLY_TARGET_SPEC_LIST and NOT_TARGET_SPEC_LIST + similar to ONLY_MACHINE_LIST and NOT_MACHINE_LIST + +2016-10-05 Simon J. Gerraty + + * dirdeps.mk: remove dependence on jot (normal situations anyway). + Before we read another Makefile.depend* set DEP_* vars from + _DEP_TARGET_SPEC in case it uses any of them with := + When bootstrapping, trim any ,* from extention of chosen _src + Makefile.depend* to get the machine value we subst for. + +2016-09-30 Simon J. Gerraty + + * dirdeps.mk: use TARGET_SPEC_VARS to qualify components added to + DEP_SKIP_DIR and DEP_DIRDEPS_FILTER + + * sys.mk: extract some bits to sys.{debug,vars}.mk + for easier re-use by others. + +2016-09-23 Simon Gerraty + + * lib.mk: Use ${PICO} for extension for PIC objects. + default to .pico (like NetBSD) safe on case insensitive filesystem. + +2016-08-19 Simon J. Gerraty + + * meta.sys.mk (META_COOKIE_TOUCH): use ${.OBJDIR}/${.TARGET:T} as default + 2016-08-15 Simon J. Gerraty * install-mk (MK_VERSION): 20160815 Modified: head/contrib/bmake/mk/FILES ============================================================================== --- head/contrib/bmake/mk/FILES Mon Dec 19 22:28:28 2016 (r310303) +++ head/contrib/bmake/mk/FILES Mon Dec 19 23:38:07 2016 (r310304) @@ -38,7 +38,9 @@ stage-install.sh subdir.mk sys.mk sys.clean-env.mk +sys.debug.mk sys.dependfile.mk +sys.vars.mk sys/AIX.mk sys/Darwin.mk sys/Generic.mk Modified: head/contrib/bmake/mk/dirdeps.mk ============================================================================== --- head/contrib/bmake/mk/dirdeps.mk Mon Dec 19 22:28:28 2016 (r310303) +++ head/contrib/bmake/mk/dirdeps.mk Mon Dec 19 23:38:07 2016 (r310304) @@ -1,4 +1,4 @@ -# $Id: dirdeps.mk,v 1.73 2016/08/15 19:28:13 sjg Exp $ +# $Id: dirdeps.mk,v 1.84 2016/11/27 02:44:34 sjg Exp $ # Copyright (c) 2010-2013, Juniper Networks, Inc. # All rights reserved. @@ -56,9 +56,12 @@ # .MAKE.DEPENDFILE_PREFIX) to refer to these makefiles to # distinguish them from others. # -# Each Makefile.depend file sets DEP_RELDIR to be the -# the RELDIR (path relative to SRCTOP) for its directory, and -# since each Makefile.depend file includes dirdeps.mk, this +# Before each Makefile.depend file is read, we set +# DEP_RELDIR to be the the RELDIR (path relative to SRCTOP) for +# its directory, and DEP_MACHINE etc according to the . +# represented by the suffix of the corresponding target. +# +# Since each Makefile.depend file includes dirdeps.mk, this # processing is recursive and results in .MAKE.LEVEL 0 learning the # dependencies of the tree wrt the initial directory (_DEP_RELDIR). # @@ -110,6 +113,29 @@ # # as we may need it to find Makefile.depend* # TARGET_SPEC = ${TARGET_SPEC_VARS:@v@${$v:U}@:ts,} # +# The following variables can influence the initial DIRDEPS +# computation with regard to the TARGET_SPECs that will be +# built. +# Most should also be considered by init.mk +# +# ONLY_TARGET_SPEC_LIST +# Defines a list of TARGET_SPECs for which the current +# directory can be built. +# If ALL_MACHINES is defined, we build for all the +# TARGET_SPECs listed. +# +# ONLY_MACHINE_LIST +# As for ONLY_TARGET_SPEC_LIST but only specifies +# MACHINEs. +# +# NOT_TARGET_SPEC_LIST +# A list of TARGET_SPECs for which the current +# directory should not be built. +# +# NOT_MACHINE_LIST +# A list of MACHINEs the current directory should not be +# built for. +# # touch this at your peril _DIRDEP_USE_LEVEL?= 0 @@ -171,9 +197,13 @@ DEP_$v ?= ${$v} # we compute below are fully qualified wrt DEP_TARGET_SPEC. # The makefiles may only partially specify (eg. MACHINE only), # so we need to construct a set of modifiers to fill in the gaps. -# jot 10 should output 1 2 3 .. 10 -JOT ?= jot -_tspec_x := ${${JOT} ${TARGET_SPEC_VARS:[#]}:L:sh} +.if ${TARGET_SPEC_VARS:[#]} > 10 +# seriously? better have jot(1) or equivalent to produce suitable sequence +_tspec_x := ${${JOT:Ujot} ${TARGET_SPEC_VARS:[#]}:L:sh} +.else +# we can provide the sequence ourselves +_tspec_x := ${1 2 3 4 5 6 7 8 9 10:L:[1..${TARGET_SPEC_VARS:[#]}]} +.endif # this handles unqualified entries M_dep_qual_fixes = C;(/[^/.,]+)$$;\1.$${DEP_TARGET_SPEC}; # there needs to be at least one item missing for these to make sense @@ -287,6 +317,18 @@ _DEP_RELDIR := ${DEP_RELDIR} .endif +# DIRDEPS_CACHE can be very handy for debugging. +# Also if repeatedly building the same target, +# we can avoid the overhead of re-computing the tree dependencies. +MK_DIRDEPS_CACHE ?= no +BUILD_DIRDEPS_CACHE ?= no +BUILD_DIRDEPS ?= yes + +.if ${MK_DIRDEPS_CACHE} == "yes" +# this is where we will cache all our work +DIRDEPS_CACHE ?= ${_OBJDIR:tA}/dirdeps.cache${.TARGETS:Nall:O:u:ts-:S,/,_,g:S,^,.,:N.} +.endif + # pickup customizations # as below you can use !target(_DIRDEP_USE) to protect things # which should only be done once. @@ -305,8 +347,10 @@ SKIP_DIR.host += ${SKIP_HOSTDIR} DEP_SKIP_DIR = ${SKIP_DIR} \ ${SKIP_DIR.${DEP_TARGET_SPEC}:U} \ - ${SKIP_DIR.${DEP_MACHINE}:U} \ - ${SKIP_DIRDEPS.${DEP_MACHINE}:U} + ${TARGET_SPEC_VARS:@v@${SKIP_DIR.${DEP_$v}:U}@} \ + ${SKIP_DIRDEPS.${DEP_TARGET_SPEC}:U} \ + ${TARGET_SPEC_VARS:@v@${SKIP_DIRDEPS.${DEP_$v}:U}@} + NSkipDir = ${DEP_SKIP_DIR:${M_ListToSkip}} @@ -344,7 +388,7 @@ _DIRDEP_USE: .USE .MAKE .ifdef ALL_MACHINES # this is how you limit it to only the machines we have been built for # previously. -.if empty(ONLY_MACHINE_LIST) +.if empty(ONLY_TARGET_SPEC_LIST) && empty(ONLY_MACHINE_LIST) .if !empty(ALL_MACHINE_LIST) # ALL_MACHINE_LIST is the list of all legal machines - ignore anything else _machine_list != cd ${_CURDIR} && 'ls' -1 ${ALL_MACHINE_LIST:O:u:@m@${.MAKE.DEPENDFILE:T:R}.$m@} 2> /dev/null; echo @@ -353,7 +397,7 @@ _machine_list != 'ls' -1 ${_CURDIR}/${.M .endif _only_machines := ${_machine_list:${NIgnoreFiles:UN*.bak}:E:O:u} .else -_only_machines := ${ONLY_MACHINE_LIST} +_only_machines := ${ONLY_TARGET_SPEC_LIST:U} ${ONLY_MACHINE_LIST:U} .endif .if empty(_only_machines) @@ -362,30 +406,35 @@ _only_machines := ${TARGET_MACHINE:U${AL .endif .else # ! ALL_MACHINES -# if ONLY_MACHINE_LIST is set, we are limited to that +# if ONLY_TARGET_SPEC_LIST or ONLY_MACHINE_LIST is set, we are limited to that. +# Note that ONLY_TARGET_SPEC_LIST should be fully qualified. # if TARGET_MACHINE is set - it is really the same as ONLY_MACHINE_LIST # otherwise DEP_MACHINE is it - so DEP_MACHINE will match. +_only_machines := ${ONLY_TARGET_SPEC_LIST:U:M${DEP_MACHINE},*} +.if empty(_only_machines) _only_machines := ${ONLY_MACHINE_LIST:U${TARGET_MACHINE:U${DEP_MACHINE}}:M${DEP_MACHINE}} .endif +.endif .if !empty(NOT_MACHINE_LIST) _only_machines := ${_only_machines:${NOT_MACHINE_LIST:${M_ListToSkip}}} .endif +.if !empty(NOT_TARGET_SPEC_LIST) +# we must first qualify +_dm := ${DEP_MACHINE} +_only_machines := ${_only_machines:M*,*} ${_only_machines:N*,*:@DEP_MACHINE@${DEP_TARGET_SPEC}@:S,^,.,:${M_dep_qual_fixes:ts:}:O:u:S,^.,,} +DEP_MACHINE := ${_dm} +_only_machines := ${_only_machines:${NOT_TARGET_SPEC_LIST:${M_ListToSkip}}} +.endif +# clean up +_only_machines := ${_only_machines:O:u} # make sure we have a starting place? DIRDEPS ?= ${RELDIR} .endif # target -# if repeatedly building the same target, -# we can avoid the overhead of re-computing the tree dependencies. -MK_DIRDEPS_CACHE ?= no -BUILD_DIRDEPS_CACHE ?= no -BUILD_DIRDEPS ?= yes - .if !defined(NO_DIRDEPS) && !defined(NO_DIRDEPS_BELOW) .if ${MK_DIRDEPS_CACHE} == "yes" -# this is where we will cache all our work -DIRDEPS_CACHE?= ${_OBJDIR:tA}/dirdeps.cache${.TARGETS:Nall:O:u:ts-:S,/,_,g:S,^,.,:N.} # just ensure this exists build-dirdeps: @@ -420,6 +469,7 @@ ${DIRDEPS_CACHE}: .META .NOMETA_CMP } > ${.TARGET}.new +@MAKELEVEL=${.MAKE.LEVEL} DIRDEPS_CACHE=${DIRDEPS_CACHE} \ DIRDEPS="${DIRDEPS}" \ + TARGET_SPEC=${TARGET_SPEC} \ MAKEFLAGS= ${.MAKE} -C ${_CURDIR} -f ${BUILD_DIRDEPS_MAKEFILE} \ ${BUILD_DIRDEPS_TARGETS} BUILD_DIRDEPS_CACHE=yes \ .MAKE.DEPENDFILE=.none \ @@ -489,8 +539,10 @@ _machines := ${_machines:O:u} _dm := ${DEP_MACHINE} # apply the same filtering that we do when qualifying DIRDEPS. # M_dep_qual_fixes expects .${MACHINE}* so add (and remove) '.' -_machines := ${_machines:@DEP_MACHINE@${DEP_TARGET_SPEC}@:S,^,.,:${M_dep_qual_fixes:ts:}:O:u:S,^.,,} +# Again we expect that any already qualified machines are fully qualified. +_machines := ${_machines:M*,*} ${_machines:N*,*:@DEP_MACHINE@${DEP_TARGET_SPEC}@:S,^,.,:${M_dep_qual_fixes:ts:}:O:u:S,^.,,} DEP_MACHINE := ${_dm} +_machines := ${_machines:O:u} .endif # reset each time through @@ -522,7 +574,7 @@ _build_dirs += ${_machines:N${DEP_TARGET # these we reset each time through as they can depend on DEP_MACHINE DEP_DIRDEPS_FILTER = \ ${DIRDEPS_FILTER.${DEP_TARGET_SPEC}:U} \ - ${DIRDEPS_FILTER.${DEP_MACHINE}:U} \ + ${TARGET_SPEC_VARS:@v@${DIRDEPS_FILTER.${DEP_$v}:U}@} \ ${DIRDEPS_FILTER:U} .if empty(DEP_DIRDEPS_FILTER) # something harmless @@ -621,6 +673,19 @@ _dirdeps_checked.$d: .endif # Note: _build_all_dirs is fully qualifed so d:R is always the directory .if exists(${d:R}) +# we pass _DEP_TARGET_SPEC to tell the next step what we want +_DEP_TARGET_SPEC := ${d:E} +# some makefiles may still look at this +_DEP_MACHINE := ${d:E:C/,.*//} +# set these too in case Makefile.depend* uses them +.if ${TARGET_SPEC_VARS:[#]} > 1 +_dtspec := ${_DEP_TARGET_SPEC:S/,/ /g} +.for i in ${_tspec_x} +DEP_${TARGET_SPEC_VARS:[$i]} := ${_dtspec:[$i]} +.endfor +.else +DEP_MACHINE := ${_DEP_MACHINE} +.endif # Warning: there is an assumption here that MACHINE is always # the first entry in TARGET_SPEC_VARS. # If TARGET_SPEC and MACHINE are insufficient, you have a problem. @@ -631,10 +696,6 @@ _qm := ${_m:C;(\.depend)$;\1.${d:E};:${M .if ${_debug_search} .info Looking for ${_qm} .endif -# we pass _DEP_TARGET_SPEC to tell the next step what we want -_DEP_TARGET_SPEC := ${d:E} -# some makefiles may still look at this -_DEP_MACHINE := ${d:E:C/,.*//} # set this "just in case" # we can skip :tA since we computed the path above DEP_RELDIR := ${_m:H:S,${SRCTOP}/,,} @@ -687,7 +748,7 @@ _src != cd ${.CURDIR} && for m in ${.MAK _src?= ${.MAKE.DEPENDFILE} -.MAKE.DEPENDFILE_BOOTSTRAP_SED+= -e 's,${_src:E},${MACHINE},g' +.MAKE.DEPENDFILE_BOOTSTRAP_SED+= -e 's/${_src:E:C/,.*//}/${MACHINE}/g' # just create Makefile.depend* for this dir bootstrap-this: .NOTMAIN @@ -696,7 +757,7 @@ bootstrap-this: .NOTMAIN .if ${_src:T} != ${.MAKE.DEPENDFILE_PREFIX:T} (cd ${.CURDIR} && sed ${.MAKE.DEPENDFILE_BOOTSTRAP_SED} ${_src} > ${_want}) .else - cp ${.CURDIR}/${_src} ${_want} + cp ${.CURDIR}/${_src:T} ${_want} .endif # create Makefile.depend* for this dir and its dependencies Modified: head/contrib/bmake/mk/gendirdeps.mk ============================================================================== --- head/contrib/bmake/mk/gendirdeps.mk Mon Dec 19 22:28:28 2016 (r310303) +++ head/contrib/bmake/mk/gendirdeps.mk Mon Dec 19 23:38:07 2016 (r310304) @@ -1,4 +1,4 @@ -# $Id: gendirdeps.mk,v 1.32 2016/04/05 15:58:37 sjg Exp $ +# $Id: gendirdeps.mk,v 1.33 2016/10/11 22:37:28 sjg Exp $ # Copyright (c) 2010-2013, Juniper Networks, Inc. # All rights reserved. @@ -146,6 +146,9 @@ M2D_OBJROOTS += ${OBJTOP} ${_OBJROOT} ${ .if defined(SB_OBJROOT) M2D_OBJROOTS += ${SB_OBJROOT} .endif +.if defined(STAGE_ROOT) +M2D_OBJROOTS += ${STAGE_ROOT} +.endif .if ${.MAKE.DEPENDFILE_PREFERENCE:U${.MAKE.DEPENDFILE}:M*.${MACHINE}} == "" # meta2deps.py only groks objroot # so we need to give it what it expects Modified: head/contrib/bmake/mk/install-mk ============================================================================== --- head/contrib/bmake/mk/install-mk Mon Dec 19 22:28:28 2016 (r310303) +++ head/contrib/bmake/mk/install-mk Mon Dec 19 23:38:07 2016 (r310304) @@ -55,7 +55,7 @@ # Simon J. Gerraty # RCSid: -# $Id: install-mk,v 1.130 2016/08/15 19:28:13 sjg Exp $ +# $Id: install-mk,v 1.135 2016/12/12 19:07:42 sjg Exp $ # # @(#) Copyright (c) 1994 Simon J. Gerraty # @@ -70,7 +70,7 @@ # sjg@crufty.net # -MK_VERSION=20160815 +MK_VERSION=20161212 OWNER= GROUP= MODE=444 Modified: head/contrib/bmake/mk/lib.mk ============================================================================== --- head/contrib/bmake/mk/lib.mk Mon Dec 19 22:28:28 2016 (r310303) +++ head/contrib/bmake/mk/lib.mk Mon Dec 19 23:38:07 2016 (r310304) @@ -1,4 +1,4 @@ -# $Id: lib.mk,v 1.54 2016/08/02 20:52:17 sjg Exp $ +# $Id: lib.mk,v 1.55 2016/09/23 23:04:51 sjg Exp $ .if !target(__${.PARSEFILE}__) __${.PARSEFILE}__: @@ -9,39 +9,30 @@ __${.PARSEFILE}__: NEED_SOLINKS?= yes .endif -.if exists(${.CURDIR}/shlib_version) -SHLIB_MAJOR != . ${.CURDIR}/shlib_version ; echo $$major -SHLIB_MINOR != . ${.CURDIR}/shlib_version ; echo $$minor -.endif - -print-shlib-major: -.if defined(SHLIB_MAJOR) && ${MK_PIC} != "no" - @echo ${SHLIB_MAJOR} -.else - @false +SHLIB_VERSION_FILE?= ${.CURDIR}/shlib_version +.if !defined(SHLIB_MAJOR) && exists(${SHLIB_VERSION_FILE}) +SHLIB_MAJOR != . ${SHLIB_VERSION_FILE} ; echo $$major +SHLIB_MINOR != . ${SHLIB_VERSION_FILE} ; echo $$minor +SHLIB_TEENY != . ${SHLIB_VERSION_FILE} ; echo $$teeny .endif -print-shlib-minor: -.if defined(SHLIB_MINOR) && ${MK_PIC} != "no" - @echo ${SHLIB_MINOR} -.else - @false -.endif - -print-shlib-teeny: -.if defined(SHLIB_TEENY) && ${MK_PIC} != "no" - @echo ${SHLIB_TEENY} +.for x in major minor teeny +print-shlib-$x: +.if defined(SHLIB_${x:tu}) && ${MK_PIC} != "no" + @echo ${SHLIB_${x:tu}} .else @false .endif +.endfor SHLIB_FULLVERSION ?= ${${SHLIB_MAJOR} ${SHLIB_MINOR} ${SHLIB_TEENY}:L:ts.} SHLIB_FULLVERSION := ${SHLIB_FULLVERSION} # add additional suffixes not exported. # .po is used for profiling object files. -# .So is used for PIC object files. -.SUFFIXES: .out .a .ln .So .po .o .s .S .c .cc .C .m .F .f .r .y .l .cl .p .h +# ${PICO} is used for PIC object files. +PICO?= .pico +.SUFFIXES: .out .a .ln ${PICO} .po .o .s .S .c .cc .C .m .F .f .r .y .l .cl .p .h .SUFFIXES: .sh .m4 .m CFLAGS+= ${COPTS} @@ -62,12 +53,12 @@ CFLAGS+= ${COPTS} # with ELF, also set shared-lib version for ld.so. # SHLIB_LDSTARTFILE: support .o file, call C++ file-level constructors # SHLIB_LDENDFILE: support .o file, call C++ file-level destructors -# FPICFLAGS: flags for ${FC} to compile .[fF] files to .So objects. +# FPICFLAGS: flags for ${FC} to compile .[fF] files to ${PICO} objects. # CPPICFLAGS: flags for ${CPP} to preprocess .[sS] files for ${AS} -# CPICFLAGS: flags for ${CC} to compile .[cC] files to .So objects. +# CPICFLAGS: flags for ${CC} to compile .[cC] files to ${PICO} objects. # CAPICFLAGS flags for {$CC} to compiling .[Ss] files # (usually just ${CPPPICFLAGS} ${CPICFLAGS}) -# APICFLAGS: flags for ${AS} to assemble .[sS] to .So objects. +# APICFLAGS: flags for ${AS} to assemble .[sS] to ${PICO} objects. .if ${TARGET_OSNAME} == "NetBSD" .if ${MACHINE_ARCH} == "alpha" @@ -162,14 +153,14 @@ LD_shared=-b LD_so=sl DLLIB= # HPsUX lorder does not grok anything but .o -LD_sobjs=`${LORDER} ${OBJS} | ${TSORT} | sed 's,\.o,.So,'` +LD_sobjs=`${LORDER} ${OBJS} | ${TSORT} | sed 's,\.o,${PICO},'` LD_pobjs=`${LORDER} ${OBJS} | ${TSORT} | sed 's,\.o,.po,'` .elif ${TARGET_OSNAME} == "OSF1" LD_shared= -msym -shared -expect_unresolved '*' LD_solib= -all lib${LIB}_pic.a DLLIB= # lorder does not grok anything but .o -LD_sobjs=`${LORDER} ${OBJS} | ${TSORT} | sed 's,\.o,.So,'` +LD_sobjs=`${LORDER} ${OBJS} | ${TSORT} | sed 's,\.o,${PICO},'` LD_pobjs=`${LORDER} ${OBJS} | ${TSORT} | sed 's,\.o,.po,'` *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@freebsd.org Tue Dec 20 01:13:12 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id CBA03C8796E; Tue, 20 Dec 2016 01:13:12 +0000 (UTC) (envelope-from kevlo@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A62EA1D19; Tue, 20 Dec 2016 01:13:12 +0000 (UTC) (envelope-from kevlo@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBK1DBYc082013; Tue, 20 Dec 2016 01:13:11 GMT (envelope-from kevlo@FreeBSD.org) Received: (from kevlo@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBK1DBtN082008; Tue, 20 Dec 2016 01:13:11 GMT (envelope-from kevlo@FreeBSD.org) Message-Id: <201612200113.uBK1DBtN082008@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevlo set sender to kevlo@FreeBSD.org using -f From: Kevin Lo Date: Tue, 20 Dec 2016 01:13:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310305 - in head/sys/dev/rtwn: rtl8188e/usb rtl8192c rtl8812a X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Dec 2016 01:13:12 -0000 Author: kevlo Date: Tue Dec 20 01:13:11 2016 New Revision: 310305 URL: https://svnweb.freebsd.org/changeset/base/310305 Log: Merge r92c_init_rf_common() into r92c_init_rf(). In r88eu_attach.c, we could use r92c_init_rf() rather than r92c_init_rf_common() when sc_init_rf() callback is invoked. While here, constantly use RF chain instead of RF path in comment. Reviewed by: avos Modified: head/sys/dev/rtwn/rtl8188e/usb/r88eu_attach.c head/sys/dev/rtwn/rtl8188e/usb/r88eu_init.c head/sys/dev/rtwn/rtl8192c/r92c.h head/sys/dev/rtwn/rtl8192c/r92c_init.c head/sys/dev/rtwn/rtl8812a/r12a_priv.h Modified: head/sys/dev/rtwn/rtl8188e/usb/r88eu_attach.c ============================================================================== --- head/sys/dev/rtwn/rtl8188e/usb/r88eu_attach.c Mon Dec 19 23:38:07 2016 (r310304) +++ head/sys/dev/rtwn/rtl8188e/usb/r88eu_attach.c Tue Dec 20 01:13:11 2016 (r310305) @@ -171,7 +171,7 @@ r88eu_attach(struct rtwn_usb_softc *uc) sc->sc_init_intr = r88eu_init_intr; sc->sc_init_edca = r92c_init_edca; sc->sc_init_bb = r88e_init_bb; - sc->sc_init_rf = r92c_init_rf_common; + sc->sc_init_rf = r92c_init_rf; sc->sc_init_antsel = rtwn_nop_softc; sc->sc_post_init = r88eu_post_init; sc->sc_init_bcnq1_boundary = rtwn_nop_int_softc; Modified: head/sys/dev/rtwn/rtl8188e/usb/r88eu_init.c ============================================================================== --- head/sys/dev/rtwn/rtl8188e/usb/r88eu_init.c Mon Dec 19 23:38:07 2016 (r310304) +++ head/sys/dev/rtwn/rtl8188e/usb/r88eu_init.c Tue Dec 20 01:13:11 2016 (r310305) @@ -200,9 +200,6 @@ r88eu_init_rx_agg(struct rtwn_softc *sc) void r88eu_post_init(struct rtwn_softc *sc) { - /* Turn CCK and OFDM blocks on. */ - rtwn_bb_setbits(sc, R92C_FPGA0_RFMOD, 0, R92C_RFMOD_CCK_EN); - rtwn_bb_setbits(sc, R92C_FPGA0_RFMOD, 0, R92C_RFMOD_OFDM_EN); /* Enable per-packet TX report. */ rtwn_setbits_1(sc, R88E_TX_RPT_CTRL, 0, R88E_TX_RPT1_ENA); Modified: head/sys/dev/rtwn/rtl8192c/r92c.h ============================================================================== --- head/sys/dev/rtwn/rtl8192c/r92c.h Mon Dec 19 23:38:07 2016 (r310304) +++ head/sys/dev/rtwn/rtl8192c/r92c.h Tue Dec 20 01:13:11 2016 (r310305) @@ -81,7 +81,6 @@ int r92c_set_page_size(struct rtwn_softc void r92c_init_bb_common(struct rtwn_softc *); int r92c_init_rf_chain(struct rtwn_softc *, const struct rtwn_rf_prog *, int); -void r92c_init_rf_common(struct rtwn_softc *); void r92c_init_rf(struct rtwn_softc *); void r92c_init_edca(struct rtwn_softc *); void r92c_init_ampdu(struct rtwn_softc *); Modified: head/sys/dev/rtwn/rtl8192c/r92c_init.c ============================================================================== --- head/sys/dev/rtwn/rtl8192c/r92c_init.c Mon Dec 19 23:38:07 2016 (r310304) +++ head/sys/dev/rtwn/rtl8192c/r92c_init.c Tue Dec 20 01:13:11 2016 (r310305) @@ -204,7 +204,7 @@ r92c_init_rf_chain(struct rtwn_softc *sc } void -r92c_init_rf_common(struct rtwn_softc *sc) +r92c_init_rf(struct rtwn_softc *sc) { struct r92c_softc *rs = sc->sc_priv; uint32_t reg, type; @@ -244,14 +244,6 @@ r92c_init_rf_common(struct rtwn_softc *s rs->rf_chnlbw[chain] = rtwn_rf_read(sc, chain, R92C_RF_CHNLBW); } -} - -void -r92c_init_rf(struct rtwn_softc *sc) -{ - struct r92c_softc *rs = sc->sc_priv; - - r92c_init_rf_common(sc); if ((rs->chip & (R92C_CHIP_UMC_A_CUT | R92C_CHIP_92C)) == R92C_CHIP_UMC_A_CUT) { Modified: head/sys/dev/rtwn/rtl8812a/r12a_priv.h ============================================================================== --- head/sys/dev/rtwn/rtl8812a/r12a_priv.h Mon Dec 19 23:38:07 2016 (r310304) +++ head/sys/dev/rtwn/rtl8812a/r12a_priv.h Tue Dec 20 01:13:11 2016 (r310305) @@ -657,7 +657,7 @@ static const struct rtwn_rf_prog rtl8812 NULL }, { 0, NULL, NULL, { 0 }, NULL }, - /* RF path 2. */ + /* RF chain 1. */ { nitems(rtl8812au_rf1_regs0), rtl8812au_rf1_regs0, From owner-svn-src-all@freebsd.org Tue Dec 20 01:34:31 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 32340C886C4; Tue, 20 Dec 2016 01:34:31 +0000 (UTC) (envelope-from jmcneill@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C2F81CA1; Tue, 20 Dec 2016 01:34:30 +0000 (UTC) (envelope-from jmcneill@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBK1YU6Q089965; Tue, 20 Dec 2016 01:34:30 GMT (envelope-from jmcneill@FreeBSD.org) Received: (from jmcneill@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBK1YTu3089959; Tue, 20 Dec 2016 01:34:29 GMT (envelope-from jmcneill@FreeBSD.org) Message-Id: <201612200134.uBK1YTu3089959@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jmcneill set sender to jmcneill@FreeBSD.org using -f From: Jared McNeill Date: Tue, 20 Dec 2016 01:34:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310306 - in head/sys: arm/allwinner arm/arm arm/freescale/imx conf dev/hdmi X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Dec 2016 01:34:31 -0000 Author: jmcneill Date: Tue Dec 20 01:34:29 2016 New Revision: 310306 URL: https://svnweb.freebsd.org/changeset/base/310306 Log: Split the DesignWare HDMI-specific code from imx6_hdmi.c into a separate file and add a generic DT binding that takes advantage of the extres framework for setting up clocks. Reviewed by: gonzo Differential Revision: https://reviews.freebsd.org/D8826 Added: head/sys/dev/hdmi/ head/sys/dev/hdmi/dwc_hdmi.c (contents, props changed) head/sys/dev/hdmi/dwc_hdmi.h (contents, props changed) head/sys/dev/hdmi/dwc_hdmi_fdt.c (contents, props changed) head/sys/dev/hdmi/dwc_hdmireg.h (contents, props changed) head/sys/dev/hdmi/hdmi_if.m - copied unchanged from r310305, head/sys/arm/arm/hdmi_if.m Deleted: head/sys/arm/arm/hdmi_if.m head/sys/arm/freescale/imx/imx6_hdmireg.h Modified: head/sys/arm/allwinner/files.allwinner head/sys/arm/freescale/imx/files.imx6 head/sys/arm/freescale/imx/imx6_hdmi.c head/sys/conf/files.arm Modified: head/sys/arm/allwinner/files.allwinner ============================================================================== --- head/sys/arm/allwinner/files.allwinner Tue Dec 20 01:13:11 2016 (r310305) +++ head/sys/arm/allwinner/files.allwinner Tue Dec 20 01:34:29 2016 (r310306) @@ -35,7 +35,7 @@ arm/allwinner/aw_cir.c optional aw_cir arm/allwinner/a10_fb.c optional vt arm/allwinner/a10_hdmi.c optional hdmi arm/allwinner/a10_hdmiaudio.c optional hdmi sound -arm/arm/hdmi_if.m optional hdmi +dev/hdmi/hdmi_if.m optional hdmi arm/allwinner/aw_reset.c standard arm/allwinner/aw_ccu.c standard Modified: head/sys/arm/freescale/imx/files.imx6 ============================================================================== --- head/sys/arm/freescale/imx/files.imx6 Tue Dec 20 01:13:11 2016 (r310305) +++ head/sys/arm/freescale/imx/files.imx6 Tue Dec 20 01:34:29 2016 (r310306) @@ -24,7 +24,8 @@ arm/freescale/imx/imx6_sdma.c optional arm/freescale/imx/imx6_audmux.c optional sound arm/freescale/imx/imx6_ssi.c optional sound -arm/arm/hdmi_if.m optional hdmi +dev/hdmi/hdmi_if.m optional hdmi +dev/hdmi/dwc_hdmi.c optional hdmi arm/freescale/imx/imx6_hdmi.c optional hdmi arm/freescale/imx/imx6_ipu.c optional vt Modified: head/sys/arm/freescale/imx/imx6_hdmi.c ============================================================================== --- head/sys/arm/freescale/imx/imx6_hdmi.c Tue Dec 20 01:13:11 2016 (r310305) +++ head/sys/arm/freescale/imx/imx6_hdmi.c Tue Dec 20 01:34:29 2016 (r310306) @@ -44,30 +44,18 @@ __FBSDID("$FreeBSD$"); #include #include -#include - -#include -#include #include #include #include -#include -#include "hdmi_if.h" +#include -#define I2C_DDC_ADDR (0x50 << 1) -#define EDID_LENGTH 0x80 +#include "hdmi_if.h" struct imx_hdmi_softc { - device_t sc_dev; - struct resource *sc_mem_res; - int sc_mem_rid; - struct intr_config_hook sc_mode_hook; - struct videomode sc_mode; - uint8_t *sc_edid; - uint8_t sc_edid_len; - phandle_t sc_i2c_xref; + struct dwc_hdmi_softc base; + phandle_t i2c_xref; }; static struct ofw_compat_data compat_data[] = { @@ -76,565 +64,17 @@ static struct ofw_compat_data compat_dat {NULL, 0} }; -static inline uint8_t -RD1(struct imx_hdmi_softc *sc, bus_size_t off) -{ - - return (bus_read_1(sc->sc_mem_res, off)); -} - -static inline void -WR1(struct imx_hdmi_softc *sc, bus_size_t off, uint8_t val) -{ - - bus_write_1(sc->sc_mem_res, off, val); -} - -static void -imx_hdmi_phy_wait_i2c_done(struct imx_hdmi_softc *sc, int msec) -{ - uint8_t val; - - val = RD1(sc, HDMI_IH_I2CMPHY_STAT0) & - (HDMI_IH_I2CMPHY_STAT0_DONE | HDMI_IH_I2CMPHY_STAT0_ERROR); - while (val == 0) { - pause("HDMI_PHY", hz/100); - msec -= 10; - if (msec <= 0) - return; - val = RD1(sc, HDMI_IH_I2CMPHY_STAT0) & - (HDMI_IH_I2CMPHY_STAT0_DONE | HDMI_IH_I2CMPHY_STAT0_ERROR); - } -} - -static void -imx_hdmi_phy_i2c_write(struct imx_hdmi_softc *sc, unsigned short data, - unsigned char addr) -{ - - /* clear DONE and ERROR flags */ - WR1(sc, HDMI_IH_I2CMPHY_STAT0, - HDMI_IH_I2CMPHY_STAT0_DONE | HDMI_IH_I2CMPHY_STAT0_ERROR); - WR1(sc, HDMI_PHY_I2CM_ADDRESS_ADDR, addr); - WR1(sc, HDMI_PHY_I2CM_DATAO_1_ADDR, ((data >> 8) & 0xff)); - WR1(sc, HDMI_PHY_I2CM_DATAO_0_ADDR, ((data >> 0) & 0xff)); - WR1(sc, HDMI_PHY_I2CM_OPERATION_ADDR, HDMI_PHY_I2CM_OPERATION_ADDR_WRITE); - imx_hdmi_phy_wait_i2c_done(sc, 1000); -} - -static void -imx_hdmi_disable_overflow_interrupts(struct imx_hdmi_softc *sc) -{ - WR1(sc, HDMI_IH_MUTE_FC_STAT2, HDMI_IH_MUTE_FC_STAT2_OVERFLOW_MASK); - WR1(sc, HDMI_FC_MASK2, - HDMI_FC_MASK2_LOW_PRI | HDMI_FC_MASK2_HIGH_PRI); -} - -static void -imx_hdmi_av_composer(struct imx_hdmi_softc *sc) -{ - uint8_t inv_val; - int is_dvi; - int hblank, vblank, hsync_len, hbp, vbp; - - /* Set up HDMI_FC_INVIDCONF */ - inv_val = ((sc->sc_mode.flags & VID_NVSYNC) ? - HDMI_FC_INVIDCONF_VSYNC_IN_POLARITY_ACTIVE_LOW : - HDMI_FC_INVIDCONF_VSYNC_IN_POLARITY_ACTIVE_HIGH); - - inv_val |= ((sc->sc_mode.flags & VID_NHSYNC) ? - HDMI_FC_INVIDCONF_HSYNC_IN_POLARITY_ACTIVE_LOW : - HDMI_FC_INVIDCONF_HSYNC_IN_POLARITY_ACTIVE_HIGH); - - inv_val |= HDMI_FC_INVIDCONF_DE_IN_POLARITY_ACTIVE_HIGH; - - inv_val |= ((sc->sc_mode.flags & VID_INTERLACE) ? - HDMI_FC_INVIDCONF_R_V_BLANK_IN_OSC_ACTIVE_HIGH : - HDMI_FC_INVIDCONF_R_V_BLANK_IN_OSC_ACTIVE_LOW); - - inv_val |= ((sc->sc_mode.flags & VID_INTERLACE) ? - HDMI_FC_INVIDCONF_IN_I_P_INTERLACED : - HDMI_FC_INVIDCONF_IN_I_P_PROGRESSIVE); - - /* TODO: implement HDMI part */ - is_dvi = 1; - inv_val |= (is_dvi ? - HDMI_FC_INVIDCONF_DVI_MODEZ_DVI_MODE : - HDMI_FC_INVIDCONF_DVI_MODEZ_HDMI_MODE); - - WR1(sc, HDMI_FC_INVIDCONF, inv_val); - - /* Set up horizontal active pixel region width */ - WR1(sc, HDMI_FC_INHACTV1, sc->sc_mode.hdisplay >> 8); - WR1(sc, HDMI_FC_INHACTV0, sc->sc_mode.hdisplay); - - /* Set up vertical blanking pixel region width */ - WR1(sc, HDMI_FC_INVACTV1, sc->sc_mode.vdisplay >> 8); - WR1(sc, HDMI_FC_INVACTV0, sc->sc_mode.vdisplay); - - /* Set up horizontal blanking pixel region width */ - hblank = sc->sc_mode.htotal - sc->sc_mode.hdisplay; - WR1(sc, HDMI_FC_INHBLANK1, hblank >> 8); - WR1(sc, HDMI_FC_INHBLANK0, hblank); - - /* Set up vertical blanking pixel region width */ - vblank = sc->sc_mode.vtotal - sc->sc_mode.vdisplay; - WR1(sc, HDMI_FC_INVBLANK, vblank); - - /* Set up HSYNC active edge delay width (in pixel clks) */ - hbp = sc->sc_mode.htotal - sc->sc_mode.hsync_end; - WR1(sc, HDMI_FC_HSYNCINDELAY1, hbp >> 8); - WR1(sc, HDMI_FC_HSYNCINDELAY0, hbp); - - /* Set up VSYNC active edge delay (in pixel clks) */ - vbp = sc->sc_mode.vtotal - sc->sc_mode.vsync_end; - WR1(sc, HDMI_FC_VSYNCINDELAY, vbp); - - hsync_len = (sc->sc_mode.hsync_end - sc->sc_mode.hsync_start); - /* Set up HSYNC active pulse width (in pixel clks) */ - WR1(sc, HDMI_FC_HSYNCINWIDTH1, hsync_len >> 8); - WR1(sc, HDMI_FC_HSYNCINWIDTH0, hsync_len); - - /* Set up VSYNC active edge delay (in pixel clks) */ - WR1(sc, HDMI_FC_VSYNCINWIDTH, (sc->sc_mode.vsync_end - sc->sc_mode.vsync_start)); -} - -static void -imx_hdmi_phy_enable_power(struct imx_hdmi_softc *sc, uint8_t enable) -{ - uint8_t reg; - - reg = RD1(sc, HDMI_PHY_CONF0); - reg &= ~HDMI_PHY_CONF0_PDZ_MASK; - reg |= (enable << HDMI_PHY_CONF0_PDZ_OFFSET); - WR1(sc, HDMI_PHY_CONF0, reg); -} - -static void -imx_hdmi_phy_enable_tmds(struct imx_hdmi_softc *sc, uint8_t enable) -{ - uint8_t reg; - - reg = RD1(sc, HDMI_PHY_CONF0); - reg &= ~HDMI_PHY_CONF0_ENTMDS_MASK; - reg |= (enable << HDMI_PHY_CONF0_ENTMDS_OFFSET); - WR1(sc, HDMI_PHY_CONF0, reg); -} - -static void -imx_hdmi_phy_gen2_pddq(struct imx_hdmi_softc *sc, uint8_t enable) -{ - uint8_t reg; - - reg = RD1(sc, HDMI_PHY_CONF0); - reg &= ~HDMI_PHY_CONF0_GEN2_PDDQ_MASK; - reg |= (enable << HDMI_PHY_CONF0_GEN2_PDDQ_OFFSET); - WR1(sc, HDMI_PHY_CONF0, reg); -} - -static void -imx_hdmi_phy_gen2_txpwron(struct imx_hdmi_softc *sc, uint8_t enable) -{ - uint8_t reg; - - reg = RD1(sc, HDMI_PHY_CONF0); - reg &= ~HDMI_PHY_CONF0_GEN2_TXPWRON_MASK; - reg |= (enable << HDMI_PHY_CONF0_GEN2_TXPWRON_OFFSET); - WR1(sc, HDMI_PHY_CONF0, reg); -} - -static void -imx_hdmi_phy_sel_data_en_pol(struct imx_hdmi_softc *sc, uint8_t enable) -{ - uint8_t reg; - - reg = RD1(sc, HDMI_PHY_CONF0); - reg &= ~HDMI_PHY_CONF0_SELDATAENPOL_MASK; - reg |= (enable << HDMI_PHY_CONF0_SELDATAENPOL_OFFSET); - WR1(sc, HDMI_PHY_CONF0, reg); -} - -static void -imx_hdmi_phy_sel_interface_control(struct imx_hdmi_softc *sc, uint8_t enable) -{ - uint8_t reg; - - reg = RD1(sc, HDMI_PHY_CONF0); - reg &= ~HDMI_PHY_CONF0_SELDIPIF_MASK; - reg |= (enable << HDMI_PHY_CONF0_SELDIPIF_OFFSET); - WR1(sc, HDMI_PHY_CONF0, reg); -} - -static inline void -imx_hdmi_phy_test_clear(struct imx_hdmi_softc *sc, unsigned char bit) -{ - uint8_t val; - - val = RD1(sc, HDMI_PHY_TST0); - val &= ~HDMI_PHY_TST0_TSTCLR_MASK; - val |= (bit << HDMI_PHY_TST0_TSTCLR_OFFSET) & - HDMI_PHY_TST0_TSTCLR_MASK; - WR1(sc, HDMI_PHY_TST0, val); -} - -static void -imx_hdmi_clear_overflow(struct imx_hdmi_softc *sc) -{ - int count; - uint8_t val; - - /* TMDS software reset */ - WR1(sc, HDMI_MC_SWRSTZ, (uint8_t)~HDMI_MC_SWRSTZ_TMDSSWRST_REQ); - - val = RD1(sc, HDMI_FC_INVIDCONF); - - for (count = 0 ; count < 5 ; count++) - WR1(sc, HDMI_FC_INVIDCONF, val); -} - -static int -imx_hdmi_phy_configure(struct imx_hdmi_softc *sc) -{ - uint8_t val; - uint8_t msec; - - WR1(sc, HDMI_MC_FLOWCTRL, HDMI_MC_FLOWCTRL_FEED_THROUGH_OFF_CSC_BYPASS); - - /* gen2 tx power off */ - imx_hdmi_phy_gen2_txpwron(sc, 0); - - /* gen2 pddq */ - imx_hdmi_phy_gen2_pddq(sc, 1); - - /* PHY reset */ - WR1(sc, HDMI_MC_PHYRSTZ, HDMI_MC_PHYRSTZ_DEASSERT); - WR1(sc, HDMI_MC_PHYRSTZ, HDMI_MC_PHYRSTZ_ASSERT); - - WR1(sc, HDMI_MC_HEACPHY_RST, HDMI_MC_HEACPHY_RST_ASSERT); - - imx_hdmi_phy_test_clear(sc, 1); - WR1(sc, HDMI_PHY_I2CM_SLAVE_ADDR, HDMI_PHY_I2CM_SLAVE_ADDR_PHY_GEN2); - imx_hdmi_phy_test_clear(sc, 0); - - /* - * Following initialization are for 8bit per color case - */ - - /* - * PLL/MPLL config, see section 24.7.22 in TRM - * config, see section 24.7.22 - */ - if (sc->sc_mode.dot_clock*1000 <= 45250000) { - imx_hdmi_phy_i2c_write(sc, CPCE_CTRL_45_25, HDMI_PHY_I2C_CPCE_CTRL); - imx_hdmi_phy_i2c_write(sc, GMPCTRL_45_25, HDMI_PHY_I2C_GMPCTRL); - } else if (sc->sc_mode.dot_clock*1000 <= 92500000) { - imx_hdmi_phy_i2c_write(sc, CPCE_CTRL_92_50, HDMI_PHY_I2C_CPCE_CTRL); - imx_hdmi_phy_i2c_write(sc, GMPCTRL_92_50, HDMI_PHY_I2C_GMPCTRL); - } else if (sc->sc_mode.dot_clock*1000 <= 185000000) { - imx_hdmi_phy_i2c_write(sc, CPCE_CTRL_185, HDMI_PHY_I2C_CPCE_CTRL); - imx_hdmi_phy_i2c_write(sc, GMPCTRL_185, HDMI_PHY_I2C_GMPCTRL); - } else { - imx_hdmi_phy_i2c_write(sc, CPCE_CTRL_370, HDMI_PHY_I2C_CPCE_CTRL); - imx_hdmi_phy_i2c_write(sc, GMPCTRL_370, HDMI_PHY_I2C_GMPCTRL); - } - - /* - * Values described in TRM section 34.9.2 PLL/MPLL Generic - * Configuration Settings. Table 34-23. - */ - if (sc->sc_mode.dot_clock*1000 <= 54000000) { - imx_hdmi_phy_i2c_write(sc, 0x091c, HDMI_PHY_I2C_CURRCTRL); - } else if (sc->sc_mode.dot_clock*1000 <= 58400000) { - imx_hdmi_phy_i2c_write(sc, 0x091c, HDMI_PHY_I2C_CURRCTRL); - } else if (sc->sc_mode.dot_clock*1000 <= 72000000) { - imx_hdmi_phy_i2c_write(sc, 0x06dc, HDMI_PHY_I2C_CURRCTRL); - } else if (sc->sc_mode.dot_clock*1000 <= 74250000) { - imx_hdmi_phy_i2c_write(sc, 0x06dc, HDMI_PHY_I2C_CURRCTRL); - } else if (sc->sc_mode.dot_clock*1000 <= 118800000) { - imx_hdmi_phy_i2c_write(sc, 0x091c, HDMI_PHY_I2C_CURRCTRL); - } else if (sc->sc_mode.dot_clock*1000 <= 216000000) { - imx_hdmi_phy_i2c_write(sc, 0x06dc, HDMI_PHY_I2C_CURRCTRL); - } else { - panic("Unsupported mode\n"); - } - - imx_hdmi_phy_i2c_write(sc, 0x0000, HDMI_PHY_I2C_PLLPHBYCTRL); - imx_hdmi_phy_i2c_write(sc, MSM_CTRL_FB_CLK, HDMI_PHY_I2C_MSM_CTRL); - /* RESISTANCE TERM 133 Ohm */ - imx_hdmi_phy_i2c_write(sc, TXTERM_133, HDMI_PHY_I2C_TXTERM); - - /* REMOVE CLK TERM */ - imx_hdmi_phy_i2c_write(sc, CKCALCTRL_OVERRIDE, HDMI_PHY_I2C_CKCALCTRL); - - if (sc->sc_mode.dot_clock*1000 > 148500000) { - imx_hdmi_phy_i2c_write(sc,CKSYMTXCTRL_OVERRIDE | CKSYMTXCTRL_TX_SYMON | - CKSYMTXCTRL_TX_TRBON | CKSYMTXCTRL_TX_CK_SYMON, HDMI_PHY_I2C_CKSYMTXCTRL); - imx_hdmi_phy_i2c_write(sc, VLEVCTRL_TX_LVL(9) | VLEVCTRL_CK_LVL(9), - HDMI_PHY_I2C_VLEVCTRL); - } else { - imx_hdmi_phy_i2c_write(sc,CKSYMTXCTRL_OVERRIDE | CKSYMTXCTRL_TX_SYMON | - CKSYMTXCTRL_TX_TRAON | CKSYMTXCTRL_TX_CK_SYMON, HDMI_PHY_I2C_CKSYMTXCTRL); - imx_hdmi_phy_i2c_write(sc, VLEVCTRL_TX_LVL(13) | VLEVCTRL_CK_LVL(13), - HDMI_PHY_I2C_VLEVCTRL); - } - - imx_hdmi_phy_enable_power(sc, 1); - - /* toggle TMDS enable */ - imx_hdmi_phy_enable_tmds(sc, 0); - imx_hdmi_phy_enable_tmds(sc, 1); - - /* gen2 tx power on */ - imx_hdmi_phy_gen2_txpwron(sc, 1); - imx_hdmi_phy_gen2_pddq(sc, 0); - - /*Wait for PHY PLL lock */ - msec = 4; - val = RD1(sc, HDMI_PHY_STAT0) & HDMI_PHY_TX_PHY_LOCK; - while (val == 0) { - DELAY(1000); - if (msec-- == 0) { - device_printf(sc->sc_dev, "PHY PLL not locked\n"); - return (-1); - } - val = RD1(sc, HDMI_PHY_STAT0) & HDMI_PHY_TX_PHY_LOCK; - } - - return true; -} - -static void -imx_hdmi_phy_init(struct imx_hdmi_softc *sc) -{ - int i; - - /* HDMI Phy spec says to do the phy initialization sequence twice */ - for (i = 0 ; i < 2 ; i++) { - imx_hdmi_phy_sel_data_en_pol(sc, 1); - imx_hdmi_phy_sel_interface_control(sc, 0); - imx_hdmi_phy_enable_tmds(sc, 0); - imx_hdmi_phy_enable_power(sc, 0); - - /* Enable CSC */ - imx_hdmi_phy_configure(sc); - } -} - -static void -imx_hdmi_enable_video_path(struct imx_hdmi_softc *sc) -{ - uint8_t clkdis; - - /* - * Control period timing - * Values are minimal according to HDMI spec 1.4a - */ - WR1(sc, HDMI_FC_CTRLDUR, 12); - WR1(sc, HDMI_FC_EXCTRLDUR, 32); - WR1(sc, HDMI_FC_EXCTRLSPAC, 1); - - /* - * Bits to fill data lines not used to transmit preamble - * for channels 0, 1, and 2 respectively - */ - WR1(sc, HDMI_FC_CH0PREAM, 0x0B); - WR1(sc, HDMI_FC_CH1PREAM, 0x16); - WR1(sc, HDMI_FC_CH2PREAM, 0x21); - - /* Save CEC clock */ - clkdis = RD1(sc, HDMI_MC_CLKDIS) & HDMI_MC_CLKDIS_CECCLK_DISABLE; - clkdis |= ~HDMI_MC_CLKDIS_CECCLK_DISABLE; - - /* Enable pixel clock and tmds data path */ - clkdis &= ~HDMI_MC_CLKDIS_PIXELCLK_DISABLE; - WR1(sc, HDMI_MC_CLKDIS, clkdis); - - clkdis &= ~HDMI_MC_CLKDIS_TMDSCLK_DISABLE; - WR1(sc, HDMI_MC_CLKDIS, clkdis); -} - -static void -imx_hdmi_video_packetize(struct imx_hdmi_softc *sc) -{ - unsigned int color_depth = 0; - unsigned int remap_size = HDMI_VP_REMAP_YCC422_16BIT; - unsigned int output_select = HDMI_VP_CONF_OUTPUT_SELECTOR_PP; - uint8_t val; - - output_select = HDMI_VP_CONF_OUTPUT_SELECTOR_BYPASS; - color_depth = 0; - - /* set the packetizer registers */ - val = ((color_depth << HDMI_VP_PR_CD_COLOR_DEPTH_OFFSET) & - HDMI_VP_PR_CD_COLOR_DEPTH_MASK); - WR1(sc, HDMI_VP_PR_CD, val); - - val = RD1(sc, HDMI_VP_STUFF); - val &= ~HDMI_VP_STUFF_PR_STUFFING_MASK; - val |= HDMI_VP_STUFF_PR_STUFFING_STUFFING_MODE; - WR1(sc, HDMI_VP_STUFF, val); - - val = RD1(sc, HDMI_VP_CONF); - val &= ~(HDMI_VP_CONF_PR_EN_MASK | - HDMI_VP_CONF_BYPASS_SELECT_MASK); - val |= HDMI_VP_CONF_PR_EN_DISABLE | - HDMI_VP_CONF_BYPASS_SELECT_VID_PACKETIZER; - WR1(sc, HDMI_VP_CONF, val); - - val = RD1(sc, HDMI_VP_STUFF); - val &= ~HDMI_VP_STUFF_IDEFAULT_PHASE_MASK; - val |= 1 << HDMI_VP_STUFF_IDEFAULT_PHASE_OFFSET; - WR1(sc, HDMI_VP_STUFF, val); - - WR1(sc, HDMI_VP_REMAP, remap_size); - - if (output_select == HDMI_VP_CONF_OUTPUT_SELECTOR_PP) { - val = RD1(sc, HDMI_VP_CONF); - val &= ~(HDMI_VP_CONF_BYPASS_EN_MASK | - HDMI_VP_CONF_PP_EN_ENMASK | - HDMI_VP_CONF_YCC422_EN_MASK); - val |= HDMI_VP_CONF_BYPASS_EN_DISABLE | - HDMI_VP_CONF_PP_EN_ENABLE | - HDMI_VP_CONF_YCC422_EN_DISABLE; - WR1(sc, HDMI_VP_CONF, val); - } else if (output_select == HDMI_VP_CONF_OUTPUT_SELECTOR_YCC422) { - val = RD1(sc, HDMI_VP_CONF); - val &= ~(HDMI_VP_CONF_BYPASS_EN_MASK | - HDMI_VP_CONF_PP_EN_ENMASK | - HDMI_VP_CONF_YCC422_EN_MASK); - val |= HDMI_VP_CONF_BYPASS_EN_DISABLE | - HDMI_VP_CONF_PP_EN_DISABLE | - HDMI_VP_CONF_YCC422_EN_ENABLE; - WR1(sc, HDMI_VP_CONF, val); - } else if (output_select == HDMI_VP_CONF_OUTPUT_SELECTOR_BYPASS) { - val = RD1(sc, HDMI_VP_CONF); - val &= ~(HDMI_VP_CONF_BYPASS_EN_MASK | - HDMI_VP_CONF_PP_EN_ENMASK | - HDMI_VP_CONF_YCC422_EN_MASK); - val |= HDMI_VP_CONF_BYPASS_EN_ENABLE | - HDMI_VP_CONF_PP_EN_DISABLE | - HDMI_VP_CONF_YCC422_EN_DISABLE; - WR1(sc, HDMI_VP_CONF, val); - } else { - return; - } - - val = RD1(sc, HDMI_VP_STUFF); - val &= ~(HDMI_VP_STUFF_PP_STUFFING_MASK | - HDMI_VP_STUFF_YCC422_STUFFING_MASK); - val |= HDMI_VP_STUFF_PP_STUFFING_STUFFING_MODE | - HDMI_VP_STUFF_YCC422_STUFFING_STUFFING_MODE; - WR1(sc, HDMI_VP_STUFF, val); - - val = RD1(sc, HDMI_VP_CONF); - val &= ~HDMI_VP_CONF_OUTPUT_SELECTOR_MASK; - val |= output_select; - WR1(sc, HDMI_VP_CONF, val); -} - -static void -imx_hdmi_video_sample(struct imx_hdmi_softc *sc) -{ - int color_format; - uint8_t val; - - color_format = 0x01; - val = HDMI_TX_INVID0_INTERNAL_DE_GENERATOR_DISABLE | - ((color_format << HDMI_TX_INVID0_VIDEO_MAPPING_OFFSET) & - HDMI_TX_INVID0_VIDEO_MAPPING_MASK); - WR1(sc, HDMI_TX_INVID0, val); - - /* Enable TX stuffing: When DE is inactive, fix the output data to 0 */ - val = HDMI_TX_INSTUFFING_BDBDATA_STUFFING_ENABLE | - HDMI_TX_INSTUFFING_RCRDATA_STUFFING_ENABLE | - HDMI_TX_INSTUFFING_GYDATA_STUFFING_ENABLE; - WR1(sc, HDMI_TX_INSTUFFING, val); - WR1(sc, HDMI_TX_GYDATA0, 0x0); - WR1(sc, HDMI_TX_GYDATA1, 0x0); - WR1(sc, HDMI_TX_RCRDATA0, 0x0); - WR1(sc, HDMI_TX_RCRDATA1, 0x0); - WR1(sc, HDMI_TX_BCBDATA0, 0x0); - WR1(sc, HDMI_TX_BCBDATA1, 0x0); -} - -static int -imx_hdmi_set_mode(struct imx_hdmi_softc *sc) -{ - - imx_hdmi_disable_overflow_interrupts(sc); - imx_hdmi_av_composer(sc); - imx_hdmi_phy_init(sc); - imx_hdmi_enable_video_path(sc); - /* TODO: AVI infoframes */ - imx_hdmi_video_packetize(sc); - /* TODO: imx_hdmi_video_csc(sc); */ - imx_hdmi_video_sample(sc); - imx_hdmi_clear_overflow(sc); - - return (0); -} - -static int -hdmi_edid_read(struct imx_hdmi_softc *sc, uint8_t **edid, uint32_t *edid_len) +static device_t +imx_hdmi_get_i2c_dev(device_t dev) { - device_t i2c_dev; - int result; - uint8_t addr = 0; - struct iic_msg msg[] = { - { 0, IIC_M_WR, 1, &addr }, - { 0, IIC_M_RD, EDID_LENGTH, NULL} - }; - - *edid = NULL; - *edid_len = 0; - - if (sc->sc_i2c_xref == 0) - return (ENXIO); - - i2c_dev = OF_device_from_xref(sc->sc_i2c_xref); - if (!i2c_dev) { - device_printf(sc->sc_dev, - "no actual device for \"ddc-i2c-bus\" property (handle=%x)\n", sc->sc_i2c_xref); - return (ENXIO); - } - - device_printf(sc->sc_dev, "reading EDID from %s, addr %02x\n", - device_get_nameunit(i2c_dev), I2C_DDC_ADDR/2); - - msg[0].slave = I2C_DDC_ADDR; - msg[1].slave = I2C_DDC_ADDR; - msg[1].buf = sc->sc_edid; - - result = iicbus_request_bus(i2c_dev, sc->sc_dev, IIC_INTRWAIT); - - if (result) { - device_printf(sc->sc_dev, "failed to request i2c bus: %d\n", result); - return (result); - } - - result = iicbus_transfer(i2c_dev, msg, 2); - iicbus_release_bus(i2c_dev, sc->sc_dev); - - if (result) { - device_printf(sc->sc_dev, "i2c transfer failed: %d\n", result); - return (result); - } else { - *edid_len = sc->sc_edid_len; - *edid = sc->sc_edid; - } + struct imx_hdmi_softc *sc; - return (result); -} + sc = device_get_softc(dev); -static void -imx_hdmi_detect_cable(void *arg) -{ - struct imx_hdmi_softc *sc; + if (sc->i2c_xref == 0) + return (NULL); - sc = arg; - EVENTHANDLER_INVOKE(hdmi_event, sc->sc_dev, HDMI_EVENT_CONNECTED); - /* Finished with the interrupt hook */ - config_intrhook_disestablish(&sc->sc_mode_hook); + return (OF_device_from_xref(sc->i2c_xref)); } static int @@ -644,9 +84,9 @@ imx_hdmi_detach(device_t dev) sc = device_get_softc(dev); - if (sc->sc_mem_res != NULL) + if (sc->base.sc_mem_res != NULL) bus_release_resource(dev, SYS_RES_MEMORY, - sc->sc_mem_rid, sc->sc_mem_res); + sc->base.sc_mem_rid, sc->base.sc_mem_res); return (0); } @@ -660,55 +100,37 @@ imx_hdmi_attach(device_t dev) phandle_t node, i2c_xref; sc = device_get_softc(dev); - sc->sc_dev = dev; + sc->base.sc_dev = dev; + sc->base.sc_get_i2c_dev = imx_hdmi_get_i2c_dev; err = 0; /* Allocate memory resources. */ - sc->sc_mem_rid = 0; - sc->sc_mem_res = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &sc->sc_mem_rid, - RF_ACTIVE); - if (sc->sc_mem_res == NULL) { + sc->base.sc_mem_rid = 0; + sc->base.sc_mem_res = bus_alloc_resource_any(dev, SYS_RES_MEMORY, + &sc->base.sc_mem_rid, RF_ACTIVE); + if (sc->base.sc_mem_res == NULL) { device_printf(dev, "Cannot allocate memory resources\n"); err = ENXIO; goto out; } - sc->sc_mode_hook.ich_func = imx_hdmi_detect_cable; - sc->sc_mode_hook.ich_arg = sc; - - if (config_intrhook_establish(&sc->sc_mode_hook) != 0) { - err = ENOMEM; - goto out; - } - node = ofw_bus_get_node(dev); if (OF_getencprop(node, "ddc-i2c-bus", &i2c_xref, sizeof(i2c_xref)) == -1) - sc->sc_i2c_xref = 0; + sc->i2c_xref = 0; else - sc->sc_i2c_xref = i2c_xref; - - sc->sc_edid = malloc(EDID_LENGTH, M_DEVBUF, M_WAITOK | M_ZERO); - sc->sc_edid_len = EDID_LENGTH; + sc->i2c_xref = i2c_xref; imx_ccm_hdmi_enable(); - device_printf(sc->sc_dev, "HDMI controller %02x:%02x:%02x:%02x\n", - RD1(sc, HDMI_DESIGN_ID), RD1(sc, HDMI_REVISION_ID), - RD1(sc, HDMI_PRODUCT_ID0), RD1(sc, HDMI_PRODUCT_ID1)); - - gpr3 = imx_iomux_gpr_get(IOMUXC_GPR3); gpr3 &= ~(IOMUXC_GPR3_HDMI_MASK); gpr3 |= IOMUXC_GPR3_HDMI_IPU1_DI0; imx_iomux_gpr_set(IOMUXC_GPR3, gpr3); - WR1(sc, HDMI_PHY_POL0, HDMI_PHY_HPD); - WR1(sc, HDMI_IH_PHY_STAT0, HDMI_IH_PHY_STAT0_HPD); + return (dwc_hdmi_init(dev)); out: - - if (err != 0) - imx_hdmi_detach(dev); + imx_hdmi_detach(dev); return (err); } @@ -725,25 +147,6 @@ imx_hdmi_probe(device_t dev) return (BUS_PROBE_DEFAULT); } -static int -imx_hdmi_get_edid(device_t dev, uint8_t **edid, uint32_t *edid_len) -{ - - return (hdmi_edid_read(device_get_softc(dev), edid, edid_len)); -} - -static int -imx_hdmi_set_videomode(device_t dev, const struct videomode *mode) -{ - struct imx_hdmi_softc *sc; - - sc = device_get_softc(dev); - memcpy(&sc->sc_mode, mode, sizeof(*mode)); - imx_hdmi_set_mode(sc); - - return (0); -} - static device_method_t imx_hdmi_methods[] = { /* Device interface */ DEVMETHOD(device_probe, imx_hdmi_probe), @@ -751,8 +154,8 @@ static device_method_t imx_hdmi_methods[ DEVMETHOD(device_detach, imx_hdmi_detach), /* HDMI methods */ - DEVMETHOD(hdmi_get_edid, imx_hdmi_get_edid), - DEVMETHOD(hdmi_set_videomode, imx_hdmi_set_videomode), + DEVMETHOD(hdmi_get_edid, dwc_hdmi_get_edid), + DEVMETHOD(hdmi_set_videomode, dwc_hdmi_set_videomode), DEVMETHOD_END }; Modified: head/sys/conf/files.arm ============================================================================== --- head/sys/conf/files.arm Tue Dec 20 01:13:11 2016 (r310305) +++ head/sys/conf/files.arm Tue Dec 20 01:34:29 2016 (r310306) @@ -60,7 +60,6 @@ arm/arm/gdb_machdep.c optional gdb arm/arm/generic_timer.c optional generic_timer arm/arm/gic.c optional gic arm/arm/gic_fdt.c optional gic fdt -arm/arm/hdmi_if.m optional hdmi arm/arm/identcpu-v4.c optional !armv6 arm/arm/identcpu-v6.c optional armv6 arm/arm/in_cksum.c optional inet | inet6 @@ -120,6 +119,7 @@ dev/dwc/if_dwc.c optional dwc dev/dwc/if_dwc_if.m optional dwc dev/fb/fb.c optional sc dev/fdt/fdt_arm_platform.c optional platform fdt +dev/hdmi/hdmi_if.m optional hdmi dev/hwpmc/hwpmc_arm.c optional hwpmc dev/hwpmc/hwpmc_armv7.c optional hwpmc armv6 dev/iicbus/twsi/twsi.c optional twsi Added: head/sys/dev/hdmi/dwc_hdmi.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/dev/hdmi/dwc_hdmi.c Tue Dec 20 01:34:29 2016 (r310306) @@ -0,0 +1,691 @@ +/*- + * Copyright (c) 2015 Oleksandr Tymoshenko + * 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. + */ + +#include +__FBSDID("$FreeBSD$"); + +/* + * HDMI core module + */ + +#include +#include +#include +#include +#include +#include +#include + +#include + +#include +#include + +#include +#include + +#include +#include + +#include "hdmi_if.h" + +#define I2C_DDC_ADDR (0x50 << 1) +#define EDID_LENGTH 0x80 + +static void +dwc_hdmi_phy_wait_i2c_done(struct dwc_hdmi_softc *sc, int msec) +{ + uint8_t val; + + val = RD1(sc, HDMI_IH_I2CMPHY_STAT0) & + (HDMI_IH_I2CMPHY_STAT0_DONE | HDMI_IH_I2CMPHY_STAT0_ERROR); + while (val == 0) { + pause("HDMI_PHY", hz/100); + msec -= 10; + if (msec <= 0) + return; + val = RD1(sc, HDMI_IH_I2CMPHY_STAT0) & + (HDMI_IH_I2CMPHY_STAT0_DONE | HDMI_IH_I2CMPHY_STAT0_ERROR); + } +} + +static void +dwc_hdmi_phy_i2c_write(struct dwc_hdmi_softc *sc, unsigned short data, + unsigned char addr) +{ + + /* clear DONE and ERROR flags */ + WR1(sc, HDMI_IH_I2CMPHY_STAT0, + HDMI_IH_I2CMPHY_STAT0_DONE | HDMI_IH_I2CMPHY_STAT0_ERROR); + WR1(sc, HDMI_PHY_I2CM_ADDRESS_ADDR, addr); + WR1(sc, HDMI_PHY_I2CM_DATAO_1_ADDR, ((data >> 8) & 0xff)); + WR1(sc, HDMI_PHY_I2CM_DATAO_0_ADDR, ((data >> 0) & 0xff)); + WR1(sc, HDMI_PHY_I2CM_OPERATION_ADDR, HDMI_PHY_I2CM_OPERATION_ADDR_WRITE); + dwc_hdmi_phy_wait_i2c_done(sc, 1000); +} + +static void +dwc_hdmi_disable_overflow_interrupts(struct dwc_hdmi_softc *sc) +{ + WR1(sc, HDMI_IH_MUTE_FC_STAT2, HDMI_IH_MUTE_FC_STAT2_OVERFLOW_MASK); + WR1(sc, HDMI_FC_MASK2, + HDMI_FC_MASK2_LOW_PRI | HDMI_FC_MASK2_HIGH_PRI); +} + +static void +dwc_hdmi_av_composer(struct dwc_hdmi_softc *sc) +{ + uint8_t inv_val; + int is_dvi; + int hblank, vblank, hsync_len, hfp, vfp; + + /* Set up HDMI_FC_INVIDCONF */ + inv_val = ((sc->sc_mode.flags & VID_PVSYNC) ? + HDMI_FC_INVIDCONF_VSYNC_IN_POLARITY_ACTIVE_HIGH : + HDMI_FC_INVIDCONF_VSYNC_IN_POLARITY_ACTIVE_LOW); + + inv_val |= ((sc->sc_mode.flags & VID_PHSYNC) ? + HDMI_FC_INVIDCONF_HSYNC_IN_POLARITY_ACTIVE_HIGH : + HDMI_FC_INVIDCONF_HSYNC_IN_POLARITY_ACTIVE_LOW); + + inv_val |= HDMI_FC_INVIDCONF_DE_IN_POLARITY_ACTIVE_HIGH; + + inv_val |= ((sc->sc_mode.flags & VID_INTERLACE) ? + HDMI_FC_INVIDCONF_R_V_BLANK_IN_OSC_ACTIVE_HIGH : + HDMI_FC_INVIDCONF_R_V_BLANK_IN_OSC_ACTIVE_LOW); + + inv_val |= ((sc->sc_mode.flags & VID_INTERLACE) ? + HDMI_FC_INVIDCONF_IN_I_P_INTERLACED : + HDMI_FC_INVIDCONF_IN_I_P_PROGRESSIVE); + + /* TODO: implement HDMI part */ + is_dvi = 1; + inv_val |= (is_dvi ? + HDMI_FC_INVIDCONF_DVI_MODEZ_DVI_MODE : + HDMI_FC_INVIDCONF_DVI_MODEZ_HDMI_MODE); + + WR1(sc, HDMI_FC_INVIDCONF, inv_val); + + /* Set up horizontal active pixel region width */ + WR1(sc, HDMI_FC_INHACTV1, sc->sc_mode.hdisplay >> 8); + WR1(sc, HDMI_FC_INHACTV0, sc->sc_mode.hdisplay); + + /* Set up vertical blanking pixel region width */ + WR1(sc, HDMI_FC_INVACTV1, sc->sc_mode.vdisplay >> 8); + WR1(sc, HDMI_FC_INVACTV0, sc->sc_mode.vdisplay); + + /* Set up horizontal blanking pixel region width */ + hblank = sc->sc_mode.htotal - sc->sc_mode.hdisplay; + WR1(sc, HDMI_FC_INHBLANK1, hblank >> 8); + WR1(sc, HDMI_FC_INHBLANK0, hblank); + + /* Set up vertical blanking pixel region width */ + vblank = sc->sc_mode.vtotal - sc->sc_mode.vdisplay; + WR1(sc, HDMI_FC_INVBLANK, vblank); + + /* Set up HSYNC active edge delay width (in pixel clks) */ + hfp = sc->sc_mode.hsync_start - sc->sc_mode.hdisplay; + WR1(sc, HDMI_FC_HSYNCINDELAY1, hfp >> 8); + WR1(sc, HDMI_FC_HSYNCINDELAY0, hfp); + + /* Set up VSYNC active edge delay (in pixel clks) */ + vfp = sc->sc_mode.vsync_start - sc->sc_mode.vdisplay; + WR1(sc, HDMI_FC_VSYNCINDELAY, vfp); + + hsync_len = (sc->sc_mode.hsync_end - sc->sc_mode.hsync_start); + /* Set up HSYNC active pulse width (in pixel clks) */ + WR1(sc, HDMI_FC_HSYNCINWIDTH1, hsync_len >> 8); + WR1(sc, HDMI_FC_HSYNCINWIDTH0, hsync_len); + + /* Set up VSYNC active edge delay (in pixel clks) */ + WR1(sc, HDMI_FC_VSYNCINWIDTH, (sc->sc_mode.vsync_end - sc->sc_mode.vsync_start)); +} + +static void +dwc_hdmi_phy_enable_power(struct dwc_hdmi_softc *sc, uint8_t enable) +{ + uint8_t reg; + + reg = RD1(sc, HDMI_PHY_CONF0); + reg &= ~HDMI_PHY_CONF0_PDZ_MASK; + reg |= (enable << HDMI_PHY_CONF0_PDZ_OFFSET); + WR1(sc, HDMI_PHY_CONF0, reg); +} + +static void +dwc_hdmi_phy_enable_tmds(struct dwc_hdmi_softc *sc, uint8_t enable) +{ + uint8_t reg; + + reg = RD1(sc, HDMI_PHY_CONF0); + reg &= ~HDMI_PHY_CONF0_ENTMDS_MASK; + reg |= (enable << HDMI_PHY_CONF0_ENTMDS_OFFSET); + WR1(sc, HDMI_PHY_CONF0, reg); +} + +static void +dwc_hdmi_phy_gen2_pddq(struct dwc_hdmi_softc *sc, uint8_t enable) +{ + uint8_t reg; + + reg = RD1(sc, HDMI_PHY_CONF0); + reg &= ~HDMI_PHY_CONF0_GEN2_PDDQ_MASK; + reg |= (enable << HDMI_PHY_CONF0_GEN2_PDDQ_OFFSET); + WR1(sc, HDMI_PHY_CONF0, reg); +} + +static void +dwc_hdmi_phy_gen2_txpwron(struct dwc_hdmi_softc *sc, uint8_t enable) +{ + uint8_t reg; + + reg = RD1(sc, HDMI_PHY_CONF0); + reg &= ~HDMI_PHY_CONF0_GEN2_TXPWRON_MASK; + reg |= (enable << HDMI_PHY_CONF0_GEN2_TXPWRON_OFFSET); + WR1(sc, HDMI_PHY_CONF0, reg); +} + +static void +dwc_hdmi_phy_sel_data_en_pol(struct dwc_hdmi_softc *sc, uint8_t enable) +{ + uint8_t reg; + + reg = RD1(sc, HDMI_PHY_CONF0); + reg &= ~HDMI_PHY_CONF0_SELDATAENPOL_MASK; + reg |= (enable << HDMI_PHY_CONF0_SELDATAENPOL_OFFSET); + WR1(sc, HDMI_PHY_CONF0, reg); +} + +static void +dwc_hdmi_phy_sel_interface_control(struct dwc_hdmi_softc *sc, uint8_t enable) +{ + uint8_t reg; + + reg = RD1(sc, HDMI_PHY_CONF0); + reg &= ~HDMI_PHY_CONF0_SELDIPIF_MASK; + reg |= (enable << HDMI_PHY_CONF0_SELDIPIF_OFFSET); + WR1(sc, HDMI_PHY_CONF0, reg); +} *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@freebsd.org Tue Dec 20 01:37:02 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 098BFC88823; Tue, 20 Dec 2016 01:37:02 +0000 (UTC) (envelope-from jmcneill@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C8944F47; Tue, 20 Dec 2016 01:37:01 +0000 (UTC) (envelope-from jmcneill@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBK1b0Rq090097; Tue, 20 Dec 2016 01:37:00 GMT (envelope-from jmcneill@FreeBSD.org) Received: (from jmcneill@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBK1b0BX090096; Tue, 20 Dec 2016 01:37:00 GMT (envelope-from jmcneill@FreeBSD.org) Message-Id: <201612200137.uBK1b0BX090096@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jmcneill set sender to jmcneill@FreeBSD.org using -f From: Jared McNeill Date: Tue, 20 Dec 2016 01:37:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310307 - head/sys/mips/ingenic X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Dec 2016 01:37:02 -0000 Author: jmcneill Date: Tue Dec 20 01:37:00 2016 New Revision: 310307 URL: https://svnweb.freebsd.org/changeset/base/310307 Log: Choose the closes matching divider instead of one that results in a frequency >= target. Fix inverted rounding logic for CLK_SET_ROUND_UP/DOWN. Reviewed by: kan Differential Revision: https://reviews.freebsd.org/D8784 Modified: head/sys/mips/ingenic/jz4780_clk_gen.c Modified: head/sys/mips/ingenic/jz4780_clk_gen.c ============================================================================== --- head/sys/mips/ingenic/jz4780_clk_gen.c Tue Dec 20 01:34:29 2016 (r310306) +++ head/sys/mips/ingenic/jz4780_clk_gen.c Tue Dec 20 01:37:00 2016 (r310307) @@ -153,23 +153,29 @@ jz4780_clk_gen_set_freq(struct clknode * { struct jz4780_clk_gen_sc *sc; uint64_t _fout; - uint32_t divider, div_reg, div_msk, reg; + uint32_t divider, div_reg, div_msk, reg, div_l, div_h; int rv; sc = clknode_get_softc(clk); - divider = fin / *fout; + /* Find closest divider */ + div_l = howmany(fin, *fout); + div_h = fin / *fout; + divider = abs((int64_t)*fout - (fin / div_l)) < + abs((int64_t)*fout - (fin / div_h)) ? div_l : div_h; /* Adjust for divider multiplier */ div_reg = divider >> sc->clk_descr->clk_div.div_lg; divider = div_reg << sc->clk_descr->clk_div.div_lg; + if (divider == 0) + divider = 1; _fout = fin / divider; /* Rounding */ - if ((flags & CLK_SET_ROUND_UP) && (*fout < _fout)) + if ((flags & CLK_SET_ROUND_UP) && (*fout > _fout)) div_reg--; - else if ((flags & CLK_SET_ROUND_DOWN) && (*fout > _fout)) + else if ((flags & CLK_SET_ROUND_DOWN) && (*fout < _fout)) div_reg++; if (div_reg == 0) div_reg = 1; From owner-svn-src-all@freebsd.org Tue Dec 20 01:51:11 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 256FBC89030; Tue, 20 Dec 2016 01:51:11 +0000 (UTC) (envelope-from jmcneill@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E1F8018DA; Tue, 20 Dec 2016 01:51:10 +0000 (UTC) (envelope-from jmcneill@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBK1pARO098120; Tue, 20 Dec 2016 01:51:10 GMT (envelope-from jmcneill@FreeBSD.org) Received: (from jmcneill@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBK1p9oR098115; Tue, 20 Dec 2016 01:51:09 GMT (envelope-from jmcneill@FreeBSD.org) Message-Id: <201612200151.uBK1p9oR098115@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jmcneill set sender to jmcneill@FreeBSD.org using -f From: Jared McNeill Date: Tue, 20 Dec 2016 01:51:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310308 - in head/sys/mips: conf ingenic X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Dec 2016 01:51:11 -0000 Author: jmcneill Date: Tue Dec 20 01:51:09 2016 New Revision: 310308 URL: https://svnweb.freebsd.org/changeset/base/310308 Log: Add support for Ingenic JZ4780 LCD controller and enable framebuffer console support. Reviewed by: kan Differential Revision: https://reviews.freebsd.org/D8827 Added: head/sys/mips/ingenic/jz4780_lcd.c (contents, props changed) head/sys/mips/ingenic/jz4780_lcd.h (contents, props changed) Modified: head/sys/mips/conf/JZ4780 head/sys/mips/ingenic/files.jz4780 Modified: head/sys/mips/conf/JZ4780 ============================================================================== --- head/sys/mips/conf/JZ4780 Tue Dec 20 01:37:00 2016 (r310307) +++ head/sys/mips/conf/JZ4780 Tue Dec 20 01:51:09 2016 (r310308) @@ -86,6 +86,16 @@ device mmcsd device dme +device iic +device iicbus + +# Framebuffer console support +device vt +device kbdmux +device hdmi +device videomode +device pty + # USB support options USB_DEBUG # enable debug msgs options USB_HOST_ALIGN=128 # L2 cache line size @@ -95,6 +105,7 @@ device dwcotg # DesignWare HS OTG cont device usb # USB Bus (required) #device udbp # USB Double Bulk Pipe devices device uhid # "Human Interface Devices" +device ukbd # Allow keyboard like HIDs to control console #device ulpt # Printer device umass # Disks/Mass storage - Requires scbus and da device ums # Mouse Modified: head/sys/mips/ingenic/files.jz4780 ============================================================================== --- head/sys/mips/ingenic/files.jz4780 Tue Dec 20 01:37:00 2016 (r310307) +++ head/sys/mips/ingenic/files.jz4780 Tue Dec 20 01:51:09 2016 (r310308) @@ -6,6 +6,9 @@ mips/ingenic/jz4780_mmc.c optional mmc mips/ingenic/jz4780_ohci.c optional ohci mips/ingenic/jz4780_smb.c optional iicbus mips/ingenic/jz4780_uart.c optional uart +mips/ingenic/jz4780_lcd.c optional vt +dev/hdmi/dwc_hdmi.c optional hdmi iicbus +dev/hdmi/dwc_hdmi_fdt.c optional hdmi iicbus mips/ingenic/jz4780_clock.c standard mips/ingenic/jz4780_clk_gen.c standard @@ -25,3 +28,6 @@ mips/ingenic/jz4780_mpboot.S optional sm # Custom interface between pinctrl and gpio mips/ingenic/jz4780_gpio_if.m standard + +# HDMI interface +dev/hdmi/hdmi_if.m standard Added: head/sys/mips/ingenic/jz4780_lcd.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/mips/ingenic/jz4780_lcd.c Tue Dec 20 01:51:09 2016 (r310308) @@ -0,0 +1,572 @@ +/*- + * Copyright (c) 2016 Jared McNeill + * 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 ``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 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$ + */ + +/* + * Ingenic JZ4780 LCD Controller + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +#include +#include + +#include +#include + +#include + +#include + +#include "fb_if.h" +#include "hdmi_if.h" + +#define FB_DEFAULT_W 800 +#define FB_DEFAULT_H 600 +#define FB_DEFAULT_REF 60 +#define FB_BPP 32 +#define FB_ALIGN (16 * 4) +#define FB_MAX_BW (1920 * 1080 * 60) +#define FB_MAX_W 2048 +#define FB_MAX_H 2048 +#define FB_DIVIDE(x, y) (((x) + ((y) / 2)) / (y)) + +#define PCFG_MAGIC 0xc7ff2100 + +#define DOT_CLOCK_TO_HZ(c) ((c) * 1000) + +#ifndef VM_MEMATTR_WRITE_COMBINING +#define VM_MEMATTR_WRITE_COMBINING VM_MEMATTR_UNCACHEABLE +#endif + +struct jzlcd_softc { + device_t dev; + device_t fbdev; + struct resource *res[1]; + + /* Clocks */ + clk_t clk; + clk_t clk_pix; + + /* Framebuffer */ + struct fb_info info; + size_t fbsize; + bus_addr_t paddr; + vm_offset_t vaddr; + + /* HDMI */ + eventhandler_tag hdmi_evh; + + /* Frame descriptor DMA */ + bus_dma_tag_t fdesc_tag; + bus_dmamap_t fdesc_map; + bus_addr_t fdesc_paddr; + struct lcd_frame_descriptor *fdesc; +}; + +static struct resource_spec jzlcd_spec[] = { + { SYS_RES_MEMORY, 0, RF_ACTIVE }, + { -1, 0 } +}; + +#define LCD_READ(sc, reg) bus_read_4((sc)->res[0], (reg)) +#define LCD_WRITE(sc, reg, val) bus_write_4((sc)->res[0], (reg), (val)) + +static int +jzlcd_allocfb(struct jzlcd_softc *sc) +{ + sc->vaddr = kmem_alloc_contig(kernel_arena, sc->fbsize, + M_NOWAIT | M_ZERO, 0, ~0, FB_ALIGN, 0, VM_MEMATTR_WRITE_COMBINING); + if (sc->vaddr == 0) { + device_printf(sc->dev, "failed to allocate FB memory\n"); + return (ENOMEM); + } + sc->paddr = pmap_kextract(sc->vaddr); + + return (0); +} + +static void +jzlcd_freefb(struct jzlcd_softc *sc) +{ + kmem_free(kernel_arena, sc->vaddr, sc->fbsize); +} + +static void +jzlcd_start(struct jzlcd_softc *sc) +{ + uint32_t ctrl; + + /* Clear status registers */ + LCD_WRITE(sc, LCDSTATE, 0); + LCD_WRITE(sc, LCDOSDS, 0); + /* Enable the controller */ + ctrl = LCD_READ(sc, LCDCTRL); + ctrl |= LCDCTRL_ENA; + ctrl &= ~LCDCTRL_DIS; + LCD_WRITE(sc, LCDCTRL, ctrl); +} + +static void +jzlcd_stop(struct jzlcd_softc *sc) +{ + uint32_t ctrl; + + ctrl = LCD_READ(sc, LCDCTRL); + if ((ctrl & LCDCTRL_ENA) != 0) { + /* Disable the controller and wait for it to stop */ + ctrl |= LCDCTRL_DIS; + LCD_WRITE(sc, LCDCTRL, ctrl); + while ((LCD_READ(sc, LCDSTATE) & LCDSTATE_LDD) == 0) + DELAY(100); + } + /* Clear all status except for disable */ + LCD_WRITE(sc, LCDSTATE, LCD_READ(sc, LCDSTATE) & ~LCDSTATE_LDD); +} + +static void +jzlcd_setup_descriptor(struct jzlcd_softc *sc, const struct videomode *mode, + u_int desno) +{ + struct lcd_frame_descriptor *fdesc; + int line_sz; + + /* Frame size is specified in # words */ + line_sz = (mode->hdisplay * FB_BPP) >> 3; + line_sz = ((line_sz + 3) & ~3) / 4; + + fdesc = sc->fdesc + desno; + + if (desno == 0) + fdesc->next = sc->fdesc_paddr + + sizeof(struct lcd_frame_descriptor); + else + fdesc->next = sc->fdesc_paddr; + fdesc->physaddr = sc->paddr; + fdesc->id = desno; + fdesc->cmd = LCDCMD_FRM_EN | (line_sz * mode->vdisplay); + fdesc->offs = 0; + fdesc->pw = 0; + fdesc->cnum_pos = LCDPOS_BPP01_18_24 | + LCDPOS_PREMULTI01 | + (desno == 0 ? LCDPOS_COEF_BLE01_1 : LCDPOS_COEF_SLE01); + fdesc->dessize = LCDDESSIZE_ALPHA | + ((mode->vdisplay - 1) << LCDDESSIZE_HEIGHT_SHIFT) | + ((mode->hdisplay - 1) << LCDDESSIZE_WIDTH_SHIFT); +} + +static int +jzlcd_set_videomode(struct jzlcd_softc *sc, const struct videomode *mode) +{ + u_int hbp, hfp, hsw, vbp, vfp, vsw; + u_int hds, hde, ht, vds, vde, vt; + uint32_t ctrl; + int error; + + hbp = mode->htotal - mode->hsync_end; + hfp = mode->hsync_start - mode->hdisplay; + hsw = mode->hsync_end - mode->hsync_start; + vbp = mode->vtotal - mode->vsync_end; + vfp = mode->vsync_start - mode->vdisplay; + vsw = mode->vsync_end - mode->vsync_start; + + hds = hsw + hbp; + hde = hds + mode->hdisplay; + ht = hde + hfp; + + vds = vsw + vbp; + vde = vds + mode->vdisplay; + vt = vde + vfp; + + /* Setup timings */ + LCD_WRITE(sc, LCDVAT, + (ht << LCDVAT_HT_SHIFT) | (vt << LCDVAT_VT_SHIFT)); + LCD_WRITE(sc, LCDDAH, + (hds << LCDDAH_HDS_SHIFT) | (hde << LCDDAH_HDE_SHIFT)); + LCD_WRITE(sc, LCDDAV, + (vds << LCDDAV_VDS_SHIFT) | (vde << LCDDAV_VDE_SHIFT)); + LCD_WRITE(sc, LCDHSYNC, hsw); + LCD_WRITE(sc, LCDVSYNC, vsw); + + /* Set configuration */ + LCD_WRITE(sc, LCDCFG, LCDCFG_NEWDES | LCDCFG_RECOVER | LCDCFG_24 | + LCDCFG_PSM | LCDCFG_CLSM | LCDCFG_SPLM | LCDCFG_REVM | LCDCFG_PCP); + ctrl = LCD_READ(sc, LCDCTRL); + ctrl &= ~LCDCTRL_BST; + ctrl |= LCDCTRL_BST_64 | LCDCTRL_OFUM; + LCD_WRITE(sc, LCDCTRL, ctrl); + LCD_WRITE(sc, LCDPCFG, PCFG_MAGIC); + LCD_WRITE(sc, LCDRGBC, LCDRGBC_RGBFMT); + + /* Update registers */ + LCD_WRITE(sc, LCDSTATE, 0); + + /* Setup frame descriptors */ + jzlcd_setup_descriptor(sc, mode, 0); + jzlcd_setup_descriptor(sc, mode, 1); + bus_dmamap_sync(sc->fdesc_tag, sc->fdesc_map, BUS_DMASYNC_PREWRITE); + + /* Setup DMA channels */ + LCD_WRITE(sc, LCDDA0, sc->fdesc_paddr + + sizeof(struct lcd_frame_descriptor)); + LCD_WRITE(sc, LCDDA1, sc->fdesc_paddr); + + /* Set display clock */ + error = clk_set_freq(sc->clk_pix, DOT_CLOCK_TO_HZ(mode->dot_clock), 0); + if (error != 0) { + device_printf(sc->dev, "failed to set pixel clock to %u Hz\n", + DOT_CLOCK_TO_HZ(mode->dot_clock)); + return (error); + } + + return (0); +} + +static int +jzlcd_configure(struct jzlcd_softc *sc, const struct videomode *mode) +{ + size_t fbsize; + int error; + + fbsize = round_page(mode->hdisplay * mode->vdisplay * (FB_BPP / NBBY)); + + /* Detach the old FB device */ + if (sc->fbdev != NULL) { + device_delete_child(sc->dev, sc->fbdev); + sc->fbdev = NULL; + } + + /* If the FB size has changed, free the old FB memory */ + if (sc->fbsize > 0 && sc->fbsize != fbsize) { + jzlcd_freefb(sc); + sc->vaddr = 0; + } + + /* Allocate the FB if necessary */ + sc->fbsize = fbsize; + if (sc->vaddr == 0) { + error = jzlcd_allocfb(sc); + if (error != 0) { + device_printf(sc->dev, "failed to allocate FB memory\n"); + return (ENXIO); + } + } + + /* Setup video mode */ + error = jzlcd_set_videomode(sc, mode); + if (error != 0) + return (error); + + /* Attach framebuffer device */ + sc->info.fb_name = device_get_nameunit(sc->dev); + sc->info.fb_vbase = (intptr_t)sc->vaddr; + sc->info.fb_pbase = sc->paddr; + sc->info.fb_size = sc->fbsize; + sc->info.fb_bpp = sc->info.fb_depth = FB_BPP; + sc->info.fb_stride = mode->hdisplay * (FB_BPP / NBBY); + sc->info.fb_width = mode->hdisplay; + sc->info.fb_height = mode->vdisplay; + + sc->fbdev = device_add_child(sc->dev, "fbd", device_get_unit(sc->dev)); + if (sc->fbdev == NULL) { + device_printf(sc->dev, "failed to add fbd child\n"); + return (ENOENT); + } + + error = device_probe_and_attach(sc->fbdev); + if (error != 0) { + device_printf(sc->dev, "failed to attach fbd device\n"); + return (error); + } + + return (0); +} + +static int +jzlcd_get_bandwidth(const struct videomode *mode) +{ + int refresh; + + refresh = FB_DIVIDE(FB_DIVIDE(DOT_CLOCK_TO_HZ(mode->dot_clock), + mode->htotal), mode->vtotal); + + return mode->hdisplay * mode->vdisplay * refresh; +} + +static int +jzlcd_mode_supported(const struct videomode *mode) +{ + /* Width and height must be less than 2048 */ + if (mode->hdisplay > FB_MAX_W || mode->vdisplay > FB_MAX_H) + return (0); + + /* Bandwidth check */ + if (jzlcd_get_bandwidth(mode) > FB_MAX_BW) + return (0); + + /* Interlace modes not yet supported by the driver */ + if ((mode->flags & VID_INTERLACE) != 0) + return (0); + + return (1); +} + +static const struct videomode * +jzlcd_find_mode(struct edid_info *ei) +{ + const struct videomode *best; + int n, bw, best_bw; + + /* If the preferred mode is OK, just use it */ + if (jzlcd_mode_supported(ei->edid_preferred_mode) != 0) + return ei->edid_preferred_mode; + + /* Pick the mode with the highest bandwidth requirements */ + best = NULL; + best_bw = 0; + for (n = 0; n < ei->edid_nmodes; n++) { + if (jzlcd_mode_supported(&ei->edid_modes[n]) == 0) + continue; + bw = jzlcd_get_bandwidth(&ei->edid_modes[n]); + if (bw > FB_MAX_BW) + continue; + if (best == NULL || bw > best_bw) { + best = &ei->edid_modes[n]; + best_bw = bw; + } + } + + return best; +} + +static void +jzlcd_hdmi_event(void *arg, device_t hdmi_dev) +{ + const struct videomode *mode; + struct videomode hdmi_mode; + struct jzlcd_softc *sc; + struct edid_info ei; + uint8_t *edid; + uint32_t edid_len; + int error; + + sc = arg; + edid = NULL; + edid_len = 0; + mode = NULL; + + error = HDMI_GET_EDID(hdmi_dev, &edid, &edid_len); + if (error != 0) { + device_printf(sc->dev, "failed to get EDID: %d\n", error); + } else { + error = edid_parse(edid, &ei); + if (error != 0) { + device_printf(sc->dev, "failed to parse EDID: %d\n", + error); + } else { + if (bootverbose) + edid_print(&ei); + + mode = jzlcd_find_mode(&ei); + } + } + + /* If a suitable mode could not be found, try the default */ + if (mode == NULL) + mode = pick_mode_by_ref(FB_DEFAULT_W, FB_DEFAULT_H, + FB_DEFAULT_REF); + + if (mode == NULL) { + device_printf(sc->dev, "failed to find usable video mode\n"); + return; + } + + if (bootverbose) + device_printf(sc->dev, "using %dx%d\n", + mode->hdisplay, mode->vdisplay); + + /* Stop the controller */ + jzlcd_stop(sc); + + /* Configure LCD controller */ + error = jzlcd_configure(sc, mode); + if (error != 0) { + device_printf(sc->dev, "failed to configure FB: %d\n", error); + return; + } + + /* Enable HDMI TX */ + hdmi_mode = *mode; + HDMI_SET_VIDEOMODE(hdmi_dev, &hdmi_mode); + + /* Start the controller! */ + jzlcd_start(sc); +} + +static void +jzlcd_dmamap_cb(void *arg, bus_dma_segment_t *segs, int nseg, int error) +{ + if (error != 0) + return; + *(bus_addr_t *)arg = segs[0].ds_addr; +} + +static int +jzlcd_probe(device_t dev) +{ + if (!ofw_bus_status_okay(dev)) + return (ENXIO); + + if (!ofw_bus_is_compatible(dev, "ingenic,jz4780-lcd")) + return (ENXIO); + + device_set_desc(dev, "Ingenic JZ4780 LCD Controller"); + return (BUS_PROBE_DEFAULT); +} + +static int +jzlcd_attach(device_t dev) +{ + struct jzlcd_softc *sc; + int error; + + sc = device_get_softc(dev); + + sc->dev = dev; + + if (bus_alloc_resources(dev, jzlcd_spec, sc->res)) { + device_printf(dev, "cannot allocate resources for device\n"); + goto failed; + } + + if (clk_get_by_ofw_name(dev, 0, "lcd_clk", &sc->clk) != 0 || + clk_get_by_ofw_name(dev, 0, "lcd_pixclk", &sc->clk_pix) != 0) { + device_printf(dev, "cannot get clocks\n"); + goto failed; + } + if (clk_enable(sc->clk) != 0 || clk_enable(sc->clk_pix) != 0) { + device_printf(dev, "cannot enable clocks\n"); + goto failed; + } + + error = bus_dma_tag_create( + bus_get_dma_tag(dev), + sizeof(struct lcd_frame_descriptor), 0, + BUS_SPACE_MAXADDR_32BIT, + BUS_SPACE_MAXADDR, + NULL, NULL, + sizeof(struct lcd_frame_descriptor) * 2, 1, + sizeof(struct lcd_frame_descriptor) * 2, + 0, + NULL, NULL, + &sc->fdesc_tag); + if (error != 0) { + device_printf(dev, "cannot create bus dma tag\n"); + goto failed; + } + + error = bus_dmamem_alloc(sc->fdesc_tag, (void **)&sc->fdesc, + BUS_DMA_NOCACHE | BUS_DMA_WAITOK | BUS_DMA_ZERO, &sc->fdesc_map); + if (error != 0) { + device_printf(dev, "cannot allocate dma descriptor\n"); + goto dmaalloc_failed; + } + + error = bus_dmamap_load(sc->fdesc_tag, sc->fdesc_map, sc->fdesc, + sizeof(struct lcd_frame_descriptor) * 2, jzlcd_dmamap_cb, + &sc->fdesc_paddr, 0); + if (error != 0) { + device_printf(dev, "cannot load dma map\n"); + goto dmaload_failed; + } + + sc->hdmi_evh = EVENTHANDLER_REGISTER(hdmi_event, + jzlcd_hdmi_event, sc, 0); + + return (0); + +dmaload_failed: + bus_dmamem_free(sc->fdesc_tag, sc->fdesc, sc->fdesc_map); +dmaalloc_failed: + bus_dma_tag_destroy(sc->fdesc_tag); +failed: + if (sc->clk_pix != NULL) + clk_release(sc->clk); + if (sc->clk != NULL) + clk_release(sc->clk); + if (sc->res != NULL) + bus_release_resources(dev, jzlcd_spec, sc->res); + + return (ENXIO); +} + +static struct fb_info * +jzlcd_fb_getinfo(device_t dev) +{ + struct jzlcd_softc *sc; + + sc = device_get_softc(dev); + + return (&sc->info); +} + +static device_method_t jzlcd_methods[] = { + /* Device interface */ + DEVMETHOD(device_probe, jzlcd_probe), + DEVMETHOD(device_attach, jzlcd_attach), + + /* FB interface */ + DEVMETHOD(fb_getinfo, jzlcd_fb_getinfo), + + DEVMETHOD_END +}; + +static driver_t jzlcd_driver = { + "fb", + jzlcd_methods, + sizeof(struct jzlcd_softc), +}; + +static devclass_t jzlcd_devclass; + +DRIVER_MODULE(fb, simplebus, jzlcd_driver, jzlcd_devclass, 0, 0); Added: head/sys/mips/ingenic/jz4780_lcd.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/mips/ingenic/jz4780_lcd.h Tue Dec 20 01:51:09 2016 (r310308) @@ -0,0 +1,204 @@ +/*- + * Copyright (c) 2016 Jared McNeill + * 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 ``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 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$ + */ + +/* + * Ingenic JZ4780 LCD Controller + */ + +#ifndef __JZ4780_LCD_H__ +#define __JZ4780_LCD_H__ + +#define LCDCFG 0x0000 +#define LCDCFG_LCDPIN (1 << 31) +#define LCDCFG_TVEPEH (1 << 30) +#define LCDCFG_NEWDES (1 << 28) +#define LCDCFG_PALBP (1 << 27) +#define LCDCFG_TVEN (1 << 26) +#define LCDCFG_RECOVER (1 << 25) +#define LCDCFG_PSM (1 << 23) +#define LCDCFG_CLSM (1 << 22) +#define LCDCFG_SPLM (1 << 21) +#define LCDCFG_REVM (1 << 20) +#define LCDCFG_HSYNM (1 << 19) +#define LCDCFG_VSYNM (1 << 18) +#define LCDCFG_INVDAT (1 << 17) +#define LCDCFG_SYNDIR (1 << 16) +#define LCDCFG_PSP (1 << 15) +#define LCDCFG_CLSP (1 << 14) +#define LCDCFG_SPLP (1 << 13) +#define LCDCFG_REVP (1 << 12) +#define LCDCFG_HSP (1 << 11) +#define LCDCFG_PCP (1 << 10) +#define LCDCFG_DEP (1 << 9) +#define LCDCFG_VSP (1 << 8) +#define LCDCFG_18_16 (1 << 7) +#define LCDCFG_24 (1 << 6) +#define LCDCFG_MODE (0xf << 0) +#define LCDCTRL 0x0030 +#define LCDCTRL_PINMD (1 << 31) +#define LCDCTRL_BST (0x7 << 28) +#define LCDCTRL_BST_4 (0 << 28) +#define LCDCTRL_BST_8 (1 << 28) +#define LCDCTRL_BST_16 (2 << 28) +#define LCDCTRL_BST_32 (3 << 28) +#define LCDCTRL_BST_64 (4 << 28) +#define LCDCTRL_OUTRGB (1 << 27) +#define LCDCTRL_OFUP (1 << 26) +#define LCDCTRL_DACTE (1 << 14) +#define LCDCTRL_EOFM (1 << 13) +#define LCDCTRL_SOFM (1 << 12) +#define LCDCTRL_OFUM (1 << 11) +#define LCDCTRL_IFUM0 (1 << 10) +#define LCDCTRL_IFUM1 (1 << 9) +#define LCDCTRL_LDDM (1 << 8) +#define LCDCTRL_QDM (1 << 7) +#define LCDCTRL_BEDN (1 << 6) +#define LCDCTRL_PEDN (1 << 5) +#define LCDCTRL_DIS (1 << 4) +#define LCDCTRL_ENA (1 << 3) +#define LCDCTRL_BPP0 (0x7 << 0) +#define LCDCTRL_BPP0_1 (0 << 0) +#define LCDCTRL_BPP0_2 (1 << 0) +#define LCDCTRL_BPP0_4 (2 << 0) +#define LCDCTRL_BPP0_8 (3 << 0) +#define LCDCTRL_BPP0_15_16 (4 << 0) +#define LCDCTRL_BPP0_18_24 (5 << 0) +#define LCDCTRL_BPP0_24_COMP (6 << 0) +#define LCDCTRL_BPP0_30 (7 << 0) +#define LCDCTR +#define LCDSTATE 0x0034 +#define LCDSTATE_QD (1 << 7) +#define LCDSTATE_EOF (1 << 5) +#define LCDSTATE_SOF (1 << 4) +#define LCDSTATE_OUT (1 << 3) +#define LCDSTATE_IFU0 (1 << 2) +#define LCDSTATE_IFU1 (1 << 1) +#define LCDSTATE_LDD (1 << 0) +#define LCDOSDC 0x0100 +#define LCDOSDCTRL 0x0104 +#define LCDOSDS 0x0108 +#define LCDBGC0 0x010c +#define LCDBGC1 0x02c4 +#define LCDKEY0 0x0110 +#define LCDKEY1 0x0114 +#define LCDALPHA 0x0118 +#define LCDIPUR 0x011c +#define LCDRGBC 0x0090 +#define LCDRGBC_RGBDM (1 << 15) +#define LCDRGBC_DMM (1 << 14) +#define LCDRGBC_422 (1 << 8) +#define LCDRGBC_RGBFMT (1 << 7) +#define LCDRGBC_ODDRGB (0x7 << 4) +#define LCDRGBC_EVENRGB (0x7 << 0) +#define LCDVAT 0x000c +#define LCDVAT_HT_SHIFT 16 +#define LCDVAT_VT_SHIFT 0 +#define LCDDAH 0x0010 +#define LCDDAH_HDS_SHIFT 16 +#define LCDDAH_HDE_SHIFT 0 +#define LCDDAV 0x0014 +#define LCDDAV_VDS_SHIFT 16 +#define LCDDAV_VDE_SHIFT 0 +#define LCDXYP0 0x0120 +#define LCDXYP1 0x0124 +#define LCDSIZE0 0x0128 +#define LCDSIZE1 0x012c +#define LCDVSYNC 0x0004 +#define LCDHSYNC 0x0008 +#define LCDPS 0x0018 +#define LCDCLS 0x001c +#define LCDSPL 0x0020 +#define LCDREV 0x0024 +#define LCDIID 0x0038 +#define LCDDA0 0x0040 +#define LCDSA0 0x0044 +#define LCDFID0 0x0048 +#define LCDCMD0 0x004c +#define LCDCMD_SOFINT (1 << 31) +#define LCDCMD_EOFINT (1 << 30) +#define LCDCMD_CMD (1 << 29) +#define LCDCMD_COMPE (1 << 27) +#define LCDCMD_FRM_EN (1 << 26) +#define LCDCMD_FIELD_SEL (1 << 25) +#define LCDCMD_16X16BLOCK (1 << 24) +#define LCDCMD_LEN (0xffffff << 0) +#define LCDOFFS0 0x0060 +#define LCDPW0 0x0064 +#define LCDCNUM0 0x0068 +#define LCDPOS0 LCDCNUM0 +#define LCDPOS_ALPHAMD1 (1 << 31) +#define LCDPOS_RGB01 (1 << 30) +#define LCDPOS_BPP01 (0x7 << 27) +#define LCDPOS_BPP01_15_16 (4 << 27) +#define LCDPOS_BPP01_18_24 (5 << 27) +#define LCDPOS_BPP01_24_COMP (6 << 27) +#define LCDPOS_BPP01_30 (7 << 27) +#define LCDPOS_PREMULTI01 (1 << 26) +#define LCDPOS_COEF_SLE01 (0x3 << 24) +#define LCDPOS_COEF_BLE01_1 (1 << 24) +#define LCDPOS_YPOS01 (0xfff << 12) +#define LCDPOS_XPOS01 (0xfff << 0) +#define LCDDESSIZE0 0x006c +#define LCDDESSIZE_ALPHA (0xff << 24) +#define LCDDESSIZE_HEIGHT (0xfff << 12) +#define LCDDESSIZE_HEIGHT_SHIFT 12 +#define LCDDESSIZE_WIDTH (0xfff << 0) +#define LCDDESSIZE_WIDTH_SHIFT 0 +#define LCDDA1 0x0050 +#define LCDSA1 0x0054 +#define LCDFID1 0x0058 +#define LCDCMD1 0x005c +#define LCDOFFS1 0x0070 +#define LCDPW1 0x0074 +#define LCDCNUM1 0x0078 +#define LCDPOS1 LCDCNUM1 +#define LCDDESSIZE1 0x007c +#define LCDPCFG 0x02c0 +#define LCDDUALCTRL 0x02c8 +#define LCDENH_CFG 0x0400 +#define LCDENH_CSCCFG 0x0404 +#define LCDENH_LUMACFG 0x0408 +#define LCDENH_CHROCFG0 0x040c +#define LCDENH_CHROCFG1 0x0410 +#define LCDENH_DITHERCFG 0x0414 +#define LCDENH_STATUS 0x0418 +#define LCDENH_GAMMA 0x0800 /* base */ +#define LCDENH_VEE 0x1000 /* base */ + +struct lcd_frame_descriptor { + uint32_t next; + uint32_t physaddr; + uint32_t id; + uint32_t cmd; + uint32_t offs; + uint32_t pw; + uint32_t cnum_pos; + uint32_t dessize; +} __packed; + +#endif /* !__JZ4780_LCD_H__ */ From owner-svn-src-all@freebsd.org Tue Dec 20 02:14:48 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B8C91C899A1; Tue, 20 Dec 2016 02:14:48 +0000 (UTC) (envelope-from sepherosa@gmail.com) Received: from mail-ua0-x243.google.com (mail-ua0-x243.google.com [IPv6:2607:f8b0:400c:c08::243]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 78BA9B88; Tue, 20 Dec 2016 02:14:48 +0000 (UTC) (envelope-from sepherosa@gmail.com) Received: by mail-ua0-x243.google.com with SMTP id 50so13572104uae.2; Mon, 19 Dec 2016 18:14:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=speRyE2gJF0/WqQvHnl52AQ4OvVvkJPKtJ56gEiAG5o=; b=RlJ7igaelU7VNRg+WejkBEhH4gdnkOaWxQk1R57lMpBigYTRdbx4vfboSSPLV1u+0j hPXeld5HHvzuPRAA7sXiW6HTi5n+f7JHD6WES5w8d+Emy5qnoscJSSnMsSZxeBmJt5z2 J8m486pmPPyy6Y1Pn8A23QNqVFi+YpGu1keiHIoTGQSy6r6wFqZit54c+rQb1n7F/Kq0 dVRgdbKOWwYrD1V7RRIwUmKUHxNpy0WZBPI/+M4iI+MWcuShczPeXc/MMhXorapQhFmy oIXSCEU/oPKfnHJbUbwMYcYyOOrUEfTV4sjSDpHS8blCJkZsoYzu5Qh32v5GIhWRf0Xm 32Pg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=speRyE2gJF0/WqQvHnl52AQ4OvVvkJPKtJ56gEiAG5o=; b=CVLMBOunnsY4RAq4dpUV3ycYsFQcYx0NrYjj5TyHjEMsk0U5Zf1fTZdMdcb84Mh5dG 62Fa2TLrXflZ+CjqR+yh9f7KRmn07hPbs7tJpBIAJjXQnih7FfFG8/oiOYAbOF4eElPG pYxsgc6tHKW6ZpOkSdd669VyJmnW48pRc0C937ykSWfne8u6BJS8J8mmLXzCKAjvGCeA +lo7CY4XpW+GfQIl8FN9yt8ibBPm0nPqWKuKwUjsZpv/lM1/Uh9eZE6/VHFpvstC/7bm a30AZlyrLwM59JK0FsVAj8NiUQYtyCyIQhuO99GHnO5KqrNr5jv+aS+I0HTMC6dLDlTg hUgA== X-Gm-Message-State: AKaTC03M/fvVBTzr4arUnVjDXjbdZlN1iUc4t9aapv0/JJMw48gUB5dvpRO2mWeFVD3kMHVXVNQ6F+HWhLs9aA== X-Received: by 10.176.68.132 with SMTP id n4mr15257506uan.75.1482200072482; Mon, 19 Dec 2016 18:14:32 -0800 (PST) MIME-Version: 1.0 Received: by 10.176.2.86 with HTTP; Mon, 19 Dec 2016 18:14:31 -0800 (PST) In-Reply-To: References: <201612161949.uBGJnMol059217@repo.freebsd.org> <9BD5034F-55A6-48F6-A391-A0877FF49702@panasas.com> <1482175209.48539.9.camel@freebsd.org> From: Sepherosa Ziehau Date: Tue, 20 Dec 2016 10:14:31 +0800 Message-ID: Subject: Re: svn commit: r310171 - head/sys/sys To: Ravi Pokala Cc: Ian Lepore , Warner Losh , Dimitry Andric , src-committers , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" Content-Type: text/plain; charset=UTF-8 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Dec 2016 02:14:48 -0000 On Tue, Dec 20, 2016 at 4:37 AM, Ravi Pokala wrote: > -----Original Message----- >> From: on behalf of Ian Lepore >> Date: 2016-12-19, Monday at 11:20 >> To: Warner Losh , Ravi Pokala >> Cc: Sepherosa Ziehau , Dimitry Andric , src-committers , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" >> Subject: Re: svn commit: r310171 - head/sys/sys >> >> On Mon, 2016-12-19 at 11:58 -0700, Warner Losh wrote: >>> >>> ... >>> >>> Are there other precedence for avoiding the SCN macros in the tree as >>> well, or is this new art? >>> >>> Warner >> >> There was another commit recently the fixed the same kind of scanf >> error by making the variable fit the scanf type (changing uint64_t to >> an explicit long long unsigned, iirc). I don't know if that alone >> counts as a precedent, but IMO it's a more palatible fix than the >> SCN/PRI ugliness. > > With all apologies to Churchill, SCN/PRI are the worst way to address this in a machine-independent way, except for all the other ways that have been tried from time to time. :-P > If no objection comes, I'd commit the posted patch as it is tomorrow in my time. Thanks, sephe -- Tomorrow Will Never Die From owner-svn-src-all@freebsd.org Tue Dec 20 02:44:26 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id EAE98C890D3; Tue, 20 Dec 2016 02:44:26 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail105.syd.optusnet.com.au (mail105.syd.optusnet.com.au [211.29.132.249]) by mx1.freebsd.org (Postfix) with ESMTP id 971E21B76; Tue, 20 Dec 2016 02:44:26 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from besplex.bde.org (c122-106-153-191.carlnfd1.nsw.optusnet.com.au [122.106.153.191]) by mail105.syd.optusnet.com.au (Postfix) with ESMTPS id 7F8EC1044B1A; Tue, 20 Dec 2016 13:44:16 +1100 (AEDT) Date: Tue, 20 Dec 2016 13:44:15 +1100 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Ravi Pokala cc: Ian Lepore , Warner Losh , Sepherosa Ziehau , Dimitry Andric , src-committers , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" Subject: Re: svn commit: r310171 - head/sys/sys In-Reply-To: Message-ID: <20161220115922.H1147@besplex.bde.org> References: <201612161949.uBGJnMol059217@repo.freebsd.org> <9BD5034F-55A6-48F6-A391-A0877FF49702@panasas.com> <1482175209.48539.9.camel@freebsd.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Optus-CM-Score: 0 X-Optus-CM-Analysis: v=2.2 cv=cZeiljLM c=1 sm=1 tr=0 a=Tj3pCpwHnMupdyZSltBt7Q==:117 a=Tj3pCpwHnMupdyZSltBt7Q==:17 a=kj9zAlcOel0A:10 a=6I5d2MoRAAAA:8 a=7Qk2ozbKAAAA:8 a=n-kJSqksAAAA:8 a=pGLkceISAAAA:8 a=bdFN6mIY_9BeUA2hOmwA:9 a=sO5Achs8AXtz-njr:21 a=C33AFFPnMQOz1LBH:21 a=CjuIK1q_8ugA:10 a=IjZwj45LgO3ly-622nXo:22 a=1lyxoWkJIXJV6VJUPhuM:22 a=fMAGXkzVR7cRuVcbbVfL:22 a=6kGIvZw6iX1k4Y-7sg4_:22 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Dec 2016 02:44:27 -0000 On Mon, 19 Dec 2016, Ravi Pokala wrote: > -----Original Message----- >> From: on behalf of Ian Lepore >> Date: 2016-12-19, Monday at 11:20 >> To: Warner Losh , Ravi Pokala >> Cc: Sepherosa Ziehau , Dimitry Andric , src-committers , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" >> Subject: Re: svn commit: r310171 - head/sys/sys >> >> On Mon, 2016-12-19 at 11:58 -0700, Warner Losh wrote: >>> >>> ... >>> >>> Are there other precedence for avoiding the SCN macros in the tree as >>> well, or is this new art? >> >> There was another commit recently the fixed the same kind of scanf >> error by making the variable fit the scanf type (changing uint64_t to >> an explicit long long unsigned, iirc). I don't know if that alone >> counts as a precedent, but IMO it's a more palatible fix than the >> SCN/PRI ugliness. That was apparently a bug, not a fix. Someone said that the variable needs to have type precisely uint64_t. (Extensive use of fixed-width types in FreeBSD is another bug. It asks for fixed width at all cost. Using the "fast" or "least" types would as for time or space efficiency instead. Or just use basic types whenever possible for simplicity. Fixed-width types should only be used on ABI boundaries.) I think there is an ABI boundary near the other commit. Some hardware wants uint64_t, and we should use uint_fast64_t or uint_least64_t, but we used uint64_t. These uses require translation at the ABI boundary, since the fast and least types may be larger than the fixed-width types. (In more complicated cases, the relevant fixed-width type does't exist. IIRC, POSIX requires only fixed width types of width 8, 16 and 32 to exist, since old badly designed ABIs like inet_addr() require a fixed width, but newer ABIs don't repeat the mistake for width 64. The C standard requires the "fast" and "least" types for widths 8, 16, 32 and 64 to exist. This is possible since they can all be [unsigned] long long or [u]intmax_t although these might be very far from being either fast or least. All fixed-width types are optional in C. So to support bad software ABIs and some hardware ABIs using portable code, you have to read write the data using some basic type (perhaps unsigned char) and convert it to a "fast" or "least" type (or maybe [u]intmax_t). We changed to using the unsigned long long abomination. This is basically a bad spelling of uintmax_t. All uint_fast64_t, uint_least64_t, unsigned long long and uintmax_t are at least as large asthe ABI type uint64_t, so they can be used to represent the ABI values, but all need translation at ABI booundaries since they may be strictly larger. The translation may be as simple as assignment, depending on how the code is written. Since the code wasn't written with this in mind, it might have type puns instead. Or the compiler might just warn about all implicit conversions that might lose bits. > With all apologies to Churchill, SCN/PRI are the worst way to address this in a machine-independent way, except for all the other ways that have been tried from time to time. :-P No, there are much better ways. For PRI*, just cast to [u]intmax_t. The only thing wrong with this is that it lots wastes space and time when [u]intmax_t is very wide. We don't have this problem yet since [u]intmax_t is only 64 bits. That would be very wide on 8-bit systems but is merely wide on 32-bit systems and not wide on 63-bit systems. PRI* is not even available for an average typedef like uid_t. It is available for all "fast" and "least" typedefs. For SCN*, first don't use *scanf(). Use APIs that can actually handle errors, like strtol(). If you have to maintain bad code that uses *scanf(), then convert to uintmax_t. The conversions are not as short as casting for *printf(). They are much like what is needed at ABI boundaries: uintmax_t tmp; uint64_t val; /* * Good code does tmp = strtoumax() here. Then handle errors * reported by strtoumax(). Then check that the result is * representable in uint64_t. Then handle errors from that. * * Bad code did *sscanf(str, "%llx", &val) with no error checking * or handling of course. The type didn't't match the format in * general, and the behaviour was undefined on overflow. */ sscanf(str, "%jx", &tmp); /* keep null error handling */ val = tmp; /* preserve undefined on overflow */ /* * Overflow in sscanf() is less likely than before (uintmax_t * might be larger). Then overflow occurs much like before on * assignment (if the result is too large for the final type). */ Since the conversion is more elaborate for *scanf() than for *printf(), SCN* is slightly less bad than PRI*. SCN* is also not available for an average type like uid_t. It is available for the "fast" and "least" typedefs. But with error handling, it is even easier to always read into a temporary variable of type [u]intmax_t so as to do range checking: uintmax_t tmp; uint_fast64_t fast_val; uint_least64_t least_val; unsigned long long abom_val; uint64_t val; errno = 0; /* chummy with implementation */ r = sscanf(str, "%jx", &tmp); if (r < 0 || errno != 0) /* detect undef behaviour sometimes */ some_error(); if (tmp > UINT64_MAX) range_error(); fast_val = tmp; /* for local use */ least_val = tmp; /* for local use */ abom_val = tmp; /* for unspeakable use */ val = tmp; /* for ABI use */ The value could have been read directly into any of the other variables except uint64_t directly, with only portable SCN* ugliness, but it is easier to use uintmax_t. It is a small step from this to using correct code using strtoumax(). The SCN* mistake is not made for the strtol() family (by having a function for every possible type). But if you have to maintain bad code using *scanf(), it might have 20 args instead of 1, or complications like %n or string input (there is nothing like the strtol() family for convenient parsing of strings). Then converting to 20 copies of the above would be painful (or course you would use a function). The quick fix is to omit the error handling and add 20 temorary variables and 20 assignments. Grepping for examples in src/bin shows only 3 utilities using *scanf() and 1 serious type error: - ls uses 1 sscanf() with bad error handling (no range checking, and a broken fall-through for < 0 (it is treated as all args present), and no errno hack. - sleep uses 1 sscanf() rewritten be me to do all possible error handling short of using the errno hack. - stty uses 4 sscanf()s with assorted type errors. It always reads 1 variable at a time into a single temporary variable of type long. This (or rather using strtol()) was almost correct before C99 broke long being longest. It should have read into a u_long for the unsigned cases. Instead, it bogusly casts &tmp from long * to u_long * and then depends on benign conversions to use tmp as a u_long. Many of the uncast longs have sign errrors in a different way -- they are for speed_t, which happens to be u_int. stty's use shows most of the ABI complications mentioned above. The sscanf()s are 1 for variables of type tcflags_t, 2 for variables of type speed_t and 1 for variables of type cc_t. All of these types are supposed to be opaque, except they are unsigned and integer. So using long to read them was wrong on all cases. The correct type was u_long in C90 and uintmax_t after C99 broke long being longest. u_long still works in FreeBSD because ABIs don't allow easy expansion and there is no need for expanding these types. These types are actually u_char and u_int, so they fit easily in u_long and more care should be taken to disallow reading values that don't fit in the final type. All other errors are ignored anyway. Bruce From owner-svn-src-all@freebsd.org Tue Dec 20 03:38:15 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9183FC8804E; Tue, 20 Dec 2016 03:38:15 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 524D81B68; Tue, 20 Dec 2016 03:38:15 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBK3cE0x039708; Tue, 20 Dec 2016 03:38:14 GMT (envelope-from cem@FreeBSD.org) Received: (from cem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBK3cESQ039706; Tue, 20 Dec 2016 03:38:14 GMT (envelope-from cem@FreeBSD.org) Message-Id: <201612200338.uBK3cESQ039706@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cem set sender to cem@FreeBSD.org using -f From: "Conrad E. Meyer" Date: Tue, 20 Dec 2016 03:38:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310309 - in head/sys/dev: mmc sdhci X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Dec 2016 03:38:15 -0000 Author: cem Date: Tue Dec 20 03:38:14 2016 New Revision: 310309 URL: https://svnweb.freebsd.org/changeset/base/310309 Log: sdhci/mmc: Minor whitespace cleanups No functional change. Submitted by: Johannes Lundberg Modified: head/sys/dev/mmc/mmc.c head/sys/dev/sdhci/sdhci_pci.c Modified: head/sys/dev/mmc/mmc.c ============================================================================== --- head/sys/dev/mmc/mmc.c Tue Dec 20 01:51:09 2016 (r310308) +++ head/sys/dev/mmc/mmc.c Tue Dec 20 03:38:14 2016 (r310309) @@ -401,7 +401,7 @@ mmc_wait_for_req(struct mmc_softc *sc, s msleep(req, &sc->sc_mtx, 0, "mmcreq", 0); MMC_UNLOCK(sc); if (mmc_debug > 2 || (mmc_debug > 0 && req->cmd->error != MMC_ERR_NONE)) - device_printf(sc->dev, "CMD%d RESULT: %d\n", + device_printf(sc->dev, "CMD%d RESULT: %d\n", req->cmd->opcode, req->cmd->error); return (0); } @@ -511,7 +511,7 @@ mmc_idle_cards(struct mmc_softc *sc) { device_t dev; struct mmc_command cmd; - + dev = sc->dev; mmcbr_set_chip_select(dev, cs_high); mmcbr_update_ios(dev); @@ -795,7 +795,7 @@ mmc_test_bus_width(struct mmc_softc *sc) data.len = 8; data.flags = MMC_DATA_WRITE; mmc_wait_for_cmd(sc, &cmd, 0); - + memset(&cmd, 0, sizeof(cmd)); memset(&data, 0, sizeof(data)); cmd.opcode = MMC_BUSTEST_R; @@ -808,7 +808,7 @@ mmc_test_bus_width(struct mmc_softc *sc) data.flags = MMC_DATA_READ; err = mmc_wait_for_cmd(sc, &cmd, 0); sc->squelched--; - + mmcbr_set_bus_width(sc->dev, bus_width_1); mmcbr_update_ios(sc->dev); @@ -832,7 +832,7 @@ mmc_test_bus_width(struct mmc_softc *sc) data.len = 4; data.flags = MMC_DATA_WRITE; mmc_wait_for_cmd(sc, &cmd, 0); - + memset(&cmd, 0, sizeof(cmd)); memset(&data, 0, sizeof(data)); cmd.opcode = MMC_BUSTEST_R; @@ -1017,7 +1017,7 @@ mmc_decode_csd_sd(uint32_t *raw_csd, str csd->r2w_factor = 1 << mmc_get_bits(raw_csd, 128, 26, 3); csd->write_bl_len = 1 << mmc_get_bits(raw_csd, 128, 22, 4); csd->write_bl_partial = mmc_get_bits(raw_csd, 128, 21, 1); - } else + } else panic("unknown SD CSD version"); } @@ -1349,9 +1349,9 @@ mmc_discover_cards(struct mmc_softc *sc) if (ivar->csd.csd_structure > 0) ivar->high_cap = 1; ivar->tran_speed = ivar->csd.tran_speed; - ivar->erase_sector = ivar->csd.erase_sector * + ivar->erase_sector = ivar->csd.erase_sector * ivar->csd.write_bl_len / MMC_SECTOR_SIZE; - + err = mmc_send_status(sc, ivar->rca, &status); if (err != MMC_ERR_NONE) { device_printf(sc->dev, @@ -1446,7 +1446,7 @@ mmc_discover_cards(struct mmc_softc *sc) mmc_decode_csd_mmc(ivar->raw_csd, &ivar->csd); ivar->sec_count = ivar->csd.capacity / MMC_SECTOR_SIZE; ivar->tran_speed = ivar->csd.tran_speed; - ivar->erase_sector = ivar->csd.erase_sector * + ivar->erase_sector = ivar->csd.erase_sector * ivar->csd.write_bl_len / MMC_SECTOR_SIZE; err = mmc_send_status(sc, ivar->rca, &status); @@ -1655,7 +1655,7 @@ mmc_calculate_clock(struct mmc_softc *sc int nkid, i, f_max; device_t *kids; struct mmc_ivars *ivar; - + f_max = mmcbr_get_f_max(sc->dev); max_dtr = max_hs_dtr = f_max; if ((mmcbr_get_caps(sc->dev) & MMC_CAP_HSPEED)) @@ -1770,7 +1770,7 @@ static void mmc_delayed_attach(void *xsc) { struct mmc_softc *sc = xsc; - + mmc_scan(sc); config_intrhook_disestablish(&sc->config_intrhook); } Modified: head/sys/dev/sdhci/sdhci_pci.c ============================================================================== --- head/sys/dev/sdhci/sdhci_pci.c Tue Dec 20 01:51:09 2016 (r310308) +++ head/sys/dev/sdhci/sdhci_pci.c Tue Dec 20 03:38:14 2016 (r310309) @@ -63,15 +63,15 @@ __FBSDID("$FreeBSD$"); #define PCI_SDHCI_IFVENDOR 0x02 #define PCI_SLOT_INFO 0x40 /* 8 bits */ -#define PCI_SLOT_INFO_SLOTS(x) (((x >> 4) & 7) + 1) -#define PCI_SLOT_INFO_FIRST_BAR(x) ((x) & 7) +#define PCI_SLOT_INFO_SLOTS(x) (((x >> 4) & 7) + 1) +#define PCI_SLOT_INFO_FIRST_BAR(x) ((x) & 7) /* * RICOH specific PCI registers */ #define SDHC_PCI_MODE_KEY 0xf9 #define SDHC_PCI_MODE 0x150 -#define SDHC_PCI_MODE_SD20 0x10 +#define SDHC_PCI_MODE_SD20 0x10 #define SDHC_PCI_BASE_FREQ_KEY 0xfc #define SDHC_PCI_BASE_FREQ 0xe1 @@ -450,11 +450,11 @@ static device_method_t sdhci_methods[] = DEVMETHOD(bus_write_ivar, sdhci_generic_write_ivar), /* mmcbr_if */ - DEVMETHOD(mmcbr_update_ios, sdhci_generic_update_ios), - DEVMETHOD(mmcbr_request, sdhci_generic_request), - DEVMETHOD(mmcbr_get_ro, sdhci_generic_get_ro), - DEVMETHOD(mmcbr_acquire_host, sdhci_generic_acquire_host), - DEVMETHOD(mmcbr_release_host, sdhci_generic_release_host), + DEVMETHOD(mmcbr_update_ios, sdhci_generic_update_ios), + DEVMETHOD(mmcbr_request, sdhci_generic_request), + DEVMETHOD(mmcbr_get_ro, sdhci_generic_get_ro), + DEVMETHOD(mmcbr_acquire_host, sdhci_generic_acquire_host), + DEVMETHOD(mmcbr_release_host, sdhci_generic_release_host), /* SDHCI registers accessors */ DEVMETHOD(sdhci_read_1, sdhci_pci_read_1), From owner-svn-src-all@freebsd.org Tue Dec 20 03:41:41 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 80D54C8825E; Tue, 20 Dec 2016 03:41:41 +0000 (UTC) (envelope-from hrs@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 50CD41F12; Tue, 20 Dec 2016 03:41:41 +0000 (UTC) (envelope-from hrs@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBK3feiB042694; Tue, 20 Dec 2016 03:41:40 GMT (envelope-from hrs@FreeBSD.org) Received: (from hrs@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBK3fe2x042693; Tue, 20 Dec 2016 03:41:40 GMT (envelope-from hrs@FreeBSD.org) Message-Id: <201612200341.uBK3fe2x042693@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hrs set sender to hrs@FreeBSD.org using -f From: Hiroki Sato Date: Tue, 20 Dec 2016 03:41:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310310 - head/usr.sbin/syslogd X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Dec 2016 03:41:41 -0000 Author: hrs Date: Tue Dec 20 03:41:40 2016 New Revision: 310310 URL: https://svnweb.freebsd.org/changeset/base/310310 Log: Add a default socket bound to *:514 when no -b option is specified. This was accidentally removed at r309933. Spotted by: Michael Butler Modified: head/usr.sbin/syslogd/syslogd.c Modified: head/usr.sbin/syslogd/syslogd.c ============================================================================== --- head/usr.sbin/syslogd/syslogd.c Tue Dec 20 03:38:14 2016 (r310309) +++ head/usr.sbin/syslogd/syslogd.c Tue Dec 20 03:41:40 2016 (r310310) @@ -383,7 +383,7 @@ close_filed(struct filed *f) int main(int argc, char *argv[]) { - int ch, i, fdsrmax = 0; + int ch, i, fdsrmax = 0, bflag = 0; struct sockaddr_storage ss; fd_set *fdsr = NULL; char line[MAXLINE + 1]; @@ -437,6 +437,7 @@ main(int argc, char *argv[]) pe->pe_name = (strlen(optarg) == 0) ? NULL : optarg; } + bflag = 1; STAILQ_INSERT_TAIL(&pqueue, pe, next); break; case 'c': @@ -528,6 +529,14 @@ main(int argc, char *argv[]) } if ((argc -= optind) != 0) usage(); + + if (bflag == 0) { + pe = calloc(1, sizeof(*pe)); + *pe = (struct peer) { + .pe_serv = "syslog" + }; + STAILQ_INSERT_TAIL(&pqueue, pe, next); + } STAILQ_FOREACH(pe, &pqueue, next) socksetup(pe); From owner-svn-src-all@freebsd.org Tue Dec 20 04:05:23 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id F3AA8C88CD5; Tue, 20 Dec 2016 04:05:22 +0000 (UTC) (envelope-from hrs@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C2F431D0C; Tue, 20 Dec 2016 04:05:22 +0000 (UTC) (envelope-from hrs@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBK45Li3051855; Tue, 20 Dec 2016 04:05:21 GMT (envelope-from hrs@FreeBSD.org) Received: (from hrs@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBK45L9Q051854; Tue, 20 Dec 2016 04:05:21 GMT (envelope-from hrs@FreeBSD.org) Message-Id: <201612200405.uBK45L9Q051854@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hrs set sender to hrs@FreeBSD.org using -f From: Hiroki Sato Date: Tue, 20 Dec 2016 04:05:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310311 - head/usr.sbin/syslogd X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Dec 2016 04:05:23 -0000 Author: hrs Date: Tue Dec 20 04:05:21 2016 New Revision: 310311 URL: https://svnweb.freebsd.org/changeset/base/310311 Log: Add a NULL check. Modified: head/usr.sbin/syslogd/syslogd.c Modified: head/usr.sbin/syslogd/syslogd.c ============================================================================== --- head/usr.sbin/syslogd/syslogd.c Tue Dec 20 03:41:40 2016 (r310310) +++ head/usr.sbin/syslogd/syslogd.c Tue Dec 20 04:05:21 2016 (r310311) @@ -532,6 +532,8 @@ main(int argc, char *argv[]) if (bflag == 0) { pe = calloc(1, sizeof(*pe)); + if (pe == NULL) + err(1, "malloc failed"); *pe = (struct peer) { .pe_serv = "syslog" }; From owner-svn-src-all@freebsd.org Tue Dec 20 04:21:09 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1A6D8C876F7; Tue, 20 Dec 2016 04:21:09 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from mail.baldwin.cx (bigwig.baldwin.cx [96.47.65.170]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id DF8D81766; Tue, 20 Dec 2016 04:21:07 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from ralph.baldwin.cx (c-73-231-226-104.hsd1.ca.comcast.net [73.231.226.104]) by mail.baldwin.cx (Postfix) with ESMTPSA id 66D0B10A980; Mon, 19 Dec 2016 23:21:06 -0500 (EST) From: John Baldwin To: Adrian Chadd Cc: Eric van Gyzen , Warner Losh , Dimitry Andric , Baptiste Daroussin , "Conrad E. Meyer" , src-committers , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" Subject: Re: svn commit: r310138 - head/lib/libc/stdio Date: Mon, 19 Dec 2016 20:10:13 -0800 Message-ID: <247095068.jHM79JMCGm@ralph.baldwin.cx> User-Agent: KMail/4.14.10 (FreeBSD/11.0-PRERELEASE; KDE/4.14.10; amd64; ; ) In-Reply-To: References: <201612160144.uBG1ipjW016736@repo.freebsd.org> <49460793.UcUNovQMDa@ralph.baldwin.cx> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.4.3 (mail.baldwin.cx); Mon, 19 Dec 2016 23:21:06 -0500 (EST) X-Virus-Scanned: clamav-milter 0.99.2 at mail.baldwin.cx X-Virus-Status: Clean X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Dec 2016 04:21:09 -0000 On Monday, December 19, 2016 02:23:08 PM Adrian Chadd wrote: > [snip] > > tl;dr - can we revert it from stdio for now so we don't end up having > people use this? I agree with that. I think in userland something like snprintb() is ok. In the kernel I'd rather keep '%b'. -- John Baldwin From owner-svn-src-all@freebsd.org Tue Dec 20 04:51:16 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6E473C8900F; Tue, 20 Dec 2016 04:51:16 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 3F6D313C7; Tue, 20 Dec 2016 04:51:16 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBK4pFSO069935; Tue, 20 Dec 2016 04:51:15 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBK4pEdq069930; Tue, 20 Dec 2016 04:51:14 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201612200451.uBK4pEdq069930@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Tue, 20 Dec 2016 04:51:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310312 - head/sys/dev/hyperv/utilities X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Dec 2016 04:51:16 -0000 Author: sephe Date: Tue Dec 20 04:51:14 2016 New Revision: 310312 URL: https://svnweb.freebsd.org/changeset/base/310312 Log: hyperv/ic: Factor out function to send IC response MFC after: 1 week Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D8844 Modified: head/sys/dev/hyperv/utilities/hv_heartbeat.c head/sys/dev/hyperv/utilities/hv_shutdown.c head/sys/dev/hyperv/utilities/hv_timesync.c head/sys/dev/hyperv/utilities/hv_util.c head/sys/dev/hyperv/utilities/hv_util.h Modified: head/sys/dev/hyperv/utilities/hv_heartbeat.c ============================================================================== --- head/sys/dev/hyperv/utilities/hv_heartbeat.c Tue Dec 20 04:05:21 2016 (r310311) +++ head/sys/dev/hyperv/utilities/hv_heartbeat.c Tue Dec 20 04:51:14 2016 (r310312) @@ -110,13 +110,9 @@ vmbus_heartbeat_cb(struct vmbus_channel } /* - * Send response by echoing the updated request back. + * Send response by echoing the request back. */ - hdr->ic_flags = VMBUS_ICMSG_FLAG_XACT | VMBUS_ICMSG_FLAG_RESP; - error = vmbus_chan_send(chan, VMBUS_CHANPKT_TYPE_INBAND, 0, - data, dlen, xactid); - if (error) - device_printf(sc->ic_dev, "resp send failed: %d\n", error); + vmbus_ic_sendresp(sc, chan, data, dlen, xactid); } static int Modified: head/sys/dev/hyperv/utilities/hv_shutdown.c ============================================================================== --- head/sys/dev/hyperv/utilities/hv_shutdown.c Tue Dec 20 04:05:21 2016 (r310311) +++ head/sys/dev/hyperv/utilities/hv_shutdown.c Tue Dec 20 04:51:14 2016 (r310312) @@ -122,13 +122,9 @@ vmbus_shutdown_cb(struct vmbus_channel * } /* - * Send response by echoing the updated request back. + * Send response by echoing the request back. */ - hdr->ic_flags = VMBUS_ICMSG_FLAG_XACT | VMBUS_ICMSG_FLAG_RESP; - error = vmbus_chan_send(chan, VMBUS_CHANPKT_TYPE_INBAND, 0, - data, dlen, xactid); - if (error) - device_printf(sc->ic_dev, "resp send failed: %d\n", error); + vmbus_ic_sendresp(sc, chan, data, dlen, xactid); if (do_shutdown) shutdown_nice(RB_POWEROFF); Modified: head/sys/dev/hyperv/utilities/hv_timesync.c ============================================================================== --- head/sys/dev/hyperv/utilities/hv_timesync.c Tue Dec 20 04:05:21 2016 (r310311) +++ head/sys/dev/hyperv/utilities/hv_timesync.c Tue Dec 20 04:51:14 2016 (r310312) @@ -203,13 +203,9 @@ vmbus_timesync_cb(struct vmbus_channel * } /* - * Send response by echoing the updated request back. + * Send response by echoing the request back. */ - hdr->ic_flags = VMBUS_ICMSG_FLAG_XACT | VMBUS_ICMSG_FLAG_RESP; - error = vmbus_chan_send(chan, VMBUS_CHANPKT_TYPE_INBAND, 0, - data, dlen, xactid); - if (error) - device_printf(sc->ic_dev, "resp send failed: %d\n", error); + vmbus_ic_sendresp(sc, chan, data, dlen, xactid); } static int Modified: head/sys/dev/hyperv/utilities/hv_util.c ============================================================================== --- head/sys/dev/hyperv/utilities/hv_util.c Tue Dec 20 04:05:21 2016 (r310311) +++ head/sys/dev/hyperv/utilities/hv_util.c Tue Dec 20 04:51:14 2016 (r310312) @@ -287,3 +287,21 @@ hv_util_detach(device_t dev) return (0); } + +int +vmbus_ic_sendresp(struct hv_util_sc *sc, struct vmbus_channel *chan, + void *data, int dlen, uint64_t xactid) +{ + struct vmbus_icmsg_hdr *hdr; + int error; + + KASSERT(dlen >= sizeof(*hdr), ("invalid data length %d", dlen)); + hdr = data; + + hdr->ic_flags = VMBUS_ICMSG_FLAG_XACT | VMBUS_ICMSG_FLAG_RESP; + error = vmbus_chan_send(chan, VMBUS_CHANPKT_TYPE_INBAND, 0, + data, dlen, xactid); + if (error) + device_printf(sc->ic_dev, "resp send failed: %d\n", error); + return (error); +} Modified: head/sys/dev/hyperv/utilities/hv_util.h ============================================================================== --- head/sys/dev/hyperv/utilities/hv_util.h Tue Dec 20 04:05:21 2016 (r310311) +++ head/sys/dev/hyperv/utilities/hv_util.h Tue Dec 20 04:51:14 2016 (r310312) @@ -58,5 +58,8 @@ int hv_util_detach(device_t dev); int vmbus_ic_probe(device_t dev, const struct vmbus_ic_desc descs[]); int vmbus_ic_negomsg(struct hv_util_sc *sc, void *data, int *dlen, uint32_t fw_ver, uint32_t msg_ver); +int vmbus_ic_sendresp(struct hv_util_sc *sc, + struct vmbus_channel *chan, void *data, int dlen, + uint64_t xactid); #endif From owner-svn-src-all@freebsd.org Tue Dec 20 05:07:14 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 00ABFC8948C; Tue, 20 Dec 2016 05:07:14 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id CF2A01C91; Tue, 20 Dec 2016 05:07:13 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBK57DoH075503; Tue, 20 Dec 2016 05:07:13 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBK57COs075495; Tue, 20 Dec 2016 05:07:12 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201612200507.uBK57COs075495@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Tue, 20 Dec 2016 05:07:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310313 - head/sys/dev/hyperv/utilities X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Dec 2016 05:07:14 -0000 Author: sephe Date: Tue Dec 20 05:07:12 2016 New Revision: 310313 URL: https://svnweb.freebsd.org/changeset/base/310313 Log: hyperv/ic: Cleanup common struct and functions. MFC after: 1 week Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D8845 Modified: head/sys/dev/hyperv/utilities/hv_heartbeat.c head/sys/dev/hyperv/utilities/hv_kvp.c head/sys/dev/hyperv/utilities/hv_shutdown.c head/sys/dev/hyperv/utilities/hv_snapshot.c head/sys/dev/hyperv/utilities/hv_timesync.c head/sys/dev/hyperv/utilities/hv_util.c head/sys/dev/hyperv/utilities/hv_util.h Modified: head/sys/dev/hyperv/utilities/hv_heartbeat.c ============================================================================== --- head/sys/dev/hyperv/utilities/hv_heartbeat.c Tue Dec 20 04:51:14 2016 (r310312) +++ head/sys/dev/hyperv/utilities/hv_heartbeat.c Tue Dec 20 05:07:12 2016 (r310313) @@ -61,7 +61,7 @@ static const struct vmbus_ic_desc vmbus_ static void vmbus_heartbeat_cb(struct vmbus_channel *chan, void *xsc) { - struct hv_util_sc *sc = xsc; + struct vmbus_ic_softc *sc = xsc; struct vmbus_icmsg_hdr *hdr; int dlen, error; uint64_t xactid; @@ -70,7 +70,7 @@ vmbus_heartbeat_cb(struct vmbus_channel /* * Receive request. */ - data = sc->receive_buffer; + data = sc->ic_buf; dlen = sc->ic_buflen; error = vmbus_chan_recv(chan, data, &dlen, &xactid); KASSERT(error != ENOBUFS, ("icbuf is not large enough")); @@ -126,18 +126,22 @@ static int hv_heartbeat_attach(device_t dev) { - return (hv_util_attach(dev, vmbus_heartbeat_cb)); + return (vmbus_ic_attach(dev, vmbus_heartbeat_cb)); } static device_method_t heartbeat_methods[] = { /* Device interface */ DEVMETHOD(device_probe, hv_heartbeat_probe), DEVMETHOD(device_attach, hv_heartbeat_attach), - DEVMETHOD(device_detach, hv_util_detach), + DEVMETHOD(device_detach, vmbus_ic_detach), { 0, 0 } }; -static driver_t heartbeat_driver = { "hvheartbeat", heartbeat_methods, sizeof(hv_util_sc)}; +static driver_t heartbeat_driver = { + "hvheartbeat", + heartbeat_methods, + sizeof(struct vmbus_ic_softc) +}; static devclass_t heartbeat_devclass; Modified: head/sys/dev/hyperv/utilities/hv_kvp.c ============================================================================== --- head/sys/dev/hyperv/utilities/hv_kvp.c Tue Dec 20 04:51:14 2016 (r310312) +++ head/sys/dev/hyperv/utilities/hv_kvp.c Tue Dec 20 05:07:12 2016 (r310313) @@ -128,7 +128,7 @@ static struct cdevsw hv_kvp_cdevsw = * KVP transaction requests from the host. */ typedef struct hv_kvp_sc { - struct hv_util_sc util_sc; + struct vmbus_ic_softc util_sc; device_t dev; /* Unless specified the pending mutex should be @@ -590,7 +590,7 @@ hv_kvp_process_request(void *context, in hv_kvp_log_info("%s: entering hv_kvp_process_request\n", __func__); sc = (hv_kvp_sc*)context; - kvp_buf = sc->util_sc.receive_buffer; + kvp_buf = sc->util_sc.ic_buf; channel = vmbus_get_channel(sc->dev); recvlen = sc->util_sc.ic_buflen; @@ -885,7 +885,7 @@ hv_kvp_attach(device_t dev) return (error); sc->hv_kvp_dev->si_drv1 = sc; - return hv_util_attach(dev, hv_kvp_callback); + return (vmbus_ic_attach(dev, hv_kvp_callback)); } static int @@ -900,7 +900,7 @@ hv_kvp_detach(device_t dev) } destroy_dev(sc->hv_kvp_dev); - return hv_util_detach(dev); + return (vmbus_ic_detach(dev)); } static device_method_t kvp_methods[] = { Modified: head/sys/dev/hyperv/utilities/hv_shutdown.c ============================================================================== --- head/sys/dev/hyperv/utilities/hv_shutdown.c Tue Dec 20 04:51:14 2016 (r310312) +++ head/sys/dev/hyperv/utilities/hv_shutdown.c Tue Dec 20 05:07:12 2016 (r310313) @@ -62,7 +62,7 @@ static const struct vmbus_ic_desc vmbus_ static void vmbus_shutdown_cb(struct vmbus_channel *chan, void *xsc) { - struct hv_util_sc *sc = xsc; + struct vmbus_ic_softc *sc = xsc; struct vmbus_icmsg_hdr *hdr; struct vmbus_icmsg_shutdown *msg; int dlen, error, do_shutdown = 0; @@ -72,7 +72,7 @@ vmbus_shutdown_cb(struct vmbus_channel * /* * Receive request. */ - data = sc->receive_buffer; + data = sc->ic_buf; dlen = sc->ic_buflen; error = vmbus_chan_recv(chan, data, &dlen, &xactid); KASSERT(error != ENOBUFS, ("icbuf is not large enough")); @@ -141,18 +141,22 @@ static int hv_shutdown_attach(device_t dev) { - return (hv_util_attach(dev, vmbus_shutdown_cb)); + return (vmbus_ic_attach(dev, vmbus_shutdown_cb)); } static device_method_t shutdown_methods[] = { /* Device interface */ DEVMETHOD(device_probe, hv_shutdown_probe), DEVMETHOD(device_attach, hv_shutdown_attach), - DEVMETHOD(device_detach, hv_util_detach), + DEVMETHOD(device_detach, vmbus_ic_detach), { 0, 0 } }; -static driver_t shutdown_driver = { "hvshutdown", shutdown_methods, sizeof(hv_util_sc)}; +static driver_t shutdown_driver = { + "hvshutdown", + shutdown_methods, + sizeof(struct vmbus_ic_softc) +}; static devclass_t shutdown_devclass; Modified: head/sys/dev/hyperv/utilities/hv_snapshot.c ============================================================================== --- head/sys/dev/hyperv/utilities/hv_snapshot.c Tue Dec 20 04:51:14 2016 (r310312) +++ head/sys/dev/hyperv/utilities/hv_snapshot.c Tue Dec 20 05:07:12 2016 (r310313) @@ -204,7 +204,7 @@ struct hv_vss_dev_sc { * https://clovertrail.github.io/assets/vssdot.png */ typedef struct hv_vss_sc { - struct hv_util_sc util_sc; + struct vmbus_ic_softc util_sc; device_t dev; struct task task; @@ -808,7 +808,7 @@ hv_vss_process_request(void *context, in hv_vss_log_info("%s: entering hv_vss_process_request\n", __func__); sc = (hv_vss_sc*)context; - vss_buf = sc->util_sc.receive_buffer; + vss_buf = sc->util_sc.ic_buf; channel = vmbus_get_channel(sc->dev); recvlen = sc->util_sc.ic_buflen; @@ -1020,7 +1020,7 @@ hv_vss_attach(device_t dev) sc->hv_appvss_dev->si_drv1 = &sc->app_sc; sc->app_sc.sc = sc; - return hv_util_attach(dev, hv_vss_callback); + return (vmbus_ic_attach(dev, hv_vss_callback)); } static int @@ -1041,7 +1041,7 @@ hv_vss_detach(device_t dev) hv_vss_destroy_send_receive_queue(dev); destroy_dev(sc->hv_vss_dev); destroy_dev(sc->hv_appvss_dev); - return hv_util_detach(dev); + return (vmbus_ic_detach(dev)); } static device_method_t vss_methods[] = { Modified: head/sys/dev/hyperv/utilities/hv_timesync.c ============================================================================== --- head/sys/dev/hyperv/utilities/hv_timesync.c Tue Dec 20 04:51:14 2016 (r310312) +++ head/sys/dev/hyperv/utilities/hv_timesync.c Tue Dec 20 05:07:12 2016 (r310313) @@ -85,7 +85,7 @@ SYSCTL_INT(_hw_hvtimesync, OID_AUTO, sam &vmbus_ts_sample_verbose, 0, "Increase sample request verbosity."); static void -vmbus_timesync(struct hv_util_sc *sc, uint64_t hvtime, uint64_t sent_tc, +vmbus_timesync(struct vmbus_ic_softc *sc, uint64_t hvtime, uint64_t sent_tc, uint8_t tsflags) { struct timespec vm_ts; @@ -150,7 +150,7 @@ vmbus_timesync(struct hv_util_sc *sc, ui static void vmbus_timesync_cb(struct vmbus_channel *chan, void *xsc) { - struct hv_util_sc *sc = xsc; + struct vmbus_ic_softc *sc = xsc; struct vmbus_icmsg_hdr *hdr; const struct vmbus_icmsg_timesync *msg; int dlen, error; @@ -160,7 +160,7 @@ vmbus_timesync_cb(struct vmbus_channel * /* * Receive request. */ - data = sc->receive_buffer; + data = sc->ic_buf; dlen = sc->ic_buflen; error = vmbus_chan_recv(chan, data, &dlen, &xactid); KASSERT(error != ENOBUFS, ("icbuf is not large enough")); @@ -219,18 +219,22 @@ static int hv_timesync_attach(device_t dev) { - return (hv_util_attach(dev, vmbus_timesync_cb)); + return (vmbus_ic_attach(dev, vmbus_timesync_cb)); } static device_method_t timesync_methods[] = { /* Device interface */ DEVMETHOD(device_probe, hv_timesync_probe), DEVMETHOD(device_attach, hv_timesync_attach), - DEVMETHOD(device_detach, hv_util_detach), + DEVMETHOD(device_detach, vmbus_ic_detach), { 0, 0 } }; -static driver_t timesync_driver = { "hvtimesync", timesync_methods, sizeof(hv_util_sc)}; +static driver_t timesync_driver = { + "hvtimesync", + timesync_methods, + sizeof(struct vmbus_ic_softc) +}; static devclass_t timesync_devclass; Modified: head/sys/dev/hyperv/utilities/hv_util.c ============================================================================== --- head/sys/dev/hyperv/utilities/hv_util.c Tue Dec 20 04:51:14 2016 (r310312) +++ head/sys/dev/hyperv/utilities/hv_util.c Tue Dec 20 05:07:12 2016 (r310313) @@ -58,7 +58,7 @@ static int vmbus_ic_fwver_sysctl(SYSCTL_ static int vmbus_ic_msgver_sysctl(SYSCTL_HANDLER_ARGS); int -vmbus_ic_negomsg(struct hv_util_sc *sc, void *data, int *dlen0, +vmbus_ic_negomsg(struct vmbus_ic_softc *sc, void *data, int *dlen0, uint32_t fw_ver, uint32_t msg_ver) { struct vmbus_icmsg_negotiate *nego; @@ -214,9 +214,9 @@ vmbus_ic_probe(device_t dev, const struc } int -hv_util_attach(device_t dev, vmbus_chan_callback_t cb) +vmbus_ic_attach(device_t dev, vmbus_chan_callback_t cb) { - struct hv_util_sc *sc = device_get_softc(dev); + struct vmbus_ic_softc *sc = device_get_softc(dev); struct vmbus_channel *chan = vmbus_get_channel(dev); struct sysctl_oid_list *child; struct sysctl_ctx_list *ctx; @@ -224,8 +224,7 @@ hv_util_attach(device_t dev, vmbus_chan_ sc->ic_dev = dev; sc->ic_buflen = VMBUS_IC_BRSIZE; - sc->receive_buffer = malloc(VMBUS_IC_BRSIZE, M_DEVBUF, - M_WAITOK | M_ZERO); + sc->ic_buf = malloc(VMBUS_IC_BRSIZE, M_DEVBUF, M_WAITOK | M_ZERO); /* * These services are not performance critical and do not need @@ -239,7 +238,7 @@ hv_util_attach(device_t dev, vmbus_chan_ error = vmbus_chan_open(chan, VMBUS_IC_BRSIZE, VMBUS_IC_BRSIZE, NULL, 0, cb, sc); if (error) { - free(sc->receive_buffer, M_DEVBUF); + free(sc->ic_buf, M_DEVBUF); return (error); } @@ -258,7 +257,7 @@ hv_util_attach(device_t dev, vmbus_chan_ static int vmbus_ic_fwver_sysctl(SYSCTL_HANDLER_ARGS) { - struct hv_util_sc *sc = arg1; + struct vmbus_ic_softc *sc = arg1; char verstr[16]; snprintf(verstr, sizeof(verstr), "%u.%u", @@ -269,7 +268,7 @@ vmbus_ic_fwver_sysctl(SYSCTL_HANDLER_ARG static int vmbus_ic_msgver_sysctl(SYSCTL_HANDLER_ARGS) { - struct hv_util_sc *sc = arg1; + struct vmbus_ic_softc *sc = arg1; char verstr[16]; snprintf(verstr, sizeof(verstr), "%u.%u", @@ -278,18 +277,18 @@ vmbus_ic_msgver_sysctl(SYSCTL_HANDLER_AR } int -hv_util_detach(device_t dev) +vmbus_ic_detach(device_t dev) { - struct hv_util_sc *sc = device_get_softc(dev); + struct vmbus_ic_softc *sc = device_get_softc(dev); vmbus_chan_close(vmbus_get_channel(dev)); - free(sc->receive_buffer, M_DEVBUF); + free(sc->ic_buf, M_DEVBUF); return (0); } int -vmbus_ic_sendresp(struct hv_util_sc *sc, struct vmbus_channel *chan, +vmbus_ic_sendresp(struct vmbus_ic_softc *sc, struct vmbus_channel *chan, void *data, int dlen, uint64_t xactid) { struct vmbus_icmsg_hdr *hdr; Modified: head/sys/dev/hyperv/utilities/hv_util.h ============================================================================== --- head/sys/dev/hyperv/utilities/hv_util.h Tue Dec 20 04:51:14 2016 (r310312) +++ head/sys/dev/hyperv/utilities/hv_util.h Tue Dec 20 05:07:12 2016 (r310313) @@ -28,23 +28,19 @@ * $FreeBSD$ */ -#ifndef _HVUTIL_H_ -#define _HVUTIL_H_ +#ifndef _VMBUS_ICVAR_H_ +#define _VMBUS_ICVAR_H_ #include #include -/** - * hv_util related structures - * - */ -typedef struct hv_util_sc { +struct vmbus_ic_softc { device_t ic_dev; - uint8_t *receive_buffer; + uint8_t *ic_buf; int ic_buflen; uint32_t ic_fwver; /* framework version */ uint32_t ic_msgver; /* message version */ -} hv_util_sc; +}; struct vmbus_ic_desc { const struct hyperv_guid ic_guid; @@ -53,13 +49,13 @@ struct vmbus_ic_desc { #define VMBUS_IC_DESC_END { .ic_desc = NULL } -int hv_util_attach(device_t dev, vmbus_chan_callback_t cb); -int hv_util_detach(device_t dev); +int vmbus_ic_attach(device_t dev, vmbus_chan_callback_t cb); +int vmbus_ic_detach(device_t dev); int vmbus_ic_probe(device_t dev, const struct vmbus_ic_desc descs[]); -int vmbus_ic_negomsg(struct hv_util_sc *sc, void *data, int *dlen, - uint32_t fw_ver, uint32_t msg_ver); -int vmbus_ic_sendresp(struct hv_util_sc *sc, +int vmbus_ic_negomsg(struct vmbus_ic_softc *sc, void *data, + int *dlen, uint32_t fw_ver, uint32_t msg_ver); +int vmbus_ic_sendresp(struct vmbus_ic_softc *sc, struct vmbus_channel *chan, void *data, int dlen, uint64_t xactid); -#endif +#endif /* !_VMBUS_ICVAR_H_ */ From owner-svn-src-all@freebsd.org Tue Dec 20 05:26:40 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 93567C89C64; Tue, 20 Dec 2016 05:26:40 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 6DFE218B4; Tue, 20 Dec 2016 05:26:40 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBK5QdB6083572; Tue, 20 Dec 2016 05:26:39 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBK5QcgI083565; Tue, 20 Dec 2016 05:26:38 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201612200526.uBK5QcgI083565@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Tue, 20 Dec 2016 05:26:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310314 - head/sys/dev/hyperv/utilities X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Dec 2016 05:26:40 -0000 Author: sephe Date: Tue Dec 20 05:26:38 2016 New Revision: 310314 URL: https://svnweb.freebsd.org/changeset/base/310314 Log: hyperv/ic: Rename cleaned up header file. MFC after: 1 week Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D8846 Added: head/sys/dev/hyperv/utilities/vmbus_icvar.h - copied unchanged from r310313, head/sys/dev/hyperv/utilities/hv_util.h Deleted: head/sys/dev/hyperv/utilities/hv_util.h Modified: head/sys/dev/hyperv/utilities/hv_heartbeat.c head/sys/dev/hyperv/utilities/hv_kvp.c head/sys/dev/hyperv/utilities/hv_shutdown.c head/sys/dev/hyperv/utilities/hv_snapshot.c head/sys/dev/hyperv/utilities/hv_timesync.c head/sys/dev/hyperv/utilities/hv_util.c Modified: head/sys/dev/hyperv/utilities/hv_heartbeat.c ============================================================================== --- head/sys/dev/hyperv/utilities/hv_heartbeat.c Tue Dec 20 05:07:12 2016 (r310313) +++ head/sys/dev/hyperv/utilities/hv_heartbeat.c Tue Dec 20 05:26:38 2016 (r310314) @@ -35,8 +35,8 @@ __FBSDID("$FreeBSD$"); #include #include -#include #include +#include #include "vmbus_if.h" Modified: head/sys/dev/hyperv/utilities/hv_kvp.c ============================================================================== --- head/sys/dev/hyperv/utilities/hv_kvp.c Tue Dec 20 05:07:12 2016 (r310313) +++ head/sys/dev/hyperv/utilities/hv_kvp.c Tue Dec 20 05:26:38 2016 (r310314) @@ -64,8 +64,8 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include -#include "hv_util.h" #include "unicode.h" #include "hv_kvp.h" #include "vmbus_if.h" Modified: head/sys/dev/hyperv/utilities/hv_shutdown.c ============================================================================== --- head/sys/dev/hyperv/utilities/hv_shutdown.c Tue Dec 20 05:07:12 2016 (r310313) +++ head/sys/dev/hyperv/utilities/hv_shutdown.c Tue Dec 20 05:26:38 2016 (r310314) @@ -36,8 +36,8 @@ __FBSDID("$FreeBSD$"); #include #include -#include #include +#include #include "vmbus_if.h" Modified: head/sys/dev/hyperv/utilities/hv_snapshot.c ============================================================================== --- head/sys/dev/hyperv/utilities/hv_snapshot.c Tue Dec 20 05:07:12 2016 (r310313) +++ head/sys/dev/hyperv/utilities/hv_snapshot.c Tue Dec 20 05:26:38 2016 (r310314) @@ -57,8 +57,8 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include -#include "hv_util.h" #include "hv_snapshot.h" #include "vmbus_if.h" Modified: head/sys/dev/hyperv/utilities/hv_timesync.c ============================================================================== --- head/sys/dev/hyperv/utilities/hv_timesync.c Tue Dec 20 05:07:12 2016 (r310313) +++ head/sys/dev/hyperv/utilities/hv_timesync.c Tue Dec 20 05:26:38 2016 (r310314) @@ -37,8 +37,8 @@ __FBSDID("$FreeBSD$"); #include #include -#include #include +#include #include "vmbus_if.h" Modified: head/sys/dev/hyperv/utilities/hv_util.c ============================================================================== --- head/sys/dev/hyperv/utilities/hv_util.c Tue Dec 20 05:07:12 2016 (r310313) +++ head/sys/dev/hyperv/utilities/hv_util.c Tue Dec 20 05:26:38 2016 (r310314) @@ -42,8 +42,8 @@ #include #include -#include #include +#include #include "vmbus_if.h" Copied: head/sys/dev/hyperv/utilities/vmbus_icvar.h (from r310313, head/sys/dev/hyperv/utilities/hv_util.h) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/dev/hyperv/utilities/vmbus_icvar.h Tue Dec 20 05:26:38 2016 (r310314, copy of r310313, head/sys/dev/hyperv/utilities/hv_util.h) @@ -0,0 +1,61 @@ +/*- + * Copyright (c) 2009-2012,2016 Microsoft Corp. + * Copyright (c) 2012 NetApp Inc. + * Copyright (c) 2012 Citrix Inc. + * 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 unmodified, 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 ``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 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$ + */ + +#ifndef _VMBUS_ICVAR_H_ +#define _VMBUS_ICVAR_H_ + +#include +#include + +struct vmbus_ic_softc { + device_t ic_dev; + uint8_t *ic_buf; + int ic_buflen; + uint32_t ic_fwver; /* framework version */ + uint32_t ic_msgver; /* message version */ +}; + +struct vmbus_ic_desc { + const struct hyperv_guid ic_guid; + const char *ic_desc; +}; + +#define VMBUS_IC_DESC_END { .ic_desc = NULL } + +int vmbus_ic_attach(device_t dev, vmbus_chan_callback_t cb); +int vmbus_ic_detach(device_t dev); +int vmbus_ic_probe(device_t dev, const struct vmbus_ic_desc descs[]); +int vmbus_ic_negomsg(struct vmbus_ic_softc *sc, void *data, + int *dlen, uint32_t fw_ver, uint32_t msg_ver); +int vmbus_ic_sendresp(struct vmbus_ic_softc *sc, + struct vmbus_channel *chan, void *data, int dlen, + uint64_t xactid); + +#endif /* !_VMBUS_ICVAR_H_ */ From owner-svn-src-all@freebsd.org Tue Dec 20 05:39:02 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 601FCC89EAD; Tue, 20 Dec 2016 05:39:02 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 136961D82; Tue, 20 Dec 2016 05:39:02 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBK5d19X087588; Tue, 20 Dec 2016 05:39:01 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBK5d08P087584; Tue, 20 Dec 2016 05:39:00 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201612200539.uBK5d08P087584@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Tue, 20 Dec 2016 05:39:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310315 - head/sys/dev/hyperv/utilities X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Dec 2016 05:39:02 -0000 Author: sephe Date: Tue Dec 20 05:39:00 2016 New Revision: 310315 URL: https://svnweb.freebsd.org/changeset/base/310315 Log: hyperv/ic: Inclusion cleanup MFC after: 1 week Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D8847 Modified: head/sys/dev/hyperv/utilities/hv_heartbeat.c head/sys/dev/hyperv/utilities/hv_shutdown.c head/sys/dev/hyperv/utilities/hv_timesync.c head/sys/dev/hyperv/utilities/hv_util.c Modified: head/sys/dev/hyperv/utilities/hv_heartbeat.c ============================================================================== --- head/sys/dev/hyperv/utilities/hv_heartbeat.c Tue Dec 20 05:26:38 2016 (r310314) +++ head/sys/dev/hyperv/utilities/hv_heartbeat.c Tue Dec 20 05:39:00 2016 (r310315) @@ -38,8 +38,6 @@ __FBSDID("$FreeBSD$"); #include #include -#include "vmbus_if.h" - #define VMBUS_HEARTBEAT_FWVER_MAJOR 3 #define VMBUS_HEARTBEAT_FWVER \ VMBUS_IC_VERSION(VMBUS_HEARTBEAT_FWVER_MAJOR, 0) Modified: head/sys/dev/hyperv/utilities/hv_shutdown.c ============================================================================== --- head/sys/dev/hyperv/utilities/hv_shutdown.c Tue Dec 20 05:26:38 2016 (r310314) +++ head/sys/dev/hyperv/utilities/hv_shutdown.c Tue Dec 20 05:39:00 2016 (r310315) @@ -39,8 +39,6 @@ __FBSDID("$FreeBSD$"); #include #include -#include "vmbus_if.h" - #define VMBUS_SHUTDOWN_FWVER_MAJOR 3 #define VMBUS_SHUTDOWN_FWVER \ VMBUS_IC_VERSION(VMBUS_SHUTDOWN_FWVER_MAJOR, 0) Modified: head/sys/dev/hyperv/utilities/hv_timesync.c ============================================================================== --- head/sys/dev/hyperv/utilities/hv_timesync.c Tue Dec 20 05:26:38 2016 (r310314) +++ head/sys/dev/hyperv/utilities/hv_timesync.c Tue Dec 20 05:39:00 2016 (r310315) @@ -40,8 +40,6 @@ __FBSDID("$FreeBSD$"); #include #include -#include "vmbus_if.h" - #define VMBUS_TIMESYNC_FWVER_MAJOR 3 #define VMBUS_TIMESYNC_FWVER \ VMBUS_IC_VERSION(VMBUS_TIMESYNC_FWVER_MAJOR, 0) Modified: head/sys/dev/hyperv/utilities/hv_util.c ============================================================================== --- head/sys/dev/hyperv/utilities/hv_util.c Tue Dec 20 05:26:38 2016 (r310314) +++ head/sys/dev/hyperv/utilities/hv_util.c Tue Dec 20 05:39:00 2016 (r310315) @@ -22,23 +22,16 @@ * 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$ */ -/* - * A common driver for all hyper-V util services. - */ +#include +__FBSDID("$FreeBSD$"); #include -#include #include #include -#include -#include #include #include -#include #include #include From owner-svn-src-all@freebsd.org Tue Dec 20 05:45:53 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E4D9AC8906E; Tue, 20 Dec 2016 05:45:53 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B43621203; Tue, 20 Dec 2016 05:45:53 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBK5jqqZ091479; Tue, 20 Dec 2016 05:45:52 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBK5jqU3091478; Tue, 20 Dec 2016 05:45:52 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201612200545.uBK5jqU3091478@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Tue, 20 Dec 2016 05:45:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310316 - head/cddl/contrib/opensolaris/lib/libdtrace/common X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Dec 2016 05:45:54 -0000 Author: markj Date: Tue Dec 20 05:45:52 2016 New Revision: 310316 URL: https://svnweb.freebsd.org/changeset/base/310316 Log: Consistently print D variable indices in decimal when disassembling. MFC after: 1 week Modified: head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_dis.c Modified: head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_dis.c ============================================================================== --- head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_dis.c Tue Dec 20 05:39:00 2016 (r310315) +++ head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_dis.c Tue Dec 20 05:45:52 2016 (r310316) @@ -499,7 +499,7 @@ dt_dis(const dtrace_difo_t *dp, FILE *fp if (v->dtdv_flags & DIFV_F_MOD) (void) strcat(flags, "/w"); - (void) fprintf(fp, "%-16s %-4x %-3s %-3s %-4s %s\n", + (void) fprintf(fp, "%-16s %-4u %-3s %-3s %-4s %s\n", &dp->dtdo_strtab[v->dtdv_name], v->dtdv_id, kind, scope, flags + 1, dt_dis_typestr(&v->dtdv_type, type, sizeof (type))); From owner-svn-src-all@freebsd.org Tue Dec 20 07:14:25 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C48A5C891C3; Tue, 20 Dec 2016 07:14:25 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 94083127A; Tue, 20 Dec 2016 07:14:25 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBK7EOmZ027552; Tue, 20 Dec 2016 07:14:24 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBK7EOeC027549; Tue, 20 Dec 2016 07:14:24 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201612200714.uBK7EOeC027549@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Tue, 20 Dec 2016 07:14:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310317 - in head/sys: conf dev/hyperv/utilities modules/hyperv/utilities X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Dec 2016 07:14:25 -0000 Author: sephe Date: Tue Dec 20 07:14:24 2016 New Revision: 310317 URL: https://svnweb.freebsd.org/changeset/base/310317 Log: hyperv/ic: Rname cleaned up file. MFC after: 1 week Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D8848 Added: head/sys/dev/hyperv/utilities/vmbus_ic.c - copied unchanged from r310316, head/sys/dev/hyperv/utilities/hv_util.c Deleted: head/sys/dev/hyperv/utilities/hv_util.c Modified: head/sys/conf/files.amd64 head/sys/conf/files.i386 head/sys/modules/hyperv/utilities/Makefile Modified: head/sys/conf/files.amd64 ============================================================================== --- head/sys/conf/files.amd64 Tue Dec 20 05:45:52 2016 (r310316) +++ head/sys/conf/files.amd64 Tue Dec 20 07:14:24 2016 (r310317) @@ -303,7 +303,7 @@ dev/hyperv/utilities/hv_kvp.c optiona dev/hyperv/utilities/hv_snapshot.c optional hyperv dev/hyperv/utilities/hv_shutdown.c optional hyperv dev/hyperv/utilities/hv_timesync.c optional hyperv -dev/hyperv/utilities/hv_util.c optional hyperv +dev/hyperv/utilities/vmbus_ic.c optional hyperv dev/hyperv/vmbus/hyperv.c optional hyperv dev/hyperv/vmbus/hyperv_busdma.c optional hyperv dev/hyperv/vmbus/vmbus.c optional hyperv pci Modified: head/sys/conf/files.i386 ============================================================================== --- head/sys/conf/files.i386 Tue Dec 20 05:45:52 2016 (r310316) +++ head/sys/conf/files.i386 Tue Dec 20 07:14:24 2016 (r310317) @@ -259,7 +259,7 @@ dev/hyperv/utilities/hv_kvp.c optiona dev/hyperv/utilities/hv_snapshot.c optional hyperv dev/hyperv/utilities/hv_shutdown.c optional hyperv dev/hyperv/utilities/hv_timesync.c optional hyperv -dev/hyperv/utilities/hv_util.c optional hyperv +dev/hyperv/utilities/vmbus_ic.c optional hyperv dev/hyperv/vmbus/hyperv.c optional hyperv dev/hyperv/vmbus/hyperv_busdma.c optional hyperv dev/hyperv/vmbus/vmbus.c optional hyperv pci Copied: head/sys/dev/hyperv/utilities/vmbus_ic.c (from r310316, head/sys/dev/hyperv/utilities/hv_util.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/dev/hyperv/utilities/vmbus_ic.c Tue Dec 20 07:14:24 2016 (r310317, copy of r310316, head/sys/dev/hyperv/utilities/hv_util.c) @@ -0,0 +1,299 @@ +/*- + * Copyright (c) 2014,2016 Microsoft Corp. + * 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 unmodified, 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 ``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 BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +#include "vmbus_if.h" + +#define VMBUS_IC_BRSIZE (4 * PAGE_SIZE) + +#define VMBUS_IC_VERCNT 2 +#define VMBUS_IC_NEGOSZ \ + __offsetof(struct vmbus_icmsg_negotiate, ic_ver[VMBUS_IC_VERCNT]) +CTASSERT(VMBUS_IC_NEGOSZ < VMBUS_IC_BRSIZE); + +static int vmbus_ic_fwver_sysctl(SYSCTL_HANDLER_ARGS); +static int vmbus_ic_msgver_sysctl(SYSCTL_HANDLER_ARGS); + +int +vmbus_ic_negomsg(struct vmbus_ic_softc *sc, void *data, int *dlen0, + uint32_t fw_ver, uint32_t msg_ver) +{ + struct vmbus_icmsg_negotiate *nego; + int i, cnt, dlen = *dlen0, error; + uint32_t sel_fw_ver, sel_msg_ver; + bool has_fw_ver, has_msg_ver; + + /* + * Preliminary message verification. + */ + if (dlen < sizeof(*nego)) { + device_printf(sc->ic_dev, "truncated ic negotiate, len %d\n", + dlen); + return (EINVAL); + } + nego = data; + + if (nego->ic_fwver_cnt == 0) { + device_printf(sc->ic_dev, "ic negotiate does not contain " + "framework version %u\n", nego->ic_fwver_cnt); + return (EINVAL); + } + if (nego->ic_msgver_cnt == 0) { + device_printf(sc->ic_dev, "ic negotiate does not contain " + "message version %u\n", nego->ic_msgver_cnt); + return (EINVAL); + } + + cnt = nego->ic_fwver_cnt + nego->ic_msgver_cnt; + if (dlen < __offsetof(struct vmbus_icmsg_negotiate, ic_ver[cnt])) { + device_printf(sc->ic_dev, "ic negotiate does not contain " + "versions %d\n", dlen); + return (EINVAL); + } + + error = EOPNOTSUPP; + + /* + * Find the best match framework version. + */ + has_fw_ver = false; + for (i = 0; i < nego->ic_fwver_cnt; ++i) { + if (VMBUS_ICVER_LE(nego->ic_ver[i], fw_ver)) { + if (!has_fw_ver) { + sel_fw_ver = nego->ic_ver[i]; + has_fw_ver = true; + } else if (VMBUS_ICVER_GT(nego->ic_ver[i], + sel_fw_ver)) { + sel_fw_ver = nego->ic_ver[i]; + } + } + } + if (!has_fw_ver) { + device_printf(sc->ic_dev, "failed to select framework " + "version\n"); + goto done; + } + + /* + * Fine the best match message version. + */ + has_msg_ver = false; + for (i = nego->ic_fwver_cnt; + i < nego->ic_fwver_cnt + nego->ic_msgver_cnt; ++i) { + if (VMBUS_ICVER_LE(nego->ic_ver[i], msg_ver)) { + if (!has_msg_ver) { + sel_msg_ver = nego->ic_ver[i]; + has_msg_ver = true; + } else if (VMBUS_ICVER_GT(nego->ic_ver[i], + sel_msg_ver)) { + sel_msg_ver = nego->ic_ver[i]; + } + } + } + if (!has_msg_ver) { + device_printf(sc->ic_dev, "failed to select message " + "version\n"); + goto done; + } + + error = 0; +done: + if (bootverbose || !has_fw_ver || !has_msg_ver) { + if (has_fw_ver) { + device_printf(sc->ic_dev, "sel framework version: " + "%u.%u\n", + VMBUS_ICVER_MAJOR(sel_fw_ver), + VMBUS_ICVER_MINOR(sel_fw_ver)); + } + for (i = 0; i < nego->ic_fwver_cnt; i++) { + device_printf(sc->ic_dev, "supp framework version: " + "%u.%u\n", + VMBUS_ICVER_MAJOR(nego->ic_ver[i]), + VMBUS_ICVER_MINOR(nego->ic_ver[i])); + } + + if (has_msg_ver) { + device_printf(sc->ic_dev, "sel message version: " + "%u.%u\n", + VMBUS_ICVER_MAJOR(sel_msg_ver), + VMBUS_ICVER_MINOR(sel_msg_ver)); + } + for (i = nego->ic_fwver_cnt; + i < nego->ic_fwver_cnt + nego->ic_msgver_cnt; i++) { + device_printf(sc->ic_dev, "supp message version: " + "%u.%u\n", + VMBUS_ICVER_MAJOR(nego->ic_ver[i]), + VMBUS_ICVER_MINOR(nego->ic_ver[i])); + } + } + if (error) + return (error); + + /* Record the selected versions. */ + sc->ic_fwver = sel_fw_ver; + sc->ic_msgver = sel_msg_ver; + + /* One framework version. */ + nego->ic_fwver_cnt = 1; + nego->ic_ver[0] = sel_fw_ver; + + /* One message version. */ + nego->ic_msgver_cnt = 1; + nego->ic_ver[1] = sel_msg_ver; + + /* Update data size. */ + nego->ic_hdr.ic_dsize = VMBUS_IC_NEGOSZ - + sizeof(struct vmbus_icmsg_hdr); + + /* Update total size, if necessary. */ + if (dlen < VMBUS_IC_NEGOSZ) + *dlen0 = VMBUS_IC_NEGOSZ; + + return (0); +} + +int +vmbus_ic_probe(device_t dev, const struct vmbus_ic_desc descs[]) +{ + device_t bus = device_get_parent(dev); + const struct vmbus_ic_desc *d; + + if (resource_disabled(device_get_name(dev), 0)) + return (ENXIO); + + for (d = descs; d->ic_desc != NULL; ++d) { + if (VMBUS_PROBE_GUID(bus, dev, &d->ic_guid) == 0) { + device_set_desc(dev, d->ic_desc); + return (BUS_PROBE_DEFAULT); + } + } + return (ENXIO); +} + +int +vmbus_ic_attach(device_t dev, vmbus_chan_callback_t cb) +{ + struct vmbus_ic_softc *sc = device_get_softc(dev); + struct vmbus_channel *chan = vmbus_get_channel(dev); + struct sysctl_oid_list *child; + struct sysctl_ctx_list *ctx; + int error; + + sc->ic_dev = dev; + sc->ic_buflen = VMBUS_IC_BRSIZE; + sc->ic_buf = malloc(VMBUS_IC_BRSIZE, M_DEVBUF, M_WAITOK | M_ZERO); + + /* + * These services are not performance critical and do not need + * batched reading. Furthermore, some services such as KVP can + * only handle one message from the host at a time. + * Turn off batched reading for all util drivers before we open the + * channel. + */ + vmbus_chan_set_readbatch(chan, false); + + error = vmbus_chan_open(chan, VMBUS_IC_BRSIZE, VMBUS_IC_BRSIZE, NULL, 0, + cb, sc); + if (error) { + free(sc->ic_buf, M_DEVBUF); + return (error); + } + + ctx = device_get_sysctl_ctx(dev); + child = SYSCTL_CHILDREN(device_get_sysctl_tree(dev)); + SYSCTL_ADD_PROC(ctx, child, OID_AUTO, "fw_version", + CTLTYPE_STRING | CTLFLAG_RD | CTLFLAG_MPSAFE, sc, 0, + vmbus_ic_fwver_sysctl, "A", "framework version"); + SYSCTL_ADD_PROC(ctx, child, OID_AUTO, "msg_version", + CTLTYPE_STRING | CTLFLAG_RD | CTLFLAG_MPSAFE, sc, 0, + vmbus_ic_msgver_sysctl, "A", "message version"); + + return (0); +} + +static int +vmbus_ic_fwver_sysctl(SYSCTL_HANDLER_ARGS) +{ + struct vmbus_ic_softc *sc = arg1; + char verstr[16]; + + snprintf(verstr, sizeof(verstr), "%u.%u", + VMBUS_ICVER_MAJOR(sc->ic_fwver), VMBUS_ICVER_MINOR(sc->ic_fwver)); + return sysctl_handle_string(oidp, verstr, sizeof(verstr), req); +} + +static int +vmbus_ic_msgver_sysctl(SYSCTL_HANDLER_ARGS) +{ + struct vmbus_ic_softc *sc = arg1; + char verstr[16]; + + snprintf(verstr, sizeof(verstr), "%u.%u", + VMBUS_ICVER_MAJOR(sc->ic_msgver), VMBUS_ICVER_MINOR(sc->ic_msgver)); + return sysctl_handle_string(oidp, verstr, sizeof(verstr), req); +} + +int +vmbus_ic_detach(device_t dev) +{ + struct vmbus_ic_softc *sc = device_get_softc(dev); + + vmbus_chan_close(vmbus_get_channel(dev)); + free(sc->ic_buf, M_DEVBUF); + + return (0); +} + +int +vmbus_ic_sendresp(struct vmbus_ic_softc *sc, struct vmbus_channel *chan, + void *data, int dlen, uint64_t xactid) +{ + struct vmbus_icmsg_hdr *hdr; + int error; + + KASSERT(dlen >= sizeof(*hdr), ("invalid data length %d", dlen)); + hdr = data; + + hdr->ic_flags = VMBUS_ICMSG_FLAG_XACT | VMBUS_ICMSG_FLAG_RESP; + error = vmbus_chan_send(chan, VMBUS_CHANPKT_TYPE_INBAND, 0, + data, dlen, xactid); + if (error) + device_printf(sc->ic_dev, "resp send failed: %d\n", error); + return (error); +} Modified: head/sys/modules/hyperv/utilities/Makefile ============================================================================== --- head/sys/modules/hyperv/utilities/Makefile Tue Dec 20 05:45:52 2016 (r310316) +++ head/sys/modules/hyperv/utilities/Makefile Tue Dec 20 07:14:24 2016 (r310317) @@ -3,7 +3,12 @@ .PATH: ${.CURDIR}/../../../dev/hyperv/utilities KMOD= hv_utils -SRCS= hv_util.c hv_kvp.c hv_snapshot.c hv_timesync.c hv_shutdown.c hv_heartbeat.c hv_snapshot.c +SRCS= vmbus_ic.c +SRCS+= hv_heartbeat.c +SRCS+= hv_kvp.c +SRCS+= hv_shutdown.c +SRCS+= hv_snapshot.c +SRCS+= hv_timesync.c SRCS+= bus_if.h device_if.h vmbus_if.h CFLAGS+= -I${.CURDIR}/../../../dev/hyperv/include \ From owner-svn-src-all@freebsd.org Tue Dec 20 07:34:46 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 26845C8971D; Tue, 20 Dec 2016 07:34:46 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 011BD1D1B; Tue, 20 Dec 2016 07:34:45 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBK7YjY3035526; Tue, 20 Dec 2016 07:34:45 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBK7YirF035523; Tue, 20 Dec 2016 07:34:44 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201612200734.uBK7YirF035523@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Tue, 20 Dec 2016 07:34:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310318 - head/sys/dev/hyperv/utilities X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Dec 2016 07:34:46 -0000 Author: sephe Date: Tue Dec 20 07:34:44 2016 New Revision: 310318 URL: https://svnweb.freebsd.org/changeset/base/310318 Log: hyperv/ic: Cleanup driver glue. MFC after: 1 week Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D8849 Modified: head/sys/dev/hyperv/utilities/hv_heartbeat.c head/sys/dev/hyperv/utilities/hv_shutdown.c head/sys/dev/hyperv/utilities/hv_timesync.c Modified: head/sys/dev/hyperv/utilities/hv_heartbeat.c ============================================================================== --- head/sys/dev/hyperv/utilities/hv_heartbeat.c Tue Dec 20 07:14:24 2016 (r310317) +++ head/sys/dev/hyperv/utilities/hv_heartbeat.c Tue Dec 20 07:34:44 2016 (r310318) @@ -46,6 +46,9 @@ __FBSDID("$FreeBSD$"); #define VMBUS_HEARTBEAT_MSGVER \ VMBUS_IC_VERSION(VMBUS_HEARTBEAT_MSGVER_MAJOR, 0) +static int vmbus_heartbeat_probe(device_t); +static int vmbus_heartbeat_attach(device_t); + static const struct vmbus_ic_desc vmbus_heartbeat_descs[] = { { .ic_guid = { .hv_guid = { @@ -56,6 +59,27 @@ static const struct vmbus_ic_desc vmbus_ VMBUS_IC_DESC_END }; +static device_method_t vmbus_heartbeat_methods[] = { + /* Device interface */ + DEVMETHOD(device_probe, vmbus_heartbeat_probe), + DEVMETHOD(device_attach, vmbus_heartbeat_attach), + DEVMETHOD(device_detach, vmbus_ic_detach), + DEVMETHOD_END +}; + +static driver_t vmbus_heartbeat_driver = { + "hvheartbeat", + vmbus_heartbeat_methods, + sizeof(struct vmbus_ic_softc) +}; + +static devclass_t vmbus_heartbeat_devclass; + +DRIVER_MODULE(hv_heartbeat, vmbus, vmbus_heartbeat_driver, + vmbus_heartbeat_devclass, NULL, NULL); +MODULE_VERSION(hv_heartbeat, 1); +MODULE_DEPEND(hv_heartbeat, vmbus, 1, 1, 1); + static void vmbus_heartbeat_cb(struct vmbus_channel *chan, void *xsc) { @@ -114,35 +138,15 @@ vmbus_heartbeat_cb(struct vmbus_channel } static int -hv_heartbeat_probe(device_t dev) +vmbus_heartbeat_probe(device_t dev) { return (vmbus_ic_probe(dev, vmbus_heartbeat_descs)); } static int -hv_heartbeat_attach(device_t dev) +vmbus_heartbeat_attach(device_t dev) { return (vmbus_ic_attach(dev, vmbus_heartbeat_cb)); } - -static device_method_t heartbeat_methods[] = { - /* Device interface */ - DEVMETHOD(device_probe, hv_heartbeat_probe), - DEVMETHOD(device_attach, hv_heartbeat_attach), - DEVMETHOD(device_detach, vmbus_ic_detach), - { 0, 0 } -}; - -static driver_t heartbeat_driver = { - "hvheartbeat", - heartbeat_methods, - sizeof(struct vmbus_ic_softc) -}; - -static devclass_t heartbeat_devclass; - -DRIVER_MODULE(hv_heartbeat, vmbus, heartbeat_driver, heartbeat_devclass, NULL, NULL); -MODULE_VERSION(hv_heartbeat, 1); -MODULE_DEPEND(hv_heartbeat, vmbus, 1, 1, 1); Modified: head/sys/dev/hyperv/utilities/hv_shutdown.c ============================================================================== --- head/sys/dev/hyperv/utilities/hv_shutdown.c Tue Dec 20 07:14:24 2016 (r310317) +++ head/sys/dev/hyperv/utilities/hv_shutdown.c Tue Dec 20 07:34:44 2016 (r310318) @@ -47,6 +47,9 @@ __FBSDID("$FreeBSD$"); #define VMBUS_SHUTDOWN_MSGVER \ VMBUS_IC_VERSION(VMBUS_SHUTDOWN_MSGVER_MAJOR, 0) +static int vmbus_shutdown_probe(device_t); +static int vmbus_shutdown_attach(device_t); + static const struct vmbus_ic_desc vmbus_shutdown_descs[] = { { .ic_guid = { .hv_guid = { @@ -57,6 +60,27 @@ static const struct vmbus_ic_desc vmbus_ VMBUS_IC_DESC_END }; +static device_method_t vmbus_shutdown_methods[] = { + /* Device interface */ + DEVMETHOD(device_probe, vmbus_shutdown_probe), + DEVMETHOD(device_attach, vmbus_shutdown_attach), + DEVMETHOD(device_detach, vmbus_ic_detach), + DEVMETHOD_END +}; + +static driver_t vmbus_shutdown_driver = { + "hvshutdown", + vmbus_shutdown_methods, + sizeof(struct vmbus_ic_softc) +}; + +static devclass_t vmbus_shutdown_devclass; + +DRIVER_MODULE(hv_shutdown, vmbus, vmbus_shutdown_driver, + vmbus_shutdown_devclass, NULL, NULL); +MODULE_VERSION(hv_shutdown, 1); +MODULE_DEPEND(hv_shutdown, vmbus, 1, 1, 1); + static void vmbus_shutdown_cb(struct vmbus_channel *chan, void *xsc) { @@ -129,35 +153,15 @@ vmbus_shutdown_cb(struct vmbus_channel * } static int -hv_shutdown_probe(device_t dev) +vmbus_shutdown_probe(device_t dev) { return (vmbus_ic_probe(dev, vmbus_shutdown_descs)); } static int -hv_shutdown_attach(device_t dev) +vmbus_shutdown_attach(device_t dev) { return (vmbus_ic_attach(dev, vmbus_shutdown_cb)); } - -static device_method_t shutdown_methods[] = { - /* Device interface */ - DEVMETHOD(device_probe, hv_shutdown_probe), - DEVMETHOD(device_attach, hv_shutdown_attach), - DEVMETHOD(device_detach, vmbus_ic_detach), - { 0, 0 } -}; - -static driver_t shutdown_driver = { - "hvshutdown", - shutdown_methods, - sizeof(struct vmbus_ic_softc) -}; - -static devclass_t shutdown_devclass; - -DRIVER_MODULE(hv_shutdown, vmbus, shutdown_driver, shutdown_devclass, NULL, NULL); -MODULE_VERSION(hv_shutdown, 1); -MODULE_DEPEND(hv_shutdown, vmbus, 1, 1, 1); Modified: head/sys/dev/hyperv/utilities/hv_timesync.c ============================================================================== --- head/sys/dev/hyperv/utilities/hv_timesync.c Tue Dec 20 07:14:24 2016 (r310317) +++ head/sys/dev/hyperv/utilities/hv_timesync.c Tue Dec 20 07:34:44 2016 (r310318) @@ -52,6 +52,9 @@ __FBSDID("$FreeBSD$"); ((sc)->ic_msgver >= VMBUS_IC_VERSION(4, 0) && \ (hyperv_features & CPUID_HV_MSR_TIME_REFCNT)) +static int vmbus_timesync_probe(device_t); +static int vmbus_timesync_attach(device_t); + static const struct vmbus_ic_desc vmbus_timesync_descs[] = { { .ic_guid = { .hv_guid = { @@ -62,6 +65,27 @@ static const struct vmbus_ic_desc vmbus_ VMBUS_IC_DESC_END }; +static device_method_t vmbus_timesync_methods[] = { + /* Device interface */ + DEVMETHOD(device_probe, vmbus_timesync_probe), + DEVMETHOD(device_attach, vmbus_timesync_attach), + DEVMETHOD(device_detach, vmbus_ic_detach), + DEVMETHOD_END +}; + +static driver_t vmbus_timesync_driver = { + "hvtimesync", + vmbus_timesync_methods, + sizeof(struct vmbus_ic_softc) +}; + +static devclass_t vmbus_timesync_devclass; + +DRIVER_MODULE(hv_timesync, vmbus, vmbus_timesync_driver, + vmbus_timesync_devclass, NULL, NULL); +MODULE_VERSION(hv_timesync, 1); +MODULE_DEPEND(hv_timesync, vmbus, 1, 1, 1); + SYSCTL_NODE(_hw, OID_AUTO, hvtimesync, CTLFLAG_RW | CTLFLAG_MPSAFE, NULL, "Hyper-V timesync interface"); @@ -207,35 +231,15 @@ vmbus_timesync_cb(struct vmbus_channel * } static int -hv_timesync_probe(device_t dev) +vmbus_timesync_probe(device_t dev) { return (vmbus_ic_probe(dev, vmbus_timesync_descs)); } static int -hv_timesync_attach(device_t dev) +vmbus_timesync_attach(device_t dev) { return (vmbus_ic_attach(dev, vmbus_timesync_cb)); } - -static device_method_t timesync_methods[] = { - /* Device interface */ - DEVMETHOD(device_probe, hv_timesync_probe), - DEVMETHOD(device_attach, hv_timesync_attach), - DEVMETHOD(device_detach, vmbus_ic_detach), - { 0, 0 } -}; - -static driver_t timesync_driver = { - "hvtimesync", - timesync_methods, - sizeof(struct vmbus_ic_softc) -}; - -static devclass_t timesync_devclass; - -DRIVER_MODULE(hv_timesync, vmbus, timesync_driver, timesync_devclass, NULL, NULL); -MODULE_VERSION(hv_timesync, 1); -MODULE_DEPEND(hv_timesync, vmbus, 1, 1, 1); From owner-svn-src-all@freebsd.org Tue Dec 20 07:42:16 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id F2191C89AD2; Tue, 20 Dec 2016 07:42:16 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C14A8122D; Tue, 20 Dec 2016 07:42:16 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBK7gFgT039480; Tue, 20 Dec 2016 07:42:15 GMT (envelope-from ed@FreeBSD.org) Received: (from ed@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBK7gF64039478; Tue, 20 Dec 2016 07:42:15 GMT (envelope-from ed@FreeBSD.org) Message-Id: <201612200742.uBK7gF64039478@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ed set sender to ed@FreeBSD.org using -f From: Ed Schouten Date: Tue, 20 Dec 2016 07:42:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r310319 - stable/11/lib/libc/gen X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Dec 2016 07:42:17 -0000 Author: ed Date: Tue Dec 20 07:42:15 2016 New Revision: 310319 URL: https://svnweb.freebsd.org/changeset/base/310319 Log: MFC r309650: Properly sign extend the result of jrand48() and mrand48(). These functions are supposed to return a value between [-2^31, 2^31). This doesn't seem to work on 64-bit systems, where we return a value between [0, 3^32). Patch up the function to use proper casts to int32_t. While there, fix some other style bugs. Modified: stable/11/lib/libc/gen/jrand48.c stable/11/lib/libc/gen/mrand48.c Directory Properties: stable/11/ (props changed) Modified: stable/11/lib/libc/gen/jrand48.c ============================================================================== --- stable/11/lib/libc/gen/jrand48.c Tue Dec 20 07:34:44 2016 (r310318) +++ stable/11/lib/libc/gen/jrand48.c Tue Dec 20 07:42:15 2016 (r310319) @@ -14,11 +14,14 @@ #include __FBSDID("$FreeBSD$"); +#include + #include "rand48.h" long jrand48(unsigned short xseed[3]) { + _dorand48(xseed); - return ((long) xseed[2] << 16) + (long) xseed[1]; + return ((int32_t)(((uint32_t)xseed[2] << 16) | (uint32_t)xseed[1])); } Modified: stable/11/lib/libc/gen/mrand48.c ============================================================================== --- stable/11/lib/libc/gen/mrand48.c Tue Dec 20 07:34:44 2016 (r310318) +++ stable/11/lib/libc/gen/mrand48.c Tue Dec 20 07:42:15 2016 (r310319) @@ -14,6 +14,8 @@ #include __FBSDID("$FreeBSD$"); +#include + #include "rand48.h" extern unsigned short _rand48_seed[3]; @@ -21,6 +23,8 @@ extern unsigned short _rand48_seed[3]; long mrand48(void) { + _dorand48(_rand48_seed); - return ((long) _rand48_seed[2] << 16) + (long) _rand48_seed[1]; + return ((int32_t)(((uint32_t)_rand48_seed[2] << 16) | + (uint32_t)_rand48_seed[1])); } From owner-svn-src-all@freebsd.org Tue Dec 20 07:50:50 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id DD588C89BD4; Tue, 20 Dec 2016 07:50:50 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A57CB15CC; Tue, 20 Dec 2016 07:50:50 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBK7on9k040782; Tue, 20 Dec 2016 07:50:49 GMT (envelope-from ed@FreeBSD.org) Received: (from ed@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBK7onvx040780; Tue, 20 Dec 2016 07:50:49 GMT (envelope-from ed@FreeBSD.org) Message-Id: <201612200750.uBK7onvx040780@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ed set sender to ed@FreeBSD.org using -f From: Ed Schouten Date: Tue, 20 Dec 2016 07:50:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r310320 - stable/10/lib/libc/gen X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Dec 2016 07:50:51 -0000 Author: ed Date: Tue Dec 20 07:50:49 2016 New Revision: 310320 URL: https://svnweb.freebsd.org/changeset/base/310320 Log: MFC r309650: Properly sign extend the result of jrand48() and mrand48(). These functions are supposed to return a value between [-2^31, 2^31). This doesn't seem to work on 64-bit systems, where we return a value between [0, 3^32). Patch up the function to use proper casts to int32_t. While there, fix some other style bugs. Modified: stable/10/lib/libc/gen/jrand48.c stable/10/lib/libc/gen/mrand48.c Directory Properties: stable/10/ (props changed) Modified: stable/10/lib/libc/gen/jrand48.c ============================================================================== --- stable/10/lib/libc/gen/jrand48.c Tue Dec 20 07:42:15 2016 (r310319) +++ stable/10/lib/libc/gen/jrand48.c Tue Dec 20 07:50:49 2016 (r310320) @@ -14,11 +14,14 @@ #include __FBSDID("$FreeBSD$"); +#include + #include "rand48.h" long jrand48(unsigned short xseed[3]) { + _dorand48(xseed); - return ((long) xseed[2] << 16) + (long) xseed[1]; + return ((int32_t)(((uint32_t)xseed[2] << 16) | (uint32_t)xseed[1])); } Modified: stable/10/lib/libc/gen/mrand48.c ============================================================================== --- stable/10/lib/libc/gen/mrand48.c Tue Dec 20 07:42:15 2016 (r310319) +++ stable/10/lib/libc/gen/mrand48.c Tue Dec 20 07:50:49 2016 (r310320) @@ -14,6 +14,8 @@ #include __FBSDID("$FreeBSD$"); +#include + #include "rand48.h" extern unsigned short _rand48_seed[3]; @@ -21,6 +23,8 @@ extern unsigned short _rand48_seed[3]; long mrand48(void) { + _dorand48(_rand48_seed); - return ((long) _rand48_seed[2] << 16) + (long) _rand48_seed[1]; + return ((int32_t)(((uint32_t)_rand48_seed[2] << 16) | + (uint32_t)_rand48_seed[1])); } From owner-svn-src-all@freebsd.org Tue Dec 20 08:01:18 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5BD55C89FE9; Tue, 20 Dec 2016 08:01:18 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 2B18A1C0F; Tue, 20 Dec 2016 08:01:18 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBK81H4s046850; Tue, 20 Dec 2016 08:01:17 GMT (envelope-from ed@FreeBSD.org) Received: (from ed@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBK81HV3046847; Tue, 20 Dec 2016 08:01:17 GMT (envelope-from ed@FreeBSD.org) Message-Id: <201612200801.uBK81HV3046847@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ed set sender to ed@FreeBSD.org using -f From: Ed Schouten Date: Tue, 20 Dec 2016 08:01:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r310321 - stable/9/lib/libc/gen X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Dec 2016 08:01:18 -0000 Author: ed Date: Tue Dec 20 08:01:17 2016 New Revision: 310321 URL: https://svnweb.freebsd.org/changeset/base/310321 Log: MFC r309650: Properly sign extend the result of jrand48() and mrand48(). These functions are supposed to return a value between [-2^31, 2^31). This doesn't seem to work on 64-bit systems, where we return a value between [0, 3^32). Patch up the function to use proper casts to int32_t. While there, fix some other style bugs. Modified: stable/9/lib/libc/gen/jrand48.c stable/9/lib/libc/gen/mrand48.c Directory Properties: stable/9/lib/libc/ (props changed) Modified: stable/9/lib/libc/gen/jrand48.c ============================================================================== --- stable/9/lib/libc/gen/jrand48.c Tue Dec 20 07:50:49 2016 (r310320) +++ stable/9/lib/libc/gen/jrand48.c Tue Dec 20 08:01:17 2016 (r310321) @@ -14,11 +14,14 @@ #include __FBSDID("$FreeBSD$"); +#include + #include "rand48.h" long jrand48(unsigned short xseed[3]) { + _dorand48(xseed); - return ((long) xseed[2] << 16) + (long) xseed[1]; + return ((int32_t)(((uint32_t)xseed[2] << 16) | (uint32_t)xseed[1])); } Modified: stable/9/lib/libc/gen/mrand48.c ============================================================================== --- stable/9/lib/libc/gen/mrand48.c Tue Dec 20 07:50:49 2016 (r310320) +++ stable/9/lib/libc/gen/mrand48.c Tue Dec 20 08:01:17 2016 (r310321) @@ -14,6 +14,8 @@ #include __FBSDID("$FreeBSD$"); +#include + #include "rand48.h" extern unsigned short _rand48_seed[3]; @@ -21,6 +23,8 @@ extern unsigned short _rand48_seed[3]; long mrand48(void) { + _dorand48(_rand48_seed); - return ((long) _rand48_seed[2] << 16) + (long) _rand48_seed[1]; + return ((int32_t)(((uint32_t)_rand48_seed[2] << 16) | + (uint32_t)_rand48_seed[1])); } From owner-svn-src-all@freebsd.org Tue Dec 20 08:42:48 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 797A9C86F93; Tue, 20 Dec 2016 08:42:48 +0000 (UTC) (envelope-from cperciva@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 1D44F101A; Tue, 20 Dec 2016 08:42:48 +0000 (UTC) (envelope-from cperciva@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBK8glO0063468; Tue, 20 Dec 2016 08:42:47 GMT (envelope-from cperciva@FreeBSD.org) Received: (from cperciva@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBK8gl9l063467; Tue, 20 Dec 2016 08:42:47 GMT (envelope-from cperciva@FreeBSD.org) Message-Id: <201612200842.uBK8gl9l063467@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cperciva set sender to cperciva@FreeBSD.org using -f From: Colin Percival Date: Tue, 20 Dec 2016 08:42:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r310322 - stable/10/sys/fs/nfs X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Dec 2016 08:42:48 -0000 Author: cperciva Date: Tue Dec 20 08:42:47 2016 New Revision: 310322 URL: https://svnweb.freebsd.org/changeset/base/310322 Log: MFC r308708: Reduce verbosity of warnings about truncating NFS fileids to 32-bit inode numbers. Modified: stable/10/sys/fs/nfs/nfs_commonsubs.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/fs/nfs/nfs_commonsubs.c ============================================================================== --- stable/10/sys/fs/nfs/nfs_commonsubs.c Tue Dec 20 08:01:17 2016 (r310321) +++ stable/10/sys/fs/nfs/nfs_commonsubs.c Tue Dec 20 08:42:47 2016 (r310322) @@ -827,6 +827,11 @@ nfsv4_loadattr(struct nfsrv_descript *nd struct dqblk dqb; uid_t savuid; #endif + static struct timeval last64fileid; + static size_t count64fileid; + static struct timeval last64mountfileid; + static size_t count64mountfileid; + static struct timeval warninterval = { 60, 0 }; if (compare) { retnotsup = 0; @@ -1196,8 +1201,14 @@ nfsv4_loadattr(struct nfsrv_descript *nd *retcmpp = NFSERR_NOTSAME; } } else if (nap != NULL) { - if (*tl++) - printf("NFSv4 fileid > 32bits\n"); + if (*tl++) { + count64fileid++; + if (ratecheck(&last64fileid, &warninterval)) { + printf("NFSv4 fileid > 32bits (%zu occurrences)\n", + count64fileid); + count64fileid = 0; + } + } nap->na_fileid = thyp; } attrsum += NFSX_HYPER; @@ -1734,8 +1745,14 @@ nfsv4_loadattr(struct nfsrv_descript *nd } } } else if (nap != NULL) { - if (*tl++) - printf("NFSv4 mounted on fileid > 32bits\n"); + if (*tl++) { + count64mountfileid++; + if (ratecheck(&last64mountfileid, &warninterval)) { + printf("NFSv4 mounted on fileid > 32bits (%zu occurrences)\n", + count64mountfileid); + count64mountfileid = 0; + } + } nap->na_mntonfileno = thyp; } attrsum += NFSX_HYPER; From owner-svn-src-all@freebsd.org Tue Dec 20 08:49:14 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 44F36C880D9; Tue, 20 Dec 2016 08:49:14 +0000 (UTC) (envelope-from hrs@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 149ED12E0; Tue, 20 Dec 2016 08:49:14 +0000 (UTC) (envelope-from hrs@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBK8nD8B063723; Tue, 20 Dec 2016 08:49:13 GMT (envelope-from hrs@FreeBSD.org) Received: (from hrs@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBK8nDbq063722; Tue, 20 Dec 2016 08:49:13 GMT (envelope-from hrs@FreeBSD.org) Message-Id: <201612200849.uBK8nDbq063722@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hrs set sender to hrs@FreeBSD.org using -f From: Hiroki Sato Date: Tue, 20 Dec 2016 08:49:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310323 - head/usr.sbin/syslogd X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Dec 2016 08:49:14 -0000 Author: hrs Date: Tue Dec 20 08:49:13 2016 New Revision: 310323 URL: https://svnweb.freebsd.org/changeset/base/310323 Log: Escape punctuation characters. Modified: head/usr.sbin/syslogd/syslogd.8 Modified: head/usr.sbin/syslogd/syslogd.8 ============================================================================== --- head/usr.sbin/syslogd/syslogd.8 Tue Dec 20 08:42:47 2016 (r310322) +++ head/usr.sbin/syslogd/syslogd.8 Tue Dec 20 08:49:13 2016 (r310323) @@ -40,7 +40,7 @@ .Op Fl a Ar allowed_peer .Op Fl b Ar bind_address .Op Fl f Ar config_file -.Op Fl l Oo Ar mode : Oc Ns Ar path +.Op Fl l Oo Ar mode \&: Oc Ns Ar path .Op Fl m Ar mark_interval .Op Fl P Ar pid_file .Op Fl p Ar log_socket @@ -103,7 +103,7 @@ option may be any of the following: .Sm off .Ar ipaddr .No / Ar masklen -.Op : Ar service +.Op \&: Ar service .Sm on .Xc Accept datagrams from @@ -145,7 +145,7 @@ is IPv6 address, a missing will be substituted by 128. .It Xo .Sm off -.Ar domainname Op : Ar service +.Ar domainname Op \&: Ar service .Sm on .Xc Accept datagrams where the reverse address lookup yields @@ -156,7 +156,7 @@ The meaning of is as explained above. .It Xo .Sm off -.No * Ar domainname Op : Ar service +.No * Ar domainname Op \&: Ar service .Sm on .Xc Same as before, except that any source host whose name @@ -174,13 +174,13 @@ option is also specified. .It Xo .Fl b .Sm off -.Ar bind_address Op : Ar service +.Ar bind_address Op \&: Ar service .Sm on .Xc .It Xo .Fl b .Sm off -.Li : Ar service +.Li \&: Ar service .Sm on .Xc Bind to a specific address and/or port. From owner-svn-src-all@freebsd.org Tue Dec 20 09:46:16 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 07C72C8755C; Tue, 20 Dec 2016 09:46:16 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C44D2112; Tue, 20 Dec 2016 09:46:15 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBK9kFC1088341; Tue, 20 Dec 2016 09:46:15 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBK9kEJp088335; Tue, 20 Dec 2016 09:46:14 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201612200946.uBK9kEJp088335@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Tue, 20 Dec 2016 09:46:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310324 - in head/sys: conf dev/hyperv/utilities modules/hyperv/utilities X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Dec 2016 09:46:16 -0000 Author: sephe Date: Tue Dec 20 09:46:14 2016 New Revision: 310324 URL: https://svnweb.freebsd.org/changeset/base/310324 Log: hyperv/ic: Rename cleaned up files. MFC after: 1 week Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D8850 Added: head/sys/dev/hyperv/utilities/vmbus_heartbeat.c - copied unchanged from r310323, head/sys/dev/hyperv/utilities/hv_heartbeat.c head/sys/dev/hyperv/utilities/vmbus_shutdown.c - copied unchanged from r310323, head/sys/dev/hyperv/utilities/hv_shutdown.c head/sys/dev/hyperv/utilities/vmbus_timesync.c - copied unchanged from r310323, head/sys/dev/hyperv/utilities/hv_timesync.c Deleted: head/sys/dev/hyperv/utilities/hv_heartbeat.c head/sys/dev/hyperv/utilities/hv_shutdown.c head/sys/dev/hyperv/utilities/hv_timesync.c Modified: head/sys/conf/files.amd64 head/sys/conf/files.i386 head/sys/modules/hyperv/utilities/Makefile Modified: head/sys/conf/files.amd64 ============================================================================== --- head/sys/conf/files.amd64 Tue Dec 20 08:49:13 2016 (r310323) +++ head/sys/conf/files.amd64 Tue Dec 20 09:46:14 2016 (r310324) @@ -298,12 +298,12 @@ dev/hyperv/netvsc/hn_nvs.c optional h dev/hyperv/netvsc/hn_rndis.c optional hyperv dev/hyperv/netvsc/if_hn.c optional hyperv dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c optional hyperv -dev/hyperv/utilities/hv_heartbeat.c optional hyperv dev/hyperv/utilities/hv_kvp.c optional hyperv dev/hyperv/utilities/hv_snapshot.c optional hyperv -dev/hyperv/utilities/hv_shutdown.c optional hyperv -dev/hyperv/utilities/hv_timesync.c optional hyperv +dev/hyperv/utilities/vmbus_heartbeat.c optional hyperv dev/hyperv/utilities/vmbus_ic.c optional hyperv +dev/hyperv/utilities/vmbus_shutdown.c optional hyperv +dev/hyperv/utilities/vmbus_timesync.c optional hyperv dev/hyperv/vmbus/hyperv.c optional hyperv dev/hyperv/vmbus/hyperv_busdma.c optional hyperv dev/hyperv/vmbus/vmbus.c optional hyperv pci Modified: head/sys/conf/files.i386 ============================================================================== --- head/sys/conf/files.i386 Tue Dec 20 08:49:13 2016 (r310323) +++ head/sys/conf/files.i386 Tue Dec 20 09:46:14 2016 (r310324) @@ -254,12 +254,12 @@ dev/hyperv/netvsc/hn_nvs.c optional h dev/hyperv/netvsc/hn_rndis.c optional hyperv dev/hyperv/netvsc/if_hn.c optional hyperv dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c optional hyperv -dev/hyperv/utilities/hv_heartbeat.c optional hyperv dev/hyperv/utilities/hv_kvp.c optional hyperv dev/hyperv/utilities/hv_snapshot.c optional hyperv -dev/hyperv/utilities/hv_shutdown.c optional hyperv -dev/hyperv/utilities/hv_timesync.c optional hyperv +dev/hyperv/utilities/vmbus_heartbeat.c optional hyperv dev/hyperv/utilities/vmbus_ic.c optional hyperv +dev/hyperv/utilities/vmbus_shutdown.c optional hyperv +dev/hyperv/utilities/vmbus_timesync.c optional hyperv dev/hyperv/vmbus/hyperv.c optional hyperv dev/hyperv/vmbus/hyperv_busdma.c optional hyperv dev/hyperv/vmbus/vmbus.c optional hyperv pci Copied: head/sys/dev/hyperv/utilities/vmbus_heartbeat.c (from r310323, head/sys/dev/hyperv/utilities/hv_heartbeat.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/dev/hyperv/utilities/vmbus_heartbeat.c Tue Dec 20 09:46:14 2016 (r310324, copy of r310323, head/sys/dev/hyperv/utilities/hv_heartbeat.c) @@ -0,0 +1,152 @@ +/*- + * Copyright (c) 2014,2016 Microsoft Corp. + * 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 unmodified, 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 ``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 BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +#define VMBUS_HEARTBEAT_FWVER_MAJOR 3 +#define VMBUS_HEARTBEAT_FWVER \ + VMBUS_IC_VERSION(VMBUS_HEARTBEAT_FWVER_MAJOR, 0) + +#define VMBUS_HEARTBEAT_MSGVER_MAJOR 3 +#define VMBUS_HEARTBEAT_MSGVER \ + VMBUS_IC_VERSION(VMBUS_HEARTBEAT_MSGVER_MAJOR, 0) + +static int vmbus_heartbeat_probe(device_t); +static int vmbus_heartbeat_attach(device_t); + +static const struct vmbus_ic_desc vmbus_heartbeat_descs[] = { + { + .ic_guid = { .hv_guid = { + 0x39, 0x4f, 0x16, 0x57, 0x15, 0x91, 0x78, 0x4e, + 0xab, 0x55, 0x38, 0x2f, 0x3b, 0xd5, 0x42, 0x2d} }, + .ic_desc = "Hyper-V Heartbeat" + }, + VMBUS_IC_DESC_END +}; + +static device_method_t vmbus_heartbeat_methods[] = { + /* Device interface */ + DEVMETHOD(device_probe, vmbus_heartbeat_probe), + DEVMETHOD(device_attach, vmbus_heartbeat_attach), + DEVMETHOD(device_detach, vmbus_ic_detach), + DEVMETHOD_END +}; + +static driver_t vmbus_heartbeat_driver = { + "hvheartbeat", + vmbus_heartbeat_methods, + sizeof(struct vmbus_ic_softc) +}; + +static devclass_t vmbus_heartbeat_devclass; + +DRIVER_MODULE(hv_heartbeat, vmbus, vmbus_heartbeat_driver, + vmbus_heartbeat_devclass, NULL, NULL); +MODULE_VERSION(hv_heartbeat, 1); +MODULE_DEPEND(hv_heartbeat, vmbus, 1, 1, 1); + +static void +vmbus_heartbeat_cb(struct vmbus_channel *chan, void *xsc) +{ + struct vmbus_ic_softc *sc = xsc; + struct vmbus_icmsg_hdr *hdr; + int dlen, error; + uint64_t xactid; + void *data; + + /* + * Receive request. + */ + data = sc->ic_buf; + dlen = sc->ic_buflen; + error = vmbus_chan_recv(chan, data, &dlen, &xactid); + KASSERT(error != ENOBUFS, ("icbuf is not large enough")); + if (error) + return; + + if (dlen < sizeof(*hdr)) { + device_printf(sc->ic_dev, "invalid data len %d\n", dlen); + return; + } + hdr = data; + + /* + * Update request, which will be echoed back as response. + */ + switch (hdr->ic_type) { + case VMBUS_ICMSG_TYPE_NEGOTIATE: + error = vmbus_ic_negomsg(sc, data, &dlen, + VMBUS_HEARTBEAT_FWVER, VMBUS_HEARTBEAT_MSGVER); + if (error) + return; + break; + + case VMBUS_ICMSG_TYPE_HEARTBEAT: + /* Only ic_seq is a must */ + if (dlen < VMBUS_ICMSG_HEARTBEAT_SIZE_MIN) { + device_printf(sc->ic_dev, "invalid heartbeat len %d\n", + dlen); + return; + } + ((struct vmbus_icmsg_heartbeat *)data)->ic_seq++; + break; + + default: + device_printf(sc->ic_dev, "got 0x%08x icmsg\n", hdr->ic_type); + break; + } + + /* + * Send response by echoing the request back. + */ + vmbus_ic_sendresp(sc, chan, data, dlen, xactid); +} + +static int +vmbus_heartbeat_probe(device_t dev) +{ + + return (vmbus_ic_probe(dev, vmbus_heartbeat_descs)); +} + +static int +vmbus_heartbeat_attach(device_t dev) +{ + + return (vmbus_ic_attach(dev, vmbus_heartbeat_cb)); +} Copied: head/sys/dev/hyperv/utilities/vmbus_shutdown.c (from r310323, head/sys/dev/hyperv/utilities/hv_shutdown.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/dev/hyperv/utilities/vmbus_shutdown.c Tue Dec 20 09:46:14 2016 (r310324, copy of r310323, head/sys/dev/hyperv/utilities/hv_shutdown.c) @@ -0,0 +1,167 @@ +/*- + * Copyright (c) 2014,2016 Microsoft Corp. + * 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 unmodified, 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 ``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 BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +#define VMBUS_SHUTDOWN_FWVER_MAJOR 3 +#define VMBUS_SHUTDOWN_FWVER \ + VMBUS_IC_VERSION(VMBUS_SHUTDOWN_FWVER_MAJOR, 0) + +#define VMBUS_SHUTDOWN_MSGVER_MAJOR 3 +#define VMBUS_SHUTDOWN_MSGVER \ + VMBUS_IC_VERSION(VMBUS_SHUTDOWN_MSGVER_MAJOR, 0) + +static int vmbus_shutdown_probe(device_t); +static int vmbus_shutdown_attach(device_t); + +static const struct vmbus_ic_desc vmbus_shutdown_descs[] = { + { + .ic_guid = { .hv_guid = { + 0x31, 0x60, 0x0b, 0x0e, 0x13, 0x52, 0x34, 0x49, + 0x81, 0x8b, 0x38, 0xd9, 0x0c, 0xed, 0x39, 0xdb } }, + .ic_desc = "Hyper-V Shutdown" + }, + VMBUS_IC_DESC_END +}; + +static device_method_t vmbus_shutdown_methods[] = { + /* Device interface */ + DEVMETHOD(device_probe, vmbus_shutdown_probe), + DEVMETHOD(device_attach, vmbus_shutdown_attach), + DEVMETHOD(device_detach, vmbus_ic_detach), + DEVMETHOD_END +}; + +static driver_t vmbus_shutdown_driver = { + "hvshutdown", + vmbus_shutdown_methods, + sizeof(struct vmbus_ic_softc) +}; + +static devclass_t vmbus_shutdown_devclass; + +DRIVER_MODULE(hv_shutdown, vmbus, vmbus_shutdown_driver, + vmbus_shutdown_devclass, NULL, NULL); +MODULE_VERSION(hv_shutdown, 1); +MODULE_DEPEND(hv_shutdown, vmbus, 1, 1, 1); + +static void +vmbus_shutdown_cb(struct vmbus_channel *chan, void *xsc) +{ + struct vmbus_ic_softc *sc = xsc; + struct vmbus_icmsg_hdr *hdr; + struct vmbus_icmsg_shutdown *msg; + int dlen, error, do_shutdown = 0; + uint64_t xactid; + void *data; + + /* + * Receive request. + */ + data = sc->ic_buf; + dlen = sc->ic_buflen; + error = vmbus_chan_recv(chan, data, &dlen, &xactid); + KASSERT(error != ENOBUFS, ("icbuf is not large enough")); + if (error) + return; + + if (dlen < sizeof(*hdr)) { + device_printf(sc->ic_dev, "invalid data len %d\n", dlen); + return; + } + hdr = data; + + /* + * Update request, which will be echoed back as response. + */ + switch (hdr->ic_type) { + case VMBUS_ICMSG_TYPE_NEGOTIATE: + error = vmbus_ic_negomsg(sc, data, &dlen, + VMBUS_SHUTDOWN_FWVER, VMBUS_SHUTDOWN_MSGVER); + if (error) + return; + break; + + case VMBUS_ICMSG_TYPE_SHUTDOWN: + if (dlen < VMBUS_ICMSG_SHUTDOWN_SIZE_MIN) { + device_printf(sc->ic_dev, "invalid shutdown len %d\n", + dlen); + return; + } + msg = data; + + /* XXX ic_flags definition? */ + if (msg->ic_haltflags == 0 || msg->ic_haltflags == 1) { + device_printf(sc->ic_dev, "shutdown requested\n"); + hdr->ic_status = VMBUS_ICMSG_STATUS_OK; + do_shutdown = 1; + } else { + device_printf(sc->ic_dev, "unknown shutdown flags " + "0x%08x\n", msg->ic_haltflags); + hdr->ic_status = VMBUS_ICMSG_STATUS_FAIL; + } + break; + + default: + device_printf(sc->ic_dev, "got 0x%08x icmsg\n", hdr->ic_type); + break; + } + + /* + * Send response by echoing the request back. + */ + vmbus_ic_sendresp(sc, chan, data, dlen, xactid); + + if (do_shutdown) + shutdown_nice(RB_POWEROFF); +} + +static int +vmbus_shutdown_probe(device_t dev) +{ + + return (vmbus_ic_probe(dev, vmbus_shutdown_descs)); +} + +static int +vmbus_shutdown_attach(device_t dev) +{ + + return (vmbus_ic_attach(dev, vmbus_shutdown_cb)); +} Copied: head/sys/dev/hyperv/utilities/vmbus_timesync.c (from r310323, head/sys/dev/hyperv/utilities/hv_timesync.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/dev/hyperv/utilities/vmbus_timesync.c Tue Dec 20 09:46:14 2016 (r310324, copy of r310323, head/sys/dev/hyperv/utilities/hv_timesync.c) @@ -0,0 +1,245 @@ +/*- + * Copyright (c) 2014,2016 Microsoft Corp. + * 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 unmodified, 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 ``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 BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +#define VMBUS_TIMESYNC_FWVER_MAJOR 3 +#define VMBUS_TIMESYNC_FWVER \ + VMBUS_IC_VERSION(VMBUS_TIMESYNC_FWVER_MAJOR, 0) + +#define VMBUS_TIMESYNC_MSGVER_MAJOR 4 +#define VMBUS_TIMESYNC_MSGVER \ + VMBUS_IC_VERSION(VMBUS_TIMESYNC_MSGVER_MAJOR, 0) + +#define VMBUS_TIMESYNC_DORTT(sc) \ + ((sc)->ic_msgver >= VMBUS_IC_VERSION(4, 0) && \ + (hyperv_features & CPUID_HV_MSR_TIME_REFCNT)) + +static int vmbus_timesync_probe(device_t); +static int vmbus_timesync_attach(device_t); + +static const struct vmbus_ic_desc vmbus_timesync_descs[] = { + { + .ic_guid = { .hv_guid = { + 0x30, 0xe6, 0x27, 0x95, 0xae, 0xd0, 0x7b, 0x49, + 0xad, 0xce, 0xe8, 0x0a, 0xb0, 0x17, 0x5c, 0xaf } }, + .ic_desc = "Hyper-V Timesync" + }, + VMBUS_IC_DESC_END +}; + +static device_method_t vmbus_timesync_methods[] = { + /* Device interface */ + DEVMETHOD(device_probe, vmbus_timesync_probe), + DEVMETHOD(device_attach, vmbus_timesync_attach), + DEVMETHOD(device_detach, vmbus_ic_detach), + DEVMETHOD_END +}; + +static driver_t vmbus_timesync_driver = { + "hvtimesync", + vmbus_timesync_methods, + sizeof(struct vmbus_ic_softc) +}; + +static devclass_t vmbus_timesync_devclass; + +DRIVER_MODULE(hv_timesync, vmbus, vmbus_timesync_driver, + vmbus_timesync_devclass, NULL, NULL); +MODULE_VERSION(hv_timesync, 1); +MODULE_DEPEND(hv_timesync, vmbus, 1, 1, 1); + +SYSCTL_NODE(_hw, OID_AUTO, hvtimesync, CTLFLAG_RW | CTLFLAG_MPSAFE, NULL, + "Hyper-V timesync interface"); + +static int vmbus_ts_ignore_sync = 0; +SYSCTL_INT(_hw_hvtimesync, OID_AUTO, ignore_sync, CTLFLAG_RWTUN, + &vmbus_ts_ignore_sync, 0, "Ignore the sync request."); + +/* + * Trigger sample sync when drift exceeds threshold (ms). + * Ignore the sample request when set to 0. + */ +static int vmbus_ts_sample_thresh = 100; +SYSCTL_INT(_hw_hvtimesync, OID_AUTO, sample_thresh, CTLFLAG_RWTUN, + &vmbus_ts_sample_thresh, 0, + "Threshold that makes sample request trigger the sync (unit: ms)."); + +static int vmbus_ts_sample_verbose = 0; +SYSCTL_INT(_hw_hvtimesync, OID_AUTO, sample_verbose, CTLFLAG_RWTUN, + &vmbus_ts_sample_verbose, 0, "Increase sample request verbosity."); + +static void +vmbus_timesync(struct vmbus_ic_softc *sc, uint64_t hvtime, uint64_t sent_tc, + uint8_t tsflags) +{ + struct timespec vm_ts; + uint64_t hv_ns, vm_ns, rtt = 0; + + if (VMBUS_TIMESYNC_DORTT(sc)) + rtt = rdmsr(MSR_HV_TIME_REF_COUNT) - sent_tc; + + hv_ns = (hvtime - VMBUS_ICMSG_TS_BASE + rtt) * HYPERV_TIMER_NS_FACTOR; + nanotime(&vm_ts); + vm_ns = (vm_ts.tv_sec * NANOSEC) + vm_ts.tv_nsec; + + if ((tsflags & VMBUS_ICMSG_TS_FLAG_SYNC) && !vmbus_ts_ignore_sync) { + struct timespec hv_ts; + + if (bootverbose) { + device_printf(sc->ic_dev, "apply sync request, " + "hv: %ju, vm: %ju\n", + (uintmax_t)hv_ns, (uintmax_t)vm_ns); + } + hv_ts.tv_sec = hv_ns / NANOSEC; + hv_ts.tv_nsec = hv_ns % NANOSEC; + kern_clock_settime(curthread, CLOCK_REALTIME, &hv_ts); + /* Done! */ + return; + } + + if ((tsflags & VMBUS_ICMSG_TS_FLAG_SAMPLE) && + vmbus_ts_sample_thresh > 0) { + int64_t diff; + + if (vmbus_ts_sample_verbose) { + device_printf(sc->ic_dev, "sample request, " + "hv: %ju, vm: %ju\n", + (uintmax_t)hv_ns, (uintmax_t)vm_ns); + } + + if (hv_ns > vm_ns) + diff = hv_ns - vm_ns; + else + diff = vm_ns - hv_ns; + /* nanosec -> millisec */ + diff /= 1000000; + + if (diff > vmbus_ts_sample_thresh) { + struct timespec hv_ts; + + if (bootverbose) { + device_printf(sc->ic_dev, + "apply sample request, hv: %ju, vm: %ju\n", + (uintmax_t)hv_ns, (uintmax_t)vm_ns); + } + hv_ts.tv_sec = hv_ns / NANOSEC; + hv_ts.tv_nsec = hv_ns % NANOSEC; + kern_clock_settime(curthread, CLOCK_REALTIME, &hv_ts); + } + /* Done */ + return; + } +} + +static void +vmbus_timesync_cb(struct vmbus_channel *chan, void *xsc) +{ + struct vmbus_ic_softc *sc = xsc; + struct vmbus_icmsg_hdr *hdr; + const struct vmbus_icmsg_timesync *msg; + int dlen, error; + uint64_t xactid; + void *data; + + /* + * Receive request. + */ + data = sc->ic_buf; + dlen = sc->ic_buflen; + error = vmbus_chan_recv(chan, data, &dlen, &xactid); + KASSERT(error != ENOBUFS, ("icbuf is not large enough")); + if (error) + return; + + if (dlen < sizeof(*hdr)) { + device_printf(sc->ic_dev, "invalid data len %d\n", dlen); + return; + } + hdr = data; + + /* + * Update request, which will be echoed back as response. + */ + switch (hdr->ic_type) { + case VMBUS_ICMSG_TYPE_NEGOTIATE: + error = vmbus_ic_negomsg(sc, data, &dlen, + VMBUS_TIMESYNC_FWVER, VMBUS_TIMESYNC_MSGVER); + if (error) + return; + if (VMBUS_TIMESYNC_DORTT(sc)) + device_printf(sc->ic_dev, "RTT\n"); + break; + + case VMBUS_ICMSG_TYPE_TIMESYNC: + if (dlen < sizeof(*msg)) { + device_printf(sc->ic_dev, "invalid timesync len %d\n", + dlen); + return; + } + msg = data; + vmbus_timesync(sc, msg->ic_hvtime, msg->ic_sent_tc, + msg->ic_tsflags); + break; + + default: + device_printf(sc->ic_dev, "got 0x%08x icmsg\n", hdr->ic_type); + break; + } + + /* + * Send response by echoing the request back. + */ + vmbus_ic_sendresp(sc, chan, data, dlen, xactid); +} + +static int +vmbus_timesync_probe(device_t dev) +{ + + return (vmbus_ic_probe(dev, vmbus_timesync_descs)); +} + +static int +vmbus_timesync_attach(device_t dev) +{ + + return (vmbus_ic_attach(dev, vmbus_timesync_cb)); +} Modified: head/sys/modules/hyperv/utilities/Makefile ============================================================================== --- head/sys/modules/hyperv/utilities/Makefile Tue Dec 20 08:49:13 2016 (r310323) +++ head/sys/modules/hyperv/utilities/Makefile Tue Dec 20 09:46:14 2016 (r310324) @@ -4,11 +4,11 @@ KMOD= hv_utils SRCS= vmbus_ic.c -SRCS+= hv_heartbeat.c SRCS+= hv_kvp.c -SRCS+= hv_shutdown.c SRCS+= hv_snapshot.c -SRCS+= hv_timesync.c +SRCS+= vmbus_heartbeat.c +SRCS+= vmbus_shutdown.c +SRCS+= vmbus_timesync.c SRCS+= bus_if.h device_if.h vmbus_if.h CFLAGS+= -I${.CURDIR}/../../../dev/hyperv/include \ From owner-svn-src-all@freebsd.org Tue Dec 20 14:52:18 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D9AF4C88AEB; Tue, 20 Dec 2016 14:52:18 +0000 (UTC) (envelope-from rysto32@gmail.com) Received: from mail-it0-x229.google.com (mail-it0-x229.google.com [IPv6:2607:f8b0:4001:c0b::229]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id A2FCC756; Tue, 20 Dec 2016 14:52:18 +0000 (UTC) (envelope-from rysto32@gmail.com) Received: by mail-it0-x229.google.com with SMTP id c20so82348247itb.0; Tue, 20 Dec 2016 06:52:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=DgnXGuIaE/Pqoxnb2SU6aaXhauQX+pfTTlJFIXWYpIg=; b=am4ZH8A9/uGDhOy7Ige2FJtKCwCA9sq+ZWfe7VGjqBMJO12dqhra8SydTTyyY0Khdi mLG3OKn6HxzjGVqWWRCh1+IKqGziNEqVFnjY1Erxks164akU6t/LFi2YO5cu3xOLXJvG qBWa0gEjoX5GB2siCslX8mjyVfrs6dwEpemSnVNeNv8zrhezl14nzO2pSMi5H1S3B6QH Xt8cblKy5Sb8xfqzO88jL4JHNceoOJJ57noQsNR2MqRgUZ1aKS4QPT9/5MpjNGIGEpyz k5YF3dh8O2ZSJ7XWqnB9NjfPzcgEmpRsmYr1CXdITfJuIu4Eeq8/MQSBvyJooTIY50ZW kfog== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=DgnXGuIaE/Pqoxnb2SU6aaXhauQX+pfTTlJFIXWYpIg=; b=XjvBm6DP7HDz61AHVEgA2/U34ZaxHQF9RrlXcgoxNgcwyPYNGaJAlrsYX7SMSfe0Wf 5Esu9/Jwmud5+UPNMpwJqNd+4svMp/G+iDaiYO7pkPzeGDXfh4nWA0RoEos52t4VAcy3 KF0kT+5hNP1/hjSVKqKlTTqGpiZ3is419qTTYfqD8VQ73j99jkR1wGkzCX6H/u+nwHIE A1ajnWLuckD5k8U6C19HrcW9tJ3p8ZsJndr4lLuwjfpSjzdFsAmpef8outziCNC8vMqB blYGgdaCf1mZFezVUDJsEoXYScC2AU3ufSV+14MBR4lE6Ffh9wf8iWIgms9Y434e6qCc H35A== X-Gm-Message-State: AIkVDXKnZI7Cai6aqNQX8PkAqaSyyY6Y+lD7oAPCKnS4a+uxDRE1+xRZQOovEAPnP8VCMwWZN2q+sVSWeuWfIg== X-Received: by 10.36.131.138 with SMTP id d132mr385620ite.98.1482245537920; Tue, 20 Dec 2016 06:52:17 -0800 (PST) MIME-Version: 1.0 Received: by 10.107.144.84 with HTTP; Tue, 20 Dec 2016 06:52:17 -0800 (PST) In-Reply-To: <201612162239.uBGMdVSL027853@repo.freebsd.org> References: <201612162239.uBGMdVSL027853@repo.freebsd.org> From: Ryan Stone Date: Tue, 20 Dec 2016 09:52:17 -0500 Message-ID: Subject: Re: svn commit: r310180 - head/sys/net To: Alan Somers Cc: "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" Content-Type: text/plain; charset=UTF-8 X-Content-Filtered-By: Mailman/MimeDel 2.1.23 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Dec 2016 14:52:19 -0000 On Fri, Dec 16, 2016 at 5:39 PM, Alan Somers wrote: > > Modified: head/sys/net/if_lagg.c > ============================================================ > ================== > --- head/sys/net/if_lagg.c Fri Dec 16 22:37:16 2016 (r310179) > +++ head/sys/net/if_lagg.c Fri Dec 16 22:39:30 2016 (r310180) > @@ -252,6 +252,7 @@ SYSCTL_INT(_net_link_lagg, OID_AUTO, def > &VNET_NAME(def_flowid_shift), 0, > "Default setting for flowid shift for load sharing"); > > +#pragma clang optimize off > static void > vnet_lagg_init(const void *unused __unused) > { > Did you intend to commit this pragma? From owner-svn-src-all@freebsd.org Tue Dec 20 15:45:54 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 77599C89A09; Tue, 20 Dec 2016 15:45:54 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 396CB216; Tue, 20 Dec 2016 15:45:54 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBKFjrjk033909; Tue, 20 Dec 2016 15:45:53 GMT (envelope-from asomers@FreeBSD.org) Received: (from asomers@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBKFjrJj033908; Tue, 20 Dec 2016 15:45:53 GMT (envelope-from asomers@FreeBSD.org) Message-Id: <201612201545.uBKFjrJj033908@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: asomers set sender to asomers@FreeBSD.org using -f From: Alan Somers Date: Tue, 20 Dec 2016 15:45:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310327 - head/sys/net X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Dec 2016 15:45:54 -0000 Author: asomers Date: Tue Dec 20 15:45:53 2016 New Revision: 310327 URL: https://svnweb.freebsd.org/changeset/base/310327 Log: Remove stray debugging code from r310180 Reported by: rstone Pointy hat to: asomers MFC after: 3 weeks X-MFC-with: 310180 Sponsored by: Spectra Logic Corp Modified: head/sys/net/if_lagg.c Modified: head/sys/net/if_lagg.c ============================================================================== --- head/sys/net/if_lagg.c Tue Dec 20 10:56:08 2016 (r310326) +++ head/sys/net/if_lagg.c Tue Dec 20 15:45:53 2016 (r310327) @@ -252,7 +252,6 @@ SYSCTL_INT(_net_link_lagg, OID_AUTO, def &VNET_NAME(def_flowid_shift), 0, "Default setting for flowid shift for load sharing"); -#pragma clang optimize off static void vnet_lagg_init(const void *unused __unused) { From owner-svn-src-all@freebsd.org Tue Dec 20 15:47:26 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id CE89BC89AAF; Tue, 20 Dec 2016 15:47:26 +0000 (UTC) (envelope-from asomers@gmail.com) Received: from mail-qt0-x242.google.com (mail-qt0-x242.google.com [IPv6:2607:f8b0:400d:c0d::242]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 92218418; Tue, 20 Dec 2016 15:47:26 +0000 (UTC) (envelope-from asomers@gmail.com) Received: by mail-qt0-x242.google.com with SMTP id n6so23365351qtd.0; Tue, 20 Dec 2016 07:47:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=T05k9yCyxEn9ZUZ8RSWlEwqgfJIEU0NJgyNy/owTWIY=; b=LMxOtqWmcqu6FNbDv3jnwGyvb8gkEfbl6525nZTqnsULN2LbpjF8fLyCTUQLGhlmXh g75J0ZlI0iPHH9VDvgPxwQeAoHvFgsB4w7JVpkdhXYuODEYxUmS7C/iDYzl71hAFkaJd YGdH1v9VZVJvyB553Q6eV2ItWxKLstDVpzmqD7tk5L+5JwMQBmd/4a2G1txU2zH1bCx4 bDdGXEVMjFEbK967K8NMmOu8dF09BvcJ9SJ6wKR8mLJzRonulzYM/ydPqtu1GxUH+2Ei /pcPaur3i+jXDnY/wriAKiJFplTLlU+HTEljSoOUOmRZ4LcsmnHer/ZXy6PMby2K33Mn QFig== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=T05k9yCyxEn9ZUZ8RSWlEwqgfJIEU0NJgyNy/owTWIY=; b=ECNLPYd2dCTETyUIlaRviqj5FKGtIxdgSUuUBooyz8+ZKvpI6ZsFVnI/Kpp+UnhuQv +FSb70vd/U8eY/ruF2SGPIsZiB7wh2+rl1srGjPtEjtqbY6b/JiCDJnIq9xhQv+S1qAR jzcH4MS1c8PQEaD0+6g4Hr0GOGCA1atx+h/kqQ+RWCxB0iHFeXsBczxPSmPeuvyOxtZr zn/5HfZZc3O4DBmC7sWEX+0QCtD//N6hz7sS5PpshnucDNKLYqxbMN4cJAIwcPjcSGNL /PUGolD8YQdCj7faJYYQ6+J1QMTlcvIaFKuC6wYYvvO51fevqWdCxo3dZYLjcsJby6rf sZWw== X-Gm-Message-State: AIkVDXKHrxWkHsrEnqsLnFJTs7Jq1dAdc6JC0+gPqY5B0R7dpG07mBNSxMRxB1ptKdWHj0XOH495hJuOlfADkg== X-Received: by 10.200.37.178 with SMTP id e47mr23256566qte.7.1482248845615; Tue, 20 Dec 2016 07:47:25 -0800 (PST) MIME-Version: 1.0 Sender: asomers@gmail.com Received: by 10.12.181.208 with HTTP; Tue, 20 Dec 2016 07:47:25 -0800 (PST) In-Reply-To: References: <201612162239.uBGMdVSL027853@repo.freebsd.org> From: Alan Somers Date: Tue, 20 Dec 2016 08:47:25 -0700 X-Google-Sender-Auth: pIhahnB2XHbRCs0ZKGGS57bUzdo Message-ID: Subject: Re: svn commit: r310180 - head/sys/net To: Ryan Stone Cc: "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" Content-Type: text/plain; charset=UTF-8 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Dec 2016 15:47:26 -0000 On Tue, Dec 20, 2016 at 7:52 AM, Ryan Stone wrote: > > > On Fri, Dec 16, 2016 at 5:39 PM, Alan Somers wrote: >> >> >> Modified: head/sys/net/if_lagg.c >> >> ============================================================================== >> --- head/sys/net/if_lagg.c Fri Dec 16 22:37:16 2016 (r310179) >> +++ head/sys/net/if_lagg.c Fri Dec 16 22:39:30 2016 (r310180) >> @@ -252,6 +252,7 @@ SYSCTL_INT(_net_link_lagg, OID_AUTO, def >> &VNET_NAME(def_flowid_shift), 0, >> "Default setting for flowid shift for load sharing"); >> >> +#pragma clang optimize off >> static void >> vnet_lagg_init(const void *unused __unused) >> { > > > Did you intend to commit this pragma? > Uh, no. Fixed in r310327. From owner-svn-src-all@freebsd.org Tue Dec 20 16:37:47 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 58517C89A00; Tue, 20 Dec 2016 16:37:47 +0000 (UTC) (envelope-from gnn@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 0DC36981; Tue, 20 Dec 2016 16:37:46 +0000 (UTC) (envelope-from gnn@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBKGbkxH054342; Tue, 20 Dec 2016 16:37:46 GMT (envelope-from gnn@FreeBSD.org) Received: (from gnn@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBKGbjaB054339; Tue, 20 Dec 2016 16:37:46 GMT (envelope-from gnn@FreeBSD.org) Message-Id: <201612201637.uBKGbjaB054339@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gnn set sender to gnn@FreeBSD.org using -f From: "George V. Neville-Neil" Date: Tue, 20 Dec 2016 16:37:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r310328 - in stable/11/sys/cddl: contrib/opensolaris/uts/common/dtrace dev/dtrace X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Dec 2016 16:37:47 -0000 Author: gnn Date: Tue Dec 20 16:37:45 2016 New Revision: 310328 URL: https://svnweb.freebsd.org/changeset/base/310328 Log: MFC: 309069 Add tunable to disable destructive dtrace Submitted by: Joerg Pernfuss Reviewed by: rstone, markj Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c stable/11/sys/cddl/dev/dtrace/dtrace_load.c stable/11/sys/cddl/dev/dtrace/dtrace_sysctl.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c Tue Dec 20 15:45:53 2016 (r310327) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c Tue Dec 20 16:37:45 2016 (r310328) @@ -157,6 +157,10 @@ * /etc/system. */ int dtrace_destructive_disallow = 0; +#ifndef illumos +/* Positive logic version of dtrace_destructive_disallow for loader tunable */ +int dtrace_allow_destructive = 1; +#endif dtrace_optval_t dtrace_nonroot_maxsize = (16 * 1024 * 1024); size_t dtrace_difo_maxsize = (256 * 1024); dtrace_optval_t dtrace_dof_maxsize = (8 * 1024 * 1024); Modified: stable/11/sys/cddl/dev/dtrace/dtrace_load.c ============================================================================== --- stable/11/sys/cddl/dev/dtrace/dtrace_load.c Tue Dec 20 15:45:53 2016 (r310327) +++ stable/11/sys/cddl/dev/dtrace/dtrace_load.c Tue Dec 20 16:37:45 2016 (r310328) @@ -52,6 +52,17 @@ dtrace_load(void *dummy) int i; #endif +#ifndef illumos + /* + * DTrace uses negative logic for the destructive mode switch, so it + * is required to translate from the sysctl which uses positive logic. + */ + if (dtrace_allow_destructive) + dtrace_destructive_disallow = 0; + else + dtrace_destructive_disallow = 1; +#endif + /* Hook into the trap handler. */ dtrace_trap_func = dtrace_trap; Modified: stable/11/sys/cddl/dev/dtrace/dtrace_sysctl.c ============================================================================== --- stable/11/sys/cddl/dev/dtrace/dtrace_sysctl.c Tue Dec 20 15:45:53 2016 (r310327) +++ stable/11/sys/cddl/dev/dtrace/dtrace_sysctl.c Tue Dec 20 16:37:45 2016 (r310328) @@ -92,3 +92,6 @@ SYSCTL_QUAD(_kern_dtrace, OID_AUTO, dof_ SYSCTL_QUAD(_kern_dtrace, OID_AUTO, helper_actions_max, CTLFLAG_RW, &dtrace_helper_actions_max, 0, "maximum number of allowed helper actions"); + +SYSCTL_INT(_security_bsd, OID_AUTO, allow_destructive_dtrace, CTLFLAG_RDTUN, + &dtrace_allow_destructive, 1, "Allow destructive mode DTrace scripts"); From owner-svn-src-all@freebsd.org Tue Dec 20 17:12:18 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id DE186C89BED; Tue, 20 Dec 2016 17:12:18 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A01C580D; Tue, 20 Dec 2016 17:12:18 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBKHCHaX070769; Tue, 20 Dec 2016 17:12:17 GMT (envelope-from cem@FreeBSD.org) Received: (from cem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBKHCHlZ070767; Tue, 20 Dec 2016 17:12:17 GMT (envelope-from cem@FreeBSD.org) Message-Id: <201612201712.uBKHCHlZ070767@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cem set sender to cem@FreeBSD.org using -f From: "Conrad E. Meyer" Date: Tue, 20 Dec 2016 17:12:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310329 - head/usr.sbin/cron/crontab X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Dec 2016 17:12:19 -0000 Author: cem Date: Tue Dec 20 17:12:17 2016 New Revision: 310329 URL: https://svnweb.freebsd.org/changeset/base/310329 Log: Add a 'force' option for non-interactive crontab removal Add a '-f' option to force crontab '-r' to be non-interactive. Submitted by: Sam Gwydir Reviewed by: me, wblock (previous version) Sponsored by: Dell EMC Isilon Differential Revision: https://reviews.freebsd.org/D8815 Modified: head/usr.sbin/cron/crontab/crontab.1 head/usr.sbin/cron/crontab/crontab.c Modified: head/usr.sbin/cron/crontab/crontab.1 ============================================================================== --- head/usr.sbin/cron/crontab/crontab.1 Tue Dec 20 16:37:45 2016 (r310328) +++ head/usr.sbin/cron/crontab/crontab.1 Tue Dec 20 17:12:17 2016 (r310329) @@ -17,7 +17,7 @@ .\" .\" $FreeBSD$ .\" -.Dd May 13, 2010 +.Dd December 20, 2016 .Dt CRONTAB 1 .Os .Sh NAME @@ -31,7 +31,8 @@ .Op Fl u Ar user { .Fl l | -.Fl r | +.Fl r Op Fl f +| .Fl e } .Sh DESCRIPTION @@ -97,6 +98,11 @@ option for safety's sake. Display the current crontab on standard output. .It Fl r Remove the current crontab. +By default the +.Fl r +option prompts for confirmation, adding the +.Fl f +option will attempt to remove the current crontab without confirmation. .It Fl e Edit the current crontab using the editor specified by the Modified: head/usr.sbin/cron/crontab/crontab.c ============================================================================== --- head/usr.sbin/cron/crontab/crontab.c Tue Dec 20 16:37:45 2016 (r310328) +++ head/usr.sbin/cron/crontab/crontab.c Tue Dec 20 17:12:17 2016 (r310329) @@ -63,6 +63,7 @@ static char Filename[MAX_FNAME]; static FILE *NewCrontab; static int CheckErrorCount; static enum opt_t Option; +static int fflag; static struct passwd *pw; static void list_cmd(void), delete_cmd(void), @@ -79,7 +80,7 @@ usage(char *msg) fprintf(stderr, "crontab: usage error: %s\n", msg); fprintf(stderr, "%s\n%s\n", "usage: crontab [-u user] file", - " crontab [-u user] { -e | -l | -r }"); + " crontab [-u user] { -l | -r [-f] | -e }"); exit(ERROR_EXIT); } @@ -142,7 +143,7 @@ parse_args(argc, argv) strcpy(RealUser, User); Filename[0] = '\0'; Option = opt_unknown; - while ((argch = getopt(argc, argv, "u:lerx:")) != -1) { + while ((argch = getopt(argc, argv, "u:lerx:f")) != -1) { switch (argch) { case 'x': if (!set_debug_flags(optarg)) @@ -172,6 +173,9 @@ parse_args(argc, argv) usage("only one operation permitted"); Option = opt_edit; break; + case 'f': + fflag = 1; + break; default: usage("unrecognized option"); } @@ -282,7 +286,7 @@ delete_cmd() { char n[MAX_FNAME]; int ch, first; - if (isatty(STDIN_FILENO)) { + if (!fflag && isatty(STDIN_FILENO)) { (void)fprintf(stderr, "remove crontab for %s? ", User); first = ch = getchar(); while (ch != '\n' && ch != EOF) From owner-svn-src-all@freebsd.org Tue Dec 20 18:02:08 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B3849C89DD1; Tue, 20 Dec 2016 18:02:08 +0000 (UTC) (envelope-from br@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 622BE926; Tue, 20 Dec 2016 18:02:08 +0000 (UTC) (envelope-from br@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBKI27G3091172; Tue, 20 Dec 2016 18:02:07 GMT (envelope-from br@FreeBSD.org) Received: (from br@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBKI27oN091165; Tue, 20 Dec 2016 18:02:07 GMT (envelope-from br@FreeBSD.org) Message-Id: <201612201802.uBKI27oN091165@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: br set sender to br@FreeBSD.org using -f From: Ruslan Bukin Date: Tue, 20 Dec 2016 18:02:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310330 - in head: share/man/man4 sys/conf sys/dev/xdma X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Dec 2016 18:02:08 -0000 Author: br Date: Tue Dec 20 18:02:07 2016 New Revision: 310330 URL: https://svnweb.freebsd.org/changeset/base/310330 Log: Add xDMA -- the DMA abstraction layer, initial verison. xDMA is a DMA framework designed to abstract the interaction between device drivers and DMA engines. Project wiki: https://wiki.freebsd.org/xdma Sponsored by: DARPA, AFRL Differential Revision: https://reviews.freebsd.org/D8807 Added: head/share/man/man4/xdma.4 (contents, props changed) head/sys/dev/xdma/ head/sys/dev/xdma/xdma.c (contents, props changed) head/sys/dev/xdma/xdma.h (contents, props changed) head/sys/dev/xdma/xdma_fdt_test.c (contents, props changed) head/sys/dev/xdma/xdma_if.m (contents, props changed) Modified: head/sys/conf/files Added: head/share/man/man4/xdma.4 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/share/man/man4/xdma.4 Tue Dec 20 18:02:07 2016 (r310330) @@ -0,0 +1,77 @@ +.\" Copyright (c) 2016 Ruslan Bukin +.\" All rights reserved. +.\" +.\" This software was developed by SRI International and the University of +.\" Cambridge Computer Laboratory under DARPA/AFRL contract FA8750-10-C-0237 +.\" ("CTSRD"), as part of the DARPA CRASH research programme. +.\" +.\" 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 December 12, 2016 +.Dt XDMA 4 +.Os +.Sh NAME +.Nm xdma +.Nd DMA abstraction layer +.Sh SYNOPSIS +To compile xDMA device support into the kernel, place the following line +in your kernel configuration file: +.Bd -ragged -offset indent +.Cd "device xdma" +.Ed +.Pp +To compile xDMA FDT-based test driver, place the following line as well: +.Bd -literal -offset indent +.Cd "device xdma_test" +.Ed +.Sh DESCRIPTION +xDMA is a DMA framework designed to abstract the interaction between device +drivers and DMA engines. +.Pp +xDMA defines an interface for efficient interaction between the device driver +and DMA controller. +The +.Nm +device provides a virtual DMA controller and virtual channels called xchans. +The controller provides virtual channels management (allocation, deallocation, +configuration) and interrupt notification esteblishment needed to receive +events from the hardware DMA controller. +.Nm +supports the following transfer types: +.Bl -hang -offset indent -width xxxxxxxx +.It Nm Cyclic +A non-stop periodic transfer designed for applications like audio. +.It Nm Memcpy +A memory-to-memory transfer. +.El +.Sh SEE ALSO +.Xr bus_dma 9 +.Sh HISTORY +Support for xDMA first appeared in +.Fx 12.0 . +.Sh AUTHORS +.An -nosplit +.Fx +xDMA framework was first added by +.An Ruslan Bukin Aq Mt br@FreeBSD.org . Modified: head/sys/conf/files ============================================================================== --- head/sys/conf/files Tue Dec 20 17:12:17 2016 (r310329) +++ head/sys/conf/files Tue Dec 20 18:02:07 2016 (r310330) @@ -3262,6 +3262,9 @@ wpi.fw optional wpifw \ compile-with "${NORMAL_FW}" \ no-obj no-implicit-rule \ clean "wpi.fw" +dev/xdma/xdma.c optional xdma +dev/xdma/xdma_if.m optional xdma +dev/xdma/xdma_fdt_test.c optional xdma xdma_test fdt dev/xe/if_xe.c optional xe dev/xe/if_xe_pccard.c optional xe pccard dev/xen/balloon/balloon.c optional xenhvm Added: head/sys/dev/xdma/xdma.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/dev/xdma/xdma.c Tue Dec 20 18:02:07 2016 (r310330) @@ -0,0 +1,673 @@ +/*- + * Copyright (c) 2016 Ruslan Bukin + * All rights reserved. + * + * This software was developed by SRI International and the University of + * Cambridge Computer Laboratory under DARPA/AFRL contract FA8750-10-C-0237 + * ("CTSRD"), as part of the DARPA CRASH research programme. + * + * 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. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include "opt_platform.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +#ifdef FDT +#include +#include +#include +#endif + +#include + +#include + +MALLOC_DEFINE(M_XDMA, "xdma", "xDMA framework"); + +/* + * Multiple xDMA controllers may work with single DMA device, + * so we have global lock for physical channel management. + */ +static struct mtx xdma_mtx; +#define XDMA_LOCK() mtx_lock(&xdma_mtx) +#define XDMA_UNLOCK() mtx_unlock(&xdma_mtx) +#define XDMA_ASSERT_LOCKED() mtx_assert(&xdma_mtx, MA_OWNED) + +/* + * Per channel locks. + */ +#define XCHAN_LOCK(xchan) mtx_lock(&xchan->mtx_lock) +#define XCHAN_UNLOCK(xchan) mtx_unlock(&xchan->mtx_lock) +#define XCHAN_ASSERT_LOCKED(xchan) mtx_assert(&xchan->mtx_lock, MA_OWNED) + +/* + * Allocate virtual xDMA channel. + */ +xdma_channel_t * +xdma_channel_alloc(xdma_controller_t *xdma) +{ + xdma_channel_t *xchan; + int ret; + + xchan = malloc(sizeof(xdma_channel_t), M_XDMA, M_WAITOK | M_ZERO); + if (xchan == NULL) { + device_printf(xdma->dev, + "%s: Can't allocate memory for channel.\n", __func__); + return (NULL); + } + xchan->xdma = xdma; + + XDMA_LOCK(); + + /* Request a real channel from hardware driver. */ + ret = XDMA_CHANNEL_ALLOC(xdma->dma_dev, xchan); + if (ret != 0) { + device_printf(xdma->dev, + "%s: Can't request hardware channel.\n", __func__); + XDMA_UNLOCK(); + free(xchan, M_XDMA); + + return (NULL); + } + + TAILQ_INIT(&xchan->ie_handlers); + mtx_init(&xchan->mtx_lock, "xDMA", NULL, MTX_DEF); + + TAILQ_INSERT_TAIL(&xdma->channels, xchan, xchan_next); + + XDMA_UNLOCK(); + + return (xchan); +} + +int +xdma_channel_free(xdma_channel_t *xchan) +{ + xdma_controller_t *xdma; + int err; + + xdma = xchan->xdma; + + XDMA_LOCK(); + + /* Free the real DMA channel. */ + err = XDMA_CHANNEL_FREE(xdma->dma_dev, xchan); + if (err != 0) { + device_printf(xdma->dev, + "%s: Can't free real hw channel.\n", __func__); + XDMA_UNLOCK(); + return (-1); + } + + xdma_teardown_all_intr(xchan); + + /* Deallocate descriptors, if any. */ + xdma_desc_free(xchan); + + mtx_destroy(&xchan->mtx_lock); + + TAILQ_REMOVE(&xdma->channels, xchan, xchan_next); + + free(xchan, M_XDMA); + + XDMA_UNLOCK(); + + return (0); +} + +int +xdma_setup_intr(xdma_channel_t *xchan, int (*cb)(void *), void *arg, + void **ihandler) +{ + struct xdma_intr_handler *ih; + xdma_controller_t *xdma; + + xdma = xchan->xdma; + KASSERT(xdma != NULL, ("xdma is NULL")); + + /* Sanity check. */ + if (cb == NULL) { + device_printf(xdma->dev, + "%s: Can't setup interrupt handler.\n", + __func__); + + return (-1); + } + + ih = malloc(sizeof(struct xdma_intr_handler), + M_XDMA, M_WAITOK | M_ZERO); + if (ih == NULL) { + device_printf(xdma->dev, + "%s: Can't allocate memory for interrupt handler.\n", + __func__); + + return (-1); + } + + ih->cb = cb; + ih->cb_user = arg; + + TAILQ_INSERT_TAIL(&xchan->ie_handlers, ih, ih_next); + + if (ihandler != NULL) { + *ihandler = ih; + } + + return (0); +} + +int +xdma_teardown_intr(xdma_channel_t *xchan, struct xdma_intr_handler *ih) +{ + xdma_controller_t *xdma; + + xdma = xchan->xdma; + KASSERT(xdma != NULL, ("xdma is NULL")); + + /* Sanity check. */ + if (ih == NULL) { + device_printf(xdma->dev, + "%s: Can't teardown interrupt.\n", __func__); + return (-1); + } + + TAILQ_REMOVE(&xchan->ie_handlers, ih, ih_next); + free(ih, M_XDMA); + + return (0); +} + +int +xdma_teardown_all_intr(xdma_channel_t *xchan) +{ + struct xdma_intr_handler *ih_tmp; + struct xdma_intr_handler *ih; + xdma_controller_t *xdma; + + xdma = xchan->xdma; + KASSERT(xdma != NULL, ("xdma is NULL")); + + TAILQ_FOREACH_SAFE(ih, &xchan->ie_handlers, ih_next, ih_tmp) { + TAILQ_REMOVE(&xchan->ie_handlers, ih, ih_next); + free(ih, M_XDMA); + } + + return (0); +} + +static void +xdma_dmamap_cb(void *arg, bus_dma_segment_t *segs, int nseg, int err) +{ + xdma_channel_t *xchan; + int i; + + xchan = (xdma_channel_t *)arg; + KASSERT(xchan != NULL, ("xchan is NULL")); + + if (err) { + xchan->map_err = 1; + return; + } + + for (i = 0; i < nseg; i++) { + xchan->descs_phys[i].ds_addr = segs[i].ds_addr; + xchan->descs_phys[i].ds_len = segs[i].ds_len; + } +} + +static int +xdma_desc_alloc_bus_dma(xdma_channel_t *xchan, uint32_t desc_size, + uint32_t align) +{ + xdma_controller_t *xdma; + bus_size_t all_desc_sz; + xdma_config_t *conf; + int nsegments; + int err; + + xdma = xchan->xdma; + conf = &xchan->conf; + + nsegments = conf->block_num; + all_desc_sz = (nsegments * desc_size); + + err = bus_dma_tag_create( + bus_get_dma_tag(xdma->dev), + align, desc_size, /* alignment, boundary */ + BUS_SPACE_MAXADDR_32BIT, /* lowaddr */ + BUS_SPACE_MAXADDR, /* highaddr */ + NULL, NULL, /* filter, filterarg */ + all_desc_sz, nsegments, /* maxsize, nsegments*/ + desc_size, 0, /* maxsegsize, flags */ + NULL, NULL, /* lockfunc, lockarg */ + &xchan->dma_tag); + if (err) { + device_printf(xdma->dev, + "%s: Can't create bus_dma tag.\n", __func__); + return (-1); + } + + err = bus_dmamem_alloc(xchan->dma_tag, (void **)&xchan->descs, + BUS_DMA_WAITOK | BUS_DMA_COHERENT, &xchan->dma_map); + if (err) { + device_printf(xdma->dev, + "%s: Can't allocate memory for descriptors.\n", __func__); + return (-1); + } + + xchan->descs_phys = malloc(nsegments * sizeof(xdma_descriptor_t), M_XDMA, + (M_WAITOK | M_ZERO)); + + xchan->map_err = 0; + err = bus_dmamap_load(xchan->dma_tag, xchan->dma_map, xchan->descs, + all_desc_sz, xdma_dmamap_cb, xchan, BUS_DMA_WAITOK); + if (err) { + device_printf(xdma->dev, + "%s: Can't load DMA map.\n", __func__); + return (-1); + } + + if (xchan->map_err != 0) { + device_printf(xdma->dev, + "%s: Can't load DMA map.\n", __func__); + return (-1); + } + + return (0); +} + +/* + * This function called by DMA controller driver. + */ +int +xdma_desc_alloc(xdma_channel_t *xchan, uint32_t desc_size, uint32_t align) +{ + xdma_controller_t *xdma; + xdma_config_t *conf; + int ret; + + XCHAN_ASSERT_LOCKED(xchan); + + xdma = xchan->xdma; + if (xdma == NULL) { + device_printf(xdma->dev, + "%s: Channel was not allocated properly.\n", __func__); + return (-1); + } + + if (xchan->flags & XCHAN_DESC_ALLOCATED) { + device_printf(xdma->dev, + "%s: Descriptors already allocated.\n", __func__); + return (-1); + } + + if ((xchan->flags & XCHAN_CONFIGURED) == 0) { + device_printf(xdma->dev, + "%s: Channel has no configuration.\n", __func__); + return (-1); + } + + conf = &xchan->conf; + + XCHAN_UNLOCK(xchan); + ret = xdma_desc_alloc_bus_dma(xchan, desc_size, align); + XCHAN_LOCK(xchan); + if (ret != 0) { + device_printf(xdma->dev, + "%s: Can't allocate memory for descriptors.\n", + __func__); + return (-1); + } + + xchan->flags |= XCHAN_DESC_ALLOCATED; + + /* We are going to write to descriptors. */ + bus_dmamap_sync(xchan->dma_tag, xchan->dma_map, BUS_DMASYNC_PREWRITE); + + return (0); +} + +int +xdma_desc_free(xdma_channel_t *xchan) +{ + + if ((xchan->flags & XCHAN_DESC_ALLOCATED) == 0) { + /* No descriptors allocated. */ + return (-1); + } + + bus_dmamap_unload(xchan->dma_tag, xchan->dma_map); + bus_dmamem_free(xchan->dma_tag, xchan->descs, xchan->dma_map); + bus_dma_tag_destroy(xchan->dma_tag); + free(xchan->descs_phys, M_XDMA); + + xchan->flags &= ~(XCHAN_DESC_ALLOCATED); + + return (0); +} + +int +xdma_prep_memcpy(xdma_channel_t *xchan, uintptr_t src_addr, + uintptr_t dst_addr, size_t len) +{ + xdma_controller_t *xdma; + xdma_config_t *conf; + int ret; + + xdma = xchan->xdma; + KASSERT(xdma != NULL, ("xdma is NULL")); + + conf = &xchan->conf; + conf->direction = XDMA_MEM_TO_MEM; + conf->src_addr = src_addr; + conf->dst_addr = dst_addr; + conf->block_len = len; + conf->block_num = 1; + + xchan->flags |= (XCHAN_CONFIGURED | XCHAN_TYPE_MEMCPY); + + XCHAN_LOCK(xchan); + + /* Deallocate old descriptors, if any. */ + xdma_desc_free(xchan); + + ret = XDMA_CHANNEL_PREP_MEMCPY(xdma->dma_dev, xchan); + if (ret != 0) { + device_printf(xdma->dev, + "%s: Can't prepare memcpy transfer.\n", __func__); + XDMA_UNLOCK(); + + return (-1); + } + + if (xchan->flags & XCHAN_DESC_ALLOCATED) { + /* Driver created xDMA descriptors. */ + bus_dmamap_sync(xchan->dma_tag, xchan->dma_map, + BUS_DMASYNC_POSTWRITE); + } + + XCHAN_UNLOCK(xchan); + + return (0); +} + +int +xdma_prep_cyclic(xdma_channel_t *xchan, enum xdma_direction dir, + uintptr_t src_addr, uintptr_t dst_addr, int block_len, + int block_num, int src_width, int dst_width) +{ + xdma_controller_t *xdma; + xdma_config_t *conf; + int ret; + + xdma = xchan->xdma; + KASSERT(xdma != NULL, ("xdma is NULL")); + + conf = &xchan->conf; + conf->direction = dir; + conf->src_addr = src_addr; + conf->dst_addr = dst_addr; + conf->block_len = block_len; + conf->block_num = block_num; + conf->src_width = src_width; + conf->dst_width = dst_width; + + xchan->flags |= (XCHAN_CONFIGURED | XCHAN_TYPE_CYCLIC); + + XCHAN_LOCK(xchan); + + /* Deallocate old descriptors, if any. */ + xdma_desc_free(xchan); + + ret = XDMA_CHANNEL_PREP_CYCLIC(xdma->dma_dev, xchan); + if (ret != 0) { + device_printf(xdma->dev, + "%s: Can't prepare cyclic transfer.\n", __func__); + XDMA_UNLOCK(); + return (-1); + } + + if (xchan->flags & XCHAN_DESC_ALLOCATED) { + /* Driver has created xDMA descriptors. */ + bus_dmamap_sync(xchan->dma_tag, xchan->dma_map, + BUS_DMASYNC_POSTWRITE); + } + + XCHAN_UNLOCK(xchan); + + return (0); +} + +int +xdma_begin(xdma_channel_t *xchan) +{ + xdma_controller_t *xdma; + int ret; + + xdma = xchan->xdma; + + ret = XDMA_CHANNEL_CONTROL(xdma->dma_dev, xchan, XDMA_CMD_BEGIN); + if (ret != 0) { + device_printf(xdma->dev, + "%s: Can't begin the channel operation.\n", __func__); + return (-1); + } + + return (0); +} + +int +xdma_terminate(xdma_channel_t *xchan) +{ + xdma_controller_t *xdma; + int ret; + + xdma = xchan->xdma; + + ret = XDMA_CHANNEL_CONTROL(xdma->dma_dev, xchan, XDMA_CMD_TERMINATE); + if (ret != 0) { + device_printf(xdma->dev, + "%s: Can't terminate the channel operation.\n", __func__); + return (-1); + } + + return (0); +} + +int +xdma_pause(xdma_channel_t *xchan) +{ + xdma_controller_t *xdma; + int ret; + + xdma = xchan->xdma; + + ret = XDMA_CHANNEL_CONTROL(xdma->dma_dev, xchan, XDMA_CMD_PAUSE); + if (ret != 0) { + device_printf(xdma->dev, + "%s: Can't pause the channel operation.\n", __func__); + return (-1); + } + + return (ret); +} + +int +xdma_callback(xdma_channel_t *xchan) +{ + struct xdma_intr_handler *ih_tmp; + struct xdma_intr_handler *ih; + + TAILQ_FOREACH_SAFE(ih, &xchan->ie_handlers, ih_next, ih_tmp) { + if (ih->cb != NULL) { + ih->cb(ih->cb_user); + } + } + + return (0); +} + +void +xdma_assert_locked(void) +{ + + XDMA_ASSERT_LOCKED(); +} + +#ifdef FDT +/* + * Notify the DMA driver we have machine-dependent data in FDT. + */ +static int +xdma_ofw_md_data(xdma_controller_t *xdma, pcell_t *cells, int ncells) +{ + uint32_t ret; + + ret = XDMA_OFW_MD_DATA(xdma->dma_dev, cells, ncells, (void **)&xdma->data); + + return (ret); +} + +/* + * Allocate xdma controller. + */ +xdma_controller_t * +xdma_ofw_get(device_t dev, const char *prop) +{ + phandle_t node, parent; + xdma_controller_t *xdma; + device_t dma_dev; + pcell_t *cells; + int ncells; + int error; + int ndmas; + int idx; + + node = ofw_bus_get_node(dev); + if (node <= 0) { + device_printf(dev, + "%s called on not ofw based device.\n", __func__); + } + + error = ofw_bus_parse_xref_list_get_length(node, + "dmas", "#dma-cells", &ndmas); + if (error) { + device_printf(dev, + "%s can't get dmas list.\n", __func__); + return (NULL); + } + + if (ndmas == 0) { + device_printf(dev, + "%s dmas list is empty.\n", __func__); + return (NULL); + } + + error = ofw_bus_find_string_index(node, "dma-names", prop, &idx); + if (error != 0) { + device_printf(dev, + "%s can't find string index.\n", __func__); + return (NULL); + } + + error = ofw_bus_parse_xref_list_alloc(node, "dmas", "#dma-cells", + idx, &parent, &ncells, &cells); + if (error != 0) { + device_printf(dev, + "%s can't get dma device xref.\n", __func__); + return (NULL); + } + + dma_dev = OF_device_from_xref(parent); + if (dma_dev == NULL) { + device_printf(dev, + "%s can't get dma device.\n", __func__); + return (NULL); + } + + xdma = malloc(sizeof(struct xdma_controller), M_XDMA, M_WAITOK | M_ZERO); + if (xdma == NULL) { + device_printf(dev, + "%s can't allocate memory for xdma.\n", __func__); + return (NULL); + } + xdma->dev = dev; + xdma->dma_dev = dma_dev; + + TAILQ_INIT(&xdma->channels); + + xdma_ofw_md_data(xdma, cells, ncells); + free(cells, M_OFWPROP); + + return (xdma); +} +#endif + +/* + * Free xDMA controller object. + */ +int +xdma_put(xdma_controller_t *xdma) +{ + + XDMA_LOCK(); + + /* Ensure no channels allocated. */ + if (!TAILQ_EMPTY(&xdma->channels)) { + device_printf(xdma->dev, "%s: Can't free xDMA\n", __func__); + return (-1); + } + + free(xdma->data, M_DEVBUF); + free(xdma, M_XDMA); + + XDMA_UNLOCK(); + + return (0); +} + +static void +xdma_init(void) +{ + + mtx_init(&xdma_mtx, "xDMA", NULL, MTX_DEF); +} + +SYSINIT(xdma, SI_SUB_DRIVERS, SI_ORDER_FIRST, xdma_init, NULL); Added: head/sys/dev/xdma/xdma.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/dev/xdma/xdma.h Tue Dec 20 18:02:07 2016 (r310330) @@ -0,0 +1,148 @@ +/*- + * Copyright (c) 2016 Ruslan Bukin + * All rights reserved. + * + * This software was developed by SRI International and the University of + * Cambridge Computer Laboratory under DARPA/AFRL contract FA8750-10-C-0237 + * ("CTSRD"), as part of the DARPA CRASH research programme. + * + * 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$ + */ + +#ifndef _DEV_EXTRES_XDMA_H_ +#define _DEV_EXTRES_XDMA_H_ + +enum xdma_direction { + XDMA_MEM_TO_MEM, + XDMA_MEM_TO_DEV, + XDMA_DEV_TO_MEM, + XDMA_DEV_TO_DEV, +}; + +enum xdma_operation_type { + XDMA_MEMCPY, + XDMA_SG, + XDMA_CYCLIC, +}; + +enum xdma_command { + XDMA_CMD_BEGIN, + XDMA_CMD_PAUSE, + XDMA_CMD_TERMINATE, + XDMA_CMD_TERMINATE_ALL, +}; + +struct xdma_controller { + device_t dev; /* DMA consumer device_t. */ + device_t dma_dev; /* A real DMA device_t. */ + void *data; /* OFW MD part. */ + + /* List of virtual channels allocated. */ + TAILQ_HEAD(xdma_channel_list, xdma_channel) channels; +}; + +typedef struct xdma_controller xdma_controller_t; + +struct xdma_channel_config { + enum xdma_direction direction; + uintptr_t src_addr; /* Physical address. */ + uintptr_t dst_addr; /* Physical address. */ + int block_len; /* In bytes. */ + int block_num; /* Count of blocks. */ + int src_width; /* In bytes. */ + int dst_width; /* In bytes. */ +}; + +typedef struct xdma_channel_config xdma_config_t; + +struct xdma_descriptor { + uintptr_t ds_addr; + uint32_t ds_len; +}; + +typedef struct xdma_descriptor xdma_descriptor_t; + +struct xdma_channel { + xdma_controller_t *xdma; + xdma_config_t conf; + + uint8_t flags; +#define XCHAN_DESC_ALLOCATED (1 << 0) +#define XCHAN_CONFIGURED (1 << 1) +#define XCHAN_TYPE_CYCLIC (1 << 2) +#define XCHAN_TYPE_MEMCPY (1 << 3) + + /* A real hardware driver channel. */ + void *chan; + + /* Interrupt handlers. */ + TAILQ_HEAD(, xdma_intr_handler) ie_handlers; + + /* Descriptors. */ + bus_dma_tag_t dma_tag; + bus_dmamap_t dma_map; + void *descs; + xdma_descriptor_t *descs_phys; + uint8_t map_err; + + struct mtx mtx_lock; + + TAILQ_ENTRY(xdma_channel) xchan_next; +}; + +typedef struct xdma_channel xdma_channel_t; + +/* xDMA controller alloc/free */ +xdma_controller_t *xdma_ofw_get(device_t dev, const char *prop); +int xdma_put(xdma_controller_t *xdma); + +xdma_channel_t * xdma_channel_alloc(xdma_controller_t *); +int xdma_channel_free(xdma_channel_t *); + +int xdma_prep_cyclic(xdma_channel_t *, enum xdma_direction, + uintptr_t, uintptr_t, int, int, int, int); +int xdma_prep_memcpy(xdma_channel_t *, uintptr_t, uintptr_t, size_t len); +int xdma_desc_alloc(xdma_channel_t *, uint32_t, uint32_t); +int xdma_desc_free(xdma_channel_t *xchan); + +/* Channel Control */ +int xdma_begin(xdma_channel_t *xchan); +int xdma_pause(xdma_channel_t *xchan); +int xdma_terminate(xdma_channel_t *xchan); + +/* Interrupt callback */ +int xdma_setup_intr(xdma_channel_t *xchan, int (*cb)(void *), void *arg, void **); +int xdma_teardown_intr(xdma_channel_t *xchan, struct xdma_intr_handler *ih); +int xdma_teardown_all_intr(xdma_channel_t *xchan); +int xdma_callback(struct xdma_channel *xchan); +void xdma_assert_locked(void); + +struct xdma_intr_handler { + int (*cb)(void *); + void *cb_user; + struct mtx ih_lock; + TAILQ_ENTRY(xdma_intr_handler) ih_next; +}; + +#endif /* !_DEV_EXTRES_XDMA_H_ */ Added: head/sys/dev/xdma/xdma_fdt_test.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/dev/xdma/xdma_fdt_test.c Tue Dec 20 18:02:07 2016 (r310330) @@ -0,0 +1,417 @@ +/*- + * Copyright (c) 2016 Ruslan Bukin + * All rights reserved. + * + * This software was developed by SRI International and the University of + * Cambridge Computer Laboratory under DARPA/AFRL contract FA8750-10-C-0237 + * ("CTSRD"), as part of the DARPA CRASH research programme. + * + * 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. + */ + +/* xDMA memcpy test driver. */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +#include + +#include +#include +#include + +/* + * To use this test add a compatible node to your dts, e.g. + * + * xdma_test { + * compatible = "freebsd,xdma-test"; + * + * dmas = <&dma 0 0 0xffffffff>; + * dma-names = "test"; + * }; + */ + +struct xdmatest_softc { + device_t dev; + xdma_controller_t *xdma; + xdma_channel_t *xchan; + void *ih; + struct intr_config_hook config_intrhook; + char *src; + char *dst; + uint32_t len; + uintptr_t src_phys; + uintptr_t dst_phys; + bus_dma_tag_t src_dma_tag; *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@freebsd.org Tue Dec 20 18:10:00 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A9302C8932E; Tue, 20 Dec 2016 18:10:00 +0000 (UTC) (envelope-from br@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 56E38E02; Tue, 20 Dec 2016 18:10:00 +0000 (UTC) (envelope-from br@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBKI9xS8091608; Tue, 20 Dec 2016 18:09:59 GMT (envelope-from br@FreeBSD.org) Received: (from br@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBKI9xs6091606; Tue, 20 Dec 2016 18:09:59 GMT (envelope-from br@FreeBSD.org) Message-Id: <201612201809.uBKI9xs6091606@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: br set sender to br@FreeBSD.org using -f From: Ruslan Bukin Date: Tue, 20 Dec 2016 18:09:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310331 - head/sys/mips/ingenic X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Dec 2016 18:10:00 -0000 Author: br Date: Tue Dec 20 18:09:59 2016 New Revision: 310331 URL: https://svnweb.freebsd.org/changeset/base/310331 Log: Add jz4780 PDMA controller driver. Sponsored by: DARPA, AFRL Differential Revision: https://reviews.freebsd.org/D8817 Added: head/sys/mips/ingenic/jz4780_pdma.c (contents, props changed) Modified: head/sys/mips/ingenic/files.jz4780 head/sys/mips/ingenic/files.x1000 Modified: head/sys/mips/ingenic/files.jz4780 ============================================================================== --- head/sys/mips/ingenic/files.jz4780 Tue Dec 20 18:02:07 2016 (r310330) +++ head/sys/mips/ingenic/files.jz4780 Tue Dec 20 18:09:59 2016 (r310331) @@ -19,6 +19,7 @@ mips/ingenic/jz4780_intr.c standard mips/ingenic/jz4780_gpio.c standard mips/ingenic/jz4780_machdep.c standard mips/ingenic/jz4780_nemc.c standard +mips/ingenic/jz4780_pdma.c standard mips/ingenic/jz4780_pinctrl.c standard mips/ingenic/jz4780_timer.c standard Modified: head/sys/mips/ingenic/files.x1000 ============================================================================== --- head/sys/mips/ingenic/files.x1000 Tue Dec 20 18:02:07 2016 (r310330) +++ head/sys/mips/ingenic/files.x1000 Tue Dec 20 18:09:59 2016 (r310331) @@ -10,6 +10,7 @@ mips/ingenic/jz4780_clk_pll.c standard mips/ingenic/jz4780_intr.c standard mips/ingenic/jz4780_gpio.c standard mips/ingenic/jz4780_machdep.c standard +mips/ingenic/jz4780_pdma.c standard mips/ingenic/jz4780_pinctrl.c standard mips/ingenic/jz4780_timer.c standard Added: head/sys/mips/ingenic/jz4780_pdma.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/mips/ingenic/jz4780_pdma.c Tue Dec 20 18:09:59 2016 (r310331) @@ -0,0 +1,544 @@ +/*- + * Copyright (c) 2016 Ruslan Bukin + * All rights reserved. + * + * This software was developed by SRI International and the University of + * Cambridge Computer Laboratory under DARPA/AFRL contract FA8750-10-C-0237 + * ("CTSRD"), as part of the DARPA CRASH research programme. + * + * 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. + */ + +/* Ingenic JZ4780 PDMA Controller. */ + +#include +__FBSDID("$FreeBSD$"); + +#include "opt_platform.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +#ifdef FDT +#include +#include +#include +#endif + +#include + +#include +#include + +#include "xdma_if.h" + +struct pdma_softc { + device_t dev; + struct resource *res[2]; + bus_space_tag_t bst; + bus_space_handle_t bsh; + void *ih; +}; + +struct pdma_fdt_data { + int tx; + int rx; + int chan; +}; + +struct pdma_channel { + xdma_channel_t *xchan; + struct pdma_fdt_data data; + int cur_desc; + int used; + int index; + int flags; +#define CHAN_DESCR_RELINK (1 << 0) +}; + +#define PDMA_NCHANNELS 32 +struct pdma_channel pdma_channels[PDMA_NCHANNELS]; + +static struct resource_spec pdma_spec[] = { + { SYS_RES_MEMORY, 0, RF_ACTIVE }, + { SYS_RES_IRQ, 0, RF_ACTIVE }, + { -1, 0 } +}; + +static int pdma_probe(device_t dev); +static int pdma_attach(device_t dev); +static int pdma_detach(device_t dev); +static int chan_start(struct pdma_softc *sc, struct pdma_channel *chan); + +static void +pdma_intr(void *arg) +{ + struct pdma_channel *chan; + struct pdma_softc *sc; + xdma_channel_t *xchan; + xdma_config_t *conf; + int pending; + int i; + + sc = arg; + + pending = READ4(sc, PDMA_DIRQP); + + /* Ack all the channels. */ + WRITE4(sc, PDMA_DIRQP, 0); + + for (i = 0; i < PDMA_NCHANNELS; i++) { + if (pending & (1 << i)) { + chan = &pdma_channels[i]; + xchan = chan->xchan; + conf = &xchan->conf; + + /* TODO: check for AR, HLT error bits here. */ + + /* Disable channel */ + WRITE4(sc, PDMA_DCS(chan->index), 0); + + if (chan->flags & CHAN_DESCR_RELINK) { + /* Enable again */ + chan->cur_desc = (chan->cur_desc + 1) % \ + conf->block_num; + chan_start(sc, chan); + } + + xdma_callback(chan->xchan); + } + } +} + +static int +pdma_probe(device_t dev) +{ + + if (!ofw_bus_status_okay(dev)) + return (ENXIO); + + if (!ofw_bus_is_compatible(dev, "ingenic,jz4780-dma")) + return (ENXIO); + + device_set_desc(dev, "Ingenic JZ4780 PDMA Controller"); + + return (BUS_PROBE_DEFAULT); +} + +static int +pdma_attach(device_t dev) +{ + struct pdma_softc *sc; + phandle_t xref, node; + int err; + int reg; + + sc = device_get_softc(dev); + sc->dev = dev; + + if (bus_alloc_resources(dev, pdma_spec, sc->res)) { + device_printf(dev, "could not allocate resources for device\n"); + return (ENXIO); + } + + /* Memory interface */ + sc->bst = rman_get_bustag(sc->res[0]); + sc->bsh = rman_get_bushandle(sc->res[0]); + + /* Setup interrupt handler */ + err = bus_setup_intr(dev, sc->res[1], INTR_TYPE_MISC | INTR_MPSAFE, + NULL, pdma_intr, sc, &sc->ih); + if (err) { + device_printf(dev, "Unable to alloc interrupt resource.\n"); + return (ENXIO); + } + + node = ofw_bus_get_node(dev); + xref = OF_xref_from_node(node); + OF_device_register_xref(xref, dev); + + reg = READ4(sc, PDMA_DMAC); + reg &= ~(DMAC_HLT | DMAC_AR); + reg |= (DMAC_DMAE); + WRITE4(sc, PDMA_DMAC, reg); + + WRITE4(sc, PDMA_DMACP, 0); + + return (0); +} + +static int +pdma_detach(device_t dev) +{ + struct pdma_softc *sc; + + sc = device_get_softc(dev); + + bus_release_resources(dev, pdma_spec, sc->res); + + return (0); +} + +static int +chan_start(struct pdma_softc *sc, struct pdma_channel *chan) +{ + struct xdma_channel *xchan; + + xchan = chan->xchan; + + /* 8 byte descriptor. */ + WRITE4(sc, PDMA_DCS(chan->index), DCS_DES8); + WRITE4(sc, PDMA_DDA(chan->index), xchan->descs_phys[chan->cur_desc].ds_addr); + WRITE4(sc, PDMA_DDS, (1 << chan->index)); + + /* Channel transfer enable. */ + WRITE4(sc, PDMA_DCS(chan->index), (DCS_DES8 | DCS_CTE)); + + return (0); +} + +static int +chan_stop(struct pdma_softc *sc, struct pdma_channel *chan) +{ + int timeout; + + WRITE4(sc, PDMA_DCS(chan->index), 0); + + timeout = 100; + + do { + if ((READ4(sc, PDMA_DCS(chan->index)) & DCS_CTE) == 0) { + break; + } + } while (timeout--); + + if (timeout == 0) { + device_printf(sc->dev, "%s: Can't stop channel %d\n", + __func__, chan->index); + } + + return (0); +} + +static int +pdma_channel_alloc(device_t dev, struct xdma_channel *xchan) +{ + struct pdma_channel *chan; + struct pdma_softc *sc; + int i; + + sc = device_get_softc(dev); + + xdma_assert_locked(); + + for (i = 0; i < PDMA_NCHANNELS; i++) { + chan = &pdma_channels[i]; + if (chan->used == 0) { + chan->xchan = xchan; + xchan->chan = (void *)chan; + chan->used = 1; + chan->index = i; + + return (0); + } + } + + return (-1); +} + +static int +pdma_channel_free(device_t dev, struct xdma_channel *xchan) +{ + struct pdma_channel *chan; + struct pdma_softc *sc; + + sc = device_get_softc(dev); + + xdma_assert_locked(); + + chan = (struct pdma_channel *)xchan->chan; + chan->used = 0; + + return (0); +} + +static int +pdma_channel_prep_memcpy(device_t dev, struct xdma_channel *xchan) +{ + struct pdma_channel *chan; + struct pdma_hwdesc *desc; + struct pdma_softc *sc; + xdma_config_t *conf; + int ret; + + sc = device_get_softc(dev); + + chan = (struct pdma_channel *)xchan->chan; + /* Ensure we are not in operation */ + chan_stop(sc, chan); + + ret = xdma_desc_alloc(xchan, sizeof(struct pdma_hwdesc), 8); + if (ret != 0) { + device_printf(sc->dev, + "%s: Can't allocate descriptors.\n", __func__); + return (-1); + } + + conf = &xchan->conf; + desc = (struct pdma_hwdesc *)xchan->descs; + desc[0].dsa = conf->src_addr; + desc[0].dta = conf->dst_addr; + desc[0].drt = DRT_AUTO; + desc[0].dcm = DCM_SAI | DCM_DAI; + + /* 4 byte copy for now. */ + desc[0].dtc = (conf->block_len / 4); + desc[0].dcm |= DCM_SP_4 | DCM_DP_4 | DCM_TSZ_4; + desc[0].dcm |= DCM_TIE; + + return (0); +} + +static int +access_width(xdma_config_t *conf, uint32_t *dcm, uint32_t *max_width) +{ + + *dcm = 0; + *max_width = max(conf->src_width, conf->dst_width); + + switch (conf->src_width) { + case 1: + *dcm |= DCM_SP_1; + break; + case 2: + *dcm |= DCM_SP_2; + break; + case 4: + *dcm |= DCM_SP_4; + break; + default: + return (-1); + } + + switch (conf->dst_width) { + case 1: + *dcm |= DCM_DP_1; + break; + case 2: + *dcm |= DCM_DP_2; + break; + case 4: + *dcm |= DCM_DP_4; + break; + default: + return (-1); + } + + switch (*max_width) { + case 1: + *dcm |= DCM_TSZ_1; + break; + case 2: + *dcm |= DCM_TSZ_2; + break; + case 4: + *dcm |= DCM_TSZ_4; + break; + default: + return (-1); + }; + + return (0); +} + +static int +pdma_channel_prep_cyclic(device_t dev, struct xdma_channel *xchan) +{ + struct pdma_fdt_data *data; + struct pdma_channel *chan; + struct pdma_hwdesc *desc; + xdma_controller_t *xdma; + struct pdma_softc *sc; + xdma_config_t *conf; + int max_width; + uint32_t reg; + uint32_t dcm; + int ret; + int i; + + sc = device_get_softc(dev); + + conf = &xchan->conf; + xdma = xchan->xdma; + data = (struct pdma_fdt_data *)xdma->data; + + ret = xdma_desc_alloc(xchan, sizeof(struct pdma_hwdesc), 8); + if (ret != 0) { + device_printf(sc->dev, + "%s: Can't allocate descriptors.\n", __func__); + return (-1); + } + + chan = (struct pdma_channel *)xchan->chan; + /* Ensure we are not in operation */ + chan_stop(sc, chan); + chan->flags = CHAN_DESCR_RELINK; + chan->cur_desc = 0; + + desc = (struct pdma_hwdesc *)xchan->descs; + + for (i = 0; i < conf->block_num; i++) { + if (conf->direction == XDMA_MEM_TO_DEV) { + desc[i].dsa = conf->src_addr + (i * conf->block_len); + desc[i].dta = conf->dst_addr; + desc[i].drt = data->tx; + desc[i].dcm = DCM_SAI; + } else if (conf->direction == XDMA_DEV_TO_MEM) { + desc[i].dsa = conf->src_addr; + desc[i].dta = conf->dst_addr + (i * conf->block_len); + desc[i].drt = data->rx; + desc[i].dcm = DCM_DAI; + } else if (conf->direction == XDMA_MEM_TO_MEM) { + desc[i].dsa = conf->src_addr + (i * conf->block_len); + desc[i].dta = conf->dst_addr + (i * conf->block_len); + desc[i].drt = DRT_AUTO; + desc[i].dcm = DCM_SAI | DCM_DAI; + } + + if (access_width(conf, &dcm, &max_width) != 0) { + device_printf(dev, + "%s: can't configure access width\n", __func__); + return (-1); + } + + desc[i].dcm |= dcm | DCM_TIE; + desc[i].dtc = (conf->block_len / max_width); + + /* + * PDMA does not provide interrupt after processing each descriptor, + * but after processing all the chain only. + * As a workaround we do unlink descriptors here, so our chain will + * consists of single descriptor only. And then we reconfigure channel + * on each interrupt again. + */ + if ((chan->flags & CHAN_DESCR_RELINK) == 0) { + if (i != (conf->block_num - 1)) { + desc[i].dcm |= DCM_LINK; + reg = ((i + 1) * sizeof(struct pdma_hwdesc)); + desc[i].dtc |= (reg >> 4) << 24; + } + } + } + + return (0); +} + +static int +pdma_channel_control(device_t dev, xdma_channel_t *xchan, int cmd) +{ + struct pdma_channel *chan; + struct pdma_softc *sc; + + sc = device_get_softc(dev); + + chan = (struct pdma_channel *)xchan->chan; + + switch (cmd) { + case XDMA_CMD_BEGIN: + chan_start(sc, chan); + break; + case XDMA_CMD_TERMINATE: + chan_stop(sc, chan); + break; + case XDMA_CMD_PAUSE: + /* TODO: implement me */ + return (-1); + } + + return (0); +} + +#ifdef FDT +static int +pdma_ofw_md_data(device_t dev, pcell_t *cells, int ncells, void **ptr) +{ + struct pdma_fdt_data *data; + + if (ncells != 3) { + return (-1); + } + + data = malloc(sizeof(struct pdma_fdt_data), M_DEVBUF, (M_WAITOK | M_ZERO)); + if (data == NULL) { + device_printf(dev, "%s: Cant allocate memory\n", __func__); + return (-1); + } + + data->tx = cells[0]; + data->rx = cells[1]; + data->chan = cells[2]; + + *ptr = data; + + return (0); +} +#endif + +static device_method_t pdma_methods[] = { + /* Device interface */ + DEVMETHOD(device_probe, pdma_probe), + DEVMETHOD(device_attach, pdma_attach), + DEVMETHOD(device_detach, pdma_detach), + + /* xDMA Interface */ + DEVMETHOD(xdma_channel_alloc, pdma_channel_alloc), + DEVMETHOD(xdma_channel_free, pdma_channel_free), + DEVMETHOD(xdma_channel_prep_cyclic, pdma_channel_prep_cyclic), + DEVMETHOD(xdma_channel_prep_memcpy, pdma_channel_prep_memcpy), + DEVMETHOD(xdma_channel_control, pdma_channel_control), +#ifdef FDT + DEVMETHOD(xdma_ofw_md_data, pdma_ofw_md_data), +#endif + + DEVMETHOD_END +}; + +static driver_t pdma_driver = { + "pdma", + pdma_methods, + sizeof(struct pdma_softc), +}; + +static devclass_t pdma_devclass; + +EARLY_DRIVER_MODULE(pdma, simplebus, pdma_driver, pdma_devclass, 0, 0, + BUS_PASS_INTERRUPT + BUS_PASS_ORDER_LATE); From owner-svn-src-all@freebsd.org Tue Dec 20 18:25:42 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B1BDFC89AD3; Tue, 20 Dec 2016 18:25:42 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 6728E1A06; Tue, 20 Dec 2016 18:25:42 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBKIPfHv099703; Tue, 20 Dec 2016 18:25:41 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBKIPfVD099702; Tue, 20 Dec 2016 18:25:41 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201612201825.uBKIPfVD099702@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Tue, 20 Dec 2016 18:25:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310332 - head/cddl/contrib/opensolaris/lib/libdtrace/common X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Dec 2016 18:25:42 -0000 Author: markj Date: Tue Dec 20 18:25:41 2016 New Revision: 310332 URL: https://svnweb.freebsd.org/changeset/base/310332 Log: Avoid modifying the object string table when patching USDT probes. dtrace converts pairs of consecutive underscores in a probe name to dashes. When dtrace -G processes relocations corresponding to USDT probe sites, it performs this conversion on the corresponding symbol names prior to looking up the resulting probe names in the USDT provider definition. However, in so doing it would actually modify the input object's string table, which breaks the string suffix merging done by recent binutils. Because we don't care about the symbol name once the probe site is recorded, just perform the probe lookup using a temporary copy. Reported by: hrs, swills MFC after: 3 weeks Modified: head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_link.c Modified: head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_link.c ============================================================================== --- head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_link.c Tue Dec 20 18:09:59 2016 (r310331) +++ head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_link.c Tue Dec 20 18:25:41 2016 (r310332) @@ -1223,6 +1223,7 @@ process_obj(dtrace_hdl_t *dtp, const cha static const char dt_enabled[] = "enabled"; static const char dt_symprefix[] = "$dtrace"; static const char dt_symfmt[] = "%s%ld.%s"; + char probename[DTRACE_NAMELEN]; int fd, i, ndx, eprobe, mod = 0; Elf *elf = NULL; GElf_Ehdr ehdr; @@ -1576,8 +1577,6 @@ process_obj(dtrace_hdl_t *dtp, const cha bcopy(s, pname, p - s); pname[p - s] = '\0'; - p = strhyphenate(p + 3); /* strlen("___") */ - if (dt_symtab_lookup(data_sym, isym, rela.r_offset, shdr_rel.sh_info, &fsym, (emachine1 == EM_PPC64), elf) != 0) @@ -1628,10 +1627,14 @@ process_obj(dtrace_hdl_t *dtp, const cha "no such provider %s", pname)); } - if ((prp = dt_probe_lookup(pvp, p)) == NULL) { + if (strlcpy(probename, p + 3, sizeof (probename)) >= + sizeof (probename)) return (dt_link_error(dtp, elf, fd, bufs, - "no such probe %s", p)); - } + "invalid probe name %s", probename)); + (void) strhyphenate(probename); + if ((prp = dt_probe_lookup(pvp, probename)) == NULL) + return (dt_link_error(dtp, elf, fd, bufs, + "no such probe %s", probename)); assert(fsym.st_value <= rela.r_offset); From owner-svn-src-all@freebsd.org Tue Dec 20 18:27:55 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 453BBC89B63; Tue, 20 Dec 2016 18:27:55 +0000 (UTC) (envelope-from br@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 0DCB61BA6; Tue, 20 Dec 2016 18:27:54 +0000 (UTC) (envelope-from br@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBKIRsds099882; Tue, 20 Dec 2016 18:27:54 GMT (envelope-from br@FreeBSD.org) Received: (from br@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBKIRrBA099876; Tue, 20 Dec 2016 18:27:53 GMT (envelope-from br@FreeBSD.org) Message-Id: <201612201827.uBKIRrBA099876@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: br set sender to br@FreeBSD.org using -f From: Ruslan Bukin Date: Tue, 20 Dec 2016 18:27:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310333 - in head/sys/mips: conf ingenic X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Dec 2016 18:27:55 -0000 Author: br Date: Tue Dec 20 18:27:53 2016 New Revision: 310333 URL: https://svnweb.freebsd.org/changeset/base/310333 Log: Add jz4780 AIC (Audio Interface Controller) driver. Sponsored by: DARPA, AFRL Differential Revision: https://reviews.freebsd.org/D8808 Added: head/sys/mips/ingenic/jz4780_aic.c (contents, props changed) Modified: head/sys/mips/conf/CANNA head/sys/mips/conf/CI20 head/sys/mips/ingenic/files.jz4780 head/sys/mips/ingenic/files.x1000 Modified: head/sys/mips/conf/CANNA ============================================================================== --- head/sys/mips/conf/CANNA Tue Dec 20 18:25:41 2016 (r310332) +++ head/sys/mips/conf/CANNA Tue Dec 20 18:27:53 2016 (r310333) @@ -26,5 +26,8 @@ options ROOTDEVNAME=\"ufs:mmcsd0s3\" makeoptions TRAMPLOADADDR=0x88000000 +device sound +device xdma + #options VERBOSE_SYSINIT options PRINTF_BUFR_SIZE=256 Modified: head/sys/mips/conf/CI20 ============================================================================== --- head/sys/mips/conf/CI20 Tue Dec 20 18:25:41 2016 (r310332) +++ head/sys/mips/conf/CI20 Tue Dec 20 18:27:53 2016 (r310333) @@ -25,6 +25,9 @@ makeoptions FDT_DTS_FILE=ingenic/ci20.dt options ROOTDEVNAME=\"ufs:mmcsd0\" +device sound +device xdma + makeoptions TRAMPLOADADDR=0x88000000 #options VERBOSE_SYSINIT Modified: head/sys/mips/ingenic/files.jz4780 ============================================================================== --- head/sys/mips/ingenic/files.jz4780 Tue Dec 20 18:25:41 2016 (r310332) +++ head/sys/mips/ingenic/files.jz4780 Tue Dec 20 18:27:53 2016 (r310333) @@ -23,6 +23,10 @@ mips/ingenic/jz4780_pdma.c standard mips/ingenic/jz4780_pinctrl.c standard mips/ingenic/jz4780_timer.c standard +# Sound +mips/ingenic/jz4780_aic.c optional sound xdma +mips/ingenic/jz4780_codec.c optional sound + # SMP mips/ingenic/jz4780_mp.c optional smp mips/ingenic/jz4780_mpboot.S optional smp Modified: head/sys/mips/ingenic/files.x1000 ============================================================================== --- head/sys/mips/ingenic/files.x1000 Tue Dec 20 18:25:41 2016 (r310332) +++ head/sys/mips/ingenic/files.x1000 Tue Dec 20 18:27:53 2016 (r310333) @@ -14,5 +14,9 @@ mips/ingenic/jz4780_pdma.c standard mips/ingenic/jz4780_pinctrl.c standard mips/ingenic/jz4780_timer.c standard +# Sound +mips/ingenic/jz4780_aic.c optional sound xdma +mips/ingenic/jz4780_codec.c optional sound + # Custom interface between pinctrl and gpio mips/ingenic/jz4780_gpio_if.m standard Added: head/sys/mips/ingenic/jz4780_aic.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/mips/ingenic/jz4780_aic.c Tue Dec 20 18:27:53 2016 (r310333) @@ -0,0 +1,754 @@ +/*- + * Copyright (c) 2016 Ruslan Bukin + * All rights reserved. + * + * This software was developed by SRI International and the University of + * Cambridge Computer Laboratory under DARPA/AFRL contract FA8750-10-C-0237 + * ("CTSRD"), as part of the DARPA CRASH research programme. + * + * 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. + */ + +/* Ingenic JZ4780 Audio Interface Controller (AIC). */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +#include +#include +#include + +#include +#include +#include + +#include +#include + +#include +#include + +#define AIC_NCHANNELS 1 + +struct aic_softc { + device_t dev; + struct resource *res[1]; + bus_space_tag_t bst; + bus_space_handle_t bsh; + struct mtx *lock; + int pos; + bus_dma_tag_t dma_tag; + bus_dmamap_t dma_map; + bus_addr_t buf_base_phys; + uint32_t *buf_base; + uintptr_t aic_fifo_paddr; + int dma_size; + clk_t clk_aic; + clk_t clk_i2s; + struct aic_rate *sr; + void *ih; + struct xdma_channel *xchan; + xdma_controller_t *xdma_tx; +}; + +/* Channel registers */ +struct sc_chinfo { + struct snd_dbuf *buffer; + struct pcm_channel *channel; + struct sc_pcminfo *parent; + + /* Channel information */ + uint32_t dir; + uint32_t format; + + /* Flags */ + uint32_t run; +}; + +/* PCM device private data */ +struct sc_pcminfo { + device_t dev; + uint32_t chnum; + struct sc_chinfo chan[AIC_NCHANNELS]; + struct aic_softc *sc; +}; + +static struct resource_spec aic_spec[] = { + { SYS_RES_MEMORY, 0, RF_ACTIVE }, + { -1, 0 } +}; + +static int aic_probe(device_t dev); +static int aic_attach(device_t dev); +static int aic_detach(device_t dev); +static int setup_xdma(struct sc_pcminfo *scp); + +struct aic_rate { + uint32_t speed; +}; + +static struct aic_rate rate_map[] = { + { 96000 }, + /* TODO: add more frequences */ + { 0 }, +}; + +/* + * Mixer interface. + */ +static int +aicmixer_init(struct snd_mixer *m) +{ + struct sc_pcminfo *scp; + struct aic_softc *sc; + int mask; + + scp = mix_getdevinfo(m); + sc = scp->sc; + + if (sc == NULL) + return -1; + + mask = SOUND_MASK_PCM; + + 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 +aicmixer_set(struct snd_mixer *m, unsigned dev, + unsigned left, unsigned right) +{ + struct sc_pcminfo *scp; + + scp = mix_getdevinfo(m); + + /* Here we can configure hardware volume on our DAC */ + + return (0); +} + +static kobj_method_t aicmixer_methods[] = { + KOBJMETHOD(mixer_init, aicmixer_init), + KOBJMETHOD(mixer_set, aicmixer_set), + KOBJMETHOD_END +}; +MIXER_DECLARE(aicmixer); + +/* + * Channel interface. + */ +static void * +aicchan_init(kobj_t obj, void *devinfo, struct snd_dbuf *b, + struct pcm_channel *c, int dir) +{ + struct sc_pcminfo *scp; + struct sc_chinfo *ch; + struct aic_softc *sc; + + scp = (struct sc_pcminfo *)devinfo; + sc = scp->sc; + + snd_mtxlock(sc->lock); + ch = &scp->chan[0]; + ch->dir = dir; + ch->run = 0; + ch->buffer = b; + ch->channel = c; + ch->parent = scp; + snd_mtxunlock(sc->lock); + + if (sndbuf_setup(ch->buffer, sc->buf_base, sc->dma_size) != 0) { + device_printf(scp->dev, "Can't setup sndbuf.\n"); + return NULL; + } + + return (ch); +} + +static int +aicchan_free(kobj_t obj, void *data) +{ + struct sc_chinfo *ch = data; + struct sc_pcminfo *scp = ch->parent; + struct aic_softc *sc = scp->sc; + + snd_mtxlock(sc->lock); + /* TODO: free channel buffer */ + snd_mtxunlock(sc->lock); + + return (0); +} + +static int +aicchan_setformat(kobj_t obj, void *data, uint32_t format) +{ + struct sc_pcminfo *scp; + struct sc_chinfo *ch; + + ch = data; + scp = ch->parent; + + ch->format = format; + + return (0); +} + +static uint32_t +aicchan_setspeed(kobj_t obj, void *data, uint32_t speed) +{ + struct sc_pcminfo *scp; + struct sc_chinfo *ch; + struct aic_rate *sr; + struct aic_softc *sc; + int threshold; + int i; + + ch = data; + scp = ch->parent; + sc = scp->sc; + + sr = NULL; + + /* First look for equal frequency. */ + for (i = 0; rate_map[i].speed != 0; i++) { + if (rate_map[i].speed == speed) + sr = &rate_map[i]; + } + + /* If no match, just find nearest. */ + if (sr == NULL) { + for (i = 0; rate_map[i].speed != 0; i++) { + sr = &rate_map[i]; + threshold = sr->speed + ((rate_map[i + 1].speed != 0) ? + ((rate_map[i + 1].speed - sr->speed) >> 1) : 0); + if (speed < threshold) + break; + } + } + + sc->sr = sr; + + /* Clocks can be reconfigured here. */ + + return (sr->speed); +} + +static uint32_t +aicchan_setblocksize(kobj_t obj, void *data, uint32_t blocksize) +{ + struct sc_pcminfo *scp; + struct sc_chinfo *ch; + struct aic_softc *sc; + + ch = data; + scp = ch->parent; + sc = scp->sc; + + sndbuf_resize(ch->buffer, sc->dma_size / blocksize, blocksize); + + return (sndbuf_getblksz(ch->buffer)); +} + +static int +aic_intr(void *arg) +{ + struct sc_pcminfo *scp; + xdma_channel_t *xchan; + struct sc_chinfo *ch; + struct aic_softc *sc; + xdma_config_t *conf; + int bufsize; + + scp = arg; + sc = scp->sc; + ch = &scp->chan[0]; + + xchan = sc->xchan; + conf = &xchan->conf; + + bufsize = sndbuf_getsize(ch->buffer); + + sc->pos += conf->block_len; + if (sc->pos >= bufsize) + sc->pos -= bufsize; + + if (ch->run) + chn_intr(ch->channel); + + return (0); +} + +static int +setup_xdma(struct sc_pcminfo *scp) +{ + struct aic_softc *sc; + struct sc_chinfo *ch; + int fmt; + int err; + + ch = &scp->chan[0]; + sc = scp->sc; + + fmt = sndbuf_getfmt(ch->buffer); + + KASSERT(fmt & AFMT_16BIT, ("16-bit audio supported only.")); + + err = xdma_prep_cyclic(sc->xchan, + XDMA_MEM_TO_DEV, /* direction */ + sc->buf_base_phys, /* src addr */ + sc->aic_fifo_paddr, /* dst addr */ + sndbuf_getblksz(ch->buffer), /* block len */ + sndbuf_getblkcnt(ch->buffer), /* block num */ + 2, /* src port width */ + 2); /* dst port width */ + if (err != 0) { + device_printf(sc->dev, "Can't configure virtual channel\n"); + return (-1); + } + + xdma_begin(sc->xchan); + + return (0); +} + +static int +aic_start(struct sc_pcminfo *scp) +{ + struct aic_softc *sc; + int reg; + + sc = scp->sc; + sc->pos = 0; + + /* Ensure clock enabled. */ + reg = READ4(sc, I2SCR); + reg |= (I2SCR_ESCLK); + WRITE4(sc, I2SCR, reg); + + setup_xdma(scp); + + reg = (AICCR_OSS_16 | AICCR_ISS_16); + reg |= (AICCR_CHANNEL_2); + reg |= (AICCR_TDMS); + reg |= (AICCR_ERPL); + WRITE4(sc, AICCR, reg); + + return (0); +} + +static int +aic_stop(struct sc_pcminfo *scp) +{ + struct aic_softc *sc; + int reg; + + sc = scp->sc; + + reg = READ4(sc, AICCR); + reg &= ~(AICCR_TDMS | AICCR_ERPL); + WRITE4(sc, AICCR, reg); + + xdma_terminate(sc->xchan); + + sc->pos = 0; + + bzero(sc->buf_base, sc->dma_size); + + return (0); +} + +static int +aicchan_trigger(kobj_t obj, void *data, int go) +{ + struct sc_pcminfo *scp; + struct sc_chinfo *ch; + struct aic_softc *sc; + + ch = data; + scp = ch->parent; + sc = scp->sc; + + snd_mtxlock(sc->lock); + + switch (go) { + case PCMTRIG_START: + ch->run = 1; + + aic_start(scp); + + break; + + case PCMTRIG_STOP: + case PCMTRIG_ABORT: + ch->run = 0; + + aic_stop(scp); + + break; + } + + snd_mtxunlock(sc->lock); + + return (0); +} + +static uint32_t +aicchan_getptr(kobj_t obj, void *data) +{ + struct sc_pcminfo *scp; + struct sc_chinfo *ch; + struct aic_softc *sc; + + ch = data; + scp = ch->parent; + sc = scp->sc; + + return (sc->pos); +} + +static uint32_t aic_pfmt[] = { + SND_FORMAT(AFMT_S16_LE, 2, 0), + 0 +}; + +static struct pcmchan_caps aic_pcaps = {96000, 96000, aic_pfmt, 0}; + +static struct pcmchan_caps * +aicchan_getcaps(kobj_t obj, void *data) +{ + + return (&aic_pcaps); +} + +static kobj_method_t aicchan_methods[] = { + KOBJMETHOD(channel_init, aicchan_init), + KOBJMETHOD(channel_free, aicchan_free), + KOBJMETHOD(channel_setformat, aicchan_setformat), + KOBJMETHOD(channel_setspeed, aicchan_setspeed), + KOBJMETHOD(channel_setblocksize, aicchan_setblocksize), + KOBJMETHOD(channel_trigger, aicchan_trigger), + KOBJMETHOD(channel_getptr, aicchan_getptr), + KOBJMETHOD(channel_getcaps, aicchan_getcaps), + KOBJMETHOD_END +}; +CHANNEL_DECLARE(aicchan); + +static void +aic_dmamap_cb(void *arg, bus_dma_segment_t *segs, int nseg, int err) +{ + bus_addr_t *addr; + + if (err) + return; + + addr = (bus_addr_t*)arg; + *addr = segs[0].ds_addr; +} + +static int +aic_dma_setup(struct aic_softc *sc) +{ + device_t dev; + int err; + + dev = sc->dev; + + /* DMA buffer size. */ + sc->dma_size = 131072; + + /* + * Must use dma_size boundary as modulo feature required. + * Modulo feature allows setup circular buffer. + */ + err = bus_dma_tag_create( + bus_get_dma_tag(sc->dev), + 4, sc->dma_size, /* alignment, boundary */ + BUS_SPACE_MAXADDR_32BIT, /* lowaddr */ + BUS_SPACE_MAXADDR, /* highaddr */ + NULL, NULL, /* filter, filterarg */ + sc->dma_size, 1, /* maxsize, nsegments */ + sc->dma_size, 0, /* maxsegsize, flags */ + NULL, NULL, /* lockfunc, lockarg */ + &sc->dma_tag); + if (err) { + device_printf(dev, "cannot create bus dma tag\n"); + return (-1); + } + + err = bus_dmamem_alloc(sc->dma_tag, (void **)&sc->buf_base, + BUS_DMA_WAITOK | BUS_DMA_COHERENT, &sc->dma_map); + if (err) { + device_printf(dev, "cannot allocate memory\n"); + return (-1); + } + + err = bus_dmamap_load(sc->dma_tag, sc->dma_map, sc->buf_base, + sc->dma_size, aic_dmamap_cb, &sc->buf_base_phys, BUS_DMA_WAITOK); + if (err) { + device_printf(dev, "cannot load DMA map\n"); + return (-1); + } + + bzero(sc->buf_base, sc->dma_size); + + return (0); +} + +static int +aic_configure_clocks(struct aic_softc *sc) +{ + uint64_t aic_freq; + uint64_t i2s_freq; + device_t dev; + int err; + + dev = sc->dev; + + err = clk_get_by_ofw_name(sc->dev, 0, "aic", &sc->clk_aic); + if (err != 0) { + device_printf(dev, "Can't find aic clock.\n"); + return (-1); + } + + err = clk_enable(sc->clk_aic); + if (err != 0) { + device_printf(dev, "Can't enable aic clock.\n"); + return (-1); + } + + err = clk_get_by_ofw_name(sc->dev, 0, "i2s", &sc->clk_i2s); + if (err != 0) { + device_printf(dev, "Can't find i2s clock.\n"); + return (-1); + } + + err = clk_enable(sc->clk_i2s); + if (err != 0) { + device_printf(dev, "Can't enable i2s clock.\n"); + return (-1); + } + + err = clk_set_freq(sc->clk_i2s, 12000000, 0); + if (err != 0) { + device_printf(dev, "Can't set i2s frequency.\n"); + return (-1); + } + + clk_get_freq(sc->clk_aic, &aic_freq); + clk_get_freq(sc->clk_i2s, &i2s_freq); + + device_printf(dev, "Frequency aic %d i2s %d\n", + (uint32_t)aic_freq, (uint32_t)i2s_freq); + + return (0); +} + +static int +aic_configure(struct aic_softc *sc) +{ + int internal_codec; + int reg; + + internal_codec = 1; + + WRITE4(sc, AICFR, AICFR_RST); + + /* Configure AIC */ + reg = 0; + if (internal_codec) { + reg |= (AICFR_ICDC); + } else { + reg |= (AICFR_SYNCD | AICFR_BCKD); + } + reg |= (AICFR_AUSEL); /* I2S/MSB-justified format. */ + reg |= (AICFR_TFTH(8)); /* Transmit FIFO threshold */ + reg |= (AICFR_RFTH(7)); /* Receive FIFO threshold */ + WRITE4(sc, AICFR, reg); + + reg = READ4(sc, AICFR); + reg |= (AICFR_ENB); /* Enable the controller. */ + WRITE4(sc, AICFR, reg); + + return (0); +} + +static int +aic_probe(device_t dev) +{ + + if (!ofw_bus_status_okay(dev)) + return (ENXIO); + + if (!ofw_bus_is_compatible(dev, "ingenic,jz4780-i2s")) + return (ENXIO); + + device_set_desc(dev, "Audio Interface Controller"); + + return (BUS_PROBE_DEFAULT); +} + +static int +aic_attach(device_t dev) +{ + char status[SND_STATUSLEN]; + struct sc_pcminfo *scp; + struct aic_softc *sc; + int err; + + sc = malloc(sizeof(*sc), M_DEVBUF, M_WAITOK | M_ZERO); + sc->dev = dev; + sc->pos = 0; + + /* Get xDMA controller */ + sc->xdma_tx = xdma_ofw_get(sc->dev, "tx"); + if (sc->xdma_tx == NULL) { + device_printf(dev, "Can't find DMA controller.\n"); + return (ENXIO); + } + + /* Alloc xDMA virtual channel. */ + sc->xchan = xdma_channel_alloc(sc->xdma_tx); + if (sc->xchan == NULL) { + device_printf(dev, "Can't alloc virtual DMA channel.\n"); + return (ENXIO); + } + + /* Setup sound subsystem */ + sc->lock = snd_mtxcreate(device_get_nameunit(dev), "aic softc"); + if (sc->lock == NULL) { + device_printf(dev, "Can't create mtx.\n"); + return (ENXIO); + } + + if (bus_alloc_resources(dev, aic_spec, sc->res)) { + device_printf(dev, + "could not allocate resources for device\n"); + return (ENXIO); + } + + /* Memory interface */ + sc->bst = rman_get_bustag(sc->res[0]); + sc->bsh = rman_get_bushandle(sc->res[0]); + sc->aic_fifo_paddr = rman_get_start(sc->res[0]) + AICDR; + + /* Setup PCM. */ + scp = malloc(sizeof(struct sc_pcminfo), M_DEVBUF, M_WAITOK | M_ZERO); + scp->sc = sc; + scp->dev = dev; + + /* Setup audio buffer. */ + err = aic_dma_setup(sc); + if (err != 0) { + device_printf(dev, "Can't setup sound buffer.\n"); + return (ENXIO); + } + + /* Setup clocks. */ + err = aic_configure_clocks(sc); + if (err != 0) { + device_printf(dev, "Can't configure clocks.\n"); + return (ENXIO); + } + + err = aic_configure(sc); + if (err != 0) { + device_printf(dev, "Can't configure AIC.\n"); + return (ENXIO); + } + + pcm_setflags(dev, pcm_getflags(dev) | SD_F_MPSAFE); + + /* Setup interrupt handler. */ + err = xdma_setup_intr(sc->xchan, aic_intr, scp, &sc->ih); + if (err) { + device_printf(sc->dev, + "Can't setup xDMA interrupt handler.\n"); + return (ENXIO); + } + + err = pcm_register(dev, scp, 1, 0); + if (err) { + device_printf(dev, "Can't register pcm.\n"); + return (ENXIO); + } + + scp->chnum = 0; + pcm_addchan(dev, PCMDIR_PLAY, &aicchan_class, scp); + scp->chnum++; + + snprintf(status, SND_STATUSLEN, "at %s", ofw_bus_get_name(dev)); + pcm_setstatus(dev, status); + + mixer_init(dev, &aicmixer_class, scp); + + return (0); +} + +static int +aic_detach(device_t dev) +{ + struct aic_softc *sc; + + sc = device_get_softc(dev); + + xdma_channel_free(sc->xchan); + + bus_release_resources(dev, aic_spec, sc->res); + + return (0); +} + +static device_method_t aic_pcm_methods[] = { + /* Device interface */ + DEVMETHOD(device_probe, aic_probe), + DEVMETHOD(device_attach, aic_attach), + DEVMETHOD(device_detach, aic_detach), + DEVMETHOD_END +}; + +static driver_t aic_pcm_driver = { + "pcm", + aic_pcm_methods, + PCM_SOFTC_SIZE, +}; + +DRIVER_MODULE(aic, simplebus, aic_pcm_driver, pcm_devclass, 0, 0); +MODULE_DEPEND(aic, sound, SOUND_MINVER, SOUND_PREFVER, SOUND_MAXVER); +MODULE_VERSION(aic, 1); From owner-svn-src-all@freebsd.org Tue Dec 20 18:47:03 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 865ECC87595; Tue, 20 Dec 2016 18:47:03 +0000 (UTC) (envelope-from br@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 31AB818D0; Tue, 20 Dec 2016 18:47:03 +0000 (UTC) (envelope-from br@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBKIl2qm010272; Tue, 20 Dec 2016 18:47:02 GMT (envelope-from br@FreeBSD.org) Received: (from br@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBKIl25t010271; Tue, 20 Dec 2016 18:47:02 GMT (envelope-from br@FreeBSD.org) Message-Id: <201612201847.uBKIl25t010271@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: br set sender to br@FreeBSD.org using -f From: Ruslan Bukin Date: Tue, 20 Dec 2016 18:47:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310334 - head/sys/mips/ingenic X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Dec 2016 18:47:03 -0000 Author: br Date: Tue Dec 20 18:47:02 2016 New Revision: 310334 URL: https://svnweb.freebsd.org/changeset/base/310334 Log: o Unmute headphones on Imgtec CI20 board. o Add some delay between codec initialization procedures. Sponsored by: DARPA, AFRL Modified: head/sys/mips/ingenic/jz4780_codec.c Modified: head/sys/mips/ingenic/jz4780_codec.c ============================================================================== --- head/sys/mips/ingenic/jz4780_codec.c Tue Dec 20 18:27:53 2016 (r310333) +++ head/sys/mips/ingenic/jz4780_codec.c Tue Dec 20 18:47:02 2016 (r310334) @@ -43,6 +43,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include @@ -50,9 +51,14 @@ __FBSDID("$FreeBSD$"); #include #include +#include + #include #include +#define CI20_HP_PIN 13 +#define CI20_HP_PORT 3 + struct codec_softc { device_t dev; struct resource *res[1]; @@ -149,6 +155,41 @@ codec_print_registers(struct codec_softc printf("codec DR_ADC_AGC %x\n", codec_read(sc, DR_ADC_AGC)); } +/* + * CI20 board-specific + */ +static int +ci20_hp_unmute(struct codec_softc *sc) +{ + device_t dev; + int port; + int err; + int pin; + + pin = CI20_HP_PIN; + port = CI20_HP_PORT; + + dev = devclass_get_device(devclass_find("gpio"), port); + if (dev == NULL) + return (0); + + err = GPIO_PIN_SETFLAGS(dev, pin, GPIO_PIN_OUTPUT); + if (err != 0) { + device_printf(dev, "Cannot configure GPIO pin %d on %s\n", + pin, device_get_nameunit(dev)); + return (err); + } + + err = GPIO_PIN_SET(dev, pin, 0); + if (err != 0) { + device_printf(dev, "Cannot configure GPIO pin %d on %s\n", + pin, device_get_nameunit(dev)); + return (err); + } + + return (0); +} + static int codec_probe(device_t dev) { @@ -187,10 +228,14 @@ codec_attach(device_t dev) reg &= ~(VIC_SB_SLEEP | VIC_SB); codec_write(sc, CR_VIC, reg); + DELAY(20000); + reg = codec_read(sc, CR_DAC); reg &= ~(DAC_SB | DAC_MUTE); codec_write(sc, CR_DAC, reg); + DELAY(10000); + /* I2S, 16-bit, 96 kHz. */ reg = codec_read(sc, AICR_DAC); reg &= ~(AICR_DAC_SB | DAC_ADWL_M); @@ -199,13 +244,19 @@ codec_attach(device_t dev) reg |= AUDIOIF_I2S; codec_write(sc, AICR_DAC, reg); + DELAY(10000); + reg = FCR_DAC_96; codec_write(sc, FCR_DAC, reg); + DELAY(10000); + /* Unmute headphones. */ reg = codec_read(sc, CR_HP); reg &= ~(HP_SB | HP_MUTE); - codec_write(sc, CR_HP, 0); + codec_write(sc, CR_HP, reg); + + ci20_hp_unmute(sc); return (0); } From owner-svn-src-all@freebsd.org Tue Dec 20 19:30:22 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id BDF90C892FF; Tue, 20 Dec 2016 19:30:22 +0000 (UTC) (envelope-from gnn@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 85F71FB1; Tue, 20 Dec 2016 19:30:22 +0000 (UTC) (envelope-from gnn@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBKJULEH026351; Tue, 20 Dec 2016 19:30:21 GMT (envelope-from gnn@FreeBSD.org) Received: (from gnn@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBKJULsD026350; Tue, 20 Dec 2016 19:30:21 GMT (envelope-from gnn@FreeBSD.org) Message-Id: <201612201930.uBKJULsD026350@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gnn set sender to gnn@FreeBSD.org using -f From: "George V. Neville-Neil" Date: Tue, 20 Dec 2016 19:30:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r310335 - stable/11/sys/cddl/contrib/opensolaris/uts/common/dtrace X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Dec 2016 19:30:22 -0000 Author: gnn Date: Tue Dec 20 19:30:21 2016 New Revision: 310335 URL: https://svnweb.freebsd.org/changeset/base/310335 Log: MFC: 309669 Fix a kernel panic in DTrace's rw_iswriter subroutine. On FreeBSD the sense of rw_write_held() and rw_iswriter() were reversed, probably due to a cut and paste error. Using rw_iswriter() would cause the kernel to panic. Reviewed by: markj Sponsored by: DARPA, AFRL Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c Tue Dec 20 18:47:02 2016 (r310334) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c Tue Dec 20 19:30:21 2016 (r310335) @@ -4274,8 +4274,8 @@ dtrace_dif_subr(uint_t subr, uint_t rd, break; } l.lx = dtrace_loadptr(tupregs[0].dttk_value); - LOCK_CLASS(l.li)->lc_owner(l.li, &lowner); - regs[rd] = (lowner == curthread); + regs[rd] = LOCK_CLASS(l.li)->lc_owner(l.li, &lowner) && + lowner != NULL; break; case DIF_SUBR_RW_ISWRITER: @@ -4286,8 +4286,8 @@ dtrace_dif_subr(uint_t subr, uint_t rd, break; } l.lx = dtrace_loadptr(tupregs[0].dttk_value); - regs[rd] = LOCK_CLASS(l.li)->lc_owner(l.li, &lowner) && - lowner != NULL; + LOCK_CLASS(l.li)->lc_owner(l.li, &lowner); + regs[rd] = (lowner == curthread); break; #endif /* illumos */ From owner-svn-src-all@freebsd.org Tue Dec 20 19:44:45 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B5EBAC89721; Tue, 20 Dec 2016 19:44:45 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 787AB1878; Tue, 20 Dec 2016 19:44:45 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBKJiiHO034232; Tue, 20 Dec 2016 19:44:44 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBKJiiMg034231; Tue, 20 Dec 2016 19:44:44 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201612201944.uBKJiiMg034231@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Tue, 20 Dec 2016 19:44:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310336 - head/sys/kern X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Dec 2016 19:44:45 -0000 Author: jhb Date: Tue Dec 20 19:44:44 2016 New Revision: 310336 URL: https://svnweb.freebsd.org/changeset/base/310336 Log: Don't spin in pause() during early boot for kthreads other than thread0. pause() uses a spin loop to simulate a sleep during early boot. However, we only need this for thread0 to get far enough in the boot process to enable timers (at which point pause() can sleep). For other kthreads, sleeping in pause() is ok as the callout will be scheduled and will eventually fire once thread0 initializes timers. Tested by: Steven Kargl Sleuthing by: markj MFC after: 1 week Sponsored by: Netflix Modified: head/sys/kern/kern_synch.c Modified: head/sys/kern/kern_synch.c ============================================================================== --- head/sys/kern/kern_synch.c Tue Dec 20 19:30:21 2016 (r310335) +++ head/sys/kern/kern_synch.c Tue Dec 20 19:44:44 2016 (r310336) @@ -321,7 +321,8 @@ pause_sbt(const char *wmesg, sbintime_t if (sbt == 0) sbt = tick_sbt; - if (cold || kdb_active || SCHEDULER_STOPPED()) { + if ((cold && curthread == &thread0) || kdb_active || + SCHEDULER_STOPPED()) { /* * We delay one second at a time to avoid overflowing the * system specific DELAY() function(s): From owner-svn-src-all@freebsd.org Tue Dec 20 20:11:17 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7CD1EC89D26; Tue, 20 Dec 2016 20:11:17 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 3AF0363C; Tue, 20 Dec 2016 20:11:17 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBKKBGiL043315; Tue, 20 Dec 2016 20:11:16 GMT (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBKKBGZr043314; Tue, 20 Dec 2016 20:11:16 GMT (envelope-from glebius@FreeBSD.org) Message-Id: <201612202011.uBKKBGZr043314@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: glebius set sender to glebius@FreeBSD.org using -f From: Gleb Smirnoff Date: Tue, 20 Dec 2016 20:11:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310337 - head/lib/libkvm X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Dec 2016 20:11:17 -0000 Author: glebius Date: Tue Dec 20 20:11:16 2016 New Revision: 310337 URL: https://svnweb.freebsd.org/changeset/base/310337 Log: Fix memory leak. CID: 1367751 Reviewed by: jhb Modified: head/lib/libkvm/kvm_private.c Modified: head/lib/libkvm/kvm_private.c ============================================================================== --- head/lib/libkvm/kvm_private.c Tue Dec 20 19:44:44 2016 (r310336) +++ head/lib/libkvm/kvm_private.c Tue Dec 20 20:11:16 2016 (r310337) @@ -200,6 +200,7 @@ _kvm_read_core_phdrs(kvm_t *kd, size_t * for (i = 0; i < phnum; i++) { if (gelf_getphdr(elf, i, &phdr[i]) == NULL) { + free(phdr); _kvm_err(kd, kd->program, "%s", elf_errmsg(0)); goto bad; } From owner-svn-src-all@freebsd.org Tue Dec 20 20:50:15 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9E9A4C89DD4; Tue, 20 Dec 2016 20:50:15 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from mail.baldwin.cx (bigwig.baldwin.cx [96.47.65.170]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E5F3B1A48; Tue, 20 Dec 2016 20:50:14 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from ralph.baldwin.cx (c-73-231-226-104.hsd1.ca.comcast.net [73.231.226.104]) by mail.baldwin.cx (Postfix) with ESMTPSA id CF11F10AA28; Tue, 20 Dec 2016 15:50:13 -0500 (EST) From: John Baldwin To: Ruslan Bukin Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r310330 - in head: share/man/man4 sys/conf sys/dev/xdma Date: Tue, 20 Dec 2016 12:50:11 -0800 Message-ID: <1904181.V85ZRTRTAB@ralph.baldwin.cx> User-Agent: KMail/4.14.10 (FreeBSD/11.0-PRERELEASE; KDE/4.14.10; amd64; ; ) In-Reply-To: <201612201802.uBKI27oN091165@repo.freebsd.org> References: <201612201802.uBKI27oN091165@repo.freebsd.org> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.4.3 (mail.baldwin.cx); Tue, 20 Dec 2016 15:50:13 -0500 (EST) X-Virus-Scanned: clamav-milter 0.99.2 at mail.baldwin.cx X-Virus-Status: Clean X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Dec 2016 20:50:15 -0000 On Tuesday, December 20, 2016 06:02:07 PM Ruslan Bukin wrote: > Author: br > Date: Tue Dec 20 18:02:07 2016 > New Revision: 310330 > URL: https://svnweb.freebsd.org/changeset/base/310330 > > Log: > Add xDMA -- the DMA abstraction layer, initial verison. > > xDMA is a DMA framework designed to abstract the interaction > between device drivers and DMA engines. > > Project wiki: https://wiki.freebsd.org/xdma > > Sponsored by: DARPA, AFRL > Differential Revision: https://reviews.freebsd.org/D8807 It probably would have been a good idea to get some design review of this on arch@ before committing. In particular, I believe from earlier discussions that you want to build a general framework that things like ioat(4) can hook into. arch@ would give you a broader audience for working out the abstractions and interfaces. -- John Baldwin From owner-svn-src-all@freebsd.org Tue Dec 20 21:17:09 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 310EBC885FD; Tue, 20 Dec 2016 21:17:09 +0000 (UTC) (envelope-from ken@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E02CCA11; Tue, 20 Dec 2016 21:17:08 +0000 (UTC) (envelope-from ken@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBKLH8gE070146; Tue, 20 Dec 2016 21:17:08 GMT (envelope-from ken@FreeBSD.org) Received: (from ken@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBKLH77j070143; Tue, 20 Dec 2016 21:17:07 GMT (envelope-from ken@FreeBSD.org) Message-Id: <201612202117.uBKLH77j070143@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ken set sender to ken@FreeBSD.org using -f From: "Kenneth D. Merry" Date: Tue, 20 Dec 2016 21:17:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310338 - in head: share/man/man4 sys/conf sys/dev/isp X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Dec 2016 21:17:09 -0000 Author: ken Date: Tue Dec 20 21:17:07 2016 New Revision: 310338 URL: https://svnweb.freebsd.org/changeset/base/310338 Log: Turn on FC-Tape by default in the isp(4) driver. FC-Tape provides additional link level error recovery, and is highly recommended for tape devices. It will only be turned on for a given target if the target supports it. Without this setting, we default to whatever FC-Tape setting is in NVRAM on the card. This can be overridden by setting the following loader tunable, for example for isp0: hint.isp.0.nofctape=1 sys/conf/options: Add a new kernel config option, ISP_FCTAPE_OFF, that defaults the FC-Tape configuration to off. sys/dev/isp/isp_pci.c: If ISP_FCTAPE_OFF is defined, turn off FC-Tape. Otherwise, turn it on if the card supports it. share/man/man4/isp.4: Add a description of FC-Tape to the isp(4) man page. Add descriptions of the fctape and nofctape options, as well as the ISP_FCTAPE_OFF kernel configuration option. Add the ispfw module and kernel drivers to the suggested configurations at the top of the man page so that users are less likely to leave it out. The driver works well with the included firmware, but may not work at all with whatever firmware the user has flashed on their card. MFC after: 3 days Sponsored by: Spectra Logic Modified: head/share/man/man4/isp.4 head/sys/conf/options head/sys/dev/isp/isp_pci.c Modified: head/share/man/man4/isp.4 ============================================================================== --- head/share/man/man4/isp.4 Tue Dec 20 20:11:16 2016 (r310337) +++ head/share/man/man4/isp.4 Tue Dec 20 21:17:07 2016 (r310338) @@ -26,7 +26,7 @@ .\" .\" $FreeBSD$ .\" -.Dd December 9, 2015 +.Dd December 20, 2016 .Dt ISP 4 .Os .Sh NAME @@ -39,13 +39,15 @@ kernel configuration file: .Bd -ragged -offset indent .Cd "device scbus" .Cd "device isp" +.Cd "device ispfw" .Ed .Pp Alternatively, to load the driver as a -module at boot time, place the following line in +module at boot time, place the following lines in .Xr loader.conf 5 : .Bd -literal -offset indent isp_load="YES" +ispfw_load="YES" .Ed .Sh DESCRIPTION This driver provides access to @@ -62,6 +64,30 @@ Fibre Channel supports initiator and tar utilizing Class 3 and Class 2 (2200 and later) connections. Support is available for Public and Private loops, Point-to-Point and Fabric connections. +.Pp +FC-Tape is supported on 4Gb (2400) and newer controllers. +FC-Tape is highly recommended for connections to tape drives that support +it. +It encompasses four elements from the the T-10 FCP-4 specification: +.Bl -bullet -offset indent +.It +Precise Delivery of Commands +.It +Confirmed Completion of FCP I/O Operations +.It +Retransmission of Unsuccessfully Transmitted IUs +.It +Task Retry Identification +.El +.Pp +Together these features allow for link level error recovery with tape +devices. +Without it, an initiator cannot, for instance, tell whether a tape write +command that has timed out resulted in all, part or none of the data going to +the tape drive. +FC-Tape is automatically enabled when connecting controller that supports +it to a target that supports it. +It may be disabled using configuration and hint options described below. .Sh FIRMWARE Firmware loading is supported if the .Xr ispfw 4 @@ -120,6 +146,13 @@ Target mode support for Fibre Channel ad .Cd options ISP_TARGET_MODE .Pp option. +.Pp +To disable FC-Tape, use the following configuration option: +.Pp +.Cd options ISP_FCTAPE_OFF +.Pp +Note that even if the ISP_FCTAPE_OFF option is used, it may be overridden +by the fctape hint described below. .Sh BOOT OPTIONS The following options are switchable by setting values in .Pa /boot/device.hints . @@ -169,6 +202,11 @@ A hint value for a driver debug level (s for the values. .It Va hint.isp.0.vports A hint to create specified number of additional virtual ports. +.It Va hint.isp.0.nofctape +Set this to 1 to disable FC-Tape operation on the given isp instance. +.It Va hint.isp.0.fctape +Set this to 1 to enable FC-Tape operation on the given isp instance for +targets that support it. .El .Sh SYSCTL OPTIONS .Bl -tag -width indent Modified: head/sys/conf/options ============================================================================== --- head/sys/conf/options Tue Dec 20 20:11:16 2016 (r310337) +++ head/sys/conf/options Tue Dec 20 21:17:07 2016 (r310338) @@ -384,6 +384,7 @@ ISP_TARGET_MODE opt_isp.h ISP_FW_CRASH_DUMP opt_isp.h ISP_DEFAULT_ROLES opt_isp.h ISP_INTERNAL_TARGET opt_isp.h +ISP_FCTAPE_OFF opt_isp.h # Options used only in dev/iscsi ISCSI_INITIATOR_DEBUG opt_iscsi_initiator.h Modified: head/sys/dev/isp/isp_pci.c ============================================================================== --- head/sys/dev/isp/isp_pci.c Tue Dec 20 20:11:16 2016 (r310337) +++ head/sys/dev/isp/isp_pci.c Tue Dec 20 21:17:07 2016 (r310338) @@ -598,11 +598,18 @@ isp_get_specific_options(device_t dev, i } } +#ifdef ISP_FCTAPE_OFF + isp->isp_confopts |= ISP_CFG_NOFCTAPE; +#else + isp->isp_confopts |= ISP_CFG_FCTAPE; +#endif + tval = 0; snprintf(name, sizeof(name), "%snofctape", prefix); (void) resource_int_value(device_get_name(dev), device_get_unit(dev), name, &tval); if (tval) { + isp->isp_confopts &= ~ISP_CFG_FCTAPE; isp->isp_confopts |= ISP_CFG_NOFCTAPE; } From owner-svn-src-all@freebsd.org Tue Dec 20 21:58:45 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4F36EC7642A; Tue, 20 Dec 2016 21:58:45 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 11AF2255; Tue, 20 Dec 2016 21:58:44 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBKLwicZ086934; Tue, 20 Dec 2016 21:58:44 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBKLwiaH086932; Tue, 20 Dec 2016 21:58:44 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201612202158.uBKLwiaH086932@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Tue, 20 Dec 2016 21:58:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310339 - in head/sys/cam: ctl scsi X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Dec 2016 21:58:45 -0000 Author: mav Date: Tue Dec 20 21:58:43 2016 New Revision: 310339 URL: https://svnweb.freebsd.org/changeset/base/310339 Log: Bump specifications support to SAM-6/SPC-5. Modified: head/sys/cam/ctl/ctl.c head/sys/cam/scsi/scsi_all.h Modified: head/sys/cam/ctl/ctl.c ============================================================================== --- head/sys/cam/ctl/ctl.c Tue Dec 20 21:17:07 2016 (r310338) +++ head/sys/cam/ctl/ctl.c Tue Dec 20 21:58:43 2016 (r310339) @@ -10174,7 +10174,7 @@ ctl_inquiry_std(struct ctl_scsiio *ctsio inq_ptr->device = (SID_QUAL_BAD_LU << 5) | T_NODEVICE; /* RMB in byte 2 is 0 */ - inq_ptr->version = SCSI_REV_SPC4; + inq_ptr->version = SCSI_REV_SPC5; /* * According to SAM-3, even if a device only supports a single @@ -10272,10 +10272,10 @@ ctl_inquiry_std(struct ctl_scsiio *ctsio inq_ptr->spi3data = SID_SPI_CLOCK_DT_ST | SID_SPI_QAS | SID_SPI_IUS; - /* SAM-5 (no version claimed) */ - scsi_ulto2b(0x00A0, inq_ptr->version1); - /* SPC-4 (no version claimed) */ - scsi_ulto2b(0x0460, inq_ptr->version2); + /* SAM-6 (no version claimed) */ + scsi_ulto2b(0x00C0, inq_ptr->version1); + /* SPC-5 (no version claimed) */ + scsi_ulto2b(0x05C0, inq_ptr->version2); if (port_type == CTL_PORT_FC) { /* FCP-2 ANSI INCITS.350:2003 */ scsi_ulto2b(0x0917, inq_ptr->version3); Modified: head/sys/cam/scsi/scsi_all.h ============================================================================== --- head/sys/cam/scsi/scsi_all.h Tue Dec 20 21:17:07 2016 (r310338) +++ head/sys/cam/scsi/scsi_all.h Tue Dec 20 21:58:43 2016 (r310339) @@ -2156,6 +2156,7 @@ struct scsi_inquiry_data #define SCSI_REV_SPC2 4 #define SCSI_REV_SPC3 5 #define SCSI_REV_SPC4 6 +#define SCSI_REV_SPC5 7 #define SID_ECMA 0x38 #define SID_ISO 0xC0 From owner-svn-src-all@freebsd.org Tue Dec 20 22:08:38 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 10278C768B8; Tue, 20 Dec 2016 22:08:38 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id BAAC3B76; Tue, 20 Dec 2016 22:08:37 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBKM8ata090814; Tue, 20 Dec 2016 22:08:36 GMT (envelope-from cem@FreeBSD.org) Received: (from cem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBKM8aH9090812; Tue, 20 Dec 2016 22:08:36 GMT (envelope-from cem@FreeBSD.org) Message-Id: <201612202208.uBKM8aH9090812@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cem set sender to cem@FreeBSD.org using -f From: "Conrad E. Meyer" Date: Tue, 20 Dec 2016 22:08:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310340 - in head/sys/dev: ichiic sdhci X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Dec 2016 22:08:38 -0000 Author: cem Date: Tue Dec 20 22:08:36 2016 New Revision: 310340 URL: https://svnweb.freebsd.org/changeset/base/310340 Log: Add Braswell PCI IDs for Intel Cherryview Submitted by: Johannes Lundberg Reviewed by: jhb Differential Revision: https://reviews.freebsd.org/D8861 Modified: head/sys/dev/ichiic/ig4_pci.c head/sys/dev/sdhci/sdhci_pci.c Modified: head/sys/dev/ichiic/ig4_pci.c ============================================================================== --- head/sys/dev/ichiic/ig4_pci.c Tue Dec 20 21:58:43 2016 (r310339) +++ head/sys/dev/ichiic/ig4_pci.c Tue Dec 20 22:08:36 2016 (r310340) @@ -68,6 +68,12 @@ static int ig4iic_pci_detach(device_t de #define PCI_CHIP_LYNXPT_LP_I2C_1 0x9c618086 #define PCI_CHIP_LYNXPT_LP_I2C_2 0x9c628086 +#define PCI_CHIP_BRASWELL_I2C_1 0x22c18086 +#define PCI_CHIP_BRASWELL_I2C_2 0x22c28086 +#define PCI_CHIP_BRASWELL_I2C_3 0x22c38086 +#define PCI_CHIP_BRASWELL_I2C_5 0x22c58086 +#define PCI_CHIP_BRASWELL_I2C_6 0x22c68086 +#define PCI_CHIP_BRASWELL_I2C_7 0x22c78086 static int ig4iic_pci_probe(device_t dev) @@ -79,6 +85,24 @@ ig4iic_pci_probe(device_t dev) case PCI_CHIP_LYNXPT_LP_I2C_2: device_set_desc(dev, "Intel Lynx Point-LP I2C Controller-2"); break; + case PCI_CHIP_BRASWELL_I2C_1: + device_set_desc(dev, "Intel Braswell Serial I/O I2C Port 1"); + break; + case PCI_CHIP_BRASWELL_I2C_2: + device_set_desc(dev, "Intel Braswell Serial I/O I2C Port 2"); + break; + case PCI_CHIP_BRASWELL_I2C_3: + device_set_desc(dev, "Intel Braswell Serial I/O I2C Port 3"); + break; + case PCI_CHIP_BRASWELL_I2C_5: + device_set_desc(dev, "Intel Braswell Serial I/O I2C Port 5"); + break; + case PCI_CHIP_BRASWELL_I2C_6: + device_set_desc(dev, "Intel Braswell Serial I/O I2C Port 6"); + break; + case PCI_CHIP_BRASWELL_I2C_7: + device_set_desc(dev, "Intel Braswell Serial I/O I2C Port 7"); + break; default: return (ENXIO); } Modified: head/sys/dev/sdhci/sdhci_pci.c ============================================================================== --- head/sys/dev/sdhci/sdhci_pci.c Tue Dec 20 21:58:43 2016 (r310339) +++ head/sys/dev/sdhci/sdhci_pci.c Tue Dec 20 22:08:36 2016 (r310340) @@ -107,6 +107,8 @@ static const struct sdhci_device { SDHCI_QUIRK_RESET_AFTER_REQUEST }, { 0x16bc14e4, 0xffff, "Broadcom BCM577xx SDXC/MMC Card Reader", SDHCI_QUIRK_BCM577XX_400KHZ_CLKSRC }, + { 0x22948086, 0xffff, "Braswell Storage Cluster Control MMC Port", + 0 }, { 0, 0xffff, NULL, 0 } }; From owner-svn-src-all@freebsd.org Tue Dec 20 22:47:10 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B206BC81877; Tue, 20 Dec 2016 22:47:10 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 81B75289; Tue, 20 Dec 2016 22:47:10 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBKMl9bX006709; Tue, 20 Dec 2016 22:47:09 GMT (envelope-from cem@FreeBSD.org) Received: (from cem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBKMl9bW006708; Tue, 20 Dec 2016 22:47:09 GMT (envelope-from cem@FreeBSD.org) Message-Id: <201612202247.uBKMl9bW006708@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cem set sender to cem@FreeBSD.org using -f From: "Conrad E. Meyer" Date: Tue, 20 Dec 2016 22:47:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310341 - head/sys/dev/sdhci X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Dec 2016 22:47:10 -0000 Author: cem Date: Tue Dec 20 22:47:09 2016 New Revision: 310341 URL: https://svnweb.freebsd.org/changeset/base/310341 Log: Follow-up to r310340: Add missing "Intel" to description Reported by: rpokala@ Modified: head/sys/dev/sdhci/sdhci_pci.c Modified: head/sys/dev/sdhci/sdhci_pci.c ============================================================================== --- head/sys/dev/sdhci/sdhci_pci.c Tue Dec 20 22:08:36 2016 (r310340) +++ head/sys/dev/sdhci/sdhci_pci.c Tue Dec 20 22:47:09 2016 (r310341) @@ -107,7 +107,7 @@ static const struct sdhci_device { SDHCI_QUIRK_RESET_AFTER_REQUEST }, { 0x16bc14e4, 0xffff, "Broadcom BCM577xx SDXC/MMC Card Reader", SDHCI_QUIRK_BCM577XX_400KHZ_CLKSRC }, - { 0x22948086, 0xffff, "Braswell Storage Cluster Control MMC Port", + { 0x22948086, 0xffff, "Intel Braswell Storage Cluster Control MMC Port", 0 }, { 0, 0xffff, NULL, 0 } From owner-svn-src-all@freebsd.org Wed Dec 21 00:47:34 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 607FAC88270; Wed, 21 Dec 2016 00:47:34 +0000 (UTC) (envelope-from cse.cem@gmail.com) Received: from mail-wj0-f170.google.com (mail-wj0-f170.google.com [209.85.210.170]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 74EC9112D; Wed, 21 Dec 2016 00:47:33 +0000 (UTC) (envelope-from cse.cem@gmail.com) Received: by mail-wj0-f170.google.com with SMTP id xy5so189606271wjc.0; Tue, 20 Dec 2016 16:47:33 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:reply-to:in-reply-to:references :from:date:message-id:subject:to:cc:content-transfer-encoding; bh=6tb+h4fNNOHEW6lSGkx50xh9MypJYKYFGTzfYhvZHm0=; b=Shab7wLqhkDS7sGH9vY2PLmHfmWH2YCi6fngbl2RMVZXQX1boSW8nGFXTD7jHt4qZ+ CC/JylAnpJ2tNjidAgrqL7eT7krqGLigTecWGiQKpRuoAS7XoFE+NTKzLiM70/TMU7La 7+i/Jci1ZA7CrNeDJ+yXEcA8CnHVDXgudzADMcfeWLWHA5JDEQujgQaNpoCukaL/ZZHI Ns0ZBi0aYKv3IE7Yr9kEG0TE5NZEcZUG5MHOMO4AL3O5OC2ZdSd0jeYWGP3tGttPUrCb Oi1cZeXv3H0bnF+Xx+/wKv/tLm2ESoZrUpT9H5HF/1xUFPzikVdlJkay5z0fFn3TWJGM MHJg== X-Gm-Message-State: AIkVDXJAK4RZJytkmOENXbZIa+OJTFaNwK8uMTpIuFzdQZbeaL9jDNKjFxJICx09KjPB6Q== X-Received: by 10.195.17.170 with SMTP id gf10mr1642614wjd.59.1482277814599; Tue, 20 Dec 2016 15:50:14 -0800 (PST) Received: from mail-wm0-f53.google.com (mail-wm0-f53.google.com. [74.125.82.53]) by smtp.gmail.com with ESMTPSA id f3sm24445272wmf.10.2016.12.20.15.50.14 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 20 Dec 2016 15:50:14 -0800 (PST) Received: by mail-wm0-f53.google.com with SMTP id t79so144340090wmt.0; Tue, 20 Dec 2016 15:50:14 -0800 (PST) X-Received: by 10.28.54.214 with SMTP id y83mr2006038wmh.45.1482277814318; Tue, 20 Dec 2016 15:50:14 -0800 (PST) MIME-Version: 1.0 Reply-To: cem@freebsd.org Received: by 10.194.29.72 with HTTP; Tue, 20 Dec 2016 15:50:13 -0800 (PST) In-Reply-To: References: <201612160144.uBG1ipjW016736@repo.freebsd.org> <49460793.UcUNovQMDa@ralph.baldwin.cx> From: Conrad Meyer Date: Tue, 20 Dec 2016 15:50:13 -0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: svn commit: r310138 - head/lib/libc/stdio To: Adrian Chadd Cc: Baptiste Daroussin , src-committers , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Dec 2016 00:47:34 -0000 I didn't get the same conclusion from the thread =E2=80=94 I haven't seen a persuasive argument for removal. Best, Conrad On Mon, Dec 19, 2016 at 2:23 PM, Adrian Chadd wrot= e: > [snip] > > tl;dr - can we revert it from stdio for now so we don't end up having > people use this? > > > > -adrian From owner-svn-src-all@freebsd.org Wed Dec 21 00:50:22 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 73F98C88343; Wed, 21 Dec 2016 00:50:22 +0000 (UTC) (envelope-from landonf@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4E69B1336; Wed, 21 Dec 2016 00:50:22 +0000 (UTC) (envelope-from landonf@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBL0oL4j055521; Wed, 21 Dec 2016 00:50:21 GMT (envelope-from landonf@FreeBSD.org) Received: (from landonf@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBL0oL6i055520; Wed, 21 Dec 2016 00:50:21 GMT (envelope-from landonf@FreeBSD.org) Message-Id: <201612210050.uBL0oL6i055520@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: landonf set sender to landonf@FreeBSD.org using -f From: "Landon J. Fuller" Date: Wed, 21 Dec 2016 00:50:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310342 - head/sys/dev/bhnd/tools X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Dec 2016 00:50:22 -0000 Author: landonf Date: Wed Dec 21 00:50:21 2016 New Revision: 310342 URL: https://svnweb.freebsd.org/changeset/base/310342 Log: bhnd(4): Use a stable sort key to produce deterministic nvram_map_gen.awk output. When ordering SROM layout entries, we now use the unique (var_id, rev_start, rev_end) tuple as the sort key; this fixes the previously non-deterministic output when sorting entries with overlapping var_ids. PR: 215422 Reported by: emaste Reviewed by: emaste Approved by: adrian (mentor) Differential Revision: https://reviews.freebsd.org/D8859 Modified: head/sys/dev/bhnd/tools/nvram_map_gen.awk Modified: head/sys/dev/bhnd/tools/nvram_map_gen.awk ============================================================================== --- head/sys/dev/bhnd/tools/nvram_map_gen.awk Tue Dec 20 22:47:09 2016 (r310341) +++ head/sys/dev/bhnd/tools/nvram_map_gen.awk Wed Dec 21 00:50:21 2016 (r310342) @@ -1519,8 +1519,10 @@ function write_srom_bindings(layout, _va array_append(_entries, _entry) } - # Sort entries by variable ID, ascending - array_sort(_entries, prop_path_create(p_var, p_vid)) + # Sort entries by (variable ID, revision range), ascending + array_sort(_entries, prop_path_create(p_var, p_vid), + prop_path_create(p_revisions, p_start), + prop_path_create(p_revisions, p_end)) # Emit all entry binding opcodes emit("static const uint8_t " _varname "[] = {\n") @@ -2297,17 +2299,24 @@ function array_get(array, idx) { # # Sort an array, using standard awk comparison operators over its values. # -# If `prop_path` is non-NULL, the corresponding property path (or property ID) +# If `prop_path*` is non-NULL, the corresponding property path (or property ID) # will be fetched from each array element and used as the sorting value. # -function array_sort(array, prop_path, _size) { +# If multiple property paths are specified, the array is first sorted by +# the first path, and then any equal values are sorted by the second path, +# and so on. +# +function array_sort(array, prop_path0, prop_path1, prop_path2, _size) { obj_assert_class(array, Array) + if (_size != null) + errorx("no more than three property paths may be specified") + _size = array_size(array) if (_size <= 1) return - _qsort(array, prop_path, 0, _size-1) + _qsort(array, prop_path0, prop_path1, prop_path2, 0, _size-1) } function _qsort_get_key(array, idx, prop_path, _v) { @@ -2319,8 +2328,35 @@ function _qsort_get_key(array, idx, prop return (prop_get_path(_v, prop_path)) } -function _qsort(array, prop_path, first, last, _qpivot, _qpivot_val, _qleft, - _qleft_val, _qright, _qright_val) +function _qsort_compare(array, lhs_idx, rhs_val, ppath0, ppath1, ppath2, + _lhs_val, _rhs_prop_val) +{ + _lhs_val = _qsort_get_key(array, lhs_idx, ppath0) + if (ppath0 == null) + _rhs_prop_val = rhs_val + else + _rhs_prop_val = prop_get_path(rhs_val, ppath0) + + if (_lhs_val == _rhs_prop_val && ppath1 != null) { + _lhs_val = _qsort_get_key(array, lhs_idx, ppath1) + _rhs_prop_val = prop_get_path(rhs_val, ppath1) + + if (_lhs_val == _rhs_prop_val && ppath2 != null) { + _lhs_val = _qsort_get_key(array, lhs_idx, ppath2) + _rhs_prop_val = prop_get_path(rhs_val, ppath2) + } + } + + if (_lhs_val < _rhs_prop_val) + return (-1) + else if (_lhs_val > _rhs_prop_val) + return (1) + else + return (0) +} + +function _qsort(array, ppath0, ppath1, ppath2, first, last, _qpivot, + _qleft, _qleft_val, _qright, _qright_val) { if (first >= last) return @@ -2330,15 +2366,21 @@ function _qsort(array, prop_path, first, _qleft = first _qright = last - _qpivot_val = _qsort_get_key(array, _qpivot, prop_path) + _qpivot_val = array_get(array, _qpivot) # partition while (_qleft <= _qright) { - while (_qsort_get_key(array, _qleft, prop_path) < _qpivot_val) + while (_qsort_compare(array, _qleft, _qpivot_val, ppath0, ppath1, + ppath2) < 0) + { _qleft++ + } - while (_qsort_get_key(array, _qright, prop_path) > _qpivot_val) + while (_qsort_compare(array, _qright, _qpivot_val, ppath0, ppath1, + ppath2) > 0) + { _qright-- + } # swap if (_qleft <= _qright) { @@ -2354,8 +2396,8 @@ function _qsort(array, prop_path, first, } # sort the partitions - _qsort(array, prop_path, first, _qright) - _qsort(array, prop_path, _qleft, last) + _qsort(array, ppath0, ppath1, ppath2, first, _qright) + _qsort(array, ppath0, ppath1, ppath2, _qleft, last) } From owner-svn-src-all@freebsd.org Wed Dec 21 00:56:23 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 63682C8866A for ; Wed, 21 Dec 2016 00:56:23 +0000 (UTC) (envelope-from ian@freebsd.org) Received: from outbound1b.ore.mailhop.org (outbound1b.ore.mailhop.org [54.200.247.200]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 44454194C for ; Wed, 21 Dec 2016 00:56:22 +0000 (UTC) (envelope-from ian@freebsd.org) X-MHO-User: 4dcce6d5-c718-11e6-8c89-112185c90658 X-Report-Abuse-To: https://support.duocircle.com/support/solutions/articles/5000540958-duocircle-standard-smtp-abuse-information X-Originating-IP: 73.78.92.27 X-Mail-Handler: DuoCircle Outbound SMTP Received: from ilsoft.org (unknown [73.78.92.27]) by outbound1.ore.mailhop.org (Halon) with ESMTPSA id 4dcce6d5-c718-11e6-8c89-112185c90658; Wed, 21 Dec 2016 00:56:28 +0000 (UTC) Received: from rev (rev [172.22.42.240]) by ilsoft.org (8.15.2/8.15.2) with ESMTP id uBL0uJCL004538; Tue, 20 Dec 2016 17:56:19 -0700 (MST) (envelope-from ian@freebsd.org) Message-ID: <1482281779.48539.41.camel@freebsd.org> Subject: Re: svn commit: r310138 - head/lib/libc/stdio From: Ian Lepore To: cem@freebsd.org, Adrian Chadd Cc: Baptiste Daroussin , src-committers , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" Date: Tue, 20 Dec 2016 17:56:19 -0700 In-Reply-To: References: <201612160144.uBG1ipjW016736@repo.freebsd.org> <49460793.UcUNovQMDa@ralph.baldwin.cx> Content-Type: text/plain; charset="windows-1251" X-Mailer: Evolution 3.18.5.1 FreeBSD GNOME Team Port Mime-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Dec 2016 00:56:23 -0000 On Tue, 2016-12-20 at 15:50 -0800, Conrad Meyer wrote: > I didn't get the same conclusion from the thread — I haven't seen a > persuasive argument for removal. > > Best, > Conrad > You're kidding, right?  Can you cite even a single message that supports the change?  My memory is that everyone who voiced an opinion said it was a bad idea, then the thread devolved into discussions of alternatives and how they were bad ideas too.  That latter bit doesn't change the basic fact that everyone started by agreeing this was a bad idea for userland. -- Ian > On Mon, Dec 19, 2016 at 2:23 PM, Adrian Chadd > wrote: > > > > [snip] > > > > tl;dr - can we revert it from stdio for now so we don't end up > > having > > people use this? > > > > > > > > -adrian > From owner-svn-src-all@freebsd.org Wed Dec 21 01:32:20 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5A672C89282; Wed, 21 Dec 2016 01:32:20 +0000 (UTC) (envelope-from gonzo@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 106AC1B25; Wed, 21 Dec 2016 01:32:19 +0000 (UTC) (envelope-from gonzo@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBL1WJkl075949; Wed, 21 Dec 2016 01:32:19 GMT (envelope-from gonzo@FreeBSD.org) Received: (from gonzo@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBL1WJJJ075948; Wed, 21 Dec 2016 01:32:19 GMT (envelope-from gonzo@FreeBSD.org) Message-Id: <201612210132.uBL1WJJJ075948@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gonzo set sender to gonzo@FreeBSD.org using -f From: Oleksandr Tymoshenko Date: Wed, 21 Dec 2016 01:32:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310343 - head/sys/arm/freescale/imx X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Dec 2016 01:32:20 -0000 Author: gonzo Date: Wed Dec 21 01:32:19 2016 New Revision: 310343 URL: https://svnweb.freebsd.org/changeset/base/310343 Log: [iMX6] Fix build for SSI driver and add dependency for SDMA driver - Pass correct pointer to OF_getencprop - Check the size of "dmas" property - Add dependency on sdma driver Reviewed by: br MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D8873 Modified: head/sys/arm/freescale/imx/imx6_ssi.c Modified: head/sys/arm/freescale/imx/imx6_ssi.c ============================================================================== --- head/sys/arm/freescale/imx/imx6_ssi.c Wed Dec 21 00:50:21 2016 (r310342) +++ head/sys/arm/freescale/imx/imx6_ssi.c Wed Dec 21 01:32:19 2016 (r310343) @@ -66,6 +66,7 @@ __FBSDID("$FreeBSD$"); bus_space_write_4(_sc->bst, _sc->bsh, _reg, _val) #define SSI_NCHANNELS 1 +#define DMAS_TOTAL 8 /* i.MX6 SSI registers */ @@ -187,8 +188,8 @@ struct sc_info { struct sdma_conf *conf; struct ssi_rate *sr; struct sdma_softc *sdma_sc; - int sdma_ev_rx; - int sdma_ev_tx; + uint32_t sdma_ev_rx; + uint32_t sdma_ev_tx; int sdma_channel; }; @@ -437,7 +438,7 @@ find_sdma_controller(struct sc_info *sc) struct sdma_softc *sdma_sc; phandle_t node, sdma_node; device_t sdma_dev; - int dts_value[8]; + pcell_t dts_value[DMAS_TOTAL]; int len; if ((node = ofw_bus_get_node(sc->dev)) == -1) @@ -446,7 +447,14 @@ find_sdma_controller(struct sc_info *sc) if ((len = OF_getproplen(node, "dmas")) <= 0) return (ENXIO); - OF_getencprop(node, "dmas", &dts_value, len); + if (len != sizeof(dts_value)) { + device_printf(sc->dev, + "\"dmas\" property length is invalid: %d (expected %d)", + len, sizeof(dts_value)); + return (ENXIO); + } + + OF_getencprop(node, "dmas", dts_value, sizeof(dts_value)); sc->sdma_ev_rx = dts_value[1]; sc->sdma_ev_tx = dts_value[5]; @@ -850,4 +858,5 @@ static driver_t ssi_pcm_driver = { DRIVER_MODULE(ssi, simplebus, ssi_pcm_driver, pcm_devclass, 0, 0); MODULE_DEPEND(ssi, sound, SOUND_MINVER, SOUND_PREFVER, SOUND_MAXVER); +MODULE_DEPEND(ssi, sdma, 0, 0, 0); MODULE_VERSION(ssi, 1); From owner-svn-src-all@freebsd.org Wed Dec 21 01:38:45 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A74EEC8940C; Wed, 21 Dec 2016 01:38:45 +0000 (UTC) (envelope-from gonzo@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 5E6F51D66; Wed, 21 Dec 2016 01:38:45 +0000 (UTC) (envelope-from gonzo@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBL1cipA076350; Wed, 21 Dec 2016 01:38:44 GMT (envelope-from gonzo@FreeBSD.org) Received: (from gonzo@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBL1ci9b076348; Wed, 21 Dec 2016 01:38:44 GMT (envelope-from gonzo@FreeBSD.org) Message-Id: <201612210138.uBL1ci9b076348@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gonzo set sender to gonzo@FreeBSD.org using -f From: Oleksandr Tymoshenko Date: Wed, 21 Dec 2016 01:38:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310344 - head/sys/arm/freescale/imx X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Dec 2016 01:38:45 -0000 Author: gonzo Date: Wed Dec 21 01:38:44 2016 New Revision: 310344 URL: https://svnweb.freebsd.org/changeset/base/310344 Log: [iMX6] Fix SDMA driver build - Place const modifiers where required - Make sure sdma device is attahched before consumers like SSI Reviewed by: br MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D8874 Modified: head/sys/arm/freescale/imx/imx6_sdma.c head/sys/arm/freescale/imx/imx6_sdma.h Modified: head/sys/arm/freescale/imx/imx6_sdma.c ============================================================================== --- head/sys/arm/freescale/imx/imx6_sdma.c Wed Dec 21 01:32:19 2016 (r310343) +++ head/sys/arm/freescale/imx/imx6_sdma.c Wed Dec 21 01:38:44 2016 (r310344) @@ -351,7 +351,7 @@ sdma_configure(int chn, struct sdma_conf static int load_firmware(struct sdma_softc *sc) { - struct sdma_firmware_header *header; + const struct sdma_firmware_header *header; const struct firmware *fp; fp = firmware_get("sdma_fw"); @@ -360,14 +360,14 @@ load_firmware(struct sdma_softc *sc) return (-1); } - header = (struct sdma_firmware_header *)fp->data; + header = fp->data; if (header->magic != FW_HEADER_MAGIC) { device_printf(sc->dev, "Can't use firmware.\n"); return (-1); } sc->fw_header = header; - sc->fw_scripts = (void *)((char *)header + + sc->fw_scripts = (const void *)((const char *)header + header->script_addrs_start); return (0); @@ -377,14 +377,14 @@ static int boot_firmware(struct sdma_softc *sc) { struct sdma_buffer_descriptor *bd0; - uint32_t *ram_code; + const uint32_t *ram_code; int timeout; int ret; int chn; int sz; int i; - ram_code = (void *)((char *)sc->fw_header + + ram_code = (const void *)((const char *)sc->fw_header + sc->fw_header->ram_code_start); /* Make sure SDMA has not started yet */ @@ -514,4 +514,5 @@ static driver_t sdma_driver = { static devclass_t sdma_devclass; -DRIVER_MODULE(sdma, simplebus, sdma_driver, sdma_devclass, 0, 0); +EARLY_DRIVER_MODULE(sdma, simplebus, sdma_driver, sdma_devclass, 0, 0, + BUS_PASS_RESOURCE); Modified: head/sys/arm/freescale/imx/imx6_sdma.h ============================================================================== --- head/sys/arm/freescale/imx/imx6_sdma.h Wed Dec 21 01:32:19 2016 (r310343) +++ head/sys/arm/freescale/imx/imx6_sdma.h Wed Dec 21 01:38:44 2016 (r310344) @@ -221,8 +221,8 @@ struct sdma_softc { uint32_t num_bd; uint32_t ccb_phys; uint32_t context_phys; - struct sdma_firmware_header *fw_header; - struct sdma_script_start_addrs *fw_scripts; + const struct sdma_firmware_header *fw_header; + const struct sdma_script_start_addrs *fw_scripts; }; struct sdma_conf { From owner-svn-src-all@freebsd.org Wed Dec 21 01:39:12 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5CFBEC89466; Wed, 21 Dec 2016 01:39:12 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 2CB491ED7; Wed, 21 Dec 2016 01:39:12 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBL1dBcb076420; Wed, 21 Dec 2016 01:39:11 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBL1dBrZ076419; Wed, 21 Dec 2016 01:39:11 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201612210139.uBL1dBrZ076419@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Wed, 21 Dec 2016 01:39:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310345 - head/sys/geom X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Dec 2016 01:39:12 -0000 Author: sephe Date: Wed Dec 21 01:39:11 2016 New Revision: 310345 URL: https://svnweb.freebsd.org/changeset/base/310345 Log: build: Unbreak LINT Sponsored by: Microsoft Modified: head/sys/geom/geom_map.c Modified: head/sys/geom/geom_map.c ============================================================================== --- head/sys/geom/geom_map.c Wed Dec 21 01:38:44 2016 (r310344) +++ head/sys/geom/geom_map.c Wed Dec 21 01:39:11 2016 (r310345) @@ -147,8 +147,13 @@ find_marker(struct g_consumer *cp, const bzero(search_key, MAP_MAX_MARKER_LEN); sectorsize = cp->provider->sectorsize; +#ifdef __LP64__ + ret = sscanf(line, "search:%li:%li:%63c", + &search_start, &search_step, search_key); +#else ret = sscanf(line, "search:%qi:%qi:%63c", &search_start, &search_step, search_key); +#endif if (ret < 3) return (1); From owner-svn-src-all@freebsd.org Wed Dec 21 01:48:55 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id DB4E6C89802; Wed, 21 Dec 2016 01:48:55 +0000 (UTC) (envelope-from feld@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id AAA781533; Wed, 21 Dec 2016 01:48:55 +0000 (UTC) (envelope-from feld@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBL1msDU080490; Wed, 21 Dec 2016 01:48:54 GMT (envelope-from feld@FreeBSD.org) Received: (from feld@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBL1mswK080489; Wed, 21 Dec 2016 01:48:54 GMT (envelope-from feld@FreeBSD.org) Message-Id: <201612210148.uBL1mswK080489@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: feld set sender to feld@FreeBSD.org using -f From: Mark Felder Date: Wed, 21 Dec 2016 01:48:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310346 - head/share/misc X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Dec 2016 01:48:56 -0000 Author: feld (ports committer) Date: Wed Dec 21 01:48:54 2016 New Revision: 310346 URL: https://svnweb.freebsd.org/changeset/base/310346 Log: Add amdmi3 to ports-secteam Approved by: swills Modified: head/share/misc/organization.dot Modified: head/share/misc/organization.dot ============================================================================== --- head/share/misc/organization.dot Wed Dec 21 01:39:11 2016 (r310345) +++ head/share/misc/organization.dot Wed Dec 21 01:48:54 2016 (r310346) @@ -34,7 +34,7 @@ portmgr [label="Port Management Team\npo portmgrsecretary [label="Port Management Team Secretary\nportmgr-secretary@FreeBSD.org\nrene"] re [label="Primary Release Engineering Team\nre@FreeBSD.org\nkib, blackend, jpaetzel, hrs, kensmith"] secteam [label="Security Team\nsecteam@FreeBSD.org\ndelphij,\ndes, gavin, gjb,\nglebius, remko"] -portssecteam [label="Ports Security Team\nports-secteam@FreeBSD.org\ndelphij, eadler, feld, jgh, junovitch, rea, sbz, simon, swills, zi"] +portssecteam [label="Ports Security Team\nports-secteam@FreeBSD.org\ndelphij, amdmi3, eadler, feld, jgh, junovitch, rea, sbz, simon, swills, zi"] secteamsecretary [label="Security Team Secretary\nsecteam-secretary@FreeBSD.org\nremko"] securityofficer [label="Security Officer Team\nsecurity-officer@FreeBSD.org\ncperciva, simon, nectar"] srccommitters [label="Src Committers\nsrc-committers@FreeBSD.org"] From owner-svn-src-all@freebsd.org Wed Dec 21 01:56:52 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E9335C89A65; Wed, 21 Dec 2016 01:56:52 +0000 (UTC) (envelope-from adrian.chadd@gmail.com) Received: from mail-wj0-x230.google.com (mail-wj0-x230.google.com [IPv6:2a00:1450:400c:c01::230]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 8959B1A1F; Wed, 21 Dec 2016 01:56:52 +0000 (UTC) (envelope-from adrian.chadd@gmail.com) Received: by mail-wj0-x230.google.com with SMTP id xy5so190465961wjc.0; Tue, 20 Dec 2016 17:56:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=pDOiqbetTJuQCSug0oCLoaF9y/7eCOdvLwLU+Jbq1Eg=; b=ndcVTf1ReL9eQmhfqI/uj1LYZPvzcefmjjOsTf5O52M6mqTI/pzk6mod7WNeNNByFC 1LDPm7aFl7tQaYYZ44nEikWJ3K9nRvI0uitnXn5eMuf/fnjP7O71vXOqdJ2RG/RMXLCR QF0ktw761kk58aPZLSzZIgSovpWqfJ1qV8pS16EKyk2zc1a2JItBSAfSRX03bTtt7Kqj oMSStksczzWEHfrGKds0UkfiWFCyuhKfMLGi/H4wB5d+7uqxuOizb3fdEglqJ/wK19SR rxOAzsfTBDOh9sUSMGVqs5UsKiQ40u1ml3WrnSiiwpNw+zvdhwlRAGq1wg9OBic+Kgyq LQcQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=pDOiqbetTJuQCSug0oCLoaF9y/7eCOdvLwLU+Jbq1Eg=; b=S/Il0XGz4lWTcFyIJKM7pVKkIgsP1MpepLLk2ql+p+BmIAb8ASNyTORy5cjZInf3Rj /0ELR6eakpKgOzOohCpWq5j7wOrWuXIIoPyxWHwjjtwM6ZgXuXsRLnHt7VZbIi1/ea/R NqLm/H3fjYcy06Ah3nkvaCJT40PQkZIJ3O09AgQQjYHAmb1vYntjKOrYOhr7n59Liad3 ASMNpwFbs7KB7MCU6sMBS3J+xr9yt3lU19AD+lXfe1ffgyxN/Z+UTsm50tktoZxPS7/K 2jBm4Gu1PsQrZC5JM3e5tm8JscxEYFia6N1+bwCSGjuhXzfuEQ2LTA/bugXtej83i4DZ rINA== X-Gm-Message-State: AIkVDXJT5+HfWYHR/+jOZVPw35WvwJO1nwmO3IFdIca/VZMYhAQpqNeblmitg+FeCbEjgvWHK0uhVaBt9P8TFw== X-Received: by 10.194.205.34 with SMTP id ld2mr1842885wjc.211.1482285409767; Tue, 20 Dec 2016 17:56:49 -0800 (PST) MIME-Version: 1.0 Received: by 10.194.44.1 with HTTP; Tue, 20 Dec 2016 17:56:49 -0800 (PST) In-Reply-To: <1482281779.48539.41.camel@freebsd.org> References: <201612160144.uBG1ipjW016736@repo.freebsd.org> <49460793.UcUNovQMDa@ralph.baldwin.cx> <1482281779.48539.41.camel@freebsd.org> From: Adrian Chadd Date: Tue, 20 Dec 2016 17:56:49 -0800 Message-ID: Subject: Re: svn commit: r310138 - head/lib/libc/stdio To: Ian Lepore Cc: "Conrad E. Meyer" , Baptiste Daroussin , src-committers , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" Content-Type: text/plain; charset=UTF-8 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Dec 2016 01:56:53 -0000 Hi, Here's my reason for removal. Plenty of us are looking to be able to build bits of the BSD source tree as part of other non FreeBSD systems, especially if they're involved in bootstrapping. That means that it needs to be compilable by a non-FreeBSD-modified compiler. Ideally this means we'd stick to mostly POSIX options source code that we can compile with unmodified compilers, and we push non-standard stuff into otherly-named functions. If things are harder then we end up with even more reasons people resist migrating to FreeBSD and instead just continue to use Linux as their platform of choice. It already cross-builds and does most of what people want without getting in their way. This change is one of those which encourage making that effort harder, and I'd like to make sure we don't do that. Building bits of the FreeBSD tree on non-FreeBSD systems (even non-same-version-FreeBSD-system trees) is increasingly painful. THanks, -adrian From owner-svn-src-all@freebsd.org Wed Dec 21 02:04:40 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2D43DC89CBC; Wed, 21 Dec 2016 02:04:40 +0000 (UTC) (envelope-from cse.cem@gmail.com) Received: from mail-wj0-f194.google.com (mail-wj0-f194.google.com [209.85.210.194]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id BE3631E69; Wed, 21 Dec 2016 02:04:39 +0000 (UTC) (envelope-from cse.cem@gmail.com) Received: by mail-wj0-f194.google.com with SMTP id kp2so30128404wjc.0; Tue, 20 Dec 2016 18:04:39 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:reply-to:in-reply-to:references :from:date:message-id:subject:to:cc; bh=O/hLiuIhE+wSQkD9EF4tUgFXJj5+oKh6wGiAOtqqnwQ=; b=W//6+FqQ8wOq68MwZJJrMBS8pa+uxALnSpU9+FOSXLrWTXC0DJsXfvRWw5q+HquWlG sdNOtNoHpV0hcqk/ltq0iROKtb4/Ad0A0Y73TAIiVvrZo6wghd0y6oJs1fL6K45jeGqL KpG1qklluxHfT/TXYOC0YrpNqEdMmKhf4Q00OopGGOGCWbZg2nFEageZRTbnWwuGO93L Tn7+qz6MDt2Ho5G1hZe+SFbC+3NGdjzczXcjVO3kBW7lJAOwGxchucV7HBfaCdz1ELmU dOSFBHAc2uMzD2cF/Xhs1arZQPBnOxq4E34K/yyWh4kmW0EfNchrb52VhtTdEgDdEM4x YRLA== X-Gm-Message-State: AIkVDXLZf2eT5WjAwuJOuE0JhMjAz3NVZ6Ho/93kXv7Wcv8AHCjcHsu54uNvQwJmvZze1w== X-Received: by 10.194.66.101 with SMTP id e5mr1877598wjt.172.1482285872328; Tue, 20 Dec 2016 18:04:32 -0800 (PST) Received: from mail-wj0-f169.google.com (mail-wj0-f169.google.com. [209.85.210.169]) by smtp.gmail.com with ESMTPSA id f134sm24767493wmf.19.2016.12.20.18.04.32 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 20 Dec 2016 18:04:32 -0800 (PST) Received: by mail-wj0-f169.google.com with SMTP id v7so191332702wjy.2; Tue, 20 Dec 2016 18:04:32 -0800 (PST) X-Received: by 10.194.222.202 with SMTP id qo10mr1908171wjc.115.1482285871946; Tue, 20 Dec 2016 18:04:31 -0800 (PST) MIME-Version: 1.0 Reply-To: cem@freebsd.org Received: by 10.194.29.72 with HTTP; Tue, 20 Dec 2016 18:04:31 -0800 (PST) In-Reply-To: References: <201612160144.uBG1ipjW016736@repo.freebsd.org> <49460793.UcUNovQMDa@ralph.baldwin.cx> <1482281779.48539.41.camel@freebsd.org> From: Conrad Meyer Date: Tue, 20 Dec 2016 18:04:31 -0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: svn commit: r310138 - head/lib/libc/stdio To: Adrian Chadd Cc: src-committers , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" Content-Type: text/plain; charset=UTF-8 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Dec 2016 02:04:40 -0000 Hi Adrian, On Tue, Dec 20, 2016 at 5:56 PM, Adrian Chadd wrote: > Here's my reason for removal. > > Plenty of us are looking to be able to build bits of the BSD source > tree as part of other non FreeBSD systems, especially if they're > involved in bootstrapping. Understood, however: > That means that it needs to be compilable > by a non-FreeBSD-modified compiler. Ideally this means we'd stick to > mostly POSIX options source code that we can compile with unmodified > compilers, and we push non-standard stuff into otherly-named > functions. Yeah, this isn't actually a problem. printf("%b", foo) compiles fine with non-modified compilers. Best, Conrad From owner-svn-src-all@freebsd.org Wed Dec 21 02:12:25 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D5109C89E9A for ; Wed, 21 Dec 2016 02:12:25 +0000 (UTC) (envelope-from juli@clockworksquid.com) Received: from mail-it0-x236.google.com (mail-it0-x236.google.com [IPv6:2607:f8b0:4001:c0b::236]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 9908012D5 for ; Wed, 21 Dec 2016 02:12:25 +0000 (UTC) (envelope-from juli@clockworksquid.com) Received: by mail-it0-x236.google.com with SMTP id o141so18984635itc.0 for ; Tue, 20 Dec 2016 18:12:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=clockworksquid.com; s=google; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=82K8fiaYkfmqSWDt1wPSfWUcR2qffhzv1V1BbUGAOc4=; b=ayjBEtO7VheY4uQBvQ+m/4/i/+PqKePBI0Cbntw4RMOQaf9ogZdt9mITA3iXscedav ShJpnWrRdeK6OVqkkN4oasnLy24SPYPZQ3vXeTBnYV1utu3S75o0uJ+4MQ6jOLvZngSr EvcO79Iwg4J0tu4Z8ef3OxHZzZkFERHtww/4Q= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=82K8fiaYkfmqSWDt1wPSfWUcR2qffhzv1V1BbUGAOc4=; b=pLyqgXu/byMroAD/Q2YbYRzWNfmthldROTJj0u+Srx4kcgyh3MPiFgHYcVqMQCw88j GgcAX+DnhxW94Mnbl8++Xv89Yet/WhMKBkqY71BbTbnO4+QGemezEKKBrCHKIYAbbNZ7 LYCJya+WdEUb8MZuBHdkct6uC63mtzeTkpbFbNWZGP3wrSeQkcXam+g6R+vDO2QujcCC zAOog0zAu5/0etOYatkMig7csqxUTL98w0Pm5yJ5rDxEYSiP/qadeVHWPnWmdeDi8qE8 4X/wnsPmfw27gHksvyl/CSqr+Qy/hmfI1OR49hQoqwt/wSVvKk/4dqQ+Yhp1DQHNJcUm cL+w== X-Gm-Message-State: AIkVDXIs9iPy7HguirCOXFspIuuYQq9LyQBQmlFZOEiQ5N+vzNn0/PmMG3pHlJkVnlkP24iqV5miDLUz0iBnMg== X-Received: by 10.36.249.203 with SMTP id l194mr5460477ith.19.1482286344921; Tue, 20 Dec 2016 18:12:24 -0800 (PST) MIME-Version: 1.0 Received: by 10.36.50.210 with HTTP; Tue, 20 Dec 2016 18:12:04 -0800 (PST) In-Reply-To: References: <201612160144.uBG1ipjW016736@repo.freebsd.org> <49460793.UcUNovQMDa@ralph.baldwin.cx> <1482281779.48539.41.camel@freebsd.org> From: Juli Mallett Date: Tue, 20 Dec 2016 18:12:04 -0800 Message-ID: Subject: Re: svn commit: r310138 - head/lib/libc/stdio To: Conrad Meyer Cc: Adrian Chadd , src-committers , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" Content-Type: text/plain; charset=UTF-8 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Dec 2016 02:12:25 -0000 On Tue, Dec 20, 2016 at 6:04 PM, Conrad Meyer wrote: > Hi Adrian, > > On Tue, Dec 20, 2016 at 5:56 PM, Adrian Chadd wrote: >> Here's my reason for removal. >> >> Plenty of us are looking to be able to build bits of the BSD source >> tree as part of other non FreeBSD systems, especially if they're >> involved in bootstrapping. > > Understood, however: > >> That means that it needs to be compilable >> by a non-FreeBSD-modified compiler. Ideally this means we'd stick to >> mostly POSIX options source code that we can compile with unmodified >> compilers, and we push non-standard stuff into otherly-named >> functions. > > Yeah, this isn't actually a problem. printf("%b", foo) compiles fine > with non-modified compilers. I want FreeBSD tools to avoid non-standard extensions to standard APIs where possible. Non-standard APIs are fine, because they're easy to provide one's own implementations along with portable software, but building in quirky behaviour to core POSIX/C/whatever interfaces invites pain. In this case, the cost-benefit ratio is all out of whack. Now, %b is unusual enough that I don't have to worry that, say, a bootstrap tool will use it, but it's also unusual enough that the benefit here is elusive. I would love to see this reverted and snprintb instead. From owner-svn-src-all@freebsd.org Wed Dec 21 02:14:36 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7E712C89F24 for ; Wed, 21 Dec 2016 02:14:36 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from nm6.bullet.mail.ne1.yahoo.com (nm6.bullet.mail.ne1.yahoo.com [98.138.90.69]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 46DD714E2 for ; Wed, 21 Dec 2016 02:14:36 +0000 (UTC) (envelope-from pfg@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1482285713; bh=XHFRePtjVFdNJBpvFWzaLdcnqTYu3o0RYuRSXI78ylE=; h=Subject:To:References:Cc:From:Date:In-Reply-To:From:Subject; b=ZJPvvxxG+qse7PwmsdwPVgyGG2NAm1v5DxkPhlR89PDl4QvG3IIGCx8tBvD54zpOC6cYVXJpI1iqHS5/SIUswUyyruOxKEgQCyQtOwyKuBR1cNT+5Htp86CuhQayBWfZtT3JrAn26K9RM6Qiz46sFhsnrJQ7qSPzlM/LMSWrbUmIbBqpKR3fmkFZOHwUIUeTi0PtXvCKAIH3lbbsNqzk8j5AOInT+OGW7tXVjbM4TIpevVSYcDQCaWHnclbJ0SOu8ex5sdnLm28k8sm1Ub5r5GMAjhAmWqNiRPrR+izC7FCTK74pbDZY4x4kxbn7CBSD66Fboqm9mDPySUGtQU+Bsw== Received: from [98.138.100.116] by nm6.bullet.mail.ne1.yahoo.com with NNFMP; 21 Dec 2016 02:01:53 -0000 Received: from [98.138.84.47] by tm107.bullet.mail.ne1.yahoo.com with NNFMP; 21 Dec 2016 02:01:53 -0000 Received: from [127.0.0.1] by smtp115.mail.ne1.yahoo.com with NNFMP; 21 Dec 2016 02:01:53 -0000 X-Yahoo-Newman-Id: 291970.15957.bm@smtp115.mail.ne1.yahoo.com X-Yahoo-Newman-Property: ymail-3 X-YMail-OSG: SYqiOeIVM1njR4IiSkSk.oyMjR9sGeiE1.lmc_3Sd.yJlBa ox766RKOBfJ5AYCkEbQWNEEHcLc5NZ6Nt8xztd5yOsbIT9CZMp5VDZ4KNTMn VP8_VyilDrVwubaZU6tdO11n9RUeexSxwV135Za8C_k6v9vodWHqKicuJ26P ljvk1Ifw5CSszE2u0Nahb2g38hnMxKB3rYq_8ZfV5XXJa_w8Xdoi2ae.Cuao lXACCq1xcdM0PkGpv8Y2IqSDZxTpJtrlfcTD5_zHk4f0SI6GmA24H4jRtcM5 G5I_H74wHOv4.fvodpyKgzHGJJrX4HCeN015kFpad_xqeyhHBPXuSOiiwDyp yLW0LeFuiwV3t4t2fJU4SbrRGFzbahOWIwK.P1aLVF3dZEKKB5nz13p9N_rK glsJERonkNRXgrdANATwZUFmYU_nFyPqCIJBVIDWTlTMWeX.ZnV_JKJUsYEt fFcbaJv8OCaej5My.hurGoWN_0_.zfAw0c2dbeA0zgkVoMuRUBYstsD9Jziw ZivCT7WOTszfduRTOpTkaIcTkc5SFHQOG8BmVoaDoJ8QUENc- X-Yahoo-SMTP: xcjD0guswBAZaPPIbxpWwLcp9Unf Subject: Re: svn commit: r310138 - head/lib/libc/stdio To: cem@freebsd.org, Adrian Chadd References: <201612160144.uBG1ipjW016736@repo.freebsd.org> <49460793.UcUNovQMDa@ralph.baldwin.cx> Cc: Baptiste Daroussin , src-committers , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" From: Pedro Giffuni Message-ID: <0f40f228-76fe-1073-ad23-d4b83a1705c8@FreeBSD.org> Date: Tue, 20 Dec 2016 21:03:16 -0500 User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.5.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Dec 2016 02:14:36 -0000 On 20/12/2016 18:50, Conrad Meyer wrote: > I didn't get the same conclusion from the thread — I haven't seen a > persuasive argument for removal. > > Best, > Conrad It's not standard or even a GNU extension (which we sometimes carry for compatibility). We don't want to encourage it's use either so it doesn't really belong in libc. +1 for removal. Pedro. From owner-svn-src-all@freebsd.org Wed Dec 21 03:09:08 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B64EDC89EA0; Wed, 21 Dec 2016 03:09:08 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 7744B1D43; Wed, 21 Dec 2016 03:09:08 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBL397hl013067; Wed, 21 Dec 2016 03:09:07 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBL3970F013066; Wed, 21 Dec 2016 03:09:07 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201612210309.uBL3970F013066@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Wed, 21 Dec 2016 03:09:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310347 - head/sys/dev/hyperv/storvsc X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Dec 2016 03:09:08 -0000 Author: sephe Date: Wed Dec 21 03:09:07 2016 New Revision: 310347 URL: https://svnweb.freebsd.org/changeset/base/310347 Log: hyperv/storvsc: The max channel in PDU actually means the max sub-chans. Use proper name for local variables. PDU fields' name was not changed yet. While I'm here, make # of usable channels tunable. This eases further testing. MFC after: 1 week Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D8851 Modified: head/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c Modified: head/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c ============================================================================== --- head/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c Wed Dec 21 01:48:54 2016 (r310346) +++ head/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c Wed Dec 21 03:09:07 2016 (r310347) @@ -147,6 +147,10 @@ static u_int hv_storvsc_max_io = 512; SYSCTL_UINT(_hw_storvsc, OID_AUTO, max_io, CTLFLAG_RDTUN, &hv_storvsc_max_io, 0, "Hyper-V storage max io limit"); +static int hv_storvsc_chan_cnt = 0; +SYSCTL_INT(_hw_storvsc, OID_AUTO, chan_cnt, CTLFLAG_RDTUN, + &hv_storvsc_chan_cnt, 0, "# of channels to use"); + #define STORVSC_MAX_IO \ vmbus_chan_prplist_nelem(hv_storvsc_ringbuffer_size, \ STORVSC_DATA_SEGCNT_MAX, VSTOR_PKT_SIZE) @@ -385,16 +389,16 @@ storvsc_subchan_attach(struct storvsc_so * @param max_chans the max channels supported by vmbus */ static void -storvsc_send_multichannel_request(struct storvsc_softc *sc, int max_chans) +storvsc_send_multichannel_request(struct storvsc_softc *sc, int max_subch) { struct vmbus_channel **subchan; struct hv_storvsc_request *request; struct vstor_packet *vstor_packet; - int request_channels_cnt = 0; + int request_subch; int ret, i; - /* get multichannels count that need to create */ - request_channels_cnt = MIN(max_chans, mp_ncpus); + /* get sub-channel count that need to create */ + request_subch = MIN(max_subch, mp_ncpus - 1); request = &sc->hs_init_req; @@ -407,7 +411,7 @@ storvsc_send_multichannel_request(struct vstor_packet->operation = VSTOR_OPERATION_CREATE_MULTI_CHANNELS; vstor_packet->flags = REQUEST_COMPLETION_FLAG; - vstor_packet->u.multi_channels_cnt = request_channels_cnt; + vstor_packet->u.multi_channels_cnt = request_subch; ret = vmbus_chan_send(sc->hs_chan, VMBUS_CHANPKT_TYPE_INBAND, VMBUS_CHANPKT_FLAG_RC, @@ -424,17 +428,17 @@ storvsc_send_multichannel_request(struct } /* Update channel count */ - sc->hs_nchan = request_channels_cnt + 1; + sc->hs_nchan = request_subch + 1; /* Wait for sub-channels setup to complete. */ - subchan = vmbus_subchan_get(sc->hs_chan, request_channels_cnt); + subchan = vmbus_subchan_get(sc->hs_chan, request_subch); /* Attach the sub-channels. */ - for (i = 0; i < request_channels_cnt; ++i) + for (i = 0; i < request_subch; ++i) storvsc_subchan_attach(sc, subchan[i]); /* Release the sub-channels. */ - vmbus_subchan_rel(subchan, request_channels_cnt); + vmbus_subchan_rel(subchan, request_subch); if (bootverbose) printf("Storvsc create multi-channel success!\n"); @@ -452,11 +456,11 @@ hv_storvsc_channel_init(struct storvsc_s int ret = 0, i; struct hv_storvsc_request *request; struct vstor_packet *vstor_packet; - uint16_t max_chans = 0; - boolean_t support_multichannel = FALSE; + uint16_t max_subch; + boolean_t support_multichannel; uint32_t version; - max_chans = 0; + max_subch = 0; support_multichannel = FALSE; request = &sc->hs_init_req; @@ -550,14 +554,21 @@ hv_storvsc_channel_init(struct storvsc_s goto cleanup; } + max_subch = vstor_packet->u.chan_props.max_channel_cnt; + if (hv_storvsc_chan_cnt > 0 && hv_storvsc_chan_cnt < (max_subch + 1)) + max_subch = hv_storvsc_chan_cnt - 1; + /* multi-channels feature is supported by WIN8 and above version */ - max_chans = vstor_packet->u.chan_props.max_channel_cnt; version = VMBUS_GET_VERSION(device_get_parent(sc->hs_dev), sc->hs_dev); if (version != VMBUS_VERSION_WIN7 && version != VMBUS_VERSION_WS2008 && (vstor_packet->u.chan_props.flags & HV_STORAGE_SUPPORTS_MULTI_CHANNEL)) { support_multichannel = TRUE; } + if (bootverbose) { + device_printf(sc->hs_dev, "max chans %d%s\n", max_subch + 1, + support_multichannel ? ", multi-chan capable" : ""); + } memset(vstor_packet, 0, sizeof(struct vstor_packet)); vstor_packet->operation = VSTOR_OPERATION_ENDINITIALIZATION; @@ -581,8 +592,8 @@ hv_storvsc_channel_init(struct storvsc_s * If multi-channel is supported, send multichannel create * request to host. */ - if (support_multichannel) - storvsc_send_multichannel_request(sc, max_chans); + if (support_multichannel && max_subch > 0) + storvsc_send_multichannel_request(sc, max_subch); cleanup: sema_destroy(&request->synch_sema); return (ret); From owner-svn-src-all@freebsd.org Wed Dec 21 03:23:37 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 09F56C8A266; Wed, 21 Dec 2016 03:23:37 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id BF12F160B; Wed, 21 Dec 2016 03:23:36 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBL3NZRn020971; Wed, 21 Dec 2016 03:23:35 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBL3NZeJ020969; Wed, 21 Dec 2016 03:23:35 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201612210323.uBL3NZeJ020969@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Wed, 21 Dec 2016 03:23:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310348 - head/sys/dev/hyperv/vmbus X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Dec 2016 03:23:37 -0000 Author: sephe Date: Wed Dec 21 03:23:35 2016 New Revision: 310348 URL: https://svnweb.freebsd.org/changeset/base/310348 Log: hyperv: Unbreak EARLY_AP_STARUP Hyper-V bootstrap by using intrhook Properly working pause and friends are required. MFC after: 3 days Sponsored by: Microsoft Modified: head/sys/dev/hyperv/vmbus/vmbus.c head/sys/dev/hyperv/vmbus/vmbus_var.h Modified: head/sys/dev/hyperv/vmbus/vmbus.c ============================================================================== --- head/sys/dev/hyperv/vmbus/vmbus.c Wed Dec 21 03:09:07 2016 (r310347) +++ head/sys/dev/hyperv/vmbus/vmbus.c Wed Dec 21 03:23:35 2016 (r310348) @@ -99,6 +99,9 @@ static uint32_t vmbus_get_vcpu_id_meth device_t dev, int cpu); static struct taskqueue *vmbus_get_eventtq_method(device_t, device_t, int); +#ifdef EARLY_AP_STARTUP +static void vmbus_intrhook(void *); +#endif static int vmbus_init(struct vmbus_softc *); static int vmbus_connect(struct vmbus_softc *, uint32_t); @@ -1402,6 +1405,21 @@ vmbus_event_proc_dummy(struct vmbus_soft { } +#ifdef EARLY_AP_STARTUP + +static void +vmbus_intrhook(void *xsc) +{ + struct vmbus_softc *sc = xsc; + + if (bootverbose) + device_printf(sc->vmbus_dev, "intrhook\n"); + vmbus_doattach(sc); + config_intrhook_disestablish(&sc->vmbus_intrhook); +} + +#endif /* EARLY_AP_STARTUP */ + static int vmbus_attach(device_t dev) { @@ -1416,7 +1434,14 @@ vmbus_attach(device_t dev) */ vmbus_sc->vmbus_event_proc = vmbus_event_proc_dummy; -#ifndef EARLY_AP_STARTUP +#ifdef EARLY_AP_STARTUP + /* + * Defer the real attach until the pause(9) works as expected. + */ + vmbus_sc->vmbus_intrhook.ich_func = vmbus_intrhook; + vmbus_sc->vmbus_intrhook.ich_arg = vmbus_sc; + config_intrhook_establish(&vmbus_sc->vmbus_intrhook); +#else /* !EARLY_AP_STARTUP */ /* * If the system has already booted and thread * scheduling is possible indicated by the global @@ -1424,8 +1449,8 @@ vmbus_attach(device_t dev) * initialization directly. */ if (!cold) -#endif vmbus_doattach(vmbus_sc); +#endif /* EARLY_AP_STARTUP */ return (0); } Modified: head/sys/dev/hyperv/vmbus/vmbus_var.h ============================================================================== --- head/sys/dev/hyperv/vmbus/vmbus_var.h Wed Dec 21 03:09:07 2016 (r310347) +++ head/sys/dev/hyperv/vmbus/vmbus_var.h Wed Dec 21 03:23:35 2016 (r310348) @@ -30,6 +30,7 @@ #define _VMBUS_VAR_H_ #include +#include #include #include @@ -128,6 +129,8 @@ struct vmbus_softc { struct mtx vmbus_chan_lock; TAILQ_HEAD(, vmbus_channel) vmbus_chans; + struct intr_config_hook vmbus_intrhook; + #ifdef NEW_PCIB /* The list of usable MMIO ranges for PCIe pass-through */ struct pcib_host_resources vmbus_mmio_res; From owner-svn-src-all@freebsd.org Wed Dec 21 05:46:00 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C9755C8A29D; Wed, 21 Dec 2016 05:46:00 +0000 (UTC) (envelope-from hrs@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 798BC1FC0; Wed, 21 Dec 2016 05:46:00 +0000 (UTC) (envelope-from hrs@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBL5jx9F077422; Wed, 21 Dec 2016 05:45:59 GMT (envelope-from hrs@FreeBSD.org) Received: (from hrs@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBL5jxfe077420; Wed, 21 Dec 2016 05:45:59 GMT (envelope-from hrs@FreeBSD.org) Message-Id: <201612210545.uBL5jxfe077420@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hrs set sender to hrs@FreeBSD.org using -f From: Hiroki Sato Date: Wed, 21 Dec 2016 05:45:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310349 - head/usr.sbin/syslogd X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Dec 2016 05:46:00 -0000 Author: hrs Date: Wed Dec 21 05:45:59 2016 New Revision: 310349 URL: https://svnweb.freebsd.org/changeset/base/310349 Log: - Use fnmatch(3) for domanname matching of -a options. - Document the patten matching. - Document -S flag in SYNOPSIS. Modified: head/usr.sbin/syslogd/syslogd.8 head/usr.sbin/syslogd/syslogd.c Modified: head/usr.sbin/syslogd/syslogd.8 ============================================================================== --- head/usr.sbin/syslogd/syslogd.8 Wed Dec 21 03:23:35 2016 (r310348) +++ head/usr.sbin/syslogd/syslogd.8 Wed Dec 21 05:45:59 2016 (r310349) @@ -28,7 +28,7 @@ .\" @(#)syslogd.8 8.1 (Berkeley) 6/6/93 .\" $FreeBSD$ .\" -.Dd June 16, 2015 +.Dd December 21, 2016 .Dt SYSLOGD 8 .Os .Sh NAME @@ -44,6 +44,7 @@ .Op Fl m Ar mark_interval .Op Fl P Ar pid_file .Op Fl p Ar log_socket +.Op Fl S Ar logpriv_socket .Sh DESCRIPTION The .Nm @@ -154,16 +155,9 @@ for the sender address. The meaning of .Ar service is as explained above. -.It Xo -.Sm off -.No * Ar domainname Op \&: Ar service -.Sm on -.Xc -Same as before, except that any source host whose name -.Em ends -in .Ar domainname -will get permission. +can contain special characters of a shell-style pattern such as +.Ql Li \&* . .El .Pp The Modified: head/usr.sbin/syslogd/syslogd.c ============================================================================== --- head/usr.sbin/syslogd/syslogd.c Wed Dec 21 03:23:35 2016 (r310348) +++ head/usr.sbin/syslogd/syslogd.c Wed Dec 21 05:45:59 2016 (r310349) @@ -98,6 +98,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -2476,8 +2477,7 @@ static int validate(struct sockaddr *sa, const char *hname) { int i; - size_t l1, l2; - char *cp, name[NI_MAXHOST], ip[NI_MAXHOST], port[NI_MAXSERV]; + char name[NI_MAXHOST], ip[NI_MAXHOST], port[NI_MAXSERV]; struct allowedpeer *ap; struct sockaddr_in *sin4, *a4p = NULL, *m4p = NULL; #ifdef INET6 @@ -2558,23 +2558,11 @@ validate(struct sockaddr *sa, const char else continue; } else { - cp = ap->a_name; - l1 = strlen(name); - if (*cp == '*') { - /* allow wildmatch */ - cp++; - l2 = strlen(cp); - if (l2 > l1 || memcmp(cp, &name[l1 - l2], l2) != 0) { - dprintf("rejected in rule %d due to name mismatch.\n", i); - continue; - } - } else { - /* exact match */ - l2 = strlen(cp); - if (l2 != l1 || memcmp(cp, name, l1) != 0) { - dprintf("rejected in rule %d due to name mismatch.\n", i); - continue; - } + if (fnmatch(ap->a_name, name, FNM_NOESCAPE) == + FNM_NOMATCH) { + dprintf("rejected in rule %d due to name " + "mismatch.\n", i); + continue; } } dprintf("accepted in rule %d.\n", i); From owner-svn-src-all@freebsd.org Wed Dec 21 06:40:30 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id ADA76C8A033; Wed, 21 Dec 2016 06:40:30 +0000 (UTC) (envelope-from julian@freebsd.org) Received: from vps1.elischer.org (vps1.elischer.org [204.109.63.16]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "vps1.elischer.org", Issuer "CA Cert Signing Authority" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 8BE5D1964; Wed, 21 Dec 2016 06:40:30 +0000 (UTC) (envelope-from julian@freebsd.org) Received: from Julian-MBP3.local (ppp121-45-237-203.lns20.per1.internode.on.net [121.45.237.203]) (authenticated bits=0) by vps1.elischer.org (8.15.2/8.15.2) with ESMTPSA id uBL6eETb081741 (version=TLSv1.2 cipher=DHE-RSA-AES128-SHA bits=128 verify=NO); Tue, 20 Dec 2016 22:40:19 -0800 (PST) (envelope-from julian@freebsd.org) Subject: Re: svn commit: r310336 - head/sys/kern To: John Baldwin , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201612201944.uBKJiiMg034231@repo.freebsd.org> From: Julian Elischer Message-ID: Date: Wed, 21 Dec 2016 14:40:09 +0800 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.11; rv:45.0) Gecko/20100101 Thunderbird/45.5.1 MIME-Version: 1.0 In-Reply-To: <201612201944.uBKJiiMg034231@repo.freebsd.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Dec 2016 06:40:30 -0000 On 21/12/2016 3:44 AM, John Baldwin wrote: > Author: jhb > Date: Tue Dec 20 19:44:44 2016 > New Revision: 310336 > URL: https://svnweb.freebsd.org/changeset/base/310336 > > Log: > Don't spin in pause() during early boot for kthreads other than thread0. > > pause() uses a spin loop to simulate a sleep during early boot. However, > we only need this for thread0 to get far enough in the boot process to > enable timers (at which point pause() can sleep). For other kthreads, > sleeping in pause() is ok as the callout will be scheduled and will > eventually fire once thread0 initializes timers. maybe we just need to depend on a variable "have_timers" that is independent of the cold/hot/whatever settings. first code to enable a timer sets it. > > Tested by: Steven Kargl > Sleuthing by: markj > MFC after: 1 week > Sponsored by: Netflix > > Modified: > head/sys/kern/kern_synch.c > > Modified: head/sys/kern/kern_synch.c > ============================================================================== > --- head/sys/kern/kern_synch.c Tue Dec 20 19:30:21 2016 (r310335) > +++ head/sys/kern/kern_synch.c Tue Dec 20 19:44:44 2016 (r310336) > @@ -321,7 +321,8 @@ pause_sbt(const char *wmesg, sbintime_t > if (sbt == 0) > sbt = tick_sbt; > > - if (cold || kdb_active || SCHEDULER_STOPPED()) { > + if ((cold && curthread == &thread0) || kdb_active || > + SCHEDULER_STOPPED()) { > /* > * We delay one second at a time to avoid overflowing the > * system specific DELAY() function(s): > > From owner-svn-src-all@freebsd.org Wed Dec 21 06:42:31 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 32283C8A1D6; Wed, 21 Dec 2016 06:42:31 +0000 (UTC) (envelope-from hrs@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E81601D71; Wed, 21 Dec 2016 06:42:30 +0000 (UTC) (envelope-from hrs@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBL6gUEs001280; Wed, 21 Dec 2016 06:42:30 GMT (envelope-from hrs@FreeBSD.org) Received: (from hrs@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBL6gUx6001279; Wed, 21 Dec 2016 06:42:30 GMT (envelope-from hrs@FreeBSD.org) Message-Id: <201612210642.uBL6gUx6001279@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hrs set sender to hrs@FreeBSD.org using -f From: Hiroki Sato Date: Wed, 21 Dec 2016 06:42:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310350 - head/usr.sbin/syslogd X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Dec 2016 06:42:31 -0000 Author: hrs Date: Wed Dec 21 06:42:30 2016 New Revision: 310350 URL: https://svnweb.freebsd.org/changeset/base/310350 Log: - Add fklog into struct socklist. Files and local/remote sockets are now processed in struct socklist in a consistent manner. - Add helper functions to add a new entry of struct socklist, filed, or peer. - Use the same routine for -l, -p, and -S. - Close /dev/klog when read(2) failed. Modified: head/usr.sbin/syslogd/syslogd.c Modified: head/usr.sbin/syslogd/syslogd.c ============================================================================== --- head/usr.sbin/syslogd/syslogd.c Wed Dec 21 05:45:59 2016 (r310349) +++ head/usr.sbin/syslogd/syslogd.c Wed Dec 21 06:42:30 2016 (r310350) @@ -144,29 +144,17 @@ struct peer { mode_t pe_mode; STAILQ_ENTRY(peer) next; }; +static STAILQ_HEAD(, peer) pqueue = STAILQ_HEAD_INITIALIZER(pqueue); + struct socklist { struct sockaddr_storage sl_ss; int sl_socket; struct peer *sl_peer; + int (*sl_recv)(struct socklist *); STAILQ_ENTRY(socklist) next; }; static STAILQ_HEAD(, socklist) shead = STAILQ_HEAD_INITIALIZER(shead); -static struct peer funix_secure = { - .pe_name = _PATH_LOG_PRIV, - .pe_mode = S_IRUSR | S_IWUSR, - .next = {NULL}, -}; -static struct peer funix_default = { - .pe_name = _PATH_LOG, - .pe_mode = DEFFILEMODE, - .next = {&funix_secure}, -}; -static STAILQ_HEAD(, peer) pqueue = { - &funix_default, - &funix_secure.next.stqe_next, -}; - /* * Flags to logmsg(). */ @@ -306,7 +294,6 @@ static int Foreground = 0; /* Run in for static int resolve = 1; /* resolve hostname */ static char LocalHostName[MAXHOSTNAMELEN]; /* our hostname */ static const char *LocalDomain; /* our local domain name */ -static int fklog = -1; /* /dev/klog */ static int Initialized; /* set when we have initialized ourselves */ static int MarkInterval = 20 * 60; /* interval between marks in seconds */ static int MarkSeq; /* mark sequence number */ @@ -337,8 +324,10 @@ static struct pidfh *pfh; static volatile sig_atomic_t MarkSet, WantDie; static int allowaddr(char *); -static void cfline(const char *, struct filed *, - const char *, const char *); +static int addfile(struct filed *); +static int addpeer(struct peer *); +static int addsock(struct sockaddr *, socklen_t, struct socklist *); +static struct filed *cfline(const char *, const char *, const char *); static const char *cvthname(struct sockaddr *); static void deadq_enter(pid_t, const char *); static int deadq_remove(pid_t); @@ -354,11 +343,12 @@ static void logmsg(int, const char *, co static void log_deadchild(pid_t, int, const char *); static void markit(void); static int socksetup(struct peer *); +static int socklist_recv_file(struct socklist *); +static int socklist_recv_sock(struct socklist *); static int skip_message(const char *, const char *, int); static void printline(const char *, char *, int); static void printsys(char *); static int p_open(const char *, pid_t *); -static void readklog(void); static void reapchild(int); static const char *ttymsg_check(struct iovec *, int, char *, int); static void usage(void); @@ -381,21 +371,61 @@ close_filed(struct filed *f) f->f_type = F_UNUSED; } +static int +addfile(struct filed *f0) +{ + struct filed *f; + + f = calloc(1, sizeof(*f)); + if (f == NULL) + err(1, "malloc failed"); + *f = *f0; + STAILQ_INSERT_TAIL(&fhead, f, next); + + return (0); +} + +static int +addpeer(struct peer *pe0) +{ + struct peer *pe; + + pe = calloc(1, sizeof(*pe)); + if (pe == NULL) + err(1, "malloc failed"); + *pe = *pe0; + STAILQ_INSERT_TAIL(&pqueue, pe, next); + + return (0); +} + +static int +addsock(struct sockaddr *sa, socklen_t sa_len, struct socklist *sl0) +{ + struct socklist *sl; + + sl = calloc(1, sizeof(*sl)); + if (sl == NULL) + err(1, "malloc failed"); + *sl = *sl0; + if (sa != NULL && sa_len > 0) + memcpy(&sl->sl_ss, sa, sa_len); + STAILQ_INSERT_TAIL(&shead, sl, next); + + return (0); +} + int main(int argc, char *argv[]) { - int ch, i, fdsrmax = 0, bflag = 0; - struct sockaddr_storage ss; + int ch, i, s, fdsrmax = 0, bflag = 0, pflag = 0, Sflag = 0; fd_set *fdsr = NULL; - char line[MAXLINE + 1]; - const char *hname; struct timeval tv, *tvp; struct sigaction sact; struct peer *pe; struct socklist *sl; sigset_t mask; pid_t ppid = 1, spid; - socklen_t sslen; char *p; if (madvise(NULL, 0, MADV_PROTECT) != 0) @@ -425,21 +455,22 @@ main(int argc, char *argv[]) usage(); break; case 'b': - if ((pe = calloc(1, sizeof(*pe))) == NULL) - err(1, "malloc failed"); + bflag = 1; if ((p = strchr(optarg, ':')) == NULL) { /* A hostname or filename only. */ - pe->pe_name = optarg; - pe->pe_serv = "syslog"; + addpeer(&(struct peer){ + .pe_name = optarg, + .pe_serv = "syslog" + }); } else { /* The case of "name:service". */ *p++ = '\0'; - pe->pe_serv = p; - pe->pe_name = (strlen(optarg) == 0) ? - NULL : optarg; + addpeer(&(struct peer){ + .pe_serv = p, + .pe_name = (strlen(optarg) == 0) ? + NULL : optarg, + }); } - bflag = 1; - STAILQ_INSERT_TAIL(&pqueue, pe, next); break; case 'c': no_compress++; @@ -460,15 +491,25 @@ main(int argc, char *argv[]) KeepKernFac = 1; break; case 'l': + case 'p': + case 'S': { long perml; mode_t mode; char *name, *ep; - if (optarg[0] == '/') { + if (ch == 'l') mode = DEFFILEMODE; + else if (ch == 'p') { + mode = DEFFILEMODE; + pflag = 1; + } else if (ch == 'S') { + mode = S_IRUSR | S_IWUSR; + Sflag = 1; + } + if (optarg[0] == '/') name = optarg; - } else if ((name = strchr(optarg, ':')) != NULL) { + else if ((name = strchr(optarg, ':')) != NULL) { *name++ = '\0'; if (name[0] != '/') errx(1, "socket name must be absolute " @@ -483,12 +524,13 @@ main(int argc, char *argv[]) } else errx(1, "invalid mode %s, exiting", optarg); - } - if ((pe = calloc(1, sizeof(*pe))) == NULL) - err(1, "malloc failed"); - pe->pe_name = name; - pe->pe_mode = mode; - STAILQ_INSERT_TAIL(&pqueue, pe, next); + } else + errx(1, "invalid filename %s, exiting", + optarg); + addpeer(&(struct peer){ + .pe_name = name, + .pe_mode = mode + }); break; } case 'm': /* mark interval */ @@ -504,18 +546,12 @@ main(int argc, char *argv[]) case 'o': use_bootfile = 1; break; - case 'p': /* path */ - funix_default.pe_name = optarg; - break; case 'P': /* path for alt. PID */ PidFile = optarg; break; case 's': /* no network mode */ SecureMode++; break; - case 'S': /* path for privileged originator */ - funix_secure.pe_name = optarg; - break; case 'T': RemoteAddDate = 1; break; @@ -531,15 +567,33 @@ main(int argc, char *argv[]) if ((argc -= optind) != 0) usage(); - if (bflag == 0) { - pe = calloc(1, sizeof(*pe)); - if (pe == NULL) - err(1, "malloc failed"); - *pe = (struct peer) { + /* Listen by default: /dev/klog. */ + s = open(_PATH_KLOG, O_RDONLY|O_NONBLOCK, 0); + if (s < 0) { + dprintf("can't open %s (%d)\n", _PATH_KLOG, errno); + } else { + addsock(NULL, 0, &(struct socklist){ + .sl_socket = s, + .sl_recv = socklist_recv_file, + }); + } + /* Listen by default: *:514 if no -b flag. */ + if (bflag == 0) + addpeer(&(struct peer){ .pe_serv = "syslog" - }; - STAILQ_INSERT_TAIL(&pqueue, pe, next); - } + }); + /* Listen by default: /var/run/log if no -p flag. */ + if (pflag == 0) + addpeer(&(struct peer){ + .pe_name = _PATH_LOG, + .pe_mode = DEFFILEMODE, + }); + /* Listen by default: /var/run/logpriv if no -S flag. */ + if (Sflag == 0) + addpeer(&(struct peer){ + .pe_name = _PATH_LOG_PRIV, + .pe_mode = S_IRUSR | S_IWUSR, + }); STAILQ_FOREACH(pe, &pqueue, next) socksetup(pe); @@ -585,9 +639,6 @@ main(int argc, char *argv[]) TAILQ_INIT(&deadq_head); - if ((fklog = open(_PATH_KLOG, O_RDONLY|O_NONBLOCK, 0)) < 0) - dprintf("can't open %s (%d)\n", _PATH_KLOG, errno); - /* tuck my process id away */ pidfile_write(pfh); @@ -605,13 +656,10 @@ main(int argc, char *argv[]) tvp = &tv; tv.tv_sec = tv.tv_usec = 0; - if (fklog != -1 && fklog > fdsrmax) - fdsrmax = fklog; STAILQ_FOREACH(sl, &shead, next) { if (sl->sl_socket > fdsrmax) fdsrmax = sl->sl_socket; } - fdsr = (fd_set *)calloc(howmany(fdsrmax+1, NFDBITS), sizeof(fd_mask)); if (fdsr == NULL) @@ -626,8 +674,6 @@ main(int argc, char *argv[]) bzero(fdsr, howmany(fdsrmax+1, NFDBITS) * sizeof(fd_mask)); - if (fklog != -1) - FD_SET(fklog, fdsr); STAILQ_FOREACH(sl, &shead, next) { if (sl->sl_socket != -1) FD_SET(sl->sl_socket, fdsr); @@ -649,49 +695,55 @@ main(int argc, char *argv[]) logerror("select"); continue; } - if (fklog != -1 && FD_ISSET(fklog, fdsr)) - readklog(); STAILQ_FOREACH(sl, &shead, next) { - int date, len; - - if (FD_ISSET(sl->sl_socket, fdsr)) { - sslen = sizeof(ss); - dprintf("sslen(1) = %d\n", sslen); - len = recvfrom(sl->sl_socket, line, - sizeof(line) - 1, 0, - sstosa(&ss), &sslen); - dprintf("sslen(2) = %d\n", sslen); - if (len == 0) - continue; - if (len < 0) { - if (errno != EINTR) - logerror("recvfrom"); - continue; - } - /* Received valid data. */ - line[len] = '\0'; - if (sl->sl_ss.ss_family == AF_LOCAL) { - hname = LocalHostName; - date = 0; - } else { - hname = cvthname(sstosa(&ss)); - unmapped(sstosa(&ss)); - if (validate(sstosa(&ss), hname) == 0) - hname = NULL; - date = RemoteAddDate ? ADDDATE : 0; - } - if (hname != NULL) - printline(hname, line, date); - else - dprintf("Invalid msg from " - "%s was ignored.", hname); - } + if (FD_ISSET(sl->sl_socket, fdsr)) + (*sl->sl_recv)(sl); } } if (fdsr) free(fdsr); } +static int +socklist_recv_sock(struct socklist *sl) +{ + struct sockaddr_storage ss; + struct sockaddr *sa = (struct sockaddr *)&ss; + socklen_t sslen; + const char *hname; + char line[MAXLINE + 1]; + int date, len; + + sslen = sizeof(ss); + len = recvfrom(sl->sl_socket, line, sizeof(line) - 1, 0, sa, &sslen); + dprintf("received sa_len = %d\n", sslen); + if (len == 0) + return (-1); + if (len < 0) { + if (errno != EINTR) + logerror("recvfrom"); + return (-1); + } + /* Received valid data. */ + line[len] = '\0'; + if (sl->sl_ss.ss_family == AF_LOCAL) { + hname = LocalHostName; + date = 0; + } else { + hname = cvthname(sa); + unmapped(sa); + if (validate(sa, hname) == 0) + hname = NULL; + date = RemoteAddDate ? ADDDATE : 0; + } + if (hname != NULL) + printline(hname, line, date); + else + dprintf("Invalid msg from %s was ignored.", hname); + + return (0); +} + static void unmapped(struct sockaddr *sa) { @@ -792,21 +844,22 @@ printline(const char *hname, char *msg, /* * Read /dev/klog while data are available, split into lines. */ -static void -readklog(void) +static int +socklist_recv_file(struct socklist *sl) { char *p, *q, line[MAXLINE + 1]; int len, i; len = 0; for (;;) { - i = read(fklog, line + len, MAXLINE - 1 - len); + i = read(sl->sl_socket, line + len, MAXLINE - 1 - len); if (i > 0) { line[i + len] = '\0'; } else { if (i < 0 && errno != EINTR && errno != EAGAIN) { logerror("klog"); - fklog = -1; + close(sl->sl_socket); + sl->sl_socket = -1; } break; } @@ -825,6 +878,8 @@ readklog(void) } if (len > 0) printsys(line); + + return (len); } /* @@ -1225,7 +1280,9 @@ fprintlog(struct filed *f, int flags, co struct socklist *sl; STAILQ_FOREACH(sl, &shead, next) { - if (sl->sl_ss.ss_family == AF_LOCAL) + if (sl->sl_ss.ss_family == AF_LOCAL || + sl->sl_ss.ss_family == AF_UNSPEC || + sl->sl_socket < 0) continue; lsent = sendto(sl->sl_socket, line, l, 0, r->ai_addr, r->ai_addrlen); @@ -1591,7 +1648,6 @@ readconfigfile(FILE *cf, int allow_inclu /* * Foreach line in the conf table, open that file. */ - f = NULL; include_len = sizeof(include_str) -1; (void)strlcpy(host, "*", sizeof(host)); (void)strlcpy(prog, "*", sizeof(prog)); @@ -1693,13 +1749,9 @@ readconfigfile(FILE *cf, int allow_inclu } for (i = strlen(cline) - 1; i >= 0 && isspace(cline[i]); i--) cline[i] = '\0'; - f = (struct filed *)calloc(1, sizeof(*f)); - if (f == NULL) { - logerror("calloc"); - exit(1); - } - STAILQ_INSERT_TAIL(&fhead, f, next); - cfline(cline, f, prog, host); + f = cfline(cline, prog, host); + if (f != NULL) + addfile(f); } } @@ -1789,23 +1841,14 @@ init(int signo) /* open the configuration file */ if ((cf = fopen(ConfFile, "r")) == NULL) { dprintf("cannot open %s\n", ConfFile); - f = calloc(1, sizeof(*f)); - if (f == NULL) { - logerror("calloc"); - exit(1); - } - cfline("*.ERR\t/dev/console", f, "*", "*"); - STAILQ_INSERT_TAIL(&fhead, f, next); - - f = calloc(1, sizeof(*f)); - if (f == NULL) { - logerror("calloc"); - exit(1); - } - cfline("*.PANIC\t*", f, "*", "*"); - STAILQ_INSERT_TAIL(&fhead, f, next); - + f = cfline("*.ERR\t/dev/console", "*", "*"); + if (f != NULL) + addfile(f); + f = cfline("*.PANIC\t*", "*", "*"); + if (f != NULL) + addfile(f); Initialized = 1; + return; } @@ -1887,9 +1930,10 @@ init(int signo) /* * Crack a configuration file line */ -static void -cfline(const char *line, struct filed *f, const char *prog, const char *host) +static struct filed * +cfline(const char *line, const char *prog, const char *host) { + struct filed *f; struct addrinfo hints, *res; int error, i, pri, syncfile; const char *p, *q; @@ -1898,10 +1942,13 @@ cfline(const char *line, struct filed *f dprintf("cfline(\"%s\", f, \"%s\", \"%s\")\n", line, prog, host); + f = calloc(1, sizeof(*f)); + if (f == NULL) { + logerror("malloc"); + exit(1); + } errno = 0; /* keep strerror() stuff out of logerror messages */ - /* clear out file entry */ - memset(f, 0, sizeof(*f)); for (i = 0; i <= LOG_NFACILITIES; i++) f->f_pmask[i] = INTERNAL_NOPRI; @@ -1995,7 +2042,7 @@ cfline(const char *line, struct filed *f (void)snprintf(ebuf, sizeof ebuf, "unknown priority name \"%s\"", buf); logerror(ebuf); - return; + return (NULL); } } if (!pri_cmp) @@ -2025,7 +2072,7 @@ cfline(const char *line, struct filed *f "unknown facility name \"%s\"", buf); logerror(ebuf); - return; + return (NULL); } f->f_pmask[i >> 3] = pri; f->f_pcmp[i >> 3] = pri_cmp; @@ -2142,6 +2189,7 @@ cfline(const char *line, struct filed *f f->f_type = F_USERS; break; } + return (f); } @@ -2731,7 +2779,6 @@ static int socksetup(struct peer *pe) { struct addrinfo hints, *res, *res0; - struct socklist *sl; int error; char *cp; /* @@ -2853,13 +2900,12 @@ socksetup(struct peer *pe) dprintf("listening on inet socket\n"); } else dprintf("sending on inet socket\n"); - sl = calloc(1, sizeof(*sl)); - if (sl == NULL) - err(1, "malloc failed"); - sl->sl_socket = s; - memcpy(&sl->sl_ss, res->ai_addr, res->ai_addrlen); - sl->sl_peer = pe; - STAILQ_INSERT_TAIL(&shead, sl, next); + addsock(res->ai_addr, res->ai_addrlen, + &(struct socklist){ + .sl_socket = s, + .sl_peer = pe, + .sl_recv = socklist_recv_sock + }); } freeaddrinfo(res0); From owner-svn-src-all@freebsd.org Wed Dec 21 06:49:22 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4B72AC8A470; Wed, 21 Dec 2016 06:49:22 +0000 (UTC) (envelope-from hrs@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 26274128E; Wed, 21 Dec 2016 06:49:22 +0000 (UTC) (envelope-from hrs@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBL6nL9x001821; Wed, 21 Dec 2016 06:49:21 GMT (envelope-from hrs@FreeBSD.org) Received: (from hrs@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBL6nLse001820; Wed, 21 Dec 2016 06:49:21 GMT (envelope-from hrs@FreeBSD.org) Message-Id: <201612210649.uBL6nLse001820@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hrs set sender to hrs@FreeBSD.org using -f From: Hiroki Sato Date: Wed, 21 Dec 2016 06:49:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310351 - head/usr.sbin/syslogd X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Dec 2016 06:49:22 -0000 Author: hrs Date: Wed Dec 21 06:49:21 2016 New Revision: 310351 URL: https://svnweb.freebsd.org/changeset/base/310351 Log: - Initialize deadq_head statically. - Fix indent. - Add missing -S flag into usage(). - Use nitems() for an iov array instead of a macro. Modified: head/usr.sbin/syslogd/syslogd.c Modified: head/usr.sbin/syslogd/syslogd.c ============================================================================== --- head/usr.sbin/syslogd/syslogd.c Wed Dec 21 06:42:30 2016 (r310350) +++ head/usr.sbin/syslogd/syslogd.c Wed Dec 21 06:49:21 2016 (r310351) @@ -223,7 +223,8 @@ struct deadq_entry { int dq_timeout; TAILQ_ENTRY(deadq_entry) dq_entries; }; -static TAILQ_HEAD(, deadq_entry) deadq_head; +static TAILQ_HEAD(, deadq_entry) deadq_head = + TAILQ_HEAD_INITIALIZER(deadq_head); /* * The timeout to apply to processes waiting on the dead queue. Unit @@ -264,11 +265,12 @@ static STAILQ_HEAD(, allowedpeer) aphead * we move to the next interval until we reach the largest. */ static int repeatinterval[] = { 30, 120, 600 }; /* # of secs before flush */ -#define MAXREPEAT ((sizeof(repeatinterval) / sizeof(repeatinterval[0])) - 1) +#define MAXREPEAT (nitems(repeatinterval) - 1) #define REPEATTIME(f) ((f)->f_time + repeatinterval[(f)->f_repeatcount]) -#define BACKOFF(f) { if (++(f)->f_repeatcount > MAXREPEAT) \ - (f)->f_repeatcount = MAXREPEAT; \ - } +#define BACKOFF(f) do { \ + if (++(f)->f_repeatcount > MAXREPEAT) \ + (f)->f_repeatcount = MAXREPEAT; \ + } while (0) /* values for f_type */ #define F_UNUSED 0 /* unused entry */ @@ -637,8 +639,6 @@ main(int argc, char *argv[]) (void)signal(SIGPIPE, SIG_IGN); /* We'll catch EPIPE instead. */ (void)alarm(TIMERINTVL); - TAILQ_INIT(&deadq_head); - /* tuck my process id away */ pidfile_write(pfh); @@ -772,11 +772,12 @@ static void usage(void) { - fprintf(stderr, "%s\n%s\n%s\n%s\n", + fprintf(stderr, "%s\n%s\n%s\n%s\n%s\n", "usage: syslogd [-468ACcdFknosTuv] [-a allowed_peer]", " [-b bind_address] [-f config_file]", " [-l [mode:]path] [-m mark_interval]", - " [-P pid_file] [-p log_socket]"); + " [-P pid_file] [-p log_socket]", + " [-S logpriv_socket]"); exit(1); } @@ -1325,7 +1326,7 @@ fprintlog(struct filed *f, int flags, co dprintf(" %s\n", f->fu_fname); v->iov_base = lf; v->iov_len = 1; - if (writev(f->f_file, iov, IOV_SIZE) < 0) { + if (writev(f->f_file, iov, nitems(iov)) < 0) { /* * If writev(2) fails for potentially transient errors * like the filesystem being full, ignore it. @@ -1355,7 +1356,7 @@ fprintlog(struct filed *f, int flags, co break; } } - if (writev(f->f_file, iov, IOV_SIZE) < 0) { + if (writev(f->f_file, iov, nitems(iov)) < 0) { int e = errno; close_filed(f); if (f->fu_pipe_pid > 0) @@ -1380,7 +1381,7 @@ fprintlog(struct filed *f, int flags, co v->iov_len = 2; errno = 0; /* ttymsg() only sometimes returns an errno */ - if ((msgret = ttymsg(iov, IOV_SIZE, f->fu_fname, 10))) { + if ((msgret = ttymsg(iov, nitems(iov), f->fu_fname, 10))) { f->f_type = F_UNUSED; logerror(msgret); } @@ -1391,7 +1392,7 @@ fprintlog(struct filed *f, int flags, co dprintf("\n"); v->iov_base = crlf; v->iov_len = 2; - wallmsg(f, iov, IOV_SIZE); + wallmsg(f, iov, nitems(iov)); break; } f->f_prevcount = 0; From owner-svn-src-all@freebsd.org Wed Dec 21 07:05:36 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0CAB8C8A85A; Wed, 21 Dec 2016 07:05:36 +0000 (UTC) (envelope-from hrs@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B6CE71A92; Wed, 21 Dec 2016 07:05:35 +0000 (UTC) (envelope-from hrs@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBL75Yf7009912; Wed, 21 Dec 2016 07:05:34 GMT (envelope-from hrs@FreeBSD.org) Received: (from hrs@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBL75YuY009911; Wed, 21 Dec 2016 07:05:34 GMT (envelope-from hrs@FreeBSD.org) Message-Id: <201612210705.uBL75YuY009911@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hrs set sender to hrs@FreeBSD.org using -f From: Hiroki Sato Date: Wed, 21 Dec 2016 07:05:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310352 - head/usr.sbin/syslogd X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Dec 2016 07:05:36 -0000 Author: hrs Date: Wed Dec 21 07:05:34 2016 New Revision: 310352 URL: https://svnweb.freebsd.org/changeset/base/310352 Log: Simplify type casting of struct sockaddr_in. Modified: head/usr.sbin/syslogd/syslogd.c Modified: head/usr.sbin/syslogd/syslogd.c ============================================================================== --- head/usr.sbin/syslogd/syslogd.c Wed Dec 21 06:49:21 2016 (r310351) +++ head/usr.sbin/syslogd/syslogd.c Wed Dec 21 07:05:34 2016 (r310352) @@ -128,6 +128,7 @@ static const char include_ext[] = ".conf #define sstosa(ss) ((struct sockaddr *)(ss)) #define satosin6(sa) ((struct sockaddr_in6 *)(void *)(sa)) +#define sstosin(ss) ((struct sockaddr_in *)(ss)) #define satosin(sa) ((struct sockaddr_in *)(void *)(sa)) #define s6_addr32 __u6_addr.__u6_addr32 #define IN6_ARE_MASKED_ADDR_EQUAL(d, a, m) ( \ @@ -2368,7 +2369,7 @@ allowaddr(char *s) struct servent *se; int masklen = -1; struct addrinfo hints, *res; - struct in_addr *addrp, *maskp; + in_addr_t *addrp, *maskp; #ifdef INET6 int i; u_int32_t *addr6p, *mask6p; @@ -2434,28 +2435,27 @@ allowaddr(char *s) ap->a_mask.ss_family = res->ai_family; if (res->ai_family == AF_INET) { ap->a_mask.ss_len = sizeof(struct sockaddr_in); - maskp = &((struct sockaddr_in *)&ap->a_mask)->sin_addr; - addrp = &((struct sockaddr_in *)&ap->a_addr)->sin_addr; + maskp = &sstosin(&ap->a_mask)->sin_addr.s_addr; + addrp = &sstosin(&ap->a_addr)->sin_addr.s_addr; if (masklen < 0) { /* use default netmask */ - if (IN_CLASSA(ntohl(addrp->s_addr))) - maskp->s_addr = htonl(IN_CLASSA_NET); - else if (IN_CLASSB(ntohl(addrp->s_addr))) - maskp->s_addr = htonl(IN_CLASSB_NET); + if (IN_CLASSA(ntohl(*addrp))) + *maskp = htonl(IN_CLASSA_NET); + else if (IN_CLASSB(ntohl(*addrp))) + *maskp = htonl(IN_CLASSB_NET); else - maskp->s_addr = htonl(IN_CLASSC_NET); + *maskp = htonl(IN_CLASSC_NET); + } else if (masklen == 0) { + *maskp = 0; } else if (masklen <= 32) { /* convert masklen to netmask */ - if (masklen == 0) - maskp->s_addr = 0; - else - maskp->s_addr = htonl(~((1 << (32 - masklen)) - 1)); + *maskp = htonl(~((1 << (32 - masklen)) - 1)); } else { freeaddrinfo(res); return (-1); } /* Lose any host bits in the network number. */ - addrp->s_addr &= maskp->s_addr; + *addrp &= *maskp; } #ifdef INET6 else if (res->ai_family == AF_INET6 && masklen <= 128) { From owner-svn-src-all@freebsd.org Wed Dec 21 08:29:46 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2FE9CC89D83; Wed, 21 Dec 2016 08:29:46 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id F28181C69; Wed, 21 Dec 2016 08:29:45 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBL8TjLW041815; Wed, 21 Dec 2016 08:29:45 GMT (envelope-from ed@FreeBSD.org) Received: (from ed@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBL8Tijt041811; Wed, 21 Dec 2016 08:29:44 GMT (envelope-from ed@FreeBSD.org) Message-Id: <201612210829.uBL8Tijt041811@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ed set sender to ed@FreeBSD.org using -f From: Ed Schouten Date: Wed, 21 Dec 2016 08:29:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310354 - in head/usr.sbin: . prometheus_sysctl_exporter X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Dec 2016 08:29:46 -0000 Author: ed Date: Wed Dec 21 08:29:44 2016 New Revision: 310354 URL: https://svnweb.freebsd.org/changeset/base/310354 Log: Add a Prometheus exporter for sysctl values. Now that we have our sysctl tree annotated with aggregation labels, let's go ahead and provide a very simple utility for exporting the sysctl tree in Prometheus' format. It can either be used in conjunction with the Prometheus node exporter or run through inetd(8). The reason why I'm opting for having it in the base system is because it has a pretty strong integration with some of sysctl's innards, such as access to iterators, name lookups, metadata and type information. As I am investigating whether we can add histograms as native types to sysctl as well, this integration will only get stronger as we go along. That's why it would be safer to oversee the development of this exporter ourselves, as opposed to having it as an external project. This exporter is remarkably compact, especially when compared to the official Linux binary of the Prometheus node exporter (16 KB vs 12 MB). I guess this could be an interesting aspect for monitoring embedded FreeBSD-based systems. Differential Revision: https://reviews.freebsd.org/D8792 Added: head/usr.sbin/prometheus_sysctl_exporter/ head/usr.sbin/prometheus_sysctl_exporter/Makefile (contents, props changed) head/usr.sbin/prometheus_sysctl_exporter/prometheus_sysctl_exporter.8 (contents, props changed) head/usr.sbin/prometheus_sysctl_exporter/prometheus_sysctl_exporter.c (contents, props changed) Modified: head/usr.sbin/Makefile Modified: head/usr.sbin/Makefile ============================================================================== --- head/usr.sbin/Makefile Wed Dec 21 07:26:04 2016 (r310353) +++ head/usr.sbin/Makefile Wed Dec 21 08:29:44 2016 (r310354) @@ -62,6 +62,7 @@ SUBDIR= adduser \ periodic \ powerd \ procctl \ + prometheus_sysctl_exporter \ pstat \ pw \ pwd_mkdb \ Added: head/usr.sbin/prometheus_sysctl_exporter/Makefile ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/usr.sbin/prometheus_sysctl_exporter/Makefile Wed Dec 21 08:29:44 2016 (r310354) @@ -0,0 +1,8 @@ +# $FreeBSD$ + +PROG= prometheus_sysctl_exporter +MAN= prometheus_sysctl_exporter.8 + +LIBADD= m z + +.include Added: head/usr.sbin/prometheus_sysctl_exporter/prometheus_sysctl_exporter.8 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/usr.sbin/prometheus_sysctl_exporter/prometheus_sysctl_exporter.8 Wed Dec 21 08:29:44 2016 (r310354) @@ -0,0 +1,106 @@ +.\" Copyright (c) 2016 Nuxi, https://nuxi.nl/ +.\" +.\" 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 December 18, 2016 +.Dt PROMETHEUS_SYSCTL_EXPORTER 8 +.Os +.Sh NAME +.Nm prometheus_sysctl_exporter +.Nd print kernel state as Prometheus metrics +.Sh SYNOPSIS +.Nm prometheus_sysctl_exporter +.Op Fl dgh +.Op Ar prefix ... +.Sh DESCRIPTION +Prometheus is a monitoring system that gathers metrics from its targets +by fetching them through HTTP GET requests. +Metrics are identified by a name and an optional set of labels. +Sample values are required to be numerical. +.Pp +The +.Nm +utility prints the values of sysctl nodes to standard output, +formatted such that they can be scraped by Prometheus directly. +By default, +it prints metrics for all numerically representable nodes in the sysctl +namespace. +It is also possible to limit output to a smaller number of metrics by +specifying one or more prefixes as arguments. +.Pp +Metrics printed by this utility are named +.Ql sysctl_ , +followed by the name of the sysctl node having its +.Ql .\& +separators replaced by +.Ql _ . +Components on which it is desirable to aggregate (e.g., +names of devices) are omitted from the metric's name, +but are appended as labels instead. +.Pp +There are two different methods for exporting the output of +.Nm +to Prometheus. +The first method is to periodically invoke this utility through +.Xr cron 8 +and store its output in a textfile. +The metrics in this textfile can then be served over HTTP using the +Prometheus node exporter's textfile collector. +The second method is to run this utility through +.Xr inetd 8 . +TCP port 9124 has been allocated for this purpose. +.Pp +The following options are available: +.Bl -tag -width indent +.It Fl d +Print descriptions of metrics when available. +.It Fl g +Gzip compresses the HTTP response body. +.It Fl h +Precede the output with a HTTP response header. +This flag is required when running this utility through +.Xr inetd 8 . +.El +.Sh SEE ALSO +.Xr cron 8 , +.Xr inetd 8 , +.Xr sysctl 8 , +.Xr SYSCTL_ADD_NODE_WITH_LABEL 9 +.Pp +Prometheus project: +.Pa https://prometheus.io/ . +.Pp +Prometheus exposition formats: +.Pa https://prometheus.io/docs/instrumenting/exposition_formats/ . +.Pp +Prometheus node exporter: +.Pa https://github.com/prometheus/node_exporter . +.Pp +Prometheus default port allocations: +.Pa https://github.com/prometheus/prometheus/wiki/Default-port-allocations . +.Sh HISTORY +.Nm +first appeared in +.Fx 12.0 . +.Sh AUTHORS +.An Nuxi : Pa https://nuxi.nl/ . Added: head/usr.sbin/prometheus_sysctl_exporter/prometheus_sysctl_exporter.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/usr.sbin/prometheus_sysctl_exporter/prometheus_sysctl_exporter.c Wed Dec 21 08:29:44 2016 (r310354) @@ -0,0 +1,652 @@ +/*- + * Copyright (c) 2016 Nuxi, https://nuxi.nl/ + * + * 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. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +/* + * Cursor for iterating over all of the system's sysctl OIDs. + */ +struct oid { + int id[CTL_MAXNAME]; + size_t len; +}; + +/* Initializes the cursor to point to start of the tree. */ +static void +oid_get_root(struct oid *o) +{ + + o->id[0] = 1; + o->len = 1; +} + +/* Obtains the OID for a sysctl by name. */ +static void +oid_get_by_name(struct oid *o, const char *name) +{ + + o->len = nitems(o->id); + if (sysctlnametomib(name, o->id, &o->len) != 0) + err(1, "sysctl(%s)", name); +} + +/* Returns whether an OID is placed below another OID. */ +static bool +oid_is_beneath(struct oid *oa, struct oid *ob) +{ + + return (oa->len >= ob->len && + memcmp(oa->id, ob->id, ob->len * sizeof(oa->id[0])) == 0); +} + +/* Advances the cursor to the next OID. */ +static bool +oid_get_next(const struct oid *cur, struct oid *next) +{ + int lookup[CTL_MAXNAME + 2]; + size_t nextsize; + + lookup[0] = 0; + lookup[1] = 2; + memcpy(lookup + 2, cur->id, cur->len * sizeof(lookup[0])); + nextsize = sizeof(next->id); + if (sysctl(lookup, 2 + cur->len, &next->id, &nextsize, 0, 0) != 0) { + if (errno == ENOENT) + return (false); + err(1, "sysctl(next)"); + } + next->len = nextsize / sizeof(next->id[0]); + return (true); +} + +/* + * OID formatting metadata. + */ +struct oidformat { + unsigned int kind; + char format[BUFSIZ]; +}; + +/* Returns whether the OID represents a temperature value. */ +static bool +oidformat_is_temperature(const struct oidformat *of) +{ + + return (of->format[0] == 'I' && of->format[1] == 'K'); +} + +/* Returns whether the OID represents a timeval structure. */ +static bool +oidformat_is_timeval(const struct oidformat *of) +{ + + return (strcmp(of->format, "S,timeval") == 0); +} + +/* Fetches the formatting metadata for an OID. */ +static bool +oid_get_format(const struct oid *o, struct oidformat *of) +{ + int lookup[CTL_MAXNAME + 2]; + size_t oflen; + + lookup[0] = 0; + lookup[1] = 4; + memcpy(lookup + 2, o->id, o->len * sizeof(lookup[0])); + oflen = sizeof(*of); + if (sysctl(lookup, 2 + o->len, of, &oflen, 0, 0) != 0) { + if (errno == ENOENT) + return (false); + err(1, "sysctl(oidfmt)"); + } + return (true); +} + +/* + * Container for holding the value of an OID. + */ +struct oidvalue { + enum { SIGNED, UNSIGNED, FLOAT } type; + union { + intmax_t s; + uintmax_t u; + double f; + } value; +}; + +/* Extracts the value of an OID, converting it to a floating-point number. */ +static double +oidvalue_get_float(const struct oidvalue *ov) +{ + + switch (ov->type) { + case SIGNED: + return (ov->value.s); + case UNSIGNED: + return (ov->value.u); + case FLOAT: + return (ov->value.f); + default: + assert(0 && "Unknown value type"); + } +} + +/* Sets the value of an OID as a signed integer. */ +static void +oidvalue_set_signed(struct oidvalue *ov, intmax_t s) +{ + + ov->type = SIGNED; + ov->value.s = s; +} + +/* Sets the value of an OID as an unsigned integer. */ +static void +oidvalue_set_unsigned(struct oidvalue *ov, uintmax_t u) +{ + + ov->type = UNSIGNED; + ov->value.u = u; +} + +/* Sets the value of an OID as a floating-point number. */ +static void +oidvalue_set_float(struct oidvalue *ov, double f) +{ + + ov->type = FLOAT; + ov->value.f = f; +} + +/* Prints the value of an OID to a file stream. */ +static void +oidvalue_print(const struct oidvalue *ov, FILE *fp) +{ + + switch (ov->type) { + case SIGNED: + fprintf(fp, "%jd", ov->value.s); + break; + case UNSIGNED: + fprintf(fp, "%ju", ov->value.u); + break; + case FLOAT: + switch (fpclassify(ov->value.f)) { + case FP_INFINITE: + if (signbit(ov->value.f)) + fprintf(fp, "-Inf"); + else + fprintf(fp, "+Inf"); + break; + case FP_NAN: + fprintf(fp, "Nan"); + break; + default: + fprintf(fp, "%.6f", ov->value.f); + break; + } + break; + } +} + +/* Fetches the value of an OID. */ +static bool +oid_get_value(const struct oid *o, const struct oidformat *of, + struct oidvalue *ov) +{ + + switch (of->kind & CTLTYPE) { +#define GET_VALUE(ctltype, type) \ + case (ctltype): { \ + type value; \ + size_t valuesize; \ + \ + valuesize = sizeof(value); \ + if (sysctl(o->id, o->len, &value, &valuesize, 0, 0) != 0) \ + return (false); \ + if ((type)-1 > 0) \ + oidvalue_set_unsigned(ov, value); \ + else \ + oidvalue_set_signed(ov, value); \ + break; \ + } + GET_VALUE(CTLTYPE_INT, int); + GET_VALUE(CTLTYPE_UINT, unsigned int); + GET_VALUE(CTLTYPE_LONG, long); + GET_VALUE(CTLTYPE_ULONG, unsigned long); + GET_VALUE(CTLTYPE_S8, int8_t); + GET_VALUE(CTLTYPE_U8, uint8_t); + GET_VALUE(CTLTYPE_S16, int16_t); + GET_VALUE(CTLTYPE_U16, uint16_t); + GET_VALUE(CTLTYPE_S32, int32_t); + GET_VALUE(CTLTYPE_U32, uint32_t); + GET_VALUE(CTLTYPE_S64, int64_t); + GET_VALUE(CTLTYPE_U64, uint64_t); +#undef GET_VALUE + case CTLTYPE_OPAQUE: + if (oidformat_is_timeval(of)) { + struct timeval tv; + size_t tvsize; + + tvsize = sizeof(tv); + if (sysctl(o->id, o->len, &tv, &tvsize, 0, 0) != 0) + return (false); + oidvalue_set_float(ov, + (double)tv.tv_sec + (double)tv.tv_usec / 1000000); + return (true); + } else if (strcmp(of->format, "S,loadavg") == 0) { + struct loadavg la; + size_t lasize; + + /* + * Only return the one minute load average, as + * the others can be inferred using avg_over_time(). + */ + lasize = sizeof(la); + if (sysctl(o->id, o->len, &la, &lasize, 0, 0) != 0) + return (false); + oidvalue_set_float(ov, + (double)la.ldavg[0] / (double)la.fscale); + return (true); + } + return (false); + default: + return (false); + } + + /* Convert temperatures from decikelvin to degrees Celcius. */ + if (oidformat_is_temperature(of)) { + double v; + int e; + + v = oidvalue_get_float(ov); + if (v < 0) { + oidvalue_set_float(ov, NAN); + } else { + e = of->format[2] >= '0' && of->format[2] <= '9' ? + of->format[2] - '0' : 1; + oidvalue_set_float(ov, v / pow(10, e) - 273.15); + } + } + return (true); +} + +/* + * The full name of an OID, stored as a series of components. + */ +struct oidname { + struct oid oid; + char names[BUFSIZ]; + char labels[BUFSIZ]; +}; + +/* + * Initializes the OID name object with an empty value. + */ +static void +oidname_init(struct oidname *on) +{ + + on->oid.len = 0; +} + +/* Fetches the name and labels of an OID, reusing the previous results. */ +static void +oid_get_name(const struct oid *o, struct oidname *on) +{ + int lookup[CTL_MAXNAME + 2]; + char *c, *label; + size_t i, len; + + /* Fetch the name and split it up in separate components. */ + lookup[0] = 0; + lookup[1] = 1; + memcpy(lookup + 2, o->id, o->len * sizeof(lookup[0])); + len = sizeof(on->names); + if (sysctl(lookup, 2 + o->len, on->names, &len, 0, 0) != 0) + err(1, "sysctl(name)"); + for (c = strchr(on->names, '.'); c != NULL; c = strchr(c + 1, '.')) + *c = '\0'; + + /* No need to fetch labels for components that we already have. */ + label = on->labels; + for (i = 0; i < o->len && i < on->oid.len && o->id[i] == on->oid.id[i]; + ++i) + label += strlen(label) + 1; + + /* Fetch the remaining labels. */ + lookup[1] = 6; + for (; i < o->len; ++i) { + len = on->labels + sizeof(on->labels) - label; + if (sysctl(lookup, 2 + i + 1, label, &len, 0, 0) == 0) { + label += len; + } else if (errno == ENOENT) { + *label++ = '\0'; + } else { + err(1, "sysctl(oidlabel)"); + } + } + on->oid = *o; +} + +/* Prints the name and labels of an OID to a file stream. */ +static void +oidname_print(const struct oidname *on, const struct oidformat *of, + FILE *fp) +{ + const char *name, *label; + size_t i; + char separator; + + /* Print the name of the metric. */ + fprintf(fp, "sysctl"); + name = on->names; + label = on->labels; + for (i = 0; i < on->oid.len; ++i) { + if (*label == '\0') { + assert(name[strspn(name, + "abcdefghijklmnopqrstuvwxyz" + "ABCDEFGHIJKLMNOPQRSTUVWXYZ" + "0123456789_")] == '\0'); + fprintf(fp, "_%s", name); + } + name += strlen(name) + 1; + label += strlen(label) + 1; + } + if (oidformat_is_temperature(of)) + fprintf(fp, "_celcius"); + else if (oidformat_is_timeval(of)) + fprintf(fp, "_seconds"); + + /* Print the labels of the metric. */ + name = on->names; + label = on->labels; + separator = '{'; + for (i = 0; i < on->oid.len; ++i) { + if (*label != '\0') { + assert(name[strspn(name, + "abcdefghijklmnopqrstuvwxyz" + "ABCDEFGHIJKLMNOPQRSTUVWXYZ" + "0123456789_-")] == '\0'); + assert(label[strspn(label, + "abcdefghijklmnopqrstuvwxyz" + "ABCDEFGHIJKLMNOPQRSTUVWXYZ" + "0123456789_")] == '\0'); + fprintf(fp, "%c%s=\"%s\"", separator, label, name); + separator = ','; + } + name += strlen(name) + 1; + label += strlen(label) + 1; + } + if (separator != '{') + fputc('}', fp); +} + +/* Returns whether the OID name has any labels associated to it. */ +static bool +oidname_has_labels(const struct oidname *on) +{ + size_t i; + + for (i = 0; i < on->oid.len; ++i) + if (on->labels[i] != 0) + return (true); + return (false); +} + +/* + * The description of an OID. + */ +struct oiddescription { + char description[BUFSIZ]; +}; + +/* + * Fetches the description of an OID. + */ +static bool +oid_get_description(const struct oid *o, struct oiddescription *od) +{ + int lookup[CTL_MAXNAME + 2]; + char *newline; + size_t odlen; + + lookup[0] = 0; + lookup[1] = 5; + memcpy(lookup + 2, o->id, o->len * sizeof(lookup[0])); + odlen = sizeof(od->description); + if (sysctl(lookup, 2 + o->len, &od->description, &odlen, 0, 0) != 0) { + if (errno == ENOENT) + return (false); + err(1, "sysctl(oiddescr)"); + } + + newline = strchr(od->description, '\n'); + if (newline != NULL) + *newline = '\0'; + + return (*od->description != '\0'); +} + +/* Prints the description of an OID to a file stream. */ +static void +oiddescription_print(const struct oiddescription *od, FILE *fp) +{ + + fprintf(fp, "%s", od->description); +} + +static void +oid_print(const struct oid *o, struct oidname *on, bool print_description, + FILE *fp) +{ + struct oidformat of; + struct oidvalue ov; + struct oiddescription od; + + if (!oid_get_format(o, &of) || !oid_get_value(o, &of, &ov)) + return; + oid_get_name(o, on); + + /* + * Print the line with the description. Prometheus expects a + * single unique description for every metric, which cannot be + * guaranteed by sysctl if labels are present. Omit the + * description if labels are present. + */ + if (print_description && !oidname_has_labels(on) && + oid_get_description(o, &od)) { + fprintf(fp, "# HELP "); + oidname_print(on, &of, fp); + fputc(' ', fp); + oiddescription_print(&od, fp); + fputc('\n', fp); + } + + /* Print the line with the value. */ + oidname_print(on, &of, fp); + fputc(' ', fp); + oidvalue_print(&ov, fp); + fputc('\n', fp); +} + +/* Gzip compresses a buffer of memory. */ +static bool +buf_gzip(const char *in, size_t inlen, char *out, size_t *outlen) +{ + z_stream stream = { + .next_in = __DECONST(unsigned char *, in), + .avail_in = inlen, + .next_out = (unsigned char *)out, + .avail_out = *outlen, + }; + + if (deflateInit2(&stream, Z_DEFAULT_COMPRESSION, Z_DEFLATED, + MAX_WBITS + 16, 8, Z_DEFAULT_STRATEGY) != Z_OK || + deflate(&stream, Z_FINISH) != Z_STREAM_END) { + return (false); + } + *outlen = stream.total_out; + return (deflateEnd(&stream) == Z_OK); +} + +static void +usage(void) +{ + + fprintf(stderr, + "usage: prometheus_sysctl_exporter [-dgh] [prefix ...]\n"); + exit(1); +} + +int +main(int argc, char *argv[]) +{ + struct oidname on; + char *http_buf; + FILE *fp; + size_t http_buflen; + int ch; + bool gzip_mode, http_mode, print_descriptions; + + /* Parse command line flags. */ + gzip_mode = http_mode = print_descriptions = false; + while ((ch = getopt(argc, argv, "dgh")) != -1) { + switch (ch) { + case 'd': + print_descriptions = true; + break; + case 'g': + gzip_mode = true; + break; + case 'h': + http_mode = true; + break; + default: + usage(); + } + } + argc -= optind; + argv += optind; + + /* HTTP output: cache metrics in buffer. */ + if (http_mode) { + fp = open_memstream(&http_buf, &http_buflen); + if (fp == NULL) + err(1, "open_memstream"); + } else { + fp = stdout; + } + + oidname_init(&on); + if (argc == 0) { + struct oid o; + + /* Print all OIDs. */ + oid_get_root(&o); + do { + oid_print(&o, &on, print_descriptions, fp); + } while (oid_get_next(&o, &o)); + } else { + int i; + + /* Print only trees provided as arguments. */ + for (i = 0; i < argc; ++i) { + struct oid o, root; + + oid_get_by_name(&root, argv[i]); + o = root; + do { + oid_print(&o, &on, print_descriptions, fp); + } while (oid_get_next(&o, &o) && + oid_is_beneath(&o, &root)); + } + } + + if (http_mode) { + const char *content_encoding = ""; + + if (ferror(fp) || fclose(fp) != 0) + err(1, "Cannot generate output"); + + /* Gzip compress the output. */ + if (gzip_mode) { + char *buf; + size_t buflen; + + buflen = http_buflen; + buf = malloc(buflen); + if (buf == NULL) + err(1, "Cannot allocate compression buffer"); + if (buf_gzip(http_buf, http_buflen, buf, &buflen)) { + content_encoding = "Content-Encoding: gzip\r\n"; + free(http_buf); + http_buf = buf; + http_buflen = buflen; + } else { + free(buf); + } + } + + /* Print HTTP header and metrics. */ + dprintf(STDOUT_FILENO, + "HTTP/1.1 200 OK\r\n" + "Connection: close\r\n" + "%s" + "Content-Length: %zu\r\n" + "Content-Type: text/plain; version=0.0.4\r\n" + "\r\n", + content_encoding, http_buflen); + write(STDOUT_FILENO, http_buf, http_buflen); + free(http_buf); + + /* Drain output. */ + if (shutdown(STDIN_FILENO, SHUT_WR) == 0) { + char buf[1024]; + + while (read(STDIN_FILENO, buf, sizeof(buf)) > 0) { + } + } + } + return (0); +} From owner-svn-src-all@freebsd.org Wed Dec 21 08:32:22 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 29616C89FB5; Wed, 21 Dec 2016 08:32:22 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id ED88A1097; Wed, 21 Dec 2016 08:32:21 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBL8WLCs044769; Wed, 21 Dec 2016 08:32:21 GMT (envelope-from ed@FreeBSD.org) Received: (from ed@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBL8WLOQ044767; Wed, 21 Dec 2016 08:32:21 GMT (envelope-from ed@FreeBSD.org) Message-Id: <201612210832.uBL8WLOQ044767@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ed set sender to ed@FreeBSD.org using -f From: Ed Schouten Date: Wed, 21 Dec 2016 08:32:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310355 - head/etc X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Dec 2016 08:32:22 -0000 Author: ed Date: Wed Dec 21 08:32:20 2016 New Revision: 310355 URL: https://svnweb.freebsd.org/changeset/base/310355 Log: Add an example inetd(8) entry for the Prometheus sysctl exporter. I went through the process of allocating a default port number for this exporter, TCP 9124. This means that we can add an entry to the services file as well. List of Prometheus default port numbers: https://github.com/prometheus/prometheus/wiki/Default-port-allocations Modified: head/etc/inetd.conf head/etc/services Modified: head/etc/inetd.conf ============================================================================== --- head/etc/inetd.conf Wed Dec 21 08:29:44 2016 (r310354) +++ head/etc/inetd.conf Wed Dec 21 08:32:20 2016 (r310355) @@ -117,3 +117,7 @@ #netbios-ssn stream tcp nowait root /usr/local/sbin/smbd smbd #netbios-ns dgram udp wait root /usr/local/sbin/nmbd nmbd #swat stream tcp nowait/400 root /usr/local/sbin/swat swat +# +# Example entry for the Prometheus sysctl metrics exporter +# +#prom-sysctl stream tcp nowait nobody /usr/sbin/prometheus_sysctl_exporter prometheus_sysctl_exporter -dgh Modified: head/etc/services ============================================================================== --- head/etc/services Wed Dec 21 08:29:44 2016 (r310354) +++ head/etc/services Wed Dec 21 08:32:20 2016 (r310355) @@ -2450,6 +2450,7 @@ aurora 9084/sctp #IBM AURORA Performan aurora 9084/tcp #IBM AURORA Performance Visualizer aurora 9084/udp #IBM AURORA Performance Visualizer jetdirect 9100/tcp #HP JetDirect card +prom-sysctl 9124/tcp #prometheus_sysctl_exporter(8) git 9418/tcp #git pack transfer service git 9418/udp #git pack transfer service man 9535/tcp From owner-svn-src-all@freebsd.org Wed Dec 21 09:05:32 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 02812C8A43D; Wed, 21 Dec 2016 09:05:32 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B7888151A; Wed, 21 Dec 2016 09:05:31 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBL95UG8057637; Wed, 21 Dec 2016 09:05:30 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBL95U8R057635; Wed, 21 Dec 2016 09:05:30 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201612210905.uBL95U8R057635@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Wed, 21 Dec 2016 09:05:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310356 - in head: sys/cam/ctl usr.sbin/ctladm X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Dec 2016 09:05:32 -0000 Author: mav Date: Wed Dec 21 09:05:30 2016 New Revision: 310356 URL: https://svnweb.freebsd.org/changeset/base/310356 Log: Add support for locally assigned RFC 4122 UUID LUN identifiers. MFC after: 2 weeks Modified: head/sys/cam/ctl/ctl.c head/usr.sbin/ctladm/ctladm.8 Modified: head/sys/cam/ctl/ctl.c ============================================================================== --- head/sys/cam/ctl/ctl.c Wed Dec 21 08:32:20 2016 (r310355) +++ head/sys/cam/ctl/ctl.c Wed Dec 21 09:05:30 2016 (r310356) @@ -4371,6 +4371,8 @@ hex2bin(const char *str, uint8_t *buf, i str += 2; buf_size *= 2; for (i = 0; str[i] != 0 && i < buf_size; i++) { + while (str[i] == '-') /* Skip dashes in UUIDs. */ + str++; c = str[i]; if (isdigit(c)) c -= '0'; @@ -4406,7 +4408,7 @@ ctl_alloc_lun(struct ctl_softc *ctl_soft struct ctl_lun *nlun, *lun; struct scsi_vpd_id_descriptor *desc; struct scsi_vpd_id_t10 *t10id; - const char *eui, *naa, *scsiname, *vendor, *value; + const char *eui, *naa, *scsiname, *uuid, *vendor, *value; int lun_number, i, lun_malloced; int devidlen, idlen1, idlen2 = 0, len; @@ -4458,6 +4460,10 @@ ctl_alloc_lun(struct ctl_softc *ctl_soft if (naa != NULL) { len += sizeof(struct scsi_vpd_id_descriptor) + 16; } + uuid = ctl_get_opt(&be_lun->options, "uuid"); + if (uuid != NULL) { + len += sizeof(struct scsi_vpd_id_descriptor) + 18; + } lun->lun_devid = malloc(sizeof(struct ctl_devid) + len, M_CTL, M_WAITOK | M_ZERO); desc = (struct scsi_vpd_id_descriptor *)lun->lun_devid->data; @@ -4504,6 +4510,16 @@ ctl_alloc_lun(struct ctl_softc *ctl_soft desc->length = desc->length > 8 ? 16 : 8; len -= 16 - desc->length; } + if (uuid != NULL) { + desc = (struct scsi_vpd_id_descriptor *)(&desc->identifier[0] + + desc->length); + desc->proto_codeset = SVPD_ID_CODESET_BINARY; + desc->id_type = SVPD_ID_PIV | SVPD_ID_ASSOC_LUN | + SVPD_ID_TYPE_UUID; + desc->identifier[0] = 0x10; + hex2bin(uuid, &desc->identifier[2], 16); + desc->length = 18; + } lun->lun_devid->len = len; mtx_lock(&ctl_softc->ctl_lock); Modified: head/usr.sbin/ctladm/ctladm.8 ============================================================================== --- head/usr.sbin/ctladm/ctladm.8 Wed Dec 21 08:32:20 2016 (r310355) +++ head/usr.sbin/ctladm/ctladm.8 Wed Dec 21 09:05:30 2016 (r310356) @@ -35,7 +35,7 @@ .\" $Id: //depot/users/kenm/FreeBSD-test2/usr.sbin/ctladm/ctladm.8#3 $ .\" $FreeBSD$ .\" -.Dd October 15, 2016 +.Dd December 21, 2016 .Dt CTLADM 8 .Os .Sh NAME @@ -859,9 +859,12 @@ Specifies LUN SCSI name string. Specifies LUN EUI-64 identifier. .It Va naa Specifies LUN NAA identifier. -Either EUI or NAA identifier should be set to UNIQUE value to allow +.It Va uuid +Specifies LUN locally assigned RFC 4122 UUID identifier. +EUI, NAA or UUID identifier should be set to UNIQUE value to allow EXTENDED COPY command access the LUN. Non-unique LUN identifiers may lead to data corruption. +Some initiators may not support later introduced UUID identifiers. .It Va ha_role Setting to "primary" or "secondary" overrides default role of the node in HA cluster, set by kern.cam.ctl.ha_role sysctl. From owner-svn-src-all@freebsd.org Wed Dec 21 09:15:27 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1BBBFC8A6A5; Wed, 21 Dec 2016 09:15:27 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id DF1A71AF9; Wed, 21 Dec 2016 09:15:26 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBL9FQ88061724; Wed, 21 Dec 2016 09:15:26 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBL9FQkR061723; Wed, 21 Dec 2016 09:15:26 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201612210915.uBL9FQkR061723@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Wed, 21 Dec 2016 09:15:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r310357 - stable/11/sys/vm X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Dec 2016 09:15:27 -0000 Author: kib Date: Wed Dec 21 09:15:25 2016 New Revision: 310357 URL: https://svnweb.freebsd.org/changeset/base/310357 Log: MFC r310097: Remove locking around accounting initialization of the default object. Modified: stable/11/sys/vm/default_pager.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/vm/default_pager.c ============================================================================== --- stable/11/sys/vm/default_pager.c Wed Dec 21 09:05:30 2016 (r310356) +++ stable/11/sys/vm/default_pager.c Wed Dec 21 09:15:25 2016 (r310357) @@ -91,10 +91,8 @@ default_pager_alloc(void *handle, vm_oof object = vm_object_allocate(OBJT_DEFAULT, OFF_TO_IDX(round_page(offset + size))); if (cred != NULL) { - VM_OBJECT_WLOCK(object); object->cred = cred; object->charge = size; - VM_OBJECT_WUNLOCK(object); } return (object); } From owner-svn-src-all@freebsd.org Wed Dec 21 09:18:54 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6892EC8A72E; Wed, 21 Dec 2016 09:18:54 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 2D0641CA1; Wed, 21 Dec 2016 09:18:54 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBL9Ir8Y061890; Wed, 21 Dec 2016 09:18:53 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBL9IrCm061889; Wed, 21 Dec 2016 09:18:53 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201612210918.uBL9IrCm061889@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Wed, 21 Dec 2016 09:18:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r310358 - stable/11/sys/vm X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Dec 2016 09:18:54 -0000 Author: kib Date: Wed Dec 21 09:18:53 2016 New Revision: 310358 URL: https://svnweb.freebsd.org/changeset/base/310358 Log: MFC r310098: Provide introductory description of the default pager. Modified: stable/11/sys/vm/default_pager.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/vm/default_pager.c ============================================================================== --- stable/11/sys/vm/default_pager.c Wed Dec 21 09:15:25 2016 (r310357) +++ stable/11/sys/vm/default_pager.c Wed Dec 21 09:18:53 2016 (r310358) @@ -63,6 +63,16 @@ static boolean_t default_pager_haspage(v int *); /* * pagerops for OBJT_DEFAULT - "default pager". + * + * This pager handles anonymous (no handle) swap-backed memory, just + * like the swap pager. It allows several optimizations based on the + * fact that no pages of a default object can be swapped out. The + * most important optimization is in vm_fault(), where the pager is + * never asked for a non-resident page. Instead, a freshly allocated + * zeroed page is used. + * + * On the first request to page out a page from a default object, the + * object is converted to swap pager type. */ struct pagerops defaultpagerops = { .pgo_alloc = default_pager_alloc, From owner-svn-src-all@freebsd.org Wed Dec 21 09:22:07 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 52A1BC8A938; Wed, 21 Dec 2016 09:22:07 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 21F1110F1; Wed, 21 Dec 2016 09:22:07 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBL9M6vC065683; Wed, 21 Dec 2016 09:22:06 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBL9M6BB065682; Wed, 21 Dec 2016 09:22:06 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201612210922.uBL9M6BB065682@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Wed, 21 Dec 2016 09:22:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r310359 - stable/11/sys/amd64/amd64 X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Dec 2016 09:22:07 -0000 Author: kib Date: Wed Dec 21 09:22:06 2016 New Revision: 310359 URL: https://svnweb.freebsd.org/changeset/base/310359 Log: MFC r310205: Fix typo. Remove spurious blank line. Modified: stable/11/sys/amd64/amd64/trap.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/amd64/amd64/trap.c ============================================================================== --- stable/11/sys/amd64/amd64/trap.c Wed Dec 21 09:18:53 2016 (r310358) +++ stable/11/sys/amd64/amd64/trap.c Wed Dec 21 09:22:06 2016 (r310359) @@ -914,7 +914,7 @@ amd64_syscall(struct thread *td, int tra } KASSERT(PCB_USER_FPU(td->td_pcb), - ("System call %s returing with kernel FPU ctx leaked", + ("System call %s returning with kernel FPU ctx leaked", syscallname(td->td_proc, sa.code))); KASSERT(td->td_pcb->pcb_save == get_pcb_user_save_td(td), ("System call %s returning with mangled pcb_save", @@ -923,7 +923,6 @@ amd64_syscall(struct thread *td, int tra ("System call %s returning with leaked invl_gen %lu", syscallname(td->td_proc, sa.code), td->td_md.md_invl_gen.gen)); - syscallret(td, error, &sa); /* From owner-svn-src-all@freebsd.org Wed Dec 21 09:36:24 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id F1AF6C8ABAF; Wed, 21 Dec 2016 09:36:24 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id CC4041706; Wed, 21 Dec 2016 09:36:24 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBL9aODx069886; Wed, 21 Dec 2016 09:36:24 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBL9aNOh069883; Wed, 21 Dec 2016 09:36:23 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201612210936.uBL9aNOh069883@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Wed, 21 Dec 2016 09:36:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310360 - in head/sys/cam: . scsi X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Dec 2016 09:36:25 -0000 Author: mav Date: Wed Dec 21 09:36:23 2016 New Revision: 310360 URL: https://svnweb.freebsd.org/changeset/base/310360 Log: Report UUID and MD5 LUN IDs. MFC after: 2 weeks Modified: head/sys/cam/cam_xpt.c head/sys/cam/scsi/scsi_all.c head/sys/cam/scsi/scsi_all.h Modified: head/sys/cam/cam_xpt.c ============================================================================== --- head/sys/cam/cam_xpt.c Wed Dec 21 09:22:06 2016 (r310359) +++ head/sys/cam/cam_xpt.c Wed Dec 21 09:36:23 2016 (r310360) @@ -1115,7 +1115,7 @@ xpt_denounce_periph(struct cam_periph *p int xpt_getattr(char *buf, size_t len, const char *attr, struct cam_path *path) { - int ret = -1, l; + int ret = -1, l, o; struct ccb_dev_advinfo cdai; struct scsi_vpd_id_descriptor *idd; @@ -1155,6 +1155,12 @@ xpt_getattr(char *buf, size_t len, const if (idd == NULL) idd = scsi_get_devid((struct scsi_vpd_device_id *)cdai.buf, cdai.provsiz, scsi_devid_is_lun_eui64); + if (idd == NULL) + idd = scsi_get_devid((struct scsi_vpd_device_id *)cdai.buf, + cdai.provsiz, scsi_devid_is_lun_uuid); + if (idd == NULL) + idd = scsi_get_devid((struct scsi_vpd_device_id *)cdai.buf, + cdai.provsiz, scsi_devid_is_lun_md5); } else idd = NULL; if (idd == NULL) @@ -1181,6 +1187,17 @@ xpt_getattr(char *buf, size_t len, const buf[l] = 0; } else ret = EFAULT; + } else if ((idd->id_type & SVPD_ID_TYPE_MASK) == SVPD_ID_TYPE_UUID + && idd->identifier[0] == 0x10) { + if ((idd->length - 2) * 2 + 4 < len) { + for (l = 2, o = 0; l < idd->length; l++) { + o += sprintf(buf + o, "%02x", + idd->identifier[l]); + if (l == 4 || l == 6 || l == 8 || l == 10) + o += sprintf(buf + o, "-"); + } + } else + ret = EFAULT; } else { if (idd->length * 2 < len) { for (l = 0; l < idd->length; l++) Modified: head/sys/cam/scsi/scsi_all.c ============================================================================== --- head/sys/cam/scsi/scsi_all.c Wed Dec 21 09:22:06 2016 (r310359) +++ head/sys/cam/scsi/scsi_all.c Wed Dec 21 09:36:23 2016 (r310360) @@ -5691,6 +5691,32 @@ scsi_devid_is_lun_name(uint8_t *bufp) } int +scsi_devid_is_lun_md5(uint8_t *bufp) +{ + struct scsi_vpd_id_descriptor *descr; + + descr = (struct scsi_vpd_id_descriptor *)bufp; + if ((descr->id_type & SVPD_ID_ASSOC_MASK) != SVPD_ID_ASSOC_LUN) + return 0; + if ((descr->id_type & SVPD_ID_TYPE_MASK) != SVPD_ID_TYPE_MD5_LUN_ID) + return 0; + return 1; +} + +int +scsi_devid_is_lun_uuid(uint8_t *bufp) +{ + struct scsi_vpd_id_descriptor *descr; + + descr = (struct scsi_vpd_id_descriptor *)bufp; + if ((descr->id_type & SVPD_ID_ASSOC_MASK) != SVPD_ID_ASSOC_LUN) + return 0; + if ((descr->id_type & SVPD_ID_TYPE_MASK) != SVPD_ID_TYPE_UUID) + return 0; + return 1; +} + +int scsi_devid_is_port_naa(uint8_t *bufp) { struct scsi_vpd_id_descriptor *descr; Modified: head/sys/cam/scsi/scsi_all.h ============================================================================== --- head/sys/cam/scsi/scsi_all.h Wed Dec 21 09:22:06 2016 (r310359) +++ head/sys/cam/scsi/scsi_all.h Wed Dec 21 09:36:23 2016 (r310360) @@ -3782,6 +3782,8 @@ int scsi_devid_is_lun_eui64(uint8_t *bu int scsi_devid_is_lun_naa(uint8_t *bufp); int scsi_devid_is_lun_name(uint8_t *bufp); int scsi_devid_is_lun_t10(uint8_t *bufp); +int scsi_devid_is_lun_md5(uint8_t *bufp); +int scsi_devid_is_lun_uuid(uint8_t *bufp); int scsi_devid_is_port_naa(uint8_t *bufp); struct scsi_vpd_id_descriptor * scsi_get_devid(struct scsi_vpd_device_id *id, uint32_t len, From owner-svn-src-all@freebsd.org Wed Dec 21 09:49:17 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id AF606C8AE25; Wed, 21 Dec 2016 09:49:17 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 7F1C41CB8; Wed, 21 Dec 2016 09:49:17 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBL9nGKE074047; Wed, 21 Dec 2016 09:49:16 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBL9nGZl074046; Wed, 21 Dec 2016 09:49:16 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201612210949.uBL9nGZl074046@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Wed, 21 Dec 2016 09:49:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310361 - head/sys/cam X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Dec 2016 09:49:17 -0000 Author: mav Date: Wed Dec 21 09:49:16 2016 New Revision: 310361 URL: https://svnweb.freebsd.org/changeset/base/310361 Log: Fix UUID formatting added in r310360. Oops! MFC after: 2 weeks Modified: head/sys/cam/cam_xpt.c Modified: head/sys/cam/cam_xpt.c ============================================================================== --- head/sys/cam/cam_xpt.c Wed Dec 21 09:36:23 2016 (r310360) +++ head/sys/cam/cam_xpt.c Wed Dec 21 09:49:16 2016 (r310361) @@ -1191,10 +1191,10 @@ xpt_getattr(char *buf, size_t len, const && idd->identifier[0] == 0x10) { if ((idd->length - 2) * 2 + 4 < len) { for (l = 2, o = 0; l < idd->length; l++) { + if (l == 6 || l == 8 || l == 10 || l == 12) + o += sprintf(buf + o, "-"); o += sprintf(buf + o, "%02x", idd->identifier[l]); - if (l == 4 || l == 6 || l == 8 || l == 10) - o += sprintf(buf + o, "-"); } } else ret = EFAULT; From owner-svn-src-all@freebsd.org Wed Dec 21 11:32:10 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1C3CAC893D4; Wed, 21 Dec 2016 11:32:10 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D3A0415FD; Wed, 21 Dec 2016 11:32:09 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBLBW96l019012; Wed, 21 Dec 2016 11:32:09 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBLBW9Ud019011; Wed, 21 Dec 2016 11:32:09 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201612211132.uBLBW9Ud019011@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Wed, 21 Dec 2016 11:32:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r310363 - stable/10/sys/vm X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Dec 2016 11:32:10 -0000 Author: kib Date: Wed Dec 21 11:32:08 2016 New Revision: 310363 URL: https://svnweb.freebsd.org/changeset/base/310363 Log: MFC r310098: Provide introductory description of the default pager. Modified: stable/10/sys/vm/default_pager.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/vm/default_pager.c ============================================================================== --- stable/10/sys/vm/default_pager.c Wed Dec 21 09:59:55 2016 (r310362) +++ stable/10/sys/vm/default_pager.c Wed Dec 21 11:32:08 2016 (r310363) @@ -63,6 +63,16 @@ static boolean_t default_pager_haspage(v int *); /* * pagerops for OBJT_DEFAULT - "default pager". + * + * This pager handles anonymous (no handle) swap-backed memory, just + * like the swap pager. It allows several optimizations based on the + * fact that no pages of a default object can be swapped out. The + * most important optimization is in vm_fault(), where the pager is + * never asked for a non-resident page. Instead, a freshly allocated + * zeroed page is used. + * + * On the first request to page out a page from a default object, the + * object is converted to swap pager type. */ struct pagerops defaultpagerops = { .pgo_alloc = default_pager_alloc, From owner-svn-src-all@freebsd.org Wed Dec 21 11:34:17 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B3F44C8956E; Wed, 21 Dec 2016 11:34:17 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 836851A7F; Wed, 21 Dec 2016 11:34:17 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBLBYGKP020973; Wed, 21 Dec 2016 11:34:16 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBLBYGXS020972; Wed, 21 Dec 2016 11:34:16 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201612211134.uBLBYGXS020972@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Wed, 21 Dec 2016 11:34:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r310364 - stable/10/sys/amd64/amd64 X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Dec 2016 11:34:17 -0000 Author: kib Date: Wed Dec 21 11:34:16 2016 New Revision: 310364 URL: https://svnweb.freebsd.org/changeset/base/310364 Log: MFC r310205: Fix typo. Modified: stable/10/sys/amd64/amd64/trap.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/amd64/amd64/trap.c ============================================================================== --- stable/10/sys/amd64/amd64/trap.c Wed Dec 21 11:32:08 2016 (r310363) +++ stable/10/sys/amd64/amd64/trap.c Wed Dec 21 11:34:16 2016 (r310364) @@ -971,7 +971,7 @@ amd64_syscall(struct thread *td, int tra } KASSERT(PCB_USER_FPU(td->td_pcb), - ("System call %s returing with kernel FPU ctx leaked", + ("System call %s returning with kernel FPU ctx leaked", syscallname(td->td_proc, sa.code))); KASSERT(td->td_pcb->pcb_save == get_pcb_user_save_td(td), ("System call %s returning with mangled pcb_save", From owner-svn-src-all@freebsd.org Wed Dec 21 14:06:45 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D5B3BC8A1A8; Wed, 21 Dec 2016 14:06:45 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 96AE62F8; Wed, 21 Dec 2016 14:06:45 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBLE6i64082253; Wed, 21 Dec 2016 14:06:44 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBLE6isw082252; Wed, 21 Dec 2016 14:06:44 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201612211406.uBLE6isw082252@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Wed, 21 Dec 2016 14:06:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310365 - head/contrib/llvm/projects/libunwind/src X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Dec 2016 14:06:45 -0000 Author: emaste Date: Wed Dec 21 14:06:44 2016 New Revision: 310365 URL: https://svnweb.freebsd.org/changeset/base/310365 Log: libunwind: make __{de,}register_frame compatible with libgcc API The libgcc __register_frame and __deregister_frame functions take a pointer to a set of FDE/CIEs, terminated by an entry where length is 0. In Apple's libunwind implementation the pointer is taken to be to a single FDE. I suspect this was just an Apple bug, compensated by Apple- specific code in LLVM. See lib/ExecutionEngine/RuntimeDyld/RTDyldMemoryManager.cpp and http://lists.llvm.org/pipermail/llvm-dev/2013-April/061737.html for more detail. This change is based on the LLVM RTDyldMemoryManager.cpp. It should later be changed to be alignment-safe. Reported by: dim Reviewed by: dim MFC after: 1 month Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D8869 Modified: head/contrib/llvm/projects/libunwind/src/UnwindLevel1-gcc-ext.c Modified: head/contrib/llvm/projects/libunwind/src/UnwindLevel1-gcc-ext.c ============================================================================== --- head/contrib/llvm/projects/libunwind/src/UnwindLevel1-gcc-ext.c Wed Dec 21 11:34:16 2016 (r310364) +++ head/contrib/llvm/projects/libunwind/src/UnwindLevel1-gcc-ext.c Wed Dec 21 14:06:44 2016 (r310365) @@ -224,6 +224,47 @@ _LIBUNWIND_EXPORT uintptr_t _Unwind_GetI #if _LIBUNWIND_SUPPORT_DWARF_UNWIND +#ifdef __FreeBSD__ + +// Based on LLVM's lib/ExecutionEngine/RuntimeDyld/RTDyldMemoryManager.cpp +// and XXX should be fixed to be alignment-safe. +static void processFDE(const char *addr, bool isDeregister) { + uint64_t length; + while ((length = *((const uint32_t *)addr)) != 0) { + const char *p = addr + 4; + if (length == 0xffffffff) { + length = *((const uint64_t *)p); + p += 8; + } + uint32_t offset = *((const uint32_t *)p); + if (offset != 0) { + if (isDeregister) + _unw_remove_dynamic_fde((unw_word_t)(uintptr_t)addr); + else + _unw_add_dynamic_fde((unw_word_t)(uintptr_t)addr); + } + addr = p + length; + } +} + +/// Called by programs with dynamic code generators that want to register +/// dynamically generated FDEs, with a libgcc-compatible API. + +_LIBUNWIND_EXPORT void __register_frame(const void *addr) { + _LIBUNWIND_TRACE_API("__register_frame(%p)", addr); + processFDE(addr, false); +} + +/// Called by programs with dynamic code generators that want to unregister +/// dynamically generated FDEs, with a libgcc-compatible API. +_LIBUNWIND_EXPORT void __deregister_frame(const void *addr) { + _LIBUNWIND_TRACE_API("__deregister_frame(%p)", addr); + processFDE(addr, true); +} + + +#else + /// Called by programs with dynamic code generators that want /// to register a dynamically generated FDE. /// This function has existed on Mac OS X since 10.4, but @@ -243,6 +284,7 @@ _LIBUNWIND_EXPORT void __deregister_fram _unw_remove_dynamic_fde((unw_word_t)(uintptr_t) fde); } +#endif // The following register/deregister functions are gcc extensions. // They have existed on Mac OS X, but have never worked because Mac OS X From owner-svn-src-all@freebsd.org Wed Dec 21 15:17:48 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B57D9C8A9FC; Wed, 21 Dec 2016 15:17:48 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 82C5514AB; Wed, 21 Dec 2016 15:17:48 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBLFHlDn012204; Wed, 21 Dec 2016 15:17:47 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBLFHl02012201; Wed, 21 Dec 2016 15:17:47 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201612211517.uBLFHl02012201@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Wed, 21 Dec 2016 15:17:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310366 - head/sys/cam/ctl X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Dec 2016 15:17:48 -0000 Author: mav Date: Wed Dec 21 15:17:47 2016 New Revision: 310366 URL: https://svnweb.freebsd.org/changeset/base/310366 Log: Add support for SITUA bit in Logical Block Provisioning mode page. VMware tries to enable this bit to avoid multiple threshold notifications in case of multiple initiators connected to the same LUN. Unfortunately their code sends MODE SELECT(6) request with parameter length hardcoded for the page without any thresholds. Since we have four threshold and our page is bigger, this attempt fails, that is correct in my understanding. So all we can do about this now is to report proper error code and hope VMware fix their code one day. MFC after: 2 weeks Modified: head/sys/cam/ctl/ctl.c head/sys/cam/ctl/ctl_error.c head/sys/cam/ctl/ctl_private.h Modified: head/sys/cam/ctl/ctl.c ============================================================================== --- head/sys/cam/ctl/ctl.c Wed Dec 21 14:06:44 2016 (r310365) +++ head/sys/cam/ctl/ctl.c Wed Dec 21 15:17:47 2016 (r310366) @@ -332,7 +332,7 @@ const static struct ctl_logical_block_pr /*page_code*/SMS_INFO_EXCEPTIONS_PAGE | SMPH_SPF, /*subpage_code*/0x02, /*page_length*/{CTL_LBPM_LEN >> 8, CTL_LBPM_LEN}, - /*flags*/0, + /*flags*/SLBPP_SITUA, /*reserved*/{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, /*descr*/{}}, {{/*flags*/0, @@ -6075,11 +6075,7 @@ do_next_page: * the mode page header, or if they didn't specify enough data in * the CDB to avoid truncating this page, kick out the request. */ - if ((page_len != (page_index->page_len - page_len_offset - - page_len_size)) - || (*len_left < page_index->page_len)) { - - + if (page_len != page_index->page_len - page_len_offset - page_len_size) { ctl_set_invalid_field(ctsio, /*sks_valid*/ 1, /*command*/ 0, @@ -6090,6 +6086,12 @@ do_next_page: ctl_done((union ctl_io *)ctsio); return (CTL_RETVAL_COMPLETE); } + if (*len_left < page_index->page_len) { + free(ctsio->kern_data_ptr, M_CTL); + ctl_set_param_len_error(ctsio); + ctl_done((union ctl_io *)ctsio); + return (CTL_RETVAL_COMPLETE); + } /* * Run through the mode page, checking to make sure that the bits @@ -9326,13 +9328,6 @@ ctl_request_sense(struct ctl_scsiio *cts ua_type = ctl_build_ua(lun, initidx, sense_ptr, sense_format); if (ua_type != CTL_UA_NONE) have_error = 1; - if (ua_type == CTL_UA_LUN_CHANGE) { - mtx_unlock(&lun->lun_lock); - mtx_lock(&softc->ctl_lock); - ctl_clr_ua_allluns(softc, initidx, ua_type); - mtx_unlock(&softc->ctl_lock); - mtx_lock(&lun->lun_lock); - } } if (have_error == 0) { /* Modified: head/sys/cam/ctl/ctl_error.c ============================================================================== --- head/sys/cam/ctl/ctl_error.c Wed Dec 21 14:06:44 2016 (r310365) +++ head/sys/cam/ctl/ctl_error.c Wed Dec 21 15:17:47 2016 (r310366) @@ -515,6 +515,7 @@ ctl_build_ua(struct ctl_lun *lun, uint32 uint32_t p, i; mtx_assert(&lun->lun_lock, MA_OWNED); + mtx_assert(&lun->ctl_softc->ctl_lock, MA_NOTOWNED); p = initidx / CTL_MAX_INIT_PER_PORT; if ((ua = lun->pending_ua[p]) == NULL) { mtx_unlock(&lun->lun_lock); @@ -547,6 +548,17 @@ ctl_build_ua(struct ctl_lun *lun, uint32 /* We're reporting this UA, so clear it */ ua[i] &= ~ua_to_clear; + if (ua_to_build == CTL_UA_LUN_CHANGE) { + mtx_unlock(&lun->lun_lock); + mtx_lock(&lun->ctl_softc->ctl_lock); + ctl_clr_ua_allluns(lun->ctl_softc, initidx, ua_to_build); + mtx_unlock(&lun->ctl_softc->ctl_lock); + mtx_lock(&lun->lun_lock); + } else if (ua_to_build == CTL_UA_THIN_PROV_THRES && + (lun->MODE_LBP.main.flags & SLBPP_SITUA) != 0) { + ctl_clr_ua_all(lun, -1, ua_to_build); + } + return (ua_to_build); } Modified: head/sys/cam/ctl/ctl_private.h ============================================================================== --- head/sys/cam/ctl/ctl_private.h Wed Dec 21 14:06:44 2016 (r310365) +++ head/sys/cam/ctl/ctl_private.h Wed Dec 21 15:17:47 2016 (r310366) @@ -290,7 +290,7 @@ static const struct ctl_page_index page_ CTL_PAGE_FLAG_ALL, NULL, ctl_ie_page_handler}, {SMS_INFO_EXCEPTIONS_PAGE | SMPH_SPF, 0x02, sizeof(struct ctl_logical_block_provisioning_page), NULL, - CTL_PAGE_FLAG_DIRECT, NULL, NULL}, + CTL_PAGE_FLAG_DIRECT, NULL, ctl_default_page_handler}, {SMS_CDDVD_CAPS_PAGE, 0, sizeof(struct scsi_cddvd_capabilities_page), NULL, CTL_PAGE_FLAG_CDROM, NULL, NULL}, From owner-svn-src-all@freebsd.org Wed Dec 21 15:27:00 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 453CDC8AF9E; Wed, 21 Dec 2016 15:27:00 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 14EBE1CA7; Wed, 21 Dec 2016 15:27:00 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBLFQxbk016213; Wed, 21 Dec 2016 15:26:59 GMT (envelope-from pfg@FreeBSD.org) Received: (from pfg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBLFQxca016212; Wed, 21 Dec 2016 15:26:59 GMT (envelope-from pfg@FreeBSD.org) Message-Id: <201612211526.uBLFQxca016212@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: pfg set sender to pfg@FreeBSD.org using -f From: "Pedro F. Giffuni" Date: Wed, 21 Dec 2016 15:26:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310367 - head/bin/pax X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Dec 2016 15:27:00 -0000 Author: pfg Date: Wed Dec 21 15:26:59 2016 New Revision: 310367 URL: https://svnweb.freebsd.org/changeset/base/310367 Log: pax(1): Fix a bug with archives smaller than 512 bytes. The problem here is that the archive is too short (< 512 bytes). The buffer routines, try to read at least 512 bytes, even when we try to determine what format file we have, which is wrong. Obtained from: NetBSD (CVS rev 1.26) MFC after: 5 days Modified: head/bin/pax/buf_subs.c Modified: head/bin/pax/buf_subs.c ============================================================================== --- head/bin/pax/buf_subs.c Wed Dec 21 15:17:47 2016 (r310366) +++ head/bin/pax/buf_subs.c Wed Dec 21 15:26:59 2016 (r310367) @@ -852,10 +852,13 @@ buf_fill(void) /* * errors require resync, EOF goes to next archive + * but in case we have not determined yet the format, + * this means that we have a very short file, so we + * are done again. */ if (cnt < 0) break; - if (ar_next() < 0) { + if (frmt == NULL || ar_next() < 0) { fini = 1; return(0); } From owner-svn-src-all@freebsd.org Wed Dec 21 15:38:29 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 46A26C8A2E2; Wed, 21 Dec 2016 15:38:29 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 15CF1127E; Wed, 21 Dec 2016 15:38:29 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBLFcSJF020405; Wed, 21 Dec 2016 15:38:28 GMT (envelope-from pfg@FreeBSD.org) Received: (from pfg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBLFcSNc020404; Wed, 21 Dec 2016 15:38:28 GMT (envelope-from pfg@FreeBSD.org) Message-Id: <201612211538.uBLFcSNc020404@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: pfg set sender to pfg@FreeBSD.org using -f From: "Pedro F. Giffuni" Date: Wed, 21 Dec 2016 15:38:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r310368 - stable/11/contrib/binutils/bfd X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Dec 2016 15:38:29 -0000 Author: pfg Date: Wed Dec 21 15:38:28 2016 New Revision: 310368 URL: https://svnweb.freebsd.org/changeset/base/310368 Log: MFC r310132: libbfd: make sure variables are initialized before using them. Initialize l_sec_contents to make sure that free(l_sec_contents) is called on valid pointers. Obtained from: OpenBSD (partial CVS rev 1.18) Modified: stable/11/contrib/binutils/bfd/elflink.c Directory Properties: stable/11/ (props changed) Modified: stable/11/contrib/binutils/bfd/elflink.c ============================================================================== --- stable/11/contrib/binutils/bfd/elflink.c Wed Dec 21 15:26:59 2016 (r310367) +++ stable/11/contrib/binutils/bfd/elflink.c Wed Dec 21 15:38:28 2016 (r310368) @@ -11487,7 +11487,7 @@ _bfd_elf_section_already_linked (bfd *ab abfd, sec); else if (sec->size != 0) { - bfd_byte *sec_contents, *l_sec_contents; + bfd_byte *sec_contents, *l_sec_contents = NULL; if (!bfd_malloc_and_get_section (abfd, sec, &sec_contents)) (*_bfd_error_handler) From owner-svn-src-all@freebsd.org Wed Dec 21 15:39:17 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7FA42C8A38E; Wed, 21 Dec 2016 15:39:17 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4EB95150C; Wed, 21 Dec 2016 15:39:17 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBLFdGfH020492; Wed, 21 Dec 2016 15:39:16 GMT (envelope-from pfg@FreeBSD.org) Received: (from pfg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBLFdGoW020491; Wed, 21 Dec 2016 15:39:16 GMT (envelope-from pfg@FreeBSD.org) Message-Id: <201612211539.uBLFdGoW020491@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: pfg set sender to pfg@FreeBSD.org using -f From: "Pedro F. Giffuni" Date: Wed, 21 Dec 2016 15:39:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r310369 - stable/10/contrib/binutils/bfd X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Dec 2016 15:39:17 -0000 Author: pfg Date: Wed Dec 21 15:39:16 2016 New Revision: 310369 URL: https://svnweb.freebsd.org/changeset/base/310369 Log: MFC r310132: libbfd: make sure variables are initialized before using them. Initialize l_sec_contents to make sure that free(l_sec_contents) is called on valid pointers. Obtained from: OpenBSD (partial CVS rev 1.18) Modified: stable/10/contrib/binutils/bfd/elflink.c Directory Properties: stable/10/ (props changed) Modified: stable/10/contrib/binutils/bfd/elflink.c ============================================================================== --- stable/10/contrib/binutils/bfd/elflink.c Wed Dec 21 15:38:28 2016 (r310368) +++ stable/10/contrib/binutils/bfd/elflink.c Wed Dec 21 15:39:16 2016 (r310369) @@ -11487,7 +11487,7 @@ _bfd_elf_section_already_linked (bfd *ab abfd, sec); else if (sec->size != 0) { - bfd_byte *sec_contents, *l_sec_contents; + bfd_byte *sec_contents, *l_sec_contents = NULL; if (!bfd_malloc_and_get_section (abfd, sec, &sec_contents)) (*_bfd_error_handler) From owner-svn-src-all@freebsd.org Wed Dec 21 15:40:17 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6E609C8A47A; Wed, 21 Dec 2016 15:40:17 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 3DA7F169C; Wed, 21 Dec 2016 15:40:17 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBLFeG4J020785; Wed, 21 Dec 2016 15:40:16 GMT (envelope-from pfg@FreeBSD.org) Received: (from pfg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBLFeGCV020784; Wed, 21 Dec 2016 15:40:16 GMT (envelope-from pfg@FreeBSD.org) Message-Id: <201612211540.uBLFeGCV020784@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: pfg set sender to pfg@FreeBSD.org using -f From: "Pedro F. Giffuni" Date: Wed, 21 Dec 2016 15:40:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r310370 - stable/9/contrib/binutils/bfd X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Dec 2016 15:40:17 -0000 Author: pfg Date: Wed Dec 21 15:40:16 2016 New Revision: 310370 URL: https://svnweb.freebsd.org/changeset/base/310370 Log: MFC r310132: libbfd: make sure variables are initialized before using them. Initialize l_sec_contents to make sure that free(l_sec_contents) is called on valid pointers. Obtained from: OpenBSD (partial CVS rev 1.18) Modified: stable/9/contrib/binutils/bfd/elflink.c Directory Properties: stable/9/contrib/binutils/ (props changed) Modified: stable/9/contrib/binutils/bfd/elflink.c ============================================================================== --- stable/9/contrib/binutils/bfd/elflink.c Wed Dec 21 15:39:16 2016 (r310369) +++ stable/9/contrib/binutils/bfd/elflink.c Wed Dec 21 15:40:16 2016 (r310370) @@ -11487,7 +11487,7 @@ _bfd_elf_section_already_linked (bfd *ab abfd, sec); else if (sec->size != 0) { - bfd_byte *sec_contents, *l_sec_contents; + bfd_byte *sec_contents, *l_sec_contents = NULL; if (!bfd_malloc_and_get_section (abfd, sec, &sec_contents)) (*_bfd_error_handler) From owner-svn-src-all@freebsd.org Wed Dec 21 15:45:24 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B13CFC8A68D; Wed, 21 Dec 2016 15:45:24 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 757DA1BD3; Wed, 21 Dec 2016 15:45:24 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBLFjNMj024758; Wed, 21 Dec 2016 15:45:23 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBLFjNgp024757; Wed, 21 Dec 2016 15:45:23 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201612211545.uBLFjNgp024757@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Wed, 21 Dec 2016 15:45:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310371 - head/sys/dev/bhnd/tools X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Dec 2016 15:45:24 -0000 Author: emaste Date: Wed Dec 21 15:45:23 2016 New Revision: 310371 URL: https://svnweb.freebsd.org/changeset/base/310371 Log: bhnd: remove srand() to ensure deterministic output r310342 fixed non-deterministic nvram_map_gen.awk output and thus a non- reproducible bhnd(4) build by using a unique sort key. Go one step further and also remove the srand() call. There's no reason we want non-deterministic behaviour from this script. PR: 215422 Reported by: gjb (non-reproducibility of bhnd) Reported by: lidl (srand as the cause) Reviewed by: landonf Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D8857 Modified: head/sys/dev/bhnd/tools/nvram_map_gen.awk Modified: head/sys/dev/bhnd/tools/nvram_map_gen.awk ============================================================================== --- head/sys/dev/bhnd/tools/nvram_map_gen.awk Wed Dec 21 15:40:16 2016 (r310370) +++ head/sys/dev/bhnd/tools/nvram_map_gen.awk Wed Dec 21 15:45:23 2016 (r310371) @@ -52,9 +52,6 @@ function main(_i) { AWK_REQ_HEX_PARSING=1 } - # Seed rand() - srand() - # Output type OUT_T = null OUT_T_HEADER = "HEADER" From owner-svn-src-all@freebsd.org Wed Dec 21 16:04:22 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E1C02C8AEDA; Wed, 21 Dec 2016 16:04:22 +0000 (UTC) (envelope-from rb743@hermes.cam.ac.uk) Received: from ppsw-43.csi.cam.ac.uk (ppsw-43.csi.cam.ac.uk [131.111.8.143]) by mx1.freebsd.org (Postfix) with ESMTP id AD3EE18FF; Wed, 21 Dec 2016 16:04:22 +0000 (UTC) (envelope-from rb743@hermes.cam.ac.uk) X-Cam-AntiVirus: no malware found X-Cam-ScannerInfo: http://help.uis.cam.ac.uk/email-scanner-virus Received: from sc1.bsdpad.com ([163.172.212.18]:16575) by ppsw-43.csi.cam.ac.uk (smtp.hermes.cam.ac.uk [131.111.8.159]:587) with esmtpsa (LOGIN:rb743) (TLSv1:ECDHE-RSA-AES256-SHA:256) id 1cJjNH-000328-mT (Exim 4.86_36-e07b163) (return-path ); Wed, 21 Dec 2016 16:04:15 +0000 Date: Wed, 21 Dec 2016 16:02:53 +0000 From: Ruslan Bukin To: John Baldwin Cc: Ruslan Bukin , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r310330 - in head: share/man/man4 sys/conf sys/dev/xdma Message-ID: <20161221160253.GA4455@bsdpad.com> References: <201612201802.uBKI27oN091165@repo.freebsd.org> <1904181.V85ZRTRTAB@ralph.baldwin.cx> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <1904181.V85ZRTRTAB@ralph.baldwin.cx> User-Agent: Mutt/1.6.1 (2016-04-27) Sender: "R. Bukin" X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Dec 2016 16:04:23 -0000 On Tue, Dec 20, 2016 at 12:50:11PM -0800, John Baldwin wrote: > On Tuesday, December 20, 2016 06:02:07 PM Ruslan Bukin wrote: > > Author: br > > Date: Tue Dec 20 18:02:07 2016 > > New Revision: 310330 > > URL: https://svnweb.freebsd.org/changeset/base/310330 > > > > Log: > > Add xDMA -- the DMA abstraction layer, initial verison. > > > > xDMA is a DMA framework designed to abstract the interaction > > between device drivers and DMA engines. > > > > Project wiki: https://wiki.freebsd.org/xdma > > > > Sponsored by: DARPA, AFRL > > Differential Revision: https://reviews.freebsd.org/D8807 > > It probably would have been a good idea to get some design review of this on > arch@ before committing. In particular, I believe from earlier discussions > that you want to build a general framework that things like ioat(4) can hook > into. arch@ would give you a broader audience for working out the > abstractions and interfaces. > Yep, you probably right. I found lack of interest from the list of reviewers I added on phabricator, so decided to go, but may be list was not 100% pervasive. Anyway it is just 673 lines of code and I continue working on it. I plan to add scatter-gathering type of transfer and SoftDMA(®) driver, so any review of this or upcoming changes would be appreciated. Ruslan From owner-svn-src-all@freebsd.org Wed Dec 21 17:32:08 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D2439C8A745; Wed, 21 Dec 2016 17:32:08 +0000 (UTC) (envelope-from adrian.chadd@gmail.com) Received: from mail-wj0-x22b.google.com (mail-wj0-x22b.google.com [IPv6:2a00:1450:400c:c01::22b]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 7B9A11324; Wed, 21 Dec 2016 17:32:08 +0000 (UTC) (envelope-from adrian.chadd@gmail.com) Received: by mail-wj0-x22b.google.com with SMTP id xy5so208075321wjc.0; Wed, 21 Dec 2016 09:32:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=SgPdBKpVTOKs72eaqztjUX7CoJfIYmIIFBR/xGw7QFM=; b=nCZVXyRwFOQBO+1p4IPnszJCr4MgsP1NuzivwRtgW4DTVgor5TGWDkLnzuljaE3gh6 rUj6cMaIAyqkdo5etgG2410MdOqxBNG6cp2lx8SCtWDj/UEQATcXtt110SHFE3laRtMn t1u07fLOz/tijCXmi3rnvELLE7g44t8ay3ph1pr4KHjfP20zvKzQNxlfbmVKs16K8eXo kEQ0NIdfwR/wqvrFMJuIuqRThLlg+ii51uFuKvTtJ2DfnkQhUOq9eod0a1otV50FXg2v GrDORDEtRraP96tYbsHPMUcPrfzOa1DXHn6nbVgTlOwZOKe/RVA+VuDpd8/GITOR4/Kz cYCQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=SgPdBKpVTOKs72eaqztjUX7CoJfIYmIIFBR/xGw7QFM=; b=Ux/UlsJttYxEtTQb3RbRS/38gL1wENV0Jfq7g3tjEjmV3FCh5XR61iO5qQTyoRl/5T Zz2DhhUHxtaoaP9tLCmT+/QnxNgOP4aLgNzwMeHvfxnnLVHENb4JPqFskxJJEoXirIYU tNPETgU1CDdxGUZ/8m0ImVXCfYEwJvB4dxvVkA8RaWdzvfDGavNf3tw80xPZBO3/BX3F BHGRIvODIKH3r+F2T/XjRKIhGe5N9qf6kuH9utGMtVtBommLuiH+73xXF116gdwD8bFT M5x5m/TLhULSJRpbLImtcb1UrZmig5Ynw4EllN1f4h60O2j17zlBBm/D/cVt3T/UuOmE 40aQ== X-Gm-Message-State: AIkVDXK7gf3l6s6gzPiLs4FJFfPR6xc+NLCF6Q3cTUCQnjZ3wtDoSIWoRQd+TG6wfXjsGbe+dNCzvSvs4Xo7dw== X-Received: by 10.194.205.34 with SMTP id ld2mr5339983wjc.211.1482341525673; Wed, 21 Dec 2016 09:32:05 -0800 (PST) MIME-Version: 1.0 Received: by 10.194.44.1 with HTTP; Wed, 21 Dec 2016 09:32:05 -0800 (PST) In-Reply-To: <201612210829.uBL8Tijt041811@repo.freebsd.org> References: <201612210829.uBL8Tijt041811@repo.freebsd.org> From: Adrian Chadd Date: Wed, 21 Dec 2016 09:32:05 -0800 Message-ID: Subject: Re: svn commit: r310354 - in head/usr.sbin: . prometheus_sysctl_exporter To: Ed Schouten Cc: "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" Content-Type: text/plain; charset=UTF-8 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Dec 2016 17:32:08 -0000 heh, in an ideal world we'd not call this "prometheus", it'd just be the way we export sysctl data via 'sysctl' in a machine parsable format. Ok, since it's HTTP/gzip, maybe a separate standalone program is cool, but it doesn't have to be specific to prometheus. :-) That way anyone wanting to write a plugin for consuming freebsd data can just use this program as the API contract. Maybe just "sysctl_export" would be fine. I'd like to encourage other consumers to use it, including existing ones that currently do all the silly hijinx. :) What do you think? -adrian On 21 December 2016 at 00:29, Ed Schouten wrote: > Author: ed > Date: Wed Dec 21 08:29:44 2016 > New Revision: 310354 > URL: https://svnweb.freebsd.org/changeset/base/310354 > > Log: > Add a Prometheus exporter for sysctl values. > > Now that we have our sysctl tree annotated with aggregation labels, > let's go ahead and provide a very simple utility for exporting the > sysctl tree in Prometheus' format. It can either be used in conjunction > with the Prometheus node exporter or run through inetd(8). > > The reason why I'm opting for having it in the base system is because it > has a pretty strong integration with some of sysctl's innards, such as > access to iterators, name lookups, metadata and type information. As I > am investigating whether we can add histograms as native types to sysctl > as well, this integration will only get stronger as we go along. That's > why it would be safer to oversee the development of this exporter > ourselves, as opposed to having it as an external project. > > This exporter is remarkably compact, especially when compared to the > official Linux binary of the Prometheus node exporter (16 KB vs 12 MB). > I guess this could be an interesting aspect for monitoring embedded > FreeBSD-based systems. > > Differential Revision: https://reviews.freebsd.org/D8792 > > Added: > head/usr.sbin/prometheus_sysctl_exporter/ > head/usr.sbin/prometheus_sysctl_exporter/Makefile (contents, props changed) > head/usr.sbin/prometheus_sysctl_exporter/prometheus_sysctl_exporter.8 (contents, props changed) > head/usr.sbin/prometheus_sysctl_exporter/prometheus_sysctl_exporter.c (contents, props changed) > Modified: > head/usr.sbin/Makefile > > Modified: head/usr.sbin/Makefile > ============================================================================== > --- head/usr.sbin/Makefile Wed Dec 21 07:26:04 2016 (r310353) > +++ head/usr.sbin/Makefile Wed Dec 21 08:29:44 2016 (r310354) > @@ -62,6 +62,7 @@ SUBDIR= adduser \ > periodic \ > powerd \ > procctl \ > + prometheus_sysctl_exporter \ > pstat \ > pw \ > pwd_mkdb \ > > Added: head/usr.sbin/prometheus_sysctl_exporter/Makefile > ============================================================================== > --- /dev/null 00:00:00 1970 (empty, because file is newly added) > +++ head/usr.sbin/prometheus_sysctl_exporter/Makefile Wed Dec 21 08:29:44 2016 (r310354) > @@ -0,0 +1,8 @@ > +# $FreeBSD$ > + > +PROG= prometheus_sysctl_exporter > +MAN= prometheus_sysctl_exporter.8 > + > +LIBADD= m z > + > +.include > > Added: head/usr.sbin/prometheus_sysctl_exporter/prometheus_sysctl_exporter.8 > ============================================================================== > --- /dev/null 00:00:00 1970 (empty, because file is newly added) > +++ head/usr.sbin/prometheus_sysctl_exporter/prometheus_sysctl_exporter.8 Wed Dec 21 08:29:44 2016 (r310354) > @@ -0,0 +1,106 @@ > +.\" Copyright (c) 2016 Nuxi, https://nuxi.nl/ > +.\" > +.\" 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 December 18, 2016 > +.Dt PROMETHEUS_SYSCTL_EXPORTER 8 > +.Os > +.Sh NAME > +.Nm prometheus_sysctl_exporter > +.Nd print kernel state as Prometheus metrics > +.Sh SYNOPSIS > +.Nm prometheus_sysctl_exporter > +.Op Fl dgh > +.Op Ar prefix ... > +.Sh DESCRIPTION > +Prometheus is a monitoring system that gathers metrics from its targets > +by fetching them through HTTP GET requests. > +Metrics are identified by a name and an optional set of labels. > +Sample values are required to be numerical. > +.Pp > +The > +.Nm > +utility prints the values of sysctl nodes to standard output, > +formatted such that they can be scraped by Prometheus directly. > +By default, > +it prints metrics for all numerically representable nodes in the sysctl > +namespace. > +It is also possible to limit output to a smaller number of metrics by > +specifying one or more prefixes as arguments. > +.Pp > +Metrics printed by this utility are named > +.Ql sysctl_ , > +followed by the name of the sysctl node having its > +.Ql .\& > +separators replaced by > +.Ql _ . > +Components on which it is desirable to aggregate (e.g., > +names of devices) are omitted from the metric's name, > +but are appended as labels instead. > +.Pp > +There are two different methods for exporting the output of > +.Nm > +to Prometheus. > +The first method is to periodically invoke this utility through > +.Xr cron 8 > +and store its output in a textfile. > +The metrics in this textfile can then be served over HTTP using the > +Prometheus node exporter's textfile collector. > +The second method is to run this utility through > +.Xr inetd 8 . > +TCP port 9124 has been allocated for this purpose. > +.Pp > +The following options are available: > +.Bl -tag -width indent > +.It Fl d > +Print descriptions of metrics when available. > +.It Fl g > +Gzip compresses the HTTP response body. > +.It Fl h > +Precede the output with a HTTP response header. > +This flag is required when running this utility through > +.Xr inetd 8 . > +.El > +.Sh SEE ALSO > +.Xr cron 8 , > +.Xr inetd 8 , > +.Xr sysctl 8 , > +.Xr SYSCTL_ADD_NODE_WITH_LABEL 9 > +.Pp > +Prometheus project: > +.Pa https://prometheus.io/ . > +.Pp > +Prometheus exposition formats: > +.Pa https://prometheus.io/docs/instrumenting/exposition_formats/ . > +.Pp > +Prometheus node exporter: > +.Pa https://github.com/prometheus/node_exporter . > +.Pp > +Prometheus default port allocations: > +.Pa https://github.com/prometheus/prometheus/wiki/Default-port-allocations . > +.Sh HISTORY > +.Nm > +first appeared in > +.Fx 12.0 . > +.Sh AUTHORS > +.An Nuxi : Pa https://nuxi.nl/ . > > Added: head/usr.sbin/prometheus_sysctl_exporter/prometheus_sysctl_exporter.c > ============================================================================== > --- /dev/null 00:00:00 1970 (empty, because file is newly added) > +++ head/usr.sbin/prometheus_sysctl_exporter/prometheus_sysctl_exporter.c Wed Dec 21 08:29:44 2016 (r310354) > @@ -0,0 +1,652 @@ > +/*- > + * Copyright (c) 2016 Nuxi, https://nuxi.nl/ > + * > + * 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. > + */ > + > +#include > +__FBSDID("$FreeBSD$"); > + > +#include > +#include > +#include > +#include > + > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > + > +/* > + * Cursor for iterating over all of the system's sysctl OIDs. > + */ > +struct oid { > + int id[CTL_MAXNAME]; > + size_t len; > +}; > + > +/* Initializes the cursor to point to start of the tree. */ > +static void > +oid_get_root(struct oid *o) > +{ > + > + o->id[0] = 1; > + o->len = 1; > +} > + > +/* Obtains the OID for a sysctl by name. */ > +static void > +oid_get_by_name(struct oid *o, const char *name) > +{ > + > + o->len = nitems(o->id); > + if (sysctlnametomib(name, o->id, &o->len) != 0) > + err(1, "sysctl(%s)", name); > +} > + > +/* Returns whether an OID is placed below another OID. */ > +static bool > +oid_is_beneath(struct oid *oa, struct oid *ob) > +{ > + > + return (oa->len >= ob->len && > + memcmp(oa->id, ob->id, ob->len * sizeof(oa->id[0])) == 0); > +} > + > +/* Advances the cursor to the next OID. */ > +static bool > +oid_get_next(const struct oid *cur, struct oid *next) > +{ > + int lookup[CTL_MAXNAME + 2]; > + size_t nextsize; > + > + lookup[0] = 0; > + lookup[1] = 2; > + memcpy(lookup + 2, cur->id, cur->len * sizeof(lookup[0])); > + nextsize = sizeof(next->id); > + if (sysctl(lookup, 2 + cur->len, &next->id, &nextsize, 0, 0) != 0) { > + if (errno == ENOENT) > + return (false); > + err(1, "sysctl(next)"); > + } > + next->len = nextsize / sizeof(next->id[0]); > + return (true); > +} > + > +/* > + * OID formatting metadata. > + */ > +struct oidformat { > + unsigned int kind; > + char format[BUFSIZ]; > +}; > + > +/* Returns whether the OID represents a temperature value. */ > +static bool > +oidformat_is_temperature(const struct oidformat *of) > +{ > + > + return (of->format[0] == 'I' && of->format[1] == 'K'); > +} > + > +/* Returns whether the OID represents a timeval structure. */ > +static bool > +oidformat_is_timeval(const struct oidformat *of) > +{ > + > + return (strcmp(of->format, "S,timeval") == 0); > +} > + > +/* Fetches the formatting metadata for an OID. */ > +static bool > +oid_get_format(const struct oid *o, struct oidformat *of) > +{ > + int lookup[CTL_MAXNAME + 2]; > + size_t oflen; > + > + lookup[0] = 0; > + lookup[1] = 4; > + memcpy(lookup + 2, o->id, o->len * sizeof(lookup[0])); > + oflen = sizeof(*of); > + if (sysctl(lookup, 2 + o->len, of, &oflen, 0, 0) != 0) { > + if (errno == ENOENT) > + return (false); > + err(1, "sysctl(oidfmt)"); > + } > + return (true); > +} > + > +/* > + * Container for holding the value of an OID. > + */ > +struct oidvalue { > + enum { SIGNED, UNSIGNED, FLOAT } type; > + union { > + intmax_t s; > + uintmax_t u; > + double f; > + } value; > +}; > + > +/* Extracts the value of an OID, converting it to a floating-point number. */ > +static double > +oidvalue_get_float(const struct oidvalue *ov) > +{ > + > + switch (ov->type) { > + case SIGNED: > + return (ov->value.s); > + case UNSIGNED: > + return (ov->value.u); > + case FLOAT: > + return (ov->value.f); > + default: > + assert(0 && "Unknown value type"); > + } > +} > + > +/* Sets the value of an OID as a signed integer. */ > +static void > +oidvalue_set_signed(struct oidvalue *ov, intmax_t s) > +{ > + > + ov->type = SIGNED; > + ov->value.s = s; > +} > + > +/* Sets the value of an OID as an unsigned integer. */ > +static void > +oidvalue_set_unsigned(struct oidvalue *ov, uintmax_t u) > +{ > + > + ov->type = UNSIGNED; > + ov->value.u = u; > +} > + > +/* Sets the value of an OID as a floating-point number. */ > +static void > +oidvalue_set_float(struct oidvalue *ov, double f) > +{ > + > + ov->type = FLOAT; > + ov->value.f = f; > +} > + > +/* Prints the value of an OID to a file stream. */ > +static void > +oidvalue_print(const struct oidvalue *ov, FILE *fp) > +{ > + > + switch (ov->type) { > + case SIGNED: > + fprintf(fp, "%jd", ov->value.s); > + break; > + case UNSIGNED: > + fprintf(fp, "%ju", ov->value.u); > + break; > + case FLOAT: > + switch (fpclassify(ov->value.f)) { > + case FP_INFINITE: > + if (signbit(ov->value.f)) > + fprintf(fp, "-Inf"); > + else > + fprintf(fp, "+Inf"); > + break; > + case FP_NAN: > + fprintf(fp, "Nan"); > + break; > + default: > + fprintf(fp, "%.6f", ov->value.f); > + break; > + } > + break; > + } > +} > + > +/* Fetches the value of an OID. */ > +static bool > +oid_get_value(const struct oid *o, const struct oidformat *of, > + struct oidvalue *ov) > +{ > + > + switch (of->kind & CTLTYPE) { > +#define GET_VALUE(ctltype, type) \ > + case (ctltype): { \ > + type value; \ > + size_t valuesize; \ > + \ > + valuesize = sizeof(value); \ > + if (sysctl(o->id, o->len, &value, &valuesize, 0, 0) != 0) \ > + return (false); \ > + if ((type)-1 > 0) \ > + oidvalue_set_unsigned(ov, value); \ > + else \ > + oidvalue_set_signed(ov, value); \ > + break; \ > + } > + GET_VALUE(CTLTYPE_INT, int); > + GET_VALUE(CTLTYPE_UINT, unsigned int); > + GET_VALUE(CTLTYPE_LONG, long); > + GET_VALUE(CTLTYPE_ULONG, unsigned long); > + GET_VALUE(CTLTYPE_S8, int8_t); > + GET_VALUE(CTLTYPE_U8, uint8_t); > + GET_VALUE(CTLTYPE_S16, int16_t); > + GET_VALUE(CTLTYPE_U16, uint16_t); > + GET_VALUE(CTLTYPE_S32, int32_t); > + GET_VALUE(CTLTYPE_U32, uint32_t); > + GET_VALUE(CTLTYPE_S64, int64_t); > + GET_VALUE(CTLTYPE_U64, uint64_t); > +#undef GET_VALUE > + case CTLTYPE_OPAQUE: > + if (oidformat_is_timeval(of)) { > + struct timeval tv; > + size_t tvsize; > + > + tvsize = sizeof(tv); > + if (sysctl(o->id, o->len, &tv, &tvsize, 0, 0) != 0) > + return (false); > + oidvalue_set_float(ov, > + (double)tv.tv_sec + (double)tv.tv_usec / 1000000); > + return (true); > + } else if (strcmp(of->format, "S,loadavg") == 0) { > + struct loadavg la; > + size_t lasize; > + > + /* > + * Only return the one minute load average, as > + * the others can be inferred using avg_over_time(). > + */ > + lasize = sizeof(la); > + if (sysctl(o->id, o->len, &la, &lasize, 0, 0) != 0) > + return (false); > + oidvalue_set_float(ov, > + (double)la.ldavg[0] / (double)la.fscale); > + return (true); > + } > + return (false); > + default: > + return (false); > + } > + > + /* Convert temperatures from decikelvin to degrees Celcius. */ > + if (oidformat_is_temperature(of)) { > + double v; > + int e; > + > + v = oidvalue_get_float(ov); > + if (v < 0) { > + oidvalue_set_float(ov, NAN); > + } else { > + e = of->format[2] >= '0' && of->format[2] <= '9' ? > + of->format[2] - '0' : 1; > + oidvalue_set_float(ov, v / pow(10, e) - 273.15); > + } > + } > + return (true); > +} > + > +/* > + * The full name of an OID, stored as a series of components. > + */ > +struct oidname { > + struct oid oid; > + char names[BUFSIZ]; > + char labels[BUFSIZ]; > +}; > + > +/* > + * Initializes the OID name object with an empty value. > + */ > +static void > +oidname_init(struct oidname *on) > +{ > + > + on->oid.len = 0; > +} > + > +/* Fetches the name and labels of an OID, reusing the previous results. */ > +static void > +oid_get_name(const struct oid *o, struct oidname *on) > +{ > + int lookup[CTL_MAXNAME + 2]; > + char *c, *label; > + size_t i, len; > + > + /* Fetch the name and split it up in separate components. */ > + lookup[0] = 0; > + lookup[1] = 1; > + memcpy(lookup + 2, o->id, o->len * sizeof(lookup[0])); > + len = sizeof(on->names); > + if (sysctl(lookup, 2 + o->len, on->names, &len, 0, 0) != 0) > + err(1, "sysctl(name)"); > + for (c = strchr(on->names, '.'); c != NULL; c = strchr(c + 1, '.')) > + *c = '\0'; > + > + /* No need to fetch labels for components that we already have. */ > + label = on->labels; > + for (i = 0; i < o->len && i < on->oid.len && o->id[i] == on->oid.id[i]; > + ++i) > + label += strlen(label) + 1; > + > + /* Fetch the remaining labels. */ > + lookup[1] = 6; > + for (; i < o->len; ++i) { > + len = on->labels + sizeof(on->labels) - label; > + if (sysctl(lookup, 2 + i + 1, label, &len, 0, 0) == 0) { > + label += len; > + } else if (errno == ENOENT) { > + *label++ = '\0'; > + } else { > + err(1, "sysctl(oidlabel)"); > + } > + } > + on->oid = *o; > +} > + > +/* Prints the name and labels of an OID to a file stream. */ > +static void > +oidname_print(const struct oidname *on, const struct oidformat *of, > + FILE *fp) > +{ > + const char *name, *label; > + size_t i; > + char separator; > + > + /* Print the name of the metric. */ > + fprintf(fp, "sysctl"); > + name = on->names; > + label = on->labels; > + for (i = 0; i < on->oid.len; ++i) { > + if (*label == '\0') { > + assert(name[strspn(name, > + "abcdefghijklmnopqrstuvwxyz" > + "ABCDEFGHIJKLMNOPQRSTUVWXYZ" > + "0123456789_")] == '\0'); > + fprintf(fp, "_%s", name); > + } > + name += strlen(name) + 1; > + label += strlen(label) + 1; > + } > + if (oidformat_is_temperature(of)) > + fprintf(fp, "_celcius"); > + else if (oidformat_is_timeval(of)) > + fprintf(fp, "_seconds"); > + > + /* Print the labels of the metric. */ > + name = on->names; > + label = on->labels; > + separator = '{'; > + for (i = 0; i < on->oid.len; ++i) { > + if (*label != '\0') { > + assert(name[strspn(name, > + "abcdefghijklmnopqrstuvwxyz" > + "ABCDEFGHIJKLMNOPQRSTUVWXYZ" > + "0123456789_-")] == '\0'); > + assert(label[strspn(label, > + "abcdefghijklmnopqrstuvwxyz" > + "ABCDEFGHIJKLMNOPQRSTUVWXYZ" > + "0123456789_")] == '\0'); > + fprintf(fp, "%c%s=\"%s\"", separator, label, name); > + separator = ','; > + } > + name += strlen(name) + 1; > + label += strlen(label) + 1; > + } > + if (separator != '{') > + fputc('}', fp); > +} > + > +/* Returns whether the OID name has any labels associated to it. */ > +static bool > +oidname_has_labels(const struct oidname *on) > +{ > + size_t i; > + > + for (i = 0; i < on->oid.len; ++i) > + if (on->labels[i] != 0) > + return (true); > + return (false); > +} > + > +/* > + * The description of an OID. > + */ > +struct oiddescription { > + char description[BUFSIZ]; > +}; > + > +/* > + * Fetches the description of an OID. > + */ > +static bool > +oid_get_description(const struct oid *o, struct oiddescription *od) > +{ > + int lookup[CTL_MAXNAME + 2]; > + char *newline; > + size_t odlen; > + > + lookup[0] = 0; > + lookup[1] = 5; > + memcpy(lookup + 2, o->id, o->len * sizeof(lookup[0])); > + odlen = sizeof(od->description); > + if (sysctl(lookup, 2 + o->len, &od->description, &odlen, 0, 0) != 0) { > + if (errno == ENOENT) > + return (false); > + err(1, "sysctl(oiddescr)"); > + } > + > + newline = strchr(od->description, '\n'); > + if (newline != NULL) > + *newline = '\0'; > + > + return (*od->description != '\0'); > +} > + > +/* Prints the description of an OID to a file stream. */ > +static void > +oiddescription_print(const struct oiddescription *od, FILE *fp) > +{ > + > + fprintf(fp, "%s", od->description); > +} > + > +static void > +oid_print(const struct oid *o, struct oidname *on, bool print_description, > + FILE *fp) > +{ > + struct oidformat of; > + struct oidvalue ov; > + struct oiddescription od; > + > + if (!oid_get_format(o, &of) || !oid_get_value(o, &of, &ov)) > + return; > + oid_get_name(o, on); > + > + /* > + * Print the line with the description. Prometheus expects a > + * single unique description for every metric, which cannot be > + * guaranteed by sysctl if labels are present. Omit the > + * description if labels are present. > + */ > + if (print_description && !oidname_has_labels(on) && > + oid_get_description(o, &od)) { > + fprintf(fp, "# HELP "); > + oidname_print(on, &of, fp); > + fputc(' ', fp); > + oiddescription_print(&od, fp); > + fputc('\n', fp); > + } > + > + /* Print the line with the value. */ > + oidname_print(on, &of, fp); > + fputc(' ', fp); > + oidvalue_print(&ov, fp); > + fputc('\n', fp); > +} > + > +/* Gzip compresses a buffer of memory. */ > +static bool > +buf_gzip(const char *in, size_t inlen, char *out, size_t *outlen) > +{ > + z_stream stream = { > + .next_in = __DECONST(unsigned char *, in), > + .avail_in = inlen, > + .next_out = (unsigned char *)out, > + .avail_out = *outlen, > + }; > + > + if (deflateInit2(&stream, Z_DEFAULT_COMPRESSION, Z_DEFLATED, > + MAX_WBITS + 16, 8, Z_DEFAULT_STRATEGY) != Z_OK || > + deflate(&stream, Z_FINISH) != Z_STREAM_END) { > + return (false); > + } > + *outlen = stream.total_out; > + return (deflateEnd(&stream) == Z_OK); > +} > + > +static void > +usage(void) > +{ > + > + fprintf(stderr, > + "usage: prometheus_sysctl_exporter [-dgh] [prefix ...]\n"); > + exit(1); > +} > + > +int > +main(int argc, char *argv[]) > +{ > + struct oidname on; > + char *http_buf; > + FILE *fp; > + size_t http_buflen; > + int ch; > + bool gzip_mode, http_mode, print_descriptions; > + > + /* Parse command line flags. */ > + gzip_mode = http_mode = print_descriptions = false; > + while ((ch = getopt(argc, argv, "dgh")) != -1) { > + switch (ch) { > + case 'd': > + print_descriptions = true; > + break; > + case 'g': > + gzip_mode = true; > + break; > + case 'h': > + http_mode = true; > + break; > + default: > + usage(); > + } > + } > + argc -= optind; > + argv += optind; > + > + /* HTTP output: cache metrics in buffer. */ > + if (http_mode) { > + fp = open_memstream(&http_buf, &http_buflen); > + if (fp == NULL) > + err(1, "open_memstream"); > + } else { > + fp = stdout; > + } > + > + oidname_init(&on); > + if (argc == 0) { > + struct oid o; > + > + /* Print all OIDs. */ > + oid_get_root(&o); > + do { > + oid_print(&o, &on, print_descriptions, fp); > + } while (oid_get_next(&o, &o)); > + } else { > + int i; > + > + /* Print only trees provided as arguments. */ > + for (i = 0; i < argc; ++i) { > + struct oid o, root; > + > + oid_get_by_name(&root, argv[i]); > + o = root; > + do { > + oid_print(&o, &on, print_descriptions, fp); > + } while (oid_get_next(&o, &o) && > + oid_is_beneath(&o, &root)); > + } > + } > + > + if (http_mode) { > + const char *content_encoding = ""; > + > + if (ferror(fp) || fclose(fp) != 0) > + err(1, "Cannot generate output"); > + > + /* Gzip compress the output. */ > + if (gzip_mode) { > + char *buf; > + size_t buflen; > + > + buflen = http_buflen; > + buf = malloc(buflen); > + if (buf == NULL) > + err(1, "Cannot allocate compression buffer"); > + if (buf_gzip(http_buf, http_buflen, buf, &buflen)) { > + content_encoding = "Content-Encoding: gzip\r\n"; > + free(http_buf); > + http_buf = buf; > + http_buflen = buflen; > + } else { > + free(buf); > + } > + } > + > + /* Print HTTP header and metrics. */ > + dprintf(STDOUT_FILENO, > + "HTTP/1.1 200 OK\r\n" > + "Connection: close\r\n" > + "%s" > + "Content-Length: %zu\r\n" > + "Content-Type: text/plain; version=0.0.4\r\n" > + "\r\n", > + content_encoding, http_buflen); > + write(STDOUT_FILENO, http_buf, http_buflen); > + free(http_buf); > + > + /* Drain output. */ > + if (shutdown(STDIN_FILENO, SHUT_WR) == 0) { > + char buf[1024]; > + > + while (read(STDIN_FILENO, buf, sizeof(buf)) > 0) { > + } > + } > + } > + return (0); > +} > From owner-svn-src-all@freebsd.org Wed Dec 21 18:04:57 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0C38BC8A0B6; Wed, 21 Dec 2016 18:04:57 +0000 (UTC) (envelope-from biancalana@gmail.com) Received: from mail-it0-x22f.google.com (mail-it0-x22f.google.com [IPv6:2607:f8b0:4001:c0b::22f]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id C740E13C6; Wed, 21 Dec 2016 18:04:56 +0000 (UTC) (envelope-from biancalana@gmail.com) Received: by mail-it0-x22f.google.com with SMTP id 75so84466536ite.1; Wed, 21 Dec 2016 10:04:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=f3jsIBrMisGK9X9ii5Tlg7l9dT018oavrSqbnbr7geg=; b=X+pZWPXfVHq3D2V5ra1LgQJpOVgd01sOIVB/eko9VITqqML5lbbopcmYbgC2cJ1fBP UcSCX/hJjFzcmvv/T3LmSsGx0hplAX1FjD7/UjbDREqU9hy/sFl1CMBPkcNrAXCdvku6 D1SGY1KYb1Mk4S/YW5qT55SizoL1mCSL/oFFExxoWBtIOsLvxyVSXLoWRTg//vJHgeZM 0rXeGOXqmgewu5avPjhWRTOTIAv7fCBMwq+etKYnkzCiNrI/+YRxReddAcey1BmSkM1q V/c1nDY12Ls+ChMm1UgHvjyrYkxDjTY3ICwJBnTKOsmrGutjJaHU4dV3/FT73ZUiu20o pj1Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=f3jsIBrMisGK9X9ii5Tlg7l9dT018oavrSqbnbr7geg=; b=I5TPEwwZloGMBXRre/fe8N9ZxC4lcTJbWLDpGeKu/uKb9a+6+fgydvwmcJ1oxz2w36 /PL/ysBOCWpD2Z7Rr9KelNxDG8VYqr+J9a/HcoGQxyIzj0cebxa5AFsiA2OIaugtHwO0 cZvSdGE6Vlgr+llTV/41vJVU5jNQ7tFsowl0Z1Wc7cC4EhFvW5BiZEC+QU3+T9rnDJmj 0+2FWlPa3WqwsDFExmLYMWUshYrv3/8mRyR4BK8GhlSMy7NYwT9QqGBbprZ/juP680YF ES0YKLHfQGJyzjDGQsjdBc5yqiLRB61Nn1revaRzIdqwcLD3Q3dUDaSY/93QBtySqG8p skWQ== X-Gm-Message-State: AIkVDXIP3I2O/iNPnoPrGi7wZAYXToSupmU4Ne1/2qxajGmZc9OLmqh/bClVJkrIvsjcKgvvupSEDtnRiRB1xg== X-Received: by 10.36.133.133 with SMTP id r127mr8776889itd.37.1482343495080; Wed, 21 Dec 2016 10:04:55 -0800 (PST) MIME-Version: 1.0 Received: by 10.64.207.225 with HTTP; Wed, 21 Dec 2016 10:04:54 -0800 (PST) In-Reply-To: References: <201612210829.uBL8Tijt041811@repo.freebsd.org> From: Alexandre Biancalana Date: Wed, 21 Dec 2016 16:04:54 -0200 Message-ID: Subject: Re: svn commit: r310354 - in head/usr.sbin: . prometheus_sysctl_exporter To: Adrian Chadd Cc: Ed Schouten , "svn-src-head@freebsd.org" , "svn-src-all@freebsd.org" , "src-committers@freebsd.org" Content-Type: text/plain; charset=UTF-8 X-Content-Filtered-By: Mailman/MimeDel 2.1.23 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Dec 2016 18:04:57 -0000 +1 On Wed, Dec 21, 2016 at 3:32 PM, Adrian Chadd wrote: > heh, > > in an ideal world we'd not call this "prometheus", it'd just be the > way we export sysctl data via 'sysctl' in a machine parsable format. > Ok, since it's HTTP/gzip, maybe a separate standalone program is cool, > but it doesn't have to be specific to prometheus. :-) > > That way anyone wanting to write a plugin for consuming freebsd data > can just use this program as the API contract. > > Maybe just "sysctl_export" would be fine. I'd like to encourage other > consumers to use it, including existing ones that currently do all the > silly hijinx. :) > > > +1 From owner-svn-src-all@freebsd.org Wed Dec 21 18:42:07 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5E574C8AE9B; Wed, 21 Dec 2016 18:42:07 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 2CABD17AB; Wed, 21 Dec 2016 18:42:07 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBLIg6C1096870; Wed, 21 Dec 2016 18:42:06 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBLIg5Me096244; Wed, 21 Dec 2016 18:42:05 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201612211842.uBLIg5Me096244@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Wed, 21 Dec 2016 18:42:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r310372 - in stable/11: lib/libmd sys/crypto/sha2 sys/crypto/skein sys/sys X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Dec 2016 18:42:07 -0000 Author: emaste Date: Wed Dec 21 18:42:04 2016 New Revision: 310372 URL: https://svnweb.freebsd.org/changeset/base/310372 Log: MFC r307521: libmd: introduce functions that operate on fd instead of filename Modified: stable/11/lib/libmd/md4.h stable/11/lib/libmd/md5.h stable/11/lib/libmd/mdXhl.c stable/11/lib/libmd/ripemd.h stable/11/lib/libmd/sha.h stable/11/sys/crypto/sha2/sha256.h stable/11/sys/crypto/sha2/sha384.h stable/11/sys/crypto/sha2/sha512.h stable/11/sys/crypto/sha2/sha512t.h stable/11/sys/crypto/skein/skein_freebsd.h stable/11/sys/crypto/skein/skein_port.h stable/11/sys/sys/md5.h Directory Properties: stable/11/ (props changed) Modified: stable/11/lib/libmd/md4.h ============================================================================== --- stable/11/lib/libmd/md4.h Wed Dec 21 15:45:23 2016 (r310371) +++ stable/11/lib/libmd/md4.h Wed Dec 21 18:42:04 2016 (r310372) @@ -53,6 +53,12 @@ __BEGIN_DECLS #ifndef MD4End #define MD4End _libmd_MD4End #endif +#ifndef MD4Fd +#define MD4Fd _libmd_MD4Fd +#endif +#ifndef MD4FdChunk +#define MD4FdChunk _libmd_MD4FdChunk +#endif #ifndef MD4File #define MD4File _libmd_MD4File #endif @@ -68,6 +74,8 @@ void MD4Update(MD4_CTX *, const void * void MD4Pad(MD4_CTX *); void MD4Final(unsigned char [16], MD4_CTX *); char * MD4End(MD4_CTX *, char *); +char * MD4Fd(int, char *); +char * MD4FdChunk(int, char *, off_t, off_t); char * MD4File(const char *, char *); char * MD4FileChunk(const char *, char *, off_t, off_t); char * MD4Data(const void *, unsigned int, char *); Modified: stable/11/lib/libmd/md5.h ============================================================================== --- stable/11/lib/libmd/md5.h Wed Dec 21 15:45:23 2016 (r310371) +++ stable/11/lib/libmd/md5.h Wed Dec 21 18:42:04 2016 (r310372) @@ -25,6 +25,12 @@ #ifndef MD5End #define MD5End _libmd_MD5End #endif +#ifndef MD5Fd +#define MD5Fd _libmd_MD5Fd +#endif +#ifndef MD5FdChunk +#define MD5FdChunk _libmd_MD5FdChunk +#endif #ifndef MD5File #define MD5File _libmd_MD5File #endif Modified: stable/11/lib/libmd/mdXhl.c ============================================================================== --- stable/11/lib/libmd/mdXhl.c Wed Dec 21 15:45:23 2016 (r310371) +++ stable/11/lib/libmd/mdXhl.c Wed Dec 21 18:42:04 2016 (r310372) @@ -42,18 +42,18 @@ MDXEnd(MDX_CTX *ctx, char *buf) } char * -MDXFile(const char *filename, char *buf) +MDXFd(int fd, char *buf) { - return (MDXFileChunk(filename, buf, 0, 0)); + return MDXFdChunk(fd, buf, 0, 0); } char * -MDXFileChunk(const char *filename, char *buf, off_t ofs, off_t len) +MDXFdChunk(int fd, char *buf, off_t ofs, off_t len) { unsigned char buffer[16*1024]; MDX_CTX ctx; struct stat stbuf; - int fd, readrv, e; + int readrv, e; off_t remain; if (len < 0) { @@ -62,9 +62,6 @@ MDXFileChunk(const char *filename, char } MDXInit(&ctx); - fd = open(filename, O_RDONLY); - if (fd < 0) - return NULL; if (ofs != 0) { errno = 0; if (lseek(fd, ofs, SEEK_SET) != ofs || @@ -86,15 +83,34 @@ MDXFileChunk(const char *filename, char remain -= readrv; } error: - e = errno; - close(fd); - errno = e; if (readrv < 0) return NULL; return (MDXEnd(&ctx, buf)); } char * +MDXFile(const char *filename, char *buf) +{ + return (MDXFileChunk(filename, buf, 0, 0)); +} + +char * +MDXFileChunk(const char *filename, char *buf, off_t ofs, off_t len) +{ + char *ret; + int e, fd; + + fd = open(filename, O_RDONLY); + if (fd < 0) + return NULL; + ret = MDXFdChunk(fd, buf, ofs, len); + e = errno; + close (fd); + errno = e; + return ret; +} + +char * MDXData (const void *data, unsigned int len, char *buf) { MDX_CTX ctx; Modified: stable/11/lib/libmd/ripemd.h ============================================================================== --- stable/11/lib/libmd/ripemd.h Wed Dec 21 15:45:23 2016 (r310371) +++ stable/11/lib/libmd/ripemd.h Wed Dec 21 18:42:04 2016 (r310372) @@ -96,6 +96,12 @@ __BEGIN_DECLS #ifndef RIPEMD160_End #define RIPEMD160_End _libmd_RIPEMD160_End #endif +#ifndef RIPEMD160_Fd +#define RIPEMD160_Fd _libmd_RIPEMD160_Fd +#endif +#ifndef RIPEMD160_FdChunk +#define RIPEMD160_FdChunk _libmd_RIPEMD160_FdChunk +#endif #ifndef RIPEMD160_File #define RIPEMD160_File _libmd_RIPEMD160_File #endif @@ -121,6 +127,8 @@ void RIPEMD160_Update(RIPEMD160_CTX *c, size_t len); void RIPEMD160_Final(unsigned char *md, RIPEMD160_CTX *c); char *RIPEMD160_End(RIPEMD160_CTX *, char *); +char *RIPEMD160_Fd(int, char *); +char *RIPEMD160_FdChunk(int, char *, off_t, off_t); char *RIPEMD160_File(const char *, char *); char *RIPEMD160_FileChunk(const char *, char *, off_t, off_t); char *RIPEMD160_Data(const void *, unsigned int, char *); Modified: stable/11/lib/libmd/sha.h ============================================================================== --- stable/11/lib/libmd/sha.h Wed Dec 21 15:45:23 2016 (r310371) +++ stable/11/lib/libmd/sha.h Wed Dec 21 18:42:04 2016 (r310372) @@ -94,6 +94,12 @@ __BEGIN_DECLS #ifndef SHA_End #define SHA_End _libmd_SHA_End #endif +#ifndef SHA_Fd +#define SHA_Fd _libmd_SHA_Fd +#endif +#ifndef SHA_FdChunk +#define SHA_FdChunk _libmd_SHA_FdChunk +#endif #ifndef SHA_File #define SHA_File _libmd_SHA_File #endif @@ -126,6 +132,12 @@ __BEGIN_DECLS #ifndef SHA1_End #define SHA1_End _libmd_SHA1_End #endif +#ifndef SHA1_Fd +#define SHA1_Fd _libmd_SHA1_Fd +#endif +#ifndef SHA1_FdChunk +#define SHA1_FdChunk _libmd_SHA1_FdChunk +#endif #ifndef SHA1_File #define SHA1_File _libmd_SHA1_File #endif @@ -150,6 +162,8 @@ void SHA_Init(SHA_CTX *c); void SHA_Update(SHA_CTX *c, const void *data, size_t len); void SHA_Final(unsigned char *md, SHA_CTX *c); char *SHA_End(SHA_CTX *, char *); +char *SHA_Fd(int, char *); +char *SHA_FdChunk(int, char *, off_t, off_t); char *SHA_File(const char *, char *); char *SHA_FileChunk(const char *, char *, off_t, off_t); char *SHA_Data(const void *, unsigned int, char *); @@ -158,6 +172,8 @@ void SHA1_Init(SHA_CTX *c); void SHA1_Update(SHA_CTX *c, const void *data, size_t len); void SHA1_Final(unsigned char *md, SHA_CTX *c); char *SHA1_End(SHA_CTX *, char *); +char *SHA1_Fd(int, char *); +char *SHA1_FdChunk(int, char *, off_t, off_t); char *SHA1_File(const char *, char *); char *SHA1_FileChunk(const char *, char *, off_t, off_t); char *SHA1_Data(const void *, unsigned int, char *); Modified: stable/11/sys/crypto/sha2/sha256.h ============================================================================== --- stable/11/sys/crypto/sha2/sha256.h Wed Dec 21 15:45:23 2016 (r310371) +++ stable/11/sys/crypto/sha2/sha256.h Wed Dec 21 18:42:04 2016 (r310372) @@ -59,6 +59,12 @@ __BEGIN_DECLS #ifndef SHA256_End #define SHA256_End _libmd_SHA256_End #endif +#ifndef SHA256_Fd +#define SHA256_Fd _libmd_SHA256_Fd +#endif +#ifndef SHA256_FdChunk +#define SHA256_FdChunk _libmd_SHA256_FdChunk +#endif #ifndef SHA256_File #define SHA256_File _libmd_SHA256_File #endif @@ -83,6 +89,8 @@ void SHA256_Final(unsigned char [__min_s #ifndef _KERNEL char *SHA256_End(SHA256_CTX *, char *); char *SHA256_Data(const void *, unsigned int, char *); +char *SHA256_Fd(int, char *); +char *SHA256_FdChunk(int, char *, off_t, off_t); char *SHA256_File(const char *, char *); char *SHA256_FileChunk(const char *, char *, off_t, off_t); #endif Modified: stable/11/sys/crypto/sha2/sha384.h ============================================================================== --- stable/11/sys/crypto/sha2/sha384.h Wed Dec 21 15:45:23 2016 (r310371) +++ stable/11/sys/crypto/sha2/sha384.h Wed Dec 21 18:42:04 2016 (r310372) @@ -58,6 +58,12 @@ __BEGIN_DECLS #ifndef SHA384_End #define SHA384_End _libmd_SHA384_End #endif +#ifndef SHA384_Fd +#define SHA384_Fd _libmd_SHA384_Fd +#endif +#ifndef SHA384_FdChunk +#define SHA384_FdChunk _libmd_SHA384_FdChunk +#endif #ifndef SHA384_File #define SHA384_File _libmd_SHA384_File #endif @@ -79,6 +85,8 @@ void SHA384_Final(unsigned char [__min_s #ifndef _KERNEL char *SHA384_End(SHA384_CTX *, char *); char *SHA384_Data(const void *, unsigned int, char *); +char *SHA384_Fd(int, char *); +char *SHA384_FdChunk(int, char *, off_t, off_t); char *SHA384_File(const char *, char *); char *SHA384_FileChunk(const char *, char *, off_t, off_t); #endif Modified: stable/11/sys/crypto/sha2/sha512.h ============================================================================== --- stable/11/sys/crypto/sha2/sha512.h Wed Dec 21 15:45:23 2016 (r310371) +++ stable/11/sys/crypto/sha2/sha512.h Wed Dec 21 18:42:04 2016 (r310372) @@ -58,6 +58,12 @@ __BEGIN_DECLS #ifndef SHA512_End #define SHA512_End _libmd_SHA512_End #endif +#ifndef SHA512_Fd +#define SHA512_Fd _libmd_SHA512_Fd +#endif +#ifndef SHA512_FdChunk +#define SHA512_FdChunk _libmd_SHA512_FdChunk +#endif #ifndef SHA512_File #define SHA512_File _libmd_SHA512_File #endif @@ -82,6 +88,8 @@ void SHA512_Final(unsigned char [__min_s #ifndef _KERNEL char *SHA512_End(SHA512_CTX *, char *); char *SHA512_Data(const void *, unsigned int, char *); +char *SHA512_Fd(int, char *); +char *SHA512_FdChunk(int, char *, off_t, off_t); char *SHA512_File(const char *, char *); char *SHA512_FileChunk(const char *, char *, off_t, off_t); #endif Modified: stable/11/sys/crypto/sha2/sha512t.h ============================================================================== --- stable/11/sys/crypto/sha2/sha512t.h Wed Dec 21 15:45:23 2016 (r310371) +++ stable/11/sys/crypto/sha2/sha512t.h Wed Dec 21 18:42:04 2016 (r310372) @@ -55,6 +55,12 @@ __BEGIN_DECLS #ifndef SHA512_224_End #define SHA512_224_End _libmd_SHA512_224_End #endif +#ifndef SHA512_224_Fd +#define SHA512_224_Fd _libmd_SHA512_224_Fd +#endif +#ifndef SHA512_224_FdChunk +#define SHA512_224_FdChunk _libmd_SHA512_224_FdChunk +#endif #ifndef SHA512_224_File #define SHA512_224_File _libmd_SHA512_224_File #endif @@ -84,6 +90,12 @@ __BEGIN_DECLS #ifndef SHA512_256_End #define SHA512_256_End _libmd_SHA512_256_End #endif +#ifndef SHA512_256_Fd +#define SHA512_256_Fd _libmd_SHA512_256_Fd +#endif +#ifndef SHA512_256_FdChunk +#define SHA512_256_FdChunk _libmd_SHA512_256_FdChunk +#endif #ifndef SHA512_256_File #define SHA512_256_File _libmd_SHA512_256_File #endif @@ -108,6 +120,8 @@ void SHA512_224_Final(unsigned char [__m #ifndef _KERNEL char *SHA512_224_End(SHA512_CTX *, char *); char *SHA512_224_Data(const void *, unsigned int, char *); +char *SHA512_224_Fd(int, char *); +char *SHA512_224_FdChunk(int, char *, off_t, off_t); char *SHA512_224_File(const char *, char *); char *SHA512_224_FileChunk(const char *, char *, off_t, off_t); #endif @@ -118,6 +132,8 @@ void SHA512_256_Final(unsigned char [__m #ifndef _KERNEL char *SHA512_256_End(SHA512_CTX *, char *); char *SHA512_256_Data(const void *, unsigned int, char *); +char *SHA512_256_Fd(int, char *); +char *SHA512_256_FdChunk(int, char *, off_t, off_t); char *SHA512_256_File(const char *, char *); char *SHA512_256_FileChunk(const char *, char *, off_t, off_t); #endif Modified: stable/11/sys/crypto/skein/skein_freebsd.h ============================================================================== --- stable/11/sys/crypto/skein/skein_freebsd.h Wed Dec 21 15:45:23 2016 (r310371) +++ stable/11/sys/crypto/skein/skein_freebsd.h Wed Dec 21 18:42:04 2016 (r310372) @@ -71,6 +71,12 @@ char *SKEIN1024_End(SKEIN1024_CTX *, c char *SKEIN256_Data(const void *, unsigned int, char *); char *SKEIN512_Data(const void *, unsigned int, char *); char *SKEIN1024_Data(const void *, unsigned int, char *); +char *SKEIN256_Fd(int, char *); +char *SKEIN512_Fd(int, char *); +char *SKEIN1024_Fd(int, char *); +char *SKEIN256_FdChunk(int, char *, off_t, off_t); +char *SKEIN512_FdChunk(int, char *, off_t, off_t); +char *SKEIN1024_FdChunk(int, char *, off_t, off_t); char *SKEIN256_File(const char *, char *); char *SKEIN512_File(const char *, char *); char *SKEIN1024_File(const char *, char *); Modified: stable/11/sys/crypto/skein/skein_port.h ============================================================================== --- stable/11/sys/crypto/skein/skein_port.h Wed Dec 21 15:45:23 2016 (r310371) +++ stable/11/sys/crypto/skein/skein_port.h Wed Dec 21 18:42:04 2016 (r310372) @@ -137,6 +137,16 @@ void Skein_Get64_LSB_First(u64b_t *ds #define SKEIN512_End _libmd_SKEIN512_End #define SKEIN1024_End _libmd_SKEIN1024_End #endif +#ifndef SKEIN256_Fd +#define SKEIN256_Fd _libmd_SKEIN256_Fd +#define SKEIN512_Fd _libmd_SKEIN512_Fd +#define SKEIN1024_Fd _libmd_SKEIN1024_Fd +#endif +#ifndef SKEIN256_FdChunk +#define SKEIN256_FdChunk _libmd_SKEIN256_FdChunk +#define SKEIN512_FdChunk _libmd_SKEIN512_FdChunk +#define SKEIN1024_FdChunk _libmd_SKEIN1024_FdChunk +#endif #ifndef SKEIN256_File #define SKEIN256_File _libmd_SKEIN256_File #define SKEIN512_File _libmd_SKEIN512_File Modified: stable/11/sys/sys/md5.h ============================================================================== --- stable/11/sys/sys/md5.h Wed Dec 21 15:45:23 2016 (r310371) +++ stable/11/sys/sys/md5.h Wed Dec 21 18:42:04 2016 (r310372) @@ -47,6 +47,8 @@ void MD5Update (MD5_CTX *, const void void MD5Final (unsigned char[__min_size(MD5_DIGEST_LENGTH)], MD5_CTX *); #ifndef _KERNEL char * MD5End(MD5_CTX *, char *); +char * MD5Fd(int, char *); +char * MD5FdChunk(int, char *, off_t, off_t); char * MD5File(const char *, char *); char * MD5FileChunk(const char *, char *, off_t, off_t); char * MD5Data(const void *, unsigned int, char *); From owner-svn-src-all@freebsd.org Wed Dec 21 19:07:04 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 384DBC8B41B for ; Wed, 21 Dec 2016 19:07:04 +0000 (UTC) (envelope-from ed@nuxi.nl) Received: from mail-yb0-x232.google.com (mail-yb0-x232.google.com [IPv6:2607:f8b0:4002:c09::232]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id EBE021436 for ; Wed, 21 Dec 2016 19:07:03 +0000 (UTC) (envelope-from ed@nuxi.nl) Received: by mail-yb0-x232.google.com with SMTP id d59so75702138ybi.1 for ; Wed, 21 Dec 2016 11:07:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nuxi-nl.20150623.gappssmtp.com; s=20150623; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=Q0w/zXpp8NUdfrw83aBc2iVscTfrephNbCYPwhlobnY=; b=wXXBKPlxYfS931wBTvnoSQDxZap+yiB+UEPrC4ZhU1EprBZTzxYip+IT+4jtJze+eI wlgvCwvreazqObMnb2iBh5ROhNJkLo1MVMEJTZJHh1UDp1vp33cJlHUMM1hXUof0yCD4 WpsfMsOnIYfdRTKn5zKgwmZFcpXDx889iR3sbt18ECpM6Zp+vQ5idOok5QS2km3dcv1B FVwiIl9cCEkQoRNrwunbwzkwJazDXOQvaK0TMHa/oO/jeO4bJXIh9G9+reNpKfTpW1tq IYm/Hnq4osAnHHaOCnW5OQoUWk1YACbC0/jKHjYYLOhPhn2P93HbARdob3FZHWa7OIyx yR3w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=Q0w/zXpp8NUdfrw83aBc2iVscTfrephNbCYPwhlobnY=; b=jDvPCzbFcDAPRKBXxWeZzom6UwIZERX1VFQWINMMONDtRb0HEx4wJewZUDMhZWC9O3 zFldA1D4iXla0ytWqYpJLghjqAtVUk4sSeTeBVLDL7iUy1dcuv0vNKBOVK1wqwl4Wfqf Ga7tyU2QrTjNaFMHy1dNiYIg7aq5DtFzzY9i+EIP0abtVdVOhoqyt9PGjjcj/wAsclMP 7ESO+G3l5+tzdxN5VmRCZlU2KFpEgfqrH25PALeUEcmSO6nWiHe1o7jhyeC5zBjIjM9O CQsclkp8HfO8R3LpKPT61nyS5kBJwT0d6FHlKj8ttiCppIPuyGvnyNSaJHGwgcrXnHO4 Fueg== X-Gm-Message-State: AIkVDXK18t7iQ2ibNyKXERYDCXAcdtwd1zofWt4TwrdgX7BXYxAjflCHJM+fl1fuhBHwy+xAxj0+BjOxSCdh8w== X-Received: by 10.37.210.197 with SMTP id j188mr3667513ybg.168.1482347223062; Wed, 21 Dec 2016 11:07:03 -0800 (PST) MIME-Version: 1.0 Received: by 10.129.2.139 with HTTP; Wed, 21 Dec 2016 11:06:32 -0800 (PST) In-Reply-To: References: <201612210829.uBL8Tijt041811@repo.freebsd.org> From: Ed Schouten Date: Wed, 21 Dec 2016 20:06:32 +0100 Message-ID: Subject: Re: svn commit: r310354 - in head/usr.sbin: . prometheus_sysctl_exporter To: Adrian Chadd Cc: Ed Schouten , "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" Content-Type: text/plain; charset=UTF-8 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Dec 2016 19:07:04 -0000 Hi Adrian, 2016-12-21 18:32 GMT+01:00 Adrian Chadd : > Maybe just "sysctl_export" would be fine. Good point. Almost all Prometheus metrics exporters use this naming scheme: ~80%: ${foo}_exporter ~20%: prometheus_${foo}_exporter Examples; - https://github.com/prometheus/node_exporter - https://github.com/ewr/elasticsearch_exporter - https://github.com/jonnenauha/prometheus_varnish_exporter The reason why I went for the 'prometheus_' prefix was mainly because of the following totally subjective reasons: - I didn't want to wreck tab completion. Right now if you type in 'sysc' and press tab, it tends to complete to 'sysctl'. - This tool is part of the base system, meaning that it will be present even if the user did nothing special. This is why I wanted the name to be a bit more self-documenting. - Thinking ahead: what if we're going to add exporters for other things as well? E.g., for Sendmail, sshd, ftpd, HAST, etc. In that case it would be nicer if those exporters shared a common prefix. That said, if people truly think it's a good idea to call this sysctl_exporter instead, then I wouldn't mind renaming it. Thoughts? Opinions? -- Ed Schouten Nuxi, 's-Hertogenbosch, the Netherlands KvK-nr.: 62051717 From owner-svn-src-all@freebsd.org Wed Dec 21 19:13:33 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C8BE0C8B5CC; Wed, 21 Dec 2016 19:13:33 +0000 (UTC) (envelope-from adrian.chadd@gmail.com) Received: from mail-wm0-x22f.google.com (mail-wm0-x22f.google.com [IPv6:2a00:1450:400c:c09::22f]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 70DDA1900; Wed, 21 Dec 2016 19:13:33 +0000 (UTC) (envelope-from adrian.chadd@gmail.com) Received: by mail-wm0-x22f.google.com with SMTP id g23so156933288wme.1; Wed, 21 Dec 2016 11:13:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=3WXEB4SP4iQynwcaXXnxPgKFTbQMGg8iVIkaiZJ0g1M=; b=cy/lQ8VucWvwV/5MV7AoEVCPZU6lS4yJNMBTwv26II+Qy5YaQiv3D+OuKStNR3BK8v Wx1cuayZJs0rBRp6Apcne55/k1DMhItuDgJT82EaUSlb5uChDeoXCAbZy41wr9Z63fm+ 42O4GOWjF07NmvtH4TKINbn3v3GbB2WBE9nnJa1IF4cLZbHxkdeGs7eex8/DFT8/unpa eTDFdMJ7C7CtQmpoXwpSJC6/3tQLEF0JkJE60W46Bwzzhvx5oD8qfu0C1xELr/Vif+tV 9kzLogQMU5Hzk+CHUioz/YODqG1KAatTHQYpJ1gE6DEwJIAxWDYU7UcnGn2teYksHxnS AENQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=3WXEB4SP4iQynwcaXXnxPgKFTbQMGg8iVIkaiZJ0g1M=; b=rdr/AusiDGbNrQVdH0Qz+PMH4QwNQr9ccGl7kvFDueQZnMs3SdtwRrzlx/8qD6ZdCi knUYh24QKEai35rdwxIBiebtrXEadn3L40E9n/jIitpKd/62e31lAajJ4ZBs5Y3KEqZm vWGpeip/CegQPHhL3/whauX6uLUZAdb8Vz/wAK/YgzBCNfGeGhejyAzIP3hZB+rm39CB 6OeCWPsH85lpxgIPr4ZrHiWDqFh/YwO4EQnaUYI6PneKQfSwBFVjJ+ydbUjiHEC3rXKk SAQ+pXfaVbqEorSG2IK+PyLseP2DAlayCxX+mHpQp/AxN9tevoRjKoNHvFZcSng//a2I g15w== X-Gm-Message-State: AIkVDXILcdZZN661ifIYcO9u2hHf3mw+PdQFTOYeogEAHOwL9aLM6y4U1J/HSSudS9sMAjG1mW5XHGdR2u7I7Q== X-Received: by 10.28.69.217 with SMTP id l86mr8044454wmi.129.1482347611891; Wed, 21 Dec 2016 11:13:31 -0800 (PST) MIME-Version: 1.0 Received: by 10.194.44.1 with HTTP; Wed, 21 Dec 2016 11:13:31 -0800 (PST) In-Reply-To: References: <201612210829.uBL8Tijt041811@repo.freebsd.org> From: Adrian Chadd Date: Wed, 21 Dec 2016 11:13:31 -0800 Message-ID: Subject: Re: svn commit: r310354 - in head/usr.sbin: . prometheus_sysctl_exporter To: Ed Schouten Cc: Ed Schouten , "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" Content-Type: text/plain; charset=UTF-8 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Dec 2016 19:13:33 -0000 My suggestion is "let's flesh out the toolsets a bit first, we can rename them before 12.0". If you really want a namespace that you can tabcomplete, then my bikeshed is painted "stats_export_XXX". I have other comments, like "should this really be doing HTTP / gzip output?" instead of say, using JSON or something else as an intermediary format. I have some half-finished patches to libstatfoo that allow either plain-text or JSON output, and the JSON output includes changes to describe the value (int, ordinal, dB, dBm, dBi, 802.11 rate, etc). -adrian From owner-svn-src-all@freebsd.org Wed Dec 21 19:32:30 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A8BA7C8BBD4; Wed, 21 Dec 2016 19:32:30 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from mail.baldwin.cx (bigwig.baldwin.cx [IPv6:2001:470:1f11:75::1]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 6525B136A; Wed, 21 Dec 2016 19:32:30 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from ralph.baldwin.cx (c-73-231-226-104.hsd1.ca.comcast.net [73.231.226.104]) by mail.baldwin.cx (Postfix) with ESMTPSA id A44B610AA28; Wed, 21 Dec 2016 14:32:27 -0500 (EST) From: John Baldwin To: Julian Elischer Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r310336 - head/sys/kern Date: Wed, 21 Dec 2016 11:28:25 -0800 Message-ID: <148295416.6HGrYZ2Ojd@ralph.baldwin.cx> User-Agent: KMail/4.14.10 (FreeBSD/11.0-PRERELEASE; KDE/4.14.10; amd64; ; ) In-Reply-To: References: <201612201944.uBKJiiMg034231@repo.freebsd.org> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.4.3 (mail.baldwin.cx); Wed, 21 Dec 2016 14:32:27 -0500 (EST) X-Virus-Scanned: clamav-milter 0.99.2 at mail.baldwin.cx X-Virus-Status: Clean X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Dec 2016 19:32:30 -0000 On Wednesday, December 21, 2016 02:40:09 PM Julian Elischer wrote: > On 21/12/2016 3:44 AM, John Baldwin wrote: > > Author: jhb > > Date: Tue Dec 20 19:44:44 2016 > > New Revision: 310336 > > URL: https://svnweb.freebsd.org/changeset/base/310336 > > > > Log: > > Don't spin in pause() during early boot for kthreads other than thread0. > > > > pause() uses a spin loop to simulate a sleep during early boot. However, > > we only need this for thread0 to get far enough in the boot process to > > enable timers (at which point pause() can sleep). For other kthreads, > > sleeping in pause() is ok as the callout will be scheduled and will > > eventually fire once thread0 initializes timers. > > maybe we just need to depend on a variable "have_timers" > that is independent of the cold/hot/whatever settings. > first code to enable a timer sets it. Eventually I think some cold checks will devolve to that (and/or cold will just go away). We aren't quite at that point yet however (though we are getting closer). -- John Baldwin From owner-svn-src-all@freebsd.org Wed Dec 21 19:53:10 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E4979C8BF5B; Wed, 21 Dec 2016 19:53:10 +0000 (UTC) (envelope-from etnapierala@gmail.com) Received: from mail-wm0-x242.google.com (mail-wm0-x242.google.com [IPv6:2a00:1450:400c:c09::242]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 725B31C67; Wed, 21 Dec 2016 19:53:10 +0000 (UTC) (envelope-from etnapierala@gmail.com) Received: by mail-wm0-x242.google.com with SMTP id m203so32312900wma.3; Wed, 21 Dec 2016 11:53:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:date:from:to:cc:subject:message-id:mail-followup-to :references:mime-version:content-disposition:in-reply-to:user-agent; bh=sJ6d9Rgr4VESNrGVaQonFmMIplNLPUIfj67Fwg0u3HY=; b=W5P1TM0+DCK+3pDDZKP7uIxniuX4Q3V/vdtgIlYhCqBf6atBkOqTQ6rlZtIWK0hFhl oDThsUovR3hNhMDtkOuGffeBdI8pMsulrIUz8eHAjti71PXIXhuqX/s9x2oxykcOoPI4 O4GyjfwC3SpWnEc16gGPnRfIJ0ZdQO8c0hB89HVoQbAfeIANufgv8Wn56Mr8lbgBMBHO l9Z5rTQKC1UjbKux47iJ/ahzTkA7Bj9Y8W4BTyrBlEa4hGH10Iatch/qTCobX8egrBP6 ofKXZv/withpQDmx1gZypRW4zXPfqiFFBa/NSu5ysAAn3Vz9Jg9SzlqgCsgAkwT0BPBe FSww== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:from:to:cc:subject:message-id :mail-followup-to:references:mime-version:content-disposition :in-reply-to:user-agent; bh=sJ6d9Rgr4VESNrGVaQonFmMIplNLPUIfj67Fwg0u3HY=; b=YwxWL4A4ifakqHyIFXjtLPXkBM/T7juBjMDff/hWJmrU5oWBHYnqyyJccvvOeQ+eEN W/eU8whBbm94ctrmZnelJyr5OXZGDQvOYCHUTPbs8Dh8V+zrIsaG1kHhkwyQPs6ig/Lb gLcutkLH0Yheao49RP9Tyr5Tt02I4ubOod5cskH1ouLcBVYTKrefhkt2LrlXxUW6hYFc 1yVs6J/VBEEX625ajVZeY7fYvQVTaYOmPjgVk0SXxvUem9NQLvuEhcUf9f+0yZ7UDzCi MX4WUZdS/mRt8W+CmcD6TDlASu/G+MbMSUCrvWjVFlWt/19eIwhGRlqqaqlbRYARS1K6 U4iw== X-Gm-Message-State: AIkVDXLaBW7qB/lx62EbQDtjxMbERHzyzsk0cUezCQni1duhIv2XVPJ0d2M4pxMzImiDMQ== X-Received: by 10.28.174.194 with SMTP id x185mr6332400wme.4.1482349987883; Wed, 21 Dec 2016 11:53:07 -0800 (PST) Received: from brick (abvn235.neoplus.adsl.tpnet.pl. [83.8.211.235]) by smtp.gmail.com with ESMTPSA id w7sm28553311wmd.24.2016.12.21.11.53.06 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 21 Dec 2016 11:53:07 -0800 (PST) Sender: =?UTF-8?Q?Edward_Tomasz_Napiera=C5=82a?= Date: Wed, 21 Dec 2016 20:53:04 +0100 From: Edward Tomasz =?utf-8?Q?Napiera=C5=82a?= To: Ed Schouten Cc: Adrian Chadd , Ed Schouten , "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" Subject: Re: svn commit: r310354 - in head/usr.sbin: . prometheus_sysctl_exporter Message-ID: <20161221195304.GA3396@brick> Mail-Followup-To: Ed Schouten , Adrian Chadd , Ed Schouten , "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" References: <201612210829.uBL8Tijt041811@repo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.7.2 (2016-11-26) X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Dec 2016 19:53:11 -0000 On 1221T2006, Ed Schouten wrote: > Hi Adrian, > > 2016-12-21 18:32 GMT+01:00 Adrian Chadd : > > Maybe just "sysctl_export" would be fine. > > Good point. Almost all Prometheus metrics exporters use this naming scheme: > > ~80%: ${foo}_exporter > ~20%: prometheus_${foo}_exporter > > Examples; > > - https://github.com/prometheus/node_exporter > - https://github.com/ewr/elasticsearch_exporter > - https://github.com/jonnenauha/prometheus_varnish_exporter > > The reason why I went for the 'prometheus_' prefix was mainly because > of the following totally subjective reasons: > > - I didn't want to wreck tab completion. Right now if you type in > 'sysc' and press tab, it tends to complete to 'sysctl'. That's a very good reason; it could also be fixed by moving it from sbin/ to libexec/. > - This tool is part of the base system, meaning that it will be > present even if the user did nothing special. This is why I wanted the > name to be a bit more self-documenting. > - Thinking ahead: what if we're going to add exporters for other > things as well? E.g., for Sendmail, sshd, ftpd, HAST, etc. In that > case it would be nicer if those exporters shared a common prefix. Another advantage of having the "prometheus" in the name is that it's easily googlable, and it clearly indicates the "protocol" (in the wide meaning) one is supposed to use to talk to it. From owner-svn-src-all@freebsd.org Wed Dec 21 20:19:13 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id BDACEC8A39A; Wed, 21 Dec 2016 20:19:13 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 8D03F16BB; Wed, 21 Dec 2016 20:19:13 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBLKJCND034477; Wed, 21 Dec 2016 20:19:12 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBLKJCBF034475; Wed, 21 Dec 2016 20:19:12 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201612212019.uBLKJCBF034475@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Wed, 21 Dec 2016 20:19:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310373 - in head/sys/cam: ctl scsi X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Dec 2016 20:19:13 -0000 Author: mav Date: Wed Dec 21 20:19:12 2016 New Revision: 310373 URL: https://svnweb.freebsd.org/changeset/base/310373 Log: Add support for REPORTING OPTIONS == 3 in REPORT SUPPORTED OPERATION CODES. MFC after: 2 weeks Modified: head/sys/cam/ctl/ctl.c head/sys/cam/scsi/scsi_all.h Modified: head/sys/cam/ctl/ctl.c ============================================================================== --- head/sys/cam/ctl/ctl.c Wed Dec 21 18:42:04 2016 (r310372) +++ head/sys/cam/ctl/ctl.c Wed Dec 21 20:19:12 2016 (r310373) @@ -7371,6 +7371,8 @@ ctl_report_supported_opcodes(struct ctl_ ctl_done((union ctl_io *)ctsio); return (CTL_RETVAL_COMPLETE); } + /* FALLTHROUGH */ + case RSO_OPTIONS_OC_ASA: total_len = sizeof(struct scsi_report_supported_opcodes_one) + 32; break; default: @@ -7459,6 +7461,18 @@ fill_one: } else one->support = 1; break; + case RSO_OPTIONS_OC_ASA: + one = (struct scsi_report_supported_opcodes_one *) + ctsio->kern_data_ptr; + entry = &ctl_cmd_table[opcode]; + if (entry->flags & CTL_CMD_FLAG_SA5) { + entry = &((const struct ctl_cmd_entry *) + entry->execute)[service_action]; + } else if (service_action != 0) { + one->support = 1; + break; + } + goto fill_one; } ctl_set_success(ctsio); Modified: head/sys/cam/scsi/scsi_all.h ============================================================================== --- head/sys/cam/scsi/scsi_all.h Wed Dec 21 18:42:04 2016 (r310372) +++ head/sys/cam/scsi/scsi_all.h Wed Dec 21 20:19:12 2016 (r310373) @@ -1456,6 +1456,7 @@ struct scsi_report_supported_opcodes #define RSO_OPTIONS_ALL 0x00 #define RSO_OPTIONS_OC 0x01 #define RSO_OPTIONS_OC_SA 0x02 +#define RSO_OPTIONS_OC_ASA 0x03 uint8_t requested_opcode; uint8_t requested_service_action[2]; uint8_t length[4]; From owner-svn-src-all@freebsd.org Wed Dec 21 22:02:23 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5D9CBC8A316; Wed, 21 Dec 2016 22:02:23 +0000 (UTC) (envelope-from jilles@stack.nl) Received: from mailout.stack.nl (mailout05.stack.nl [IPv6:2001:610:1108:5010::202]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mailout.stack.nl", Issuer "CA Cert Signing Authority" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 272301BE2; Wed, 21 Dec 2016 22:02:23 +0000 (UTC) (envelope-from jilles@stack.nl) Received: from snail.stack.nl (snail.stack.nl [IPv6:2001:610:1108:5010::131]) by mailout.stack.nl (Postfix) with ESMTP id 98F4D32; Wed, 21 Dec 2016 23:02:12 +0100 (CET) Received: by snail.stack.nl (Postfix, from userid 1677) id 85B5C28494; Wed, 21 Dec 2016 23:02:12 +0100 (CET) Date: Wed, 21 Dec 2016 23:02:12 +0100 From: Jilles Tjoelker To: Conrad Meyer Cc: Adrian Chadd , src-committers , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" Subject: Re: svn commit: r310138 - head/lib/libc/stdio Message-ID: <20161221220212.GA97256@stack.nl> References: <201612160144.uBG1ipjW016736@repo.freebsd.org> <49460793.UcUNovQMDa@ralph.baldwin.cx> <1482281779.48539.41.camel@freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Dec 2016 22:02:23 -0000 On Tue, Dec 20, 2016 at 06:04:31PM -0800, Conrad Meyer wrote: > On Tue, Dec 20, 2016 at 5:56 PM, Adrian Chadd wrote: > > Here's my reason for removal. > > Plenty of us are looking to be able to build bits of the BSD source > > tree as part of other non FreeBSD systems, especially if they're > > involved in bootstrapping. > Understood, however: > > That means that it needs to be compilable > > by a non-FreeBSD-modified compiler. Ideally this means we'd stick to > > mostly POSIX options source code that we can compile with unmodified > > compilers, and we push non-standard stuff into otherly-named > > functions. > Yeah, this isn't actually a problem. printf("%b", foo) compiles fine > with non-modified compilers. It compiles only if you disable format string warnings that should not be disabled for any serious software development, in my humble opinion. It will build, but not in a way I can call "fine". This indeed makes it very hard to justify extensions to format strings. Special formatting will need to use new functions. -- Jilles Tjoelker From owner-svn-src-all@freebsd.org Wed Dec 21 22:04:46 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4C081C8A3A1; Wed, 21 Dec 2016 22:04:46 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 1B2531D8F; Wed, 21 Dec 2016 22:04:46 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBLM4jWD080770; Wed, 21 Dec 2016 22:04:45 GMT (envelope-from brooks@FreeBSD.org) Received: (from brooks@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBLM4jnG080768; Wed, 21 Dec 2016 22:04:45 GMT (envelope-from brooks@FreeBSD.org) Message-Id: <201612212204.uBLM4jnG080768@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: brooks set sender to brooks@FreeBSD.org using -f From: Brooks Davis Date: Wed, 21 Dec 2016 22:04:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r310374 - stable/11/sbin/mount X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Dec 2016 22:04:46 -0000 Author: brooks Date: Wed Dec 21 22:04:44 2016 New Revision: 310374 URL: https://svnweb.freebsd.org/changeset/base/310374 Log: MFC r310092: Add a free_iovec() function to reset iovec's. The primary purpose is to call nmount() in a loop with new iovec's so free_iovec takes arguments by reference and resets their values. Reviewed by: cem Sponsored by: DARPA, AFRL Differential Revision: https://reviews.freebsd.org/D8513 Modified: stable/11/sbin/mount/getmntopts.c stable/11/sbin/mount/mntopts.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sbin/mount/getmntopts.c ============================================================================== --- stable/11/sbin/mount/getmntopts.c Wed Dec 21 20:19:12 2016 (r310373) +++ stable/11/sbin/mount/getmntopts.c Wed Dec 21 22:04:44 2016 (r310374) @@ -181,3 +181,17 @@ build_iovec_argf(struct iovec **iov, int va_end(ap); build_iovec(iov, iovlen, name, strdup(val), (size_t)-1); } + +/* + * Free the iovec and reset to NULL with zero length. Useful for calling + * nmount in a loop. + */ +void +free_iovec(struct iovec **iov, int *iovlen) +{ + int i; + + for (i = 0; i < *iovlen; i++) + free((*iov)[i].iov_base); + free(*iov); +} Modified: stable/11/sbin/mount/mntopts.h ============================================================================== --- stable/11/sbin/mount/mntopts.h Wed Dec 21 20:19:12 2016 (r310373) +++ stable/11/sbin/mount/mntopts.h Wed Dec 21 22:04:44 2016 (r310374) @@ -99,3 +99,4 @@ int checkpath(const char *, char resolve extern int getmnt_silent; void build_iovec(struct iovec **iov, int *iovlen, const char *name, void *val, size_t len); void build_iovec_argf(struct iovec **iov, int *iovlen, const char *name, const char *fmt, ...); +void free_iovec(struct iovec **iovec, int *iovlen); From owner-svn-src-all@freebsd.org Wed Dec 21 22:09:56 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 56027C8A54B for ; Wed, 21 Dec 2016 22:09:56 +0000 (UTC) (envelope-from ys-h@sea.plala.or.jp) Received: from msa04b.plala.or.jp (msa04.plala.or.jp [IPv6:2400:7800:0:5010::4]) by mx1.freebsd.org (Postfix) with ESMTP id EA4AC1034 for ; Wed, 21 Dec 2016 22:09:55 +0000 (UTC) (envelope-from ys-h@sea.plala.or.jp) Received: from AH53MB ([60.41.112.187]) by msa04b.plala.or.jp with SMTP id <20161221220952.BIZY29075.msa04b.plala.or.jp@AH53MB> for ; Thu, 22 Dec 2016 07:09:52 +0900 Date: Thu, 22 Dec 2016 07:09:52 +0900 From: Hiroshi Yoshida To: svn-src-all@freebsd.org Subject: Re: svn commit: r310363 - stable/10/sys/vm Message-Id: <20161222070952.eca6bc2a567f88292f686e99@sea.plala.or.jp> In-Reply-To: <201612211132.uBLBW9Ud019011@repo.freebsd.org> References: <201612211132.uBLBW9Ud019011@repo.freebsd.org> X-Mailer: Sylpheed 3.4.3 (GTK+ 2.10.14; i686-pc-mingw32) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-VirusScan: Outbound; msa04m; Thu, 22 Dec 2016 07:09:52 +0900 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Dec 2016 22:09:56 -0000 On Wed, 21 Dec 2016 11:32:09 +0000 (UTC) Konstantin Belousov wrote: > Author: kib > Date: Wed Dec 21 11:32:08 2016 > New Revision: 310363 > URL: https://svnweb.freebsd.org/changeset/base/310363 > > Log: > MFC r310098: > Provide introductory description of the default pager. > > Modified: > stable/10/sys/vm/default_pager.c > Directory Properties: > stable/10/ (props changed) > > Modified: stable/10/sys/vm/default_pager.c > ============================================================================== > --- stable/10/sys/vm/default_pager.c Wed Dec 21 09:59:55 2016 (r310362) > +++ stable/10/sys/vm/default_pager.c Wed Dec 21 11:32:08 2016 (r310363) > @@ -63,6 +63,16 @@ static boolean_t default_pager_haspage(v > int *); > /* > * pagerops for OBJT_DEFAULT - "default pager". > + * > + * This pager handles anonymous (no handle) swap-backed memory, just > + * like the swap pager. It allows several optimizations based on the > + * fact that no pages of a default object can be swapped out. The > + * most important optimization is in vm_fault(), where the pager is > + * never asked for a non-resident page. Instead, a freshly allocated > + * zeroed page is used. > + * > + * On the first request to page out a page from a default object, the > + * object is converted to swap pager type. > */ > struct pagerops defaultpagerops = { > .pgo_alloc = default_pager_alloc, > r310097 not need to merge it? -- Hiroshi Yoshida From owner-svn-src-all@freebsd.org Wed Dec 21 22:21:33 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 13877C8A99B; Wed, 21 Dec 2016 22:21:33 +0000 (UTC) (envelope-from ronald-lists@klop.ws) Received: from smarthost1.greenhost.nl (smarthost1.greenhost.nl [195.190.28.81]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C9BBF1731; Wed, 21 Dec 2016 22:21:31 +0000 (UTC) (envelope-from ronald-lists@klop.ws) Received: from smtp.greenhost.nl ([213.108.104.138]) by smarthost1.greenhost.nl with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.84_2) (envelope-from ) id 1cJpGE-00061T-JR; Wed, 21 Dec 2016 23:21:22 +0100 Content-Type: text/plain; charset=utf-8; format=flowed; delsp=yes To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org, "Andrew Turner" Subject: Re: svn commit: r310124 - head/sys/boot/arm/uboot References: <201612151736.uBFHatUL016048@repo.freebsd.org> Date: Wed, 21 Dec 2016 23:21:21 +0100 MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: "Ronald Klop" Message-ID: In-Reply-To: <201612151736.uBFHatUL016048@repo.freebsd.org> User-Agent: Opera Mail/12.16 (FreeBSD) X-Authenticated-As-Hash: 398f5522cb258ce43cb679602f8cfe8b62a256d1 X-Virus-Scanned: by clamav at smarthost1.samage.net X-Spam-Level: / X-Spam-Score: -0.2 X-Spam-Status: No, score=-0.2 required=5.0 tests=ALL_TRUSTED, BAYES_50 autolearn=disabled version=3.4.0 X-Scan-Signature: 2394e6fd9f1e9f86011669f8146dc264 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Dec 2016 22:21:33 -0000 Hello, Is this 12-CURRENT only or also applicable to 11-STABLE? Regards, Ronald. On Thu, 15 Dec 2016 18:36:55 +0100, Andrew Turner wrote: > Author: andrew > Date: Thu Dec 15 17:36:54 2016 > New Revision: 310124 > URL: https://svnweb.freebsd.org/changeset/base/310124 > > Log: > Add -fPIC to the ubldr build. Without this the self relocation code > will > try to use an absolute address in a switch statement, jumping to an > invalid > memory location. > Sponsored by: ABT Systems Ltd > > Modified: > head/sys/boot/arm/uboot/Makefile > > Modified: head/sys/boot/arm/uboot/Makefile > ============================================================================== > --- head/sys/boot/arm/uboot/Makefile Thu Dec 15 17:34:18 2016 (r310123) > +++ head/sys/boot/arm/uboot/Makefile Thu Dec 15 17:36:54 2016 (r310124) > @@ -109,6 +109,8 @@ CFLAGS+= -I${.OBJDIR}/../../uboot/lib > # where to get libstand from > CFLAGS+= -I${.CURDIR}/../../../../lib/libstand/ > +CFLAGS+= -fPIC > + > # clang doesn't understand %D as a specifier to printf > NO_WERROR.clang= > _______________________________________________ > svn-src-all@freebsd.org mailing list > https://lists.freebsd.org/mailman/listinfo/svn-src-all > To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org" From owner-svn-src-all@freebsd.org Wed Dec 21 22:35:28 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4F88FC8ACB9; Wed, 21 Dec 2016 22:35:28 +0000 (UTC) (envelope-from gonzo@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 0506F1E94; Wed, 21 Dec 2016 22:35:27 +0000 (UTC) (envelope-from gonzo@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBLMZRhD093010; Wed, 21 Dec 2016 22:35:27 GMT (envelope-from gonzo@FreeBSD.org) Received: (from gonzo@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBLMZRkq093009; Wed, 21 Dec 2016 22:35:27 GMT (envelope-from gonzo@FreeBSD.org) Message-Id: <201612212235.uBLMZRkq093009@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gonzo set sender to gonzo@FreeBSD.org using -f From: Oleksandr Tymoshenko Date: Wed, 21 Dec 2016 22:35:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310375 - head/sys/dev/iwn X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Dec 2016 22:35:28 -0000 Author: gonzo Date: Wed Dec 21 22:35:26 2016 New Revision: 310375 URL: https://svnweb.freebsd.org/changeset/base/310375 Log: [iwn] Several fixes for DMA part of iwn(4) - Perform DMS sync when accessing/initializing ICT table - Fix some DMA sync operations to use matching tags Reviewed by: avos MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D8804 Modified: head/sys/dev/iwn/if_iwn.c Modified: head/sys/dev/iwn/if_iwn.c ============================================================================== --- head/sys/dev/iwn/if_iwn.c Wed Dec 21 22:04:44 2016 (r310374) +++ head/sys/dev/iwn/if_iwn.c Wed Dec 21 22:35:26 2016 (r310375) @@ -2120,6 +2120,9 @@ iwn5000_ict_reset(struct iwn_softc *sc) memset(sc->ict, 0, IWN_ICT_SIZE); sc->ict_cur = 0; + bus_dmamap_sync(sc->ict_dma.tag, sc->ict_dma.map, + BUS_DMASYNC_PREWRITE); + /* Set physical address of ICT table (4KB aligned). */ DPRINTF(sc, IWN_DEBUG_RESET, "%s: enabling ICT\n", __func__); IWN_WRITE(sc, IWN_DRAM_INT_TBL, IWN_DRAM_INT_TBL_ENABLE | @@ -4100,6 +4103,8 @@ iwn_intr(void *arg) /* Read interrupts from ICT (fast) or from registers (slow). */ if (sc->sc_flags & IWN_FLAG_USE_ICT) { + bus_dmamap_sync(sc->ict_dma.tag, sc->ict_dma.map, + BUS_DMASYNC_POSTREAD); tmp = 0; while (sc->ict[sc->ict_cur] != 0) { tmp |= sc->ict[sc->ict_cur]; @@ -4635,7 +4640,7 @@ iwn_tx_data(struct iwn_softc *sc, struct } bus_dmamap_sync(ring->data_dmat, data->map, BUS_DMASYNC_PREWRITE); - bus_dmamap_sync(ring->data_dmat, ring->cmd_dma.map, + bus_dmamap_sync(ring->cmd_dma.tag, ring->cmd_dma.map, BUS_DMASYNC_PREWRITE); bus_dmamap_sync(ring->desc_dma.tag, ring->desc_dma.map, BUS_DMASYNC_PREWRITE); @@ -4828,7 +4833,7 @@ iwn_tx_data_raw(struct iwn_softc *sc, st } bus_dmamap_sync(ring->data_dmat, data->map, BUS_DMASYNC_PREWRITE); - bus_dmamap_sync(ring->data_dmat, ring->cmd_dma.map, + bus_dmamap_sync(ring->cmd_dma.tag, ring->cmd_dma.map, BUS_DMASYNC_PREWRITE); bus_dmamap_sync(ring->desc_dma.tag, ring->desc_dma.map, BUS_DMASYNC_PREWRITE); @@ -5161,7 +5166,7 @@ iwn_cmd(struct iwn_softc *sc, int code, bus_dmamap_sync(ring->data_dmat, data->map, BUS_DMASYNC_PREWRITE); } else { - bus_dmamap_sync(ring->data_dmat, ring->cmd_dma.map, + bus_dmamap_sync(ring->cmd_dma.tag, ring->cmd_dma.map, BUS_DMASYNC_PREWRITE); } bus_dmamap_sync(ring->desc_dma.tag, ring->desc_dma.map, From owner-svn-src-all@freebsd.org Wed Dec 21 22:47:11 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C5EBCC8AFE3; Wed, 21 Dec 2016 22:47:11 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 8831B13C6; Wed, 21 Dec 2016 22:47:11 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBLMlAHt096970; Wed, 21 Dec 2016 22:47:10 GMT (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBLMlAv8096969; Wed, 21 Dec 2016 22:47:10 GMT (envelope-from glebius@FreeBSD.org) Message-Id: <201612212247.uBLMlAv8096969@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: glebius set sender to glebius@FreeBSD.org using -f From: Gleb Smirnoff Date: Wed, 21 Dec 2016 22:47:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310376 - head/sys/netinet X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Dec 2016 22:47:11 -0000 Author: glebius Date: Wed Dec 21 22:47:10 2016 New Revision: 310376 URL: https://svnweb.freebsd.org/changeset/base/310376 Log: Remove assigned only variable. Modified: head/sys/netinet/tcp_syncache.c Modified: head/sys/netinet/tcp_syncache.c ============================================================================== --- head/sys/netinet/tcp_syncache.c Wed Dec 21 22:35:26 2016 (r310375) +++ head/sys/netinet/tcp_syncache.c Wed Dec 21 22:47:10 2016 (r310376) @@ -1170,7 +1170,7 @@ syncache_add(struct in_conninfo *inc, st struct syncache_head *sch; struct mbuf *ipopts = NULL; u_int ltflags; - int win, sb_hiwat, ip_ttl, ip_tos; + int win, ip_ttl, ip_tos; char *s; int rv = 0; #ifdef INET6 @@ -1208,7 +1208,6 @@ syncache_add(struct in_conninfo *inc, st ip_ttl = inp->inp_ip_ttl; ip_tos = inp->inp_ip_tos; win = sbspace(&so->so_rcv); - sb_hiwat = so->so_rcv.sb_hiwat; ltflags = (tp->t_flags & (TF_NOOPT | TF_SIGNATURE)); #ifdef TCP_RFC7413 From owner-svn-src-all@freebsd.org Wed Dec 21 22:53:11 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7D93FC8B251; Wed, 21 Dec 2016 22:53:11 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 5805A18F9; Wed, 21 Dec 2016 22:53:11 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBLMrAxT001008; Wed, 21 Dec 2016 22:53:10 GMT (envelope-from brooks@FreeBSD.org) Received: (from brooks@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBLMrAs3001006; Wed, 21 Dec 2016 22:53:10 GMT (envelope-from brooks@FreeBSD.org) Message-Id: <201612212253.uBLMrAs3001006@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: brooks set sender to brooks@FreeBSD.org using -f From: Brooks Davis Date: Wed, 21 Dec 2016 22:53:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r310377 - stable/11/bin/df X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Dec 2016 22:53:11 -0000 Author: brooks Date: Wed Dec 21 22:53:10 2016 New Revision: 310377 URL: https://svnweb.freebsd.org/changeset/base/310377 Log: MFC r310088, r310090, r310095 r310088: Put the undocumented df feature of mounting filesystems from device nodes under an ifdef. Leave enabled. Reviewed by: cem Sponsored by: DARPA, AFRL Differential Revision: https://reviews.freebsd.org/D8513 r310090: Mount filesystems without executable permissions since they should never be used. Reviewed by: cem Sponsored by: DARPA, AFRL Differential Revision: https://reviews.freebsd.org/D8513 r310095: Use nmount(2) rather than the obsolete mount(2). Reviewed by: cem Sponsored by: DARPA, AFRL Differential Revision: https://reviews.freebsd.org/D8513 Modified: stable/11/bin/df/Makefile stable/11/bin/df/df.c Directory Properties: stable/11/ (props changed) Modified: stable/11/bin/df/Makefile ============================================================================== --- stable/11/bin/df/Makefile Wed Dec 21 22:47:10 2016 (r310376) +++ stable/11/bin/df/Makefile Wed Dec 21 22:53:10 2016 (r310377) @@ -10,6 +10,9 @@ SRCS= df.c vfslist.c CFLAGS+= -I${MOUNT} +CFLAGS+= -DMOUNT_CHAR_DEVS +SRCS+= getmntopts.c + LIBADD= xo util .include Modified: stable/11/bin/df/df.c ============================================================================== --- stable/11/bin/df/df.c Wed Dec 21 22:47:10 2016 (r310376) +++ stable/11/bin/df/df.c Wed Dec 21 22:53:10 2016 (r310377) @@ -50,10 +50,15 @@ __FBSDID("$FreeBSD$"); #include #include #include +#ifdef MOUNT_CHAR_DEVS #include +#endif #include #include #include +#ifdef MOUNT_CHAR_DEVS +#include +#endif #include #include #include @@ -98,7 +103,9 @@ imax(int a, int b) static int aflag = 0, cflag, hflag, iflag, kflag, lflag = 0, nflag, Tflag; static int thousands; +#ifdef MOUNT_CHAR_DEVS static struct ufs_args mdev; +#endif int main(int argc, char *argv[]) @@ -107,11 +114,21 @@ main(int argc, char *argv[]) struct statfs statfsbuf, totalbuf; struct maxwidths maxwidths; struct statfs *mntbuf; +#ifdef MOUNT_CHAR_DEVS + struct iovec *iov = NULL; +#endif const char *fstype; - char *mntpath, *mntpt; +#ifdef MOUNT_CHAR_DEVS + char *mntpath; + char errmsg[255] = {0}; +#endif + char *mntpt; const char **vfslist; int i, mntsize; int ch, rv; +#ifdef MOUNT_CHAR_DEVS + int iovlen = 0; +#endif fstype = "ufs"; (void)setlocale(LC_ALL, ""); @@ -224,6 +241,7 @@ main(int argc, char *argv[]) rv = 1; continue; } +#ifdef MOUNT_CHAR_DEVS } else if (S_ISCHR(stbuf.st_mode)) { if ((mntpt = getmntpt(*argv)) == NULL) { mdev.fspec = *argv; @@ -240,9 +258,23 @@ main(int argc, char *argv[]) free(mntpath); continue; } - if (mount(fstype, mntpt, MNT_RDONLY, - &mdev) != 0) { - xo_warn("%s", *argv); + if (iov != NULL) + free_iovec(&iov, &iovlen); + build_iovec_argf(&iov, &iovlen, "fstype", "%s", + fstype); + build_iovec_argf(&iov, &iovlen, "fspath", "%s", + mntpath); + build_iovec_argf(&iov, &iovlen, "from", "%s", + *argv); + build_iovec(&iov, &iovlen, "errmsg", errmsg, + sizeof(errmsg)); + if (nmount(iov, iovlen, + MNT_RDONLY|MNT_NOEXEC) < 0) { + if (errmsg[0]) + xo_warn("%s: %s", *argv, + errmsg); + else + xo_warn("%s", *argv); rv = 1; (void)rmdir(mntpt); free(mntpath); @@ -261,6 +293,7 @@ main(int argc, char *argv[]) free(mntpath); continue; } +#endif } else mntpt = *argv; From owner-svn-src-all@freebsd.org Wed Dec 21 23:16:59 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C1466C8B6F7; Wed, 21 Dec 2016 23:16:59 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 8973D130A; Wed, 21 Dec 2016 23:16:59 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBLNGwGm009137; Wed, 21 Dec 2016 23:16:58 GMT (envelope-from brooks@FreeBSD.org) Received: (from brooks@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBLNGwuQ009134; Wed, 21 Dec 2016 23:16:58 GMT (envelope-from brooks@FreeBSD.org) Message-Id: <201612212316.uBLNGwuQ009134@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: brooks set sender to brooks@FreeBSD.org using -f From: Brooks Davis Date: Wed, 21 Dec 2016 23:16:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r310378 - stable/10/sbin/mount X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Dec 2016 23:16:59 -0000 Author: brooks Date: Wed Dec 21 23:16:58 2016 New Revision: 310378 URL: https://svnweb.freebsd.org/changeset/base/310378 Log: MFC r310092: Add a free_iovec() function to reset iovec's. The primary purpose is to call nmount() in a loop with new iovec's so free_iovec takes arguments by reference and resets their values. Reviewed by: cem MFC after: 1 week Sponsored by: DARPA, AFRL Differential Revision: https://reviews.freebsd.org/D8513 Modified: stable/10/sbin/mount/getmntopts.c stable/10/sbin/mount/mntopts.h Directory Properties: stable/10/ (props changed) Modified: stable/10/sbin/mount/getmntopts.c ============================================================================== --- stable/10/sbin/mount/getmntopts.c Wed Dec 21 22:53:10 2016 (r310377) +++ stable/10/sbin/mount/getmntopts.c Wed Dec 21 23:16:58 2016 (r310378) @@ -181,3 +181,17 @@ build_iovec_argf(struct iovec **iov, int va_end(ap); build_iovec(iov, iovlen, name, strdup(val), (size_t)-1); } + +/* + * Free the iovec and reset to NULL with zero length. Useful for calling + * nmount in a loop. + */ +void +free_iovec(struct iovec **iov, int *iovlen) +{ + int i; + + for (i = 0; i < *iovlen; i++) + free((*iov)[i].iov_base); + free(*iov); +} Modified: stable/10/sbin/mount/mntopts.h ============================================================================== --- stable/10/sbin/mount/mntopts.h Wed Dec 21 22:53:10 2016 (r310377) +++ stable/10/sbin/mount/mntopts.h Wed Dec 21 23:16:58 2016 (r310378) @@ -99,3 +99,4 @@ int checkpath(const char *, char resolve extern int getmnt_silent; void build_iovec(struct iovec **iov, int *iovlen, const char *name, void *val, size_t len); void build_iovec_argf(struct iovec **iov, int *iovlen, const char *name, const char *fmt, ...); +void free_iovec(struct iovec **iovec, int *iovlen); From owner-svn-src-all@freebsd.org Wed Dec 21 23:54:13 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 744B7C8BE80; Wed, 21 Dec 2016 23:54:13 +0000 (UTC) (envelope-from gavin@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 36B0113BB; Wed, 21 Dec 2016 23:54:13 +0000 (UTC) (envelope-from gavin@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBLNsCfd025144; Wed, 21 Dec 2016 23:54:12 GMT (envelope-from gavin@FreeBSD.org) Received: (from gavin@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBLNsCDi025143; Wed, 21 Dec 2016 23:54:12 GMT (envelope-from gavin@FreeBSD.org) Message-Id: <201612212354.uBLNsCDi025143@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gavin set sender to gavin@FreeBSD.org using -f From: Gavin Atkinson Date: Wed, 21 Dec 2016 23:54:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310379 - head/sys/dev/ow X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Dec 2016 23:54:13 -0000 Author: gavin Date: Wed Dec 21 23:54:12 2016 New Revision: 310379 URL: https://svnweb.freebsd.org/changeset/base/310379 Log: ow_temp: Correct typo in comment Modified: head/sys/dev/ow/ow_temp.c Modified: head/sys/dev/ow/ow_temp.c ============================================================================== --- head/sys/dev/ow/ow_temp.c Wed Dec 21 23:16:58 2016 (r310378) +++ head/sys/dev/ow/ow_temp.c Wed Dec 21 23:54:12 2016 (r310379) @@ -164,7 +164,7 @@ ow_temp_event_thread(void *arg) if (scratch[7]) { /* * Formula from DS18S20 datasheet, page 6 - * DS18S20 datahseet says count_per_c is 16, DS1820 does not + * DS18S20 datasheet says count_per_c is 16, DS1820 does not */ sc->temp = (int16_t)((scratch[0] & 0xfe) | (scratch[1] << 8)) << 3; From owner-svn-src-all@freebsd.org Wed Dec 21 23:59:59 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B3086C8B24D; Wed, 21 Dec 2016 23:59:59 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 8DB6316E4; Wed, 21 Dec 2016 23:59:59 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBLNxw6h025385; Wed, 21 Dec 2016 23:59:58 GMT (envelope-from brooks@FreeBSD.org) Received: (from brooks@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBLNxwdc025383; Wed, 21 Dec 2016 23:59:58 GMT (envelope-from brooks@FreeBSD.org) Message-Id: <201612212359.uBLNxwdc025383@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: brooks set sender to brooks@FreeBSD.org using -f From: Brooks Davis Date: Wed, 21 Dec 2016 23:59:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r310380 - stable/10/bin/df X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Dec 2016 23:59:59 -0000 Author: brooks Date: Wed Dec 21 23:59:58 2016 New Revision: 310380 URL: https://svnweb.freebsd.org/changeset/base/310380 Log: MFC r310088, r310090, r310095 r310088: Put the undocumented df feature of mounting filesystems from device nodes under an ifdef. Leave enabled. Reviewed by: cem Sponsored by: DARPA, AFRL Differential Revision: https://reviews.freebsd.org/D8513 r310090: Mount filesystems without executable permissions since they should never be used. Reviewed by: cem Sponsored by: DARPA, AFRL Differential Revision: https://reviews.freebsd.org/D8513 r310095: Use nmount(2) rather than the obsolete mount(2). Reviewed by: cem Sponsored by: DARPA, AFRL Differential Revision: https://reviews.freebsd.org/D8513 Modified: stable/10/bin/df/Makefile stable/10/bin/df/df.c Directory Properties: stable/10/ (props changed) Modified: stable/10/bin/df/Makefile ============================================================================== --- stable/10/bin/df/Makefile Wed Dec 21 23:54:12 2016 (r310379) +++ stable/10/bin/df/Makefile Wed Dec 21 23:59:58 2016 (r310380) @@ -9,6 +9,9 @@ SRCS= df.c vfslist.c CFLAGS+= -I${MOUNT} +CFLAGS+= -DMOUNT_CHAR_DEVS +SRCS+= getmntopts.c + DPADD= ${LIBUTIL} LDADD= -lutil Modified: stable/10/bin/df/df.c ============================================================================== --- stable/10/bin/df/df.c Wed Dec 21 23:54:12 2016 (r310379) +++ stable/10/bin/df/df.c Wed Dec 21 23:59:58 2016 (r310380) @@ -50,10 +50,15 @@ __FBSDID("$FreeBSD$"); #include #include #include +#ifdef MOUNT_CHAR_DEVS #include +#endif #include #include #include +#ifdef MOUNT_CHAR_DEVS +#include +#endif #include #include #include @@ -97,7 +102,9 @@ imax(int a, int b) static int aflag = 0, cflag, hflag, iflag, kflag, lflag = 0, nflag, Tflag; static int thousands; +#ifdef MOUNT_CHAR_DEVS static struct ufs_args mdev; +#endif int main(int argc, char *argv[]) @@ -106,11 +113,21 @@ main(int argc, char *argv[]) struct statfs statfsbuf, totalbuf; struct maxwidths maxwidths; struct statfs *mntbuf; +#ifdef MOUNT_CHAR_DEVS + struct iovec *iov = NULL; +#endif const char *fstype; - char *mntpath, *mntpt; +#ifdef MOUNT_CHAR_DEVS + char *mntpath; + char errmsg[255] = {0}; +#endif + char *mntpt; const char **vfslist; int i, mntsize; int ch, rv; +#ifdef MOUNT_CHAR_DEVS + int iovlen = 0; +#endif fstype = "ufs"; (void)setlocale(LC_ALL, ""); @@ -215,6 +232,7 @@ main(int argc, char *argv[]) rv = 1; continue; } +#ifdef MOUNT_CHAR_DEVS } else if (S_ISCHR(stbuf.st_mode)) { if ((mntpt = getmntpt(*argv)) == NULL) { mdev.fspec = *argv; @@ -231,9 +249,23 @@ main(int argc, char *argv[]) free(mntpath); continue; } - if (mount(fstype, mntpt, MNT_RDONLY, - &mdev) != 0) { - warn("%s", *argv); + if (iov != NULL) + free_iovec(&iov, &iovlen); + build_iovec_argf(&iov, &iovlen, "fstype", "%s", + fstype); + build_iovec_argf(&iov, &iovlen, "fspath", "%s", + mntpath); + build_iovec_argf(&iov, &iovlen, "from", "%s", + *argv); + build_iovec(&iov, &iovlen, "errmsg", errmsg, + sizeof(errmsg)); + if (nmount(iov, iovlen, + MNT_RDONLY|MNT_NOEXEC) < 0) { + if (errmsg[0]) + warn("%s: %s", *argv, + errmsg); + else + warn("%s", *argv); rv = 1; (void)rmdir(mntpt); free(mntpath); @@ -252,6 +284,7 @@ main(int argc, char *argv[]) free(mntpath); continue; } +#endif } else mntpt = *argv; From owner-svn-src-all@freebsd.org Thu Dec 22 00:09:55 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 43DEFC8B4E7; Thu, 22 Dec 2016 00:09:55 +0000 (UTC) (envelope-from gavin@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 05DC71BD7; Thu, 22 Dec 2016 00:09:54 +0000 (UTC) (envelope-from gavin@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBM09s45029259; Thu, 22 Dec 2016 00:09:54 GMT (envelope-from gavin@FreeBSD.org) Received: (from gavin@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBM09s5M029258; Thu, 22 Dec 2016 00:09:54 GMT (envelope-from gavin@FreeBSD.org) Message-Id: <201612220009.uBM09s5M029258@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gavin set sender to gavin@FreeBSD.org using -f From: Gavin Atkinson Date: Thu, 22 Dec 2016 00:09:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310381 - head/sys/dev/ow X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Dec 2016 00:09:55 -0000 Author: gavin Date: Thu Dec 22 00:09:53 2016 New Revision: 310381 URL: https://svnweb.freebsd.org/changeset/base/310381 Log: ow_temp: Update the temperature visible via the sysctl atomically, rather than using it as temporary calculation space. Modified: head/sys/dev/ow/ow_temp.c Modified: head/sys/dev/ow/ow_temp.c ============================================================================== --- head/sys/dev/ow/ow_temp.c Wed Dec 21 23:59:58 2016 (r310380) +++ head/sys/dev/ow/ow_temp.c Thu Dec 22 00:09:53 2016 (r310381) @@ -137,7 +137,7 @@ ow_temp_event_thread(void *arg) struct ow_temp_softc *sc; uint8_t scratch[8 + 1]; uint8_t crc; - int retries, rv; + int retries, rv, tmp; sc = arg; pause("owtstart", device_get_unit(sc->dev) * hz / 100); // 10ms stagger @@ -166,14 +166,14 @@ ow_temp_event_thread(void *arg) * Formula from DS18S20 datasheet, page 6 * DS18S20 datasheet says count_per_c is 16, DS1820 does not */ - sc->temp = (int16_t)((scratch[0] & 0xfe) | + tmp = (int16_t)((scratch[0] & 0xfe) | (scratch[1] << 8)) << 3; - sc->temp += 16 - scratch[6] - 4; /* count_per_c == 16 */ + tmp += 16 - scratch[6] - 4; /* count_per_c == 16 */ } else - sc->temp = (int16_t)(scratch[0] | (scratch[1] << 8)) << 3; + tmp = (int16_t)(scratch[0] | (scratch[1] << 8)) << 3; } else - sc->temp = (int16_t)(scratch[0] | (scratch[1] << 8)); - sc->temp = sc->temp * 1000 / 16 + 273150; + tmp = (int16_t)(scratch[0] | (scratch[1] << 8)); + sc->temp = tmp * 1000 / 16 + 273150; break; } sc->bad_crc++; From owner-svn-src-all@freebsd.org Thu Dec 22 00:19:30 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4EF9CC8B695; Thu, 22 Dec 2016 00:19:30 +0000 (UTC) (envelope-from hiren@strugglingcoder.info) Received: from mail.strugglingcoder.info (strugglingcoder.info [104.236.146.68]) by mx1.freebsd.org (Postfix) with ESMTP id 3FA8E9E; Thu, 22 Dec 2016 00:19:29 +0000 (UTC) (envelope-from hiren@strugglingcoder.info) Received: from localhost (unknown [10.1.1.3]) (Authenticated sender: hiren@strugglingcoder.info) by mail.strugglingcoder.info (Postfix) with ESMTPA id 1345517474; Wed, 21 Dec 2016 16:19:29 -0800 (PST) Date: Wed, 21 Dec 2016 16:19:28 -0800 From: hiren panchasara To: Gleb Smirnoff Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r309745 - in head: share/man/man9 sys/kern sys/sys Message-ID: <20161222001928.GZ82166@strugglingcoder.info> References: <201612091758.uB9HwYC0087384@repo.freebsd.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="LG5jgFgJbJFFiAfj" Content-Disposition: inline In-Reply-To: <201612091758.uB9HwYC0087384@repo.freebsd.org> User-Agent: Mutt/1.5.23 (2014-03-12) X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Dec 2016 00:19:30 -0000 --LG5jgFgJbJFFiAfj Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On 12/09/16 at 05:58P, Gleb Smirnoff wrote: > Author: glebius > Date: Fri Dec 9 17:58:34 2016 > New Revision: 309745 > URL: https://svnweb.freebsd.org/changeset/base/309745 >=20 > Log: > Provide counter_ratecheck(), a MP-friendly substitution to ppsratecheck= (). > When rated event happens at a very quick rate, the ppsratecheck() is not > only racy, but also becomes a performance bottleneck. > =20 > Together with: rrs, jtl Glebius, Is it possible for you to MFC this and the following fix to it to 11? Cheers, Hiren --LG5jgFgJbJFFiAfj Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQF8BAABCgBmBQJYWxwOXxSAAAAAAC4AKGlzc3Vlci1mcHJAbm90YXRpb25zLm9w ZW5wZ3AuZmlmdGhob3JzZW1hbi5uZXRBNEUyMEZBMUQ4Nzg4RjNGMTdFNjZGMDI4 QjkyNTBFMTU2M0VERkU1AAoJEIuSUOFWPt/l4fsIAIaLAya5tD8BwlnGK7rNccwp K35nNJJtnrcmm4hkeIpu6ndWJ/k6eSayTWbxITkusPKXQU4sGLGcek7hzSvnHgHy 9kYY4AjwuxYTtrHWKxwSoSKXkjY/Zx9fpIFMxAcAWn1VrFwkN4S1xwWjqLc5+pCc av1V9i3z9mYiwNbmNacdwQMGXz3N5hJMYmw5KHnEqq5cP74lkbNTq+eCvr6fjGEH FYwICJlGRde0q3R5mMZcQ+RDmVuPSQhA6owtyiRScwzIjWP0RfXhZ0ZyfcrmIQKG rqrOWGk4aXL2GwCMl1QTNzxdMxwAB+P/CAkvlCE1uWAamozoGzXHN0qOZsUjAhY= =jCT9 -----END PGP SIGNATURE----- --LG5jgFgJbJFFiAfj-- From owner-svn-src-all@freebsd.org Thu Dec 22 00:35:14 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0BBBCC8BB49; Thu, 22 Dec 2016 00:35:14 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B698AC10; Thu, 22 Dec 2016 00:35:13 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBM0ZCIF041158; Thu, 22 Dec 2016 00:35:12 GMT (envelope-from brooks@FreeBSD.org) Received: (from brooks@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBM0ZCHg041156; Thu, 22 Dec 2016 00:35:12 GMT (envelope-from brooks@FreeBSD.org) Message-Id: <201612220035.uBM0ZCHg041156@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: brooks set sender to brooks@FreeBSD.org using -f From: Brooks Davis Date: Thu, 22 Dec 2016 00:35:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310382 - head/sbin/tunefs X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Dec 2016 00:35:14 -0000 Author: brooks Date: Thu Dec 22 00:35:12 2016 New Revision: 310382 URL: https://svnweb.freebsd.org/changeset/base/310382 Log: Convert tunefs use to nmount(2) Reviewed by: jhb, emaste Sponsored by: DARPA, AFRL Differential Revision: https://reviews.freebsd.org/D8822 Modified: head/sbin/tunefs/Makefile head/sbin/tunefs/tunefs.c Modified: head/sbin/tunefs/Makefile ============================================================================== --- head/sbin/tunefs/Makefile Thu Dec 22 00:09:53 2016 (r310381) +++ head/sbin/tunefs/Makefile Thu Dec 22 00:35:12 2016 (r310382) @@ -3,9 +3,14 @@ PACKAGE=runtime PROG= tunefs +SRCS= tunefs.c getmntopts.c LIBADD= ufs MAN= tunefs.8 +MOUNT= ${SRCTOP}/sbin/mount +CFLAGS+= -I${MOUNT} +.PATH: ${MOUNT} + WARNS= 3 .include Modified: head/sbin/tunefs/tunefs.c ============================================================================== --- head/sbin/tunefs/tunefs.c Thu Dec 22 00:09:53 2016 (r310381) +++ head/sbin/tunefs/tunefs.c Thu Dec 22 00:35:12 2016 (r310382) @@ -59,6 +59,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -93,9 +94,11 @@ main(int argc, char *argv[]) int kvalue, Lflag, lflag, mflag, mvalue, Nflag, nflag, oflag, ovalue; int pflag, sflag, svalue, Svalue, tflag; int ch, found_arg, i; + int iovlen = 0; const char *chg[2]; - struct ufs_args args; struct statfs stfs; + struct iovec *iov = NULL; + char errmsg[255] = {0}; if (argc < 3) usage(); @@ -556,10 +559,16 @@ main(int argc, char *argv[]) goto err; ufs_disk_close(&disk); if (active) { - bzero(&args, sizeof(args)); - if (mount("ufs", on, - stfs.f_flags | MNT_UPDATE | MNT_RELOAD, &args) < 0) - err(9, "%s: reload", special); + build_iovec_argf(&iov, &iovlen, "fstype", "ufs"); + build_iovec_argf(&iov, &iovlen, "fspath", "%s", on); + build_iovec(&iov, &iovlen, "errmsg", errmsg, sizeof(errmsg)); + if (nmount(iov, iovlen, + stfs.f_flags | MNT_UPDATE | MNT_RELOAD) < 0) { + if (errmsg[0]) + err(9, "%s: reload: %s", special, errmsg); + else + err(9, "%s: reload", special); + } warnx("file system reloaded"); } exit(0); From owner-svn-src-all@freebsd.org Thu Dec 22 04:54:37 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id CBF79C8C5F4 for ; Thu, 22 Dec 2016 04:54:37 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-it0-x241.google.com (mail-it0-x241.google.com [IPv6:2607:f8b0:4001:c0b::241]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 94E70F99 for ; Thu, 22 Dec 2016 04:54:37 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-it0-x241.google.com with SMTP id 75so19646622ite.1 for ; Wed, 21 Dec 2016 20:54:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20150623.gappssmtp.com; s=20150623; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=QIfpzdF2wynGF0HCBwLRm5d/rjKYGmtJ2/qzg9jB8LM=; b=XlvupZsXWOFth2Ym40vMLwwLoGhcjBZX9DdDSiO/pv4J3YIdQhgJ2BpIKCerp1h8cV bUmAX5wyGV7vBgqOILh1s45oQJVOMWguodK+YAyuPSdlbKPgWPgtBBxHGzujXsNOZw+Z 21lLZDcDtfDNWkvNnhFZDErPxmLSgavK+jOoNx7O0FHr4XDRhQUkYW4VXZdzLJbXpbOa f8vv7Qsvo8AkcA5Q/4P2c/4r8QByQBRn6xp4KwdwQ2YDCLfTo4tOK2zdsuSGcyiRcQYJ UnR6Ea48QGfbE5Ad4e12DV+FR8z7V7BzobwNiI2UNPH5utNUXhz9G+3ZkNFFaGFtPLhM B8DQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=QIfpzdF2wynGF0HCBwLRm5d/rjKYGmtJ2/qzg9jB8LM=; b=nos4C1byqRFtQ4panZ0IvB1HdgUSZXVyPp1nZsEkqG/Sfb6osW+ZtCpx7psc8AZIZF PDQvxI7nDsooCdMNQ166AWCT2HvGESGro+qnyJfrgnkinETOrFsRxneojo/8G4lR3A+P RvLoAmivp7dcupoZAUKiPMDqCsFA1sk+EBWEGYcs77JVH+Ty1IsHSA5sf21OEGocyxZl vcyEPi5AAPTfDFwBiWhCK3493UXZ3fU7gVbNE6rPpiWBrfjMMe4D6Lv3XgOR9fZ22P+F RVxJdcjS/dzcLK0WcdlJo8+KwCRfkDR63xh/49xJy4K27ukodbxcjpR72s36QV4I80Ha f0bw== X-Gm-Message-State: AIkVDXJ+UxQKTkaXDVfrSPCcIbzfj5BPlIib/LVQ2tArK9rpLwLcGv8wTA5dd4eekf3KzQwgjL+QZnARVoDjSg== X-Received: by 10.36.58.16 with SMTP id m16mr8258559itm.85.1482382476989; Wed, 21 Dec 2016 20:54:36 -0800 (PST) MIME-Version: 1.0 Sender: wlosh@bsdimp.com Received: by 10.79.22.135 with HTTP; Wed, 21 Dec 2016 20:54:36 -0800 (PST) X-Originating-IP: [69.53.245.200] In-Reply-To: References: <201612210829.uBL8Tijt041811@repo.freebsd.org> From: Warner Losh Date: Wed, 21 Dec 2016 21:54:36 -0700 X-Google-Sender-Auth: jg8uwx5qzHbKI9Q2qK6VXYjogI0 Message-ID: Subject: Re: svn commit: r310354 - in head/usr.sbin: . prometheus_sysctl_exporter To: Ed Schouten Cc: Adrian Chadd , Ed Schouten , "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" Content-Type: text/plain; charset=UTF-8 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Dec 2016 04:54:37 -0000 On Wed, Dec 21, 2016 at 12:06 PM, Ed Schouten wrote: > Hi Adrian, > > 2016-12-21 18:32 GMT+01:00 Adrian Chadd : >> Maybe just "sysctl_export" would be fine. > > Good point. Almost all Prometheus metrics exporters use this naming scheme: > > ~80%: ${foo}_exporter > ~20%: prometheus_${foo}_exporter > > Examples; > > - https://github.com/prometheus/node_exporter > - https://github.com/ewr/elasticsearch_exporter > - https://github.com/jonnenauha/prometheus_varnish_exporter > > The reason why I went for the 'prometheus_' prefix was mainly because > of the following totally subjective reasons: > > - I didn't want to wreck tab completion. Right now if you type in > 'sysc' and press tab, it tends to complete to 'sysctl'. > - This tool is part of the base system, meaning that it will be > present even if the user did nothing special. This is why I wanted the > name to be a bit more self-documenting. > - Thinking ahead: what if we're going to add exporters for other > things as well? E.g., for Sendmail, sshd, ftpd, HAST, etc. In that > case it would be nicer if those exporters shared a common prefix. > > That said, if people truly think it's a good idea to call this > sysctl_exporter instead, then I wouldn't mind renaming it. > > Thoughts? Opinions? sysctl_ anything will have my rage filled tab completion beeps sending hate your way for years to come. Please don't do that :) Warner From owner-svn-src-all@freebsd.org Thu Dec 22 05:23:39 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B1BE0C8CFF3; Thu, 22 Dec 2016 05:23:39 +0000 (UTC) (envelope-from hrs@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 72A051DCB; Thu, 22 Dec 2016 05:23:39 +0000 (UTC) (envelope-from hrs@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBM5Nc3s058812; Thu, 22 Dec 2016 05:23:38 GMT (envelope-from hrs@FreeBSD.org) Received: (from hrs@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBM5NcNr058811; Thu, 22 Dec 2016 05:23:38 GMT (envelope-from hrs@FreeBSD.org) Message-Id: <201612220523.uBM5NcNr058811@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hrs set sender to hrs@FreeBSD.org using -f From: Hiroki Sato Date: Thu, 22 Dec 2016 05:23:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310383 - head/usr.sbin/syslogd X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Dec 2016 05:23:39 -0000 Author: hrs Date: Thu Dec 22 05:23:38 2016 New Revision: 310383 URL: https://svnweb.freebsd.org/changeset/base/310383 Log: - Simplify masklen->netmask conversion for AF_INET6. - Use iov[N] by array index instead of using pointer v = &iov[0] to make the compiler catch an out-of-range access of the array. Modified: head/usr.sbin/syslogd/syslogd.c Modified: head/usr.sbin/syslogd/syslogd.c ============================================================================== --- head/usr.sbin/syslogd/syslogd.c Thu Dec 22 00:35:12 2016 (r310382) +++ head/usr.sbin/syslogd/syslogd.c Thu Dec 22 05:23:38 2016 (r310383) @@ -127,9 +127,10 @@ static const char include_ext[] = ".conf #define MAXUNAMES 20 /* maximum number of user names */ #define sstosa(ss) ((struct sockaddr *)(ss)) -#define satosin6(sa) ((struct sockaddr_in6 *)(void *)(sa)) -#define sstosin(ss) ((struct sockaddr_in *)(ss)) +#define sstosin(ss) ((struct sockaddr_in *)(void *)(ss)) #define satosin(sa) ((struct sockaddr_in *)(void *)(sa)) +#define sstosin6(ss) ((struct sockaddr_in6 *)(void *)(ss)) +#define satosin6(sa) ((struct sockaddr_in6 *)(void *)(sa)) #define s6_addr32 __u6_addr.__u6_addr32 #define IN6_ARE_MASKED_ADDR_EQUAL(d, a, m) ( \ (((d)->s6_addr32[0] ^ (a)->s6_addr32[0]) & (m)->s6_addr32[0]) == 0 && \ @@ -1147,37 +1148,40 @@ static void fprintlog(struct filed *f, int flags, const char *msg) { struct iovec iov[IOV_SIZE]; - struct iovec *v; struct addrinfo *r; int l, lsent = 0; char line[MAXLINE + 1], repbuf[80], greetings[200], *wmsg = NULL; char nul[] = "", space[] = " ", lf[] = "\n", crlf[] = "\r\n"; const char *msgret; - v = iov; if (f->f_type == F_WALL) { - v->iov_base = greetings; /* The time displayed is not synchornized with the other log * destinations (like messages). Following fragment was using * ctime(&now), which was updating the time every 30 sec. * With f_lasttime, time is synchronized correctly. */ - v->iov_len = snprintf(greetings, sizeof greetings, - "\r\n\7Message from syslogd@%s at %.24s ...\r\n", - f->f_prevhost, f->f_lasttime); - if (v->iov_len >= sizeof greetings) - v->iov_len = sizeof greetings - 1; - v++; - v->iov_base = nul; - v->iov_len = 0; - v++; + iov[0] = (struct iovec){ + .iov_base = greetings, + .iov_len = snprintf(greetings, sizeof(greetings), + "\r\n\7Message from syslogd@%s " + "at %.24s ...\r\n", + f->f_prevhost, f->f_lasttime) + }; + if (iov[0].iov_len >= sizeof(greetings)) + iov[0].iov_len = sizeof(greetings) - 1; + iov[1] = (struct iovec){ + .iov_base = nul, + .iov_len = 0 + }; } else { - v->iov_base = f->f_lasttime; - v->iov_len = strlen(f->f_lasttime); - v++; - v->iov_base = space; - v->iov_len = 1; - v++; + iov[0] = (struct iovec){ + .iov_base = f->f_lasttime, + .iov_len = strlen(f->f_lasttime) + }; + iov[1] = (struct iovec){ + .iov_base = space, + .iov_len = 1 + }; } if (LogFacPri) { @@ -1214,39 +1218,46 @@ fprintlog(struct filed *f, int flags, co p_s = p_n; } snprintf(fp_buf, sizeof fp_buf, "<%s.%s> ", f_s, p_s); - v->iov_base = fp_buf; - v->iov_len = strlen(fp_buf); + iov[2] = (struct iovec){ + .iov_base = fp_buf, + .iov_len = strlen(fp_buf) + }; } else { - v->iov_base = nul; - v->iov_len = 0; - } - v++; - - v->iov_base = f->f_prevhost; - v->iov_len = strlen(v->iov_base); - v++; - v->iov_base = space; - v->iov_len = 1; - v++; - + iov[2] = (struct iovec){ + .iov_base = nul, + .iov_len = 0 + }; + } + iov[3] = (struct iovec){ + .iov_base = f->f_prevhost, + .iov_len = strlen(f->f_prevhost) + }; + iov[4] = (struct iovec){ + .iov_base = space, + .iov_len = 1 + }; if (msg) { wmsg = strdup(msg); /* XXX iov_base needs a `const' sibling. */ if (wmsg == NULL) { logerror("strdup"); exit(1); } - v->iov_base = wmsg; - v->iov_len = strlen(msg); + iov[5] = (struct iovec){ + .iov_base = wmsg, + .iov_len = strlen(msg) + }; } else if (f->f_prevcount > 1) { - v->iov_base = repbuf; - v->iov_len = snprintf(repbuf, sizeof repbuf, - "last message repeated %d times", f->f_prevcount); + iov[5] = (struct iovec){ + .iov_base = repbuf, + .iov_len = snprintf(repbuf, sizeof(repbuf), + "last message repeated %d times", f->f_prevcount) + }; } else { - v->iov_base = f->f_prevline; - v->iov_len = f->f_prevlen; + iov[5] = (struct iovec){ + .iov_base = f->f_prevline, + .iov_len = f->f_prevlen + }; } - v++; - dprintf("Logging to %s", TypeNames[f->f_type]); f->f_time = now; @@ -1325,8 +1336,10 @@ fprintlog(struct filed *f, int flags, co case F_FILE: dprintf(" %s\n", f->fu_fname); - v->iov_base = lf; - v->iov_len = 1; + iov[6] = (struct iovec){ + .iov_base = lf, + .iov_len = 1 + }; if (writev(f->f_file, iov, nitems(iov)) < 0) { /* * If writev(2) fails for potentially transient errors @@ -1347,8 +1360,10 @@ fprintlog(struct filed *f, int flags, co case F_PIPE: dprintf(" %s\n", f->fu_pipe_pname); - v->iov_base = lf; - v->iov_len = 1; + iov[6] = (struct iovec){ + .iov_base = lf, + .iov_len = 1 + }; if (f->fu_pipe_pid == 0) { if ((f->f_file = p_open(f->fu_pipe_pname, &f->fu_pipe_pid)) < 0) { @@ -1378,9 +1393,10 @@ fprintlog(struct filed *f, int flags, co case F_TTY: dprintf(" %s%s\n", _PATH_DEV, f->fu_fname); - v->iov_base = crlf; - v->iov_len = 2; - + iov[6] = (struct iovec){ + .iov_base = crlf, + .iov_len = 2 + }; errno = 0; /* ttymsg() only sometimes returns an errno */ if ((msgret = ttymsg(iov, nitems(iov), f->fu_fname, 10))) { f->f_type = F_UNUSED; @@ -1391,8 +1407,10 @@ fprintlog(struct filed *f, int flags, co case F_USERS: case F_WALL: dprintf("\n"); - v->iov_base = crlf; - v->iov_len = 2; + iov[6] = (struct iovec){ + .iov_base = crlf, + .iov_len = 2 + }; wallmsg(f, iov, nitems(iov)); break; } @@ -2371,8 +2389,7 @@ allowaddr(char *s) struct addrinfo hints, *res; in_addr_t *addrp, *maskp; #ifdef INET6 - int i; - u_int32_t *addr6p, *mask6p; + uint32_t *addr6p, *mask6p; #endif char ip[NI_MAXHOST]; @@ -2433,8 +2450,8 @@ allowaddr(char *s) memcpy(&ap->a_addr, res->ai_addr, res->ai_addrlen); memset(&ap->a_mask, 0, sizeof(ap->a_mask)); ap->a_mask.ss_family = res->ai_family; + ap->a_mask.ss_len = res->ai_addrlen; if (res->ai_family == AF_INET) { - ap->a_mask.ss_len = sizeof(struct sockaddr_in); maskp = &sstosin(&ap->a_mask)->sin_addr.s_addr; addrp = &sstosin(&ap->a_addr)->sin_addr.s_addr; if (masklen < 0) { @@ -2459,24 +2476,23 @@ allowaddr(char *s) } #ifdef INET6 else if (res->ai_family == AF_INET6 && masklen <= 128) { - ap->a_mask.ss_len = sizeof(struct sockaddr_in6); if (masklen < 0) masklen = 128; - mask6p = (u_int32_t *)&((struct sockaddr_in6 *)&ap->a_mask)->sin6_addr; + mask6p = (uint32_t *)&sstosin6(&ap->a_mask)->sin6_addr.s6_addr32[0]; + addr6p = (uint32_t *)&sstosin6(&ap->a_addr)->sin6_addr.s6_addr32[0]; /* convert masklen to netmask */ while (masklen > 0) { if (masklen < 32) { - *mask6p = htonl(~(0xffffffff >> masklen)); + *mask6p = + htonl(~(0xffffffff >> masklen)); + *addr6p &= *mask6p; break; + } else { + *mask6p++ = 0xffffffff; + addr6p++; + masklen -= 32; } - *mask6p++ = 0xffffffff; - masklen -= 32; } - /* Lose any host bits in the network number. */ - mask6p = (u_int32_t *)&((struct sockaddr_in6 *)&ap->a_mask)->sin6_addr; - addr6p = (u_int32_t *)&((struct sockaddr_in6 *)&ap->a_addr)->sin6_addr; - for (i = 0; i < 4; i++) - addr6p[i] &= mask6p[i]; } #endif else { From owner-svn-src-all@freebsd.org Thu Dec 22 05:28:31 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id EE611C8C283; Thu, 22 Dec 2016 05:28:31 +0000 (UTC) (envelope-from hrs@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id BDCBAFD; Thu, 22 Dec 2016 05:28:31 +0000 (UTC) (envelope-from hrs@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBM5SUOr059017; Thu, 22 Dec 2016 05:28:30 GMT (envelope-from hrs@FreeBSD.org) Received: (from hrs@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBM5SUr1059016; Thu, 22 Dec 2016 05:28:30 GMT (envelope-from hrs@FreeBSD.org) Message-Id: <201612220528.uBM5SUr1059016@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hrs set sender to hrs@FreeBSD.org using -f From: Hiroki Sato Date: Thu, 22 Dec 2016 05:28:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310384 - head/usr.sbin/syslogd X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Dec 2016 05:28:32 -0000 Author: hrs Date: Thu Dec 22 05:28:30 2016 New Revision: 310384 URL: https://svnweb.freebsd.org/changeset/base/310384 Log: Fix debug log in the case of AF_INET6. Modified: head/usr.sbin/syslogd/syslogd.c Modified: head/usr.sbin/syslogd/syslogd.c ============================================================================== --- head/usr.sbin/syslogd/syslogd.c Thu Dec 22 05:23:38 2016 (r310383) +++ head/usr.sbin/syslogd/syslogd.c Thu Dec 22 05:28:30 2016 (r310384) @@ -1262,17 +1262,23 @@ fprintlog(struct filed *f, int flags, co f->f_time = now; switch (f->f_type) { - int port; case F_UNUSED: dprintf("\n"); break; case F_FORW: - port = ntohs(satosin(f->fu_forw_addr->ai_addr)->sin_port); - if (port != 514) { - dprintf(" %s:%d\n", f->fu_forw_hname, port); - } else { - dprintf(" %s\n", f->fu_forw_hname); + dprintf(" %s", f->fu_forw_hname); + switch (f->fu_forw_addr->ai_addr->sa_family) { + case AF_INET: + dprintf(":%d\n", + ntohs(satosin(f->fu_forw_addr->ai_addr)->sin_port)); + break; +#ifdef INET6 + case AF_INET6: + dprintf(":%d\n", + ntohs(satosin6(f->fu_forw_addr->ai_addr)->sin6_port)); + break; +#endif } /* check for local vs remote messages */ if (strcasecmp(f->f_prevhost, LocalHostName)) From owner-svn-src-all@freebsd.org Thu Dec 22 05:55:46 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 284E1C8CDF0; Thu, 22 Dec 2016 05:55:46 +0000 (UTC) (envelope-from hrs@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 02C1412E0; Thu, 22 Dec 2016 05:55:45 +0000 (UTC) (envelope-from hrs@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBM5tjsu071125; Thu, 22 Dec 2016 05:55:45 GMT (envelope-from hrs@FreeBSD.org) Received: (from hrs@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBM5tjKC071124; Thu, 22 Dec 2016 05:55:45 GMT (envelope-from hrs@FreeBSD.org) Message-Id: <201612220555.uBM5tjKC071124@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hrs set sender to hrs@FreeBSD.org using -f From: Hiroki Sato Date: Thu, 22 Dec 2016 05:55:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310385 - head/usr.sbin/syslogd X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Dec 2016 05:55:46 -0000 Author: hrs Date: Thu Dec 22 05:55:44 2016 New Revision: 310385 URL: https://svnweb.freebsd.org/changeset/base/310385 Log: Initialize a structure by using a compound literal to avoid forgetting to zero unspecified members. Modified: head/usr.sbin/syslogd/syslogd.c Modified: head/usr.sbin/syslogd/syslogd.c ============================================================================== --- head/usr.sbin/syslogd/syslogd.c Thu Dec 22 05:28:30 2016 (r310384) +++ head/usr.sbin/syslogd/syslogd.c Thu Dec 22 05:55:44 2016 (r310385) @@ -425,7 +425,6 @@ main(int argc, char *argv[]) int ch, i, s, fdsrmax = 0, bflag = 0, pflag = 0, Sflag = 0; fd_set *fdsr = NULL; struct timeval tv, *tvp; - struct sigaction sact; struct peer *pe; struct socklist *sl; sigset_t mask; @@ -633,10 +632,11 @@ main(int argc, char *argv[]) */ sigemptyset(&mask); sigaddset(&mask, SIGHUP); - sact.sa_handler = reapchild; - sact.sa_mask = mask; - sact.sa_flags = SA_RESTART; - (void)sigaction(SIGCHLD, &sact, NULL); + (void)sigaction(SIGCHLD, &(struct sigaction){ + .sa_handler = reapchild, + .sa_mask = mask, + .sa_flags = SA_RESTART + }, NULL); (void)signal(SIGALRM, domark); (void)signal(SIGPIPE, SIG_IGN); /* We'll catch EPIPE instead. */ (void)alarm(TIMERINTVL); @@ -650,10 +650,11 @@ main(int argc, char *argv[]) /* prevent SIGHUP and SIGCHLD handlers from running in parallel */ sigemptyset(&mask); sigaddset(&mask, SIGCHLD); - sact.sa_handler = init; - sact.sa_mask = mask; - sact.sa_flags = SA_RESTART; - (void)sigaction(SIGHUP, &sact, NULL); + (void)sigaction(SIGHUP, &(struct sigaction){ + .sa_handler = init, + .sa_mask = mask, + .sa_flags = SA_RESTART + }, NULL); tvp = &tv; tv.tv_sec = tv.tv_usec = 0; @@ -750,7 +751,7 @@ static void unmapped(struct sockaddr *sa) { struct sockaddr_in6 *sin6; - struct sockaddr_in sin4; + struct sockaddr_in sin; if (sa == NULL || sa->sa_family != AF_INET6 || @@ -759,15 +760,14 @@ unmapped(struct sockaddr *sa) sin6 = satosin6(sa); if (!IN6_IS_ADDR_V4MAPPED(&sin6->sin6_addr)) return; - - memset(&sin4, 0, sizeof(sin4)); - sin4.sin_family = AF_INET; - sin4.sin_len = sizeof(sin4); - memcpy(&sin4.sin_addr, &sin6->sin6_addr.s6_addr[12], - sizeof(sin4.sin_addr)); - sin4.sin_port = sin6->sin6_port; - - memcpy(sa, &sin4, sin4.sin_len); + sin = (struct sockaddr_in){ + .sin_family = AF_INET, + .sin_len = sizeof(sin), + .sin_port = sin6->sin6_port + }; + memcpy(&sin.sin_addr, &sin6->sin6_addr.s6_addr[12], + sizeof(sin.sin_addr)); + memcpy(sa, &sin, sizeof(sin)); } static void @@ -2154,9 +2154,10 @@ cfline(const char *line, const char *pro else p = NULL; - memset(&hints, 0, sizeof(hints)); - hints.ai_family = family; - hints.ai_socktype = SOCK_DGRAM; + hints = (struct addrinfo){ + .ai_family = family, + .ai_socktype = SOCK_DGRAM + }; error = getaddrinfo(f->fu_forw_hname, p ? p : "syslog", &hints, &res); if (error) { @@ -2447,16 +2448,18 @@ allowaddr(char *s) cp2 = NULL; } #endif - memset(&hints, 0, sizeof(hints)); - hints.ai_family = PF_UNSPEC; - hints.ai_socktype = SOCK_DGRAM; - hints.ai_flags = AI_PASSIVE | AI_NUMERICHOST; + hints = (struct addrinfo){ + .ai_family = PF_UNSPEC, + .ai_socktype = SOCK_DGRAM, + .ai_flags = AI_PASSIVE | AI_NUMERICHOST + }; if (getaddrinfo(s, NULL, &hints, &res) == 0) { ap->isnumeric = 1; memcpy(&ap->a_addr, res->ai_addr, res->ai_addrlen); - memset(&ap->a_mask, 0, sizeof(ap->a_mask)); - ap->a_mask.ss_family = res->ai_family; - ap->a_mask.ss_len = res->ai_addrlen; + ap->a_mask = (struct sockaddr_storage){ + .ss_family = res->ai_family, + .ss_len = res->ai_addrlen + }; if (res->ai_family == AF_INET) { maskp = &sstosin(&ap->a_mask)->sin_addr.s_addr; addrp = &sstosin(&ap->a_addr)->sin_addr.s_addr; @@ -2567,10 +2570,11 @@ validate(struct sockaddr *sa, const char return (1); (void)strlcpy(name, hname, sizeof(name)); - memset(&hints, 0, sizeof(hints)); - hints.ai_family = PF_UNSPEC; - hints.ai_socktype = SOCK_DGRAM; - hints.ai_flags = AI_PASSIVE | AI_NUMERICHOST; + hints = (struct addrinfo){ + .ai_family = PF_UNSPEC, + .ai_socktype = SOCK_DGRAM, + .ai_flags = AI_PASSIVE | AI_NUMERICHOST + }; if (getaddrinfo(name, NULL, &hints, &res) == 0) freeaddrinfo(res); else if (strchr(name, '.') == NULL) { @@ -2751,9 +2755,10 @@ deadq_enter(pid_t pid, const char *name) logerror("malloc"); exit(1); } - - p->dq_pid = pid; - p->dq_timeout = DQ_TIMO_INIT; + *p = (struct deadq_entry){ + .dq_pid = pid, + .dq_timeout = DQ_TIMO_INIT + }; TAILQ_INSERT_TAIL(&deadq_head, p, dq_entries); } @@ -2831,11 +2836,11 @@ socksetup(struct peer *pe) } #endif } - memset(&hints, 0, sizeof(hints)); - hints.ai_family = AF_UNSPEC; - hints.ai_socktype = SOCK_DGRAM; - hints.ai_flags = AI_PASSIVE; - + hints = (struct addrinfo){ + .ai_family = AF_UNSPEC, + .ai_socktype = SOCK_DGRAM, + .ai_flags = AI_PASSIVE + }; dprintf("Try %s\n", pe->pe_name); if (pe->pe_serv == NULL) pe->pe_serv = "syslog"; @@ -2847,7 +2852,6 @@ socksetup(struct peer *pe) } for (res = res0; res != NULL; res = res->ai_next) { int s; - int on = 1; if (res->ai_family == AF_LOCAL) unlink(pe->pe_name); @@ -2868,7 +2872,7 @@ socksetup(struct peer *pe) #ifdef INET6 if (res->ai_family == AF_INET6) { if (setsockopt(s, IPPROTO_IPV6, IPV6_V6ONLY, - (char *)&on, sizeof(on)) < 0) { + &(int){1}, sizeof(int)) < 0) { logerror("setsockopt(IPV6_V6ONLY)"); close(s); error++; @@ -2877,7 +2881,7 @@ socksetup(struct peer *pe) } #endif if (setsockopt(s, SOL_SOCKET, SO_REUSEADDR, - (char *)&on, sizeof(on)) < 0) { + &(int){1}, sizeof(int)) < 0) { logerror("setsockopt(SO_REUSEADDR)"); close(s); error++; @@ -2938,11 +2942,10 @@ socksetup(struct peer *pe) static void increase_rcvbuf(int fd) { - socklen_t len, slen; - - slen = sizeof(len); + socklen_t len; - if (getsockopt(fd, SOL_SOCKET, SO_RCVBUF, &len, &slen) == 0) { + if (getsockopt(fd, SOL_SOCKET, SO_RCVBUF, &len, + &(socklen_t){sizeof(len)}) == 0) { if (len < RCVBUF_MINSIZE) { len = RCVBUF_MINSIZE; setsockopt(fd, SOL_SOCKET, SO_RCVBUF, &len, sizeof(len)); From owner-svn-src-all@freebsd.org Thu Dec 22 05:57:47 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 35547C8CF50; Thu, 22 Dec 2016 05:57:47 +0000 (UTC) (envelope-from hrs@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 04F6C152F; Thu, 22 Dec 2016 05:57:46 +0000 (UTC) (envelope-from hrs@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBM5vkUg071232; Thu, 22 Dec 2016 05:57:46 GMT (envelope-from hrs@FreeBSD.org) Received: (from hrs@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBM5vkbO071231; Thu, 22 Dec 2016 05:57:46 GMT (envelope-from hrs@FreeBSD.org) Message-Id: <201612220557.uBM5vkbO071231@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hrs set sender to hrs@FreeBSD.org using -f From: Hiroki Sato Date: Thu, 22 Dec 2016 05:57:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310386 - head/usr.sbin/syslogd X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Dec 2016 05:57:47 -0000 Author: hrs Date: Thu Dec 22 05:57:45 2016 New Revision: 310386 URL: https://svnweb.freebsd.org/changeset/base/310386 Log: Add a missing "default:" case. Modified: head/usr.sbin/syslogd/syslogd.c Modified: head/usr.sbin/syslogd/syslogd.c ============================================================================== --- head/usr.sbin/syslogd/syslogd.c Thu Dec 22 05:55:44 2016 (r310385) +++ head/usr.sbin/syslogd/syslogd.c Thu Dec 22 05:57:45 2016 (r310386) @@ -1279,6 +1279,8 @@ fprintlog(struct filed *f, int flags, co ntohs(satosin6(f->fu_forw_addr->ai_addr)->sin6_port)); break; #endif + default: + dprintf("\n"); } /* check for local vs remote messages */ if (strcasecmp(f->f_prevhost, LocalHostName)) From owner-svn-src-all@freebsd.org Thu Dec 22 10:11:04 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C8A11C8A4E7; Thu, 22 Dec 2016 10:11:04 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 8AE1313A7; Thu, 22 Dec 2016 10:11:04 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBMAB3tc072110; Thu, 22 Dec 2016 10:11:03 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBMAB3vW072109; Thu, 22 Dec 2016 10:11:03 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201612221011.uBMAB3vW072109@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 22 Dec 2016 10:11:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310387 - head/sys/dev/mlx5/mlx5_en X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Dec 2016 10:11:04 -0000 Author: hselasky Date: Thu Dec 22 10:11:03 2016 New Revision: 310387 URL: https://svnweb.freebsd.org/changeset/base/310387 Log: Add more comments regarding collection of statistics counters. Sponsored by: Mellanox Technologies MFC after: 1 week Modified: head/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Modified: head/sys/dev/mlx5/mlx5_en/mlx5_en_main.c ============================================================================== --- head/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Thu Dec 22 05:57:45 2016 (r310386) +++ head/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Thu Dec 22 10:11:03 2016 (r310387) @@ -306,6 +306,12 @@ mlx5e_update_carrier_work(struct work_st PRIV_UNLOCK(priv); } +/* + * This function reads the physical port counters from the firmware + * using a pre-defined layout defined by various MLX5E_PPORT_XXX() + * macros. The output is converted from big-endian 64-bit values into + * host endian ones and stored in the "priv->stats.pport" structure. + */ static void mlx5e_update_pport_counters(struct mlx5e_priv *priv) { @@ -319,20 +325,27 @@ mlx5e_update_pport_counters(struct mlx5e unsigned x; unsigned y; + /* allocate firmware request structures */ in = mlx5_vzalloc(sz); out = mlx5_vzalloc(sz); if (in == NULL || out == NULL) goto free_out; + /* + * Get pointer to the 64-bit counter set which is located at a + * fixed offset in the output firmware request structure: + */ ptr = (uint64_t *)MLX5_ADDR_OF(ppcnt_reg, out, counter_set); MLX5_SET(ppcnt_reg, in, local_port, 1); + /* read IEEE802_3 counter group using predefined counter layout */ MLX5_SET(ppcnt_reg, in, grp, MLX5_IEEE_802_3_COUNTERS_GROUP); mlx5_core_access_reg(mdev, in, sz, out, sz, MLX5_REG_PPCNT, 0, 0); for (x = y = 0; x != MLX5E_PPORT_IEEE802_3_STATS_NUM; x++, y++) s->arg[y] = be64toh(ptr[x]); + /* read RFC2819 counter group using predefined counter layout */ MLX5_SET(ppcnt_reg, in, grp, MLX5_RFC_2819_COUNTERS_GROUP); mlx5_core_access_reg(mdev, in, sz, out, sz, MLX5_REG_PPCNT, 0, 0); for (x = 0; x != MLX5E_PPORT_RFC2819_STATS_NUM; x++, y++) @@ -341,20 +354,29 @@ mlx5e_update_pport_counters(struct mlx5e MLX5E_PPORT_RFC2819_STATS_DEBUG_NUM; x++, y++) s_debug->arg[y] = be64toh(ptr[x]); + /* read RFC2863 counter group using predefined counter layout */ MLX5_SET(ppcnt_reg, in, grp, MLX5_RFC_2863_COUNTERS_GROUP); mlx5_core_access_reg(mdev, in, sz, out, sz, MLX5_REG_PPCNT, 0, 0); for (x = 0; x != MLX5E_PPORT_RFC2863_STATS_DEBUG_NUM; x++, y++) s_debug->arg[y] = be64toh(ptr[x]); + /* read physical layer stats counter group using predefined counter layout */ MLX5_SET(ppcnt_reg, in, grp, MLX5_PHYSICAL_LAYER_COUNTERS_GROUP); mlx5_core_access_reg(mdev, in, sz, out, sz, MLX5_REG_PPCNT, 0, 0); for (x = 0; x != MLX5E_PPORT_PHYSICAL_LAYER_STATS_DEBUG_NUM; x++, y++) s_debug->arg[y] = be64toh(ptr[x]); free_out: + /* free firmware request structures */ kvfree(in); kvfree(out); } +/* + * This function is called regularly to collect all statistics + * counters from the firmware. The values can be viewed through the + * sysctl interface. Execution is serialized using the priv's global + * configuration lock. + */ static void mlx5e_update_stats_work(struct work_struct *work) { From owner-svn-src-all@freebsd.org Thu Dec 22 10:12:20 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E400BC8A6ED; Thu, 22 Dec 2016 10:12:20 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id ACBB6167D; Thu, 22 Dec 2016 10:12:20 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBMACJV2075663; Thu, 22 Dec 2016 10:12:19 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBMACJQB075662; Thu, 22 Dec 2016 10:12:19 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201612221012.uBMACJQB075662@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 22 Dec 2016 10:12:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310388 - head/sys/dev/mlx5/mlx5_en X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Dec 2016 10:12:21 -0000 Author: hselasky Date: Thu Dec 22 10:12:19 2016 New Revision: 310388 URL: https://svnweb.freebsd.org/changeset/base/310388 Log: Make a read only pointer constant. Sponsored by: Mellanox Technologies MFC after: 1 week Modified: head/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Modified: head/sys/dev/mlx5/mlx5_en/mlx5_en_main.c ============================================================================== --- head/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Thu Dec 22 10:11:03 2016 (r310387) +++ head/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Thu Dec 22 10:12:19 2016 (r310388) @@ -320,7 +320,7 @@ mlx5e_update_pport_counters(struct mlx5e struct mlx5e_port_stats_debug *s_debug = &priv->stats.port_stats_debug; u32 *in; u32 *out; - u64 *ptr; + const u64 *ptr; unsigned sz = MLX5_ST_SZ_BYTES(ppcnt_reg); unsigned x; unsigned y; @@ -335,7 +335,7 @@ mlx5e_update_pport_counters(struct mlx5e * Get pointer to the 64-bit counter set which is located at a * fixed offset in the output firmware request structure: */ - ptr = (uint64_t *)MLX5_ADDR_OF(ppcnt_reg, out, counter_set); + ptr = (const uint64_t *)MLX5_ADDR_OF(ppcnt_reg, out, counter_set); MLX5_SET(ppcnt_reg, in, local_port, 1); From owner-svn-src-all@freebsd.org Thu Dec 22 11:10:12 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id ADDA5C8B99B; Thu, 22 Dec 2016 11:10:12 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 71A6714C6; Thu, 22 Dec 2016 11:10:12 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBMBABx5095989; Thu, 22 Dec 2016 11:10:11 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBMBABC9095987; Thu, 22 Dec 2016 11:10:11 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201612221110.uBMBABC9095987@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Thu, 22 Dec 2016 11:10:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310389 - head/sys/cam/ctl X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Dec 2016 11:10:12 -0000 Author: mav Date: Thu Dec 22 11:10:11 2016 New Revision: 310389 URL: https://svnweb.freebsd.org/changeset/base/310389 Log: Fix REPORT SUPPORTED OPERATION CODES for READ/WRITE BUFFER commands. Specifications require MODE parameter of those commands to be treated the same as SERVICE ACTION parameter of other commands. MFC after: 2 weeks Modified: head/sys/cam/ctl/ctl.c head/sys/cam/ctl/ctl_cmd_table.c Modified: head/sys/cam/ctl/ctl.c ============================================================================== --- head/sys/cam/ctl/ctl.c Thu Dec 22 10:12:19 2016 (r310388) +++ head/sys/cam/ctl/ctl.c Thu Dec 22 11:10:11 2016 (r310389) @@ -5517,19 +5517,6 @@ ctl_read_buffer(struct ctl_scsiio *ctsio return (CTL_RETVAL_COMPLETE); } - if ((byte2 & RWB_MODE) != RWB_MODE_DATA && - (byte2 & RWB_MODE) != RWB_MODE_ECHO_DESCR && - (byte2 & RWB_MODE) != RWB_MODE_DESCR) { - ctl_set_invalid_field(ctsio, - /*sks_valid*/ 1, - /*command*/ 1, - /*field*/ 1, - /*bit_valid*/ 1, - /*bit*/ 4); - ctl_done((union ctl_io *)ctsio); - return (CTL_RETVAL_COMPLETE); - } - if (buffer_offset > CTL_WRITE_BUFFER_SIZE || buffer_offset + len > CTL_WRITE_BUFFER_SIZE) { ctl_set_invalid_field(ctsio, @@ -5580,17 +5567,6 @@ ctl_write_buffer(struct ctl_scsiio *ctsi lun = (struct ctl_lun *)ctsio->io_hdr.ctl_private[CTL_PRIV_LUN].ptr; cdb = (struct scsi_write_buffer *)ctsio->cdb; - if ((cdb->byte2 & RWB_MODE) != RWB_MODE_DATA) { - ctl_set_invalid_field(ctsio, - /*sks_valid*/ 1, - /*command*/ 1, - /*field*/ 1, - /*bit_valid*/ 1, - /*bit*/ 4); - ctl_done((union ctl_io *)ctsio); - return (CTL_RETVAL_COMPLETE); - } - len = scsi_3btoul(cdb->length); buffer_offset = scsi_3btoul(cdb->offset); Modified: head/sys/cam/ctl/ctl_cmd_table.c ============================================================================== --- head/sys/cam/ctl/ctl_cmd_table.c Thu Dec 22 10:12:19 2016 (r310388) +++ head/sys/cam/ctl/ctl_cmd_table.c Thu Dec 22 11:10:11 2016 (r310389) @@ -62,6 +62,215 @@ * tables. */ +/* 3B WRITE BUFFER */ +const struct ctl_cmd_entry ctl_cmd_table_3b[32] = +{ +/* 00 WRITE BUFFER HDR DATA */ +{NULL, CTL_SERIDX_INVLD, CTL_CMD_FLAG_NONE, CTL_LUN_PAT_NONE}, + +/* 01 WRITE BUFFER VENDOR */ +{NULL, CTL_SERIDX_INVLD, CTL_CMD_FLAG_NONE, CTL_LUN_PAT_NONE}, + +/* 02 WRITE BUFFER DATA */ +{ctl_write_buffer, CTL_SERIDX_MD_SEL, CTL_CMD_FLAG_OK_ON_BOTH | + CTL_CMD_FLAG_OK_ON_NO_MEDIA | + CTL_CMD_FLAG_OK_ON_STANDBY | + CTL_FLAG_DATA_OUT, + CTL_LUN_PAT_NONE, + 10, {0x02, 0, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x07}}, + +/* 03 WRITE BUFFER DESCR */ +{NULL, CTL_SERIDX_INVLD, CTL_CMD_FLAG_NONE, CTL_LUN_PAT_NONE}, + +/* 04 WRITE BUFFER DOWNLOAD */ +{NULL, CTL_SERIDX_INVLD, CTL_CMD_FLAG_NONE, CTL_LUN_PAT_NONE}, + +/* 05 WRITE BUFFER DOWNLOAD SAVE */ +{NULL, CTL_SERIDX_INVLD, CTL_CMD_FLAG_NONE, CTL_LUN_PAT_NONE}, + +/* 06 */ +{NULL, CTL_SERIDX_INVLD, CTL_CMD_FLAG_NONE, CTL_LUN_PAT_NONE}, + +/* 07 */ +{NULL, CTL_SERIDX_INVLD, CTL_CMD_FLAG_NONE, CTL_LUN_PAT_NONE}, + +/* 08 */ +{NULL, CTL_SERIDX_INVLD, CTL_CMD_FLAG_NONE, CTL_LUN_PAT_NONE}, + +/* 09 */ +{NULL, CTL_SERIDX_INVLD, CTL_CMD_FLAG_NONE, CTL_LUN_PAT_NONE}, + +/* 0A WRITE BUFFER ECHO */ +{NULL, CTL_SERIDX_INVLD, CTL_CMD_FLAG_NONE, CTL_LUN_PAT_NONE}, + +/* 0B WRITE BUFFER ECHO DESCRIPTOR */ +{NULL, CTL_SERIDX_INVLD, CTL_CMD_FLAG_NONE, CTL_LUN_PAT_NONE}, + +/* 0C */ +{NULL, CTL_SERIDX_INVLD, CTL_CMD_FLAG_NONE, CTL_LUN_PAT_NONE}, + +/* 0D */ +{NULL, CTL_SERIDX_INVLD, CTL_CMD_FLAG_NONE, CTL_LUN_PAT_NONE}, + +/* 0E */ +{NULL, CTL_SERIDX_INVLD, CTL_CMD_FLAG_NONE, CTL_LUN_PAT_NONE}, + +/* 0F */ +{NULL, CTL_SERIDX_INVLD, CTL_CMD_FLAG_NONE, CTL_LUN_PAT_NONE}, + +/* 10 */ +{NULL, CTL_SERIDX_INVLD, CTL_CMD_FLAG_NONE, CTL_LUN_PAT_NONE}, + +/* 11 */ +{NULL, CTL_SERIDX_INVLD, CTL_CMD_FLAG_NONE, CTL_LUN_PAT_NONE}, + +/* 12 */ +{NULL, CTL_SERIDX_INVLD, CTL_CMD_FLAG_NONE, CTL_LUN_PAT_NONE}, + +/* 13 */ +{NULL, CTL_SERIDX_INVLD, CTL_CMD_FLAG_NONE, CTL_LUN_PAT_NONE}, + +/* 14 */ +{NULL, CTL_SERIDX_INVLD, CTL_CMD_FLAG_NONE, CTL_LUN_PAT_NONE}, + +/* 15 */ +{NULL, CTL_SERIDX_INVLD, CTL_CMD_FLAG_NONE, CTL_LUN_PAT_NONE}, + +/* 16 */ +{NULL, CTL_SERIDX_INVLD, CTL_CMD_FLAG_NONE, CTL_LUN_PAT_NONE}, + +/* 17 */ +{NULL, CTL_SERIDX_INVLD, CTL_CMD_FLAG_NONE, CTL_LUN_PAT_NONE}, + +/* 18 */ +{NULL, CTL_SERIDX_INVLD, CTL_CMD_FLAG_NONE, CTL_LUN_PAT_NONE}, + +/* 19 */ +{NULL, CTL_SERIDX_INVLD, CTL_CMD_FLAG_NONE, CTL_LUN_PAT_NONE}, + +/* 1A */ +{NULL, CTL_SERIDX_INVLD, CTL_CMD_FLAG_NONE, CTL_LUN_PAT_NONE}, + +/* 1B */ +{NULL, CTL_SERIDX_INVLD, CTL_CMD_FLAG_NONE, CTL_LUN_PAT_NONE}, + +/* 1C WRITE BUFFER ERROR HISTORY */ +{NULL, CTL_SERIDX_INVLD, CTL_CMD_FLAG_NONE, CTL_LUN_PAT_NONE}, + +/* 1d-1f */ +}; + +/* 3C READ BUFFER(10) */ +const struct ctl_cmd_entry ctl_cmd_table_3c[32] = +{ +/* 00 READ BUFFER(10) HDR DATA */ +{NULL, CTL_SERIDX_INVLD, CTL_CMD_FLAG_NONE, CTL_LUN_PAT_NONE}, + +/* 01 READ BUFFER(10) VENDOR */ +{NULL, CTL_SERIDX_INVLD, CTL_CMD_FLAG_NONE, CTL_LUN_PAT_NONE}, + +/* 02 READ BUFFER(10) DATA */ +{ctl_read_buffer, CTL_SERIDX_MD_SNS, CTL_CMD_FLAG_OK_ON_BOTH | + CTL_CMD_FLAG_OK_ON_NO_MEDIA | + CTL_CMD_FLAG_OK_ON_STANDBY | + CTL_FLAG_DATA_IN | + CTL_CMD_FLAG_ALLOW_ON_PR_WRESV, + CTL_LUN_PAT_NONE, + 10, {0x02, 0, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x07}}, + +/* 03 READ BUFFER(10) DESCR */ +{ctl_read_buffer, CTL_SERIDX_MD_SNS, CTL_CMD_FLAG_OK_ON_BOTH | + CTL_CMD_FLAG_OK_ON_NO_MEDIA | + CTL_CMD_FLAG_OK_ON_STANDBY | + CTL_FLAG_DATA_IN | + CTL_CMD_FLAG_ALLOW_ON_PR_WRESV, + CTL_LUN_PAT_NONE, + 10, {0x03, 0, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x07}}, + +/* 04 */ +{NULL, CTL_SERIDX_INVLD, CTL_CMD_FLAG_NONE, CTL_LUN_PAT_NONE}, + +/* 05 */ +{NULL, CTL_SERIDX_INVLD, CTL_CMD_FLAG_NONE, CTL_LUN_PAT_NONE}, + +/* 06 */ +{NULL, CTL_SERIDX_INVLD, CTL_CMD_FLAG_NONE, CTL_LUN_PAT_NONE}, + +/* 07 */ +{NULL, CTL_SERIDX_INVLD, CTL_CMD_FLAG_NONE, CTL_LUN_PAT_NONE}, + +/* 08 */ +{NULL, CTL_SERIDX_INVLD, CTL_CMD_FLAG_NONE, CTL_LUN_PAT_NONE}, + +/* 09 */ +{NULL, CTL_SERIDX_INVLD, CTL_CMD_FLAG_NONE, CTL_LUN_PAT_NONE}, + +/* 0A READ BUFFER(10) ECHO */ +{NULL, CTL_SERIDX_INVLD, CTL_CMD_FLAG_NONE, CTL_LUN_PAT_NONE}, + +/* 0B READ BUFFER(10) ECHO DESCRIPTOR */ +{ctl_read_buffer, CTL_SERIDX_MD_SNS, CTL_CMD_FLAG_OK_ON_BOTH | + CTL_CMD_FLAG_OK_ON_NO_MEDIA | + CTL_CMD_FLAG_OK_ON_STANDBY | + CTL_FLAG_DATA_IN | + CTL_CMD_FLAG_ALLOW_ON_PR_WRESV, + CTL_LUN_PAT_NONE, + 10, {0x0b, 0, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x07}}, + +/* 0C */ +{NULL, CTL_SERIDX_INVLD, CTL_CMD_FLAG_NONE, CTL_LUN_PAT_NONE}, + +/* 0D */ +{NULL, CTL_SERIDX_INVLD, CTL_CMD_FLAG_NONE, CTL_LUN_PAT_NONE}, + +/* 0E */ +{NULL, CTL_SERIDX_INVLD, CTL_CMD_FLAG_NONE, CTL_LUN_PAT_NONE}, + +/* 0F */ +{NULL, CTL_SERIDX_INVLD, CTL_CMD_FLAG_NONE, CTL_LUN_PAT_NONE}, + +/* 10 */ +{NULL, CTL_SERIDX_INVLD, CTL_CMD_FLAG_NONE, CTL_LUN_PAT_NONE}, + +/* 11 */ +{NULL, CTL_SERIDX_INVLD, CTL_CMD_FLAG_NONE, CTL_LUN_PAT_NONE}, + +/* 12 */ +{NULL, CTL_SERIDX_INVLD, CTL_CMD_FLAG_NONE, CTL_LUN_PAT_NONE}, + +/* 13 */ +{NULL, CTL_SERIDX_INVLD, CTL_CMD_FLAG_NONE, CTL_LUN_PAT_NONE}, + +/* 14 */ +{NULL, CTL_SERIDX_INVLD, CTL_CMD_FLAG_NONE, CTL_LUN_PAT_NONE}, + +/* 15 */ +{NULL, CTL_SERIDX_INVLD, CTL_CMD_FLAG_NONE, CTL_LUN_PAT_NONE}, + +/* 16 */ +{NULL, CTL_SERIDX_INVLD, CTL_CMD_FLAG_NONE, CTL_LUN_PAT_NONE}, + +/* 17 */ +{NULL, CTL_SERIDX_INVLD, CTL_CMD_FLAG_NONE, CTL_LUN_PAT_NONE}, + +/* 18 */ +{NULL, CTL_SERIDX_INVLD, CTL_CMD_FLAG_NONE, CTL_LUN_PAT_NONE}, + +/* 19 */ +{NULL, CTL_SERIDX_INVLD, CTL_CMD_FLAG_NONE, CTL_LUN_PAT_NONE}, + +/* 1A */ +{NULL, CTL_SERIDX_INVLD, CTL_CMD_FLAG_NONE, CTL_LUN_PAT_NONE}, + +/* 1B */ +{NULL, CTL_SERIDX_INVLD, CTL_CMD_FLAG_NONE, CTL_LUN_PAT_NONE}, + +/* 1C READ BUFFER(10) ERROR HISTORY */ +{NULL, CTL_SERIDX_INVLD, CTL_CMD_FLAG_NONE, CTL_LUN_PAT_NONE}, + +/* 1d-1f */ +}; + /* 5E PERSISTENT RESERVE IN */ const struct ctl_cmd_entry ctl_cmd_table_5e[32] = { @@ -367,6 +576,118 @@ const struct ctl_cmd_entry ctl_cmd_table 16, {0x08, 0, 0, 0, 0, 0, 0, 0, 0, 0xff, 0xff, 0xff, 0xff, 0, 0x07}}, }; +/* 9B READ BUFFER(16) */ +const struct ctl_cmd_entry ctl_cmd_table_9b[32] = +{ +/* 00 READ BUFFER(16) HDR DATA */ +{NULL, CTL_SERIDX_INVLD, CTL_CMD_FLAG_NONE, CTL_LUN_PAT_NONE}, + +/* 01 READ BUFFER(16) VENDOR */ +{NULL, CTL_SERIDX_INVLD, CTL_CMD_FLAG_NONE, CTL_LUN_PAT_NONE}, + +/* 02 READ BUFFER(16) DATA */ +{ctl_read_buffer, CTL_SERIDX_MD_SNS, CTL_CMD_FLAG_OK_ON_BOTH | + CTL_CMD_FLAG_OK_ON_NO_MEDIA | + CTL_CMD_FLAG_OK_ON_STANDBY | + CTL_FLAG_DATA_IN, + CTL_LUN_PAT_NONE, + 16, {0x02, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0, 0x07}}, + +/* 03 READ BUFFER(16) DESCR */ +{ctl_read_buffer, CTL_SERIDX_MD_SNS, CTL_CMD_FLAG_OK_ON_BOTH | + CTL_CMD_FLAG_OK_ON_NO_MEDIA | + CTL_CMD_FLAG_OK_ON_STANDBY | + CTL_FLAG_DATA_IN, + CTL_LUN_PAT_NONE, + 16, {0x03, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0, 0x07}}, + +/* 04 READ BUFFER(16) */ +{NULL, CTL_SERIDX_INVLD, CTL_CMD_FLAG_NONE, CTL_LUN_PAT_NONE}, + +/* 05 READ BUFFER(16) */ +{NULL, CTL_SERIDX_INVLD, CTL_CMD_FLAG_NONE, CTL_LUN_PAT_NONE}, + +/* 06 */ +{NULL, CTL_SERIDX_INVLD, CTL_CMD_FLAG_NONE, CTL_LUN_PAT_NONE}, + +/* 07 */ +{NULL, CTL_SERIDX_INVLD, CTL_CMD_FLAG_NONE, CTL_LUN_PAT_NONE}, + +/* 08 */ +{NULL, CTL_SERIDX_INVLD, CTL_CMD_FLAG_NONE, CTL_LUN_PAT_NONE}, + +/* 09 */ +{NULL, CTL_SERIDX_INVLD, CTL_CMD_FLAG_NONE, CTL_LUN_PAT_NONE}, + +/* 0A READ BUFFER(16) ECHO */ +{NULL, CTL_SERIDX_INVLD, CTL_CMD_FLAG_NONE, CTL_LUN_PAT_NONE}, + +/* 0B READ BUFFER(16) ECHO DESCRIPTOR */ +{ctl_read_buffer, CTL_SERIDX_MD_SNS, CTL_CMD_FLAG_OK_ON_BOTH | + CTL_CMD_FLAG_OK_ON_NO_MEDIA | + CTL_CMD_FLAG_OK_ON_STANDBY | + CTL_FLAG_DATA_IN, + CTL_LUN_PAT_NONE, + 16, {0x0b, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0, 0x07}}, + +/* 0C */ +{NULL, CTL_SERIDX_INVLD, CTL_CMD_FLAG_NONE, CTL_LUN_PAT_NONE}, + +/* 0D */ +{NULL, CTL_SERIDX_INVLD, CTL_CMD_FLAG_NONE, CTL_LUN_PAT_NONE}, + +/* 0E */ +{NULL, CTL_SERIDX_INVLD, CTL_CMD_FLAG_NONE, CTL_LUN_PAT_NONE}, + +/* 0F */ +{NULL, CTL_SERIDX_INVLD, CTL_CMD_FLAG_NONE, CTL_LUN_PAT_NONE}, + +/* 10 */ +{NULL, CTL_SERIDX_INVLD, CTL_CMD_FLAG_NONE, CTL_LUN_PAT_NONE}, + +/* 11 */ +{NULL, CTL_SERIDX_INVLD, CTL_CMD_FLAG_NONE, CTL_LUN_PAT_NONE}, + +/* 12 */ +{NULL, CTL_SERIDX_INVLD, CTL_CMD_FLAG_NONE, CTL_LUN_PAT_NONE}, + +/* 13 */ +{NULL, CTL_SERIDX_INVLD, CTL_CMD_FLAG_NONE, CTL_LUN_PAT_NONE}, + +/* 14 */ +{NULL, CTL_SERIDX_INVLD, CTL_CMD_FLAG_NONE, CTL_LUN_PAT_NONE}, + +/* 15 */ +{NULL, CTL_SERIDX_INVLD, CTL_CMD_FLAG_NONE, CTL_LUN_PAT_NONE}, + +/* 16 */ +{NULL, CTL_SERIDX_INVLD, CTL_CMD_FLAG_NONE, CTL_LUN_PAT_NONE}, + +/* 17 */ +{NULL, CTL_SERIDX_INVLD, CTL_CMD_FLAG_NONE, CTL_LUN_PAT_NONE}, + +/* 18 */ +{NULL, CTL_SERIDX_INVLD, CTL_CMD_FLAG_NONE, CTL_LUN_PAT_NONE}, + +/* 19 */ +{NULL, CTL_SERIDX_INVLD, CTL_CMD_FLAG_NONE, CTL_LUN_PAT_NONE}, + +/* 1A */ +{NULL, CTL_SERIDX_INVLD, CTL_CMD_FLAG_NONE, CTL_LUN_PAT_NONE}, + +/* 1B */ +{NULL, CTL_SERIDX_INVLD, CTL_CMD_FLAG_NONE, CTL_LUN_PAT_NONE}, + +/* 1C READ BUFFER(16) ERROR HISTORY */ +{NULL, CTL_SERIDX_INVLD, CTL_CMD_FLAG_NONE, CTL_LUN_PAT_NONE}, + +/* 1d-1f */ +}; + + /* 9E SERVICE ACTION IN(16) */ const struct ctl_cmd_entry ctl_cmd_table_9e[32] = { @@ -782,21 +1103,12 @@ const struct ctl_cmd_entry ctl_cmd_table {NULL, CTL_SERIDX_INVLD, CTL_CMD_FLAG_NONE, CTL_LUN_PAT_NONE}, /* 3B WRITE BUFFER */ -{ctl_write_buffer, CTL_SERIDX_MD_SEL, CTL_CMD_FLAG_OK_ON_BOTH | - CTL_CMD_FLAG_OK_ON_NO_MEDIA | - CTL_CMD_FLAG_OK_ON_STANDBY | - CTL_FLAG_DATA_OUT, - CTL_LUN_PAT_NONE, - 10, {0x1f, 0, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x07}}, +{__DECONST(ctl_opfunc *, ctl_cmd_table_3b), CTL_SERIDX_INVLD, CTL_CMD_FLAG_SA5, + CTL_LUN_PAT_NONE}, /* 3C READ BUFFER */ -{ctl_read_buffer, CTL_SERIDX_MD_SNS, CTL_CMD_FLAG_OK_ON_BOTH | - CTL_CMD_FLAG_OK_ON_NO_MEDIA | - CTL_CMD_FLAG_OK_ON_STANDBY | - CTL_FLAG_DATA_IN | - CTL_CMD_FLAG_ALLOW_ON_PR_WRESV, - CTL_LUN_PAT_NONE, - 10, {0x1f, 0, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x07}}, +{__DECONST(ctl_opfunc *, ctl_cmd_table_3c), CTL_SERIDX_INVLD, CTL_CMD_FLAG_SA5, + CTL_LUN_PAT_NONE}, /* 3D UPDATE BLOCK */ {NULL, CTL_SERIDX_INVLD, CTL_CMD_FLAG_NONE, CTL_LUN_PAT_NONE}, @@ -1154,14 +1466,8 @@ const struct ctl_cmd_entry ctl_cmd_table {NULL, CTL_SERIDX_INVLD, CTL_CMD_FLAG_NONE, CTL_LUN_PAT_NONE}, /* 9B READ BUFFER(16) */ -{ctl_read_buffer, CTL_SERIDX_MD_SNS, CTL_CMD_FLAG_OK_ON_BOTH | - CTL_CMD_FLAG_OK_ON_NO_MEDIA | - CTL_CMD_FLAG_OK_ON_STANDBY | - CTL_FLAG_DATA_IN | - CTL_CMD_FLAG_ALLOW_ON_PR_WRESV, - CTL_LUN_PAT_NONE, - 10, {0x1f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0, 0x07}}, +{__DECONST(ctl_opfunc *, ctl_cmd_table_9b), CTL_SERIDX_INVLD, CTL_CMD_FLAG_SA5, + CTL_LUN_PAT_NONE}, /* 9C WRITE ATOMIC (16) */ {ctl_read_write, CTL_SERIDX_WRITE, CTL_CMD_FLAG_OK_ON_DIRECT| CTL_FLAG_DATA_OUT, From owner-svn-src-all@freebsd.org Thu Dec 22 12:18:42 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3C77CC8B8B4; Thu, 22 Dec 2016 12:18:42 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 1735F1D57; Thu, 22 Dec 2016 12:18:42 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBMCIfr3024341; Thu, 22 Dec 2016 12:18:41 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBMCIft4024338; Thu, 22 Dec 2016 12:18:41 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201612221218.uBMCIft4024338@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Thu, 22 Dec 2016 12:18:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310390 - in head/sys/cam: ctl scsi X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Dec 2016 12:18:42 -0000 Author: mav Date: Thu Dec 22 12:18:40 2016 New Revision: 310390 URL: https://svnweb.freebsd.org/changeset/base/310390 Log: Add support for REPD bit in RSTMF command. We have no real timeout values to report there, but its better then error. MFC after: 2 weeks Modified: head/sys/cam/ctl/ctl.c head/sys/cam/ctl/ctl_cmd_table.c head/sys/cam/scsi/scsi_all.h Modified: head/sys/cam/ctl/ctl.c ============================================================================== --- head/sys/cam/ctl/ctl.c Thu Dec 22 11:10:11 2016 (r310389) +++ head/sys/cam/ctl/ctl.c Thu Dec 22 12:18:40 2016 (r310390) @@ -7462,7 +7462,7 @@ int ctl_report_supported_tmf(struct ctl_scsiio *ctsio) { struct scsi_report_supported_tmf *cdb; - struct scsi_report_supported_tmf_data *data; + struct scsi_report_supported_tmf_ext_data *data; int retval; int alloc_len, total_len; @@ -7472,7 +7472,10 @@ ctl_report_supported_tmf(struct ctl_scsi retval = CTL_RETVAL_COMPLETE; - total_len = sizeof(struct scsi_report_supported_tmf_data); + if (cdb->options & RST_REPD) + total_len = sizeof(struct scsi_report_supported_tmf_ext_data); + else + total_len = sizeof(struct scsi_report_supported_tmf_data); alloc_len = scsi_4btoul(cdb->length); ctsio->kern_data_ptr = malloc(total_len, M_CTL, M_WAITOK | M_ZERO); @@ -7491,10 +7494,11 @@ ctl_report_supported_tmf(struct ctl_scsi ctsio->kern_data_resid = 0; ctsio->kern_rel_offset = 0; - data = (struct scsi_report_supported_tmf_data *)ctsio->kern_data_ptr; + data = (struct scsi_report_supported_tmf_ext_data *)ctsio->kern_data_ptr; data->byte1 |= RST_ATS | RST_ATSS | RST_CTSS | RST_LURS | RST_QTS | RST_TRS; data->byte2 |= RST_QAES | RST_QTSS | RST_ITNRS; + data->length = total_len - 4; ctl_set_success(ctsio); ctsio->io_hdr.flags |= CTL_FLAG_ALLOCATED; Modified: head/sys/cam/ctl/ctl_cmd_table.c ============================================================================== --- head/sys/cam/ctl/ctl_cmd_table.c Thu Dec 22 11:10:11 2016 (r310389) +++ head/sys/cam/ctl/ctl_cmd_table.c Thu Dec 22 12:18:40 2016 (r310390) @@ -824,7 +824,7 @@ const struct ctl_cmd_entry ctl_cmd_table CTL_FLAG_DATA_IN | CTL_CMD_FLAG_ALLOW_ON_PR_RESV, CTL_LUN_PAT_NONE, - 12, {0x0d, 0, 0, 0, 0, 0xff, 0xff, 0xff, 0xff, 0, 0x07}}, + 12, {0x0d, 0x80, 0, 0, 0, 0xff, 0xff, 0xff, 0xff, 0, 0x07}}, /* 0E */ {NULL, CTL_SERIDX_INVLD, CTL_CMD_FLAG_NONE, CTL_LUN_PAT_NONE}, Modified: head/sys/cam/scsi/scsi_all.h ============================================================================== --- head/sys/cam/scsi/scsi_all.h Thu Dec 22 11:10:11 2016 (r310389) +++ head/sys/cam/scsi/scsi_all.h Thu Dec 22 12:18:40 2016 (r310390) @@ -1482,6 +1482,10 @@ struct scsi_report_supported_opcodes_des uint8_t flags; #define RSO_SERVACTV 0x01 #define RSO_CTDP 0x02 +#define RSO_CDLP_MASK 0x0c +#define RSO_CDLP_NO 0x00 +#define RSO_CDLP_A 0x04 +#define RSO_CDLP_B 0x08 uint8_t cdb_length[2]; struct scsi_report_supported_opcodes_timeout timeout[0]; }; @@ -1497,6 +1501,10 @@ struct scsi_report_supported_opcodes_one uint8_t reserved; uint8_t support; #define RSO_ONE_CTDP 0x80 +#define RSO_ONE_CDLP_MASK 0x18 +#define RSO_ONE_CDLP_NO 0x00 +#define RSO_ONE_CDLP_A 0x08 +#define RSO_ONE_CDLP_B 0x10 #define RSO_ONE_SUP_MASK 0x07 #define RSO_ONE_SUP_UNAVAIL 0x00 #define RSO_ONE_SUP_NOT_SUP 0x01 @@ -1510,7 +1518,9 @@ struct scsi_report_supported_tmf { uint8_t opcode; uint8_t service_action; - uint8_t reserved[4]; + uint8_t options; +#define RST_REPD 0x80 + uint8_t reserved[3]; uint8_t length[4]; uint8_t reserved1; uint8_t control; @@ -1531,7 +1541,34 @@ struct scsi_report_supported_tmf_data #define RST_ITNRS 0x01 #define RST_QTSS 0x02 #define RST_QAES 0x04 - uint8_t reserved[2]; + uint8_t reserved; + uint8_t length; +}; + +struct scsi_report_supported_tmf_ext_data +{ + uint8_t byte1; + uint8_t byte2; + uint8_t reserved; + uint8_t length; + uint8_t byte5; +#define RST_TMFTMOV 0x01 + uint8_t reserved2; + uint8_t byte7; +#define RST_WAKETS 0x01 +#define RST_TRTS 0x02 +#define RST_QTTS 0x04 +#define RST_LURTS 0x08 +#define RST_CTSTS 0x10 +#define RST_CACATS 0x20 +#define RST_ATSTS 0x40 +#define RST_ATTS 0x80 + uint8_t byte8; +#define RST_ITNRTS 0x01 +#define RST_QTSTS 0x02 +#define RST_QAETS 0x04 + uint8_t long_timeout[4]; + uint8_t short_timeout[4]; }; struct scsi_report_timestamp From owner-svn-src-all@freebsd.org Thu Dec 22 13:46:18 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B7278C8A289; Thu, 22 Dec 2016 13:46:18 +0000 (UTC) (envelope-from hrs@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 913C918D6; Thu, 22 Dec 2016 13:46:18 +0000 (UTC) (envelope-from hrs@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBMDkHhr060781; Thu, 22 Dec 2016 13:46:17 GMT (envelope-from hrs@FreeBSD.org) Received: (from hrs@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBMDkH4h060780; Thu, 22 Dec 2016 13:46:17 GMT (envelope-from hrs@FreeBSD.org) Message-Id: <201612221346.uBMDkH4h060780@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hrs set sender to hrs@FreeBSD.org using -f From: Hiroki Sato Date: Thu, 22 Dec 2016 13:46:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310393 - head/usr.sbin/syslogd X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Dec 2016 13:46:18 -0000 Author: hrs Date: Thu Dec 22 13:46:17 2016 New Revision: 310393 URL: https://svnweb.freebsd.org/changeset/base/310393 Log: - Fix a use-after-free bug when dq_timeout == 1 and sending SIGTERM to the process failed. It is an unusual situation but it can happen. - Split deadq_remove() into deadq_remove() and deadq_removebypid(). - Normalize variable names of struct deadq_entry *. Modified: head/usr.sbin/syslogd/syslogd.c Modified: head/usr.sbin/syslogd/syslogd.c ============================================================================== --- head/usr.sbin/syslogd/syslogd.c Thu Dec 22 13:38:50 2016 (r310392) +++ head/usr.sbin/syslogd/syslogd.c Thu Dec 22 13:46:17 2016 (r310393) @@ -236,9 +236,6 @@ static TAILQ_HEAD(, deadq_entry) deadq_h #define DQ_TIMO_INIT 2 -typedef struct deadq_entry *dq_t; - - /* * Struct to hold records of network addresses that are allowed to log * to us. @@ -334,7 +331,8 @@ static int addsock(struct sockaddr *, so static struct filed *cfline(const char *, const char *, const char *); static const char *cvthname(struct sockaddr *); static void deadq_enter(pid_t, const char *); -static int deadq_remove(pid_t); +static int deadq_remove(struct deadq_entry *); +static int deadq_removebypid(pid_t); static int decode(const char *, const CODE *); static void die(int) __dead2; static void dodie(int); @@ -1509,7 +1507,7 @@ reapchild(int signo __unused) continue; /* First, look if it's a process from the dead queue. */ - if (deadq_remove(pid)) + if (deadq_removebypid(pid)) continue; /* Now, look in list of active processes. */ @@ -2252,7 +2250,7 @@ static void markit(void) { struct filed *f; - dq_t q, next; + struct deadq_entry *dq, *dq0; now = time((time_t *)NULL); MarkSeq += TIMERINTVL; @@ -2273,14 +2271,12 @@ markit(void) } /* Walk the dead queue, and see if we should signal somebody. */ - for (q = TAILQ_FIRST(&deadq_head); q != NULL; q = next) { - next = TAILQ_NEXT(q, dq_entries); - - switch (q->dq_timeout) { + TAILQ_FOREACH_SAFE(dq, &deadq_head, dq_entries, dq0) { + switch (dq->dq_timeout) { case 0: /* Already signalled once, try harder now. */ - if (kill(q->dq_pid, SIGKILL) != 0) - (void)deadq_remove(q->dq_pid); + if (kill(dq->dq_pid, SIGKILL) != 0) + (void)deadq_remove(dq); break; case 1: @@ -2292,12 +2288,13 @@ markit(void) * didn't even really exist, in case we simply * drop it from the dead queue). */ - if (kill(q->dq_pid, SIGTERM) != 0) - (void)deadq_remove(q->dq_pid); - /* FALLTHROUGH */ - + if (kill(dq->dq_pid, SIGTERM) != 0) + (void)deadq_remove(dq); + else + dq->dq_timeout--; + break; default: - q->dq_timeout--; + dq->dq_timeout--; } } MarkSet = 0; @@ -2738,7 +2735,7 @@ p_open(const char *prog, pid_t *rpid) static void deadq_enter(pid_t pid, const char *name) { - dq_t p; + struct deadq_entry *dq; int status; /* @@ -2752,36 +2749,42 @@ deadq_enter(pid_t pid, const char *name) return; } - p = malloc(sizeof(struct deadq_entry)); - if (p == NULL) { + dq = malloc(sizeof(*dq)); + if (dq == NULL) { logerror("malloc"); exit(1); } - *p = (struct deadq_entry){ + *dq = (struct deadq_entry){ .dq_pid = pid, .dq_timeout = DQ_TIMO_INIT }; - TAILQ_INSERT_TAIL(&deadq_head, p, dq_entries); + TAILQ_INSERT_TAIL(&deadq_head, dq, dq_entries); } static int -deadq_remove(pid_t pid) +deadq_remove(struct deadq_entry *dq) { - dq_t q; - - TAILQ_FOREACH(q, &deadq_head, dq_entries) { - if (q->dq_pid == pid) - break; - } - if (q != NULL) { - TAILQ_REMOVE(&deadq_head, q, dq_entries); - free(q); + if (dq != NULL) { + TAILQ_REMOVE(&deadq_head, dq, dq_entries); + free(dq); return (1); } return (0); } +static int +deadq_removebypid(pid_t pid) +{ + struct deadq_entry *dq; + + TAILQ_FOREACH(dq, &deadq_head, dq_entries) { + if (dq->dq_pid == pid) + break; + } + return (deadq_remove(dq)); +} + static void log_deadchild(pid_t pid, int status, const char *name) { From owner-svn-src-all@freebsd.org Thu Dec 22 15:01:07 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B2B34C8B87B; Thu, 22 Dec 2016 15:01:07 +0000 (UTC) (envelope-from manu@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 81EA31418; Thu, 22 Dec 2016 15:01:07 +0000 (UTC) (envelope-from manu@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBMF16X5090886; Thu, 22 Dec 2016 15:01:06 GMT (envelope-from manu@FreeBSD.org) Received: (from manu@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBMF16LR090885; Thu, 22 Dec 2016 15:01:06 GMT (envelope-from manu@FreeBSD.org) Message-Id: <201612221501.uBMF16LR090885@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: manu set sender to manu@FreeBSD.org using -f From: Emmanuel Vadot Date: Thu, 22 Dec 2016 15:01:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310414 - head/sys/arm/allwinner/clk X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Dec 2016 15:01:07 -0000 Author: manu Date: Thu Dec 22 15:01:06 2016 New Revision: 310414 URL: https://svnweb.freebsd.org/changeset/base/310414 Log: Allwinner clk: factor M for mod clock is 4 bits, not 5 MFC after: 1 week Modified: head/sys/arm/allwinner/clk/aw_modclk.c Modified: head/sys/arm/allwinner/clk/aw_modclk.c ============================================================================== --- head/sys/arm/allwinner/clk/aw_modclk.c Thu Dec 22 14:27:07 2016 (r310413) +++ head/sys/arm/allwinner/clk/aw_modclk.c Thu Dec 22 15:01:06 2016 (r310414) @@ -56,9 +56,9 @@ __FBSDID("$FreeBSD$"); #define CLK_RATIO_N (0x3 << 16) #define CLK_RATIO_N_SHIFT 16 #define CLK_RATIO_N_MAX 0x3 -#define CLK_RATIO_M (0x1f << 0) +#define CLK_RATIO_M (0xf << 0) #define CLK_RATIO_M_SHIFT 0 -#define CLK_RATIO_M_MAX 0x1f +#define CLK_RATIO_M_MAX 0xf static struct ofw_compat_data compat_data[] = { { "allwinner,sun4i-a10-mod0-clk", 1 }, From owner-svn-src-all@freebsd.org Thu Dec 22 15:48:55 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A3ACDC8B7F5; Thu, 22 Dec 2016 15:48:55 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 7345013D7; Thu, 22 Dec 2016 15:48:55 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBMFmsWE010708; Thu, 22 Dec 2016 15:48:54 GMT (envelope-from asomers@FreeBSD.org) Received: (from asomers@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBMFmsgm010707; Thu, 22 Dec 2016 15:48:54 GMT (envelope-from asomers@FreeBSD.org) Message-Id: <201612221548.uBMFmsgm010707@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: asomers set sender to asomers@FreeBSD.org using -f From: Alan Somers Date: Thu, 22 Dec 2016 15:48:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310417 - head/sys/boot/forth X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Dec 2016 15:48:55 -0000 Author: asomers Date: Thu Dec 22 15:48:54 2016 New Revision: 310417 URL: https://svnweb.freebsd.org/changeset/base/310417 Log: Add a dumpdev example to /boot/defaults/loader.conf Submitted by: rgrimes MFC after: 4 weeks Sponsored by: Spectra Logic Corp Modified: head/sys/boot/forth/loader.conf Modified: head/sys/boot/forth/loader.conf ============================================================================== --- head/sys/boot/forth/loader.conf Thu Dec 22 15:46:12 2016 (r310416) +++ head/sys/boot/forth/loader.conf Thu Dec 22 15:48:54 2016 (r310417) @@ -101,6 +101,7 @@ module_path="/boot/modules" # Set the mo #prompt="\\${interpret}" # Set the command prompt #root_disk_unit="0" # Force the root disk unit number #rootdev="disk1s1a" # Set the root filesystem +#dumpdev="disk1s1b" # Set a dump device early in the boot process #tftp.blksize="1428" # Set the RFC 2348 TFTP block size. # If the TFTP server does not support RFC 2348, # the block size is set to 512. If the value From owner-svn-src-all@freebsd.org Thu Dec 22 16:09:46 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2B120C8C066; Thu, 22 Dec 2016 16:09:46 +0000 (UTC) (envelope-from royger@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 053FF37C; Thu, 22 Dec 2016 16:09:45 +0000 (UTC) (envelope-from royger@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBMG9jNK019187; Thu, 22 Dec 2016 16:09:45 GMT (envelope-from royger@FreeBSD.org) Received: (from royger@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBMG9i3l019183; Thu, 22 Dec 2016 16:09:44 GMT (envelope-from royger@FreeBSD.org) Message-Id: <201612221609.uBMG9i3l019183@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: royger set sender to royger@FreeBSD.org using -f From: =?UTF-8?Q?Roger_Pau_Monn=c3=a9?= Date: Thu, 22 Dec 2016 16:09:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310418 - in head/sys: dev/xen/evtchn x86/xen xen X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Dec 2016 16:09:46 -0000 Author: royger Date: Thu Dec 22 16:09:44 2016 New Revision: 310418 URL: https://svnweb.freebsd.org/changeset/base/310418 Log: xen: fix IPI setup with EARLY_AP_STARTUP Current Xen IPI setup functions require that the caller provide a device in order to obtain the name of the interrupt from it. With early AP startup this device is no longer available at the point where IPIs are bound, and a KASSERT would trigger: panic: NULL pcpu device_t cpuid = 0 KDB: stack backtrace: db_trace_self_wrapper() at db_trace_self_wrapper+0x2b/frame 0xffffffff82233a20 vpanic() at vpanic+0x186/frame 0xffffffff82233aa0 kassert_panic() at kassert_panic+0x126/frame 0xffffffff82233b10 xen_setup_cpus() at xen_setup_cpus+0x5b/frame 0xffffffff82233b50 mi_startup() at mi_startup+0x118/frame 0xffffffff82233b70 btext() at btext+0x2c Fix this by no longer requiring the presence of a device in order to bind IPIs, and simply use the "cpuX" format where X is the CPU identifier in order to describe the interrupt. Reported by: sbruno, cperciva Tested by: sbruno X-MFC-With: r310177 Sponsored by: Citrix Systems R&D Modified: head/sys/dev/xen/evtchn/evtchn_dev.c head/sys/x86/xen/xen_apic.c head/sys/x86/xen/xen_intr.c head/sys/xen/xen_intr.h Modified: head/sys/dev/xen/evtchn/evtchn_dev.c ============================================================================== --- head/sys/dev/xen/evtchn/evtchn_dev.c Thu Dec 22 15:48:54 2016 (r310417) +++ head/sys/dev/xen/evtchn/evtchn_dev.c Thu Dec 22 16:09:44 2016 (r310418) @@ -373,9 +373,9 @@ evtchn_bind_user_port(struct per_user_da mtx_lock(&u->bind_mutex); RB_INSERT(evtchn_tree, &u->evtchns, evtchn); mtx_unlock(&u->bind_mutex); - error = xen_intr_add_handler(evtchn_dev, evtchn_filter, - evtchn_interrupt, evtchn, INTR_TYPE_MISC | INTR_MPSAFE, - evtchn->handle); + error = xen_intr_add_handler(device_get_nameunit(evtchn_dev), + evtchn_filter, evtchn_interrupt, evtchn, + INTR_TYPE_MISC | INTR_MPSAFE, evtchn->handle); if (error != 0) { xen_intr_unbind(&evtchn->handle); mtx_lock(&u->bind_mutex); Modified: head/sys/x86/xen/xen_apic.c ============================================================================== --- head/sys/x86/xen/xen_apic.c Thu Dec 22 15:48:54 2016 (r310417) +++ head/sys/x86/xen/xen_apic.c Thu Dec 22 16:09:44 2016 (r310418) @@ -500,12 +500,9 @@ xen_cpu_ipi_init(int cpu) { xen_intr_handle_t *ipi_handle; const struct xen_ipi_handler *ipi; - device_t dev; int idx, rc; ipi_handle = DPCPU_ID_GET(cpu, ipi_handle); - dev = pcpu_find(cpu)->pc_device; - KASSERT((dev != NULL), ("NULL pcpu device_t")); for (ipi = xen_ipis, idx = 0; idx < nitems(xen_ipis); ipi++, idx++) { @@ -514,7 +511,7 @@ xen_cpu_ipi_init(int cpu) continue; } - rc = xen_intr_alloc_and_bind_ipi(dev, cpu, ipi->filter, + rc = xen_intr_alloc_and_bind_ipi(cpu, ipi->filter, INTR_TYPE_TTY, &ipi_handle[idx]); if (rc != 0) panic("Unable to allocate a XEN IPI port"); Modified: head/sys/x86/xen/xen_intr.c ============================================================================== --- head/sys/x86/xen/xen_intr.c Thu Dec 22 15:48:54 2016 (r310417) +++ head/sys/x86/xen/xen_intr.c Thu Dec 22 16:09:44 2016 (r310418) @@ -392,7 +392,7 @@ xen_intr_release_isrc(struct xenisrc *is */ static int xen_intr_bind_isrc(struct xenisrc **isrcp, evtchn_port_t local_port, - enum evtchn_type type, device_t intr_owner, driver_filter_t filter, + enum evtchn_type type, const char *intr_owner, driver_filter_t filter, driver_intr_t handler, void *arg, enum intr_type flags, xen_intr_handle_t *port_handlep) { @@ -401,8 +401,8 @@ xen_intr_bind_isrc(struct xenisrc **isrc *isrcp = NULL; if (port_handlep == NULL) { - device_printf(intr_owner, - "xen_intr_bind_isrc: Bad event handle\n"); + printf("%s: xen_intr_bind_isrc: Bad event handle\n", + intr_owner); return (EINVAL); } @@ -1175,8 +1175,9 @@ xen_intr_bind_local_port(device_t dev, e struct xenisrc *isrc; int error; - error = xen_intr_bind_isrc(&isrc, local_port, EVTCHN_TYPE_PORT, dev, - filter, handler, arg, flags, port_handlep); + error = xen_intr_bind_isrc(&isrc, local_port, EVTCHN_TYPE_PORT, + device_get_nameunit(dev), filter, handler, arg, flags, + port_handlep); if (error != 0) return (error); @@ -1210,8 +1211,8 @@ xen_intr_alloc_and_bind_local_port(devic } error = xen_intr_bind_isrc(&isrc, alloc_unbound.port, EVTCHN_TYPE_PORT, - dev, filter, handler, arg, flags, - port_handlep); + device_get_nameunit(dev), filter, handler, arg, flags, + port_handlep); if (error != 0) { evtchn_close_t close = { .port = alloc_unbound.port }; if (HYPERVISOR_event_channel_op(EVTCHNOP_close, &close)) @@ -1245,8 +1246,8 @@ xen_intr_bind_remote_port(device_t dev, } error = xen_intr_bind_isrc(&isrc, bind_interdomain.local_port, - EVTCHN_TYPE_PORT, dev, filter, handler, - arg, flags, port_handlep); + EVTCHN_TYPE_PORT, device_get_nameunit(dev), filter, handler, arg, + flags, port_handlep); if (error) { evtchn_close_t close = { .port = bind_interdomain.local_port }; if (HYPERVISOR_event_channel_op(EVTCHNOP_close, &close)) @@ -1285,8 +1286,9 @@ xen_intr_bind_virq(device_t dev, u_int v return (-error); } - error = xen_intr_bind_isrc(&isrc, bind_virq.port, EVTCHN_TYPE_VIRQ, dev, - filter, handler, arg, flags, port_handlep); + error = xen_intr_bind_isrc(&isrc, bind_virq.port, EVTCHN_TYPE_VIRQ, + device_get_nameunit(dev), filter, handler, arg, flags, + port_handlep); #ifdef SMP if (error == 0) @@ -1325,14 +1327,15 @@ xen_intr_bind_virq(device_t dev, u_int v } int -xen_intr_alloc_and_bind_ipi(device_t dev, u_int cpu, - driver_filter_t filter, enum intr_type flags, - xen_intr_handle_t *port_handlep) +xen_intr_alloc_and_bind_ipi(u_int cpu, driver_filter_t filter, + enum intr_type flags, xen_intr_handle_t *port_handlep) { #ifdef SMP int vcpu_id = pcpu_find(cpu)->pc_vcpu_id; struct xenisrc *isrc; struct evtchn_bind_ipi bind_ipi = { .vcpu = vcpu_id }; + /* Same size as the one used by intr_handler->ih_name. */ + char name[MAXCOMLEN + 1]; int error; /* Ensure the target CPU is ready to handle evtchn interrupts. */ @@ -1348,12 +1351,10 @@ xen_intr_alloc_and_bind_ipi(device_t dev return (-error); } - error = xen_intr_bind_isrc(&isrc, bind_ipi.port, EVTCHN_TYPE_IPI, - dev, filter, NULL, NULL, flags, - port_handlep); - if (error == 0) - error = intr_event_bind(isrc->xi_intsrc.is_event, cpu); + snprintf(name, sizeof(name), "cpu%u", cpu); + error = xen_intr_bind_isrc(&isrc, bind_ipi.port, EVTCHN_TYPE_IPI, + name, filter, NULL, NULL, flags, port_handlep); if (error != 0) { evtchn_close_t close = { .port = bind_ipi.port }; @@ -1549,7 +1550,7 @@ xen_intr_port(xen_intr_handle_t handle) } int -xen_intr_add_handler(device_t dev, driver_filter_t filter, +xen_intr_add_handler(const char *name, driver_filter_t filter, driver_intr_t handler, void *arg, enum intr_type flags, xen_intr_handle_t handle) { @@ -1560,12 +1561,12 @@ xen_intr_add_handler(device_t dev, drive if (isrc == NULL || isrc->xi_cookie != NULL) return (EINVAL); - error = intr_add_handler(device_get_nameunit(dev), isrc->xi_vector, - filter, handler, arg, flags|INTR_EXCL, &isrc->xi_cookie); + error = intr_add_handler(name, isrc->xi_vector,filter, handler, arg, + flags|INTR_EXCL, &isrc->xi_cookie); if (error != 0) { - device_printf(dev, - "xen_intr_add_handler: intr_add_handler failed: %d\n", - error); + printf( + "%s: xen_intr_add_handler: intr_add_handler failed: %d\n", + name, error); } return (error); Modified: head/sys/xen/xen_intr.h ============================================================================== --- head/sys/xen/xen_intr.h Thu Dec 22 15:48:54 2016 (r310417) +++ head/sys/xen/xen_intr.h Thu Dec 22 16:09:44 2016 (r310418) @@ -143,7 +143,6 @@ int xen_intr_bind_virq(device_t dev, u_i * interupts and, if successful, associate the port with the specified * interrupt handler. * - * \param dev The device making this bind request. * \param cpu The cpu receiving the IPI. * \param filter The interrupt filter servicing this IPI. * \param irqflags Interrupt handler flags. See sys/bus.h. @@ -152,7 +151,7 @@ int xen_intr_bind_virq(device_t dev, u_i * * \returns 0 on success, otherwise an errno. */ -int xen_intr_alloc_and_bind_ipi(device_t dev, u_int cpu, +int xen_intr_alloc_and_bind_ipi(u_int cpu, driver_filter_t filter, enum intr_type irqflags, xen_intr_handle_t *handlep); @@ -259,7 +258,7 @@ int xen_release_msi(int vector); * * \returns 0 on success, otherwise an errno. */ -int xen_intr_add_handler(device_t dev, driver_filter_t filter, +int xen_intr_add_handler(const char *name, driver_filter_t filter, driver_intr_t handler, void *arg, enum intr_type flags, xen_intr_handle_t handle); From owner-svn-src-all@freebsd.org Thu Dec 22 16:19:08 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4117FC8C3B0; Thu, 22 Dec 2016 16:19:08 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A6AD0C20; Thu, 22 Dec 2016 16:19:07 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBMGJ6M5023059; Thu, 22 Dec 2016 16:19:06 GMT (envelope-from delphij@FreeBSD.org) Received: (from delphij@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBMGJ6SY023055; Thu, 22 Dec 2016 16:19:06 GMT (envelope-from delphij@FreeBSD.org) Message-Id: <201612221619.uBMGJ6SY023055@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: delphij set sender to delphij@FreeBSD.org using -f From: Xin LI Date: Thu, 22 Dec 2016 16:19:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-releng@freebsd.org Subject: svn commit: r310419 - in releng: 10.1 10.1/contrib/ntp 10.1/contrib/ntp/html 10.1/contrib/ntp/html/drivers 10.1/contrib/ntp/include 10.1/contrib/ntp/lib/isc 10.1/contrib/ntp/libntp 10.1/contrib/ntp... X-SVN-Group: releng MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Dec 2016 16:19:08 -0000 Author: delphij Date: Thu Dec 22 16:19:05 2016 New Revision: 310419 URL: https://svnweb.freebsd.org/changeset/base/310419 Log: Fix multiple vulnerabilities of ntp. Approved by: so Added: releng/10.1/contrib/ntp/include/libssl_compat.h (contents, props changed) releng/10.1/contrib/ntp/libntp/libssl_compat.c (contents, props changed) releng/10.1/contrib/ntp/sntp/unity/ulib_setup.c (contents, props changed) releng/10.1/contrib/ntp/sntp/unity/ulib_teardown.c (contents, props changed) releng/10.2/contrib/ntp/include/libssl_compat.h (contents, props changed) releng/10.2/contrib/ntp/libntp/libssl_compat.c (contents, props changed) releng/10.2/contrib/ntp/sntp/unity/ulib_setup.c (contents, props changed) releng/10.2/contrib/ntp/sntp/unity/ulib_teardown.c (contents, props changed) releng/10.3/contrib/ntp/include/libssl_compat.h (contents, props changed) releng/10.3/contrib/ntp/libntp/libssl_compat.c (contents, props changed) releng/10.3/contrib/ntp/sntp/unity/ulib_setup.c (contents, props changed) releng/10.3/contrib/ntp/sntp/unity/ulib_teardown.c (contents, props changed) releng/11.0/contrib/ntp/include/libssl_compat.h releng/11.0/contrib/ntp/libntp/libssl_compat.c releng/11.0/contrib/ntp/sntp/unity/ulib_setup.c releng/11.0/contrib/ntp/sntp/unity/ulib_teardown.c releng/9.3/contrib/ntp/include/libssl_compat.h (contents, props changed) releng/9.3/contrib/ntp/libntp/libssl_compat.c (contents, props changed) releng/9.3/contrib/ntp/sntp/unity/ulib_setup.c (contents, props changed) releng/9.3/contrib/ntp/sntp/unity/ulib_teardown.c (contents, props changed) Modified: releng/10.1/UPDATING releng/10.1/contrib/ntp/ChangeLog releng/10.1/contrib/ntp/CommitLog releng/10.1/contrib/ntp/NEWS releng/10.1/contrib/ntp/configure releng/10.1/contrib/ntp/html/drivers/driver40.html releng/10.1/contrib/ntp/html/miscopt.html releng/10.1/contrib/ntp/include/Makefile.am releng/10.1/contrib/ntp/include/Makefile.in releng/10.1/contrib/ntp/include/ntp.h releng/10.1/contrib/ntp/include/ntp_intres.h releng/10.1/contrib/ntp/include/ntpd.h releng/10.1/contrib/ntp/lib/isc/netaddr.c releng/10.1/contrib/ntp/libntp/Makefile.am releng/10.1/contrib/ntp/libntp/Makefile.in releng/10.1/contrib/ntp/libntp/a_md5encrypt.c releng/10.1/contrib/ntp/libntp/audio.c releng/10.1/contrib/ntp/libntp/ntp_calendar.c releng/10.1/contrib/ntp/libntp/ntp_intres.c releng/10.1/contrib/ntp/libntp/ssl_init.c releng/10.1/contrib/ntp/libntp/work_fork.c releng/10.1/contrib/ntp/libparse/clk_hopf6021.c releng/10.1/contrib/ntp/ntpd/complete.conf.in releng/10.1/contrib/ntp/ntpd/invoke-ntp.conf.texi releng/10.1/contrib/ntp/ntpd/invoke-ntp.keys.texi releng/10.1/contrib/ntp/ntpd/invoke-ntpd.texi releng/10.1/contrib/ntp/ntpd/keyword-gen-utd releng/10.1/contrib/ntp/ntpd/keyword-gen.c releng/10.1/contrib/ntp/ntpd/ntp.conf.5man releng/10.1/contrib/ntp/ntpd/ntp.conf.5mdoc releng/10.1/contrib/ntp/ntpd/ntp.conf.def releng/10.1/contrib/ntp/ntpd/ntp.conf.html releng/10.1/contrib/ntp/ntpd/ntp.conf.man.in releng/10.1/contrib/ntp/ntpd/ntp.conf.mdoc.in releng/10.1/contrib/ntp/ntpd/ntp.keys.5man releng/10.1/contrib/ntp/ntpd/ntp.keys.5mdoc releng/10.1/contrib/ntp/ntpd/ntp.keys.html releng/10.1/contrib/ntp/ntpd/ntp.keys.man.in releng/10.1/contrib/ntp/ntpd/ntp.keys.mdoc.in releng/10.1/contrib/ntp/ntpd/ntp_config.c releng/10.1/contrib/ntp/ntpd/ntp_control.c releng/10.1/contrib/ntp/ntpd/ntp_crypto.c releng/10.1/contrib/ntp/ntpd/ntp_keyword.h releng/10.1/contrib/ntp/ntpd/ntp_loopfilter.c releng/10.1/contrib/ntp/ntpd/ntp_parser.c releng/10.1/contrib/ntp/ntpd/ntp_parser.h releng/10.1/contrib/ntp/ntpd/ntp_peer.c releng/10.1/contrib/ntp/ntpd/ntp_proto.c releng/10.1/contrib/ntp/ntpd/ntp_refclock.c releng/10.1/contrib/ntp/ntpd/ntpd-opts.c releng/10.1/contrib/ntp/ntpd/ntpd-opts.h releng/10.1/contrib/ntp/ntpd/ntpd.1ntpdman releng/10.1/contrib/ntp/ntpd/ntpd.1ntpdmdoc releng/10.1/contrib/ntp/ntpd/ntpd.html releng/10.1/contrib/ntp/ntpd/ntpd.man.in releng/10.1/contrib/ntp/ntpd/ntpd.mdoc.in releng/10.1/contrib/ntp/ntpd/refclock_gpsdjson.c releng/10.1/contrib/ntp/ntpd/refclock_jjy.c releng/10.1/contrib/ntp/ntpd/refclock_jupiter.c releng/10.1/contrib/ntp/ntpdc/invoke-ntpdc.texi releng/10.1/contrib/ntp/ntpdc/ntpdc-opts.c releng/10.1/contrib/ntp/ntpdc/ntpdc-opts.h releng/10.1/contrib/ntp/ntpdc/ntpdc.1ntpdcman releng/10.1/contrib/ntp/ntpdc/ntpdc.1ntpdcmdoc releng/10.1/contrib/ntp/ntpdc/ntpdc.html releng/10.1/contrib/ntp/ntpdc/ntpdc.man.in releng/10.1/contrib/ntp/ntpdc/ntpdc.mdoc.in releng/10.1/contrib/ntp/ntpq/invoke-ntpq.texi releng/10.1/contrib/ntp/ntpq/ntpq-opts.c releng/10.1/contrib/ntp/ntpq/ntpq-opts.h releng/10.1/contrib/ntp/ntpq/ntpq.1ntpqman releng/10.1/contrib/ntp/ntpq/ntpq.1ntpqmdoc releng/10.1/contrib/ntp/ntpq/ntpq.c releng/10.1/contrib/ntp/ntpq/ntpq.html releng/10.1/contrib/ntp/ntpq/ntpq.man.in releng/10.1/contrib/ntp/ntpq/ntpq.mdoc.in releng/10.1/contrib/ntp/ntpsnmpd/invoke-ntpsnmpd.texi releng/10.1/contrib/ntp/ntpsnmpd/ntpsnmpd-opts.c releng/10.1/contrib/ntp/ntpsnmpd/ntpsnmpd-opts.h releng/10.1/contrib/ntp/ntpsnmpd/ntpsnmpd.1ntpsnmpdman releng/10.1/contrib/ntp/ntpsnmpd/ntpsnmpd.1ntpsnmpdmdoc releng/10.1/contrib/ntp/ntpsnmpd/ntpsnmpd.html releng/10.1/contrib/ntp/ntpsnmpd/ntpsnmpd.man.in releng/10.1/contrib/ntp/ntpsnmpd/ntpsnmpd.mdoc.in releng/10.1/contrib/ntp/packageinfo.sh releng/10.1/contrib/ntp/scripts/build/genAuthors.in releng/10.1/contrib/ntp/scripts/calc_tickadj/calc_tickadj.1calc_tickadjman releng/10.1/contrib/ntp/scripts/calc_tickadj/calc_tickadj.1calc_tickadjmdoc releng/10.1/contrib/ntp/scripts/calc_tickadj/calc_tickadj.html releng/10.1/contrib/ntp/scripts/calc_tickadj/calc_tickadj.man.in releng/10.1/contrib/ntp/scripts/calc_tickadj/calc_tickadj.mdoc.in releng/10.1/contrib/ntp/scripts/calc_tickadj/invoke-calc_tickadj.texi releng/10.1/contrib/ntp/scripts/invoke-plot_summary.texi releng/10.1/contrib/ntp/scripts/invoke-summary.texi releng/10.1/contrib/ntp/scripts/ntp-wait/invoke-ntp-wait.texi releng/10.1/contrib/ntp/scripts/ntp-wait/ntp-wait-opts releng/10.1/contrib/ntp/scripts/ntp-wait/ntp-wait.1ntp-waitman releng/10.1/contrib/ntp/scripts/ntp-wait/ntp-wait.1ntp-waitmdoc releng/10.1/contrib/ntp/scripts/ntp-wait/ntp-wait.html releng/10.1/contrib/ntp/scripts/ntp-wait/ntp-wait.man.in releng/10.1/contrib/ntp/scripts/ntp-wait/ntp-wait.mdoc.in releng/10.1/contrib/ntp/scripts/ntpsweep/invoke-ntpsweep.texi releng/10.1/contrib/ntp/scripts/ntpsweep/ntpsweep-opts releng/10.1/contrib/ntp/scripts/ntpsweep/ntpsweep.1ntpsweepman releng/10.1/contrib/ntp/scripts/ntpsweep/ntpsweep.1ntpsweepmdoc releng/10.1/contrib/ntp/scripts/ntpsweep/ntpsweep.html releng/10.1/contrib/ntp/scripts/ntpsweep/ntpsweep.man.in releng/10.1/contrib/ntp/scripts/ntpsweep/ntpsweep.mdoc.in releng/10.1/contrib/ntp/scripts/ntptrace/invoke-ntptrace.texi releng/10.1/contrib/ntp/scripts/ntptrace/ntptrace-opts releng/10.1/contrib/ntp/scripts/ntptrace/ntptrace.1ntptraceman releng/10.1/contrib/ntp/scripts/ntptrace/ntptrace.1ntptracemdoc releng/10.1/contrib/ntp/scripts/ntptrace/ntptrace.html releng/10.1/contrib/ntp/scripts/ntptrace/ntptrace.man.in releng/10.1/contrib/ntp/scripts/ntptrace/ntptrace.mdoc.in releng/10.1/contrib/ntp/scripts/plot_summary-opts releng/10.1/contrib/ntp/scripts/plot_summary.1plot_summaryman releng/10.1/contrib/ntp/scripts/plot_summary.1plot_summarymdoc releng/10.1/contrib/ntp/scripts/plot_summary.html releng/10.1/contrib/ntp/scripts/plot_summary.man.in releng/10.1/contrib/ntp/scripts/plot_summary.mdoc.in releng/10.1/contrib/ntp/scripts/summary-opts releng/10.1/contrib/ntp/scripts/summary.1summaryman releng/10.1/contrib/ntp/scripts/summary.1summarymdoc releng/10.1/contrib/ntp/scripts/summary.html releng/10.1/contrib/ntp/scripts/summary.man.in releng/10.1/contrib/ntp/scripts/summary.mdoc.in releng/10.1/contrib/ntp/scripts/update-leap/invoke-update-leap.texi releng/10.1/contrib/ntp/scripts/update-leap/update-leap-opts releng/10.1/contrib/ntp/scripts/update-leap/update-leap.1update-leapman releng/10.1/contrib/ntp/scripts/update-leap/update-leap.1update-leapmdoc releng/10.1/contrib/ntp/scripts/update-leap/update-leap.html releng/10.1/contrib/ntp/scripts/update-leap/update-leap.in releng/10.1/contrib/ntp/scripts/update-leap/update-leap.man.in releng/10.1/contrib/ntp/scripts/update-leap/update-leap.mdoc.in releng/10.1/contrib/ntp/sntp/configure releng/10.1/contrib/ntp/sntp/crypto.c releng/10.1/contrib/ntp/sntp/include/version.def releng/10.1/contrib/ntp/sntp/include/version.texi releng/10.1/contrib/ntp/sntp/invoke-sntp.texi releng/10.1/contrib/ntp/sntp/m4/version.m4 releng/10.1/contrib/ntp/sntp/sntp-opts.c releng/10.1/contrib/ntp/sntp/sntp-opts.h releng/10.1/contrib/ntp/sntp/sntp.1sntpman releng/10.1/contrib/ntp/sntp/sntp.1sntpmdoc releng/10.1/contrib/ntp/sntp/sntp.html releng/10.1/contrib/ntp/sntp/sntp.man.in releng/10.1/contrib/ntp/sntp/sntp.mdoc.in releng/10.1/contrib/ntp/sntp/tests/packetProcessing.c releng/10.1/contrib/ntp/sntp/tests/run-packetProcessing.c releng/10.1/contrib/ntp/sntp/unity/Makefile.am releng/10.1/contrib/ntp/sntp/unity/Makefile.in releng/10.1/contrib/ntp/sntp/unity/unity_fixture.c releng/10.1/contrib/ntp/sntp/version.c releng/10.1/contrib/ntp/tests/libntp/a_md5encrypt.c releng/10.1/contrib/ntp/tests/libntp/calendar.c releng/10.1/contrib/ntp/tests/libntp/run-calendar.c releng/10.1/contrib/ntp/tests/libntp/sfptostr.c releng/10.1/contrib/ntp/tests/ntpd/Makefile.am releng/10.1/contrib/ntp/tests/ntpd/Makefile.in releng/10.1/contrib/ntp/util/invoke-ntp-keygen.texi releng/10.1/contrib/ntp/util/ntp-keygen-opts.c releng/10.1/contrib/ntp/util/ntp-keygen-opts.h releng/10.1/contrib/ntp/util/ntp-keygen.1ntp-keygenman releng/10.1/contrib/ntp/util/ntp-keygen.1ntp-keygenmdoc releng/10.1/contrib/ntp/util/ntp-keygen.c releng/10.1/contrib/ntp/util/ntp-keygen.html releng/10.1/contrib/ntp/util/ntp-keygen.man.in releng/10.1/contrib/ntp/util/ntp-keygen.mdoc.in releng/10.1/sys/conf/newvers.sh releng/10.1/usr.sbin/ntp/config.h releng/10.1/usr.sbin/ntp/doc/ntp-keygen.8 releng/10.1/usr.sbin/ntp/doc/ntp.conf.5 releng/10.1/usr.sbin/ntp/doc/ntp.keys.5 releng/10.1/usr.sbin/ntp/doc/ntpd.8 releng/10.1/usr.sbin/ntp/doc/ntpdc.8 releng/10.1/usr.sbin/ntp/doc/ntpq.8 releng/10.1/usr.sbin/ntp/doc/sntp.8 releng/10.1/usr.sbin/ntp/libntp/Makefile releng/10.1/usr.sbin/ntp/scripts/mkver releng/10.2/UPDATING releng/10.2/contrib/ntp/ChangeLog releng/10.2/contrib/ntp/CommitLog releng/10.2/contrib/ntp/NEWS releng/10.2/contrib/ntp/configure releng/10.2/contrib/ntp/html/drivers/driver40.html releng/10.2/contrib/ntp/html/miscopt.html releng/10.2/contrib/ntp/include/Makefile.am releng/10.2/contrib/ntp/include/Makefile.in releng/10.2/contrib/ntp/include/ntp.h releng/10.2/contrib/ntp/include/ntp_intres.h releng/10.2/contrib/ntp/include/ntpd.h releng/10.2/contrib/ntp/lib/isc/netaddr.c releng/10.2/contrib/ntp/libntp/Makefile.am releng/10.2/contrib/ntp/libntp/Makefile.in releng/10.2/contrib/ntp/libntp/a_md5encrypt.c releng/10.2/contrib/ntp/libntp/audio.c releng/10.2/contrib/ntp/libntp/ntp_calendar.c releng/10.2/contrib/ntp/libntp/ntp_intres.c releng/10.2/contrib/ntp/libntp/ssl_init.c releng/10.2/contrib/ntp/libntp/work_fork.c releng/10.2/contrib/ntp/libparse/clk_hopf6021.c releng/10.2/contrib/ntp/ntpd/complete.conf.in releng/10.2/contrib/ntp/ntpd/invoke-ntp.conf.texi releng/10.2/contrib/ntp/ntpd/invoke-ntp.keys.texi releng/10.2/contrib/ntp/ntpd/invoke-ntpd.texi releng/10.2/contrib/ntp/ntpd/keyword-gen-utd releng/10.2/contrib/ntp/ntpd/keyword-gen.c releng/10.2/contrib/ntp/ntpd/ntp.conf.5man releng/10.2/contrib/ntp/ntpd/ntp.conf.5mdoc releng/10.2/contrib/ntp/ntpd/ntp.conf.def releng/10.2/contrib/ntp/ntpd/ntp.conf.html releng/10.2/contrib/ntp/ntpd/ntp.conf.man.in releng/10.2/contrib/ntp/ntpd/ntp.conf.mdoc.in releng/10.2/contrib/ntp/ntpd/ntp.keys.5man releng/10.2/contrib/ntp/ntpd/ntp.keys.5mdoc releng/10.2/contrib/ntp/ntpd/ntp.keys.html releng/10.2/contrib/ntp/ntpd/ntp.keys.man.in releng/10.2/contrib/ntp/ntpd/ntp.keys.mdoc.in releng/10.2/contrib/ntp/ntpd/ntp_config.c releng/10.2/contrib/ntp/ntpd/ntp_control.c releng/10.2/contrib/ntp/ntpd/ntp_crypto.c releng/10.2/contrib/ntp/ntpd/ntp_keyword.h releng/10.2/contrib/ntp/ntpd/ntp_loopfilter.c releng/10.2/contrib/ntp/ntpd/ntp_parser.c releng/10.2/contrib/ntp/ntpd/ntp_parser.h releng/10.2/contrib/ntp/ntpd/ntp_peer.c releng/10.2/contrib/ntp/ntpd/ntp_proto.c releng/10.2/contrib/ntp/ntpd/ntp_refclock.c releng/10.2/contrib/ntp/ntpd/ntpd-opts.c releng/10.2/contrib/ntp/ntpd/ntpd-opts.h releng/10.2/contrib/ntp/ntpd/ntpd.1ntpdman releng/10.2/contrib/ntp/ntpd/ntpd.1ntpdmdoc releng/10.2/contrib/ntp/ntpd/ntpd.html releng/10.2/contrib/ntp/ntpd/ntpd.man.in releng/10.2/contrib/ntp/ntpd/ntpd.mdoc.in releng/10.2/contrib/ntp/ntpd/refclock_gpsdjson.c releng/10.2/contrib/ntp/ntpd/refclock_jjy.c releng/10.2/contrib/ntp/ntpd/refclock_jupiter.c releng/10.2/contrib/ntp/ntpdc/invoke-ntpdc.texi releng/10.2/contrib/ntp/ntpdc/ntpdc-opts.c releng/10.2/contrib/ntp/ntpdc/ntpdc-opts.h releng/10.2/contrib/ntp/ntpdc/ntpdc.1ntpdcman releng/10.2/contrib/ntp/ntpdc/ntpdc.1ntpdcmdoc releng/10.2/contrib/ntp/ntpdc/ntpdc.html releng/10.2/contrib/ntp/ntpdc/ntpdc.man.in releng/10.2/contrib/ntp/ntpdc/ntpdc.mdoc.in releng/10.2/contrib/ntp/ntpq/invoke-ntpq.texi releng/10.2/contrib/ntp/ntpq/ntpq-opts.c releng/10.2/contrib/ntp/ntpq/ntpq-opts.h releng/10.2/contrib/ntp/ntpq/ntpq.1ntpqman releng/10.2/contrib/ntp/ntpq/ntpq.1ntpqmdoc releng/10.2/contrib/ntp/ntpq/ntpq.c releng/10.2/contrib/ntp/ntpq/ntpq.html releng/10.2/contrib/ntp/ntpq/ntpq.man.in releng/10.2/contrib/ntp/ntpq/ntpq.mdoc.in releng/10.2/contrib/ntp/ntpsnmpd/invoke-ntpsnmpd.texi releng/10.2/contrib/ntp/ntpsnmpd/ntpsnmpd-opts.c releng/10.2/contrib/ntp/ntpsnmpd/ntpsnmpd-opts.h releng/10.2/contrib/ntp/ntpsnmpd/ntpsnmpd.1ntpsnmpdman releng/10.2/contrib/ntp/ntpsnmpd/ntpsnmpd.1ntpsnmpdmdoc releng/10.2/contrib/ntp/ntpsnmpd/ntpsnmpd.html releng/10.2/contrib/ntp/ntpsnmpd/ntpsnmpd.man.in releng/10.2/contrib/ntp/ntpsnmpd/ntpsnmpd.mdoc.in releng/10.2/contrib/ntp/packageinfo.sh releng/10.2/contrib/ntp/scripts/build/genAuthors.in releng/10.2/contrib/ntp/scripts/calc_tickadj/calc_tickadj.1calc_tickadjman releng/10.2/contrib/ntp/scripts/calc_tickadj/calc_tickadj.1calc_tickadjmdoc releng/10.2/contrib/ntp/scripts/calc_tickadj/calc_tickadj.html releng/10.2/contrib/ntp/scripts/calc_tickadj/calc_tickadj.man.in releng/10.2/contrib/ntp/scripts/calc_tickadj/calc_tickadj.mdoc.in releng/10.2/contrib/ntp/scripts/calc_tickadj/invoke-calc_tickadj.texi releng/10.2/contrib/ntp/scripts/invoke-plot_summary.texi releng/10.2/contrib/ntp/scripts/invoke-summary.texi releng/10.2/contrib/ntp/scripts/ntp-wait/invoke-ntp-wait.texi releng/10.2/contrib/ntp/scripts/ntp-wait/ntp-wait-opts releng/10.2/contrib/ntp/scripts/ntp-wait/ntp-wait.1ntp-waitman releng/10.2/contrib/ntp/scripts/ntp-wait/ntp-wait.1ntp-waitmdoc releng/10.2/contrib/ntp/scripts/ntp-wait/ntp-wait.html releng/10.2/contrib/ntp/scripts/ntp-wait/ntp-wait.man.in releng/10.2/contrib/ntp/scripts/ntp-wait/ntp-wait.mdoc.in releng/10.2/contrib/ntp/scripts/ntpsweep/invoke-ntpsweep.texi releng/10.2/contrib/ntp/scripts/ntpsweep/ntpsweep-opts releng/10.2/contrib/ntp/scripts/ntpsweep/ntpsweep.1ntpsweepman releng/10.2/contrib/ntp/scripts/ntpsweep/ntpsweep.1ntpsweepmdoc releng/10.2/contrib/ntp/scripts/ntpsweep/ntpsweep.html releng/10.2/contrib/ntp/scripts/ntpsweep/ntpsweep.man.in releng/10.2/contrib/ntp/scripts/ntpsweep/ntpsweep.mdoc.in releng/10.2/contrib/ntp/scripts/ntptrace/invoke-ntptrace.texi releng/10.2/contrib/ntp/scripts/ntptrace/ntptrace-opts releng/10.2/contrib/ntp/scripts/ntptrace/ntptrace.1ntptraceman releng/10.2/contrib/ntp/scripts/ntptrace/ntptrace.1ntptracemdoc releng/10.2/contrib/ntp/scripts/ntptrace/ntptrace.html releng/10.2/contrib/ntp/scripts/ntptrace/ntptrace.man.in releng/10.2/contrib/ntp/scripts/ntptrace/ntptrace.mdoc.in releng/10.2/contrib/ntp/scripts/plot_summary-opts releng/10.2/contrib/ntp/scripts/plot_summary.1plot_summaryman releng/10.2/contrib/ntp/scripts/plot_summary.1plot_summarymdoc releng/10.2/contrib/ntp/scripts/plot_summary.html releng/10.2/contrib/ntp/scripts/plot_summary.man.in releng/10.2/contrib/ntp/scripts/plot_summary.mdoc.in releng/10.2/contrib/ntp/scripts/summary-opts releng/10.2/contrib/ntp/scripts/summary.1summaryman releng/10.2/contrib/ntp/scripts/summary.1summarymdoc releng/10.2/contrib/ntp/scripts/summary.html releng/10.2/contrib/ntp/scripts/summary.man.in releng/10.2/contrib/ntp/scripts/summary.mdoc.in releng/10.2/contrib/ntp/scripts/update-leap/invoke-update-leap.texi releng/10.2/contrib/ntp/scripts/update-leap/update-leap-opts releng/10.2/contrib/ntp/scripts/update-leap/update-leap.1update-leapman releng/10.2/contrib/ntp/scripts/update-leap/update-leap.1update-leapmdoc releng/10.2/contrib/ntp/scripts/update-leap/update-leap.html releng/10.2/contrib/ntp/scripts/update-leap/update-leap.in releng/10.2/contrib/ntp/scripts/update-leap/update-leap.man.in releng/10.2/contrib/ntp/scripts/update-leap/update-leap.mdoc.in releng/10.2/contrib/ntp/sntp/configure releng/10.2/contrib/ntp/sntp/crypto.c releng/10.2/contrib/ntp/sntp/include/version.def releng/10.2/contrib/ntp/sntp/include/version.texi releng/10.2/contrib/ntp/sntp/invoke-sntp.texi releng/10.2/contrib/ntp/sntp/m4/version.m4 releng/10.2/contrib/ntp/sntp/sntp-opts.c releng/10.2/contrib/ntp/sntp/sntp-opts.h releng/10.2/contrib/ntp/sntp/sntp.1sntpman releng/10.2/contrib/ntp/sntp/sntp.1sntpmdoc releng/10.2/contrib/ntp/sntp/sntp.html releng/10.2/contrib/ntp/sntp/sntp.man.in releng/10.2/contrib/ntp/sntp/sntp.mdoc.in releng/10.2/contrib/ntp/sntp/tests/packetProcessing.c releng/10.2/contrib/ntp/sntp/tests/run-packetProcessing.c releng/10.2/contrib/ntp/sntp/unity/Makefile.am releng/10.2/contrib/ntp/sntp/unity/Makefile.in releng/10.2/contrib/ntp/sntp/unity/unity_fixture.c releng/10.2/contrib/ntp/sntp/version.c releng/10.2/contrib/ntp/tests/libntp/a_md5encrypt.c releng/10.2/contrib/ntp/tests/libntp/calendar.c releng/10.2/contrib/ntp/tests/libntp/run-calendar.c releng/10.2/contrib/ntp/tests/libntp/sfptostr.c releng/10.2/contrib/ntp/tests/ntpd/Makefile.am releng/10.2/contrib/ntp/tests/ntpd/Makefile.in releng/10.2/contrib/ntp/util/invoke-ntp-keygen.texi releng/10.2/contrib/ntp/util/ntp-keygen-opts.c releng/10.2/contrib/ntp/util/ntp-keygen-opts.h releng/10.2/contrib/ntp/util/ntp-keygen.1ntp-keygenman releng/10.2/contrib/ntp/util/ntp-keygen.1ntp-keygenmdoc releng/10.2/contrib/ntp/util/ntp-keygen.c releng/10.2/contrib/ntp/util/ntp-keygen.html releng/10.2/contrib/ntp/util/ntp-keygen.man.in releng/10.2/contrib/ntp/util/ntp-keygen.mdoc.in releng/10.2/sys/conf/newvers.sh releng/10.2/usr.sbin/ntp/config.h releng/10.2/usr.sbin/ntp/doc/ntp-keygen.8 releng/10.2/usr.sbin/ntp/doc/ntp.conf.5 releng/10.2/usr.sbin/ntp/doc/ntp.keys.5 releng/10.2/usr.sbin/ntp/doc/ntpd.8 releng/10.2/usr.sbin/ntp/doc/ntpdc.8 releng/10.2/usr.sbin/ntp/doc/ntpq.8 releng/10.2/usr.sbin/ntp/doc/sntp.8 releng/10.2/usr.sbin/ntp/libntp/Makefile releng/10.2/usr.sbin/ntp/scripts/mkver releng/10.3/UPDATING releng/10.3/contrib/ntp/ChangeLog releng/10.3/contrib/ntp/CommitLog releng/10.3/contrib/ntp/NEWS releng/10.3/contrib/ntp/configure releng/10.3/contrib/ntp/html/drivers/driver40.html releng/10.3/contrib/ntp/html/miscopt.html releng/10.3/contrib/ntp/include/Makefile.am releng/10.3/contrib/ntp/include/Makefile.in releng/10.3/contrib/ntp/include/ntp.h releng/10.3/contrib/ntp/include/ntp_intres.h releng/10.3/contrib/ntp/include/ntpd.h releng/10.3/contrib/ntp/lib/isc/netaddr.c releng/10.3/contrib/ntp/libntp/Makefile.am releng/10.3/contrib/ntp/libntp/Makefile.in releng/10.3/contrib/ntp/libntp/a_md5encrypt.c releng/10.3/contrib/ntp/libntp/audio.c releng/10.3/contrib/ntp/libntp/ntp_calendar.c releng/10.3/contrib/ntp/libntp/ntp_intres.c releng/10.3/contrib/ntp/libntp/ssl_init.c releng/10.3/contrib/ntp/libntp/work_fork.c releng/10.3/contrib/ntp/libparse/clk_hopf6021.c releng/10.3/contrib/ntp/ntpd/complete.conf.in releng/10.3/contrib/ntp/ntpd/invoke-ntp.conf.texi releng/10.3/contrib/ntp/ntpd/invoke-ntp.keys.texi releng/10.3/contrib/ntp/ntpd/invoke-ntpd.texi releng/10.3/contrib/ntp/ntpd/keyword-gen-utd releng/10.3/contrib/ntp/ntpd/keyword-gen.c releng/10.3/contrib/ntp/ntpd/ntp.conf.5man releng/10.3/contrib/ntp/ntpd/ntp.conf.5mdoc releng/10.3/contrib/ntp/ntpd/ntp.conf.def releng/10.3/contrib/ntp/ntpd/ntp.conf.html releng/10.3/contrib/ntp/ntpd/ntp.conf.man.in releng/10.3/contrib/ntp/ntpd/ntp.conf.mdoc.in releng/10.3/contrib/ntp/ntpd/ntp.keys.5man releng/10.3/contrib/ntp/ntpd/ntp.keys.5mdoc releng/10.3/contrib/ntp/ntpd/ntp.keys.html releng/10.3/contrib/ntp/ntpd/ntp.keys.man.in releng/10.3/contrib/ntp/ntpd/ntp.keys.mdoc.in releng/10.3/contrib/ntp/ntpd/ntp_config.c releng/10.3/contrib/ntp/ntpd/ntp_control.c releng/10.3/contrib/ntp/ntpd/ntp_crypto.c releng/10.3/contrib/ntp/ntpd/ntp_keyword.h releng/10.3/contrib/ntp/ntpd/ntp_loopfilter.c releng/10.3/contrib/ntp/ntpd/ntp_parser.c releng/10.3/contrib/ntp/ntpd/ntp_parser.h releng/10.3/contrib/ntp/ntpd/ntp_peer.c releng/10.3/contrib/ntp/ntpd/ntp_proto.c releng/10.3/contrib/ntp/ntpd/ntp_refclock.c releng/10.3/contrib/ntp/ntpd/ntpd-opts.c releng/10.3/contrib/ntp/ntpd/ntpd-opts.h releng/10.3/contrib/ntp/ntpd/ntpd.1ntpdman releng/10.3/contrib/ntp/ntpd/ntpd.1ntpdmdoc releng/10.3/contrib/ntp/ntpd/ntpd.html releng/10.3/contrib/ntp/ntpd/ntpd.man.in releng/10.3/contrib/ntp/ntpd/ntpd.mdoc.in releng/10.3/contrib/ntp/ntpd/refclock_gpsdjson.c releng/10.3/contrib/ntp/ntpd/refclock_jjy.c releng/10.3/contrib/ntp/ntpd/refclock_jupiter.c releng/10.3/contrib/ntp/ntpdc/invoke-ntpdc.texi releng/10.3/contrib/ntp/ntpdc/ntpdc-opts.c releng/10.3/contrib/ntp/ntpdc/ntpdc-opts.h releng/10.3/contrib/ntp/ntpdc/ntpdc.1ntpdcman releng/10.3/contrib/ntp/ntpdc/ntpdc.1ntpdcmdoc releng/10.3/contrib/ntp/ntpdc/ntpdc.html releng/10.3/contrib/ntp/ntpdc/ntpdc.man.in releng/10.3/contrib/ntp/ntpdc/ntpdc.mdoc.in releng/10.3/contrib/ntp/ntpq/invoke-ntpq.texi releng/10.3/contrib/ntp/ntpq/ntpq-opts.c releng/10.3/contrib/ntp/ntpq/ntpq-opts.h releng/10.3/contrib/ntp/ntpq/ntpq.1ntpqman releng/10.3/contrib/ntp/ntpq/ntpq.1ntpqmdoc releng/10.3/contrib/ntp/ntpq/ntpq.c releng/10.3/contrib/ntp/ntpq/ntpq.html releng/10.3/contrib/ntp/ntpq/ntpq.man.in releng/10.3/contrib/ntp/ntpq/ntpq.mdoc.in releng/10.3/contrib/ntp/ntpsnmpd/invoke-ntpsnmpd.texi releng/10.3/contrib/ntp/ntpsnmpd/ntpsnmpd-opts.c releng/10.3/contrib/ntp/ntpsnmpd/ntpsnmpd-opts.h releng/10.3/contrib/ntp/ntpsnmpd/ntpsnmpd.1ntpsnmpdman releng/10.3/contrib/ntp/ntpsnmpd/ntpsnmpd.1ntpsnmpdmdoc releng/10.3/contrib/ntp/ntpsnmpd/ntpsnmpd.html releng/10.3/contrib/ntp/ntpsnmpd/ntpsnmpd.man.in releng/10.3/contrib/ntp/ntpsnmpd/ntpsnmpd.mdoc.in releng/10.3/contrib/ntp/packageinfo.sh releng/10.3/contrib/ntp/scripts/build/genAuthors.in releng/10.3/contrib/ntp/scripts/calc_tickadj/calc_tickadj.1calc_tickadjman releng/10.3/contrib/ntp/scripts/calc_tickadj/calc_tickadj.1calc_tickadjmdoc releng/10.3/contrib/ntp/scripts/calc_tickadj/calc_tickadj.html releng/10.3/contrib/ntp/scripts/calc_tickadj/calc_tickadj.man.in releng/10.3/contrib/ntp/scripts/calc_tickadj/calc_tickadj.mdoc.in releng/10.3/contrib/ntp/scripts/calc_tickadj/invoke-calc_tickadj.texi releng/10.3/contrib/ntp/scripts/invoke-plot_summary.texi releng/10.3/contrib/ntp/scripts/invoke-summary.texi releng/10.3/contrib/ntp/scripts/ntp-wait/invoke-ntp-wait.texi releng/10.3/contrib/ntp/scripts/ntp-wait/ntp-wait-opts releng/10.3/contrib/ntp/scripts/ntp-wait/ntp-wait.1ntp-waitman releng/10.3/contrib/ntp/scripts/ntp-wait/ntp-wait.1ntp-waitmdoc releng/10.3/contrib/ntp/scripts/ntp-wait/ntp-wait.html releng/10.3/contrib/ntp/scripts/ntp-wait/ntp-wait.man.in releng/10.3/contrib/ntp/scripts/ntp-wait/ntp-wait.mdoc.in releng/10.3/contrib/ntp/scripts/ntpsweep/invoke-ntpsweep.texi releng/10.3/contrib/ntp/scripts/ntpsweep/ntpsweep-opts releng/10.3/contrib/ntp/scripts/ntpsweep/ntpsweep.1ntpsweepman releng/10.3/contrib/ntp/scripts/ntpsweep/ntpsweep.1ntpsweepmdoc releng/10.3/contrib/ntp/scripts/ntpsweep/ntpsweep.html releng/10.3/contrib/ntp/scripts/ntpsweep/ntpsweep.man.in releng/10.3/contrib/ntp/scripts/ntpsweep/ntpsweep.mdoc.in releng/10.3/contrib/ntp/scripts/ntptrace/invoke-ntptrace.texi releng/10.3/contrib/ntp/scripts/ntptrace/ntptrace-opts releng/10.3/contrib/ntp/scripts/ntptrace/ntptrace.1ntptraceman releng/10.3/contrib/ntp/scripts/ntptrace/ntptrace.1ntptracemdoc releng/10.3/contrib/ntp/scripts/ntptrace/ntptrace.html releng/10.3/contrib/ntp/scripts/ntptrace/ntptrace.man.in releng/10.3/contrib/ntp/scripts/ntptrace/ntptrace.mdoc.in releng/10.3/contrib/ntp/scripts/plot_summary-opts releng/10.3/contrib/ntp/scripts/plot_summary.1plot_summaryman releng/10.3/contrib/ntp/scripts/plot_summary.1plot_summarymdoc releng/10.3/contrib/ntp/scripts/plot_summary.html releng/10.3/contrib/ntp/scripts/plot_summary.man.in releng/10.3/contrib/ntp/scripts/plot_summary.mdoc.in releng/10.3/contrib/ntp/scripts/summary-opts releng/10.3/contrib/ntp/scripts/summary.1summaryman releng/10.3/contrib/ntp/scripts/summary.1summarymdoc releng/10.3/contrib/ntp/scripts/summary.html releng/10.3/contrib/ntp/scripts/summary.man.in releng/10.3/contrib/ntp/scripts/summary.mdoc.in releng/10.3/contrib/ntp/scripts/update-leap/invoke-update-leap.texi releng/10.3/contrib/ntp/scripts/update-leap/update-leap-opts releng/10.3/contrib/ntp/scripts/update-leap/update-leap.1update-leapman releng/10.3/contrib/ntp/scripts/update-leap/update-leap.1update-leapmdoc releng/10.3/contrib/ntp/scripts/update-leap/update-leap.html releng/10.3/contrib/ntp/scripts/update-leap/update-leap.in releng/10.3/contrib/ntp/scripts/update-leap/update-leap.man.in releng/10.3/contrib/ntp/scripts/update-leap/update-leap.mdoc.in releng/10.3/contrib/ntp/sntp/configure releng/10.3/contrib/ntp/sntp/crypto.c releng/10.3/contrib/ntp/sntp/include/version.def releng/10.3/contrib/ntp/sntp/include/version.texi releng/10.3/contrib/ntp/sntp/invoke-sntp.texi releng/10.3/contrib/ntp/sntp/m4/version.m4 releng/10.3/contrib/ntp/sntp/sntp-opts.c releng/10.3/contrib/ntp/sntp/sntp-opts.h releng/10.3/contrib/ntp/sntp/sntp.1sntpman releng/10.3/contrib/ntp/sntp/sntp.1sntpmdoc releng/10.3/contrib/ntp/sntp/sntp.html releng/10.3/contrib/ntp/sntp/sntp.man.in releng/10.3/contrib/ntp/sntp/sntp.mdoc.in releng/10.3/contrib/ntp/sntp/tests/packetProcessing.c releng/10.3/contrib/ntp/sntp/tests/run-packetProcessing.c releng/10.3/contrib/ntp/sntp/unity/Makefile.am releng/10.3/contrib/ntp/sntp/unity/Makefile.in releng/10.3/contrib/ntp/sntp/unity/unity_fixture.c releng/10.3/contrib/ntp/sntp/version.c releng/10.3/contrib/ntp/tests/libntp/a_md5encrypt.c releng/10.3/contrib/ntp/tests/libntp/calendar.c releng/10.3/contrib/ntp/tests/libntp/run-calendar.c releng/10.3/contrib/ntp/tests/libntp/sfptostr.c releng/10.3/contrib/ntp/tests/ntpd/Makefile.am releng/10.3/contrib/ntp/tests/ntpd/Makefile.in releng/10.3/contrib/ntp/util/invoke-ntp-keygen.texi releng/10.3/contrib/ntp/util/ntp-keygen-opts.c releng/10.3/contrib/ntp/util/ntp-keygen-opts.h releng/10.3/contrib/ntp/util/ntp-keygen.1ntp-keygenman releng/10.3/contrib/ntp/util/ntp-keygen.1ntp-keygenmdoc releng/10.3/contrib/ntp/util/ntp-keygen.c releng/10.3/contrib/ntp/util/ntp-keygen.html releng/10.3/contrib/ntp/util/ntp-keygen.man.in releng/10.3/contrib/ntp/util/ntp-keygen.mdoc.in releng/10.3/sys/conf/newvers.sh releng/10.3/usr.sbin/ntp/config.h releng/10.3/usr.sbin/ntp/doc/ntp-keygen.8 releng/10.3/usr.sbin/ntp/doc/ntp.conf.5 releng/10.3/usr.sbin/ntp/doc/ntp.keys.5 releng/10.3/usr.sbin/ntp/doc/ntpd.8 releng/10.3/usr.sbin/ntp/doc/ntpdc.8 releng/10.3/usr.sbin/ntp/doc/ntpq.8 releng/10.3/usr.sbin/ntp/doc/sntp.8 releng/10.3/usr.sbin/ntp/libntp/Makefile releng/10.3/usr.sbin/ntp/scripts/mkver releng/11.0/UPDATING releng/11.0/contrib/ntp/ChangeLog releng/11.0/contrib/ntp/CommitLog releng/11.0/contrib/ntp/NEWS releng/11.0/contrib/ntp/configure releng/11.0/contrib/ntp/html/drivers/driver40.html releng/11.0/contrib/ntp/html/miscopt.html releng/11.0/contrib/ntp/include/Makefile.am releng/11.0/contrib/ntp/include/Makefile.in releng/11.0/contrib/ntp/include/ntp.h releng/11.0/contrib/ntp/include/ntp_intres.h releng/11.0/contrib/ntp/include/ntpd.h releng/11.0/contrib/ntp/lib/isc/netaddr.c releng/11.0/contrib/ntp/libntp/Makefile.am releng/11.0/contrib/ntp/libntp/Makefile.in releng/11.0/contrib/ntp/libntp/a_md5encrypt.c releng/11.0/contrib/ntp/libntp/audio.c releng/11.0/contrib/ntp/libntp/ntp_calendar.c releng/11.0/contrib/ntp/libntp/ntp_intres.c releng/11.0/contrib/ntp/libntp/ssl_init.c releng/11.0/contrib/ntp/libntp/work_fork.c releng/11.0/contrib/ntp/libparse/clk_hopf6021.c releng/11.0/contrib/ntp/ntpd/complete.conf.in releng/11.0/contrib/ntp/ntpd/invoke-ntp.conf.texi releng/11.0/contrib/ntp/ntpd/invoke-ntp.keys.texi releng/11.0/contrib/ntp/ntpd/invoke-ntpd.texi releng/11.0/contrib/ntp/ntpd/keyword-gen-utd releng/11.0/contrib/ntp/ntpd/keyword-gen.c releng/11.0/contrib/ntp/ntpd/ntp.conf.5man releng/11.0/contrib/ntp/ntpd/ntp.conf.5mdoc releng/11.0/contrib/ntp/ntpd/ntp.conf.def releng/11.0/contrib/ntp/ntpd/ntp.conf.html releng/11.0/contrib/ntp/ntpd/ntp.conf.man.in releng/11.0/contrib/ntp/ntpd/ntp.conf.mdoc.in releng/11.0/contrib/ntp/ntpd/ntp.keys.5man releng/11.0/contrib/ntp/ntpd/ntp.keys.5mdoc releng/11.0/contrib/ntp/ntpd/ntp.keys.html releng/11.0/contrib/ntp/ntpd/ntp.keys.man.in releng/11.0/contrib/ntp/ntpd/ntp.keys.mdoc.in releng/11.0/contrib/ntp/ntpd/ntp_config.c releng/11.0/contrib/ntp/ntpd/ntp_control.c releng/11.0/contrib/ntp/ntpd/ntp_crypto.c releng/11.0/contrib/ntp/ntpd/ntp_keyword.h releng/11.0/contrib/ntp/ntpd/ntp_loopfilter.c releng/11.0/contrib/ntp/ntpd/ntp_parser.c releng/11.0/contrib/ntp/ntpd/ntp_parser.h releng/11.0/contrib/ntp/ntpd/ntp_peer.c releng/11.0/contrib/ntp/ntpd/ntp_proto.c releng/11.0/contrib/ntp/ntpd/ntp_refclock.c releng/11.0/contrib/ntp/ntpd/ntpd-opts.c releng/11.0/contrib/ntp/ntpd/ntpd-opts.h releng/11.0/contrib/ntp/ntpd/ntpd.1ntpdman releng/11.0/contrib/ntp/ntpd/ntpd.1ntpdmdoc releng/11.0/contrib/ntp/ntpd/ntpd.html releng/11.0/contrib/ntp/ntpd/ntpd.man.in releng/11.0/contrib/ntp/ntpd/ntpd.mdoc.in releng/11.0/contrib/ntp/ntpd/refclock_gpsdjson.c releng/11.0/contrib/ntp/ntpd/refclock_jjy.c releng/11.0/contrib/ntp/ntpd/refclock_jupiter.c releng/11.0/contrib/ntp/ntpdc/invoke-ntpdc.texi releng/11.0/contrib/ntp/ntpdc/ntpdc-opts.c releng/11.0/contrib/ntp/ntpdc/ntpdc-opts.h releng/11.0/contrib/ntp/ntpdc/ntpdc.1ntpdcman releng/11.0/contrib/ntp/ntpdc/ntpdc.1ntpdcmdoc releng/11.0/contrib/ntp/ntpdc/ntpdc.html releng/11.0/contrib/ntp/ntpdc/ntpdc.man.in releng/11.0/contrib/ntp/ntpdc/ntpdc.mdoc.in releng/11.0/contrib/ntp/ntpq/invoke-ntpq.texi releng/11.0/contrib/ntp/ntpq/ntpq-opts.c releng/11.0/contrib/ntp/ntpq/ntpq-opts.h releng/11.0/contrib/ntp/ntpq/ntpq.1ntpqman releng/11.0/contrib/ntp/ntpq/ntpq.1ntpqmdoc releng/11.0/contrib/ntp/ntpq/ntpq.c releng/11.0/contrib/ntp/ntpq/ntpq.html releng/11.0/contrib/ntp/ntpq/ntpq.man.in releng/11.0/contrib/ntp/ntpq/ntpq.mdoc.in releng/11.0/contrib/ntp/ntpsnmpd/invoke-ntpsnmpd.texi releng/11.0/contrib/ntp/ntpsnmpd/ntpsnmpd-opts.c releng/11.0/contrib/ntp/ntpsnmpd/ntpsnmpd-opts.h releng/11.0/contrib/ntp/ntpsnmpd/ntpsnmpd.1ntpsnmpdman releng/11.0/contrib/ntp/ntpsnmpd/ntpsnmpd.1ntpsnmpdmdoc releng/11.0/contrib/ntp/ntpsnmpd/ntpsnmpd.html releng/11.0/contrib/ntp/ntpsnmpd/ntpsnmpd.man.in releng/11.0/contrib/ntp/ntpsnmpd/ntpsnmpd.mdoc.in releng/11.0/contrib/ntp/packageinfo.sh releng/11.0/contrib/ntp/scripts/build/genAuthors.in releng/11.0/contrib/ntp/scripts/calc_tickadj/calc_tickadj.1calc_tickadjman releng/11.0/contrib/ntp/scripts/calc_tickadj/calc_tickadj.1calc_tickadjmdoc releng/11.0/contrib/ntp/scripts/calc_tickadj/calc_tickadj.html releng/11.0/contrib/ntp/scripts/calc_tickadj/calc_tickadj.man.in releng/11.0/contrib/ntp/scripts/calc_tickadj/calc_tickadj.mdoc.in releng/11.0/contrib/ntp/scripts/calc_tickadj/invoke-calc_tickadj.texi releng/11.0/contrib/ntp/scripts/invoke-plot_summary.texi releng/11.0/contrib/ntp/scripts/invoke-summary.texi releng/11.0/contrib/ntp/scripts/ntp-wait/invoke-ntp-wait.texi releng/11.0/contrib/ntp/scripts/ntp-wait/ntp-wait-opts releng/11.0/contrib/ntp/scripts/ntp-wait/ntp-wait.1ntp-waitman releng/11.0/contrib/ntp/scripts/ntp-wait/ntp-wait.1ntp-waitmdoc releng/11.0/contrib/ntp/scripts/ntp-wait/ntp-wait.html releng/11.0/contrib/ntp/scripts/ntp-wait/ntp-wait.man.in releng/11.0/contrib/ntp/scripts/ntp-wait/ntp-wait.mdoc.in releng/11.0/contrib/ntp/scripts/ntpsweep/invoke-ntpsweep.texi releng/11.0/contrib/ntp/scripts/ntpsweep/ntpsweep-opts releng/11.0/contrib/ntp/scripts/ntpsweep/ntpsweep.1ntpsweepman releng/11.0/contrib/ntp/scripts/ntpsweep/ntpsweep.1ntpsweepmdoc releng/11.0/contrib/ntp/scripts/ntpsweep/ntpsweep.html releng/11.0/contrib/ntp/scripts/ntpsweep/ntpsweep.man.in releng/11.0/contrib/ntp/scripts/ntpsweep/ntpsweep.mdoc.in releng/11.0/contrib/ntp/scripts/ntptrace/invoke-ntptrace.texi releng/11.0/contrib/ntp/scripts/ntptrace/ntptrace-opts releng/11.0/contrib/ntp/scripts/ntptrace/ntptrace.1ntptraceman releng/11.0/contrib/ntp/scripts/ntptrace/ntptrace.1ntptracemdoc releng/11.0/contrib/ntp/scripts/ntptrace/ntptrace.html releng/11.0/contrib/ntp/scripts/ntptrace/ntptrace.man.in releng/11.0/contrib/ntp/scripts/ntptrace/ntptrace.mdoc.in releng/11.0/contrib/ntp/scripts/plot_summary-opts releng/11.0/contrib/ntp/scripts/plot_summary.1plot_summaryman releng/11.0/contrib/ntp/scripts/plot_summary.1plot_summarymdoc releng/11.0/contrib/ntp/scripts/plot_summary.html releng/11.0/contrib/ntp/scripts/plot_summary.man.in releng/11.0/contrib/ntp/scripts/plot_summary.mdoc.in releng/11.0/contrib/ntp/scripts/summary-opts releng/11.0/contrib/ntp/scripts/summary.1summaryman releng/11.0/contrib/ntp/scripts/summary.1summarymdoc releng/11.0/contrib/ntp/scripts/summary.html releng/11.0/contrib/ntp/scripts/summary.man.in releng/11.0/contrib/ntp/scripts/summary.mdoc.in releng/11.0/contrib/ntp/scripts/update-leap/invoke-update-leap.texi releng/11.0/contrib/ntp/scripts/update-leap/update-leap-opts releng/11.0/contrib/ntp/scripts/update-leap/update-leap.1update-leapman releng/11.0/contrib/ntp/scripts/update-leap/update-leap.1update-leapmdoc releng/11.0/contrib/ntp/scripts/update-leap/update-leap.html releng/11.0/contrib/ntp/scripts/update-leap/update-leap.in releng/11.0/contrib/ntp/scripts/update-leap/update-leap.man.in releng/11.0/contrib/ntp/scripts/update-leap/update-leap.mdoc.in releng/11.0/contrib/ntp/sntp/configure releng/11.0/contrib/ntp/sntp/crypto.c releng/11.0/contrib/ntp/sntp/include/version.def releng/11.0/contrib/ntp/sntp/include/version.texi releng/11.0/contrib/ntp/sntp/invoke-sntp.texi releng/11.0/contrib/ntp/sntp/m4/version.m4 releng/11.0/contrib/ntp/sntp/sntp-opts.c releng/11.0/contrib/ntp/sntp/sntp-opts.h releng/11.0/contrib/ntp/sntp/sntp.1sntpman releng/11.0/contrib/ntp/sntp/sntp.1sntpmdoc releng/11.0/contrib/ntp/sntp/sntp.html releng/11.0/contrib/ntp/sntp/sntp.man.in releng/11.0/contrib/ntp/sntp/sntp.mdoc.in releng/11.0/contrib/ntp/sntp/tests/packetProcessing.c releng/11.0/contrib/ntp/sntp/tests/run-packetProcessing.c releng/11.0/contrib/ntp/sntp/unity/Makefile.am releng/11.0/contrib/ntp/sntp/unity/Makefile.in releng/11.0/contrib/ntp/sntp/unity/unity_fixture.c releng/11.0/contrib/ntp/sntp/version.c releng/11.0/contrib/ntp/tests/libntp/a_md5encrypt.c releng/11.0/contrib/ntp/tests/libntp/calendar.c releng/11.0/contrib/ntp/tests/libntp/run-calendar.c releng/11.0/contrib/ntp/tests/libntp/sfptostr.c releng/11.0/contrib/ntp/tests/ntpd/Makefile.am releng/11.0/contrib/ntp/tests/ntpd/Makefile.in releng/11.0/contrib/ntp/util/invoke-ntp-keygen.texi releng/11.0/contrib/ntp/util/ntp-keygen-opts.c releng/11.0/contrib/ntp/util/ntp-keygen-opts.h releng/11.0/contrib/ntp/util/ntp-keygen.1ntp-keygenman releng/11.0/contrib/ntp/util/ntp-keygen.1ntp-keygenmdoc releng/11.0/contrib/ntp/util/ntp-keygen.c releng/11.0/contrib/ntp/util/ntp-keygen.html releng/11.0/contrib/ntp/util/ntp-keygen.man.in releng/11.0/contrib/ntp/util/ntp-keygen.mdoc.in releng/11.0/sys/conf/newvers.sh releng/11.0/usr.sbin/ntp/config.h releng/11.0/usr.sbin/ntp/doc/ntp-keygen.8 releng/11.0/usr.sbin/ntp/doc/ntp.conf.5 releng/11.0/usr.sbin/ntp/doc/ntp.keys.5 releng/11.0/usr.sbin/ntp/doc/ntpd.8 releng/11.0/usr.sbin/ntp/doc/ntpdc.8 releng/11.0/usr.sbin/ntp/doc/ntpq.8 releng/11.0/usr.sbin/ntp/doc/sntp.8 releng/11.0/usr.sbin/ntp/libntp/Makefile releng/11.0/usr.sbin/ntp/scripts/mkver releng/9.3/UPDATING releng/9.3/contrib/ntp/ChangeLog releng/9.3/contrib/ntp/CommitLog releng/9.3/contrib/ntp/NEWS releng/9.3/contrib/ntp/configure releng/9.3/contrib/ntp/html/drivers/driver40.html releng/9.3/contrib/ntp/html/miscopt.html releng/9.3/contrib/ntp/include/Makefile.am releng/9.3/contrib/ntp/include/Makefile.in releng/9.3/contrib/ntp/include/ntp.h releng/9.3/contrib/ntp/include/ntp_intres.h releng/9.3/contrib/ntp/include/ntpd.h releng/9.3/contrib/ntp/lib/isc/netaddr.c releng/9.3/contrib/ntp/libntp/Makefile.am releng/9.3/contrib/ntp/libntp/Makefile.in releng/9.3/contrib/ntp/libntp/a_md5encrypt.c releng/9.3/contrib/ntp/libntp/audio.c releng/9.3/contrib/ntp/libntp/ntp_calendar.c releng/9.3/contrib/ntp/libntp/ntp_intres.c releng/9.3/contrib/ntp/libntp/ssl_init.c releng/9.3/contrib/ntp/libntp/work_fork.c releng/9.3/contrib/ntp/libparse/clk_hopf6021.c releng/9.3/contrib/ntp/ntpd/complete.conf.in releng/9.3/contrib/ntp/ntpd/invoke-ntp.conf.texi releng/9.3/contrib/ntp/ntpd/invoke-ntp.keys.texi releng/9.3/contrib/ntp/ntpd/invoke-ntpd.texi releng/9.3/contrib/ntp/ntpd/keyword-gen-utd releng/9.3/contrib/ntp/ntpd/keyword-gen.c releng/9.3/contrib/ntp/ntpd/ntp.conf.5man releng/9.3/contrib/ntp/ntpd/ntp.conf.5mdoc releng/9.3/contrib/ntp/ntpd/ntp.conf.def releng/9.3/contrib/ntp/ntpd/ntp.conf.html releng/9.3/contrib/ntp/ntpd/ntp.conf.man.in releng/9.3/contrib/ntp/ntpd/ntp.conf.mdoc.in releng/9.3/contrib/ntp/ntpd/ntp.keys.5man releng/9.3/contrib/ntp/ntpd/ntp.keys.5mdoc releng/9.3/contrib/ntp/ntpd/ntp.keys.html releng/9.3/contrib/ntp/ntpd/ntp.keys.man.in releng/9.3/contrib/ntp/ntpd/ntp.keys.mdoc.in releng/9.3/contrib/ntp/ntpd/ntp_config.c releng/9.3/contrib/ntp/ntpd/ntp_control.c releng/9.3/contrib/ntp/ntpd/ntp_crypto.c releng/9.3/contrib/ntp/ntpd/ntp_keyword.h releng/9.3/contrib/ntp/ntpd/ntp_loopfilter.c releng/9.3/contrib/ntp/ntpd/ntp_parser.c releng/9.3/contrib/ntp/ntpd/ntp_parser.h releng/9.3/contrib/ntp/ntpd/ntp_peer.c releng/9.3/contrib/ntp/ntpd/ntp_proto.c releng/9.3/contrib/ntp/ntpd/ntp_refclock.c releng/9.3/contrib/ntp/ntpd/ntpd-opts.c releng/9.3/contrib/ntp/ntpd/ntpd-opts.h releng/9.3/contrib/ntp/ntpd/ntpd.1ntpdman releng/9.3/contrib/ntp/ntpd/ntpd.1ntpdmdoc releng/9.3/contrib/ntp/ntpd/ntpd.html releng/9.3/contrib/ntp/ntpd/ntpd.man.in releng/9.3/contrib/ntp/ntpd/ntpd.mdoc.in releng/9.3/contrib/ntp/ntpd/refclock_gpsdjson.c releng/9.3/contrib/ntp/ntpd/refclock_jjy.c releng/9.3/contrib/ntp/ntpd/refclock_jupiter.c releng/9.3/contrib/ntp/ntpdc/invoke-ntpdc.texi releng/9.3/contrib/ntp/ntpdc/ntpdc-opts.c releng/9.3/contrib/ntp/ntpdc/ntpdc-opts.h releng/9.3/contrib/ntp/ntpdc/ntpdc.1ntpdcman releng/9.3/contrib/ntp/ntpdc/ntpdc.1ntpdcmdoc releng/9.3/contrib/ntp/ntpdc/ntpdc.html releng/9.3/contrib/ntp/ntpdc/ntpdc.man.in releng/9.3/contrib/ntp/ntpdc/ntpdc.mdoc.in releng/9.3/contrib/ntp/ntpq/invoke-ntpq.texi releng/9.3/contrib/ntp/ntpq/ntpq-opts.c releng/9.3/contrib/ntp/ntpq/ntpq-opts.h releng/9.3/contrib/ntp/ntpq/ntpq.1ntpqman releng/9.3/contrib/ntp/ntpq/ntpq.1ntpqmdoc releng/9.3/contrib/ntp/ntpq/ntpq.c releng/9.3/contrib/ntp/ntpq/ntpq.html releng/9.3/contrib/ntp/ntpq/ntpq.man.in releng/9.3/contrib/ntp/ntpq/ntpq.mdoc.in releng/9.3/contrib/ntp/ntpsnmpd/invoke-ntpsnmpd.texi releng/9.3/contrib/ntp/ntpsnmpd/ntpsnmpd-opts.c releng/9.3/contrib/ntp/ntpsnmpd/ntpsnmpd-opts.h releng/9.3/contrib/ntp/ntpsnmpd/ntpsnmpd.1ntpsnmpdman releng/9.3/contrib/ntp/ntpsnmpd/ntpsnmpd.1ntpsnmpdmdoc releng/9.3/contrib/ntp/ntpsnmpd/ntpsnmpd.html releng/9.3/contrib/ntp/ntpsnmpd/ntpsnmpd.man.in releng/9.3/contrib/ntp/ntpsnmpd/ntpsnmpd.mdoc.in releng/9.3/contrib/ntp/packageinfo.sh releng/9.3/contrib/ntp/scripts/build/genAuthors.in releng/9.3/contrib/ntp/scripts/calc_tickadj/calc_tickadj.1calc_tickadjman releng/9.3/contrib/ntp/scripts/calc_tickadj/calc_tickadj.1calc_tickadjmdoc releng/9.3/contrib/ntp/scripts/calc_tickadj/calc_tickadj.html releng/9.3/contrib/ntp/scripts/calc_tickadj/calc_tickadj.man.in releng/9.3/contrib/ntp/scripts/calc_tickadj/calc_tickadj.mdoc.in releng/9.3/contrib/ntp/scripts/calc_tickadj/invoke-calc_tickadj.texi releng/9.3/contrib/ntp/scripts/invoke-plot_summary.texi releng/9.3/contrib/ntp/scripts/invoke-summary.texi releng/9.3/contrib/ntp/scripts/ntp-wait/invoke-ntp-wait.texi releng/9.3/contrib/ntp/scripts/ntp-wait/ntp-wait-opts releng/9.3/contrib/ntp/scripts/ntp-wait/ntp-wait.1ntp-waitman releng/9.3/contrib/ntp/scripts/ntp-wait/ntp-wait.1ntp-waitmdoc releng/9.3/contrib/ntp/scripts/ntp-wait/ntp-wait.html releng/9.3/contrib/ntp/scripts/ntp-wait/ntp-wait.man.in releng/9.3/contrib/ntp/scripts/ntp-wait/ntp-wait.mdoc.in releng/9.3/contrib/ntp/scripts/ntpsweep/invoke-ntpsweep.texi releng/9.3/contrib/ntp/scripts/ntpsweep/ntpsweep-opts releng/9.3/contrib/ntp/scripts/ntpsweep/ntpsweep.1ntpsweepman releng/9.3/contrib/ntp/scripts/ntpsweep/ntpsweep.1ntpsweepmdoc releng/9.3/contrib/ntp/scripts/ntpsweep/ntpsweep.html releng/9.3/contrib/ntp/scripts/ntpsweep/ntpsweep.man.in releng/9.3/contrib/ntp/scripts/ntpsweep/ntpsweep.mdoc.in releng/9.3/contrib/ntp/scripts/ntptrace/invoke-ntptrace.texi releng/9.3/contrib/ntp/scripts/ntptrace/ntptrace-opts releng/9.3/contrib/ntp/scripts/ntptrace/ntptrace.1ntptraceman releng/9.3/contrib/ntp/scripts/ntptrace/ntptrace.1ntptracemdoc releng/9.3/contrib/ntp/scripts/ntptrace/ntptrace.html releng/9.3/contrib/ntp/scripts/ntptrace/ntptrace.man.in releng/9.3/contrib/ntp/scripts/ntptrace/ntptrace.mdoc.in releng/9.3/contrib/ntp/scripts/plot_summary-opts releng/9.3/contrib/ntp/scripts/plot_summary.1plot_summaryman releng/9.3/contrib/ntp/scripts/plot_summary.1plot_summarymdoc releng/9.3/contrib/ntp/scripts/plot_summary.html releng/9.3/contrib/ntp/scripts/plot_summary.man.in releng/9.3/contrib/ntp/scripts/plot_summary.mdoc.in releng/9.3/contrib/ntp/scripts/summary-opts releng/9.3/contrib/ntp/scripts/summary.1summaryman releng/9.3/contrib/ntp/scripts/summary.1summarymdoc releng/9.3/contrib/ntp/scripts/summary.html releng/9.3/contrib/ntp/scripts/summary.man.in releng/9.3/contrib/ntp/scripts/summary.mdoc.in releng/9.3/contrib/ntp/scripts/update-leap/invoke-update-leap.texi releng/9.3/contrib/ntp/scripts/update-leap/update-leap-opts releng/9.3/contrib/ntp/scripts/update-leap/update-leap.1update-leapman releng/9.3/contrib/ntp/scripts/update-leap/update-leap.1update-leapmdoc releng/9.3/contrib/ntp/scripts/update-leap/update-leap.html releng/9.3/contrib/ntp/scripts/update-leap/update-leap.in releng/9.3/contrib/ntp/scripts/update-leap/update-leap.man.in releng/9.3/contrib/ntp/scripts/update-leap/update-leap.mdoc.in releng/9.3/contrib/ntp/sntp/configure releng/9.3/contrib/ntp/sntp/crypto.c releng/9.3/contrib/ntp/sntp/include/version.def releng/9.3/contrib/ntp/sntp/include/version.texi releng/9.3/contrib/ntp/sntp/invoke-sntp.texi releng/9.3/contrib/ntp/sntp/m4/version.m4 releng/9.3/contrib/ntp/sntp/sntp-opts.c releng/9.3/contrib/ntp/sntp/sntp-opts.h releng/9.3/contrib/ntp/sntp/sntp.1sntpman releng/9.3/contrib/ntp/sntp/sntp.1sntpmdoc releng/9.3/contrib/ntp/sntp/sntp.html releng/9.3/contrib/ntp/sntp/sntp.man.in releng/9.3/contrib/ntp/sntp/sntp.mdoc.in releng/9.3/contrib/ntp/sntp/tests/packetProcessing.c releng/9.3/contrib/ntp/sntp/tests/run-packetProcessing.c releng/9.3/contrib/ntp/sntp/unity/Makefile.am releng/9.3/contrib/ntp/sntp/unity/Makefile.in releng/9.3/contrib/ntp/sntp/unity/unity_fixture.c releng/9.3/contrib/ntp/sntp/version.c releng/9.3/contrib/ntp/tests/libntp/a_md5encrypt.c releng/9.3/contrib/ntp/tests/libntp/calendar.c releng/9.3/contrib/ntp/tests/libntp/run-calendar.c releng/9.3/contrib/ntp/tests/libntp/sfptostr.c releng/9.3/contrib/ntp/tests/ntpd/Makefile.am releng/9.3/contrib/ntp/tests/ntpd/Makefile.in releng/9.3/contrib/ntp/util/invoke-ntp-keygen.texi releng/9.3/contrib/ntp/util/ntp-keygen-opts.c releng/9.3/contrib/ntp/util/ntp-keygen-opts.h releng/9.3/contrib/ntp/util/ntp-keygen.1ntp-keygenman releng/9.3/contrib/ntp/util/ntp-keygen.1ntp-keygenmdoc releng/9.3/contrib/ntp/util/ntp-keygen.c releng/9.3/contrib/ntp/util/ntp-keygen.html releng/9.3/contrib/ntp/util/ntp-keygen.man.in releng/9.3/contrib/ntp/util/ntp-keygen.mdoc.in releng/9.3/sys/conf/newvers.sh releng/9.3/usr.sbin/ntp/config.h releng/9.3/usr.sbin/ntp/doc/ntp-keygen.8 releng/9.3/usr.sbin/ntp/doc/ntp.conf.5 releng/9.3/usr.sbin/ntp/doc/ntp.keys.5 releng/9.3/usr.sbin/ntp/doc/ntpd.8 releng/9.3/usr.sbin/ntp/doc/ntpdc.8 releng/9.3/usr.sbin/ntp/doc/ntpq.8 releng/9.3/usr.sbin/ntp/doc/sntp.8 releng/9.3/usr.sbin/ntp/libntp/Makefile releng/9.3/usr.sbin/ntp/ntp-keygen/Makefile releng/9.3/usr.sbin/ntp/scripts/mkver Modified: releng/10.1/UPDATING ============================================================================== --- releng/10.1/UPDATING Thu Dec 22 16:09:44 2016 (r310418) +++ releng/10.1/UPDATING Thu Dec 22 16:19:05 2016 (r310419) @@ -16,6 +16,10 @@ from older versions of FreeBSD, try WITH stable/10, and then rebuild without this option. The bootstrap process from older version of current is a bit fragile. +20161222 p45 FreeBSD-SA-16:39.ntp + + Fix multiple vulnerabilities of ntp. + 20161208 p44 FreeBSD-SA-16:37.libc [revised] Fix regressions introduced by SA-16:37.libc. Modified: releng/10.1/contrib/ntp/ChangeLog ============================================================================== --- releng/10.1/contrib/ntp/ChangeLog Thu Dec 22 16:09:44 2016 (r310418) +++ releng/10.1/contrib/ntp/ChangeLog Thu Dec 22 16:19:05 2016 (r310419) @@ -1,4 +1,73 @@ --- +(4.2.8p9) 2016/11/21 Released by Harlan Stenn +(4.2.8p9) 2016/MM/DD Released by Harlan Stenn + +* [Sec 3119] Trap crash +* [Sec 3118] Mode 6 information disclosure and DDoS vector + - TRAP config via mode 6 packet requires AUTH now. +* [Sec 3114] Broadcast Mode Replay Prevention DoS + - applied patches by Matthew Van Gundy. + - with bcpollbstep, tweaks and cleanup by stenn@ntp.org +* [Sec 3113] Broadcast Mode Poll Interval Enforcement DoS + - applied fix as suggested by Matthew Van Gundy +* [Sec 3110] Windows: ntpd DoS by oversized UDP packet + - fixed error handling for truncated UDP packets. +* [Sec 3102] Zero origin issues. HStenn. +* [Sec 3082] null pointer dereference in _IO_str_init_static_internal() + - more hardening to read_mru_list(). perlinger@ntp.org +* [Sec 3072] Attack on interface selection + - implemented Miroslav Lichvars suggestion + to skip interface updates based on incoming packets +* [Bug 3142] bug in netmask prefix length detection +* [Bug 3138] gpsdjson refclock should honor fudgetime1. stenn@ntp.org +* [Bug 3129] Unknown hosts can put resolver thread into a hard loop + - moved retry decision where it belongs. +* [Bug 3125] NTPD doesn't fully start when ntp.conf entries are out of order + using the loopback-ppsapi-provider.dll +* [Bug 3116] unit tests for NTP time stamp expansion. +* [Bug 3100] ntpq can't retrieve daemon_version + - fixed extended sysvar lookup (bug introduced with bug 3008 fix) +* [Bug 3095] Compatibility with openssl 1.1 + - applied patches by Kurt Roeckx to source + - added shim layer for SSL API calls with issues (both directions) +* [Bug 3089] Serial Parser does not work anymore for hopfser like device + - simplified / refactored hex-decoding in driver. +* [Bug 3084] update-leap mis-parses the leapfile name. HStenn. +* [Bug 3068] Linker warnings when building on Solaris. perlinger@ntp.org + - applied patch thanks to Andrew Stormont +* [Bug 3067] Root distance calculation needs improvement. HStenn. +* [Bug 3066] NMEA clock ignores pps. perlinger@ntp.org + - PPS-HACK works again. +* [Bug 3059] Potential buffer overrun from oversized hash + - applied patch by Brian Utterback +* [Bug 3053] ntp_loopfilter.c frequency calc precedence error. Sarah White. +* [Bug 3050] Fix for bug #2960 causes [...] spurious error message. + + - patches by Reinhard Max and Havard Eidnes +* [Bug 3047] Fix refclock_jjy C-DEX JST2000. abe@ntp.org + - Patch provided by Kuramatsu. +* [Bug 3021] unity_fixture.c needs pragma weak + - removed unnecessary & harmful decls of 'setUp()' & 'tearDown()' +* [Bug 3019] Windows: ERROR_HOST_UNREACHABLE block packet processing. + DMayer and JPerlinger. +* [Bug 2998] sntp/tests/packetProcessing.c broken without openssl. JPerlinger +* [Bug 2961] sntp/tests/packetProcessing.c assumes AUTOKEY. HStenn. +* [Bug 2959] refclock_jupiter: gps week correction + - fixed GPS week expansion to work based on build date. Special thanks + to Craig Leres for initial patch and testing. +* [Bug 2951] ntpd tests fail: multiple definition of `send_via_ntp_signd' + - fixed Makefile.am +* [Bug 2689] ATOM driver processes last PPS pulse at startup, + even if it is very old + - make sure PPS source is alive before processing samples + - improve stability close to the 500ms phase jump (phase gate) +* Fix typos in include/ntp.h. +* Shim X509_get_signature_nid() if needed. +* git author attribution cleanup +* bk ignore file cleanup +* remove locks in Windows IO, use rpc-like thread synchronisation instead + +--- (4.2.8p8) 2016/06/02 Released by Harlan Stenn * [Sec 3042] Broadcast Interleave. HStenn. @@ -19,7 +88,7 @@ * Fix typo in ntp-wait and plot_summary. HStenn. * Make sure we have an "author" file for git imports. HStenn. * Update the sntp problem tests for MacOS. HStenn. - + --- (4.2.8p7) 2016/04/26 Released by Harlan Stenn Modified: releng/10.1/contrib/ntp/CommitLog ============================================================================== --- releng/10.1/contrib/ntp/CommitLog Thu Dec 22 16:09:44 2016 (r310418) +++ releng/10.1/contrib/ntp/CommitLog Thu Dec 22 16:19:05 2016 (r310419) @@ -1,3 +1,1866 @@ +ChangeSet@1.3720, 2016-11-21 08:08:21-05:00, stenn@deacon.udel.edu + NTP_4_2_8P9 + TAG: NTP_4_2_8P9 + + ChangeLog@1.1852 +1 -0 + NTP_4_2_8P9 + + ntpd/invoke-ntp.conf.texi@1.203 +1 -1 + NTP_4_2_8P9 + + ntpd/invoke-ntp.keys.texi@1.192 +1 -1 + NTP_4_2_8P9 + + ntpd/invoke-ntpd.texi@1.508 +2 -2 + NTP_4_2_8P9 + + ntpd/ntp.conf.5man@1.237 +3 -3 + NTP_4_2_8P9 + + ntpd/ntp.conf.5mdoc@1.237 +2 -2 + NTP_4_2_8P9 + + ntpd/ntp.conf.html@1.187 +157 -154 + NTP_4_2_8P9 + + ntpd/ntp.conf.man.in@1.237 +3 -3 + NTP_4_2_8P9 + + ntpd/ntp.conf.mdoc.in@1.237 +2 -2 + NTP_4_2_8P9 + + ntpd/ntp.keys.5man@1.226 +2 -2 + NTP_4_2_8P9 + + ntpd/ntp.keys.5mdoc@1.226 +3 -3 + NTP_4_2_8P9 + + ntpd/ntp.keys.html@1.188 +21 -33 + NTP_4_2_8P9 + + ntpd/ntp.keys.man.in@1.226 +2 -2 + NTP_4_2_8P9 + + ntpd/ntp.keys.mdoc.in@1.226 +3 -3 + NTP_4_2_8P9 + + ntpd/ntpd-opts.c@1.530 +245 -245 + NTP_4_2_8P9 + + ntpd/ntpd-opts.h@1.529 +3 -3 + NTP_4_2_8P9 + + ntpd/ntpd.1ntpdman@1.337 +3 -3 + NTP_4_2_8P9 + + ntpd/ntpd.1ntpdmdoc@1.337 +2 -2 + NTP_4_2_8P9 + + ntpd/ntpd.html@1.181 +142 -186 + NTP_4_2_8P9 + + ntpd/ntpd.man.in@1.337 +3 -3 + NTP_4_2_8P9 + + ntpd/ntpd.mdoc.in@1.337 +2 -2 + NTP_4_2_8P9 + + ntpdc/invoke-ntpdc.texi@1.505 +2 -2 + NTP_4_2_8P9 + + ntpdc/ntpdc-opts.c@1.523 +106 -106 + NTP_4_2_8P9 + + ntpdc/ntpdc-opts.h@1.522 +3 -3 + NTP_4_2_8P9 + + ntpdc/ntpdc.1ntpdcman@1.336 +3 -3 + NTP_4_2_8P9 + + ntpdc/ntpdc.1ntpdcmdoc@1.336 +2 -2 + NTP_4_2_8P9 + + ntpdc/ntpdc.html@1.349 +75 -95 + NTP_4_2_8P9 + + ntpdc/ntpdc.man.in@1.336 +3 -3 + NTP_4_2_8P9 + + ntpdc/ntpdc.mdoc.in@1.336 +2 -2 + NTP_4_2_8P9 + + ntpq/invoke-ntpq.texi@1.513 +2 -2 + NTP_4_2_8P9 + + ntpq/ntpq-opts.c@1.530 +113 -113 + NTP_4_2_8P9 + + ntpq/ntpq-opts.h@1.528 +3 -3 + NTP_4_2_8P9 + + ntpq/ntpq.1ntpqman@1.341 +3 -3 + NTP_4_2_8P9 + + ntpq/ntpq.1ntpqmdoc@1.341 +2 -2 + NTP_4_2_8P9 + + ntpq/ntpq.html@1.178 +136 -160 + NTP_4_2_8P9 + + ntpq/ntpq.man.in@1.341 +3 -3 + NTP_4_2_8P9 + + ntpq/ntpq.mdoc.in@1.341 +2 -2 + NTP_4_2_8P9 + + ntpsnmpd/invoke-ntpsnmpd.texi@1.507 +2 -2 + NTP_4_2_8P9 + + ntpsnmpd/ntpsnmpd-opts.c@1.525 +67 -67 + NTP_4_2_8P9 + + ntpsnmpd/ntpsnmpd-opts.h@1.524 +3 -3 + NTP_4_2_8P9 + + ntpsnmpd/ntpsnmpd.1ntpsnmpdman@1.336 +3 -3 + NTP_4_2_8P9 + + ntpsnmpd/ntpsnmpd.1ntpsnmpdmdoc@1.336 +2 -2 + NTP_4_2_8P9 + + ntpsnmpd/ntpsnmpd.html@1.176 +10 -14 + NTP_4_2_8P9 + + ntpsnmpd/ntpsnmpd.man.in@1.336 +3 -3 + NTP_4_2_8P9 + + ntpsnmpd/ntpsnmpd.mdoc.in@1.336 +2 -2 + NTP_4_2_8P9 + + packageinfo.sh@1.532 +2 -2 + NTP_4_2_8P9 + + scripts/calc_tickadj/calc_tickadj.1calc_tickadjman@1.97 +3 -3 + NTP_4_2_8P9 + + scripts/calc_tickadj/calc_tickadj.1calc_tickadjmdoc@1.98 +2 -2 + NTP_4_2_8P9 + + scripts/calc_tickadj/calc_tickadj.html@1.99 +30 -42 + NTP_4_2_8P9 + + scripts/calc_tickadj/calc_tickadj.man.in@1.96 +3 -3 + NTP_4_2_8P9 + + scripts/calc_tickadj/calc_tickadj.mdoc.in@1.98 +2 -2 + NTP_4_2_8P9 + + scripts/calc_tickadj/invoke-calc_tickadj.texi@1.101 +1 -1 + NTP_4_2_8P9 + + scripts/invoke-plot_summary.texi@1.119 +2 -2 + NTP_4_2_8P9 + + scripts/invoke-summary.texi@1.118 +2 -2 + NTP_4_2_8P9 + + scripts/ntp-wait/invoke-ntp-wait.texi@1.328 +2 -2 + NTP_4_2_8P9 + + scripts/ntp-wait/ntp-wait-opts@1.64 +2 -2 + NTP_4_2_8P9 + + scripts/ntp-wait/ntp-wait.1ntp-waitman@1.325 +3 -3 + NTP_4_2_8P9 + + scripts/ntp-wait/ntp-wait.1ntp-waitmdoc@1.326 +2 -2 + NTP_4_2_8P9 + + scripts/ntp-wait/ntp-wait.html@1.345 +41 -59 + NTP_4_2_8P9 + + scripts/ntp-wait/ntp-wait.man.in@1.325 +3 -3 + NTP_4_2_8P9 + + scripts/ntp-wait/ntp-wait.mdoc.in@1.326 +2 -2 + NTP_4_2_8P9 + + scripts/ntpsweep/invoke-ntpsweep.texi@1.116 +2 -2 + NTP_4_2_8P9 + + scripts/ntpsweep/ntpsweep-opts@1.66 +2 -2 + NTP_4_2_8P9 + + scripts/ntpsweep/ntpsweep.1ntpsweepman@1.104 +3 -3 + NTP_4_2_8P9 + + scripts/ntpsweep/ntpsweep.1ntpsweepmdoc@1.104 +2 -2 + NTP_4_2_8P9 + + scripts/ntpsweep/ntpsweep.html@1.117 +46 -57 + NTP_4_2_8P9 + + scripts/ntpsweep/ntpsweep.man.in@1.104 +3 -3 + NTP_4_2_8P9 + + scripts/ntpsweep/ntpsweep.mdoc.in@1.105 +2 -2 + NTP_4_2_8P9 + + scripts/ntptrace/invoke-ntptrace.texi@1.117 +2 -2 + NTP_4_2_8P9 + + scripts/ntptrace/ntptrace-opts@1.66 +2 -2 + NTP_4_2_8P9 + + scripts/ntptrace/ntptrace.1ntptraceman@1.104 +3 -3 + NTP_4_2_8P9 + + scripts/ntptrace/ntptrace.1ntptracemdoc@1.105 +2 -2 + NTP_4_2_8P9 + + scripts/ntptrace/ntptrace.html@1.118 +38 -47 + NTP_4_2_8P9 + + scripts/ntptrace/ntptrace.man.in@1.104 +3 -3 + NTP_4_2_8P9 + + scripts/ntptrace/ntptrace.mdoc.in@1.106 +2 -2 + NTP_4_2_8P9 + + scripts/plot_summary-opts@1.67 +2 -2 + NTP_4_2_8P9 + + scripts/plot_summary.1plot_summaryman@1.117 +3 -3 + NTP_4_2_8P9 + + scripts/plot_summary.1plot_summarymdoc@1.117 +2 -2 + NTP_4_2_8P9 + + scripts/plot_summary.html@1.120 +40 -58 + NTP_4_2_8P9 + + scripts/plot_summary.man.in@1.117 +3 -3 + NTP_4_2_8P9 + + scripts/plot_summary.mdoc.in@1.117 +2 -2 + NTP_4_2_8P9 + + scripts/summary-opts@1.66 +2 -2 + NTP_4_2_8P9 + + scripts/summary.1summaryman@1.116 +3 -3 + NTP_4_2_8P9 + + scripts/summary.1summarymdoc@1.116 +2 -2 + NTP_4_2_8P9 + + scripts/summary.html@1.119 +37 -49 + NTP_4_2_8P9 + + scripts/summary.man.in@1.116 +3 -3 + NTP_4_2_8P9 + + scripts/summary.mdoc.in@1.116 +2 -2 + NTP_4_2_8P9 + + scripts/update-leap/invoke-update-leap.texi@1.17 +1 -1 + NTP_4_2_8P9 + + scripts/update-leap/update-leap-opts@1.17 +2 -2 + NTP_4_2_8P9 + + scripts/update-leap/update-leap.1update-leapman@1.17 +3 -3 + NTP_4_2_8P9 + + scripts/update-leap/update-leap.1update-leapmdoc@1.17 +2 -2 + NTP_4_2_8P9 + + scripts/update-leap/update-leap.html@1.17 +48 -72 + NTP_4_2_8P9 + + scripts/update-leap/update-leap.man.in@1.17 +3 -3 + NTP_4_2_8P9 + + scripts/update-leap/update-leap.mdoc.in@1.17 +2 -2 + NTP_4_2_8P9 + + sntp/invoke-sntp.texi@1.505 +2 -2 + NTP_4_2_8P9 + + sntp/sntp-opts.c@1.524 +158 -158 + NTP_4_2_8P9 + + sntp/sntp-opts.h@1.522 +3 -3 + NTP_4_2_8P9 + + sntp/sntp.1sntpman@1.340 +3 -3 + NTP_4_2_8P9 + + sntp/sntp.1sntpmdoc@1.340 +2 -2 + NTP_4_2_8P9 + + sntp/sntp.html@1.520 +111 -135 + NTP_4_2_8P9 + + sntp/sntp.man.in@1.340 +3 -3 + NTP_4_2_8P9 + + sntp/sntp.mdoc.in@1.340 +2 -2 + NTP_4_2_8P9 + + util/invoke-ntp-keygen.texi@1.508 +2 -2 + NTP_4_2_8P9 + + util/ntp-keygen-opts.c@1.526 +172 -172 + NTP_4_2_8P9 + + util/ntp-keygen-opts.h@1.524 +3 -3 + NTP_4_2_8P9 + + util/ntp-keygen.1ntp-keygenman@1.336 +3 -3 + NTP_4_2_8P9 + + util/ntp-keygen.1ntp-keygenmdoc@1.336 +2 -2 + NTP_4_2_8P9 + + util/ntp-keygen.html@1.182 +157 -216 + NTP_4_2_8P9 + + util/ntp-keygen.man.in@1.336 +3 -3 + NTP_4_2_8P9 + + util/ntp-keygen.mdoc.in@1.336 +2 -2 + NTP_4_2_8P9 + +ChangeSet@1.3719, 2016-11-21 07:07:04-05:00, stenn@deacon.udel.edu + ntp-4.2.8p9 + + packageinfo.sh@1.531 +1 -1 + ntp-4.2.8p9 + +ChangeSet@1.3718, 2016-11-21 03:47:58+00:00, stenn@psp-deb1.ntp.org + NEWS updates, final p9 testing + + NEWS@1.203 +25 -17 + NEWS updates, final p9 testing + + packageinfo.sh@1.530 +2 -2 + NEWS updates, final p9 testing + +ChangeSet@1.3717, 2016-11-18 10:33:02+00:00, stenn@psp-deb1.ntp.org + NEWS update for 3142 + + NEWS@1.202 +2 -1 + NEWS update for 3142 + +ChangeSet@1.3686.23.1, 2016-11-18 08:55:13+01:00, perlinger@ntp.org + [Bug 3142] bug in netmask prefix length detection + + ChangeLog@1.1834.23.1 +3 -0 + [Bug 3142] bug in netmask prefix length detection + + lib/isc/netaddr.c@1.15 +0 -1 + [Bug 3142] bug in netmask prefix length detection + +ChangeSet@1.3715, 2016-11-16 21:25:49-08:00, harlan@fb-x86-a.pfcs.com + NEWS file update + + NEWS@1.201 +7 -22 + NEWS file update + +ChangeSet@1.3707.1.1, 2016-11-13 21:59:31-08:00, harlan@fb-x86-a.pfcs.com + cleanup + + NEWS@1.197.1.1 +201 -77 + cleanup + +ChangeSet@1.3713, 2016-11-13 21:56:18-08:00, harlan@hms-mbp11.pfcs.com + cleanip + + ChangeLog@1.1850 +2 -0 + cleanip + +ChangeSet@1.3712, 2016-11-13 02:43:02+00:00, stenn@psp-deb1.ntp.org + NEWS updates + + NEWS@1.199 +17 -0 + NEWS updates + +ChangeSet@1.3710, 2016-11-13 02:30:31+00:00, stenn@psp-deb1.ntp.org + NEWS cleanup + + NEWS@1.198 +2 -0 + NEWS cleanup + +ChangeSet@1.3707, 2016-11-12 17:36:54-08:00, harlan@fb-x86-a.pfcs.com + NEWS cleanup + + NEWS@1.197 +41 -6 + NEWS cleanup + +ChangeSet@1.3706, 2016-11-12 16:55:59-08:00, harlan@fb-x86-a.pfcs.com + [Bug 3067] Root distance calculation needs improvement. HStenn + + ChangeLog@1.1846.1.2 +1 -0 + [Bug 3067] Root distance calculation needs improvement. HStenn + + NEWS@1.196 +1 -0 + [Bug 3067] Root distance calculation needs improvement. HStenn + + ntpd/ntp_proto.c@1.396 +16 -11 + [Bug 3067] Root distance calculation needs improvement. HStenn + +ChangeSet@1.3705, 2016-11-12 15:57:34-08:00, harlan@fb-x86-a.pfcs.com + [Bug 3138] gpsdjson refclock should honor fudgetime1. stenn@ntp.org + + ChangeLog@1.1846.1.1 +1 -0 + [Bug 3138] gpsdjson refclock should honor fudgetime1. stenn@ntp.org + + NEWS@1.195 +1 -0 + [Bug 3138] gpsdjson refclock should honor fudgetime1. stenn@ntp.org + + ntpd/refclock_gpsdjson.c@1.25 +1 -1 + [Bug 3138] gpsdjson refclock should honor fudgetime1. stenn@ntp.org + +ChangeSet@1.3686.22.1, 2016-11-12 05:54:39+01:00, perlinger@ntp.org + [Bug 3129] Unknown hosts can put resolver thread into a hard loop + + ChangeLog@1.1834.22.1 +4 -0 + [Bug 3129] Unknown hosts can put resolver thread into a hard loop + + include/ntp_intres.h@1.2 +6 -0 + [Bug 3129] Unknown hosts can put resolver thread into a hard loop + - add flags and prototype for 'getaddrinfo_sometime_ex()' + + libntp/ntp_intres.c@1.101 +48 -14 + [Bug 3129] Unknown hosts can put resolver thread into a hard loop + - implement 'getaddrinfo_sometime_ex()', support ignoring all errors + + ntpd/ntp_config.c@1.338.1.1 +11 -10 + [Bug 3129] Unknown hosts can put resolver thread into a hard loop + - move decison about igoring DNS errors to resolver code + +ChangeSet@1.3703.1.2, 2016-11-09 12:32:07+00:00, stenn@psp-deb1.ntp.org + [Bug 3114] bcpollbstep, tweaks and cleanup + + ChangeLog@1.1848 +1 -1 + [Bug 3114] bcpollbstep, tweaks and cleanup + + html/miscopt.html@1.87 +4 -2 + [Bug 3114] bcpollbstep, tweaks and cleanup + + include/ntp.h@1.223 +1 -0 + [Bug 3114] bcpollbstep, tweaks and cleanup + + include/ntpd.h@1.194 +1 -0 + [Bug 3114] bcpollbstep, tweaks and cleanup + + ntpd/complete.conf.in@1.32 +1 -1 + [Bug 3114] bcpollbstep, tweaks and cleanup + + ntpd/invoke-ntp.conf.texi@1.202 +16 -1 + [Bug 3114] bcpollbstep, tweaks and cleanup + + ntpd/keyword-gen-utd@1.29 +1 -1 + [Bug 3114] bcpollbstep, tweaks and cleanup + + ntpd/keyword-gen.c@1.35 +1 -0 + [Bug 3114] bcpollbstep, tweaks and cleanup + + ntpd/ntp.conf.5man@1.236 +29 -8 + [Bug 3114] bcpollbstep, tweaks and cleanup + + ntpd/ntp.conf.5mdoc@1.236 +21 -2 + [Bug 3114] bcpollbstep, tweaks and cleanup + + ntpd/ntp.conf.def@1.25 +19 -0 + [Bug 3114] bcpollbstep, tweaks and cleanup + + ntpd/ntp.conf.man.in@1.236 +29 -8 + [Bug 3114] bcpollbstep, tweaks and cleanup + + ntpd/ntp.conf.mdoc.in@1.236 +21 -2 + [Bug 3114] bcpollbstep, tweaks and cleanup + + ntpd/ntp_config.c@1.339 +15 -0 + [Bug 3114] bcpollbstep, tweaks and cleanup + + ntpd/ntp_keyword.h@1.31 +1068 -1058 + [Bug 3114] bcpollbstep, tweaks and cleanup + + ntpd/ntp_parser.c@1.103 +1196 -1193 + [Bug 3114] bcpollbstep, tweaks and cleanup + + ntpd/ntp_parser.h@1.67 +373 -371 + [Bug 3114] bcpollbstep, tweaks and cleanup + + ntpd/ntp_parser.y@1.93 +3 -1 + [Bug 3114] bcpollbstep, tweaks and cleanup + + ntpd/ntp_proto.c@1.394.1.2 +43 -26 + [Bug 3114] bcpollbstep, tweaks and cleanup + +ChangeSet@1.3703, 2016-11-09 06:06:04+00:00, stenn@psp-deb1.ntp.org + typo + + ChangeLog@1.1846 +1 -1 + typo + +ChangeSet@1.3686.21.1, 2016-11-08 20:01:41+01:00, perlinger@ntp.org + [Bug 3089] Serial Parser does not work anymore for hopfser like device + + ChangeLog@1.1834.21.1 +4 -0 + [Bug 3089] Serial Parser does not work anymore for hopfser like device + + libparse/clk_hopf6021.c@1.13 +43 -25 + [Bug 3089] Serial Parser does not work anymore for hopfser like device + - simplified / refactored hex-decoding in driver. + +ChangeSet@1.3698.2.1, 2016-11-03 17:02:24-07:00, harlan@max.pfcs.com + Added leap smear/root dispersion comment + + ntpd/ntp_proto.c@1.393.1.1 +4 -0 + Added leap smear/root dispersion comment + +ChangeSet@1.3699.1.2, 2016-10-31 10:56:33+00:00, stenn@psp-deb1.ntp.org + Add bug 3125 to the NEWS file + + NEWS@1.194 +2 -0 + Add bug 3125 to the NEWS file + +ChangeSet@1.3701, 2016-10-24 07:37:25+02:00, perlinger@ntp.org + [winio2 - unlocked] + - the great lock removal + - the great renaming + + ChangeLog@1.1844 +1 -0 + [winio2 - unlocked] notes on changes + + ntpd/ntp_refclock.c@1.123 +1 -1 + [winio2 - unlocked] + - whitespace at EOL + + ports/winnt/include/ntp_iocpltypes.h@1.3 +21 -24 + [winio2 - unlocked] + - eliminate critical section, simplify API + - the great renaming + + ports/winnt/ntpd/ntp_iocompletionport.c@1.77 +331 -209 + [winio2 - unlocked] + - the great lock removal + - handle context objects are only manipulated by IOCPL thread + - closing handles is done by main thread after informing IOCPL thread (RPC-style) + - the great renaming + - restructured UNIX line mode emulation + + ports/winnt/ntpd/ntp_iocpltypes.c@1.3 +31 -95 + [winio2 - unlocked] + - eliminate critical section, simplify API + - the great renaming + + +ChangeSet@1.3698.1.7, 2016-10-23 05:18:04+00:00, stenn@psp-deb1.ntp.org + ntp-4.2.8p9-PRE + + ntpd/invoke-ntp.conf.texi@1.201 +1 -1 + ntp-4.2.8p9-PRE + + ntpd/invoke-ntp.keys.texi@1.191 +1 -1 + ntp-4.2.8p9-PRE + + ntpd/invoke-ntpd.texi@1.507 +2 -2 + ntp-4.2.8p9-PRE + + ntpd/ntp.conf.5man@1.235 +3 -3 + ntp-4.2.8p9-PRE + + ntpd/ntp.conf.5mdoc@1.235 +2 -2 + ntp-4.2.8p9-PRE + + ntpd/ntp.conf.html@1.186 +104 -91 + ntp-4.2.8p9-PRE + + ntpd/ntp.conf.man.in@1.235 +3 -3 + ntp-4.2.8p9-PRE + + ntpd/ntp.conf.mdoc.in@1.235 +2 -2 + ntp-4.2.8p9-PRE + + ntpd/ntp.keys.5man@1.225 +2 -2 + ntp-4.2.8p9-PRE + + ntpd/ntp.keys.5mdoc@1.225 +3 -3 + ntp-4.2.8p9-PRE + + ntpd/ntp.keys.html@1.187 +29 -17 + ntp-4.2.8p9-PRE + + ntpd/ntp.keys.man.in@1.225 +2 -2 + ntp-4.2.8p9-PRE + + ntpd/ntp.keys.mdoc.in@1.225 +3 -3 + ntp-4.2.8p9-PRE + + ntpd/ntpd-opts.c@1.529 +245 -245 + ntp-4.2.8p9-PRE + + ntpd/ntpd-opts.h@1.528 +3 -3 + ntp-4.2.8p9-PRE + + ntpd/ntpd.1ntpdman@1.336 +3 -3 + ntp-4.2.8p9-PRE + + ntpd/ntpd.1ntpdmdoc@1.336 +2 -2 + ntp-4.2.8p9-PRE + + ntpd/ntpd.html@1.180 +146 -102 + ntp-4.2.8p9-PRE + + ntpd/ntpd.man.in@1.336 +3 -3 + ntp-4.2.8p9-PRE + + ntpd/ntpd.mdoc.in@1.336 +2 -2 + ntp-4.2.8p9-PRE + + ntpdc/invoke-ntpdc.texi@1.504 +2 -2 + ntp-4.2.8p9-PRE + + ntpdc/ntpdc-opts.c@1.522 +106 -106 + ntp-4.2.8p9-PRE + + ntpdc/ntpdc-opts.h@1.521 +3 -3 + ntp-4.2.8p9-PRE + + ntpdc/ntpdc.1ntpdcman@1.335 +3 -3 + ntp-4.2.8p9-PRE + + ntpdc/ntpdc.1ntpdcmdoc@1.335 +2 -2 + ntp-4.2.8p9-PRE + + ntpdc/ntpdc.html@1.348 +77 -57 + ntp-4.2.8p9-PRE + + ntpdc/ntpdc.man.in@1.335 +3 -3 + ntp-4.2.8p9-PRE + + ntpdc/ntpdc.mdoc.in@1.335 +2 -2 + ntp-4.2.8p9-PRE + + ntpq/invoke-ntpq.texi@1.512 +2 -2 + ntp-4.2.8p9-PRE + + ntpq/ntpq-opts.c@1.529 +113 -113 + ntp-4.2.8p9-PRE + + ntpq/ntpq-opts.h@1.527 +3 -3 + ntp-4.2.8p9-PRE + + ntpq/ntpq.1ntpqman@1.340 +3 -3 + ntp-4.2.8p9-PRE + + ntpq/ntpq.1ntpqmdoc@1.340 +2 -2 + ntp-4.2.8p9-PRE + + ntpq/ntpq.html@1.177 +129 -105 + ntp-4.2.8p9-PRE + + ntpq/ntpq.man.in@1.340 +3 -3 + ntp-4.2.8p9-PRE + + ntpq/ntpq.mdoc.in@1.340 +2 -2 + ntp-4.2.8p9-PRE + + ntpsnmpd/invoke-ntpsnmpd.texi@1.506 +2 -2 + ntp-4.2.8p9-PRE + + ntpsnmpd/ntpsnmpd-opts.c@1.524 +67 -67 + ntp-4.2.8p9-PRE + + ntpsnmpd/ntpsnmpd-opts.h@1.523 +3 -3 + ntp-4.2.8p9-PRE + + ntpsnmpd/ntpsnmpd.1ntpsnmpdman@1.335 +3 -3 + ntp-4.2.8p9-PRE + + ntpsnmpd/ntpsnmpd.1ntpsnmpdmdoc@1.335 +2 -2 + ntp-4.2.8p9-PRE + + ntpsnmpd/ntpsnmpd.html@1.175 +14 -10 + ntp-4.2.8p9-PRE + + ntpsnmpd/ntpsnmpd.man.in@1.335 +3 -3 + ntp-4.2.8p9-PRE + + ntpsnmpd/ntpsnmpd.mdoc.in@1.335 +2 -2 + ntp-4.2.8p9-PRE + + packageinfo.sh@1.529 +2 -2 + ntp-4.2.8p9-PRE + + scripts/calc_tickadj/calc_tickadj.1calc_tickadjman@1.96 +3 -3 + ntp-4.2.8p9-PRE + + scripts/calc_tickadj/calc_tickadj.1calc_tickadjmdoc@1.97 +2 -2 + ntp-4.2.8p9-PRE + + scripts/calc_tickadj/calc_tickadj.html@1.98 +34 -22 + ntp-4.2.8p9-PRE + + scripts/calc_tickadj/calc_tickadj.man.in@1.95 +3 -3 + ntp-4.2.8p9-PRE + + scripts/calc_tickadj/calc_tickadj.mdoc.in@1.97 +2 -2 + ntp-4.2.8p9-PRE + + scripts/calc_tickadj/invoke-calc_tickadj.texi@1.100 +1 -1 + ntp-4.2.8p9-PRE + + scripts/invoke-plot_summary.texi@1.118 +2 -2 + ntp-4.2.8p9-PRE + + scripts/invoke-summary.texi@1.117 +2 -2 + ntp-4.2.8p9-PRE + + scripts/ntp-wait/invoke-ntp-wait.texi@1.327 +2 -2 + ntp-4.2.8p9-PRE + + scripts/ntp-wait/ntp-wait-opts@1.63 +2 -2 + ntp-4.2.8p9-PRE + + scripts/ntp-wait/ntp-wait.1ntp-waitman@1.324 +3 -3 + ntp-4.2.8p9-PRE + + scripts/ntp-wait/ntp-wait.1ntp-waitmdoc@1.325 +2 -2 + ntp-4.2.8p9-PRE + + scripts/ntp-wait/ntp-wait.html@1.344 +49 -31 + ntp-4.2.8p9-PRE + + scripts/ntp-wait/ntp-wait.man.in@1.324 +3 -3 + ntp-4.2.8p9-PRE + + scripts/ntp-wait/ntp-wait.mdoc.in@1.325 +2 -2 + ntp-4.2.8p9-PRE + + scripts/ntpsweep/invoke-ntpsweep.texi@1.115 +2 -2 + ntp-4.2.8p9-PRE + + scripts/ntpsweep/ntpsweep-opts@1.65 +2 -2 + ntp-4.2.8p9-PRE + + scripts/ntpsweep/ntpsweep.1ntpsweepman@1.103 +3 -3 + ntp-4.2.8p9-PRE + + scripts/ntpsweep/ntpsweep.1ntpsweepmdoc@1.103 +2 -2 + ntp-4.2.8p9-PRE + + scripts/ntpsweep/ntpsweep.html@1.116 +44 -33 + ntp-4.2.8p9-PRE + + scripts/ntpsweep/ntpsweep.man.in@1.103 +3 -3 + ntp-4.2.8p9-PRE + + scripts/ntpsweep/ntpsweep.mdoc.in@1.104 +2 -2 + ntp-4.2.8p9-PRE + + scripts/ntptrace/invoke-ntptrace.texi@1.116 +2 -2 + ntp-4.2.8p9-PRE + + scripts/ntptrace/ntptrace-opts@1.65 +2 -2 + ntp-4.2.8p9-PRE + + scripts/ntptrace/ntptrace.1ntptraceman@1.103 +3 -3 + ntp-4.2.8p9-PRE + + scripts/ntptrace/ntptrace.1ntptracemdoc@1.104 +2 -2 + ntp-4.2.8p9-PRE + + scripts/ntptrace/ntptrace.html@1.117 +36 -27 + ntp-4.2.8p9-PRE + + scripts/ntptrace/ntptrace.man.in@1.103 +3 -3 + ntp-4.2.8p9-PRE + + scripts/ntptrace/ntptrace.mdoc.in@1.105 +2 -2 + ntp-4.2.8p9-PRE + + scripts/plot_summary-opts@1.66 +2 -2 + ntp-4.2.8p9-PRE + + scripts/plot_summary.1plot_summaryman@1.116 +3 -3 + ntp-4.2.8p9-PRE + + scripts/plot_summary.1plot_summarymdoc@1.116 +2 -2 + ntp-4.2.8p9-PRE + + scripts/plot_summary.html@1.119 +47 -29 + ntp-4.2.8p9-PRE + + scripts/plot_summary.man.in@1.116 +3 -3 + ntp-4.2.8p9-PRE + + scripts/plot_summary.mdoc.in@1.116 +2 -2 + ntp-4.2.8p9-PRE + + scripts/summary-opts@1.65 +2 -2 + ntp-4.2.8p9-PRE + + scripts/summary.1summaryman@1.115 +3 -3 + ntp-4.2.8p9-PRE + + scripts/summary.1summarymdoc@1.115 +2 -2 + ntp-4.2.8p9-PRE + + scripts/summary.html@1.118 +39 -27 + ntp-4.2.8p9-PRE + + scripts/summary.man.in@1.115 +3 -3 + ntp-4.2.8p9-PRE + + scripts/summary.mdoc.in@1.115 +2 -2 + ntp-4.2.8p9-PRE + + scripts/update-leap/invoke-update-leap.texi@1.16 +1 -1 + ntp-4.2.8p9-PRE + + scripts/update-leap/update-leap-opts@1.16 +2 -2 + ntp-4.2.8p9-PRE + + scripts/update-leap/update-leap.1update-leapman@1.16 +3 -3 + ntp-4.2.8p9-PRE + + scripts/update-leap/update-leap.1update-leapmdoc@1.16 +2 -2 + ntp-4.2.8p9-PRE + + scripts/update-leap/update-leap.html@1.16 +59 -35 + ntp-4.2.8p9-PRE + + scripts/update-leap/update-leap.man.in@1.16 +3 -3 + ntp-4.2.8p9-PRE + + scripts/update-leap/update-leap.mdoc.in@1.16 +2 -2 + ntp-4.2.8p9-PRE + + sntp/invoke-sntp.texi@1.504 +2 -2 + ntp-4.2.8p9-PRE + + sntp/sntp-opts.c@1.523 +158 -158 + ntp-4.2.8p9-PRE + + sntp/sntp-opts.h@1.521 +3 -3 + ntp-4.2.8p9-PRE + + sntp/sntp.1sntpman@1.339 +3 -3 + ntp-4.2.8p9-PRE + + sntp/sntp.1sntpmdoc@1.339 +2 -2 + ntp-4.2.8p9-PRE + + sntp/sntp.html@1.519 +109 -85 + ntp-4.2.8p9-PRE + + sntp/sntp.man.in@1.339 +3 -3 + ntp-4.2.8p9-PRE + + sntp/sntp.mdoc.in@1.339 +2 -2 + ntp-4.2.8p9-PRE + + util/invoke-ntp-keygen.texi@1.507 +2 -2 + ntp-4.2.8p9-PRE + + util/ntp-keygen-opts.c@1.525 +172 -172 + ntp-4.2.8p9-PRE + + util/ntp-keygen-opts.h@1.523 +3 -3 + ntp-4.2.8p9-PRE + + util/ntp-keygen.1ntp-keygenman@1.335 +3 -3 + ntp-4.2.8p9-PRE + + util/ntp-keygen.1ntp-keygenmdoc@1.335 +2 -2 + ntp-4.2.8p9-PRE + + util/ntp-keygen.html@1.181 +183 -124 + ntp-4.2.8p9-PRE + + util/ntp-keygen.man.in@1.335 +3 -3 + ntp-4.2.8p9-PRE + + util/ntp-keygen.mdoc.in@1.335 +2 -2 + ntp-4.2.8p9-PRE + +ChangeSet@1.3688.4.1, 2016-10-20 19:28:06+00:00, stenn@psp-deb1.ntp.org + cleanup + + ChangeLog@1.1836.4.1 +1 -0 + cleanup + +ChangeSet@1.3686.20.1, 2016-10-20 20:13:40+02:00, perlinger@ntp.org + [Sec 3114] Broadcast Mode Replay Prevention DoS *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@freebsd.org Thu Dec 22 17:21:09 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C1BBFC8C4E5; Thu, 22 Dec 2016 17:21:09 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from mail.baldwin.cx (bigwig.baldwin.cx [96.47.65.170]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 9965D1D0F; Thu, 22 Dec 2016 17:21:08 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from ralph.baldwin.cx (c-73-231-226-104.hsd1.ca.comcast.net [73.231.226.104]) by mail.baldwin.cx (Postfix) with ESMTPSA id BE39010A745; Thu, 22 Dec 2016 12:21:00 -0500 (EST) From: John Baldwin To: Roger Pau =?ISO-8859-1?Q?Monn=E9?= Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r310418 - in head/sys: dev/xen/evtchn x86/xen xen Date: Thu, 22 Dec 2016 09:20:52 -0800 Message-ID: <1571704.dT3ioqCDCL@ralph.baldwin.cx> User-Agent: KMail/4.14.10 (FreeBSD/11.0-PRERELEASE; KDE/4.14.10; amd64; ; ) In-Reply-To: <201612221609.uBMG9i3l019183@repo.freebsd.org> References: <201612221609.uBMG9i3l019183@repo.freebsd.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="iso-8859-1" X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.4.3 (mail.baldwin.cx); Thu, 22 Dec 2016 12:21:00 -0500 (EST) X-Virus-Scanned: clamav-milter 0.99.2 at mail.baldwin.cx X-Virus-Status: Clean X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Dec 2016 17:21:09 -0000 On Thursday, December 22, 2016 04:09:44 PM Roger Pau Monn=E9 wrote: > Author: royger > Date: Thu Dec 22 16:09:44 2016 > New Revision: 310418 > URL: https://svnweb.freebsd.org/changeset/base/310418 >=20 > Log: > xen: fix IPI setup with EARLY_AP_STARTUP > =20 > Current Xen IPI setup functions require that the caller provide a d= evice in > order to obtain the name of the interrupt from it. With early AP st= artup this > device is no longer available at the point where IPIs are bound, an= d a KASSERT > would trigger: > =20 > panic: NULL pcpu device_t > cpuid =3D 0 > KDB: stack backtrace: > db_trace_self_wrapper() at db_trace_self_wrapper+0x2b/frame 0xfffff= fff82233a20 > vpanic() at vpanic+0x186/frame 0xffffffff82233aa0 > kassert_panic() at kassert_panic+0x126/frame 0xffffffff82233b10 > xen_setup_cpus() at xen_setup_cpus+0x5b/frame 0xffffffff82233b50 > mi_startup() at mi_startup+0x118/frame 0xffffffff82233b70 > btext() at btext+0x2c > =20 > Fix this by no longer requiring the presence of a device in order t= o bind IPIs, > and simply use the "cpuX" format where X is the CPU identifier in o= rder to > describe the interrupt. Thanks for fixing this! > Modified: head/sys/xen/xen_intr.h > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D > --- head/sys/xen/xen_intr.h=09Thu Dec 22 15:48:54 2016=09(r310417) > +++ head/sys/xen/xen_intr.h=09Thu Dec 22 16:09:44 2016=09(r310418) > @@ -143,7 +143,6 @@ int xen_intr_bind_virq(device_t dev, u_i > * interupts and, if successful, associate the port with the specifi= ed > * interrupt handler. > * > - * \param dev The device making this bind request. > * \param cpu The cpu receiving the IPI. > * \param filter The interrupt filter servicing this IPI. > * \param irqflags Interrupt handler flags. See sys/bus.h. > @@ -152,7 +151,7 @@ int xen_intr_bind_virq(device_t dev, u_i > * > * \returns 0 on success, otherwise an errno. > */ > -int xen_intr_alloc_and_bind_ipi(device_t dev, u_int cpu, > +int xen_intr_alloc_and_bind_ipi(u_int cpu, > =09driver_filter_t filter, enum intr_type irqflags, > =09xen_intr_handle_t *handlep); > =20 > @@ -259,7 +258,7 @@ int xen_release_msi(int vector); > * > * \returns 0 on success, otherwise an errno. > */ > -int xen_intr_add_handler(device_t dev, driver_filter_t filter, > +int xen_intr_add_handler(const char *name, driver_filter_t filter, > =09driver_intr_t handler, void *arg, enum intr_type flags, > =09xen_intr_handle_t handle); Does the doxygen comment above this function need the name arg added? --=20 John Baldwin From owner-svn-src-all@freebsd.org Thu Dec 22 17:37:41 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5FF3BC8CC7B; Thu, 22 Dec 2016 17:37:41 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 20BE2779; Thu, 22 Dec 2016 17:37:41 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBMHbeQW055344; Thu, 22 Dec 2016 17:37:40 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBMHbeb7055342; Thu, 22 Dec 2016 17:37:40 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201612221737.uBMHbeb7055342@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Thu, 22 Dec 2016 17:37:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310420 - head/libexec/rtld-elf X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Dec 2016 17:37:41 -0000 Author: markj Date: Thu Dec 22 17:37:39 2016 New Revision: 310420 URL: https://svnweb.freebsd.org/changeset/base/310420 Log: rtld: Fix a race between dl_iterate_phdr() and dlclose(). Add a transient reference count to ensure that the phdr argument to the callback remains valid while the bind lock is dropped. Reviewed by: kib MFC after: 2 weeks Sponsored by: Dell EMC Isilon Modified: head/libexec/rtld-elf/rtld.c head/libexec/rtld-elf/rtld.h Modified: head/libexec/rtld-elf/rtld.c ============================================================================== --- head/libexec/rtld-elf/rtld.c Thu Dec 22 16:19:05 2016 (r310419) +++ head/libexec/rtld-elf/rtld.c Thu Dec 22 17:37:39 2016 (r310420) @@ -87,6 +87,8 @@ static char *errmsg_save(void); static void *fill_search_info(const char *, size_t, void *); static char *find_library(const char *, const Obj_Entry *, int *); static const char *gethints(bool); +static void hold_object(Obj_Entry *); +static void unhold_object(Obj_Entry *); static void init_dag(Obj_Entry *); static void init_pagesizes(Elf_Auxinfo **aux_info); static void init_rtld(caddr_t, Elf_Auxinfo **); @@ -112,6 +114,7 @@ static void objlist_put_after(Objlist *, static void objlist_remove(Objlist *, Obj_Entry *); static int parse_libdir(const char *); static void *path_enumerate(const char *, path_enum_proc, void *); +static void release_object(Obj_Entry *); static int relocate_object_dag(Obj_Entry *root, bool bind_now, Obj_Entry *rtldobj, int flags, RtldLockState *lockstate); static int relocate_object(Obj_Entry *obj, bool bind_now, Obj_Entry *rtldobj, @@ -1852,6 +1855,23 @@ globallist_next(const Obj_Entry *obj) } } +/* Prevent the object from being unmapped while the bind lock is dropped. */ +static void +hold_object(Obj_Entry *obj) +{ + + obj->holdcount++; +} + +static void +unhold_object(Obj_Entry *obj) +{ + + assert(obj->holdcount > 0); + if (--obj->holdcount == 0 && obj->unholdfree) + release_object(obj); +} + static void process_z(Obj_Entry *root) { @@ -2417,6 +2437,7 @@ objlist_call_fini(Objlist *list, Obj_Ent * won't be unloaded although its fini function has been * called. */ + hold_object(elm->obj); lock_release(rtld_bind_lock, lockstate); /* @@ -2444,6 +2465,7 @@ objlist_call_fini(Objlist *list, Obj_Ent call_initfini_pointer(elm->obj, elm->obj->fini); } wlock_acquire(rtld_bind_lock, lockstate); + unhold_object(elm->obj); /* No need to free anything if process is going down. */ if (root != NULL) free(elm); @@ -2497,6 +2519,7 @@ objlist_call_init(Objlist *list, RtldLoc * without better locking. */ elm->obj->init_done = true; + hold_object(elm->obj); lock_release(rtld_bind_lock, lockstate); /* @@ -2523,6 +2546,7 @@ objlist_call_init(Objlist *list, RtldLoc } } wlock_acquire(rtld_bind_lock, lockstate); + unhold_object(elm->obj); } errmsg_restore(saved_msg); } @@ -3553,11 +3577,13 @@ dl_iterate_phdr(__dl_iterate_hdr_callbac for (obj = globallist_curr(TAILQ_FIRST(&obj_list)); obj != NULL;) { TAILQ_INSERT_AFTER(&obj_list, obj, &marker, next); rtld_fill_dl_phdr_info(obj, &phdr_info); + hold_object(obj); lock_release(rtld_bind_lock, &bind_lockstate); error = callback(&phdr_info, sizeof phdr_info, param); wlock_acquire(rtld_bind_lock, &bind_lockstate); + unhold_object(obj); obj = globallist_next(&marker); TAILQ_REMOVE(&obj_list, &marker, next); if (error != 0) { @@ -3812,6 +3838,19 @@ _r_debug_postinit(struct link_map *m) __compiler_membar(); } +static void +release_object(Obj_Entry *obj) +{ + + if (obj->holdcount > 0) { + obj->unholdfree = true; + return; + } + munmap(obj->mapbase, obj->mapsize); + linkmap_delete(obj); + obj_free(obj); +} + /* * Get address of the pointer variable in the main program. * Prefer non-weak symbol over the weak one. @@ -4399,12 +4438,16 @@ unload_object(Obj_Entry *root) LD_UTRACE(UTRACE_UNLOAD_OBJECT, obj, obj->mapbase, obj->mapsize, 0, obj->path); dbg("unloading \"%s\"", obj->path); - unload_filtees(root); - munmap(obj->mapbase, obj->mapsize); - linkmap_delete(obj); + /* + * Unlink the object now to prevent new references from + * being acquired while the bind lock is dropped in + * recursive dlclose() invocations. + */ TAILQ_REMOVE(&obj_list, obj, next); obj_count--; - obj_free(obj); + + unload_filtees(root); + release_object(obj); } } Modified: head/libexec/rtld-elf/rtld.h ============================================================================== --- head/libexec/rtld-elf/rtld.h Thu Dec 22 16:19:05 2016 (r310419) +++ head/libexec/rtld-elf/rtld.h Thu Dec 22 17:37:39 2016 (r310420) @@ -142,7 +142,8 @@ typedef struct Struct_Obj_Entry { TAILQ_ENTRY(Struct_Obj_Entry) next; char *path; /* Pathname of underlying file (%) */ char *origin_path; /* Directory path of origin file */ - int refcount; + int refcount; /* DAG references */ + int holdcount; /* Count of transient references */ int dl_refcount; /* Number of times loaded by dlopen */ /* These items are computed by map_object() or by digest_phdr(). */ @@ -265,6 +266,7 @@ typedef struct Struct_Obj_Entry { bool valid_hash_gnu : 1; /* A valid GNU hash tag is available */ bool dlopened : 1; /* dlopen()-ed (vs. load statically) */ bool marker : 1; /* marker on the global obj list */ + bool unholdfree : 1; /* unmap upon last unhold */ struct link_map linkmap; /* For GDB and dlinfo() */ Objlist dldags; /* Object belongs to these dlopened DAGs (%) */ From owner-svn-src-all@freebsd.org Thu Dec 22 17:41:33 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 82A00C8B2DF; Thu, 22 Dec 2016 17:41:33 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 45098D5C; Thu, 22 Dec 2016 17:41:33 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBMHfWrh058580; Thu, 22 Dec 2016 17:41:32 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBMHfWjt058578; Thu, 22 Dec 2016 17:41:32 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201612221741.uBMHfWjt058578@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Thu, 22 Dec 2016 17:41:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310421 - head/libexec/rtld-elf X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Dec 2016 17:41:33 -0000 Author: markj Date: Thu Dec 22 17:41:32 2016 New Revision: 310421 URL: https://svnweb.freebsd.org/changeset/base/310421 Log: rtld: Ensure that dlopen() cannot obtain a reference on a doomed object. rtld drops the bind lock to call fini functions in an object prior to unmapping it. The new "doomed" state flag prevents the acquisition of new references for an object while the lock is dropped. Reviewed by: kib MFC after: 2 weeks Sponsored by: Dell EMC Isilon Modified: head/libexec/rtld-elf/rtld.c head/libexec/rtld-elf/rtld.h Modified: head/libexec/rtld-elf/rtld.c ============================================================================== --- head/libexec/rtld-elf/rtld.c Thu Dec 22 17:37:39 2016 (r310420) +++ head/libexec/rtld-elf/rtld.c Thu Dec 22 17:41:32 2016 (r310421) @@ -2229,7 +2229,7 @@ load_object(const char *name, int fd_u, fd = -1; if (name != NULL) { TAILQ_FOREACH(obj, &obj_list, next) { - if (obj->marker) + if (obj->marker || obj->doomed) continue; if (object_match_name(obj, name)) return (obj); @@ -2276,7 +2276,7 @@ load_object(const char *name, int fd_u, return NULL; } TAILQ_FOREACH(obj, &obj_list, next) { - if (obj->marker) + if (obj->marker || obj->doomed) continue; if (obj->ino == sb.st_ino && obj->dev == sb.st_dev) break; @@ -2418,6 +2418,9 @@ objlist_call_fini(Objlist *list, Obj_Ent assert(root == NULL || root->refcount == 1); + if (root != NULL) + root->doomed = true; + /* * Preserve the current error message since a fini function might * call into the dynamic linker and overwrite it. @@ -2430,16 +2433,11 @@ objlist_call_fini(Objlist *list, Obj_Ent continue; /* Remove object from fini list to prevent recursive invocation. */ STAILQ_REMOVE(list, elm, Struct_Objlist_Entry, link); - /* - * XXX: If a dlopen() call references an object while the - * fini function is in progress, we might end up trying to - * unload the referenced object in dlclose() or the object - * won't be unloaded although its fini function has been - * called. - */ + /* Ensure that new references cannot be acquired. */ + elm->obj->doomed = true; + hold_object(elm->obj); lock_release(rtld_bind_lock, lockstate); - /* * It is legal to have both DT_FINI and DT_FINI_ARRAY defined. * When this happens, DT_FINI_ARRAY is processed first. Modified: head/libexec/rtld-elf/rtld.h ============================================================================== --- head/libexec/rtld-elf/rtld.h Thu Dec 22 17:37:39 2016 (r310420) +++ head/libexec/rtld-elf/rtld.h Thu Dec 22 17:41:32 2016 (r310421) @@ -267,6 +267,7 @@ typedef struct Struct_Obj_Entry { bool dlopened : 1; /* dlopen()-ed (vs. load statically) */ bool marker : 1; /* marker on the global obj list */ bool unholdfree : 1; /* unmap upon last unhold */ + bool doomed : 1; /* Object cannot be referenced */ struct link_map linkmap; /* For GDB and dlinfo() */ Objlist dldags; /* Object belongs to these dlopened DAGs (%) */ From owner-svn-src-all@freebsd.org Thu Dec 22 17:44:28 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id AC958C8B555; Thu, 22 Dec 2016 17:44:28 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 63D4D11A5; Thu, 22 Dec 2016 17:44:28 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBMHiRhl059463; Thu, 22 Dec 2016 17:44:27 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBMHiRFW059462; Thu, 22 Dec 2016 17:44:27 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201612221744.uBMHiRFW059462@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Thu, 22 Dec 2016 17:44:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310422 - head/libexec/rtld-elf X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Dec 2016 17:44:28 -0000 Author: markj Date: Thu Dec 22 17:44:27 2016 New Revision: 310422 URL: https://svnweb.freebsd.org/changeset/base/310422 Log: rtld: Fix a couple of bugs around the unloading of ELF filters. - Pass the correct object to unload_filtees(). - Use a marker to restart iteration after unload_filtees() has returned. It calls dlclose() and may recursively remove entries from the global object list, so TAILQ_FOREACH_SAFE is not sufficient. Reviewed by: kib MFC after: 2 weeks Sponsored by: Dell EMC Isilon Modified: head/libexec/rtld-elf/rtld.c Modified: head/libexec/rtld-elf/rtld.c ============================================================================== --- head/libexec/rtld-elf/rtld.c Thu Dec 22 17:41:32 2016 (r310421) +++ head/libexec/rtld-elf/rtld.c Thu Dec 22 17:44:27 2016 (r310422) @@ -90,6 +90,7 @@ static const char *gethints(bool); static void hold_object(Obj_Entry *); static void unhold_object(Obj_Entry *); static void init_dag(Obj_Entry *); +static void init_marker(Obj_Entry *); static void init_pagesizes(Elf_Auxinfo **aux_info); static void init_rtld(caddr_t, Elf_Auxinfo **); static void initlist_add_neededs(Needed_Entry *, Objlist *); @@ -1829,6 +1830,14 @@ init_dag(Obj_Entry *root) root->dag_inited = true; } +static void +init_marker(Obj_Entry *marker) +{ + + bzero(marker, sizeof(*marker)); + marker->marker = true; +} + Obj_Entry * globallist_curr(const Obj_Entry *obj) { @@ -3566,8 +3575,7 @@ dl_iterate_phdr(__dl_iterate_hdr_callbac RtldLockState bind_lockstate, phdr_lockstate; int error; - bzero(&marker, sizeof(marker)); - marker.marker = true; + init_marker(&marker); error = 0; wlock_acquire(rtld_phdr_lock, &phdr_lockstate); @@ -4419,7 +4427,7 @@ trace_loaded_objects(Obj_Entry *obj) static void unload_object(Obj_Entry *root) { - Obj_Entry *obj, *obj1; + Obj_Entry marker, *obj, *next; assert(root->refcount == 0); @@ -4430,7 +4438,8 @@ unload_object(Obj_Entry *root) unlink_object(root); /* Unmap all objects that are no longer referenced. */ - TAILQ_FOREACH_SAFE(obj, &obj_list, next, obj1) { + for (obj = TAILQ_FIRST(&obj_list); obj != NULL; obj = next) { + next = TAILQ_NEXT(obj, next); if (obj->marker || obj->refcount != 0) continue; LD_UTRACE(UTRACE_UNLOAD_OBJECT, obj, obj->mapbase, @@ -4444,7 +4453,16 @@ unload_object(Obj_Entry *root) TAILQ_REMOVE(&obj_list, obj, next); obj_count--; - unload_filtees(root); + if (obj->filtees_loaded) { + if (next != NULL) { + init_marker(&marker); + TAILQ_INSERT_BEFORE(next, &marker, next); + unload_filtees(obj); + next = TAILQ_NEXT(&marker, next); + TAILQ_REMOVE(&obj_list, &marker, next); + } else + unload_filtees(obj); + } release_object(obj); } } From owner-svn-src-all@freebsd.org Thu Dec 22 17:51:45 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E9E23C8B93D; Thu, 22 Dec 2016 17:51:45 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B9AE41742; Thu, 22 Dec 2016 17:51:45 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBMHpi1V062787; Thu, 22 Dec 2016 17:51:44 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBMHpim4062786; Thu, 22 Dec 2016 17:51:44 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201612221751.uBMHpim4062786@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Thu, 22 Dec 2016 17:51:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310423 - head/sys/kern X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Dec 2016 17:51:46 -0000 Author: markj Date: Thu Dec 22 17:51:44 2016 New Revision: 310423 URL: https://svnweb.freebsd.org/changeset/base/310423 Log: Revert part of r300109. The removal of TAILQ_FOREACH_SAFE introduced a small race: when the last thread on a sleepqueue is awoken, it reclaims the sleepqueue and may begin executing on a different CPU before sleepq_resume_thread() returns. This leaves a window during which it may go back to sleep and incorrectly be awoken again by the caller of sleepq_broadcast(). Reported and tested by: pho MFC after: 3 days Sponsored by: Dell EMC Isilon Modified: head/sys/kern/subr_sleepqueue.c Modified: head/sys/kern/subr_sleepqueue.c ============================================================================== --- head/sys/kern/subr_sleepqueue.c Thu Dec 22 17:44:27 2016 (r310422) +++ head/sys/kern/subr_sleepqueue.c Thu Dec 22 17:51:44 2016 (r310423) @@ -880,7 +880,7 @@ int sleepq_broadcast(void *wchan, int flags, int pri, int queue) { struct sleepqueue *sq; - struct thread *td; + struct thread *td, *tdn; int wakeup_swapper; CTR2(KTR_PROC, "sleepq_broadcast(%p, %d)", wchan, flags); @@ -894,7 +894,7 @@ sleepq_broadcast(void *wchan, int flags, /* Resume all blocked threads on the sleep queue. */ wakeup_swapper = 0; - while ((td = TAILQ_FIRST(&sq->sq_blocked[queue])) != NULL) { + TAILQ_FOREACH_SAFE(td, &sq->sq_blocked[queue], td_slpq, tdn) { thread_lock(td); wakeup_swapper |= sleepq_resume_thread(sq, td, pri); thread_unlock(td); From owner-svn-src-all@freebsd.org Thu Dec 22 18:05:24 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 32FC7C8BF18; Thu, 22 Dec 2016 18:05:24 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 01BB810E; Thu, 22 Dec 2016 18:05:23 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBMI5NxT067879; Thu, 22 Dec 2016 18:05:23 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBMI5NVC067875; Thu, 22 Dec 2016 18:05:23 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201612221805.uBMI5NVC067875@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Thu, 22 Dec 2016 18:05:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310424 - head/share/man/man4 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Dec 2016 18:05:24 -0000 Author: jhb Date: Thu Dec 22 18:05:22 2016 New Revision: 310424 URL: https://svnweb.freebsd.org/changeset/base/310424 Log: Replace passive voice with active voice and other tweaks. - Drop uses of 'will'. - Replace 'to use' with active voice. - Tidy language around interrupt types and clarify that INTx doesn't work on VFs. - Drop leading articles from sysctl/tunable descriptions. - Tweak the wording of several sysctl/tunable descriptions. Submitted by: wblock (1, 2, 4) Sponsored by: Chelsio Communications MFC after: 3 days Differential Revision: https://reviews.freebsd.org/D8812 Modified: head/share/man/man4/cxgbe.4 head/share/man/man4/cxgbev.4 Modified: head/share/man/man4/cxgbe.4 ============================================================================== --- head/share/man/man4/cxgbe.4 Thu Dec 22 17:51:44 2016 (r310423) +++ head/share/man/man4/cxgbe.4 Thu Dec 22 18:05:22 2016 (r310424) @@ -31,7 +31,7 @@ .\" .\" $FreeBSD$ .\" -.Dd December 5, 2016 +.Dd December 22, 2016 .Dt CXGBE 4 .Os .Sh NAME @@ -80,9 +80,9 @@ driver uses different names for devices Loader tunables with the hw.cxgbe prefix apply to all cards. The driver provides sysctl MIBs for both ports and parent devices using the names above. -For example, a T5 adapter will provide port MIBs under dev.cxl and +For example, a T5 adapter provides port MIBs under dev.cxl and adapter-wide MIBs under dev.t5nex. -References to sysctl MIBs in the remainder of this page will use +References to sysctl MIBs in the remainder of this page use dev. for port MIBs and dev. for adapter-wide MIBs. .Pp For more information on configuring this device, see @@ -169,38 +169,38 @@ prompt before booting the kernel or stor .Xr loader.conf 5 . .Bl -tag -width indent .It Va hw.cxgbe.ntxq10g -The number of tx queues to use for a 10Gb or higher-speed port. +Number of tx queues used for a 10Gb or higher-speed port. The default is 16 or the number of CPU cores in the system, whichever is less. .It Va hw.cxgbe.nrxq10g -The number of rx queues to use for a 10Gb or higher-speed port. +Number of rx queues used for a 10Gb or higher-speed port. The default is 8 or the number of CPU cores in the system, whichever is less. .It Va hw.cxgbe.ntxq1g -The number of tx queues to use for a 1Gb port. +Number of tx queues used for a 1Gb port. The default is 4 or the number of CPU cores in the system, whichever is less. .It Va hw.cxgbe.nrxq1g -The number of rx queues to use for a 1Gb port. +Number of rx queues used for a 1Gb port. The default is 2 or the number of CPU cores in the system, whichever is less. .It Va hw.cxgbe.nofldtxq10g -The number of TOE tx queues to use for a 10Gb or higher-speed port. +Number of TOE tx queues used for a 10Gb or higher-speed port. The default is 8 or the number of CPU cores in the system, whichever is less. .It Va hw.cxgbe.nofldrxq10g -The number of TOE rx queues to use for a 10Gb or higher-speed port. +Number of TOE rx queues used for a 10Gb or higher-speed port. The default is 2 or the number of CPU cores in the system, whichever is less. .It Va hw.cxgbe.nofldtxq1g -The number of TOE tx queues to use for a 1Gb port. +Number of TOE tx queues used for a 1Gb port. The default is 2 or the number of CPU cores in the system, whichever is less. .It Va hw.cxgbe.nofldrxq1g -The number of TOE rx queues to use for a 1Gb port. +Number of TOE rx queues used for a 1Gb port. The default is 1. .It Va hw.cxgbe.num_vis -The number of virtual interfaces (VIs) created for each port. +Number of virtual interfaces (VIs) created for each port. Each virtual interface creates a separate network interface. The first virtual interface on each port is required and represents the primary network interface on the port. @@ -211,7 +211,7 @@ for rx and tx as well an additional pair The default is 1. .It Va hw.cxgbe.holdoff_timer_idx_10G .It Va hw.cxgbe.holdoff_timer_idx_1G -The timer index value to use to delay interrupts. +Timer index value used to delay interrupts. The holdoff timer list has the values 1, 5, 10, 50, 100, and 200 by default (all values are in microseconds) and the index selects a value from this list. @@ -220,8 +220,8 @@ Different interfaces can be assigned dif dev..X.holdoff_tmr_idx sysctl. .It Va hw.cxgbe.holdoff_pktc_idx_10G .It Va hw.cxgbe.holdoff_pktc_idx_1G -The packet-count index value to use to delay interrupts. -The packet-count list has the values 1, 8, 16, and 32 by default +Packet-count index value used to delay interrupts. +The packet-count list has the values 1, 8, 16, and 32 by default, and the index selects a value from this list. The default value is -1 which means packet counting is disabled and interrupts are generated based solely on the holdoff timer value. @@ -230,8 +230,7 @@ dev..X.holdoff_pktc_idx sysctl. This sysctl works only when the interface has never been marked up (as done by ifconfig up). .It Va hw.cxgbe.qsize_txq -The size, in number of entries, of the descriptor ring used for a tx -queue. +Number of entries in a transmit queue's descriptor ring. A buf_ring of the same size is also allocated for additional software queuing. See @@ -242,19 +241,17 @@ dev..X.qsize_txq sysctl. This sysctl works only when the interface has never been marked up (as done by ifconfig up). .It Va hw.cxgbe.qsize_rxq -The size, in number of entries, of the descriptor ring used for an -rx queue. +Number of entries in a receive queue's descriptor ring. The default value is 1024. Different interfaces can be assigned different values via the dev..X.qsize_rxq sysctl. This sysctl works only when the interface has never been marked up (as done by ifconfig up). .It Va hw.cxgbe.interrupt_types -The interrupt types that the driver is allowed to use. -Bit 0 represents INTx (line interrupts), bit 1 MSI, bit 2 MSI-X. +Permitted interrupt types. +Bit 0 represents INTx (line interrupts), bit 1 MSI, and bit 2 MSI-X. The default is 7 (all allowed). -The driver will select the best possible type out of the allowed types by -itself. +The driver selects the best possible type out of the allowed types. .It Va hw.cxgbe.fw_install 0 prohibits the driver from installing a firmware on the card. 1 allows the driver to install a new firmware if internal driver @@ -265,7 +262,7 @@ long as it is compatible with the driver the one already on the card. The default is 1. .It Va hw.cxgbe.fl_pktshift -The number of bytes of padding inserted before the beginning of an Ethernet +Number of padding bytes inserted before the beginning of an Ethernet frame in the receive buffer. The default value of 2 ensures that the Ethernet payload (usually the IP header) is at a 4 byte aligned address. @@ -309,8 +306,8 @@ Each of these must be set to one of the (usually 2048, 4096, 9216, and 16384) and largest_rx_cluster must be greater than or equal to safest_rx_cluster. The defaults are 16384 and 4096 respectively. -The driver will never attempt to allocate a receive buffer larger than -largest_rx_cluster and will fall back to allocating buffers of +The driver never attempts to allocate a receive buffer larger than +largest_rx_cluster and falls back to allocating buffers of safest_rx_cluster size if an allocation larger than safest_rx_cluster fails. Note that largest_rx_cluster merely establishes a ceiling -- the driver is allowed to allocate buffers of smaller sizes. Modified: head/share/man/man4/cxgbev.4 ============================================================================== --- head/share/man/man4/cxgbev.4 Thu Dec 22 17:51:44 2016 (r310423) +++ head/share/man/man4/cxgbev.4 Thu Dec 22 18:05:22 2016 (r310424) @@ -31,7 +31,7 @@ .\" .\" $FreeBSD$ .\" -.Dd December 5, 2016 +.Dd December 22, 2016 .Dt CXGBEV 4 .Os .Sh NAME @@ -81,9 +81,9 @@ The Physical Function driver for Chelsio tunables. The driver provides sysctl MIBs for both ports and parent devices using the names above. -For example, a T5 VF will provide port MIBs under dev.cxlv and +For example, a T5 VF provides port MIBs under dev.cxlv and parent device MIBs under dev.t5vf. -References to sysctl MIBs in the remainder of this page will use +References to sysctl MIBs in the remainder of this page use dev. for port MIBs and dev. for parent device MIBs. .Pp For more information on configuring this device, see @@ -173,24 +173,24 @@ prompt before booting the kernel or stor .Xr loader.conf 5 . .Bl -tag -width indent .It Va hw.cxgbe.ntxq10g -The number of tx queues to use for a 10Gb or higher-speed port. +Number of tx queues used for a 10Gb or higher-speed port. The default is 16 or the number of CPU cores in the system, whichever is less. .It Va hw.cxgbe.nrxq10g -The number of rx queues to use for a 10Gb or higher-speed port. +Number of rx queues used for a 10Gb or higher-speed port. The default is 8 or the number of CPU cores in the system, whichever is less. .It Va hw.cxgbe.ntxq1g -The number of tx queues to use for a 1Gb port. +Number of tx queues used for a 1Gb port. The default is 4 or the number of CPU cores in the system, whichever is less. .It Va hw.cxgbe.nrxq1g -The number of rx queues to use for a 1Gb port. +Number of rx queues used for a 1Gb port. The default is 2 or the number of CPU cores in the system, whichever is less. .It Va hw.cxgbe.holdoff_timer_idx_10G .It Va hw.cxgbe.holdoff_timer_idx_1G -The timer index value to use to delay interrupts. +Timer index value used to delay interrupts. The holdoff timer list has the values 1, 5, 10, 50, 100, and 200 by default (all values are in microseconds) and the index selects a value from this list. @@ -199,8 +199,8 @@ Different interfaces can be assigned dif dev..X.holdoff_tmr_idx sysctl. .It Va hw.cxgbe.holdoff_pktc_idx_10G .It Va hw.cxgbe.holdoff_pktc_idx_1G -The packet-count index value to use to delay interrupts. -The packet-count list has the values 1, 8, 16, and 32 by default +Packet-count index value used to delay interrupts. +The packet-count list has the values 1, 8, 16, and 32 by default, and the index selects a value from this list. The default value is -1 which means packet counting is disabled and interrupts are generated based solely on the holdoff timer value. @@ -209,8 +209,7 @@ dev..X.holdoff_pktc_idx sysctl. This sysctl works only when the interface has never been marked up (as done by ifconfig up). .It Va hw.cxgbe.qsize_txq -The size, in number of entries, of the descriptor ring used for a tx -queue. +Number of entries in a transmit queue's descriptor ring. A buf_ring of the same size is also allocated for additional software queuing. See @@ -221,21 +220,21 @@ dev..X.qsize_txq sysctl. This sysctl works only when the interface has never been marked up (as done by ifconfig up). .It Va hw.cxgbe.qsize_rxq -The size, in number of entries, of the descriptor ring used for an -rx queue. +Number of entries in a receive queue's descriptor ring. The default value is 1024. Different interfaces can be assigned different values via the dev..X.qsize_rxq sysctl. This sysctl works only when the interface has never been marked up (as done by ifconfig up). .It Va hw.cxgbe.interrupt_types -The interrupt types that the driver is allowed to use. -Bit 0 represents INTx (line interrupts), bit 1 MSI, bit 2 MSI-X. +Permitted interrupt types. +Bit 0 represents INTx (line interrupts), bit 1 MSI, and bit 2 MSI-X. The default is 7 (all allowed). -The driver will select the best possible type out of the allowed types by -itself. +The driver selects the best possible type out of the allowed types. +Note that Virtual Functions do not support INTx interrupts and fail +to attach if neither MSI nor MSI-X are enabled. .It Va hw.cxgbe.fl_pktshift -The number of bytes of padding inserted before the beginning of an Ethernet +Number of padding bytes inserted before the beginning of an Ethernet frame in the receive buffer. The default value of 2 ensures that the Ethernet payload (usually the IP header) is at a 4 byte aligned address. @@ -262,8 +261,8 @@ Each of these must be set to one of the (usually 2048, 4096, 9216, and 16384) and largest_rx_cluster must be greater than or equal to safest_rx_cluster. The defaults are 16384 and 4096 respectively. -The driver will never attempt to allocate a receive buffer larger than -largest_rx_cluster and will fall back to allocating buffers of +The driver never attempts to allocate a receive buffer larger than +largest_rx_cluster and falls back to allocating buffers of safest_rx_cluster size if an allocation larger than safest_rx_cluster fails. Note that largest_rx_cluster merely establishes a ceiling -- the driver is allowed to allocate buffers of smaller sizes. @@ -271,8 +270,8 @@ allowed to allocate buffers of smaller s .Pp Certain settings and resources for Virtual Functions are dictated by the parent Physical Function driver. -For example, the Physical Function driver limits the number of queues a -Virtual Function is permitted to use. +For example, the Physical Function driver limits the number of queues +available to a Virtual Function. Some of these limits can be adjusted in the firmware configuration file used with the Physical Function driver. .Pp @@ -290,7 +289,7 @@ to 1 .Pc . .Pp The VF driver currently depends on the PF driver. -As a result, loading the VF driver will also load the PF driver as a +As a result, loading the VF driver also loads the PF driver as a dependency. .Sh SUPPORT For general information and support, From owner-svn-src-all@freebsd.org Thu Dec 22 18:26:22 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C9306C8C6D6; Thu, 22 Dec 2016 18:26:22 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 986B11093; Thu, 22 Dec 2016 18:26:22 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBMIQLK8076249; Thu, 22 Dec 2016 18:26:21 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBMIQLFQ076247; Thu, 22 Dec 2016 18:26:21 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201612221826.uBMIQLFQ076247@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Thu, 22 Dec 2016 18:26:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310425 - in head/sys/dev/mlx4: mlx4_core mlx4_ib X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Dec 2016 18:26:22 -0000 Author: emaste Date: Thu Dec 22 18:26:21 2016 New Revision: 310425 URL: https://svnweb.freebsd.org/changeset/base/310425 Log: mlx: avoid use of __DATE__ to make build reproducible Reviewed by: hselasky Differential Revision: https://reviews.freebsd.org/D8886 Modified: head/sys/dev/mlx4/mlx4_core/mlx4.h head/sys/dev/mlx4/mlx4_ib/mlx4_ib_main.c Modified: head/sys/dev/mlx4/mlx4_core/mlx4.h ============================================================================== --- head/sys/dev/mlx4/mlx4_core/mlx4.h Thu Dec 22 18:05:22 2016 (r310424) +++ head/sys/dev/mlx4/mlx4_core/mlx4.h Thu Dec 22 18:26:21 2016 (r310425) @@ -52,7 +52,7 @@ #define DRV_NAME "mlx4_core" #define PFX DRV_NAME ": " #define DRV_VERSION "2.1.6" -#define DRV_RELDATE __DATE__ +#define DRV_RELDATE "Sep 30 2016" #define DRV_STACK_NAME "Linux-MLNX_OFED" #define DRV_STACK_VERSION "2.1" Modified: head/sys/dev/mlx4/mlx4_ib/mlx4_ib_main.c ============================================================================== --- head/sys/dev/mlx4/mlx4_ib/mlx4_ib_main.c Thu Dec 22 18:05:22 2016 (r310424) +++ head/sys/dev/mlx4/mlx4_ib/mlx4_ib_main.c Thu Dec 22 18:26:21 2016 (r310425) @@ -59,7 +59,7 @@ #define DRV_NAME MLX4_IB_DRV_NAME #define DRV_VERSION "1.0" -#define DRV_RELDATE __DATE__ +#define DRV_RELDATE "Sep 30 2016" #define MLX4_IB_DRIVER_PROC_DIR_NAME "driver/mlx4_ib" #define MLX4_IB_MRS_PROC_DIR_NAME "mrs" From owner-svn-src-all@freebsd.org Thu Dec 22 18:30:30 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C3545C8C84F; Thu, 22 Dec 2016 18:30:30 +0000 (UTC) (envelope-from julian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 92FCA1369; Thu, 22 Dec 2016 18:30:30 +0000 (UTC) (envelope-from julian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBMIUTtd076459; Thu, 22 Dec 2016 18:30:29 GMT (envelope-from julian@FreeBSD.org) Received: (from julian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBMIUTNK076458; Thu, 22 Dec 2016 18:30:29 GMT (envelope-from julian@FreeBSD.org) Message-Id: <201612221830.uBMIUTNK076458@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: julian set sender to julian@FreeBSD.org using -f From: Julian Elischer Date: Thu, 22 Dec 2016 18:30:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310426 - head/share/zoneinfo X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Dec 2016 18:30:30 -0000 Author: julian Date: Thu Dec 22 18:30:29 2016 New Revision: 310426 URL: https://svnweb.freebsd.org/changeset/base/310426 Log: If you are going to be run individually to make a new timezone set then ensure the destination directories exist. Especially if you define OLDTIMEZONES because the mtree pass doesn't do it for you. MFC after: 1 week Sponsored by: Panzura Modified: head/share/zoneinfo/Makefile Modified: head/share/zoneinfo/Makefile ============================================================================== --- head/share/zoneinfo/Makefile Thu Dec 22 18:26:21 2016 (r310425) +++ head/share/zoneinfo/Makefile Thu Dec 22 18:30:29 2016 (r310426) @@ -85,6 +85,8 @@ zoneinfo: yearistype ${TDATA} beforeinstall: install-zoneinfo install-zoneinfo: + mkdir -p ${DESTDIR}/usr/share/zoneinfo + cd ${DESTDIR}/usr/share/zoneinfo; mkdir -p ${TZBUILDSUBDIRS} cd ${TZBUILDDIR} && \ find -s * -type f -print -exec ${INSTALL} ${TAG_ARGS} \ -o ${BINOWN} -g ${BINGRP} -m ${NOBINMODE} \ From owner-svn-src-all@freebsd.org Thu Dec 22 18:33:36 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8C597C8CAA9; Thu, 22 Dec 2016 18:33:36 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from cell.glebi.us (glebi.us [96.95.210.25]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "cell.glebi.us", Issuer "cell.glebi.us" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 7637C17FC; Thu, 22 Dec 2016 18:33:36 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from cell.glebi.us (localhost [127.0.0.1]) by cell.glebi.us (8.15.2/8.15.2) with ESMTPS id uBMIXZ7G082168 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Thu, 22 Dec 2016 10:33:35 -0800 (PST) (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by cell.glebi.us (8.15.2/8.15.2/Submit) id uBMIXZvE082167; Thu, 22 Dec 2016 10:33:35 -0800 (PST) (envelope-from glebius@FreeBSD.org) X-Authentication-Warning: cell.glebi.us: glebius set sender to glebius@FreeBSD.org using -f Date: Thu, 22 Dec 2016 10:33:34 -0800 From: Gleb Smirnoff To: hiren panchasara Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r309745 - in head: share/man/man9 sys/kern sys/sys Message-ID: <20161222183334.GP9389@FreeBSD.org> References: <201612091758.uB9HwYC0087384@repo.freebsd.org> <20161222001928.GZ82166@strugglingcoder.info> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20161222001928.GZ82166@strugglingcoder.info> User-Agent: Mutt/1.7.0 (2016-08-17) X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Dec 2016 18:33:36 -0000 Hi! On Wed, Dec 21, 2016 at 04:19:28PM -0800, hiren panchasara wrote: h> On 12/09/16 at 05:58P, Gleb Smirnoff wrote: h> > Author: glebius h> > Date: Fri Dec 9 17:58:34 2016 h> > New Revision: 309745 h> > URL: https://svnweb.freebsd.org/changeset/base/309745 h> > h> > Log: h> > Provide counter_ratecheck(), a MP-friendly substitution to ppsratecheck(). h> > When rated event happens at a very quick rate, the ppsratecheck() is not h> > only racy, but also becomes a performance bottleneck. h> > h> > Together with: rrs, jtl h> h> Is it possible for you to MFC this and the following fix to it to 11? Have you tried it and found useful? If yes, you are welcome to merge it. My current work involves only FreeBSD head, I don't have any STABLE production boxes, that's why I am very conservative with my MFCs: I do only obvious conservative bugfixes, not performance improvements. -- Totus tuus, Glebius. From owner-svn-src-all@freebsd.org Thu Dec 22 18:39:18 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 706DCC8CD54; Thu, 22 Dec 2016 18:39:18 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from mail.baldwin.cx (bigwig.baldwin.cx [IPv6:2001:470:1f11:75::1]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 5115A1C9B; Thu, 22 Dec 2016 18:39:18 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from ralph.baldwin.cx (c-73-231-226-104.hsd1.ca.comcast.net [73.231.226.104]) by mail.baldwin.cx (Postfix) with ESMTPSA id 31A6010A761; Thu, 22 Dec 2016 13:39:17 -0500 (EST) From: John Baldwin To: Mark Johnston Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r310423 - head/sys/kern Date: Thu, 22 Dec 2016 10:39:12 -0800 Message-ID: <6562460.a4qdZuDa0s@ralph.baldwin.cx> User-Agent: KMail/4.14.10 (FreeBSD/11.0-PRERELEASE; KDE/4.14.10; amd64; ; ) In-Reply-To: <201612221751.uBMHpim4062786@repo.freebsd.org> References: <201612221751.uBMHpim4062786@repo.freebsd.org> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.4.3 (mail.baldwin.cx); Thu, 22 Dec 2016 13:39:17 -0500 (EST) X-Virus-Scanned: clamav-milter 0.99.2 at mail.baldwin.cx X-Virus-Status: Clean X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Dec 2016 18:39:18 -0000 On Thursday, December 22, 2016 05:51:44 PM Mark Johnston wrote: > Author: markj > Date: Thu Dec 22 17:51:44 2016 > New Revision: 310423 > URL: https://svnweb.freebsd.org/changeset/base/310423 > > Log: > Revert part of r300109. > > The removal of TAILQ_FOREACH_SAFE introduced a small race: when the last > thread on a sleepqueue is awoken, it reclaims the sleepqueue and may begin > executing on a different CPU before sleepq_resume_thread() returns. This > leaves a window during which it may go back to sleep and incorrectly be > awoken again by the caller of sleepq_broadcast(). This is very subtle. The issue is that the last sleepq_resume_thread transfers ownership of 'sq' from the wait channel that the sleepq_broadcast has locked, to the thread being resumed. I thought about using a local TAILQ_HEAD and using TAILQ_CONCAT to move the list of threads out of the sleep queue and then walking that list. However, a comment explaining this transfer of ownership (and that we can't safely access 'sq' after the last thread is resumed) is probably sufficient (but necessary I think). Do you feel like adding one? -- John Baldwin From owner-svn-src-all@freebsd.org Thu Dec 22 18:49:58 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0ACCAC8D31C; Thu, 22 Dec 2016 18:49:58 +0000 (UTC) (envelope-from hiren@strugglingcoder.info) Received: from mail.strugglingcoder.info (strugglingcoder.info [104.236.146.68]) by mx1.freebsd.org (Postfix) with ESMTP id E98949B8; Thu, 22 Dec 2016 18:49:57 +0000 (UTC) (envelope-from hiren@strugglingcoder.info) Received: from localhost (unknown [10.1.1.3]) (Authenticated sender: hiren@strugglingcoder.info) by mail.strugglingcoder.info (Postfix) with ESMTPA id 9219E177F3; Thu, 22 Dec 2016 10:49:56 -0800 (PST) Date: Thu, 22 Dec 2016 10:49:56 -0800 From: hiren panchasara To: Gleb Smirnoff Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r309745 - in head: share/man/man9 sys/kern sys/sys Message-ID: <20161222184956.GD82166@strugglingcoder.info> References: <201612091758.uB9HwYC0087384@repo.freebsd.org> <20161222001928.GZ82166@strugglingcoder.info> <20161222183334.GP9389@FreeBSD.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="Zljh9u/ceMLi+8mf" Content-Disposition: inline In-Reply-To: <20161222183334.GP9389@FreeBSD.org> User-Agent: Mutt/1.5.23 (2014-03-12) X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Dec 2016 18:49:58 -0000 --Zljh9u/ceMLi+8mf Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On 12/22/16 at 10:33P, Gleb Smirnoff wrote: > Hi! >=20 > On Wed, Dec 21, 2016 at 04:19:28PM -0800, hiren panchasara wrote: > h> On 12/09/16 at 05:58P, Gleb Smirnoff wrote: > h> > Author: glebius > h> > Date: Fri Dec 9 17:58:34 2016 > h> > New Revision: 309745 > h> > URL: https://svnweb.freebsd.org/changeset/base/309745 > h> >=20 > h> > Log: > h> > Provide counter_ratecheck(), a MP-friendly substitution to ppsrate= check(). > h> > When rated event happens at a very quick rate, the ppsratecheck() = is not > h> > only racy, but also becomes a performance bottleneck. > h> > =20 > h> > Together with: rrs, jtl > h>=20 > h> Is it possible for you to MFC this and the following fix to it to 11? >=20 > Have you tried it and found useful? If yes, you are welcome to merge it. As you stated yourself in the commit message, this is a clear bug and an opportunity for performance enhancement. Do you feel this bug won't be in 11 and systems running on 11 won't have similar performance gains as those running on -head? Specially when 11 is the latest released version that many (like myself) would be running in the production. >=20 > My current work involves only FreeBSD head, I don't have any STABLE produ= ction > boxes, that's why I am very conservative with my MFCs: I do only obvious > conservative bugfixes, not performance improvements. The obvious reason we encourage original submitter to do MFCs is that (s)he is intimately familiar with the changes.=20 I can understand your point of not having any 11 based systems to test. I'll test this on our $work prod and do the MFC myself. Thanks for the original fix. Cheers, Hiren --Zljh9u/ceMLi+8mf Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQF8BAABCgBmBQJYXCBGXxSAAAAAAC4AKGlzc3Vlci1mcHJAbm90YXRpb25zLm9w ZW5wZ3AuZmlmdGhob3JzZW1hbi5uZXRBNEUyMEZBMUQ4Nzg4RjNGMTdFNjZGMDI4 QjkyNTBFMTU2M0VERkU1AAoJEIuSUOFWPt/lp0oH/3ghdQFFPUoBGLPGajuwAxpl YimyXcya96wh14xr+k6F5Gm/77WIPl0CwWHnr5A7zLpgJVpewH09A2CP4U9j6hAL rFo3Hu7CoKMwt23cVft5mVNh+pObmLZC9h/82xOyJqOA6sumKhOGwwjJjXn8S5+q xZqQ4Oc2zeD0KxbJU8CL+gUhAt4IMNVMAWKxV4KikK8X5snEM1QFZ/ns50gtnlQi TDnjNXpg69IflINufLO00+/kC/lNls1QQMhSTsY6SElJZJ6X+eH+sCragf6bHgvM Gw/qiwh3ni/12auEAhfQ0AVCPrgU27dWSHoPJ305FpwBdTZ6eY1m/VtL10ZRQgw= =Yxuq -----END PGP SIGNATURE----- --Zljh9u/ceMLi+8mf-- From owner-svn-src-all@freebsd.org Thu Dec 22 19:19:40 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 153D0C8DD90; Thu, 22 Dec 2016 19:19:40 +0000 (UTC) (envelope-from markjdb@gmail.com) Received: from mail-qt0-x243.google.com (mail-qt0-x243.google.com [IPv6:2607:f8b0:400d:c0d::243]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id C64DD1CD7; Thu, 22 Dec 2016 19:19:39 +0000 (UTC) (envelope-from markjdb@gmail.com) Received: by mail-qt0-x243.google.com with SMTP id 3so4644657qtr.2; Thu, 22 Dec 2016 11:19:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=0d+Murcr8TY6GCYjcuNlhgXUE+4M1ScE8+ItgGwEi6U=; b=vNaa051gwlk8+L3et4o3FulWnQfGwVVuyiySzQRYuns6xKk35MGb8Biwtq6WpyqOBK t6opxNdvU11jaOutzhGdoXKr3xQ7gdStvFlHPTyxf/E11UZNFiKFtf8xx/qUd+piggkD h2EVVV3flDFDXCv5qJxvkpWl0FHV8UnLcdPR8bSePgEpUUIut2GoNA7Ip5qlhhdHiAXA ihf7/OzR9NjpHSfmD3+CsWO4CGR18XcaOsYpvoTfz7IirYB5y45HIF1g7dc/6eWB6q3N M1uTOc2YQHa3H1ou0rCGBKW5a5Fx7U7ys6VMZz23yUlQQjxs7cSzfWQ3eChJ44PsCvjY JDKA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:from:to:cc:subject:message-id :references:mime-version:content-disposition:in-reply-to:user-agent; bh=0d+Murcr8TY6GCYjcuNlhgXUE+4M1ScE8+ItgGwEi6U=; b=CzkSPCdFMyRDeWUksH3M7L131swH+0JFjGnSteaHQROr9xiDnIdZrEVTMcOkDV+nKa jEztFhZwkEP+F8CCnaiV2MVY7f7bdKBa7mSimr/s+/94Ez/DuYxxyr1kMZH/Yb31YW2/ cd1k9k+G4tnplepINNuNKRo+563wFIWNHzi3uAIh4VW0UZZaUSs5XPrp7MBirPk/7Xzq BcKVMO4dp7q/GsBajgxJYdgnFQ9H+ZWaJ6aFqv+ctube+1Koj0IiRPf43x5UpHS5k663 22kGNmRwShMLDWCz4tb+7ly+hpSUg0WPQHCkk4LWCsNDqqj5Mm60R2ZwyKHzsLoXaBiH WDLQ== X-Gm-Message-State: AIkVDXKa4/PXZ111Gu/W7W7PgrhtgnWa/cfD0/5eRBfIBDRMIYlhmPCqQgJbURcTTpH6Ig== X-Received: by 10.200.41.9 with SMTP id y9mr12269673qty.26.1482434378787; Thu, 22 Dec 2016 11:19:38 -0800 (PST) Received: from wkstn-mjohnston.west.isilon.com (c-76-104-201-218.hsd1.wa.comcast.net. [76.104.201.218]) by smtp.gmail.com with ESMTPSA id y22sm18597334qtb.26.2016.12.22.11.19.37 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 22 Dec 2016 11:19:38 -0800 (PST) Sender: Mark Johnston Date: Thu, 22 Dec 2016 11:26:01 -0800 From: Mark Johnston To: John Baldwin Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r310423 - head/sys/kern Message-ID: <20161222192601.GA78778@wkstn-mjohnston.west.isilon.com> References: <201612221751.uBMHpim4062786@repo.freebsd.org> <6562460.a4qdZuDa0s@ralph.baldwin.cx> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <6562460.a4qdZuDa0s@ralph.baldwin.cx> User-Agent: Mutt/1.7.2 (2016-11-26) X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Dec 2016 19:19:40 -0000 On Thu, Dec 22, 2016 at 10:39:12AM -0800, John Baldwin wrote: > On Thursday, December 22, 2016 05:51:44 PM Mark Johnston wrote: > > Author: markj > > Date: Thu Dec 22 17:51:44 2016 > > New Revision: 310423 > > URL: https://svnweb.freebsd.org/changeset/base/310423 > > > > Log: > > Revert part of r300109. > > > > The removal of TAILQ_FOREACH_SAFE introduced a small race: when the last > > thread on a sleepqueue is awoken, it reclaims the sleepqueue and may begin > > executing on a different CPU before sleepq_resume_thread() returns. This > > leaves a window during which it may go back to sleep and incorrectly be > > awoken again by the caller of sleepq_broadcast(). > > This is very subtle. :( > The issue is that the last sleepq_resume_thread transfers > ownership of 'sq' from the wait channel that the sleepq_broadcast has locked, > to the thread being resumed. Right, that's what I meant by "reclaims the sleepqueue." One other requirement for hitting the race is that the thread goes back to sleep on a wait channel that hashes to a different sleepchain, else the sleepchain lock held by the sleepq_broadcast() caller is, I believe, sufficient to prevent the reuse of the sleepqueue before the loop has terminated. > I thought about using a local TAILQ_HEAD and > using TAILQ_CONCAT to move the list of threads out of the sleep queue and then > walking that list. However, a comment explaining this transfer of ownership > (and that we can't safely access 'sq' after the last thread is resumed) is > probably sufficient (but necessary I think). Do you feel like adding one? How about: Index: subr_sleepqueue.c =================================================================== --- subr_sleepqueue.c (revision 310423) +++ subr_sleepqueue.c (working copy) @@ -892,7 +892,12 @@ KASSERT(sq->sq_type == (flags & SLEEPQ_TYPE), ("%s: mismatch between sleep/wakeup and cv_*", __func__)); - /* Resume all blocked threads on the sleep queue. */ + /* + * Resume all blocked threads on the sleep queue. The last thread will + * be given ownership of sq and may re-enqueue itself before + * sleepq_resume_thread() returns, so we must cache the "next" queue + * item at the beginning of the final iteration. + */ wakeup_swapper = 0; TAILQ_FOREACH_SAFE(td, &sq->sq_blocked[queue], td_slpq, tdn) { thread_lock(td); From owner-svn-src-all@freebsd.org Thu Dec 22 19:42:55 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 96543C8D47C for ; Thu, 22 Dec 2016 19:42:55 +0000 (UTC) (envelope-from ed@nuxi.nl) Received: from mail-yw0-x22b.google.com (mail-yw0-x22b.google.com [IPv6:2607:f8b0:4002:c05::22b]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 5CF01F2F for ; Thu, 22 Dec 2016 19:42:55 +0000 (UTC) (envelope-from ed@nuxi.nl) Received: by mail-yw0-x22b.google.com with SMTP id r204so120289384ywb.0 for ; Thu, 22 Dec 2016 11:42:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nuxi-nl.20150623.gappssmtp.com; s=20150623; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-transfer-encoding; bh=xx2uty5DmqTGvyFg777yzTFvDWwjapNmTzx8WJw76yU=; b=KIGZ1aUEXG8npRTIvxtCL6M7J0AD9CMFjb43BKKQQoK2NzVYyICpzNIBVREsKvGiTg 1JFAuFS3ik8UrNyBru+gsCh6CTS+REfKoL5YwfHzVtoY0PghJwmUXeiqT2QyOsQ9uGQF QmK3B2b0mlyejVx3oSP4ZDecfsmvw3qwctWRBbnvbUkjwkL39xoxjinV7OYrYXRvoPLM vfb1pA1A5UYYkyyjYJ1XX+Ov3FAp1D1tdcGBuvYqtNdXwizjDjQStGYU+d+s8Ly5jptI QCctHp+UCtzTrJqkn2cD7mUJE39F1B6Chc4/NWvmSfEnH8KSnTUdEF7aQaD/Ag3Egfvt 0alA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:content-transfer-encoding; bh=xx2uty5DmqTGvyFg777yzTFvDWwjapNmTzx8WJw76yU=; b=b6MWiO1NGOmm4Eedd+Rk3Vf7DBC8D2DYhwfMxBKf6And8Et5oMHsbBVW7mX7wUojgd tl2Z6kdm+qTDPzSrM4sKajZug7VeDDsmQs00hm0iQMiyR4sBNROtGM1MsGaFsHjYWqKV wNaqGdO6ZvRpXVnCK3OTd9jGo81/YpV32HG8kcr9B9o5RXo7/rEq3tMBadCEo/KR7nPu AD7kT7wr+QGUtEKWGJ1K3LCe7lSowDMr0dkH+MH10Cos2oGLhuf/Uv8XOdfEktD3Wnjc d6rEnhgHC4pEwNfUIvKhht3OeRN5powCFIGQ0OR/Eh25ThGbmsRnoYzM5ojlUC/X0XD1 vq3w== X-Gm-Message-State: AIkVDXJQV/87s8jpwa+Rh0QoFcd8BXgQXXeoxJSXdpbrW/nvxr64A6iWoAUb+GBLuGRU2SEE68S+bKSQAgi8zA== X-Received: by 10.13.221.215 with SMTP id g206mr9674883ywe.350.1482435774391; Thu, 22 Dec 2016 11:42:54 -0800 (PST) MIME-Version: 1.0 Received: by 10.129.2.139 with HTTP; Thu, 22 Dec 2016 11:42:24 -0800 (PST) In-Reply-To: <20161221195304.GA3396@brick> References: <201612210829.uBL8Tijt041811@repo.freebsd.org> <20161221195304.GA3396@brick> From: Ed Schouten Date: Thu, 22 Dec 2016 20:42:24 +0100 Message-ID: Subject: Re: svn commit: r310354 - in head/usr.sbin: . prometheus_sysctl_exporter To: Ed Schouten , Adrian Chadd , Ed Schouten , "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Dec 2016 19:42:55 -0000 Hey! 2016-12-21 20:53 GMT+01:00 Edward Tomasz Napiera=C5=82a = : > That's a very good reason; it could also be fixed by moving > it from sbin/ to libexec/. I'm not sure that doing that is a good idea. You can also invoke this exporter through cron(8), so that it can be collected by the Prometheus node exporter. Another use case is invoking it from within a CGI script, so that it can be embedded in an existing web service. Storing the executable under /usr/libexec would therefore be a bit weird. > Another advantage of having the "prometheus" in the name is that it's > easily googlable, and it clearly indicates the "protocol" (in the wide > meaning) one is supposed to use to talk to it. Agreed. Let's leave it the way it is right now, as I don't feel like upsetting Warner. ;-) --=20 Ed Schouten Nuxi, 's-Hertogenbosch, the Netherlands KvK-nr.: 62051717 From owner-svn-src-all@freebsd.org Thu Dec 22 19:45:12 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 49496C8D511 for ; Thu, 22 Dec 2016 19:45:12 +0000 (UTC) (envelope-from ed@nuxi.nl) Received: from mail-yb0-x232.google.com (mail-yb0-x232.google.com [IPv6:2607:f8b0:4002:c09::232]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 09B18111A for ; Thu, 22 Dec 2016 19:45:12 +0000 (UTC) (envelope-from ed@nuxi.nl) Received: by mail-yb0-x232.google.com with SMTP id v132so83978332yba.0 for ; Thu, 22 Dec 2016 11:45:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nuxi-nl.20150623.gappssmtp.com; s=20150623; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=lOSLWGl/2UDjhL/n8Tkwii0ukSDpQefoLjPdK3QJdq0=; b=Jm6dtFFqOz0RK/xvtFbY4eI6S5sFyZKpx3pTJnhcDGldcfo5zSIAoWRAkI8vw7hu0W BOVIkMZAaWxIhMOoF+NOGnQoChjezYKoye5cUHDXmVc8BWWMsSFvnGWWOd/Dwm7q+puH OHQvA8peV//UN60oCrkIfDBz2ZVJZ1xopfmGrIK9RgdOQW1XRhcSw+CE+dlPe7zXDQxL E46rURIq9vBMkV0gGzce/+YoaBfeMu2tKaOdMQkpdW6LyymlVfqmQEXL/Z+6bJ3IwLKX WYzvWEv6UsTvuLiJG7SXkkorT3c6nDTu9UXjC20qX1piFjHtj/RIkBIhvlgPZq8wt6Ow jaTg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=lOSLWGl/2UDjhL/n8Tkwii0ukSDpQefoLjPdK3QJdq0=; b=tluvF2dCsT4VHluqZ9Ez6IfNQ/IJmjt1UV+LjHy5GquFpJ7eAo3mYwie/0HwZ5ZrT6 TlCMzm2tyABAHvGenbXL4ChVG3Fl1b2XkazE52Aqvg48Z/lA3n588rMCzcw4zmP1WVTC zS/pVOF5EX3iuzjOOjw5rdzAtmg/eBwAJPI7VFjJKc0HPMu0g0+ly8BTeI9GQWJbxa/2 SLPHvUz+EnN0y6WXUIcTaduGdfAv72AqUlTpLpANTAsCjnp7IP8N9xnlcXXodkulDyVb wCqfq+MW2pHCQ/CMnBykWFhYsGM5Kw21GOqb3mG1xHff82nMgZwdeW+lzxL8R+Aw+2fg VW/g== X-Gm-Message-State: AIkVDXJgayZXr94h4zZ7m6A9K6oxaD4OjIem8hGnoAdTo5lxIWISGtSd6Zo27jiZFR3WVZLfRi8bh+F1bsk+PA== X-Received: by 10.37.173.96 with SMTP id l32mr7637996ybe.25.1482435911144; Thu, 22 Dec 2016 11:45:11 -0800 (PST) MIME-Version: 1.0 Received: by 10.129.2.139 with HTTP; Thu, 22 Dec 2016 11:44:40 -0800 (PST) In-Reply-To: <201612221826.uBMIQLFQ076247@repo.freebsd.org> References: <201612221826.uBMIQLFQ076247@repo.freebsd.org> From: Ed Schouten Date: Thu, 22 Dec 2016 20:44:40 +0100 Message-ID: Subject: Re: svn commit: r310425 - in head/sys/dev/mlx4: mlx4_core mlx4_ib To: Ed Maste Cc: src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset=UTF-8 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Dec 2016 19:45:12 -0000 2016-12-22 19:26 GMT+01:00 Ed Maste : > Log: > mlx: avoid use of __DATE__ to make build reproducible Out of curiosity, are we planning on adding -Wdate-time or -Werror=date-time to our default CFLAGS? If so, awesome! -- Ed Schouten Nuxi, 's-Hertogenbosch, the Netherlands KvK-nr.: 62051717 From owner-svn-src-all@freebsd.org Thu Dec 22 20:01:06 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id EBBE5C8DAA6; Thu, 22 Dec 2016 20:01:06 +0000 (UTC) (envelope-from brooks@spindle.one-eyed-alien.net) Received: from spindle.one-eyed-alien.net (spindle.one-eyed-alien.net [199.48.129.229]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C637F1BBA; Thu, 22 Dec 2016 20:01:06 +0000 (UTC) (envelope-from brooks@spindle.one-eyed-alien.net) Received: by spindle.one-eyed-alien.net (Postfix, from userid 3001) id 81B7C5A9F12; Thu, 22 Dec 2016 19:52:11 +0000 (UTC) Date: Thu, 22 Dec 2016 19:52:11 +0000 From: Brooks Davis To: Ed Schouten Cc: Adrian Chadd , Ed Schouten , "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" Subject: Re: svn commit: r310354 - in head/usr.sbin: . prometheus_sysctl_exporter Message-ID: <20161222195211.GA50719@spindle.one-eyed-alien.net> References: <201612210829.uBL8Tijt041811@repo.freebsd.org> <20161221195304.GA3396@brick> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="2fHTh5uZTiUOsy+g" Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.7.2 (2016-11-26) X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Dec 2016 20:01:07 -0000 --2fHTh5uZTiUOsy+g Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Thu, Dec 22, 2016 at 08:42:24PM +0100, Ed Schouten wrote: > Hey! >=20 > 2016-12-21 20:53 GMT+01:00 Edward Tomasz Napiera??a : > > That's a very good reason; it could also be fixed by moving > > it from sbin/ to libexec/. >=20 > I'm not sure that doing that is a good idea. You can also invoke this > exporter through cron(8), so that it can be collected by the > Prometheus node exporter. Another use case is invoking it from within > a CGI script, so that it can be embedded in an existing web service. > Storing the executable under /usr/libexec would therefore be a bit > weird. To me, those use cases argue for /usr/libexec which is for things humans don't run. -- Brooks --2fHTh5uZTiUOsy+g Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEcBAEBAgAGBQJYXC7qAAoJEKzQXbSebgfAX9UH/1ELT5mqiPt052WQlJV1Uxcv 7IKxlDpPVRjAvgptYxKuC6QzbRbsH23ODDZnrQ/O5AirsZNmDvQFZAHhj1qd+nN9 rDN9X9z98Y4gXDrhJfSfnPZVkFBzWXXu+JpV31hit3+ZyfS8wJf4Mb7HvsGmNYYG Byg6SBsJzRO7QvjrQA/oNLj2nelI24WRfYbIepf4cERRvQ4w5vbKv11E8ZX0HjBu 81AKzi7wEzpDbIPj1TZ+FitaLnzqVBVDxtkl0nv4XVx9+kBFCdBWzuNAT9QbcW0k OHAL5aBj4uMffHJWmH4uZvznB0VQFgGpex0qLKqeLdfnSrxWyLNfNpAv37KWx9Q= =uUN5 -----END PGP SIGNATURE----- --2fHTh5uZTiUOsy+g-- From owner-svn-src-all@freebsd.org Thu Dec 22 20:07:54 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8C3DFC8DF52 for ; Thu, 22 Dec 2016 20:07:54 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from nm26.bullet.mail.ne1.yahoo.com (nm26.bullet.mail.ne1.yahoo.com [98.138.90.89]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 529EE391 for ; Thu, 22 Dec 2016 20:07:54 +0000 (UTC) (envelope-from pfg@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1482437267; bh=ZBl5FvOPPsyo2LVmJGFoNzzxZQi5TztR514ONn7g1DA=; h=Subject:To:References:From:Date:In-Reply-To:From:Subject; b=BWrrWMFLCXaTvNME4gBNB96jXcNG9Dupq1EdNkOLmtke1DTgCwRwp/C52lEgc5lDrjDFOmlyKD2bfw3pT/VEQiM84MoID3IoUVVmpNIOlfb74LN826XNzpOwGhm+ZTdxWhDYCJZ3PELbK+2FEF8JBtVSMQu4e2A/NyfLJzhc/FJSGXE6dqxgsoYQZgrsSRwdt9C9IAvbVQhmYZk3IMjKuovvcgeROs/y/z8ZAFOtaIcaxAhuObc7t99caBcyum0/yuh0LXajrU9dt6Lh5TCkoDXgAE530owZQFhqxeMPi+xdIea4Uk6f2CFmdV0Es9cn5eck/zbuQ/Jts5Dw3GMMng== Received: from [98.138.101.128] by nm26.bullet.mail.ne1.yahoo.com with NNFMP; 22 Dec 2016 20:07:47 -0000 Received: from [98.138.104.116] by tm16.bullet.mail.ne1.yahoo.com with NNFMP; 22 Dec 2016 20:07:47 -0000 Received: from [127.0.0.1] by smtp225.mail.ne1.yahoo.com with NNFMP; 22 Dec 2016 20:07:44 -0000 X-Yahoo-Newman-Id: 270394.99934.bm@smtp225.mail.ne1.yahoo.com X-Yahoo-Newman-Property: ymail-3 X-YMail-OSG: MLlX9vMVM1nxDPYn20KvjQ56.URWEN.F1glGXfTLIoYqGu1 Ri6RoAQsRYip0ZIQrnxG1xOewurtWK9NI_tkzYiIB4MmFRae1tfV.OuU0dVG DX.W.iSmGwDj2fk30c5g4DFkI3bYcNDM8U0tSNAVGeZQKFDjuLwsyzS6r9zm KfuwHq6ih.jKfMoQHwY_pniYwbgDqaLpz2_gpAYsOYEVWwj3cDgicH.db5MI ym4Dm7p9FxI57bUS026kEkIRyNcOlhkVJi_.xULWD8qwkyQgy2BUKGSFP1qn G3vXG_XdCBZ.FhomO0Bx5TqhMZ8B4pRjliVi9_1J_gmJwojEzreowGUB5sJs _FkJntwMx3awEe58IcmAgfcukApoqYhn7HEKcSO5qVnuOkfCMpD2V4wPsk3a XcNXkwFLHsN9i7F.NIWijC2evD4p8QV9TxOTGegI7rq3WXOGHk8qLkTzSNvD 4_5m0JoWkZGQdPQQlEWNEABe9Fm8k4z2_6vh.j7anQpcDHH_d52ezH.zxHz9 4G3aoOzmqvrojQ6QN8XphAuYZI0diRjhg0Ab6NZsxkwCAKQwo X-Yahoo-SMTP: xcjD0guswBAZaPPIbxpWwLcp9Unf Subject: Re: svn commit: r310425 - in head/sys/dev/mlx4: mlx4_core mlx4_ib To: Ed Maste , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201612221826.uBMIQLFQ076247@repo.freebsd.org> From: Pedro Giffuni Message-ID: Date: Thu, 22 Dec 2016 15:09:09 -0500 User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.5.1 MIME-Version: 1.0 In-Reply-To: <201612221826.uBMIQLFQ076247@repo.freebsd.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Dec 2016 20:07:54 -0000 On 22/12/2016 13:26, Ed Maste wrote: > Author: emaste > Date: Thu Dec 22 18:26:21 2016 > New Revision: 310425 > URL: https://svnweb.freebsd.org/changeset/base/310425 > > Log: > mlx: avoid use of __DATE__ to make build reproducible > > Reviewed by: hselasky > Differential Revision: https://reviews.freebsd.org/D8886 Hmm ... Sadly opengrok[*] reveals many uses of __DATE__. I am wondering if there is some way to have it replaced with the SVN Date keyword. Pedro. * http://src.illumos.org/source/search?q=__DATE__&defs=&refs=&path=&hist=&project=freebsd-head > Modified: > head/sys/dev/mlx4/mlx4_core/mlx4.h > head/sys/dev/mlx4/mlx4_ib/mlx4_ib_main.c > > Modified: head/sys/dev/mlx4/mlx4_core/mlx4.h > ============================================================================== > --- head/sys/dev/mlx4/mlx4_core/mlx4.h Thu Dec 22 18:05:22 2016 (r310424) > +++ head/sys/dev/mlx4/mlx4_core/mlx4.h Thu Dec 22 18:26:21 2016 (r310425) > @@ -52,7 +52,7 @@ > #define DRV_NAME "mlx4_core" > #define PFX DRV_NAME ": " > #define DRV_VERSION "2.1.6" > -#define DRV_RELDATE __DATE__ > +#define DRV_RELDATE "Sep 30 2016" > > #define DRV_STACK_NAME "Linux-MLNX_OFED" > #define DRV_STACK_VERSION "2.1" > > Modified: head/sys/dev/mlx4/mlx4_ib/mlx4_ib_main.c > ============================================================================== > --- head/sys/dev/mlx4/mlx4_ib/mlx4_ib_main.c Thu Dec 22 18:05:22 2016 (r310424) > +++ head/sys/dev/mlx4/mlx4_ib/mlx4_ib_main.c Thu Dec 22 18:26:21 2016 (r310425) > @@ -59,7 +59,7 @@ > > #define DRV_NAME MLX4_IB_DRV_NAME > #define DRV_VERSION "1.0" > -#define DRV_RELDATE __DATE__ > +#define DRV_RELDATE "Sep 30 2016" > > #define MLX4_IB_DRIVER_PROC_DIR_NAME "driver/mlx4_ib" > #define MLX4_IB_MRS_PROC_DIR_NAME "mrs" > From owner-svn-src-all@freebsd.org Thu Dec 22 20:16:12 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 03BB1C8C4CA; Thu, 22 Dec 2016 20:16:12 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C6320103D; Thu, 22 Dec 2016 20:16:11 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBMKGAhB021074; Thu, 22 Dec 2016 20:16:10 GMT (envelope-from jhibbits@FreeBSD.org) Received: (from jhibbits@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBMKGAGN021068; Thu, 22 Dec 2016 20:16:10 GMT (envelope-from jhibbits@FreeBSD.org) Message-Id: <201612222016.uBMKGAGN021068@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhibbits set sender to jhibbits@FreeBSD.org using -f From: Justin Hibbits Date: Thu, 22 Dec 2016 20:16:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r310427 - in stable/11/sys/powerpc: conf conf/dpaa mpc85xx X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Dec 2016 20:16:12 -0000 Author: jhibbits Date: Thu Dec 22 20:16:10 2016 New Revision: 310427 URL: https://svnweb.freebsd.org/changeset/base/310427 Log: Partial MFC r303693: Merge MPC85XX and QorIQ config options Only a partial MFC, keeping files.powerpc and options.powerpc intact, to retain compatibility with any kernel configs that may use the QORIQ_DPAA option. Modified: stable/11/sys/powerpc/conf/MPC85XX stable/11/sys/powerpc/conf/dpaa/DPAA stable/11/sys/powerpc/mpc85xx/mpc85xx.c stable/11/sys/powerpc/mpc85xx/mpc85xx.h stable/11/sys/powerpc/mpc85xx/pci_mpc85xx.c stable/11/sys/powerpc/mpc85xx/platform_mpc85xx.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/powerpc/conf/MPC85XX ============================================================================== --- stable/11/sys/powerpc/conf/MPC85XX Thu Dec 22 18:30:29 2016 (r310426) +++ stable/11/sys/powerpc/conf/MPC85XX Thu Dec 22 20:16:10 2016 (r310427) @@ -10,7 +10,9 @@ ident MPC85XX machine powerpc powerpc +include "dpaa/config.dpaa" makeoptions DEBUG="-Wa,-me500 -g" +makeoptions WERROR="-Werror -Wno-format -Wno-redundant-decls" makeoptions NO_MODULES=yes options FPU_EMU @@ -21,7 +23,6 @@ options BREAK_TO_DEBUGGER options BOOTP options BOOTP_NFSROOT #options BOOTP_NFSV3 -options BOOTP_WIRED_TO=tsec0 options CD9660 options COMPAT_43 options DDB @@ -29,7 +30,6 @@ options DDB options DEVICE_POLLING #options DIAGNOSTIC options FDT -makeoptions FDT_DTS_FILE=mpc8572ds.dts #makeoptions FDT_DTS_FILE=mpc8555cds.dts options FFS options GDB @@ -69,6 +69,7 @@ device em device alc device ether device fxp +device gpio device iic device iicbus #device isa Modified: stable/11/sys/powerpc/conf/dpaa/DPAA ============================================================================== --- stable/11/sys/powerpc/conf/dpaa/DPAA Thu Dec 22 18:30:29 2016 (r310426) +++ stable/11/sys/powerpc/conf/dpaa/DPAA Thu Dec 22 20:16:10 2016 (r310427) @@ -16,7 +16,7 @@ makeoptions WERROR="-Werror -Wno-format makeoptions NO_MODULES=yes # Platform support -options QORIQ_DPAA #Freescale SoC family +options MPC85XX #Freescale SoC family options SMP #Symmetric Multi Processing Modified: stable/11/sys/powerpc/mpc85xx/mpc85xx.c ============================================================================== --- stable/11/sys/powerpc/mpc85xx/mpc85xx.c Thu Dec 22 18:30:29 2016 (r310426) +++ stable/11/sys/powerpc/mpc85xx/mpc85xx.c Thu Dec 22 20:16:10 2016 (r310427) @@ -108,13 +108,17 @@ law_getmax(void) static inline void law_write(uint32_t n, uint64_t bar, uint32_t sr) { -#if defined(QORIQ_DPAA) - ccsr_write4(OCP85XX_LAWBARH(n), bar >> 32); - ccsr_write4(OCP85XX_LAWBARL(n), bar); -#else - ccsr_write4(OCP85XX_LAWBAR(n), bar >> 12); -#endif - ccsr_write4(OCP85XX_LAWSR(n), sr); + + if (mpc85xx_is_qoriq()) { + ccsr_write4(OCP85XX_LAWBARH(n), bar >> 32); + ccsr_write4(OCP85XX_LAWBARL(n), bar); + ccsr_write4(OCP85XX_LAWSR_QORIQ(n), sr); + ccsr_read4(OCP85XX_LAWSR_QORIQ(n)); + } else { + ccsr_write4(OCP85XX_LAWBAR(n), bar >> 12); + ccsr_write4(OCP85XX_LAWSR_85XX(n), sr); + ccsr_read4(OCP85XX_LAWSR_85XX(n)); + } /* * The last write to LAWAR should be followed by a read @@ -123,20 +127,21 @@ law_write(uint32_t n, uint64_t bar, uint * instruction. */ - ccsr_read4(OCP85XX_LAWSR(n)); isync(); } static inline void law_read(uint32_t n, uint64_t *bar, uint32_t *sr) { -#if defined(QORIQ_DPAA) - *bar = (uint64_t)ccsr_read4(OCP85XX_LAWBARH(n)) << 32 | - ccsr_read4(OCP85XX_LAWBARL(n)); -#else - *bar = (uint64_t)ccsr_read4(OCP85XX_LAWBAR(n)) << 12; -#endif - *sr = ccsr_read4(OCP85XX_LAWSR(n)); + + if (mpc85xx_is_qoriq()) { + *bar = (uint64_t)ccsr_read4(OCP85XX_LAWBARH(n)) << 32 | + ccsr_read4(OCP85XX_LAWBARL(n)); + *sr = ccsr_read4(OCP85XX_LAWSR_QORIQ(n)); + } else { + *bar = (uint64_t)ccsr_read4(OCP85XX_LAWBAR(n)) << 12; + *sr = ccsr_read4(OCP85XX_LAWSR_85XX(n)); + } } static int @@ -306,6 +311,18 @@ mpc85xx_enable_l3_cache(void) } } +int +mpc85xx_is_qoriq(void) +{ + uint16_t pvr = mfpvr() >> 16; + + /* QorIQ register set is only in e500mc and derivative core based SoCs. */ + if (pvr == FSL_E500mc || pvr == FSL_E5500 || pvr == FSL_E6500) + return (1); + + return (0); +} + static void mpc85xx_dataloss_erratum_spr976(void) { @@ -352,9 +369,7 @@ moveon: if (err != 0) return (err); -#ifdef QORIQ_DPAA law_enable(OCP85XX_TGTIF_DCSR, b, 0x400000); -#endif return pmap_early_io_map(b, 0x400000); } Modified: stable/11/sys/powerpc/mpc85xx/mpc85xx.h ============================================================================== --- stable/11/sys/powerpc/mpc85xx/mpc85xx.h Thu Dec 22 18:30:29 2016 (r310426) +++ stable/11/sys/powerpc/mpc85xx/mpc85xx.h Thu Dec 22 20:16:10 2016 (r310427) @@ -67,36 +67,44 @@ extern vm_offset_t ccsrbar_va; /* * Local access registers */ -#if defined(QORIQ_DPAA) /* Write order: OCP_LAWBARH -> OCP_LAWBARL -> OCP_LAWSR */ #define OCP85XX_LAWBARH(n) (CCSRBAR_VA + 0xc00 + 0x10 * (n)) #define OCP85XX_LAWBARL(n) (CCSRBAR_VA + 0xc04 + 0x10 * (n)) -#define OCP85XX_LAWSR(n) (CCSRBAR_VA + 0xc08 + 0x10 * (n)) -#else +#define OCP85XX_LAWSR_QORIQ(n) (CCSRBAR_VA + 0xc08 + 0x10 * (n)) #define OCP85XX_LAWBAR(n) (CCSRBAR_VA + 0xc08 + 0x10 * (n)) -#define OCP85XX_LAWSR(n) (CCSRBAR_VA + 0xc10 + 0x10 * (n)) -#endif +#define OCP85XX_LAWSR_85XX(n) (CCSRBAR_VA + 0xc10 + 0x10 * (n)) +#define OCP85XX_LAWSR(n) (mpc85xx_is_qoriq() ? OCP85XX_LAWSR_QORIQ(n) : \ + OCP85XX_LAWSR_85XX(n)) /* Attribute register */ #define OCP85XX_ENA_MASK 0x80000000 #define OCP85XX_DIS_MASK 0x7fffffff -#if defined(QORIQ_DPAA) -#define OCP85XX_TGTIF_LBC 0x1f -#define OCP85XX_TGTIF_RAM_INTL 0x14 -#define OCP85XX_TGTIF_RAM1 0x10 -#define OCP85XX_TGTIF_RAM2 0x11 -#define OCP85XX_TGTIF_BMAN 0x18 -#define OCP85XX_TGTIF_DCSR 0x1D -#define OCP85XX_TGTIF_QMAN 0x3C -#define OCP85XX_TRGT_SHIFT 20 -#else -#define OCP85XX_TGTIF_LBC 0x04 -#define OCP85XX_TGTIF_RAM_INTL 0x0b -#define OCP85XX_TGTIF_RIO 0x0c -#define OCP85XX_TGTIF_RAM1 0x0f -#define OCP85XX_TGTIF_RAM2 0x16 -#endif +#define OCP85XX_TGTIF_LBC_QORIQ 0x1f +#define OCP85XX_TGTIF_RAM_INTL_QORIQ 0x14 +#define OCP85XX_TGTIF_RAM1_QORIQ 0x10 +#define OCP85XX_TGTIF_RAM2_QORIQ 0x11 +#define OCP85XX_TGTIF_BMAN 0x18 +#define OCP85XX_TGTIF_DCSR 0x1D +#define OCP85XX_TGTIF_QMAN 0x3C +#define OCP85XX_TRGT_SHIFT_QORIQ 20 + +#define OCP85XX_TGTIF_LBC_85XX 0x04 +#define OCP85XX_TGTIF_RAM_INTL_85XX 0x0b +#define OCP85XX_TGTIF_RIO_85XX 0x0c +#define OCP85XX_TGTIF_RAM1_85XX 0x0f +#define OCP85XX_TGTIF_RAM2_85XX 0x16 + +#define OCP85XX_TGTIF_LBC \ + (mpc85xx_is_qoriq() ? OCP85XX_TGTIF_LBC_QORIQ : OCP85XX_TGTIF_LBC_85XX) +#define OCP85XX_TGTIF_RAM_INTL \ + (mpc85xx_is_qoriq() ? OCP85XX_TGTIF_RAM_INTL_QORIQ : OCP85XX_TGTIF_RAM_INTL_85XX) +#define OCP85XX_TGTIF_RIO \ + (mpc85xx_is_qoriq() ? OCP85XX_TGTIF_RIO_QORIQ : OCP85XX_TGTIF_RIO_85XX) +#define OCP85XX_TGTIF_RAM1 \ + (mpc85xx_is_qoriq() ? OCP85XX_TGTIF_RAM1_QORIQ : OCP85XX_TGTIF_RAM1_85XX) +#define OCP85XX_TGTIF_RAM2 \ + (mpc85xx_is_qoriq() ? OCP85XX_TGTIF_RAM2_QORIQ : OCP85XX_TGTIF_RAM2_85XX) /* * L2 cache registers @@ -153,5 +161,6 @@ int mpc85xx_attach(platform_t); void mpc85xx_enable_l3_cache(void); void mpc85xx_fix_errata(vm_offset_t); void dataloss_erratum_access(vm_offset_t, uint32_t); +int mpc85xx_is_qoriq(void); #endif /* _MPC85XX_H_ */ Modified: stable/11/sys/powerpc/mpc85xx/pci_mpc85xx.c ============================================================================== --- stable/11/sys/powerpc/mpc85xx/pci_mpc85xx.c Thu Dec 22 18:30:29 2016 (r310426) +++ stable/11/sys/powerpc/mpc85xx/pci_mpc85xx.c Thu Dec 22 20:16:10 2016 (r310427) @@ -655,7 +655,8 @@ fsl_pcib_inbound(struct fsl_pcib_softc * switch (tgt) { /* XXX OCP85XX_TGTIF_RAM2, OCP85XX_TGTIF_RAM_INTL should be handled */ - case OCP85XX_TGTIF_RAM1: + case OCP85XX_TGTIF_RAM1_85XX: + case OCP85XX_TGTIF_RAM1_QORIQ: attr = 0xa0f55000 | (ffsl(size) - 2); break; default: Modified: stable/11/sys/powerpc/mpc85xx/platform_mpc85xx.c ============================================================================== --- stable/11/sys/powerpc/mpc85xx/platform_mpc85xx.c Thu Dec 22 18:30:29 2016 (r310426) +++ stable/11/sys/powerpc/mpc85xx/platform_mpc85xx.c Thu Dec 22 20:16:10 2016 (r310427) @@ -258,16 +258,17 @@ mpc85xx_timebase_freq(platform_t plat, s sizeof(freq)) <= 0) goto out; + if (freq == 0) + goto out; + /* * Time Base and Decrementer are updated every 8 CCB bus clocks. * HID0[SEL_TBCLK] = 0 */ - if (freq != 0) -#ifdef QORIQ_DPAA + if (mpc85xx_is_qoriq()) ticks = freq / 32; -#else + else ticks = freq / 8; -#endif out: if (ticks <= 0) @@ -324,24 +325,24 @@ mpc85xx_smp_start_cpu(platform_t plat, s int timeout; uintptr_t brr; int cpuid; - -#ifdef QORIQ_DPAA uint32_t tgt; - reg = ccsr_read4(OCP85XX_COREDISR); - cpuid = pc->pc_cpuid; - - if ((reg & cpuid) != 0) { - printf("%s: CPU %d is disabled!\n", __func__, pc->pc_cpuid); - return (-1); + if (mpc85xx_is_qoriq()) { + reg = ccsr_read4(OCP85XX_COREDISR); + cpuid = pc->pc_cpuid; + + if ((reg & (1 << cpuid)) != 0) { + printf("%s: CPU %d is disabled!\n", __func__, pc->pc_cpuid); + return (-1); + } + + brr = OCP85XX_BRR; + } else { + brr = OCP85XX_EEBPCR; + cpuid = pc->pc_cpuid + 24; } - - brr = OCP85XX_BRR; -#else /* QORIQ_DPAA */ - brr = OCP85XX_EEBPCR; - cpuid = pc->pc_cpuid + 24; -#endif bp_kernload = kernload; + reg = ccsr_read4(brr); if ((reg & (1 << cpuid)) != 0) { printf("SMP: CPU %d already out of hold-off state!\n", @@ -358,55 +359,52 @@ mpc85xx_smp_start_cpu(platform_t plat, s bptr = ((vm_paddr_t)(uintptr_t)__boot_page - KERNBASE) + kernload; KASSERT((bptr & 0xfff) == 0, ("%s: boot page is not aligned (%#jx)", __func__, (uintmax_t)bptr)); -#ifdef QORIQ_DPAA - - /* - * Read DDR controller configuration to select proper BPTR target ID. - * - * On P5020 bit 29 of DDR1_CS0_CONFIG enables DDR controllers - * interleaving. If this bit is set, we have to use - * OCP85XX_TGTIF_RAM_INTL as BPTR target ID. On other QorIQ DPAA SoCs, - * this bit is reserved and always 0. - */ - - reg = ccsr_read4(OCP85XX_DDR1_CS0_CONFIG); - if (reg & (1 << 29)) - tgt = OCP85XX_TGTIF_RAM_INTL; - else - tgt = OCP85XX_TGTIF_RAM1; - - /* - * Set BSTR to the physical address of the boot page - */ - ccsr_write4(OCP85XX_BSTRH, bptr >> 32); - ccsr_write4(OCP85XX_BSTRL, bptr); - ccsr_write4(OCP85XX_BSTAR, OCP85XX_ENA_MASK | - (tgt << OCP85XX_TRGT_SHIFT) | (ffsl(PAGE_SIZE) - 2)); - - /* Read back OCP85XX_BSTAR to synchronize write */ - ccsr_read4(OCP85XX_BSTAR); - - /* - * Enable and configure time base on new CPU. - */ - - /* Set TB clock source to platform clock / 32 */ - reg = ccsr_read4(CCSR_CTBCKSELR); - ccsr_write4(CCSR_CTBCKSELR, reg & ~(1 << pc->pc_cpuid)); - - /* Enable TB */ - reg = ccsr_read4(CCSR_CTBENR); - ccsr_write4(CCSR_CTBENR, reg | (1 << pc->pc_cpuid)); -#else - - /* - * Set BPTR to the physical address of the boot page - */ - bptr = (bptr >> 12) | 0x80000000u; - ccsr_write4(OCP85XX_BPTR, bptr); - __asm __volatile("isync; msync"); - -#endif /* QORIQ_DPAA */ + if (mpc85xx_is_qoriq()) { + /* + * Read DDR controller configuration to select proper BPTR target ID. + * + * On P5020 bit 29 of DDR1_CS0_CONFIG enables DDR controllers + * interleaving. If this bit is set, we have to use + * OCP85XX_TGTIF_RAM_INTL as BPTR target ID. On other QorIQ DPAA SoCs, + * this bit is reserved and always 0. + */ + + reg = ccsr_read4(OCP85XX_DDR1_CS0_CONFIG); + if (reg & (1 << 29)) + tgt = OCP85XX_TGTIF_RAM_INTL; + else + tgt = OCP85XX_TGTIF_RAM1; + + /* + * Set BSTR to the physical address of the boot page + */ + ccsr_write4(OCP85XX_BSTRH, bptr >> 32); + ccsr_write4(OCP85XX_BSTRL, bptr); + ccsr_write4(OCP85XX_BSTAR, OCP85XX_ENA_MASK | + (tgt << OCP85XX_TRGT_SHIFT_QORIQ) | (ffsl(PAGE_SIZE) - 2)); + + /* Read back OCP85XX_BSTAR to synchronize write */ + ccsr_read4(OCP85XX_BSTAR); + + /* + * Enable and configure time base on new CPU. + */ + + /* Set TB clock source to platform clock / 32 */ + reg = ccsr_read4(CCSR_CTBCKSELR); + ccsr_write4(CCSR_CTBCKSELR, reg & ~(1 << pc->pc_cpuid)); + + /* Enable TB */ + reg = ccsr_read4(CCSR_CTBENR); + ccsr_write4(CCSR_CTBENR, reg | (1 << pc->pc_cpuid)); + } else { + /* + * Set BPTR to the physical address of the boot page + */ + bptr = (bptr >> 12) | 0x80000000u; + ccsr_write4(OCP85XX_BPTR, bptr); + __asm __volatile("isync; msync"); + } /* * Release AP from hold-off state @@ -424,15 +422,14 @@ mpc85xx_smp_start_cpu(platform_t plat, s * address (= 0xfffff000) isn't permanently remapped and thus not * usable otherwise. */ -#ifdef QORIQ_DPAA - ccsr_write4(OCP85XX_BSTAR, 0); -#else - ccsr_write4(OCP85XX_BPTR, 0); -#endif + if (mpc85xx_is_qoriq()) + ccsr_write4(OCP85XX_BSTAR, 0); + else + ccsr_write4(OCP85XX_BPTR, 0); __asm __volatile("isync; msync"); if (!pc->pc_awake) - printf("SMP: CPU %d didn't wake up.\n", pc->pc_cpuid); + panic("SMP: CPU %d didn't wake up.\n", pc->pc_cpuid); return ((pc->pc_awake) ? 0 : EBUSY); #else /* No SMP support */ @@ -469,33 +466,32 @@ mpc85xx_reset(platform_t plat) static void mpc85xx_idle(platform_t plat, int cpu) { -#ifdef QORIQ_DPAA uint32_t reg; - reg = ccsr_read4(OCP85XX_RCPM_CDOZCR); - ccsr_write4(OCP85XX_RCPM_CDOZCR, reg | (1 << cpu)); - ccsr_read4(OCP85XX_RCPM_CDOZCR); -#else - register_t msr; - - msr = mfmsr(); - /* Freescale E500 core RM section 6.4.1. */ - __asm __volatile("msync; mtmsr %0; isync" :: - "r" (msr | PSL_WE)); -#endif + if (mpc85xx_is_qoriq()) { + reg = ccsr_read4(OCP85XX_RCPM_CDOZCR); + ccsr_write4(OCP85XX_RCPM_CDOZCR, reg | (1 << cpu)); + ccsr_read4(OCP85XX_RCPM_CDOZCR); + } else { + reg = mfmsr(); + /* Freescale E500 core RM section 6.4.1. */ + __asm __volatile("msync; mtmsr %0; isync" :: + "r" (reg | PSL_WE)); + } } static int mpc85xx_idle_wakeup(platform_t plat, int cpu) { -#ifdef QORIQ_DPAA uint32_t reg; - reg = ccsr_read4(OCP85XX_RCPM_CDOZCR); - ccsr_write4(OCP85XX_RCPM_CDOZCR, reg & ~(1 << cpu)); - ccsr_read4(OCP85XX_RCPM_CDOZCR); + if (mpc85xx_is_qoriq()) { + reg = ccsr_read4(OCP85XX_RCPM_CDOZCR); + ccsr_write4(OCP85XX_RCPM_CDOZCR, reg & ~(1 << cpu)); + ccsr_read4(OCP85XX_RCPM_CDOZCR); + + return (1); + } - return (1); -#endif return (0); } From owner-svn-src-all@freebsd.org Thu Dec 22 20:28:07 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 77504C8CEF7; Thu, 22 Dec 2016 20:28:07 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 470741E2F; Thu, 22 Dec 2016 20:28:07 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBMKS6fQ025290; Thu, 22 Dec 2016 20:28:06 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBMKS6VO025289; Thu, 22 Dec 2016 20:28:06 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201612222028.uBMKS6VO025289@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Thu, 22 Dec 2016 20:28:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310428 - head/sys/mips/malta X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Dec 2016 20:28:07 -0000 Author: jhb Date: Thu Dec 22 20:28:06 2016 New Revision: 310428 URL: https://svnweb.freebsd.org/changeset/base/310428 Log: Fix dump_avail[] for MALTA platforms to include the kernel. dump_avail[] is supposed to be a superset of phys_avail[] that describes all of the memory ranges that should be included in a full dump. minidumps don't consider pages described by dump_avail[] to be valid and thus they are excluded via the is_dumpable() function. Most MIPS platforms (including MALTA) set dump_avail[] to be identical to phys_avail[]. In particular, phys_avail[] doesn't include the kernel itself, so pages for the kernel and it's global variables are not considered dumpable and not included in the dump. Fix this by setting dump_avail[0] to the first memory address (0) rather than the end of the kernel. Several other MIPS platforms have the same bug, though I am only able to test malta in qemu. The correct fix is to set dump_avail[] to describe RAM and in particular to not set dump_avail[0] to the end of the kernel (kernel_kseg0_end). Sponsored by: DARPA / AFRL Modified: head/sys/mips/malta/malta_machdep.c Modified: head/sys/mips/malta/malta_machdep.c ============================================================================== --- head/sys/mips/malta/malta_machdep.c Thu Dec 22 20:16:10 2016 (r310427) +++ head/sys/mips/malta/malta_machdep.c Thu Dec 22 20:28:06 2016 (r310428) @@ -191,7 +191,7 @@ mips_init(unsigned long memsize, uint64_ /* phys_avail regions are in bytes */ phys_avail[0] = MIPS_KSEG0_TO_PHYS(kernel_kseg0_end); phys_avail[1] = memsize; - dump_avail[0] = phys_avail[0]; + dump_avail[0] = 0; dump_avail[1] = phys_avail[1]; /* Only specify the extended region if it's set */ From owner-svn-src-all@freebsd.org Thu Dec 22 20:56:09 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D37BAC8D684; Thu, 22 Dec 2016 20:56:09 +0000 (UTC) (envelope-from carpeddiem@gmail.com) Received: from mail-it0-x243.google.com (mail-it0-x243.google.com [IPv6:2607:f8b0:4001:c0b::243]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 9CECAEEB; Thu, 22 Dec 2016 20:56:09 +0000 (UTC) (envelope-from carpeddiem@gmail.com) Received: by mail-it0-x243.google.com with SMTP id 75so22150773ite.1; Thu, 22 Dec 2016 12:56:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=+g3LzCztI93SwgwiiP7+DQhW2SHsYrGkNU8PDZCPXSY=; b=cn2Vyy3Bu956JQAyMR1ZnyFY5IcGk2LszZ+m3mT2u2IkYwNbzwG4oyhQtCS5dfvE6R 7KFETpXOtzehH5lB3ATdq4SuFyEuayqEOSTcwFejINzxvNqmeqD0RaiELMkghbJ//uuJ 3IoDlmdXu4bSCXYfHPDy20MEeD5foe43w0+VMFMIvhE7aXPF8FLXL0up1OOU+nTqFM2e jxEZTXAkCFg5jv85yxgh/wAZqdvalHJpqWROmbGXKgquQVSz+Gs4KuJdQWyftqhx/vRM ra9SjR2xS77SJTb5ISJzatZRro2f2zekX3eWU50sntLJgts3vetK9T/WLRSztri2KCuF +cNQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=+g3LzCztI93SwgwiiP7+DQhW2SHsYrGkNU8PDZCPXSY=; b=H5nshCL4BqO6bvkS+g8FoF/gtUepljF8A1j7wbPaCY25U/BieRSxluaWj48uE868dX GAAyPdwS6qtGStotkDJqpakFqiEOh4frtdkzvQiDpzPhFC8Tm1bdyrEKXv+/3r5vsaJK gImX70dH+qDh8k6/b5z98mNoDZ5use62EimnP7b5iWv/vggbgIQwQDuTiE5w9lObRvl5 4VKvkfA8GYsw5AUTHMw06rPptLBG43uUsyRr9QSa9CcijzBY4UPihKgi8qhe7o4s7eTT vFIjvBLsKZZpf7O/6x8b6lAugPdLFs+b5gOA+CbsgdmfZ5aGDj5A84cQ5Zff2lEyKgUX Pu7Q== X-Gm-Message-State: AIkVDXJ9nmPwTpXg90M1tlhnMIaUILngbwlnZ1teweWWQ6Sg2iqrbndaXkamkQdygYfeaD8Z7yqtUwzYuOu8LQ== X-Received: by 10.36.77.5 with SMTP id l5mr11485066itb.83.1482440168743; Thu, 22 Dec 2016 12:56:08 -0800 (PST) MIME-Version: 1.0 Sender: carpeddiem@gmail.com Received: by 10.107.175.133 with HTTP; Thu, 22 Dec 2016 12:55:48 -0800 (PST) In-Reply-To: References: <201612221826.uBMIQLFQ076247@repo.freebsd.org> From: Ed Maste Date: Thu, 22 Dec 2016 15:55:48 -0500 X-Google-Sender-Auth: lrygBWPj69TyYGuXRcHIAiHhKio Message-ID: Subject: Re: svn commit: r310425 - in head/sys/dev/mlx4: mlx4_core mlx4_ib To: Pedro Giffuni Cc: "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" Content-Type: text/plain; charset=UTF-8 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Dec 2016 20:56:09 -0000 On 22 December 2016 at 15:09, Pedro Giffuni wrote: > > On 22/12/2016 13:26, Ed Maste wrote: >> >> Author: emaste >> Date: Thu Dec 22 18:26:21 2016 >> New Revision: 310425 >> URL: https://svnweb.freebsd.org/changeset/base/310425 >> >> Log: >> mlx: avoid use of __DATE__ to make build reproducible >> Reviewed by: hselasky >> Differential Revision: https://reviews.freebsd.org/D8886 > > Hmm ... > Sadly opengrok[*] reveals many uses of __DATE__. Many of these are not an issue for a reproducible base system though: they're in comments, in source under tools/ or contrib code that's not built, or are the implementation of __DATE__ support in some compiler or text processor. I believe that on amd64 it was only this now-removed instance in mlx(4) and the one in iasl (see https://reviews.freebsd.org/D8856) that affected base system reproducibility. > I am wondering if there is some way to have it replaced with the SVN Date > keyword. I don't like the idea of deriving it from an SVN keyword, since it then doesn't work for FreeBSD developers or downstream projects using git or other version control tools. The kernel version uniquely identifies the source from which it was built, and in my opinion it's preferable to just remove this sort of metadata. Here I went with just pinning it to the last date the src was updated as this vendor code and produces a user-facing string, but perhaps Mellanox can be convinced to just remove the DRV_RELDATE. Posted in https://reviews.freebsd.org/D8888. From owner-svn-src-all@freebsd.org Thu Dec 22 20:58:00 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 215BAC8D701; Thu, 22 Dec 2016 20:58:00 +0000 (UTC) (envelope-from carpeddiem@gmail.com) Received: from mail-it0-x241.google.com (mail-it0-x241.google.com [IPv6:2607:f8b0:4001:c0b::241]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id DABDA10A9; Thu, 22 Dec 2016 20:57:59 +0000 (UTC) (envelope-from carpeddiem@gmail.com) Received: by mail-it0-x241.google.com with SMTP id 75so22155208ite.1; Thu, 22 Dec 2016 12:57:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=PVB9KJGh5Wbdjqs4OQvpwhhJ8sJHWWMLBMljR7+9E28=; b=Zn5nEnJKQUwjswkLRAkz+Lq6leyTw7AK+2hpvKwFhRwZ2XiIxwBU4i2/ok1ywYFFdc EywbFvLHHm9uD5i86t1SzYZtE1+fxlYH2wxfx0cwvTi3DyPpFTBuVNtT42dAWqU2mZDz nYVvzFbbhey15WEdwvu6OG4NjhV24/rirVWcZbwippcgS9ivKPLj3H3sQ55iPTKyYmIz HiY6QxHJxlPbZB7uUh2i6f5Ba25u7Oeb8BoK/PYxZzTKlfX0zpvSz7XRGEHJeV7YiMkZ AdNcCsDLCDMyncMP9ZrQzjCv1L7Wq4jTUODiKGjnFQrCdLTfusFaHUVKy2veqyJ+YdJk APjw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=PVB9KJGh5Wbdjqs4OQvpwhhJ8sJHWWMLBMljR7+9E28=; b=ufzKc3Ucep+TEpwujpDRsxxF5381bVTKf1vRTsIMWBPW5DFP0ZobbEASL8zfdOI+V8 CQFs5pOo54JGzn3QkdXdMuCCi0Hn1uGUbgkqcbDnZ5ntTfhDNpszYqCjv4ccK0mOYPm0 hKyXuvGpEl/eWDN0XuNtSI3HcDGI7MZ6FKcFPzpEX1ufgSkc3OjhPPvqjSsJSxWtxYSJ t6QmzVEPRHWPzWozuqot/lbpkf1hhpjQ683YuuMV1Hedby4u1YIfms1VMRqrbSv6hOBL YFVopCXun74Hkol/kyfkft7a/Mxjba+WWc2O7cadGVUM3vC+4EYWOqb7itBieElMCseD EBLg== X-Gm-Message-State: AIkVDXLjaTQtOGmgoQWYPKq2oGKUhol5Z3PgveR9IkF4nlFzdUv5sJK3tUbsgQgcWsToXjCVMBv/axcPw6I/fw== X-Received: by 10.36.108.17 with SMTP id w17mr10919103itb.108.1482440279381; Thu, 22 Dec 2016 12:57:59 -0800 (PST) MIME-Version: 1.0 Sender: carpeddiem@gmail.com Received: by 10.107.175.133 with HTTP; Thu, 22 Dec 2016 12:57:38 -0800 (PST) In-Reply-To: References: <201612221826.uBMIQLFQ076247@repo.freebsd.org> From: Ed Maste Date: Thu, 22 Dec 2016 15:57:38 -0500 X-Google-Sender-Auth: ZwTEFqFcPnM_izyqToo7yTj8szA Message-ID: Subject: Re: svn commit: r310425 - in head/sys/dev/mlx4: mlx4_core mlx4_ib To: Ed Schouten Cc: src-committers , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" Content-Type: text/plain; charset=UTF-8 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Dec 2016 20:58:00 -0000 On 22 December 2016 at 14:44, Ed Schouten wrote: > 2016-12-22 19:26 GMT+01:00 Ed Maste : >> Log: >> mlx: avoid use of __DATE__ to make build reproducible > > Out of curiosity, are we planning on adding -Wdate-time or > -Werror=date-time to our default CFLAGS? If so, awesome! I hadn't thought of it, but good idea. Maybe something like this for now: --- a/share/mk/bsd.sys.mk +++ b/share/mk/bsd.sys.mk @@ -88,6 +88,9 @@ CWARNFLAGS.clang+= -Wno-parentheses .if defined(NO_WARRAY_BOUNDS) CWARNFLAGS.clang+= -Wno-array-bounds .endif # NO_WARRAY_BOUNDS +.if ${MK_REPRODUCIBLE_BUILD} != no +CWARNFLAGS.clang+= -Wdate-time +.endif # MK_REPRODUCIBLE_BUILD .endif # WARNS From owner-svn-src-all@freebsd.org Thu Dec 22 21:01:57 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5BB30C8D8A9; Thu, 22 Dec 2016 21:01:57 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 1BD0E155A; Thu, 22 Dec 2016 21:01:57 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBML1uBk040639; Thu, 22 Dec 2016 21:01:56 GMT (envelope-from adrian@FreeBSD.org) Received: (from adrian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBML1uFn040638; Thu, 22 Dec 2016 21:01:56 GMT (envelope-from adrian@FreeBSD.org) Message-Id: <201612222101.uBML1uFn040638@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: adrian set sender to adrian@FreeBSD.org using -f From: Adrian Chadd Date: Thu, 22 Dec 2016 21:01:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310429 - head/sys/dev/usb/wlan X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Dec 2016 21:01:57 -0000 Author: adrian Date: Thu Dec 22 21:01:56 2016 New Revision: 310429 URL: https://svnweb.freebsd.org/changeset/base/310429 Log: [rsu] convert rsu to use the ieee80211_rx_stats struct to pass up RSSI, PHY and rate information. I don't yet know which RX descriptor bits map to shortgi, long-gi, short-preamble, long-preamble, STBC, LDPC, HT40, etc - so I can't easily add those just yet. There's apparently no per-frame RX RSSI information exposed so we also just use the results from the previous calibration task. This also tidies up how the per-mbuf RSSI is pushed into the frame - now that it's attached to the mbuf via rx_stats, we don't have to do any silly hijinx to get it out of the frame processing path. Tested: * RTL8712, 1x1 cut 3, STA mode Modified: head/sys/dev/usb/wlan/if_rsu.c Modified: head/sys/dev/usb/wlan/if_rsu.c ============================================================================== --- head/sys/dev/usb/wlan/if_rsu.c Thu Dec 22 20:28:06 2016 (r310428) +++ head/sys/dev/usb/wlan/if_rsu.c Thu Dec 22 21:01:56 2016 (r310429) @@ -238,8 +238,7 @@ static struct mbuf * rsu_rx_copy_to_mbuf struct r92s_rx_stat *, int); static uint32_t rsu_get_tsf_low(struct rsu_softc *); static uint32_t rsu_get_tsf_high(struct rsu_softc *); -static struct ieee80211_node * rsu_rx_frame(struct rsu_softc *, struct mbuf *, - int8_t *); +static struct ieee80211_node * rsu_rx_frame(struct rsu_softc *, struct mbuf *); static struct mbuf * rsu_rx_multi_frame(struct rsu_softc *, uint8_t *, int); static struct mbuf * rsu_rxeof(struct usb_xfer *, struct rsu_data *); @@ -2344,14 +2343,16 @@ rsu_get_tsf_high(struct rsu_softc *sc) } static struct ieee80211_node * -rsu_rx_frame(struct rsu_softc *sc, struct mbuf *m, int8_t *rssi_p) +rsu_rx_frame(struct rsu_softc *sc, struct mbuf *m) { struct ieee80211com *ic = &sc->sc_ic; struct ieee80211_frame_min *wh; + struct ieee80211_rx_stats rxs; struct r92s_rx_stat *stat; uint32_t rxdw0, rxdw3; uint8_t cipher, rate; int infosz; + int rssi; stat = mtod(m, struct r92s_rx_stat *); rxdw0 = le32toh(stat->rxdw0); @@ -2363,10 +2364,10 @@ rsu_rx_frame(struct rsu_softc *sc, struc /* Get RSSI from PHY status descriptor if present. */ if (infosz != 0 && (rxdw0 & R92S_RXDW0_PHYST)) - *rssi_p = rsu_get_rssi(sc, rate, &stat[1]); + rssi = rsu_get_rssi(sc, rate, &stat[1]); else { /* Cheat and get the last calibrated RSSI */ - *rssi_p = rsu_hwrssi_to_rssi(sc, sc->sc_currssi); + rssi = rsu_hwrssi_to_rssi(sc, sc->sc_currssi); } if (ieee80211_radiotap_active(ic)) { @@ -2402,7 +2403,7 @@ rsu_rx_frame(struct rsu_softc *sc, struc tap->wr_rate = 0x80 | (rate - 12); } - tap->wr_dbm_antsignal = *rssi_p; + tap->wr_dbm_antsignal = rssi; tap->wr_chan_freq = htole16(ic->ic_curchan->ic_freq); tap->wr_chan_flags = htole16(ic->ic_curchan->ic_flags); }; @@ -2441,6 +2442,78 @@ rsu_rx_frame(struct rsu_softc *sc, struc } } + /* RX flags */ + + /* Set channel flags for input path */ + bzero(&rxs, sizeof(rxs)); + + /* normal RSSI */ + rxs.r_flags |= IEEE80211_R_NF | IEEE80211_R_RSSI; + rxs.c_rssi = rssi; + rxs.c_nf = -96; + + /* Rate */ + if (!(rxdw3 & R92S_RXDW3_HTC)) { + switch (rate) { + /* CCK. */ + case 0: + rxs.c_rate = 2; + rxs.c_pktflags |= IEEE80211_RX_F_CCK; + break; + case 1: + rxs.c_rate = 4; + rxs.c_pktflags |= IEEE80211_RX_F_CCK; + break; + case 2: + rxs.c_rate = 11; + rxs.c_pktflags |= IEEE80211_RX_F_CCK; + break; + case 3: + rxs.c_rate = 22; + rxs.c_pktflags |= IEEE80211_RX_F_CCK; + break; + /* OFDM. */ + case 4: + rxs.c_rate = 12; + rxs.c_pktflags |= IEEE80211_RX_F_OFDM; + break; + case 5: + rxs.c_rate = 18; + rxs.c_pktflags |= IEEE80211_RX_F_OFDM; + break; + case 6: + rxs.c_rate = 24; + rxs.c_pktflags |= IEEE80211_RX_F_OFDM; + break; + case 7: + rxs.c_rate = 36; + rxs.c_pktflags |= IEEE80211_RX_F_OFDM; + break; + case 8: + rxs.c_rate = 48; + rxs.c_pktflags |= IEEE80211_RX_F_OFDM; + break; + case 9: + rxs.c_rate = 72; + rxs.c_pktflags |= IEEE80211_RX_F_OFDM; + break; + case 10: + rxs.c_rate = 96; + rxs.c_pktflags |= IEEE80211_RX_F_OFDM; + break; + case 11: + rxs.c_rate = 108; + rxs.c_pktflags |= IEEE80211_RX_F_OFDM; + break; + } + } else if (rate >= 12) { /* MCS0~15. */ + /* Bit 7 set means HT MCS instead of rate. */ + rxs.c_rate = (rate - 12); + rxs.c_pktflags |= IEEE80211_RX_F_HT; + } + + (void) ieee80211_add_rx_params(m, &rxs); + /* Drop descriptor. */ m_adj(m, sizeof(*stat) + infosz); wh = mtod(m, struct ieee80211_frame_min *); @@ -2550,7 +2623,6 @@ rsu_bulk_rx_callback(struct usb_xfer *xf struct ieee80211_node *ni; struct mbuf *m = NULL, *next; struct rsu_data *data; - int8_t rssi; RSU_ASSERT_LOCKED(sc); @@ -2584,16 +2656,16 @@ tr_setup: next = m->m_next; m->m_next = NULL; - ni = rsu_rx_frame(sc, m, &rssi); + ni = rsu_rx_frame(sc, m); RSU_UNLOCK(sc); if (ni != NULL) { if (ni->ni_flags & IEEE80211_NODE_HT) m->m_flags |= M_AMPDU; - (void)ieee80211_input(ni, m, rssi, -96); + (void)ieee80211_input_mimo(ni, m); ieee80211_free_node(ni); } else - (void)ieee80211_input_all(ic, m, rssi, -96); + (void)ieee80211_input_mimo_all(ic, m); RSU_LOCK(sc); m = next; From owner-svn-src-all@freebsd.org Thu Dec 22 21:11:43 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5CC9AC8DB72; Thu, 22 Dec 2016 21:11:43 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 2591B19F5; Thu, 22 Dec 2016 21:11:43 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBMLBg4M043376; Thu, 22 Dec 2016 21:11:42 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBMLBgi3043375; Thu, 22 Dec 2016 21:11:42 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201612222111.uBMLBgi3043375@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Thu, 22 Dec 2016 21:11:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310430 - head/sys/conf X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Dec 2016 21:11:43 -0000 Author: ian Date: Thu Dec 22 21:11:42 2016 New Revision: 310430 URL: https://svnweb.freebsd.org/changeset/base/310430 Log: Use ${.OBJDIR} to refer to the kernel build object dir, instead of trying to recreate it from ${MAKEOBJDIRPREFIX} and ${SRC_BASE} and ${KERNCONF}, the latter being especially problematic when KERNCONF is set to the names of multiple kernel configs. Modified: head/sys/conf/kern.post.mk Modified: head/sys/conf/kern.post.mk ============================================================================== --- head/sys/conf/kern.post.mk Thu Dec 22 21:01:56 2016 (r310429) +++ head/sys/conf/kern.post.mk Thu Dec 22 21:11:42 2016 (r310430) @@ -63,7 +63,7 @@ OSRELDATE!= awk '/^\#define[[:space:]]*_ ${MAKEOBJDIRPREFIX}${SRC_BASE}/include/osreldate.h .endif # Keep the related ports builds in the obj directory so that they are only rebuilt once per kernel build -WRKDIRPREFIX?= ${MAKEOBJDIRPREFIX}${SRC_BASE}/sys/${KERNCONF} +WRKDIRPREFIX?= ${.OBJDIR} PORTSMODULESENV=\ env \ -u CC \ From owner-svn-src-all@freebsd.org Thu Dec 22 21:29:59 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2FF51C8D119; Thu, 22 Dec 2016 21:29:59 +0000 (UTC) (envelope-from gonzo@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 0A5B16D0; Thu, 22 Dec 2016 21:29:58 +0000 (UTC) (envelope-from gonzo@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBMLTwdM050027; Thu, 22 Dec 2016 21:29:58 GMT (envelope-from gonzo@FreeBSD.org) Received: (from gonzo@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBMLTvXd050022; Thu, 22 Dec 2016 21:29:57 GMT (envelope-from gonzo@FreeBSD.org) Message-Id: <201612222129.uBMLTvXd050022@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gonzo set sender to gonzo@FreeBSD.org using -f From: Oleksandr Tymoshenko Date: Thu, 22 Dec 2016 21:29:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r310431 - in stable/11/sys/dev: evdev syscons vt X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Dec 2016 21:29:59 -0000 Author: gonzo Date: Thu Dec 22 21:29:57 2016 New Revision: 310431 URL: https://svnweb.freebsd.org/changeset/base/310431 Log: MFC r309823: [evdev] Adds evdev support to sysmouse(4) driver For horizontal (T-axis) wheel reporting which is not supported by sysmouse protocol kern.evdev.sysmouse_t_axis sysctl is introduced. It can take following values: 0 - no T-axis events (default) 1 - T-axis events are originated in ums(4) driver. 2 - T-axis events are originated in psm(4) driver. Submitted by: Vladimir Kondratiev Differential Revision: https://reviews.freebsd.org/D8597 Modified: stable/11/sys/dev/evdev/evdev.c stable/11/sys/dev/evdev/evdev.h stable/11/sys/dev/syscons/sysmouse.c stable/11/sys/dev/vt/vt_sysmouse.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/evdev/evdev.c ============================================================================== --- stable/11/sys/dev/evdev/evdev.c Thu Dec 22 21:11:42 2016 (r310430) +++ stable/11/sys/dev/evdev/evdev.c Thu Dec 22 21:29:57 2016 (r310431) @@ -63,11 +63,14 @@ enum evdev_sparse_result MALLOC_DEFINE(M_EVDEV, "evdev", "evdev memory"); int evdev_rcpt_mask = EVDEV_RCPT_SYSMOUSE | EVDEV_RCPT_KBDMUX; +int evdev_sysmouse_t_axis = 0; SYSCTL_NODE(_kern, OID_AUTO, evdev, CTLFLAG_RW, 0, "Evdev args"); SYSCTL_INT(_kern_evdev, OID_AUTO, rcpt_mask, CTLFLAG_RW, &evdev_rcpt_mask, 0, "Who is receiving events: bit0 - sysmouse, bit1 - kbdmux, " "bit2 - mouse hardware, bit3 - keyboard hardware"); +SYSCTL_INT(_kern_evdev, OID_AUTO, sysmouse_t_axis, CTLFLAG_RW, + &evdev_sysmouse_t_axis, 0, "Extract T-axis from 0-none, 1-ums, 2-psm"); static void evdev_start_repeat(struct evdev_dev *, uint16_t); static void evdev_stop_repeat(struct evdev_dev *); Modified: stable/11/sys/dev/evdev/evdev.h ============================================================================== --- stable/11/sys/dev/evdev/evdev.h Thu Dec 22 21:11:42 2016 (r310430) +++ stable/11/sys/dev/evdev/evdev.h Thu Dec 22 21:29:57 2016 (r310431) @@ -56,6 +56,22 @@ typedef void (evdev_keycode_t)(struct ev #define EVDEV_RCPT_HW_MOUSE (1<<2) #define EVDEV_RCPT_HW_KBD (1<<3) extern int evdev_rcpt_mask; +/* + * Sysmouse protocol does not support horizontal wheel movement reporting. + * To overcome this limitation different drivers use different sysmouse proto + * extensions. Set kern.evdev.sysmouse_t_axis to tell sysmouse evdev driver + * which protocol extension is used. + * 0 - do not extract horizontal wheel movement (default). + * 1 - ums(4) horizontal wheel encoding. T-axis is mapped to buttons 6 and 7 + * 2 - psm(4) wheels encoding: z = 1,-1 - vert. wheel, z = 2,-2 - horiz. wheel + */ +enum +{ + EVDEV_SYSMOUSE_T_AXIS_NONE = 0, + EVDEV_SYSMOUSE_T_AXIS_UMS = 1, + EVDEV_SYSMOUSE_T_AXIS_PSM = 2, +}; +extern int evdev_sysmouse_t_axis; #define ABS_MT_FIRST ABS_MT_TOUCH_MAJOR #define ABS_MT_LAST ABS_MT_TOOL_Y Modified: stable/11/sys/dev/syscons/sysmouse.c ============================================================================== --- stable/11/sys/dev/syscons/sysmouse.c Thu Dec 22 21:11:42 2016 (r310430) +++ stable/11/sys/dev/syscons/sysmouse.c Thu Dec 22 21:29:57 2016 (r310431) @@ -28,6 +28,7 @@ #include __FBSDID("$FreeBSD$"); +#include "opt_evdev.h" #include "opt_syscons.h" #include @@ -43,6 +44,11 @@ __FBSDID("$FreeBSD$"); #include +#ifdef EVDEV_SUPPORT +#include +#include +#endif + #ifndef SC_NO_SYSMOUSE /* local variables */ @@ -50,6 +56,72 @@ static struct tty *sysmouse_tty; static int mouse_level; /* sysmouse protocol level */ static mousestatus_t mouse_status; +#ifdef EVDEV_SUPPORT +static struct evdev_dev *sysmouse_evdev; + +static void +smdev_evdev_init(void) +{ + int i; + + sysmouse_evdev = evdev_alloc(); + evdev_set_name(sysmouse_evdev, "System mouse"); + evdev_set_phys(sysmouse_evdev, "sysmouse"); + evdev_set_id(sysmouse_evdev, BUS_VIRTUAL, 0, 0, 0); + evdev_support_prop(sysmouse_evdev, INPUT_PROP_POINTER); + evdev_support_event(sysmouse_evdev, EV_SYN); + evdev_support_event(sysmouse_evdev, EV_REL); + evdev_support_event(sysmouse_evdev, EV_KEY); + evdev_support_rel(sysmouse_evdev, REL_X); + evdev_support_rel(sysmouse_evdev, REL_Y); + evdev_support_rel(sysmouse_evdev, REL_WHEEL); + evdev_support_rel(sysmouse_evdev, REL_HWHEEL); + for (i = 0; i < 8; i++) + evdev_support_key(sysmouse_evdev, BTN_MOUSE + i); + if (evdev_register(sysmouse_evdev)) { + evdev_free(sysmouse_evdev); + sysmouse_evdev = NULL; + } +} + +static void +smdev_evdev_write(int x, int y, int z, int buttons) +{ + + if (sysmouse_evdev == NULL || !(evdev_rcpt_mask & EVDEV_RCPT_SYSMOUSE)) + return; + + evdev_push_event(sysmouse_evdev, EV_REL, REL_X, x); + evdev_push_event(sysmouse_evdev, EV_REL, REL_Y, y); + switch (evdev_sysmouse_t_axis) { + case EVDEV_SYSMOUSE_T_AXIS_PSM: + switch (z) { + case 1: + case -1: + evdev_push_rel(sysmouse_evdev, REL_WHEEL, -z); + break; + case 2: + case -2: + evdev_push_rel(sysmouse_evdev, REL_HWHEEL, z / 2); + break; + } + break; + case EVDEV_SYSMOUSE_T_AXIS_UMS: + /* XXX: Edge triggering should be used here */ + if (buttons & (1 << 5)) + evdev_push_rel(sysmouse_evdev, REL_HWHEEL, 1); + else if (buttons & (1 << 6)) + evdev_push_rel(sysmouse_evdev, REL_HWHEEL, -1); + /* PASSTHROUGH */ + case EVDEV_SYSMOUSE_T_AXIS_NONE: + default: + evdev_push_rel(sysmouse_evdev, REL_WHEEL, -z); + } + evdev_push_mouse_btn(sysmouse_evdev, buttons); + evdev_sync(sysmouse_evdev); +} +#endif + static void smdev_close(struct tty *tp) { @@ -170,6 +242,9 @@ sm_attach_mouse(void *unused) return; sysmouse_tty = tty_alloc(&smdev_ttydevsw, NULL); tty_makedev(sysmouse_tty, NULL, "sysmouse"); +#ifdef EVDEV_SUPPORT + smdev_evdev_init(); +#endif } SYSINIT(sysmouse, SI_SUB_DRIVERS, SI_ORDER_MIDDLE, sm_attach_mouse, NULL); @@ -220,7 +295,14 @@ sysmouse_event(mouse_info_t *info) mouse_status.flags |= ((x || y || z) ? MOUSE_POSCHANGED : 0) | (mouse_status.obutton ^ mouse_status.button); flags = mouse_status.flags; - if (flags == 0 || !tty_opened(sysmouse_tty)) + if (flags == 0) + goto done; + +#ifdef EVDEV_SUPPORT + smdev_evdev_write(x, y, z, mouse_status.button); +#endif + + if (!tty_opened(sysmouse_tty)) goto done; /* the first five bytes are compatible with MouseSystems' */ Modified: stable/11/sys/dev/vt/vt_sysmouse.c ============================================================================== --- stable/11/sys/dev/vt/vt_sysmouse.c Thu Dec 22 21:11:42 2016 (r310430) +++ stable/11/sys/dev/vt/vt_sysmouse.c Thu Dec 22 21:29:57 2016 (r310431) @@ -33,6 +33,8 @@ #include __FBSDID("$FreeBSD$"); +#include "opt_evdev.h" + #include #include #include @@ -50,6 +52,11 @@ __FBSDID("$FreeBSD$"); #include +#ifdef EVDEV_SUPPORT +#include +#include +#endif + static d_open_t sysmouse_open; static d_close_t sysmouse_close; static d_read_t sysmouse_read; @@ -81,6 +88,72 @@ static MALLOC_DEFINE(M_SYSMOUSE, "sysmou static unsigned char *sysmouse_buffer; static unsigned int sysmouse_start, sysmouse_length; +#ifdef EVDEV_SUPPORT +static struct evdev_dev *sysmouse_evdev; + +static void +sysmouse_evdev_init(void) +{ + int i; + + sysmouse_evdev = evdev_alloc(); + evdev_set_name(sysmouse_evdev, "System mouse"); + evdev_set_phys(sysmouse_evdev, "sysmouse"); + evdev_set_id(sysmouse_evdev, BUS_VIRTUAL, 0, 0, 0); + evdev_support_prop(sysmouse_evdev, INPUT_PROP_POINTER); + evdev_support_event(sysmouse_evdev, EV_SYN); + evdev_support_event(sysmouse_evdev, EV_REL); + evdev_support_event(sysmouse_evdev, EV_KEY); + evdev_support_rel(sysmouse_evdev, REL_X); + evdev_support_rel(sysmouse_evdev, REL_Y); + evdev_support_rel(sysmouse_evdev, REL_WHEEL); + evdev_support_rel(sysmouse_evdev, REL_HWHEEL); + for (i = 0; i < 8; i++) + evdev_support_key(sysmouse_evdev, BTN_MOUSE + i); + if (evdev_register(sysmouse_evdev)) { + evdev_free(sysmouse_evdev); + sysmouse_evdev = NULL; + } +} + +static void +sysmouse_evdev_store(int x, int y, int z, int buttons) +{ + + if (sysmouse_evdev == NULL || !(evdev_rcpt_mask & EVDEV_RCPT_SYSMOUSE)) + return; + + evdev_push_event(sysmouse_evdev, EV_REL, REL_X, x); + evdev_push_event(sysmouse_evdev, EV_REL, REL_Y, y); + switch (evdev_sysmouse_t_axis) { + case EVDEV_SYSMOUSE_T_AXIS_PSM: + switch (z) { + case 1: + case -1: + evdev_push_rel(sysmouse_evdev, REL_WHEEL, -z); + break; + case 2: + case -2: + evdev_push_rel(sysmouse_evdev, REL_HWHEEL, z / 2); + break; + } + break; + case EVDEV_SYSMOUSE_T_AXIS_UMS: + /* XXX: Edge triggering should be used here */ + if (buttons & (1 << 5)) + evdev_push_rel(sysmouse_evdev, REL_HWHEEL, 1); + else if (buttons & (1 << 6)) + evdev_push_rel(sysmouse_evdev, REL_HWHEEL, -1); + /* PASSTHROUGH */ + case EVDEV_SYSMOUSE_T_AXIS_NONE: + default: + evdev_push_rel(sysmouse_evdev, REL_WHEEL, -z); + } + evdev_push_mouse_btn(sysmouse_evdev, buttons); + evdev_sync(sysmouse_evdev); +} +#endif + static int sysmouse_buf_read(struct uio *uio, unsigned int length) { @@ -170,6 +243,9 @@ sysmouse_process_event(mouse_info_t *mi) if (sysmouse_status.flags == 0) goto done; +#ifdef EVDEV_SUPPORT + sysmouse_evdev_store(x, y, z, sysmouse_status.button); +#endif /* The first five bytes are compatible with MouseSystems. */ buf[0] = MOUSE_MSC_SYNC | @@ -404,6 +480,9 @@ sysmouse_drvinit(void *unused) cv_init(&sysmouse_sleep, "sysmrd"); make_dev(&sysmouse_cdevsw, 0, UID_ROOT, GID_WHEEL, 0600, "sysmouse"); +#ifdef EVDEV_SUPPORT + sysmouse_evdev_init(); +#endif } SYSINIT(sysmouse, SI_SUB_DRIVERS, SI_ORDER_MIDDLE, sysmouse_drvinit, NULL); From owner-svn-src-all@freebsd.org Thu Dec 22 21:56:43 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1179EC8D6B4; Thu, 22 Dec 2016 21:56:43 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id DE23015F4; Thu, 22 Dec 2016 21:56:42 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBMLugLH062819; Thu, 22 Dec 2016 21:56:42 GMT (envelope-from rmacklem@FreeBSD.org) Received: (from rmacklem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBMLug5k062813; Thu, 22 Dec 2016 21:56:42 GMT (envelope-from rmacklem@FreeBSD.org) Message-Id: <201612222156.uBMLug5k062813@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rmacklem set sender to rmacklem@FreeBSD.org using -f From: Rick Macklem Date: Thu, 22 Dec 2016 21:56:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r310432 - stable/11/usr.sbin/nfsd X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Dec 2016 21:56:43 -0000 Author: rmacklem Date: Thu Dec 22 21:56:41 2016 New Revision: 310432 URL: https://svnweb.freebsd.org/changeset/base/310432 Log: MFC: r309723 Patch the nfsd so that it doesn't register with rpcbind for an NFSv4 only server. This patch uses the sysctl vfs.nfsd.server_min_nfsvers to determine if/what versions of NFS service should be registered with rpcbind. For NFSv4 only, it does not register at all, since NFSv4 always uses 2049 and does not require rpcbind. For NFSv3 minimum, it registers NFSv3 but not NFSv2. Modified: stable/11/usr.sbin/nfsd/nfsd.c Directory Properties: stable/11/ (props changed) Modified: stable/11/usr.sbin/nfsd/nfsd.c ============================================================================== --- stable/11/usr.sbin/nfsd/nfsd.c Thu Dec 22 21:29:57 2016 (r310431) +++ stable/11/usr.sbin/nfsd/nfsd.c Thu Dec 22 21:56:41 2016 (r310432) @@ -82,6 +82,9 @@ static int debug = 0; #define NFSD_STABLEBACKUP "/var/db/nfs-stablerestart.bak" #define MAXNFSDCNT 256 #define DEFNFSDCNT 4 +#define NFS_VER2 2 +#define NFS_VER3 3 +#define NFS_VER4 4 static pid_t children[MAXNFSDCNT]; /* PIDs of children */ static int nfsdcnt; /* number of children */ static int nfsdcnt_set; @@ -158,6 +161,8 @@ main(int argc, char **argv) int bindhostc, bindanyflag, rpcbreg, rpcbregcnt; int nfssvc_addsock; int longindex = 0; + int nfs_minvers = NFS_VER2; + size_t nfs_minvers_size; const char *lopt; char **bindhost = NULL; pid_t pid; @@ -266,6 +271,15 @@ main(int argc, char **argv) errx(1, "Out of memory"); } + nfs_minvers_size = sizeof(nfs_minvers); + error = sysctlbyname("vfs.nfsd.server_min_nfsvers", &nfs_minvers, + &nfs_minvers_size, NULL, 0); + if (error != 0 || nfs_minvers < NFS_VER2 || nfs_minvers > NFS_VER4) { + warnx("sysctlbyname(vfs.nfsd.server_min_nfsvers) failed," + " defaulting to NFSv2"); + nfs_minvers = NFS_VER2; + } + if (unregister) { unregistration(); exit (0); @@ -285,9 +299,14 @@ main(int argc, char **argv) err(1, "getnetconfigent udp failed"); nb_udp.buf = ai_udp->ai_addr; nb_udp.len = nb_udp.maxlen = ai_udp->ai_addrlen; - if ((!rpcb_set(NFS_PROGRAM, 2, nconf_udp, &nb_udp)) || - (!rpcb_set(NFS_PROGRAM, 3, nconf_udp, &nb_udp))) - err(1, "rpcb_set udp failed"); + if (nfs_minvers == NFS_VER2) + if (!rpcb_set(NFS_PROGRAM, 2, nconf_udp, + &nb_udp)) + err(1, "rpcb_set udp failed"); + if (nfs_minvers <= NFS_VER3) + if (!rpcb_set(NFS_PROGRAM, 3, nconf_udp, + &nb_udp)) + err(1, "rpcb_set udp failed"); freeaddrinfo(ai_udp); } if (udpflag && ip6flag) { @@ -304,9 +323,14 @@ main(int argc, char **argv) err(1, "getnetconfigent udp6 failed"); nb_udp6.buf = ai_udp6->ai_addr; nb_udp6.len = nb_udp6.maxlen = ai_udp6->ai_addrlen; - if ((!rpcb_set(NFS_PROGRAM, 2, nconf_udp6, &nb_udp6)) || - (!rpcb_set(NFS_PROGRAM, 3, nconf_udp6, &nb_udp6))) - err(1, "rpcb_set udp6 failed"); + if (nfs_minvers == NFS_VER2) + if (!rpcb_set(NFS_PROGRAM, 2, nconf_udp6, + &nb_udp6)) + err(1, "rpcb_set udp6 failed"); + if (nfs_minvers <= NFS_VER3) + if (!rpcb_set(NFS_PROGRAM, 3, nconf_udp6, + &nb_udp6)) + err(1, "rpcb_set udp6 failed"); freeaddrinfo(ai_udp6); } if (tcpflag) { @@ -323,9 +347,14 @@ main(int argc, char **argv) err(1, "getnetconfigent tcp failed"); nb_tcp.buf = ai_tcp->ai_addr; nb_tcp.len = nb_tcp.maxlen = ai_tcp->ai_addrlen; - if ((!rpcb_set(NFS_PROGRAM, 2, nconf_tcp, &nb_tcp)) || - (!rpcb_set(NFS_PROGRAM, 3, nconf_tcp, &nb_tcp))) - err(1, "rpcb_set tcp failed"); + if (nfs_minvers == NFS_VER2) + if (!rpcb_set(NFS_PROGRAM, 2, nconf_tcp, + &nb_tcp)) + err(1, "rpcb_set tcp failed"); + if (nfs_minvers <= NFS_VER3) + if (!rpcb_set(NFS_PROGRAM, 3, nconf_tcp, + &nb_tcp)) + err(1, "rpcb_set tcp failed"); freeaddrinfo(ai_tcp); } if (tcpflag && ip6flag) { @@ -342,9 +371,14 @@ main(int argc, char **argv) err(1, "getnetconfigent tcp6 failed"); nb_tcp6.buf = ai_tcp6->ai_addr; nb_tcp6.len = nb_tcp6.maxlen = ai_tcp6->ai_addrlen; - if ((!rpcb_set(NFS_PROGRAM, 2, nconf_tcp6, &nb_tcp6)) || - (!rpcb_set(NFS_PROGRAM, 3, nconf_tcp6, &nb_tcp6))) - err(1, "rpcb_set tcp6 failed"); + if (nfs_minvers == NFS_VER2) + if (!rpcb_set(NFS_PROGRAM, 2, nconf_tcp6, + &nb_tcp6)) + err(1, "rpcb_set tcp6 failed"); + if (nfs_minvers <= NFS_VER3) + if (!rpcb_set(NFS_PROGRAM, 3, nconf_tcp6, + &nb_tcp6)) + err(1, "rpcb_set tcp6 failed"); freeaddrinfo(ai_tcp6); } exit (0); @@ -475,9 +509,14 @@ main(int argc, char **argv) err(1, "getnetconfigent udp failed"); nb_udp.buf = ai_udp->ai_addr; nb_udp.len = nb_udp.maxlen = ai_udp->ai_addrlen; - if ((!rpcb_set(NFS_PROGRAM, 2, nconf_udp, &nb_udp)) || - (!rpcb_set(NFS_PROGRAM, 3, nconf_udp, &nb_udp))) - err(1, "rpcb_set udp failed"); + if (nfs_minvers == NFS_VER2) + if (!rpcb_set(NFS_PROGRAM, 2, nconf_udp, + &nb_udp)) + err(1, "rpcb_set udp failed"); + if (nfs_minvers <= NFS_VER3) + if (!rpcb_set(NFS_PROGRAM, 3, nconf_udp, + &nb_udp)) + err(1, "rpcb_set udp failed"); freeaddrinfo(ai_udp); } } @@ -544,9 +583,16 @@ main(int argc, char **argv) err(1, "getnetconfigent udp6 failed"); nb_udp6.buf = ai_udp6->ai_addr; nb_udp6.len = nb_udp6.maxlen = ai_udp6->ai_addrlen; - if ((!rpcb_set(NFS_PROGRAM, 2, nconf_udp6, &nb_udp6)) || - (!rpcb_set(NFS_PROGRAM, 3, nconf_udp6, &nb_udp6))) - err(1, "rpcb_set udp6 failed"); + if (nfs_minvers == NFS_VER2) + if (!rpcb_set(NFS_PROGRAM, 2, nconf_udp6, + &nb_udp6)) + err(1, + "rpcb_set udp6 failed"); + if (nfs_minvers <= NFS_VER3) + if (!rpcb_set(NFS_PROGRAM, 3, nconf_udp6, + &nb_udp6)) + err(1, + "rpcb_set udp6 failed"); freeaddrinfo(ai_udp6); } } @@ -610,10 +656,14 @@ main(int argc, char **argv) err(1, "getnetconfigent tcp failed"); nb_tcp.buf = ai_tcp->ai_addr; nb_tcp.len = nb_tcp.maxlen = ai_tcp->ai_addrlen; - if ((!rpcb_set(NFS_PROGRAM, 2, nconf_tcp, - &nb_tcp)) || (!rpcb_set(NFS_PROGRAM, 3, - nconf_tcp, &nb_tcp))) - err(1, "rpcb_set tcp failed"); + if (nfs_minvers == NFS_VER2) + if (!rpcb_set(NFS_PROGRAM, 2, nconf_tcp, + &nb_tcp)) + err(1, "rpcb_set tcp failed"); + if (nfs_minvers <= NFS_VER3) + if (!rpcb_set(NFS_PROGRAM, 3, nconf_tcp, + &nb_tcp)) + err(1, "rpcb_set tcp failed"); freeaddrinfo(ai_tcp); } } @@ -685,9 +735,14 @@ main(int argc, char **argv) err(1, "getnetconfigent tcp6 failed"); nb_tcp6.buf = ai_tcp6->ai_addr; nb_tcp6.len = nb_tcp6.maxlen = ai_tcp6->ai_addrlen; - if ((!rpcb_set(NFS_PROGRAM, 2, nconf_tcp6, &nb_tcp6)) || - (!rpcb_set(NFS_PROGRAM, 3, nconf_tcp6, &nb_tcp6))) - err(1, "rpcb_set tcp6 failed"); + if (nfs_minvers == NFS_VER2) + if (!rpcb_set(NFS_PROGRAM, 2, nconf_tcp6, + &nb_tcp6)) + err(1, "rpcb_set tcp6 failed"); + if (nfs_minvers <= NFS_VER3) + if (!rpcb_set(NFS_PROGRAM, 3, nconf_tcp6, + &nb_tcp6)) + err(1, "rpcb_set tcp6 failed"); freeaddrinfo(ai_tcp6); } } From owner-svn-src-all@freebsd.org Thu Dec 22 22:02:06 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7DC7FC8D971; Thu, 22 Dec 2016 22:02:06 +0000 (UTC) (envelope-from baptiste.daroussin@gmail.com) Received: from mail-wm0-x243.google.com (mail-wm0-x243.google.com [IPv6:2a00:1450:400c:c09::243]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 06E901CE6; Thu, 22 Dec 2016 22:02:06 +0000 (UTC) (envelope-from baptiste.daroussin@gmail.com) Received: by mail-wm0-x243.google.com with SMTP id c85so317745wmi.1; Thu, 22 Dec 2016 14:02:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=MKSrveDDU7+FIhZXC26llknjw3U8LOhywM8q9juIJVY=; b=WWgcQI6vKwotyCEQkiT/Mgh2cw/5XaOg747sDUSIJ9YTz/Q8DglFzqyuWmS9geCDcX IPreavhBqqf0cXtKlJQYCOkQpcPbfGncMtCwitlxAaxZC9BqujCu2yM7S0xsfOMJg8ep kJwvM0r2viwRQlGynZu842pmzDBWFr44FCXysxvKN7qHJfttHEPyHlomsAkGTlBIQ/B9 llw/Z9C4FDezDGztBfU8D7IkHKjnSx2/6B9wHnkJGJkPLJwJ4t9+dygkoM2YSaMZJabh TWyKsFOBQvE1xRLypAf1SFAFOPHKCYGh9quFDMF09dYRO4Fdn4hrlE00jK6fR3JKjxzM Qrmg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:from:to:cc:subject:message-id :references:mime-version:content-disposition:in-reply-to:user-agent; bh=MKSrveDDU7+FIhZXC26llknjw3U8LOhywM8q9juIJVY=; b=FyFZzixgGePU0V6aGST6vyu7UKZpMeMI/xwBKm01MDZaGkF4N3hUX7Ix2oIEW4qK9b o8OImDLJEmSMpop9AwzSFa01taEzMnNaRopjbhpxXgGvLc3NRShGVorw3SN0tDkZS/PK /O3DLCYSNl1+J7TgJhKBNUI4VBwcVe1aK+NDC0DiXYIiDTcSf1COAt5AvgUfol3HiFzz 6sgSUR9B0DfqGyZKY7IQoaMYX8sltXDPe8uinDfPXFkklSKEernTa2hBPp4UHGDNasYO fI3tnYDJSLrv8WZMGzR/ZAcrDeiyRNtSWguUSRCRyerzPRg/ORtVewHsQyvlbp3zOlPD zvvA== X-Gm-Message-State: AIkVDXKFgPS7Wyfmrvuu4g+pmOtGx5TBDhV01Dfu8TnjrH8R40u6wG/S7osz3mXpzfdqjw== X-Received: by 10.28.25.135 with SMTP id 129mr12978806wmz.122.1482444124126; Thu, 22 Dec 2016 14:02:04 -0800 (PST) Received: from ivaldir.etoilebsd.net ([2001:41d0:8:db4c::1]) by smtp.gmail.com with ESMTPSA id b15sm34128594wma.5.2016.12.22.14.02.03 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 22 Dec 2016 14:02:03 -0800 (PST) Sender: Baptiste Daroussin Date: Thu, 22 Dec 2016 23:02:02 +0100 From: Baptiste Daroussin To: Ed Maste Cc: Ed Schouten , src-committers , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" Subject: Re: svn commit: r310425 - in head/sys/dev/mlx4: mlx4_core mlx4_ib Message-ID: <20161222220202.y4us772z6hd43nni@ivaldir.etoilebsd.net> References: <201612221826.uBMIQLFQ076247@repo.freebsd.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="dcexskdpxwkelirr" Content-Disposition: inline In-Reply-To: User-Agent: NeoMutt/20161126 (1.7.1) X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Dec 2016 22:02:06 -0000 --dcexskdpxwkelirr Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Thu, Dec 22, 2016 at 03:57:38PM -0500, Ed Maste wrote: > On 22 December 2016 at 14:44, Ed Schouten wrote: > > 2016-12-22 19:26 GMT+01:00 Ed Maste : > >> Log: > >> mlx: avoid use of __DATE__ to make build reproducible > > > > Out of curiosity, are we planning on adding -Wdate-time or > > -Werror=3Ddate-time to our default CFLAGS? If so, awesome! >=20 > I hadn't thought of it, but good idea. Maybe something like this for now: >=20 > --- a/share/mk/bsd.sys.mk > +++ b/share/mk/bsd.sys.mk > @@ -88,6 +88,9 @@ CWARNFLAGS.clang+=3D -Wno-parentheses > .if defined(NO_WARRAY_BOUNDS) > CWARNFLAGS.clang+=3D -Wno-array-bounds > .endif # NO_WARRAY_BOUNDS > +.if ${MK_REPRODUCIBLE_BUILD} !=3D no > +CWARNFLAGS.clang+=3D -Wdate-time > +.endif # MK_REPRODUCIBLE_BUILD > .endif # WARNS >=20 +1 Bapt --dcexskdpxwkelirr Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCAAdFiEEgOTj3suS2urGXVU3Y4mL3PG3PloFAlhcTVMACgkQY4mL3PG3 PlppJg/9E2icSMeBbRlzNpa5FSV43VGlLi9653qXNoiIx317uWc6BYYXW6f8C5tn oUDIxOt3VUCX1qwHePcB7a6V75GzgF9Elu72akduNuMSuhm44LWB/WZ1aW0/51AJ KC5qhHc5WUB4mpk93WH55Bcw+ljxgmNmmL1662LdgCVDPxvAeQowaqz9FivHsXWL QkEvhLUuWcGzaDZ30JYUA+Yg3iFCZG53zfUMvn+Z39XP1HZ+4Qj0SGQtCnolBAZJ kTasdBwdPvIKMHhlGrDuEneWitbcSI/VebkvB3zv5eXpvYJldIqnd1qeJg5DshBL am/SF0MxTWF0wsaYmQAo+X8KrbBYKCIZauQLcTDGbzi+HUT2yWNXitpnHbqpeY4u Dpg3PatkpPSVuO5i3l2eiHz1v3a7LDKaIdY/O08gczgmVshGuAw/tix8G6zlPAXE 0dyAVcGm6B+brsP0UC1KwD2IlcuN8ABgNdWLucWs+rNUDplmhIc/kSJFD1yOP3E4 rktHVwuJmMvei6AjGFc0SsuIY06Jzvy56RxLaFtaR4+tBo0gDZLh3Zk0+BzVKBNP cI1khLE84ex2El1sp1O10ScZK8U2+1OFEkgAaXP5riIksWSfHOAcMH5QfPNMCHTc FZNB6Ac1hG6XBIjOTRL51cXVcRq8/kw96vr2qBbwksEdHeUDdxE= =i88t -----END PGP SIGNATURE----- --dcexskdpxwkelirr-- From owner-svn-src-all@freebsd.org Thu Dec 22 22:02:48 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E18E6C8D9D1; Thu, 22 Dec 2016 22:02:48 +0000 (UTC) (envelope-from baptiste.daroussin@gmail.com) Received: from mail-wj0-x244.google.com (mail-wj0-x244.google.com [IPv6:2a00:1450:400c:c01::244]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 6E03D1EA4; Thu, 22 Dec 2016 22:02:48 +0000 (UTC) (envelope-from baptiste.daroussin@gmail.com) Received: by mail-wj0-x244.google.com with SMTP id j10so38004621wjb.3; Thu, 22 Dec 2016 14:02:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=IY7qokueCFgDVb5VajLeRFt012GAaoa7xz6W2IrXgw0=; b=kjkhH4Fv/ABEBKg8NMK5u9z73Wp4srqKg7Kl/8sw8/os1POaP0Rt+YlSFLIGczgave BGr3Tptxu/fLckrSjvnj2CGfCoNh9Lqw8uHTnypQsmGkCP33Fla6HkHbQh/1vw2i0nja clnYuEHoNgHn6BP/n36wkwXDrRbpvdSv3lxFH5mKaOiIUmPGbrm61ukmHWza4HcFetsY vBKWL5HswzdNAJUyNmzgH2eRpCGMXMH5n50R8xeSDpYVUGIiQm2AxL7Nlvrr7Vr/d0uO plr7NXHuCbE6xTo/2La00GWkznCL2ryywPvn+SvUSxyuR+HlkDIkEr4oVy4WaqIEtAv5 ulPg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:from:to:cc:subject:message-id :references:mime-version:content-disposition:in-reply-to:user-agent; bh=IY7qokueCFgDVb5VajLeRFt012GAaoa7xz6W2IrXgw0=; b=f9ebZqCtUvdW27dyrfW306YPAR2JFthULOMCqjsJisud7aX4QRBh6SInPQ3xau0U9N dhCzu0PCR8jSGCBMEXzKTmnga61jmhbem8Ao46J7KdHIRtnWqGWL8W0VpRhBjKc+xoQH wGc83TO3i6qqKvyp2p5xAL0wxPxBIeKpZ+Vcms9MSSWk2sTNGQrWPtd2Sb4otOkEF3BA PMI3aW+3yPJ6C73txdl0qwt+KmDstwc1lHyU/IutrW4U/Q9gDd3/tHLZbuqaTCzpRR01 amQ0kvK0K2USKfYmWjnC/cSVYqwxK1kY7+LrN3Lq7ELILlo7E/jjTyXzzYafYzmn7O4G dm/A== X-Gm-Message-State: AIkVDXJlowo5ke7kRT5US2vvN1bovcLq9vOvCAVExPnyNot7EWp71eMZFqtwz6MNr4YIfw== X-Received: by 10.195.30.43 with SMTP id kb11mr10594508wjd.131.1482444166958; Thu, 22 Dec 2016 14:02:46 -0800 (PST) Received: from ivaldir.etoilebsd.net ([2001:41d0:8:db4c::1]) by smtp.gmail.com with ESMTPSA id jz1sm12082115wjc.38.2016.12.22.14.02.46 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 22 Dec 2016 14:02:46 -0800 (PST) Sender: Baptiste Daroussin Date: Thu, 22 Dec 2016 23:02:45 +0100 From: Baptiste Daroussin To: Jilles Tjoelker Cc: Conrad Meyer , Adrian Chadd , src-committers , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" Subject: Re: svn commit: r310138 - head/lib/libc/stdio Message-ID: <20161222220245.zolanf4f2sii352d@ivaldir.etoilebsd.net> References: <201612160144.uBG1ipjW016736@repo.freebsd.org> <49460793.UcUNovQMDa@ralph.baldwin.cx> <1482281779.48539.41.camel@freebsd.org> <20161221220212.GA97256@stack.nl> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="bg2nhnfsemzw6v7m" Content-Disposition: inline In-Reply-To: <20161221220212.GA97256@stack.nl> User-Agent: NeoMutt/20161126 (1.7.1) X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Dec 2016 22:02:49 -0000 --bg2nhnfsemzw6v7m Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, Dec 21, 2016 at 11:02:12PM +0100, Jilles Tjoelker wrote: > On Tue, Dec 20, 2016 at 06:04:31PM -0800, Conrad Meyer wrote: > > On Tue, Dec 20, 2016 at 5:56 PM, Adrian Chadd = wrote: > > > Here's my reason for removal. >=20 > > > Plenty of us are looking to be able to build bits of the BSD source > > > tree as part of other non FreeBSD systems, especially if they're > > > involved in bootstrapping. >=20 > > Understood, however: >=20 > > > That means that it needs to be compilable > > > by a non-FreeBSD-modified compiler. Ideally this means we'd stick to > > > mostly POSIX options source code that we can compile with unmodified > > > compilers, and we push non-standard stuff into otherly-named > > > functions. >=20 > > Yeah, this isn't actually a problem. printf("%b", foo) compiles fine > > with non-modified compilers. >=20 > It compiles only if you disable format string warnings that should not > be disabled for any serious software development, in my humble opinion. > It will build, but not in a way I can call "fine". >=20 > This indeed makes it very hard to justify extensions to format strings. > Special formatting will need to use new functions. >=20 I think it is pretty clear that there are too many people requesting the re= vert for the revert not to be done. Bapt --bg2nhnfsemzw6v7m Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCAAdFiEEgOTj3suS2urGXVU3Y4mL3PG3PloFAlhcTYUACgkQY4mL3PG3 PloNzQ//cdILmxq3LHUWwwNStzEKSKdKkTGuHu18dJ7UJaong0WWdrgPIf8oOQN9 G5HGoL7Ehv47fkq5Bztek+uka5lKt/VZ0KMpbqLc3wPaE0r/aFVkiqjSL2ozrEKQ zVz5pWmZJXzVN7geEmyhJnvKQuNQmZ2u32wbnPbCD1A1qwuT1vK5M1N0GRSDPLlz AM9Wxzv0aB8rPWtpYV8vlo6PbkMVhI15dMgFC1CS5mEMXKlfArOFhd8pTni6C7Jt 6PWQn2jRJl/DgekLbqULuPrWv+SQdbsYO5jLJxCljg/XznplWGe1J0PQCj1gRrDB BbJZYIUXYQ1LNCdy7YLdBwqrDfbPyQa26gf+NbFJwre9zjMKAmkYor630tGGV1Kq vnin17jfzacNAm09R0Qp3/trqj1CGZdahx2QP207RWz6TcFRvm89zFGhbqwPSp7c ya8DxVwr7Ekgm8umq/Z4mrzoPpM8Tcx1KG1lezx/jVjHYf0LwpzhoC7+3p2i21Gz Ho9L+WTGlOim4+ty5TIG3tZHaKjtkrfPyzKMJDd79ew+5ukGCSbaSj+xLyTRVuBE BrTx2/b3ervP+87dhF7bdypbj3H1E9zoSxKm3lXpRVNm14L8t3JoulI+arPMucQa s81NvbPeYrX8hhGi1lTglKlnu1yqOXV3Hv/TSM7v0nMDX0EL8A8= =OjtK -----END PGP SIGNATURE----- --bg2nhnfsemzw6v7m-- From owner-svn-src-all@freebsd.org Thu Dec 22 22:30:43 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id BC525C8D10B; Thu, 22 Dec 2016 22:30:43 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 8C09BBC6; Thu, 22 Dec 2016 22:30:43 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBMMUgCX075129; Thu, 22 Dec 2016 22:30:42 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBMMUge9075128; Thu, 22 Dec 2016 22:30:42 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201612222230.uBMMUge9075128@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Ngie Cooper Date: Thu, 22 Dec 2016 22:30:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310433 - head/lib/libc/stdio X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Dec 2016 22:30:43 -0000 Author: ngie Date: Thu Dec 22 22:30:42 2016 New Revision: 310433 URL: https://svnweb.freebsd.org/changeset/base/310433 Log: Revert r310138 Adding %b support to vfprintf for parity with kernel space requires more discussion/review. In particular, many parties were concerned over introducing a non-standard format qualifier to *printf(3) which didn't already exist in other OSes, e.g. Linux, thus making code which used %b harder to port to other operating systems. Requested by: many Modified: head/lib/libc/stdio/vfprintf.c Modified: head/lib/libc/stdio/vfprintf.c ============================================================================== --- head/lib/libc/stdio/vfprintf.c Thu Dec 22 21:56:41 2016 (r310432) +++ head/lib/libc/stdio/vfprintf.c Thu Dec 22 22:30:42 2016 (r310433) @@ -611,37 +611,6 @@ reswitch: switch (ch) { case 'z': flags |= SIZET; goto rflag; - case 'b': - { - const char *q; - int anybitset, bit; - - ulval = (u_int)GETARG(int); - cp = GETARG(char *); - - q = __ultoa(ulval, buf + BUF, *cp++, 0, xdigs_lower); - PRINT(q, buf + BUF - q); - - if (ulval == 0) - break; - - for (anybitset = 0; *cp;) { - bit = *cp++; - if (ulval & (1 << (bit - 1))) { - PRINT(anybitset ? "," : "<", 1); - q = cp; - for (; (bit = *cp) > ' '; ++cp) - continue; - PRINT(q, cp - q); - anybitset = 1; - } else - for (; *cp > ' '; ++cp) - continue; - } - if (anybitset) - PRINT(">", 1); - } - continue; case 'C': flags |= LONGINT; /*FALLTHROUGH*/ From owner-svn-src-all@freebsd.org Thu Dec 22 23:02:32 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 49CD2C8D914; Thu, 22 Dec 2016 23:02:32 +0000 (UTC) (envelope-from cse.cem@gmail.com) Received: from mail-wj0-f175.google.com (mail-wj0-f175.google.com [209.85.210.175]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id D93F5178; Thu, 22 Dec 2016 23:02:31 +0000 (UTC) (envelope-from cse.cem@gmail.com) Received: by mail-wj0-f175.google.com with SMTP id sd9so54616403wjb.1; Thu, 22 Dec 2016 15:02:31 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:reply-to:in-reply-to:references :from:date:message-id:subject:to:cc; bh=dVnlVaTtPTPl6WwAKMmAqg+Ia5+kpbcwLAyF549M6/I=; b=ICQayQKVFkXvNHpxsOsZ7+2gW6Nimc5hoGEJCoHZp0moex31s1m9zUlhy+PFURoPph rxqiKcOttUR5ym0xWdnfD1IYZkAvIc2YTsi9pY4IIa5vXO4PpgJsf4w91FIuqor3YZH0 BSzk1YJAbKQh3kbXFlBNepBmA4m//EvbItxMKYILezf4zvM15AURA+e6mbHicwjD6aZr 7OVdmgaXKcOhsdocu7xWLPnO/avlZOU3D/yjb3DS8HK82xc2Ljges6XQtX5hP1eVWpbB 5IceE6MEzWlaVw/7rzvZT2/X0bKXelGYP0PhM3Awoj8+W0iHEmHpz9uPKG5y1JLdyGvf bzAw== X-Gm-Message-State: AIkVDXJKF7jb5jAUF4pHgUpx4TN0hUIrcW3KXT7f/Ps1h9UGEAPyEQh4umHcBSUGw2A2Hw== X-Received: by 10.194.148.134 with SMTP id ts6mr10929930wjb.220.1482446350537; Thu, 22 Dec 2016 14:39:10 -0800 (PST) Received: from mail-wj0-f173.google.com (mail-wj0-f173.google.com. [209.85.210.173]) by smtp.gmail.com with ESMTPSA id gj6sm37722117wjb.29.2016.12.22.14.39.10 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 22 Dec 2016 14:39:10 -0800 (PST) Received: by mail-wj0-f173.google.com with SMTP id c11so34304919wjx.3; Thu, 22 Dec 2016 14:39:10 -0800 (PST) X-Received: by 10.194.222.202 with SMTP id qo10mr10899228wjc.115.1482446350283; Thu, 22 Dec 2016 14:39:10 -0800 (PST) MIME-Version: 1.0 Reply-To: cem@freebsd.org Received: by 10.194.29.72 with HTTP; Thu, 22 Dec 2016 14:39:09 -0800 (PST) In-Reply-To: <201612222230.uBMMUge9075128@repo.freebsd.org> References: <201612222230.uBMMUge9075128@repo.freebsd.org> From: Conrad Meyer Date: Thu, 22 Dec 2016 14:39:09 -0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: svn commit: r310433 - head/lib/libc/stdio To: Ngie Cooper Cc: src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset=UTF-8 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Dec 2016 23:02:32 -0000 This was unjustified and inappropriate. On Thu, Dec 22, 2016 at 2:30 PM, Ngie Cooper wrote: > Author: ngie > Date: Thu Dec 22 22:30:42 2016 > New Revision: 310433 > URL: https://svnweb.freebsd.org/changeset/base/310433 > > Log: > Revert r310138 > > Adding %b support to vfprintf for parity with kernel space requires > more discussion/review. > > In particular, many parties were concerned over introducing a > non-standard format qualifier to *printf(3) which didn't already > exist in other OSes, e.g. Linux, thus making code which used %b > harder to port to other operating systems. > > Requested by: many > > Modified: > head/lib/libc/stdio/vfprintf.c > > Modified: head/lib/libc/stdio/vfprintf.c > ============================================================================== > --- head/lib/libc/stdio/vfprintf.c Thu Dec 22 21:56:41 2016 (r310432) > +++ head/lib/libc/stdio/vfprintf.c Thu Dec 22 22:30:42 2016 (r310433) > @@ -611,37 +611,6 @@ reswitch: switch (ch) { > case 'z': > flags |= SIZET; > goto rflag; > - case 'b': > - { > - const char *q; > - int anybitset, bit; > - > - ulval = (u_int)GETARG(int); > - cp = GETARG(char *); > - > - q = __ultoa(ulval, buf + BUF, *cp++, 0, xdigs_lower); > - PRINT(q, buf + BUF - q); > - > - if (ulval == 0) > - break; > - > - for (anybitset = 0; *cp;) { > - bit = *cp++; > - if (ulval & (1 << (bit - 1))) { > - PRINT(anybitset ? "," : "<", 1); > - q = cp; > - for (; (bit = *cp) > ' '; ++cp) > - continue; > - PRINT(q, cp - q); > - anybitset = 1; > - } else > - for (; *cp > ' '; ++cp) > - continue; > - } > - if (anybitset) > - PRINT(">", 1); > - } > - continue; > case 'C': > flags |= LONGINT; > /*FALLTHROUGH*/ > From owner-svn-src-all@freebsd.org Thu Dec 22 23:16:18 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 260FEC8DE32; Thu, 22 Dec 2016 23:16:18 +0000 (UTC) (envelope-from yaneurabeya@gmail.com) Received: from mail-pg0-x242.google.com (mail-pg0-x242.google.com [IPv6:2607:f8b0:400e:c05::242]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id E7FC8CC3; Thu, 22 Dec 2016 23:16:17 +0000 (UTC) (envelope-from yaneurabeya@gmail.com) Received: by mail-pg0-x242.google.com with SMTP id g1so19791098pgn.0; Thu, 22 Dec 2016 15:16:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:message-id:mime-version:subject:date:in-reply-to:cc:to :references; bh=ifgxMxLuqcU0+WHSuHeYrD/z+RoDy5xE/sfz4xW4s7o=; b=Ujniz1U79WDBMajw3BQB0koAhpQKklt29QHyZhY0RRSfQHlJpzERP5M3q+ZQdp16Uj yXSXCbMXob4W59m7q5+008sHxqzAAlhA9lfrcJ4EEnYCIBztA8vhsLn0cr3ZmtIX8uJO QNMRm0K4bys6o9o0oss0Dq+IUK1DkTlw4UFpxIpyoxR0h+ENyPT655X/rQEU1SSK6+0M UWF+OhhERf93ncfOfAeuac/PZkq0lqreGcGZogyu2mvAZf60nnQhIzh9vUS2EaP6Kv7W oiBmeTdiCTBEzvAOKdep0m++2IgwMF7sW3uNjHkgcFrN/Wb5t9Lg0ltsG8r32x84aOGk MSyA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:message-id:mime-version:subject:date :in-reply-to:cc:to:references; bh=ifgxMxLuqcU0+WHSuHeYrD/z+RoDy5xE/sfz4xW4s7o=; b=q0N9U5Ft2yYND0uZYeMa38vcNnrncf4TLq8ZK3Z6k1GTresh00JpbuR75ZB4Gmrfxy jw8yFeyamYUKPdQ1wLJm5lbH90v/DsC8v34EjVKfNVmhasxRZwGN1GPxfjmph0v0Zg9q Opj36UBSZEAtDm/u9N4W44EQBjYNYMczAim4GonMgjor+wddrVVnOSLMwVEcaWZfEn/k 8UbRJ0a9HYcW39+kCF+s5qLaEuXuyz/9gsqHXQn2PTEgI0alcBYSfeiExQEAy3/95Do2 hJJuMCH4wNb4c0PAH4Hpm5gHKkTawCO1mALk5WUdzGO7X8aYB0J1WmEbV2q/Sux9VR6G 4sSA== X-Gm-Message-State: AIkVDXINuMPU/o6qAL5nL5p5KFHVaoOPhsp3m4fU/MK7LXhLRtK/fbMnz3s+E9gqHMiytQ== X-Received: by 10.99.19.65 with SMTP id 1mr21210911pgt.71.1482448577290; Thu, 22 Dec 2016 15:16:17 -0800 (PST) Received: from fuji-wireless.local (c-73-19-52-228.hsd1.wa.comcast.net. [73.19.52.228]) by smtp.gmail.com with ESMTPSA id c71sm57436173pga.22.2016.12.22.15.16.16 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 22 Dec 2016 15:16:16 -0800 (PST) From: "Ngie Cooper (yaneurabeya)" Message-Id: Mime-Version: 1.0 (Mac OS X Mail 10.2 \(3259\)) Subject: Re: svn commit: r310433 - head/lib/libc/stdio Date: Thu, 22 Dec 2016 15:16:15 -0800 In-Reply-To: Cc: Ngie Cooper , src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org To: cem@freebsd.org References: <201612222230.uBMMUge9075128@repo.freebsd.org> X-Mailer: Apple Mail (2.3259) Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.23 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Dec 2016 23:16:18 -0000 > On Dec 22, 2016, at 2:39 PM, Conrad Meyer wrote: >=20 > This was unjustified and inappropriate. Conrad, =46rom the committer=E2=80=99s guide ( = https://www.freebsd.org/doc/en_US.ISO8859-1/articles/committers-guide/arti= cle.html#developer.relations = ): If you are unsure about a commit for any reason at all, have it reviewed = by -hackers before committing. Better to have it flamed then and there = rather than when it is part of the repository. If you do happen to = commit something which results in controversy erupting, you may also = wish to consider backing the change out again until the matter is = settled. Remember =E2=80=93 with a version control system we can always = change it back. Per the commit message, the change wasn=E2=80=99t reviewed = before commit (" Reviewed by: no one, unfortunately=E2=80=9D). More = than a handful of people requested that the commit be reverted/changed. = There wasn=E2=80=99t an issue with the content created =E2=80=94 there = was just an issue with how %b was implemented (especially when it = impedes being able to cross-compile FreeBSD on other operating systems = or port code to those operating systems). Dmitriy=E2=80=99s comment about adding snprintb(3) from NetBSD = makes a lot of sense and will reintroduce the code that you added here, = and I fully agree and support his suggestion. For what it=E2=80=99s worth from personal experience, it=E2=80=99s= really a pain when non-standard things get leaked into FreeBSD, or when = you have to port software to other operating systems that use = non-standard interfaces (I usually have to do this moving Linux code to = FreeBSD). Take the format -fformat* string functionality in OneFS =E2=80=94= it=E2=80=99s unfortunate that we can=E2=80=99t use a standard compiler = to compile OneFS out of the box and instead have to bootstrap a compiler = which is intelligent enough to understand how the custom format strings = work, just to compile user space/a kernel. Thank you, -Ngie= From owner-svn-src-all@freebsd.org Thu Dec 22 23:32:24 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id EEDC9C8D4A1; Thu, 22 Dec 2016 23:32:24 +0000 (UTC) (envelope-from cse.cem@gmail.com) Received: from mail-wj0-f195.google.com (mail-wj0-f195.google.com [209.85.210.195]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 8E4901796; Thu, 22 Dec 2016 23:32:24 +0000 (UTC) (envelope-from cse.cem@gmail.com) Received: by mail-wj0-f195.google.com with SMTP id kp2so38166459wjc.0; Thu, 22 Dec 2016 15:32:24 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:reply-to:in-reply-to:references :from:date:message-id:subject:to:cc:content-transfer-encoding; bh=Z8PoypfFiMnhZtC6FASHCoCDRe+0tFYUNb61hXcp8ss=; b=F62VtFJB8bLMKdeJ62J0Y/FU9xHTUewyV4F2Ygkhxm0XxHq0OKkEQq2X9dJX8TquG9 1V+Vqru9VTTsHnc/LPHekHx6nj07lAOLwVrvzRHl5Sdp7UzsPhjYTMR5ujs57wwMZev5 deAe6T3fx+VksY8Sobbnnr4dVoeDi/P7egZ7xqac2OyxyDQNQroOwc/CWdi+mfnZ+q/l xWKGBy0Gpz1BAqZqK+zpsuQmN1TR4exQMFajYERs1K9DzTpTbI/tairn7qj62/gRBmBQ xktY55o/DJ79inIqt3nEVa3FjTwnpWd5tCvz/p56bojlZvEMKGZGgGJjRwnwOiPsXxqY WMQg== X-Gm-Message-State: AIkVDXLV/nU69LU/3r4mkqQn0A0yp/WWzBNWWukAq9fx8ylzRYS5KdZF+89o+oAzDEZo2A== X-Received: by 10.194.141.98 with SMTP id rn2mr10983970wjb.1.1482449542383; Thu, 22 Dec 2016 15:32:22 -0800 (PST) Received: from mail-wm0-f41.google.com (mail-wm0-f41.google.com. [74.125.82.41]) by smtp.gmail.com with ESMTPSA id k11sm34230552wmf.24.2016.12.22.15.32.22 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 22 Dec 2016 15:32:22 -0800 (PST) Received: by mail-wm0-f41.google.com with SMTP id k184so3090838wme.1; Thu, 22 Dec 2016 15:32:22 -0800 (PST) X-Received: by 10.28.88.11 with SMTP id m11mr13039997wmb.45.1482449542026; Thu, 22 Dec 2016 15:32:22 -0800 (PST) MIME-Version: 1.0 Reply-To: cem@freebsd.org Received: by 10.194.29.72 with HTTP; Thu, 22 Dec 2016 15:32:21 -0800 (PST) In-Reply-To: References: <201612222230.uBMMUge9075128@repo.freebsd.org> From: Conrad Meyer Date: Thu, 22 Dec 2016 15:32:21 -0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: svn commit: r310433 - head/lib/libc/stdio To: "Ngie Cooper (yaneurabeya)" Cc: src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Dec 2016 23:32:25 -0000 On Thu, Dec 22, 2016 at 3:16 PM, Ngie Cooper (yaneurabeya) wrote: > > On Dec 22, 2016, at 2:39 PM, Conrad Meyer wrote: > > This was unjustified and inappropriate. > > > Conrad, > > From the committer=E2=80=99s guide ( > https://www.freebsd.org/doc/en_US.ISO8859-1/articles/committers-guide/art= icle.html#developer.relations > ): > > If you are unsure about a commit for any reason at all, have it reviewed = by > -hackers before committing. Better to have it flamed then and there rathe= r > than when it is part of the repository. If you do happen to commit someth= ing > which results in controversy erupting, you may also wish to consider back= ing > the change out again until the matter is settled. Remember =E2=80=93 with= a version > control system we can always change it back. > > Per the commit message, the change wasn=E2=80=99t reviewed before commit = (" Reviewed > by: no one, unfortunately=E2=80=9D). More than a handful of people reques= ted that > the commit be reverted/changed. There wasn=E2=80=99t an issue with the co= ntent > created =E2=80=94 there was just an issue with how %b was implemented (es= pecially > when it impedes being able to cross-compile FreeBSD on other operating > systems or port code to those operating systems). > Dmitriy=E2=80=99s comment about adding snprintb(3) from NetBSD makes a lo= t of sense > and will reintroduce the code that you added here, and I fully agree and > support his suggestion. > For what it=E2=80=99s worth from personal experience, it=E2=80=99s really= a pain when > non-standard things get leaked into FreeBSD, or when you have to port > software to other operating systems that use non-standard interfaces (I > usually have to do this moving Linux code to FreeBSD). Take the format > -fformat* string functionality in OneFS =E2=80=94 it=E2=80=99s unfortunat= e that we can=E2=80=99t use > a standard compiler to compile OneFS out of the box and instead have to > bootstrap a compiler which is intelligent enough to understand how the > custom format strings work, just to compile user space/a kernel. > Thank you, > -Ngie Ngie, The revert was unjustified and inappropriate, period. You haven't justified it here either. The guide refers to reverting your own commits, not others'. Please stop helping. Conrad From owner-svn-src-all@freebsd.org Thu Dec 22 23:37:19 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id DB87BC8D5E2; Thu, 22 Dec 2016 23:37:19 +0000 (UTC) (envelope-from yaneurabeya@gmail.com) Received: from mail-pg0-x243.google.com (mail-pg0-x243.google.com [IPv6:2607:f8b0:400e:c05::243]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id A759219B8; Thu, 22 Dec 2016 23:37:19 +0000 (UTC) (envelope-from yaneurabeya@gmail.com) Received: by mail-pg0-x243.google.com with SMTP id n5so416568pgh.3; Thu, 22 Dec 2016 15:37:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:mime-version:from:in-reply-to:date:cc:message-id:references :to; bh=ouqEHNImw7nCBucUqJc4oNrpb5GmBOHcE+QTSgYW/yg=; b=DHOB7nFWCyScprE1i1AgDJtPeBmScBLQITaqNaSAmWjSOa1plQy6xjfJ7cvhK7jhfA Zlm39MRN9/F4g8WCpd8yszu4L/C9U+d83EA73SdgCNRFbQU5ITtrWqUOTLS/rjdC3Vrf Kh7NHGPuNqOiZl4MtvaKrQUmH7xuatwKdU8YQ4lpsBz2CxfT6IQ/kDArKBx7HnUtdi6Q WSk5JDuUdvbc9/CeYZ5xMbNm18NXAOmZUzvduO4j95NttOCYNC0RjLJ2q0b9BmrBcPGQ eNEatNU+or22M7VCWqHBw1mVBlo5H7xnopjzRCljnw3V/H+56VFbWLLxnYN1P4nA0LpZ U6xw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:mime-version:from:in-reply-to:date:cc :message-id:references:to; bh=ouqEHNImw7nCBucUqJc4oNrpb5GmBOHcE+QTSgYW/yg=; b=r5Up91jndGD+pEhanOSWUzOF/dROm2SHBKBcYHT/MEmrlXhu3C/1hFTwwXb1yx6xP1 SyG5tfd+A4SjHs1pEiI5vfEkPB9cHtFTDAQXfhIVF+agcQysZnScU6EaTUuZ2zgSy8gd TuaSnzFg1y7zhBEyK4xHiaWocas9ECMT2lBd3pNbQAtgf+LW5jzM0mjrqAYY6r27BTd4 SSV5YJ+3Z/FJt1j05/3qLlhcUEkJ1eFcuQwscaBcTxPDcVKZPk/eJXtFU07Jz1pc/0Ty YcfCryvoAn+byKSlwsfMkWiE1gi62yle1BjcXMEfekOuRSZUHcQ9GUwRG/P73FRgSXCl +kAA== X-Gm-Message-State: AIkVDXIz9CD/RK4NqORZml/FfrXRnCqH0quWVxnUPRtcJtbVtezPt/RNVVdFjiD09OeZ+w== X-Received: by 10.84.143.162 with SMTP id 31mr24303225plz.2.1482449838934; Thu, 22 Dec 2016 15:37:18 -0800 (PST) Received: from [192.168.20.12] (c-73-19-52-228.hsd1.wa.comcast.net. [73.19.52.228]) by smtp.gmail.com with ESMTPSA id 72sm57252405pfw.37.2016.12.22.15.37.18 (version=TLS1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 22 Dec 2016 15:37:18 -0800 (PST) Subject: Re: svn commit: r310433 - head/lib/libc/stdio Mime-Version: 1.0 (Mac OS X Mail 9.3 \(3124\)) Content-Type: multipart/signed; boundary="Apple-Mail=_C1D28C36-72D4-4C33-943C-6990684F6C35"; protocol="application/pgp-signature"; micalg=pgp-sha512 X-Pgp-Agent: GPGMail From: "Ngie Cooper (yaneurabeya)" In-Reply-To: Date: Thu, 22 Dec 2016 15:37:16 -0800 Cc: src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Message-Id: References: <201612222230.uBMMUge9075128@repo.freebsd.org> To: cem@freebsd.org X-Mailer: Apple Mail (2.3124) X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Dec 2016 23:37:20 -0000 --Apple-Mail=_C1D28C36-72D4-4C33-943C-6990684F6C35 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=us-ascii > Ngie, > > The revert was unjustified and inappropriate, period. You haven't > justified it here either. The guide refers to reverting your own > commits, not others'. Please stop helping. Ok. Got it. --Apple-Mail=_C1D28C36-72D4-4C33-943C-6990684F6C35 Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=signature.asc Content-Type: application/pgp-signature; name=signature.asc Content-Description: Message signed with OpenPGP using GPGMail -----BEGIN PGP SIGNATURE----- Comment: GPGTools - https://gpgtools.org iQIcBAEBCgAGBQJYXGOtAAoJEPWDqSZpMIYVW/4P/3bLOWj/zqZCXWyWW4EUVjRQ zWufmWWka84Kw9V7a8nEo5NN2DxJ/RqyYkZ34CH1AERvXoZFePwPx7iyWnG9pmpE STpQCT3mwH2wl+AOMVJKgzIIk8pC+zKQpXAg97raoiiVOuPa+zq1oJC/QRAdtEWZ QahvprZ15rW7PnSiuFf8V75r2zRXny9NuzXEljJvmq6RcLeWRWrHV4E6B0Zv5v1r Arq8/vhGC4vfdySEkzC4fk9OpKSr/o47LaT/yJmfmIc3Pa+pMT86YAqqeeeX54ya zYN5mLSDpOr3TJz88cbs0zumCxCKBRFIPuR4X+t05LIGX/WQw12naVyQqgvr/asN QyMQO58Xva7K4FkWHqznMolNaytvOw7OA1TrsS78nG4IOftyuwxB7k0grNRPusIE AQL/cohkq7no1dtpaNYD6OVBeYU7A6BFYZ3lX1+2fPnftIvlCDetLOKyD7uALPzh XE668739KkfyZCTwMU1uIbqL1Bw+LVnuCo4F43jpBAZYcRX9NDRx3IJFB/Yl6TrP 787l5oc5BE3ipceGf39Jzf8Ccg4DSvNWL5pOgGikTsMbHpJVn8VF5zyCSC4GYVoz LF75BjOnn/Frie6vu84SBQXkrT3aXsAHXWaUZxFtBuD3R6ZiX8qD0xH5nI7+mmUc 0lp2wVivmIMLygF3mMhn =5l7z -----END PGP SIGNATURE----- --Apple-Mail=_C1D28C36-72D4-4C33-943C-6990684F6C35-- From owner-svn-src-all@freebsd.org Thu Dec 22 23:39:13 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 45EE4C8D681; Thu, 22 Dec 2016 23:39:13 +0000 (UTC) (envelope-from hrs@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 06A451B60; Thu, 22 Dec 2016 23:39:12 +0000 (UTC) (envelope-from hrs@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBMNdClO004706; Thu, 22 Dec 2016 23:39:12 GMT (envelope-from hrs@FreeBSD.org) Received: (from hrs@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBMNdCGf004704; Thu, 22 Dec 2016 23:39:12 GMT (envelope-from hrs@FreeBSD.org) Message-Id: <201612222339.uBMNdCGf004704@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hrs set sender to hrs@FreeBSD.org using -f From: Hiroki Sato Date: Thu, 22 Dec 2016 23:39:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310434 - head/usr.bin/logger X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Dec 2016 23:39:13 -0000 Author: hrs Date: Thu Dec 22 23:39:11 2016 New Revision: 310434 URL: https://svnweb.freebsd.org/changeset/base/310434 Log: - Add -S option to specify the source address/port for UDP communication. - Document -S option. - Document that -h option supports AF_LOCAL. - Split preparation of UDP sockets in logmessage() into socksetup(). Modified: head/usr.bin/logger/logger.1 head/usr.bin/logger/logger.c Modified: head/usr.bin/logger/logger.1 ============================================================================== --- head/usr.bin/logger/logger.1 Thu Dec 22 22:30:42 2016 (r310433) +++ head/usr.bin/logger/logger.1 Thu Dec 22 23:39:11 2016 (r310434) @@ -28,7 +28,7 @@ .\" @(#)logger.1 8.1 (Berkeley) 6/6/93 .\" $FreeBSD$ .\" -.Dd March 21, 2015 +.Dd December 23, 2016 .Dt LOGGER 1 .Os .Sh NAME @@ -41,6 +41,7 @@ .Op Fl h Ar host .Op Fl P Ar port .Op Fl p Ar pri +.Op Fl S Ar addr Ns \&: Ns Ar port .Op Fl t Ar tag .Op Ar message ... .Sh DESCRIPTION @@ -80,6 +81,28 @@ This option is ignored when a message is Send the message to the remote system .Ar host instead of logging it locally. +Note that +.Nm +currently supports +.Li AF_INET +.Pq IPv4 , +.Li AF_INET6 +.Pq IPv6 , +and +.Li AF_LOCAL +.Pq Unix-domain socket +address families. +The following address formats are valid in +.Ar host : +.Pp +.Bl -tag -width "AF_LOCAL" -compact +.It Li AF_INET +192.168.2.1 +.It Li AF_INET6 +2001:db8::1 +.It Li AF_LOCAL +.Pa /var/run/log +.El .It Fl P Ar port Send the message to the specified .Ar port @@ -101,6 +124,20 @@ level in the .Ar local3 facility. The default is ``user.notice.'' +.It Fl S Ar addr Ns \&: Ns Ar port +Specify source address and/or source port when using +.Fl h +option. +The same address will be used for all of the remote addresses +when +.Fl A +flag is enabled. +Note that a numeric IPv6 address in +.Ar addr +must be enclosed with +.Qq \&[ +and +.Qq \&] . .It Fl t Ar tag Mark every line in the log with the specified .Ar tag Modified: head/usr.bin/logger/logger.c ============================================================================== --- head/usr.bin/logger/logger.c Thu Dec 22 22:30:42 2016 (r310433) +++ head/usr.bin/logger/logger.c Thu Dec 22 23:39:11 2016 (r310434) @@ -57,18 +57,22 @@ __FBSDID("$FreeBSD$"); #define SYSLOG_NAMES #include +#define sstosa(ss) ((struct sockaddr *)(void *)ss) + +struct socks { + int sk_sock; + int sk_addrlen; + struct sockaddr_storage sk_addr; +}; + static int decode(char *, const CODE *); static int pencode(char *); -static void logmessage(int, const char *, const char *, const char *, +static ssize_t socksetup(const char *, const char *, const char *, + struct socks **); +static void logmessage(int, const char *, struct socks *, ssize_t, const char *); static void usage(void); -struct socks { - int sock; - int addrlen; - struct sockaddr_storage addr; -}; - #ifdef INET6 static int family = PF_UNSPEC; /* protocol family (IPv4, IPv6 or both) */ #else @@ -85,17 +89,20 @@ static int send_to_all = 0; /* send mess int main(int argc, char *argv[]) { + struct socks *socks; + ssize_t nsock; int ch, logflags, pri; char *tag, *host, buf[1024]; - const char *svcname; + const char *svcname, *src; tag = NULL; host = NULL; svcname = "syslog"; + src = NULL; pri = LOG_USER | LOG_NOTICE; logflags = 0; unsetenv("TZ"); - while ((ch = getopt(argc, argv, "46Af:h:iP:p:st:")) != -1) + while ((ch = getopt(argc, argv, "46Af:h:iP:p:S:st:")) != -1) switch((char)ch) { case '4': family = PF_INET; @@ -128,6 +135,9 @@ main(int argc, char *argv[]) case 's': /* log to standard error */ logflags |= LOG_PERROR; break; + case 'S': /* source address */ + src = optarg; + break; case 't': /* tag */ tag = optarg; break; @@ -138,6 +148,16 @@ main(int argc, char *argv[]) argc -= optind; argv += optind; + if (host) { + nsock = socksetup(src, host, svcname, &socks); + if (nsock <= 0) + errx(1, "socket"); + } else { + if (src) + errx(1, "-h option is missing."); + nsock = 0; + } + if (tag == NULL) tag = getlogin(); /* setup for logging */ @@ -153,11 +173,11 @@ main(int argc, char *argv[]) for (p = buf, endp = buf + sizeof(buf) - 2; *argv;) { len = strlen(*argv); if (p + len > endp && p > buf) { - logmessage(pri, tag, host, svcname, buf); + logmessage(pri, tag, socks, nsock, buf); p = buf; } if (len > sizeof(buf) - 1) - logmessage(pri, tag, host, svcname, *argv++); + logmessage(pri, tag, socks, nsock, *argv++); else { if (p != buf) *p++ = ' '; @@ -166,78 +186,162 @@ main(int argc, char *argv[]) } } if (p != buf) - logmessage(pri, tag, host, svcname, buf); + logmessage(pri, tag, socks, nsock, buf); } else while (fgets(buf, sizeof(buf), stdin) != NULL) - logmessage(pri, tag, host, svcname, buf); + logmessage(pri, tag, socks, nsock, buf); exit(0); } +static ssize_t +socksetup(const char *src, const char *dst, const char *svcname, + struct socks **socks) +{ + struct addrinfo hints, *res, *res0; + struct sockaddr_storage *ss_src[AF_MAX]; + struct socks *sk; + ssize_t nsock = 0; + int error, maxs; + + memset(&ss_src[0], 0, sizeof(ss_src)); + if (src) { + char *p, *p0, *hs, *hbuf, *sbuf; + + hbuf = sbuf = NULL; + p0 = p = strdup(src); + if (p0 == NULL) + err(1, "strdup failed"); + hs = p0; /* point to search ":" */ +#ifdef INET6 + /* -S option supports IPv6 addr in "[2001:db8::1]:service". */ + if (*p0 == '[') { + p = strchr(p0, ']'); + if (p == NULL) + errx(1, "\"]\" not found in src addr"); + *p = '\0'; + /* hs points just after ']' (':' or '\0'). */ + hs = p + 1; + /* + * p points just after '[' while it points hs + * in the case of []. + */ + p = ((p0 + 1) == (hs - 1)) ? hs : p0 + 1; + } +#endif + if (*p != '\0') { + /* (p == hs) means ":514" or "[]:514". */ + hbuf = (p == hs && *p == ':') ? NULL : p; + p = strchr(hs, ':'); + if (p != NULL) { + *p = '\0'; + sbuf = (*(p + 1) != '\0') ? p + 1 : NULL; + } + } + hints = (struct addrinfo){ + .ai_family = family, + .ai_socktype = SOCK_DGRAM, + .ai_flags = AI_PASSIVE + }; + error = getaddrinfo(hbuf, sbuf, &hints, &res0); + if (error) + errx(1, "%s: %s", gai_strerror(error), src); + for (res = res0; res; res = res->ai_next) { + switch (res->ai_family) { + case AF_INET: +#ifdef INET6 + case AF_INET6: +#endif + if (ss_src[res->ai_family] != NULL) + continue; + ss_src[res->ai_family] = + malloc(sizeof(struct sockaddr_storage)); + if (ss_src[res->ai_family] == NULL) + err(1, "malloc failed"); + memcpy(ss_src[res->ai_family], res->ai_addr, + res->ai_addrlen); + } + } + freeaddrinfo(res0); + free(p0); + } + + /* resolve hostname */ + hints = (struct addrinfo){ + .ai_family = family, + .ai_socktype = SOCK_DGRAM + }; + error = getaddrinfo(dst, svcname, &hints, &res0); + if (error == EAI_SERVICE) { + warnx("%s/udp: unknown service", svcname); + error = getaddrinfo(dst, "514", &hints, &res); + } + if (error) + errx(1, "%s: %s", gai_strerror(error), dst); + /* count max number of sockets we may open */ + maxs = 0; + for (res = res0; res; res = res->ai_next) + maxs++; + sk = calloc(maxs, sizeof(*sk)); + if (sk == NULL) + errx(1, "couldn't allocate memory for sockets"); + for (res = res0; res; res = res->ai_next) { + int s; + + s = socket(res->ai_family, res->ai_socktype, + res->ai_protocol); + if (s < 0) + continue; + if (src && ss_src[res->ai_family] == NULL) + errx(1, "address family mismatch"); + + if (ss_src[res->ai_family]) { + error = bind(s, sstosa(ss_src[res->ai_family]), + ss_src[res->ai_family]->ss_len); + if (error < 0) + err(1, "bind"); + } + sk[nsock] = (struct socks){ + .sk_addrlen = res->ai_addrlen, + .sk_sock = s + }; + memcpy(&sk[nsock].sk_addr, res->ai_addr, res->ai_addrlen); + nsock++; + } + freeaddrinfo(res0); + + *socks = sk; + return (nsock); +} + /* * Send the message to syslog, either on the local host, or on a remote host */ static void -logmessage(int pri, const char *tag, const char *host, const char *svcname, - const char *buf) +logmessage(int pri, const char *tag, struct socks *sk, ssize_t nsock, + const char *buf) { - static struct socks *socks; - static int nsock = 0; - struct addrinfo hints, *res, *r; char *line; - int maxs, len, sock, error, i, lsent; + int len, i, lsent; - if (host == NULL) { + if (nsock == 0) { syslog(pri, "%s", buf); return; } - - if (nsock <= 0) { /* set up socket stuff */ - /* resolve hostname */ - memset(&hints, 0, sizeof(hints)); - hints.ai_family = family; - hints.ai_socktype = SOCK_DGRAM; - error = getaddrinfo(host, svcname, &hints, &res); - if (error == EAI_SERVICE) { - warnx("%s/udp: unknown service", svcname); - error = getaddrinfo(host, "514", &hints, &res); - } - if (error) - errx(1, "%s: %s", gai_strerror(error), host); - /* count max number of sockets we may open */ - for (maxs = 0, r = res; r; r = r->ai_next, maxs++); - socks = malloc(maxs * sizeof(struct socks)); - if (!socks) - errx(1, "couldn't allocate memory for sockets"); - for (r = res; r; r = r->ai_next) { - sock = socket(r->ai_family, r->ai_socktype, - r->ai_protocol); - if (sock < 0) - continue; - memcpy(&socks[nsock].addr, r->ai_addr, r->ai_addrlen); - socks[nsock].addrlen = r->ai_addrlen; - socks[nsock++].sock = sock; - } - freeaddrinfo(res); - if (nsock <= 0) - errx(1, "socket"); - } - if ((len = asprintf(&line, "<%d>%s: %s", pri, tag, buf)) == -1) errx(1, "asprintf"); lsent = -1; - for (i = 0; i < nsock; ++i) { - lsent = sendto(socks[i].sock, line, len, 0, - (struct sockaddr *)&socks[i].addr, - socks[i].addrlen); + for (i = 0; i < nsock; i++) { + lsent = sendto(sk[i].sk_sock, line, len, 0, + sstosa(&sk[i].sk_addr), sk[i].sk_addrlen); if (lsent == len && !send_to_all) break; } if (lsent != len) { if (lsent == -1) - warn ("sendto"); + warn("sendto"); else - warnx ("sendto: short send - %d bytes", lsent); + warnx("sendto: short send - %d bytes", lsent); } free(line); @@ -290,7 +394,7 @@ usage(void) { (void)fprintf(stderr, "usage: %s\n", "logger [-46Ais] [-f file] [-h host] [-P port] [-p pri] [-t tag]\n" - " [message ...]" + " [-S addr:port] [message ...]" ); exit(1); } From owner-svn-src-all@freebsd.org Thu Dec 22 23:59:55 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id F260CC8DDBF; Thu, 22 Dec 2016 23:59:54 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A2A30AB6; Thu, 22 Dec 2016 23:59:54 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBMNxrvb013288; Thu, 22 Dec 2016 23:59:53 GMT (envelope-from adrian@FreeBSD.org) Received: (from adrian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBMNxrh0013287; Thu, 22 Dec 2016 23:59:53 GMT (envelope-from adrian@FreeBSD.org) Message-Id: <201612222359.uBMNxrh0013287@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: adrian set sender to adrian@FreeBSD.org using -f From: Adrian Chadd Date: Thu, 22 Dec 2016 23:59:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310435 - head/sys/net80211 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Dec 2016 23:59:55 -0000 Author: adrian Date: Thu Dec 22 23:59:53 2016 New Revision: 310435 URL: https://svnweb.freebsd.org/changeset/base/310435 Log: [net80211] WEP offload support. Yes, the ath10k NIC actually also does do WEP TX/RX offload. Tested: * ath10k driver port, WEP STA mode. Modified: head/sys/net80211/ieee80211_crypto_wep.c Modified: head/sys/net80211/ieee80211_crypto_wep.c ============================================================================== --- head/sys/net80211/ieee80211_crypto_wep.c Thu Dec 22 23:39:11 2016 (r310434) +++ head/sys/net80211/ieee80211_crypto_wep.c Thu Dec 22 23:59:53 2016 (r310435) @@ -180,10 +180,22 @@ wep_encap(struct ieee80211_key *k, struc { struct wep_ctx *ctx = k->wk_private; struct ieee80211com *ic = ctx->wc_ic; + struct ieee80211_frame *wh; uint8_t *ivp; int hdrlen; + int is_mgmt; hdrlen = ieee80211_hdrspace(ic, mtod(m, void *)); + wh = mtod(m, struct ieee80211_frame *); + is_mgmt = IEEE80211_IS_MGMT(wh); + + /* + * Check to see if IV is required. + */ + if (is_mgmt && (k->wk_flags & IEEE80211_KEY_NOIVMGT)) + return 1; + if ((! is_mgmt) && (k->wk_flags & IEEE80211_KEY_NOIV)) + return 1; /* * Copy down 802.11 header and add the IV + KeyID. @@ -228,9 +240,15 @@ wep_decap(struct ieee80211_key *k, struc struct wep_ctx *ctx = k->wk_private; struct ieee80211vap *vap = ctx->wc_vap; struct ieee80211_frame *wh; + const struct ieee80211_rx_stats *rxs; wh = mtod(m, struct ieee80211_frame *); + rxs = ieee80211_get_rx_params_ptr(m); + + if ((rxs != NULL) && (rxs->c_pktflags & IEEE80211_RX_F_IV_STRIP)) + goto finish; + /* * Check if the device handled the decrypt in hardware. * If so we just strip the header; otherwise we need to @@ -249,6 +267,9 @@ wep_decap(struct ieee80211_key *k, struc */ ovbcopy(mtod(m, void *), mtod(m, uint8_t *) + wep.ic_header, hdrlen); m_adj(m, wep.ic_header); + +finish: + /* XXX TODO: do we have to strip this for offload devices? */ m_adj(m, -wep.ic_trailer); return 1; From owner-svn-src-all@freebsd.org Fri Dec 23 00:05:14 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 843B8C8B057 for ; Fri, 23 Dec 2016 00:05:14 +0000 (UTC) (envelope-from mailing-machine@vniz.net) Received: from mail-lf0-f65.google.com (mail-lf0-f65.google.com [209.85.215.65]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 17AAC103E for ; Fri, 23 Dec 2016 00:05:13 +0000 (UTC) (envelope-from mailing-machine@vniz.net) Received: by mail-lf0-f65.google.com with SMTP id t196so1405760lff.3 for ; Thu, 22 Dec 2016 16:05:13 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:references:cc:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding; bh=uCvqWoD+F0lkfVLjtRrrGW05TVbuaf6p2UDwhJdSnJQ=; b=FTHL/2VjuwkM1gpFRV2mrHKJjGYTnvkizzWKYjpNBbK4QA1UzN9f70aTxEhhzmjNNB jrCkC/fShwKy4h6D7v9MKn0QZym/vHcdeX+BG4UyIDLVdVQMRCCroUZrYnmEpEZtLXv/ 4tU1zXc8vVFIlgwylMBaGue1A52NBfwQTB9mlU8mJSMX+32t8CaeCZ/W12xR6ncVOH3T sWbFZFxpqdNPeI3EcTn5AwE+eDlfzz4zh/HYhF2dcoEz21a4mC6YD3q1oWr+3Asc8CVE /OnBfoAhdvqdcYQPYcDuqerZkxZimyHNG+zQxUDVK2QPAqayqI9Iq6UoBoepao/sNWLe Z/GA== X-Gm-Message-State: AIkVDXJ0yRbNSGjCTg2FLUcMcroP9NEUXwU8/XNTR6w1BLCYmkea6h5YrDGQx6J6dS9PWg== X-Received: by 10.46.74.10 with SMTP id x10mr5195152lja.8.1482451505724; Thu, 22 Dec 2016 16:05:05 -0800 (PST) Received: from [192.168.1.2] ([89.169.173.68]) by smtp.gmail.com with ESMTPSA id p9sm556125lfd.49.2016.12.22.16.05.04 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 22 Dec 2016 16:05:05 -0800 (PST) Subject: Re: svn commit: r310433 - head/lib/libc/stdio To: cem@freebsd.org, Ngie Cooper References: <201612222230.uBMMUge9075128@repo.freebsd.org> Cc: src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org From: Andrey Chernov Message-ID: Date: Fri, 23 Dec 2016 03:05:04 +0300 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.5.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Dec 2016 00:05:14 -0000 On 23.12.2016 1:39, Conrad Meyer wrote: > This was unjustified and inappropriate. I don't think so. While being able to back it out or fix it by another way by yourself, you just doing nothing for several days. Your personal reasons of inability to act properly so long time weights less than project consistency at whole, so backing it out from anybody is justified and appropriate in such situations. > On Thu, Dec 22, 2016 at 2:30 PM, Ngie Cooper wrote: >> Author: ngie >> Date: Thu Dec 22 22:30:42 2016 >> New Revision: 310433 >> URL: https://svnweb.freebsd.org/changeset/base/310433 >> >> Log: >> Revert r310138 >> >> Adding %b support to vfprintf for parity with kernel space requires >> more discussion/review. >> >> In particular, many parties were concerned over introducing a >> non-standard format qualifier to *printf(3) which didn't already >> exist in other OSes, e.g. Linux, thus making code which used %b >> harder to port to other operating systems. >> >> Requested by: many >> >> Modified: >> head/lib/libc/stdio/vfprintf.c >> >> Modified: head/lib/libc/stdio/vfprintf.c >> ============================================================================== >> --- head/lib/libc/stdio/vfprintf.c Thu Dec 22 21:56:41 2016 (r310432) >> +++ head/lib/libc/stdio/vfprintf.c Thu Dec 22 22:30:42 2016 (r310433) >> @@ -611,37 +611,6 @@ reswitch: switch (ch) { >> case 'z': >> flags |= SIZET; >> goto rflag; >> - case 'b': >> - { >> - const char *q; >> - int anybitset, bit; >> - >> - ulval = (u_int)GETARG(int); >> - cp = GETARG(char *); >> - >> - q = __ultoa(ulval, buf + BUF, *cp++, 0, xdigs_lower); >> - PRINT(q, buf + BUF - q); >> - >> - if (ulval == 0) >> - break; >> - >> - for (anybitset = 0; *cp;) { >> - bit = *cp++; >> - if (ulval & (1 << (bit - 1))) { >> - PRINT(anybitset ? "," : "<", 1); >> - q = cp; >> - for (; (bit = *cp) > ' '; ++cp) >> - continue; >> - PRINT(q, cp - q); >> - anybitset = 1; >> - } else >> - for (; *cp > ' '; ++cp) >> - continue; >> - } >> - if (anybitset) >> - PRINT(">", 1); >> - } >> - continue; >> case 'C': >> flags |= LONGINT; >> /*FALLTHROUGH*/ >> > From owner-svn-src-all@freebsd.org Fri Dec 23 00:38:44 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id DE048C8B969; Fri, 23 Dec 2016 00:38:44 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 8E0941E17; Fri, 23 Dec 2016 00:38:44 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBN0ch2M029261; Fri, 23 Dec 2016 00:38:43 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBN0chRm029259; Fri, 23 Dec 2016 00:38:43 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201612230038.uBN0chRm029259@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Fri, 23 Dec 2016 00:38:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r310436 - stable/11/sys/kern X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Dec 2016 00:38:45 -0000 Author: jhb Date: Fri Dec 23 00:38:43 2016 New Revision: 310436 URL: https://svnweb.freebsd.org/changeset/base/310436 Log: MFC 308948: Initialize 'ticks' earlier in boot after 'hz' is set. This avoids the time-warp after kthreads have started running and the required fixup to td_slptick and td_blktick in the EARLY_AP_STARTUP case. Now, 'ticks' is initialized before any kthreads are created or any context switches are performed. Modified: stable/11/sys/kern/kern_clock.c stable/11/sys/kern/subr_param.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/kern/kern_clock.c ============================================================================== --- stable/11/sys/kern/kern_clock.c Thu Dec 22 23:59:53 2016 (r310435) +++ stable/11/sys/kern/kern_clock.c Fri Dec 23 00:38:43 2016 (r310436) @@ -393,10 +393,6 @@ static void initclocks(dummy) void *dummy; { -#ifdef EARLY_AP_STARTUP - struct proc *p; - struct thread *td; -#endif register int i; /* @@ -416,40 +412,6 @@ initclocks(dummy) #ifdef SW_WATCHDOG EVENTHANDLER_REGISTER(watchdog_list, watchdog_config, NULL, 0); #endif - /* - * Arrange for ticks to wrap 10 minutes after boot to help catch - * sign problems sooner. - */ - ticks = INT_MAX - (hz * 10 * 60); - -#ifdef EARLY_AP_STARTUP - /* - * Fixup the tick counts in any blocked or sleeping threads to - * account for the jump above. - */ - sx_slock(&allproc_lock); - FOREACH_PROC_IN_SYSTEM(p) { - PROC_LOCK(p); - if (p->p_state == PRS_NEW) { - PROC_UNLOCK(p); - continue; - } - FOREACH_THREAD_IN_PROC(p, td) { - thread_lock(td); - if (TD_ON_LOCK(td)) { - MPASS(td->td_blktick == 0); - td->td_blktick = ticks; - } - if (TD_ON_SLEEPQ(td)) { - MPASS(td->td_slptick == 0); - td->td_slptick = ticks; - } - thread_unlock(td); - } - PROC_UNLOCK(p); - } - sx_sunlock(&allproc_lock); -#endif } /* Modified: stable/11/sys/kern/subr_param.c ============================================================================== --- stable/11/sys/kern/subr_param.c Thu Dec 22 23:59:53 2016 (r310435) +++ stable/11/sys/kern/subr_param.c Fri Dec 23 00:38:43 2016 (r310436) @@ -171,6 +171,12 @@ init_param1(void) tick_sbt = SBT_1S / hz; tick_bt = sbttobt(tick_sbt); + /* + * Arrange for ticks to wrap 10 minutes after boot to help catch + * sign problems sooner. + */ + ticks = INT_MAX - (hz * 10 * 60); + #ifdef VM_SWZONE_SIZE_MAX maxswzone = VM_SWZONE_SIZE_MAX; #endif From owner-svn-src-all@freebsd.org Fri Dec 23 01:18:37 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B3867C8C403; Fri, 23 Dec 2016 01:18:37 +0000 (UTC) (envelope-from hiren@strugglingcoder.info) Received: from mail.strugglingcoder.info (strugglingcoder.info [104.236.146.68]) by mx1.freebsd.org (Postfix) with ESMTP id A3DBD10EC; Fri, 23 Dec 2016 01:18:37 +0000 (UTC) (envelope-from hiren@strugglingcoder.info) Received: from localhost (unknown [10.1.1.3]) (Authenticated sender: hiren@strugglingcoder.info) by mail.strugglingcoder.info (Postfix) with ESMTPA id B64BF17A00; Thu, 22 Dec 2016 17:18:31 -0800 (PST) Date: Thu, 22 Dec 2016 17:18:31 -0800 From: hiren panchasara To: Andrey Chernov Cc: cem@freebsd.org, Ngie Cooper , src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r310433 - head/lib/libc/stdio Message-ID: <20161223011831.GI82166@strugglingcoder.info> References: <201612222230.uBMMUge9075128@repo.freebsd.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="dYuLH7fbMjVsPkFl" Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.23 (2014-03-12) X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Dec 2016 01:18:37 -0000 --dYuLH7fbMjVsPkFl Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On 12/23/16 at 03:05P, Andrey Chernov wrote: > On 23.12.2016 1:39, Conrad Meyer wrote: > > This was unjustified and inappropriate. >=20 > I don't think so. While being able to back it out or fix it by another > way by yourself, you just doing nothing for several days. Your personal > reasons of inability to act properly so long time weights less than > project consistency at whole, so backing it out from anybody is > justified and appropriate in such situations. Conrad, As Andrey rightly said, you didn't respond to all raised concerns neither did you revert your commit (which was the majority vote anyways). So I'd say, it is totally justified and appropriate. Cheers, Hiren --dYuLH7fbMjVsPkFl Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQF8BAABCgBmBQJYXHtkXxSAAAAAAC4AKGlzc3Vlci1mcHJAbm90YXRpb25zLm9w ZW5wZ3AuZmlmdGhob3JzZW1hbi5uZXRBNEUyMEZBMUQ4Nzg4RjNGMTdFNjZGMDI4 QjkyNTBFMTU2M0VERkU1AAoJEIuSUOFWPt/lpccH/3vo2cFoLe0r3e7P746ns8oR U2eHFsnjJguaCeUQ9Q9se9SlNDP5wxCGZBAjMyp0SN33zkLd3339h1SjSUeI+V34 XkXrh0ZzvEhbh9+rDJGfk4v7oHZo18Cwc9DQi+RRybAhEnAt3FTuTbPO4klwSJri UXKB4NPGS9AGyhaPEImRvGAApiJMzqVyTr+LUajQtH1vTpGQu8Tx4jmg3O5GHCoP 5Co/VZWsUvcHhlvmRQnTUeQJT76VpU1m+kYI621Bcj+tzTQsOQR7sjQTToFnPZBW rUr6oidrd6FbG2y0Cmte1JhapuRzqWNvoHlSGJEIwhgUOxVa0XMFp6ARC+7EGFI= =fZ4z -----END PGP SIGNATURE----- --dYuLH7fbMjVsPkFl-- From owner-svn-src-all@freebsd.org Fri Dec 23 02:57:01 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C9088C8DCB8; Fri, 23 Dec 2016 02:57:01 +0000 (UTC) (envelope-from sjg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 97AAC1B6A; Fri, 23 Dec 2016 02:57:01 +0000 (UTC) (envelope-from sjg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBN2v0po085650; Fri, 23 Dec 2016 02:57:00 GMT (envelope-from sjg@FreeBSD.org) Received: (from sjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBN2v0tO085644; Fri, 23 Dec 2016 02:57:00 GMT (envelope-from sjg@FreeBSD.org) Message-Id: <201612230257.uBN2v0tO085644@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sjg set sender to sjg@FreeBSD.org using -f From: "Simon J. Gerraty" Date: Fri, 23 Dec 2016 02:57:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310437 - head/share/mk X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Dec 2016 02:57:01 -0000 Author: sjg Date: Fri Dec 23 02:57:00 2016 New Revision: 310437 URL: https://svnweb.freebsd.org/changeset/base/310437 Log: Update meta* from bmake-20161212 Modified: head/share/mk/dirdeps.mk head/share/mk/gendirdeps.mk head/share/mk/meta.stage.mk head/share/mk/meta2deps.py head/share/mk/meta2deps.sh Modified: head/share/mk/dirdeps.mk ============================================================================== --- head/share/mk/dirdeps.mk Fri Dec 23 00:38:43 2016 (r310436) +++ head/share/mk/dirdeps.mk Fri Dec 23 02:57:00 2016 (r310437) @@ -1,5 +1,5 @@ # $FreeBSD$ -# $Id: dirdeps.mk,v 1.73 2016/08/15 19:28:13 sjg Exp $ +# $Id: dirdeps.mk,v 1.84 2016/11/27 02:44:34 sjg Exp $ # Copyright (c) 2010-2013, Juniper Networks, Inc. # All rights reserved. @@ -57,9 +57,12 @@ # .MAKE.DEPENDFILE_PREFIX) to refer to these makefiles to # distinguish them from others. # -# Each Makefile.depend file sets DEP_RELDIR to be the -# the RELDIR (path relative to SRCTOP) for its directory, and -# since each Makefile.depend file includes dirdeps.mk, this +# Before each Makefile.depend file is read, we set +# DEP_RELDIR to be the the RELDIR (path relative to SRCTOP) for +# its directory, and DEP_MACHINE etc according to the . +# represented by the suffix of the corresponding target. +# +# Since each Makefile.depend file includes dirdeps.mk, this # processing is recursive and results in .MAKE.LEVEL 0 learning the # dependencies of the tree wrt the initial directory (_DEP_RELDIR). # @@ -111,6 +114,29 @@ # # as we may need it to find Makefile.depend* # TARGET_SPEC = ${TARGET_SPEC_VARS:@v@${$v:U}@:ts,} # +# The following variables can influence the initial DIRDEPS +# computation with regard to the TARGET_SPECs that will be +# built. +# Most should also be considered by init.mk +# +# ONLY_TARGET_SPEC_LIST +# Defines a list of TARGET_SPECs for which the current +# directory can be built. +# If ALL_MACHINES is defined, we build for all the +# TARGET_SPECs listed. +# +# ONLY_MACHINE_LIST +# As for ONLY_TARGET_SPEC_LIST but only specifies +# MACHINEs. +# +# NOT_TARGET_SPEC_LIST +# A list of TARGET_SPECs for which the current +# directory should not be built. +# +# NOT_MACHINE_LIST +# A list of MACHINEs the current directory should not be +# built for. +# # touch this at your peril _DIRDEP_USE_LEVEL?= 0 @@ -172,9 +198,13 @@ DEP_$v ?= ${$v} # we compute below are fully qualified wrt DEP_TARGET_SPEC. # The makefiles may only partially specify (eg. MACHINE only), # so we need to construct a set of modifiers to fill in the gaps. -# jot 10 should output 1 2 3 .. 10 -JOT ?= jot -_tspec_x := ${${JOT} ${TARGET_SPEC_VARS:[#]}:L:sh} +.if ${TARGET_SPEC_VARS:[#]} > 10 +# seriously? better have jot(1) or equivalent to produce suitable sequence +_tspec_x := ${${JOT:Ujot} ${TARGET_SPEC_VARS:[#]}:L:sh} +.else +# we can provide the sequence ourselves +_tspec_x := ${1 2 3 4 5 6 7 8 9 10:L:[1..${TARGET_SPEC_VARS:[#]}]} +.endif # this handles unqualified entries M_dep_qual_fixes = C;(/[^/.,]+)$$;\1.$${DEP_TARGET_SPEC}; # there needs to be at least one item missing for these to make sense @@ -288,6 +318,18 @@ _DEP_RELDIR := ${DEP_RELDIR} .endif +# DIRDEPS_CACHE can be very handy for debugging. +# Also if repeatedly building the same target, +# we can avoid the overhead of re-computing the tree dependencies. +MK_DIRDEPS_CACHE ?= no +BUILD_DIRDEPS_CACHE ?= no +BUILD_DIRDEPS ?= yes + +.if ${MK_DIRDEPS_CACHE} == "yes" +# this is where we will cache all our work +DIRDEPS_CACHE ?= ${_OBJDIR:tA}/dirdeps.cache${.TARGETS:Nall:O:u:ts-:S,/,_,g:S,^,.,:N.} +.endif + # pickup customizations # as below you can use !target(_DIRDEP_USE) to protect things # which should only be done once. @@ -306,8 +348,10 @@ SKIP_DIR.host += ${SKIP_HOSTDIR} DEP_SKIP_DIR = ${SKIP_DIR} \ ${SKIP_DIR.${DEP_TARGET_SPEC}:U} \ - ${SKIP_DIR.${DEP_MACHINE}:U} \ - ${SKIP_DIRDEPS.${DEP_MACHINE}:U} + ${TARGET_SPEC_VARS:@v@${SKIP_DIR.${DEP_$v}:U}@} \ + ${SKIP_DIRDEPS.${DEP_TARGET_SPEC}:U} \ + ${TARGET_SPEC_VARS:@v@${SKIP_DIRDEPS.${DEP_$v}:U}@} + NSkipDir = ${DEP_SKIP_DIR:${M_ListToSkip}} @@ -345,7 +389,7 @@ _DIRDEP_USE: .USE .MAKE .ifdef ALL_MACHINES # this is how you limit it to only the machines we have been built for # previously. -.if empty(ONLY_MACHINE_LIST) +.if empty(ONLY_TARGET_SPEC_LIST) && empty(ONLY_MACHINE_LIST) .if !empty(ALL_MACHINE_LIST) # ALL_MACHINE_LIST is the list of all legal machines - ignore anything else _machine_list != cd ${_CURDIR} && 'ls' -1 ${ALL_MACHINE_LIST:O:u:@m@${.MAKE.DEPENDFILE:T:R}.$m@} 2> /dev/null; echo @@ -354,7 +398,7 @@ _machine_list != 'ls' -1 ${_CURDIR}/${.M .endif _only_machines := ${_machine_list:${NIgnoreFiles:UN*.bak}:E:O:u} .else -_only_machines := ${ONLY_MACHINE_LIST} +_only_machines := ${ONLY_TARGET_SPEC_LIST:U} ${ONLY_MACHINE_LIST:U} .endif .if empty(_only_machines) @@ -363,30 +407,35 @@ _only_machines := ${TARGET_MACHINE:U${AL .endif .else # ! ALL_MACHINES -# if ONLY_MACHINE_LIST is set, we are limited to that +# if ONLY_TARGET_SPEC_LIST or ONLY_MACHINE_LIST is set, we are limited to that. +# Note that ONLY_TARGET_SPEC_LIST should be fully qualified. # if TARGET_MACHINE is set - it is really the same as ONLY_MACHINE_LIST # otherwise DEP_MACHINE is it - so DEP_MACHINE will match. +_only_machines := ${ONLY_TARGET_SPEC_LIST:U:M${DEP_MACHINE},*} +.if empty(_only_machines) _only_machines := ${ONLY_MACHINE_LIST:U${TARGET_MACHINE:U${DEP_MACHINE}}:M${DEP_MACHINE}} .endif +.endif .if !empty(NOT_MACHINE_LIST) _only_machines := ${_only_machines:${NOT_MACHINE_LIST:${M_ListToSkip}}} .endif +.if !empty(NOT_TARGET_SPEC_LIST) +# we must first qualify +_dm := ${DEP_MACHINE} +_only_machines := ${_only_machines:M*,*} ${_only_machines:N*,*:@DEP_MACHINE@${DEP_TARGET_SPEC}@:S,^,.,:${M_dep_qual_fixes:ts:}:O:u:S,^.,,} +DEP_MACHINE := ${_dm} +_only_machines := ${_only_machines:${NOT_TARGET_SPEC_LIST:${M_ListToSkip}}} +.endif +# clean up +_only_machines := ${_only_machines:O:u} # make sure we have a starting place? DIRDEPS ?= ${RELDIR} .endif # target -# if repeatedly building the same target, -# we can avoid the overhead of re-computing the tree dependencies. -MK_DIRDEPS_CACHE ?= no -BUILD_DIRDEPS_CACHE ?= no -BUILD_DIRDEPS ?= yes - .if !defined(NO_DIRDEPS) && !defined(NO_DIRDEPS_BELOW) .if ${MK_DIRDEPS_CACHE} == "yes" -# this is where we will cache all our work -DIRDEPS_CACHE?= ${_OBJDIR:tA}/dirdeps.cache${.TARGETS:Nall:O:u:ts-:S,/,_,g:S,^,.,:N.} # just ensure this exists build-dirdeps: @@ -421,6 +470,7 @@ ${DIRDEPS_CACHE}: .META .NOMETA_CMP } > ${.TARGET}.new +@MAKELEVEL=${.MAKE.LEVEL} DIRDEPS_CACHE=${DIRDEPS_CACHE} \ DIRDEPS="${DIRDEPS}" \ + TARGET_SPEC=${TARGET_SPEC} \ MAKEFLAGS= ${.MAKE} -C ${_CURDIR} -f ${BUILD_DIRDEPS_MAKEFILE} \ ${BUILD_DIRDEPS_TARGETS} BUILD_DIRDEPS_CACHE=yes \ .MAKE.DEPENDFILE=.none \ @@ -490,8 +540,10 @@ _machines := ${_machines:O:u} _dm := ${DEP_MACHINE} # apply the same filtering that we do when qualifying DIRDEPS. # M_dep_qual_fixes expects .${MACHINE}* so add (and remove) '.' -_machines := ${_machines:@DEP_MACHINE@${DEP_TARGET_SPEC}@:S,^,.,:${M_dep_qual_fixes:ts:}:O:u:S,^.,,} +# Again we expect that any already qualified machines are fully qualified. +_machines := ${_machines:M*,*} ${_machines:N*,*:@DEP_MACHINE@${DEP_TARGET_SPEC}@:S,^,.,:${M_dep_qual_fixes:ts:}:O:u:S,^.,,} DEP_MACHINE := ${_dm} +_machines := ${_machines:O:u} .endif # reset each time through @@ -523,7 +575,7 @@ _build_dirs += ${_machines:N${DEP_TARGET # these we reset each time through as they can depend on DEP_MACHINE DEP_DIRDEPS_FILTER = \ ${DIRDEPS_FILTER.${DEP_TARGET_SPEC}:U} \ - ${DIRDEPS_FILTER.${DEP_MACHINE}:U} \ + ${TARGET_SPEC_VARS:@v@${DIRDEPS_FILTER.${DEP_$v}:U}@} \ ${DIRDEPS_FILTER:U} .if empty(DEP_DIRDEPS_FILTER) # something harmless @@ -622,6 +674,19 @@ _dirdeps_checked.$d: .endif # Note: _build_all_dirs is fully qualifed so d:R is always the directory .if exists(${d:R}) +# we pass _DEP_TARGET_SPEC to tell the next step what we want +_DEP_TARGET_SPEC := ${d:E} +# some makefiles may still look at this +_DEP_MACHINE := ${d:E:C/,.*//} +# set these too in case Makefile.depend* uses them +.if ${TARGET_SPEC_VARS:[#]} > 1 +_dtspec := ${_DEP_TARGET_SPEC:S/,/ /g} +.for i in ${_tspec_x} +DEP_${TARGET_SPEC_VARS:[$i]} := ${_dtspec:[$i]} +.endfor +.else +DEP_MACHINE := ${_DEP_MACHINE} +.endif # Warning: there is an assumption here that MACHINE is always # the first entry in TARGET_SPEC_VARS. # If TARGET_SPEC and MACHINE are insufficient, you have a problem. @@ -632,10 +697,6 @@ _qm := ${_m:C;(\.depend)$;\1.${d:E};:${M .if ${_debug_search} .info Looking for ${_qm} .endif -# we pass _DEP_TARGET_SPEC to tell the next step what we want -_DEP_TARGET_SPEC := ${d:E} -# some makefiles may still look at this -_DEP_MACHINE := ${d:E:C/,.*//} # set this "just in case" # we can skip :tA since we computed the path above DEP_RELDIR := ${_m:H:S,${SRCTOP}/,,} @@ -688,7 +749,7 @@ _src != cd ${.CURDIR} && for m in ${.MAK _src?= ${.MAKE.DEPENDFILE} -.MAKE.DEPENDFILE_BOOTSTRAP_SED+= -e 's,${_src:E},${MACHINE},g' +.MAKE.DEPENDFILE_BOOTSTRAP_SED+= -e 's/${_src:E:C/,.*//}/${MACHINE}/g' # just create Makefile.depend* for this dir bootstrap-this: .NOTMAIN Modified: head/share/mk/gendirdeps.mk ============================================================================== --- head/share/mk/gendirdeps.mk Fri Dec 23 00:38:43 2016 (r310436) +++ head/share/mk/gendirdeps.mk Fri Dec 23 02:57:00 2016 (r310437) @@ -1,5 +1,5 @@ # $FreeBSD$ -# $Id: gendirdeps.mk,v 1.30 2016/02/27 00:20:39 sjg Exp $ +# $Id: gendirdeps.mk,v 1.33 2016/10/11 22:37:28 sjg Exp $ # Copyright (c) 2010-2013, Juniper Networks, Inc. # All rights reserved. @@ -147,6 +147,9 @@ M2D_OBJROOTS += ${OBJTOP} ${_OBJROOT} ${ .if defined(SB_OBJROOT) M2D_OBJROOTS += ${SB_OBJROOT} .endif +.if defined(STAGE_ROOT) +M2D_OBJROOTS += ${STAGE_ROOT} +.endif .if ${.MAKE.DEPENDFILE_PREFERENCE:U${.MAKE.DEPENDFILE}:M*.${MACHINE}} == "" # meta2deps.py only groks objroot # so we need to give it what it expects Modified: head/share/mk/meta.stage.mk ============================================================================== --- head/share/mk/meta.stage.mk Fri Dec 23 00:38:43 2016 (r310436) +++ head/share/mk/meta.stage.mk Fri Dec 23 02:57:00 2016 (r310437) @@ -1,5 +1,5 @@ # $FreeBSD$ -# $Id: meta.stage.mk,v 1.45 2016/05/26 03:59:09 sjg Exp $ +# $Id: meta.stage.mk,v 1.47 2016/12/07 23:07:49 sjg Exp $ # # @(#) Copyright (c) 2011, Simon J. Gerraty # @@ -59,7 +59,7 @@ GENDIRDEPS_FILTER += Nnot-empty-is-impor LN_CP_SCRIPT = LnCp() { \ rm -f $$2 2> /dev/null; \ - { [ -z "$$mode" ] && ln $$1 $$2 2> /dev/null; } || \ + { [ -z "$$mode" ] && ${LN:Uln} $$1 $$2 2> /dev/null; } || \ cp -p $$1 $$2; } # a staging conflict should cause an error @@ -220,19 +220,29 @@ stage_symlinks: .dirdep .if !empty(STAGE_AS_SETS) CLEANFILES += ${STAGE_AS_SETS:@s@stage*$s@} -STAGE_TARGETS += stage_as +STAGE_TARGETS += stage_as stage_as_and_symlink # sometimes things need to be renamed as they are staged # each ${file} will be staged as ${STAGE_AS_${file:T}} # one could achieve the same with SYMLINKS +# stage_as_and_symlink makes the original name a symlink to the new name +# it is the same as using stage_as and stage_symlinks but ensures +# both operations happen together .for s in ${STAGE_AS_SETS:O:u} STAGE_AS.$s ?= ${.ALLSRC:N.dirdep:Nstage_*} +STAGE_AS_AND_SYMLINK.$s ?= ${.ALLSRC:N.dirdep:Nstage_*} stage_as: stage_as.$s stage_as.$s: .dirdep @${STAGE_AS_SCRIPT}; StageAs ${FLAGS.$@} ${STAGE_FILES_DIR.$s:U${STAGE_DIR.$s}:${STAGE_DIR_FILTER}} ${STAGE_AS.$s:@f@$f ${STAGE_AS_${f:tA}:U${STAGE_AS_${f:T}:U${f:T}}}@} @touch $@ +stage_as_and_symlink: stage_as_and_symlink.$s +stage_as_and_symlink.$s: .dirdep + @${STAGE_AS_SCRIPT}; StageAs ${FLAGS.$@} ${STAGE_FILES_DIR.$s:U${STAGE_DIR.$s}:${STAGE_DIR_FILTER}} ${STAGE_AS_AND_SYMLINK.$s:@f@$f ${STAGE_AS_${f:tA}:U${STAGE_AS_${f:T}:U${f:T}}}@} + @${STAGE_LINKS_SCRIPT}; StageLinks -s ${STAGE_FILES_DIR.$s:U${STAGE_DIR.$s}:${STAGE_DIR_FILTER}} ${STAGE_AS_AND_SYMLINK.$s:@f@${STAGE_AS_${f:tA}:U${STAGE_AS_${f:T}:U${f:T}}} $f@} + @touch $@ + .endfor .endif Modified: head/share/mk/meta2deps.py ============================================================================== --- head/share/mk/meta2deps.py Fri Dec 23 00:38:43 2016 (r310436) +++ head/share/mk/meta2deps.py Fri Dec 23 02:57:00 2016 (r310437) @@ -1,4 +1,3 @@ -# $FreeBSD$ #!/usr/bin/env python from __future__ import print_function @@ -38,7 +37,8 @@ We only pay attention to a subset of the """ RCSid: - $Id: meta2deps.py,v 1.19 2016/04/02 20:45:40 sjg Exp $ + $FreeBSD$ + $Id: meta2deps.py,v 1.22 2016/12/12 19:07:42 sjg Exp $ Copyright (c) 2011-2013, Juniper Networks, Inc. All rights reserved. @@ -114,7 +114,7 @@ def abspath(path, cwd, last_dir=None, de if rpath: path = rpath if (path.find('/') < 0 or - path.find('./') > 0 or + path.find('./') > 0 or path.endswith('/..') or os.path.islink(path)): return os.path.realpath(path) @@ -154,38 +154,38 @@ class MetaFile: """if name is set we will parse it now. conf can have the follwing keys: - SRCTOPS list of tops of the src tree(s). + SRCTOPS list of tops of the src tree(s). - CURDIR the src directory 'bmake' was run from. + CURDIR the src directory 'bmake' was run from. - RELDIR the relative path from SRCTOP to CURDIR + RELDIR the relative path from SRCTOP to CURDIR - MACHINE the machine we built for. - set to 'none' if we are not cross-building. - More specifically if machine cannot be deduced from objdirs. + MACHINE the machine we built for. + set to 'none' if we are not cross-building. + More specifically if machine cannot be deduced from objdirs. TARGET_SPEC - Sometimes MACHINE isn't enough. + Sometimes MACHINE isn't enough. HOST_TARGET - when we build for the pseudo machine 'host' - the object tree uses HOST_TARGET rather than MACHINE. + when we build for the pseudo machine 'host' + the object tree uses HOST_TARGET rather than MACHINE. OBJROOTS a list of the common prefix for all obj dirs it might - end in '/' or '-'. + end in '/' or '-'. - DPDEPS names an optional file to which per file dependencies - will be appended. - For example if 'some/path/foo.h' is read from SRCTOP - then 'DPDEPS_some/path/foo.h +=' "RELDIR" is output. - This can allow 'bmake' to learn all the dirs within - the tree that depend on 'foo.h' - - EXCLUDES - A list of paths to ignore. - ccache(1) can otherwise be trouble. + DPDEPS names an optional file to which per file dependencies + will be appended. + For example if 'some/path/foo.h' is read from SRCTOP + then 'DPDEPS_some/path/foo.h +=' "RELDIR" is output. + This can allow 'bmake' to learn all the dirs within + the tree that depend on 'foo.h' + + EXCLUDES + A list of paths to ignore. + ccache(1) can otherwise be trouble. - debug desired debug level + debug desired debug level debug_out open file to send debug output to (sys.stderr) @@ -229,8 +229,9 @@ class MetaFile: if objroot.endswith(e): # this is not what we want - fix it objroot = objroot[0:-len(e)] - if e.endswith('/'): - objroot += '/' + + if objroot[-1] != '/': + objroot += '/' if not objroot in self.objroots: self.objroots.append(objroot) _objroot = os.path.realpath(objroot) @@ -293,6 +294,9 @@ class MetaFile: return None for f in sort_unique(self.file_deps): print('DPDEPS_%s += %s' % (f, self.reldir), file=out) + # these entries provide for reverse DIRDEPS lookup + for f in self.obj_deps: + print('DEPDIRS_%s += %s' % (f, self.reldir), file=out) def seenit(self, dir): """rememer that we have seen dir.""" @@ -360,28 +364,28 @@ class MetaFile: def parse(self, name=None, file=None): """A meta file looks like: - # Meta data file "path" - CMD "command-line" - CWD "cwd" - TARGET "target" - -- command output -- - -- filemon acquired metadata -- - # buildmon version 3 - V 3 - C "pid" "cwd" - E "pid" "path" - F "pid" "child" - R "pid" "path" - W "pid" "path" - X "pid" "status" - D "pid" "path" - L "pid" "src" "target" - M "pid" "old" "new" - S "pid" "path" - # Bye bye + # Meta data file "path" + CMD "command-line" + CWD "cwd" + TARGET "target" + -- command output -- + -- filemon acquired metadata -- + # buildmon version 3 + V 3 + C "pid" "cwd" + E "pid" "path" + F "pid" "child" + R "pid" "path" + W "pid" "path" + X "pid" "status" + D "pid" "path" + L "pid" "src" "target" + M "pid" "old" "new" + S "pid" "path" + # Bye bye - We go to some effort to avoid processing a dependency more than once. - Of the above record types only C,E,F,L,R,V and W are of interest. + We go to some effort to avoid processing a dependency more than once. + Of the above record types only C,E,F,L,R,V and W are of interest. """ version = 0 # unknown @@ -431,7 +435,6 @@ class MetaFile: pid = int(w[1]) if pid != last_pid: if last_pid: - pid_cwd[last_pid] = cwd pid_last_dir[last_pid] = self.last_dir cwd = getv(pid_cwd, pid, self.cwd) self.last_dir = getv(pid_last_dir, pid, self.cwd) @@ -448,7 +451,8 @@ class MetaFile: cwd = abspath(w[2], cwd, None, self.debug, self.debug_out) if cwd.endswith('/.'): cwd = cwd[0:-2] - self.last_dir = cwd + self.last_dir = pid_last_dir[pid] = cwd + pid_cwd[pid] = cwd if self.debug > 1: print("cwd=", cwd, file=self.debug_out) continue @@ -545,6 +549,9 @@ class MetaFile: ddep = self.find_obj(objroot, dir, path, w[2]) if ddep: self.add(self.obj_deps, ddep, 'obj') + if self.dpdeps and objroot.endswith('/stage/'): + sp = '/'.join(path.replace(objroot,'').split('/')[1:]) + self.add(self.file_deps, sp, 'file') else: # don't waste time looking again self.seenit(w[2]) Modified: head/share/mk/meta2deps.sh ============================================================================== --- head/share/mk/meta2deps.sh Fri Dec 23 00:38:43 2016 (r310436) +++ head/share/mk/meta2deps.sh Fri Dec 23 02:57:00 2016 (r310437) @@ -1,4 +1,3 @@ -# $FreeBSD$ #!/bin/sh # NAME: @@ -53,7 +52,7 @@ # $SB/obj-i386/bsd/gnu/lib/csu # $SB/obj-i386/bsd/gnu/lib/libgcc # $SB/obj-i386/bsd/include -# $SB/obj-i386/bsd/lib/csu/i386-elf +# $SB/obj-i386/bsd/lib/csu/i386 # $SB/obj-i386/bsd/lib/libc # $SB/src/bsd/include # $SB/src/bsd/sys/i386/include @@ -78,7 +77,8 @@ # RCSid: -# $Id: meta2deps.sh,v 1.9 2015/04/03 18:23:25 sjg Exp $ +# $FreeBSD$ +# $Id: meta2deps.sh,v 1.12 2016/12/13 20:44:16 sjg Exp $ # Copyright (c) 2010-2013, Juniper Networks, Inc. # All rights reserved. @@ -256,7 +256,7 @@ meta2deps() { *) case "$lpid" in "") ;; - *) eval ldir_$lpid=$ldir cwd_$lpid=$cwd;; + *) eval ldir_$lpid=$ldir;; esac eval ldir=\${ldir_$pid:-$CWD} cwd=\${cwd_$pid:-$CWD} lpid=$pid @@ -272,9 +272,11 @@ meta2deps() { esac # watch out for temp dirs that no longer exist test -d ${cwd:-/dev/null/no/such} || cwd=$CWD + eval cwd_$pid=$cwd continue ;; - F,*) eval cwd_$path=$cwd ldir_$path=$ldir + F,*) # $path is new pid + eval cwd_$path=$cwd ldir_$path=$ldir continue ;; *) dir=${path%/*} From owner-svn-src-all@freebsd.org Fri Dec 23 02:57:20 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8402EC8DD20; Fri, 23 Dec 2016 02:57:20 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 52A1C1CB8; Fri, 23 Dec 2016 02:57:20 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBN2vJfl085714; Fri, 23 Dec 2016 02:57:19 GMT (envelope-from jhibbits@FreeBSD.org) Received: (from jhibbits@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBN2vJUm085713; Fri, 23 Dec 2016 02:57:19 GMT (envelope-from jhibbits@FreeBSD.org) Message-Id: <201612230257.uBN2vJUm085713@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhibbits set sender to jhibbits@FreeBSD.org using -f From: Justin Hibbits Date: Fri, 23 Dec 2016 02:57:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r310438 - stable/11/sys/cddl/dev/dtrace/powerpc X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Dec 2016 02:57:20 -0000 Author: jhibbits Date: Fri Dec 23 02:57:19 2016 New Revision: 310438 URL: https://svnweb.freebsd.org/changeset/base/310438 Log: MFC r303796: Two fixups for dtrace * Use the right incantation to get the next stack pointer. * Clear EE using the correct instruction sequence. Modified: stable/11/sys/cddl/dev/dtrace/powerpc/dtrace_asm.S stable/11/sys/cddl/dev/dtrace/powerpc/dtrace_isa.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/cddl/dev/dtrace/powerpc/dtrace_asm.S ============================================================================== --- stable/11/sys/cddl/dev/dtrace/powerpc/dtrace_asm.S Fri Dec 23 02:57:00 2016 (r310437) +++ stable/11/sys/cddl/dev/dtrace/powerpc/dtrace_asm.S Fri Dec 23 02:57:19 2016 (r310438) @@ -67,7 +67,13 @@ dtrace_icookie_t dtrace_interrupt_disabl */ ASENTRY_NOPROF(dtrace_interrupt_disable) mfmsr %r3 - andi. %r0,%r3,~PSL_EE@l +#ifdef __powerpc64__ + /* Two-instruction sequence to clear EE flag */ + rldicl %r0,%r3,48,1 + rotldi %r0,%r0,16 +#else + rlwinm %r0,%r3,0,~PSL_EE /* Clear EE flag */ +#endif mtmsr %r0 blr END(dtrace_interrupt_disable) Modified: stable/11/sys/cddl/dev/dtrace/powerpc/dtrace_isa.c ============================================================================== --- stable/11/sys/cddl/dev/dtrace/powerpc/dtrace_isa.c Fri Dec 23 02:57:00 2016 (r310437) +++ stable/11/sys/cddl/dev/dtrace/powerpc/dtrace_isa.c Fri Dec 23 02:57:19 2016 (r310438) @@ -545,7 +545,7 @@ dtrace_getstackdepth(int aframes) else aframes--; osp = sp; - sp = *(uintptr_t *)sp; + sp = dtrace_next_sp(sp); } if (depth < aframes) return (0); From owner-svn-src-all@freebsd.org Fri Dec 23 03:07:20 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id EB8DCC8C12D; Fri, 23 Dec 2016 03:07:20 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 6A9371761; Fri, 23 Dec 2016 03:07:20 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBN37Jw7090795; Fri, 23 Dec 2016 03:07:19 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBN37Jse090793; Fri, 23 Dec 2016 03:07:19 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201612230307.uBN37Jse090793@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Fri, 23 Dec 2016 03:07:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r310439 - stable/11/sys/kern X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Dec 2016 03:07:21 -0000 Author: jhb Date: Fri Dec 23 03:07:19 2016 New Revision: 310439 URL: https://svnweb.freebsd.org/changeset/base/310439 Log: MFC 309148: Permit timed sleeps for threads other than thread0 before timers are working. The callout subsystem already handles early callouts and schedules the first clock interrupt appropriately based on the currently pending callouts. The one nit to fix was that callouts scheduled via C_HARDCLOCK during early boot could fire too early once timers were enabled as the per-CPU base time is always zero until timers are initialized. The change in callout_when() handles this case by using the current uptime as the base time of the callout during bootup if the per-CPU base time is zero. Modified: stable/11/sys/kern/kern_timeout.c stable/11/sys/kern/subr_sleepqueue.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/kern/kern_timeout.c ============================================================================== --- stable/11/sys/kern/kern_timeout.c Fri Dec 23 02:57:19 2016 (r310438) +++ stable/11/sys/kern/kern_timeout.c Fri Dec 23 03:07:19 2016 (r310439) @@ -981,6 +981,8 @@ callout_when(sbintime_t sbt, sbintime_t spinlock_exit(); #endif #endif + if (cold && to_sbt == 0) + to_sbt = sbinuptime(); if ((flags & C_HARDCLOCK) == 0) to_sbt += tick_sbt; } else Modified: stable/11/sys/kern/subr_sleepqueue.c ============================================================================== --- stable/11/sys/kern/subr_sleepqueue.c Fri Dec 23 02:57:19 2016 (r310438) +++ stable/11/sys/kern/subr_sleepqueue.c Fri Dec 23 03:07:19 2016 (r310439) @@ -386,7 +386,7 @@ sleepq_set_timeout_sbt(void *wchan, sbin MPASS(TD_ON_SLEEPQ(td)); MPASS(td->td_sleepqueue == NULL); MPASS(wchan != NULL); - if (cold) + if (cold && td == &thread0) panic("timed sleep before timers are working"); KASSERT(td->td_sleeptimo == 0, ("td %d %p td_sleeptimo %jx", td->td_tid, td, (uintmax_t)td->td_sleeptimo)); From owner-svn-src-all@freebsd.org Fri Dec 23 03:08:28 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6F64BC8C1BD; Fri, 23 Dec 2016 03:08:28 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 31CF218FE; Fri, 23 Dec 2016 03:08:28 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBN38RME090893; Fri, 23 Dec 2016 03:08:27 GMT (envelope-from jhibbits@FreeBSD.org) Received: (from jhibbits@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBN38ROT090891; Fri, 23 Dec 2016 03:08:27 GMT (envelope-from jhibbits@FreeBSD.org) Message-Id: <201612230308.uBN38ROT090891@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhibbits set sender to jhibbits@FreeBSD.org using -f From: Justin Hibbits Date: Fri, 23 Dec 2016 03:08:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r310440 - in stable/11/sys/powerpc: booke mpc85xx X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Dec 2016 03:08:28 -0000 Author: jhibbits Date: Fri Dec 23 03:08:27 2016 New Revision: 310440 URL: https://svnweb.freebsd.org/changeset/base/310440 Log: MFC r304047,r304068: r304047: Add ePAPR boot support for PowerPC book-E (MPC85xx) hardware r304068: Only flush bp_kernload from the dcache, no need to sync the icache on the boot CPU. Modified: stable/11/sys/powerpc/booke/locore.S stable/11/sys/powerpc/mpc85xx/platform_mpc85xx.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/powerpc/booke/locore.S ============================================================================== --- stable/11/sys/powerpc/booke/locore.S Fri Dec 23 03:07:19 2016 (r310439) +++ stable/11/sys/powerpc/booke/locore.S Fri Dec 23 03:08:27 2016 (r310440) @@ -409,6 +409,8 @@ bp_kernload: ori %r3, %r3, (MAS3_SX | MAS3_SW | MAS3_SR)@l mtspr SPR_MAS3, %r3 isync + bl zero_mas7 + bl zero_mas8 tlbwe isync msync Modified: stable/11/sys/powerpc/mpc85xx/platform_mpc85xx.c ============================================================================== --- stable/11/sys/powerpc/mpc85xx/platform_mpc85xx.c Fri Dec 23 03:07:19 2016 (r310439) +++ stable/11/sys/powerpc/mpc85xx/platform_mpc85xx.c Fri Dec 23 03:08:27 2016 (r310440) @@ -39,7 +39,9 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include +#include #include #include #include @@ -53,6 +55,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include @@ -63,6 +66,15 @@ extern void *ap_pcpu; extern vm_paddr_t kernload; /* Kernel physical load address */ extern uint8_t __boot_page[]; /* Boot page body */ extern uint32_t bp_kernload; + +struct cpu_release { + uint32_t entry_h; + uint32_t entry_l; + uint32_t r3_h; + uint32_t r3_l; + uint32_t reserved; + uint32_t pir; +}; #endif extern uint32_t *bootinfo; @@ -316,6 +328,51 @@ mpc85xx_smp_get_bsp(platform_t plat, str return (0); } +#ifdef SMP +static int +mpc85xx_smp_start_cpu_epapr(platform_t plat, struct pcpu *pc) +{ + vm_paddr_t rel_pa, bptr; + volatile struct cpu_release *rel; + vm_offset_t rel_va, rel_page; + phandle_t node; + int i; + + /* If we're calling this, the node already exists. */ + node = OF_finddevice("/cpus"); + for (i = 0, node = OF_child(node); i < pc->pc_cpuid; + i++, node = OF_peer(node)) + ; + if (OF_getencprop(node, "cpu-release-addr", (pcell_t *)&rel_pa, + sizeof(rel_pa)) == -1) { + return (ENOENT); + } + + rel_page = kva_alloc(PAGE_SIZE); + if (rel_page == 0) + return (ENOMEM); + + critical_enter(); + rel_va = rel_page + (rel_pa & PAGE_MASK); + pmap_kenter(rel_page, rel_pa & ~PAGE_MASK); + rel = (struct cpu_release *)rel_va; + bptr = ((vm_paddr_t)(uintptr_t)__boot_page - KERNBASE) + kernload; + cpu_flush_dcache(__DEVOLATILE(struct cpu_release *,rel), sizeof(*rel)); + rel->pir = pc->pc_cpuid; __asm __volatile("sync"); + rel->entry_h = (bptr >> 32); + rel->entry_l = bptr; __asm __volatile("sync"); + cpu_flush_dcache(__DEVOLATILE(struct cpu_release *,rel), sizeof(*rel)); + if (bootverbose) + printf("Waking up CPU %d via CPU release page %p\n", + pc->pc_cpuid, rel); + critical_exit(); + pmap_kremove(rel_page); + kva_free(rel_page, PAGE_SIZE); + + return (0); +} +#endif + static int mpc85xx_smp_start_cpu(platform_t plat, struct pcpu *pc) { @@ -325,6 +382,7 @@ mpc85xx_smp_start_cpu(platform_t plat, s int timeout; uintptr_t brr; int cpuid; + int epapr_boot = 0; uint32_t tgt; if (mpc85xx_is_qoriq()) { @@ -342,6 +400,20 @@ mpc85xx_smp_start_cpu(platform_t plat, s cpuid = pc->pc_cpuid + 24; } bp_kernload = kernload; + /* + * bp_kernload is in the boot page. Sync the cache because ePAPR + * booting has the other core(s) already running. + */ + cpu_flush_dcache(&bp_kernload, sizeof(bp_kernload)); + + ap_pcpu = pc; + __asm __volatile("msync; isync"); + + /* First try the ePAPR way. */ + if (mpc85xx_smp_start_cpu_epapr(plat, pc) == 0) { + epapr_boot = 1; + goto spin_wait; + } reg = ccsr_read4(brr); if ((reg & (1 << cpuid)) != 0) { @@ -350,9 +422,6 @@ mpc85xx_smp_start_cpu(platform_t plat, s return (ENXIO); } - ap_pcpu = pc; - __asm __volatile("msync; isync"); - /* Flush caches to have our changes hit DRAM. */ cpu_flush_dcache(__boot_page, 4096); @@ -413,6 +482,7 @@ mpc85xx_smp_start_cpu(platform_t plat, s ccsr_write4(brr, reg | (1 << cpuid)); __asm __volatile("isync; msync"); +spin_wait: timeout = 500; while (!pc->pc_awake && timeout--) DELAY(1000); /* wait 1ms */ @@ -422,11 +492,13 @@ mpc85xx_smp_start_cpu(platform_t plat, s * address (= 0xfffff000) isn't permanently remapped and thus not * usable otherwise. */ - if (mpc85xx_is_qoriq()) - ccsr_write4(OCP85XX_BSTAR, 0); - else - ccsr_write4(OCP85XX_BPTR, 0); - __asm __volatile("isync; msync"); + if (!epapr_boot) { + if (mpc85xx_is_qoriq()) + ccsr_write4(OCP85XX_BSTAR, 0); + else + ccsr_write4(OCP85XX_BPTR, 0); + __asm __volatile("isync; msync"); + } if (!pc->pc_awake) panic("SMP: CPU %d didn't wake up.\n", pc->pc_cpuid); From owner-svn-src-all@freebsd.org Fri Dec 23 03:14:06 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id EBA13C8C4EB; Fri, 23 Dec 2016 03:14:06 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A073F1EC0; Fri, 23 Dec 2016 03:14:06 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBN3E5kM094666; Fri, 23 Dec 2016 03:14:05 GMT (envelope-from jhibbits@FreeBSD.org) Received: (from jhibbits@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBN3E5wV094664; Fri, 23 Dec 2016 03:14:05 GMT (envelope-from jhibbits@FreeBSD.org) Message-Id: <201612230314.uBN3E5wV094664@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhibbits set sender to jhibbits@FreeBSD.org using -f From: Justin Hibbits Date: Fri, 23 Dec 2016 03:14:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r310441 - in stable/11/sys/powerpc: mpc85xx powerpc X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Dec 2016 03:14:07 -0000 Author: jhibbits Date: Fri Dec 23 03:14:05 2016 New Revision: 310441 URL: https://svnweb.freebsd.org/changeset/base/310441 Log: MFC r305320,r306702: r305320: Use the right ifdef macro. r306702: Fix e500mc/derivatives cpu idle Modified: stable/11/sys/powerpc/mpc85xx/platform_mpc85xx.c stable/11/sys/powerpc/powerpc/cpu.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/powerpc/mpc85xx/platform_mpc85xx.c ============================================================================== --- stable/11/sys/powerpc/mpc85xx/platform_mpc85xx.c Fri Dec 23 03:08:27 2016 (r310440) +++ stable/11/sys/powerpc/mpc85xx/platform_mpc85xx.c Fri Dec 23 03:14:05 2016 (r310441) @@ -541,9 +541,11 @@ mpc85xx_idle(platform_t plat, int cpu) uint32_t reg; if (mpc85xx_is_qoriq()) { - reg = ccsr_read4(OCP85XX_RCPM_CDOZCR); - ccsr_write4(OCP85XX_RCPM_CDOZCR, reg | (1 << cpu)); - ccsr_read4(OCP85XX_RCPM_CDOZCR); + /* + * Base binutils doesn't know what the 'wait' instruction is, so + * use the opcode encoding here. + */ + __asm __volatile("wrteei 1; .long 0x7c00007c"); } else { reg = mfmsr(); /* Freescale E500 core RM section 6.4.1. */ @@ -555,15 +557,6 @@ mpc85xx_idle(platform_t plat, int cpu) static int mpc85xx_idle_wakeup(platform_t plat, int cpu) { - uint32_t reg; - - if (mpc85xx_is_qoriq()) { - reg = ccsr_read4(OCP85XX_RCPM_CDOZCR); - ccsr_write4(OCP85XX_RCPM_CDOZCR, reg & ~(1 << cpu)); - ccsr_read4(OCP85XX_RCPM_CDOZCR); - - return (1); - } return (0); } Modified: stable/11/sys/powerpc/powerpc/cpu.c ============================================================================== --- stable/11/sys/powerpc/powerpc/cpu.c Fri Dec 23 03:08:27 2016 (r310440) +++ stable/11/sys/powerpc/powerpc/cpu.c Fri Dec 23 03:14:05 2016 (r310441) @@ -663,7 +663,7 @@ static void cpu_idle_booke(sbintime_t sbt) { -#ifdef E500 +#ifdef BOOKE_E500 platform_cpu_idle(PCPU_GET(cpuid)); #endif } From owner-svn-src-all@freebsd.org Fri Dec 23 03:19:49 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id DBB00C8C639; Fri, 23 Dec 2016 03:19:49 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 857AA11A5; Fri, 23 Dec 2016 03:19:49 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBN3JmQP095214; Fri, 23 Dec 2016 03:19:48 GMT (envelope-from jhibbits@FreeBSD.org) Received: (from jhibbits@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBN3JmKK095211; Fri, 23 Dec 2016 03:19:48 GMT (envelope-from jhibbits@FreeBSD.org) Message-Id: <201612230319.uBN3JmKK095211@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhibbits set sender to jhibbits@FreeBSD.org using -f From: Justin Hibbits Date: Fri, 23 Dec 2016 03:19:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r310442 - in stable/11/sys/powerpc: booke powerpc X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Dec 2016 03:19:50 -0000 Author: jhibbits Date: Fri Dec 23 03:19:48 2016 New Revision: 310442 URL: https://svnweb.freebsd.org/changeset/base/310442 Log: MFC r304052: Add missing pmap_kremove() method for book-e. Modified: stable/11/sys/powerpc/booke/pmap.c stable/11/sys/powerpc/powerpc/mmu_if.m stable/11/sys/powerpc/powerpc/pmap_dispatch.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/powerpc/booke/pmap.c ============================================================================== --- stable/11/sys/powerpc/booke/pmap.c Fri Dec 23 03:14:05 2016 (r310441) +++ stable/11/sys/powerpc/booke/pmap.c Fri Dec 23 03:19:48 2016 (r310442) @@ -385,7 +385,7 @@ static mmu_method_t mmu_booke_methods[] MMUMETHOD(mmu_kenter, mmu_booke_kenter), MMUMETHOD(mmu_kenter_attr, mmu_booke_kenter_attr), MMUMETHOD(mmu_kextract, mmu_booke_kextract), -/* MMUMETHOD(mmu_kremove, mmu_booke_kremove), */ + MMUMETHOD(mmu_kremove, mmu_booke_kremove), MMUMETHOD(mmu_unmapdev, mmu_booke_unmapdev), MMUMETHOD(mmu_change_attr, mmu_booke_change_attr), Modified: stable/11/sys/powerpc/powerpc/mmu_if.m ============================================================================== --- stable/11/sys/powerpc/powerpc/mmu_if.m Fri Dec 23 03:14:05 2016 (r310441) +++ stable/11/sys/powerpc/powerpc/mmu_if.m Fri Dec 23 03:19:48 2016 (r310442) @@ -870,6 +870,16 @@ METHOD void kenter_attr { } DEFAULT mmu_null_kenter_attr; /** + * @brief Unmap a wired page from kernel virtual address space + * + * @param _va mapped virtual address + */ +METHOD void kremove { + mmu_t _mmu; + vm_offset_t _va; +}; + +/** * @brief Determine if the given physical address range has been direct-mapped. * * @param _pa physical address start Modified: stable/11/sys/powerpc/powerpc/pmap_dispatch.c ============================================================================== --- stable/11/sys/powerpc/powerpc/pmap_dispatch.c Fri Dec 23 03:14:05 2016 (r310441) +++ stable/11/sys/powerpc/powerpc/pmap_dispatch.c Fri Dec 23 03:19:48 2016 (r310442) @@ -510,6 +510,14 @@ pmap_kenter_attr(vm_offset_t va, vm_offs MMU_KENTER_ATTR(mmu_obj, va, pa, ma); } +void +pmap_kremove(vm_offset_t va) +{ + + CTR2(KTR_PMAP, "%s(%#x)", __func__, va); + return (MMU_KREMOVE(mmu_obj, va)); +} + boolean_t pmap_dev_direct_mapped(vm_paddr_t pa, vm_size_t size) { From owner-svn-src-all@freebsd.org Fri Dec 23 03:20:35 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9D78DC8C6D6; Fri, 23 Dec 2016 03:20:35 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 5F49C131E; Fri, 23 Dec 2016 03:20:35 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBN3KYkT095324; Fri, 23 Dec 2016 03:20:34 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBN3KY8N095321; Fri, 23 Dec 2016 03:20:34 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201612230320.uBN3KY8N095321@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Fri, 23 Dec 2016 03:20:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310443 - head/sys/mips/mips X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Dec 2016 03:20:35 -0000 Author: jhb Date: Fri Dec 23 03:20:34 2016 New Revision: 310443 URL: https://svnweb.freebsd.org/changeset/base/310443 Log: MFamd64: Various fixes for MIPS minidumps. - Honor PG_NODUMP by not dumping pages with this flag set. - Pat the watchdog during dumps to avoid a watchdog reset while writing out a dump. - Reformat the output during a dump to update every 10% done rather than every 2MB dumped. - Include UMA small pages and pages holding PV entries in minidumps. Sponsored by: DARPA / AFRL Modified: head/sys/mips/mips/minidump_machdep.c head/sys/mips/mips/pmap.c head/sys/mips/mips/uma_machdep.c Modified: head/sys/mips/mips/minidump_machdep.c ============================================================================== --- head/sys/mips/mips/minidump_machdep.c Fri Dec 23 03:19:48 2016 (r310442) +++ head/sys/mips/mips/minidump_machdep.c Fri Dec 23 03:20:34 2016 (r310443) @@ -37,8 +37,11 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include +#include +#include #include #include #include @@ -62,7 +65,7 @@ static off_t dumplo; static off_t origdumplo; /* Handle chunked writes. */ -static uint64_t counter, progress; +static uint64_t counter, progress, dumpsize; /* Just auxiliary bufffer */ static char tmpbuffer[PAGE_SIZE]; @@ -73,8 +76,11 @@ CTASSERT(sizeof(*vm_page_dump) == 4); static int is_dumpable(vm_paddr_t pa) { + vm_page_t m; int i; + if ((m = vm_phys_paddr_to_vm_page(pa)) != NULL) + return ((m->flags & PG_NODUMP) == 0); for (i = 0; dump_avail[i] != 0 || dump_avail[i + 1] != 0; i += 2) { if (pa >= dump_avail[i] && pa < dump_avail[i + 1]) return (1); @@ -104,7 +110,40 @@ dump_drop_page(vm_paddr_t pa) atomic_clear_int(&vm_page_dump[idx], 1ul << bit); } -#define PG2MB(pgs) (((pgs) + (1 << 8) - 1) >> 8) +static struct { + int min_per; + int max_per; + int visited; +} progress_track[10] = { + { 0, 10, 0}, + { 10, 20, 0}, + { 20, 30, 0}, + { 30, 40, 0}, + { 40, 50, 0}, + { 50, 60, 0}, + { 60, 70, 0}, + { 70, 80, 0}, + { 80, 90, 0}, + { 90, 100, 0} +}; + +static void +report_progress(uint64_t progress, uint64_t dumpsize) +{ + int sofar, i; + + sofar = 100 - ((progress * 100) / dumpsize); + for (i = 0; i < nitems(progress_track); i++) { + if (sofar < progress_track[i].min_per || + sofar > progress_track[i].max_per) + continue; + if (progress_track[i].visited) + return; + progress_track[i].visited = 1; + printf("..%d%%", sofar); + return; + } +} static int write_buffer(struct dumperinfo *di, char *ptr, size_t sz) @@ -126,10 +165,12 @@ write_buffer(struct dumperinfo *di, char progress -= len; if (counter >> 22) { - printf(" %jd", PG2MB(progress >> PAGE_SHIFT)); + report_progress(progress, dumpsize); counter &= (1<<22) - 1; } + wdog_kern_pat(WD_LASTVAL); + if (ptr) { error = dump_write(di, ptr, 0, dumplo, len); if (error) @@ -156,7 +197,6 @@ int minidumpsys(struct dumperinfo *di) { struct minidumphdr mdhdr; - uint64_t dumpsize; uint32_t ptesize; uint32_t bits; vm_paddr_t pa; @@ -247,9 +287,8 @@ minidumpsys(struct dumperinfo *di) mkdumpheader(&kdh, KERNELDUMPMAGIC, KERNELDUMP_MIPS_VERSION, dumpsize, kerneldumpcrypto_dumpkeysize(di->kdc), di->blocksize); - printf("Physical memory: %ju MB\n", - (uintmax_t)ptoa((uintmax_t)physmem) / 1048576); - printf("Dumping %llu MB:", (long long)dumpsize >> 20); + printf("Dumping %llu out of %ju MB:", (long long)dumpsize >> 20, + ptoa((uintmax_t)physmem) / 1048576); /* Dump leader */ error = dump_write_header(di, &kdh, 0, dumplo); Modified: head/sys/mips/mips/pmap.c ============================================================================== --- head/sys/mips/mips/pmap.c Fri Dec 23 03:19:48 2016 (r310442) +++ head/sys/mips/mips/pmap.c Fri Dec 23 03:20:34 2016 (r310443) @@ -1484,6 +1484,7 @@ pmap_pv_reclaim(pmap_t locked_pmap) /* Entire chunk is free; return it. */ m_pc = PHYS_TO_VM_PAGE(MIPS_DIRECT_TO_PHYS( (vm_offset_t)pc)); + dump_drop_page(m_pc->phys_addr); break; } } @@ -1545,6 +1546,7 @@ free_pv_chunk(struct pv_chunk *pc) PV_STAT(pc_chunk_frees++); /* entire chunk is free, return it */ m = PHYS_TO_VM_PAGE(MIPS_DIRECT_TO_PHYS((vm_offset_t)pc)); + dump_drop_page(m->phys_addr); vm_page_unwire(m, PQ_NONE); vm_page_free(m); } @@ -1605,6 +1607,7 @@ retry: } PV_STAT(pc_chunk_count++); PV_STAT(pc_chunk_allocs++); + dump_add_page(m->phys_addr); pc = (struct pv_chunk *)MIPS_PHYS_TO_DIRECT(VM_PAGE_TO_PHYS(m)); pc->pc_pmap = pmap; pc->pc_map[0] = pc_freemask[0] & ~1ul; /* preallocated bit 0 */ Modified: head/sys/mips/mips/uma_machdep.c ============================================================================== --- head/sys/mips/mips/uma_machdep.c Fri Dec 23 03:19:48 2016 (r310442) +++ head/sys/mips/mips/uma_machdep.c Fri Dec 23 03:20:34 2016 (r310443) @@ -68,6 +68,8 @@ uma_small_alloc(uma_zone_t zone, vm_size } pa = VM_PAGE_TO_PHYS(m); + if ((wait & M_NODUMP) == 0) + dump_add_page(pa); va = (void *)MIPS_PHYS_TO_DIRECT(pa); if ((wait & M_ZERO) && (m->flags & PG_ZERO) == 0) bzero(va, PAGE_SIZE); @@ -81,6 +83,7 @@ uma_small_free(void *mem, vm_size_t size vm_paddr_t pa; pa = MIPS_DIRECT_TO_PHYS((vm_offset_t)mem); + dump_drop_page(pa); m = PHYS_TO_VM_PAGE(pa); m->wire_count--; vm_page_free(m); From owner-svn-src-all@freebsd.org Fri Dec 23 03:23:15 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id AEC8AC8C902; Fri, 23 Dec 2016 03:23:15 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 6F8BA17C8; Fri, 23 Dec 2016 03:23:15 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBN3NEA3099185; Fri, 23 Dec 2016 03:23:14 GMT (envelope-from jhibbits@FreeBSD.org) Received: (from jhibbits@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBN3NEKa099183; Fri, 23 Dec 2016 03:23:14 GMT (envelope-from jhibbits@FreeBSD.org) Message-Id: <201612230323.uBN3NEKa099183@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhibbits set sender to jhibbits@FreeBSD.org using -f From: Justin Hibbits Date: Fri, 23 Dec 2016 03:23:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r310444 - stable/11/sys/dev/tsec X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Dec 2016 03:23:15 -0000 Author: jhibbits Date: Fri Dec 23 03:23:14 2016 New Revision: 310444 URL: https://svnweb.freebsd.org/changeset/base/310444 Log: MFC r305040: Add support for NXP/Freescale etsec2 ethernet controller Modified: stable/11/sys/dev/tsec/if_tsec.h stable/11/sys/dev/tsec/if_tsec_fdt.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/tsec/if_tsec.h ============================================================================== --- stable/11/sys/dev/tsec/if_tsec.h Fri Dec 23 03:20:34 2016 (r310443) +++ stable/11/sys/dev/tsec/if_tsec.h Fri Dec 23 03:23:14 2016 (r310444) @@ -135,6 +135,7 @@ struct tsec_softc { int phyaddr; bus_space_tag_t phy_bst; bus_space_handle_t phy_bsh; + int phy_regoff; }; /* interface to get/put generic objects */ @@ -258,9 +259,11 @@ extern struct mtx tsec_phy_mtx; #define TSEC_PHY_LOCK(sc) mtx_lock(&tsec_phy_mtx) #define TSEC_PHY_UNLOCK(sc) mtx_unlock(&tsec_phy_mtx) #define TSEC_PHY_READ(sc, reg) \ - bus_space_read_4((sc)->phy_bst, (sc)->phy_bsh, (reg)) + bus_space_read_4((sc)->phy_bst, (sc)->phy_bsh, \ + (reg) + (sc)->phy_regoff) #define TSEC_PHY_WRITE(sc, reg, val) \ - bus_space_write_4((sc)->phy_bst, (sc)->phy_bsh, (reg), (val)) + bus_space_write_4((sc)->phy_bst, (sc)->phy_bsh, \ + (reg) + (sc)->phy_regoff, (val)) /* Lock for transmitter */ #define TSEC_TRANSMIT_LOCK(sc) do { \ Modified: stable/11/sys/dev/tsec/if_tsec_fdt.c ============================================================================== --- stable/11/sys/dev/tsec/if_tsec_fdt.c Fri Dec 23 03:20:34 2016 (r310443) +++ stable/11/sys/dev/tsec/if_tsec_fdt.c Fri Dec 23 03:23:14 2016 (r310444) @@ -121,25 +121,33 @@ tsec_fdt_probe(device_t dev) sc = device_get_softc(dev); - sc->sc_rrid = 0; - sc->sc_rres = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &sc->sc_rrid, - RF_ACTIVE); - if (sc->sc_rres == NULL) - return (ENXIO); - - sc->sc_bas.bsh = rman_get_bushandle(sc->sc_rres); - sc->sc_bas.bst = rman_get_bustag(sc->sc_rres); - - /* Check if we are eTSEC (enhanced TSEC) */ - id = TSEC_READ(sc, TSEC_REG_ID); - sc->is_etsec = ((id >> 16) == TSEC_ETSEC_ID) ? 1 : 0; - id |= TSEC_READ(sc, TSEC_REG_ID2); - - bus_release_resource(dev, SYS_RES_MEMORY, sc->sc_rrid, sc->sc_rres); - - if (id == 0) { - device_printf(dev, "could not identify TSEC type\n"); - return (ENXIO); + /* + * Device trees with "fsl,etsec2" compatible nodes don't have a reg + * property, as it's been relegated to the queue-group children. + */ + if (ofw_bus_is_compatible(dev, "fsl,etsec2")) + sc->is_etsec = 1; + else { + sc->sc_rrid = 0; + sc->sc_rres = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &sc->sc_rrid, + RF_ACTIVE); + if (sc->sc_rres == NULL) + return (ENXIO); + + sc->sc_bas.bsh = rman_get_bushandle(sc->sc_rres); + sc->sc_bas.bst = rman_get_bustag(sc->sc_rres); + + /* Check if we are eTSEC (enhanced TSEC) */ + id = TSEC_READ(sc, TSEC_REG_ID); + sc->is_etsec = ((id >> 16) == TSEC_ETSEC_ID) ? 1 : 0; + id |= TSEC_READ(sc, TSEC_REG_ID2); + + bus_release_resource(dev, SYS_RES_MEMORY, sc->sc_rrid, sc->sc_rres); + + if (id == 0) { + device_printf(dev, "could not identify TSEC type\n"); + return (ENXIO); + } } if (sc->is_etsec) @@ -154,13 +162,31 @@ static int tsec_fdt_attach(device_t dev) { struct tsec_softc *sc; - phandle_t phy; + struct resource_list *rl; + phandle_t child, mdio, phy; + int acells, scells; int error = 0; sc = device_get_softc(dev); sc->dev = dev; sc->node = ofw_bus_get_node(dev); + if (fdt_addrsize_cells(sc->node, &acells, &scells) != 0) { + acells = 1; + scells = 1; + } + if (ofw_bus_is_compatible(dev, "fsl,etsec2")) { + rl = BUS_GET_RESOURCE_LIST(device_get_parent(dev), dev); + + /* + * TODO: Add all children resources to the list. Will be + * required to support multigroup mode. + */ + child = OF_child(sc->node); + ofw_bus_reg_to_rl(dev, child, acells, scells, rl); + ofw_bus_intr_to_rl(dev, child, rl, NULL); + } + /* Get phy address from fdt */ if (OF_getencprop(sc->node, "phy-handle", &phy, sizeof(phy)) <= 0) { device_printf(dev, "PHY not found in device tree"); @@ -168,9 +194,17 @@ tsec_fdt_attach(device_t dev) } phy = OF_node_from_xref(phy); - OF_decode_addr(OF_parent(phy), 0, &sc->phy_bst, &sc->phy_bsh, NULL); + mdio = OF_parent(phy); + OF_decode_addr(mdio, 0, &sc->phy_bst, &sc->phy_bsh, NULL); OF_getencprop(phy, "reg", &sc->phyaddr, sizeof(sc->phyaddr)); + /* + * etsec2 MDIO nodes are given the MDIO module base address, so we need + * to add the MII offset to get the PHY registers. + */ + if (ofw_bus_node_is_compatible(mdio, "fsl,etsec2-mdio")) + sc->phy_regoff = TSEC_REG_MIIBASE; + /* Init timer */ callout_init(&sc->tsec_callout, 1); From owner-svn-src-all@freebsd.org Fri Dec 23 03:27:12 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 71694C8CBA0; Fri, 23 Dec 2016 03:27:12 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4C1AB1A78; Fri, 23 Dec 2016 03:27:12 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBN3RB1k099446; Fri, 23 Dec 2016 03:27:11 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBN3RBC1099442; Fri, 23 Dec 2016 03:27:11 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201612230327.uBN3RBC1099442@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Fri, 23 Dec 2016 03:27:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310445 - in head/sys/mips: include mips X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Dec 2016 03:27:12 -0000 Author: jhb Date: Fri Dec 23 03:27:11 2016 New Revision: 310445 URL: https://svnweb.freebsd.org/changeset/base/310445 Log: Teach DDB how to unwind across a kernel stack overflow. Kernel stack overflows in MIPS call panic() directly from an assembly handler after storing the interrupted context's registers in a trapframe. Rather than inferring the location of ra, sp, and pc from the instruction stream, recognize the pc of a kernel stack overflow and pull the registers from the trapframe. Sponsored by: DARPA / AFRL Modified: head/sys/mips/include/trap.h head/sys/mips/mips/db_trace.c head/sys/mips/mips/exception.S Modified: head/sys/mips/include/trap.h ============================================================================== --- head/sys/mips/include/trap.h Fri Dec 23 03:23:14 2016 (r310444) +++ head/sys/mips/include/trap.h Fri Dec 23 03:27:11 2016 (r310445) @@ -111,6 +111,7 @@ void trapDump(char *msg); void MipsFPTrap(u_int, u_int, u_int); void MipsKernGenException(void); void MipsKernIntr(void); +void MipsKStackOverflow(void); void MipsTLBInvalidException(void); void MipsTLBMissException(void); void MipsUserGenException(void); Modified: head/sys/mips/mips/db_trace.c ============================================================================== --- head/sys/mips/mips/db_trace.c Fri Dec 23 03:23:14 2016 (r310444) +++ head/sys/mips/mips/db_trace.c Fri Dec 23 03:27:11 2016 (r310445) @@ -36,6 +36,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include #include @@ -157,7 +158,6 @@ loop: valid_args[2] = 0; valid_args[3] = 0; next_ra = 0; -/* Jump here after a nonstandard (interrupt handler) frame */ stksize = 0; subr = 0; if (frames++ > 100) { @@ -213,6 +213,15 @@ loop: ra = 0; goto done; } + + /* + * For a kernel stack overflow, skip to the output and + * afterwards pull the previous registers out of the trapframe + * instead of decoding the function prologue. + */ + if (pc == (uintptr_t)MipsKStackOverflow) + goto done; + /* * Find the beginning of the current subroutine by scanning * backwards from the current PC for the end of the previous @@ -389,7 +398,21 @@ done: (uintmax_t)(u_register_t) sp, stksize); - if (ra) { + if (pc == (uintptr_t)MipsKStackOverflow) { +#define TF_REG(base, reg) ((base) + CALLFRAME_SIZ + ((reg) * SZREG)) +#if defined(__mips_n64) || defined(__mips_n32) + pc = kdbpeekd((int *)TF_REG(sp, PC)); + ra = kdbpeekd((int *)TF_REG(sp, RA)); + sp = kdbpeekd((int *)TF_REG(sp, SP)); +#else + pc = kdbpeek((int *)TF_REG(sp, PC)); + ra = kdbpeek((int *)TF_REG(sp, RA)); + sp = kdbpeek((int *)TF_REG(sp, SP)); +#endif +#undef TF_REG + (*printfn) ("--- Kernel Stack Overflow ---\n"); + goto loop; + } else if (ra) { if (pc == ra && stksize == 0) (*printfn) ("stacktrace: loop!\n"); else { Modified: head/sys/mips/mips/exception.S ============================================================================== --- head/sys/mips/mips/exception.S Fri Dec 23 03:23:14 2016 (r310444) +++ head/sys/mips/mips/exception.S Fri Dec 23 03:27:11 2016 (r310445) @@ -1019,6 +1019,8 @@ tlb_insert_random: * of this handler. Otherwise the ddb backtrace code will think that * the panic() was called from MipsTLBMissException. */ + .globl MipsKStackOverflow +MipsKStackOverflow: nop .set pop From owner-svn-src-all@freebsd.org Fri Dec 23 03:28:44 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B36A7C8CC37; Fri, 23 Dec 2016 03:28:44 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 825921C21; Fri, 23 Dec 2016 03:28:44 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBN3ShHo099561; Fri, 23 Dec 2016 03:28:43 GMT (envelope-from jhibbits@FreeBSD.org) Received: (from jhibbits@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBN3ShFB099560; Fri, 23 Dec 2016 03:28:43 GMT (envelope-from jhibbits@FreeBSD.org) Message-Id: <201612230328.uBN3ShFB099560@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhibbits set sender to jhibbits@FreeBSD.org using -f From: Justin Hibbits Date: Fri, 23 Dec 2016 03:28:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r310446 - stable/11/sys/powerpc/conf X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Dec 2016 03:28:44 -0000 Author: jhibbits Date: Fri Dec 23 03:28:43 2016 New Revision: 310446 URL: https://svnweb.freebsd.org/changeset/base/310446 Log: MFC r305677: Add ehci to the MPC85XX build Modified: stable/11/sys/powerpc/conf/MPC85XX Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/powerpc/conf/MPC85XX ============================================================================== --- stable/11/sys/powerpc/conf/MPC85XX Fri Dec 23 03:27:11 2016 (r310445) +++ stable/11/sys/powerpc/conf/MPC85XX Fri Dec 23 03:28:43 2016 (r310446) @@ -89,6 +89,7 @@ device tun device uart options USB_DEBUG # enable debug msgs #device uhci +device ehci device umass device usb device vlan From owner-svn-src-all@freebsd.org Fri Dec 23 03:31:55 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 315B2C8CD2D; Fri, 23 Dec 2016 03:31:55 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 005A71EB9; Fri, 23 Dec 2016 03:31:54 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBN3VsDA003390; Fri, 23 Dec 2016 03:31:54 GMT (envelope-from jhibbits@FreeBSD.org) Received: (from jhibbits@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBN3VseB003389; Fri, 23 Dec 2016 03:31:54 GMT (envelope-from jhibbits@FreeBSD.org) Message-Id: <201612230331.uBN3VseB003389@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhibbits set sender to jhibbits@FreeBSD.org using -f From: Justin Hibbits Date: Fri, 23 Dec 2016 03:31:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r310447 - stable/11/sys/powerpc/fpu X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Dec 2016 03:31:55 -0000 Author: jhibbits Date: Fri Dec 23 03:31:53 2016 New Revision: 310447 URL: https://svnweb.freebsd.org/changeset/base/310447 Log: MFC r307598: Un-static two local variables in the FPU emulator Static variables aren't MP-safe, and this was causing bizarre segfaults on a dual-core e500v2 system (P1022). Modified: stable/11/sys/powerpc/fpu/fpu_emu.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/powerpc/fpu/fpu_emu.c ============================================================================== --- stable/11/sys/powerpc/fpu/fpu_emu.c Fri Dec 23 03:28:43 2016 (r310446) +++ stable/11/sys/powerpc/fpu/fpu_emu.c Fri Dec 23 03:31:53 2016 (r310447) @@ -185,8 +185,8 @@ fpu_dumpfpn(struct fpn *fp) int fpu_emulate(struct trapframe *frame, struct fpu *fpf) { - static union instr insn; - static struct fpemu fe; + union instr insn; + struct fpemu fe; static int lastill = 0; int sig; From owner-svn-src-all@freebsd.org Fri Dec 23 03:35:40 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 771C0C8CF82; Fri, 23 Dec 2016 03:35:40 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 457D812AB; Fri, 23 Dec 2016 03:35:40 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBN3Zdd1003646; Fri, 23 Dec 2016 03:35:39 GMT (envelope-from jhibbits@FreeBSD.org) Received: (from jhibbits@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBN3ZdIU003644; Fri, 23 Dec 2016 03:35:39 GMT (envelope-from jhibbits@FreeBSD.org) Message-Id: <201612230335.uBN3ZdIU003644@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhibbits set sender to jhibbits@FreeBSD.org using -f From: Justin Hibbits Date: Fri, 23 Dec 2016 03:35:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r310448 - stable/11/sys/powerpc/mpc85xx X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Dec 2016 03:35:40 -0000 Author: jhibbits Date: Fri Dec 23 03:35:39 2016 New Revision: 310448 URL: https://svnweb.freebsd.org/changeset/base/310448 Log: MFC r308669: Write to the correct GPIO registers. Modified: stable/11/sys/powerpc/mpc85xx/qoriq_gpio.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/powerpc/mpc85xx/qoriq_gpio.c ============================================================================== --- stable/11/sys/powerpc/mpc85xx/qoriq_gpio.c Fri Dec 23 03:31:53 2016 (r310447) +++ stable/11/sys/powerpc/mpc85xx/qoriq_gpio.c Fri Dec 23 03:35:39 2016 (r310448) @@ -173,7 +173,7 @@ qoriq_gpio_pin_set(device_t dev, uint32_ outvals = bus_read_4(sc->sc_mem, GPIO_GPDAT); outvals &= ~(1 << pinbit); outvals |= (value << pinbit); - bus_write_4(sc->sc_mem, 0, outvals); + bus_write_4(sc->sc_mem, GPIO_GPDAT, outvals); GPIO_UNLOCK(sc); @@ -208,7 +208,7 @@ qoriq_gpio_pin_toggle(device_t dev, uint val = bus_read_4(sc->sc_mem, GPIO_GPDAT); val ^= (1 << (31 - pin)); - bus_write_4(sc->sc_mem, 0, val); + bus_write_4(sc->sc_mem, GPIO_GPDAT, val); GPIO_UNLOCK(sc); From owner-svn-src-all@freebsd.org Fri Dec 23 03:40:14 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 31371C8D056; Fri, 23 Dec 2016 03:40:14 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from mail.baldwin.cx (bigwig.baldwin.cx [96.47.65.170]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 01CD614A8; Fri, 23 Dec 2016 03:40:14 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from ralph.baldwin.cx (c-73-231-226-104.hsd1.ca.comcast.net [73.231.226.104]) by mail.baldwin.cx (Postfix) with ESMTPSA id 0EC0810AA64; Thu, 22 Dec 2016 22:40:13 -0500 (EST) From: John Baldwin To: Mark Johnston Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r310423 - head/sys/kern Date: Thu, 22 Dec 2016 16:40:38 -0800 Message-ID: <2625364.T1Fo1rRtxp@ralph.baldwin.cx> User-Agent: KMail/4.14.10 (FreeBSD/11.0-PRERELEASE; KDE/4.14.10; amd64; ; ) In-Reply-To: <20161222192601.GA78778@wkstn-mjohnston.west.isilon.com> References: <201612221751.uBMHpim4062786@repo.freebsd.org> <6562460.a4qdZuDa0s@ralph.baldwin.cx> <20161222192601.GA78778@wkstn-mjohnston.west.isilon.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.4.3 (mail.baldwin.cx); Thu, 22 Dec 2016 22:40:13 -0500 (EST) X-Virus-Scanned: clamav-milter 0.99.2 at mail.baldwin.cx X-Virus-Status: Clean X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Dec 2016 03:40:14 -0000 On Thursday, December 22, 2016 11:26:01 AM Mark Johnston wrote: > On Thu, Dec 22, 2016 at 10:39:12AM -0800, John Baldwin wrote: > > On Thursday, December 22, 2016 05:51:44 PM Mark Johnston wrote: > > > Author: markj > > > Date: Thu Dec 22 17:51:44 2016 > > > New Revision: 310423 > > > URL: https://svnweb.freebsd.org/changeset/base/310423 > > > > > > Log: > > > Revert part of r300109. > > > > > > The removal of TAILQ_FOREACH_SAFE introduced a small race: when the last > > > thread on a sleepqueue is awoken, it reclaims the sleepqueue and may begin > > > executing on a different CPU before sleepq_resume_thread() returns. This > > > leaves a window during which it may go back to sleep and incorrectly be > > > awoken again by the caller of sleepq_broadcast(). > > > > This is very subtle. > > :( That also means debugging this was a nice catch. :) > > The issue is that the last sleepq_resume_thread transfers > > ownership of 'sq' from the wait channel that the sleepq_broadcast has locked, > > to the thread being resumed. > > Right, that's what I meant by "reclaims the sleepqueue." One other > requirement for hitting the race is that the thread goes back to sleep > on a wait channel that hashes to a different sleepchain, else the > sleepchain lock held by the sleepq_broadcast() caller is, I believe, > sufficient to prevent the reuse of the sleepqueue before the loop has > terminated. > > > I thought about using a local TAILQ_HEAD and > > using TAILQ_CONCAT to move the list of threads out of the sleep queue and then > > walking that list. However, a comment explaining this transfer of ownership > > (and that we can't safely access 'sq' after the last thread is resumed) is > > probably sufficient (but necessary I think). Do you feel like adding one? > > How about: > > Index: subr_sleepqueue.c > =================================================================== > --- subr_sleepqueue.c (revision 310423) > +++ subr_sleepqueue.c (working copy) > @@ -892,7 +892,12 @@ > KASSERT(sq->sq_type == (flags & SLEEPQ_TYPE), > ("%s: mismatch between sleep/wakeup and cv_*", __func__)); > > - /* Resume all blocked threads on the sleep queue. */ > + /* > + * Resume all blocked threads on the sleep queue. The last thread will > + * be given ownership of sq and may re-enqueue itself before > + * sleepq_resume_thread() returns, so we must cache the "next" queue > + * item at the beginning of the final iteration. > + */ > wakeup_swapper = 0; > TAILQ_FOREACH_SAFE(td, &sq->sq_blocked[queue], td_slpq, tdn) { > thread_lock(td); That looks great, thanks! -- John Baldwin From owner-svn-src-all@freebsd.org Fri Dec 23 03:42:39 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6D24EC8D253; Fri, 23 Dec 2016 03:42:39 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 355FC1A00; Fri, 23 Dec 2016 03:42:39 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBN3gccT008395; Fri, 23 Dec 2016 03:42:38 GMT (envelope-from jhibbits@FreeBSD.org) Received: (from jhibbits@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBN3gc2W008394; Fri, 23 Dec 2016 03:42:38 GMT (envelope-from jhibbits@FreeBSD.org) Message-Id: <201612230342.uBN3gc2W008394@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhibbits set sender to jhibbits@FreeBSD.org using -f From: Justin Hibbits Date: Fri, 23 Dec 2016 03:42:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r310449 - stable/11/sys/powerpc/powerpc X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Dec 2016 03:42:39 -0000 Author: jhibbits Date: Fri Dec 23 03:42:38 2016 New Revision: 310449 URL: https://svnweb.freebsd.org/changeset/base/310449 Log: MFC r309309,r310150: Bring the powerpc DDB disassembler into the 21st century Modified: stable/11/sys/powerpc/powerpc/db_disasm.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/powerpc/powerpc/db_disasm.c ============================================================================== --- stable/11/sys/powerpc/powerpc/db_disasm.c Fri Dec 23 03:35:39 2016 (r310448) +++ stable/11/sys/powerpc/powerpc/db_disasm.c Fri Dec 23 03:42:38 2016 (r310449) @@ -1,13 +1,14 @@ -/* $FreeBSD$ */ -/* $NetBSD: db_disasm.c,v 1.12 2002/01/05 22:07:26 jhawk Exp $ */ +/* $NetBSD: db_disasm.c,v 1.28 2013/07/04 23:00:23 joerg Exp $ */ /* $OpenBSD: db_disasm.c,v 1.2 1996/12/28 06:21:48 rahnds Exp $ */ +#include +__FBSDID("$FreeBSD$"); + #include #include #include #include -#include #include #include @@ -20,11 +21,13 @@ enum function_mask { Op_B = 0x00000002, Op_BI = 0x00000004, Op_BO = 0x00000008, + Op_BC = Op_BI | Op_BO, Op_CRM = 0x00000010, - Op_D = 0x00000020, /* yes, Op_S and Op_D are the same */ - Op_S = 0x00000020, - Op_FM = 0x00000040, - Op_IMM = 0x00000080, + Op_D = 0x00000020, + Op_ST = 0x00000020, /* Op_S for store-operations, same as D */ + Op_S = 0x00000040, /* S-field is swapped with A-field */ + Op_FM = Op_D | Op_S, /* kludge (reduce Op_s) */ + Op_dA = 0x00000080, Op_LK = 0x00000100, Op_Rc = 0x00000200, Op_AA = Op_LK | Op_Rc, /* kludge (reduce Op_s) */ @@ -37,10 +40,10 @@ enum function_mask { Op_const = 0x00004000, Op_SIMM = Op_const | Op_sign, Op_UIMM = Op_const, - Op_d = Op_const | Op_sign, Op_crbA = 0x00008000, Op_crbB = 0x00010000, Op_WS = Op_crbB, /* kludge, same field as crbB */ + Op_rSH = Op_crbB, /* kludge, same field as crbB */ Op_crbD = 0x00020000, Op_crfD = 0x00040000, Op_crfS = 0x00080000, @@ -50,7 +53,7 @@ enum function_mask { Op_dcr = Op_spr, /* out of bits - cheat with Op_spr */ Op_tbr = 0x00800000, - Op_L = 0x01000000, + Op_BP = 0x01000000, Op_BD = 0x02000000, Op_LI = 0x04000000, Op_C = 0x08000000, @@ -67,7 +70,7 @@ enum function_mask { }; struct opcode { - char *name; + const char *name; u_int32_t mask; u_int32_t code; enum function_mask func; @@ -78,7 +81,7 @@ typedef void (op_class_func) (instr_t, v u_int32_t extract_field(u_int32_t value, u_int32_t base, u_int32_t width); void disasm_fields(const struct opcode *popcode, instr_t instr, vm_offset_t loc, - char *disasm_str); + char *disasm_str, size_t slen); void dis_ppc(const struct opcode *opcodeset, instr_t instr, vm_offset_t loc); op_class_func op_ill, op_base; @@ -89,7 +92,7 @@ op_class_func op_cl_x3e, op_cl_x3f; op_class_func *opcodes_base[] = { /*x00*/ op_ill, op_ill, op_base, op_ill, /*x04*/ op_ill, op_ill, op_ill, op_base, -/*x08*/ op_base, op_base, op_ill, op_base, +/*x08*/ op_base, op_base, op_base, op_base, /*x0C*/ op_base, op_base, op_base/*XXX*/, op_base/*XXX*/, /*x10*/ op_base, op_base, op_base, op_cl_x13, /*x14*/ op_base, op_base, op_ill, op_base, @@ -118,14 +121,16 @@ const struct opcode opcodes[] = { { "twi", 0xfc000000, 0x0c000000, Op_TO | Op_A | Op_SIMM }, { "mulli", 0xfc000000, 0x1c000000, Op_D | Op_A | Op_SIMM }, { "subfic", 0xfc000000, 0x20000000, Op_D | Op_A | Op_SIMM }, - { "cmpli", 0xfc000000, 0x28000000, Op_crfD | Op_L | Op_A | Op_SIMM }, - { "cmpi", 0xfc000000, 0x2c000000, Op_crfD | Op_L | Op_A | Op_SIMM }, + { "cmplwi", 0xfc200000, 0x28000000, Op_crfD | Op_A | Op_SIMM }, + { "cmpldi", 0xfc200000, 0x28200000, Op_crfD | Op_A | Op_SIMM }, + { "cmpwi", 0xfc200000, 0x2c000000, Op_crfD | Op_A | Op_SIMM }, + { "cmpdi", 0xfc200000, 0x2c200000, Op_crfD | Op_A | Op_SIMM }, { "addic", 0xfc000000, 0x30000000, Op_D | Op_A | Op_SIMM }, { "addic.", 0xfc000000, 0x34000000, Op_D | Op_A | Op_SIMM }, { "addi", 0xfc000000, 0x38000000, Op_D | Op_A | Op_SIMM }, { "addis", 0xfc000000, 0x3c000000, Op_D | Op_A | Op_SIMM }, - { "bc", 0xfc000000, 0x40000000, Op_BO | Op_BI | Op_BD | Op_AA | Op_LK }, - { "sc", 0xffffffff, 0x44000002, Op_BO | Op_BI | Op_BD | Op_AA | Op_LK }, + { "b", 0xfc000000, 0x40000000, Op_BC | Op_BD | Op_AA | Op_LK }, /* bc */ + { "sc", 0xffffffff, 0x44000002, 0 }, { "b", 0xfc000000, 0x48000000, Op_LI | Op_AA | Op_LK }, { "rlwimi", 0xfc000000, 0x50000000, Op_S | Op_A | Op_SH | Op_MB | Op_ME | Op_Rc }, @@ -140,33 +145,33 @@ const struct opcode opcodes[] = { { "andi.", 0xfc000000, 0x70000000, Op_S | Op_A | Op_UIMM }, { "andis.", 0xfc000000, 0x74000000, Op_S | Op_A | Op_UIMM }, - { "lwz", 0xfc000000, 0x80000000, Op_D | Op_A | Op_d }, - { "lwzu", 0xfc000000, 0x84000000, Op_D | Op_A | Op_d }, - { "lbz", 0xfc000000, 0x88000000, Op_D | Op_A | Op_d }, - { "lbzu", 0xfc000000, 0x8c000000, Op_D | Op_A | Op_d }, - { "stw", 0xfc000000, 0x90000000, Op_S | Op_A | Op_d }, - { "stwu", 0xfc000000, 0x94000000, Op_S | Op_A | Op_d }, - { "stb", 0xfc000000, 0x98000000, Op_S | Op_A | Op_d }, - { "stbu", 0xfc000000, 0x9c000000, Op_S | Op_A | Op_d }, - - { "lhz", 0xfc000000, 0xa0000000, Op_D | Op_A | Op_d }, - { "lhzu", 0xfc000000, 0xa4000000, Op_D | Op_A | Op_d }, - { "lha", 0xfc000000, 0xa8000000, Op_D | Op_A | Op_d }, - { "lhau", 0xfc000000, 0xac000000, Op_D | Op_A | Op_d }, - { "sth", 0xfc000000, 0xb0000000, Op_S | Op_A | Op_d }, - { "sthu", 0xfc000000, 0xb4000000, Op_S | Op_A | Op_d }, - { "lmw", 0xfc000000, 0xb8000000, Op_D | Op_A | Op_d }, - { "stmw", 0xfc000000, 0xbc000000, Op_S | Op_A | Op_d }, - - { "lfs", 0xfc000000, 0xc0000000, Op_D | Op_A | Op_d }, - { "lfsu", 0xfc000000, 0xc4000000, Op_D | Op_A | Op_d }, - { "lfd", 0xfc000000, 0xc8000000, Op_D | Op_A | Op_d }, - { "lfdu", 0xfc000000, 0xcc000000, Op_D | Op_A | Op_d }, - - { "stfs", 0xfc000000, 0xd0000000, Op_S | Op_A | Op_d }, - { "stfsu", 0xfc000000, 0xd4000000, Op_S | Op_A | Op_d }, - { "stfd", 0xfc000000, 0xd8000000, Op_S | Op_A | Op_d }, - { "stfdu", 0xfc000000, 0xdc000000, Op_S | Op_A | Op_d }, + { "lwz", 0xfc000000, 0x80000000, Op_D | Op_dA }, + { "lwzu", 0xfc000000, 0x84000000, Op_D | Op_dA }, + { "lbz", 0xfc000000, 0x88000000, Op_D | Op_dA }, + { "lbzu", 0xfc000000, 0x8c000000, Op_D | Op_dA }, + { "stw", 0xfc000000, 0x90000000, Op_ST | Op_dA }, + { "stwu", 0xfc000000, 0x94000000, Op_ST | Op_dA }, + { "stb", 0xfc000000, 0x98000000, Op_ST | Op_dA }, + { "stbu", 0xfc000000, 0x9c000000, Op_ST | Op_dA }, + + { "lhz", 0xfc000000, 0xa0000000, Op_D | Op_dA }, + { "lhzu", 0xfc000000, 0xa4000000, Op_D | Op_dA }, + { "lha", 0xfc000000, 0xa8000000, Op_D | Op_dA }, + { "lhau", 0xfc000000, 0xac000000, Op_D | Op_dA }, + { "sth", 0xfc000000, 0xb0000000, Op_ST | Op_dA }, + { "sthu", 0xfc000000, 0xb4000000, Op_ST | Op_dA }, + { "lmw", 0xfc000000, 0xb8000000, Op_D | Op_dA }, + { "stmw", 0xfc000000, 0xbc000000, Op_ST | Op_dA }, + + { "lfs", 0xfc000000, 0xc0000000, Op_D | Op_dA }, + { "lfsu", 0xfc000000, 0xc4000000, Op_D | Op_dA }, + { "lfd", 0xfc000000, 0xc8000000, Op_D | Op_dA }, + { "lfdu", 0xfc000000, 0xcc000000, Op_D | Op_dA }, + + { "stfs", 0xfc000000, 0xd0000000, Op_ST | Op_dA }, + { "stfsu", 0xfc000000, 0xd4000000, Op_ST | Op_dA }, + { "stfd", 0xfc000000, 0xd8000000, Op_ST | Op_dA }, + { "stfdu", 0xfc000000, 0xdc000000, Op_ST | Op_dA }, { "", 0x0, 0x0, 0 } }; @@ -174,10 +179,10 @@ const struct opcode opcodes[] = { const struct opcode opcodes_13[] = { /* 0x13 << 2 */ { "mcrf", 0xfc0007fe, 0x4c000000, Op_crfD | Op_crfS }, - { "bclr", 0xfc0007fe, 0x4c000020, Op_BO | Op_BI | Op_LK }, + { "b", 0xfc0007fe, 0x4c000020, Op_BC | Op_LK }, /* bclr */ { "crnor", 0xfc0007fe, 0x4c000042, Op_crbD | Op_crbA | Op_crbB }, { "rfi", 0xfc0007fe, 0x4c000064, 0 }, - { "crandc", 0xfc0007fe, 0x4c000102, Op_BO | Op_BI | Op_LK }, + { "crandc", 0xfc0007fe, 0x4c000102, Op_crbD | Op_crbA | Op_crbB }, { "isync", 0xfc0007fe, 0x4c00012c, 0 }, { "crxor", 0xfc0007fe, 0x4c000182, Op_crbD | Op_crbA | Op_crbB }, { "crnand", 0xfc0007fe, 0x4c0001c2, Op_crbD | Op_crbA | Op_crbB }, @@ -185,7 +190,7 @@ const struct opcode opcodes_13[] = { { "creqv", 0xfc0007fe, 0x4c000242, Op_crbD | Op_crbA | Op_crbB }, { "crorc", 0xfc0007fe, 0x4c000342, Op_crbD | Op_crbA | Op_crbB }, { "cror", 0xfc0007fe, 0x4c000382, Op_crbD | Op_crbA | Op_crbB }, - { "bcctr", 0xfc0007fe, 0x4c000420, Op_BO | Op_BI | Op_LK }, + { "b", 0xfc0007fe, 0x4c000420, Op_BC | Op_LK }, /* bcctr */ { "", 0x0, 0x0, 0 } }; @@ -203,12 +208,16 @@ const struct opcode opcodes_1e[] = { /* 1f * 4 = 7c */ const struct opcode opcodes_1f[] = { /* 1f << 2 */ - { "cmp", 0xfc0007fe, 0x7c000000, Op_S | Op_A | Op_B | Op_me | Op_Rc }, + { "cmpw", 0xfc2007fe, 0x7c000000, Op_crfD | Op_A | Op_B }, + { "cmpd", 0xfc2007fe, 0x7c200000, Op_crfD | Op_A | Op_B }, { "tw", 0xfc0007fe, 0x7c000008, Op_TO | Op_A | Op_B }, { "subfc", 0xfc0003fe, 0x7c000010, Op_D | Op_A | Op_B | Op_OE | Op_Rc }, { "mulhdu", 0xfc0007fe, 0x7c000012, Op_D | Op_A | Op_B | Op_Rc }, { "addc", 0xfc0003fe, 0x7c000014, Op_D | Op_A | Op_B | Op_OE | Op_Rc }, { "mulhwu", 0xfc0007fe, 0x7c000016, Op_D | Op_A | Op_B | Op_Rc }, + { "isellt", 0xfc0007ff, 0x7c00001e, Op_D | Op_A | Op_B }, + { "iselgt", 0xfc0007ff, 0x7c00005e, Op_D | Op_A | Op_B }, + { "iseleq", 0xfc0007ff, 0x7c00009e, Op_D | Op_A | Op_B }, { "mfcr", 0xfc0007fe, 0x7c000026, Op_D }, { "lwarx", 0xfc0007fe, 0x7c000028, Op_D | Op_A | Op_B }, @@ -218,7 +227,8 @@ const struct opcode opcodes_1f[] = { { "cntlzw", 0xfc0007fe, 0x7c000034, Op_D | Op_A | Op_Rc }, { "sld", 0xfc0007fe, 0x7c000036, Op_D | Op_A | Op_B | Op_Rc }, { "and", 0xfc0007fe, 0x7c000038, Op_D | Op_A | Op_B | Op_Rc }, - { "cmpl", 0xfc0007fe, 0x7c000040, Op_crfD | Op_L | Op_A | Op_B }, + { "cmplw", 0xfc2007fe, 0x7c000040, Op_crfD | Op_A | Op_B }, + { "cmpld", 0xfc2007fe, 0x7c200040, Op_crfD | Op_A | Op_B }, { "subf", 0xfc0003fe, 0x7c000050, Op_D | Op_A | Op_B | Op_OE | Op_Rc }, { "ldux", 0xfc0007fe, 0x7c00006a, Op_D | Op_A | Op_B }, { "dcbst", 0xfc0007fe, 0x7c00006c, Op_A | Op_B }, @@ -240,24 +250,24 @@ const struct opcode opcodes_1f[] = { { "adde", 0xfc0003fe, 0x7c000114, Op_D | Op_A | Op_B | Op_OE | Op_Rc }, { "mtcrf", 0xfc0007fe, 0x7c000120, Op_S | Op_CRM }, { "mtmsr", 0xfc0007fe, 0x7c000124, Op_S }, - { "stdx", 0xfc0007fe, 0x7c00012a, Op_S | Op_A | Op_B }, - { "stwcx.", 0xfc0007ff, 0x7c00012d, Op_S | Op_A | Op_B }, - { "stwx", 0xfc0007fe, 0x7c00012e, Op_S | Op_A | Op_B }, - { "wrteei", 0xfc0003fe, 0x7c000146 }, /* XXX: out of flags! */ - { "stdux", 0xfc0007fe, 0x7c00016a, Op_S | Op_A | Op_B }, - { "stwux", 0xfc0007fe, 0x7c00016e, Op_S | Op_A | Op_B }, + { "stdx", 0xfc0007fe, 0x7c00012a, Op_ST | Op_A | Op_B }, + { "stwcx.", 0xfc0007ff, 0x7c00012d, Op_ST | Op_A | Op_B }, + { "stwx", 0xfc0007fe, 0x7c00012e, Op_ST | Op_A | Op_B }, + { "wrteei", 0xfc0003fe, 0x7c000146, 0 }, /* XXX: out of flags! */ + { "stdux", 0xfc0007fe, 0x7c00016a, Op_ST | Op_A | Op_B }, + { "stwux", 0xfc0007fe, 0x7c00016e, Op_ST | Op_A | Op_B }, { "subfze", 0xfc0003fe, 0x7c000190, Op_D | Op_A | Op_OE | Op_Rc }, { "addze", 0xfc0003fe, 0x7c000194, Op_D | Op_A | Op_OE | Op_Rc }, { "mtsr", 0xfc0007fe, 0x7c0001a4, Op_S | Op_SR }, - { "stdcx.", 0xfc0007ff, 0x7c0001ad, Op_S | Op_A | Op_B }, - { "stbx", 0xfc0007fe, 0x7c0001ae, Op_S | Op_A | Op_B }, + { "stdcx.", 0xfc0007ff, 0x7c0001ad, Op_ST | Op_A | Op_B }, + { "stbx", 0xfc0007fe, 0x7c0001ae, Op_ST | Op_A | Op_B }, { "subfme", 0xfc0003fe, 0x7c0001d0, Op_D | Op_A | Op_OE | Op_Rc }, { "mulld", 0xfc0003fe, 0x7c0001d2, Op_D | Op_A | Op_B | Op_OE | Op_Rc }, { "addme", 0xfc0003fe, 0x7c0001d4, Op_D | Op_A | Op_OE | Op_Rc }, { "mullw", 0xfc0003fe, 0x7c0001d6, Op_D | Op_A | Op_B | Op_OE | Op_Rc }, { "mtsrin", 0xfc0007fe, 0x7c0001e4, Op_S | Op_B }, { "dcbtst", 0xfc0007fe, 0x7c0001ec, Op_A | Op_B }, - { "stbux", 0xfc0007fe, 0x7c0001ee, Op_S | Op_A | Op_B }, + { "stbux", 0xfc0007fe, 0x7c0001ee, Op_ST | Op_A | Op_B }, { "add", 0xfc0003fe, 0x7c000214, Op_D | Op_A | Op_B | Op_OE | Op_Rc }, { "dcbt", 0xfc0007fe, 0x7c00022c, Op_A | Op_B }, { "lhzx", 0xfc0007ff, 0x7c00022e, Op_D | Op_A | Op_B }, @@ -274,11 +284,11 @@ const struct opcode opcodes_1f[] = { { "mftb", 0xfc0007fe, 0x7c0002e6, Op_D | Op_tbr }, { "lwaux", 0xfc0007fe, 0x7c0002ea, Op_D | Op_A | Op_B }, { "lhaux", 0xfc0007fe, 0x7c0002ee, Op_D | Op_A | Op_B }, - { "sthx", 0xfc0007fe, 0x7c00032e, Op_S | Op_A | Op_B }, + { "sthx", 0xfc0007fe, 0x7c00032e, Op_ST | Op_A | Op_B }, { "orc", 0xfc0007fe, 0x7c000338, Op_S | Op_A | Op_B | Op_Rc }, - { "ecowx", 0xfc0007fe, 0x7c00036c, Op_S | Op_A | Op_B | Op_Rc }, + { "ecowx", 0xfc0007fe, 0x7c00036c, Op_ST | Op_A | Op_B | Op_Rc }, { "slbie", 0xfc0007fc, 0x7c000364, Op_B }, - { "sthux", 0xfc0007fe, 0x7c00036e, Op_S | Op_A | Op_B }, + { "sthux", 0xfc0007fe, 0x7c00036e, Op_ST | Op_A | Op_B }, { "or", 0xfc0007fe, 0x7c000378, Op_S | Op_A | Op_B | Op_Rc }, { "mtdcr", 0xfc0007fe, 0x7c000386, Op_S | Op_dcr }, { "divdu", 0xfc0003fe, 0x7c000392, Op_D | Op_A | Op_B | Op_OE | Op_Rc }, @@ -304,27 +314,27 @@ const struct opcode opcodes_1f[] = { { "lfdx", 0xfc0007fe, 0x7c0004ae, Op_D | Op_A | Op_B }, { "lfdux", 0xfc0007fe, 0x7c0004ee, Op_D | Op_A | Op_B }, { "mfsrin", 0xfc0007fe, 0x7c000526, Op_D | Op_B }, - { "stswx", 0xfc0007fe, 0x7c00052a, Op_S | Op_A | Op_B }, - { "stwbrx", 0xfc0007fe, 0x7c00052c, Op_S | Op_A | Op_B }, - { "stfsx", 0xfc0007fe, 0x7c00052e, Op_S | Op_A | Op_B }, - { "stfsux", 0xfc0007fe, 0x7c00056e, Op_S | Op_A | Op_B }, - { "stswi", 0xfc0007fe, 0x7c0005aa, Op_S | Op_A | Op_NB }, - { "stfdx", 0xfc0007fe, 0x7c0005ae, Op_S | Op_A | Op_B }, - { "stfdux", 0xfc0007fe, 0x7c0005ee, Op_S | Op_A | Op_B }, + { "stswx", 0xfc0007fe, 0x7c00052a, Op_ST | Op_A | Op_B }, + { "stwbrx", 0xfc0007fe, 0x7c00052c, Op_ST | Op_A | Op_B }, + { "stfsx", 0xfc0007fe, 0x7c00052e, Op_ST | Op_A | Op_B }, + { "stfsux", 0xfc0007fe, 0x7c00056e, Op_ST | Op_A | Op_B }, + { "stswi", 0xfc0007fe, 0x7c0005aa, Op_ST | Op_A | Op_NB }, + { "stfdx", 0xfc0007fe, 0x7c0005ae, Op_ST | Op_A | Op_B }, + { "stfdux", 0xfc0007fe, 0x7c0005ee, Op_ST | Op_A | Op_B }, { "lhbrx", 0xfc0007fe, 0x7c00062c, Op_D | Op_A | Op_B }, { "sraw", 0xfc0007fe, 0x7c000630, Op_S | Op_A | Op_B }, { "srad", 0xfc0007fe, 0x7c000634, Op_S | Op_A | Op_B | Op_Rc }, - { "srawi", 0xfc0007fe, 0x7c000670, Op_S | Op_A | Op_B | Op_Rc }, + { "srawi", 0xfc0007fe, 0x7c000670, Op_S | Op_A | Op_rSH | Op_Rc }, { "sradi", 0xfc0007fc, 0x7c000674, Op_S | Op_A | Op_sh }, { "eieio", 0xfc0007fe, 0x7c0006ac, 0 }, { "tlbsx", 0xfc0007fe, 0x7c000724, Op_S | Op_A | Op_B | Op_Rc }, - { "sthbrx", 0xfc0007fe, 0x7c00072c, Op_S | Op_A | Op_B }, - { "extsh", 0xfc0007fe, 0x7c000734, Op_S | Op_A | Op_B | Op_Rc }, + { "sthbrx", 0xfc0007fe, 0x7c00072c, Op_ST | Op_A | Op_B }, + { "extsh", 0xfc0007fe, 0x7c000734, Op_S | Op_A | Op_Rc }, { "tlbre", 0xfc0007fe, 0x7c000764, Op_D | Op_A | Op_WS }, { "extsb", 0xfc0007fe, 0x7c000774, Op_S | Op_A | Op_Rc }, { "icbi", 0xfc0007fe, 0x7c0007ac, Op_A | Op_B }, { "tlbwe", 0xfc0007fe, 0x7c0007a4, Op_S | Op_A | Op_WS }, - { "stfiwx", 0xfc0007fe, 0x7c0007ae, Op_S | Op_A | Op_B }, + { "stfiwx", 0xfc0007fe, 0x7c0007ae, Op_ST | Op_A | Op_B }, { "extsw", 0xfc0007fe, 0x7c0007b4, Op_S | Op_A | Op_Rc }, { "dcbz", 0xfc0007fe, 0x7c0007ec, Op_A | Op_B }, { "", 0x0, 0x0, 0 } @@ -354,8 +364,8 @@ const struct opcode opcodes_3b[] = { }; /* 3e * 4 = f8 */ const struct opcode opcodes_3e[] = { - { "std", 0xfc000003, 0xf8000000, Op_S | Op_A | Op_ds }, - { "stdu", 0xfc000003, 0xf8000001, Op_S | Op_A | Op_ds }, + { "std", 0xfc000003, 0xf8000000, Op_ST | Op_A | Op_ds }, + { "stdu", 0xfc000003, 0xf8000001, Op_ST | Op_A | Op_ds }, { "", 0x0, 0x0, 0 } }; @@ -384,7 +394,7 @@ const struct opcode opcodes_3f[] = { { "mcrfs", 0xfc0007fe, 0xfc000080, Op_D | Op_B | Op_Rc }, { "mtfsb0", 0xfc0007fe, 0xfc00008c, Op_crfD | Op_Rc }, { "fmr", 0xfc0007fe, 0xfc000090, Op_D | Op_B | Op_Rc }, - { "mtfsfi", 0xfc0007fe, 0xfc00010c, Op_crfD | Op_IMM | Op_Rc }, + { "mtfsfi", 0xfc0007fe, 0xfc00010c, 0 }, /* XXX: out of flags! */ { "fnabs", 0xfc0007fe, 0xfc000110, Op_D | Op_B | Op_Rc }, { "fabs", 0xfc0007fe, 0xfc000210, Op_D | Op_B | Op_Rc }, @@ -399,10 +409,11 @@ const struct opcode opcodes_3f[] = { struct specialreg { int reg; - char *name; + const char *name; }; const struct specialreg sprregs[] = { + { 0x000, "mq" }, { 0x001, "xer" }, { 0x008, "lr" }, { 0x009, "ctr" }, @@ -412,7 +423,11 @@ const struct specialreg sprregs[] = { { 0x019, "sdr1" }, { 0x01a, "srr0" }, { 0x01b, "srr1" }, +#ifdef BOOKE_PPC4XX { 0x100, "usprg0" }, +#else + { 0x100, "vrsave" }, +#endif { 0x110, "sprg0" }, { 0x111, "sprg1" }, { 0x112, "sprg2" }, @@ -442,6 +457,22 @@ const struct specialreg sprregs[] = { { 0x21d, "dbat2l" }, { 0x21e, "dbat3u" }, { 0x21f, "dbat3l" }, + { 0x230, "ibat4u" }, + { 0x231, "ibat4l" }, + { 0x232, "ibat5u" }, + { 0x233, "ibat5l" }, + { 0x234, "ibat6u" }, + { 0x235, "ibat6l" }, + { 0x236, "ibat7u" }, + { 0x237, "ibat7l" }, + { 0x238, "dbat4u" }, + { 0x239, "dbat4l" }, + { 0x23a, "dbat5u" }, + { 0x23b, "dbat5l" }, + { 0x23c, "dbat6u" }, + { 0x23d, "dbat6l" }, + { 0x23e, "dbat7u" }, + { 0x23f, "dbat7l" }, { 0x3b0, "zpr" }, { 0x3b1, "pid" }, { 0x3b3, "ccr0" }, @@ -463,12 +494,22 @@ const struct specialreg sprregs[] = { { 0x3db, "pit" }, { 0x3de, "srr2" }, { 0x3df, "srr3" }, +#ifdef BOOKE_PPC4XX { 0x3f0, "dbsr" }, { 0x3f2, "dbcr0" }, { 0x3f4, "iac1" }, { 0x3f5, "iac2" }, { 0x3f6, "dac1" }, { 0x3f7, "dac2" }, +#else + { 0x3f0, "hid0" }, + { 0x3f1, "hid1" }, + { 0x3f2, "iabr" }, + { 0x3f3, "hid2" }, + { 0x3f5, "dabr" }, + { 0x3f6, "msscr0" }, + { 0x3f7, "msscr1" }, +#endif { 0x3f9, "l2cr" }, { 0x3fa, "dccr" }, { 0x3fb, "iccr" }, @@ -553,6 +594,11 @@ const struct specialreg dcrregs[] = { { 0, NULL } }; +static const char *condstr[8] = { + "ge", "le", "ne", "ns", "lt", "gt", "eq", "so" +}; + + void op_ill(instr_t instr, vm_offset_t loc) { @@ -570,154 +616,267 @@ const struct opcode * search_op(const st void disasm_fields(const struct opcode *popcode, instr_t instr, vm_offset_t loc, - char *disasm_str) + char *disasm_str, size_t slen) { char * pstr; enum function_mask func; + int len; + +#define ADD_LEN(s) do { \ + len = (s); \ + slen -= len; \ + pstr += len; \ + } while(0) +#define APP_PSTR(fmt, arg) ADD_LEN(snprintf(pstr, slen, (fmt), (arg))) +#define APP_PSTRS(fmt) ADD_LEN(snprintf(pstr, slen, "%s", (fmt))) pstr = disasm_str; func = popcode->func; + if (func & Op_BC) { + u_int BO, BI; + BO = extract_field(instr, 31 - 10, 5); + BI = extract_field(instr, 31 - 15, 5); + func &= ~Op_BC; + if (BO & 4) { + /* standard, no decrement */ + if (BO & 16) { + if (popcode->code == 0x40000000) { + APP_PSTRS("c"); + func |= Op_BO | Op_BI; + } + } + else { + APP_PSTRS(condstr[((BO & 8) >> 1) + (BI & 3)]); + if (BI >= 4) + func |= Op_crfS; + } + } + else { + /* decrement and branch */ + if (BO & 2) + APP_PSTRS("dz"); + else + APP_PSTRS("dnz"); + if ((BO & 24) == 0) + APP_PSTRS("f"); + else if ((BO & 24) == 8) + APP_PSTRS("t"); + else + func |= Op_BI; + } + if (popcode->code == 0x4c000020) + APP_PSTRS("lr"); + else if (popcode->code == 0x4c000420) + APP_PSTRS("ctr"); + if ((BO & 20) != 20 && (func & Op_BO) == 0) + func |= Op_BP; /* branch prediction hint */ + } if (func & Op_OE) { u_int OE; - /* also for Op_S (they are the same) */ OE = extract_field(instr, 31 - 21, 1); if (OE) { - pstr += sprintf(pstr, "o"); + APP_PSTRS("o"); } func &= ~Op_OE; } switch (func & Op_LKM) { case Op_Rc: - if (instr & 0x1) { - pstr += sprintf(pstr, "."); - } + if (instr & 0x1) + APP_PSTRS("."); break; case Op_AA: + if (instr & 0x1) + APP_PSTRS("l"); if (instr & 0x2) { - pstr += sprintf(pstr, "a"); + APP_PSTRS("a"); loc = 0; /* Absolute address */ } + break; case Op_LK: - if (instr & 0x1) { - pstr += sprintf(pstr, "l"); - } + if (instr & 0x1) + APP_PSTRS("l"); break; default: func &= ~Op_LKM; } - pstr += sprintf(pstr, "\t"); + if (func & Op_BP) { + int y; + y = (instr & 0x200000) != 0; + if (popcode->code == 0x40000000) { + int BD; + BD = extract_field(instr, 31 - 29, 14); + BD = BD << 18; + BD = BD >> 16; + BD += loc; + if ((vm_offset_t)BD < loc) + y ^= 1; + } + APP_PSTR("%c", y ? '+' : '-'); + func &= ~Op_BP; + } + APP_PSTRS("\t"); /* XXX: special cases here, out of flags in a 32bit word. */ if (strcmp(popcode->name, "wrteei") == 0) { int E; E = extract_field(instr, 31 - 16, 5); - pstr += sprintf(pstr, "%d", E); + APP_PSTR("%d", E); return; } + else if (strcmp(popcode->name, "mtfsfi") == 0) { + u_int UI; + UI = extract_field(instr, 31 - 8, 3); + APP_PSTR("crf%u, ", UI); + UI = extract_field(instr, 31 - 19, 4); + APP_PSTR("0x%x", UI); + } /* XXX: end of special cases here. */ - if (func & Op_D) { + if ((func & Op_FM) == Op_FM) { + u_int FM; + FM = extract_field(instr, 31 - 14, 8); + APP_PSTR("0x%x, ", FM); + func &= ~Op_FM; + } + if (func & Op_D) { /* Op_ST is the same */ u_int D; - /* also for Op_S (they are the same) */ D = extract_field(instr, 31 - 10, 5); - pstr += sprintf(pstr, "r%d, ", D); + APP_PSTR("r%d, ", D); func &= ~Op_D; } if (func & Op_crbD) { u_int crbD; crbD = extract_field(instr, 31 - 10, 5); - pstr += sprintf(pstr, "crb%d, ", crbD); + APP_PSTR("crb%d, ", crbD); func &= ~Op_crbD; } if (func & Op_crfD) { u_int crfD; crfD = extract_field(instr, 31 - 8, 3); - pstr += sprintf(pstr, "crf%d, ", crfD); + APP_PSTR("crf%d, ", crfD); func &= ~Op_crfD; } - if (func & Op_L) { - u_int L; - L = extract_field(instr, 31 - 10, 1); - if (L) { - pstr += sprintf(pstr, "L, "); - } - func &= ~Op_L; - } - if (func & Op_FM) { - u_int FM; - FM = extract_field(instr, 31 - 10, 8); - pstr += sprintf(pstr, "%d, ", FM); - func &= ~Op_FM; - } if (func & Op_TO) { u_int TO; TO = extract_field(instr, 31 - 10, 1); - pstr += sprintf(pstr, "%d, ", TO); + APP_PSTR("%d, ", TO); func &= ~Op_TO; } if (func & Op_crfS) { u_int crfS; crfS = extract_field(instr, 31 - 13, 3); - pstr += sprintf(pstr, "%d, ", crfS); + APP_PSTR("crf%d, ", crfS); func &= ~Op_crfS; } + if (func & Op_CRM) { + u_int CRM; + CRM = extract_field(instr, 31 - 19, 8); + APP_PSTR("0x%x, ", CRM); + func &= ~Op_CRM; + } if (func & Op_BO) { u_int BO; BO = extract_field(instr, 31 - 10, 5); - pstr += sprintf(pstr, "%d, ", BO); + APP_PSTR("%d, ", BO); func &= ~Op_BO; } + if (func & Op_BI) { + u_int BI; + BI = extract_field(instr, 31 - 15, 5); + APP_PSTR("%d, ", BI); + func &= ~Op_BI; + } + if (func & Op_dA) { /* register A indirect with displacement */ + u_int A; + A = extract_field(instr, 31 - 31, 16); + if (A & 0x8000) { + APP_PSTRS("-"); + A = 0x10000-A; + } + APP_PSTR("0x%x", A); + A = extract_field(instr, 31 - 15, 5); + APP_PSTR("(r%d)", A); + func &= ~Op_dA; + } + if (func & Op_spr) { + u_int spr; + u_int sprl; + u_int sprh; + const struct specialreg *regs; + int i; + sprl = extract_field(instr, 31 - 15, 5); + sprh = extract_field(instr, 31 - 20, 5); + spr = sprh << 5 | sprl; + + /* ugly hack - out of bitfields in the function mask */ + if (popcode->name[2] == 'd') /* m.Dcr */ + regs = dcrregs; + else + regs = sprregs; + for (i = 0; regs[i].name != NULL; i++) + if (spr == regs[i].reg) + break; + if (regs[i].name == NULL) + APP_PSTR("[unknown special reg (%d)]", spr); + else + APP_PSTR("%s", regs[i].name); + + if (popcode->name[1] == 't') /* spr is destination */ + APP_PSTRS(", "); + func &= ~Op_spr; + } + if (func & Op_SR) { + u_int SR; + SR = extract_field(instr, 31 - 15, 3); + APP_PSTR("sr%d", SR); + if (popcode->name[1] == 't') /* SR is destination */ + APP_PSTRS(", "); + func &= ~Op_SR; + } if (func & Op_A) { u_int A; A = extract_field(instr, 31 - 15, 5); - pstr += sprintf(pstr, "r%d, ", A); + APP_PSTR("r%d, ", A); func &= ~Op_A; } - if (func & Op_B) { - u_int B; - B = extract_field(instr, 31 - 20, 5); - pstr += sprintf(pstr, "r%d, ", B); - func &= ~Op_B; + if (func & Op_S) { + u_int D; + D = extract_field(instr, 31 - 10, 5); + APP_PSTR("r%d, ", D); + func &= ~Op_S; } if (func & Op_C) { u_int C; C = extract_field(instr, 31 - 25, 5); - pstr += sprintf(pstr, "r%d, ", C); + APP_PSTR("r%d, ", C); func &= ~Op_C; } - if (func & Op_BI) { - u_int BI; - BI = extract_field(instr, 31 - 10, 5); - pstr += sprintf(pstr, "%d, ", BI); - func &= ~Op_BI; + if (func & Op_B) { + u_int B; + B = extract_field(instr, 31 - 20, 5); + APP_PSTR("r%d", B); + func &= ~Op_B; } if (func & Op_crbA) { u_int crbA; crbA = extract_field(instr, 31 - 15, 5); - pstr += sprintf(pstr, "%d, ", crbA); + APP_PSTR("%d, ", crbA); func &= ~Op_crbA; } if (func & Op_crbB) { u_int crbB; crbB = extract_field(instr, 31 - 20, 5); - pstr += sprintf(pstr, "%d, ", crbB); + APP_PSTR("%d, ", crbB); func &= ~Op_crbB; } - if (func & Op_CRM) { - u_int CRM; - CRM = extract_field(instr, 31 - 19, 8); - pstr += sprintf(pstr, "0x%x, ", CRM); - func &= ~Op_CRM; - } if (func & Op_LI) { int LI; LI = extract_field(instr, 31 - 29, 24); - /* Need to sign extend and shift up 2, then add addr */ LI = LI << 8; LI = LI >> 6; LI += loc; - pstr += sprintf (pstr, "0x%x, ", LI); + APP_PSTR("0x%x", LI); func &= ~Op_LI; } switch (func & Op_SIMM) { @@ -725,7 +884,7 @@ disasm_fields(const struct opcode *popco case Op_SIMM: /* same as Op_d */ IMM = extract_field(instr, 31 - 31, 16); if (IMM & 0x8000) { - pstr += sprintf(pstr, "-"); + APP_PSTRS("-"); IMM = 0x10000-IMM; } func &= ~Op_SIMM; @@ -735,95 +894,74 @@ disasm_fields(const struct opcode *popco func &= ~Op_UIMM; goto common; common: - pstr += sprintf(pstr, "0x%x", IMM); + APP_PSTR("0x%x", IMM); break; default: - break; + ; } if (func & Op_BD) { - u_int BD; + int BD; BD = extract_field(instr, 31 - 29, 14); - pstr += sprintf(pstr, "0x%x, ", BD); + BD = BD << 18; + BD = BD >> 16; + BD += loc; + /* Need to sign extend and shift up 2, then add addr */ + APP_PSTR("0x%x", BD); func &= ~Op_BD; } if (func & Op_ds) { u_int ds; ds = extract_field(instr, 31 - 29, 14) << 2; - pstr += sprintf(pstr, "0x%x, ", ds); + APP_PSTR("0x%x", ds); func &= ~Op_ds; } - if (func & Op_spr) { - u_int spr; - u_int sprl; - u_int sprh; - const struct specialreg *regs; - int i; - sprl = extract_field(instr, 31 - 15, 5); - sprh = extract_field(instr, 31 - 20, 5); - spr = sprh << 5 | sprl; - - /* ugly hack - out of bitfields in the function mask */ - if (popcode->name[2] == 'd') /* m.Dcr */ - regs = dcrregs; - else - regs = sprregs; - for (i = 0; regs[i].name != NULL; i++) - if (spr == regs[i].reg) - break; - if (regs[i].reg == 0) - pstr += sprintf(pstr, "[unknown special reg (%d)]", spr); - else - pstr += sprintf(pstr, "%s", regs[i].name); - func &= ~Op_spr; - } - if (func & Op_me) { u_int me, mel, meh; mel = extract_field(instr, 31 - 25, 4); meh = extract_field(instr, 31 - 26, 1); me = meh << 4 | mel; - pstr += sprintf(pstr, ", 0x%x", me); + APP_PSTR(", 0x%x", me); func &= ~Op_me; } - if ((func & Op_MB) && (func & Op_sh_mb_sh)) { - u_int MB; - u_int ME; - MB = extract_field(instr, 31 - 20, 5); - pstr += sprintf(pstr, ", %d", MB); - ME = extract_field(instr, 31 - 25, 5); - pstr += sprintf(pstr, ", %d", ME); - } if ((func & Op_SH) && (func & Op_sh_mb_sh)) { u_int SH; SH = extract_field(instr, 31 - 20, 5); - pstr += sprintf(pstr, ", %d", SH); + APP_PSTR("%d", SH); + } + if ((func & Op_MB) && (func & Op_sh_mb_sh)) { + u_int MB; + u_int ME; + MB = extract_field(instr, 31 - 25, 5); + APP_PSTR(", %d", MB); + ME = extract_field(instr, 31 - 30, 5); + APP_PSTR(", %d", ME); } if ((func & Op_sh) && ! (func & Op_sh_mb_sh)) { u_int sh, shl, shh; shl = extract_field(instr, 31 - 19, 4); shh = extract_field(instr, 31 - 20, 1); sh = shh << 4 | shl; - pstr += sprintf(pstr, ", %d", sh); + APP_PSTR(", %d", sh); } if ((func & Op_mb) && ! (func & Op_sh_mb_sh)) { u_int mb, mbl, mbh; mbl = extract_field(instr, 31 - 25, 4); mbh = extract_field(instr, 31 - 26, 1); mb = mbh << 4 | mbl; - pstr += sprintf(pstr, ", %d", mb); + APP_PSTR(", %d", mb); } if ((func & Op_me) && ! (func & Op_sh_mb_sh)) { u_int me, mel, meh; mel = extract_field(instr, 31 - 25, 4); meh = extract_field(instr, 31 - 26, 1); me = meh << 4 | mel; - pstr += sprintf(pstr, ", %d", me); + APP_PSTR(", %d", me); } if (func & Op_tbr) { u_int tbr; u_int tbrl; u_int tbrh; - char *reg; + const char *reg; tbrl = extract_field(instr, 31 - 15, 5); tbrh = extract_field(instr, 31 - 20, 5); tbr = tbrh << 5 | tbrl; @@ -839,31 +977,22 @@ disasm_fields(const struct opcode *popco reg = NULL; } if (reg == NULL) - pstr += sprintf(pstr, ", [unknown tbr %d ]", tbr); + APP_PSTR(", [unknown tbr %d ]", tbr); else - pstr += sprintf(pstr, ", %s", reg); + APP_PSTR(", %s", reg); func &= ~Op_tbr; } - if (func & Op_SR) { - u_int SR; - SR = extract_field(instr, 31 - 15, 3); - pstr += sprintf(pstr, ", sr%d", SR); - func &= ~Op_SR; - } if (func & Op_NB) { u_int NB; NB = extract_field(instr, 31 - 20, 5); if (NB == 0) NB = 32; - pstr += sprintf(pstr, ", %d", NB); - func &= ~Op_SR; - } - if (func & Op_IMM) { - u_int IMM; - IMM = extract_field(instr, 31 - 19, 4); - pstr += sprintf(pstr, ", %d", IMM); + APP_PSTR(", %d", NB); func &= ~Op_SR; } +#undef ADD_LEN +#undef APP_PSTR +#undef APP_PSTRS } void @@ -920,14 +1049,15 @@ dis_ppc(const struct opcode *opcodeset, const struct opcode *op; int found = 0; int i; - char disasm_str[30]; + char disasm_str[80]; for (i = 0, op = &opcodeset[0]; found == 0 && op->mask != 0; i++, op = &opcodeset[i]) { if ((instr & op->mask) == op->code) { found = 1; - disasm_fields(op, instr, loc, disasm_str); + disasm_fields(op, instr, loc, disasm_str, + sizeof disasm_str); db_printf("%s%s\n", op->name, disasm_str); return; } From owner-svn-src-all@freebsd.org Fri Dec 23 04:35:16 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id BDA87C8DEAE; Fri, 23 Dec 2016 04:35:16 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 85FC01E86; Fri, 23 Dec 2016 04:35:16 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBN4ZFoH029309; Fri, 23 Dec 2016 04:35:15 GMT (envelope-from jkim@FreeBSD.org) Received: (from jkim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBN4ZEhl029295; Fri, 23 Dec 2016 04:35:14 GMT (envelope-from jkim@FreeBSD.org) Message-Id: <201612230435.uBN4ZEhl029295@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jkim set sender to jkim@FreeBSD.org using -f From: Jung-uk Kim Date: Fri, 23 Dec 2016 04:35:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r310450 - in vendor-sys/acpica/dist: . generate/unix/acpiexec generate/unix/acpihelp source/common source/compiler source/compiler/parsers source/compiler/preprocessor source/components... X-SVN-Group: vendor-sys MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Dec 2016 04:35:16 -0000 Author: jkim Date: Fri Dec 23 04:35:14 2016 New Revision: 310450 URL: https://svnweb.freebsd.org/changeset/base/310450 Log: Import ACPICA 20161222. Added: vendor-sys/acpica/dist/source/compiler/parsers/ vendor-sys/acpica/dist/source/compiler/preprocessor/ vendor-sys/acpica/dist/source/os_specific/service_layers/osgendbg.c (contents, props changed) vendor-sys/acpica/dist/source/tools/acpihelp/ahaml.c (contents, props changed) vendor-sys/acpica/dist/source/tools/acpihelp/ahasl.c (contents, props changed) vendor-sys/acpica/dist/source/tools/efihello/ vendor-sys/acpica/dist/source/tools/efihello/efihello.c (contents, props changed) Modified: vendor-sys/acpica/dist/changes.txt vendor-sys/acpica/dist/generate/unix/acpiexec/Makefile vendor-sys/acpica/dist/generate/unix/acpihelp/Makefile vendor-sys/acpica/dist/source/common/acfileio.c vendor-sys/acpica/dist/source/common/ahtable.c vendor-sys/acpica/dist/source/common/ahuuids.c vendor-sys/acpica/dist/source/compiler/aslutils.c vendor-sys/acpica/dist/source/components/debugger/dbinput.c vendor-sys/acpica/dist/source/components/debugger/dbxface.c vendor-sys/acpica/dist/source/components/disassembler/dmopcode.c vendor-sys/acpica/dist/source/components/disassembler/dmwalk.c vendor-sys/acpica/dist/source/components/executer/exconfig.c vendor-sys/acpica/dist/source/components/executer/exfldio.c vendor-sys/acpica/dist/source/components/hardware/hwesleep.c vendor-sys/acpica/dist/source/components/hardware/hwregs.c vendor-sys/acpica/dist/source/components/hardware/hwsleep.c vendor-sys/acpica/dist/source/components/parser/psargs.c vendor-sys/acpica/dist/source/components/parser/pstree.c vendor-sys/acpica/dist/source/components/utilities/utclib.c vendor-sys/acpica/dist/source/components/utilities/utdecode.c vendor-sys/acpica/dist/source/components/utilities/utdelete.c vendor-sys/acpica/dist/source/components/utilities/utmutex.c vendor-sys/acpica/dist/source/components/utilities/utresrc.c vendor-sys/acpica/dist/source/include/acclib.h vendor-sys/acpica/dist/source/include/acdebug.h vendor-sys/acpica/dist/source/include/acdisasm.h vendor-sys/acpica/dist/source/include/acexcep.h vendor-sys/acpica/dist/source/include/acglobal.h vendor-sys/acpica/dist/source/include/aclocal.h vendor-sys/acpica/dist/source/include/acmacros.h vendor-sys/acpica/dist/source/include/acpiosxf.h vendor-sys/acpica/dist/source/include/acpixf.h vendor-sys/acpica/dist/source/include/platform/acefi.h vendor-sys/acpica/dist/source/include/platform/acefiex.h vendor-sys/acpica/dist/source/include/platform/acenv.h vendor-sys/acpica/dist/source/include/platform/aclinux.h vendor-sys/acpica/dist/source/include/platform/aclinuxex.h vendor-sys/acpica/dist/source/os_specific/service_layers/osunixxf.c vendor-sys/acpica/dist/source/os_specific/service_layers/oswinxf.c vendor-sys/acpica/dist/source/tools/acpiexec/aemain.c vendor-sys/acpica/dist/source/tools/acpihelp/acpihelp.h vendor-sys/acpica/dist/source/tools/acpihelp/ahamlops.c vendor-sys/acpica/dist/source/tools/acpihelp/ahaslkey.c vendor-sys/acpica/dist/source/tools/acpihelp/ahaslops.c vendor-sys/acpica/dist/source/tools/acpihelp/ahdecode.c vendor-sys/acpica/dist/source/tools/acpihelp/ahgrammar.c vendor-sys/acpica/dist/source/tools/acpihelp/ahmain.c vendor-sys/acpica/dist/tests/misc/grammar.asl Modified: vendor-sys/acpica/dist/changes.txt ============================================================================== --- vendor-sys/acpica/dist/changes.txt Fri Dec 23 03:42:38 2016 (r310449) +++ vendor-sys/acpica/dist/changes.txt Fri Dec 23 04:35:14 2016 (r310450) @@ -1,4 +1,93 @@ ---------------------------------------- +22 December 2016. Summary of changes for version 20161222: + + +1) ACPICA kernel-resident subsystem: + +AML Debugger: Implemented a new mechanism to simplify and enhance +debugger integration into all environments, including kernel debuggers +and user-space utilities, as well as remote debug services. This +mechanism essentially consists of new OSL interfaces to support debugger +initialization/termination, as well as wait/notify interfaces to perform +the debugger handshake with the host. Lv Zheng. + + New OSL interfaces: + AcpiOsInitializeDebugger (void) + AcpiOsTerminateDebugger (void) + AcpiOsWaitCommandReady (void) + AcpiOsNotifyCommandComplete (void) + + New OS services layer: + osgendbg.c -- Example implementation, and used for AcpiExec + +Update for Generic Address Space (GAS) support: Although the AccessWidth +and/or BitOffset fields of the GAS are not often used, this change now +fully supports these fields. This affects the internal support for FADT +registers, registers in other ACPI data tables, and the AcpiRead and +AcpiWrite public interfaces. Lv Zheng. + +Sleep support: In order to simplify integration of ACPI sleep for the +various host operating systems, a new OSL interface has been introduced. +AcpiOsEnterSleep allows the host to perform any required operations +before the final write to the sleep control register(s) is performed by +ACPICA. Lv Zheng. + + New OSL interface: + AcpiOsEnterSleep(SleepState, RegisterAValue, RegisterBValue) + + Called from these internal interfaces: + AcpiHwLegacySleep + AcpiHwExtendedSleep + +EFI support: Added a very small EFI/ACPICA example application. Provides +a simple demo for EFI integration, as well as assisting with resolution +of issues related to customer ACPICA/EFI integration. Lv Zheng. See: + + source/tools/efihello/efihello.c + +Local C library: Implemented several new functions to enhance ACPICA +portability, for environments where these clib functions are not +available (such as EFI). Lv Zheng: + putchar + getchar + strpbrk + strtok + memmove + +Fixed a regression where occasionally a valid resource descriptor was +incorrectly detected as invalid at runtime, and a +AE_AML_NO_RESOURCE_END_TAG was returned. + +Fixed a problem with the recently implemented support that enables +control method invocations as Target operands to many ASL operators. +Warnings of this form: "Needed type [Reference], found [Processor]" were +seen at runtime for some method invocations. + +Example Code and Data Size: These are the sizes for the OS-independent +acpica.lib produced by the Microsoft Visual C++ 9.0 32-bit compiler. The +debug version of the code includes the debug output trace mechanism and +has a much larger code and data size. + + Current Release: + Non-Debug Version: 141.5K Code, 58.5K Data, 200.0K Total + Debug Version: 201.7K Code, 82.7K Data, 284.4K Total + Previous Release: + Non-Debug Version: 140.5K Code, 58.5K Data, 198.9K Total + Debug Version: 201.3K Code, 82.7K Data, 284.0K Total + + +2) iASL Compiler/Disassembler and Tools: + +Disassembler: Enhanced output by adding the capability to detect and +disassemble ASL Switch/Case statements back to the original ASL source +code instead of if/else blocks. David Box. + +AcpiHelp: Split a large file into separate files based upon +functionality/purpose. New files are: + ahaml.c + ahasl.c + +---------------------------------------- 17 November 2016. Summary of changes for version 20161117: Modified: vendor-sys/acpica/dist/generate/unix/acpiexec/Makefile ============================================================================== --- vendor-sys/acpica/dist/generate/unix/acpiexec/Makefile Fri Dec 23 03:42:38 2016 (r310449) +++ vendor-sys/acpica/dist/generate/unix/acpiexec/Makefile Fri Dec 23 04:35:14 2016 (r310450) @@ -163,6 +163,7 @@ OBJECTS = \ $(OBJDIR)/nsxfeval.o\ $(OBJDIR)/nsxfname.o\ $(OBJDIR)/nsxfobj.o\ + $(OBJDIR)/osgendbg.o\ $(OBJDIR)/osunixxf.o\ $(OBJDIR)/psargs.o\ $(OBJDIR)/psloop.o\ Modified: vendor-sys/acpica/dist/generate/unix/acpihelp/Makefile ============================================================================== --- vendor-sys/acpica/dist/generate/unix/acpihelp/Makefile Fri Dec 23 03:42:38 2016 (r310449) +++ vendor-sys/acpica/dist/generate/unix/acpihelp/Makefile Fri Dec 23 04:35:14 2016 (r310450) @@ -28,7 +28,9 @@ HEADERS = \ $(wildcard $(ACPIHELP)/*.h) OBJECTS = \ + $(OBJDIR)/ahaml.o\ $(OBJDIR)/ahamlops.o\ + $(OBJDIR)/ahasl.o\ $(OBJDIR)/ahaslkey.o\ $(OBJDIR)/ahaslops.o\ $(OBJDIR)/ahdecode.o\ Modified: vendor-sys/acpica/dist/source/common/acfileio.c ============================================================================== --- vendor-sys/acpica/dist/source/common/acfileio.c Fri Dec 23 03:42:38 2016 (r310449) +++ vendor-sys/acpica/dist/source/common/acfileio.c Fri Dec 23 04:35:14 2016 (r310450) @@ -403,7 +403,7 @@ AcValidateTableHeader ( UINT32 i; - ACPI_FUNCTION_TRACE ("AcValidateTableHeader"); + ACPI_FUNCTION_TRACE (AcValidateTableHeader); /* Read a potential table header */ Modified: vendor-sys/acpica/dist/source/common/ahtable.c ============================================================================== --- vendor-sys/acpica/dist/source/common/ahtable.c Fri Dec 23 03:42:38 2016 (r310449) +++ vendor-sys/acpica/dist/source/common/ahtable.c Fri Dec 23 04:35:14 2016 (r310450) @@ -51,7 +51,7 @@ const AH_TABLE * AcpiAhGetTableInfo ( char *Signature); -extern const AH_TABLE AcpiSupportedTables[]; +extern const AH_TABLE Gbl_AcpiSupportedTables[]; /******************************************************************************* @@ -73,7 +73,7 @@ AcpiAhGetTableInfo ( const AH_TABLE *Info; - for (Info = AcpiSupportedTables; Info->Signature; Info++) + for (Info = Gbl_AcpiSupportedTables; Info->Signature; Info++) { if (ACPI_COMPARE_NAME (Signature, Info->Signature)) { @@ -89,7 +89,7 @@ AcpiAhGetTableInfo ( * Note: Any tables added here should be duplicated within AcpiDmTableData * in the file common/dmtable.c */ -const AH_TABLE AcpiSupportedTables[] = +const AH_TABLE Gbl_AcpiSupportedTables[] = { {ACPI_SIG_ASF, "Alert Standard Format table"}, {ACPI_SIG_BERT, "Boot Error Record Table"}, Modified: vendor-sys/acpica/dist/source/common/ahuuids.c ============================================================================== --- vendor-sys/acpica/dist/source/common/ahuuids.c Fri Dec 23 03:42:38 2016 (r310449) +++ vendor-sys/acpica/dist/source/common/ahuuids.c Fri Dec 23 04:35:14 2016 (r310450) @@ -52,7 +52,7 @@ /* * Table of "known" (ACPI-related) UUIDs */ -const AH_UUID AcpiUuids[] = +const AH_UUID Gbl_AcpiUuids[] = { {"[Controllers]", NULL}, {"GPIO Controller", UUID_GPIO_CONTROLLER}, @@ -112,7 +112,7 @@ AcpiAhMatchUuid ( /* Walk the table of known ACPI-related UUIDs */ - for (Info = AcpiUuids; Info->Description; Info++) + for (Info = Gbl_AcpiUuids; Info->Description; Info++) { /* Null string means desciption is a UUID class */ Modified: vendor-sys/acpica/dist/source/compiler/aslutils.c ============================================================================== --- vendor-sys/acpica/dist/source/compiler/aslutils.c Fri Dec 23 03:42:38 2016 (r310449) +++ vendor-sys/acpica/dist/source/compiler/aslutils.c Fri Dec 23 04:35:14 2016 (r310450) @@ -155,7 +155,7 @@ UtDisplaySupportedTables ( /* All ACPI tables with the common table header */ printf ("\n Supported ACPI tables:\n"); - for (TableData = AcpiSupportedTables, i = 1; + for (TableData = Gbl_AcpiSupportedTables, i = 1; TableData->Signature; TableData++, i++) { printf ("%8u) %s %s\n", i, Modified: vendor-sys/acpica/dist/source/components/debugger/dbinput.c ============================================================================== --- vendor-sys/acpica/dist/source/components/debugger/dbinput.c Fri Dec 23 03:42:38 2016 (r310449) +++ vendor-sys/acpica/dist/source/components/debugger/dbinput.c Fri Dec 23 04:35:14 2016 (r310450) @@ -64,10 +64,6 @@ AcpiDbMatchCommand ( char *UserCommand); static void -AcpiDbSingleThread ( - void); - -static void AcpiDbDisplayCommandInfo ( const char *Command, BOOLEAN DisplayAll); @@ -1231,61 +1227,17 @@ void ACPI_SYSTEM_XFACE AcpiDbExecuteThread ( void *Context) { - ACPI_STATUS Status = AE_OK; - ACPI_STATUS MStatus; - - - while (Status != AE_CTRL_TERMINATE && !AcpiGbl_DbTerminateLoop) - { - AcpiGbl_MethodExecuting = FALSE; - AcpiGbl_StepToNextCall = FALSE; - MStatus = AcpiOsAcquireMutex (AcpiGbl_DbCommandReady, - ACPI_WAIT_FOREVER); - if (ACPI_FAILURE (MStatus)) - { - return; - } - - Status = AcpiDbCommandDispatch (AcpiGbl_DbLineBuf, NULL, NULL); - - AcpiOsReleaseMutex (AcpiGbl_DbCommandComplete); - } + (void) AcpiDbUserCommands (); AcpiGbl_DbThreadsTerminated = TRUE; } /******************************************************************************* * - * FUNCTION: AcpiDbSingleThread - * - * PARAMETERS: None - * - * RETURN: None - * - * DESCRIPTION: Debugger execute thread. Waits for a command line, then - * simply dispatches it. - * - ******************************************************************************/ - -static void -AcpiDbSingleThread ( - void) -{ - - AcpiGbl_MethodExecuting = FALSE; - AcpiGbl_StepToNextCall = FALSE; - - (void) AcpiDbCommandDispatch (AcpiGbl_DbLineBuf, NULL, NULL); -} - - -/******************************************************************************* - * * FUNCTION: AcpiDbUserCommands * - * PARAMETERS: Prompt - User prompt (depends on mode) - * Op - Current executing parse op + * PARAMETERS: None * * RETURN: None * @@ -1296,8 +1248,7 @@ AcpiDbSingleThread ( ACPI_STATUS AcpiDbUserCommands ( - char Prompt, - ACPI_PARSE_OBJECT *Op) + void) { ACPI_STATUS Status = AE_OK; @@ -1308,55 +1259,33 @@ AcpiDbUserCommands ( while (!AcpiGbl_DbTerminateLoop) { - /* Force output to console until a command is entered */ - - AcpiDbSetOutputDestination (ACPI_DB_CONSOLE_OUTPUT); - - /* Different prompt if method is executing */ + /* Wait the readiness of the command */ - if (!AcpiGbl_MethodExecuting) - { - AcpiOsPrintf ("%1c ", ACPI_DEBUGGER_COMMAND_PROMPT); - } - else + Status = AcpiOsWaitCommandReady (); + if (ACPI_FAILURE (Status)) { - AcpiOsPrintf ("%1c ", ACPI_DEBUGGER_EXECUTE_PROMPT); + break; } - /* Get the user input line */ + /* Just call to the command line interpreter */ - Status = AcpiOsGetLine (AcpiGbl_DbLineBuf, - ACPI_DB_LINE_BUFFER_SIZE, NULL); - if (ACPI_FAILURE (Status)) - { - ACPI_EXCEPTION ((AE_INFO, Status, "While parsing command line")); - return (Status); - } + AcpiGbl_MethodExecuting = FALSE; + AcpiGbl_StepToNextCall = FALSE; - /* Check for single or multithreaded debug */ + (void) AcpiDbCommandDispatch (AcpiGbl_DbLineBuf, NULL, NULL); - if (AcpiGbl_DebuggerConfiguration & DEBUGGER_MULTI_THREADED) - { - /* - * Signal the debug thread that we have a command to execute, - * and wait for the command to complete. - */ - AcpiOsReleaseMutex (AcpiGbl_DbCommandReady); - - Status = AcpiOsAcquireMutex (AcpiGbl_DbCommandComplete, - ACPI_WAIT_FOREVER); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - } - else - { - /* Just call to the command line interpreter */ + /* Notify the completion of the command */ - AcpiDbSingleThread (); + Status = AcpiOsNotifyCommandComplete (); + if (ACPI_FAILURE (Status)) + { + break; } } + if (ACPI_FAILURE (Status) && Status != AE_CTRL_TERMINATE) + { + ACPI_EXCEPTION ((AE_INFO, Status, "While parsing command line")); + } return (Status); } Modified: vendor-sys/acpica/dist/source/components/debugger/dbxface.c ============================================================================== --- vendor-sys/acpica/dist/source/components/debugger/dbxface.c Fri Dec 23 03:42:38 2016 (r310449) +++ vendor-sys/acpica/dist/source/components/debugger/dbxface.c Fri Dec 23 04:35:14 2016 (r310450) @@ -95,50 +95,23 @@ AcpiDbStartCommand ( AcpiGbl_MethodExecuting = TRUE; Status = AE_CTRL_TRUE; + while (Status == AE_CTRL_TRUE) { - if (AcpiGbl_DebuggerConfiguration == DEBUGGER_MULTI_THREADED) - { - /* Handshake with the front-end that gets user command lines */ + /* Notify the completion of the command */ - AcpiOsReleaseMutex (AcpiGbl_DbCommandComplete); - - Status = AcpiOsAcquireMutex (AcpiGbl_DbCommandReady, - ACPI_WAIT_FOREVER); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - } - else + Status = AcpiOsNotifyCommandComplete (); + if (ACPI_FAILURE (Status)) { - /* Single threaded, we must get a command line ourselves */ - - /* Force output to console until a command is entered */ - - AcpiDbSetOutputDestination (ACPI_DB_CONSOLE_OUTPUT); - - /* Different prompt if method is executing */ - - if (!AcpiGbl_MethodExecuting) - { - AcpiOsPrintf ("%1c ", ACPI_DEBUGGER_COMMAND_PROMPT); - } - else - { - AcpiOsPrintf ("%1c ", ACPI_DEBUGGER_EXECUTE_PROMPT); - } + goto ErrorExit; + } - /* Get the user input line */ + /* Wait the readiness of the command */ - Status = AcpiOsGetLine (AcpiGbl_DbLineBuf, - ACPI_DB_LINE_BUFFER_SIZE, NULL); - if (ACPI_FAILURE (Status)) - { - ACPI_EXCEPTION ((AE_INFO, Status, - "While parsing command line")); - return (Status); - } + Status = AcpiOsWaitCommandReady (); + if (ACPI_FAILURE (Status)) + { + goto ErrorExit; } Status = AcpiDbCommandDispatch (AcpiGbl_DbLineBuf, WalkState, Op); @@ -146,6 +119,12 @@ AcpiDbStartCommand ( /* AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE); */ +ErrorExit: + if (ACPI_FAILURE (Status) && Status != AE_CTRL_TERMINATE) + { + ACPI_EXCEPTION ((AE_INFO, Status, + "While parsing/handling command line")); + } return (Status); } @@ -493,16 +472,7 @@ AcpiInitializeDebugger ( { /* These were created with one unit, grab it */ - Status = AcpiOsAcquireMutex (AcpiGbl_DbCommandComplete, - ACPI_WAIT_FOREVER); - if (ACPI_FAILURE (Status)) - { - AcpiOsPrintf ("Could not get debugger mutex\n"); - return_ACPI_STATUS (Status); - } - - Status = AcpiOsAcquireMutex (AcpiGbl_DbCommandReady, - ACPI_WAIT_FOREVER); + Status = AcpiOsInitializeDebugger (); if (ACPI_FAILURE (Status)) { AcpiOsPrintf ("Could not get debugger mutex\n"); @@ -556,14 +526,14 @@ AcpiTerminateDebugger ( if (AcpiGbl_DebuggerConfiguration & DEBUGGER_MULTI_THREADED) { - AcpiOsReleaseMutex (AcpiGbl_DbCommandReady); - /* Wait the AML Debugger threads */ while (!AcpiGbl_DbThreadsTerminated) { AcpiOsSleep (100); } + + AcpiOsTerminateDebugger (); } if (AcpiGbl_DbBuffer) Modified: vendor-sys/acpica/dist/source/components/disassembler/dmopcode.c ============================================================================== --- vendor-sys/acpica/dist/source/components/disassembler/dmopcode.c Fri Dec 23 03:42:38 2016 (r310449) +++ vendor-sys/acpica/dist/source/components/disassembler/dmopcode.c Fri Dec 23 04:35:14 2016 (r310450) @@ -68,6 +68,13 @@ static void AcpiDmPromoteSubtree ( ACPI_PARSE_OBJECT *StartOp); +static BOOLEAN +AcpiDmIsSwitchBlock ( + ACPI_PARSE_OBJECT *Op); + +static BOOLEAN +AcpiDmIsCaseBlock ( + ACPI_PARSE_OBJECT *Op); /******************************************************************************* * @@ -968,6 +975,28 @@ AcpiDmDisassembleOneOp ( AcpiDmNamestring (Op->Common.Value.Name); break; + case AML_WHILE_OP: + + if (AcpiDmIsSwitchBlock(Op)) + { + AcpiOsPrintf ("%s", "Switch"); + break; + } + + AcpiOsPrintf ("%s", OpInfo->Name); + break; + + case AML_IF_OP: + + if (Op->Common.DisasmOpcode == ACPI_DASM_CASE) + { + AcpiOsPrintf ("%s", "Case"); + break; + } + + AcpiOsPrintf ("%s", OpInfo->Name); + break; + case AML_ELSE_OP: AcpiDmConvertToElseIf (Op); @@ -1078,6 +1107,12 @@ AcpiDmConvertToElseIf ( { /* Not a proper Else..If sequence, cannot convert to ElseIf */ + if (OriginalElseOp->Common.DisasmOpcode == ACPI_DASM_DEFAULT) + { + AcpiOsPrintf ("%s", "Default"); + return; + } + AcpiOsPrintf ("%s", "Else"); return; } @@ -1087,13 +1122,42 @@ AcpiDmConvertToElseIf ( ElseOp = IfOp->Common.Next; if (ElseOp && ElseOp->Common.Next) { + if (OriginalElseOp->Common.DisasmOpcode == ACPI_DASM_DEFAULT) + { + AcpiOsPrintf ("%s", "Default"); + return; + } + AcpiOsPrintf ("%s", "Else"); return; } - /* Emit ElseIf, mark the IF as now an ELSEIF */ + if (OriginalElseOp->Common.DisasmOpcode == ACPI_DASM_DEFAULT) + { + /* + * There is an ElseIf but in this case the Else is actually + * a Default block for a Switch/Case statement. No conversion. + */ + AcpiOsPrintf ("%s", "Default"); + return; + } + + if (OriginalElseOp->Common.DisasmOpcode == ACPI_DASM_CASE) + { + /* + * This ElseIf is actually a Case block for a Switch/Case + * statement. Print Case but do not return so that we can + * promote the subtree and keep the indentation level. + */ + AcpiOsPrintf ("%s", "Case"); + } + else + { + /* Emit ElseIf, mark the IF as now an ELSEIF */ + + AcpiOsPrintf ("%s", "ElseIf"); + } - AcpiOsPrintf ("%s", "ElseIf"); IfOp->Common.DisasmFlags |= ACPI_PARSEOP_ELSEIF; /* The IF parent will now be the same as the original ELSE parent */ @@ -1184,3 +1248,400 @@ AcpiDmPromoteSubtree ( Op = Op->Common.Next; } } + +/******************************************************************************* + * + * FUNCTION: AcpiDmIsTempName + * + * PARAMETERS: Op - Object to be examined + * + * RETURN: TRUE if object is a temporary (_T_x) name + * + * DESCRIPTION: Determine if an object is a temporary name and ignore it. + * Temporary names are only used for Switch statements. This + * function depends on this restriced usage. + * + ******************************************************************************/ + +BOOLEAN +AcpiDmIsTempName ( + ACPI_PARSE_OBJECT *Op) +{ + char *Temp; + + if (Op->Common.AmlOpcode != AML_NAME_OP) + { + return (FALSE); + } + + Temp = (char *)(Op->Common.Aml); + ++Temp; + + if (strncmp(Temp, "_T_", 3)) + { + return (FALSE); + } + + /* Ignore Op */ + + Op->Common.DisasmFlags |= ACPI_PARSEOP_IGNORE; + + return (TRUE); +} + +/******************************************************************************* + * + * FUNCTION: AcpiDmIsSwitchBlock + * + * PARAMETERS: Op - While Object + * + * RETURN: TRUE if While block can be converted to a Switch/Case block + * + * DESCRIPTION: Determines if While block is a Switch/Case statement. Modifies + * parse tree to allow for Switch/Case disassembly during walk. + * + * EXAMPLE: Example of parse tree to be converted + * + * While + * One + * Store + * ByteConst + * -NamePath- + * If + * LEqual + * -NamePath- + * Zero + * Return + * One + * Else + * Return + * WordConst + * Break + * + ******************************************************************************/ + +static BOOLEAN +AcpiDmIsSwitchBlock ( + ACPI_PARSE_OBJECT *Op) +{ + ACPI_PARSE_OBJECT *OneOp; + ACPI_PARSE_OBJECT *StoreOp; + ACPI_PARSE_OBJECT *NamePathOp; + ACPI_PARSE_OBJECT *PredicateOp; + ACPI_PARSE_OBJECT *CurrentOp; + ACPI_PARSE_OBJECT *TempOp; + + /* Check for One Op Predicate */ + + OneOp = AcpiPsGetArg (Op, 0); + if (!OneOp || (OneOp->Common.AmlOpcode != AML_ONE_OP)) + { + return (FALSE); + } + + /* Check for Store Op */ + + StoreOp = OneOp->Common.Next; + if (!StoreOp || (StoreOp->Common.AmlOpcode != AML_STORE_OP)) + { + return (FALSE); + } + + /* Check for Name Op with _T_ string */ + + NamePathOp = AcpiPsGetArg (StoreOp, 1); + if (!NamePathOp || (NamePathOp->Common.AmlOpcode != AML_INT_NAMEPATH_OP)) + { + return (FALSE); + } + + if (strncmp((char *)(NamePathOp->Common.Aml), "_T_", 3)) + { + return (FALSE); + } + + /* This is a Switch/Case control block */ + + /* Ignore the One Op Predicate */ + + OneOp->Common.DisasmFlags |= ACPI_PARSEOP_IGNORE; + + /* Ignore the Store Op, but not the children */ + + StoreOp->Common.DisasmOpcode = ACPI_DASM_IGNORE_SINGLE; + + /* + * First arg of Store Op is the Switch condition. + * Mark it as a Switch predicate and as a parameter list for paren + * closing and correct indentation. + */ + PredicateOp = AcpiPsGetArg (StoreOp, 0); + PredicateOp->Common.DisasmOpcode = ACPI_DASM_SWITCH_PREDICATE; + PredicateOp->Common.DisasmFlags |= ACPI_PARSEOP_PARAMETER_LIST; + + /* Ignore the Name Op */ + + NamePathOp->Common.DisasmFlags = ACPI_PARSEOP_IGNORE; + + /* Remaining opcodes are the Case statements (If/ElseIf's) */ + + CurrentOp = StoreOp->Common.Next; + while (AcpiDmIsCaseBlock (CurrentOp)) + { + /* Block is a Case structure */ + + if (CurrentOp->Common.AmlOpcode == AML_ELSE_OP) + { + /* ElseIf */ + + CurrentOp->Common.DisasmOpcode = ACPI_DASM_CASE; + CurrentOp = AcpiPsGetArg (CurrentOp, 0); + } + + /* If */ + + CurrentOp->Common.DisasmOpcode = ACPI_DASM_CASE; + + /* + * Mark the parse tree for Case disassembly. There are two + * types of Case statements. The first type of statement begins with + * an LEqual. The second starts with an LNot and uses a Match statement + * on a Package of constants. + */ + TempOp = AcpiPsGetArg (CurrentOp, 0); + switch (TempOp->Common.AmlOpcode) + { + case (AML_LEQUAL_OP): + + /* Ignore just the LEqual Op */ + + TempOp->Common.DisasmOpcode = ACPI_DASM_IGNORE_SINGLE; + + /* Ignore the NamePath Op */ + + TempOp = AcpiPsGetArg (TempOp, 0); + TempOp->Common.DisasmFlags = ACPI_PARSEOP_IGNORE; + + /* + * Second arg of LEqual will be the Case predicate. + * Mark it as a predicate and also as a parameter list for paren + * closing and correct indentation. + */ + PredicateOp = TempOp->Common.Next; + PredicateOp->Common.DisasmOpcode = ACPI_DASM_SWITCH_PREDICATE; + PredicateOp->Common.DisasmFlags |= ACPI_PARSEOP_PARAMETER_LIST; + + break; + + case (AML_LNOT_OP): + + /* + * The Package will be the predicate of the Case statement. + * It's under: + * LNOT + * LEQUAL + * MATCH + * PACKAGE + */ + + /* Get the LEqual Op from LNot */ + + TempOp = AcpiPsGetArg (TempOp, 0); + + /* Get the Match Op from LEqual */ + + TempOp = AcpiPsGetArg (TempOp, 0); + + /* Get the Package Op from Match */ + + PredicateOp = AcpiPsGetArg (TempOp, 0); + + /* Mark as parameter list for paren closing */ + + PredicateOp->Common.DisasmFlags |= ACPI_PARSEOP_PARAMETER_LIST; + + /* + * The Package list would be too deeply indented if we + * chose to simply ignore the all the parent opcodes, so + * we rearrange the parse tree instead. + */ + + /* + * Save the second arg of the If/Else Op which is the + * block code of code for this Case statement. + */ + TempOp = AcpiPsGetArg (CurrentOp, 1); + + /* + * Move the Package Op to the child (predicate) of the + * Case statement. + */ + CurrentOp->Common.Value.Arg = PredicateOp; + PredicateOp->Common.Parent = CurrentOp; + + /* Add the block code */ + + PredicateOp->Common.Next = TempOp; + + break; + + default: + + /* Should never get here */ + + break; + } + + /* Advance to next Case block */ + + CurrentOp = CurrentOp->Common.Next; + } + + /* If CurrentOp is now an Else, then this is a Default block */ + + if (CurrentOp && CurrentOp->Common.AmlOpcode == AML_ELSE_OP) + { + CurrentOp->Common.DisasmOpcode = ACPI_DASM_DEFAULT; + } + + /* + * From the first If advance to the Break op. It's possible to + * have an Else (Default) op here when there is only one Case + * statement, so check for it. + */ + CurrentOp = StoreOp->Common.Next->Common.Next; + if (CurrentOp->Common.AmlOpcode == AML_ELSE_OP) + { + CurrentOp = CurrentOp->Common.Next; + } + + /* Ignore the Break Op */ + + CurrentOp->Common.DisasmFlags |= ACPI_PARSEOP_IGNORE; + + return (TRUE); +} + +/******************************************************************************* + * + * FUNCTION: AcpiDmIsCaseBlock + * + * PARAMETERS: Op - Object to test + * + * RETURN: TRUE if Object is beginning of a Case block. + * + * DESCRIPTION: Determines if an Object is the beginning of a Case block for a + * Switch/Case statement. Parse tree must be one of the following + * forms: + * + * Else (Optional) + * If + * LEqual + * -NamePath- _T_x + * + * Else (Optional) + * If + * LNot + * LEqual + * Match + * Package + * ByteConst + * -NamePath- _T_x + * + ******************************************************************************/ + +static BOOLEAN +AcpiDmIsCaseBlock ( + ACPI_PARSE_OBJECT *Op) +{ + ACPI_PARSE_OBJECT *CurrentOp; + + if (!Op) + { + return (FALSE); + } + + /* Look for an If or ElseIf */ + + CurrentOp = Op; + if (CurrentOp->Common.AmlOpcode == AML_ELSE_OP) + { + CurrentOp = AcpiPsGetArg (CurrentOp, 0); + if (!CurrentOp) + { + return (FALSE); + } + } + + if (!CurrentOp || CurrentOp->Common.AmlOpcode != AML_IF_OP) + { + return (FALSE); + } + + /* Child must be LEqual or LNot */ + + CurrentOp = AcpiPsGetArg (CurrentOp, 0); + if (!CurrentOp) + { + return (FALSE); + } + + switch (CurrentOp->Common.AmlOpcode) + { + case (AML_LEQUAL_OP): + + /* Next child must be NamePath with string _T_ */ + + CurrentOp = AcpiPsGetArg (CurrentOp, 0); + if (!CurrentOp || !CurrentOp->Common.Value.Name || + strncmp(CurrentOp->Common.Value.Name, "_T_", 3)) + { + return (FALSE); + } + + break; + + case (AML_LNOT_OP): + + /* Child of LNot must be LEqual op */ + + CurrentOp = AcpiPsGetArg (CurrentOp, 0); + if (!CurrentOp || (CurrentOp->Common.AmlOpcode != AML_LEQUAL_OP)) + { + return (FALSE); + } + + /* Child of LNot must be Match op */ + + CurrentOp = AcpiPsGetArg (CurrentOp, 0); + if (!CurrentOp || (CurrentOp->Common.AmlOpcode != AML_MATCH_OP)) + { + return (FALSE); + } + + /* First child of Match must be Package op */ + + CurrentOp = AcpiPsGetArg (CurrentOp, 0); + if (!CurrentOp || (CurrentOp->Common.AmlOpcode != AML_PACKAGE_OP)) + { + return (FALSE); + } + + /* Third child of Match must be NamePath with string _T_ */ + + CurrentOp = AcpiPsGetArg (CurrentOp->Common.Parent, 2); + if (!CurrentOp || !CurrentOp->Common.Value.Name || + strncmp(CurrentOp->Common.Value.Name, "_T_", 3)) + { + return (FALSE); + } + + break; + + default: + + return (FALSE); + } + + return (TRUE); +} Modified: vendor-sys/acpica/dist/source/components/disassembler/dmwalk.c ============================================================================== --- vendor-sys/acpica/dist/source/components/disassembler/dmwalk.c Fri Dec 23 03:42:38 2016 (r310449) +++ vendor-sys/acpica/dist/source/components/disassembler/dmwalk.c Fri Dec 23 04:35:14 2016 (r310450) @@ -455,6 +455,20 @@ AcpiDmDescendingOp ( return (AE_CTRL_DEPTH); } + if (AcpiDmIsTempName(Op)) + { + /* Ignore compiler generated temporary names */ + + return (AE_CTRL_DEPTH); + } + + if (Op->Common.DisasmOpcode == ACPI_DASM_IGNORE_SINGLE) + { + /* Ignore this op, but not it's children */ + + return (AE_OK); + } + if (Op->Common.AmlOpcode == AML_IF_OP) { NextOp = AcpiPsGetDepthNext (NULL, Op); @@ -889,7 +903,8 @@ AcpiDmAscendingOp ( ACPI_PARSE_OBJECT *ParentOp; - if (Op->Common.DisasmFlags & ACPI_PARSEOP_IGNORE) + if (Op->Common.DisasmFlags & ACPI_PARSEOP_IGNORE || + Op->Common.DisasmOpcode == ACPI_DASM_IGNORE_SINGLE) { /* Ignore this op -- it was handled elsewhere */ @@ -1049,9 +1064,12 @@ AcpiDmAscendingOp ( *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@freebsd.org Fri Dec 23 04:37:13 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 24B92C8DF2B; Fri, 23 Dec 2016 04:37:13 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D058D1FEB; Fri, 23 Dec 2016 04:37:12 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBN4bCKo029453; Fri, 23 Dec 2016 04:37:12 GMT (envelope-from jkim@FreeBSD.org) Received: (from jkim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBN4bCru029452; Fri, 23 Dec 2016 04:37:12 GMT (envelope-from jkim@FreeBSD.org) Message-Id: <201612230437.uBN4bCru029452@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jkim set sender to jkim@FreeBSD.org using -f From: Jung-uk Kim Date: Fri, 23 Dec 2016 04:37:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r310451 - vendor-sys/acpica/20161222 X-SVN-Group: vendor-sys MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Dec 2016 04:37:13 -0000 Author: jkim Date: Fri Dec 23 04:37:11 2016 New Revision: 310451 URL: https://svnweb.freebsd.org/changeset/base/310451 Log: Tag ACPICA 20161222. Added: vendor-sys/acpica/20161222/ - copied from r310450, vendor-sys/acpica/dist/ From owner-svn-src-all@freebsd.org Fri Dec 23 04:38:28 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7A6AFC8DF9A; Fri, 23 Dec 2016 04:38:28 +0000 (UTC) (envelope-from hrs@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4A10D1153; Fri, 23 Dec 2016 04:38:28 +0000 (UTC) (envelope-from hrs@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBN4cRSc029538; Fri, 23 Dec 2016 04:38:27 GMT (envelope-from hrs@FreeBSD.org) Received: (from hrs@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBN4cRas029537; Fri, 23 Dec 2016 04:38:27 GMT (envelope-from hrs@FreeBSD.org) Message-Id: <201612230438.uBN4cRas029537@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hrs set sender to hrs@FreeBSD.org using -f From: Hiroki Sato Date: Fri, 23 Dec 2016 04:38:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310452 - head/usr.bin/logger X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Dec 2016 04:38:28 -0000 Author: hrs Date: Fri Dec 23 04:38:27 2016 New Revision: 310452 URL: https://svnweb.freebsd.org/changeset/base/310452 Log: mdoc fixes. Modified: head/usr.bin/logger/logger.1 Modified: head/usr.bin/logger/logger.1 ============================================================================== --- head/usr.bin/logger/logger.1 Fri Dec 23 04:37:11 2016 (r310451) +++ head/usr.bin/logger/logger.1 Fri Dec 23 04:38:27 2016 (r310452) @@ -116,14 +116,18 @@ If an unknown service name is used, prints a warning and falls back to port 514. .It Fl p Ar pri Enter the message with the specified priority. -The priority may be specified numerically or as a ``facility.level'' +The priority may be specified numerically or as a +.Li facility.level pair. -For example, ``\-p local3.info'' logs the message(s) as +For example, +.Dq Fl p Li local3.info +logs the message(s) as .Ar info Ns rmational level in the .Ar local3 facility. -The default is ``user.notice.'' +The default is +.Dq Li user.notice . .It Fl S Ar addr Ns \&: Ns Ar port Specify source address and/or source port when using .Fl h @@ -135,9 +139,9 @@ flag is enabled. Note that a numeric IPv6 address in .Ar addr must be enclosed with -.Qq \&[ +.Dq \&[ and -.Qq \&] . +.Dq \&] . .It Fl t Ar tag Mark every line in the log with the specified .Ar tag From owner-svn-src-all@freebsd.org Fri Dec 23 04:59:24 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 382DCC8C581; Fri, 23 Dec 2016 04:59:24 +0000 (UTC) (envelope-from hrs@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id ED0231EA8; Fri, 23 Dec 2016 04:59:23 +0000 (UTC) (envelope-from hrs@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBN4xNpo039515; Fri, 23 Dec 2016 04:59:23 GMT (envelope-from hrs@FreeBSD.org) Received: (from hrs@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBN4xNcl039514; Fri, 23 Dec 2016 04:59:23 GMT (envelope-from hrs@FreeBSD.org) Message-Id: <201612230459.uBN4xNcl039514@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hrs set sender to hrs@FreeBSD.org using -f From: Hiroki Sato Date: Fri, 23 Dec 2016 04:59:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310453 - head/usr.sbin/syslogd X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Dec 2016 04:59:24 -0000 Author: hrs Date: Fri Dec 23 04:59:22 2016 New Revision: 310453 URL: https://svnweb.freebsd.org/changeset/base/310453 Log: mdoc and style fixes. Modified: head/usr.sbin/syslogd/syslogd.8 Modified: head/usr.sbin/syslogd/syslogd.8 ============================================================================== --- head/usr.sbin/syslogd/syslogd.8 Fri Dec 23 04:38:27 2016 (r310452) +++ head/usr.sbin/syslogd/syslogd.8 Fri Dec 23 04:59:22 2016 (r310453) @@ -40,7 +40,7 @@ .Op Fl a Ar allowed_peer .Op Fl b Ar bind_address .Op Fl f Ar config_file -.Op Fl l Oo Ar mode \&: Oc Ns Ar path +.Op Fl l Oo Ar mode Ns \&: Oc Ns Ar path .Op Fl m Ar mark_interval .Op Fl P Ar pid_file .Op Fl p Ar log_socket @@ -48,7 +48,9 @@ .Sh DESCRIPTION The .Nm -utility reads and logs messages to the system console, log files, other +utility reads and logs messages to the system console, +log files, +other machines and/or users as specified by its configuration file. .Pp The options are as follows: @@ -64,7 +66,8 @@ to use IPv6 addresses only. .It Fl 8 Tells .Nm -not to interfere with 8-bit data. Normally +not to interfere with 8-bit data. +Normally .Nm will replace C1 control characters .Pq ISO 8859 and Unicode characters @@ -137,11 +140,13 @@ is IPv4 address, a missing .Ar masklen will be substituted by the historic class A or class B netmasks if .Ar ipaddr -belongs into the address range of class A or B, respectively, or -by 24 otherwise. +belongs into the address range of class A or B, +respectively, +or by 24 otherwise. If .Ar ipaddr -is IPv6 address, a missing +is IPv6 address, +a missing .Ar masklen will be substituted by 128. .It Xo @@ -191,29 +196,31 @@ is This option can be specified multiple times to bind to multiple addresses and/or ports. .It Fl C -Create log files that do not exist (permission is set to -.Li 0600 ) . +Create log files that do not exist +.Pq permission is set to Ql Li 0600 . .It Fl c Disable the compression of repeated instances of the same line into a single line of the form .Dq Li "last message repeated N times" when the output is a pipe to another program. -If specified twice, disable this compression in all cases. +If specified twice, +disable this compression in all cases. .It Fl d Put .Nm into debugging mode. This is probably only of use to developers working on .Nm . -.It Fl f +.It Fl f Ar config_file Specify the pathname of an alternate configuration file; the default is .Pa /etc/syslog.conf . .It Fl F Run .Nm -in the foreground, rather than going into daemon mode. This is useful if -some other process uses +in the foreground, +rather than going into daemon mode. +This is useful if some other process uses .Xr fork 2 and .Xr exec 3 @@ -230,52 +237,75 @@ Usually the .Dq kern facility is reserved for messages read directly from .Pa /dev/klog . -.It Fl m +.It Fl m Ar mark_interval Select the number of minutes between .Dq mark -messages; the default is 20 minutes. +messages; +the default is 20 minutes. .It Fl N -Disable binding on UDP sockets. RFC 3164 recommends that outgoing -syslogd messages should originate from the privileged port, this -option +Disable binding on UDP sockets. +RFC 3164 recommends that outgoing +.Nm +messages should originate from the privileged port, +this option .Em disables -the recommended behavior. This option inherits +the recommended behavior. +This option inherits .Fl s . .It Fl n -Disable dns query for every request. +Disable DNS query for every request. .It Fl o Prefix kernel messages with the full kernel boot file as determined by .Xr getbootfile 3 . Without this, the kernel message prefix is always .Dq Li kernel: . -.It Fl p +.It Fl p Ar log_socket Specify the pathname of an alternate log socket to be used instead; the default is .Pa /var/run/log . -.It Fl P +When a single +.Fl p +options are specified, +the default pathname is replaced with the specified one. +When two or more +.Fl p +options are specified, +the remaining pathnames are treated as additional log sockets. +.It Fl P Ar pid_file Specify an alternative file in which to store the process ID. The default is .Pa /var/run/syslog.pid . -.It Fl S +.It Fl S Ar logpriv_socket Specify the pathname of an alternate log socket for privileged -applications to be used instead; the default is +applications to be used instead; +the default is .Pa /var/run/logpriv . -.It Fl l +When a single +.Fl S +options are specified, +the default pathname is replaced with the specified one. +When two or more +.Fl S +options are specified, +the remaining pathnames are treated as additional log sockets. +.It Fl l Oo Ar mode Ns \&: Oc Ns Ar path Specify a location where .Nm should place an additional log socket. The primary use for this is to place additional log sockets in .Pa /var/run/log of various chroot filespaces. -File permissions for socket can be specified in octal representation -before socket name, delimited with a colon. -Path to socket location must be absolute. +File permissions for socket can be specified in octal representation in +.Ar mode , +delimited with a colon. +The socket location must be specified as an absolute pathname in +.Ar path . .It Fl s Operate in secure mode. Do not log messages from remote machines. -If -specified twice, no network socket will be opened at all, which also -disables logging to remote machines. +If specified twice, +no network socket will be opened at all, +which also disables logging to remote machines. .It Fl T Always use the local time and date for messages received from the network, instead of the timestamp field supplied in the message by the remote host. @@ -284,14 +314,16 @@ or are unable to generate a correct time .It Fl u Unique priority logging. Only log messages at the specified priority. -Without this option, messages at the stated priority or higher are logged. +Without this option, +messages at the stated priority or higher are logged. This option changes the default comparison from .Dq => to .Dq = . .It Fl v Verbose logging. -If specified once, the numeric facility and priority are +If specified once, +the numeric facility and priority are logged with each locally-written message. If specified more than once, the names of the facility and priority are logged with each locally-written @@ -318,7 +350,7 @@ from an Internet domain socket specified .Pa /etc/services , and from the special device .Pa /dev/klog -(to read kernel messages). +.Pq to read kernel messages . .Pp The .Nm @@ -333,8 +365,10 @@ This can be used to kill or reconfigure The message sent to .Nm should consist of a single line. -The message can contain a priority code, which should be a preceding -decimal number in angle braces, for example, +The message can contain a priority code, +which should be a preceding +decimal number in angle braces, +for example, .Sq Aq 5 . This priority code should map into the priorities defined in the include file @@ -342,9 +376,10 @@ include file .Pp For security reasons, .Nm -will not append to log files that do not exist (unless -.Fl C -option is specified); +will not append to log files that do not exist +.Po unless Fl C +option is specified +.Pc ; therefore, they must be created manually before running .Nm . .Pp @@ -393,23 +428,23 @@ options are extensions. .Sh BUGS The ability to log messages received in UDP packets is equivalent to -an unauthenticated remote disk-filling service, and should probably be -disabled by default. +an unauthenticated remote disk-filling service, +and should probably be disabled by default. Some sort of .No inter- Ns Nm syslogd authentication mechanism ought to be worked out. -To prevent the worst -abuse, use of the +To prevent the worst abuse, +use of the .Fl a option is therefore highly recommended. .Pp The .Fl a -matching algorithm does not pretend to be very efficient; use of numeric -IP addresses is faster than domain name comparison. -Since the allowed -peer list is being walked linearly, peer groups where frequent messages -are being anticipated from should be put early into the +matching algorithm does not pretend to be very efficient; +use of numeric IP addresses is faster than domain name comparison. +Since the allowed peer list is being walked linearly, +peer groups where frequent messages are being anticipated +from should be put early into the .Fl a list. .Pp From owner-svn-src-all@freebsd.org Fri Dec 23 05:02:18 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E77ABC8C7C4; Fri, 23 Dec 2016 05:02:18 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B009512BF; Fri, 23 Dec 2016 05:02:18 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBN52HYg041970; Fri, 23 Dec 2016 05:02:17 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBN52Hmq041969; Fri, 23 Dec 2016 05:02:17 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201612230502.uBN52Hmq041969@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Fri, 23 Dec 2016 05:02:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310454 - head/sys/kern X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Dec 2016 05:02:19 -0000 Author: markj Date: Fri Dec 23 05:02:17 2016 New Revision: 310454 URL: https://svnweb.freebsd.org/changeset/base/310454 Log: Add a comment explaining the race fixed by r310423. Suggested and reviewed by: jhb X-MFC With: r310423 Modified: head/sys/kern/subr_sleepqueue.c Modified: head/sys/kern/subr_sleepqueue.c ============================================================================== --- head/sys/kern/subr_sleepqueue.c Fri Dec 23 04:59:22 2016 (r310453) +++ head/sys/kern/subr_sleepqueue.c Fri Dec 23 05:02:17 2016 (r310454) @@ -892,7 +892,12 @@ sleepq_broadcast(void *wchan, int flags, KASSERT(sq->sq_type == (flags & SLEEPQ_TYPE), ("%s: mismatch between sleep/wakeup and cv_*", __func__)); - /* Resume all blocked threads on the sleep queue. */ + /* + * Resume all blocked threads on the sleep queue. The last thread will + * be given ownership of sq and may re-enqueue itself before + * sleepq_resume_thread() returns, so we must cache the "next" queue + * item at the beginning of the final iteration. + */ wakeup_swapper = 0; TAILQ_FOREACH_SAFE(td, &sq->sq_blocked[queue], td_slpq, tdn) { thread_lock(td); From owner-svn-src-all@freebsd.org Fri Dec 23 05:07:30 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1FB8FC8C860; Fri, 23 Dec 2016 05:07:30 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D8A9814F1; Fri, 23 Dec 2016 05:07:29 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBN57Tmb043572; Fri, 23 Dec 2016 05:07:29 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBN57Tln043571; Fri, 23 Dec 2016 05:07:29 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201612230507.uBN57Tln043571@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Ngie Cooper Date: Fri, 23 Dec 2016 05:07:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310455 - head/contrib/bsnmp/snmpd X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Dec 2016 05:07:30 -0000 Author: ngie Date: Fri Dec 23 05:07:28 2016 New Revision: 310455 URL: https://svnweb.freebsd.org/changeset/base/310455 Log: Clarify failure in snmp_output(..) with call to snmp_pdu_decode - Explicitly test snmp_pdu_encode against SNMP_CODE_OK instead of assuming any non-zero value is bad. - Print out the code before calling abort() to give the end-user something actionable to debug without having to recompile the binary, since the core might not have these details. MFC after: 1 week Modified: head/contrib/bsnmp/snmpd/main.c Modified: head/contrib/bsnmp/snmpd/main.c ============================================================================== --- head/contrib/bsnmp/snmpd/main.c Fri Dec 23 05:02:17 2016 (r310454) +++ head/contrib/bsnmp/snmpd/main.c Fri Dec 23 05:07:28 2016 (r310455) @@ -282,12 +282,13 @@ snmp_output(struct snmp_pdu *pdu, u_char const char *dest) { struct asn_buf resp_b; + enum snmp_code code; resp_b.asn_ptr = sndbuf; resp_b.asn_len = snmpd.txbuf; - if (snmp_pdu_encode(pdu, &resp_b) != 0) { - syslog(LOG_ERR, "cannot encode message"); + if ((code = snmp_pdu_encode(pdu, &resp_b)) != SNMP_CODE_OK) { + syslog(LOG_ERR, "cannot encode message (code=%d)", code); abort(); } if (debug.dump_pdus) { From owner-svn-src-all@freebsd.org Fri Dec 23 06:29:25 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A43EBC8DAD9; Fri, 23 Dec 2016 06:29:25 +0000 (UTC) (envelope-from hrs@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 667D51218; Fri, 23 Dec 2016 06:29:25 +0000 (UTC) (envelope-from hrs@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBN6TO4n075216; Fri, 23 Dec 2016 06:29:24 GMT (envelope-from hrs@FreeBSD.org) Received: (from hrs@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBN6TODs075215; Fri, 23 Dec 2016 06:29:24 GMT (envelope-from hrs@FreeBSD.org) Message-Id: <201612230629.uBN6TODs075215@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hrs set sender to hrs@FreeBSD.org using -f From: Hiroki Sato Date: Fri, 23 Dec 2016 06:29:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310456 - head/usr.sbin/syslogd X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Dec 2016 06:29:25 -0000 Author: hrs Date: Fri Dec 23 06:29:24 2016 New Revision: 310456 URL: https://svnweb.freebsd.org/changeset/base/310456 Log: - More ifdef INET and INET6. - Use STDERR_FILENO + 1 instead of "3". - Fix dprintf() in cvthname(). Modified: head/usr.sbin/syslogd/syslogd.c Modified: head/usr.sbin/syslogd/syslogd.c ============================================================================== --- head/usr.sbin/syslogd/syslogd.c Fri Dec 23 05:07:28 2016 (r310455) +++ head/usr.sbin/syslogd/syslogd.c Fri Dec 23 06:29:24 2016 (r310456) @@ -748,6 +748,7 @@ socklist_recv_sock(struct socklist *sl) static void unmapped(struct sockaddr *sa) { +#if defined(INET) && defined(INET6) struct sockaddr_in6 *sin6; struct sockaddr_in sin; @@ -766,6 +767,10 @@ unmapped(struct sockaddr *sa) memcpy(&sin.sin_addr, &sin6->sin6_addr.s6_addr[12], sizeof(sin.sin_addr)); memcpy(sa, &sin, sizeof(sin)); +#else + if (sa == NULL) + return; +#endif } static void @@ -1533,24 +1538,23 @@ cvthname(struct sockaddr *f) sigset_t omask, nmask; static char hname[NI_MAXHOST], ip[NI_MAXHOST]; - dprintf("cvthname(%d) len = %d, %zu\n", f->sa_family, f->sa_len, sizeof(struct sockaddr_in6)); + dprintf("cvthname(%d) len = %d\n", f->sa_family, f->sa_len); error = getnameinfo(f, f->sa_len, ip, sizeof(ip), NULL, 0, NI_NUMERICHOST); - dprintf("cvthname(%s)\n", ip); - if (error) { dprintf("Malformed from address %s\n", gai_strerror(error)); return ("???"); } + dprintf("cvthname(%s)\n", ip); + if (!resolve) return (ip); sigemptyset(&nmask); sigaddset(&nmask, SIGHUP); sigprocmask(SIG_BLOCK, &nmask, &omask); - error = getnameinfo((struct sockaddr *)f, - ((struct sockaddr *)f)->sa_len, - hname, sizeof hname, NULL, 0, NI_NAMEREQD); + error = getnameinfo(f, f->sa_len, hname, sizeof(hname), + NULL, 0, NI_NAMEREQD); sigprocmask(SIG_SETMASK, &omask, NULL); if (error) { dprintf("Host name for your address (%s) unknown\n", ip); @@ -2393,7 +2397,9 @@ allowaddr(char *s) struct servent *se; int masklen = -1; struct addrinfo hints, *res; +#ifdef INET in_addr_t *addrp, *maskp; +#endif #ifdef INET6 uint32_t *addr6p, *mask6p; #endif @@ -2459,7 +2465,9 @@ allowaddr(char *s) .ss_family = res->ai_family, .ss_len = res->ai_addrlen }; - if (res->ai_family == AF_INET) { + switch (res->ai_family) { +#ifdef INET + case AF_INET: maskp = &sstosin(&ap->a_mask)->sin_addr.s_addr; addrp = &sstosin(&ap->a_addr)->sin_addr.s_addr; if (masklen < 0) { @@ -2481,9 +2489,14 @@ allowaddr(char *s) } /* Lose any host bits in the network number. */ *addrp &= *maskp; - } + break; +#endif #ifdef INET6 - else if (res->ai_family == AF_INET6 && masklen <= 128) { + case AF_INET6: + if (masklen > 128) { + freeaddrinfo(res); + return (-1); + } if (masklen < 0) masklen = 128; mask6p = (uint32_t *)&sstosin6(&ap->a_mask)->sin6_addr.s6_addr32[0]; @@ -2501,9 +2514,9 @@ allowaddr(char *s) masklen -= 32; } } - } + break; #endif - else { + default: freeaddrinfo(res); return (-1); } @@ -2527,12 +2540,12 @@ allowaddr(char *s) printf("allowaddr: rule "); if (ap->isnumeric) { printf("numeric, "); - getnameinfo((struct sockaddr *)&ap->a_addr, - ((struct sockaddr *)&ap->a_addr)->sa_len, + getnameinfo(sstosa(&ap->a_addr), + (sstosa(&ap->a_addr))->sa_len, ip, sizeof ip, NULL, 0, NI_NUMERICHOST); printf("addr = %s, ", ip); - getnameinfo((struct sockaddr *)&ap->a_mask, - ((struct sockaddr *)&ap->a_mask)->sa_len, + getnameinfo(sstosa(&ap->a_mask), + (sstosa(&ap->a_mask))->sa_len, ip, sizeof ip, NULL, 0, NI_NUMERICHOST); printf("mask = %s; ", ip); } else { @@ -2552,7 +2565,9 @@ validate(struct sockaddr *sa, const char int i; char name[NI_MAXHOST], ip[NI_MAXHOST], port[NI_MAXSERV]; struct allowedpeer *ap; +#ifdef INET struct sockaddr_in *sin4, *a4p = NULL, *m4p = NULL; +#endif #ifdef INET6 struct sockaddr_in6 *sin6, *a6p = NULL, *m6p = NULL; #endif @@ -2602,7 +2617,8 @@ validate(struct sockaddr *sa, const char dprintf("rejected in rule %d due to address family mismatch.\n", i); continue; } - if (ap->a_addr.ss_family == AF_INET) { +#ifdef INET + else if (ap->a_addr.ss_family == AF_INET) { sin4 = satosin(sa); a4p = satosin(&ap->a_addr); m4p = satosin(&ap->a_mask); @@ -2612,6 +2628,7 @@ validate(struct sockaddr *sa, const char continue; } } +#endif #ifdef INET6 else if (ap->a_addr.ss_family == AF_INET6) { sin6 = satosin6(sa); @@ -2702,7 +2719,7 @@ p_open(const char *prog, pid_t *rpid) dup2(pfd[0], STDIN_FILENO); dup2(nulldesc, STDOUT_FILENO); dup2(nulldesc, STDERR_FILENO); - closefrom(3); + closefrom(STDERR_FILENO + 1); (void)execvp(_PATH_BSHELL, argv); _exit(255); From owner-svn-src-all@freebsd.org Fri Dec 23 06:35:20 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0EADAC8DE14; Fri, 23 Dec 2016 06:35:20 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D29571702; Fri, 23 Dec 2016 06:35:19 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBN6ZJqS078953; Fri, 23 Dec 2016 06:35:19 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBN6ZJAY078952; Fri, 23 Dec 2016 06:35:19 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201612230635.uBN6ZJAY078952@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Ngie Cooper Date: Fri, 23 Dec 2016 06:35:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310457 - head/etc X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Dec 2016 06:35:20 -0000 Author: ngie Date: Fri Dec 23 06:35:18 2016 New Revision: 310457 URL: https://svnweb.freebsd.org/changeset/base/310457 Log: Clean up trailing whitespace No functional change MFC after: 3 days Modified: head/etc/snmpd.config Modified: head/etc/snmpd.config ============================================================================== --- head/etc/snmpd.config Fri Dec 23 06:29:24 2016 (r310456) +++ head/etc/snmpd.config Fri Dec 23 06:35:18 2016 (r310457) @@ -127,7 +127,7 @@ snmpEnableAuthenTraps = 2 # The following block creates a user with name "bsnmp" and sets privacy # and encryption options to SHA256 message digests and AES encryption # for this user. -# +# # usmUserStatus.$(engine).$(user1) = 5 # usmUserAuthProtocol.$(engine).$(user1) = $(HMACSHAAuthProtocol) # usmUserAuthKeyChange.$(engine).$(user1) = $(user1passwd) @@ -170,7 +170,7 @@ snmpEnableAuthenTraps = 2 # vacmSecurityToGroupStatus.$(securityModelUSM).$(read) = 4 # vacmGroupName.$(securityModelUSM).$(read) = $(write) -# +# # The OID of the .iso.org.dod.internet subtree # # internetoid := 1.3.6.1 @@ -193,7 +193,7 @@ snmpEnableAuthenTraps = 2 # vacmAccessReadViewName.$(read)."".$(securityModelSNMPv1).$(noAuthNoPriv) = "internet" # -# Read-write access for SNMPv2 users +# Read-write access for SNMPv2 users # # vacmAccessStatus.$(write)."".$(securityModelSNMPv2c).$(noAuthNoPriv) = 4 # vacmAccessReadViewName.$(write)."".$(securityModelSNMPv2c).$(noAuthNoPriv) = "internet" From owner-svn-src-all@freebsd.org Fri Dec 23 06:56:50 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 28596C8C333; Fri, 23 Dec 2016 06:56:50 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 02FCE1F91; Fri, 23 Dec 2016 06:56:49 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBN6unbL087318; Fri, 23 Dec 2016 06:56:49 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBN6unvP087317; Fri, 23 Dec 2016 06:56:49 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201612230656.uBN6unvP087317@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Ngie Cooper Date: Fri, 23 Dec 2016 06:56:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310458 - head/etc X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Dec 2016 06:56:50 -0000 Author: ngie Date: Fri Dec 23 06:56:48 2016 New Revision: 310458 URL: https://svnweb.freebsd.org/changeset/base/310458 Log: Group all loadable modules in the %default section This will allow new users to uncomment the modules and have things work with less head scratching, in the event they decide to uncomment any of the section separators, e.g. %usm or %vcm, as the module loading is only effective in the %default section. MFC after: 1 week Modified: head/etc/snmpd.config Modified: head/etc/snmpd.config ============================================================================== --- head/etc/snmpd.config Fri Dec 23 06:35:18 2016 (r310457) +++ head/etc/snmpd.config Fri Dec 23 06:56:48 2016 (r310458) @@ -112,12 +112,63 @@ sysObjectId = 1.3.6.1.4.1.12325.1.1.2.1 snmpEnableAuthenTraps = 2 +# Uncomment `begemotSnmpdModulePath.".." = ".."' entries below to enable +# modules + +# +# Bridge module +# This requires the mibII module. +# +#begemotSnmpdModulePath."bridge" = "/usr/lib/snmp_bridge.so" + +# +# Host resources module +# This requires the mibII module. +# +#begemotSnmpdModulePath."hostres" = "/usr/lib/snmp_hostres.so" + +# +# LM75 Sensor module +# +#begemotSnmpdModulePath."lm75" = "/usr/lib/snmp_lm75.so" + +# +# MIB-2 module +# +begemotSnmpdModulePath."mibII" = "/usr/lib/snmp_mibII.so" + +# +# Netgraph module +# +#begemotSnmpdModulePath."netgraph" = "/usr/lib/snmp_netgraph.so" + +# +# pf(4) module +# +#begemotSnmpdModulePath."pf" = "/usr/lib/snmp_pf.so" + +# +# SNMPv3 Notification Targets +# +# begemotSnmpdModulePath."target" = "/usr/lib/snmp_target.so" + # # SNMPv3 User-based security module - must be loaded for SNMPv3 USM # #begemotSnmpdModulePath."usm" = "/usr/lib/snmp_usm.so" # +# SNMPv3 View-based Access Control module +# +#begemotSnmpdModulePath."vacm" = "/usr/lib/snmp_vacm.so" + +# +# Wireless module +# This requires the mibII module. +# +#begemotSnmpdModulePath."wlan" = "/usr/lib/snmp_wlan.so" + +# # SNMPv3 USM User definition. # @@ -147,11 +198,6 @@ snmpEnableAuthenTraps = 2 # # -# SNMPv3 View-based Access Control module -# -#begemotSnmpdModulePath."vacm" = "/usr/lib/snmp_vacm.so" - -# # Definition of view-based access control entries. # #%vacm @@ -215,11 +261,6 @@ snmpEnableAuthenTraps = 2 # vacmAccessWriteViewName.$(write)."".3.$(authPriv) = "restricted" # vacmAccessNotifyViewName.$(write)."".3.$(authPriv) = "restricted" -# -# SNMPv3 Notification Targets -# -# begemotSnmpdModulePath."target" = "/usr/lib/snmp_target.so" - #%target # Send notifications to target tag "test" # tag := "test" @@ -259,49 +300,12 @@ snmpEnableAuthenTraps = 2 # snmpTargetAddrParams.$(tagremote) = $(tag) # snmpTargetAddrRowStatus.$(tagremote) = 1 -# -# Load MIB-2 module -# -begemotSnmpdModulePath."mibII" = "/usr/lib/snmp_mibII.so" - # Force a polling rate for the 64-bit interface counters in case # the automatic computation is wrong (which may be the case if an interface # announces the wrong bit rate via its MIB). #%mibII #begemotIfForcePoll = 2000 - -# Netgraph module -# -#begemotSnmpdModulePath."netgraph" = "/usr/lib/snmp_netgraph.so" -# #%netgraph #begemotNgControlNodeName = "snmpd" -# -# LM75 Sensor module -# -#begemotSnmpdModulePath."lm75" = "/usr/lib/snmp_lm75.so" - -# -# pf(4) module -# -#begemotSnmpdModulePath."pf" = "/usr/lib/snmp_pf.so" - -# -# Host resources module -# This requires the mibII module. -# -#begemotSnmpdModulePath."hostres" = "/usr/lib/snmp_hostres.so" - -# -# Bridge module -# This requires the mibII module. -# -#begemotSnmpdModulePath."bridge" = "/usr/lib/snmp_bridge.so" - -# -# Wireless module -# This requires the mibII module. -# -#begemotSnmpdModulePath."wlan" = "/usr/lib/snmp_wlan.so" From owner-svn-src-all@freebsd.org Fri Dec 23 07:55:14 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E4277C8D78B; Fri, 23 Dec 2016 07:55:14 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B0E651D11; Fri, 23 Dec 2016 07:55:14 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBN7tDvT012486; Fri, 23 Dec 2016 07:55:13 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBN7tDx9012485; Fri, 23 Dec 2016 07:55:13 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201612230755.uBN7tDx9012485@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Ngie Cooper Date: Fri, 23 Dec 2016 07:55:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310459 - head/contrib/bsnmp/snmpd X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Dec 2016 07:55:15 -0000 Author: ngie Date: Fri Dec 23 07:55:13 2016 New Revision: 310459 URL: https://svnweb.freebsd.org/changeset/base/310459 Log: Sort #includes per style(9) No functional change MFC after: 3 days Modified: head/contrib/bsnmp/snmpd/action.c Modified: head/contrib/bsnmp/snmpd/action.c ============================================================================== --- head/contrib/bsnmp/snmpd/action.c Fri Dec 23 06:56:48 2016 (r310458) +++ head/contrib/bsnmp/snmpd/action.c Fri Dec 23 07:55:13 2016 (r310459) @@ -38,12 +38,12 @@ #include #include #include +#include +#include +#include #include #include -#include #include -#include -#include #include #include "snmpmod.h" From owner-svn-src-all@freebsd.org Fri Dec 23 08:41:29 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C6152C89806; Fri, 23 Dec 2016 08:41:29 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 870DA16CB; Fri, 23 Dec 2016 08:41:29 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBN8fSWP032227; Fri, 23 Dec 2016 08:41:28 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBN8fS6C032225; Fri, 23 Dec 2016 08:41:28 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201612230841.uBN8fS6C032225@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Fri, 23 Dec 2016 08:41:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310462 - head/sys/dev/hyperv/utilities X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Dec 2016 08:41:29 -0000 Author: sephe Date: Fri Dec 23 08:41:28 2016 New Revision: 310462 URL: https://svnweb.freebsd.org/changeset/base/310462 Log: hyperv/ic: Fix version4 timesync message format. It is not compat w/ the old timesync message format, which the message type stays the same as the old timesync message. MFC after: 1 week Sponsored by: Microsoft Modified: head/sys/dev/hyperv/utilities/vmbus_icreg.h head/sys/dev/hyperv/utilities/vmbus_timesync.c Modified: head/sys/dev/hyperv/utilities/vmbus_icreg.h ============================================================================== --- head/sys/dev/hyperv/utilities/vmbus_icreg.h Fri Dec 23 08:31:29 2016 (r310461) +++ head/sys/dev/hyperv/utilities/vmbus_icreg.h Fri Dec 23 08:41:28 2016 (r310462) @@ -114,8 +114,17 @@ struct vmbus_icmsg_timesync { struct vmbus_icmsg_hdr ic_hdr; uint64_t ic_hvtime; uint64_t ic_vmtime; + uint64_t ic_rtt; + uint8_t ic_tsflags; /* VMBUS_ICMSG_TS_FLAG_ */ +} __packed; + +/* VMBUS_ICMSG_TYPE_TIMESYNC, MSGVER4 */ +struct vmbus_icmsg_timesync4 { + struct vmbus_icmsg_hdr ic_hdr; + uint64_t ic_hvtime; uint64_t ic_sent_tc; uint8_t ic_tsflags; /* VMBUS_ICMSG_TS_FLAG_ */ + uint8_t ic_rsvd[5]; } __packed; #define VMBUS_ICMSG_TS_FLAG_SYNC 0x01 Modified: head/sys/dev/hyperv/utilities/vmbus_timesync.c ============================================================================== --- head/sys/dev/hyperv/utilities/vmbus_timesync.c Fri Dec 23 08:31:29 2016 (r310461) +++ head/sys/dev/hyperv/utilities/vmbus_timesync.c Fri Dec 23 08:41:28 2016 (r310462) @@ -48,8 +48,11 @@ __FBSDID("$FreeBSD$"); #define VMBUS_TIMESYNC_MSGVER \ VMBUS_IC_VERSION(VMBUS_TIMESYNC_MSGVER_MAJOR, 0) +#define VMBUS_TIMESYNC_MSGVER4(sc) \ + VMBUS_ICVER_LE(VMBUS_IC_VERSION(4, 0), (sc)->ic_msgver) + #define VMBUS_TIMESYNC_DORTT(sc) \ - ((sc)->ic_msgver >= VMBUS_IC_VERSION(4, 0) && \ + (VMBUS_TIMESYNC_MSGVER4((sc)) &&\ (hyperv_features & CPUID_HV_MSR_TIME_REFCNT)) static int vmbus_timesync_probe(device_t); @@ -174,7 +177,6 @@ vmbus_timesync_cb(struct vmbus_channel * { struct vmbus_ic_softc *sc = xsc; struct vmbus_icmsg_hdr *hdr; - const struct vmbus_icmsg_timesync *msg; int dlen, error; uint64_t xactid; void *data; @@ -209,14 +211,28 @@ vmbus_timesync_cb(struct vmbus_channel * break; case VMBUS_ICMSG_TYPE_TIMESYNC: - if (dlen < sizeof(*msg)) { - device_printf(sc->ic_dev, "invalid timesync len %d\n", - dlen); - return; + if (VMBUS_TIMESYNC_MSGVER4(sc)) { + const struct vmbus_icmsg_timesync4 *msg4; + + if (dlen < sizeof(*msg4)) { + device_printf(sc->ic_dev, "invalid timesync4 " + "len %d\n", dlen); + return; + } + msg4 = data; + vmbus_timesync(sc, msg4->ic_hvtime, msg4->ic_sent_tc, + msg4->ic_tsflags); + } else { + const struct vmbus_icmsg_timesync *msg; + + if (dlen < sizeof(*msg)) { + device_printf(sc->ic_dev, "invalid timesync " + "len %d\n", dlen); + return; + } + msg = data; + vmbus_timesync(sc, msg->ic_hvtime, 0, msg->ic_tsflags); } - msg = data; - vmbus_timesync(sc, msg->ic_hvtime, msg->ic_sent_tc, - msg->ic_tsflags); break; default: From owner-svn-src-all@freebsd.org Fri Dec 23 08:44:11 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D64C3C898B6; Fri, 23 Dec 2016 08:44:11 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A59901A5C; Fri, 23 Dec 2016 08:44:11 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBN8iAl9033236; Fri, 23 Dec 2016 08:44:10 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBN8iAo5033235; Fri, 23 Dec 2016 08:44:10 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201612230844.uBN8iAo5033235@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Ngie Cooper Date: Fri, 23 Dec 2016 08:44:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r310463 - stable/11/sys/modules/ioat X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Dec 2016 08:44:11 -0000 Author: ngie Date: Fri Dec 23 08:44:10 2016 New Revision: 310463 URL: https://svnweb.freebsd.org/changeset/base/310463 Log: MFC r309521: Unbreak "make depend" with sys/modules/ioat by adding opt_ddb.h to SRCS Modified: stable/11/sys/modules/ioat/Makefile Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/modules/ioat/Makefile ============================================================================== --- stable/11/sys/modules/ioat/Makefile Fri Dec 23 08:41:28 2016 (r310462) +++ stable/11/sys/modules/ioat/Makefile Fri Dec 23 08:44:10 2016 (r310463) @@ -9,6 +9,7 @@ IOAT_SRC_PATH = ${.CURDIR}/../.. KMOD= ioat SRCS= ioat.c ioat_test.c SRCS+= device_if.h bus_if.h pci_if.h +SRCS+= opt_ddb.h CFLAGS+= -I${IOAT_SRC_PATH} From owner-svn-src-all@freebsd.org Fri Dec 23 08:52:11 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7382EC89D55; Fri, 23 Dec 2016 08:52:11 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 430381100; Fri, 23 Dec 2016 08:52:11 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBN8qA3b036881; Fri, 23 Dec 2016 08:52:10 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBN8qAiE036880; Fri, 23 Dec 2016 08:52:10 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201612230852.uBN8qAiE036880@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Fri, 23 Dec 2016 08:52:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310465 - head/sys/dev/hyperv/utilities X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Dec 2016 08:52:11 -0000 Author: sephe Date: Fri Dec 23 08:52:10 2016 New Revision: 310465 URL: https://svnweb.freebsd.org/changeset/base/310465 Log: hyperv/ic: Allow applying the samples from hypervisor unconditionally. MFC after: 1 week Sponsored by: Microsoft Modified: head/sys/dev/hyperv/utilities/vmbus_timesync.c Modified: head/sys/dev/hyperv/utilities/vmbus_timesync.c ============================================================================== --- head/sys/dev/hyperv/utilities/vmbus_timesync.c Fri Dec 23 08:49:30 2016 (r310464) +++ head/sys/dev/hyperv/utilities/vmbus_timesync.c Fri Dec 23 08:52:10 2016 (r310465) @@ -139,7 +139,7 @@ vmbus_timesync(struct vmbus_ic_softc *sc } if ((tsflags & VMBUS_ICMSG_TS_FLAG_SAMPLE) && - vmbus_ts_sample_thresh > 0) { + vmbus_ts_sample_thresh >= 0) { int64_t diff; if (vmbus_ts_sample_verbose) { From owner-svn-src-all@freebsd.org Fri Dec 23 08:54:45 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4CED5C89EAA; Fri, 23 Dec 2016 08:54:45 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 1CC3D1394; Fri, 23 Dec 2016 08:54:45 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBN8siwF037209; Fri, 23 Dec 2016 08:54:44 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBN8si3Q037208; Fri, 23 Dec 2016 08:54:44 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201612230854.uBN8si3Q037208@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Ngie Cooper Date: Fri, 23 Dec 2016 08:54:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310466 - head/etc X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Dec 2016 08:54:45 -0000 Author: ngie Date: Fri Dec 23 08:54:44 2016 New Revision: 310466 URL: https://svnweb.freebsd.org/changeset/base/310466 Log: Don't hardcode $(securityModelUSM) (3) in the authPriv example under the %vacm section MFC after: 1 week Modified: head/etc/snmpd.config Modified: head/etc/snmpd.config ============================================================================== --- head/etc/snmpd.config Fri Dec 23 08:52:10 2016 (r310465) +++ head/etc/snmpd.config Fri Dec 23 08:54:44 2016 (r310466) @@ -256,10 +256,10 @@ begemotSnmpdModulePath."mibII" = "/usr/l # #Read-write-notify access to restricted for SNMPv3 USM users with authPriv # -# vacmAccessStatus.$(write)."".3.$(authPriv) = 4 -# vacmAccessReadViewName.$(write)."".3.$(authPriv) = "restricted" -# vacmAccessWriteViewName.$(write)."".3.$(authPriv) = "restricted" -# vacmAccessNotifyViewName.$(write)."".3.$(authPriv) = "restricted" +# vacmAccessStatus.$(write)."".$(securityModelUSM).$(authPriv) = 4 +# vacmAccessReadViewName.$(write)."".$(securityModelUSM).$(authPriv) = "restricted" +# vacmAccessWriteViewName.$(write)."".$(securityModelUSM).$(authPriv) = "restricted" +# vacmAccessNotifyViewName.$(write)."".$(securityModelUSM).$(authPriv) = "restricted" #%target # Send notifications to target tag "test" From owner-svn-src-all@freebsd.org Fri Dec 23 08:59:25 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 021E5C89FA1; Fri, 23 Dec 2016 08:59:25 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C5A3215D9; Fri, 23 Dec 2016 08:59:24 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBN8xN4k037482; Fri, 23 Dec 2016 08:59:23 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBN8xNaP037481; Fri, 23 Dec 2016 08:59:23 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201612230859.uBN8xNaP037481@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Ngie Cooper Date: Fri, 23 Dec 2016 08:59:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310467 - head/etc X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Dec 2016 08:59:25 -0000 Author: ngie Date: Fri Dec 23 08:59:23 2016 New Revision: 310467 URL: https://svnweb.freebsd.org/changeset/base/310467 Log: Provide some guidance when dealing with sections and variables contained within them For example, using variables designated for %usm requires uncommenting %usm section header MFC after: 1 month Modified: head/etc/snmpd.config Modified: head/etc/snmpd.config ============================================================================== --- head/etc/snmpd.config Fri Dec 23 08:54:44 2016 (r310466) +++ head/etc/snmpd.config Fri Dec 23 08:59:23 2016 (r310467) @@ -116,6 +116,14 @@ snmpEnableAuthenTraps = 2 # modules # +# Control configuration for the modules in the module specific sections, e.g. +# the "usm" module (begemotSnmpdModulePath."usm") can be controlled in the +# %usm specific section. You must uncomment the section specific header in +# order to use the enclosed variables, e.g. `usmUserStatus.$(engine).$(user1)` +# can only be used if %usm is uncommented. +# + +# # Bridge module # This requires the mibII module. # From owner-svn-src-all@freebsd.org Fri Dec 23 09:27:27 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 28EC1C8CA51; Fri, 23 Dec 2016 09:27:27 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D244F14E2; Fri, 23 Dec 2016 09:27:26 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBN9RQHT049776; Fri, 23 Dec 2016 09:27:26 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBN9RQNH049775; Fri, 23 Dec 2016 09:27:26 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201612230927.uBN9RQNH049775@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Fri, 23 Dec 2016 09:27:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r310469 - stable/11/sys/kern X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Dec 2016 09:27:27 -0000 Author: kib Date: Fri Dec 23 09:27:25 2016 New Revision: 310469 URL: https://svnweb.freebsd.org/changeset/base/310469 Log: MFC r310159: Switch from stdatomic.h to atomic.h for kernel. Modified: stable/11/sys/kern/kern_event.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/kern/kern_event.c ============================================================================== --- stable/11/sys/kern/kern_event.c Fri Dec 23 09:10:57 2016 (r310468) +++ stable/11/sys/kern/kern_event.c Fri Dec 23 09:27:25 2016 (r310469) @@ -48,7 +48,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include #include @@ -69,6 +68,7 @@ __FBSDID("$FreeBSD$"); #ifdef KTRACE #include #endif +#include #include @@ -188,7 +188,7 @@ static struct filterops user_filtops = { }; static uma_zone_t knote_zone; -static atomic_uint kq_ncallouts = ATOMIC_VAR_INIT(0); +static unsigned int kq_ncallouts = 0; static unsigned int kq_calloutmax = 4 * 1024; SYSCTL_UINT(_kern, OID_AUTO, kq_calloutmax, CTLFLAG_RW, &kq_calloutmax, 0, "Maximum number of callouts allocated for kqueue"); @@ -672,13 +672,11 @@ filt_timerattach(struct knote *kn) if (to < 0) return (EINVAL); - ncallouts = atomic_load_explicit(&kq_ncallouts, memory_order_relaxed); do { + ncallouts = kq_ncallouts; if (ncallouts >= kq_calloutmax) return (ENOMEM); - } while (!atomic_compare_exchange_weak_explicit(&kq_ncallouts, - &ncallouts, ncallouts + 1, memory_order_relaxed, - memory_order_relaxed)); + } while (!atomic_cmpset_int(&kq_ncallouts, ncallouts, ncallouts + 1)); kn->kn_flags |= EV_CLEAR; /* automatically set */ kn->kn_status &= ~KN_DETACHED; /* knlist_add clears it */ @@ -703,7 +701,7 @@ filt_timerdetach(struct knote *kn) callout_drain(calloutp); free(calloutp, M_KQUEUE); free(kn->kn_ptr.p_nexttime, M_KQUEUE); - old = atomic_fetch_sub_explicit(&kq_ncallouts, 1, memory_order_relaxed); + old = atomic_fetchadd_int(&kq_ncallouts, -1); KASSERT(old > 0, ("Number of callouts cannot become negative")); kn->kn_status |= KN_DETACHED; /* knlist_remove sets it */ } From owner-svn-src-all@freebsd.org Fri Dec 23 09:30:36 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2ECBAC8CB86; Fri, 23 Dec 2016 09:30:36 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id F244416B7; Fri, 23 Dec 2016 09:30:35 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBN9UZLO050104; Fri, 23 Dec 2016 09:30:35 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBN9UZoA050103; Fri, 23 Dec 2016 09:30:35 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201612230930.uBN9UZoA050103@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Fri, 23 Dec 2016 09:30:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r310470 - stable/11/sys/vm X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Dec 2016 09:30:36 -0000 Author: kib Date: Fri Dec 23 09:30:34 2016 New Revision: 310470 URL: https://svnweb.freebsd.org/changeset/base/310470 Log: MFC r310182: In swp_pager_meta_free_all(), fix type of the index variable. Style. Modified: stable/11/sys/vm/swap_pager.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/vm/swap_pager.c ============================================================================== --- stable/11/sys/vm/swap_pager.c Fri Dec 23 09:27:25 2016 (r310469) +++ stable/11/sys/vm/swap_pager.c Fri Dec 23 09:30:34 2016 (r310470) @@ -1913,30 +1913,30 @@ swp_pager_meta_free(vm_object_t object, static void swp_pager_meta_free_all(vm_object_t object) { - daddr_t index = 0; + struct swblock **pswap, *swap; + vm_pindex_t index; + daddr_t v; + int i; VM_OBJECT_ASSERT_WLOCKED(object); if (object->type != OBJT_SWAP) return; - while (object->un_pager.swp.swp_bcount) { - struct swblock **pswap; - struct swblock *swap; - + index = 0; + while (object->un_pager.swp.swp_bcount != 0) { mtx_lock(&swhash_mtx); pswap = swp_pager_hash(object, index); if ((swap = *pswap) != NULL) { - int i; - for (i = 0; i < SWAP_META_PAGES; ++i) { - daddr_t v = swap->swb_pages[i]; + v = swap->swb_pages[i]; if (v != SWAPBLK_NONE) { --swap->swb_count; swp_pager_freeswapspace(v, 1); } } if (swap->swb_count != 0) - panic("swap_pager_meta_free_all: swb_count != 0"); + panic( + "swap_pager_meta_free_all: swb_count != 0"); *pswap = swap->swb_hnext; uma_zfree(swap_zone, swap); --object->un_pager.swp.swp_bcount; From owner-svn-src-all@freebsd.org Fri Dec 23 09:35:40 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8D424C8CE40; Fri, 23 Dec 2016 09:35:40 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 42A951C60; Fri, 23 Dec 2016 09:35:40 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBN9ZdH8053813; Fri, 23 Dec 2016 09:35:39 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBN9ZdIV053812; Fri, 23 Dec 2016 09:35:39 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201612230935.uBN9ZdIV053812@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Fri, 23 Dec 2016 09:35:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r310471 - stable/10/sys/kern X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Dec 2016 09:35:40 -0000 Author: kib Date: Fri Dec 23 09:35:39 2016 New Revision: 310471 URL: https://svnweb.freebsd.org/changeset/base/310471 Log: MFC r310159: Switch from stdatomic.h to atomic.h for kernel. Modified: stable/10/sys/kern/kern_event.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/kern/kern_event.c ============================================================================== --- stable/10/sys/kern/kern_event.c Fri Dec 23 09:30:34 2016 (r310470) +++ stable/10/sys/kern/kern_event.c Fri Dec 23 09:35:39 2016 (r310471) @@ -47,7 +47,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include #include @@ -66,6 +65,7 @@ __FBSDID("$FreeBSD$"); #ifdef KTRACE #include #endif +#include #include @@ -184,7 +184,7 @@ static struct filterops user_filtops = { }; static uma_zone_t knote_zone; -static atomic_uint kq_ncallouts = ATOMIC_VAR_INIT(0); +static unsigned int kq_ncallouts = 0; static unsigned int kq_calloutmax = 4 * 1024; SYSCTL_UINT(_kern, OID_AUTO, kq_calloutmax, CTLFLAG_RW, &kq_calloutmax, 0, "Maximum number of callouts allocated for kqueue"); @@ -652,13 +652,11 @@ filt_timerattach(struct knote *kn) if (to < 0) return (EINVAL); - ncallouts = atomic_load_explicit(&kq_ncallouts, memory_order_relaxed); do { + ncallouts = kq_ncallouts; if (ncallouts >= kq_calloutmax) return (ENOMEM); - } while (!atomic_compare_exchange_weak_explicit(&kq_ncallouts, - &ncallouts, ncallouts + 1, memory_order_relaxed, - memory_order_relaxed)); + } while (!atomic_cmpset_int(&kq_ncallouts, ncallouts, ncallouts + 1)); kn->kn_flags |= EV_CLEAR; /* automatically set */ kn->kn_status &= ~KN_DETACHED; /* knlist_add clears it */ @@ -683,7 +681,7 @@ filt_timerdetach(struct knote *kn) callout_drain(calloutp); free(calloutp, M_KQUEUE); free(kn->kn_ptr.p_nexttime, M_KQUEUE); - old = atomic_fetch_sub_explicit(&kq_ncallouts, 1, memory_order_relaxed); + old = atomic_fetchadd_int(&kq_ncallouts, -1); KASSERT(old > 0, ("Number of callouts cannot become negative")); kn->kn_status |= KN_DETACHED; /* knlist_remove sets it */ } From owner-svn-src-all@freebsd.org Fri Dec 23 09:39:51 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id EB515C8CF03; Fri, 23 Dec 2016 09:39:51 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id BAA7C1DF7; Fri, 23 Dec 2016 09:39:51 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBN9dopr054001; Fri, 23 Dec 2016 09:39:50 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBN9doa7054000; Fri, 23 Dec 2016 09:39:50 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201612230939.uBN9doa7054000@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Fri, 23 Dec 2016 09:39:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r310472 - stable/10/sys/vm X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Dec 2016 09:39:52 -0000 Author: kib Date: Fri Dec 23 09:39:50 2016 New Revision: 310472 URL: https://svnweb.freebsd.org/changeset/base/310472 Log: MFC r310182: In swp_pager_meta_free_all(), fix type of the index variable. Style. Modified: stable/10/sys/vm/swap_pager.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/vm/swap_pager.c ============================================================================== --- stable/10/sys/vm/swap_pager.c Fri Dec 23 09:35:39 2016 (r310471) +++ stable/10/sys/vm/swap_pager.c Fri Dec 23 09:39:50 2016 (r310472) @@ -1997,30 +1997,30 @@ swp_pager_meta_free(vm_object_t object, static void swp_pager_meta_free_all(vm_object_t object) { - daddr_t index = 0; + struct swblock **pswap, *swap; + vm_pindex_t index; + daddr_t v; + int i; VM_OBJECT_ASSERT_WLOCKED(object); if (object->type != OBJT_SWAP) return; - while (object->un_pager.swp.swp_bcount) { - struct swblock **pswap; - struct swblock *swap; - + index = 0; + while (object->un_pager.swp.swp_bcount != 0) { mtx_lock(&swhash_mtx); pswap = swp_pager_hash(object, index); if ((swap = *pswap) != NULL) { - int i; - for (i = 0; i < SWAP_META_PAGES; ++i) { - daddr_t v = swap->swb_pages[i]; + v = swap->swb_pages[i]; if (v != SWAPBLK_NONE) { --swap->swb_count; swp_pager_freeswapspace(v, 1); } } if (swap->swb_count != 0) - panic("swap_pager_meta_free_all: swb_count != 0"); + panic( + "swap_pager_meta_free_all: swb_count != 0"); *pswap = swap->swb_hnext; uma_zfree(swap_zone, swap); --object->un_pager.swp.swp_bcount; From owner-svn-src-all@freebsd.org Fri Dec 23 10:23:37 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id CC383C8D1BC; Fri, 23 Dec 2016 10:23:37 +0000 (UTC) (envelope-from theraven@FreeBSD.org) Received: from theravensnest.org (theraven.freebsd.your.org [216.14.102.27]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "cloud.theravensnest.org", Issuer "StartCom Class 1 DV Server CA" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id A60951F9C; Fri, 23 Dec 2016 10:23:36 +0000 (UTC) (envelope-from theraven@FreeBSD.org) Received: from pc40.home (ABordeaux-656-1-243-246.w90-38.abo.wanadoo.fr [90.38.35.246]) (authenticated bits=0) by theravensnest.org (8.15.2/8.15.2) with ESMTPSA id uBNANBnx055998 (version=TLSv1 cipher=ECDHE-RSA-AES256-SHA bits=256 verify=NO); Fri, 23 Dec 2016 10:23:22 GMT (envelope-from theraven@FreeBSD.org) X-Authentication-Warning: theravensnest.org: Host ABordeaux-656-1-243-246.w90-38.abo.wanadoo.fr [90.38.35.246] claimed to be pc40.home Content-Type: multipart/signed; boundary="Apple-Mail=_FE5AB27D-9CFA-4009-A999-3BEFFE9DA562"; protocol="application/pkcs7-signature"; micalg=sha1 Mime-Version: 1.0 (Mac OS X Mail 9.3 \(3124\)) Subject: Re: svn commit: r310138 - head/lib/libc/stdio From: David Chisnall In-Reply-To: <20161222220245.zolanf4f2sii352d@ivaldir.etoilebsd.net> Date: Fri, 23 Dec 2016 11:23:08 +0100 Cc: Jilles Tjoelker , Conrad Meyer , Adrian Chadd , src-committers , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" Message-Id: References: <201612160144.uBG1ipjW016736@repo.freebsd.org> <49460793.UcUNovQMDa@ralph.baldwin.cx> <1482281779.48539.41.camel@freebsd.org> <20161221220212.GA97256@stack.nl> <20161222220245.zolanf4f2sii352d@ivaldir.etoilebsd.net> To: Baptiste Daroussin X-Mailer: Apple Mail (2.3124) X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Dec 2016 10:23:37 -0000 --Apple-Mail=_FE5AB27D-9CFA-4009-A999-3BEFFE9DA562 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 On 22 Dec 2016, at 23:02, Baptiste Daroussin wrote: >=20 > I think it is pretty clear that there are too many people requesting = the revert > for the revert not to be done. Even if this feature is desired, the implementation in the patch is = broken and should be reverted until a correct implementation (one that = doesn=E2=80=99t break the first time user code calls register_printf_*) = is done. David --Apple-Mail=_FE5AB27D-9CFA-4009-A999-3BEFFE9DA562 Content-Disposition: attachment; filename=smime.p7s Content-Type: application/pkcs7-signature; name=smime.p7s Content-Transfer-Encoding: base64 MIAGCSqGSIb3DQEHAqCAMIACAQExCzAJBgUrDgMCGgUAMIAGCSqGSIb3DQEHAQAAoIIK5jCCBPww ggPkoAMCAQICECJrrb9nBol9MHok/UZg/AYwDQYJKoZIhvcNAQELBQAwdTELMAkGA1UEBhMCSUwx FjAUBgNVBAoTDVN0YXJ0Q29tIEx0ZC4xKTAnBgNVBAsTIFN0YXJ0Q29tIENlcnRpZmljYXRpb24g QXV0aG9yaXR5MSMwIQYDVQQDExpTdGFydENvbSBDbGFzcyAxIENsaWVudCBDQTAeFw0xNjA0MTkw OTI3NDJaFw0xNzA0MTkwOTI3NDJaMEQxHTAbBgNVBAMMFHRoZXJhdmVuQGZyZWVic2Qub3JnMSMw IQYJKoZIhvcNAQkBFhR0aGVyYXZlbkBmcmVlYnNkLm9yZzCCASIwDQYJKoZIhvcNAQEBBQADggEP ADCCAQoCggEBALsL5pEhrGjrswHVdMHWhgxb8ARKDYRePSqpDLmjJ40bpx+n1zrvIwjC2Vk2IpoD 04rg5Pog2IrhnX+Qk2NSXzBXWj2JAaTc9OtSeAY0BtgJYXONGONQbRKVy97QBdzd1SbMEzDrOgH5 UDI+5sF1PboOTmLyTAPI9273XdfZ0BnstUXs8NXr/7p9E5CWJOsO1iQcINbm4XiwC1PLNMeWUknE Nji/hFKwcE8IFtaUe1ymbw6yA3rBpDu3KewIRD1T66FPTZJeIzvUoBIqWd+GAOfCBG2QYmbc3y/x K2hCtcXThcB1uVFA2q39koLKA8wHyqv4Jhm3wzhAqKDsWK4bGW0CAwEAAaOCAbcwggGzMA4GA1Ud DwEB/wQEAwIEsDAdBgNVHSUEFjAUBggrBgEFBQcDAgYIKwYBBQUHAwQwCQYDVR0TBAIwADAdBgNV HQ4EFgQU5J3Kc8GeW8pEGxBkcMoA7eUOPRwwHwYDVR0jBBgwFoAUJIFsOWG+SQ+PtxtGK8kotSdI bWgwbwYIKwYBBQUHAQEEYzBhMCQGCCsGAQUFBzABhhhodHRwOi8vb2NzcC5zdGFydHNzbC5jb20w OQYIKwYBBQUHMAKGLWh0dHA6Ly9haWEuc3RhcnRzc2wuY29tL2NlcnRzL3NjYS5jbGllbnQxLmNy dDA4BgNVHR8EMTAvMC2gK6AphidodHRwOi8vY3JsLnN0YXJ0c3NsLmNvbS9zY2EtY2xpZW50MS5j cmwwHwYDVR0RBBgwFoEUdGhlcmF2ZW5AZnJlZWJzZC5vcmcwIwYDVR0SBBwwGoYYaHR0cDovL3d3 dy5zdGFydHNzbC5jb20vMEYGA1UdIAQ/MD0wOwYLKwYBBAGBtTcBAgUwLDAqBggrBgEFBQcCARYe aHR0cDovL3d3dy5zdGFydHNzbC5jb20vcG9saWN5MA0GCSqGSIb3DQEBCwUAA4IBAQBSBDH+kZf5 bZkNFcMSPdfnGC7F8utBIxs2bi3JQjsBoQTm1vnXdwgINSfO9At6iQZHoEyj8ZE6PcMFuEU0+bk0 aE8aYcW59WnxfWx943upZoMhX0YVaJcFK01EHFrddRAP44sh7Eu6JtdFuAG+6btDReMcg35Qm65X 7/280aVm7awadJ+IQs8r9qBVk2NFqkvHCETtJjNWXd7M6mcsfXstvykbubPQH/VNW/zrX6yzIcI4 aoz+Sn8RJmHNkk6cImqe1KvsdDLXmqCoeoMwos62pT18RaI//jwTdmnf5EHFMlevnxOr7rzA++71 OSZfdYf6+nvHOod1F721rNuy6lxFMIIF4jCCA8qgAwIBAgIQa6eKfQrXiNZRCvlZ5Oe04TANBgkq hkiG9w0BAQsFADB9MQswCQYDVQQGEwJJTDEWMBQGA1UEChMNU3RhcnRDb20gTHRkLjErMCkGA1UE CxMiU2VjdXJlIERpZ2l0YWwgQ2VydGlmaWNhdGUgU2lnbmluZzEpMCcGA1UEAxMgU3RhcnRDb20g Q2VydGlmaWNhdGlvbiBBdXRob3JpdHkwHhcNMTUxMjE2MDEwMDA1WhcNMzAxMjE2MDEwMDA1WjB1 MQswCQYDVQQGEwJJTDEWMBQGA1UEChMNU3RhcnRDb20gTHRkLjEpMCcGA1UECxMgU3RhcnRDb20g Q2VydGlmaWNhdGlvbiBBdXRob3JpdHkxIzAhBgNVBAMTGlN0YXJ0Q29tIENsYXNzIDEgQ2xpZW50 IENBMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAvX3a98OifYP2W4L921tfrh4bdcC1 Ga+YJKy7V3nYNewJHnzMlBsK0Hb8Dm4Wo3FZpylcYa1MJGT10QMGWaLER3xCIuRR+8eklf/EqeZW RLojJ7zBRtjMywPOCelrOU+DX12dKp+Ez4J6919rz1UudTO1GvZyCYJ/I7062uHsskM8b7gPxmcC oO1UHwwpgkvpCArJWGFoFzjLdsZbErJcS3HtAhlkbE/BKTMrdYg35Uo12SLBO5tbk8h2imbKTC8i Ms+pskrvI/AVlh6QoTTXk6xboVX6zgMgzxSVVLymQiygYYm0y5aMsvi2raFhC643SOGvErWWPPnS EfbeAD1xswIDAQABo4IBZDCCAWAwDgYDVR0PAQH/BAQDAgEGMB0GA1UdJQQWMBQGCCsGAQUFBwMC BggrBgEFBQcDBDASBgNVHRMBAf8ECDAGAQH/AgEAMDIGA1UdHwQrMCkwJ6AloCOGIWh0dHA6Ly9j cmwuc3RhcnRzc2wuY29tL3Nmc2NhLmNybDBmBggrBgEFBQcBAQRaMFgwJAYIKwYBBQUHMAGGGGh0 dHA6Ly9vY3NwLnN0YXJ0c3NsLmNvbTAwBggrBgEFBQcwAoYkaHR0cDovL2FpYS5zdGFydHNzbC5j b20vY2VydHMvY2EuY3J0MB0GA1UdDgQWBBQkgWw5Yb5JD4+3G0YrySi1J0htaDAfBgNVHSMEGDAW gBROC+8apEBbpRdphzDKNGhD0EGu8jA/BgNVHSAEODA2MDQGBFUdIAAwLDAqBggrBgEFBQcCARYe aHR0cDovL3d3dy5zdGFydHNzbC5jb20vcG9saWN5MA0GCSqGSIb3DQEBCwUAA4ICAQCL4/eH7AGL hK0PAQJbnOEjJyMEvTTwcAJuUh/bodjQl06u4putYOxdSyIjSP/sKt+31LmjG8+IO1WqykE4H/Lm 7NKezWVnCHuwb3ptgFmlwbMbGkU2MOZBtwzfKXdYUhFLhaE2uw5jXhXvLYitQay962wP5uPI6eAI hV4L8aaya1u4s7MnrTq0Rz25FuGNO79vTHYWj797tSRC8rM16js4yGKOLFpQvIg0F8IElv57b1st p+C7omqM5Qn15dePbSnqr8Jb65WtmJJbnv6rlqfY/aLuE/zmNAlzLmPgfMDStKIXdg+EoYBZTEo8 wBUaBxihfNbJ069ndQOxMNNqBelEMgpAtmjTbCuXFjqIwWq+XOx6ZV/Wh2FAmaLsSHlNvEjjSQMZ wE4EeHCdo66ZmEs/5JYlCeOkulKVQ6P3m5/XOj2jP17Q2AgmjP+11+sHN7PvrG0OwrQp9QMe3X+r n0G8MjtFfqBWvR9CgLIxzM3MJNxFdgdjS2rYnShP5uxvqwfZvhZVYCIkqdJhpYON0DvSodfiar0w iM79mySZJjzC0CTbiisBzS/BeBhqeo2wFfli/iw3hn1XKvAx0ty6w/scmBF0AYqmRHYj1TjMSw0l Al7AztLglqWjUPI+sukvadMRPxmtKXlS2nVR4an/Z16imsZ69+fFYH68c1CK7zmjozGCA04wggNK AgEBMIGJMHUxCzAJBgNVBAYTAklMMRYwFAYDVQQKEw1TdGFydENvbSBMdGQuMSkwJwYDVQQLEyBT dGFydENvbSBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTEjMCEGA1UEAxMaU3RhcnRDb20gQ2xhc3Mg MSBDbGllbnQgQ0ECECJrrb9nBol9MHok/UZg/AYwCQYFKw4DAhoFAKCCAZkwGAYJKoZIhvcNAQkD MQsGCSqGSIb3DQEHATAcBgkqhkiG9w0BCQUxDxcNMTYxMjIzMTAyMzA5WjAjBgkqhkiG9w0BCQQx FgQUN107XEeaddBJDh4Dz5kE/X6dwMIwgZoGCSsGAQQBgjcQBDGBjDCBiTB1MQswCQYDVQQGEwJJ TDEWMBQGA1UEChMNU3RhcnRDb20gTHRkLjEpMCcGA1UECxMgU3RhcnRDb20gQ2VydGlmaWNhdGlv biBBdXRob3JpdHkxIzAhBgNVBAMTGlN0YXJ0Q29tIENsYXNzIDEgQ2xpZW50IENBAhAia62/ZwaJ fTB6JP1GYPwGMIGcBgsqhkiG9w0BCRACCzGBjKCBiTB1MQswCQYDVQQGEwJJTDEWMBQGA1UEChMN U3RhcnRDb20gTHRkLjEpMCcGA1UECxMgU3RhcnRDb20gQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkx IzAhBgNVBAMTGlN0YXJ0Q29tIENsYXNzIDEgQ2xpZW50IENBAhAia62/ZwaJfTB6JP1GYPwGMA0G CSqGSIb3DQEBAQUABIIBALG2tLUcxTayMYoOCnxzaUgBbOAiaUKKy2EUwrKgasD4Irvd0jW1WnGs HW7Sztlijtsku+ZBT6NbObpVEAZIPNVyqIEoQkO0MPhOpSOaxt4UH6boUOBYtZ4VANALSxjc0Wn/ f3KhuLepicwiK6OwXi+HqThB6hFgJsWYHVMKd3ZjnOKnCBm01tN5KSbk25VavC5WqVOV8vbczpUl N+R1bEGK4Bx601m71nFPfHAv+oGQ6nLFJuu1LFtaOgC+43LYJ+0zqslbFIhjqIJ31vBR0p03jxgC 7cDiBjmaFRBMJQSA4EpGBMGcY681Ag3kxeLce/xwA9c2Hfpmx6PnQZE8gxgAAAAAAAA= --Apple-Mail=_FE5AB27D-9CFA-4009-A999-3BEFFE9DA562-- From owner-svn-src-all@freebsd.org Fri Dec 23 14:54:41 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6A2CCC8E63C; Fri, 23 Dec 2016 14:54:41 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 190341CD6; Fri, 23 Dec 2016 14:54:41 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBNEseBE085810; Fri, 23 Dec 2016 14:54:40 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBNEseZe085809; Fri, 23 Dec 2016 14:54:40 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201612231454.uBNEseZe085809@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Fri, 23 Dec 2016 14:54:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310478 - head/sys/cam/ctl X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Dec 2016 14:54:41 -0000 Author: mav Date: Fri Dec 23 14:54:40 2016 New Revision: 310478 URL: https://svnweb.freebsd.org/changeset/base/310478 Log: Add place-holders for TAPE STREAM MIRRORING subcommands of XCOPY. We do not support tapes, so this is only a comments. MFC after: 2 weeks Modified: head/sys/cam/ctl/ctl_cmd_table.c Modified: head/sys/cam/ctl/ctl_cmd_table.c ============================================================================== --- head/sys/cam/ctl/ctl_cmd_table.c Fri Dec 23 14:44:40 2016 (r310477) +++ head/sys/cam/ctl/ctl_cmd_table.c Fri Dec 23 14:54:40 2016 (r310478) @@ -482,7 +482,7 @@ const struct ctl_cmd_entry ctl_cmd_table /* 15 */ {NULL, CTL_SERIDX_INVLD, CTL_CMD_FLAG_NONE, CTL_LUN_PAT_NONE}, -/* 16 */ +/* 16 SET TAPE STREAM MIRRORING */ {NULL, CTL_SERIDX_INVLD, CTL_CMD_FLAG_NONE, CTL_LUN_PAT_NONE}, /* 17 */ @@ -506,6 +506,11 @@ const struct ctl_cmd_entry ctl_cmd_table CTL_FLAG_DATA_NONE, CTL_LUN_PAT_NONE, 16, { 0x1c, 0xff, 0xff, 0xff, 0xff, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x07}}, + +/* 1D COPY OPERATION CLOSE */ +{NULL, CTL_SERIDX_INVLD, CTL_CMD_FLAG_NONE, CTL_LUN_PAT_NONE}, + +/* 1e-1f */ }; /* 84 RECEIVE COPY STATUS */ @@ -574,6 +579,50 @@ const struct ctl_cmd_entry ctl_cmd_table CTL_CMD_FLAG_ALLOW_ON_PR_RESV, CTL_LUN_PAT_NONE, 16, {0x08, 0, 0, 0, 0, 0, 0, 0, 0, 0xff, 0xff, 0xff, 0xff, 0, 0x07}}, + +/* 09 */ +{NULL, CTL_SERIDX_INVLD, CTL_CMD_FLAG_NONE, CTL_LUN_PAT_NONE}, + +/* 0A */ +{NULL, CTL_SERIDX_INVLD, CTL_CMD_FLAG_NONE, CTL_LUN_PAT_NONE}, + +/* 0B */ +{NULL, CTL_SERIDX_INVLD, CTL_CMD_FLAG_NONE, CTL_LUN_PAT_NONE}, + +/* 0C */ +{NULL, CTL_SERIDX_INVLD, CTL_CMD_FLAG_NONE, CTL_LUN_PAT_NONE}, + +/* 0D */ +{NULL, CTL_SERIDX_INVLD, CTL_CMD_FLAG_NONE, CTL_LUN_PAT_NONE}, + +/* 0E */ +{NULL, CTL_SERIDX_INVLD, CTL_CMD_FLAG_NONE, CTL_LUN_PAT_NONE}, + +/* 0F */ +{NULL, CTL_SERIDX_INVLD, CTL_CMD_FLAG_NONE, CTL_LUN_PAT_NONE}, + +/* 10 */ +{NULL, CTL_SERIDX_INVLD, CTL_CMD_FLAG_NONE, CTL_LUN_PAT_NONE}, + +/* 11 */ +{NULL, CTL_SERIDX_INVLD, CTL_CMD_FLAG_NONE, CTL_LUN_PAT_NONE}, + +/* 12 */ +{NULL, CTL_SERIDX_INVLD, CTL_CMD_FLAG_NONE, CTL_LUN_PAT_NONE}, + +/* 13 */ +{NULL, CTL_SERIDX_INVLD, CTL_CMD_FLAG_NONE, CTL_LUN_PAT_NONE}, + +/* 14 */ +{NULL, CTL_SERIDX_INVLD, CTL_CMD_FLAG_NONE, CTL_LUN_PAT_NONE}, + +/* 15 */ +{NULL, CTL_SERIDX_INVLD, CTL_CMD_FLAG_NONE, CTL_LUN_PAT_NONE}, + +/* 16 REPORT TAPE STREAM MIRRORING */ +{NULL, CTL_SERIDX_INVLD, CTL_CMD_FLAG_NONE, CTL_LUN_PAT_NONE}, + +/* 17-1f */ }; /* 9B READ BUFFER(16) */ From owner-svn-src-all@freebsd.org Fri Dec 23 15:02:42 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2B91BC8E7D0; Fri, 23 Dec 2016 15:02:42 +0000 (UTC) (envelope-from des@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D4169189; Fri, 23 Dec 2016 15:02:41 +0000 (UTC) (envelope-from des@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBNF2fTu090164; Fri, 23 Dec 2016 15:02:41 GMT (envelope-from des@FreeBSD.org) Received: (from des@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBNF2ep4090162; Fri, 23 Dec 2016 15:02:40 GMT (envelope-from des@FreeBSD.org) Message-Id: <201612231502.uBNF2ep4090162@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: des set sender to des@FreeBSD.org using -f From: =?UTF-8?Q?Dag-Erling_Sm=c3=b8rgrav?= Date: Fri, 23 Dec 2016 15:02:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r310479 - stable/11/lib/libutil X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Dec 2016 15:02:42 -0000 Author: des Date: Fri Dec 23 15:02:40 2016 New Revision: 310479 URL: https://svnweb.freebsd.org/changeset/base/310479 Log: MFH (r309269): use malloc()ed buffers instead of stack buffers Modified: stable/11/lib/libutil/gr_util.c stable/11/lib/libutil/pw_util.c Directory Properties: stable/11/ (props changed) Modified: stable/11/lib/libutil/gr_util.c ============================================================================== --- stable/11/lib/libutil/gr_util.c Fri Dec 23 14:54:40 2016 (r310478) +++ stable/11/lib/libutil/gr_util.c Fri Dec 23 15:02:40 2016 (r310479) @@ -164,11 +164,12 @@ gr_tmp(int mfd) int gr_copy(int ffd, int tfd, const struct group *gr, struct group *old_gr) { - char buf[8192], *end, *line, *p, *q, *r, t; + char *buf, *end, *line, *p, *q, *r, *tmp; struct group *fgr; const struct group *sgr; - size_t len; + size_t len, size; int eof, readlen; + char t; if (old_gr == NULL && gr == NULL) return(-1); @@ -186,6 +187,10 @@ gr_copy(int ffd, int tfd, const struct g if (sgr == NULL) sgr = gr; + /* initialize the buffer */ + if ((buf = malloc(size = 1024)) == NULL) + goto err; + eof = 0; len = 0; p = q = end = buf; @@ -199,10 +204,16 @@ gr_copy(int ffd, int tfd, const struct g if (q >= end) { if (eof) break; - if ((size_t)(q - p) >= sizeof(buf)) { - warnx("group line too long"); - errno = EINVAL; /* hack */ - goto err; + while ((size_t)(q - p) >= size) { + if ((tmp = realloc(buf, size * 2)) == NULL) { + warnx("group line too long"); + goto err; + } + p = tmp + (p - buf); + q = tmp + (q - buf); + end = tmp + (end - buf); + buf = tmp; + size = size * 2; } if (p < end) { q = memmove(buf, p, end -p); @@ -210,7 +221,7 @@ gr_copy(int ffd, int tfd, const struct g } else { p = q = end = buf; } - readlen = read(ffd, end, sizeof(buf) - (end -buf)); + readlen = read(ffd, end, size - (end - buf)); if (readlen == -1) goto err; else @@ -219,7 +230,7 @@ gr_copy(int ffd, int tfd, const struct g break; end += len; len = end - buf; - if (len < (ssize_t)sizeof(buf)) { + if (len < size) { eof = 1; if (len > 0 && buf[len -1] != '\n') ++len, *end++ = '\n'; @@ -281,7 +292,7 @@ gr_copy(int ffd, int tfd, const struct g if (write(tfd, q, end - q) != end - q) goto err; q = buf; - readlen = read(ffd, buf, sizeof(buf)); + readlen = read(ffd, buf, size); if (readlen == 0) break; else @@ -303,12 +314,12 @@ gr_copy(int ffd, int tfd, const struct g write(tfd, "\n", 1) != 1) goto err; done: - if (line != NULL) - free(line); + free(line); + free(buf); return (0); err: - if (line != NULL) - free(line); + free(line); + free(buf); return (-1); } Modified: stable/11/lib/libutil/pw_util.c ============================================================================== --- stable/11/lib/libutil/pw_util.c Fri Dec 23 14:54:40 2016 (r310478) +++ stable/11/lib/libutil/pw_util.c Fri Dec 23 15:02:40 2016 (r310479) @@ -427,11 +427,12 @@ pw_make_v7(const struct passwd *pw) int pw_copy(int ffd, int tfd, const struct passwd *pw, struct passwd *old_pw) { - char buf[8192], *end, *line, *p, *q, *r, t; + char *buf, *end, *line, *p, *q, *r, *tmp; struct passwd *fpw; const struct passwd *spw; - size_t len; + size_t len, size; int eof, readlen; + char t; if (old_pw == NULL && pw == NULL) return (-1); @@ -449,6 +450,10 @@ pw_copy(int ffd, int tfd, const struct p if (spw == NULL) spw = pw; + /* initialize the buffer */ + if ((buf = malloc(size = 1024)) == NULL) + goto err; + eof = 0; len = 0; p = q = end = buf; @@ -462,10 +467,16 @@ pw_copy(int ffd, int tfd, const struct p if (q >= end) { if (eof) break; - if ((size_t)(q - p) >= sizeof(buf)) { - warnx("passwd line too long"); - errno = EINVAL; /* hack */ - goto err; + while ((size_t)(q - p) >= size) { + if ((tmp = realloc(buf, size * 2)) == NULL) { + warnx("passwd line too long"); + goto err; + } + p = tmp + (p - buf); + q = tmp + (q - buf); + end = tmp + (end - buf); + buf = tmp; + size = size * 2; } if (p < end) { q = memmove(buf, p, end - p); @@ -473,7 +484,7 @@ pw_copy(int ffd, int tfd, const struct p } else { p = q = end = buf; } - readlen = read(ffd, end, sizeof(buf) - (end - buf)); + readlen = read(ffd, end, size - (end - buf)); if (readlen == -1) goto err; else @@ -482,7 +493,7 @@ pw_copy(int ffd, int tfd, const struct p break; end += len; len = end - buf; - if (len < (ssize_t)sizeof(buf)) { + if (len < size) { eof = 1; if (len > 0 && buf[len - 1] != '\n') ++len, *end++ = '\n'; @@ -545,7 +556,7 @@ pw_copy(int ffd, int tfd, const struct p if (write(tfd, q, end - q) != end - q) goto err; q = buf; - readlen = read(ffd, buf, sizeof(buf)); + readlen = read(ffd, buf, size); if (readlen == 0) break; else @@ -567,12 +578,12 @@ pw_copy(int ffd, int tfd, const struct p write(tfd, "\n", 1) != 1) goto err; done: - if (line != NULL) - free(line); + free(line); + free(buf); return (0); err: - if (line != NULL) - free(line); + free(line); + free(buf); return (-1); } From owner-svn-src-all@freebsd.org Fri Dec 23 15:05:42 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E069DC8E853; Fri, 23 Dec 2016 15:05:42 +0000 (UTC) (envelope-from des@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A1419362; Fri, 23 Dec 2016 15:05:42 +0000 (UTC) (envelope-from des@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBNF5fi8090307; Fri, 23 Dec 2016 15:05:41 GMT (envelope-from des@FreeBSD.org) Received: (from des@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBNF5fer090305; Fri, 23 Dec 2016 15:05:41 GMT (envelope-from des@FreeBSD.org) Message-Id: <201612231505.uBNF5fer090305@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: des set sender to des@FreeBSD.org using -f From: =?UTF-8?Q?Dag-Erling_Sm=c3=b8rgrav?= Date: Fri, 23 Dec 2016 15:05:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r310480 - stable/10/lib/libutil X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Dec 2016 15:05:43 -0000 Author: des Date: Fri Dec 23 15:05:41 2016 New Revision: 310480 URL: https://svnweb.freebsd.org/changeset/base/310480 Log: MFH (r309269): use malloc()ed buffers instead of stack buffers Modified: stable/10/lib/libutil/gr_util.c stable/10/lib/libutil/pw_util.c Directory Properties: stable/10/ (props changed) Modified: stable/10/lib/libutil/gr_util.c ============================================================================== --- stable/10/lib/libutil/gr_util.c Fri Dec 23 15:02:40 2016 (r310479) +++ stable/10/lib/libutil/gr_util.c Fri Dec 23 15:05:41 2016 (r310480) @@ -164,11 +164,12 @@ gr_tmp(int mfd) int gr_copy(int ffd, int tfd, const struct group *gr, struct group *old_gr) { - char buf[8192], *end, *line, *p, *q, *r, t; + char *buf, *end, *line, *p, *q, *r, *tmp; struct group *fgr; const struct group *sgr; - size_t len; + size_t len, size; int eof, readlen; + char t; if (old_gr == NULL && gr == NULL) return(-1); @@ -186,6 +187,10 @@ gr_copy(int ffd, int tfd, const struct g if (sgr == NULL) sgr = gr; + /* initialize the buffer */ + if ((buf = malloc(size = 1024)) == NULL) + goto err; + eof = 0; len = 0; p = q = end = buf; @@ -199,10 +204,16 @@ gr_copy(int ffd, int tfd, const struct g if (q >= end) { if (eof) break; - if ((size_t)(q - p) >= sizeof(buf)) { - warnx("group line too long"); - errno = EINVAL; /* hack */ - goto err; + while ((size_t)(q - p) >= size) { + if ((tmp = realloc(buf, size * 2)) == NULL) { + warnx("group line too long"); + goto err; + } + p = tmp + (p - buf); + q = tmp + (q - buf); + end = tmp + (end - buf); + buf = tmp; + size = size * 2; } if (p < end) { q = memmove(buf, p, end -p); @@ -210,7 +221,7 @@ gr_copy(int ffd, int tfd, const struct g } else { p = q = end = buf; } - readlen = read(ffd, end, sizeof(buf) - (end -buf)); + readlen = read(ffd, end, size - (end - buf)); if (readlen == -1) goto err; else @@ -219,7 +230,7 @@ gr_copy(int ffd, int tfd, const struct g break; end += len; len = end - buf; - if (len < (ssize_t)sizeof(buf)) { + if (len < size) { eof = 1; if (len > 0 && buf[len -1] != '\n') ++len, *end++ = '\n'; @@ -281,7 +292,7 @@ gr_copy(int ffd, int tfd, const struct g if (write(tfd, q, end - q) != end - q) goto err; q = buf; - readlen = read(ffd, buf, sizeof(buf)); + readlen = read(ffd, buf, size); if (readlen == 0) break; else @@ -303,12 +314,12 @@ gr_copy(int ffd, int tfd, const struct g write(tfd, "\n", 1) != 1) goto err; done: - if (line != NULL) - free(line); + free(line); + free(buf); return (0); err: - if (line != NULL) - free(line); + free(line); + free(buf); return (-1); } Modified: stable/10/lib/libutil/pw_util.c ============================================================================== --- stable/10/lib/libutil/pw_util.c Fri Dec 23 15:02:40 2016 (r310479) +++ stable/10/lib/libutil/pw_util.c Fri Dec 23 15:05:41 2016 (r310480) @@ -428,11 +428,12 @@ pw_make_v7(const struct passwd *pw) int pw_copy(int ffd, int tfd, const struct passwd *pw, struct passwd *old_pw) { - char buf[8192], *end, *line, *p, *q, *r, t; + char *buf, *end, *line, *p, *q, *r, *tmp; struct passwd *fpw; const struct passwd *spw; - size_t len; + size_t len, size; int eof, readlen; + char t; if (old_pw == NULL && pw == NULL) return (-1); @@ -450,6 +451,10 @@ pw_copy(int ffd, int tfd, const struct p if (spw == NULL) spw = pw; + /* initialize the buffer */ + if ((buf = malloc(size = 1024)) == NULL) + goto err; + eof = 0; len = 0; p = q = end = buf; @@ -463,10 +468,16 @@ pw_copy(int ffd, int tfd, const struct p if (q >= end) { if (eof) break; - if ((size_t)(q - p) >= sizeof(buf)) { - warnx("passwd line too long"); - errno = EINVAL; /* hack */ - goto err; + while ((size_t)(q - p) >= size) { + if ((tmp = realloc(buf, size * 2)) == NULL) { + warnx("passwd line too long"); + goto err; + } + p = tmp + (p - buf); + q = tmp + (q - buf); + end = tmp + (end - buf); + buf = tmp; + size = size * 2; } if (p < end) { q = memmove(buf, p, end - p); @@ -474,7 +485,7 @@ pw_copy(int ffd, int tfd, const struct p } else { p = q = end = buf; } - readlen = read(ffd, end, sizeof(buf) - (end - buf)); + readlen = read(ffd, end, size - (end - buf)); if (readlen == -1) goto err; else @@ -483,7 +494,7 @@ pw_copy(int ffd, int tfd, const struct p break; end += len; len = end - buf; - if (len < (ssize_t)sizeof(buf)) { + if (len < size) { eof = 1; if (len > 0 && buf[len - 1] != '\n') ++len, *end++ = '\n'; @@ -546,7 +557,7 @@ pw_copy(int ffd, int tfd, const struct p if (write(tfd, q, end - q) != end - q) goto err; q = buf; - readlen = read(ffd, buf, sizeof(buf)); + readlen = read(ffd, buf, size); if (readlen == 0) break; else @@ -568,12 +579,12 @@ pw_copy(int ffd, int tfd, const struct p write(tfd, "\n", 1) != 1) goto err; done: - if (line != NULL) - free(line); + free(line); + free(buf); return (0); err: - if (line != NULL) - free(line); + free(line); + free(buf); return (-1); } From owner-svn-src-all@freebsd.org Fri Dec 23 15:14:57 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E81C5C8EABE; Fri, 23 Dec 2016 15:14:57 +0000 (UTC) (envelope-from jah@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A24A4B5C; Fri, 23 Dec 2016 15:14:57 +0000 (UTC) (envelope-from jah@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBNFEuGi094302; Fri, 23 Dec 2016 15:14:56 GMT (envelope-from jah@FreeBSD.org) Received: (from jah@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBNFEuSh094299; Fri, 23 Dec 2016 15:14:56 GMT (envelope-from jah@FreeBSD.org) Message-Id: <201612231514.uBNFEuSh094299@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jah set sender to jah@FreeBSD.org using -f From: "Jason A. Harmening" Date: Fri, 23 Dec 2016 15:14:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310481 - in head/sys/i386: i386 include X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Dec 2016 15:14:58 -0000 Author: jah Date: Fri Dec 23 15:14:56 2016 New Revision: 310481 URL: https://svnweb.freebsd.org/changeset/base/310481 Log: Move the objects used to create temporary mappings for i386 pmap zero and copy operations to the MD PCPU region. Change sysmap initialization to only allocate KVA pages for CPUs that are actually present. As a minor optimization, this also prevents false sharing between adjacent sysmap objects since the pcpu struct is already cacheline-aligned. While here, move pc_qmap_addr initialization for the BSP into pmap_bootstrap(), which allows use of pmap_quick* functions during early boot. Reviewed by: kib MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D8833 Modified: head/sys/i386/i386/pmap.c head/sys/i386/include/pcpu.h Modified: head/sys/i386/i386/pmap.c ============================================================================== --- head/sys/i386/i386/pmap.c Fri Dec 23 15:05:41 2016 (r310480) +++ head/sys/i386/i386/pmap.c Fri Dec 23 15:14:56 2016 (r310481) @@ -257,14 +257,6 @@ vm_offset_t pv_vafree; /* freelist sto /* * All those kernel PT submaps that BSD is so fond of */ -struct sysmaps { - struct mtx lock; - pt_entry_t *CMAP1; - pt_entry_t *CMAP2; - caddr_t CADDR1; - caddr_t CADDR2; -}; -static struct sysmaps sysmaps_pcpu[MAXCPU]; pt_entry_t *CMAP3; static pd_entry_t *KPTD; caddr_t ptvmmap = 0; @@ -379,7 +371,7 @@ pmap_bootstrap(vm_paddr_t firstaddr) { vm_offset_t va; pt_entry_t *pte, *unused; - struct sysmaps *sysmaps; + struct pcpu *pc; int i; /* @@ -441,16 +433,19 @@ pmap_bootstrap(vm_paddr_t firstaddr) va = virtual_avail; pte = vtopte(va); + /* + * Initialize temporary map objects on the current CPU for use + * during early boot. * CMAP1/CMAP2 are used for zeroing and copying pages. * CMAP3 is used for the boot-time memory test. */ - for (i = 0; i < MAXCPU; i++) { - sysmaps = &sysmaps_pcpu[i]; - mtx_init(&sysmaps->lock, "SYSMAPS", NULL, MTX_DEF); - SYSMAP(caddr_t, sysmaps->CMAP1, sysmaps->CADDR1, 1) - SYSMAP(caddr_t, sysmaps->CMAP2, sysmaps->CADDR2, 1) - } + pc = pcpu_find(curcpu); + mtx_init(&pc->pc_cmap_lock, "SYSMAPS", NULL, MTX_DEF); + SYSMAP(caddr_t, pc->pc_cmap_pte1, pc->pc_cmap_addr1, 1) + SYSMAP(caddr_t, pc->pc_cmap_pte2, pc->pc_cmap_addr2, 1) + SYSMAP(vm_offset_t, pte, pc->pc_qmap_addr, 1) + SYSMAP(caddr_t, CMAP3, CADDR3, 1); /* @@ -520,20 +515,33 @@ pmap_bootstrap(vm_paddr_t firstaddr) } static void -pmap_init_qpages(void) +pmap_init_reserved_pages(void) { struct pcpu *pc; + vm_offset_t pages; int i; CPU_FOREACH(i) { pc = pcpu_find(i); - pc->pc_qmap_addr = kva_alloc(PAGE_SIZE); - if (pc->pc_qmap_addr == 0) - panic("pmap_init_qpages: unable to allocate KVA"); + /* + * Skip if the mapping has already been initialized, + * i.e. this is the BSP. + */ + if (pc->pc_cmap_addr1 != 0) + continue; + mtx_init(&pc->pc_cmap_lock, "SYSMAPS", NULL, MTX_DEF); + pages = kva_alloc(PAGE_SIZE * 3); + if (pages == 0) + panic("%s: unable to allocate KVA", __func__); + pc->pc_cmap_pte1 = vtopte(pages); + pc->pc_cmap_pte2 = vtopte(pages + PAGE_SIZE); + pc->pc_cmap_addr1 = (caddr_t)pages; + pc->pc_cmap_addr2 = (caddr_t)(pages + PAGE_SIZE); + pc->pc_qmap_addr = pages + (PAGE_SIZE * 2); } } - -SYSINIT(qpages_init, SI_SUB_CPU, SI_ORDER_ANY, pmap_init_qpages, NULL); + +SYSINIT(rpages_init, SI_SUB_CPU, SI_ORDER_ANY, pmap_init_reserved_pages, NULL); /* * Setup the PAT MSR. @@ -4194,20 +4202,22 @@ pagezero(void *page) void pmap_zero_page(vm_page_t m) { - struct sysmaps *sysmaps; + pt_entry_t *cmap_pte2; + struct pcpu *pc; - sysmaps = &sysmaps_pcpu[PCPU_GET(cpuid)]; - mtx_lock(&sysmaps->lock); - if (*sysmaps->CMAP2) - panic("pmap_zero_page: CMAP2 busy"); sched_pin(); - *sysmaps->CMAP2 = PG_V | PG_RW | VM_PAGE_TO_PHYS(m) | PG_A | PG_M | + pc = pcpu_find(curcpu); + cmap_pte2 = pc->pc_cmap_pte2; + mtx_lock(&pc->pc_cmap_lock); + if (*cmap_pte2) + panic("pmap_zero_page: CMAP2 busy"); + *cmap_pte2 = PG_V | PG_RW | VM_PAGE_TO_PHYS(m) | PG_A | PG_M | pmap_cache_bits(m->md.pat_mode, 0); - invlcaddr(sysmaps->CADDR2); - pagezero(sysmaps->CADDR2); - *sysmaps->CMAP2 = 0; + invlcaddr(pc->pc_cmap_addr2); + pagezero(pc->pc_cmap_addr2); + *cmap_pte2 = 0; + mtx_unlock(&pc->pc_cmap_lock); sched_unpin(); - mtx_unlock(&sysmaps->lock); } /* @@ -4217,23 +4227,25 @@ pmap_zero_page(vm_page_t m) void pmap_zero_page_area(vm_page_t m, int off, int size) { - struct sysmaps *sysmaps; + pt_entry_t *cmap_pte2; + struct pcpu *pc; - sysmaps = &sysmaps_pcpu[PCPU_GET(cpuid)]; - mtx_lock(&sysmaps->lock); - if (*sysmaps->CMAP2) - panic("pmap_zero_page_area: CMAP2 busy"); sched_pin(); - *sysmaps->CMAP2 = PG_V | PG_RW | VM_PAGE_TO_PHYS(m) | PG_A | PG_M | + pc = pcpu_find(curcpu); + cmap_pte2 = pc->pc_cmap_pte2; + mtx_lock(&pc->pc_cmap_lock); + if (*cmap_pte2) + panic("pmap_zero_page_area: CMAP2 busy"); + *cmap_pte2 = PG_V | PG_RW | VM_PAGE_TO_PHYS(m) | PG_A | PG_M | pmap_cache_bits(m->md.pat_mode, 0); - invlcaddr(sysmaps->CADDR2); + invlcaddr(pc->pc_cmap_addr2); if (off == 0 && size == PAGE_SIZE) - pagezero(sysmaps->CADDR2); + pagezero(pc->pc_cmap_addr2); else - bzero((char *)sysmaps->CADDR2 + off, size); - *sysmaps->CMAP2 = 0; + bzero(pc->pc_cmap_addr2 + off, size); + *cmap_pte2 = 0; + mtx_unlock(&pc->pc_cmap_lock); sched_unpin(); - mtx_unlock(&sysmaps->lock); } /* @@ -4242,26 +4254,29 @@ pmap_zero_page_area(vm_page_t m, int off void pmap_copy_page(vm_page_t src, vm_page_t dst) { - struct sysmaps *sysmaps; + pt_entry_t *cmap_pte1, *cmap_pte2; + struct pcpu *pc; - sysmaps = &sysmaps_pcpu[PCPU_GET(cpuid)]; - mtx_lock(&sysmaps->lock); - if (*sysmaps->CMAP1) + sched_pin(); + pc = pcpu_find(curcpu); + cmap_pte1 = pc->pc_cmap_pte1; + cmap_pte2 = pc->pc_cmap_pte2; + mtx_lock(&pc->pc_cmap_lock); + if (*cmap_pte1) panic("pmap_copy_page: CMAP1 busy"); - if (*sysmaps->CMAP2) + if (*cmap_pte2) panic("pmap_copy_page: CMAP2 busy"); - sched_pin(); - *sysmaps->CMAP1 = PG_V | VM_PAGE_TO_PHYS(src) | PG_A | + *cmap_pte1 = PG_V | VM_PAGE_TO_PHYS(src) | PG_A | pmap_cache_bits(src->md.pat_mode, 0); - invlcaddr(sysmaps->CADDR1); - *sysmaps->CMAP2 = PG_V | PG_RW | VM_PAGE_TO_PHYS(dst) | PG_A | PG_M | + invlcaddr(pc->pc_cmap_addr1); + *cmap_pte2 = PG_V | PG_RW | VM_PAGE_TO_PHYS(dst) | PG_A | PG_M | pmap_cache_bits(dst->md.pat_mode, 0); - invlcaddr(sysmaps->CADDR2); - bcopy(sysmaps->CADDR1, sysmaps->CADDR2, PAGE_SIZE); - *sysmaps->CMAP1 = 0; - *sysmaps->CMAP2 = 0; + invlcaddr(pc->pc_cmap_addr2); + bcopy(pc->pc_cmap_addr1, pc->pc_cmap_addr2, PAGE_SIZE); + *cmap_pte1 = 0; + *cmap_pte2 = 0; + mtx_unlock(&pc->pc_cmap_lock); sched_unpin(); - mtx_unlock(&sysmaps->lock); } int unmapped_buf_allowed = 1; @@ -4270,19 +4285,22 @@ void pmap_copy_pages(vm_page_t ma[], vm_offset_t a_offset, vm_page_t mb[], vm_offset_t b_offset, int xfersize) { - struct sysmaps *sysmaps; vm_page_t a_pg, b_pg; char *a_cp, *b_cp; vm_offset_t a_pg_offset, b_pg_offset; + pt_entry_t *cmap_pte1, *cmap_pte2; + struct pcpu *pc; int cnt; - sysmaps = &sysmaps_pcpu[PCPU_GET(cpuid)]; - mtx_lock(&sysmaps->lock); - if (*sysmaps->CMAP1 != 0) + sched_pin(); + pc = pcpu_find(curcpu); + cmap_pte1 = pc->pc_cmap_pte1; + cmap_pte2 = pc->pc_cmap_pte2; + mtx_lock(&pc->pc_cmap_lock); + if (*cmap_pte1 != 0) panic("pmap_copy_pages: CMAP1 busy"); - if (*sysmaps->CMAP2 != 0) + if (*cmap_pte2 != 0) panic("pmap_copy_pages: CMAP2 busy"); - sched_pin(); while (xfersize > 0) { a_pg = ma[a_offset >> PAGE_SHIFT]; a_pg_offset = a_offset & PAGE_MASK; @@ -4290,23 +4308,23 @@ pmap_copy_pages(vm_page_t ma[], vm_offse b_pg = mb[b_offset >> PAGE_SHIFT]; b_pg_offset = b_offset & PAGE_MASK; cnt = min(cnt, PAGE_SIZE - b_pg_offset); - *sysmaps->CMAP1 = PG_V | VM_PAGE_TO_PHYS(a_pg) | PG_A | + *cmap_pte1 = PG_V | VM_PAGE_TO_PHYS(a_pg) | PG_A | pmap_cache_bits(a_pg->md.pat_mode, 0); - invlcaddr(sysmaps->CADDR1); - *sysmaps->CMAP2 = PG_V | PG_RW | VM_PAGE_TO_PHYS(b_pg) | PG_A | + invlcaddr(pc->pc_cmap_addr1); + *cmap_pte2 = PG_V | PG_RW | VM_PAGE_TO_PHYS(b_pg) | PG_A | PG_M | pmap_cache_bits(b_pg->md.pat_mode, 0); - invlcaddr(sysmaps->CADDR2); - a_cp = sysmaps->CADDR1 + a_pg_offset; - b_cp = sysmaps->CADDR2 + b_pg_offset; + invlcaddr(pc->pc_cmap_addr2); + a_cp = pc->pc_cmap_addr1 + a_pg_offset; + b_cp = pc->pc_cmap_addr2 + b_pg_offset; bcopy(a_cp, b_cp, cnt); a_offset += cnt; b_offset += cnt; xfersize -= cnt; } - *sysmaps->CMAP1 = 0; - *sysmaps->CMAP2 = 0; + *cmap_pte1 = 0; + *cmap_pte2 = 0; + mtx_unlock(&pc->pc_cmap_lock); sched_unpin(); - mtx_unlock(&sysmaps->lock); } /* @@ -5247,21 +5265,23 @@ pmap_page_set_memattr(vm_page_t m, vm_me static void pmap_flush_page(vm_page_t m) { - struct sysmaps *sysmaps; + pt_entry_t *cmap_pte2; + struct pcpu *pc; vm_offset_t sva, eva; bool useclflushopt; useclflushopt = (cpu_stdext_feature & CPUID_STDEXT_CLFLUSHOPT) != 0; if (useclflushopt || (cpu_feature & CPUID_CLFSH) != 0) { - sysmaps = &sysmaps_pcpu[PCPU_GET(cpuid)]; - mtx_lock(&sysmaps->lock); - if (*sysmaps->CMAP2) - panic("pmap_flush_page: CMAP2 busy"); sched_pin(); - *sysmaps->CMAP2 = PG_V | PG_RW | VM_PAGE_TO_PHYS(m) | + pc = pcpu_find(curcpu); + cmap_pte2 = pc->pc_cmap_pte2; + mtx_lock(&pc->pc_cmap_lock); + if (*cmap_pte2) + panic("pmap_flush_page: CMAP2 busy"); + *cmap_pte2 = PG_V | PG_RW | VM_PAGE_TO_PHYS(m) | PG_A | PG_M | pmap_cache_bits(m->md.pat_mode, 0); - invlcaddr(sysmaps->CADDR2); - sva = (vm_offset_t)sysmaps->CADDR2; + invlcaddr(pc->pc_cmap_addr2); + sva = (vm_offset_t)pc->pc_cmap_addr2; eva = sva + PAGE_SIZE; /* @@ -5280,9 +5300,9 @@ pmap_flush_page(vm_page_t m) } if (useclflushopt || cpu_vendor_id != CPU_VENDOR_INTEL) mfence(); - *sysmaps->CMAP2 = 0; + *cmap_pte2 = 0; + mtx_unlock(&pc->pc_cmap_lock); sched_unpin(); - mtx_unlock(&sysmaps->lock); } else pmap_invalidate_cache(); } Modified: head/sys/i386/include/pcpu.h ============================================================================== --- head/sys/i386/include/pcpu.h Fri Dec 23 15:05:41 2016 (r310480) +++ head/sys/i386/include/pcpu.h Fri Dec 23 15:14:56 2016 (r310481) @@ -36,6 +36,9 @@ #include #include +#include +#include + /* * The SMP parts are setup in pmap.c and locore.s for the BSP, and * mp_machdep.c sets up the data for the AP's to "see" when they awake. @@ -58,9 +61,14 @@ int pc_private_tss; /* Flag indicating private tss*/\ u_int pc_cmci_mask; /* MCx banks for CMCI */ \ u_int pc_vcpu_id; /* Xen vCPU ID */ \ + struct mtx pc_cmap_lock; \ + void *pc_cmap_pte1; \ + void *pc_cmap_pte2; \ + caddr_t pc_cmap_addr1; \ + caddr_t pc_cmap_addr2; \ vm_offset_t pc_qmap_addr; /* KVA for temporary mappings */\ uint32_t pc_smp_tlb_done; /* TLB op acknowledgement */ \ - char __pad[225] + char __pad[189] #ifdef _KERNEL From owner-svn-src-all@freebsd.org Fri Dec 23 16:36:21 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E7BABC8E1AA; Fri, 23 Dec 2016 16:36:21 +0000 (UTC) (envelope-from carpeddiem@gmail.com) Received: from mail-io0-x243.google.com (mail-io0-x243.google.com [IPv6:2607:f8b0:4001:c06::243]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id B228115FF; Fri, 23 Dec 2016 16:36:21 +0000 (UTC) (envelope-from carpeddiem@gmail.com) Received: by mail-io0-x243.google.com with SMTP id m204so230825ioe.3; Fri, 23 Dec 2016 08:36:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=XHcyEuRONp66DoHE9PYDy903k8sHrcJV3Rf6q3HxOVU=; b=H8U2m066fHVN74g1ifHcUo1NXQmT8qRllG+AbgGZPO0xTSvvKj7dviY9w8vU81G6p2 ZxVz3fSddE0UscINSYTLvn1daov0ZS9u0NR9LX6ZtHAJXZWmSbCwqikNdEACwgQvlkT9 heqFNUGul2n79VRyNeXu1xbh53c2hpQdaJ/qFg6wtfrAeVLpWzSEJ2dJOMrugSULyerD d9uMEsNYI/lmT+WQWASTWogAKICT4Wx9dwYmqaOHxE8C88oG22bkKkB4esqZ7xP1HuxF LDkKhr9PtqxmAMd76bAnTTP8Sg7Gvc/sEKnLgwBZ04U9fYYhDE++39DQ6PJRfN9gb8SV GGDQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=XHcyEuRONp66DoHE9PYDy903k8sHrcJV3Rf6q3HxOVU=; b=ljH02udzqJzNtiGGYHjZuza96fRm0mAN1oCXjlgPjpBS3chJp4nHSizXHTjCkgFlWz q1v8V+AkFYj9HwPO3vetBNSR0YFkp+Geyc7MLMNyfW93pQWvfKLyQgOriqJQlY3B78cP Wx4/Nx7Mt5AIN70bbMbxa3ei6AL5+s5EydSrKUNIUW5gfg2DI19oCcB1xgyc9BG2fH00 5Koes55PQ6YiECoqsqpDCgKhId5m4jh+jJYuql7AoPlV3b3qGXMjjnP1BqKPUMMo23Zw frF5Ysp7NpZWv2Ru7H4f0XrKAeEJBenRiNds5lefmlMtvd93rtdaNrBVV1MqofR12Q8c C6Vg== X-Gm-Message-State: AIkVDXLyA5pNMiX4EF3e0wMolcrp8zEqAUCkjYxQkMoKG1/RQphFnUBC30D57eyDwlABDVl+QQbHBguy5kkb7g== X-Received: by 10.107.18.193 with SMTP id 62mr16542832ios.155.1482510979958; Fri, 23 Dec 2016 08:36:19 -0800 (PST) MIME-Version: 1.0 Sender: carpeddiem@gmail.com Received: by 10.107.175.133 with HTTP; Fri, 23 Dec 2016 08:35:59 -0800 (PST) In-Reply-To: <201611180013.uAI0DU57087971@repo.freebsd.org> References: <201611180013.uAI0DU57087971@repo.freebsd.org> From: Ed Maste Date: Fri, 23 Dec 2016 11:35:59 -0500 X-Google-Sender-Auth: tdAKy7v4-50_ky7NfMAI8zaVZvA Message-ID: Subject: Re: svn commit: r308789 - head/sys/conf To: Gleb Smirnoff Cc: "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" Content-Type: text/plain; charset=UTF-8 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Dec 2016 16:36:22 -0000 On 17 November 2016 at 19:13, Gleb Smirnoff wrote: > Author: glebius > Date: Fri Nov 18 00:13:30 2016 > New Revision: 308789 > URL: https://svnweb.freebsd.org/changeset/base/308789 > > Log: > If FreeBSD source tree is a subproject of a bigger project, then .git or > .hg may reside above FreeBSD sources root. Provide function findvcs() > that will climb up and seek for presence of a VCS directory. This can incorrectly find an unrelated .git directory and provide a git revision unrelated to the FreeBSD source being built. For example, a build from my Subversion tree now reports "FreeBSD 12.0-CURRENT #2 ad3f46a(master)" instead of "FreeBSD 12.0-CURRENT #5 r310482M". Can you explain your use case in a little more detail so that I can avoid breaking it with a change here? Do you commit FreeBSD snapshots into the "bigger project"? From owner-svn-src-all@freebsd.org Fri Dec 23 18:25:45 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5F28BC8ED52; Fri, 23 Dec 2016 18:25:45 +0000 (UTC) (envelope-from ken@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 1F63593C; Fri, 23 Dec 2016 18:25:45 +0000 (UTC) (envelope-from ken@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBNIPiRK071695; Fri, 23 Dec 2016 18:25:44 GMT (envelope-from ken@FreeBSD.org) Received: (from ken@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBNIPiqr071692; Fri, 23 Dec 2016 18:25:44 GMT (envelope-from ken@FreeBSD.org) Message-Id: <201612231825.uBNIPiqr071692@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ken set sender to ken@FreeBSD.org using -f From: "Kenneth D. Merry" Date: Fri, 23 Dec 2016 18:25:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r310483 - in stable/11: share/man/man4 sys/conf sys/dev/isp X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Dec 2016 18:25:45 -0000 Author: ken Date: Fri Dec 23 18:25:43 2016 New Revision: 310483 URL: https://svnweb.freebsd.org/changeset/base/310483 Log: MFC, r310338: ------------------------------------------------------------------------ r310338 | ken | 2016-12-20 14:17:07 -0700 (Tue, 20 Dec 2016) | 37 lines Turn on FC-Tape by default in the isp(4) driver. FC-Tape provides additional link level error recovery, and is highly recommended for tape devices. It will only be turned on for a given target if the target supports it. Without this setting, we default to whatever FC-Tape setting is in NVRAM on the card. This can be overridden by setting the following loader tunable, for example for isp0: hint.isp.0.nofctape=1 sys/conf/options: Add a new kernel config option, ISP_FCTAPE_OFF, that defaults the FC-Tape configuration to off. sys/dev/isp/isp_pci.c: If ISP_FCTAPE_OFF is defined, turn off FC-Tape. Otherwise, turn it on if the card supports it. share/man/man4/isp.4: Add a description of FC-Tape to the isp(4) man page. Add descriptions of the fctape and nofctape options, as well as the ISP_FCTAPE_OFF kernel configuration option. Add the ispfw module and kernel drivers to the suggested configurations at the top of the man page so that users are less likely to leave it out. The driver works well with the included firmware, but may not work at all with whatever firmware the user has flashed on their card. Sponsored by: Spectra Logic ------------------------------------------------------------------------ Sponsored by: Spectra Logic Modified: stable/11/share/man/man4/isp.4 stable/11/sys/conf/options stable/11/sys/dev/isp/isp_pci.c Directory Properties: stable/11/ (props changed) Modified: stable/11/share/man/man4/isp.4 ============================================================================== --- stable/11/share/man/man4/isp.4 Fri Dec 23 16:06:41 2016 (r310482) +++ stable/11/share/man/man4/isp.4 Fri Dec 23 18:25:43 2016 (r310483) @@ -26,7 +26,7 @@ .\" .\" $FreeBSD$ .\" -.Dd December 9, 2015 +.Dd December 20, 2016 .Dt ISP 4 .Os .Sh NAME @@ -39,13 +39,15 @@ kernel configuration file: .Bd -ragged -offset indent .Cd "device scbus" .Cd "device isp" +.Cd "device ispfw" .Ed .Pp Alternatively, to load the driver as a -module at boot time, place the following line in +module at boot time, place the following lines in .Xr loader.conf 5 : .Bd -literal -offset indent isp_load="YES" +ispfw_load="YES" .Ed .Sh DESCRIPTION This driver provides access to @@ -62,6 +64,30 @@ Fibre Channel supports initiator and tar utilizing Class 3 and Class 2 (2200 and later) connections. Support is available for Public and Private loops, Point-to-Point and Fabric connections. +.Pp +FC-Tape is supported on 4Gb (2400) and newer controllers. +FC-Tape is highly recommended for connections to tape drives that support +it. +It encompasses four elements from the the T-10 FCP-4 specification: +.Bl -bullet -offset indent +.It +Precise Delivery of Commands +.It +Confirmed Completion of FCP I/O Operations +.It +Retransmission of Unsuccessfully Transmitted IUs +.It +Task Retry Identification +.El +.Pp +Together these features allow for link level error recovery with tape +devices. +Without it, an initiator cannot, for instance, tell whether a tape write +command that has timed out resulted in all, part or none of the data going to +the tape drive. +FC-Tape is automatically enabled when connecting controller that supports +it to a target that supports it. +It may be disabled using configuration and hint options described below. .Sh FIRMWARE Firmware loading is supported if the .Xr ispfw 4 @@ -120,6 +146,13 @@ Target mode support for Fibre Channel ad .Cd options ISP_TARGET_MODE .Pp option. +.Pp +To disable FC-Tape, use the following configuration option: +.Pp +.Cd options ISP_FCTAPE_OFF +.Pp +Note that even if the ISP_FCTAPE_OFF option is used, it may be overridden +by the fctape hint described below. .Sh BOOT OPTIONS The following options are switchable by setting values in .Pa /boot/device.hints . @@ -169,6 +202,11 @@ A hint value for a driver debug level (s for the values. .It Va hint.isp.0.vports A hint to create specified number of additional virtual ports. +.It Va hint.isp.0.nofctape +Set this to 1 to disable FC-Tape operation on the given isp instance. +.It Va hint.isp.0.fctape +Set this to 1 to enable FC-Tape operation on the given isp instance for +targets that support it. .El .Sh SYSCTL OPTIONS .Bl -tag -width indent Modified: stable/11/sys/conf/options ============================================================================== --- stable/11/sys/conf/options Fri Dec 23 16:06:41 2016 (r310482) +++ stable/11/sys/conf/options Fri Dec 23 18:25:43 2016 (r310483) @@ -381,6 +381,7 @@ ISP_TARGET_MODE opt_isp.h ISP_FW_CRASH_DUMP opt_isp.h ISP_DEFAULT_ROLES opt_isp.h ISP_INTERNAL_TARGET opt_isp.h +ISP_FCTAPE_OFF opt_isp.h # Options used only in dev/iscsi ISCSI_INITIATOR_DEBUG opt_iscsi_initiator.h Modified: stable/11/sys/dev/isp/isp_pci.c ============================================================================== --- stable/11/sys/dev/isp/isp_pci.c Fri Dec 23 16:06:41 2016 (r310482) +++ stable/11/sys/dev/isp/isp_pci.c Fri Dec 23 18:25:43 2016 (r310483) @@ -598,11 +598,18 @@ isp_get_specific_options(device_t dev, i } } +#ifdef ISP_FCTAPE_OFF + isp->isp_confopts |= ISP_CFG_NOFCTAPE; +#else + isp->isp_confopts |= ISP_CFG_FCTAPE; +#endif + tval = 0; snprintf(name, sizeof(name), "%snofctape", prefix); (void) resource_int_value(device_get_name(dev), device_get_unit(dev), name, &tval); if (tval) { + isp->isp_confopts &= ~ISP_CFG_FCTAPE; isp->isp_confopts |= ISP_CFG_NOFCTAPE; } From owner-svn-src-all@freebsd.org Fri Dec 23 18:26:04 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 457B8C8ED96; Fri, 23 Dec 2016 18:26:04 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from mail.baldwin.cx (bigwig.baldwin.cx [IPv6:2001:470:1f11:75::1]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B37C7A46; Fri, 23 Dec 2016 18:26:03 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from ralph.baldwin.cx (c-73-231-226-104.hsd1.ca.comcast.net [73.231.226.104]) by mail.baldwin.cx (Postfix) with ESMTPSA id 34B7F10A999; Fri, 23 Dec 2016 13:26:01 -0500 (EST) From: John Baldwin To: src-committers@freebsd.org Cc: svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r310445 - in head/sys/mips: include mips Date: Thu, 22 Dec 2016 19:49:11 -0800 Message-ID: <1808755.8aTbUPpvbL@ralph.baldwin.cx> User-Agent: KMail/4.14.10 (FreeBSD/11.0-PRERELEASE; KDE/4.14.10; amd64; ; ) In-Reply-To: <201612230327.uBN3RBC1099442@repo.freebsd.org> References: <201612230327.uBN3RBC1099442@repo.freebsd.org> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.4.3 (mail.baldwin.cx); Fri, 23 Dec 2016 13:26:01 -0500 (EST) X-Virus-Scanned: clamav-milter 0.99.2 at mail.baldwin.cx X-Virus-Status: Clean X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Dec 2016 18:26:04 -0000 On Friday, December 23, 2016 03:27:11 AM John Baldwin wrote: > Author: jhb > Date: Fri Dec 23 03:27:11 2016 > New Revision: 310445 > URL: https://svnweb.freebsd.org/changeset/base/310445 > > Log: > Teach DDB how to unwind across a kernel stack overflow. > > Kernel stack overflows in MIPS call panic() directly from an assembly > handler after storing the interrupted context's registers in a > trapframe. Rather than inferring the location of ra, sp, and pc from > the instruction stream, recognize the pc of a kernel stack overflow > and pull the registers from the trapframe. > > Sponsored by: DARPA / AFRL We should possibly use this same logic for other subroutines that use trapframes. Trying to run a program that core dumps over NFS in my qemu mips64 machine triggers the stack overflow on a kernel built with gcc5.3 from ports. The DDB stack trace doesn't get very far: panic: kernel stack overflow - trapframe at 0xffffffff80699eb0 KDB: stack backtrace: db_trace_self+1c (?,?,?,?) ra ffffffff801620d8 sp ffffffff80699ac0 sz 16 ffffffff801620ac+2c (?,?,?,?) ra ffffffff80357788 sp ffffffff80699ad0 sz 800 ffffffff80357744+44 (?,?,?,?) ra ffffffff80304ff4 sp ffffffff80699df0 sz 16 vpanic+f4 (?,?,?,?) ra ffffffff80305d84 sp ffffffff80699e00 sz 48 panic+30 (?,ffffffff80699eb0,ffffffffffffffec,ffffffff802c901c) ra ffffffff805388bc sp ffffffff80699e30 sz 96 MipsTLBInvalidException+360 (?,?,?,?) ra 0 sp ffffffff80699e90 sz 0 --- Kernel Stack Overflow --- ffffffff802c9018+4 (?,?,?,?) ra ffffffff805544e4 sp c00000002a5b5fa0 sz 96 ffffffff80554400+e4 (?,?,?,?) ra ffffffff802c90f4 sp c00000002a5b6000 sz 48 ffffffff802c9018+dc (?,?,?,?) ra ffffffff805563dc sp c00000002a5b6030 sz 96 cpu_intr+248 (?,?,?,?) ra ffffffff80538110 sp c00000002a5b6090 sz 80 MipsKernIntr+188 (?,?,?,?) ra 0 sp c00000002a5b60e0 sz 368 pid 607 KDB: enter: panic (In particular, we probably should be using the trapframe logic employed here for MipsKernIntr.) I've patched kgdb to add a MIPS kernel target and taught it how to handle trapframes, etc. (and it can cross-debug, so I used an amd64 host to examine the dump) and it gives a more useful stack trace. Unfortunately, increasing the kstack size on MIPS as a workaround for this issue seems to be very hard as the code in cpu_switch() hard codes exactly two TLB entries to cover the kernel stack and PCB to avoid TLB faults during a context switch. I think if you create a kthread with a non-default kstack size on MIPS it's probably a ticking time bomb in that you might get a TLB miss when accessing the pcb. savectx () at /usr/home/john/work/git/freebsd/sys/mips/mips/swtch.S:171 171 SAVE_U_PCB_CONTEXT(ra, PCB_REG_PC, a0) (kgdb) where #0 savectx () at /usr/home/john/work/git/freebsd/sys/mips/mips/swtch.S:171 #1 0xffffffff80304dfc in doadump (textdump=textdump@entry=0) at /usr/home/john/work/git/freebsd/sys/kern/kern_shutdown.c:297 #2 0xffffffff8015d868 in db_dump (dummy=, dummy2=, dummy3=, dummy4=) at /usr/home/john/work/git/freebsd/sys/ddb/db_command.c:546 #3 0xffffffff8015e474 in db_command ( last_cmdp=last_cmdp@entry=0xffffffff8069e778 , cmd_table=, cmd_table@entry=0xffffffff8069e730 , dopager=dopager@entry=1) at /usr/home/john/work/git/freebsd/sys/ddb/db_command.c:453 #4 0xffffffff8015eab8 in db_command_loop () at /usr/home/john/work/git/freebsd/sys/ddb/db_command.c:506 #5 0xffffffff80162040 in db_trap (type=, code=) at /usr/home/john/work/git/freebsd/sys/ddb/db_main.c:248 #6 0xffffffff803583e8 in kdb_trap (type=type@entry=9, code=code@entry=0, tf=tf@entry=0xffffffff80699ca0 ) at /usr/home/john/work/git/freebsd/sys/kern/subr_kdb.c:654 #7 0xffffffff8054ba10 in trap (trapframe=0xffffffff80699ca0 ) at /usr/home/john/work/git/freebsd/sys/mips/mips/trap.c:828 #8 #9 kdb_enter (why=0xffffffff805b6138 "panic", msg=) at /usr/home/john/work/git/freebsd/sys/kern/subr_kdb.c:444 #10 0xffffffff8030503c in vpanic (fmt=, ap=ap@entry=0xffffffff80699e58 ) at /usr/home/john/work/git/freebsd/sys/kern/kern_shutdown.c:752 ---Type to continue, or q to quit--- #11 0xffffffff80305d84 in panic (fmt=) at /usr/home/john/work/git/freebsd/sys/kern/kern_shutdown.c:690 #12 #13 0xffffffff802c901c in intr_event_handle (ie=0x9800000000a42400, frame=frame@entry=0x0) at /usr/home/john/work/git/freebsd/sys/kern/kern_intr.c:1397 #14 0xffffffff805544e4 in gt_pci_intr (v=0x9800000000ab0800) at /usr/home/john/work/git/freebsd/sys/mips/malta/gt_pci.c:236 #15 0xffffffff802c90f4 in intr_event_handle (ie=0x9800000000a43900, frame=frame@entry=0xc00000002a5b6100) at /usr/home/john/work/git/freebsd/sys/kern/kern_intr.c:1436 #16 0xffffffff805563dc in cpu_intr (tf=0xc00000002a5b6100) at /usr/home/john/work/git/freebsd/sys/mips/mips/intr_machdep.c:264 #17 #18 le_pci_wrcsr (sc=0x9800000000ae9400, port=, val=) at /usr/home/john/work/git/freebsd/sys/dev/le/if_le_pci.c:187 #19 0xffffffff801893e4 in am79900_start_locked (sc=0x9800000000ae9400) at /usr/home/john/work/git/freebsd/sys/dev/le/am79900.c:594 #20 0xffffffff8018b1c0 in lance_start (ifp=) at /usr/home/john/work/git/freebsd/sys/dev/le/lance.c:243 #21 0xffffffff804137e4 in if_start (ifp=ifp@entry=0x9800000000ae4800) at /usr/home/john/work/git/freebsd/sys/net/if.c:3630 #22 0xffffffff80413998 in if_transmit (ifp=0x9800000000ae4800, m=) at /usr/home/john/work/git/freebsd/sys/net/if.c:3642 #23 0xffffffff804174fc in ether_output_frame ( ---Type to continue, or q to quit--- ifp=ifp@entry=0x9800000000ae4800, m=0x980000000162d100) at /usr/home/john/work/git/freebsd/sys/net/if_ethersubr.c:457 #24 0xffffffff80417b94 in ether_output (ifp=0x9800000000ae4800, m=0x980000000162d100, dst=0x98000000032878f0, ro=) at /usr/home/john/work/git/freebsd/sys/net/if_ethersubr.c:429 #25 0xffffffff8045cf28 in ip_output (m=m@entry=0x980000000162d100, opt=, ro=0x98000000032878d0, flags=, imo=, imo@entry=0x0, inp=) at /usr/home/john/work/git/freebsd/sys/netinet/ip_output.c:664 #26 0xffffffff80470348 in tcp_output (tp=0x9800000001f4f000) at /usr/home/john/work/git/freebsd/sys/netinet/tcp_output.c:1432 #27 0xffffffff80480d1c in tcp_usr_send (so=0x98000000032a8a20, flags=, m=0x9800000001621a00, nam=0x0, control=, td=0x9800000003275a60) at /usr/home/john/work/git/freebsd/sys/netinet/tcp_usrreq.c:956 #28 0xffffffff803a6ef8 in sosend_generic (so=0x98000000032a8a20, addr=, uio=0x0, top=0x9800000001621a00, control=, flags=, td=) at /usr/home/john/work/git/freebsd/sys/kern/uipc_socket.c:1359 #29 0xffffffff803a7060 in sosend (so=, addr=addr@entry=0x0, uio=uio@entry=0x0, top=top@entry=0x9800000001621a00, control=control@entry=0x0, flags=flags@entry=0, td=) at /usr/home/john/work/git/freebsd/sys/kern/uipc_socket.c:1403 #30 0xffffffff8049220c in clnt_vc_call (cl=, ext=0xc00000002a5b69e8, proc=, args=0x980000000162d200, resultsp=0xc00000002a5b6b40, utimeout=...) ---Type to continue, or q to quit--- at /usr/home/john/work/git/freebsd/sys/rpc/clnt_vc.c:398 #31 0xffffffff804908a4 in clnt_reconnect_call (cl=0x9800000001630400, ext=0xc00000002a5b69e8, proc=, args=0x980000000162d200, resultsp=0xc00000002a5b6b40, utimeout=...) at /usr/home/john/work/git/freebsd/sys/rpc/clnt_rc.c:271 #32 0xffffffff801dd360 in newnfs_request (nd=0xc00000002a5b6b40, nmp=0x980000000163b800, clp=clp@entry=0x0, nrp=0x980000000163b928, vp=0x98000000044aa000, td=td@entry=0x9800000003275a60, cred=cred@entry=0x9800000001670000, prog=prog@entry=100003, vers=3, retsum=retsum@entry=0x0, toplevel=toplevel@entry=1, xidp=xidp@entry=0x0, sep=sep@entry=0x0) at /usr/home/john/work/git/freebsd/sys/fs/nfs/nfs_commonkrpc.c:746 #33 0xffffffff8022c738 in nfscl_request (nd=nd@entry=0xc00000002a5b6b40, vp=vp@entry=0x98000000044aa000, p=p@entry=0x9800000003275a60, cred=cred@entry=0x9800000001670000, stuff=stuff@entry=0x0) at /usr/home/john/work/git/freebsd/sys/fs/nfsclient/nfs_clport.c:951 #34 0xffffffff802116a8 in nfsrpc_commit (vp=0x98000000044aa000, offset=offset@entry=65536, cnt=cnt@entry=65536, cred=cred@entry=0x9800000001670000, p=p@entry=0x9800000003275a60, nap=nap@entry=0xc00000002a5b6cc0, attrflagp=attrflagp@entry=0xc00000002a5b6d88, stuff=stuff@entry=0x0) at /usr/home/john/work/git/freebsd/sys/fs/nfsclient/nfs_clrpcops.c:3640 #35 0xffffffff80220e74 in ncl_commit (vp=vp@entry=0x98000000044aa000, offset=offset@entry=65536, cnt=, cred=cred@entry=0x9800000001670000, td=td@entry=0x9800000003275a60) at /usr/home/john/work/git/freebsd/sys/fs/nfsclient/nfs_clvnops.c:2553 ---Type to continue, or q to quit--- #36 0xffffffff8022130c in ncl_flush (vp=0x98000000044aa000, waitfor=, cred=cred@entry=0x0, td=0x9800000003275a60, commit=commit@entry=1, called_from_renewthread=called_from_renewthread@entry=0) at /usr/home/john/work/git/freebsd/sys/fs/nfsclient/nfs_clvnops.c:2774 #37 0xffffffff8022220c in nfs_fsync (ap=) at /usr/home/john/work/git/freebsd/sys/fs/nfsclient/nfs_clvnops.c:2619 #38 0xffffffff80559508 in VOP_FSYNC_APV (vop=, a=a@entry=0xc00000002a5b6fa0) at vnode_if.c:1331 #39 0xffffffff803bcbd4 in VOP_FSYNC (td=, waitfor=, vp=) at vnode_if.h:549 #40 bufsync (bo=, waitfor=) at /usr/home/john/work/git/freebsd/sys/kern/vfs_bio.c:4605 #41 0xffffffff803e6088 in bufobj_invalbuf (bo=bo@entry=0x98000000044aa0d0, flags=, slpflag=, slptimeo=) at /usr/home/john/work/git/freebsd/sys/kern/vfs_subr.c:1633 #42 0xffffffff803e63a8 in vinvalbuf (vp=vp@entry=0x98000000044aa000, flags=flags@entry=1, slpflag=slpflag@entry=0, slptimeo=slptimeo@entry=0) at /usr/home/john/work/git/freebsd/sys/kern/vfs_subr.c:1711 #43 0xffffffff8022df5c in ncl_vinvalbuf (vp=vp@entry=0x98000000044aa000, flags=flags@entry=1, td=td@entry=0x9800000003275a60, intrflg=, intrflg@entry=1) at /usr/home/john/work/git/freebsd/sys/fs/nfsclient/nfs_clbio.c:1387 #44 0xffffffff8021d5ec in nfs_setattr (ap=0xc00000002a5b7298) at /usr/home/john/work/git/freebsd/sys/fs/nfsclient/nfs_clvnops.c:937 #45 0xffffffff80558564 in VOP_SETATTR_APV (vop=, ---Type to continue, or q to quit--- a=a@entry=0xc00000002a5b7298) at vnode_if.c:799 #46 0xffffffff80230eac in VOP_SETATTR (cred=0x9800000001670000, vap=0xc00000002a5b71f0, vp=0x98000000044aa000) at vnode_if.h:335 #47 ncl_write (ap=) at /usr/home/john/work/git/freebsd/sys/fs/nfsclient/nfs_clbio.c:1280 #48 0xffffffff80558b70 in VOP_WRITE_APV (vop=, a=a@entry=0xc00000002a5b74f0) at vnode_if.c:1000 #49 0xffffffff803f9708 in VOP_WRITE (cred=, ioflag=, uio=0xc00000002a5b7690, vp=) at vnode_if.h:413 #50 vn_io_fault_doio (args=args@entry=0xc00000002a5b76d8, uio=uio@entry=0xc00000002a5b7690, td=td@entry=0x9800000003275a60) at /usr/home/john/work/git/freebsd/sys/kern/vfs_vnops.c:952 #51 0xffffffff803f9894 in vn_io_fault1 (vp=vp@entry=0x98000000044aa000, uio=uio@entry=0xc00000002a5b7690, args=args@entry=0xc00000002a5b76d8, td=td@entry=0x9800000003275a60) at /usr/home/john/work/git/freebsd/sys/kern/vfs_vnops.c:1060 #52 0xffffffff803fca30 in vn_rdwr (rw=rw@entry=UIO_WRITE, vp=vp@entry=0x98000000044aa000, base=base@entry=0x160085000, len=len@entry=16384, offset=offset@entry=131072, segflg=segflg@entry=UIO_USERSPACE, ioflg=ioflg@entry=16641, active_cred=active_cred@entry=0x9800000001670000, file_cred=file_cred@entry=0x0, aresid=aresid@entry=0xc00000002a5b77a0, td=td@entry=0x9800000003275a60) at /usr/home/john/work/git/freebsd/sys/kern/vfs_vnops.c:576 #53 0xffffffff803fcc68 in vn_rdwr_inchunks (rw=rw@entry=UIO_WRITE, ---Type to continue, or q to quit--- vp=0x98000000044aa000, base=0x160085000, len=16384, offset=131072, offset@entry=98304, segflg=segflg@entry=UIO_USERSPACE, ioflg=ioflg@entry=16641, active_cred=0x9800000001670000, file_cred=0x0, aresid=aresid@entry=0x0, td=0x9800000003275a60) at /usr/home/john/work/git/freebsd/sys/kern/vfs_vnops.c:641 #54 0xffffffff802954f4 in core_write (seg=UIO_USERSPACE, offset=98304, len=, base=, p=0xc00000002a5b7860) at /usr/home/john/work/git/freebsd/sys/kern/imgact_elf.c:1229 #55 core_output (tmpbuf=0x0, p=0xc00000002a5b7860, offset=98304, len=, base=) at /usr/home/john/work/git/freebsd/sys/kern/imgact_elf.c:1243 #56 elf64_coredump (td=, vp=0x98000000044aa000, limit=9223372036854775807, flags=) at /usr/home/john/work/git/freebsd/sys/kern/imgact_elf.c:1384 #57 0xffffffff8030805c in coredump (td=td@entry=0x9800000003275a60) at /usr/home/john/work/git/freebsd/sys/kern/kern_sig.c:3477 #58 0xffffffff8030b818 in sigexit (td=td@entry=0x9800000003275a60, sig=sig@entry=7) at /usr/home/john/work/git/freebsd/sys/kern/kern_sig.c:3072 #59 0xffffffff8030c19c in postsig (sig=sig@entry=7) at /usr/home/john/work/git/freebsd/sys/kern/kern_sig.c:2985 #60 0xffffffff8036f13c in ast (framep=0xc00000002a5b7d30) at /usr/home/john/work/git/freebsd/sys/kern/subr_trap.c:314 #61 #62 0x0000000120000ff4 in ?? () Backtrace stopped: previous frame identical to this frame (corrupt stack?) -- John Baldwin From owner-svn-src-all@freebsd.org Fri Dec 23 18:29:12 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 384E5C8EE7C; Fri, 23 Dec 2016 18:29:12 +0000 (UTC) (envelope-from ken@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id ED129C98; Fri, 23 Dec 2016 18:29:11 +0000 (UTC) (envelope-from ken@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBNITBia071853; Fri, 23 Dec 2016 18:29:11 GMT (envelope-from ken@FreeBSD.org) Received: (from ken@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBNITA0V071850; Fri, 23 Dec 2016 18:29:10 GMT (envelope-from ken@FreeBSD.org) Message-Id: <201612231829.uBNITA0V071850@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ken set sender to ken@FreeBSD.org using -f From: "Kenneth D. Merry" Date: Fri, 23 Dec 2016 18:29:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r310484 - in stable/10: share/man/man4 sys/conf sys/dev/isp X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Dec 2016 18:29:12 -0000 Author: ken Date: Fri Dec 23 18:29:10 2016 New Revision: 310484 URL: https://svnweb.freebsd.org/changeset/base/310484 Log: MFC, r310338: ------------------------------------------------------------------------ r310338 | ken | 2016-12-20 14:17:07 -0700 (Tue, 20 Dec 2016) | 37 lines Turn on FC-Tape by default in the isp(4) driver. FC-Tape provides additional link level error recovery, and is highly recommended for tape devices. It will only be turned on for a given target if the target supports it. Without this setting, we default to whatever FC-Tape setting is in NVRAM on the card. This can be overridden by setting the following loader tunable, for example for isp0: hint.isp.0.nofctape=1 sys/conf/options: Add a new kernel config option, ISP_FCTAPE_OFF, that defaults the FC-Tape configuration to off. sys/dev/isp/isp_pci.c: If ISP_FCTAPE_OFF is defined, turn off FC-Tape. Otherwise, turn it on if the card supports it. share/man/man4/isp.4: Add a description of FC-Tape to the isp(4) man page. Add descriptions of the fctape and nofctape options, as well as the ISP_FCTAPE_OFF kernel configuration option. Add the ispfw module and kernel drivers to the suggested configurations at the top of the man page so that users are less likely to leave it out. The driver works well with the included firmware, but may not work at all with whatever firmware the user has flashed on their card. Sponsored by: Spectra Logic ------------------------------------------------------------------------ Sponsored by: Spectra Logic Modified: stable/10/share/man/man4/isp.4 stable/10/sys/conf/options stable/10/sys/dev/isp/isp_pci.c Directory Properties: stable/10/ (props changed) Modified: stable/10/share/man/man4/isp.4 ============================================================================== --- stable/10/share/man/man4/isp.4 Fri Dec 23 18:25:43 2016 (r310483) +++ stable/10/share/man/man4/isp.4 Fri Dec 23 18:29:10 2016 (r310484) @@ -26,7 +26,7 @@ .\" .\" $FreeBSD$ .\" -.Dd December 9, 2015 +.Dd December 20, 2016 .Dt ISP 4 .Os .Sh NAME @@ -39,13 +39,15 @@ kernel configuration file: .Bd -ragged -offset indent .Cd "device scbus" .Cd "device isp" +.Cd "device ispfw" .Ed .Pp Alternatively, to load the driver as a -module at boot time, place the following line in +module at boot time, place the following lines in .Xr loader.conf 5 : .Bd -literal -offset indent isp_load="YES" +ispfw_load="YES" .Ed .Sh DESCRIPTION This driver provides access to @@ -62,6 +64,30 @@ Fibre Channel supports initiator and tar utilizing Class 3 and Class 2 (2200 and later) connections. Support is available for Public and Private loops, Point-to-Point and Fabric connections. +.Pp +FC-Tape is supported on 4Gb (2400) and newer controllers. +FC-Tape is highly recommended for connections to tape drives that support +it. +It encompasses four elements from the the T-10 FCP-4 specification: +.Bl -bullet -offset indent +.It +Precise Delivery of Commands +.It +Confirmed Completion of FCP I/O Operations +.It +Retransmission of Unsuccessfully Transmitted IUs +.It +Task Retry Identification +.El +.Pp +Together these features allow for link level error recovery with tape +devices. +Without it, an initiator cannot, for instance, tell whether a tape write +command that has timed out resulted in all, part or none of the data going to +the tape drive. +FC-Tape is automatically enabled when connecting controller that supports +it to a target that supports it. +It may be disabled using configuration and hint options described below. .Sh FIRMWARE Firmware loading is supported if the .Xr ispfw 4 @@ -120,6 +146,13 @@ Target mode support for Fibre Channel ad .Cd options ISP_TARGET_MODE .Pp option. +.Pp +To disable FC-Tape, use the following configuration option: +.Pp +.Cd options ISP_FCTAPE_OFF +.Pp +Note that even if the ISP_FCTAPE_OFF option is used, it may be overridden +by the fctape hint described below. .Sh BOOT OPTIONS The following options are switchable by setting values in .Pa /boot/device.hints . @@ -169,6 +202,11 @@ A hint value for a driver debug level (s for the values. .It Va hint.isp.0.vports A hint to create specified number of additional virtual ports. +.It Va hint.isp.0.nofctape +Set this to 1 to disable FC-Tape operation on the given isp instance. +.It Va hint.isp.0.fctape +Set this to 1 to enable FC-Tape operation on the given isp instance for +targets that support it. .El .Sh SYSCTL OPTIONS .Bl -tag -width indent Modified: stable/10/sys/conf/options ============================================================================== --- stable/10/sys/conf/options Fri Dec 23 18:25:43 2016 (r310483) +++ stable/10/sys/conf/options Fri Dec 23 18:29:10 2016 (r310484) @@ -374,6 +374,7 @@ ISP_TARGET_MODE opt_isp.h ISP_FW_CRASH_DUMP opt_isp.h ISP_DEFAULT_ROLES opt_isp.h ISP_INTERNAL_TARGET opt_isp.h +ISP_FCTAPE_OFF opt_isp.h # Options used only in dev/iscsi ISCSI_INITIATOR_DEBUG opt_iscsi_initiator.h Modified: stable/10/sys/dev/isp/isp_pci.c ============================================================================== --- stable/10/sys/dev/isp/isp_pci.c Fri Dec 23 18:25:43 2016 (r310483) +++ stable/10/sys/dev/isp/isp_pci.c Fri Dec 23 18:29:10 2016 (r310484) @@ -598,11 +598,18 @@ isp_get_specific_options(device_t dev, i } } +#ifdef ISP_FCTAPE_OFF + isp->isp_confopts |= ISP_CFG_NOFCTAPE; +#else + isp->isp_confopts |= ISP_CFG_FCTAPE; +#endif + tval = 0; snprintf(name, sizeof(name), "%snofctape", prefix); (void) resource_int_value(device_get_name(dev), device_get_unit(dev), name, &tval); if (tval) { + isp->isp_confopts &= ~ISP_CFG_FCTAPE; isp->isp_confopts |= ISP_CFG_NOFCTAPE; } From owner-svn-src-all@freebsd.org Fri Dec 23 18:36:18 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8ED99C8C0E1 for ; Fri, 23 Dec 2016 18:36:18 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-it0-x244.google.com (mail-it0-x244.google.com [IPv6:2607:f8b0:4001:c0b::244]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 495DA10C0 for ; Fri, 23 Dec 2016 18:36:18 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-it0-x244.google.com with SMTP id b123so25203002itb.2 for ; Fri, 23 Dec 2016 10:36:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20150623.gappssmtp.com; s=20150623; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=IbQo8UOhjyWPG3k63Z3qwa7YANX/0IiYRrkc2C6daDk=; b=hjuGXVSM2l2bG+VMTiK3FUhbZ3ElppmfGugM8WJ9t11R4cd9b+3dcwT9oi0gsbgRso zcnZg2mhgsl2m8SARnr3kusoSFEGu0WlIqH5BChowV2Vh0GtBzpYDAKM9wcIzAS5hnTo xONvN1JPRwiTESRpYFEWneNP/986oH2hdxxMi6YsA2bSFzk67DteY39tMG6kxUiFfdWa l+qPRenttyp5FrhLG6fk2xkpGuyWe29Ao+KhL83Vtb7p4cGa7Ei/IdckPBa0y7ZFUhEd gsTz9j5cHbR8KwEhoR+zaRFJpCQJEuheVFu5U04eyXREXAfQoh9+veBcTrU62OP7E2ww vIeQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=IbQo8UOhjyWPG3k63Z3qwa7YANX/0IiYRrkc2C6daDk=; b=HmtdEMlFgw5tKDyiiEgySHDEGVaLbb+vM8/L0bVpP2MiNUsfD/oKim6ANGraORJq3S t12UCKRM5KjANSfem0s9v/3rbwaCqSGd6Ef8uVbTMEnc9j5P1xx9a1tIQEuPaOrNgC6l /TCK1QAFHtNZtcKU6xHeY8rxPCiO00EOKP57bEU1lyzqhYIhcBH/RORnQ8dqzkMlNjQi DTto5cxpGvfLyXX9/UFkiSGjt324pP/mFCs4Av3it+JKQloIWaM6s8rDZ70cAHJQ6VPg pglvXVmINJox7uKDN6Nj0J7X4MVlvARni/ew14ue9JxDQPiSEkjIJgGqBSG1lvm6XEn4 CZyg== X-Gm-Message-State: AIkVDXKC0YtyeMJmWrH+sIV6XiPtoRos/MCd/4cFqc0Fz1AxIp1mqbOYOLh7eXGAB97oUvToVq+8silpM70bkQ== X-Received: by 10.36.200.68 with SMTP id w65mr16823524itf.85.1482518177362; Fri, 23 Dec 2016 10:36:17 -0800 (PST) MIME-Version: 1.0 Sender: wlosh@bsdimp.com Received: by 10.79.22.135 with HTTP; Fri, 23 Dec 2016 10:36:16 -0800 (PST) X-Originating-IP: [50.253.99.174] In-Reply-To: References: <201611180013.uAI0DU57087971@repo.freebsd.org> From: Warner Losh Date: Fri, 23 Dec 2016 11:36:16 -0700 X-Google-Sender-Auth: MO1wesfYsL7T0phbHCaiKCKkLRE Message-ID: Subject: Re: svn commit: r308789 - head/sys/conf To: Ed Maste Cc: Gleb Smirnoff , "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" Content-Type: text/plain; charset=UTF-8 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Dec 2016 18:36:18 -0000 On Fri, Dec 23, 2016 at 9:35 AM, Ed Maste wrote: > On 17 November 2016 at 19:13, Gleb Smirnoff wrote: >> Author: glebius >> Date: Fri Nov 18 00:13:30 2016 >> New Revision: 308789 >> URL: https://svnweb.freebsd.org/changeset/base/308789 >> >> Log: >> If FreeBSD source tree is a subproject of a bigger project, then .git or >> .hg may reside above FreeBSD sources root. Provide function findvcs() >> that will climb up and seek for presence of a VCS directory. > > This can incorrectly find an unrelated .git directory and provide a > git revision unrelated to the FreeBSD source being built. For example, > a build from my Subversion tree now reports "FreeBSD 12.0-CURRENT #2 > ad3f46a(master)" instead of "FreeBSD 12.0-CURRENT #5 r310482M". > > Can you explain your use case in a little more detail so that I can > avoid breaking it with a change here? Do you commit FreeBSD snapshots > into the "bigger project"? This is done at work (Netflix). We import all the FreeBSD revisions from github into our repo, and then merge them into the top level FreeBSD directory from time to time using git's subtree functionality. We also pull in our ports tree this way (so we have a ports directory at the same level as our FreeBSD directory). So we don't have a $TOPSRC/.git like you would if you'd just cloned directly from github. Our .git directory lives in $TOPSRC/.git as a result. newvers.sh should find the 'deepest' SCM it can, and use that instead of apparently using the topmost (I'm surprised that you have FreeBSD under a directory that has a git checkout in it, btw, but I know that with my dotfile management repo, that sometimes happens by mistake). And if this somehow produces a 'tie', the tie should go to svn. Looking at how to fix this mess... woof. There's all kinds of crazy here. Support for: git, git + svn, hg, p4, svn and svnlite. Sometimes $VCS_cmd is defined if it exists at all on the system, other times it's only defined if it exists on the system AND we think the tree is under $VCS. But the base of all this woe is that findvcs is called on a per-vcs basis, rather than being called early to match one of N VCS signatures. It would be better off searching each directory for each file rather than finding any file at any level. Warner From owner-svn-src-all@freebsd.org Fri Dec 23 19:28:16 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id F259DC8D053; Fri, 23 Dec 2016 19:28:16 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B353CA91; Fri, 23 Dec 2016 19:28:16 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBNJSFYi095999; Fri, 23 Dec 2016 19:28:15 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBNJSFGT095997; Fri, 23 Dec 2016 19:28:15 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201612231928.uBNJSFGT095997@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Fri, 23 Dec 2016 19:28:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r310485 - in stable: 10/sys/amd64/amd64 10/sys/i386/i386 11/sys/amd64/amd64 11/sys/i386/i386 X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Dec 2016 19:28:17 -0000 Author: jhb Date: Fri Dec 23 19:28:15 2016 New Revision: 310485 URL: https://svnweb.freebsd.org/changeset/base/310485 Log: MFC 308820,308821: Fixes for fatal page faults on x86. 308820: Report page faults due to reserved bits in PTEs as a separate fault type. Rather than reporting a page fault due to a bad PTE as a protection violation with the "rsv" flag, treat these faults as a separate type of fault altogether. 308821: MFamd64: Various fatal page fault fixes. - If a page fault is triggered due to reserved bits in a PTE, treat it as a fatal fault and panic. - If PG_NX is in use, report whether a fatal page fault is due to an instruction fetch or a data access. - If a fatal page fault is due to reserved bits in a PTE, report that as the page fault type rather than a protection violation. Modified: stable/11/sys/amd64/amd64/trap.c stable/11/sys/i386/i386/trap.c Directory Properties: stable/11/ (props changed) Changes in other areas also in this revision: Modified: stable/10/sys/amd64/amd64/trap.c stable/10/sys/i386/i386/trap.c Directory Properties: stable/10/ (props changed) Modified: stable/11/sys/amd64/amd64/trap.c ============================================================================== --- stable/11/sys/amd64/amd64/trap.c Fri Dec 23 18:29:10 2016 (r310484) +++ stable/11/sys/amd64/amd64/trap.c Fri Dec 23 19:28:15 2016 (r310485) @@ -761,11 +761,11 @@ trap_fatal(frame, eva) #endif if (type == T_PAGEFLT) { printf("fault virtual address = 0x%lx\n", eva); - printf("fault code = %s %s %s%s, %s\n", + printf("fault code = %s %s %s, %s\n", code & PGEX_U ? "user" : "supervisor", code & PGEX_W ? "write" : "read", code & PGEX_I ? "instruction" : "data", - code & PGEX_RSV ? " rsv" : "", + code & PGEX_RSV ? "reserved bits in PTE" : code & PGEX_P ? "protection violation" : "page not present"); } printf("instruction pointer = 0x%lx:0x%lx\n", Modified: stable/11/sys/i386/i386/trap.c ============================================================================== --- stable/11/sys/i386/i386/trap.c Fri Dec 23 18:29:10 2016 (r310484) +++ stable/11/sys/i386/i386/trap.c Fri Dec 23 19:28:15 2016 (r310485) @@ -857,6 +857,14 @@ trap_pfault(frame, usermode, eva) } /* + * If the trap was caused by errant bits in the PTE then panic. + */ + if (frame->tf_err & PGEX_RSV) { + trap_fatal(frame, eva); + return (-1); + } + + /* * PGEX_I is defined only if the execute disable bit capability is * supported and enabled. */ @@ -926,9 +934,15 @@ trap_fatal(frame, eva) #endif if (type == T_PAGEFLT) { printf("fault virtual address = 0x%x\n", eva); - printf("fault code = %s %s, %s\n", + printf("fault code = %s %s%s, %s\n", code & PGEX_U ? "user" : "supervisor", code & PGEX_W ? "write" : "read", +#if defined(PAE) || defined(PAE_TABLES) + pg_nx != 0 ? + (code & PGEX_I ? " instruction" : " data") : +#endif + "", + code & PGEX_RSV ? "reserved bits in PTE" : code & PGEX_P ? "protection violation" : "page not present"); } printf("instruction pointer = 0x%x:0x%x\n", From owner-svn-src-all@freebsd.org Fri Dec 23 19:28:16 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id AF9D9C8D04E; Fri, 23 Dec 2016 19:28:16 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 64BC7A90; Fri, 23 Dec 2016 19:28:16 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBNJSFIX095992; Fri, 23 Dec 2016 19:28:15 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBNJSFMK095990; Fri, 23 Dec 2016 19:28:15 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201612231928.uBNJSFMK095990@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Fri, 23 Dec 2016 19:28:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r310485 - in stable: 10/sys/amd64/amd64 10/sys/i386/i386 11/sys/amd64/amd64 11/sys/i386/i386 X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Dec 2016 19:28:16 -0000 Author: jhb Date: Fri Dec 23 19:28:15 2016 New Revision: 310485 URL: https://svnweb.freebsd.org/changeset/base/310485 Log: MFC 308820,308821: Fixes for fatal page faults on x86. 308820: Report page faults due to reserved bits in PTEs as a separate fault type. Rather than reporting a page fault due to a bad PTE as a protection violation with the "rsv" flag, treat these faults as a separate type of fault altogether. 308821: MFamd64: Various fatal page fault fixes. - If a page fault is triggered due to reserved bits in a PTE, treat it as a fatal fault and panic. - If PG_NX is in use, report whether a fatal page fault is due to an instruction fetch or a data access. - If a fatal page fault is due to reserved bits in a PTE, report that as the page fault type rather than a protection violation. Modified: stable/10/sys/amd64/amd64/trap.c stable/10/sys/i386/i386/trap.c Directory Properties: stable/10/ (props changed) Changes in other areas also in this revision: Modified: stable/11/sys/amd64/amd64/trap.c stable/11/sys/i386/i386/trap.c Directory Properties: stable/11/ (props changed) Modified: stable/10/sys/amd64/amd64/trap.c ============================================================================== --- stable/10/sys/amd64/amd64/trap.c Fri Dec 23 18:29:10 2016 (r310484) +++ stable/10/sys/amd64/amd64/trap.c Fri Dec 23 19:28:15 2016 (r310485) @@ -812,11 +812,11 @@ trap_fatal(frame, eva) #endif if (type == T_PAGEFLT) { printf("fault virtual address = 0x%lx\n", eva); - printf("fault code = %s %s %s%s, %s\n", + printf("fault code = %s %s %s, %s\n", code & PGEX_U ? "user" : "supervisor", code & PGEX_W ? "write" : "read", code & PGEX_I ? "instruction" : "data", - code & PGEX_RSV ? " rsv" : "", + code & PGEX_RSV ? "reserved bits in PTE" : code & PGEX_P ? "protection violation" : "page not present"); } printf("instruction pointer = 0x%lx:0x%lx\n", Modified: stable/10/sys/i386/i386/trap.c ============================================================================== --- stable/10/sys/i386/i386/trap.c Fri Dec 23 18:29:10 2016 (r310484) +++ stable/10/sys/i386/i386/trap.c Fri Dec 23 19:28:15 2016 (r310485) @@ -879,6 +879,14 @@ trap_pfault(frame, usermode, eva) } /* + * If the trap was caused by errant bits in the PTE then panic. + */ + if (frame->tf_err & PGEX_RSV) { + trap_fatal(frame, eva); + return (-1); + } + + /* * PGEX_I is defined only if the execute disable bit capability is * supported and enabled. */ @@ -968,9 +976,15 @@ trap_fatal(frame, eva) #endif if (type == T_PAGEFLT) { printf("fault virtual address = 0x%x\n", eva); - printf("fault code = %s %s, %s\n", + printf("fault code = %s %s%s, %s\n", code & PGEX_U ? "user" : "supervisor", code & PGEX_W ? "write" : "read", +#if defined(PAE) || defined(PAE_TABLES) + pg_nx != 0 ? + (code & PGEX_I ? " instruction" : " data") : +#endif + "", + code & PGEX_RSV ? "reserved bits in PTE" : code & PGEX_P ? "protection violation" : "page not present"); } printf("instruction pointer = 0x%x:0x%x\n", From owner-svn-src-all@freebsd.org Fri Dec 23 19:30:16 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 36653C8D172; Fri, 23 Dec 2016 19:30:16 +0000 (UTC) (envelope-from kan@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 044C4DFE; Fri, 23 Dec 2016 19:30:15 +0000 (UTC) (envelope-from kan@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBNJUFDD096156; Fri, 23 Dec 2016 19:30:15 GMT (envelope-from kan@FreeBSD.org) Received: (from kan@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBNJUF3T096155; Fri, 23 Dec 2016 19:30:15 GMT (envelope-from kan@FreeBSD.org) Message-Id: <201612231930.uBNJUF3T096155@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kan set sender to kan@FreeBSD.org using -f From: Alexander Kabaev Date: Fri, 23 Dec 2016 19:30:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310486 - head/sys/mips/ingenic X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Dec 2016 19:30:16 -0000 Author: kan Date: Fri Dec 23 19:30:14 2016 New Revision: 310486 URL: https://svnweb.freebsd.org/changeset/base/310486 Log: Pass memattrs to fb device so that user mappings can inherit them Reviewed by: jmcneill Modified: head/sys/mips/ingenic/jz4780_lcd.c Modified: head/sys/mips/ingenic/jz4780_lcd.c ============================================================================== --- head/sys/mips/ingenic/jz4780_lcd.c Fri Dec 23 19:28:15 2016 (r310485) +++ head/sys/mips/ingenic/jz4780_lcd.c Fri Dec 23 19:30:14 2016 (r310486) @@ -306,7 +306,10 @@ jzlcd_configure(struct jzlcd_softc *sc, sc->info.fb_stride = mode->hdisplay * (FB_BPP / NBBY); sc->info.fb_width = mode->hdisplay; sc->info.fb_height = mode->vdisplay; - +#ifdef VM_MEMATTR_WRITE_COMBINING + sc->info.fb_flags = FB_FLAG_MEMATTR; + sc->info.fb_memattr = VM_MEMATTR_WRITE_COMBINING; +#endif sc->fbdev = device_add_child(sc->dev, "fbd", device_get_unit(sc->dev)); if (sc->fbdev == NULL) { device_printf(sc->dev, "failed to add fbd child\n"); From owner-svn-src-all@freebsd.org Fri Dec 23 19:42:19 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1117DC8D615; Fri, 23 Dec 2016 19:42:19 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id BA296164D; Fri, 23 Dec 2016 19:42:18 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBNJgH8N003675; Fri, 23 Dec 2016 19:42:17 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBNJgHrB003674; Fri, 23 Dec 2016 19:42:17 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201612231942.uBNJgHrB003674@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Fri, 23 Dec 2016 19:42:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r310487 - in stable: 10/sys/dev/acpica 11/sys/dev/acpica X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Dec 2016 19:42:19 -0000 Author: jhb Date: Fri Dec 23 19:42:17 2016 New Revision: 310487 URL: https://svnweb.freebsd.org/changeset/base/310487 Log: MFC 309588: Don't attach to Host-PCI bridges with a bad bus number. If the bus number assigned to a Host-PCI bridge doesn't match the first bus number in the associated producer range from _CRS, print a warning and fail to attach rather than panicking due to an assertion failure. At least one single-socket Dell machine leaves a "ghost" Host-PCI bridge device in the ACPI namespace that seems to correspond to the I/O hub in the second socket of a two-socket machine. However, the BIOS doesn't configure the settings for this "ghost" bridge correctly, nor does it have any PCI devices behind it. Modified: stable/10/sys/dev/acpica/acpi_pcib_acpi.c Directory Properties: stable/10/ (props changed) Changes in other areas also in this revision: Modified: stable/11/sys/dev/acpica/acpi_pcib_acpi.c Directory Properties: stable/11/ (props changed) Modified: stable/10/sys/dev/acpica/acpi_pcib_acpi.c ============================================================================== --- stable/10/sys/dev/acpica/acpi_pcib_acpi.c Fri Dec 23 19:30:14 2016 (r310486) +++ stable/10/sys/dev/acpica/acpi_pcib_acpi.c Fri Dec 23 19:42:17 2016 (r310487) @@ -480,10 +480,17 @@ acpi_pcib_acpi_attach(device_t dev) pci_domain_release_bus(sc->ap_segment, dev, rid, bus_res); } } else { -#ifdef INVARIANTS - if (first_decoded_bus(sc, &start) == 0) - KASSERT(start == sc->ap_bus, ("bus number mismatch")); -#endif + /* + * Require the bus number from _BBN to match the start of any + * decoded range. + */ + if (first_decoded_bus(sc, &start) == 0 && sc->ap_bus != start) { + device_printf(dev, + "bus number %d does not match start of decoded range %ju\n", + sc->ap_bus, (uintmax_t)start); + pcib_host_res_free(dev, &sc->ap_host_res); + return (ENXIO); + } } #else /* From owner-svn-src-all@freebsd.org Fri Dec 23 19:42:19 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4C7DCC8D620; Fri, 23 Dec 2016 19:42:19 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id F05B8164E; Fri, 23 Dec 2016 19:42:18 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBNJgIpQ003681; Fri, 23 Dec 2016 19:42:18 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBNJgIbo003680; Fri, 23 Dec 2016 19:42:18 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201612231942.uBNJgIbo003680@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Fri, 23 Dec 2016 19:42:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r310487 - in stable: 10/sys/dev/acpica 11/sys/dev/acpica X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Dec 2016 19:42:19 -0000 Author: jhb Date: Fri Dec 23 19:42:17 2016 New Revision: 310487 URL: https://svnweb.freebsd.org/changeset/base/310487 Log: MFC 309588: Don't attach to Host-PCI bridges with a bad bus number. If the bus number assigned to a Host-PCI bridge doesn't match the first bus number in the associated producer range from _CRS, print a warning and fail to attach rather than panicking due to an assertion failure. At least one single-socket Dell machine leaves a "ghost" Host-PCI bridge device in the ACPI namespace that seems to correspond to the I/O hub in the second socket of a two-socket machine. However, the BIOS doesn't configure the settings for this "ghost" bridge correctly, nor does it have any PCI devices behind it. Modified: stable/11/sys/dev/acpica/acpi_pcib_acpi.c Directory Properties: stable/11/ (props changed) Changes in other areas also in this revision: Modified: stable/10/sys/dev/acpica/acpi_pcib_acpi.c Directory Properties: stable/10/ (props changed) Modified: stable/11/sys/dev/acpica/acpi_pcib_acpi.c ============================================================================== --- stable/11/sys/dev/acpica/acpi_pcib_acpi.c Fri Dec 23 19:30:14 2016 (r310486) +++ stable/11/sys/dev/acpica/acpi_pcib_acpi.c Fri Dec 23 19:42:17 2016 (r310487) @@ -488,10 +488,17 @@ acpi_pcib_acpi_attach(device_t dev) pci_domain_release_bus(sc->ap_segment, dev, rid, bus_res); } } else { -#ifdef INVARIANTS - if (first_decoded_bus(sc, &start) == 0) - KASSERT(start == sc->ap_bus, ("bus number mismatch")); -#endif + /* + * Require the bus number from _BBN to match the start of any + * decoded range. + */ + if (first_decoded_bus(sc, &start) == 0 && sc->ap_bus != start) { + device_printf(dev, + "bus number %d does not match start of decoded range %ju\n", + sc->ap_bus, (uintmax_t)start); + pcib_host_res_free(dev, &sc->ap_host_res); + return (ENXIO); + } } #else /* @@ -514,6 +521,9 @@ acpi_pcib_acpi_attach(device_t dev) if (device_add_child(dev, "pci", -1) == NULL) { device_printf(device_get_parent(dev), "couldn't attach pci bus\n"); +#if defined(NEW_PCIB) && defined(PCI_RES_BUS) + pcib_host_res_free(dev, &sc->ap_host_res); +#endif return (ENXIO); } return (bus_generic_attach(dev)); From owner-svn-src-all@freebsd.org Fri Dec 23 20:14:07 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2B92DC8DDE4; Fri, 23 Dec 2016 20:14:07 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id CACA05E8; Fri, 23 Dec 2016 20:14:06 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBNKE67c015811; Fri, 23 Dec 2016 20:14:06 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBNKE5O8015808; Fri, 23 Dec 2016 20:14:05 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201612232014.uBNKE5O8015808@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Fri, 23 Dec 2016 20:14:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310488 - in head/sys/dev/mlx4: mlx4_core mlx4_ib X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Dec 2016 20:14:07 -0000 Author: emaste Date: Fri Dec 23 20:14:05 2016 New Revision: 310488 URL: https://svnweb.freebsd.org/changeset/base/310488 Log: mlx(4): remove date from log message Further to r310425, go one step further and just remove the date. Reviewed by: hselasky Differential Revision: https://reviews.freebsd.org/D8888 Modified: head/sys/dev/mlx4/mlx4_core/mlx4.h head/sys/dev/mlx4/mlx4_core/mlx4_main.c head/sys/dev/mlx4/mlx4_ib/mlx4_ib_main.c Modified: head/sys/dev/mlx4/mlx4_core/mlx4.h ============================================================================== --- head/sys/dev/mlx4/mlx4_core/mlx4.h Fri Dec 23 19:42:17 2016 (r310487) +++ head/sys/dev/mlx4/mlx4_core/mlx4.h Fri Dec 23 20:14:05 2016 (r310488) @@ -52,7 +52,6 @@ #define DRV_NAME "mlx4_core" #define PFX DRV_NAME ": " #define DRV_VERSION "2.1.6" -#define DRV_RELDATE "Sep 30 2016" #define DRV_STACK_NAME "Linux-MLNX_OFED" #define DRV_STACK_VERSION "2.1" Modified: head/sys/dev/mlx4/mlx4_core/mlx4_main.c ============================================================================== --- head/sys/dev/mlx4/mlx4_core/mlx4_main.c Fri Dec 23 19:42:17 2016 (r310487) +++ head/sys/dev/mlx4/mlx4_core/mlx4_main.c Fri Dec 23 20:14:05 2016 (r310488) @@ -174,7 +174,7 @@ MODULE_PARM_DESC(enable_64b_cqe_eqe, static char mlx4_version[] __devinitdata = DRV_NAME ": Mellanox ConnectX VPI driver v" - DRV_VERSION " (" DRV_RELDATE ")\n"; + DRV_VERSION "\n"; static int log_num_mac = 7; module_param_named(log_num_mac, log_num_mac, int, 0444); Modified: head/sys/dev/mlx4/mlx4_ib/mlx4_ib_main.c ============================================================================== --- head/sys/dev/mlx4/mlx4_ib/mlx4_ib_main.c Fri Dec 23 19:42:17 2016 (r310487) +++ head/sys/dev/mlx4/mlx4_ib/mlx4_ib_main.c Fri Dec 23 20:14:05 2016 (r310488) @@ -59,7 +59,6 @@ #define DRV_NAME MLX4_IB_DRV_NAME #define DRV_VERSION "1.0" -#define DRV_RELDATE "Sep 30 2016" #define MLX4_IB_DRIVER_PROC_DIR_NAME "driver/mlx4_ib" #define MLX4_IB_MRS_PROC_DIR_NAME "mrs" @@ -102,7 +101,7 @@ static spinlock_t dev_num_str_lock; static const char mlx4_ib_version[] = DRV_NAME ": Mellanox ConnectX InfiniBand driver v" - DRV_VERSION " (" DRV_RELDATE ")\n"; + DRV_VERSION "\n"; struct update_gid_work { struct work_struct work; From owner-svn-src-all@freebsd.org Fri Dec 23 20:59:40 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 06E7BC8EBFA; Fri, 23 Dec 2016 20:59:40 +0000 (UTC) (envelope-from adrian.chadd@gmail.com) Received: from mail-wm0-x22b.google.com (mail-wm0-x22b.google.com [IPv6:2a00:1450:400c:c09::22b]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 9AFB3F2; Fri, 23 Dec 2016 20:59:39 +0000 (UTC) (envelope-from adrian.chadd@gmail.com) Received: by mail-wm0-x22b.google.com with SMTP id k184so25605705wme.1; Fri, 23 Dec 2016 12:59:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=WwgRQobpuBvJ/QYpkFf6u3FJcLvRHfO09fWmkjspHvc=; b=Hb+Z1uiwN8ZVWPMAcwWhYsAl7Uap/QZqZQzK1grj90XJmJ6oZPzc7TIStfZqxdquSr CZv98J0Tt7Mq6skfi0twJGHiOE6A9PiTLCqb2VtR9Q4XVqzoVCVZ2gFdLc71fOM7mxLh 9CfORhnAepw/mlyWmtMbn8zwn9gzBwSN34iXcd+PWenrTBGscPzJA3n9A0AWOSCY5w8o jd843vnhaWPXPHCwV9w5QG8SUKUr1Uo1nk7gr/5GgLy220z4yUT6rfyvrNdqjsp0ImLL tAIo5j0wdziXy6GbshA/lYDN5i6dBPWENglEG904txnVfnQbb+pyvqQoGK2Bo9cAtxa/ Gxmw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=WwgRQobpuBvJ/QYpkFf6u3FJcLvRHfO09fWmkjspHvc=; b=AvpIkKrcwRqfrgKt6pLQtQ/eBamLEfcbMM7aRulQlav0xQEUDEgW8/6nNPg4jsPmka oq5/LFwmPQP6GscZuHR13p/0s6kLaX77tpXc4nPdS2+BGgs0/aHFksegXRHN+jRnaXoh SP7eCKJ6Kqam8hfJKCaKRgeanN7wHAIVnFTr33A03AS5jnaph7alWCuGH3AuJuh1WY8h 7ClSIbQQjZ6Bl7xrRL5zhkbBcd/UjkQcvrhleDWq7KYrjp/l6rX1JYgvd+o+Q9XHxviQ 1N+FBd80hMlDsoc3+wWNQ0yV7+nyBxzwi1zdVTL1GP8McuH/aFaiei4TecLMVzWE4tMD gnYg== X-Gm-Message-State: AIkVDXK7LnkUHsgn7f2VMjmCcJGyJtYwaZ8okDiwbIJFyCJW9sw7XQ4TgODrtchJyT12M6tnhEmGTT30v8TyJw== X-Received: by 10.28.109.156 with SMTP id b28mr15119024wmi.116.1482526777802; Fri, 23 Dec 2016 12:59:37 -0800 (PST) MIME-Version: 1.0 Received: by 10.194.44.1 with HTTP; Fri, 23 Dec 2016 12:59:37 -0800 (PST) In-Reply-To: <1808755.8aTbUPpvbL@ralph.baldwin.cx> References: <201612230327.uBN3RBC1099442@repo.freebsd.org> <1808755.8aTbUPpvbL@ralph.baldwin.cx> From: Adrian Chadd Date: Fri, 23 Dec 2016 12:59:37 -0800 Message-ID: Subject: Re: svn commit: r310445 - in head/sys/mips: include mips To: John Baldwin Cc: "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" Content-Type: text/plain; charset=UTF-8 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Dec 2016 20:59:40 -0000 That's a ... deeep stack. :( How big is each stackframe? -adrian On 22 December 2016 at 19:49, John Baldwin wrote: > On Friday, December 23, 2016 03:27:11 AM John Baldwin wrote: >> Author: jhb >> Date: Fri Dec 23 03:27:11 2016 >> New Revision: 310445 >> URL: https://svnweb.freebsd.org/changeset/base/310445 >> >> Log: >> Teach DDB how to unwind across a kernel stack overflow. >> >> Kernel stack overflows in MIPS call panic() directly from an assembly >> handler after storing the interrupted context's registers in a >> trapframe. Rather than inferring the location of ra, sp, and pc from >> the instruction stream, recognize the pc of a kernel stack overflow >> and pull the registers from the trapframe. >> >> Sponsored by: DARPA / AFRL > > We should possibly use this same logic for other subroutines that use > trapframes. Trying to run a program that core dumps over NFS in my > qemu mips64 machine triggers the stack overflow on a kernel built with > gcc5.3 from ports. The DDB stack trace doesn't get very far: > > panic: kernel stack overflow - trapframe at 0xffffffff80699eb0 > KDB: stack backtrace: > db_trace_self+1c (?,?,?,?) ra ffffffff801620d8 sp ffffffff80699ac0 sz 16 > ffffffff801620ac+2c (?,?,?,?) ra ffffffff80357788 sp ffffffff80699ad0 sz 800 > ffffffff80357744+44 (?,?,?,?) ra ffffffff80304ff4 sp ffffffff80699df0 sz 16 > vpanic+f4 (?,?,?,?) ra ffffffff80305d84 sp ffffffff80699e00 sz 48 > panic+30 (?,ffffffff80699eb0,ffffffffffffffec,ffffffff802c901c) ra ffffffff805388bc sp ffffffff80699e30 sz 96 > MipsTLBInvalidException+360 (?,?,?,?) ra 0 sp ffffffff80699e90 sz 0 > --- Kernel Stack Overflow --- > ffffffff802c9018+4 (?,?,?,?) ra ffffffff805544e4 sp c00000002a5b5fa0 sz 96 > ffffffff80554400+e4 (?,?,?,?) ra ffffffff802c90f4 sp c00000002a5b6000 sz 48 > ffffffff802c9018+dc (?,?,?,?) ra ffffffff805563dc sp c00000002a5b6030 sz 96 > cpu_intr+248 (?,?,?,?) ra ffffffff80538110 sp c00000002a5b6090 sz 80 > MipsKernIntr+188 (?,?,?,?) ra 0 sp c00000002a5b60e0 sz 368 > pid 607 > KDB: enter: panic > > (In particular, we probably should be using the trapframe logic employed > here for MipsKernIntr.) > > I've patched kgdb to add a MIPS kernel target and taught it how to handle > trapframes, etc. (and it can cross-debug, so I used an amd64 host to examine > the dump) and it gives a more useful stack trace. Unfortunately, increasing > the kstack size on MIPS as a workaround for this issue seems to be very > hard as the code in cpu_switch() hard codes exactly two TLB entries to cover > the kernel stack and PCB to avoid TLB faults during a context switch. I think > if you create a kthread with a non-default kstack size on MIPS it's probably > a ticking time bomb in that you might get a TLB miss when accessing the pcb. > > savectx () at /usr/home/john/work/git/freebsd/sys/mips/mips/swtch.S:171 > 171 SAVE_U_PCB_CONTEXT(ra, PCB_REG_PC, a0) > (kgdb) where > #0 savectx () at /usr/home/john/work/git/freebsd/sys/mips/mips/swtch.S:171 > #1 0xffffffff80304dfc in doadump (textdump=textdump@entry=0) > at /usr/home/john/work/git/freebsd/sys/kern/kern_shutdown.c:297 > #2 0xffffffff8015d868 in db_dump (dummy=, > dummy2=, dummy3=, dummy4=) > at /usr/home/john/work/git/freebsd/sys/ddb/db_command.c:546 > #3 0xffffffff8015e474 in db_command ( > last_cmdp=last_cmdp@entry=0xffffffff8069e778 , > cmd_table=, > cmd_table@entry=0xffffffff8069e730 , dopager=dopager@entry=1) > at /usr/home/john/work/git/freebsd/sys/ddb/db_command.c:453 > #4 0xffffffff8015eab8 in db_command_loop () > at /usr/home/john/work/git/freebsd/sys/ddb/db_command.c:506 > #5 0xffffffff80162040 in db_trap (type=, code=) > at /usr/home/john/work/git/freebsd/sys/ddb/db_main.c:248 > #6 0xffffffff803583e8 in kdb_trap (type=type@entry=9, code=code@entry=0, > tf=tf@entry=0xffffffff80699ca0 ) > at /usr/home/john/work/git/freebsd/sys/kern/subr_kdb.c:654 > #7 0xffffffff8054ba10 in trap (trapframe=0xffffffff80699ca0 ) > at /usr/home/john/work/git/freebsd/sys/mips/mips/trap.c:828 > #8 > #9 kdb_enter (why=0xffffffff805b6138 "panic", msg=) > at /usr/home/john/work/git/freebsd/sys/kern/subr_kdb.c:444 > #10 0xffffffff8030503c in vpanic (fmt=, > ap=ap@entry=0xffffffff80699e58 ) > at /usr/home/john/work/git/freebsd/sys/kern/kern_shutdown.c:752 > ---Type to continue, or q to quit--- > #11 0xffffffff80305d84 in panic (fmt=) > at /usr/home/john/work/git/freebsd/sys/kern/kern_shutdown.c:690 > #12 > #13 0xffffffff802c901c in intr_event_handle (ie=0x9800000000a42400, > frame=frame@entry=0x0) > at /usr/home/john/work/git/freebsd/sys/kern/kern_intr.c:1397 > #14 0xffffffff805544e4 in gt_pci_intr (v=0x9800000000ab0800) > at /usr/home/john/work/git/freebsd/sys/mips/malta/gt_pci.c:236 > #15 0xffffffff802c90f4 in intr_event_handle (ie=0x9800000000a43900, > frame=frame@entry=0xc00000002a5b6100) > at /usr/home/john/work/git/freebsd/sys/kern/kern_intr.c:1436 > #16 0xffffffff805563dc in cpu_intr (tf=0xc00000002a5b6100) > at /usr/home/john/work/git/freebsd/sys/mips/mips/intr_machdep.c:264 > #17 > #18 le_pci_wrcsr (sc=0x9800000000ae9400, port=, > val=) > at /usr/home/john/work/git/freebsd/sys/dev/le/if_le_pci.c:187 > #19 0xffffffff801893e4 in am79900_start_locked (sc=0x9800000000ae9400) > at /usr/home/john/work/git/freebsd/sys/dev/le/am79900.c:594 > #20 0xffffffff8018b1c0 in lance_start (ifp=) > at /usr/home/john/work/git/freebsd/sys/dev/le/lance.c:243 > #21 0xffffffff804137e4 in if_start (ifp=ifp@entry=0x9800000000ae4800) > at /usr/home/john/work/git/freebsd/sys/net/if.c:3630 > #22 0xffffffff80413998 in if_transmit (ifp=0x9800000000ae4800, > m=) at /usr/home/john/work/git/freebsd/sys/net/if.c:3642 > #23 0xffffffff804174fc in ether_output_frame ( > ---Type to continue, or q to quit--- > ifp=ifp@entry=0x9800000000ae4800, m=0x980000000162d100) > at /usr/home/john/work/git/freebsd/sys/net/if_ethersubr.c:457 > #24 0xffffffff80417b94 in ether_output (ifp=0x9800000000ae4800, > m=0x980000000162d100, dst=0x98000000032878f0, ro=) > at /usr/home/john/work/git/freebsd/sys/net/if_ethersubr.c:429 > #25 0xffffffff8045cf28 in ip_output (m=m@entry=0x980000000162d100, > opt=, ro=0x98000000032878d0, flags=, > imo=, imo@entry=0x0, inp=) > at /usr/home/john/work/git/freebsd/sys/netinet/ip_output.c:664 > #26 0xffffffff80470348 in tcp_output (tp=0x9800000001f4f000) > at /usr/home/john/work/git/freebsd/sys/netinet/tcp_output.c:1432 > #27 0xffffffff80480d1c in tcp_usr_send (so=0x98000000032a8a20, > flags=, m=0x9800000001621a00, nam=0x0, > control=, td=0x9800000003275a60) > at /usr/home/john/work/git/freebsd/sys/netinet/tcp_usrreq.c:956 > #28 0xffffffff803a6ef8 in sosend_generic (so=0x98000000032a8a20, > addr=, uio=0x0, top=0x9800000001621a00, > control=, flags=, td=) > at /usr/home/john/work/git/freebsd/sys/kern/uipc_socket.c:1359 > #29 0xffffffff803a7060 in sosend (so=, addr=addr@entry=0x0, > uio=uio@entry=0x0, top=top@entry=0x9800000001621a00, > control=control@entry=0x0, flags=flags@entry=0, td=) > at /usr/home/john/work/git/freebsd/sys/kern/uipc_socket.c:1403 > #30 0xffffffff8049220c in clnt_vc_call (cl=, > ext=0xc00000002a5b69e8, proc=, args=0x980000000162d200, > resultsp=0xc00000002a5b6b40, utimeout=...) > ---Type to continue, or q to quit--- > at /usr/home/john/work/git/freebsd/sys/rpc/clnt_vc.c:398 > #31 0xffffffff804908a4 in clnt_reconnect_call (cl=0x9800000001630400, > ext=0xc00000002a5b69e8, proc=, args=0x980000000162d200, > resultsp=0xc00000002a5b6b40, utimeout=...) > at /usr/home/john/work/git/freebsd/sys/rpc/clnt_rc.c:271 > #32 0xffffffff801dd360 in newnfs_request (nd=0xc00000002a5b6b40, > nmp=0x980000000163b800, clp=clp@entry=0x0, nrp=0x980000000163b928, > vp=0x98000000044aa000, td=td@entry=0x9800000003275a60, > cred=cred@entry=0x9800000001670000, prog=prog@entry=100003, vers=3, > retsum=retsum@entry=0x0, toplevel=toplevel@entry=1, xidp=xidp@entry=0x0, > sep=sep@entry=0x0) > at /usr/home/john/work/git/freebsd/sys/fs/nfs/nfs_commonkrpc.c:746 > #33 0xffffffff8022c738 in nfscl_request (nd=nd@entry=0xc00000002a5b6b40, > vp=vp@entry=0x98000000044aa000, p=p@entry=0x9800000003275a60, > cred=cred@entry=0x9800000001670000, stuff=stuff@entry=0x0) > at /usr/home/john/work/git/freebsd/sys/fs/nfsclient/nfs_clport.c:951 > #34 0xffffffff802116a8 in nfsrpc_commit (vp=0x98000000044aa000, > offset=offset@entry=65536, cnt=cnt@entry=65536, > cred=cred@entry=0x9800000001670000, p=p@entry=0x9800000003275a60, > nap=nap@entry=0xc00000002a5b6cc0, > attrflagp=attrflagp@entry=0xc00000002a5b6d88, stuff=stuff@entry=0x0) > at /usr/home/john/work/git/freebsd/sys/fs/nfsclient/nfs_clrpcops.c:3640 > #35 0xffffffff80220e74 in ncl_commit (vp=vp@entry=0x98000000044aa000, > offset=offset@entry=65536, cnt=, > cred=cred@entry=0x9800000001670000, td=td@entry=0x9800000003275a60) > at /usr/home/john/work/git/freebsd/sys/fs/nfsclient/nfs_clvnops.c:2553 > ---Type to continue, or q to quit--- > #36 0xffffffff8022130c in ncl_flush (vp=0x98000000044aa000, > waitfor=, cred=cred@entry=0x0, td=0x9800000003275a60, > commit=commit@entry=1, > called_from_renewthread=called_from_renewthread@entry=0) > at /usr/home/john/work/git/freebsd/sys/fs/nfsclient/nfs_clvnops.c:2774 > #37 0xffffffff8022220c in nfs_fsync (ap=) > at /usr/home/john/work/git/freebsd/sys/fs/nfsclient/nfs_clvnops.c:2619 > #38 0xffffffff80559508 in VOP_FSYNC_APV (vop=, > a=a@entry=0xc00000002a5b6fa0) at vnode_if.c:1331 > #39 0xffffffff803bcbd4 in VOP_FSYNC (td=, > waitfor=, vp=) at vnode_if.h:549 > #40 bufsync (bo=, waitfor=) > at /usr/home/john/work/git/freebsd/sys/kern/vfs_bio.c:4605 > #41 0xffffffff803e6088 in bufobj_invalbuf (bo=bo@entry=0x98000000044aa0d0, > flags=, slpflag=, slptimeo=) > at /usr/home/john/work/git/freebsd/sys/kern/vfs_subr.c:1633 > #42 0xffffffff803e63a8 in vinvalbuf (vp=vp@entry=0x98000000044aa000, > flags=flags@entry=1, slpflag=slpflag@entry=0, slptimeo=slptimeo@entry=0) > at /usr/home/john/work/git/freebsd/sys/kern/vfs_subr.c:1711 > #43 0xffffffff8022df5c in ncl_vinvalbuf (vp=vp@entry=0x98000000044aa000, > flags=flags@entry=1, td=td@entry=0x9800000003275a60, > intrflg=, intrflg@entry=1) > at /usr/home/john/work/git/freebsd/sys/fs/nfsclient/nfs_clbio.c:1387 > #44 0xffffffff8021d5ec in nfs_setattr (ap=0xc00000002a5b7298) > at /usr/home/john/work/git/freebsd/sys/fs/nfsclient/nfs_clvnops.c:937 > #45 0xffffffff80558564 in VOP_SETATTR_APV (vop=, > ---Type to continue, or q to quit--- > a=a@entry=0xc00000002a5b7298) at vnode_if.c:799 > #46 0xffffffff80230eac in VOP_SETATTR (cred=0x9800000001670000, > vap=0xc00000002a5b71f0, vp=0x98000000044aa000) at vnode_if.h:335 > #47 ncl_write (ap=) > at /usr/home/john/work/git/freebsd/sys/fs/nfsclient/nfs_clbio.c:1280 > #48 0xffffffff80558b70 in VOP_WRITE_APV (vop=, > a=a@entry=0xc00000002a5b74f0) at vnode_if.c:1000 > #49 0xffffffff803f9708 in VOP_WRITE (cred=, > ioflag=, uio=0xc00000002a5b7690, vp=) > at vnode_if.h:413 > #50 vn_io_fault_doio (args=args@entry=0xc00000002a5b76d8, > uio=uio@entry=0xc00000002a5b7690, td=td@entry=0x9800000003275a60) > at /usr/home/john/work/git/freebsd/sys/kern/vfs_vnops.c:952 > #51 0xffffffff803f9894 in vn_io_fault1 (vp=vp@entry=0x98000000044aa000, > uio=uio@entry=0xc00000002a5b7690, args=args@entry=0xc00000002a5b76d8, > td=td@entry=0x9800000003275a60) > at /usr/home/john/work/git/freebsd/sys/kern/vfs_vnops.c:1060 > #52 0xffffffff803fca30 in vn_rdwr (rw=rw@entry=UIO_WRITE, > vp=vp@entry=0x98000000044aa000, base=base@entry=0x160085000, > len=len@entry=16384, offset=offset@entry=131072, > segflg=segflg@entry=UIO_USERSPACE, ioflg=ioflg@entry=16641, > active_cred=active_cred@entry=0x9800000001670000, > file_cred=file_cred@entry=0x0, aresid=aresid@entry=0xc00000002a5b77a0, > td=td@entry=0x9800000003275a60) > at /usr/home/john/work/git/freebsd/sys/kern/vfs_vnops.c:576 > #53 0xffffffff803fcc68 in vn_rdwr_inchunks (rw=rw@entry=UIO_WRITE, > ---Type to continue, or q to quit--- > vp=0x98000000044aa000, base=0x160085000, len=16384, offset=131072, > offset@entry=98304, segflg=segflg@entry=UIO_USERSPACE, > ioflg=ioflg@entry=16641, active_cred=0x9800000001670000, file_cred=0x0, > aresid=aresid@entry=0x0, td=0x9800000003275a60) > at /usr/home/john/work/git/freebsd/sys/kern/vfs_vnops.c:641 > #54 0xffffffff802954f4 in core_write (seg=UIO_USERSPACE, offset=98304, > len=, base=, p=0xc00000002a5b7860) > at /usr/home/john/work/git/freebsd/sys/kern/imgact_elf.c:1229 > #55 core_output (tmpbuf=0x0, p=0xc00000002a5b7860, offset=98304, > len=, base=) > at /usr/home/john/work/git/freebsd/sys/kern/imgact_elf.c:1243 > #56 elf64_coredump (td=, vp=0x98000000044aa000, > limit=9223372036854775807, flags=) > at /usr/home/john/work/git/freebsd/sys/kern/imgact_elf.c:1384 > #57 0xffffffff8030805c in coredump (td=td@entry=0x9800000003275a60) > at /usr/home/john/work/git/freebsd/sys/kern/kern_sig.c:3477 > #58 0xffffffff8030b818 in sigexit (td=td@entry=0x9800000003275a60, > sig=sig@entry=7) > at /usr/home/john/work/git/freebsd/sys/kern/kern_sig.c:3072 > #59 0xffffffff8030c19c in postsig (sig=sig@entry=7) > at /usr/home/john/work/git/freebsd/sys/kern/kern_sig.c:2985 > #60 0xffffffff8036f13c in ast (framep=0xc00000002a5b7d30) > at /usr/home/john/work/git/freebsd/sys/kern/subr_trap.c:314 > #61 > #62 0x0000000120000ff4 in ?? () > Backtrace stopped: previous frame identical to this frame (corrupt stack?) > > -- > John Baldwin > From owner-svn-src-all@freebsd.org Fri Dec 23 21:56:10 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 41BCFC8EB8C; Fri, 23 Dec 2016 21:56:10 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 029E51E4A; Fri, 23 Dec 2016 21:56:09 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBNLu9XM056454; Fri, 23 Dec 2016 21:56:09 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBNLu9Bt056452; Fri, 23 Dec 2016 21:56:09 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201612232156.uBNLu9Bt056452@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Fri, 23 Dec 2016 21:56:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310489 - head/sys/cam/scsi X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Dec 2016 21:56:10 -0000 Author: mav Date: Fri Dec 23 21:56:08 2016 New Revision: 310489 URL: https://svnweb.freebsd.org/changeset/base/310489 Log: Implement printing forwarded sense data. MFC after: 2 weeks Modified: head/sys/cam/scsi/scsi_all.c head/sys/cam/scsi/scsi_all.h Modified: head/sys/cam/scsi/scsi_all.c ============================================================================== --- head/sys/cam/scsi/scsi_all.c Fri Dec 23 20:14:05 2016 (r310488) +++ head/sys/cam/scsi/scsi_all.c Fri Dec 23 21:56:08 2016 (r310489) @@ -4711,6 +4711,26 @@ scsi_sense_ata_sbuf(struct sbuf *sb, str sbuf_printf(sb, "device: %02x, ", res->device); } +void +scsi_sense_forwarded_sbuf(struct sbuf *sb, struct scsi_sense_data *sense, + u_int sense_len, uint8_t *cdb, int cdb_len, + struct scsi_inquiry_data *inq_data, + struct scsi_sense_desc_header *header) +{ + struct scsi_sense_forwarded *forwarded; + const char *sense_key_desc; + const char *asc_desc; + int error_code, sense_key, asc, ascq; + + forwarded = (struct scsi_sense_forwarded *)header; + scsi_extract_sense_len((struct scsi_sense_data *)forwarded->sense_data, + forwarded->length - 2, &error_code, &sense_key, &asc, &ascq, 1); + scsi_sense_desc(sense_key, asc, ascq, NULL, &sense_key_desc, &asc_desc); + + sbuf_printf(sb, "Forwarded sense: %s asc:%x,%x (%s): ", + sense_key_desc, asc, ascq, asc_desc); +} + /* * Generic sense descriptor printing routine. This is used when we have * not yet implemented a specific printing routine for this descriptor. @@ -4758,7 +4778,8 @@ struct scsi_sense_desc_printer { {SSD_DESC_STREAM, scsi_sense_stream_sbuf}, {SSD_DESC_BLOCK, scsi_sense_block_sbuf}, {SSD_DESC_ATA, scsi_sense_ata_sbuf}, - {SSD_DESC_PROGRESS, scsi_sense_progress_sbuf} + {SSD_DESC_PROGRESS, scsi_sense_progress_sbuf}, + {SSD_DESC_FORWARDED, scsi_sense_forwarded_sbuf} }; void Modified: head/sys/cam/scsi/scsi_all.h ============================================================================== --- head/sys/cam/scsi/scsi_all.h Fri Dec 23 20:14:05 2016 (r310488) +++ head/sys/cam/scsi/scsi_all.h Fri Dec 23 21:56:08 2016 (r310489) @@ -3532,6 +3532,8 @@ struct scsi_sense_forwarded #define SSD_FORWARDED_SDS_UNK 0x00 #define SSD_FORWARDED_SDS_EXSRC 0x01 #define SSD_FORWARDED_SDS_EXDST 0x02 + uint8_t status; + uint8_t sense_data[]; }; /* @@ -3764,6 +3766,10 @@ void scsi_sense_ata_sbuf(struct sbuf *sb u_int sense_len, uint8_t *cdb, int cdb_len, struct scsi_inquiry_data *inq_data, struct scsi_sense_desc_header *header); +void scsi_sense_forwarded_sbuf(struct sbuf *sb, struct scsi_sense_data *sense, + u_int sense_len, uint8_t *cdb, int cdb_len, + struct scsi_inquiry_data *inq_data, + struct scsi_sense_desc_header *header); void scsi_sense_generic_sbuf(struct sbuf *sb, struct scsi_sense_data *sense, u_int sense_len, uint8_t *cdb, int cdb_len, struct scsi_inquiry_data *inq_data, From owner-svn-src-all@freebsd.org Fri Dec 23 22:42:16 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 54E17C8E54B; Fri, 23 Dec 2016 22:42:16 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id ECE9015A5; Fri, 23 Dec 2016 22:42:15 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBNMgF8x077260; Fri, 23 Dec 2016 22:42:15 GMT (envelope-from cy@FreeBSD.org) Received: (from cy@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBNMgEdt077255; Fri, 23 Dec 2016 22:42:14 GMT (envelope-from cy@FreeBSD.org) Message-Id: <201612232242.uBNMgEdt077255@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cy set sender to cy@FreeBSD.org using -f From: Cy Schubert Date: Fri, 23 Dec 2016 22:42:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r310490 - in stable: 10/contrib/amd 10/contrib/amd/amd 10/contrib/amd/amq 10/contrib/amd/conf/checkmount 10/contrib/amd/conf/mtab 10/contrib/amd/conf/nfs_prot 10/contrib/amd/conf/transp... X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Dec 2016 22:42:16 -0000 Author: cy Date: Fri Dec 23 22:42:14 2016 New Revision: 310490 URL: https://svnweb.freebsd.org/changeset/base/310490 Log: MFC r308493, r308619: Update amd from am-utils 6.1.5 to 6.2. Used extensively on my network over the past ten weeks. Reviewed by: pfg, brooks Suggested by: pfg Obtained from: ftp://ftp.am-utils.org/pub/am-utils/ Relnotes: yes Differential Revision: D8405 Added: stable/11/contrib/amd/amd/info_sun.c - copied unchanged from r308493, head/contrib/amd/amd/info_sun.c stable/11/contrib/amd/amd/ops_ext.c - copied unchanged from r308493, head/contrib/amd/amd/ops_ext.c stable/11/contrib/amd/amd/ops_lustre.c - copied unchanged from r308493, head/contrib/amd/amd/ops_lustre.c stable/11/contrib/amd/amd/ops_nfs4.c - copied unchanged from r308493, head/contrib/amd/amd/ops_nfs4.c stable/11/contrib/amd/amd/ops_udf.c - copied unchanged from r308493, head/contrib/amd/amd/ops_udf.c stable/11/contrib/amd/amd/sun2amd.8 - copied unchanged from r308493, head/contrib/amd/amd/sun2amd.8 stable/11/contrib/amd/amd/sun2amd.c - copied unchanged from r308493, head/contrib/amd/amd/sun2amd.c stable/11/contrib/amd/amd/sun_map.c - copied unchanged from r308493, head/contrib/amd/amd/sun_map.c stable/11/contrib/amd/amd/sun_map.h - copied unchanged from r308493, head/contrib/amd/amd/sun_map.h stable/11/contrib/amd/amd/sun_map_parse.y - copied unchanged from r308493, head/contrib/amd/amd/sun_map_parse.y stable/11/contrib/amd/amd/sun_map_tok.l - copied unchanged from r308493, head/contrib/amd/amd/sun_map_tok.l stable/11/contrib/amd/amd/test1.sh - copied unchanged from r308493, head/contrib/amd/amd/test1.sh stable/11/contrib/amd/fsinfo/null_gram.c - copied unchanged from r308493, head/contrib/amd/fsinfo/null_gram.c stable/11/contrib/amd/fsinfo/null_gram.h - copied unchanged from r308493, head/contrib/amd/fsinfo/null_gram.h stable/11/contrib/amd/fsinfo/null_gram.y - copied unchanged from r308493, head/contrib/amd/fsinfo/null_gram.y stable/11/contrib/amd/fsinfo/null_lex.c - copied unchanged from r308493, head/contrib/amd/fsinfo/null_lex.c stable/11/contrib/amd/fsinfo/null_lex.l - copied unchanged from r308493, head/contrib/amd/fsinfo/null_lex.l stable/11/contrib/amd/include/nfs_common.h - copied unchanged from r308493, head/contrib/amd/include/nfs_common.h Modified: stable/11/contrib/amd/AUTHORS stable/11/contrib/amd/BUGS stable/11/contrib/amd/COPYING stable/11/contrib/amd/ChangeLog stable/11/contrib/amd/FAQ stable/11/contrib/amd/INSTALL stable/11/contrib/amd/MIRRORS.html stable/11/contrib/amd/MIRRORS.txt stable/11/contrib/amd/NEWS stable/11/contrib/amd/README stable/11/contrib/amd/README.attrcache stable/11/contrib/amd/README.ldap stable/11/contrib/amd/README.y2k stable/11/contrib/amd/amd/am_ops.c stable/11/contrib/amd/amd/amd.8 stable/11/contrib/amd/amd/amd.c stable/11/contrib/amd/amd/amd.h stable/11/contrib/amd/amd/amfs_auto.c stable/11/contrib/amd/amd/amfs_direct.c stable/11/contrib/amd/amd/amfs_error.c stable/11/contrib/amd/amd/amfs_generic.c stable/11/contrib/amd/amd/amfs_host.c stable/11/contrib/amd/amd/amfs_link.c stable/11/contrib/amd/amd/amfs_linkx.c stable/11/contrib/amd/amd/amfs_nfsl.c stable/11/contrib/amd/amd/amfs_nfsx.c stable/11/contrib/amd/amd/amfs_program.c stable/11/contrib/amd/amd/amfs_root.c stable/11/contrib/amd/amd/amfs_toplvl.c stable/11/contrib/amd/amd/amfs_union.c stable/11/contrib/amd/amd/amq_subr.c stable/11/contrib/amd/amd/amq_svc.c stable/11/contrib/amd/amd/autil.c stable/11/contrib/amd/amd/clock.c stable/11/contrib/amd/amd/conf.c stable/11/contrib/amd/amd/conf_parse.y stable/11/contrib/amd/amd/conf_tok.l stable/11/contrib/amd/amd/get_args.c stable/11/contrib/amd/amd/info_exec.c stable/11/contrib/amd/amd/info_file.c stable/11/contrib/amd/amd/info_hesiod.c stable/11/contrib/amd/amd/info_ldap.c stable/11/contrib/amd/amd/info_ndbm.c stable/11/contrib/amd/amd/info_nis.c stable/11/contrib/amd/amd/info_nisplus.c stable/11/contrib/amd/amd/info_passwd.c stable/11/contrib/amd/amd/info_union.c stable/11/contrib/amd/amd/map.c stable/11/contrib/amd/amd/mapc.c stable/11/contrib/amd/amd/mntfs.c stable/11/contrib/amd/amd/nfs_prot_svc.c stable/11/contrib/amd/amd/nfs_start.c stable/11/contrib/amd/amd/nfs_subr.c stable/11/contrib/amd/amd/ops_TEMPLATE.c stable/11/contrib/amd/amd/ops_cachefs.c stable/11/contrib/amd/amd/ops_cdfs.c stable/11/contrib/amd/amd/ops_efs.c stable/11/contrib/amd/amd/ops_lofs.c stable/11/contrib/amd/amd/ops_mfs.c stable/11/contrib/amd/amd/ops_nfs.c stable/11/contrib/amd/amd/ops_nfs3.c stable/11/contrib/amd/amd/ops_nullfs.c stable/11/contrib/amd/amd/ops_pcfs.c stable/11/contrib/amd/amd/ops_tfs.c stable/11/contrib/amd/amd/ops_tmpfs.c stable/11/contrib/amd/amd/ops_ufs.c stable/11/contrib/amd/amd/ops_umapfs.c stable/11/contrib/amd/amd/ops_unionfs.c stable/11/contrib/amd/amd/ops_xfs.c stable/11/contrib/amd/amd/opts.c stable/11/contrib/amd/amd/readdir.c stable/11/contrib/amd/amd/restart.c stable/11/contrib/amd/amd/rpc_fwd.c stable/11/contrib/amd/amd/sched.c stable/11/contrib/amd/amd/srvr_amfs_auto.c stable/11/contrib/amd/amd/srvr_nfs.c stable/11/contrib/amd/amq/amq.8 stable/11/contrib/amd/amq/amq.c stable/11/contrib/amd/amq/amq.h stable/11/contrib/amd/amq/amq_clnt.c stable/11/contrib/amd/amq/amq_xdr.c stable/11/contrib/amd/amq/pawd.1 stable/11/contrib/amd/amq/pawd.c stable/11/contrib/amd/bootstrap stable/11/contrib/amd/conf/checkmount/checkmount_bsd44.c stable/11/contrib/amd/conf/mtab/mtab_bsd.c stable/11/contrib/amd/conf/nfs_prot/nfs_prot_freebsd2.h stable/11/contrib/amd/conf/nfs_prot/nfs_prot_freebsd3.h stable/11/contrib/amd/conf/transp/transp_sockets.c stable/11/contrib/amd/conf/umount/umount_bsd44.c stable/11/contrib/amd/doc/am-utils.texi stable/11/contrib/amd/doc/stamp-vti stable/11/contrib/amd/doc/texinfo.tex stable/11/contrib/amd/doc/version.texi stable/11/contrib/amd/fixmount/fixmount.8 stable/11/contrib/amd/fixmount/fixmount.c stable/11/contrib/amd/fsinfo/fsi_analyze.c stable/11/contrib/amd/fsinfo/fsi_data.h stable/11/contrib/amd/fsinfo/fsi_dict.c stable/11/contrib/amd/fsinfo/fsi_gram.y stable/11/contrib/amd/fsinfo/fsi_lex.l stable/11/contrib/amd/fsinfo/fsi_util.c stable/11/contrib/amd/fsinfo/fsinfo.8 stable/11/contrib/amd/fsinfo/fsinfo.c stable/11/contrib/amd/fsinfo/fsinfo.h stable/11/contrib/amd/fsinfo/wr_atab.c stable/11/contrib/amd/fsinfo/wr_bparam.c stable/11/contrib/amd/fsinfo/wr_dumpset.c stable/11/contrib/amd/fsinfo/wr_exportfs.c stable/11/contrib/amd/fsinfo/wr_fstab.c stable/11/contrib/amd/hlfsd/hlfsd.8 stable/11/contrib/amd/hlfsd/hlfsd.c stable/11/contrib/amd/hlfsd/hlfsd.h stable/11/contrib/amd/hlfsd/homedir.c stable/11/contrib/amd/hlfsd/nfs_prot_svc.c stable/11/contrib/amd/hlfsd/stubs.c stable/11/contrib/amd/include/am_compat.h stable/11/contrib/amd/include/am_defs.h stable/11/contrib/amd/include/am_utils.h stable/11/contrib/amd/include/am_xdr_func.h stable/11/contrib/amd/include/amq_defs.h stable/11/contrib/amd/include/mount_headers1.h stable/11/contrib/amd/include/mount_headers2.h stable/11/contrib/amd/ldap-id.ms stable/11/contrib/amd/ldap-id.txt stable/11/contrib/amd/libamu/amu.h stable/11/contrib/amd/libamu/hasmntopt.c stable/11/contrib/amd/libamu/misc_rpc.c stable/11/contrib/amd/libamu/mount_fs.c stable/11/contrib/amd/libamu/mtab.c stable/11/contrib/amd/libamu/nfs_prot_xdr.c stable/11/contrib/amd/libamu/strerror.c stable/11/contrib/amd/libamu/strutil.c stable/11/contrib/amd/libamu/wire.c stable/11/contrib/amd/libamu/xdr_func.c stable/11/contrib/amd/libamu/xutil.c stable/11/contrib/amd/mk-amd-map/mk-amd-map.8 stable/11/contrib/amd/mk-amd-map/mk-amd-map.c stable/11/contrib/amd/scripts/amd.conf-sample stable/11/contrib/amd/scripts/amd.conf.5 stable/11/contrib/amd/scripts/automount2amd.8 stable/11/contrib/amd/scripts/fixrmtab.in stable/11/contrib/amd/vers.m4 stable/11/contrib/amd/wire-test/wire-test.8 stable/11/contrib/amd/wire-test/wire-test.c stable/11/usr.sbin/amd/amd/Makefile stable/11/usr.sbin/amd/fsinfo/Makefile stable/11/usr.sbin/amd/include/config.h Directory Properties: stable/11/ (props changed) Changes in other areas also in this revision: Added: stable/10/contrib/amd/amd/info_sun.c - copied unchanged from r308493, head/contrib/amd/amd/info_sun.c stable/10/contrib/amd/amd/ops_ext.c - copied unchanged from r308493, head/contrib/amd/amd/ops_ext.c stable/10/contrib/amd/amd/ops_lustre.c - copied unchanged from r308493, head/contrib/amd/amd/ops_lustre.c stable/10/contrib/amd/amd/ops_nfs4.c - copied unchanged from r308493, head/contrib/amd/amd/ops_nfs4.c stable/10/contrib/amd/amd/ops_udf.c - copied unchanged from r308493, head/contrib/amd/amd/ops_udf.c stable/10/contrib/amd/amd/sun2amd.8 - copied unchanged from r308493, head/contrib/amd/amd/sun2amd.8 stable/10/contrib/amd/amd/sun2amd.c - copied unchanged from r308493, head/contrib/amd/amd/sun2amd.c stable/10/contrib/amd/amd/sun_map.c - copied unchanged from r308493, head/contrib/amd/amd/sun_map.c stable/10/contrib/amd/amd/sun_map.h - copied unchanged from r308493, head/contrib/amd/amd/sun_map.h stable/10/contrib/amd/amd/sun_map_parse.y - copied unchanged from r308493, head/contrib/amd/amd/sun_map_parse.y stable/10/contrib/amd/amd/sun_map_tok.l - copied unchanged from r308493, head/contrib/amd/amd/sun_map_tok.l stable/10/contrib/amd/amd/test1.sh - copied unchanged from r308493, head/contrib/amd/amd/test1.sh stable/10/contrib/amd/fsinfo/null_gram.c - copied unchanged from r308493, head/contrib/amd/fsinfo/null_gram.c stable/10/contrib/amd/fsinfo/null_gram.h - copied unchanged from r308493, head/contrib/amd/fsinfo/null_gram.h stable/10/contrib/amd/fsinfo/null_gram.y - copied unchanged from r308493, head/contrib/amd/fsinfo/null_gram.y stable/10/contrib/amd/fsinfo/null_lex.c - copied unchanged from r308493, head/contrib/amd/fsinfo/null_lex.c stable/10/contrib/amd/fsinfo/null_lex.l - copied unchanged from r308493, head/contrib/amd/fsinfo/null_lex.l stable/10/contrib/amd/include/nfs_common.h - copied unchanged from r308493, head/contrib/amd/include/nfs_common.h Modified: stable/10/contrib/amd/AUTHORS stable/10/contrib/amd/BUGS stable/10/contrib/amd/COPYING stable/10/contrib/amd/ChangeLog stable/10/contrib/amd/FAQ stable/10/contrib/amd/INSTALL stable/10/contrib/amd/MIRRORS.html stable/10/contrib/amd/MIRRORS.txt stable/10/contrib/amd/NEWS stable/10/contrib/amd/README stable/10/contrib/amd/README.attrcache stable/10/contrib/amd/README.ldap stable/10/contrib/amd/README.y2k stable/10/contrib/amd/amd/am_ops.c stable/10/contrib/amd/amd/amd.8 stable/10/contrib/amd/amd/amd.c stable/10/contrib/amd/amd/amd.h stable/10/contrib/amd/amd/amfs_auto.c stable/10/contrib/amd/amd/amfs_direct.c stable/10/contrib/amd/amd/amfs_error.c stable/10/contrib/amd/amd/amfs_generic.c stable/10/contrib/amd/amd/amfs_host.c stable/10/contrib/amd/amd/amfs_link.c stable/10/contrib/amd/amd/amfs_linkx.c stable/10/contrib/amd/amd/amfs_nfsl.c stable/10/contrib/amd/amd/amfs_nfsx.c stable/10/contrib/amd/amd/amfs_program.c stable/10/contrib/amd/amd/amfs_root.c stable/10/contrib/amd/amd/amfs_toplvl.c stable/10/contrib/amd/amd/amfs_union.c stable/10/contrib/amd/amd/amq_subr.c stable/10/contrib/amd/amd/amq_svc.c stable/10/contrib/amd/amd/autil.c stable/10/contrib/amd/amd/clock.c stable/10/contrib/amd/amd/conf.c stable/10/contrib/amd/amd/conf_parse.y stable/10/contrib/amd/amd/conf_tok.l stable/10/contrib/amd/amd/get_args.c stable/10/contrib/amd/amd/info_exec.c stable/10/contrib/amd/amd/info_file.c stable/10/contrib/amd/amd/info_hesiod.c stable/10/contrib/amd/amd/info_ldap.c stable/10/contrib/amd/amd/info_ndbm.c stable/10/contrib/amd/amd/info_nis.c stable/10/contrib/amd/amd/info_nisplus.c stable/10/contrib/amd/amd/info_passwd.c stable/10/contrib/amd/amd/info_union.c stable/10/contrib/amd/amd/map.c stable/10/contrib/amd/amd/mapc.c stable/10/contrib/amd/amd/mntfs.c stable/10/contrib/amd/amd/nfs_prot_svc.c stable/10/contrib/amd/amd/nfs_start.c stable/10/contrib/amd/amd/nfs_subr.c stable/10/contrib/amd/amd/ops_TEMPLATE.c stable/10/contrib/amd/amd/ops_cachefs.c stable/10/contrib/amd/amd/ops_cdfs.c stable/10/contrib/amd/amd/ops_efs.c stable/10/contrib/amd/amd/ops_lofs.c stable/10/contrib/amd/amd/ops_mfs.c stable/10/contrib/amd/amd/ops_nfs.c stable/10/contrib/amd/amd/ops_nfs3.c stable/10/contrib/amd/amd/ops_nullfs.c stable/10/contrib/amd/amd/ops_pcfs.c stable/10/contrib/amd/amd/ops_tfs.c stable/10/contrib/amd/amd/ops_tmpfs.c stable/10/contrib/amd/amd/ops_ufs.c stable/10/contrib/amd/amd/ops_umapfs.c stable/10/contrib/amd/amd/ops_unionfs.c stable/10/contrib/amd/amd/ops_xfs.c stable/10/contrib/amd/amd/opts.c stable/10/contrib/amd/amd/readdir.c stable/10/contrib/amd/amd/restart.c stable/10/contrib/amd/amd/rpc_fwd.c stable/10/contrib/amd/amd/sched.c stable/10/contrib/amd/amd/srvr_amfs_auto.c stable/10/contrib/amd/amd/srvr_nfs.c stable/10/contrib/amd/amq/amq.8 stable/10/contrib/amd/amq/amq.c stable/10/contrib/amd/amq/amq.h stable/10/contrib/amd/amq/amq_clnt.c stable/10/contrib/amd/amq/amq_xdr.c stable/10/contrib/amd/amq/pawd.1 stable/10/contrib/amd/amq/pawd.c stable/10/contrib/amd/bootstrap stable/10/contrib/amd/conf/checkmount/checkmount_bsd44.c stable/10/contrib/amd/conf/mtab/mtab_bsd.c stable/10/contrib/amd/conf/nfs_prot/nfs_prot_freebsd2.h stable/10/contrib/amd/conf/nfs_prot/nfs_prot_freebsd3.h stable/10/contrib/amd/conf/transp/transp_sockets.c stable/10/contrib/amd/conf/umount/umount_bsd44.c stable/10/contrib/amd/doc/am-utils.texi stable/10/contrib/amd/doc/stamp-vti stable/10/contrib/amd/doc/texinfo.tex stable/10/contrib/amd/doc/version.texi stable/10/contrib/amd/fixmount/fixmount.8 stable/10/contrib/amd/fixmount/fixmount.c stable/10/contrib/amd/fsinfo/fsi_analyze.c stable/10/contrib/amd/fsinfo/fsi_data.h stable/10/contrib/amd/fsinfo/fsi_dict.c stable/10/contrib/amd/fsinfo/fsi_gram.y stable/10/contrib/amd/fsinfo/fsi_lex.l stable/10/contrib/amd/fsinfo/fsi_util.c stable/10/contrib/amd/fsinfo/fsinfo.8 stable/10/contrib/amd/fsinfo/fsinfo.c stable/10/contrib/amd/fsinfo/fsinfo.h stable/10/contrib/amd/fsinfo/wr_atab.c stable/10/contrib/amd/fsinfo/wr_bparam.c stable/10/contrib/amd/fsinfo/wr_dumpset.c stable/10/contrib/amd/fsinfo/wr_exportfs.c stable/10/contrib/amd/fsinfo/wr_fstab.c stable/10/contrib/amd/hlfsd/hlfsd.8 stable/10/contrib/amd/hlfsd/hlfsd.c stable/10/contrib/amd/hlfsd/hlfsd.h stable/10/contrib/amd/hlfsd/homedir.c stable/10/contrib/amd/hlfsd/nfs_prot_svc.c stable/10/contrib/amd/hlfsd/stubs.c stable/10/contrib/amd/include/am_compat.h stable/10/contrib/amd/include/am_defs.h stable/10/contrib/amd/include/am_utils.h stable/10/contrib/amd/include/am_xdr_func.h stable/10/contrib/amd/include/amq_defs.h stable/10/contrib/amd/include/mount_headers1.h stable/10/contrib/amd/include/mount_headers2.h stable/10/contrib/amd/ldap-id.ms stable/10/contrib/amd/ldap-id.txt stable/10/contrib/amd/libamu/amu.h stable/10/contrib/amd/libamu/hasmntopt.c stable/10/contrib/amd/libamu/misc_rpc.c stable/10/contrib/amd/libamu/mount_fs.c stable/10/contrib/amd/libamu/mtab.c stable/10/contrib/amd/libamu/nfs_prot_xdr.c stable/10/contrib/amd/libamu/strerror.c stable/10/contrib/amd/libamu/strutil.c stable/10/contrib/amd/libamu/wire.c stable/10/contrib/amd/libamu/xdr_func.c stable/10/contrib/amd/libamu/xutil.c stable/10/contrib/amd/mk-amd-map/mk-amd-map.8 stable/10/contrib/amd/mk-amd-map/mk-amd-map.c stable/10/contrib/amd/scripts/amd.conf-sample stable/10/contrib/amd/scripts/amd.conf.5 stable/10/contrib/amd/scripts/automount2amd.8 stable/10/contrib/amd/scripts/fixrmtab.in stable/10/contrib/amd/vers.m4 stable/10/contrib/amd/wire-test/wire-test.8 stable/10/contrib/amd/wire-test/wire-test.c stable/10/usr.sbin/amd/amd/Makefile stable/10/usr.sbin/amd/fsinfo/Makefile stable/10/usr.sbin/amd/include/config.h Directory Properties: stable/10/ (props changed) Modified: stable/11/contrib/amd/AUTHORS ============================================================================== --- stable/11/contrib/amd/AUTHORS Fri Dec 23 21:56:08 2016 (r310489) +++ stable/11/contrib/amd/AUTHORS Fri Dec 23 22:42:14 2016 (r310490) @@ -6,22 +6,22 @@ This file lists the ones who contributed particular order, and I thank them all. This is of course not to diminish the smaller contributes of the many others. Thank you all. -* Erez Zadok +* Erez Zadok The most significant changes were made by Erez Zadok in terms of bug fixes, ports, and new features added. Erez Zadok is the current maintainer of am-utils, as of January 1997. -* Ion Badulescu +* Ion Badulescu Co-maintainer of am-utils since late 1999: Linux and Solaris autofs support, Linux NFSv3 support, major code reorganization, etc... -* Randall S. Winchester +* Randall S. Winchester May 7, 1997: contributed a special version of upl102 that included NFS V.3 support. Some of the code was contributed by Christos Zoulas -. I (Erez) ported these changes to am-utils. +. I (Erez) ported these changes to am-utils. September 12, 1997: lots of small prototype cleanups and fixes to numerous files. @@ -35,12 +35,12 @@ February 1, 1998: fixes for NetBSD to be September 4, 1999: assorted fixes for NetBSD 1.4+. -* Hannes Reinecke +* Hannes Reinecke Back in 1995, contributed code for linux. A new parser for file system specific options that only exist under linux. -* Leif Johansson +* Leif Johansson June 22, 1997: minor patch to ensure that systems without an RE library work. @@ -52,7 +52,7 @@ functions. Contributed scripts/amd2ldif August 4, 1997: info_ldap.c fixes and adding two new amd.conf ldap variables: ldap_cache_seconds and ldap_cache_maxmem. -* Andreas Stolcke +* Andreas Stolcke June 22, 1997: patches to ensure that proto= and vers= options work properly in mount tables and can be overridden. Later on, more code @@ -68,11 +68,11 @@ message. December 19, 1997: detected an FMR (Free Memory Read) in amd/mntfs.c, uninit_mntfs(). -* Danny Braniss +* Danny Braniss July, 6 1997: contributed patches to hesiod on bsdi3. -* Tom Schmidt +* Tom Schmidt July 10, 1997: Recommdation to include libgdbm if libc has no dbm_open. Patches for netgrp(host) command. Mods to aux/config.guess to recognize @@ -86,7 +86,7 @@ IFF_ROUTE instead of IFF_LOOPBACK. May 30, 2000: correct logging types for addopts/mergeopts messages. -* Daniel S. Riley +* Daniel S. Riley July 11, 1997: fixes to DU-4.0 to support string POSIX.1 signals, and struct sockaddr with sa_len field. @@ -99,15 +99,15 @@ grpid, nosuid, and actimo. August 15, 1998: fix memory leak in processing of /defaults, and avoid accessing uninitialized memory in osf1. -* Roman Hodek +* Roman Hodek July 23, 1997: Got lots of patches from the Debian Linux folks, who fixed several generic bugs, and one serious one for Linux. The latter involved using connected sockets for NFS mounts on kernels 1.3.10 and older. Roman's -work is baed on amd-upl102, and work from Ian Murdock -and Dominik Kubla . +work is baed on amd-upl102, and work from Ian Murdock +and Dominik Kubla . -* Rainer Orth +* Rainer Orth August 6, 1997: assorted fixes to support hesiod-1.3, solaris 2.4 (which I already fixed but did not release yet), and support for $LDFLAGS at @@ -132,34 +132,34 @@ mount tables in Solaris 8. February 9, 2000: new debug options hrtime (hi-res timer) and xdrtrace. bug fixes. -* Jason Thorpe +* Jason Thorpe August 25, 1997: make amd work when talking to NIS+ servers in NIS compatibility mode. Fix originally came from Matthieu Herrb -. +. -* Chris Metcalf +* Chris Metcalf August 29, 1997: patch to make amd use FQHN for NFS/RPC authentication, useful esp. for cross-domain NFS mounts. September 2, 1997: if plock() succeeded, don't display errno string. -* Enami Tsugutomo +* Enami Tsugutomo September 4, 1997: don't ping remote servers with NFS V.3 always, but V.2, regardless of client's NFS version. (conf/transp/transp_sockets.c) -* Dan Riley +* Dan Riley September 19, 1997: make sure that amd works with more secure portmappers that do not allow forwarding of RPC messages to other services. -* Wolfgang Rupprecht +* Wolfgang Rupprecht August 10, 1997: netbsd and other bsd systems have a mask flag for pcfs_args (msdos mount). -* Christos Zoulas +* Christos Zoulas September 25, 1997: fix to initialize uid/gid fields of pcfs_args_t on netbsd. @@ -181,7 +181,7 @@ TLI implementations. Patch to print ver options had been initialized, so we can print domain, host, and hostd. Linux patch to use umount2(2) if umount(2) fails. -* Bill Paul +* Bill Paul November 5, 1997: NFS v.3 support for AIX 4.2.1, which does *not* include headers for this. Bill had to guess at the right structures, field names, @@ -189,26 +189,26 @@ sizes, alignment, etc. January 15, 1999: small ldap bug fixes. -* Stefan Vogel +* Stefan Vogel November 14, 1997: typo in the subscription instructions to amd-dev. -* Guntram Wolski +* Guntram Wolski November 15, 1997: pointed out mismatching documentation for the -o option. -* Michael Hucka +* Michael Hucka January 11, 1997: pointed out reversed definition of NFS mount options vers and proto. -* Albert Chin +* Albert Chin January 12, 1998: minor bug in output of amd -H. June 23, 2005: assortment of small compile bugs on aix4, and solaris 5/6/7. -* Thomas Richter +* Thomas Richter January 13, 1998: use case insensitive comparisons for variables that need it (such as all hostname related ones, and more). @@ -216,11 +216,11 @@ it (such as all hostname related ones, a July 20, 1998: don't leak memory in the private version of yp_all (when vendor yp_all is bad). -* Fred Korz +* Fred Korz January 30, 1998: minor typo fixed to tftp example in am-utils.texi. -* Donald Buczek +* Donald Buczek March 6, 1998: correctly inherit existing NFS V.3 mounts upon restart. @@ -230,36 +230,36 @@ March 20, 1998: do not close stdout in c allow startup script to redirect it. Set a temporary secure umask(0022) before writing log file and restore it afterwards. -* Matthew Crosby +* Matthew Crosby April 20, 1998: allow arbitrary number of interfaces in wire listing. -* David O'Brien +* David O'Brien September 4, 1998: bug fix to avoid overrunning hostname buffer, and minor amd.conf man page typo correction. September 22, 1999: use more secure vsnprintf in real_plog(). -* Danny Rathjens +* Danny Rathjens October 29, 1998: swap arguments to kill(2) in amd.c. -* Mike Mitchell +* Mike Mitchell November 3, 1998: amd/nfs_subr.c (nfsproc_lookup_2_svc): try to avoid a race condition between unmounting and re-mounting an entry, by increasing the ttl of a looked up entry before unmounting it. -* Douglas K. Rand" +* Douglas K. Rand" December 3, 1998: case insensitive host name match for nfsl. -* David Wolfskill +* David Wolfskill January 28, 1999: don't turn on/off noconn option if it was already in that state. -* Jeffrey C Honig +* Jeffrey C Honig March 14, 1999: clean up more autogenerated files upon "make distclean". March 15, 1999: avoid overly verbose NIS warning even on systems that don't @@ -271,30 +271,30 @@ detection for bsdi4. September 17, 1999: fixes to expn. -* Paul Balyoz +* Paul Balyoz March 26, 1999: ensure lostaltmail displays Y2K compliant dates. -* Jon Peatfield +* Jon Peatfield March 30, 1999: turn off incomplete NFS V.3 support in HPUX 10.20. September 22, 1999: safe reloading of maps without first clearing old copies, and using cached copies if map failed to reload. -* Peter Breitenlohner +* Peter Breitenlohner July 24, 1999: patch for linux 2.2.x to work with older libc5 systems, and nis_isup mis-logic fixes. December 13, 2001: report typos in scripts/amd.conf.5. -* Dale Talcott +* Dale Talcott July 26, 1999: added NFS3 support for AIX mounting. -* Christophe Kalt +* Christophe Kalt July 14, 1999: add netgrpd() syntax function which uses FQHN. -* Andrew J. Korty +* Andrew J. Korty September 5, 1999: pawd works for type:=nfsl. -* Nick Williams +* Nick Williams September 1, 1999: bug fix for incorrect symlinks when two locations are requested simultaneously. @@ -306,38 +306,38 @@ doing rapid mounts and umounts in succes June 5, 2000: better handling of potential race-conditions during rapid u/mounts. Correctly update d_drops stats for amq -s. -* Johann Pfefferl +* Johann Pfefferl November 16, 1999: fix to ldap code so repeated calls to string2he don't corrupt the string passed. -* Amitha Perera +* Amitha Perera December 9, 1999: detect all wire() interfaces correctly. -* Steven Danz +* Steven Danz January 25, 2000: allow browsable auto maps. -* Wolfram Klaus . +* Wolfram Klaus . November 21, 2000: recognize proplist mnttab flag. -* Thomas Klausner +* Thomas Klausner November 21, 2000: lots of NetBSD fixes (many of which are generic). April 18, 2003: patch to reference am-utils info pages in man page. November 28, 2004: small fixes to typos in amd.conf(5) man page. -* Olaf Kirch +* Olaf Kirch February 1, 2001: important Linux NFS error number mapping fixed -* Ahmon Dancy +* Ahmon Dancy February 9, 2001: Apple Rhapsody/Darwin/OS X port -* Sebastien Bahloul +* Sebastien Bahloul July 3, 2001: LDAP fixes and updates to support new APIs March 27, 2002: LDAP bug and port to HPUX-11. -* Philippe Troin +* Philippe Troin July 12, 2001: Proper handling of GNU getopt, support for optionally disabling LDAP/Hesiod, fixes for the dev/nodev option on Linux. Texi documentation fix. @@ -348,65 +348,65 @@ generic mount option. July 17, 2003: pref:=null core dump fix. libgdbm portability. tcpd/librap support. And a few other things for the 6.0 branch. -* Trond Myklebust +* Trond Myklebust January 10, 2002: Proper initialization of the timeo parameter on Linux, TCP _must_ have a timeout 2 orders of magnitude larger than UDP -* George Ross +* George Ross April 29, 2002: Rework of old code, support for wildcards in LDAP queries, and an FD leak fix. Amd -A support. October 21, 2002: ldap_unbind fix for SIGPIPE, and support for LDAPv3 -protocol version parameter (with Tim Colles ). +protocol version parameter (with Tim Colles ). -* Matthias Scheler +* Matthias Scheler June 14, 2002: patch to use "xlatecookie" NFS mount option. -* Jun-ichiro itojun Hagino . +* Jun-ichiro itojun Hagino . June 11, 2002: minor fixes to support NetBSD 1.6A. -* Sean Fagan +* Sean Fagan March 14, 2003: detect and use the MNT2_GEN_OPT_AUTOMNTFS mount flag on OS X / Darwin. -* Hendrik Scholz +* Hendrik Scholz June 9, 2003: mk-amd-map should open temp db file using O_EXCL. -* Mark Davies +* Mark Davies July 14, 2003: define "xlatecookie" mnttab option if not defined (for NetBSD). Support null hesiod entries if they start with a ".". -* Eric S. Raymond +* Eric S. Raymond December 9, 2003: fix unbalanced [] typo in fsinfo man page. -* Martin Blapp +* Martin Blapp July 6, 2004: recognize fields in pcfs_args_t in FreeBSD 5. -* Dan Nelson +* Dan Nelson August 2, 2004: pawd to recognize "host" type mounts. -* Hauke Fath +* Hauke Fath August 3, 2004: pawd to recognize "linkx" type mounts. -* Michael van Elst +* Michael van Elst September 1, 2004: bug fix to avoid race condition in calls to mntctl on AIX. -* Jonathan Chen +* Jonathan Chen October 22, 2004: patch/fix to move mlock/mlockall/plock code after the fork(). June 29, 2005: core dump going off end of exported_ap[] array. September 29, 2005: patch/fix for pawd not to go into an infinite loop. October 25, 2005: patch/fix for pawd to repeatedly resolve path. -* David Rage +* David Rage January 17, 2005: prevent Amd from logging 'Read-only filesystem' errors when the mount point has an ancestor (i.e. '/') that is mounted read-only. -* Kevin Layer +* Kevin Layer January 28, 2005: basic instructions how to setup Amd on Mac OS-X. -* Dan Ottavio +* Dan Ottavio March 2, 2005: new global amd.conf option debug_mtab_file, to set the debug mtab file when using debug_options=mtab. Default has changed from "./mtab" to "/tmp/mtab" to avoid security problem. Bug fixed to ensure that Amd @@ -415,16 +415,13 @@ terminates properly even mtab file doesn * Erik Kline January 3, 2005: implementation of executable maps for Amd. -* Jim Zajkowski +* Jim Zajkowski March 14, 2005: small patch to amd2ldif. * Adam Morley January 27, 2005: synchronize what amd2ldif does vs. what the ldap.schema expects. -* Graeme Wilford +* Graeme Wilford July 4, 2005: buffer overflow in pawd. -* Steve Plite -September 22, 2005: repair reversed meaning of D_AMQ, so amq will unregister -on exit. Modified: stable/11/contrib/amd/BUGS ============================================================================== --- stable/11/contrib/amd/BUGS Fri Dec 23 21:56:08 2016 (r310489) +++ stable/11/contrib/amd/BUGS Fri Dec 23 22:42:14 2016 (r310490) @@ -1,7 +1,7 @@ LIST OF KNOWN BUGS IN AM-UTILS OR OPERATING SYSTEMS Note: report am-utils bugs via Bugzilla to https://bugzilla.am-utils.org/ or -by email to the am-utils@am-utils.org mailing list. +by email to the am-utils mailing list (see www.am-utils.org). (1) mips-sgi-irix* @@ -98,11 +98,11 @@ diff -u -r1.1 utsname.h (4) powerpc-ibm-aix4.2.1.0 -[4A] "Randall S. Winchester" reports that for amd to +[4A] "Randall S. Winchester" reports that for amd to start, you need to kill and restart rpc.mountd and possibly also make sure that nfsd is running. Normally these are not required. -[4B] "Stefan Vogel" reports that if your amq +[4B] "Stefan Vogel" reports that if your amq executable dump core unexpectedly, then it may be a bug in gcc 2.7.x. Upgrade to gcc 2.8.x or use IBM's xlC compiler. @@ -123,7 +123,7 @@ but it is not yet in the glibc-2.0.7-19 A bug in libc results in an amq binary that doesn't work; amq -v dumps core in xdr_string. There is no known fix (source code or vendor patch) at this -time. (Please let am-utils@am-utils.org know if you know of a fix.) +time. (Please let us know if you have a fix; see www.am-utils.org.) (7) *-aix4.3.2.0 Modified: stable/11/contrib/amd/COPYING ============================================================================== --- stable/11/contrib/amd/COPYING Fri Dec 23 21:56:08 2016 (r310489) +++ stable/11/contrib/amd/COPYING Fri Dec 23 22:42:14 2016 (r310490) @@ -1,4 +1,4 @@ -Copyright (c) 1997-2006 Erez Zadok +Copyright (c) 1997-2014 Erez Zadok Copyright (c) 1989 Jan-Simon Pendry Copyright (c) 1989 Imperial College of Science, Technology & Medicine Copyright (c) 1989 The Regents of the University of California. @@ -15,12 +15,7 @@ are met: 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. -3. All advertising materials mentioning features or use of this software - must display the following acknowledgment: - This product includes software developed by the University of - California, Berkeley and its contributors, as well as the Trustees of - Columbia University. -4. Neither the name of the University nor the names of its contributors +3. Neither the name of the University nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. Modified: stable/11/contrib/amd/ChangeLog ============================================================================== --- stable/11/contrib/amd/ChangeLog Fri Dec 23 21:56:08 2016 (r310489) +++ stable/11/contrib/amd/ChangeLog Fri Dec 23 22:42:14 2016 (r310490) @@ -1,14 +1,564 @@ -2006-05-11 Erez Zadok +2014-10-28 Christos Zoulas ******************************************************************* - *** Released am-utils-6.1.5 *** + *** Released am-utils-6.2 *** ******************************************************************* -2006-05-10 Erez Zadok + * add ylwrap.amd, sick and tired of patching broken ylwrap. + +2014-09-05 Christos Zoulas + + * factor out the size check for both readdir methods + (raven at themaw.net) + +2014-09-03 Christos Zoulas + + * configure test for 64 bit xdr function (raven at themaw.net) + +2014-09-01 Christos Zoulas + + * bug fix from raven at themaw.net to prevent writing v3 handle + to a v2 structure. + +2014-07-21 Christos Zoulas + + * fix permission problems with access + * auto_nfs_version = 3 now works for me. + +2014-07-20 Christos Zoulas + + * refresh some autoconf files + * force autoconf version since earlier versions don't work + * changes from raven at themaw.net to support NFSv3 for automounted + toplevel filesystems presented to the list in May. A few bug fixes + and integration changes by me. The code now works well enough to + mount the filesystem with NFSv3 and automount children but readdir + does not work yet (so no listing of automounted filesystems). + The new code is not enabled by default. To enable use + auto_nfs_version = 3 + in your configuration file. + +2014-03-26 Christos Zoulas + + From Ian Kent + + * use mktemp in scripts/fixrmtab + * fix documentatio nits + * [linux] Add ext2, ext3, ext4 specific mount options + * fix tcpwrappers (hosts.{allow,deny} problems for specific host + entries + +2014-03-20 Christos Zoulas + + + * don't background autofs umount + * avoid fh NULL dereference on umount + * handle ENOENT umount return for autofs mounts + * fix error message in get_nfs_version + * fix debug log deadlock + * [linux] retry umount on EBUSY + * handle failed umount on exit + +2014-03-09 Christos Zoulas + + * Remove BSD advertising clause. + * Remove expn program which is not used by anything + +2013-12-05 Christos Zoulas + + * Change the way we handle multiple lex scanners and yacc parsers + in a single program. Our old patch to ylwrap does not work anymore + because the bison parsers need shared symbols that start with yy + and we can't easily select which ones work. So now we use -P and + -p to let lex and yacc do the work for us. This requires a patch + to ylwrap, but it is smaller. + + +2013-12-05 Christos Zoulas + + * Change the way we handle multiple lex scanners and yacc parsers + in a single program. Our old patch to ylwrap does not work anymore + because the bison parsers need shared symbols that start with yy + and we can't easily select which ones work. So now we use -P and + -p to let lex and yacc do the work for us. This requires a patch + to ylwrap, but it is smaller. + +2013-05-14 Christos Zoulas + + * update to handle new autoconf and regen files + +2012-11-23 Christos Zoulas + + * recognize mountport=, noacl options + * simplify the bootstrap process, by forcing + all the files to be rebuild with autoreconf -f - i + +2012-10-03 Christos Zoulas + + * add missing ops_nfs4.c to the Makefile.am + +2012-09-14 Christos Zoulas + + * add locking option handling for lustre + * fix noatime, nodiratime, mandlock for linux + +2012-07-25 Christos Zoulas + + * bug fixes for lustre rhost parsing + +2012-06-27 Christos Zoulas + + * Disable 1/2-baked sun map support to avoid SIGSEGV + +2012-06-16 Christos Zoulas + + ******************************************************************* + *** Released am-utils-6.2-rc1 *** + ******************************************************************* + + * Fix libtool.m4 to work with later versions of autoconf. + * In buildall, use eval so that quoted strings work + * Centralize nfs version checking function, and introduce + new configuration variable nfs_vers_ping, which is the + max version we ping for. This is not documented yet, because + there might be a better way separate the max version we can + use vs the max version we ping for. + +2012-06-09 Christos Zoulas + + * fix issue with parsing nfsv4 security option strings + +2012-05-01 Christos Zoulas + + * Handle EPERM return from v4 file handles + in old linux kernels + +2012-03-09 Christos Zoulas + + * fix linux autofs detection + * fix wrong types in new amq mount xdr processing + +2012-01-25 Christos Zoulas + + * FreeBSD portability fixes + +2012-01-23 Christos Zoulas + + * Avoid type punned warnings + +2011-12-29 Christos Zoulas + + * fix bug I introduced in get_nfs_version that caused it to return 0 + * add direct support for ext{2,3,4} + +2011-12-15 Christos Zoulas + + * Include on linux, to grab extra mount flags + * Add support for lustre + +2011-11-28 Christos Zoulas + + * For nfsl mounts, match against either the short local + host name or the fqdn name. + +2011-10-06 Christos Zoulas + + * Add NFSv4 support (loosely based on Ramya's code). + Currently if the NFSv4 mount fails with ENOENT we fail + back to NFSv3, unless -DNO_FALLBACK. + * Replace strdup with xstrdup. It is not nice to replace + system functions with ones that behave differently. + * Add various consistency checks (caller function checks + variable for NULL, but callee does not). + * Fix error handling in various paths. + * Don't check before using XFREE(). free(NULL) works. + +2011-09-15 Christos Zoulas + + * amq -i addition (prints info about the map files) + +2011-09-14 Christos Zoulas + + * Solaris OS and compiler fixes from: + Hofmann, Frank + Sayle, Alex + - (void)&var generates warnings, removed + - __inline is invalid, changed with inline + - and other headers have extra dependendcies + ` +2011-08-11 Christos Zoulas + + * fix potential buffer overflow in expand_error() + (Richard Kettlewell). Does not seem to be exploitable. + + * simplify %option parsing to appease ancient flex. + +2011-06-21 Christos Zoulas + + * add support for linux autofs version 5 (untested) + +2011-06-18 Christos Zoulas + + * roll back to an older version of libtool that works + + * newer versions of config.guess and config.sub + + * minor fixes to buildall + +2011-05-19 Christos Zoulas + + * m4/macros/libtool.m4: for AIX AC_LANG_PROGRAM is incorrectly + used and the latest autoconf gives an error. For now just + quote it. + + * configure.in: Fedora Core 15 and RedHat 6 now don't define + af_family_t in , but in . + Include so that we get + indirectly. This caused the detection + test to fail. + +2010-11-24 Erez Zadok + + * m4/macros/os_cflags.m4: for linux, define _GNU_SOURCE (to get + definitions for O_LARGEFILE and more). + +2010-11-20 Christos Zoulas + + * Update news items, add release readme, mark as rc1 + + * Fix addopts code to work with options that are key=value + when the built-in hasmntopt() code is not used. The problem + was that the code passed "key=" to hasmntopt not "key". + +2009-12-10 Christos Zoulas + + * Copy all fields of the am_opts structure + When we introduced am_loc we also added a function to + create a duplicate of an am_opts structure. As it turns + out, that only made a partial copy of the struct and some + fields (e.g. opt_cache) was left blank in the new structure. + Unfortunately any code that was checking the options + through the mntfs structure was mislead by the partial + copy: caching was disabled completely, for example, and + since browsing relies on caching being enabled it wasn't + working either. + From: Krisztian Kovacs + + * Initialize RPC authentication flavor to AUTH_UNIX instead + of zero. RHEL 5 uses version 6 of the mount_arg structure + that includes the desired RPC authorization flavour. + Unfortunately amd initializes that value to zero, meaning + AUTH_NULL, resulting in all NFS servers denying operations. + From: Krisztian Kovacs + + * Make sure to remove nodes in the proper order when going + down. Depending on what order the nodes got created it's + possible that the parent of a node has a bigger am_mapno + (index in exported_ap[]) so that it gets freed before + its child while the child's am_parent pointer is still + pointing to the already freed block of memory. + This change makes sure that umount_exported() cleans up + all children of a node first before freeing the node. + From: Krisztian Kovacs + + * Fix Linux-specific stuff in ops_tmpfs.c + AUTOFS_TMPFS_FS_FLAGS is defined only in the Linux-specific + conf_linux.c file, so it cannot be built on Solaris. + From: Krisztian Kovacs + + * Add missing parenthesis to fix defined(XXX + From: Krisztian Kovacs + + * In the previous commit we've already made a change that + makes this code unnecessary since the node is returned + even if the backing file server is known to be down. + Since the code path is unused it should be removed. + From: Krisztian Kovacs + + * amfs_generic_lookup_child() tries to find an alternate + file server if it detects that the current one is down. + However, in the comparison used to decide if a possible + mount is the same as the current one it compares the am_loc + pointers instead of the actual mntfs pointers. Since + amfs_lookup_one_location() creates a brand new am_loc + structure for the returned mntfs structure the am_loc + pointer will be different even if the mntfs it's pointing + to is the same. + This tricks amfs_generic_lookup_child() think it has + found an alternate file server while it hasn't and thus + starts multiple racing mounts for the very same node and + mntfs. + From: Krisztian Kovacs + + * In the new am_loc scheme mounted mntfs structures still + have their mf_fo structure left intact. So when restart + creates a fake mntfs for an already mounted filesystem it + should not free mf_fo right away. + From: Krisztian Kovacs + + * Setting the error flag of the mntfs for which the share + is already mounted results in the mount point not being + removed when it times out. (Amd considers it an error + mntfs and thus umount becomse a no-op.) + From: Krisztian Kovacs + + * Right now AMD sets all timeout values to their defaults + even if you explicitly set them to zero. This patch + introduces separate flags that store if the respective + values have been set and the code path setting default + values checks these flags instead of testing the values + for zero. [Linux only] + From: Krisztian Kovacs + + * Fix mntfs related lookup/(un)mount race conditions, by + introducing a new structure linking an mntfs to a node. + From: Krisztian Kovacs + + * We have to free the buffers allocated by the XDR routines when + decoding the mount response after copying them to their final place. + From: Krisztian Kovacs + +2009-12-09 Christos Zoulas + + * Free continuation in amfs_retry() if we don't call amfs_bgmount() + Normally it's amfs_bgmount() which frees the continuation. However, if + the mount is already in progress and we're in amfs_retry() for another + node we don't try mounting the filesystem once again. Still, we have + to free the continuation as we won't get called again and thus would + leak the continuation structure and our am_loc references. + From: Krisztian Kovacs + + * Fix use-after-free and double free of mntfs private data + ops_nfs.c(nfs_init) does not clear private data pointer after free(). + This leads to use-after-free and double free in case mount() fails. + (found by valgrind) + From: Krisztian Kovacs + +2009-11-23 Christos Zoulas + + * The temporary filename buffer was leaked in lock_mtab(). + From: Krisztian Kovacs + +2009-10-27 Christos Zoulas + + * Deal with errno.h->sys/errno.h better + +2009-10-26 Christos Zoulas + + * Fix issue with autoconf 2.63 + + * Fix compile warnings for gcc-4.4.x + +2009-04-15 Christos Zoulas + + * Share the LDAP connection between different maps to save resources + on the LDAP server. (Olaf Flebbe ) + +2009-03-20 Christos Zoulas + + * Fix largefile re-definitions + + * Fix compilation error caused in previous patch + +2009-02-19 Christos Zoulas + + * Add a synchronous unmount amq rpc that will wait for the remote + filesystem to be unmounted, or return an error. Enabled by amq -uu + +2009-01-11 Erez Zadok + + * amd/ops_udf.c: don't define functions/variables which may not be + used. + + * amd/ops_tmpfs.c (mount_tmpfs): force gcc not to complain about + unused variables. + + * config.guess.long: properly support Fedora Core. + +2009-01-09 Christos Zoulas + + * Fix nfs mounts on linux 2.6.26 by explicitly initializing context. + + * Treat an empty sublink as an unset sublink; this allows us to + say sublink:=; in a spec to override the default. (This produces + Bad selector error, but it works. XXX: We need to decide how to + unset a selector. I proposed an unset keyword a while ago). + +2009-01-06 Christos Zoulas + + * re-renerate all generated files with newer versions of the + auto-tools. + + * move INSTALL to INSTALL.am-utils to avoid conflicts + + * fix incompatibilities with new m4 and new autoconf. + + * add UDF filesystem support. + + * fix NetBSD nfs file handle detection. + +2009-01-02 Christos Zoulas + + * add nocasetrans, nojoliet, rrcaseins for cd9660 filesystems + +2008-12-03 Christos Zoulas + + * allow ldap queries try a comma-separated list of servers given as: + + ldap_hostports = host1:port1,host2,host3:port3 + + original patch from Florian Geyer + +2008-09-19 Christos Zoulas + + * the auth_create gid on NetBSD is int + + * deal with lossage from flex -P + + * fix missing/incorrect prototypes + +2008-09-17 Christos Zoulas + + * fix manual page section issues (sorting, non-existant) + + * add missing forward declarations + + * avoid null pointer derefs (coverity) + + * more portable endian detection support + + * implement tmpfs support + + * use sizeof var instead of constant + + * fix yyerror declaration and definition + + * fix yy function renaming, and correct some renaming issues. + + * work around automake < 1.9 issue where ylwrap is not being run + for a single yacc or lex file. + + * NetBSD + - handle headers that need other headers to compile + - add exfs and tmpfs specific glue + - add options log, noatime, nocoredump, nodevmtime, softdep, + symperm, union + - NetBSD's new mount system call needs the size of the opaque + filesystem specific structure, but passing 0 for now works. + We would need to change a lot more code to pass the size from + the fs-specific calls, so for now punt. + - recvfrom takes socklen_t * on NetBSD + - handle newer NetBSD using statvfs + - NetBSD calls its ufs ffs + + * Linux + - Most recent kernels have trouble with trying to parse the pid + hostname and do locking. What before was a silent failure, now + there is a warning printed and the mount is rejected. This is + the simplest fix: + (http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=479884) + +2007-04-13 Erez Zadok + + * amd/sun_map.c (sun_append_str): When translating '&' from Sun + automounter maps, replace it with "${key}" in the Amd map, not + with the value of the key at the time. This way '*' maps work + too. + + * config.guess.long: don't use -q option to grep because some + systems don't support it. Bug fix for solaris. + +2007-03-11 Christos Zoulas + + * amd/opts.c (expand_op): Don't call xstrlcpy() to truncate a + string. It causes spurious xstrlcpy() syslog() errors. Use + memcpy() and explicitly terminate the string. + +2007-01-20 Erez Zadok + + * updated copyright year to 2007 on all files. + +2006-12-27 Erez Zadok + + * minor new port: ia64-hp-hpux11.23 + + * m4/macros/check_libwrap_severity.m4 (LIBS): also test if caller + needs to define rfc931_timeout. + + * amd/sun2amd.c: define rfc931_timeout and allow/deny_severity for + libwrap. + + * amd/amq_svc.c: some versions of libwrap require the caller to + define rfc931_timeout in addition to allow/deny_severity. + + * amd/amfs_toplvl.c (amfs_toplvl_init): properly detect when + forced unmount functionality exists for all systems. + + * libamu/mount_fs.c (compute_nfs_args): reset nfs_args_t->pathconf + only if field exists. + + * conf/nfs_prot/nfs_prot_hpux11.h: prevent HPUX 11.23 from + including or (TLI definitions are already + included from elsewhere). + + * configure.in: detect nfs_args_t->pathconf field. + +2006-11-27 Erez Zadok + + * doc/Makefile.am: properly publish html files using newer + text2html. + +2006-11-27 Erez Zadok + + * doc/Makefile.am: obfuscate emails in ChangeLog before it is *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@freebsd.org Fri Dec 23 22:42:16 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id DBB2AC8E550; Fri, 23 Dec 2016 22:42:16 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 7FD8B15AC; Fri, 23 Dec 2016 22:42:16 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBNMgFDe077271; Fri, 23 Dec 2016 22:42:15 GMT (envelope-from cy@FreeBSD.org) Received: (from cy@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBNMgFel077265; Fri, 23 Dec 2016 22:42:15 GMT (envelope-from cy@FreeBSD.org) Message-Id: <201612232242.uBNMgFel077265@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cy set sender to cy@FreeBSD.org using -f From: Cy Schubert Date: Fri, 23 Dec 2016 22:42:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r310490 - in stable: 10/contrib/amd 10/contrib/amd/amd 10/contrib/amd/amq 10/contrib/amd/conf/checkmount 10/contrib/amd/conf/mtab 10/contrib/amd/conf/nfs_prot 10/contrib/amd/conf/transp... X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Dec 2016 22:42:17 -0000 Author: cy Date: Fri Dec 23 22:42:14 2016 New Revision: 310490 URL: https://svnweb.freebsd.org/changeset/base/310490 Log: MFC r308493, r308619: Update amd from am-utils 6.1.5 to 6.2. Used extensively on my network over the past ten weeks. Reviewed by: pfg, brooks Suggested by: pfg Obtained from: ftp://ftp.am-utils.org/pub/am-utils/ Relnotes: yes Differential Revision: D8405 Added: stable/10/contrib/amd/amd/info_sun.c - copied unchanged from r308493, head/contrib/amd/amd/info_sun.c stable/10/contrib/amd/amd/ops_ext.c - copied unchanged from r308493, head/contrib/amd/amd/ops_ext.c stable/10/contrib/amd/amd/ops_lustre.c - copied unchanged from r308493, head/contrib/amd/amd/ops_lustre.c stable/10/contrib/amd/amd/ops_nfs4.c - copied unchanged from r308493, head/contrib/amd/amd/ops_nfs4.c stable/10/contrib/amd/amd/ops_udf.c - copied unchanged from r308493, head/contrib/amd/amd/ops_udf.c stable/10/contrib/amd/amd/sun2amd.8 - copied unchanged from r308493, head/contrib/amd/amd/sun2amd.8 stable/10/contrib/amd/amd/sun2amd.c - copied unchanged from r308493, head/contrib/amd/amd/sun2amd.c stable/10/contrib/amd/amd/sun_map.c - copied unchanged from r308493, head/contrib/amd/amd/sun_map.c stable/10/contrib/amd/amd/sun_map.h - copied unchanged from r308493, head/contrib/amd/amd/sun_map.h stable/10/contrib/amd/amd/sun_map_parse.y - copied unchanged from r308493, head/contrib/amd/amd/sun_map_parse.y stable/10/contrib/amd/amd/sun_map_tok.l - copied unchanged from r308493, head/contrib/amd/amd/sun_map_tok.l stable/10/contrib/amd/amd/test1.sh - copied unchanged from r308493, head/contrib/amd/amd/test1.sh stable/10/contrib/amd/fsinfo/null_gram.c - copied unchanged from r308493, head/contrib/amd/fsinfo/null_gram.c stable/10/contrib/amd/fsinfo/null_gram.h - copied unchanged from r308493, head/contrib/amd/fsinfo/null_gram.h stable/10/contrib/amd/fsinfo/null_gram.y - copied unchanged from r308493, head/contrib/amd/fsinfo/null_gram.y stable/10/contrib/amd/fsinfo/null_lex.c - copied unchanged from r308493, head/contrib/amd/fsinfo/null_lex.c stable/10/contrib/amd/fsinfo/null_lex.l - copied unchanged from r308493, head/contrib/amd/fsinfo/null_lex.l stable/10/contrib/amd/include/nfs_common.h - copied unchanged from r308493, head/contrib/amd/include/nfs_common.h Modified: stable/10/contrib/amd/AUTHORS stable/10/contrib/amd/BUGS stable/10/contrib/amd/COPYING stable/10/contrib/amd/ChangeLog stable/10/contrib/amd/FAQ stable/10/contrib/amd/INSTALL stable/10/contrib/amd/MIRRORS.html stable/10/contrib/amd/MIRRORS.txt stable/10/contrib/amd/NEWS stable/10/contrib/amd/README stable/10/contrib/amd/README.attrcache stable/10/contrib/amd/README.ldap stable/10/contrib/amd/README.y2k stable/10/contrib/amd/amd/am_ops.c stable/10/contrib/amd/amd/amd.8 stable/10/contrib/amd/amd/amd.c stable/10/contrib/amd/amd/amd.h stable/10/contrib/amd/amd/amfs_auto.c stable/10/contrib/amd/amd/amfs_direct.c stable/10/contrib/amd/amd/amfs_error.c stable/10/contrib/amd/amd/amfs_generic.c stable/10/contrib/amd/amd/amfs_host.c stable/10/contrib/amd/amd/amfs_link.c stable/10/contrib/amd/amd/amfs_linkx.c stable/10/contrib/amd/amd/amfs_nfsl.c stable/10/contrib/amd/amd/amfs_nfsx.c stable/10/contrib/amd/amd/amfs_program.c stable/10/contrib/amd/amd/amfs_root.c stable/10/contrib/amd/amd/amfs_toplvl.c stable/10/contrib/amd/amd/amfs_union.c stable/10/contrib/amd/amd/amq_subr.c stable/10/contrib/amd/amd/amq_svc.c stable/10/contrib/amd/amd/autil.c stable/10/contrib/amd/amd/clock.c stable/10/contrib/amd/amd/conf.c stable/10/contrib/amd/amd/conf_parse.y stable/10/contrib/amd/amd/conf_tok.l stable/10/contrib/amd/amd/get_args.c stable/10/contrib/amd/amd/info_exec.c stable/10/contrib/amd/amd/info_file.c stable/10/contrib/amd/amd/info_hesiod.c stable/10/contrib/amd/amd/info_ldap.c stable/10/contrib/amd/amd/info_ndbm.c stable/10/contrib/amd/amd/info_nis.c stable/10/contrib/amd/amd/info_nisplus.c stable/10/contrib/amd/amd/info_passwd.c stable/10/contrib/amd/amd/info_union.c stable/10/contrib/amd/amd/map.c stable/10/contrib/amd/amd/mapc.c stable/10/contrib/amd/amd/mntfs.c stable/10/contrib/amd/amd/nfs_prot_svc.c stable/10/contrib/amd/amd/nfs_start.c stable/10/contrib/amd/amd/nfs_subr.c stable/10/contrib/amd/amd/ops_TEMPLATE.c stable/10/contrib/amd/amd/ops_cachefs.c stable/10/contrib/amd/amd/ops_cdfs.c stable/10/contrib/amd/amd/ops_efs.c stable/10/contrib/amd/amd/ops_lofs.c stable/10/contrib/amd/amd/ops_mfs.c stable/10/contrib/amd/amd/ops_nfs.c stable/10/contrib/amd/amd/ops_nfs3.c stable/10/contrib/amd/amd/ops_nullfs.c stable/10/contrib/amd/amd/ops_pcfs.c stable/10/contrib/amd/amd/ops_tfs.c stable/10/contrib/amd/amd/ops_tmpfs.c stable/10/contrib/amd/amd/ops_ufs.c stable/10/contrib/amd/amd/ops_umapfs.c stable/10/contrib/amd/amd/ops_unionfs.c stable/10/contrib/amd/amd/ops_xfs.c stable/10/contrib/amd/amd/opts.c stable/10/contrib/amd/amd/readdir.c stable/10/contrib/amd/amd/restart.c stable/10/contrib/amd/amd/rpc_fwd.c stable/10/contrib/amd/amd/sched.c stable/10/contrib/amd/amd/srvr_amfs_auto.c stable/10/contrib/amd/amd/srvr_nfs.c stable/10/contrib/amd/amq/amq.8 stable/10/contrib/amd/amq/amq.c stable/10/contrib/amd/amq/amq.h stable/10/contrib/amd/amq/amq_clnt.c stable/10/contrib/amd/amq/amq_xdr.c stable/10/contrib/amd/amq/pawd.1 stable/10/contrib/amd/amq/pawd.c stable/10/contrib/amd/bootstrap stable/10/contrib/amd/conf/checkmount/checkmount_bsd44.c stable/10/contrib/amd/conf/mtab/mtab_bsd.c stable/10/contrib/amd/conf/nfs_prot/nfs_prot_freebsd2.h stable/10/contrib/amd/conf/nfs_prot/nfs_prot_freebsd3.h stable/10/contrib/amd/conf/transp/transp_sockets.c stable/10/contrib/amd/conf/umount/umount_bsd44.c stable/10/contrib/amd/doc/am-utils.texi stable/10/contrib/amd/doc/stamp-vti stable/10/contrib/amd/doc/texinfo.tex stable/10/contrib/amd/doc/version.texi stable/10/contrib/amd/fixmount/fixmount.8 stable/10/contrib/amd/fixmount/fixmount.c stable/10/contrib/amd/fsinfo/fsi_analyze.c stable/10/contrib/amd/fsinfo/fsi_data.h stable/10/contrib/amd/fsinfo/fsi_dict.c stable/10/contrib/amd/fsinfo/fsi_gram.y stable/10/contrib/amd/fsinfo/fsi_lex.l stable/10/contrib/amd/fsinfo/fsi_util.c stable/10/contrib/amd/fsinfo/fsinfo.8 stable/10/contrib/amd/fsinfo/fsinfo.c stable/10/contrib/amd/fsinfo/fsinfo.h stable/10/contrib/amd/fsinfo/wr_atab.c stable/10/contrib/amd/fsinfo/wr_bparam.c stable/10/contrib/amd/fsinfo/wr_dumpset.c stable/10/contrib/amd/fsinfo/wr_exportfs.c stable/10/contrib/amd/fsinfo/wr_fstab.c stable/10/contrib/amd/hlfsd/hlfsd.8 stable/10/contrib/amd/hlfsd/hlfsd.c stable/10/contrib/amd/hlfsd/hlfsd.h stable/10/contrib/amd/hlfsd/homedir.c stable/10/contrib/amd/hlfsd/nfs_prot_svc.c stable/10/contrib/amd/hlfsd/stubs.c stable/10/contrib/amd/include/am_compat.h stable/10/contrib/amd/include/am_defs.h stable/10/contrib/amd/include/am_utils.h stable/10/contrib/amd/include/am_xdr_func.h stable/10/contrib/amd/include/amq_defs.h stable/10/contrib/amd/include/mount_headers1.h stable/10/contrib/amd/include/mount_headers2.h stable/10/contrib/amd/ldap-id.ms stable/10/contrib/amd/ldap-id.txt stable/10/contrib/amd/libamu/amu.h stable/10/contrib/amd/libamu/hasmntopt.c stable/10/contrib/amd/libamu/misc_rpc.c stable/10/contrib/amd/libamu/mount_fs.c stable/10/contrib/amd/libamu/mtab.c stable/10/contrib/amd/libamu/nfs_prot_xdr.c stable/10/contrib/amd/libamu/strerror.c stable/10/contrib/amd/libamu/strutil.c stable/10/contrib/amd/libamu/wire.c stable/10/contrib/amd/libamu/xdr_func.c stable/10/contrib/amd/libamu/xutil.c stable/10/contrib/amd/mk-amd-map/mk-amd-map.8 stable/10/contrib/amd/mk-amd-map/mk-amd-map.c stable/10/contrib/amd/scripts/amd.conf-sample stable/10/contrib/amd/scripts/amd.conf.5 stable/10/contrib/amd/scripts/automount2amd.8 stable/10/contrib/amd/scripts/fixrmtab.in stable/10/contrib/amd/vers.m4 stable/10/contrib/amd/wire-test/wire-test.8 stable/10/contrib/amd/wire-test/wire-test.c stable/10/usr.sbin/amd/amd/Makefile stable/10/usr.sbin/amd/fsinfo/Makefile stable/10/usr.sbin/amd/include/config.h Directory Properties: stable/10/ (props changed) Changes in other areas also in this revision: Added: stable/11/contrib/amd/amd/info_sun.c - copied unchanged from r308493, head/contrib/amd/amd/info_sun.c stable/11/contrib/amd/amd/ops_ext.c - copied unchanged from r308493, head/contrib/amd/amd/ops_ext.c stable/11/contrib/amd/amd/ops_lustre.c - copied unchanged from r308493, head/contrib/amd/amd/ops_lustre.c stable/11/contrib/amd/amd/ops_nfs4.c - copied unchanged from r308493, head/contrib/amd/amd/ops_nfs4.c stable/11/contrib/amd/amd/ops_udf.c - copied unchanged from r308493, head/contrib/amd/amd/ops_udf.c stable/11/contrib/amd/amd/sun2amd.8 - copied unchanged from r308493, head/contrib/amd/amd/sun2amd.8 stable/11/contrib/amd/amd/sun2amd.c - copied unchanged from r308493, head/contrib/amd/amd/sun2amd.c stable/11/contrib/amd/amd/sun_map.c - copied unchanged from r308493, head/contrib/amd/amd/sun_map.c stable/11/contrib/amd/amd/sun_map.h - copied unchanged from r308493, head/contrib/amd/amd/sun_map.h stable/11/contrib/amd/amd/sun_map_parse.y - copied unchanged from r308493, head/contrib/amd/amd/sun_map_parse.y stable/11/contrib/amd/amd/sun_map_tok.l - copied unchanged from r308493, head/contrib/amd/amd/sun_map_tok.l stable/11/contrib/amd/amd/test1.sh - copied unchanged from r308493, head/contrib/amd/amd/test1.sh stable/11/contrib/amd/fsinfo/null_gram.c - copied unchanged from r308493, head/contrib/amd/fsinfo/null_gram.c stable/11/contrib/amd/fsinfo/null_gram.h - copied unchanged from r308493, head/contrib/amd/fsinfo/null_gram.h stable/11/contrib/amd/fsinfo/null_gram.y - copied unchanged from r308493, head/contrib/amd/fsinfo/null_gram.y stable/11/contrib/amd/fsinfo/null_lex.c - copied unchanged from r308493, head/contrib/amd/fsinfo/null_lex.c stable/11/contrib/amd/fsinfo/null_lex.l - copied unchanged from r308493, head/contrib/amd/fsinfo/null_lex.l stable/11/contrib/amd/include/nfs_common.h - copied unchanged from r308493, head/contrib/amd/include/nfs_common.h Modified: stable/11/contrib/amd/AUTHORS stable/11/contrib/amd/BUGS stable/11/contrib/amd/COPYING stable/11/contrib/amd/ChangeLog stable/11/contrib/amd/FAQ stable/11/contrib/amd/INSTALL stable/11/contrib/amd/MIRRORS.html stable/11/contrib/amd/MIRRORS.txt stable/11/contrib/amd/NEWS stable/11/contrib/amd/README stable/11/contrib/amd/README.attrcache stable/11/contrib/amd/README.ldap stable/11/contrib/amd/README.y2k stable/11/contrib/amd/amd/am_ops.c stable/11/contrib/amd/amd/amd.8 stable/11/contrib/amd/amd/amd.c stable/11/contrib/amd/amd/amd.h stable/11/contrib/amd/amd/amfs_auto.c stable/11/contrib/amd/amd/amfs_direct.c stable/11/contrib/amd/amd/amfs_error.c stable/11/contrib/amd/amd/amfs_generic.c stable/11/contrib/amd/amd/amfs_host.c stable/11/contrib/amd/amd/amfs_link.c stable/11/contrib/amd/amd/amfs_linkx.c stable/11/contrib/amd/amd/amfs_nfsl.c stable/11/contrib/amd/amd/amfs_nfsx.c stable/11/contrib/amd/amd/amfs_program.c stable/11/contrib/amd/amd/amfs_root.c stable/11/contrib/amd/amd/amfs_toplvl.c stable/11/contrib/amd/amd/amfs_union.c stable/11/contrib/amd/amd/amq_subr.c stable/11/contrib/amd/amd/amq_svc.c stable/11/contrib/amd/amd/autil.c stable/11/contrib/amd/amd/clock.c stable/11/contrib/amd/amd/conf.c stable/11/contrib/amd/amd/conf_parse.y stable/11/contrib/amd/amd/conf_tok.l stable/11/contrib/amd/amd/get_args.c stable/11/contrib/amd/amd/info_exec.c stable/11/contrib/amd/amd/info_file.c stable/11/contrib/amd/amd/info_hesiod.c stable/11/contrib/amd/amd/info_ldap.c stable/11/contrib/amd/amd/info_ndbm.c stable/11/contrib/amd/amd/info_nis.c stable/11/contrib/amd/amd/info_nisplus.c stable/11/contrib/amd/amd/info_passwd.c stable/11/contrib/amd/amd/info_union.c stable/11/contrib/amd/amd/map.c stable/11/contrib/amd/amd/mapc.c stable/11/contrib/amd/amd/mntfs.c stable/11/contrib/amd/amd/nfs_prot_svc.c stable/11/contrib/amd/amd/nfs_start.c stable/11/contrib/amd/amd/nfs_subr.c stable/11/contrib/amd/amd/ops_TEMPLATE.c stable/11/contrib/amd/amd/ops_cachefs.c stable/11/contrib/amd/amd/ops_cdfs.c stable/11/contrib/amd/amd/ops_efs.c stable/11/contrib/amd/amd/ops_lofs.c stable/11/contrib/amd/amd/ops_mfs.c stable/11/contrib/amd/amd/ops_nfs.c stable/11/contrib/amd/amd/ops_nfs3.c stable/11/contrib/amd/amd/ops_nullfs.c stable/11/contrib/amd/amd/ops_pcfs.c stable/11/contrib/amd/amd/ops_tfs.c stable/11/contrib/amd/amd/ops_tmpfs.c stable/11/contrib/amd/amd/ops_ufs.c stable/11/contrib/amd/amd/ops_umapfs.c stable/11/contrib/amd/amd/ops_unionfs.c stable/11/contrib/amd/amd/ops_xfs.c stable/11/contrib/amd/amd/opts.c stable/11/contrib/amd/amd/readdir.c stable/11/contrib/amd/amd/restart.c stable/11/contrib/amd/amd/rpc_fwd.c stable/11/contrib/amd/amd/sched.c stable/11/contrib/amd/amd/srvr_amfs_auto.c stable/11/contrib/amd/amd/srvr_nfs.c stable/11/contrib/amd/amq/amq.8 stable/11/contrib/amd/amq/amq.c stable/11/contrib/amd/amq/amq.h stable/11/contrib/amd/amq/amq_clnt.c stable/11/contrib/amd/amq/amq_xdr.c stable/11/contrib/amd/amq/pawd.1 stable/11/contrib/amd/amq/pawd.c stable/11/contrib/amd/bootstrap stable/11/contrib/amd/conf/checkmount/checkmount_bsd44.c stable/11/contrib/amd/conf/mtab/mtab_bsd.c stable/11/contrib/amd/conf/nfs_prot/nfs_prot_freebsd2.h stable/11/contrib/amd/conf/nfs_prot/nfs_prot_freebsd3.h stable/11/contrib/amd/conf/transp/transp_sockets.c stable/11/contrib/amd/conf/umount/umount_bsd44.c stable/11/contrib/amd/doc/am-utils.texi stable/11/contrib/amd/doc/stamp-vti stable/11/contrib/amd/doc/texinfo.tex stable/11/contrib/amd/doc/version.texi stable/11/contrib/amd/fixmount/fixmount.8 stable/11/contrib/amd/fixmount/fixmount.c stable/11/contrib/amd/fsinfo/fsi_analyze.c stable/11/contrib/amd/fsinfo/fsi_data.h stable/11/contrib/amd/fsinfo/fsi_dict.c stable/11/contrib/amd/fsinfo/fsi_gram.y stable/11/contrib/amd/fsinfo/fsi_lex.l stable/11/contrib/amd/fsinfo/fsi_util.c stable/11/contrib/amd/fsinfo/fsinfo.8 stable/11/contrib/amd/fsinfo/fsinfo.c stable/11/contrib/amd/fsinfo/fsinfo.h stable/11/contrib/amd/fsinfo/wr_atab.c stable/11/contrib/amd/fsinfo/wr_bparam.c stable/11/contrib/amd/fsinfo/wr_dumpset.c stable/11/contrib/amd/fsinfo/wr_exportfs.c stable/11/contrib/amd/fsinfo/wr_fstab.c stable/11/contrib/amd/hlfsd/hlfsd.8 stable/11/contrib/amd/hlfsd/hlfsd.c stable/11/contrib/amd/hlfsd/hlfsd.h stable/11/contrib/amd/hlfsd/homedir.c stable/11/contrib/amd/hlfsd/nfs_prot_svc.c stable/11/contrib/amd/hlfsd/stubs.c stable/11/contrib/amd/include/am_compat.h stable/11/contrib/amd/include/am_defs.h stable/11/contrib/amd/include/am_utils.h stable/11/contrib/amd/include/am_xdr_func.h stable/11/contrib/amd/include/amq_defs.h stable/11/contrib/amd/include/mount_headers1.h stable/11/contrib/amd/include/mount_headers2.h stable/11/contrib/amd/ldap-id.ms stable/11/contrib/amd/ldap-id.txt stable/11/contrib/amd/libamu/amu.h stable/11/contrib/amd/libamu/hasmntopt.c stable/11/contrib/amd/libamu/misc_rpc.c stable/11/contrib/amd/libamu/mount_fs.c stable/11/contrib/amd/libamu/mtab.c stable/11/contrib/amd/libamu/nfs_prot_xdr.c stable/11/contrib/amd/libamu/strerror.c stable/11/contrib/amd/libamu/strutil.c stable/11/contrib/amd/libamu/wire.c stable/11/contrib/amd/libamu/xdr_func.c stable/11/contrib/amd/libamu/xutil.c stable/11/contrib/amd/mk-amd-map/mk-amd-map.8 stable/11/contrib/amd/mk-amd-map/mk-amd-map.c stable/11/contrib/amd/scripts/amd.conf-sample stable/11/contrib/amd/scripts/amd.conf.5 stable/11/contrib/amd/scripts/automount2amd.8 stable/11/contrib/amd/scripts/fixrmtab.in stable/11/contrib/amd/vers.m4 stable/11/contrib/amd/wire-test/wire-test.8 stable/11/contrib/amd/wire-test/wire-test.c stable/11/usr.sbin/amd/amd/Makefile stable/11/usr.sbin/amd/fsinfo/Makefile stable/11/usr.sbin/amd/include/config.h Directory Properties: stable/11/ (props changed) Modified: stable/10/contrib/amd/AUTHORS ============================================================================== --- stable/10/contrib/amd/AUTHORS Fri Dec 23 21:56:08 2016 (r310489) +++ stable/10/contrib/amd/AUTHORS Fri Dec 23 22:42:14 2016 (r310490) @@ -6,22 +6,22 @@ This file lists the ones who contributed particular order, and I thank them all. This is of course not to diminish the smaller contributes of the many others. Thank you all. -* Erez Zadok +* Erez Zadok The most significant changes were made by Erez Zadok in terms of bug fixes, ports, and new features added. Erez Zadok is the current maintainer of am-utils, as of January 1997. -* Ion Badulescu +* Ion Badulescu Co-maintainer of am-utils since late 1999: Linux and Solaris autofs support, Linux NFSv3 support, major code reorganization, etc... -* Randall S. Winchester +* Randall S. Winchester May 7, 1997: contributed a special version of upl102 that included NFS V.3 support. Some of the code was contributed by Christos Zoulas -. I (Erez) ported these changes to am-utils. +. I (Erez) ported these changes to am-utils. September 12, 1997: lots of small prototype cleanups and fixes to numerous files. @@ -35,12 +35,12 @@ February 1, 1998: fixes for NetBSD to be September 4, 1999: assorted fixes for NetBSD 1.4+. -* Hannes Reinecke +* Hannes Reinecke Back in 1995, contributed code for linux. A new parser for file system specific options that only exist under linux. -* Leif Johansson +* Leif Johansson June 22, 1997: minor patch to ensure that systems without an RE library work. @@ -52,7 +52,7 @@ functions. Contributed scripts/amd2ldif August 4, 1997: info_ldap.c fixes and adding two new amd.conf ldap variables: ldap_cache_seconds and ldap_cache_maxmem. -* Andreas Stolcke +* Andreas Stolcke June 22, 1997: patches to ensure that proto= and vers= options work properly in mount tables and can be overridden. Later on, more code @@ -68,11 +68,11 @@ message. December 19, 1997: detected an FMR (Free Memory Read) in amd/mntfs.c, uninit_mntfs(). -* Danny Braniss +* Danny Braniss July, 6 1997: contributed patches to hesiod on bsdi3. -* Tom Schmidt +* Tom Schmidt July 10, 1997: Recommdation to include libgdbm if libc has no dbm_open. Patches for netgrp(host) command. Mods to aux/config.guess to recognize @@ -86,7 +86,7 @@ IFF_ROUTE instead of IFF_LOOPBACK. May 30, 2000: correct logging types for addopts/mergeopts messages. -* Daniel S. Riley +* Daniel S. Riley July 11, 1997: fixes to DU-4.0 to support string POSIX.1 signals, and struct sockaddr with sa_len field. @@ -99,15 +99,15 @@ grpid, nosuid, and actimo. August 15, 1998: fix memory leak in processing of /defaults, and avoid accessing uninitialized memory in osf1. -* Roman Hodek +* Roman Hodek July 23, 1997: Got lots of patches from the Debian Linux folks, who fixed several generic bugs, and one serious one for Linux. The latter involved using connected sockets for NFS mounts on kernels 1.3.10 and older. Roman's -work is baed on amd-upl102, and work from Ian Murdock -and Dominik Kubla . +work is baed on amd-upl102, and work from Ian Murdock +and Dominik Kubla . -* Rainer Orth +* Rainer Orth August 6, 1997: assorted fixes to support hesiod-1.3, solaris 2.4 (which I already fixed but did not release yet), and support for $LDFLAGS at @@ -132,34 +132,34 @@ mount tables in Solaris 8. February 9, 2000: new debug options hrtime (hi-res timer) and xdrtrace. bug fixes. -* Jason Thorpe +* Jason Thorpe August 25, 1997: make amd work when talking to NIS+ servers in NIS compatibility mode. Fix originally came from Matthieu Herrb -. +. -* Chris Metcalf +* Chris Metcalf August 29, 1997: patch to make amd use FQHN for NFS/RPC authentication, useful esp. for cross-domain NFS mounts. September 2, 1997: if plock() succeeded, don't display errno string. -* Enami Tsugutomo +* Enami Tsugutomo September 4, 1997: don't ping remote servers with NFS V.3 always, but V.2, regardless of client's NFS version. (conf/transp/transp_sockets.c) -* Dan Riley +* Dan Riley September 19, 1997: make sure that amd works with more secure portmappers that do not allow forwarding of RPC messages to other services. -* Wolfgang Rupprecht +* Wolfgang Rupprecht August 10, 1997: netbsd and other bsd systems have a mask flag for pcfs_args (msdos mount). -* Christos Zoulas +* Christos Zoulas September 25, 1997: fix to initialize uid/gid fields of pcfs_args_t on netbsd. @@ -181,7 +181,7 @@ TLI implementations. Patch to print ver options had been initialized, so we can print domain, host, and hostd. Linux patch to use umount2(2) if umount(2) fails. -* Bill Paul +* Bill Paul November 5, 1997: NFS v.3 support for AIX 4.2.1, which does *not* include headers for this. Bill had to guess at the right structures, field names, @@ -189,26 +189,26 @@ sizes, alignment, etc. January 15, 1999: small ldap bug fixes. -* Stefan Vogel +* Stefan Vogel November 14, 1997: typo in the subscription instructions to amd-dev. -* Guntram Wolski +* Guntram Wolski November 15, 1997: pointed out mismatching documentation for the -o option. -* Michael Hucka +* Michael Hucka January 11, 1997: pointed out reversed definition of NFS mount options vers and proto. -* Albert Chin +* Albert Chin January 12, 1998: minor bug in output of amd -H. June 23, 2005: assortment of small compile bugs on aix4, and solaris 5/6/7. -* Thomas Richter +* Thomas Richter January 13, 1998: use case insensitive comparisons for variables that need it (such as all hostname related ones, and more). @@ -216,11 +216,11 @@ it (such as all hostname related ones, a July 20, 1998: don't leak memory in the private version of yp_all (when vendor yp_all is bad). -* Fred Korz +* Fred Korz January 30, 1998: minor typo fixed to tftp example in am-utils.texi. -* Donald Buczek +* Donald Buczek March 6, 1998: correctly inherit existing NFS V.3 mounts upon restart. @@ -230,36 +230,36 @@ March 20, 1998: do not close stdout in c allow startup script to redirect it. Set a temporary secure umask(0022) before writing log file and restore it afterwards. -* Matthew Crosby +* Matthew Crosby April 20, 1998: allow arbitrary number of interfaces in wire listing. -* David O'Brien +* David O'Brien September 4, 1998: bug fix to avoid overrunning hostname buffer, and minor amd.conf man page typo correction. September 22, 1999: use more secure vsnprintf in real_plog(). -* Danny Rathjens +* Danny Rathjens October 29, 1998: swap arguments to kill(2) in amd.c. -* Mike Mitchell +* Mike Mitchell November 3, 1998: amd/nfs_subr.c (nfsproc_lookup_2_svc): try to avoid a race condition between unmounting and re-mounting an entry, by increasing the ttl of a looked up entry before unmounting it. -* Douglas K. Rand" +* Douglas K. Rand" December 3, 1998: case insensitive host name match for nfsl. -* David Wolfskill +* David Wolfskill January 28, 1999: don't turn on/off noconn option if it was already in that state. -* Jeffrey C Honig +* Jeffrey C Honig March 14, 1999: clean up more autogenerated files upon "make distclean". March 15, 1999: avoid overly verbose NIS warning even on systems that don't @@ -271,30 +271,30 @@ detection for bsdi4. September 17, 1999: fixes to expn. -* Paul Balyoz +* Paul Balyoz March 26, 1999: ensure lostaltmail displays Y2K compliant dates. -* Jon Peatfield +* Jon Peatfield March 30, 1999: turn off incomplete NFS V.3 support in HPUX 10.20. September 22, 1999: safe reloading of maps without first clearing old copies, and using cached copies if map failed to reload. -* Peter Breitenlohner +* Peter Breitenlohner July 24, 1999: patch for linux 2.2.x to work with older libc5 systems, and nis_isup mis-logic fixes. December 13, 2001: report typos in scripts/amd.conf.5. -* Dale Talcott +* Dale Talcott July 26, 1999: added NFS3 support for AIX mounting. -* Christophe Kalt +* Christophe Kalt July 14, 1999: add netgrpd() syntax function which uses FQHN. -* Andrew J. Korty +* Andrew J. Korty September 5, 1999: pawd works for type:=nfsl. -* Nick Williams +* Nick Williams September 1, 1999: bug fix for incorrect symlinks when two locations are requested simultaneously. @@ -306,38 +306,38 @@ doing rapid mounts and umounts in succes June 5, 2000: better handling of potential race-conditions during rapid u/mounts. Correctly update d_drops stats for amq -s. -* Johann Pfefferl +* Johann Pfefferl November 16, 1999: fix to ldap code so repeated calls to string2he don't corrupt the string passed. -* Amitha Perera +* Amitha Perera December 9, 1999: detect all wire() interfaces correctly. -* Steven Danz +* Steven Danz January 25, 2000: allow browsable auto maps. -* Wolfram Klaus . +* Wolfram Klaus . November 21, 2000: recognize proplist mnttab flag. -* Thomas Klausner +* Thomas Klausner November 21, 2000: lots of NetBSD fixes (many of which are generic). April 18, 2003: patch to reference am-utils info pages in man page. November 28, 2004: small fixes to typos in amd.conf(5) man page. -* Olaf Kirch +* Olaf Kirch February 1, 2001: important Linux NFS error number mapping fixed -* Ahmon Dancy +* Ahmon Dancy February 9, 2001: Apple Rhapsody/Darwin/OS X port -* Sebastien Bahloul +* Sebastien Bahloul July 3, 2001: LDAP fixes and updates to support new APIs March 27, 2002: LDAP bug and port to HPUX-11. -* Philippe Troin +* Philippe Troin July 12, 2001: Proper handling of GNU getopt, support for optionally disabling LDAP/Hesiod, fixes for the dev/nodev option on Linux. Texi documentation fix. @@ -348,65 +348,65 @@ generic mount option. July 17, 2003: pref:=null core dump fix. libgdbm portability. tcpd/librap support. And a few other things for the 6.0 branch. -* Trond Myklebust +* Trond Myklebust January 10, 2002: Proper initialization of the timeo parameter on Linux, TCP _must_ have a timeout 2 orders of magnitude larger than UDP -* George Ross +* George Ross April 29, 2002: Rework of old code, support for wildcards in LDAP queries, and an FD leak fix. Amd -A support. October 21, 2002: ldap_unbind fix for SIGPIPE, and support for LDAPv3 -protocol version parameter (with Tim Colles ). +protocol version parameter (with Tim Colles ). -* Matthias Scheler +* Matthias Scheler June 14, 2002: patch to use "xlatecookie" NFS mount option. -* Jun-ichiro itojun Hagino . +* Jun-ichiro itojun Hagino . June 11, 2002: minor fixes to support NetBSD 1.6A. -* Sean Fagan +* Sean Fagan March 14, 2003: detect and use the MNT2_GEN_OPT_AUTOMNTFS mount flag on OS X / Darwin. -* Hendrik Scholz +* Hendrik Scholz June 9, 2003: mk-amd-map should open temp db file using O_EXCL. -* Mark Davies +* Mark Davies July 14, 2003: define "xlatecookie" mnttab option if not defined (for NetBSD). Support null hesiod entries if they start with a ".". -* Eric S. Raymond +* Eric S. Raymond December 9, 2003: fix unbalanced [] typo in fsinfo man page. -* Martin Blapp +* Martin Blapp July 6, 2004: recognize fields in pcfs_args_t in FreeBSD 5. -* Dan Nelson +* Dan Nelson August 2, 2004: pawd to recognize "host" type mounts. -* Hauke Fath +* Hauke Fath August 3, 2004: pawd to recognize "linkx" type mounts. -* Michael van Elst +* Michael van Elst September 1, 2004: bug fix to avoid race condition in calls to mntctl on AIX. -* Jonathan Chen +* Jonathan Chen October 22, 2004: patch/fix to move mlock/mlockall/plock code after the fork(). June 29, 2005: core dump going off end of exported_ap[] array. September 29, 2005: patch/fix for pawd not to go into an infinite loop. October 25, 2005: patch/fix for pawd to repeatedly resolve path. -* David Rage +* David Rage January 17, 2005: prevent Amd from logging 'Read-only filesystem' errors when the mount point has an ancestor (i.e. '/') that is mounted read-only. -* Kevin Layer +* Kevin Layer January 28, 2005: basic instructions how to setup Amd on Mac OS-X. -* Dan Ottavio +* Dan Ottavio March 2, 2005: new global amd.conf option debug_mtab_file, to set the debug mtab file when using debug_options=mtab. Default has changed from "./mtab" to "/tmp/mtab" to avoid security problem. Bug fixed to ensure that Amd @@ -415,16 +415,13 @@ terminates properly even mtab file doesn * Erik Kline January 3, 2005: implementation of executable maps for Amd. -* Jim Zajkowski +* Jim Zajkowski March 14, 2005: small patch to amd2ldif. * Adam Morley January 27, 2005: synchronize what amd2ldif does vs. what the ldap.schema expects. -* Graeme Wilford +* Graeme Wilford July 4, 2005: buffer overflow in pawd. -* Steve Plite -September 22, 2005: repair reversed meaning of D_AMQ, so amq will unregister -on exit. Modified: stable/10/contrib/amd/BUGS ============================================================================== --- stable/10/contrib/amd/BUGS Fri Dec 23 21:56:08 2016 (r310489) +++ stable/10/contrib/amd/BUGS Fri Dec 23 22:42:14 2016 (r310490) @@ -1,7 +1,7 @@ LIST OF KNOWN BUGS IN AM-UTILS OR OPERATING SYSTEMS Note: report am-utils bugs via Bugzilla to https://bugzilla.am-utils.org/ or -by email to the am-utils@am-utils.org mailing list. +by email to the am-utils mailing list (see www.am-utils.org). (1) mips-sgi-irix* @@ -98,11 +98,11 @@ diff -u -r1.1 utsname.h (4) powerpc-ibm-aix4.2.1.0 -[4A] "Randall S. Winchester" reports that for amd to +[4A] "Randall S. Winchester" reports that for amd to start, you need to kill and restart rpc.mountd and possibly also make sure that nfsd is running. Normally these are not required. -[4B] "Stefan Vogel" reports that if your amq +[4B] "Stefan Vogel" reports that if your amq executable dump core unexpectedly, then it may be a bug in gcc 2.7.x. Upgrade to gcc 2.8.x or use IBM's xlC compiler. @@ -123,7 +123,7 @@ but it is not yet in the glibc-2.0.7-19 A bug in libc results in an amq binary that doesn't work; amq -v dumps core in xdr_string. There is no known fix (source code or vendor patch) at this -time. (Please let am-utils@am-utils.org know if you know of a fix.) +time. (Please let us know if you have a fix; see www.am-utils.org.) (7) *-aix4.3.2.0 Modified: stable/10/contrib/amd/COPYING ============================================================================== --- stable/10/contrib/amd/COPYING Fri Dec 23 21:56:08 2016 (r310489) +++ stable/10/contrib/amd/COPYING Fri Dec 23 22:42:14 2016 (r310490) @@ -1,4 +1,4 @@ -Copyright (c) 1997-2006 Erez Zadok +Copyright (c) 1997-2014 Erez Zadok Copyright (c) 1989 Jan-Simon Pendry Copyright (c) 1989 Imperial College of Science, Technology & Medicine Copyright (c) 1989 The Regents of the University of California. @@ -15,12 +15,7 @@ are met: 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. -3. All advertising materials mentioning features or use of this software - must display the following acknowledgment: - This product includes software developed by the University of - California, Berkeley and its contributors, as well as the Trustees of - Columbia University. -4. Neither the name of the University nor the names of its contributors +3. Neither the name of the University nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. Modified: stable/10/contrib/amd/ChangeLog ============================================================================== --- stable/10/contrib/amd/ChangeLog Fri Dec 23 21:56:08 2016 (r310489) +++ stable/10/contrib/amd/ChangeLog Fri Dec 23 22:42:14 2016 (r310490) @@ -1,14 +1,564 @@ -2006-05-11 Erez Zadok +2014-10-28 Christos Zoulas ******************************************************************* - *** Released am-utils-6.1.5 *** + *** Released am-utils-6.2 *** ******************************************************************* -2006-05-10 Erez Zadok + * add ylwrap.amd, sick and tired of patching broken ylwrap. + +2014-09-05 Christos Zoulas + + * factor out the size check for both readdir methods + (raven at themaw.net) + +2014-09-03 Christos Zoulas + + * configure test for 64 bit xdr function (raven at themaw.net) + +2014-09-01 Christos Zoulas + + * bug fix from raven at themaw.net to prevent writing v3 handle + to a v2 structure. + +2014-07-21 Christos Zoulas + + * fix permission problems with access + * auto_nfs_version = 3 now works for me. + +2014-07-20 Christos Zoulas + + * refresh some autoconf files + * force autoconf version since earlier versions don't work + * changes from raven at themaw.net to support NFSv3 for automounted + toplevel filesystems presented to the list in May. A few bug fixes + and integration changes by me. The code now works well enough to + mount the filesystem with NFSv3 and automount children but readdir + does not work yet (so no listing of automounted filesystems). + The new code is not enabled by default. To enable use + auto_nfs_version = 3 + in your configuration file. + +2014-03-26 Christos Zoulas + + From Ian Kent + + * use mktemp in scripts/fixrmtab + * fix documentatio nits + * [linux] Add ext2, ext3, ext4 specific mount options + * fix tcpwrappers (hosts.{allow,deny} problems for specific host + entries + +2014-03-20 Christos Zoulas + + + * don't background autofs umount + * avoid fh NULL dereference on umount + * handle ENOENT umount return for autofs mounts + * fix error message in get_nfs_version + * fix debug log deadlock + * [linux] retry umount on EBUSY + * handle failed umount on exit + +2014-03-09 Christos Zoulas + + * Remove BSD advertising clause. + * Remove expn program which is not used by anything + +2013-12-05 Christos Zoulas + + * Change the way we handle multiple lex scanners and yacc parsers + in a single program. Our old patch to ylwrap does not work anymore + because the bison parsers need shared symbols that start with yy + and we can't easily select which ones work. So now we use -P and + -p to let lex and yacc do the work for us. This requires a patch + to ylwrap, but it is smaller. + + +2013-12-05 Christos Zoulas + + * Change the way we handle multiple lex scanners and yacc parsers + in a single program. Our old patch to ylwrap does not work anymore + because the bison parsers need shared symbols that start with yy + and we can't easily select which ones work. So now we use -P and + -p to let lex and yacc do the work for us. This requires a patch + to ylwrap, but it is smaller. + +2013-05-14 Christos Zoulas + + * update to handle new autoconf and regen files + +2012-11-23 Christos Zoulas + + * recognize mountport=, noacl options + * simplify the bootstrap process, by forcing + all the files to be rebuild with autoreconf -f - i + +2012-10-03 Christos Zoulas + + * add missing ops_nfs4.c to the Makefile.am + +2012-09-14 Christos Zoulas + + * add locking option handling for lustre + * fix noatime, nodiratime, mandlock for linux + +2012-07-25 Christos Zoulas + + * bug fixes for lustre rhost parsing + +2012-06-27 Christos Zoulas + + * Disable 1/2-baked sun map support to avoid SIGSEGV + +2012-06-16 Christos Zoulas + + ******************************************************************* + *** Released am-utils-6.2-rc1 *** + ******************************************************************* + + * Fix libtool.m4 to work with later versions of autoconf. + * In buildall, use eval so that quoted strings work + * Centralize nfs version checking function, and introduce + new configuration variable nfs_vers_ping, which is the + max version we ping for. This is not documented yet, because + there might be a better way separate the max version we can + use vs the max version we ping for. + +2012-06-09 Christos Zoulas + + * fix issue with parsing nfsv4 security option strings + +2012-05-01 Christos Zoulas + + * Handle EPERM return from v4 file handles + in old linux kernels + +2012-03-09 Christos Zoulas + + * fix linux autofs detection + * fix wrong types in new amq mount xdr processing + +2012-01-25 Christos Zoulas + + * FreeBSD portability fixes + +2012-01-23 Christos Zoulas + + * Avoid type punned warnings + +2011-12-29 Christos Zoulas + + * fix bug I introduced in get_nfs_version that caused it to return 0 + * add direct support for ext{2,3,4} + +2011-12-15 Christos Zoulas + + * Include on linux, to grab extra mount flags + * Add support for lustre + +2011-11-28 Christos Zoulas + + * For nfsl mounts, match against either the short local + host name or the fqdn name. + +2011-10-06 Christos Zoulas + + * Add NFSv4 support (loosely based on Ramya's code). + Currently if the NFSv4 mount fails with ENOENT we fail + back to NFSv3, unless -DNO_FALLBACK. + * Replace strdup with xstrdup. It is not nice to replace + system functions with ones that behave differently. + * Add various consistency checks (caller function checks + variable for NULL, but callee does not). + * Fix error handling in various paths. + * Don't check before using XFREE(). free(NULL) works. + +2011-09-15 Christos Zoulas + + * amq -i addition (prints info about the map files) + +2011-09-14 Christos Zoulas + + * Solaris OS and compiler fixes from: + Hofmann, Frank + Sayle, Alex + - (void)&var generates warnings, removed + - __inline is invalid, changed with inline + - and other headers have extra dependendcies + ` +2011-08-11 Christos Zoulas + + * fix potential buffer overflow in expand_error() + (Richard Kettlewell). Does not seem to be exploitable. + + * simplify %option parsing to appease ancient flex. + +2011-06-21 Christos Zoulas + + * add support for linux autofs version 5 (untested) + +2011-06-18 Christos Zoulas + + * roll back to an older version of libtool that works + + * newer versions of config.guess and config.sub + + * minor fixes to buildall + +2011-05-19 Christos Zoulas + + * m4/macros/libtool.m4: for AIX AC_LANG_PROGRAM is incorrectly + used and the latest autoconf gives an error. For now just + quote it. + + * configure.in: Fedora Core 15 and RedHat 6 now don't define + af_family_t in , but in . + Include so that we get + indirectly. This caused the detection + test to fail. + +2010-11-24 Erez Zadok + + * m4/macros/os_cflags.m4: for linux, define _GNU_SOURCE (to get + definitions for O_LARGEFILE and more). + +2010-11-20 Christos Zoulas + + * Update news items, add release readme, mark as rc1 + + * Fix addopts code to work with options that are key=value + when the built-in hasmntopt() code is not used. The problem + was that the code passed "key=" to hasmntopt not "key". + +2009-12-10 Christos Zoulas + + * Copy all fields of the am_opts structure + When we introduced am_loc we also added a function to + create a duplicate of an am_opts structure. As it turns + out, that only made a partial copy of the struct and some + fields (e.g. opt_cache) was left blank in the new structure. + Unfortunately any code that was checking the options + through the mntfs structure was mislead by the partial + copy: caching was disabled completely, for example, and + since browsing relies on caching being enabled it wasn't + working either. + From: Krisztian Kovacs + + * Initialize RPC authentication flavor to AUTH_UNIX instead + of zero. RHEL 5 uses version 6 of the mount_arg structure + that includes the desired RPC authorization flavour. + Unfortunately amd initializes that value to zero, meaning + AUTH_NULL, resulting in all NFS servers denying operations. + From: Krisztian Kovacs + + * Make sure to remove nodes in the proper order when going + down. Depending on what order the nodes got created it's + possible that the parent of a node has a bigger am_mapno + (index in exported_ap[]) so that it gets freed before + its child while the child's am_parent pointer is still + pointing to the already freed block of memory. + This change makes sure that umount_exported() cleans up + all children of a node first before freeing the node. + From: Krisztian Kovacs + + * Fix Linux-specific stuff in ops_tmpfs.c + AUTOFS_TMPFS_FS_FLAGS is defined only in the Linux-specific + conf_linux.c file, so it cannot be built on Solaris. + From: Krisztian Kovacs + + * Add missing parenthesis to fix defined(XXX + From: Krisztian Kovacs + + * In the previous commit we've already made a change that + makes this code unnecessary since the node is returned + even if the backing file server is known to be down. + Since the code path is unused it should be removed. + From: Krisztian Kovacs + + * amfs_generic_lookup_child() tries to find an alternate + file server if it detects that the current one is down. + However, in the comparison used to decide if a possible + mount is the same as the current one it compares the am_loc + pointers instead of the actual mntfs pointers. Since + amfs_lookup_one_location() creates a brand new am_loc + structure for the returned mntfs structure the am_loc + pointer will be different even if the mntfs it's pointing + to is the same. + This tricks amfs_generic_lookup_child() think it has + found an alternate file server while it hasn't and thus + starts multiple racing mounts for the very same node and + mntfs. + From: Krisztian Kovacs + + * In the new am_loc scheme mounted mntfs structures still + have their mf_fo structure left intact. So when restart + creates a fake mntfs for an already mounted filesystem it + should not free mf_fo right away. + From: Krisztian Kovacs + + * Setting the error flag of the mntfs for which the share + is already mounted results in the mount point not being + removed when it times out. (Amd considers it an error + mntfs and thus umount becomse a no-op.) + From: Krisztian Kovacs + + * Right now AMD sets all timeout values to their defaults + even if you explicitly set them to zero. This patch + introduces separate flags that store if the respective + values have been set and the code path setting default + values checks these flags instead of testing the values + for zero. [Linux only] + From: Krisztian Kovacs + + * Fix mntfs related lookup/(un)mount race conditions, by + introducing a new structure linking an mntfs to a node. + From: Krisztian Kovacs + + * We have to free the buffers allocated by the XDR routines when + decoding the mount response after copying them to their final place. + From: Krisztian Kovacs + +2009-12-09 Christos Zoulas + + * Free continuation in amfs_retry() if we don't call amfs_bgmount() + Normally it's amfs_bgmount() which frees the continuation. However, if + the mount is already in progress and we're in amfs_retry() for another + node we don't try mounting the filesystem once again. Still, we have + to free the continuation as we won't get called again and thus would + leak the continuation structure and our am_loc references. + From: Krisztian Kovacs + + * Fix use-after-free and double free of mntfs private data + ops_nfs.c(nfs_init) does not clear private data pointer after free(). + This leads to use-after-free and double free in case mount() fails. + (found by valgrind) + From: Krisztian Kovacs + +2009-11-23 Christos Zoulas + + * The temporary filename buffer was leaked in lock_mtab(). + From: Krisztian Kovacs + +2009-10-27 Christos Zoulas + + * Deal with errno.h->sys/errno.h better + +2009-10-26 Christos Zoulas + + * Fix issue with autoconf 2.63 + + * Fix compile warnings for gcc-4.4.x + +2009-04-15 Christos Zoulas + + * Share the LDAP connection between different maps to save resources + on the LDAP server. (Olaf Flebbe ) + +2009-03-20 Christos Zoulas + + * Fix largefile re-definitions + + * Fix compilation error caused in previous patch + +2009-02-19 Christos Zoulas + + * Add a synchronous unmount amq rpc that will wait for the remote + filesystem to be unmounted, or return an error. Enabled by amq -uu + +2009-01-11 Erez Zadok + + * amd/ops_udf.c: don't define functions/variables which may not be + used. + + * amd/ops_tmpfs.c (mount_tmpfs): force gcc not to complain about + unused variables. + + * config.guess.long: properly support Fedora Core. + +2009-01-09 Christos Zoulas + + * Fix nfs mounts on linux 2.6.26 by explicitly initializing context. + + * Treat an empty sublink as an unset sublink; this allows us to + say sublink:=; in a spec to override the default. (This produces + Bad selector error, but it works. XXX: We need to decide how to + unset a selector. I proposed an unset keyword a while ago). + +2009-01-06 Christos Zoulas + + * re-renerate all generated files with newer versions of the + auto-tools. + + * move INSTALL to INSTALL.am-utils to avoid conflicts + + * fix incompatibilities with new m4 and new autoconf. + + * add UDF filesystem support. + + * fix NetBSD nfs file handle detection. + +2009-01-02 Christos Zoulas + + * add nocasetrans, nojoliet, rrcaseins for cd9660 filesystems + +2008-12-03 Christos Zoulas + + * allow ldap queries try a comma-separated list of servers given as: + + ldap_hostports = host1:port1,host2,host3:port3 + + original patch from Florian Geyer + +2008-09-19 Christos Zoulas + + * the auth_create gid on NetBSD is int + + * deal with lossage from flex -P + + * fix missing/incorrect prototypes + +2008-09-17 Christos Zoulas + + * fix manual page section issues (sorting, non-existant) + + * add missing forward declarations + + * avoid null pointer derefs (coverity) + + * more portable endian detection support + + * implement tmpfs support + + * use sizeof var instead of constant + + * fix yyerror declaration and definition + + * fix yy function renaming, and correct some renaming issues. + + * work around automake < 1.9 issue where ylwrap is not being run + for a single yacc or lex file. + + * NetBSD + - handle headers that need other headers to compile + - add exfs and tmpfs specific glue + - add options log, noatime, nocoredump, nodevmtime, softdep, + symperm, union + - NetBSD's new mount system call needs the size of the opaque + filesystem specific structure, but passing 0 for now works. + We would need to change a lot more code to pass the size from + the fs-specific calls, so for now punt. + - recvfrom takes socklen_t * on NetBSD + - handle newer NetBSD using statvfs + - NetBSD calls its ufs ffs + + * Linux + - Most recent kernels have trouble with trying to parse the pid + hostname and do locking. What before was a silent failure, now + there is a warning printed and the mount is rejected. This is + the simplest fix: + (http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=479884) + +2007-04-13 Erez Zadok + + * amd/sun_map.c (sun_append_str): When translating '&' from Sun + automounter maps, replace it with "${key}" in the Amd map, not + with the value of the key at the time. This way '*' maps work + too. + + * config.guess.long: don't use -q option to grep because some + systems don't support it. Bug fix for solaris. + +2007-03-11 Christos Zoulas + + * amd/opts.c (expand_op): Don't call xstrlcpy() to truncate a + string. It causes spurious xstrlcpy() syslog() errors. Use + memcpy() and explicitly terminate the string. + +2007-01-20 Erez Zadok + + * updated copyright year to 2007 on all files. + +2006-12-27 Erez Zadok + + * minor new port: ia64-hp-hpux11.23 + + * m4/macros/check_libwrap_severity.m4 (LIBS): also test if caller + needs to define rfc931_timeout. + + * amd/sun2amd.c: define rfc931_timeout and allow/deny_severity for + libwrap. + + * amd/amq_svc.c: some versions of libwrap require the caller to + define rfc931_timeout in addition to allow/deny_severity. + + * amd/amfs_toplvl.c (amfs_toplvl_init): properly detect when + forced unmount functionality exists for all systems. + + * libamu/mount_fs.c (compute_nfs_args): reset nfs_args_t->pathconf + only if field exists. + + * conf/nfs_prot/nfs_prot_hpux11.h: prevent HPUX 11.23 from + including or (TLI definitions are already + included from elsewhere). + + * configure.in: detect nfs_args_t->pathconf field. + +2006-11-27 Erez Zadok + + * doc/Makefile.am: properly publish html files using newer + text2html. + +2006-11-27 Erez Zadok + + * doc/Makefile.am: obfuscate emails in ChangeLog before it is *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@freebsd.org Fri Dec 23 22:54:57 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 364EEC8E8A7 for ; Fri, 23 Dec 2016 22:54:57 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-io0-x244.google.com (mail-io0-x244.google.com [IPv6:2607:f8b0:4001:c06::244]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id F30EC1F2A for ; Fri, 23 Dec 2016 22:54:56 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-io0-x244.google.com with SMTP id n85so7243873ioi.1 for ; Fri, 23 Dec 2016 14:54:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20150623.gappssmtp.com; s=20150623; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=brkOsluyIM8rwWu4hm3RwHSA6efQ3LvVN045RNDv+L8=; b=LtVSKg+GxU6GyupTGRCtH/BueCs3Cgvb2B8AYkNfyCcWXOaNei1DOGEPv7OQd4ce/W 4k9yOXQUkKiBQpgGtTxihhiRiRat4Pa8MknF8PwnsKR52Oo+vk1mhW9wWo9nVX+Aib+k qEtJJj4++X5FygD+MXHiLSjRYDYF3+eIt1weh+sM8+QjeGFwJ5/DUpE/CaNbp2Mk4MNl y+WKJtltLZZ76b3KLThCS6ErvftsUl1M6dqs7Zgw4IGaFizvUoyQHluE5MGPkCGdfEzQ xo0yIwAkyxA4F1vQYWhGfZT+wvivsyUIIRYe1KHSzQwmWa5CkeKEgupANs/5Qe7Rv/WY MQnA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=brkOsluyIM8rwWu4hm3RwHSA6efQ3LvVN045RNDv+L8=; b=oABsYRj1O4jHSoHqx2cu6CV1Fo+2n1oQabbyqtfC8ho73Qh4gF5rTTFt0dWLbOmE/6 y9/WyBCoHCRCY58E+A84p9ljSuWAUSNNmz5iqtrUCo1YcPT2oH/I7gx37E3Vxb4OfpoT fus9tt41ClERIj0L9takWmQyfmyxsVeVdDDchl1x3DHw3DMN5M1ZjTGt5z32ekTYvV36 Wn++/AI48FqO1wT/Zbdtemc4TTaMgCCHxi/YPPj5KV+Y06TZ1Arv1mex+wBr5RfP4iaR VFLzQB0aax2mjisMmB1x2TaACHKboL49EZTKWhe/4RgV3KgDzcdbfhJkL7FaOeosa729 6XFA== X-Gm-Message-State: AIkVDXJcWtgK5ZMEzPjYbFDp49tu+yZHAzma5WjhJtRggg2VP9LCqj4Ld6y0s2YCvx6B5E5HunYhjsjWGEC0mw== X-Received: by 10.107.198.9 with SMTP id w9mr5043050iof.19.1482533696258; Fri, 23 Dec 2016 14:54:56 -0800 (PST) MIME-Version: 1.0 Sender: wlosh@bsdimp.com Received: by 10.79.22.135 with HTTP; Fri, 23 Dec 2016 14:54:55 -0800 (PST) X-Originating-IP: [50.253.99.174] In-Reply-To: References: <201611180013.uAI0DU57087971@repo.freebsd.org> From: Warner Losh Date: Fri, 23 Dec 2016 15:54:55 -0700 X-Google-Sender-Auth: rm1onL4KlLWspjwy9erwrJlwOYM Message-ID: Subject: Re: svn commit: r308789 - head/sys/conf To: Ed Maste Cc: Gleb Smirnoff , "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" Content-Type: text/plain; charset=UTF-8 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Dec 2016 22:54:57 -0000 On Fri, Dec 23, 2016 at 11:36 AM, Warner Losh wrote: > On Fri, Dec 23, 2016 at 9:35 AM, Ed Maste wrote: >> On 17 November 2016 at 19:13, Gleb Smirnoff wrote: >>> Author: glebius >>> Date: Fri Nov 18 00:13:30 2016 >>> New Revision: 308789 >>> URL: https://svnweb.freebsd.org/changeset/base/308789 >>> >>> Log: >>> If FreeBSD source tree is a subproject of a bigger project, then .git or >>> .hg may reside above FreeBSD sources root. Provide function findvcs() >>> that will climb up and seek for presence of a VCS directory. >> >> This can incorrectly find an unrelated .git directory and provide a >> git revision unrelated to the FreeBSD source being built. For example, >> a build from my Subversion tree now reports "FreeBSD 12.0-CURRENT #2 >> ad3f46a(master)" instead of "FreeBSD 12.0-CURRENT #5 r310482M". >> >> Can you explain your use case in a little more detail so that I can >> avoid breaking it with a change here? Do you commit FreeBSD snapshots >> into the "bigger project"? > > This is done at work (Netflix). We import all the FreeBSD revisions > from github into our repo, and then merge them into the top level > FreeBSD directory from time to time using git's subtree functionality. > We also pull in our ports tree this way (so we have a ports directory > at the same level as our FreeBSD directory). So we don't have a > $TOPSRC/.git like you would if you'd just cloned directly from github. > Our .git directory lives in $TOPSRC/.git as a result. newvers.sh > should find the 'deepest' SCM it can, and use that instead of > apparently using the topmost (I'm surprised that you have FreeBSD > under a directory that has a git checkout in it, btw, but I know that > with my dotfile management repo, that sometimes happens by mistake). > And if this somehow produces a 'tie', the tie should go to svn. > > Looking at how to fix this mess... woof. There's all kinds of crazy > here. Support for: git, git + svn, hg, p4, svn and svnlite. Sometimes > $VCS_cmd is defined if it exists at all on the system, other times > it's only defined if it exists on the system AND we think the tree is > under $VCS. > > But the base of all this woe is that findvcs is called on a per-vcs > basis, rather than being called early to match one of N VCS > signatures. It would be better off searching each directory for each > file rather than finding any file at any level. After chatting with Ed on IRC, I've posted this review. https://reviews.freebsd.org/D8895 which should fix the issues. Warner From owner-svn-src-all@freebsd.org Fri Dec 23 23:14:55 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 76748C8EBCD; Fri, 23 Dec 2016 23:14:55 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 38C5BB78; Fri, 23 Dec 2016 23:14:55 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBNNEspL090211; Fri, 23 Dec 2016 23:14:54 GMT (envelope-from rmacklem@FreeBSD.org) Received: (from rmacklem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBNNEr73090201; Fri, 23 Dec 2016 23:14:53 GMT (envelope-from rmacklem@FreeBSD.org) Message-Id: <201612232314.uBNNEr73090201@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rmacklem set sender to rmacklem@FreeBSD.org using -f From: Rick Macklem Date: Fri, 23 Dec 2016 23:14:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310491 - in head/sys/fs: nfs nfsclient X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Dec 2016 23:14:55 -0000 Author: rmacklem Date: Fri Dec 23 23:14:53 2016 New Revision: 310491 URL: https://svnweb.freebsd.org/changeset/base/310491 Log: Fix NFSv4.1 client recovery from NFS4ERR_BAD_SESSION errors. For most NFSv4.1 servers, a NFS4ERR_BAD_SESSION error is a rare failure that indicates that the server has lost session/open/lock state. However, recent testing by cperciva@ against the AmazonEFS server found several problems with client recovery from this due to it generating this failure frequently. Briefly, the problems fixed are: - If all session slots were in use at the time of the failure, some processes would continue to loop waiting for a slot on the old session forever. - If an RPC that doesn't use open/lock state failed with NFS4ERR_BAD_SESSION, it would fail the RPC/syscall instead of initiating recovery and then looping to retry the RPC. - If a successful reply to an RPC for an old session wasn't processed until after a new session was created for a NFS4ERR_BAD_SESSION error, it would erroneously update the new session and corrupt it. - The use of the first element of the session list in the nfs mount structure (which is always the current metadata session) was slightly racey. With changes for the above problems it became more racey, so all uses of this head pointer was wrapped with a NFSLOCKMNT()/NFSUNLOCKMNT(). - Although the kernel malloc() usually allocates more bytes than requested and, as such, this wouldn't have caused problems, the allocation of a session structure was 1 byte smaller than it should have been. (Null termination byte for the string not included in byte count.) There are probably still problems with a pNFS data server that fails with NFS4ERR_BAD_SESSION, but I have no server that does this to test against (the AmazonEFS server doesn't do pNFS), so I can't fix these yet. Although this patch is fairly large, it should only affect the handling of NFS4ERR_BAD_SESSION error replies from an NFSv4.1 server. Thanks go to cperciva@ for the extension testing he did to help isolate/fix these problems. Reported by: cperciva Tested by: cperciva MFC after: 3 months Differential Revision: https://reviews.freebsd.org/D8745 Modified: head/sys/fs/nfs/nfs.h head/sys/fs/nfs/nfs_commonkrpc.c head/sys/fs/nfs/nfs_commonport.c head/sys/fs/nfs/nfs_commonsubs.c head/sys/fs/nfs/nfsclstate.h head/sys/fs/nfsclient/nfs_clcomsubs.c head/sys/fs/nfsclient/nfs_clport.c head/sys/fs/nfsclient/nfs_clrpcops.c head/sys/fs/nfsclient/nfs_clstate.c head/sys/fs/nfsclient/nfs_clvfsops.c head/sys/fs/nfsclient/nfsmount.h Modified: head/sys/fs/nfs/nfs.h ============================================================================== --- head/sys/fs/nfs/nfs.h Fri Dec 23 22:42:14 2016 (r310490) +++ head/sys/fs/nfs/nfs.h Fri Dec 23 23:14:53 2016 (r310491) @@ -601,6 +601,7 @@ struct nfsrv_descript { uint8_t nd_sessionid[NFSX_V4SESSIONID]; /* Session id */ uint32_t nd_slotid; /* Slotid for this RPC */ SVCXPRT *nd_xprt; /* Server RPC handle */ + uint32_t *nd_sequence; /* Sequence Op. ptr */ }; #define nd_princlen nd_gssnamelen @@ -636,6 +637,7 @@ struct nfsrv_descript { #define ND_HASSEQUENCE 0x04000000 #define ND_CACHETHIS 0x08000000 #define ND_LASTOP 0x10000000 +#define ND_LOOPBADSESS 0x20000000 /* * ND_GSS should be the "or" of all GSS type authentications. @@ -649,6 +651,7 @@ struct nfsv4_opflag { int modifyfs; int lktype; int needsseq; + int loopbadsess; }; /* Modified: head/sys/fs/nfs/nfs_commonkrpc.c ============================================================================== --- head/sys/fs/nfs/nfs_commonkrpc.c Fri Dec 23 22:42:14 2016 (r310490) +++ head/sys/fs/nfs/nfs_commonkrpc.c Fri Dec 23 23:14:53 2016 (r310491) @@ -89,6 +89,7 @@ uint32_t nfscl_nfs4_done_probes[NFSV41_N NFSSTATESPINLOCK; NFSREQSPINLOCK; NFSDLOCKMUTEX; +NFSCLSTATEMUTEX; extern struct nfsstatsv1 nfsstatsv1; extern struct nfsreqhead nfsd_reqq; extern int nfscl_ticks; @@ -473,13 +474,13 @@ int newnfs_request(struct nfsrv_descript *nd, struct nfsmount *nmp, struct nfsclient *clp, struct nfssockreq *nrp, vnode_t vp, struct thread *td, struct ucred *cred, u_int32_t prog, u_int32_t vers, - u_char *retsum, int toplevel, u_int64_t *xidp, struct nfsclsession *sep) + u_char *retsum, int toplevel, u_int64_t *xidp, struct nfsclsession *dssep) { - u_int32_t retseq, retval, *tl; + uint32_t retseq, retval, slotseq, *tl; time_t waituntil; int i = 0, j = 0, opcnt, set_sigset = 0, slot; int trycnt, error = 0, usegssname = 0, secflavour = AUTH_SYS; - int freeslot, timeo; + int freeslot, maxslot, reterr, slotpos, timeo; u_int16_t procnum; u_int trylater_delay = 1; struct nfs_feedback_arg nf; @@ -491,7 +492,10 @@ newnfs_request(struct nfsrv_descript *nd char *srv_principal = NULL, *clnt_principal = NULL; sigset_t oldset; struct ucred *authcred; + struct nfsclsession *sep; + uint8_t sessionid[NFSX_V4SESSIONID]; + sep = dssep; if (xidp != NULL) *xidp = 0; /* Reject requests while attempting a forced unmount. */ @@ -803,7 +807,7 @@ tryagain: nd->nd_procnum != NFSV4PROC_CBNULL) { /* If sep == NULL, set it to the default in nmp. */ if (sep == NULL && nmp != NULL) - sep = NFSMNT_MDSSESSION(nmp); + sep = nfsmnt_mdssession(nmp); /* * and now the actual NFS xdr. */ @@ -847,18 +851,25 @@ tryagain: NFSX_V4SESSIONID + 4 * NFSX_UNSIGNED); mtx_lock(&sep->nfsess_mtx); - tl += NFSX_V4SESSIONID / NFSX_UNSIGNED; - retseq = fxdr_unsigned(uint32_t, *tl++); - slot = fxdr_unsigned(int, *tl++); - freeslot = slot; - if (retseq != sep->nfsess_slotseq[slot]) - printf("retseq diff 0x%x\n", retseq); - retval = fxdr_unsigned(uint32_t, *++tl); - if ((retval + 1) < sep->nfsess_foreslots) - sep->nfsess_foreslots = (retval + 1); - else if ((retval + 1) > sep->nfsess_foreslots) - sep->nfsess_foreslots = (retval < 64) ? - (retval + 1) : 64; + if (bcmp(tl, sep->nfsess_sessionid, + NFSX_V4SESSIONID) == 0) { + tl += NFSX_V4SESSIONID / NFSX_UNSIGNED; + retseq = fxdr_unsigned(uint32_t, *tl++); + slot = fxdr_unsigned(int, *tl++); + freeslot = slot; + if (retseq != sep->nfsess_slotseq[slot]) + printf("retseq diff 0x%x\n", + retseq); + retval = fxdr_unsigned(uint32_t, *++tl); + if ((retval + 1) < sep->nfsess_foreslots + ) + sep->nfsess_foreslots = (retval + + 1); + else if ((retval + 1) > + sep->nfsess_foreslots) + sep->nfsess_foreslots = (retval + < 64) ? (retval + 1) : 64; + } mtx_unlock(&sep->nfsess_mtx); /* Grab the op and status for the next one. */ @@ -871,6 +882,76 @@ tryagain: } } if (nd->nd_repstat != 0) { + if (nd->nd_repstat == NFSERR_BADSESSION && + nmp != NULL && dssep == NULL) { + /* + * If this is a client side MDS RPC, mark + * the MDS session defunct and initiate + * recovery, as required. + * The nfsess_defunct field is protected by + * the NFSLOCKMNT()/nm_mtx lock and not the + * nfsess_mtx lock to simplify its handling, + * for the MDS session. This lock is also + * sufficient for nfsess_sessionid, since it + * never changes in the structure. + */ + NFSCL_DEBUG(1, "Got badsession\n"); + NFSLOCKCLSTATE(); + NFSLOCKMNT(nmp); + sep = NFSMNT_MDSSESSION(nmp); + if (bcmp(sep->nfsess_sessionid, nd->nd_sequence, + NFSX_V4SESSIONID) == 0) { + /* Initiate recovery. */ + sep->nfsess_defunct = 1; + NFSCL_DEBUG(1, "Marked defunct\n"); + if (nmp->nm_clp != NULL) { + nmp->nm_clp->nfsc_flags |= + NFSCLFLAGS_RECOVER; + wakeup(nmp->nm_clp); + } + } + NFSUNLOCKCLSTATE(); + /* + * Sleep for up to 1sec waiting for a new + * session. + */ + mtx_sleep(&nmp->nm_sess, &nmp->nm_mtx, PZERO, + "nfsbadsess", hz); + /* + * Get the session again, in case a new one + * has been created during the sleep. + */ + sep = NFSMNT_MDSSESSION(nmp); + NFSUNLOCKMNT(nmp); + if ((nd->nd_flag & ND_LOOPBADSESS) != 0) { + reterr = nfsv4_sequencelookup(nmp, sep, + &slotpos, &maxslot, &slotseq, + sessionid); + if (reterr == 0) { + /* Fill in new session info. */ + NFSCL_DEBUG(1, + "Filling in new sequence\n"); + tl = nd->nd_sequence; + bcopy(sessionid, tl, + NFSX_V4SESSIONID); + tl += NFSX_V4SESSIONID / + NFSX_UNSIGNED; + *tl++ = txdr_unsigned(slotseq); + *tl++ = txdr_unsigned(slotpos); + *tl = txdr_unsigned(maxslot); + } + if (reterr == NFSERR_BADSESSION || + reterr == 0) { + NFSCL_DEBUG(1, + "Badsession looping\n"); + m_freem(nd->nd_mrep); + nd->nd_mrep = NULL; + goto tryagain; + } + nd->nd_repstat = reterr; + NFSCL_DEBUG(1, "Got err=%d\n", reterr); + } + } if (((nd->nd_repstat == NFSERR_DELAY || nd->nd_repstat == NFSERR_GRACE) && (nd->nd_flag & ND_NFSV4) && Modified: head/sys/fs/nfs/nfs_commonport.c ============================================================================== --- head/sys/fs/nfs/nfs_commonport.c Fri Dec 23 22:42:14 2016 (r310490) +++ head/sys/fs/nfs/nfs_commonport.c Fri Dec 23 23:14:53 2016 (r310491) @@ -129,6 +129,7 @@ struct mtx nfs_state_mutex; struct mtx nfs_nameid_mutex; struct mtx nfs_req_mutex; struct mtx nfs_slock_mutex; +struct mtx nfs_clstate_mutex; /* local functions */ static int nfssvc_call(struct thread *, struct nfssvc_args *, struct ucred *); @@ -647,6 +648,7 @@ newnfs_portinit(void) /* Initialize SMP locks used by both client and server. */ mtx_init(&newnfsd_mtx, "newnfsd_mtx", NULL, MTX_DEF); mtx_init(&nfs_state_mutex, "nfs_state_mutex", NULL, MTX_DEF); + mtx_init(&nfs_clstate_mutex, "nfs_clstate_mutex", NULL, MTX_DEF); } /* @@ -712,6 +714,7 @@ nfscommon_modevent(module_t mod, int typ mtx_destroy(&nfs_nameid_mutex); mtx_destroy(&newnfsd_mtx); mtx_destroy(&nfs_state_mutex); + mtx_destroy(&nfs_clstate_mutex); mtx_destroy(&nfs_sockl_mutex); mtx_destroy(&nfs_slock_mutex); mtx_destroy(&nfs_req_mutex); Modified: head/sys/fs/nfs/nfs_commonsubs.c ============================================================================== --- head/sys/fs/nfs/nfs_commonsubs.c Fri Dec 23 22:42:14 2016 (r310490) +++ head/sys/fs/nfs/nfs_commonsubs.c Fri Dec 23 23:14:53 2016 (r310491) @@ -90,65 +90,65 @@ extern int nfsrv_lughashsize; * Define it here, since it is used by both the client and server. */ struct nfsv4_opflag nfsv4_opflag[NFSV41_NOPS] = { - { 0, 0, 0, 0, LK_EXCLUSIVE, 1 }, /* undef */ - { 0, 0, 0, 0, LK_EXCLUSIVE, 1 }, /* undef */ - { 0, 0, 0, 0, LK_EXCLUSIVE, 1 }, /* undef */ - { 0, 1, 0, 0, LK_SHARED, 1 }, /* Access */ - { 0, 1, 0, 0, LK_EXCLUSIVE, 1 }, /* Close */ - { 0, 2, 0, 1, LK_EXCLUSIVE, 1 }, /* Commit */ - { 1, 2, 1, 1, LK_EXCLUSIVE, 1 }, /* Create */ - { 0, 0, 0, 0, LK_EXCLUSIVE, 1 }, /* Delegpurge */ - { 0, 1, 0, 0, LK_EXCLUSIVE, 1 }, /* Delegreturn */ - { 0, 1, 0, 0, LK_SHARED, 1 }, /* Getattr */ - { 0, 1, 0, 0, LK_EXCLUSIVE, 1 }, /* GetFH */ - { 2, 1, 1, 1, LK_EXCLUSIVE, 1 }, /* Link */ - { 0, 1, 0, 0, LK_EXCLUSIVE, 1 }, /* Lock */ - { 0, 1, 0, 0, LK_EXCLUSIVE, 1 }, /* LockT */ - { 0, 1, 0, 0, LK_EXCLUSIVE, 1 }, /* LockU */ - { 1, 2, 0, 0, LK_EXCLUSIVE, 1 }, /* Lookup */ - { 1, 2, 0, 0, LK_EXCLUSIVE, 1 }, /* Lookupp */ - { 0, 1, 0, 0, LK_EXCLUSIVE, 1 }, /* NVerify */ - { 1, 1, 0, 1, LK_EXCLUSIVE, 1 }, /* Open */ - { 1, 1, 0, 0, LK_EXCLUSIVE, 1 }, /* OpenAttr */ - { 0, 1, 0, 0, LK_EXCLUSIVE, 1 }, /* OpenConfirm */ - { 0, 1, 0, 0, LK_EXCLUSIVE, 1 }, /* OpenDowngrade */ - { 1, 0, 0, 0, LK_EXCLUSIVE, 1 }, /* PutFH */ - { 1, 0, 0, 0, LK_EXCLUSIVE, 1 }, /* PutPubFH */ - { 1, 0, 0, 0, LK_EXCLUSIVE, 1 }, /* PutRootFH */ - { 0, 1, 0, 0, LK_SHARED, 1 }, /* Read */ - { 0, 1, 0, 0, LK_SHARED, 1 }, /* Readdir */ - { 0, 1, 0, 0, LK_SHARED, 1 }, /* ReadLink */ - { 0, 2, 1, 1, LK_EXCLUSIVE, 1 }, /* Remove */ - { 2, 1, 1, 1, LK_EXCLUSIVE, 1 }, /* Rename */ - { 0, 0, 0, 0, LK_EXCLUSIVE, 1 }, /* Renew */ - { 0, 0, 0, 0, LK_EXCLUSIVE, 1 }, /* RestoreFH */ - { 0, 1, 0, 0, LK_EXCLUSIVE, 1 }, /* SaveFH */ - { 0, 1, 0, 0, LK_EXCLUSIVE, 1 }, /* SecInfo */ - { 0, 2, 1, 1, LK_EXCLUSIVE, 1 }, /* Setattr */ - { 0, 0, 0, 0, LK_EXCLUSIVE, 1 }, /* SetClientID */ - { 0, 0, 0, 0, LK_EXCLUSIVE, 1 }, /* SetClientIDConfirm */ - { 0, 1, 0, 0, LK_EXCLUSIVE, 1 }, /* Verify */ - { 0, 2, 1, 1, LK_EXCLUSIVE, 1 }, /* Write */ - { 0, 0, 0, 0, LK_EXCLUSIVE, 1 }, /* ReleaseLockOwner */ - { 0, 0, 0, 0, LK_EXCLUSIVE, 1 }, /* Backchannel Ctrl */ - { 0, 0, 0, 0, LK_EXCLUSIVE, 1 }, /* Bind Conn to Sess */ - { 0, 0, 0, 0, LK_EXCLUSIVE, 0 }, /* Exchange ID */ - { 0, 0, 0, 0, LK_EXCLUSIVE, 0 }, /* Create Session */ - { 0, 0, 0, 0, LK_EXCLUSIVE, 0 }, /* Destroy Session */ - { 0, 0, 0, 0, LK_EXCLUSIVE, 1 }, /* Free StateID */ - { 0, 0, 0, 0, LK_EXCLUSIVE, 1 }, /* Get Dir Deleg */ - { 0, 0, 0, 0, LK_EXCLUSIVE, 1 }, /* Get Device Info */ - { 0, 0, 0, 0, LK_EXCLUSIVE, 1 }, /* Get Device List */ - { 0, 1, 0, 0, LK_EXCLUSIVE, 1 }, /* Layout Commit */ - { 0, 1, 0, 0, LK_EXCLUSIVE, 1 }, /* Layout Get */ - { 0, 1, 0, 0, LK_EXCLUSIVE, 1 }, /* Layout Return */ - { 0, 0, 0, 0, LK_EXCLUSIVE, 1 }, /* Secinfo No name */ - { 0, 0, 0, 0, LK_EXCLUSIVE, 1 }, /* Sequence */ - { 0, 0, 0, 0, LK_EXCLUSIVE, 1 }, /* Set SSV */ - { 0, 0, 0, 0, LK_EXCLUSIVE, 1 }, /* Test StateID */ - { 0, 0, 0, 0, LK_EXCLUSIVE, 1 }, /* Want Delegation */ - { 0, 0, 0, 0, LK_EXCLUSIVE, 0 }, /* Destroy ClientID */ - { 0, 0, 0, 0, LK_EXCLUSIVE, 1 }, /* Reclaim Complete */ + { 0, 0, 0, 0, LK_EXCLUSIVE, 1, 1 }, /* undef */ + { 0, 0, 0, 0, LK_EXCLUSIVE, 1, 1 }, /* undef */ + { 0, 0, 0, 0, LK_EXCLUSIVE, 1, 1 }, /* undef */ + { 0, 1, 0, 0, LK_SHARED, 1, 1 }, /* Access */ + { 0, 1, 0, 0, LK_EXCLUSIVE, 1, 0 }, /* Close */ + { 0, 2, 0, 1, LK_EXCLUSIVE, 1, 1 }, /* Commit */ + { 1, 2, 1, 1, LK_EXCLUSIVE, 1, 1 }, /* Create */ + { 0, 0, 0, 0, LK_EXCLUSIVE, 1, 0 }, /* Delegpurge */ + { 0, 1, 0, 0, LK_EXCLUSIVE, 1, 0 }, /* Delegreturn */ + { 0, 1, 0, 0, LK_SHARED, 1, 1 }, /* Getattr */ + { 0, 1, 0, 0, LK_EXCLUSIVE, 1, 1 }, /* GetFH */ + { 2, 1, 1, 1, LK_EXCLUSIVE, 1, 1 }, /* Link */ + { 0, 1, 0, 0, LK_EXCLUSIVE, 1, 0 }, /* Lock */ + { 0, 1, 0, 0, LK_EXCLUSIVE, 1, 0 }, /* LockT */ + { 0, 1, 0, 0, LK_EXCLUSIVE, 1, 0 }, /* LockU */ + { 1, 2, 0, 0, LK_EXCLUSIVE, 1, 1 }, /* Lookup */ + { 1, 2, 0, 0, LK_EXCLUSIVE, 1, 1 }, /* Lookupp */ + { 0, 1, 0, 0, LK_EXCLUSIVE, 1, 1 }, /* NVerify */ + { 1, 1, 0, 1, LK_EXCLUSIVE, 1, 0 }, /* Open */ + { 1, 1, 0, 0, LK_EXCLUSIVE, 1, 0 }, /* OpenAttr */ + { 0, 1, 0, 0, LK_EXCLUSIVE, 1, 0 }, /* OpenConfirm */ + { 0, 1, 0, 0, LK_EXCLUSIVE, 1, 0 }, /* OpenDowngrade */ + { 1, 0, 0, 0, LK_EXCLUSIVE, 1, 1 }, /* PutFH */ + { 1, 0, 0, 0, LK_EXCLUSIVE, 1, 1 }, /* PutPubFH */ + { 1, 0, 0, 0, LK_EXCLUSIVE, 1, 1 }, /* PutRootFH */ + { 0, 1, 0, 0, LK_SHARED, 1, 0 }, /* Read */ + { 0, 1, 0, 0, LK_SHARED, 1, 1 }, /* Readdir */ + { 0, 1, 0, 0, LK_SHARED, 1, 1 }, /* ReadLink */ + { 0, 2, 1, 1, LK_EXCLUSIVE, 1, 1 }, /* Remove */ + { 2, 1, 1, 1, LK_EXCLUSIVE, 1, 1 }, /* Rename */ + { 0, 0, 0, 0, LK_EXCLUSIVE, 1, 0 }, /* Renew */ + { 0, 0, 0, 0, LK_EXCLUSIVE, 1, 1 }, /* RestoreFH */ + { 0, 1, 0, 0, LK_EXCLUSIVE, 1, 1 }, /* SaveFH */ + { 0, 1, 0, 0, LK_EXCLUSIVE, 1, 1 }, /* SecInfo */ + { 0, 2, 1, 1, LK_EXCLUSIVE, 1, 0 }, /* Setattr */ + { 0, 0, 0, 0, LK_EXCLUSIVE, 1, 1 }, /* SetClientID */ + { 0, 0, 0, 0, LK_EXCLUSIVE, 1, 1 }, /* SetClientIDConfirm */ + { 0, 1, 0, 0, LK_EXCLUSIVE, 1, 1 }, /* Verify */ + { 0, 2, 1, 1, LK_EXCLUSIVE, 1, 0 }, /* Write */ + { 0, 0, 0, 0, LK_EXCLUSIVE, 1, 0 }, /* ReleaseLockOwner */ + { 0, 0, 0, 0, LK_EXCLUSIVE, 1, 1 }, /* Backchannel Ctrl */ + { 0, 0, 0, 0, LK_EXCLUSIVE, 1, 1 }, /* Bind Conn to Sess */ + { 0, 0, 0, 0, LK_EXCLUSIVE, 0, 0 }, /* Exchange ID */ + { 0, 0, 0, 0, LK_EXCLUSIVE, 0, 0 }, /* Create Session */ + { 0, 0, 0, 0, LK_EXCLUSIVE, 0, 0 }, /* Destroy Session */ + { 0, 0, 0, 0, LK_EXCLUSIVE, 1, 0 }, /* Free StateID */ + { 0, 0, 0, 0, LK_EXCLUSIVE, 1, 1 }, /* Get Dir Deleg */ + { 0, 0, 0, 0, LK_EXCLUSIVE, 1, 1 }, /* Get Device Info */ + { 0, 0, 0, 0, LK_EXCLUSIVE, 1, 1 }, /* Get Device List */ + { 0, 1, 0, 0, LK_EXCLUSIVE, 1, 1 }, /* Layout Commit */ + { 0, 1, 0, 0, LK_EXCLUSIVE, 1, 1 }, /* Layout Get */ + { 0, 1, 0, 0, LK_EXCLUSIVE, 1, 0 }, /* Layout Return */ + { 0, 0, 0, 0, LK_EXCLUSIVE, 1, 1 }, /* Secinfo No name */ + { 0, 0, 0, 0, LK_EXCLUSIVE, 1, 0 }, /* Sequence */ + { 0, 0, 0, 0, LK_EXCLUSIVE, 1, 1 }, /* Set SSV */ + { 0, 0, 0, 0, LK_EXCLUSIVE, 1, 1 }, /* Test StateID */ + { 0, 0, 0, 0, LK_EXCLUSIVE, 1, 1 }, /* Want Delegation */ + { 0, 0, 0, 0, LK_EXCLUSIVE, 0, 0 }, /* Destroy ClientID */ + { 0, 0, 0, 0, LK_EXCLUSIVE, 1, 1 }, /* Reclaim Complete */ }; #endif /* !APPLEKEXT */ @@ -4130,22 +4130,35 @@ nfsv4_setsequence(struct nfsmount *nmp, error = nfsv4_sequencelookup(nmp, sep, &slotpos, &maxslot, &slotseq, sessionid); - if (error != 0) - return; - KASSERT(maxslot >= 0, ("nfscl_setsequence neg maxslot")); /* Build the Sequence arguments. */ NFSM_BUILD(tl, uint32_t *, NFSX_V4SESSIONID + 4 * NFSX_UNSIGNED); + nd->nd_sequence = tl; bcopy(sessionid, tl, NFSX_V4SESSIONID); tl += NFSX_V4SESSIONID / NFSX_UNSIGNED; nd->nd_slotseq = tl; - *tl++ = txdr_unsigned(slotseq); - *tl++ = txdr_unsigned(slotpos); - *tl++ = txdr_unsigned(maxslot); - if (dont_replycache == 0) - *tl = newnfs_true; - else - *tl = newnfs_false; + if (error == 0) { + *tl++ = txdr_unsigned(slotseq); + *tl++ = txdr_unsigned(slotpos); + *tl++ = txdr_unsigned(maxslot); + if (dont_replycache == 0) + *tl = newnfs_true; + else + *tl = newnfs_false; + } else { + /* + * There are two errors and the rest of the session can + * just be zeros. + * NFSERR_BADSESSION: This bad session should just generate + * the same error again when the RPC is retried. + * ESTALE: A forced dismount is in progress and will cause the + * RPC to fail later. + */ + *tl++ = 0; + *tl++ = 0; + *tl++ = 0; + *tl = 0; + } nd->nd_flag |= ND_HASSEQUENCE; } @@ -4161,6 +4174,13 @@ nfsv4_sequencelookup(struct nfsmount *nm maxslot = -1; mtx_lock(&sep->nfsess_mtx); do { + if (nmp != NULL && sep->nfsess_defunct != 0) { + /* Just return the bad session. */ + bcopy(sep->nfsess_sessionid, sessionid, + NFSX_V4SESSIONID); + mtx_unlock(&sep->nfsess_mtx); + return (NFSERR_BADSESSION); + } bitval = 1; for (i = 0; i < sep->nfsess_foreslots; i++) { if ((bitval & sep->nfsess_slots) == 0) { Modified: head/sys/fs/nfs/nfsclstate.h ============================================================================== --- head/sys/fs/nfs/nfsclstate.h Fri Dec 23 22:42:14 2016 (r310490) +++ head/sys/fs/nfs/nfsclstate.h Fri Dec 23 23:14:53 2016 (r310491) @@ -65,6 +65,7 @@ struct nfsclsession { uint16_t nfsess_foreslots; uint16_t nfsess_backslots; uint8_t nfsess_sessionid[NFSX_V4SESSIONID]; + uint8_t nfsess_defunct; /* Non-zero for old sessions */ }; /* Modified: head/sys/fs/nfsclient/nfs_clcomsubs.c ============================================================================== --- head/sys/fs/nfsclient/nfs_clcomsubs.c Fri Dec 23 22:42:14 2016 (r310490) +++ head/sys/fs/nfsclient/nfs_clcomsubs.c Fri Dec 23 23:14:53 2016 (r310491) @@ -200,13 +200,16 @@ nfscl_reqstart(struct nfsrv_descript *nd *tl = txdr_unsigned(opcnt); if ((nd->nd_flag & ND_NFSV41) != 0 && nfsv4_opflag[nfsv4_opmap[procnum].op].needsseq > 0) { + if (nfsv4_opflag[nfsv4_opmap[procnum].op].loopbadsess > + 0) + nd->nd_flag |= ND_LOOPBADSESS; NFSM_BUILD(tl, u_int32_t *, NFSX_UNSIGNED); *tl = txdr_unsigned(NFSV4OP_SEQUENCE); - if (sep == NULL) - nfsv4_setsequence(nmp, nd, - NFSMNT_MDSSESSION(nmp), + if (sep == NULL) { + sep = nfsmnt_mdssession(nmp); + nfsv4_setsequence(nmp, nd, sep, nfs_bigreply[procnum]); - else + } else nfsv4_setsequence(nmp, nd, sep, nfs_bigreply[procnum]); } Modified: head/sys/fs/nfsclient/nfs_clport.c ============================================================================== --- head/sys/fs/nfsclient/nfs_clport.c Fri Dec 23 22:42:14 2016 (r310490) +++ head/sys/fs/nfsclient/nfs_clport.c Fri Dec 23 23:14:53 2016 (r310491) @@ -82,7 +82,6 @@ extern short nfsv4_cbport; extern int nfscl_enablecallb; extern int nfs_numnfscbd; extern int nfscl_inited; -struct mtx nfs_clstate_mutex; struct mtx ncl_iod_mutex; NFSDLOCKMUTEX; @@ -1381,8 +1380,6 @@ nfscl_modevent(module_t mod, int type, v if (loaded) return (0); newnfs_portinit(); - mtx_init(&nfs_clstate_mutex, "nfs_clstate_mutex", NULL, - MTX_DEF); mtx_init(&ncl_iod_mutex, "ncl_iod_mutex", NULL, MTX_DEF); nfscl_init(); NFSD_LOCK(); @@ -1406,7 +1403,6 @@ nfscl_modevent(module_t mod, int type, v ncl_call_invalcaches = NULL; nfsd_call_nfscl = NULL; /* and get rid of the mutexes */ - mtx_destroy(&nfs_clstate_mutex); mtx_destroy(&ncl_iod_mutex); loaded = 0; break; Modified: head/sys/fs/nfsclient/nfs_clrpcops.c ============================================================================== --- head/sys/fs/nfsclient/nfs_clrpcops.c Fri Dec 23 22:42:14 2016 (r310490) +++ head/sys/fs/nfsclient/nfs_clrpcops.c Fri Dec 23 23:14:53 2016 (r310491) @@ -384,6 +384,7 @@ nfsrpc_openrpc(struct nfsmount *nmp, vno u_int32_t rflags, deleg; nfsattrbit_t attrbits; int error, ret, acesize, limitby; + struct nfsclsession *tsep; dp = *dpp; *dpp = NULL; @@ -392,8 +393,9 @@ nfsrpc_openrpc(struct nfsmount *nmp, vno *tl++ = txdr_unsigned(op->nfso_own->nfsow_seqid); *tl++ = txdr_unsigned(mode & NFSV4OPEN_ACCESSBOTH); *tl++ = txdr_unsigned((mode >> NFSLCK_SHIFT) & NFSV4OPEN_DENYBOTH); - *tl++ = NFSMNT_MDSSESSION(nmp)->nfsess_clientid.lval[0]; - *tl = NFSMNT_MDSSESSION(nmp)->nfsess_clientid.lval[1]; + tsep = nfsmnt_mdssession(nmp); + *tl++ = tsep->nfsess_clientid.lval[0]; + *tl = tsep->nfsess_clientid.lval[1]; (void) nfsm_strtom(nd, op->nfso_own->nfsow_owner, NFSV4CL_LOCKNAMELEN); NFSM_BUILD(tl, u_int32_t *, 2 * NFSX_UNSIGNED); *tl++ = txdr_unsigned(NFSV4OPEN_NOCREATE); @@ -557,7 +559,7 @@ nfsrpc_openrpc(struct nfsmount *nmp, vno } if (nd->nd_repstat != 0 && error == 0) error = nd->nd_repstat; - if (error == NFSERR_STALECLIENTID || error == NFSERR_BADSESSION) + if (error == NFSERR_STALECLIENTID) nfscl_initiate_recovery(op->nfso_own->nfsow_clp); nfsmout: if (!error) @@ -604,7 +606,7 @@ nfsrpc_opendowngrade(vnode_t vp, u_int32 } if (nd->nd_repstat && error == 0) error = nd->nd_repstat; - if (error == NFSERR_STALESTATEID || error == NFSERR_BADSESSION) + if (error == NFSERR_STALESTATEID) nfscl_initiate_recovery(op->nfso_own->nfsow_clp); nfsmout: mbuf_freem(nd->nd_mrep); @@ -762,7 +764,7 @@ nfsrpc_closerpc(struct nfsrv_descript *n if (nd->nd_repstat == 0) NFSM_DISSECT(tl, u_int32_t *, NFSX_STATEID); error = nd->nd_repstat; - if (error == NFSERR_STALESTATEID || error == NFSERR_BADSESSION) + if (error == NFSERR_STALESTATEID) nfscl_initiate_recovery(op->nfso_own->nfsow_clp); nfsmout: mbuf_freem(nd->nd_mrep); @@ -803,7 +805,7 @@ nfsrpc_openconfirm(vnode_t vp, u_int8_t op->nfso_stateid.other[2] = *tl; } error = nd->nd_repstat; - if (error == NFSERR_STALESTATEID || error == NFSERR_BADSESSION) + if (error == NFSERR_STALESTATEID) nfscl_initiate_recovery(op->nfso_own->nfsow_clp); nfsmout: mbuf_freem(nd->nd_mrep); @@ -828,33 +830,53 @@ nfsrpc_setclient(struct nfsmount *nmp, s nfsquad_t confirm; u_int32_t lease; static u_int32_t rev = 0; - struct nfsclds *dsp, *ndsp, *tdsp; + struct nfsclds *dsp; struct in6_addr a6; + struct nfsclsession *tsep; if (nfsboottime.tv_sec == 0) NFSSETBOOTTIME(nfsboottime); clp->nfsc_rev = rev++; if (NFSHASNFSV4N(nmp)) { + /* + * Either there was no previous session or the + * previous session has failed, so... + * do an ExchangeID followed by the CreateSession. + */ error = nfsrpc_exchangeid(nmp, clp, &nmp->nm_sockreq, NFSV4EXCH_USEPNFSMDS | NFSV4EXCH_USENONPNFS, &dsp, cred, p); NFSCL_DEBUG(1, "aft exch=%d\n", error); - if (error == 0) { + if (error == 0) error = nfsrpc_createsession(nmp, &dsp->nfsclds_sess, &nmp->nm_sockreq, dsp->nfsclds_sess.nfsess_sequenceid, 1, cred, p); - if (error == 0) { - NFSLOCKMNT(nmp); - TAILQ_FOREACH_SAFE(tdsp, &nmp->nm_sess, - nfsclds_list, ndsp) - nfscl_freenfsclds(tdsp); - TAILQ_INIT(&nmp->nm_sess); - TAILQ_INSERT_HEAD(&nmp->nm_sess, dsp, - nfsclds_list); - NFSUNLOCKMNT(nmp); - } else - nfscl_freenfsclds(dsp); - NFSCL_DEBUG(1, "aft createsess=%d\n", error); - } + if (error == 0) { + NFSLOCKMNT(nmp); + /* + * The old sessions cannot be safely free'd + * here, since they may still be used by + * in-progress RPCs. + */ + tsep = NULL; + if (TAILQ_FIRST(&nmp->nm_sess) != NULL) + tsep = NFSMNT_MDSSESSION(nmp); + TAILQ_INSERT_HEAD(&nmp->nm_sess, dsp, + nfsclds_list); + /* + * Wake up RPCs waiting for a slot on the + * old session. These will then fail with + * NFSERR_BADSESSION and be retried with the + * new session by nfsv4_setsequence(). + * Also wakeup() processes waiting for the + * new session. + */ + if (tsep != NULL) + wakeup(&tsep->nfsess_slots); + wakeup(&nmp->nm_sess); + NFSUNLOCKMNT(nmp); + } else + nfscl_freenfsclds(dsp); + NFSCL_DEBUG(1, "aft createsess=%d\n", error); if (error == 0 && reclaim == 0) { error = nfsrpc_reclaimcomplete(nmp, cred, p); NFSCL_DEBUG(1, "aft reclaimcomp=%d\n", error); @@ -875,6 +897,7 @@ nfsrpc_setclient(struct nfsmount *nmp, s mtx_init(&dsp->nfsclds_sess.nfsess_mtx, "nfssession", NULL, MTX_DEF); NFSLOCKMNT(nmp); TAILQ_INSERT_HEAD(&nmp->nm_sess, dsp, nfsclds_list); + tsep = NFSMNT_MDSSESSION(nmp); NFSUNLOCKMNT(nmp); nfscl_reqstart(nd, NFSPROC_SETCLIENTID, nmp, NULL, 0, NULL, NULL); @@ -936,8 +959,8 @@ nfsrpc_setclient(struct nfsmount *nmp, s return (error); if (nd->nd_repstat == 0) { NFSM_DISSECT(tl, u_int32_t *, 4 * NFSX_UNSIGNED); - NFSMNT_MDSSESSION(nmp)->nfsess_clientid.lval[0] = *tl++; - NFSMNT_MDSSESSION(nmp)->nfsess_clientid.lval[1] = *tl++; + tsep->nfsess_clientid.lval[0] = *tl++; + tsep->nfsess_clientid.lval[1] = *tl++; confirm.lval[0] = *tl++; confirm.lval[1] = *tl; mbuf_freem(nd->nd_mrep); @@ -949,8 +972,8 @@ nfsrpc_setclient(struct nfsmount *nmp, s nfscl_reqstart(nd, NFSPROC_SETCLIENTIDCFRM, nmp, NULL, 0, NULL, NULL); NFSM_BUILD(tl, u_int32_t *, 4 * NFSX_UNSIGNED); - *tl++ = NFSMNT_MDSSESSION(nmp)->nfsess_clientid.lval[0]; - *tl++ = NFSMNT_MDSSESSION(nmp)->nfsess_clientid.lval[1]; + *tl++ = tsep->nfsess_clientid.lval[0]; + *tl++ = tsep->nfsess_clientid.lval[1]; *tl++ = confirm.lval[0]; *tl = confirm.lval[1]; nd->nd_flag |= ND_USEGSSNAME; @@ -1111,7 +1134,7 @@ nfsrpc_setattr(vnode_t vp, struct vattr else error = nfsrpc_setaclrpc(vp, cred, p, aclp, &stateid, stuff); - if (error == NFSERR_STALESTATEID || error == NFSERR_BADSESSION) + if (error == NFSERR_STALESTATEID) nfscl_initiate_recovery(nmp->nm_clp); if (lckp != NULL) nfscl_lockderef(lckp); @@ -1368,7 +1391,7 @@ nfsrpc_read(vnode_t vp, struct uio *uiop &lckp); error = nfsrpc_readrpc(vp, uiop, newcred, &stateid, p, nap, attrflagp, stuff); - if (error == NFSERR_STALESTATEID || error == NFSERR_BADSESSION) + if (error == NFSERR_STALESTATEID) nfscl_initiate_recovery(nmp->nm_clp); if (lckp != NULL) nfscl_lockderef(lckp); @@ -1538,7 +1561,7 @@ nfsrpc_write(vnode_t vp, struct uio *uio else error = nfsrpc_writerpc(vp, uiop, iomode, must_commit, newcred, &stateid, p, nap, attrflagp, stuff); - if (error == NFSERR_STALESTATEID || error == NFSERR_BADSESSION) + if (error == NFSERR_STALESTATEID) nfscl_initiate_recovery(nmp->nm_clp); if (lckp != NULL) nfscl_lockderef(lckp); @@ -1964,6 +1987,7 @@ nfsrpc_createv4(vnode_t dvp, char *name, nfsv4stateid_t stateid; u_int32_t rflags; struct nfsmount *nmp; + struct nfsclsession *tsep; nmp = VFSTONFS(dvp->v_mount); np = VTONFS(dvp); @@ -1983,8 +2007,9 @@ nfsrpc_createv4(vnode_t dvp, char *name, *tl++ = txdr_unsigned(NFSV4OPEN_ACCESSWRITE | NFSV4OPEN_ACCESSREAD); *tl++ = txdr_unsigned(NFSV4OPEN_DENYNONE); - *tl++ = NFSMNT_MDSSESSION(nmp)->nfsess_clientid.lval[0]; - *tl = NFSMNT_MDSSESSION(nmp)->nfsess_clientid.lval[1]; + tsep = nfsmnt_mdssession(nmp); + *tl++ = tsep->nfsess_clientid.lval[0]; + *tl = tsep->nfsess_clientid.lval[1]; (void) nfsm_strtom(nd, owp->nfsow_owner, NFSV4CL_LOCKNAMELEN); NFSM_BUILD(tl, u_int32_t *, 2 * NFSX_UNSIGNED); *tl++ = txdr_unsigned(NFSV4OPEN_CREATE); @@ -2178,7 +2203,7 @@ nfsrpc_createv4(vnode_t dvp, char *name, } if (nd->nd_repstat != 0 && error == 0) error = nd->nd_repstat; - if (error == NFSERR_STALECLIENTID || error == NFSERR_BADSESSION) + if (error == NFSERR_STALECLIENTID) nfscl_initiate_recovery(owp->nfsow_clp); nfsmout: if (!error) @@ -3840,6 +3865,7 @@ nfsrpc_lockt(struct nfsrv_descript *nd, uint8_t own[NFSV4CL_LOCKNAMELEN + NFSX_V4FHMAX]; struct nfsnode *np; struct nfsmount *nmp; + struct nfsclsession *tsep; nmp = VFSTONFS(vp->v_mount); NFSCL_REQSTART(nd, NFSPROC_LOCKT, vp); @@ -3852,8 +3878,9 @@ nfsrpc_lockt(struct nfsrv_descript *nd, tl += 2; txdr_hyper(len, tl); tl += 2; - *tl++ = NFSMNT_MDSSESSION(nmp)->nfsess_clientid.lval[0]; - *tl = NFSMNT_MDSSESSION(nmp)->nfsess_clientid.lval[1]; + tsep = nfsmnt_mdssession(nmp); + *tl++ = tsep->nfsess_clientid.lval[0]; + *tl = tsep->nfsess_clientid.lval[1]; nfscl_filllockowner(id, own, flags); np = VTONFS(vp); NFSBCOPY(np->n_fhp->nfh_fh, &own[NFSV4CL_LOCKNAMELEN], @@ -3893,8 +3920,7 @@ nfsrpc_lockt(struct nfsrv_descript *nd, error = EBADRPC; if (!error) error = nfsm_advance(nd, NFSM_RNDUP(size), -1); - } else if (nd->nd_repstat == NFSERR_STALECLIENTID || - nd->nd_repstat == NFSERR_BADSESSION) + } else if (nd->nd_repstat == NFSERR_STALECLIENTID) nfscl_initiate_recovery(clp); nfsmout: mbuf_freem(nd->nd_mrep); @@ -3944,8 +3970,7 @@ nfsrpc_locku(struct nfsrv_descript *nd, lp->nfsl_stateid.other[0] = *tl++; lp->nfsl_stateid.other[1] = *tl++; lp->nfsl_stateid.other[2] = *tl; - } else if (nd->nd_repstat == NFSERR_STALESTATEID || - nd->nd_repstat == NFSERR_BADSESSION) + } else if (nd->nd_repstat == NFSERR_STALESTATEID) nfscl_initiate_recovery(lp->nfsl_open->nfso_own->nfsow_clp); nfsmout: mbuf_freem(nd->nd_mrep); @@ -3964,6 +3989,7 @@ nfsrpc_lock(struct nfsrv_descript *nd, s u_int32_t *tl; int error, size; uint8_t own[NFSV4CL_LOCKNAMELEN + NFSX_V4FHMAX]; + struct nfsclsession *tsep; nfscl_reqstart(nd, NFSPROC_LOCK, nmp, nfhp, fhlen, NULL, NULL); NFSM_BUILD(tl, u_int32_t *, 7 * NFSX_UNSIGNED); @@ -3989,8 +4015,9 @@ nfsrpc_lock(struct nfsrv_descript *nd, s *tl++ = lp->nfsl_open->nfso_stateid.other[1]; *tl++ = lp->nfsl_open->nfso_stateid.other[2]; *tl++ = txdr_unsigned(lp->nfsl_seqid); - *tl++ = NFSMNT_MDSSESSION(nmp)->nfsess_clientid.lval[0]; - *tl = NFSMNT_MDSSESSION(nmp)->nfsess_clientid.lval[1]; + tsep = nfsmnt_mdssession(nmp); + *tl++ = tsep->nfsess_clientid.lval[0]; + *tl = tsep->nfsess_clientid.lval[1]; NFSBCOPY(lp->nfsl_owner, own, NFSV4CL_LOCKNAMELEN); NFSBCOPY(nfhp, &own[NFSV4CL_LOCKNAMELEN], fhlen); (void)nfsm_strtom(nd, own, NFSV4CL_LOCKNAMELEN + fhlen); @@ -4031,8 +4058,7 @@ nfsrpc_lock(struct nfsrv_descript *nd, s error = EBADRPC; if (!error) error = nfsm_advance(nd, NFSM_RNDUP(size), -1); - } else if (nd->nd_repstat == NFSERR_STALESTATEID || - nd->nd_repstat == NFSERR_BADSESSION) + } else if (nd->nd_repstat == NFSERR_STALESTATEID) nfscl_initiate_recovery(lp->nfsl_open->nfso_own->nfsow_clp); nfsmout: mbuf_freem(nd->nd_mrep); @@ -4232,25 +4258,36 @@ nfsrpc_renew(struct nfsclclient *clp, st struct nfsmount *nmp; int error; struct nfssockreq *nrp; + struct nfsclsession *tsep; nmp = clp->nfsc_nmp; if (nmp == NULL) return (0); - nfscl_reqstart(nd, NFSPROC_RENEW, nmp, NULL, 0, NULL, - &dsp->nfsclds_sess); + if (dsp == NULL) + nfscl_reqstart(nd, NFSPROC_RENEW, nmp, NULL, 0, NULL, NULL); + else + nfscl_reqstart(nd, NFSPROC_RENEW, nmp, NULL, 0, NULL, + &dsp->nfsclds_sess); if (!NFSHASNFSV4N(nmp)) { /* NFSv4.1 just uses a Sequence Op and not a Renew. */ NFSM_BUILD(tl, u_int32_t *, 2 * NFSX_UNSIGNED); - *tl++ = NFSMNT_MDSSESSION(nmp)->nfsess_clientid.lval[0]; - *tl = NFSMNT_MDSSESSION(nmp)->nfsess_clientid.lval[1]; - } - nrp = dsp->nfsclds_sockp; + tsep = nfsmnt_mdssession(nmp); + *tl++ = tsep->nfsess_clientid.lval[0]; + *tl = tsep->nfsess_clientid.lval[1]; + } + nrp = NULL; + if (dsp != NULL) + nrp = dsp->nfsclds_sockp; if (nrp == NULL) /* If NULL, use the MDS socket. */ nrp = &nmp->nm_sockreq; nd->nd_flag |= ND_USEGSSNAME; - error = newnfs_request(nd, nmp, NULL, nrp, NULL, p, cred, - NFS_PROG, NFS_VER4, NULL, 1, NULL, &dsp->nfsclds_sess); + if (dsp == NULL) + error = newnfs_request(nd, nmp, NULL, nrp, NULL, p, cred, + NFS_PROG, NFS_VER4, NULL, 1, NULL, NULL); + else + error = newnfs_request(nd, nmp, NULL, nrp, NULL, p, cred, + NFS_PROG, NFS_VER4, NULL, 1, NULL, &dsp->nfsclds_sess); if (error) return (error); error = nd->nd_repstat; @@ -4269,6 +4306,7 @@ nfsrpc_rellockown(struct nfsmount *nmp, u_int32_t *tl; int error; uint8_t own[NFSV4CL_LOCKNAMELEN + NFSX_V4FHMAX]; + struct nfsclsession *tsep; if (NFSHASNFSV4N(nmp)) { /* For NFSv4.1, do a FreeStateID. */ @@ -4279,8 +4317,9 @@ nfsrpc_rellockown(struct nfsmount *nmp, nfscl_reqstart(nd, NFSPROC_RELEASELCKOWN, nmp, NULL, 0, NULL, NULL); NFSM_BUILD(tl, u_int32_t *, 2 * NFSX_UNSIGNED); - *tl++ = NFSMNT_MDSSESSION(nmp)->nfsess_clientid.lval[0]; - *tl = NFSMNT_MDSSESSION(nmp)->nfsess_clientid.lval[1]; + tsep = nfsmnt_mdssession(nmp); + *tl++ = tsep->nfsess_clientid.lval[0]; + *tl = tsep->nfsess_clientid.lval[1]; NFSBCOPY(lp->nfsl_owner, own, NFSV4CL_LOCKNAMELEN); NFSBCOPY(fh, &own[NFSV4CL_LOCKNAMELEN], fhlen); (void)nfsm_strtom(nd, own, NFSV4CL_LOCKNAMELEN + fhlen); @@ -4518,7 +4557,7 @@ nfsrpc_exchangeid(struct nfsmount *nmp, error = NFSERR_BADXDR; goto nfsmout; } - dsp = malloc(sizeof(struct nfsclds) + len, M_NFSCLDS, + dsp = malloc(sizeof(struct nfsclds) + len + 1, M_NFSCLDS, M_WAITOK | M_ZERO); dsp->nfsclds_expire = NFSD_MONOSEC + clp->nfsc_renew; dsp->nfsclds_servownlen = len; @@ -4661,10 +4700,12 @@ nfsrpc_destroysession(struct nfsmount *n struct nfsrv_descript nfsd; struct nfsrv_descript *nd = &nfsd; int error; + struct nfsclsession *tsep; nfscl_reqstart(nd, NFSPROC_DESTROYSESSION, nmp, NULL, 0, NULL, NULL); NFSM_BUILD(tl, uint32_t *, NFSX_V4SESSIONID); - bcopy(NFSMNT_MDSSESSION(nmp)->nfsess_sessionid, tl, NFSX_V4SESSIONID); + tsep = nfsmnt_mdssession(nmp); + bcopy(tsep->nfsess_sessionid, tl, NFSX_V4SESSIONID); nd->nd_flag |= ND_USEGSSNAME; error = newnfs_request(nd, nmp, NULL, &nmp->nm_sockreq, NULL, p, cred, NFS_PROG, NFS_VER4, NULL, 1, NULL, NULL); @@ -4686,11 +4727,13 @@ nfsrpc_destroyclient(struct nfsmount *nm struct nfsrv_descript nfsd; struct nfsrv_descript *nd = &nfsd; int error; + struct nfsclsession *tsep; nfscl_reqstart(nd, NFSPROC_DESTROYCLIENT, nmp, NULL, 0, NULL, NULL); NFSM_BUILD(tl, uint32_t *, 2 * NFSX_UNSIGNED); - *tl++ = NFSMNT_MDSSESSION(nmp)->nfsess_clientid.lval[0]; - *tl = NFSMNT_MDSSESSION(nmp)->nfsess_clientid.lval[1]; + tsep = nfsmnt_mdssession(nmp); + *tl++ = tsep->nfsess_clientid.lval[0]; + *tl = tsep->nfsess_clientid.lval[1]; nd->nd_flag |= ND_USEGSSNAME; error = newnfs_request(nd, nmp, NULL, &nmp->nm_sockreq, NULL, p, cred, NFS_PROG, NFS_VER4, NULL, 1, NULL, NULL); @@ -5158,6 +5201,7 @@ nfsrpc_getlayout(struct nfsmount *nmp, v struct nfsclflayouthead flh; int error = 0, islocked, layoutlen, recalled, retonclose; nfsv4stateid_t stateid; + struct nfsclsession *tsep; *lypp = NULL; /* @@ -5172,7 +5216,8 @@ nfsrpc_getlayout(struct nfsmount *nmp, v if (recalled != 0) return (EIO); LIST_INIT(&flh); - layoutlen = NFSMNT_MDSSESSION(nmp)->nfsess_maxcache - + tsep = nfsmnt_mdssession(nmp); + layoutlen = tsep->nfsess_maxcache - (NFSX_STATEID + 3 * NFSX_UNSIGNED); if (lyp == NULL) { stateid.seqid = 0; @@ -5269,7 +5314,8 @@ nfsrpc_fillsa(struct nfsmount *nmp, stru if (msad != NULL && msad->sin_family == AF_INET && ssd->sin_addr.s_addr == msad->sin_addr.s_addr && ssd->sin_port == msad->sin_port && - (tdsp->nfsclds_flags & NFSCLDS_DS) != 0) { + (tdsp->nfsclds_flags & NFSCLDS_DS) != 0 && + tdsp->nfsclds_sess.nfsess_defunct == 0) { *dspp = tdsp; NFSUNLOCKMNT(nmp); NFSCL_DEBUG(4, "fnd same addr\n"); @@ -5309,7 +5355,8 @@ nfsrpc_fillsa(struct nfsmount *nmp, stru IN6_ARE_ADDR_EQUAL(&ssd6->sin6_addr, &msad6->sin6_addr) && ssd6->sin6_port == msad6->sin6_port && - (tdsp->nfsclds_flags & NFSCLDS_DS) != 0) { + (tdsp->nfsclds_flags & NFSCLDS_DS) != 0 && + tdsp->nfsclds_sess.nfsess_defunct == 0) { *dspp = tdsp; NFSUNLOCKMNT(nmp); return (0); @@ -5862,7 +5909,8 @@ nfscl_getsameserver(struct nfsmount *nmp if (dsp->nfsclds_servownlen == newdsp->nfsclds_servownlen && dsp->nfsclds_servownlen != 0 && !NFSBCMP(dsp->nfsclds_serverown, newdsp->nfsclds_serverown, - dsp->nfsclds_servownlen)) { + dsp->nfsclds_servownlen) && + dsp->nfsclds_sess.nfsess_defunct == 0) { NFSCL_DEBUG(4, "fnd same fdsp=%p dsp=%p flg=0x%x\n", TAILQ_FIRST(&nmp->nm_sess), dsp, dsp->nfsclds_flags); Modified: head/sys/fs/nfsclient/nfs_clstate.c ============================================================================== --- head/sys/fs/nfsclient/nfs_clstate.c Fri Dec 23 22:42:14 2016 (r310490) +++ head/sys/fs/nfsclient/nfs_clstate.c Fri Dec 23 23:14:53 2016 (r310491) @@ -2470,8 +2470,11 @@ nfscl_renewthread(struct nfsclclient *cl if (recover_done_time < NFSD_MONOSEC) { recover_done_time = NFSD_MONOSEC + clp->nfsc_renew; + NFSCL_DEBUG(1, "Doing recovery..\n"); nfscl_recover(clp, cred, p); } else { + NFSCL_DEBUG(1, "Clear Recovery dt=%u ms=%jd\n", + recover_done_time, (intmax_t)NFSD_MONOSEC); NFSLOCKCLSTATE(); clp->nfsc_flags &= ~NFSCLFLAGS_RECOVER; NFSUNLOCKCLSTATE(); @@ -2481,8 +2484,7 @@ nfscl_renewthread(struct nfsclclient *cl (clp->nfsc_flags & NFSCLFLAGS_HASCLIENTID)) { clp->nfsc_expire = NFSD_MONOSEC + clp->nfsc_renew; clidrev = clp->nfsc_clientidrev; - error = nfsrpc_renew(clp, - TAILQ_FIRST(&clp->nfsc_nmp->nm_sess), cred, p); + error = nfsrpc_renew(clp, NULL, cred, p); if (error == NFSERR_CBPATHDOWN) cbpathdown = 1; else if (error == NFSERR_STALECLIENTID || @@ -2494,24 +2496,27 @@ nfscl_renewthread(struct nfsclclient *cl (void) nfscl_hasexpired(clp, clidrev, p); } - /* Do renews for any DS sessions. */ checkdsrenew: - NFSLOCKMNT(clp->nfsc_nmp); - /* Skip first entry, since the MDS is handled above. */ - dsp = TAILQ_FIRST(&clp->nfsc_nmp->nm_sess); - if (dsp != NULL) - dsp = TAILQ_NEXT(dsp, nfsclds_list); - while (dsp != NULL) { - if (dsp->nfsclds_expire <= NFSD_MONOSEC) { - dsp->nfsclds_expire = NFSD_MONOSEC + - clp->nfsc_renew; - NFSUNLOCKMNT(clp->nfsc_nmp); - (void)nfsrpc_renew(clp, dsp, cred, p); - goto checkdsrenew; + if (NFSHASNFSV4N(clp->nfsc_nmp)) { + /* Do renews for any DS sessions. */ + NFSLOCKMNT(clp->nfsc_nmp); + /* Skip first entry, since the MDS is handled above. */ + dsp = TAILQ_FIRST(&clp->nfsc_nmp->nm_sess); + if (dsp != NULL) + dsp = TAILQ_NEXT(dsp, nfsclds_list); + while (dsp != NULL) { + if (dsp->nfsclds_expire <= NFSD_MONOSEC && + dsp->nfsclds_sess.nfsess_defunct == 0) { + dsp->nfsclds_expire = NFSD_MONOSEC + + clp->nfsc_renew; + NFSUNLOCKMNT(clp->nfsc_nmp); + (void)nfsrpc_renew(clp, dsp, cred, p); + goto checkdsrenew; + } + dsp = TAILQ_NEXT(dsp, nfsclds_list); } - dsp = TAILQ_NEXT(dsp, nfsclds_list); + NFSUNLOCKMNT(clp->nfsc_nmp); } - NFSUNLOCKMNT(clp->nfsc_nmp); TAILQ_INIT(&dh); NFSLOCKCLSTATE(); @@ -3163,6 +3168,7 @@ nfscl_docb(struct nfsrv_descript *nd, NF int changed, gotone, laytype, recalltype; uint32_t iomode; struct nfsclrecalllayout *recallp = NULL; + struct nfsclsession *tsep; gotseq_ok = 0; nfsrvd_rephead(nd); @@ -3472,13 +3478,12 @@ nfscl_docb(struct nfsrv_descript *nd, NF error = NFSERR_SERVERFAULT; } else error = NFSERR_SEQUENCEPOS; - if (error == 0) + if (error == 0) { + tsep = nfsmnt_mdssession(clp->nfsc_nmp); error = nfsv4_seqsession(seqid, slotid, - highslot, - NFSMNT_MDSSESSION(clp->nfsc_nmp)-> - nfsess_cbslots, &rep, - NFSMNT_MDSSESSION(clp->nfsc_nmp)-> - nfsess_backslots); + highslot, tsep->nfsess_cbslots, &rep, + tsep->nfsess_backslots); + } NFSUNLOCKCLSTATE(); if (error == 0) { gotseq_ok = 1; @@ -3546,8 +3551,8 @@ out: NFSLOCKCLSTATE(); clp = nfscl_getclntsess(sessionid); if (clp != NULL) { - nfsv4_seqsess_cacherep(slotid, - NFSMNT_MDSSESSION(clp->nfsc_nmp)->nfsess_cbslots, + tsep = nfsmnt_mdssession(clp->nfsc_nmp); + nfsv4_seqsess_cacherep(slotid, tsep->nfsess_cbslots, NFSERR_OK, &rep); NFSUNLOCKCLSTATE(); *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@freebsd.org Sat Dec 24 00:30:30 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id EEB50C8EEC8; Sat, 24 Dec 2016 00:30:30 +0000 (UTC) (envelope-from gonzo@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id BE702F65; Sat, 24 Dec 2016 00:30:30 +0000 (UTC) (envelope-from gonzo@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBO0UTT3019743; Sat, 24 Dec 2016 00:30:29 GMT (envelope-from gonzo@FreeBSD.org) Received: (from gonzo@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBO0UTTL019742; Sat, 24 Dec 2016 00:30:29 GMT (envelope-from gonzo@FreeBSD.org) Message-Id: <201612240030.uBO0UTTL019742@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gonzo set sender to gonzo@FreeBSD.org using -f From: Oleksandr Tymoshenko Date: Sat, 24 Dec 2016 00:30:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310492 - head/sys/dev/spibus X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 24 Dec 2016 00:30:31 -0000 Author: gonzo Date: Sat Dec 24 00:30:29 2016 New Revision: 310492 URL: https://svnweb.freebsd.org/changeset/base/310492 Log: [spigen] Fix spigen attaching as a driver for SPI devices nodes in FDT Return BUS_PROBE_NOWILDCARD in probe method to make sure that spigen attaches only to the device created in identify method. Before this change spigen probe method used to return 0 which meant it competed with other drivers to be attached to the devices created for child nodes of SPI bus node in FDT. Reported by: Daniel Braniss MFC after: 1 week Modified: head/sys/dev/spibus/spigen.c Modified: head/sys/dev/spibus/spigen.c ============================================================================== --- head/sys/dev/spibus/spigen.c Fri Dec 23 23:14:53 2016 (r310491) +++ head/sys/dev/spibus/spigen.c Sat Dec 24 00:30:29 2016 (r310492) @@ -81,8 +81,10 @@ spigen_identify(driver_t *driver, device static int spigen_probe(device_t dev) { + device_set_desc(dev, "SPI Generic IO"); - return (0); + + return (BUS_PROBE_NOWILDCARD); } static int spigen_open(struct cdev *, int, int, struct thread *); From owner-svn-src-all@freebsd.org Sat Dec 24 02:31:27 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id DAFFDC8DFC7; Sat, 24 Dec 2016 02:31:27 +0000 (UTC) (envelope-from kan@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B5A436E4; Sat, 24 Dec 2016 02:31:27 +0000 (UTC) (envelope-from kan@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBO2VQdr068529; Sat, 24 Dec 2016 02:31:26 GMT (envelope-from kan@FreeBSD.org) Received: (from kan@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBO2VQgA068527; Sat, 24 Dec 2016 02:31:26 GMT (envelope-from kan@FreeBSD.org) Message-Id: <201612240231.uBO2VQgA068527@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kan set sender to kan@FreeBSD.org using -f From: Alexander Kabaev Date: Sat, 24 Dec 2016 02:31:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310493 - head/sys/mips/ingenic X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 24 Dec 2016 02:31:28 -0000 Author: kan Date: Sat Dec 24 02:31:26 2016 New Revision: 310493 URL: https://svnweb.freebsd.org/changeset/base/310493 Log: Add driver for JZ4780 RTC device. Only support basic timekeeping for now. Added: head/sys/mips/ingenic/jz4780_rtc.c (contents, props changed) Modified: head/sys/mips/ingenic/files.jz4780 Modified: head/sys/mips/ingenic/files.jz4780 ============================================================================== --- head/sys/mips/ingenic/files.jz4780 Sat Dec 24 00:30:29 2016 (r310492) +++ head/sys/mips/ingenic/files.jz4780 Sat Dec 24 02:31:26 2016 (r310493) @@ -21,6 +21,7 @@ mips/ingenic/jz4780_machdep.c standard mips/ingenic/jz4780_nemc.c standard mips/ingenic/jz4780_pdma.c standard mips/ingenic/jz4780_pinctrl.c standard +mips/ingenic/jz4780_rtc.c standard mips/ingenic/jz4780_timer.c standard # Sound Added: head/sys/mips/ingenic/jz4780_rtc.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/mips/ingenic/jz4780_rtc.c Sat Dec 24 02:31:26 2016 (r310493) @@ -0,0 +1,234 @@ +/*- + * Copyright 2016 Alexander Kabaev + * 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. + */ + +/* + * Ingenic JZ4780 RTC driver + * + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +#include +#include + +#include "clock_if.h" + +#define JZ_RTC_TIMEOUT 5000 + +#define JZ_RTCCR 0x00 +# define JZ_RTCCR_WRDY (1u << 7) +#define JZ_RTSR 0x04 +#define JZ_HSPR 0x34 +#define JZ_WENR 0x3C +# define JZ_WENR_PAT 0xa55a +# define JZ_WENR_WEN (1u <<31) + +struct jz4780_rtc_softc { + device_t dev; + struct resource *res[2]; +}; + +static struct resource_spec jz4780_rtc_spec[] = { + { SYS_RES_MEMORY, 0, RF_ACTIVE }, + { SYS_RES_IRQ, 0, RF_ACTIVE }, + { -1, 0 } +}; + +#define CSR_READ(sc, reg) bus_read_4((sc)->res[0], (reg)) +#define CSR_WRITE(sc, reg, val) bus_write_4((sc)->res[0], (reg), (val)) + +static int jz4780_rtc_probe(device_t dev); +static int jz4780_rtc_attach(device_t dev); +static int jz4780_rtc_detach(device_t dev); + +static int +jz4780_rtc_probe(device_t dev) +{ + + if (!ofw_bus_status_okay(dev)) + return (ENXIO); + + if (!ofw_bus_is_compatible(dev, "ingenic,jz4780-rtc")) + return (ENXIO); + + device_set_desc(dev, "JZ4780 RTC"); + + return (BUS_PROBE_DEFAULT); +} + +/* Poll control register until RTC is ready to accept register writes */ +static int +jz4780_rtc_wait(struct jz4780_rtc_softc *sc) +{ + int timeout; + + timeout = JZ_RTC_TIMEOUT; + while (timeout-- > 0) { + if (CSR_READ(sc, JZ_RTCCR) & JZ_RTCCR_WRDY) + return (0); + } + return (EIO); +} + +/* + * Write RTC register. It appears that RTC goes into read-only mode at random, + * which suggests something is up with how it is powered up, so do the pattern + * writing dance every time just in case. + */ +static int +jz4780_rtc_write(struct jz4780_rtc_softc *sc, uint32_t reg, uint32_t val) +{ + int ret, timeout; + + ret = jz4780_rtc_wait(sc); + if (ret != 0) + return (ret); + + CSR_WRITE(sc, JZ_WENR, JZ_WENR_PAT); + + ret = jz4780_rtc_wait(sc); + if (ret) + return ret; + + timeout = JZ_RTC_TIMEOUT; + while (timeout-- > 0) { + if (CSR_READ(sc, JZ_WENR) & JZ_WENR_WEN) + break; + } + if (timeout < 0) + return (EIO); + + CSR_WRITE(sc, reg, val); + return 0; +} + +static int +jz4780_rtc_attach(device_t dev) +{ + struct jz4780_rtc_softc *sc = device_get_softc(dev); + uint32_t scratch; + int ret; + + sc->dev = dev; + + if (bus_alloc_resources(dev, jz4780_rtc_spec, sc->res)) { + device_printf(dev, "could not allocate resources for device\n"); + return (ENXIO); + } + + scratch = CSR_READ(sc, JZ_HSPR); + if (scratch != 0x12345678) { + ret = jz4780_rtc_write(sc, JZ_HSPR, 0x12345678); + if (ret == 0) + ret = jz4780_rtc_write(sc, JZ_RTSR, 0); + if (ret) { + device_printf(dev, "Unable to write RTC registers\n"); + jz4780_rtc_detach(dev); + return (ret); + } + } + clock_register(dev, 1000000); /* Register 1 HZ clock */ + return (0); +} + +static int +jz4780_rtc_detach(device_t dev) +{ + struct jz4780_rtc_softc *sc; + + sc = device_get_softc(dev); + bus_release_resources(dev, jz4780_rtc_spec, sc->res); + return (0); +} + +static int +jz4780_rtc_gettime(device_t dev, struct timespec *ts) +{ + struct jz4780_rtc_softc *sc; + uint32_t val1, val2; + int timeout; + + sc = device_get_softc(dev); + + timeout = JZ_RTC_TIMEOUT; + val2 = CSR_READ(sc, JZ_RTSR); + do { + val1 = val2; + val2 = CSR_READ(sc, JZ_RTSR); + } while (val1 != val2 && timeout-- >= 0); + + if (timeout < 0) + return (EIO); + + /* Convert secs to timespec directly */ + ts->tv_sec = val1; + ts->tv_nsec = 0; + return 0; +} + +static int +jz4780_rtc_settime(device_t dev, struct timespec *ts) +{ + struct jz4780_rtc_softc *sc; + + sc = device_get_softc(dev); + return jz4780_rtc_write(sc, JZ_RTSR, ts->tv_sec); +} + +static device_method_t jz4780_rtc_methods[] = { + /* Device interface */ + DEVMETHOD(device_probe, jz4780_rtc_probe), + DEVMETHOD(device_attach, jz4780_rtc_attach), + DEVMETHOD(device_detach, jz4780_rtc_detach), + + DEVMETHOD(clock_gettime, jz4780_rtc_gettime), + DEVMETHOD(clock_settime, jz4780_rtc_settime), + + DEVMETHOD_END +}; + +static driver_t jz4780_rtc_driver = { + "jz4780_rtc", + jz4780_rtc_methods, + sizeof(struct jz4780_rtc_softc), +}; + +static devclass_t jz4780_rtc_devclass; + +EARLY_DRIVER_MODULE(jz4780_rtc, simplebus, jz4780_rtc_driver, + jz4780_rtc_devclass, 0, 0, BUS_PASS_TIMER + BUS_PASS_ORDER_MIDDLE); From owner-svn-src-all@freebsd.org Sat Dec 24 07:13:34 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E080BC8EFFB; Sat, 24 Dec 2016 07:13:34 +0000 (UTC) (envelope-from hrs@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B02421F3C; Sat, 24 Dec 2016 07:13:34 +0000 (UTC) (envelope-from hrs@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBO7DXFg085088; Sat, 24 Dec 2016 07:13:33 GMT (envelope-from hrs@FreeBSD.org) Received: (from hrs@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBO7DXlD085087; Sat, 24 Dec 2016 07:13:33 GMT (envelope-from hrs@FreeBSD.org) Message-Id: <201612240713.uBO7DXlD085087@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hrs set sender to hrs@FreeBSD.org using -f From: Hiroki Sato Date: Sat, 24 Dec 2016 07:13:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310494 - head/usr.sbin/syslogd X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 24 Dec 2016 07:13:35 -0000 Author: hrs Date: Sat Dec 24 07:13:33 2016 New Revision: 310494 URL: https://svnweb.freebsd.org/changeset/base/310494 Log: - Remove unused code. - Use closefrom(). Modified: head/usr.sbin/syslogd/syslogd.c Modified: head/usr.sbin/syslogd/syslogd.c ============================================================================== --- head/usr.sbin/syslogd/syslogd.c Sat Dec 24 02:31:26 2016 (r310493) +++ head/usr.sbin/syslogd/syslogd.c Sat Dec 24 07:13:33 2016 (r310494) @@ -357,7 +357,7 @@ static void usage(void); static int validate(struct sockaddr *, const char *); static void unmapped(struct sockaddr *); static void wallmsg(struct filed *, struct iovec *, const int iovlen); -static int waitdaemon(int, int, int); +static int waitdaemon(int); static void timedout(int); static void increase_rcvbuf(int); @@ -606,7 +606,7 @@ main(int argc, char *argv[]) } if ((!Foreground) && (!Debug)) { - ppid = waitdaemon(0, 0, 30); + ppid = waitdaemon(30); if (ppid < 0) { warn("could not become daemon"); pidfile_remove(pfh); @@ -2311,7 +2311,7 @@ markit(void) * Set a timer so we don't hang forever if it wedges. */ static int -waitdaemon(int nochdir, int noclose, int maxwait) +waitdaemon(int maxwait) { int fd; int status; @@ -2343,15 +2343,12 @@ waitdaemon(int nochdir, int noclose, int if (setsid() == -1) return (-1); - if (!nochdir) - (void)chdir("/"); - - if (!noclose && (fd = open(_PATH_DEVNULL, O_RDWR, 0)) != -1) { + (void)chdir("/"); + if ((fd = open(_PATH_DEVNULL, O_RDWR, 0)) != -1) { (void)dup2(fd, STDIN_FILENO); (void)dup2(fd, STDOUT_FILENO); (void)dup2(fd, STDERR_FILENO); - if (fd > 2) - (void)close (fd); + closefrom(STDERR_FILENO + 1); } return (getppid()); } From owner-svn-src-all@freebsd.org Sat Dec 24 08:59:31 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E59C3C8CEF8; Sat, 24 Dec 2016 08:59:31 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B9743EF2; Sat, 24 Dec 2016 08:59:31 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBO8xUin025712; Sat, 24 Dec 2016 08:59:30 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBO8xUYR025711; Sat, 24 Dec 2016 08:59:30 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201612240859.uBO8xUYR025711@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Sat, 24 Dec 2016 08:59:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r310495 - stable/11/sys/netinet X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 24 Dec 2016 08:59:32 -0000 Author: tuexen Date: Sat Dec 24 08:59:30 2016 New Revision: 310495 URL: https://svnweb.freebsd.org/changeset/base/310495 Log: MFC r310193: Fix the handling of buffered messages in stream reset deferred handling. Thanks to Eugen-Andrei Gavriloaie for reporting the issue and providing substantial help in nailing down the issue. Modified: stable/11/sys/netinet/sctp_indata.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/netinet/sctp_indata.c ============================================================================== --- stable/11/sys/netinet/sctp_indata.c Sat Dec 24 07:13:33 2016 (r310494) +++ stable/11/sys/netinet/sctp_indata.c Sat Dec 24 08:59:30 2016 (r310495) @@ -472,7 +472,6 @@ sctp_clean_up_control(struct sctp_tcb *s */ static void sctp_queue_data_to_stream(struct sctp_tcb *stcb, - struct sctp_stream_in *strm, struct sctp_association *asoc, struct sctp_queued_to_read *control, int *abort_flag, int *need_reasm) { @@ -498,16 +497,17 @@ sctp_queue_data_to_stream(struct sctp_tc int queue_needed; uint32_t nxt_todel; struct mbuf *op_err; + struct sctp_stream_in *strm; char msg[SCTP_DIAG_INFO_LEN]; + strm = &asoc->strmin[control->sinfo_stream]; if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_STR_LOGGING_ENABLE) { sctp_log_strm_del(control, NULL, SCTP_STR_LOG_FROM_INTO_STRD); } if (SCTP_MID_GT((asoc->idata_supported), strm->last_mid_delivered, control->mid)) { /* The incoming sseq is behind where we last delivered? */ SCTPDBG(SCTP_DEBUG_INDATA1, "Duplicate S-SEQ: %u delivered: %u from peer, Abort association\n", - control->mid, strm->last_mid_delivered); -protocol_error: + strm->last_mid_delivered, control->mid); /* * throw it in the stream so it gets cleaned up in * association destruction @@ -531,9 +531,6 @@ protocol_error: return; } - if ((SCTP_TSN_GE(asoc->cumulative_tsn, control->sinfo_tsn)) && (asoc->idata_supported == 0)) { - goto protocol_error; - } queue_needed = 1; asoc->size_on_all_streams += control->length; sctp_ucount_incr(asoc->cnt_on_all_streams); @@ -1041,7 +1038,7 @@ sctp_deliver_reasm_check(struct sctp_tcb } control = TAILQ_FIRST(&strm->uno_inqueue); - if ((control) && + if ((control != NULL) && (asoc->idata_supported == 0)) { /* Special handling needed for "old" data format */ if (sctp_handle_old_unordered_data(stcb, asoc, strm, control, pd_point, inp_read_lock_held)) { @@ -1280,7 +1277,6 @@ sctp_add_chk_to_control(struct sctp_queu */ static void sctp_queue_data_for_reasm(struct sctp_tcb *stcb, struct sctp_association *asoc, - struct sctp_stream_in *strm, struct sctp_queued_to_read *control, struct sctp_tmit_chunk *chk, int created_control, @@ -1288,8 +1284,10 @@ sctp_queue_data_for_reasm(struct sctp_tc { uint32_t next_fsn; struct sctp_tmit_chunk *at, *nat; + struct sctp_stream_in *strm; int do_wakeup, unordered; + strm = &asoc->strmin[control->sinfo_stream]; /* * For old un-ordered data chunks. */ @@ -1582,7 +1580,6 @@ sctp_process_a_data_chunk(struct sctp_tc uint32_t ppid; uint8_t chk_flags; struct sctp_stream_reset_list *liste; - struct sctp_stream_in *strm; int ordered; size_t clen; int created_control = 0; @@ -1733,7 +1730,6 @@ sctp_process_a_data_chunk(struct sctp_tc } return (0); } - strm = &asoc->strmin[sid]; /* * If its a fragmented message, lets see if we can find the control * on the reassembly queues. @@ -1750,7 +1746,7 @@ sctp_process_a_data_chunk(struct sctp_tc mid, chk_flags); goto err_out; } - control = sctp_find_reasm_entry(strm, mid, ordered, asoc->idata_supported); + control = sctp_find_reasm_entry(&asoc->strmin[sid], mid, ordered, asoc->idata_supported); SCTPDBG(SCTP_DEBUG_XXX, "chunk_flags:0x%x look for control on queues %p\n", chk_flags, control); if ((chk_flags & SCTP_DATA_NOT_FRAG) != SCTP_DATA_NOT_FRAG) { @@ -2020,7 +2016,7 @@ sctp_process_a_data_chunk(struct sctp_tc if ((chk_flags & SCTP_DATA_UNORDERED) == 0) { /* for ordered, bump what we delivered */ - strm->last_mid_delivered++; + asoc->strmin[sid].last_mid_delivered++; } SCTP_STAT_INCR(sctps_recvexpress); if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_STR_LOGGING_ENABLE) { @@ -2130,7 +2126,7 @@ sctp_process_a_data_chunk(struct sctp_tc } else { SCTPDBG(SCTP_DEBUG_XXX, "Queue control: %p for reordering MID: %u\n", control, mid); - sctp_queue_data_to_stream(stcb, strm, asoc, control, abort_flag, &need_reasm_check); + sctp_queue_data_to_stream(stcb, asoc, control, abort_flag, &need_reasm_check); if (*abort_flag) { if (last_chunk) { *m = NULL; @@ -2145,7 +2141,7 @@ sctp_process_a_data_chunk(struct sctp_tc SCTPDBG(SCTP_DEBUG_XXX, "Queue data to stream for reasm control: %p MID: %u\n", control, mid); - sctp_queue_data_for_reasm(stcb, asoc, strm, control, chk, created_control, abort_flag, tsn); + sctp_queue_data_for_reasm(stcb, asoc, control, chk, created_control, abort_flag, tsn); if (*abort_flag) { /* * the assoc is now gone and chk was put onto the reasm @@ -2179,6 +2175,10 @@ finish_express_del: sctp_log_map(asoc->mapping_array_base_tsn, asoc->cumulative_tsn, asoc->highest_tsn_inside_map, SCTP_MAP_PREPARE_SLIDE); } + if (need_reasm_check) { + (void)sctp_deliver_reasm_check(stcb, asoc, &asoc->strmin[sid], SCTP_READ_LOCK_NOT_HELD); + need_reasm_check = 0; + } /* check the special flag for stream resets */ if (((liste = TAILQ_FIRST(&asoc->resetHead)) != NULL) && SCTP_TSN_GE(asoc->cumulative_tsn, liste->tsn)) { @@ -2200,10 +2200,14 @@ finish_express_del: /* All can be removed */ TAILQ_FOREACH_SAFE(ctl, &asoc->pending_reply_queue, next, nctl) { TAILQ_REMOVE(&asoc->pending_reply_queue, ctl, next); - sctp_queue_data_to_stream(stcb, strm, asoc, ctl, abort_flag, &need_reasm_check); + sctp_queue_data_to_stream(stcb, asoc, ctl, abort_flag, &need_reasm_check); if (*abort_flag) { return (0); } + if (need_reasm_check) { + (void)sctp_deliver_reasm_check(stcb, asoc, &asoc->strmin[ctl->sinfo_stream], SCTP_READ_LOCK_NOT_HELD); + need_reasm_check = 0; + } } } else { TAILQ_FOREACH_SAFE(ctl, &asoc->pending_reply_queue, next, nctl) { @@ -2216,22 +2220,16 @@ finish_express_del: * ctl->sinfo_tsn > liste->tsn */ TAILQ_REMOVE(&asoc->pending_reply_queue, ctl, next); - sctp_queue_data_to_stream(stcb, strm, asoc, ctl, abort_flag, &need_reasm_check); + sctp_queue_data_to_stream(stcb, asoc, ctl, abort_flag, &need_reasm_check); if (*abort_flag) { return (0); } + if (need_reasm_check) { + (void)sctp_deliver_reasm_check(stcb, asoc, &asoc->strmin[ctl->sinfo_stream], SCTP_READ_LOCK_NOT_HELD); + need_reasm_check = 0; + } } } - /* - * Now service re-assembly to pick up anything that has been - * held on reassembly queue? - */ - (void)sctp_deliver_reasm_check(stcb, asoc, strm, SCTP_READ_LOCK_NOT_HELD); - need_reasm_check = 0; - } - if (need_reasm_check) { - /* Another one waits ? */ - (void)sctp_deliver_reasm_check(stcb, asoc, strm, SCTP_READ_LOCK_NOT_HELD); } return (1); } From owner-svn-src-all@freebsd.org Sat Dec 24 09:57:33 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 40C72C8B098; Sat, 24 Dec 2016 09:57:33 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 02DD7BB3; Sat, 24 Dec 2016 09:57:32 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBO9vWBb049844; Sat, 24 Dec 2016 09:57:32 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBO9vWTZ049843; Sat, 24 Dec 2016 09:57:32 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201612240957.uBO9vWTZ049843@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Sat, 24 Dec 2016 09:57:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310496 - head/sys/vm X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 24 Dec 2016 09:57:33 -0000 Author: kib Date: Sat Dec 24 09:57:31 2016 New Revision: 310496 URL: https://svnweb.freebsd.org/changeset/base/310496 Log: Fix argument type and microoptimize swp_pager_meta_free(). The count argument natural type if vm_pindex_t, but due to the loop organization, it has to be signed type to detect the termination condition. Replace this logic by using distinguished counter for the processed pages, and terminate loop when the counter exceeds the argument. Completely process one swblock for all relevant indexes instead of doing relookup in hash when incrementing page index on the loop step. Do not drop hash mutex around iterations. Noted and reviewed by: alc Tested by: pho Sponsored by: The FreeBSD Foundation MFC after: 2 weeks Modified: head/sys/vm/swap_pager.c Modified: head/sys/vm/swap_pager.c ============================================================================== --- head/sys/vm/swap_pager.c Sat Dec 24 08:59:30 2016 (r310495) +++ head/sys/vm/swap_pager.c Sat Dec 24 09:57:31 2016 (r310496) @@ -410,7 +410,7 @@ static daddr_t swp_pager_getswapspace(in */ static struct swblock **swp_pager_hash(vm_object_t object, vm_pindex_t index); static void swp_pager_meta_build(vm_object_t, vm_pindex_t, daddr_t); -static void swp_pager_meta_free(vm_object_t, vm_pindex_t, daddr_t); +static void swp_pager_meta_free(vm_object_t, vm_pindex_t, vm_pindex_t); static void swp_pager_meta_free_all(vm_object_t); static daddr_t swp_pager_meta_ctl(vm_object_t, vm_pindex_t, int); @@ -1869,42 +1869,42 @@ done: * with resident pages. */ static void -swp_pager_meta_free(vm_object_t object, vm_pindex_t index, daddr_t count) +swp_pager_meta_free(vm_object_t object, vm_pindex_t index, vm_pindex_t count) { + struct swblock **pswap, *swap; + vm_pindex_t c; + daddr_t v; + int n, sidx; VM_OBJECT_ASSERT_LOCKED(object); - if (object->type != OBJT_SWAP) + if (object->type != OBJT_SWAP || count == 0) return; - while (count > 0) { - struct swblock **pswap; - struct swblock *swap; - - mtx_lock(&swhash_mtx); + mtx_lock(&swhash_mtx); + for (c = 0; c < count;) { pswap = swp_pager_hash(object, index); - - if ((swap = *pswap) != NULL) { - daddr_t v = swap->swb_pages[index & SWAP_META_MASK]; - - if (v != SWAPBLK_NONE) { - swp_pager_freeswapspace(v, 1); - swap->swb_pages[index & SWAP_META_MASK] = - SWAPBLK_NONE; - if (--swap->swb_count == 0) { - *pswap = swap->swb_hnext; - uma_zfree(swap_zone, swap); - --object->un_pager.swp.swp_bcount; - } + sidx = index & SWAP_META_MASK; + n = SWAP_META_PAGES - sidx; + index += n; + if ((swap = *pswap) == NULL) { + c += n; + continue; + } + for (; c < count && sidx < SWAP_META_PAGES; ++c, ++sidx) { + if ((v = swap->swb_pages[sidx]) == SWAPBLK_NONE) + continue; + swp_pager_freeswapspace(v, 1); + swap->swb_pages[sidx] = SWAPBLK_NONE; + if (--swap->swb_count == 0) { + *pswap = swap->swb_hnext; + uma_zfree(swap_zone, swap); + --object->un_pager.swp.swp_bcount; + c += SWAP_META_PAGES - sidx; + break; } - --count; - ++index; - } else { - int n = SWAP_META_PAGES - (index & SWAP_META_MASK); - count -= n; - index += n; } - mtx_unlock(&swhash_mtx); } + mtx_unlock(&swhash_mtx); } /* From owner-svn-src-all@freebsd.org Sat Dec 24 11:22:30 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 463A9C8E9AC; Sat, 24 Dec 2016 11:22:30 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 0189F14B9; Sat, 24 Dec 2016 11:22:29 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBOBMTMb086318; Sat, 24 Dec 2016 11:22:29 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBOBMSR7086315; Sat, 24 Dec 2016 11:22:28 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201612241122.uBOBMSR7086315@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Ngie Cooper Date: Sat, 24 Dec 2016 11:22:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310497 - in head/usr.sbin/bsnmpd/tools: bsnmptools libbsnmptools X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 24 Dec 2016 11:22:30 -0000 Author: ngie Date: Sat Dec 24 11:22:28 2016 New Revision: 310497 URL: https://svnweb.freebsd.org/changeset/base/310497 Log: Warning message cleanup - Use warn instead of warnx + strerror(errno) - Remove unnecessary trailing newline from a warnx call - Add missing spaces following "," in syslog and warn* calls MFC after: 2 weeks Modified: head/usr.sbin/bsnmpd/tools/bsnmptools/bsnmpget.c head/usr.sbin/bsnmpd/tools/libbsnmptools/bsnmptc.c head/usr.sbin/bsnmpd/tools/libbsnmptools/bsnmptools.c Modified: head/usr.sbin/bsnmpd/tools/bsnmptools/bsnmpget.c ============================================================================== --- head/usr.sbin/bsnmpd/tools/bsnmptools/bsnmpget.c Sat Dec 24 09:57:31 2016 (r310496) +++ head/usr.sbin/bsnmpd/tools/bsnmptools/bsnmpget.c Sat Dec 24 11:22:28 2016 (r310497) @@ -394,7 +394,7 @@ snmptool_get(struct snmp_toolinfo *snmpt GET_NONREP(snmptoolctx)); if (snmp_dialog(&req, &resp) == -1) { - warnx("Snmp dialog - %s", strerror(errno)); + warn("Snmp dialog"); break; } @@ -521,7 +521,7 @@ snmptool_walk(struct snmp_toolinfo *snmp snmp_pdu_free(&resp); } else - warnx("Snmp dialog - %s", strerror(errno)); + warn("Snmp dialog"); } if (snmp_object_remove(snmptoolctx, &root) < 0) { @@ -554,8 +554,7 @@ parse_oid_numeric(struct snmp_value *val errno = 0; suboid = strtoul(val, &endptr, 10); if (errno != 0) { - warnx("Value %s not supported - %s", val, - strerror(errno)); + warn("Value %s not supported", val); errno = saved_errno; return (-1); } @@ -634,7 +633,7 @@ parse_int(struct snmp_value *value, char v = strtol(val, &endptr, 10); if (errno != 0) { - warnx("Value %s not supported - %s", val, strerror(errno)); + warn("Value %s not supported", val); errno = saved_errno; return (-1); } @@ -682,7 +681,7 @@ parse_uint(struct snmp_value *value, cha v = strtoul(val, &endptr, 10); if (errno != 0) { - warnx("Value %s not supported - %s", val, strerror(errno)); + warn("Value %s not supported", val); errno = saved_errno; return (-1); } @@ -736,7 +735,7 @@ parse_uint64(struct snmp_value *value, c v = strtoull(val, &endptr, 10); if (errno != 0) { - warnx("Value %s not supported - %s", val, strerror(errno)); + warnx("Value %s not supported", val); errno = saved_errno; return (-1); } @@ -821,7 +820,7 @@ parse_pair_numoid_val(char *str, struct break; if (ptr[cnt] != '\0') { - warnx("Value string too long - %s",ptr); + warnx("Value string too long - %s", ptr); return (-1); } @@ -830,7 +829,7 @@ parse_pair_numoid_val(char *str, struct * to know syntax to check value boundaries. */ if (snmp_parse_numoid(oid_str, &(snmp_val->var)) < 0) { - warnx("Error parsing OID %s",oid_str); + warnx("Error parsing OID %s", oid_str); return (-1); } @@ -956,7 +955,7 @@ static int32_t add_octstring_syntax(struct snmp_value *dst, struct snmp_value *src) { if (src->v.octetstring.len > ASN_MAXOCTETSTRING) { - warnx("OctetString len too big - %u",src->v.octetstring.len); + warnx("OctetString len too big - %u", src->v.octetstring.len); return (-1); } @@ -1084,7 +1083,7 @@ snmptool_set(struct snmp_toolinfo *snmpt while ((snmp_pdu_add_bindings(snmptoolctx, snmpset_verify_vbind, snmpset_add_vbind, &req, SNMP_MAX_BINDINGS)) > 0) { if (snmp_dialog(&req, &resp)) { - warnx("Snmp dialog - %s", strerror(errno)); + warn("Snmp dialog"); break; } @@ -1229,7 +1228,7 @@ main(int argc, char ** argv) } if (snmp_open(NULL, NULL, NULL, NULL)) { - warnx("Failed to open snmp session: %s.", strerror(errno)); + warn("Failed to open snmp session"); snmp_tool_freeall(&snmptoolctx); exit(1); } @@ -1239,7 +1238,7 @@ main(int argc, char ** argv) if (ISSET_EDISCOVER(&snmptoolctx) && snmp_discover_engine(snmptoolctx.passwd) < 0) { - warnx("Unknown SNMP Engine ID: %s.", strerror(errno)); + warn("Unknown SNMP Engine ID"); rc = 1; goto cleanup; } @@ -1255,7 +1254,7 @@ main(int argc, char ** argv) snmp_get_local_keys(&snmp_client.user, snmp_client.engine.engine_id, snmp_client.engine.engine_len) != SNMP_CODE_OK) { - warnx("Failed to get keys: %s.", strerror(errno)); + warn("Failed to get keys"); rc = 1; goto cleanup; } Modified: head/usr.sbin/bsnmpd/tools/libbsnmptools/bsnmptc.c ============================================================================== --- head/usr.sbin/bsnmpd/tools/libbsnmptools/bsnmptc.c Sat Dec 24 09:57:31 2016 (r310496) +++ head/usr.sbin/bsnmpd/tools/libbsnmptools/bsnmptc.c Sat Dec 24 11:22:28 2016 (r310497) @@ -269,7 +269,7 @@ parse_octetstring(struct snmp_value *val value->v.octetstring.len = len; if((value->v.octetstring.octets = malloc(len)) == NULL) { - syslog(LOG_ERR,"malloc failed: %s", strerror(errno)); + syslog(LOG_ERR, "malloc failed: %s", strerror(errno)); return (-1); } @@ -570,7 +570,7 @@ parse_dateandtime(struct snmp_value *sv, date[10] = v; if ((sv->v.octetstring.octets = malloc(SNMP_DATETIME_OCTETS)) == NULL) { - warnx("malloc() failed - %s", strerror(errno)); + warn("malloc() failed"); return (-1); } @@ -626,7 +626,7 @@ snmp_addr2asn_oid(char *str, struct asn_ return (NULL); } if (*endptr != ':') { - warnx("Failed adding oid - %s",str); + warnx("Failed adding oid - %s", str); return (NULL); } if (snmp_suboid_append(oid, (asn_subid_t) v) < 0) @@ -679,7 +679,7 @@ parse_physaddress(struct snmp_value *sv, phys_addr[5] = v; if ((sv->v.octetstring.octets = malloc(SNMP_PHYSADDR_OCTETS)) == NULL) { - syslog(LOG_ERR,"malloc failed: %s", strerror(errno)); + syslog(LOG_ERR, "malloc failed: %s", strerror(errno)); return (-1); } @@ -743,7 +743,7 @@ snmp_ntp_ts2asn_oid(char *str, struct as errno = saved_errno; if (*endptr != '.') { - warnx("Failed adding oid - %s",str); + warnx("Failed adding oid - %s", str); return (NULL); } @@ -824,7 +824,7 @@ parse_ntp_ts(struct snmp_value *sv, char } if ((sv->v.octetstring.octets = malloc(SNMP_NTP_TS_OCTETS)) == NULL) { - syslog(LOG_ERR,"malloc failed: %s", strerror(errno)); + syslog(LOG_ERR, "malloc failed: %s", strerror(errno)); return (-1); } @@ -987,7 +987,7 @@ parse_bridge_id(struct snmp_value *sv, c bridge_id[7] = v; if ((sv->v.octetstring.octets = malloc(SNMP_BRIDGEID_OCTETS)) == NULL) { - syslog(LOG_ERR,"malloc failed: %s", strerror(errno)); + syslog(LOG_ERR, "malloc failed: %s", strerror(errno)); return (-1); } @@ -1098,7 +1098,7 @@ parse_bport_id(struct snmp_value *value, bport_id[1] = v; if ((value->v.octetstring.octets = malloc(SNMP_BPORT_OCTETS)) == NULL) { - syslog(LOG_ERR,"malloc failed: %s", strerror(errno)); + syslog(LOG_ERR, "malloc failed: %s", strerror(errno)); return (-1); } @@ -1178,7 +1178,7 @@ snmp_oct2inetaddr(uint32_t len, char *oc } if (inet_ntop(af, ip, buf, SNMP_INADDRS_STRSZ) == NULL) { - warnx("inet_ntop failed - %s", strerror(errno)); + warn("inet_ntop failed"); return (NULL); } @@ -1230,7 +1230,7 @@ snmp_bits2oct(char *str, struct asn_oid v = strtoull(str, &endptr, 16); if (errno != 0) { - warnx("Bad BITS value %s - %s", str, strerror(errno)); + warn("Bad BITS value %s", str); errno = saved_errno; return (NULL); } @@ -1270,7 +1270,7 @@ parse_bits(struct snmp_value *value, cha v = strtoull(string, &endptr, 16); if (errno != 0) { - warnx("Bad BITS value %s - %s", string, strerror(errno)); + warn("Bad BITS value %s", string); errno = saved_errno; return (-1); } Modified: head/usr.sbin/bsnmpd/tools/libbsnmptools/bsnmptools.c ============================================================================== --- head/usr.sbin/bsnmpd/tools/libbsnmptools/bsnmptools.c Sat Dec 24 09:57:31 2016 (r310496) +++ head/usr.sbin/bsnmpd/tools/libbsnmptools/bsnmptools.c Sat Dec 24 11:22:28 2016 (r310497) @@ -177,7 +177,7 @@ snmptool_init(struct snmp_toolinfo *snmp if ((slen = strlen(str)) > MAXSTR) slen = MAXSTR - 1; if ((snmptoolctx->passwd = malloc(slen + 1)) == NULL) { - warnx("malloc() failed - %s", strerror(errno)); + warn("malloc() failed"); return (-1); } if (slen > 0) @@ -252,12 +252,12 @@ add_filename(struct snmp_toolinfo *snmpt } if ((fstring = strdup(filename)) == NULL) { - warnx("strdup() failed - %s", strerror(errno)); + warn("strdup() failed"); return (-1); } if ((entry = calloc(1, sizeof(struct fname))) == NULL) { - warnx("calloc() failed - %s", strerror(errno)); + warn("calloc() failed"); free(fstring); return (-1); } @@ -668,8 +668,7 @@ parse_user_security(struct snmp_toolinfo errno = 0; snmp_client.engine.engine_boots = strtoul(val, NULL, 10); if (errno != 0) { - warnx("Bad 'engine-boots' value %s - %s", val, - strerror(errno)); + warn("Bad 'engine-boots' value %s", val); errno = saved_errno; return (-1); } @@ -684,8 +683,7 @@ parse_user_security(struct snmp_toolinfo errno = 0; snmp_client.engine.engine_time = strtoul(val, NULL, 10); if (errno != 0) { - warnx("Bad 'engine-time' value %s - %s", val, - strerror(errno)); + warn("Bad 'engine-time' value %s", val); errno = saved_errno; return (-1); } @@ -819,7 +817,7 @@ parse_timeout(char *opt_arg) v = strtol(opt_arg, NULL, 10); if (errno != 0) { - warnx( "Error parsing timeout value - %s", strerror(errno)); + warn("Error parsing timeout value"); errno = saved_errno; return (-1); } @@ -842,7 +840,7 @@ parse_retry(char *opt_arg) v = strtoul(opt_arg, NULL, 10); if (errno != 0) { - warnx("Error parsing retries count - %s", strerror(errno)); + warn("Error parsing retries count"); errno = saved_errno; return (-1); } @@ -865,7 +863,7 @@ parse_version(char *opt_arg) v = strtoul(opt_arg, NULL, 10); if (errno != 0) { - warnx("Error parsing version - %s", strerror(errno)); + warn("Error parsing version"); errno = saved_errno; return (-1); } @@ -917,7 +915,7 @@ parse_buflen(char *opt_arg) size = strtoul(opt_arg, NULL, 10); if (errno != 0) { - warnx("Error parsing buffer size - %s", strerror(errno)); + warn("Error parsing buffer size"); errno = saved_errno; return (-1); } @@ -1040,8 +1038,7 @@ snmp_int2asn_oid(char *str, struct asn_o v = strtol(str, &endptr, 10); if (errno != 0) { - warnx("Integer value %s not supported - %s", str, - strerror(errno)); + warn("Integer value %s not supported", str); errno = saved_errno; return (NULL); } @@ -1120,8 +1117,7 @@ snmp_uint2asn_oid(char *str, struct asn_ v = strtoul(str, &endptr, 10); if (errno != 0) { - warnx("Integer value %s not supported - %s\n", str, - strerror(errno)); + warn("Integer value %s not supported", str); errno = saved_errno; return (NULL); } @@ -1145,8 +1141,7 @@ snmp_cnt64_2asn_oid(char *str, struct as v = strtoull(str, &endptr, 10); if (errno != 0) { - warnx("Integer value %s not supported - %s", str, - strerror(errno)); + warn("Integer value %s not supported", str); errno = saved_errno; return (NULL); } From owner-svn-src-all@freebsd.org Sat Dec 24 11:23:20 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0CBA1C8EA0E; Sat, 24 Dec 2016 11:23:20 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C1BD81667; Sat, 24 Dec 2016 11:23:19 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBOBNIXJ086393; Sat, 24 Dec 2016 11:23:18 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBOBNIhc086390; Sat, 24 Dec 2016 11:23:18 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201612241123.uBOBNIhc086390@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Ngie Cooper Date: Sat, 24 Dec 2016 11:23:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310498 - head/contrib/bsnmp/snmpd X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 24 Dec 2016 11:23:20 -0000 Author: ngie Date: Sat Dec 24 11:23:18 2016 New Revision: 310498 URL: https://svnweb.freebsd.org/changeset/base/310498 Log: Allow SNMPv3 authNoPriv and noAuthNoPriv protocols to discover snmpEngineTime as discussed in RFC-5343 This fixes interoperability with net-snmp. Tested with the following invocations of snmpwalk (from net-snmp): - noAuthNoPriv: % snmpwalk -v 3 -n '' -u public localhost snmpEngineTime - authNoPriv: % snmpwalk -v 3 -n '' -u bsnmp -A bsnmptest -l authNoPriv -a sha localhost \ localhost snmpEngineTime - authPriv: % snmpwalk -v 3 -n '' -u bsnmp -A bsnmptest -l authPriv -a sha -x des \ -X bsnmptest localhost snmpEngineTime MFC after: 1 week Obtained from: Isilon OneFS (5ec6d772cacbc, with minor tweaks) Submitted by: Austin Voecks Sponsored by: Dell EMC Isilon Modified: head/contrib/bsnmp/snmpd/action.c head/contrib/bsnmp/snmpd/main.c head/contrib/bsnmp/snmpd/snmpd.h Modified: head/contrib/bsnmp/snmpd/action.c ============================================================================== --- head/contrib/bsnmp/snmpd/action.c Sat Dec 24 11:22:28 2016 (r310497) +++ head/contrib/bsnmp/snmpd/action.c Sat Dec 24 11:23:18 2016 (r310498) @@ -40,6 +40,7 @@ #include #include #include +#include #include #include #include @@ -219,6 +220,21 @@ save_boots: return (0); } +void +update_snmpd_engine_time(void) +{ + uint64_t etime; + + etime = (get_ticks() - start_tick) / 100ULL; + if (etime < INT32_MAX) + snmpd_engine.engine_time = etime; + else { + start_tick = get_ticks(); + (void)set_snmpd_engine(); + snmpd_engine.engine_time = start_tick; + } +} + /************************************************************* * * System group @@ -1118,7 +1134,7 @@ op_snmp_engine(struct snmp_context *ctx value->v.integer = snmpd_engine.engine_boots; break; case LEAF_snmpEngineTime: - snmpd_engine.engine_time = (get_ticks() - start_tick) / 100ULL; + update_snmpd_engine_time(); value->v.integer = snmpd_engine.engine_time; break; case LEAF_snmpEngineMaxMessageSize: Modified: head/contrib/bsnmp/snmpd/main.c ============================================================================== --- head/contrib/bsnmp/snmpd/main.c Sat Dec 24 11:22:28 2016 (r310497) +++ head/contrib/bsnmp/snmpd/main.c Sat Dec 24 11:23:18 2016 (r310498) @@ -53,7 +53,6 @@ #include #include #include -#include #ifdef USE_TCPWRAPPERS #include @@ -304,7 +303,6 @@ snmp_output(struct snmp_pdu *pdu, u_char static enum snmp_code snmp_pdu_auth_user(struct snmp_pdu *pdu) { - uint64_t etime; usm_user = NULL; /* un-authenticated snmpEngineId discovery */ @@ -312,6 +310,7 @@ snmp_pdu_auth_user(struct snmp_pdu *pdu) pdu->engine.engine_len = snmpd_engine.engine_len; memcpy(pdu->engine.engine_id, snmpd_engine.engine_id, snmpd_engine.engine_len); + update_snmpd_engine_time(); pdu->engine.engine_boots = snmpd_engine.engine_boots; pdu->engine.engine_time = snmpd_engine.engine_time; pdu->flags |= SNMP_MSG_AUTODISCOVER; @@ -334,21 +333,14 @@ snmp_pdu_auth_user(struct snmp_pdu *pdu) /* authenticated snmpEngineId discovery */ if ((pdu->flags & SNMP_MSG_AUTH_FLAG) != 0) { - etime = (get_ticks() - start_tick) / 100ULL; - if (etime < INT32_MAX) - snmpd_engine.engine_time = etime; - else { - start_tick = get_ticks(); - set_snmpd_engine(); - snmpd_engine.engine_time = start_tick; - } - + update_snmpd_engine_time(); pdu->user.auth_proto = usm_user->suser.auth_proto; memcpy(pdu->user.auth_key, usm_user->suser.auth_key, sizeof(pdu->user.auth_key)); if (pdu->engine.engine_boots == 0 && pdu->engine.engine_time == 0) { + update_snmpd_engine_time(); pdu->flags |= SNMP_MSG_AUTODISCOVER; return (SNMP_CODE_OK); } @@ -643,6 +635,7 @@ decoded: pdu->engine.engine_time == 0) { asn_append_oid(&(pdu->bindings[pdu->nbindings++].var), &oid_usmNotInTimeWindows); + update_snmpd_engine_time(); pdu->engine.engine_boots = snmpd_engine.engine_boots; pdu->engine.engine_time = snmpd_engine.engine_time; } Modified: head/contrib/bsnmp/snmpd/snmpd.h ============================================================================== --- head/contrib/bsnmp/snmpd/snmpd.h Sat Dec 24 11:22:28 2016 (r310497) +++ head/contrib/bsnmp/snmpd/snmpd.h Sat Dec 24 11:23:18 2016 (r310498) @@ -332,6 +332,7 @@ int init_actvals(void); extern char engine_file[]; int init_snmpd_engine(void); int set_snmpd_engine(void); +void update_snmpd_engine_time(void); int read_config(const char *, struct lmodule *); int define_macro(const char *name, const char *value); From owner-svn-src-all@freebsd.org Sat Dec 24 11:26:56 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 62CE1C8EA88; Sat, 24 Dec 2016 11:26:56 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 32975181D; Sat, 24 Dec 2016 11:26:56 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBOBQtxI086580; Sat, 24 Dec 2016 11:26:55 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBOBQt9P086579; Sat, 24 Dec 2016 11:26:55 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201612241126.uBOBQt9P086579@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Ngie Cooper Date: Sat, 24 Dec 2016 11:26:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310499 - head/contrib/bsnmp/lib X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 24 Dec 2016 11:26:56 -0000 Author: ngie Date: Sat Dec 24 11:26:55 2016 New Revision: 310499 URL: https://svnweb.freebsd.org/changeset/base/310499 Log: Sort #includes No functional change MFC after: 3 days Modified: head/contrib/bsnmp/lib/snmp.c Modified: head/contrib/bsnmp/lib/snmp.c ============================================================================== --- head/contrib/bsnmp/lib/snmp.c Sat Dec 24 11:23:18 2016 (r310498) +++ head/contrib/bsnmp/lib/snmp.c Sat Dec 24 11:26:55 2016 (r310499) @@ -38,19 +38,19 @@ */ #include #include +#include +#include +#include #include #include #include #include +#include #ifdef HAVE_STDINT_H #include #elif defined(HAVE_INTTYPES_H) #include #endif -#include -#include -#include -#include #include "asn1.h" #include "snmp.h" From owner-svn-src-all@freebsd.org Sat Dec 24 11:30:25 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D21E9C8EB14; Sat, 24 Dec 2016 11:30:25 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 9661A19B7; Sat, 24 Dec 2016 11:30:25 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBOBUOtV086772; Sat, 24 Dec 2016 11:30:24 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBOBUOAq086771; Sat, 24 Dec 2016 11:30:24 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201612241130.uBOBUOAq086771@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Ngie Cooper Date: Sat, 24 Dec 2016 11:30:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310500 - head/contrib/bsnmp/lib X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 24 Dec 2016 11:30:25 -0000 Author: ngie Date: Sat Dec 24 11:30:24 2016 New Revision: 310500 URL: https://svnweb.freebsd.org/changeset/base/310500 Log: Minor style(9) fixes - Trailing whitespace cleanup - Sort variables in snmp_dialog(..) by alignment No functional change MFC after: 1 week Modified: head/contrib/bsnmp/lib/snmpclient.c Modified: head/contrib/bsnmp/lib/snmpclient.c ============================================================================== --- head/contrib/bsnmp/lib/snmpclient.c Sat Dec 24 11:26:55 2016 (r310499) +++ head/contrib/bsnmp/lib/snmpclient.c Sat Dec 24 11:30:24 2016 (r310500) @@ -1214,7 +1214,7 @@ snmp_next_reqid(struct snmp_client * c) int32_t i; i = c->next_reqid; - if (c->next_reqid >= c->max_reqid) + if (c->next_reqid >= c->max_reqid) c->next_reqid = c->min_reqid; else c->next_reqid++; @@ -1230,7 +1230,7 @@ snmp_send_packet(struct snmp_pdu * pdu) u_char *buf; struct asn_buf b; ssize_t ret; - + if ((buf = malloc(snmp_client.txbuflen)) == NULL) { seterr(&snmp_client, "%s", strerror(errno)); return (-1); @@ -1684,9 +1684,9 @@ snmp_dialog(struct snmp_v1_pdu *req, str struct timeval tv = snmp_client.timeout; struct timeval end; struct snmp_pdu pdu; - u_int i; - int32_t reqid; int ret; + int32_t reqid; + u_int i; /* * Make a copy of the request and replace the syntaxes by NULL From owner-svn-src-all@freebsd.org Sat Dec 24 11:41:18 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 46A99C8ED04; Sat, 24 Dec 2016 11:41:18 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E32D81E91; Sat, 24 Dec 2016 11:41:17 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBOBfHuK091519; Sat, 24 Dec 2016 11:41:17 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBOBfHYw091518; Sat, 24 Dec 2016 11:41:17 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201612241141.uBOBfHYw091518@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Ngie Cooper Date: Sat, 24 Dec 2016 11:41:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310501 - head/contrib/bsnmp/lib X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 24 Dec 2016 11:41:18 -0000 Author: ngie Date: Sat Dec 24 11:41:16 2016 New Revision: 310501 URL: https://svnweb.freebsd.org/changeset/base/310501 Log: Be more strict about IpAddress type in snmp_value_parse(..) - Use inet_pton with AF_INET instead of doing longhand with sscanf. - Use gethostbyname2 with AF_INET to ensure that the hostname isn't accidentally parsed with another address family, e.g. AF_INET6. NB: IpAddress per RFC-2578 is IPv4 only. Work is in progress to add the InetAddress type and friends documented in RFC-4001 and elsewhere (which supports IPv4, IPv6, and more). MFC after: 2 weeks Modified: head/contrib/bsnmp/lib/snmp.c Modified: head/contrib/bsnmp/lib/snmp.c ============================================================================== --- head/contrib/bsnmp/lib/snmp.c Sat Dec 24 11:30:24 2016 (r310500) +++ head/contrib/bsnmp/lib/snmp.c Sat Dec 24 11:41:16 2016 (r310501) @@ -51,6 +51,8 @@ #elif defined(HAVE_INTTYPES_H) #include #endif +#include +#include #include "asn1.h" #include "snmp.h" @@ -1384,29 +1386,16 @@ snmp_value_parse(const char *str, enum s case SNMP_SYNTAX_IPADDRESS: { struct hostent *he; - u_long ip[4]; - int n; - if (sscanf(str, "%lu.%lu.%lu.%lu%n", &ip[0], &ip[1], &ip[2], - &ip[3], &n) == 4 && (size_t)n == strlen(str) && - ip[0] <= 0xff && ip[1] <= 0xff && - ip[2] <= 0xff && ip[3] <= 0xff) { - v->ipaddress[0] = (u_char)ip[0]; - v->ipaddress[1] = (u_char)ip[1]; - v->ipaddress[2] = (u_char)ip[2]; - v->ipaddress[3] = (u_char)ip[3]; + if (inet_pton(AF_INET, str, &v->ipaddress) == 1) return (0); - } - - if ((he = gethostbyname(str)) == NULL) + if ((he = gethostbyname2(str, AF_INET)) == NULL) return (-1); if (he->h_addrtype != AF_INET) return (-1); - v->ipaddress[0] = he->h_addr[0]; - v->ipaddress[1] = he->h_addr[1]; - v->ipaddress[2] = he->h_addr[2]; - v->ipaddress[3] = he->h_addr[3]; + memcpy(v->ipaddress, he->h_addr, sizeof(v->ipaddress)); + return (0); } From owner-svn-src-all@freebsd.org Sat Dec 24 11:49:26 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D1D06C8EFEF; Sat, 24 Dec 2016 11:49:26 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A17247AF; Sat, 24 Dec 2016 11:49:26 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBOBnPVn094811; Sat, 24 Dec 2016 11:49:25 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBOBnPFd094810; Sat, 24 Dec 2016 11:49:25 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201612241149.uBOBnPFd094810@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Ngie Cooper Date: Sat, 24 Dec 2016 11:49:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310503 - head/contrib/bsnmp/snmp_target X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 24 Dec 2016 11:49:26 -0000 Author: ngie Date: Sat Dec 24 11:49:25 2016 New Revision: 310503 URL: https://svnweb.freebsd.org/changeset/base/310503 Log: style(9): delete stray trailing whitespace after break statement MFC after: 3 days Modified: head/contrib/bsnmp/snmp_target/target_snmp.c Modified: head/contrib/bsnmp/snmp_target/target_snmp.c ============================================================================== --- head/contrib/bsnmp/snmp_target/target_snmp.c Sat Dec 24 11:47:47 2016 (r310502) +++ head/contrib/bsnmp/snmp_target/target_snmp.c Sat Dec 24 11:49:25 2016 (r310503) @@ -299,7 +299,7 @@ op_snmp_target_addrs(struct snmp_context return (target_delete_address(addrs)); break; default: - break; + break; } return (SNMP_ERR_NOERROR); From owner-svn-src-all@freebsd.org Sat Dec 24 12:50:19 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 00DEEC8EF18; Sat, 24 Dec 2016 12:50:19 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C40221077; Sat, 24 Dec 2016 12:50:18 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBOCoHeK019981; Sat, 24 Dec 2016 12:50:17 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBOCoH8C019980; Sat, 24 Dec 2016 12:50:17 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201612241250.uBOCoH8C019980@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Ngie Cooper Date: Sat, 24 Dec 2016 12:50:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310504 - head/usr.sbin/syslogd X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 24 Dec 2016 12:50:19 -0000 Author: ngie Date: Sat Dec 24 12:50:17 2016 New Revision: 310504 URL: https://svnweb.freebsd.org/changeset/base/310504 Log: Unbreak syslogd after r310494 Don't close all file descriptors greater than STDERR_FILENO (2) in waitdaemon(..) -- only close fd (file descriptor for /dev/null used in subsequent calls to dup2) if it's greater than STDERR_FILENO. Reported by: subbsd@gmail.com, danny@cs.huji.ac.il Pointyhat to: hrs X-MFC with: r310494 Modified: head/usr.sbin/syslogd/syslogd.c Modified: head/usr.sbin/syslogd/syslogd.c ============================================================================== --- head/usr.sbin/syslogd/syslogd.c Sat Dec 24 11:49:25 2016 (r310503) +++ head/usr.sbin/syslogd/syslogd.c Sat Dec 24 12:50:17 2016 (r310504) @@ -2348,7 +2348,8 @@ waitdaemon(int maxwait) (void)dup2(fd, STDIN_FILENO); (void)dup2(fd, STDOUT_FILENO); (void)dup2(fd, STDERR_FILENO); - closefrom(STDERR_FILENO + 1); + if (fd > STDERR_FILENO) + (void)close(fd); } return (getppid()); } From owner-svn-src-all@freebsd.org Sat Dec 24 12:55:38 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 813D6C8E355; Sat, 24 Dec 2016 12:55:38 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 419EE192B; Sat, 24 Dec 2016 12:55:38 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBOCtbSp023926; Sat, 24 Dec 2016 12:55:37 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBOCtbOV023924; Sat, 24 Dec 2016 12:55:37 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201612241255.uBOCtbOV023924@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Ngie Cooper Date: Sat, 24 Dec 2016 12:55:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r310505 - in stable/11: lib/libelftc tools/build/mk X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 24 Dec 2016 12:55:38 -0000 Author: ngie Date: Sat Dec 24 12:55:37 2016 New Revision: 310505 URL: https://svnweb.freebsd.org/changeset/base/310505 Log: MFC r310186,r310187: r310186: Install the lib/libelftc manpages Some other manpages, e.g. c++filt reference these r310187: Remove lib/libelf's manpages if MK_TOOLCHAIN == no Add a comment to help figure out which set is lib/libelf's and which set is lib/libelftc's Modified: stable/11/lib/libelftc/Makefile stable/11/tools/build/mk/OptionalObsoleteFiles.inc Directory Properties: stable/11/ (props changed) Modified: stable/11/lib/libelftc/Makefile ============================================================================== --- stable/11/lib/libelftc/Makefile Sat Dec 24 12:50:17 2016 (r310504) +++ stable/11/lib/libelftc/Makefile Sat Dec 24 12:55:37 2016 (r310505) @@ -28,7 +28,15 @@ SRCS= elftc_bfdtarget.c INCS= libelftc.h CFLAGS+=-I${ELFTCDIR}/libelftc -I${ELFTCDIR}/common -MAN= +MAN+= elftc.3 \ + elftc_bfd_find_target.3 \ + elftc_copyfile.3 \ + elftc_demangle.3 \ + elftc_reloc_type_str.3 \ + elftc_set_timestamps.3 \ + elftc_timestamp.3 \ + elftc_string_table_create.3 \ + elftc_version.3 # This same hack is in lib/libelf/Makefile and usr.bin/readelf/Makefile # We need to link against the correct version of these files. One Modified: stable/11/tools/build/mk/OptionalObsoleteFiles.inc ============================================================================== --- stable/11/tools/build/mk/OptionalObsoleteFiles.inc Sat Dec 24 12:50:17 2016 (r310504) +++ stable/11/tools/build/mk/OptionalObsoleteFiles.inc Sat Dec 24 12:55:37 2016 (r310505) @@ -8066,6 +8066,65 @@ OLD_FILES+=usr/share/man/man1/strip.1.gz OLD_FILES+=usr/bin/objcopy OLD_FILES+=usr/share/man/man1/objcopy.1.gz .endif +# lib/libelf +OLD_FILES+=usr/share/man/man3/elf.3.gz +OLD_FILES+=usr/share/man/man3/elf_begin.3.gz +OLD_FILES+=usr/share/man/man3/elf_cntl.3.gz +OLD_FILES+=usr/share/man/man3/elf_end.3.gz +OLD_FILES+=usr/share/man/man3/elf_errmsg.3.gz +OLD_FILES+=usr/share/man/man3/elf_fill.3.gz +OLD_FILES+=usr/share/man/man3/elf_flagdata.3.gz +OLD_FILES+=usr/share/man/man3/elf_getarhdr.3.gz +OLD_FILES+=usr/share/man/man3/elf_getarsym.3.gz +OLD_FILES+=usr/share/man/man3/elf_getbase.3.gz +OLD_FILES+=usr/share/man/man3/elf_getdata.3.gz +OLD_FILES+=usr/share/man/man3/elf_getident.3.gz +OLD_FILES+=usr/share/man/man3/elf_getscn.3.gz +OLD_FILES+=usr/share/man/man3/elf_getphdrnum.3.gz +OLD_FILES+=usr/share/man/man3/elf_getphnum.3.gz +OLD_FILES+=usr/share/man/man3/elf_getshdrnum.3.gz +OLD_FILES+=usr/share/man/man3/elf_getshnum.3.gz +OLD_FILES+=usr/share/man/man3/elf_getshdrstrndx.3.gz +OLD_FILES+=usr/share/man/man3/elf_getshstrndx.3.gz +OLD_FILES+=usr/share/man/man3/elf_hash.3.gz +OLD_FILES+=usr/share/man/man3/elf_kind.3.gz +OLD_FILES+=usr/share/man/man3/elf_memory.3.gz +OLD_FILES+=usr/share/man/man3/elf_next.3.gz +OLD_FILES+=usr/share/man/man3/elf_open.3.gz +OLD_FILES+=usr/share/man/man3/elf_rawfile.3.gz +OLD_FILES+=usr/share/man/man3/elf_rand.3.gz +OLD_FILES+=usr/share/man/man3/elf_strptr.3.gz +OLD_FILES+=usr/share/man/man3/elf_update.3.gz +OLD_FILES+=usr/share/man/man3/elf_version.3.gz +OLD_FILES+=usr/share/man/man3/gelf.3.gz +OLD_FILES+=usr/share/man/man3/gelf_checksum.3.gz +OLD_FILES+=usr/share/man/man3/gelf_fsize.3.gz +OLD_FILES+=usr/share/man/man3/gelf_getcap.3.gz +OLD_FILES+=usr/share/man/man3/gelf_getclass.3.gz +OLD_FILES+=usr/share/man/man3/gelf_getdyn.3.gz +OLD_FILES+=usr/share/man/man3/gelf_getehdr.3.gz +OLD_FILES+=usr/share/man/man3/gelf_getmove.3.gz +OLD_FILES+=usr/share/man/man3/gelf_getphdr.3.gz +OLD_FILES+=usr/share/man/man3/gelf_getrel.3.gz +OLD_FILES+=usr/share/man/man3/gelf_getrela.3.gz +OLD_FILES+=usr/share/man/man3/gelf_getshdr.3.gz +OLD_FILES+=usr/share/man/man3/gelf_getsym.3.gz +OLD_FILES+=usr/share/man/man3/gelf_getsyminfo.3.gz +OLD_FILES+=usr/share/man/man3/gelf_getsymshndx.3.gz +OLD_FILES+=usr/share/man/man3/gelf_newehdr.3.gz +OLD_FILES+=usr/share/man/man3/gelf_newphdr.3.gz +OLD_FILES+=usr/share/man/man3/gelf_update_ehdr.3.gz +OLD_FILES+=usr/share/man/man3/gelf_xlatetof.3.gz +# lib/libelftc +OLD_FILES+=usr/share/man/man3/elftc.3.gz +OLD_FILES+=usr/share/man/man3/elftc_bfd_find_target.3.gz +OLD_FILES+=usr/share/man/man3/elftc_copyfile.3.gz +OLD_FILES+=usr/share/man/man3/elftc_demangle.3.gz +OLD_FILES+=usr/share/man/man3/elftc_reloc_type_str.3.gz +OLD_FILES+=usr/share/man/man3/elftc_set_timestamps.3.gz +OLD_FILES+=usr/share/man/man3/elftc_timestamp.3.gz +OLD_FILES+=usr/share/man/man3/elftc_string_table_create.3.gz +OLD_FILES+=usr/share/man/man3/elftc_version.3.gz OLD_FILES+=usr/tests/usr.bin/yacc/Kyuafile OLD_FILES+=usr/tests/usr.bin/yacc/btyacc_calc1.y OLD_FILES+=usr/tests/usr.bin/yacc/btyacc_demo.y From owner-svn-src-all@freebsd.org Sat Dec 24 12:58:34 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7BB19C8E496; Sat, 24 Dec 2016 12:58:34 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 30F001C4E; Sat, 24 Dec 2016 12:58:34 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBOCwXbK024312; Sat, 24 Dec 2016 12:58:33 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBOCwXIu024311; Sat, 24 Dec 2016 12:58:33 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201612241258.uBOCwXIu024311@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Ngie Cooper Date: Sat, 24 Dec 2016 12:58:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r310506 - stable/11/contrib/netbsd-tests/lib/libc/sys X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 24 Dec 2016 12:58:34 -0000 Author: ngie Date: Sat Dec 24 12:58:33 2016 New Revision: 310506 URL: https://svnweb.freebsd.org/changeset/base/310506 Log: MFC r309837: Change the process limits for RLIMIT_MEMLOCK to RLIM_INFINITY when executing :mincore_resid The default process limits in FreeBSD is 64kB for unprivileged users, which empirically is too low to run the :mincore_resid testcase. Process limits are inherited, so even though the default limit for root users is RLIM_INFINITY, the inherited limit with "sudo" with the default login.conf will be 64kB. Use setrlimit to set rlim_max for RLIMIT_MEMLOCK to RLIM_INFINITY to avoid ENOMEM issues when calling mlock to wire the mmap'ed address space. setrlimit requires root access to increase rlim_max, so require root privileges when running the test Discovered when executing the tests with sudo, e.g. "sudo kyua test -k /usr/tests/lib/libc/sys/Kyuafile mincore_test" Modified: stable/11/contrib/netbsd-tests/lib/libc/sys/t_mincore.c Directory Properties: stable/11/ (props changed) Modified: stable/11/contrib/netbsd-tests/lib/libc/sys/t_mincore.c ============================================================================== --- stable/11/contrib/netbsd-tests/lib/libc/sys/t_mincore.c Sat Dec 24 12:55:37 2016 (r310505) +++ stable/11/contrib/netbsd-tests/lib/libc/sys/t_mincore.c Sat Dec 24 12:58:33 2016 (r310506) @@ -144,6 +144,9 @@ ATF_TC_WITH_CLEANUP(mincore_resid); ATF_TC_HEAD(mincore_resid, tc) { atf_tc_set_md_var(tc, "descr", "Test page residency with mincore(2)"); +#ifdef __FreeBSD__ + atf_tc_set_md_var(tc, "require.user", "root"); +#endif } ATF_TC_BODY(mincore_resid, tc) @@ -155,6 +158,13 @@ ATF_TC_BODY(mincore_resid, tc) struct rlimit rlim; ATF_REQUIRE(getrlimit(RLIMIT_MEMLOCK, &rlim) == 0); +#ifdef __FreeBSD__ + /* + * Bump the mlock limit to unlimited so the rest of the testcase + * passes instead of failing on the mlock call. + */ + rlim.rlim_max = RLIM_INFINITY; +#endif rlim.rlim_cur = rlim.rlim_max; ATF_REQUIRE(setrlimit(RLIMIT_MEMLOCK, &rlim) == 0); @@ -206,8 +216,9 @@ ATF_TC_BODY(mincore_resid, tc) "might be low on memory"); #ifdef __FreeBSD__ - ATF_REQUIRE_MSG(mlock(addr, npgs * page) == 0, "mlock failed: %s", - strerror(errno)); + if (mlock(addr, npgs * page) == -1 && errno != ENOMEM) + atf_tc_skip("could not wire anonymous test area, system might " + "be low on memory"); #endif ATF_REQUIRE(check_residency(addr, npgs) == npgs); ATF_REQUIRE(munmap(addr, npgs * page) == 0); From owner-svn-src-all@freebsd.org Sat Dec 24 13:00:20 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 93DDEC8E54C; Sat, 24 Dec 2016 13:00:20 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4A9921DE0; Sat, 24 Dec 2016 13:00:20 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBOD0Jm1024475; Sat, 24 Dec 2016 13:00:19 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBOD0JLw024474; Sat, 24 Dec 2016 13:00:19 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201612241300.uBOD0JLw024474@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Ngie Cooper Date: Sat, 24 Dec 2016 13:00:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r310507 - stable/10/contrib/netbsd-tests/lib/libc/sys X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 24 Dec 2016 13:00:20 -0000 Author: ngie Date: Sat Dec 24 13:00:19 2016 New Revision: 310507 URL: https://svnweb.freebsd.org/changeset/base/310507 Log: MFstable/11 r310506: MFC r309837: Change the process limits for RLIMIT_MEMLOCK to RLIM_INFINITY when executing :mincore_resid The default process limits in FreeBSD is 64kB for unprivileged users, which empirically is too low to run the :mincore_resid testcase. Process limits are inherited, so even though the default limit for root users is RLIM_INFINITY, the inherited limit with "sudo" with the default login.conf will be 64kB. Use setrlimit to set rlim_max for RLIMIT_MEMLOCK to RLIM_INFINITY to avoid ENOMEM issues when calling mlock to wire the mmap'ed address space. setrlimit requires root access to increase rlim_max, so require root privileges when running the test Discovered when executing the tests with sudo, e.g. "sudo kyua test -k /usr/tests/lib/libc/sys/Kyuafile mincore_test" Modified: stable/10/contrib/netbsd-tests/lib/libc/sys/t_mincore.c Directory Properties: stable/10/ (props changed) Modified: stable/10/contrib/netbsd-tests/lib/libc/sys/t_mincore.c ============================================================================== --- stable/10/contrib/netbsd-tests/lib/libc/sys/t_mincore.c Sat Dec 24 12:58:33 2016 (r310506) +++ stable/10/contrib/netbsd-tests/lib/libc/sys/t_mincore.c Sat Dec 24 13:00:19 2016 (r310507) @@ -144,6 +144,9 @@ ATF_TC_WITH_CLEANUP(mincore_resid); ATF_TC_HEAD(mincore_resid, tc) { atf_tc_set_md_var(tc, "descr", "Test page residency with mincore(2)"); +#ifdef __FreeBSD__ + atf_tc_set_md_var(tc, "require.user", "root"); +#endif } ATF_TC_BODY(mincore_resid, tc) @@ -155,6 +158,13 @@ ATF_TC_BODY(mincore_resid, tc) struct rlimit rlim; ATF_REQUIRE(getrlimit(RLIMIT_MEMLOCK, &rlim) == 0); +#ifdef __FreeBSD__ + /* + * Bump the mlock limit to unlimited so the rest of the testcase + * passes instead of failing on the mlock call. + */ + rlim.rlim_max = RLIM_INFINITY; +#endif rlim.rlim_cur = rlim.rlim_max; ATF_REQUIRE(setrlimit(RLIMIT_MEMLOCK, &rlim) == 0); @@ -206,8 +216,9 @@ ATF_TC_BODY(mincore_resid, tc) "might be low on memory"); #ifdef __FreeBSD__ - ATF_REQUIRE_MSG(mlock(addr, npgs * page) == 0, "mlock failed: %s", - strerror(errno)); + if (mlock(addr, npgs * page) == -1 && errno != ENOMEM) + atf_tc_skip("could not wire anonymous test area, system might " + "be low on memory"); #endif ATF_REQUIRE(check_residency(addr, npgs) == npgs); ATF_REQUIRE(munmap(addr, npgs * page) == 0); From owner-svn-src-all@freebsd.org Sat Dec 24 13:07:16 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2EDFEC8EB0D; Sat, 24 Dec 2016 13:07:16 +0000 (UTC) (envelope-from yaneurabeya@gmail.com) Received: from mail-pg0-x244.google.com (mail-pg0-x244.google.com [IPv6:2607:f8b0:400e:c05::244]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id F007210EA; Sat, 24 Dec 2016 13:07:15 +0000 (UTC) (envelope-from yaneurabeya@gmail.com) Received: by mail-pg0-x244.google.com with SMTP id i5so3689526pgh.2; Sat, 24 Dec 2016 05:07:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:mime-version:from:in-reply-to:date:cc:message-id:references :to; bh=n7OkXlwPcktNLnJkacayhGlxd5rtvfy4AcIUw2J7rmA=; b=El5iwS3m4lMkOP90I7bjBS4cpCfHwtIkiBSaqTat4m8TTu29XVX3F7QCN6SklMJJ86 RFETGn4H7ksB2XQaMD0eZhmECxGYnFpFAW7yKiN2FBfH7H7bNcC+EK0vx5gSk6j5xxap 3Uj9f5tr2yTRccknem6EY3lCG/iVXshqKK5J4dEloPzgWOK3oND7IITYmwokynbQEdD8 zJrRHp4qh2Yt68HonelLKAFF74uxodV2sIB9bWXIcH50+2wN4XychUewV6YEfIeoe2IQ DxWa7rdqVOpaa6LbxLJUWYz1AV+l4wO2rYTzNFV4P3vjUJBn+IHO5d4AyVwRbdQk/Jp/ XL3w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:mime-version:from:in-reply-to:date:cc :message-id:references:to; bh=n7OkXlwPcktNLnJkacayhGlxd5rtvfy4AcIUw2J7rmA=; b=Hww67dt74NSCzVIcVN9E+yowsEsi5cZ5gElv6G4D2YWVgMvJpGRugawNKn2v3v2obg BhvPpHlE0ox7/xyal6vTnrgJRa1ZoHB5IWGfat5gKOC+ujbjqx6d1iHQ6xypLFBiI0QH BlGnrUevQUoOfT5n1yWy+oTl+IxDaObXWh9xiT36r+kLyNu8+WlwjKaSRQ2LsCEgbAIE SIhVYeCcRd08PUDdAn3gxOZPvrmus3rwCJPbykhuw/6nlwLVUjUfJDPKHJu5Y/1F3d0O eb77uKrzKpXMrNNNUC2/ANPcNA5acQc8+1MS4qLvLkyZ1sMPi8A3Klm8gd4HzpgHfwWP i7GA== X-Gm-Message-State: AIkVDXKd4YKgcxCeYN490uDE0ZJAm6x3pEMS3QUq9vsRR7PD8c98XX1od2vfLRAbpj34YA== X-Received: by 10.99.135.200 with SMTP id i191mr34371934pge.162.1482584835541; Sat, 24 Dec 2016 05:07:15 -0800 (PST) Received: from [192.168.20.12] (c-73-19-52-228.hsd1.wa.comcast.net. [73.19.52.228]) by smtp.gmail.com with ESMTPSA id t3sm27035152pfb.60.2016.12.24.05.07.14 (version=TLS1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sat, 24 Dec 2016 05:07:14 -0800 (PST) Subject: Re: svn commit: r309774 - head/contrib/netbsd-tests/fs/tmpfs Mime-Version: 1.0 (Mac OS X Mail 9.3 \(3124\)) Content-Type: multipart/signed; boundary="Apple-Mail=_D0346E5E-0F45-40F3-8517-A0C671F064F8"; protocol="application/pgp-signature"; micalg=pgp-sha512 X-Pgp-Agent: GPGMail From: "Ngie Cooper (yaneurabeya)" In-Reply-To: <20161210103511.GO54029@kib.kiev.ua> Date: Sat, 24 Dec 2016 05:07:14 -0800 Cc: Ngie Cooper , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Message-Id: <060D8CAD-E4A1-4984-AD97-FDF0B96A004A@gmail.com> References: <201612092250.uB9MohnP008576@repo.freebsd.org> <20161210103511.GO54029@kib.kiev.ua> To: Konstantin Belousov X-Mailer: Apple Mail (2.3124) X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 24 Dec 2016 13:07:16 -0000 --Apple-Mail=_D0346E5E-0F45-40F3-8517-A0C671F064F8 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 > On Dec 10, 2016, at 02:35, Konstantin Belousov = wrote: =E2=80=A6 > Why this test is under fs/tmpfs ? I was not able to see how tmpfs is > used for this test. test_mount (the first command executed in the testcases), sets up a = tmpfs mount. Thus, the test is ensuring that md(4) devices (or vnd(4) in = the case of NetBSD) can be backed on tmpfs mounts. Thanks! -Ngie --Apple-Mail=_D0346E5E-0F45-40F3-8517-A0C671F064F8 Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=signature.asc Content-Type: application/pgp-signature; name=signature.asc Content-Description: Message signed with OpenPGP using GPGMail -----BEGIN PGP SIGNATURE----- Comment: GPGTools - https://gpgtools.org iQIcBAEBCgAGBQJYXnMCAAoJEPWDqSZpMIYVgLwQAIY0bQlMX6C/mL2LDvVRQ2n6 4hx/0Jdcyur4H1Rjus9MACsQKAr6U/cCIiGoxWp4zUqWEyWXfcFdv29fXlqSONhf TtwkLo1Td/rhCIpI1jWa0m5pzDaa0YprXDlbxsPh+N2jDVRuKCuk9wIsuwQP2hXH rR2+2eG5ti8BxDiakDdBe14bqM+AYd3v3Z9b+KVimC2nnG5xF2OzL2aL8Nzdq3HQ Asc9AgK5KLctDkhScXSQsH619BvJW/JxSYyd7tHwjQvncj+OP68d0mw7ITzsyOnJ oiolBrJUWlXUEFtEIjamaqYQIrVwPXFeowG0s9G4nStS122OlWSn+2wP4BOiRL38 XtXcRsxOfSmUGGgQ3yy5jNN2R5rbTQe4g1B2S3Xo2epgQbVEr0DlJ0OYBEZohTKE yf/ZcxsnQuhzfhdeU7OxJUziQ6NOfrYVtODFgz/081/kzTF3DNirT7N8D8Bp2O8n Qsf7RhYa+cC5RTb5kuHcZYf29kqcM/dHARBbK2aJ1l6VuxaD3IjBWUBCKZ/mNnAq F2dp6uUaq262KllUTA2jKJsvXnC4jzK12VJ0oyYIZvxLZtrdZP3SDH/KYNp4KAz4 y2XxrkZPXIneZQEd4PwAAZadcm97HGEk3AensGr5L37WmbRzzCwTAGfqE9RonuZR XRmVWRVFFX19X8NKR+Fv =pC8p -----END PGP SIGNATURE----- --Apple-Mail=_D0346E5E-0F45-40F3-8517-A0C671F064F8-- From owner-svn-src-all@freebsd.org Sat Dec 24 13:28:40 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 758BBC8F2C6; Sat, 24 Dec 2016 13:28:40 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 44A441E59; Sat, 24 Dec 2016 13:28:40 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBODSdlP038492; Sat, 24 Dec 2016 13:28:39 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBODSd0D038490; Sat, 24 Dec 2016 13:28:39 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201612241328.uBODSd0D038490@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Sat, 24 Dec 2016 13:28:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r310508 - in stable/10/sys/ia64: ia64 include X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 24 Dec 2016 13:28:40 -0000 Author: avg Date: Sat Dec 24 13:28:39 2016 New Revision: 310508 URL: https://svnweb.freebsd.org/changeset/base/310508 Log: define Maxmem for ia64, the only platform that didn't have it This is a direct commit to stable/10 as the platform was removed in the newer branches. Maxmem is required for compiling fwohci(4) on ia64 since commit r310081, MFC of r277511. It was easier to add Maxmem than to make a special case for ia64 in fwohci. Reported by: jhb, gjb Discussed with: kib, jhb Modified: stable/10/sys/ia64/ia64/physmem.c stable/10/sys/ia64/include/md_var.h Modified: stable/10/sys/ia64/ia64/physmem.c ============================================================================== --- stable/10/sys/ia64/ia64/physmem.c Sat Dec 24 13:00:19 2016 (r310507) +++ stable/10/sys/ia64/ia64/physmem.c Sat Dec 24 13:28:39 2016 (r310508) @@ -38,7 +38,7 @@ static u_int phys_avail_segs; vm_paddr_t phys_avail[2 * VM_PHYSSEG_MAX + 2]; vm_paddr_t paddr_max; - +long Maxmem; long realmem; static u_int @@ -168,6 +168,12 @@ ia64_physmem_fini(void) size = 1U << 27; realmem = (realmem + size - 1) & ~(size - 1); realmem = atop(realmem); + + /* + * Maxmem isn't the "maximum memory", it's one larger than the + * highest page of the physical address space. + */ + Maxmem = atop(paddr_max); return (0); } Modified: stable/10/sys/ia64/include/md_var.h ============================================================================== --- stable/10/sys/ia64/include/md_var.h Sat Dec 24 13:00:19 2016 (r310507) +++ stable/10/sys/ia64/include/md_var.h Sat Dec 24 13:28:39 2016 (r310508) @@ -75,6 +75,7 @@ struct ia64_init_return { extern uint64_t ia64_lapic_addr; extern vm_paddr_t paddr_max; +extern long Maxmem; extern u_int busdma_swi_pending; void *acpi_find_table(const char *sig); From owner-svn-src-all@freebsd.org Sat Dec 24 13:36:35 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D908EC8F5F5; Sat, 24 Dec 2016 13:36:35 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from citapm.icyb.net.ua (citapm.icyb.net.ua [212.40.38.140]) by mx1.freebsd.org (Postfix) with ESMTP id 6CC723C7; Sat, 24 Dec 2016 13:36:33 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from porto.starpoint.kiev.ua (porto-e.starpoint.kiev.ua [212.40.38.100]) by citapm.icyb.net.ua (8.8.8p3/ICyb-2.3exp) with ESMTP id PAA25273; Sat, 24 Dec 2016 15:36:32 +0200 (EET) (envelope-from avg@FreeBSD.org) Received: from localhost ([127.0.0.1]) by porto.starpoint.kiev.ua with esmtp (Exim 4.34 (FreeBSD)) id 1cKmUy-000H13-Oz; Sat, 24 Dec 2016 15:36:32 +0200 Subject: Re: svn commit: r308371 - in stable/10: share/man/man4 sys/conf sys/dev/jedec_ts sys/modules/i2c sys/modules/i2c/jedec_ts To: John Baldwin References: <201611061356.uA6DuYcO079294@repo.freebsd.org> <1625245.4edrXav981@ralph.baldwin.cx> <912ba7fd-353c-006e-ef65-faa12b83de9f@FreeBSD.org> <2547422.gn4y6NaJ31@ralph.baldwin.cx> Cc: src-committers@FreeBSD.org, svn-src-all@FreeBSD.org, svn-src-stable@FreeBSD.org, svn-src-stable-10@FreeBSD.org From: Andriy Gapon Message-ID: <9c234848-2d27-b417-b78d-18bde988bc07@FreeBSD.org> Date: Sat, 24 Dec 2016 15:35:37 +0200 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:45.0) Gecko/20100101 Thunderbird/45.5.1 MIME-Version: 1.0 In-Reply-To: <2547422.gn4y6NaJ31@ralph.baldwin.cx> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 24 Dec 2016 13:36:36 -0000 On 19/12/2016 18:55, John Baldwin wrote: > Yes. Well, it fixes linking of kernels at least. Now make tinderbox > on 10 fails for the following kernels: > > _.ia64.GENERIC: Maxmem is not available on ia64. It is spelled > paddr_max instead. The firewire code is trying to use Maxmem. > _.ia64.LINT: Same. > _.arm.LINT: Many link errors and warnings, though lack of 'kbd_*' symbols > seems to be the only actual errors. > > I suspect you recently MFC'd changes to fwohci.c that are using Maxmem. > However, I'm not sure it is worth fixing fwohci on ia64. The ia64 problem should be fixed now. I added Maxmem as we discussed. -- Andriy Gapon From owner-svn-src-all@freebsd.org Sat Dec 24 13:55:00 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 288F2C8FA46; Sat, 24 Dec 2016 13:55:00 +0000 (UTC) (envelope-from hrs@FreeBSD.org) Received: from mail.allbsd.org (gatekeeper.allbsd.org [IPv6:2001:2f0:104:e001::32]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "*.allbsd.org", Issuer "RapidSSL SHA256 CA - G3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 9D21FFDE; Sat, 24 Dec 2016 13:54:59 +0000 (UTC) (envelope-from hrs@FreeBSD.org) Received: from mail-d.allbsd.org (p2027-ipbf1605funabasi.chiba.ocn.ne.jp [123.225.191.27]) (authenticated bits=56) by mail.allbsd.org (8.15.2/8.15.2) with ESMTPSA id uBODsZWP081360 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL) (Client CN "/OU=GT07882699/OU=See+20www.rapidssl.com/resources/cps+20+28c+2915/OU=Domain+20Control+20Validated+20-+20RapidSSL+28R+29/CN=*.allbsd.org", Issuer "/C=US/O=GeoTrust+20Inc./CN=RapidSSL+20SHA256+20CA+20-+20G3"); Sat, 24 Dec 2016 22:54:55 +0900 (JST) (envelope-from hrs@FreeBSD.org) Received: from alph.allbsd.org (alph.allbsd.org [192.168.0.10]) by mail-d.allbsd.org (8.15.2/8.15.2) with ESMTPS id uBODrIZ2005918 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Sat, 24 Dec 2016 22:53:18 +0900 (JST) (envelope-from hrs@FreeBSD.org) Received: from localhost (localhost [IPv6:::1]) (authenticated bits=0) by alph.allbsd.org (8.15.2/8.15.2) with ESMTPA id uBODrGAF005914; Sat, 24 Dec 2016 22:53:17 +0900 (JST) (envelope-from hrs@FreeBSD.org) Date: Sat, 24 Dec 2016 22:52:21 +0900 (JST) Message-Id: <20161224.225221.1424676865406190118.hrs@allbsd.org> To: ngie@FreeBSD.org Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r310504 - head/usr.sbin/syslogd From: Hiroki Sato In-Reply-To: <201612241250.uBOCoH8C019980@repo.freebsd.org> References: <201612241250.uBOCoH8C019980@repo.freebsd.org> X-PGPkey-fingerprint: BDB3 443F A5DD B3D0 A530 FFD7 4F2C D3D8 2793 CF2D X-Mailer: Mew version 6.7 on Emacs 25.1 / Mule 6.0 (HANACHIRUSATO) Mime-Version: 1.0 Content-Type: Multipart/Signed; protocol="application/pgp-signature"; micalg=pgp-sha1; boundary="--Security_Multipart(Sat_Dec_24_22_52_21_2016_960)--" Content-Transfer-Encoding: 7bit X-Virus-Scanned: clamav-milter 0.99 at gatekeeper.allbsd.org X-Virus-Status: Clean X-Greylist: Sender DNS name whitelisted, not delayed by milter-greylist-4.4.3 (mail.allbsd.org [133.31.130.32]); Sat, 24 Dec 2016 22:54:56 +0900 (JST) X-Spam-Status: No, score=-99.9 required=13.0 tests=CONTENT_TYPE_PRESENT, QENCPTR1,USER_IN_WHITELIST autolearn=no autolearn_force=no version=3.4.1 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on gatekeeper.allbsd.org X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 24 Dec 2016 13:55:00 -0000 ----Security_Multipart(Sat_Dec_24_22_52_21_2016_960)-- Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit Ngie Cooper wrote in <201612241250.uBOCoH8C019980@repo.freebsd.org>: ng> Author: ngie ng> Date: Sat Dec 24 12:50:17 2016 ng> New Revision: 310504 ng> URL: https://svnweb.freebsd.org/changeset/base/310504 ng> ng> Log: ng> Unbreak syslogd after r310494 ng> ng> Don't close all file descriptors greater than STDERR_FILENO (2) in ng> waitdaemon(..) -- only close fd (file descriptor for /dev/null used in ng> subsequent calls to dup2) if it's greater than STDERR_FILENO. ng> ng> Reported by: subbsd@gmail.com, danny@cs.huji.ac.il ng> Pointyhat to: hrs ng> X-MFC with: r310494 Thanks! -- Hiroki ----Security_Multipart(Sat_Dec_24_22_52_21_2016_960)-- Content-Type: application/pgp-signature Content-Transfer-Encoding: 7bit -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iEYEABECAAYFAlhefZUACgkQTyzT2CeTzy20+gCfZPr0uOkfw3mrhXkfiw7RnDK5 FwkAoLbMjOUaPH5aQ3TfnS/+DG0uD34l =Eeir -----END PGP SIGNATURE----- ----Security_Multipart(Sat_Dec_24_22_52_21_2016_960)---- From owner-svn-src-all@freebsd.org Sat Dec 24 14:12:54 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4F198C8FE6E; Sat, 24 Dec 2016 14:12:54 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 0F62B19FC; Sat, 24 Dec 2016 14:12:53 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBOECrf2058486; Sat, 24 Dec 2016 14:12:53 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBOECrLc058483; Sat, 24 Dec 2016 14:12:53 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201612241412.uBOECrLc058483@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Sat, 24 Dec 2016 14:12:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r310509 - in stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs: . sys X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 24 Dec 2016 14:12:54 -0000 Author: avg Date: Sat Dec 24 14:12:52 2016 New Revision: 310509 URL: https://svnweb.freebsd.org/changeset/base/310509 Log: MFC r309097: MFV r308987: 7180 potential race between zfs_suspend_fs+zfs_resume_fs and zfs_ioc_rename Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_vfsops.h stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_vfsops.h ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_vfsops.h Sat Dec 24 13:28:39 2016 (r310508) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_vfsops.h Sat Dec 24 14:12:52 2016 (r310509) @@ -142,7 +142,7 @@ extern uint_t zfs_fsyncer_key; extern int zfs_super_owner; extern int zfs_suspend_fs(zfsvfs_t *zfsvfs); -extern int zfs_resume_fs(zfsvfs_t *zfsvfs, const char *osname); +extern int zfs_resume_fs(zfsvfs_t *zfsvfs, struct dsl_dataset *ds); extern int zfs_userspace_one(zfsvfs_t *zfsvfs, zfs_userquota_prop_t type, const char *domain, uint64_t rid, uint64_t *valuep); extern int zfs_userspace_many(zfsvfs_t *zfsvfs, zfs_userquota_prop_t type, Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c Sat Dec 24 13:28:39 2016 (r310508) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c Sat Dec 24 14:12:52 2016 (r310509) @@ -3788,12 +3788,15 @@ zfs_ioc_rollback(const char *fsname, nvl int error; if (getzfsvfs(fsname, &zfsvfs) == 0) { + dsl_dataset_t *ds; + + ds = dmu_objset_ds(zfsvfs->z_os); error = zfs_suspend_fs(zfsvfs); if (error == 0) { int resume_err; error = dsl_dataset_rollback(fsname, zfsvfs, outnvl); - resume_err = zfs_resume_fs(zfsvfs, fsname); + resume_err = zfs_resume_fs(zfsvfs, ds); error = error ? error : resume_err; } #ifdef illumos @@ -4444,8 +4447,10 @@ zfs_ioc_recv(zfs_cmd_t *zc) if (getzfsvfs(tofs, &zfsvfs) == 0) { /* online recv */ + dsl_dataset_t *ds; int end_err; + ds = dmu_objset_ds(zfsvfs->z_os); error = zfs_suspend_fs(zfsvfs); /* * If the suspend fails, then the recv_end will @@ -4453,7 +4458,7 @@ zfs_ioc_recv(zfs_cmd_t *zc) */ end_err = dmu_recv_end(&drc, zfsvfs); if (error == 0) - error = zfs_resume_fs(zfsvfs, tofs); + error = zfs_resume_fs(zfsvfs, ds); error = error ? error : end_err; #ifdef illumos VFS_RELE(zfsvfs->z_vfs); @@ -4999,11 +5004,14 @@ zfs_ioc_userspace_upgrade(zfs_cmd_t *zc) * objset needs to be closed & reopened (to grow the * objset_phys_t). Suspend/resume the fs will do that. */ + dsl_dataset_t *ds; + + ds = dmu_objset_ds(zfsvfs->z_os); error = zfs_suspend_fs(zfsvfs); if (error == 0) { dmu_objset_refresh_ownership(zfsvfs->z_os, zfsvfs); - error = zfs_resume_fs(zfsvfs, zc->zc_name); + error = zfs_resume_fs(zfsvfs, ds); } } if (error == 0) Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c Sat Dec 24 13:28:39 2016 (r310508) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c Sat Dec 24 14:12:52 2016 (r310509) @@ -2225,7 +2225,7 @@ zfs_suspend_fs(zfsvfs_t *zfsvfs) * zfsvfs, held, and long held on entry. */ int -zfs_resume_fs(zfsvfs_t *zfsvfs, const char *osname) +zfs_resume_fs(zfsvfs_t *zfsvfs, dsl_dataset_t *ds) { int err; znode_t *zp; @@ -2234,14 +2234,13 @@ zfs_resume_fs(zfsvfs_t *zfsvfs, const ch ASSERT(RW_WRITE_HELD(&zfsvfs->z_teardown_inactive_lock)); /* - * We already own this, so just hold and rele it to update the - * objset_t, as the one we had before may have been evicted. + * We already own this, so just update the objset_t, as the one we + * had before may have been evicted. */ objset_t *os; - VERIFY0(dmu_objset_hold(osname, zfsvfs, &os)); - VERIFY3P(os->os_dsl_dataset->ds_owner, ==, zfsvfs); - VERIFY(dsl_dataset_long_held(os->os_dsl_dataset)); - dmu_objset_rele(os, zfsvfs); + VERIFY3P(ds->ds_owner, ==, zfsvfs); + VERIFY(dsl_dataset_long_held(ds)); + VERIFY0(dmu_objset_from_ds(ds, &os)); err = zfsvfs_init(zfsvfs, os); if (err != 0) From owner-svn-src-all@freebsd.org Sat Dec 24 14:13:23 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 695C2C8FECD; Sat, 24 Dec 2016 14:13:23 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 2A2F81B60; Sat, 24 Dec 2016 14:13:23 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBOEDMTv058555; Sat, 24 Dec 2016 14:13:22 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBOEDMnh058551; Sat, 24 Dec 2016 14:13:22 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201612241413.uBOEDMnh058551@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Sat, 24 Dec 2016 14:13:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r310510 - in stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs: . sys X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 24 Dec 2016 14:13:23 -0000 Author: avg Date: Sat Dec 24 14:13:21 2016 New Revision: 310510 URL: https://svnweb.freebsd.org/changeset/base/310510 Log: MFC r309097: MFV r308987: 7180 potential race between zfs_suspend_fs+zfs_resume_fs and zfs_ioc_rename Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_vfsops.h stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_vfsops.h ============================================================================== --- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_vfsops.h Sat Dec 24 14:12:52 2016 (r310509) +++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_vfsops.h Sat Dec 24 14:13:21 2016 (r310510) @@ -142,7 +142,7 @@ extern uint_t zfs_fsyncer_key; extern int zfs_super_owner; extern int zfs_suspend_fs(zfsvfs_t *zfsvfs); -extern int zfs_resume_fs(zfsvfs_t *zfsvfs, const char *osname); +extern int zfs_resume_fs(zfsvfs_t *zfsvfs, struct dsl_dataset *ds); extern int zfs_userspace_one(zfsvfs_t *zfsvfs, zfs_userquota_prop_t type, const char *domain, uint64_t rid, uint64_t *valuep); extern int zfs_userspace_many(zfsvfs_t *zfsvfs, zfs_userquota_prop_t type, Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c ============================================================================== --- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c Sat Dec 24 14:12:52 2016 (r310509) +++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c Sat Dec 24 14:13:21 2016 (r310510) @@ -3788,12 +3788,15 @@ zfs_ioc_rollback(const char *fsname, nvl int error; if (getzfsvfs(fsname, &zfsvfs) == 0) { + dsl_dataset_t *ds; + + ds = dmu_objset_ds(zfsvfs->z_os); error = zfs_suspend_fs(zfsvfs); if (error == 0) { int resume_err; error = dsl_dataset_rollback(fsname, zfsvfs, outnvl); - resume_err = zfs_resume_fs(zfsvfs, fsname); + resume_err = zfs_resume_fs(zfsvfs, ds); error = error ? error : resume_err; } #ifdef illumos @@ -4444,8 +4447,10 @@ zfs_ioc_recv(zfs_cmd_t *zc) if (getzfsvfs(tofs, &zfsvfs) == 0) { /* online recv */ + dsl_dataset_t *ds; int end_err; + ds = dmu_objset_ds(zfsvfs->z_os); error = zfs_suspend_fs(zfsvfs); /* * If the suspend fails, then the recv_end will @@ -4453,7 +4458,7 @@ zfs_ioc_recv(zfs_cmd_t *zc) */ end_err = dmu_recv_end(&drc, zfsvfs); if (error == 0) - error = zfs_resume_fs(zfsvfs, tofs); + error = zfs_resume_fs(zfsvfs, ds); error = error ? error : end_err; #ifdef illumos VFS_RELE(zfsvfs->z_vfs); @@ -4999,11 +5004,14 @@ zfs_ioc_userspace_upgrade(zfs_cmd_t *zc) * objset needs to be closed & reopened (to grow the * objset_phys_t). Suspend/resume the fs will do that. */ + dsl_dataset_t *ds; + + ds = dmu_objset_ds(zfsvfs->z_os); error = zfs_suspend_fs(zfsvfs); if (error == 0) { dmu_objset_refresh_ownership(zfsvfs->z_os, zfsvfs); - error = zfs_resume_fs(zfsvfs, zc->zc_name); + error = zfs_resume_fs(zfsvfs, ds); } } if (error == 0) Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c ============================================================================== --- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c Sat Dec 24 14:12:52 2016 (r310509) +++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c Sat Dec 24 14:13:21 2016 (r310510) @@ -2226,7 +2226,7 @@ zfs_suspend_fs(zfsvfs_t *zfsvfs) * zfsvfs, held, and long held on entry. */ int -zfs_resume_fs(zfsvfs_t *zfsvfs, const char *osname) +zfs_resume_fs(zfsvfs_t *zfsvfs, dsl_dataset_t *ds) { int err; znode_t *zp; @@ -2235,14 +2235,13 @@ zfs_resume_fs(zfsvfs_t *zfsvfs, const ch ASSERT(RW_WRITE_HELD(&zfsvfs->z_teardown_inactive_lock)); /* - * We already own this, so just hold and rele it to update the - * objset_t, as the one we had before may have been evicted. + * We already own this, so just update the objset_t, as the one we + * had before may have been evicted. */ objset_t *os; - VERIFY0(dmu_objset_hold(osname, zfsvfs, &os)); - VERIFY3P(os->os_dsl_dataset->ds_owner, ==, zfsvfs); - VERIFY(dsl_dataset_long_held(os->os_dsl_dataset)); - dmu_objset_rele(os, zfsvfs); + VERIFY3P(ds->ds_owner, ==, zfsvfs); + VERIFY(dsl_dataset_long_held(ds)); + VERIFY0(dmu_objset_from_ds(ds, &os)); err = zfsvfs_init(zfsvfs, os); if (err != 0) From owner-svn-src-all@freebsd.org Sat Dec 24 14:17:42 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B850BC8FFA2; Sat, 24 Dec 2016 14:17:42 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 92CBD1D45; Sat, 24 Dec 2016 14:17:42 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBOEHfnK058761; Sat, 24 Dec 2016 14:17:41 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBOEHfC8058758; Sat, 24 Dec 2016 14:17:41 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201612241417.uBOEHfC8058758@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Sat, 24 Dec 2016 14:17:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r310511 - in stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs: . sys X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 24 Dec 2016 14:17:42 -0000 Author: avg Date: Sat Dec 24 14:17:41 2016 New Revision: 310511 URL: https://svnweb.freebsd.org/changeset/base/310511 Log: MFC r309098: MFV r308988: 7199, 7200 dsl_dataset_rollback_sync may try to free already free blocks Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dataset.c stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_pool.c stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dsl_dataset.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dataset.c ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dataset.c Sat Dec 24 14:13:21 2016 (r310510) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dataset.c Sat Dec 24 14:17:41 2016 (r310511) @@ -88,6 +88,8 @@ extern inline dsl_dataset_phys_t *dsl_da extern int spa_asize_inflation; +static zil_header_t zero_zil; + /* * Figure out how much of this delta should be propogated to the dsl_dir * layer. If there's a refreservation, that space has already been @@ -132,6 +134,7 @@ dsl_dataset_block_born(dsl_dataset_t *ds return; } + ASSERT3U(bp->blk_birth, >, dsl_dataset_phys(ds)->ds_prev_snap_txg); dmu_buf_will_dirty(ds->ds_dbuf, tx); mutex_enter(&ds->ds_lock); delta = parent_delta(ds, used); @@ -902,8 +905,20 @@ dsl_dataset_zero_zil(dsl_dataset_t *ds, objset_t *os; VERIFY0(dmu_objset_from_ds(ds, &os)); - bzero(&os->os_zil_header, sizeof (os->os_zil_header)); - dsl_dataset_dirty(ds, tx); + if (bcmp(&os->os_zil_header, &zero_zil, sizeof (zero_zil)) != 0) { + dsl_pool_t *dp = ds->ds_dir->dd_pool; + zio_t *zio; + + bzero(&os->os_zil_header, sizeof (os->os_zil_header)); + + zio = zio_root(dp->dp_spa, NULL, NULL, ZIO_FLAG_MUSTSUCCEED); + dsl_dataset_sync(ds, zio, tx); + VERIFY0(zio_wait(zio)); + + /* dsl_dataset_sync_done will drop this reference. */ + dmu_buf_add_ref(ds->ds_dbuf, ds); + dsl_dataset_sync_done(ds, tx); + } } uint64_t @@ -1083,8 +1098,10 @@ dsl_dataset_dirty(dsl_dataset_t *ds, dmu if (dsl_dataset_phys(ds)->ds_next_snap_obj != 0) panic("dirtying snapshot!"); - dp = ds->ds_dir->dd_pool; + /* Must not dirty a dataset in the same txg where it got snapshotted. */ + ASSERT3U(tx->tx_txg, >, dsl_dataset_phys(ds)->ds_prev_snap_txg); + dp = ds->ds_dir->dd_pool; if (txg_list_add(&dp->dp_dirty_datasets, ds, tx->tx_txg)) { /* up the hold count until we can be written out */ dmu_buf_add_ref(ds->ds_dbuf, ds); @@ -1339,8 +1356,6 @@ void dsl_dataset_snapshot_sync_impl(dsl_dataset_t *ds, const char *snapname, dmu_tx_t *tx) { - static zil_header_t zero_zil; - dsl_pool_t *dp = ds->ds_dir->dd_pool; dmu_buf_t *dbuf; dsl_dataset_phys_t *dsphys; @@ -1359,6 +1374,10 @@ dsl_dataset_snapshot_sync_impl(dsl_datas bcmp(&os->os_phys->os_zil_header, &zero_zil, sizeof (zero_zil)) == 0); + /* Should not snapshot a dirty dataset. */ + ASSERT(!txg_list_member(&ds->ds_dir->dd_pool->dp_dirty_datasets, + ds, tx->tx_txg)); + dsl_fs_ss_count_adjust(ds->ds_dir, 1, DD_FIELD_SNAPSHOT_COUNT, tx); /* @@ -1718,6 +1737,27 @@ dsl_dataset_sync(dsl_dataset_t *ds, zio_ } } +static int +deadlist_enqueue_cb(void *arg, const blkptr_t *bp, dmu_tx_t *tx) +{ + dsl_deadlist_t *dl = arg; + dsl_deadlist_insert(dl, bp, tx); + return (0); +} + +void +dsl_dataset_sync_done(dsl_dataset_t *ds, dmu_tx_t *tx) +{ + objset_t *os = ds->ds_objset; + + bplist_iterate(&ds->ds_pending_deadlist, + deadlist_enqueue_cb, &ds->ds_deadlist, tx); + + ASSERT(!dmu_objset_is_dirty(os, dmu_tx_get_txg(tx))); + + dmu_buf_rele(ds->ds_dbuf, ds); +} + static void get_clones_stat(dsl_dataset_t *ds, nvlist_t *nv) { @@ -2237,6 +2277,18 @@ dsl_dataset_rollback_check(void *arg, dm return (SET_ERROR(EINVAL)); } + /* + * No rollback to a snapshot created in the current txg, because + * the rollback may dirty the dataset and create blocks that are + * not reachable from the rootbp while having a birth txg that + * falls into the snapshot's range. + */ + if (dmu_tx_is_syncing(tx) && + dsl_dataset_phys(ds)->ds_prev_snap_txg >= tx->tx_txg) { + dsl_dataset_rele(ds, FTAG); + return (SET_ERROR(EAGAIN)); + } + /* must not have any bookmarks after the most recent snapshot */ nvlist_t *proprequest = fnvlist_alloc(); fnvlist_add_boolean(proprequest, zfs_prop_to_name(ZFS_PROP_CREATETXG)); Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_pool.c ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_pool.c Sat Dec 24 14:13:21 2016 (r310510) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_pool.c Sat Dec 24 14:17:41 2016 (r310511) @@ -524,14 +524,6 @@ dsl_pool_mos_diduse_space(dsl_pool_t *dp mutex_exit(&dp->dp_lock); } -static int -deadlist_enqueue_cb(void *arg, const blkptr_t *bp, dmu_tx_t *tx) -{ - dsl_deadlist_t *dl = arg; - dsl_deadlist_insert(dl, bp, tx); - return (0); -} - static void dsl_pool_sync_mos(dsl_pool_t *dp, dmu_tx_t *tx) { @@ -632,11 +624,7 @@ dsl_pool_sync(dsl_pool_t *dp, uint64_t t * - release hold from dsl_dataset_dirty() */ while ((ds = list_remove_head(&synced_datasets)) != NULL) { - objset_t *os = ds->ds_objset; - bplist_iterate(&ds->ds_pending_deadlist, - deadlist_enqueue_cb, &ds->ds_deadlist, tx); - ASSERT(!dmu_objset_is_dirty(os, txg)); - dmu_buf_rele(ds->ds_dbuf, ds); + dsl_dataset_sync_done(ds, tx); } while ((dd = txg_list_remove(&dp->dp_dirty_dirs, txg)) != NULL) { dsl_dir_sync(dd, tx); Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dsl_dataset.h ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dsl_dataset.h Sat Dec 24 14:13:21 2016 (r310510) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dsl_dataset.h Sat Dec 24 14:17:41 2016 (r310511) @@ -274,6 +274,7 @@ boolean_t dsl_dataset_modified_since_sna dsl_dataset_t *snap); void dsl_dataset_sync(dsl_dataset_t *os, zio_t *zio, dmu_tx_t *tx); +void dsl_dataset_sync_done(dsl_dataset_t *os, dmu_tx_t *tx); void dsl_dataset_block_born(dsl_dataset_t *ds, const blkptr_t *bp, dmu_tx_t *tx); From owner-svn-src-all@freebsd.org Sat Dec 24 14:17:51 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id BC950C8FFDF; Sat, 24 Dec 2016 14:17:51 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 91A1B1D9F; Sat, 24 Dec 2016 14:17:51 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBOEHoFB058813; Sat, 24 Dec 2016 14:17:50 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBOEHodj058810; Sat, 24 Dec 2016 14:17:50 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201612241417.uBOEHodj058810@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Sat, 24 Dec 2016 14:17:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r310512 - in stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs: . sys X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 24 Dec 2016 14:17:51 -0000 Author: avg Date: Sat Dec 24 14:17:50 2016 New Revision: 310512 URL: https://svnweb.freebsd.org/changeset/base/310512 Log: MFC r309098: MFV r308988: 7199, 7200 dsl_dataset_rollback_sync may try to free already free blocks Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dataset.c stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_pool.c stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dsl_dataset.h Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dataset.c ============================================================================== --- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dataset.c Sat Dec 24 14:17:41 2016 (r310511) +++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dataset.c Sat Dec 24 14:17:50 2016 (r310512) @@ -88,6 +88,8 @@ extern inline dsl_dataset_phys_t *dsl_da extern int spa_asize_inflation; +static zil_header_t zero_zil; + /* * Figure out how much of this delta should be propogated to the dsl_dir * layer. If there's a refreservation, that space has already been @@ -132,6 +134,7 @@ dsl_dataset_block_born(dsl_dataset_t *ds return; } + ASSERT3U(bp->blk_birth, >, dsl_dataset_phys(ds)->ds_prev_snap_txg); dmu_buf_will_dirty(ds->ds_dbuf, tx); mutex_enter(&ds->ds_lock); delta = parent_delta(ds, used); @@ -902,8 +905,20 @@ dsl_dataset_zero_zil(dsl_dataset_t *ds, objset_t *os; VERIFY0(dmu_objset_from_ds(ds, &os)); - bzero(&os->os_zil_header, sizeof (os->os_zil_header)); - dsl_dataset_dirty(ds, tx); + if (bcmp(&os->os_zil_header, &zero_zil, sizeof (zero_zil)) != 0) { + dsl_pool_t *dp = ds->ds_dir->dd_pool; + zio_t *zio; + + bzero(&os->os_zil_header, sizeof (os->os_zil_header)); + + zio = zio_root(dp->dp_spa, NULL, NULL, ZIO_FLAG_MUSTSUCCEED); + dsl_dataset_sync(ds, zio, tx); + VERIFY0(zio_wait(zio)); + + /* dsl_dataset_sync_done will drop this reference. */ + dmu_buf_add_ref(ds->ds_dbuf, ds); + dsl_dataset_sync_done(ds, tx); + } } uint64_t @@ -1083,8 +1098,10 @@ dsl_dataset_dirty(dsl_dataset_t *ds, dmu if (dsl_dataset_phys(ds)->ds_next_snap_obj != 0) panic("dirtying snapshot!"); - dp = ds->ds_dir->dd_pool; + /* Must not dirty a dataset in the same txg where it got snapshotted. */ + ASSERT3U(tx->tx_txg, >, dsl_dataset_phys(ds)->ds_prev_snap_txg); + dp = ds->ds_dir->dd_pool; if (txg_list_add(&dp->dp_dirty_datasets, ds, tx->tx_txg)) { /* up the hold count until we can be written out */ dmu_buf_add_ref(ds->ds_dbuf, ds); @@ -1339,8 +1356,6 @@ void dsl_dataset_snapshot_sync_impl(dsl_dataset_t *ds, const char *snapname, dmu_tx_t *tx) { - static zil_header_t zero_zil; - dsl_pool_t *dp = ds->ds_dir->dd_pool; dmu_buf_t *dbuf; dsl_dataset_phys_t *dsphys; @@ -1359,6 +1374,10 @@ dsl_dataset_snapshot_sync_impl(dsl_datas bcmp(&os->os_phys->os_zil_header, &zero_zil, sizeof (zero_zil)) == 0); + /* Should not snapshot a dirty dataset. */ + ASSERT(!txg_list_member(&ds->ds_dir->dd_pool->dp_dirty_datasets, + ds, tx->tx_txg)); + dsl_fs_ss_count_adjust(ds->ds_dir, 1, DD_FIELD_SNAPSHOT_COUNT, tx); /* @@ -1718,6 +1737,27 @@ dsl_dataset_sync(dsl_dataset_t *ds, zio_ } } +static int +deadlist_enqueue_cb(void *arg, const blkptr_t *bp, dmu_tx_t *tx) +{ + dsl_deadlist_t *dl = arg; + dsl_deadlist_insert(dl, bp, tx); + return (0); +} + +void +dsl_dataset_sync_done(dsl_dataset_t *ds, dmu_tx_t *tx) +{ + objset_t *os = ds->ds_objset; + + bplist_iterate(&ds->ds_pending_deadlist, + deadlist_enqueue_cb, &ds->ds_deadlist, tx); + + ASSERT(!dmu_objset_is_dirty(os, dmu_tx_get_txg(tx))); + + dmu_buf_rele(ds->ds_dbuf, ds); +} + static void get_clones_stat(dsl_dataset_t *ds, nvlist_t *nv) { @@ -2237,6 +2277,18 @@ dsl_dataset_rollback_check(void *arg, dm return (SET_ERROR(EINVAL)); } + /* + * No rollback to a snapshot created in the current txg, because + * the rollback may dirty the dataset and create blocks that are + * not reachable from the rootbp while having a birth txg that + * falls into the snapshot's range. + */ + if (dmu_tx_is_syncing(tx) && + dsl_dataset_phys(ds)->ds_prev_snap_txg >= tx->tx_txg) { + dsl_dataset_rele(ds, FTAG); + return (SET_ERROR(EAGAIN)); + } + /* must not have any bookmarks after the most recent snapshot */ nvlist_t *proprequest = fnvlist_alloc(); fnvlist_add_boolean(proprequest, zfs_prop_to_name(ZFS_PROP_CREATETXG)); Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_pool.c ============================================================================== --- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_pool.c Sat Dec 24 14:17:41 2016 (r310511) +++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_pool.c Sat Dec 24 14:17:50 2016 (r310512) @@ -528,14 +528,6 @@ dsl_pool_mos_diduse_space(dsl_pool_t *dp mutex_exit(&dp->dp_lock); } -static int -deadlist_enqueue_cb(void *arg, const blkptr_t *bp, dmu_tx_t *tx) -{ - dsl_deadlist_t *dl = arg; - dsl_deadlist_insert(dl, bp, tx); - return (0); -} - static void dsl_pool_sync_mos(dsl_pool_t *dp, dmu_tx_t *tx) { @@ -636,11 +628,7 @@ dsl_pool_sync(dsl_pool_t *dp, uint64_t t * - release hold from dsl_dataset_dirty() */ while ((ds = list_remove_head(&synced_datasets)) != NULL) { - objset_t *os = ds->ds_objset; - bplist_iterate(&ds->ds_pending_deadlist, - deadlist_enqueue_cb, &ds->ds_deadlist, tx); - ASSERT(!dmu_objset_is_dirty(os, txg)); - dmu_buf_rele(ds->ds_dbuf, ds); + dsl_dataset_sync_done(ds, tx); } while ((dd = txg_list_remove(&dp->dp_dirty_dirs, txg)) != NULL) { dsl_dir_sync(dd, tx); Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dsl_dataset.h ============================================================================== --- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dsl_dataset.h Sat Dec 24 14:17:41 2016 (r310511) +++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dsl_dataset.h Sat Dec 24 14:17:50 2016 (r310512) @@ -274,6 +274,7 @@ boolean_t dsl_dataset_modified_since_sna dsl_dataset_t *snap); void dsl_dataset_sync(dsl_dataset_t *os, zio_t *zio, dmu_tx_t *tx); +void dsl_dataset_sync_done(dsl_dataset_t *os, dmu_tx_t *tx); void dsl_dataset_block_born(dsl_dataset_t *ds, const blkptr_t *bp, dmu_tx_t *tx); From owner-svn-src-all@freebsd.org Sat Dec 24 14:23:10 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 99325C8E2F8; Sat, 24 Dec 2016 14:23:10 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 682685E0; Sat, 24 Dec 2016 14:23:10 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBOEN9xo062658; Sat, 24 Dec 2016 14:23:09 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBOEN9X3062657; Sat, 24 Dec 2016 14:23:09 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201612241423.uBOEN9X3062657@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Sat, 24 Dec 2016 14:23:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r310513 - stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 24 Dec 2016 14:23:10 -0000 Author: avg Date: Sat Dec 24 14:23:09 2016 New Revision: 310513 URL: https://svnweb.freebsd.org/changeset/base/310513 Log: MFC r309099: MFV r308990: 7181 race between zfs_mount and zfs_ioc_rollback Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c Sat Dec 24 14:17:50 2016 (r310512) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c Sat Dec 24 14:23:09 2016 (r310513) @@ -1039,13 +1039,6 @@ zfsvfs_setup(zfsvfs_t *zfsvfs, boolean_t if (error) return (error); - /* - * Set the objset user_ptr to track its zfsvfs. - */ - mutex_enter(&zfsvfs->z_os->os_user_ptr_lock); - dmu_objset_set_user(zfsvfs->z_os, zfsvfs); - mutex_exit(&zfsvfs->z_os->os_user_ptr_lock); - zfsvfs->z_log = zil_open(zfsvfs->z_os, zfs_get_data); /* @@ -1106,6 +1099,13 @@ zfsvfs_setup(zfsvfs_t *zfsvfs, boolean_t zfsvfs->z_vfs->vfs_flag |= readonly; /* restore readonly bit */ } + /* + * Set the objset user_ptr to track its zfsvfs. + */ + mutex_enter(&zfsvfs->z_os->os_user_ptr_lock); + dmu_objset_set_user(zfsvfs->z_os, zfsvfs); + mutex_exit(&zfsvfs->z_os->os_user_ptr_lock); + return (0); } From owner-svn-src-all@freebsd.org Sat Dec 24 14:23:15 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id F0F33C8E337; Sat, 24 Dec 2016 14:23:15 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id BA8CC635; Sat, 24 Dec 2016 14:23:15 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBOENEVW062705; Sat, 24 Dec 2016 14:23:14 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBOENErn062704; Sat, 24 Dec 2016 14:23:14 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201612241423.uBOENErn062704@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Sat, 24 Dec 2016 14:23:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r310514 - stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 24 Dec 2016 14:23:16 -0000 Author: avg Date: Sat Dec 24 14:23:14 2016 New Revision: 310514 URL: https://svnweb.freebsd.org/changeset/base/310514 Log: MFC r309099: MFV r308990: 7181 race between zfs_mount and zfs_ioc_rollback Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c ============================================================================== --- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c Sat Dec 24 14:23:09 2016 (r310513) +++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c Sat Dec 24 14:23:14 2016 (r310514) @@ -1040,13 +1040,6 @@ zfsvfs_setup(zfsvfs_t *zfsvfs, boolean_t if (error) return (error); - /* - * Set the objset user_ptr to track its zfsvfs. - */ - mutex_enter(&zfsvfs->z_os->os_user_ptr_lock); - dmu_objset_set_user(zfsvfs->z_os, zfsvfs); - mutex_exit(&zfsvfs->z_os->os_user_ptr_lock); - zfsvfs->z_log = zil_open(zfsvfs->z_os, zfs_get_data); /* @@ -1107,6 +1100,13 @@ zfsvfs_setup(zfsvfs_t *zfsvfs, boolean_t zfsvfs->z_vfs->vfs_flag |= readonly; /* restore readonly bit */ } + /* + * Set the objset user_ptr to track its zfsvfs. + */ + mutex_enter(&zfsvfs->z_os->os_user_ptr_lock); + dmu_objset_set_user(zfsvfs->z_os, zfsvfs); + mutex_exit(&zfsvfs->z_os->os_user_ptr_lock); + return (0); } From owner-svn-src-all@freebsd.org Sat Dec 24 14:25:21 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id AA5B6C8E482; Sat, 24 Dec 2016 14:25:21 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 820AFA0F; Sat, 24 Dec 2016 14:25:21 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBOEPKWG062947; Sat, 24 Dec 2016 14:25:20 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBOEPKcA062944; Sat, 24 Dec 2016 14:25:20 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201612241425.uBOEPKcA062944@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Sat, 24 Dec 2016 14:25:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r310515 - stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 24 Dec 2016 14:25:21 -0000 Author: avg Date: Sat Dec 24 14:25:20 2016 New Revision: 310515 URL: https://svnweb.freebsd.org/changeset/base/310515 Log: MFC r309250: MFV r309249: 3821 Race in rollback, zil close, and zil flush Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_pool.c stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zil.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_pool.c ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_pool.c Sat Dec 24 14:23:14 2016 (r310514) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_pool.c Sat Dec 24 14:25:20 2016 (r310515) @@ -20,7 +20,7 @@ */ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2011, 2015 by Delphix. All rights reserved. + * Copyright (c) 2011, 2016 by Delphix. All rights reserved. * Copyright (c) 2013 Steven Hartland. All rights reserved. * Copyright (c) 2014 Spectra Logic Corporation, All rights reserved. * Copyright (c) 2014 Integros [integros.com] @@ -681,9 +681,16 @@ dsl_pool_sync_done(dsl_pool_t *dp, uint6 { zilog_t *zilog; - while (zilog = txg_list_remove(&dp->dp_dirty_zilogs, txg)) { + while (zilog = txg_list_head(&dp->dp_dirty_zilogs, txg)) { dsl_dataset_t *ds = dmu_objset_ds(zilog->zl_os); + /* + * We don't remove the zilog from the dp_dirty_zilogs + * list until after we've cleaned it. This ensures that + * callers of zilog_is_dirty() receive an accurate + * answer when they are racing with the spa sync thread. + */ zil_clean(zilog, txg); + (void) txg_list_remove_this(&dp->dp_dirty_zilogs, zilog, txg); ASSERT(!dmu_objset_is_dirty(zilog->zl_os, txg)); dmu_buf_rele(ds->ds_dbuf, zilog); } Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c Sat Dec 24 14:23:14 2016 (r310514) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c Sat Dec 24 14:25:20 2016 (r310515) @@ -7091,8 +7091,6 @@ spa_sync(spa_t *spa, uint64_t txg) spa->spa_config_syncing = NULL; } - spa->spa_ubsync = spa->spa_uberblock; - dsl_pool_sync_done(dp, txg); mutex_enter(&spa->spa_alloc_lock); @@ -7117,6 +7115,13 @@ spa_sync(spa_t *spa, uint64_t txg) spa->spa_sync_pass = 0; + /* + * Update the last synced uberblock here. We want to do this at + * the end of spa_sync() so that consumers of spa_last_synced_txg() + * will be guaranteed that all the processing associated with + * that txg has been completed. + */ + spa->spa_ubsync = spa->spa_uberblock; spa_config_exit(spa, SCL_CONFIG, FTAG); spa_handle_ignored_writes(spa); Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zil.c ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zil.c Sat Dec 24 14:23:14 2016 (r310514) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zil.c Sat Dec 24 14:25:20 2016 (r310515) @@ -20,8 +20,7 @@ */ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2011, 2015 by Delphix. All rights reserved. - * Copyright (c) 2011, 2014 by Delphix. All rights reserved. + * Copyright (c) 2011, 2016 by Delphix. All rights reserved. * Copyright (c) 2014 Integros [integros.com] */ @@ -492,6 +491,27 @@ zilog_dirty(zilog_t *zilog, uint64_t txg } } +/* + * Determine if the zil is dirty in the specified txg. Callers wanting to + * ensure that the dirty state does not change must hold the itxg_lock for + * the specified txg. Holding the lock will ensure that the zil cannot be + * dirtied (zil_itx_assign) or cleaned (zil_clean) while we check its current + * state. + */ +boolean_t +zilog_is_dirty_in_txg(zilog_t *zilog, uint64_t txg) +{ + dsl_pool_t *dp = zilog->zl_dmu_pool; + + if (txg_list_member(&dp->dp_dirty_zilogs, zilog, txg & TXG_MASK)) + return (B_TRUE); + return (B_FALSE); +} + +/* + * Determine if the zil is dirty. The zil is considered dirty if it has + * any pending itx records that have not been cleaned by zil_clean(). + */ boolean_t zilog_is_dirty(zilog_t *zilog) { @@ -1055,8 +1075,6 @@ zil_lwb_commit(zilog_t *zilog, itx_t *it return (NULL); ASSERT(lwb->lwb_buf != NULL); - ASSERT(zilog_is_dirty(zilog) || - spa_freeze_txg(zilog->zl_spa) != UINT64_MAX); if (lrc->lrc_txtype == TX_WRITE && itx->itx_wr_state == WR_NEED_COPY) dlen = P2ROUNDUP_TYPED( @@ -1389,6 +1407,11 @@ zil_get_commit_list(zilog_t *zilog) else otxg = spa_last_synced_txg(zilog->zl_spa) + 1; + /* + * This is inherently racy, since there is nothing to prevent + * the last synced txg from changing. That's okay since we'll + * only commit things in the future. + */ for (txg = otxg; txg < (otxg + TXG_CONCURRENT_STATES); txg++) { itxg_t *itxg = &zilog->zl_itxg[txg & TXG_MASK]; @@ -1398,6 +1421,16 @@ zil_get_commit_list(zilog_t *zilog) continue; } + /* + * If we're adding itx records to the zl_itx_commit_list, + * then the zil better be dirty in this "txg". We can assert + * that here since we're holding the itxg_lock which will + * prevent spa_sync from cleaning it. Once we add the itxs + * to the zl_itx_commit_list we must commit it to disk even + * if it's unnecessary (i.e. the txg was synced). + */ + ASSERT(zilog_is_dirty_in_txg(zilog, txg) || + spa_freeze_txg(zilog->zl_spa) != UINT64_MAX); list_move_tail(commit_list, &itxg->itxg_itxs->i_sync_list); push_sod += itxg->itxg_sod; itxg->itxg_sod = 0; @@ -1423,6 +1456,10 @@ zil_async_to_sync(zilog_t *zilog, uint64 else otxg = spa_last_synced_txg(zilog->zl_spa) + 1; + /* + * This is inherently racy, since there is nothing to prevent + * the last synced txg from changing. + */ for (txg = otxg; txg < (otxg + TXG_CONCURRENT_STATES); txg++) { itxg_t *itxg = &zilog->zl_itxg[txg & TXG_MASK]; @@ -1494,8 +1531,14 @@ zil_commit_writer(zilog_t *zilog) DTRACE_PROBE1(zil__cw1, zilog_t *, zilog); while (itx = list_head(&zilog->zl_itx_commit_list)) { txg = itx->itx_lr.lrc_txg; - ASSERT(txg); + ASSERT3U(txg, !=, 0); + /* + * This is inherently racy and may result in us writing + * out a log block for a txg that was just synced. This is + * ok since we'll end cleaning up that log block the next + * time we call zil_sync(). + */ if (txg > spa_last_synced_txg(spa) || txg > spa_freeze_txg(spa)) lwb = zil_lwb_commit(zilog, itx, lwb); list_remove(&zilog->zl_itx_commit_list, itx); @@ -1812,7 +1855,10 @@ zil_close(zilog_t *zilog) mutex_exit(&zilog->zl_lock); if (txg) txg_wait_synced(zilog->zl_dmu_pool, txg); - ASSERT(!zilog_is_dirty(zilog)); + + if (zilog_is_dirty(zilog)) + zfs_dbgmsg("zil (%p) is dirty, txg %llu", zilog, txg); + VERIFY(!zilog_is_dirty(zilog)); taskq_destroy(zilog->zl_clean_taskq); zilog->zl_clean_taskq = NULL; From owner-svn-src-all@freebsd.org Sat Dec 24 14:25:27 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 61674C8E4CB; Sat, 24 Dec 2016 14:25:27 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 3B6D7A36; Sat, 24 Dec 2016 14:25:27 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBOEPQGY062997; Sat, 24 Dec 2016 14:25:26 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBOEPQOr062994; Sat, 24 Dec 2016 14:25:26 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201612241425.uBOEPQOr062994@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Sat, 24 Dec 2016 14:25:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r310516 - stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 24 Dec 2016 14:25:27 -0000 Author: avg Date: Sat Dec 24 14:25:25 2016 New Revision: 310516 URL: https://svnweb.freebsd.org/changeset/base/310516 Log: MFC r309250: MFV r309249: 3821 Race in rollback, zil close, and zil flush Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_pool.c stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zil.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_pool.c ============================================================================== --- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_pool.c Sat Dec 24 14:25:20 2016 (r310515) +++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_pool.c Sat Dec 24 14:25:25 2016 (r310516) @@ -20,7 +20,7 @@ */ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2011, 2015 by Delphix. All rights reserved. + * Copyright (c) 2011, 2016 by Delphix. All rights reserved. * Copyright (c) 2013 Steven Hartland. All rights reserved. * Copyright (c) 2014 Spectra Logic Corporation, All rights reserved. * Copyright (c) 2014 Integros [integros.com] @@ -685,9 +685,16 @@ dsl_pool_sync_done(dsl_pool_t *dp, uint6 { zilog_t *zilog; - while (zilog = txg_list_remove(&dp->dp_dirty_zilogs, txg)) { + while (zilog = txg_list_head(&dp->dp_dirty_zilogs, txg)) { dsl_dataset_t *ds = dmu_objset_ds(zilog->zl_os); + /* + * We don't remove the zilog from the dp_dirty_zilogs + * list until after we've cleaned it. This ensures that + * callers of zilog_is_dirty() receive an accurate + * answer when they are racing with the spa sync thread. + */ zil_clean(zilog, txg); + (void) txg_list_remove_this(&dp->dp_dirty_zilogs, zilog, txg); ASSERT(!dmu_objset_is_dirty(zilog->zl_os, txg)); dmu_buf_rele(ds->ds_dbuf, zilog); } Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c ============================================================================== --- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c Sat Dec 24 14:25:20 2016 (r310515) +++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c Sat Dec 24 14:25:25 2016 (r310516) @@ -6881,8 +6881,6 @@ spa_sync(spa_t *spa, uint64_t txg) spa->spa_config_syncing = NULL; } - spa->spa_ubsync = spa->spa_uberblock; - dsl_pool_sync_done(dp, txg); mutex_enter(&spa->spa_alloc_lock); @@ -6907,6 +6905,13 @@ spa_sync(spa_t *spa, uint64_t txg) spa->spa_sync_pass = 0; + /* + * Update the last synced uberblock here. We want to do this at + * the end of spa_sync() so that consumers of spa_last_synced_txg() + * will be guaranteed that all the processing associated with + * that txg has been completed. + */ + spa->spa_ubsync = spa->spa_uberblock; spa_config_exit(spa, SCL_CONFIG, FTAG); spa_handle_ignored_writes(spa); Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zil.c ============================================================================== --- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zil.c Sat Dec 24 14:25:20 2016 (r310515) +++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zil.c Sat Dec 24 14:25:25 2016 (r310516) @@ -20,8 +20,7 @@ */ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2011, 2015 by Delphix. All rights reserved. - * Copyright (c) 2011, 2014 by Delphix. All rights reserved. + * Copyright (c) 2011, 2016 by Delphix. All rights reserved. * Copyright (c) 2014 Integros [integros.com] */ @@ -495,6 +494,27 @@ zilog_dirty(zilog_t *zilog, uint64_t txg } } +/* + * Determine if the zil is dirty in the specified txg. Callers wanting to + * ensure that the dirty state does not change must hold the itxg_lock for + * the specified txg. Holding the lock will ensure that the zil cannot be + * dirtied (zil_itx_assign) or cleaned (zil_clean) while we check its current + * state. + */ +boolean_t +zilog_is_dirty_in_txg(zilog_t *zilog, uint64_t txg) +{ + dsl_pool_t *dp = zilog->zl_dmu_pool; + + if (txg_list_member(&dp->dp_dirty_zilogs, zilog, txg & TXG_MASK)) + return (B_TRUE); + return (B_FALSE); +} + +/* + * Determine if the zil is dirty. The zil is considered dirty if it has + * any pending itx records that have not been cleaned by zil_clean(). + */ boolean_t zilog_is_dirty(zilog_t *zilog) { @@ -1058,8 +1078,6 @@ zil_lwb_commit(zilog_t *zilog, itx_t *it return (NULL); ASSERT(lwb->lwb_buf != NULL); - ASSERT(zilog_is_dirty(zilog) || - spa_freeze_txg(zilog->zl_spa) != UINT64_MAX); if (lrc->lrc_txtype == TX_WRITE && itx->itx_wr_state == WR_NEED_COPY) dlen = P2ROUNDUP_TYPED( @@ -1392,6 +1410,11 @@ zil_get_commit_list(zilog_t *zilog) else otxg = spa_last_synced_txg(zilog->zl_spa) + 1; + /* + * This is inherently racy, since there is nothing to prevent + * the last synced txg from changing. That's okay since we'll + * only commit things in the future. + */ for (txg = otxg; txg < (otxg + TXG_CONCURRENT_STATES); txg++) { itxg_t *itxg = &zilog->zl_itxg[txg & TXG_MASK]; @@ -1401,6 +1424,16 @@ zil_get_commit_list(zilog_t *zilog) continue; } + /* + * If we're adding itx records to the zl_itx_commit_list, + * then the zil better be dirty in this "txg". We can assert + * that here since we're holding the itxg_lock which will + * prevent spa_sync from cleaning it. Once we add the itxs + * to the zl_itx_commit_list we must commit it to disk even + * if it's unnecessary (i.e. the txg was synced). + */ + ASSERT(zilog_is_dirty_in_txg(zilog, txg) || + spa_freeze_txg(zilog->zl_spa) != UINT64_MAX); list_move_tail(commit_list, &itxg->itxg_itxs->i_sync_list); push_sod += itxg->itxg_sod; itxg->itxg_sod = 0; @@ -1426,6 +1459,10 @@ zil_async_to_sync(zilog_t *zilog, uint64 else otxg = spa_last_synced_txg(zilog->zl_spa) + 1; + /* + * This is inherently racy, since there is nothing to prevent + * the last synced txg from changing. + */ for (txg = otxg; txg < (otxg + TXG_CONCURRENT_STATES); txg++) { itxg_t *itxg = &zilog->zl_itxg[txg & TXG_MASK]; @@ -1497,8 +1534,14 @@ zil_commit_writer(zilog_t *zilog) DTRACE_PROBE1(zil__cw1, zilog_t *, zilog); while (itx = list_head(&zilog->zl_itx_commit_list)) { txg = itx->itx_lr.lrc_txg; - ASSERT(txg); + ASSERT3U(txg, !=, 0); + /* + * This is inherently racy and may result in us writing + * out a log block for a txg that was just synced. This is + * ok since we'll end cleaning up that log block the next + * time we call zil_sync(). + */ if (txg > spa_last_synced_txg(spa) || txg > spa_freeze_txg(spa)) lwb = zil_lwb_commit(zilog, itx, lwb); list_remove(&zilog->zl_itx_commit_list, itx); @@ -1815,7 +1858,10 @@ zil_close(zilog_t *zilog) mutex_exit(&zilog->zl_lock); if (txg) txg_wait_synced(zilog->zl_dmu_pool, txg); - ASSERT(!zilog_is_dirty(zilog)); + + if (zilog_is_dirty(zilog)) + zfs_dbgmsg("zil (%p) is dirty, txg %llu", zilog, txg); + VERIFY(!zilog_is_dirty(zilog)); taskq_destroy(zilog->zl_clean_taskq); zilog->zl_clean_taskq = NULL; From owner-svn-src-all@freebsd.org Sat Dec 24 14:33:37 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3B12BC8E8F2; Sat, 24 Dec 2016 14:33:37 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 06ED0126D; Sat, 24 Dec 2016 14:33:36 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBOEXatm067155; Sat, 24 Dec 2016 14:33:36 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBOEXZJh067151; Sat, 24 Dec 2016 14:33:35 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201612241433.uBOEXZJh067151@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Sat, 24 Dec 2016 14:33:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r310517 - stable/11/sys/dev/ichiic X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 24 Dec 2016 14:33:37 -0000 Author: avg Date: Sat Dec 24 14:33:35 2016 New Revision: 310517 URL: https://svnweb.freebsd.org/changeset/base/310517 Log: MFC r308219: ichiic/ig4: completely disengage from smbus Modified: stable/11/sys/dev/ichiic/ig4_iic.c stable/11/sys/dev/ichiic/ig4_pci.c stable/11/sys/dev/ichiic/ig4_reg.h stable/11/sys/dev/ichiic/ig4_var.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/ichiic/ig4_iic.c ============================================================================== --- stable/11/sys/dev/ichiic/ig4_iic.c Sat Dec 24 14:25:25 2016 (r310516) +++ stable/11/sys/dev/ichiic/ig4_iic.c Sat Dec 24 14:33:35 2016 (r310517) @@ -37,7 +37,7 @@ __FBSDID("$FreeBSD$"); /* - * Intel fourth generation mobile cpus integrated I2C device, smbus driver. + * Intel fourth generation mobile cpus integrated I2C deviceer. * * See ig4_reg.h for datasheet reference and notes. * See ig4_var.h for locking semantics. @@ -60,7 +60,6 @@ __FBSDID("$FreeBSD$"); #include #include -#include #include #include @@ -236,18 +235,13 @@ data_read(ig4iic_softc_t *sc) * the target address for when the controller later issues a START. */ static void -set_slave_addr(ig4iic_softc_t *sc, uint8_t slave, int trans_op) +set_slave_addr(ig4iic_softc_t *sc, uint8_t slave) { uint32_t tar; uint32_t ctl; int use_10bit; - use_10bit = sc->use_10bit; - if (trans_op & SMB_TRANS_7BIT) - use_10bit = 0; - if (trans_op & SMB_TRANS_10BIT) - use_10bit = 1; - + use_10bit = 0; if (sc->slave_valid && sc->last_slave == slave && sc->use_10bit == use_10bit) { return; @@ -291,208 +285,12 @@ set_slave_addr(ig4iic_softc_t *sc, uint8 } /* - * Issue START with byte command, possible count, and a variable length - * read or write buffer, then possible turn-around read. The read also - * has a possible count received. - * - * For SMBUS - - * - * Quick: START+ADDR+RD/WR STOP - * - * Normal: START+ADDR+WR CMD DATA..DATA STOP - * - * START+ADDR+RD CMD - * RESTART+ADDR RDATA..RDATA STOP - * (can also be used for I2C transactions) - * - * Process Call: START+ADDR+WR CMD DATAL DATAH - * RESTART+ADDR+RD RDATAL RDATAH STOP - * - * Block: START+ADDR+RD CMD - * RESTART+ADDR+RD RCOUNT DATA... STOP - * - * START+ADDR+WR CMD - * RESTART+ADDR+WR WCOUNT DATA... STOP - * - * For I2C - basically, no *COUNT fields, possibly no *CMD field. If the - * sender needs to issue a 2-byte command it will incorporate it - * into the write buffer and also set NOCMD. - * - * Generally speaking, the START+ADDR / RESTART+ADDR is handled automatically - * by the controller at the beginning of a command sequence or on a data - * direction turn-around, and we only need to tell it when to issue the STOP. - */ -static int -smb_transaction(ig4iic_softc_t *sc, char cmd, int op, - char *wbuf, int wcount, char *rbuf, int rcount, int *actualp) -{ - int error; - int unit; - uint32_t last; - - /* - * Debugging - dump registers - */ - if (ig4_dump) { - unit = device_get_unit(sc->dev); - if (ig4_dump & (1 << unit)) { - ig4_dump &= ~(1 << unit); - ig4iic_dump(sc); - } - } - - /* - * Issue START or RESTART with next data byte, clear any previous - * abort condition that may have been holding the txfifo in reset. - */ - last = IG4_DATA_RESTART; - reg_read(sc, IG4_REG_CLR_TX_ABORT); - if (actualp) - *actualp = 0; - - /* - * Issue command if not told otherwise (smbus). - */ - if ((op & SMB_TRANS_NOCMD) == 0) { - error = wait_status(sc, IG4_STATUS_TX_NOTFULL); - if (error) - goto done; - last |= (u_char)cmd; - if (wcount == 0 && rcount == 0 && (op & SMB_TRANS_NOSTOP) == 0) - last |= IG4_DATA_STOP; - reg_write(sc, IG4_REG_DATA_CMD, last); - last = 0; - } - - /* - * Clean out any previously received data. - */ - if (sc->rpos != sc->rnext && - (op & SMB_TRANS_NOREPORT) == 0) { - device_printf(sc->dev, - "discarding %d bytes of spurious data\n", - sc->rnext - sc->rpos); - } - sc->rpos = 0; - sc->rnext = 0; - - /* - * If writing and not told otherwise, issue the write count (smbus). - */ - if (wcount && (op & SMB_TRANS_NOCNT) == 0) { - error = wait_status(sc, IG4_STATUS_TX_NOTFULL); - if (error) - goto done; - last |= (u_char)cmd; - reg_write(sc, IG4_REG_DATA_CMD, last); - last = 0; - } - - /* - * Bulk write (i2c) - */ - while (wcount) { - error = wait_status(sc, IG4_STATUS_TX_NOTFULL); - if (error) - goto done; - last |= (u_char)*wbuf; - if (wcount == 1 && rcount == 0 && (op & SMB_TRANS_NOSTOP) == 0) - last |= IG4_DATA_STOP; - reg_write(sc, IG4_REG_DATA_CMD, last); - --wcount; - ++wbuf; - last = 0; - } - - /* - * Issue reads to xmit FIFO (strange, I know) to tell the controller - * to clock in data. At the moment just issue one read ahead to - * pipeline the incoming data. - * - * NOTE: In the case of NOCMD and wcount == 0 we still issue a - * RESTART here, even if the data direction has not changed - * from the previous CHAINing call. This we force the RESTART. - * (A new START is issued automatically by the controller in - * the other nominal cases such as a data direction change or - * a previous STOP was issued). - * - * If this will be the last byte read we must also issue the STOP - * at the end of the read. - */ - if (rcount) { - last = IG4_DATA_RESTART | IG4_DATA_COMMAND_RD; - if (rcount == 1 && - (op & (SMB_TRANS_NOSTOP | SMB_TRANS_NOCNT)) == - SMB_TRANS_NOCNT) { - last |= IG4_DATA_STOP; - } - reg_write(sc, IG4_REG_DATA_CMD, last); - last = IG4_DATA_COMMAND_RD; - } - - /* - * Bulk read (i2c) and count field handling (smbus) - */ - while (rcount) { - /* - * Maintain a pipeline by queueing the allowance for the next - * read before waiting for the current read. - */ - if (rcount > 1) { - if (op & SMB_TRANS_NOCNT) - last = (rcount == 2) ? IG4_DATA_STOP : 0; - else - last = 0; - reg_write(sc, IG4_REG_DATA_CMD, IG4_DATA_COMMAND_RD | - last); - } - error = wait_status(sc, IG4_STATUS_RX_NOTEMPTY); - if (error) { - if ((op & SMB_TRANS_NOREPORT) == 0) { - device_printf(sc->dev, - "rx timeout addr 0x%02x\n", - sc->last_slave); - } - goto done; - } - last = data_read(sc); - - if (op & SMB_TRANS_NOCNT) { - *rbuf = (u_char)last; - ++rbuf; - --rcount; - if (actualp) - ++*actualp; - } else { - /* - * Handle count field (smbus), which is not part of - * the rcount'ed buffer. The first read data in a - * bulk transfer is the count. - * - * XXX if rcount is loaded as 0 how do I generate a - * STOP now without issuing another RD or WR? - */ - if (rcount > (u_char)last) - rcount = (u_char)last; - op |= SMB_TRANS_NOCNT; - } - } - error = 0; -done: - /* XXX wait for xmit buffer to become empty */ - last = reg_read(sc, IG4_REG_TX_ABRT_SOURCE); - - return (error); -} - -/* * IICBUS API FUNCTIONS */ static int ig4iic_xfer_start(ig4iic_softc_t *sc, uint16_t slave) { - /* XXX 10-bit address support? */ - set_slave_addr(sc, slave >> 1, 0); + set_slave_addr(sc, slave >> 1); return (0); } @@ -706,7 +504,7 @@ ig4iic_reset(device_t dev, u_char speed, /* TODO handle speed configuration? */ if (oldaddr != NULL) *oldaddr = sc->last_slave << 1; - set_slave_addr(sc, addr >> 1, 0); + set_slave_addr(sc, addr >> 1); if (addr == IIC_UNKNOWN) sc->slave_valid = false; @@ -716,8 +514,6 @@ ig4iic_reset(device_t dev, u_char speed, } /* - * SMBUS API FUNCTIONS - * * Called from ig4iic_pci_attach/detach() */ int @@ -836,7 +632,6 @@ ig4iic_start(void *xdev) config_intrhook_disestablish(&sc->enum_hook); - /* Attach us to the smbus */ error = bus_generic_attach(sc->dev); if (error) { device_printf(sc->dev, @@ -844,8 +639,6 @@ ig4iic_start(void *xdev) } } - - int ig4iic_detach(ig4iic_softc_t *sc) { @@ -874,276 +667,6 @@ ig4iic_detach(ig4iic_softc_t *sc) return (0); } -int -ig4iic_smb_callback(device_t dev, int index, void *data) -{ - int error; - - switch (index) { - case SMB_REQUEST_BUS: - error = 0; - break; - case SMB_RELEASE_BUS: - error = 0; - break; - default: - error = SMB_EABORT; - break; - } - - return (error); -} - -/* - * Quick command. i.e. START + cmd + R/W + STOP and no data. It is - * unclear to me how I could implement this with the intel i2c controller - * because the controller sends STARTs and STOPs automatically with data. - */ -int -ig4iic_smb_quick(device_t dev, u_char slave, int how) -{ - - return (SMB_ENOTSUPP); -} - -/* - * Incremental send byte without stop (?). It is unclear why the slave - * address is specified if this presumably is used in combination with - * ig4iic_smb_quick(). - * - * (Also, how would this work anyway? Issue the last byte with writeb()?) - */ -int -ig4iic_smb_sendb(device_t dev, u_char slave, char byte) -{ - ig4iic_softc_t *sc = device_get_softc(dev); - uint32_t cmd; - int error; - - sx_xlock(&sc->call_lock); - mtx_lock(&sc->io_lock); - - set_slave_addr(sc, slave, 0); - cmd = byte; - if (wait_status(sc, IG4_STATUS_TX_NOTFULL) == 0) { - reg_write(sc, IG4_REG_DATA_CMD, cmd); - error = 0; - } else { - error = SMB_ETIMEOUT; - } - - mtx_unlock(&sc->io_lock); - sx_xunlock(&sc->call_lock); - return (error); -} - -/* - * Incremental receive byte without stop (?). It is unclear why the slave - * address is specified if this presumably is used in combination with - * ig4iic_smb_quick(). - */ -int -ig4iic_smb_recvb(device_t dev, u_char slave, char *byte) -{ - ig4iic_softc_t *sc = device_get_softc(dev); - int error; - - sx_xlock(&sc->call_lock); - mtx_lock(&sc->io_lock); - - set_slave_addr(sc, slave, 0); - reg_write(sc, IG4_REG_DATA_CMD, IG4_DATA_COMMAND_RD); - if (wait_status(sc, IG4_STATUS_RX_NOTEMPTY) == 0) { - *byte = data_read(sc); - error = 0; - } else { - *byte = 0; - error = SMB_ETIMEOUT; - } - - mtx_unlock(&sc->io_lock); - sx_xunlock(&sc->call_lock); - return (error); -} - -/* - * Write command and single byte in transaction. - */ -int -ig4iic_smb_writeb(device_t dev, u_char slave, char cmd, char byte) -{ - ig4iic_softc_t *sc = device_get_softc(dev); - int error; - - sx_xlock(&sc->call_lock); - mtx_lock(&sc->io_lock); - - set_slave_addr(sc, slave, 0); - error = smb_transaction(sc, cmd, SMB_TRANS_NOCNT, - &byte, 1, NULL, 0, NULL); - - mtx_unlock(&sc->io_lock); - sx_xunlock(&sc->call_lock); - return (error); -} - -/* - * Write command and single word in transaction. - */ -int -ig4iic_smb_writew(device_t dev, u_char slave, char cmd, short word) -{ - ig4iic_softc_t *sc = device_get_softc(dev); - char buf[2]; - int error; - - sx_xlock(&sc->call_lock); - mtx_lock(&sc->io_lock); - - set_slave_addr(sc, slave, 0); - buf[0] = word & 0xFF; - buf[1] = word >> 8; - error = smb_transaction(sc, cmd, SMB_TRANS_NOCNT, - buf, 2, NULL, 0, NULL); - - mtx_unlock(&sc->io_lock); - sx_xunlock(&sc->call_lock); - return (error); -} - -/* - * write command and read single byte in transaction. - */ -int -ig4iic_smb_readb(device_t dev, u_char slave, char cmd, char *byte) -{ - ig4iic_softc_t *sc = device_get_softc(dev); - int error; - - sx_xlock(&sc->call_lock); - mtx_lock(&sc->io_lock); - - set_slave_addr(sc, slave, 0); - error = smb_transaction(sc, cmd, SMB_TRANS_NOCNT, - NULL, 0, byte, 1, NULL); - - mtx_unlock(&sc->io_lock); - sx_xunlock(&sc->call_lock); - return (error); -} - -/* - * write command and read word in transaction. - */ -int -ig4iic_smb_readw(device_t dev, u_char slave, char cmd, short *word) -{ - ig4iic_softc_t *sc = device_get_softc(dev); - char buf[2]; - int error; - - sx_xlock(&sc->call_lock); - mtx_lock(&sc->io_lock); - - set_slave_addr(sc, slave, 0); - if ((error = smb_transaction(sc, cmd, SMB_TRANS_NOCNT, - NULL, 0, buf, 2, NULL)) == 0) { - *word = (u_char)buf[0] | ((u_char)buf[1] << 8); - } - - mtx_unlock(&sc->io_lock); - sx_xunlock(&sc->call_lock); - return (error); -} - -/* - * write command and word and read word in transaction - */ -int -ig4iic_smb_pcall(device_t dev, u_char slave, char cmd, - short sdata, short *rdata) -{ - ig4iic_softc_t *sc = device_get_softc(dev); - char rbuf[2]; - char wbuf[2]; - int error; - - sx_xlock(&sc->call_lock); - mtx_lock(&sc->io_lock); - - set_slave_addr(sc, slave, 0); - wbuf[0] = sdata & 0xFF; - wbuf[1] = sdata >> 8; - if ((error = smb_transaction(sc, cmd, SMB_TRANS_NOCNT, - wbuf, 2, rbuf, 2, NULL)) == 0) { - *rdata = (u_char)rbuf[0] | ((u_char)rbuf[1] << 8); - } - - mtx_unlock(&sc->io_lock); - sx_xunlock(&sc->call_lock); - return (error); -} - -int -ig4iic_smb_bwrite(device_t dev, u_char slave, char cmd, - u_char wcount, char *buf) -{ - ig4iic_softc_t *sc = device_get_softc(dev); - int error; - - sx_xlock(&sc->call_lock); - mtx_lock(&sc->io_lock); - - set_slave_addr(sc, slave, 0); - error = smb_transaction(sc, cmd, 0, - buf, wcount, NULL, 0, NULL); - - mtx_unlock(&sc->io_lock); - sx_xunlock(&sc->call_lock); - return (error); -} - -int -ig4iic_smb_bread(device_t dev, u_char slave, char cmd, - u_char *countp_char, char *buf) -{ - ig4iic_softc_t *sc = device_get_softc(dev); - int rcount = *countp_char; - int error; - - sx_xlock(&sc->call_lock); - mtx_lock(&sc->io_lock); - - set_slave_addr(sc, slave, 0); - error = smb_transaction(sc, cmd, 0, - NULL, 0, buf, rcount, &rcount); - *countp_char = rcount; - - mtx_unlock(&sc->io_lock); - sx_xunlock(&sc->call_lock); - return (error); -} - -int -ig4iic_smb_trans(device_t dev, int slave, char cmd, int op, - char *wbuf, int wcount, char *rbuf, int rcount, - int *actualp) -{ - ig4iic_softc_t *sc = device_get_softc(dev); - int error; - - sx_xlock(&sc->call_lock); - mtx_lock(&sc->io_lock); - - set_slave_addr(sc, slave, op); - error = smb_transaction(sc, cmd, op, - wbuf, wcount, rbuf, rcount, actualp); - - mtx_unlock(&sc->io_lock); - sx_xunlock(&sc->call_lock); - return (error); -} - /* * Interrupt Operation, see ig4_var.h for locking semantics. */ Modified: stable/11/sys/dev/ichiic/ig4_pci.c ============================================================================== --- stable/11/sys/dev/ichiic/ig4_pci.c Sat Dec 24 14:25:25 2016 (r310516) +++ stable/11/sys/dev/ichiic/ig4_pci.c Sat Dec 24 14:33:35 2016 (r310517) @@ -37,7 +37,7 @@ __FBSDID("$FreeBSD$"); /* - * Intel fourth generation mobile cpus integrated I2C device, smbus driver. + * Intel fourth generation mobile cpus integrated I2C device. * * See ig4_reg.h for datasheet reference and notes. */ @@ -59,11 +59,8 @@ __FBSDID("$FreeBSD$"); #include #include -#include #include -#include "smbus_if.h" - #include #include @@ -167,20 +164,6 @@ static device_method_t ig4iic_pci_method DEVMETHOD(device_attach, ig4iic_pci_attach), DEVMETHOD(device_detach, ig4iic_pci_detach), - /* SMBus methods from ig4_smb.c */ - DEVMETHOD(smbus_callback, ig4iic_smb_callback), - DEVMETHOD(smbus_quick, ig4iic_smb_quick), - DEVMETHOD(smbus_sendb, ig4iic_smb_sendb), - DEVMETHOD(smbus_recvb, ig4iic_smb_recvb), - DEVMETHOD(smbus_writeb, ig4iic_smb_writeb), - DEVMETHOD(smbus_writew, ig4iic_smb_writew), - DEVMETHOD(smbus_readb, ig4iic_smb_readb), - DEVMETHOD(smbus_readw, ig4iic_smb_readw), - DEVMETHOD(smbus_pcall, ig4iic_smb_pcall), - DEVMETHOD(smbus_bwrite, ig4iic_smb_bwrite), - DEVMETHOD(smbus_bread, ig4iic_smb_bread), - DEVMETHOD(smbus_trans, ig4iic_smb_trans), - DEVMETHOD(iicbus_transfer, ig4iic_transfer), DEVMETHOD(iicbus_reset, ig4iic_reset), DEVMETHOD(iicbus_callback, iicbus_null_callback), @@ -199,6 +182,5 @@ static devclass_t ig4iic_pci_devclass; DRIVER_MODULE_ORDERED(ig4iic, pci, ig4iic_pci_driver, ig4iic_pci_devclass, 0, 0, SI_ORDER_ANY); MODULE_DEPEND(ig4iic, pci, 1, 1, 1); -MODULE_DEPEND(ig4iic, smbus, SMBUS_MINVER, SMBUS_PREFVER, SMBUS_MAXVER); MODULE_DEPEND(ig4iic, iicbus, IICBUS_MINVER, IICBUS_PREFVER, IICBUS_MAXVER); MODULE_VERSION(ig4iic, 1); Modified: stable/11/sys/dev/ichiic/ig4_reg.h ============================================================================== --- stable/11/sys/dev/ichiic/ig4_reg.h Sat Dec 24 14:25:25 2016 (r310516) +++ stable/11/sys/dev/ichiic/ig4_reg.h Sat Dec 24 14:33:35 2016 (r310517) @@ -47,14 +47,14 @@ * I am also using the linux driver code as a reference to help resolve any * issues that come. These will be specifically documented in the code. * - * Please see protocol notes in section 5.21. This controller is an I2C - * master only and cannot act as a slave. The IO voltage should be set by - * the BIOS. Standard (100Kb/s) and Fast (400Kb/s) and fast mode plus - * (1MB/s) is supported. High speed mode (3.4 MB/s) is NOT supported. + * This controller is an I2C master only and cannot act as a slave. The IO + * voltage should be set by the BIOS. Standard (100Kb/s) and Fast (400Kb/s) + * and fast mode plus (1MB/s) is supported. High speed mode (3.4 MB/s) is NOT + * supported. */ -#ifndef _BUS_SMBUS_INTELGEN4_IG4_REG_H_ -#define _BUS_SMBUS_INTELGEN4_IG4_REG_H_ +#ifndef _ICHIIC_IG4_REG_H_ +#define _ICHIIC_IG4_REG_H_ /* * 22.2 MMIO registers can be accessed through BAR0 in PCI mode or through @@ -619,4 +619,4 @@ #define IG4_SWLTR_SNOOP_VALUE_DECODE(v) ((v) & 0x3F) #define IG4_SWLTR_SNOOP_VALUE_ENCODE(v) ((v) & 0x3F) -#endif +#endif /* _ICHIIC_IG4_REG_H_ */ Modified: stable/11/sys/dev/ichiic/ig4_var.h ============================================================================== --- stable/11/sys/dev/ichiic/ig4_var.h Sat Dec 24 14:25:25 2016 (r310516) +++ stable/11/sys/dev/ichiic/ig4_var.h Sat Dec 24 14:33:35 2016 (r310517) @@ -35,13 +35,12 @@ * $FreeBSD$ */ -#ifndef _BUS_SMBUS_INTELGEN4_IG4_VAR_H_ -#define _BUS_SMBUS_INTELGEN4_IG4_VAR_H_ +#ifndef _ICHIIC_IG4_VAR_H_ +#define _ICHIIC_IG4_VAR_H_ #include "bus_if.h" #include "device_if.h" #include "pci_if.h" -#include "smbus_if.h" #include "iicbus_if.h" #define IG4_RBUFSIZE 128 @@ -75,12 +74,12 @@ struct ig4iic_softc { /* * Locking semantics: * - * Functions implementing the smbus interface that interact + * Functions implementing the icbus interface that interact * with the controller acquire an exclusive lock on call_lock * to prevent interleaving of calls to the interface and a lock on * io_lock right afterwards, to synchronize controller I/O activity. - * - * The interrupt handler can only read data while no ig4iic_smb_* call + * + * The interrupt handler can only read data while no iicbus call * is in progress or while io_lock is dropped during mtx_sleep in * wait_status and set_controller. It is safe to drop io_lock in those * places, because the interrupt handler only accesses those registers: @@ -91,7 +90,7 @@ struct ig4iic_softc { * * Locking outside of those places is required to make the content * of rpos/rnext predictable (e.g. whenever data_read is called and in - * smb_transaction). + * ig4iic_transfer). */ struct sx call_lock; struct mtx io_lock; @@ -103,20 +102,8 @@ typedef struct ig4iic_softc ig4iic_softc int ig4iic_attach(ig4iic_softc_t *sc); int ig4iic_detach(ig4iic_softc_t *sc); -/* SMBus methods */ -extern smbus_callback_t ig4iic_smb_callback; -extern smbus_quick_t ig4iic_smb_quick; -extern smbus_sendb_t ig4iic_smb_sendb; -extern smbus_recvb_t ig4iic_smb_recvb; -extern smbus_writeb_t ig4iic_smb_writeb; -extern smbus_writew_t ig4iic_smb_writew; -extern smbus_readb_t ig4iic_smb_readb; -extern smbus_readw_t ig4iic_smb_readw; -extern smbus_pcall_t ig4iic_smb_pcall; -extern smbus_bwrite_t ig4iic_smb_bwrite; -extern smbus_bread_t ig4iic_smb_bread; -extern smbus_trans_t ig4iic_smb_trans; +/* iicbus methods */ extern iicbus_transfer_t ig4iic_transfer; extern iicbus_reset_t ig4iic_reset; -#endif +#endif /* _ICHIIC_IG4_VAR_H_ */ From owner-svn-src-all@freebsd.org Sat Dec 24 14:39:31 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4253DC8EA0B; Sat, 24 Dec 2016 14:39:31 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 117DE14DD; Sat, 24 Dec 2016 14:39:30 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBOEdU6G067406; Sat, 24 Dec 2016 14:39:30 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBOEdUhg067405; Sat, 24 Dec 2016 14:39:30 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201612241439.uBOEdUhg067405@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Sat, 24 Dec 2016 14:39:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r310518 - stable/11/sys/dev/smbus X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 24 Dec 2016 14:39:31 -0000 Author: avg Date: Sat Dec 24 14:39:30 2016 New Revision: 310518 URL: https://svnweb.freebsd.org/changeset/base/310518 Log: MFC r308220: smbus: remove the potentially very dangerous slave probing code Modified: stable/11/sys/dev/smbus/smbus.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/smbus/smbus.c ============================================================================== --- stable/11/sys/dev/smbus/smbus.c Sat Dec 24 14:33:35 2016 (r310517) +++ stable/11/sys/dev/smbus/smbus.c Sat Dec 24 14:39:30 2016 (r310518) @@ -50,7 +50,6 @@ struct smbus_ivar /* * Autoconfiguration and support routines for System Management bus */ -static void smbus_probe_device(device_t dev, u_char addr); static int smbus_probe(device_t dev) @@ -65,13 +64,9 @@ static int smbus_attach(device_t dev) { struct smbus_softc *sc = device_get_softc(dev); - unsigned char addr; mtx_init(&sc->lock, device_get_nameunit(dev), "smbus", MTX_DEF); bus_generic_probe(dev); - for (addr = SMBUS_ADDR_MIN; addr < SMBUS_ADDR_MAX; ++addr) { - smbus_probe_device(dev, addr); - } bus_enumerate_hinted_children(dev); bus_generic_attach(dev); @@ -98,30 +93,6 @@ smbus_generic_intr(device_t dev, u_char { } -static void -smbus_probe_device(device_t dev, u_char addr) -{ - device_t child; - int error; - u_char cmd; - u_char buf[2]; - struct smbus_ivar *devi; - - cmd = 0x01; - error = smbus_trans(dev, addr, cmd, - SMB_TRANS_NOCNT | SMB_TRANS_NOREPORT, - NULL, 0, buf, 1, NULL); - if (error == 0) { - if (bootverbose) - device_printf(dev, "Probed address 0x%02x\n", addr); - child = BUS_ADD_CHILD(dev, SMBUS_ORDER_PNP, NULL, -1); - if (child == NULL) - return; - devi = device_get_ivars(child); - devi->addr = addr; - } -} - static device_t smbus_add_child(device_t dev, u_int order, const char *name, int unit) { From owner-svn-src-all@freebsd.org Sat Dec 24 14:41:12 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A0B07C8ECF5; Sat, 24 Dec 2016 14:41:12 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 7023518B9; Sat, 24 Dec 2016 14:41:12 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBOEfBlI067653; Sat, 24 Dec 2016 14:41:11 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBOEfBme067652; Sat, 24 Dec 2016 14:41:11 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201612241441.uBOEfBme067652@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Sat, 24 Dec 2016 14:41:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r310519 - stable/11/sys/dev/ichiic X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 24 Dec 2016 14:41:12 -0000 Author: avg Date: Sat Dec 24 14:41:11 2016 New Revision: 310519 URL: https://svnweb.freebsd.org/changeset/base/310519 Log: MFC r308221: fix typo in a comment Modified: stable/11/sys/dev/ichiic/ig4_iic.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/ichiic/ig4_iic.c ============================================================================== --- stable/11/sys/dev/ichiic/ig4_iic.c Sat Dec 24 14:39:30 2016 (r310518) +++ stable/11/sys/dev/ichiic/ig4_iic.c Sat Dec 24 14:41:11 2016 (r310519) @@ -37,7 +37,7 @@ __FBSDID("$FreeBSD$"); /* - * Intel fourth generation mobile cpus integrated I2C deviceer. + * Intel fourth generation mobile cpus integrated I2C device. * * See ig4_reg.h for datasheet reference and notes. * See ig4_var.h for locking semantics. From owner-svn-src-all@freebsd.org Sat Dec 24 14:44:26 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B1B87C8EF61; Sat, 24 Dec 2016 14:44:26 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 724ED1C68; Sat, 24 Dec 2016 14:44:26 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBOEiPs9071693; Sat, 24 Dec 2016 14:44:25 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBOEiPoL071688; Sat, 24 Dec 2016 14:44:25 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201612241444.uBOEiPoL071688@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Sat, 24 Dec 2016 14:44:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r310520 - in stable/11: share/man/man4 sys/dev/smbus X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 24 Dec 2016 14:44:26 -0000 Author: avg Date: Sat Dec 24 14:44:25 2016 New Revision: 310520 URL: https://svnweb.freebsd.org/changeset/base/310520 Log: MFC r308242: smbus: remove smbus_trans / SMB_TRANS This change reverts most of r281985. The method did not map to anything defined by SMBus protocol and could not be implemented for SMBus controllers. This change is obviously not backwards compatible, but I have good reasons to believe that there have never been any users of SMB_TRANS. Modified: stable/11/share/man/man4/smb.4 stable/11/sys/dev/smbus/smb.c stable/11/sys/dev/smbus/smb.h stable/11/sys/dev/smbus/smbconf.h stable/11/sys/dev/smbus/smbus_if.m Directory Properties: stable/11/ (props changed) Modified: stable/11/share/man/man4/smb.4 ============================================================================== --- stable/11/share/man/man4/smb.4 Sat Dec 24 14:41:11 2016 (r310519) +++ stable/11/share/man/man4/smb.4 Sat Dec 24 14:44:25 2016 (r310520) @@ -162,33 +162,6 @@ to the device, then reads bytes of data that from the device. This data is returned in the buffer pointed to by .Fa rbuf . -.It Dv SMB_TRANS Ta -.Em Trans -sends an SMB roll-up transaction with flags that also allow it to -be used for (mostly) I2C pass-through and with 10-bit addresses. -This function can be utilized to roll up all of the above functions. -It first sends the byte from -.Fa cmd -to the device, followed by -.Fa wcount -bytes of data that are taken from the buffer pointed to by -.Fa wbuf , -then reads -.Fa rcount -bytes of data that from the device. -This data is returned in the buffer pointed to by -.Fa rbuf . -.Pp -The following flags are allowed in -.Fa op : -.Pp -.Bd -literal -compact -SMB_TRANS_NOSTOP Do not send STOP at end -SMB_TRANS_NOCMD Ignore cmd field (do not tx) -SMB_TRANS_NOCNT Do not tx or rx count field -SMB_TRANS_7BIT Change address mode to 7-bit -SMB_TRANS_10BIT Change address mode to 10-bit -.Ed .El .Pp The Modified: stable/11/sys/dev/smbus/smb.c ============================================================================== --- stable/11/sys/dev/smbus/smb.c Sat Dec 24 14:41:11 2016 (r310519) +++ stable/11/sys/dev/smbus/smb.c Sat Dec 24 14:44:25 2016 (r310520) @@ -301,24 +301,6 @@ smbioctl(struct cdev *dev, u_long cmd, c error = copyout(buf, s->rbuf, s->rcount); break; - case SMB_TRANS: - if (s->rcount < 0 || s->wcount < 0) { - error = EINVAL; - break; - } - if (s->rcount > SMB_MAXBLOCKSIZE) - s->rcount = SMB_MAXBLOCKSIZE; - if (s->wcount > SMB_MAXBLOCKSIZE) - s->wcount = SMB_MAXBLOCKSIZE; - if (s->wcount) - error = copyin(s->wbuf, buf, s->wcount); - if (error) - break; - error = smbus_error(smbus_trans(parent, s->slave, s->cmd, - s->op, buf, s->wcount, buf, s->rcount, &s->rcount)); - if (error == 0) - error = copyout(buf, s->rbuf, s->rcount); - break; default: error = ENOTTY; } Modified: stable/11/sys/dev/smbus/smb.h ============================================================================== --- stable/11/sys/dev/smbus/smb.h Sat Dec 24 14:41:11 2016 (r310519) +++ stable/11/sys/dev/smbus/smb.h Sat Dec 24 14:44:25 2016 (r310520) @@ -54,11 +54,8 @@ struct smbcmd { /* * SMBus spec 2.0 says block transfers may be at most 32 bytes. - * We use SMBus for i2c as well, make the size limit something more - * reasonable. Keep in mind that a char buf array is declared on the - * kernel stack. */ -#define SMB_MAXBLOCKSIZE 1024 +#define SMB_MAXBLOCKSIZE 32 #define SMB_QUICK_WRITE _IOW('i', 1, struct smbcmd) #define SMB_QUICK_READ _IOW('i', 2, struct smbcmd) @@ -71,6 +68,6 @@ struct smbcmd { #define SMB_PCALL _IOWR('i', 9, struct smbcmd) #define SMB_BWRITE _IOW('i', 10, struct smbcmd) #define SMB_BREAD _IOWR('i', 11, struct smbcmd) -#define SMB_TRANS _IOWR('i', 12, struct smbcmd) +#define SMB_OLD_TRANS _IOWR('i', 12, struct smbcmd) #endif Modified: stable/11/sys/dev/smbus/smbconf.h ============================================================================== --- stable/11/sys/dev/smbus/smbconf.h Sat Dec 24 14:41:11 2016 (r310519) +++ stable/11/sys/dev/smbus/smbconf.h Sat Dec 24 14:44:25 2016 (r310520) @@ -72,25 +72,6 @@ #define SMB_QREAD 0x1 /* - * smbus transction op with pass-thru capabilities - * - * This smbus function is capable of doing a smbus command transaction - * (read or write), and can be flagged to not issue the 'cmd' and/or - * issue or expect a count field as well as flagged for chaining (no STOP), - * which gives it an i2c pass-through capability. - * - * NOSTOP- Caller chaining transactions, do not issue STOP - * NOCMD- Do not transmit the command field - * NOCNT- Do not transmit (wr) or expect (rd) the count field - */ -#define SMB_TRANS_NOSTOP 0x0001 /* do not send STOP at end */ -#define SMB_TRANS_NOCMD 0x0002 /* ignore cmd field (do not tx) */ -#define SMB_TRANS_NOCNT 0x0004 /* do not tx or rx count field */ -#define SMB_TRANS_7BIT 0x0008 /* change address mode to 7-bit */ -#define SMB_TRANS_10BIT 0x0010 /* change address mode to 10-bit */ -#define SMB_TRANS_NOREPORT 0x0020 /* do not report errors */ - -/* * ivars codes */ enum smbus_ivars { Modified: stable/11/sys/dev/smbus/smbus_if.m ============================================================================== --- stable/11/sys/dev/smbus/smbus_if.m Sat Dec 24 14:41:11 2016 (r310519) +++ stable/11/sys/dev/smbus/smbus_if.m Sat Dec 24 14:44:25 2016 (r310520) @@ -149,20 +149,3 @@ METHOD int bread { u_char *count; char *buf; }; - -# -# SMB roll-up transaction with flags that also allow it to be -# used for (mostly) i2c pass-through and with 10-bit addresses. -# This function can be used to roll-up all of the above functions. -# -METHOD int trans { - device_t dev; - int slave; - char cmd; - int op; - char *wbuf; - int wcount; - char *rbuf; - int rcount; - int *actualp; -}; From owner-svn-src-all@freebsd.org Sat Dec 24 14:48:29 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6F154C8D13A; Sat, 24 Dec 2016 14:48:29 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 2487A1E0A; Sat, 24 Dec 2016 14:48:29 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBOEmSct071896; Sat, 24 Dec 2016 14:48:28 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBOEmSLF071895; Sat, 24 Dec 2016 14:48:28 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201612241448.uBOEmSLF071895@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Sat, 24 Dec 2016 14:48:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r310521 - stable/10/sys/dev/iicbus X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 24 Dec 2016 14:48:29 -0000 Author: avg Date: Sat Dec 24 14:48:28 2016 New Revision: 310521 URL: https://svnweb.freebsd.org/changeset/base/310521 Log: MFC r308530: iicsmb: SMB_MAXBLOCKSIZE can be used again Modified: stable/10/sys/dev/iicbus/iicsmb.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/iicbus/iicsmb.c ============================================================================== --- stable/10/sys/dev/iicbus/iicsmb.c Sat Dec 24 14:44:25 2016 (r310520) +++ stable/10/sys/dev/iicbus/iicsmb.c Sat Dec 24 14:48:28 2016 (r310521) @@ -57,6 +57,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include "iicbus_if.h" @@ -432,7 +433,7 @@ iicsmb_bwrite(device_t dev, u_char slave }; int error; - if (count > 32 || count == 0) + if (count > SMB_MAXBLOCKSIZE || count == 0) return (SMB_EINVAL); error = TRANSFER_MSGS(dev, msgs); return (iic2smb_error(error)); @@ -450,12 +451,6 @@ iicsmb_bread(device_t dev, u_char slave, }; device_t parent = device_get_parent(dev); int error; - u_char bufsz; - - /* Stash output buffer size before overwriting it. */ - bufsz = *count; - if (bufsz == 0) - return (SMB_EINVAL); /* Have to do this because the command is split in two transfers. */ error = iicbus_request_bus(parent, dev, IIC_WAIT); @@ -465,18 +460,13 @@ iicsmb_bread(device_t dev, u_char slave, /* * If the slave offers an empty or a too long reply, * read one byte to generate the stop or abort. - * XXX 32 is hardcoded until SMB_MAXBLOCKSIZE is restored - * to sanity. */ - if (*count > 32 || *count == 0) + if (*count > SMB_MAXBLOCKSIZE || *count == 0) block_msg[0].len = 1; - /* If longer than the buffer, then clamp at the buffer size. */ - if (*count > bufsz) - block_msg[0].len = bufsz; else block_msg[0].len = *count; error = TRANSFER_MSGS(dev, block_msg); - if (*count > 32 || *count == 0) + if (*count > SMB_MAXBLOCKSIZE || *count == 0) error = SMB_EINVAL; } (void)iicbus_release_bus(parent, dev); From owner-svn-src-all@freebsd.org Sat Dec 24 14:48:51 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 182E4C8D1B9; Sat, 24 Dec 2016 14:48:51 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C255C1F67; Sat, 24 Dec 2016 14:48:50 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBOEmnJo071956; Sat, 24 Dec 2016 14:48:49 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBOEmneZ071955; Sat, 24 Dec 2016 14:48:49 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201612241448.uBOEmneZ071955@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Sat, 24 Dec 2016 14:48:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r310522 - stable/11/sys/dev/iicbus X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 24 Dec 2016 14:48:51 -0000 Author: avg Date: Sat Dec 24 14:48:49 2016 New Revision: 310522 URL: https://svnweb.freebsd.org/changeset/base/310522 Log: MFC r308530: iicsmb: SMB_MAXBLOCKSIZE can be used again Modified: stable/11/sys/dev/iicbus/iicsmb.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/iicbus/iicsmb.c ============================================================================== --- stable/11/sys/dev/iicbus/iicsmb.c Sat Dec 24 14:48:28 2016 (r310521) +++ stable/11/sys/dev/iicbus/iicsmb.c Sat Dec 24 14:48:49 2016 (r310522) @@ -57,6 +57,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include "iicbus_if.h" @@ -432,7 +433,7 @@ iicsmb_bwrite(device_t dev, u_char slave }; int error; - if (count > 32 || count == 0) + if (count > SMB_MAXBLOCKSIZE || count == 0) return (SMB_EINVAL); error = TRANSFER_MSGS(dev, msgs); return (iic2smb_error(error)); @@ -450,12 +451,6 @@ iicsmb_bread(device_t dev, u_char slave, }; device_t parent = device_get_parent(dev); int error; - u_char bufsz; - - /* Stash output buffer size before overwriting it. */ - bufsz = *count; - if (bufsz == 0) - return (SMB_EINVAL); /* Have to do this because the command is split in two transfers. */ error = iicbus_request_bus(parent, dev, IIC_WAIT); @@ -465,18 +460,13 @@ iicsmb_bread(device_t dev, u_char slave, /* * If the slave offers an empty or a too long reply, * read one byte to generate the stop or abort. - * XXX 32 is hardcoded until SMB_MAXBLOCKSIZE is restored - * to sanity. */ - if (*count > 32 || *count == 0) + if (*count > SMB_MAXBLOCKSIZE || *count == 0) block_msg[0].len = 1; - /* If longer than the buffer, then clamp at the buffer size. */ - if (*count > bufsz) - block_msg[0].len = bufsz; else block_msg[0].len = *count; error = TRANSFER_MSGS(dev, block_msg); - if (*count > 32 || *count == 0) + if (*count > SMB_MAXBLOCKSIZE || *count == 0) error = SMB_EINVAL; } (void)iicbus_release_bus(parent, dev); From owner-svn-src-all@freebsd.org Sat Dec 24 14:50:14 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6A132C8D261; Sat, 24 Dec 2016 14:50:14 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 38FB314D; Sat, 24 Dec 2016 14:50:14 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBOEoDMW072093; Sat, 24 Dec 2016 14:50:13 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBOEoDf3072092; Sat, 24 Dec 2016 14:50:13 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201612241450.uBOEoDf3072092@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Sat, 24 Dec 2016 14:50:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r310523 - stable/11/share/man/man4 X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 24 Dec 2016 14:50:14 -0000 Author: avg Date: Sat Dec 24 14:50:13 2016 New Revision: 310523 URL: https://svnweb.freebsd.org/changeset/base/310523 Log: MFC r308532: update SMB_BWRITE documentation, clarify SMB_BREAD Modified: stable/11/share/man/man4/smb.4 Directory Properties: stable/11/ (props changed) Modified: stable/11/share/man/man4/smb.4 ============================================================================== --- stable/11/share/man/man4/smb.4 Sat Dec 24 14:48:49 2016 (r310522) +++ stable/11/share/man/man4/smb.4 Sat Dec 24 14:50:13 2016 (r310523) @@ -141,26 +141,25 @@ in .Em BlockWrite first sends the byte from .Fa cmd -to the device, followed by +to the device, then the byte from +.Fa wcount +followed by .Fa wcount bytes of data that are taken from the buffer pointed to by .Fa wbuf . The SMBus specification mandates that no more than 32 bytes of -data can be transferred in a single block read or write command, -but since -.Xr smbus 4 -is also used to access I2C devices, the limit has been increased -to 1024. +data can be transferred in a single block read or write command. This value can be read from the constant .Dv SMB_MAXBLOCKSIZE . .It Dv SMB_BREAD Ta .Em BlockRead first sends the byte from .Fa cmd -to the device, then reads -.Fa rcount -bytes of data that from the device. -This data is returned in the buffer pointed to by +to the device, then reads a count of data bytes that the device +is going to provide and then reads that many bytes. +The count is returned in +.Fa rcount. +The data is returned in the buffer pointed to by .Fa rbuf . .El .Pp From owner-svn-src-all@freebsd.org Sat Dec 24 16:01:21 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A25ECC8F5B3; Sat, 24 Dec 2016 16:01:21 +0000 (UTC) (envelope-from freebsd-rwg@pdx.rh.CN85.dnsmgr.net) Received: from pdx.rh.CN85.dnsmgr.net (br1.CN84in.dnsmgr.net [69.59.192.140]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 7B83D86E; Sat, 24 Dec 2016 16:01:20 +0000 (UTC) (envelope-from freebsd-rwg@pdx.rh.CN85.dnsmgr.net) Received: from pdx.rh.CN85.dnsmgr.net (localhost [127.0.0.1]) by pdx.rh.CN85.dnsmgr.net (8.13.3/8.13.3) with ESMTP id uBOG1ALN082264; Sat, 24 Dec 2016 08:01:13 -0800 (PST) (envelope-from freebsd-rwg@pdx.rh.CN85.dnsmgr.net) Received: (from freebsd-rwg@localhost) by pdx.rh.CN85.dnsmgr.net (8.13.3/8.13.3/Submit) id uBOG15jv082263; Sat, 24 Dec 2016 08:01:05 -0800 (PST) (envelope-from freebsd-rwg) From: "Rodney W. Grimes" Message-Id: <201612241601.uBOG15jv082263@pdx.rh.CN85.dnsmgr.net> Subject: Re: svn commit: r310517 - stable/11/sys/dev/ichiic In-Reply-To: <201612241433.uBOEXZJh067151@repo.freebsd.org> To: Andriy Gapon Date: Sat, 24 Dec 2016 08:01:05 -0800 (PST) CC: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org X-Mailer: ELM [version 2.4ME+ PL121h (25)] MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 24 Dec 2016 16:01:21 -0000 Small typo to fix please. > Author: avg > Date: Sat Dec 24 14:33:35 2016 > New Revision: 310517 > URL: https://svnweb.freebsd.org/changeset/base/310517 > > Log: > MFC r308219: ichiic/ig4: completely disengage from smbus > > Modified: > stable/11/sys/dev/ichiic/ig4_iic.c > stable/11/sys/dev/ichiic/ig4_pci.c > stable/11/sys/dev/ichiic/ig4_reg.h > stable/11/sys/dev/ichiic/ig4_var.h > Directory Properties: > stable/11/ (props changed) > > Modified: stable/11/sys/dev/ichiic/ig4_iic.c > ============================================================================== > --- stable/11/sys/dev/ichiic/ig4_iic.c Sat Dec 24 14:25:25 2016 (r310516) > +++ stable/11/sys/dev/ichiic/ig4_iic.c Sat Dec 24 14:33:35 2016 (r310517) > @@ -37,7 +37,7 @@ > __FBSDID("$FreeBSD$"); > > /* > - * Intel fourth generation mobile cpus integrated I2C device, smbus driver. > + * Intel fourth generation mobile cpus integrated I2C deviceer. ^^^^^^^^^^^^^^ -- Rod Grimes rgrimes@freebsd.org From owner-svn-src-all@freebsd.org Sat Dec 24 17:42:36 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 43EEDC8F201; Sat, 24 Dec 2016 17:42:36 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 0C4F31C8E; Sat, 24 Dec 2016 17:42:35 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBOHgZmD045297; Sat, 24 Dec 2016 17:42:35 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBOHgYQp045291; Sat, 24 Dec 2016 17:42:34 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201612241742.uBOHgYQp045291@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Sat, 24 Dec 2016 17:42:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310524 - in head/sys/cam: ctl scsi X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 24 Dec 2016 17:42:36 -0000 Author: mav Date: Sat Dec 24 17:42:34 2016 New Revision: 310524 URL: https://svnweb.freebsd.org/changeset/base/310524 Log: Improve length handling when writing sense data. - Allow maximal sense size limitation via Control Extension mode page. - When sense size limited, include descriptors atomically: whole or none. - Set new SDAT_OVFL bit if some descriptors don't fit the limit. - Report real written sense length instead of static maximal 252 bytes. MFC after: 2 weeks Modified: head/sys/cam/ctl/ctl.c head/sys/cam/ctl/ctl_error.c head/sys/cam/ctl/ctl_error.h head/sys/cam/ctl/ctl_private.h head/sys/cam/scsi/scsi_all.c head/sys/cam/scsi/scsi_all.h Modified: head/sys/cam/ctl/ctl.c ============================================================================== --- head/sys/cam/ctl/ctl.c Sat Dec 24 14:50:13 2016 (r310523) +++ head/sys/cam/ctl/ctl.c Sat Dec 24 17:42:34 2016 (r310524) @@ -278,7 +278,7 @@ const static struct scsi_control_ext_pag /*page_length*/{CTL_CEM_LEN >> 8, CTL_CEM_LEN}, /*flags*/0, /*prio*/0, - /*max_sense*/0 + /*max_sense*/0xff }; const static struct scsi_info_exceptions_page ie_page_default = { @@ -9220,6 +9220,7 @@ ctl_request_sense(struct ctl_scsiio *cts struct ctl_lun *lun; uint32_t initidx; int have_error; + u_int sense_len = SSD_FULL_SIZE; scsi_sense_data_type sense_format; ctl_ua_type ua_type; uint8_t asc = 0, ascq = 0; @@ -9263,7 +9264,7 @@ ctl_request_sense(struct ctl_scsiio *cts ((lun->flags & CTL_LUN_PRIMARY_SC) == 0 && softc->ha_link < CTL_HA_LINK_UNKNOWN)) { /* "Logical unit not supported" */ - ctl_set_sense_data(sense_ptr, NULL, sense_format, + ctl_set_sense_data(sense_ptr, &sense_len, NULL, sense_format, /*current_error*/ 1, /*sense_key*/ SSD_KEY_ILLEGAL_REQUEST, /*asc*/ 0x25, @@ -9319,7 +9320,8 @@ ctl_request_sense(struct ctl_scsiio *cts } else #endif if (have_error == 0) { - ua_type = ctl_build_ua(lun, initidx, sense_ptr, sense_format); + ua_type = ctl_build_ua(lun, initidx, sense_ptr, &sense_len, + sense_format); if (ua_type != CTL_UA_NONE) have_error = 1; } @@ -9331,7 +9333,7 @@ ctl_request_sense(struct ctl_scsiio *cts asc = lun->ie_asc; ascq = lun->ie_ascq; } - ctl_set_sense_data(sense_ptr, lun, sense_format, + ctl_set_sense_data(sense_ptr, &sense_len, lun, sense_format, /*current_error*/ 1, /*sense_key*/ SSD_KEY_NO_SENSE, /*asc*/ asc, @@ -11635,14 +11637,15 @@ ctl_scsiio_precheck(struct ctl_softc *so */ if ((entry->flags & CTL_CMD_FLAG_NO_SENSE) == 0) { ctl_ua_type ua_type; + u_int sense_len = 0; ua_type = ctl_build_ua(lun, initidx, &ctsio->sense_data, - SSD_TYPE_NONE); + &sense_len, SSD_TYPE_NONE); if (ua_type != CTL_UA_NONE) { mtx_unlock(&lun->lun_lock); ctsio->scsi_status = SCSI_STATUS_CHECK_COND; ctsio->io_hdr.status = CTL_SCSI_ERROR | CTL_AUTOSENSE; - ctsio->sense_len = SSD_FULL_SIZE; + ctsio->sense_len = sense_len; ctl_done((union ctl_io *)ctsio); return (retval); } Modified: head/sys/cam/ctl/ctl_error.c ============================================================================== --- head/sys/cam/ctl/ctl_error.c Sat Dec 24 14:50:13 2016 (r310523) +++ head/sys/cam/ctl/ctl_error.c Sat Dec 24 17:42:34 2016 (r310524) @@ -65,9 +65,9 @@ __FBSDID("$FreeBSD$"); #include void -ctl_set_sense_data_va(struct scsi_sense_data *sense_data, void *lunptr, - scsi_sense_data_type sense_format, int current_error, - int sense_key, int asc, int ascq, va_list ap) +ctl_set_sense_data_va(struct scsi_sense_data *sense_data, u_int *sense_len, + void *lunptr, scsi_sense_data_type sense_format, int current_error, + int sense_key, int asc, int ascq, va_list ap) { struct ctl_lun *lun; @@ -89,20 +89,30 @@ ctl_set_sense_data_va(struct scsi_sense_ sense_format = SSD_TYPE_FIXED; } - scsi_set_sense_data_va(sense_data, sense_format, current_error, - sense_key, asc, ascq, ap); + /* + * Determine maximum sense data length to return. + */ + if (*sense_len == 0) { + if ((lun != NULL) && (lun->MODE_CTRLE.max_sense != 0)) + *sense_len = lun->MODE_CTRLE.max_sense; + else + *sense_len = SSD_FULL_SIZE; + } + + scsi_set_sense_data_va(sense_data, sense_len, sense_format, + current_error, sense_key, asc, ascq, ap); } void -ctl_set_sense_data(struct scsi_sense_data *sense_data, void *lunptr, - scsi_sense_data_type sense_format, int current_error, - int sense_key, int asc, int ascq, ...) +ctl_set_sense_data(struct scsi_sense_data *sense_data, u_int *sense_len, + void *lunptr, scsi_sense_data_type sense_format, int current_error, + int sense_key, int asc, int ascq, ...) { va_list ap; va_start(ap, ascq); - ctl_set_sense_data_va(sense_data, lunptr, sense_format, current_error, - sense_key, asc, ascq, ap); + ctl_set_sense_data_va(sense_data, sense_len, lunptr, sense_format, + current_error, sense_key, asc, ascq, ap); va_end(ap); } @@ -112,6 +122,7 @@ ctl_set_sense(struct ctl_scsiio *ctsio, { va_list ap; struct ctl_lun *lun; + u_int sense_len; /* * The LUN can't go away until all of the commands have been @@ -121,7 +132,8 @@ ctl_set_sense(struct ctl_scsiio *ctsio, lun = (struct ctl_lun *)ctsio->io_hdr.ctl_private[CTL_PRIV_LUN].ptr; va_start(ap, ascq); - ctl_set_sense_data_va(&ctsio->sense_data, + sense_len = 0; + ctl_set_sense_data_va(&ctsio->sense_data, &sense_len, lun, SSD_TYPE_NONE, current_error, @@ -132,7 +144,7 @@ ctl_set_sense(struct ctl_scsiio *ctsio, va_end(ap); ctsio->scsi_status = SCSI_STATUS_CHECK_COND; - ctsio->sense_len = SSD_FULL_SIZE; + ctsio->sense_len = sense_len; ctsio->io_hdr.status = CTL_SCSI_ERROR | CTL_AUTOSENSE; } @@ -148,6 +160,7 @@ ctl_sense_to_desc(struct scsi_sense_data { struct scsi_sense_stream stream_sense; int current_error; + u_int sense_len; uint8_t stream_bits; bzero(sense_dest, sizeof(*sense_dest)); @@ -173,7 +186,8 @@ ctl_sense_to_desc(struct scsi_sense_data * value is set in the fixed sense data, set it in the descriptor * data. Otherwise, skip it. */ - ctl_set_sense_data((struct scsi_sense_data *)sense_dest, + sense_len = SSD_FULL_SIZE; + ctl_set_sense_data((struct scsi_sense_data *)sense_dest, &sense_len, /*lun*/ NULL, /*sense_format*/ SSD_TYPE_DESC, current_error, @@ -233,6 +247,7 @@ ctl_sense_to_fixed(struct scsi_sense_dat int info_size = 0, cmd_size = 0, fru_size = 0; int sks_size = 0, stream_size = 0; int pos; + u_int sense_len; if ((sense_src->error_code & SSD_ERRCODE) == SSD_DESC_CURRENT_ERROR) current_error = 1; @@ -318,7 +333,8 @@ ctl_sense_to_fixed(struct scsi_sense_dat } } - ctl_set_sense_data((struct scsi_sense_data *)sense_dest, + sense_len = SSD_FULL_SIZE; + ctl_set_sense_data((struct scsi_sense_data *)sense_dest, &sense_len, /*lun*/ NULL, /*sense_format*/ SSD_TYPE_FIXED, current_error, @@ -501,12 +517,13 @@ ctl_build_qae(struct ctl_lun *lun, uint3 resp[0] |= 0x20; resp[1] = asc; resp[2] = ascq; - return (ua); + return (ua_to_build); } ctl_ua_type ctl_build_ua(struct ctl_lun *lun, uint32_t initidx, - struct scsi_sense_data *sense, scsi_sense_data_type sense_format) + struct scsi_sense_data *sense, u_int *sense_len, + scsi_sense_data_type sense_format) { ctl_ua_type *ua; ctl_ua_type ua_to_build, ua_to_clear; @@ -540,7 +557,7 @@ ctl_build_ua(struct ctl_lun *lun, uint32 info = NULL; ctl_ua_to_ascq(lun, ua_to_build, &asc, &ascq, &ua_to_clear, &info); - ctl_set_sense_data(sense, lun, sense_format, /*current_error*/ 1, + ctl_set_sense_data(sense, sense_len, lun, sense_format, 1, /*sense_key*/ SSD_KEY_UNIT_ATTENTION, asc, ascq, ((info != NULL) ? SSD_ELEM_INFO : SSD_ELEM_SKIP), 8, info, SSD_ELEM_NONE); Modified: head/sys/cam/ctl/ctl_error.h ============================================================================== --- head/sys/cam/ctl/ctl_error.h Sat Dec 24 14:50:13 2016 (r310523) +++ head/sys/cam/ctl/ctl_error.h Sat Dec 24 17:42:34 2016 (r310524) @@ -45,12 +45,12 @@ struct ctl_lun; -void ctl_set_sense_data_va(struct scsi_sense_data *sense_data, void *lun, - scsi_sense_data_type sense_format, int current_error, - int sense_key, int asc, int ascq, va_list ap); -void ctl_set_sense_data(struct scsi_sense_data *sense_data, void *lun, - scsi_sense_data_type sense_format, int current_error, - int sense_key, int asc, int ascq, ...); +void ctl_set_sense_data_va(struct scsi_sense_data *sense_data, u_int *sense_len, + void *lun, scsi_sense_data_type sense_format, int current_error, + int sense_key, int asc, int ascq, va_list ap); +void ctl_set_sense_data(struct scsi_sense_data *sense_data, u_int *sense_len, + void *lun, scsi_sense_data_type sense_format, int current_error, + int sense_key, int asc, int ascq, ...); void ctl_set_sense(struct ctl_scsiio *ctsio, int current_error, int sense_key, int asc, int ascq, ...); void ctl_sense_to_desc(struct scsi_sense_data_fixed *sense_src, @@ -60,7 +60,8 @@ void ctl_sense_to_fixed(struct scsi_sens void ctl_set_ua(struct ctl_scsiio *ctsio, int asc, int ascq); ctl_ua_type ctl_build_qae(struct ctl_lun *lun, uint32_t initidx, uint8_t *resp); ctl_ua_type ctl_build_ua(struct ctl_lun *lun, uint32_t initidx, - struct scsi_sense_data *sense, scsi_sense_data_type sense_format); + struct scsi_sense_data *sense, u_int *sense_len, + scsi_sense_data_type sense_format); void ctl_set_overlapped_cmd(struct ctl_scsiio *ctsio); void ctl_set_overlapped_tag(struct ctl_scsiio *ctsio, uint8_t tag); void ctl_set_invalid_field(struct ctl_scsiio *ctsio, int sks_valid, int command, Modified: head/sys/cam/ctl/ctl_private.h ============================================================================== --- head/sys/cam/ctl/ctl_private.h Sat Dec 24 14:50:13 2016 (r310523) +++ head/sys/cam/ctl/ctl_private.h Sat Dec 24 17:42:34 2016 (r310524) @@ -285,7 +285,7 @@ static const struct ctl_page_index page_ CTL_PAGE_FLAG_ALL, NULL, ctl_default_page_handler}, {SMS_CONTROL_MODE_PAGE | SMPH_SPF, 0x01, sizeof(struct scsi_control_ext_page), NULL, - CTL_PAGE_FLAG_ALL, NULL, NULL}, + CTL_PAGE_FLAG_ALL, NULL, ctl_default_page_handler}, {SMS_INFO_EXCEPTIONS_PAGE, 0, sizeof(struct scsi_info_exceptions_page), NULL, CTL_PAGE_FLAG_ALL, NULL, ctl_ie_page_handler}, {SMS_INFO_EXCEPTIONS_PAGE | SMPH_SPF, 0x02, Modified: head/sys/cam/scsi/scsi_all.c ============================================================================== --- head/sys/cam/scsi/scsi_all.c Sat Dec 24 14:50:13 2016 (r310523) +++ head/sys/cam/scsi/scsi_all.c Sat Dec 24 17:42:34 2016 (r310524) @@ -3742,341 +3742,300 @@ scsi_find_desc(struct scsi_sense_data_de } /* - * Fill in SCSI sense data with the specified parameters. This routine can - * fill in either fixed or descriptor type sense data. + * Fill in SCSI descriptor sense data with the specified parameters. */ -void -scsi_set_sense_data_va(struct scsi_sense_data *sense_data, - scsi_sense_data_type sense_format, int current_error, - int sense_key, int asc, int ascq, va_list ap) +static void +scsi_set_sense_data_desc_va(struct scsi_sense_data *sense_data, + u_int *sense_len, scsi_sense_data_type sense_format, int current_error, + int sense_key, int asc, int ascq, va_list ap) { - int descriptor_sense; + struct scsi_sense_data_desc *sense; scsi_sense_elem_type elem_type; + int space, len; + uint8_t *desc, *data; - /* - * Determine whether to return fixed or descriptor format sense - * data. If the user specifies SSD_TYPE_NONE for some reason, - * they'll just get fixed sense data. - */ - if (sense_format == SSD_TYPE_DESC) - descriptor_sense = 1; - else - descriptor_sense = 0; - - /* - * Zero the sense data, so that we don't pass back any garbage data - * to the user. - */ memset(sense_data, 0, sizeof(*sense_data)); + sense = (struct scsi_sense_data_desc *)sense_data; + if (current_error != 0) + sense->error_code = SSD_DESC_CURRENT_ERROR; + else + sense->error_code = SSD_DESC_DEFERRED_ERROR; + sense->sense_key = sense_key; + sense->add_sense_code = asc; + sense->add_sense_code_qual = ascq; + sense->flags = 0; + + desc = &sense->sense_desc[0]; + space = *sense_len - offsetof(struct scsi_sense_data_desc, sense_desc); + while ((elem_type = va_arg(ap, scsi_sense_elem_type)) != + SSD_ELEM_NONE) { + if (elem_type >= SSD_ELEM_MAX) { + printf("%s: invalid sense type %d\n", __func__, + elem_type); + break; + } + len = va_arg(ap, int); + data = va_arg(ap, uint8_t *); - if (descriptor_sense != 0) { - struct scsi_sense_data_desc *sense; - - sense = (struct scsi_sense_data_desc *)sense_data; - /* - * The descriptor sense format eliminates the use of the - * valid bit. - */ - if (current_error != 0) - sense->error_code = SSD_DESC_CURRENT_ERROR; - else - sense->error_code = SSD_DESC_DEFERRED_ERROR; - sense->sense_key = sense_key; - sense->add_sense_code = asc; - sense->add_sense_code_qual = ascq; - /* - * Start off with no extra length, since the above data - * fits in the standard descriptor sense information. - */ - sense->extra_len = 0; - while ((elem_type = (scsi_sense_elem_type)va_arg(ap, - scsi_sense_elem_type)) != SSD_ELEM_NONE) { - int sense_len, len_to_copy; - uint8_t *data; - - if (elem_type >= SSD_ELEM_MAX) { - printf("%s: invalid sense type %d\n", __func__, - elem_type); + switch (elem_type) { + case SSD_ELEM_SKIP: + break; + case SSD_ELEM_DESC: + if (space < len) { + sense->flags |= SSDD_SDAT_OVFL; break; } + bcopy(data, desc, len); + desc += len; + space -= len; + break; + case SSD_ELEM_SKS: { + struct scsi_sense_sks *sks = (void *)desc; - sense_len = (int)va_arg(ap, int); - len_to_copy = MIN(sense_len, SSD_EXTRA_MAX - - sense->extra_len); - data = (uint8_t *)va_arg(ap, uint8_t *); - - /* - * We've already consumed the arguments for this one. - */ - if (elem_type == SSD_ELEM_SKIP) - continue; - - switch (elem_type) { - case SSD_ELEM_DESC: { - - /* - * This is a straight descriptor. All we - * need to do is copy the data in. - */ - bcopy(data, &sense->sense_desc[ - sense->extra_len], len_to_copy); - sense->extra_len += len_to_copy; + if (len > sizeof(sks->sense_key_spec)) + break; + if (space < sizeof(*sks)) { + sense->flags |= SSDD_SDAT_OVFL; break; } - case SSD_ELEM_SKS: { - struct scsi_sense_sks sks; - - bzero(&sks, sizeof(sks)); + sks->desc_type = SSD_DESC_SKS; + sks->length = sizeof(*sks) - + (offsetof(struct scsi_sense_sks, length) + 1); + bcopy(data, &sks->sense_key_spec, len); + desc += sizeof(*sks); + space -= sizeof(*sks); + break; + } + case SSD_ELEM_COMMAND: { + struct scsi_sense_command *cmd = (void *)desc; - /* - * This is already-formatted sense key - * specific data. We just need to fill out - * the header and copy everything in. - */ - bcopy(data, &sks.sense_key_spec, - MIN(len_to_copy, - sizeof(sks.sense_key_spec))); - - sks.desc_type = SSD_DESC_SKS; - sks.length = sizeof(sks) - - offsetof(struct scsi_sense_sks, reserved1); - bcopy(&sks,&sense->sense_desc[sense->extra_len], - sizeof(sks)); - sense->extra_len += sizeof(sks); + if (len > sizeof(cmd->command_info)) + break; + if (space < sizeof(*cmd)) { + sense->flags |= SSDD_SDAT_OVFL; break; } - case SSD_ELEM_INFO: - case SSD_ELEM_COMMAND: { - struct scsi_sense_command cmd; - struct scsi_sense_info info; - uint8_t *data_dest; - uint8_t *descriptor; - int descriptor_size, i, copy_len; - - bzero(&cmd, sizeof(cmd)); - bzero(&info, sizeof(info)); - - /* - * Command or information data. The - * operate in pretty much the same way. - */ - if (elem_type == SSD_ELEM_COMMAND) { - len_to_copy = MIN(len_to_copy, - sizeof(cmd.command_info)); - descriptor = (uint8_t *)&cmd; - descriptor_size = sizeof(cmd); - data_dest =(uint8_t *)&cmd.command_info; - cmd.desc_type = SSD_DESC_COMMAND; - cmd.length = sizeof(cmd) - - offsetof(struct scsi_sense_command, - reserved); - } else { - len_to_copy = MIN(len_to_copy, - sizeof(info.info)); - descriptor = (uint8_t *)&info; - descriptor_size = sizeof(cmd); - data_dest = (uint8_t *)&info.info; - info.desc_type = SSD_DESC_INFO; - info.byte2 = SSD_INFO_VALID; - info.length = sizeof(info) - - offsetof(struct scsi_sense_info, - byte2); - } - - /* - * Copy this in reverse because the spec - * (SPC-4) says that when 4 byte quantities - * are stored in this 8 byte field, the - * first four bytes shall be 0. - * - * So we fill the bytes in from the end, and - * if we have less than 8 bytes to copy, - * the initial, most significant bytes will - * be 0. - */ - for (i = sense_len - 1; i >= 0 && - len_to_copy > 0; i--, len_to_copy--) - data_dest[len_to_copy - 1] = data[i]; + cmd->desc_type = SSD_DESC_COMMAND; + cmd->length = sizeof(*cmd) - + (offsetof(struct scsi_sense_command, length) + 1); + bcopy(data, &cmd->command_info[ + sizeof(cmd->command_info) - len], len); + desc += sizeof(*cmd); + space -= sizeof(*cmd); + break; + } + case SSD_ELEM_INFO: { + struct scsi_sense_info *info = (void *)desc; - /* - * This calculation looks much like the - * initial len_to_copy calculation, but - * we have to do it again here, because - * we're looking at a larger amount that - * may or may not fit. It's not only the - * data the user passed in, but also the - * rest of the descriptor. - */ - copy_len = MIN(descriptor_size, - SSD_EXTRA_MAX - sense->extra_len); - bcopy(descriptor, &sense->sense_desc[ - sense->extra_len], copy_len); - sense->extra_len += copy_len; + if (len > sizeof(info->info)) break; - } - case SSD_ELEM_FRU: { - struct scsi_sense_fru fru; - int copy_len; - - bzero(&fru, sizeof(fru)); - - fru.desc_type = SSD_DESC_FRU; - fru.length = sizeof(fru) - - offsetof(struct scsi_sense_fru, reserved); - fru.fru = *data; - - copy_len = MIN(sizeof(fru), SSD_EXTRA_MAX - - sense->extra_len); - bcopy(&fru, &sense->sense_desc[ - sense->extra_len], copy_len); - sense->extra_len += copy_len; + if (space < sizeof(*info)) { + sense->flags |= SSDD_SDAT_OVFL; break; } - case SSD_ELEM_STREAM: { - struct scsi_sense_stream stream_sense; - int copy_len; - - bzero(&stream_sense, sizeof(stream_sense)); - stream_sense.desc_type = SSD_DESC_STREAM; - stream_sense.length = sizeof(stream_sense) - - offsetof(struct scsi_sense_stream, reserved); - stream_sense.byte3 = *data; - - copy_len = MIN(sizeof(stream_sense), - SSD_EXTRA_MAX - sense->extra_len); - bcopy(&stream_sense, &sense->sense_desc[ - sense->extra_len], copy_len); - sense->extra_len += copy_len; + info->desc_type = SSD_DESC_INFO; + info->length = sizeof(*info) - + (offsetof(struct scsi_sense_info, length) + 1); + info->byte2 = SSD_INFO_VALID; + bcopy(data, &info->info[sizeof(info->info) - len], len); + desc += sizeof(*info); + space -= sizeof(*info); + break; + } + case SSD_ELEM_FRU: { + struct scsi_sense_fru *fru = (void *)desc; + + if (len > sizeof(fru->fru)) break; - } - default: - /* - * We shouldn't get here, but if we do, do - * nothing. We've already consumed the - * arguments above. - */ + if (space < sizeof(*fru)) { + sense->flags |= SSDD_SDAT_OVFL; break; } + fru->desc_type = SSD_DESC_FRU; + fru->length = sizeof(*fru) - + (offsetof(struct scsi_sense_fru, length) + 1); + fru->fru = *data; + desc += sizeof(*fru); + space -= sizeof(*fru); + break; } - } else { - struct scsi_sense_data_fixed *sense; - - sense = (struct scsi_sense_data_fixed *)sense_data; - - if (current_error != 0) - sense->error_code = SSD_CURRENT_ERROR; - else - sense->error_code = SSD_DEFERRED_ERROR; + case SSD_ELEM_STREAM: { + struct scsi_sense_stream *stream = (void *)desc; - sense->flags = sense_key; - sense->add_sense_code = asc; - sense->add_sense_code_qual = ascq; - /* - * We've set the ASC and ASCQ, so we have 6 more bytes of - * valid data. If we wind up setting any of the other - * fields, we'll bump this to 10 extra bytes. - */ - sense->extra_len = 6; - - while ((elem_type = (scsi_sense_elem_type)va_arg(ap, - scsi_sense_elem_type)) != SSD_ELEM_NONE) { - int sense_len, len_to_copy; - uint8_t *data; - - if (elem_type >= SSD_ELEM_MAX) { - printf("%s: invalid sense type %d\n", __func__, - elem_type); + if (len > sizeof(stream->byte3)) + break; + if (space < sizeof(*stream)) { + sense->flags |= SSDD_SDAT_OVFL; break; } + stream->desc_type = SSD_DESC_STREAM; + stream->length = sizeof(*stream) - + (offsetof(struct scsi_sense_stream, length) + 1); + stream->byte3 = *data; + desc += sizeof(*stream); + space -= sizeof(*stream); + break; + } + default: /* - * If we get in here, just bump the extra length to - * 10 bytes. That will encompass anything we're - * going to set here. + * We shouldn't get here, but if we do, do nothing. + * We've already consumed the arguments above. */ - sense->extra_len = 10; - sense_len = (int)va_arg(ap, int); - data = (uint8_t *)va_arg(ap, uint8_t *); + break; + } + } + sense->extra_len = desc - &sense->sense_desc[0]; + *sense_len = offsetof(struct scsi_sense_data_desc, extra_len) + 1 + + sense->extra_len; +} - switch (elem_type) { - case SSD_ELEM_SKS: - /* - * The user passed in pre-formatted sense - * key specific data. - */ - bcopy(data, &sense->sense_key_spec[0], - MIN(sizeof(sense->sense_key_spec), - sense_len)); - break; - case SSD_ELEM_INFO: - case SSD_ELEM_COMMAND: { - uint8_t *data_dest; - int i; - - if (elem_type == SSD_ELEM_COMMAND) { - data_dest = &sense->cmd_spec_info[0]; - len_to_copy = MIN(sense_len, - sizeof(sense->cmd_spec_info)); - } else { - data_dest = &sense->info[0]; - len_to_copy = MIN(sense_len, - sizeof(sense->info)); - - /* Set VALID bit only if no overflow. */ - for (i = 0; i < sense_len - len_to_copy; - i++) { - if (data[i] != 0) - break; - } - if (i >= sense_len - len_to_copy) { - sense->error_code |= - SSD_ERRCODE_VALID; - } - } +/* + * Fill in SCSI fixed sense data with the specified parameters. + */ +static void +scsi_set_sense_data_fixed_va(struct scsi_sense_data *sense_data, + u_int *sense_len, scsi_sense_data_type sense_format, int current_error, + int sense_key, int asc, int ascq, va_list ap) +{ + struct scsi_sense_data_fixed *sense; + scsi_sense_elem_type elem_type; + uint8_t *data; + int len; - /* - * Copy this in reverse so that if we have - * less than 4 bytes to fill, the least - * significant bytes will be at the end. - * If we have more than 4 bytes, only the - * least significant bytes will be included. - */ - for (i = sense_len - 1; i >= 0 && - len_to_copy > 0; i--, len_to_copy--) - data_dest[len_to_copy - 1] = data[i]; + memset(sense_data, 0, sizeof(*sense_data)); + sense = (struct scsi_sense_data_fixed *)sense_data; + if (current_error != 0) + sense->error_code = SSD_CURRENT_ERROR; + else + sense->error_code = SSD_DEFERRED_ERROR; + sense->flags = sense_key & SSD_KEY; + sense->extra_len = 0; + if (*sense_len >= 13) { + sense->add_sense_code = asc; + sense->extra_len = MAX(sense->extra_len, 5); + } else + sense->flags |= SSD_SDAT_OVFL; + if (*sense_len >= 14) { + sense->add_sense_code_qual = ascq; + sense->extra_len = MAX(sense->extra_len, 6); + } else + sense->flags |= SSD_SDAT_OVFL; + while ((elem_type = va_arg(ap, scsi_sense_elem_type)) != + SSD_ELEM_NONE) { + if (elem_type >= SSD_ELEM_MAX) { + printf("%s: invalid sense type %d\n", __func__, + elem_type); + break; + } + len = va_arg(ap, int); + data = va_arg(ap, uint8_t *); + + switch (elem_type) { + case SSD_ELEM_SKIP: + break; + case SSD_ELEM_SKS: + if (len > sizeof(sense->sense_key_spec)) break; - } - case SSD_ELEM_FRU: - sense->fru = *data; + if (*sense_len < 18) { + sense->flags |= SSD_SDAT_OVFL; break; - case SSD_ELEM_STREAM: - sense->flags |= *data; + } + bcopy(data, &sense->sense_key_spec[0], len); + sense->extra_len = MAX(sense->extra_len, 10); + break; + case SSD_ELEM_COMMAND: + if (*sense_len < 12) { + sense->flags |= SSD_SDAT_OVFL; break; - case SSD_ELEM_DESC: - default: - - /* - * If the user passes in descriptor sense, - * we can't handle that in fixed format. - * So just skip it, and any unknown argument - * types. - */ + } + if (len > sizeof(sense->cmd_spec_info)) { + data += len - sizeof(sense->cmd_spec_info); + len -= len - sizeof(sense->cmd_spec_info); + } + bcopy(data, &sense->cmd_spec_info[ + sizeof(sense->cmd_spec_info) - len], len); + sense->extra_len = MAX(sense->extra_len, 4); + break; + case SSD_ELEM_INFO: + /* Set VALID bit only if no overflow. */ + sense->error_code |= SSD_ERRCODE_VALID; + while (len > sizeof(sense->info)) { + if (data[0] != 0) + sense->error_code &= ~SSD_ERRCODE_VALID; + data ++; + len --; + } + bcopy(data, &sense->info[sizeof(sense->info) - len], len); + break; + case SSD_ELEM_FRU: + if (*sense_len < 15) { + sense->flags |= SSD_SDAT_OVFL; break; } + sense->fru = *data; + sense->extra_len = MAX(sense->extra_len, 7); + break; + case SSD_ELEM_STREAM: + sense->flags |= *data & + (SSD_ILI | SSD_EOM | SSD_FILEMARK); + break; + default: + + /* + * We can't handle that in fixed format. Skip it. + */ + break; } } + *sense_len = offsetof(struct scsi_sense_data_fixed, extra_len) + 1 + + sense->extra_len; +} + +/* + * Fill in SCSI sense data with the specified parameters. This routine can + * fill in either fixed or descriptor type sense data. + */ +void +scsi_set_sense_data_va(struct scsi_sense_data *sense_data, u_int *sense_len, + scsi_sense_data_type sense_format, int current_error, + int sense_key, int asc, int ascq, va_list ap) +{ + + if (*sense_len > SSD_FULL_SIZE) + *sense_len = SSD_FULL_SIZE; + if (sense_format == SSD_TYPE_DESC) + scsi_set_sense_data_desc_va(sense_data, sense_len, + sense_format, current_error, sense_key, asc, ascq, ap); + else + scsi_set_sense_data_fixed_va(sense_data, sense_len, + sense_format, current_error, sense_key, asc, ascq, ap); +} + +void +scsi_set_sense_data(struct scsi_sense_data *sense_data, + scsi_sense_data_type sense_format, int current_error, + int sense_key, int asc, int ascq, ...) +{ + va_list ap; + u_int sense_len = SSD_FULL_SIZE; + + va_start(ap, ascq); + scsi_set_sense_data_va(sense_data, &sense_len, sense_format, + current_error, sense_key, asc, ascq, ap); + va_end(ap); } void -scsi_set_sense_data(struct scsi_sense_data *sense_data, +scsi_set_sense_data_len(struct scsi_sense_data *sense_data, u_int *sense_len, scsi_sense_data_type sense_format, int current_error, - int sense_key, int asc, int ascq, ...) + int sense_key, int asc, int ascq, ...) { va_list ap; va_start(ap, ascq); - scsi_set_sense_data_va(sense_data, sense_format, current_error, - sense_key, asc, ascq, ap); + scsi_set_sense_data_va(sense_data, sense_len, sense_format, + current_error, sense_key, asc, ascq, ap); va_end(ap); } Modified: head/sys/cam/scsi/scsi_all.h ============================================================================== --- head/sys/cam/scsi/scsi_all.h Sat Dec 24 14:50:13 2016 (r310523) +++ head/sys/cam/scsi/scsi_all.h Sat Dec 24 17:42:34 2016 (r310524) @@ -3196,11 +3196,12 @@ struct scsi_sense_data_fixed #define SSD_KEY_BLANK_CHECK 0x08 #define SSD_KEY_Vendor_Specific 0x09 #define SSD_KEY_COPY_ABORTED 0x0a -#define SSD_KEY_ABORTED_COMMAND 0x0b +#define SSD_KEY_ABORTED_COMMAND 0x0b #define SSD_KEY_EQUAL 0x0c #define SSD_KEY_VOLUME_OVERFLOW 0x0d #define SSD_KEY_MISCOMPARE 0x0e -#define SSD_KEY_COMPLETED 0x0f +#define SSD_KEY_COMPLETED 0x0f +#define SSD_SDAT_OVFL 0x10 #define SSD_ILI 0x20 #define SSD_EOM 0x40 #define SSD_FILEMARK 0x80 @@ -3238,7 +3239,9 @@ struct scsi_sense_data_desc uint8_t sense_key; uint8_t add_sense_code; uint8_t add_sense_code_qual; - uint8_t reserved[3]; + uint8_t flags; +#define SSDD_SDAT_OVFL 0x80 + uint8_t reserved[2]; /* * Note that SPC-4, section 4.5.2.1 says that the extra_len field * must be less than or equal to 244. @@ -3706,13 +3709,15 @@ void scsi_desc_iterate(struct scsi_sense void *), void *arg); uint8_t *scsi_find_desc(struct scsi_sense_data_desc *sense, u_int sense_len, uint8_t desc_type); -void scsi_set_sense_data(struct scsi_sense_data *sense_data, +void scsi_set_sense_data(struct scsi_sense_data *sense_data, scsi_sense_data_type sense_format, int current_error, int sense_key, int asc, int ascq, ...) ; +void scsi_set_sense_data_len(struct scsi_sense_data *sense_data, + u_int *sense_len, scsi_sense_data_type sense_format, int current_error, + int sense_key, int asc, int ascq, ...) ; void scsi_set_sense_data_va(struct scsi_sense_data *sense_data, - scsi_sense_data_type sense_format, - int current_error, int sense_key, int asc, - int ascq, va_list ap); + u_int *sense_len, scsi_sense_data_type sense_format, + int current_error, int sense_key, int asc, int ascq, va_list ap); int scsi_get_sense_info(struct scsi_sense_data *sense_data, u_int sense_len, uint8_t info_type, uint64_t *info, int64_t *signed_info); From owner-svn-src-all@freebsd.org Sat Dec 24 22:51:04 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8FBFAC8FDCA; Sat, 24 Dec 2016 22:51:04 +0000 (UTC) (envelope-from hrs@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 5293B1AD0; Sat, 24 Dec 2016 22:51:04 +0000 (UTC) (envelope-from hrs@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBOMp2Yp067914; Sat, 24 Dec 2016 22:51:02 GMT (envelope-from hrs@FreeBSD.org) Received: (from hrs@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBOMp2bu067913; Sat, 24 Dec 2016 22:51:02 GMT (envelope-from hrs@FreeBSD.org) Message-Id: <201612242251.uBOMp2bu067913@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hrs set sender to hrs@FreeBSD.org using -f From: Hiroki Sato Date: Sat, 24 Dec 2016 22:51:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310527 - head/usr.bin/logger X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 24 Dec 2016 22:51:04 -0000 Author: hrs Date: Sat Dec 24 22:51:02 2016 New Revision: 310527 URL: https://svnweb.freebsd.org/changeset/base/310527 Log: Fix gcc build. Spotted by: lidl Modified: head/usr.bin/logger/logger.c Modified: head/usr.bin/logger/logger.c ============================================================================== --- head/usr.bin/logger/logger.c Sat Dec 24 20:36:27 2016 (r310526) +++ head/usr.bin/logger/logger.c Sat Dec 24 22:51:02 2016 (r310527) @@ -99,6 +99,7 @@ main(int argc, char *argv[]) host = NULL; svcname = "syslog"; src = NULL; + socks = NULL; pri = LOG_USER | LOG_NOTICE; logflags = 0; unsetenv("TZ"); From owner-svn-src-all@freebsd.org Sat Dec 24 23:29:52 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0213FC8FEE7; Sat, 24 Dec 2016 23:29:52 +0000 (UTC) (envelope-from hrs@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id AC0021147; Sat, 24 Dec 2016 23:29:51 +0000 (UTC) (envelope-from hrs@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBONTodl083192; Sat, 24 Dec 2016 23:29:50 GMT (envelope-from hrs@FreeBSD.org) Received: (from hrs@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBONToT3083191; Sat, 24 Dec 2016 23:29:50 GMT (envelope-from hrs@FreeBSD.org) Message-Id: <201612242329.uBONToT3083191@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hrs set sender to hrs@FreeBSD.org using -f From: Hiroki Sato Date: Sat, 24 Dec 2016 23:29:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310528 - head/usr.sbin/syslogd X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 24 Dec 2016 23:29:52 -0000 Author: hrs Date: Sat Dec 24 23:29:50 2016 New Revision: 310528 URL: https://svnweb.freebsd.org/changeset/base/310528 Log: - Fix -N flag (NoBind) for AF_LOCAL sockets. - Do setsockopt(SO_RCVBUF) for AF_LOCAL sockets regardless of -s flag. Modified: head/usr.sbin/syslogd/syslogd.c Modified: head/usr.sbin/syslogd/syslogd.c ============================================================================== --- head/usr.sbin/syslogd/syslogd.c Sat Dec 24 22:51:02 2016 (r310527) +++ head/usr.sbin/syslogd/syslogd.c Sat Dec 24 23:29:50 2016 (r310528) @@ -2873,9 +2873,8 @@ socksetup(struct peer *pe) for (res = res0; res != NULL; res = res->ai_next) { int s; - if (res->ai_family == AF_LOCAL) - unlink(pe->pe_name); - else if (SecureMode > 1) { + if (res->ai_family != AF_LOCAL && + SecureMode > 1) { /* Only AF_LOCAL in secure mode. */ continue; } @@ -2907,26 +2906,36 @@ socksetup(struct peer *pe) error++; continue; } + /* - * RFC 3164 recommends that client side message - * should come from the privileged syslogd port. + * Bind INET and UNIX-domain sockets. + * + * A UNIX-domain socket is always bound to a pathname + * regardless of -N flag. * - * If the system administrator choose not to obey + * For INET sockets, RFC 3164 recommends that client + * side message should come from the privileged syslogd port. + * + * If the system administrator chooses not to obey * this, we can skip the bind() step so that the * system will choose a port for us. */ - if (NoBind == 0) { + if (res->ai_family == AF_LOCAL) + unlink(pe->pe_name); + if (res->ai_family == AF_LOCAL || + NoBind == 0 || pe->pe_name != NULL) { if (bind(s, res->ai_addr, res->ai_addrlen) < 0) { logerror("bind"); close(s); error++; continue; } - if (SecureMode == 0) + if (res->ai_family == AF_LOCAL || + SecureMode == 0) increase_rcvbuf(s); } if (res->ai_family == AF_LOCAL && - chmod(pe->pe_name, pe->pe_mode) < 0) { + chmod(pe->pe_name, pe->pe_mode) < 0) { dprintf("chmod %s: %s\n", pe->pe_name, strerror(errno)); close(s); @@ -2936,7 +2945,7 @@ socksetup(struct peer *pe) dprintf("new socket fd is %d\n", s); listen(s, 5); dprintf("shutdown\n"); - if (SecureMode) { + if (SecureMode || res->ai_family == AF_LOCAL) { /* Forbid communication in secure mode. */ if (shutdown(s, SHUT_RD) < 0 && errno != ENOTCONN) { @@ -2944,9 +2953,9 @@ socksetup(struct peer *pe) if (!Debug) die(0); } - dprintf("listening on inet socket\n"); + dprintf("listening on socket\n"); } else - dprintf("sending on inet socket\n"); + dprintf("sending on socket\n"); addsock(res->ai_addr, res->ai_addrlen, &(struct socklist){ .sl_socket = s, From owner-svn-src-all@freebsd.org Sat Dec 24 23:43:15 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 434A4C8F346; Sat, 24 Dec 2016 23:43:15 +0000 (UTC) (envelope-from avos@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 12EBB1A06; Sat, 24 Dec 2016 23:43:15 +0000 (UTC) (envelope-from avos@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBONhEpI091129; Sat, 24 Dec 2016 23:43:14 GMT (envelope-from avos@FreeBSD.org) Received: (from avos@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBONhEZ1091128; Sat, 24 Dec 2016 23:43:14 GMT (envelope-from avos@FreeBSD.org) Message-Id: <201612242343.uBONhEZ1091128@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avos set sender to avos@FreeBSD.org using -f From: Andriy Voskoboinyk Date: Sat, 24 Dec 2016 23:43:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310529 - head/sys/net80211 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 24 Dec 2016 23:43:15 -0000 Author: avos Date: Sat Dec 24 23:43:14 2016 New Revision: 310529 URL: https://svnweb.freebsd.org/changeset/base/310529 Log: net80211: fix 'pending CAC -> RUN transition lost' bug. Ensure that CAC -> RUN state transition will be requested for every vap only once. Modified: head/sys/net80211/ieee80211_proto.c Modified: head/sys/net80211/ieee80211_proto.c ============================================================================== --- head/sys/net80211/ieee80211_proto.c Sat Dec 24 23:29:50 2016 (r310528) +++ head/sys/net80211/ieee80211_proto.c Sat Dec 24 23:43:14 2016 (r310529) @@ -1840,7 +1840,7 @@ ieee80211_cac_completeswitch(struct ieee ieee80211_new_state_locked(vap0, IEEE80211_S_RUN, 0); TAILQ_FOREACH(vap, &ic->ic_vaps, iv_next) - if (vap->iv_state == IEEE80211_S_CAC) + if (vap->iv_state == IEEE80211_S_CAC && vap != vap0) ieee80211_new_state_locked(vap, IEEE80211_S_RUN, 0); IEEE80211_UNLOCK(ic); } From owner-svn-src-all@freebsd.org Sat Dec 24 23:51:28 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 85768C8F449; Sat, 24 Dec 2016 23:51:28 +0000 (UTC) (envelope-from jamie@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 602681DB2; Sat, 24 Dec 2016 23:51:28 +0000 (UTC) (envelope-from jamie@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBONpRq3092200; Sat, 24 Dec 2016 23:51:27 GMT (envelope-from jamie@FreeBSD.org) Received: (from jamie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBONpRZC092199; Sat, 24 Dec 2016 23:51:27 GMT (envelope-from jamie@FreeBSD.org) Message-Id: <201612242351.uBONpRZC092199@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jamie set sender to jamie@FreeBSD.org using -f From: Jamie Gritton Date: Sat, 24 Dec 2016 23:51:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310530 - head/usr.sbin/jls X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 24 Dec 2016 23:51:28 -0000 Author: jamie Date: Sat Dec 24 23:51:27 2016 New Revision: 310530 URL: https://svnweb.freebsd.org/changeset/base/310530 Log: Improve IP address list representation in libxo output. Extract decision-making about special-case printing of certain jail parameters into a function. Refactor emitting of IPv4 and IPv6 address lists into a function. Resulting user-facing changes: XO_VERSION is bumped to 2. In verbose mode (-v), IPv4 and IPv6-Addresses are now properly emitted as separate lists. This only affects the output in encoding styles, i.e. xml and json. { { "__version": "1", "__version": "2", "jail-information": { "jail-information": { "jail": [ "jail": [ { { "jid": 166, "jid": 166, "hostname": "foo.com", "hostname": "foo.com", "path": "/var/jail/foo", "path": "/var/jail/foo", "name": "foo", "name": "foo", "state": "ACTIVE", "state": "ACTIVE", "cpusetid": 2, "cpusetid": 2, "ipv4_addrs": [ "ipv4_addrs": [ "10.1.1.1", "10.1.1.1", "10.1.1.2", "10.1.1.2", "10.1.1.3", | "10.1.1.3" > ], > "ipv6_addrs": [ "fe80::1000:1", "fe80::1000:1", "fe80::1000:2" "fe80::1000:2" ] ] } } ] ] } } } } In -n mode, ip4.addr and ip6.addr are formatted in the encoding styles' native list types, e.g. instead of comma-separated lists, JSON arrays are printed. jls -n all --libxo json ... "ip4.addr": [ "10.1.1.1", "10.1.1.2", "10.1.1.3" ], "ip4.saddrsel": true, "ip6.addr": [ "fe80::1000:1", "fe80::1000:2" ], ... jls -n all --libxo xml ... 10.1.1.1 10.1.1.2 10.1.1.3 true fe80::1000:1 fe80::1000:2 ... PR: 215008 Submitted by: Christian Schwarz Differential Revision: https://reviews.freebsd.org/D8766 Modified: head/usr.sbin/jls/jls.c Modified: head/usr.sbin/jls/jls.c ============================================================================== --- head/usr.sbin/jls/jls.c Sat Dec 24 23:43:14 2016 (r310529) +++ head/usr.sbin/jls/jls.c Sat Dec 24 23:51:27 2016 (r310530) @@ -51,7 +51,7 @@ __FBSDID("$FreeBSD$"); #define JP_USER 0x01000000 #define JP_OPT 0x02000000 -#define JLS_XO_VERSION "1" +#define JLS_XO_VERSION "2" #define PRINT_DEFAULT 0x01 #define PRINT_HEADER 0x02 @@ -77,7 +77,10 @@ static int sort_param(const void *a, con static char *noname(const char *name); static char *nononame(const char *name); static int print_jail(int pflags, int jflags); +static int special_print(int pflags, struct jailparam *param); static void quoted_print(int pflags, char *name, char *value); +static void emit_ip_addr_list(int af_family, const char *list_name, + struct jailparam *param); int main(int argc, char **argv) @@ -379,8 +382,7 @@ print_jail(int pflags, int jflags) { char *nname, *xo_nname; char **param_values; - int i, ai, jid, count, n, spc; - char ipbuf[INET6_ADDRSTRLEN]; + int i, jid, n, spc; jid = jailparam_get(params, nparams, jflags); if (jid < 0) @@ -401,29 +403,13 @@ print_jail(int pflags, int jflags) n = 6; #ifdef INET if (ip4_ok && !strcmp(params[n].jp_name, "ip4.addr")) { - count = params[n].jp_valuelen / sizeof(struct in_addr); - for (ai = 0; ai < count; ai++) - if (inet_ntop(AF_INET, - &((struct in_addr *)params[n].jp_value)[ai], - ipbuf, sizeof(ipbuf)) == NULL) - xo_err(1, "inet_ntop"); - else { - xo_emit("{P: }{l:ipv4_addrs}{P:\n}", ipbuf); - } + emit_ip_addr_list(AF_INET, "ipv4_addrs", params + n); n++; } #endif #ifdef INET6 if (ip6_ok && !strcmp(params[n].jp_name, "ip6.addr")) { - count = params[n].jp_valuelen / sizeof(struct in6_addr); - for (ai = 0; ai < count; ai++) - if (inet_ntop(AF_INET6, - &((struct in6_addr *) - params[n].jp_value)[ai], - ipbuf, sizeof(ipbuf)) == NULL) - xo_err(1, "inet_ntop"); - else - xo_emit("{P: }{l:ipv6_addrs}{P:\n}", ipbuf); + emit_ip_addr_list(AF_INET6, "ipv6_addrs", params + n); n++; } #endif @@ -499,14 +485,8 @@ print_jail(int pflags, int jflags) } xo_emit("{d:%s}=", params[i].jp_name); } - if (params[i].jp_valuelen == 0) { - if (pflags & PRINT_QUOTED) - xo_emit("{P:\"\"}"); - else if (!(pflags & PRINT_NAMEVAL)) - xo_emit("{P:-}"); - } else { + if (!special_print(pflags, params + i)) quoted_print(pflags, params[i].jp_name, param_values[i]); - } } xo_emit("{P:\n}"); for (i = 0; i < nparams; i++) @@ -553,3 +533,70 @@ quoted_print(int pflags, char *name, cha if (qc && pflags & PRINT_QUOTED) xo_emit("{P:/%c}", qc); } + +static int +special_print(int pflags, struct jailparam *param) +{ + int ip_as_list; + + switch (xo_get_style(NULL)) { + case XO_STYLE_JSON: + case XO_STYLE_XML: + ip_as_list = 1; + break; + default: + ip_as_list = 0; + } + + if (!ip_as_list && param->jp_valuelen == 0) { + if (pflags & PRINT_QUOTED) + xo_emit("{P:\"\"}"); + else if (!(pflags & PRINT_NAMEVAL)) + xo_emit("{P:-}"); + } else if (ip_as_list && !strcmp(param->jp_name, "ip4.addr")) { + emit_ip_addr_list(AF_INET, param->jp_name, param); + } else if (ip_as_list && !strcmp(param->jp_name, "ip6.addr")) { + emit_ip_addr_list(AF_INET6, param->jp_name, param); + } else { + return 0; + } + + return 1; +} + +static void +emit_ip_addr_list(int af_family, const char *list_name, struct jailparam *param) +{ + char ipbuf[INET6_ADDRSTRLEN]; + size_t addr_len; + const char *emit_str; + int ai, count; + + switch (af_family) { + case AF_INET: + addr_len = sizeof(struct in_addr); + emit_str = "{P: }{ql:ipv4_addr}{P:\n}"; + break; + case AF_INET6: + addr_len = sizeof(struct in6_addr); + emit_str = "{P: }{ql:ipv6_addr}{P:\n}"; + break; + default: + xo_err(1, "unsupported af_family"); + return; + } + + count = param->jp_valuelen / addr_len; + + xo_open_list(list_name); + for (ai = 0; ai < count; ai++) { + if (inet_ntop(af_family, + ((uint8_t *)param->jp_value) + addr_len * ai, + ipbuf, sizeof(ipbuf)) == NULL) { + xo_err(1, "inet_ntop"); + } else { + xo_emit(emit_str, ipbuf); + } + } + xo_close_list(list_name); +}