From owner-svn-src-head@FreeBSD.ORG Sun Apr 18 05:49:16 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C54E2106564A; Sun, 18 Apr 2010 05:49:16 +0000 (UTC) (envelope-from thompsa@FreeBSD.org) Received: from pele.citylink.co.nz (pele.citylink.co.nz [202.8.44.226]) by mx1.freebsd.org (Postfix) with ESMTP id 846EC8FC16; Sun, 18 Apr 2010 05:49:16 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by pele.citylink.co.nz (Postfix) with ESMTP id 5076993736; Sun, 18 Apr 2010 17:49:15 +1200 (NZST) X-Virus-Scanned: Debian amavisd-new at citylink.co.nz Received: from pele.citylink.co.nz ([127.0.0.1]) by localhost (pele.citylink.co.nz [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 6tBhq0rPfNQ8; Sun, 18 Apr 2010 17:49:10 +1200 (NZST) Received: from citylink.fud.org.nz (unknown [202.8.44.45]) by pele.citylink.co.nz (Postfix) with ESMTP; Sun, 18 Apr 2010 17:49:10 +1200 (NZST) Received: by citylink.fud.org.nz (Postfix, from userid 1001) id 19A8D11432; Sun, 18 Apr 2010 17:49:10 +1200 (NZST) Date: Sun, 18 Apr 2010 17:49:09 +1200 From: Andrew Thompson To: Doug Barton Message-ID: <20100418054909.GA8617@citylink.fud.org.nz> References: <201004171848.o3HImI3u040381@svn.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201004171848.o3HImI3u040381@svn.freebsd.org> User-Agent: Mutt/1.5.17 (2007-11-01) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r206769 - in head: etc/defaults share/man/man5 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Apr 2010 05:49:16 -0000 On Sat, Apr 17, 2010 at 06:48:18PM +0000, Doug Barton wrote: > Author: dougb > Date: Sat Apr 17 18:48:18 2010 > New Revision: 206769 > URL: http://svn.freebsd.org/changeset/base/206769 > > Log: > In case a user wants to configure only an IPv6 link-local address > add an example that shows how to do it. > > Modified: > head/etc/defaults/rc.conf > head/share/man/man5/rc.conf.5 > > Modified: head/etc/defaults/rc.conf > ============================================================================== > --- head/etc/defaults/rc.conf Sat Apr 17 18:35:07 2010 (r206768) > +++ head/etc/defaults/rc.conf Sat Apr 17 18:48:18 2010 (r206769) > @@ -211,6 +211,7 @@ ifconfig_lo0="inet 127.0.0.1" # default > #ifconfig_lo0_alias0="inet 127.0.0.254 netmask 0xffffffff" # Sample alias entry. > #ifconfig_ed0_ipx="ipx 0x00010010" # Sample IPX address family entry. > #ifconfig_ed0_ipv6="RTADV" # Sample IPv6 entry for RA/rtsol(8) > +#ifconfig_ed0_ipv6="inet6 auto_linklocal" # To configure only link-local Magic ifconfig parameters in rc.conf are usually in upper case, what makes this one different? Andrew From owner-svn-src-head@FreeBSD.ORG Sun Apr 18 06:16:47 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B91FA1065673 for ; Sun, 18 Apr 2010 06:16:47 +0000 (UTC) (envelope-from dougb@FreeBSD.org) Received: from mail2.fluidhosting.com (mx23.fluidhosting.com [204.14.89.6]) by mx1.freebsd.org (Postfix) with ESMTP id 0C2028FC14 for ; Sun, 18 Apr 2010 06:16:46 +0000 (UTC) Received: (qmail 27035 invoked by uid 399); 18 Apr 2010 06:16:46 -0000 Received: from localhost (HELO foreign.dougb.net) (dougb@dougbarton.us@127.0.0.1) by localhost with ESMTPAM; 18 Apr 2010 06:16:46 -0000 X-Originating-IP: 127.0.0.1 X-Sender: dougb@dougbarton.us Message-ID: <4BCAA3CC.3020200@FreeBSD.org> Date: Sat, 17 Apr 2010 23:16:44 -0700 From: Doug Barton Organization: http://SupersetSolutions.com/ User-Agent: Mozilla/5.0 (X11; U; FreeBSD i386; en-US; rv:1.9.1.9) Gecko/20100330 Thunderbird/3.0.4 MIME-Version: 1.0 To: Andrew Thompson References: <201004171848.o3HImI3u040381@svn.freebsd.org> <20100418054909.GA8617@citylink.fud.org.nz> In-Reply-To: <20100418054909.GA8617@citylink.fud.org.nz> X-Enigmail-Version: 1.0.1 OpenPGP: id=1A1ABC84 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r206769 - in head: etc/defaults share/man/man5 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Apr 2010 06:16:47 -0000 On 04/17/10 22:49, Andrew Thompson wrote: > Magic ifconfig parameters in rc.conf are usually in upper case, what > makes this one different? It's not magic. :) That's the actual command line that will be fed to ifconfig. Doug -- ... and that's just a little bit of history repeating. -- Propellerheads Improve the effectiveness of your Internet presence with a domain name makeover! http://SupersetSolutions.com/ From owner-svn-src-head@FreeBSD.ORG Sun Apr 18 06:28:50 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9762C1065670; Sun, 18 Apr 2010 06:28:50 +0000 (UTC) (envelope-from thompsa@FreeBSD.org) Received: from pele.citylink.co.nz (pele.citylink.co.nz [202.8.44.226]) by mx1.freebsd.org (Postfix) with ESMTP id 1AC9B8FC21; Sun, 18 Apr 2010 06:28:49 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by pele.citylink.co.nz (Postfix) with ESMTP id 49C2A93764; Sun, 18 Apr 2010 18:28:49 +1200 (NZST) X-Virus-Scanned: Debian amavisd-new at citylink.co.nz Received: from pele.citylink.co.nz ([127.0.0.1]) by localhost (pele.citylink.co.nz [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id T0KIj34Penwm; Sun, 18 Apr 2010 18:28:45 +1200 (NZST) Received: from citylink.fud.org.nz (unknown [202.8.44.45]) by pele.citylink.co.nz (Postfix) with ESMTP; Sun, 18 Apr 2010 18:28:45 +1200 (NZST) Received: by citylink.fud.org.nz (Postfix, from userid 1001) id EFB6911432; Sun, 18 Apr 2010 18:28:44 +1200 (NZST) Date: Sun, 18 Apr 2010 18:28:44 +1200 From: Andrew Thompson To: Doug Barton Message-ID: <20100418062844.GB8617@citylink.fud.org.nz> References: <201004171848.o3HImI3u040381@svn.freebsd.org> <20100418054909.GA8617@citylink.fud.org.nz> <4BCAA3CC.3020200@FreeBSD.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4BCAA3CC.3020200@FreeBSD.org> User-Agent: Mutt/1.5.17 (2007-11-01) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r206769 - in head: etc/defaults share/man/man5 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Apr 2010 06:28:50 -0000 On Sat, Apr 17, 2010 at 11:16:44PM -0700, Doug Barton wrote: > On 04/17/10 22:49, Andrew Thompson wrote: > > Magic ifconfig parameters in rc.conf are usually in upper case, what > > makes this one different? > > It's not magic. :) That's the actual command line that will be fed to > ifconfig. oops, my mistake. From owner-svn-src-head@FreeBSD.ORG Sun Apr 18 12:20:33 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7B0221065673; Sun, 18 Apr 2010 12:20:33 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 69F2C8FC1C; Sun, 18 Apr 2010 12:20:33 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o3ICKX3A076490; Sun, 18 Apr 2010 12:20:33 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o3ICKX41076488; Sun, 18 Apr 2010 12:20:33 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <201004181220.o3ICKX41076488@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Sun, 18 Apr 2010 12:20:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r206792 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Apr 2010 12:20:33 -0000 Author: pjd Date: Sun Apr 18 12:20:33 2010 New Revision: 206792 URL: http://svn.freebsd.org/changeset/base/206792 Log: Set ARC_L2_WRITING on L2ARC header creation. Obtained from: OpenSolaris Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c Sun Apr 18 10:42:42 2010 (r206791) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c Sun Apr 18 12:20:33 2010 (r206792) @@ -4562,6 +4562,7 @@ l2arc_write_buffers(spa_t *spa, l2arc_de hdrl2->b_dev = dev; hdrl2->b_daddr = dev->l2ad_hand; + ab->b_flags |= ARC_L2_WRITING; ab->b_l2hdr = hdrl2; list_insert_head(dev->l2ad_buflist, ab); buf_data = ab->b_buf->b_data; From owner-svn-src-head@FreeBSD.ORG Sun Apr 18 12:21:52 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9AFE4106566C; Sun, 18 Apr 2010 12:21:52 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 89C628FC24; Sun, 18 Apr 2010 12:21:52 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o3ICLq8i076788; Sun, 18 Apr 2010 12:21:52 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o3ICLqWP076786; Sun, 18 Apr 2010 12:21:52 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <201004181221.o3ICLqWP076786@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Sun, 18 Apr 2010 12:21:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r206793 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Apr 2010 12:21:52 -0000 Author: pjd Date: Sun Apr 18 12:21:52 2010 New Revision: 206793 URL: http://svn.freebsd.org/changeset/base/206793 Log: Remove racy assertion. Obtained from: OpenSolaris Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c Sun Apr 18 12:20:33 2010 (r206792) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c Sun Apr 18 12:21:52 2010 (r206793) @@ -2731,7 +2731,6 @@ arc_read(zio_t *pio, spa_t *spa, blkptr_ uint32_t *arc_flags, const zbookmark_t *zb) { int err; - arc_buf_hdr_t *hdr = pbuf->b_hdr; ASSERT(!refcount_is_zero(&pbuf->b_hdr->b_refcnt)); ASSERT3U((char *)bp - (char *)pbuf->b_data, <, pbuf->b_hdr->b_size); @@ -2739,8 +2738,6 @@ arc_read(zio_t *pio, spa_t *spa, blkptr_ err = arc_read_nolock(pio, spa, bp, done, private, priority, zio_flags, arc_flags, zb); - - ASSERT3P(hdr, ==, pbuf->b_hdr); rw_exit(&pbuf->b_lock); return (err); } From owner-svn-src-head@FreeBSD.ORG Sun Apr 18 12:25:41 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2F6E8106564A; Sun, 18 Apr 2010 12:25:41 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 1E0248FC0C; Sun, 18 Apr 2010 12:25:41 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o3ICPfl0077686; Sun, 18 Apr 2010 12:25:41 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o3ICPenT077684; Sun, 18 Apr 2010 12:25:41 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <201004181225.o3ICPenT077684@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Sun, 18 Apr 2010 12:25:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r206794 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Apr 2010 12:25:41 -0000 Author: pjd Date: Sun Apr 18 12:25:40 2010 New Revision: 206794 URL: http://svn.freebsd.org/changeset/base/206794 Log: Extend locks scope to match OpenSolaris. Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c Sun Apr 18 12:21:52 2010 (r206793) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c Sun Apr 18 12:25:40 2010 (r206794) @@ -1106,8 +1106,6 @@ add_reference(arc_buf_hdr_t *ab, kmutex_ mutex_enter(lock); ASSERT(list_link_active(&ab->b_arc_node)); list_remove(list, ab); - mutex_exit(lock); - if (GHOST_STATE(ab->b_state)) { ASSERT3U(ab->b_datacnt, ==, 0); ASSERT3P(ab->b_buf, ==, NULL); @@ -1116,6 +1114,7 @@ add_reference(arc_buf_hdr_t *ab, kmutex_ ASSERT(delta > 0); ASSERT3U(*size, >=, delta); atomic_add_64(size, -delta); + mutex_exit(lock); /* remove the prefetch flag if we get a reference */ if (ab->b_flags & ARC_PREFETCH) ab->b_flags &= ~ARC_PREFETCH; @@ -1138,15 +1137,13 @@ remove_reference(arc_buf_hdr_t *ab, kmut kmutex_t *lock; get_buf_info(ab, state, &list, &lock); - ASSERT(!MUTEX_HELD(lock)); mutex_enter(lock); ASSERT(!list_link_active(&ab->b_arc_node)); list_insert_head(list, ab); - mutex_exit(lock); - ASSERT(ab->b_datacnt > 0); atomic_add_64(size, ab->b_size * ab->b_datacnt); + mutex_exit(lock); } return (cnt); } From owner-svn-src-head@FreeBSD.ORG Sun Apr 18 12:27:07 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7C0AB1065670; Sun, 18 Apr 2010 12:27:07 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 6AD7D8FC1E; Sun, 18 Apr 2010 12:27:07 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o3ICR7G6078020; Sun, 18 Apr 2010 12:27:07 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o3ICR7nw078018; Sun, 18 Apr 2010 12:27:07 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <201004181227.o3ICR7nw078018@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Sun, 18 Apr 2010 12:27:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r206795 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Apr 2010 12:27:07 -0000 Author: pjd Date: Sun Apr 18 12:27:07 2010 New Revision: 206795 URL: http://svn.freebsd.org/changeset/base/206795 Log: Add missing list and lock destruction. Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c Sun Apr 18 12:25:40 2010 (r206794) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c Sun Apr 18 12:27:07 2010 (r206795) @@ -3850,12 +3850,14 @@ arc_fini(void) list_destroy(&arc_mru_ghost->arcs_lists[i]); list_destroy(&arc_mfu->arcs_lists[i]); list_destroy(&arc_mfu_ghost->arcs_lists[i]); + list_destroy(&arc_l2c_only->arcs_lists[i]); mutex_destroy(&arc_anon->arcs_locks[i].arcs_lock); mutex_destroy(&arc_mru->arcs_locks[i].arcs_lock); mutex_destroy(&arc_mru_ghost->arcs_locks[i].arcs_lock); mutex_destroy(&arc_mfu->arcs_locks[i].arcs_lock); mutex_destroy(&arc_mfu_ghost->arcs_locks[i].arcs_lock); + mutex_destroy(&arc_l2c_only->arcs_locks[i].arcs_lock); } mutex_destroy(&zfs_write_limit_lock); From owner-svn-src-head@FreeBSD.ORG Sun Apr 18 12:36:53 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 63E601065675; Sun, 18 Apr 2010 12:36:53 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 51B628FC27; Sun, 18 Apr 2010 12:36:53 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o3ICarQf080175; Sun, 18 Apr 2010 12:36:53 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o3ICarvZ080173; Sun, 18 Apr 2010 12:36:53 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <201004181236.o3ICarvZ080173@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Sun, 18 Apr 2010 12:36:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r206796 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Apr 2010 12:36:53 -0000 Author: pjd Date: Sun Apr 18 12:36:53 2010 New Revision: 206796 URL: http://svn.freebsd.org/changeset/base/206796 Log: Style fixes. Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c Sun Apr 18 12:27:07 2010 (r206795) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c Sun Apr 18 12:36:53 2010 (r206796) @@ -131,7 +131,6 @@ #include #include -#include #include static kmutex_t arc_reclaim_thr_lock; @@ -238,7 +237,7 @@ struct arcs_lock { */ #define ARC_BUFC_NUMDATALISTS 16 #define ARC_BUFC_NUMMETADATALISTS 16 -#define ARC_BUFC_NUMLISTS (ARC_BUFC_NUMMETADATALISTS+ARC_BUFC_NUMDATALISTS) +#define ARC_BUFC_NUMLISTS (ARC_BUFC_NUMMETADATALISTS + ARC_BUFC_NUMDATALISTS) typedef struct arc_state { uint64_t arcs_lsize[ARC_BUFC_NUMTYPES]; /* amount of evictable data */ @@ -247,7 +246,7 @@ typedef struct arc_state { struct arcs_lock arcs_locks[ARC_BUFC_NUMLISTS] __aligned(CACHE_LINE_SIZE); } arc_state_t; -#define ARCS_LOCK(s, i) &((s)->arcs_locks[(i)].arcs_lock) +#define ARCS_LOCK(s, i) (&((s)->arcs_locks[(i)].arcs_lock)) /* The 6 states: */ static arc_state_t ARC_anon; @@ -307,9 +306,9 @@ typedef struct arc_stats { kstat_named_t arcstat_l2_hdr_size; kstat_named_t arcstat_memory_throttle_count; kstat_named_t arcstat_l2_write_trylock_fail; - kstat_named_t arcstat_l2_write_in_l2; kstat_named_t arcstat_l2_write_passed_headroom; kstat_named_t arcstat_l2_write_spa_mismatch; + kstat_named_t arcstat_l2_write_in_l2; kstat_named_t arcstat_l2_write_hdr_io_in_progress; kstat_named_t arcstat_l2_write_not_cacheable; kstat_named_t arcstat_l2_write_full; @@ -370,19 +369,19 @@ static arc_stats_t arc_stats = { { "l2_size", KSTAT_DATA_UINT64 }, { "l2_hdr_size", KSTAT_DATA_UINT64 }, { "memory_throttle_count", KSTAT_DATA_UINT64 }, - { "l2_write_trylock_fail", KSTAT_DATA_UINT64 }, - { "l2_write_in_l2", KSTAT_DATA_UINT64 }, - { "l2_write_passed_headroom", KSTAT_DATA_UINT64 }, - { "l2_write_spa_mismatch", KSTAT_DATA_UINT64 }, - { "l2_write_io_in_progress", KSTAT_DATA_UINT64 }, - { "l2_write_not_cacheable", KSTAT_DATA_UINT64 }, - { "l2_write_full", KSTAT_DATA_UINT64 }, - { "l2_write_buffer_iter", KSTAT_DATA_UINT64 }, - { "l2_write_pios", KSTAT_DATA_UINT64 }, - { "l2_write_bytes_written", KSTAT_DATA_UINT64 }, - { "l2_write_buffer_bytes_scanned", KSTAT_DATA_UINT64 }, - { "l2_write_buffer_list_iter", KSTAT_DATA_UINT64 }, - { "l2_write_buffer_list_null_iter", KSTAT_DATA_UINT64 } + { "l2_write_trylock_fail", KSTAT_DATA_UINT64 }, + { "l2_write_passed_headroom", KSTAT_DATA_UINT64 }, + { "l2_write_spa_mismatch", KSTAT_DATA_UINT64 }, + { "l2_write_in_l2", KSTAT_DATA_UINT64 }, + { "l2_write_io_in_progress", KSTAT_DATA_UINT64 }, + { "l2_write_not_cacheable", KSTAT_DATA_UINT64 }, + { "l2_write_full", KSTAT_DATA_UINT64 }, + { "l2_write_buffer_iter", KSTAT_DATA_UINT64 }, + { "l2_write_pios", KSTAT_DATA_UINT64 }, + { "l2_write_bytes_written", KSTAT_DATA_UINT64 }, + { "l2_write_buffer_bytes_scanned", KSTAT_DATA_UINT64 }, + { "l2_write_buffer_list_iter", KSTAT_DATA_UINT64 }, + { "l2_write_buffer_list_null_iter", KSTAT_DATA_UINT64 } }; #define ARCSTAT(stat) (arc_stats.stat.value.ui64) @@ -390,7 +389,7 @@ static arc_stats_t arc_stats = { #define ARCSTAT_INCR(stat, val) \ atomic_add_64(&arc_stats.stat.value.ui64, (val)); -#define ARCSTAT_BUMP(stat) ARCSTAT_INCR(stat, 1) +#define ARCSTAT_BUMP(stat) ARCSTAT_INCR(stat, 1) #define ARCSTAT_BUMPDOWN(stat) ARCSTAT_INCR(stat, -1) #define ARCSTAT_MAX(stat, val) { \ @@ -424,7 +423,7 @@ static arc_stats_t arc_stats = { } kstat_t *arc_ksp; -static arc_state_t *arc_anon; +static arc_state_t *arc_anon; static arc_state_t *arc_mru; static arc_state_t *arc_mru_ghost; static arc_state_t *arc_mfu; @@ -1076,10 +1075,10 @@ get_buf_info(arc_buf_hdr_t *ab, arc_stat { uint64_t buf_hashid = buf_hash(ab->b_spa, &ab->b_dva, ab->b_birth); - if (ab->b_type == ARC_BUFC_METADATA) - buf_hashid &= (ARC_BUFC_NUMMETADATALISTS-1); + if (ab->b_type == ARC_BUFC_METADATA) + buf_hashid &= (ARC_BUFC_NUMMETADATALISTS - 1); else { - buf_hashid &= (ARC_BUFC_NUMDATALISTS-1); + buf_hashid &= (ARC_BUFC_NUMDATALISTS - 1); buf_hashid += ARC_BUFC_NUMMETADATALISTS; } @@ -1096,10 +1095,10 @@ add_reference(arc_buf_hdr_t *ab, kmutex_ if ((refcount_add(&ab->b_refcnt, tag) == 1) && (ab->b_state != arc_anon)) { - list_t *list; - kmutex_t *lock; uint64_t delta = ab->b_size * ab->b_datacnt; uint64_t *size = &ab->b_state->arcs_lsize[ab->b_type]; + list_t *list; + kmutex_t *lock; get_buf_info(ab, ab->b_state, &list, &lock); ASSERT(!MUTEX_HELD(lock)); @@ -1179,7 +1178,6 @@ arc_change_state(arc_state_t *new_state, get_buf_info(ab, old_state, &list, &lock); use_mutex = !MUTEX_HELD(lock); - if (use_mutex) mutex_enter(lock); @@ -1202,13 +1200,11 @@ arc_change_state(arc_state_t *new_state, mutex_exit(lock); } if (new_state != arc_anon) { - int use_mutex; + int use_mutex; uint64_t *size = &new_state->arcs_lsize[ab->b_type]; get_buf_info(ab, new_state, &list, &lock); use_mutex = !MUTEX_HELD(lock); - - if (use_mutex) mutex_enter(lock); @@ -1626,7 +1622,7 @@ arc_evict(arc_state_t *state, spa_t *spa ASSERT(state == arc_mru || state == arc_mfu); evicted_state = (state == arc_mru) ? arc_mru_ghost : arc_mfu_ghost; - + if (type == ARC_BUFC_METADATA) { offset = 0; list_count = ARC_BUFC_NUMMETADATALISTS; @@ -1635,7 +1631,6 @@ arc_evict(arc_state_t *state, spa_t *spa idx = evict_metadata_offset; } else { offset = ARC_BUFC_NUMMETADATALISTS; - list_start = &state->arcs_lists[offset]; evicted_list_start = &evicted_state->arcs_lists[offset]; list_count = ARC_BUFC_NUMDATALISTS; @@ -1643,12 +1638,12 @@ arc_evict(arc_state_t *state, spa_t *spa } bytes_remaining = evicted_state->arcs_lsize[type]; count = 0; - + evict_start: list = &list_start[idx]; evicted_list = &evicted_list_start[idx]; lock = ARCS_LOCK(state, (offset + idx)); - evicted_lock = ARCS_LOCK(evicted_state, (offset + idx)); + evicted_lock = ARCS_LOCK(evicted_state, (offset + idx)); mutex_enter(lock); mutex_enter(evicted_lock); @@ -1718,7 +1713,7 @@ evict_start: if (bytes_remaining > 0) { mutex_exit(evicted_lock); mutex_exit(lock); - idx = ((idx + 1)&(list_count-1)); + idx = ((idx + 1) & (list_count - 1)); count++; goto evict_start; } @@ -1729,8 +1724,8 @@ evict_start: mutex_exit(evicted_lock); mutex_exit(lock); - - idx = ((idx + 1)&(list_count-1)); + + idx = ((idx + 1) & (list_count - 1)); count++; if (bytes_evicted < bytes) { @@ -1740,11 +1735,11 @@ evict_start: dprintf("only evicted %lld bytes from %x", (longlong_t)bytes_evicted, state); } - if (type == ARC_BUFC_METADATA) + if (type == ARC_BUFC_METADATA) evict_metadata_offset = idx; else evict_data_offset = idx; - + if (skipped) ARCSTAT_INCR(arcstat_evict_skip, skipped); @@ -1801,7 +1796,7 @@ arc_evict_ghost(arc_state_t *state, spa_ list_start = &state->arcs_lists[ARC_BUFC_NUMMETADATALISTS]; list_count = ARC_BUFC_NUMDATALISTS; offset = ARC_BUFC_NUMMETADATALISTS; - + evict_start: list = &list_start[idx]; lock = ARCS_LOCK(state, idx + offset); @@ -1848,12 +1843,12 @@ evict_start: } } mutex_exit(lock); - idx = ((idx + 1)&(ARC_BUFC_NUMDATALISTS-1)); + idx = ((idx + 1) & (ARC_BUFC_NUMDATALISTS - 1)); count++; - + if (count < list_count) goto evict_start; - + evict_offset = idx; if ((uintptr_t)list > (uintptr_t)&state->arcs_lists[ARC_BUFC_NUMMETADATALISTS] && (bytes < 0 || bytes_deleted < bytes)) { @@ -1942,7 +1937,7 @@ arc_do_user_evicts(void) /* * Move list over to avoid LOR */ -restart: +restart: mutex_enter(&arc_eviction_mtx); tmp_arc_eviction_list = arc_eviction_list; arc_eviction_list = NULL; @@ -2053,7 +2048,7 @@ arc_reclaim_needed(void) return (0); /* - * If pages are needed or we're within 2048 pages + * If pages are needed or we're within 2048 pages * of needing to page need to reclaim */ if (vm_pages_needed || (vm_paging_target() > -2048)) @@ -2611,10 +2606,7 @@ arc_read_done(zio_t *zio) hdr->b_flags &= ~ARC_L2_EVICTED; if (l2arc_noprefetch && (hdr->b_flags & ARC_PREFETCH)) hdr->b_flags &= ~ARC_L2CACHE; -#if 0 - else if ((hdr->b_flags & ARC_PREFETCH) == 0) - hdr->b_flags |= ARC_L2CACHE; -#endif + /* byteswap if necessary */ callback_list = hdr->b_acb; ASSERT(callback_list != NULL); @@ -2951,7 +2943,7 @@ top: * released by l2arc_read_done(). */ rzio = zio_read_phys(pio, vd, addr, size, - buf->b_data, ZIO_CHECKSUM_OFF, + buf->b_data, ZIO_CHECKSUM_OFF, l2arc_read_done, cb, priority, zio_flags | ZIO_FLAG_DONT_CACHE | ZIO_FLAG_CANFAIL | ZIO_FLAG_DONT_PROPAGATE | @@ -3048,7 +3040,7 @@ arc_buf_evict(arc_buf_t *buf) arc_buf_t **bufp; list_t *list, *evicted_list; kmutex_t *lock, *evicted_lock; - + rw_enter(&buf->b_lock, RW_WRITER); hdr = buf->b_hdr; if (hdr == NULL) { @@ -3723,7 +3715,6 @@ arc_init(void) arc_size = 0; for (i = 0; i < ARC_BUFC_NUMLISTS; i++) { - mutex_init(&arc_anon->arcs_locks[i].arcs_lock, NULL, MUTEX_DEFAULT, NULL); mutex_init(&arc_mru->arcs_locks[i].arcs_lock, @@ -3736,7 +3727,7 @@ arc_init(void) NULL, MUTEX_DEFAULT, NULL); mutex_init(&arc_l2c_only->arcs_locks[i].arcs_lock, NULL, MUTEX_DEFAULT, NULL); - + list_create(&arc_mru->arcs_lists[i], sizeof (arc_buf_hdr_t), offsetof(arc_buf_hdr_t, b_arc_node)); list_create(&arc_mru_ghost->arcs_lists[i], @@ -3786,7 +3777,7 @@ arc_init(void) #ifdef _KERNEL if (TUNABLE_INT_FETCH("vfs.zfs.prefetch_disable", &zfs_prefetch_disable)) prefetch_tunable_set = 1; - + #ifdef __i386__ if (prefetch_tunable_set == 0) { printf("ZFS NOTICE: Prefetch is disabled by default on i386 " @@ -3795,7 +3786,7 @@ arc_init(void) "to /boot/loader.conf.\n"); zfs_prefetch_disable=1; } -#else +#else if ((((uint64_t)physmem * PAGESIZE) < (1ULL << 32)) && prefetch_tunable_set == 0) { printf("ZFS NOTICE: Prefetch is disabled by default if less " @@ -3804,7 +3795,7 @@ arc_init(void) "to /boot/loader.conf.\n"); zfs_prefetch_disable=1; } -#endif +#endif /* Warn about ZFS memory and address space requirements. */ if (((uint64_t)physmem * PAGESIZE) < (256 + 128 + 64) * (1 << 20)) { printf("ZFS WARNING: Recommended minimum RAM size is 512MB; " @@ -3824,7 +3815,7 @@ void arc_fini(void) { int i; - + mutex_enter(&arc_reclaim_thr_lock); arc_thread_exit = 1; cv_signal(&arc_reclaim_thr_cv); @@ -3859,7 +3850,7 @@ arc_fini(void) mutex_destroy(&arc_mfu_ghost->arcs_locks[i].arcs_lock); mutex_destroy(&arc_l2c_only->arcs_locks[i].arcs_lock); } - + mutex_destroy(&zfs_write_limit_lock); buf_fini(); @@ -4255,18 +4246,18 @@ l2arc_list_locked(int list_num, kmutex_t { list_t *list; int idx; - - ASSERT(list_num >= 0 && list_num < 2*ARC_BUFC_NUMLISTS); + + ASSERT(list_num >= 0 && list_num < 2 * ARC_BUFC_NUMLISTS); if (list_num < ARC_BUFC_NUMMETADATALISTS) { idx = list_num; list = &arc_mfu->arcs_lists[idx]; *lock = ARCS_LOCK(arc_mfu, idx); - } else if (list_num < ARC_BUFC_NUMMETADATALISTS*2) { + } else if (list_num < ARC_BUFC_NUMMETADATALISTS * 2) { idx = list_num - ARC_BUFC_NUMMETADATALISTS; list = &arc_mru->arcs_lists[idx]; *lock = ARCS_LOCK(arc_mru, idx); - } else if (list_num < (ARC_BUFC_NUMMETADATALISTS*2 + + } else if (list_num < (ARC_BUFC_NUMMETADATALISTS * 2 + ARC_BUFC_NUMDATALISTS)) { idx = list_num - ARC_BUFC_NUMMETADATALISTS; list = &arc_mfu->arcs_lists[idx]; @@ -4277,8 +4268,6 @@ l2arc_list_locked(int list_num, kmutex_t *lock = ARCS_LOCK(arc_mru, idx); } - CTR3(KTR_SPARE2, "list=%p list_num=%d idx=%d", - list, list_num, idx); ASSERT(!(MUTEX_HELD(*lock))); mutex_enter(*lock); return (list); @@ -4448,7 +4437,7 @@ l2arc_write_buffers(spa_t *spa, l2arc_de * Copy buffers for L2ARC writing. */ mutex_enter(&l2arc_buflist_mtx); - for (try = 0; try < 2*ARC_BUFC_NUMLISTS; try++) { + for (try = 0; try < 2 * ARC_BUFC_NUMLISTS; try++) { list = l2arc_list_locked(try, &list_lock); passed_sz = 0; ARCSTAT_BUMP(arcstat_l2_write_buffer_list_iter); @@ -4464,9 +4453,8 @@ l2arc_write_buffers(spa_t *spa, l2arc_de ab = list_head(list); else ab = list_tail(list); - if (ab == NULL) { + if (ab == NULL) ARCSTAT_BUMP(arcstat_l2_write_buffer_list_null_iter); - } for (; ab; ab = ab_prev) { if (arc_warm == B_FALSE) @@ -4474,7 +4462,7 @@ l2arc_write_buffers(spa_t *spa, l2arc_de else ab_prev = list_prev(list, ab); ARCSTAT_INCR(arcstat_l2_write_buffer_bytes_scanned, ab->b_size); - + hash_lock = HDR_LOCK(ab); have_lock = MUTEX_HELD(hash_lock); if (!have_lock && !mutex_tryenter(hash_lock)) { From owner-svn-src-head@FreeBSD.ORG Sun Apr 18 12:43:34 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 51972106566C; Sun, 18 Apr 2010 12:43:34 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 390618FC24; Sun, 18 Apr 2010 12:43:34 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o3IChY4P081684; Sun, 18 Apr 2010 12:43:34 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o3IChYmE081682; Sun, 18 Apr 2010 12:43:34 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <201004181243.o3IChYmE081682@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Sun, 18 Apr 2010 12:43:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r206797 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Apr 2010 12:43:34 -0000 Author: pjd Date: Sun Apr 18 12:43:33 2010 New Revision: 206797 URL: http://svn.freebsd.org/changeset/base/206797 Log: Restore previous order. Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/arc.h Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/arc.h ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/arc.h Sun Apr 18 12:36:53 2010 (r206796) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/arc.h Sun Apr 18 12:43:33 2010 (r206797) @@ -55,8 +55,8 @@ struct arc_buf { }; typedef enum arc_buf_contents { - ARC_BUFC_METADATA, /* buffer contains metadata */ ARC_BUFC_DATA, /* buffer contains data */ + ARC_BUFC_METADATA, /* buffer contains metadata */ ARC_BUFC_NUMTYPES } arc_buf_contents_t; /* From owner-svn-src-head@FreeBSD.ORG Sun Apr 18 17:50:09 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 82B861065673; Sun, 18 Apr 2010 17:50:09 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 722388FC1A; Sun, 18 Apr 2010 17:50:09 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o3IHo9DI049306; Sun, 18 Apr 2010 17:50:09 GMT (envelope-from alc@svn.freebsd.org) Received: (from alc@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o3IHo9hV049304; Sun, 18 Apr 2010 17:50:09 GMT (envelope-from alc@svn.freebsd.org) Message-Id: <201004181750.o3IHo9hV049304@svn.freebsd.org> From: Alan Cox Date: Sun, 18 Apr 2010 17:50:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r206801 - head/sys/vm X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Apr 2010 17:50:09 -0000 Author: alc Date: Sun Apr 18 17:50:09 2010 New Revision: 206801 URL: http://svn.freebsd.org/changeset/base/206801 Log: There is no justification for vm_object_split() setting PG_REFERENCED on a page that it is going to sleep on. Eliminate it. MFC after: 3 weeks Modified: head/sys/vm/vm_object.c Modified: head/sys/vm/vm_object.c ============================================================================== --- head/sys/vm/vm_object.c Sun Apr 18 16:37:38 2010 (r206800) +++ head/sys/vm/vm_object.c Sun Apr 18 17:50:09 2010 (r206801) @@ -1422,7 +1422,6 @@ retry: * not be changed by this operation. */ if ((m->oflags & VPO_BUSY) || m->busy) { - vm_page_flag_set(m, PG_REFERENCED); vm_page_unlock_queues(); VM_OBJECT_UNLOCK(new_object); m->oflags |= VPO_WANTED; From owner-svn-src-head@FreeBSD.ORG Sun Apr 18 18:04:05 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4B2E7106566B; Sun, 18 Apr 2010 18:04:05 +0000 (UTC) (envelope-from pjd@garage.freebsd.pl) Received: from mail.garage.freebsd.pl (chello089077043238.chello.pl [89.77.43.238]) by mx1.freebsd.org (Postfix) with ESMTP id 617CE8FC15; Sun, 18 Apr 2010 18:04:03 +0000 (UTC) Received: by mail.garage.freebsd.pl (Postfix, from userid 65534) id 819E045E8E; Sun, 18 Apr 2010 20:04:01 +0200 (CEST) Received: from localhost (chello089077043238.chello.pl [89.77.43.238]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.garage.freebsd.pl (Postfix) with ESMTP id C9F8945C9C; Sun, 18 Apr 2010 20:03:55 +0200 (CEST) Date: Sun, 18 Apr 2010 20:03:57 +0200 From: Pawel Jakub Dawidek To: Kip Macy Message-ID: <20100418180356.GC2005@garage.freebsd.pl> References: <201003162217.o2GMHMjU012285@svn.freebsd.org> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="ABTtc+pdwF7KHXCz" Content-Disposition: inline In-Reply-To: <201003162217.o2GMHMjU012285@svn.freebsd.org> User-Agent: Mutt/1.4.2.3i X-PGP-Key-URL: http://people.freebsd.org/~pjd/pjd.asc X-OS: FreeBSD 9.0-CURRENT i386 X-Spam-Checker-Version: SpamAssassin 3.0.4 (2005-06-05) on mail.garage.freebsd.pl X-Spam-Level: X-Spam-Status: No, score=-0.6 required=4.5 tests=BAYES_00,RCVD_IN_SORBS_DUL autolearn=no version=3.0.4 Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r205231 - in head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs: . sys X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Apr 2010 18:04:05 -0000 --ABTtc+pdwF7KHXCz Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Mar 16, 2010 at 10:17:22PM +0000, Kip Macy wrote: > Author: kmacy > Date: Tue Mar 16 22:17:21 2010 > New Revision: 205231 > URL: http://svn.freebsd.org/changeset/base/205231 >=20 > Log: > - reduce contention by breaking up ARC state locks in to 16 for data > and 16 for metadata > - export L2ARC tunables as sysctls > - add several kstats to track L2ARC state more precisely > - avoid holding a contended lock when atomically incrementing a > contended counter (no lock protection needed for atomics) [...] > @@ -2505,6 +2731,7 @@ arc_read(zio_t *pio, spa_t *spa, blkptr_ > uint32_t *arc_flags, const zbookmark_t *zb) > { > int err; > + arc_buf_hdr_t *hdr =3D pbuf->b_hdr; > =20 > ASSERT(!refcount_is_zero(&pbuf->b_hdr->b_refcnt)); > ASSERT3U((char *)bp - (char *)pbuf->b_data, <, pbuf->b_hdr->b_size); > @@ -2513,8 +2740,8 @@ arc_read(zio_t *pio, spa_t *spa, blkptr_ > err =3D arc_read_nolock(pio, spa, bp, done, private, priority, > zio_flags, arc_flags, zb); > =20 > + ASSERT3P(hdr, =3D=3D, pbuf->b_hdr); > rw_exit(&pbuf->b_lock); > - > return (err); > } [...] This commit reverted my fix, which I committed in r204804. --=20 Pawel Jakub Dawidek http://www.wheelsystems.com pjd@FreeBSD.org http://www.FreeBSD.org FreeBSD committer Am I Evil? Yes, I Am! --ABTtc+pdwF7KHXCz Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.14 (FreeBSD) iEYEARECAAYFAkvLSYwACgkQForvXbEpPzTylQCfTvpmDmrl0d++RrH9VTs1YrH5 EckAoPW1L6V7dTQb05N8PGeuWDQSn6+z =ctfk -----END PGP SIGNATURE----- --ABTtc+pdwF7KHXCz-- From owner-svn-src-head@FreeBSD.ORG Sun Apr 18 18:23:11 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8002E1065670; Sun, 18 Apr 2010 18:23:11 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 5440D8FC13; Sun, 18 Apr 2010 18:23:11 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o3IINBlJ056642; Sun, 18 Apr 2010 18:23:11 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o3IINBKB056640; Sun, 18 Apr 2010 18:23:11 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201004181823.o3IINBKB056640@svn.freebsd.org> From: Konstantin Belousov Date: Sun, 18 Apr 2010 18:23:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r206802 - head/lib/libc/sys X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Apr 2010 18:23:11 -0000 Author: kib Date: Sun Apr 18 18:23:11 2010 New Revision: 206802 URL: http://svn.freebsd.org/changeset/base/206802 Log: Revert r206649. Simplify the presented declaration of struct sigaction, noting the caveat in the text. Real layout of the structure and exposed implementation namespace only obfuscates the usage. Submitted by: bde MFC after: 3 days Modified: head/lib/libc/sys/sigaction.2 Modified: head/lib/libc/sys/sigaction.2 ============================================================================== --- head/lib/libc/sys/sigaction.2 Sun Apr 18 17:50:09 2010 (r206801) +++ head/lib/libc/sys/sigaction.2 Sun Apr 18 18:23:11 2010 (r206802) @@ -28,7 +28,7 @@ .\" From: @(#)sigaction.2 8.2 (Berkeley) 4/3/94 .\" $FreeBSD$ .\" -.Dd April 13, 2010 +.Dd April 18, 2010 .Dt SIGACTION 2 .Os .Sh NAME @@ -40,16 +40,11 @@ .In signal.h .Bd -literal struct sigaction { - union { - void (*__sa_handler)(int); - void (*__sa_sigaction)(int, siginfo_t *, void *); - } __sigaction_u; /* signal handler */ + void (*sa_handler)(int); + void (*sa_sigaction)(int, siginfo_t *, void *); int sa_flags; /* see signal options below */ sigset_t sa_mask; /* signal mask to apply */ }; - -#define sa_handler __sigaction_u.__sa_handler -#define sa_sigaction __sigaction_u.__sa_sigaction .Ed .Ft int .Fo sigaction @@ -148,6 +143,16 @@ If is non-zero, the previous handling information for the signal is returned to the user. .Pp +The above declaration of +.Vt "struct sigaction" +is not literal. +It is provided only to list the accessible members. +See +.In sys/signal.h +for the actual definition. +In particular, the storage occupied by sa_handler and sa_sigaction overlaps, +and an application can not use both simultaneously. +.Pp Once a signal handler is installed, it normally remains installed until another .Fn sigaction @@ -496,16 +501,6 @@ or .Dv SIG_IGN this way. .Pp -If preprocessing symbol -.Va _POSIX_C_SOURCE -with the value >= 199309 is not defined, the following declaration for -the handler shall be used: -.Bl -tag -offset indent -width short -.It Tn POSIX Dv SA_SIGINFO : -.Ft void -.Fn handler int "struct __sigaction *" "void *" ; -.El -.Pp If the .Dv SA_SIGINFO flag is not set, the handler function should match From owner-svn-src-head@FreeBSD.ORG Sun Apr 18 18:43:37 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 288DA1065679; Sun, 18 Apr 2010 18:43:37 +0000 (UTC) (envelope-from rpaulo@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id F2ADC8FC1C; Sun, 18 Apr 2010 18:43:36 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o3IIhael061259; Sun, 18 Apr 2010 18:43:36 GMT (envelope-from rpaulo@svn.freebsd.org) Received: (from rpaulo@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o3IIhaGw061258; Sun, 18 Apr 2010 18:43:36 GMT (envelope-from rpaulo@svn.freebsd.org) Message-Id: <201004181843.o3IIhaGw061258@svn.freebsd.org> From: Rui Paulo Date: Sun, 18 Apr 2010 18:43:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r206803 - head/sys/mips/rmi/dev/sec X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Apr 2010 18:43:37 -0000 Author: rpaulo Date: Sun Apr 18 18:43:36 2010 New Revision: 206803 URL: http://svn.freebsd.org/changeset/base/206803 Log: Delete svn:executable prop. Modified: Directory Properties: head/sys/mips/rmi/dev/sec/desc.h (props changed) From owner-svn-src-head@FreeBSD.ORG Sun Apr 18 21:29:28 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BDE2D106566B; Sun, 18 Apr 2010 21:29:28 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id AD9008FC14; Sun, 18 Apr 2010 21:29:28 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o3ILTSR7098834; Sun, 18 Apr 2010 21:29:28 GMT (envelope-from alc@svn.freebsd.org) Received: (from alc@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o3ILTSCd098832; Sun, 18 Apr 2010 21:29:28 GMT (envelope-from alc@svn.freebsd.org) Message-Id: <201004182129.o3ILTSCd098832@svn.freebsd.org> From: Alan Cox Date: Sun, 18 Apr 2010 21:29:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r206814 - head/sys/vm X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Apr 2010 21:29:28 -0000 Author: alc Date: Sun Apr 18 21:29:28 2010 New Revision: 206814 URL: http://svn.freebsd.org/changeset/base/206814 Log: Remove a nonsensical test from vm_pageout_clean(). A page can't be in the inactive queue and have a non-zero wire count. Reviewed by: kib MFC after: 3 weeks Modified: head/sys/vm/vm_pageout.c Modified: head/sys/vm/vm_pageout.c ============================================================================== --- head/sys/vm/vm_pageout.c Sun Apr 18 21:26:59 2010 (r206813) +++ head/sys/vm/vm_pageout.c Sun Apr 18 21:29:28 2010 (r206814) @@ -350,7 +350,6 @@ more: vm_page_test_dirty(p); if (p->dirty == 0 || p->queue != PQ_INACTIVE || - p->wire_count != 0 || /* may be held by buf cache */ p->hold_count != 0) { /* may be undergoing I/O */ ib = 0; break; @@ -378,7 +377,6 @@ more: vm_page_test_dirty(p); if (p->dirty == 0 || p->queue != PQ_INACTIVE || - p->wire_count != 0 || /* may be held by buf cache */ p->hold_count != 0) { /* may be undergoing I/O */ break; } From owner-svn-src-head@FreeBSD.ORG Sun Apr 18 22:13:46 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 50F1F106564A; Sun, 18 Apr 2010 22:13:46 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 18B888FC23; Sun, 18 Apr 2010 22:13:46 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o3IMDjtV009575; Sun, 18 Apr 2010 22:13:45 GMT (envelope-from jilles@svn.freebsd.org) Received: (from jilles@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o3IMDjES009573; Sun, 18 Apr 2010 22:13:45 GMT (envelope-from jilles@svn.freebsd.org) Message-Id: <201004182213.o3IMDjES009573@svn.freebsd.org> From: Jilles Tjoelker Date: Sun, 18 Apr 2010 22:13:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r206817 - head/tools/regression/bin/sh/expansion X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Apr 2010 22:13:46 -0000 Author: jilles Date: Sun Apr 18 22:13:45 2010 New Revision: 206817 URL: http://svn.freebsd.org/changeset/base/206817 Log: sh: Add testcases for double-quotes within quoted ${var+-...} (non-POSIX). POSIX leaves things like "${var+"word"}" undefined. We follow traditional ash behaviour here. Hence, these testcases also work on stable/8. Added: head/tools/regression/bin/sh/expansion/plus-minus3.0 (contents, props changed) Added: head/tools/regression/bin/sh/expansion/plus-minus3.0 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tools/regression/bin/sh/expansion/plus-minus3.0 Sun Apr 18 22:13:45 2010 (r206817) @@ -0,0 +1,44 @@ +# $FreeBSD$ + +e= q='?' a='*' t=texttext s='ast*que?non' p='/et[c]/' w='a b c' b='{{(#)}}' +h='##' +failures='' +ok='' + +testcase() { + code="$1" + expected="$2" + oIFS="$IFS" + eval "$code" + IFS='|' + result="$#|$*" + IFS="$oIFS" + if [ "x$result" = "x$expected" ]; then + ok=x$ok + else + failures=x$failures + echo "For $code, expected $expected actual $result" + fi +} + +# We follow original ash behaviour for quoted ${var+-=?} expansions: +# a double-quote in one switches back to unquoted state. +# This allows expanding a variable as a single word if it is set +# and substituting multiple words otherwise. +# It is also close to the Bourne and Korn shells. +# POSIX leaves this undefined, and various other shells treat +# such double-quotes as introducing a second level of quoting +# which does not do much except quoting close braces. + +testcase 'set -- "${p+"/et[c]/"}"' '1|/etc/' +testcase 'set -- "${p-"/et[c]/"}"' '1|/et[c]/' +testcase 'set -- "${p+"$p"}"' '1|/etc/' +testcase 'set -- "${p-"$p"}"' '1|/et[c]/' +testcase 'set -- "${p+"""/et[c]/"}"' '1|/etc/' +testcase 'set -- "${p-"""/et[c]/"}"' '1|/et[c]/' +testcase 'set -- "${p+"""$p"}"' '1|/etc/' +testcase 'set -- "${p-"""$p"}"' '1|/et[c]/' +testcase 'set -- "${p+"\@"}"' '1|@' +testcase 'set -- "${p+"'\''/et[c]/'\''"}"' '1|/et[c]/' + +test "x$failures" = x From owner-svn-src-head@FreeBSD.ORG Sun Apr 18 22:21:23 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 84A0D106566B; Sun, 18 Apr 2010 22:21:23 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 7393A8FC17; Sun, 18 Apr 2010 22:21:23 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o3IMLNCW011570; Sun, 18 Apr 2010 22:21:23 GMT (envelope-from rmacklem@svn.freebsd.org) Received: (from rmacklem@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o3IMLNFW011567; Sun, 18 Apr 2010 22:21:23 GMT (envelope-from rmacklem@svn.freebsd.org) Message-Id: <201004182221.o3IMLNFW011567@svn.freebsd.org> From: Rick Macklem Date: Sun, 18 Apr 2010 22:21:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r206818 - in head/sys/fs: nfs nfsclient X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Apr 2010 22:21:23 -0000 Author: rmacklem Date: Sun Apr 18 22:21:23 2010 New Revision: 206818 URL: http://svn.freebsd.org/changeset/base/206818 Log: Avoid extraneous recovery cycles in the experimental NFS client when an NFSv4 server reboots, by doing two things. 1 - Make the function that acquires a stateid for I/O operations block until recovery is complete, so that it doesn't acquire out of date stateids. 2 - Only allow a recovery once every 1/2 of a lease duration, since the NFSv4 server must provide a recovery grace period of at least a lease duration. This should avoid recoveries caused by an out of date stateid that was acquired for an I/O op. just before a recovery cycle started. MFC after: 1 week Modified: head/sys/fs/nfs/nfsclstate.h head/sys/fs/nfsclient/nfs_clstate.c Modified: head/sys/fs/nfs/nfsclstate.h ============================================================================== --- head/sys/fs/nfs/nfsclstate.h Sun Apr 18 22:13:45 2010 (r206817) +++ head/sys/fs/nfs/nfsclstate.h Sun Apr 18 22:21:23 2010 (r206818) @@ -74,6 +74,7 @@ struct nfsclclient { #define NFSCLFLAGS_EXPIREIT 0x0040 #define NFSCLFLAGS_FIRSTDELEG 0x0080 #define NFSCLFLAGS_GOTDELEG 0x0100 +#define NFSCLFLAGS_RECVRINPROG 0x0200 struct nfsclowner { LIST_ENTRY(nfsclowner) nfsow_list; Modified: head/sys/fs/nfsclient/nfs_clstate.c ============================================================================== --- head/sys/fs/nfsclient/nfs_clstate.c Sun Apr 18 22:13:45 2010 (r206817) +++ head/sys/fs/nfsclient/nfs_clstate.c Sun Apr 18 22:21:23 2010 (r206818) @@ -481,6 +481,13 @@ nfscl_getstateid(vnode_t vp, u_int8_t *n } /* + * Wait for recovery to complete. + */ + while ((clp->nfsc_flags & NFSCLFLAGS_RECVRINPROG)) + (void) nfsmsleep(&clp->nfsc_flags, NFSCLSTATEMUTEXPTR, + PZERO, "nfsrecvr", NULL); + + /* * First, look for a delegation. */ LIST_FOREACH(dp, NFSCLDELEGHASH(clp, nfhp, fhlen), nfsdl_hash) { @@ -1778,6 +1785,7 @@ nfscl_recover(struct nfsclclient *clp, s * block when trying to use state. */ NFSLOCKCLSTATE(); + clp->nfsc_flags |= NFSCLFLAGS_RECVRINPROG; do { igotlock = nfsv4_lock(&clp->nfsc_lock, 1, NULL, NFSCLSTATEMUTEXPTR); @@ -1794,9 +1802,10 @@ nfscl_recover(struct nfsclclient *clp, s error == NFSERR_STALEDONTRECOVER) && --trycnt > 0); if (error) { nfscl_cleanclient(clp); - clp->nfsc_flags &= ~(NFSCLFLAGS_HASCLIENTID | - NFSCLFLAGS_RECOVER); NFSLOCKCLSTATE(); + clp->nfsc_flags &= ~(NFSCLFLAGS_HASCLIENTID | + NFSCLFLAGS_RECOVER | NFSCLFLAGS_RECVRINPROG); + wakeup(&clp->nfsc_flags); nfsv4_unlock(&clp->nfsc_lock, 0); NFSUNLOCKCLSTATE(); return; @@ -2057,6 +2066,8 @@ nfscl_recover(struct nfsclclient *clp, s } NFSLOCKCLSTATE(); + clp->nfsc_flags &= ~NFSCLFLAGS_RECVRINPROG; + wakeup(&clp->nfsc_flags); nfsv4_unlock(&clp->nfsc_lock, 0); NFSUNLOCKCLSTATE(); NFSFREECRED(tcred); @@ -2316,6 +2327,7 @@ nfscl_renewthread(struct nfsclclient *cl struct ucred *cred; u_int32_t clidrev; int error, cbpathdown, islept, igotlock, ret, clearok; + uint32_t recover_done_time = 0; cred = newnfs_getcred(); NFSLOCKCLSTATE(); @@ -2324,8 +2336,21 @@ nfscl_renewthread(struct nfsclclient *cl for(;;) { newnfs_setroot(cred); cbpathdown = 0; - if (clp->nfsc_flags & NFSCLFLAGS_RECOVER) - nfscl_recover(clp, cred, p); + if (clp->nfsc_flags & NFSCLFLAGS_RECOVER) { + /* + * Only allow one recover within 1/2 of the lease + * duration (nfsc_renew). + */ + if (recover_done_time < NFSD_MONOSEC) { + recover_done_time = NFSD_MONOSEC + + clp->nfsc_renew; + nfscl_recover(clp, cred, p); + } else { + NFSLOCKCLSTATE(); + clp->nfsc_flags &= ~NFSCLFLAGS_RECOVER; + NFSUNLOCKCLSTATE(); + } + } if (clp->nfsc_expire <= NFSD_MONOSEC && (clp->nfsc_flags & NFSCLFLAGS_HASCLIENTID)) { clp->nfsc_expire = NFSD_MONOSEC + clp->nfsc_renew; From owner-svn-src-head@FreeBSD.ORG Sun Apr 18 22:32:08 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 569451065673; Sun, 18 Apr 2010 22:32:08 +0000 (UTC) (envelope-from jmallett@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 445978FC0C; Sun, 18 Apr 2010 22:32:08 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o3IMW8wx013969; Sun, 18 Apr 2010 22:32:08 GMT (envelope-from jmallett@svn.freebsd.org) Received: (from jmallett@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o3IMW860013954; Sun, 18 Apr 2010 22:32:08 GMT (envelope-from jmallett@svn.freebsd.org) Message-Id: <201004182232.o3IMW860013954@svn.freebsd.org> From: Juli Mallett Date: Sun, 18 Apr 2010 22:32:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r206819 - in head/sys: mips/include mips/mips vm X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Apr 2010 22:32:08 -0000 Author: jmallett Date: Sun Apr 18 22:32:07 2010 New Revision: 206819 URL: http://svn.freebsd.org/changeset/base/206819 Log: o) Add a VM find-space option, VMFS_TLB_ALIGNED_SPACE, which searches the address space for an address as aligned by the new pmap_align_tlb() function, which is for constraints imposed by the TLB. [1] o) Add a kmem_alloc_nofault_space() function, which acts like kmem_alloc_nofault() but allows the caller to specify which find-space option to use. [1] o) Use kmem_alloc_nofault_space() with VMFS_TLB_ALIGNED_SPACE to allocate the kernel stack address on MIPS. [1] o) Make pmap_align_tlb() on MIPS align addresses so that they do not start on an odd boundary within the TLB, so that they are suitable for insertion as wired entries and do not have to share a TLB entry with another mapping, assuming they are appropriately-sized. o) Eliminate md_realstack now that the kstack will be appropriately-aligned on MIPS. o) Increase the number of guard pages to 2 so that we retain the proper alignment of the kstack address. Reviewed by: [1] alc X-MFC-after: Making sure alc has not come up with a better interface. Modified: head/sys/mips/include/param.h head/sys/mips/include/proc.h head/sys/mips/mips/exception.S head/sys/mips/mips/genassym.c head/sys/mips/mips/machdep.c head/sys/mips/mips/pmap.c head/sys/mips/mips/swtch.S head/sys/mips/mips/vm_machdep.c head/sys/vm/pmap.h head/sys/vm/vm_extern.h head/sys/vm/vm_glue.c head/sys/vm/vm_kern.c head/sys/vm/vm_map.c head/sys/vm/vm_map.h Modified: head/sys/mips/include/param.h ============================================================================== --- head/sys/mips/include/param.h Sun Apr 18 22:21:23 2010 (r206818) +++ head/sys/mips/include/param.h Sun Apr 18 22:32:07 2010 (r206819) @@ -113,12 +113,9 @@ /* * The kernel stack needs to be aligned on a (PAGE_SIZE * 2) boundary. - * - * Although we allocate 3 pages for the kernel stack we end up using - * only the 2 pages that are aligned on a (PAGE_SIZE * 2) boundary. */ -#define KSTACK_PAGES 3 /* kernel stack*/ -#define KSTACK_GUARD_PAGES 1 /* pages of kstack guard; 0 disables */ +#define KSTACK_PAGES 2 /* kernel stack*/ +#define KSTACK_GUARD_PAGES 2 /* pages of kstack guard; 0 disables */ #define UPAGES 2 Modified: head/sys/mips/include/proc.h ============================================================================== --- head/sys/mips/include/proc.h Sun Apr 18 22:21:23 2010 (r206818) +++ head/sys/mips/include/proc.h Sun Apr 18 22:32:07 2010 (r206819) @@ -44,7 +44,7 @@ */ struct mdthread { int md_flags; /* machine-dependent flags */ - int md_upte[KSTACK_PAGES - 1]; /* ptes for mapping u pcb */ + int md_upte[KSTACK_PAGES]; /* ptes for mapping u pcb */ int md_ss_addr; /* single step address for ptrace */ int md_ss_instr; /* single step instruction for ptrace */ register_t md_saved_intr; @@ -53,7 +53,6 @@ struct mdthread { int md_pc_ctrl; /* performance counter control */ int md_pc_count; /* performance counter */ int md_pc_spill; /* performance counter spill */ - vm_offset_t md_realstack; void *md_tls; }; Modified: head/sys/mips/mips/exception.S ============================================================================== --- head/sys/mips/mips/exception.S Sun Apr 18 22:21:23 2010 (r206818) +++ head/sys/mips/mips/exception.S Sun Apr 18 22:32:07 2010 (r206819) @@ -928,7 +928,7 @@ tlb_insert_random: */ GET_CPU_PCPU(k1) lw k0, PC_CURTHREAD(k1) - lw k0, TD_REALKSTACK(k0) + lw k0, TD_KSTACK(k0) sltu k0, k0, sp bnez k0, _C_LABEL(MipsKernGenException) nop @@ -975,7 +975,7 @@ tlb_insert_random: */ GET_CPU_PCPU(k1) lw k0, PC_CURTHREAD(k1) - sw zero, TD_REALKSTACK(k0) + sw zero, TD_KSTACK(k0) move a1, a0 PANIC("kernel stack overflow - trapframe at %p") Modified: head/sys/mips/mips/genassym.c ============================================================================== --- head/sys/mips/mips/genassym.c Sun Apr 18 22:21:23 2010 (r206818) +++ head/sys/mips/mips/genassym.c Sun Apr 18 22:32:07 2010 (r206819) @@ -65,7 +65,7 @@ __FBSDID("$FreeBSD$"); ASSYM(TD_PCB, offsetof(struct thread, td_pcb)); ASSYM(TD_UPTE, offsetof(struct thread, td_md.md_upte)); -ASSYM(TD_REALKSTACK, offsetof(struct thread, td_md.md_realstack)); +ASSYM(TD_KSTACK, offsetof(struct thread, td_kstack)); ASSYM(TD_FLAGS, offsetof(struct thread, td_flags)); ASSYM(TD_LOCK, offsetof(struct thread, td_lock)); ASSYM(TD_FRAME, offsetof(struct thread, td_frame)); Modified: head/sys/mips/mips/machdep.c ============================================================================== --- head/sys/mips/mips/machdep.c Sun Apr 18 22:21:23 2010 (r206818) +++ head/sys/mips/mips/machdep.c Sun Apr 18 22:32:07 2010 (r206819) @@ -298,14 +298,13 @@ mips_proc0_init(void) (long)kstack0)); thread0.td_kstack = kstack0; thread0.td_kstack_pages = KSTACK_PAGES; - thread0.td_md.md_realstack = roundup2(thread0.td_kstack, PAGE_SIZE * 2); /* * Do not use cpu_thread_alloc to initialize these fields * thread0 is the only thread that has kstack located in KSEG0 * while cpu_thread_alloc handles kstack allocated in KSEG2. */ - thread0.td_pcb = (struct pcb *)(thread0.td_md.md_realstack + - (thread0.td_kstack_pages - 1) * PAGE_SIZE) - 1; + thread0.td_pcb = (struct pcb *)(thread0.td_kstack + + thread0.td_kstack_pages * PAGE_SIZE) - 1; thread0.td_frame = &thread0.td_pcb->pcb_regs; /* Steal memory for the dynamic per-cpu area. */ Modified: head/sys/mips/mips/pmap.c ============================================================================== --- head/sys/mips/mips/pmap.c Sun Apr 18 22:21:23 2010 (r206818) +++ head/sys/mips/mips/pmap.c Sun Apr 18 22:32:07 2010 (r206819) @@ -2813,6 +2813,21 @@ pmap_align_superpage(vm_object_t object, *addr = ((*addr + SEGOFSET) & ~SEGOFSET) + superpage_offset; } +/* + * Increase the starting virtual address of the given mapping so + * that it is aligned to not be the second page in a TLB entry. + * This routine assumes that the length is appropriately-sized so + * that the allocation does not share a TLB entry at all if required. + */ +void +pmap_align_tlb(vm_offset_t *addr) +{ + if ((*addr & PAGE_SIZE) == 0) + return; + *addr += PAGE_SIZE; + return; +} + int pmap_pid_dump(int pid); int Modified: head/sys/mips/mips/swtch.S ============================================================================== --- head/sys/mips/mips/swtch.S Sun Apr 18 22:21:23 2010 (r206818) +++ head/sys/mips/mips/swtch.S Sun Apr 18 22:32:07 2010 (r206819) @@ -339,7 +339,7 @@ blocked_loop: sw a1, PC_CURTHREAD(a3) lw a2, TD_PCB(a1) sw a2, PC_CURPCB(a3) - lw v0, TD_REALKSTACK(a1) + lw v0, TD_KSTACK(a1) li s0, MIPS_KSEG2_START # If Uarea addr is below kseg2, bltu v0, s0, sw2 # no need to insert in TLB. lw a1, TD_UPTE+0(s7) # t0 = first u. pte Modified: head/sys/mips/mips/vm_machdep.c ============================================================================== --- head/sys/mips/mips/vm_machdep.c Sun Apr 18 22:21:23 2010 (r206818) +++ head/sys/mips/mips/vm_machdep.c Sun Apr 18 22:32:07 2010 (r206819) @@ -217,13 +217,9 @@ cpu_thread_swapin(struct thread *td) * part of the thread struct so cpu_switch() can quickly map in * the pcb struct and kernel stack. */ - if (!(pte = pmap_segmap(kernel_pmap, td->td_md.md_realstack))) - panic("cpu_thread_swapin: invalid segmap"); - pte += ((vm_offset_t)td->td_md.md_realstack >> PAGE_SHIFT) & (NPTEPG - 1); - - for (i = 0; i < KSTACK_PAGES - 1; i++) { + for (i = 0; i < KSTACK_PAGES; i++) { + pte = pmap_pte(kernel_pmap, td->td_kstack + i * PAGE_SIZE); td->td_md.md_upte[i] = *pte & ~(PTE_RO|PTE_WIRED); - pte++; } } @@ -238,22 +234,14 @@ cpu_thread_alloc(struct thread *td) pt_entry_t *pte; int i; - if (td->td_kstack & (1 << PAGE_SHIFT)) - td->td_md.md_realstack = td->td_kstack + PAGE_SIZE; - else - td->td_md.md_realstack = td->td_kstack; - - td->td_pcb = (struct pcb *)(td->td_md.md_realstack + - (td->td_kstack_pages - 1) * PAGE_SIZE) - 1; + KASSERT((td->td_kstack & (1 << PAGE_SHIFT)) == 0, ("kernel stack must be aligned.")); + td->td_pcb = (struct pcb *)(td->td_kstack + + td->td_kstack_pages * PAGE_SIZE) - 1; td->td_frame = &td->td_pcb->pcb_regs; - if (!(pte = pmap_segmap(kernel_pmap, td->td_md.md_realstack))) - panic("cpu_thread_alloc: invalid segmap"); - pte += ((vm_offset_t)td->td_md.md_realstack >> PAGE_SHIFT) & (NPTEPG - 1); - - for (i = 0; i < KSTACK_PAGES - 1; i++) { + for (i = 0; i < KSTACK_PAGES; i++) { + pte = pmap_pte(kernel_pmap, td->td_kstack + i * PAGE_SIZE); td->td_md.md_upte[i] = *pte & ~(PTE_RO|PTE_WIRED); - pte++; } } Modified: head/sys/vm/pmap.h ============================================================================== --- head/sys/vm/pmap.h Sun Apr 18 22:21:23 2010 (r206818) +++ head/sys/vm/pmap.h Sun Apr 18 22:32:07 2010 (r206819) @@ -98,6 +98,9 @@ extern vm_offset_t kernel_vm_end; void pmap_align_superpage(vm_object_t, vm_ooffset_t, vm_offset_t *, vm_size_t); +#if defined(__mips__) +void pmap_align_tlb(vm_offset_t *); +#endif void pmap_change_wiring(pmap_t, vm_offset_t, boolean_t); void pmap_clear_modify(vm_page_t m); void pmap_clear_reference(vm_page_t m); Modified: head/sys/vm/vm_extern.h ============================================================================== --- head/sys/vm/vm_extern.h Sun Apr 18 22:21:23 2010 (r206818) +++ head/sys/vm/vm_extern.h Sun Apr 18 22:32:07 2010 (r206819) @@ -47,6 +47,7 @@ vm_offset_t kmem_alloc_contig(vm_map_t m vm_paddr_t low, vm_paddr_t high, unsigned long alignment, unsigned long boundary, vm_memattr_t memattr); vm_offset_t kmem_alloc_nofault(vm_map_t, vm_size_t); +vm_offset_t kmem_alloc_nofault_space(vm_map_t, vm_size_t, int); vm_offset_t kmem_alloc_wait(vm_map_t, vm_size_t); void kmem_free(vm_map_t, vm_offset_t, vm_size_t); void kmem_free_wakeup(vm_map_t, vm_offset_t, vm_size_t); Modified: head/sys/vm/vm_glue.c ============================================================================== --- head/sys/vm/vm_glue.c Sun Apr 18 22:21:23 2010 (r206818) +++ head/sys/vm/vm_glue.c Sun Apr 18 22:32:07 2010 (r206819) @@ -373,8 +373,17 @@ vm_thread_new(struct thread *td, int pag /* * Get a kernel virtual address for this thread's kstack. */ +#if defined(__mips__) + /* + * We need to align the kstack's mapped address to fit within + * a single TLB entry. + */ + ks = kmem_alloc_nofault_space(kernel_map, + (pages + KSTACK_GUARD_PAGES) * PAGE_SIZE, VMFS_TLB_ALIGNED_SPACE); +#else ks = kmem_alloc_nofault(kernel_map, (pages + KSTACK_GUARD_PAGES) * PAGE_SIZE); +#endif if (ks == 0) { printf("vm_thread_new: kstack allocation failed\n"); vm_object_deallocate(ksobj); Modified: head/sys/vm/vm_kern.c ============================================================================== --- head/sys/vm/vm_kern.c Sun Apr 18 22:21:23 2010 (r206818) +++ head/sys/vm/vm_kern.c Sun Apr 18 22:32:07 2010 (r206819) @@ -119,6 +119,35 @@ kmem_alloc_nofault(map, size) } /* + * kmem_alloc_nofault_space: + * + * Allocate a virtual address range with no underlying object and + * no initial mapping to physical memory within the specified + * address space. Any mapping from this range to physical memory + * must be explicitly created prior to its use, typically with + * pmap_qenter(). Any attempt to create a mapping on demand + * through vm_fault() will result in a panic. + */ +vm_offset_t +kmem_alloc_nofault_space(map, size, find_space) + vm_map_t map; + vm_size_t size; + int find_space; +{ + vm_offset_t addr; + int result; + + size = round_page(size); + addr = vm_map_min(map); + result = vm_map_find(map, NULL, 0, &addr, size, find_space, + VM_PROT_ALL, VM_PROT_ALL, MAP_NOFAULT); + if (result != KERN_SUCCESS) { + return (0); + } + return (addr); +} + +/* * Allocate wired-down memory in the kernel's address map * or a submap. */ Modified: head/sys/vm/vm_map.c ============================================================================== --- head/sys/vm/vm_map.c Sun Apr 18 22:21:23 2010 (r206818) +++ head/sys/vm/vm_map.c Sun Apr 18 22:32:07 2010 (r206819) @@ -1394,9 +1394,20 @@ vm_map_find(vm_map_t map, vm_object_t ob vm_map_unlock(map); return (KERN_NO_SPACE); } - if (find_space == VMFS_ALIGNED_SPACE) + switch (find_space) { + case VMFS_ALIGNED_SPACE: pmap_align_superpage(object, offset, addr, length); + break; +#ifdef VMFS_TLB_ALIGNED_SPACE + case VMFS_TLB_ALIGNED_SPACE: + pmap_align_tlb(addr); + break; +#endif + default: + break; + } + start = *addr; } result = vm_map_insert(map, object, offset, start, start + Modified: head/sys/vm/vm_map.h ============================================================================== --- head/sys/vm/vm_map.h Sun Apr 18 22:21:23 2010 (r206818) +++ head/sys/vm/vm_map.h Sun Apr 18 22:32:07 2010 (r206819) @@ -326,6 +326,9 @@ long vmspace_wired_count(struct vmspace #define VMFS_NO_SPACE 0 /* don't find; use the given range */ #define VMFS_ANY_SPACE 1 /* find a range with any alignment */ #define VMFS_ALIGNED_SPACE 2 /* find a superpage-aligned range */ +#if defined(__mips__) +#define VMFS_TLB_ALIGNED_SPACE 3 /* find a TLB entry aligned range */ +#endif /* * vm_map_wire and vm_map_unwire option flags From owner-svn-src-head@FreeBSD.ORG Mon Apr 19 00:18:15 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2CD3B106566B; Mon, 19 Apr 2010 00:18:15 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 1CB808FC1E; Mon, 19 Apr 2010 00:18:15 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o3J0IFM9037377; Mon, 19 Apr 2010 00:18:15 GMT (envelope-from alc@svn.freebsd.org) Received: (from alc@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o3J0IEhA037375; Mon, 19 Apr 2010 00:18:14 GMT (envelope-from alc@svn.freebsd.org) Message-Id: <201004190018.o3J0IEhA037375@svn.freebsd.org> From: Alan Cox Date: Mon, 19 Apr 2010 00:18:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r206823 - head/sys/vm X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Apr 2010 00:18:15 -0000 Author: alc Date: Mon Apr 19 00:18:14 2010 New Revision: 206823 URL: http://svn.freebsd.org/changeset/base/206823 Log: vm_thread_swapout() can safely dirty the page before rather than after acquiring the page queues lock. Modified: head/sys/vm/vm_glue.c Modified: head/sys/vm/vm_glue.c ============================================================================== --- head/sys/vm/vm_glue.c Sun Apr 18 22:51:20 2010 (r206822) +++ head/sys/vm/vm_glue.c Mon Apr 19 00:18:14 2010 (r206823) @@ -523,8 +523,8 @@ vm_thread_swapout(struct thread *td) m = vm_page_lookup(ksobj, i); if (m == NULL) panic("vm_thread_swapout: kstack already missing?"); - vm_page_lock_queues(); vm_page_dirty(m); + vm_page_lock_queues(); vm_page_unwire(m, 0); vm_page_unlock_queues(); } From owner-svn-src-head@FreeBSD.ORG Mon Apr 19 02:12:34 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3F2991065672; Mon, 19 Apr 2010 02:12:34 +0000 (UTC) (envelope-from yanefbsd@gmail.com) Received: from qw-out-2122.google.com (qw-out-2122.google.com [74.125.92.26]) by mx1.freebsd.org (Postfix) with ESMTP id AB7568FC19; Mon, 19 Apr 2010 02:12:33 +0000 (UTC) Received: by qw-out-2122.google.com with SMTP id 5so1418455qwi.7 for ; Sun, 18 Apr 2010 19:12:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:received:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=BM4xQniw4B11NovFRBwfAg5Rhi54rjIT0/WE8+qEOAs=; b=EBb/HI+TRBXVxvHsOXyZRosdWN/g7FMkim8GgTcGY+ALep8wYETOvU9hUSPHcfIZW/ 15PrpPerztdmiVwqY7Uo/7ADr54+V+hxvnbtVav9KF8Lo1QinZnHxZzKQn0g1R2UUzSb h8mMUkb5XaOSu9Wn8Qr+4W+1Q/zZ3Bke53oNs= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; b=hAwSZSp6hMYZ8EuZ50jpBpPPOyqM7VFQZ69RcWIblFRr4TH2IL6Tqtt8AOttksz/rm HzcftSwC4jgx6T6ea4ZMALMLB6gOBsmg4cXpvlIGhSxGpc5IusE1dWf6rdG1INYpbErr xmzbmtQGNzhUkQ1tEUJOLlpyf2j9fpQUinrtY= MIME-Version: 1.0 Received: by 10.229.28.85 with HTTP; Sun, 18 Apr 2010 19:12:32 -0700 (PDT) In-Reply-To: <201004130952.o3D9qgJs012413@svn.freebsd.org> References: <201004130952.o3D9qgJs012413@svn.freebsd.org> Date: Sun, 18 Apr 2010 19:12:32 -0700 Received: by 10.229.217.14 with SMTP id hk14mr6289291qcb.89.1271643152794; Sun, 18 Apr 2010 19:12:32 -0700 (PDT) Message-ID: From: Garrett Cooper To: Luigi Rizzo Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r206550 - head/sbin/geom/class/sched X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Apr 2010 02:12:34 -0000 On Tue, Apr 13, 2010 at 2:52 AM, Luigi Rizzo wrote: > Author: luigi > Date: Tue Apr 13 09:52:42 2010 > New Revision: 206550 > URL: http://svn.freebsd.org/changeset/base/206550 > > Log: > =A0use correct .PATH, remove unused CFLAGS > > Modified: > =A0head/sbin/geom/class/sched/Makefile > > Modified: head/sbin/geom/class/sched/Makefile > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=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/sbin/geom/class/sched/Makefile Tue Apr 13 08:56:03 2010 =A0 =A0 = =A0 =A0(r206549) > +++ head/sbin/geom/class/sched/Makefile Tue Apr 13 09:52:42 2010 =A0 =A0 = =A0 =A0(r206550) > @@ -1,9 +1,8 @@ > =A0# GEOM_LIBRARY_PATH > =A0# $FreeBSD$ > > -.PATH: /usr/src/sbin/geom/misc > - > -CFLAGS +=3D -I/usr/src/sbin/geom > +.PATH: ${.CURDIR}/../../misc > +#CFLAGS +=3D -I/usr/src/sbin/geom Shouldn't this just be removed instead of commented out? Thanks, -Garrett From owner-svn-src-head@FreeBSD.ORG Mon Apr 19 06:01:58 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B2F6E106566B; Mon, 19 Apr 2010 06:01:58 +0000 (UTC) (envelope-from jmallett@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 9FEAA8FC18; Mon, 19 Apr 2010 06:01:58 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o3J61wRf013166; Mon, 19 Apr 2010 06:01:58 GMT (envelope-from jmallett@svn.freebsd.org) Received: (from jmallett@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o3J61wBc013160; Mon, 19 Apr 2010 06:01:58 GMT (envelope-from jmallett@svn.freebsd.org) Message-Id: <201004190601.o3J61wBc013160@svn.freebsd.org> From: Juli Mallett Date: Mon, 19 Apr 2010 06:01:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r206829 - in head/sys/mips: cavium include mips X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Apr 2010 06:01:58 -0000 Author: jmallett Date: Mon Apr 19 06:01:58 2010 New Revision: 206829 URL: http://svn.freebsd.org/changeset/base/206829 Log: o) Fix XKPHYS physical address extraction. Also define cache coherency attributes for XKPHYS. o) Make coprocessor 0 accessor function macros for register+selector registers take the full name so that e.g. (as done in this commit), prid selector 1 can be written through mips_wr_ebase() rather than mips_wr_prid1(). o) Allow for sign extension of 32-bit segment addresses. o) Remove an unused MIPS-I register number. Modified: head/sys/mips/cavium/octeon_machdep.c head/sys/mips/cavium/octeon_mp.c head/sys/mips/include/cpufunc.h head/sys/mips/include/cpuregs.h head/sys/mips/mips/genassym.c Modified: head/sys/mips/cavium/octeon_machdep.c ============================================================================== --- head/sys/mips/cavium/octeon_machdep.c Mon Apr 19 04:54:34 2010 (r206828) +++ head/sys/mips/cavium/octeon_machdep.c Mon Apr 19 06:01:58 2010 (r206829) @@ -86,16 +86,6 @@ static void octeon_boot_params_init(regi static uint64_t ciu_get_intr_sum_reg_addr(int core_num, int intx, int enx); static uint64_t ciu_get_intr_en_reg_addr(int core_num, int intx, int enx); -static __inline void -mips_wr_ebase(u_int32_t a0) -{ - __asm __volatile("mtc0 %[a0], $15, 1 ;" - : - : [a0] "r"(a0)); - - mips_barrier(); -} - void platform_cpu_init() { Modified: head/sys/mips/cavium/octeon_mp.c ============================================================================== --- head/sys/mips/cavium/octeon_mp.c Mon Apr 19 04:54:34 2010 (r206828) +++ head/sys/mips/cavium/octeon_mp.c Mon Apr 19 06:01:58 2010 (r206829) @@ -69,7 +69,7 @@ platform_init_ap(int cpuid) /* * Set the exception base. */ - mips_wr_prid1(0x80000000 | cpuid); + mips_wr_ebase(0x80000000 | cpuid); /* * Set up interrupts, clear IPIs and unmask the IPI interrupt. Modified: head/sys/mips/include/cpufunc.h ============================================================================== --- head/sys/mips/include/cpufunc.h Mon Apr 19 04:54:34 2010 (r206828) +++ head/sys/mips/include/cpufunc.h Mon Apr 19 06:01:58 2010 (r206829) @@ -166,7 +166,7 @@ mips_wr_ ## n (uint32_t a0) \ #define MIPS_RDRW32_COP0_SEL(n,r,s) \ static __inline uint32_t \ -mips_rd_ ## n ## s(void) \ +mips_rd_ ## n(void) \ { \ int v0; \ __asm __volatile ("mfc0 %[v0], $"__XSTRING(r)", "__XSTRING(s)";" \ @@ -175,7 +175,7 @@ mips_rd_ ## n ## s(void) \ return (v0); \ } \ static __inline void \ -mips_wr_ ## n ## s(uint32_t a0) \ +mips_wr_ ## n(uint32_t a0) \ { \ __asm __volatile ("mtc0 %[a0], $"__XSTRING(r)", "__XSTRING(s)";" \ __XSTRING(COP0_SYNC)";" \ @@ -201,9 +201,9 @@ static __inline void mips_sync_icache (v MIPS_RDRW32_COP0(compare, MIPS_COP_0_COMPARE); MIPS_RDRW32_COP0(config, MIPS_COP_0_CONFIG); -MIPS_RDRW32_COP0_SEL(config, MIPS_COP_0_CONFIG, 1); -MIPS_RDRW32_COP0_SEL(config, MIPS_COP_0_CONFIG, 2); -MIPS_RDRW32_COP0_SEL(config, MIPS_COP_0_CONFIG, 3); +MIPS_RDRW32_COP0_SEL(config1, MIPS_COP_0_CONFIG, 1); +MIPS_RDRW32_COP0_SEL(config2, MIPS_COP_0_CONFIG, 2); +MIPS_RDRW32_COP0_SEL(config3, MIPS_COP_0_CONFIG, 3); MIPS_RDRW32_COP0(count, MIPS_COP_0_COUNT); MIPS_RDRW32_COP0(index, MIPS_COP_0_TLB_INDEX); MIPS_RDRW32_COP0(wired, MIPS_COP_0_TLB_WIRED); @@ -219,20 +219,20 @@ MIPS_RDRW32_COP0(pagemask, MIPS_COP_0_TL #endif MIPS_RDRW32_COP0(prid, MIPS_COP_0_PRID); /* XXX 64-bit? */ -MIPS_RDRW32_COP0_SEL(prid, MIPS_COP_0_PRID, 1); +MIPS_RDRW32_COP0_SEL(ebase, MIPS_COP_0_PRID, 1); MIPS_RDRW32_COP0(watchlo, MIPS_COP_0_WATCH_LO); -MIPS_RDRW32_COP0_SEL(watchlo, MIPS_COP_0_WATCH_LO, 1); -MIPS_RDRW32_COP0_SEL(watchlo, MIPS_COP_0_WATCH_LO, 2); -MIPS_RDRW32_COP0_SEL(watchlo, MIPS_COP_0_WATCH_LO, 3); +MIPS_RDRW32_COP0_SEL(watchlo1, MIPS_COP_0_WATCH_LO, 1); +MIPS_RDRW32_COP0_SEL(watchlo2, MIPS_COP_0_WATCH_LO, 2); +MIPS_RDRW32_COP0_SEL(watchlo3, MIPS_COP_0_WATCH_LO, 3); MIPS_RDRW32_COP0(watchhi, MIPS_COP_0_WATCH_HI); -MIPS_RDRW32_COP0_SEL(watchhi, MIPS_COP_0_WATCH_HI, 1); -MIPS_RDRW32_COP0_SEL(watchhi, MIPS_COP_0_WATCH_HI, 2); -MIPS_RDRW32_COP0_SEL(watchhi, MIPS_COP_0_WATCH_HI, 3); - -MIPS_RDRW32_COP0_SEL(perfcnt, MIPS_COP_0_PERFCNT, 0); -MIPS_RDRW32_COP0_SEL(perfcnt, MIPS_COP_0_PERFCNT, 1); -MIPS_RDRW32_COP0_SEL(perfcnt, MIPS_COP_0_PERFCNT, 2); -MIPS_RDRW32_COP0_SEL(perfcnt, MIPS_COP_0_PERFCNT, 3); +MIPS_RDRW32_COP0_SEL(watchhi1, MIPS_COP_0_WATCH_HI, 1); +MIPS_RDRW32_COP0_SEL(watchhi2, MIPS_COP_0_WATCH_HI, 2); +MIPS_RDRW32_COP0_SEL(watchhi3, MIPS_COP_0_WATCH_HI, 3); + +MIPS_RDRW32_COP0_SEL(perfcnt0, MIPS_COP_0_PERFCNT, 0); +MIPS_RDRW32_COP0_SEL(perfcnt1, MIPS_COP_0_PERFCNT, 1); +MIPS_RDRW32_COP0_SEL(perfcnt2, MIPS_COP_0_PERFCNT, 2); +MIPS_RDRW32_COP0_SEL(perfcnt3, MIPS_COP_0_PERFCNT, 3); #undef MIPS_RDRW32_COP0 Modified: head/sys/mips/include/cpuregs.h ============================================================================== --- head/sys/mips/include/cpuregs.h Mon Apr 19 04:54:34 2010 (r206828) +++ head/sys/mips/include/cpuregs.h Mon Apr 19 06:01:58 2010 (r206829) @@ -78,21 +78,36 @@ * Caching of mapped addresses is controlled by bits in the TLB entry. */ -#define MIPS_KUSEG_START 0x0 -#define MIPS_KSEG0_START 0x80000000 -#define MIPS_KSEG0_END 0x9fffffff -#define MIPS_KSEG1_START 0xa0000000 -#define MIPS_KSEG1_END 0xbfffffff -#define MIPS_KSSEG_START 0xc0000000 -#define MIPS_KSSEG_END 0xdfffffff +#if !defined(_LOCORE) +#define MIPS_KUSEG_START 0x00000000 +#define MIPS_KSEG0_START ((intptr_t)(int32_t)0x80000000) +#define MIPS_KSEG0_END ((intptr_t)(int32_t)0x9fffffff) +#define MIPS_KSEG1_START ((intptr_t)(int32_t)0xa0000000) +#define MIPS_KSEG1_END ((intptr_t)(int32_t)0xbfffffff) +#define MIPS_KSSEG_START ((intptr_t)(int32_t)0xc0000000) +#define MIPS_KSSEG_END ((intptr_t)(int32_t)0xdfffffff) +#define MIPS_KSEG3_START ((intptr_t)(int32_t)0xe0000000) +#define MIPS_KSEG3_END ((intptr_t)(int32_t)0xffffffff) + #define MIPS_KSEG2_START MIPS_KSSEG_START #define MIPS_KSEG2_END MIPS_KSSEG_END -#define MIPS_KSEG3_START 0xe0000000 -#define MIPS_KSEG3_END 0xffffffff +#endif + +#define MIPS_XKPHYS_START 0x8000000000000000 +#define MIPS_XKPHYS_END 0xbfffffffffffffff + +#define MIPS_XKPHYS_CCA_UC 0x02 /* Uncached. */ +#define MIPS_XKPHYS_CCA_CNC 0x03 /* Cacheable non-coherent. */ #define MIPS_PHYS_TO_XKPHYS(cca,x) \ ((0x2ULL << 62) | ((unsigned long long)(cca) << 59) | (x)) -#define MIPS_XKPHYS_TO_PHYS(x) ((x) & 0x0effffffffffffffULL) +#define MIPS_XKPHYS_TO_PHYS(x) ((x) & 0x07ffffffffffffffULL) + +#define MIPS_XUSEG_START 0x0000000000000000 +#define MIPS_XUSEG_END 0x0000010000000000 + +#define MIPS_XKSEG_START 0xc000000000000000 +#define MIPS_XKSEG_END 0xc00000ff80000000 /* CPU dependent mtc0 hazard hook */ #ifdef TARGET_OCTEON @@ -471,7 +486,6 @@ * (3=32bit, 6=64bit, i=impl dep) * 0 MIPS_COP_0_TLB_INDEX 3333 TLB Index. * 1 MIPS_COP_0_TLB_RANDOM 3333 TLB Random. - * 2 MIPS_COP_0_TLB_LOW 3... r3k TLB entry low. * 2 MIPS_COP_0_TLB_LO0 .636 r4k TLB entry low. * 3 MIPS_COP_0_TLB_LO1 .636 r4k TLB entry low, extended. * 4 MIPS_COP_0_TLB_CONTEXT 3636 TLB Context. @@ -531,10 +545,6 @@ #define MIPS_COP_0_EXC_PC _(14) #define MIPS_COP_0_PRID _(15) - -/* MIPS-I */ -#define MIPS_COP_0_TLB_LOW _(2) - /* MIPS-III */ #define MIPS_COP_0_TLB_LO0 _(2) #define MIPS_COP_0_TLB_LO1 _(3) Modified: head/sys/mips/mips/genassym.c ============================================================================== --- head/sys/mips/mips/genassym.c Mon Apr 19 04:54:34 2010 (r206828) +++ head/sys/mips/mips/genassym.c Mon Apr 19 06:01:58 2010 (r206829) @@ -54,6 +54,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -91,9 +92,14 @@ ASSYM(SIGF_UC, offsetof(struct sigframe, ASSYM(SIGFPE, SIGFPE); ASSYM(PAGE_SHIFT, PAGE_SHIFT); ASSYM(PAGE_SIZE, PAGE_SIZE); +ASSYM(PAGE_MASK, PAGE_MASK); ASSYM(SEGSHIFT, SEGSHIFT); ASSYM(NPTEPG, NPTEPG); ASSYM(TDF_NEEDRESCHED, TDF_NEEDRESCHED); ASSYM(TDF_ASTPENDING, TDF_ASTPENDING); ASSYM(PCPU_SIZE, sizeof(struct pcpu)); ASSYM(MAXCOMLEN, MAXCOMLEN); + +ASSYM(MIPS_KSEG0_START, MIPS_KSEG0_START); +ASSYM(MIPS_KSEG1_START, MIPS_KSEG1_START); +ASSYM(MIPS_KSEG2_START, MIPS_KSEG2_START); From owner-svn-src-head@FreeBSD.ORG Mon Apr 19 07:34:26 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CE3E91065674; Mon, 19 Apr 2010 07:34:26 +0000 (UTC) (envelope-from jmallett@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id BA1B08FC08; Mon, 19 Apr 2010 07:34:26 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o3J7YQHd033618; Mon, 19 Apr 2010 07:34:26 GMT (envelope-from jmallett@svn.freebsd.org) Received: (from jmallett@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o3J7YQ37033610; Mon, 19 Apr 2010 07:34:26 GMT (envelope-from jmallett@svn.freebsd.org) Message-Id: <201004190734.o3J7YQ37033610@svn.freebsd.org> From: Juli Mallett Date: Mon, 19 Apr 2010 07:34:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r206834 - in head/sys/mips: include mips X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Apr 2010 07:34:26 -0000 Author: jmallett Date: Mon Apr 19 07:34:26 2010 New Revision: 206834 URL: http://svn.freebsd.org/changeset/base/206834 Log: o) Eliminate the "stand" frame and its use. Use CALLFRAME_* everywhere. o) Use macros for register-width, etc., rather than doing it by hand in a few more assembly files. o) Reduce diffs between various bits of TLB refill code in exception.S and between interrupt processing code. o) Use PTR_* to operate on registers that are pointers (e.g. sp). o) Add and use a macro, CLEAR_PTE_SWBITS rather than using the mysteriously-named WIRED_SHIFT to select bits to truncate when loading PTEs. o) Don't doubly disable interrupts by moving zero to the status register, especially since that has the nasty side-effect of taking us out of 64-bit mode. o) Use CLEAR_STATUS to disable interrupts the first time. o) Keep SR_PX set as well as SR_[KSU]X when doing exception processing. This is the bit that determines whether 64-bit operations are allowed. o) Don't enable interrupts until configure_final(), like most other ports. Modified: head/sys/mips/include/regnum.h head/sys/mips/mips/autoconf.c head/sys/mips/mips/exception.S head/sys/mips/mips/fp.S head/sys/mips/mips/machdep.c head/sys/mips/mips/swtch.S head/sys/mips/mips/vm_machdep.c Modified: head/sys/mips/include/regnum.h ============================================================================== --- head/sys/mips/include/regnum.h Mon Apr 19 07:16:01 2010 (r206833) +++ head/sys/mips/include/regnum.h Mon Apr 19 07:34:26 2010 (r206834) @@ -42,10 +42,6 @@ #ifndef _MACHINE_REGNUM_H_ #define _MACHINE_REGNUM_H_ -#define STAND_ARG_SIZE 16 -#define STAND_FRAME_SIZE 24 -#define STAND_RA_OFFSET 20 - /* This must match the numbers * in pcb.h and is used by * swtch.S Modified: head/sys/mips/mips/autoconf.c ============================================================================== --- head/sys/mips/mips/autoconf.c Mon Apr 19 07:16:01 2010 (r206833) +++ head/sys/mips/mips/autoconf.c Mon Apr 19 07:34:26 2010 (r206834) @@ -102,6 +102,7 @@ static void configure_final(dummy) void *dummy; { + intr_enable(); cninit_finish(); Modified: head/sys/mips/mips/exception.S ============================================================================== --- head/sys/mips/mips/exception.S Mon Apr 19 07:16:01 2010 (r206833) +++ head/sys/mips/mips/exception.S Mon Apr 19 07:34:26 2010 (r206834) @@ -66,37 +66,14 @@ #include "assym.s" -#if defined(ISA_MIPS32) -#undef WITH_64BIT_CP0 -#elif defined(ISA_MIPS64) -#define WITH_64BIT_CP0 -#elif defined(ISA_MIPS3) -#define WITH_64BIT_CP0 -#else -#error "Please write the code for this ISA" -#endif +/* + * Clear the software-managed bits in a PTE in register pr. + */ +#define CLEAR_PTE_SWBITS(pr) \ + sll pr, 2 ; \ + srl pr, 2 # keep bottom 30 bits -#ifdef WITH_64BIT_CP0 -#define _SLL dsll -#define _SRL dsrl -#define _MFC0 dmfc0 -#define _MTC0 dmtc0 -#define WIRED_SHIFT 34 -#else -#define _SLL sll -#define _SRL srl -#define _MFC0 mfc0 -#define _MTC0 mtc0 -#define WIRED_SHIFT 2 -#endif .set noreorder # Noreorder is default style! -#if defined(ISA_MIPS32) - .set mips32 -#elif defined(ISA_MIPS64) - .set mips64 -#elif defined(ISA_MIPS3) - .set mips3 -#endif /* * Reasonable limit @@ -125,12 +102,12 @@ * * */ - - .set noat VECTOR(MipsTLBMiss, unknown) - j _C_LABEL(MipsDoTLBMiss) - mfc0 k0, COP_0_BAD_VADDR # get the fault address - nop + .set push + .set noat + j MipsDoTLBMiss + MFC0 k0, COP_0_BAD_VADDR # get the fault address + .set pop VECTOR_END(MipsTLBMiss) /* @@ -145,42 +122,40 @@ VECTOR_END(MipsTLBMiss) * let the processor trap to load the correct value after service. *---------------------------------------------------------------------------- */ + .set push + .set noat MipsDoTLBMiss: - #k0 already has BadVA - bltz k0, 1f #02: k0<0 -> 1f (kernel fault) - srl k0, k0, SEGSHIFT - 2 #03: k0=seg offset (almost) - GET_CPU_PCPU(k1) - lw k1, PC_SEGBASE(k1) - beqz k1, 2f #05: make sure segbase is not null - andi k0, k0, 0x7fc #06: k0=seg offset (mask 0x3) -#xxx mips64 unsafe? - addu k1, k0, k1 #07: k1=seg entry address - lw k1, 0(k1) #08: k1=seg entry - mfc0 k0, COP_0_BAD_VADDR #09: k0=bad address (again) - beq k1, zero, 2f #0a: ==0 -- no page table - srl k0, PAGE_SHIFT - 2 #0b: k0=VPN (aka va>>10) + bltz k0, 1f #02: k0<0 -> 1f (kernel fault) + PTR_SRL k0, k0, SEGSHIFT - 2 #03: k0=seg offset (almost) - andi k0, k0, ((NPTEPG/2) - 1) << 3 #0c: k0=page tab offset -#xxx mips64 unsafe? - addu k1, k1, k0 #0d: k1=pte address - lw k0, 0(k1) #0e: k0=lo0 pte - lw k1, 4(k1) #0f: k1=lo1 pte - _SLL k0, k0, WIRED_SHIFT #10: keep bottom 30 bits - _SRL k0, k0, WIRED_SHIFT #11: keep bottom 30 bits - _MTC0 k0, COP_0_TLB_LO0 #12: lo0 is loaded - _SLL k1, k1, WIRED_SHIFT #13: keep bottom 30 bits - _SRL k1, k1, WIRED_SHIFT #14: keep bottom 30 bits - _MTC0 k1, COP_0_TLB_LO1 #15: lo1 is loaded - HAZARD_DELAY - tlbwr #1a: write to tlb + GET_CPU_PCPU(k1) + PTR_L k1, PC_SEGBASE(k1) + beqz k1, 2f #05: make sure segbase is not null + andi k0, k0, 0xffc #06: k0=seg offset (mask 0x3) + PTR_ADDU k1, k0, k1 #07: k1=seg entry address + + PTR_L k1, 0(k1) #08: k1=seg entry + MFC0 k0, COP_0_BAD_VADDR #09: k0=bad address (again) + beq k1, zero, 2f #0a: ==0 -- no page table + srl k0, PAGE_SHIFT - 2 #0b: k0=VPN (aka va>>10) + andi k0, k0, 0xff8 #0c: k0=page tab offset + PTR_ADDU k1, k1, k0 #0d: k1=pte address + lw k0, 0(k1) #0e: k0=lo0 pte + lw k1, 4(k1) #0f: k1=lo0 pte + CLEAR_PTE_SWBITS(k0) + MTC0 k0, COP_0_TLB_LO0 #12: lo0 is loaded + COP0_SYNC + CLEAR_PTE_SWBITS(k1) + MTC0 k1, COP_0_TLB_LO1 #15: lo1 is loaded + COP0_SYNC + tlbwr #1a: write to tlb HAZARD_DELAY - eret #1f: retUrn from exception -1: j _C_LABEL(MipsTLBMissException) #20: kernel exception - nop #21: branch delay slot -2: j SlowFault #22: no page table present - nop #23: branch delay slot - - .set at + eret #1f: retUrn from exception +1: j MipsTLBMissException #20: kernel exception + nop #21: branch delay slot +2: j SlowFault #22: no page table present + nop #23: branch delay slot + .set pop /* * This code is copied to the general exception vector address to @@ -207,7 +182,7 @@ VECTOR(MipsException, unknown) # the cause is already # shifted left by 2 bits so # we dont have to shift. - lw k0, 0(k0) # Get the function address + PTR_L k0, 0(k0) # Get the function address nop j k0 # Jump to the function. nop @@ -244,20 +219,9 @@ SlowFault: * *---------------------------------------------------------------------------- */ -#if defined(ISA_MIPS32) -#define STORE sw /* 32 bit mode regsave instruction */ -#define LOAD lw /* 32 bit mode regload instruction */ -#define RSIZE 4 /* 32 bit mode register size */ -#elif defined(ISA_MIPS64) -#define STORE sd /* 64 bit mode regsave instruction */ -#define LOAD ld /* 64 bit mode regload instruction */ -#define RSIZE 8 /* 64 bit mode register size */ -#else -#error "Please write code for this isa." -#endif #define SAVE_REG(reg, offs, base) \ - STORE reg, STAND_ARG_SIZE + (RSIZE * offs) (base) + REG_S reg, CALLFRAME_SIZ + (SZREG * offs) (base) #ifdef TARGET_OCTEON #define CLEAR_STATUS \ @@ -274,7 +238,7 @@ SlowFault: and a0, a0, a2 ; \ mtc0 a0, COP_0_STATUS_REG #endif - + /* * Save CPU and CP0 register state. * @@ -317,8 +281,8 @@ SlowFault: mfhi v1 ;\ mfc0 a0, COP_0_STATUS_REG ;\ mfc0 a1, COP_0_CAUSE_REG ;\ - mfc0 a2, COP_0_BAD_VADDR ;\ - mfc0 a3, COP_0_EXC_PC ;\ + MFC0 a2, COP_0_BAD_VADDR ;\ + MFC0 a3, COP_0_EXC_PC ;\ SAVE_REG(v0, MULLO, sp) ;\ SAVE_REG(v1, MULHI, sp) ;\ SAVE_REG(a0, SR, sp) ;\ @@ -332,20 +296,20 @@ SlowFault: PTR_ADDU v0, sp, KERN_EXC_FRAME_SIZE ;\ SAVE_REG(v0, SP, sp) ;\ CLEAR_STATUS ;\ - PTR_ADDU a0, sp, STAND_ARG_SIZE ;\ + PTR_ADDU a0, sp, CALLFRAME_SIZ ;\ ITLBNOPFIX #define RESTORE_REG(reg, offs, base) \ - LOAD reg, STAND_ARG_SIZE + (RSIZE * offs) (base) + REG_L reg, CALLFRAME_SIZ + (SZREG * offs) (base) #define RESTORE_CPU \ - mtc0 zero,COP_0_STATUS_REG ;\ + CLEAR_STATUS ;\ RESTORE_REG(k0, SR, sp) ;\ RESTORE_REG(t0, MULLO, sp) ;\ RESTORE_REG(t1, MULHI, sp) ;\ mtlo t0 ;\ mthi t1 ;\ - _MTC0 v0, COP_0_EXC_PC ;\ + MTC0 v0, COP_0_EXC_PC ;\ .set noat ;\ RESTORE_REG(AT, AST, sp) ;\ RESTORE_REG(v0, V0, sp) ;\ @@ -384,13 +348,13 @@ SlowFault: * the status register and the multiply lo and high registers. * In addition, we set this up for linkage conventions. */ -#define KERN_REG_SIZE (NUMSAVEREGS * RSIZE) -#define KERN_EXC_FRAME_SIZE (STAND_FRAME_SIZE + KERN_REG_SIZE + 16) +#define KERN_REG_SIZE (NUMSAVEREGS * SZREG) +#define KERN_EXC_FRAME_SIZE (CALLFRAME_SIZ + KERN_REG_SIZE + 16) NNON_LEAF(MipsKernGenException, KERN_EXC_FRAME_SIZE, ra) .set noat - subu sp, sp, KERN_EXC_FRAME_SIZE - .mask 0x80000000, (STAND_RA_OFFSET - KERN_EXC_FRAME_SIZE) + PTR_SUBU sp, sp, KERN_EXC_FRAME_SIZE + .mask 0x80000000, (CALLFRAME_RA - KERN_EXC_FRAME_SIZE) /* * Save CPU state, building 'frame'. */ @@ -401,7 +365,7 @@ NNON_LEAF(MipsKernGenException, KERN_EXC PTR_LA gp, _C_LABEL(_gp) PTR_LA k0, _C_LABEL(trap) jalr k0 - sw a3, STAND_RA_OFFSET + KERN_REG_SIZE(sp) # for debugging + REG_S a3, CALLFRAME_RA + KERN_REG_SIZE(sp) # for debugging /* * Update interrupt mask in saved status register @@ -410,7 +374,6 @@ NNON_LEAF(MipsKernGenException, KERN_EXC * in trap handler */ mfc0 a0, COP_0_STATUS_REG - mtc0 zero, COP_0_STATUS_REG and a0, a0, SR_INT_MASK RESTORE_REG(a1, SR, sp) and a1, a1, ~SR_INT_MASK @@ -424,10 +387,10 @@ END(MipsKernGenException) #define SAVE_U_PCB_REG(reg, offs, base) \ - STORE reg, U_PCB_REGS + (RSIZE * offs) (base) + REG_S reg, U_PCB_REGS + (SZREG * offs) (base) #define RESTORE_U_PCB_REG(reg, offs, base) \ - LOAD reg, U_PCB_REGS + (RSIZE * offs) (base) + REG_L reg, U_PCB_REGS + (SZREG * offs) (base) /*---------------------------------------------------------------------------- * @@ -443,14 +406,14 @@ END(MipsKernGenException) * *---------------------------------------------------------------------------- */ -NNON_LEAF(MipsUserGenException, STAND_FRAME_SIZE, ra) +NNON_LEAF(MipsUserGenException, CALLFRAME_SIZ, ra) .set noat - .mask 0x80000000, (STAND_RA_OFFSET - STAND_FRAME_SIZE) + .mask 0x80000000, (CALLFRAME_RA - CALLFRAME_SIZ) /* * Save all of the registers except for the kernel temporaries in u.u_pcb. */ GET_CPU_PCPU(k1) - lw k1, PC_CURPCB(k1) + PTR_L k1, PC_CURPCB(k1) SAVE_U_PCB_REG(AT, AST, k1) .set at SAVE_U_PCB_REG(v0, V0, k1) @@ -476,17 +439,17 @@ NNON_LEAF(MipsUserGenException, STAND_FR SAVE_U_PCB_REG(s2, S2, k1) SAVE_U_PCB_REG(s3, S3, k1) SAVE_U_PCB_REG(s4, S4, k1) - mfc0 a2, COP_0_BAD_VADDR # Third arg is the fault addr + MFC0 a2, COP_0_BAD_VADDR # Third arg is the fault addr SAVE_U_PCB_REG(s5, S5, k1) SAVE_U_PCB_REG(s6, S6, k1) SAVE_U_PCB_REG(s7, S7, k1) SAVE_U_PCB_REG(t8, T8, k1) - mfc0 a3, COP_0_EXC_PC # Fourth arg is the pc. + MFC0 a3, COP_0_EXC_PC # Fourth arg is the pc. SAVE_U_PCB_REG(t9, T9, k1) SAVE_U_PCB_REG(gp, GP, k1) SAVE_U_PCB_REG(sp, SP, k1) SAVE_U_PCB_REG(s8, S8, k1) - subu sp, k1, STAND_FRAME_SIZE # switch to kernel SP + PTR_SUBU sp, k1, CALLFRAME_SIZ # switch to kernel SP SAVE_U_PCB_REG(ra, RA, k1) SAVE_U_PCB_REG(v0, MULLO, k1) SAVE_U_PCB_REG(v1, MULHI, k1) @@ -494,12 +457,12 @@ NNON_LEAF(MipsUserGenException, STAND_FR SAVE_U_PCB_REG(a1, CAUSE, k1) SAVE_U_PCB_REG(a2, BADVADDR, k1) SAVE_U_PCB_REG(a3, PC, k1) - sw a3, STAND_RA_OFFSET(sp) # for debugging + REG_S a3, CALLFRAME_RA(sp) # for debugging PTR_LA gp, _C_LABEL(_gp) # switch to kernel GP # Turn off fpu and enter kernel mode and t0, a0, ~(SR_COP_1_BIT | SR_EXL | SR_KSU_MASK | SR_INT_ENAB) #ifdef TARGET_OCTEON - or t0, t0, (MIPS_SR_KX | MIPS_SR_SX | MIPS_SR_UX) + or t0, t0, (MIPS_SR_KX | MIPS_SR_SX | MIPS_SR_UX | MIPS32_SR_PX) #endif mtc0 t0, COP_0_STATUS_REG PTR_ADDU a0, k1, U_PCB_REGS @@ -518,10 +481,7 @@ NNON_LEAF(MipsUserGenException, STAND_FR */ DO_AST - mfc0 t0, COP_0_STATUS_REG # disable int - and t0, t0, ~(MIPS_SR_INT_IE) - mtc0 t0, COP_0_STATUS_REG - ITLBNOPFIX + CLEAR_STATUS /* * The use of k1 for storing the PCB pointer must be done only @@ -529,7 +489,7 @@ NNON_LEAF(MipsUserGenException, STAND_FR * by the interrupt code. */ GET_CPU_PCPU(k1) - lw k1, PC_CURPCB(k1) + PTR_L k1, PC_CURPCB(k1) /* * Update interrupt mask in saved status register @@ -549,7 +509,7 @@ NNON_LEAF(MipsUserGenException, STAND_FR mthi t1 RESTORE_U_PCB_REG(a0, PC, k1) RESTORE_U_PCB_REG(v0, V0, k1) - _MTC0 a0, COP_0_EXC_PC # set return address + MTC0 a0, COP_0_EXC_PC # set return address RESTORE_U_PCB_REG(v1, V1, k1) RESTORE_U_PCB_REG(a0, A0, k1) RESTORE_U_PCB_REG(a1, A1, k1) @@ -578,9 +538,6 @@ NNON_LEAF(MipsUserGenException, STAND_FR RESTORE_U_PCB_REG(k0, SR, k1) RESTORE_U_PCB_REG(s8, S8, k1) RESTORE_U_PCB_REG(ra, RA, k1) -#ifdef TARGET_OCTEON - and k0, k0, ~(MIPS_SR_KX | MIPS_SR_SX | MIPS_SR_UX) -#endif .set noat RESTORE_U_PCB_REG(AT, AST, k1) @@ -610,27 +567,25 @@ END(MipsUserGenException) NNON_LEAF(MipsKernIntr, KERN_EXC_FRAME_SIZE, ra) .set noat - subu sp, sp, KERN_EXC_FRAME_SIZE - .mask 0x80000000, (STAND_RA_OFFSET - KERN_EXC_FRAME_SIZE) + PTR_SUBU sp, sp, KERN_EXC_FRAME_SIZE + .mask 0x80000000, (CALLFRAME_RA - KERN_EXC_FRAME_SIZE) /* - * Save the relevant kernel registers onto the stack. + * Save CPU state, building 'frame'. */ SAVE_CPU - /* - * Call the interrupt handler. + * Call the interrupt handler. a0 points at the saved frame. */ PTR_LA gp, _C_LABEL(_gp) - PTR_ADDU a0, sp, STAND_ARG_SIZE PTR_LA k0, _C_LABEL(cpu_intr) jalr k0 - sw a3, STAND_RA_OFFSET + KERN_REG_SIZE(sp) - /* Why no AST processing here? */ + REG_S a3, CALLFRAME_RA + KERN_REG_SIZE(sp) # for debugging /* * Update interrupt mask in saved status register * Some of interrupts could be disabled by - * intr filters + * intr filters if interrupts are enabled later + * in trap handler */ mfc0 a0, COP_0_STATUS_REG and a0, a0, SR_INT_MASK @@ -638,12 +593,8 @@ NNON_LEAF(MipsKernIntr, KERN_EXC_FRAME_S and a1, a1, ~SR_INT_MASK or a1, a1, a0 SAVE_REG(a1, SR, sp) - -/* - * Restore registers and return from the interrupt. - */ - lw v0, STAND_RA_OFFSET + KERN_REG_SIZE(sp) - RESTORE_CPU + REG_L v0, CALLFRAME_RA + KERN_REG_SIZE(sp) + RESTORE_CPU # v0 contains the return address. sync eret .set at @@ -668,15 +619,15 @@ END(MipsKernIntr) * *---------------------------------------------------------------------------- */ -NNON_LEAF(MipsUserIntr, STAND_FRAME_SIZE, ra) +NNON_LEAF(MipsUserIntr, CALLFRAME_SIZ, ra) .set noat - .mask 0x80000000, (STAND_RA_OFFSET - STAND_FRAME_SIZE) + .mask 0x80000000, (CALLFRAME_RA - CALLFRAME_SIZ) /* * Save the relevant user registers into the u.u_pcb struct. * We don't need to save s0 - s8 because the compiler does it for us. */ GET_CPU_PCPU(k1) - lw k1, PC_CURPCB(k1) + PTR_L k1, PC_CURPCB(k1) SAVE_U_PCB_REG(AT, AST, k1) .set at SAVE_U_PCB_REG(v0, V0, k1) @@ -715,19 +666,19 @@ NNON_LEAF(MipsUserIntr, STAND_FRAME_SIZE mfhi v1 mfc0 a0, COP_0_STATUS_REG mfc0 a1, COP_0_CAUSE_REG - mfc0 a3, COP_0_EXC_PC + MFC0 a3, COP_0_EXC_PC SAVE_U_PCB_REG(v0, MULLO, k1) SAVE_U_PCB_REG(v1, MULHI, k1) SAVE_U_PCB_REG(a0, SR, k1) SAVE_U_PCB_REG(a1, CAUSE, k1) SAVE_U_PCB_REG(a3, PC, k1) # PC in a3, note used later! - subu sp, k1, STAND_FRAME_SIZE # switch to kernel SP + PTR_SUBU sp, k1, CALLFRAME_SIZ # switch to kernel SP PTR_LA gp, _C_LABEL(_gp) # switch to kernel GP # Turn off fpu, disable interrupts, set kernel mode kernel mode, clear exception level. and t0, a0, ~(SR_COP_1_BIT | SR_EXL | SR_INT_ENAB | SR_KSU_MASK) #ifdef TARGET_OCTEON - or t0, t0, (MIPS_SR_KX | MIPS_SR_SX | MIPS_SR_UX) + or t0, t0, (MIPS_SR_KX | MIPS_SR_SX | MIPS_SR_UX | MIPS32_SR_PX) #endif mtc0 t0, COP_0_STATUS_REG ITLBNOPFIX @@ -737,7 +688,7 @@ NNON_LEAF(MipsUserIntr, STAND_FRAME_SIZE */ PTR_LA k0, _C_LABEL(cpu_intr) jalr k0 - sw a3, STAND_RA_OFFSET(sp) # for debugging + REG_S a3, CALLFRAME_RA(sp) # for debugging /* * Enable interrupts before doing ast(). @@ -759,13 +710,10 @@ NNON_LEAF(MipsUserIntr, STAND_FRAME_SIZE /* * Restore user registers and return. */ - mfc0 t0, COP_0_STATUS_REG # disable int - and t0, t0, ~(MIPS_SR_INT_IE) - mtc0 t0, COP_0_STATUS_REG - ITLBNOPFIX + CLEAR_STATUS GET_CPU_PCPU(k1) - lw k1, PC_CURPCB(k1) + PTR_L k1, PC_CURPCB(k1) /* * Update interrupt mask in saved status register @@ -793,7 +741,7 @@ NNON_LEAF(MipsUserIntr, STAND_FRAME_SIZE RESTORE_U_PCB_REG(t2, PC, k1) mtlo t0 mthi t1 - _MTC0 t2, COP_0_EXC_PC # set return address + MTC0 t2, COP_0_EXC_PC # set return address RESTORE_U_PCB_REG(v0, V0, k1) RESTORE_U_PCB_REG(v1, V1, k1) RESTORE_U_PCB_REG(a0, A0, k1) @@ -814,9 +762,6 @@ NNON_LEAF(MipsUserIntr, STAND_FRAME_SIZE RESTORE_U_PCB_REG(k0, SR, k1) RESTORE_U_PCB_REG(sp, SP, k1) RESTORE_U_PCB_REG(ra, RA, k1) -#ifdef TARGET_OCTEON - and k0, k0, ~(MIPS_SR_KX | MIPS_SR_SX | MIPS_SR_UX) -#endif .set noat RESTORE_U_PCB_REG(AT, AST, k1) @@ -832,78 +777,78 @@ NLEAF(MipsTLBInvalidException) .set noat .set noreorder - mfc0 k0, COP_0_BAD_VADDR - li k1, VM_MAXUSER_ADDRESS - sltu k1, k0, k1 - bnez k1, 1f + MFC0 k0, COP_0_BAD_VADDR + PTR_LI k1, VM_MAXUSER_ADDRESS + sltu k1, k0, k1 + bnez k1, 1f nop - /* badvaddr = kernel address */ - lui k1, %hi(_C_LABEL(kernel_segmap)) - b 2f - lw k1, %lo(_C_LABEL(kernel_segmap))(k1) + /* Kernel address. */ + lui k1, %hi(kernel_segmap) # k1=hi of segbase + b 2f + PTR_L k1, %lo(kernel_segmap)(k1) # k1=segment tab base -1: - /* badvaddr = user address */ +1: /* User address. */ GET_CPU_PCPU(k1) - lw k1, PC_SEGBASE(k1) + PTR_L k1, PC_SEGBASE(k1) -2: - beqz k1, 3f /* invalid page directory pointer */ +2: /* Validate page directory pointer. */ + beqz k1, 3f nop - srl k0, SEGSHIFT - 2 - andi k0, 0xffc - addu k1, k1, k0 - lw k1, 0(k1) - beqz k1, 3f /* invalid page table page pointer */ + PTR_SRL k0, SEGSHIFT - 2 # k0=seg offset (almost) + beq k1, zero, MipsKernGenException # ==0 -- no seg tab + andi k0, k0, 0xffc # k0=seg offset (mask 0x3) + PTR_ADDU k1, k0, k1 # k1=seg entry address + PTR_L k1, 0(k1) # k1=seg entry + + /* Validate page table pointer. */ + beqz k1, 3f nop - mfc0 k0, COP_0_BAD_VADDR - srl k0, PAGE_SHIFT - 2 - andi k0, 0xffc - addu k1, k1, k0 + MFC0 k0, COP_0_BAD_VADDR # k0=bad address (again) + PTR_SRL k0, PAGE_SHIFT - 2 # k0=VPN + andi k0, k0, 0xffc # k0=page tab offset + PTR_ADDU k1, k1, k0 # k1=pte address + lw k0, 0(k1) # k0=this PTE - lw k0, 0(k1) - andi k0, PTE_V - beqz k0, 3f /* invalid page table entry */ + /* Validate page table entry. */ + andi k0, PTE_V + beqz k0, 3f nop - andi k0, k1, 4 - bnez k0, odd_page + /* Check whether this is an even or odd entry. */ + andi k0, k1, 4 + bnez k0, odd_page nop -even_page: - lw k0, 0(k1) - _SLL k0, k0, WIRED_SHIFT - _SRL k0, k0, WIRED_SHIFT - _MTC0 k0, COP_0_TLB_LO0 - - lw k0, 4(k1) - _SLL k0, k0, WIRED_SHIFT - _SRL k0, k0, WIRED_SHIFT - _MTC0 k0, COP_0_TLB_LO1 + lw k0, 0(k1) + lw k1, 4(k1) + CLEAR_PTE_SWBITS(k0) + MTC0 k0, COP_0_TLB_LO0 + COP0_SYNC + CLEAR_PTE_SWBITS(k1) + MTC0 k1, COP_0_TLB_LO1 + COP0_SYNC - b tlb_insert_entry + b tlb_insert_entry nop odd_page: - lw k0, 0(k1) - _SLL k0, k0, WIRED_SHIFT - _SRL k0, k0, WIRED_SHIFT - _MTC0 k0, COP_0_TLB_LO1 - - lw k0, -4(k1) - _SLL k0, k0, WIRED_SHIFT - _SRL k0, k0, WIRED_SHIFT - _MTC0 k0, COP_0_TLB_LO0 + lw k0, -4(k1) + lw k1, 0(k1) + CLEAR_PTE_SWBITS(k0) + MTC0 k0, COP_0_TLB_LO0 + COP0_SYNC + CLEAR_PTE_SWBITS(k1) + MTC0 k1, COP_0_TLB_LO1 + COP0_SYNC tlb_insert_entry: tlbp HAZARD_DELAY - mfc0 k0, COP_0_TLB_INDEX - HAZARD_DELAY - bltz k0, tlb_insert_random + mfc0 k0, COP_0_TLB_INDEX + bltz k0, tlb_insert_random nop tlbwi eret @@ -927,8 +872,8 @@ tlb_insert_random: * Check for kernel stack overflow. */ GET_CPU_PCPU(k1) - lw k0, PC_CURTHREAD(k1) - lw k0, TD_KSTACK(k0) + PTR_L k0, PC_CURTHREAD(k1) + PTR_L k0, TD_KSTACK(k0) sltu k0, k0, sp bnez k0, _C_LABEL(MipsKernGenException) nop @@ -944,8 +889,8 @@ tlb_insert_random: sll k1, k1, PAGE_SHIFT + 1 PTR_LA k0, _C_LABEL(pcpu_space) - addiu k0, (PAGE_SIZE * 2) - addu k0, k0, k1 + PTR_ADDU k0, PAGE_SIZE * 2 + PTR_ADDU k0, k0, k1 /* * Stash the original value of 'sp' so we can update trapframe later. @@ -954,12 +899,12 @@ tlb_insert_random: move k1, sp move sp, k0 - subu sp, sp, KERN_EXC_FRAME_SIZE + PTR_SUBU sp, sp, KERN_EXC_FRAME_SIZE move k0, ra move ra, zero - sw ra, CALLFRAME_RA(sp) /* stop the ddb backtrace right here */ - sw zero, CALLFRAME_SP(sp) + REG_S ra, CALLFRAME_RA(sp) /* stop the ddb backtrace right here */ + REG_S zero, CALLFRAME_SP(sp) move ra, k0 SAVE_CPU @@ -974,8 +919,8 @@ tlb_insert_random: * Squelch any more overflow checks by setting the stack base to 0. */ GET_CPU_PCPU(k1) - lw k0, PC_CURTHREAD(k1) - sw zero, TD_KSTACK(k0) + PTR_L k0, PC_CURTHREAD(k1) + PTR_S zero, TD_KSTACK(k0) move a1, a0 PANIC("kernel stack overflow - trapframe at %p") @@ -1008,34 +953,30 @@ END(MipsTLBInvalidException) */ NLEAF(MipsTLBMissException) .set noat - mfc0 k0, COP_0_BAD_VADDR # k0=bad address - li k1, (VM_MAX_KERNEL_ADDRESS) # check fault address against - sltu k1, k1, k0 # upper bound of kernel_segmap - bnez k1, _C_LABEL(MipsKernGenException) # out of bound - lui k1, %hi(_C_LABEL(kernel_segmap)) # k1=hi of segbase - srl k0, 20 # k0=seg offset (almost) - lw k1, %lo(_C_LABEL(kernel_segmap))(k1) # k1=segment tab base - beq k1, zero, _C_LABEL(MipsKernGenException) # ==0 -- no seg tab - andi k0, k0, 0xffc # k0=seg offset (mask 0x3) -#xxx mips64 unsafe - addu k1, k0, k1 # k1=seg entry address - lw k1, 0(k1) # k1=seg entry - mfc0 k0, COP_0_BAD_VADDR # k0=bad address (again) - beq k1, zero, _C_LABEL(MipsKernGenException) # ==0 -- no page table - srl k0, 10 # k0=VPN (aka va>>10) - andi k0, k0, 0xff8 # k0=page tab offset -#xxx mips64 unsafe - addu k1, k1, k0 # k1=pte address - lw k0, 0(k1) # k0=lo0 pte - lw k1, 4(k1) # k1=lo1 pte - _SLL k0, WIRED_SHIFT # chop bits [31..30] - _SRL k0, WIRED_SHIFT # chop bits [31..30] - _MTC0 k0, COP_0_TLB_LO0 # lo0 is loaded - _SLL k1, WIRED_SHIFT # chop bits [31..30] - _SRL k1, WIRED_SHIFT # chop bits [31..30] - _MTC0 k1, COP_0_TLB_LO1 # lo1 is loaded - - HAZARD_DELAY + MFC0 k0, COP_0_BAD_VADDR # k0=bad address + PTR_LI k1, VM_MAX_KERNEL_ADDRESS # check fault address against + sltu k1, k1, k0 # upper bound of kernel_segmap + bnez k1, MipsKernGenException # out of bound + lui k1, %hi(kernel_segmap) # k1=hi of segbase + PTR_SRL k0, SEGSHIFT - 2 # k0=seg offset (almost) + PTR_L k1, %lo(kernel_segmap)(k1) # k1=segment tab base + beq k1, zero, MipsKernGenException # ==0 -- no seg tab + andi k0, k0, 0xffc # k0=seg offset (mask 0x3) + PTR_ADDU k1, k0, k1 # k1=seg entry address + PTR_L k1, 0(k1) # k1=seg entry + MFC0 k0, COP_0_BAD_VADDR # k0=bad address (again) + beq k1, zero, MipsKernGenException # ==0 -- no page table + PTR_SRL k0, PAGE_SHIFT - 2 # k0=VPN + andi k0, k0, 0xff8 # k0=page tab offset + PTR_ADDU k1, k1, k0 # k1=pte address + lw k0, 0(k1) # k0=lo0 pte + lw k1, 4(k1) # k1=lo1 pte + CLEAR_PTE_SWBITS(k0) + MTC0 k0, COP_0_TLB_LO0 # lo0 is loaded + COP0_SYNC + CLEAR_PTE_SWBITS(k1) + MTC0 k1, COP_0_TLB_LO1 # lo1 is loaded + COP0_SYNC tlbwr # write to tlb HAZARD_DELAY eret # return from exception @@ -1061,11 +1002,11 @@ END(MipsTLBMissException) * *---------------------------------------------------------------------------- */ -NON_LEAF(MipsFPTrap, STAND_FRAME_SIZE, ra) - subu sp, sp, STAND_FRAME_SIZE +NON_LEAF(MipsFPTrap, CALLFRAME_SIZ, ra) + PTR_SUBU sp, sp, CALLFRAME_SIZ mfc0 t0, COP_0_STATUS_REG - sw ra, STAND_RA_OFFSET(sp) - .mask 0x80000000, (STAND_RA_OFFSET - STAND_FRAME_SIZE) + REG_S ra, CALLFRAME_RA(sp) + .mask 0x80000000, (CALLFRAME_RA - CALLFRAME_SIZ) or t1, t0, SR_COP_1_BIT mtc0 t1, COP_0_STATUS_REG @@ -1086,10 +1027,10 @@ NON_LEAF(MipsFPTrap, STAND_FRAME_SIZE, r * The instruction is in the branch delay slot so the branch will have to * be emulated to get the resulting PC. */ - sw a2, STAND_FRAME_SIZE + 8(sp) + PTR_S a2, CALLFRAME_SIZ + 8(sp) GET_CPU_PCPU(a0) #mips64 unsafe? - lw a0, PC_CURPCB(a0) + PTR_L a0, PC_CURPCB(a0) PTR_ADDU a0, a0, U_PCB_REGS # first arg is ptr to CPU registers move a1, a2 # second arg is instruction PC move a2, t1 # third arg is floating point CSR @@ -1100,7 +1041,7 @@ NON_LEAF(MipsFPTrap, STAND_FRAME_SIZE, r * Now load the floating-point instruction in the branch delay slot * to be emulated. */ - lw a2, STAND_FRAME_SIZE + 8(sp) # restore EXC pc + PTR_L a2, CALLFRAME_SIZ + 8(sp) # restore EXC pc b 2f lw a0, 4(a2) # a0 = coproc instruction /* @@ -1110,10 +1051,10 @@ NON_LEAF(MipsFPTrap, STAND_FRAME_SIZE, r 1: lw a0, 0(a2) # a0 = coproc instruction #xxx mips64 unsafe? - addu v0, a2, 4 # v0 = next pc + PTR_ADDU v0, a2, 4 # v0 = next pc 2: GET_CPU_PCPU(t2) - lw t2, PC_CURPCB(t2) + PTR_L t2, PC_CURPCB(t2) SAVE_U_PCB_REG(v0, PC, t2) # save new pc /* * Check to see if the instruction to be emulated is a floating-point @@ -1127,7 +1068,7 @@ NON_LEAF(MipsFPTrap, STAND_FRAME_SIZE, r */ 3: GET_CPU_PCPU(a0) - lw a0, PC_CURTHREAD(a0) # get current thread + PTR_L a0, PC_CURTHREAD(a0) # get current thread cfc1 a2, FPC_CSR # code = FP execptions ctc1 zero, FPC_CSR # Clear exceptions PTR_LA t3, _C_LABEL(trapsignal) @@ -1149,12 +1090,12 @@ NON_LEAF(MipsFPTrap, STAND_FRAME_SIZE, r */ FPReturn: mfc0 t0, COP_0_STATUS_REG - lw ra, STAND_RA_OFFSET(sp) + PTR_L ra, CALLFRAME_RA(sp) and t0, t0, ~SR_COP_1_BIT mtc0 t0, COP_0_STATUS_REG ITLBNOPFIX j ra - PTR_ADDU sp, sp, STAND_FRAME_SIZE + PTR_ADDU sp, sp, CALLFRAME_SIZ END(MipsFPTrap) /* @@ -1182,7 +1123,7 @@ VECTOR(MipsCache, unknown) PTR_LA k0, _C_LABEL(MipsCacheException) li k1, MIPS_PHYS_MASK and k0, k1 - li k1, MIPS_KSEG1_START + PTR_LI k1, MIPS_KSEG1_START or k0, k1 j k0 nop @@ -1200,16 +1141,16 @@ NESTED_NOPROFILE(MipsCacheException, KER .mask 0x80000000, -4 PTR_LA k0, _C_LABEL(panic) # return to panic PTR_LA a0, 9f # panicstr - _MFC0 a1, COP_0_ERROR_PC + MFC0 a1, COP_0_ERROR_PC mfc0 a2, COP_0_CACHE_ERR # 3rd arg cache error - _MTC0 k0, COP_0_ERROR_PC # set return address + MTC0 k0, COP_0_ERROR_PC # set return address mfc0 k0, COP_0_STATUS_REG # restore status li k1, SR_DIAG_DE # ignore further errors or k0, k1 mtc0 k0, COP_0_STATUS_REG # restore status - HAZARD_DELAY + COP0_SYNC eret Modified: head/sys/mips/mips/fp.S ============================================================================== --- head/sys/mips/mips/fp.S Mon Apr 19 07:16:01 2010 (r206833) +++ head/sys/mips/mips/fp.S Mon Apr 19 07:34:26 2010 (r206834) @@ -94,9 +94,9 @@ * *---------------------------------------------------------------------------- */ -NON_LEAF(MipsEmulateFP, STAND_FRAME_SIZE, ra) - subu sp, sp, STAND_FRAME_SIZE - sw ra, STAND_RA_OFFSET(sp) +NON_LEAF(MipsEmulateFP, CALLFRAME_SIZ, ra) + subu sp, sp, CALLFRAME_SIZ + sw ra, CALLFRAME_RA(sp) /* * Decode the FMT field (bits 24-21) and FUNCTION field (bits 5-0). */ @@ -2247,8 +2247,8 @@ result_fs_d: # result is FS jal set_fd_d # save result (in t0,t1,t2,t3) done: - lw ra, STAND_RA_OFFSET(sp) - addu sp, sp, STAND_FRAME_SIZE + lw ra, CALLFRAME_RA(sp) + addu sp, sp, CALLFRAME_SIZ j ra END(MipsEmulateFP) Modified: head/sys/mips/mips/machdep.c ============================================================================== --- head/sys/mips/mips/machdep.c Mon Apr 19 07:16:01 2010 (r206833) +++ head/sys/mips/mips/machdep.c Mon Apr 19 07:34:26 2010 (r206834) @@ -369,7 +369,6 @@ mips_vector_init(void) * when handler is installed for it */ set_intr_mask(ALL_INT_MASK); - intr_enable(); /* Clear BEV in SR so we start handling our own exceptions */ mips_wr_status(mips_rd_status() & ~SR_BOOT_EXC_VEC); Modified: head/sys/mips/mips/swtch.S ============================================================================== --- head/sys/mips/mips/swtch.S Mon Apr 19 07:16:01 2010 (r206833) +++ head/sys/mips/mips/swtch.S Mon Apr 19 07:34:26 2010 (r206834) @@ -65,53 +65,7 @@ #include "assym.s" -#if defined(ISA_MIPS32) -#undef WITH_64BIT_CP0 -#elif defined(ISA_MIPS64) -#define WITH_64BIT_CP0 -#elif defined(ISA_MIPS3) -#define WITH_64BIT_CP0 -#else -#error "Please write the code for this ISA" -#endif - -#ifdef WITH_64BIT_CP0 -#define _SLL dsll -#define _SRL dsrl -#define _MFC0 dmfc0 -#define _MTC0 dmtc0 -#define WIRED_SHIFT 34 -#else -#define _SLL sll -#define _SRL srl -#define _MFC0 mfc0 -#define _MTC0 mtc0 -#define WIRED_SHIFT 2 -#endif .set noreorder # Noreorder is default style! -#if defined(ISA_MIPS32) - .set mips32 -#elif defined(ISA_MIPS64) - .set mips64 -#elif defined(ISA_MIPS3) - .set mips3 -#endif - -#if defined(ISA_MIPS32) -#define STORE sw /* 32 bit mode regsave instruction */ -#define LOAD lw /* 32 bit mode regload instruction */ -#define RSIZE 4 /* 32 bit mode register size */ -#define STORE_FP swc1 /* 32 bit mode fp regsave instruction */ -#define LOAD_FP lwc1 /* 32 bit mode fp regload instruction */ -#define FP_RSIZE 4 /* 32 bit mode fp register size */ -#else -#define STORE sd /* 64 bit mode regsave instruction */ -#define LOAD ld /* 64 bit mode regload instruction */ -#define RSIZE 8 /* 64 bit mode register size */ -#define STORE_FP sdc1 /* 64 bit mode fp regsave instruction */ -#define LOAD_FP ldc1 /* 64 bit mode fp regload instruction */ -#define FP_RSIZE 8 /* 64 bit mode fp register size */ -#endif /* * FREEBSD_DEVELOPERS_FIXME @@ -125,28 +79,28 @@ #endif #define SAVE_U_PCB_REG(reg, offs, base) \ - STORE reg, U_PCB_REGS + (RSIZE * offs) (base) + REG_S reg, U_PCB_REGS + (SZREG * offs) (base) #define RESTORE_U_PCB_REG(reg, offs, base) \ - LOAD reg, U_PCB_REGS + (RSIZE * offs) (base) + REG_L reg, U_PCB_REGS + (SZREG * offs) (base) #define SAVE_U_PCB_FPREG(reg, offs, base) \ - STORE_FP reg, U_PCB_FPREGS + (FP_RSIZE * offs) (base) + FP_S reg, U_PCB_FPREGS + (SZFPREG * offs) (base) #define RESTORE_U_PCB_FPREG(reg, offs, base) \ - LOAD_FP reg, U_PCB_FPREGS + (FP_RSIZE * offs) (base) + FP_L reg, U_PCB_FPREGS + (SZFPREG * offs) (base) #define SAVE_U_PCB_FPSR(reg, offs, base) \ - STORE reg, U_PCB_FPREGS + (FP_RSIZE * offs) (base) + REG_S reg, U_PCB_FPREGS + (SZFPREG * offs) (base) #define RESTORE_U_PCB_FPSR(reg, offs, base) \ - LOAD reg, U_PCB_FPREGS + (FP_RSIZE * offs) (base) + REG_L reg, U_PCB_FPREGS + (SZFPREG * offs) (base) #define SAVE_U_PCB_CONTEXT(reg, offs, base) \ - STORE reg, U_PCB_CONTEXT + (RSIZE * offs) (base) + REG_S reg, U_PCB_CONTEXT + (SZREG * offs) (base) #define RESTORE_U_PCB_CONTEXT(reg, offs, base) \ - LOAD reg, U_PCB_CONTEXT + (RSIZE * offs) (base) + REG_L reg, U_PCB_CONTEXT + (SZREG * offs) (base) #define ITLBNOPFIX nop;nop;nop;nop;nop;nop;nop;nop;nop;nop; @@ -172,7 +126,7 @@ LEAF(fork_trampoline) */ .set noat GET_CPU_PCPU(k1) - lw k1, PC_CURPCB(k1) + PTR_L k1, PC_CURPCB(k1) RESTORE_U_PCB_REG(t0, MULLO, k1) RESTORE_U_PCB_REG(t1, MULHI, k1) @@ -181,7 +135,7 @@ LEAF(fork_trampoline) RESTORE_U_PCB_REG(a0, PC, k1) RESTORE_U_PCB_REG(AT, AST, k1) RESTORE_U_PCB_REG(v0, V0, k1) - _MTC0 a0, COP_0_EXC_PC # set return address + MTC0 a0, COP_0_EXC_PC # set return address *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@FreeBSD.ORG Mon Apr 19 07:51:57 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id AEBB1106564A; Mon, 19 Apr 2010 07:51:57 +0000 (UTC) (envelope-from jmallett@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 9CA908FC1E; Mon, 19 Apr 2010 07:51:57 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o3J7pv8M037530; Mon, 19 Apr 2010 07:51:57 GMT (envelope-from jmallett@svn.freebsd.org) Received: (from jmallett@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o3J7pvMa037528; Mon, 19 Apr 2010 07:51:57 GMT (envelope-from jmallett@svn.freebsd.org) Message-Id: <201004190751.o3J7pvMa037528@svn.freebsd.org> From: Juli Mallett Date: Mon, 19 Apr 2010 07:51:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r206836 - in head/sys: conf mips/mips X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Apr 2010 07:51:57 -0000 Author: jmallett Date: Mon Apr 19 07:51:57 2010 New Revision: 206836 URL: http://svn.freebsd.org/changeset/base/206836 Log: Remove unused file. Deleted: head/sys/mips/mips/copystr.S Modified: head/sys/conf/files.mips Modified: head/sys/conf/files.mips ============================================================================== --- head/sys/conf/files.mips Mon Apr 19 07:39:56 2010 (r206835) +++ head/sys/conf/files.mips Mon Apr 19 07:51:57 2010 (r206836) @@ -50,7 +50,6 @@ mips/mips/bus_space_generic.c standard mips/mips/busdma_machdep.c standard mips/mips/cache.c standard mips/mips/cache_mipsNN.c standard -#mips/mips/copystr.S standard mips/mips/db_disasm.c optional ddb mips/mips/db_interface.c optional ddb mips/mips/db_trace.c optional ddb From owner-svn-src-head@FreeBSD.ORG Mon Apr 19 09:03:34 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9555A1065676; Mon, 19 Apr 2010 09:03:34 +0000 (UTC) (envelope-from jmallett@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 843758FC14; Mon, 19 Apr 2010 09:03:34 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o3J93YFY053272; Mon, 19 Apr 2010 09:03:34 GMT (envelope-from jmallett@svn.freebsd.org) Received: (from jmallett@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o3J93YTR053270; Mon, 19 Apr 2010 09:03:34 GMT (envelope-from jmallett@svn.freebsd.org) Message-Id: <201004190903.o3J93YTR053270@svn.freebsd.org> From: Juli Mallett Date: Mon, 19 Apr 2010 09:03:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r206837 - head/sys/mips/malta X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Apr 2010 09:03:34 -0000 Author: jmallett Date: Mon Apr 19 09:03:34 2010 New Revision: 206837 URL: http://svn.freebsd.org/changeset/base/206837 Log: Fix MALTA64 build. Modified: head/sys/mips/malta/gt_pci.c Modified: head/sys/mips/malta/gt_pci.c ============================================================================== --- head/sys/mips/malta/gt_pci.c Mon Apr 19 07:51:57 2010 (r206836) +++ head/sys/mips/malta/gt_pci.c Mon Apr 19 09:03:34 2010 (r206837) @@ -109,8 +109,8 @@ struct gt_pci_softc { struct rman sc_mem_rman; struct rman sc_io_rman; struct rman sc_irq_rman; - uint32_t sc_mem; - uint32_t sc_io; + unsigned long sc_mem; + bus_space_handle_t sc_io; struct resource *sc_irq; struct intr_event *sc_eventstab[ICU_LEN]; From owner-svn-src-head@FreeBSD.ORG Mon Apr 19 09:03:37 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 482B51065674; Mon, 19 Apr 2010 09:03:37 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 369C88FC2C; Mon, 19 Apr 2010 09:03:37 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o3J93boT053310; Mon, 19 Apr 2010 09:03:37 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o3J93b5R053308; Mon, 19 Apr 2010 09:03:37 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <201004190903.o3J93b5R053308@svn.freebsd.org> From: Xin LI Date: Mon, 19 Apr 2010 09:03:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r206838 - head/sys/cddl/compat/opensolaris/kern X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Apr 2010 09:03:37 -0000 Author: delphij Date: Mon Apr 19 09:03:36 2010 New Revision: 206838 URL: http://svn.freebsd.org/changeset/base/206838 Log: Partially MFp4 #176265 by pjd@: - Properly initialize and destroy system_taskq. - Add a dummy implementation of taskq_create_proc(). Note: We do not currently use system_taskq in ZFS so this is mostly a no-op at this time. Proper system_taskq initialization is required by newer ZFS code. Ok'ed by: pjd MFC after: 2 weeks Modified: head/sys/cddl/compat/opensolaris/kern/opensolaris_taskq.c Modified: head/sys/cddl/compat/opensolaris/kern/opensolaris_taskq.c ============================================================================== --- head/sys/cddl/compat/opensolaris/kern/opensolaris_taskq.c Mon Apr 19 09:03:34 2010 (r206837) +++ head/sys/cddl/compat/opensolaris/kern/opensolaris_taskq.c Mon Apr 19 09:03:36 2010 (r206838) @@ -52,9 +52,9 @@ static void system_taskq_init(void *arg) { - system_taskq = (taskq_t *)taskqueue_thread; taskq_zone = uma_zcreate("taskq_zone", sizeof(struct ostask), NULL, NULL, NULL, NULL, 0, 0); + system_taskq = taskq_create("system_taskq", mp_ncpus, 0, 0, 0, 0); } SYSINIT(system_taskq_init, SI_SUB_CONFIGURE, SI_ORDER_ANY, system_taskq_init, NULL); @@ -62,6 +62,7 @@ static void system_taskq_fini(void *arg) { + taskq_destroy(system_taskq); uma_zdestroy(taskq_zone); } SYSUNINIT(system_taskq_fini, SI_SUB_CONFIGURE, SI_ORDER_ANY, system_taskq_fini, NULL); @@ -72,10 +73,8 @@ taskq_create(const char *name, int nthre { taskq_t *tq; - if ((flags & TASKQ_THREADS_CPU_PCT) != 0) { - /* TODO: Calculate number od threads. */ - printf("%s: TASKQ_THREADS_CPU_PCT\n", __func__); - } + if ((flags & TASKQ_THREADS_CPU_PCT) != 0) + nthreads = MAX((mp_ncpus * nthreads) / 100, 1); tq = kmem_alloc(sizeof(*tq), KM_SLEEP); tq->tq_queue = taskqueue_create(name, M_WAITOK, taskqueue_thread_enqueue, @@ -85,6 +84,14 @@ taskq_create(const char *name, int nthre return ((taskq_t *)tq); } +taskq_t * +taskq_create_proc(const char *name, int nthreads, pri_t pri, int minalloc, + int maxalloc, proc_t *proc __unused, uint_t flags) +{ + + return (taskq_create(name, nthreads, pri, minalloc, maxalloc, flags)); +} + void taskq_destroy(taskq_t *tq) { From owner-svn-src-head@FreeBSD.ORG Mon Apr 19 14:07:34 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0F579106567D; Mon, 19 Apr 2010 14:07:34 +0000 (UTC) (envelope-from rpaulo@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id BC30C8FC1C; Mon, 19 Apr 2010 14:07:33 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o3JE7XNK021883; Mon, 19 Apr 2010 14:07:33 GMT (envelope-from rpaulo@svn.freebsd.org) Received: (from rpaulo@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o3JE7XuU021881; Mon, 19 Apr 2010 14:07:33 GMT (envelope-from rpaulo@svn.freebsd.org) Message-Id: <201004191407.o3JE7XuU021881@svn.freebsd.org> From: Rui Paulo Date: Mon, 19 Apr 2010 14:07:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r206839 - head/sys/dev/ahci X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Apr 2010 14:07:34 -0000 Author: rpaulo Date: Mon Apr 19 14:07:33 2010 New Revision: 206839 URL: http://svn.freebsd.org/changeset/base/206839 Log: Revert r206755. It causes some laptops to stop booting. Modified: head/sys/dev/ahci/ahci.c Modified: head/sys/dev/ahci/ahci.c ============================================================================== --- head/sys/dev/ahci/ahci.c Mon Apr 19 09:03:36 2010 (r206838) +++ head/sys/dev/ahci/ahci.c Mon Apr 19 14:07:33 2010 (r206839) @@ -126,7 +126,6 @@ static struct { {0x26838086, 0x00, "Intel ESB2", 0}, {0x27c18086, 0x00, "Intel ICH7", 0}, {0x27c38086, 0x00, "Intel ICH7", 0}, - {0x27c48086, 0x00, "Intel ICH7M", 0}, {0x27c58086, 0x00, "Intel ICH7M", 0}, {0x27c68086, 0x00, "Intel ICH7M", 0}, {0x28218086, 0x00, "Intel ICH8", 0}, From owner-svn-src-head@FreeBSD.ORG Mon Apr 19 14:15:58 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7C67D1065675; Mon, 19 Apr 2010 14:15:58 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 6BC4A8FC13; Mon, 19 Apr 2010 14:15:58 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o3JEFwKB023797; Mon, 19 Apr 2010 14:15:58 GMT (envelope-from tuexen@svn.freebsd.org) Received: (from tuexen@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o3JEFwbM023795; Mon, 19 Apr 2010 14:15:58 GMT (envelope-from tuexen@svn.freebsd.org) Message-Id: <201004191415.o3JEFwbM023795@svn.freebsd.org> From: Michael Tuexen Date: Mon, 19 Apr 2010 14:15:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r206840 - head/sys/netinet X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Apr 2010 14:15:58 -0000 Author: tuexen Date: Mon Apr 19 14:15:58 2010 New Revision: 206840 URL: http://svn.freebsd.org/changeset/base/206840 Log: Get delayed SACK working again. MFC after: 3 days. Modified: head/sys/netinet/sctp_indata.c Modified: head/sys/netinet/sctp_indata.c ============================================================================== --- head/sys/netinet/sctp_indata.c Mon Apr 19 14:07:33 2010 (r206839) +++ head/sys/netinet/sctp_indata.c Mon Apr 19 14:15:58 2010 (r206840) @@ -2123,6 +2123,10 @@ failed_pdapi_express_del: } } finish_express_del: + if (tsn == (asoc->cumulative_tsn + 1)) { + /* Update cum-ack */ + asoc->cumulative_tsn = tsn; + } if (last_chunk) { *m = NULL; } From owner-svn-src-head@FreeBSD.ORG Mon Apr 19 14:34:44 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B6505106564A; Mon, 19 Apr 2010 14:34:44 +0000 (UTC) (envelope-from nwhitehorn@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A54CA8FC29; Mon, 19 Apr 2010 14:34:44 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o3JEYioR027974; Mon, 19 Apr 2010 14:34:44 GMT (envelope-from nwhitehorn@svn.freebsd.org) Received: (from nwhitehorn@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o3JEYih5027972; Mon, 19 Apr 2010 14:34:44 GMT (envelope-from nwhitehorn@svn.freebsd.org) Message-Id: <201004191434.o3JEYih5027972@svn.freebsd.org> From: Nathan Whitehorn Date: Mon, 19 Apr 2010 14:34:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r206842 - head/contrib/top X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Apr 2010 14:34:44 -0000 Author: nwhitehorn Date: Mon Apr 19 14:34:44 2010 New Revision: 206842 URL: http://svn.freebsd.org/changeset/base/206842 Log: Fix brokenness in top on big-endian 32-bit systems introduced when changing format_k2 to take a long long. Because itoa is defined as a K&R C function, without prototyping its arguments, format_k2 passed a 64-bit value, but itoa() received only the first word, showing '0' in all memory fields. Modified: head/contrib/top/utils.c Modified: head/contrib/top/utils.c ============================================================================== --- head/contrib/top/utils.c Mon Apr 19 14:23:15 2010 (r206841) +++ head/contrib/top/utils.c Mon Apr 19 14:34:44 2010 (r206842) @@ -499,7 +499,7 @@ unsigned long long amt; } } - p = strecpy(p, itoa(amt)); + p = strecpy(p, itoa((int)amt)); *p++ = tag; *p = '\0'; From owner-svn-src-head@FreeBSD.ORG Mon Apr 19 15:11:46 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 29A30106566B; Mon, 19 Apr 2010 15:11:46 +0000 (UTC) (envelope-from luigi@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 181E98FC14; Mon, 19 Apr 2010 15:11:46 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o3JFBjHb036353; Mon, 19 Apr 2010 15:11:45 GMT (envelope-from luigi@svn.freebsd.org) Received: (from luigi@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o3JFBjLj036350; Mon, 19 Apr 2010 15:11:45 GMT (envelope-from luigi@svn.freebsd.org) Message-Id: <201004191511.o3JFBjLj036350@svn.freebsd.org> From: Luigi Rizzo Date: Mon, 19 Apr 2010 15:11:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r206843 - head/sbin/ipfw X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Apr 2010 15:11:46 -0000 Author: luigi Date: Mon Apr 19 15:11:45 2010 New Revision: 206843 URL: http://svn.freebsd.org/changeset/base/206843 Log: Slightly different handling of printf/snprintf for unaligned uint64_t, which should improve readability, and also to ease the port to platforms that do not support %llu MFC after: 3 days Modified: head/sbin/ipfw/dummynet.c head/sbin/ipfw/ipfw2.c head/sbin/ipfw/ipfw2.h Modified: head/sbin/ipfw/dummynet.c ============================================================================== --- head/sbin/ipfw/dummynet.c Mon Apr 19 14:34:44 2010 (r206842) +++ head/sbin/ipfw/dummynet.c Mon Apr 19 15:11:45 2010 (r206843) @@ -203,9 +203,9 @@ list_flow(struct dn_flow *ni) inet_ntop(AF_INET6, &(id->dst_ip6), buff, sizeof(buff)), id->dst_port); } - printf("%4llu %8llu %2u %4u %3u\n", - align_uint64(&ni->tot_pkts), - align_uint64(&ni->tot_bytes), + pr_u64(&ni->tot_pkts, 4); + pr_u64(&ni->tot_bytes, 8); + printf("%2u %4u %3u\n", ni->length, ni->len_bytes, ni->drops); } @@ -290,8 +290,8 @@ static void list_pipes(struct dn_id *oid, struct dn_id *end) { char buf[160]; /* pending buffer */ - buf[0] = '\0'; + buf[0] = '\0'; for (; oid != end; oid = O_NEXT(oid, oid->len)) { if (oid->len < sizeof(*oid)) errx(1, "invalid oid len %d\n", oid->len); Modified: head/sbin/ipfw/ipfw2.c ============================================================================== --- head/sbin/ipfw/ipfw2.c Mon Apr 19 14:34:44 2010 (r206842) +++ head/sbin/ipfw/ipfw2.c Mon Apr 19 15:11:45 2010 (r206843) @@ -314,22 +314,27 @@ static struct _s_x rule_options[] = { { NULL, 0 } /* terminator */ }; -/* - * The following is used to generate a printable argument for - * 64-bit numbers, irrespective of platform alignment and bit size. - * Because all the printf in this program use %llu as a format, - * we just return an unsigned long long, which is larger than - * we need in certain cases, but saves the hassle of using - * PRIu64 as a format specifier. - * We don't care about inlining, this is not performance critical code. +/* + * Helper routine to print a possibly unaligned uint64_t on + * various platform. If width > 0, print the value with + * the desired width, followed by a space; + * otherwise, return the required width. */ -unsigned long long -align_uint64(const uint64_t *pll) +int +pr_u64(uint64_t *pd, int width) { - uint64_t ret; +#ifdef TCC +#define U64_FMT "I64" +#else +#define U64_FMT "llu" +#endif + uint64_t d; - bcopy (pll, &ret, sizeof(ret)); - return ret; + bcopy (pd, &d, sizeof(d)); + return (width > 0) ? + printf("%*" U64_FMT " ", width, d) : + snprintf(NULL, 0, "%" U64_FMT, d) ; +#undef U64_FMT } void * @@ -973,9 +978,10 @@ show_ipfw(struct ip_fw *rule, int pcwidt } printf("%05u ", rule->rulenum); - if (pcwidth>0 || bcwidth>0) - printf("%*llu %*llu ", pcwidth, align_uint64(&rule->pcnt), - bcwidth, align_uint64(&rule->bcnt)); + if (pcwidth > 0 || bcwidth > 0) { + pr_u64(&rule->pcnt, pcwidth); + pr_u64(&rule->bcnt, bcwidth); + } if (co.do_time == 2) printf("%10u ", rule->timestamp); @@ -1577,10 +1583,12 @@ show_dyn_ipfw(ipfw_dyn_rule *d, int pcwi } bcopy(&d->rule, &rulenum, sizeof(rulenum)); printf("%05d", rulenum); - if (pcwidth>0 || bcwidth>0) - printf(" %*llu %*llu (%ds)", pcwidth, - align_uint64(&d->pcnt), bcwidth, - align_uint64(&d->bcnt), d->expire); + if (pcwidth > 0 || bcwidth > 0) { + printf(" "); + pr_u64(&d->pcnt, pcwidth); + pr_u64(&d->bcnt, bcwidth); + printf("(%ds)", d->expire); + } switch (d->dyn_type) { case O_LIMIT_PARENT: printf(" PARENT %d", d->count); @@ -1645,9 +1653,9 @@ ipfw_sets_handler(char *av[]) free(data); nalloc = nalloc * 2 + 200; nbytes = nalloc; - data = safe_calloc(1, nbytes); - if (do_cmd(IP_FW_GET, data, (uintptr_t)&nbytes) < 0) - err(EX_OSERR, "getsockopt(IP_FW_GET)"); + data = safe_calloc(1, nbytes); + if (do_cmd(IP_FW_GET, data, (uintptr_t)&nbytes) < 0) + err(EX_OSERR, "getsockopt(IP_FW_GET)"); } bcopy(&((struct ip_fw *)data)->next_rule, @@ -1837,14 +1845,12 @@ ipfw_list(int ac, char *av[], int show_c continue; /* packet counter */ - width = snprintf(NULL, 0, "%llu", - align_uint64(&r->pcnt)); + width = pr_u64(&r->pcnt, 0); if (width > pcwidth) pcwidth = width; /* byte counter */ - width = snprintf(NULL, 0, "%llu", - align_uint64(&r->bcnt)); + width = pr_u64(&r->bcnt, 0); if (width > bcwidth) bcwidth = width; } @@ -1858,13 +1864,11 @@ ipfw_list(int ac, char *av[], int show_c if (set != co.use_set - 1) continue; } - width = snprintf(NULL, 0, "%llu", - align_uint64(&d->pcnt)); + width = pr_u64(&d->pcnt, 0); if (width > pcwidth) pcwidth = width; - width = snprintf(NULL, 0, "%llu", - align_uint64(&d->bcnt)); + width = pr_u64(&d->bcnt, 0); if (width > bcwidth) bcwidth = width; } Modified: head/sbin/ipfw/ipfw2.h ============================================================================== --- head/sbin/ipfw/ipfw2.h Mon Apr 19 14:34:44 2010 (r206842) +++ head/sbin/ipfw/ipfw2.h Mon Apr 19 15:11:45 2010 (r206843) @@ -207,7 +207,7 @@ enum tokens { #define NEED(_p, msg) {if (!_p) errx(EX_USAGE, msg);} #define NEED1(msg) {if (!(*av)) errx(EX_USAGE, msg);} -unsigned long long align_uint64(const uint64_t *pll); +int pr_u64(uint64_t *pd, int width); /* memory allocation support */ void *safe_calloc(size_t number, size_t size); From owner-svn-src-head@FreeBSD.ORG Mon Apr 19 15:15:36 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 60942106566C; Mon, 19 Apr 2010 15:15:36 +0000 (UTC) (envelope-from ken@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 5006D8FC23; Mon, 19 Apr 2010 15:15:36 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o3JFFaNQ037278; Mon, 19 Apr 2010 15:15:36 GMT (envelope-from ken@svn.freebsd.org) Received: (from ken@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o3JFFapS037276; Mon, 19 Apr 2010 15:15:36 GMT (envelope-from ken@svn.freebsd.org) Message-Id: <201004191515.o3JFFapS037276@svn.freebsd.org> From: "Kenneth D. Merry" Date: Mon, 19 Apr 2010 15:15:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r206844 - head/sys/netinet X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Apr 2010 15:15:36 -0000 Author: ken Date: Mon Apr 19 15:15:36 2010 New Revision: 206844 URL: http://svn.freebsd.org/changeset/base/206844 Log: Don't clear other flags (e.g. CSUM_TCP) when setting CSUM_TSO. This was causing TSO to break for the Xen netfront driver. Reviewed by: gibbs, rwatson MFC after: 7 days Modified: head/sys/netinet/tcp_output.c Modified: head/sys/netinet/tcp_output.c ============================================================================== --- head/sys/netinet/tcp_output.c Mon Apr 19 15:11:45 2010 (r206843) +++ head/sys/netinet/tcp_output.c Mon Apr 19 15:15:36 2010 (r206844) @@ -1048,7 +1048,7 @@ send: * XXX: Fixme: This is currently not the case for IPv6. */ if (tso) { - m->m_pkthdr.csum_flags = CSUM_TSO; + m->m_pkthdr.csum_flags |= CSUM_TSO; m->m_pkthdr.tso_segsz = tp->t_maxopd - optlen; } From owner-svn-src-head@FreeBSD.ORG Mon Apr 19 16:01:56 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9C54C106567D; Mon, 19 Apr 2010 16:01:56 +0000 (UTC) (envelope-from rnoland@FreeBSD.org) Received: from gizmo.2hip.net (gizmo.2hip.net [64.74.207.195]) by mx1.freebsd.org (Postfix) with ESMTP id 5AF6F8FC19; Mon, 19 Apr 2010 16:01:56 +0000 (UTC) Received: from [10.170.20.44] (nat-170-142-177-44.tn.gov [170.142.177.44]) (authenticated bits=0) by gizmo.2hip.net (8.14.3/8.14.3) with ESMTP id o3JG1rkR003589 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Mon, 19 Apr 2010 12:01:54 -0400 (EDT) (envelope-from rnoland@FreeBSD.org) Message-ID: <4BCC7E64.4040200@FreeBSD.org> Date: Mon, 19 Apr 2010 11:01:40 -0500 From: Robert Noland Organization: FreeBSD User-Agent: Thunderbird 2.0.0.19 (X11/20090218) MIME-Version: 1.0 To: Luigi Rizzo References: <201004191511.o3JFBjLj036350@svn.freebsd.org> In-Reply-To: <201004191511.o3JFBjLj036350@svn.freebsd.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=1.0 required=5.0 tests=AWL, BAYES_00, FH_DATE_PAST_20XX, RDNS_DYNAMIC,SPF_SOFTFAIL autolearn=no version=3.2.5 X-Spam-Level: * X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on gizmo.2hip.net Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r206843 - head/sbin/ipfw X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Apr 2010 16:01:56 -0000 Luigi Rizzo wrote: > Author: luigi > Date: Mon Apr 19 15:11:45 2010 > New Revision: 206843 > URL: http://svn.freebsd.org/changeset/base/206843 > > Log: > Slightly different handling of printf/snprintf for unaligned uint64_t, > which should improve readability, and also to ease the port to > platforms that do not support %llu > > MFC after: 3 days > > Modified: > head/sbin/ipfw/dummynet.c > head/sbin/ipfw/ipfw2.c > head/sbin/ipfw/ipfw2.h > > Modified: head/sbin/ipfw/dummynet.c > ============================================================================== > --- head/sbin/ipfw/dummynet.c Mon Apr 19 14:34:44 2010 (r206842) > +++ head/sbin/ipfw/dummynet.c Mon Apr 19 15:11:45 2010 (r206843) > @@ -203,9 +203,9 @@ list_flow(struct dn_flow *ni) > inet_ntop(AF_INET6, &(id->dst_ip6), buff, sizeof(buff)), > id->dst_port); > } > - printf("%4llu %8llu %2u %4u %3u\n", > - align_uint64(&ni->tot_pkts), > - align_uint64(&ni->tot_bytes), > + pr_u64(&ni->tot_pkts, 4); > + pr_u64(&ni->tot_bytes, 8); > + printf("%2u %4u %3u\n", > ni->length, ni->len_bytes, ni->drops); > } > > @@ -290,8 +290,8 @@ static void > list_pipes(struct dn_id *oid, struct dn_id *end) > { > char buf[160]; /* pending buffer */ > - buf[0] = '\0'; > > + buf[0] = '\0'; > for (; oid != end; oid = O_NEXT(oid, oid->len)) { > if (oid->len < sizeof(*oid)) > errx(1, "invalid oid len %d\n", oid->len); > > Modified: head/sbin/ipfw/ipfw2.c > ============================================================================== > --- head/sbin/ipfw/ipfw2.c Mon Apr 19 14:34:44 2010 (r206842) > +++ head/sbin/ipfw/ipfw2.c Mon Apr 19 15:11:45 2010 (r206843) > @@ -314,22 +314,27 @@ static struct _s_x rule_options[] = { > { NULL, 0 } /* terminator */ > }; > > -/* > - * The following is used to generate a printable argument for > - * 64-bit numbers, irrespective of platform alignment and bit size. > - * Because all the printf in this program use %llu as a format, > - * we just return an unsigned long long, which is larger than > - * we need in certain cases, but saves the hassle of using > - * PRIu64 as a format specifier. > - * We don't care about inlining, this is not performance critical code. > +/* > + * Helper routine to print a possibly unaligned uint64_t on > + * various platform. If width > 0, print the value with > + * the desired width, followed by a space; > + * otherwise, return the required width. > */ > -unsigned long long > -align_uint64(const uint64_t *pll) > +int > +pr_u64(uint64_t *pd, int width) > { > - uint64_t ret; > +#ifdef TCC > +#define U64_FMT "I64" > +#else > +#define U64_FMT "llu" This is broken on amd64. It either needs casting or the following patch... beastie% svn diff Index: sbin/ipfw/ipfw2.c =================================================================== --- sbin/ipfw/ipfw2.c (revision 206844) +++ sbin/ipfw/ipfw2.c (working copy) @@ -326,7 +326,7 @@ #ifdef TCC #define U64_FMT "I64" #else -#define U64_FMT "llu" +#define U64_FMT "ju" #endif uint64_t d; robert. > +#endif > + uint64_t d; > > - bcopy (pll, &ret, sizeof(ret)); > - return ret; > + bcopy (pd, &d, sizeof(d)); > + return (width > 0) ? > + printf("%*" U64_FMT " ", width, d) : > + snprintf(NULL, 0, "%" U64_FMT, d) ; > +#undef U64_FMT > } > > void * > @@ -973,9 +978,10 @@ show_ipfw(struct ip_fw *rule, int pcwidt > } > printf("%05u ", rule->rulenum); > > - if (pcwidth>0 || bcwidth>0) > - printf("%*llu %*llu ", pcwidth, align_uint64(&rule->pcnt), > - bcwidth, align_uint64(&rule->bcnt)); > + if (pcwidth > 0 || bcwidth > 0) { > + pr_u64(&rule->pcnt, pcwidth); > + pr_u64(&rule->bcnt, bcwidth); > + } > > if (co.do_time == 2) > printf("%10u ", rule->timestamp); > @@ -1577,10 +1583,12 @@ show_dyn_ipfw(ipfw_dyn_rule *d, int pcwi > } > bcopy(&d->rule, &rulenum, sizeof(rulenum)); > printf("%05d", rulenum); > - if (pcwidth>0 || bcwidth>0) > - printf(" %*llu %*llu (%ds)", pcwidth, > - align_uint64(&d->pcnt), bcwidth, > - align_uint64(&d->bcnt), d->expire); > + if (pcwidth > 0 || bcwidth > 0) { > + printf(" "); > + pr_u64(&d->pcnt, pcwidth); > + pr_u64(&d->bcnt, bcwidth); > + printf("(%ds)", d->expire); > + } > switch (d->dyn_type) { > case O_LIMIT_PARENT: > printf(" PARENT %d", d->count); > @@ -1645,9 +1653,9 @@ ipfw_sets_handler(char *av[]) > free(data); > nalloc = nalloc * 2 + 200; > nbytes = nalloc; > - data = safe_calloc(1, nbytes); > - if (do_cmd(IP_FW_GET, data, (uintptr_t)&nbytes) < 0) > - err(EX_OSERR, "getsockopt(IP_FW_GET)"); > + data = safe_calloc(1, nbytes); > + if (do_cmd(IP_FW_GET, data, (uintptr_t)&nbytes) < 0) > + err(EX_OSERR, "getsockopt(IP_FW_GET)"); > } > > bcopy(&((struct ip_fw *)data)->next_rule, > @@ -1837,14 +1845,12 @@ ipfw_list(int ac, char *av[], int show_c > continue; > > /* packet counter */ > - width = snprintf(NULL, 0, "%llu", > - align_uint64(&r->pcnt)); > + width = pr_u64(&r->pcnt, 0); > if (width > pcwidth) > pcwidth = width; > > /* byte counter */ > - width = snprintf(NULL, 0, "%llu", > - align_uint64(&r->bcnt)); > + width = pr_u64(&r->bcnt, 0); > if (width > bcwidth) > bcwidth = width; > } > @@ -1858,13 +1864,11 @@ ipfw_list(int ac, char *av[], int show_c > if (set != co.use_set - 1) > continue; > } > - width = snprintf(NULL, 0, "%llu", > - align_uint64(&d->pcnt)); > + width = pr_u64(&d->pcnt, 0); > if (width > pcwidth) > pcwidth = width; > > - width = snprintf(NULL, 0, "%llu", > - align_uint64(&d->bcnt)); > + width = pr_u64(&d->bcnt, 0); > if (width > bcwidth) > bcwidth = width; > } > > Modified: head/sbin/ipfw/ipfw2.h > ============================================================================== > --- head/sbin/ipfw/ipfw2.h Mon Apr 19 14:34:44 2010 (r206842) > +++ head/sbin/ipfw/ipfw2.h Mon Apr 19 15:11:45 2010 (r206843) > @@ -207,7 +207,7 @@ enum tokens { > #define NEED(_p, msg) {if (!_p) errx(EX_USAGE, msg);} > #define NEED1(msg) {if (!(*av)) errx(EX_USAGE, msg);} > > -unsigned long long align_uint64(const uint64_t *pll); > +int pr_u64(uint64_t *pd, int width); > > /* memory allocation support */ > void *safe_calloc(size_t number, size_t size); From owner-svn-src-head@FreeBSD.ORG Mon Apr 19 16:17:31 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id F1E541065670; Mon, 19 Apr 2010 16:17:30 +0000 (UTC) (envelope-from luigi@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id DFC538FC08; Mon, 19 Apr 2010 16:17:30 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o3JGHUVo050908; Mon, 19 Apr 2010 16:17:30 GMT (envelope-from luigi@svn.freebsd.org) Received: (from luigi@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o3JGHUbx050899; Mon, 19 Apr 2010 16:17:30 GMT (envelope-from luigi@svn.freebsd.org) Message-Id: <201004191617.o3JGHUbx050899@svn.freebsd.org> From: Luigi Rizzo Date: Mon, 19 Apr 2010 16:17:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r206845 - in head/sys/netinet: . ipfw X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Apr 2010 16:17:31 -0000 Author: luigi Date: Mon Apr 19 16:17:30 2010 New Revision: 206845 URL: http://svn.freebsd.org/changeset/base/206845 Log: whitespace fixes (trailing whitespace, bad indentation after a merge, etc.) Modified: head/sys/netinet/ip_dummynet.h head/sys/netinet/ipfw/dn_sched.h head/sys/netinet/ipfw/dn_sched_rr.c head/sys/netinet/ipfw/dn_sched_wf2q.c head/sys/netinet/ipfw/ip_dn_private.h head/sys/netinet/ipfw/ip_dummynet.c head/sys/netinet/ipfw/ip_fw_pfil.c head/sys/netinet/ipfw/ip_fw_private.h Modified: head/sys/netinet/ip_dummynet.h ============================================================================== --- head/sys/netinet/ip_dummynet.h Mon Apr 19 15:15:36 2010 (r206844) +++ head/sys/netinet/ip_dummynet.h Mon Apr 19 16:17:30 2010 (r206845) @@ -87,14 +87,14 @@ enum { DN_SYSCTL_SET, DN_LAST, -} ; +}; enum { /* subtype for schedulers, flowset and the like */ DN_SCHED_UNKNOWN = 0, DN_SCHED_FIFO = 1, DN_SCHED_WF2QP = 2, /* others are in individual modules */ -} ; +}; enum { /* user flags */ DN_HAVE_MASK = 0x0001, /* fs or sched has a mask */ @@ -113,16 +113,16 @@ enum { /* user flags */ struct dn_link { struct dn_id oid; - /* + /* * Userland sets bw and delay in bits/s and milliseconds. * The kernel converts this back and forth to bits/tick and ticks. * XXX what about burst ? - */ + */ int32_t link_nr; int bandwidth; /* bit/s or bits/tick. */ int delay; /* ms and ticks */ uint64_t burst; /* scaled. bits*Hz XXX */ -} ; +}; /* * A flowset, which is a template for flows. Contains parameters @@ -132,13 +132,13 @@ struct dn_link { */ struct dn_fs { struct dn_id oid; - uint32_t fs_nr; /* the flowset number */ - uint32_t flags; /* userland flags */ - int qsize ; /* queue size in slots or bytes */ - int32_t plr; /* PLR, pkt loss rate (2^31-1 means 100%) */ + uint32_t fs_nr; /* the flowset number */ + uint32_t flags; /* userland flags */ + int qsize; /* queue size in slots or bytes */ + int32_t plr; /* PLR, pkt loss rate (2^31-1 means 100%) */ uint32_t buckets; /* buckets used for the queue hash table */ - struct ipfw_flow_id flow_mask ; + struct ipfw_flow_id flow_mask; uint32_t sched_nr; /* the scheduler we attach to */ /* generic scheduler parameters. Leave them at -1 if unset. * Now we use 0: weight, 1: lmax, 2: priority @@ -149,14 +149,14 @@ struct dn_fs { * weight and probabilities are in the range 0..1 represented * in fixed point arithmetic with SCALE_RED decimal bits. */ -#define SCALE_RED 16 -#define SCALE(x) ( (x) << SCALE_RED ) -#define SCALE_VAL(x) ( (x) >> SCALE_RED ) -#define SCALE_MUL(x,y) ( ( (x) * (y) ) >> SCALE_RED ) - int w_q ; /* queue weight (scaled) */ - int max_th ; /* maximum threshold for queue (scaled) */ - int min_th ; /* minimum threshold for queue (scaled) */ - int max_p ; /* maximum value for p_b (scaled) */ +#define SCALE_RED 16 +#define SCALE(x) ( (x) << SCALE_RED ) +#define SCALE_VAL(x) ( (x) >> SCALE_RED ) +#define SCALE_MUL(x,y) ( ( (x) * (y) ) >> SCALE_RED ) + int w_q ; /* queue weight (scaled) */ + int max_th ; /* maximum threshold for queue (scaled) */ + int min_th ; /* minimum threshold for queue (scaled) */ + int max_p ; /* maximum value for p_b (scaled) */ }; @@ -177,10 +177,10 @@ struct dn_flow { }; - /* +/* * Scheduler template, mostly indicating the name, number, * sched_mask and buckets. - */ + */ struct dn_sch { struct dn_id oid; uint32_t sched_nr; /* N, scheduler number */ @@ -199,14 +199,14 @@ struct dn_sch { #define ED_MAX_SAMPLES_NO 1024 struct dn_profile { struct dn_id oid; - /* fields to simulate a delay profile */ + /* fields to simulate a delay profile */ #define ED_MAX_NAME_LEN 32 - char name[ED_MAX_NAME_LEN]; - int link_nr; - int loss_level; - int bandwidth; // XXX use link bandwidth? - int samples_no; /* actual length of samples[] */ - int samples[ED_MAX_SAMPLES_NO]; /* may be shorter */ + char name[ED_MAX_NAME_LEN]; + int link_nr; + int loss_level; + int bandwidth; // XXX use link bandwidth? + int samples_no; /* actual len of samples[] */ + int samples[ED_MAX_SAMPLES_NO]; /* may be shorter */ }; Modified: head/sys/netinet/ipfw/dn_sched.h ============================================================================== --- head/sys/netinet/ipfw/dn_sched.h Mon Apr 19 15:15:36 2010 (r206844) +++ head/sys/netinet/ipfw/dn_sched.h Mon Apr 19 16:17:30 2010 (r206845) @@ -140,9 +140,9 @@ struct dn_alg { /* MSVC does not support initializers so we need this ugly macro */ #ifdef _WIN32 -#define _SI(fld) +#define _SI(fld) #else -#define _SI(fld) fld +#define _SI(fld) fld #endif /* Modified: head/sys/netinet/ipfw/dn_sched_rr.c ============================================================================== --- head/sys/netinet/ipfw/dn_sched_rr.c Mon Apr 19 15:15:36 2010 (r206844) +++ head/sys/netinet/ipfw/dn_sched_rr.c Mon Apr 19 16:17:30 2010 (r206845) @@ -94,7 +94,7 @@ rr_remove_head(struct rr_si *si) if (si->head == NULL) return; /* empty queue */ si->head->status = 0; - + if (si->head == si->tail) { si->head = si->tail = NULL; return; @@ -141,7 +141,7 @@ next_pointer(struct rr_si *si) si->tail = si->tail->qnext; } -static int +static int rr_enqueue(struct dn_sch_inst *_si, struct dn_queue *q, struct mbuf *m) { struct rr_si *si; @@ -154,7 +154,7 @@ rr_enqueue(struct dn_sch_inst *_si, stru return 0; } - /* If reach this point, queue q was idle */ + /* If reach this point, queue q was idle */ si = (struct rr_si *)(_si + 1); rrq = (struct rr_queue *)q; Modified: head/sys/netinet/ipfw/dn_sched_wf2q.c ============================================================================== --- head/sys/netinet/ipfw/dn_sched_wf2q.c Mon Apr 19 15:15:36 2010 (r206844) +++ head/sys/netinet/ipfw/dn_sched_wf2q.c Mon Apr 19 16:17:30 2010 (r206845) @@ -125,7 +125,7 @@ idle_check(struct wf2qp_si *si, int n, i } } -static int +static int wf2qp_enqueue(struct dn_sch_inst *_si, struct dn_queue *q, struct mbuf *m) { struct dn_fsk *fs = q->fs; @@ -140,7 +140,7 @@ wf2qp_enqueue(struct dn_sch_inst *_si, s return 0; } - /* If reach this point, queue q was idle */ + /* If reach this point, queue q was idle */ alg_fq = (struct wf2qp_queue *)q; if (DN_KEY_LT(alg_fq->F, alg_fq->S)) { @@ -318,7 +318,7 @@ wf2qp_free_queue(struct dn_queue *q) { struct wf2qp_queue *alg_fq = (struct wf2qp_queue *)q; struct wf2qp_si *si = (struct wf2qp_si *)(q->_si + 1); - + if (alg_fq->S >= alg_fq->F + 1) return 0; /* nothing to do, not in any heap */ si->wsum -= q->fs->fs.par[0]; @@ -361,7 +361,7 @@ static struct dn_alg wf2qp_desc = { _SI( .destroy = ) NULL, _SI( .new_sched = ) wf2qp_new_sched, _SI( .free_sched = ) wf2qp_free_sched, - + _SI( .new_fsk = ) wf2qp_new_fsk, _SI( .free_fsk = ) NULL, Modified: head/sys/netinet/ipfw/ip_dn_private.h ============================================================================== --- head/sys/netinet/ipfw/ip_dn_private.h Mon Apr 19 15:15:36 2010 (r206844) +++ head/sys/netinet/ipfw/ip_dn_private.h Mon Apr 19 16:17:30 2010 (r206845) @@ -149,7 +149,7 @@ struct dn_parms { int drain_sch; uint32_t expire; uint32_t expire_cycle; /* tick count */ - + int init_done; /* if the upper half is busy doing something long, Modified: head/sys/netinet/ipfw/ip_dummynet.c ============================================================================== --- head/sys/netinet/ipfw/ip_dummynet.c Mon Apr 19 15:15:36 2010 (r206844) +++ head/sys/netinet/ipfw/ip_dummynet.c Mon Apr 19 16:17:30 2010 (r206845) @@ -1547,28 +1547,28 @@ config_profile(struct dn_profile *pf, st /* XXX other sanity checks */ DN_BH_WLOCK(); for (; i < 2*DN_MAX_ID; i += DN_MAX_ID) { - s = locate_scheduler(i); + s = locate_scheduler(i); - if (s == NULL) { + if (s == NULL) { err = EINVAL; break; - } - dn_cfg.id++; - /* - * If we had a profile and the new one does not fit, - * or it is deleted, then we need to free memory. - */ - if (s->profile && (pf->samples_no == 0 || - s->profile->oid.len < pf->oid.len)) { - free(s->profile, M_DUMMYNET); - s->profile = NULL; - } + } + dn_cfg.id++; + /* + * If we had a profile and the new one does not fit, + * or it is deleted, then we need to free memory. + */ + if (s->profile && (pf->samples_no == 0 || + s->profile->oid.len < pf->oid.len)) { + free(s->profile, M_DUMMYNET); + s->profile = NULL; + } if (pf->samples_no == 0) continue; - /* + /* * new profile, possibly allocate memory - * and copy data. - */ + * and copy data. + */ if (s->profile == NULL) s->profile = malloc(pf->oid.len, M_DUMMYNET, M_NOWAIT | M_ZERO); @@ -1642,7 +1642,8 @@ do_config(void *p, int l) default: D("cmd %d not implemented", o->type); break; -#ifdef EMULATE_SYSCTL + +#ifdef EMULATE_SYSCTL /* sysctl emulation. * if we recognize the command, jump to the correct * handler and return @@ -1651,6 +1652,7 @@ do_config(void *p, int l) err = kesysctl_emu_set(p, l); return err; #endif + case DN_CMD_CONFIG: /* simply a header */ break; Modified: head/sys/netinet/ipfw/ip_fw_pfil.c ============================================================================== --- head/sys/netinet/ipfw/ip_fw_pfil.c Mon Apr 19 15:15:36 2010 (r206844) +++ head/sys/netinet/ipfw/ip_fw_pfil.c Mon Apr 19 16:17:30 2010 (r206845) @@ -147,8 +147,8 @@ again: switch (ipfw) { case IP_FW_PASS: /* next_hop may be set by ipfw_chk */ - if (args.next_hop == NULL) - break; /* pass */ + if (args.next_hop == NULL) + break; /* pass */ #ifndef IPFIREWALL_FORWARD ret = EACCES; #else @@ -347,14 +347,14 @@ ipfw_attach_hooks(int arg) if (arg == 0) /* detach */ ipfw_hook(0, AF_INET); - else if (V_fw_enable && ipfw_hook(1, AF_INET) != 0) { + else if (V_fw_enable && ipfw_hook(1, AF_INET) != 0) { error = ENOENT; /* see ip_fw_pfil.c::ipfw_hook() */ printf("ipfw_hook() error\n"); } #ifdef INET6 if (arg == 0) /* detach */ ipfw_hook(0, AF_INET6); - else if (V_fw6_enable && ipfw_hook(1, AF_INET6) != 0) { + else if (V_fw6_enable && ipfw_hook(1, AF_INET6) != 0) { error = ENOENT; printf("ipfw6_hook() error\n"); } Modified: head/sys/netinet/ipfw/ip_fw_private.h ============================================================================== --- head/sys/netinet/ipfw/ip_fw_private.h Mon Apr 19 15:15:36 2010 (r206844) +++ head/sys/netinet/ipfw/ip_fw_private.h Mon Apr 19 16:17:30 2010 (r206845) @@ -214,7 +214,7 @@ struct ip_fw_chain { struct ip_fw *default_rule; int n_rules; /* number of static rules */ int static_len; /* total len of static rules */ - struct ip_fw **map; /* array of rule ptrs to ease lookup */ + struct ip_fw **map; /* array of rule ptrs to ease lookup */ LIST_HEAD(nat_list, cfg_nat) nat; /* list of nat entries */ struct radix_node_head *tables[IPFW_TABLES_MAX]; #if defined( __linux__ ) || defined( _WIN32 ) From owner-svn-src-head@FreeBSD.ORG Mon Apr 19 16:35:48 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 591DF1065672; Mon, 19 Apr 2010 16:35:48 +0000 (UTC) (envelope-from luigi@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 481FD8FC1D; Mon, 19 Apr 2010 16:35:48 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o3JGZmU9055007; Mon, 19 Apr 2010 16:35:48 GMT (envelope-from luigi@svn.freebsd.org) Received: (from luigi@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o3JGZmU4055005; Mon, 19 Apr 2010 16:35:48 GMT (envelope-from luigi@svn.freebsd.org) Message-Id: <201004191635.o3JGZmU4055005@svn.freebsd.org> From: Luigi Rizzo Date: Mon, 19 Apr 2010 16:35:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r206846 - head/sbin/ipfw X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Apr 2010 16:35:48 -0000 Author: luigi Date: Mon Apr 19 16:35:47 2010 New Revision: 206846 URL: http://svn.freebsd.org/changeset/base/206846 Log: fix 64-bit build Reported by: Robert Noland Modified: head/sbin/ipfw/ipfw2.c Modified: head/sbin/ipfw/ipfw2.c ============================================================================== --- head/sbin/ipfw/ipfw2.c Mon Apr 19 16:17:30 2010 (r206845) +++ head/sbin/ipfw/ipfw2.c Mon Apr 19 16:35:47 2010 (r206846) @@ -328,9 +328,11 @@ pr_u64(uint64_t *pd, int width) #else #define U64_FMT "llu" #endif - uint64_t d; + uint64_t u; + unsigned long long d; - bcopy (pd, &d, sizeof(d)); + bcopy (pd, &u, sizeof(u)); + d = u; return (width > 0) ? printf("%*" U64_FMT " ", width, d) : snprintf(NULL, 0, "%" U64_FMT, d) ; From owner-svn-src-head@FreeBSD.ORG Mon Apr 19 16:36:59 2010 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BD8AF1065676; Mon, 19 Apr 2010 16:36:59 +0000 (UTC) (envelope-from luigi@onelab2.iet.unipi.it) Received: from onelab2.iet.unipi.it (onelab2.iet.unipi.it [131.114.59.238]) by mx1.freebsd.org (Postfix) with ESMTP id 7B4598FC28; Mon, 19 Apr 2010 16:36:59 +0000 (UTC) Received: by onelab2.iet.unipi.it (Postfix, from userid 275) id 671F073098; Mon, 19 Apr 2010 18:47:32 +0200 (CEST) Date: Mon, 19 Apr 2010 18:47:32 +0200 From: Luigi Rizzo To: Robert Noland Message-ID: <20100419164732.GA51318@onelab2.iet.unipi.it> References: <201004191511.o3JFBjLj036350@svn.freebsd.org> <4BCC7E64.4040200@FreeBSD.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4BCC7E64.4040200@FreeBSD.org> User-Agent: Mutt/1.4.2.3i Cc: svn-src-head@FreeBSD.org, Luigi Rizzo , src-committers@FreeBSD.org, svn-src-all@FreeBSD.org Subject: Re: svn commit: r206843 - head/sbin/ipfw X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Apr 2010 16:36:59 -0000 On Mon, Apr 19, 2010 at 11:01:40AM -0500, Robert Noland wrote: ... > >+#ifdef TCC > >+#define U64_FMT "I64" > >+#else > >+#define U64_FMT "llu" > > This is broken on amd64. It either needs casting or the following patch... thanks, i prefer passing through an unsigned long long as in the previous version because %ju seems less portable than %llu cheers luigi From owner-svn-src-head@FreeBSD.ORG Mon Apr 19 17:16:23 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A8816106564A; Mon, 19 Apr 2010 17:16:23 +0000 (UTC) (envelope-from rpaulo@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 972068FC1A; Mon, 19 Apr 2010 17:16:23 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o3JHGNon064023; Mon, 19 Apr 2010 17:16:23 GMT (envelope-from rpaulo@svn.freebsd.org) Received: (from rpaulo@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o3JHGN33064021; Mon, 19 Apr 2010 17:16:23 GMT (envelope-from rpaulo@svn.freebsd.org) Message-Id: <201004191716.o3JHGN33064021@svn.freebsd.org> From: Rui Paulo Date: Mon, 19 Apr 2010 17:16:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r206848 - head/tools/tools/ath/common X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Apr 2010 17:16:23 -0000 Author: rpaulo Date: Mon Apr 19 17:16:23 2010 New Revision: 206848 URL: http://svn.freebsd.org/changeset/base/206848 Log: Dump the AR_PHY_TURBO register on the AR5416. This register holds 11n configurations. Sponsored by: iXsystems, inc. Modified: head/tools/tools/ath/common/dumpregs_5416.c Modified: head/tools/tools/ath/common/dumpregs_5416.c ============================================================================== --- head/tools/tools/ath/common/dumpregs_5416.c Mon Apr 19 16:59:01 2010 (r206847) +++ head/tools/tools/ath/common/dumpregs_5416.c Mon Apr 19 17:16:23 2010 (r206848) @@ -394,6 +394,7 @@ static struct dumpreg ar5416regs[] = { DEFBASIC(AR_SLP_CNT, "SLPCNT"), DEFBASIC(AR_SLP_MIB_CTRL, "SLPMIB"), DEFBASIC(AR_EXTRCCNT, "EXTRCCNT"), + DEFBASIC(AR_PHY_TURBO, "PHYTURBO"), DEFVOID(AR_PHY_ADC_SERIAL_CTL, "PHY_ADC_SERIAL_CTL"), From owner-svn-src-head@FreeBSD.ORG Mon Apr 19 20:07:35 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B35C21065670; Mon, 19 Apr 2010 20:07:35 +0000 (UTC) (envelope-from jh@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 8908B8FC13; Mon, 19 Apr 2010 20:07:35 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o3JK7ZDK002568; Mon, 19 Apr 2010 20:07:35 GMT (envelope-from jh@svn.freebsd.org) Received: (from jh@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o3JK7Zsc002566; Mon, 19 Apr 2010 20:07:35 GMT (envelope-from jh@svn.freebsd.org) Message-Id: <201004192007.o3JK7Zsc002566@svn.freebsd.org> From: Jaakko Heinonen Date: Mon, 19 Apr 2010 20:07:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r206859 - head/sys/geom X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Apr 2010 20:07:35 -0000 Author: jh Date: Mon Apr 19 20:07:35 2010 New Revision: 206859 URL: http://svn.freebsd.org/changeset/base/206859 Log: Fix ddb(4) "show geom addr" command when INVARIANTS is enabled. Don't assert that the topology lock is held when g_valid_obj() is called from debugger. MFC after: 1 week Modified: head/sys/geom/geom_subr.c Modified: head/sys/geom/geom_subr.c ============================================================================== --- head/sys/geom/geom_subr.c Mon Apr 19 19:50:39 2010 (r206858) +++ head/sys/geom/geom_subr.c Mon Apr 19 20:07:35 2010 (r206859) @@ -59,6 +59,10 @@ __FBSDID("$FreeBSD$"); #include #endif +#ifdef KDB +#include +#endif + struct class_list_head g_classes = LIST_HEAD_INITIALIZER(g_classes); static struct g_tailq_head geoms = TAILQ_HEAD_INITIALIZER(geoms); char *g_wait_event, *g_wait_up, *g_wait_down, *g_wait_sim; @@ -1011,12 +1015,11 @@ g_getattr__(const char *attr, struct g_c #if defined(DIAGNOSTIC) || defined(DDB) /* - * This function walks (topologically unsafely) the mesh and return a - * non-zero integer if it finds the argument pointer is an object. - * The return value indicates which type of object it is belived to be. - * If topology is not locked, this function is potentially dangerous, - * but since it is for debugging purposes and can be useful for instance - * from DDB, we do not assert topology lock is held. + * This function walks the mesh and returns a non-zero integer if it + * finds the argument pointer is an object. The return value indicates + * which type of object it is believed to be. If topology is not locked, + * this function is potentially dangerous, but we don't assert that the + * topology lock is held when called from debugger. */ int g_valid_obj(void const *ptr) @@ -1026,7 +1029,10 @@ g_valid_obj(void const *ptr) struct g_consumer *cp; struct g_provider *pp; - g_topology_assert(); +#ifdef KDB + if (kdb_active == 0) +#endif + g_topology_assert(); LIST_FOREACH(mp, &g_classes, class) { if (ptr == mp) From owner-svn-src-head@FreeBSD.ORG Mon Apr 19 20:59:40 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 056D1106566C; Mon, 19 Apr 2010 20:59:40 +0000 (UTC) (envelope-from edwin@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E71808FC18; Mon, 19 Apr 2010 20:59:39 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o3JKxdd1014460; Mon, 19 Apr 2010 20:59:39 GMT (envelope-from edwin@svn.freebsd.org) Received: (from edwin@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o3JKxdrK014455; Mon, 19 Apr 2010 20:59:39 GMT (envelope-from edwin@svn.freebsd.org) Message-Id: <201004192059.o3JKxdrK014455@svn.freebsd.org> From: Edwin Groothuis Date: Mon, 19 Apr 2010 20:59:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r206868 - head/contrib/tzdata X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Apr 2010 20:59:40 -0000 Author: edwin Date: Mon Apr 19 20:59:39 2010 New Revision: 206868 URL: http://svn.freebsd.org/changeset/base/206868 Log: MFV of tzdata2010i, r206865 - Marocco does have DST this year between May and August. - Historical data for Taiwan - Argentina / San Luis does not do DST this year. Modified: head/contrib/tzdata/africa head/contrib/tzdata/asia head/contrib/tzdata/southamerica Directory Properties: head/contrib/tzdata/ (props changed) Modified: head/contrib/tzdata/africa ============================================================================== --- head/contrib/tzdata/africa Mon Apr 19 20:56:04 2010 (r206867) +++ head/contrib/tzdata/africa Mon Apr 19 20:59:39 2010 (r206868) @@ -1,5 +1,5 @@ #
-# @(#)africa	8.23
+# @(#)africa	8.26
 # This file is in the public domain, so clarified as of
 # 2009-05-17 by Arthur David Olson.
 
@@ -680,6 +680,21 @@ Zone	Indian/Mayotte	3:00:56 -	LMT	1911 J
 # http://www.worldtimezone.com/dst_news/dst_news_morocco03.html
 # 
 
+# From Steffen Thorsen (2010-04-13):
+# Several news media in Morocco report that the Ministry of Modernization
+# of Public Sectors has announced that Morocco will have DST from
+# 2010-05-02 to 2010-08-08.
+#
+# Example:
+# 
+# http://www.lavieeco.com/actualites/4099-le-maroc-passera-a-l-heure-d-ete-gmt1-le-2-mai.html
+# 
+# (French)
+# Our page:
+# 
+# http://www.timeanddate.com/news/time/morocco-starts-dst-2010.html
+# 
+
 # RULE	NAME	FROM	TO	TYPE	IN	ON	AT	SAVE	LETTER/S
 
 Rule	Morocco	1939	only	-	Sep	12	 0:00	1:00	S
@@ -701,6 +716,8 @@ Rule	Morocco	2008	only	-	Jun	 1	 0:00	1:
 Rule	Morocco	2008	only	-	Sep	 1	 0:00	0	-
 Rule	Morocco	2009	only	-	Jun	 1	 0:00	1:00	S
 Rule	Morocco	2009	only	-	Aug	 21	 0:00	0	-
+Rule	Morocco	2010	only	-	May	 2	 0:00	1:00	S
+Rule	Morocco	2010	only	-	Aug	 8	 0:00	0	-
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
 Zone Africa/Casablanca	-0:30:20 -	LMT	1913 Oct 26
 			 0:00	Morocco	WE%sT	1984 Mar 16
@@ -942,6 +959,24 @@ Zone	Africa/Lome	0:04:52 -	LMT	1893
 # Therefore, the standard time will be kept unchanged the whole year long."
 # So foregoing DST seems to be an exception (albeit one that may be repeated in the  future).
 
+# From Alexander Krivenyshev (2010-03-27):
+# According to some news reports Tunis confirmed not to use DST in 2010
+#
+# (translation):
+# "The Tunisian government has decided to abandon DST, which was scheduled on
+# Sunday...
+# Tunisian authorities had suspended the DST for the first time last year also
+# coincided with the month of Ramadan..."
+#
+# (in Arabic)
+# 
+# http://www.moheet.com/show_news.aspx?nid=358861&pg=1
+# 
+# http://www.almadenahnews.com/newss/news.php?c=118&id=38036
+# or
+# 
+# http://www.worldtimezone.com/dst_news/dst_news_tunis02.html
+
 # Rule	NAME	FROM	TO	TYPE	IN	ON	AT	SAVE	LETTER/S
 Rule	Tunisia	1939	only	-	Apr	15	23:00s	1:00	S
 Rule	Tunisia	1939	only	-	Nov	18	23:00s	0	-
@@ -968,8 +1003,7 @@ Rule	Tunisia	2005	only	-	May	 1	 0:00s	1
 Rule	Tunisia	2005	only	-	Sep	30	 1:00s	0	-
 Rule	Tunisia	2006	2008	-	Mar	lastSun	 2:00s	1:00	S
 Rule	Tunisia	2006	2008	-	Oct	lastSun	 2:00s	0	-
-Rule	Tunisia	2010	max	-	Mar	lastSun	 2:00s	1:00	S
-Rule	Tunisia	2010	max	-	Oct	lastSun	 2:00s	0	-
+
 # Shanks & Pottenger give 0:09:20 for Paris Mean Time; go with Howse's
 # more precise 0:09:21.
 # Shanks & Pottenger say the 1911 switch was on Mar 9; go with Howse's Mar 11.

Modified: head/contrib/tzdata/asia
==============================================================================
--- head/contrib/tzdata/asia	Mon Apr 19 20:56:04 2010	(r206867)
+++ head/contrib/tzdata/asia	Mon Apr 19 20:59:39 2010	(r206868)
@@ -1,4 +1,4 @@
-# @(#)asia	8.58
+# @(#)asia	8.60
 # This file is in the public domain, so clarified as of
 # 2009-05-17 by Arthur David Olson.
 
@@ -566,6 +566,28 @@ Zone	Asia/Hong_Kong	7:36:36 -	LMT	1904 O
 # was still controlled by Japan.  This is hard to believe, but we don't
 # have any other information.
 
+# From smallufo (2010-04-03):
+# According to Taiwan's CWB,
+# 
+# http://www.cwb.gov.tw/V6/astronomy/cdata/summert.htm
+# 
+# Taipei has DST in 1979 between July 1st and Sep 30.
+
+# From Arthur David Olson (2010-04-07):
+# Here's Google's translation of the table at the bottom of the "summert.htm" page:
+# Decade 	                                                    Name                      Start and end date
+# Republic of China 34 years to 40 years (AD 1945-1951 years) Summer Time               May 1 to September 30 
+# 41 years of the Republic of China (AD 1952)                 Daylight Saving Time      March 1 to October 31 
+# Republic of China 42 years to 43 years (AD 1953-1954 years) Daylight Saving Time      April 1 to October 31 
+# In the 44 years to 45 years (AD 1955-1956 years)            Daylight Saving Time      April 1 to September 30 
+# Republic of China 46 years to 48 years (AD 1957-1959)       Summer Time               April 1 to September 30 
+# Republic of China 49 years to 50 years (AD 1960-1961)       Summer Time               June 1 to September 30 
+# Republic of China 51 years to 62 years (AD 1962-1973 years) Stop Summer Time 
+# Republic of China 63 years to 64 years (1974-1975 AD)       Daylight Saving Time      April 1 to September 30 
+# Republic of China 65 years to 67 years (1976-1978 AD)       Stop Daylight Saving Time 
+# Republic of China 68 years (AD 1979)                        Daylight Saving Time      July 1 to September 30 
+# Republic of China since 69 years (AD 1980)                  Stop Daylight Saving Time
+
 # Rule	NAME	FROM	TO	TYPE	IN	ON	AT	SAVE	LETTER/S
 Rule	Taiwan	1945	1951	-	May	1	0:00	1:00	D
 Rule	Taiwan	1945	1951	-	Oct	1	0:00	0	S
@@ -576,8 +598,9 @@ Rule	Taiwan	1955	1961	-	Oct	1	0:00	0	S
 Rule	Taiwan	1960	1961	-	Jun	1	0:00	1:00	D
 Rule	Taiwan	1974	1975	-	Apr	1	0:00	1:00	D
 Rule	Taiwan	1974	1975	-	Oct	1	0:00	0	S
-Rule	Taiwan	1980	only	-	Jun	30	0:00	1:00	D
-Rule	Taiwan	1980	only	-	Sep	30	0:00	0	S
+Rule	Taiwan	1979	only	-	Jun	30	0:00	1:00	D
+Rule	Taiwan	1979	only	-	Sep	30	0:00	0	S
+
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
 Zone	Asia/Taipei	8:06:00 -	LMT	1896 # or Taibei or T'ai-pei
 			8:00	Taiwan	C%sT
@@ -1912,13 +1935,35 @@ Zone	Asia/Muscat	3:54:20 -	LMT	1920
 # [T]he German Consulate General in Karachi reported me today that Pakistan
 # will go back to standard time on 1st of November.
 
+# From Steffen Thorsen (2010-03-26):
+# Steffen Thorsen wrote:
+# > On Thursday (2010-03-25) it was announced that DST would start in
+# > Pakistan on 2010-04-01.
+# >
+# > Then today, the president said that they might have to revert the
+# > decision if it is not supported by the parliament. So at the time
+# > being, it seems unclear if DST will be actually observed or not - but
+# > April 1 could be a more likely date than April 15.
+# Now, it seems that the decision to not observe DST in final:
+#
+# "Govt Withdraws Plan To Advance Clocks"
+# 
+# http://www.apakistannews.com/govt-withdraws-plan-to-advance-clocks-172041
+# 
+#
+# "People laud PM's announcement to end DST"
+# 
+# http://www.app.com.pk/en_/index.php?option=com_content&task=view&id=99374&Itemid=2
+# 
+
 # Rule	NAME	FROM	TO	TYPE	IN	ON	AT	SAVE	LETTER/S
 Rule Pakistan	2002	only	-	Apr	Sun>=2	0:01	1:00	S
 Rule Pakistan	2002	only	-	Oct	Sun>=2	0:01	0	-
 Rule Pakistan	2008	only	-	Jun	1	0:00	1:00	S
 Rule Pakistan	2008	only	-	Nov	1	0:00	0	-
-Rule Pakistan	2009	max	-	Apr	15	0:00	1:00	S
-Rule Pakistan	2009	max	-	Nov	1	0:00	0	-
+Rule Pakistan	2009	only	-	Apr	15	0:00	1:00	S
+Rule Pakistan	2009	only	-	Nov	1	0:00	0	-
+
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
 Zone	Asia/Karachi	4:28:12 -	LMT	1907
 			5:30	-	IST	1942 Sep

Modified: head/contrib/tzdata/southamerica
==============================================================================
--- head/contrib/tzdata/southamerica	Mon Apr 19 20:56:04 2010	(r206867)
+++ head/contrib/tzdata/southamerica	Mon Apr 19 20:59:39 2010	(r206868)
@@ -1,5 +1,5 @@
 # 
-# @(#)southamerica	8.43
+# @(#)southamerica	8.44
 # This file is in the public domain, so clarified as of
 # 2009-05-17 by Arthur David Olson.
 
@@ -437,6 +437,27 @@ Rule	Arg	2008	only	-	Oct	Sun>=15	0:00	1:
 # of the country calls it "ART".
 # ...
 
+# From Alexander Krivenyshev (2010-04-09):
+# According to news reports from El Diario de la Republica Province San
+# Luis, Argentina (standard time UTC-04) will keep Daylight Saving Time
+# after April 11, 2010--will continue to have same time as rest of
+# Argentina (UTC-3) (no DST).
+#
+# Confirmaron la prórroga del huso horario de verano (Spanish)
+# 
+# http://www.eldiariodelarepublica.com/index.php?option=com_content&task=view&id=29383&Itemid=9
+# 
+# or (some English translation):
+# 
+# http://www.worldtimezone.com/dst_news/dst_news_argentina08.html
+# 
+
+# From Mariano Absatz (2010-04-12):
+# yes...I can confirm this...and given that San Luis keeps calling
+# UTC-03:00 "summer time", we should't just let San Luis go back to "Arg"
+# rules...San Luis is still using "Western ARgentina Time" and it got
+# stuck on Summer daylight savings time even though the summer is over.
+
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
 #
 # Buenos Aires (BA), Capital Federal (CF),
@@ -570,8 +591,8 @@ Zone America/Argentina/Mendoza -4:35:16 
 #
 # San Luis (SL)
 
-Rule	SanLuis	2008	max	-	Mar	Sun>=8	0:00	0	-
-Rule	SanLuis	2007	max	-	Oct	Sun>=8	0:00	1:00	S
+Rule	SanLuis	2008	2009	-	Mar	Sun>=8	0:00	0	-
+Rule	SanLuis	2007	2009	-	Oct	Sun>=8	0:00	1:00	S
 
 Zone America/Argentina/San_Luis -4:25:24 - LMT	1894 Oct 31
 			-4:16:48 -	CMT	1920 May

From owner-svn-src-head@FreeBSD.ORG  Mon Apr 19 22:10:40 2010
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id C6372106566B;
	Mon, 19 Apr 2010 22:10:40 +0000 (UTC)
	(envelope-from yongari@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id B3D898FC14;
	Mon, 19 Apr 2010 22:10:40 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o3JMAe8a030474;
	Mon, 19 Apr 2010 22:10:40 GMT (envelope-from yongari@svn.freebsd.org)
Received: (from yongari@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o3JMAeHY030467;
	Mon, 19 Apr 2010 22:10:40 GMT (envelope-from yongari@svn.freebsd.org)
Message-Id: <201004192210.o3JMAeHY030467@svn.freebsd.org>
From: Pyun YongHyeon 
Date: Mon, 19 Apr 2010 22:10:40 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r206876 - in head/sys/dev: age alc ale fxp msk nfe
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Mon, 19 Apr 2010 22:10:40 -0000

Author: yongari
Date: Mon Apr 19 22:10:40 2010
New Revision: 206876
URL: http://svn.freebsd.org/changeset/base/206876

Log:
  With r206844, CSUM_TCP is also set for CSUM_TSO case. Modify
  drivers to take into account for the change. Basically CSUM_TSO
  should be checked before checking CSUM_TCP.

Modified:
  head/sys/dev/age/if_age.c
  head/sys/dev/alc/if_alc.c
  head/sys/dev/ale/if_ale.c
  head/sys/dev/fxp/if_fxp.c
  head/sys/dev/msk/if_msk.c
  head/sys/dev/nfe/if_nfe.c

Modified: head/sys/dev/age/if_age.c
==============================================================================
--- head/sys/dev/age/if_age.c	Mon Apr 19 22:01:59 2010	(r206875)
+++ head/sys/dev/age/if_age.c	Mon Apr 19 22:10:40 2010	(r206876)
@@ -1629,22 +1629,8 @@ age_encap(struct age_softc *sc, struct m
 	}
 
 	m = *m_head;
-	/* Configure Tx IP/TCP/UDP checksum offload. */
-	if ((m->m_pkthdr.csum_flags & AGE_CSUM_FEATURES) != 0) {
-		cflags |= AGE_TD_CSUM;
-		if ((m->m_pkthdr.csum_flags & CSUM_TCP) != 0)
-			cflags |= AGE_TD_TCPCSUM;
-		if ((m->m_pkthdr.csum_flags & CSUM_UDP) != 0)
-			cflags |= AGE_TD_UDPCSUM;
-		/* Set checksum start offset. */
-		cflags |= (poff << AGE_TD_CSUM_PLOADOFFSET_SHIFT);
-		/* Set checksum insertion position of TCP/UDP. */
-		cflags |= ((poff + m->m_pkthdr.csum_data) <<
-		    AGE_TD_CSUM_XSUMOFFSET_SHIFT);
-	}
-
-	/* Configure TSO. */
 	if ((m->m_pkthdr.csum_flags & CSUM_TSO) != 0) {
+		/* Configure TSO. */
 		if (poff + (tcp->th_off << 2) == m->m_pkthdr.len) {
 			/* Not TSO but IP/TCP checksum offload. */
 			cflags |= AGE_TD_IPCSUM | AGE_TD_TCPCSUM;
@@ -1660,6 +1646,18 @@ age_encap(struct age_softc *sc, struct m
 		/* Set IP/TCP header size. */
 		cflags |= ip->ip_hl << AGE_TD_IPHDR_LEN_SHIFT;
 		cflags |= tcp->th_off << AGE_TD_TSO_TCPHDR_LEN_SHIFT;
+	} else if ((m->m_pkthdr.csum_flags & AGE_CSUM_FEATURES) != 0) {
+		/* Configure Tx IP/TCP/UDP checksum offload. */
+		cflags |= AGE_TD_CSUM;
+		if ((m->m_pkthdr.csum_flags & CSUM_TCP) != 0)
+			cflags |= AGE_TD_TCPCSUM;
+		if ((m->m_pkthdr.csum_flags & CSUM_UDP) != 0)
+			cflags |= AGE_TD_UDPCSUM;
+		/* Set checksum start offset. */
+		cflags |= (poff << AGE_TD_CSUM_PLOADOFFSET_SHIFT);
+		/* Set checksum insertion position of TCP/UDP. */
+		cflags |= ((poff + m->m_pkthdr.csum_data) <<
+		    AGE_TD_CSUM_XSUMOFFSET_SHIFT);
 	}
 
 	/* Configure VLAN hardware tag insertion. */

Modified: head/sys/dev/alc/if_alc.c
==============================================================================
--- head/sys/dev/alc/if_alc.c	Mon Apr 19 22:01:59 2010	(r206875)
+++ head/sys/dev/alc/if_alc.c	Mon Apr 19 22:10:40 2010	(r206876)
@@ -1908,28 +1908,7 @@ alc_encap(struct alc_softc *sc, struct m
 		vtag = (vtag << TD_VLAN_SHIFT) & TD_VLAN_MASK;
 		cflags |= TD_INS_VLAN_TAG;
 	}
-	/* Configure Tx checksum offload. */
-	if ((m->m_pkthdr.csum_flags & ALC_CSUM_FEATURES) != 0) {
-#ifdef ALC_USE_CUSTOM_CSUM
-		cflags |= TD_CUSTOM_CSUM;
-		/* Set checksum start offset. */
-		cflags |= ((poff >> 1) << TD_PLOAD_OFFSET_SHIFT) &
-		    TD_PLOAD_OFFSET_MASK;
-		/* Set checksum insertion position of TCP/UDP. */
-		cflags |= (((poff + m->m_pkthdr.csum_data) >> 1) <<
-		    TD_CUSTOM_CSUM_OFFSET_SHIFT) & TD_CUSTOM_CSUM_OFFSET_MASK;
-#else
-		if ((m->m_pkthdr.csum_flags & CSUM_IP) != 0)
-			cflags |= TD_IPCSUM;
-		if ((m->m_pkthdr.csum_flags & CSUM_TCP) != 0)
-			cflags |= TD_TCPCSUM;
-		if ((m->m_pkthdr.csum_flags & CSUM_UDP) != 0)
-			cflags |= TD_UDPCSUM;
-		/* Set TCP/UDP header offset. */
-		cflags |= (poff << TD_L4HDR_OFFSET_SHIFT) &
-		    TD_L4HDR_OFFSET_MASK;
-#endif
-	} else if ((m->m_pkthdr.csum_flags & CSUM_TSO) != 0) {
+	if ((m->m_pkthdr.csum_flags & CSUM_TSO) != 0) {
 		/* Request TSO and set MSS. */
 		cflags |= TD_TSO | TD_TSO_DESCV1;
 		cflags |= ((uint32_t)m->m_pkthdr.tso_segsz << TD_MSS_SHIFT) &
@@ -1961,6 +1940,27 @@ alc_encap(struct alc_softc *sc, struct m
 		}
 		/* Handle remaining fragments. */
 		idx = 1;
+	} else if ((m->m_pkthdr.csum_flags & ALC_CSUM_FEATURES) != 0) {
+		/* Configure Tx checksum offload. */
+#ifdef ALC_USE_CUSTOM_CSUM
+		cflags |= TD_CUSTOM_CSUM;
+		/* Set checksum start offset. */
+		cflags |= ((poff >> 1) << TD_PLOAD_OFFSET_SHIFT) &
+		    TD_PLOAD_OFFSET_MASK;
+		/* Set checksum insertion position of TCP/UDP. */
+		cflags |= (((poff + m->m_pkthdr.csum_data) >> 1) <<
+		    TD_CUSTOM_CSUM_OFFSET_SHIFT) & TD_CUSTOM_CSUM_OFFSET_MASK;
+#else
+		if ((m->m_pkthdr.csum_flags & CSUM_IP) != 0)
+			cflags |= TD_IPCSUM;
+		if ((m->m_pkthdr.csum_flags & CSUM_TCP) != 0)
+			cflags |= TD_TCPCSUM;
+		if ((m->m_pkthdr.csum_flags & CSUM_UDP) != 0)
+			cflags |= TD_UDPCSUM;
+		/* Set TCP/UDP header offset. */
+		cflags |= (poff << TD_L4HDR_OFFSET_SHIFT) &
+		    TD_L4HDR_OFFSET_MASK;
+#endif
 	}
 	for (; idx < nsegs; idx++) {
 		desc = &sc->alc_rdata.alc_tx_ring[prod];

Modified: head/sys/dev/ale/if_ale.c
==============================================================================
--- head/sys/dev/ale/if_ale.c	Mon Apr 19 22:01:59 2010	(r206875)
+++ head/sys/dev/ale/if_ale.c	Mon Apr 19 22:10:40 2010	(r206876)
@@ -1737,8 +1737,14 @@ ale_encap(struct ale_softc *sc, struct m
 	bus_dmamap_sync(sc->ale_cdata.ale_tx_tag, map, BUS_DMASYNC_PREWRITE);
 
 	m = *m_head;
-	/* Configure Tx checksum offload. */
-	if ((m->m_pkthdr.csum_flags & ALE_CSUM_FEATURES) != 0) {
+	if ((m->m_pkthdr.csum_flags & CSUM_TSO) != 0) {
+		/* Request TSO and set MSS. */
+		cflags |= ALE_TD_TSO;
+		cflags |= ((uint32_t)m->m_pkthdr.tso_segsz << ALE_TD_MSS_SHIFT);
+		/* Set IP/TCP header size. */
+		cflags |= ip->ip_hl << ALE_TD_IPHDR_LEN_SHIFT;
+		cflags |= tcp->th_off << ALE_TD_TCPHDR_LEN_SHIFT;
+	} else if ((m->m_pkthdr.csum_flags & ALE_CSUM_FEATURES) != 0) {
 		/*
 		 * AR81xx supports Tx custom checksum offload feature
 		 * that offloads single 16bit checksum computation.
@@ -1769,15 +1775,6 @@ ale_encap(struct ale_softc *sc, struct m
 		    ALE_TD_CSUM_XSUMOFFSET_SHIFT);
 	}
 
-	if ((m->m_pkthdr.csum_flags & CSUM_TSO) != 0) {
-		/* Request TSO and set MSS. */
-		cflags |= ALE_TD_TSO;
-		cflags |= ((uint32_t)m->m_pkthdr.tso_segsz << ALE_TD_MSS_SHIFT);
-		/* Set IP/TCP header size. */
-		cflags |= ip->ip_hl << ALE_TD_IPHDR_LEN_SHIFT;
-		cflags |= tcp->th_off << ALE_TD_TCPHDR_LEN_SHIFT;
-	}
-
 	/* Configure VLAN hardware tag insertion. */
 	if ((m->m_flags & M_VLANTAG) != 0) {
 		vtag = ALE_TX_VLAN_TAG(m->m_pkthdr.ether_vtag);

Modified: head/sys/dev/fxp/if_fxp.c
==============================================================================
--- head/sys/dev/fxp/if_fxp.c	Mon Apr 19 22:01:59 2010	(r206875)
+++ head/sys/dev/fxp/if_fxp.c	Mon Apr 19 22:10:40 2010	(r206876)
@@ -1417,60 +1417,6 @@ fxp_encap(struct fxp_softc *sc, struct m
 		    FXP_IPCB_HARDWAREPARSING_ENABLE;
 
 	m = *m_head;
-	/*
-	 * Deal with TCP/IP checksum offload. Note that
-	 * in order for TCP checksum offload to work,
-	 * the pseudo header checksum must have already
-	 * been computed and stored in the checksum field
-	 * in the TCP header. The stack should have
-	 * already done this for us.
-	 */
-	if (m->m_pkthdr.csum_flags & FXP_CSUM_FEATURES) {
-		txp->tx_cb->ipcb_ip_schedule = FXP_IPCB_TCPUDP_CHECKSUM_ENABLE;
-		if (m->m_pkthdr.csum_flags & CSUM_TCP)
-			txp->tx_cb->ipcb_ip_schedule |= FXP_IPCB_TCP_PACKET;
-
-#ifdef FXP_IP_CSUM_WAR
-		/*
-		 * XXX The 82550 chip appears to have trouble
-		 * dealing with IP header checksums in very small
-		 * datagrams, namely fragments from 1 to 3 bytes
-		 * in size. For example, say you want to transmit
-		 * a UDP packet of 1473 bytes. The packet will be
-		 * fragmented over two IP datagrams, the latter
-		 * containing only one byte of data. The 82550 will
-		 * botch the header checksum on the 1-byte fragment.
-		 * As long as the datagram contains 4 or more bytes
-		 * of data, you're ok.
-		 *
-                 * The following code attempts to work around this
-		 * problem: if the datagram is less than 38 bytes
-		 * in size (14 bytes ether header, 20 bytes IP header,
-		 * plus 4 bytes of data), we punt and compute the IP
-		 * header checksum by hand. This workaround doesn't
-		 * work very well, however, since it can be fooled
-		 * by things like VLAN tags and IP options that make
-		 * the header sizes/offsets vary.
-		 */
-
-		if (m->m_pkthdr.csum_flags & CSUM_IP) {
-			if (m->m_pkthdr.len < 38) {
-				struct ip *ip;
-				m->m_data += ETHER_HDR_LEN;
-				ip = mtod(m, struct ip *);
-				ip->ip_sum = in_cksum(m, ip->ip_hl << 2);
-				m->m_data -= ETHER_HDR_LEN;
-				m->m_pkthdr.csum_flags &= ~CSUM_IP;
-			} else {
-				txp->tx_cb->ipcb_ip_activation_high =
-				    FXP_IPCB_HARDWAREPARSING_ENABLE;
-				txp->tx_cb->ipcb_ip_schedule |=
-				    FXP_IPCB_IP_CHECKSUM_ENABLE;
-			}
-		}
-#endif
-	}
-
 	if (m->m_pkthdr.csum_flags & CSUM_TSO) {
 		/*
 		 * 82550/82551 requires ethernet/IP/TCP headers must be
@@ -1539,6 +1485,58 @@ fxp_encap(struct fxp_softc *sc, struct m
 		tcp_payload = m->m_pkthdr.len - ip_off - (ip->ip_hl << 2);
 		tcp_payload -= tcp->th_off << 2;
 		*m_head = m;
+	} else if (m->m_pkthdr.csum_flags & FXP_CSUM_FEATURES) {
+		/*
+		 * Deal with TCP/IP checksum offload. Note that
+		 * in order for TCP checksum offload to work,
+		 * the pseudo header checksum must have already
+		 * been computed and stored in the checksum field
+		 * in the TCP header. The stack should have
+		 * already done this for us.
+		 */
+		txp->tx_cb->ipcb_ip_schedule = FXP_IPCB_TCPUDP_CHECKSUM_ENABLE;
+		if (m->m_pkthdr.csum_flags & CSUM_TCP)
+			txp->tx_cb->ipcb_ip_schedule |= FXP_IPCB_TCP_PACKET;
+
+#ifdef FXP_IP_CSUM_WAR
+		/*
+		 * XXX The 82550 chip appears to have trouble
+		 * dealing with IP header checksums in very small
+		 * datagrams, namely fragments from 1 to 3 bytes
+		 * in size. For example, say you want to transmit
+		 * a UDP packet of 1473 bytes. The packet will be
+		 * fragmented over two IP datagrams, the latter
+		 * containing only one byte of data. The 82550 will
+		 * botch the header checksum on the 1-byte fragment.
+		 * As long as the datagram contains 4 or more bytes
+		 * of data, you're ok.
+		 *
+                 * The following code attempts to work around this
+		 * problem: if the datagram is less than 38 bytes
+		 * in size (14 bytes ether header, 20 bytes IP header,
+		 * plus 4 bytes of data), we punt and compute the IP
+		 * header checksum by hand. This workaround doesn't
+		 * work very well, however, since it can be fooled
+		 * by things like VLAN tags and IP options that make
+		 * the header sizes/offsets vary.
+		 */
+
+		if (m->m_pkthdr.csum_flags & CSUM_IP) {
+			if (m->m_pkthdr.len < 38) {
+				struct ip *ip;
+				m->m_data += ETHER_HDR_LEN;
+				ip = mtod(m, struct ip *);
+				ip->ip_sum = in_cksum(m, ip->ip_hl << 2);
+				m->m_data -= ETHER_HDR_LEN;
+				m->m_pkthdr.csum_flags &= ~CSUM_IP;
+			} else {
+				txp->tx_cb->ipcb_ip_activation_high =
+				    FXP_IPCB_HARDWAREPARSING_ENABLE;
+				txp->tx_cb->ipcb_ip_schedule |=
+				    FXP_IPCB_IP_CHECKSUM_ENABLE;
+			}
+		}
+#endif
 	}
 
 	error = bus_dmamap_load_mbuf_sg(sc->fxp_txmtag, txp->tx_map, *m_head,

Modified: head/sys/dev/msk/if_msk.c
==============================================================================
--- head/sys/dev/msk/if_msk.c	Mon Apr 19 22:01:59 2010	(r206875)
+++ head/sys/dev/msk/if_msk.c	Mon Apr 19 22:10:40 2010	(r206876)
@@ -2605,23 +2605,32 @@ msk_encap(struct msk_if_softc *sc_if, st
 		ip = (struct ip *)(mtod(m, char *) + offset);
 		offset += (ip->ip_hl << 2);
 		tcp_offset = offset;
-		/*
-		 * It seems that Yukon II has Tx checksum offload bug for
-		 * small TCP packets that's less than 60 bytes in size
-		 * (e.g. TCP window probe packet, pure ACK packet).
-		 * Common work around like padding with zeros to make the
-		 * frame minimum ethernet frame size didn't work at all.
-		 * Instead of disabling checksum offload completely we
-		 * resort to S/W checksum routine when we encounter short
-		 * TCP frames.
-		 * Short UDP packets appear to be handled correctly by
-		 * Yukon II. Also I assume this bug does not happen on
-		 * controllers that use newer descriptor format or
-		 * automatic Tx checksum calaulcation.
-		 */
-		if ((sc_if->msk_flags & MSK_FLAG_AUTOTX_CSUM) == 0 &&
+		if ((m->m_pkthdr.csum_flags & CSUM_TSO) != 0) {
+			m = m_pullup(m, offset + sizeof(struct tcphdr));
+			if (m == NULL) {
+				*m_head = NULL;
+				return (ENOBUFS);
+			}
+			tcp = (struct tcphdr *)(mtod(m, char *) + offset);
+			offset += (tcp->th_off << 2);
+		} else if ((sc_if->msk_flags & MSK_FLAG_AUTOTX_CSUM) == 0 &&
 		    (m->m_pkthdr.len < MSK_MIN_FRAMELEN) &&
 		    (m->m_pkthdr.csum_flags & CSUM_TCP) != 0) {
+			/*
+			 * It seems that Yukon II has Tx checksum offload bug
+			 * for small TCP packets that's less than 60 bytes in
+			 * size (e.g. TCP window probe packet, pure ACK packet).
+			 * Common work around like padding with zeros to make
+			 * the frame minimum ethernet frame size didn't work at
+			 * all.
+			 * Instead of disabling checksum offload completely we
+			 * resort to S/W checksum routine when we encounter
+			 * short TCP frames.
+			 * Short UDP packets appear to be handled correctly by
+			 * Yukon II. Also I assume this bug does not happen on
+			 * controllers that use newer descriptor format or
+			 * automatic Tx checksum calaulcation.
+			 */
 			m = m_pullup(m, offset + sizeof(struct tcphdr));
 			if (m == NULL) {
 				*m_head = NULL;
@@ -2632,15 +2641,6 @@ msk_encap(struct msk_if_softc *sc_if, st
 			    m->m_pkthdr.len, offset);
 			m->m_pkthdr.csum_flags &= ~CSUM_TCP;
 		}
-		if ((m->m_pkthdr.csum_flags & CSUM_TSO) != 0) {
-			m = m_pullup(m, offset + sizeof(struct tcphdr));
-			if (m == NULL) {
-				*m_head = NULL;
-				return (ENOBUFS);
-			}
-			tcp = (struct tcphdr *)(mtod(m, char *) + offset);
-			offset += (tcp->th_off << 2);
-		}
 		*m_head = m;
 	}
 

Modified: head/sys/dev/nfe/if_nfe.c
==============================================================================
--- head/sys/dev/nfe/if_nfe.c	Mon Apr 19 22:01:59 2010	(r206875)
+++ head/sys/dev/nfe/if_nfe.c	Mon Apr 19 22:10:40 2010	(r206876)
@@ -2366,7 +2366,12 @@ nfe_encap(struct nfe_softc *sc, struct m
 	m = *m_head;
 	cflags = flags = 0;
 	tso_segsz = 0;
-	if ((m->m_pkthdr.csum_flags & NFE_CSUM_FEATURES) != 0) {
+	if ((m->m_pkthdr.csum_flags & CSUM_TSO) != 0) {
+		tso_segsz = (uint32_t)m->m_pkthdr.tso_segsz <<
+		    NFE_TX_TSO_SHIFT;
+		cflags &= ~(NFE_TX_IP_CSUM | NFE_TX_TCP_UDP_CSUM);
+		cflags |= NFE_TX_TSO;
+	} else if ((m->m_pkthdr.csum_flags & NFE_CSUM_FEATURES) != 0) {
 		if ((m->m_pkthdr.csum_flags & CSUM_IP) != 0)
 			cflags |= NFE_TX_IP_CSUM;
 		if ((m->m_pkthdr.csum_flags & CSUM_TCP) != 0)
@@ -2374,12 +2379,6 @@ nfe_encap(struct nfe_softc *sc, struct m
 		if ((m->m_pkthdr.csum_flags & CSUM_UDP) != 0)
 			cflags |= NFE_TX_TCP_UDP_CSUM;
 	}
-	if ((m->m_pkthdr.csum_flags & CSUM_TSO) != 0) {
-		tso_segsz = (uint32_t)m->m_pkthdr.tso_segsz <<
-		    NFE_TX_TSO_SHIFT;
-		cflags &= ~(NFE_TX_IP_CSUM | NFE_TX_TCP_UDP_CSUM);
-		cflags |= NFE_TX_TSO;
-	}
 
 	for (i = 0; i < nsegs; i++) {
 		if (sc->nfe_flags & NFE_40BIT_ADDR) {

From owner-svn-src-head@FreeBSD.ORG  Mon Apr 19 23:12:05 2010
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 5AB02106566C;
	Mon, 19 Apr 2010 23:12:05 +0000 (UTC)
	(envelope-from julianelischer@gmail.com)
Received: from mail-vw0-f54.google.com (mail-vw0-f54.google.com
	[209.85.212.54])
	by mx1.freebsd.org (Postfix) with ESMTP id B78FC8FC0C;
	Mon, 19 Apr 2010 23:12:04 +0000 (UTC)
Received: by vws18 with SMTP id 18so437382vws.13
	for ; Mon, 19 Apr 2010 16:12:03 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma;
	h=domainkey-signature:received:received:sender:message-id:date:from
	:user-agent:mime-version:to:cc:subject:references:in-reply-to
	:content-type:content-transfer-encoding;
	bh=Og/6YkpE3c1nDUyQeFOe1G3BxS6Y357VcAyiDClahHY=;
	b=aalRj3lErwlgrdNAiP8Z9NSPlwvHquPCH1vXqTTUNIlMFbuEZrwZ79dAlCaMSDO/uD
	JIgdvFc6gNUY57YH6AsbG98jMc2155XDY5QE5+fOIq/qGbUh5DMXtC+ROqtYyCptoalf
	5/jA2eD6z3fSk1BRxgkNK/r3RTHxGM8rDaLgA=
DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma;
	h=sender:message-id:date:from:user-agent:mime-version:to:cc:subject
	:references:in-reply-to:content-type:content-transfer-encoding;
	b=P3cC2yq69BaBd17sLZqEaIFXZD8Uy5V9oGm2+y3uFACwdJGEt7X5wrI+jKBD1rqk+r
	00r+RqbnEbrmWRwfAdfEr0mIde2tE78z8mN09NJBTmBLT+NFMfdDOR8ecWBFzXXpymmS
	9WjEmDs+vpA18inYGC6rg8Rpq+H4fVx4y2cew=
Received: by 10.220.128.22 with SMTP id i22mr4044506vcs.20.1271717068482;
	Mon, 19 Apr 2010 15:44:28 -0700 (PDT)
Received: from julian-mac.elischer.org
	(h-67-100-89-137.snfccasy.static.covad.net [67.100.89.137])
	by mx.google.com with ESMTPS id m13sm20659521vcs.13.2010.04.19.15.44.26
	(version=TLSv1/SSLv3 cipher=RC4-MD5);
	Mon, 19 Apr 2010 15:44:27 -0700 (PDT)
Sender: Julian Elischer 
Message-ID: <4BCCDCC9.2070604@elischer.org>
Date: Mon, 19 Apr 2010 15:44:25 -0700
From: Julian Elischer 
User-Agent: Mozilla/5.0 (Macintosh; U; PPC Mac OS X 10.4; en-US;
	rv:1.9.1.9) Gecko/20100317 Thunderbird/3.0.4
MIME-Version: 1.0
To: Robert Noland 
References: <201004191511.o3JFBjLj036350@svn.freebsd.org>
	<4BCC7E64.4040200@FreeBSD.org>
In-Reply-To: <4BCC7E64.4040200@FreeBSD.org>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Cc: svn-src-head@freebsd.org, Luigi Rizzo ,
	src-committers@freebsd.org, svn-src-all@freebsd.org
Subject: Re: svn commit: r206843 - head/sbin/ipfw
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Mon, 19 Apr 2010 23:12:05 -0000

On 4/19/10 9:01 AM, Robert Noland wrote:
>
>
> Luigi Rizzo wrote:


[...]

> Index: sbin/ipfw/ipfw2.c
> ===================================================================
> --- sbin/ipfw/ipfw2.c (revision 206844)
> +++ sbin/ipfw/ipfw2.c (working copy)
> @@ -326,7 +326,7 @@
> #ifdef TCC
> #define U64_FMT "I64"
> #else
> -#define U64_FMT "llu"
> +#define U64_FMT "ju"
> #endif
> uint64_t d;

  believe there is a posix define for this?
(though I can't remember it right now).

>
> robert.

[...]

From owner-svn-src-head@FreeBSD.ORG  Mon Apr 19 23:27:54 2010
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id D6C951065675;
	Mon, 19 Apr 2010 23:27:54 +0000 (UTC)
	(envelope-from attilio@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id AB9478FC19;
	Mon, 19 Apr 2010 23:27:54 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o3JNRsrA047858;
	Mon, 19 Apr 2010 23:27:54 GMT (envelope-from attilio@svn.freebsd.org)
Received: (from attilio@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o3JNRsK4047856;
	Mon, 19 Apr 2010 23:27:54 GMT (envelope-from attilio@svn.freebsd.org)
Message-Id: <201004192327.o3JNRsK4047856@svn.freebsd.org>
From: Attilio Rao 
Date: Mon, 19 Apr 2010 23:27:54 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r206878 - head/sys/kern
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Mon, 19 Apr 2010 23:27:54 -0000

Author: attilio
Date: Mon Apr 19 23:27:54 2010
New Revision: 206878
URL: http://svn.freebsd.org/changeset/base/206878

Log:
  Fix a deadlock in the shutdown code:
  When performing a smp_rendezvous() or more likely, on amd64 and i386,
  a smp_tlb_shootdown() the caller will end up with the smp_ipi_mtx
  spinlock held, busy-waiting for other CPUs to acknowledge the operation.
  As long as CPUs are suspended (via cpu_reset()) between the active mask
  read and IPI sending there can be a deadlock where the caller will wait
  forever for a dead CPU to acknowledge the operation.
  Please note that on CPU0 that is going to be someway heavier because of
  the spinlocks being disabled earlier than quitting the machine.
  
  Fix this bug by calling cpu_reset() with the smp_ipi_mtx held.
  Note that it is very likely that a saner offline/online CPUs mechanism
  will help heavilly in fixing similar cases as it is likely more bugs
  of this type may arise in the future.
  
  Reported by:	rwatson
  Discussed with:	jhb
  Tested by:	rnoland, Giovanni Trematerra
  		
  MFC:		2 weeks
  
  Special deciation to:	anyone who made possible to have 16-ways machines
  			in Netperf

Modified:
  head/sys/kern/kern_shutdown.c

Modified: head/sys/kern/kern_shutdown.c
==============================================================================
--- head/sys/kern/kern_shutdown.c	Mon Apr 19 22:15:40 2010	(r206877)
+++ head/sys/kern/kern_shutdown.c	Mon Apr 19 23:27:54 2010	(r206878)
@@ -62,7 +62,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
-#include 		/* smp_active */
+#include 
 #include 
 #include 
 
@@ -485,15 +485,20 @@ static void
 shutdown_reset(void *junk, int howto)
 {
 
+	printf("Rebooting...\n");
+	DELAY(1000000);	/* wait 1 sec for printf's to complete and be read */
+
 	/*
-	 * Disable interrupts on CPU0 in order to avoid fast handlers
-	 * to preempt the stopping process and to deadlock against other
-	 * CPUs.
+	 * Acquiring smp_ipi_mtx here has a double effect:
+	 * - it disables interrupts avoiding CPU0 preemption
+	 *   by fast handlers (thus deadlocking  against other CPUs)
+	 * - it avoids deadlocks against smp_rendezvous() or, more 
+	 *   generally, threads busy-waiting, with this spinlock held,
+	 *   and waiting for responses by threads on other CPUs
+	 *   (ie. smp_tlb_shootdown()).
 	 */
-	spinlock_enter();
+	mtx_lock_spin(&smp_ipi_mtx);
 
-	printf("Rebooting...\n");
-	DELAY(1000000);	/* wait 1 sec for printf's to complete and be read */
 	/* cpu_boot(howto); */ /* doesn't do anything at the moment */
 	cpu_reset();
 	/* NOTREACHED */ /* assuming reset worked */

From owner-svn-src-head@FreeBSD.ORG  Mon Apr 19 23:40:46 2010
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 7FCDC1065675;
	Mon, 19 Apr 2010 23:40:46 +0000 (UTC)
	(envelope-from attilio@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 6FA6D8FC12;
	Mon, 19 Apr 2010 23:40:46 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o3JNekjH050683;
	Mon, 19 Apr 2010 23:40:46 GMT (envelope-from attilio@svn.freebsd.org)
Received: (from attilio@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o3JNeksX050681;
	Mon, 19 Apr 2010 23:40:46 GMT (envelope-from attilio@svn.freebsd.org)
Message-Id: <201004192340.o3JNeksX050681@svn.freebsd.org>
From: Attilio Rao 
Date: Mon, 19 Apr 2010 23:40:46 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r206879 - head/sys/kern
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Mon, 19 Apr 2010 23:40:46 -0000

Author: attilio
Date: Mon Apr 19 23:40:46 2010
New Revision: 206879
URL: http://svn.freebsd.org/changeset/base/206879

Log:
  getblk lockmgr is mostly used as a msleep() and may lead too easilly to
  false positives.
  Whitelist it.
  
  Reported by:	Erik Cederstrand 

Modified:
  head/sys/kern/kern_clock.c

Modified: head/sys/kern/kern_clock.c
==============================================================================
--- head/sys/kern/kern_clock.c	Mon Apr 19 23:27:54 2010	(r206878)
+++ head/sys/kern/kern_clock.c	Mon Apr 19 23:40:46 2010	(r206879)
@@ -163,6 +163,7 @@ SYSCTL_PROC(_kern, OID_AUTO, cp_times, C
 
 #ifdef DEADLKRES
 static const char *blessed[] = {
+	"getblk",
 	"so_snd_sx",
 	"so_rcv_sx",
 	NULL

From owner-svn-src-head@FreeBSD.ORG  Tue Apr 20 01:02:39 2010
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id EC878106566C;
	Tue, 20 Apr 2010 01:02:39 +0000 (UTC)
	(envelope-from rmacklem@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id DC6B38FC18;
	Tue, 20 Apr 2010 01:02:39 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o3K12d6V068621;
	Tue, 20 Apr 2010 01:02:39 GMT
	(envelope-from rmacklem@svn.freebsd.org)
Received: (from rmacklem@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o3K12dsp068619;
	Tue, 20 Apr 2010 01:02:39 GMT
	(envelope-from rmacklem@svn.freebsd.org)
Message-Id: <201004200102.o3K12dsp068619@svn.freebsd.org>
From: Rick Macklem 
Date: Tue, 20 Apr 2010 01:02:39 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r206880 - head/sys/fs/nfsclient
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Tue, 20 Apr 2010 01:02:40 -0000

Author: rmacklem
Date: Tue Apr 20 01:02:39 2010
New Revision: 206880
URL: http://svn.freebsd.org/changeset/base/206880

Log:
  For the experimental NFS client doing an NFSv4 mount,
  set the NFSCLFLAGS_RECVRINPROG while doing recovery from an expired
  lease in a manner similar to r206818 for server reboot recovery.
  This will prevent the function that acquires stateids for I/O
  operations from acquiring out of date stateids during recovery.
  Also, fix up mutex locking on the nfsc_flags field.
  
  MFC after:	1 week

Modified:
  head/sys/fs/nfsclient/nfs_clstate.c

Modified: head/sys/fs/nfsclient/nfs_clstate.c
==============================================================================
--- head/sys/fs/nfsclient/nfs_clstate.c	Mon Apr 19 23:40:46 2010	(r206879)
+++ head/sys/fs/nfsclient/nfs_clstate.c	Tue Apr 20 01:02:39 2010	(r206880)
@@ -2111,6 +2111,7 @@ nfscl_hasexpired(struct nfsclclient *clp
 		NFSUNLOCKCLSTATE();
 		return (0);
 	}
+	clp->nfsc_flags |= NFSCLFLAGS_RECVRINPROG;
 	NFSUNLOCKCLSTATE();
 
 	nmp = clp->nfsc_nmp;
@@ -2127,6 +2128,7 @@ nfscl_hasexpired(struct nfsclclient *clp
 		 * Clear out any state.
 		 */
 		nfscl_cleanclient(clp);
+		NFSLOCKCLSTATE();
 		clp->nfsc_flags &= ~(NFSCLFLAGS_HASCLIENTID |
 		    NFSCLFLAGS_RECOVER);
 	} else {
@@ -2140,14 +2142,15 @@ nfscl_hasexpired(struct nfsclclient *clp
 		 * Expire the state for the client.
 		 */
 		nfscl_expireclient(clp, nmp, cred, p);
+		NFSLOCKCLSTATE();
 		clp->nfsc_flags |= NFSCLFLAGS_HASCLIENTID;
 		clp->nfsc_flags &= ~NFSCLFLAGS_RECOVER;
 	}
-	NFSFREECRED(cred);
-	clp->nfsc_flags &= ~NFSCLFLAGS_EXPIREIT;
-	NFSLOCKCLSTATE();
+	clp->nfsc_flags &= ~(NFSCLFLAGS_EXPIREIT | NFSCLFLAGS_RECVRINPROG);
+	wakeup(&clp->nfsc_flags);
 	nfsv4_unlock(&clp->nfsc_lock, 0);
 	NFSUNLOCKCLSTATE();
+	NFSFREECRED(cred);
 	return (error);
 }
 

From owner-svn-src-head@FreeBSD.ORG  Tue Apr 20 01:12:24 2010
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 0509C106564A;
	Tue, 20 Apr 2010 01:12:24 +0000 (UTC)
	(envelope-from nwhitehorn@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id E89988FC1A;
	Tue, 20 Apr 2010 01:12:23 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o3K1CNoW070753;
	Tue, 20 Apr 2010 01:12:23 GMT
	(envelope-from nwhitehorn@svn.freebsd.org)
Received: (from nwhitehorn@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o3K1CNbe070751;
	Tue, 20 Apr 2010 01:12:23 GMT
	(envelope-from nwhitehorn@svn.freebsd.org)
Message-Id: <201004200112.o3K1CNbe070751@svn.freebsd.org>
From: Nathan Whitehorn 
Date: Tue, 20 Apr 2010 01:12:23 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r206881 - head/release/powerpc
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Tue, 20 Apr 2010 01:12:24 -0000

Author: nwhitehorn
Date: Tue Apr 20 01:12:23 2010
New Revision: 206881
URL: http://svn.freebsd.org/changeset/base/206881

Log:
  Add gpart and glabel to the release CD mfsroot. Even if sysinstall
  cannot partition disks on powerpc, this will allow the user to.
  
  PR:		powerpc/93203
  Obtained from:	ia64
  MFC after:	1 week

Modified:
  head/release/powerpc/boot_crunch.conf

Modified: head/release/powerpc/boot_crunch.conf
==============================================================================
--- head/release/powerpc/boot_crunch.conf	Tue Apr 20 01:02:39 2010	(r206880)
+++ head/release/powerpc/boot_crunch.conf	Tue Apr 20 01:12:23 2010	(r206881)
@@ -15,6 +15,7 @@ srcdirs /usr/src/sbin
 progs camcontrol
 progs dhclient
 progs fsck_ffs
+progs geom
 progs ifconfig
 progs mount_msdosfs
 progs mount_nfs
@@ -25,6 +26,8 @@ progs rtsol
 progs tunefs
 ln fsck_ffs fsck_4.2bsd
 ln fsck_ffs fsck_ufs
+ln geom glabel
+ln geom gpart
 
 srcdirs /usr/src/usr.bin
 progs cpio
@@ -43,4 +46,4 @@ progs usbconfig
 
 libs -ll -ledit -lutil -lmd -lcrypt -lftpio -lz -lnetgraph
 libs -ldialog -lncurses -ldisk -lcam -lkiconv -lsbuf -lufs
-libs -lbsdxml -larchive -lbz2 -lusb -ljail
+libs -lgeom -lbsdxml -larchive -lbz2 -lusb -ljail

From owner-svn-src-head@FreeBSD.ORG  Tue Apr 20 04:16:39 2010
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id C7E99106567A;
	Tue, 20 Apr 2010 04:16:39 +0000 (UTC) (envelope-from alc@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id B7EFA8FC28;
	Tue, 20 Apr 2010 04:16:39 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o3K4GdtS011463;
	Tue, 20 Apr 2010 04:16:39 GMT (envelope-from alc@svn.freebsd.org)
Received: (from alc@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o3K4Gdc3011461;
	Tue, 20 Apr 2010 04:16:39 GMT (envelope-from alc@svn.freebsd.org)
Message-Id: <201004200416.o3K4Gdc3011461@svn.freebsd.org>
From: Alan Cox 
Date: Tue, 20 Apr 2010 04:16:39 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r206885 - head/sys/vm
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Tue, 20 Apr 2010 04:16:39 -0000

Author: alc
Date: Tue Apr 20 04:16:39 2010
New Revision: 206885
URL: http://svn.freebsd.org/changeset/base/206885

Log:
  Eliminate an unnecessary call to pmap_remove_all().  If a page belongs to
  an object whose reference count is zero, then that page cannot possibly
  be mapped.

Modified:
  head/sys/vm/vm_pageout.c

Modified: head/sys/vm/vm_pageout.c
==============================================================================
--- head/sys/vm/vm_pageout.c	Tue Apr 20 03:20:20 2010	(r206884)
+++ head/sys/vm/vm_pageout.c	Tue Apr 20 04:16:39 2010	(r206885)
@@ -1122,7 +1122,8 @@ unlock_and_continue:
 			    m->act_count == 0) {
 				page_shortage--;
 				if (object->ref_count == 0) {
-					pmap_remove_all(m);
+					KASSERT(!pmap_page_is_mapped(m),
+				    ("vm_pageout_scan: page %p is mapped", m));
 					if (m->dirty == 0)
 						vm_page_cache(m);
 					else

From owner-svn-src-head@FreeBSD.ORG  Tue Apr 20 05:17:03 2010
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id E5DE6106564A;
	Tue, 20 Apr 2010 05:17:02 +0000 (UTC)
	(envelope-from kmatthew.macy@gmail.com)
Received: from mail-qy0-f181.google.com (mail-qy0-f181.google.com
	[209.85.221.181])
	by mx1.freebsd.org (Postfix) with ESMTP id 741BE8FC16;
	Tue, 20 Apr 2010 05:17:02 +0000 (UTC)
Received: by qyk11 with SMTP id 11so6012039qyk.13
	for ; Mon, 19 Apr 2010 22:17:01 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma;
	h=domainkey-signature:mime-version:sender:reply-to:received
	:in-reply-to:references:date:x-google-sender-auth:received
	:message-id:subject:from:to:cc:content-type
	:content-transfer-encoding;
	bh=WyKz3PMbtNUa818S+rFlLpSOE60Zs9GxLsxWBVJnbl0=;
	b=gkj4Zk1NZHMg9FKHNBfqo+Dpwei+Z5oMkNJIPp45xDVGdfpSnkODIs3lhsXuR+p8xq
	Nv2A2Jo7JU3nW4HaY0KMduMe8kg/8Dj6jiP0zfZ7r/8rgZ7IM5RUNH+EJ9MBoJN964Rz
	X4ReZq7I6nE0Ycg7IQznBiKJCfcymJPROUf2s=
DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma;
	h=mime-version:sender:reply-to:in-reply-to:references:date
	:x-google-sender-auth:message-id:subject:from:to:cc:content-type
	:content-transfer-encoding;
	b=QAtDzrpD1r6nL7bgYm2IVzljExHsBCd9VwwqICAvwmn0ip0AlFJ30Xc7Yass9lc/ec
	qlFgfEoGlAyoQYdXd0FYqZhQkECkS21iNqB12wRpTueRWl5zlvDMM8qckVOibK1ZIgQI
	yaNt9QsA9C2ghEswBhCsJ8nYRoyBnlNJB2+SE=
MIME-Version: 1.0
Sender: kmatthew.macy@gmail.com
Received: by 10.229.226.6 with HTTP; Mon, 19 Apr 2010 22:17:01 -0700 (PDT)
In-Reply-To: <201004031620.o33GKM0n037332@svn.freebsd.org>
References: <201004031620.o33GKM0n037332@svn.freebsd.org>
Date: Mon, 19 Apr 2010 22:17:01 -0700
X-Google-Sender-Auth: ff152be23782f1de
Received: by 10.229.193.18 with SMTP id ds18mr1567774qcb.14.1271740621272; 
	Mon, 19 Apr 2010 22:17:01 -0700 (PDT)
Message-ID: 
From: "K. Macy" 
To: Alan Cox 
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org,
	src-committers@freebsd.org
Subject: Re: svn commit: r206140 - head/sys/vm
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
Reply-To: kmacy@freebsd.org
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Tue, 20 Apr 2010 05:17:03 -0000

How has the problem been addressed? I'm seeing periodic panics with
non-zero resident count with the page lock patch applied. It is
possible that I've inadvertently re-introduced an issue you've fixed.

Thanks,
Kip

On Sat, Apr 3, 2010 at 9:20 AM, Alan Cox  wrote:
> Author: alc
> Date: Sat Apr =A03 16:20:22 2010
> New Revision: 206140
> URL: http://svn.freebsd.org/changeset/base/206140
>
> Log:
> =A0Re-enable the call to pmap_release() by vmspace_dofree(). =A0The accou=
nting
> =A0problem that is described in the comment has been addressed.
>
> =A0Submitted by: kib
> =A0Tested by: =A0 =A0pho (a few months ago)
> =A0MFC after: =A0 =A06 weeks
>
> Modified:
> =A0head/sys/vm/vm_map.c
>
> Modified: head/sys/vm/vm_map.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/vm/vm_map.c =A0 =A0 =A0 =A0Sat Apr =A03 15:52:32 2010 =A0 =
=A0 =A0 =A0(r206139)
> +++ head/sys/vm/vm_map.c =A0 =A0 =A0 =A0Sat Apr =A03 16:20:22 2010 =A0 =
=A0 =A0 =A0(r206140)
> @@ -313,6 +313,7 @@ vm_init2(void)
> =A0static inline void
> =A0vmspace_dofree(struct vmspace *vm)
> =A0{
> +
> =A0 =A0 =A0 =A0CTR1(KTR_VM, "vmspace_free: %p", vm);
>
> =A0 =A0 =A0 =A0/*
> @@ -329,12 +330,8 @@ vmspace_dofree(struct vmspace *vm)
> =A0 =A0 =A0 =A0(void)vm_map_remove(&vm->vm_map, vm->vm_map.min_offset,
> =A0 =A0 =A0 =A0 =A0 =A0vm->vm_map.max_offset);
>
> - =A0 =A0 =A0 /*
> - =A0 =A0 =A0 =A0* XXX Comment out the pmap_release call for now. The
> - =A0 =A0 =A0 =A0* vmspace_zone is marked as UMA_ZONE_NOFREE, and bugs ca=
use
> - =A0 =A0 =A0 =A0* pmap.resident_count to be !=3D 0 on exit sometimes.
> - =A0 =A0 =A0 =A0*/
> -/* =A0 =A0 pmap_release(vmspace_pmap(vm)); */
> + =A0 =A0 =A0 pmap_release(vmspace_pmap(vm));
> + =A0 =A0 =A0 vm->vm_map.pmap =3D NULL;
> =A0 =A0 =A0 =A0uma_zfree(vmspace_zone, vm);
> =A0}
>
>

From owner-svn-src-head@FreeBSD.ORG  Tue Apr 20 05:31:54 2010
Return-Path: 
Delivered-To: svn-src-head@FreeBSD.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 6A98F106566C;
	Tue, 20 Apr 2010 05:31:54 +0000 (UTC)
	(envelope-from luigi@onelab2.iet.unipi.it)
Received: from onelab2.iet.unipi.it (onelab2.iet.unipi.it [131.114.59.238])
	by mx1.freebsd.org (Postfix) with ESMTP id 29E2A8FC0C;
	Tue, 20 Apr 2010 05:31:53 +0000 (UTC)
Received: by onelab2.iet.unipi.it (Postfix, from userid 275)
	id C446773098; Tue, 20 Apr 2010 07:42:27 +0200 (CEST)
Date: Tue, 20 Apr 2010 07:42:27 +0200
From: Luigi Rizzo 
To: Julian Elischer 
Message-ID: <20100420054227.GA62058@onelab2.iet.unipi.it>
References: <201004191511.o3JFBjLj036350@svn.freebsd.org>
	<4BCC7E64.4040200@FreeBSD.org> <4BCCDCC9.2070604@elischer.org>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <4BCCDCC9.2070604@elischer.org>
User-Agent: Mutt/1.4.2.3i
Cc: svn-src-head@FreeBSD.org, Luigi Rizzo ,
	src-committers@FreeBSD.org, svn-src-all@FreeBSD.org,
	Robert Noland 
Subject: Re: svn commit: r206843 - head/sbin/ipfw
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Tue, 20 Apr 2010 05:31:54 -0000

On Mon, Apr 19, 2010 at 03:44:25PM -0700, Julian Elischer wrote:
> On 4/19/10 9:01 AM, Robert Noland wrote:
> >
> >
> >Luigi Rizzo wrote:
> 
> 
> [...]
> 
> >Index: sbin/ipfw/ipfw2.c
> >===================================================================
> >--- sbin/ipfw/ipfw2.c (revision 206844)
> >+++ sbin/ipfw/ipfw2.c (working copy)
> >@@ -326,7 +326,7 @@
> >#ifdef TCC
> >#define U64_FMT "I64"
> >#else
> >-#define U64_FMT "llu"
> >+#define U64_FMT "ju"
> >#endif
> >uint64_t d;
> 
>  believe there is a posix define for this?
> (though I can't remember it right now).

the reason for the above code is that MSVC (actually, the DLL in
Windows -- so the problem exists also for TCC on Windows) does not
support %llu or %ju but only %I64 and that is why i need this ugly
code (to tell the truth i am not even sure that the various libc
for embedded platforms support %ju).

	cheers
	luigi

From owner-svn-src-head@FreeBSD.ORG  Tue Apr 20 06:10:05 2010
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 75114106564A;
	Tue, 20 Apr 2010 06:10:05 +0000 (UTC)
	(envelope-from maxim@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 496168FC27;
	Tue, 20 Apr 2010 06:10:05 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o3K6A5lv036470;
	Tue, 20 Apr 2010 06:10:05 GMT (envelope-from maxim@svn.freebsd.org)
Received: (from maxim@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o3K6A5qP036467;
	Tue, 20 Apr 2010 06:10:05 GMT (envelope-from maxim@svn.freebsd.org)
Message-Id: <201004200610.o3K6A5qP036467@svn.freebsd.org>
From: Maxim Konovalov 
Date: Tue, 20 Apr 2010 06:10:05 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r206889 - head/sbin/ping6
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Tue, 20 Apr 2010 06:10:05 -0000

Author: maxim
Date: Tue Apr 20 06:10:05 2010
New Revision: 206889
URL: http://svn.freebsd.org/changeset/base/206889

Log:
  o Add do-not-fragment option support to ping6(8).
  
  PR:		bin/145759
  Submitted by:	pluknet
  MFC after:	1 month

Modified:
  head/sbin/ping6/ping6.8
  head/sbin/ping6/ping6.c

Modified: head/sbin/ping6/ping6.8
==============================================================================
--- head/sbin/ping6/ping6.8	Tue Apr 20 06:08:34 2010	(r206888)
+++ head/sbin/ping6/ping6.8	Tue Apr 20 06:10:05 2010	(r206889)
@@ -29,7 +29,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd August 27, 2008
+.Dd April 20, 2010
 .Dt PING6 8
 .Os
 .Sh NAME
@@ -40,9 +40,9 @@ packets to network hosts
 .Sh SYNOPSIS
 .Nm
 .\" without ipsec, or new ipsec
-.Op Fl dfHmnNoqrRtvwW
+.Op Fl DdfHmnNoqrRtvwW
 .\" old ipsec
-.\" .Op Fl AdEfmnNqRtvwW
+.\" .Op Fl ADdEfmnNqRtvwW
 .Bk -words
 .Op Fl a Ar addrtype
 .Ek
@@ -141,6 +141,8 @@ Stop after sending
 .Ar count
 .Tn ECHO_RESPONSE
 packets.
+.It Fl D
+Disable IPv6 fragmentation.
 .It Fl d
 Set the
 .Dv SO_DEBUG

Modified: head/sbin/ping6/ping6.c
==============================================================================
--- head/sbin/ping6/ping6.c	Tue Apr 20 06:08:34 2010	(r206888)
+++ head/sbin/ping6/ping6.c	Tue Apr 20 06:10:05 2010	(r206889)
@@ -191,6 +191,7 @@ struct tv32 {
 #define F_ONCE		0x200000
 #define F_AUDIBLE	0x400000
 #define F_MISSED	0x800000
+#define F_DONTFRAG	0x1000000
 #define F_NOUSERDATA	(F_NODEADDR | F_FQDN | F_FQDNOLD | F_SUPTYPES)
 u_int options;
 
@@ -349,7 +350,7 @@ main(argc, argv)
 #endif /*IPSEC_POLICY_IPSEC*/
 #endif
 	while ((ch = getopt(argc, argv,
-	    "a:b:c:dfHg:h:I:i:l:mnNop:qrRS:s:tvwW" ADDOPTS)) != -1) {
+	    "a:b:c:DdfHg:h:I:i:l:mnNop:qrRS:s:tvwW" ADDOPTS)) != -1) {
 #undef ADDOPTS
 		switch (ch) {
 		case 'a':
@@ -415,6 +416,9 @@ main(argc, argv)
 				errx(1,
 				    "illegal number of packets -- %s", optarg);
 			break;
+		case 'D':
+			options |= F_DONTFRAG;
+			break;
 		case 'd':
 			options |= F_SO_DEBUG;
 			break;
@@ -742,7 +746,11 @@ main(argc, argv)
 	for (i = 0; i < sizeof(nonce); i += sizeof(u_int32_t))
 		*((u_int32_t *)&nonce[i]) = arc4random();
 #endif
-
+	optval = 1;
+	if (options & F_DONTFRAG)
+		if (setsockopt(s, IPPROTO_IPV6, IPV6_DONTFRAG,
+		    &optval, sizeof(optval)) == -1)
+			err(1, "IPV6_DONTFRAG");
 	hold = 1;
 
 	if (options & F_SO_DEBUG)
@@ -2780,7 +2788,7 @@ usage()
 	    "A"
 #endif
 	    "usage: ping6 [-"
-	    "d"
+	    "Dd"
 #if defined(IPSEC) && !defined(IPSEC_POLICY_IPSEC)
 	    "E"
 #endif

From owner-svn-src-head@FreeBSD.ORG  Tue Apr 20 07:09:47 2010
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 818B4106564A;
	Tue, 20 Apr 2010 07:09:47 +0000 (UTC) (envelope-from alc@cs.rice.edu)
Received: from mail.cs.rice.edu (mail.cs.rice.edu [128.42.1.31])
	by mx1.freebsd.org (Postfix) with ESMTP id 4477A8FC16;
	Tue, 20 Apr 2010 07:09:47 +0000 (UTC)
Received: from mail.cs.rice.edu (localhost.localdomain [127.0.0.1])
	by mail.cs.rice.edu (Postfix) with ESMTP id B302F2C2B0E;
	Tue, 20 Apr 2010 02:09:46 -0500 (CDT)
X-Virus-Scanned: by amavis-2.4.0 at mail.cs.rice.edu
Received: from mail.cs.rice.edu ([127.0.0.1])
	by mail.cs.rice.edu (mail.cs.rice.edu [127.0.0.1]) (amavisd-new,
	port 10024)
	with LMTP id cSM087aFbX97; Tue, 20 Apr 2010 02:09:39 -0500 (CDT)
Received: from adsl-216-63-78-18.dsl.hstntx.swbell.net
	(adsl-216-63-78-18.dsl.hstntx.swbell.net [216.63.78.18])
	(using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits))
	(No client certificate requested)
	by mail.cs.rice.edu (Postfix) with ESMTP id 43D662C2ACE;
	Tue, 20 Apr 2010 02:09:38 -0500 (CDT)
Message-ID: <4BCD5331.4030303@cs.rice.edu>
Date: Tue, 20 Apr 2010 02:09:37 -0500
From: Alan Cox 
User-Agent: Thunderbird 2.0.0.24 (X11/20100327)
MIME-Version: 1.0
To: kmacy@freebsd.org
References: <201004031620.o33GKM0n037332@svn.freebsd.org>
	
In-Reply-To: 
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
Cc: Alan Cox , svn-src-head@freebsd.org,
	svn-src-all@freebsd.org, src-committers@freebsd.org
Subject: Re: svn commit: r206140 - head/sys/vm
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Tue, 20 Apr 2010 07:09:47 -0000

K. Macy wrote:
> How has the problem been addressed? I'm seeing periodic panics with
> non-zero resident count with the page lock patch applied. It is
> possible that I've inadvertently re-introduced an issue you've fixed.
>
>   

r196318 and r189783 come to mind.

>
> On Sat, Apr 3, 2010 at 9:20 AM, Alan Cox  wrote:
>   
>> Author: alc
>> Date: Sat Apr  3 16:20:22 2010
>> New Revision: 206140
>> URL: http://svn.freebsd.org/changeset/base/206140
>>
>> Log:
>>  Re-enable the call to pmap_release() by vmspace_dofree().  The accounting
>>  problem that is described in the comment has been addressed.
>>
>>  Submitted by: kib
>>  Tested by:    pho (a few months ago)
>>  MFC after:    6 weeks
>>
>> Modified:
>>  head/sys/vm/vm_map.c
>>
>> Modified: head/sys/vm/vm_map.c
>> ==============================================================================
>> --- head/sys/vm/vm_map.c        Sat Apr  3 15:52:32 2010        (r206139)
>> +++ head/sys/vm/vm_map.c        Sat Apr  3 16:20:22 2010        (r206140)
>> @@ -313,6 +313,7 @@ vm_init2(void)
>>  static inline void
>>  vmspace_dofree(struct vmspace *vm)
>>  {
>> +
>>        CTR1(KTR_VM, "vmspace_free: %p", vm);
>>
>>        /*
>> @@ -329,12 +330,8 @@ vmspace_dofree(struct vmspace *vm)
>>        (void)vm_map_remove(&vm->vm_map, vm->vm_map.min_offset,
>>            vm->vm_map.max_offset);
>>
>> -       /*
>> -        * XXX Comment out the pmap_release call for now. The
>> -        * vmspace_zone is marked as UMA_ZONE_NOFREE, and bugs cause
>> -        * pmap.resident_count to be != 0 on exit sometimes.
>> -        */
>> -/*     pmap_release(vmspace_pmap(vm)); */
>> +       pmap_release(vmspace_pmap(vm));
>> +       vm->vm_map.pmap = NULL;
>>        uma_zfree(vmspace_zone, vm);
>>  }
>>
>>
>>     


From owner-svn-src-head@FreeBSD.ORG  Tue Apr 20 08:50:20 2010
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 313D41065672;
	Tue, 20 Apr 2010 08:50:20 +0000 (UTC)
	(envelope-from tuexen@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id D69FD8FC1D;
	Tue, 20 Apr 2010 08:50:19 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o3K8oJGT071733;
	Tue, 20 Apr 2010 08:50:19 GMT (envelope-from tuexen@svn.freebsd.org)
Received: (from tuexen@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o3K8oJG2071731;
	Tue, 20 Apr 2010 08:50:19 GMT (envelope-from tuexen@svn.freebsd.org)
Message-Id: <201004200850.o3K8oJG2071731@svn.freebsd.org>
From: Michael Tuexen 
Date: Tue, 20 Apr 2010 08:50:19 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r206891 - head/sys/netinet
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Tue, 20 Apr 2010 08:50:20 -0000

Author: tuexen
Date: Tue Apr 20 08:50:19 2010
New Revision: 206891
URL: http://svn.freebsd.org/changeset/base/206891

Log:
  Really print the nr_mapping array when it should be printed.`
  
  MFC after: 3 days.

Modified:
  head/sys/netinet/sctputil.c

Modified: head/sys/netinet/sctputil.c
==============================================================================
--- head/sys/netinet/sctputil.c	Tue Apr 20 08:19:43 2010	(r206890)
+++ head/sys/netinet/sctputil.c	Tue Apr 20 08:50:19 2010	(r206891)
@@ -1215,7 +1215,7 @@ sctp_print_mapping_array(struct sctp_ass
 	}
 	printf("Non renegable mapping array (last %d entries are zero):\n", asoc->mapping_array_size - limit);
 	for (i = 0; i < limit; i++) {
-		printf("%2.2x%c", asoc->mapping_array[i], ((i + 1) % 16) ? ' ' : '\n');
+		printf("%2.2x%c", asoc->nr_mapping_array[i], ((i + 1) % 16) ? ' ' : '\n');
 	}
 	if (limit % 16)
 		printf("\n");

From owner-svn-src-head@FreeBSD.ORG  Tue Apr 20 08:51:22 2010
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 3BA8A106566C;
	Tue, 20 Apr 2010 08:51:22 +0000 (UTC)
	(envelope-from tuexen@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 2AC2F8FC08;
	Tue, 20 Apr 2010 08:51:22 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o3K8pMpe072009;
	Tue, 20 Apr 2010 08:51:22 GMT (envelope-from tuexen@svn.freebsd.org)
Received: (from tuexen@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o3K8pMHr072007;
	Tue, 20 Apr 2010 08:51:22 GMT (envelope-from tuexen@svn.freebsd.org)
Message-Id: <201004200851.o3K8pMHr072007@svn.freebsd.org>
From: Michael Tuexen 
Date: Tue, 20 Apr 2010 08:51:22 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r206892 - head/sys/netinet
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Tue, 20 Apr 2010 08:51:22 -0000

Author: tuexen
Date: Tue Apr 20 08:51:21 2010
New Revision: 206892
URL: http://svn.freebsd.org/changeset/base/206892

Log:
  Update highest_tsn variables when sliding mapping arrays.

Modified:
  head/sys/netinet/sctp_indata.c

Modified: head/sys/netinet/sctp_indata.c
==============================================================================
--- head/sys/netinet/sctp_indata.c	Tue Apr 20 08:50:19 2010	(r206891)
+++ head/sys/netinet/sctp_indata.c	Tue Apr 20 08:51:21 2010	(r206892)
@@ -2390,6 +2390,12 @@ sctp_slide_mapping_arrays(struct sctp_tc
 				asoc->mapping_array[ii] = 0;
 				asoc->nr_mapping_array[ii] = 0;
 			}
+			if (asoc->highest_tsn_inside_map + 1 == asoc->mapping_array_base_tsn) {
+				asoc->highest_tsn_inside_map += (slide_from << 3);
+			}
+			if (asoc->highest_tsn_inside_nr_map + 1 == asoc->mapping_array_base_tsn) {
+				asoc->highest_tsn_inside_nr_map += (slide_from << 3);
+			}
 			asoc->mapping_array_base_tsn += (slide_from << 3);
 			if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_MAP_LOGGING_ENABLE) {
 				sctp_log_map(asoc->mapping_array_base_tsn,

From owner-svn-src-head@FreeBSD.ORG  Tue Apr 20 09:39:25 2010
Return-Path: 
Delivered-To: svn-src-head@FreeBSD.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id AFB64106564A;
	Tue, 20 Apr 2010 09:39:25 +0000 (UTC)
	(envelope-from brde@optusnet.com.au)
Received: from mail04.syd.optusnet.com.au (mail04.syd.optusnet.com.au
	[211.29.132.185])
	by mx1.freebsd.org (Postfix) with ESMTP id 3DCB58FC22;
	Tue, 20 Apr 2010 09:39:24 +0000 (UTC)
Received: from c122-106-144-83.carlnfd1.nsw.optusnet.com.au
	(c122-106-144-83.carlnfd1.nsw.optusnet.com.au [122.106.144.83])
	by mail04.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id
	o3K9dEkg011357
	(version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO);
	Tue, 20 Apr 2010 19:39:16 +1000
Date: Tue, 20 Apr 2010 19:39:14 +1000 (EST)
From: Bruce Evans 
X-X-Sender: bde@delplex.bde.org
To: Luigi Rizzo 
In-Reply-To: <20100420054227.GA62058@onelab2.iet.unipi.it>
Message-ID: <20100420192603.R4920@delplex.bde.org>
References: <201004191511.o3JFBjLj036350@svn.freebsd.org>
	<4BCC7E64.4040200@FreeBSD.org> <4BCCDCC9.2070604@elischer.org>
	<20100420054227.GA62058@onelab2.iet.unipi.it>
MIME-Version: 1.0
Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed
Cc: Luigi Rizzo , src-committers@FreeBSD.org,
	Robert Noland , svn-src-all@FreeBSD.org,
	Julian Elischer , svn-src-head@FreeBSD.org
Subject: Re: svn commit: r206843 - head/sbin/ipfw
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Tue, 20 Apr 2010 09:39:25 -0000

On Tue, 20 Apr 2010, Luigi Rizzo wrote:

> On Mon, Apr 19, 2010 at 03:44:25PM -0700, Julian Elischer wrote:
>> On 4/19/10 9:01 AM, Robert Noland wrote:
>>>
>>>
>>> Luigi Rizzo wrote:
>>
>>
>> [...]
>>
>>> Index: sbin/ipfw/ipfw2.c
>>> ===================================================================
>>> --- sbin/ipfw/ipfw2.c (revision 206844)
>>> +++ sbin/ipfw/ipfw2.c (working copy)
>>> @@ -326,7 +326,7 @@
>>> #ifdef TCC
>>> #define U64_FMT "I64"
>>> #else
>>> -#define U64_FMT "llu"
>>> +#define U64_FMT "ju"
>>> #endif
>>> uint64_t d;

Ugh.  I started introducing intmax_t about 10 years ago to try to kill
long long.  But long long is now used much more than 10 years ago :-(.
Also, uint64_t should not be used in contexts like this (where hardware
requirements don't require any particular size).

>>  believe there is a posix define for this?
>> (though I can't remember it right now).

Nothing to do with POSIX.  The C99 define for this even less portable
than the above (though easier to fake in header files).  All of the
above basically require C99.

> the reason for the above code is that MSVC (actually, the DLL in
> Windows -- so the problem exists also for TCC on Windows) does not
> support %llu or %ju but only %I64 and that is why i need this ugly
> code (to tell the truth i am not even sure that the various libc
> for embedded platforms support %ju).

All FreeBSD libc's should, since %ju is part of the small part of C99
actually supported by FreeBSD.  For a vendor embedded platform, support
depends on the vendor having the sam support for C99 as FreeBSD does in
this area.

%I64 is actually better than the C99 formats, though not as good as
%IDWIM where the compiler rewrites the format string, replacing %IDWIM
by any C99 or vendor format specifier that will work at runtime (only
works for literal format strings).  I think %I is in sfio, where this
and other design errors in stdio were fixed long before C99 standardized
more errors.  Don't know if sfio has %IDWIM -- this requires compiler
support.

Bruce

From owner-svn-src-head@FreeBSD.ORG  Tue Apr 20 10:16:44 2010
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id D1DD7106566B;
	Tue, 20 Apr 2010 10:16:44 +0000 (UTC) (envelope-from kib@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id C01658FC14;
	Tue, 20 Apr 2010 10:16:44 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o3KAGi5H090828;
	Tue, 20 Apr 2010 10:16:44 GMT (envelope-from kib@svn.freebsd.org)
Received: (from kib@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o3KAGiWZ090824;
	Tue, 20 Apr 2010 10:16:44 GMT (envelope-from kib@svn.freebsd.org)
Message-Id: <201004201016.o3KAGiWZ090824@svn.freebsd.org>
From: Konstantin Belousov 
Date: Tue, 20 Apr 2010 10:16:44 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r206893 - in head: include lib/libc/stdlib
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Tue, 20 Apr 2010 10:16:44 -0000

Author: kib
Date: Tue Apr 20 10:16:44 2010
New Revision: 206893
URL: http://svn.freebsd.org/changeset/base/206893

Log:
  Slightly modernize realpath(3).
  
  SUSv4 requires that implementation returns EINVAL if supplied path is NULL,
  and ENOENT if path is empty string [1].
  Bring prototype in conformance with SUSv4, adding restrict keywords.
  Allow the resolved path buffer pointer be NULL, in which case realpath(3)
  allocates storage with malloc().
  
  PR:	kern/121897 [1]
  MFC after:	2 weeks

Modified:
  head/include/stdlib.h
  head/lib/libc/stdlib/realpath.3
  head/lib/libc/stdlib/realpath.c

Modified: head/include/stdlib.h
==============================================================================
--- head/include/stdlib.h	Tue Apr 20 08:51:21 2010	(r206892)
+++ head/include/stdlib.h	Tue Apr 20 10:16:44 2010	(r206893)
@@ -201,7 +201,7 @@ int	 posix_openpt(int);
 char	*ptsname(int);
 int	 putenv(char *);
 long	 random(void);
-char	*realpath(const char *, char resolved_path[]);
+char	*realpath(const char * __restrict, char * __restrict);
 unsigned short
 	*seed48(unsigned short[3]);
 #ifndef _SETKEY_DECLARED

Modified: head/lib/libc/stdlib/realpath.3
==============================================================================
--- head/lib/libc/stdlib/realpath.3	Tue Apr 20 08:51:21 2010	(r206892)
+++ head/lib/libc/stdlib/realpath.3	Tue Apr 20 10:16:44 2010	(r206893)
@@ -31,7 +31,7 @@
 .\"     @(#)realpath.3	8.2 (Berkeley) 2/16/94
 .\" $FreeBSD$
 .\"
-.Dd February 16, 1994
+.Dd April 19, 2010
 .Dt REALPATH 3
 .Os
 .Sh NAME
@@ -43,7 +43,7 @@
 .In sys/param.h
 .In stdlib.h
 .Ft "char *"
-.Fn realpath "const char *pathname" "char resolved_path[PATH_MAX]"
+.Fn realpath "const char *pathname" "char *resolved_path"
 .Sh DESCRIPTION
 The
 .Fn realpath
@@ -64,7 +64,8 @@ argument
 .Em must
 refer to a buffer capable of storing at least
 .Dv PATH_MAX
-characters.
+characters, or be
+.Dv NULL .
 .Pp
 The
 .Fn realpath
@@ -82,6 +83,13 @@ The
 function returns
 .Fa resolved_path
 on success.
+If the function was supplied
+.Dv NULL
+as
+.Fa resolved_path ,
+and operation did not cause errors, the returned value is
+a null-terminated string in a buffer allocated by a call to
+.Fn malloc 3 .
 If an error occurs,
 .Fn realpath
 returns
@@ -89,6 +97,11 @@ returns
 and
 .Fa resolved_path
 contains the pathname which caused the problem.
+If
+.Fa resolved_path
+was
+.Dv NULL ,
+then information of the failed pathname component is lost.
 .Sh ERRORS
 The function
 .Fn realpath

Modified: head/lib/libc/stdlib/realpath.c
==============================================================================
--- head/lib/libc/stdlib/realpath.c	Tue Apr 20 08:51:21 2010	(r206892)
+++ head/lib/libc/stdlib/realpath.c	Tue Apr 20 10:16:44 2010	(r206893)
@@ -43,23 +43,37 @@ __FBSDID("$FreeBSD$");
 #include "un-namespace.h"
 
 /*
- * char *realpath(const char *path, char resolved[PATH_MAX]);
- *
  * Find the real name of path, by removing all ".", ".." and symlink
  * components.  Returns (resolved) on success, or (NULL) on failure,
  * in which case the path which caused trouble is left in (resolved).
  */
 char *
-realpath(const char *path, char resolved[PATH_MAX])
+realpath(const char * __restrict path, char * __restrict resolved)
 {
 	struct stat sb;
 	char *p, *q, *s;
 	size_t left_len, resolved_len;
 	unsigned symlinks;
-	int serrno, slen;
+	int serrno, slen, m;
 	char left[PATH_MAX], next_token[PATH_MAX], symlink[PATH_MAX];
 
+	if (path == NULL) {
+		errno = EINVAL;
+		return (NULL);
+	}
+	if (path[0] == '\0') {
+		errno = ENOENT;
+		return (NULL);
+	}
 	serrno = errno;
+	if (resolved == NULL) {
+		resolved = malloc(PATH_MAX);
+		if (resolved == NULL)
+			return (NULL);
+		m = 1;
+	} else
+		m = 0;
+
 	symlinks = 0;
 	if (path[0] == '/') {
 		resolved[0] = '/';
@@ -71,12 +85,19 @@ realpath(const char *path, char resolved
 	} else {
 		if (getcwd(resolved, PATH_MAX) == NULL) {
 			strlcpy(resolved, ".", PATH_MAX);
+			if (m) {
+				serrno = errno;
+				free(resolved);
+				errno = serrno;
+			}
 			return (NULL);
 		}
 		resolved_len = strlen(resolved);
 		left_len = strlcpy(left, path, sizeof(left));
 	}
 	if (left_len >= sizeof(left) || resolved_len >= PATH_MAX) {
+		if (m)
+			free(resolved);
 		errno = ENAMETOOLONG;
 		return (NULL);
 	}
@@ -92,6 +113,8 @@ realpath(const char *path, char resolved
 		p = strchr(left, '/');
 		s = p ? p : left + left_len;
 		if (s - left >= sizeof(next_token)) {
+			if (m)
+				free(resolved);
 			errno = ENAMETOOLONG;
 			return (NULL);
 		}
@@ -102,6 +125,8 @@ realpath(const char *path, char resolved
 			memmove(left, s + 1, left_len + 1);
 		if (resolved[resolved_len - 1] != '/') {
 			if (resolved_len + 1 >= PATH_MAX) {
+				if (m)
+					free(resolved);
 				errno = ENAMETOOLONG;
 				return (NULL);
 			}
@@ -133,6 +158,8 @@ realpath(const char *path, char resolved
 		 */
 		resolved_len = strlcat(resolved, next_token, PATH_MAX);
 		if (resolved_len >= PATH_MAX) {
+			if (m)
+				free(resolved);
 			errno = ENAMETOOLONG;
 			return (NULL);
 		}
@@ -141,16 +168,29 @@ realpath(const char *path, char resolved
 				errno = serrno;
 				return (resolved);
 			}
+			if (m) {
+				serrno = errno;
+				free(resolved);
+				errno = serrno;
+			}
 			return (NULL);
 		}
 		if (S_ISLNK(sb.st_mode)) {
 			if (symlinks++ > MAXSYMLINKS) {
+				if (m)
+					free(resolved);
 				errno = ELOOP;
 				return (NULL);
 			}
 			slen = readlink(resolved, symlink, sizeof(symlink) - 1);
-			if (slen < 0)
+			if (slen < 0) {
+				if (m) {
+					serrno = errno;
+					free(resolved);
+					errno = serrno;
+				}
 				return (NULL);
+			}
 			symlink[slen] = '\0';
 			if (symlink[0] == '/') {
 				resolved[1] = 0;
@@ -171,6 +211,8 @@ realpath(const char *path, char resolved
 			if (p != NULL) {
 				if (symlink[slen - 1] != '/') {
 					if (slen + 1 >= sizeof(symlink)) {
+						if (m)
+							free(resolved);
 						errno = ENAMETOOLONG;
 						return (NULL);
 					}
@@ -179,6 +221,8 @@ realpath(const char *path, char resolved
 				}
 				left_len = strlcat(symlink, left, sizeof(left));
 				if (left_len >= sizeof(left)) {
+					if (m)
+						free(resolved);
 					errno = ENAMETOOLONG;
 					return (NULL);
 				}

From owner-svn-src-head@FreeBSD.ORG  Tue Apr 20 10:19:27 2010
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id DF9871065676;
	Tue, 20 Apr 2010 10:19:27 +0000 (UTC) (envelope-from kib@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id B51BD8FC1F;
	Tue, 20 Apr 2010 10:19:27 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o3KAJR51091448;
	Tue, 20 Apr 2010 10:19:27 GMT (envelope-from kib@svn.freebsd.org)
Received: (from kib@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o3KAJRQT091444;
	Tue, 20 Apr 2010 10:19:27 GMT (envelope-from kib@svn.freebsd.org)
Message-Id: <201004201019.o3KAJRQT091444@svn.freebsd.org>
From: Konstantin Belousov 
Date: Tue, 20 Apr 2010 10:19:27 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r206894 - in head/sys: fs/pseudofs kern ufs/ufs
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Tue, 20 Apr 2010 10:19:28 -0000

Author: kib
Date: Tue Apr 20 10:19:27 2010
New Revision: 206894
URL: http://svn.freebsd.org/changeset/base/206894

Log:
  The cache_enter(9) function shall not be called for doomed dvp.
  Assert this.
  
  In the reported panic, vdestroy() fired the assertion "vp has namecache
  for ..", because pseudofs may end up doing cache_enter() with reclaimed
  dvp, after dotdot lookup temporary unlocked dvp.
  Similar problem exists in ufs_lookup() for "." lookup, when vnode
  lock needs to be upgraded.
  
  Verify that dvp is not reclaimed before calling cache_enter().
  
  Reported and tested by:	pho
  Reviewed by:	kan
  MFC after:	2 weeks

Modified:
  head/sys/fs/pseudofs/pseudofs_vnops.c
  head/sys/kern/vfs_cache.c
  head/sys/ufs/ufs/ufs_lookup.c

Modified: head/sys/fs/pseudofs/pseudofs_vnops.c
==============================================================================
--- head/sys/fs/pseudofs/pseudofs_vnops.c	Tue Apr 20 10:16:44 2010	(r206893)
+++ head/sys/fs/pseudofs/pseudofs_vnops.c	Tue Apr 20 10:19:27 2010	(r206894)
@@ -542,7 +542,7 @@ pfs_lookup(struct vop_cachedlookup_args 
 
 	if (cnp->cn_flags & ISDOTDOT)
 		vn_lock(vn, LK_EXCLUSIVE|LK_RETRY);
-	if (cnp->cn_flags & MAKEENTRY)
+	if (cnp->cn_flags & MAKEENTRY && !(vn->v_iflag & VI_DOOMED))
 		cache_enter(vn, *vpp, cnp);
 	PFS_RETURN (0);
  failed:

Modified: head/sys/kern/vfs_cache.c
==============================================================================
--- head/sys/kern/vfs_cache.c	Tue Apr 20 10:16:44 2010	(r206893)
+++ head/sys/kern/vfs_cache.c	Tue Apr 20 10:19:27 2010	(r206894)
@@ -611,6 +611,8 @@ cache_enter(dvp, vp, cnp)
 	CTR3(KTR_VFS, "cache_enter(%p, %p, %s)", dvp, vp, cnp->cn_nameptr);
 	VNASSERT(vp == NULL || (vp->v_iflag & VI_DOOMED) == 0, vp,
 	    ("cache_enter: Adding a doomed vnode"));
+	VNASSERT(dvp == NULL || (dvp->v_iflag & VI_DOOMED) == 0, dvp,
+	    ("cache_enter: Doomed vnode used as src"));
 
 	if (!doingcache)
 		return;

Modified: head/sys/ufs/ufs/ufs_lookup.c
==============================================================================
--- head/sys/ufs/ufs/ufs_lookup.c	Tue Apr 20 10:16:44 2010	(r206893)
+++ head/sys/ufs/ufs/ufs_lookup.c	Tue Apr 20 10:19:27 2010	(r206894)
@@ -704,6 +704,14 @@ found:
 				vn_lock(vdp, LK_UPGRADE | LK_RETRY);
 			else /* if (ltype == LK_SHARED) */
 				vn_lock(vdp, LK_DOWNGRADE | LK_RETRY);
+			/*
+			 * Relock for the "." case may left us with
+			 * reclaimed vnode.
+			 */
+			if (vdp->v_iflag & VI_DOOMED) {
+				vrele(vdp);
+				return (ENOENT);
+			}
 		}
 		*vpp = vdp;
 	} else {

From owner-svn-src-head@FreeBSD.ORG  Tue Apr 20 10:42:08 2010
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id E951B106566C;
	Tue, 20 Apr 2010 10:42:08 +0000 (UTC)
	(envelope-from rpaulo@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id BF5B18FC14;
	Tue, 20 Apr 2010 10:42:08 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o3KAg8nb096520;
	Tue, 20 Apr 2010 10:42:08 GMT (envelope-from rpaulo@svn.freebsd.org)
Received: (from rpaulo@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o3KAg8Hc096519;
	Tue, 20 Apr 2010 10:42:08 GMT (envelope-from rpaulo@svn.freebsd.org)
Message-Id: <201004201042.o3KAg8Hc096519@svn.freebsd.org>
From: Rui Paulo 
Date: Tue, 20 Apr 2010 10:42:08 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r206895 - head/sys/mips/rmi
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Tue, 20 Apr 2010 10:42:09 -0000

Author: rpaulo
Date: Tue Apr 20 10:42:08 2010
New Revision: 206895
URL: http://svn.freebsd.org/changeset/base/206895

Log:
  Remove svn:executable prop.

Modified:
Directory Properties:
  head/sys/mips/rmi/debug.h   (props changed)
  head/sys/mips/rmi/msgring.h   (props changed)
  head/sys/mips/rmi/shared_structs.h   (props changed)
  head/sys/mips/rmi/shared_structs_func.h   (props changed)
  head/sys/mips/rmi/shared_structs_offsets.h   (props changed)

From owner-svn-src-head@FreeBSD.ORG  Tue Apr 20 12:22:06 2010
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id D11071065672;
	Tue, 20 Apr 2010 12:22:06 +0000 (UTC)
	(envelope-from attilio@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id C09EB8FC21;
	Tue, 20 Apr 2010 12:22:06 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o3KCM6FX024388;
	Tue, 20 Apr 2010 12:22:06 GMT (envelope-from attilio@svn.freebsd.org)
Received: (from attilio@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o3KCM6cc024386;
	Tue, 20 Apr 2010 12:22:06 GMT (envelope-from attilio@svn.freebsd.org)
Message-Id: <201004201222.o3KCM6cc024386@svn.freebsd.org>
From: Attilio Rao 
Date: Tue, 20 Apr 2010 12:22:06 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r206897 - head/sys/kern
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Tue, 20 Apr 2010 12:22:06 -0000

Author: attilio
Date: Tue Apr 20 12:22:06 2010
New Revision: 206897
URL: http://svn.freebsd.org/changeset/base/206897

Log:
  Fix compilation in the !SMP case.
  Keep the interrupts disabled in order to avoid preemption problems.
  
  Reported by:	tinderbox, b.f. 
  MFC:		2 weeks
  X-MFC:		r206878

Modified:
  head/sys/kern/kern_shutdown.c

Modified: head/sys/kern/kern_shutdown.c
==============================================================================
--- head/sys/kern/kern_shutdown.c	Tue Apr 20 12:07:16 2010	(r206896)
+++ head/sys/kern/kern_shutdown.c	Tue Apr 20 12:22:06 2010	(r206897)
@@ -496,8 +496,14 @@ shutdown_reset(void *junk, int howto)
 	 *   generally, threads busy-waiting, with this spinlock held,
 	 *   and waiting for responses by threads on other CPUs
 	 *   (ie. smp_tlb_shootdown()).
+	 *
+	 * For the !SMP case it just needs to handle the former problem.
 	 */
+#ifdef SMP
 	mtx_lock_spin(&smp_ipi_mtx);
+#else
+	spinlock_enter();
+#endif
 
 	/* cpu_boot(howto); */ /* doesn't do anything at the moment */
 	cpu_reset();

From owner-svn-src-head@FreeBSD.ORG  Tue Apr 20 13:57:45 2010
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 15D611065670;
	Tue, 20 Apr 2010 13:57:45 +0000 (UTC)
	(envelope-from rnoland@FreeBSD.org)
Received: from gizmo.2hip.net (gizmo.2hip.net [64.74.207.195])
	by mx1.freebsd.org (Postfix) with ESMTP id CDA478FC13;
	Tue, 20 Apr 2010 13:57:44 +0000 (UTC)
Received: from [10.170.20.44] (nat-170-142-177-44.tn.gov [170.142.177.44])
	(authenticated bits=0)
	by gizmo.2hip.net (8.14.3/8.14.3) with ESMTP id o3KDvenf014804
	(version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO);
	Tue, 20 Apr 2010 09:57:41 -0400 (EDT)
	(envelope-from rnoland@FreeBSD.org)
Message-ID: <4BCDB2C8.7090505@FreeBSD.org>
Date: Tue, 20 Apr 2010 08:57:28 -0500
From: Robert Noland 
Organization: FreeBSD
User-Agent: Thunderbird 2.0.0.19 (X11/20090218)
MIME-Version: 1.0
To: Julian Elischer 
References: <201004191511.o3JFBjLj036350@svn.freebsd.org>
	<4BCC7E64.4040200@FreeBSD.org> <4BCCDCC9.2070604@elischer.org>
In-Reply-To: <4BCCDCC9.2070604@elischer.org>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
X-Spam-Status: No, score=0.9 required=5.0 tests=AWL, BAYES_00,
	FH_DATE_PAST_20XX, 
	RDNS_DYNAMIC,SPF_SOFTFAIL autolearn=no version=3.2.5
X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on gizmo.2hip.net
Cc: svn-src-head@freebsd.org, Luigi Rizzo ,
	src-committers@freebsd.org, svn-src-all@freebsd.org
Subject: Re: svn commit: r206843 - head/sbin/ipfw
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Tue, 20 Apr 2010 13:57:45 -0000



Julian Elischer wrote:
> On 4/19/10 9:01 AM, Robert Noland wrote:
>>
>>
>> Luigi Rizzo wrote:
> 
> 
> [...]
> 
>> Index: sbin/ipfw/ipfw2.c
>> ===================================================================
>> --- sbin/ipfw/ipfw2.c (revision 206844)
>> +++ sbin/ipfw/ipfw2.c (working copy)
>> @@ -326,7 +326,7 @@
>> #ifdef TCC
>> #define U64_FMT "I64"
>> #else
>> -#define U64_FMT "llu"
>> +#define U64_FMT "ju"
>> #endif
>> uint64_t d;
> 
>  believe there is a posix define for this?
> (though I can't remember it right now).

machine/_inttypes.h

...
#define PRIu8           "u"     /* uint8_t */
#define PRIu16          "u"     /* uint16_t */
#define PRIu32          "u"     /* uint32_t */
#define PRIu64          "lu"    /* uint64_t */
...

robert.


>>
>> robert.
> 
> [...]

From owner-svn-src-head@FreeBSD.ORG  Tue Apr 20 14:22:29 2010
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 964751065670;
	Tue, 20 Apr 2010 14:22:29 +0000 (UTC) (envelope-from kib@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 8319B8FC14;
	Tue, 20 Apr 2010 14:22:29 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o3KEMTgp050819;
	Tue, 20 Apr 2010 14:22:29 GMT (envelope-from kib@svn.freebsd.org)
Received: (from kib@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o3KEMTao050817;
	Tue, 20 Apr 2010 14:22:29 GMT (envelope-from kib@svn.freebsd.org)
Message-Id: <201004201422.o3KEMTao050817@svn.freebsd.org>
From: Konstantin Belousov 
Date: Tue, 20 Apr 2010 14:22:29 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r206898 - head/lib/libc/stdlib
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Tue, 20 Apr 2010 14:22:29 -0000

Author: kib
Date: Tue Apr 20 14:22:29 2010
New Revision: 206898
URL: http://svn.freebsd.org/changeset/base/206898

Log:
  Free() is not allowed to modify errno, remove safety brackets around it [1].
  Add small optimization, do not copy a string to the buffer that is
  to be freed immediately after.
  
  Noted by:	jh [1]
  Reviewed by:	jh
  MFC after:	2 weeks

Modified:
  head/lib/libc/stdlib/realpath.c

Modified: head/lib/libc/stdlib/realpath.c
==============================================================================
--- head/lib/libc/stdlib/realpath.c	Tue Apr 20 12:22:06 2010	(r206897)
+++ head/lib/libc/stdlib/realpath.c	Tue Apr 20 14:22:29 2010	(r206898)
@@ -84,12 +84,10 @@ realpath(const char * __restrict path, c
 		left_len = strlcpy(left, path + 1, sizeof(left));
 	} else {
 		if (getcwd(resolved, PATH_MAX) == NULL) {
-			strlcpy(resolved, ".", PATH_MAX);
-			if (m) {
-				serrno = errno;
+			if (m)
 				free(resolved);
-				errno = serrno;
-			}
+			else
+				strlcpy(resolved, ".", PATH_MAX);
 			return (NULL);
 		}
 		resolved_len = strlen(resolved);
@@ -168,11 +166,8 @@ realpath(const char * __restrict path, c
 				errno = serrno;
 				return (resolved);
 			}
-			if (m) {
-				serrno = errno;
+			if (m)
 				free(resolved);
-				errno = serrno;
-			}
 			return (NULL);
 		}
 		if (S_ISLNK(sb.st_mode)) {
@@ -184,11 +179,8 @@ realpath(const char * __restrict path, c
 			}
 			slen = readlink(resolved, symlink, sizeof(symlink) - 1);
 			if (slen < 0) {
-				if (m) {
-					serrno = errno;
+				if (m)
 					free(resolved);
-					errno = serrno;
-				}
 				return (NULL);
 			}
 			symlink[slen] = '\0';

From owner-svn-src-head@FreeBSD.ORG  Tue Apr 20 16:30:18 2010
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 033EA1065670;
	Tue, 20 Apr 2010 16:30:18 +0000 (UTC)
	(envelope-from rpaulo@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id E5BE28FC1A;
	Tue, 20 Apr 2010 16:30:17 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o3KGUHp8082389;
	Tue, 20 Apr 2010 16:30:17 GMT (envelope-from rpaulo@svn.freebsd.org)
Received: (from rpaulo@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o3KGUHKP082387;
	Tue, 20 Apr 2010 16:30:17 GMT (envelope-from rpaulo@svn.freebsd.org)
Message-Id: <201004201630.o3KGUHKP082387@svn.freebsd.org>
From: Rui Paulo 
Date: Tue, 20 Apr 2010 16:30:17 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r206900 - in head/sys: cddl/dev/cyclic/amd64
	modules/cyclic
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Tue, 20 Apr 2010 16:30:18 -0000

Author: rpaulo
Date: Tue Apr 20 16:30:17 2010
New Revision: 206900
URL: http://svn.freebsd.org/changeset/base/206900

Log:
  The amd64 version of the cyclic dtrace module is a verbatim copy of the
  i386 version, so instead having a copy of the same file, use Makefile
  foo to include the i386 version on amd64.

Deleted:
  head/sys/cddl/dev/cyclic/amd64/
Modified:
  head/sys/modules/cyclic/Makefile

Modified: head/sys/modules/cyclic/Makefile
==============================================================================
--- head/sys/modules/cyclic/Makefile	Tue Apr 20 15:23:12 2010	(r206899)
+++ head/sys/modules/cyclic/Makefile	Tue Apr 20 16:30:17 2010	(r206900)
@@ -10,7 +10,7 @@ SRCS+=		vnode_if.h
 CFLAGS+=	-I${.CURDIR}/../../cddl/compat/opensolaris		\
 		-I${.CURDIR}/../../cddl/contrib/opensolaris/uts/common	\
 		-I${.CURDIR}/../..					\
-		-I${.CURDIR}/../../cddl/dev/cyclic/${MACHINE_ARCH}
+		-I${.CURDIR}/../../cddl/dev/cyclic/${MACHINE_ARCH:S/amd64/i386/}
 
 CFLAGS+=	-DDEBUG=1
 

From owner-svn-src-head@FreeBSD.ORG  Tue Apr 20 17:03:30 2010
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id E91B11065670;
	Tue, 20 Apr 2010 17:03:30 +0000 (UTC)
	(envelope-from rpaulo@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id D75E08FC16;
	Tue, 20 Apr 2010 17:03:30 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o3KH3UXj089741;
	Tue, 20 Apr 2010 17:03:30 GMT (envelope-from rpaulo@svn.freebsd.org)
Received: (from rpaulo@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o3KH3Uj5089736;
	Tue, 20 Apr 2010 17:03:30 GMT (envelope-from rpaulo@svn.freebsd.org)
Message-Id: <201004201703.o3KH3Uj5089736@svn.freebsd.org>
From: Rui Paulo 
Date: Tue, 20 Apr 2010 17:03:30 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r206901 - in head/sys: amd64/amd64 cddl/dev/cyclic/i386
	i386/i386 sys
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Tue, 20 Apr 2010 17:03:31 -0000

Author: rpaulo
Date: Tue Apr 20 17:03:30 2010
New Revision: 206901
URL: http://svn.freebsd.org/changeset/base/206901

Log:
  Rename the cyclic global variable lapic_cyclic_clock_func to just
  cyclic_clock_func. This will make more sense when we start developing non
  x86 cyclic version.

Modified:
  head/sys/amd64/amd64/local_apic.c
  head/sys/cddl/dev/cyclic/i386/cyclic_machdep.c
  head/sys/i386/i386/local_apic.c
  head/sys/sys/dtrace_bsd.h

Modified: head/sys/amd64/amd64/local_apic.c
==============================================================================
--- head/sys/amd64/amd64/local_apic.c	Tue Apr 20 16:30:17 2010	(r206900)
+++ head/sys/amd64/amd64/local_apic.c	Tue Apr 20 17:03:30 2010	(r206901)
@@ -70,7 +70,7 @@ __FBSDID("$FreeBSD$");
 
 #ifdef KDTRACE_HOOKS
 #include 
-cyclic_clock_func_t	lapic_cyclic_clock_func[MAXCPU];
+cyclic_clock_func_t	cyclic_clock_func[MAXCPU];
 #endif
 
 /* Sanity checks on IDT vectors. */
@@ -778,8 +778,8 @@ lapic_handle_timer(struct trapframe *fra
 	 * timers.
 	 */
 	int cpu = PCPU_GET(cpuid);
-	if (lapic_cyclic_clock_func[cpu] != NULL)
-		(*lapic_cyclic_clock_func[cpu])(frame);
+	if (cyclic_clock_func[cpu] != NULL)
+		(*cyclic_clock_func[cpu])(frame);
 #endif
 
 	/* Fire hardclock at hz. */

Modified: head/sys/cddl/dev/cyclic/i386/cyclic_machdep.c
==============================================================================
--- head/sys/cddl/dev/cyclic/i386/cyclic_machdep.c	Tue Apr 20 16:30:17 2010	(r206900)
+++ head/sys/cddl/dev/cyclic/i386/cyclic_machdep.c	Tue Apr 20 17:03:30 2010	(r206901)
@@ -67,7 +67,7 @@ cyclic_machdep_uninit(void)
 
 	for (i = 0; i <= mp_maxid; i++)
 		/* Reset the cyclic clock callback hook. */
-		lapic_cyclic_clock_func[i] = NULL;
+		cyclic_clock_func[i] = NULL;
 
 	/* De-register the cyclic backend. */
 	cyclic_uninit();
@@ -105,13 +105,13 @@ cyclic_clock(struct trapframe *frame)
 static void enable(cyb_arg_t arg)
 {
 	/* Register the cyclic clock callback function. */
-	lapic_cyclic_clock_func[curcpu] = cyclic_clock;
+	cyclic_clock_func[curcpu] = cyclic_clock;
 }
 
 static void disable(cyb_arg_t arg)
 {
 	/* Reset the cyclic clock callback function. */
-	lapic_cyclic_clock_func[curcpu] = NULL;
+	cyclic_clock_func[curcpu] = NULL;
 }
 
 static void reprogram(cyb_arg_t arg, hrtime_t exp)

Modified: head/sys/i386/i386/local_apic.c
==============================================================================
--- head/sys/i386/i386/local_apic.c	Tue Apr 20 16:30:17 2010	(r206900)
+++ head/sys/i386/i386/local_apic.c	Tue Apr 20 17:03:30 2010	(r206901)
@@ -71,7 +71,7 @@ __FBSDID("$FreeBSD$");
 
 #ifdef KDTRACE_HOOKS
 #include 
-cyclic_clock_func_t	lapic_cyclic_clock_func[MAXCPU];
+cyclic_clock_func_t	cyclic_clock_func[MAXCPU];
 #endif
 
 /* Sanity checks on IDT vectors. */
@@ -779,8 +779,8 @@ lapic_handle_timer(struct trapframe *fra
 	 * timers.
 	 */
 	int cpu = PCPU_GET(cpuid);
-	if (lapic_cyclic_clock_func[cpu] != NULL)
-		(*lapic_cyclic_clock_func[cpu])(frame);
+	if (cyclic_clock_func[cpu] != NULL)
+		(*cyclic_clock_func[cpu])(frame);
 #endif
 
 	/* Fire hardclock at hz. */

Modified: head/sys/sys/dtrace_bsd.h
==============================================================================
--- head/sys/sys/dtrace_bsd.h	Tue Apr 20 16:30:17 2010	(r206900)
+++ head/sys/sys/dtrace_bsd.h	Tue Apr 20 17:03:30 2010	(r206901)
@@ -50,7 +50,7 @@ typedef	void (*cyclic_clock_func_t)(stru
  *
  * Defining them here avoids a proliferation of header files.
  */
-extern cyclic_clock_func_t     lapic_cyclic_clock_func[];
+extern cyclic_clock_func_t     cyclic_clock_func[];
 
 /*
  * The dtrace module handles traps that occur during a DTrace probe.

From owner-svn-src-head@FreeBSD.ORG  Tue Apr 20 17:22:20 2010
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id A7CF71065676;
	Tue, 20 Apr 2010 17:22:20 +0000 (UTC)
	(envelope-from rpaulo@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 96F9A8FC14;
	Tue, 20 Apr 2010 17:22:20 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o3KHMKVm093879;
	Tue, 20 Apr 2010 17:22:20 GMT (envelope-from rpaulo@svn.freebsd.org)
Received: (from rpaulo@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o3KHMKIf093877;
	Tue, 20 Apr 2010 17:22:20 GMT (envelope-from rpaulo@svn.freebsd.org)
Message-Id: <201004201722.o3KHMKIf093877@svn.freebsd.org>
From: Rui Paulo 
Date: Tue, 20 Apr 2010 17:22:20 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r206902 - head/sys/mips/mips
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Tue, 20 Apr 2010 17:22:20 -0000

Author: rpaulo
Date: Tue Apr 20 17:22:20 2010
New Revision: 206902
URL: http://svn.freebsd.org/changeset/base/206902

Log:
  Add the necessary hooks for dtrace cyclic module.

Modified:
  head/sys/mips/mips/tick.c

Modified: head/sys/mips/mips/tick.c
==============================================================================
--- head/sys/mips/mips/tick.c	Tue Apr 20 17:03:30 2010	(r206901)
+++ head/sys/mips/mips/tick.c	Tue Apr 20 17:22:20 2010	(r206902)
@@ -295,7 +295,16 @@ clock_intr(void *arg)
 	 */
 	if (delta > cycles_per_hz)
 		delta = cycles_per_hz;
-
+#if KDTRACE_HOOKS
+	/*
+	 * If the DTrace hooks are configured and a callback function
+	 * has been registered, then call it to process the high speed
+	 * timers.
+	 */
+	int cpu = PCPU_GET(cpuid);
+	if (cyclic_clock_func[cpu] != NULL)
+		(*cyclic_clock_func[cpu])(tf);
+#endif
 	/* Fire hardclock at hz. */
 	cpu_ticks->hard_ticks += delta;
 	if (cpu_ticks->hard_ticks >= cycles_per_hz) {

From owner-svn-src-head@FreeBSD.ORG  Tue Apr 20 17:57:44 2010
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 536EB1065672;
	Tue, 20 Apr 2010 17:57:44 +0000 (UTC) (envelope-from imp@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 42C018FC17;
	Tue, 20 Apr 2010 17:57:44 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o3KHvio9001747;
	Tue, 20 Apr 2010 17:57:44 GMT (envelope-from imp@svn.freebsd.org)
Received: (from imp@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o3KHvi2L001745;
	Tue, 20 Apr 2010 17:57:44 GMT (envelope-from imp@svn.freebsd.org)
Message-Id: <201004201757.o3KHvi2L001745@svn.freebsd.org>
From: Warner Losh 
Date: Tue, 20 Apr 2010 17:57:44 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r206903 - head/sys/sys
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Tue, 20 Apr 2010 17:57:44 -0000

Author: imp
Date: Tue Apr 20 17:57:43 2010
New Revision: 206903
URL: http://svn.freebsd.org/changeset/base/206903

Log:
  Make this file more C++ friendly.

Modified:
  head/sys/sys/thr.h

Modified: head/sys/sys/thr.h
==============================================================================
--- head/sys/sys/thr.h	Tue Apr 20 17:22:20 2010	(r206902)
+++ head/sys/sys/thr.h	Tue Apr 20 17:57:43 2010	(r206903)
@@ -30,6 +30,7 @@
 #ifndef _SYS_THR_H_
 #define	_SYS_THR_H_
 
+#include 
 #include 
 #include 
 
@@ -68,6 +69,7 @@ typedef __pid_t		pid_t;
 #define _PID_T_DECLARED
 #endif
 
+__BEGIN_DECLS
 int thr_create(ucontext_t *ctx, long *id, int flags);
 int thr_new(struct thr_param *param, int param_size);
 int thr_self(long *id);
@@ -77,7 +79,7 @@ int thr_kill2(pid_t pid, long id, int si
 int thr_suspend(const struct timespec *timeout);
 int thr_wake(long id);
 int thr_set_name(long id, const char *name);
-
+__END_DECLS
 #endif /* !_KERNEL */
 
 #endif /* ! _SYS_THR_H_ */

From owner-svn-src-head@FreeBSD.ORG  Tue Apr 20 18:16:57 2010
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 3398C1065677;
	Tue, 20 Apr 2010 18:16:57 +0000 (UTC)
	(envelope-from anchie@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id E06BA8FC25;
	Tue, 20 Apr 2010 18:16:56 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o3KIGuSD006082;
	Tue, 20 Apr 2010 18:16:56 GMT (envelope-from anchie@svn.freebsd.org)
Received: (from anchie@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o3KIGuAk006081;
	Tue, 20 Apr 2010 18:16:56 GMT (envelope-from anchie@svn.freebsd.org)
Message-Id: <201004201816.o3KIGuAk006081@svn.freebsd.org>
From: Ana Kukec 
Date: Tue, 20 Apr 2010 18:16:56 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r206904 - head/share/misc
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Tue, 20 Apr 2010 18:16:57 -0000

Author: anchie
Date: Tue Apr 20 18:16:56 2010
New Revision: 206904
URL: http://svn.freebsd.org/changeset/base/206904

Log:
  Add myself and list bz@ as my mentor.
  
  Approved by:	bz (mentor)

Modified:
  head/share/misc/committers-src.dot

Modified: head/share/misc/committers-src.dot
==============================================================================
--- head/share/misc/committers-src.dot	Tue Apr 20 17:57:43 2010	(r206903)
+++ head/share/misc/committers-src.dot	Tue Apr 20 18:16:56 2010	(r206904)
@@ -55,6 +55,7 @@ node [color=lightblue2, style=filled, bg
 ache [label="Andrey Chernov\nache@FreeBSD.org\n1993/10/31"]
 akiyama [label="Shunsuke Akiyama\nakiyama@FreeBSD.org\n2000/06/19"]
 ambrisko [label="Doug Ambrisko\nambrisko@FreeBSD.org\n2001/12/19"]
+anchie [label="Ana Kukec\anchie@FreeBSD.org\n2010/04/14"]
 andre [label="Andre Oppermann\nandre@FreeBSD.org\n2003/11/12"]
 anholt [label="Eric Anholt\nanholt@FreeBSD.org\n2002/04/22"]
 antoine [label="Antoine Brodin\nantoine@FreeBSD.org\n2008/02/03"]
@@ -238,6 +239,7 @@ brian -> joe
 brooks -> bushman
 brooks -> jamie
 
+bz -> anchie
 bz -> jamie
 bz -> syrinx
 

From owner-svn-src-head@FreeBSD.ORG  Tue Apr 20 19:30:12 2010
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 955561065673;
	Tue, 20 Apr 2010 19:30:12 +0000 (UTC)
	(envelope-from brucec@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 847308FC15;
	Tue, 20 Apr 2010 19:30:12 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o3KJUCJi022416;
	Tue, 20 Apr 2010 19:30:12 GMT (envelope-from brucec@svn.freebsd.org)
Received: (from brucec@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o3KJUCMR022414;
	Tue, 20 Apr 2010 19:30:12 GMT (envelope-from brucec@svn.freebsd.org)
Message-Id: <201004201930.o3KJUCMR022414@svn.freebsd.org>
From: Bruce Cran 
Date: Tue, 20 Apr 2010 19:30:12 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r206909 - head/sys/dev/sis
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Tue, 20 Apr 2010 19:30:12 -0000

Author: brucec
Date: Tue Apr 20 19:30:12 2010
New Revision: 206909
URL: http://svn.freebsd.org/changeset/base/206909

Log:
  It's not necessary to reset the chip every time an input overflow event
  occurs. In addition, the delay when programming the short cable fix
  should be 100us, not 100ms.
  
  PR:	kern/64556
  Submitted by:	Thomas Hurst 
  Approved by:	rrs (mentor)
  MFC after:	1 week

Modified:
  head/sys/dev/sis/if_sis.c

Modified: head/sys/dev/sis/if_sis.c
==============================================================================
--- head/sys/dev/sis/if_sis.c	Tue Apr 20 18:46:00 2010	(r206908)
+++ head/sys/dev/sis/if_sis.c	Tue Apr 20 19:30:12 2010	(r206909)
@@ -1483,15 +1483,6 @@ sis_rxeof(struct sis_softc *sc)
 	return (rx_npkts);
 }
 
-static void
-sis_rxeoc(struct sis_softc *sc)
-{
-
-	SIS_LOCK_ASSERT(sc);
-	sis_rxeof(sc);
-	sis_initl(sc);
-}
-
 /*
  * A frame was downloaded to the chip. It's safe for us to clean up
  * the list buffers.
@@ -1614,7 +1605,7 @@ sis_poll(struct ifnet *ifp, enum poll_cm
 		status = CSR_READ_4(sc, SIS_ISR);
 
 		if (status & (SIS_ISR_RX_ERR|SIS_ISR_RX_OFLOW))
-			sis_rxeoc(sc);
+			ifp->if_ierrors++;
 
 		if (status & (SIS_ISR_RX_IDLE))
 			SIS_SETBIT(sc, SIS_CSR, SIS_CSR_RX_ENABLE);
@@ -1672,7 +1663,7 @@ sis_intr(void *arg)
 			sis_rxeof(sc);
 
 		if (status & SIS_ISR_RX_OFLOW)
-			sis_rxeoc(sc);
+			ifp->if_ierrors++;
 
 		if (status & (SIS_ISR_RX_IDLE))
 			SIS_SETBIT(sc, SIS_CSR, SIS_CSR_RX_ENABLE);
@@ -2017,7 +2008,7 @@ sis_initl(struct sis_softc *sc)
 		CSR_WRITE_4(sc, NS_PHY_PAGE, 0x0001);
 		reg = CSR_READ_4(sc, NS_PHY_DSPCFG) & 0xfff;
 		CSR_WRITE_4(sc, NS_PHY_DSPCFG, reg | 0x1000);
-		DELAY(100000);
+		DELAY(100);
 		reg = CSR_READ_4(sc, NS_PHY_TDATA) & 0xff;
 		if ((reg & 0x0080) == 0 || (reg > 0xd8 && reg <= 0xff)) {
 			device_printf(sc->sis_dev,

From owner-svn-src-head@FreeBSD.ORG  Tue Apr 20 20:35:09 2010
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 59C89106564A;
	Tue, 20 Apr 2010 20:35:09 +0000 (UTC) (envelope-from bz@FreeBSD.org)
Received: from mail.cksoft.de (mail.cksoft.de [IPv6:2001:4068:10::3])
	by mx1.freebsd.org (Postfix) with ESMTP id CED918FC27;
	Tue, 20 Apr 2010 20:35:08 +0000 (UTC)
Received: from localhost (amavis.fra.cksoft.de [192.168.74.71])
	by mail.cksoft.de (Postfix) with ESMTP id 3C49F41C751;
	Tue, 20 Apr 2010 22:35:07 +0200 (CEST)
X-Virus-Scanned: amavisd-new at cksoft.de
Received: from mail.cksoft.de ([192.168.74.103])
	by localhost (amavis.fra.cksoft.de [192.168.74.71]) (amavisd-new,
	port 10024)
	with ESMTP id oRq+C9l2EdAT; Tue, 20 Apr 2010 22:35:06 +0200 (CEST)
Received: by mail.cksoft.de (Postfix, from userid 66)
	id 5045F41C75A; Tue, 20 Apr 2010 22:35:06 +0200 (CEST)
Received: from maildrop.int.zabbadoz.net (maildrop.int.zabbadoz.net
	[10.111.66.10])
	(using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits))
	(No client certificate requested)
	by mail.int.zabbadoz.net (Postfix) with ESMTP id 68AF044496D;
	Tue, 20 Apr 2010 20:30:19 +0000 (UTC)
Date: Tue, 20 Apr 2010 20:30:18 +0000 (UTC)
From: "Bjoern A. Zeeb" 
X-X-Sender: bz@maildrop.int.zabbadoz.net
To: Rui Paulo 
In-Reply-To: <201004201703.o3KH3Uj5089736@svn.freebsd.org>
Message-ID: <20100420202929.X40281@maildrop.int.zabbadoz.net>
References: <201004201703.o3KH3Uj5089736@svn.freebsd.org>
X-OpenPGP-Key: 0x14003F198FEFA3E77207EE8D2B58B8F83CCF1842
MIME-Version: 1.0
Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed
Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org,
	src-committers@freebsd.org
Subject: Re: svn commit: r206901 - in head/sys: amd64/amd64
 cddl/dev/cyclic/i386 i386/i386 sys
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Tue, 20 Apr 2010 20:35:09 -0000

On Tue, 20 Apr 2010, Rui Paulo wrote:

> Author: rpaulo
> Date: Tue Apr 20 17:03:30 2010
> New Revision: 206901
> URL: http://svn.freebsd.org/changeset/base/206901
>
> Log:
>  Rename the cyclic global variable lapic_cyclic_clock_func to just
>  cyclic_clock_func. This will make more sense when we start developing non
>  x86 cyclic version.

I think this is the cause for LINT.386 failing with:

  87 /scratch/tmp/bz/HEAD.svn/sys/x86/isa/clock.c: In function 'clkintr':
  88 /scratch/tmp/bz/HEAD.svn/sys/x86/isa/clock.c:189: error: 'lapic_cyclic_clock_func' undeclared (first use in this function)
  89 /scratch/tmp/bz/HEAD.svn/sys/x86/isa/clock.c:189: error: (Each undeclared identifier is reported only once
  90 /scratch/tmp/bz/HEAD.svn/sys/x86/isa/clock.c:189: error: for each function it appears in.)



> Modified:
>  head/sys/amd64/amd64/local_apic.c
>  head/sys/cddl/dev/cyclic/i386/cyclic_machdep.c
>  head/sys/i386/i386/local_apic.c
>  head/sys/sys/dtrace_bsd.h
>
> Modified: head/sys/amd64/amd64/local_apic.c
> ==============================================================================
> --- head/sys/amd64/amd64/local_apic.c	Tue Apr 20 16:30:17 2010	(r206900)
> +++ head/sys/amd64/amd64/local_apic.c	Tue Apr 20 17:03:30 2010	(r206901)
> @@ -70,7 +70,7 @@ __FBSDID("$FreeBSD$");
>
> #ifdef KDTRACE_HOOKS
> #include 
> -cyclic_clock_func_t	lapic_cyclic_clock_func[MAXCPU];
> +cyclic_clock_func_t	cyclic_clock_func[MAXCPU];
> #endif
>
> /* Sanity checks on IDT vectors. */
> @@ -778,8 +778,8 @@ lapic_handle_timer(struct trapframe *fra
> 	 * timers.
> 	 */
> 	int cpu = PCPU_GET(cpuid);
> -	if (lapic_cyclic_clock_func[cpu] != NULL)
> -		(*lapic_cyclic_clock_func[cpu])(frame);
> +	if (cyclic_clock_func[cpu] != NULL)
> +		(*cyclic_clock_func[cpu])(frame);
> #endif
>
> 	/* Fire hardclock at hz. */
>
> Modified: head/sys/cddl/dev/cyclic/i386/cyclic_machdep.c
> ==============================================================================
> --- head/sys/cddl/dev/cyclic/i386/cyclic_machdep.c	Tue Apr 20 16:30:17 2010	(r206900)
> +++ head/sys/cddl/dev/cyclic/i386/cyclic_machdep.c	Tue Apr 20 17:03:30 2010	(r206901)
> @@ -67,7 +67,7 @@ cyclic_machdep_uninit(void)
>
> 	for (i = 0; i <= mp_maxid; i++)
> 		/* Reset the cyclic clock callback hook. */
> -		lapic_cyclic_clock_func[i] = NULL;
> +		cyclic_clock_func[i] = NULL;
>
> 	/* De-register the cyclic backend. */
> 	cyclic_uninit();
> @@ -105,13 +105,13 @@ cyclic_clock(struct trapframe *frame)
> static void enable(cyb_arg_t arg)
> {
> 	/* Register the cyclic clock callback function. */
> -	lapic_cyclic_clock_func[curcpu] = cyclic_clock;
> +	cyclic_clock_func[curcpu] = cyclic_clock;
> }
>
> static void disable(cyb_arg_t arg)
> {
> 	/* Reset the cyclic clock callback function. */
> -	lapic_cyclic_clock_func[curcpu] = NULL;
> +	cyclic_clock_func[curcpu] = NULL;
> }
>
> static void reprogram(cyb_arg_t arg, hrtime_t exp)
>
> Modified: head/sys/i386/i386/local_apic.c
> ==============================================================================
> --- head/sys/i386/i386/local_apic.c	Tue Apr 20 16:30:17 2010	(r206900)
> +++ head/sys/i386/i386/local_apic.c	Tue Apr 20 17:03:30 2010	(r206901)
> @@ -71,7 +71,7 @@ __FBSDID("$FreeBSD$");
>
> #ifdef KDTRACE_HOOKS
> #include 
> -cyclic_clock_func_t	lapic_cyclic_clock_func[MAXCPU];
> +cyclic_clock_func_t	cyclic_clock_func[MAXCPU];
> #endif
>
> /* Sanity checks on IDT vectors. */
> @@ -779,8 +779,8 @@ lapic_handle_timer(struct trapframe *fra
> 	 * timers.
> 	 */
> 	int cpu = PCPU_GET(cpuid);
> -	if (lapic_cyclic_clock_func[cpu] != NULL)
> -		(*lapic_cyclic_clock_func[cpu])(frame);
> +	if (cyclic_clock_func[cpu] != NULL)
> +		(*cyclic_clock_func[cpu])(frame);
> #endif
>
> 	/* Fire hardclock at hz. */
>
> Modified: head/sys/sys/dtrace_bsd.h
> ==============================================================================
> --- head/sys/sys/dtrace_bsd.h	Tue Apr 20 16:30:17 2010	(r206900)
> +++ head/sys/sys/dtrace_bsd.h	Tue Apr 20 17:03:30 2010	(r206901)
> @@ -50,7 +50,7 @@ typedef	void (*cyclic_clock_func_t)(stru
>  *
>  * Defining them here avoids a proliferation of header files.
>  */
> -extern cyclic_clock_func_t     lapic_cyclic_clock_func[];
> +extern cyclic_clock_func_t     cyclic_clock_func[];
>
> /*
>  * The dtrace module handles traps that occur during a DTrace probe.
>

-- 
Bjoern A. Zeeb         It will not break if you know what you are doing.

From owner-svn-src-head@FreeBSD.ORG  Tue Apr 20 20:36:38 2010
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 8E9261065673;
	Tue, 20 Apr 2010 20:36:38 +0000 (UTC) (envelope-from imp@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 7E3AB8FC23;
	Tue, 20 Apr 2010 20:36:38 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o3KKacAr037397;
	Tue, 20 Apr 2010 20:36:38 GMT (envelope-from imp@svn.freebsd.org)
Received: (from imp@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o3KKac1w037395;
	Tue, 20 Apr 2010 20:36:38 GMT (envelope-from imp@svn.freebsd.org)
Message-Id: <201004202036.o3KKac1w037395@svn.freebsd.org>
From: Warner Losh 
Date: Tue, 20 Apr 2010 20:36:38 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r206915 - head/usr.sbin/config
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Tue, 20 Apr 2010 20:36:38 -0000

Author: imp
Date: Tue Apr 20 20:36:38 2010
New Revision: 206915
URL: http://svn.freebsd.org/changeset/base/206915

Log:
  Bump minor version of config to reflect the new option remapping
  feature.  The kernel makefiles have specifically not been bumped
  because nothing uses this new feature and doing so forces everybody to
  recompile for no good reason.  This chnage will be MFC'd where the
  kernel version numbers for amd64 and ia64 will be bumped, since those
  are the only two that have use the option remapping feature.  Once
  merged, this will give a better error message to folks that are using
  buildkernel without buildworld or kernel-toolchain to update their
  kernels.
  
  MFC after:	3 days

Modified:
  head/usr.sbin/config/configvers.h

Modified: head/usr.sbin/config/configvers.h
==============================================================================
--- head/usr.sbin/config/configvers.h	Tue Apr 20 20:26:26 2010	(r206914)
+++ head/usr.sbin/config/configvers.h	Tue Apr 20 20:36:38 2010	(r206915)
@@ -49,5 +49,5 @@
  *
  * $FreeBSD$
  */
-#define	CONFIGVERS	600007
+#define	CONFIGVERS	600008
 #define	MAJOR_VERS(x)	((x) / 100000)

From owner-svn-src-head@FreeBSD.ORG  Tue Apr 20 20:39:43 2010
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 05930106564A;
	Tue, 20 Apr 2010 20:39:43 +0000 (UTC) (envelope-from imp@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id E94A28FC08;
	Tue, 20 Apr 2010 20:39:42 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o3KKdg2m038080;
	Tue, 20 Apr 2010 20:39:42 GMT (envelope-from imp@svn.freebsd.org)
Received: (from imp@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o3KKdg86038078;
	Tue, 20 Apr 2010 20:39:42 GMT (envelope-from imp@svn.freebsd.org)
Message-Id: <201004202039.o3KKdg86038078@svn.freebsd.org>
From: Warner Losh 
Date: Tue, 20 Apr 2010 20:39:42 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r206916 - head/sys/kern
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Tue, 20 Apr 2010 20:39:43 -0000

Author: imp
Date: Tue Apr 20 20:39:42 2010
New Revision: 206916
URL: http://svn.freebsd.org/changeset/base/206916

Log:
  Make sure that we free the passed in data message if we don't actually
  insert it onto the queue.  Also, fix a mtx leak if someone turns off
  devctl while we're processing a messages.
  
  MFC after:	5 days

Modified:
  head/sys/kern/subr_bus.c

Modified: head/sys/kern/subr_bus.c
==============================================================================
--- head/sys/kern/subr_bus.c	Tue Apr 20 20:36:38 2010	(r206915)
+++ head/sys/kern/subr_bus.c	Tue Apr 20 20:39:42 2010	(r206916)
@@ -545,15 +545,16 @@ devctl_queue_data(char *data)
 	struct proc *p;
 
 	if (strlen(data) == 0)
-		return;
+		goto out;
 	if (devctl_queue_length == 0)
-		return;
+		goto out;
 	n1 = malloc(sizeof(*n1), M_BUS, M_NOWAIT);
 	if (n1 == NULL)
-		return;
+		goto out;
 	n1->dei_data = data;
 	mtx_lock(&devsoftc.mtx);
 	if (devctl_queue_length == 0) {
+		mtx_unlock(&devsoftc.mtx);
 		free(n1->dei_data, M_BUS);
 		free(n1, M_BUS);
 		return;
@@ -577,6 +578,14 @@ devctl_queue_data(char *data)
 		psignal(p, SIGIO);
 		PROC_UNLOCK(p);
 	}
+	return;
+out:
+	/*
+	 * We have to free data on all error paths since the caller
+	 * assumes it will be free'd when this item is dequeued.
+	 */
+	free(data, M_BUS);
+	return;
 }
 
 /**

From owner-svn-src-head@FreeBSD.ORG  Tue Apr 20 20:58:49 2010
Return-Path: 
Delivered-To: svn-src-head@FreeBSD.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 160EE106566C;
	Tue, 20 Apr 2010 20:58:49 +0000 (UTC)
	(envelope-from peterjeremy@acm.org)
Received: from mail36.syd.optusnet.com.au (mail36.syd.optusnet.com.au
	[211.29.133.76])
	by mx1.freebsd.org (Postfix) with ESMTP id 7C50E8FC1B;
	Tue, 20 Apr 2010 20:58:48 +0000 (UTC)
Received: from server.vk2pj.dyndns.org
	(c122-106-253-149.belrs3.nsw.optusnet.com.au [122.106.253.149])
	by mail36.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id
	o3KKwjRA025757
	(version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO);
	Wed, 21 Apr 2010 06:58:46 +1000
X-Bogosity: Ham, spamicity=0.000000
Received: from server.vk2pj.dyndns.org (localhost.vk2pj.dyndns.org [127.0.0.1])
	by server.vk2pj.dyndns.org (8.14.4/8.14.4) with ESMTP id o3KKwjER038564;
	Wed, 21 Apr 2010 06:58:45 +1000 (EST)
	(envelope-from peter@server.vk2pj.dyndns.org)
Received: (from peter@localhost)
	by server.vk2pj.dyndns.org (8.14.4/8.14.4/Submit) id o3KKwjVf038563;
	Wed, 21 Apr 2010 06:58:45 +1000 (EST) (envelope-from peter)
Date: Wed, 21 Apr 2010 06:58:45 +1000
From: Peter Jeremy 
To: Alan Cox 
Message-ID: <20100420205845.GA38549@server.vk2pj.dyndns.org>
References: <201004182129.o3ILTSCd098832@svn.freebsd.org>
MIME-Version: 1.0
Content-Type: multipart/signed; micalg=pgp-sha1;
	protocol="application/pgp-signature"; boundary="y0ulUmNC+osPPQO6"
Content-Disposition: inline
In-Reply-To: <201004182129.o3ILTSCd098832@svn.freebsd.org>
X-PGP-Key: http://members.optusnet.com.au/peterjeremy/pubkey.asc
User-Agent: Mutt/1.5.20 (2009-06-14)
Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org,
	src-committers@FreeBSD.org
Subject: Re: svn commit: r206814 - head/sys/vm
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Tue, 20 Apr 2010 20:58:49 -0000


--y0ulUmNC+osPPQO6
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On 2010-Apr-18 21:29:28 +0000, Alan Cox  wrote:
>  Remove a nonsensical test from vm_pageout_clean().  A page can't be in t=
he
>  inactive queue and have a non-zero wire count.

Should this test be turned into a KASSERT()?

--=20
Peter Jeremy

--y0ulUmNC+osPPQO6
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.14 (FreeBSD)

iEYEARECAAYFAkvOFYUACgkQ/opHv/APuIcIigCfXz9uw4dOnYsNA7hOwxUY0rAC
cO4AmQH5UcXSC7v9dC+DJGjRQRrFp42W
=dLMO
-----END PGP SIGNATURE-----

--y0ulUmNC+osPPQO6--

From owner-svn-src-head@FreeBSD.ORG  Tue Apr 20 21:04:57 2010
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id BB422106566B;
	Tue, 20 Apr 2010 21:04:57 +0000 (UTC)
	(envelope-from rpaulo@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id AAFAC8FC18;
	Tue, 20 Apr 2010 21:04:57 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o3KL4vEA043957;
	Tue, 20 Apr 2010 21:04:57 GMT (envelope-from rpaulo@svn.freebsd.org)
Received: (from rpaulo@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o3KL4vHv043955;
	Tue, 20 Apr 2010 21:04:57 GMT (envelope-from rpaulo@svn.freebsd.org)
Message-Id: <201004202104.o3KL4vHv043955@svn.freebsd.org>
From: Rui Paulo 
Date: Tue, 20 Apr 2010 21:04:57 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r206922 - head/sys/x86/isa
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Tue, 20 Apr 2010 21:04:57 -0000

Author: rpaulo
Date: Tue Apr 20 21:04:57 2010
New Revision: 206922
URL: http://svn.freebsd.org/changeset/base/206922

Log:
  Fix another instance of lapic_cyclic_clock_func.

Modified:
  head/sys/x86/isa/clock.c

Modified: head/sys/x86/isa/clock.c
==============================================================================
--- head/sys/x86/isa/clock.c	Tue Apr 20 21:03:42 2010	(r206921)
+++ head/sys/x86/isa/clock.c	Tue Apr 20 21:04:57 2010	(r206922)
@@ -186,8 +186,8 @@ clkintr(struct trapframe *frame)
 	 * timers.
 	 */
 	int cpu = PCPU_GET(cpuid);
-	if (lapic_cyclic_clock_func[cpu] != NULL)
-		(*lapic_cyclic_clock_func[cpu])(frame);
+	if (cyclic_clock_func[cpu] != NULL)
+		(*cyclic_clock_func[cpu])(frame);
 #endif
 
 	if (using_atrtc_timer) {

From owner-svn-src-head@FreeBSD.ORG  Tue Apr 20 21:14:31 2010
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 08C0B106566C;
	Tue, 20 Apr 2010 21:14:31 +0000 (UTC)
	(envelope-from delphij@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id EB6518FC17;
	Tue, 20 Apr 2010 21:14:30 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o3KLEUCt046172;
	Tue, 20 Apr 2010 21:14:30 GMT (envelope-from delphij@svn.freebsd.org)
Received: (from delphij@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o3KLEUNa046153;
	Tue, 20 Apr 2010 21:14:30 GMT (envelope-from delphij@svn.freebsd.org)
Message-Id: <201004202114.o3KLEUNa046153@svn.freebsd.org>
From: Xin LI 
Date: Tue, 20 Apr 2010 21:14:30 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r206924 - head/lib/libz
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Tue, 20 Apr 2010 21:14:31 -0000

Author: delphij
Date: Tue Apr 20 21:14:30 2010
New Revision: 206924
URL: http://svn.freebsd.org/changeset/base/206924

Log:
  MFV: zlib 1.2.5.

Modified:
  head/lib/libz/ChangeLog
  head/lib/libz/README
  head/lib/libz/crc32.c
  head/lib/libz/deflate.c
  head/lib/libz/deflate.h
  head/lib/libz/gzguts.h
  head/lib/libz/gzlib.c
  head/lib/libz/inffast.c
  head/lib/libz/inffast.h
  head/lib/libz/inftrees.c
  head/lib/libz/inftrees.h
  head/lib/libz/trees.c
  head/lib/libz/trees.h
  head/lib/libz/zconf.h
  head/lib/libz/zlib.3
  head/lib/libz/zlib.h
  head/lib/libz/zutil.c
  head/lib/libz/zutil.h
Directory Properties:
  head/lib/libz/   (props changed)

Modified: head/lib/libz/ChangeLog
==============================================================================
--- head/lib/libz/ChangeLog	Tue Apr 20 21:08:00 2010	(r206923)
+++ head/lib/libz/ChangeLog	Tue Apr 20 21:14:30 2010	(r206924)
@@ -1,6 +1,32 @@
 
                 ChangeLog file for zlib
 
+Changes in 1.2.5 (19 Apr 2010)
+- Disable visibility attribute in win32/Makefile.gcc [Bar-Lev]
+- Default to libdir as sharedlibdir in configure [Nieder]
+- Update copyright dates on modified source files
+- Update trees.c to be able to generate modified trees.h
+- Exit configure for MinGW, suggesting win32/Makefile.gcc
+
+Changes in 1.2.4.5 (18 Apr 2010)
+- Set sharedlibdir in configure [Torok]
+- Set LDFLAGS in Makefile.in [Bar-Lev]
+- Avoid mkdir objs race condition in Makefile.in [Bowler]
+- Add ZLIB_INTERNAL in front of internal inter-module functions and arrays
+- Define ZLIB_INTERNAL to hide internal functions and arrays for GNU C
+- Don't use hidden attribute when it is a warning generator (e.g. Solaris)
+
+Changes in 1.2.4.4 (18 Apr 2010)
+- Fix CROSS_PREFIX executable testing, CHOST extract, mingw* [Torok]
+- Undefine _LARGEFILE64_SOURCE in zconf.h if it is zero, but not if empty
+- Try to use bash or ksh regardless of functionality of /bin/sh
+- Fix configure incompatibility with NetBSD sh
+- Remove attempt to run under bash or ksh since have better NetBSD fix
+- Fix win32/Makefile.gcc for MinGW [Bar-Lev]
+- Add diagnostic messages when using CROSS_PREFIX in configure
+- Added --sharedlibdir option to configure [Weigelt]
+- Use hidden visibility attribute when available [Frysinger]
+
 Changes in 1.2.4.3 (10 Apr 2010)
 - Only use CROSS_PREFIX in configure for ar and ranlib if they exist
 - Use CROSS_PREFIX for nm [Bar-Lev]
@@ -151,7 +177,7 @@ Changes in 1.2.3.6 (17 Jan 2010)
 - Correct email address in configure for system options
 - Update make_vms.com and add make_vms.com to contrib/minizip [Zinser]
 - Update zlib.map [Brown]
-- Fix Makefile.in for Solaris 10 make of example64 and minizip64 [Tšršk]
+- Fix Makefile.in for Solaris 10 make of example64 and minizip64 [Torok]
 - Apply various fixes to CMakeLists.txt [Lowman]
 - Add checks on len in gzread() and gzwrite()
 - Add error message for no more room for gzungetc()

Modified: head/lib/libz/README
==============================================================================
--- head/lib/libz/README	Tue Apr 20 21:08:00 2010	(r206923)
+++ head/lib/libz/README	Tue Apr 20 21:14:30 2010	(r206924)
@@ -1,6 +1,6 @@
 ZLIB DATA COMPRESSION LIBRARY
 
-zlib 1.2.4.3 is a general purpose data compression library.  All the code is
+zlib 1.2.5 is a general purpose data compression library.  All the code is
 thread safe.  The data format used by the zlib library is described by RFCs
 (Request for Comments) 1950 to 1952 in the files
 http://www.ietf.org/rfc/rfc1950.txt (zlib format), rfc1951.txt (deflate format)
@@ -31,7 +31,7 @@ Mark Nelson  wrote an ar
 issue of Dr.  Dobb's Journal; a copy of the article is available at
 http://marknelson.us/1997/01/01/zlib-engine/ .
 
-The changes made in version 1.2.4.3 are documented in the file ChangeLog.
+The changes made in version 1.2.5 are documented in the file ChangeLog.
 
 Unsupported third party contributions are provided in directory contrib/ .
 

Modified: head/lib/libz/crc32.c
==============================================================================
--- head/lib/libz/crc32.c	Tue Apr 20 21:08:00 2010	(r206923)
+++ head/lib/libz/crc32.c	Tue Apr 20 21:14:30 2010	(r206924)
@@ -1,5 +1,5 @@
 /* crc32.c -- compute the CRC-32 of a data stream
- * Copyright (C) 1995-2006 Mark Adler
+ * Copyright (C) 1995-2006, 2010 Mark Adler
  * For conditions of distribution and use, see copyright notice in zlib.h
  *
  * Thanks to Rodney Brown  for his contribution of faster

Modified: head/lib/libz/deflate.c
==============================================================================
--- head/lib/libz/deflate.c	Tue Apr 20 21:08:00 2010	(r206923)
+++ head/lib/libz/deflate.c	Tue Apr 20 21:14:30 2010	(r206924)
@@ -52,7 +52,7 @@
 #include "deflate.h"
 
 const char deflate_copyright[] =
-   " deflate 1.2.4.3 Copyright 1995-2010 Jean-loup Gailly and Mark Adler ";
+   " deflate 1.2.5 Copyright 1995-2010 Jean-loup Gailly and Mark Adler ";
 /*
   If you use the zlib library in a product, an acknowledgment is welcome
   in the documentation of your product. If for some reason you cannot

Modified: head/lib/libz/deflate.h
==============================================================================
--- head/lib/libz/deflate.h	Tue Apr 20 21:08:00 2010	(r206923)
+++ head/lib/libz/deflate.h	Tue Apr 20 21:14:30 2010	(r206924)
@@ -1,5 +1,5 @@
 /* deflate.h -- internal compression state
- * Copyright (C) 1995-2009 Jean-loup Gailly
+ * Copyright (C) 1995-2010 Jean-loup Gailly
  * For conditions of distribution and use, see copyright notice in zlib.h
  */
 
@@ -290,13 +290,13 @@ typedef struct internal_state {
    memory checker errors from longest match routines */
 
         /* in trees.c */
-void _tr_init         OF((deflate_state *s));
-int  _tr_tally        OF((deflate_state *s, unsigned dist, unsigned lc));
-void _tr_flush_block  OF((deflate_state *s, charf *buf, ulg stored_len,
-                          int last));
-void _tr_align        OF((deflate_state *s));
-void _tr_stored_block OF((deflate_state *s, charf *buf, ulg stored_len,
-                          int last));
+void ZLIB_INTERNAL _tr_init OF((deflate_state *s));
+int ZLIB_INTERNAL _tr_tally OF((deflate_state *s, unsigned dist, unsigned lc));
+void ZLIB_INTERNAL _tr_flush_block OF((deflate_state *s, charf *buf,
+                        ulg stored_len, int last));
+void ZLIB_INTERNAL _tr_align OF((deflate_state *s));
+void ZLIB_INTERNAL _tr_stored_block OF((deflate_state *s, charf *buf,
+                        ulg stored_len, int last));
 
 #define d_code(dist) \
    ((dist) < 256 ? _dist_code[dist] : _dist_code[256+((dist)>>7)])
@@ -309,11 +309,11 @@ void _tr_stored_block OF((deflate_state 
 /* Inline versions of _tr_tally for speed: */
 
 #if defined(GEN_TREES_H) || !defined(STDC)
-  extern uch _length_code[];
-  extern uch _dist_code[];
+  extern uch ZLIB_INTERNAL _length_code[];
+  extern uch ZLIB_INTERNAL _dist_code[];
 #else
-  extern const uch _length_code[];
-  extern const uch _dist_code[];
+  extern const uch ZLIB_INTERNAL _length_code[];
+  extern const uch ZLIB_INTERNAL _dist_code[];
 #endif
 
 # define _tr_tally_lit(s, c, flush) \

Modified: head/lib/libz/gzguts.h
==============================================================================
--- head/lib/libz/gzguts.h	Tue Apr 20 21:08:00 2010	(r206923)
+++ head/lib/libz/gzguts.h	Tue Apr 20 21:14:30 2010	(r206924)
@@ -12,7 +12,11 @@
 #  endif
 #endif
 
-#define ZLIB_INTERNAL
+#if ((__GNUC__-0) * 10 + __GNUC_MINOR__-0 >= 33) && !defined(NO_VIZ)
+#  define ZLIB_INTERNAL __attribute__((visibility ("hidden")))
+#else
+#  define ZLIB_INTERNAL
+#endif
 
 #include 
 #include "zlib.h"
@@ -112,9 +116,9 @@ typedef struct {
 typedef gz_state FAR *gz_statep;
 
 /* shared functions */
-ZEXTERN void ZEXPORT gz_error OF((gz_statep, int, const char *));
+void ZLIB_INTERNAL gz_error OF((gz_statep, int, const char *));
 #if defined UNDER_CE
-ZEXTERN char ZEXPORT *gz_strwinerror OF((DWORD error));
+char ZLIB_INTERNAL *gz_strwinerror OF((DWORD error));
 #endif
 
 /* GT_OFF(x), where x is an unsigned value, is true if x > maximum z_off64_t
@@ -123,6 +127,6 @@ ZEXTERN char ZEXPORT *gz_strwinerror OF(
 #ifdef INT_MAX
 #  define GT_OFF(x) (sizeof(int) == sizeof(z_off64_t) && (x) > INT_MAX)
 #else
-ZEXTERN unsigned ZEXPORT gz_intmax OF((void));
+unsigned ZLIB_INTERNAL gz_intmax OF((void));
 #  define GT_OFF(x) (sizeof(int) == sizeof(z_off64_t) && (x) > gz_intmax())
 #endif

Modified: head/lib/libz/gzlib.c
==============================================================================
--- head/lib/libz/gzlib.c	Tue Apr 20 21:08:00 2010	(r206923)
+++ head/lib/libz/gzlib.c	Tue Apr 20 21:14:30 2010	(r206924)
@@ -29,7 +29,7 @@ local gzFile gz_open OF((const char *, i
 
    The gz_strwinerror function does not change the current setting of
    GetLastError. */
-char ZEXPORT *gz_strwinerror (error)
+char ZLIB_INTERNAL *gz_strwinerror (error)
      DWORD error;
 {
     static char buf[1024];
@@ -485,7 +485,7 @@ void ZEXPORT gzclearerr(file)
    memory).  Simply save the error message as a static string.  If there is an
    allocation failure constructing the error message, then convert the error to
    out of memory. */
-void ZEXPORT gz_error(state, err, msg)
+void ZLIB_INTERNAL gz_error(state, err, msg)
     gz_statep state;
     int err;
     const char *msg;
@@ -525,7 +525,7 @@ void ZEXPORT gz_error(state, err, msg)
    available) -- we need to do this to cover cases where 2's complement not
    used, since C standard permits 1's complement and sign-bit representations,
    otherwise we could just use ((unsigned)-1) >> 1 */
-unsigned ZEXPORT gz_intmax()
+unsigned ZLIB_INTERNAL gz_intmax()
 {
     unsigned p, q;
 

Modified: head/lib/libz/inffast.c
==============================================================================
--- head/lib/libz/inffast.c	Tue Apr 20 21:08:00 2010	(r206923)
+++ head/lib/libz/inffast.c	Tue Apr 20 21:14:30 2010	(r206924)
@@ -1,5 +1,5 @@
 /* inffast.c -- fast decoding
- * Copyright (C) 1995-2008 Mark Adler
+ * Copyright (C) 1995-2008, 2010 Mark Adler
  * For conditions of distribution and use, see copyright notice in zlib.h
  */
 
@@ -64,7 +64,7 @@
       requires strm->avail_out >= 258 for each loop to avoid checking for
       output space.
  */
-void inflate_fast(strm, start)
+void ZLIB_INTERNAL inflate_fast(strm, start)
 z_streamp strm;
 unsigned start;         /* inflate()'s starting value for strm->avail_out */
 {

Modified: head/lib/libz/inffast.h
==============================================================================
--- head/lib/libz/inffast.h	Tue Apr 20 21:08:00 2010	(r206923)
+++ head/lib/libz/inffast.h	Tue Apr 20 21:14:30 2010	(r206924)
@@ -1,5 +1,5 @@
 /* inffast.h -- header to use inffast.c
- * Copyright (C) 1995-2003 Mark Adler
+ * Copyright (C) 1995-2003, 2010 Mark Adler
  * For conditions of distribution and use, see copyright notice in zlib.h
  */
 
@@ -8,4 +8,4 @@
    subject to change. Applications should only use zlib.h.
  */
 
-void inflate_fast OF((z_streamp strm, unsigned start));
+void ZLIB_INTERNAL inflate_fast OF((z_streamp strm, unsigned start));

Modified: head/lib/libz/inftrees.c
==============================================================================
--- head/lib/libz/inftrees.c	Tue Apr 20 21:08:00 2010	(r206923)
+++ head/lib/libz/inftrees.c	Tue Apr 20 21:14:30 2010	(r206924)
@@ -9,7 +9,7 @@
 #define MAXBITS 15
 
 const char inflate_copyright[] =
-   " inflate 1.2.4.3 Copyright 1995-2010 Mark Adler ";
+   " inflate 1.2.5 Copyright 1995-2010 Mark Adler ";
 /*
   If you use the zlib library in a product, an acknowledgment is welcome
   in the documentation of your product. If for some reason you cannot
@@ -29,7 +29,7 @@ const char inflate_copyright[] =
    table index bits.  It will differ if the request is greater than the
    longest code or if it is less than the shortest code.
  */
-int inflate_table(type, lens, codes, table, bits, work)
+int ZLIB_INTERNAL inflate_table(type, lens, codes, table, bits, work)
 codetype type;
 unsigned short FAR *lens;
 unsigned codes;
@@ -62,7 +62,7 @@ unsigned short FAR *work;
         35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258, 0, 0};
     static const unsigned short lext[31] = { /* Length codes 257..285 extra */
         16, 16, 16, 16, 16, 16, 16, 16, 17, 17, 17, 17, 18, 18, 18, 18,
-        19, 19, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 16, 195, 66};
+        19, 19, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 16, 73, 195};
     static const unsigned short dbase[32] = { /* Distance codes 0..29 base */
         1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193,
         257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145,

Modified: head/lib/libz/inftrees.h
==============================================================================
--- head/lib/libz/inftrees.h	Tue Apr 20 21:08:00 2010	(r206923)
+++ head/lib/libz/inftrees.h	Tue Apr 20 21:14:30 2010	(r206924)
@@ -1,5 +1,5 @@
 /* inftrees.h -- header to use inftrees.c
- * Copyright (C) 1995-2005 Mark Adler
+ * Copyright (C) 1995-2005, 2010 Mark Adler
  * For conditions of distribution and use, see copyright notice in zlib.h
  */
 
@@ -57,6 +57,6 @@ typedef enum {
     DISTS
 } codetype;
 
-extern int inflate_table OF((codetype type, unsigned short FAR *lens,
+int ZLIB_INTERNAL inflate_table OF((codetype type, unsigned short FAR *lens,
                              unsigned codes, code FAR * FAR *table,
                              unsigned FAR *bits, unsigned short FAR *work));

Modified: head/lib/libz/trees.c
==============================================================================
--- head/lib/libz/trees.c	Tue Apr 20 21:08:00 2010	(r206923)
+++ head/lib/libz/trees.c	Tue Apr 20 21:14:30 2010	(r206924)
@@ -1,5 +1,5 @@
 /* trees.c -- output deflated data using Huffman coding
- * Copyright (C) 1995-2009 Jean-loup Gailly
+ * Copyright (C) 1995-2010 Jean-loup Gailly
  * detect_data_type() function provided freely by Cosmin Truta, 2006
  * For conditions of distribution and use, see copyright notice in zlib.h
  */
@@ -351,13 +351,14 @@ void gen_trees_header()
                 static_dtree[i].Len, SEPARATOR(i, D_CODES-1, 5));
     }
 
-    fprintf(header, "const uch _dist_code[DIST_CODE_LEN] = {\n");
+    fprintf(header, "const uch ZLIB_INTERNAL _dist_code[DIST_CODE_LEN] = {\n");
     for (i = 0; i < DIST_CODE_LEN; i++) {
         fprintf(header, "%2u%s", _dist_code[i],
                 SEPARATOR(i, DIST_CODE_LEN-1, 20));
     }
 
-    fprintf(header, "const uch _length_code[MAX_MATCH-MIN_MATCH+1]= {\n");
+    fprintf(header,
+        "const uch ZLIB_INTERNAL _length_code[MAX_MATCH-MIN_MATCH+1]= {\n");
     for (i = 0; i < MAX_MATCH-MIN_MATCH+1; i++) {
         fprintf(header, "%2u%s", _length_code[i],
                 SEPARATOR(i, MAX_MATCH-MIN_MATCH, 20));
@@ -382,7 +383,7 @@ void gen_trees_header()
 /* ===========================================================================
  * Initialize the tree data structures for a new zlib stream.
  */
-void _tr_init(s)
+void ZLIB_INTERNAL _tr_init(s)
     deflate_state *s;
 {
     tr_static_init();
@@ -867,7 +868,7 @@ local void send_all_trees(s, lcodes, dco
 /* ===========================================================================
  * Send a stored block
  */
-void _tr_stored_block(s, buf, stored_len, last)
+void ZLIB_INTERNAL _tr_stored_block(s, buf, stored_len, last)
     deflate_state *s;
     charf *buf;       /* input block */
     ulg stored_len;   /* length of input block */
@@ -892,7 +893,7 @@ void _tr_stored_block(s, buf, stored_len
  * To simplify the code, we assume the worst case of last real code encoded
  * on one bit only.
  */
-void _tr_align(s)
+void ZLIB_INTERNAL _tr_align(s)
     deflate_state *s;
 {
     send_bits(s, STATIC_TREES<<1, 3);
@@ -921,7 +922,7 @@ void _tr_align(s)
  * Determine the best encoding for the current block: dynamic trees, static
  * trees or store, and output the encoded block to the zip file.
  */
-void _tr_flush_block(s, buf, stored_len, last)
+void ZLIB_INTERNAL _tr_flush_block(s, buf, stored_len, last)
     deflate_state *s;
     charf *buf;       /* input block, or NULL if too old */
     ulg stored_len;   /* length of input block */
@@ -1022,7 +1023,7 @@ void _tr_flush_block(s, buf, stored_len,
  * Save the match info and tally the frequency counts. Return true if
  * the current block must be flushed.
  */
-int _tr_tally (s, dist, lc)
+int ZLIB_INTERNAL _tr_tally (s, dist, lc)
     deflate_state *s;
     unsigned dist;  /* distance of matched string */
     unsigned lc;    /* match length-MIN_MATCH or unmatched char (if dist==0) */

Modified: head/lib/libz/trees.h
==============================================================================
--- head/lib/libz/trees.h	Tue Apr 20 21:08:00 2010	(r206923)
+++ head/lib/libz/trees.h	Tue Apr 20 21:14:30 2010	(r206924)
@@ -70,7 +70,7 @@ local const ct_data static_dtree[D_CODES
 {{19},{ 5}}, {{11},{ 5}}, {{27},{ 5}}, {{ 7},{ 5}}, {{23},{ 5}}
 };
 
-const uch _dist_code[DIST_CODE_LEN] = {
+const uch ZLIB_INTERNAL _dist_code[DIST_CODE_LEN] = {
  0,  1,  2,  3,  4,  4,  5,  5,  6,  6,  6,  6,  7,  7,  7,  7,  8,  8,  8,  8,
  8,  8,  8,  8,  9,  9,  9,  9,  9,  9,  9,  9, 10, 10, 10, 10, 10, 10, 10, 10,
 10, 10, 10, 10, 10, 10, 10, 10, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11,
@@ -99,7 +99,7 @@ const uch _dist_code[DIST_CODE_LEN] = {
 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29
 };
 
-const uch _length_code[MAX_MATCH-MIN_MATCH+1]= {
+const uch ZLIB_INTERNAL _length_code[MAX_MATCH-MIN_MATCH+1]= {
  0,  1,  2,  3,  4,  5,  6,  7,  8,  8,  9,  9, 10, 10, 11, 11, 12, 12, 12, 12,
 13, 13, 13, 13, 14, 14, 14, 14, 15, 15, 15, 15, 16, 16, 16, 16, 16, 16, 16, 16,
 17, 17, 17, 17, 17, 17, 17, 17, 18, 18, 18, 18, 18, 18, 18, 18, 19, 19, 19, 19,

Modified: head/lib/libz/zconf.h
==============================================================================
--- head/lib/libz/zconf.h	Tue Apr 20 21:08:00 2010	(r206923)
+++ head/lib/libz/zconf.h	Tue Apr 20 21:14:30 2010	(r206924)
@@ -315,10 +315,6 @@
 #  endif
 #endif
 
-#ifdef HAVE_VISIBILITY_PRAGMA
-#  define ZEXTERN __attribute__((visibility ("default"))) extern
-#endif
-
 #ifndef ZEXTERN
 #  define ZEXTERN extern
 #endif
@@ -368,6 +364,16 @@ typedef uLong FAR uLongf;
 #  include     /* for off_t */
 #endif
 
+/* a little trick to accommodate both "#define _LARGEFILE64_SOURCE" and
+ * "#define _LARGEFILE64_SOURCE 1" as requesting 64-bit operations, (even
+ * though the former does not conform to the LFS document), but considering
+ * both "#undef _LARGEFILE64_SOURCE" and "#define _LARGEFILE64_SOURCE 0" as
+ * equivalently requesting no 64-bit operations
+ */
+#if -_LARGEFILE64_SOURCE - -1 == 1
+#  undef _LARGEFILE64_SOURCE
+#endif
+
 #if defined(Z_HAVE_UNISTD_H) || defined(_LARGEFILE64_SOURCE)
 #  include        /* for SEEK_* and off_t */
 #  ifdef VMS

Modified: head/lib/libz/zlib.3
==============================================================================
--- head/lib/libz/zlib.3	Tue Apr 20 21:08:00 2010	(r206923)
+++ head/lib/libz/zlib.3	Tue Apr 20 21:14:30 2010	(r206924)
@@ -1,4 +1,4 @@
-.TH ZLIB 3 "10 Apr 2010"
+.TH ZLIB 3 "19 Apr 2010"
 .SH NAME
 zlib \- compression/decompression library
 .SH SYNOPSIS
@@ -125,7 +125,7 @@ before asking for help.
 Send questions and/or comments to zlib@gzip.org,
 or (for the Windows DLL version) to Gilles Vollant (info@winimage.com).
 .SH AUTHORS
-Version 1.2.4.3
+Version 1.2.5
 Copyright (C) 1995-2010 Jean-loup Gailly (jloup@gzip.org)
 and Mark Adler (madler@alumni.caltech.edu).
 .LP

Modified: head/lib/libz/zlib.h
==============================================================================
--- head/lib/libz/zlib.h	Tue Apr 20 21:08:00 2010	(r206923)
+++ head/lib/libz/zlib.h	Tue Apr 20 21:14:30 2010	(r206924)
@@ -1,5 +1,5 @@
 /* zlib.h -- interface of the 'zlib' general purpose compression library
-  version 1.2.4.3, April 10th, 2010
+  version 1.2.5, April 19th, 2010
 
   Copyright (C) 1995-2010 Jean-loup Gailly and Mark Adler
 
@@ -37,12 +37,12 @@
 extern "C" {
 #endif
 
-#define ZLIB_VERSION "1.2.4.3"
-#define ZLIB_VERNUM 0x1243
+#define ZLIB_VERSION "1.2.5"
+#define ZLIB_VERNUM 0x1250
 #define ZLIB_VER_MAJOR 1
 #define ZLIB_VER_MINOR 2
-#define ZLIB_VER_REVISION 4
-#define ZLIB_VER_SUBREVISION 3
+#define ZLIB_VER_REVISION 5
+#define ZLIB_VER_SUBREVISION 0
 
 /*
     The 'zlib' compression library provides in-memory compression and

Modified: head/lib/libz/zutil.c
==============================================================================
--- head/lib/libz/zutil.c	Tue Apr 20 21:08:00 2010	(r206923)
+++ head/lib/libz/zutil.c	Tue Apr 20 21:14:30 2010	(r206924)
@@ -1,5 +1,5 @@
 /* zutil.c -- target dependent utility functions for the compression library
- * Copyright (C) 1995-2005 Jean-loup Gailly.
+ * Copyright (C) 1995-2005, 2010 Jean-loup Gailly.
  * For conditions of distribution and use, see copyright notice in zlib.h
  */
 
@@ -117,9 +117,9 @@ uLong ZEXPORT zlibCompileFlags()
 #  ifndef verbose
 #    define verbose 0
 #  endif
-int z_verbose = verbose;
+int ZLIB_INTERNAL z_verbose = verbose;
 
-void z_error (m)
+void ZLIB_INTERNAL z_error (m)
     char *m;
 {
     fprintf(stderr, "%s\n", m);
@@ -146,7 +146,7 @@ const char * ZEXPORT zError(err)
 
 #ifndef HAVE_MEMCPY
 
-void zmemcpy(dest, source, len)
+void ZLIB_INTERNAL zmemcpy(dest, source, len)
     Bytef* dest;
     const Bytef* source;
     uInt  len;
@@ -157,7 +157,7 @@ void zmemcpy(dest, source, len)
     } while (--len != 0);
 }
 
-int zmemcmp(s1, s2, len)
+int ZLIB_INTERNAL zmemcmp(s1, s2, len)
     const Bytef* s1;
     const Bytef* s2;
     uInt  len;
@@ -170,7 +170,7 @@ int zmemcmp(s1, s2, len)
     return 0;
 }
 
-void zmemzero(dest, len)
+void ZLIB_INTERNAL zmemzero(dest, len)
     Bytef* dest;
     uInt  len;
 {
@@ -213,7 +213,7 @@ local ptr_table table[MAX_PTR];
  * a protected system like OS/2. Use Microsoft C instead.
  */
 
-voidpf zcalloc (voidpf opaque, unsigned items, unsigned size)
+voidpf ZLIB_INTERNAL zcalloc (voidpf opaque, unsigned items, unsigned size)
 {
     voidpf buf = opaque; /* just to make some compilers happy */
     ulg bsize = (ulg)items*size;
@@ -237,7 +237,7 @@ voidpf zcalloc (voidpf opaque, unsigned 
     return buf;
 }
 
-void  zcfree (voidpf opaque, voidpf ptr)
+void ZLIB_INTERNAL zcfree (voidpf opaque, voidpf ptr)
 {
     int n;
     if (*(ush*)&ptr != 0) { /* object < 64K */
@@ -272,13 +272,13 @@ void  zcfree (voidpf opaque, voidpf ptr)
 #  define _hfree   hfree
 #endif
 
-voidpf zcalloc (voidpf opaque, uInt items, uInt size)
+voidpf ZLIB_INTERNAL zcalloc (voidpf opaque, uInt items, uInt size)
 {
     if (opaque) opaque = 0; /* to make compiler happy */
     return _halloc((long)items, size);
 }
 
-void  zcfree (voidpf opaque, voidpf ptr)
+void ZLIB_INTERNAL zcfree (voidpf opaque, voidpf ptr)
 {
     if (opaque) opaque = 0; /* to make compiler happy */
     _hfree(ptr);
@@ -297,7 +297,7 @@ extern voidp  calloc OF((uInt items, uIn
 extern void   free   OF((voidpf ptr));
 #endif
 
-voidpf zcalloc (opaque, items, size)
+voidpf ZLIB_INTERNAL zcalloc (opaque, items, size)
     voidpf opaque;
     unsigned items;
     unsigned size;
@@ -307,7 +307,7 @@ voidpf zcalloc (opaque, items, size)
                               (voidpf)calloc(items, size);
 }
 
-void  zcfree (opaque, ptr)
+void ZLIB_INTERNAL zcfree (opaque, ptr)
     voidpf opaque;
     voidpf ptr;
 {

Modified: head/lib/libz/zutil.h
==============================================================================
--- head/lib/libz/zutil.h	Tue Apr 20 21:08:00 2010	(r206923)
+++ head/lib/libz/zutil.h	Tue Apr 20 21:14:30 2010	(r206924)
@@ -13,7 +13,12 @@
 #ifndef ZUTIL_H
 #define ZUTIL_H
 
-#define ZLIB_INTERNAL
+#if ((__GNUC__-0) * 10 + __GNUC_MINOR__-0 >= 33) && !defined(NO_VIZ)
+#  define ZLIB_INTERNAL __attribute__((visibility ("hidden")))
+#else
+#  define ZLIB_INTERNAL
+#endif
+
 #include "zlib.h"
 
 #ifdef STDC
@@ -231,16 +236,16 @@ extern const char * const z_errmsg[10]; 
 #    define zmemzero(dest, len) memset(dest, 0, len)
 #  endif
 #else
-   extern void zmemcpy  OF((Bytef* dest, const Bytef* source, uInt len));
-   extern int  zmemcmp  OF((const Bytef* s1, const Bytef* s2, uInt len));
-   extern void zmemzero OF((Bytef* dest, uInt len));
+   void ZLIB_INTERNAL zmemcpy OF((Bytef* dest, const Bytef* source, uInt len));
+   int ZLIB_INTERNAL zmemcmp OF((const Bytef* s1, const Bytef* s2, uInt len));
+   void ZLIB_INTERNAL zmemzero OF((Bytef* dest, uInt len));
 #endif
 
 /* Diagnostic functions */
 #ifdef DEBUG
 #  include 
-   extern int z_verbose;
-   extern void z_error    OF((char *m));
+   extern int ZLIB_INTERNAL z_verbose;
+   extern void ZLIB_INTERNAL z_error OF((char *m));
 #  define Assert(cond,msg) {if(!(cond)) z_error(msg);}
 #  define Trace(x) {if (z_verbose>=0) fprintf x ;}
 #  define Tracev(x) {if (z_verbose>0) fprintf x ;}
@@ -257,8 +262,9 @@ extern const char * const z_errmsg[10]; 
 #endif
 
 
-voidpf zcalloc OF((voidpf opaque, unsigned items, unsigned size));
-void   zcfree  OF((voidpf opaque, voidpf ptr));
+voidpf ZLIB_INTERNAL zcalloc OF((voidpf opaque, unsigned items,
+                        unsigned size));
+void ZLIB_INTERNAL zcfree  OF((voidpf opaque, voidpf ptr));
 
 #define ZALLOC(strm, items, size) \
            (*((strm)->zalloc))((strm)->opaque, (items), (size))

From owner-svn-src-head@FreeBSD.ORG  Tue Apr 20 21:33:23 2010
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 94FA01065670;
	Tue, 20 Apr 2010 21:33:23 +0000 (UTC)
	(envelope-from rpaulo@freebsd.org)
Received: from karen.lavabit.com (karen.lavabit.com [72.249.41.33])
	by mx1.freebsd.org (Postfix) with ESMTP id 70DAF8FC1E;
	Tue, 20 Apr 2010 21:33:23 +0000 (UTC)
Received: from e.earth.lavabit.com (e.earth.lavabit.com [192.168.111.14])
	by karen.lavabit.com (Postfix) with ESMTP id 2F62024ED91;
	Tue, 20 Apr 2010 16:05:17 -0500 (CDT)
Received: from 10.0.10.3 (54.81.54.77.rev.vodafone.pt [77.54.81.54])
	by lavabit.com with ESMTP id T8RCU7GKKFZB;
	Tue, 20 Apr 2010 16:05:17 -0500
Mime-Version: 1.0 (Apple Message framework v1078)
Content-Type: text/plain; charset=us-ascii
From: Rui Paulo 
In-Reply-To: <20100420202929.X40281@maildrop.int.zabbadoz.net>
Date: Tue, 20 Apr 2010 22:05:13 +0100
Content-Transfer-Encoding: quoted-printable
Message-Id: <106EA284-739C-4431-B4B4-388F41C27B3D@FreeBSD.org>
References: <201004201703.o3KH3Uj5089736@svn.freebsd.org>
	<20100420202929.X40281@maildrop.int.zabbadoz.net>
To: "Bjoern A. Zeeb" 
X-Mailer: Apple Mail (2.1078)
Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org,
	src-committers@freebsd.org
Subject: Re: svn commit: r206901 - in head/sys: amd64/amd64
	cddl/dev/cyclic/i386 i386/i386 sys
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Tue, 20 Apr 2010 21:33:23 -0000


On 20 Apr 2010, at 21:30, Bjoern A. Zeeb wrote:

> On Tue, 20 Apr 2010, Rui Paulo wrote:
>=20
>> Author: rpaulo
>> Date: Tue Apr 20 17:03:30 2010
>> New Revision: 206901
>> URL: http://svn.freebsd.org/changeset/base/206901
>>=20
>> Log:
>> Rename the cyclic global variable lapic_cyclic_clock_func to just
>> cyclic_clock_func. This will make more sense when we start developing =
non
>> x86 cyclic version.
>=20
> I think this is the cause for LINT.386 failing with:
>=20
> 87 /scratch/tmp/bz/HEAD.svn/sys/x86/isa/clock.c: In function =
'clkintr':
> 88 /scratch/tmp/bz/HEAD.svn/sys/x86/isa/clock.c:189: error: =
'lapic_cyclic_clock_func' undeclared (first use in this function)
> 89 /scratch/tmp/bz/HEAD.svn/sys/x86/isa/clock.c:189: error: (Each =
undeclared identifier is reported only once
> 90 /scratch/tmp/bz/HEAD.svn/sys/x86/isa/clock.c:189: error: for each =
function it appears in.)

Fixed, thanks.

Regards,
--
Rui Paulo



From owner-svn-src-head@FreeBSD.ORG  Tue Apr 20 22:43:53 2010
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id DB22A106566C;
	Tue, 20 Apr 2010 22:43:53 +0000 (UTC)
	(envelope-from rstone@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id CACDB8FC08;
	Tue, 20 Apr 2010 22:43:53 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o3KMhrti066948;
	Tue, 20 Apr 2010 22:43:53 GMT (envelope-from rstone@svn.freebsd.org)
Received: (from rstone@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o3KMhrkX066946;
	Tue, 20 Apr 2010 22:43:53 GMT (envelope-from rstone@svn.freebsd.org)
Message-Id: <201004202243.o3KMhrkX066946@svn.freebsd.org>
From: Ryan Stone 
Date: Tue, 20 Apr 2010 22:43:53 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r206945 - head/share/misc
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Tue, 20 Apr 2010 22:43:54 -0000

Author: rstone
Date: Tue Apr 20 22:43:53 2010
New Revision: 206945
URL: http://svn.freebsd.org/changeset/base/206945

Log:
  add new committer rstone to committers-src.dot

Modified:
  head/share/misc/committers-src.dot

Modified: head/share/misc/committers-src.dot
==============================================================================
--- head/share/misc/committers-src.dot	Tue Apr 20 22:32:34 2010	(r206944)
+++ head/share/misc/committers-src.dot	Tue Apr 20 22:43:53 2010	(r206945)
@@ -170,6 +170,7 @@ roberto [label="Ollivier Robert\nroberto
 rpaulo [label="Rui Paulo\nrpaulo@FreeBSD.org\n2007/09/25"]
 rrs [label="Randall R Stewart\nrrs@FreeBSD.org\n2007/02/08"]
 rse [label="Ralf S. Engelschall\nrse@FreeBSD.org\n1997/07/31"]
+rstone [label="Ryan Stone\nrstone@FreeBSD.org\n2010/04/19"]
 ru [label="Ruslan Ermilov\nru@FreeBSD.org\n1999/05/27"]
 rwatson [label="Robert N. M. Watson\nrwatson@FreeBSD.org\n1999/12/16"]
 sam [label="Sam Leffler\nsam@FreeBSD.org\n2002/07/02"]
@@ -271,6 +272,8 @@ ed -> uqs
 eivind -> des
 eivind -> rwatson
 
+emaste -> rstone
+
 emax -> markus
 
 gallatin -> ticso
@@ -342,6 +345,7 @@ jkh -> yar
 
 jkoshy -> kaiw
 jkoshy -> fabient
+jkoshy -> rstone
 
 jlemon -> bmilekic
 jlemon -> brooks

From owner-svn-src-head@FreeBSD.ORG  Wed Apr 21 00:42:49 2010
Return-Path: 
Delivered-To: svn-src-head@FreeBSD.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 38E5C1065676;
	Wed, 21 Apr 2010 00:42:49 +0000 (UTC)
	(envelope-from nyan@FreeBSD.org)
Received: from sakura.ccs.furiru.org (sakura.ccs.furiru.org
	[IPv6:2001:2f0:104:8060::1])
	by mx1.freebsd.org (Postfix) with ESMTP id D00398FC20;
	Wed, 21 Apr 2010 00:42:48 +0000 (UTC)
Received: from localhost (authenticated bits=0)
	by sakura.ccs.furiru.org (unknown) with ESMTP id o3L0gg6D021137;
	Wed, 21 Apr 2010 09:42:46 +0900 (JST)
	(envelope-from nyan@FreeBSD.org)
Date: Wed, 21 Apr 2010 09:42:42 +0900 (JST)
Message-Id: <20100421.094242.94902748.nyan@FreeBSD.org>
To: rpaulo@FreeBSD.org
From: TAKAHASHI Yoshihiro 
In-Reply-To: <201004202104.o3KL4vHv043955@svn.freebsd.org>
References: <201004202104.o3KL4vHv043955@svn.freebsd.org>
X-Mailer: Mew version 6.3 on Emacs 22.3 / Mule 5.0 (SAKAKI)
Mime-Version: 1.0
Content-Type: Text/Plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org,
	src-committers@FreeBSD.org
Subject: Re: svn commit: r206922 - head/sys/x86/isa
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 21 Apr 2010 00:42:49 -0000

In article <201004202104.o3KL4vHv043955@svn.freebsd.org>
Rui Paulo  writes:

> Log:
>   Fix another instance of lapic_cyclic_clock_func.
> 
> Modified:
>   head/sys/x86/isa/clock.c
> 
> Modified: head/sys/x86/isa/clock.c
> ==============================================================================
> --- head/sys/x86/isa/clock.c	Tue Apr 20 21:03:42 2010	(r206921)
> +++ head/sys/x86/isa/clock.c	Tue Apr 20 21:04:57 2010	(r206922)
> @@ -186,8 +186,8 @@ clkintr(struct trapframe *frame)
>  	 * timers.
>  	 */
>  	int cpu = PCPU_GET(cpuid);
> -	if (lapic_cyclic_clock_func[cpu] != NULL)
> -		(*lapic_cyclic_clock_func[cpu])(frame);
> +	if (cyclic_clock_func[cpu] != NULL)
> +		(*cyclic_clock_func[cpu])(frame);
>  #endif
>  
>  	if (using_atrtc_timer) {

The same change is needed for sys/pc98/cbus/clock.c.

---
TAKAHASHI Yoshihiro 

From owner-svn-src-head@FreeBSD.ORG  Wed Apr 21 00:52:56 2010
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 57CA0106564A;
	Wed, 21 Apr 2010 00:52:56 +0000 (UTC)
	(envelope-from rwatson@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 462078FC1E;
	Wed, 21 Apr 2010 00:52:56 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o3L0quBA096707;
	Wed, 21 Apr 2010 00:52:56 GMT (envelope-from rwatson@svn.freebsd.org)
Received: (from rwatson@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o3L0qu4m096704;
	Wed, 21 Apr 2010 00:52:56 GMT (envelope-from rwatson@svn.freebsd.org)
Message-Id: <201004210052.o3L0qu4m096704@svn.freebsd.org>
From: Robert Watson 
Date: Wed, 21 Apr 2010 00:52:56 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r206972 - head/tools/tools/netrate/tcpp
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 21 Apr 2010 00:52:56 -0000

Author: rwatson
Date: Wed Apr 21 00:52:55 2010
New Revision: 206972
URL: http://svn.freebsd.org/changeset/base/206972

Log:
  Merge @176820, @176822, @177156 to tcpp from P4 to HEAD:
  
    Improve accuracy of connection data transfer math.
  
    Disable Nagle's algorithm to avoid delaying transfers of data --
    will want to refine this to combine payload with header transfer,
    however.
  
    Now that we're running w/o Nagle, try to send the initial data
    burst with the header in a single TCP segment.
  
    Prefer %zu to %ju for size_t.
  
  MFC after:	1 week
  Sponsored by:	Juniper, Inc.

Modified:
  head/tools/tools/netrate/tcpp/tcpp_client.c
  head/tools/tools/netrate/tcpp/tcpp_server.c

Modified: head/tools/tools/netrate/tcpp/tcpp_client.c
==============================================================================
--- head/tools/tools/netrate/tcpp/tcpp_client.c	Wed Apr 21 00:26:41 2010	(r206971)
+++ head/tools/tools/netrate/tcpp/tcpp_client.c	Wed Apr 21 00:52:55 2010	(r206972)
@@ -33,9 +33,11 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 
 #include 
+#include 
 
 #include 
 #include 
@@ -82,6 +84,7 @@ static int			 kq;
 static int			 started;	/* Number started so far. */
 static int			 finished;	/* Number finished so far. */
 static int			 counter;	/* IP number offset. */
+static uint64_t			 payload_len;
 
 static struct connection *
 tcpp_client_newconn(void)
@@ -109,6 +112,9 @@ tcpp_client_newconn(void)
 	i = 1;
 	if (setsockopt(fd, SOL_SOCKET, SO_NOSIGPIPE, &i, sizeof(i)) < 0)
 		err(-1, "setsockopt");
+	i = 1;
+	if (setsockopt(fd, IPPROTO_TCP, TCP_NODELAY, &i, sizeof(i)) < 0)
+		err(-1, "setsockopt");
 #if 0
 	i = 1;
 	if (setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, &i, sizeof(i)) < 0)
@@ -131,7 +137,7 @@ tcpp_client_newconn(void)
 	conn->conn_magic = CONNECTION_MAGIC;
 	conn->conn_fd = fd;
 	conn->conn_header.th_magic = TCPP_MAGIC;
-	conn->conn_header.th_len = bflag;
+	conn->conn_header.th_len = payload_len;
 	tcpp_header_encode(&conn->conn_header);
 
 	EV_SET(&kev, fd, EVFILT_WRITE, EV_ADD, 0, 0, conn);
@@ -156,16 +162,22 @@ static void
 tcpp_client_handleconn(struct kevent *kev)
 {
 	struct connection *conn;
-	ssize_t len;
+	struct iovec iov[2];
+	ssize_t len, header_left;
 
 	conn = kev->udata;
 	if (conn->conn_magic != CONNECTION_MAGIC)
 		errx(-1, "tcpp_client_handleconn: magic");
 
 	if (conn->conn_header_sent < sizeof(conn->conn_header)) {
-		len = write(conn->conn_fd, ((u_char *)&conn->conn_header) +
-		    conn->conn_header_sent, sizeof(conn->conn_header) -
-		    conn->conn_header_sent);
+		header_left = sizeof(conn->conn_header) -
+		    conn->conn_header_sent;
+		iov[0].iov_base = ((u_char *)&conn->conn_header) +
+		    conn->conn_header_sent;
+		iov[0].iov_len = header_left;
+		iov[1].iov_base = buffer;
+		iov[1].iov_len = min(sizeof(buffer), payload_len);
+		len = writev(conn->conn_fd, iov, 2);
 		if (len < 0) {
 			tcpp_client_closeconn(conn);
 			err(-1, "tcpp_client_handleconn: header write");
@@ -175,10 +187,14 @@ tcpp_client_handleconn(struct kevent *ke
 			errx(-1, "tcpp_client_handleconn: header write "
 			    "premature EOF");
 		}
-		conn->conn_header_sent += len;
+		if (len > header_left) {
+			conn->conn_data_sent += (len - header_left);
+			conn->conn_header_sent += header_left;
+		} else
+			conn->conn_header_sent += len;
 	} else {
 		len = write(conn->conn_fd, buffer, min(sizeof(buffer),
-		    bflag - conn->conn_data_sent));
+		    payload_len - conn->conn_data_sent));
 		if (len < 0) {
 			tcpp_client_closeconn(conn);
 			err(-1, "tcpp_client_handleconn: data write");
@@ -189,12 +205,12 @@ tcpp_client_handleconn(struct kevent *ke
 			    "premature EOF");
 		}
 		conn->conn_data_sent += len;
-		if (conn->conn_data_sent >= bflag) {
-			/*
-			 * All is well.
-			 */
-			tcpp_client_closeconn(conn);
-		}
+	}
+	if (conn->conn_data_sent >= payload_len) {
+		/*
+		 * All is well.
+		 */
+		tcpp_client_closeconn(conn);
 	}
 }
 
@@ -261,6 +277,11 @@ tcpp_client(void)
 	pid_t pid;
 	int i, failed, status;
 
+	if (bflag < sizeof(struct tcpp_header))
+		errx(-1, "Can't use -b less than %zu\n",
+		   sizeof(struct tcpp_header));
+	payload_len = bflag - sizeof(struct tcpp_header);
+
 	pid_list = malloc(sizeof(*pid_list) * pflag);
 	if (pid_list == NULL)
 		err(-1, "malloc pid_list");

Modified: head/tools/tools/netrate/tcpp/tcpp_server.c
==============================================================================
--- head/tools/tools/netrate/tcpp/tcpp_server.c	Wed Apr 21 00:26:41 2010	(r206971)
+++ head/tools/tools/netrate/tcpp/tcpp_server.c	Wed Apr 21 00:52:55 2010	(r206972)
@@ -37,6 +37,7 @@
 #include 
 
 #include 
+#include 
 
 #include 
 #include 
@@ -239,6 +240,10 @@ tcpp_server_worker(int workernum)
 	if (setsockopt(listen_sock, SOL_SOCKET, SO_REUSEPORT, &i, sizeof(i))
 	    < 0)
 		err(-1, "setsockopt");
+	i = 1;
+	if (setsockopt(listen_sock, IPPROTO_TCP, TCP_NODELAY, &i, sizeof(i))
+	    < 0)
+		err(-1, "setsockopt");
 	if (bind(listen_sock, (struct sockaddr *)&localipbase,
 	    sizeof(localipbase)) < 0)
 		err(-1, "bind");

From owner-svn-src-head@FreeBSD.ORG  Wed Apr 21 01:13:09 2010
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 533411065678;
	Wed, 21 Apr 2010 01:13:09 +0000 (UTC)
	(envelope-from delphij@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 42D5E8FC22;
	Wed, 21 Apr 2010 01:13:09 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o3L1D9s0001273;
	Wed, 21 Apr 2010 01:13:09 GMT (envelope-from delphij@svn.freebsd.org)
Received: (from delphij@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o3L1D9rw001271;
	Wed, 21 Apr 2010 01:13:09 GMT (envelope-from delphij@svn.freebsd.org)
Message-Id: <201004210113.o3L1D9rw001271@svn.freebsd.org>
From: Xin LI 
Date: Wed, 21 Apr 2010 01:13:09 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r206973 - head/share/mk
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 21 Apr 2010 01:13:09 -0000

Author: delphij
Date: Wed Apr 21 01:13:08 2010
New Revision: 206973
URL: http://svn.freebsd.org/changeset/base/206973

Log:
  When CPUTYPE is defined to any value, on amd64 platform "mmx" is
  available through MACHINE_CPU, indicating the CPU supports that
  feature, as done by revision 138685.
  
  This changeset adds "mmx" into the default amd64 MACHINE_CPU list
  when no CPUTYPE is specified to provide consistent behavior.
  
  PR:		amd64/145593
  Submitted by:	mm
  MFC after:	2 weeks

Modified:
  head/share/mk/bsd.cpu.mk

Modified: head/share/mk/bsd.cpu.mk
==============================================================================
--- head/share/mk/bsd.cpu.mk	Wed Apr 21 00:52:55 2010	(r206972)
+++ head/share/mk/bsd.cpu.mk	Wed Apr 21 01:13:08 2010	(r206973)
@@ -9,7 +9,7 @@ _CPUCFLAGS =
 . if ${MACHINE_ARCH} == "i386"
 MACHINE_CPU = i486
 . elif ${MACHINE_ARCH} == "amd64"
-MACHINE_CPU = amd64 sse2 sse
+MACHINE_CPU = amd64 sse2 sse mmx
 . elif ${MACHINE_ARCH} == "ia64"
 MACHINE_CPU = itanium
 . elif ${MACHINE_ARCH} == "powerpc"

From owner-svn-src-head@FreeBSD.ORG  Wed Apr 21 01:48:11 2010
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id C7C97106566C;
	Wed, 21 Apr 2010 01:48:11 +0000 (UTC)
	(envelope-from yanefbsd@gmail.com)
Received: from mail-vw0-f54.google.com (mail-vw0-f54.google.com
	[209.85.212.54])
	by mx1.freebsd.org (Postfix) with ESMTP id 36E208FC22;
	Wed, 21 Apr 2010 01:48:11 +0000 (UTC)
Received: by vws8 with SMTP id 8so103768vws.13
	for ; Tue, 20 Apr 2010 18:48:10 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma;
	h=domainkey-signature:mime-version:received:in-reply-to:references
	:date:received:message-id:subject:from:to:cc:content-type
	:content-transfer-encoding;
	bh=M6W+e5oYVKjEatmRgTNQM/fqvDPIoI9D5ThtSUg1D9Q=;
	b=kg7CUKr3i/kolMYKYVY4wq2EdaeFol6p1cbPQHdoEPsFAl+kkocjSfG/Zq+EZ9Wh+q
	d1C7mn8/MKfo8LidT9P7bsLmvTcIXD++TT8CWygStEow6bYWklOk6o+fFPxfGXe02fpm
	TVriNB5rtRtIhozSnW250CVP8OFIPVsV/OMPQ=
DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma;
	h=mime-version:in-reply-to:references:date:message-id:subject:from:to
	:cc:content-type:content-transfer-encoding;
	b=GdMIUrWVfIgKQMtn2OuJsvIGrxamqv+XgmeW/b0Rtw5Z/17KZUpcITEXKHdS25MtD4
	2kOAGOVs6Levce/gjfjnx4XXTxUwSaN01LbaRCKvda1lhfkwP10sYUBn2HHhY0q/t2A1
	wVXZ229ftvR6zuEex+dGCvCz/mxfQuk0sdwyI=
MIME-Version: 1.0
Received: by 10.229.28.85 with HTTP; Tue, 20 Apr 2010 18:48:10 -0700 (PDT)
In-Reply-To: <201004210113.o3L1D9rw001271@svn.freebsd.org>
References: <201004210113.o3L1D9rw001271@svn.freebsd.org>
Date: Tue, 20 Apr 2010 18:48:10 -0700
Received: by 10.229.238.70 with SMTP id kr6mr3790259qcb.49.1271814490414; Tue, 
	20 Apr 2010 18:48:10 -0700 (PDT)
Message-ID: 
From: Garrett Cooper 
To: Xin LI 
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org,
	src-committers@freebsd.org
Subject: Re: svn commit: r206973 - head/share/mk
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 21 Apr 2010 01:48:11 -0000

On Tue, Apr 20, 2010 at 6:13 PM, Xin LI  wrote:
> Author: delphij
> Date: Wed Apr 21 01:13:08 2010
> New Revision: 206973
> URL: http://svn.freebsd.org/changeset/base/206973
>
> Log:
> =A0When CPUTYPE is defined to any value, on amd64 platform "mmx" is
> =A0available through MACHINE_CPU, indicating the CPU supports that
> =A0feature, as done by revision 138685.
>
> =A0This changeset adds "mmx" into the default amd64 MACHINE_CPU list
> =A0when no CPUTYPE is specified to provide consistent behavior.

The crowd goes wild XD...
Thanks Martin and Xin Li!
-Garrett

From owner-svn-src-head@FreeBSD.ORG  Wed Apr 21 02:02:30 2010
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 390C6106564A;
	Wed, 21 Apr 2010 02:02:30 +0000 (UTC)
	(envelope-from rysto32@gmail.com)
Received: from mail-wy0-f182.google.com (mail-wy0-f182.google.com
	[74.125.82.182])
	by mx1.freebsd.org (Postfix) with ESMTP id 735858FC1A;
	Wed, 21 Apr 2010 02:02:29 +0000 (UTC)
Received: by wye20 with SMTP id 20so609970wye.13
	for ; Tue, 20 Apr 2010 19:02:28 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma;
	h=domainkey-signature:mime-version:received:in-reply-to:references
	:date:received:message-id:subject:from:to:cc:content-type
	:content-transfer-encoding;
	bh=ekzIPNLukoH34S3WW6eryGHrKadV5/qiFMpzFu2cn/g=;
	b=vsaSJzEoswNDM13/DQfrZiEUvQzAc7ODFdNKG32eQZhoXCW0oXnUa4G6a1FpuMz28V
	4h2YFXlPi5XK16Q0GHQEPnOLM6NFH7R4dTytcdZCQWjKgTAlw79mlzg6t0xihTZ99QR3
	Be8fZDXQHi/WkiJDmMkNrGJfXp5Y34iE69w54=
DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma;
	h=mime-version:in-reply-to:references:date:message-id:subject:from:to
	:cc:content-type:content-transfer-encoding;
	b=ud/6lpnzTeYr0zicQj+sGxxLAvr0KVPZW9HpGxNlnzSLE2x8QqBRUShJnKFiBCObIp
	I7fP85VRmsWNEbL3wCXasNCFkNJ5nswBz1/vGw3OsxhPBB4LaELXnnicOSw5PmK6tVBu
	jHnCbDtXqm+1WfSGFYsVnuhYUp59QLX4Q0PSw=
MIME-Version: 1.0
Received: by 10.216.53.202 with HTTP; Tue, 20 Apr 2010 18:36:19 -0700 (PDT)
In-Reply-To: <201004202243.o3KMhrkX066946@svn.freebsd.org>
References: <201004202243.o3KMhrkX066946@svn.freebsd.org>
Date: Tue, 20 Apr 2010 21:36:19 -0400
Received: by 10.216.184.195 with SMTP id s45mr421167wem.28.1271813779447; Tue, 
	20 Apr 2010 18:36:19 -0700 (PDT)
Message-ID: 
From: Ryan Stone 
To: Ryan Stone 
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org,
	src-committers@freebsd.org
Subject: Re: svn commit: r206945 - head/share/misc
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 21 Apr 2010 02:02:30 -0000

Sorry, I forgot the following:

Approved by: emaste (mentor) and jkoshy (mentor)


I'm looking into why svn wasn't using the default checkin template for me.

On Tue, Apr 20, 2010 at 6:43 PM, Ryan Stone  wrote:
> Author: rstone
> Date: Tue Apr 20 22:43:53 2010
> New Revision: 206945
> URL: http://svn.freebsd.org/changeset/base/206945
>
> Log:
> =A0add new committer rstone to committers-src.dot
>
> Modified:
> =A0head/share/misc/committers-src.dot
>
> Modified: head/share/misc/committers-src.dot
> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=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/share/misc/committers-src.dot =A0Tue Apr 20 22:32:34 2010 =A0 =
=A0 =A0 =A0(r206944)
> +++ head/share/misc/committers-src.dot =A0Tue Apr 20 22:43:53 2010 =A0 =
=A0 =A0 =A0(r206945)
> @@ -170,6 +170,7 @@ roberto [label=3D"Ollivier Robert\nroberto
> =A0rpaulo [label=3D"Rui Paulo\nrpaulo@FreeBSD.org\n2007/09/25"]
> =A0rrs [label=3D"Randall R Stewart\nrrs@FreeBSD.org\n2007/02/08"]
> =A0rse [label=3D"Ralf S. Engelschall\nrse@FreeBSD.org\n1997/07/31"]
> +rstone [label=3D"Ryan Stone\nrstone@FreeBSD.org\n2010/04/19"]
> =A0ru [label=3D"Ruslan Ermilov\nru@FreeBSD.org\n1999/05/27"]
> =A0rwatson [label=3D"Robert N. M. Watson\nrwatson@FreeBSD.org\n1999/12/16=
"]
> =A0sam [label=3D"Sam Leffler\nsam@FreeBSD.org\n2002/07/02"]
> @@ -271,6 +272,8 @@ ed -> uqs
> =A0eivind -> des
> =A0eivind -> rwatson
>
> +emaste -> rstone
> +
> =A0emax -> markus
>
> =A0gallatin -> ticso
> @@ -342,6 +345,7 @@ jkh -> yar
>
> =A0jkoshy -> kaiw
> =A0jkoshy -> fabient
> +jkoshy -> rstone
>
> =A0jlemon -> bmilekic
> =A0jlemon -> brooks
>

From owner-svn-src-head@FreeBSD.ORG  Wed Apr 21 05:10:54 2010
Return-Path: 
Delivered-To: svn-src-head@FreeBSD.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 46F2A106566C;
	Wed, 21 Apr 2010 05:10:54 +0000 (UTC) (envelope-from alc@cs.rice.edu)
Received: from mail.cs.rice.edu (mail.cs.rice.edu [128.42.1.31])
	by mx1.freebsd.org (Postfix) with ESMTP id 162868FC16;
	Wed, 21 Apr 2010 05:10:53 +0000 (UTC)
Received: from mail.cs.rice.edu (localhost.localdomain [127.0.0.1])
	by mail.cs.rice.edu (Postfix) with ESMTP id 772ED2C2AEB;
	Wed, 21 Apr 2010 00:10:53 -0500 (CDT)
X-Virus-Scanned: by amavis-2.4.0 at mail.cs.rice.edu
Received: from mail.cs.rice.edu ([127.0.0.1])
	by mail.cs.rice.edu (mail.cs.rice.edu [127.0.0.1]) (amavisd-new,
	port 10024)
	with LMTP id sWxE+yQNxR-m; Wed, 21 Apr 2010 00:10:45 -0500 (CDT)
Received: from adsl-216-63-78-18.dsl.hstntx.swbell.net
	(adsl-216-63-78-18.dsl.hstntx.swbell.net [216.63.78.18])
	(using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits))
	(No client certificate requested)
	by mail.cs.rice.edu (Postfix) with ESMTP id 194302C2A92;
	Wed, 21 Apr 2010 00:10:45 -0500 (CDT)
Message-ID: <4BCE88D4.5080600@cs.rice.edu>
Date: Wed, 21 Apr 2010 00:10:44 -0500
From: Alan Cox 
User-Agent: Thunderbird 2.0.0.24 (X11/20100327)
MIME-Version: 1.0
To: Peter Jeremy 
References: <201004182129.o3ILTSCd098832@svn.freebsd.org>
	<20100420205845.GA38549@server.vk2pj.dyndns.org>
In-Reply-To: <20100420205845.GA38549@server.vk2pj.dyndns.org>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
Cc: Alan Cox , svn-src-head@FreeBSD.org,
	svn-src-all@FreeBSD.org, src-committers@FreeBSD.org
Subject: Re: svn commit: r206814 - head/sys/vm
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 21 Apr 2010 05:10:54 -0000

Peter Jeremy wrote:
> On 2010-Apr-18 21:29:28 +0000, Alan Cox  wrote:
>   
>>  Remove a nonsensical test from vm_pageout_clean().  A page can't be in the
>>  inactive queue and have a non-zero wire count.
>>     
>
> Should this test be turned into a KASSERT()?
>
>   

I considered it, but no I don't think an assertion is called for.  We 
already have checks in the places where a page is wired or unwired.

Regards,
Alan


From owner-svn-src-head@FreeBSD.ORG  Wed Apr 21 08:18:06 2010
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id DFA7F106564A;
	Wed, 21 Apr 2010 08:18:06 +0000 (UTC)
	(envelope-from randi@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id CED9C8FC26;
	Wed, 21 Apr 2010 08:18:06 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o3L8I6LJ096041;
	Wed, 21 Apr 2010 08:18:06 GMT (envelope-from randi@svn.freebsd.org)
Received: (from randi@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o3L8I6uv096039;
	Wed, 21 Apr 2010 08:18:06 GMT (envelope-from randi@svn.freebsd.org)
Message-Id: <201004210818.o3L8I6uv096039@svn.freebsd.org>
From: Randi Harper 
Date: Wed, 21 Apr 2010 08:18:06 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r206988 - head/share/misc
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 21 Apr 2010 08:18:07 -0000

Author: randi
Date: Wed Apr 21 08:18:06 2010
New Revision: 206988
URL: http://svn.freebsd.org/changeset/base/206988

Log:
  Add myself to committers-src.dot.
  
  Approved by:	cperciva (mentor)

Modified:
  head/share/misc/committers-src.dot

Modified: head/share/misc/committers-src.dot
==============================================================================
--- head/share/misc/committers-src.dot	Wed Apr 21 07:39:11 2010	(r206987)
+++ head/share/misc/committers-src.dot	Wed Apr 21 08:18:06 2010	(r206988)
@@ -162,6 +162,7 @@ pjd [label="Pawel Jakub Dawidek\npjd@Fre
 ps [label="Paul Saab\nps@FreeBSD.org\n2000/02/23"]
 qingli [label="Qing Li\nqingli@FreeBSD.org\n2005/04/13"]
 rafan [label="Rong-En Fan\nrafan@FreeBSD.org\n2007/01/31"]
+randi [label="Randi Harper\nrandi@FreeBSD.org\n2010/04/20"]
 remko [label="Remko Lodder\nremko@FreeBSD.org\n2007/02/23"]
 rik [label="Roman Kurakin\nrik@FreeBSD.org\n2003/12/18"]
 rink [label="Rink Springer\nrink@FreeBSD.org\n2006/01/16"]
@@ -245,6 +246,7 @@ bz -> jamie
 bz -> syrinx
 
 cperciva -> flz
+cperciva -> randi
 cperciva -> simon
 
 csjp -> bushman

From owner-svn-src-head@FreeBSD.ORG  Wed Apr 21 08:57:37 2010
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: by hub.freebsd.org (Postfix, from userid 1033)
	id 98E851065670; Wed, 21 Apr 2010 08:57:37 +0000 (UTC)
Date: Wed, 21 Apr 2010 08:57:37 +0000
From: Alexey Dokuchaev 
To: Ana Kukec 
Message-ID: <20100421085737.GB70860@FreeBSD.org>
References: <201004201816.o3KIGuAk006081@svn.freebsd.org>
Mime-Version: 1.0
Content-Type: text/plain; charset=koi8-r
Content-Disposition: inline
In-Reply-To: <201004201816.o3KIGuAk006081@svn.freebsd.org>
User-Agent: Mutt/1.4.2.1i
Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org,
	src-committers@freebsd.org
Subject: Re: svn commit: r206904 - head/share/misc
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 21 Apr 2010 08:57:37 -0000

On Tue, Apr 20, 2010 at 06:16:56PM +0000, Ana Kukec wrote:
> Author: anchie
> Date: Tue Apr 20 18:16:56 2010
> New Revision: 206904
> URL: http://svn.freebsd.org/changeset/base/206904
> 
> Log:
>   Add myself and list bz@ as my mentor.
>   
>   Approved by:	bz (mentor)
> 
> Modified:
>   head/share/misc/committers-src.dot
> 
> Modified: head/share/misc/committers-src.dot
> ==============================================================================
> --- head/share/misc/committers-src.dot	Tue Apr 20 17:57:43 2010	(r206903)
> +++ head/share/misc/committers-src.dot	Tue Apr 20 18:16:56 2010	(r206904)
> @@ -55,6 +55,7 @@ node [color=lightblue2, style=filled, bg
>  ache [label="Andrey Chernov\nache@FreeBSD.org\n1993/10/31"]
>  akiyama [label="Shunsuke Akiyama\nakiyama@FreeBSD.org\n2000/06/19"]
>  ambrisko [label="Doug Ambrisko\nambrisko@FreeBSD.org\n2001/12/19"]
> +anchie [label="Ana Kukec\anchie@FreeBSD.org\n2010/04/14"]

Looks like a missing `n' after `\' to me.

./danfe

From owner-svn-src-head@FreeBSD.ORG  Wed Apr 21 10:21:35 2010
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 406EF1065670;
	Wed, 21 Apr 2010 10:21:35 +0000 (UTC) (envelope-from bz@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 2F37D8FC08;
	Wed, 21 Apr 2010 10:21:35 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o3LALZZT023274;
	Wed, 21 Apr 2010 10:21:35 GMT (envelope-from bz@svn.freebsd.org)
Received: (from bz@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o3LALZWn023272;
	Wed, 21 Apr 2010 10:21:35 GMT (envelope-from bz@svn.freebsd.org)
Message-Id: <201004211021.o3LALZWn023272@svn.freebsd.org>
From: "Bjoern A. Zeeb" 
Date: Wed, 21 Apr 2010 10:21:35 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r206989 - head/sys/netinet
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 21 Apr 2010 10:21:35 -0000

Author: bz
Date: Wed Apr 21 10:21:34 2010
New Revision: 206989
URL: http://svn.freebsd.org/changeset/base/206989

Log:
  Avoid memory access after free.  Use the (shortend) copy for the
  ipsec mtu lookup as well.
  
  PR:		kern/145736
  Submitted by:	Peter Molnar (peter molnar.cc)
  MFC after:	3 days

Modified:
  head/sys/netinet/ip_input.c

Modified: head/sys/netinet/ip_input.c
==============================================================================
--- head/sys/netinet/ip_input.c	Wed Apr 21 08:18:06 2010	(r206988)
+++ head/sys/netinet/ip_input.c	Wed Apr 21 10:21:34 2010	(r206989)
@@ -1590,7 +1590,7 @@ ip_forward(struct mbuf *m, int srcrt)
 		 * If IPsec is configured for this path,
 		 * override any possibly mtu value set by ip_output.
 		 */ 
-		mtu = ip_ipsec_mtu(m, mtu);
+		mtu = ip_ipsec_mtu(mcopy, mtu);
 #endif /* IPSEC */
 		/*
 		 * If the MTU was set before make sure we are below the

From owner-svn-src-head@FreeBSD.ORG  Wed Apr 21 11:17:16 2010
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id C4692106566B;
	Wed, 21 Apr 2010 11:17:16 +0000 (UTC) (envelope-from kib@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id B2F4E8FC18;
	Wed, 21 Apr 2010 11:17:16 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o3LBHG1H036983;
	Wed, 21 Apr 2010 11:17:16 GMT (envelope-from kib@svn.freebsd.org)
Received: (from kib@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o3LBHGOm036981;
	Wed, 21 Apr 2010 11:17:16 GMT (envelope-from kib@svn.freebsd.org)
Message-Id: <201004211117.o3LBHGOm036981@svn.freebsd.org>
From: Konstantin Belousov 
Date: Wed, 21 Apr 2010 11:17:16 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r206992 - head/sys/amd64/ia32
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 21 Apr 2010 11:17:16 -0000

Author: kib
Date: Wed Apr 21 11:17:16 2010
New Revision: 206992
URL: http://svn.freebsd.org/changeset/base/206992

Log:
  As was done in r155238 for i386 and in r155239 for amd64, clear the carry
  flag for ia32 binary executed on amd64 host in get_mcontext().
  
  PR:	kern/92110 (one more time)
  Reported by:	stas
  MFC after:	1 week

Modified:
  head/sys/amd64/ia32/ia32_signal.c

Modified: head/sys/amd64/ia32/ia32_signal.c
==============================================================================
--- head/sys/amd64/ia32/ia32_signal.c	Wed Apr 21 11:11:11 2010	(r206991)
+++ head/sys/amd64/ia32/ia32_signal.c	Wed Apr 21 11:17:16 2010	(r206992)
@@ -141,9 +141,11 @@ ia32_get_mcontext(struct thread *td, str
 	mcp->mc_esi = tp->tf_rsi;
 	mcp->mc_ebp = tp->tf_rbp;
 	mcp->mc_isp = tp->tf_rsp;
+	mcp->mc_eflags = tp->tf_rflags;
 	if (flags & GET_MC_CLEAR_RET) {
 		mcp->mc_eax = 0;
 		mcp->mc_edx = 0;
+		mcp->mc_eflags &= ~PSL_C;
 	} else {
 		mcp->mc_eax = tp->tf_rax;
 		mcp->mc_edx = tp->tf_rdx;
@@ -152,7 +154,6 @@ ia32_get_mcontext(struct thread *td, str
 	mcp->mc_ecx = tp->tf_rcx;
 	mcp->mc_eip = tp->tf_rip;
 	mcp->mc_cs = tp->tf_cs;
-	mcp->mc_eflags = tp->tf_rflags;
 	mcp->mc_esp = tp->tf_rsp;
 	mcp->mc_ss = tp->tf_ss;
 	mcp->mc_len = sizeof(*mcp);

From owner-svn-src-head@FreeBSD.ORG  Wed Apr 21 11:28:13 2010
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 5935C106566C;
	Wed, 21 Apr 2010 11:28:13 +0000 (UTC)
	(envelope-from rpaulo@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 47F898FC13;
	Wed, 21 Apr 2010 11:28:13 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o3LBSD7o039425;
	Wed, 21 Apr 2010 11:28:13 GMT (envelope-from rpaulo@svn.freebsd.org)
Received: (from rpaulo@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o3LBSDwC039423;
	Wed, 21 Apr 2010 11:28:13 GMT (envelope-from rpaulo@svn.freebsd.org)
Message-Id: <201004211128.o3LBSDwC039423@svn.freebsd.org>
From: Rui Paulo 
Date: Wed, 21 Apr 2010 11:28:13 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r206993 - head/sys/pc98/cbus
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 21 Apr 2010 11:28:13 -0000

Author: rpaulo
Date: Wed Apr 21 11:28:13 2010
New Revision: 206993
URL: http://svn.freebsd.org/changeset/base/206993

Log:
  Comply with the new cyclic dtrace module variable name
  (cyclic_clock_func).

Modified:
  head/sys/pc98/cbus/clock.c

Modified: head/sys/pc98/cbus/clock.c
==============================================================================
--- head/sys/pc98/cbus/clock.c	Wed Apr 21 11:17:16 2010	(r206992)
+++ head/sys/pc98/cbus/clock.c	Wed Apr 21 11:28:13 2010	(r206993)
@@ -175,8 +175,8 @@ clkintr(struct trapframe *frame)
 	 * timers.
 	 */
 	int cpu = PCPU_GET(cpuid);
-	if (lapic_cyclic_clock_func[cpu] != NULL)
-		(*lapic_cyclic_clock_func[cpu])(frame);
+	if (cyclic_clock_func[cpu] != NULL)
+		(*cyclic_clock_func[cpu])(frame);
 #endif
 
 #ifdef SMP

From owner-svn-src-head@FreeBSD.ORG  Wed Apr 21 11:35:35 2010
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 473B11065674;
	Wed, 21 Apr 2010 11:35:35 +0000 (UTC)
	(envelope-from rpaulo@freebsd.org)
Received: from karen.lavabit.com (karen.lavabit.com [72.249.41.33])
	by mx1.freebsd.org (Postfix) with ESMTP id 2271E8FC31;
	Wed, 21 Apr 2010 11:35:34 +0000 (UTC)
Received: from e.earth.lavabit.com (e.earth.lavabit.com [192.168.111.14])
	by karen.lavabit.com (Postfix) with ESMTP id 78AF724EE08;
	Wed, 21 Apr 2010 06:35:34 -0500 (CDT)
Received: from 10.0.10.3 (54.81.54.77.rev.vodafone.pt [77.54.81.54])
	by lavabit.com with ESMTP id 73X69BNNVBWD;
	Wed, 21 Apr 2010 06:35:34 -0500
Mime-Version: 1.0 (Apple Message framework v1078)
Content-Type: text/plain; charset=us-ascii
From: Rui Paulo 
In-Reply-To: <20100421.094242.94902748.nyan@FreeBSD.org>
Date: Wed, 21 Apr 2010 12:35:31 +0100
Content-Transfer-Encoding: quoted-printable
Message-Id: <46ADE413-773C-47C3-8EDE-12B6FEDC0BD8@FreeBSD.org>
References: <201004202104.o3KL4vHv043955@svn.freebsd.org>
	<20100421.094242.94902748.nyan@FreeBSD.org>
To: TAKAHASHI Yoshihiro 
X-Mailer: Apple Mail (2.1078)
Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org,
	src-committers@FreeBSD.org
Subject: Re: svn commit: r206922 - head/sys/x86/isa
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 21 Apr 2010 11:35:35 -0000

On 21 Apr 2010, at 01:42, TAKAHASHI Yoshihiro wrote:

> In article <201004202104.o3KL4vHv043955@svn.freebsd.org>
> Rui Paulo  writes:
>=20
>> Log:
>>  Fix another instance of lapic_cyclic_clock_func.
>>=20
>> Modified:
>>  head/sys/x86/isa/clock.c
>>=20
>> Modified: head/sys/x86/isa/clock.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/x86/isa/clock.c	Tue Apr 20 21:03:42 2010	=
(r206921)
>> +++ head/sys/x86/isa/clock.c	Tue Apr 20 21:04:57 2010	=
(r206922)
>> @@ -186,8 +186,8 @@ clkintr(struct trapframe *frame)
>> 	 * timers.
>> 	 */
>> 	int cpu =3D PCPU_GET(cpuid);
>> -	if (lapic_cyclic_clock_func[cpu] !=3D NULL)
>> -		(*lapic_cyclic_clock_func[cpu])(frame);
>> +	if (cyclic_clock_func[cpu] !=3D NULL)
>> +		(*cyclic_clock_func[cpu])(frame);
>> #endif
>>=20
>> 	if (using_atrtc_timer) {
>=20
> The same change is needed for sys/pc98/cbus/clock.c.

Thanks, fixed.

Regards,
--
Rui Paulo



From owner-svn-src-head@FreeBSD.ORG  Wed Apr 21 11:50:14 2010
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 2D97D106566C;
	Wed, 21 Apr 2010 11:50:14 +0000 (UTC)
	(envelope-from fabient@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 1BE9B8FC17;
	Wed, 21 Apr 2010 11:50:14 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o3LBoEQH044259;
	Wed, 21 Apr 2010 11:50:14 GMT (envelope-from fabient@svn.freebsd.org)
Received: (from fabient@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o3LBoEGs044257;
	Wed, 21 Apr 2010 11:50:14 GMT (envelope-from fabient@svn.freebsd.org)
Message-Id: <201004211150.o3LBoEGs044257@svn.freebsd.org>
From: Fabien Thomas 
Date: Wed, 21 Apr 2010 11:50:13 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r206994 - head/usr.sbin/pmcstat
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 21 Apr 2010 11:50:14 -0000

Author: fabient
Date: Wed Apr 21 11:50:13 2010
New Revision: 206994
URL: http://svn.freebsd.org/changeset/base/206994

Log:
  Apply threshold filter to root node in calltree view.
  
  MFC after: 3days

Modified:
  head/usr.sbin/pmcstat/pmcpl_calltree.c

Modified: head/usr.sbin/pmcstat/pmcpl_calltree.c
==============================================================================
--- head/usr.sbin/pmcstat/pmcpl_calltree.c	Wed Apr 21 11:28:13 2010	(r206993)
+++ head/usr.sbin/pmcstat/pmcpl_calltree.c	Wed Apr 21 11:50:13 2010	(r206994)
@@ -499,9 +499,10 @@ void
 pmcpl_ct_topdisplay(void)
 {
 	int i, x, y, pmcin;
-	struct pmcpl_ct_sample rsamples;
+	struct pmcpl_ct_sample r, *rsamples;
 
-	pmcpl_ct_samples_root(&rsamples);
+	rsamples = &r;
+	pmcpl_ct_samples_root(rsamples);
 
 	PMCSTAT_PRINTW("%-10.10s %s\n", "IMAGE", "CALLTREE");
 
@@ -524,16 +525,20 @@ pmcpl_ct_topdisplay(void)
 			if (PMCPL_CT_SAMPLE(pmcin,
 			    &pmcpl_ct_root->pct_arc[i].pcta_samples) == 0)
 				continue;
+			if (PMCPL_CT_SAMPLEP(pmcin,
+			    &pmcpl_ct_root->pct_arc[i].pcta_samples) <=
+			    pmcstat_threshold)
+				continue;
 			if (pmcpl_ct_node_dumptop(pmcin,
 			        pmcpl_ct_root->pct_arc[i].pcta_child,
-			        &rsamples, x, &y, pmcstat_displayheight - 2)) {
+			        rsamples, x, &y, pmcstat_displayheight - 2)) {
 				break;
 			}
 		}
 
-		pmcpl_ct_node_printtop(&rsamples, pmcin, y);
+		pmcpl_ct_node_printtop(rsamples, pmcin, y);
 	}
-	pmcpl_ct_samples_free(&rsamples);
+	pmcpl_ct_samples_free(rsamples);
 }
 
 /*

From owner-svn-src-head@FreeBSD.ORG  Wed Apr 21 12:02:46 2010
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 4F1DC106566B;
	Wed, 21 Apr 2010 12:02:46 +0000 (UTC)
	(envelope-from randi@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 3DF0C8FC2A;
	Wed, 21 Apr 2010 12:02:46 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o3LC2kVV047113;
	Wed, 21 Apr 2010 12:02:46 GMT (envelope-from randi@svn.freebsd.org)
Received: (from randi@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o3LC2k7Y047111;
	Wed, 21 Apr 2010 12:02:46 GMT (envelope-from randi@svn.freebsd.org)
Message-Id: <201004211202.o3LC2k7Y047111@svn.freebsd.org>
From: Randi Harper 
Date: Wed, 21 Apr 2010 12:02:46 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r206995 - head/usr.sbin/sysinstall
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 21 Apr 2010 12:02:46 -0000

Author: randi
Date: Wed Apr 21 12:02:45 2010
New Revision: 206995
URL: http://svn.freebsd.org/changeset/base/206995

Log:
  Fix bug introduced in r198317: Don't leak a file descriptor after scanning for network devices.
  
  Approved by:	cperciva (mentor)
  MFC after:	1 week (original commit + bugfix)

Modified:
  head/usr.sbin/sysinstall/tcpip.c

Modified: head/usr.sbin/sysinstall/tcpip.c
==============================================================================
--- head/usr.sbin/sysinstall/tcpip.c	Wed Apr 21 11:50:13 2010	(r206994)
+++ head/usr.sbin/sysinstall/tcpip.c	Wed Apr 21 12:02:45 2010	(r206995)
@@ -683,6 +683,8 @@ tcpDeviceScan(void)
 		}
 	}
 
+	close(s);
+
 	freeifaddrs(ifap);
 
 	return (NULL);

From owner-svn-src-head@FreeBSD.ORG  Wed Apr 21 12:17:02 2010
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 7BC39106566C;
	Wed, 21 Apr 2010 12:17:02 +0000 (UTC) (envelope-from avg@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 6A9A18FC26;
	Wed, 21 Apr 2010 12:17:02 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o3LCH2mr050252;
	Wed, 21 Apr 2010 12:17:02 GMT (envelope-from avg@svn.freebsd.org)
Received: (from avg@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o3LCH2Lq050249;
	Wed, 21 Apr 2010 12:17:02 GMT (envelope-from avg@svn.freebsd.org)
Message-Id: <201004211217.o3LCH2Lq050249@svn.freebsd.org>
From: Andriy Gapon 
Date: Wed, 21 Apr 2010 12:17:02 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r206996 - in head: etc/mtree share/examples
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 21 Apr 2010 12:17:02 -0000

Author: avg
Date: Wed Apr 21 12:17:01 2010
New Revision: 206996
URL: http://svn.freebsd.org/changeset/base/206996

Log:
  indent.pro example: actually install the sample file

Modified:
  head/etc/mtree/BSD.usr.dist
  head/share/examples/Makefile

Modified: head/etc/mtree/BSD.usr.dist
==============================================================================
--- head/etc/mtree/BSD.usr.dist	Wed Apr 21 12:02:45 2010	(r206995)
+++ head/etc/mtree/BSD.usr.dist	Wed Apr 21 12:17:01 2010	(r206996)
@@ -219,6 +219,8 @@
             ..
             ibcs2
             ..
+            indent
+            ..
             ipfilter
             ..
             ipfw

Modified: head/share/examples/Makefile
==============================================================================
--- head/share/examples/Makefile	Wed Apr 21 12:02:45 2010	(r206995)
+++ head/share/examples/Makefile	Wed Apr 21 12:17:01 2010	(r206996)
@@ -15,6 +15,7 @@ LDIRS=	BSD_daemon \
 	find_interface \
 	hast \
 	ibcs2 \
+	indent \
 	ipfw \
 	kld \
 	libvgl \
@@ -77,6 +78,7 @@ XFILES=	BSD_daemon/FreeBSD.pfa \
 	hast/vip-up.sh \
 	ibcs2/README \
 	ibcs2/hello.uu \
+	indent/indent.pro \
 	ipfw/change_rules.sh \
 	kld/Makefile \
 	kld/cdev/Makefile \

From owner-svn-src-head@FreeBSD.ORG  Wed Apr 21 12:21:35 2010
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 9C03C1065670;
	Wed, 21 Apr 2010 12:21:35 +0000 (UTC) (envelope-from avg@freebsd.org)
Received: from citadel.icyb.net.ua (citadel.icyb.net.ua [212.40.38.140])
	by mx1.freebsd.org (Postfix) with ESMTP id 3ED108FC2C;
	Wed, 21 Apr 2010 12:21:33 +0000 (UTC)
Received: from odyssey.starpoint.kiev.ua (alpha-e.starpoint.kiev.ua
	[212.40.38.101])
	by citadel.icyb.net.ua (8.8.8p3/ICyb-2.3exp) with ESMTP id PAA02403;
	Wed, 21 Apr 2010 15:21:29 +0300 (EEST)
	(envelope-from avg@freebsd.org)
Message-ID: <4BCEEDC9.6040608@freebsd.org>
Date: Wed, 21 Apr 2010 15:21:29 +0300
From: Andriy Gapon 
User-Agent: Thunderbird 2.0.0.24 (X11/20100319)
MIME-Version: 1.0
To: Andriy Gapon 
References: <201004211217.o3LCH2Lq050249@svn.freebsd.org>
In-Reply-To: <201004211217.o3LCH2Lq050249@svn.freebsd.org>
X-Enigmail-Version: 0.95.7
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 7bit
Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org,
	src-committers@freebsd.org
Subject: Re: svn commit: r206996 - in head: etc/mtree share/examples
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 21 Apr 2010 12:21:35 -0000

on 21/04/2010 15:17 Andriy Gapon said the following:
> Author: avg
> Date: Wed Apr 21 12:17:01 2010
> New Revision: 206996
> URL: http://svn.freebsd.org/changeset/base/206996
> 
> Log:
>   indent.pro example: actually install the sample file
> 
> Modified:
>   head/etc/mtree/BSD.usr.dist
>   head/share/examples/Makefile

I see that there is a number of files/directories in share/examples that are not
hooked into share/examples/Makefile and/or BSD.usr.dist.
Could that be by design/intention?

> Modified: head/etc/mtree/BSD.usr.dist
> ==============================================================================
> --- head/etc/mtree/BSD.usr.dist	Wed Apr 21 12:02:45 2010	(r206995)
> +++ head/etc/mtree/BSD.usr.dist	Wed Apr 21 12:17:01 2010	(r206996)
> @@ -219,6 +219,8 @@
>              ..
>              ibcs2
>              ..
> +            indent
> +            ..
>              ipfilter
>              ..
>              ipfw
> 
> Modified: head/share/examples/Makefile
> ==============================================================================
> --- head/share/examples/Makefile	Wed Apr 21 12:02:45 2010	(r206995)
> +++ head/share/examples/Makefile	Wed Apr 21 12:17:01 2010	(r206996)
> @@ -15,6 +15,7 @@ LDIRS=	BSD_daemon \
>  	find_interface \
>  	hast \
>  	ibcs2 \
> +	indent \
>  	ipfw \
>  	kld \
>  	libvgl \
> @@ -77,6 +78,7 @@ XFILES=	BSD_daemon/FreeBSD.pfa \
>  	hast/vip-up.sh \
>  	ibcs2/README \
>  	ibcs2/hello.uu \
> +	indent/indent.pro \
>  	ipfw/change_rules.sh \
>  	kld/Makefile \
>  	kld/cdev/Makefile \


-- 
Andriy Gapon

From owner-svn-src-head@FreeBSD.ORG  Wed Apr 21 16:38:37 2010
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id E600F106564A;
	Wed, 21 Apr 2010 16:38:37 +0000 (UTC) (envelope-from kib@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id D58C18FC08;
	Wed, 21 Apr 2010 16:38:37 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o3LGcbK0008133;
	Wed, 21 Apr 2010 16:38:37 GMT (envelope-from kib@svn.freebsd.org)
Received: (from kib@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o3LGcbAd008132;
	Wed, 21 Apr 2010 16:38:37 GMT (envelope-from kib@svn.freebsd.org)
Message-Id: <201004211638.o3LGcbAd008132@svn.freebsd.org>
From: Konstantin Belousov 
Date: Wed, 21 Apr 2010 16:38:37 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r206997 - head/include
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 21 Apr 2010 16:38:38 -0000

Author: kib
Date: Wed Apr 21 16:38:37 2010
New Revision: 206997
URL: http://svn.freebsd.org/changeset/base/206997

Log:
  Move realpath(3) prototype to a POSIX section.
  
  Noted by:	bde
  MFC after:	2 weeks

Modified:
  head/include/stdlib.h

Modified: head/include/stdlib.h
==============================================================================
--- head/include/stdlib.h	Wed Apr 21 12:17:01 2010	(r206996)
+++ head/include/stdlib.h	Wed Apr 21 16:38:37 2010	(r206997)
@@ -155,6 +155,7 @@ void	 _Exit(int) __dead2;
 #if __POSIX_VISIBLE /* >= ??? */
 int	 posix_memalign(void **, size_t, size_t); /* (ADV) */
 int	 rand_r(unsigned *);			/* (TSF) */
+char	*realpath(const char * __restrict, char * __restrict);
 int	 setenv(const char *, const char *, int);
 int	 unsetenv(const char *);
 #endif
@@ -201,7 +202,6 @@ int	 posix_openpt(int);
 char	*ptsname(int);
 int	 putenv(char *);
 long	 random(void);
-char	*realpath(const char * __restrict, char * __restrict);
 unsigned short
 	*seed48(unsigned short[3]);
 #ifndef _SETKEY_DECLARED

From owner-svn-src-head@FreeBSD.ORG  Wed Apr 21 16:41:02 2010
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 6C94E1065677;
	Wed, 21 Apr 2010 16:41:02 +0000 (UTC) (envelope-from kib@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 5C5F88FC20;
	Wed, 21 Apr 2010 16:41:02 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o3LGf2It008704;
	Wed, 21 Apr 2010 16:41:02 GMT (envelope-from kib@svn.freebsd.org)
Received: (from kib@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o3LGf2jB008702;
	Wed, 21 Apr 2010 16:41:02 GMT (envelope-from kib@svn.freebsd.org)
Message-Id: <201004211641.o3LGf2jB008702@svn.freebsd.org>
From: Konstantin Belousov 
Date: Wed, 21 Apr 2010 16:41:02 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r206998 - head/lib/libc/stdlib
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 21 Apr 2010 16:41:02 -0000

Author: kib
Date: Wed Apr 21 16:41:02 2010
New Revision: 206998
URL: http://svn.freebsd.org/changeset/base/206998

Log:
  Add standards section, improve wording, taking into account the handling
  of NULL and changed type in declaration.
  
  Suggested by:	bde
  MFC after:	2 weeks

Modified:
  head/lib/libc/stdlib/realpath.3

Modified: head/lib/libc/stdlib/realpath.3
==============================================================================
--- head/lib/libc/stdlib/realpath.3	Wed Apr 21 16:38:37 2010	(r206997)
+++ head/lib/libc/stdlib/realpath.3	Wed Apr 21 16:41:02 2010	(r206998)
@@ -94,14 +94,11 @@ If an error occurs,
 .Fn realpath
 returns
 .Dv NULL ,
-and
-.Fa resolved_path
-contains the pathname which caused the problem.
-If
+and if
 .Fa resolved_path
-was
+is not
 .Dv NULL ,
-then information of the failed pathname component is lost.
+the array that it points to contains the pathname which caused the problem.
 .Sh ERRORS
 The function
 .Fn realpath
@@ -126,6 +123,11 @@ when given a relative
 .Fa pathname .
 .Sh "SEE ALSO"
 .Xr getcwd 3
+.Sh STANDARDS
+The
+.Fn realpath
+function conforms to
+.St -p1003.1-2001 .
 .Sh HISTORY
 The
 .Fn realpath

From owner-svn-src-head@FreeBSD.ORG  Wed Apr 21 17:38:16 2010
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id E0BDF106566B;
	Wed, 21 Apr 2010 17:38:16 +0000 (UTC)
	(envelope-from bschmidt@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id CFFA08FC14;
	Wed, 21 Apr 2010 17:38:16 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o3LHcGCt021504;
	Wed, 21 Apr 2010 17:38:16 GMT
	(envelope-from bschmidt@svn.freebsd.org)
Received: (from bschmidt@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o3LHcGtH021502;
	Wed, 21 Apr 2010 17:38:16 GMT
	(envelope-from bschmidt@svn.freebsd.org)
Message-Id: <201004211738.o3LHcGtH021502@svn.freebsd.org>
From: Bernhard Schmidt 
Date: Wed, 21 Apr 2010 17:38:16 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r207001 - head/sys/dev/iwn
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 21 Apr 2010 17:38:17 -0000

Author: bschmidt
Date: Wed Apr 21 17:38:16 2010
New Revision: 207001
URL: http://svn.freebsd.org/changeset/base/207001

Log:
  Use correct bus_dma_tag_t for TX frames.
  
  Reported by:	Andreas Nilsson 
  Approved by:	rpaulo (mentor)
  MFC after:	3 days

Modified:
  head/sys/dev/iwn/if_iwn.c

Modified: head/sys/dev/iwn/if_iwn.c
==============================================================================
--- head/sys/dev/iwn/if_iwn.c	Wed Apr 21 17:23:31 2010	(r207000)
+++ head/sys/dev/iwn/if_iwn.c	Wed Apr 21 17:38:16 2010	(r207001)
@@ -2282,6 +2282,7 @@ iwn4965_tx_done(struct iwn_softc *sc, st
     struct iwn_rx_data *data)
 {
 	struct iwn4965_tx_stat *stat = (struct iwn4965_tx_stat *)(desc + 1);
+	struct iwn_tx_ring *ring = &sc->txq[desc->qid & 0xf];
 
 	DPRINTF(sc, IWN_DEBUG_XMIT, "%s: "
 	    "qid %d idx %d retries %d nkill %d rate %x duration %d status %x\n",
@@ -2289,7 +2290,7 @@ iwn4965_tx_done(struct iwn_softc *sc, st
 	    stat->btkillcnt, stat->rate, le16toh(stat->duration),
 	    le32toh(stat->status));
 
-	bus_dmamap_sync(sc->rxq.data_dmat, data->map, BUS_DMASYNC_POSTREAD);
+	bus_dmamap_sync(ring->data_dmat, data->map, BUS_DMASYNC_POSTREAD);
 	iwn_tx_done(sc, desc, stat->ackfailcnt, le32toh(stat->status) & 0xff);
 }
 
@@ -2298,6 +2299,7 @@ iwn5000_tx_done(struct iwn_softc *sc, st
     struct iwn_rx_data *data)
 {
 	struct iwn5000_tx_stat *stat = (struct iwn5000_tx_stat *)(desc + 1);
+	struct iwn_tx_ring *ring = &sc->txq[desc->qid & 0xf];
 
 	DPRINTF(sc, IWN_DEBUG_XMIT, "%s: "
 	    "qid %d idx %d retries %d nkill %d rate %x duration %d status %x\n",
@@ -2310,7 +2312,7 @@ iwn5000_tx_done(struct iwn_softc *sc, st
 	iwn5000_reset_sched(sc, desc->qid & 0xf, desc->idx);
 #endif
 
-	bus_dmamap_sync(sc->rxq.data_dmat, data->map, BUS_DMASYNC_POSTREAD);
+	bus_dmamap_sync(ring->data_dmat, data->map, BUS_DMASYNC_POSTREAD);
 	iwn_tx_done(sc, desc, stat->ackfailcnt, le16toh(stat->status) & 0xff);
 }
 

From owner-svn-src-head@FreeBSD.ORG  Wed Apr 21 17:54:32 2010
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 05EBC1065672;
	Wed, 21 Apr 2010 17:54:32 +0000 (UTC)
	(envelope-from delphij@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id D02B88FC15;
	Wed, 21 Apr 2010 17:54:31 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o3LHsVoO025158;
	Wed, 21 Apr 2010 17:54:31 GMT (envelope-from delphij@svn.freebsd.org)
Received: (from delphij@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o3LHsVgQ025157;
	Wed, 21 Apr 2010 17:54:31 GMT (envelope-from delphij@svn.freebsd.org)
Message-Id: <201004211754.o3LHsVgQ025157@svn.freebsd.org>
From: Xin LI 
Date: Wed, 21 Apr 2010 17:54:31 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r207003 - head/contrib/gnu-sort
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 21 Apr 2010 17:54:32 -0000

Author: delphij
Date: Wed Apr 21 17:54:31 2010
New Revision: 207003
URL: http://svn.freebsd.org/changeset/base/207003

Log:
  Bootstrap merge history.

Modified:
Directory Properties:
  head/contrib/gnu-sort/   (props changed)

From owner-svn-src-head@FreeBSD.ORG  Wed Apr 21 18:55:45 2010
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 6F7D7106564A;
	Wed, 21 Apr 2010 18:55:45 +0000 (UTC)
	(envelope-from brucec@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 53E648FC14;
	Wed, 21 Apr 2010 18:55:45 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o3LItjh1038859;
	Wed, 21 Apr 2010 18:55:45 GMT (envelope-from brucec@svn.freebsd.org)
Received: (from brucec@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o3LItiw2038856;
	Wed, 21 Apr 2010 18:55:44 GMT (envelope-from brucec@svn.freebsd.org)
Message-Id: <201004211855.o3LItiw2038856@svn.freebsd.org>
From: Bruce Cran 
Date: Wed, 21 Apr 2010 18:55:44 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r207005 - head/usr.sbin/sysinstall
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 21 Apr 2010 18:55:45 -0000

Author: brucec
Date: Wed Apr 21 18:55:44 2010
New Revision: 207005
URL: http://svn.freebsd.org/changeset/base/207005

Log:
  Make the "Q = Finish" text visible when running sysinstall as a normal
  application.  Reword the boot manager screen to try and avoid confusion.
  
  Reviewed by:	randi
  Approved by:	rrs (mentor)
  MFC after:	1 week

Modified:
  head/usr.sbin/sysinstall/disks.c
  head/usr.sbin/sysinstall/menus.c

Modified: head/usr.sbin/sysinstall/disks.c
==============================================================================
--- head/usr.sbin/sysinstall/disks.c	Wed Apr 21 18:43:15 2010	(r207004)
+++ head/usr.sbin/sysinstall/disks.c	Wed Apr 21 18:55:44 2010	(r207005)
@@ -207,9 +207,12 @@ print_command_summary(void)
     mvprintw(14, 0, "The following commands are supported (in upper or lower case):");
     mvprintw(16, 0, "A = Use Entire Disk   G = set Drive Geometry   C = Create Slice");
     mvprintw(17, 0, "D = Delete Slice      Z = Toggle Size Units    S = Set Bootable   | = Expert m.");
-    mvprintw(18, 0, "T = Change Type       U = Undo All Changes     Q = Finish");
+    mvprintw(18, 0, "T = Change Type       U = Undo All Changes");
+
     if (!RunningAsInit)
-	mvprintw(18, 47, "W = Write Changes");
+	mvprintw(18, 47, "W = Write Changes  Q = Finish");
+    else
+	mvprintw(18, 47, "Q = Finish");
     mvprintw(21, 0, "Use F1 or ? to get more help, arrow keys to select.");
     move(0, 0);
 }

Modified: head/usr.sbin/sysinstall/menus.c
==============================================================================
--- head/usr.sbin/sysinstall/menus.c	Wed Apr 21 18:43:15 2010	(r207004)
+++ head/usr.sbin/sysinstall/menus.c	Wed Apr 21 18:55:44 2010	(r207005)
@@ -1175,20 +1175,16 @@ DMenu MenuMBRType = {
     "at boot time.  If you have more than one drive and want to boot\n"
     "from the second one, the boot manager will also make it possible\n"
     "to do so (limitations in the PC BIOS usually prevent this otherwise).\n"
-    "If you will only have FreeBSD on the machine the boot manager is\n"
-    "not needed and it slows down the boot while offering you the choice\n"
-    "of which operating system to boot.  If you do not want a boot\n"
-    "manager, or wish to replace an existing one, select \"standard\".\n"
-    "If you would prefer your Master Boot Record remain untouched then\n"
-    "select \"None\".\n\n"
-    "  NOTE:  PC-DOS users will almost certainly require \"None\"!",
-    "Press F1 to read about drive setup",
+    "If you have other operating systems installed and would like a choice when\n"
+    "booting, choose \"BootMgr\". If you would prefer to keep your existing\n"
+    "boot manager, select \"None\".\n\n",
+    "",    
     "drives",
-    { { "Standard",	"Install a standard MBR (no boot manager)",
+    { { "Standard",	"Install a standard MBR (non-interactive boot manager)",
 	dmenuRadioCheck, dmenuSetValue, NULL, &BootMgr, '(', '*', ')', 1 },
       { "BootMgr",	"Install the FreeBSD Boot Manager",
 	dmenuRadioCheck, dmenuSetValue, NULL, &BootMgr, '(', '*', ')', 0 },
-      { "None",		"Leave the Master Boot Record untouched",
+      { "None",		"Do not install a boot manager",
 	dmenuRadioCheck, dmenuSetValue, NULL, &BootMgr, '(', '*', ')', 2 },
       { NULL } },
 };

From owner-svn-src-head@FreeBSD.ORG  Wed Apr 21 19:03:35 2010
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 26EBD1065673;
	Wed, 21 Apr 2010 19:03:35 +0000 (UTC)
	(envelope-from brucec@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 15E918FC12;
	Wed, 21 Apr 2010 19:03:35 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o3LJ3YYc040632;
	Wed, 21 Apr 2010 19:03:34 GMT (envelope-from brucec@svn.freebsd.org)
Received: (from brucec@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o3LJ3YpY040629;
	Wed, 21 Apr 2010 19:03:34 GMT (envelope-from brucec@svn.freebsd.org)
Message-Id: <201004211903.o3LJ3YpY040629@svn.freebsd.org>
From: Bruce Cran 
Date: Wed, 21 Apr 2010 19:03:34 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r207006 - head/usr.sbin/sade
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 21 Apr 2010 19:03:35 -0000

Author: brucec
Date: Wed Apr 21 19:03:34 2010
New Revision: 207006
URL: http://svn.freebsd.org/changeset/base/207006

Log:
  Remove the reference to DD mode, and replace with Expert mode. Also, make
  sure the "Q = Finish" text is visible.
  Reword the boot manager screen to try and avoid confusion, and make the
  order of the menu items match that in sysinstall.
  
  PR:		bin/142916
  Submitted by:	Jeremy Chadwick 
  Reviewed by:	randi
  Approved by:	rrs (mentor)
  MFC after:	1 week

Modified:
  head/usr.sbin/sade/disks.c
  head/usr.sbin/sade/menus.c

Modified: head/usr.sbin/sade/disks.c
==============================================================================
--- head/usr.sbin/sade/disks.c	Wed Apr 21 18:55:44 2010	(r207005)
+++ head/usr.sbin/sade/disks.c	Wed Apr 21 19:03:34 2010	(r207006)
@@ -202,10 +202,9 @@ static void
 print_command_summary(void)
 {
     mvprintw(14, 0, "The following commands are supported (in upper or lower case):");
-    mvprintw(16, 0, "A = Use Entire Disk   G = set Drive Geometry   C = Create Slice   F = `DD' mode");
-    mvprintw(17, 0, "D = Delete Slice      Z = Toggle Size Units    S = Set Bootable   | = Wizard m.");
-    mvprintw(18, 0, "T = Change Type       U = Undo All Changes     Q = Finish");
-    mvprintw(18, 47, "W = Write Changes");
+    mvprintw(16, 0, "A = Use Entire Disk   G = set Drive Geometry   C = Create Slice");
+    mvprintw(17, 0, "D = Delete Slice      Z = Toggle Size Units    S = Set Bootable   | = Expert m.");
+    mvprintw(18, 0, "T = Change Type       U = Undo All Changes     W = Write Changes  Q = Finish");
     mvprintw(21, 0, "Use F1 or ? to get more help, arrow keys to select.");
     move(0, 0);
 }

Modified: head/usr.sbin/sade/menus.c
==============================================================================
--- head/usr.sbin/sade/menus.c	Wed Apr 21 18:55:44 2010	(r207005)
+++ head/usr.sbin/sade/menus.c	Wed Apr 21 19:03:34 2010	(r207006)
@@ -92,24 +92,23 @@ DMenu MenuIPLType = {
 DMenu MenuMBRType = {
     DMENU_NORMAL_TYPE | DMENU_SELECTION_RETURNS,
     "overwrite me",		/* will be disk specific label */
-    "FreeBSD comes with a boot selector that allows you to easily\n"
+    "FreeBSD comes with a boot manager that allows you to easily\n"
     "select between FreeBSD and any other operating systems on your machine\n"
     "at boot time.  If you have more than one drive and want to boot\n"
-    "from the second one, the boot selector will also make it possible\n"
+    "from the second one, the boot manager will also make it possible\n"
     "to do so (limitations in the PC BIOS usually prevent this otherwise).\n"
-    "If you do not want a boot selector, or wish to replace an existing\n"
-    "one, select \"standard\".  If you would prefer your Master Boot\n"
-    "Record to remain untouched then select \"None\".\n\n"
-    "  NOTE:  PC-DOS users will almost certainly require \"None\"!",
-    "Press F1 to read about drive setup",
+    "If you have other operating systems installed and would like a choice when\n"
+    "booting, choose \"BootMgr\". If you would prefer to keep your existing\n"
+    "boot manager, select \"None\".\n\n",
+    "",
     "drives",
-    { { "BootMgr",	"Install the FreeBSD Boot Manager",
-	dmenuRadioCheck, dmenuSetValue, NULL, &BootMgr, 0, 0, 0, 0 },
-      { "Standard",	"Install a standard MBR (no boot manager)",
+    { { "Standard",	"Install a standard MBR (non-interactive boot manager)",
 	dmenuRadioCheck, dmenuSetValue, NULL, &BootMgr, '(', '*', ')', 1 },
-      { "None",		"Leave the Master Boot Record untouched",
+      { "BootMgr",	"Install the FreeBSD boot manager",
+	dmenuRadioCheck, dmenuSetValue, NULL, &BootMgr, '(', '*', ')', 0 },
+      { "None",		"Do not install a boot manager",
 	dmenuRadioCheck, dmenuSetValue, NULL, &BootMgr, '(', '*', ')', 2 },
-      { NULL, NULL, NULL, NULL, NULL, NULL, 0, 0, 0, 0 } },
+      { NULL, NULL, NULL, NULL, NULL, NULL, 0, 0, 0, 0 } }
 };
 #endif /* PC98 */
 #endif /* __i386__ */

From owner-svn-src-head@FreeBSD.ORG  Wed Apr 21 19:06:58 2010
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 43195106566C;
	Wed, 21 Apr 2010 19:06:58 +0000 (UTC)
	(envelope-from bruce@cran.org.uk)
Received: from muon.cran.org.uk (unknown [IPv6:2001:470:1f09:679::1])
	by mx1.freebsd.org (Postfix) with ESMTP id 07AB78FC08;
	Wed, 21 Apr 2010 19:06:58 +0000 (UTC)
Received: from muon.cran.org.uk (localhost [127.0.0.1])
	by muon.cran.org.uk (Postfix) with ESMTP id 50841C400C;
	Wed, 21 Apr 2010 19:06:57 +0000 (UTC)
X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on muon.cran.org.uk
X-Spam-Level: 
X-Spam-Status: No, score=-2.7 required=8.0 tests=AWL,BAYES_00,RDNS_DYNAMIC
	autolearn=no version=3.2.5
Received: from core.draftnet (87-194-158-129.bethere.co.uk [87.194.158.129])
	(using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits))
	(No client certificate requested)
	by muon.cran.org.uk (Postfix) with ESMTPSA;
	Wed, 21 Apr 2010 19:06:57 +0000 (UTC)
From: Bruce Cran 
To: Bruce Cran 
Date: Wed, 21 Apr 2010 20:06:12 +0100
User-Agent: KMail/1.13.2 (FreeBSD/9.0-CURRENT; KDE/4.4.2; amd64; ; )
References: <201004211903.o3LJ3YpY040629@svn.freebsd.org>
In-Reply-To: <201004211903.o3LJ3YpY040629@svn.freebsd.org>
MIME-Version: 1.0
Content-Type: Text/Plain;
  charset="utf-8"
Content-Transfer-Encoding: 7bit
Message-Id: <201004212006.13188.bruce@cran.org.uk>
Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org,
	src-committers@freebsd.org
Subject: Re: svn commit: r207006 - head/usr.sbin/sade
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 21 Apr 2010 19:06:58 -0000

On Wednesday 21 April 2010 20:03:34 Bruce Cran wrote:
> Author: brucec
> Date: Wed Apr 21 19:03:34 2010
> New Revision: 207006
> URL: http://svn.freebsd.org/changeset/base/207006
> 
> Log:
>   Remove the reference to DD mode, and replace with Expert mode. Also, make
>   sure the "Q = Finish" text is visible.
>   Reword the boot manager screen to try and avoid confusion, and make the
>   order of the menu items match that in sysinstall.

The checkin actually replaced Wizard mode with Expert mode, and removed 'DD' 
mode.

-- 
Bruce Cran

From owner-svn-src-head@FreeBSD.ORG  Wed Apr 21 19:28:02 2010
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 3CF70106566B;
	Wed, 21 Apr 2010 19:28:02 +0000 (UTC) (envelope-from kib@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 2B89C8FC24;
	Wed, 21 Apr 2010 19:28:02 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o3LJS2KX046008;
	Wed, 21 Apr 2010 19:28:02 GMT (envelope-from kib@svn.freebsd.org)
Received: (from kib@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o3LJS2Tl046005;
	Wed, 21 Apr 2010 19:28:02 GMT (envelope-from kib@svn.freebsd.org)
Message-Id: <201004211928.o3LJS2Tl046005@svn.freebsd.org>
From: Konstantin Belousov 
Date: Wed, 21 Apr 2010 19:28:02 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r207007 - head/sys/compat/freebsd32
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 21 Apr 2010 19:28:02 -0000

Author: kib
Date: Wed Apr 21 19:28:01 2010
New Revision: 207007
URL: http://svn.freebsd.org/changeset/base/207007

Log:
  Extract the code to copy-out struct rusage32 from struct rusage
  into the new function.
  
  Reviewed by:	jhb
  MFC after:	1 week

Modified:
  head/sys/compat/freebsd32/freebsd32_misc.c
  head/sys/compat/freebsd32/freebsd32_util.h

Modified: head/sys/compat/freebsd32/freebsd32_misc.c
==============================================================================
--- head/sys/compat/freebsd32/freebsd32_misc.c	Wed Apr 21 19:03:34 2010	(r207006)
+++ head/sys/compat/freebsd32/freebsd32_misc.c	Wed Apr 21 19:28:01 2010	(r207007)
@@ -129,6 +129,28 @@ static int freebsd32_kevent_copyin(void 
 #define RETVAL_LO 0	
 #endif
 
+void
+freebsd32_rusage_out(const struct rusage *s, struct rusage32 *s32)
+{
+
+	TV_CP(*s, *s32, ru_utime);
+	TV_CP(*s, *s32, ru_stime);
+	CP(*s, *s32, ru_maxrss);
+	CP(*s, *s32, ru_ixrss);
+	CP(*s, *s32, ru_idrss);
+	CP(*s, *s32, ru_isrss);
+	CP(*s, *s32, ru_minflt);
+	CP(*s, *s32, ru_majflt);
+	CP(*s, *s32, ru_nswap);
+	CP(*s, *s32, ru_inblock);
+	CP(*s, *s32, ru_oublock);
+	CP(*s, *s32, ru_msgsnd);
+	CP(*s, *s32, ru_msgrcv);
+	CP(*s, *s32, ru_nsignals);
+	CP(*s, *s32, ru_nvcsw);
+	CP(*s, *s32, ru_nivcsw);
+}
+
 int
 freebsd32_wait4(struct thread *td, struct freebsd32_wait4_args *uap)
 {
@@ -146,22 +168,7 @@ freebsd32_wait4(struct thread *td, struc
 	if (uap->status != NULL)
 		error = copyout(&status, uap->status, sizeof(status));
 	if (uap->rusage != NULL && error == 0) {
-		TV_CP(ru, ru32, ru_utime);
-		TV_CP(ru, ru32, ru_stime);
-		CP(ru, ru32, ru_maxrss);
-		CP(ru, ru32, ru_ixrss);
-		CP(ru, ru32, ru_idrss);
-		CP(ru, ru32, ru_isrss);
-		CP(ru, ru32, ru_minflt);
-		CP(ru, ru32, ru_majflt);
-		CP(ru, ru32, ru_nswap);
-		CP(ru, ru32, ru_inblock);
-		CP(ru, ru32, ru_oublock);
-		CP(ru, ru32, ru_msgsnd);
-		CP(ru, ru32, ru_msgrcv);
-		CP(ru, ru32, ru_nsignals);
-		CP(ru, ru32, ru_nvcsw);
-		CP(ru, ru32, ru_nivcsw);
+		freebsd32_rusage_out(&ru, &ru32);
 		error = copyout(&ru32, uap->rusage, sizeof(ru32));
 	}
 	return (error);
@@ -755,22 +762,7 @@ freebsd32_getrusage(struct thread *td, s
 	if (error)
 		return (error);
 	if (uap->rusage != NULL) {
-		TV_CP(s, s32, ru_utime);
-		TV_CP(s, s32, ru_stime);
-		CP(s, s32, ru_maxrss);
-		CP(s, s32, ru_ixrss);
-		CP(s, s32, ru_idrss);
-		CP(s, s32, ru_isrss);
-		CP(s, s32, ru_minflt);
-		CP(s, s32, ru_majflt);
-		CP(s, s32, ru_nswap);
-		CP(s, s32, ru_inblock);
-		CP(s, s32, ru_oublock);
-		CP(s, s32, ru_msgsnd);
-		CP(s, s32, ru_msgrcv);
-		CP(s, s32, ru_nsignals);
-		CP(s, s32, ru_nvcsw);
-		CP(s, s32, ru_nivcsw);
+		freebsd32_rusage_out(&s, &s32);
 		error = copyout(&s32, uap->rusage, sizeof(s32));
 	}
 	return (error);

Modified: head/sys/compat/freebsd32/freebsd32_util.h
==============================================================================
--- head/sys/compat/freebsd32/freebsd32_util.h	Wed Apr 21 19:03:34 2010	(r207006)
+++ head/sys/compat/freebsd32/freebsd32_util.h	Wed Apr 21 19:28:01 2010	(r207007)
@@ -94,9 +94,12 @@ int    syscall32_module_handler(struct m
 int    syscall32_helper_register(struct syscall_helper_data *sd);
 int    syscall32_helper_unregister(struct syscall_helper_data *sd);
 
-register_t *freebsd32_copyout_strings(struct image_params *imgp);
 struct iovec32;
+struct rusage32;
+register_t *freebsd32_copyout_strings(struct image_params *imgp);
 int	freebsd32_copyiniov(struct iovec32 *iovp, u_int iovcnt,
 	    struct iovec **iov, int error);
+void	freebsd32_rusage_out(const struct rusage *s, struct rusage32 *s32);
+
 
 #endif /* !_COMPAT_FREEBSD32_FREEBSD32_UTIL_H_ */

From owner-svn-src-head@FreeBSD.ORG  Wed Apr 21 19:32:00 2010
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id E1D65106566C;
	Wed, 21 Apr 2010 19:32:00 +0000 (UTC) (envelope-from kib@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id CFD738FC1B;
	Wed, 21 Apr 2010 19:32:00 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o3LJW0KZ046910;
	Wed, 21 Apr 2010 19:32:00 GMT (envelope-from kib@svn.freebsd.org)
Received: (from kib@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o3LJW0Mc046907;
	Wed, 21 Apr 2010 19:32:00 GMT (envelope-from kib@svn.freebsd.org)
Message-Id: <201004211932.o3LJW0Mc046907@svn.freebsd.org>
From: Konstantin Belousov 
Date: Wed, 21 Apr 2010 19:32:00 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r207008 - in head/sys: compat/freebsd32 kern
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 21 Apr 2010 19:32:01 -0000

Author: kib
Date: Wed Apr 21 19:32:00 2010
New Revision: 207008
URL: http://svn.freebsd.org/changeset/base/207008

Log:
  Provide compat32 shims for kinfo_proc sysctl. This allows 32bit ps(1) to
  mostly work on 64bit host.
  
  The work is based on an original patch submitted by emaste, obtained
  from Sandvine's source tree.
  
  Reviewed by:	jhb
  MFC after:	1 week

Modified:
  head/sys/compat/freebsd32/freebsd32.h
  head/sys/kern/kern_proc.c

Modified: head/sys/compat/freebsd32/freebsd32.h
==============================================================================
--- head/sys/compat/freebsd32/freebsd32.h	Wed Apr 21 19:28:01 2010	(r207007)
+++ head/sys/compat/freebsd32/freebsd32.h	Wed Apr 21 19:32:00 2010	(r207008)
@@ -31,6 +31,7 @@
 
 #include 
 #include 
+#include 
 
 #define PTRIN(v)	(void *)(uintptr_t) (v)
 #define PTROUT(v)	(u_int32_t)(uintptr_t) (v)
@@ -229,4 +230,85 @@ struct mq_attr32 {
 	int	__reserved[4];
 };
 
+struct kinfo_proc32 {
+	int	ki_structsize;
+	int	ki_layout;
+	uint32_t ki_args;
+	uint32_t ki_paddr;
+	uint32_t ki_addr;
+	uint32_t ki_tracep;
+	uint32_t ki_textvp;
+	uint32_t ki_fd;
+	uint32_t ki_vmspace;
+	uint32_t ki_wchan;
+	pid_t	ki_pid;
+	pid_t	ki_ppid;
+	pid_t	ki_pgid;
+	pid_t	ki_tpgid;
+	pid_t	ki_sid;
+	pid_t	ki_tsid;
+	short	ki_jobc;
+	short	ki_spare_short1;
+	dev_t	ki_tdev;
+	sigset_t ki_siglist;
+	sigset_t ki_sigmask;
+	sigset_t ki_sigignore;
+	sigset_t ki_sigcatch;
+	uid_t	ki_uid;
+	uid_t	ki_ruid;
+	uid_t	ki_svuid;
+	gid_t	ki_rgid;
+	gid_t	ki_svgid;
+	short	ki_ngroups;
+	short	ki_spare_short2;
+	gid_t 	ki_groups[KI_NGROUPS];
+	uint32_t ki_size;
+	int32_t ki_rssize;
+	int32_t ki_swrss;
+	int32_t ki_tsize;
+	int32_t ki_dsize;
+	int32_t ki_ssize;
+	u_short	ki_xstat;
+	u_short	ki_acflag;
+	fixpt_t	ki_pctcpu;
+	u_int	ki_estcpu;
+	u_int	ki_slptime;
+	u_int	ki_swtime;
+	int	ki_spareint1;
+	u_int64_t ki_runtime;
+	struct	timeval32 ki_start;
+	struct	timeval32 ki_childtime;
+	int	ki_flag;
+	int	ki_kiflag;
+	int	ki_traceflag;
+	char	ki_stat;
+	signed char ki_nice;
+	char	ki_lock;
+	char	ki_rqindex;
+	u_char	ki_oncpu;
+	u_char	ki_lastcpu;
+	char	ki_ocomm[OCOMMLEN+1];
+	char	ki_wmesg[WMESGLEN+1];
+	char	ki_login[LOGNAMELEN+1];
+	char	ki_lockname[LOCKNAMELEN+1];
+	char	ki_comm[COMMLEN+1];
+	char	ki_emul[KI_EMULNAMELEN+1];
+	char	ki_sparestrings[68];
+	int	ki_spareints[KI_NSPARE_INT];
+	u_int	ki_cr_flags;
+	int	ki_jid;
+	int	ki_numthreads;
+	lwpid_t	ki_tid;
+	struct	priority ki_pri;
+	struct	rusage32 ki_rusage;
+	struct	rusage32 ki_rusage_ch;
+	uint32_t ki_pcb;
+	uint32_t ki_kstack;
+	uint32_t ki_udata;
+	uint32_t ki_spareptrs[KI_NSPARE_PTR];	/* spare room for growth */
+	int	ki_sparelongs[KI_NSPARE_LONG];
+	int	ki_sflag;
+	int	ki_tdflags;
+};
+
 #endif /* !_COMPAT_FREEBSD32_FREEBSD32_H_ */

Modified: head/sys/kern/kern_proc.c
==============================================================================
--- head/sys/kern/kern_proc.c	Wed Apr 21 19:28:01 2010	(r207007)
+++ head/sys/kern/kern_proc.c	Wed Apr 21 19:32:00 2010	(r207008)
@@ -42,6 +42,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -79,6 +80,11 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 
+#ifdef COMPAT_FREEBSD32
+#include 
+#include 
+#endif
+
 SDT_PROVIDER_DEFINE(proc);
 SDT_PROBE_DEFINE(proc, kernel, ctor, entry);
 SDT_PROBE_ARGTYPE(proc, kernel, ctor, entry, 0, "struct proc *");
@@ -969,6 +975,128 @@ zpfind(pid_t pid)
 #define KERN_PROC_ZOMBMASK	0x3
 #define KERN_PROC_NOTHREADS	0x4
 
+#ifdef COMPAT_FREEBSD32
+
+/*
+ * This function is typically used to copy out the kernel address, so
+ * it can be replaced by assignment of zero.
+ */
+static inline uint32_t
+ptr32_trim(void *ptr)
+{
+	uintptr_t uptr;
+
+	uptr = (uintptr_t)ptr;
+	return ((uptr > UINT_MAX) ? 0 : uptr);
+}
+
+#define PTRTRIM_CP(src,dst,fld) \
+	do { (dst).fld = ptr32_trim((src).fld); } while (0)
+
+static void
+freebsd32_kinfo_proc_out(const struct kinfo_proc *ki, struct kinfo_proc32 *ki32)
+{
+	int i;
+
+	bzero(ki32, sizeof(struct kinfo_proc32));
+	ki32->ki_structsize = sizeof(struct kinfo_proc32);
+	CP(*ki, *ki32, ki_layout);
+	PTRTRIM_CP(*ki, *ki32, ki_args);
+	PTRTRIM_CP(*ki, *ki32, ki_paddr);
+	PTRTRIM_CP(*ki, *ki32, ki_addr);
+	PTRTRIM_CP(*ki, *ki32, ki_tracep);
+	PTRTRIM_CP(*ki, *ki32, ki_textvp);
+	PTRTRIM_CP(*ki, *ki32, ki_fd);
+	PTRTRIM_CP(*ki, *ki32, ki_vmspace);
+	PTRTRIM_CP(*ki, *ki32, ki_wchan);
+	CP(*ki, *ki32, ki_pid);
+	CP(*ki, *ki32, ki_ppid);
+	CP(*ki, *ki32, ki_pgid);
+	CP(*ki, *ki32, ki_tpgid);
+	CP(*ki, *ki32, ki_sid);
+	CP(*ki, *ki32, ki_tsid);
+	CP(*ki, *ki32, ki_jobc);
+	CP(*ki, *ki32, ki_tdev);
+	CP(*ki, *ki32, ki_siglist);
+	CP(*ki, *ki32, ki_sigmask);
+	CP(*ki, *ki32, ki_sigignore);
+	CP(*ki, *ki32, ki_sigcatch);
+	CP(*ki, *ki32, ki_uid);
+	CP(*ki, *ki32, ki_ruid);
+	CP(*ki, *ki32, ki_svuid);
+	CP(*ki, *ki32, ki_rgid);
+	CP(*ki, *ki32, ki_svgid);
+	CP(*ki, *ki32, ki_ngroups);
+	for (i = 0; i < KI_NGROUPS; i++)
+		CP(*ki, *ki32, ki_groups[i]);
+	CP(*ki, *ki32, ki_size);
+	CP(*ki, *ki32, ki_rssize);
+	CP(*ki, *ki32, ki_swrss);
+	CP(*ki, *ki32, ki_tsize);
+	CP(*ki, *ki32, ki_dsize);
+	CP(*ki, *ki32, ki_ssize);
+	CP(*ki, *ki32, ki_xstat);
+	CP(*ki, *ki32, ki_acflag);
+	CP(*ki, *ki32, ki_pctcpu);
+	CP(*ki, *ki32, ki_estcpu);
+	CP(*ki, *ki32, ki_slptime);
+	CP(*ki, *ki32, ki_swtime);
+	CP(*ki, *ki32, ki_runtime);
+	TV_CP(*ki, *ki32, ki_start);
+	TV_CP(*ki, *ki32, ki_childtime);
+	CP(*ki, *ki32, ki_flag);
+	CP(*ki, *ki32, ki_kiflag);
+	CP(*ki, *ki32, ki_traceflag);
+	CP(*ki, *ki32, ki_stat);
+	CP(*ki, *ki32, ki_nice);
+	CP(*ki, *ki32, ki_lock);
+	CP(*ki, *ki32, ki_rqindex);
+	CP(*ki, *ki32, ki_oncpu);
+	CP(*ki, *ki32, ki_lastcpu);
+	bcopy(ki->ki_ocomm, ki32->ki_ocomm, OCOMMLEN + 1);
+	bcopy(ki->ki_wmesg, ki32->ki_wmesg, WMESGLEN + 1);
+	bcopy(ki->ki_login, ki32->ki_login, LOGNAMELEN + 1);
+	bcopy(ki->ki_lockname, ki32->ki_lockname, LOCKNAMELEN + 1);
+	bcopy(ki->ki_comm, ki32->ki_comm, COMMLEN + 1);
+	bcopy(ki->ki_emul, ki32->ki_emul, KI_EMULNAMELEN + 1);
+	CP(*ki, *ki32, ki_cr_flags);
+	CP(*ki, *ki32, ki_jid);
+	CP(*ki, *ki32, ki_numthreads);
+	CP(*ki, *ki32, ki_tid);
+	CP(*ki, *ki32, ki_pri);
+	freebsd32_rusage_out(&ki->ki_rusage, &ki32->ki_rusage);
+	freebsd32_rusage_out(&ki->ki_rusage_ch, &ki32->ki_rusage_ch);
+	PTRTRIM_CP(*ki, *ki32, ki_pcb);
+	PTRTRIM_CP(*ki, *ki32, ki_kstack);
+	PTRTRIM_CP(*ki, *ki32, ki_udata);
+	CP(*ki, *ki32, ki_sflag);
+	CP(*ki, *ki32, ki_tdflags);
+}
+
+static int
+sysctl_out_proc_copyout(struct kinfo_proc *ki, struct sysctl_req *req)
+{
+	struct kinfo_proc32 ki32;
+	int error;
+
+	if (req->flags & SCTL_MASK32) {
+		freebsd32_kinfo_proc_out(ki, &ki32);
+		error = SYSCTL_OUT(req, (caddr_t)&ki32,
+		    sizeof(struct kinfo_proc32));
+	} else
+		error = SYSCTL_OUT(req, (caddr_t)ki,
+		    sizeof(struct kinfo_proc));
+	return (error);
+}
+#else
+static int
+sysctl_out_proc_copyout(struct kinfo_proc *ki, struct sysctl_req *req)
+{
+
+	return (SYSCTL_OUT(req, (caddr_t)&ki, sizeof(struct kinfo_proc)));
+}
+#endif
+
 /*
  * Must be called with the process locked and will return with it unlocked.
  */
@@ -986,13 +1114,11 @@ sysctl_out_proc(struct proc *p, struct s
 
 	fill_kinfo_proc(p, &kinfo_proc);
 	if (flags & KERN_PROC_NOTHREADS)
-		error = SYSCTL_OUT(req, (caddr_t)&kinfo_proc,
-		    sizeof(kinfo_proc));
+		error = sysctl_out_proc_copyout(&kinfo_proc, req);
 	else {
 		FOREACH_THREAD_IN_PROC(p, td) {
 			fill_kinfo_thread(td, &kinfo_proc, 1);
-			error = SYSCTL_OUT(req, (caddr_t)&kinfo_proc,
-			    sizeof(kinfo_proc));
+			error = sysctl_out_proc_copyout(&kinfo_proc, req);
 			if (error)
 				break;
 		}

From owner-svn-src-head@FreeBSD.ORG  Wed Apr 21 19:35:56 2010
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 82E3F106566B;
	Wed, 21 Apr 2010 19:35:56 +0000 (UTC) (envelope-from kib@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 725178FC0C;
	Wed, 21 Apr 2010 19:35:56 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o3LJZuc6047808;
	Wed, 21 Apr 2010 19:35:56 GMT (envelope-from kib@svn.freebsd.org)
Received: (from kib@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o3LJZuBh047806;
	Wed, 21 Apr 2010 19:35:56 GMT (envelope-from kib@svn.freebsd.org)
Message-Id: <201004211935.o3LJZuBh047806@svn.freebsd.org>
From: Konstantin Belousov 
Date: Wed, 21 Apr 2010 19:35:56 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r207009 - head/lib/libc/stdlib
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 21 Apr 2010 19:35:56 -0000

Author: kib
Date: Wed Apr 21 19:35:56 2010
New Revision: 207009
URL: http://svn.freebsd.org/changeset/base/207009

Log:
  C language does not has references, it provides pointers.
  
  Suggested by:	bde
  MFC after:	2 weeks

Modified:
  head/lib/libc/stdlib/realpath.3

Modified: head/lib/libc/stdlib/realpath.3
==============================================================================
--- head/lib/libc/stdlib/realpath.3	Wed Apr 21 19:32:00 2010	(r207008)
+++ head/lib/libc/stdlib/realpath.3	Wed Apr 21 19:35:56 2010	(r207009)
@@ -56,13 +56,13 @@ and
 in
 .Fa pathname ,
 and copies the resulting absolute pathname into
-the memory referenced by
+the memory pointed to by
 .Fa resolved_path .
 The
 .Fa resolved_path
 argument
 .Em must
-refer to a buffer capable of storing at least
+point to a buffer capable of storing at least
 .Dv PATH_MAX
 characters, or be
 .Dv NULL .

From owner-svn-src-head@FreeBSD.ORG  Wed Apr 21 20:04:43 2010
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 444F91065672;
	Wed, 21 Apr 2010 20:04:43 +0000 (UTC) (envelope-from kib@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 339798FC18;
	Wed, 21 Apr 2010 20:04:43 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o3LK4hqI054616;
	Wed, 21 Apr 2010 20:04:43 GMT (envelope-from kib@svn.freebsd.org)
Received: (from kib@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o3LK4h3A054614;
	Wed, 21 Apr 2010 20:04:43 GMT (envelope-from kib@svn.freebsd.org)
Message-Id: <201004212004.o3LK4h3A054614@svn.freebsd.org>
From: Konstantin Belousov 
Date: Wed, 21 Apr 2010 20:04:43 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r207016 - head/sys/kern
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 21 Apr 2010 20:04:43 -0000

Author: kib
Date: Wed Apr 21 20:04:42 2010
New Revision: 207016
URL: http://svn.freebsd.org/changeset/base/207016

Log:
  Fix typo.
  
  Submitted by:	emaste
  Pointy hat to:	kib (who needs much bigger wardrobe)
  MFC after:	1 week

Modified:
  head/sys/kern/kern_proc.c

Modified: head/sys/kern/kern_proc.c
==============================================================================
--- head/sys/kern/kern_proc.c	Wed Apr 21 20:00:13 2010	(r207015)
+++ head/sys/kern/kern_proc.c	Wed Apr 21 20:04:42 2010	(r207016)
@@ -1093,7 +1093,7 @@ static int
 sysctl_out_proc_copyout(struct kinfo_proc *ki, struct sysctl_req *req)
 {
 
-	return (SYSCTL_OUT(req, (caddr_t)&ki, sizeof(struct kinfo_proc)));
+	return (SYSCTL_OUT(req, (caddr_t)ki, sizeof(struct kinfo_proc)));
 }
 #endif
 

From owner-svn-src-head@FreeBSD.ORG  Wed Apr 21 20:05:50 2010
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 298B0106564A;
	Wed, 21 Apr 2010 20:05:50 +0000 (UTC)
	(envelope-from anchie@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 190398FC0A;
	Wed, 21 Apr 2010 20:05:50 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o3LK5nNe054889;
	Wed, 21 Apr 2010 20:05:49 GMT (envelope-from anchie@svn.freebsd.org)
Received: (from anchie@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o3LK5nZ5054887;
	Wed, 21 Apr 2010 20:05:49 GMT (envelope-from anchie@svn.freebsd.org)
Message-Id: <201004212005.o3LK5nZ5054887@svn.freebsd.org>
From: Ana Kukec 
Date: Wed, 21 Apr 2010 20:05:49 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r207017 - head/share/misc
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 21 Apr 2010 20:05:50 -0000

Author: anchie
Date: Wed Apr 21 20:05:49 2010
New Revision: 207017
URL: http://svn.freebsd.org/changeset/base/207017

Log:
  Fix of r206904, \nanchie is needed instead of \anchie.
  
  Approved by:	bz (mentor)
  Reported by:	danfe, zec

Modified:
  head/share/misc/committers-src.dot

Modified: head/share/misc/committers-src.dot
==============================================================================
--- head/share/misc/committers-src.dot	Wed Apr 21 20:04:42 2010	(r207016)
+++ head/share/misc/committers-src.dot	Wed Apr 21 20:05:49 2010	(r207017)
@@ -55,7 +55,7 @@ node [color=lightblue2, style=filled, bg
 ache [label="Andrey Chernov\nache@FreeBSD.org\n1993/10/31"]
 akiyama [label="Shunsuke Akiyama\nakiyama@FreeBSD.org\n2000/06/19"]
 ambrisko [label="Doug Ambrisko\nambrisko@FreeBSD.org\n2001/12/19"]
-anchie [label="Ana Kukec\anchie@FreeBSD.org\n2010/04/14"]
+anchie [label="Ana Kukec\nanchie@FreeBSD.org\n2010/04/14"]
 andre [label="Andre Oppermann\nandre@FreeBSD.org\n2003/11/12"]
 anholt [label="Eric Anholt\nanholt@FreeBSD.org\n2002/04/22"]
 antoine [label="Antoine Brodin\nantoine@FreeBSD.org\n2008/02/03"]

From owner-svn-src-head@FreeBSD.ORG  Wed Apr 21 21:51:14 2010
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id B817D106566B;
	Wed, 21 Apr 2010 21:51:14 +0000 (UTC)
	(envelope-from thompsa@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id A61A58FC1F;
	Wed, 21 Apr 2010 21:51:14 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o3LLpE0g078335;
	Wed, 21 Apr 2010 21:51:14 GMT (envelope-from thompsa@svn.freebsd.org)
Received: (from thompsa@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o3LLpE3V078331;
	Wed, 21 Apr 2010 21:51:14 GMT (envelope-from thompsa@svn.freebsd.org)
Message-Id: <201004212151.o3LLpE3V078331@svn.freebsd.org>
From: Andrew Thompson 
Date: Wed, 21 Apr 2010 21:51:14 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r207020 - in head: etc etc/devd sys/dev/usb
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 21 Apr 2010 21:51:14 -0000

Author: thompsa
Date: Wed Apr 21 21:51:14 2010
New Revision: 207020
URL: http://svn.freebsd.org/changeset/base/207020

Log:
  Change usb devd events from fake attach to a notify. The ugen device is not a
  proper device_t so it faked the devctl event to appear like one, this is now a
  notify which allows more information to be passed.
  
  We notify for both the device attach/detach and for each usb interface. A devd
  rule can now match on the interface properties, including composite devices
  which may have a uvideo interface and also usound and possibly uhid too.
  
  An example to match a umass device with a scsi subclass and BBB protocol would be
  
  notify 100 {
  	match "system"          "USB";
  	match "subsystem"       "INTERFACE";
  	match "type"            "ATTACH";
  	match "intclass"        "0x08";
  	match "intsubclass"     "0x06";
  	match "intprotocol"     "0x50";
  	action ...
  };
  
  The old attach devctl event has been retained for the moment to make merging to
  8.1 easier. This was never compatible with 7.x or earlier due to the ugen regex
  change needed.
  
  Reviewed by:	warner
  MFC after:	1 week

Modified:
  head/etc/devd.conf
  head/etc/devd/uath.conf
  head/sys/dev/usb/usb_device.c

Modified: head/etc/devd.conf
==============================================================================
--- head/etc/devd.conf	Wed Apr 21 21:21:52 2010	(r207019)
+++ head/etc/devd.conf	Wed Apr 21 21:51:14 2010	(r207020)
@@ -138,12 +138,14 @@ attach 100 {
 # This entry starts the ColdSync tool in daemon mode. Make sure you have an up
 # to date /usr/local/etc/palms. We override the 'listen' settings for port and
 # type in /usr/local/etc/coldsync.conf.
-attach 100 {
-	device-name "ugen[0-9]+";
-	match "vendor" "0x082d";
-	match "product" "0x0100";
-	match "release" "0x0100";
-	action "/usr/local/bin/coldsync -md -p /dev/$device-name -t usb";
+notify 100 {
+	match "system"		"USB";
+	match "subsystem"	"DEVICE";
+	match "type"		"ATTACH";
+	match "vendor"		"0x082d";
+	match "product"		"0x0100";
+	match "release"		"0x0100";
+	action "/usr/local/bin/coldsync -md -p /dev/$cdev -t usb";
 };
 
 #

Modified: head/etc/devd/uath.conf
==============================================================================
--- head/etc/devd/uath.conf	Wed Apr 21 21:21:52 2010	(r207019)
+++ head/etc/devd/uath.conf	Wed Apr 21 21:51:14 2010	(r207020)
@@ -4,117 +4,143 @@
 
 # Accton
 #   SMCWUSB-G and SMCWUSBT-G2
-attach 100 {
-	device-name "ugen[0-9.]+";
-	match "vendor" "0x083a";
-	match "product" "(0x4505|0x4507)";
-	action "/usr/sbin/uathload -d /dev/$device-name";
+notify 100 {
+	match "system"		"USB";
+	match "subsystem"	"DEVICE";
+	match "type"		"ATTACH";
+	match "vendor"		"0x083a";
+	match "product"		"(0x4505|0x4507)";
+	action "/usr/sbin/uathload -d /dev/$cdev";
 };
 
 # Atheros Communications
 #   AR5523
-attach 100 {
-	device-name "ugen[0-9.]+";
-	match "vendor" "0x168c";
-	match "product" "0x0002";
-	action "/usr/sbin/uathload -d /dev/$device-name";
+notify 100 {
+	match "system"		"USB";
+	match "subsystem"	"DEVICE";
+	match "type"		"ATTACH";
+	match "vendor"		"0x168c";
+	match "product"		"0x0002";
+	action "/usr/sbin/uathload -d /dev/$cdev";
 };
 
 # Atheros Communications
 #   AR5523
-attach 100 {
-	device-name "ugen[0-9.]+";
-	match "vendor" "0x0cf3";
-	match "product" "(0x0002|0x0004|0x0006)";
-	action "/usr/sbin/uathload -d /dev/$device-name";
+notify 100 {
+	match "system"		"USB";
+	match "subsystem"	"DEVICE";
+	match "type"		"ATTACH";
+	match "vendor"		"0x0cf3";
+	match "product"		"(0x0002|0x0004|0x0006)";
+	action "/usr/sbin/uathload -d /dev/$cdev";
 };
 
 # Conceptronic
 #   AR5523
-attach 100 {
-	device-name "ugen[0-9.]+";
-	match "vendor" "0x0d8e";
-	match "product" "(0x7802|0x7812)";
-	action "/usr/sbin/uathload -d /dev/$device-name";
+notify 100 {
+	match "system"		"USB";
+	match "subsystem"	"DEVICE";
+	match "type"		"ATTACH";
+	match "vendor"		"0x0d8e";
+	match "product"		"(0x7802|0x7812)";
+	action "/usr/sbin/uathload -d /dev/$cdev";
 };
 
 # D-Link
 #   DWL-AG132, DWL-G132 and DWL-AG122
-attach 100 {
-	device-name "ugen[0-9.]+";
-	match "vendor" "0x2001";
-	match "product" "(0x3a01|0x3a03|0x3a05)";
-	action "/usr/sbin/uathload -d /dev/$device-name";
+notify 100 {
+	match "system"		"USB";
+	match "subsystem"	"DEVICE";
+	match "type"		"ATTACH";
+	match "vendor"		"0x2001";
+	match "product"		"(0x3a01|0x3a03|0x3a05)";
+	action "/usr/sbin/uathload -d /dev/$cdev";
 };
 
 # D-Link
 #  DWA-120
-attach 100 {
-	device-name "ugen[0-9.]+";
-	match "vendor" "0x07d1";
-	match "product" "0x3a0c";
-	action "/usr/sbin/uathload -d /dev/$device-name";
+notify 100 {
+	match "system"		"USB";
+	match "subsystem"	"DEVICE";
+	match "type"		"ATTACH";
+	match "vendor"		"0x07d1";
+	match "product"		"0x3a0c";
+	action "/usr/sbin/uathload -d /dev/$cdev";
 };
 
 # Gigaset
 #   SMCWUSBT-G
-attach 100 {
-	device-name "ugen[0-9.]+";
-	match "vendor" "0x1690";
-	match "product" "(0x0711|0x0713)";
-	action "/usr/sbin/uathload -d /dev/$device-name";
+notify 100 {
+	match "system"		"USB";
+	match "subsystem"	"DEVICE";
+	match "type"		"ATTACH";
+	match "vendor"		"0x1690";
+	match "product"		"(0x0711|0x0713)";
+	action "/usr/sbin/uathload -d /dev/$cdev";
 };
 
 # Global Sun Technology
 #   AR5523
-attach 100 {
-	device-name "ugen[0-9.]+";
-	match "vendor" "0x16ab";
-	match "product" "(0x7802|0x7812)";
-	action "/usr/sbin/uathload -d /dev/$device-name";
+notify 100 {
+	match "system"		"USB";
+	match "subsystem"	"DEVICE";
+	match "type"		"ATTACH";
+	match "vendor"		"0x16ab";
+	match "product"		"(0x7802|0x7812)";
+	action "/usr/sbin/uathload -d /dev/$cdev";
 };
 
 # BayNETGEAR
 #   WG111U
-attach 100 {
-	device-name "ugen[0-9.]+";
-	match "vendor" "0x0846";
-	match "product" "0x4301";
-	action "/usr/sbin/uathload -d /dev/$device-name";
+notify 100 {
+	match "system"		"USB";
+	match "subsystem"	"DEVICE";
+	match "type"		"ATTACH";
+	match "vendor"		"0x0846";
+	match "product"		"0x4301";
+	action "/usr/sbin/uathload -d /dev/$cdev";
 };
 
 # Netgear
 #   WG111T and WPN111
-attach 100 {
-	device-name "ugen[0-9.]+";
-	match "vendor" "0x1385";
-	match "product" "(0x4251|0x5f01)";
-	action "/usr/sbin/uathload -d /dev/$device-name";
+notify 100 {
+	match "system"		"USB";
+	match "subsystem"	"DEVICE";
+	match "type"		"ATTACH";
+	match "vendor"		"0x1385";
+	match "product"		"(0x4251|0x5f01)";
+	action "/usr/sbin/uathload -d /dev/$cdev";
 };
 
 # U-MEDIA Communications
 #   TEW-444UB and AR5523
-attach 100 {
-	device-name "ugen[0-9.]+";
-	match "vendor" "0x157e";
-	match "product" "(0x3007|0x3206)";
-	action "/usr/sbin/uathload -d /dev/$device-name";
+notify 100 {
+	match "system"		"USB";
+	match "subsystem"	"DEVICE";
+	match "type"		"ATTACH";
+	match "vendor"		"0x157e";
+	match "product"		"(0x3007|0x3206)";
+	action "/usr/sbin/uathload -d /dev/$cdev";
 };
 
 # Wistron NeWeb
 #   AR5523
-attach 100 {
-	device-name "ugen[0-9.]+";
-	match "vendor" "0x1435";
-	match "product" "(0x0827|0x0829)";
-	action "/usr/sbin/uathload -d /dev/$device-name";
+notify 100 {
+	match "system"		"USB";
+	match "subsystem"	"DEVICE";
+	match "type"		"ATTACH";
+	match "vendor"		"0x1435";
+	match "product"		"(0x0827|0x0829)";
+	action "/usr/sbin/uathload -d /dev/$cdev";
 };
 
 # Z-Com
 #   AR5523
-attach 100 {
-	device-name "ugen[0-9.]+";
-	match "vendor" "0x0cde";
-	match "product" "0x0013";
-	action "/usr/sbin/uathload -d /dev/$device-name";
+notify 100 {
+	match "system"		"USB";
+	match "subsystem"	"DEVICE";
+	match "type"		"ATTACH";
+	match "vendor"		"0x0cde";
+	match "product"		"0x0013";
+	action "/usr/sbin/uathload -d /dev/$cdev";
 };

Modified: head/sys/dev/usb/usb_device.c
==============================================================================
--- head/sys/dev/usb/usb_device.c	Wed Apr 21 21:21:52 2010	(r207019)
+++ head/sys/dev/usb/usb_device.c	Wed Apr 21 21:51:14 2010	(r207020)
@@ -45,6 +45,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -1834,7 +1835,7 @@ config_done:
 	printf("%s: <%s> at %s\n", udev->ugen_name, udev->manufacturer,
 	    device_get_nameunit(udev->bus->bdev));
 
-	usb_notify_addq("+", udev);
+	usb_notify_addq("ATTACH", udev);
 #endif
 done:
 	if (err) {
@@ -1980,7 +1981,7 @@ usb_free_device(struct usb_device *udev,
 	usb_set_device_state(udev, USB_STATE_DETACHED);
 
 #if USB_HAVE_UGEN
-	usb_notify_addq("-", udev);
+	usb_notify_addq("DETACH", udev);
 
 	printf("%s: <%s> at %s (disconnected)\n", udev->ugen_name,
 	    udev->manufacturer, device_get_nameunit(bus->bdev));
@@ -2347,13 +2348,23 @@ usbd_get_device_index(struct usb_device 
  *
  * This function will generate events for dev.
  *------------------------------------------------------------------------*/
+#ifndef BURN_BRIDGES
 static void
-usb_notify_addq(const char *type, struct usb_device *udev)
+usb_notify_addq_compat(const char *type, struct usb_device *udev)
 {
 	char *data = NULL;
+	const char *ntype;
 	struct malloc_type *mt;
 	const size_t buf_size = 512;
 
+	/* Convert notify type */
+	if (strcmp(type, "ATTACH") == 0)
+		ntype = "+";
+	else if (strcmp(type, "DETACH") == 0)
+		ntype = "-";
+	else
+		return;
+
 	mtx_lock(&malloc_mtx);
 	mt = malloc_desc2type("bus");	/* XXX M_BUS */
 	mtx_unlock(&malloc_mtx);
@@ -2378,7 +2389,7 @@ usb_notify_addq(const char *type, struct
 	    "port=%u "
 	    "on "
 	    "%s\n",
-	    type,
+	    ntype,
 	    udev->ugen_name,
 	    UGETW(udev->ddesc.idVendor),
 	    UGETW(udev->ddesc.idProduct),
@@ -2393,6 +2404,85 @@ usb_notify_addq(const char *type, struct
 
 	devctl_queue_data(data);
 }
+#endif
+
+static void
+usb_notify_addq(const char *type, struct usb_device *udev)
+{
+	struct usb_interface *iface;
+	struct sbuf *sb;
+	int i;
+
+#ifndef BURN_BRIDGES
+	usb_notify_addq_compat(type, udev);
+#endif
+
+	/* announce the device */
+	sb = sbuf_new_auto();
+	sbuf_printf(sb,
+	    "cdev=%s "
+	    "vendor=0x%04x "
+	    "product=0x%04x "
+	    "devclass=0x%02x "
+	    "devsubclass=0x%02x "
+	    "sernum=\"%s\" "
+	    "release=0x%04x "
+	    "port=%u "
+	    "parent=%s\n",
+	    udev->ugen_name,
+	    UGETW(udev->ddesc.idVendor),
+	    UGETW(udev->ddesc.idProduct),
+	    udev->ddesc.bDeviceClass,
+	    udev->ddesc.bDeviceSubClass,
+	    udev->serial,
+	    UGETW(udev->ddesc.bcdDevice),
+	    udev->port_no,
+	    udev->parent_hub != NULL ?
+	    udev->parent_hub->ugen_name :
+	    device_get_nameunit(device_get_parent(udev->bus->bdev)));
+	sbuf_finish(sb);
+	devctl_notify("USB", "DEVICE", type, sbuf_data(sb));
+	sbuf_delete(sb);
+
+	/* announce each interface */
+	for (i = 0; i < USB_IFACE_MAX; i++) {
+		iface = usbd_get_iface(udev, i);
+		if (iface == NULL)
+			break;		/* end of interfaces */
+		if (iface->idesc == NULL)
+			continue;	/* no interface descriptor */
+
+		sb = sbuf_new_auto();
+		sbuf_printf(sb,
+		    "cdev=%s "
+		    "vendor=0x%04x "
+		    "product=0x%04x "
+		    "devclass=0x%02x "
+		    "devsubclass=0x%02x "
+		    "sernum=\"%s\" "
+		    "release=0x%04x "
+		    "interface=%d "
+		    "endpoints=%d "
+		    "intclass=0x%02x "
+		    "intsubclass=0x%02x "
+		    "intprotocol=0x%02x\n",
+		    udev->ugen_name,
+		    UGETW(udev->ddesc.idVendor),
+		    UGETW(udev->ddesc.idProduct),
+		    udev->ddesc.bDeviceClass,
+		    udev->ddesc.bDeviceSubClass,
+		    udev->serial,
+		    UGETW(udev->ddesc.bcdDevice),
+		    iface->idesc->bInterfaceNumber,
+		    iface->idesc->bNumEndpoints,
+		    iface->idesc->bInterfaceClass,
+		    iface->idesc->bInterfaceSubClass,
+		    iface->idesc->bInterfaceProtocol);
+		sbuf_finish(sb);
+		devctl_notify("USB", "INTERFACE", type, sbuf_data(sb));
+		sbuf_delete(sb);
+	}
+}
 
 /*------------------------------------------------------------------------*
  *	usb_fifo_free_wrap

From owner-svn-src-head@FreeBSD.ORG  Wed Apr 21 21:57:03 2010
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id D26421065670;
	Wed, 21 Apr 2010 21:57:03 +0000 (UTC)
	(envelope-from jilles@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id A84E98FC21;
	Wed, 21 Apr 2010 21:57:03 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o3LLv3FI079659;
	Wed, 21 Apr 2010 21:57:03 GMT (envelope-from jilles@svn.freebsd.org)
Received: (from jilles@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o3LLv37P079657;
	Wed, 21 Apr 2010 21:57:03 GMT (envelope-from jilles@svn.freebsd.org)
Message-Id: <201004212157.o3LLv37P079657@svn.freebsd.org>
From: Jilles Tjoelker 
Date: Wed, 21 Apr 2010 21:57:03 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r207021 - head/bin/ln
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 21 Apr 2010 21:57:03 -0000

Author: jilles
Date: Wed Apr 21 21:57:03 2010
New Revision: 207021
URL: http://svn.freebsd.org/changeset/base/207021

Log:
  ln: Allow a trailing slash when creating a link to a directory.
  
  In the 'ln source... directory' synopsis, the basename of each source
  determines the name of the created link. Determine this using basename(3)
  instead of strrchr(..., '/') which is incorrect if the pathname ends in a
  slash.
  
  The patch is somewhat changed to allow for basename(3) implementations that
  change the passed pathname, and to fix the -w option's checking also.
  The code to compare directory entries only applies to hard links, which
  cannot be created to directories using ln.
  
  Example:
    ln -s /etc/defaults/ /tmp
  This should create a symlink named defaults.
  
  PR:		121568
  Submitted by:	Ighighi
  MFC after:	1 week

Modified:
  head/bin/ln/ln.c

Modified: head/bin/ln/ln.c
==============================================================================
--- head/bin/ln/ln.c	Wed Apr 21 21:51:14 2010	(r207020)
+++ head/bin/ln/ln.c	Wed Apr 21 21:57:03 2010	(r207021)
@@ -47,6 +47,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -226,6 +227,7 @@ linkit(const char *source, const char *t
 	int ch, exists, first;
 	char path[PATH_MAX];
 	char wbuf[PATH_MAX];
+	char bbuf[PATH_MAX];
 
 	if (!sflag) {
 		/* If source doesn't exist, quit now. */
@@ -248,11 +250,9 @@ linkit(const char *source, const char *t
 	if (isdir ||
 	    (lstat(target, &sb) == 0 && S_ISDIR(sb.st_mode)) ||
 	    (!hflag && stat(target, &sb) == 0 && S_ISDIR(sb.st_mode))) {
-		if ((p = strrchr(source, '/')) == NULL)
-			p = source;
-		else
-			++p;
-		if (snprintf(path, sizeof(path), "%s/%s", target, p) >=
+		if (strlcpy(bbuf, source, sizeof(bbuf)) >= sizeof(bbuf) ||
+		    (p = basename(bbuf)) == NULL ||
+		    snprintf(path, sizeof(path), "%s/%s", target, p) >=
 		    (ssize_t)sizeof(path)) {
 			errno = ENAMETOOLONG;
 			warn("%s", source);
@@ -276,15 +276,14 @@ linkit(const char *source, const char *t
 			 * absolute path of the source, by appending `source'
 			 * to the parent directory of the target.
 			 */
-			p = strrchr(target, '/');
-			if (p != NULL)
-				p++;
-			else
-				p = target;
-			(void)snprintf(wbuf, sizeof(wbuf), "%.*s%s",
-			    (int)(p - target), target, source);
-			if (stat(wbuf, &sb) != 0)
-				warn("warning: %s", source);
+			strlcpy(bbuf, target, sizeof(bbuf));
+			p = dirname(bbuf);
+			if (p != NULL) {
+				(void)snprintf(wbuf, sizeof(wbuf), "%s/%s",
+						p, source);
+				if (stat(wbuf, &sb) != 0)
+					warn("warning: %s", source);
+			}
 		}
 	}
 

From owner-svn-src-head@FreeBSD.ORG  Wed Apr 21 23:03:27 2010
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 09F0C106566C;
	Wed, 21 Apr 2010 23:03:27 +0000 (UTC)
	(envelope-from thompsa@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id EE65E8FC1D;
	Wed, 21 Apr 2010 23:03:26 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o3LN3Qvs094695;
	Wed, 21 Apr 2010 23:03:26 GMT (envelope-from thompsa@svn.freebsd.org)
Received: (from thompsa@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o3LN3QsF094693;
	Wed, 21 Apr 2010 23:03:26 GMT (envelope-from thompsa@svn.freebsd.org)
Message-Id: <201004212303.o3LN3QsF094693@svn.freebsd.org>
From: Andrew Thompson 
Date: Wed, 21 Apr 2010 23:03:26 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r207027 - head/sys/dev/usb
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 21 Apr 2010 23:03:27 -0000

Author: thompsa
Date: Wed Apr 21 23:03:26 2010
New Revision: 207027
URL: http://svn.freebsd.org/changeset/base/207027

Log:
  Also add the usb mode to the devd string as the usb controller can work in both
  host or device (gadget) modes.
  
  Suggested by:	HPS

Modified:
  head/sys/dev/usb/usb_device.c

Modified: head/sys/dev/usb/usb_device.c
==============================================================================
--- head/sys/dev/usb/usb_device.c	Wed Apr 21 22:34:49 2010	(r207026)
+++ head/sys/dev/usb/usb_device.c	Wed Apr 21 23:03:26 2010	(r207027)
@@ -2427,6 +2427,7 @@ usb_notify_addq(const char *type, struct
 	    "devsubclass=0x%02x "
 	    "sernum=\"%s\" "
 	    "release=0x%04x "
+	    "mode=%s "
 	    "port=%u "
 	    "parent=%s\n",
 	    udev->ugen_name,
@@ -2436,6 +2437,7 @@ usb_notify_addq(const char *type, struct
 	    udev->ddesc.bDeviceSubClass,
 	    udev->serial,
 	    UGETW(udev->ddesc.bcdDevice),
+	    (udev->flags.usb_mode == USB_MODE_HOST) ? "host" : "device",
 	    udev->port_no,
 	    udev->parent_hub != NULL ?
 	    udev->parent_hub->ugen_name :
@@ -2461,6 +2463,7 @@ usb_notify_addq(const char *type, struct
 		    "devsubclass=0x%02x "
 		    "sernum=\"%s\" "
 		    "release=0x%04x "
+		    "mode=%s "
 		    "interface=%d "
 		    "endpoints=%d "
 		    "intclass=0x%02x "
@@ -2473,6 +2476,7 @@ usb_notify_addq(const char *type, struct
 		    udev->ddesc.bDeviceSubClass,
 		    udev->serial,
 		    UGETW(udev->ddesc.bcdDevice),
+		    (udev->flags.usb_mode == USB_MODE_HOST) ? "host" : "device",
 		    iface->idesc->bInterfaceNumber,
 		    iface->idesc->bNumEndpoints,
 		    iface->idesc->bInterfaceClass,

From owner-svn-src-head@FreeBSD.ORG  Thu Apr 22 09:20:18 2010
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 8D3E2106564A;
	Thu, 22 Apr 2010 09:20:18 +0000 (UTC)
	(envelope-from netchild@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 7BE438FC0C;
	Thu, 22 Apr 2010 09:20:18 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o3M9KIUU032337;
	Thu, 22 Apr 2010 09:20:18 GMT
	(envelope-from netchild@svn.freebsd.org)
Received: (from netchild@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o3M9KICU032336;
	Thu, 22 Apr 2010 09:20:18 GMT
	(envelope-from netchild@svn.freebsd.org)
Message-Id: <201004220920.o3M9KICU032336@svn.freebsd.org>
From: Alexander Leidinger 
Date: Thu, 22 Apr 2010 09:20:17 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r207056 - in head: sys/conf usr.sbin/config
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 22 Apr 2010 09:20:18 -0000

Author: netchild
Date: Thu Apr 22 09:20:17 2010
New Revision: 207056
URL: http://svn.freebsd.org/changeset/base/207056

Log:
  Revert r206179 (by imp) and do something similar which is more consistent
  with all other corresponding CTF places by changing the corresponding
  code which is generated by config(8). Or in short, move the '@' from
  the variable definition to the use of the variable. [1]
  
  While I'm here break up a long line. [2]
  
  Discussed with:	imp [1,2], bde [2]

Modified:
  head/sys/conf/kern.pre.mk
  head/usr.sbin/config/mkmakefile.c

Modified: head/sys/conf/kern.pre.mk
==============================================================================
--- head/sys/conf/kern.pre.mk	Thu Apr 22 06:58:59 2010	(r207055)
+++ head/sys/conf/kern.pre.mk	Thu Apr 22 09:20:17 2010	(r207056)
@@ -128,7 +128,8 @@ NORMAL_C_NOWERROR= ${CC} -c ${CFLAGS} ${
 NORMAL_M= ${AWK} -f $S/tools/makeobjops.awk ${.IMPSRC} -c ; \
 	  ${CC} -c ${CFLAGS} ${WERROR} ${PROF} ${.PREFIX}.c
 
-NORMAL_CTFCONVERT= @[ -z "${CTFCONVERT}" -o -n "${NO_CTF}" ] || ${CTFCONVERT} ${CTFFLAGS} ${.TARGET}
+NORMAL_CTFCONVERT= [ -z "${CTFCONVERT}" -o -n "${NO_CTF}" ] || \
+		   ${CTFCONVERT} ${CTFFLAGS} ${.TARGET}
 
 NORMAL_LINT=	${LINT} ${LINTFLAGS} ${CFLAGS:M-[DIU]*} ${.IMPSRC}
 

Modified: head/usr.sbin/config/mkmakefile.c
==============================================================================
--- head/usr.sbin/config/mkmakefile.c	Thu Apr 22 06:58:59 2010	(r207055)
+++ head/usr.sbin/config/mkmakefile.c	Thu Apr 22 09:20:17 2010	(r207056)
@@ -741,7 +741,7 @@ do_rules(FILE *f)
 				printf("config: don't know rules for %s\n", np);
 				break;
 			}
-			snprintf(cmd, sizeof(cmd), "${%s_%c%s}\n.if defined(NORMAL_CTFCONVERT) && !empty(NORMAL_CTFCONVERT)\n\t${NORMAL_CTFCONVERT}\n.endif", ftype,
+			snprintf(cmd, sizeof(cmd), "${%s_%c%s}\n\t@${NORMAL_CTFCONVERT}", ftype,
 			    toupper(och),
 			    ftp->f_flags & NOWERROR ? "_NOWERROR" : "");
 			compilewith = cmd;

From owner-svn-src-head@FreeBSD.ORG  Thu Apr 22 09:24:01 2010
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id D073A1065677;
	Thu, 22 Apr 2010 09:24:01 +0000 (UTC)
	(envelope-from netchild@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id BFB518FC0A;
	Thu, 22 Apr 2010 09:24:01 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o3M9O19V033163;
	Thu, 22 Apr 2010 09:24:01 GMT
	(envelope-from netchild@svn.freebsd.org)
Received: (from netchild@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o3M9O1a4033162;
	Thu, 22 Apr 2010 09:24:01 GMT
	(envelope-from netchild@svn.freebsd.org)
Message-Id: <201004220924.o3M9O1a4033162@svn.freebsd.org>
From: Alexander Leidinger 
Date: Thu, 22 Apr 2010 09:24:01 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r207057 - head/sys/conf
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 22 Apr 2010 09:24:01 -0000

Author: netchild
Date: Thu Apr 22 09:24:01 2010
New Revision: 207057
URL: http://svn.freebsd.org/changeset/base/207057

Log:
  Do the ctfmerge (= all symbols, not only symbols from one object file) for
  KLDs too.
  
  Noticed by:	np

Modified:
  head/sys/conf/kmod.mk

Modified: head/sys/conf/kmod.mk
==============================================================================
--- head/sys/conf/kmod.mk	Thu Apr 22 09:20:17 2010	(r207056)
+++ head/sys/conf/kmod.mk	Thu Apr 22 09:24:01 2010	(r207057)
@@ -137,6 +137,10 @@ CFLAGS+=	-mlongcall -fno-omit-frame-poin
 CFLAGS+=	-G0 -fno-pic -mno-abicalls -mlong-calls
 .endif
 
+.if defined(DEBUG) || defined(DEBUG_FLAGS)
+CTFFLAGS+=	-g
+.endif
+
 .if defined(FIRMWS)
 .if !exists(@)
 ${KMOD:S/$/.c/}: @
@@ -202,6 +206,7 @@ ${KMOD}.kld: ${OBJS}
 ${FULLPROG}: ${OBJS}
 .endif
 	${LD} ${LDFLAGS} -r -d -o ${.TARGET} ${OBJS}
+	@[ -z "${CTFMERGE}" -o -n "${NO_CTF}" ] || ${CTFMERGE} ${CTFFLAGS} -o ${.TARGET} ${OBJS}
 .if defined(EXPORT_SYMS)
 .if ${EXPORT_SYMS} != YES
 .if ${EXPORT_SYMS} == NO

From owner-svn-src-head@FreeBSD.ORG  Thu Apr 22 09:30:03 2010
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 011D91065670;
	Thu, 22 Apr 2010 09:30:03 +0000 (UTC)
	(envelope-from netchild@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id E46E28FC1A;
	Thu, 22 Apr 2010 09:30:02 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o3M9U2mo034502;
	Thu, 22 Apr 2010 09:30:02 GMT
	(envelope-from netchild@svn.freebsd.org)
Received: (from netchild@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o3M9U2GS034500;
	Thu, 22 Apr 2010 09:30:02 GMT
	(envelope-from netchild@svn.freebsd.org)
Message-Id: <201004220930.o3M9U2GS034500@svn.freebsd.org>
From: Alexander Leidinger 
Date: Thu, 22 Apr 2010 09:30:02 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r207058 - head
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 22 Apr 2010 09:30:03 -0000

Author: netchild
Date: Thu Apr 22 09:30:02 2010
New Revision: 207058
URL: http://svn.freebsd.org/changeset/base/207058

Log:
  Remove explicit setting of NO_CTF in WMAKEENV and in the make call for
  the buildkernel. This way makeoptions WITH_CTF=yes not only works when
  compiling the tradtitional way, but also when using buildkernel. This
  does not enable the CTF part of the world, it still defaults to without
  CTF info.
  
  The cross/build-tools/bootstrap targets are not affected by this, they
  still have and should keep the explicit NO_CTF.
  
  Notified by:	np

Modified:
  head/Makefile.inc1

Modified: head/Makefile.inc1
==============================================================================
--- head/Makefile.inc1	Thu Apr 22 09:24:01 2010	(r207057)
+++ head/Makefile.inc1	Thu Apr 22 09:30:02 2010	(r207058)
@@ -259,7 +259,7 @@ WMAKEENV=	${CROSSENV} \
 		VERSION="${VERSION}" \
 		INSTALL="sh ${.CURDIR}/tools/install.sh" \
 		PATH=${TMPPATH}
-.if ${MK_CDDL} == "no" || defined(NO_CTF)
+.if ${MK_CDDL} == "no"
 WMAKEENV+=	NO_CTF=1
 .endif
 WMAKE=		${WMAKEENV} ${MAKE} -f Makefile.inc1 DESTDIR=${WORLDTMP}
@@ -780,7 +780,7 @@ buildkernel:
 	@echo "--------------------------------------------------------------"
 	cd ${KRNLOBJDIR}/${_kernel}; \
 	    MAKESRCPATH=${KERNSRCDIR}/dev/aic7xxx/aicasm \
-	    ${MAKE} SSP_CFLAGS= -DNO_CPU_CFLAGS -DNO_CTF \
+	    ${MAKE} SSP_CFLAGS= -DNO_CPU_CFLAGS \
 	    -f ${KERNSRCDIR}/dev/aic7xxx/aicasm/Makefile
 # XXX - Gratuitously builds aicasm in the ``makeoptions NO_MODULES'' case.
 .if !defined(MODULES_WITH_WORLD) && !defined(NO_MODULES) && exists(${KERNSRCDIR}/modules)

From owner-svn-src-head@FreeBSD.ORG  Thu Apr 22 18:21:26 2010
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 1E7A7106564A;
	Thu, 22 Apr 2010 18:21:26 +0000 (UTC)
	(envelope-from rnoland@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 0BF898FC21;
	Thu, 22 Apr 2010 18:21:26 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o3MILQpl054565;
	Thu, 22 Apr 2010 18:21:26 GMT (envelope-from rnoland@svn.freebsd.org)
Received: (from rnoland@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o3MILP0q054543;
	Thu, 22 Apr 2010 18:21:25 GMT (envelope-from rnoland@svn.freebsd.org)
Message-Id: <201004221821.o3MILP0q054543@svn.freebsd.org>
From: Robert Noland 
Date: Thu, 22 Apr 2010 18:21:25 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r207066 - head/sys/dev/drm
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 22 Apr 2010 18:21:26 -0000

Author: rnoland
Date: Thu Apr 22 18:21:25 2010
New Revision: 207066
URL: http://svn.freebsd.org/changeset/base/207066

Log:
  Rework how drm maps are handled.
  
   * On 32 bit platforms we steal the upper 4 bits of the map handle
     to store a unique map id.
   * On 64 bit platforms we steal the upper 24 bits.
  
  Resolves issues where the offsets that are handed to mmap may overlap the VRAM on some cards.
  
  Tested on: radeon, intel, mga, and via.
  
  This will break nouveau.  I will spin new patches shortly.

Modified:
  head/sys/dev/drm/drmP.h
  head/sys/dev/drm/drm_bufs.c
  head/sys/dev/drm/drm_context.c
  head/sys/dev/drm/drm_drv.c
  head/sys/dev/drm/drm_memory.c
  head/sys/dev/drm/drm_scatter.c
  head/sys/dev/drm/drm_sysctl.c
  head/sys/dev/drm/drm_vm.c
  head/sys/dev/drm/i915_dma.c
  head/sys/dev/drm/mach64_dma.c
  head/sys/dev/drm/mga_dma.c
  head/sys/dev/drm/mga_warp.c
  head/sys/dev/drm/r128_cce.c
  head/sys/dev/drm/r128_state.c
  head/sys/dev/drm/r600_blit.c
  head/sys/dev/drm/r600_cp.c
  head/sys/dev/drm/radeon_cp.c
  head/sys/dev/drm/radeon_cs.c
  head/sys/dev/drm/radeon_state.c
  head/sys/dev/drm/savage_bci.c
  head/sys/dev/drm/via_dma.c
  head/sys/dev/drm/via_map.c
  head/sys/dev/drm/via_mm.c

Modified: head/sys/dev/drm/drmP.h
==============================================================================
--- head/sys/dev/drm/drmP.h	Thu Apr 22 14:54:54 2010	(r207065)
+++ head/sys/dev/drm/drmP.h	Thu Apr 22 18:21:25 2010	(r207066)
@@ -239,22 +239,22 @@ typedef u_int8_t u8;
 #define DRM_MEMORYBARRIER()		mb()
 
 #define DRM_READ8(map, offset)						\
-	*(volatile u_int8_t *)(((vm_offset_t)(map)->handle) +		\
+	*(volatile u_int8_t *)(((vm_offset_t)(map)->virtual) +		\
 	    (vm_offset_t)(offset))
 #define DRM_READ16(map, offset)						\
-	*(volatile u_int16_t *)(((vm_offset_t)(map)->handle) +		\
+	*(volatile u_int16_t *)(((vm_offset_t)(map)->virtual) +		\
 	    (vm_offset_t)(offset))
 #define DRM_READ32(map, offset)						\
-	*(volatile u_int32_t *)(((vm_offset_t)(map)->handle) +		\
+	*(volatile u_int32_t *)(((vm_offset_t)(map)->virtual) +		\
 	    (vm_offset_t)(offset))
 #define DRM_WRITE8(map, offset, val)					\
-	*(volatile u_int8_t *)(((vm_offset_t)(map)->handle) +		\
+	*(volatile u_int8_t *)(((vm_offset_t)(map)->virtual) +		\
 	    (vm_offset_t)(offset)) = val
 #define DRM_WRITE16(map, offset, val)					\
-	*(volatile u_int16_t *)(((vm_offset_t)(map)->handle) +		\
+	*(volatile u_int16_t *)(((vm_offset_t)(map)->virtual) +		\
 	    (vm_offset_t)(offset)) = val
 #define DRM_WRITE32(map, offset, val)					\
-	*(volatile u_int32_t *)(((vm_offset_t)(map)->handle) +		\
+	*(volatile u_int32_t *)(((vm_offset_t)(map)->virtual) +		\
 	    (vm_offset_t)(offset)) = val
 
 #define DRM_VERIFYAREA_READ( uaddr, size )		\
@@ -481,18 +481,21 @@ typedef struct drm_sg_mem {
 	struct drm_dma_handle	 *dmah;		/* Handle to PCI memory  */
 } drm_sg_mem_t;
 
+#define DRM_MAP_HANDLE_BITS	(sizeof(void *) == 4 ? 4 : 24)
+#define DRM_MAP_HANDLE_SHIFT	(sizeof(void *) * 8 - DRM_MAP_HANDLE_BITS)
 typedef TAILQ_HEAD(drm_map_list, drm_local_map) drm_map_list_t;
 
 typedef struct drm_local_map {
-	unsigned long	offset;	 /* Physical address (0 for SAREA)*/
-	unsigned long	size;	 /* Physical size (bytes)	    */
-	enum drm_map_type	type;	 /* Type of memory mapped		    */
-	enum drm_map_flags	flags;	 /* Flags				    */
-	void		*handle; /* User-space: "Handle" to pass to mmap    */
-				 /* Kernel-space: kernel-virtual address    */
-	int		mtrr;	 /* Boolean: MTRR used */
-				 /* Private data			    */
-	int		rid;	 /* PCI resource ID for bus_space */
+	unsigned long offset;	  /* Physical address (0 for SAREA)       */
+	unsigned long size;	  /* Physical size (bytes)                */
+	enum drm_map_type type;	  /* Type of memory mapped                */
+	enum drm_map_flags flags; /* Flags                                */
+	void *handle;		  /* User-space: "Handle" to pass to mmap */
+				  /* Kernel-space: kernel-virtual address */
+	int mtrr;		  /* Boolean: MTRR used                   */
+				  /* Private data                         */
+	int rid;		  /* PCI resource ID for bus_space        */
+	void *virtual;		  /* Kernel-space: kernel-virtual address */
 	struct resource *bsr;
 	bus_space_tag_t bst;
 	bus_space_handle_t bsh;
@@ -643,6 +646,7 @@ struct drm_device {
 
 	/* Linked list of mappable regions. Protected by dev_lock */
 	drm_map_list_t	  maplist;
+	struct unrhdr	  *map_unrhdr;
 
 	drm_local_map_t	  **context_sareas;
 	int		  max_context;
@@ -973,17 +977,17 @@ drm_free(void *pt, size_t size, struct m
 static __inline__ void
 drm_core_ioremap_wc(struct drm_local_map *map, struct drm_device *dev)
 {
-	map->handle = drm_ioremap_wc(dev, map);
+	map->virtual = drm_ioremap_wc(dev, map);
 }
 static __inline__ void
 drm_core_ioremap(struct drm_local_map *map, struct drm_device *dev)
 {
-	map->handle = drm_ioremap(dev, map);
+	map->virtual = drm_ioremap(dev, map);
 }
 static __inline__ void
 drm_core_ioremapfree(struct drm_local_map *map, struct drm_device *dev)
 {
-	if ( map->handle && map->size )
+	if ( map->virtual && map->size )
 		drm_ioremapfree(map);
 }
 
@@ -994,7 +998,7 @@ drm_core_findmap(struct drm_device *dev,
 
 	DRM_SPINLOCK_ASSERT(&dev->dev_lock);
 	TAILQ_FOREACH(map, &dev->maplist, link) {
-		if (map->offset == offset)
+		if (offset == (unsigned long)map->handle)
 			return map;
 	}
 	return NULL;

Modified: head/sys/dev/drm/drm_bufs.c
==============================================================================
--- head/sys/dev/drm/drm_bufs.c	Thu Apr 22 14:54:54 2010	(r207065)
+++ head/sys/dev/drm/drm_bufs.c	Thu Apr 22 18:21:25 2010	(r207066)
@@ -156,10 +156,12 @@ int drm_addmap(struct drm_device * dev, 
 	map->size = size;
 	map->type = type;
 	map->flags = flags;
+	map->handle = (void *)((unsigned long)alloc_unr(dev->map_unrhdr) <<
+	    DRM_MAP_HANDLE_SHIFT);
 
 	switch (map->type) {
 	case _DRM_REGISTERS:
-		map->handle = drm_ioremap(dev, map);
+		map->virtual = drm_ioremap(dev, map);
 		if (!(map->flags & _DRM_WRITE_COMBINING))
 			break;
 		/* FALLTHROUGH */
@@ -168,25 +170,25 @@ int drm_addmap(struct drm_device * dev, 
 			map->mtrr = 1;
 		break;
 	case _DRM_SHM:
-		map->handle = malloc(map->size, DRM_MEM_MAPS, M_NOWAIT);
+		map->virtual = malloc(map->size, DRM_MEM_MAPS, M_NOWAIT);
 		DRM_DEBUG("%lu %d %p\n",
-		    map->size, drm_order(map->size), map->handle);
-		if (!map->handle) {
+		    map->size, drm_order(map->size), map->virtual);
+		if (!map->virtual) {
 			free(map, DRM_MEM_MAPS);
 			DRM_LOCK();
 			return ENOMEM;
 		}
-		map->offset = (unsigned long)map->handle;
+		map->offset = (unsigned long)map->virtual;
 		if (map->flags & _DRM_CONTAINS_LOCK) {
 			/* Prevent a 2nd X Server from creating a 2nd lock */
 			DRM_LOCK();
 			if (dev->lock.hw_lock != NULL) {
 				DRM_UNLOCK();
-				free(map->handle, DRM_MEM_MAPS);
+				free(map->virtual, DRM_MEM_MAPS);
 				free(map, DRM_MEM_MAPS);
 				return EBUSY;
 			}
-			dev->lock.hw_lock = map->handle; /* Pointer to lock */
+			dev->lock.hw_lock = map->virtual; /* Pointer to lock */
 			DRM_UNLOCK();
 		}
 		break;
@@ -224,7 +226,8 @@ int drm_addmap(struct drm_device * dev, 
 			DRM_LOCK();
 			return EINVAL;
 		}
-		map->offset += dev->sg->handle;
+		map->virtual = (void *)(dev->sg->handle + offset);
+		map->offset = dev->sg->handle + offset;
 		break;
 	case _DRM_CONSISTENT:
 		/* Unfortunately, we don't get any alignment specification from
@@ -242,7 +245,7 @@ int drm_addmap(struct drm_device * dev, 
 			DRM_LOCK();
 			return ENOMEM;
 		}
-		map->handle = map->dmah->vaddr;
+		map->virtual = map->dmah->vaddr;
 		map->offset = map->dmah->busaddr;
 		break;
 	default:
@@ -291,11 +294,7 @@ int drm_addmap_ioctl(struct drm_device *
 	request->type = map->type;
 	request->flags = map->flags;
 	request->mtrr   = map->mtrr;
-	request->handle = map->handle;
-
-	if (request->type != _DRM_SHM) {
-		request->handle = (void *)request->offset;
-	}
+	request->handle = (void *)map->handle;
 
 	return 0;
 }
@@ -324,7 +323,7 @@ void drm_rmmap(struct drm_device *dev, d
 		}
 		break;
 	case _DRM_SHM:
-		free(map->handle, DRM_MEM_MAPS);
+		free(map->virtual, DRM_MEM_MAPS);
 		break;
 	case _DRM_AGP:
 	case _DRM_SCATTER_GATHER:
@@ -342,6 +341,12 @@ void drm_rmmap(struct drm_device *dev, d
 		    map->bsr);
 	}
 
+	DRM_UNLOCK();
+	if (map->handle)
+		free_unr(dev->map_unrhdr, (unsigned long)map->handle >>
+		    DRM_MAP_HANDLE_SHIFT);
+	DRM_LOCK();
+
 	free(map, DRM_MEM_MAPS);
 }
 
@@ -1054,7 +1059,7 @@ int drm_mapbufs(struct drm_device *dev, 
 			goto done;
 		}
 		size = round_page(map->size);
-		foff = map->offset;
+		foff = (unsigned long)map->handle;
 	} else {
 		size = round_page(dma->byte_count),
 		foff = 0;

Modified: head/sys/dev/drm/drm_context.c
==============================================================================
--- head/sys/dev/drm/drm_context.c	Thu Apr 22 14:54:54 2010	(r207065)
+++ head/sys/dev/drm/drm_context.c	Thu Apr 22 18:21:25 2010	(r207066)
@@ -147,7 +147,7 @@ int drm_getsareactx(struct drm_device *d
 	map = dev->context_sareas[request->ctx_id];
 	DRM_UNLOCK();
 
-	request->handle = map->handle;
+	request->handle = (void *)map->handle;
 
 	return 0;
 }

Modified: head/sys/dev/drm/drm_drv.c
==============================================================================
--- head/sys/dev/drm/drm_drv.c	Thu Apr 22 14:54:54 2010	(r207065)
+++ head/sys/dev/drm/drm_drv.c	Thu Apr 22 18:21:25 2010	(r207066)
@@ -434,6 +434,12 @@ static int drm_load(struct drm_device *d
 	DRM_DEBUG("\n");
 
 	TAILQ_INIT(&dev->maplist);
+	dev->map_unrhdr = new_unrhdr(1, ((1 << DRM_MAP_HANDLE_BITS) - 1), NULL);
+	if (dev->map_unrhdr == NULL) {
+		DRM_ERROR("Couldn't allocate map number allocator\n");
+		return EINVAL;
+	}
+
 
 	drm_mem_init();
 	drm_sysctl_init(dev);
@@ -565,6 +571,7 @@ static void drm_unload(struct drm_device
 	}
 
 	delete_unrhdr(dev->drw_unrhdr);
+	delete_unrhdr(dev->map_unrhdr);
 
 	drm_mem_uninit();
 

Modified: head/sys/dev/drm/drm_memory.c
==============================================================================
--- head/sys/dev/drm/drm_memory.c	Thu Apr 22 14:54:54 2010	(r207065)
+++ head/sys/dev/drm/drm_memory.c	Thu Apr 22 18:21:25 2010	(r207066)
@@ -83,7 +83,7 @@ void *drm_ioremap(struct drm_device *dev
 
 void drm_ioremapfree(drm_local_map_t *map)
 {
-	pmap_unmapdev((vm_offset_t) map->handle, map->size);
+	pmap_unmapdev((vm_offset_t) map->virtual, map->size);
 }
 
 int

Modified: head/sys/dev/drm/drm_scatter.c
==============================================================================
--- head/sys/dev/drm/drm_scatter.c	Thu Apr 22 14:54:54 2010	(r207065)
+++ head/sys/dev/drm/drm_scatter.c	Thu Apr 22 18:21:25 2010	(r207066)
@@ -100,11 +100,14 @@ drm_sg_alloc(struct drm_device *dev, str
 	dev->sg = entry;
 	DRM_UNLOCK();
 
-	DRM_DEBUG("handle=%08lx, kva=%p, contents=%08lx\n", entry->handle,
-	    entry->virtual, *(unsigned long *)entry->virtual);
+	pmap_change_attr((vm_offset_t)dmah->vaddr, request->size,
+	    PAT_WRITE_COMBINING);
 
 	request->handle = entry->handle;
 
+	DRM_DEBUG("handle=%08lx, kva=%p, contents=%08lx\n", entry->handle,
+	    entry->virtual, *(unsigned long *)entry->virtual);
+
 	return 0;
 }
 

Modified: head/sys/dev/drm/drm_sysctl.c
==============================================================================
--- head/sys/dev/drm/drm_sysctl.c	Thu Apr 22 14:54:54 2010	(r207065)
+++ head/sys/dev/drm/drm_sysctl.c	Thu Apr 22 18:21:25 2010	(r207066)
@@ -188,7 +188,7 @@ static int drm_vm_info DRM_SYSCTL_HANDLE
 	DRM_UNLOCK();
 
 	DRM_SYSCTL_PRINT("\nslot offset	        size       "
-	    "type flags address            mtrr\n");
+	    "type flags address            handle mtrr\n");
 
 	for (i = 0; i < mapcount; i++) {
 		map = &tempmaps[i];
@@ -204,9 +204,11 @@ static int drm_vm_info DRM_SYSCTL_HANDLE
 			yesno = "yes";
 
 		DRM_SYSCTL_PRINT(
-		    "%4d 0x%016lx 0x%08lx %4.4s  0x%02x 0x%016lx %s\n", i,
-		    map->offset, map->size, type, map->flags,
-		    (unsigned long)map->handle, yesno);
+		    "%4d 0x%016lx 0x%08lx %4.4s  0x%02x 0x%016lx %6d %s\n",
+		    i, map->offset, map->size, type, map->flags,
+		    (unsigned long)map->virtual,
+		    (unsigned int)((unsigned long)map->handle >>
+		    DRM_MAP_HANDLE_SHIFT), yesno);
 	}
 	SYSCTL_OUT(req, "", 1);
 

Modified: head/sys/dev/drm/drm_vm.c
==============================================================================
--- head/sys/dev/drm/drm_vm.c	Thu Apr 22 14:54:54 2010	(r207065)
+++ head/sys/dev/drm/drm_vm.c	Thu Apr 22 18:21:25 2010	(r207066)
@@ -54,6 +54,7 @@ int drm_mmap(struct cdev *kdev, vm_ooffs
 	if (file_priv && !file_priv->authenticated)
 		return EACCES;
 
+	DRM_DEBUG("called with offset %016jx\n", offset);
 	if (dev->dma && offset < ptoa(dev->dma->page_count)) {
 		drm_device_dma_t *dma = dev->dma;
 
@@ -72,31 +73,31 @@ int drm_mmap(struct cdev *kdev, vm_ooffs
 		}
 	}
 
-				/* A sequential search of a linked list is
-				   fine here because: 1) there will only be
-				   about 5-10 entries in the list and, 2) a
-				   DRI client only has to do this mapping
-				   once, so it doesn't have to be optimized
-				   for performance, even if the list was a
-				   bit longer. */
+	/* A sequential search of a linked list is
+	   fine here because: 1) there will only be
+	   about 5-10 entries in the list and, 2) a
+	   DRI client only has to do this mapping
+	   once, so it doesn't have to be optimized
+	   for performance, even if the list was a
+	   bit longer.
+	*/
 	DRM_LOCK();
 	TAILQ_FOREACH(map, &dev->maplist, link) {
-		if (offset >= map->offset && offset < map->offset + map->size)
+		if (offset >> DRM_MAP_HANDLE_SHIFT ==
+		    (unsigned long)map->handle >> DRM_MAP_HANDLE_SHIFT)
 			break;
 	}
 
 	if (map == NULL) {
-		DRM_DEBUG("Can't find map, requested offset = %016lx\n",
-		    (unsigned long)offset);
+		DRM_DEBUG("Can't find map, request offset = %016jx\n", offset);
 		TAILQ_FOREACH(map, &dev->maplist, link) {
 			DRM_DEBUG("map offset = %016lx, handle = %016lx\n",
-			    (unsigned long)map->offset,
-			    (unsigned long)map->handle);
+			    map->offset, (unsigned long)map->handle);
 		}
 		DRM_UNLOCK();
 		return -1;
 	}
-	if (((map->flags&_DRM_RESTRICTED) && !DRM_SUSER(DRM_CURPROC))) {
+	if (((map->flags & _DRM_RESTRICTED) && !DRM_SUSER(DRM_CURPROC))) {
 		DRM_UNLOCK();
 		DRM_DEBUG("restricted map\n");
 		return -1;
@@ -104,18 +105,22 @@ int drm_mmap(struct cdev *kdev, vm_ooffs
 	type = map->type;
 	DRM_UNLOCK();
 
+	offset = offset & ((1ULL << DRM_MAP_HANDLE_SHIFT) - 1);
+
 	switch (type) {
 	case _DRM_FRAME_BUFFER:
-	case _DRM_REGISTERS:
 	case _DRM_AGP:
-		phys = offset;
-		break;
-	case _DRM_CONSISTENT:
-		phys = vtophys((char *)map->handle + (offset - map->offset));
+		*memattr = VM_MEMATTR_WRITE_COMBINING;
+		/* FALLTHROUGH */
+	case _DRM_REGISTERS:
+		phys = map->offset + offset;
 		break;
 	case _DRM_SCATTER_GATHER:
+		*memattr = VM_MEMATTR_WRITE_COMBINING;
+		/* FALLTHROUGH */
+	case _DRM_CONSISTENT:
 	case _DRM_SHM:
-		phys = vtophys(offset);
+		phys = vtophys((char *)map->virtual + offset);
 		break;
 	default:
 		DRM_ERROR("bad map type %d\n", type);

Modified: head/sys/dev/drm/i915_dma.c
==============================================================================
--- head/sys/dev/drm/i915_dma.c	Thu Apr 22 14:54:54 2010	(r207065)
+++ head/sys/dev/drm/i915_dma.c	Thu Apr 22 18:21:25 2010	(r207066)
@@ -151,7 +151,7 @@ static int i915_dma_cleanup(struct drm_d
 	if (dev_priv->ring.virtual_start) {
 		drm_core_ioremapfree(&dev_priv->ring.map, dev);
 		dev_priv->ring.virtual_start = NULL;
-		dev_priv->ring.map.handle = NULL;
+		dev_priv->ring.map.virtual = NULL;
 		dev_priv->ring.map.size = 0;
 	}
 
@@ -174,7 +174,7 @@ static int i915_initialize(struct drm_de
 	}
 
 	dev_priv->sarea_priv = (drm_i915_sarea_t *)
-	    ((u8 *) dev_priv->sarea->handle + init->sarea_priv_offset);
+	    ((u8 *) dev_priv->sarea->virtual + init->sarea_priv_offset);
 
 	if (init->ring_size != 0) {
 		if (dev_priv->ring.ring_obj != NULL) {
@@ -195,7 +195,7 @@ static int i915_initialize(struct drm_de
 
 		drm_core_ioremap_wc(&dev_priv->ring.map, dev);
 
-		if (dev_priv->ring.map.handle == NULL) {
+		if (dev_priv->ring.map.virtual == NULL) {
 			i915_dma_cleanup(dev);
 			DRM_ERROR("can not ioremap virtual address for"
 				  " ring buffer\n");
@@ -203,7 +203,7 @@ static int i915_initialize(struct drm_de
 		}
 	}
 
-	dev_priv->ring.virtual_start = dev_priv->ring.map.handle;
+	dev_priv->ring.virtual_start = dev_priv->ring.map.virtual;
 
 	dev_priv->cpp = init->cpp;
 	dev_priv->back_offset = init->back_offset;
@@ -229,7 +229,7 @@ static int i915_dma_resume(struct drm_de
 		return -EINVAL;
 	}
 
-	if (dev_priv->ring.map.handle == NULL) {
+	if (dev_priv->ring.map.virtual == NULL) {
 		DRM_ERROR("can not ioremap virtual address for"
 			  " ring buffer\n");
 		return -ENOMEM;
@@ -823,14 +823,14 @@ static int i915_set_status_page(struct d
 	dev_priv->hws_map.mtrr = 0;
 
 	drm_core_ioremap_wc(&dev_priv->hws_map, dev);
-	if (dev_priv->hws_map.handle == NULL) {
+	if (dev_priv->hws_map.virtual == NULL) {
 		i915_dma_cleanup(dev);
 		dev_priv->status_gfx_addr = 0;
 		DRM_ERROR("can not ioremap virtual address for"
 				" G33 hw status page\n");
 		return -ENOMEM;
 	}
-	dev_priv->hw_status_page = dev_priv->hws_map.handle;
+	dev_priv->hw_status_page = dev_priv->hws_map.virtual;
 
 	memset(dev_priv->hw_status_page, 0, PAGE_SIZE);
 	I915_WRITE(HWS_PGA, dev_priv->status_gfx_addr);

Modified: head/sys/dev/drm/mach64_dma.c
==============================================================================
--- head/sys/dev/drm/mach64_dma.c	Thu Apr 22 14:54:54 2010	(r207065)
+++ head/sys/dev/drm/mach64_dma.c	Thu Apr 22 18:21:25 2010	(r207066)
@@ -1078,11 +1078,11 @@ static int mach64_do_dma_init(struct drm
 	}
 
 	dev_priv->sarea_priv = (drm_mach64_sarea_t *)
-	    ((u8 *) dev_priv->sarea->handle + init->sarea_priv_offset);
+	    ((u8 *) dev_priv->sarea->virtual + init->sarea_priv_offset);
 
 	if (!dev_priv->is_pci) {
 		drm_core_ioremap(dev_priv->ring_map, dev);
-		if (!dev_priv->ring_map->handle) {
+		if (!dev_priv->ring_map->virtual) {
 			DRM_ERROR("can not ioremap virtual address for"
 				  " descriptor ring\n");
 			dev->dev_private = (void *)dev_priv;
@@ -1103,7 +1103,7 @@ static int mach64_do_dma_init(struct drm
 		dev_priv->dev_buffers = dev->agp_buffer_map;
 
 		drm_core_ioremap(dev->agp_buffer_map, dev);
-		if (!dev->agp_buffer_map->handle) {
+		if (!dev->agp_buffer_map->virtual) {
 			DRM_ERROR("can not ioremap virtual address for"
 				  " dma buffer\n");
 			dev->dev_private = (void *)dev_priv;
@@ -1147,7 +1147,7 @@ static int mach64_do_dma_init(struct drm
 	}
 
 	dev_priv->ring.size = 0x4000;	/* 16KB */
-	dev_priv->ring.start = dev_priv->ring_map->handle;
+	dev_priv->ring.start = dev_priv->ring_map->virtual;
 	dev_priv->ring.start_addr = (u32) dev_priv->ring_map->offset;
 
 	memset(dev_priv->ring.start, 0, dev_priv->ring.size);

Modified: head/sys/dev/drm/mga_dma.c
==============================================================================
--- head/sys/dev/drm/mga_dma.c	Thu Apr 22 14:54:54 2010	(r207065)
+++ head/sys/dev/drm/mga_dma.c	Thu Apr 22 18:21:25 2010	(r207066)
@@ -585,11 +585,11 @@ static int mga_do_agp_dma_bootstrap(stru
 	drm_core_ioremap(dev_priv->primary, dev);
 	drm_core_ioremap(dev->agp_buffer_map, dev);
 
-	if (!dev_priv->warp->handle ||
-	    !dev_priv->primary->handle || !dev->agp_buffer_map->handle) {
+	if (!dev_priv->warp->virtual ||
+	    !dev_priv->primary->virtual || !dev->agp_buffer_map->virtual) {
 		DRM_ERROR("failed to ioremap agp regions! (%p, %p, %p)\n",
-			  dev_priv->warp->handle, dev_priv->primary->handle,
-			  dev->agp_buffer_map->handle);
+			  dev_priv->warp->virtual, dev_priv->primary->virtual,
+			  dev->agp_buffer_map->virtual);
 		return -ENOMEM;
 	}
 
@@ -878,14 +878,14 @@ static int mga_do_init_dma(struct drm_de
 	}
 
 	dev_priv->sarea_priv =
-	    (drm_mga_sarea_t *) ((u8 *) dev_priv->sarea->handle +
+	    (drm_mga_sarea_t *) ((u8 *) dev_priv->sarea->virtual +
 				 init->sarea_priv_offset);
 
-	if (!dev_priv->warp->handle ||
-	    !dev_priv->primary->handle ||
+	if (!dev_priv->warp->virtual ||
+	    !dev_priv->primary->virtual ||
 	    ((dev_priv->dma_access != 0) &&
 	     ((dev->agp_buffer_map == NULL) ||
-	      (dev->agp_buffer_map->handle == NULL)))) {
+	      (dev->agp_buffer_map->virtual == NULL)))) {
 		DRM_ERROR("failed to ioremap agp regions!\n");
 		return -ENOMEM;
 	}
@@ -902,7 +902,7 @@ static int mga_do_init_dma(struct drm_de
 		return ret;
 	}
 
-	dev_priv->prim.status = (u32 *) dev_priv->status->handle;
+	dev_priv->prim.status = (u32 *) dev_priv->status->virtual;
 
 	mga_do_wait_for_idle(dev_priv);
 
@@ -910,8 +910,8 @@ static int mga_do_init_dma(struct drm_de
 	 */
 	MGA_WRITE(MGA_PRIMADDRESS, dev_priv->primary->offset | MGA_DMA_GENERAL);
 
-	dev_priv->prim.start = (u8 *) dev_priv->primary->handle;
-	dev_priv->prim.end = ((u8 *) dev_priv->primary->handle
+	dev_priv->prim.start = (u8 *) dev_priv->primary->virtual;
+	dev_priv->prim.end = ((u8 *) dev_priv->primary->virtual
 			      + dev_priv->primary->size);
 	dev_priv->prim.size = dev_priv->primary->size;
 

Modified: head/sys/dev/drm/mga_warp.c
==============================================================================
--- head/sys/dev/drm/mga_warp.c	Thu Apr 22 14:54:54 2010	(r207065)
+++ head/sys/dev/drm/mga_warp.c	Thu Apr 22 18:21:25 2010	(r207066)
@@ -96,7 +96,7 @@ unsigned int mga_warp_microcode_size(con
 
 static int mga_warp_install_g400_microcode(drm_mga_private_t * dev_priv)
 {
-	unsigned char *vcbase = dev_priv->warp->handle;
+	unsigned char *vcbase = dev_priv->warp->virtual;
 	unsigned long pcbase = dev_priv->warp->offset;
 
 	memset(dev_priv->warp_pipe_phys, 0, sizeof(dev_priv->warp_pipe_phys));
@@ -124,7 +124,7 @@ static int mga_warp_install_g400_microco
 
 static int mga_warp_install_g200_microcode(drm_mga_private_t * dev_priv)
 {
-	unsigned char *vcbase = dev_priv->warp->handle;
+	unsigned char *vcbase = dev_priv->warp->virtual;
 	unsigned long pcbase = dev_priv->warp->offset;
 
 	memset(dev_priv->warp_pipe_phys, 0, sizeof(dev_priv->warp_pipe_phys));

Modified: head/sys/dev/drm/r128_cce.c
==============================================================================
--- head/sys/dev/drm/r128_cce.c	Thu Apr 22 14:54:54 2010	(r207065)
+++ head/sys/dev/drm/r128_cce.c	Thu Apr 22 18:21:25 2010	(r207066)
@@ -509,7 +509,7 @@ static int r128_do_init_cce(struct drm_d
 	}
 
 	dev_priv->sarea_priv =
-	    (drm_r128_sarea_t *) ((u8 *) dev_priv->sarea->handle +
+	    (drm_r128_sarea_t *) ((u8 *) dev_priv->sarea->virtual +
 				  init->sarea_priv_offset);
 
 #if __OS_HAS_AGP
@@ -517,9 +517,9 @@ static int r128_do_init_cce(struct drm_d
 		drm_core_ioremap(dev_priv->cce_ring, dev);
 		drm_core_ioremap(dev_priv->ring_rptr, dev);
 		drm_core_ioremap(dev->agp_buffer_map, dev);
-		if (!dev_priv->cce_ring->handle ||
-		    !dev_priv->ring_rptr->handle ||
-		    !dev->agp_buffer_map->handle) {
+		if (!dev_priv->cce_ring->virtual ||
+		    !dev_priv->ring_rptr->virtual ||
+		    !dev->agp_buffer_map->virtual) {
 			DRM_ERROR("Could not ioremap agp regions!\n");
 			dev->dev_private = (void *)dev_priv;
 			r128_do_cleanup_cce(dev);
@@ -528,10 +528,11 @@ static int r128_do_init_cce(struct drm_d
 	} else
 #endif
 	{
-		dev_priv->cce_ring->handle = (void *)dev_priv->cce_ring->offset;
-		dev_priv->ring_rptr->handle =
+		dev_priv->cce_ring->virtual =
+		    (void *)dev_priv->cce_ring->offset;
+		dev_priv->ring_rptr->virtual =
 		    (void *)dev_priv->ring_rptr->offset;
-		dev->agp_buffer_map->handle =
+		dev->agp_buffer_map->virtual =
 		    (void *)dev->agp_buffer_map->offset;
 	}
 
@@ -542,8 +543,8 @@ static int r128_do_init_cce(struct drm_d
 #endif
 		dev_priv->cce_buffers_offset = (unsigned long)dev->sg->virtual;
 
-	dev_priv->ring.start = (u32 *) dev_priv->cce_ring->handle;
-	dev_priv->ring.end = ((u32 *) dev_priv->cce_ring->handle
+	dev_priv->ring.start = (u32 *) dev_priv->cce_ring->virtual;
+	dev_priv->ring.end = ((u32 *) dev_priv->cce_ring->virtual
 			      + init->ring_size / sizeof(u32));
 	dev_priv->ring.size = init->ring_size;
 	dev_priv->ring.size_l2qw = drm_order(init->ring_size / 8);

Modified: head/sys/dev/drm/r128_state.c
==============================================================================
--- head/sys/dev/drm/r128_state.c	Thu Apr 22 14:54:54 2010	(r207065)
+++ head/sys/dev/drm/r128_state.c	Thu Apr 22 18:21:25 2010	(r207066)
@@ -657,7 +657,7 @@ static void r128_cce_dispatch_indirect(s
 		 */
 		if (dwords & 1) {
 			u32 *data = (u32 *)
-			    ((char *)dev->agp_buffer_map->handle
+			    ((char *)dev->agp_buffer_map->virtual
 			     + buf->offset + start);
 			data[dwords++] = cpu_to_le32(R128_CCE_PACKET2);
 		}
@@ -722,7 +722,7 @@ static void r128_cce_dispatch_indices(st
 
 		dwords = (end - start + 3) / sizeof(u32);
 
-		data = (u32 *) ((char *)dev->agp_buffer_map->handle
+		data = (u32 *) ((char *)dev->agp_buffer_map->virtual
 				+ buf->offset + start);
 
 		data[0] = cpu_to_le32(CCE_PACKET3(R128_3D_RNDR_GEN_INDX_PRIM,

Modified: head/sys/dev/drm/r600_blit.c
==============================================================================
--- head/sys/dev/drm/r600_blit.c	Thu Apr 22 14:54:54 2010	(r207065)
+++ head/sys/dev/drm/r600_blit.c	Thu Apr 22 18:21:25 2010	(r207066)
@@ -1290,8 +1290,8 @@ set_shaders(struct drm_device *dev)
 	DRM_DEBUG("\n");
 
 	/* load shaders */
-	vs = (u32 *) ((char *)dev->agp_buffer_map->handle + dev_priv->blit_vb->offset);
-	ps = (u32 *) ((char *)dev->agp_buffer_map->handle + dev_priv->blit_vb->offset + 256);
+	vs = (u32 *) ((char *)dev->agp_buffer_map->virtual + dev_priv->blit_vb->offset);
+	ps = (u32 *) ((char *)dev->agp_buffer_map->virtual + dev_priv->blit_vb->offset + 256);
 
 	shader_size = sizeof(r6xx_vs) / 4;
 	for (i= 0; i < shader_size; i++)
@@ -1718,11 +1718,10 @@ r600_blit_copy(struct drm_device *dev,
 	u64 vb_addr;
 	u32 *vb;
 
-	vb = (u32 *) ((char *)dev->agp_buffer_map->handle +
+	vb = (u32 *) ((char *)dev->agp_buffer_map->virtual +
 	    dev_priv->blit_vb->offset + dev_priv->blit_vb->used);
-	DRM_DEBUG("src=0x%016llx, dst=0x%016llx, size=%d\n",
-	    (unsigned long long)src_gpu_addr,
-	    (unsigned long long)dst_gpu_addr, size_bytes);
+	DRM_DEBUG("src=0x%016jx, dst=0x%016jx, size=%d\n",
+	    src_gpu_addr, dst_gpu_addr, size_bytes);
 
 	if ((size_bytes & 3) || (src_gpu_addr & 3) || (dst_gpu_addr & 3)) {
 		max_bytes = 8192;
@@ -1759,7 +1758,7 @@ r600_blit_copy(struct drm_device *dev,
 				if (!dev_priv->blit_vb)
 					return;
 				set_shaders(dev);
-				vb = (u32 *) ((char *)dev->agp_buffer_map->handle +
+				vb = (u32 *) ((char *)dev->agp_buffer_map->virtual +
 				    dev_priv->blit_vb->offset + dev_priv->blit_vb->used);
 			}
 
@@ -1849,7 +1848,7 @@ r600_blit_copy(struct drm_device *dev,
 				if (!dev_priv->blit_vb)
 					return;
 				set_shaders(dev);
-				vb = (u32 *) ((char *)dev->agp_buffer_map->handle +
+				vb = (u32 *) ((char *)dev->agp_buffer_map->virtual +
 				    dev_priv->blit_vb->offset + dev_priv->blit_vb->used);
 			}
 
@@ -1928,7 +1927,7 @@ r600_blit_swap(struct drm_device *dev,
 			return;
 		set_shaders(dev);
 	}
-	vb = (u32 *) ((char *)dev->agp_buffer_map->handle +
+	vb = (u32 *) ((char *)dev->agp_buffer_map->virtual +
 	    dev_priv->blit_vb->offset + dev_priv->blit_vb->used);
 
 	sx2 = sx + w;

Modified: head/sys/dev/drm/r600_cp.c
==============================================================================
--- head/sys/dev/drm/r600_cp.c	Thu Apr 22 14:54:54 2010	(r207065)
+++ head/sys/dev/drm/r600_cp.c	Thu Apr 22 18:21:25 2010	(r207066)
@@ -1914,7 +1914,7 @@ int r600_do_init_cp(struct drm_device *d
 	}
 
 	dev_priv->sarea_priv =
-	    (drm_radeon_sarea_t *) ((u8 *) dev_priv->sarea->handle +
+	    (drm_radeon_sarea_t *) ((u8 *) dev_priv->sarea->virtual +
 				    init->sarea_priv_offset);
 
 #if __OS_HAS_AGP
@@ -1923,9 +1923,9 @@ int r600_do_init_cp(struct drm_device *d
 		drm_core_ioremap_wc(dev_priv->cp_ring, dev);
 		drm_core_ioremap_wc(dev_priv->ring_rptr, dev);
 		drm_core_ioremap_wc(dev->agp_buffer_map, dev);
-		if (!dev_priv->cp_ring->handle ||
-		    !dev_priv->ring_rptr->handle ||
-		    !dev->agp_buffer_map->handle) {
+		if (!dev_priv->cp_ring->virtual ||
+		    !dev_priv->ring_rptr->virtual ||
+		    !dev->agp_buffer_map->virtual) {
 			DRM_ERROR("could not find ioremap agp regions!\n");
 			r600_do_cleanup_cp(dev);
 			return -EINVAL;
@@ -1933,18 +1933,19 @@ int r600_do_init_cp(struct drm_device *d
 	} else
 #endif
 	{
-		dev_priv->cp_ring->handle = (void *)dev_priv->cp_ring->offset;
-		dev_priv->ring_rptr->handle =
+		dev_priv->cp_ring->virtual =
+		    (void *)dev_priv->cp_ring->offset;
+		dev_priv->ring_rptr->virtual =
 		    (void *)dev_priv->ring_rptr->offset;
-		dev->agp_buffer_map->handle =
+		dev->agp_buffer_map->virtual =
 		    (void *)dev->agp_buffer_map->offset;
 
-		DRM_DEBUG("dev_priv->cp_ring->handle %p\n",
-			  dev_priv->cp_ring->handle);
-		DRM_DEBUG("dev_priv->ring_rptr->handle %p\n",
-			  dev_priv->ring_rptr->handle);
-		DRM_DEBUG("dev->agp_buffer_map->handle %p\n",
-			  dev->agp_buffer_map->handle);
+		DRM_DEBUG("dev_priv->cp_ring->virtual %p\n",
+			  dev_priv->cp_ring->virtual);
+		DRM_DEBUG("dev_priv->ring_rptr->virtual %p\n",
+			  dev_priv->ring_rptr->virtual);
+		DRM_DEBUG("dev->agp_buffer_map->virtual %p\n",
+			  dev->agp_buffer_map->virtual);
 	}
 
 	dev_priv->fb_location = (radeon_read_fb_location(dev_priv) & 0xffff) << 24;
@@ -2024,8 +2025,8 @@ int r600_do_init_cp(struct drm_device *d
 	DRM_DEBUG("dev_priv->gart_buffers_offset 0x%08lx\n",
 		  dev_priv->gart_buffers_offset);
 
-	dev_priv->ring.start = (u32 *) dev_priv->cp_ring->handle;
-	dev_priv->ring.end = ((u32 *) dev_priv->cp_ring->handle
+	dev_priv->ring.start = (u32 *) dev_priv->cp_ring->virtual;
+	dev_priv->ring.end = ((u32 *) dev_priv->cp_ring->virtual
 			      + init->ring_size / sizeof(u32));
 	dev_priv->ring.size = init->ring_size;
 	dev_priv->ring.size_l2qw = drm_order(init->ring_size / 8);
@@ -2064,14 +2065,14 @@ int r600_do_init_cp(struct drm_device *d
 			dev_priv->gart_info.table_size;
 
 		drm_core_ioremap_wc(&dev_priv->gart_info.mapping, dev);
-		if (!dev_priv->gart_info.mapping.handle) {
+		if (!dev_priv->gart_info.mapping.virtual) {
 			DRM_ERROR("ioremap failed.\n");
 			r600_do_cleanup_cp(dev);
 			return -EINVAL;
 		}
 
 		dev_priv->gart_info.addr =
-			dev_priv->gart_info.mapping.handle;
+			dev_priv->gart_info.mapping.virtual;
 
 		DRM_DEBUG("Setting phys_pci_gart to %p %08lX\n",
 			  dev_priv->gart_info.addr,
@@ -2219,7 +2220,7 @@ int r600_cp_dispatch_indirect(struct drm
 		 */
 		while (dwords & 0xf) {
 			u32 *data = (u32 *)
-			    ((char *)dev->agp_buffer_map->handle
+			    ((char *)dev->agp_buffer_map->virtual
 			     + buf->offset + start);
 			data[dwords++] = RADEON_CP_PACKET2;
 		}
@@ -2343,7 +2344,8 @@ int r600_cp_dispatch_texture(struct drm_
 		/* Dispatch the indirect buffer.
 		 */
 		buffer =
-		    (u32 *) ((char *)dev->agp_buffer_map->handle + buf->offset);
+		    (u32 *) ((char *)dev->agp_buffer_map->virtual +
+		    buf->offset);
 
 		if (DRM_COPY_FROM_USER(buffer, data, pass_size)) {
 			DRM_ERROR("EFAULT on pad, %d bytes\n", pass_size);

Modified: head/sys/dev/drm/radeon_cp.c
==============================================================================
--- head/sys/dev/drm/radeon_cp.c	Thu Apr 22 14:54:54 2010	(r207065)
+++ head/sys/dev/drm/radeon_cp.c	Thu Apr 22 18:21:25 2010	(r207066)
@@ -53,7 +53,7 @@ u32 radeon_read_ring_rptr(drm_radeon_pri
 		val = DRM_READ32(dev_priv->ring_rptr, off);
 	} else {
 		val = *(((volatile u32 *)
-			 dev_priv->ring_rptr->handle) +
+			 dev_priv->ring_rptr->virtual) +
 			(off / sizeof(u32)));
 		val = le32_to_cpu(val);
 	}
@@ -77,7 +77,7 @@ void radeon_write_ring_rptr(drm_radeon_p
 	if (dev_priv->flags & RADEON_IS_AGP)
 		DRM_WRITE32(dev_priv->ring_rptr, off, val);
 	else
-		*(((volatile u32 *) dev_priv->ring_rptr->handle) +
+		*(((volatile u32 *) dev_priv->ring_rptr->virtual) +
 		  (off / sizeof(u32))) = cpu_to_le32(val);
 }
 
@@ -1278,7 +1278,7 @@ static int radeon_do_init_cp(struct drm_
 	}
 
 	dev_priv->sarea_priv =
-	    (drm_radeon_sarea_t *) ((u8 *) dev_priv->sarea->handle +
+	    (drm_radeon_sarea_t *) ((u8 *) dev_priv->sarea->virtual +
 				    init->sarea_priv_offset);
 
 #if __OS_HAS_AGP
@@ -1286,9 +1286,9 @@ static int radeon_do_init_cp(struct drm_
 		drm_core_ioremap_wc(dev_priv->cp_ring, dev);
 		drm_core_ioremap_wc(dev_priv->ring_rptr, dev);
 		drm_core_ioremap_wc(dev->agp_buffer_map, dev);
-		if (!dev_priv->cp_ring->handle ||
-		    !dev_priv->ring_rptr->handle ||
-		    !dev->agp_buffer_map->handle) {
+		if (!dev_priv->cp_ring->virtual ||
+		    !dev_priv->ring_rptr->virtual ||
+		    !dev->agp_buffer_map->virtual) {
 			DRM_ERROR("could not find ioremap agp regions!\n");
 			radeon_do_cleanup_cp(dev);
 			return -EINVAL;
@@ -1296,19 +1296,19 @@ static int radeon_do_init_cp(struct drm_
 	} else
 #endif
 	{
-		dev_priv->cp_ring->handle =
+		dev_priv->cp_ring->virtual =
 			(void *)(unsigned long)dev_priv->cp_ring->offset;
-		dev_priv->ring_rptr->handle =
+		dev_priv->ring_rptr->virtual =
 			(void *)(unsigned long)dev_priv->ring_rptr->offset;
-		dev->agp_buffer_map->handle =
+		dev->agp_buffer_map->virtual =
 			(void *)(unsigned long)dev->agp_buffer_map->offset;
 
-		DRM_DEBUG("dev_priv->cp_ring->handle %p\n",
-			  dev_priv->cp_ring->handle);
-		DRM_DEBUG("dev_priv->ring_rptr->handle %p\n",
-			  dev_priv->ring_rptr->handle);
-		DRM_DEBUG("dev->agp_buffer_map->handle %p\n",
-			  dev->agp_buffer_map->handle);
+		DRM_DEBUG("dev_priv->cp_ring->virtual %p\n",
+			  dev_priv->cp_ring->virtual);
+		DRM_DEBUG("dev_priv->ring_rptr->virtual %p\n",
+			  dev_priv->ring_rptr->virtual);
+		DRM_DEBUG("dev->agp_buffer_map->virtual %p\n",
+			  dev->agp_buffer_map->virtual);
 	}
 
 	dev_priv->fb_location = (radeon_read_fb_location(dev_priv) & 0xffff) << 16;
@@ -1386,8 +1386,8 @@ static int radeon_do_init_cp(struct drm_
 	DRM_DEBUG("dev_priv->gart_buffers_offset 0x%lx\n",
 		  dev_priv->gart_buffers_offset);
 
-	dev_priv->ring.start = (u32 *) dev_priv->cp_ring->handle;
-	dev_priv->ring.end = ((u32 *) dev_priv->cp_ring->handle
+	dev_priv->ring.start = (u32 *) dev_priv->cp_ring->virtual;
+	dev_priv->ring.end = ((u32 *) dev_priv->cp_ring->virtual
 			      + init->ring_size / sizeof(u32));
 	dev_priv->ring.size = init->ring_size;
 	dev_priv->ring.size_l2qw = drm_order(init->ring_size / 8);
@@ -1423,7 +1423,7 @@ static int radeon_do_init_cp(struct drm_
 
 			drm_core_ioremap_wc(&dev_priv->gart_info.mapping, dev);
 			dev_priv->gart_info.addr =
-			    dev_priv->gart_info.mapping.handle;
+			    dev_priv->gart_info.mapping.virtual;
 
 			if (dev_priv->flags & RADEON_IS_PCIE)
 				dev_priv->gart_info.gart_reg_if = DRM_ATI_GART_PCIE;

Modified: head/sys/dev/drm/radeon_cs.c
==============================================================================
--- head/sys/dev/drm/radeon_cs.c	Thu Apr 22 14:54:54 2010	(r207065)
+++ head/sys/dev/drm/radeon_cs.c	Thu Apr 22 18:21:25 2010	(r207066)
@@ -821,7 +821,7 @@ static int r600_ib_get(struct drm_radeon
 	}
 	buf->file_priv = parser->file_priv;
 	dev_priv->cs_buf = buf;
-	parser->ib = (void *)((vm_offset_t)dev->agp_buffer_map->handle +
+	parser->ib = (void *)((vm_offset_t)dev->agp_buffer_map->virtual +
 	    buf->offset);
 
 	return 0;

Modified: head/sys/dev/drm/radeon_state.c
==============================================================================
--- head/sys/dev/drm/radeon_state.c	Thu Apr 22 14:54:54 2010	(r207065)
+++ head/sys/dev/drm/radeon_state.c	Thu Apr 22 18:21:25 2010	(r207066)
@@ -1420,7 +1420,7 @@ static void radeon_cp_dispatch_swap(stru
 static void radeon_cp_dispatch_flip(struct drm_device *dev)
 {
 	drm_radeon_private_t *dev_priv = dev->dev_private;
-	struct drm_sarea *sarea = (struct drm_sarea *)dev_priv->sarea->handle;
+	struct drm_sarea *sarea = (struct drm_sarea *)dev_priv->sarea->virtual;
 	int offset = (dev_priv->sarea_priv->pfCurrentPage == 1)
 	    ? dev_priv->front_offset : dev_priv->back_offset;
 	RING_LOCALS;
@@ -1582,7 +1582,7 @@ static void radeon_cp_dispatch_indirect(
 		 */
 		if (dwords & 1) {
 			u32 *data = (u32 *)
-			    ((char *)dev->agp_buffer_map->handle
+			    ((char *)dev->agp_buffer_map->virtual
 			     + buf->offset + start);
 			data[dwords++] = RADEON_CP_PACKET2;
 		}
@@ -1629,7 +1629,7 @@ static void radeon_cp_dispatch_indices(s
 
 	dwords = (prim->finish - prim->start + 3) / sizeof(u32);
 
-	data = (u32 *) ((char *)dev->agp_buffer_map->handle +
+	data = (u32 *) ((char *)dev->agp_buffer_map->virtual +
 			elt_buf->offset + prim->start);
 
 	data[0] = CP_PACKET3(RADEON_3D_RNDR_GEN_INDX_PRIM, dwords - 2);
@@ -1781,7 +1781,7 @@ static int radeon_cp_dispatch_texture(st
 		/* Dispatch the indirect buffer.
 		 */
 		buffer =
-		    (u32 *) ((char *)dev->agp_buffer_map->handle + buf->offset);
+		    (u32 *) ((char *)dev->agp_buffer_map->virtual + buf->offset);
 		dwords = size / 4;
 
 #define RADEON_COPY_MT(_buf, _data, _width) \

Modified: head/sys/dev/drm/savage_bci.c
==============================================================================
--- head/sys/dev/drm/savage_bci.c	Thu Apr 22 14:54:54 2010	(r207065)
+++ head/sys/dev/drm/savage_bci.c	Thu Apr 22 18:21:25 2010	(r207066)
@@ -376,7 +376,7 @@ uint32_t *savage_dma_alloc(drm_savage_pr
 		  cur, dev_priv->dma_pages[cur].used, n, rest, nr_pages);
 
 	if (cur + nr_pages < dev_priv->nr_dma_pages) {
-		dma_ptr = (uint32_t *)dev_priv->cmd_dma->handle +
+		dma_ptr = (uint32_t *)dev_priv->cmd_dma->virtual +
 		    cur * SAVAGE_DMA_PAGE_SIZE + dev_priv->dma_pages[cur].used;
 		if (n < rest)
 			rest = n;
@@ -392,7 +392,7 @@ uint32_t *savage_dma_alloc(drm_savage_pr
 			dev_priv->dma_pages[i].used = 0;
 			dev_priv->dma_pages[i].flushed = 0;
 		}
-		dma_ptr = (uint32_t *)dev_priv->cmd_dma->handle;
+		dma_ptr = (uint32_t *)dev_priv->cmd_dma->virtual;
 		dev_priv->first_dma_page = cur = 0;
 	}
 	for (i = cur; nr_pages > 0; ++i, --nr_pages) {
@@ -443,7 +443,7 @@ static void savage_dma_flush(drm_savage_
 
 	/* pad with noops */
 	if (pad) {
-		uint32_t *dma_ptr = (uint32_t *)dev_priv->cmd_dma->handle +
+		uint32_t *dma_ptr = (uint32_t *)dev_priv->cmd_dma->virtual +
 		    cur * SAVAGE_DMA_PAGE_SIZE + dev_priv->dma_pages[cur].used;
 		dev_priv->dma_pages[cur].used += pad;
 		while (pad != 0) {
@@ -517,7 +517,7 @@ static void savage_fake_dma_flush(drm_sa
 	for (i = dev_priv->first_dma_page;
 	     i <= dev_priv->current_dma_page && dev_priv->dma_pages[i].used;
 	     ++i) {
-		uint32_t *dma_ptr = (uint32_t *)dev_priv->cmd_dma->handle +
+		uint32_t *dma_ptr = (uint32_t *)dev_priv->cmd_dma->virtual +
 			i * SAVAGE_DMA_PAGE_SIZE;
 #if SAVAGE_DMA_DEBUG
 		/* Sanity check: all pages except the last one must be full. */
@@ -784,7 +784,7 @@ static int savage_do_init_bci(struct drm
 				return -EINVAL;
 			}
 			drm_core_ioremap(dev_priv->cmd_dma, dev);
-			if (!dev_priv->cmd_dma->handle) {
+			if (!dev_priv->cmd_dma->virtual) {
 				DRM_ERROR("failed to ioremap command "
 					  "DMA region!\n");
 				savage_do_cleanup_bci(dev);
@@ -806,9 +806,9 @@ static int savage_do_init_bci(struct drm
 		dev_priv->fake_dma.offset = 0;
 		dev_priv->fake_dma.size = SAVAGE_FAKE_DMA_SIZE;
 		dev_priv->fake_dma.type = _DRM_SHM;
-		dev_priv->fake_dma.handle = drm_alloc(SAVAGE_FAKE_DMA_SIZE,
+		dev_priv->fake_dma.virtual = drm_alloc(SAVAGE_FAKE_DMA_SIZE,
 						      DRM_MEM_DRIVER);
-		if (!dev_priv->fake_dma.handle) {
+		if (!dev_priv->fake_dma.virtual) {
 			DRM_ERROR("could not allocate faked DMA buffer!\n");
 			savage_do_cleanup_bci(dev);
 			return -ENOMEM;
@@ -818,7 +818,7 @@ static int savage_do_init_bci(struct drm
 	}
 
 	dev_priv->sarea_priv =
-		(drm_savage_sarea_t *)((uint8_t *)dev_priv->sarea->handle +
+		(drm_savage_sarea_t *)((uint8_t *)dev_priv->sarea->virtual +
 				       init->sarea_priv_offset);
 
 	/* setup bitmap descriptors */
@@ -857,7 +857,7 @@ static int savage_do_init_bci(struct drm
 	dev_priv->event_counter = 0;
 	dev_priv->event_wrap = 0;
 	dev_priv->bci_ptr = (volatile uint32_t *)
-	    ((uint8_t *)dev_priv->mmio->handle + SAVAGE_BCI_OFFSET);
+	    ((uint8_t *)dev_priv->mmio->virtual + SAVAGE_BCI_OFFSET);
 	if (S3_SAVAGE3D_SERIES(dev_priv->chipset)) {

*** DIFF OUTPUT TRUNCATED AT 1000 LINES ***

From owner-svn-src-head@FreeBSD.ORG  Thu Apr 22 18:44:24 2010
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 1C18F1065716;
	Thu, 22 Apr 2010 18:44:24 +0000 (UTC)
	(envelope-from rnoland@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 09A568FC12;
	Thu, 22 Apr 2010 18:44:24 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o3MIiNMZ059706;
	Thu, 22 Apr 2010 18:44:23 GMT (envelope-from rnoland@svn.freebsd.org)
Received: (from rnoland@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o3MIiNgV059699;
	Thu, 22 Apr 2010 18:44:23 GMT (envelope-from rnoland@svn.freebsd.org)
Message-Id: <201004221844.o3MIiNgV059699@svn.freebsd.org>
From: Robert Noland 
Date: Thu, 22 Apr 2010 18:44:23 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r207067 - head/sys/dev/drm
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 22 Apr 2010 18:44:24 -0000

Author: rnoland
Date: Thu Apr 22 18:44:23 2010
New Revision: 207067
URL: http://svn.freebsd.org/changeset/base/207067

Log:
  re-write scatter gather memory allocation yet again...
  
  This time, abandon the use of busdma and start interacting with the VM
  system directly.  Make use of the new kmem_alloc_attr() which allows us
  to easily allocate non-contiguous pages to back the GART table.  This
  should help a lot when starting or restarting X after the system has
  been running for a while and memory has become fragmented.
  
  MFC after:	2 weeks

Modified:
  head/sys/dev/drm/drmP.h
  head/sys/dev/drm/drm_bufs.c
  head/sys/dev/drm/drm_scatter.c
  head/sys/dev/drm/r128_cce.c
  head/sys/dev/drm/r600_cp.c
  head/sys/dev/drm/radeon_cp.c

Modified: head/sys/dev/drm/drmP.h
==============================================================================
--- head/sys/dev/drm/drmP.h	Thu Apr 22 18:21:25 2010	(r207066)
+++ head/sys/dev/drm/drmP.h	Thu Apr 22 18:44:23 2010	(r207067)
@@ -49,6 +49,7 @@ struct drm_file;
 #include 
 #include 
 #include 
+#include 
 #include 
 #if __FreeBSD_version >= 700000
 #include 
@@ -68,10 +69,13 @@ struct drm_file;
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
+#include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -474,11 +478,10 @@ typedef struct drm_agp_head {
 } drm_agp_head_t;
 
 typedef struct drm_sg_mem {
-	unsigned long		  handle;
-	void			 *virtual;
-	int			  pages;
-	dma_addr_t		 *busaddr;
-	struct drm_dma_handle	 *dmah;		/* Handle to PCI memory  */
+	vm_offset_t vaddr;
+	vm_paddr_t *busaddr;
+	vm_pindex_t pages;
+	vm_object_t obj;
 } drm_sg_mem_t;
 
 #define DRM_MAP_HANDLE_BITS	(sizeof(void *) == 4 ? 4 : 24)

Modified: head/sys/dev/drm/drm_bufs.c
==============================================================================
--- head/sys/dev/drm/drm_bufs.c	Thu Apr 22 18:21:25 2010	(r207066)
+++ head/sys/dev/drm/drm_bufs.c	Thu Apr 22 18:44:23 2010	(r207067)
@@ -226,8 +226,8 @@ int drm_addmap(struct drm_device * dev, 
 			DRM_LOCK();
 			return EINVAL;
 		}
-		map->virtual = (void *)(dev->sg->handle + offset);
-		map->offset = dev->sg->handle + offset;
+		map->virtual = (void *)(dev->sg->vaddr + offset);
+		map->offset = dev->sg->vaddr + offset;
 		break;
 	case _DRM_CONSISTENT:
 		/* Unfortunately, we don't get any alignment specification from
@@ -744,7 +744,7 @@ static int drm_do_addbufs_sg(struct drm_
 
 		buf->offset  = (dma->byte_count + offset);
 		buf->bus_address = agp_offset + offset;
-		buf->address = (void *)(agp_offset + offset + dev->sg->handle);
+		buf->address = (void *)(agp_offset + offset + dev->sg->vaddr);
 		buf->next    = NULL;
 		buf->pending = 0;
 		buf->file_priv = NULL;

Modified: head/sys/dev/drm/drm_scatter.c
==============================================================================
--- head/sys/dev/drm/drm_scatter.c	Thu Apr 22 18:21:25 2010	(r207066)
+++ head/sys/dev/drm/drm_scatter.c	Thu Apr 22 18:44:23 2010	(r207067)
@@ -1,5 +1,5 @@
 /*-
- * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California.
+ * Copyright (c) 2009 Robert C. Noland III 
  * All Rights Reserved.
  *
  * Permission is hereby granted, free of charge, to any person obtaining a
@@ -20,11 +20,6 @@
  * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
  * DEALINGS IN THE SOFTWARE.
- *
- * Authors:
- *   Gareth Hughes 
- *   Eric Anholt 
- *
  */
 
 #include 
@@ -32,99 +27,58 @@ __FBSDID("$FreeBSD$");
 
 /** @file drm_scatter.c
  * Allocation of memory for scatter-gather mappings by the graphics chip.
- *
  * The memory allocated here is then made into an aperture in the card
- * by drm_ati_pcigart_init().
+ * by mapping the pages into the GART.
  */
 
 #include "dev/drm/drmP.h"
 
-static void drm_sg_alloc_cb(void *arg, bus_dma_segment_t *segs,
-			    int nsegs, int error);
-
 int
 drm_sg_alloc(struct drm_device *dev, struct drm_scatter_gather *request)
 {
 	struct drm_sg_mem *entry;
-	struct drm_dma_handle *dmah;
-	int ret;
+	vm_size_t size;
+	vm_pindex_t pindex;
 
 	if (dev->sg)
 		return EINVAL;
 
-	entry = malloc(sizeof(*entry), DRM_MEM_SGLISTS, M_WAITOK | M_ZERO);
-	entry->pages = round_page(request->size) / PAGE_SIZE;
-	DRM_DEBUG("sg size=%ld pages=%d\n", request->size, entry->pages);
+	DRM_DEBUG("request size=%ld\n", request->size);
+
+	entry = malloc(sizeof(*entry), DRM_MEM_DRIVER, M_WAITOK | M_ZERO);
 
+	size = round_page(request->size);
+	entry->pages = OFF_TO_IDX(size);
 	entry->busaddr = malloc(entry->pages * sizeof(*entry->busaddr),
-	    DRM_MEM_PAGES, M_WAITOK | M_ZERO);
-	dmah = malloc(sizeof(struct drm_dma_handle), DRM_MEM_DMA,
-	    M_WAITOK | M_ZERO);
-	entry->dmah = dmah;
-
-	ret = bus_dma_tag_create(NULL, PAGE_SIZE, 0, /* tag, align, boundary */
-	    BUS_SPACE_MAXADDR_32BIT, BUS_SPACE_MAXADDR, /* lowaddr, highaddr */
-	    NULL, NULL, /* filtfunc, filtfuncargs */
-	    request->size, entry->pages, /* maxsize, nsegs */
-	    PAGE_SIZE, 0, /* maxsegsize, flags */
-	    NULL, NULL, /* lockfunc, lockfuncargs */
-	    &dmah->tag);
-	if (ret != 0) {
-		drm_sg_cleanup(entry);
-		return ENOMEM;
-	}
+	    DRM_MEM_SGLISTS, M_WAITOK | M_ZERO);
 
-	ret = bus_dmamem_alloc(dmah->tag, &dmah->vaddr,
-	    BUS_DMA_WAITOK | BUS_DMA_ZERO | BUS_DMA_NOCACHE, &dmah->map);
-	if (ret != 0) {
+	entry->vaddr = kmem_alloc_attr(kernel_map, size, M_WAITOK | M_ZERO,
+	    0, BUS_SPACE_MAXADDR_32BIT, VM_MEMATTR_WRITE_COMBINING);
+	if (entry->vaddr == 0) {
 		drm_sg_cleanup(entry);
-		return ENOMEM;
+		return (ENOMEM);
 	}
 
-	entry->handle = (unsigned long)dmah->vaddr;
-	entry->virtual = dmah->vaddr;
-
-	ret = bus_dmamap_load(dmah->tag, dmah->map, dmah->vaddr,
-	    request->size, drm_sg_alloc_cb, entry, BUS_DMA_NOWAIT);
-	if (ret != 0) {
-		drm_sg_cleanup(entry);
-		return ENOMEM;
+	for(pindex = 0; pindex < entry->pages; pindex++) {
+		entry->busaddr[pindex] =
+		    vtophys(entry->vaddr + IDX_TO_OFF(pindex));
 	}
 
 	DRM_LOCK();
 	if (dev->sg) {
 		DRM_UNLOCK();
 		drm_sg_cleanup(entry);
-		return EINVAL;
+		return (EINVAL);
 	}
 	dev->sg = entry;
 	DRM_UNLOCK();
 
-	pmap_change_attr((vm_offset_t)dmah->vaddr, request->size,
-	    PAT_WRITE_COMBINING);
+	request->handle = entry->vaddr;
 
-	request->handle = entry->handle;
+	DRM_DEBUG("allocated %ju pages @ 0x%08zx, contents=%08lx\n",
+	    entry->pages, entry->vaddr, *(unsigned long *)entry->vaddr);
 
-	DRM_DEBUG("handle=%08lx, kva=%p, contents=%08lx\n", entry->handle,
-	    entry->virtual, *(unsigned long *)entry->virtual);
-
-	return 0;
-}
-
-static void
-drm_sg_alloc_cb(void *arg, bus_dma_segment_t *segs, int nsegs, int error)
-{
-	struct drm_sg_mem *entry = arg;
-	int i;
-
-	if (error != 0)
-	    return;
-
-	for(i = 0 ; i < nsegs ; i++) {
-		entry->busaddr[i] = segs[i].ds_addr;
-		DRM_DEBUG("segment %d @ 0x%016lx\n", i,
-		    (unsigned long)segs[i].ds_addr);
-	}
+	return (0);
 }
 
 int
@@ -135,23 +89,22 @@ drm_sg_alloc_ioctl(struct drm_device *de
 
 	DRM_DEBUG("\n");
 
-	return drm_sg_alloc(dev, request);
+	return (drm_sg_alloc(dev, request));
 }
 
 void
 drm_sg_cleanup(struct drm_sg_mem *entry)
 {
-	struct drm_dma_handle *dmah = entry->dmah;
+	if (entry == NULL)
+		return;
+
+	if (entry->vaddr != 0)
+		kmem_free(kernel_map, entry->vaddr, IDX_TO_OFF(entry->pages));
 
-	if (dmah->map != NULL)
-		bus_dmamap_unload(dmah->tag, dmah->map);
-	if (dmah->vaddr != NULL)
-		bus_dmamem_free(dmah->tag, dmah->vaddr, dmah->map);
-	if (dmah->tag != NULL)
-		bus_dma_tag_destroy(dmah->tag);
-	free(dmah, DRM_MEM_DMA);
-	free(entry->busaddr, DRM_MEM_PAGES);
-	free(entry, DRM_MEM_SGLISTS);
+	free(entry->busaddr, DRM_MEM_SGLISTS);
+	free(entry, DRM_MEM_DRIVER);
+
+	return;
 }
 
 int
@@ -165,12 +118,12 @@ drm_sg_free(struct drm_device *dev, void
 	dev->sg = NULL;
 	DRM_UNLOCK();
 
-	if (!entry || entry->handle != request->handle)
-		return EINVAL;
+	if (!entry || entry->vaddr != request->handle)
+		return (EINVAL);
 
-	DRM_DEBUG("sg free virtual = 0x%lx\n", entry->handle);
+	DRM_DEBUG("free 0x%zx\n", entry->vaddr);
 
 	drm_sg_cleanup(entry);
 
-	return 0;
+	return (0);
 }

Modified: head/sys/dev/drm/r128_cce.c
==============================================================================
--- head/sys/dev/drm/r128_cce.c	Thu Apr 22 18:21:25 2010	(r207066)
+++ head/sys/dev/drm/r128_cce.c	Thu Apr 22 18:44:23 2010	(r207067)
@@ -327,8 +327,7 @@ static void r128_cce_init_ring_buffer(st
 		ring_start = dev_priv->cce_ring->offset - dev->agp->base;
 	else
 #endif
-		ring_start = dev_priv->cce_ring->offset -
-				(unsigned long)dev->sg->virtual;
+		ring_start = dev_priv->cce_ring->offset - dev->sg->vaddr;
 
 	R128_WRITE(R128_PM4_BUFFER_OFFSET, ring_start | R128_AGP_OFFSET);
 
@@ -541,7 +540,7 @@ static int r128_do_init_cce(struct drm_d
 		dev_priv->cce_buffers_offset = dev->agp->base;
 	else
 #endif
-		dev_priv->cce_buffers_offset = (unsigned long)dev->sg->virtual;
+		dev_priv->cce_buffers_offset = dev->sg->vaddr;
 
 	dev_priv->ring.start = (u32 *) dev_priv->cce_ring->virtual;
 	dev_priv->ring.end = ((u32 *) dev_priv->cce_ring->virtual

Modified: head/sys/dev/drm/r600_cp.c
==============================================================================
--- head/sys/dev/drm/r600_cp.c	Thu Apr 22 18:21:25 2010	(r207066)
+++ head/sys/dev/drm/r600_cp.c	Thu Apr 22 18:44:23 2010	(r207067)
@@ -1670,9 +1670,8 @@ static void r600_cp_init_ring_buffer(str
 	} else
 #endif
 	{
-		rptr_addr = dev_priv->ring_rptr->offset
-			- ((unsigned long) dev->sg->virtual)
-			+ dev_priv->gart_vm_start;
+		rptr_addr = dev_priv->ring_rptr->offset - dev->sg->vaddr +
+		    dev_priv->gart_vm_start;
 	}
 	RADEON_WRITE(R600_CP_RB_RPTR_ADDR,
 		     rptr_addr & 0xffffffff);
@@ -1706,9 +1705,8 @@ static void r600_cp_init_ring_buffer(str
 			      + dev_priv->gart_vm_start);
 	} else
 #endif
-		ring_start = (dev_priv->cp_ring->offset
-			      - (unsigned long)dev->sg->virtual
-			      + dev_priv->gart_vm_start);
+		ring_start = dev_priv->cp_ring->offset - dev->sg->vaddr +
+		    dev_priv->gart_vm_start;
 
 	RADEON_WRITE(R600_CP_RB_BASE, ring_start >> 8);
 
@@ -2012,9 +2010,8 @@ int r600_do_init_cp(struct drm_device *d
 						 + dev_priv->gart_vm_start);
 	else
 #endif
-		dev_priv->gart_buffers_offset = (dev->agp_buffer_map->offset
-						 - (unsigned long)dev->sg->virtual
-						 + dev_priv->gart_vm_start);
+		dev_priv->gart_buffers_offset = dev->agp_buffer_map->offset -
+		    dev->sg->vaddr + dev_priv->gart_vm_start;
 
 	DRM_DEBUG("fb 0x%08x size %d\n",
 		  (unsigned int) dev_priv->fb_location,

Modified: head/sys/dev/drm/radeon_cp.c
==============================================================================
--- head/sys/dev/drm/radeon_cp.c	Thu Apr 22 18:21:25 2010	(r207066)
+++ head/sys/dev/drm/radeon_cp.c	Thu Apr 22 18:44:23 2010	(r207067)
@@ -720,9 +720,8 @@ static void radeon_cp_init_ring_buffer(s
 			      + dev_priv->gart_vm_start);
 	} else
 #endif
-		ring_start = (dev_priv->cp_ring->offset
-			      - (unsigned long)dev->sg->virtual
-			      + dev_priv->gart_vm_start);
+		ring_start = (dev_priv->cp_ring->offset - dev->sg->vaddr +
+		    dev_priv->gart_vm_start);
 
 	RADEON_WRITE(RADEON_CP_RB_BASE, ring_start);
 
@@ -744,9 +743,8 @@ static void radeon_cp_init_ring_buffer(s
 #endif
 	{
 		RADEON_WRITE(RADEON_CP_RB_RPTR_ADDR,
-			     dev_priv->ring_rptr->offset
-			     - ((unsigned long) dev->sg->virtual)
-			     + dev_priv->gart_vm_start);
+		    dev_priv->ring_rptr->offset - dev->sg->vaddr +
+		    dev_priv->gart_vm_start);
 	}
 
 	/* Set ring buffer size */
@@ -1377,9 +1375,8 @@ static int radeon_do_init_cp(struct drm_
 						 + dev_priv->gart_vm_start);
 	else
 #endif
-		dev_priv->gart_buffers_offset = (dev->agp_buffer_map->offset
-					- (unsigned long)dev->sg->virtual
-					+ dev_priv->gart_vm_start);
+		dev_priv->gart_buffers_offset = dev->agp_buffer_map->offset -
+		    dev->sg->vaddr + dev_priv->gart_vm_start;
 
 	DRM_DEBUG("dev_priv->gart_size %d\n", dev_priv->gart_size);
 	DRM_DEBUG("dev_priv->gart_vm_start 0x%x\n", dev_priv->gart_vm_start);

From owner-svn-src-head@FreeBSD.ORG  Thu Apr 22 18:47:24 2010
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 228C01065673;
	Thu, 22 Apr 2010 18:47:24 +0000 (UTC) (envelope-from pjd@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 10FEC8FC1D;
	Thu, 22 Apr 2010 18:47:24 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o3MIlNNE060439;
	Thu, 22 Apr 2010 18:47:23 GMT (envelope-from pjd@svn.freebsd.org)
Received: (from pjd@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o3MIlNxa060437;
	Thu, 22 Apr 2010 18:47:23 GMT (envelope-from pjd@svn.freebsd.org)
Message-Id: <201004221847.o3MIlNxa060437@svn.freebsd.org>
From: Pawel Jakub Dawidek 
Date: Thu, 22 Apr 2010 18:47:23 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r207068 -
	head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 22 Apr 2010 18:47:24 -0000

Author: pjd
Date: Thu Apr 22 18:47:23 2010
New Revision: 207068
URL: http://svn.freebsd.org/changeset/base/207068

Log:
  Allow to modify directory's content even if the ZFS_NOUNLINK (SF_NOUNLINK,
  sunlnk) flag is set. We only deny dirctory's removal or rename.
  
  PR:		kern/143343
  Reported by:	marck
  MFC after:	3 days

Modified:
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_acl.c

Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_acl.c
==============================================================================
--- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_acl.c	Thu Apr 22 18:44:23 2010	(r207067)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_acl.c	Thu Apr 22 18:47:23 2010	(r207068)
@@ -2235,11 +2235,24 @@ zfs_zaccess_common(znode_t *zp, uint32_t
 		return (EPERM);
 	}
 
+#ifdef sun
 	if ((v4_mode & (ACE_DELETE | ACE_DELETE_CHILD)) &&
 	    (zp->z_phys->zp_flags & ZFS_NOUNLINK)) {
 		*check_privs = B_FALSE;
 		return (EPERM);
 	}
+#else
+	/*
+	 * In FreeBSD we allow to modify directory's content is ZFS_NOUNLINK
+	 * (sunlnk) is set. We just don't allow directory removal, which is
+	 * handled in zfs_zaccess_delete().
+	 */
+	if ((v4_mode & ACE_DELETE) &&
+	    (zp->z_phys->zp_flags & ZFS_NOUNLINK)) {
+		*check_privs = B_FALSE;
+		return (EPERM);
+	}
+#endif
 
 	if (((v4_mode & (ACE_READ_DATA|ACE_EXECUTE)) &&
 	    (zp->z_phys->zp_flags & ZFS_AV_QUARANTINED))) {

From owner-svn-src-head@FreeBSD.ORG  Thu Apr 22 18:47:30 2010
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 7D4551065670;
	Thu, 22 Apr 2010 18:47:30 +0000 (UTC)
	(envelope-from rnoland@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 517CB8FC08;
	Thu, 22 Apr 2010 18:47:30 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o3MIlUEp060478;
	Thu, 22 Apr 2010 18:47:30 GMT (envelope-from rnoland@svn.freebsd.org)
Received: (from rnoland@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o3MIlUFr060475;
	Thu, 22 Apr 2010 18:47:30 GMT (envelope-from rnoland@svn.freebsd.org)
Message-Id: <201004221847.o3MIlUFr060475@svn.freebsd.org>
From: Robert Noland 
Date: Thu, 22 Apr 2010 18:47:30 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r207069 - head/sys/dev/drm
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 22 Apr 2010 18:47:30 -0000

Author: rnoland
Date: Thu Apr 22 18:47:30 2010
New Revision: 207069
URL: http://svn.freebsd.org/changeset/base/207069

Log:
  Now that we properly set write-combining on the pages that back the GART,
  disable snooping on radeons.
  
  MFC after:	2 weeks

Modified:
  head/sys/dev/drm/ati_pcigart.c
  head/sys/dev/drm/r600_cp.c

Modified: head/sys/dev/drm/ati_pcigart.c
==============================================================================
--- head/sys/dev/drm/ati_pcigart.c	Thu Apr 22 18:47:23 2010	(r207068)
+++ head/sys/dev/drm/ati_pcigart.c	Thu Apr 22 18:47:30 2010	(r207069)
@@ -39,8 +39,9 @@ __FBSDID("$FreeBSD$");
 #define ATI_PCIGART_PAGE_SIZE		4096	/* PCI GART page size */
 #define ATI_PCIGART_PAGE_MASK		(~(ATI_PCIGART_PAGE_SIZE-1))
 
-#define ATI_PCIE_WRITE 0x4
-#define ATI_PCIE_READ 0x8
+#define ATI_GART_NOSNOOP	0x1
+#define ATI_GART_WRITE		0x4
+#define ATI_GART_READ		0x8
 
 static void
 drm_ati_alloc_pcigart_table_cb(void *arg, bus_dma_segment_t *segs,
@@ -196,13 +197,15 @@ drm_ati_pcigart_init(struct drm_device *
 			case DRM_ATI_GART_IGP:
 				page_base |=
 				    (upper_32_bits(entry_addr) & 0xff) << 4;
-				page_base |= 0xc;
+				page_base |= ATI_GART_READ | ATI_GART_WRITE;
+				page_base |= ATI_GART_NOSNOOP;
 				break;
 			case DRM_ATI_GART_PCIE:
 				page_base >>= 8;
 				page_base |=
 				    (upper_32_bits(entry_addr) & 0xff) << 24;
-				page_base |= ATI_PCIE_READ | ATI_PCIE_WRITE;
+				page_base |= ATI_GART_READ | ATI_GART_WRITE;
+				page_base |= ATI_GART_NOSNOOP;
 				break;
 			default:
 			case DRM_ATI_GART_PCI:

Modified: head/sys/dev/drm/r600_cp.c
==============================================================================
--- head/sys/dev/drm/r600_cp.c	Thu Apr 22 18:47:23 2010	(r207068)
+++ head/sys/dev/drm/r600_cp.c	Thu Apr 22 18:47:30 2010	(r207069)
@@ -180,7 +180,7 @@ int r600_page_table_init(struct drm_devi
 		entry_addr = entry->busaddr[i];
 		for (j = 0; j < (PAGE_SIZE / ATI_PCIGART_PAGE_SIZE); j++) {
 			page_base = (u64) entry_addr & ATI_PCIGART_PAGE_MASK;
-			page_base |= R600_PTE_VALID | R600_PTE_SYSTEM | R600_PTE_SNOOPED;
+			page_base |= R600_PTE_VALID | R600_PTE_SYSTEM;
 			page_base |= R600_PTE_READABLE | R600_PTE_WRITEABLE;
 
 			*pci_gart = page_base;

From owner-svn-src-head@FreeBSD.ORG  Thu Apr 22 19:18:10 2010
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 86D34106564A;
	Thu, 22 Apr 2010 19:18:10 +0000 (UTC) (envelope-from pjd@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 6BA598FC17;
	Thu, 22 Apr 2010 19:18:10 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o3MJIA2c067372;
	Thu, 22 Apr 2010 19:18:10 GMT (envelope-from pjd@svn.freebsd.org)
Received: (from pjd@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o3MJIA8i067368;
	Thu, 22 Apr 2010 19:18:10 GMT (envelope-from pjd@svn.freebsd.org)
Message-Id: <201004221918.o3MJIA8i067368@svn.freebsd.org>
From: Pawel Jakub Dawidek 
Date: Thu, 22 Apr 2010 19:18:10 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r207070 - in head/sbin: hastctl hastd
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 22 Apr 2010 19:18:10 -0000

Author: pjd
Date: Thu Apr 22 19:18:10 2010
New Revision: 207070
URL: http://svn.freebsd.org/changeset/base/207070

Log:
  Fix compilation with WITHOUT_CRYPT or WITHOUT_OPENSSL options.
  
  Reported by:	Andrei V. Lavreniyuk 
  MFC after:	3 days

Modified:
  head/sbin/hastctl/Makefile
  head/sbin/hastd/Makefile
  head/sbin/hastd/hast_proto.c

Modified: head/sbin/hastctl/Makefile
==============================================================================
--- head/sbin/hastctl/Makefile	Thu Apr 22 18:47:30 2010	(r207069)
+++ head/sbin/hastctl/Makefile	Thu Apr 22 19:18:10 2010	(r207070)
@@ -25,8 +25,13 @@ CFLAGS+=-DINET6
 # This is needed to have WARNS > 1.
 CFLAGS+=-DYY_NO_UNPUT
 
-DPADD=	${LIBCRYPTO} ${LIBL}
-LDADD=	-lcrypto -ll
+DPADD=	${LIBL}
+LDADD=	-ll
+.if ${MK_OPENSSL} != "no"
+DPADD+=	${LIBCRYPTO}
+LDADD+=	-lcrypto
+CFLAGS+=-DHAVE_CRYPTO
+.endif
 
 YFLAGS+=-v
 

Modified: head/sbin/hastd/Makefile
==============================================================================
--- head/sbin/hastd/Makefile	Thu Apr 22 18:47:30 2010	(r207069)
+++ head/sbin/hastd/Makefile	Thu Apr 22 19:18:10 2010	(r207070)
@@ -26,9 +26,13 @@ CFLAGS+=-DINET6
 # This is needed to have WARNS > 1.
 CFLAGS+=-DYY_NO_UNPUT
 
-DPADD=	${LIBCRYPTO} ${LIBGEOM} ${LIBBSDXML} ${LIBSBUF} ${LIBL} \
-	${LIBPTHREAD} ${LIBUTIL}
-LDADD=	-lcrypto -lgeom -lbsdxml -lsbuf -ll -lpthread -lutil
+DPADD=	${LIBGEOM} ${LIBBSDXML} ${LIBSBUF} ${LIBL} ${LIBPTHREAD} ${LIBUTIL}
+LDADD=	-lgeom -lbsdxml -lsbuf -ll -lpthread -lutil
+.if ${MK_OPENSSL} != "no"
+DPADD+=	${LIBCRYPTO}
+LDADD+=	-lcrypto
+CFLAGS+=-DHAVE_CRYPTO
+.endif
 
 YFLAGS+=-v
 

Modified: head/sbin/hastd/hast_proto.c
==============================================================================
--- head/sbin/hastd/hast_proto.c	Thu Apr 22 18:47:30 2010	(r207069)
+++ head/sbin/hastd/hast_proto.c	Thu Apr 22 19:18:10 2010	(r207070)
@@ -37,7 +37,9 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 
+#ifdef HAVE_CRYPTO
 #include 
+#endif
 
 #include 
 #include 
@@ -67,14 +69,18 @@ static int compression_send(struct hast_
     void **datap, size_t *sizep, bool *freedatap);
 static int compression_recv(struct hast_resource *res, struct nv *nv,
     void **datap, size_t *sizep, bool *freedatap);
+#ifdef HAVE_CRYPTO
 static int checksum_send(struct hast_resource *res, struct nv *nv,
     void **datap, size_t *sizep, bool *freedatap);
 static int checksum_recv(struct hast_resource *res, struct nv *nv,
     void **datap, size_t *sizep, bool *freedatap);
+#endif
 
 static struct hast_pipe_stage pipeline[] = {
 	{ "compression", compression_send, compression_recv },
+#ifdef HAVE_CRYPTO
 	{ "checksum", checksum_send, checksum_recv }
+#endif
 };
 
 static int
@@ -161,6 +167,7 @@ compression_recv(struct hast_resource *r
 	return (0);
 }
 
+#ifdef HAVE_CRYPTO
 static int
 checksum_send(struct hast_resource *res, struct nv *nv, void **datap,
     size_t *sizep, bool *freedatap __unused)
@@ -221,6 +228,7 @@ checksum_recv(struct hast_resource *res,
 
 	return (0);
 }
+#endif	/* HAVE_CRYPTO */
 
 /*
  * Send the given nv structure via conn.

From owner-svn-src-head@FreeBSD.ORG  Thu Apr 22 20:25:07 2010
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id C1844106564A;
	Thu, 22 Apr 2010 20:25:07 +0000 (UTC)
	(envelope-from yongari@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id AFC148FC0A;
	Thu, 22 Apr 2010 20:25:07 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o3MKP74r082408;
	Thu, 22 Apr 2010 20:25:07 GMT (envelope-from yongari@svn.freebsd.org)
Received: (from yongari@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o3MKP7im082406;
	Thu, 22 Apr 2010 20:25:07 GMT (envelope-from yongari@svn.freebsd.org)
Message-Id: <201004222025.o3MKP7im082406@svn.freebsd.org>
From: Pyun YongHyeon 
Date: Thu, 22 Apr 2010 20:25:07 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r207071 - head/sys/dev/sge
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 22 Apr 2010 20:25:07 -0000

Author: yongari
Date: Thu Apr 22 20:25:07 2010
New Revision: 207071
URL: http://svn.freebsd.org/changeset/base/207071

Log:
  Intialize interrupt moderation control register. The magic value
  was chosen by lots of trial and errors. The chosen value shows
  good interrupt moderation without additional latency.
  Without this change, controller can generate more than 140k
  interrupts per second under high network load.
  
  Submitted by:	xclin  cs dot nctu dot edu dot tw >

Modified:
  head/sys/dev/sge/if_sge.c

Modified: head/sys/dev/sge/if_sge.c
==============================================================================
--- head/sys/dev/sge/if_sge.c	Thu Apr 22 19:18:10 2010	(r207070)
+++ head/sys/dev/sge/if_sge.c	Thu Apr 22 20:25:07 2010	(r207071)
@@ -1551,10 +1551,13 @@ sge_init_locked(struct sge_softc *sc)
 	/*
 	 * XXX Try to mitigate interrupts.
 	 */
+	CSR_WRITE_4(sc, IntrControl, 0x08880000);
+#ifdef notyet
 	if (sc->sge_intrcontrol != 0)
 		CSR_WRITE_4(sc, IntrControl, sc->sge_intrcontrol);
 	if (sc->sge_intrtimer != 0)
 		CSR_WRITE_4(sc, IntrTimer, sc->sge_intrtimer);
+#endif
 
 	/*
 	 * Clear and enable interrupts.

From owner-svn-src-head@FreeBSD.ORG  Thu Apr 22 20:46:39 2010
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id B634C106564A;
	Thu, 22 Apr 2010 20:46:39 +0000 (UTC)
	(envelope-from thompsa@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 8B1BF8FC20;
	Thu, 22 Apr 2010 20:46:39 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o3MKkdXX087403;
	Thu, 22 Apr 2010 20:46:39 GMT (envelope-from thompsa@svn.freebsd.org)
Received: (from thompsa@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o3MKkdV7087402;
	Thu, 22 Apr 2010 20:46:39 GMT (envelope-from thompsa@svn.freebsd.org)
Message-Id: <201004222046.o3MKkdV7087402@svn.freebsd.org>
From: Andrew Thompson 
Date: Thu, 22 Apr 2010 20:46:39 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r207072 - head/sbin/devd
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 22 Apr 2010 20:46:39 -0000

Author: thompsa
Date: Thu Apr 22 20:46:39 2010
New Revision: 207072
URL: http://svn.freebsd.org/changeset/base/207072

Log:
  Document the new USB notification types.

Modified:
  head/sbin/devd/devd.conf.5

Modified: head/sbin/devd/devd.conf.5
==============================================================================
--- head/sbin/devd/devd.conf.5	Thu Apr 22 20:25:07 2010	(r207071)
+++ head/sbin/devd/devd.conf.5	Thu Apr 22 20:46:39 2010	(r207072)
@@ -250,18 +250,40 @@ CIS-vendor.
 Device class.
 .It Li device
 Device ID.
+.It Li devclass
+Device Class (USB)
+.It Li devsubclass
+Device Sub-class (USB)
 .It Li device-name
 Name of attached/detached device.
+.It Li endpoints
+Endpoint count (USB)
 .It Li function
 Card functions.
+.It Li interface
+Interface ID (USB)
+.It Li intclass
+Interface Class (USB)
+.It Li intprotocol
+Interface Protocol  (USB)
+.It Li intsubclass
+Interface Sub-class (USB)
 .It Li manufacturer
 Manufacturer ID (pccard).
+.It Li mode
+Peripheral mode (USB)
 .It Li notify
 Match the value of the
 .Dq Li notify
 variable.
+.It Li parent
+Parent device
+.It Li port
+Hub port number (USB)
 .It Li product
-Product ID (pccard).
+Product ID (pccard/USB).
+.It Li release
+Hardware revision (USB)
 .It Li serial
 Serial Number (USB).
 .It Li slot
@@ -342,6 +364,27 @@ The
 node is destroyed.
 .El
 .El
+.It Li USB
+Events related to the USB subsystem.
+.Bl -tag -width ".Sy Subsystem" -compact
+.It Sy Subsystem
+.It Li DEVICE
+.Bl -tag -width ".Li DETACH" -compact
+.It Sy Type
+.It Li ATTACH
+USB device is attached to the system.
+.It Li DETACH
+USB device is detached from the system.
+.El
+.It Li INTERFACE
+.Bl -tag -width ".Li DETACH" -compact
+.It Sy Type
+.It Li ATTACH
+USB interface is attached from a device.
+.It Li DETACH
+USB interface is detached from a device.
+.El
+.El
 .It Li coretemp
 Events related to the
 .Xr coretemp 4
@@ -461,6 +504,17 @@ notify 0 {
 };
 
 #
+# Match a USB device type
+#
+notify 0 {
+	match "system"			"USB";
+	match "subsystem"		"INTERFACE";
+	match "type"			"ATTACH";
+	match "intclass"		"0x0e";
+	action "logger USB video device attached";
+};
+
+#
 # Try to configure ath and wi devices with pccard_ether
 # as they are attached.
 #

From owner-svn-src-head@FreeBSD.ORG  Thu Apr 22 21:31:35 2010
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 9E412106566C;
	Thu, 22 Apr 2010 21:31:35 +0000 (UTC)
	(envelope-from thompsa@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 8894E8FC0A;
	Thu, 22 Apr 2010 21:31:35 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o3MLVZ2o097527;
	Thu, 22 Apr 2010 21:31:35 GMT (envelope-from thompsa@svn.freebsd.org)
Received: (from thompsa@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o3MLVYj2097482;
	Thu, 22 Apr 2010 21:31:34 GMT (envelope-from thompsa@svn.freebsd.org)
Message-Id: <201004222131.o3MLVYj2097482@svn.freebsd.org>
From: Andrew Thompson 
Date: Thu, 22 Apr 2010 21:31:34 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r207077 - in head/sys: amd64/conf arm/conf
	dev/sound/usb dev/usb dev/usb/controller dev/usb/input
	dev/usb/misc dev/usb/net dev/usb/serial dev/usb/storage
	dev/usb/wlan i386/conf ia64/con...
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 22 Apr 2010 21:31:35 -0000

Author: thompsa
Date: Thu Apr 22 21:31:34 2010
New Revision: 207077
URL: http://svn.freebsd.org/changeset/base/207077

Log:
  Change USB_DEBUG to #ifdef and allow it to be turned off. Previously this had
  the illusion of a tunable setting but was always turned on regardless.
  
  MFC after:	1 week

Modified:
  head/sys/amd64/conf/GENERIC
  head/sys/arm/conf/DB-78XXX
  head/sys/arm/conf/DB-88F5XXX
  head/sys/arm/conf/DB-88F6XXX
  head/sys/arm/conf/HL200
  head/sys/arm/conf/KB920X
  head/sys/arm/conf/LN2410SBC
  head/sys/arm/conf/SHEEVAPLUG
  head/sys/dev/sound/usb/uaudio.c
  head/sys/dev/usb/controller/ehci.c
  head/sys/dev/usb/controller/uhci.c
  head/sys/dev/usb/controller/uss820dci.c
  head/sys/dev/usb/input/atp.c
  head/sys/dev/usb/input/uhid.c
  head/sys/dev/usb/input/ukbd.c
  head/sys/dev/usb/input/ums.c
  head/sys/dev/usb/misc/udbp.c
  head/sys/dev/usb/net/if_aue.c
  head/sys/dev/usb/net/if_axe.c
  head/sys/dev/usb/net/if_cdce.c
  head/sys/dev/usb/net/if_cue.c
  head/sys/dev/usb/net/if_kue.c
  head/sys/dev/usb/net/if_rue.c
  head/sys/dev/usb/net/if_udav.c
  head/sys/dev/usb/serial/u3g.c
  head/sys/dev/usb/serial/ubsa.c
  head/sys/dev/usb/serial/ubser.c
  head/sys/dev/usb/serial/uchcom.c
  head/sys/dev/usb/serial/uftdi.c
  head/sys/dev/usb/serial/ulpt.c
  head/sys/dev/usb/serial/umodem.c
  head/sys/dev/usb/serial/umoscom.c
  head/sys/dev/usb/serial/uplcom.c
  head/sys/dev/usb/serial/usb_serial.c
  head/sys/dev/usb/serial/uslcom.c
  head/sys/dev/usb/serial/uvisor.c
  head/sys/dev/usb/serial/uvscom.c
  head/sys/dev/usb/storage/umass.c
  head/sys/dev/usb/storage/urio.c
  head/sys/dev/usb/storage/ustorage_fs.c
  head/sys/dev/usb/usb_debug.h
  head/sys/dev/usb/usb_freebsd.h
  head/sys/dev/usb/usb_request.c
  head/sys/dev/usb/usb_transfer.c
  head/sys/dev/usb/wlan/if_rum.c
  head/sys/dev/usb/wlan/if_run.c
  head/sys/dev/usb/wlan/if_ural.c
  head/sys/dev/usb/wlan/if_zyd.c
  head/sys/i386/conf/GENERIC
  head/sys/i386/conf/XBOX
  head/sys/ia64/conf/GENERIC
  head/sys/mips/conf/SENTRY5
  head/sys/mips/conf/XLR
  head/sys/pc98/conf/GENERIC
  head/sys/powerpc/conf/GENERIC
  head/sys/powerpc/conf/MPC85XX
  head/sys/sparc64/conf/GENERIC
  head/sys/sun4v/conf/GENERIC

Modified: head/sys/amd64/conf/GENERIC
==============================================================================
--- head/sys/amd64/conf/GENERIC	Thu Apr 22 21:17:00 2010	(r207076)
+++ head/sys/amd64/conf/GENERIC	Thu Apr 22 21:31:34 2010	(r207077)
@@ -281,6 +281,7 @@ device		firmware	# firmware assist modul
 device		bpf		# Berkeley packet filter
 
 # USB support
+#options 	USB_DEBUG	# enable debug msgs
 device		uhci		# UHCI PCI->USB interface
 device		ohci		# OHCI PCI->USB interface
 device		ehci		# EHCI PCI->USB interface (USB 2.0)

Modified: head/sys/arm/conf/DB-78XXX
==============================================================================
--- head/sys/arm/conf/DB-78XXX	Thu Apr 22 21:17:00 2010	(r207076)
+++ head/sys/arm/conf/DB-78XXX	Thu Apr 22 21:31:34 2010	(r207077)
@@ -67,6 +67,7 @@ device		e1000phy
 device		bpf
 
 # USB
+options 	USB_DEBUG	# enable debug msgs
 device		usb
 device		ehci
 device		umass

Modified: head/sys/arm/conf/DB-88F5XXX
==============================================================================
--- head/sys/arm/conf/DB-88F5XXX	Thu Apr 22 21:17:00 2010	(r207076)
+++ head/sys/arm/conf/DB-88F5XXX	Thu Apr 22 21:31:34 2010	(r207077)
@@ -74,6 +74,7 @@ device		iicbus
 device		ds133x
 
 # USB
+options 	USB_DEBUG	# enable debug msgs
 device		usb
 device		ehci
 device		umass

Modified: head/sys/arm/conf/DB-88F6XXX
==============================================================================
--- head/sys/arm/conf/DB-88F6XXX	Thu Apr 22 21:17:00 2010	(r207076)
+++ head/sys/arm/conf/DB-88F6XXX	Thu Apr 22 21:31:34 2010	(r207077)
@@ -67,6 +67,7 @@ device		e1000phy
 device		bpf
 
 # USB
+options 	USB_DEBUG	# enable debug msgs
 device		usb
 device		ehci
 device		umass

Modified: head/sys/arm/conf/HL200
==============================================================================
--- head/sys/arm/conf/HL200	Thu Apr 22 21:17:00 2010	(r207076)
+++ head/sys/arm/conf/HL200	Thu Apr 22 21:31:34 2010	(r207077)
@@ -95,6 +95,7 @@ device		icee
 
 device		bpf
 # USB support
+options 	USB_DEBUG	# enable debug msgs
 device		ohci		# OHCI localbus->USB interface
 device		usb		# USB Bus (required)
 #device		udbp		# USB Double Bulk Pipe devices

Modified: head/sys/arm/conf/KB920X
==============================================================================
--- head/sys/arm/conf/KB920X	Thu Apr 22 21:17:00 2010	(r207076)
+++ head/sys/arm/conf/KB920X	Thu Apr 22 21:31:34 2010	(r207077)
@@ -96,6 +96,7 @@ device		icee
 
 device		bpf
 # USB support
+options 	USB_DEBUG	# enable debug msgs
 device		ohci		# OHCI localbus->USB interface
 device		usb		# USB Bus (required)
 #device		udbp		# USB Double Bulk Pipe devices

Modified: head/sys/arm/conf/LN2410SBC
==============================================================================
--- head/sys/arm/conf/LN2410SBC	Thu Apr 22 21:17:00 2010	(r207076)
+++ head/sys/arm/conf/LN2410SBC	Thu Apr 22 21:31:34 2010	(r207077)
@@ -79,6 +79,7 @@ options 	WITNESS_SKIPSPIN	#Don't run wit
 
 device		md
 
+options 	USB_DEBUG	# enable debug msgs
 device		usb
 device		ohci
 device		umass

Modified: head/sys/arm/conf/SHEEVAPLUG
==============================================================================
--- head/sys/arm/conf/SHEEVAPLUG	Thu Apr 22 21:17:00 2010	(r207076)
+++ head/sys/arm/conf/SHEEVAPLUG	Thu Apr 22 21:31:34 2010	(r207077)
@@ -61,6 +61,7 @@ options		DEVICE_POLLING
 device		vlan
 
 # USB
+options 	USB_DEBUG	# enable debug msgs
 device		usb
 device		ehci
 device		umass

Modified: head/sys/dev/sound/usb/uaudio.c
==============================================================================
--- head/sys/dev/sound/usb/uaudio.c	Thu Apr 22 21:17:00 2010	(r207076)
+++ head/sys/dev/sound/usb/uaudio.c	Thu Apr 22 21:31:34 2010	(r207077)
@@ -91,7 +91,7 @@ static int uaudio_default_rate = 0;		/* 
 static int uaudio_default_bits = 32;
 static int uaudio_default_channels = 0;		/* use default */
 
-#if USB_DEBUG
+#ifdef USB_DEBUG
 static int uaudio_debug = 0;
 
 SYSCTL_NODE(_hw_usb, OID_AUTO, uaudio, CTLFLAG_RW, 0, "USB uaudio");
@@ -321,7 +321,7 @@ static const struct uaudio_format uaudio
 #define	UAC_RECORD	3
 #define	UAC_NCLASSES	4
 
-#if USB_DEBUG
+#ifdef USB_DEBUG
 static const char *uac_names[] = {
 	"outputs", "inputs", "equalization", "record"
 };
@@ -406,7 +406,7 @@ static void	umidi_init(device_t dev);
 static int32_t	umidi_probe(device_t dev);
 static int32_t	umidi_detach(device_t dev);
 
-#if USB_DEBUG
+#ifdef USB_DEBUG
 static void	uaudio_chan_dump_ep_desc(
 		    const usb_endpoint_descriptor_audio_t *);
 static void	uaudio_mixer_dump_cluster(uint8_t,
@@ -780,7 +780,7 @@ uaudio_detach(device_t dev)
  * AS - Audio Stream - routines
  *========================================================================*/
 
-#if USB_DEBUG
+#ifdef USB_DEBUG
 static void
 uaudio_chan_dump_ep_desc(const usb_endpoint_descriptor_audio_t *ed)
 {
@@ -1019,7 +1019,7 @@ uaudio_chan_fill_info_sub(struct uaudio_
 				if ((chan->valid == 0) && usbd_get_iface(udev, curidx)) {
 
 					chan->valid = 1;
-#if USB_DEBUG
+#ifdef USB_DEBUG
 					uaudio_chan_dump_ep_desc(ed1);
 					uaudio_chan_dump_ep_desc(ed2);
 
@@ -1689,7 +1689,7 @@ uaudio_mixer_add_ctl(struct uaudio_softc
 
 	uaudio_mixer_add_ctl_sub(sc, mc);
 
-#if USB_DEBUG
+#ifdef USB_DEBUG
 	if (uaudio_debug > 2) {
 		uint8_t i;
 
@@ -1708,7 +1708,7 @@ static void
 uaudio_mixer_add_input(struct uaudio_softc *sc,
     const struct uaudio_terminal_node *iot, int id)
 {
-#if USB_DEBUG
+#ifdef USB_DEBUG
 	const struct usb_audio_input_terminal *d = iot[id].u.it;
 
 	DPRINTFN(3, "bTerminalId=%d wTerminalType=0x%04x "
@@ -1724,7 +1724,7 @@ static void
 uaudio_mixer_add_output(struct uaudio_softc *sc,
     const struct uaudio_terminal_node *iot, int id)
 {
-#if USB_DEBUG
+#ifdef USB_DEBUG
 	const struct usb_audio_output_terminal *d = iot[id].u.ot;
 
 	DPRINTFN(3, "bTerminalId=%d wTerminalType=0x%04x "
@@ -2257,7 +2257,7 @@ error:
 	return (NULL);
 }
 
-#if USB_DEBUG
+#ifdef USB_DEBUG
 static void
 uaudio_mixer_dump_cluster(uint8_t id, const struct uaudio_terminal_node *iot)
 {
@@ -2350,7 +2350,7 @@ done:
 	return (r);
 }
 
-#if USB_DEBUG
+#ifdef USB_DEBUG
 
 struct uaudio_tt_to_string {
 	uint16_t terminal_type;
@@ -2856,7 +2856,7 @@ uaudio_mixer_fill_info(struct uaudio_sof
 		(iot + i)->root = iot;
 	} while (i--);
 
-#if USB_DEBUG
+#ifdef USB_DEBUG
 	i = ID_max;
 	do {
 		uint8_t j;

Modified: head/sys/dev/usb/controller/ehci.c
==============================================================================
--- head/sys/dev/usb/controller/ehci.c	Thu Apr 22 21:17:00 2010	(r207076)
+++ head/sys/dev/usb/controller/ehci.c	Thu Apr 22 21:31:34 2010	(r207077)
@@ -89,7 +89,7 @@ __FBSDID("$FreeBSD$");
    ((ehci_softc_t *)(((uint8_t *)(bus)) - \
     ((uint8_t *)&(((ehci_softc_t *)0)->sc_bus))))
 
-#if USB_DEBUG
+#ifdef USB_DEBUG
 static int ehcidebug = 0;
 static int ehcinohighspeed = 0;
 static int ehciiaadbug = 0;
@@ -258,7 +258,7 @@ ehci_init(ehci_softc_t *sc)
 	usb_callout_init_mtx(&sc->sc_tmo_pcd, &sc->sc_bus.bus_mtx, 0);
 	usb_callout_init_mtx(&sc->sc_tmo_poll, &sc->sc_bus.bus_mtx, 0);
 
-#if USB_DEBUG
+#ifdef USB_DEBUG
 	if (ehciiaadbug)
 		sc->sc_flags |= EHCI_SCFLG_IAADBUG;
 	if (ehcilostintrbug)
@@ -486,7 +486,7 @@ ehci_init(ehci_softc_t *sc)
 
 	usb_bus_mem_flush_all(&sc->sc_bus, &ehci_iterate_hw_softc);
 
-#if USB_DEBUG
+#ifdef USB_DEBUG
 	if (ehcidebug) {
 		ehci_dump_sqh(sc, sc->sc_async_p_last);
 	}
@@ -685,7 +685,7 @@ ehci_shutdown(ehci_softc_t *sc)
 	}
 }
 
-#if USB_DEBUG
+#ifdef USB_DEBUG
 static void
 ehci_dump_regs(ehci_softc_t *sc)
 {
@@ -1229,7 +1229,7 @@ ehci_non_isoc_done_sub(struct usb_xfer *
 
 	xfer->td_transfer_cache = td;
 
-#if USB_DEBUG
+#ifdef USB_DEBUG
 	if (status & EHCI_QTD_STATERRS) {
 		DPRINTFN(11, "error, addr=%d, endpt=0x%02x, frame=0x%02x"
 		    "status=%s%s%s%s%s%s%s%s\n",
@@ -1260,7 +1260,7 @@ ehci_non_isoc_done(struct usb_xfer *xfer
 	DPRINTFN(13, "xfer=%p endpoint=%p transfer done\n",
 	    xfer, xfer->endpoint);
 
-#if USB_DEBUG
+#ifdef USB_DEBUG
 	if (ehcidebug > 10) {
 		ehci_softc_t *sc = EHCI_BUS2SC(xfer->xroot->bus);
 
@@ -1527,7 +1527,7 @@ ehci_interrupt(ehci_softc_t *sc)
 
 	DPRINTFN(16, "real interrupt\n");
 
-#if USB_DEBUG
+#ifdef USB_DEBUG
 	if (ehcidebug > 15) {
 		ehci_dump_regs(sc);
 	}
@@ -1548,7 +1548,7 @@ ehci_interrupt(ehci_softc_t *sc)
 	if (status & EHCI_STS_HSE) {
 		printf("%s: unrecoverable error, "
 		    "controller halted\n", __FUNCTION__);
-#if USB_DEBUG
+#ifdef USB_DEBUG
 		ehci_dump_regs(sc);
 		ehci_dump_isoc(sc);
 #endif
@@ -1978,7 +1978,7 @@ ehci_setup_standard_chain(struct usb_xfe
 
 	xfer->td_transfer_last = td;
 
-#if USB_DEBUG
+#ifdef USB_DEBUG
 	if (ehcidebug > 8) {
 		DPRINTF("nexttog=%d; data before transfer:\n",
 		    xfer->endpoint->toggle_next);
@@ -2106,7 +2106,7 @@ ehci_isoc_fs_done(ehci_softc_t *sc, stru
 		if (pp_last >= &sc->sc_isoc_fs_p_last[EHCI_VIRTUAL_FRAMELIST_COUNT]) {
 			pp_last = &sc->sc_isoc_fs_p_last[0];
 		}
-#if USB_DEBUG
+#ifdef USB_DEBUG
 		if (ehcidebug > 15) {
 			DPRINTF("isoc FS-TD\n");
 			ehci_dump_sitd(sc, td);
@@ -2160,7 +2160,7 @@ ehci_isoc_hs_done(ehci_softc_t *sc, stru
 		if (pp_last >= &sc->sc_isoc_hs_p_last[EHCI_VIRTUAL_FRAMELIST_COUNT]) {
 			pp_last = &sc->sc_isoc_hs_p_last[0];
 		}
-#if USB_DEBUG
+#ifdef USB_DEBUG
 		if (ehcidebug > 15) {
 			DPRINTF("isoc HS-TD\n");
 			ehci_dump_itd(sc, td);
@@ -2224,7 +2224,7 @@ ehci_device_done(struct usb_xfer *xfer, 
 
 	if ((methods == &ehci_device_bulk_methods) ||
 	    (methods == &ehci_device_ctrl_methods)) {
-#if USB_DEBUG
+#ifdef USB_DEBUG
 		if (ehcidebug > 8) {
 			DPRINTF("nexttog=%d; data after transfer:\n",
 			    xfer->endpoint->toggle_next);
@@ -2509,7 +2509,7 @@ ehci_device_isoc_fs_enter(struct usb_xfe
 	uint8_t sb;
 	uint8_t error;
 
-#if USB_DEBUG
+#ifdef USB_DEBUG
 	uint8_t once = 1;
 
 #endif
@@ -2593,7 +2593,7 @@ ehci_device_isoc_fs_enter(struct usb_xfe
 		/* reuse sitd_portaddr and sitd_back from last transfer */
 
 		if (*plen > xfer->max_frame_size) {
-#if USB_DEBUG
+#ifdef USB_DEBUG
 			if (once) {
 				once = 0;
 				printf("%s: frame length(%d) exceeds %d "
@@ -2683,7 +2683,7 @@ ehci_device_isoc_fs_enter(struct usb_xfe
 		}
 		usb_pc_cpu_flush(td->page_cache);
 
-#if USB_DEBUG
+#ifdef USB_DEBUG
 		if (ehcidebug > 15) {
 			DPRINTF("FS-TD %d\n", nframes);
 			ehci_dump_sitd(sc, td);
@@ -2800,7 +2800,7 @@ ehci_device_isoc_hs_enter(struct usb_xfe
 	uint8_t td_no;
 	uint8_t page_no;
 
-#if USB_DEBUG
+#ifdef USB_DEBUG
 	uint8_t once = 1;
 
 #endif
@@ -2878,7 +2878,7 @@ ehci_device_isoc_hs_enter(struct usb_xfe
 		}
 		/* range check */
 		if (*plen > xfer->max_frame_size) {
-#if USB_DEBUG
+#ifdef USB_DEBUG
 			if (once) {
 				once = 0;
 				printf("%s: frame length(%d) exceeds %d bytes "
@@ -2962,7 +2962,7 @@ ehci_device_isoc_hs_enter(struct usb_xfe
 				td->itd_status[td_no - 1] |= htohc32(sc, EHCI_ITD_IOC);
 			}
 			usb_pc_cpu_flush(td->page_cache);
-#if USB_DEBUG
+#ifdef USB_DEBUG
 			if (ehcidebug > 15) {
 				DPRINTF("HS-TD %d\n", nframes);
 				ehci_dump_itd(sc, td);
@@ -3398,7 +3398,7 @@ ehci_roothub_exec(struct usb_device *ude
 			break;
 		case UHF_PORT_RESET:
 			DPRINTFN(6, "reset port %d\n", index);
-#if USB_DEBUG
+#ifdef USB_DEBUG
 			if (ehcinohighspeed) {
 				/*
 				 * Connect USB device to companion

Modified: head/sys/dev/usb/controller/uhci.c
==============================================================================
--- head/sys/dev/usb/controller/uhci.c	Thu Apr 22 21:17:00 2010	(r207076)
+++ head/sys/dev/usb/controller/uhci.c	Thu Apr 22 21:31:34 2010	(r207077)
@@ -82,7 +82,7 @@ __FBSDID("$FreeBSD$");
    ((uhci_softc_t *)(((uint8_t *)(bus)) - \
     ((uint8_t *)&(((uhci_softc_t *)0)->sc_bus))))
 
-#if USB_DEBUG
+#ifdef USB_DEBUG
 static int uhcidebug = 0;
 static int uhcinoloop = 0;
 
@@ -459,7 +459,7 @@ uhci_init(uhci_softc_t *sc)
 
 	usb_callout_init_mtx(&sc->sc_root_intr, &sc->sc_bus.bus_mtx, 0);
 
-#if USB_DEBUG
+#ifdef USB_DEBUG
 	if (uhcidebug > 2) {
 		uhci_dumpregs(sc);
 	}
@@ -668,7 +668,7 @@ uhci_suspend(uhci_softc_t *sc)
 {
 	USB_BUS_LOCK(&sc->sc_bus);
 
-#if USB_DEBUG
+#ifdef USB_DEBUG
 	if (uhcidebug > 2) {
 		uhci_dumpregs(sc);
 	}
@@ -712,7 +712,7 @@ uhci_resume(uhci_softc_t *sc)
 
 	uhci_start(sc);
 
-#if USB_DEBUG
+#ifdef USB_DEBUG
 	if (uhcidebug > 2) {
 		uhci_dumpregs(sc);
 	}
@@ -724,7 +724,7 @@ uhci_resume(uhci_softc_t *sc)
 	uhci_do_poll(&sc->sc_bus);
 }
 
-#if USB_DEBUG
+#ifdef USB_DEBUG
 static void
 uhci_dumpregs(uhci_softc_t *sc)
 {
@@ -855,7 +855,7 @@ uhci_add_loop(uhci_softc_t *sc)
 	struct uhci_qh *qh_lst;
 	struct uhci_qh *qh_rec;
 
-#if USB_DEBUG
+#ifdef USB_DEBUG
 	if (uhcinoloop) {
 		return;
 	}
@@ -878,7 +878,7 @@ uhci_rem_loop(uhci_softc_t *sc)
 {
 	struct uhci_qh *qh_lst;
 
-#if USB_DEBUG
+#ifdef USB_DEBUG
 	if (uhcinoloop) {
 		return;
 	}
@@ -1046,7 +1046,7 @@ uhci_isoc_done(uhci_softc_t *sc, struct 
 		if (pp_last >= &sc->sc_isoc_p_last[UHCI_VFRAMELIST_COUNT]) {
 			pp_last = &sc->sc_isoc_p_last[0];
 		}
-#if USB_DEBUG
+#ifdef USB_DEBUG
 		if (uhcidebug > 5) {
 			DPRINTF("isoc TD\n");
 			uhci_dump_td(td);
@@ -1177,7 +1177,7 @@ uhci_non_isoc_done_sub(struct usb_xfer *
 
 	xfer->endpoint->toggle_next = (token & UHCI_TD_SET_DT(1)) ? 0 : 1;
 
-#if USB_DEBUG
+#ifdef USB_DEBUG
 	if (status & UHCI_TD_ERROR) {
 		DPRINTFN(11, "error, addr=%d, endpt=0x%02x, frame=0x%02x "
 		    "status=%s%s%s%s%s%s%s%s%s%s%s\n",
@@ -1207,7 +1207,7 @@ uhci_non_isoc_done(struct usb_xfer *xfer
 	DPRINTFN(13, "xfer=%p endpoint=%p transfer done\n",
 	    xfer, xfer->endpoint);
 
-#if USB_DEBUG
+#ifdef USB_DEBUG
 	if (uhcidebug > 10) {
 		uhci_dump_tds(xfer->td_transfer_first);
 	}
@@ -1446,7 +1446,7 @@ uhci_interrupt(uhci_softc_t *sc)
 
 	DPRINTFN(16, "real interrupt\n");
 
-#if USB_DEBUG
+#ifdef USB_DEBUG
 	if (uhcidebug > 15) {
 		uhci_dumpregs(sc);
 	}
@@ -1460,7 +1460,7 @@ uhci_interrupt(uhci_softc_t *sc)
 	    UHCI_STS_HCPE | UHCI_STS_HCH)) {
 
 		if (status & UHCI_STS_RD) {
-#if USB_DEBUG
+#ifdef USB_DEBUG
 			printf("%s: resume detect\n",
 			    __FUNCTION__);
 #endif
@@ -1477,7 +1477,7 @@ uhci_interrupt(uhci_softc_t *sc)
 			/* no acknowledge needed */
 			DPRINTF("%s: host controller halted\n",
 			    __FUNCTION__);
-#if USB_DEBUG
+#ifdef USB_DEBUG
 			if (uhcidebug > 0) {
 				uhci_dump_all(sc);
 			}
@@ -1839,7 +1839,7 @@ uhci_setup_standard_chain(struct usb_xfe
 
 	xfer->td_transfer_last = td;
 
-#if USB_DEBUG
+#ifdef USB_DEBUG
 	if (uhcidebug > 8) {
 		DPRINTF("nexttog=%d; data before transfer:\n",
 		    xfer->endpoint->toggle_next);
@@ -2155,7 +2155,7 @@ uhci_device_isoc_enter(struct usb_xfer *
 	uint32_t temp;
 	uint32_t *plen;
 
-#if USB_DEBUG
+#ifdef USB_DEBUG
 	uint8_t once = 1;
 
 #endif
@@ -2227,7 +2227,7 @@ uhci_device_isoc_enter(struct usb_xfer *
 			pp_last = &sc->sc_isoc_p_last[0];
 		}
 		if (*plen > xfer->max_frame_size) {
-#if USB_DEBUG
+#ifdef USB_DEBUG
 			if (once) {
 				once = 0;
 				printf("%s: frame length(%d) exceeds %d "
@@ -2279,7 +2279,7 @@ uhci_device_isoc_enter(struct usb_xfer *
 
 		usb_pc_cpu_flush(td->page_cache);
 
-#if USB_DEBUG
+#ifdef USB_DEBUG
 		if (uhcidebug > 5) {
 			DPRINTF("TD %d\n", nframes);
 			uhci_dump_td(td);

Modified: head/sys/dev/usb/controller/uss820dci.c
==============================================================================
--- head/sys/dev/usb/controller/uss820dci.c	Thu Apr 22 21:17:00 2010	(r207076)
+++ head/sys/dev/usb/controller/uss820dci.c	Thu Apr 22 21:31:34 2010	(r207077)
@@ -77,7 +77,7 @@
 #define	USS820_DCI_PC2SC(pc) \
    USS820_DCI_BUS2SC(USB_DMATAG_TO_XROOT((pc)->tag_parent)->bus)
 
-#if USB_DEBUG
+#ifdef USB_DEBUG
 static int uss820dcidebug = 0;
 
 SYSCTL_NODE(_hw_usb, OID_AUTO, uss820dci, CTLFLAG_RW, 0, "USB uss820dci");

Modified: head/sys/dev/usb/input/atp.c
==============================================================================
--- head/sys/dev/usb/input/atp.c	Thu Apr 22 21:17:00 2010	(r207076)
+++ head/sys/dev/usb/input/atp.c	Thu Apr 22 21:31:34 2010	(r207077)
@@ -116,7 +116,7 @@ __FBSDID("$FreeBSD$");
 /* Tunables */
 SYSCTL_NODE(_hw_usb, OID_AUTO, atp, CTLFLAG_RW, 0, "USB atp");
 
-#if USB_DEBUG
+#ifdef USB_DEBUG
 enum atp_log_level {
 	ATP_LLEVEL_DISABLED = 0,
 	ATP_LLEVEL_ERROR,
@@ -126,7 +126,7 @@ enum atp_log_level {
 static int atp_debug = ATP_LLEVEL_ERROR; /* the default is to only log errors */
 SYSCTL_INT(_hw_usb_atp, OID_AUTO, debug, CTLFLAG_RW,
     &atp_debug, ATP_LLEVEL_ERROR, "ATP debug level");
-#endif /* #if USB_DEBUG */
+#endif /* USB_DEBUG */
 
 static u_int atp_touch_timeout = ATP_TOUCH_TIMEOUT;
 SYSCTL_INT(_hw_usb_atp, OID_AUTO, touch_timeout, CTLFLAG_RW, &atp_touch_timeout,
@@ -1055,7 +1055,7 @@ atp_update_strokes(struct atp_softc *sc,
 		if (pspans_y[j].matched == FALSE) break;
 	}
 	if ((i < n_xpspans) && (j < n_ypspans)) {
-#if USB_DEBUG
+#ifdef USB_DEBUG
 		if (atp_debug >= ATP_LLEVEL_INFO) {
 			printf("unmatched pspans:");
 			for (; i < n_xpspans; i++) {
@@ -1072,7 +1072,7 @@ atp_update_strokes(struct atp_softc *sc,
 			}
 			printf("\n");
 		}
-#endif /* #if USB_DEBUG */
+#endif /* USB_DEBUG */
 		if ((n_xpspans == 1) && (n_ypspans == 1))
 			/* The common case of a single pair of new pspans. */
 			atp_add_stroke(sc, &pspans_x[0], &pspans_y[0]);
@@ -1082,7 +1082,7 @@ atp_update_strokes(struct atp_softc *sc,
 			    pspans_y, n_ypspans);
 	}
 
-#if USB_DEBUG
+#ifdef USB_DEBUG
 	if (atp_debug >= ATP_LLEVEL_INFO) {
 		for (i = 0; i < sc->sc_n_strokes; i++) {
 			atp_stroke *stroke = &sc->sc_strokes[i];
@@ -1110,7 +1110,7 @@ atp_update_strokes(struct atp_softc *sc,
 		if (sc->sc_n_strokes)
 			printf("\n");
 	}
-#endif /* #if USB_DEBUG */
+#endif /* USB_DEBUG */
 
 	return (movement);
 }

Modified: head/sys/dev/usb/input/uhid.c
==============================================================================
--- head/sys/dev/usb/input/uhid.c	Thu Apr 22 21:17:00 2010	(r207076)
+++ head/sys/dev/usb/input/uhid.c	Thu Apr 22 21:31:34 2010	(r207077)
@@ -76,7 +76,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 
-#if USB_DEBUG
+#ifdef USB_DEBUG
 static int uhid_debug = 0;
 
 SYSCTL_NODE(_hw_usb, OID_AUTO, uhid, CTLFLAG_RW, 0, "USB uhid");

Modified: head/sys/dev/usb/input/ukbd.c
==============================================================================
--- head/sys/dev/usb/input/ukbd.c	Thu Apr 22 21:17:00 2010	(r207076)
+++ head/sys/dev/usb/input/ukbd.c	Thu Apr 22 21:31:34 2010	(r207077)
@@ -88,7 +88,7 @@ __FBSDID("$FreeBSD$");
 /* the following file must be included after "ukbdmap.h" */
 #include 
 
-#if USB_DEBUG
+#ifdef USB_DEBUG
 static int ukbd_debug = 0;
 static int ukbd_no_leds = 0;
 
@@ -612,7 +612,7 @@ ukbd_intr_callback(struct usb_xfer *xfer
 				apple_fn = 1;
 			else
 				apple_fn = 0;
-#if USB_DEBUG
+#ifdef USB_DEBUG
 			DPRINTF("apple_eject=%u apple_fn=%u\n",
 			    apple_eject, apple_fn);
 
@@ -678,7 +678,7 @@ ukbd_set_leds_callback(struct usb_xfer *
 	uint8_t buf[2];
 	struct ukbd_softc *sc = usbd_xfer_softc(xfer);
 
-#if USB_DEBUG
+#ifdef USB_DEBUG
 	if (ukbd_no_leds)
 		return;
 #endif

Modified: head/sys/dev/usb/input/ums.c
==============================================================================
--- head/sys/dev/usb/input/ums.c	Thu Apr 22 21:17:00 2010	(r207076)
+++ head/sys/dev/usb/input/ums.c	Thu Apr 22 21:31:34 2010	(r207077)
@@ -74,7 +74,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 
-#if USB_DEBUG
+#ifdef USB_DEBUG
 static int ums_debug = 0;
 
 SYSCTL_NODE(_hw_usb, OID_AUTO, ums, CTLFLAG_RW, 0, "USB ums");
@@ -494,7 +494,9 @@ ums_attach(device_t dev)
 	int err;
 	uint16_t d_len;
 	uint8_t i;
+#ifdef USB_DEBUG
 	uint8_t j;
+#endif
 
 	DPRINTFN(11, "sc=%p\n", sc);
 
@@ -588,7 +590,7 @@ ums_attach(device_t dev)
 	free(d_ptr, M_TEMP);
 	d_ptr = NULL;
 
-#if USB_DEBUG
+#ifdef USB_DEBUG
 	for (j = 0; j < UMS_INFO_MAX; j++) {
 		info = &sc->sc_info[j];
 

Modified: head/sys/dev/usb/misc/udbp.c
==============================================================================
--- head/sys/dev/usb/misc/udbp.c	Thu Apr 22 21:17:00 2010	(r207076)
+++ head/sys/dev/usb/misc/udbp.c	Thu Apr 22 21:31:34 2010	(r207077)
@@ -94,7 +94,7 @@ __FBSDID("$FreeBSD$");
 
 #include 
 
-#if USB_DEBUG
+#ifdef USB_DEBUG
 static int udbp_debug = 0;
 
 SYSCTL_NODE(_hw_usb, OID_AUTO, udbp, CTLFLAG_RW, 0, "USB udbp");

Modified: head/sys/dev/usb/net/if_aue.c
==============================================================================
--- head/sys/dev/usb/net/if_aue.c	Thu Apr 22 21:17:00 2010	(r207076)
+++ head/sys/dev/usb/net/if_aue.c	Thu Apr 22 21:31:34 2010	(r207077)
@@ -100,7 +100,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 
-#if USB_DEBUG
+#ifdef USB_DEBUG
 static int aue_debug = 0;
 
 SYSCTL_NODE(_hw_usb, OID_AUTO, aue, CTLFLAG_RW, 0, "USB aue");

Modified: head/sys/dev/usb/net/if_axe.c
==============================================================================
--- head/sys/dev/usb/net/if_axe.c	Thu Apr 22 21:17:00 2010	(r207076)
+++ head/sys/dev/usb/net/if_axe.c	Thu Apr 22 21:31:34 2010	(r207077)
@@ -123,7 +123,7 @@ __FBSDID("$FreeBSD$");
  */
 #define AXE_178_MAX_FRAME_BURST	1
 
-#if USB_DEBUG
+#ifdef USB_DEBUG
 static int axe_debug = 0;
 
 SYSCTL_NODE(_hw_usb, OID_AUTO, axe, CTLFLAG_RW, 0, "USB axe");

Modified: head/sys/dev/usb/net/if_cdce.c
==============================================================================
--- head/sys/dev/usb/net/if_cdce.c	Thu Apr 22 21:17:00 2010	(r207076)
+++ head/sys/dev/usb/net/if_cdce.c	Thu Apr 22 21:31:34 2010	(r207077)
@@ -108,7 +108,7 @@ static uether_fn_t cdce_setpromisc;
 
 static uint32_t	cdce_m_crc32(struct mbuf *, uint32_t, uint32_t);
 
-#if USB_DEBUG
+#ifdef USB_DEBUG
 static int cdce_debug = 0;
 
 SYSCTL_NODE(_hw_usb, OID_AUTO, cdce, CTLFLAG_RW, 0, "USB CDC-Ethernet");

Modified: head/sys/dev/usb/net/if_cue.c
==============================================================================
--- head/sys/dev/usb/net/if_cue.c	Thu Apr 22 21:17:00 2010	(r207076)
+++ head/sys/dev/usb/net/if_cue.c	Thu Apr 22 21:31:34 2010	(r207077)
@@ -122,7 +122,7 @@ static int	cue_getmac(struct cue_softc *
 static uint32_t	cue_mchash(const uint8_t *);
 static void	cue_reset(struct cue_softc *);
 
-#if USB_DEBUG
+#ifdef USB_DEBUG
 static int cue_debug = 0;
 
 SYSCTL_NODE(_hw_usb, OID_AUTO, cue, CTLFLAG_RW, 0, "USB cue");

Modified: head/sys/dev/usb/net/if_kue.c
==============================================================================
--- head/sys/dev/usb/net/if_kue.c	Thu Apr 22 21:17:00 2010	(r207076)
+++ head/sys/dev/usb/net/if_kue.c	Thu Apr 22 21:31:34 2010	(r207077)
@@ -163,7 +163,7 @@ static int	kue_ctl(struct kue_softc *, u
 static int	kue_load_fw(struct kue_softc *);
 static void	kue_reset(struct kue_softc *);
 
-#if USB_DEBUG
+#ifdef USB_DEBUG
 static int kue_debug = 0;
 
 SYSCTL_NODE(_hw_usb, OID_AUTO, kue, CTLFLAG_RW, 0, "USB kue");

Modified: head/sys/dev/usb/net/if_rue.c
==============================================================================
--- head/sys/dev/usb/net/if_rue.c	Thu Apr 22 21:17:00 2010	(r207076)
+++ head/sys/dev/usb/net/if_rue.c	Thu Apr 22 21:31:34 2010	(r207077)
@@ -97,7 +97,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 
-#if USB_DEBUG
+#ifdef USB_DEBUG
 static int rue_debug = 0;
 
 SYSCTL_NODE(_hw_usb, OID_AUTO, rue, CTLFLAG_RW, 0, "USB rue");

Modified: head/sys/dev/usb/net/if_udav.c
==============================================================================
--- head/sys/dev/usb/net/if_udav.c	Thu Apr 22 21:17:00 2010	(r207076)
+++ head/sys/dev/usb/net/if_udav.c	Thu Apr 22 21:31:34 2010	(r207077)
@@ -185,7 +185,7 @@ static const struct usb_ether_methods ud
 	.ue_mii_sts = udav_ifmedia_status,
 };
 
-#if USB_DEBUG
+#ifdef USB_DEBUG
 static int udav_debug = 0;
 
 SYSCTL_NODE(_hw_usb, OID_AUTO, udav, CTLFLAG_RW, 0, "USB udav");

Modified: head/sys/dev/usb/serial/u3g.c
==============================================================================
--- head/sys/dev/usb/serial/u3g.c	Thu Apr 22 21:17:00 2010	(r207076)
+++ head/sys/dev/usb/serial/u3g.c	Thu Apr 22 21:31:34 2010	(r207077)
@@ -63,7 +63,7 @@
 
 #include 
 
-#if USB_DEBUG
+#ifdef USB_DEBUG
 static int u3g_debug = 0;
 
 SYSCTL_NODE(_hw_usb, OID_AUTO, u3g, CTLFLAG_RW, 0, "USB 3g");

Modified: head/sys/dev/usb/serial/ubsa.c
==============================================================================
--- head/sys/dev/usb/serial/ubsa.c	Thu Apr 22 21:17:00 2010	(r207076)
+++ head/sys/dev/usb/serial/ubsa.c	Thu Apr 22 21:31:34 2010	(r207077)
@@ -93,7 +93,7 @@ __FBSDID("$FreeBSD$");
 
 #include 
 
-#if USB_DEBUG
+#ifdef USB_DEBUG
 static int ubsa_debug = 0;
 
 SYSCTL_NODE(_hw_usb, OID_AUTO, ubsa, CTLFLAG_RW, 0, "USB ubsa");
@@ -405,9 +405,8 @@ ubsa_cfg_set_break(struct ucom_softc *uc
 static int
 ubsa_pre_param(struct ucom_softc *ucom, struct termios *t)
 {
-	struct ubsa_softc *sc = ucom->sc_parent;
 
-	DPRINTF("sc = %p\n", sc);
+	DPRINTF("sc = %p\n", ucom->sc_parent);
 
 	switch (t->c_ospeed) {
 	case B0:

Modified: head/sys/dev/usb/serial/ubser.c
==============================================================================
--- head/sys/dev/usb/serial/ubser.c	Thu Apr 22 21:17:00 2010	(r207076)
+++ head/sys/dev/usb/serial/ubser.c	Thu Apr 22 21:31:34 2010	(r207077)
@@ -115,7 +115,7 @@ __FBSDID("$FreeBSD$");
 #define	VENDOR_SET_BREAK		0x02
 #define	VENDOR_CLEAR_BREAK		0x03
 
-#if USB_DEBUG
+#ifdef USB_DEBUG
 static int ubser_debug = 0;
 
 SYSCTL_NODE(_hw_usb, OID_AUTO, ubser, CTLFLAG_RW, 0, "USB ubser");

Modified: head/sys/dev/usb/serial/uchcom.c
==============================================================================
--- head/sys/dev/usb/serial/uchcom.c	Thu Apr 22 21:17:00 2010	(r207076)
+++ head/sys/dev/usb/serial/uchcom.c	Thu Apr 22 21:31:34 2010	(r207077)
@@ -101,7 +101,7 @@ __FBSDID("$FreeBSD$");
 
 #include 
 
-#if USB_DEBUG
+#ifdef USB_DEBUG
 static int uchcom_debug = 0;
 
 SYSCTL_NODE(_hw_usb, OID_AUTO, uchcom, CTLFLAG_RW, 0, "USB uchcom");

Modified: head/sys/dev/usb/serial/uftdi.c
==============================================================================
--- head/sys/dev/usb/serial/uftdi.c	Thu Apr 22 21:17:00 2010	(r207076)
+++ head/sys/dev/usb/serial/uftdi.c	Thu Apr 22 21:31:34 2010	(r207077)
@@ -73,7 +73,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 
-#if USB_DEBUG
+#ifdef USB_DEBUG
 static int uftdi_debug = 0;
 
 SYSCTL_NODE(_hw_usb, OID_AUTO, uftdi, CTLFLAG_RW, 0, "USB uftdi");

Modified: head/sys/dev/usb/serial/ulpt.c
==============================================================================
--- head/sys/dev/usb/serial/ulpt.c	Thu Apr 22 21:17:00 2010	(r207076)
+++ head/sys/dev/usb/serial/ulpt.c	Thu Apr 22 21:31:34 2010	(r207077)
@@ -72,7 +72,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 
-#if USB_DEBUG
+#ifdef USB_DEBUG
 static int ulpt_debug = 0;
 
 SYSCTL_NODE(_hw_usb, OID_AUTO, ulpt, CTLFLAG_RW, 0, "USB ulpt");

Modified: head/sys/dev/usb/serial/umodem.c
==============================================================================
--- head/sys/dev/usb/serial/umodem.c	Thu Apr 22 21:17:00 2010	(r207076)
+++ head/sys/dev/usb/serial/umodem.c	Thu Apr 22 21:31:34 2010	(r207077)
@@ -116,7 +116,7 @@ __FBSDID("$FreeBSD$");
 
 #include 
 
-#if USB_DEBUG
+#ifdef USB_DEBUG
 static int umodem_debug = 0;
 
 SYSCTL_NODE(_hw_usb, OID_AUTO, umodem, CTLFLAG_RW, 0, "USB umodem");

Modified: head/sys/dev/usb/serial/umoscom.c
==============================================================================
--- head/sys/dev/usb/serial/umoscom.c	Thu Apr 22 21:17:00 2010	(r207076)
+++ head/sys/dev/usb/serial/umoscom.c	Thu Apr 22 21:31:34 2010	(r207077)
@@ -48,7 +48,7 @@
 
 #include 
 
-#if USB_DEBUG
+#ifdef USB_DEBUG
 static int umoscom_debug = 0;
 
 SYSCTL_NODE(_hw_usb, OID_AUTO, umoscom, CTLFLAG_RW, 0, "USB umoscom");

Modified: head/sys/dev/usb/serial/uplcom.c
==============================================================================
--- head/sys/dev/usb/serial/uplcom.c	Thu Apr 22 21:17:00 2010	(r207076)
+++ head/sys/dev/usb/serial/uplcom.c	Thu Apr 22 21:31:34 2010	(r207077)
@@ -116,7 +116,7 @@ __FBSDID("$FreeBSD$");
 
 #include 
 
-#if USB_DEBUG
+#ifdef USB_DEBUG
 static int uplcom_debug = 0;
 
 SYSCTL_NODE(_hw_usb, OID_AUTO, uplcom, CTLFLAG_RW, 0, "USB uplcom");

Modified: head/sys/dev/usb/serial/usb_serial.c
==============================================================================
--- head/sys/dev/usb/serial/usb_serial.c	Thu Apr 22 21:17:00 2010	(r207076)
+++ head/sys/dev/usb/serial/usb_serial.c	Thu Apr 22 21:31:34 2010	(r207077)
@@ -104,7 +104,7 @@ __FBSDID("$FreeBSD$");
 
 SYSCTL_NODE(_hw_usb, OID_AUTO, ucom, CTLFLAG_RW, 0, "USB ucom");
 
-#if USB_DEBUG
+#ifdef USB_DEBUG
 static int ucom_debug = 0;
 
 SYSCTL_INT(_hw_usb_ucom, OID_AUTO, debug, CTLFLAG_RW,

Modified: head/sys/dev/usb/serial/uslcom.c
==============================================================================
--- head/sys/dev/usb/serial/uslcom.c	Thu Apr 22 21:17:00 2010	(r207076)
+++ head/sys/dev/usb/serial/uslcom.c	Thu Apr 22 21:31:34 2010	(r207077)
@@ -50,7 +50,7 @@ __FBSDID("$FreeBSD$");
 
 #include 
 
-#if USB_DEBUG
+#ifdef USB_DEBUG
 static int uslcom_debug = 0;
 
 SYSCTL_NODE(_hw_usb, OID_AUTO, uslcom, CTLFLAG_RW, 0, "USB uslcom");

Modified: head/sys/dev/usb/serial/uvisor.c
==============================================================================
--- head/sys/dev/usb/serial/uvisor.c	Thu Apr 22 21:17:00 2010	(r207076)
+++ head/sys/dev/usb/serial/uvisor.c	Thu Apr 22 21:31:34 2010	(r207077)
@@ -78,7 +78,7 @@
 
 #include 
 
-#if USB_DEBUG
+#ifdef USB_DEBUG
 static int uvisor_debug = 0;
 
 SYSCTL_NODE(_hw_usb, OID_AUTO, uvisor, CTLFLAG_RW, 0, "USB uvisor");
@@ -392,7 +392,7 @@ uvisor_init(struct uvisor_softc *sc, str
 			goto done;
 		}
 	}
-#if USB_DEBUG
+#ifdef USB_DEBUG
 	if (sc->sc_flag & UVISOR_FLAG_VISOR) {
 		uint16_t i, np;
 		const char *desc;

Modified: head/sys/dev/usb/serial/uvscom.c
==============================================================================
--- head/sys/dev/usb/serial/uvscom.c	Thu Apr 22 21:17:00 2010	(r207076)
+++ head/sys/dev/usb/serial/uvscom.c	Thu Apr 22 21:31:34 2010	(r207077)
@@ -68,7 +68,7 @@ __FBSDID("$FreeBSD$");
 
 #include 
 
-#if USB_DEBUG
+#ifdef USB_DEBUG
 static int uvscom_debug = 0;
 
 SYSCTL_NODE(_hw_usb, OID_AUTO, uvscom, CTLFLAG_RW, 0, "USB uvscom");

Modified: head/sys/dev/usb/storage/umass.c
==============================================================================
--- head/sys/dev/usb/storage/umass.c	Thu Apr 22 21:17:00 2010	(r207076)
+++ head/sys/dev/usb/storage/umass.c	Thu Apr 22 21:31:34 2010	(r207077)
@@ -146,7 +146,7 @@ __FBSDID("$FreeBSD$");
 #define	UMASS_USB_FLAGS
 #endif
 
-#if USB_DEBUG
+#ifdef USB_DEBUG
 #define	DIF(m, x)				\
   do {						\
     if (umass_debug & (m)) { x ; }		\
@@ -488,7 +488,7 @@ static uint8_t	umass_no_transform(struct
 static uint8_t	umass_std_transform(struct umass_softc *, union ccb *, uint8_t
 		    *, uint8_t);
 
-#if USB_DEBUG
+#ifdef USB_DEBUG
 static void	umass_bbb_dump_cbw(struct umass_softc *, umass_bbb_cbw_t *);
 static void	umass_bbb_dump_csw(struct umass_softc *, umass_bbb_csw_t *);
 static void	umass_cbi_dump_cmd(struct umass_softc *, void *, uint8_t);
@@ -917,7 +917,7 @@ umass_attach(device_t dev)
 	}
 	sc->sc_iface_no = id->bInterfaceNumber;
 
-#if USB_DEBUG
+#ifdef USB_DEBUG
 	device_printf(dev, " ");
 
 	switch (sc->sc_proto & UMASS_PROTO_COMMAND) {
@@ -3012,7 +3012,7 @@ umass_std_transform(struct umass_softc *
 	return (1);
 }
 
-#if USB_DEBUG
+#ifdef USB_DEBUG
 static void
 umass_bbb_dump_cbw(struct umass_softc *sc, umass_bbb_cbw_t *cbw)
 {

Modified: head/sys/dev/usb/storage/urio.c
==============================================================================
--- head/sys/dev/usb/storage/urio.c	Thu Apr 22 21:17:00 2010	(r207076)
+++ head/sys/dev/usb/storage/urio.c	Thu Apr 22 21:31:34 2010	(r207077)
@@ -78,7 +78,7 @@ __FBSDID("$FreeBSD$");
 
 #include 
 
-#if USB_DEBUG
+#ifdef USB_DEBUG
 static int urio_debug = 0;
 
 SYSCTL_NODE(_hw_usb, OID_AUTO, urio, CTLFLAG_RW, 0, "USB urio");

Modified: head/sys/dev/usb/storage/ustorage_fs.c
==============================================================================
--- head/sys/dev/usb/storage/ustorage_fs.c	Thu Apr 22 21:17:00 2010	(r207076)
+++ head/sys/dev/usb/storage/ustorage_fs.c	Thu Apr 22 21:31:34 2010	(r207077)
@@ -64,7 +64,7 @@
 #define	USB_DEBUG_VAR ustorage_fs_debug
 #include 
 
-#if USB_DEBUG
+#ifdef USB_DEBUG
 static int ustorage_fs_debug = 0;
 
 SYSCTL_NODE(_hw_usb, OID_AUTO, ustorage_fs, CTLFLAG_RW, 0, "USB ustorage_fs");

Modified: head/sys/dev/usb/usb_debug.h
==============================================================================
--- head/sys/dev/usb/usb_debug.h	Thu Apr 22 21:17:00 2010	(r207076)
+++ head/sys/dev/usb/usb_debug.h	Thu Apr 22 21:31:34 2010	(r207077)
@@ -34,7 +34,7 @@ extern int usb_debug;
 
 /* Check if USB debugging is enabled. */
 #ifdef USB_DEBUG_VAR
-#if (USB_DEBUG != 0)
+#ifdef USB_DEBUG
 #define	DPRINTFN(n,fmt,...) do {		\
   if ((USB_DEBUG_VAR) >= (n)) {			\
     printf("%s: " fmt,				\

Modified: head/sys/dev/usb/usb_freebsd.h
==============================================================================
--- head/sys/dev/usb/usb_freebsd.h	Thu Apr 22 21:17:00 2010	(r207076)
+++ head/sys/dev/usb/usb_freebsd.h	Thu Apr 22 21:31:34 2010	(r207077)
@@ -57,10 +57,6 @@
 #define	USB_HUB_MAX_DEPTH	5
 #define	USB_EP0_BUFSIZE		1024	/* bytes */
 
-#ifndef USB_DEBUG
-#define USB_DEBUG 1
-#endif
-
 typedef uint32_t usb_timeout_t;		/* milliseconds */
 typedef uint32_t usb_frlength_t;	/* bytes */
 typedef uint32_t usb_frcount_t;		/* units */

Modified: head/sys/dev/usb/usb_request.c
==============================================================================
--- head/sys/dev/usb/usb_request.c	Thu Apr 22 21:17:00 2010	(r207076)
+++ head/sys/dev/usb/usb_request.c	Thu Apr 22 21:31:34 2010	(r207077)
@@ -68,7 +68,7 @@
 #include 
 #include 
 
-#if USB_DEBUG
+#ifdef USB_DEBUG
 static int usb_pr_poll_delay = USB_PORT_RESET_DELAY;
 static int usb_pr_recovery_delay = USB_PORT_RESET_RECOVERY;
 static int usb_ss_delay = 0;
@@ -433,7 +433,7 @@ usbd_do_request_flags(struct usb_device 
 		} else {
 			if (xfer->frlengths[0] == 0) {
 				if (xfer->flags.manual_status) {
-#if USB_DEBUG
+#ifdef USB_DEBUG
 					int temp;
 

*** DIFF OUTPUT TRUNCATED AT 1000 LINES ***

From owner-svn-src-head@FreeBSD.ORG  Thu Apr 22 21:41:50 2010
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id DB68D106566C;
	Thu, 22 Apr 2010 21:41:50 +0000 (UTC)
	(envelope-from thompsa@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id C984D8FC17;
	Thu, 22 Apr 2010 21:41:50 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o3MLfot7099866;
	Thu, 22 Apr 2010 21:41:50 GMT (envelope-from thompsa@svn.freebsd.org)
Received: (from thompsa@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o3MLfoRj099864;
	Thu, 22 Apr 2010 21:41:50 GMT (envelope-from thompsa@svn.freebsd.org)
Message-Id: <201004222141.o3MLfoRj099864@svn.freebsd.org>
From: Andrew Thompson 
Date: Thu, 22 Apr 2010 21:41:50 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r207078 - head/sys/dev/usb
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 22 Apr 2010 21:41:51 -0000

Author: thompsa
Date: Thu Apr 22 21:41:50 2010
New Revision: 207078
URL: http://svn.freebsd.org/changeset/base/207078

Log:
  Use SX_DUPOK rather than making the string unique.

Modified:
  head/sys/dev/usb/usb_device.c

Modified: head/sys/dev/usb/usb_device.c
==============================================================================
--- head/sys/dev/usb/usb_device.c	Thu Apr 22 21:31:34 2010	(r207077)
+++ head/sys/dev/usb/usb_device.c	Thu Apr 22 21:41:50 2010	(r207078)
@@ -1491,10 +1491,10 @@ usb_alloc_device(device_t parent_dev, st
 		return (NULL);
 	}
 	/* initialise our SX-lock */
-	sx_init(udev->default_sx, "0123456789ABCDEF - USB device SX lock" + depth);
+	sx_init_flags(udev->default_sx, "USB device SX lock", SX_DUPOK);
 
 	/* initialise our SX-lock */
-	sx_init(udev->default_sx + 1, "0123456789ABCDEF - USB config SX lock" + depth);
+	sx_init_flags(udev->default_sx + 1, "USB config SX lock", SX_DUPOK);
 
 	cv_init(udev->default_cv, "WCTRL");
 	cv_init(udev->default_cv + 1, "UGONE");

From owner-svn-src-head@FreeBSD.ORG  Thu Apr 22 22:00:17 2010
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 0A600106564A;
	Thu, 22 Apr 2010 22:00:17 +0000 (UTC)
	(envelope-from thompsa@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id EC3538FC12;
	Thu, 22 Apr 2010 22:00:16 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o3MM0GlW004109;
	Thu, 22 Apr 2010 22:00:16 GMT (envelope-from thompsa@svn.freebsd.org)
Received: (from thompsa@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o3MM0GAQ004103;
	Thu, 22 Apr 2010 22:00:16 GMT (envelope-from thompsa@svn.freebsd.org)
Message-Id: <201004222200.o3MM0GAQ004103@svn.freebsd.org>
From: Andrew Thompson 
Date: Thu, 22 Apr 2010 22:00:16 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r207079 - head/sys/dev/usb
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 22 Apr 2010 22:00:17 -0000

Author: thompsa
Date: Thu Apr 22 22:00:16 2010
New Revision: 207079
URL: http://svn.freebsd.org/changeset/base/207079

Log:
  Properly name the sxlocks, mutexes and condvars.

Modified:
  head/sys/dev/usb/usb_dev.c
  head/sys/dev/usb/usb_device.c
  head/sys/dev/usb/usb_device.h
  head/sys/dev/usb/usb_request.c
  head/sys/dev/usb/usb_transfer.c

Modified: head/sys/dev/usb/usb_dev.c
==============================================================================
--- head/sys/dev/usb/usb_dev.c	Thu Apr 22 21:41:50 2010	(r207078)
+++ head/sys/dev/usb/usb_dev.c	Thu Apr 22 22:00:16 2010	(r207079)
@@ -284,7 +284,7 @@ error:
 		usbd_enum_unlock(cpd->udev);
 
 		if (--(cpd->udev->refcount) == 0) {
-			cv_signal(cpd->udev->default_cv + 1);
+			cv_signal(&cpd->udev->ref_cv);
 		}
 	}
 	mtx_unlock(&usb_ref_lock);
@@ -352,7 +352,7 @@ usb_unref_device(struct usb_cdev_privdat
 	}
 	if (crd->is_uref) {
 		if (--(cpd->udev->refcount) == 0) {
-			cv_signal(cpd->udev->default_cv + 1);
+			cv_signal(&cpd->udev->ref_cv);
 		}
 		crd->is_uref = 0;
 	}
@@ -500,7 +500,7 @@ usb_fifo_create(struct usb_cdev_privdata
 		/* update some fields */
 		f->fifo_index = n + USB_FIFO_TX;
 		f->dev_ep_index = e;
-		f->priv_mtx = udev->default_mtx;
+		f->priv_mtx = &udev->device_mtx;
 		f->priv_sc0 = ep;
 		f->methods = &usb_ugen_methods;
 		f->iface_index = ep->iface_index;
@@ -527,7 +527,7 @@ usb_fifo_create(struct usb_cdev_privdata
 		/* update some fields */
 		f->fifo_index = n + USB_FIFO_RX;
 		f->dev_ep_index = e;
-		f->priv_mtx = udev->default_mtx;
+		f->priv_mtx = &udev->device_mtx;
 		f->priv_sc0 = ep;
 		f->methods = &usb_ugen_methods;
 		f->iface_index = ep->iface_index;

Modified: head/sys/dev/usb/usb_device.c
==============================================================================
--- head/sys/dev/usb/usb_device.c	Thu Apr 22 21:41:50 2010	(r207078)
+++ head/sys/dev/usb/usb_device.c	Thu Apr 22 22:00:16 2010	(r207079)
@@ -655,7 +655,7 @@ usb_config_parse(struct usb_device *udev
 		goto cleanup;
 
 	if (cmd == USB_CFG_INIT) {
-		sx_assert(udev->default_sx + 1, SA_LOCKED);
+		sx_assert(&udev->enum_sx, SA_LOCKED);
 
 		/* check for in-use endpoints */
 
@@ -1062,7 +1062,7 @@ usb_detach_device(struct usb_device *ude
 	}
 	DPRINTFN(4, "udev=%p\n", udev);
 
-	sx_assert(udev->default_sx + 1, SA_LOCKED);
+	sx_assert(&udev->enum_sx, SA_LOCKED);
 
 	/*
 	 * First detach the child to give the child's detach routine a
@@ -1380,7 +1380,7 @@ usb_suspend_resume(struct usb_device *ud
 	}
 	DPRINTFN(4, "udev=%p do_suspend=%d\n", udev, do_suspend);
 
-	sx_assert(udev->default_sx + 1, SA_LOCKED);
+	sx_assert(&udev->enum_sx, SA_LOCKED);
 
 	USB_BUS_LOCK(udev->bus);
 	/* filter the suspend events */
@@ -1419,13 +1419,13 @@ usbd_clear_stall_proc(struct usb_proc_ms
 
 	/* Change lock */
 	USB_BUS_UNLOCK(udev->bus);
-	mtx_lock(udev->default_mtx);
+	mtx_lock(&udev->device_mtx);
 
 	/* Start clear stall callback */
 	usbd_transfer_start(udev->default_xfer[1]);
 
 	/* Change lock */
-	mtx_unlock(udev->default_mtx);
+	mtx_unlock(&udev->device_mtx);
 	USB_BUS_LOCK(udev->bus);
 }
 
@@ -1491,16 +1491,16 @@ usb_alloc_device(device_t parent_dev, st
 		return (NULL);
 	}
 	/* initialise our SX-lock */
-	sx_init_flags(udev->default_sx, "USB device SX lock", SX_DUPOK);
+	sx_init_flags(&udev->ctrl_sx, "USB device SX lock", SX_DUPOK);
 
 	/* initialise our SX-lock */
-	sx_init_flags(udev->default_sx + 1, "USB config SX lock", SX_DUPOK);
+	sx_init_flags(&udev->enum_sx, "USB config SX lock", SX_DUPOK);
 
-	cv_init(udev->default_cv, "WCTRL");
-	cv_init(udev->default_cv + 1, "UGONE");
+	cv_init(&udev->ctrlreq_cv, "WCTRL");
+	cv_init(&udev->ref_cv, "UGONE");
 
 	/* initialise our mutex */
-	mtx_init(udev->default_mtx, "USB device mutex", NULL, MTX_DEF);
+	mtx_init(&udev->device_mtx, "USB device mutex", NULL, MTX_DEF);
 
 	/* initialise generic clear stall */
 	udev->cs_msg[0].hdr.pm_callback = &usbd_clear_stall_proc;
@@ -2005,7 +2005,7 @@ usb_free_device(struct usb_device *udev,
 	mtx_lock(&usb_ref_lock);
 	udev->refcount--;
 	while (udev->refcount != 0) {
-		cv_wait(udev->default_cv + 1, &usb_ref_lock);
+		cv_wait(&udev->ref_cv, &usb_ref_lock);
 	}
 	mtx_unlock(&usb_ref_lock);
 
@@ -2036,13 +2036,13 @@ usb_free_device(struct usb_device *udev,
 	    &udev->cs_msg[0], &udev->cs_msg[1]);
 	USB_BUS_UNLOCK(udev->bus);
 
-	sx_destroy(udev->default_sx);
-	sx_destroy(udev->default_sx + 1);
+	sx_destroy(&udev->ctrl_sx);
+	sx_destroy(&udev->enum_sx);
 
-	cv_destroy(udev->default_cv);
-	cv_destroy(udev->default_cv + 1);
+	cv_destroy(&udev->ctrlreq_cv);
+	cv_destroy(&udev->ref_cv);
 
-	mtx_destroy(udev->default_mtx);
+	mtx_destroy(&udev->device_mtx);
 #if USB_HAVE_UGEN
 	KASSERT(LIST_FIRST(&udev->pd_list) == NULL, ("leaked cdev entries"));
 #endif
@@ -2588,7 +2588,7 @@ usbd_device_attached(struct usb_device *
 void
 usbd_enum_lock(struct usb_device *udev)
 {
-	sx_xlock(udev->default_sx + 1);
+	sx_xlock(&udev->enum_sx);
 	/* 
 	 * NEWBUS LOCK NOTE: We should check if any parent SX locks
 	 * are locked before locking Giant. Else the lock can be
@@ -2603,7 +2603,7 @@ void
 usbd_enum_unlock(struct usb_device *udev)
 {
 	mtx_unlock(&Giant);
-	sx_xunlock(udev->default_sx + 1);
+	sx_xunlock(&udev->enum_sx);
 }
 
 /*
@@ -2614,5 +2614,5 @@ usbd_enum_unlock(struct usb_device *udev
 uint8_t
 usbd_enum_is_locked(struct usb_device *udev)
 {
-	return (sx_xlocked(udev->default_sx + 1));
+	return (sx_xlocked(&udev->enum_sx));
 }

Modified: head/sys/dev/usb/usb_device.h
==============================================================================
--- head/sys/dev/usb/usb_device.h	Thu Apr 22 21:41:50 2010	(r207078)
+++ head/sys/dev/usb/usb_device.h	Thu Apr 22 22:00:16 2010	(r207079)
@@ -113,9 +113,11 @@ struct usb_power_save {
 struct usb_device {
 	struct usb_clear_stall_msg cs_msg[2];	/* generic clear stall
 						 * messages */
-	struct sx default_sx[2];
-	struct mtx default_mtx[1];
-	struct cv default_cv[2];
+	struct sx ctrl_sx;
+	struct sx enum_sx;
+	struct mtx device_mtx;
+	struct cv ctrlreq_cv;
+	struct cv ref_cv;
 	struct usb_interface *ifaces;
 	struct usb_endpoint default_ep;	/* Control Endpoint 0 */
 	struct usb_endpoint *endpoints;

Modified: head/sys/dev/usb/usb_request.c
==============================================================================
--- head/sys/dev/usb/usb_request.c	Thu Apr 22 21:41:50 2010	(r207078)
+++ head/sys/dev/usb/usb_request.c	Thu Apr 22 22:00:16 2010	(r207079)
@@ -99,7 +99,7 @@ usbd_do_request_callback(struct usb_xfer
 		usbd_transfer_submit(xfer);
 		break;
 	default:
-		cv_signal(xfer->xroot->udev->default_cv);
+		cv_signal(&xfer->xroot->udev->ctrlreq_cv);
 		break;
 	}
 }
@@ -319,7 +319,7 @@ usbd_do_request_flags(struct usb_device 
 	 * is achieved when multiple threads are involved:
 	 */
 
-	sx_xlock(udev->default_sx);
+	sx_xlock(&udev->ctrl_sx);
 
 	hr_func = usbd_get_hr_func(udev);
 
@@ -457,7 +457,7 @@ usbd_do_request_flags(struct usb_device 
 		usbd_transfer_start(xfer);
 
 		while (usbd_transfer_pending(xfer)) {
-			cv_wait(udev->default_cv,
+			cv_wait(&udev->ctrlreq_cv,
 			    xfer->xroot->xfer_mtx);
 		}
 
@@ -534,7 +534,7 @@ usbd_do_request_flags(struct usb_device 
 	USB_XFER_UNLOCK(xfer);
 
 done:
-	sx_xunlock(udev->default_sx);
+	sx_xunlock(&udev->ctrl_sx);
 
 	if (mtx) {
 		mtx_lock(mtx);

Modified: head/sys/dev/usb/usb_transfer.c
==============================================================================
--- head/sys/dev/usb/usb_transfer.c	Thu Apr 22 21:41:50 2010	(r207078)
+++ head/sys/dev/usb/usb_transfer.c	Thu Apr 22 22:00:16 2010	(r207079)
@@ -2821,7 +2821,7 @@ repeat:
 	iface_index = 0;
 	if (usbd_transfer_setup(udev, &iface_index,
 	    udev->default_xfer, usb_control_ep_cfg, USB_DEFAULT_XFER_MAX, NULL,
-	    udev->default_mtx)) {
+	    &udev->device_mtx)) {
 		DPRINTFN(0, "could not setup default "
 		    "USB transfer\n");
 	} else {

From owner-svn-src-head@FreeBSD.ORG  Thu Apr 22 22:15:09 2010
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 0ACFE1065672;
	Thu, 22 Apr 2010 22:15:09 +0000 (UTC)
	(envelope-from thompsa@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id EBD558FC1D;
	Thu, 22 Apr 2010 22:15:08 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o3MMF8QQ007491;
	Thu, 22 Apr 2010 22:15:08 GMT (envelope-from thompsa@svn.freebsd.org)
Received: (from thompsa@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o3MMF8ia007481;
	Thu, 22 Apr 2010 22:15:08 GMT (envelope-from thompsa@svn.freebsd.org)
Message-Id: <201004222215.o3MMF8ia007481@svn.freebsd.org>
From: Andrew Thompson 
Date: Thu, 22 Apr 2010 22:15:08 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r207080 - head/sys/dev/usb
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 22 Apr 2010 22:15:09 -0000

Author: thompsa
Date: Thu Apr 22 22:15:08 2010
New Revision: 207080
URL: http://svn.freebsd.org/changeset/base/207080

Log:
  Use a more obvious prefix for the USB control (endpoint 0) transfers rather
  than default_*.

Modified:
  head/sys/dev/usb/usb_compat_linux.c
  head/sys/dev/usb/usb_dev.c
  head/sys/dev/usb/usb_device.c
  head/sys/dev/usb/usb_device.h
  head/sys/dev/usb/usb_generic.c
  head/sys/dev/usb/usb_hub.c
  head/sys/dev/usb/usb_request.c
  head/sys/dev/usb/usb_transfer.c
  head/sys/dev/usb/usb_transfer.h

Modified: head/sys/dev/usb/usb_compat_linux.c
==============================================================================
--- head/sys/dev/usb/usb_compat_linux.c	Thu Apr 22 22:00:16 2010	(r207079)
+++ head/sys/dev/usb/usb_compat_linux.c	Thu Apr 22 22:15:08 2010	(r207080)
@@ -971,7 +971,7 @@ usb_linux_create_usb_device(struct usb_d
 			udev->devnum = device_get_unit(dev);
 			bcopy(&udev->ddesc, &udev->descriptor,
 			    sizeof(udev->descriptor));
-			bcopy(udev->default_ep.edesc, &udev->ep0.desc,
+			bcopy(udev->ctrl_ep.edesc, &udev->ep0.desc,
 			    sizeof(udev->ep0.desc));
 		}
 	}

Modified: head/sys/dev/usb/usb_dev.c
==============================================================================
--- head/sys/dev/usb/usb_dev.c	Thu Apr 22 22:00:16 2010	(r207079)
+++ head/sys/dev/usb/usb_dev.c	Thu Apr 22 22:15:08 2010	(r207080)
@@ -615,7 +615,7 @@ usb_dev_get_ep(struct usb_device *udev, 
 	uint8_t ep_dir;
 
 	if (ep_index == 0) {
-		ep = &udev->default_ep;
+		ep = &udev->ctrl_ep;
 	} else {
 		if (dir == USB_FIFO_RX) {
 			if (udev->flags.usb_mode == USB_MODE_HOST) {

Modified: head/sys/dev/usb/usb_device.c
==============================================================================
--- head/sys/dev/usb/usb_device.c	Thu Apr 22 22:00:16 2010	(r207079)
+++ head/sys/dev/usb/usb_device.c	Thu Apr 22 22:15:08 2010	(r207080)
@@ -179,9 +179,9 @@ usbd_get_ep_by_addr(struct usb_device *u
 	/*
 	 * The default endpoint is always present and is checked separately:
 	 */
-	if ((udev->default_ep.edesc) &&
-	    ((udev->default_ep.edesc->bEndpointAddress & EA_MASK) == ea_val)) {
-		ep = &udev->default_ep;
+	if ((udev->ctrl_ep.edesc) &&
+	    ((udev->ctrl_ep.edesc->bEndpointAddress & EA_MASK) == ea_val)) {
+		ep = &udev->ctrl_ep;
 		goto found;
 	}
 	return (NULL);
@@ -297,11 +297,11 @@ usbd_get_endpoint(struct usb_device *ude
 	 * address" and "any direction" returns the first endpoint of the
 	 * interface. "iface_index" and "direction" is ignored:
 	 */
-	if ((udev->default_ep.edesc) &&
-	    ((udev->default_ep.edesc->bEndpointAddress & ea_mask) == ea_val) &&
-	    ((udev->default_ep.edesc->bmAttributes & type_mask) == type_val) &&
+	if ((udev->ctrl_ep.edesc) &&
+	    ((udev->ctrl_ep.edesc->bEndpointAddress & ea_mask) == ea_val) &&
+	    ((udev->ctrl_ep.edesc->bmAttributes & type_mask) == type_val) &&
 	    (!index)) {
-		ep = &udev->default_ep;
+		ep = &udev->ctrl_ep;
 		goto found;
 	}
 	return (NULL);
@@ -1422,7 +1422,7 @@ usbd_clear_stall_proc(struct usb_proc_ms
 	mtx_lock(&udev->device_mtx);
 
 	/* Start clear stall callback */
-	usbd_transfer_start(udev->default_xfer[1]);
+	usbd_transfer_start(udev->ctrl_xfer[1]);
 
 	/* Change lock */
 	mtx_unlock(&udev->device_mtx);
@@ -1529,13 +1529,13 @@ usb_alloc_device(device_t parent_dev, st
 	udev->refcount = 1;
 
 	/* set up default endpoint descriptor */
-	udev->default_ep_desc.bLength = sizeof(udev->default_ep_desc);
-	udev->default_ep_desc.bDescriptorType = UDESC_ENDPOINT;
-	udev->default_ep_desc.bEndpointAddress = USB_CONTROL_ENDPOINT;
-	udev->default_ep_desc.bmAttributes = UE_CONTROL;
-	udev->default_ep_desc.wMaxPacketSize[0] = USB_MAX_IPACKET;
-	udev->default_ep_desc.wMaxPacketSize[1] = 0;
-	udev->default_ep_desc.bInterval = 0;
+	udev->ctrl_ep_desc.bLength = sizeof(udev->ctrl_ep_desc);
+	udev->ctrl_ep_desc.bDescriptorType = UDESC_ENDPOINT;
+	udev->ctrl_ep_desc.bEndpointAddress = USB_CONTROL_ENDPOINT;
+	udev->ctrl_ep_desc.bmAttributes = UE_CONTROL;
+	udev->ctrl_ep_desc.wMaxPacketSize[0] = USB_MAX_IPACKET;
+	udev->ctrl_ep_desc.wMaxPacketSize[1] = 0;
+	udev->ctrl_ep_desc.bInterval = 0;
 	udev->ddesc.bMaxPacketSize = USB_MAX_IPACKET;
 
 	udev->speed = speed;
@@ -1559,8 +1559,8 @@ usb_alloc_device(device_t parent_dev, st
 
 	/* init the default endpoint */
 	usb_init_endpoint(udev, 0,
-	    &udev->default_ep_desc,
-	    &udev->default_ep);
+	    &udev->ctrl_ep_desc,
+	    &udev->ctrl_ep);
 
 	/* set device index */
 	udev->device_index = device_index;
@@ -1573,10 +1573,10 @@ usb_alloc_device(device_t parent_dev, st
 	LIST_INIT(&udev->pd_list);
 
 	/* Create the control endpoint device */
-	udev->default_dev = usb_make_dev(udev, 0, FREAD|FWRITE);
+	udev->ctrl_dev = usb_make_dev(udev, 0, FREAD|FWRITE);
 
 	/* Create a link from /dev/ugenX.X to the default endpoint */
-	make_dev_alias(udev->default_dev, udev->ugen_name);
+	make_dev_alias(udev->ctrl_dev, udev->ugen_name);
 #endif
 	if (udev->flags.usb_mode == USB_MODE_HOST) {
 
@@ -2009,20 +2009,20 @@ usb_free_device(struct usb_device *udev,
 	}
 	mtx_unlock(&usb_ref_lock);
 
-	destroy_dev_sched_cb(udev->default_dev, usb_cdev_cleanup,
-	    udev->default_dev->si_drv1);
+	destroy_dev_sched_cb(udev->ctrl_dev, usb_cdev_cleanup,
+	    udev->ctrl_dev->si_drv1);
 #endif
 
 	if (udev->flags.usb_mode == USB_MODE_DEVICE) {
 		/* stop receiving any control transfers (Device Side Mode) */
-		usbd_transfer_unsetup(udev->default_xfer, USB_DEFAULT_XFER_MAX);
+		usbd_transfer_unsetup(udev->ctrl_xfer, USB_CTRL_XFER_MAX);
 	}
 
 	/* the following will get the device unconfigured in software */
 	usb_unconfigure(udev, USB_UNCFG_FLAG_FREE_EP0);
 
 	/* unsetup any leftover default USB transfers */
-	usbd_transfer_unsetup(udev->default_xfer, USB_DEFAULT_XFER_MAX);
+	usbd_transfer_unsetup(udev->ctrl_xfer, USB_CTRL_XFER_MAX);
 
 	/* template unsetup, if any */
 	(usb_temp_unsetup_p) (udev);

Modified: head/sys/dev/usb/usb_device.h
==============================================================================
--- head/sys/dev/usb/usb_device.h	Thu Apr 22 22:00:16 2010	(r207079)
+++ head/sys/dev/usb/usb_device.h	Thu Apr 22 22:15:08 2010	(r207080)
@@ -30,7 +30,7 @@
 struct usb_symlink;		/* UGEN */
 struct usb_device;		/* linux compat */
 
-#define	USB_DEFAULT_XFER_MAX 2
+#define	USB_CTRL_XFER_MAX 2
 
 /* "usb_parse_config()" commands */
 
@@ -119,7 +119,7 @@ struct usb_device {
 	struct cv ctrlreq_cv;
 	struct cv ref_cv;
 	struct usb_interface *ifaces;
-	struct usb_endpoint default_ep;	/* Control Endpoint 0 */
+	struct usb_endpoint ctrl_ep;	/* Control Endpoint 0 */
 	struct usb_endpoint *endpoints;
 	struct usb_power_save pwr_save;/* power save data */
 	struct usb_bus *bus;		/* our USB BUS */
@@ -128,13 +128,13 @@ struct usb_device {
 	struct usb_device *parent_hs_hub;	/* high-speed parent HUB */
 	struct usb_config_descriptor *cdesc;	/* full config descr */
 	struct usb_hub *hub;		/* only if this is a hub */
-	struct usb_xfer *default_xfer[USB_DEFAULT_XFER_MAX];
+	struct usb_xfer *ctrl_xfer[USB_CTRL_XFER_MAX];
 	struct usb_temp_data *usb_template_ptr;
 	struct usb_endpoint *ep_curr;	/* current clear stall endpoint */
 #if USB_HAVE_UGEN
 	struct usb_fifo *fifo[USB_FIFO_MAX];
 	struct usb_symlink *ugen_symlink;	/* our generic symlink */
-	struct cdev *default_dev;	/* Control Endpoint 0 device node */
+	struct cdev *ctrl_dev;	/* Control Endpoint 0 device node */
 	LIST_HEAD(,usb_fs_privdata) pd_list;
 	char	ugen_name[20];		/* name of ugenX.X device */
 #endif
@@ -166,7 +166,7 @@ struct usb_device {
 
 	struct usb_device_flags flags;
 
-	struct usb_endpoint_descriptor default_ep_desc;	/* for endpoint 0 */
+	struct usb_endpoint_descriptor ctrl_ep_desc;	/* for endpoint 0 */
 	struct usb_device_descriptor ddesc;	/* device descriptor */
 
 	char	*serial;		/* serial number */

Modified: head/sys/dev/usb/usb_generic.c
==============================================================================
--- head/sys/dev/usb/usb_generic.c	Thu Apr 22 22:00:16 2010	(r207079)
+++ head/sys/dev/usb/usb_generic.c	Thu Apr 22 22:15:08 2010	(r207080)
@@ -81,11 +81,11 @@
 
 static usb_callback_t ugen_read_clear_stall_callback;
 static usb_callback_t ugen_write_clear_stall_callback;
-static usb_callback_t ugen_default_read_callback;
-static usb_callback_t ugen_default_write_callback;
+static usb_callback_t ugen_ctrl_read_callback;
+static usb_callback_t ugen_ctrl_write_callback;
 static usb_callback_t ugen_isoc_read_callback;
 static usb_callback_t ugen_isoc_write_callback;
-static usb_callback_t ugen_default_fs_callback;
+static usb_callback_t ugen_ctrl_fs_callback;
 
 static usb_fifo_open_t ugen_open;
 static usb_fifo_close_t ugen_close;
@@ -265,7 +265,7 @@ ugen_open_pipe_write(struct usb_fifo *f)
 		if (f->flag_short) {
 			usb_config[0].flags.force_short_xfer = 1;
 		}
-		usb_config[0].callback = &ugen_default_write_callback;
+		usb_config[0].callback = &ugen_ctrl_write_callback;
 		usb_config[0].timeout = f->timeout;
 		usb_config[0].frames = 1;
 		usb_config[0].bufsize = f->bufsize;
@@ -335,7 +335,7 @@ ugen_open_pipe_read(struct usb_fifo *f)
 		}
 		usb_config[0].timeout = f->timeout;
 		usb_config[0].frames = 1;
-		usb_config[0].callback = &ugen_default_read_callback;
+		usb_config[0].callback = &ugen_ctrl_read_callback;
 		usb_config[0].bufsize = f->bufsize;
 
 		if (ugen_transfer_setup(f, usb_config, 2)) {
@@ -401,7 +401,7 @@ ugen_stop_io(struct usb_fifo *f)
 }
 
 static void
-ugen_default_read_callback(struct usb_xfer *xfer, usb_error_t error)
+ugen_ctrl_read_callback(struct usb_xfer *xfer, usb_error_t error)
 {
 	struct usb_fifo *f = usbd_xfer_softc(xfer);
 	struct usb_mbuf *m;
@@ -453,7 +453,7 @@ ugen_default_read_callback(struct usb_xf
 }
 
 static void
-ugen_default_write_callback(struct usb_xfer *xfer, usb_error_t error)
+ugen_ctrl_write_callback(struct usb_xfer *xfer, usb_error_t error)
 {
 	struct usb_fifo *f = usbd_xfer_softc(xfer);
 	usb_frlength_t actlen;
@@ -1480,7 +1480,7 @@ ugen_ioctl(struct usb_fifo *f, u_long cm
 		usb_config[0].direction = ed->bEndpointAddress & (UE_DIR_OUT | UE_DIR_IN);
 		usb_config[0].interval = USB_DEFAULT_INTERVAL;
 		usb_config[0].flags.proxy_buffer = 1;
-		usb_config[0].callback = &ugen_default_fs_callback;
+		usb_config[0].callback = &ugen_ctrl_fs_callback;
 		usb_config[0].timeout = 0;	/* no timeout */
 		usb_config[0].frames = u.popen->max_frames;
 		usb_config[0].bufsize = u.popen->max_bufsize;
@@ -2201,7 +2201,7 @@ ugen_ioctl_post(struct usb_fifo *f, u_lo
 }
 
 static void
-ugen_default_fs_callback(struct usb_xfer *xfer, usb_error_t error)
+ugen_ctrl_fs_callback(struct usb_xfer *xfer, usb_error_t error)
 {
 	;				/* workaround for a bug in "indent" */
 

Modified: head/sys/dev/usb/usb_hub.c
==============================================================================
--- head/sys/dev/usb/usb_hub.c	Thu Apr 22 22:00:16 2010	(r207079)
+++ head/sys/dev/usb/usb_hub.c	Thu Apr 22 22:15:08 2010	(r207080)
@@ -246,7 +246,7 @@ uhub_explore_sub(struct uhub_softc *sc, 
 	/* start control transfer, if device mode */
 
 	if (child->flags.usb_mode == USB_MODE_DEVICE) {
-		usbd_default_transfer_setup(child);
+		usbd_ctrl_transfer_setup(child);
 	}
 	/* if a HUB becomes present, do a recursive HUB explore */
 

Modified: head/sys/dev/usb/usb_request.c
==============================================================================
--- head/sys/dev/usb/usb_request.c	Thu Apr 22 22:00:16 2010	(r207079)
+++ head/sys/dev/usb/usb_request.c	Thu Apr 22 22:15:08 2010	(r207080)
@@ -374,9 +374,9 @@ usbd_do_request_flags(struct usb_device 
 	/*
 	 * Setup a new USB transfer or use the existing one, if any:
 	 */
-	usbd_default_transfer_setup(udev);
+	usbd_ctrl_transfer_setup(udev);
 
-	xfer = udev->default_xfer[0];
+	xfer = udev->ctrl_xfer[0];
 	if (xfer == NULL) {
 		/* most likely out of memory */
 		err = USB_ERR_NOMEM;

Modified: head/sys/dev/usb/usb_transfer.c
==============================================================================
--- head/sys/dev/usb/usb_transfer.c	Thu Apr 22 22:00:16 2010	(r207079)
+++ head/sys/dev/usb/usb_transfer.c	Thu Apr 22 22:15:08 2010	(r207080)
@@ -72,7 +72,7 @@ struct usb_std_packet_size {
 
 static usb_callback_t usb_request_callback;
 
-static const struct usb_config usb_control_ep_cfg[USB_DEFAULT_XFER_MAX] = {
+static const struct usb_config usb_control_ep_cfg[USB_CTRL_XFER_MAX] = {
 
 	/* This transfer is used for generic control endpoint transfers */
 
@@ -2433,8 +2433,8 @@ usbd_pipe_start(struct usb_xfer_queue *p
 			if (udev->flags.usb_mode == USB_MODE_DEVICE) {
 				(udev->bus->methods->set_stall) (
 				    udev, NULL, ep, &did_stall);
-			} else if (udev->default_xfer[1]) {
-				info = udev->default_xfer[1]->xroot;
+			} else if (udev->ctrl_xfer[1]) {
+				info = udev->ctrl_xfer[1]->xroot;
 				usb_proc_msignal(
 				    &info->bus->non_giant_callback_proc,
 				    &udev->cs_msg[0], &udev->cs_msg[1]);
@@ -2757,13 +2757,13 @@ usb_command_wrapper(struct usb_xfer_queu
 }
 
 /*------------------------------------------------------------------------*
- *	usbd_default_transfer_setup
+ *	usbd_ctrl_transfer_setup
  *
  * This function is used to setup the default USB control endpoint
  * transfer.
  *------------------------------------------------------------------------*/
 void
-usbd_default_transfer_setup(struct usb_device *udev)
+usbd_ctrl_transfer_setup(struct usb_device *udev)
 {
 	struct usb_xfer *xfer;
 	uint8_t no_resetup;
@@ -2774,12 +2774,12 @@ usbd_default_transfer_setup(struct usb_d
 		return;
 repeat:
 
-	xfer = udev->default_xfer[0];
+	xfer = udev->ctrl_xfer[0];
 	if (xfer) {
 		USB_XFER_LOCK(xfer);
 		no_resetup =
 		    ((xfer->address == udev->address) &&
-		    (udev->default_ep_desc.wMaxPacketSize[0] ==
+		    (udev->ctrl_ep_desc.wMaxPacketSize[0] ==
 		    udev->ddesc.bMaxPacketSize));
 		if (udev->flags.usb_mode == USB_MODE_DEVICE) {
 			if (no_resetup) {
@@ -2806,13 +2806,13 @@ repeat:
 	/*
 	 * Update wMaxPacketSize for the default control endpoint:
 	 */
-	udev->default_ep_desc.wMaxPacketSize[0] =
+	udev->ctrl_ep_desc.wMaxPacketSize[0] =
 	    udev->ddesc.bMaxPacketSize;
 
 	/*
 	 * Unsetup any existing USB transfer:
 	 */
-	usbd_transfer_unsetup(udev->default_xfer, USB_DEFAULT_XFER_MAX);
+	usbd_transfer_unsetup(udev->ctrl_xfer, USB_CTRL_XFER_MAX);
 
 	/*
 	 * Try to setup a new USB transfer for the
@@ -2820,7 +2820,7 @@ repeat:
 	 */
 	iface_index = 0;
 	if (usbd_transfer_setup(udev, &iface_index,
-	    udev->default_xfer, usb_control_ep_cfg, USB_DEFAULT_XFER_MAX, NULL,
+	    udev->ctrl_xfer, usb_control_ep_cfg, USB_CTRL_XFER_MAX, NULL,
 	    &udev->device_mtx)) {
 		DPRINTFN(0, "could not setup default "
 		    "USB transfer\n");
@@ -3001,13 +3001,13 @@ usbd_transfer_poll(struct usb_xfer **ppx
 		USB_BUS_LOCK(xroot->bus);
 
 		/* check for clear stall */
-		if (udev->default_xfer[1] != NULL) {
+		if (udev->ctrl_xfer[1] != NULL) {
 
 			/* poll clear stall start */
 			pm = &udev->cs_msg[0].hdr;
 			(pm->pm_callback) (pm);
 			/* poll clear stall done thread */
-			pm = &udev->default_xfer[1]->
+			pm = &udev->ctrl_xfer[1]->
 			    xroot->done_m[0].hdr;
 			(pm->pm_callback) (pm);
 		}

Modified: head/sys/dev/usb/usb_transfer.h
==============================================================================
--- head/sys/dev/usb/usb_transfer.h	Thu Apr 22 22:00:16 2010	(r207079)
+++ head/sys/dev/usb/usb_transfer.h	Thu Apr 22 22:15:08 2010	(r207080)
@@ -123,7 +123,7 @@ void	usbd_transfer_done(struct usb_xfer 
 void	usbd_transfer_enqueue(struct usb_xfer_queue *pq,
 	    struct usb_xfer *xfer);
 void	usbd_transfer_setup_sub(struct usb_setup_params *parm);
-void	usbd_default_transfer_setup(struct usb_device *udev);
+void	usbd_ctrl_transfer_setup(struct usb_device *udev);
 void	usbd_clear_data_toggle(struct usb_device *udev,
 	    struct usb_endpoint *ep);
 usb_callback_t usbd_do_request_callback;

From owner-svn-src-head@FreeBSD.ORG  Thu Apr 22 23:47:19 2010
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id C4218106566B;
	Thu, 22 Apr 2010 23:47:19 +0000 (UTC)
	(envelope-from jkim@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id B24198FC0C;
	Thu, 22 Apr 2010 23:47:19 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o3MNlJPo028206;
	Thu, 22 Apr 2010 23:47:19 GMT (envelope-from jkim@svn.freebsd.org)
Received: (from jkim@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o3MNlJMU028201;
	Thu, 22 Apr 2010 23:47:19 GMT (envelope-from jkim@svn.freebsd.org)
Message-Id: <201004222347.o3MNlJMU028201@svn.freebsd.org>
From: Jung-uk Kim 
Date: Thu, 22 Apr 2010 23:47:19 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r207081 - in head/sys: amd64/amd64 i386/i386
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 22 Apr 2010 23:47:19 -0000

Author: jkim
Date: Thu Apr 22 23:47:19 2010
New Revision: 207081
URL: http://svn.freebsd.org/changeset/base/207081

Log:
  If a conditional jump instruction has the same jt and jf, do not perform
  the test and jump unconditionally.

Modified:
  head/sys/amd64/amd64/bpf_jit_machdep.c
  head/sys/amd64/amd64/bpf_jit_machdep.h
  head/sys/i386/i386/bpf_jit_machdep.c
  head/sys/i386/i386/bpf_jit_machdep.h

Modified: head/sys/amd64/amd64/bpf_jit_machdep.c
==============================================================================
--- head/sys/amd64/amd64/bpf_jit_machdep.c	Thu Apr 22 22:15:08 2010	(r207080)
+++ head/sys/amd64/amd64/bpf_jit_machdep.c	Thu Apr 22 23:47:19 2010	(r207081)
@@ -419,62 +419,77 @@ bpf_jit_compile(struct bpf_insn *prog, u
 				break;
 
 			case BPF_JMP|BPF_JA:
-				JMP(stream.refs[stream.bpf_pc + ins->k] -
-				    stream.refs[stream.bpf_pc]);
+				JUMP(ins->k);
 				break;
 
 			case BPF_JMP|BPF_JGT|BPF_K:
-				if (ins->jt == 0 && ins->jf == 0)
+				if (ins->jt == ins->jf) {
+					JUMP(ins->jt);
 					break;
+				}
 				CMPid(ins->k, EAX);
 				JCC(JA, JBE);
 				break;
 
 			case BPF_JMP|BPF_JGE|BPF_K:
-				if (ins->jt == 0 && ins->jf == 0)
+				if (ins->jt == ins->jf) {
+					JUMP(ins->jt);
 					break;
+				}
 				CMPid(ins->k, EAX);
 				JCC(JAE, JB);
 				break;
 
 			case BPF_JMP|BPF_JEQ|BPF_K:
-				if (ins->jt == 0 && ins->jf == 0)
+				if (ins->jt == ins->jf) {
+					JUMP(ins->jt);
 					break;
+				}
 				CMPid(ins->k, EAX);
 				JCC(JE, JNE);
 				break;
 
 			case BPF_JMP|BPF_JSET|BPF_K:
-				if (ins->jt == 0 && ins->jf == 0)
+				if (ins->jt == ins->jf) {
+					JUMP(ins->jt);
 					break;
+				}
 				TESTid(ins->k, EAX);
 				JCC(JNE, JE);
 				break;
 
 			case BPF_JMP|BPF_JGT|BPF_X:
-				if (ins->jt == 0 && ins->jf == 0)
+				if (ins->jt == ins->jf) {
+					JUMP(ins->jt);
 					break;
+				}
 				CMPrd(EDX, EAX);
 				JCC(JA, JBE);
 				break;
 
 			case BPF_JMP|BPF_JGE|BPF_X:
-				if (ins->jt == 0 && ins->jf == 0)
+				if (ins->jt == ins->jf) {
+					JUMP(ins->jt);
 					break;
+				}
 				CMPrd(EDX, EAX);
 				JCC(JAE, JB);
 				break;
 
 			case BPF_JMP|BPF_JEQ|BPF_X:
-				if (ins->jt == 0 && ins->jf == 0)
+				if (ins->jt == ins->jf) {
+					JUMP(ins->jt);
 					break;
+				}
 				CMPrd(EDX, EAX);
 				JCC(JE, JNE);
 				break;
 
 			case BPF_JMP|BPF_JSET|BPF_X:
-				if (ins->jt == 0 && ins->jf == 0)
+				if (ins->jt == ins->jf) {
+					JUMP(ins->jt);
 					break;
+				}
 				TESTrd(EDX, EAX);
 				JCC(JNE, JE);
 				break;

Modified: head/sys/amd64/amd64/bpf_jit_machdep.h
==============================================================================
--- head/sys/amd64/amd64/bpf_jit_machdep.h	Thu Apr 22 22:15:08 2010	(r207080)
+++ head/sys/amd64/amd64/bpf_jit_machdep.h	Thu Apr 22 23:47:19 2010	(r207081)
@@ -473,4 +473,10 @@ typedef void (*emit_func)(bpf_bin_stream
 	}								\
 } while (0)
 
+#define	JUMP(off) do {							\
+	if ((off) != 0)							\
+		JMP(stream.refs[stream.bpf_pc + (off)] -		\
+		    stream.refs[stream.bpf_pc]);			\
+} while (0)
+
 #endif	/* _BPF_JIT_MACHDEP_H_ */

Modified: head/sys/i386/i386/bpf_jit_machdep.c
==============================================================================
--- head/sys/i386/i386/bpf_jit_machdep.c	Thu Apr 22 22:15:08 2010	(r207080)
+++ head/sys/i386/i386/bpf_jit_machdep.c	Thu Apr 22 23:47:19 2010	(r207081)
@@ -440,62 +440,77 @@ bpf_jit_compile(struct bpf_insn *prog, u
 				break;
 
 			case BPF_JMP|BPF_JA:
-				JMP(stream.refs[stream.bpf_pc + ins->k] -
-				    stream.refs[stream.bpf_pc]);
+				JUMP(ins->k);
 				break;
 
 			case BPF_JMP|BPF_JGT|BPF_K:
-				if (ins->jt == 0 && ins->jf == 0)
+				if (ins->jt == ins->jf) {
+					JUMP(ins->jt);
 					break;
+				}
 				CMPid(ins->k, EAX);
 				JCC(JA, JBE);
 				break;
 
 			case BPF_JMP|BPF_JGE|BPF_K:
-				if (ins->jt == 0 && ins->jf == 0)
+				if (ins->jt == ins->jf) {
+					JUMP(ins->jt);
 					break;
+				}
 				CMPid(ins->k, EAX);
 				JCC(JAE, JB);
 				break;
 
 			case BPF_JMP|BPF_JEQ|BPF_K:
-				if (ins->jt == 0 && ins->jf == 0)
+				if (ins->jt == ins->jf) {
+					JUMP(ins->jt);
 					break;
+				}
 				CMPid(ins->k, EAX);
 				JCC(JE, JNE);
 				break;
 
 			case BPF_JMP|BPF_JSET|BPF_K:
-				if (ins->jt == 0 && ins->jf == 0)
+				if (ins->jt == ins->jf) {
+					JUMP(ins->jt);
 					break;
+				}
 				TESTid(ins->k, EAX);
 				JCC(JNE, JE);
 				break;
 
 			case BPF_JMP|BPF_JGT|BPF_X:
-				if (ins->jt == 0 && ins->jf == 0)
+				if (ins->jt == ins->jf) {
+					JUMP(ins->jt);
 					break;
+				}
 				CMPrd(EDX, EAX);
 				JCC(JA, JBE);
 				break;
 
 			case BPF_JMP|BPF_JGE|BPF_X:
-				if (ins->jt == 0 && ins->jf == 0)
+				if (ins->jt == ins->jf) {
+					JUMP(ins->jt);
 					break;
+				}
 				CMPrd(EDX, EAX);
 				JCC(JAE, JB);
 				break;
 
 			case BPF_JMP|BPF_JEQ|BPF_X:
-				if (ins->jt == 0 && ins->jf == 0)
+				if (ins->jt == ins->jf) {
+					JUMP(ins->jt);
 					break;
+				}
 				CMPrd(EDX, EAX);
 				JCC(JE, JNE);
 				break;
 
 			case BPF_JMP|BPF_JSET|BPF_X:
-				if (ins->jt == 0 && ins->jf == 0)
+				if (ins->jt == ins->jf) {
+					JUMP(ins->jt);
 					break;
+				}
 				TESTrd(EDX, EAX);
 				JCC(JNE, JE);
 				break;

Modified: head/sys/i386/i386/bpf_jit_machdep.h
==============================================================================
--- head/sys/i386/i386/bpf_jit_machdep.h	Thu Apr 22 22:15:08 2010	(r207080)
+++ head/sys/i386/i386/bpf_jit_machdep.h	Thu Apr 22 23:47:19 2010	(r207081)
@@ -418,4 +418,10 @@ typedef void (*emit_func)(bpf_bin_stream
 	}								\
 } while (0)
 
+#define	JUMP(off) do {							\
+	if ((off) != 0)							\
+		JMP(stream.refs[stream.bpf_pc + (off)] -		\
+		    stream.refs[stream.bpf_pc]);			\
+} while (0)
+
 #endif	/* _BPF_JIT_MACHDEP_H_ */

From owner-svn-src-head@FreeBSD.ORG  Thu Apr 22 23:51:01 2010
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id AA571106564A;
	Thu, 22 Apr 2010 23:51:01 +0000 (UTC)
	(envelope-from rmacklem@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 975ED8FC14;
	Thu, 22 Apr 2010 23:51:01 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o3MNp1OY029071;
	Thu, 22 Apr 2010 23:51:01 GMT
	(envelope-from rmacklem@svn.freebsd.org)
Received: (from rmacklem@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o3MNp1x2029061;
	Thu, 22 Apr 2010 23:51:01 GMT
	(envelope-from rmacklem@svn.freebsd.org)
Message-Id: <201004222351.o3MNp1x2029061@svn.freebsd.org>
From: Rick Macklem 
Date: Thu, 22 Apr 2010 23:51:01 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r207082 - in head/sys/fs: nfs nfsclient
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 22 Apr 2010 23:51:01 -0000

Author: rmacklem
Date: Thu Apr 22 23:51:01 2010
New Revision: 207082
URL: http://svn.freebsd.org/changeset/base/207082

Log:
  When the experimental NFS client is handling an NFSv4 server reboot
  with delegations enabled, the recovery could fail if the renew
  thread is trying to return a delegation, since it will not do the
  recovery. This patch fixes the above by having nfscl_recalldeleg()
  fail with the I/O operations returning EIO, so that they will be
  attempted later. Most of the patch consists of adding an argument
  to various functions to indicate the delegation recall case where
  this needs to be done.
  
  MFC after:	1 week

Modified:
  head/sys/fs/nfs/nfs_var.h
  head/sys/fs/nfsclient/nfs.h
  head/sys/fs/nfsclient/nfs_clbio.c
  head/sys/fs/nfsclient/nfs_clnfsiod.c
  head/sys/fs/nfsclient/nfs_clnode.c
  head/sys/fs/nfsclient/nfs_clrpcops.c
  head/sys/fs/nfsclient/nfs_clstate.c
  head/sys/fs/nfsclient/nfs_clvnops.c

Modified: head/sys/fs/nfs/nfs_var.h
==============================================================================
--- head/sys/fs/nfs/nfs_var.h	Thu Apr 22 23:47:19 2010	(r207081)
+++ head/sys/fs/nfs/nfs_var.h	Thu Apr 22 23:51:01 2010	(r207082)
@@ -369,7 +369,7 @@ int nfsrpc_readlink(vnode_t, struct uio 
 int nfsrpc_read(vnode_t, struct uio *, struct ucred *, NFSPROC_T *,
     struct nfsvattr *, int *, void *);
 int nfsrpc_write(vnode_t, struct uio *, int *, u_char *,
-    struct ucred *, NFSPROC_T *, struct nfsvattr *, int *, void *);
+    struct ucred *, NFSPROC_T *, struct nfsvattr *, int *, void *, int);
 int nfsrpc_mknod(vnode_t, char *, int, struct vattr *, u_int32_t,
     enum vtype, struct ucred *, NFSPROC_T *, struct nfsvattr *,
     struct nfsvattr *, struct nfsfh **, int *, int *, void *);
@@ -502,7 +502,7 @@ int nfscl_maperr(NFSPROC_T *, int, uid_t
 void nfscl_init(void);
 
 /* nfs_clbio.c */
-int ncl_flush(vnode_t, int, struct ucred *, NFSPROC_T *, int);
+int ncl_flush(vnode_t, int, struct ucred *, NFSPROC_T *, int, int);
 
 /* nfs_clnode.c */
 void ncl_invalcaches(vnode_t);

Modified: head/sys/fs/nfsclient/nfs.h
==============================================================================
--- head/sys/fs/nfsclient/nfs.h	Thu Apr 22 23:47:19 2010	(r207081)
+++ head/sys/fs/nfsclient/nfs.h	Thu Apr 22 23:51:01 2010	(r207082)
@@ -79,14 +79,16 @@ int ncl_biowrite(struct vnode *, struct 
 int ncl_vinvalbuf(struct vnode *, int, struct thread *, int);
 int ncl_asyncio(struct nfsmount *, struct buf *, struct ucred *,
     struct thread *);
-int ncl_doio(struct vnode *, struct buf *, struct ucred *, struct thread *);
+int ncl_doio(struct vnode *, struct buf *, struct ucred *, struct thread *,
+    int);
 void ncl_nhinit(void);
 void ncl_nhuninit(void);
 void ncl_nodelock(struct nfsnode *);
 void ncl_nodeunlock(struct nfsnode *);
 int ncl_getattrcache(struct vnode *, struct vattr *);
 int ncl_readrpc(struct vnode *, struct uio *, struct ucred *);
-int ncl_writerpc(struct vnode *, struct uio *, struct ucred *, int *, int *);
+int ncl_writerpc(struct vnode *, struct uio *, struct ucred *, int *, int *,
+    int);
 int ncl_readlinkrpc(struct vnode *, struct uio *, struct ucred *);
 int ncl_readdirrpc(struct vnode *, struct uio *, struct ucred *,
     struct thread *);

Modified: head/sys/fs/nfsclient/nfs_clbio.c
==============================================================================
--- head/sys/fs/nfsclient/nfs_clbio.c	Thu Apr 22 23:47:19 2010	(r207081)
+++ head/sys/fs/nfsclient/nfs_clbio.c	Thu Apr 22 23:51:01 2010	(r207082)
@@ -336,7 +336,7 @@ ncl_putpages(struct vop_putpages_args *a
 	else
 	    iomode = NFSWRITE_FILESYNC;
 
-	error = ncl_writerpc(vp, &uio, cred, &iomode, &must_commit);
+	error = ncl_writerpc(vp, &uio, cred, &iomode, &must_commit, 0);
 
 	pmap_qremove(kva, npages);
 	relpbuf(bp, &ncl_pbuf_freecnt);
@@ -554,7 +554,7 @@ ncl_bioread(struct vnode *vp, struct uio
 		if ((bp->b_flags & B_CACHE) == 0) {
 		    bp->b_iocmd = BIO_READ;
 		    vfs_busy_pages(bp, 0);
-		    error = ncl_doio(vp, bp, cred, td);
+		    error = ncl_doio(vp, bp, cred, td, 0);
 		    if (error) {
 			brelse(bp);
 			return (error);
@@ -583,7 +583,7 @@ ncl_bioread(struct vnode *vp, struct uio
 		if ((bp->b_flags & B_CACHE) == 0) {
 		    bp->b_iocmd = BIO_READ;
 		    vfs_busy_pages(bp, 0);
-		    error = ncl_doio(vp, bp, cred, td);
+		    error = ncl_doio(vp, bp, cred, td, 0);
 		    if (error) {
 			bp->b_ioflags |= BIO_ERROR;
 			brelse(bp);
@@ -609,7 +609,7 @@ ncl_bioread(struct vnode *vp, struct uio
 		if ((bp->b_flags & B_CACHE) == 0) {
 		    bp->b_iocmd = BIO_READ;
 		    vfs_busy_pages(bp, 0);
-		    error = ncl_doio(vp, bp, cred, td);
+		    error = ncl_doio(vp, bp, cred, td, 0);
 		    if (error) {
 			    brelse(bp);
 		    }
@@ -638,7 +638,7 @@ ncl_bioread(struct vnode *vp, struct uio
 			    if ((bp->b_flags & B_CACHE) == 0) {
 				    bp->b_iocmd = BIO_READ;
 				    vfs_busy_pages(bp, 0);
-				    error = ncl_doio(vp, bp, cred, td);
+				    error = ncl_doio(vp, bp, cred, td, 0);
 				    /*
 				     * no error + B_INVAL == directory EOF,
 				     * use the block.
@@ -771,7 +771,7 @@ do_sync:
 			uio.uio_td = td;
 			iomode = NFSWRITE_FILESYNC;
 			error = ncl_writerpc(vp, &uio, cred, &iomode,
-			    &must_commit);
+			    &must_commit, 0);
 			KASSERT((must_commit == 0), 
 				("ncl_directio_write: Did not commit write"));
 			if (error)
@@ -1122,7 +1122,7 @@ again:
 		if ((bp->b_flags & B_CACHE) == 0) {
 			bp->b_iocmd = BIO_READ;
 			vfs_busy_pages(bp, 0);
-			error = ncl_doio(vp, bp, cred, td);
+			error = ncl_doio(vp, bp, cred, td, 0);
 			if (error) {
 				brelse(bp);
 				break;
@@ -1523,7 +1523,7 @@ ncl_doio_directwrite(struct buf *bp)
 	
 	iomode = NFSWRITE_FILESYNC;
 	uiop->uio_td = NULL; /* NULL since we're in nfsiod */
-	ncl_writerpc(bp->b_vp, uiop, bp->b_wcred, &iomode, &must_commit);
+	ncl_writerpc(bp->b_vp, uiop, bp->b_wcred, &iomode, &must_commit, 0);
 	KASSERT((must_commit == 0), ("ncl_doio_directwrite: Did not commit write"));
 	free(iov_base, M_NFSDIRECTIO);
 	free(uiop->uio_iov, M_NFSDIRECTIO);
@@ -1550,7 +1550,8 @@ ncl_doio_directwrite(struct buf *bp)
  * synchronously or from an nfsiod.
  */
 int
-ncl_doio(struct vnode *vp, struct buf *bp, struct ucred *cr, struct thread *td)
+ncl_doio(struct vnode *vp, struct buf *bp, struct ucred *cr, struct thread *td,
+    int called_from_strategy)
 {
 	struct uio *uiop;
 	struct nfsnode *np;
@@ -1695,7 +1696,8 @@ ncl_doio(struct vnode *vp, struct buf *b
 		else
 		    iomode = NFSWRITE_FILESYNC;
 
-		error = ncl_writerpc(vp, uiop, cr, &iomode, &must_commit);
+		error = ncl_writerpc(vp, uiop, cr, &iomode, &must_commit,
+		    called_from_strategy);
 
 		/*
 		 * When setting B_NEEDCOMMIT also set B_CLUSTEROK to try
@@ -1732,6 +1734,12 @@ ncl_doio(struct vnode *vp, struct buf *b
 		 * the block is reused. This is indicated by setting
 		 * the B_DELWRI and B_NEEDCOMMIT flags.
 		 *
+		 * EIO is returned by ncl_writerpc() to indicate a recoverable
+		 * write error and is handled as above, except that
+		 * B_EINTR isn't set. One cause of this is a stale stateid
+		 * error for the RPC that indicates recovery is required,
+		 * when called with called_from_strategy != 0.
+		 *
 		 * If the buffer is marked B_PAGING, it does not reside on
 		 * the vp's paging queues so we cannot call bdirty().  The
 		 * bp in this case is not an NFS cache block so we should
@@ -1760,7 +1768,8 @@ ncl_doio(struct vnode *vp, struct buf *b
 			    bdirty(bp);
 			    bp->b_flags &= ~B_DONE;
 			}
-			if (error && (bp->b_flags & B_ASYNC) == 0)
+			if ((error == EINTR || error == ETIMEDOUT) &&
+			    (bp->b_flags & B_ASYNC) == 0)
 			    bp->b_flags |= B_EINTR;
 			splx(s);
 	    	} else {

Modified: head/sys/fs/nfsclient/nfs_clnfsiod.c
==============================================================================
--- head/sys/fs/nfsclient/nfs_clnfsiod.c	Thu Apr 22 23:47:19 2010	(r207081)
+++ head/sys/fs/nfsclient/nfs_clnfsiod.c	Thu Apr 22 23:51:01 2010	(r207082)
@@ -278,9 +278,11 @@ nfssvc_iod(void *instance)
 			(void)ncl_doio_directwrite(bp);
 		} else {
 			if (bp->b_iocmd == BIO_READ)
-				(void) ncl_doio(bp->b_vp, bp, bp->b_rcred, NULL);
+				(void) ncl_doio(bp->b_vp, bp, bp->b_rcred,
+				    NULL, 0);
 			else
-				(void) ncl_doio(bp->b_vp, bp, bp->b_wcred, NULL);
+				(void) ncl_doio(bp->b_vp, bp, bp->b_wcred,
+				    NULL, 0);
 		}
 		mtx_lock(&ncl_iod_mutex);
 		/*

Modified: head/sys/fs/nfsclient/nfs_clnode.c
==============================================================================
--- head/sys/fs/nfsclient/nfs_clnode.c	Thu Apr 22 23:47:19 2010	(r207081)
+++ head/sys/fs/nfsclient/nfs_clnode.c	Thu Apr 22 23:51:01 2010	(r207082)
@@ -199,7 +199,7 @@ ncl_inactive(struct vop_inactive_args *a
 		 * available for the writes.
 		 */
 		if (nfscl_mustflush(vp))
-			(void) ncl_flush(vp, MNT_WAIT, NULL, ap->a_td, 1);
+			(void) ncl_flush(vp, MNT_WAIT, NULL, ap->a_td, 1, 0);
 		(void) nfsrpc_close(vp, 1, ap->a_td);
 	}
 

Modified: head/sys/fs/nfsclient/nfs_clrpcops.c
==============================================================================
--- head/sys/fs/nfsclient/nfs_clrpcops.c	Thu Apr 22 23:47:19 2010	(r207081)
+++ head/sys/fs/nfsclient/nfs_clrpcops.c	Thu Apr 22 23:51:01 2010	(r207082)
@@ -1346,11 +1346,16 @@ nfsmout:
 
 /*
  * nfs write operation
+ * When called_from_strategy != 0, it should return EIO for an error that
+ * indicates recovery is in progress, so that the buffer will be left
+ * dirty and be written back to the server later. If it loops around,
+ * the recovery thread could get stuck waiting for the buffer and recovery
+ * will then deadlock.
  */
 APPLESTATIC int
 nfsrpc_write(vnode_t vp, struct uio *uiop, int *iomode, u_char *verfp,
     struct ucred *cred, NFSPROC_T *p, struct nfsvattr *nap, int *attrflagp,
-    void *stuff)
+    void *stuff, int called_from_strategy)
 {
 	int error, expireret = 0, retrycnt, nostateid;
 	u_int32_t clidrev = 0;
@@ -1410,12 +1415,15 @@ nfscl_dumpstate(nmp, 1, 1, 0, 0);
 			expireret = nfscl_hasexpired(nmp->nm_clp, clidrev, p);
 		}
 		retrycnt++;
-	} while (error == NFSERR_GRACE || error == NFSERR_STALESTATEID ||
-	    error == NFSERR_STALEDONTRECOVER || error == NFSERR_DELAY ||
+	} while (error == NFSERR_GRACE || error == NFSERR_DELAY ||
+	    ((error == NFSERR_STALESTATEID ||
+	      error == NFSERR_STALEDONTRECOVER) && called_from_strategy == 0) ||
 	    (error == NFSERR_OLDSTATEID && retrycnt < 20) ||
 	    ((error == NFSERR_EXPIRED || error == NFSERR_BADSTATEID) &&
 	     expireret == 0 && clidrev != 0 && retrycnt < 4));
-	if (error && retrycnt >= 4)
+	if (error != 0 && (retrycnt >= 4 ||
+	    ((error == NFSERR_STALESTATEID ||
+	      error == NFSERR_STALEDONTRECOVER) && called_from_strategy != 0)))
 		error = EIO;
 	if (NFSHASNFSV4(nmp) && p == NULL)
 		NFSFREECRED(newcred);

Modified: head/sys/fs/nfsclient/nfs_clstate.c
==============================================================================
--- head/sys/fs/nfsclient/nfs_clstate.c	Thu Apr 22 23:47:19 2010	(r207081)
+++ head/sys/fs/nfsclient/nfs_clstate.c	Thu Apr 22 23:51:01 2010	(r207082)
@@ -139,7 +139,7 @@ static void nfscl_freedeleg(struct nfscl
 static int nfscl_errmap(struct nfsrv_descript *);
 static void nfscl_cleanup_common(struct nfsclclient *, u_int8_t *);
 static int nfscl_recalldeleg(struct nfsclclient *, struct nfsmount *,
-    struct nfscldeleg *, vnode_t, struct ucred *, NFSPROC_T *);
+    struct nfscldeleg *, vnode_t, struct ucred *, NFSPROC_T *, int);
 static void nfscl_freeopenowner(struct nfsclowner *, int);
 static void nfscl_cleandeleg(struct nfscldeleg *);
 static int nfscl_trydelegreturn(struct nfscldeleg *, struct ucred *,
@@ -2469,7 +2469,7 @@ tryagain:
 				NFSUNLOCKCLSTATE();
 				newnfs_copycred(&dp->nfsdl_cred, cred);
 				ret = nfscl_recalldeleg(clp, clp->nfsc_nmp, dp,
-				    NULL, cred, p);
+				    NULL, cred, p, 1);
 				if (!ret) {
 				    nfscl_cleandeleg(dp);
 				    TAILQ_REMOVE(&clp->nfsc_deleg, dp,
@@ -3309,7 +3309,8 @@ nfscl_lockt(vnode_t vp, struct nfsclclie
  */
 static int
 nfscl_recalldeleg(struct nfsclclient *clp, struct nfsmount *nmp,
-    struct nfscldeleg *dp, vnode_t vp, struct ucred *cred, NFSPROC_T *p)
+    struct nfscldeleg *dp, vnode_t vp, struct ucred *cred, NFSPROC_T *p,
+    int called_from_renewthread)
 {
 	struct nfsclowner *owp, *lowp, *nowp;
 	struct nfsclopen *op, *lop;
@@ -3343,6 +3344,7 @@ nfscl_recalldeleg(struct nfsclclient *cl
 	 * Ok, if it's a write delegation, flush data to the server, so
 	 * that close/open consistency is retained.
 	 */
+	ret = 0;
 	NFSLOCKNODE(np);
 	if ((dp->nfsdl_flags & NFSCLDL_WRITE) && (np->n_flag & NMODIFIED)) {
 #ifdef APPLE
@@ -3351,7 +3353,8 @@ nfscl_recalldeleg(struct nfsclclient *cl
 		np->n_flag |= NDELEGRECALL;
 #endif
 		NFSUNLOCKNODE(np);
-		(void) ncl_flush(vp, MNT_WAIT, cred, p, 1);
+		ret = ncl_flush(vp, MNT_WAIT, cred, p, 1,
+		    called_from_renewthread);
 		NFSLOCKNODE(np);
 #ifdef APPLE
 		OSBitAndAtomic((int32_t)~(NMODIFIED | NDELEGRECALL), (UInt32 *)&np->n_flag);
@@ -3360,6 +3363,16 @@ nfscl_recalldeleg(struct nfsclclient *cl
 #endif
 	}
 	NFSUNLOCKNODE(np);
+	if (ret == EIO && called_from_renewthread != 0) {
+		/*
+		 * If the flush failed with EIO for the renew thread,
+		 * return now, so that the dirty buffer will be flushed
+		 * later.
+		 */
+		if (gotvp != 0)
+			vrele(vp);
+		return (ret);
+	}
 
 	/*
 	 * Now, for each openowner with opens issued locally, move them
@@ -3857,7 +3870,7 @@ nfscl_removedeleg(vnode_t vp, NFSPROC_T 
 			NFSUNLOCKCLSTATE();
 			cred = newnfs_getcred();
 			newnfs_copycred(&dp->nfsdl_cred, cred);
-			(void) nfscl_recalldeleg(clp, nmp, dp, vp, cred, p);
+			(void) nfscl_recalldeleg(clp, nmp, dp, vp, cred, p, 0);
 			NFSFREECRED(cred);
 			triedrecall = 1;
 			NFSLOCKCLSTATE();
@@ -3955,7 +3968,7 @@ nfscl_renamedeleg(vnode_t fvp, nfsv4stat
 			NFSUNLOCKCLSTATE();
 			cred = newnfs_getcred();
 			newnfs_copycred(&dp->nfsdl_cred, cred);
-			(void) nfscl_recalldeleg(clp, nmp, dp, fvp, cred, p);
+			(void) nfscl_recalldeleg(clp, nmp, dp, fvp, cred, p, 0);
 			NFSFREECRED(cred);
 			triedrecall = 1;
 			NFSLOCKCLSTATE();

Modified: head/sys/fs/nfsclient/nfs_clvnops.c
==============================================================================
--- head/sys/fs/nfsclient/nfs_clvnops.c	Thu Apr 22 23:47:19 2010	(r207081)
+++ head/sys/fs/nfsclient/nfs_clvnops.c	Thu Apr 22 23:51:01 2010	(r207082)
@@ -670,13 +670,13 @@ nfs_close(struct vop_close_args *ap)
 		     * traditional vnode locking implemented for Vnode Ops.
 		     */
 		    int cm = newnfs_commit_on_close ? 1 : 0;
-		    error = ncl_flush(vp, MNT_WAIT, cred, ap->a_td, cm);
+		    error = ncl_flush(vp, MNT_WAIT, cred, ap->a_td, cm, 0);
 		    /* np->n_flag &= ~NMODIFIED; */
 		} else if (NFS_ISV4(vp)) { 
 			if (nfscl_mustflush(vp)) {
 				int cm = newnfs_commit_on_close ? 1 : 0;
 				error = ncl_flush(vp, MNT_WAIT, cred, ap->a_td,
-				    cm);
+				    cm, 0);
 				/*
 				 * as above w.r.t races when clearing
 				 * NMODIFIED.
@@ -1306,7 +1306,7 @@ ncl_readrpc(struct vnode *vp, struct uio
  */
 int
 ncl_writerpc(struct vnode *vp, struct uio *uiop, struct ucred *cred,
-	     int *iomode, int *must_commit)
+    int *iomode, int *must_commit, int called_from_strategy)
 {
 	struct nfsvattr nfsva;
 	int error = 0, attrflag, ret;
@@ -1315,7 +1315,7 @@ ncl_writerpc(struct vnode *vp, struct ui
 
 	*must_commit = 0;
 	error = nfsrpc_write(vp, uiop, iomode, verf, cred,
-	    uiop->uio_td, &nfsva, &attrflag, NULL);
+	    uiop->uio_td, &nfsva, &attrflag, NULL, called_from_strategy);
 	NFSLOCKMNT(nmp);
 	if (!error && NFSHASWRITEVERF(nmp) &&
 	    NFSBCMP(verf, nmp->nm_verf, NFSX_VERF)) {
@@ -2473,7 +2473,7 @@ nfs_strategy(struct vop_strategy_args *a
 	 */
 	if ((bp->b_flags & B_ASYNC) == 0 ||
 	    ncl_asyncio(VFSTONFS(ap->a_vp->v_mount), bp, NOCRED, curthread))
-		(void)ncl_doio(ap->a_vp, bp, cr, curthread);
+		(void) ncl_doio(ap->a_vp, bp, cr, curthread, 1);
 	return (0);
 }
 
@@ -2484,17 +2484,20 @@ nfs_strategy(struct vop_strategy_args *a
 static int
 nfs_fsync(struct vop_fsync_args *ap)
 {
-	return (ncl_flush(ap->a_vp, ap->a_waitfor, NULL, ap->a_td, 1));
+	return (ncl_flush(ap->a_vp, ap->a_waitfor, NULL, ap->a_td, 1, 0));
 }
 
 /*
  * Flush all the blocks associated with a vnode.
  * 	Walk through the buffer pool and push any dirty pages
  *	associated with the vnode.
+ * If the called_from_renewthread argument is TRUE, it has been called
+ * from the NFSv4 renew thread and, as such, cannot block indefinitely
+ * waiting for a buffer write to complete.
  */
 int
 ncl_flush(struct vnode *vp, int waitfor, struct ucred *cred, struct thread *td,
-    int commit)
+    int commit, int called_from_renewthread)
 {
 	struct nfsnode *np = VTONFS(vp);
 	struct buf *bp;
@@ -2513,6 +2516,8 @@ ncl_flush(struct vnode *vp, int waitfor,
 	struct buf *bvec_on_stack[NFS_COMMITBVECSIZ];
 	int bvecsize = 0, bveccount;
 
+	if (called_from_renewthread != 0)
+		slptimeo = hz;
 	if (nmp->nm_flag & NFSMNT_INT)
 		slpflag = NFS_PCATCH;
 	if (!commit)
@@ -2708,6 +2713,14 @@ loop:
 				error = 0;
 				goto loop;
 			}
+			if (called_from_renewthread != 0) {
+				/*
+				 * Return EIO so the flush will be retried
+				 * later.
+				 */
+				error = EIO;
+				goto done;
+			}
 			if (newnfs_sigintr(nmp, td)) {
 				error = EINTR;
 				goto done;
@@ -2747,6 +2760,14 @@ loop:
 			error = bufobj_wwait(bo, slpflag, slptimeo);
 			if (error) {
 			    BO_UNLOCK(bo);
+			    if (called_from_renewthread != 0) {
+				/*
+				 * Return EIO so that the flush will be
+				 * retried later.
+				 */
+				error = EIO;
+				goto done;
+			    }
 			    error = newnfs_sigintr(nmp, td);
 			    if (error)
 				goto done;
@@ -2838,7 +2859,7 @@ nfs_advlock(struct vop_advlock_args *ap)
 		 */
 		if (ap->a_op == F_UNLCK &&
 		    nfscl_checkwritelocked(vp, ap->a_fl, cred, td))
-			(void) ncl_flush(vp, MNT_WAIT, cred, td, 1);
+			(void) ncl_flush(vp, MNT_WAIT, cred, td, 1, 0);
 
 		/*
 		 * Loop around doing the lock op, while a blocking lock

From owner-svn-src-head@FreeBSD.ORG  Fri Apr 23 01:34:01 2010
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id B0654106566B;
	Fri, 23 Apr 2010 01:34:01 +0000 (UTC)
	(envelope-from neel@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id A009D8FC13;
	Fri, 23 Apr 2010 01:34:01 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o3N1Y1nE051990;
	Fri, 23 Apr 2010 01:34:01 GMT (envelope-from neel@svn.freebsd.org)
Received: (from neel@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o3N1Y1Ko051988;
	Fri, 23 Apr 2010 01:34:01 GMT (envelope-from neel@svn.freebsd.org)
Message-Id: <201004230134.o3N1Y1Ko051988@svn.freebsd.org>
From: Neel Natu 
Date: Fri, 23 Apr 2010 01:34:01 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r207089 - head/sys/mips/mips
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 23 Apr 2010 01:34:01 -0000

Author: neel
Date: Fri Apr 23 01:34:01 2010
New Revision: 207089
URL: http://svn.freebsd.org/changeset/base/207089

Log:
  Fix compilation error.
  
  tick.c:298:5: error: "KDTRACE_HOOKS" is not defined

Modified:
  head/sys/mips/mips/tick.c

Modified: head/sys/mips/mips/tick.c
==============================================================================
--- head/sys/mips/mips/tick.c	Fri Apr 23 01:22:48 2010	(r207088)
+++ head/sys/mips/mips/tick.c	Fri Apr 23 01:34:01 2010	(r207089)
@@ -295,7 +295,7 @@ clock_intr(void *arg)
 	 */
 	if (delta > cycles_per_hz)
 		delta = cycles_per_hz;
-#if KDTRACE_HOOKS
+#ifdef KDTRACE_HOOKS
 	/*
 	 * If the DTrace hooks are configured and a callback function
 	 * has been registered, then call it to process the high speed

From owner-svn-src-head@FreeBSD.ORG  Fri Apr 23 03:11:40 2010
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 3E60B106564A;
	Fri, 23 Apr 2010 03:11:40 +0000 (UTC)
	(envelope-from marcel@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 2D3F78FC0C;
	Fri, 23 Apr 2010 03:11:40 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o3N3BeQh073939;
	Fri, 23 Apr 2010 03:11:40 GMT (envelope-from marcel@svn.freebsd.org)
Received: (from marcel@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o3N3Be3O073930;
	Fri, 23 Apr 2010 03:11:40 GMT (envelope-from marcel@svn.freebsd.org)
Message-Id: <201004230311.o3N3Be3O073930@svn.freebsd.org>
From: Marcel Moolenaar 
Date: Fri, 23 Apr 2010 03:11:40 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r207094 - head/sys/geom/part
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 23 Apr 2010 03:11:40 -0000

Author: marcel
Date: Fri Apr 23 03:11:39 2010
New Revision: 207094
URL: http://svn.freebsd.org/changeset/base/207094

Log:
  Implement the resize verb and add support for resizing partitions
  for all schemes but EBR. Quality work by Andrey!
  
  Submitted by:	"Andrey V. Elsukov" 

Modified:
  head/sys/geom/part/g_part.c
  head/sys/geom/part/g_part_apm.c
  head/sys/geom/part/g_part_bsd.c
  head/sys/geom/part/g_part_gpt.c
  head/sys/geom/part/g_part_if.m
  head/sys/geom/part/g_part_mbr.c
  head/sys/geom/part/g_part_pc98.c
  head/sys/geom/part/g_part_vtoc8.c

Modified: head/sys/geom/part/g_part.c
==============================================================================
--- head/sys/geom/part/g_part.c	Fri Apr 23 02:31:28 2010	(r207093)
+++ head/sys/geom/part/g_part.c	Fri Apr 23 03:11:39 2010	(r207094)
@@ -971,9 +971,85 @@ g_part_ctl_recover(struct gctl_req *req,
 static int
 g_part_ctl_resize(struct gctl_req *req, struct g_part_parms *gpp)
 {
-	gctl_error(req, "%d verb 'resize'", ENOSYS);
-	return (ENOSYS);
-} 
+	struct g_geom *gp;
+	struct g_provider *pp;
+	struct g_part_entry *pe, *entry;
+	struct g_part_table *table;
+	struct sbuf *sb;
+	quad_t end;
+	int error;
+
+	gp = gpp->gpp_geom;
+	G_PART_TRACE((G_T_TOPOLOGY, "%s(%s)", __func__, gp->name));
+	g_topology_assert();
+	table = gp->softc;
+
+	/* check gpp_index */
+	LIST_FOREACH(entry, &table->gpt_entry, gpe_entry) {
+		if (entry->gpe_deleted || entry->gpe_internal)
+			continue;
+		if (entry->gpe_index == gpp->gpp_index)
+			break;
+	}
+	if (entry == NULL) {
+		gctl_error(req, "%d index '%d'", ENOENT, gpp->gpp_index);
+		return (ENOENT);
+	}
+
+	/* check gpp_size */
+	end = entry->gpe_start + gpp->gpp_size - 1;
+	if (gpp->gpp_size < 1 || end > table->gpt_last) {
+		gctl_error(req, "%d size '%jd'", EINVAL,
+		    (intmax_t)gpp->gpp_size);
+		return (EINVAL);
+	}
+
+	LIST_FOREACH(pe, &table->gpt_entry, gpe_entry) {
+		if (pe->gpe_deleted || pe->gpe_internal || pe == entry)
+			continue;
+		if (end >= pe->gpe_start && end <= pe->gpe_end) {
+			gctl_error(req, "%d end '%jd'", ENOSPC,
+			    (intmax_t)end);
+			return (ENOSPC);
+		}
+		if (entry->gpe_start < pe->gpe_start && end > pe->gpe_end) {
+			gctl_error(req, "%d size '%jd'", ENOSPC,
+			    (intmax_t)gpp->gpp_size);
+			return (ENOSPC);
+		}
+	}
+
+	pp = entry->gpe_pp;
+	if ((g_debugflags & 16) == 0 &&
+	    (pp->acr > 0 || pp->acw > 0 || pp->ace > 0)) {
+		gctl_error(req, "%d", EBUSY);
+		return (EBUSY);
+	}
+
+	error = G_PART_RESIZE(table, entry, gpp);
+	if (error) {
+		gctl_error(req, "%d", error);
+		return (error);
+	}
+
+	if (!entry->gpe_created)
+		entry->gpe_modified = 1;
+
+	/* update mediasize of changed provider */
+	pp->mediasize = (entry->gpe_end - entry->gpe_start + 1) *
+		pp->sectorsize;
+
+	/* Provide feedback if so requested. */
+	if (gpp->gpp_parms & G_PART_PARM_OUTPUT) {
+		sb = sbuf_new_auto();
+		G_PART_FULLNAME(table, entry, sb, gp->name);
+		sbuf_cat(sb, " resized\n");
+		sbuf_finish(sb);
+		gctl_set_param(req, "output", sbuf_data(sb), sbuf_len(sb) + 1);
+		sbuf_delete(sb);
+	}
+	return (0);
+}
 
 static int
 g_part_ctl_setunset(struct gctl_req *req, struct g_part_parms *gpp,
@@ -1194,7 +1270,8 @@ g_part_ctlreq(struct gctl_req *req, stru
 			mparms |= G_PART_PARM_GEOM;
 		} else if (!strcmp(verb, "resize")) {
 			ctlreq = G_PART_CTL_RESIZE;
-			mparms |= G_PART_PARM_GEOM | G_PART_PARM_INDEX;
+			mparms |= G_PART_PARM_GEOM | G_PART_PARM_INDEX |
+			    G_PART_PARM_SIZE;
 		}
 		break;
 	case 's':

Modified: head/sys/geom/part/g_part_apm.c
==============================================================================
--- head/sys/geom/part/g_part_apm.c	Fri Apr 23 02:31:28 2010	(r207093)
+++ head/sys/geom/part/g_part_apm.c	Fri Apr 23 03:11:39 2010	(r207094)
@@ -74,6 +74,8 @@ static int g_part_apm_read(struct g_part
 static const char *g_part_apm_type(struct g_part_table *, struct g_part_entry *,
     char *, size_t);
 static int g_part_apm_write(struct g_part_table *, struct g_consumer *);
+static int g_part_apm_resize(struct g_part_table *, struct g_part_entry *,
+    struct g_part_parms *);
 
 static kobj_method_t g_part_apm_methods[] = {
 	KOBJMETHOD(g_part_add,		g_part_apm_add),
@@ -82,6 +84,7 @@ static kobj_method_t g_part_apm_methods[
 	KOBJMETHOD(g_part_dumpconf,	g_part_apm_dumpconf),
 	KOBJMETHOD(g_part_dumpto,	g_part_apm_dumpto),
 	KOBJMETHOD(g_part_modify,	g_part_apm_modify),
+	KOBJMETHOD(g_part_resize,	g_part_apm_resize),
 	KOBJMETHOD(g_part_name,		g_part_apm_name),
 	KOBJMETHOD(g_part_probe,	g_part_apm_probe),
 	KOBJMETHOD(g_part_read,		g_part_apm_read),
@@ -318,6 +321,19 @@ g_part_apm_modify(struct g_part_table *b
 	return (0);
 }
 
+static int
+g_part_apm_resize(struct g_part_table *basetable,
+    struct g_part_entry *baseentry, struct g_part_parms *gpp)
+{
+	struct g_part_apm_entry *entry;
+
+	entry = (struct g_part_apm_entry *)baseentry;
+	baseentry->gpe_end = baseentry->gpe_start + gpp->gpp_size - 1;
+	entry->ent.ent_size = gpp->gpp_size;
+
+	return (0);
+}
+
 static const char *
 g_part_apm_name(struct g_part_table *table, struct g_part_entry *baseentry,
     char *buf, size_t bufsz)

Modified: head/sys/geom/part/g_part_bsd.c
==============================================================================
--- head/sys/geom/part/g_part_bsd.c	Fri Apr 23 02:31:28 2010	(r207093)
+++ head/sys/geom/part/g_part_bsd.c	Fri Apr 23 03:11:39 2010	(r207094)
@@ -73,6 +73,8 @@ static int g_part_bsd_read(struct g_part
 static const char *g_part_bsd_type(struct g_part_table *, struct g_part_entry *,
     char *, size_t);
 static int g_part_bsd_write(struct g_part_table *, struct g_consumer *);
+static int g_part_bsd_resize(struct g_part_table *, struct g_part_entry *,
+    struct g_part_parms *);
 
 static kobj_method_t g_part_bsd_methods[] = {
 	KOBJMETHOD(g_part_add,		g_part_bsd_add),
@@ -82,6 +84,7 @@ static kobj_method_t g_part_bsd_methods[
 	KOBJMETHOD(g_part_dumpconf,	g_part_bsd_dumpconf),
 	KOBJMETHOD(g_part_dumpto,	g_part_bsd_dumpto),
 	KOBJMETHOD(g_part_modify,	g_part_bsd_modify),
+	KOBJMETHOD(g_part_resize,	g_part_bsd_resize),
 	KOBJMETHOD(g_part_name,		g_part_bsd_name),
 	KOBJMETHOD(g_part_probe,	g_part_bsd_probe),
 	KOBJMETHOD(g_part_read,		g_part_bsd_read),
@@ -288,6 +291,19 @@ g_part_bsd_modify(struct g_part_table *b
 	return (0);
 }
 
+static int
+g_part_bsd_resize(struct g_part_table *basetable,
+    struct g_part_entry *baseentry, struct g_part_parms *gpp)
+{
+	struct g_part_bsd_entry *entry;
+
+	entry = (struct g_part_bsd_entry *)baseentry;
+	baseentry->gpe_end = baseentry->gpe_start + gpp->gpp_size - 1;
+	entry->part.p_size = gpp->gpp_size;
+
+	return (0);
+}
+
 static const char *
 g_part_bsd_name(struct g_part_table *table, struct g_part_entry *baseentry,
     char *buf, size_t bufsz)

Modified: head/sys/geom/part/g_part_gpt.c
==============================================================================
--- head/sys/geom/part/g_part_gpt.c	Fri Apr 23 02:31:28 2010	(r207093)
+++ head/sys/geom/part/g_part_gpt.c	Fri Apr 23 03:11:39 2010	(r207094)
@@ -103,6 +103,8 @@ static int g_part_gpt_read(struct g_part
 static const char *g_part_gpt_type(struct g_part_table *, struct g_part_entry *,
     char *, size_t);
 static int g_part_gpt_write(struct g_part_table *, struct g_consumer *);
+static int g_part_gpt_resize(struct g_part_table *, struct g_part_entry *,
+    struct g_part_parms *);
 
 static kobj_method_t g_part_gpt_methods[] = {
 	KOBJMETHOD(g_part_add,		g_part_gpt_add),
@@ -112,6 +114,7 @@ static kobj_method_t g_part_gpt_methods[
 	KOBJMETHOD(g_part_dumpconf,	g_part_gpt_dumpconf),
 	KOBJMETHOD(g_part_dumpto,	g_part_gpt_dumpto),
 	KOBJMETHOD(g_part_modify,	g_part_gpt_modify),
+	KOBJMETHOD(g_part_resize,	g_part_gpt_resize),
 	KOBJMETHOD(g_part_name,		g_part_gpt_name),
 	KOBJMETHOD(g_part_probe,	g_part_gpt_probe),
 	KOBJMETHOD(g_part_read,		g_part_gpt_read),
@@ -550,6 +553,19 @@ g_part_gpt_modify(struct g_part_table *b
 	return (0);
 }
 
+static int
+g_part_gpt_resize(struct g_part_table *basetable,
+    struct g_part_entry *baseentry, struct g_part_parms *gpp)
+{
+	struct g_part_gpt_entry *entry;
+	entry = (struct g_part_gpt_entry *)baseentry;
+
+	baseentry->gpe_end = baseentry->gpe_start + gpp->gpp_size - 1;
+	entry->ent.ent_lba_end = baseentry->gpe_end;
+
+	return (0);
+}
+
 static const char *
 g_part_gpt_name(struct g_part_table *table, struct g_part_entry *baseentry,
     char *buf, size_t bufsz)

Modified: head/sys/geom/part/g_part_if.m
==============================================================================
--- head/sys/geom/part/g_part_if.m	Fri Apr 23 02:31:28 2010	(r207093)
+++ head/sys/geom/part/g_part_if.m	Fri Apr 23 03:11:39 2010	(r207094)
@@ -58,6 +58,13 @@ CODE {
 	{
 		return (0);
 	}
+
+	static int
+	default_resize(struct g_part_table *t __unused,
+	    struct g_part_entry *e __unused, struct g_part_parms *p __unused)
+	{
+		return (ENOSYS);
+	}
 };
 
 # add() - scheme specific processing for the add verb.
@@ -114,6 +121,13 @@ METHOD int modify {
 	struct g_part_parms *gpp;
 };
 
+# resize() - scheme specific processing for the resize verb.
+METHOD int resize {
+	struct g_part_table *table;
+	struct g_part_entry *entry;
+	struct g_part_parms *gpp;
+} DEFAULT default_resize;
+
 # name() - return the name of the given partition entry.
 # Typical names are "p1", "s0" or "c".
 METHOD const char * name {

Modified: head/sys/geom/part/g_part_mbr.c
==============================================================================
--- head/sys/geom/part/g_part_mbr.c	Fri Apr 23 02:31:28 2010	(r207093)
+++ head/sys/geom/part/g_part_mbr.c	Fri Apr 23 03:11:39 2010	(r207094)
@@ -76,6 +76,8 @@ static int g_part_mbr_setunset(struct g_
 static const char *g_part_mbr_type(struct g_part_table *, struct g_part_entry *,
     char *, size_t);
 static int g_part_mbr_write(struct g_part_table *, struct g_consumer *);
+static int g_part_mbr_resize(struct g_part_table *, struct g_part_entry *,
+    struct g_part_parms *);
 
 static kobj_method_t g_part_mbr_methods[] = {
 	KOBJMETHOD(g_part_add,		g_part_mbr_add),
@@ -85,6 +87,7 @@ static kobj_method_t g_part_mbr_methods[
 	KOBJMETHOD(g_part_dumpconf,	g_part_mbr_dumpconf),
 	KOBJMETHOD(g_part_dumpto,	g_part_mbr_dumpto),
 	KOBJMETHOD(g_part_modify,	g_part_mbr_modify),
+	KOBJMETHOD(g_part_resize,	g_part_mbr_resize),
 	KOBJMETHOD(g_part_name,		g_part_mbr_name),
 	KOBJMETHOD(g_part_probe,	g_part_mbr_probe),
 	KOBJMETHOD(g_part_read,		g_part_mbr_read),
@@ -302,6 +305,31 @@ g_part_mbr_modify(struct g_part_table *b
 	return (0);
 }
 
+static int
+g_part_mbr_resize(struct g_part_table *basetable,
+    struct g_part_entry *baseentry, struct g_part_parms *gpp)
+{
+	struct g_part_mbr_entry *entry;
+	uint32_t size, sectors;
+
+	sectors = basetable->gpt_sectors;
+	size = gpp->gpp_size;
+
+	if (size < sectors)
+		return (EINVAL);
+	if (size % sectors)
+		size = size - (size % sectors);
+	if (size < sectors)
+		return (EINVAL);
+
+	entry = (struct g_part_mbr_entry *)baseentry;
+	baseentry->gpe_end = baseentry->gpe_start + size - 1;
+	entry->ent.dp_size = size;
+	mbr_set_chs(basetable, baseentry->gpe_end, &entry->ent.dp_ecyl,
+	    &entry->ent.dp_ehd, &entry->ent.dp_esect);
+	return (0);
+}
+
 static const char *
 g_part_mbr_name(struct g_part_table *table, struct g_part_entry *baseentry,
     char *buf, size_t bufsz)

Modified: head/sys/geom/part/g_part_pc98.c
==============================================================================
--- head/sys/geom/part/g_part_pc98.c	Fri Apr 23 02:31:28 2010	(r207093)
+++ head/sys/geom/part/g_part_pc98.c	Fri Apr 23 03:11:39 2010	(r207094)
@@ -77,6 +77,8 @@ static int g_part_pc98_setunset(struct g
 static const char *g_part_pc98_type(struct g_part_table *,
     struct g_part_entry *, char *, size_t);
 static int g_part_pc98_write(struct g_part_table *, struct g_consumer *);
+static int g_part_pc98_resize(struct g_part_table *, struct g_part_entry *,  
+    struct g_part_parms *);
 
 static kobj_method_t g_part_pc98_methods[] = {
 	KOBJMETHOD(g_part_add,		g_part_pc98_add),
@@ -86,6 +88,7 @@ static kobj_method_t g_part_pc98_methods
 	KOBJMETHOD(g_part_dumpconf,	g_part_pc98_dumpconf),
 	KOBJMETHOD(g_part_dumpto,	g_part_pc98_dumpto),
 	KOBJMETHOD(g_part_modify,	g_part_pc98_modify),
+	KOBJMETHOD(g_part_resize,	g_part_pc98_resize),
 	KOBJMETHOD(g_part_name,		g_part_pc98_name),
 	KOBJMETHOD(g_part_probe,	g_part_pc98_probe),
 	KOBJMETHOD(g_part_read,		g_part_pc98_read),
@@ -308,6 +311,31 @@ g_part_pc98_modify(struct g_part_table *
 	return (0);
 }
 
+static int
+g_part_pc98_resize(struct g_part_table *basetable,
+    struct g_part_entry *baseentry, struct g_part_parms *gpp)
+{
+	struct g_part_pc98_entry *entry;
+	uint32_t size, cyl;
+
+	cyl = basetable->gpt_heads * basetable->gpt_sectors;
+	size = gpp->gpp_size;
+
+	if (size < cyl)
+		return (EINVAL);
+	if (size % cyl)
+		size = size - (size % cyl);
+	if (size < cyl)
+		return (EINVAL);
+
+	entry = (struct g_part_pc98_entry *)baseentry;
+	baseentry->gpe_end = baseentry->gpe_start + size - 1;
+	pc98_set_chs(basetable, baseentry->gpe_end, &entry->ent.dp_ecyl,
+	    &entry->ent.dp_ehd, &entry->ent.dp_esect);
+
+	return (0);
+}
+
 static const char *
 g_part_pc98_name(struct g_part_table *table, struct g_part_entry *baseentry,
     char *buf, size_t bufsz)

Modified: head/sys/geom/part/g_part_vtoc8.c
==============================================================================
--- head/sys/geom/part/g_part_vtoc8.c	Fri Apr 23 02:31:28 2010	(r207093)
+++ head/sys/geom/part/g_part_vtoc8.c	Fri Apr 23 03:11:39 2010	(r207094)
@@ -67,6 +67,8 @@ static int g_part_vtoc8_read(struct g_pa
 static const char *g_part_vtoc8_type(struct g_part_table *, struct g_part_entry *,
     char *, size_t);
 static int g_part_vtoc8_write(struct g_part_table *, struct g_consumer *);
+static int g_part_vtoc8_resize(struct g_part_table *, struct g_part_entry *,  
+    struct g_part_parms *);
 
 static kobj_method_t g_part_vtoc8_methods[] = {
 	KOBJMETHOD(g_part_add,		g_part_vtoc8_add),
@@ -75,6 +77,7 @@ static kobj_method_t g_part_vtoc8_method
 	KOBJMETHOD(g_part_dumpconf,	g_part_vtoc8_dumpconf),
 	KOBJMETHOD(g_part_dumpto,	g_part_vtoc8_dumpto),
 	KOBJMETHOD(g_part_modify,	g_part_vtoc8_modify),
+	KOBJMETHOD(g_part_resize,	g_part_vtoc8_resize),
 	KOBJMETHOD(g_part_name,		g_part_vtoc8_name),
 	KOBJMETHOD(g_part_probe,	g_part_vtoc8_probe),
 	KOBJMETHOD(g_part_read,		g_part_vtoc8_read),
@@ -294,6 +297,26 @@ g_part_vtoc8_modify(struct g_part_table 
 	return (0);
 }
 
+static int
+g_part_vtoc8_resize(struct g_part_table *basetable,
+    struct g_part_entry *entry, struct g_part_parms *gpp)
+{
+	struct g_part_vtoc8_table *table;
+	uint64_t size;
+
+	table = (struct g_part_vtoc8_table *)basetable;
+	size = gpp->gpp_size;
+	if (size % table->secpercyl)
+		size = size - (size % table->secpercyl);
+	if (size < table->secpercyl)
+		return (EINVAL);
+
+	entry->gpe_end = entry->gpe_start + size - 1;
+	be32enc(&table->vtoc.map[entry->gpe_index - 1].nblks, size);
+
+	return (0);
+}
+
 static const char *
 g_part_vtoc8_name(struct g_part_table *table, struct g_part_entry *baseentry,
     char *buf, size_t bufsz)

From owner-svn-src-head@FreeBSD.ORG  Fri Apr 23 03:14:05 2010
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 12B3B1065674;
	Fri, 23 Apr 2010 03:14:05 +0000 (UTC)
	(envelope-from marcel@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 0241F8FC1C;
	Fri, 23 Apr 2010 03:14:05 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o3N3E4ok074498;
	Fri, 23 Apr 2010 03:14:04 GMT (envelope-from marcel@svn.freebsd.org)
Received: (from marcel@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o3N3E4t1074495;
	Fri, 23 Apr 2010 03:14:04 GMT (envelope-from marcel@svn.freebsd.org)
Message-Id: <201004230314.o3N3E4t1074495@svn.freebsd.org>
From: Marcel Moolenaar 
Date: Fri, 23 Apr 2010 03:14:04 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r207095 - head/sbin/geom/class/part
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 23 Apr 2010 03:14:05 -0000

Author: marcel
Date: Fri Apr 23 03:14:04 2010
New Revision: 207095
URL: http://svn.freebsd.org/changeset/base/207095

Log:
  Implement the resize command for resizing partitions. Without new
  size, the partition in question is resized to fill all available
  space. Quality work by Andrey!
  
  Submitted by:	"Andrey V. Elsukov" 

Modified:
  head/sbin/geom/class/part/geom_part.c
  head/sbin/geom/class/part/gpart.8

Modified: head/sbin/geom/class/part/geom_part.c
==============================================================================
--- head/sbin/geom/class/part/geom_part.c	Fri Apr 23 03:11:39 2010	(r207094)
+++ head/sbin/geom/class/part/geom_part.c	Fri Apr 23 03:14:04 2010	(r207095)
@@ -133,6 +133,13 @@ struct g_command PUBSYM(class_commands)[
 		G_OPT_SENTINEL },
 	  "geom", NULL
         },
+	{ "resize", 0, gpart_issue, {
+		{ 's', "size", autofill, G_TYPE_ASCLBA },
+		{ 'i', index_param, NULL, G_TYPE_ASCNUM },
+		{ 'f', "flags", flags, G_TYPE_STRING },
+		G_OPT_SENTINEL },
+	  "geom", NULL
+	},
 	G_CMD_SENTINEL
 };
 
@@ -243,6 +250,99 @@ fmtattrib(struct gprovider *pp)
 }
 
 static int
+gpart_autofill_resize(struct gctl_req *req)
+{
+	struct gmesh mesh;
+	struct gclass *cp;
+	struct ggeom *gp;
+	struct gprovider *pp;
+	unsigned long long last, size, start, new_size;
+	unsigned long long lba, new_lba;
+	const char *s;
+	char *val;
+	int error, idx;
+
+	s = gctl_get_ascii(req, "size");
+	if (*s == '*')
+		new_size = (unsigned long long)atoll(s);
+	else
+		return (0);
+
+	s = gctl_get_ascii(req, index_param);
+	idx = strtol(s, &val, 10);
+	if (idx < 1 || *s == '\0' || *val != '\0')
+		errx(EXIT_FAILURE, "invalid partition index");
+
+	error = geom_gettree(&mesh);
+	if (error)
+		return (error);
+	s = gctl_get_ascii(req, "class");
+	if (s == NULL)
+		abort();
+	cp = find_class(&mesh, s);
+	if (cp == NULL)
+		errx(EXIT_FAILURE, "Class %s not found.", s);
+	s = gctl_get_ascii(req, "geom");
+	if (s == NULL)
+		abort();
+	gp = find_geom(cp, s);
+	if (gp == NULL)
+		errx(EXIT_FAILURE, "No such geom: %s.", s);
+	last = atoll(find_geomcfg(gp, "last"));
+
+	LIST_FOREACH(pp, &gp->lg_provider, lg_provider) {
+		s = find_provcfg(pp, "index");
+		if (s == NULL)
+			continue;
+		if (atoi(s) == idx)
+			break;
+	}
+	if (pp == NULL)
+		errx(EXIT_FAILURE, "invalid partition index");
+
+	s = find_provcfg(pp, "start");
+	if (s == NULL) {
+		s = find_provcfg(pp, "offset");
+		start = atoll(s) / pp->lg_sectorsize;
+	} else
+		start = atoll(s);
+	s = find_provcfg(pp, "end");
+	if (s == NULL) {
+		s = find_provcfg(pp, "length");
+		lba = start + atoll(s) / pp->lg_sectorsize;
+	} else
+		lba = atoll(s) + 1;
+
+	if (lba > last)
+		return (ENOSPC);
+	size = lba - start;
+	pp = find_provider(gp, lba);
+	if (pp == NULL)
+		new_size = last - start + 1;
+	else {
+		s = find_provcfg(pp, "start");
+		if (s == NULL) {
+			s = find_provcfg(pp, "offset");
+			new_lba = atoll(s) / pp->lg_sectorsize;
+		} else
+			new_lba = atoll(s);
+		/* Is there any free space between current and
+		 * next providers?
+		 */
+		if (new_lba > lba)
+			new_size = new_lba - start;
+		else
+			return (ENOSPC);
+	}
+	asprintf(&val, "%llu", new_size);
+	if (val == NULL)
+		return (ENOMEM);
+	gctl_change_param(req, "size", -1, val);
+
+	return (0);
+}
+
+static int
 gpart_autofill(struct gctl_req *req)
 {
 	struct gmesh mesh;
@@ -257,6 +357,8 @@ gpart_autofill(struct gctl_req *req)
 	int error, has_size, has_start;
 
 	s = gctl_get_ascii(req, "verb");
+	if (strcmp(s, "resize") == 0)
+		return gpart_autofill_resize(req);
 	if (strcmp(s, "add") != 0)
 		return (0);
 

Modified: head/sbin/geom/class/part/gpart.8
==============================================================================
--- head/sbin/geom/class/part/gpart.8	Fri Apr 23 03:11:39 2010	(r207094)
+++ head/sbin/geom/class/part/gpart.8	Fri Apr 23 03:14:04 2010	(r207095)
@@ -24,7 +24,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd November 18, 2008
+.Dd April 22, 2010
 .Dt GPART 8
 .Os
 .Sh NAME
@@ -120,6 +120,13 @@ utility:
 .Op Fl t Ar type
 .Op Fl f Ar flags
 .Ar geom
+.\" ==== RESIZE ====
+.Nm
+.Cm resize
+.Fl i Ar index
+.Op Fl s Ar size
+.Op Fl f Ar flags
+.Ar geom
 .\" ==== SET ====
 .Nm
 .Cm set
@@ -325,6 +332,30 @@ See the section entitled
 below for a discussion
 about its use.
 .El
+.\" ==== RESIZE ====
+.It Cm resize
+Resize a partition from geom
+.Ar geom
+and further identified by the
+.Fl i Ar index
+option. New partition size is expressed in logical block
+numbers and can be given by the 
+.Fl s Ar size
+option. If
+.Fl s
+option is ommited then new size is automatically calculated
+to maximum available from given geom
+.Ar geom .
+.Pp
+Additional options include:
+.Bl -tag -width 10n
+.It Fl f Ar flags
+Additional operational flags.
+See the section entitled
+.Sx "OPERATIONAL FLAGS"
+below for a discussion
+about its use.
+.El
 .\" ==== SET ====
 .It Cm set
 Set the named attribute on the partition entry.

From owner-svn-src-head@FreeBSD.ORG  Fri Apr 23 03:37:39 2010
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id D4937106566B;
	Fri, 23 Apr 2010 03:37:39 +0000 (UTC)
	(envelope-from marcel@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id C497C8FC1A;
	Fri, 23 Apr 2010 03:37:39 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o3N3bdaK079743;
	Fri, 23 Apr 2010 03:37:39 GMT (envelope-from marcel@svn.freebsd.org)
Received: (from marcel@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o3N3bd7Q079742;
	Fri, 23 Apr 2010 03:37:39 GMT (envelope-from marcel@svn.freebsd.org)
Message-Id: <201004230337.o3N3bd7Q079742@svn.freebsd.org>
From: Marcel Moolenaar 
Date: Fri, 23 Apr 2010 03:37:39 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r207096 - head/sbin/geom/class/part
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 23 Apr 2010 03:37:39 -0000

Author: marcel
Date: Fri Apr 23 03:37:39 2010
New Revision: 207096
URL: http://svn.freebsd.org/changeset/base/207096

Log:
  Add and describe GEOM_PART_EBR.

Modified:
  head/sbin/geom/class/part/gpart.8

Modified: head/sbin/geom/class/part/gpart.8
==============================================================================
--- head/sbin/geom/class/part/gpart.8	Fri Apr 23 03:14:04 2010	(r207095)
+++ head/sbin/geom/class/part/gpart.8	Fri Apr 23 03:37:39 2010	(r207096)
@@ -37,6 +37,7 @@ lines in your kernel configuration file:
 .Bd -ragged -offset indent
 .Cd "options GEOM_PART_APM"
 .Cd "options GEOM_PART_BSD"
+.Cd "options GEOM_PART_EBR"
 .Cd "options GEOM_PART_GPT"
 .Cd "options GEOM_PART_MBR"
 .Cd "options GEOM_PART_PC98"
@@ -53,6 +54,10 @@ option adds support for the traditional
 .Bx
 disklabel.
 The
+.Dv GEOM_PART_EBR
+option adds support for the Extended Boot Record (EBR),
+which is used to define a logical partition.
+The
 .Dv GEOM_PART_GPT
 option adds support for the GUID Partition Table (GPT)
 found on Intel Itanium computers and Intel-based Macintosh computers.

From owner-svn-src-head@FreeBSD.ORG  Fri Apr 23 06:51:19 2010
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 69B481065670;
	Fri, 23 Apr 2010 06:51:19 +0000 (UTC)
	(envelope-from marius@alchemy.franken.de)
Received: from alchemy.franken.de (alchemy.franken.de [194.94.249.214])
	by mx1.freebsd.org (Postfix) with ESMTP id EA5068FC0A;
	Fri, 23 Apr 2010 06:51:18 +0000 (UTC)
Received: from alchemy.franken.de (localhost [127.0.0.1])
	by alchemy.franken.de (8.14.3/8.14.3/ALCHEMY.FRANKEN.DE) with ESMTP id
	o3N6pGWD091720; Fri, 23 Apr 2010 08:51:17 +0200 (CEST)
	(envelope-from marius@alchemy.franken.de)
Received: (from marius@localhost)
	by alchemy.franken.de (8.14.3/8.14.3/Submit) id o3N6pGTU091719;
	Fri, 23 Apr 2010 08:51:16 +0200 (CEST) (envelope-from marius)
Date: Fri, 23 Apr 2010 08:51:16 +0200
From: Marius Strobl 
To: Andrew Thompson 
Message-ID: <20100423065116.GA59832@alchemy.franken.de>
References: <201004222131.o3MLVYj2097482@svn.freebsd.org>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <201004222131.o3MLVYj2097482@svn.freebsd.org>
User-Agent: Mutt/1.4.2.3i
Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org,
	src-committers@freebsd.org
Subject: Re: svn commit: r207077 - in head/sys: amd64/conf arm/conf
	dev/sound/usb dev/usb dev/usb/controller dev/usb/input
	dev/usb/misc dev/usb/net dev/usb/serial dev/usb/storage
	dev/usb/wlan i386/conf ia64/con...
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 23 Apr 2010 06:51:19 -0000

On Thu, Apr 22, 2010 at 09:31:34PM +0000, Andrew Thompson wrote:
> Author: thompsa
> Date: Thu Apr 22 21:31:34 2010
> New Revision: 207077
> URL: http://svn.freebsd.org/changeset/base/207077
> 
> Log:
>   Change USB_DEBUG to #ifdef and allow it to be turned off. Previously this had
>   the illusion of a tunable setting but was always turned on regardless.
>   

What's the rationale behind enabling it in all configuration files
except those of amd64 and pc98?

Marius


From owner-svn-src-head@FreeBSD.ORG  Fri Apr 23 07:30:42 2010
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 9ED501065677;
	Fri, 23 Apr 2010 07:30:42 +0000 (UTC)
	(envelope-from thompsa@FreeBSD.org)
Received: from pele.citylink.co.nz (pele.citylink.co.nz [202.8.44.226])
	by mx1.freebsd.org (Postfix) with ESMTP id 5D0468FC1E;
	Fri, 23 Apr 2010 07:30:41 +0000 (UTC)
Received: from localhost (localhost [127.0.0.1])
	by pele.citylink.co.nz (Postfix) with ESMTP id 4D7B47BF31;
	Fri, 23 Apr 2010 19:30:40 +1200 (NZST)
X-Virus-Scanned: Debian amavisd-new at citylink.co.nz
Received: from pele.citylink.co.nz ([127.0.0.1])
	by localhost (pele.citylink.co.nz [127.0.0.1]) (amavisd-new, port 10024)
	with ESMTP id cFrIdZ76Wv3l; Fri, 23 Apr 2010 19:30:35 +1200 (NZST)
Received: from citylink.fud.org.nz (unknown [202.8.44.45])
	by pele.citylink.co.nz (Postfix) with ESMTP;
	Fri, 23 Apr 2010 19:30:35 +1200 (NZST)
Received: by citylink.fud.org.nz (Postfix, from userid 1001)
	id 39E8C11420; Fri, 23 Apr 2010 19:30:35 +1200 (NZST)
Date: Fri, 23 Apr 2010 19:30:35 +1200
From: Andrew Thompson 
To: Marius Strobl 
Message-ID: <20100423073035.GA20337@citylink.fud.org.nz>
References: <201004222131.o3MLVYj2097482@svn.freebsd.org>
	<20100423065116.GA59832@alchemy.franken.de>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <20100423065116.GA59832@alchemy.franken.de>
User-Agent: Mutt/1.5.17 (2007-11-01)
Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org,
	src-committers@freebsd.org
Subject: Re: svn commit: r207077 - in head/sys: amd64/conf arm/conf
	dev/sound/usb dev/usb dev/usb/controller dev/usb/input dev/usb/misc
	dev/usb/net dev/usb/serial dev/usb/storage dev/usb/wlan i386/conf
	ia64/con...
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 23 Apr 2010 07:30:42 -0000

On Fri, Apr 23, 2010 at 08:51:16AM +0200, Marius Strobl wrote:
> On Thu, Apr 22, 2010 at 09:31:34PM +0000, Andrew Thompson wrote:
> > Author: thompsa
> > Date: Thu Apr 22 21:31:34 2010
> > New Revision: 207077
> > URL: http://svn.freebsd.org/changeset/base/207077
> > 
> > Log:
> >   Change USB_DEBUG to #ifdef and allow it to be turned off. Previously this had
> >   the illusion of a tunable setting but was always turned on regardless.
> >   
> 
> What's the rationale behind enabling it in all configuration files
> except those of amd64 and pc98?

Well since it was enabled before I was just keeping status quo. Missing
amd64 and pc98 was probably an oversight on my behalf.


Andrew

From owner-svn-src-head@FreeBSD.ORG  Fri Apr 23 08:19:47 2010
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id DB6A11065675;
	Fri, 23 Apr 2010 08:19:47 +0000 (UTC)
	(envelope-from tuexen@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id C9AD08FC1F;
	Fri, 23 Apr 2010 08:19:47 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o3N8Jlcw041799;
	Fri, 23 Apr 2010 08:19:47 GMT (envelope-from tuexen@svn.freebsd.org)
Received: (from tuexen@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o3N8JljQ041797;
	Fri, 23 Apr 2010 08:19:47 GMT (envelope-from tuexen@svn.freebsd.org)
Message-Id: <201004230819.o3N8JljQ041797@svn.freebsd.org>
From: Michael Tuexen 
Date: Fri, 23 Apr 2010 08:19:47 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r207099 - head/sys/netinet
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 23 Apr 2010 08:19:48 -0000

Author: tuexen
Date: Fri Apr 23 08:19:47 2010
New Revision: 207099
URL: http://svn.freebsd.org/changeset/base/207099

Log:
  * Fix compilation when using SCTP_AUDITING_ENABLED.
  * Fix delaying of SACK by taking out old optimization code
    which does not optimize anymore.
  * Fix fast retransmission of chunks abandoned by the
    "number of retransmissions" policy.
  
  MFC after: 3 days.

Modified:
  head/sys/netinet/sctp_asconf.c
  head/sys/netinet/sctp_indata.c
  head/sys/netinet/sctputil.c

Modified: head/sys/netinet/sctp_asconf.c
==============================================================================
--- head/sys/netinet/sctp_asconf.c	Fri Apr 23 07:32:42 2010	(r207098)
+++ head/sys/netinet/sctp_asconf.c	Fri Apr 23 08:19:47 2010	(r207099)
@@ -1113,7 +1113,7 @@ sctp_assoc_immediate_retrans(struct sctp
 		}
 		SCTP_TCB_LOCK_ASSERT(stcb);
 #ifdef SCTP_AUDITING_ENABLED
-		sctp_auditing(4, stcb->sctp_ep, stcb->asoc.deleted_primary);
+		sctp_auditing(4, stcb->sctp_ep, stcb, stcb->asoc.deleted_primary);
 #endif
 		sctp_chunk_output(stcb->sctp_ep, stcb, SCTP_OUTPUT_FROM_T3, SCTP_SO_NOT_LOCKED);
 		if ((stcb->asoc.num_send_timers_up == 0) &&

Modified: head/sys/netinet/sctp_indata.c
==============================================================================
--- head/sys/netinet/sctp_indata.c	Fri Apr 23 07:32:42 2010	(r207098)
+++ head/sys/netinet/sctp_indata.c	Fri Apr 23 08:19:47 2010	(r207099)
@@ -2823,25 +2823,7 @@ sctp_process_data(struct mbuf **mm, int 
 		stcb->asoc.send_sack = 1;
 	}
 	/* Start a sack timer or QUEUE a SACK for sending */
-	if ((stcb->asoc.cumulative_tsn == stcb->asoc.highest_tsn_inside_nr_map) &&
-	    (stcb->asoc.nr_mapping_array[0] != 0xff)) {
-		if ((stcb->asoc.data_pkts_seen >= stcb->asoc.sack_freq) ||
-		    (stcb->asoc.delayed_ack == 0) ||
-		    (stcb->asoc.numduptsns) ||
-		    (stcb->asoc.send_sack == 1)) {
-			if (SCTP_OS_TIMER_PENDING(&stcb->asoc.dack_timer.timer)) {
-				(void)SCTP_OS_TIMER_STOP(&stcb->asoc.dack_timer.timer);
-			}
-			sctp_send_sack(stcb);
-		} else {
-			if (!SCTP_OS_TIMER_PENDING(&stcb->asoc.dack_timer.timer)) {
-				sctp_timer_start(SCTP_TIMER_TYPE_RECV,
-				    stcb->sctp_ep, stcb, NULL);
-			}
-		}
-	} else {
-		sctp_sack_check(stcb, was_a_gap, &abort_flag);
-	}
+	sctp_sack_check(stcb, was_a_gap, &abort_flag);
 	if (abort_flag)
 		return (2);
 
@@ -3532,6 +3514,25 @@ sctp_strike_gap_ack_chunks(struct sctp_t
 		if (tp1->sent == SCTP_DATAGRAM_RESEND) {
 			struct sctp_nets *alt;
 
+			if ((stcb->asoc.peer_supports_prsctp) &&
+			    (PR_SCTP_RTX_ENABLED(tp1->flags))) {
+				/*
+				 * 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) {
+						(void)sctp_release_pr_sctp_chunk(stcb, tp1,
+						    (SCTP_RESPONSE_TO_USER_REQ | SCTP_NOTIFY_DATAGRAM_SENT),
+						    SCTP_SO_NOT_LOCKED);
+					}
+					/* Make sure to flag we had a FR */
+					tp1->whoTo->net_ack++;
+					tp1 = TAILQ_NEXT(tp1, sctp_next);
+					continue;
+				}
+			}
 			/* fix counts and things */
 			if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_FLIGHT_LOGGING_ENABLE) {
 				sctp_misc_ints(SCTP_FLIGHT_LOG_DOWN_RSND,
@@ -3554,25 +3555,6 @@ sctp_strike_gap_ack_chunks(struct sctp_t
 			/* remove from the total flight */
 			sctp_total_flight_decrease(stcb, tp1);
 
-			if ((stcb->asoc.peer_supports_prsctp) &&
-			    (PR_SCTP_RTX_ENABLED(tp1->flags))) {
-				/*
-				 * 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) {
-						(void)sctp_release_pr_sctp_chunk(stcb, tp1,
-						    (SCTP_RESPONSE_TO_USER_REQ | SCTP_NOTIFY_DATAGRAM_SENT),
-						    SCTP_SO_NOT_LOCKED);
-					}
-					/* Make sure to flag we had a FR */
-					tp1->whoTo->net_ack++;
-					tp1 = TAILQ_NEXT(tp1, sctp_next);
-					continue;
-				}
-			}
 			/* 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,

Modified: head/sys/netinet/sctputil.c
==============================================================================
--- head/sys/netinet/sctputil.c	Fri Apr 23 07:32:42 2010	(r207098)
+++ head/sys/netinet/sctputil.c	Fri Apr 23 08:19:47 2010	(r207099)
@@ -674,7 +674,7 @@ sctp_auditing(int from, struct sctp_inpc
 			sctp_audit_indx = 0;
 		}
 		rep = 1;
-		SCTP_PRINTF("tot_flt_book:%d\n", tot_book);
+		SCTP_PRINTF("tot_flt_book:%d\n", tot_book_cnt);
 
 		stcb->asoc.total_flight_count = tot_book_cnt;
 	}
@@ -703,8 +703,8 @@ sctp_auditing(int from, struct sctp_inpc
 				}
 			}
 			if (lnet->flight_size != tot_out) {
-				SCTP_PRINTF("net:%x flight was %d corrected to %d\n",
-				    (uint32_t) lnet, lnet->flight_size,
+				SCTP_PRINTF("net:%p flight was %d corrected to %d\n",
+				    lnet, lnet->flight_size,
 				    tot_out);
 				lnet->flight_size = tot_out;
 			}

From owner-svn-src-head@FreeBSD.ORG  Fri Apr 23 10:55:05 2010
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 768EF106566B;
	Fri, 23 Apr 2010 10:55:05 +0000 (UTC)
	(envelope-from kostikbel@gmail.com)
Received: from mail.zoral.com.ua (mx0.zoral.com.ua [91.193.166.200])
	by mx1.freebsd.org (Postfix) with ESMTP id 5A31A8FC1C;
	Fri, 23 Apr 2010 10:55:03 +0000 (UTC)
Received: from deviant.kiev.zoral.com.ua (root@deviant.kiev.zoral.com.ua
	[10.1.1.148])
	by mail.zoral.com.ua (8.14.2/8.14.2) with ESMTP id o3NAso1u015771
	(version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO);
	Fri, 23 Apr 2010 13:54:50 +0300 (EEST)
	(envelope-from kostikbel@gmail.com)
Received: from deviant.kiev.zoral.com.ua (kostik@localhost [127.0.0.1])
	by deviant.kiev.zoral.com.ua (8.14.4/8.14.4) with ESMTP id
	o3NAso8u093935; Fri, 23 Apr 2010 13:54:50 +0300 (EEST)
	(envelope-from kostikbel@gmail.com)
Received: (from kostik@localhost)
	by deviant.kiev.zoral.com.ua (8.14.4/8.14.4/Submit) id o3NAso3x093933; 
	Fri, 23 Apr 2010 13:54:50 +0300 (EEST)
	(envelope-from kostikbel@gmail.com)
X-Authentication-Warning: deviant.kiev.zoral.com.ua: kostik set sender to
	kostikbel@gmail.com using -f
Date: Fri, 23 Apr 2010 13:54:50 +0300
From: Kostik Belousov 
To: Gabor Kovesdan 
Message-ID: <20100423105450.GA90348@deviant.kiev.zoral.com.ua>
References: <201001252337.o0PNbobw012278@svn.freebsd.org>
Mime-Version: 1.0
Content-Type: multipart/signed; micalg=pgp-sha1;
	protocol="application/pgp-signature"; boundary="9amGYk9869ThD9tj"
Content-Disposition: inline
In-Reply-To: <201001252337.o0PNbobw012278@svn.freebsd.org>
User-Agent: Mutt/1.4.2.3i
X-Virus-Scanned: clamav-milter 0.95.2 at skuns.kiev.zoral.com.ua
X-Virus-Status: Clean
X-Spam-Status: No, score=-3.8 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00,
	DNS_FROM_OPENWHOIS autolearn=no version=3.2.5
X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on
	skuns.kiev.zoral.com.ua
Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org,
	src-committers@freebsd.org
Subject: Re: svn commit: r202992 - head/lib/libc/nls
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 23 Apr 2010 10:55:05 -0000


--9amGYk9869ThD9tj
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Mon, Jan 25, 2010 at 11:37:50PM +0000, Gabor Kovesdan wrote:
> Author: gabor (doc,ports committer)
> Date: Mon Jan 25 23:37:49 2010
> New Revision: 202992
> URL: http://svn.freebsd.org/changeset/base/202992
>=20
> Log:
>   Cache failing and opened catalogs in catopen() and related functions.
>   Continuous catopen() calls cause 4 failig stat(2) each, which means a l=
ot
>   of overhead.  It is also a good idea to keep the opened catalogs in the=
 memory
>   to speed up further catopen() calls to the same catalog since these cat=
alogs
>   are not big at all.  In this case, we count references and only free() =
the
>   allocated space when the reference count reaches 0.  The reads and writ=
es to
>   the cache are syncronized with an rwlock when these functions are calle=
d from
>   a threaded program.
>  =20
>   Requested by:	kib
>   Approved by:	delphij

Would you, please merge this (and followups) to stable/8, preferably before
the 8.1 freeze ?

Thanks.

--9amGYk9869ThD9tj
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (FreeBSD)

iEYEARECAAYFAkvRfHkACgkQC3+MBN1Mb4iq8QCfZmMM78cYZpT5U0rf77ozStgB
hcgAn1wCkXeiIX+QbGR5EQOxL3EuJ6k9
=u82W
-----END PGP SIGNATURE-----

--9amGYk9869ThD9tj--

From owner-svn-src-head@FreeBSD.ORG  Fri Apr 23 11:07:44 2010
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 016CC106564A;
	Fri, 23 Apr 2010 11:07:44 +0000 (UTC) (envelope-from flz@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id E0A808FC13;
	Fri, 23 Apr 2010 11:07:43 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o3NB7hNi080407;
	Fri, 23 Apr 2010 11:07:43 GMT (envelope-from flz@svn.freebsd.org)
Received: (from flz@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o3NB7h2a080365;
	Fri, 23 Apr 2010 11:07:43 GMT (envelope-from flz@svn.freebsd.org)
Message-Id: <201004231107.o3NB7h2a080365@svn.freebsd.org>
From: Florent Thoumie 
Date: Fri, 23 Apr 2010 11:07:43 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r207113 - in head: . lib lib/libpkg share/mk
	usr.sbin/pkg_install usr.sbin/pkg_install/add
	usr.sbin/pkg_install/create usr.sbin/pkg_install/delete
	usr.sbin/pkg_install/info usr.sbin/pkg...
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 23 Apr 2010 11:07:44 -0000

Author: flz
Date: Fri Apr 23 11:07:43 2010
New Revision: 207113
URL: http://svn.freebsd.org/changeset/base/207113

Log:
  - Take libinstall.a out of pkg_install and make it a proper shared library.
  - Rework the wrapper support to check libpkg version as well as pkg_install
  version.
  - Add libfetch to _prebuild_libs.
  - There are no new features introduced.
  
  Notes: the API is not stable, so basically, do not use libpkg in your
  projects for now. Also there's no manpage for libpkg yet, because the API
  will change drastically. I repeat, do not use libpkg for now.

Added:
  head/lib/libpkg/
     - copied from r206135, head/usr.sbin/pkg_install/lib/
  head/lib/libpkg/pkg.h
     - copied, changed from r206135, head/usr.sbin/pkg_install/lib/lib.h
Deleted:
  head/lib/libpkg/lib.h
  head/usr.sbin/pkg_install/lib/
Modified:
  head/Makefile.inc1
  head/lib/Makefile
  head/lib/libpkg/Makefile
  head/lib/libpkg/deps.c
  head/lib/libpkg/exec.c
  head/lib/libpkg/file.c
  head/lib/libpkg/global.c
  head/lib/libpkg/match.c
  head/lib/libpkg/msg.c
  head/lib/libpkg/pen.c
  head/lib/libpkg/pkgwrap.c
  head/lib/libpkg/plist.c
  head/lib/libpkg/str.c
  head/lib/libpkg/url.c
  head/lib/libpkg/version.c
  head/share/mk/bsd.libnames.mk
  head/usr.sbin/pkg_install/Makefile
  head/usr.sbin/pkg_install/Makefile.inc
  head/usr.sbin/pkg_install/add/Makefile
  head/usr.sbin/pkg_install/add/extract.c
  head/usr.sbin/pkg_install/add/futil.c
  head/usr.sbin/pkg_install/add/main.c
  head/usr.sbin/pkg_install/add/perform.c
  head/usr.sbin/pkg_install/create/Makefile
  head/usr.sbin/pkg_install/create/main.c
  head/usr.sbin/pkg_install/create/perform.c
  head/usr.sbin/pkg_install/create/pl.c
  head/usr.sbin/pkg_install/delete/Makefile
  head/usr.sbin/pkg_install/delete/main.c
  head/usr.sbin/pkg_install/delete/perform.c
  head/usr.sbin/pkg_install/info/Makefile
  head/usr.sbin/pkg_install/info/info.h
  head/usr.sbin/pkg_install/info/main.c
  head/usr.sbin/pkg_install/info/perform.c
  head/usr.sbin/pkg_install/info/show.c
  head/usr.sbin/pkg_install/updating/Makefile
  head/usr.sbin/pkg_install/updating/main.c
  head/usr.sbin/pkg_install/version/Makefile
  head/usr.sbin/pkg_install/version/main.c
  head/usr.sbin/pkg_install/version/perform.c

Modified: head/Makefile.inc1
==============================================================================
--- head/Makefile.inc1	Fri Apr 23 10:33:32 2010	(r207112)
+++ head/Makefile.inc1	Fri Apr 23 11:07:43 2010	(r207113)
@@ -1111,7 +1111,7 @@ _prebuild_libs=	${_kerberos5_lib_libasn1
 		${_kerberos5_lib_libhx509} ${_kerberos5_lib_libkrb5} \
 		${_kerberos5_lib_libroken} \
 		lib/libbz2 lib/libcom_err lib/libcrypt \
-		lib/libexpat \
+		lib/libexpat lib/libfetch \
 		${_lib_libgssapi} ${_lib_libipx} \
 		lib/libkiconv lib/libkvm lib/libmd \
 		lib/ncurses/ncurses lib/ncurses/ncursesw \
@@ -1138,6 +1138,7 @@ _cddl_lib= cddl/lib
 _secure_lib_libcrypto= secure/lib/libcrypto
 _secure_lib_libssl= secure/lib/libssl
 lib/libradius__L secure/lib/libssl__L: secure/lib/libcrypto__L
+lib/libfetch__L: secure/lib/libcrypto__L secure/lib/libssl__L lib/libmd__L
 .if ${MK_OPENSSH} != "no"
 _secure_lib_libssh= secure/lib/libssh
 secure/lib/libssh__L: lib/libz__L secure/lib/libcrypto__L lib/libcrypt__L
@@ -1173,7 +1174,7 @@ _lib_libypclnt=	lib/libypclnt
 .endif
 
 .if ${MK_OPENSSL} == "no"
-lib/libradius__L: lib/libmd__L
+lib/libfetch__L lib/libradius__L: lib/libmd__L
 .endif
 
 .for _lib in ${_prereq_libs}

Modified: head/lib/Makefile
==============================================================================
--- head/lib/Makefile	Fri Apr 23 10:33:32 2010	(r207112)
+++ head/lib/Makefile	Fri Apr 23 11:07:43 2010	(r207113)
@@ -85,6 +85,7 @@ SUBDIR=	${SUBDIR_ORDERED} \
 	libopie \
 	libpam \
 	libpcap \
+	${_libpkg} \
 	${_libpmc} \
 	libproc \
 	librt \
@@ -197,6 +198,10 @@ _libmp=		libmp
 _libpmc=	libpmc
 .endif
 
+.if ${MK_PKGTOOLS} != "no"
+_libpkg=	libpkg
+.endif
+
 .if ${MK_SENDMAIL} != "no"
 _libmilter=	libmilter
 _libsm=		libsm

Modified: head/lib/libpkg/Makefile
==============================================================================
--- head/usr.sbin/pkg_install/lib/Makefile	Sat Apr  3 11:19:20 2010	(r206135)
+++ head/lib/libpkg/Makefile	Fri Apr 23 11:07:43 2010	(r207113)
@@ -1,11 +1,47 @@
 # $FreeBSD$
 
-LIB=	install
-INTERNALLIB=
-SRCS=	file.c msg.c plist.c str.c exec.c global.c pen.c match.c \
-	deps.c version.c pkgwrap.c url.c
+.include 
 
-WARNS?=	3
-WFORMAT?=	1
+LIB=		pkg
+
+SHLIBDIR?=	/usr/lib
+SHLIB_MAJOR=	0
+
+SRCS=		deps.c		\
+		exec.c		\
+		file.c		\
+		global.c	\
+		match.c		\
+		msg.c		\
+		pen.c		\
+		pkgwrap.c	\
+		plist.c		\
+		str.c		\
+		url.c		\
+		version.c
+INCS=		pkg.h
+
+CFLAGS+=	-DYES_I_KNOW_THE_API_IS_RUBBISH_AND_IS_DOOMED_TO_CHANGE
+
+DPADD=		${LIBFETCH} ${LIBMD} ${LIBUTIL}
+LDADD=		-lfetch -lmd -lutil
+
+.if ${MK_OPENSSL} != "no"
+DPADD+=         ${LIBSSL} ${LIBCRYPTO}
+LDADD+=         -lssl -lcrypto
+.endif
+
+WARNS?=		3
+
+DATE!= grep LIBPKG_VERSION ${.CURDIR}/pkg.h | sed 's|.*[      ]||'
+
+distfile: clean
+	@(cd ${.CURDIR}/..; \
+		cp -r libpkg libpkg-${DATE}; \
+		tar -czf libpkg/libpkg-${DATE}.tar.gz \
+			--exclude .#* --exclude *~ --exclude CVS \
+			--exclude .svn --exclude libpkg-*.tar.gz \
+			libpkg-${DATE}; \
+		rm -rf libpkg-${DATE})
 
 .include 

Modified: head/lib/libpkg/deps.c
==============================================================================
--- head/usr.sbin/pkg_install/lib/deps.c	Sat Apr  3 11:19:20 2010	(r206135)
+++ head/lib/libpkg/deps.c	Fri Apr 23 11:07:43 2010	(r207113)
@@ -22,7 +22,7 @@
 #include 
 __FBSDID("$FreeBSD$");
 
-#include "lib.h"
+#include "pkg.h"
 #include 
 #include 
 

Modified: head/lib/libpkg/exec.c
==============================================================================
--- head/usr.sbin/pkg_install/lib/exec.c	Sat Apr  3 11:19:20 2010	(r206135)
+++ head/lib/libpkg/exec.c	Fri Apr 23 11:07:43 2010	(r207113)
@@ -21,7 +21,7 @@
 #include 
 __FBSDID("$FreeBSD$");
 
-#include "lib.h"
+#include "pkg.h"
 #include 
 
 /*

Modified: head/lib/libpkg/file.c
==============================================================================
--- head/usr.sbin/pkg_install/lib/file.c	Sat Apr  3 11:19:20 2010	(r206135)
+++ head/lib/libpkg/file.c	Fri Apr 23 11:07:43 2010	(r207113)
@@ -21,7 +21,7 @@
 #include 
 __FBSDID("$FreeBSD$");
 
-#include "lib.h"
+#include "pkg.h"
 #include 
 #include 
 #include 

Modified: head/lib/libpkg/global.c
==============================================================================
--- head/usr.sbin/pkg_install/lib/global.c	Sat Apr  3 11:19:20 2010	(r206135)
+++ head/lib/libpkg/global.c	Fri Apr 23 11:07:43 2010	(r207113)
@@ -22,7 +22,7 @@
 #include 
 __FBSDID("$FreeBSD$");
 
-#include "lib.h"
+#include "pkg.h"
 
 /* These are global for all utils */
 Boolean	Quiet		= FALSE;

Modified: head/lib/libpkg/match.c
==============================================================================
--- head/usr.sbin/pkg_install/lib/match.c	Sat Apr  3 11:19:20 2010	(r206135)
+++ head/lib/libpkg/match.c	Fri Apr 23 11:07:43 2010	(r207113)
@@ -21,7 +21,7 @@
 #include 
 __FBSDID("$FreeBSD$");
 
-#include "lib.h"
+#include "pkg.h"
 #include 
 #include 
 #include 
@@ -292,7 +292,7 @@ matchallbyorigin(const char **origins, i
 		break;
 	    }
 	}
-	if (cmd != PLIST_ORIGIN && ( Verbose || 0 != strncmp("bsdpan-", installed[i], 7 ) ) )
+	if (cmd != PLIST_ORIGIN && 0 != strncmp("bsdpan-", installed[i], 7))
 	    warnx("package %s has no origin recorded", installed[i]);
 	fclose(fp);
     }

Modified: head/lib/libpkg/msg.c
==============================================================================
--- head/usr.sbin/pkg_install/lib/msg.c	Sat Apr  3 11:19:20 2010	(r206135)
+++ head/lib/libpkg/msg.c	Fri Apr 23 11:07:43 2010	(r207113)
@@ -21,7 +21,7 @@
 #include 
 __FBSDID("$FreeBSD$");
 
-#include "lib.h"
+#include "pkg.h"
 #include 
 #include 
 
@@ -61,12 +61,7 @@ y_or_n(Boolean def, const char *msg, ...
 	else
 	    fprintf(stderr, " [no]? ");
 	fflush(stderr);
-	if (AutoAnswer) {
-	    ch = (AutoAnswer == YES) ? 'Y' : 'N';
-	    fprintf(stderr, "%c\n", ch);
-	}
-	else
-	    ch = toupper(fgetc(tty));
+	ch = toupper(fgetc(tty));
 	if (ch == '\n')
 	    ch = (def) ? 'Y' : 'N';
     }

Modified: head/lib/libpkg/pen.c
==============================================================================
--- head/usr.sbin/pkg_install/lib/pen.c	Sat Apr  3 11:19:20 2010	(r206135)
+++ head/lib/libpkg/pen.c	Fri Apr 23 11:07:43 2010	(r207113)
@@ -21,7 +21,7 @@
 #include 
 __FBSDID("$FreeBSD$");
 
-#include "lib.h"
+#include "pkg.h"
 #include 
 #include 
 #include 
@@ -103,7 +103,7 @@ popPen(char *pen)
 const char *
 make_playpen(char *pen, off_t sz)
 {
-    char humbuf1[6], humbuf2[6];
+    char humbuf[6];
     char cwd[FILENAME_MAX];
 
     if (!find_play_pen(pen, sz))
@@ -114,22 +114,15 @@ make_playpen(char *pen, off_t sz)
 	errx(2, "%s: can't mktemp '%s'", __func__, pen);
     }
 
-    if (Verbose) {
-	if (sz) {
-	    humanize_number(humbuf1, sizeof humbuf1, sz, "", HN_AUTOSCALE,
-	        HN_NOSPACE);
-	    humanize_number(humbuf2, sizeof humbuf2, min_free(pen),
-	        "", HN_AUTOSCALE, HN_NOSPACE);
-	    fprintf(stderr, "Requested space: %s bytes, free space: %s bytes in %s\n", humbuf1, humbuf2, pen);
-	}
-    }
+    humanize_number(humbuf, sizeof humbuf, sz, "", HN_AUTOSCALE, HN_NOSPACE);
 
     if (min_free(pen) < sz) {
 	rmdir(pen);
 	cleanup(0);
 	errx(2, "%s: not enough free space to create '%s'.\n"
 	     "Please set your PKG_TMPDIR environment variable to a location\n"
-	     "with more space and\ntry the command again", __func__, pen);
+	     "with at least %s and try the command again",
+	     __func__, humbuf, pen);
     }
 
     if (!getcwd(cwd, FILENAME_MAX)) {

Copied and modified: head/lib/libpkg/pkg.h (from r206135, head/usr.sbin/pkg_install/lib/lib.h)
==============================================================================
--- head/usr.sbin/pkg_install/lib/lib.h	Sat Apr  3 11:19:20 2010	(r206135, copy source)
+++ head/lib/libpkg/pkg.h	Fri Apr 23 11:07:43 2010	(r207113)
@@ -23,6 +23,10 @@
 #ifndef _INST_LIB_LIB_H_
 #define _INST_LIB_LIB_H_
 
+#ifndef YES_I_KNOW_THE_API_IS_RUBBISH_AND_IS_DOOMED_TO_CHANGE
+#error "You obviously have no idea what you're doing."
+#endif
+
 /* Includes */
 #include 
 #include 
@@ -96,13 +100,12 @@
 #define PKG_PREFIX_VNAME	"PKG_PREFIX"
 
 /*
- * Version of the package tools - increase whenever you make a change
+ * Version of the package library - increase whenever you make a change
  * in the code that is not cosmetic only.
  */
-#define PKG_INSTALL_VERSION	20100403
+#define LIBPKG_VERSION 20100423
 
 #define PKG_WRAPCONF_FNAME	"/var/db/pkg_install.conf"
-#define main(argc, argv)	real_main(argc, argv)
 
 /* Version numbers to assist with changes in package file format */
 #define PLIST_FMT_VER_MAJOR	1
@@ -214,7 +217,7 @@ Boolean 	make_preserve_name(char *, int,
 
 /* For all */
 int		pkg_perform(char **);
-int		real_main(int, char **);
+void		pkg_wrap(long, char **);
 
 /* Query installed packages */
 char		**matchinstalled(match_t, char **, int *);
@@ -229,6 +232,7 @@ int		chkifdepends(const char *, const ch
 int		requiredby(const char *, struct reqr_by_head **, Boolean, Boolean);
 
 /* Version */
+int		libpkg_version(void);
 int		verscmp(Package *, int, int);
 int		version_cmp(const char *, const char *);
 

Modified: head/lib/libpkg/pkgwrap.c
==============================================================================
--- head/usr.sbin/pkg_install/lib/pkgwrap.c	Sat Apr  3 11:19:20 2010	(r206135)
+++ head/lib/libpkg/pkgwrap.c	Fri Apr 23 11:07:43 2010	(r207113)
@@ -19,71 +19,72 @@
 #include 
 __FBSDID("$FreeBSD$");
 
-#include "lib.h"
+#include "pkg.h"
 #include 
 #include 
 #include 
 #include 
 
-#undef main
-
-#define SEPARATORS " \t"
-
 extern char **environ;
 
-int
-main(int argc, char **argv)
+void
+pkg_wrap(long curver, char **argv)
 {
-    FILE *f;
-    char buffer[FILENAME_MAX], *cp, *verstr;
-    int len;
+    FILE* f;
+    char ver[9];			/* Format is: 'YYYYMMDD\0' */
+    char buffer[FILENAME_MAX+10];	/* Format is: 'YYYYMMDD ' */
+    char cmd[FILENAME_MAX+5];		/* Format is: ' -PPq' */
+    char *path, *cp;
+    long ptver, lpver;
 
     if (getenv("PKG_NOWRAP") != NULL)
 	goto nowrap;
-    f = fopen(PKG_WRAPCONF_FNAME, "r");
-    if (f == NULL)
-	goto nowrap;
-    cp = fgets(buffer, 256, f);
-    fclose(f);
-    if (cp == NULL)
-	goto nowrap;
-    len = strlen(cp);
-    if (cp[len - 1] == '\n')
-	cp[len - 1] = '\0';
-    while (strchr(SEPARATORS, *cp) != NULL)
-	cp++;
-    verstr = cp;
-    cp = strpbrk(cp, SEPARATORS);
-    if (cp == NULL)
+
+    setenv("PKG_NOWRAP", "1", 1);
+
+    /* Get alternative location for package tools. */
+    if ((f = fopen(PKG_WRAPCONF_FNAME, "r")) == NULL) {
 	goto nowrap;
-    *cp = '\0';
-    for (cp = verstr; *cp != '\0'; cp++)
-	if (isdigit(*cp) == 0)
+    } else {
+	if (get_string(buffer, FILENAME_MAX+9, f) == NULL) {
 	    goto nowrap;
-    if (atoi(verstr) < PKG_INSTALL_VERSION)
-	goto nowrap;
-    cp++;
-    while (*cp != '\0' && strchr(SEPARATORS, *cp) != NULL)
-	cp++;
-    if (*cp == '\0')
-	goto nowrap;
-    bcopy(cp, buffer, strlen(cp) + 1);
-    cp = strpbrk(buffer, SEPARATORS);
-    if (cp != NULL)
-	*cp = '\0';
-    if (!isdir(buffer))
-	goto nowrap;
-    cp = strrchr(argv[0], '/');
-    if (cp == NULL)
+	} else {
+	    if ((path = strrchr(buffer, ' ')) == NULL) {
+		goto nowrap;
+	    } else {
+		*path++ = '\0';
+	    }
+	}
+    }
+
+    if ((cp = strrchr(argv[0], '/')) == NULL) {
 	cp = argv[0];
-    else
+    } else {
 	cp++;
-    strlcat(buffer, "/", sizeof(buffer));
-    strlcat(buffer, cp, sizeof(buffer));
-    setenv("PKG_NOWRAP", "1", 1);
-    execve(buffer, argv, environ);
+    }
+
+    /* Get version of the other pkg_install and libpkg */
+    snprintf(cmd, FILENAME_MAX+10, "%s/%s -PPq", path, cp);
+    if ((f = popen(cmd, "r")) == NULL) {
+	perror("popen()");
+	goto nowrap;
+    } else {
+	if (get_string(ver, 9, f) == NULL)
+	    goto nowrap; 
+	else
+	    ptver = strtol(ver, NULL, 10);
+	if (get_string(ver, 9, f) == NULL)
+	    goto nowrap;
+	else
+	    lpver = strtol(ver, NULL, 10);
+	pclose(f);
+    }
+
+    if ((lpver >= LIBPKG_VERSION) && (ptver > curver)) {
+	snprintf(cmd, FILENAME_MAX, "%s/%s", path, cp);
+	execve(cmd, argv, environ);
+    }
 
 nowrap:
     unsetenv("PKG_NOWRAP");
-    return(real_main(argc, argv));
 }

Modified: head/lib/libpkg/plist.c
==============================================================================
--- head/usr.sbin/pkg_install/lib/plist.c	Sat Apr  3 11:19:20 2010	(r206135)
+++ head/lib/libpkg/plist.c	Fri Apr 23 11:07:43 2010	(r207113)
@@ -21,7 +21,7 @@
 #include 
 __FBSDID("$FreeBSD$");
 
-#include "lib.h"
+#include "pkg.h"
 #include 
 #include 
 

Modified: head/lib/libpkg/str.c
==============================================================================
--- head/usr.sbin/pkg_install/lib/str.c	Sat Apr  3 11:19:20 2010	(r206135)
+++ head/lib/libpkg/str.c	Fri Apr 23 11:07:43 2010	(r207113)
@@ -21,7 +21,7 @@
 #include 
 __FBSDID("$FreeBSD$");
 
-#include "lib.h"
+#include "pkg.h"
 
 char *
 strconcat(const char *s1, const char *s2)

Modified: head/lib/libpkg/url.c
==============================================================================
--- head/usr.sbin/pkg_install/lib/url.c	Sat Apr  3 11:19:20 2010	(r206135)
+++ head/lib/libpkg/url.c	Fri Apr 23 11:07:43 2010	(r207113)
@@ -21,7 +21,7 @@
 #include 
 __FBSDID("$FreeBSD$");
 
-#include "lib.h"
+#include "pkg.h"
 #include 
 #include 
 #include 
@@ -109,7 +109,7 @@ fileGetURL(const char *base, const char 
 	printf("Error: Unable to get %s: %s\n",
 	       fname, fetchLastErrString);
 	/* If the fetch fails, yank the package. */
-	if (keep_package && unlink(pkg) < 0 && Verbose) {
+	if (keep_package && unlink(pkg) < 0) {
 	    warnx("failed to remove partially fetched package: %s", pkg);
 	}
 	return NULL;

Modified: head/lib/libpkg/version.c
==============================================================================
--- head/usr.sbin/pkg_install/lib/version.c	Sat Apr  3 11:19:20 2010	(r206135)
+++ head/lib/libpkg/version.c	Fri Apr 23 11:07:43 2010	(r207113)
@@ -19,10 +19,20 @@
 #include 
 __FBSDID("$FreeBSD$");
 
-#include "lib.h"
+#include "pkg.h"
 #include 
 
 /*
+ * This routine could easily go somewhere else.
+ *
+ */
+int
+libpkg_version(void)
+{
+	return LIBPKG_VERSION;
+}
+
+/*
  * Routines to assist with PLIST_FMT_VER numbers in the packing
  * lists.
  *

Modified: head/share/mk/bsd.libnames.mk
==============================================================================
--- head/share/mk/bsd.libnames.mk	Fri Apr 23 10:33:32 2010	(r207112)
+++ head/share/mk/bsd.libnames.mk	Fri Apr 23 11:07:43 2010	(r207113)
@@ -128,6 +128,7 @@ MINUSLPAM+=	-lypclnt
 
 LIBPANEL?=	${DESTDIR}${LIBDIR}/libpanel.a
 LIBPCAP?=	${DESTDIR}${LIBDIR}/libpcap.a
+LIBPKG?=	${DESTDIR}${LIBDIR}/libpkg.a
 LIBPMC?=	${DESTDIR}${LIBDIR}/libpmc.a
 LIBPROC?=	${DESTDIR}${LIBDIR}/libproc.a
 LIBPTHREAD?=	${DESTDIR}${LIBDIR}/libpthread.a

Modified: head/usr.sbin/pkg_install/Makefile
==============================================================================
--- head/usr.sbin/pkg_install/Makefile	Fri Apr 23 10:33:32 2010	(r207112)
+++ head/usr.sbin/pkg_install/Makefile	Fri Apr 23 11:07:43 2010	(r207113)
@@ -2,11 +2,11 @@
 
 .include 
 
-SUBDIR=	lib add create delete info updating version
+SUBDIR=	add create delete info updating version
 
 .include 
 
-DATE!=	grep PKG_INSTALL_VERSION ${.CURDIR}/lib/lib.h | sed 's|.*[ 	]||'
+DATE!=	grep PKG_INSTALL_VERSION ${.CURDIR}/Makefile.inc | sed 's|.*=||'
 
 distfile: clean
 	@(cd ${.CURDIR}/..; \

Modified: head/usr.sbin/pkg_install/Makefile.inc
==============================================================================
--- head/usr.sbin/pkg_install/Makefile.inc	Fri Apr 23 10:33:32 2010	(r207112)
+++ head/usr.sbin/pkg_install/Makefile.inc	Fri Apr 23 11:07:43 2010	(r207113)
@@ -2,16 +2,11 @@
 
 .include 
 
-LIBINSTALL=	${.OBJDIR}/../lib/libinstall.a
+CFLAGS+=	-DPKG_INSTALL_VERSION=20100423
+CFLAGS+=	-DYES_I_KNOW_THE_API_IS_RUBBISH_AND_IS_DOOMED_TO_CHANGE
 
-DPADD+=		${LIBUTIL}
-LDADD+=		-lutil
-
-.if ${MK_OPENSSL} != "no" && \
-    defined(LDADD) && ${LDADD:M-lfetch} != ""
-DPADD+=		${LIBSSL} ${LIBCRYPTO}
-LDADD+=		-lssl -lcrypto
-.endif
+DPADD+=		${LIBPKG}
+LDADD+=		-lpkg
 
 # Inherit BINDIR from one level up.
 .include "../Makefile.inc"

Modified: head/usr.sbin/pkg_install/add/Makefile
==============================================================================
--- head/usr.sbin/pkg_install/add/Makefile	Fri Apr 23 10:33:32 2010	(r207112)
+++ head/usr.sbin/pkg_install/add/Makefile	Fri Apr 23 11:07:43 2010	(r207113)
@@ -1,14 +1,11 @@
 # $FreeBSD$
 
+.include 
+
 PROG=	pkg_add
 SRCS=	main.c perform.c futil.c extract.c
 
-CFLAGS+= -I${.CURDIR}/../lib
-
 WARNS?=	3
 WFORMAT?=	1
 
-DPADD=	${LIBINSTALL} ${LIBFETCH} ${LIBMD}
-LDADD=	${LIBINSTALL} -lfetch -lmd
-
 .include 

Modified: head/usr.sbin/pkg_install/add/extract.c
==============================================================================
--- head/usr.sbin/pkg_install/add/extract.c	Fri Apr 23 10:33:32 2010	(r207112)
+++ head/usr.sbin/pkg_install/add/extract.c	Fri Apr 23 11:07:43 2010	(r207113)
@@ -23,7 +23,7 @@ __FBSDID("$FreeBSD$");
 
 #include 
 #include 
-#include "lib.h"
+#include 
 #include "add.h"
 
 

Modified: head/usr.sbin/pkg_install/add/futil.c
==============================================================================
--- head/usr.sbin/pkg_install/add/futil.c	Fri Apr 23 10:33:32 2010	(r207112)
+++ head/usr.sbin/pkg_install/add/futil.c	Fri Apr 23 11:07:43 2010	(r207113)
@@ -22,7 +22,7 @@
 __FBSDID("$FreeBSD$");
 
 #include 
-#include "lib.h"
+#include 
 #include "add.h"
 
 /*

Modified: head/usr.sbin/pkg_install/add/main.c
==============================================================================
--- head/usr.sbin/pkg_install/add/main.c	Fri Apr 23 10:33:32 2010	(r207112)
+++ head/usr.sbin/pkg_install/add/main.c	Fri Apr 23 11:07:43 2010	(r207113)
@@ -26,7 +26,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 
-#include "lib.h"
+#include 
 #include "add.h"
 
 char	*Prefix		= NULL;
@@ -128,6 +128,8 @@ main(int argc, char **argv)
     static char temppackageroot[MAXPATHLEN];
     static char pkgaddpath[MAXPATHLEN];
 
+    pkg_wrap(PKG_INSTALL_VERSION, argv);
+
     if (*argv[0] != '/' && strchr(argv[0], '/') != NULL)
 	PkgAddCmd = realpath(argv[0], pkgaddpath);
     else

Modified: head/usr.sbin/pkg_install/add/perform.c
==============================================================================
--- head/usr.sbin/pkg_install/add/perform.c	Fri Apr 23 10:33:32 2010	(r207112)
+++ head/usr.sbin/pkg_install/add/perform.c	Fri Apr 23 11:07:43 2010	(r207113)
@@ -23,7 +23,7 @@ __FBSDID("$FreeBSD$");
 
 #include 
 #include 
-#include "lib.h"
+#include 
 #include "add.h"
 
 #include 

Modified: head/usr.sbin/pkg_install/create/Makefile
==============================================================================
--- head/usr.sbin/pkg_install/create/Makefile	Fri Apr 23 10:33:32 2010	(r207112)
+++ head/usr.sbin/pkg_install/create/Makefile	Fri Apr 23 11:07:43 2010	(r207113)
@@ -3,12 +3,10 @@
 PROG=	pkg_create
 SRCS=	main.c perform.c pl.c
 
-CFLAGS+= -I${.CURDIR}/../lib
-
 WARNS?=	3
 WFORMAT?=	1
 
-DPADD=	${LIBINSTALL} ${LIBMD}
-LDADD=	${LIBINSTALL} -lmd
+DPADD=	${LIBMD}
+LDADD=	-lmd
 
 .include 

Modified: head/usr.sbin/pkg_install/create/main.c
==============================================================================
--- head/usr.sbin/pkg_install/create/main.c	Fri Apr 23 10:33:32 2010	(r207112)
+++ head/usr.sbin/pkg_install/create/main.c	Fri Apr 23 11:07:43 2010	(r207113)
@@ -15,7 +15,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 
-#include "lib.h"
+#include 
 #include "create.h"
 
 match_t	MatchType	= MATCH_GLOB;
@@ -72,6 +72,8 @@ main(int argc, char **argv)
     int ch;
     char **pkgs, **start, *tmp;
 
+    pkg_wrap(PKG_INSTALL_VERSION, argv);
+
     pkgs = start = argv;
     while ((ch = getopt_long(argc, argv, opts, longopts, NULL)) != -1)
 	switch(ch) {

Modified: head/usr.sbin/pkg_install/create/perform.c
==============================================================================
--- head/usr.sbin/pkg_install/create/perform.c	Fri Apr 23 10:33:32 2010	(r207112)
+++ head/usr.sbin/pkg_install/create/perform.c	Fri Apr 23 11:07:43 2010	(r207113)
@@ -21,7 +21,7 @@
 #include 
 __FBSDID("$FreeBSD$");
 
-#include "lib.h"
+#include 
 #include "create.h"
 
 #include 

Modified: head/usr.sbin/pkg_install/create/pl.c
==============================================================================
--- head/usr.sbin/pkg_install/create/pl.c	Fri Apr 23 10:33:32 2010	(r207112)
+++ head/usr.sbin/pkg_install/create/pl.c	Fri Apr 23 11:07:43 2010	(r207113)
@@ -21,7 +21,7 @@
 #include 
 __FBSDID("$FreeBSD$");
 
-#include "lib.h"
+#include 
 #include "create.h"
 #include 
 #include 

Modified: head/usr.sbin/pkg_install/delete/Makefile
==============================================================================
--- head/usr.sbin/pkg_install/delete/Makefile	Fri Apr 23 10:33:32 2010	(r207112)
+++ head/usr.sbin/pkg_install/delete/Makefile	Fri Apr 23 11:07:43 2010	(r207113)
@@ -3,11 +3,6 @@
 PROG=	pkg_delete
 SRCS=	main.c perform.c
 
-CFLAGS+= -I${.CURDIR}/../lib
-
 WFORMAT?=	1
 
-DPADD=	${LIBINSTALL} ${LIBMD}
-LDADD=	${LIBINSTALL} -lmd
-
 .include 

Modified: head/usr.sbin/pkg_install/delete/main.c
==============================================================================
--- head/usr.sbin/pkg_install/delete/main.c	Fri Apr 23 10:33:32 2010	(r207112)
+++ head/usr.sbin/pkg_install/delete/main.c	Fri Apr 23 11:07:43 2010	(r207113)
@@ -27,7 +27,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 
-#include "lib.h"
+#include 
 #include "delete.h"
 
 char	*Prefix		= NULL;
@@ -67,6 +67,8 @@ main(int argc, char **argv)
     const char *tmp;
     struct stat stat_s;
 
+    pkg_wrap(PKG_INSTALL_VERSION, argv);
+
     pkgs = start = argv;
     while ((ch = getopt_long(argc, argv, opts, longopts, NULL)) != -1)
 	switch(ch) {

Modified: head/usr.sbin/pkg_install/delete/perform.c
==============================================================================
--- head/usr.sbin/pkg_install/delete/perform.c	Fri Apr 23 10:33:32 2010	(r207112)
+++ head/usr.sbin/pkg_install/delete/perform.c	Fri Apr 23 11:07:43 2010	(r207113)
@@ -22,7 +22,7 @@
 __FBSDID("$FreeBSD$");
 
 #include 
-#include "lib.h"
+#include 
 #include "delete.h"
 
 static int pkg_do(char *);

Modified: head/usr.sbin/pkg_install/info/Makefile
==============================================================================
--- head/usr.sbin/pkg_install/info/Makefile	Fri Apr 23 10:33:32 2010	(r207112)
+++ head/usr.sbin/pkg_install/info/Makefile	Fri Apr 23 11:07:43 2010	(r207113)
@@ -3,11 +3,9 @@
 PROG=	pkg_info
 SRCS=	main.c perform.c show.c
 
-CFLAGS+= -I${.CURDIR}/../lib
-
 WFORMAT?=	1
 
-DPADD=	${LIBINSTALL} ${LIBFETCH} ${LIBMD}
-LDADD=	${LIBINSTALL} -lfetch -lmd
+DPADD=	${LIBMD}
+LDADD=	-lmd
 
 .include 

Modified: head/usr.sbin/pkg_install/info/info.h
==============================================================================
--- head/usr.sbin/pkg_install/info/info.h	Fri Apr 23 10:33:32 2010	(r207112)
+++ head/usr.sbin/pkg_install/info/info.h	Fri Apr 23 11:07:43 2010	(r207113)
@@ -33,25 +33,26 @@
 #define MAXNAMESIZE  20
 #endif
 
-#define SHOW_COMMENT	0x00001
-#define SHOW_DESC	0x00002
-#define SHOW_PLIST	0x00004
-#define SHOW_INSTALL	0x00008
-#define SHOW_DEINSTALL	0x00010
-#define SHOW_REQUIRE	0x00020
-#define SHOW_PREFIX	0x00040
-#define SHOW_INDEX	0x00080
-#define SHOW_FILES	0x00100
-#define SHOW_DISPLAY	0x00200
-#define SHOW_REQBY	0x00400
-#define SHOW_MTREE	0x00800
-#define SHOW_SIZE	0x01000
-#define SHOW_ORIGIN	0x02000
-#define SHOW_CKSUM	0x04000
-#define SHOW_FMTREV	0x08000
-#define SHOW_PTREV	0x10000
-#define SHOW_DEPEND	0x20000
-#define SHOW_PKGNAME	0x40000
+#define SHOW_COMMENT	0x000001
+#define SHOW_DESC	0x000002
+#define SHOW_PLIST	0x000004
+#define SHOW_INSTALL	0x000008
+#define SHOW_DEINSTALL	0x000010
+#define SHOW_REQUIRE	0x000020
+#define SHOW_PREFIX	0x000040
+#define SHOW_INDEX	0x000080
+#define SHOW_FILES	0x000100
+#define SHOW_DISPLAY	0x000200
+#define SHOW_REQBY	0x000400
+#define SHOW_MTREE	0x000800
+#define SHOW_SIZE	0x001000
+#define SHOW_ORIGIN	0x002000
+#define SHOW_CKSUM	0x004000
+#define SHOW_FMTREV	0x008000
+#define SHOW_PTREV	0x010000
+#define SHOW_DEPEND	0x020000
+#define SHOW_PKGNAME	0x040000
+#define SHOW_LPREV	0x100000
 
 struct which_entry {
     TAILQ_ENTRY(which_entry) next;

Modified: head/usr.sbin/pkg_install/info/main.c
==============================================================================
--- head/usr.sbin/pkg_install/info/main.c	Fri Apr 23 10:33:32 2010	(r207112)
+++ head/usr.sbin/pkg_install/info/main.c	Fri Apr 23 11:07:43 2010	(r207113)
@@ -25,7 +25,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 
-#include "lib.h"
+#include 
 #include "info.h"
 
 int	Flags		= 0;
@@ -68,6 +68,8 @@ main(int argc, char **argv)
     char **pkgs, **start;
     char *pkgs_split;
 
+    pkg_wrap(PKG_INSTALL_VERSION, argv);
+
     whead = malloc(sizeof(struct which_head));
     if (whead == NULL)
 	err(2, NULL);
@@ -225,7 +227,10 @@ main(int argc, char **argv)
 	    }
 
 	case 'P':
-	    Flags = SHOW_PTREV;
+	    if (Flags & SHOW_PTREV)
+		Flags |= SHOW_LPREV;
+	    else
+		Flags = SHOW_PTREV;
 	    break;
 
 	case 'h':
@@ -242,6 +247,11 @@ main(int argc, char **argv)
 	if (!Quiet)
 	    printf("Package tools revision: ");
 	printf("%d\n", PKG_INSTALL_VERSION);
+	if (Flags & SHOW_LPREV) {
+	    if (!Quiet)
+		printf("Libpkg revision: ");
+	    printf("%d\n", libpkg_version());
+	}
 	exit(0);
     }
 

Modified: head/usr.sbin/pkg_install/info/perform.c
==============================================================================
--- head/usr.sbin/pkg_install/info/perform.c	Fri Apr 23 10:33:32 2010	(r207112)
+++ head/usr.sbin/pkg_install/info/perform.c	Fri Apr 23 11:07:43 2010	(r207113)
@@ -21,7 +21,7 @@
 #include 
 __FBSDID("$FreeBSD$");
 
-#include "lib.h"
+#include 
 #include "info.h"
 #include 
 #include 

Modified: head/usr.sbin/pkg_install/info/show.c
==============================================================================
--- head/usr.sbin/pkg_install/info/show.c	Fri Apr 23 10:33:32 2010	(r207112)
+++ head/usr.sbin/pkg_install/info/show.c	Fri Apr 23 11:07:43 2010	(r207113)
@@ -21,7 +21,7 @@
 #include 
 __FBSDID("$FreeBSD$");
 
-#include "lib.h"
+#include 
 #include "info.h"
 #include 
 #include 

Modified: head/usr.sbin/pkg_install/updating/Makefile
==============================================================================
--- head/usr.sbin/pkg_install/updating/Makefile	Fri Apr 23 10:33:32 2010	(r207112)
+++ head/usr.sbin/pkg_install/updating/Makefile	Fri Apr 23 11:07:43 2010	(r207113)
@@ -3,11 +3,6 @@
 PROG=	pkg_updating
 SRCS=	main.c
 
-CFLAGS+= -I${.CURDIR}/../lib
-
 WFORMAT?= 1
 
-DPADD=	${LIBINSTALL} ${LIBFETCH} ${LIBMD}
-LDADD=	${LIBINSTALL} -lfetch -lmd
-
 .include 

Modified: head/usr.sbin/pkg_install/updating/main.c
==============================================================================
--- head/usr.sbin/pkg_install/updating/main.c	Fri Apr 23 10:33:32 2010	(r207112)
+++ head/usr.sbin/pkg_install/updating/main.c	Fri Apr 23 11:07:43 2010	(r207113)
@@ -19,7 +19,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 
-#include "lib.h"
+#include 
 #include "pathnames.h"
 
 typedef struct installedport {
@@ -87,6 +87,8 @@ main(int argc, char *argv[])
 	DIR *dir;
 	FILE *fd;
 
+	pkg_wrap(PKG_INSTALL_VERSION, argv);
+
 	while ((ch = getopt_long(argc, argv, opts, longopts, NULL)) != -1) {
 		switch (ch) {
 			case 'd':

Modified: head/usr.sbin/pkg_install/version/Makefile
==============================================================================
--- head/usr.sbin/pkg_install/version/Makefile	Fri Apr 23 10:33:32 2010	(r207112)
+++ head/usr.sbin/pkg_install/version/Makefile	Fri Apr 23 11:07:43 2010	(r207113)
@@ -3,13 +3,8 @@
 PROG=	pkg_version
 SRCS=	main.c perform.c
 
-CFLAGS+= -I${.CURDIR}/../lib
-
 WFORMAT?=	1
 
-DPADD=	${LIBINSTALL} ${LIBFETCH} ${LIBMD}
-LDADD=	${LIBINSTALL} -lfetch -lmd
-
 test:
 	sh ${.CURDIR}/test-pkg_version.sh
 

Modified: head/usr.sbin/pkg_install/version/main.c
==============================================================================
--- head/usr.sbin/pkg_install/version/main.c	Fri Apr 23 10:33:32 2010	(r207112)
+++ head/usr.sbin/pkg_install/version/main.c	Fri Apr 23 11:07:43 2010	(r207113)
@@ -25,7 +25,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 
-#include "lib.h"
+#include 
 #include "version.h"
 
 char	*LimitChars = NULL;
@@ -58,6 +58,8 @@ main(int argc, char **argv)
 {
     int ch, cmp = 0;
 
+    pkg_wrap(PKG_INSTALL_VERSION, argv);
+
     if (argc == 4 && !strcmp(argv[1], "-t")) {
 	cmp = version_cmp(argv[2], argv[3]);
 	printf(cmp > 0 ? ">\n" : (cmp < 0 ? "<\n" : "=\n"));

Modified: head/usr.sbin/pkg_install/version/perform.c
==============================================================================
--- head/usr.sbin/pkg_install/version/perform.c	Fri Apr 23 10:33:32 2010	(r207112)
+++ head/usr.sbin/pkg_install/version/perform.c	Fri Apr 23 11:07:43 2010	(r207113)
@@ -21,7 +21,7 @@
 #include 
 __FBSDID("$FreeBSD$");
 
-#include "lib.h"
+#include 
 #include "version.h"
 #include 
 #include 

From owner-svn-src-head@FreeBSD.ORG  Fri Apr 23 14:32:58 2010
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id ACCD61065670;
	Fri, 23 Apr 2010 14:32:58 +0000 (UTC) (envelope-from bz@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 9C46B8FC1A;
	Fri, 23 Apr 2010 14:32:58 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o3NEWwJQ025867;
	Fri, 23 Apr 2010 14:32:58 GMT (envelope-from bz@svn.freebsd.org)
Received: (from bz@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o3NEWw8k025865;
	Fri, 23 Apr 2010 14:32:58 GMT (envelope-from bz@svn.freebsd.org)
Message-Id: <201004231432.o3NEWw8k025865@svn.freebsd.org>
From: "Bjoern A. Zeeb" 
Date: Fri, 23 Apr 2010 14:32:58 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r207116 - head/sys/kern
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 23 Apr 2010 14:32:58 -0000

Author: bz
Date: Fri Apr 23 14:32:58 2010
New Revision: 207116
URL: http://svn.freebsd.org/changeset/base/207116

Log:
  Remove one zero from the double-0.
  This code doesn't have a license to kill.
  
  MFC after:	3 days

Modified:
  head/sys/kern/kern_descrip.c

Modified: head/sys/kern/kern_descrip.c
==============================================================================
--- head/sys/kern/kern_descrip.c	Fri Apr 23 14:16:10 2010	(r207115)
+++ head/sys/kern/kern_descrip.c	Fri Apr 23 14:32:58 2010	(r207116)
@@ -2896,7 +2896,7 @@ sysctl_kern_proc_ofiledesc(SYSCTL_HANDLE
 				free(sa, M_SONAME);
 			}
 			if (so->so_proto->pr_usrreqs->pru_peeraddr(so, &sa)
-			    == 00 && sa->sa_len <= sizeof(kif->kf_sa_peer)) {
+			    == 0 && sa->sa_len <= sizeof(kif->kf_sa_peer)) {
 				bcopy(sa, &kif->kf_sa_peer, sa->sa_len);
 				free(sa, M_SONAME);
 			}
@@ -3149,7 +3149,7 @@ sysctl_kern_proc_filedesc(SYSCTL_HANDLER
 				free(sa, M_SONAME);
 			}
 			if (so->so_proto->pr_usrreqs->pru_peeraddr(so, &sa)
-			    == 00 && sa->sa_len <= sizeof(kif->kf_sa_peer)) {
+			    == 0 && sa->sa_len <= sizeof(kif->kf_sa_peer)) {
 				bcopy(sa, &kif->kf_sa_peer, sa->sa_len);
 				free(sa, M_SONAME);
 			}

From owner-svn-src-head@FreeBSD.ORG  Fri Apr 23 14:48:30 2010
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 8A887106566B;
	Fri, 23 Apr 2010 14:48:30 +0000 (UTC)
	(envelope-from rnoland@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 791F78FC0C;
	Fri, 23 Apr 2010 14:48:30 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o3NEmUL6029442;
	Fri, 23 Apr 2010 14:48:30 GMT (envelope-from rnoland@svn.freebsd.org)
Received: (from rnoland@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o3NEmU3t029437;
	Fri, 23 Apr 2010 14:48:30 GMT (envelope-from rnoland@svn.freebsd.org)
Message-Id: <201004231448.o3NEmU3t029437@svn.freebsd.org>
From: Robert Noland 
Date: Fri, 23 Apr 2010 14:48:30 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r207118 - head/sys/dev/drm
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 23 Apr 2010 14:48:30 -0000

Author: rnoland
Date: Fri Apr 23 14:48:30 2010
New Revision: 207118
URL: http://svn.freebsd.org/changeset/base/207118

Log:
  Address some WITNESS panics that occur when using the via driver.
  
  Some of these cases should be safe in a non-atomic fashion, however
  since all of the driver ioctls are locked, a lot of work is required to
  fix it correctly.  Just don't sleep now.
  
  MFC after:	2 weeks

Modified:
  head/sys/dev/drm/drmP.h
  head/sys/dev/drm/drm_hashtab.c
  head/sys/dev/drm/drm_mm.c
  head/sys/dev/drm/drm_sman.c

Modified: head/sys/dev/drm/drmP.h
==============================================================================
--- head/sys/dev/drm/drmP.h	Fri Apr 23 14:35:03 2010	(r207117)
+++ head/sys/dev/drm/drmP.h	Fri Apr 23 14:48:30 2010	(r207118)
@@ -228,7 +228,7 @@ enum {
 #define DRM_MTRR_WC		MDF_WRITECOMBINE
 #define jiffies			ticks
 
-typedef unsigned long dma_addr_t;
+typedef vm_paddr_t dma_addr_t;
 typedef u_int64_t u64;
 typedef u_int32_t u32;
 typedef u_int16_t u16;

Modified: head/sys/dev/drm/drm_hashtab.c
==============================================================================
--- head/sys/dev/drm/drm_hashtab.c	Fri Apr 23 14:35:03 2010	(r207117)
+++ head/sys/dev/drm/drm_hashtab.c	Fri Apr 23 14:48:30 2010	(r207118)
@@ -46,7 +46,8 @@ int drm_ht_create(struct drm_open_hash *
 	ht->size = 1 << order;
 	ht->order = order;
 	ht->table = NULL;
-	ht->table = hashinit(ht->size, DRM_MEM_HASHTAB, &ht->mask);
+	ht->table = hashinit_flags(ht->size, DRM_MEM_HASHTAB, &ht->mask,
+	    HASH_NOWAIT);
 	if (!ht->table) {
 		DRM_ERROR("Out of memory for hash table\n");
 		return -ENOMEM;

Modified: head/sys/dev/drm/drm_mm.c
==============================================================================
--- head/sys/dev/drm/drm_mm.c	Fri Apr 23 14:35:03 2010	(r207117)
+++ head/sys/dev/drm/drm_mm.c	Fri Apr 23 14:48:30 2010	(r207118)
@@ -333,7 +333,8 @@ int drm_mm_init(struct drm_mm * mm, unsi
 	mm->num_unused = 0;
 	mtx_init(&mm->unused_lock, "drm_unused", NULL, MTX_DEF);
 
-	return drm_mm_create_tail_node(mm, start, size, 0);
+	/* XXX This could be non-atomic but gets called from a locked path */
+	return drm_mm_create_tail_node(mm, start, size, 1);
 }
 
 void drm_mm_takedown(struct drm_mm * mm)

Modified: head/sys/dev/drm/drm_sman.c
==============================================================================
--- head/sys/dev/drm/drm_sman.c	Fri Apr 23 14:35:03 2010	(r207117)
+++ head/sys/dev/drm/drm_sman.c	Fri Apr 23 14:48:30 2010	(r207118)
@@ -96,7 +96,8 @@ static void *drm_sman_mm_allocate(void *
 	if (!tmp) {
 		return NULL;
 	}
-	tmp = drm_mm_get_block(tmp, size, alignment);
+	/* This could be non-atomic, but we are called from a locked path */
+	tmp = drm_mm_get_block_atomic(tmp, size, alignment);
 	return tmp;
 }
 
@@ -131,7 +132,7 @@ drm_sman_set_range(struct drm_sman * sma
 	KASSERT(manager < sman->num_managers, ("Invalid manager"));
 
 	sman_mm = &sman->mm[manager];
-	mm = malloc(sizeof(*mm), DRM_MEM_MM, M_WAITOK | M_ZERO);
+	mm = malloc(sizeof(*mm), DRM_MEM_MM, M_NOWAIT | M_ZERO);
 	if (!mm) {
 		return -ENOMEM;
 	}
@@ -174,7 +175,7 @@ static struct drm_owner_item *drm_sman_g
 				      owner_hash);
 	}
 
-	owner_item = malloc(sizeof(*owner_item), DRM_MEM_MM, M_WAITOK | M_ZERO);
+	owner_item = malloc(sizeof(*owner_item), DRM_MEM_MM, M_NOWAIT | M_ZERO);
 	if (!owner_item)
 		goto out;
 
@@ -206,12 +207,11 @@ struct drm_memblock_item *drm_sman_alloc
 
 	sman_mm = &sman->mm[manager];
 	tmp = sman_mm->allocate(sman_mm->private, size, alignment);
-
 	if (!tmp) {
 		return NULL;
 	}
 
-	memblock = malloc(sizeof(*memblock), DRM_MEM_MM, M_WAITOK | M_ZERO);
+	memblock = malloc(sizeof(*memblock), DRM_MEM_MM, M_NOWAIT | M_ZERO);
 	DRM_DEBUG("allocated mem_block %p\n", memblock);
 	if (!memblock)
 		goto out;

From owner-svn-src-head@FreeBSD.ORG  Fri Apr 23 17:26:49 2010
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 7B0B21065686;
	Fri, 23 Apr 2010 17:26:49 +0000 (UTC)
	(envelope-from jilles@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 699D88FC1B;
	Fri, 23 Apr 2010 17:26:49 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o3NHQnvF065424;
	Fri, 23 Apr 2010 17:26:49 GMT (envelope-from jilles@svn.freebsd.org)
Received: (from jilles@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o3NHQnoa065422;
	Fri, 23 Apr 2010 17:26:49 GMT (envelope-from jilles@svn.freebsd.org)
Message-Id: <201004231726.o3NHQnoa065422@svn.freebsd.org>
From: Jilles Tjoelker 
Date: Fri, 23 Apr 2010 17:26:49 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r207127 - head/tools/regression/bin/sh/expansion
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 23 Apr 2010 17:26:49 -0000

Author: jilles
Date: Fri Apr 23 17:26:49 2010
New Revision: 207127
URL: http://svn.freebsd.org/changeset/base/207127

Log:
  sh: Add some more tests for ${v#...} and ${v%...}.
  
  These pass on stable/8 as well.

Added:
  head/tools/regression/bin/sh/expansion/trim3.0   (contents, props changed)

Added: head/tools/regression/bin/sh/expansion/trim3.0
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/tools/regression/bin/sh/expansion/trim3.0	Fri Apr 23 17:26:49 2010	(r207127)
@@ -0,0 +1,46 @@
+# $FreeBSD$
+
+e= q='?' a='*' t=texttext s='ast*que?non' p='/et[c]/' w='a b c' b='{{(#)}}'
+h='##' c='\\\\'
+failures=''
+ok=''
+
+testcase() {
+	code="$1"
+	expected="$2"
+	oIFS="$IFS"
+	eval "$code"
+	IFS='|'
+	result="$#|$*"
+	IFS="$oIFS"
+	if [ "x$result" = "x$expected" ]; then
+		ok=x$ok
+	else
+		failures=x$failures
+		echo "For $code, expected $expected actual $result"
+	fi
+}
+
+# This doesn't make much sense, but it fails in dash so I'm adding it here:
+testcase 'set -- "${w%${w#???}}"'		'1|a b'
+
+testcase 'set -- ${p#/et[}'			'1|c]/'
+testcase 'set -- "${p#/et[}"'			'1|c]/'
+testcase 'set -- "${p%${p#????}}"'		'1|/et['
+
+testcase 'set -- ${b%'\'}\''}'			'1|{{(#)}'
+
+testcase 'set -- ${c#\\}'			'1|\\\'
+testcase 'set -- ${c#\\\\}'			'1|\\'
+testcase 'set -- ${c#\\\\\\}'			'1|\'
+testcase 'set -- ${c#\\\\\\\\}'			'0|'
+testcase 'set -- "${c#\\}"'			'1|\\\'
+testcase 'set -- "${c#\\\\}"'			'1|\\'
+testcase 'set -- "${c#\\\\\\}"'			'1|\'
+testcase 'set -- "${c#\\\\\\\\}"'		'1|'
+testcase 'set -- "${c#"$c"}"'			'1|'
+testcase 'set -- ${c#"$c"}'			'0|'
+testcase 'set -- "${c%"$c"}"'			'1|'
+testcase 'set -- ${c%"$c"}'			'0|'
+
+test "x$failures" = x

From owner-svn-src-head@FreeBSD.ORG  Fri Apr 23 18:53:18 2010
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 3B4E2106567A;
	Fri, 23 Apr 2010 18:53:18 +0000 (UTC)
	(envelope-from jmallett@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 2A9D78FC22;
	Fri, 23 Apr 2010 18:53:18 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o3NIrINo084673;
	Fri, 23 Apr 2010 18:53:18 GMT
	(envelope-from jmallett@svn.freebsd.org)
Received: (from jmallett@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o3NIrIoB084653;
	Fri, 23 Apr 2010 18:53:18 GMT
	(envelope-from jmallett@svn.freebsd.org)
Message-Id: <201004231853.o3NIrIoB084653@svn.freebsd.org>
From: Juli Mallett 
Date: Fri, 23 Apr 2010 18:53:18 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r207130 - head/sys/mips/mips
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 23 Apr 2010 18:53:18 -0000

Author: jmallett
Date: Fri Apr 23 18:53:17 2010
New Revision: 207130
URL: http://svn.freebsd.org/changeset/base/207130

Log:
  Large memory mappings are always CPU local and always done with interrupts
  disabled.  Be doubly-sure that we don't try to do a TLB shootdown on SMP
  systems for those mappings.
  
  Submitted by:	C. Jayachandran

Modified:
  head/sys/mips/mips/pmap.c

Modified: head/sys/mips/mips/pmap.c
==============================================================================
--- head/sys/mips/mips/pmap.c	Fri Apr 23 18:01:19 2010	(r207129)
+++ head/sys/mips/mips/pmap.c	Fri Apr 23 18:53:17 2010	(r207130)
@@ -251,11 +251,11 @@ caddr_t virtual_sys_start = (caddr_t)0;
 #define	PMAP_LMEM_UNMAP()						\
 	pte = pmap_pte(kernel_pmap, sysm->base);			\
 	*pte = PTE_G;							\
-	pmap_invalidate_page(kernel_pmap, sysm->base);			\
+	pmap_TLB_invalidate_kernel(sysm->base);				\
 	sysm->valid1 = 0;						\
 	pte = pmap_pte(kernel_pmap, sysm->base + PAGE_SIZE);		\
 	*pte = PTE_G;							\
-	pmap_invalidate_page(kernel_pmap, sysm->base + PAGE_SIZE);	\
+	pmap_TLB_invalidate_kernel(sysm->base + PAGE_SIZE);		\
 	sysm->valid2 = 0;						\
 	sched_unpin();							\
 	intr_restore(intr);						\

From owner-svn-src-head@FreeBSD.ORG  Fri Apr 23 19:20:56 2010
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 863321065672;
	Fri, 23 Apr 2010 19:20:56 +0000 (UTC)
	(envelope-from jmallett@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 757858FC1C;
	Fri, 23 Apr 2010 19:20:56 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o3NJKulL090839;
	Fri, 23 Apr 2010 19:20:56 GMT
	(envelope-from jmallett@svn.freebsd.org)
Received: (from jmallett@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o3NJKuPo090836;
	Fri, 23 Apr 2010 19:20:56 GMT
	(envelope-from jmallett@svn.freebsd.org)
Message-Id: <201004231920.o3NJKuPo090836@svn.freebsd.org>
From: Juli Mallett 
Date: Fri, 23 Apr 2010 19:20:56 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r207131 - in head/sys/mips: conf sibyte
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 23 Apr 2010 19:20:56 -0000

Author: jmallett
Date: Fri Apr 23 19:20:56 2010
New Revision: 207131
URL: http://svn.freebsd.org/changeset/base/207131

Log:
  o) Remove default MAXMEM on SWARM; pmap can readily use lmem for >512M
     physical addresses.
  o) Set a local maxmem in sb_machdep.c to avoid trying to use pages over 2^64
     under 32-bit ABIs.  Our pmap needs corrected to use vm_paddr_t consistently,
     then we can make vm_paddr_t 64-bit under 32-bit ABIs and add code in pmap
     to limit phys_avail by the maximum PFN that a 32-bit PTE can hold.

Modified:
  head/sys/mips/conf/SWARM
  head/sys/mips/sibyte/sb_machdep.c

Modified: head/sys/mips/conf/SWARM
==============================================================================
--- head/sys/mips/conf/SWARM	Fri Apr 23 18:53:17 2010	(r207130)
+++ head/sys/mips/conf/SWARM	Fri Apr 23 19:20:56 2010	(r207131)
@@ -8,12 +8,6 @@ options		CPU_SB1
 files		"../sibyte/files.sibyte"
 hints		"SWARM.hints"
 
-#
-# 32-bit kernel cannot deal with physical memory beyond 4GB
-# XXX pmap assumes that all the memory can be mapped using KSEG0
-#
-options		MAXMEM=512*1024
-
 options		CFE
 options		CFE_CONSOLE
 options		CFE_ENV

Modified: head/sys/mips/sibyte/sb_machdep.c
==============================================================================
--- head/sys/mips/sibyte/sb_machdep.c	Fri Apr 23 18:53:17 2010	(r207130)
+++ head/sys/mips/sibyte/sb_machdep.c	Fri Apr 23 19:20:56 2010	(r207131)
@@ -158,6 +158,17 @@ mips_init(void)
 	TUNABLE_INT_FETCH("hw.physmem", &tmp);
 	maxmem = (uint64_t)tmp * 1024;
 
+	/*
+	 * XXX
+	 * If we used vm_paddr_t consistently in pmap, etc., we could
+	 * use 64-bit page numbers on !n64 systems, too, like i386
+	 * does with PAE.
+	 */
+#if !defined(__mips_n64)
+	if (maxmem == 0 || maxmem > 0xffffffff)
+		maxmem = 0xffffffff;
+#endif
+
 #ifdef CFE
 	/*
 	 * Query DRAM memory map from CFE.

From owner-svn-src-head@FreeBSD.ORG  Fri Apr 23 19:48:31 2010
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 65597106564A;
	Fri, 23 Apr 2010 19:48:31 +0000 (UTC)
	(envelope-from jmallett@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 54BF98FC13;
	Fri, 23 Apr 2010 19:48:31 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o3NJmVux097031;
	Fri, 23 Apr 2010 19:48:31 GMT
	(envelope-from jmallett@svn.freebsd.org)
Received: (from jmallett@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o3NJmVfB097029;
	Fri, 23 Apr 2010 19:48:31 GMT
	(envelope-from jmallett@svn.freebsd.org)
Message-Id: <201004231948.o3NJmVfB097029@svn.freebsd.org>
From: Juli Mallett 
Date: Fri, 23 Apr 2010 19:48:31 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r207134 - head/sys/mips/mips
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 23 Apr 2010 19:48:31 -0000

Author: jmallett
Date: Fri Apr 23 19:48:31 2010
New Revision: 207134
URL: http://svn.freebsd.org/changeset/base/207134

Log:
  Build some nops into CLEAR_STATUS here to make sure that the following
  instructions can't be interrupted.

Modified:
  head/sys/mips/mips/exception.S

Modified: head/sys/mips/mips/exception.S
==============================================================================
--- head/sys/mips/mips/exception.S	Fri Apr 23 19:35:07 2010	(r207133)
+++ head/sys/mips/mips/exception.S	Fri Apr 23 19:48:31 2010	(r207134)
@@ -230,13 +230,15 @@ SlowFault:
 	or      a0, a0, a2	        ; \
 	li      a2, ~(MIPS_SR_INT_IE | MIPS_SR_EXL | SR_KSU_USER)   ; \
 	and     a0, a0, a2              ; \
-        mtc0    a0, COP_0_STATUS_REG    
+        mtc0    a0, COP_0_STATUS_REG    ; \
+	ITLBNOPFIX
 #else
 #define CLEAR_STATUS \
 	mfc0    a0, COP_0_STATUS_REG    ;\
 	li      a2, ~(MIPS_SR_INT_IE | MIPS_SR_EXL | SR_KSU_USER)   ; \
 	and     a0, a0, a2              ; \
-	mtc0	a0, COP_0_STATUS_REG
+	mtc0	a0, COP_0_STATUS_REG	; \
+	ITLBNOPFIX
 #endif
 
 /*

From owner-svn-src-head@FreeBSD.ORG  Fri Apr 23 22:42:50 2010
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 1D8901065670;
	Fri, 23 Apr 2010 22:42:50 +0000 (UTC)
	(envelope-from jkim@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 0CCB58FC15;
	Fri, 23 Apr 2010 22:42:50 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o3NMgnqA036408;
	Fri, 23 Apr 2010 22:42:49 GMT (envelope-from jkim@svn.freebsd.org)
Received: (from jkim@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o3NMgnej036406;
	Fri, 23 Apr 2010 22:42:49 GMT (envelope-from jkim@svn.freebsd.org)
Message-Id: <201004232242.o3NMgnej036406@svn.freebsd.org>
From: Jung-uk Kim 
Date: Fri, 23 Apr 2010 22:42:49 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r207135 - head/tools/regression/bpf/bpf_filter/tests
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 23 Apr 2010 22:42:50 -0000

Author: jkim
Date: Fri Apr 23 22:42:49 2010
New Revision: 207135
URL: http://svn.freebsd.org/changeset/base/207135

Log:
  Adjust a test case and make it more jump optimization neutral for JIT case.

Modified:
  head/tools/regression/bpf/bpf_filter/tests/test0083.h

Modified: head/tools/regression/bpf/bpf_filter/tests/test0083.h
==============================================================================
--- head/tools/regression/bpf/bpf_filter/tests/test0083.h	Fri Apr 23 19:48:31 2010	(r207134)
+++ head/tools/regression/bpf/bpf_filter/tests/test0083.h	Fri Apr 23 22:42:49 2010	(r207135)
@@ -6,7 +6,7 @@
 
 /* BPF program */
 struct bpf_insn pc[] = {
-	BPF_JUMP(BPF_JMP+BPF_JA, 0, 0, 0),
+	BPF_STMT(BPF_LD|BPF_IMM, 0),
 };
 
 /* Packet */

From owner-svn-src-head@FreeBSD.ORG  Sat Apr 24 03:11:36 2010
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 18F9D1065670;
	Sat, 24 Apr 2010 03:11:36 +0000 (UTC)
	(envelope-from jmallett@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 0703B8FC15;
	Sat, 24 Apr 2010 03:11:36 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o3O3BZIv004149;
	Sat, 24 Apr 2010 03:11:35 GMT
	(envelope-from jmallett@svn.freebsd.org)
Received: (from jmallett@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o3O3BZSa004146;
	Sat, 24 Apr 2010 03:11:35 GMT
	(envelope-from jmallett@svn.freebsd.org)
Message-Id: <201004240311.o3O3BZSa004146@svn.freebsd.org>
From: Juli Mallett 
Date: Sat, 24 Apr 2010 03:11:35 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r207139 - in head/sys/mips: include mips
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Sat, 24 Apr 2010 03:11:36 -0000

Author: jmallett
Date: Sat Apr 24 03:11:35 2010
New Revision: 207139
URL: http://svn.freebsd.org/changeset/base/207139

Log:
  Most MIPS systems have a comparatively-sparse physical memory layout.  Switch
  to using the sparse physseg layout in the VM system.

Modified:
  head/sys/mips/include/vmparam.h
  head/sys/mips/mips/pmap.c

Modified: head/sys/mips/include/vmparam.h
==============================================================================
--- head/sys/mips/include/vmparam.h	Sat Apr 24 00:53:41 2010	(r207138)
+++ head/sys/mips/include/vmparam.h	Sat Apr 24 03:11:35 2010	(r207139)
@@ -152,9 +152,9 @@
 #define	VM_PHYSSEG_MAX		32
 
 /*
- * The physical address space is densely populated.
+ * The physical address space is sparsely populated.
  */
-#define	VM_PHYSSEG_DENSE
+#define	VM_PHYSSEG_SPARSE
 
 /*
  * Create three free page pools: VM_FREEPOOL_DEFAULT is the default pool

Modified: head/sys/mips/mips/pmap.c
==============================================================================
--- head/sys/mips/mips/pmap.c	Sat Apr 24 00:53:41 2010	(r207138)
+++ head/sys/mips/mips/pmap.c	Sat Apr 24 03:11:35 2010	(r207139)
@@ -2381,8 +2381,7 @@ pmap_remove_pages(pmap_t pmap)
 		*pte = is_kernel_pmap(pmap) ? PTE_G : 0;
 
 		m = PHYS_TO_VM_PAGE(mips_tlbpfn_to_paddr(tpte));
-
-		KASSERT(m < &vm_page_array[vm_page_array_size],
+		KASSERT(m != NULL,
 		    ("pmap_remove_pages: bad tpte %x", tpte));
 
 		pv->pv_pmap->pm_stats.resident_count--;
@@ -2984,10 +2983,12 @@ page_is_managed(vm_offset_t pa)
 {
 	vm_offset_t pgnum = mips_btop(pa);
 
-	if (pgnum >= first_page && (pgnum < (first_page + vm_page_array_size))) {
+	if (pgnum >= first_page) {
 		vm_page_t m;
 
 		m = PHYS_TO_VM_PAGE(pa);
+		if (m == NULL)
+			return 0;
 		if ((m->flags & (PG_FICTITIOUS | PG_UNMANAGED)) == 0)
 			return 1;
 	}

From owner-svn-src-head@FreeBSD.ORG  Sat Apr 24 07:05:36 2010
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 69E361065670;
	Sat, 24 Apr 2010 07:05:36 +0000 (UTC)
	(envelope-from jeff@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 567B08FC1B;
	Sat, 24 Apr 2010 07:05:36 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o3O75agf055415;
	Sat, 24 Apr 2010 07:05:36 GMT (envelope-from jeff@svn.freebsd.org)
Received: (from jeff@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o3O75aZP055400;
	Sat, 24 Apr 2010 07:05:36 GMT (envelope-from jeff@svn.freebsd.org)
Message-Id: <201004240705.o3O75aZP055400@svn.freebsd.org>
From: Jeff Roberson 
Date: Sat, 24 Apr 2010 07:05:36 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r207141 - in head: lib/libufs sbin/dumpfs sbin/fsck_ffs
	sbin/fsdb sbin/tunefs sys/kern sys/sys sys/ufs/ffs
	sys/ufs/ufs usr.sbin/makefs/ffs
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Sat, 24 Apr 2010 07:05:36 -0000

Author: jeff
Date: Sat Apr 24 07:05:35 2010
New Revision: 207141
URL: http://svn.freebsd.org/changeset/base/207141

Log:
   - Merge soft-updates journaling from projects/suj/head into head.  This
     brings in support for an optional intent log which eliminates the need
     for background fsck on unclean shutdown.
  
  Sponsored by:   iXsystems, Yahoo!, and Juniper.
  With help from: McKusick and Peter Holm

Added:
  head/sbin/fsck_ffs/suj.c   (contents, props changed)
Modified:
  head/lib/libufs/Makefile
  head/lib/libufs/cgroup.c
  head/lib/libufs/inode.c
  head/lib/libufs/libufs.h
  head/lib/libufs/sblock.c
  head/lib/libufs/type.c
  head/sbin/dumpfs/dumpfs.c
  head/sbin/fsck_ffs/Makefile
  head/sbin/fsck_ffs/fsck.h
  head/sbin/fsck_ffs/gjournal.c
  head/sbin/fsck_ffs/main.c
  head/sbin/fsck_ffs/pass5.c
  head/sbin/fsdb/fsdb.c
  head/sbin/fsdb/fsdbutil.c
  head/sbin/tunefs/tunefs.8
  head/sbin/tunefs/tunefs.c
  head/sys/kern/vfs_bio.c
  head/sys/kern/vfs_subr.c
  head/sys/sys/buf.h
  head/sys/sys/mount.h
  head/sys/ufs/ffs/ffs_alloc.c
  head/sys/ufs/ffs/ffs_balloc.c
  head/sys/ufs/ffs/ffs_extern.h
  head/sys/ufs/ffs/ffs_inode.c
  head/sys/ufs/ffs/ffs_snapshot.c
  head/sys/ufs/ffs/ffs_softdep.c
  head/sys/ufs/ffs/ffs_subr.c
  head/sys/ufs/ffs/ffs_vfsops.c
  head/sys/ufs/ffs/ffs_vnops.c
  head/sys/ufs/ffs/fs.h
  head/sys/ufs/ffs/softdep.h
  head/sys/ufs/ufs/dinode.h
  head/sys/ufs/ufs/inode.h
  head/sys/ufs/ufs/ufs_dirhash.c
  head/sys/ufs/ufs/ufs_extern.h
  head/sys/ufs/ufs/ufs_lookup.c
  head/sys/ufs/ufs/ufs_vnops.c
  head/sys/ufs/ufs/ufsmount.h
  head/usr.sbin/makefs/ffs/ffs_bswap.c

Modified: head/lib/libufs/Makefile
==============================================================================
--- head/lib/libufs/Makefile	Sat Apr 24 05:03:42 2010	(r207140)
+++ head/lib/libufs/Makefile	Sat Apr 24 07:05:35 2010	(r207141)
@@ -3,7 +3,7 @@
 LIB=	ufs
 SHLIBDIR?= /lib
 
-SRCS=	block.c cgroup.c inode.c sblock.c type.c
+SRCS=	block.c cgroup.c inode.c sblock.c type.c ffs_subr.c ffs_tables.c
 INCS=	libufs.h
 
 MAN=	bread.3 cgread.3 libufs.3 sbread.3 ufs_disk_close.3
@@ -16,8 +16,11 @@ MLINKS+= ufs_disk_close.3 ufs_disk_fillo
 MLINKS+= ufs_disk_close.3 ufs_disk_fillout_blank.3
 MLINKS+= ufs_disk_close.3 ufs_disk_write.3
 
-WARNS?=	3
+.PATH:  ${.CURDIR}/../../sys/ufs/ffs
 
+WARNS?=	2
+
+DEBUG_FLAGS = -g
 CFLAGS+= -D_LIBUFS
 .if defined(LIBUFS_DEBUG)
 CFLAGS+= -D_LIBUFS_DEBUGGING

Modified: head/lib/libufs/cgroup.c
==============================================================================
--- head/lib/libufs/cgroup.c	Sat Apr 24 05:03:42 2010	(r207140)
+++ head/lib/libufs/cgroup.c	Sat Apr 24 07:05:35 2010	(r207141)
@@ -40,11 +40,143 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 
 #include 
 
+ufs2_daddr_t
+cgballoc(struct uufsd *disk)
+{
+	u_int8_t *blksfree;
+	struct cg *cgp;
+	struct fs *fs;
+	long bno;
+
+	fs = &disk->d_fs;
+	cgp = &disk->d_cg;
+	blksfree = cg_blksfree(cgp);
+	for (bno = 0; bno < fs->fs_fpg / fs->fs_frag; bno++)
+		if (ffs_isblock(fs, blksfree, bno))
+			goto gotit;
+	return (0);
+gotit:
+	fs->fs_cs(fs, cgp->cg_cgx).cs_nbfree--;
+	ffs_clrblock(fs, blksfree, (long)bno);
+	ffs_clusteracct(fs, cgp, bno, -1);
+	cgp->cg_cs.cs_nbfree--;
+	fs->fs_cstotal.cs_nbfree--;
+	fs->fs_fmod = 1;
+	return (cgbase(fs, cgp->cg_cgx) + blkstofrags(fs, bno));
+}
+
+int
+cgbfree(struct uufsd *disk, ufs2_daddr_t bno, long size)
+{
+	u_int8_t *blksfree;
+	struct fs *fs;
+	struct cg *cgp;
+	ufs1_daddr_t fragno, cgbno;
+	int i, cg, blk, frags, bbase;
+
+	fs = &disk->d_fs;
+	cg = dtog(fs, bno);
+	if (cgread1(disk, cg) != 1)
+		return (-1);
+	cgp = &disk->d_cg;
+	cgbno = dtogd(fs, bno);
+	blksfree = cg_blksfree(cgp);
+	if (size == fs->fs_bsize) {
+		fragno = fragstoblks(fs, cgbno);
+		ffs_setblock(fs, blksfree, fragno);
+		ffs_clusteracct(fs, cgp, fragno, 1);
+		cgp->cg_cs.cs_nbfree++;
+		fs->fs_cstotal.cs_nbfree++;
+		fs->fs_cs(fs, cg).cs_nbfree++;
+	} else {
+		bbase = cgbno - fragnum(fs, cgbno);
+		/*
+		 * decrement the counts associated with the old frags
+		 */
+		blk = blkmap(fs, blksfree, bbase);
+		ffs_fragacct(fs, blk, cgp->cg_frsum, -1);
+		/*
+		 * deallocate the fragment
+		 */
+		frags = numfrags(fs, size);
+		for (i = 0; i < frags; i++)
+			setbit(blksfree, cgbno + i);
+		cgp->cg_cs.cs_nffree += i;
+		fs->fs_cstotal.cs_nffree += i;
+		fs->fs_cs(fs, cg).cs_nffree += i;
+		/*
+		 * add back in counts associated with the new frags
+		 */
+		blk = blkmap(fs, blksfree, bbase);
+		ffs_fragacct(fs, blk, cgp->cg_frsum, 1);
+		/*
+		 * if a complete block has been reassembled, account for it
+		 */
+		fragno = fragstoblks(fs, bbase);
+		if (ffs_isblock(fs, blksfree, fragno)) {
+			cgp->cg_cs.cs_nffree -= fs->fs_frag;
+			fs->fs_cstotal.cs_nffree -= fs->fs_frag;
+			fs->fs_cs(fs, cg).cs_nffree -= fs->fs_frag;
+			ffs_clusteracct(fs, cgp, fragno, 1);
+			cgp->cg_cs.cs_nbfree++;
+			fs->fs_cstotal.cs_nbfree++;
+			fs->fs_cs(fs, cg).cs_nbfree++;
+		}
+	}
+	return cgwrite(disk);
+}
+
+ino_t
+cgialloc(struct uufsd *disk)
+{
+	struct ufs2_dinode *dp2;
+	u_int8_t *inosused;
+	struct cg *cgp;
+	struct fs *fs;
+	ino_t ino;
+	int i;
+
+	fs = &disk->d_fs;
+	cgp = &disk->d_cg;
+	inosused = cg_inosused(cgp);
+	for (ino = 0; ino < fs->fs_ipg / NBBY; ino++)
+		if (isclr(inosused, ino))
+			goto gotit;
+	return (0);
+gotit:
+	if (fs->fs_magic == FS_UFS2_MAGIC &&
+	    ino + INOPB(fs) > cgp->cg_initediblk &&
+	    cgp->cg_initediblk < cgp->cg_niblk) {
+		char block[MAXBSIZE];
+		bzero(block, (int)fs->fs_bsize);
+		dp2 = (struct ufs2_dinode *)█
+		for (i = 0; i < INOPB(fs); i++) {
+			dp2->di_gen = arc4random() / 2 + 1;
+			dp2++;
+		}
+		if (bwrite(disk, ino_to_fsba(fs,
+		    cgp->cg_cgx * fs->fs_ipg + cgp->cg_initediblk),
+		    block, fs->fs_bsize))
+			return (0);
+		cgp->cg_initediblk += INOPB(fs);
+	}
+
+	setbit(inosused, ino);
+	cgp->cg_irotor = ino;
+	cgp->cg_cs.cs_nifree--;
+	fs->fs_cstotal.cs_nifree--;
+	fs->fs_cs(fs, cgp->cg_cgx).cs_nifree--;
+	fs->fs_fmod = 1;
+
+	return (ino + (cgp->cg_cgx * fs->fs_ipg));
+}
+
 int
 cgread(struct uufsd *disk)
 {
@@ -55,14 +187,12 @@ int
 cgread1(struct uufsd *disk, int c)
 {
 	struct fs *fs;
-	off_t ccg;
 
 	fs = &disk->d_fs;
 
 	if ((unsigned)c >= fs->fs_ncg) {
 		return (0);
 	}
-	ccg = fsbtodb(fs, cgtod(fs, c)) * disk->d_bsize;
 	if (bread(disk, fsbtodb(fs, cgtod(fs, c)), disk->d_cgunion.d_buf,
 	    fs->fs_bsize) == -1) {
 		ERROR(disk, "unable to read cylinder group");
@@ -73,6 +203,12 @@ cgread1(struct uufsd *disk, int c)
 }
 
 int
+cgwrite(struct uufsd *disk)
+{
+	return (cgwrite1(disk, disk->d_lcg));
+}
+
+int
 cgwrite1(struct uufsd *disk, int c)
 {
 	struct fs *fs;

Modified: head/lib/libufs/inode.c
==============================================================================
--- head/lib/libufs/inode.c	Sat Apr 24 05:03:42 2010	(r207140)
+++ head/lib/libufs/inode.c	Sat Apr 24 07:05:35 2010	(r207141)
@@ -93,3 +93,19 @@ gotit:	switch (disk->d_ufs) {
 	ERROR(disk, "unknown UFS filesystem type");
 	return (-1);
 }
+
+int
+putino(struct uufsd *disk)
+{
+	struct fs *fs;
+
+	fs = &disk->d_fs;
+	if (disk->d_inoblock == NULL) {
+		ERROR(disk, "No inode block allocated");
+		return (-1);
+	}
+	if (bwrite(disk, fsbtodb(fs, ino_to_fsba(&disk->d_fs, disk->d_inomin)),
+	    disk->d_inoblock, disk->d_fs.fs_bsize) <= 0)
+		return (-1);
+	return (0);
+}

Modified: head/lib/libufs/libufs.h
==============================================================================
--- head/lib/libufs/libufs.h	Sat Apr 24 05:03:42 2010	(r207140)
+++ head/lib/libufs/libufs.h	Sat Apr 24 07:05:35 2010	(r207141)
@@ -71,6 +71,7 @@ struct uufsd {
 	int d_fd;		/* raw device file descriptor */
 	long d_bsize;		/* device bsize */
 	ufs2_daddr_t d_sblock;	/* superblock location */
+	struct csum *d_sbcsum;	/* Superblock summary info */
 	caddr_t d_inoblock;	/* inode block */
 	ino_t d_inomin;		/* low inode */
 	ino_t d_inomax;		/* high inode */
@@ -109,14 +110,19 @@ int berase(struct uufsd *, ufs2_daddr_t,
 /*
  * cgroup.c
  */
+ufs2_daddr_t cgballoc(struct uufsd *);
+int cgbfree(struct uufsd *, ufs2_daddr_t, long);
+ino_t cgialloc(struct uufsd *);
 int cgread(struct uufsd *);
 int cgread1(struct uufsd *, int);
+int cgwrite(struct uufsd *);
 int cgwrite1(struct uufsd *, int);
 
 /*
  * inode.c
  */
 int getino(struct uufsd *, void **, ino_t, int *);
+int putino(struct uufsd *);
 
 /*
  * sblock.c
@@ -132,6 +138,16 @@ int ufs_disk_fillout(struct uufsd *, con
 int ufs_disk_fillout_blank(struct uufsd *, const char *);
 int ufs_disk_write(struct uufsd *);
 
+/*
+ * ffs_subr.c
+ */
+void	ffs_clrblock(struct fs *, u_char *, ufs1_daddr_t);
+void	ffs_clusteracct(struct fs *, struct cg *, ufs1_daddr_t, int);
+void	ffs_fragacct(struct fs *, int, int32_t [], int);
+int	ffs_isblock(struct fs *, u_char *, ufs1_daddr_t);
+int	ffs_isfreeblock(struct fs *, u_char *, ufs1_daddr_t);
+void	ffs_setblock(struct fs *, u_char *, ufs1_daddr_t);
+
 __END_DECLS
 
 #endif	/* __LIBUFS_H__ */

Modified: head/lib/libufs/sblock.c
==============================================================================
--- head/lib/libufs/sblock.c	Sat Apr 24 05:03:42 2010	(r207140)
+++ head/lib/libufs/sblock.c	Sat Apr 24 07:05:35 2010	(r207141)
@@ -40,6 +40,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 #include 
 
 #include 
@@ -49,8 +50,11 @@ static int superblocks[] = SBLOCKSEARCH;
 int
 sbread(struct uufsd *disk)
 {
+	uint8_t block[MAXBSIZE];
 	struct fs *fs;
 	int sb, superblock;
+	int i, size, blks;
+	uint8_t *space;
 
 	ERROR(disk, NULL);
 
@@ -86,6 +90,34 @@ sbread(struct uufsd *disk)
 	}
 	disk->d_bsize = fs->fs_fsize / fsbtodb(fs, 1);
 	disk->d_sblock = superblock / disk->d_bsize;
+	/*
+	 * Read in the superblock summary information.
+	 */
+	size = fs->fs_cssize;
+	blks = howmany(size, fs->fs_fsize);
+	size += fs->fs_ncg * sizeof(int32_t);
+	space = malloc(size);
+	if (space == NULL) {
+		ERROR(disk, "failed to allocate space for summary information");
+		return (-1);
+	}
+	fs->fs_csp = (struct csum *)space;
+	for (i = 0; i < blks; i += fs->fs_frag) {
+		size = fs->fs_bsize;
+		if (i + fs->fs_frag > blks)
+			size = (blks - i) * fs->fs_fsize;
+		if (bread(disk, fsbtodb(fs, fs->fs_csaddr + i), block, size)
+		    == -1) {
+			ERROR(disk, "Failed to read sb summary information");
+			free(fs->fs_csp);
+			return (-1);
+		}
+		bcopy(block, space, size);
+		space += size;
+	}
+	fs->fs_maxcluster = (uint32_t *)space;
+	disk->d_sbcsum = fs->fs_csp;
+
 	return (0);
 }
 
@@ -93,6 +125,8 @@ int
 sbwrite(struct uufsd *disk, int all)
 {
 	struct fs *fs;
+	int blks, size;
+	uint8_t *space;
 	unsigned i;
 
 	ERROR(disk, NULL);
@@ -107,6 +141,22 @@ sbwrite(struct uufsd *disk, int all)
 		ERROR(disk, "failed to write superblock");
 		return (-1);
 	}
+	/*
+	 * Write superblock summary information.
+	 */
+	blks = howmany(fs->fs_cssize, fs->fs_fsize);
+	space = (uint8_t *)disk->d_sbcsum;
+	for (i = 0; i < blks; i += fs->fs_frag) {
+		size = fs->fs_bsize;
+		if (i + fs->fs_frag > blks)
+			size = (blks - i) * fs->fs_fsize;
+		if (bwrite(disk, fsbtodb(fs, fs->fs_csaddr + i), space, size)
+		    == -1) {
+			ERROR(disk, "Failed to write sb summary information");
+			return (-1);
+		}
+		space += size;
+	}
 	if (all) {
 		for (i = 0; i < fs->fs_ncg; i++)
 			if (bwrite(disk, fsbtodb(fs, cgsblock(fs, i)),

Modified: head/lib/libufs/type.c
==============================================================================
--- head/lib/libufs/type.c	Sat Apr 24 05:03:42 2010	(r207140)
+++ head/lib/libufs/type.c	Sat Apr 24 07:05:35 2010	(r207141)
@@ -66,6 +66,10 @@ ufs_disk_close(struct uufsd *disk)
 		free((char *)(uintptr_t)disk->d_name);
 		disk->d_name = NULL;
 	}
+	if (disk->d_sbcsum != NULL) {
+		free(disk->d_sbcsum);
+		disk->d_sbcsum = NULL;
+	}
 	return (0);
 }
 
@@ -156,6 +160,7 @@ again:	if ((ret = stat(name, &st)) < 0) 
 	disk->d_mine = 0;
 	disk->d_ufs = 0;
 	disk->d_error = NULL;
+	disk->d_sbcsum = NULL;
 
 	if (oname != name) {
 		name = strdup(name);

Modified: head/sbin/dumpfs/dumpfs.c
==============================================================================
--- head/sbin/dumpfs/dumpfs.c	Sat Apr 24 05:03:42 2010	(r207140)
+++ head/sbin/dumpfs/dumpfs.c	Sat Apr 24 07:05:35 2010	(r207141)
@@ -238,7 +238,7 @@ dumpfs(const char *name)
 	if (fsflags & FS_UNCLEAN)
 		printf("unclean ");
 	if (fsflags & FS_DOSOFTDEP)
-		printf("soft-updates ");
+		printf("soft-updates%s ", (fsflags & FS_SUJ) ? "+journal" : "");
 	if (fsflags & FS_NEEDSFSCK)
 		printf("needs fsck run ");
 	if (fsflags & FS_INDEXDIRS)
@@ -255,7 +255,7 @@ dumpfs(const char *name)
 		printf("nfsv4acls ");
 	fsflags &= ~(FS_UNCLEAN | FS_DOSOFTDEP | FS_NEEDSFSCK | FS_INDEXDIRS |
 		     FS_ACLS | FS_MULTILABEL | FS_GJOURNAL | FS_FLAGS_UPDATED |
-		     FS_NFS4ACLS);
+		     FS_NFS4ACLS | FS_SUJ);
 	if (fsflags != 0)
 		printf("unknown flags (%#x)", fsflags);
 	putchar('\n');

Modified: head/sbin/fsck_ffs/Makefile
==============================================================================
--- head/sbin/fsck_ffs/Makefile	Sat Apr 24 05:03:42 2010	(r207140)
+++ head/sbin/fsck_ffs/Makefile	Sat Apr 24 07:05:35 2010	(r207141)
@@ -7,8 +7,7 @@ LINKS+=	${BINDIR}/fsck_ffs ${BINDIR}/fsc
 MAN=	fsck_ffs.8
 MLINKS=	fsck_ffs.8 fsck_ufs.8 fsck_ffs.8 fsck_4.2bsd.8
 SRCS=	dir.c ea.c fsutil.c inode.c main.c pass1.c pass1b.c pass2.c pass3.c \
-	pass4.c pass5.c setup.c utilities.c ffs_subr.c ffs_tables.c gjournal.c \
-	getmntopts.c
+	pass4.c pass5.c setup.c suj.c utilities.c gjournal.c getmntopts.c
 DPADD=	${LIBUFS}
 LDADD=	-lufs
 WARNS?=	2

Modified: head/sbin/fsck_ffs/fsck.h
==============================================================================
--- head/sbin/fsck_ffs/fsck.h	Sat Apr 24 05:03:42 2010	(r207140)
+++ head/sbin/fsck_ffs/fsck.h	Sat Apr 24 07:05:35 2010	(r207141)
@@ -347,10 +347,6 @@ void		direrror(ino_t ino, const char *er
 int		dirscan(struct inodesc *);
 int		dofix(struct inodesc *, const char *msg);
 int		eascan(struct inodesc *, struct ufs2_dinode *dp);
-void		ffs_clrblock(struct fs *, u_char *, ufs1_daddr_t);
-void		ffs_fragacct(struct fs *, int, int32_t [], int);
-int		ffs_isblock(struct fs *, u_char *, ufs1_daddr_t);
-void		ffs_setblock(struct fs *, u_char *, ufs1_daddr_t);
 void		fileerror(ino_t cwd, ino_t ino, const char *errmesg);
 int		findino(struct inodesc *);
 int		findname(struct inodesc *);
@@ -392,3 +388,4 @@ void		sblock_init(void);
 void		setinodebuf(ino_t);
 int		setup(char *dev);
 void		gjournal_check(const char *filesys);
+int		suj_check(const char *filesys);

Modified: head/sbin/fsck_ffs/gjournal.c
==============================================================================
--- head/sbin/fsck_ffs/gjournal.c	Sat Apr 24 05:03:42 2010	(r207140)
+++ head/sbin/fsck_ffs/gjournal.c	Sat Apr 24 07:05:35 2010	(r207141)
@@ -96,27 +96,6 @@ struct ufs2_dinode ufs2_zino;
 static void putcgs(void);
 
 /*
- * Write current block of inodes.
- */
-static int
-putino(struct uufsd *disk, ino_t inode)
-{
-	caddr_t inoblock;
-	struct fs *fs;
-	ssize_t ret;
-
-	fs = &disk->d_fs;
-	inoblock = disk->d_inoblock;
-
-	assert(inoblock != NULL);
-	assert(inode >= disk->d_inomin && inode <= disk->d_inomax);
-	ret = bwrite(disk, fsbtodb(fs, ino_to_fsba(fs, inode)), inoblock,
-	    fs->fs_bsize);
-
-	return (ret == -1 ? -1 : 0);
-}
-
-/*
  * Return cylinder group from the cache or load it if it is not in the
  * cache yet.
  * Don't cache more than MAX_CACHED_CGS cylinder groups.
@@ -242,13 +221,11 @@ cancelcgs(void)
 #endif
 
 /*
- * Open the given provider, load statistics.
+ * Open the given provider, load superblock.
  */
 static void
-getdisk(void)
+opendisk(void)
 {
-	int i;
-
 	if (disk != NULL)
 		return;
 	disk = malloc(sizeof(*disk));
@@ -259,24 +236,6 @@ getdisk(void)
 		    disk->d_error);
 	}
 	fs = &disk->d_fs;
-	fs->fs_csp = malloc((size_t)fs->fs_cssize);
-	if (fs->fs_csp == NULL)
-		err(1, "malloc(%zu)", (size_t)fs->fs_cssize);
-	bzero(fs->fs_csp, (size_t)fs->fs_cssize);
-	for (i = 0; i < fs->fs_cssize; i += fs->fs_bsize) {
-		if (bread(disk, fsbtodb(fs, fs->fs_csaddr + numfrags(fs, i)),
-		    (void *)(((char *)fs->fs_csp) + i),
-		    (size_t)(fs->fs_cssize - i < fs->fs_bsize ? fs->fs_cssize - i : fs->fs_bsize)) == -1) {
-			err(1, "bread: %s", disk->d_error);
-		}
-	}
-	if (fs->fs_contigsumsize > 0) {
-		fs->fs_maxcluster = malloc(fs->fs_ncg * sizeof(int32_t));
-		if (fs->fs_maxcluster == NULL)
-			err(1, "malloc(%zu)", fs->fs_ncg * sizeof(int32_t));
-		for (i = 0; i < fs->fs_ncg; i++)
-			fs->fs_maxcluster[i] = fs->fs_contigsumsize;
-	}
 }
 
 /*
@@ -286,11 +245,6 @@ static void
 closedisk(void)
 {
 
-	free(fs->fs_csp);
-	if (fs->fs_contigsumsize > 0) {
-		free(fs->fs_maxcluster);
-		fs->fs_maxcluster = NULL;
-	}
 	fs->fs_clean = 1;
 	if (sbwrite(disk, 0) == -1)
 		err(1, "sbwrite(%s)", devnam);
@@ -301,227 +255,6 @@ closedisk(void)
 	fs = NULL;
 }
 
-/*
- * Write the statistics back, call closedisk().
- */
-static void
-putdisk(void)
-{
-	int i;
-
-	assert(disk != NULL && fs != NULL);
-	for (i = 0; i < fs->fs_cssize; i += fs->fs_bsize) {
-		if (bwrite(disk, fsbtodb(fs, fs->fs_csaddr + numfrags(fs, i)),
-		    (void *)(((char *)fs->fs_csp) + i),
-		    (size_t)(fs->fs_cssize - i < fs->fs_bsize ? fs->fs_cssize - i : fs->fs_bsize)) == -1) {
-			err(1, "bwrite: %s", disk->d_error);
-		}
-	}
-	closedisk();
-}
-
-#if 0
-/*
- * Free memory, close the disk, but don't write anything back.
- */
-static void
-canceldisk(void)
-{
-	int i;
-
-	assert(disk != NULL && fs != NULL);
-	free(fs->fs_csp);
-	if (fs->fs_contigsumsize > 0)
-		free(fs->fs_maxcluster);
-	if (ufs_disk_close(disk) == -1)
-		err(1, "ufs_disk_close(%s)", devnam);
-	free(disk);
-	disk = NULL;
-	fs = NULL;
-}
-#endif
-
-static int
-isblock(unsigned char *cp, ufs1_daddr_t h)
-{
-	unsigned char mask;
-
-	switch ((int)fs->fs_frag) {
-	case 8:
-		return (cp[h] == 0xff);
-	case 4:
-		mask = 0x0f << ((h & 0x1) << 2);
-		return ((cp[h >> 1] & mask) == mask);
-	case 2:
-		mask = 0x03 << ((h & 0x3) << 1);
-		return ((cp[h >> 2] & mask) == mask);
-	case 1:
-		mask = 0x01 << (h & 0x7);
-		return ((cp[h >> 3] & mask) == mask);
-	default:
-		assert(!"isblock: invalid number of fragments");
-	}
-	return (0);
-}
-
-/*
- * put a block into the map
- */
-static void
-setblock(unsigned char *cp, ufs1_daddr_t h)
-{
-
-	switch ((int)fs->fs_frag) {
-	case 8:
-		cp[h] = 0xff;
-		return;
-	case 4:
-		cp[h >> 1] |= (0x0f << ((h & 0x1) << 2));
-		return;
-	case 2:
-		cp[h >> 2] |= (0x03 << ((h & 0x3) << 1));
-		return;
-	case 1:
-		cp[h >> 3] |= (0x01 << (h & 0x7));
-		return;
-	default:
-		assert(!"setblock: invalid number of fragments");
-	}
-}
-
-/*
- * check if a block is free
- */
-static int
-isfreeblock(u_char *cp, ufs1_daddr_t h)
-{
-
-	switch ((int)fs->fs_frag) {
-	case 8:
-		return (cp[h] == 0);
-	case 4:
-		return ((cp[h >> 1] & (0x0f << ((h & 0x1) << 2))) == 0);
-	case 2:
-		return ((cp[h >> 2] & (0x03 << ((h & 0x3) << 1))) == 0);
-	case 1:
-		return ((cp[h >> 3] & (0x01 << (h & 0x7))) == 0);
-	default:
-		assert(!"isfreeblock: invalid number of fragments");
-	}
-	return (0);
-}
-
-/*
- * Update the frsum fields to reflect addition or deletion
- * of some frags.
- */
-void
-fragacct(int fragmap, int32_t fraglist[], int cnt)
-{
-	int inblk;
-	int field, subfield;
-	int siz, pos;
-
-	inblk = (int)(fragtbl[fs->fs_frag][fragmap]) << 1;
-	fragmap <<= 1;
-	for (siz = 1; siz < fs->fs_frag; siz++) {
-		if ((inblk & (1 << (siz + (fs->fs_frag % NBBY)))) == 0)
-			continue;
-		field = around[siz];
-		subfield = inside[siz];
-		for (pos = siz; pos <= fs->fs_frag; pos++) {
-			if ((fragmap & field) == subfield) {
-				fraglist[siz] += cnt;
-				pos += siz;
-				field <<= siz;
-				subfield <<= siz;
-			}
-			field <<= 1;
-			subfield <<= 1;
-		}
-	}
-}
-
-static void
-clusteracct(struct cg *cgp, ufs1_daddr_t blkno)
-{
-	int32_t *sump;
-	int32_t *lp;
-	u_char *freemapp, *mapp;
-	int i, start, end, forw, back, map, bit;
-
-	if (fs->fs_contigsumsize <= 0)
-		return;
-	freemapp = cg_clustersfree(cgp);
-	sump = cg_clustersum(cgp);
-	/*
-	 * Clear the actual block.
-	 */
-	setbit(freemapp, blkno);
-	/*
-	 * Find the size of the cluster going forward.
-	 */
-	start = blkno + 1;
-	end = start + fs->fs_contigsumsize;
-	if (end >= cgp->cg_nclusterblks)
-		end = cgp->cg_nclusterblks;
-	mapp = &freemapp[start / NBBY];
-	map = *mapp++;
-	bit = 1 << (start % NBBY);
-	for (i = start; i < end; i++) {
-		if ((map & bit) == 0)
-			break;
-		if ((i & (NBBY - 1)) != (NBBY - 1)) {
-			bit <<= 1;
-		} else {
-			map = *mapp++;
-			bit = 1;
-		}
-	}
-	forw = i - start;
-	/*
-	 * Find the size of the cluster going backward.
-	 */
-	start = blkno - 1;
-	end = start - fs->fs_contigsumsize;
-	if (end < 0)
-		end = -1;
-	mapp = &freemapp[start / NBBY];
-	map = *mapp--;
-	bit = 1 << (start % NBBY);
-	for (i = start; i > end; i--) {
-		if ((map & bit) == 0)
-			break;
-		if ((i & (NBBY - 1)) != 0) {
-			bit >>= 1;
-		} else {
-			map = *mapp--;
-			bit = 1 << (NBBY - 1);
-		}
-	}
-	back = start - i;
-	/*
-	 * Account for old cluster and the possibly new forward and
-	 * back clusters.
-	 */
-	i = back + forw + 1;
-	if (i > fs->fs_contigsumsize)
-		i = fs->fs_contigsumsize;
-	sump[i]++;
-	if (back > 0)
-		sump[back]--;
-	if (forw > 0)
-		sump[forw]--;
-	/*
-	 * Update cluster summary information.
-	 */
-	lp = &sump[fs->fs_contigsumsize];
-	for (i = fs->fs_contigsumsize; i > 0; i--)
-		if (*lp-- > 0)
-			break;
-	fs->fs_maxcluster[cgp->cg_cgx] = i;
-}
-
 static void
 blkfree(ufs2_daddr_t bno, long size)
 {
@@ -539,10 +272,10 @@ blkfree(ufs2_daddr_t bno, long size)
 	blksfree = cg_blksfree(cgp);
 	if (size == fs->fs_bsize) {
 		fragno = fragstoblks(fs, cgbno);
-		if (!isfreeblock(blksfree, fragno))
+		if (!ffs_isfreeblock(fs, blksfree, fragno))
 			assert(!"blkfree: freeing free block");
-		setblock(blksfree, fragno);
-		clusteracct(cgp, fragno);
+		ffs_setblock(fs, blksfree, fragno);
+		ffs_clusteracct(fs, cgp, fragno, 1);
 		cgp->cg_cs.cs_nbfree++;
 		fs->fs_cstotal.cs_nbfree++;
 		fs->fs_cs(fs, cg).cs_nbfree++;
@@ -552,7 +285,7 @@ blkfree(ufs2_daddr_t bno, long size)
 		 * decrement the counts associated with the old frags
 		 */
 		blk = blkmap(fs, blksfree, bbase);
-		fragacct(blk, cgp->cg_frsum, -1);
+		ffs_fragacct(fs, blk, cgp->cg_frsum, -1);
 		/*
 		 * deallocate the fragment
 		 */
@@ -569,16 +302,16 @@ blkfree(ufs2_daddr_t bno, long size)
 		 * add back in counts associated with the new frags
 		 */
 		blk = blkmap(fs, blksfree, bbase);
-		fragacct(blk, cgp->cg_frsum, 1);
+		ffs_fragacct(fs, blk, cgp->cg_frsum, 1);
 		/*
 		 * if a complete block has been reassembled, account for it
 		 */
 		fragno = fragstoblks(fs, bbase);
-		if (isblock(blksfree, fragno)) {
+		if (ffs_isblock(fs, blksfree, fragno)) {
 			cgp->cg_cs.cs_nffree -= fs->fs_frag;
 			fs->fs_cstotal.cs_nffree -= fs->fs_frag;
 			fs->fs_cs(fs, cg).cs_nffree -= fs->fs_frag;
-			clusteracct(cgp, fragno);
+			ffs_clusteracct(fs, cgp, fragno, 1);
 			cgp->cg_cs.cs_nbfree++;
 			fs->fs_cstotal.cs_nbfree++;
 			fs->fs_cs(fs, cg).cs_nbfree++;
@@ -599,7 +332,7 @@ freeindir(ufs2_daddr_t blk, int level)
 	if (bread(disk, fsbtodb(fs, blk), (void *)&sblks, (size_t)fs->fs_bsize) == -1)
 		err(1, "bread: %s", disk->d_error);
 	blks = (ufs2_daddr_t *)&sblks;
-	for (i = 0; i < howmany(fs->fs_bsize, sizeof(ufs2_daddr_t)); i++) {
+	for (i = 0; i < NINDIR(fs); i++) {
 		if (blks[i] == 0)
 			break;
 		if (level == 0)
@@ -671,7 +404,7 @@ gjournal_check(const char *filesys)
 	int cg, mode;
 
 	devnam = filesys;
-	getdisk();
+	opendisk();
 	/* Are there any unreferenced inodes in this file system? */
 	if (fs->fs_unrefs == 0) {
 		//printf("No unreferenced inodes.\n");
@@ -747,7 +480,7 @@ gjournal_check(const char *filesys)
 			/* Zero-fill the inode. */
 			*dino = ufs2_zino;
 			/* Write the inode back. */
-			if (putino(disk, ino) == -1)
+			if (putino(disk) == -1)
 				err(1, "putino(cg=%d ino=%d)", cg, ino);
 			if (cgp->cg_unrefs == 0) {
 				//printf("No more unreferenced inodes in cg=%d.\n", cg);
@@ -772,5 +505,5 @@ gjournal_check(const char *filesys)
 	/* Write back modified cylinder groups. */
 	putcgs();
 	/* Write back updated statistics and super-block. */
-	putdisk();
+	closedisk();
 }

Modified: head/sbin/fsck_ffs/main.c
==============================================================================
--- head/sbin/fsck_ffs/main.c	Sat Apr 24 05:03:42 2010	(r207140)
+++ head/sbin/fsck_ffs/main.c	Sat Apr 24 07:05:35 2010	(r207141)
@@ -242,8 +242,9 @@ checkfilesys(char *filesys)
 		if ((fsreadfd = open(filesys, O_RDONLY)) < 0 || readsb(0) == 0)
 			exit(3);	/* Cannot read superblock */
 		close(fsreadfd);
-		if (sblock.fs_flags & FS_NEEDSFSCK)
-			exit(4);	/* Earlier background failed */
+		/* Earlier background failed or journaled */
+		if (sblock.fs_flags & (FS_NEEDSFSCK | FS_SUJ))
+			exit(4);
 		if ((sblock.fs_flags & FS_DOSOFTDEP) == 0)
 			exit(5);	/* Not running soft updates */
 		size = MIBSIZE;
@@ -299,7 +300,7 @@ checkfilesys(char *filesys)
 			pfatal("MOUNTED READ-ONLY, CANNOT RUN IN BACKGROUND\n");
 		} else if ((fsreadfd = open(filesys, O_RDONLY)) >= 0) {
 			if (readsb(0) != 0) {
-				if (sblock.fs_flags & FS_NEEDSFSCK) {
+				if (sblock.fs_flags & (FS_NEEDSFSCK | FS_SUJ)) {
 					bkgrdflag = 0;
 					pfatal("UNEXPECTED INCONSISTENCY, %s\n",
 					    "CANNOT RUN IN BACKGROUND\n");
@@ -384,6 +385,26 @@ checkfilesys(char *filesys)
 		    sblock.fs_cstotal.cs_nffree * 100.0 / sblock.fs_dsize);
 		return (0);
 	}
+	/*
+	 * Determine if we can and should do journal recovery.
+	 */
+	if ((sblock.fs_flags & (FS_SUJ | FS_NEEDSFSCK)) == FS_SUJ) {
+		if (preen || reply("USE JOURNAL?")) {
+			if (suj_check(filesys) == 0) {
+				if (chkdoreload(mntp) == 0)
+					exit(0);
+				exit(4);
+			}
+			/* suj_check failed, fall through. */
+		}
+		printf("** Skipping journal, falling through to full fsck\n");
+		/*
+		 * Write the superblock so we don't try to recover the
+		 * journal on another pass.
+		 */
+		sblock.fs_mtime = time(NULL);
+		sbdirty();
+	}
 	
 	/*
 	 * Cleared if any questions answered no. Used to decide if

Modified: head/sbin/fsck_ffs/pass5.c
==============================================================================
--- head/sbin/fsck_ffs/pass5.c	Sat Apr 24 05:03:42 2010	(r207140)
+++ head/sbin/fsck_ffs/pass5.c	Sat Apr 24 07:05:35 2010	(r207141)
@@ -45,6 +45,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 
 #include "fsck.h"
 

Added: head/sbin/fsck_ffs/suj.c
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/sbin/fsck_ffs/suj.c	Sat Apr 24 07:05:35 2010	(r207141)
@@ -0,0 +1,4699 @@
+/*-
+ * Copyright 2009, 2010 Jeffrey W. Roberson 
+ * 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 AUTHORS 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 AUTHORS 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 
+#include 
+
+#include "fsck.h"
+
+#define	DOTDOT_OFFSET	DIRECTSIZ(1)
+#define	SUJ_HASHSIZE	2048
+#define	SUJ_HASHMASK	(SUJ_HASHSIZE - 1)
+#define	SUJ_HASH(x)	((x * 2654435761) & SUJ_HASHMASK)
+
+struct suj_seg {
+	TAILQ_ENTRY(suj_seg) ss_next;
+	struct jsegrec	ss_rec;
+	uint8_t		*ss_blk;
+};
+
+struct suj_rec {
+	TAILQ_ENTRY(suj_rec) sr_next;
+	union jrec	*sr_rec;
+};
+TAILQ_HEAD(srechd, suj_rec);
+
+struct suj_ino {
+	LIST_ENTRY(suj_ino)	si_next;
+	struct srechd		si_recs;
+	struct srechd		si_newrecs;
+	struct srechd		si_movs;
+	struct jtrncrec		*si_trunc;
+	ino_t			si_ino;
+	char			si_skipparent;
+	char			si_hasrecs;
+	char			si_blkadj;
+	char			si_linkadj;
+	int			si_mode;
+	nlink_t			si_nlinkadj;
+	nlink_t			si_nlink;
+	nlink_t			si_dotlinks;
+};
+LIST_HEAD(inohd, suj_ino);
+
+struct suj_blk {
+	LIST_ENTRY(suj_blk)	sb_next;
+	struct srechd		sb_recs;
+	ufs2_daddr_t		sb_blk;
+};
+LIST_HEAD(blkhd, suj_blk);
+
+struct data_blk {
+	LIST_ENTRY(data_blk)	db_next;
+	uint8_t			*db_buf;
+	ufs2_daddr_t		db_blk;
+	int			db_size;
+	int			db_dirty;
+};
+
+struct ino_blk {
+	LIST_ENTRY(ino_blk)	ib_next;
+	uint8_t			*ib_buf;
+	int			ib_dirty;
+	ufs2_daddr_t		ib_blk;
+};
+LIST_HEAD(iblkhd, ino_blk);
+
+struct suj_cg {
+	LIST_ENTRY(suj_cg)	sc_next;
+	struct blkhd		sc_blkhash[SUJ_HASHSIZE];
+	struct inohd		sc_inohash[SUJ_HASHSIZE];
+	struct iblkhd		sc_iblkhash[SUJ_HASHSIZE];
+	struct ino_blk		*sc_lastiblk;
+	struct suj_ino		*sc_lastino;
+	struct suj_blk		*sc_lastblk;
+	uint8_t			*sc_cgbuf;
+	struct cg		*sc_cgp;
+	int			sc_dirty;
+	int			sc_cgx;
+};
+

*** DIFF OUTPUT TRUNCATED AT 1000 LINES ***

From owner-svn-src-head@FreeBSD.ORG  Sat Apr 24 07:36:33 2010
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 94FDB106566C;
	Sat, 24 Apr 2010 07:36:33 +0000 (UTC) (envelope-from pjd@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 855AE8FC19;
	Sat, 24 Apr 2010 07:36:33 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o3O7aX44062191;
	Sat, 24 Apr 2010 07:36:33 GMT (envelope-from pjd@svn.freebsd.org)
Received: (from pjd@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o3O7aXVX062189;
	Sat, 24 Apr 2010 07:36:33 GMT (envelope-from pjd@svn.freebsd.org)
Message-Id: <201004240736.o3O7aXVX062189@svn.freebsd.org>
From: Pawel Jakub Dawidek 
Date: Sat, 24 Apr 2010 07:36:33 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r207142 - head/sys/ufs/ffs
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Sat, 24 Apr 2010 07:36:33 -0000

Author: pjd
Date: Sat Apr 24 07:36:33 2010
New Revision: 207142
URL: http://svn.freebsd.org/changeset/base/207142

Log:
  Fix build for UFS without SOFTUPDATES.

Modified:
  head/sys/ufs/ffs/ffs_softdep.c

Modified: head/sys/ufs/ffs/ffs_softdep.c
==============================================================================
--- head/sys/ufs/ffs/ffs_softdep.c	Sat Apr 24 07:05:35 2010	(r207141)
+++ head/sys/ufs/ffs/ffs_softdep.c	Sat Apr 24 07:36:33 2010	(r207142)
@@ -232,7 +232,8 @@ softdep_setup_directory_add(bp, dp, diro
 }
 
 void 
-softdep_change_directoryentry_offset(dp, base, oldloc, newloc, entrysize)
+softdep_change_directoryentry_offset(bp, dp, base, oldloc, newloc, entrysize)
+	struct buf *bp;
 	struct inode *dp;
 	caddr_t base;
 	caddr_t oldloc;

From owner-svn-src-head@FreeBSD.ORG  Sat Apr 24 07:54:50 2010
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 0736D1065679;
	Sat, 24 Apr 2010 07:54:50 +0000 (UTC) (envelope-from pjd@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id EBE068FC1C;
	Sat, 24 Apr 2010 07:54:49 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o3O7snRI066340;
	Sat, 24 Apr 2010 07:54:49 GMT (envelope-from pjd@svn.freebsd.org)
Received: (from pjd@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o3O7snH5066338;
	Sat, 24 Apr 2010 07:54:49 GMT (envelope-from pjd@svn.freebsd.org)
Message-Id: <201004240754.o3O7snH5066338@svn.freebsd.org>
From: Pawel Jakub Dawidek 
Date: Sat, 24 Apr 2010 07:54:49 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r207143 - head/sbin/fsck_ffs
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Sat, 24 Apr 2010 07:54:50 -0000

Author: pjd
Date: Sat Apr 24 07:54:49 2010
New Revision: 207143
URL: http://svn.freebsd.org/changeset/base/207143

Log:
  Protect fsck.h from being included twice.

Modified:
  head/sbin/fsck_ffs/fsck.h

Modified: head/sbin/fsck_ffs/fsck.h
==============================================================================
--- head/sbin/fsck_ffs/fsck.h	Sat Apr 24 07:36:33 2010	(r207142)
+++ head/sbin/fsck_ffs/fsck.h	Sat Apr 24 07:54:49 2010	(r207143)
@@ -60,6 +60,9 @@
  * $FreeBSD$
  */
 
+#ifndef _FSCK_H_
+#define	_FSCK_H_
+
 #include 
 #include 
 #include 
@@ -389,3 +392,5 @@ void		setinodebuf(ino_t);
 int		setup(char *dev);
 void		gjournal_check(const char *filesys);
 int		suj_check(const char *filesys);
+
+#endif	/* !_FSCK_H_ */

From owner-svn-src-head@FreeBSD.ORG  Sat Apr 24 07:58:59 2010
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id DEC70106564A;
	Sat, 24 Apr 2010 07:58:59 +0000 (UTC) (envelope-from pjd@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id CDB8F8FC13;
	Sat, 24 Apr 2010 07:58:59 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o3O7wxlx067334;
	Sat, 24 Apr 2010 07:58:59 GMT (envelope-from pjd@svn.freebsd.org)
Received: (from pjd@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o3O7wxZA067332;
	Sat, 24 Apr 2010 07:58:59 GMT (envelope-from pjd@svn.freebsd.org)
Message-Id: <201004240758.o3O7wxZA067332@svn.freebsd.org>
From: Pawel Jakub Dawidek 
Date: Sat, 24 Apr 2010 07:58:59 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r207144 - head/sbin/fsck_ffs
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Sat, 24 Apr 2010 07:59:00 -0000

Author: pjd
Date: Sat Apr 24 07:58:59 2010
New Revision: 207144
URL: http://svn.freebsd.org/changeset/base/207144

Log:
  suj.c seems to contain two versions of the code.
  Remove the one that doesn't compile.

Modified:
  head/sbin/fsck_ffs/suj.c

Modified: head/sbin/fsck_ffs/suj.c
==============================================================================
--- head/sbin/fsck_ffs/suj.c	Sat Apr 24 07:54:49 2010	(r207143)
+++ head/sbin/fsck_ffs/suj.c	Sat Apr 24 07:58:59 2010	(r207144)
@@ -2632,2068 +2632,3 @@ suj_check(const char *filesys)
 
 	return (0);
 }
-/*-
- * Copyright (c) 2009 Jeffrey W. Roberson 
- * 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 AUTHORS 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 AUTHORS 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 
-
-#include "fsck.h"
-
-static void	ino_decr(ino_t);
-
-#define	SUJ_HASHSIZE	128
-#define	SUJ_HASHMASK	(SUJ_HASHSIZE - 1)
-#define	SUJ_HASH(x)	((x * 2654435761) & SUJ_HASHMASK)
-
-struct suj_seg {
-	TAILQ_ENTRY(suj_seg) ss_next;
-	struct jsegrec	ss_rec;
-	uint8_t		*ss_blk;
-};
-
-struct suj_rec {
-	TAILQ_ENTRY(suj_rec) sr_next;
-	union jrec	*sr_rec;
-};
-TAILQ_HEAD(srechd, suj_rec);
-
-struct suj_ino {
-	LIST_ENTRY(suj_ino)	si_next;
-	struct srechd		si_recs;
-	struct srechd		si_movs;
-	ino_t			si_ino;
-	int			si_nlinkadj;
-	int			si_skipparent;
-	int			si_linkadj;
-	int			si_hasrecs;
-	int			si_blkadj;
-};
-LIST_HEAD(inohd, suj_ino);
-
-struct suj_blk {
-	LIST_ENTRY(suj_blk)	sb_next;
-	struct srechd		sb_recs;
-	ufs2_daddr_t		sb_blk;
-};
-LIST_HEAD(blkhd, suj_blk);
-
-struct data_blk {
-	LIST_ENTRY(data_blk)	db_next;
-	uint8_t			*db_buf;
-	ufs2_daddr_t		db_blk;
-	int			db_size;
-};
-
-struct ino_blk {
-	LIST_ENTRY(ino_blk)	ib_next;
-	uint8_t			*ib_buf;
-	int			ib_dirty;
-	ufs2_daddr_t		ib_blk;
-};
-LIST_HEAD(iblkhd, ino_blk);
-
-struct suj_cg {
-	LIST_ENTRY(suj_cg)	sc_next;
-	struct blkhd		sc_blkhash[SUJ_HASHSIZE];
-	struct inohd		sc_inohash[SUJ_HASHSIZE];
-	struct iblkhd		sc_iblkhash[SUJ_HASHSIZE];
-	struct ino_blk		*sc_lastiblk;
-	uint8_t			*sc_cgbuf;
-	struct cg		*sc_cgp;
-	int			sc_dirty;
-	int			sc_cgx;
-};
-
-LIST_HEAD(cghd, suj_cg) cghash[SUJ_HASHSIZE];
-LIST_HEAD(dblkhd, data_blk) dbhash[SUJ_HASHSIZE];
-
-TAILQ_HEAD(seghd, suj_seg) allsegs;
-uint64_t oldseq;
-static struct uufsd *disk = NULL;
-static struct fs *fs = NULL;
-
-/*
- * Summary statistics.
- */
-uint64_t freefrags;
-uint64_t freeblocks;
-uint64_t freeinos;
-uint64_t freedir;
-uint64_t jbytes;
-uint64_t jrecs;
-
-typedef void (*ino_visitor)(ino_t, ufs_lbn_t, ufs2_daddr_t, int);
-
-static void *
-errmalloc(size_t n)
-{
-	void *a;
-
-	a = malloc(n);
-	if (a == NULL)
-		errx(1, "malloc(%zu)", n);
-	return (a);
-}
-
-/*
- * Open the given provider, load superblock.
- */
-static void
-opendisk(const char *devnam)
-{
-	if (disk != NULL)
-		return;
-	disk = malloc(sizeof(*disk));
-	if (disk == NULL)
-		errx(1, "malloc(%zu)", sizeof(*disk));
-	if (ufs_disk_fillout(disk, devnam) == -1) {
-		err(1, "ufs_disk_fillout(%s) failed: %s", devnam,
-		    disk->d_error);
-	}
-	fs = &disk->d_fs;
-	/*
-	 * Setup a few things so reply() can work.
-	 */
-	bcopy(fs, &sblock, sizeof(sblock));
-	fsreadfd = disk->d_fd;
-	fswritefd = disk->d_fd;
-}
-
-/*
- * Mark file system as clean, write the super-block back, close the disk.
- */
-static void
-closedisk(const char *devnam)
-{
-	struct csum *cgsum;
-	int i;
-
-	/*
-	 * Recompute the fs summary info from correct cs summaries.
-	 */
-	bzero(&fs->fs_cstotal, sizeof(struct csum_total));
-	for (i = 0; i < fs->fs_ncg; i++) {
-		cgsum = &fs->fs_cs(fs, i);
-		fs->fs_cstotal.cs_nffree += cgsum->cs_nffree;
-		fs->fs_cstotal.cs_nbfree += cgsum->cs_nbfree;
-		fs->fs_cstotal.cs_nifree += cgsum->cs_nifree;
-		fs->fs_cstotal.cs_ndir += cgsum->cs_ndir;
-	}
-	/* XXX Don't set clean for now, we don't trust the journal. */
-	/* fs->fs_clean = 1; */
-	fs->fs_time = time(NULL);
-	fs->fs_mtime = time(NULL);
-	if (sbwrite(disk, 0) == -1)
-		err(1, "sbwrite(%s)", devnam);
-	if (ufs_disk_close(disk) == -1)
-		err(1, "ufs_disk_close(%s)", devnam);
-	free(disk);
-	disk = NULL;
-	fs = NULL;
-	fsreadfd = -1;
-	fswritefd = -1;
-}
-
-/*
- * Lookup a cg by number in the hash so we can keep track of which cgs
- * need stats rebuilt.
- */
-static struct suj_cg *
-cg_lookup(int cgx)
-{
-	struct cghd *hd;
-	struct suj_cg *sc;
-
-	if (cgx < 0 || cgx >= fs->fs_ncg) {
-		abort();
-		errx(1, "Bad cg number %d", cgx);
-	}
-	hd = &cghash[SUJ_HASH(cgx)];
-	LIST_FOREACH(sc, hd, sc_next)
-		if (sc->sc_cgx == cgx)
-			return (sc);
-	sc = errmalloc(sizeof(*sc));
-	bzero(sc, sizeof(*sc));
-	sc->sc_cgbuf = errmalloc(fs->fs_bsize);
-	sc->sc_cgp = (struct cg *)sc->sc_cgbuf;
-	sc->sc_cgx = cgx;
-	LIST_INSERT_HEAD(hd, sc, sc_next);
-	if (bread(disk, fsbtodb(fs, cgtod(fs, sc->sc_cgx)), sc->sc_cgbuf,
-	    fs->fs_bsize) == -1)
-		err(1, "Unable to read cylinder group %d", sc->sc_cgx);
-
-	return (sc);
-}
-
-/*
- * Lookup an inode number in the hash and allocate a suj_ino if it does
- * not exist.
- */
-static struct suj_ino *
-ino_lookup(ino_t ino, int creat)
-{
-	struct suj_ino *sino;
-	struct inohd *hd;
-	struct suj_cg *sc;
-
-	sc = cg_lookup(ino_to_cg(fs, ino));
-	hd = &sc->sc_inohash[SUJ_HASH(ino)];
-	LIST_FOREACH(sino, hd, si_next)
-		if (sino->si_ino == ino)
-			return (sino);
-	if (creat == 0)
-		return (NULL);
-	sino = errmalloc(sizeof(*sino));
-	bzero(sino, sizeof(*sino));
-	sino->si_ino = ino;
-	sino->si_nlinkadj = 0;
-	TAILQ_INIT(&sino->si_recs);
-	TAILQ_INIT(&sino->si_movs);
-	LIST_INSERT_HEAD(hd, sino, si_next);
-
-	return (sino);
-}
-
-/*
- * Lookup a block number in the hash and allocate a suj_blk if it does
- * not exist.
- */
-static struct suj_blk *
-blk_lookup(ufs2_daddr_t blk, int creat)
-{
-	struct suj_blk *sblk;
-	struct suj_cg *sc;
-	struct blkhd *hd;
-
-	sc = cg_lookup(dtog(fs, blk));
-	hd = &sc->sc_blkhash[SUJ_HASH(blk)];
-	LIST_FOREACH(sblk, hd, sb_next)
-		if (sblk->sb_blk == blk)
-			return (sblk);
-	if (creat == 0)
-		return (NULL);
-	sblk = errmalloc(sizeof(*sblk));
-	bzero(sblk, sizeof(*sblk));
-	sblk->sb_blk = blk;
-	TAILQ_INIT(&sblk->sb_recs);
-	LIST_INSERT_HEAD(hd, sblk, sb_next);
-
-	return (sblk);
-}
-
-static uint8_t *
-dblk_read(ufs2_daddr_t blk, int size)
-{
-	struct data_blk *dblk;
-	struct dblkhd *hd;
-
-	hd = &dbhash[SUJ_HASH(blk)];
-	LIST_FOREACH(dblk, hd, db_next)
-		if (dblk->db_blk == blk)
-			goto found;
-	/*
-	 * The inode block wasn't located, allocate a new one.
-	 */
-	dblk = errmalloc(sizeof(*dblk));
-	bzero(dblk, sizeof(*dblk));
-	LIST_INSERT_HEAD(hd, dblk, db_next);
-	dblk->db_blk = blk;
-found:
-	/*
-	 * I doubt size mismatches can happen in practice but it is trivial
-	 * to handle.
-	 */
-	if (size != dblk->db_size) {
-		if (dblk->db_buf)
-			free(dblk->db_buf);
-		dblk->db_buf = errmalloc(size);
-		dblk->db_size = size;
-		if (bread(disk, fsbtodb(fs, blk), dblk->db_buf, size) == -1)
-			err(1, "Failed to read data block %jd", blk);
-	}
-	return (dblk->db_buf);
-}
-
-static union dinode *
-ino_read(ino_t ino)
-{
-	struct ino_blk *iblk;
-	struct iblkhd *hd;
-	struct suj_cg *sc;
-	ufs2_daddr_t blk;
-	int off;
-
-	blk = ino_to_fsba(fs, ino);
-	sc = cg_lookup(ino_to_cg(fs, ino));
-	hd = &sc->sc_iblkhash[SUJ_HASH(blk)];
-	LIST_FOREACH(iblk, hd, ib_next)
-		if (iblk->ib_blk == blk)
-			goto found;
-	/*
-	 * The inode block wasn't located, allocate a new one.
-	 */
-	iblk = errmalloc(sizeof(*iblk));
-	bzero(iblk, sizeof(*iblk));
-	iblk->ib_buf = errmalloc(fs->fs_bsize);
-	iblk->ib_blk = blk;
-	LIST_INSERT_HEAD(hd, iblk, ib_next);
-	if (bread(disk, fsbtodb(fs, blk), iblk->ib_buf, fs->fs_bsize) == -1)
-		err(1, "Failed to read inode block %jd", blk);
-found:
-	sc->sc_lastiblk = iblk;
-	off = ino_to_fsbo(fs, ino);
-	if (fs->fs_magic == FS_UFS1_MAGIC)
-		return (union dinode *)&((struct ufs1_dinode *)iblk->ib_buf)[off];
-	else
-		return (union dinode *)&((struct ufs2_dinode *)iblk->ib_buf)[off];
-}
-
-static void
-ino_dirty(ino_t ino)
-{
-	struct ino_blk *iblk;
-	struct iblkhd *hd;
-	struct suj_cg *sc;
-	ufs2_daddr_t blk;
-
-	blk = ino_to_fsba(fs, ino);
-	sc = cg_lookup(ino_to_cg(fs, ino));
-	iblk = sc->sc_lastiblk;
-	if (iblk && iblk->ib_blk == blk) {
-		iblk->ib_dirty = 1;
-		return;
-	}
-	hd = &sc->sc_iblkhash[SUJ_HASH(blk)];
-	LIST_FOREACH(iblk, hd, ib_next) {
-		if (iblk->ib_blk == blk) {
-			iblk->ib_dirty = 1;
-			return;
-		}
-	}
-	ino_read(ino);
-	ino_dirty(ino);
-}
-
-static void
-iblk_write(struct ino_blk *iblk)
-{
-
-	if (iblk->ib_dirty == 0)
-		return;
-	if (bwrite(disk, fsbtodb(fs, iblk->ib_blk), iblk->ib_buf,
-	    fs->fs_bsize) == -1)
-		err(1, "Failed to write inode block %jd", iblk->ib_blk);
-}
-
-/*
- * Return 1 if the inode was free and 0 if it is allocated.
- */
-static int
-ino_isfree(ino_t ino)
-{
-	struct suj_cg *sc;
-	uint8_t *inosused;
-	struct cg *cgp;
-	int cg;
-
-	cg = ino_to_cg(fs, ino);
-	ino = ino % fs->fs_ipg;
-	sc = cg_lookup(cg);
-	cgp = sc->sc_cgp;
-	inosused = cg_inosused(cgp);
-	return isclr(inosused, ino);
-}
-
-static int
-blk_overlaps(struct jblkrec *brec, ufs2_daddr_t start, int frags)
-{
-	ufs2_daddr_t bstart;
-	ufs2_daddr_t bend;
-	ufs2_daddr_t end;
-
-	end = start + frags;
-	bstart = brec->jb_blkno + brec->jb_oldfrags;
-	bend = bstart + brec->jb_frags;
-	if (start < bend && end > bstart)
-		return (1);
-	return (0);
-}
-
-static int
-blk_equals(struct jblkrec *brec, ino_t ino, ufs_lbn_t lbn, ufs2_daddr_t start,
-    int frags)
-{
-
-	if (brec->jb_ino != ino || brec->jb_lbn != lbn)
-		return (0);
-	if (brec->jb_blkno + brec->jb_oldfrags != start)
-		return (0);
-	if (brec->jb_frags != frags)
-		return (0);
-	return (1);
-}
-
-static void
-blk_setmask(struct jblkrec *brec, int *mask)
-{
-	int i;
-
-	for (i = brec->jb_oldfrags; i < brec->jb_oldfrags + brec->jb_frags; i++)
-		*mask |= 1 << i;
-}
-
-/*
- * Determine whether a given block has been reallocated to a new location.
- * Returns a mask of overlapping bits if any frags have been reused or
- * zero if the block has not been re-used and the contents can be trusted.
- * 
- * This is used to ensure that an orphaned pointer due to truncate is safe
- * to be freed.  The mask value can be used to free partial blocks.
- */
-static int
-blk_isfree(ufs2_daddr_t blk, ino_t ino, ufs_lbn_t lbn, int frags)
-{
-	struct suj_blk *sblk;
-	struct suj_rec *srec;
-	struct jblkrec *brec;
-	int mask;
-	int off;
-
-	/*
-	 * To be certain we're not freeing a reallocated block we lookup
-	 * this block in the blk hash and see if there is an allocation
-	 * journal record that overlaps with any fragments in the block
-	 * we're concerned with.  If any fragments have ben reallocated
-	 * the block has already been freed and re-used for another purpose.
-	 */
-	mask = 0;
-	sblk = blk_lookup(blknum(fs, blk), 0);
-	if (sblk == NULL)
-		return (0);
-	off = blk - sblk->sb_blk;
-	TAILQ_FOREACH(srec, &sblk->sb_recs, sr_next) {
-		brec = (struct jblkrec *)srec->sr_rec;
-		/*
-		 * If the block overlaps but does not match
-		 * exactly it's a new allocation.  If it matches
-		 * exactly this record refers to the current
-		 * location.
-		 */ 
-		if (blk_overlaps(brec, blk, frags) == 0)
-			continue;
-		if (blk_equals(brec, ino, lbn, blk, frags) == 1)
-			mask = 0;
-		else
-			blk_setmask(brec, &mask);
-	}
-	if (debug)
-		printf("blk_isfree: blk %jd sblk %jd off %d mask 0x%X\n",
-		    blk, sblk->sb_blk, off, mask);
-	return (mask >> off);
-}
-
-/*
- * Determine whether it is safe to follow an indirect.  It is not safe
- * if any part of the indirect has been reallocated or the last journal
- * entry was an allocation.  Just allocated indirects may not have valid
- * pointers yet and all of their children will have their own records.
- * 
- * Returns 1 if it's safe to follow the indirect and 0 otherwise.
- */
-static int
-blk_isindir(ufs2_daddr_t blk, ino_t ino, ufs_lbn_t lbn)
-{
-	struct suj_blk *sblk;
-	struct jblkrec *brec;
-
-	sblk = blk_lookup(blk, 0);
-	if (sblk == NULL)
-		return (1);
-	if (TAILQ_EMPTY(&sblk->sb_recs))
-		return (1);
-	brec = (struct jblkrec *)TAILQ_LAST(&sblk->sb_recs, srechd)->sr_rec;
-	if (blk_equals(brec, ino, lbn, blk, fs->fs_frag))
-		if (brec->jb_op == JOP_FREEBLK)
-			return (1);
-	return (0);
-}
-
-/*
- * Clear an inode from the cg bitmap.  If the inode was already clear return
- * 0 so the caller knows it does not have to check the inode contents.
- */
-static int
-ino_free(ino_t ino, int mode)
-{
-	struct suj_cg *sc;
-	uint8_t *inosused;
-	struct cg *cgp;
-	int cg;
-
-	cg = ino_to_cg(fs, ino);
-	ino = ino % fs->fs_ipg;
-	sc = cg_lookup(cg);
-	cgp = sc->sc_cgp;
-	inosused = cg_inosused(cgp);
-	/*
-	 * The bitmap may never have made it to the disk so we have to
-	 * conditionally clear.  We can avoid writing the cg in this case.
-	 */
-	if (isclr(inosused, ino))
-		return (0);
-	freeinos++;
-	clrbit(inosused, ino);
-	if (ino < cgp->cg_irotor)
-		cgp->cg_irotor = ino;
-	cgp->cg_cs.cs_nifree++;
-	if ((mode & IFMT) == IFDIR) {
-		freedir++;
-		cgp->cg_cs.cs_ndir--;
-	}
-	sc->sc_dirty = 1;
-
-	return (1);
-}
-
-/*
- * Free 'frags' frags starting at filesystem block 'bno' skipping any frags
- * set in the mask.
- */
-static void
-blk_free(ufs2_daddr_t bno, int mask, int frags)
-{
-	ufs1_daddr_t fragno, cgbno;
-	struct suj_cg *sc;
-	struct cg *cgp;
-	int i, cg;
-	uint8_t *blksfree;
-
-	if (debug)
-		printf("Freeing %d frags at blk %jd\n", frags, bno);
-	cg = dtog(fs, bno);
-	sc = cg_lookup(cg);
-	cgp = sc->sc_cgp;
-	cgbno = dtogd(fs, bno);
-	blksfree = cg_blksfree(cgp);
-
-	/*
-	 * If it's not allocated we only wrote the journal entry
-	 * and never the bitmaps.  Here we unconditionally clear and
-	 * resolve the cg summary later.
-	 */
-	if (frags == fs->fs_frag && mask == 0) {
-		fragno = fragstoblks(fs, cgbno);
-		ffs_setblock(fs, blksfree, fragno);
-		freeblocks++;
-	} else {
-		/*
-		 * deallocate the fragment
-		 */
-		for (i = 0; i < frags; i++)
-			if ((mask & (1 << i)) == 0 && isclr(blksfree, cgbno +i)) {
-				freefrags++;
-				setbit(blksfree, cgbno + i);
-			}
-	}
-	sc->sc_dirty = 1;
-}
-
-/*
- * Fetch an indirect block to find the block at a given lbn.  The lbn
- * may be negative to fetch a specific indirect block pointer or positive
- * to fetch a specific block.
- */
-static ufs2_daddr_t
-indir_blkatoff(ufs2_daddr_t blk, ino_t ino, ufs_lbn_t cur, ufs_lbn_t lbn, int level)
-{
-	ufs2_daddr_t *bap2;
-	ufs2_daddr_t *bap1;
-	ufs_lbn_t lbnadd;
-	ufs_lbn_t base;
-	int i;
-
-	if (blk == 0)
-		return (0);
-	if (cur == lbn)
-		return (blk);
-	if (level == 0 && lbn < 0) {
-		abort();
-		errx(1, "Invalid lbn %jd", lbn);
-	}
-	bap2 = (void *)dblk_read(blk, fs->fs_bsize);
-	bap1 = (void *)bap2;
-	lbnadd = 1;
-	base = -(cur + level);
-	for (i = level; i > 0; i--)
-		lbnadd *= NINDIR(fs);
-	if (lbn > 0) 
-		i = (lbn - base) / lbnadd;
-	else
-		i = (-lbn - base) / lbnadd;
-	if (i < 0 || i >= NINDIR(fs)) {
-		abort();
-		errx(1, "Invalid indirect index %d produced by lbn %jd",
-		    i, lbn);
-	}
-	if (level == 0)
-		cur = base + (i * lbnadd);
-	else
-		cur = -(base + (i * lbnadd)) - (level - 1);
-	if (fs->fs_magic == FS_UFS1_MAGIC)
-		blk = bap1[i];
-	else
-		blk = bap2[i];
-	if (cur == lbn)
-		return (blk);
-	if (level == 0) {
-		abort();
-		errx(1, "Invalid lbn %jd at level 0", lbn);
-	}
-	return indir_blkatoff(blk, ino, cur, lbn, level - 1);
-}
-
-/*
- * Finds the disk block address at the specified lbn within the inode
- * specified by ip.  This follows the whole tree and honors di_size and
- * di_extsize so it is a true test of reachability.  The lbn may be
- * negative if an extattr or indirect block is requested.
- */
-static ufs2_daddr_t
-ino_blkatoff(union dinode *ip, ino_t ino, ufs_lbn_t lbn, int *frags)
-{
-	ufs_lbn_t tmpval;
-	ufs_lbn_t cur;
-	ufs_lbn_t next;
-	int i;
-
-	/*
-	 * Handle extattr blocks first.
-	 */
-	if (lbn < 0 && lbn >= -NXADDR) {
-		lbn = -1 - lbn;
-		if (lbn > lblkno(fs, ip->dp2.di_extsize - 1))
-			return (0);
-		*frags = numfrags(fs, sblksize(fs, ip->dp2.di_extsize, lbn));
-		return (ip->dp2.di_extb[lbn]);
-	}
-	/*
-	 * And now direct and indirect.  Verify that the lbn does not
-	 * exceed the size required to store the file by asking for
-	 * the lbn of the last byte.  These blocks should be 0 anyway
-	 * so this simply saves the traversal.
-	 */
-	if (lbn > 0 && lbn > lblkno(fs, DIP(ip, di_size) - 1))
-		return (0);
-	if (lbn < 0 && -lbn > lblkno(fs, DIP(ip, di_size) - 1))
-		return (0);
-	if (lbn >= 0 && lbn < NDADDR) {
-		*frags = numfrags(fs, sblksize(fs, DIP(ip, di_size), lbn));
-		return (DIP(ip, di_db[lbn]));
-	}
-	*frags = fs->fs_frag;
-
-	for (i = 0, tmpval = NINDIR(fs), cur = NDADDR; i < NIADDR; i++,
-	    tmpval *= NINDIR(fs), cur = next) {
-		next = cur + tmpval;
-		if (lbn == -cur)
-			return (DIP(ip, di_ib[i]));
-		/*
-		 * Determine whether the lbn in question is within this tree.
-		 */
-		if (lbn < 0 && -lbn >= next)
-			continue;
-		if (lbn > 0 && lbn >= next)
-			continue;
-
-		return indir_blkatoff(DIP(ip, di_ib[i]), ino, -cur - i, lbn, i);
-	}
-	errx(1, "lbn %jd not in ino", lbn);
-}
-
-/*
- * Determine whether a block exists at a particular lbn in an inode.
- * Returns 1 if found, 0 if not.  lbn may be negative for indirects
- * or ext blocks.
- */
-static int
-blk_isat(ino_t ino, ufs_lbn_t lbn, ufs2_daddr_t blk, int *frags)
-{
-	union dinode *ip;
-	ufs2_daddr_t nblk;
-
-	ip = ino_read(ino);
-
-	if (DIP(ip, di_nlink) == 0 || DIP(ip, di_mode) == 0)
-		return (0);
-	nblk = ino_blkatoff(ip, ino, lbn, frags);
-
-	return (nblk == blk);
-}
-
-/*
- * Determines whether a pointer to an inode exists within a directory
- * at a specified offset.  Returns the mode of the found entry.
- */
-static int
-ino_isat(ino_t parent, off_t diroff, ino_t child, int *mode, int *isdot)
-{
-	union dinode *dip;
-	struct direct *dp;
-	ufs2_daddr_t blk;
-	uint8_t *block;
-	ufs_lbn_t lbn;
-	int blksize;
-	int frags;
-	int dpoff;
-	int doff;
-
-	*isdot = 0;
-	dip = ino_read(parent);
-	*mode = DIP(dip, di_mode);
-	if ((*mode & IFMT) != IFDIR) {
-		if (debug) {
-			/* This can happen if the parent inode was reallocated. */
-			if (*mode != 0)
-				printf("Directory %d has bad mode %o\n",
-				    parent, *mode);
-			else
-				printf("Directory %d zero inode\n", parent);
-		}
-		return (0);
-	}
-	lbn = lblkno(fs, diroff);
-	doff = blkoff(fs, diroff);
-	blksize = sblksize(fs, DIP(dip, di_size), lbn);
-	if (diroff + DIRECTSIZ(1) > DIP(dip, di_size) || doff >= blksize) {
-		if (debug)
-			printf("ino %d absent from %d due to offset %jd"
-			    " exceeding size %jd\n",
-			    child, parent, diroff, DIP(dip, di_size));
-		return (0);
-	}
-	blk = ino_blkatoff(dip, parent, lbn, &frags);
-	if (blk <= 0) {
-		if (debug)
-			printf("Sparse directory %d", parent);
-		return (0);
-	}
-	block = dblk_read(blk, blksize);
-	/*
-	 * Walk through the records from the start of the block to be
-	 * certain we hit a valid record and not some junk in the middle
-	 * of a file name.  Stop when we reach or pass the expected offset.
-	 */
-	dpoff = 0;
-	do {
-		dp = (struct direct *)&block[dpoff];
-		if (dpoff == doff)
-			break;
-		if (dp->d_reclen == 0)
-			break;
-		dpoff += dp->d_reclen;
-	} while (dpoff <= doff);
-	if (dpoff > fs->fs_bsize)
-		errx(1, "Corrupt directory block in dir inode %d", parent);
-	/* Not found. */
-	if (dpoff != doff) {
-		if (debug)
-			printf("ino %d not found in %d, lbn %jd, dpoff %d\n",
-			    child, parent, lbn, dpoff);
-		return (0);
-	}
-	/*
-	 * We found the item in question.  Record the mode and whether it's
-	 * a . or .. link for the caller.
-	 */
-	if (dp->d_ino == child) {
-		if (child == parent)
-			*isdot = 1;
-		else if (dp->d_namlen == 2 &&
-		    dp->d_name[0] == '.' && dp->d_name[1] == '.')
-			*isdot = 1;
-		*mode = DTTOIF(dp->d_type);
-		return (1);
-	}
-	if (debug)
-		printf("ino %d doesn't match dirent ino %d in parent %d\n",
-		    child, dp->d_ino, parent);
-	return (0);
-}
-
-#define	VISIT_INDIR	0x0001
-#define	VISIT_EXT	0x0002
-
-/*
- * Read an indirect level which may or may not be linked into an inode.
- */
-static void
-indir_visit(ino_t ino, ufs_lbn_t lbn, ufs2_daddr_t blk, uint64_t *frags,
-    ino_visitor visitor, int flags)
-{
-	ufs2_daddr_t *bap2;
-	ufs1_daddr_t *bap1;
-	ufs_lbn_t lbnadd;
-	ufs2_daddr_t nblk;
-	ufs_lbn_t nlbn;
-	int level;
-	int i;
-
-	/*
-	 * Don't visit indirect blocks with contents we can't trust.  This
-	 * should only happen when indir_visit() is called to complete a
-	 * truncate that never finished and not when a pointer is found via
-	 * an inode.
-	 */
-	if (blk == 0)
-		return;
-	if (blk_isindir(blk, ino, lbn) == 0) {
-		if (debug)
-			printf("blk %jd ino %d lbn %jd is not indir.\n",
-			    blk, ino, lbn);
-		goto out;
-	}
-	level = lbn_level(lbn);
-	if (level == -1) {
-		abort();
-		errx(1, "Invalid level for lbn %jd", lbn);
-	}
-	lbnadd = 1;
-	for (i = level; i > 0; i--)
-		lbnadd *= NINDIR(fs);
-	bap1 = (void *)dblk_read(blk, fs->fs_bsize);
-	bap2 = (void *)bap1;
-	for (i = 0; i < NINDIR(fs); i++) {
-		if (fs->fs_magic == FS_UFS1_MAGIC)
-			nblk = *bap1++;
-		else
-			nblk = *bap2++;
-		if (nblk == 0)
-			continue;
-		if (level == 0) {
-			nlbn = -lbn + i * lbnadd;
-			(*frags) += fs->fs_frag;
-			visitor(ino, nlbn, nblk, fs->fs_frag);
-		} else {
-			nlbn = (lbn + 1) - (i * lbnadd);
-			indir_visit(ino, nlbn, nblk, frags, visitor, flags);
-		}
-	}
-out:
-	if (flags & VISIT_INDIR) {
-		(*frags) += fs->fs_frag;
-		visitor(ino, lbn, blk, fs->fs_frag);
-	}
-}
-
-/*
- * Visit each block in an inode as specified by 'flags' and call a
- * callback function.  The callback may inspect or free blocks.  The
- * count of frags found according to the size in the file is returned.
- * This is not valid for sparse files but may be used to determine
- * the correct di_blocks for a file.
- */
-static uint64_t
-ino_visit(union dinode *ip, ino_t ino, ino_visitor visitor, int flags)
-{
-	ufs_lbn_t tmpval;
-	ufs_lbn_t lbn;
-	uint64_t size;
-	uint64_t fragcnt;
-	int mode;
-	int frags;
-	int i;
-
-	size = DIP(ip, di_size);
-	mode = DIP(ip, di_mode) & IFMT;
-	fragcnt = 0;
-	if ((flags & VISIT_EXT) &&
-	    fs->fs_magic == FS_UFS2_MAGIC && ip->dp2.di_extsize) {
-		for (i = 0; i < NXADDR; i++) {
-			if (ip->dp2.di_extb[i] == 0)
-				continue;
-			frags = sblksize(fs, ip->dp2.di_extsize, i);
-			frags = numfrags(fs, frags);
-			fragcnt += frags;
-			visitor(ino, -1 - i, ip->dp2.di_extb[i], frags);
-		}
-	}
-	/* Skip datablocks for short links and devices. */
-	if (mode == IFBLK || mode == IFCHR ||
-	    (mode == IFLNK && size < fs->fs_maxsymlinklen))
-		return (fragcnt);
-	for (i = 0; i < NDADDR; i++) {
-		if (DIP(ip, di_db[i]) == 0)
-			continue;
-		frags = sblksize(fs, size, i);
-		frags = numfrags(fs, frags);
-		fragcnt += frags;
-		visitor(ino, i, DIP(ip, di_db[i]), frags);
-	}
-	for (i = 0, tmpval = NINDIR(fs), lbn = NDADDR; i < NIADDR; i++,
-	    tmpval *= NINDIR(fs), lbn += tmpval) {
-		if (DIP(ip, di_ib[i]) == 0)
-			continue;
-		indir_visit(ino, -lbn - i, DIP(ip, di_ib[i]), &fragcnt, visitor,
-		    flags);
-	}
-	return (fragcnt);
-}
-
-/*
- * Null visitor function used when we just want to count blocks.
- */
-static void
-null_visit(ino_t ino, ufs_lbn_t lbn, ufs2_daddr_t blk, int frags)
-{
-}
-
-/*
- * Recalculate di_blocks when we discover that a block allocation or
- * free was not successfully completed.  The kernel does not roll this back
- * because it would be too expensive to compute which indirects were
- * reachable at the time the inode was written.
- */
-static void
-ino_adjblks(ino_t ino)
-{
-	struct suj_ino *sino;
-	union dinode *ip;
-	uint64_t blocks;
-	uint64_t frags;
-
-	sino = ino_lookup(ino, 1);
-	if (sino->si_blkadj)
-		return;
-	sino->si_blkadj = 1;
-	ip = ino_read(ino);
-	/* No need to adjust zero'd inodes. */
-	if (DIP(ip, di_mode) == 0)
-		return;
-	frags = ino_visit(ip, ino, null_visit, VISIT_INDIR | VISIT_EXT);
-	blocks = fsbtodb(fs, frags);
-	if (blocks == DIP(ip, di_blocks))
-		return;
-	if (debug)
-		printf("ino %d adjusting block count from %jd to %jd\n",
-		    ino, DIP(ip, di_blocks), blocks);
-	DIP_SET(ip, di_blocks, blocks);
-	ino_dirty(ino);
-}
-
-static void
-blk_free_visit(ino_t ino, ufs_lbn_t lbn, ufs2_daddr_t blk, int frags)
-{
-	int mask;

*** DIFF OUTPUT TRUNCATED AT 1000 LINES ***

From owner-svn-src-head@FreeBSD.ORG  Sat Apr 24 07:59:45 2010
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 7B0D81065687;
	Sat, 24 Apr 2010 07:59:45 +0000 (UTC)
	(envelope-from jeff@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 528BD8FC1E;
	Sat, 24 Apr 2010 07:59:45 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o3O7xjTt067536;
	Sat, 24 Apr 2010 07:59:45 GMT (envelope-from jeff@svn.freebsd.org)
Received: (from jeff@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o3O7xjhZ067534;
	Sat, 24 Apr 2010 07:59:45 GMT (envelope-from jeff@svn.freebsd.org)
Message-Id: <201004240759.o3O7xjhZ067534@svn.freebsd.org>
From: Jeff Roberson 
Date: Sat, 24 Apr 2010 07:59:45 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r207145 - head/sbin/tunefs
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Sat, 24 Apr 2010 07:59:45 -0000

Author: jeff
Date: Sat Apr 24 07:59:45 2010
New Revision: 207145
URL: http://svn.freebsd.org/changeset/base/207145

Log:
   - Temporarily lower WARNS until I fix alignment warnings on sparc64.
  
  Reported by:	Florian Smeets

Modified:
  head/sbin/tunefs/Makefile

Modified: head/sbin/tunefs/Makefile
==============================================================================
--- head/sbin/tunefs/Makefile	Sat Apr 24 07:58:59 2010	(r207144)
+++ head/sbin/tunefs/Makefile	Sat Apr 24 07:59:45 2010	(r207145)
@@ -6,4 +6,6 @@ DPADD=	${LIBUFS}
 LDADD=	-lufs
 MAN=	tunefs.8
 
+WARNS=	3
+
 .include 

From owner-svn-src-head@FreeBSD.ORG  Sat Apr 24 09:02:52 2010
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 723BB106566B;
	Sat, 24 Apr 2010 09:02:52 +0000 (UTC)
	(envelope-from jroberson@jroberson.net)
Received: from mail-pw0-f54.google.com (mail-pw0-f54.google.com
	[209.85.160.54])
	by mx1.freebsd.org (Postfix) with ESMTP id 4A0F38FC17;
	Sat, 24 Apr 2010 09:02:52 +0000 (UTC)
Received: by pwi9 with SMTP id 9so7671297pwi.13
	for ; Sat, 24 Apr 2010 02:02:51 -0700 (PDT)
Received: by 10.141.124.4 with SMTP id b4mr1282840rvn.41.1272098445237;
	Sat, 24 Apr 2010 01:40:45 -0700 (PDT)
Received: from [10.0.1.198] (udp022762uds.hawaiiantel.net [72.234.79.107])
	by mx.google.com with ESMTPS id h11sm768861rvm.9.2010.04.24.01.40.42
	(version=SSLv3 cipher=RC4-MD5); Sat, 24 Apr 2010 01:40:44 -0700 (PDT)
Date: Fri, 23 Apr 2010 22:40:45 -1000 (HST)
From: Jeff Roberson 
X-X-Sender: jroberson@desktop
To: Pawel Jakub Dawidek 
In-Reply-To: <201004240758.o3O7wxZA067332@svn.freebsd.org>
Message-ID: 
References: <201004240758.o3O7wxZA067332@svn.freebsd.org>
User-Agent: Alpine 2.00 (BSF 1167 2008-08-23)
MIME-Version: 1.0
Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed
Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org,
	src-committers@freebsd.org
Subject: Re: svn commit: r207144 - head/sbin/fsck_ffs
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Sat, 24 Apr 2010 09:02:52 -0000

On Sat, 24 Apr 2010, Pawel Jakub Dawidek wrote:

> Author: pjd
> Date: Sat Apr 24 07:58:59 2010
> New Revision: 207144
> URL: http://svn.freebsd.org/changeset/base/207144
>
> Log:
>  suj.c seems to contain two versions of the code.
>  Remove the one that doesn't compile.

Thanks pjd.  I must've patched twice and not noticed.  When I tried to 
just merge the changes from my projects branch it failed.

Jeff

>
> Modified:
>  head/sbin/fsck_ffs/suj.c
>
> Modified: head/sbin/fsck_ffs/suj.c
> ==============================================================================
> --- head/sbin/fsck_ffs/suj.c	Sat Apr 24 07:54:49 2010	(r207143)
> +++ head/sbin/fsck_ffs/suj.c	Sat Apr 24 07:58:59 2010	(r207144)
> @@ -2632,2068 +2632,3 @@ suj_check(const char *filesys)
>
> 	return (0);
> }
> -/*-
> - * Copyright (c) 2009 Jeffrey W. Roberson 
> - * 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 AUTHORS 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 AUTHORS 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 
> -
> -#include "fsck.h"
> -
> -static void	ino_decr(ino_t);
> -
> -#define	SUJ_HASHSIZE	128
> -#define	SUJ_HASHMASK	(SUJ_HASHSIZE - 1)
> -#define	SUJ_HASH(x)	((x * 2654435761) & SUJ_HASHMASK)
> -
> -struct suj_seg {
> -	TAILQ_ENTRY(suj_seg) ss_next;
> -	struct jsegrec	ss_rec;
> -	uint8_t		*ss_blk;
> -};
> -
> -struct suj_rec {
> -	TAILQ_ENTRY(suj_rec) sr_next;
> -	union jrec	*sr_rec;
> -};
> -TAILQ_HEAD(srechd, suj_rec);
> -
> -struct suj_ino {
> -	LIST_ENTRY(suj_ino)	si_next;
> -	struct srechd		si_recs;
> -	struct srechd		si_movs;
> -	ino_t			si_ino;
> -	int			si_nlinkadj;
> -	int			si_skipparent;
> -	int			si_linkadj;
> -	int			si_hasrecs;
> -	int			si_blkadj;
> -};
> -LIST_HEAD(inohd, suj_ino);
> -
> -struct suj_blk {
> -	LIST_ENTRY(suj_blk)	sb_next;
> -	struct srechd		sb_recs;
> -	ufs2_daddr_t		sb_blk;
> -};
> -LIST_HEAD(blkhd, suj_blk);
> -
> -struct data_blk {
> -	LIST_ENTRY(data_blk)	db_next;
> -	uint8_t			*db_buf;
> -	ufs2_daddr_t		db_blk;
> -	int			db_size;
> -};
> -
> -struct ino_blk {
> -	LIST_ENTRY(ino_blk)	ib_next;
> -	uint8_t			*ib_buf;
> -	int			ib_dirty;
> -	ufs2_daddr_t		ib_blk;
> -};
> -LIST_HEAD(iblkhd, ino_blk);
> -
> -struct suj_cg {
> -	LIST_ENTRY(suj_cg)	sc_next;
> -	struct blkhd		sc_blkhash[SUJ_HASHSIZE];
> -	struct inohd		sc_inohash[SUJ_HASHSIZE];
> -	struct iblkhd		sc_iblkhash[SUJ_HASHSIZE];
> -	struct ino_blk		*sc_lastiblk;
> -	uint8_t			*sc_cgbuf;
> -	struct cg		*sc_cgp;
> -	int			sc_dirty;
> -	int			sc_cgx;
> -};
> -
> -LIST_HEAD(cghd, suj_cg) cghash[SUJ_HASHSIZE];
> -LIST_HEAD(dblkhd, data_blk) dbhash[SUJ_HASHSIZE];
> -
> -TAILQ_HEAD(seghd, suj_seg) allsegs;
> -uint64_t oldseq;
> -static struct uufsd *disk = NULL;
> -static struct fs *fs = NULL;
> -
> -/*
> - * Summary statistics.
> - */
> -uint64_t freefrags;
> -uint64_t freeblocks;
> -uint64_t freeinos;
> -uint64_t freedir;
> -uint64_t jbytes;
> -uint64_t jrecs;
> -
> -typedef void (*ino_visitor)(ino_t, ufs_lbn_t, ufs2_daddr_t, int);
> -
> -static void *
> -errmalloc(size_t n)
> -{
> -	void *a;
> -
> -	a = malloc(n);
> -	if (a == NULL)
> -		errx(1, "malloc(%zu)", n);
> -	return (a);
> -}
> -
> -/*
> - * Open the given provider, load superblock.
> - */
> -static void
> -opendisk(const char *devnam)
> -{
> -	if (disk != NULL)
> -		return;
> -	disk = malloc(sizeof(*disk));
> -	if (disk == NULL)
> -		errx(1, "malloc(%zu)", sizeof(*disk));
> -	if (ufs_disk_fillout(disk, devnam) == -1) {
> -		err(1, "ufs_disk_fillout(%s) failed: %s", devnam,
> -		    disk->d_error);
> -	}
> -	fs = &disk->d_fs;
> -	/*
> -	 * Setup a few things so reply() can work.
> -	 */
> -	bcopy(fs, &sblock, sizeof(sblock));
> -	fsreadfd = disk->d_fd;
> -	fswritefd = disk->d_fd;
> -}
> -
> -/*
> - * Mark file system as clean, write the super-block back, close the disk.
> - */
> -static void
> -closedisk(const char *devnam)
> -{
> -	struct csum *cgsum;
> -	int i;
> -
> -	/*
> -	 * Recompute the fs summary info from correct cs summaries.
> -	 */
> -	bzero(&fs->fs_cstotal, sizeof(struct csum_total));
> -	for (i = 0; i < fs->fs_ncg; i++) {
> -		cgsum = &fs->fs_cs(fs, i);
> -		fs->fs_cstotal.cs_nffree += cgsum->cs_nffree;
> -		fs->fs_cstotal.cs_nbfree += cgsum->cs_nbfree;
> -		fs->fs_cstotal.cs_nifree += cgsum->cs_nifree;
> -		fs->fs_cstotal.cs_ndir += cgsum->cs_ndir;
> -	}
> -	/* XXX Don't set clean for now, we don't trust the journal. */
> -	/* fs->fs_clean = 1; */
> -	fs->fs_time = time(NULL);
> -	fs->fs_mtime = time(NULL);
> -	if (sbwrite(disk, 0) == -1)
> -		err(1, "sbwrite(%s)", devnam);
> -	if (ufs_disk_close(disk) == -1)
> -		err(1, "ufs_disk_close(%s)", devnam);
> -	free(disk);
> -	disk = NULL;
> -	fs = NULL;
> -	fsreadfd = -1;
> -	fswritefd = -1;
> -}
> -
> -/*
> - * Lookup a cg by number in the hash so we can keep track of which cgs
> - * need stats rebuilt.
> - */
> -static struct suj_cg *
> -cg_lookup(int cgx)
> -{
> -	struct cghd *hd;
> -	struct suj_cg *sc;
> -
> -	if (cgx < 0 || cgx >= fs->fs_ncg) {
> -		abort();
> -		errx(1, "Bad cg number %d", cgx);
> -	}
> -	hd = &cghash[SUJ_HASH(cgx)];
> -	LIST_FOREACH(sc, hd, sc_next)
> -		if (sc->sc_cgx == cgx)
> -			return (sc);
> -	sc = errmalloc(sizeof(*sc));
> -	bzero(sc, sizeof(*sc));
> -	sc->sc_cgbuf = errmalloc(fs->fs_bsize);
> -	sc->sc_cgp = (struct cg *)sc->sc_cgbuf;
> -	sc->sc_cgx = cgx;
> -	LIST_INSERT_HEAD(hd, sc, sc_next);
> -	if (bread(disk, fsbtodb(fs, cgtod(fs, sc->sc_cgx)), sc->sc_cgbuf,
> -	    fs->fs_bsize) == -1)
> -		err(1, "Unable to read cylinder group %d", sc->sc_cgx);
> -
> -	return (sc);
> -}
> -
> -/*
> - * Lookup an inode number in the hash and allocate a suj_ino if it does
> - * not exist.
> - */
> -static struct suj_ino *
> -ino_lookup(ino_t ino, int creat)
> -{
> -	struct suj_ino *sino;
> -	struct inohd *hd;
> -	struct suj_cg *sc;
> -
> -	sc = cg_lookup(ino_to_cg(fs, ino));
> -	hd = &sc->sc_inohash[SUJ_HASH(ino)];
> -	LIST_FOREACH(sino, hd, si_next)
> -		if (sino->si_ino == ino)
> -			return (sino);
> -	if (creat == 0)
> -		return (NULL);
> -	sino = errmalloc(sizeof(*sino));
> -	bzero(sino, sizeof(*sino));
> -	sino->si_ino = ino;
> -	sino->si_nlinkadj = 0;
> -	TAILQ_INIT(&sino->si_recs);
> -	TAILQ_INIT(&sino->si_movs);
> -	LIST_INSERT_HEAD(hd, sino, si_next);
> -
> -	return (sino);
> -}
> -
> -/*
> - * Lookup a block number in the hash and allocate a suj_blk if it does
> - * not exist.
> - */
> -static struct suj_blk *
> -blk_lookup(ufs2_daddr_t blk, int creat)
> -{
> -	struct suj_blk *sblk;
> -	struct suj_cg *sc;
> -	struct blkhd *hd;
> -
> -	sc = cg_lookup(dtog(fs, blk));
> -	hd = &sc->sc_blkhash[SUJ_HASH(blk)];
> -	LIST_FOREACH(sblk, hd, sb_next)
> -		if (sblk->sb_blk == blk)
> -			return (sblk);
> -	if (creat == 0)
> -		return (NULL);
> -	sblk = errmalloc(sizeof(*sblk));
> -	bzero(sblk, sizeof(*sblk));
> -	sblk->sb_blk = blk;
> -	TAILQ_INIT(&sblk->sb_recs);
> -	LIST_INSERT_HEAD(hd, sblk, sb_next);
> -
> -	return (sblk);
> -}
> -
> -static uint8_t *
> -dblk_read(ufs2_daddr_t blk, int size)
> -{
> -	struct data_blk *dblk;
> -	struct dblkhd *hd;
> -
> -	hd = &dbhash[SUJ_HASH(blk)];
> -	LIST_FOREACH(dblk, hd, db_next)
> -		if (dblk->db_blk == blk)
> -			goto found;
> -	/*
> -	 * The inode block wasn't located, allocate a new one.
> -	 */
> -	dblk = errmalloc(sizeof(*dblk));
> -	bzero(dblk, sizeof(*dblk));
> -	LIST_INSERT_HEAD(hd, dblk, db_next);
> -	dblk->db_blk = blk;
> -found:
> -	/*
> -	 * I doubt size mismatches can happen in practice but it is trivial
> -	 * to handle.
> -	 */
> -	if (size != dblk->db_size) {
> -		if (dblk->db_buf)
> -			free(dblk->db_buf);
> -		dblk->db_buf = errmalloc(size);
> -		dblk->db_size = size;
> -		if (bread(disk, fsbtodb(fs, blk), dblk->db_buf, size) == -1)
> -			err(1, "Failed to read data block %jd", blk);
> -	}
> -	return (dblk->db_buf);
> -}
> -
> -static union dinode *
> -ino_read(ino_t ino)
> -{
> -	struct ino_blk *iblk;
> -	struct iblkhd *hd;
> -	struct suj_cg *sc;
> -	ufs2_daddr_t blk;
> -	int off;
> -
> -	blk = ino_to_fsba(fs, ino);
> -	sc = cg_lookup(ino_to_cg(fs, ino));
> -	hd = &sc->sc_iblkhash[SUJ_HASH(blk)];
> -	LIST_FOREACH(iblk, hd, ib_next)
> -		if (iblk->ib_blk == blk)
> -			goto found;
> -	/*
> -	 * The inode block wasn't located, allocate a new one.
> -	 */
> -	iblk = errmalloc(sizeof(*iblk));
> -	bzero(iblk, sizeof(*iblk));
> -	iblk->ib_buf = errmalloc(fs->fs_bsize);
> -	iblk->ib_blk = blk;
> -	LIST_INSERT_HEAD(hd, iblk, ib_next);
> -	if (bread(disk, fsbtodb(fs, blk), iblk->ib_buf, fs->fs_bsize) == -1)
> -		err(1, "Failed to read inode block %jd", blk);
> -found:
> -	sc->sc_lastiblk = iblk;
> -	off = ino_to_fsbo(fs, ino);
> -	if (fs->fs_magic == FS_UFS1_MAGIC)
> -		return (union dinode *)&((struct ufs1_dinode *)iblk->ib_buf)[off];
> -	else
> -		return (union dinode *)&((struct ufs2_dinode *)iblk->ib_buf)[off];
> -}
> -
> -static void
> -ino_dirty(ino_t ino)
> -{
> -	struct ino_blk *iblk;
> -	struct iblkhd *hd;
> -	struct suj_cg *sc;
> -	ufs2_daddr_t blk;
> -
> -	blk = ino_to_fsba(fs, ino);
> -	sc = cg_lookup(ino_to_cg(fs, ino));
> -	iblk = sc->sc_lastiblk;
> -	if (iblk && iblk->ib_blk == blk) {
> -		iblk->ib_dirty = 1;
> -		return;
> -	}
> -	hd = &sc->sc_iblkhash[SUJ_HASH(blk)];
> -	LIST_FOREACH(iblk, hd, ib_next) {
> -		if (iblk->ib_blk == blk) {
> -			iblk->ib_dirty = 1;
> -			return;
> -		}
> -	}
> -	ino_read(ino);
> -	ino_dirty(ino);
> -}
> -
> -static void
> -iblk_write(struct ino_blk *iblk)
> -{
> -
> -	if (iblk->ib_dirty == 0)
> -		return;
> -	if (bwrite(disk, fsbtodb(fs, iblk->ib_blk), iblk->ib_buf,
> -	    fs->fs_bsize) == -1)
> -		err(1, "Failed to write inode block %jd", iblk->ib_blk);
> -}
> -
> -/*
> - * Return 1 if the inode was free and 0 if it is allocated.
> - */
> -static int
> -ino_isfree(ino_t ino)
> -{
> -	struct suj_cg *sc;
> -	uint8_t *inosused;
> -	struct cg *cgp;
> -	int cg;
> -
> -	cg = ino_to_cg(fs, ino);
> -	ino = ino % fs->fs_ipg;
> -	sc = cg_lookup(cg);
> -	cgp = sc->sc_cgp;
> -	inosused = cg_inosused(cgp);
> -	return isclr(inosused, ino);
> -}
> -
> -static int
> -blk_overlaps(struct jblkrec *brec, ufs2_daddr_t start, int frags)
> -{
> -	ufs2_daddr_t bstart;
> -	ufs2_daddr_t bend;
> -	ufs2_daddr_t end;
> -
> -	end = start + frags;
> -	bstart = brec->jb_blkno + brec->jb_oldfrags;
> -	bend = bstart + brec->jb_frags;
> -	if (start < bend && end > bstart)
> -		return (1);
> -	return (0);
> -}
> -
> -static int
> -blk_equals(struct jblkrec *brec, ino_t ino, ufs_lbn_t lbn, ufs2_daddr_t start,
> -    int frags)
> -{
> -
> -	if (brec->jb_ino != ino || brec->jb_lbn != lbn)
> -		return (0);
> -	if (brec->jb_blkno + brec->jb_oldfrags != start)
> -		return (0);
> -	if (brec->jb_frags != frags)
> -		return (0);
> -	return (1);
> -}
> -
> -static void
> -blk_setmask(struct jblkrec *brec, int *mask)
> -{
> -	int i;
> -
> -	for (i = brec->jb_oldfrags; i < brec->jb_oldfrags + brec->jb_frags; i++)
> -		*mask |= 1 << i;
> -}
> -
> -/*
> - * Determine whether a given block has been reallocated to a new location.
> - * Returns a mask of overlapping bits if any frags have been reused or
> - * zero if the block has not been re-used and the contents can be trusted.
> - *
> - * This is used to ensure that an orphaned pointer due to truncate is safe
> - * to be freed.  The mask value can be used to free partial blocks.
> - */
> -static int
> -blk_isfree(ufs2_daddr_t blk, ino_t ino, ufs_lbn_t lbn, int frags)
> -{
> -	struct suj_blk *sblk;
> -	struct suj_rec *srec;
> -	struct jblkrec *brec;
> -	int mask;
> -	int off;
> -
> -	/*
> -	 * To be certain we're not freeing a reallocated block we lookup
> -	 * this block in the blk hash and see if there is an allocation
> -	 * journal record that overlaps with any fragments in the block
> -	 * we're concerned with.  If any fragments have ben reallocated
> -	 * the block has already been freed and re-used for another purpose.
> -	 */
> -	mask = 0;
> -	sblk = blk_lookup(blknum(fs, blk), 0);
> -	if (sblk == NULL)
> -		return (0);
> -	off = blk - sblk->sb_blk;
> -	TAILQ_FOREACH(srec, &sblk->sb_recs, sr_next) {
> -		brec = (struct jblkrec *)srec->sr_rec;
> -		/*
> -		 * If the block overlaps but does not match
> -		 * exactly it's a new allocation.  If it matches
> -		 * exactly this record refers to the current
> -		 * location.
> -		 */
> -		if (blk_overlaps(brec, blk, frags) == 0)
> -			continue;
> -		if (blk_equals(brec, ino, lbn, blk, frags) == 1)
> -			mask = 0;
> -		else
> -			blk_setmask(brec, &mask);
> -	}
> -	if (debug)
> -		printf("blk_isfree: blk %jd sblk %jd off %d mask 0x%X\n",
> -		    blk, sblk->sb_blk, off, mask);
> -	return (mask >> off);
> -}
> -
> -/*
> - * Determine whether it is safe to follow an indirect.  It is not safe
> - * if any part of the indirect has been reallocated or the last journal
> - * entry was an allocation.  Just allocated indirects may not have valid
> - * pointers yet and all of their children will have their own records.
> - *
> - * Returns 1 if it's safe to follow the indirect and 0 otherwise.
> - */
> -static int
> -blk_isindir(ufs2_daddr_t blk, ino_t ino, ufs_lbn_t lbn)
> -{
> -	struct suj_blk *sblk;
> -	struct jblkrec *brec;
> -
> -	sblk = blk_lookup(blk, 0);
> -	if (sblk == NULL)
> -		return (1);
> -	if (TAILQ_EMPTY(&sblk->sb_recs))
> -		return (1);
> -	brec = (struct jblkrec *)TAILQ_LAST(&sblk->sb_recs, srechd)->sr_rec;
> -	if (blk_equals(brec, ino, lbn, blk, fs->fs_frag))
> -		if (brec->jb_op == JOP_FREEBLK)
> -			return (1);
> -	return (0);
> -}
> -
> -/*
> - * Clear an inode from the cg bitmap.  If the inode was already clear return
> - * 0 so the caller knows it does not have to check the inode contents.
> - */
> -static int
> -ino_free(ino_t ino, int mode)
> -{
> -	struct suj_cg *sc;
> -	uint8_t *inosused;
> -	struct cg *cgp;
> -	int cg;
> -
> -	cg = ino_to_cg(fs, ino);
> -	ino = ino % fs->fs_ipg;
> -	sc = cg_lookup(cg);
> -	cgp = sc->sc_cgp;
> -	inosused = cg_inosused(cgp);
> -	/*
> -	 * The bitmap may never have made it to the disk so we have to
> -	 * conditionally clear.  We can avoid writing the cg in this case.
> -	 */
> -	if (isclr(inosused, ino))
> -		return (0);
> -	freeinos++;
> -	clrbit(inosused, ino);
> -	if (ino < cgp->cg_irotor)
> -		cgp->cg_irotor = ino;
> -	cgp->cg_cs.cs_nifree++;
> -	if ((mode & IFMT) == IFDIR) {
> -		freedir++;
> -		cgp->cg_cs.cs_ndir--;
> -	}
> -	sc->sc_dirty = 1;
> -
> -	return (1);
> -}
> -
> -/*
> - * Free 'frags' frags starting at filesystem block 'bno' skipping any frags
> - * set in the mask.
> - */
> -static void
> -blk_free(ufs2_daddr_t bno, int mask, int frags)
> -{
> -	ufs1_daddr_t fragno, cgbno;
> -	struct suj_cg *sc;
> -	struct cg *cgp;
> -	int i, cg;
> -	uint8_t *blksfree;
> -
> -	if (debug)
> -		printf("Freeing %d frags at blk %jd\n", frags, bno);
> -	cg = dtog(fs, bno);
> -	sc = cg_lookup(cg);
> -	cgp = sc->sc_cgp;
> -	cgbno = dtogd(fs, bno);
> -	blksfree = cg_blksfree(cgp);
> -
> -	/*
> -	 * If it's not allocated we only wrote the journal entry
> -	 * and never the bitmaps.  Here we unconditionally clear and
> -	 * resolve the cg summary later.
> -	 */
> -	if (frags == fs->fs_frag && mask == 0) {
> -		fragno = fragstoblks(fs, cgbno);
> -		ffs_setblock(fs, blksfree, fragno);
> -		freeblocks++;
> -	} else {
> -		/*
> -		 * deallocate the fragment
> -		 */
> -		for (i = 0; i < frags; i++)
> -			if ((mask & (1 << i)) == 0 && isclr(blksfree, cgbno +i)) {
> -				freefrags++;
> -				setbit(blksfree, cgbno + i);
> -			}
> -	}
> -	sc->sc_dirty = 1;
> -}
> -
> -/*
> - * Fetch an indirect block to find the block at a given lbn.  The lbn
> - * may be negative to fetch a specific indirect block pointer or positive
> - * to fetch a specific block.
> - */
> -static ufs2_daddr_t
> -indir_blkatoff(ufs2_daddr_t blk, ino_t ino, ufs_lbn_t cur, ufs_lbn_t lbn, int level)
> -{
> -	ufs2_daddr_t *bap2;
> -	ufs2_daddr_t *bap1;
> -	ufs_lbn_t lbnadd;
> -	ufs_lbn_t base;
> -	int i;
> -
> -	if (blk == 0)
> -		return (0);
> -	if (cur == lbn)
> -		return (blk);
> -	if (level == 0 && lbn < 0) {
> -		abort();
> -		errx(1, "Invalid lbn %jd", lbn);
> -	}
> -	bap2 = (void *)dblk_read(blk, fs->fs_bsize);
> -	bap1 = (void *)bap2;
> -	lbnadd = 1;
> -	base = -(cur + level);
> -	for (i = level; i > 0; i--)
> -		lbnadd *= NINDIR(fs);
> -	if (lbn > 0)
> -		i = (lbn - base) / lbnadd;
> -	else
> -		i = (-lbn - base) / lbnadd;
> -	if (i < 0 || i >= NINDIR(fs)) {
> -		abort();
> -		errx(1, "Invalid indirect index %d produced by lbn %jd",
> -		    i, lbn);
> -	}
> -	if (level == 0)
> -		cur = base + (i * lbnadd);
> -	else
> -		cur = -(base + (i * lbnadd)) - (level - 1);
> -	if (fs->fs_magic == FS_UFS1_MAGIC)
> -		blk = bap1[i];
> -	else
> -		blk = bap2[i];
> -	if (cur == lbn)
> -		return (blk);
> -	if (level == 0) {
> -		abort();
> -		errx(1, "Invalid lbn %jd at level 0", lbn);
> -	}
> -	return indir_blkatoff(blk, ino, cur, lbn, level - 1);
> -}
> -
> -/*
> - * Finds the disk block address at the specified lbn within the inode
> - * specified by ip.  This follows the whole tree and honors di_size and
> - * di_extsize so it is a true test of reachability.  The lbn may be
> - * negative if an extattr or indirect block is requested.
> - */
> -static ufs2_daddr_t
> -ino_blkatoff(union dinode *ip, ino_t ino, ufs_lbn_t lbn, int *frags)
> -{
> -	ufs_lbn_t tmpval;
> -	ufs_lbn_t cur;
> -	ufs_lbn_t next;
> -	int i;
> -
> -	/*
> -	 * Handle extattr blocks first.
> -	 */
> -	if (lbn < 0 && lbn >= -NXADDR) {
> -		lbn = -1 - lbn;
> -		if (lbn > lblkno(fs, ip->dp2.di_extsize - 1))
> -			return (0);
> -		*frags = numfrags(fs, sblksize(fs, ip->dp2.di_extsize, lbn));
> -		return (ip->dp2.di_extb[lbn]);
> -	}
> -	/*
> -	 * And now direct and indirect.  Verify that the lbn does not
> -	 * exceed the size required to store the file by asking for
> -	 * the lbn of the last byte.  These blocks should be 0 anyway
> -	 * so this simply saves the traversal.
> -	 */
> -	if (lbn > 0 && lbn > lblkno(fs, DIP(ip, di_size) - 1))
> -		return (0);
> -	if (lbn < 0 && -lbn > lblkno(fs, DIP(ip, di_size) - 1))
> -		return (0);
> -	if (lbn >= 0 && lbn < NDADDR) {
> -		*frags = numfrags(fs, sblksize(fs, DIP(ip, di_size), lbn));
> -		return (DIP(ip, di_db[lbn]));
> -	}
> -	*frags = fs->fs_frag;
> -
> -	for (i = 0, tmpval = NINDIR(fs), cur = NDADDR; i < NIADDR; i++,
> -	    tmpval *= NINDIR(fs), cur = next) {
> -		next = cur + tmpval;
> -		if (lbn == -cur)
> -			return (DIP(ip, di_ib[i]));
> -		/*
> -		 * Determine whether the lbn in question is within this tree.
> -		 */
> -		if (lbn < 0 && -lbn >= next)
> -			continue;
> -		if (lbn > 0 && lbn >= next)
> -			continue;
> -
> -		return indir_blkatoff(DIP(ip, di_ib[i]), ino, -cur - i, lbn, i);
> -	}
> -	errx(1, "lbn %jd not in ino", lbn);
> -}
> -
> -/*
> - * Determine whether a block exists at a particular lbn in an inode.
> - * Returns 1 if found, 0 if not.  lbn may be negative for indirects
> - * or ext blocks.
> - */
> -static int
> -blk_isat(ino_t ino, ufs_lbn_t lbn, ufs2_daddr_t blk, int *frags)
> -{
> -	union dinode *ip;
> -	ufs2_daddr_t nblk;
> -
> -	ip = ino_read(ino);
> -
> -	if (DIP(ip, di_nlink) == 0 || DIP(ip, di_mode) == 0)
> -		return (0);
> -	nblk = ino_blkatoff(ip, ino, lbn, frags);
> -
> -	return (nblk == blk);
> -}
> -
> -/*
> - * Determines whether a pointer to an inode exists within a directory
> - * at a specified offset.  Returns the mode of the found entry.
> - */
> -static int
> -ino_isat(ino_t parent, off_t diroff, ino_t child, int *mode, int *isdot)
> -{
> -	union dinode *dip;
> -	struct direct *dp;
> -	ufs2_daddr_t blk;
> -	uint8_t *block;
> -	ufs_lbn_t lbn;
> -	int blksize;
> -	int frags;
> -	int dpoff;
> -	int doff;
> -
> -	*isdot = 0;
> -	dip = ino_read(parent);
> -	*mode = DIP(dip, di_mode);
> -	if ((*mode & IFMT) != IFDIR) {
> -		if (debug) {
> -			/* This can happen if the parent inode was reallocated. */
> -			if (*mode != 0)
> -				printf("Directory %d has bad mode %o\n",
> -				    parent, *mode);
> -			else
> -				printf("Directory %d zero inode\n", parent);
> -		}
> -		return (0);
> -	}
> -	lbn = lblkno(fs, diroff);
> -	doff = blkoff(fs, diroff);
> -	blksize = sblksize(fs, DIP(dip, di_size), lbn);
> -	if (diroff + DIRECTSIZ(1) > DIP(dip, di_size) || doff >= blksize) {
> -		if (debug)
> -			printf("ino %d absent from %d due to offset %jd"
> -			    " exceeding size %jd\n",
> -			    child, parent, diroff, DIP(dip, di_size));
> -		return (0);
> -	}
> -	blk = ino_blkatoff(dip, parent, lbn, &frags);
> -	if (blk <= 0) {
> -		if (debug)
> -			printf("Sparse directory %d", parent);
> -		return (0);
> -	}
> -	block = dblk_read(blk, blksize);
> -	/*
> -	 * Walk through the records from the start of the block to be
> -	 * certain we hit a valid record and not some junk in the middle
> -	 * of a file name.  Stop when we reach or pass the expected offset.
> -	 */
> -	dpoff = 0;
> -	do {
> -		dp = (struct direct *)&block[dpoff];
> -		if (dpoff == doff)
> -			break;
> -		if (dp->d_reclen == 0)
> -			break;
> -		dpoff += dp->d_reclen;
> -	} while (dpoff <= doff);
> -	if (dpoff > fs->fs_bsize)
> -		errx(1, "Corrupt directory block in dir inode %d", parent);
> -	/* Not found. */
> -	if (dpoff != doff) {
> -		if (debug)
> -			printf("ino %d not found in %d, lbn %jd, dpoff %d\n",
> -			    child, parent, lbn, dpoff);
> -		return (0);
> -	}
> -	/*
> -	 * We found the item in question.  Record the mode and whether it's
> -	 * a . or .. link for the caller.
> -	 */
> -	if (dp->d_ino == child) {
> -		if (child == parent)
> -			*isdot = 1;
> -		else if (dp->d_namlen == 2 &&
> -		    dp->d_name[0] == '.' && dp->d_name[1] == '.')
> -			*isdot = 1;
> -		*mode = DTTOIF(dp->d_type);
> -		return (1);
> -	}
> -	if (debug)
> -		printf("ino %d doesn't match dirent ino %d in parent %d\n",
> -		    child, dp->d_ino, parent);
> -	return (0);
> -}
> -
> -#define	VISIT_INDIR	0x0001
> -#define	VISIT_EXT	0x0002
> -
> -/*
> - * Read an indirect level which may or may not be linked into an inode.
> - */
> -static void
> -indir_visit(ino_t ino, ufs_lbn_t lbn, ufs2_daddr_t blk, uint64_t *frags,
> -    ino_visitor visitor, int flags)
> -{
> -	ufs2_daddr_t *bap2;
> -	ufs1_daddr_t *bap1;
> -	ufs_lbn_t lbnadd;
> -	ufs2_daddr_t nblk;
> -	ufs_lbn_t nlbn;
> -	int level;
> -	int i;
> -
> -	/*
> -	 * Don't visit indirect blocks with contents we can't trust.  This
> -	 * should only happen when indir_visit() is called to complete a
> -	 * truncate that never finished and not when a pointer is found via
> -	 * an inode.
> -	 */
> -	if (blk == 0)
> -		return;
> -	if (blk_isindir(blk, ino, lbn) == 0) {
> -		if (debug)
> -			printf("blk %jd ino %d lbn %jd is not indir.\n",
> -			    blk, ino, lbn);
> -		goto out;
> -	}
> -	level = lbn_level(lbn);
> -	if (level == -1) {
> -		abort();
> -		errx(1, "Invalid level for lbn %jd", lbn);
> -	}
> -	lbnadd = 1;
> -	for (i = level; i > 0; i--)
> -		lbnadd *= NINDIR(fs);
> -	bap1 = (void *)dblk_read(blk, fs->fs_bsize);
> -	bap2 = (void *)bap1;
> -	for (i = 0; i < NINDIR(fs); i++) {
> -		if (fs->fs_magic == FS_UFS1_MAGIC)
> -			nblk = *bap1++;
> -		else
> -			nblk = *bap2++;
> -		if (nblk == 0)
> -			continue;
> -		if (level == 0) {
> -			nlbn = -lbn + i * lbnadd;
> -			(*frags) += fs->fs_frag;
> -			visitor(ino, nlbn, nblk, fs->fs_frag);
> -		} else {
> -			nlbn = (lbn + 1) - (i * lbnadd);
> -			indir_visit(ino, nlbn, nblk, frags, visitor, flags);
> -		}
> -	}
> -out:
> -	if (flags & VISIT_INDIR) {
> -		(*frags) += fs->fs_frag;
> -		visitor(ino, lbn, blk, fs->fs_frag);
> -	}
> -}
> -
> -/*
> - * Visit each block in an inode as specified by 'flags' and call a
> - * callback function.  The callback may inspect or free blocks.  The
> - * count of frags found according to the size in the file is returned.
> - * This is not valid for sparse files but may be used to determine
> - * the correct di_blocks for a file.
> - */
> -static uint64_t
> -ino_visit(union dinode *ip, ino_t ino, ino_visitor visitor, int flags)
> -{
> -	ufs_lbn_t tmpval;
> -	ufs_lbn_t lbn;
> -	uint64_t size;
> -	uint64_t fragcnt;
> -	int mode;
> -	int frags;
> -	int i;
> -
> -	size = DIP(ip, di_size);
> -	mode = DIP(ip, di_mode) & IFMT;
> -	fragcnt = 0;
> -	if ((flags & VISIT_EXT) &&
> -	    fs->fs_magic == FS_UFS2_MAGIC && ip->dp2.di_extsize) {
> -		for (i = 0; i < NXADDR; i++) {
> -			if (ip->dp2.di_extb[i] == 0)
> -				continue;
> -			frags = sblksize(fs, ip->dp2.di_extsize, i);
> -			frags = numfrags(fs, frags);
> -			fragcnt += frags;
> -			visitor(ino, -1 - i, ip->dp2.di_extb[i], frags);
> -		}
> -	}
> -	/* Skip datablocks for short links and devices. */
> -	if (mode == IFBLK || mode == IFCHR ||
> -	    (mode == IFLNK && size < fs->fs_maxsymlinklen))
> -		return (fragcnt);
> -	for (i = 0; i < NDADDR; i++) {
> -		if (DIP(ip, di_db[i]) == 0)
> -			continue;
> -		frags = sblksize(fs, size, i);
> -		frags = numfrags(fs, frags);
> -		fragcnt += frags;
> -		visitor(ino, i, DIP(ip, di_db[i]), frags);
> -	}
> -	for (i = 0, tmpval = NINDIR(fs), lbn = NDADDR; i < NIADDR; i++,
> -	    tmpval *= NINDIR(fs), lbn += tmpval) {
> -		if (DIP(ip, di_ib[i]) == 0)
> -			continue;
> -		indir_visit(ino, -lbn - i, DIP(ip, di_ib[i]), &fragcnt, visitor,
> -		    flags);
> -	}
> -	return (fragcnt);
> -}
> -
> -/*
> - * Null visitor function used when we just want to count blocks.
> - */
> -static void
> -null_visit(ino_t ino, ufs_lbn_t lbn, ufs2_daddr_t blk, int frags)
> -{
> -}
> -
> -/*
> - * Recalculate di_blocks when we discover that a block allocation or
> - * free was not successfully completed.  The kernel does not roll this back
> - * because it would be too expensive to compute which indirects were
> - * reachable at the time the inode was written.
> - */
> -static void
> -ino_adjblks(ino_t ino)
> -{
> -	struct suj_ino *sino;
> -	union dinode *ip;
> -	uint64_t blocks;
> -	uint64_t frags;
> -
> -	sino = ino_lookup(ino, 1);
> -	if (sino->si_blkadj)
> -		return;
> -	sino->si_blkadj = 1;
> -	ip = ino_read(ino);
> -	/* No need to adjust zero'd inodes. */
> -	if (DIP(ip, di_mode) == 0)
> -		return;
> -	frags = ino_visit(ip, ino, null_visit, VISIT_INDIR | VISIT_EXT);
> -	blocks = fsbtodb(fs, frags);
> -	if (blocks == DIP(ip, di_blocks))
> -		return;
> -	if (debug)
> -		printf("ino %d adjusting block count from %jd to %jd\n",
> -		    ino, DIP(ip, di_blocks), blocks);
> -	DIP_SET(ip, di_blocks, blocks);
> -	ino_dirty(ino);
> -}
> -
> -static void
> -blk_free_visit(ino_t ino, ufs_lbn_t lbn, ufs2_daddr_t blk, int frags)
> -{
> -	int mask;
>
> *** DIFF OUTPUT TRUNCATED AT 1000 LINES ***
>

From owner-svn-src-head@FreeBSD.ORG  Sat Apr 24 12:11:42 2010
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id E462A1065672;
	Sat, 24 Apr 2010 12:11:42 +0000 (UTC)
	(envelope-from marius@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id D0B768FC1A;
	Sat, 24 Apr 2010 12:11:42 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o3OCBgIe027193;
	Sat, 24 Apr 2010 12:11:42 GMT (envelope-from marius@svn.freebsd.org)
Received: (from marius@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o3OCBgXD027190;
	Sat, 24 Apr 2010 12:11:42 GMT (envelope-from marius@svn.freebsd.org)
Message-Id: <201004241211.o3OCBgXD027190@svn.freebsd.org>
From: Marius Strobl 
Date: Sat, 24 Apr 2010 12:11:42 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r207151 - in head/tools/test: . testfloat
	testfloat/sparc64
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Sat, 24 Apr 2010 12:11:43 -0000

Author: marius
Date: Sat Apr 24 12:11:41 2010
New Revision: 207151
URL: http://svn.freebsd.org/changeset/base/207151

Log:
  Add a TestFloat based test suite for floating-point implementations
  currently supporting sparc64. After a `make depend all` there are
  three programs; testsoftfloat for testing against the SoftFloat in
  src/lib/libc/softfloat for reference purposes, testemufloat for
  testing the emulator source in src/lib/libc/sparc64/fpu and testfloat
  for testing with the installed libc. Support for other architectures
  can be added as needed.
  
  PR:		144900
  Submitted by:	Peter Jeremy

Added:
  head/tools/test/testfloat/
  head/tools/test/testfloat/README.txt
     - copied unchanged from r207134, vendor/testfloat/dist/testfloat/README.txt
  head/tools/test/testfloat/fail.c
     - copied unchanged from r207134, vendor/testfloat/dist/testfloat/fail.c
  head/tools/test/testfloat/fail.h
     - copied unchanged from r207134, vendor/testfloat/dist/testfloat/fail.h
  head/tools/test/testfloat/random.c   (contents, props changed)
     - copied, changed from r207134, vendor/testfloat/dist/testfloat/random.c
  head/tools/test/testfloat/random.h
     - copied unchanged from r207134, vendor/testfloat/dist/testfloat/random.h
  head/tools/test/testfloat/slowfloat-32.c
     - copied unchanged from r207134, vendor/testfloat/dist/testfloat/slowfloat-32.c
  head/tools/test/testfloat/slowfloat-64.c
     - copied unchanged from r207134, vendor/testfloat/dist/testfloat/slowfloat-64.c
  head/tools/test/testfloat/slowfloat.c
     - copied unchanged from r207134, vendor/testfloat/dist/testfloat/slowfloat.c
  head/tools/test/testfloat/slowfloat.h
     - copied unchanged from r207134, vendor/testfloat/dist/testfloat/slowfloat.h
  head/tools/test/testfloat/sparc64/
  head/tools/test/testfloat/sparc64/Makefile   (contents, props changed)
  head/tools/test/testfloat/sparc64/fpu_emul.S   (contents, props changed)
  head/tools/test/testfloat/sparc64/fpu_reg.h   (contents, props changed)
  head/tools/test/testfloat/sparc64/fpu_util.c   (contents, props changed)
  head/tools/test/testfloat/sparc64/libc_private.h   (contents, props changed)
  head/tools/test/testfloat/sparc64/milieu.h   (contents, props changed)
  head/tools/test/testfloat/sparc64/namespace.h   (contents, props changed)
  head/tools/test/testfloat/sparc64/softfloat.h   (contents, props changed)
  head/tools/test/testfloat/sparc64/sparc64.h   (contents, props changed)
  head/tools/test/testfloat/sparc64/systflags.c   (contents, props changed)
  head/tools/test/testfloat/sparc64/systfloat.S   (contents, props changed)
  head/tools/test/testfloat/sparc64/systfloat.h   (contents, props changed)
  head/tools/test/testfloat/sparc64/systmodes.c   (contents, props changed)
  head/tools/test/testfloat/sparc64/un-namespace.h   (contents, props changed)
  head/tools/test/testfloat/systemBugs.txt
     - copied unchanged from r207134, vendor/testfloat/dist/testfloat/systemBugs.txt
  head/tools/test/testfloat/systflags.h
     - copied unchanged from r207134, vendor/testfloat/dist/testfloat/systflags.h
  head/tools/test/testfloat/systfloat.c
     - copied unchanged from r207134, vendor/testfloat/dist/testfloat/systfloat.c
  head/tools/test/testfloat/systmodes.h
     - copied unchanged from r207134, vendor/testfloat/dist/testfloat/systmodes.h
  head/tools/test/testfloat/testCases.c   (contents, props changed)
     - copied, changed from r207134, vendor/testfloat/dist/testfloat/testCases.c
  head/tools/test/testfloat/testCases.h
     - copied unchanged from r207134, vendor/testfloat/dist/testfloat/testCases.h
  head/tools/test/testfloat/testFunction.c
     - copied unchanged from r207134, vendor/testfloat/dist/testfloat/testFunction.c
  head/tools/test/testfloat/testFunction.h
     - copied unchanged from r207134, vendor/testfloat/dist/testfloat/testFunction.h
  head/tools/test/testfloat/testLoops.c
     - copied unchanged from r207134, vendor/testfloat/dist/testfloat/testLoops.c
  head/tools/test/testfloat/testLoops.h
     - copied unchanged from r207134, vendor/testfloat/dist/testfloat/testLoops.h
  head/tools/test/testfloat/testfloat-history.txt
     - copied unchanged from r207134, vendor/testfloat/dist/testfloat/testfloat-history.txt
  head/tools/test/testfloat/testfloat-source.txt
     - copied unchanged from r207134, vendor/testfloat/dist/testfloat/testfloat-source.txt
  head/tools/test/testfloat/testfloat.c   (contents, props changed)
     - copied, changed from r207134, vendor/testfloat/dist/testfloat/testfloat.c
  head/tools/test/testfloat/testfloat.txt
     - copied unchanged from r207134, vendor/testfloat/dist/testfloat/testfloat.txt
  head/tools/test/testfloat/testsoftfloat.c   (contents, props changed)
     - copied, changed from r207134, vendor/testfloat/dist/testfloat/testsoftfloat.c
  head/tools/test/testfloat/writeHex.c
     - copied unchanged from r207134, vendor/testfloat/dist/testfloat/writeHex.c
  head/tools/test/testfloat/writeHex.h
     - copied unchanged from r207134, vendor/testfloat/dist/testfloat/writeHex.h
Modified:
  head/tools/test/README

Modified: head/tools/test/README
==============================================================================
--- head/tools/test/README	Sat Apr 24 10:22:08 2010	(r207150)
+++ head/tools/test/README	Sat Apr 24 12:11:41 2010	(r207151)
@@ -11,3 +11,4 @@ devrandom	Programs to test /dev/*random.
 dtrace		DTrace test suite
 malloc		A program to test and benchmark malloc().
 posixshm	A program to test POSIX shared memory.
+testfloat	Programs to test floating-point implementations

Copied: head/tools/test/testfloat/README.txt (from r207134, vendor/testfloat/dist/testfloat/README.txt)
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/tools/test/testfloat/README.txt	Sat Apr 24 12:11:41 2010	(r207151, copy of r207134, vendor/testfloat/dist/testfloat/README.txt)
@@ -0,0 +1,50 @@
+
+Package Overview for TestFloat Release 2a
+
+John R. Hauser
+1998 December 16
+
+
+TestFloat is a program for testing that a floating-point implementation
+conforms to the IEC/IEEE Standard for Binary Floating-Point Arithmetic.
+TestFloat is distributed in the form of C source code.  The TestFloat
+package actually provides two related programs:
+
+-- The `testfloat' program tests a system's floating-point for conformance
+   to the IEC/IEEE Standard.  This program uses the SoftFloat software
+   floating-point implementation as a basis for comparison.
+
+-- The `testsoftfloat' program tests SoftFloat itself for conformance to
+   the IEC/IEEE Standard.  These tests are performed by comparing against a
+   separate, slower software floating-point that is included in the TestFloat
+   package.
+
+TestFloat depends on SoftFloat, but SoftFloat is not included in the
+TestFloat package.  SoftFloat can be obtained through the Web page `http://
+HTTP.CS.Berkeley.EDU/~jhauser/arithmetic/SoftFloat.html'.
+
+TestFloat is documented in three text files:
+
+   testfloat.txt          Documentation for using the TestFloat programs
+                              (both `testfloat' and `testsoftfloat').
+   testfloat-source.txt   Documentation for porting and compiling TestFloat.
+   testfloat-history.txt  History of major changes to TestFloat.
+
+The following file is also provided:
+
+   systemBugs.txt         Information about processor bugs found using
+                              TestFloat.
+
+Other files in the package comprise the source code for TestFloat.
+
+Please be aware that some work is involved in porting this software to other
+targets.  It is not just a matter of getting `make' to complete without
+error messages.  I would have written the code that way if I could, but
+there are fundamental differences between systems that I can't make go away.
+You should not attempt to compile the TestFloat sources without first
+reading `testfloat-source.txt'.
+
+At the time of this writing, the most up-to-date information about
+TestFloat and the latest release can be found at the Web page `http://
+HTTP.CS.Berkeley.EDU/~jhauser/arithmetic/TestFloat.html'.
+

Copied: head/tools/test/testfloat/fail.c (from r207134, vendor/testfloat/dist/testfloat/fail.c)
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/tools/test/testfloat/fail.c	Sat Apr 24 12:11:41 2010	(r207151, copy of r207134, vendor/testfloat/dist/testfloat/fail.c)
@@ -0,0 +1,46 @@
+
+/*
+===============================================================================
+
+This C source file is part of TestFloat, Release 2a, a package of programs
+for testing the correctness of floating-point arithmetic complying to the
+IEC/IEEE Standard for Floating-Point.
+
+Written by John R. Hauser.  More information is available through the Web
+page `http://HTTP.CS.Berkeley.EDU/~jhauser/arithmetic/TestFloat.html'.
+
+THIS SOFTWARE IS DISTRIBUTED AS IS, FOR FREE.  Although reasonable effort
+has been made to avoid it, THIS SOFTWARE MAY CONTAIN FAULTS THAT WILL AT
+TIMES RESULT IN INCORRECT BEHAVIOR.  USE OF THIS SOFTWARE IS RESTRICTED TO
+PERSONS AND ORGANIZATIONS WHO CAN AND WILL TAKE FULL RESPONSIBILITY FOR ANY
+AND ALL LOSSES, COSTS, OR OTHER PROBLEMS ARISING FROM ITS USE.
+
+Derivative works are acceptable, even for commercial purposes, so long as
+(1) they include prominent notice that the work is derivative, and (2) they
+include prominent notice akin to these four paragraphs for those parts of
+this code that are retained.
+
+===============================================================================
+*/
+
+#include 
+#include 
+#include 
+#include "milieu.h"
+#include "fail.h"
+
+char *fail_programName = "";
+
+void fail( const char *message, ... )
+{
+    va_list varArgs;
+
+    fprintf( stderr, "%s: ", fail_programName );
+    va_start( varArgs, message );
+    vfprintf( stderr, message, varArgs );
+    va_end( varArgs );
+    fputs( ".\n", stderr );
+    exit( EXIT_FAILURE );
+
+}
+

Copied: head/tools/test/testfloat/fail.h (from r207134, vendor/testfloat/dist/testfloat/fail.h)
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/tools/test/testfloat/fail.h	Sat Apr 24 12:11:41 2010	(r207151, copy of r207134, vendor/testfloat/dist/testfloat/fail.h)
@@ -0,0 +1,29 @@
+
+/*
+===============================================================================
+
+This C header file is part of TestFloat, Release 2a, a package of programs
+for testing the correctness of floating-point arithmetic complying to the
+IEC/IEEE Standard for Floating-Point.
+
+Written by John R. Hauser.  More information is available through the Web
+page `http://HTTP.CS.Berkeley.EDU/~jhauser/arithmetic/TestFloat.html'.
+
+THIS SOFTWARE IS DISTRIBUTED AS IS, FOR FREE.  Although reasonable effort
+has been made to avoid it, THIS SOFTWARE MAY CONTAIN FAULTS THAT WILL AT
+TIMES RESULT IN INCORRECT BEHAVIOR.  USE OF THIS SOFTWARE IS RESTRICTED TO
+PERSONS AND ORGANIZATIONS WHO CAN AND WILL TAKE FULL RESPONSIBILITY FOR ANY
+AND ALL LOSSES, COSTS, OR OTHER PROBLEMS ARISING FROM ITS USE.
+
+Derivative works are acceptable, even for commercial purposes, so long as
+(1) they include prominent notice that the work is derivative, and (2) they
+include prominent notice akin to these four paragraphs for those parts of
+this code that are retained.
+
+===============================================================================
+*/
+
+extern char *fail_programName;
+
+void fail( const char *, ... );
+

Copied and modified: head/tools/test/testfloat/random.c (from r207134, vendor/testfloat/dist/testfloat/random.c)
==============================================================================
--- vendor/testfloat/dist/testfloat/random.c	Fri Apr 23 19:48:31 2010	(r207134, copy source)
+++ head/tools/test/testfloat/random.c	Sat Apr 24 12:11:41 2010	(r207151)
@@ -23,6 +23,9 @@ this code that are retained.
 ===============================================================================
 */
 
+#include 
+__FBSDID("$FreeBSD$");
+
 #include 
 #include "milieu.h"
 #include "random.h"
@@ -30,26 +33,21 @@ this code that are retained.
 uint8 randomUint8( void )
 {
 
-    return (bits8) ( rand()>>4 );
+    return (bits8) ( random()>>4 );
 
 }
 
 uint16 randomUint16( void )
 {
 
-    return ( ( rand() & 0x0FF0 )<<4 ) | ( ( rand()>>4 ) & 0xFF );
+    return ( random() & 0x0000ffff );
 
 }
 
 uint32 randomUint32( void )
 {
 
-    return
-          ( ( (uint32) ( rand() & 0x0FF0 ) )<<20 )
-        | ( ( (uint32) ( rand() & 0x0FF0 ) )<<12 )
-        | ( ( rand() & 0x0FF0 )<<4 )
-        | ( ( rand()>>4 ) & 0xFF );
-
+    return ( ( (uint32) random()<<16) | ( (uint32) random() & 0x0000ffff) );
 }
 
 #ifdef BITS64

Copied: head/tools/test/testfloat/random.h (from r207134, vendor/testfloat/dist/testfloat/random.h)
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/tools/test/testfloat/random.h	Sat Apr 24 12:11:41 2010	(r207151, copy of r207134, vendor/testfloat/dist/testfloat/random.h)
@@ -0,0 +1,32 @@
+
+/*
+===============================================================================
+
+This C header file is part of TestFloat, Release 2a, a package of programs
+for testing the correctness of floating-point arithmetic complying to the
+IEC/IEEE Standard for Floating-Point.
+
+Written by John R. Hauser.  More information is available through the Web
+page `http://HTTP.CS.Berkeley.EDU/~jhauser/arithmetic/TestFloat.html'.
+
+THIS SOFTWARE IS DISTRIBUTED AS IS, FOR FREE.  Although reasonable effort
+has been made to avoid it, THIS SOFTWARE MAY CONTAIN FAULTS THAT WILL AT
+TIMES RESULT IN INCORRECT BEHAVIOR.  USE OF THIS SOFTWARE IS RESTRICTED TO
+PERSONS AND ORGANIZATIONS WHO CAN AND WILL TAKE FULL RESPONSIBILITY FOR ANY
+AND ALL LOSSES, COSTS, OR OTHER PROBLEMS ARISING FROM ITS USE.
+
+Derivative works are acceptable, even for commercial purposes, so long as
+(1) they include prominent notice that the work is derivative, and (2) they
+include prominent notice akin to these four paragraphs for those parts of
+this code that are retained.
+
+===============================================================================
+*/
+
+uint8 randomUint8( void );
+uint16 randomUint16( void );
+uint32 randomUint32( void );
+#ifdef BITS64
+uint64 randomUint64( void );
+#endif
+

Copied: head/tools/test/testfloat/slowfloat-32.c (from r207134, vendor/testfloat/dist/testfloat/slowfloat-32.c)
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/tools/test/testfloat/slowfloat-32.c	Sat Apr 24 12:11:41 2010	(r207151, copy of r207134, vendor/testfloat/dist/testfloat/slowfloat-32.c)
@@ -0,0 +1,1183 @@
+
+/*
+===============================================================================
+
+This C source file is part of TestFloat, Release 2a, a package of programs
+for testing the correctness of floating-point arithmetic complying to the
+IEC/IEEE Standard for Floating-Point.
+
+Written by John R. Hauser.  More information is available through the Web
+page `http://HTTP.CS.Berkeley.EDU/~jhauser/arithmetic/TestFloat.html'.
+
+THIS SOFTWARE IS DISTRIBUTED AS IS, FOR FREE.  Although reasonable effort
+has been made to avoid it, THIS SOFTWARE MAY CONTAIN FAULTS THAT WILL AT
+TIMES RESULT IN INCORRECT BEHAVIOR.  USE OF THIS SOFTWARE IS RESTRICTED TO
+PERSONS AND ORGANIZATIONS WHO CAN AND WILL TAKE FULL RESPONSIBILITY FOR ANY
+AND ALL LOSSES, COSTS, OR OTHER PROBLEMS ARISING FROM ITS USE.
+
+Derivative works are acceptable, even for commercial purposes, so long as
+(1) they include prominent notice that the work is derivative, and (2) they
+include prominent notice akin to these four paragraphs for those parts of
+this code that are retained.
+
+===============================================================================
+*/
+
+int8 slow_float_rounding_mode;
+int8 slow_float_exception_flags;
+int8 slow_float_detect_tininess;
+
+typedef struct {
+    bits32 a0, a1;
+} bits64X;
+
+typedef struct {
+    flag isNaN;
+    flag isInf;
+    flag isZero;
+    flag sign;
+    int16 exp;
+    bits64X sig;
+} floatX;
+
+static const floatX floatXNaN = { TRUE, FALSE, FALSE, FALSE, 0, { 0, 0 } };
+static const floatX floatXPositiveZero =
+    { FALSE, FALSE, TRUE, FALSE, 0, { 0, 0 } };
+static const floatX floatXNegativeZero =
+    { FALSE, FALSE, TRUE, TRUE, 0, { 0, 0 } };
+
+static bits64X shortShift64Left( bits64X a, int8 shiftCount )
+{
+    int8 negShiftCount;
+
+    negShiftCount = ( - shiftCount & 31 );
+    a.a0 = ( a.a0<>negShiftCount );
+    a.a1 <<= shiftCount;
+    return a;
+
+}
+
+static bits64X shortShift64RightJamming( bits64X a, int8 shiftCount )
+{
+    int8 negShiftCount;
+    bits32 extra;
+
+    negShiftCount = ( - shiftCount & 31 );
+    extra = a.a1<>shiftCount ) | ( extra != 0 );
+    a.a0 >>= shiftCount;
+    return a;
+
+}
+
+static bits64X neg64( bits64X a )
+{
+
+    if ( a.a1 == 0 ) {
+        a.a0 = - a.a0;
+    }
+    else {
+        a.a1 = - a.a1;
+        a.a0 = ~ a.a0;
+    }
+    return a;
+
+}
+
+static bits64X add64( bits64X a, bits64X b )
+{
+
+    a.a1 += b.a1;
+    a.a0 += b.a0 + ( a.a1 < b.a1 );
+    return a;
+
+}
+
+static flag eq64( bits64X a, bits64X b )
+{
+
+    return ( a.a0 == b.a0 ) && ( a.a1 == b.a1 );
+
+}
+
+static flag le64( bits64X a, bits64X b )
+{
+
+    return ( a.a0 < b.a0 ) || ( ( a.a0 == b.a0 ) && ( a.a1 <= b.a1 ) );
+
+}
+
+static flag lt64( bits64X a, bits64X b )
+{
+
+    return ( a.a0 < b.a0 ) || ( ( a.a0 == b.a0 ) && ( a.a1 < b.a1 ) );
+
+}
+
+static floatX roundFloatXTo24( flag isTiny, floatX zx )
+{
+
+    if ( zx.sig.a1 ) {
+        slow_float_exception_flags |= float_flag_inexact;
+        if ( isTiny ) slow_float_exception_flags |= float_flag_underflow;
+        switch ( slow_float_rounding_mode ) {
+         case float_round_nearest_even:
+            if ( zx.sig.a1 < 0x80000000 ) goto noIncrement;
+            if ( ( zx.sig.a1 == 0x80000000 ) && ! ( zx.sig.a0 & 1 ) ) {
+                goto noIncrement;
+            }
+            break;
+         case float_round_to_zero:
+            goto noIncrement;
+         case float_round_down:
+            if ( ! zx.sign ) goto noIncrement;
+            break;
+         case float_round_up:
+            if ( zx.sign ) goto noIncrement;
+            break;
+        }
+        ++zx.sig.a0;
+        if ( zx.sig.a0 == 0x01000000 ) {
+            zx.sig.a0 = 0x00800000;
+            ++zx.exp;
+        }
+    }
+ noIncrement:
+    zx.sig.a1 = 0;
+    return zx;
+
+}
+
+static floatX roundFloatXTo53( flag isTiny, floatX zx )
+{
+    int8 roundBits;
+
+    roundBits = zx.sig.a1 & 7;
+    zx.sig.a1 -= roundBits;
+    if ( roundBits ) {
+        slow_float_exception_flags |= float_flag_inexact;
+        if ( isTiny ) slow_float_exception_flags |= float_flag_underflow;
+        switch ( slow_float_rounding_mode ) {
+         case float_round_nearest_even:
+            if ( roundBits < 4 ) goto noIncrement;
+            if ( ( roundBits == 4 ) && ! ( zx.sig.a1 & 8 ) ) goto noIncrement;
+            break;
+         case float_round_to_zero:
+            goto noIncrement;
+         case float_round_down:
+            if ( ! zx.sign ) goto noIncrement;
+            break;
+         case float_round_up:
+            if ( zx.sign ) goto noIncrement;
+            break;
+        }
+        zx.sig.a1 += 8;
+        zx.sig.a0 += ( zx.sig.a1 == 0 );
+        if ( zx.sig.a0 == 0x01000000 ) {
+            zx.sig.a0 = 0x00800000;
+            ++zx.exp;
+        }
+    }
+ noIncrement:
+    return zx;
+
+}
+
+static floatX int32ToFloatX( int32 a )
+{
+    floatX ax;
+
+    ax.isNaN = FALSE;
+    ax.isInf = FALSE;
+    ax.sign = ( a < 0 );
+    ax.sig.a1 = ax.sign ? - a : a;
+    ax.sig.a0 = 0;
+    if ( a == 0 ) {
+        ax.isZero = TRUE;
+        return ax;
+    }
+    ax.isZero = FALSE;
+    ax.sig = shortShift64Left( ax.sig, 23 );
+    ax.exp = 32;
+    while ( ax.sig.a0 < 0x00800000 ) {
+        ax.sig = shortShift64Left( ax.sig, 1 );
+        --ax.exp;
+    }
+    return ax;
+
+}
+
+static int32 floatXToInt32( floatX ax )
+{
+    int8 savedExceptionFlags;
+    int16 shiftCount;
+    int32 z;
+
+    if ( ax.isInf || ax.isNaN ) {
+        slow_float_exception_flags |= float_flag_invalid;
+        return ( ax.isInf & ax.sign ) ? 0x80000000 : 0x7FFFFFFF;
+    }
+    if ( ax.isZero ) return 0;
+    savedExceptionFlags = slow_float_exception_flags;
+    shiftCount = 52 - ax.exp;
+    if ( 56 < shiftCount ) {
+        ax.sig.a1 = 1;
+        ax.sig.a0 = 0;
+    }
+    else {
+        while ( 0 < shiftCount ) {
+            ax.sig = shortShift64RightJamming( ax.sig, 1 );
+            --shiftCount;
+        }
+    }
+    ax = roundFloatXTo53( FALSE, ax );
+    ax.sig = shortShift64RightJamming( ax.sig, 3 );
+    z = ax.sig.a1;
+    if ( ax.sign ) z = - z;
+    if (    ( shiftCount < 0 )
+         || ax.sig.a0
+         || ( ( z != 0 ) && ( ( ax.sign ^ ( z < 0 ) ) != 0 ) )
+       ) {
+        slow_float_exception_flags = savedExceptionFlags | float_flag_invalid;
+        return ax.sign ? 0x80000000 : 0x7FFFFFFF;
+    }
+    return z;
+
+}
+
+static floatX float32ToFloatX( float32 a )
+{
+    int16 expField;
+    floatX ax;
+
+    ax.isNaN = FALSE;
+    ax.isInf = FALSE;
+    ax.isZero = FALSE;
+    ax.sign = ( ( a & 0x80000000 ) != 0 );
+    expField = ( a>>23 ) & 0xFF;
+    ax.sig.a1 = 0;
+    ax.sig.a0 = a & 0x007FFFFF;
+    if ( expField == 0 ) {
+        if ( ax.sig.a0 == 0 ) {
+            ax.isZero = TRUE;
+        }
+        else {
+            expField = 1 - 0x7F;
+            do {
+                ax.sig.a0 <<= 1;
+                --expField;
+            } while ( ax.sig.a0 < 0x00800000 );
+            ax.exp = expField;
+        }
+    }
+    else if ( expField == 0xFF ) {
+        if ( ax.sig.a0 == 0 ) {
+            ax.isInf = TRUE;
+        }
+        else {
+            ax.isNaN = TRUE;
+        }
+    }
+    else {
+        ax.sig.a0 |= 0x00800000;
+        ax.exp = expField - 0x7F;
+    }
+    return ax;
+
+}
+
+static float32 floatXToFloat32( floatX zx )
+{
+    floatX savedZ;
+    flag isTiny;
+    int16 expField;
+    float32 z;
+
+    if ( zx.isZero ) return zx.sign ? 0x80000000 : 0;
+    if ( zx.isInf ) return zx.sign ? 0xFF800000 : 0x7F800000;
+    if ( zx.isNaN ) return 0xFFFFFFFF;
+    while ( 0x01000000 <= zx.sig.a0 ) {
+        zx.sig = shortShift64RightJamming( zx.sig, 1 );
+        ++zx.exp;
+    }
+    while ( zx.sig.a0 < 0x00800000 ) {
+        zx.sig = shortShift64Left( zx.sig, 1 );
+        --zx.exp;
+    }
+    savedZ = zx;
+    isTiny =
+           ( slow_float_detect_tininess == float_tininess_before_rounding )
+        && ( zx.exp + 0x7F <= 0 );
+    zx = roundFloatXTo24( isTiny, zx );
+    expField = zx.exp + 0x7F;
+    if ( 0xFF <= expField ) {
+        slow_float_exception_flags |=
+            float_flag_overflow | float_flag_inexact;
+        if ( zx.sign ) {
+            switch ( slow_float_rounding_mode ) {
+             case float_round_nearest_even:
+             case float_round_down:
+                z = 0xFF800000;
+                break;
+             case float_round_to_zero:
+             case float_round_up:
+                z = 0xFF7FFFFF;
+                break;
+            }
+        }
+        else {
+            switch ( slow_float_rounding_mode ) {
+             case float_round_nearest_even:
+             case float_round_up:
+                z = 0x7F800000;
+                break;
+             case float_round_to_zero:
+             case float_round_down:
+                z = 0x7F7FFFFF;
+                break;
+            }
+        }
+        return z;
+    }
+    if ( expField <= 0 ) {
+        isTiny = TRUE;
+        zx = savedZ;
+        expField = zx.exp + 0x7F;
+        if ( expField < -27 ) {
+            zx.sig.a1 = ( zx.sig.a0 != 0 ) || ( zx.sig.a1 != 0 );
+            zx.sig.a0 = 0;
+        }
+        else {
+            while ( expField <= 0 ) {
+                zx.sig = shortShift64RightJamming( zx.sig, 1 );
+                ++expField;
+            }
+        }
+        zx = roundFloatXTo24( isTiny, zx );
+        expField = ( 0x00800000 <= zx.sig.a0 ) ? 1 : 0;
+    }
+    z = expField;
+    z <<= 23;
+    if ( zx.sign ) z |= 0x80000000;
+    z |= zx.sig.a0 & 0x007FFFFF;
+    return z;
+
+}
+
+static floatX float64ToFloatX( float64 a )
+{
+    int16 expField;
+    floatX ax;
+
+    ax.isNaN = FALSE;
+    ax.isInf = FALSE;
+    ax.isZero = FALSE;
+#ifdef BITS64
+    ax.sign = ( ( a & LIT64( 0x8000000000000000 ) ) != 0 );
+    expField = ( a>>52 ) & 0x7FF;
+    ax.sig.a1 = a;
+    ax.sig.a0 = ( a>>32 ) & 0x000FFFFF;
+#else
+    ax.sign = ( ( a.high & 0x80000000 ) != 0 );
+    expField = ( a.high>>( 52 - 32 ) ) & 0x7FF;
+    ax.sig.a1 = a.low;
+    ax.sig.a0 = a.high & 0x000FFFFF;
+#endif
+    if ( expField == 0 ) {
+        if ( ( ax.sig.a0 == 0 ) && ( ax.sig.a1 == 0 ) ) {
+            ax.isZero = TRUE;
+        }
+        else {
+            expField = 1 - 0x3FF;
+            do {
+                ax.sig = shortShift64Left( ax.sig, 1 );
+                --expField;
+            } while ( ax.sig.a0 < 0x00100000 );
+            ax.exp = expField;
+        }
+    }
+    else if ( expField == 0x7FF ) {
+        if ( ( ax.sig.a0 == 0 ) && ( ax.sig.a1 == 0 ) ) {
+            ax.isInf = TRUE;
+        }
+        else {
+            ax.isNaN = TRUE;
+        }
+    }
+    else {
+        ax.exp = expField - 0x3FF;
+        ax.sig.a0 |= 0x00100000;
+    }
+    ax.sig = shortShift64Left( ax.sig, 3 );
+    return ax;
+
+}
+
+static float64 floatXToFloat64( floatX zx )
+{
+    floatX savedZ;
+    flag isTiny;
+    int16 expField;
+    float64 z;
+
+#ifdef BITS64
+    if ( zx.isZero ) return zx.sign ? LIT64( 0x8000000000000000 ) : 0;
+    if ( zx.isInf ) {
+        return
+              zx.sign ? LIT64( 0xFFF0000000000000 )
+            : LIT64( 0x7FF0000000000000 );
+    }
+    if ( zx.isNaN ) return LIT64( 0xFFFFFFFFFFFFFFFF );
+#else
+    if ( zx.isZero ) {
+        z.low = 0;
+        z.high = zx.sign ? 0x80000000 : 0;
+        return z;
+    }
+    if ( zx.isInf ) {
+        z.low = 0;
+        z.high = zx.sign ? 0xFFF00000 : 0x7FF00000;
+        return z;
+    }
+    if ( zx.isNaN ) {
+        z.high = z.low = 0xFFFFFFFF;
+        return z;
+    }
+#endif
+    while ( 0x01000000 <= zx.sig.a0 ) {
+        zx.sig = shortShift64RightJamming( zx.sig, 1 );
+        ++zx.exp;
+    }
+    while ( zx.sig.a0 < 0x00800000 ) {
+        zx.sig = shortShift64Left( zx.sig, 1 );
+        --zx.exp;
+    }
+    savedZ = zx;
+    isTiny =
+           ( slow_float_detect_tininess == float_tininess_before_rounding )
+        && ( zx.exp + 0x3FF <= 0 );
+    zx = roundFloatXTo53( isTiny, zx );
+    expField = zx.exp + 0x3FF;
+    if ( 0x7FF <= expField ) {
+        slow_float_exception_flags |=
+            float_flag_overflow | float_flag_inexact;
+#ifdef BITS64
+        if ( zx.sign ) {
+            switch ( slow_float_rounding_mode ) {
+             case float_round_nearest_even:
+             case float_round_down:
+                z = LIT64( 0xFFF0000000000000 );
+                break;
+             case float_round_to_zero:
+             case float_round_up:
+                z = LIT64( 0xFFEFFFFFFFFFFFFF );
+                break;
+            }
+        }
+        else {
+            switch ( slow_float_rounding_mode ) {
+             case float_round_nearest_even:
+             case float_round_up:
+                z = LIT64( 0x7FF0000000000000 );
+                break;
+             case float_round_to_zero:
+             case float_round_down:
+                z = LIT64( 0x7FEFFFFFFFFFFFFF );
+                break;
+            }
+        }
+#else
+        if ( zx.sign ) {
+            switch ( slow_float_rounding_mode ) {
+             case float_round_nearest_even:
+             case float_round_down:
+                z.low = 0;
+                z.high = 0xFFF00000;
+                break;
+             case float_round_to_zero:
+             case float_round_up:
+                z.low = 0xFFFFFFFF;
+                z.high = 0xFFEFFFFF;
+                break;
+            }
+        }
+        else {
+            switch ( slow_float_rounding_mode ) {
+             case float_round_nearest_even:
+             case float_round_up:
+                z.low = 0;
+                z.high = 0x7FF00000;
+                break;
+             case float_round_to_zero:
+             case float_round_down:
+                z.low = 0xFFFFFFFF;
+                z.high = 0x7FEFFFFF;
+                break;
+            }
+        }
+#endif
+        return z;
+    }
+    if ( expField <= 0 ) {
+        isTiny = TRUE;
+        zx = savedZ;
+        expField = zx.exp + 0x3FF;
+        if ( expField < -56 ) {
+            zx.sig.a1 = ( zx.sig.a0 != 0 ) || ( zx.sig.a1 != 0 );
+            zx.sig.a0 = 0;
+        }
+        else {
+            while ( expField <= 0 ) {
+                zx.sig = shortShift64RightJamming( zx.sig, 1 );
+                ++expField;
+            }
+        }
+        zx = roundFloatXTo53( isTiny, zx );
+        expField = ( 0x00800000 <= zx.sig.a0 ) ? 1 : 0;
+    }
+    zx.sig = shortShift64RightJamming( zx.sig, 3 );
+#ifdef BITS64
+    z = expField;
+    z <<= 52;
+    if ( zx.sign ) z |= LIT64( 0x8000000000000000 );
+    z |= ( ( (bits64) ( zx.sig.a0 & 0x000FFFFF ) )<<32 ) | zx.sig.a1;
+#else
+    z.low = zx.sig.a1;
+    z.high = expField;
+    z.high <<= 52 - 32;
+    if ( zx.sign ) z.high |= 0x80000000;
+    z.high |= zx.sig.a0 & 0x000FFFFF;
+#endif
+    return z;
+
+}
+
+static floatX floatXInvalid( void )
+{
+
+    slow_float_exception_flags |= float_flag_invalid;
+    return floatXNaN;
+
+}
+
+static floatX floatXRoundToInt( floatX ax )
+{
+    int16 shiftCount, i;
+
+    if ( ax.isNaN || ax.isInf ) return ax;
+    shiftCount = 52 - ax.exp;
+    if ( shiftCount <= 0 ) return ax;
+    if ( 55 < shiftCount ) {
+        ax.exp = 52;
+        ax.sig.a1 = ! ax.isZero;
+        ax.sig.a0 = 0;
+    }
+    else {
+        while ( 0 < shiftCount ) {
+            ax.sig = shortShift64RightJamming( ax.sig, 1 );
+            ++ax.exp;
+            --shiftCount;
+        }
+    }
+    ax = roundFloatXTo53( FALSE, ax );
+    if ( ( ax.sig.a0 == 0 ) && ( ax.sig.a1 == 0 ) ) ax.isZero = TRUE;
+    return ax;
+
+}
+
+static floatX floatXAdd( floatX ax, floatX bx )
+{
+    int16 expDiff;
+    floatX zx;
+
+    if ( ax.isNaN ) return ax;
+    if ( bx.isNaN ) return bx;
+    if ( ax.isInf && bx.isInf ) {
+        if ( ax.sign == bx.sign ) return ax;
+        return floatXInvalid();
+    }
+    if ( ax.isInf ) return ax;
+    if ( bx.isInf ) return bx;
+    if ( ax.isZero && bx.isZero ) {
+        if ( ax.sign == bx.sign ) return ax;
+        goto completeCancellation;
+    }
+    if (    ( ax.sign != bx.sign )
+         && ( ax.exp == bx.exp )
+         && eq64( ax.sig, bx.sig )
+       ) {
+ completeCancellation:
+        return
+              ( slow_float_rounding_mode == float_round_down ) ?
+                  floatXNegativeZero
+            : floatXPositiveZero;
+    }
+    if ( ax.isZero ) return bx;
+    if ( bx.isZero ) return ax;
+    expDiff = ax.exp - bx.exp;
+    if ( expDiff < 0 ) {
+        zx = ax;
+        zx.exp = bx.exp;
+        if ( expDiff < -56 ) {
+            zx.sig.a1 = 1;
+            zx.sig.a0 = 0;
+        }
+        else {
+            while ( expDiff < 0 ) {
+                zx.sig = shortShift64RightJamming( zx.sig, 1 );
+                ++expDiff;
+            }
+        }
+        if ( ax.sign != bx.sign ) zx.sig = neg64( zx.sig );
+        zx.sign = bx.sign;
+        zx.sig = add64( zx.sig, bx.sig );
+    }
+    else {
+        zx = bx;
+        zx.exp = ax.exp;
+        if ( 56 < expDiff ) {
+            zx.sig.a1 = 1;
+            zx.sig.a0 = 0;
+        }
+        else {
+            while ( 0 < expDiff ) {
+                zx.sig = shortShift64RightJamming( zx.sig, 1 );
+                --expDiff;
+            }
+        }
+        if ( ax.sign != bx.sign ) zx.sig = neg64( zx.sig );
+        zx.sign = ax.sign;
+        zx.sig = add64( zx.sig, ax.sig );
+    }
+    if ( zx.sig.a0 & 0x80000000 ) {
+        zx.sig = neg64( zx.sig );
+        zx.sign = ! zx.sign;
+    }
+    return zx;
+
+}
+
+static floatX floatXMul( floatX ax, floatX bx )
+{
+    int8 bitNum;
+    floatX zx;
+
+    if ( ax.isNaN ) return ax;
+    if ( bx.isNaN ) return bx;
+    if ( ax.isInf ) {
+        if ( bx.isZero ) return floatXInvalid();
+        if ( bx.sign ) ax.sign = ! ax.sign;
+        return ax;
+    }
+    if ( bx.isInf ) {
+        if ( ax.isZero ) return floatXInvalid();
+        if ( ax.sign ) bx.sign = ! bx.sign;
+        return bx;
+    }
+    zx = ax;
+    zx.sign ^= bx.sign;
+    if ( ax.isZero || bx.isZero ) {
+        return zx.sign ? floatXNegativeZero : floatXPositiveZero;
+    }
+    zx.exp += bx.exp + 1;
+    zx.sig.a1 = 0;
+    zx.sig.a0 = 0;
+    for ( bitNum = 0; bitNum < 55; ++bitNum ) {
+        if ( bx.sig.a1 & 2 ) zx.sig = add64( zx.sig, ax.sig );
+        bx.sig = shortShift64RightJamming( bx.sig, 1 );
+        zx.sig = shortShift64RightJamming( zx.sig, 1 );
+    }
+    return zx;
+
+}
+
+static floatX floatXDiv( floatX ax, floatX bx )
+{
+    bits64X negBSig;
+    int8 bitNum;
+    floatX zx;
+
+    if ( ax.isNaN ) return ax;
+    if ( bx.isNaN ) return bx;
+    if ( ax.isInf ) {
+        if ( bx.isInf ) return floatXInvalid();
+        if ( bx.sign ) ax.sign = ! ax.sign;
+        return ax;
+    }
+    if ( bx.isZero ) {
+        if ( ax.isZero ) return floatXInvalid();
+        slow_float_exception_flags |= float_flag_divbyzero;
+        if ( ax.sign ) bx.sign = ! bx.sign;
+        bx.isZero = FALSE;
+        bx.isInf = TRUE;
+        return bx;
+    }
+    zx = ax;
+    zx.sign ^= bx.sign;
+    if ( ax.isZero || bx.isInf ) {
+        return zx.sign ? floatXNegativeZero : floatXPositiveZero;
+    }
+    zx.exp -= bx.exp + 1;
+    zx.sig.a1 = 0;
+    zx.sig.a0 = 0;
+    negBSig = neg64( bx.sig );
+    for ( bitNum = 0; bitNum < 56; ++bitNum ) {
+        if ( le64( bx.sig, ax.sig ) ) {
+            zx.sig.a1 |= 1;
+            ax.sig = add64( ax.sig, negBSig );
+        }
+        ax.sig = shortShift64Left( ax.sig, 1 );
+        zx.sig = shortShift64Left( zx.sig, 1 );
+    }
+    if ( ax.sig.a0 || ax.sig.a1 ) zx.sig.a1 |= 1;
+    return zx;
+
+}
+
+static floatX floatXRem( floatX ax, floatX bx )
+{
+    bits64X negBSig;
+    flag lastQuotientBit;
+    bits64X savedASig;
+
+    if ( ax.isNaN ) return ax;
+    if ( bx.isNaN ) return bx;
+    if ( ax.isInf || bx.isZero ) return floatXInvalid();
+    if ( ax.isZero || bx.isInf ) return ax;
+    --bx.exp;
+    if ( ax.exp < bx.exp ) return ax;
+    bx.sig = shortShift64Left( bx.sig, 1 );
+    negBSig = neg64( bx.sig );
+    while ( bx.exp < ax.exp ) {
+        if ( le64( bx.sig, ax.sig ) ) ax.sig = add64( ax.sig, negBSig );
+        ax.sig = shortShift64Left( ax.sig, 1 );
+        --ax.exp;
+    }
+    lastQuotientBit = le64( bx.sig, ax.sig );
+    if ( lastQuotientBit ) ax.sig = add64( ax.sig, negBSig );
+    savedASig = ax.sig;
+    ax.sig = neg64( add64( ax.sig, negBSig ) );
+    if ( lt64( ax.sig, savedASig ) ) {
+        ax.sign = ! ax.sign;
+    }
+    else if ( lt64( savedASig, ax.sig ) ) {
+        ax.sig = savedASig;
+    }
+    else {
+        if ( lastQuotientBit ) {
+            ax.sign = ! ax.sign;
+        }
+        else {
+            ax.sig = savedASig;
+        }
+    }
+    if ( ( ax.sig.a0 == 0 ) && ( ax.sig.a1 == 0 ) ) ax.isZero = TRUE;
+    return ax;
+
+}
+
+static floatX floatXSqrt( floatX ax )

*** DIFF OUTPUT TRUNCATED AT 1000 LINES ***

From owner-svn-src-head@FreeBSD.ORG  Sat Apr 24 12:49:53 2010
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 6C513106564A;
	Sat, 24 Apr 2010 12:49:53 +0000 (UTC) (envelope-from kib@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 59BD48FC12;
	Sat, 24 Apr 2010 12:49:53 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o3OCnrhL035715;
	Sat, 24 Apr 2010 12:49:53 GMT (envelope-from kib@svn.freebsd.org)
Received: (from kib@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o3OCnrXG035678;
	Sat, 24 Apr 2010 12:49:53 GMT (envelope-from kib@svn.freebsd.org)
Message-Id: <201004241249.o3OCnrXG035678@svn.freebsd.org>
From: Konstantin Belousov 
Date: Sat, 24 Apr 2010 12:49:53 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r207152 - in head/sys: amd64/include arm/include
	i386/include ia64/include kern mips/include powerpc/include
	sparc64/include sun4v/include sys
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Sat, 24 Apr 2010 12:49:53 -0000

Author: kib
Date: Sat Apr 24 12:49:52 2010
New Revision: 207152
URL: http://svn.freebsd.org/changeset/base/207152

Log:
  Move the constants specifying the size of struct kinfo_proc into
  machine-specific header files. Add KINFO_PROC32_SIZE for struct
  kinfo_proc32 for architectures providing COMPAT_FREEBSD32. Add
  CTASSERT for the size of struct kinfo_proc32.
  
  Submitted by:	pluknet
  Reviewed by:	imp, jhb, nwhitehorn
  MFC after:	2 weeks

Modified:
  head/sys/amd64/include/proc.h
  head/sys/arm/include/proc.h
  head/sys/i386/include/proc.h
  head/sys/ia64/include/proc.h
  head/sys/kern/kern_proc.c
  head/sys/mips/include/proc.h
  head/sys/powerpc/include/proc.h
  head/sys/sparc64/include/proc.h
  head/sys/sun4v/include/proc.h
  head/sys/sys/user.h

Modified: head/sys/amd64/include/proc.h
==============================================================================
--- head/sys/amd64/include/proc.h	Sat Apr 24 12:11:41 2010	(r207151)
+++ head/sys/amd64/include/proc.h	Sat Apr 24 12:49:52 2010	(r207152)
@@ -53,6 +53,9 @@ struct mdproc {
 	struct system_segment_descriptor md_ldt_sd;
 };
 
+#define KINFO_PROC_SIZE 1088
+#define KINFO_PROC32_SIZE 768
+
 #ifdef	_KERNEL
 
 /* Get the current kernel thread stack usage. */

Modified: head/sys/arm/include/proc.h
==============================================================================
--- head/sys/arm/include/proc.h	Sat Apr 24 12:11:41 2010	(r207151)
+++ head/sys/arm/include/proc.h	Sat Apr 24 12:49:52 2010	(r207152)
@@ -60,4 +60,6 @@ struct mdproc {
 	void	*md_sigtramp;
 };
 
+#define KINFO_PROC_SIZE 792
+
 #endif /* !_MACHINE_PROC_H_ */

Modified: head/sys/i386/include/proc.h
==============================================================================
--- head/sys/i386/include/proc.h	Sat Apr 24 12:11:41 2010	(r207151)
+++ head/sys/i386/include/proc.h	Sat Apr 24 12:49:52 2010	(r207152)
@@ -57,6 +57,8 @@ struct mdproc {
 	struct proc_ldt *md_ldt;	/* (t) per-process ldt */
 };
 
+#define KINFO_PROC_SIZE 768
+
 #ifdef	_KERNEL
 
 /* Get the current kernel thread stack usage. */

Modified: head/sys/ia64/include/proc.h
==============================================================================
--- head/sys/ia64/include/proc.h	Sat Apr 24 12:11:41 2010	(r207151)
+++ head/sys/ia64/include/proc.h	Sat Apr 24 12:49:52 2010	(r207152)
@@ -38,4 +38,7 @@ struct mdproc {
 	int		__dummy;	/* Avoid having an empty struct. */
 };
 
+#define KINFO_PROC_SIZE 1088
+#define KINFO_PROC32_SIZE 768
+
 #endif /* !_MACHINE_PROC_H_ */

Modified: head/sys/kern/kern_proc.c
==============================================================================
--- head/sys/kern/kern_proc.c	Sat Apr 24 12:11:41 2010	(r207151)
+++ head/sys/kern/kern_proc.c	Sat Apr 24 12:49:52 2010	(r207152)
@@ -151,6 +151,9 @@ int kstack_pages = KSTACK_PAGES;
 SYSCTL_INT(_kern, OID_AUTO, kstack_pages, CTLFLAG_RD, &kstack_pages, 0, "");
 
 CTASSERT(sizeof(struct kinfo_proc) == KINFO_PROC_SIZE);
+#ifdef COMPAT_FREEBSD32
+CTASSERT(sizeof(struct kinfo_proc32) == KINFO_PROC32_SIZE);
+#endif
 
 /*
  * Initialize global process hashing structures.

Modified: head/sys/mips/include/proc.h
==============================================================================
--- head/sys/mips/include/proc.h	Sat Apr 24 12:11:41 2010	(r207151)
+++ head/sys/mips/include/proc.h	Sat Apr 24 12:49:52 2010	(r207152)
@@ -68,4 +68,10 @@ struct thread;
 void	mips_cpu_switch(struct thread *, struct thread *, struct mtx *);
 void	mips_cpu_throw(struct thread *, struct thread *);
 
+#ifdef __mips_n64
+#define KINFO_PROC_SIZE 1088
+#else
+#define KINFO_PROC_SIZE 816
+#endif
+
 #endif	/* !_MACHINE_PROC_H_ */

Modified: head/sys/powerpc/include/proc.h
==============================================================================
--- head/sys/powerpc/include/proc.h	Sat Apr 24 12:11:41 2010	(r207151)
+++ head/sys/powerpc/include/proc.h	Sat Apr 24 12:49:52 2010	(r207152)
@@ -46,4 +46,6 @@ struct mdthread {
 struct mdproc {
 };
 
+#define KINFO_PROC_SIZE 768
+
 #endif /* !_MACHINE_PROC_H_ */

Modified: head/sys/sparc64/include/proc.h
==============================================================================
--- head/sys/sparc64/include/proc.h	Sat Apr 24 12:11:41 2010	(r207151)
+++ head/sys/sparc64/include/proc.h	Sat Apr 24 12:49:52 2010	(r207152)
@@ -51,4 +51,6 @@ struct mdproc {
 	void	*md_sigtramp;
 };
 
+#define KINFO_PROC_SIZE 1088
+
 #endif /* !_MACHINE_PROC_H_ */

Modified: head/sys/sun4v/include/proc.h
==============================================================================
--- head/sys/sun4v/include/proc.h	Sat Apr 24 12:11:41 2010	(r207151)
+++ head/sys/sun4v/include/proc.h	Sat Apr 24 12:49:52 2010	(r207152)
@@ -51,4 +51,6 @@ struct mdproc {
 	void	*md_sigtramp;
 };
 
+#define KINFO_PROC_SIZE 1088
+
 #endif /* !_MACHINE_PROC_H_ */

Modified: head/sys/sys/user.h
==============================================================================
--- head/sys/sys/user.h	Sat Apr 24 12:11:41 2010	(r207151)
+++ head/sys/sys/user.h	Sat Apr 24 12:49:52 2010	(r207152)
@@ -87,34 +87,11 @@
 #define	KI_NSPARE_LONG	12
 #define	KI_NSPARE_PTR	7
 
-#ifdef __amd64__
-#define	KINFO_PROC_SIZE	1088
-#endif
-#ifdef __arm__
-#define	KINFO_PROC_SIZE	792
-#endif
-#ifdef __ia64__
-#define	KINFO_PROC_SIZE 1088
-#endif
-#ifdef __i386__
-#define	KINFO_PROC_SIZE	768
-#endif
-#ifdef __mips__
-#ifdef __mips_n64
-#define	KINFO_PROC_SIZE	1088
-#else
-#define	KINFO_PROC_SIZE	816
-#endif
-#endif
-#ifdef __powerpc__
-#define	KINFO_PROC_SIZE	768
-#endif
-#ifdef __sparc64__
-#define	KINFO_PROC_SIZE 1088
-#endif
+#ifndef _KERNEL
 #ifndef KINFO_PROC_SIZE
 #error "Unknown architecture"
 #endif
+#endif /* !_KERNEL */
 
 #define	WMESGLEN	8		/* size of returned wchan message */
 #define	LOCKNAMELEN	8		/* size of returned lock name */

From owner-svn-src-head@FreeBSD.ORG  Sat Apr 24 13:53:13 2010
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 185D0106566B;
	Sat, 24 Apr 2010 13:53:13 +0000 (UTC)
	(envelope-from jilles@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id E231B8FC16;
	Sat, 24 Apr 2010 13:53:12 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o3ODrCpt049713;
	Sat, 24 Apr 2010 13:53:12 GMT (envelope-from jilles@svn.freebsd.org)
Received: (from jilles@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o3ODrC0L049712;
	Sat, 24 Apr 2010 13:53:12 GMT (envelope-from jilles@svn.freebsd.org)
Message-Id: <201004241353.o3ODrC0L049712@svn.freebsd.org>
From: Jilles Tjoelker 
Date: Sat, 24 Apr 2010 13:53:12 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r207153 - head/usr.bin/stat
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Sat, 24 Apr 2010 13:53:13 -0000

Author: jilles
Date: Sat Apr 24 13:53:12 2010
New Revision: 207153
URL: http://svn.freebsd.org/changeset/base/207153

Log:
  stat: Allow -f %Sf to display the file flags symbolically.
  
  I have changed the patch slightly to show '-' if there are no flags just
  like ls -ldo does.
  
  PR:		124349
  Submitted by:	Ighighi
  MFC after:	1 week

Modified:
  head/usr.bin/stat/stat.1
  head/usr.bin/stat/stat.c

Modified: head/usr.bin/stat/stat.1
==============================================================================
--- head/usr.bin/stat/stat.1	Sat Apr 24 12:49:52 2010	(r207152)
+++ head/usr.bin/stat/stat.1	Sat Apr 24 13:53:12 2010	(r207153)
@@ -29,7 +29,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd April 27, 2007
+.Dd April 24, 2010
 .Dt STAT 1
 .Os
 .Sh NAME
@@ -232,6 +232,11 @@ Display date in
 format.
 .It Cm dr
 Display actual device name.
+.It Cm f
+Display the flags of
+.Ar file
+as in
+.Nm ls Fl lTdo .
 .It Cm gu
 Display group or user name.
 .It Cm p

Modified: head/usr.bin/stat/stat.c
==============================================================================
--- head/usr.bin/stat/stat.c	Sat Apr 24 12:49:52 2010	(r207152)
+++ head/usr.bin/stat/stat.c	Sat Apr 24 13:53:12 2010	(r207153)
@@ -182,6 +182,9 @@ int	format1(const struct stat *,	/* stat
 	    char *, size_t,		/* a place to put the output */
 	    int, int, int, int,		/* the parsed format */
 	    int, int);
+#if HAVE_STRUCT_STAT_ST_FLAGS
+char   *xfflagstostr(unsigned long);
+#endif
 
 char *timefmt;
 int linkfail;
@@ -333,6 +336,25 @@ main(int argc, char *argv[])
 	return (am_readlink ? linkfail : errs);
 }
 
+#if HAVE_STRUCT_STAT_ST_FLAGS
+/*
+ * fflagstostr() wrapper that leaks only once
+ */
+char *
+xfflagstostr(unsigned long fflags)
+{
+	static char *str = NULL;
+
+	if (str != NULL)
+		free(str);
+
+	str = fflagstostr(fflags);
+	if (str == NULL)
+		err(1, "fflagstostr");
+	return (str);
+}
+#endif /* HAVE_STRUCT_STAT_ST_FLAGS */
+
 void
 usage(const char *synopsis)
 {
@@ -725,8 +747,11 @@ format1(const struct stat *st,
 	case SHOW_st_flags:
 		small = (sizeof(st->st_flags) == 4);
 		data = st->st_flags;
-		sdata = NULL;
-		formats = FMTF_DECIMAL | FMTF_OCTAL | FMTF_UNSIGNED | FMTF_HEX;
+		sdata = xfflagstostr(st->st_flags);
+		if (*sdata == '\0')
+			sdata = "-";
+		formats = FMTF_DECIMAL | FMTF_OCTAL | FMTF_UNSIGNED | FMTF_HEX |
+		    FMTF_STRING;
 		if (ofmt == 0)
 			ofmt = FMTF_UNSIGNED;
 		break;

From owner-svn-src-head@FreeBSD.ORG  Sat Apr 24 16:27:44 2010
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 70A001065670;
	Sat, 24 Apr 2010 16:27:44 +0000 (UTC)
	(envelope-from marius@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 464B88FC0C;
	Sat, 24 Apr 2010 16:27:44 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o3OGRiFt083785;
	Sat, 24 Apr 2010 16:27:44 GMT (envelope-from marius@svn.freebsd.org)
Received: (from marius@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o3OGRiI2083784;
	Sat, 24 Apr 2010 16:27:44 GMT (envelope-from marius@svn.freebsd.org)
Message-Id: <201004241627.o3OGRiI2083784@svn.freebsd.org>
From: Marius Strobl 
Date: Sat, 24 Apr 2010 16:27:43 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r207154 - head/sys/conf
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Sat, 24 Apr 2010 16:27:44 -0000

Author: marius
Date: Sat Apr 24 16:27:43 2010
New Revision: 207154
URL: http://svn.freebsd.org/changeset/base/207154

Log:
  Fix some sorting and whitespace nits.

Modified:
  head/sys/conf/files.sparc64
  head/sys/conf/files.sun4v

Modified: head/sys/conf/files.sparc64
==============================================================================
--- head/sys/conf/files.sparc64	Sat Apr 24 13:53:12 2010	(r207153)
+++ head/sys/conf/files.sparc64	Sat Apr 24 16:27:43 2010	(r207154)
@@ -22,7 +22,7 @@ ukbdmap.h			optional	ukbd_dflt_keymap	\
 	no-obj no-implicit-rule before-depend				\
 	clean		"ukbdmap.h"
 #
-crypto/blowfish/bf_enc.c	optional	crypto | ipsec 
+crypto/blowfish/bf_enc.c	optional	crypto | ipsec
 crypto/des/des_enc.c		optional	crypto | ipsec | netsmb
 dev/atkbdc/atkbd.c		optional	atkbd atkbdc
 dev/atkbdc/atkbd_atkbdc.c	optional	atkbd atkbdc
@@ -42,11 +42,11 @@ dev/kbd/kbd.c			optional	atkbd | sc | uk
 dev/le/if_le_lebuffer.c		optional	le sbus
 dev/le/if_le_ledma.c		optional	le sbus
 dev/le/lebuffer_sbus.c		optional	le sbus
-dev/ofw/ofw_if.m		standard
 dev/ofw/ofw_bus_if.m		standard
 dev/ofw/ofw_bus_subr.c		standard
-dev/ofw/ofw_standard.c		standard
 dev/ofw/ofw_console.c		optional	ofw_console
+dev/ofw/ofw_if.m		standard
+dev/ofw/ofw_standard.c		standard
 dev/ofw/openfirm.c		standard
 dev/ofw/openfirmio.c		standard
 dev/ofw/openpromio.c		standard
@@ -79,7 +79,7 @@ sparc64/pci/ofw_pcib.c		optional	pci
 sparc64/pci/ofw_pcib_subr.c	optional	pci
 sparc64/pci/ofw_pcibus.c	optional	pci
 sparc64/pci/psycho.c		optional	pci
-sparc64/pci/sbbc.c		optional	uart sbbc
+sparc64/pci/sbbc.c		optional	sbbc uart
 sparc64/pci/schizo.c		optional	pci
 sparc64/sbus/dma_sbus.c		optional	sbus
 sparc64/sbus/sbus.c		optional	sbus

Modified: head/sys/conf/files.sun4v
==============================================================================
--- head/sys/conf/files.sun4v	Sat Apr 24 13:53:12 2010	(r207153)
+++ head/sys/conf/files.sun4v	Sat Apr 24 16:27:43 2010	(r207154)
@@ -18,12 +18,12 @@ ukbdmap.h			optional	ukbd_dflt_keymap	\
 	clean		"ukbdmap.h"
 #
 #
-crypto/blowfish/bf_enc.c	optional	crypto | ipsec 
+crypto/blowfish/bf_enc.c	optional	crypto | ipsec
 crypto/des/des_enc.c		optional	crypto | ipsec | netsmb
 dev/ofw/ofw_bus_if.m		standard
-dev/ofw/ofw_if.m		standard
 dev/ofw/ofw_bus_subr.c		standard
 dev/ofw/ofw_console.c		optional	ofw_console
+dev/ofw/ofw_if.m		standard
 dev/ofw/ofw_standard.c		standard
 dev/ofw/openfirm.c		standard
 dev/ofw/openfirmio.c		standard

From owner-svn-src-head@FreeBSD.ORG  Sat Apr 24 17:32:53 2010
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id B984E106564A;
	Sat, 24 Apr 2010 17:32:53 +0000 (UTC) (envelope-from alc@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id A55238FC0C;
	Sat, 24 Apr 2010 17:32:53 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o3OHWr5e098654;
	Sat, 24 Apr 2010 17:32:53 GMT (envelope-from alc@svn.freebsd.org)
Received: (from alc@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o3OHWrcB098640;
	Sat, 24 Apr 2010 17:32:53 GMT (envelope-from alc@svn.freebsd.org)
Message-Id: <201004241732.o3OHWrcB098640@svn.freebsd.org>
From: Alan Cox 
Date: Sat, 24 Apr 2010 17:32:53 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r207155 - in head/sys: amd64/amd64 arm/arm i386/i386
	i386/xen ia64/ia64 mips/mips powerpc/aim powerpc/booke
	powerpc/powerpc sparc64/sparc64 sun4v/sun4v vm
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Sat, 24 Apr 2010 17:32:54 -0000

Author: alc
Date: Sat Apr 24 17:32:52 2010
New Revision: 207155
URL: http://svn.freebsd.org/changeset/base/207155

Log:
  Resurrect pmap_is_referenced() and use it in mincore().  Essentially,
  pmap_ts_referenced() is not always appropriate for checking whether or
  not pages have been referenced because it clears any reference bits
  that it encounters.  For example, in mincore(), clearing the reference
  bits has two negative consequences.  First, it throws off the activity
  count calculations performed by the page daemon.  Specifically, a page
  on which mincore() has called pmap_ts_referenced() looks less active
  to the page daemon than it should.  Consequently, the page could be
  deactivated prematurely by the page daemon.  Arguably, this problem
  could be fixed by having mincore() duplicate the activity count
  calculation on the page.  However, there is a second problem for which
  that is not a solution.  In order to clear a reference on a 4KB page,
  it may be necessary to demote a 2/4MB page mapping.  Thus, a mincore()
  by one process can have the side effect of demoting a superpage
  mapping within another process!

Modified:
  head/sys/amd64/amd64/pmap.c
  head/sys/arm/arm/pmap.c
  head/sys/i386/i386/pmap.c
  head/sys/i386/xen/pmap.c
  head/sys/ia64/ia64/pmap.c
  head/sys/mips/mips/pmap.c
  head/sys/powerpc/aim/mmu_oea.c
  head/sys/powerpc/aim/mmu_oea64.c
  head/sys/powerpc/booke/pmap.c
  head/sys/powerpc/powerpc/mmu_if.m
  head/sys/powerpc/powerpc/pmap_dispatch.c
  head/sys/sparc64/sparc64/pmap.c
  head/sys/sun4v/sun4v/pmap.c
  head/sys/vm/pmap.h
  head/sys/vm/vm_mmap.c

Modified: head/sys/amd64/amd64/pmap.c
==============================================================================
--- head/sys/amd64/amd64/pmap.c	Sat Apr 24 16:27:43 2010	(r207154)
+++ head/sys/amd64/amd64/pmap.c	Sat Apr 24 17:32:52 2010	(r207155)
@@ -236,6 +236,7 @@ static void pmap_fill_ptp(pt_entry_t *fi
 static void pmap_insert_pt_page(pmap_t pmap, vm_page_t mpte);
 static void pmap_invalidate_cache_range(vm_offset_t sva, vm_offset_t eva);
 static boolean_t pmap_is_modified_pvh(struct md_page *pvh);
+static boolean_t pmap_is_referenced_pvh(struct md_page *pvh);
 static void pmap_kenter_attr(vm_offset_t va, vm_paddr_t pa, int mode);
 static vm_page_t pmap_lookup_pt_page(pmap_t pmap, vm_offset_t va);
 static void pmap_pde_attr(pd_entry_t *pde, int cache_bits);
@@ -4178,6 +4179,49 @@ pmap_is_prefaultable(pmap_t pmap, vm_off
 }
 
 /*
+ *	pmap_is_referenced:
+ *
+ *	Return whether or not the specified physical page was referenced
+ *	in any physical maps.
+ */
+boolean_t
+pmap_is_referenced(vm_page_t m)
+{
+
+	if (m->flags & PG_FICTITIOUS)
+		return (FALSE);
+	if (pmap_is_referenced_pvh(&m->md))
+		return (TRUE);
+	return (pmap_is_referenced_pvh(pa_to_pvh(VM_PAGE_TO_PHYS(m))));
+}
+
+/*
+ * Returns TRUE if any of the given mappings were referenced and FALSE
+ * otherwise.  Both page and 2mpage mappings are supported.
+ */
+static boolean_t
+pmap_is_referenced_pvh(struct md_page *pvh)
+{
+	pv_entry_t pv;
+	pt_entry_t *pte;
+	pmap_t pmap;
+	boolean_t rv;
+
+	mtx_assert(&vm_page_queue_mtx, MA_OWNED);
+	rv = FALSE;
+	TAILQ_FOREACH(pv, &pvh->pv_list, pv_list) {
+		pmap = PV_PMAP(pv);
+		PMAP_LOCK(pmap);
+		pte = pmap_pte(pmap, pv->pv_va);
+		rv = (*pte & (PG_A | PG_V)) == (PG_A | PG_V);
+		PMAP_UNLOCK(pmap);
+		if (rv)
+			break;
+	}
+	return (rv);
+}
+
+/*
  * Clear the write and modified bits in each of the given page's mappings.
  */
 void
@@ -4893,10 +4937,8 @@ pmap_mincore(pmap_t pmap, vm_offset_t ad
 			 */
 			vm_page_lock_queues();
 			if ((m->flags & PG_REFERENCED) ||
-			    pmap_ts_referenced(m)) {
+			    pmap_is_referenced(m))
 				val |= MINCORE_REFERENCED_OTHER;
-				vm_page_flag_set(m, PG_REFERENCED);
-			}
 			vm_page_unlock_queues();
 		}
 	} 

Modified: head/sys/arm/arm/pmap.c
==============================================================================
--- head/sys/arm/arm/pmap.c	Sat Apr 24 16:27:43 2010	(r207154)
+++ head/sys/arm/arm/pmap.c	Sat Apr 24 17:32:52 2010	(r207155)
@@ -4493,6 +4493,20 @@ pmap_clear_modify(vm_page_t m)
 
 
 /*
+ *	pmap_is_referenced:
+ *
+ *	Return whether or not the specified physical page was referenced
+ *	in any physical maps.
+ */
+boolean_t
+pmap_is_referenced(vm_page_t m)
+{
+
+	return ((m->flags & (PG_FICTITIOUS | PG_UNMANAGED)) == 0 &&
+	    (m->md.pvh_attrs & PVF_REF) != 0);
+}
+
+/*
  *	pmap_clear_reference:
  *
  *	Clear the reference bit on the specified physical page.

Modified: head/sys/i386/i386/pmap.c
==============================================================================
--- head/sys/i386/i386/pmap.c	Sat Apr 24 16:27:43 2010	(r207154)
+++ head/sys/i386/i386/pmap.c	Sat Apr 24 17:32:52 2010	(r207155)
@@ -296,6 +296,7 @@ static vm_page_t pmap_enter_quick_locked
 static void pmap_insert_pt_page(pmap_t pmap, vm_page_t mpte);
 static void pmap_fill_ptp(pt_entry_t *firstpte, pt_entry_t newpte);
 static boolean_t pmap_is_modified_pvh(struct md_page *pvh);
+static boolean_t pmap_is_referenced_pvh(struct md_page *pvh);
 static void pmap_kenter_attr(vm_offset_t va, vm_paddr_t pa, int mode);
 static void pmap_kenter_pde(vm_offset_t va, pd_entry_t newpde);
 static vm_page_t pmap_lookup_pt_page(pmap_t pmap, vm_offset_t va);
@@ -4356,6 +4357,51 @@ pmap_is_prefaultable(pmap_t pmap, vm_off
 }
 
 /*
+ *	pmap_is_referenced:
+ *
+ *	Return whether or not the specified physical page was referenced
+ *	in any physical maps.
+ */
+boolean_t
+pmap_is_referenced(vm_page_t m)
+{
+
+	if (m->flags & PG_FICTITIOUS)
+		return (FALSE);
+	if (pmap_is_referenced_pvh(&m->md))
+		return (TRUE);
+	return (pmap_is_referenced_pvh(pa_to_pvh(VM_PAGE_TO_PHYS(m))));
+}
+
+/*
+ * Returns TRUE if any of the given mappings were referenced and FALSE
+ * otherwise.  Both page and 4mpage mappings are supported.
+ */
+static boolean_t
+pmap_is_referenced_pvh(struct md_page *pvh)
+{
+	pv_entry_t pv;
+	pt_entry_t *pte;
+	pmap_t pmap;
+	boolean_t rv;
+
+	mtx_assert(&vm_page_queue_mtx, MA_OWNED);
+	rv = FALSE;
+	sched_pin();
+	TAILQ_FOREACH(pv, &pvh->pv_list, pv_list) {
+		pmap = PV_PMAP(pv);
+		PMAP_LOCK(pmap);
+		pte = pmap_pte_quick(pmap, pv->pv_va);
+		rv = (*pte & (PG_A | PG_V)) == (PG_A | PG_V);
+		PMAP_UNLOCK(pmap);
+		if (rv)
+			break;
+	}
+	sched_unpin();
+	return (rv);
+}
+
+/*
  * Clear the write and modified bits in each of the given page's mappings.
  */
 void
@@ -4961,10 +5007,8 @@ pmap_mincore(pmap_t pmap, vm_offset_t ad
 			 */
 			vm_page_lock_queues();
 			if ((m->flags & PG_REFERENCED) ||
-			    pmap_ts_referenced(m)) {
+			    pmap_is_referenced(m))
 				val |= MINCORE_REFERENCED_OTHER;
-				vm_page_flag_set(m, PG_REFERENCED);
-			}
 			vm_page_unlock_queues();
 		}
 	} 

Modified: head/sys/i386/xen/pmap.c
==============================================================================
--- head/sys/i386/xen/pmap.c	Sat Apr 24 16:27:43 2010	(r207154)
+++ head/sys/i386/xen/pmap.c	Sat Apr 24 17:32:52 2010	(r207155)
@@ -3718,6 +3718,34 @@ pmap_is_prefaultable(pmap_t pmap, vm_off
 	return (rv);
 }
 
+boolean_t
+pmap_is_referenced(vm_page_t m)
+{
+	pv_entry_t pv;
+	pt_entry_t *pte;
+	pmap_t pmap;
+	boolean_t rv;
+
+	rv = FALSE;
+	if (m->flags & PG_FICTITIOUS)
+		return (rv);
+	sched_pin();
+	mtx_assert(&vm_page_queue_mtx, MA_OWNED);
+	TAILQ_FOREACH(pv, &m->md.pv_list, pv_list) {
+		pmap = PV_PMAP(pv);
+		PMAP_LOCK(pmap);
+		pte = pmap_pte_quick(pmap, pv->pv_va);
+		rv = (*pte & (PG_A | PG_V)) == (PG_A | PG_V);
+		PMAP_UNLOCK(pmap);
+		if (rv)
+			break;
+	}
+	if (*PMAP1)
+		PT_SET_MA(PADDR1, 0);
+	sched_unpin();
+	return (rv);
+}
+
 void
 pmap_map_readonly(pmap_t pmap, vm_offset_t va, int len)
 {
@@ -4145,10 +4173,8 @@ pmap_mincore(pmap_t pmap, vm_offset_t ad
 			 */
 			vm_page_lock_queues();
 			if ((m->flags & PG_REFERENCED) ||
-			    pmap_ts_referenced(m)) {
+			    pmap_is_referenced(m))
 				val |= MINCORE_REFERENCED_OTHER;
-				vm_page_flag_set(m, PG_REFERENCED);
-			}
 			vm_page_unlock_queues();
 		}
 	} 

Modified: head/sys/ia64/ia64/pmap.c
==============================================================================
--- head/sys/ia64/ia64/pmap.c	Sat Apr 24 16:27:43 2010	(r207154)
+++ head/sys/ia64/ia64/pmap.c	Sat Apr 24 17:32:52 2010	(r207155)
@@ -2023,6 +2023,37 @@ pmap_is_prefaultable(pmap_t pmap, vm_off
 }
 
 /*
+ *	pmap_is_referenced:
+ *
+ *	Return whether or not the specified physical page was referenced
+ *	in any physical maps.
+ */
+boolean_t
+pmap_is_referenced(vm_page_t m)
+{
+	struct ia64_lpte *pte;
+	pmap_t oldpmap;
+	pv_entry_t pv;
+	boolean_t rv;
+
+	rv = FALSE;
+	if (m->flags & PG_FICTITIOUS)
+		return (rv);
+	TAILQ_FOREACH(pv, &m->md.pv_list, pv_list) {
+		PMAP_LOCK(pv->pv_pmap);
+		oldpmap = pmap_switch(pv->pv_pmap);
+		pte = pmap_find_vhpt(pv->pv_va);
+		pmap_switch(oldpmap);
+		KASSERT(pte != NULL, ("pte"));
+		rv = pmap_accessed(pte) ? TRUE : FALSE;
+		PMAP_UNLOCK(pv->pv_pmap);
+		if (rv)
+			break;
+	}
+	return (rv);
+}
+
+/*
  *	Clear the modify bits on the specified physical page.
  */
 void
@@ -2197,10 +2228,8 @@ pmap_mincore(pmap_t pmap, vm_offset_t ad
 			 * Referenced by someone
 			 */
 			vm_page_lock_queues();
-			if (pmap_ts_referenced(m)) {
+			if (pmap_is_referenced(m))
 				val |= MINCORE_REFERENCED_OTHER;
-				vm_page_flag_set(m, PG_REFERENCED);
-			}
 			vm_page_unlock_queues();
 		}
 	} 

Modified: head/sys/mips/mips/pmap.c
==============================================================================
--- head/sys/mips/mips/pmap.c	Sat Apr 24 16:27:43 2010	(r207154)
+++ head/sys/mips/mips/pmap.c	Sat Apr 24 17:32:52 2010	(r207155)
@@ -2626,6 +2626,20 @@ pmap_clear_modify(vm_page_t m)
 }
 
 /*
+ *	pmap_is_referenced:
+ *
+ *	Return whether or not the specified physical page was referenced
+ *	in any physical maps.
+ */
+boolean_t
+pmap_is_referenced(vm_page_t m)
+{
+
+	return ((m->flags & PG_FICTITIOUS) == 0 &&
+	    (m->md.pv_flags & PV_TABLE_REF) != 0);
+}
+
+/*
  *	pmap_clear_reference:
  *
  *	Clear the reference bit on the specified physical page.
@@ -2750,10 +2764,8 @@ pmap_mincore(pmap_t pmap, vm_offset_t ad
 		 * Referenced by us or someone
 		 */
 		vm_page_lock_queues();
-		if ((m->flags & PG_REFERENCED) || pmap_ts_referenced(m)) {
+		if ((m->flags & PG_REFERENCED) || pmap_is_referenced(m))
 			val |= MINCORE_REFERENCED | MINCORE_REFERENCED_OTHER;
-			vm_page_flag_set(m, PG_REFERENCED);
-		}
 		vm_page_unlock_queues();
 	}
 	return val;

Modified: head/sys/powerpc/aim/mmu_oea.c
==============================================================================
--- head/sys/powerpc/aim/mmu_oea.c	Sat Apr 24 16:27:43 2010	(r207154)
+++ head/sys/powerpc/aim/mmu_oea.c	Sat Apr 24 17:32:52 2010	(r207155)
@@ -305,6 +305,7 @@ vm_paddr_t moea_extract(mmu_t, pmap_t, v
 vm_page_t moea_extract_and_hold(mmu_t, pmap_t, vm_offset_t, vm_prot_t);
 void moea_init(mmu_t);
 boolean_t moea_is_modified(mmu_t, vm_page_t);
+boolean_t moea_is_referenced(mmu_t, vm_page_t);
 boolean_t moea_ts_referenced(mmu_t, vm_page_t);
 vm_offset_t moea_map(mmu_t, vm_offset_t *, vm_offset_t, vm_offset_t, int);
 boolean_t moea_page_exists_quick(mmu_t, pmap_t, vm_page_t);
@@ -344,6 +345,7 @@ static mmu_method_t moea_methods[] = {
 	MMUMETHOD(mmu_extract_and_hold,	moea_extract_and_hold),
 	MMUMETHOD(mmu_init,		moea_init),
 	MMUMETHOD(mmu_is_modified,	moea_is_modified),
+	MMUMETHOD(mmu_is_referenced,	moea_is_referenced),
 	MMUMETHOD(mmu_ts_referenced,	moea_ts_referenced),
 	MMUMETHOD(mmu_map,     		moea_map),
 	MMUMETHOD(mmu_page_exists_quick,moea_page_exists_quick),
@@ -1269,6 +1271,15 @@ moea_init(mmu_t mmu)
 }
 
 boolean_t
+moea_is_referenced(mmu_t mmu, vm_page_t m)
+{
+
+	if ((m->flags & (PG_FICTITIOUS | PG_UNMANAGED)) != 0)
+		return (FALSE);
+	return (moea_query_bit(m, PTE_REF));
+}
+
+boolean_t
 moea_is_modified(mmu_t mmu, vm_page_t m)
 {
 

Modified: head/sys/powerpc/aim/mmu_oea64.c
==============================================================================
--- head/sys/powerpc/aim/mmu_oea64.c	Sat Apr 24 16:27:43 2010	(r207154)
+++ head/sys/powerpc/aim/mmu_oea64.c	Sat Apr 24 17:32:52 2010	(r207155)
@@ -379,6 +379,7 @@ vm_paddr_t moea64_extract(mmu_t, pmap_t,
 vm_page_t moea64_extract_and_hold(mmu_t, pmap_t, vm_offset_t, vm_prot_t);
 void moea64_init(mmu_t);
 boolean_t moea64_is_modified(mmu_t, vm_page_t);
+boolean_t moea64_is_referenced(mmu_t, vm_page_t);
 boolean_t moea64_ts_referenced(mmu_t, vm_page_t);
 vm_offset_t moea64_map(mmu_t, vm_offset_t *, vm_offset_t, vm_offset_t, int);
 boolean_t moea64_page_exists_quick(mmu_t, pmap_t, vm_page_t);
@@ -416,6 +417,7 @@ static mmu_method_t moea64_bridge_method
 	MMUMETHOD(mmu_extract_and_hold,	moea64_extract_and_hold),
 	MMUMETHOD(mmu_init,		moea64_init),
 	MMUMETHOD(mmu_is_modified,	moea64_is_modified),
+	MMUMETHOD(mmu_is_referenced,	moea64_is_referenced),
 	MMUMETHOD(mmu_ts_referenced,	moea64_ts_referenced),
 	MMUMETHOD(mmu_map,     		moea64_map),
 	MMUMETHOD(mmu_page_exists_quick,moea64_page_exists_quick),
@@ -1463,6 +1465,15 @@ moea64_init(mmu_t mmu)
 }
 
 boolean_t
+moea64_is_referenced(mmu_t mmu, vm_page_t m)
+{
+
+	if ((m->flags & (PG_FICTITIOUS | PG_UNMANAGED)) != 0)
+		return (FALSE);
+	return (moea64_query_bit(m, PTE_REF));
+}
+
+boolean_t
 moea64_is_modified(mmu_t mmu, vm_page_t m)
 {
 

Modified: head/sys/powerpc/booke/pmap.c
==============================================================================
--- head/sys/powerpc/booke/pmap.c	Sat Apr 24 16:27:43 2010	(r207154)
+++ head/sys/powerpc/booke/pmap.c	Sat Apr 24 17:32:52 2010	(r207155)
@@ -288,6 +288,7 @@ static vm_page_t	mmu_booke_extract_and_h
 static void		mmu_booke_init(mmu_t);
 static boolean_t	mmu_booke_is_modified(mmu_t, vm_page_t);
 static boolean_t	mmu_booke_is_prefaultable(mmu_t, pmap_t, vm_offset_t);
+static boolean_t	mmu_booke_is_referenced(mmu_t, vm_page_t);
 static boolean_t	mmu_booke_ts_referenced(mmu_t, vm_page_t);
 static vm_offset_t	mmu_booke_map(mmu_t, vm_offset_t *, vm_offset_t, vm_offset_t,
     int);
@@ -342,6 +343,7 @@ static mmu_method_t mmu_booke_methods[] 
 	MMUMETHOD(mmu_init,		mmu_booke_init),
 	MMUMETHOD(mmu_is_modified,	mmu_booke_is_modified),
 	MMUMETHOD(mmu_is_prefaultable,	mmu_booke_is_prefaultable),
+	MMUMETHOD(mmu_is_referenced,	mmu_booke_is_referenced),
 	MMUMETHOD(mmu_ts_referenced,	mmu_booke_ts_referenced),
 	MMUMETHOD(mmu_map,		mmu_booke_map),
 	MMUMETHOD(mmu_mincore,		mmu_booke_mincore),
@@ -2181,6 +2183,33 @@ mmu_booke_is_prefaultable(mmu_t mmu, pma
 }
 
 /*
+ * Return whether or not the specified physical page was referenced
+ * in any physical maps.
+ */
+static boolean_t
+mmu_booke_is_referenced(mmu_t mmu, vm_page_t m)
+{
+	pte_t *pte;
+	pv_entry_t pv;
+	boolean_t rv;
+
+	mtx_assert(&vm_page_queue_mtx, MA_OWNED);
+	rv = FALSE;
+	if ((m->flags & (PG_FICTITIOUS | PG_UNMANAGED)) != 0)
+		return (rv);
+	TAILQ_FOREACH(pv, &m->md.pv_list, pv_link) {
+		PMAP_LOCK(pv->pv_pmap);
+		if ((pte = pte_find(mmu, pv->pv_pmap, pv->pv_va)) != NULL &&
+		    PTE_ISVALID(pte))
+			rv = PTE_ISREFERENCED(pte) ? TRUE : FALSE;
+		PMAP_UNLOCK(pv->pv_pmap);
+		if (rv)
+			break;
+	}
+	return (rv);
+}
+
+/*
  * Clear the modify bits on the specified physical page.
  */
 static void

Modified: head/sys/powerpc/powerpc/mmu_if.m
==============================================================================
--- head/sys/powerpc/powerpc/mmu_if.m	Sat Apr 24 16:27:43 2010	(r207154)
+++ head/sys/powerpc/powerpc/mmu_if.m	Sat Apr 24 17:32:52 2010	(r207155)
@@ -346,6 +346,20 @@ METHOD boolean_t is_prefaultable {
 
 
 /**
+ * @brief Return whether or not the specified physical page was referenced
+ * in any physical maps.
+ *
+ * @params _pg		physical page
+ *
+ * @retval boolean	TRUE if page has been referenced
+ */
+METHOD boolean_t is_referenced {
+	mmu_t		_mmu;
+	vm_page_t	_pg;
+};
+
+
+/**
  * @brief Return a count of referenced bits for a page, clearing those bits.
  * Not all referenced bits need to be cleared, but it is necessary that 0
  * only be returned when there are none set.

Modified: head/sys/powerpc/powerpc/pmap_dispatch.c
==============================================================================
--- head/sys/powerpc/powerpc/pmap_dispatch.c	Sat Apr 24 16:27:43 2010	(r207154)
+++ head/sys/powerpc/powerpc/pmap_dispatch.c	Sat Apr 24 17:32:52 2010	(r207155)
@@ -195,6 +195,14 @@ pmap_is_prefaultable(pmap_t pmap, vm_off
 }
 
 boolean_t
+pmap_is_referenced(vm_page_t m)
+{
+
+	CTR2(KTR_PMAP, "%s(%p)", __func__, m);
+	return (MMU_IS_REFERENCED(mmu_obj, m));
+}
+
+boolean_t
 pmap_ts_referenced(vm_page_t m)
 {
 

Modified: head/sys/sparc64/sparc64/pmap.c
==============================================================================
--- head/sys/sparc64/sparc64/pmap.c	Sat Apr 24 16:27:43 2010	(r207154)
+++ head/sys/sparc64/sparc64/pmap.c	Sat Apr 24 17:32:52 2010	(r207155)
@@ -1917,6 +1917,27 @@ pmap_is_prefaultable(pmap_t pmap, vm_off
 	return (FALSE);
 }
 
+/*
+ * Return whether or not the specified physical page was referenced
+ * in any physical maps.
+ */
+boolean_t
+pmap_is_referenced(vm_page_t m)
+{
+	struct tte *tp;
+
+	mtx_assert(&vm_page_queue_mtx, MA_OWNED);
+	if ((m->flags & (PG_FICTITIOUS | PG_UNMANAGED)) != 0)
+		return (FALSE);
+	TAILQ_FOREACH(tp, &m->md.tte_list, tte_link) {
+		if ((tp->tte_data & TD_PV) == 0)
+			continue;
+		if ((tp->tte_data & TD_REF) != 0)
+			return (TRUE);
+	}
+	return (FALSE);
+}
+
 void
 pmap_clear_modify(vm_page_t m)
 {

Modified: head/sys/sun4v/sun4v/pmap.c
==============================================================================
--- head/sys/sun4v/sun4v/pmap.c	Sat Apr 24 16:27:43 2010	(r207154)
+++ head/sys/sun4v/sun4v/pmap.c	Sat Apr 24 17:32:52 2010	(r207155)
@@ -1592,6 +1592,17 @@ pmap_is_prefaultable(pmap_t pmap, vm_off
 }
 
 /*
+ * Return whether or not the specified physical page was referenced
+ * in any physical maps.
+ */
+boolean_t
+pmap_is_referenced(vm_page_t m)
+{
+
+	return (tte_get_phys_bit(m, VTD_REF));
+}
+
+/*
  * Extract the physical page address associated with the given kernel virtual
  * address.
  */

Modified: head/sys/vm/pmap.h
==============================================================================
--- head/sys/vm/pmap.h	Sat Apr 24 16:27:43 2010	(r207154)
+++ head/sys/vm/pmap.h	Sat Apr 24 17:32:52 2010	(r207155)
@@ -119,6 +119,7 @@ void		 pmap_growkernel(vm_offset_t);
 void		 pmap_init(void);
 boolean_t	 pmap_is_modified(vm_page_t m);
 boolean_t	 pmap_is_prefaultable(pmap_t pmap, vm_offset_t va);
+boolean_t	 pmap_is_referenced(vm_page_t m);
 boolean_t	 pmap_ts_referenced(vm_page_t m);
 vm_offset_t	 pmap_map(vm_offset_t *, vm_paddr_t, vm_paddr_t, int);
 void		 pmap_object_init_pt(pmap_t pmap, vm_offset_t addr,

Modified: head/sys/vm/vm_mmap.c
==============================================================================
--- head/sys/vm/vm_mmap.c	Sat Apr 24 16:27:43 2010	(r207154)
+++ head/sys/vm/vm_mmap.c	Sat Apr 24 17:32:52 2010	(r207155)
@@ -871,10 +871,8 @@ RestartScan:
 						pmap_is_modified(m))
 						mincoreinfo |= MINCORE_MODIFIED_OTHER;
 					if ((m->flags & PG_REFERENCED) ||
-						pmap_ts_referenced(m)) {
-						vm_page_flag_set(m, PG_REFERENCED);
+					    pmap_is_referenced(m))
 						mincoreinfo |= MINCORE_REFERENCED_OTHER;
-					}
 					vm_page_unlock_queues();
 				}
 				VM_OBJECT_UNLOCK(current->object.vm_object);

From owner-svn-src-head@FreeBSD.ORG  Sat Apr 24 18:13:13 2010
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 4CFBB106564A;
	Sat, 24 Apr 2010 18:13:13 +0000 (UTC)
	(envelope-from rnoland@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 3C0EC8FC0A;
	Sat, 24 Apr 2010 18:13:13 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o3OIDCWs007890;
	Sat, 24 Apr 2010 18:13:12 GMT (envelope-from rnoland@svn.freebsd.org)
Received: (from rnoland@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o3OIDCxa007888;
	Sat, 24 Apr 2010 18:13:12 GMT (envelope-from rnoland@svn.freebsd.org)
Message-Id: <201004241813.o3OIDCxa007888@svn.freebsd.org>
From: Robert Noland 
Date: Sat, 24 Apr 2010 18:13:12 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r207156 - head/sys/dev/drm
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Sat, 24 Apr 2010 18:13:13 -0000

Author: rnoland
Date: Sat Apr 24 18:13:12 2010
New Revision: 207156
URL: http://svn.freebsd.org/changeset/base/207156

Log:
  remove vm obect tracker that slipped in from prior work.
  
  MFC after:	2 weeks

Modified:
  head/sys/dev/drm/drmP.h

Modified: head/sys/dev/drm/drmP.h
==============================================================================
--- head/sys/dev/drm/drmP.h	Sat Apr 24 17:32:52 2010	(r207155)
+++ head/sys/dev/drm/drmP.h	Sat Apr 24 18:13:12 2010	(r207156)
@@ -481,7 +481,6 @@ typedef struct drm_sg_mem {
 	vm_offset_t vaddr;
 	vm_paddr_t *busaddr;
 	vm_pindex_t pages;
-	vm_object_t obj;
 } drm_sg_mem_t;
 
 #define DRM_MAP_HANDLE_BITS	(sizeof(void *) == 4 ? 4 : 24)

From owner-svn-src-head@FreeBSD.ORG  Sat Apr 24 19:51:54 2010
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 5A763106564A;
	Sat, 24 Apr 2010 19:51:54 +0000 (UTC)
	(envelope-from a_best01@uni-muenster.de)
Received: from zivm-relay2.uni-muenster.de (ZIVM-RELAY2.UNI-MUENSTER.DE
	[128.176.192.13])
	by mx1.freebsd.org (Postfix) with ESMTP id B2D1F8FC14;
	Sat, 24 Apr 2010 19:51:53 +0000 (UTC)
X-IronPort-AV: E=Sophos;i="4.52,267,1270418400"; d="scan'208";a="242933116"
Received: from zivmaildisp1.uni-muenster.de (HELO
	ZIVMAILUSER03.UNI-MUENSTER.DE) ([128.176.188.85])
	by zivm-relay2.uni-muenster.de with ESMTP; 24 Apr 2010 21:51:52 +0200
Received: by ZIVMAILUSER03.UNI-MUENSTER.DE (Postfix, from userid 149459)
	id 8F6981B0758; Sat, 24 Apr 2010 21:51:52 +0200 (CEST)
Date: Sat, 24 Apr 2010 21:51:51 +0200 (CEST)
From: Alexander Best 
Sender: 
Organization: Westfaelische Wilhelms-Universitaet Muenster
To: Jeff Roberson 
Message-ID: 
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org
Subject: Re: svn commit: r207141 - in head: lib/libufs sbin/dumpfs
 sbin/fsck_ffs sbin/fsdb sbin/tunefs sys/kern sys/sys sys/ufs/ffs
 sys/ufs/ufs usr.sbin/makefs/ffs
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Sat, 24 Apr 2010 19:51:54 -0000

great news to finally have SUJ in HEAD. will you also be adding a -j switch to
newfs(8)? a SUJ entry in UPDATING will probably appear in the next few days i
believe?

-- 
Alexander Best

From owner-svn-src-head@FreeBSD.ORG  Sat Apr 24 20:10:39 2010
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 234C4106564A;
	Sat, 24 Apr 2010 20:10:39 +0000 (UTC)
	(envelope-from a_best01@uni-muenster.de)
Received: from zivm-relay3.uni-muenster.de (ZIVM-RELAY3.UNI-MUENSTER.DE
	[128.176.192.19])
	by mx1.freebsd.org (Postfix) with ESMTP id 4BBB78FC12;
	Sat, 24 Apr 2010 20:10:37 +0000 (UTC)
X-IronPort-AV: E=Sophos;i="4.52,267,1270418400"; 
	d="txt'?scan'208";a="32172949"
Received: from zivmaildisp1.uni-muenster.de (HELO
	ZIVMAILUSER05.UNI-MUENSTER.DE) ([128.176.188.85])
	by zivm-relay3.uni-muenster.de with ESMTP; 24 Apr 2010 22:10:25 +0200
Received: by ZIVMAILUSER05.UNI-MUENSTER.DE (Postfix, from userid 149459)
	id 5C9D81B07E7; Sat, 24 Apr 2010 22:10:25 +0200 (CEST)
Date: Sat, 24 Apr 2010 22:10:18 +0200 (CEST)
From: Alexander Best 
Sender: 
Organization: Westfaelische Wilhelms-Universitaet Muenster
To: Luigi Rizzo 
Message-ID: 
MIME-Version: 1.0
Content-Type: multipart/mixed;
	boundary=+permail-20100424201018f7e55a9d00007b30-a_best01+
Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org
Subject: Re: svn commit: r206497 - in head: sbin/geom/class
 sbin/geom/class/sched sys/geom/sched sys/modules/geom
 sys/modules/geom/geom_sched sys/modules/geom/geom_sched/gs_sched
 sys/modules/geom/geom_sched/gsc...
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Sat, 24 Apr 2010 20:10:39 -0000

  This is a MIME encoded multipart message.

--+permail-20100424201018f7e55a9d00007b30-a_best01+
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

tiny patch to fix a typo in the gsched(8) manual. ;)

-- 
Alexander Best

--+permail-20100424201018f7e55a9d00007b30-a_best01+
Content-Type: text/plain
Content-Transfer-Encoding: Base64
Content-Disposition: attachment; filename="gsched.8.patch.txt"

SW5kZXg6IHNiaW4vZ2VvbS9jbGFzcy9zY2hlZC9nc2NoZWQuOAo9PT09PT09PT09PT09PT09PT09
PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09Ci0tLSBzYmlu
L2dlb20vY2xhc3Mvc2NoZWQvZ3NjaGVkLjgJKHJldmlzaW9uIDIwNzE1NCkKKysrIHNiaW4vZ2Vv
bS9jbGFzcy9zY2hlZC9nc2NoZWQuOAkod29ya2luZyBjb3B5KQpAQCAtOTMsOCArOTMsOCBAQAog
b24gYW4gYWxyZWFkeSBleGlzdGluZyBwcm92aWRlci4KIC5QcAogQSBzdWJzZXF1ZW50ICdkZXN0
cm95JyB3aWxsIHJlbW92ZSB0aGUgbmV3bHkgY3JlYXRlZCBnZW9tIGFuZAotaG9vayB0aGUgcHJv
dmlkZXIgYmFjayB0byB0aGUgb3JpZ2luYWwgZ2VvbS4KLS5BciBhbGdvcml0aG0KK2hvb2sgdGhl
IHByb3ZpZGVyIGJhY2sgdG8gdGhlIG9yaWdpbmFsIGdlb20KKy5BciBhbGdvcml0aG0gLgogLkl0
IENtIGNvbmZpZ3VyZQogQ29uZmlndXJlIGV4aXN0aW5nIHNjaGVkdWxpbmcgcHJvdmlkZXIuICBJ
dCBzdXBwb3J0cyB0aGUgc2FtZSBvcHRpb25zCiBhcyB0aGUgCg==

--+permail-20100424201018f7e55a9d00007b30-a_best01+--

From owner-svn-src-head@FreeBSD.ORG  Sat Apr 24 20:18:36 2010
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 3952D106566B
	for ; Sat, 24 Apr 2010 20:18:36 +0000 (UTC)
	(envelope-from dougb@FreeBSD.org)
Received: from mail2.fluidhosting.com (mx23.fluidhosting.com [204.14.89.6])
	by mx1.freebsd.org (Postfix) with ESMTP id BE1058FC1C
	for ; Sat, 24 Apr 2010 20:18:35 +0000 (UTC)
Received: (qmail 15779 invoked by uid 399); 24 Apr 2010 20:18:33 -0000
Received: from localhost (HELO foreign.dougb.net)
	(dougb@dougbarton.us@127.0.0.1)
	by localhost with ESMTPAM; 24 Apr 2010 20:18:33 -0000
X-Originating-IP: 127.0.0.1
X-Sender: dougb@dougbarton.us
Message-ID: <4BD35218.8000000@FreeBSD.org>
Date: Sat, 24 Apr 2010 13:18:32 -0700
From: Doug Barton 
Organization: http://SupersetSolutions.com/
User-Agent: Mozilla/5.0 (X11; U; FreeBSD i386; en-US;
	rv:1.9.1.9) Gecko/20100330 Thunderbird/3.0.4
MIME-Version: 1.0
To: Jilles Tjoelker 
References: <201004241353.o3ODrC0L049712@svn.freebsd.org>
In-Reply-To: <201004241353.o3ODrC0L049712@svn.freebsd.org>
X-Enigmail-Version: 1.0.1
OpenPGP: id=1A1ABC84
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 7bit
Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org,
	src-committers@freebsd.org, Ighighi 
Subject: Re: svn commit: r207153 - head/usr.bin/stat
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Sat, 24 Apr 2010 20:18:36 -0000

On 04/24/10 06:53, Jilles Tjoelker wrote:
> Author: jilles
> Date: Sat Apr 24 13:53:12 2010
> New Revision: 207153
> URL: http://svn.freebsd.org/changeset/base/207153
> 
> Log:
>   stat: Allow -f %Sf to display the file flags symbolically.
>   
>   I have changed the patch slightly to show '-' if there are no flags just
>   like ls -ldo does.
>   
>   PR:		124349
>   Submitted by:	Ighighi
>   MFC after:	1 week

FYI, I originally imported the version of stat(1) we have in our tree
from NetBSD, although admittedly I haven't kept up with the updates
they've made to it. You (either jilles or the PR submitter) might want
to communicate with the NetBSD folks about this change, and if you're
really interested compare our version to theirs and include any other
interesting updates from their tree.
http://cvsweb.netbsd.org/bsdweb.cgi/src/usr.bin/stat/

While you're certainly under no obligation to do any of this, please let
me know your intentions so that if you're not interested I can add it to
my TODO list. :)


Regards,

Doug

-- 

	... and that's just a little bit of history repeating.
			-- Propellerheads

	Improve the effectiveness of your Internet presence with
	a domain name makeover!    http://SupersetSolutions.com/


From owner-svn-src-head@FreeBSD.ORG  Sat Apr 24 21:17:08 2010
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 53F81106566C;
	Sat, 24 Apr 2010 21:17:08 +0000 (UTC)
	(envelope-from kmacy@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 434228FC14;
	Sat, 24 Apr 2010 21:17:08 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o3OLH7Li048861;
	Sat, 24 Apr 2010 21:17:07 GMT (envelope-from kmacy@svn.freebsd.org)
Received: (from kmacy@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o3OLH7Wd048859;
	Sat, 24 Apr 2010 21:17:07 GMT (envelope-from kmacy@svn.freebsd.org)
Message-Id: <201004242117.o3OLH7Wd048859@svn.freebsd.org>
From: Kip Macy 
Date: Sat, 24 Apr 2010 21:17:07 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r207161 - head/sys/amd64/amd64
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Sat, 24 Apr 2010 21:17:08 -0000

Author: kmacy
Date: Sat Apr 24 21:17:07 2010
New Revision: 207161
URL: http://svn.freebsd.org/changeset/base/207161

Log:
  apply style(9) changes applied to head_page_lock_2
  
  requested by: kib@

Modified:
  head/sys/amd64/amd64/pmap.c

Modified: head/sys/amd64/amd64/pmap.c
==============================================================================
--- head/sys/amd64/amd64/pmap.c	Sat Apr 24 21:05:08 2010	(r207160)
+++ head/sys/amd64/amd64/pmap.c	Sat Apr 24 21:17:07 2010	(r207161)
@@ -284,7 +284,7 @@ pmap_kmem_choose(vm_offset_t addr)
 	vm_offset_t newaddr = addr;
 
 	newaddr = (addr + (NBPDR - 1)) & ~(NBPDR - 1);
-	return newaddr;
+	return (newaddr);
 }
 
 /********************/
@@ -295,7 +295,7 @@ pmap_kmem_choose(vm_offset_t addr)
 static __inline vm_pindex_t
 pmap_pde_pindex(vm_offset_t va)
 {
-	return va >> PDRSHIFT;
+	return (va >> PDRSHIFT);
 }
 
 
@@ -354,7 +354,7 @@ pmap_pdpe(pmap_t pmap, vm_offset_t va)
 
 	pml4e = pmap_pml4e(pmap, va);
 	if ((*pml4e & PG_V) == 0)
-		return NULL;
+		return (NULL);
 	return (pmap_pml4e_to_pdpe(pml4e, va));
 }
 
@@ -376,7 +376,7 @@ pmap_pde(pmap_t pmap, vm_offset_t va)
 
 	pdpe = pmap_pdpe(pmap, va);
 	if (pdpe == NULL || (*pdpe & PG_V) == 0)
-		 return NULL;
+		return (NULL);
 	return (pmap_pdpe_to_pde(pdpe, va));
 }
 
@@ -398,7 +398,7 @@ pmap_pte(pmap_t pmap, vm_offset_t va)
 
 	pde = pmap_pde(pmap, va);
 	if (pde == NULL || (*pde & PG_V) == 0)
-		return NULL;
+		return (NULL);
 	if ((*pde & PG_PS) != 0)	/* compat with i386 pmap_pte() */
 		return ((pt_entry_t *)pde);
 	return (pmap_pde_to_pte(pde, va));
@@ -1237,7 +1237,7 @@ pmap_kextract(vm_offset_t va)
 			pa = (pa & PG_FRAME) | (va & PAGE_MASK);
 		}
 	}
-	return pa;
+	return (pa);
 }
 
 /***************************************************
@@ -1467,9 +1467,9 @@ pmap_unwire_pte_hold(pmap_t pmap, vm_off
 
 	--m->wire_count;
 	if (m->wire_count == 0)
-		return _pmap_unwire_pte_hold(pmap, va, m, free);
+		return (_pmap_unwire_pte_hold(pmap, va, m, free));
 	else
-		return 0;
+		return (0);
 }
 
 static int 
@@ -1525,7 +1525,7 @@ _pmap_unwire_pte_hold(pmap_t pmap, vm_of
 	 */
 	pmap_add_delayed_free_list(m, free, TRUE);
 	
-	return 1;
+	return (1);
 }
 
 /*
@@ -1538,10 +1538,10 @@ pmap_unuse_pt(pmap_t pmap, vm_offset_t v
 	vm_page_t mpte;
 
 	if (va >= VM_MAXUSER_ADDRESS)
-		return 0;
+		return (0);
 	KASSERT(ptepde != 0, ("pmap_unuse_pt: ptepde != 0"));
 	mpte = PHYS_TO_VM_PAGE(ptepde & PG_FRAME);
-	return pmap_unwire_pte_hold(pmap, va, mpte, free);
+	return (pmap_unwire_pte_hold(pmap, va, mpte, free));
 }
 
 void
@@ -1732,7 +1732,7 @@ _pmap_allocpte(pmap_t pmap, vm_pindex_t 
 
 	pmap->pm_stats.resident_count++;
 
-	return m;
+	return (m);
 }
 
 static vm_page_t
@@ -3510,7 +3510,7 @@ pmap_enter_quick_locked(pmap_t pmap, vm_
 		pte_store(pte, pa | PG_V | PG_U);
 	else
 		pte_store(pte, pa | PG_V | PG_U | PG_MANAGED);
-	return mpte;
+	return (mpte);
 }
 
 /*
@@ -3887,12 +3887,12 @@ pmap_page_exists_quick(pmap_t pmap, vm_p
 	int loops = 0;
 
 	if (m->flags & PG_FICTITIOUS)
-		return FALSE;
+		return (FALSE);
 
 	mtx_assert(&vm_page_queue_mtx, MA_OWNED);
 	TAILQ_FOREACH(pv, &m->md.pv_list, pv_list) {
 		if (PV_PMAP(pv) == pmap) {
-			return TRUE;
+			return (TRUE);
 		}
 		loops++;
 		if (loops >= 16)
@@ -4908,7 +4908,7 @@ pmap_mincore(pmap_t pmap, vm_offset_t ad
 	if (pte != 0) {
 		val |= MINCORE_INCORE;
 		if ((pte & PG_MANAGED) == 0)
-			return val;
+			return (val);
 
 		m = PHYS_TO_VM_PAGE(pa);
 
@@ -4942,7 +4942,7 @@ pmap_mincore(pmap_t pmap, vm_offset_t ad
 			vm_page_unlock_queues();
 		}
 	} 
-	return val;
+	return (val);
 }
 
 void

From owner-svn-src-head@FreeBSD.ORG  Sat Apr 24 21:36:53 2010
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 30671106566B;
	Sat, 24 Apr 2010 21:36:53 +0000 (UTC)
	(envelope-from kmacy@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 2009A8FC0A;
	Sat, 24 Apr 2010 21:36:53 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o3OLarsg053293;
	Sat, 24 Apr 2010 21:36:53 GMT (envelope-from kmacy@svn.freebsd.org)
Received: (from kmacy@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o3OLarpq053291;
	Sat, 24 Apr 2010 21:36:53 GMT (envelope-from kmacy@svn.freebsd.org)
Message-Id: <201004242136.o3OLarpq053291@svn.freebsd.org>
From: Kip Macy 
Date: Sat, 24 Apr 2010 21:36:52 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r207163 - head/sys/i386/i386
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Sat, 24 Apr 2010 21:36:53 -0000

Author: kmacy
Date: Sat Apr 24 21:36:52 2010
New Revision: 207163
URL: http://svn.freebsd.org/changeset/base/207163

Log:
  - fix style issues on i386 as well
  
  requested by: alc@

Modified:
  head/sys/i386/i386/pmap.c

Modified: head/sys/i386/i386/pmap.c
==============================================================================
--- head/sys/i386/i386/pmap.c	Sat Apr 24 21:20:43 2010	(r207162)
+++ head/sys/i386/i386/pmap.c	Sat Apr 24 21:36:52 2010	(r207163)
@@ -1607,9 +1607,9 @@ pmap_unwire_pte_hold(pmap_t pmap, vm_pag
 
 	--m->wire_count;
 	if (m->wire_count == 0)
-		return _pmap_unwire_pte_hold(pmap, m, free);
+		return (_pmap_unwire_pte_hold(pmap, m, free));
 	else
-		return 0;
+		return (0);
 }
 
 static int 
@@ -1643,7 +1643,7 @@ _pmap_unwire_pte_hold(pmap_t pmap, vm_pa
 	 */
 	pmap_add_delayed_free_list(m, free, TRUE);
 
-	return 1;
+	return (1);
 }
 
 /*
@@ -1657,10 +1657,10 @@ pmap_unuse_pt(pmap_t pmap, vm_offset_t v
 	vm_page_t mpte;
 
 	if (va >= VM_MAXUSER_ADDRESS)
-		return 0;
+		return (0);
 	ptepde = *pmap_pde(pmap, va);
 	mpte = PHYS_TO_VM_PAGE(ptepde & PG_FRAME);
-	return pmap_unwire_pte_hold(pmap, mpte, free);
+	return (pmap_unwire_pte_hold(pmap, mpte, free));
 }
 
 void
@@ -1811,7 +1811,7 @@ _pmap_allocpte(pmap_t pmap, unsigned pte
 	pmap->pm_pdir[ptepindex] =
 		(pd_entry_t) (ptepa | PG_U | PG_RW | PG_V | PG_A | PG_M);
 
-	return m;
+	return (m);
 }
 
 static vm_page_t
@@ -2009,7 +2009,7 @@ kvm_size(SYSCTL_HANDLER_ARGS)
 {
 	unsigned long ksize = VM_MAX_KERNEL_ADDRESS - KERNBASE;
 
-	return sysctl_handle_long(oidp, &ksize, 0, req);
+	return (sysctl_handle_long(oidp, &ksize, 0, req));
 }
 SYSCTL_PROC(_vm, OID_AUTO, kvm_size, CTLTYPE_LONG|CTLFLAG_RD, 
     0, 0, kvm_size, "IU", "Size of KVM");
@@ -2019,7 +2019,7 @@ kvm_free(SYSCTL_HANDLER_ARGS)
 {
 	unsigned long kfree = VM_MAX_KERNEL_ADDRESS - kernel_vm_end;
 
-	return sysctl_handle_long(oidp, &kfree, 0, req);
+	return (sysctl_handle_long(oidp, &kfree, 0, req));
 }
 SYSCTL_PROC(_vm, OID_AUTO, kvm_free, CTLTYPE_LONG|CTLFLAG_RD, 
     0, 0, kvm_free, "IU", "Amount of KVM free");
@@ -2083,7 +2083,7 @@ static __inline struct pv_chunk *
 pv_to_chunk(pv_entry_t pv)
 {
 
-	return (struct pv_chunk *)((uintptr_t)pv & ~(uintptr_t)PAGE_MASK);
+	return ((struct pv_chunk *)((uintptr_t)pv & ~(uintptr_t)PAGE_MASK));
 }
 
 #define PV_PMAP(pv) (pv_to_chunk(pv)->pc_pmap)
@@ -3662,7 +3662,7 @@ pmap_enter_quick_locked(pmap_t pmap, vm_
 		pte_store(pte, pa | PG_V | PG_U);
 	else
 		pte_store(pte, pa | PG_V | PG_U | PG_MANAGED);
-	return mpte;
+	return (mpte);
 }
 
 /*
@@ -4059,12 +4059,12 @@ pmap_page_exists_quick(pmap_t pmap, vm_p
 	int loops = 0;
 
 	if (m->flags & PG_FICTITIOUS)
-		return FALSE;
+		return (FALSE);
 
 	mtx_assert(&vm_page_queue_mtx, MA_OWNED);
 	TAILQ_FOREACH(pv, &m->md.pv_list, pv_list) {
 		if (PV_PMAP(pv) == pmap) {
-			return TRUE;
+			return (TRUE);
 		}
 		loops++;
 		if (loops >= 16)
@@ -4978,7 +4978,7 @@ pmap_mincore(pmap_t pmap, vm_offset_t ad
 	if (pte != 0) {
 		val |= MINCORE_INCORE;
 		if ((pte & PG_MANAGED) == 0)
-			return val;
+			return (val);
 
 		m = PHYS_TO_VM_PAGE(pa);
 
@@ -5012,7 +5012,7 @@ pmap_mincore(pmap_t pmap, vm_offset_t ad
 			vm_page_unlock_queues();
 		}
 	} 
-	return val;
+	return (val);
 }
 
 void
@@ -5107,7 +5107,7 @@ pmap_pid_dump(int pid)
 								printf("\n");
 							}
 							sx_sunlock(&allproc_lock);
-							return npte;
+							return (npte);
 						}
 						pte = pmap_pte(pmap, va);
 						if (pte && pmap_pte_v(pte)) {
@@ -5132,7 +5132,7 @@ pmap_pid_dump(int pid)
 		}
 	}
 	sx_sunlock(&allproc_lock);
-	return npte;
+	return (npte);
 }
 #endif
 

From owner-svn-src-head@FreeBSD.ORG  Sat Apr 24 22:16:02 2010
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 183E8106564A;
	Sat, 24 Apr 2010 22:16:02 +0000 (UTC)
	(envelope-from jilles@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 0712C8FC1B;
	Sat, 24 Apr 2010 22:16:02 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o3OMG1ko062060;
	Sat, 24 Apr 2010 22:16:01 GMT (envelope-from jilles@svn.freebsd.org)
Received: (from jilles@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o3OMG1Ue062059;
	Sat, 24 Apr 2010 22:16:01 GMT (envelope-from jilles@svn.freebsd.org)
Message-Id: <201004242216.o3OMG1Ue062059@svn.freebsd.org>
From: Jilles Tjoelker 
Date: Sat, 24 Apr 2010 22:16:01 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r207166 - head/share/man/man1
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Sat, 24 Apr 2010 22:16:02 -0000

Author: jilles
Date: Sat Apr 24 22:16:01 2010
New Revision: 207166
URL: http://svn.freebsd.org/changeset/base/207166

Log:
  builtin(1): Mention [ sh builtin.
  
  MFC after:	1 week

Modified:
  head/share/man/man1/builtin.1

Modified: head/share/man/man1/builtin.1
==============================================================================
--- head/share/man/man1/builtin.1	Sat Apr 24 22:09:13 2010	(r207165)
+++ head/share/man/man1/builtin.1	Sat Apr 24 22:16:01 2010	(r207166)
@@ -26,7 +26,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd October 14, 2006
+.Dd April 25, 2010
 .Dt BUILTIN 1
 .Os
 .Sh NAME
@@ -36,6 +36,7 @@
 .Nm \&. ,
 .Nm \&: ,
 .Nm @ ,
+.Nm \&[ ,
 .Nm { ,
 .Nm } ,
 .Nm alias ,
@@ -200,6 +201,7 @@ but are implemented as scripts using a b
 .It Ic . Ta \&No Ta \&No Ta Yes
 .It Ic : Ta \&No Ta Yes Ta Yes
 .It Ic @ Ta \&No Ta Yes Ta Yes
+.It Ic \&[ Ta Yes Ta \&No Ta Yes
 .It Ic { Ta \&No Ta \&No Ta Yes
 .It Ic } Ta \&No Ta \&No Ta Yes
 .It Ic alias Ta No** Ta Yes Ta Yes

From owner-svn-src-head@FreeBSD.ORG  Sat Apr 24 22:24:27 2010
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 383061065670;
	Sat, 24 Apr 2010 22:24:27 +0000 (UTC)
	(envelope-from jilles@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 27EA48FC0C;
	Sat, 24 Apr 2010 22:24:27 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o3OMOR1k063986;
	Sat, 24 Apr 2010 22:24:27 GMT (envelope-from jilles@svn.freebsd.org)
Received: (from jilles@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o3OMOR4g063984;
	Sat, 24 Apr 2010 22:24:27 GMT (envelope-from jilles@svn.freebsd.org)
Message-Id: <201004242224.o3OMOR4g063984@svn.freebsd.org>
From: Jilles Tjoelker 
Date: Sat, 24 Apr 2010 22:24:27 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r207168 - head/share/man/man1
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Sat, 24 Apr 2010 22:24:27 -0000

Author: jilles
Date: Sat Apr 24 22:24:26 2010
New Revision: 207168
URL: http://svn.freebsd.org/changeset/base/207168

Log:
  builtin(1): Add missing escaping for !, . and : in the table.
  
  This caused these commands to look differently (not bold) from the other
  commands in the table (bold).
  
  MFC after:	1 week

Modified:
  head/share/man/man1/builtin.1

Modified: head/share/man/man1/builtin.1
==============================================================================
--- head/share/man/man1/builtin.1	Sat Apr 24 22:23:49 2010	(r207167)
+++ head/share/man/man1/builtin.1	Sat Apr 24 22:24:26 2010	(r207168)
@@ -196,10 +196,10 @@ but are implemented as scripts using a b
 .It Xo
 .Em "Command	External" Ta Xr csh 1 Ta Xr sh 1
 .Xc
-.It Ic ! Ta \&No Ta \&No Ta Yes
+.It Ic \&! Ta \&No Ta \&No Ta Yes
 .It Ic % Ta \&No Ta Yes Ta \&No
-.It Ic . Ta \&No Ta \&No Ta Yes
-.It Ic : Ta \&No Ta Yes Ta Yes
+.It Ic \&. Ta \&No Ta \&No Ta Yes
+.It Ic \&: Ta \&No Ta Yes Ta Yes
 .It Ic @ Ta \&No Ta Yes Ta Yes
 .It Ic \&[ Ta Yes Ta \&No Ta Yes
 .It Ic { Ta \&No Ta \&No Ta Yes

From owner-svn-src-head@FreeBSD.ORG  Sat Apr 24 22:52:15 2010
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 3ABA11065676;
	Sat, 24 Apr 2010 22:52:15 +0000 (UTC)
	(envelope-from rmacklem@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 28B8B8FC15;
	Sat, 24 Apr 2010 22:52:15 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o3OMqEGs070183;
	Sat, 24 Apr 2010 22:52:14 GMT
	(envelope-from rmacklem@svn.freebsd.org)
Received: (from rmacklem@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o3OMqEd3070173;
	Sat, 24 Apr 2010 22:52:14 GMT
	(envelope-from rmacklem@svn.freebsd.org)
Message-Id: <201004242252.o3OMqEd3070173@svn.freebsd.org>
From: Rick Macklem 
Date: Sat, 24 Apr 2010 22:52:14 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r207170 - in head/sys/fs: nfs nfsclient nfsserver
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Sat, 24 Apr 2010 22:52:15 -0000

Author: rmacklem
Date: Sat Apr 24 22:52:14 2010
New Revision: 207170
URL: http://svn.freebsd.org/changeset/base/207170

Log:
  An NFSv4 server will reply NFSERR_GRACE for non-recovery RPCs
  during the grace period after startup. This grace period must
  be at least the lease duration, which is typically 1-2 minutes.
  It seems prudent for the experimental NFS client to wait a few
  seconds before retrying such an RPC, so that the server isn't
  flooded with non-recovery RPCs during recovery. This patch adds
  an argument to nfs_catnap() to implement a 5 second delay
  for this case.
  
  MFC after:	1 week

Modified:
  head/sys/fs/nfs/nfs_commonkrpc.c
  head/sys/fs/nfs/nfs_commonport.c
  head/sys/fs/nfs/nfs_var.h
  head/sys/fs/nfs/nfsport.h
  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/nfs_clvnops.c
  head/sys/fs/nfsserver/nfs_nfsdstate.c

Modified: head/sys/fs/nfs/nfs_commonkrpc.c
==============================================================================
--- head/sys/fs/nfs/nfs_commonkrpc.c	Sat Apr 24 22:31:51 2010	(r207169)
+++ head/sys/fs/nfs/nfs_commonkrpc.c	Sat Apr 24 22:52:14 2010	(r207170)
@@ -650,7 +650,7 @@ tryagain:
 					trylater_delay = NFS_TRYLATERDEL;
 				waituntil = NFSD_MONOSEC + trylater_delay;
 				while (NFSD_MONOSEC < waituntil)
-					(void) nfs_catnap(PZERO, "nfstry");
+					(void) nfs_catnap(PZERO, 0, "nfstry");
 				trylater_delay *= 2;
 				goto tryagain;
 			}

Modified: head/sys/fs/nfs/nfs_commonport.c
==============================================================================
--- head/sys/fs/nfs/nfs_commonport.c	Sat Apr 24 22:31:51 2010	(r207169)
+++ head/sys/fs/nfs/nfs_commonport.c	Sat Apr 24 22:52:14 2010	(r207170)
@@ -345,17 +345,21 @@ newnfs_timer(void *arg)
 
 
 /*
- * sleep for a short period of time.
+ * Sleep for a short period of time unless errval == NFSERR_GRACE, where
+ * the sleep should be for 5 seconds.
  * Since lbolt doesn't exist in FreeBSD-CURRENT, just use a timeout on
  * an event that never gets a wakeup. Only return EINTR or 0.
  */
 int
-nfs_catnap(int prio, const char *wmesg)
+nfs_catnap(int prio, int errval, const char *wmesg)
 {
 	static int non_event;
 	int ret;
 
-	ret = tsleep(&non_event, prio, wmesg, 1);
+	if (errval == NFSERR_GRACE)
+		ret = tsleep(&non_event, prio, wmesg, 5 * hz);
+	else
+		ret = tsleep(&non_event, prio, wmesg, 1);
 	if (ret != EINTR)
 		ret = 0;
 	return (ret);

Modified: head/sys/fs/nfs/nfs_var.h
==============================================================================
--- head/sys/fs/nfs/nfs_var.h	Sat Apr 24 22:31:51 2010	(r207169)
+++ head/sys/fs/nfs/nfs_var.h	Sat Apr 24 22:52:14 2010	(r207170)
@@ -322,7 +322,7 @@ int nfsvno_v4rootexport(struct nfsrv_des
 void newnfs_portinit(void);
 struct ucred *newnfs_getcred(void);
 void newnfs_setroot(struct ucred *);
-int nfs_catnap(int, const char *);
+int nfs_catnap(int, int, const char *);
 struct nfsreferral *nfsv4root_getreferral(vnode_t, vnode_t, u_int32_t);
 int nfsrv_atroot(vnode_t, long *);
 void newnfs_timer(void *);

Modified: head/sys/fs/nfs/nfsport.h
==============================================================================
--- head/sys/fs/nfs/nfsport.h	Sat Apr 24 22:31:51 2010	(r207169)
+++ head/sys/fs/nfs/nfsport.h	Sat Apr 24 22:52:14 2010	(r207170)
@@ -143,21 +143,21 @@
 #define	NFSMGET(m)	do { 					\
 		MGET((m), M_TRYWAIT, MT_DATA); 			\
 		while ((m) == NULL ) { 				\
-			(void) nfs_catnap(PZERO, "nfsmget");	\
+			(void) nfs_catnap(PZERO, 0, "nfsmget");	\
 			MGET((m), M_TRYWAIT, MT_DATA); 		\
 		} 						\
 	} while (0)
 #define	NFSMGETHDR(m)	do { 					\
 		MGETHDR((m), M_TRYWAIT, MT_DATA);		\
 		while ((m) == NULL ) { 				\
-			(void) nfs_catnap(PZERO, "nfsmget");	\
+			(void) nfs_catnap(PZERO, 0, "nfsmget");	\
 			MGETHDR((m), M_TRYWAIT, MT_DATA); 	\
 		} 						\
 	} while (0)
 #define	NFSMCLGET(m, w)	do { 					\
 		MGET((m), M_TRYWAIT, MT_DATA); 			\
 		while ((m) == NULL ) { 				\
-			(void) nfs_catnap(PZERO, "nfsmget");	\
+			(void) nfs_catnap(PZERO, 0, "nfsmget");	\
 			MGET((m), M_TRYWAIT, MT_DATA); 		\
 		} 						\
 		MCLGET((m), (w));				\
@@ -165,7 +165,7 @@
 #define	NFSMCLGETHDR(m, w) do { 				\
 		MGETHDR((m), M_TRYWAIT, MT_DATA);		\
 		while ((m) == NULL ) { 				\
-			(void) nfs_catnap(PZERO, "nfsmget");	\
+			(void) nfs_catnap(PZERO, 0, "nfsmget");	\
 			MGETHDR((m), M_TRYWAIT, MT_DATA); 	\
 		} 						\
 	} while (0)

Modified: head/sys/fs/nfsclient/nfs_clrpcops.c
==============================================================================
--- head/sys/fs/nfsclient/nfs_clrpcops.c	Sat Apr 24 22:31:51 2010	(r207169)
+++ head/sys/fs/nfsclient/nfs_clrpcops.c	Sat Apr 24 22:52:14 2010	(r207170)
@@ -298,7 +298,7 @@ else printf(" fhl=0\n");
 	    nfscl_openrelease(op, error, newone);
 	    if (error == NFSERR_GRACE || error == NFSERR_STALECLIENTID ||
 		error == NFSERR_STALEDONTRECOVER || error == NFSERR_DELAY) {
-		(void) nfs_catnap(PZERO, "nfs_open");
+		(void) nfs_catnap(PZERO, error, "nfs_open");
 	    } else if ((error == NFSERR_EXPIRED || error == NFSERR_BADSTATEID)
 		&& clidrev != 0) {
 		expireret = nfscl_hasexpired(nmp->nm_clp, clidrev, p);
@@ -460,7 +460,7 @@ nfsrpc_openrpc(struct nfsmount *nmp, vno
 			ret = nfsrpc_openconfirm(vp, newfhp, newfhlen, op,
 			    cred, p);
 			if (ret == NFSERR_DELAY)
-			    (void) nfs_catnap(PZERO, "nfs_open");
+			    (void) nfs_catnap(PZERO, ret, "nfs_open");
 		    } while (ret == NFSERR_DELAY);
 		    error = ret;
 		}
@@ -484,7 +484,7 @@ nfsrpc_openrpc(struct nfsmount *nmp, vno
 			    newfhlen, mode, op, name, namelen, &ndp, 0, 0x0,
 			    cred, p, syscred, 1);
 			if (ret == NFSERR_DELAY)
-			    (void) nfs_catnap(PZERO, "nfs_open2");
+			    (void) nfs_catnap(PZERO, ret, "nfs_open2");
 		    } while (ret == NFSERR_DELAY);
 		    if (ret) {
 			if (ndp != NULL)
@@ -624,6 +624,7 @@ nfsrpc_doclose(struct nfsmount *nmp, str
 					    nd->nd_repstat == NFSERR_DELAY) &&
 					    error == 0)
 						(void) nfs_catnap(PZERO,
+						    (int)nd->nd_repstat,
 						    "nfs_close");
 				} while ((nd->nd_repstat == NFSERR_GRACE ||
 				    nd->nd_repstat == NFSERR_DELAY) &&
@@ -645,7 +646,7 @@ nfsrpc_doclose(struct nfsmount *nmp, str
 	do {
 		error = nfscl_tryclose(op, tcred, nmp, p);
 		if (error == NFSERR_GRACE)
-			(void) nfs_catnap(PZERO, "nfs_close");
+			(void) nfs_catnap(PZERO, error, "nfs_close");
 	} while (error == NFSERR_GRACE);
 	NFSLOCKCLSTATE();
 	nfscl_lockunlock(&op->nfso_own->nfsow_rwlock);
@@ -999,7 +1000,7 @@ nfsrpc_setattr(vnode_t vp, struct vattr 
 		if (error == NFSERR_GRACE || error == NFSERR_STALESTATEID ||
 		    error == NFSERR_STALEDONTRECOVER || error == NFSERR_DELAY ||
 		    error == NFSERR_OLDSTATEID) {
-			(void) nfs_catnap(PZERO, "nfs_setattr");
+			(void) nfs_catnap(PZERO, error, "nfs_setattr");
 		} else if ((error == NFSERR_EXPIRED ||
 		    error == NFSERR_BADSTATEID) && clidrev != 0) {
 			expireret = nfscl_hasexpired(nmp->nm_clp, clidrev, p);
@@ -1244,7 +1245,7 @@ nfsrpc_read(vnode_t vp, struct uio *uiop
 		if (error == NFSERR_GRACE || error == NFSERR_STALESTATEID ||
 		    error == NFSERR_STALEDONTRECOVER || error == NFSERR_DELAY ||
 		    error == NFSERR_OLDSTATEID) {
-			(void) nfs_catnap(PZERO, "nfs_read");
+			(void) nfs_catnap(PZERO, error, "nfs_read");
 		} else if ((error == NFSERR_EXPIRED ||
 		    error == NFSERR_BADSTATEID) && clidrev != 0) {
 			expireret = nfscl_hasexpired(nmp->nm_clp, clidrev, p);
@@ -1409,7 +1410,7 @@ nfscl_dumpstate(nmp, 1, 1, 0, 0);
 		if (error == NFSERR_GRACE || error == NFSERR_STALESTATEID ||
 		    error == NFSERR_STALEDONTRECOVER || error == NFSERR_DELAY ||
 		    error == NFSERR_OLDSTATEID) {
-			(void) nfs_catnap(PZERO, "nfs_write");
+			(void) nfs_catnap(PZERO, error, "nfs_write");
 		} else if ((error == NFSERR_EXPIRED ||
 		    error == NFSERR_BADSTATEID) && clidrev != 0) {
 			expireret = nfscl_hasexpired(nmp->nm_clp, clidrev, p);
@@ -1736,7 +1737,7 @@ nfsrpc_create(vnode_t dvp, char *name, i
 		nfscl_ownerrelease(owp, error, newone, unlocked);
 		if (error == NFSERR_GRACE || error == NFSERR_STALECLIENTID ||
 		    error == NFSERR_STALEDONTRECOVER || error == NFSERR_DELAY) {
-			(void) nfs_catnap(PZERO, "nfs_open");
+			(void) nfs_catnap(PZERO, error, "nfs_open");
 		} else if ((error == NFSERR_EXPIRED ||
 		    error == NFSERR_BADSTATEID) && clidrev != 0) {
 			expireret = nfscl_hasexpired(nmp->nm_clp, clidrev, p);
@@ -1969,7 +1970,7 @@ nfsrpc_createv4(vnode_t dvp, char *name,
 			ret = nfsrpc_openconfirm(dvp, nfhp->nfh_fh,
 			    nfhp->nfh_len, op, cred, p);
 			if (ret == NFSERR_DELAY)
-			    (void) nfs_catnap(PZERO, "nfs_create");
+			    (void) nfs_catnap(PZERO, ret, "nfs_create");
 		    } while (ret == NFSERR_DELAY);
 		    error = ret;
 		}
@@ -1991,7 +1992,7 @@ nfsrpc_createv4(vnode_t dvp, char *name,
 			    (NFSV4OPEN_ACCESSWRITE | NFSV4OPEN_ACCESSREAD), op,
 			    name, namelen, &dp, 0, 0x0, cred, p, 0, 1);
 			if (ret == NFSERR_DELAY)
-			    (void) nfs_catnap(PZERO, "nfs_crt2");
+			    (void) nfs_catnap(PZERO, ret, "nfs_crt2");
 		    } while (ret == NFSERR_DELAY);
 		    if (ret) {
 			if (dp != NULL)
@@ -3533,7 +3534,8 @@ nfsrpc_advlock(vnode_t vp, off_t size, i
 			    if ((nd->nd_repstat == NFSERR_GRACE ||
 				 nd->nd_repstat == NFSERR_DELAY) &&
 				error == 0)
-				(void) nfs_catnap(PZERO, "nfs_advlock");
+				(void) nfs_catnap(PZERO, (int)nd->nd_repstat,
+				    "nfs_advlock");
 			} while ((nd->nd_repstat == NFSERR_GRACE ||
 			    nd->nd_repstat == NFSERR_DELAY) && error == 0);
 		    }
@@ -3570,7 +3572,7 @@ nfsrpc_advlock(vnode_t vp, off_t size, i
 	    if (error == NFSERR_GRACE || error == NFSERR_STALESTATEID ||
 		error == NFSERR_STALEDONTRECOVER ||
 		error == NFSERR_STALECLIENTID || error == NFSERR_DELAY) {
-		(void) nfs_catnap(PZERO, "nfs_advlock");
+		(void) nfs_catnap(PZERO, error, "nfs_advlock");
 	    } else if ((error == NFSERR_EXPIRED || error == NFSERR_BADSTATEID)
 		&& clidrev != 0) {
 		expireret = nfscl_hasexpired(nmp->nm_clp, clidrev, p);

Modified: head/sys/fs/nfsclient/nfs_clstate.c
==============================================================================
--- head/sys/fs/nfsclient/nfs_clstate.c	Sat Apr 24 22:31:51 2010	(r207169)
+++ head/sys/fs/nfsclient/nfs_clstate.c	Sat Apr 24 22:52:14 2010	(r207170)
@@ -784,7 +784,7 @@ nfscl_getcl(vnode_t vp, struct ucred *cr
 			if (error == NFSERR_STALECLIENTID ||
 			    error == NFSERR_STALEDONTRECOVER ||
 			    error == NFSERR_CLIDINUSE) {
-				(void) nfs_catnap(PZERO, "nfs_setcl");
+				(void) nfs_catnap(PZERO, error, "nfs_setcl");
 			}
 		} while (((error == NFSERR_STALECLIENTID ||
 		     error == NFSERR_STALEDONTRECOVER) && --trystalecnt > 0) ||
@@ -2046,7 +2046,7 @@ nfscl_recover(struct nfsclclient *clp, s
 			newnfs_copycred(&op->nfso_cred, tcred);
 			error = nfscl_tryclose(op, tcred, nmp, p);
 			if (error == NFSERR_GRACE)
-				(void) nfs_catnap(PZERO, "nfsexcls");
+				(void) nfs_catnap(PZERO, error, "nfsexcls");
 		} while (error == NFSERR_GRACE);
 		LIST_REMOVE(op, nfso_list);
 		FREE((caddr_t)op, M_NFSCLOPEN);
@@ -2059,7 +2059,7 @@ nfscl_recover(struct nfsclclient *clp, s
 			newnfs_copycred(&dp->nfsdl_cred, tcred);
 			error = nfscl_trydelegreturn(dp, tcred, nmp, p);
 			if (error == NFSERR_GRACE)
-				(void) nfs_catnap(PZERO, "nfsexdlg");
+				(void) nfs_catnap(PZERO, error, "nfsexdlg");
 		} while (error == NFSERR_GRACE);
 		TAILQ_REMOVE(&extra_deleg, dp, nfsdl_list);
 		FREE((caddr_t)dp, M_NFSCLDELEG);
@@ -3619,7 +3619,7 @@ nfscl_tryopen(struct nfsmount *nmp, vnod
 		    mode, op, name, namelen, ndpp, reclaim, delegtype, cred, p,
 		    0, 0);
 		if (error == NFSERR_DELAY)
-			(void) nfs_catnap(PZERO, "nfstryop");
+			(void) nfs_catnap(PZERO, error, "nfstryop");
 	} while (error == NFSERR_DELAY);
 	if (error == EAUTH || error == EACCES) {
 		/* Try again using system credentials */
@@ -3629,7 +3629,7 @@ nfscl_tryopen(struct nfsmount *nmp, vnod
 			newfhlen, mode, op, name, namelen, ndpp, reclaim,
 			delegtype, cred, p, 1, 0);
 		    if (error == NFSERR_DELAY)
-			(void) nfs_catnap(PZERO, "nfstryop");
+			(void) nfs_catnap(PZERO, error, "nfstryop");
 		} while (error == NFSERR_DELAY);
 	}
 	return (error);
@@ -3652,7 +3652,8 @@ nfscl_trylock(struct nfsmount *nmp, vnod
 		error = nfsrpc_lock(nd, nmp, vp, fhp, fhlen, nlp, newone,
 		    reclaim, off, len, type, cred, p, 0);
 		if (!error && nd->nd_repstat == NFSERR_DELAY)
-			(void) nfs_catnap(PZERO, "nfstrylck");
+			(void) nfs_catnap(PZERO, (int)nd->nd_repstat,
+			    "nfstrylck");
 	} while (!error && nd->nd_repstat == NFSERR_DELAY);
 	if (!error)
 		error = nd->nd_repstat;
@@ -3663,7 +3664,8 @@ nfscl_trylock(struct nfsmount *nmp, vnod
 			error = nfsrpc_lock(nd, nmp, vp, fhp, fhlen, nlp,
 			    newone, reclaim, off, len, type, cred, p, 1);
 			if (!error && nd->nd_repstat == NFSERR_DELAY)
-				(void) nfs_catnap(PZERO, "nfstrylck");
+				(void) nfs_catnap(PZERO, (int)nd->nd_repstat,
+				    "nfstrylck");
 		} while (!error && nd->nd_repstat == NFSERR_DELAY);
 		if (!error)
 			error = nd->nd_repstat;
@@ -3685,7 +3687,7 @@ nfscl_trydelegreturn(struct nfscldeleg *
 	do {
 		error = nfsrpc_delegreturn(dp, cred, nmp, p, 0);
 		if (error == NFSERR_DELAY)
-			(void) nfs_catnap(PZERO, "nfstrydp");
+			(void) nfs_catnap(PZERO, error, "nfstrydp");
 	} while (error == NFSERR_DELAY);
 	if (error == EAUTH || error == EACCES) {
 		/* Try again using system credentials */
@@ -3693,7 +3695,7 @@ nfscl_trydelegreturn(struct nfscldeleg *
 		do {
 			error = nfsrpc_delegreturn(dp, cred, nmp, p, 1);
 			if (error == NFSERR_DELAY)
-				(void) nfs_catnap(PZERO, "nfstrydp");
+				(void) nfs_catnap(PZERO, error, "nfstrydp");
 		} while (error == NFSERR_DELAY);
 	}
 	return (error);
@@ -3714,7 +3716,7 @@ nfscl_tryclose(struct nfsclopen *op, str
 	do {
 		error = nfsrpc_closerpc(nd, nmp, op, cred, p, 0);
 		if (error == NFSERR_DELAY)
-			(void) nfs_catnap(PZERO, "nfstrycl");
+			(void) nfs_catnap(PZERO, error, "nfstrycl");
 	} while (error == NFSERR_DELAY);
 	if (error == EAUTH || error == EACCES) {
 		/* Try again using system credentials */
@@ -3722,7 +3724,7 @@ nfscl_tryclose(struct nfsclopen *op, str
 		do {
 			error = nfsrpc_closerpc(nd, nmp, op, cred, p, 1);
 			if (error == NFSERR_DELAY)
-				(void) nfs_catnap(PZERO, "nfstrycl");
+				(void) nfs_catnap(PZERO, error, "nfstrycl");
 		} while (error == NFSERR_DELAY);
 	}
 	return (error);

Modified: head/sys/fs/nfsclient/nfs_clvfsops.c
==============================================================================
--- head/sys/fs/nfsclient/nfs_clvfsops.c	Sat Apr 24 22:31:51 2010	(r207169)
+++ head/sys/fs/nfsclient/nfs_clvfsops.c	Sat Apr 24 22:52:14 2010	(r207170)
@@ -652,7 +652,7 @@ nfs_decode_args(struct mount *mp, struct
 			while (newnfs_connect(nmp, &nmp->nm_sockreq,
 			    cred, td, 0)) {
 				printf("newnfs_args: retrying connect\n");
-				(void) nfs_catnap(PSOCK, "newnfscon");
+				(void) nfs_catnap(PSOCK, 0, "newnfscon");
 			}
 		}
 	} else {
@@ -1188,7 +1188,7 @@ mountnfs(struct nfs_args *argp, struct m
 			error = nfsrpc_getdirpath(nmp, NFSMNT_DIRPATH(nmp),
 			    cred, td);
 			if (error)
-				(void) nfs_catnap(PZERO, "nfsgetdirp");
+				(void) nfs_catnap(PZERO, error, "nfsgetdirp");
 		} while (error && --trycnt > 0);
 		if (error) {
 			error = nfscl_maperr(td, error, (uid_t)0, (gid_t)0);
@@ -1284,7 +1284,7 @@ nfs_unmount(struct mount *mp, int mntfla
 	do {
 		error = vflush(mp, 1, flags, td);
 		if ((mntflags & MNT_FORCE) && error != 0 && ++trycnt < 30)
-			(void) nfs_catnap(PSOCK, "newndm");
+			(void) nfs_catnap(PSOCK, error, "newndm");
 	} while ((mntflags & MNT_FORCE) && error != 0 && trycnt < 30);
 	if (error)
 		goto out;

Modified: head/sys/fs/nfsclient/nfs_clvnops.c
==============================================================================
--- head/sys/fs/nfsclient/nfs_clvnops.c	Sat Apr 24 22:31:51 2010	(r207169)
+++ head/sys/fs/nfsclient/nfs_clvnops.c	Sat Apr 24 22:52:14 2010	(r207170)
@@ -2871,7 +2871,8 @@ nfs_advlock(struct vop_advlock_args *ap)
 			if (ret == NFSERR_DENIED && (ap->a_flags & F_WAIT) &&
 			    ap->a_op == F_SETLK) {
 				VOP_UNLOCK(vp, 0);
-				error = nfs_catnap(PZERO | PCATCH, "ncladvl");
+				error = nfs_catnap(PZERO | PCATCH, ret,
+				    "ncladvl");
 				if (error)
 					return (EINTR);
 				vn_lock(vp, LK_EXCLUSIVE | LK_RETRY);

Modified: head/sys/fs/nfsserver/nfs_nfsdstate.c
==============================================================================
--- head/sys/fs/nfsserver/nfs_nfsdstate.c	Sat Apr 24 22:31:51 2010	(r207169)
+++ head/sys/fs/nfsserver/nfs_nfsdstate.c	Sat Apr 24 22:52:14 2010	(r207170)
@@ -4578,7 +4578,7 @@ nfsd_recalldelegation(vnode_t vp, NFSPRO
 			    100000)
 				return;
 			/* Sleep for a short period of time */
-			(void) nfs_catnap(PZERO, "nfsremove");
+			(void) nfs_catnap(PZERO, 0, "nfsremove");
 		}
 	} while (error == NFSERR_DELAY);
 }

From owner-svn-src-head@FreeBSD.ORG  Sat Apr 24 23:32:25 2010
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 24689106566B;
	Sat, 24 Apr 2010 23:32:25 +0000 (UTC)
	(envelope-from weongyo@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 145908FC12;
	Sat, 24 Apr 2010 23:32:25 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o3ONWOIS079260;
	Sat, 24 Apr 2010 23:32:24 GMT (envelope-from weongyo@svn.freebsd.org)
Received: (from weongyo@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o3ONWO7g079258;
	Sat, 24 Apr 2010 23:32:24 GMT (envelope-from weongyo@svn.freebsd.org)
Message-Id: <201004242332.o3ONWO7g079258@svn.freebsd.org>
From: Weongyo Jeong 
Date: Sat, 24 Apr 2010 23:32:24 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r207176 - head/sys/dev/bwn
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Sat, 24 Apr 2010 23:32:25 -0000

Author: weongyo
Date: Sat Apr 24 23:32:24 2010
New Revision: 207176
URL: http://svn.freebsd.org/changeset/base/207176

Log:
  ifp->if_ipackets++ when RX packet interrupts are occurred.
  
  MFC after:	3 days

Modified:
  head/sys/dev/bwn/if_bwn.c

Modified: head/sys/dev/bwn/if_bwn.c
==============================================================================
--- head/sys/dev/bwn/if_bwn.c	Sat Apr 24 23:20:51 2010	(r207175)
+++ head/sys/dev/bwn/if_bwn.c	Sat Apr 24 23:32:24 2010	(r207176)
@@ -9368,6 +9368,8 @@ bwn_rxeof(struct bwn_mac *mac, struct mb
 	rssi = rxhdr->phy.abg.rssi;	/* XXX incorrect RSSI calculation? */
 	noise = mac->mac_stats.link_noise;
 
+	ifp->if_ipackets++;
+
 	BWN_UNLOCK(sc);
 
 	ni = ieee80211_find_rxnode(ic, wh);