From owner-svn-src-head@FreeBSD.ORG Sun Jul 5 06:14:59 2009 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 EFB61106566C; Sun, 5 Jul 2009 06:14:59 +0000 (UTC) (envelope-from brian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id DE6D18FC1E; Sun, 5 Jul 2009 06:14:59 +0000 (UTC) (envelope-from brian@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n656ExLS038760; Sun, 5 Jul 2009 06:14:59 GMT (envelope-from brian@svn.freebsd.org) Received: (from brian@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n656Exou038758; Sun, 5 Jul 2009 06:14:59 GMT (envelope-from brian@svn.freebsd.org) Message-Id: <200907050614.n656Exou038758@svn.freebsd.org> From: Brian Somers Date: Sun, 5 Jul 2009 06:14: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: r195346 - head/usr.sbin/pkg_install/add 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, 05 Jul 2009 06:15:00 -0000 Author: brian Date: Sun Jul 5 06:14:59 2009 New Revision: 195346 URL: http://svn.freebsd.org/changeset/base/195346 Log: Disable r194497 for now. It doesn't work well with ports-mgmt/tinderbox. Approved by: re (ken) Modified: head/usr.sbin/pkg_install/add/perform.c Modified: head/usr.sbin/pkg_install/add/perform.c ============================================================================== --- head/usr.sbin/pkg_install/add/perform.c Sun Jul 5 01:36:24 2009 (r195345) +++ head/usr.sbin/pkg_install/add/perform.c Sun Jul 5 06:14:59 2009 (r195346) @@ -278,6 +278,7 @@ pkg_do(char *pkg) warnx("-f specified; proceeding anyway"); } +#if ENSURE_THAT_ALL_REQUIREMENTS_ARE_MET /* * Before attempting to do the slave mode bit, ensure that we've * downloaded & processed everything we need. @@ -313,6 +314,7 @@ pkg_do(char *pkg) } } } +#endif /* Now check the packing list for dependencies */ for (p = Plist.head; p ; p = p->next) { From owner-svn-src-head@FreeBSD.ORG Sun Jul 5 14:03:41 2009 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 A6F321065670; Sun, 5 Jul 2009 14:03:41 +0000 (UTC) (envelope-from ivoras@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 9530E8FC15; Sun, 5 Jul 2009 14:03:41 +0000 (UTC) (envelope-from ivoras@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n65E3fIp051074; Sun, 5 Jul 2009 14:03:41 GMT (envelope-from ivoras@svn.freebsd.org) Received: (from ivoras@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n65E3fOp051072; Sun, 5 Jul 2009 14:03:41 GMT (envelope-from ivoras@svn.freebsd.org) Message-Id: <200907051403.n65E3fOp051072@svn.freebsd.org> From: Ivan Voras Date: Sun, 5 Jul 2009 14:03:41 +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: r195362 - head/sys/modules/geom/geom_label 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, 05 Jul 2009 14:03:42 -0000 Author: ivoras Date: Sun Jul 5 14:03:41 2009 New Revision: 195362 URL: http://svn.freebsd.org/changeset/base/195362 Log: Add missing reference to GPT support. Submitted by: Paul B. Mahol onemda at gmail.com Approved by: re (kib) Modified: head/sys/modules/geom/geom_label/Makefile Modified: head/sys/modules/geom/geom_label/Makefile ============================================================================== --- head/sys/modules/geom/geom_label/Makefile Sun Jul 5 13:17:18 2009 (r195361) +++ head/sys/modules/geom/geom_label/Makefile Sun Jul 5 14:03:41 2009 (r195362) @@ -5,6 +5,7 @@ KMOD= geom_label SRCS= g_label.c SRCS+= g_label_ext2fs.c +SRCS+= g_label_gpt.c SRCS+= g_label_iso9660.c SRCS+= g_label_msdosfs.c SRCS+= g_label_ntfs.c From owner-svn-src-head@FreeBSD.ORG Sun Jul 5 14:50:45 2009 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 D68271065670; Sun, 5 Jul 2009 14:50:45 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C49FA8FC08; Sun, 5 Jul 2009 14:50:45 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n65EojBM052096; Sun, 5 Jul 2009 14:50:45 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n65EojI1052093; Sun, 5 Jul 2009 14:50:45 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <200907051450.n65EojI1052093@svn.freebsd.org> From: Alexander Motin Date: Sun, 5 Jul 2009 14:50: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: r195363 - in head/sys: conf dev/ata/chipsets 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, 05 Jul 2009 14:50:46 -0000 Author: mav Date: Sun Jul 5 14:50:45 2009 New Revision: 195363 URL: http://svn.freebsd.org/changeset/base/195363 Log: Mark atanvidia depending on ataahci since rev.188846. Approved by: re (kib) Modified: head/sys/conf/files head/sys/dev/ata/chipsets/ata-nvidia.c Modified: head/sys/conf/files ============================================================================== --- head/sys/conf/files Sun Jul 5 14:03:41 2009 (r195362) +++ head/sys/conf/files Sun Jul 5 14:50:45 2009 (r195363) @@ -498,7 +498,8 @@ dev/ata/ata-cbus.c optional ata pc98 | dev/ata/ata-isa.c optional ata isa | ataisa dev/ata/ata-pci.c optional ata pci | atapci dev/ata/chipsets/ata-ahci.c optional ata pci | ataahci | ataacerlabs | \ - ataati | ataintel | atajmicron | atavia + ataati | ataintel | atajmicron | \ + atavia | atanvidia dev/ata/chipsets/ata-acard.c optional ata pci | ataacard dev/ata/chipsets/ata-acerlabs.c optional ata pci | ataacerlabs dev/ata/chipsets/ata-adaptec.c optional ata pci | ataadaptec Modified: head/sys/dev/ata/chipsets/ata-nvidia.c ============================================================================== --- head/sys/dev/ata/chipsets/ata-nvidia.c Sun Jul 5 14:03:41 2009 (r195362) +++ head/sys/dev/ata/chipsets/ata-nvidia.c Sun Jul 5 14:50:45 2009 (r195363) @@ -287,3 +287,4 @@ ata_nvidia_setmode(device_t dev, int mod } ATA_DECLARE_DRIVER(ata_nvidia); +MODULE_DEPEND(ata_nvidia, ata_ahci, 1, 1, 1); From owner-svn-src-head@FreeBSD.ORG Sun Jul 5 15:25:02 2009 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 D40511065676; Sun, 5 Jul 2009 15:25:02 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C27E78FC0A; Sun, 5 Jul 2009 15:25:02 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n65FP2Bj053146; Sun, 5 Jul 2009 15:25:02 GMT (envelope-from trasz@svn.freebsd.org) Received: (from trasz@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n65FP2UL053144; Sun, 5 Jul 2009 15:25:02 GMT (envelope-from trasz@svn.freebsd.org) Message-Id: <200907051525.n65FP2UL053144@svn.freebsd.org> From: Edward Tomasz Napierala Date: Sun, 5 Jul 2009 15:25: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: r195374 - head/sys/modules 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, 05 Jul 2009 15:25:03 -0000 Author: trasz Date: Sun Jul 5 15:25:02 2009 New Revision: 195374 URL: http://svn.freebsd.org/changeset/base/195374 Log: When the kernel is configured without "options FFS", build UFS as a module without requiring any special build flags. Approved by: re (kib) Modified: head/sys/modules/Makefile Modified: head/sys/modules/Makefile ============================================================================== --- head/sys/modules/Makefile Sun Jul 5 15:23:54 2009 (r195373) +++ head/sys/modules/Makefile Sun Jul 5 15:25:02 2009 (r195374) @@ -271,7 +271,7 @@ SUBDIR= ${_3dfx} \ ubsec \ udf \ udf_iconv \ - ${_ufs} \ + ufs \ unionfs \ usb \ utopia \ @@ -304,10 +304,6 @@ _syscons= syscons _vpo= vpo .endif -.if defined(ALL_MODULES) -_ufs= ufs -.endif - .if ${MK_CRYPT} != "no" || defined(ALL_MODULES) .if exists(${.CURDIR}/../opencrypto) _crypto= crypto From owner-svn-src-head@FreeBSD.ORG Sun Jul 5 16:55:57 2009 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 6E3EF106564A; Sun, 5 Jul 2009 16:55:57 +0000 (UTC) (envelope-from brian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 5CD918FC08; Sun, 5 Jul 2009 16:55:57 +0000 (UTC) (envelope-from brian@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n65GtvUW054803; Sun, 5 Jul 2009 16:55:57 GMT (envelope-from brian@svn.freebsd.org) Received: (from brian@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n65GtvS9054801; Sun, 5 Jul 2009 16:55:57 GMT (envelope-from brian@svn.freebsd.org) Message-Id: <200907051655.n65GtvS9054801@svn.freebsd.org> From: Brian Somers Date: Sun, 5 Jul 2009 16:55: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: r195375 - head/usr.sbin/ppp 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, 05 Jul 2009 16:55:57 -0000 Author: brian Date: Sun Jul 5 16:55:57 2009 New Revision: 195375 URL: http://svn.freebsd.org/changeset/base/195375 Log: Add a missing phrase. Submitted by: Jason McIntyre jmc at kerhand dot co dot uk Approved by: re (kib) Obtained from: OpenBSD MFC after: 3 weeks Modified: head/usr.sbin/ppp/ppp.8.m4 Modified: head/usr.sbin/ppp/ppp.8.m4 ============================================================================== --- head/usr.sbin/ppp/ppp.8.m4 Sun Jul 5 15:25:02 2009 (r195374) +++ head/usr.sbin/ppp/ppp.8.m4 Sun Jul 5 16:55:57 2009 (r195375) @@ -5456,7 +5456,7 @@ keywords. .It RAD_FRAMED_IPV6_PREFIX If this attribute is supplied, the value is substituted for IPV6PREFIX in a command. -You may pass it to such as DHCPv6 for delegating an +You may pass it to an upper layer protocol such as DHCPv6 for delegating an IPv6 prefix to a peer. .It RAD_FRAMED_IPV6_ROUTE The received string is expected to be in the format From owner-svn-src-head@FreeBSD.ORG Sun Jul 5 17:45:48 2009 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 D98AE106566C; Sun, 5 Jul 2009 17:45:48 +0000 (UTC) (envelope-from sam@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C5B738FC15; Sun, 5 Jul 2009 17:45:48 +0000 (UTC) (envelope-from sam@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n65HjmV8055801; Sun, 5 Jul 2009 17:45:48 GMT (envelope-from sam@svn.freebsd.org) Received: (from sam@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n65Hjmdi055792; Sun, 5 Jul 2009 17:45:48 GMT (envelope-from sam@svn.freebsd.org) Message-Id: <200907051745.n65Hjmdi055792@svn.freebsd.org> From: Sam Leffler Date: Sun, 5 Jul 2009 17:45: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: r195376 - in head/sys: amd64/include arm/include i386/include ia64/include mips/include powerpc/include sparc64/include sun4v/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: Sun, 05 Jul 2009 17:45:49 -0000 Author: sam Date: Sun Jul 5 17:45:48 2009 New Revision: 195376 URL: http://svn.freebsd.org/changeset/base/195376 Log: Cleanup ALIGNED_POINTER: o add to platforms where it was missing (arm, i386, powerpc, sparc64, sun4v) o define as "1" on amd64 and i386 where there is no restriction o make the type returned consistent with ALIGN o remove _ALIGNED_POINTER o make associated comments consistent Reviewed by: bde, imp, marcel Approved by: re (kensmith) Modified: head/sys/amd64/include/param.h head/sys/arm/include/param.h head/sys/i386/include/param.h head/sys/ia64/include/param.h head/sys/mips/include/param.h head/sys/powerpc/include/param.h head/sys/sparc64/include/param.h head/sys/sun4v/include/param.h Modified: head/sys/amd64/include/param.h ============================================================================== --- head/sys/amd64/include/param.h Sun Jul 5 16:55:57 2009 (r195375) +++ head/sys/amd64/include/param.h Sun Jul 5 17:45:48 2009 (r195376) @@ -47,12 +47,6 @@ * Round p (pointer or byte index) up to a correctly-aligned value * for all data types (int, long, ...). The result is u_long and * must be cast to any desired pointer type. - * - * ALIGNED_POINTER is a boolean macro that checks whether an address - * is valid to fetch data elements of type t from on this architecture. - * This does not reflect the optimal alignment, just the possibility - * (within reasonable limits). - * */ #ifndef _ALIGNBYTES #define _ALIGNBYTES (sizeof(long) - 1) @@ -60,9 +54,6 @@ #ifndef _ALIGN #define _ALIGN(p) (((u_long)(p) + _ALIGNBYTES) &~ _ALIGNBYTES) #endif -#ifndef _ALIGNED_POINTER -#define _ALIGNED_POINTER(p,t) ((((u_long)(p)) & (sizeof(t)-1)) == 0) -#endif #ifndef _NO_NAMESPACE_POLLUTION @@ -87,7 +78,13 @@ #define ALIGNBYTES _ALIGNBYTES #define ALIGN(p) _ALIGN(p) -#define ALIGNED_POINTER(p,t) _ALIGNED_POINTER(p,t) +/* + * ALIGNED_POINTER is a boolean macro that checks whether an address + * is valid to fetch data elements of type t from on this architecture. + * This does not reflect the optimal alignment, just the possibility + * (within reasonable limits). + */ +#define ALIGNED_POINTER(p, t) 1 /* * CACHE_LINE_SIZE is the compile-time maximum cache line size for an Modified: head/sys/arm/include/param.h ============================================================================== --- head/sys/arm/include/param.h Sun Jul 5 16:55:57 2009 (r195375) +++ head/sys/arm/include/param.h Sun Jul 5 17:45:48 2009 (r195376) @@ -80,6 +80,13 @@ #define ALIGNBYTES _ALIGNBYTES #define ALIGN(p) _ALIGN(p) +/* + * ALIGNED_POINTER is a boolean macro that checks whether an address + * is valid to fetch data elements of type t from on this architecture. + * This does not reflect the optimal alignment, just the possibility + * (within reasonable limits). + */ +#define ALIGNED_POINTER(p, t) ((((unsigned)(p)) & (sizeof(t)-1)) == 0) /* * CACHE_LINE_SIZE is the compile-time maximum cache line size for an Modified: head/sys/i386/include/param.h ============================================================================== --- head/sys/i386/include/param.h Sun Jul 5 16:55:57 2009 (r195375) +++ head/sys/i386/include/param.h Sun Jul 5 17:45:48 2009 (r195376) @@ -73,6 +73,13 @@ #define ALIGNBYTES _ALIGNBYTES #define ALIGN(p) _ALIGN(p) +/* + * ALIGNED_POINTER is a boolean macro that checks whether an address + * is valid to fetch data elements of type t from on this architecture. + * This does not reflect the optimal alignment, just the possibility + * (within reasonable limits). + */ +#define ALIGNED_POINTER(p, t) 1 /* * CACHE_LINE_SIZE is the compile-time maximum cache line size for an Modified: head/sys/ia64/include/param.h ============================================================================== --- head/sys/ia64/include/param.h Sun Jul 5 16:55:57 2009 (r195375) +++ head/sys/ia64/include/param.h Sun Jul 5 17:45:48 2009 (r195376) @@ -46,12 +46,6 @@ * Round p (pointer or byte index) up to a correctly-aligned value for all * data types (int, long, ...). The result is u_long and must be cast to * any desired pointer type. - * - * ALIGNED_POINTER is a boolean macro that checks whether an address - * is valid to fetch data elements of type t from on this architecture. - * This does not reflect the optimal alignment, just the possibility - * (within reasonable limits). - * */ #ifndef _ALIGNBYTES #define _ALIGNBYTES 15 @@ -59,9 +53,6 @@ #ifndef _ALIGN #define _ALIGN(p) (((u_long)(p) + _ALIGNBYTES) &~ _ALIGNBYTES) #endif -#ifndef _ALIGNED_POINTER -#define _ALIGNED_POINTER(p,t) ((((u_long)(p)) & (sizeof(t)-1)) == 0) -#endif #ifndef _NO_NAMESPACE_POLLUTION @@ -84,20 +75,15 @@ #define MAXCPU 1 #endif +#define ALIGNBYTES _ALIGNBYTES +#define ALIGN(p) _ALIGN(p) /* - * Round p (pointer or byte index) up to a correctly-aligned value for all - * data types (int, long, ...). The result is u_long and must be cast to - * any desired pointer type. - * * ALIGNED_POINTER is a boolean macro that checks whether an address * is valid to fetch data elements of type t from on this architecture. * This does not reflect the optimal alignment, just the possibility * (within reasonable limits). - * */ -#define ALIGNBYTES _ALIGNBYTES -#define ALIGN(p) _ALIGN(p) -#define ALIGNED_POINTER(p,t) _ALIGNED_POINTER(p,t) +#define ALIGNED_POINTER(p,t) ((((u_long)(p)) & (sizeof(t)-1)) == 0) /* * CACHE_LINE_SIZE is the compile-time maximum cache line size for an Modified: head/sys/mips/include/param.h ============================================================================== --- head/sys/mips/include/param.h Sun Jul 5 16:55:57 2009 (r195375) +++ head/sys/mips/include/param.h Sun Jul 5 17:45:48 2009 (r195376) @@ -84,10 +84,16 @@ */ #define _ALIGNBYTES 7 #define _ALIGN(p) (((u_int)(p) + _ALIGNBYTES) &~ _ALIGNBYTES) -#define ALIGNED_POINTER(p, t) ((((u_int32_t)(p)) & (sizeof (t) - 1)) == 0) #define ALIGNBYTES _ALIGNBYTES #define ALIGN(p) _ALIGN(p) +/* + * ALIGNED_POINTER is a boolean macro that checks whether an address + * is valid to fetch data elements of type t from on this architecture. + * This does not reflect the optimal alignment, just the possibility + * (within reasonable limits). + */ +#define ALIGNED_POINTER(p, t) ((((unsigned)(p)) & (sizeof (t) - 1)) == 0) /* * CACHE_LINE_SIZE is the compile-time maximum cache line size for an Modified: head/sys/powerpc/include/param.h ============================================================================== --- head/sys/powerpc/include/param.h Sun Jul 5 16:55:57 2009 (r195375) +++ head/sys/powerpc/include/param.h Sun Jul 5 17:45:48 2009 (r195376) @@ -78,6 +78,13 @@ #define ALIGNBYTES _ALIGNBYTES #define ALIGN(p) _ALIGN(p) +/* + * ALIGNED_POINTER is a boolean macro that checks whether an address + * is valid to fetch data elements of type t from on this architecture. + * This does not reflect the optimal alignment, just the possibility + * (within reasonable limits). + */ +#define ALIGNED_POINTER(p, t) ((((unsigned)(p)) & (sizeof (t) - 1)) == 0) /* * CACHE_LINE_SIZE is the compile-time maximum cache line size for an Modified: head/sys/sparc64/include/param.h ============================================================================== --- head/sys/sparc64/include/param.h Sun Jul 5 16:55:57 2009 (r195375) +++ head/sys/sparc64/include/param.h Sun Jul 5 17:45:48 2009 (r195376) @@ -70,6 +70,13 @@ #define ALIGNBYTES _ALIGNBYTES #define ALIGN(p) _ALIGN(p) +/* + * ALIGNED_POINTER is a boolean macro that checks whether an address + * is valid to fetch data elements of type t from on this architecture. + * This does not reflect the optimal alignment, just the possibility + * (within reasonable limits). + */ +#define ALIGNED_POINTER(p, t) ((((u_long)(p)) & (sizeof (t) - 1)) == 0) /* * CACHE_LINE_SIZE is the compile-time maximum cache line size for an Modified: head/sys/sun4v/include/param.h ============================================================================== --- head/sys/sun4v/include/param.h Sun Jul 5 16:55:57 2009 (r195375) +++ head/sys/sun4v/include/param.h Sun Jul 5 17:45:48 2009 (r195376) @@ -70,6 +70,13 @@ #define ALIGNBYTES _ALIGNBYTES #define ALIGN(p) _ALIGN(p) +/* + * ALIGNED_POINTER is a boolean macro that checks whether an address + * is valid to fetch data elements of type t from on this architecture. + * This does not reflect the optimal alignment, just the possibility + * (within reasonable limits). + */ +#define ALIGNED_POINTER(p, t) ((((u_long)(p)) & (sizeof (t) - 1)) == 0) /* * CACHE_LINE_SIZE is the compile-time maximum cache line size for an From owner-svn-src-head@FreeBSD.ORG Sun Jul 5 17:59:19 2009 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 9A249106564A; Sun, 5 Jul 2009 17:59:19 +0000 (UTC) (envelope-from sam@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 870758FC14; Sun, 5 Jul 2009 17:59:19 +0000 (UTC) (envelope-from sam@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n65HxJK6056088; Sun, 5 Jul 2009 17:59:19 GMT (envelope-from sam@svn.freebsd.org) Received: (from sam@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n65HxJ3v056078; Sun, 5 Jul 2009 17:59:19 GMT (envelope-from sam@svn.freebsd.org) Message-Id: <200907051759.n65HxJ3v056078@svn.freebsd.org> From: Sam Leffler Date: Sun, 5 Jul 2009 17:59: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: r195377 - in head/sys: conf dev/mwl net80211 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, 05 Jul 2009 17:59:20 -0000 Author: sam Date: Sun Jul 5 17:59:19 2009 New Revision: 195377 URL: http://svn.freebsd.org/changeset/base/195377 Log: Revamp 802.11 action frame handling: o add a new facility for components to register send+recv handlers o ieee80211_send_action and ieee80211_recv_action now use the registered handlers to dispatch operations o rev ieee80211_send_action api to enable passing arbitrary data o rev ieee80211_recv_action api to pass the 802.11 frame header as it may be difficult to locate o update existing IEEE80211_ACTION_CAT_BA and IEEE80211_ACTION_CAT_HT handling o update mwl for api rev Reviewed by: rpaulo Approved by: re (kensmith) Added: head/sys/net80211/ieee80211_action.c (contents, props changed) head/sys/net80211/ieee80211_action.h (contents, props changed) Modified: head/sys/conf/files head/sys/dev/mwl/if_mwl.c head/sys/dev/mwl/if_mwlvar.h head/sys/net80211/ieee80211_adhoc.c head/sys/net80211/ieee80211_hostap.c head/sys/net80211/ieee80211_ht.c head/sys/net80211/ieee80211_ht.h head/sys/net80211/ieee80211_sta.c head/sys/net80211/ieee80211_var.h head/sys/net80211/ieee80211_wds.c Modified: head/sys/conf/files ============================================================================== --- head/sys/conf/files Sun Jul 5 17:45:48 2009 (r195376) +++ head/sys/conf/files Sun Jul 5 17:59:19 2009 (r195377) @@ -2231,6 +2231,7 @@ net/zlib.c optional crypto | geom_uzip ddb_ctf net80211/ieee80211.c optional wlan net80211/ieee80211_acl.c optional wlan wlan_acl +net80211/ieee80211_action.c optional wlan net80211/ieee80211_adhoc.c optional wlan net80211/ieee80211_amrr.c optional wlan wlan_amrr net80211/ieee80211_crypto.c optional wlan Modified: head/sys/dev/mwl/if_mwl.c ============================================================================== --- head/sys/dev/mwl/if_mwl.c Sun Jul 5 17:45:48 2009 (r195376) +++ head/sys/dev/mwl/if_mwl.c Sun Jul 5 17:59:19 2009 (r195377) @@ -144,7 +144,8 @@ static void mwl_tx_proc(void *, int); static int mwl_chan_set(struct mwl_softc *, struct ieee80211_channel *); static void mwl_draintxq(struct mwl_softc *); static void mwl_cleartxq(struct mwl_softc *, struct ieee80211vap *); -static void mwl_recv_action(struct ieee80211_node *, +static int mwl_recv_action(struct ieee80211_node *, + const struct ieee80211_frame *, const uint8_t *, const uint8_t *); static int mwl_addba_request(struct ieee80211_node *, struct ieee80211_tx_ampdu *, int dialogtoken, @@ -3656,8 +3657,9 @@ mwl_cleartxq(struct mwl_softc *sc, struc } } -static void -mwl_recv_action(struct ieee80211_node *ni, const uint8_t *frm, const uint8_t *efrm) +static int +mwl_recv_action(struct ieee80211_node *ni, const struct ieee80211_frame *wh, + const uint8_t *frm, const uint8_t *efrm) { struct mwl_softc *sc = ni->ni_ic->ic_ifp->if_softc; const struct ieee80211_action *ia; @@ -3671,8 +3673,9 @@ mwl_recv_action(struct ieee80211_node *n mwl_hal_setmimops(sc->sc_mh, ni->ni_macaddr, mps->am_control & IEEE80211_A_HT_MIMOPWRSAVE_ENA, MS(mps->am_control, IEEE80211_A_HT_MIMOPWRSAVE_MODE)); + return 0; } else - sc->sc_recv_action(ni, frm, efrm); + return sc->sc_recv_action(ni, wh, frm, efrm); } static int Modified: head/sys/dev/mwl/if_mwlvar.h ============================================================================== --- head/sys/dev/mwl/if_mwlvar.h Sun Jul 5 17:45:48 2009 (r195376) +++ head/sys/dev/mwl/if_mwlvar.h Sun Jul 5 17:59:19 2009 (r195377) @@ -289,7 +289,8 @@ struct mwl_softc { enum ieee80211_state, int); void (*sc_node_cleanup)(struct ieee80211_node *); void (*sc_node_drain)(struct ieee80211_node *); - void (*sc_recv_action)(struct ieee80211_node *, + int (*sc_recv_action)(struct ieee80211_node *, + const struct ieee80211_frame *, const uint8_t *, const uint8_t *); int (*sc_addba_request)(struct ieee80211_node *, struct ieee80211_tx_ampdu *, Added: head/sys/net80211/ieee80211_action.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/net80211/ieee80211_action.c Sun Jul 5 17:59:19 2009 (r195377) @@ -0,0 +1,291 @@ +/*- + * Copyright (c) 2009 Sam Leffler, Errno Consulting + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include +#ifdef __FreeBSD__ +__FBSDID("$FreeBSD$"); +#endif + +/* + * IEEE 802.11 send/recv action frame support. + */ + +#include "opt_inet.h" +#include "opt_wlan.h" + +#include +#include +#include + +#include + +#include +#include +#include + +#include +#include + +static int +send_inval(struct ieee80211_node *ni, int cat, int act, void *sa) +{ + return EINVAL; +} + +static ieee80211_send_action_func *ba_send_action[8] = { + send_inval, send_inval, send_inval, send_inval, + send_inval, send_inval, send_inval, send_inval, +}; +static ieee80211_send_action_func *ht_send_action[8] = { + send_inval, send_inval, send_inval, send_inval, + send_inval, send_inval, send_inval, send_inval, +}; +/* NB: temporary until 802.11s support is added */ +#ifdef IEEE80211_ACTION_CAT_MESHPEERING +static ieee80211_send_action_func *meshpl_send_action[8] = { + send_inval, send_inval, send_inval, send_inval, + send_inval, send_inval, send_inval, send_inval, +}; +static ieee80211_send_action_func *meshlm_send_action[4] = { + send_inval, send_inval, send_inval, send_inval, +}; +static ieee80211_send_action_func *hwmp_send_action[8] = { + send_inval, send_inval, send_inval, send_inval, + send_inval, send_inval, send_inval, send_inval, +}; +#endif +static ieee80211_send_action_func *vendor_send_action[8] = { + send_inval, send_inval, send_inval, send_inval, + send_inval, send_inval, send_inval, send_inval, +}; + +int +ieee80211_send_action_register(int cat, int act, ieee80211_send_action_func *f) +{ +#define N(a) (sizeof(a) / sizeof(a[0])) + switch (cat) { + case IEEE80211_ACTION_CAT_BA: + if (act >= N(ba_send_action)) + break; + ba_send_action[act] = f; + return 0; + case IEEE80211_ACTION_CAT_HT: + if (act >= N(ht_send_action)) + break; + ht_send_action[act] = f; + return 0; +#ifdef IEEE80211_ACTION_CAT_MESHPEERING + case IEEE80211_ACTION_CAT_MESHPEERING: + if (act >= N(meshpl_send_action)) + break; + meshpl_send_action[act] = f; + return 0; + case IEEE80211_ACTION_CAT_MESHLMETRIC: + if (act >= N(meshlm_send_action)) + break; + meshlm_send_action[act] = f; + return 0; + case IEEE80211_ACTION_CAT_MESHPATH: + if (act > N(hwmp_send_action)) + break; + hwmp_send_action[act] = f; + return 0; +#endif + case IEEE80211_ACTION_CAT_VENDOR: + if (act >= N(vendor_send_action)) + break; + vendor_send_action[act] = f; + return 0; + } + return EINVAL; +#undef N +} + +void +ieee80211_send_action_unregister(int cat, int act) +{ + ieee80211_send_action_register(cat, act, send_inval); +} + +int +ieee80211_send_action(struct ieee80211_node *ni, int cat, int act, void *sa) +{ +#define N(a) (sizeof(a) / sizeof(a[0])) + ieee80211_send_action_func *f = send_inval; + + switch (cat) { + case IEEE80211_ACTION_CAT_BA: + if (act < N(ba_send_action)) + f = ba_send_action[act]; + break; + case IEEE80211_ACTION_CAT_HT: + if (act < N(ht_send_action)) + f = ht_send_action[act]; + break; +#ifdef IEEE80211_ACTION_CAT_MESHPEERING + case IEEE80211_ACTION_CAT_MESHPEERING: + if (act < N(meshpl_send_action)) + f = meshpl_send_action[act]; + break; + case IEEE80211_ACTION_CAT_MESHLMETRIC: + if (act < N(meshlm_send_action)) + f = meshlm_send_action[act]; + break; + case IEEE80211_ACTION_CAT_MESHPATH: + if (act < N(hwmp_send_action)) + f = hwmp_send_action[act]; + break; +#endif + case IEEE80211_ACTION_CAT_VENDOR: + if (act < N(vendor_send_action)) + f = vendor_send_action[act]; + break; + } + return f(ni, cat, act, sa); +#undef N +} + +static int +recv_inval(struct ieee80211_node *ni, const struct ieee80211_frame *wh, + const uint8_t *frm, const uint8_t *efrm) +{ + return EINVAL; +} + +static ieee80211_recv_action_func *ba_recv_action[8] = { + recv_inval, recv_inval, recv_inval, recv_inval, + recv_inval, recv_inval, recv_inval, recv_inval, +}; +static ieee80211_recv_action_func *ht_recv_action[8] = { + recv_inval, recv_inval, recv_inval, recv_inval, + recv_inval, recv_inval, recv_inval, recv_inval, +}; +#ifdef IEEE80211_ACTION_CAT_MESHPEERING +static ieee80211_recv_action_func *meshpl_recv_action[8] = { + recv_inval, recv_inval, recv_inval, recv_inval, + recv_inval, recv_inval, recv_inval, recv_inval, +}; +static ieee80211_recv_action_func *meshlm_recv_action[4] = { + recv_inval, recv_inval, recv_inval, recv_inval, +}; +static ieee80211_recv_action_func *hwmp_recv_action[8] = { + recv_inval, recv_inval, recv_inval, recv_inval, + recv_inval, recv_inval, recv_inval, recv_inval, +}; +#endif +static ieee80211_recv_action_func *vendor_recv_action[8] = { + recv_inval, recv_inval, recv_inval, recv_inval, + recv_inval, recv_inval, recv_inval, recv_inval, +}; + +int +ieee80211_recv_action_register(int cat, int act, ieee80211_recv_action_func *f) +{ +#define N(a) (sizeof(a) / sizeof(a[0])) + switch (cat) { + case IEEE80211_ACTION_CAT_BA: + if (act >= N(ba_recv_action)) + break; + ba_recv_action[act] = f; + return 0; + case IEEE80211_ACTION_CAT_HT: + if (act >= N(ht_recv_action)) + break; + ht_recv_action[act] = f; + return 0; +#ifdef IEEE80211_ACTION_CAT_MESHPEERING + case IEEE80211_ACTION_CAT_MESHPEERING: + if (act >= N(meshpl_recv_action)) + break; + meshpl_recv_action[act] = f; + return 0; + case IEEE80211_ACTION_CAT_MESHLMETRIC: + if (act >= N(meshlm_recv_action)) + break; + meshlm_recv_action[act] = f; + return 0; + case IEEE80211_ACTION_CAT_MESHPATH: + if (act >= N(hwmp_recv_action)) + break; + hwmp_recv_action[act] = f; + return 0; +#endif + case IEEE80211_ACTION_CAT_VENDOR: + if (act >= N(vendor_recv_action)) + break; + vendor_recv_action[act] = f; + return 0; + } + return EINVAL; +#undef N +} + +void +ieee80211_recv_action_unregister(int cat, int act) +{ + ieee80211_recv_action_register(cat, act, recv_inval); +} + +int +ieee80211_recv_action(struct ieee80211_node *ni, + const struct ieee80211_frame *wh, + const uint8_t *frm, const uint8_t *efrm) +{ +#define N(a) (sizeof(a) / sizeof(a[0])) + ieee80211_recv_action_func *f = recv_inval; + const struct ieee80211_action *ia = + (const struct ieee80211_action *) frm; + + switch (ia->ia_category) { + case IEEE80211_ACTION_CAT_BA: + if (ia->ia_action < N(ba_recv_action)) + f = ba_recv_action[ia->ia_action]; + break; + case IEEE80211_ACTION_CAT_HT: + if (ia->ia_action < N(ht_recv_action)) + f = ht_recv_action[ia->ia_action]; + break; +#ifdef IEEE80211_ACTION_CAT_MESHPEERING + case IEEE80211_ACTION_CAT_MESHPEERING: + if (ia->ia_action < N(meshpl_recv_action)) + f = meshpl_recv_action[ia->ia_action]; + break; + case IEEE80211_ACTION_CAT_MESHLMETRIC: + if (ia->ia_action < N(meshlm_recv_action)) + f = meshlm_recv_action[ia->ia_action]; + break; + case IEEE80211_ACTION_CAT_MESHPATH: + if (ia->ia_action < N(hwmp_recv_action)) + f = hwmp_recv_action[ia->ia_action]; + break; +#endif + case IEEE80211_ACTION_CAT_VENDOR: + if (ia->ia_action < N(vendor_recv_action)) + f = vendor_recv_action[ia->ia_action]; + break; + } + return f(ni, wh, frm, efrm); +#undef N +} Added: head/sys/net80211/ieee80211_action.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/net80211/ieee80211_action.h Sun Jul 5 17:59:19 2009 (r195377) @@ -0,0 +1,52 @@ +/*- + * Copyright (c) 2009 Sam Leffler, Errno Consulting + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * $FreeBSD$ + */ +#ifndef _NET80211_IEEE80211_ACTION_H_ +#define _NET80211_IEEE80211_ACTION_H_ + +/* + * 802.11 send/recv action frame support. + */ + +struct ieee80211_node; +struct ieee80211_frame; + +typedef int ieee80211_send_action_func(struct ieee80211_node *, + int, int, void *); +int ieee80211_send_action_register(int cat, int act, + ieee80211_send_action_func *f); +void ieee80211_send_action_unregister(int cat, int act); +int ieee80211_send_action(struct ieee80211_node *, int, int, void *); + +typedef int ieee80211_recv_action_func(struct ieee80211_node *, + const struct ieee80211_frame *, const uint8_t *, const uint8_t *); +int ieee80211_recv_action_register(int cat, int act, + ieee80211_recv_action_func *); +void ieee80211_recv_action_unregister(int cat, int act); +int ieee80211_recv_action(struct ieee80211_node *, + const struct ieee80211_frame *, + const uint8_t *, const uint8_t *); +#endif /* _NET80211_IEEE80211_ACTION_H_ */ Modified: head/sys/net80211/ieee80211_adhoc.c ============================================================================== --- head/sys/net80211/ieee80211_adhoc.c Sun Jul 5 17:45:48 2009 (r195376) +++ head/sys/net80211/ieee80211_adhoc.c Sun Jul 5 17:59:19 2009 (r195377) @@ -879,7 +879,7 @@ adhoc_recv_mgmt(struct ieee80211_node *n } break; } - ic->ic_recv_action(ni, frm, efrm); + ic->ic_recv_action(ni, wh, frm, efrm); break; } Modified: head/sys/net80211/ieee80211_hostap.c ============================================================================== --- head/sys/net80211/ieee80211_hostap.c Sun Jul 5 17:45:48 2009 (r195376) +++ head/sys/net80211/ieee80211_hostap.c Sun Jul 5 17:59:19 2009 (r195377) @@ -2189,7 +2189,7 @@ hostap_recv_mgmt(struct ieee80211_node * case IEEE80211_FC0_SUBTYPE_ACTION: if (vap->iv_state == IEEE80211_S_RUN) { if (ieee80211_parse_action(ni, m0) == 0) - ic->ic_recv_action(ni, frm, efrm); + ic->ic_recv_action(ni, wh, frm, efrm); } else vap->iv_stats.is_rx_mgtdiscard++; break; Modified: head/sys/net80211/ieee80211_ht.c ============================================================================== --- head/sys/net80211/ieee80211_ht.c Sun Jul 5 17:45:48 2009 (r195376) +++ head/sys/net80211/ieee80211_ht.c Sun Jul 5 17:59:19 2009 (r195377) @@ -47,6 +47,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include /* define here, used throughout file */ @@ -104,20 +105,52 @@ SYSCTL_INT(_net_wlan, OID_AUTO, addba_ma static int ieee80211_bar_timeout = -1; /* timeout waiting for BAR response */ static int ieee80211_bar_maxtries = 50;/* max BAR requests before DELBA */ -/* - * Setup HT parameters that depends on the clock frequency. - */ +static ieee80211_recv_action_func ht_recv_action_ba_addba_request; +static ieee80211_recv_action_func ht_recv_action_ba_addba_response; +static ieee80211_recv_action_func ht_recv_action_ba_delba; +static ieee80211_recv_action_func ht_recv_action_ht_mimopwrsave; +static ieee80211_recv_action_func ht_recv_action_ht_txchwidth; + +static ieee80211_send_action_func ht_send_action_ba_addba; +static ieee80211_send_action_func ht_send_action_ba_delba; +static ieee80211_send_action_func ht_send_action_ht_txchwidth; + static void -ieee80211_ht_setup(void) +ieee80211_ht_init(void) { + /* + * Setup HT parameters that depends on the clock frequency. + */ #ifdef IEEE80211_AMPDU_AGE ieee80211_ampdu_age = msecs_to_ticks(500); #endif ieee80211_addba_timeout = msecs_to_ticks(250); ieee80211_addba_backoff = msecs_to_ticks(10*1000); ieee80211_bar_timeout = msecs_to_ticks(250); + /* + * Register action frame handlers. + */ + ieee80211_recv_action_register(IEEE80211_ACTION_CAT_BA, + IEEE80211_ACTION_BA_ADDBA_REQUEST, ht_recv_action_ba_addba_request); + ieee80211_recv_action_register(IEEE80211_ACTION_CAT_BA, + IEEE80211_ACTION_BA_ADDBA_RESPONSE, ht_recv_action_ba_addba_response); + ieee80211_recv_action_register(IEEE80211_ACTION_CAT_BA, + IEEE80211_ACTION_BA_DELBA, ht_recv_action_ba_delba); + ieee80211_recv_action_register(IEEE80211_ACTION_CAT_HT, + IEEE80211_ACTION_HT_MIMOPWRSAVE, ht_recv_action_ht_mimopwrsave); + ieee80211_recv_action_register(IEEE80211_ACTION_CAT_HT, + IEEE80211_ACTION_HT_TXCHWIDTH, ht_recv_action_ht_txchwidth); + + ieee80211_send_action_register(IEEE80211_ACTION_CAT_BA, + IEEE80211_ACTION_BA_ADDBA_REQUEST, ht_send_action_ba_addba); + ieee80211_send_action_register(IEEE80211_ACTION_CAT_BA, + IEEE80211_ACTION_BA_ADDBA_RESPONSE, ht_send_action_ba_addba); + ieee80211_send_action_register(IEEE80211_ACTION_CAT_BA, + IEEE80211_ACTION_BA_DELBA, ht_send_action_ba_delba); + ieee80211_send_action_register(IEEE80211_ACTION_CAT_HT, + IEEE80211_ACTION_HT_TXCHWIDTH, ht_send_action_ht_txchwidth); } -SYSINIT(wlan_ht, SI_SUB_DRIVERS, SI_ORDER_FIRST, ieee80211_ht_setup, NULL); +SYSINIT(wlan_ht, SI_SUB_DRIVERS, SI_ORDER_FIRST, ieee80211_ht_init, NULL); static int ieee80211_ampdu_enable(struct ieee80211_node *ni, struct ieee80211_tx_ampdu *tap); @@ -129,8 +162,6 @@ static int ieee80211_addba_response(stru int code, int baparamset, int batimeout); static void ieee80211_addba_stop(struct ieee80211_node *ni, struct ieee80211_tx_ampdu *tap); -static void ieee80211_aggr_recv_action(struct ieee80211_node *ni, - const uint8_t *frm, const uint8_t *efrm); static void ieee80211_bar_response(struct ieee80211_node *ni, struct ieee80211_tx_ampdu *tap, int status); static void ampdu_tx_stop(struct ieee80211_tx_ampdu *tap); @@ -143,7 +174,7 @@ void ieee80211_ht_attach(struct ieee80211com *ic) { /* setup default aggregation policy */ - ic->ic_recv_action = ieee80211_aggr_recv_action; + ic->ic_recv_action = ieee80211_recv_action; ic->ic_send_action = ieee80211_send_action; ic->ic_ampdu_enable = ieee80211_ampdu_enable; ic->ic_addba_request = ieee80211_addba_request; @@ -1580,247 +1611,221 @@ ieee80211_addba_stop(struct ieee80211_no * update our aggregation state. All other frames are passed up * for processing by ieee80211_recv_action. */ -static void -ieee80211_aggr_recv_action(struct ieee80211_node *ni, +static int +ht_recv_action_ba_addba_request(struct ieee80211_node *ni, + const struct ieee80211_frame *wh, const uint8_t *frm, const uint8_t *efrm) { struct ieee80211com *ic = ni->ni_ic; struct ieee80211vap *vap = ni->ni_vap; - const struct ieee80211_action *ia; struct ieee80211_rx_ampdu *rap; - struct ieee80211_tx_ampdu *tap; - uint8_t dialogtoken, policy; - uint16_t baparamset, batimeout, baseqctl, code; + uint8_t dialogtoken; + uint16_t baparamset, batimeout, baseqctl; uint16_t args[4]; - int tid, ac, bufsiz; + int tid; - ia = (const struct ieee80211_action *) frm; - switch (ia->ia_category) { - case IEEE80211_ACTION_CAT_BA: - switch (ia->ia_action) { - case IEEE80211_ACTION_BA_ADDBA_REQUEST: - dialogtoken = frm[2]; - baparamset = LE_READ_2(frm+3); - batimeout = LE_READ_2(frm+5); - baseqctl = LE_READ_2(frm+7); + dialogtoken = frm[2]; + baparamset = LE_READ_2(frm+3); + batimeout = LE_READ_2(frm+5); + baseqctl = LE_READ_2(frm+7); + + tid = MS(baparamset, IEEE80211_BAPS_TID); + + IEEE80211_NOTE(vap, IEEE80211_MSG_ACTION | IEEE80211_MSG_11N, ni, + "recv ADDBA request: dialogtoken %u baparamset 0x%x " + "(tid %d bufsiz %d) batimeout %d baseqctl %d:%d", + dialogtoken, baparamset, + tid, MS(baparamset, IEEE80211_BAPS_BUFSIZ), + batimeout, + MS(baseqctl, IEEE80211_BASEQ_START), + MS(baseqctl, IEEE80211_BASEQ_FRAG)); - tid = MS(baparamset, IEEE80211_BAPS_TID); + rap = &ni->ni_rx_ampdu[tid]; - IEEE80211_NOTE(vap, - IEEE80211_MSG_ACTION | IEEE80211_MSG_11N, ni, - "recv ADDBA request: dialogtoken %u " - "baparamset 0x%x (tid %d bufsiz %d) batimeout %d " - "baseqctl %d:%d", - dialogtoken, baparamset, - tid, MS(baparamset, IEEE80211_BAPS_BUFSIZ), - batimeout, - MS(baseqctl, IEEE80211_BASEQ_START), - MS(baseqctl, IEEE80211_BASEQ_FRAG)); + /* Send ADDBA response */ + args[0] = dialogtoken; + /* + * NB: We ack only if the sta associated with HT and + * the ap is configured to do AMPDU rx (the latter + * violates the 11n spec and is mostly for testing). + */ + if ((ni->ni_flags & IEEE80211_NODE_AMPDU_RX) && + (vap->iv_flags_ht & IEEE80211_FHT_AMPDU_RX)) { + /* XXX handle ampdu_rx_start failure */ + ic->ic_ampdu_rx_start(ni, rap, + baparamset, batimeout, baseqctl); - rap = &ni->ni_rx_ampdu[tid]; + args[1] = IEEE80211_STATUS_SUCCESS; + } else { + IEEE80211_NOTE(vap, IEEE80211_MSG_ACTION | IEEE80211_MSG_11N, + ni, "reject ADDBA request: %s", + ni->ni_flags & IEEE80211_NODE_AMPDU_RX ? + "administratively disabled" : + "not negotiated for station"); + vap->iv_stats.is_addba_reject++; + args[1] = IEEE80211_STATUS_UNSPECIFIED; + } + /* XXX honor rap flags? */ + args[2] = IEEE80211_BAPS_POLICY_IMMEDIATE + | SM(tid, IEEE80211_BAPS_TID) + | SM(rap->rxa_wnd, IEEE80211_BAPS_BUFSIZ) + ; + args[3] = 0; + ic->ic_send_action(ni, IEEE80211_ACTION_CAT_BA, + IEEE80211_ACTION_BA_ADDBA_RESPONSE, args); + return 0; +} - /* Send ADDBA response */ - args[0] = dialogtoken; - /* - * NB: We ack only if the sta associated with HT and - * the ap is configured to do AMPDU rx (the latter - * violates the 11n spec and is mostly for testing). - */ - if ((ni->ni_flags & IEEE80211_NODE_AMPDU_RX) && - (vap->iv_flags_ht & IEEE80211_FHT_AMPDU_RX)) { - /* XXX handle ampdu_rx_start failure */ - ic->ic_ampdu_rx_start(ni, rap, - baparamset, batimeout, baseqctl); +static int +ht_recv_action_ba_addba_response(struct ieee80211_node *ni, + const struct ieee80211_frame *wh, + const uint8_t *frm, const uint8_t *efrm) +{ + struct ieee80211com *ic = ni->ni_ic; + struct ieee80211vap *vap = ni->ni_vap; + struct ieee80211_tx_ampdu *tap; + uint8_t dialogtoken, policy; + uint16_t baparamset, batimeout, code; + int tid, ac, bufsiz; - args[1] = IEEE80211_STATUS_SUCCESS; - } else { - IEEE80211_NOTE(vap, - IEEE80211_MSG_ACTION | IEEE80211_MSG_11N, - ni, "reject ADDBA request: %s", - ni->ni_flags & IEEE80211_NODE_AMPDU_RX ? - "administratively disabled" : - "not negotiated for station"); - vap->iv_stats.is_addba_reject++; - args[1] = IEEE80211_STATUS_UNSPECIFIED; - } - /* XXX honor rap flags? */ - args[2] = IEEE80211_BAPS_POLICY_IMMEDIATE - | SM(tid, IEEE80211_BAPS_TID) - | SM(rap->rxa_wnd, IEEE80211_BAPS_BUFSIZ) - ; - args[3] = 0; - ic->ic_send_action(ni, IEEE80211_ACTION_CAT_BA, - IEEE80211_ACTION_BA_ADDBA_RESPONSE, args); - return; - - case IEEE80211_ACTION_BA_ADDBA_RESPONSE: - dialogtoken = frm[2]; - code = LE_READ_2(frm+3); - baparamset = LE_READ_2(frm+5); - tid = MS(baparamset, IEEE80211_BAPS_TID); - bufsiz = MS(baparamset, IEEE80211_BAPS_BUFSIZ); - policy = MS(baparamset, IEEE80211_BAPS_POLICY); - batimeout = LE_READ_2(frm+7); - - ac = TID_TO_WME_AC(tid); - tap = &ni->ni_tx_ampdu[ac]; - if ((tap->txa_flags & IEEE80211_AGGR_XCHGPEND) == 0) { - IEEE80211_DISCARD_MAC(vap, - IEEE80211_MSG_ACTION | IEEE80211_MSG_11N, - ni->ni_macaddr, "ADDBA response", - "no pending ADDBA, tid %d dialogtoken %u " - "code %d", tid, dialogtoken, code); - vap->iv_stats.is_addba_norequest++; - return; - } - if (dialogtoken != tap->txa_token) { - IEEE80211_DISCARD_MAC(vap, - IEEE80211_MSG_ACTION | IEEE80211_MSG_11N, - ni->ni_macaddr, "ADDBA response", - "dialogtoken mismatch: waiting for %d, " - "received %d, tid %d code %d", - tap->txa_token, dialogtoken, tid, code); - vap->iv_stats.is_addba_badtoken++; - return; - } - /* NB: assumes IEEE80211_AGGR_IMMEDIATE is 1 */ - if (policy != (tap->txa_flags & IEEE80211_AGGR_IMMEDIATE)) { - IEEE80211_DISCARD_MAC(vap, - IEEE80211_MSG_ACTION | IEEE80211_MSG_11N, - ni->ni_macaddr, "ADDBA response", - "policy mismatch: expecting %s, " - "received %s, tid %d code %d", - tap->txa_flags & IEEE80211_AGGR_IMMEDIATE, - policy, tid, code); - vap->iv_stats.is_addba_badpolicy++; - return; - } + dialogtoken = frm[2]; + code = LE_READ_2(frm+3); + baparamset = LE_READ_2(frm+5); + tid = MS(baparamset, IEEE80211_BAPS_TID); + bufsiz = MS(baparamset, IEEE80211_BAPS_BUFSIZ); + policy = MS(baparamset, IEEE80211_BAPS_POLICY); + batimeout = LE_READ_2(frm+7); + + ac = TID_TO_WME_AC(tid); + tap = &ni->ni_tx_ampdu[ac]; + if ((tap->txa_flags & IEEE80211_AGGR_XCHGPEND) == 0) { + IEEE80211_DISCARD_MAC(vap, + IEEE80211_MSG_ACTION | IEEE80211_MSG_11N, + ni->ni_macaddr, "ADDBA response", + "no pending ADDBA, tid %d dialogtoken %u " + "code %d", tid, dialogtoken, code); + vap->iv_stats.is_addba_norequest++; + return 0; + } + if (dialogtoken != tap->txa_token) { + IEEE80211_DISCARD_MAC(vap, + IEEE80211_MSG_ACTION | IEEE80211_MSG_11N, + ni->ni_macaddr, "ADDBA response", + "dialogtoken mismatch: waiting for %d, " + "received %d, tid %d code %d", + tap->txa_token, dialogtoken, tid, code); + vap->iv_stats.is_addba_badtoken++; + return 0; + } + /* NB: assumes IEEE80211_AGGR_IMMEDIATE is 1 */ + if (policy != (tap->txa_flags & IEEE80211_AGGR_IMMEDIATE)) { + IEEE80211_DISCARD_MAC(vap, + IEEE80211_MSG_ACTION | IEEE80211_MSG_11N, + ni->ni_macaddr, "ADDBA response", + "policy mismatch: expecting %s, " + "received %s, tid %d code %d", + tap->txa_flags & IEEE80211_AGGR_IMMEDIATE, + policy, tid, code); + vap->iv_stats.is_addba_badpolicy++; + return 0; + } #if 0 - /* XXX we take MIN in ieee80211_addba_response */ - if (bufsiz > IEEE80211_AGGR_BAWMAX) { - IEEE80211_DISCARD_MAC(vap, - IEEE80211_MSG_ACTION | IEEE80211_MSG_11N, - ni->ni_macaddr, "ADDBA response", - "BA window too large: max %d, " - "received %d, tid %d code %d", - bufsiz, IEEE80211_AGGR_BAWMAX, tid, code); - vap->iv_stats.is_addba_badbawinsize++; - return; - } + /* XXX we take MIN in ieee80211_addba_response */ + if (bufsiz > IEEE80211_AGGR_BAWMAX) { + IEEE80211_DISCARD_MAC(vap, + IEEE80211_MSG_ACTION | IEEE80211_MSG_11N, + ni->ni_macaddr, "ADDBA response", + "BA window too large: max %d, " + "received %d, tid %d code %d", + bufsiz, IEEE80211_AGGR_BAWMAX, tid, code); + vap->iv_stats.is_addba_badbawinsize++; + return 0; + } #endif - IEEE80211_NOTE(vap, - IEEE80211_MSG_ACTION | IEEE80211_MSG_11N, ni, - "recv ADDBA response: dialogtoken %u code %d " - "baparamset 0x%x (tid %d bufsiz %d) batimeout %d", - dialogtoken, code, baparamset, tid, bufsiz, - batimeout); - ic->ic_addba_response(ni, tap, - code, baparamset, batimeout); - return; - - case IEEE80211_ACTION_BA_DELBA: - baparamset = LE_READ_2(frm+2); - code = LE_READ_2(frm+4); + IEEE80211_NOTE(vap, IEEE80211_MSG_ACTION | IEEE80211_MSG_11N, ni, + "recv ADDBA response: dialogtoken %u code %d " + "baparamset 0x%x (tid %d bufsiz %d) batimeout %d", + dialogtoken, code, baparamset, tid, bufsiz, + batimeout); + ic->ic_addba_response(ni, tap, code, baparamset, batimeout); + return 0; +} - tid = MS(baparamset, IEEE80211_DELBAPS_TID); +static int +ht_recv_action_ba_delba(struct ieee80211_node *ni, + const struct ieee80211_frame *wh, + const uint8_t *frm, const uint8_t *efrm) +{ + struct ieee80211com *ic = ni->ni_ic; + struct ieee80211_rx_ampdu *rap; + struct ieee80211_tx_ampdu *tap; + uint16_t baparamset, code; + int tid, ac; - IEEE80211_NOTE(vap, - IEEE80211_MSG_ACTION | IEEE80211_MSG_11N, ni, - "recv DELBA: baparamset 0x%x (tid %d initiator %d) " - "code %d", baparamset, tid, - MS(baparamset, IEEE80211_DELBAPS_INIT), code); - - if ((baparamset & IEEE80211_DELBAPS_INIT) == 0) { - ac = TID_TO_WME_AC(tid); - tap = &ni->ni_tx_ampdu[ac]; - ic->ic_addba_stop(ni, tap); - } else { - rap = &ni->ni_rx_ampdu[tid]; - ic->ic_ampdu_rx_stop(ni, rap); - } - return; - } - break; + baparamset = LE_READ_2(frm+2); + code = LE_READ_2(frm+4); + + tid = MS(baparamset, IEEE80211_DELBAPS_TID); + + IEEE80211_NOTE(ni->ni_vap, IEEE80211_MSG_ACTION | IEEE80211_MSG_11N, ni, + "recv DELBA: baparamset 0x%x (tid %d initiator %d) " + "code %d", baparamset, tid, + MS(baparamset, IEEE80211_DELBAPS_INIT), code); + + if ((baparamset & IEEE80211_DELBAPS_INIT) == 0) { + ac = TID_TO_WME_AC(tid); + tap = &ni->ni_tx_ampdu[ac]; + ic->ic_addba_stop(ni, tap); + } else { + rap = &ni->ni_rx_ampdu[tid]; + ic->ic_ampdu_rx_stop(ni, rap); } - ieee80211_recv_action(ni, frm, efrm); + return 0; } -/* - * Process a received 802.11n action frame. - * Aggregation-related frames are assumed to be handled - * already; we handle any other frames we can, otherwise - * complain about being unsupported (with debugging). - */ -void -ieee80211_recv_action(struct ieee80211_node *ni, +static int +ht_recv_action_ht_txchwidth(struct ieee80211_node *ni, + const struct ieee80211_frame *wh, const uint8_t *frm, const uint8_t *efrm) { - struct ieee80211vap *vap = ni->ni_vap; - const struct ieee80211_action *ia; int chw; - ia = (const struct ieee80211_action *) frm; - switch (ia->ia_category) { - case IEEE80211_ACTION_CAT_BA: - IEEE80211_NOTE(vap, - IEEE80211_MSG_ACTION | IEEE80211_MSG_11N, ni, - "%s: BA action %d not implemented", __func__, - ia->ia_action); - vap->iv_stats.is_rx_mgtdiscard++; - break; - case IEEE80211_ACTION_CAT_HT: - switch (ia->ia_action) { - case IEEE80211_ACTION_HT_TXCHWIDTH: - chw = frm[2] == IEEE80211_A_HT_TXCHWIDTH_2040 ? 40 : 20; - IEEE80211_NOTE(vap, - IEEE80211_MSG_ACTION | IEEE80211_MSG_11N, ni, - "%s: HT txchwidth, width %d%s", - __func__, chw, ni->ni_chw != chw ? "*" : ""); - if (chw != ni->ni_chw) { - ni->ni_chw = chw; - /* XXX notify on change */ - } - break; - case IEEE80211_ACTION_HT_MIMOPWRSAVE: { - const struct ieee80211_action_ht_mimopowersave *mps = - (const struct ieee80211_action_ht_mimopowersave *) ia; - /* XXX check iv_htcaps */ - if (mps->am_control & IEEE80211_A_HT_MIMOPWRSAVE_ENA) - ni->ni_flags |= IEEE80211_NODE_MIMO_PS; - else - ni->ni_flags &= ~IEEE80211_NODE_MIMO_PS; - if (mps->am_control & IEEE80211_A_HT_MIMOPWRSAVE_MODE) - ni->ni_flags |= IEEE80211_NODE_MIMO_RTS; - else - ni->ni_flags &= ~IEEE80211_NODE_MIMO_RTS; - /* XXX notify on change */ - IEEE80211_NOTE(vap, - IEEE80211_MSG_ACTION | IEEE80211_MSG_11N, ni, - "%s: HT MIMO PS (%s%s)", __func__, - (ni->ni_flags & IEEE80211_NODE_MIMO_PS) ? - "on" : "off", - (ni->ni_flags & IEEE80211_NODE_MIMO_RTS) ? - "+rts" : "" - ); - break; - } - default: - IEEE80211_NOTE(vap, - IEEE80211_MSG_ACTION | IEEE80211_MSG_11N, ni, - "%s: HT action %d not implemented", __func__, - ia->ia_action); - vap->iv_stats.is_rx_mgtdiscard++; - break; - } - break; - default: - IEEE80211_NOTE(vap, - IEEE80211_MSG_ACTION | IEEE80211_MSG_11N, ni, - "%s: category %d not implemented", __func__, - ia->ia_category); - vap->iv_stats.is_rx_mgtdiscard++; - break; + chw = (frm[2] == IEEE80211_A_HT_TXCHWIDTH_2040) ? 40 : 20; + + IEEE80211_NOTE(ni->ni_vap, IEEE80211_MSG_ACTION | IEEE80211_MSG_11N, ni, + "%s: HT txchwidth, width %d%s", + __func__, chw, ni->ni_chw != chw ? "*" : ""); + if (chw != ni->ni_chw) { + ni->ni_chw = chw; + /* XXX notify on change */ } + return 0; +} + +static int +ht_recv_action_ht_mimopwrsave(struct ieee80211_node *ni, + const struct ieee80211_frame *wh, + const uint8_t *frm, const uint8_t *efrm) +{ + const struct ieee80211_action_ht_mimopowersave *mps = + (const struct ieee80211_action_ht_mimopowersave *) frm; + + /* XXX check iv_htcaps */ + if (mps->am_control & IEEE80211_A_HT_MIMOPWRSAVE_ENA) + ni->ni_flags |= IEEE80211_NODE_MIMO_PS; + else + ni->ni_flags &= ~IEEE80211_NODE_MIMO_PS; + if (mps->am_control & IEEE80211_A_HT_MIMOPWRSAVE_MODE) + ni->ni_flags |= IEEE80211_NODE_MIMO_RTS; + else + ni->ni_flags &= ~IEEE80211_NODE_MIMO_RTS; + /* XXX notify on change */ + IEEE80211_NOTE(ni->ni_vap, IEEE80211_MSG_ACTION | IEEE80211_MSG_11N, ni, + "%s: HT MIMO PS (%s%s)", __func__, + (ni->ni_flags & IEEE80211_NODE_MIMO_PS) ? "on" : "off", + (ni->ni_flags & IEEE80211_NODE_MIMO_RTS) ? "+rts" : "" + ); + return 0; } /* @@ -1937,7 +1942,7 @@ ieee80211_ampdu_stop(struct ieee80211_no args[0] = WME_AC_TO_TID(tap->txa_ac); args[1] = IEEE80211_DELBAPS_INIT; args[2] = reason; /* XXX reason code */ - ieee80211_send_action(ni, IEEE80211_ACTION_CAT_BA, + ic->ic_send_action(ni, IEEE80211_ACTION_CAT_BA, IEEE80211_ACTION_BA_DELBA, args); } else { IEEE80211_NOTE(vap, IEEE80211_MSG_ACTION | IEEE80211_MSG_11N, @@ -2115,143 +2120,160 @@ bad: #undef senderr } -/* - * Send an action management frame. The arguments are stuff - * into a frame without inspection; the caller is assumed to - * prepare them carefully (e.g. based on the aggregation state). - */ -int -ieee80211_send_action(struct ieee80211_node *ni, - int category, int action, uint16_t args[4]) +static int +ht_action_output(struct ieee80211_node *ni, struct mbuf *m) { -#define senderr(_x, _v) do { vap->iv_stats._v++; ret = _x; goto bad; } while (0) + struct ieee80211_bpf_params params; + + memset(¶ms, 0, sizeof(params)); + params.ibp_pri = WME_AC_VO; + params.ibp_rate0 = ni->ni_txparms->mgmtrate; + /* NB: we know all frames are unicast */ + params.ibp_try0 = ni->ni_txparms->maxretry; + params.ibp_power = ni->ni_txpower; + return ieee80211_mgmt_output(ni, m, IEEE80211_FC0_SUBTYPE_ACTION, + ¶ms); +} + #define ADDSHORT(frm, v) do { \ frm[0] = (v) & 0xff; \ frm[1] = (v) >> 8; \ frm += 2; \ } while (0) + +/* + * Send an action management frame. The arguments are stuff + * into a frame without inspection; the caller is assumed to + * prepare them carefully (e.g. based on the aggregation state). *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@FreeBSD.ORG Sun Jul 5 18:15:06 2009 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 5DEC6106566C; Sun, 5 Jul 2009 18:15:06 +0000 (UTC) (envelope-from ariff@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 4B6558FC08; Sun, 5 Jul 2009 18:15:06 +0000 (UTC) (envelope-from ariff@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n65IF66d056429; Sun, 5 Jul 2009 18:15:06 GMT (envelope-from ariff@svn.freebsd.org) Received: (from ariff@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n65IF6k3056426; Sun, 5 Jul 2009 18:15:06 GMT (envelope-from ariff@svn.freebsd.org) Message-Id: <200907051815.n65IF6k3056426@svn.freebsd.org> From: Ariff Abdullah Date: Sun, 5 Jul 2009 18:15: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: r195378 - in head/sys: dev/sound/pcm tools/sound 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, 05 Jul 2009 18:15:06 -0000 Author: ariff Date: Sun Jul 5 18:15:06 2009 New Revision: 195378 URL: http://svn.freebsd.org/changeset/base/195378 Log: - Increase dynamic range of filter coefficients from 28bit to 30bit. This cause dramatic effect in overall precision and conversion quality by pushing down most aliasing artifacts around -180 dB. Spectrogram analysis/comparison: http://people.freebsd.org/~ariff/z_comparison/z_28vs30/ - Guard against possible 64bit overflow during accumulation process by slightly normalize and saturate sample and coefficient multiplication, possible during extreme 32bit downsampling (eg. 380KHz -> 8KHz) with custom preset that require more than ~7000 taps filter (which is overkill). - Add knobs through FEEDER_RATE_PRESETS to set dynamic range of filter coefficients/accumulator and prefered polynomial interpolator: COEFFICIENT_BIT:X (where 1 <= X <= 30, default: 30) ACCUMULATOR_BIT:X (where 32 <= X <=64, default: 58) INTERPOLATOR:I (where I = ZOH, LINEAR, QUADRATIC, HERMITE, BSPLINE, OPT32X, OPT16X, OPT8X, OPT4X, OPT2X) Approved by: re (kib) Modified: head/sys/dev/sound/pcm/feeder_rate.c head/sys/tools/sound/feeder_rate_mkfilter.awk Modified: head/sys/dev/sound/pcm/feeder_rate.c ============================================================================== --- head/sys/dev/sound/pcm/feeder_rate.c Sun Jul 5 17:59:19 2009 (r195377) +++ head/sys/dev/sound/pcm/feeder_rate.c Sun Jul 5 18:15:06 2009 (r195378) @@ -527,7 +527,7 @@ z_feed_linear_##SIGN##BIT##ENDIAN(struct z &= Z_MASK; \ coeff = Z_COEFF_INTERPOLATE(z, z_coeff[c], z_dcoeff[c]); \ x = _PCM_READ_##SIGN##BIT##_##ENDIAN(p); \ - v += (intpcm64_t)x * coeff; \ + v += Z_NORM_##BIT((intpcm64_t)x * coeff); \ z += info->z_dy; \ p adv##= info->channels * PCM_##BIT##_BPS @@ -582,7 +582,7 @@ z_feed_sinc_##SIGN##BIT##ENDIAN(struct z if (info->z_scale != Z_ONE) \ v = Z_SCALE_##BIT(v, info->z_scale); \ else \ - v >>= Z_COEFF_SHIFT; \ + v >>= Z_COEFF_SHIFT - Z_GUARD_BIT_##BIT; \ Z_CLIP_CHECK(v, BIT); \ _PCM_WRITE_##SIGN##BIT##_##ENDIAN(dst, Z_CLAMP(v, BIT)); \ } while (ch != 0); \ @@ -610,18 +610,18 @@ z_feed_sinc_polyphase_##SIGN##BIT##ENDIA ((info->z_alpha * info->z_size) << 1); \ for (i = info->z_size; i != 0; i--) { \ x = _PCM_READ_##SIGN##BIT##_##ENDIAN(p); \ - v += (intpcm64_t)x * *z_pcoeff; \ + v += Z_NORM_##BIT((intpcm64_t)x * *z_pcoeff); \ z_pcoeff++; \ p += info->channels * PCM_##BIT##_BPS; \ x = _PCM_READ_##SIGN##BIT##_##ENDIAN(p); \ - v += (intpcm64_t)x * *z_pcoeff; \ + v += Z_NORM_##BIT((intpcm64_t)x * *z_pcoeff); \ z_pcoeff++; \ p += info->channels * PCM_##BIT##_BPS; \ } \ if (info->z_scale != Z_ONE) \ v = Z_SCALE_##BIT(v, info->z_scale); \ else \ - v >>= Z_COEFF_SHIFT; \ + v >>= Z_COEFF_SHIFT - Z_GUARD_BIT_##BIT; \ Z_CLIP_CHECK(v, BIT); \ _PCM_WRITE_##SIGN##BIT##_##ENDIAN(dst, Z_CLAMP(v, BIT)); \ } while (ch != 0); \ @@ -882,7 +882,7 @@ z_coeff_interpolate(int32_t z, int32_t * zoo2 = z_coeff[2] - z_coeff[-1]; zoo3 = z_coeff[3] - z_coeff[-2]; - zoc0 = (((0x1ac2260dLL * zoe1)) >> 30) + + zoc0 = ((0x1ac2260dLL * zoe1) >> 30) + ((0x0526cdcaLL * zoe2) >> 30) + ((0x00170c29LL * zoe3) >> 30); zoc1 = ((0x14f8a49aLL * zoo1) >> 30) + ((0x0d6d1109LL * zoo2) >> 30) + ((0x008cd4dcLL * zoo3) >> 30); @@ -911,7 +911,7 @@ z_coeff_interpolate(int32_t z, int32_t * zoo2 = z_coeff[2] - z_coeff[-1]; zoo3 = z_coeff[3] - z_coeff[-2]; - zoc0 = (((0x1ac2260dLL * zoe1)) >> 30) + + zoc0 = ((0x1ac2260dLL * zoe1) >> 30) + ((0x0526cdcaLL * zoe2) >> 30) + ((0x00170c29LL * zoe3) >> 30); zoc1 = ((0x14f8a49aLL * zoo1) >> 30) + ((0x0d6d1109LL * zoo2) >> 30) + ((0x008cd4dcLL * zoo3) >> 30); @@ -940,7 +940,7 @@ z_coeff_interpolate(int32_t z, int32_t * zoo2 = z_coeff[2] - z_coeff[-1]; zoo3 = z_coeff[3] - z_coeff[-2]; - zoc0 = (((0x1aa9b47dLL * zoe1)) >> 30) + + zoc0 = ((0x1aa9b47dLL * zoe1) >> 30) + ((0x053d9944LL * zoe2) >> 30) + ((0x0018b23fLL * zoe3) >> 30); zoc1 = ((0x14a104d1LL * zoo1) >> 30) + ((0x0d7d2504LL * zoo2) >> 30) + ((0x0094b599LL * zoo3) >> 30); @@ -969,7 +969,7 @@ z_coeff_interpolate(int32_t z, int32_t * zoo2 = z_coeff[2] - z_coeff[-1]; zoo3 = z_coeff[3] - z_coeff[-2]; - zoc0 = (((0x1a8eda43LL * zoe1)) >> 30) + + zoc0 = ((0x1a8eda43LL * zoe1) >> 30) + ((0x0556ee38LL * zoe2) >> 30) + ((0x001a3784LL * zoe3) >> 30); zoc1 = ((0x143d863eLL * zoo1) >> 30) + ((0x0d910e36LL * zoo2) >> 30) + ((0x009ca889LL * zoo3) >> 30); @@ -998,7 +998,7 @@ z_coeff_interpolate(int32_t z, int32_t * zoo2 = z_coeff[2] - z_coeff[-1]; zoo3 = z_coeff[3] - z_coeff[-2]; - zoc0 = (((0x19edb6fdLL * zoe1)) >> 30) + + zoc0 = ((0x19edb6fdLL * zoe1) >> 30) + ((0x05ebd062LL * zoe2) >> 30) + ((0x00267881LL * zoe3) >> 30); zoc1 = ((0x1223af76LL * zoo1) >> 30) + ((0x0de3dd6bLL * zoo2) >> 30) + ((0x00d683cdLL * zoo3) >> 30); Modified: head/sys/tools/sound/feeder_rate_mkfilter.awk ============================================================================== --- head/sys/tools/sound/feeder_rate_mkfilter.awk Sun Jul 5 17:59:19 2009 (r195377) +++ head/sys/tools/sound/feeder_rate_mkfilter.awk Sun Jul 5 18:15:06 2009 (r195378) @@ -386,6 +386,27 @@ function filter_parse(s, a, i, attn, ale return (-1); } + if (alen > 0 && a[1] == "COEFFICIENT_BIT") { + if (alen != 2) + return (-1); + init_coeff_bit(floor(a[2])); + return (-1); + } + + if (alen > 0 && a[1] == "ACCUMULATOR_BIT") { + if (alen != 2) + return (-1); + init_accum_bit(floor(a[2])); + return (-1); + } + + if (alen > 0 && a[1] == "INTERPOLATOR") { + if (alen != 2) + return (-1); + init_coeff_interpolator(toupper(a[2])); + return (-1); + } + if (alen == 1 || alen == 2) { if (a[1] == "NYQUIST_HOVER") { i = 1.0 * a[2]; @@ -448,7 +469,12 @@ function filter_parse(s, a, i, attn, ale function genscale(bit, s1, s2, scale) { - s1 = Z_COEFF_SHIFT - (32 - bit); + if ((bit + Z_COEFF_SHIFT) > Z_ACCUMULATOR_BIT) + s1 = Z_COEFF_SHIFT - \ + (32 - (Z_ACCUMULATOR_BIT - Z_COEFF_SHIFT)); + else + s1 = Z_COEFF_SHIFT - (32 - bit); + s2 = Z_SHIFT + (32 - bit); if (s1 == 0) @@ -527,6 +553,62 @@ function init_drift(drift, xdrift) Z_MASK = Z_ONE - 1; } +function init_coeff_bit(cbit, xcbit) +{ + xcbit = floor(cbit); + + if (Z_COEFF_SHIFT != 0) { + if (xcbit != Z_COEFF_SHIFT) + printf("#error Z_COEFF_SHIFT reinitialize!\n"); + return; + } + + # + # Initialize dynamic range of coefficients. + # + if (xcbit < 1) + xcbit = 1; + else if (xcbit > 30) + xcbit = 30; + + Z_COEFF_SHIFT = xcbit; + Z_COEFF_ONE = shl(1, Z_COEFF_SHIFT); +} + +function init_accum_bit(accbit, xaccbit) +{ + xaccbit = floor(accbit); + + if (Z_ACCUMULATOR_BIT != 0) { + if (xaccbit != Z_ACCUMULATOR_BIT) + printf("#error Z_ACCUMULATOR_BIT reinitialize!\n"); + return; + } + + # + # Initialize dynamic range of accumulator. + # + if (xaccbit > 64) + xaccbit = 64; + else if (xaccbit < 32) + xaccbit = 32; + + Z_ACCUMULATOR_BIT = xaccbit; +} + +function init_coeff_interpolator(interp) +{ + # + # Validate interpolator type. + # + if (interp == "ZOH" || interp == "LINEAR" || \ + interp == "QUADRATIC" || interp == "HERMITE" || \ + interp == "BSPLINE" || interp == "OPT32X" || \ + interp == "OPT16X" || interp == "OPT8X" || \ + interp == "OPT4X" || interp == "OPT2X") + Z_COEFF_INTERPOLATOR = interp; +} + BEGIN { I0_EPSILON = 1e-21; M_PI = atan2(0.0, -1.0); @@ -536,11 +618,17 @@ BEGIN { Z_COEFF_OFFSET = 5; + Z_ACCUMULATOR_BIT_DEFAULT = 58; + Z_ACCUMULATOR_BIT = 0; + Z_FULL_SHIFT = 30; Z_FULL_ONE = shl(1, Z_FULL_SHIFT); - Z_COEFF_SHIFT = 28; - Z_COEFF_ONE = shl(1, Z_COEFF_SHIFT); + Z_COEFF_SHIFT_DEFAULT = 30; + Z_COEFF_SHIFT = 0; + Z_COEFF_ONE = 0; + + Z_COEFF_INTERPOLATOR = 0; Z_INTERP_COEFF_SHIFT = 24; Z_INTERP_COEFF_ONE = shl(1, Z_INTERP_COEFF_SHIFT); @@ -620,6 +708,10 @@ BEGIN { rolloff = Popts["rolloff"]; if (Z_DRIFT_SHIFT == -1) init_drift(Z_DRIFT_SHIFT_DEFAULT); + if (Z_COEFF_SHIFT == 0) + init_coeff_bit(Z_COEFF_SHIFT_DEFAULT); + if (Z_ACCUMULATOR_BIT == 0) + init_accum_bit(Z_ACCUMULATOR_BIT_DEFAULT); ztab[imp["quality"] - 2] = \ mkfilter(imp, nmult, rolloff, beta, Z_DRIFT_ONE); imp["quality"]++; @@ -751,6 +843,18 @@ BEGIN { genscale(24); genscale(32); printf("\n"); + printf("#define Z_ACCUMULATOR_BIT\t%d\n\n", Z_ACCUMULATOR_BIT) + for (i = 8; i <= 32; i += 8) { + gbit = ((i + Z_COEFF_SHIFT) > Z_ACCUMULATOR_BIT) ? \ + (i - (Z_ACCUMULATOR_BIT - Z_COEFF_SHIFT)) : 0; + printf("#define Z_GUARD_BIT_%d\t\t%d\n", i, gbit); + if (gbit == 0) + printf("#define Z_NORM_%d(v)\t\t(v)\n\n", i); + else + printf("#define Z_NORM_%d(v)\t\t" \ + "((v) >> Z_GUARD_BIT_%d)\n\n", i, i); + } + printf("\n"); printf("#define Z_LINEAR_FULL_ONE\t0x%08xU\n", Z_LINEAR_FULL_ONE); printf("#define Z_LINEAR_SHIFT\t\t%d\n", Z_LINEAR_SHIFT); printf("#define Z_LINEAR_UNSHIFT\t%d\n", Z_LINEAR_UNSHIFT); @@ -775,6 +879,9 @@ BEGIN { printf("\n"); printf("#define Z_QUALITY_MIN\t\t0\n"); printf("#define Z_QUALITY_MAX\t\t%d\n", length(ztab) + 1); + if (Z_COEFF_INTERPOLATOR != 0) + printf("\n#define Z_COEFF_INTERP_%s\t1\n", \ + Z_COEFF_INTERPOLATOR); printf("\n/*\n * smallest: %.32f\n * largest: %.32f\n *\n", \ smallest, largest); printf(" * z_unshift=%d, z_interp_shift=%d\n *\n", \ From owner-svn-src-head@FreeBSD.ORG Sun Jul 5 18:17:37 2009 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 EF70F1065670; Sun, 5 Jul 2009 18:17:37 +0000 (UTC) (envelope-from sam@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id DCEC38FC15; Sun, 5 Jul 2009 18:17:37 +0000 (UTC) (envelope-from sam@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n65IHbrn056576; Sun, 5 Jul 2009 18:17:37 GMT (envelope-from sam@svn.freebsd.org) Received: (from sam@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n65IHbwq056567; Sun, 5 Jul 2009 18:17:37 GMT (envelope-from sam@svn.freebsd.org) Message-Id: <200907051817.n65IHbwq056567@svn.freebsd.org> From: Sam Leffler Date: Sun, 5 Jul 2009 18:17: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: r195379 - head/sys/net80211 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, 05 Jul 2009 18:17:38 -0000 Author: sam Date: Sun Jul 5 18:17:37 2009 New Revision: 195379 URL: http://svn.freebsd.org/changeset/base/195379 Log: Add ieee80211_ageq; a facility for staging packets that require long-term work before they can be serviced. Packets are tagged and assigned an age (in seconds) at the point they are added to the queue. If a packet is not retrieved before it's age expires it is reclaimed. Tagging can take two forms: a reference to an ieee80211_node (as happens in the tx path) or an opaque token in cases where there is no reference or the node structure is not stable (i.e. it's going to be destroyed). o add ic_stageq to replace the per-node wds staging queue used for dynamic wds o add ieee80211_mac_hash for building ageq tokens; this computes a 32-bit hash from an 802.11 mac address (copied from the bridge) o while here fix a stray ';' noticed in IEEE80211_PSQ_INIT Reviewed by: rpaulo Approved by: re (kensmith) Added: head/sys/net80211/ieee80211_ageq.c (contents, props changed) head/sys/net80211/ieee80211_ageq.h (contents, props changed) Modified: head/sys/net80211/ieee80211.c head/sys/net80211/ieee80211_freebsd.h head/sys/net80211/ieee80211_node.c head/sys/net80211/ieee80211_node.h head/sys/net80211/ieee80211_var.h head/sys/net80211/ieee80211_wds.c Modified: head/sys/net80211/ieee80211.c ============================================================================== --- head/sys/net80211/ieee80211.c Sun Jul 5 18:15:06 2009 (r195378) +++ head/sys/net80211/ieee80211.c Sun Jul 5 18:17:37 2009 (r195379) @@ -268,6 +268,7 @@ ieee80211_ifattach(struct ieee80211com * ic->ic_update_mcast = null_update_mcast; ic->ic_update_promisc = null_update_promisc; + ic->ic_hash_key = arc4random(); ic->ic_bintval = IEEE80211_BINTVAL_DEFAULT; ic->ic_lintval = ic->ic_bintval; ic->ic_txpowlimit = IEEE80211_TXPOWER_MAX; @@ -1568,3 +1569,39 @@ ieee80211_media2rate(int mword) ieeerates[IFM_SUBTYPE(mword)] : 0; #undef N } + +/* + * The following hash function is adapted from "Hash Functions" by Bob Jenkins + * ("Algorithm Alley", Dr. Dobbs Journal, September 1997). + */ +#define mix(a, b, c) \ +do { \ + a -= b; a -= c; a ^= (c >> 13); \ + b -= c; b -= a; b ^= (a << 8); \ + c -= a; c -= b; c ^= (b >> 13); \ + a -= b; a -= c; a ^= (c >> 12); \ + b -= c; b -= a; b ^= (a << 16); \ + c -= a; c -= b; c ^= (b >> 5); \ + a -= b; a -= c; a ^= (c >> 3); \ + b -= c; b -= a; b ^= (a << 10); \ + c -= a; c -= b; c ^= (b >> 15); \ +} while (/*CONSTCOND*/0) + +uint32_t +ieee80211_mac_hash(const struct ieee80211com *ic, + const uint8_t addr[IEEE80211_ADDR_LEN]) +{ + uint32_t a = 0x9e3779b9, b = 0x9e3779b9, c = ic->ic_hash_key; + + b += addr[5] << 8; + b += addr[4]; + a += addr[3] << 24; + a += addr[2] << 16; + a += addr[1] << 8; + a += addr[0]; + + mix(a, b, c); + + return c; +} +#undef mix Added: head/sys/net80211/ieee80211_ageq.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/net80211/ieee80211_ageq.c Sun Jul 5 18:17:37 2009 (r195379) @@ -0,0 +1,236 @@ +/*- + * Copyright (c) 2009 Sam Leffler, Errno Consulting + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include +__FBSDID("$FreeBSD$"); + +/* + * IEEE 802.11 age queue support. + */ +#include "opt_wlan.h" + +#include +#include +#include + +#include + +#include +#include +#include + +#include + +/* + * Initialize an ageq. + */ +void +ieee80211_ageq_init(struct ieee80211_ageq *aq, int maxlen, const char *name) +{ + memset(aq, 0, sizeof(aq)); + aq->aq_maxlen = maxlen; + IEEE80211_AGEQ_INIT(aq, name); /* OS-dependent setup */ +} + +/* + * Cleanup an ageq initialized with ieee80211_ageq_init. Note + * the queue is assumed empty; this can be done with ieee80211_ageq_drain. + */ +void +ieee80211_ageq_cleanup(struct ieee80211_ageq *aq) +{ + KASSERT(aq->aq_len == 0, ("%d frames on ageq", aq->aq_len)); + IEEE80211_AGEQ_DESTROY(aq); /* OS-dependent cleanup */ +} + +/* + * Free an mbuf according to ageq rules: if marked as holding + * and 802.11 frame then also reclaim a node reference from + * the packet header; this handles packets q'd in the tx path. + */ +static void +ageq_mfree(struct mbuf *m) +{ + if (m->m_flags & M_ENCAP) { + struct ieee80211_node *ni = (void *) m->m_pkthdr.rcvif; + ieee80211_free_node(ni); + } + m->m_nextpkt = NULL; + m_freem(m); +} + +/* + * Free a list of mbufs using ageq rules (see above). + */ +void +ieee80211_ageq_mfree(struct mbuf *m) +{ + struct mbuf *next; + + for (; m != NULL; m = next) { + next = m->m_nextpkt; + ageq_mfree(m); + } +} + +/* + * Append an mbuf to the ageq and mark it with the specified max age + * If the frame is not removed before the age (in seconds) expires + * then it is reclaimed (along with any node reference). + */ +int +ieee80211_ageq_append(struct ieee80211_ageq *aq, struct mbuf *m, int age) +{ + IEEE80211_AGEQ_LOCK(aq); + if (__predict_true(aq->aq_len < aq->aq_maxlen)) { + if (aq->aq_tail == NULL) { + aq->aq_head = m; + } else { + aq->aq_tail->m_nextpkt = m; + age -= M_AGE_GET(aq->aq_head); + } + KASSERT(age >= 0, ("age %d", age)); + M_AGE_SET(m, age); + m->m_nextpkt = NULL; + aq->aq_tail = m; + aq->aq_len++; + IEEE80211_AGEQ_UNLOCK(aq); + return 0; + } else { + /* + * No space, drop and cleanup references. + */ + aq->aq_drops++; + IEEE80211_AGEQ_UNLOCK(aq); + /* XXX tail drop? */ + ageq_mfree(m); + return ENOSPC; + } +} + +/* + * Drain/reclaim all frames from an ageq. + */ +void +ieee80211_ageq_drain(struct ieee80211_ageq *aq) +{ + ieee80211_ageq_mfree(ieee80211_ageq_remove(aq, NULL)); +} + +/* + * Drain/reclaim frames associated with a specific node from an ageq. + */ +void +ieee80211_ageq_drain_node(struct ieee80211_ageq *aq, + struct ieee80211_node *ni) +{ + ieee80211_ageq_mfree(ieee80211_ageq_remove(aq, ni)); +} + +/* + * Age frames on the age queue. Ages are stored as time + * deltas (in seconds) relative to the head so we can check + * and/or adjust only the head of the list. If a frame's age + * exceeds the time quanta then remove it. The list of removed + * frames is is returned to the caller joined by m_nextpkt. + */ +struct mbuf * +ieee80211_ageq_age(struct ieee80211_ageq *aq, int quanta) +{ + struct mbuf *head, **phead; + struct mbuf *m; + + phead = &head; + if (aq->aq_len != 0) { + IEEE80211_AGEQ_LOCK(aq); + while ((m = aq->aq_head) != NULL && M_AGE_GET(m) < quanta) { + if ((aq->aq_head = m->m_nextpkt) == NULL) + aq->aq_tail = NULL; + KASSERT(aq->aq_len > 0, ("aq len %d", aq->aq_len)); + aq->aq_len--; + /* add to private list for return */ + *phead = m; + phead = &m->m_nextpkt; + } + if (m != NULL) + M_AGE_SUB(m, quanta); + IEEE80211_AGEQ_UNLOCK(aq); + } + *phead = NULL; + return head; +} + +/* + * Remove all frames matching the specified node identifier + * (NULL matches all). Frames are returned as a list joined + * by m_nextpkt. + */ +struct mbuf * +ieee80211_ageq_remove(struct ieee80211_ageq *aq, + struct ieee80211_node *match) +{ + struct mbuf *m, **prev, *ohead; + struct mbuf *head, **phead; + + IEEE80211_AGEQ_LOCK(aq); + ohead = aq->aq_head; + prev = &aq->aq_head; + phead = &head; + while ((m = *prev) != NULL) { + if (match != NULL && m->m_pkthdr.rcvif != (void *) match) { + prev = &m->m_nextpkt; + continue; + } + /* + * Adjust q length. + */ + KASSERT(aq->aq_len > 0, ("aq len %d", aq->aq_len)); + aq->aq_len--; + /* + * Remove from forward list; tail pointer is harder. + */ + *prev = m->m_nextpkt; + if (aq->aq_tail == m) { + KASSERT(m->m_nextpkt == NULL, ("not last")); + if (aq->aq_head == m) { /* list empty */ + KASSERT(aq->aq_len == 0, + ("not empty, len %d", aq->aq_len)); + aq->aq_tail = NULL; + } else { /* must be one before */ + aq->aq_tail = (struct mbuf *)((uintptr_t)prev - + offsetof(struct mbuf, m_nextpkt)); + } + } + /* add to private list for return */ + *phead = m; + phead = &m->m_nextpkt; + } + if (head == ohead && aq->aq_head != NULL) /* correct age */ + M_AGE_SET(aq->aq_head, M_AGE_GET(head)); + IEEE80211_AGEQ_UNLOCK(aq); + + *phead = NULL; + return head; +} Added: head/sys/net80211/ieee80211_ageq.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/net80211/ieee80211_ageq.h Sun Jul 5 18:17:37 2009 (r195379) @@ -0,0 +1,54 @@ +/*- + * Copyright (c) 2009 Sam Leffler, Errno Consulting + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * $FreeBSD$ + */ +#ifndef _NET80211_IEEE80211_STAGEQ_H_ +#define _NET80211_IEEE80211_STAGEQ_H_ + +struct ieee80211_node; +struct mbuf; + +struct ieee80211_ageq { + ieee80211_ageq_lock_t aq_lock; + int aq_len; /* # items on queue */ + int aq_maxlen; /* max queue length */ + int aq_drops; /* frames dropped */ + struct mbuf *aq_head; /* frames linked w/ m_nextpkt */ + struct mbuf *aq_tail; /* last frame in queue */ +}; + +void ieee80211_ageq_init(struct ieee80211_ageq *, int maxlen, + const char *name); +void ieee80211_ageq_cleanup(struct ieee80211_ageq *); +void ieee80211_ageq_mfree(struct mbuf *); +int ieee80211_ageq_append(struct ieee80211_ageq *, struct mbuf *, + int age); +void ieee80211_ageq_drain(struct ieee80211_ageq *); +void ieee80211_ageq_drain_node(struct ieee80211_ageq *, + struct ieee80211_node *); +struct mbuf *ieee80211_ageq_age(struct ieee80211_ageq *, int quanta); +struct mbuf *ieee80211_ageq_remove(struct ieee80211_ageq *, + struct ieee80211_node *match); +#endif /* _NET80211_IEEE80211_STAGEQ_H_ */ Modified: head/sys/net80211/ieee80211_freebsd.h ============================================================================== --- head/sys/net80211/ieee80211_freebsd.h Sun Jul 5 18:15:06 2009 (r195378) +++ head/sys/net80211/ieee80211_freebsd.h Sun Jul 5 18:17:37 2009 (r195379) @@ -100,25 +100,12 @@ typedef struct { #define IEEE80211_NODE_ITERATE_UNLOCK(_nt) \ mtx_unlock(IEEE80211_NODE_ITERATE_LOCK_OBJ(_nt)) -#define _AGEQ_ENQUEUE(_ifq, _m, _qlen, _age) do { \ - (_m)->m_nextpkt = NULL; \ - if ((_ifq)->ifq_tail != NULL) { \ - _age -= M_AGE_GET((_ifq)->ifq_head); \ - (_ifq)->ifq_tail->m_nextpkt = (_m); \ - } else { \ - (_ifq)->ifq_head = (_m); \ - } \ - M_AGE_SET(_m, _age); \ - (_ifq)->ifq_tail = (_m); \ - (_qlen) = ++(_ifq)->ifq_len; \ -} while (0) - /* * Power-save queue definitions. */ typedef struct mtx ieee80211_psq_lock_t; #define IEEE80211_PSQ_INIT(_psq, _name) \ - mtx_init(&(_psq)->psq_lock, _name, "802.11 ps q", MTX_DEF); + mtx_init(&(_psq)->psq_lock, _name, "802.11 ps q", MTX_DEF) #define IEEE80211_PSQ_DESTROY(_psq) mtx_destroy(&(_psq)->psq_lock) #define IEEE80211_PSQ_LOCK(_psq) mtx_lock(&(_psq)->psq_lock) #define IEEE80211_PSQ_UNLOCK(_psq) mtx_unlock(&(_psq)->psq_lock) @@ -137,24 +124,16 @@ typedef struct mtx ieee80211_psq_lock_t; IF_UNLOCK(ifq); \ } while (0) #endif /* IF_PREPEND_LIST */ - -/* XXX temporary */ -#define IEEE80211_NODE_WDSQ_INIT(_ni, _name) do { \ - mtx_init(&(_ni)->ni_wdsq.ifq_mtx, _name, "802.11 wds queue", MTX_DEF);\ - (_ni)->ni_wdsq.ifq_maxlen = IEEE80211_PS_MAX_QUEUE; \ -} while (0) -#define IEEE80211_NODE_WDSQ_DESTROY(_ni) do { \ - mtx_destroy(&(_ni)->ni_wdsq.ifq_mtx); \ -} while (0) -#define IEEE80211_NODE_WDSQ_QLEN(_ni) _IF_QLEN(&(_ni)->ni_wdsq) -#define IEEE80211_NODE_WDSQ_LOCK(_ni) IF_LOCK(&(_ni)->ni_wdsq) -#define IEEE80211_NODE_WDSQ_UNLOCK(_ni) IF_UNLOCK(&(_ni)->ni_wdsq) -#define _IEEE80211_NODE_WDSQ_DEQUEUE_HEAD(_ni, _m) do { \ - _IF_DEQUEUE(&(_ni)->ni_wdsq, m); \ -} while (0) -#define _IEEE80211_NODE_WDSQ_ENQUEUE(_ni, _m, _qlen, _age) do { \ - _AGEQ_ENQUEUE(&ni->ni_wdsq, _m, _qlen, _age); \ -} while (0) + +/* + * Age queue definitions. + */ +typedef struct mtx ieee80211_ageq_lock_t; +#define IEEE80211_AGEQ_INIT(_aq, _name) \ + mtx_init(&(_aq)->aq_lock, _name, "802.11 age q", MTX_DEF) +#define IEEE80211_AGEQ_DESTROY(_aq) mtx_destroy(&(_aq)->aq_lock) +#define IEEE80211_AGEQ_LOCK(_aq) mtx_lock(&(_aq)->aq_lock) +#define IEEE80211_AGEQ_UNLOCK(_aq) mtx_unlock(&(_aq)->aq_lock) /* * 802.1x MAC ACL database locking definitions. Modified: head/sys/net80211/ieee80211_node.c ============================================================================== --- head/sys/net80211/ieee80211_node.c Sun Jul 5 18:15:06 2009 (r195378) +++ head/sys/net80211/ieee80211_node.c Sun Jul 5 18:17:37 2009 (r195379) @@ -99,6 +99,9 @@ MALLOC_DEFINE(M_80211_NODE_IE, "80211nod void ieee80211_node_attach(struct ieee80211com *ic) { + /* XXX really want maxlen enforced per-sta */ + ieee80211_ageq_init(&ic->ic_stageq, ic->ic_max_keyix * 8, + "802.11 staging q"); ieee80211_node_table_init(ic, &ic->ic_sta, "station", IEEE80211_INACT_INIT, ic->ic_max_keyix); callout_init(&ic->ic_inact, CALLOUT_MPSAFE); @@ -127,6 +130,7 @@ ieee80211_node_detach(struct ieee80211co callout_drain(&ic->ic_inact); ieee80211_node_table_cleanup(&ic->ic_sta); + ieee80211_ageq_cleanup(&ic->ic_stageq); } void @@ -927,6 +931,7 @@ node_cleanup(struct ieee80211_node *ni) { #define N(a) (sizeof(a)/sizeof(a[0])) struct ieee80211vap *vap = ni->ni_vap; + struct ieee80211com *ic = ni->ni_ic; int i; /* NB: preserve ni_table */ @@ -947,6 +952,11 @@ node_cleanup(struct ieee80211_node *ni) ieee80211_ff_node_cleanup(ni); #endif /* + * Clear any staging queue entries. + */ + ieee80211_ageq_drain_node(&ic->ic_stageq, ni); + + /* * Clear AREF flag that marks the authorization refcnt bump * has happened. This is probably not needed as the node * should always be removed from the table so not found but @@ -999,7 +1009,6 @@ node_free(struct ieee80211_node *ni) ic->ic_node_cleanup(ni); ieee80211_ies_cleanup(&ni->ni_ies); ieee80211_psq_cleanup(&ni->ni_psq); - IEEE80211_NODE_WDSQ_DESTROY(ni); free(ni, M_80211_NODE); } @@ -1017,11 +1026,6 @@ node_age(struct ieee80211_node *ni) ni->ni_psq.psq_len == 0 && vap->iv_set_tim != NULL) vap->iv_set_tim(ni, 0); /* - * Age frames on the wds pending queue. - */ - if (IEEE80211_NODE_WDSQ_QLEN(ni) != 0) - ieee80211_node_wdsq_age(ni); - /* * Age out HT resources (e.g. frames on the * A-MPDU reorder queues). */ @@ -1086,7 +1090,6 @@ ieee80211_alloc_node(struct ieee80211_no ni->ni_inact = ni->ni_inact_reload; ni->ni_ath_defkeyix = 0x7fff; ieee80211_psq_init(&ni->ni_psq, "unknown"); - IEEE80211_NODE_WDSQ_INIT(ni, "unknown"); IEEE80211_NODE_LOCK(nt); TAILQ_INSERT_TAIL(&nt->nt_node, ni, ni_list); @@ -1136,7 +1139,6 @@ ieee80211_tmp_node(struct ieee80211vap * ni->ni_txpower = bss->ni_txpower; /* XXX optimize away */ ieee80211_psq_init(&ni->ni_psq, "unknown"); - IEEE80211_NODE_WDSQ_INIT(ni, "unknown"); } else { /* XXX msg */ vap->iv_stats.is_rx_nodealloc++; @@ -2075,6 +2077,7 @@ ieee80211_node_timeout(void *arg) if ((ic->ic_flags & IEEE80211_F_CSAPENDING) == 0) { ieee80211_scan_timeout(ic); ieee80211_timeout_stations(ic); + ieee80211_ageq_age(&ic->ic_stageq, IEEE80211_INACT_WAIT); IEEE80211_LOCK(ic); ieee80211_erp_timeout(ic); Modified: head/sys/net80211/ieee80211_node.h ============================================================================== --- head/sys/net80211/ieee80211_node.h Sun Jul 5 18:15:06 2009 (r195378) +++ head/sys/net80211/ieee80211_node.h Sun Jul 5 18:17:37 2009 (r195379) @@ -193,8 +193,6 @@ struct ieee80211_node { struct ieee80211_nodestats ni_stats; /* per-node statistics */ struct ieee80211vap *ni_wdsvap; /* associated WDS vap */ - /* XXX move to vap? */ - struct ifqueue ni_wdsq; /* wds pending queue */ uint64_t ni_spare[4]; }; MALLOC_DECLARE(M_80211_NODE); Modified: head/sys/net80211/ieee80211_var.h ============================================================================== --- head/sys/net80211/ieee80211_var.h Sun Jul 5 18:15:06 2009 (r195378) +++ head/sys/net80211/ieee80211_var.h Sun Jul 5 18:17:37 2009 (r195379) @@ -44,6 +44,7 @@ #include #include +#include #include #include #include /* for ieee80211_stats */ @@ -194,6 +195,8 @@ struct ieee80211com { /* NB: this is the union of all vap stations/neighbors */ int ic_max_keyix; /* max h/w key index */ struct ieee80211_node_table ic_sta; /* stations/neighbors */ + struct ieee80211_ageq ic_stageq; /* frame staging queue */ + uint32_t ic_hash_key; /* random key for mac hash */ /* XXX multi-bss: split out common/vap parts */ struct ieee80211_wme_state ic_wme; /* WME/WMM state */ @@ -659,6 +662,8 @@ struct ieee80211_channel *ieee80211_find int ieee, int flags); int ieee80211_setmode(struct ieee80211com *, enum ieee80211_phymode); enum ieee80211_phymode ieee80211_chan2mode(const struct ieee80211_channel *); +uint32_t ieee80211_mac_hash(const struct ieee80211com *, + const uint8_t addr[IEEE80211_ADDR_LEN]); void ieee80211_radiotap_attach(struct ieee80211com *, struct ieee80211_radiotap_header *th, int tlen, Modified: head/sys/net80211/ieee80211_wds.c ============================================================================== --- head/sys/net80211/ieee80211_wds.c Sun Jul 5 18:15:06 2009 (r195378) +++ head/sys/net80211/ieee80211_wds.c Sun Jul 5 18:17:37 2009 (r195379) @@ -97,6 +97,28 @@ wds_vattach(struct ieee80211vap *vap) vap->iv_opdetach = wds_vdetach; } +static void +wds_flush(struct ieee80211_node *ni) +{ + struct ieee80211com *ic = ni->ni_ic; + struct mbuf *m, *next; + int8_t rssi, nf; + + m = ieee80211_ageq_remove(&ic->ic_stageq, + (void *)(uintptr_t) ieee80211_mac_hash(ic, ni->ni_macaddr)); + if (m == NULL) + return; + + IEEE80211_NOTE(ni->ni_vap, IEEE80211_MSG_WDS, ni, + "%s", "flush wds queue"); + ic->ic_node_getsignal(ni, &rssi, &nf); + for (; m != NULL; m = next) { + next = m->m_nextpkt; + m->m_nextpkt = NULL; + ieee80211_input(ni, m, rssi, nf); + } +} + static int ieee80211_create_wds(struct ieee80211vap *vap, struct ieee80211_channel *chan) { @@ -195,26 +217,10 @@ ieee80211_create_wds(struct ieee80211vap } /* - * Flush pending frames now that were setup. + * Flush any pending frames now that were setup. */ - if (ni != NULL && IEEE80211_NODE_WDSQ_QLEN(ni) != 0) { - int8_t rssi, nf; - - IEEE80211_NOTE(vap, IEEE80211_MSG_WDS, ni, - "flush wds queue, %u packets queued", - IEEE80211_NODE_WDSQ_QLEN(ni)); - ic->ic_node_getsignal(ni, &rssi, &nf); - for (;;) { - struct mbuf *m; - - IEEE80211_NODE_WDSQ_LOCK(ni); - _IEEE80211_NODE_WDSQ_DEQUEUE_HEAD(ni, m); - IEEE80211_NODE_WDSQ_UNLOCK(ni); - if (m == NULL) - break; - ieee80211_input(ni, m, rssi, nf); - } - } + if (ni != NULL) + wds_flush(ni); return (ni == NULL ? ENOENT : 0); } @@ -310,91 +316,24 @@ ieee80211_dwds_mcast(struct ieee80211vap void ieee80211_dwds_discover(struct ieee80211_node *ni, struct mbuf *m) { - struct ieee80211vap *vap = ni->ni_vap; struct ieee80211com *ic = ni->ni_ic; - int qlen, age; - - IEEE80211_NODE_WDSQ_LOCK(ni); - if (!_IF_QFULL(&ni->ni_wdsq)) { - /* - * Tag the frame with it's expiry time and insert - * it in the queue. The aging interval is 4 times - * the listen interval specified by the station. - * Frames that sit around too long are reclaimed - * using this information. - */ - /* XXX handle overflow? */ - /* XXX per/vap beacon interval? */ - /* NB: TU -> secs */ - age = ((ni->ni_intval * ic->ic_lintval) << 2) / 1024; - _IEEE80211_NODE_WDSQ_ENQUEUE(ni, m, qlen, age); - IEEE80211_NODE_WDSQ_UNLOCK(ni); - IEEE80211_NOTE(vap, IEEE80211_MSG_WDS, ni, - "save frame, %u now queued", qlen); - } else { - vap->iv_stats.is_dwds_qdrop++; - _IF_DROP(&ni->ni_wdsq); - IEEE80211_NODE_WDSQ_UNLOCK(ni); - - IEEE80211_DISCARD(vap, IEEE80211_MSG_INPUT | IEEE80211_MSG_WDS, - mtod(m, struct ieee80211_frame *), "wds data", - "pending q overflow, drops %d (len %d)", - ni->ni_wdsq.ifq_drops, ni->ni_wdsq.ifq_len); - -#ifdef IEEE80211_DEBUG - if (ieee80211_msg_dumppkts(vap)) - ieee80211_dump_pkt(ic, mtod(m, caddr_t), - m->m_len, -1, -1); -#endif - /* XXX tail drop? */ - m_freem(m); - } + /* + * Save the frame with an aging interval 4 times + * the listen interval specified by the station. + * Frames that sit around too long are reclaimed + * using this information. + * XXX handle overflow? + * XXX per/vap beacon interval? + */ + m->m_pkthdr.rcvif = (void *)(uintptr_t) + ieee80211_mac_hash(ic, ni->ni_macaddr); + (void) ieee80211_ageq_append(&ic->ic_stageq, m, + ((ni->ni_intval * ic->ic_lintval) << 2) / 1024); ieee80211_notify_wds_discover(ni); } /* - * Age frames on the WDS pending queue. The aging interval is - * 4 times the listen interval specified by the station. This - * number is factored into the age calculations when the frame - * is placed on the queue. We store ages as time differences - * so we can check and/or adjust only the head of the list. - * If a frame's age exceeds the threshold then discard it. - * The number of frames discarded is returned to the caller. - */ -int -ieee80211_node_wdsq_age(struct ieee80211_node *ni) -{ -#ifdef IEEE80211_DEBUG - struct ieee80211vap *vap = ni->ni_vap; -#endif - struct mbuf *m; - int discard = 0; - - IEEE80211_NODE_WDSQ_LOCK(ni); - while (_IF_POLL(&ni->ni_wdsq, m) != NULL && - M_AGE_GET(m) < IEEE80211_INACT_WAIT) { - IEEE80211_NOTE(vap, IEEE80211_MSG_WDS, ni, - "discard frame, age %u", M_AGE_GET(m)); - - /* XXX could be optimized */ - _IEEE80211_NODE_WDSQ_DEQUEUE_HEAD(ni, m); - m_freem(m); - discard++; - } - if (m != NULL) - M_AGE_SUB(m, IEEE80211_INACT_WAIT); - IEEE80211_NODE_WDSQ_UNLOCK(ni); - - IEEE80211_NOTE(vap, IEEE80211_MSG_WDS, ni, - "discard %u frames for age", discard); -#if 0 - IEEE80211_NODE_STAT_ADD(ni, wds_discard, discard); -#endif - return discard; -} - -/* * IEEE80211_M_WDS vap state machine handler. */ static int From owner-svn-src-head@FreeBSD.ORG Sun Jul 5 20:20:09 2009 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 C10A0106566C; Sun, 5 Jul 2009 20:20:09 +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 AF0888FC16; Sun, 5 Jul 2009 20:20:09 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n65KK9HV058767; Sun, 5 Jul 2009 20:20:09 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n65KK9Cs058765; Sun, 5 Jul 2009 20:20:09 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <200907052020.n65KK9Cs058765@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Sun, 5 Jul 2009 20:20: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: r195380 - 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, 05 Jul 2009 20:20:10 -0000 Author: pjd Date: Sun Jul 5 20:20:09 2009 New Revision: 195380 URL: http://svn.freebsd.org/changeset/base/195380 Log: - Don't suggest opening file for writing in preparation for fexecve(2). - execve(2)/fexecve(2) won't return ETXTBSY if file is open for reading. Approved by: re (kib) Modified: head/lib/libc/sys/execve.2 Modified: head/lib/libc/sys/execve.2 ============================================================================== --- head/lib/libc/sys/execve.2 Sun Jul 5 18:17:37 2009 (r195379) +++ head/lib/libc/sys/execve.2 Sun Jul 5 20:20:09 2009 (r195380) @@ -220,13 +220,11 @@ Since execute permission is checked by .Fn fexecve , the file descriptor .Fa fd -need not have been -opened with the +need not have been opened with the .Dv O_EXEC flag. -However, if the file to be executed denies read and write -permission for the process preparing to do the exec, the only way to -provide the +However, if the file to be executed denies read permission for the process +preparing to do the exec, the only way to provide the .Fa fd to .Fn fexecve @@ -234,6 +232,7 @@ is to use the .Dv O_EXEC flag when opening .Fa fd . +Note that the file to be executed can not be open for writing. .Sh RETURN VALUES As the .Fn execve @@ -277,7 +276,7 @@ The new process file has the appropriate permission, but has an invalid magic number in its header. .It Bq Er ETXTBSY The new process file is a pure procedure (shared text) -file that is currently open for writing or reading by some process. +file that is currently open for writing by some process. .It Bq Er ENOMEM The new process requires more virtual memory than is allowed by the imposed maximum From owner-svn-src-head@FreeBSD.ORG Sun Jul 5 20:44:50 2009 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 8A43C1065670; Sun, 5 Jul 2009 20:44:50 +0000 (UTC) (envelope-from sam@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 785F68FC0A; Sun, 5 Jul 2009 20:44:50 +0000 (UTC) (envelope-from sam@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n65KioKv059290; Sun, 5 Jul 2009 20:44:50 GMT (envelope-from sam@svn.freebsd.org) Received: (from sam@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n65KioCU059288; Sun, 5 Jul 2009 20:44:50 GMT (envelope-from sam@svn.freebsd.org) Message-Id: <200907052044.n65KioCU059288@svn.freebsd.org> From: Sam Leffler Date: Sun, 5 Jul 2009 20:44: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: r195381 - 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: Sun, 05 Jul 2009 20:44:51 -0000 Author: sam Date: Sun Jul 5 20:44:50 2009 New Revision: 195381 URL: http://svn.freebsd.org/changeset/base/195381 Log: add missing bit of r195379 Approved by: re (kensmith) Modified: head/sys/conf/files Modified: head/sys/conf/files ============================================================================== --- head/sys/conf/files Sun Jul 5 20:20:09 2009 (r195380) +++ head/sys/conf/files Sun Jul 5 20:44:50 2009 (r195381) @@ -2232,6 +2232,7 @@ net/zlib.c optional crypto | geom_uzip net80211/ieee80211.c optional wlan net80211/ieee80211_acl.c optional wlan wlan_acl net80211/ieee80211_action.c optional wlan +net80211/ieee80211_ageq.c optional wlan net80211/ieee80211_adhoc.c optional wlan net80211/ieee80211_amrr.c optional wlan wlan_amrr net80211/ieee80211_crypto.c optional wlan From owner-svn-src-head@FreeBSD.ORG Sun Jul 5 21:19:12 2009 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 799381065686; Sun, 5 Jul 2009 21:19:12 +0000 (UTC) (envelope-from sam@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 675F88FC16; Sun, 5 Jul 2009 21:19:12 +0000 (UTC) (envelope-from sam@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n65LJBnU059976; Sun, 5 Jul 2009 21:19:11 GMT (envelope-from sam@svn.freebsd.org) Received: (from sam@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n65LJB9A059974; Sun, 5 Jul 2009 21:19:11 GMT (envelope-from sam@svn.freebsd.org) Message-Id: <200907052119.n65LJB9A059974@svn.freebsd.org> From: Sam Leffler Date: Sun, 5 Jul 2009 21:19: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: r195383 - head/sys/modules/wlan 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, 05 Jul 2009 21:19:13 -0000 Author: sam Date: Sun Jul 5 21:19:10 2009 New Revision: 195383 URL: http://svn.freebsd.org/changeset/base/195383 Log: catchup with action+ageq additions Submitted by: "Paul B. Mahol" Approved by: re (implicit) Modified: head/sys/modules/wlan/Makefile Modified: head/sys/modules/wlan/Makefile ============================================================================== --- head/sys/modules/wlan/Makefile Sun Jul 5 21:16:26 2009 (r195382) +++ head/sys/modules/wlan/Makefile Sun Jul 5 21:19:10 2009 (r195383) @@ -3,7 +3,8 @@ .PATH: ${.CURDIR}/../../net80211 KMOD= wlan -SRCS= ieee80211.c ieee80211_crypto.c ieee80211_crypto_none.c ieee80211_dfs.c \ +SRCS= ieee80211.c ieee80211_action.c ieee80211_ageq.c \ + ieee80211_crypto.c ieee80211_crypto_none.c ieee80211_dfs.c \ ieee80211_freebsd.c ieee80211_input.c ieee80211_ioctl.c \ ieee80211_node.c ieee80211_output.c ieee80211_phy.c ieee80211_power.c \ ieee80211_proto.c ieee80211_scan.c ieee80211_scan_sta.c \ From owner-svn-src-head@FreeBSD.ORG Sun Jul 5 21:40:22 2009 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 321761065670; Sun, 5 Jul 2009 21:40:22 +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 1F72C8FC15; Sun, 5 Jul 2009 21:40:22 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n65LeMbP060447; Sun, 5 Jul 2009 21:40:22 GMT (envelope-from alc@svn.freebsd.org) Received: (from alc@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n65LeLoW060444; Sun, 5 Jul 2009 21:40:21 GMT (envelope-from alc@svn.freebsd.org) Message-Id: <200907052140.n65LeLoW060444@svn.freebsd.org> From: Alan Cox Date: Sun, 5 Jul 2009 21:40:21 +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: r195385 - in head/sys/i386: i386 xen 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, 05 Jul 2009 21:40:22 -0000 Author: alc Date: Sun Jul 5 21:40:21 2009 New Revision: 195385 URL: http://svn.freebsd.org/changeset/base/195385 Log: PAE adds another level to the i386 page table. This level is a small 4-entry table that must be located within the first 4GB of RAM. This requirement is met by defining an UMA zone with a custom back-end allocator function. This revision makes two changes to this back-end allocator function: (1) It replaces the use of contigmalloc() with the use of kmem_alloc_contig(). This eliminates "double accounting", i.e., accounting by both the UMA zone and malloc tags. (I made the same change for the same reason to the zones supporting jumbo frames a week ago.) (2) It passes through the "wait" parameter, i.e., M_WAITOK, M_ZERO, etc. to kmem_alloc_contig() rather than ignoring it. pmap_init() calls uma_zalloc() with both M_WAITOK and M_ZERO. At the moment, this is harmless only because the default behavior of contigmalloc()/kmem_alloc_contig() is to wait and because pmap_init() doesn't really depend on the memory being zeroed. The back-end allocator function in the Xen pmap is dead code. I am changing it nonetheless because I don't want to leave any "bad examples" in the source tree for someone to copy at a later date. Approved by: re (kib) Modified: head/sys/i386/i386/pmap.c head/sys/i386/xen/pmap.c Modified: head/sys/i386/i386/pmap.c ============================================================================== --- head/sys/i386/i386/pmap.c Sun Jul 5 21:35:05 2009 (r195384) +++ head/sys/i386/i386/pmap.c Sun Jul 5 21:40:21 2009 (r195385) @@ -562,17 +562,14 @@ pmap_page_init(vm_page_t m) } #ifdef PAE - -static MALLOC_DEFINE(M_PMAPPDPT, "pmap", "pmap pdpt"); - static void * pmap_pdpt_allocf(uma_zone_t zone, int bytes, u_int8_t *flags, int wait) { /* Inform UMA that this allocator uses kernel_map/object. */ *flags = UMA_SLAB_KERNEL; - return (contigmalloc(PAGE_SIZE, M_PMAPPDPT, 0, 0x0ULL, 0xffffffffULL, - 1, 0)); + return ((void *)kmem_alloc_contig(kernel_map, bytes, wait, 0x0ULL, + 0xffffffffULL, 1, 0, VM_CACHE_DEFAULT)); } #endif Modified: head/sys/i386/xen/pmap.c ============================================================================== --- head/sys/i386/xen/pmap.c Sun Jul 5 21:35:05 2009 (r195384) +++ head/sys/i386/xen/pmap.c Sun Jul 5 21:40:21 2009 (r195385) @@ -608,15 +608,14 @@ pmap_page_init(vm_page_t m) } #if defined(PAE) && !defined(XEN) - -static MALLOC_DEFINE(M_PMAPPDPT, "pmap", "pmap pdpt"); - static void * pmap_pdpt_allocf(uma_zone_t zone, int bytes, u_int8_t *flags, int wait) { - *flags = UMA_SLAB_PRIV; - return (contigmalloc(PAGE_SIZE, M_PMAPPDPT, 0, 0x0ULL, 0xffffffffULL, - 1, 0)); + + /* Inform UMA that this allocator uses kernel_map/object. */ + *flags = UMA_SLAB_KERNEL; + return ((void *)kmem_alloc_contig(kernel_map, bytes, wait, 0x0ULL, + 0xffffffffULL, 1, 0, VM_CACHE_DEFAULT)); } #endif From owner-svn-src-head@FreeBSD.ORG Mon Jul 6 02:02:46 2009 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 E9159106564A; Mon, 6 Jul 2009 02:02:46 +0000 (UTC) (envelope-from kientzle@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D560C8FC1C; Mon, 6 Jul 2009 02:02:46 +0000 (UTC) (envelope-from kientzle@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n6622jUq065557; Mon, 6 Jul 2009 02:02:45 GMT (envelope-from kientzle@svn.freebsd.org) Received: (from kientzle@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n6622jw9065554; Mon, 6 Jul 2009 02:02:45 GMT (envelope-from kientzle@svn.freebsd.org) Message-Id: <200907060202.n6622jw9065554@svn.freebsd.org> From: Tim Kientzle Date: Mon, 6 Jul 2009 02:02: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: r195389 - in head/usr.bin/cpio: . test 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, 06 Jul 2009 02:02:47 -0000 Author: kientzle Date: Mon Jul 6 02:02:45 2009 New Revision: 195389 URL: http://svn.freebsd.org/changeset/base/195389 Log: This addresses some issues with my earlier -R fix that were pointed out by Brooks Davis and Alexey Dokuchaev: * It now tries to lookup arguments as names first, then tries to parse them as numbers. In particular, this makes the behavior consistent with POSIX conventions when usernames consist entirely of digits. * It now uses strtoul() for the numeric parsing. Finally, I've included an update to the test harness to exercise the new numeric cases for -R. Approved by: re (kib) Modified: head/usr.bin/cpio/cmdline.c head/usr.bin/cpio/test/test_owner_parse.c Modified: head/usr.bin/cpio/cmdline.c ============================================================================== --- head/usr.bin/cpio/cmdline.c Mon Jul 6 01:32:29 2009 (r195388) +++ head/usr.bin/cpio/cmdline.c Mon Jul 6 02:02:45 2009 (r195389) @@ -275,29 +275,14 @@ cpio_getopt(struct cpio *cpio) * : - Override group but not user * * Where uid/gid are decimal representations and groupname/username - * are names to be looked up in system database. Note that - * uid/gid parsing takes priority over username/groupname lookup, - * so this won't do a lookup for usernames or group names that - * consist entirely of digits. + * are names to be looked up in system database. Note that we try + * to look up an argument as a name first, then try numeric parsing. * * A period can be used instead of the colon. * * Sets uid/gid return as appropriate, -1 indicates uid/gid not specified. * */ -static int -decimal_parse(const char *p) -{ - /* TODO: guard against overflow. */ - int n = 0; - for (; *p != '\0'; ++p) { - if (*p < '0' || *p > '9') - return (-1); - n = n * 10 + *p - '0'; - } - return (n); -} - int owner_parse(const char *spec, int *uid, int *gid) { @@ -306,6 +291,9 @@ owner_parse(const char *spec, int *uid, *uid = -1; *gid = -1; + if (spec[0] == '\0') + return (1); + /* * Split spec into [user][:.][group] * u -> first char of username, NULL if no username @@ -338,32 +326,34 @@ owner_parse(const char *spec, int *uid, } memcpy(user, u, ue - u); user[ue - u] = '\0'; - *uid = decimal_parse(user); - if (*uid < 0) { - /* Couldn't parse as integer, try username lookup. */ - pwent = getpwnam(user); - if (pwent == NULL) { + if ((pwent = getpwnam(user)) != NULL) { + *uid = pwent->pw_uid; + if (*ue != '\0') + *gid = pwent->pw_gid; + } else { + char *end; + errno = 0; + *uid = strtoul(user, &end, 10); + if (errno || *end != '\0') { cpio_warnc(errno, "Couldn't lookup user ``%s''", user); return (1); } - *uid = pwent->pw_uid; - if (*ue != '\0' && *g == '\0') - *gid = pwent->pw_gid; } free(user); } + if (*g != '\0') { - *gid = decimal_parse(g); - if (*gid < 0) { - /* Couldn't parse int, try group name lookup. */ - struct group *grp; - grp = getgrnam(g); - if (grp != NULL) - *gid = grp->gr_gid; - else { + struct group *grp; + if ((grp = getgrnam(g)) != NULL) { + *gid = grp->gr_gid; + } else { + char *end; + errno = 0; + *gid = strtoul(g, &end, 10); + if (errno || *end != '\0') { cpio_warnc(errno, - "Couldn't look up group ``%s''", g); + "Couldn't lookup group ``%s''", g); return (1); } } Modified: head/usr.bin/cpio/test/test_owner_parse.c ============================================================================== --- head/usr.bin/cpio/test/test_owner_parse.c Mon Jul 6 01:32:29 2009 (r195388) +++ head/usr.bin/cpio/test/test_owner_parse.c Mon Jul 6 02:02:45 2009 (r195389) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2003-2007 Tim Kientzle + * Copyright (c) 2003-2009 Tim Kientzle * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -26,6 +26,7 @@ __FBSDID("$FreeBSD$"); #include "../cpio.h" +#include "err.h" #if defined(__CYGWIN__) /* On cygwin, the Administrator user most likely exists (unless @@ -37,16 +38,23 @@ __FBSDID("$FreeBSD$"); * Use CreateWellKnownSID() and LookupAccountName()? */ #define ROOT "Administrator" -#define ROOT_UID 500 -#define ROOT_GID1 513 -#define ROOT_GID2 545 -#define ROOT_GID3 544 +static int root_uids[] = { 500 }; +static int root_gids[] = { 513, 545, 544 }; #else #define ROOT "root" -#define ROOT_UID 0 -#define ROOT_GID 0 +static int root_uids[] = { 0 }; +static int root_gids[] = { 0 }; #endif +static int +int_in_list(int i, int *l, size_t n) +{ + while (n-- > 0) + if (*l++ == i) + return (1); + failure("%d", i); + return (0); +} DEFINE_TEST(test_owner_parse) { @@ -56,38 +64,47 @@ DEFINE_TEST(test_owner_parse) #else int uid, gid; - cpio_progname = "Ignore this message"; - assertEqualInt(0, owner_parse(ROOT, &uid, &gid)); - assertEqualInt(ROOT_UID, uid); + assert(int_in_list(uid, root_uids, + sizeof(root_uids)/sizeof(root_uids[0]))); assertEqualInt(-1, gid); assertEqualInt(0, owner_parse(ROOT ":", &uid, &gid)); - assertEqualInt(ROOT_UID, uid); -#if defined(__CYGWIN__) - { - int gidIsOneOf = (ROOT_GID1 == gid) - || (ROOT_GID2 == gid) - || (ROOT_GID3 == gid); - assertEqualInt(1, gidIsOneOf); - } -#else - assertEqualInt(ROOT_GID, gid); -#endif + assert(int_in_list(uid, root_uids, + sizeof(root_uids)/sizeof(root_uids[0]))); + assert(int_in_list(gid, root_gids, + sizeof(root_gids)/sizeof(root_gids[0]))); assertEqualInt(0, owner_parse(ROOT ".", &uid, &gid)); - assertEqualInt(ROOT_UID, uid); -#if defined(__CYGWIN__) - { - int gidIsOneOf = (ROOT_GID1 == gid) - || (ROOT_GID2 == gid) - || (ROOT_GID3 == gid); - assertEqualInt(1, gidIsOneOf); - } -#else - assertEqualInt(ROOT_GID, gid); -#endif + assert(int_in_list(uid, root_uids, + sizeof(root_uids)/sizeof(root_uids[0]))); + assert(int_in_list(gid, root_gids, + sizeof(root_gids)/sizeof(root_gids[0]))); + + assertEqualInt(0, owner_parse("111", &uid, &gid)); + assertEqualInt(111, uid); + assertEqualInt(-1, gid); + + assertEqualInt(0, owner_parse("112:", &uid, &gid)); + assertEqualInt(112, uid); + /* Can't assert gid, since we don't know gid for user #112. */ + + assertEqualInt(0, owner_parse("113.", &uid, &gid)); + assertEqualInt(113, uid); + /* Can't assert gid, since we don't know gid for user #113. */ + + assertEqualInt(0, owner_parse(":114", &uid, &gid)); + assertEqualInt(-1, uid); + assertEqualInt(114, gid); + + assertEqualInt(0, owner_parse(".115", &uid, &gid)); + assertEqualInt(-1, uid); + assertEqualInt(115, gid); + + assertEqualInt(0, owner_parse("116:117", &uid, &gid)); + assertEqualInt(116, uid); + assertEqualInt(117, gid); /* * TODO: Lookup current user/group name, build strings and @@ -104,6 +121,7 @@ DEFINE_TEST(test_owner_parse) * Alternatively, redirect stderr temporarily to suppress the output. */ + cpio_progname = "Ignore this message"; assertEqualInt(1, owner_parse(":nonexistentgroup", &uid, &gid)); assertEqualInt(1, owner_parse(ROOT ":nonexistentgroup", &uid, &gid)); assertEqualInt(1, From owner-svn-src-head@FreeBSD.ORG Mon Jul 6 09:31:04 2009 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 86A641065670; Mon, 6 Jul 2009 09:31:04 +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 748298FC15; Mon, 6 Jul 2009 09:31:04 +0000 (UTC) (envelope-from attilio@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n669V472074491; Mon, 6 Jul 2009 09:31:04 GMT (envelope-from attilio@svn.freebsd.org) Received: (from attilio@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n669V4Zc074488; Mon, 6 Jul 2009 09:31:04 GMT (envelope-from attilio@svn.freebsd.org) Message-Id: <200907060931.n669V4Zc074488@svn.freebsd.org> From: Attilio Rao Date: Mon, 6 Jul 2009 09:31: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: r195403 - head/lib/libthr/thread 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, 06 Jul 2009 09:31:05 -0000 Author: attilio Date: Mon Jul 6 09:31:04 2009 New Revision: 195403 URL: http://svn.freebsd.org/changeset/base/195403 Log: In the current code, rdlock_count is not correctly handled for some cases. The most notable is that it is not bumped in rwlock_rdlock_common() when the hard path (__thr_rwlock_rdlock()) returns successfully. This can lead to deadlocks in libthr when rwlocks recursion in read mode happens. Fix the interested parts by correctly handling rdlock_count. PR: threads/136345 Reported by: rink Tested by: rink Reviewed by: jeff Approved by: re (kib) MFC: 2 weeks Modified: head/lib/libthr/thread/thr_rtld.c head/lib/libthr/thread/thr_rwlock.c Modified: head/lib/libthr/thread/thr_rtld.c ============================================================================== --- head/lib/libthr/thread/thr_rtld.c Mon Jul 6 09:07:35 2009 (r195402) +++ head/lib/libthr/thread/thr_rtld.c Mon Jul 6 09:31:04 2009 (r195403) @@ -114,6 +114,7 @@ _thr_rtld_rlock_acquire(void *lock) THR_CRITICAL_ENTER(curthread); while (_thr_rwlock_rdlock(&l->lock, 0, NULL) != 0) ; + curthread->rdlock_count++; RESTORE_ERRNO(); } @@ -148,6 +149,7 @@ _thr_rtld_lock_release(void *lock) state = l->lock.rw_state; if (_thr_rwlock_unlock(&l->lock) == 0) { + curthread->rdlock_count--; if ((state & URWLOCK_WRITE_OWNER) == 0) { THR_CRITICAL_LEAVE(curthread); } else { Modified: head/lib/libthr/thread/thr_rwlock.c ============================================================================== --- head/lib/libthr/thread/thr_rwlock.c Mon Jul 6 09:07:35 2009 (r195402) +++ head/lib/libthr/thread/thr_rwlock.c Mon Jul 6 09:31:04 2009 (r195403) @@ -177,10 +177,11 @@ rwlock_rdlock_common(pthread_rwlock_t *r /* if interrupted, try to lock it in userland again. */ if (_thr_rwlock_tryrdlock(&prwlock->lock, flags) == 0) { ret = 0; - curthread->rdlock_count++; break; } } + if (ret == 0) + curthread->rdlock_count++; return (ret); } From owner-svn-src-head@FreeBSD.ORG Mon Jul 6 11:45:37 2009 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 033F81065674; Mon, 6 Jul 2009 11:45:37 +0000 (UTC) (envelope-from des@des.no) Received: from tim.des.no (tim.des.no [194.63.250.121]) by mx1.freebsd.org (Postfix) with ESMTP id B2D2F8FC20; Mon, 6 Jul 2009 11:45:35 +0000 (UTC) (envelope-from des@des.no) Received: from ds4.des.no (des.no [84.49.246.2]) by smtp.des.no (Postfix) with ESMTP id 8CEAC6D420; Mon, 6 Jul 2009 13:45:34 +0200 (CEST) Received: by ds4.des.no (Postfix, from userid 1001) id 685FB844B5; Mon, 6 Jul 2009 13:45:34 +0200 (CEST) From: =?utf-8?Q?Dag-Erling_Sm=C3=B8rgrav?= To: Bruce Simpson References: <200907021824.n62IObWJ051643@svn.freebsd.org> <4A4F24AF.3080900@incunabulum.net> Date: Mon, 06 Jul 2009 13:45:34 +0200 In-Reply-To: <4A4F24AF.3080900@incunabulum.net> (Bruce Simpson's message of "Sat, 04 Jul 2009 10:45:19 +0100") Message-ID: <86y6r2ghlt.fsf@ds4.des.no> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.92 (berkeley-unix) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Ed Schouten Subject: Re: svn commit: r195295 - in head/sys: amd64/conf i386/conf ia64/conf pc98/conf powerpc/conf sparc64/conf sun4v/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: Mon, 06 Jul 2009 11:45:37 -0000 Bruce Simpson writes: > Ed Schouten writes: > > Enable POSIX semaphores on all non-embedded architectures by default. > Thank you. I didn't do this as normally we're pretty conservative > about this sort of change, but now they are fixed, it just plain makes > sense. They aren't fixed, they're just broken in a different way. The previous implementation used the filesystem namespace, so you could (to a certain degree) apply filesystem access control semantics, including letting processes in separate jails use the same semaphore names without stepping on each others toes. The current implementation uses its own flat namespace with no access control whatsoever and is not jailable. At some point, somebody is going to have to fix it all over again. DES --=20 Dag-Erling Sm=C3=B8rgrav - des@des.no From owner-svn-src-head@FreeBSD.ORG Mon Jul 6 11:46:19 2009 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 49DBF106564A; Mon, 6 Jul 2009 11:46:19 +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 3663D8FC1A; Mon, 6 Jul 2009 11:46:19 +0000 (UTC) (envelope-from flz@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n66BkJxX081100; Mon, 6 Jul 2009 11:46:19 GMT (envelope-from flz@svn.freebsd.org) Received: (from flz@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n66BkJDt081098; Mon, 6 Jul 2009 11:46:19 GMT (envelope-from flz@svn.freebsd.org) Message-Id: <200907061146.n66BkJDt081098@svn.freebsd.org> From: Florent Thoumie Date: Mon, 6 Jul 2009 11:46: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: r195405 - 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: Mon, 06 Jul 2009 11:46:20 -0000 Author: flz Date: Mon Jul 6 11:46:18 2009 New Revision: 195405 URL: http://svn.freebsd.org/changeset/base/195405 Log: - pkg_install is maintained by portmgr. - BSD.x11{,-4}.dist aren't used anymore and BSD.local.dist now lives in ports/Templates/. Most people apparently missed that move and still commit to the src copy, so I'll have to remove it eventually but for now, the MAINTAINERS line can go. Approved by: re (kib) Modified: head/MAINTAINERS Modified: head/MAINTAINERS ============================================================================== --- head/MAINTAINERS Mon Jul 6 10:40:46 2009 (r195404) +++ head/MAINTAINERS Mon Jul 6 11:46:18 2009 (r195405) @@ -111,7 +111,7 @@ truss alfred Will be happy to review co rpc alfred Pre-commit review requested. xfs kan@FreeBSD.org,rodrigc@FreeBSD.org,cattelan@xfs.org Pre-commit review preferred. -pkg_install krion Pre-commit review or approval from portmgr@ requested. +pkg_install portmgr Pre-commit review or approval from portmgr@ requested. linux emul emulation Please discuss changes here. bs{diff,patch} cperciva Pre-commit review requested. portsnap cperciva Pre-commit review requested. @@ -123,7 +123,6 @@ lib/libsdp emax Pre-commit review prefe usr.bin/bluetooth emax Pre-commit review preferred. usr.sbin/bluetooth emax Pre-commit review preferred. gnu/usr.bin/send-pr bugmaster Pre-commit review requested. -BSD.{local,x11*}.dist portmgr Pre-commit review requested, since these files interface with ports. ncurses rafan Heads-up appreciated, try not to break it. Following are the entries from the Makefiles, and a few other sources. From owner-svn-src-head@FreeBSD.ORG Mon Jul 6 11:57:33 2009 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 B89231065670; Mon, 6 Jul 2009 11:57:33 +0000 (UTC) (envelope-from des@des.no) Received: from tim.des.no (tim.des.no [194.63.250.121]) by mx1.freebsd.org (Postfix) with ESMTP id 73C128FC1B; Mon, 6 Jul 2009 11:57:33 +0000 (UTC) (envelope-from des@des.no) Received: from ds4.des.no (des.no [84.49.246.2]) by smtp.des.no (Postfix) with ESMTP id 9A6C56D420; Mon, 6 Jul 2009 13:57:32 +0200 (CEST) Received: by ds4.des.no (Postfix, from userid 1001) id 7A30D844B5; Mon, 6 Jul 2009 13:57:32 +0200 (CEST) From: =?utf-8?Q?Dag-Erling_Sm=C3=B8rgrav?= To: Bruce Simpson References: <200907021824.n62IObWJ051643@svn.freebsd.org> <4A4F24AF.3080900@incunabulum.net> <86y6r2ghlt.fsf@ds4.des.no> Date: Mon, 06 Jul 2009 13:57:32 +0200 In-Reply-To: <86y6r2ghlt.fsf@ds4.des.no> ("Dag-Erling =?utf-8?Q?Sm=C3=B8rg?= =?utf-8?Q?rav=22's?= message of "Mon, 06 Jul 2009 13:45:34 +0200") Message-ID: <86prcegh1v.fsf@ds4.des.no> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.92 (berkeley-unix) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Ed Schouten Subject: Re: svn commit: r195295 - in head/sys: amd64/conf i386/conf ia64/conf pc98/conf powerpc/conf sparc64/conf sun4v/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: Mon, 06 Jul 2009 11:57:34 -0000 Dag-Erling Sm=C3=B8rgrav writes: > They aren't fixed, they're just broken in a different way. The previous > implementation used the filesystem namespace, Bah, it didn't. Please ignore me. DES --=20 Dag-Erling Sm=C3=B8rgrav - des@des.no From owner-svn-src-head@FreeBSD.ORG Mon Jul 6 12:58:32 2009 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 DF8EB1065670; Mon, 6 Jul 2009 12:58:32 +0000 (UTC) (envelope-from rink@rink.nu) Received: from mx1.rink.nu (gloom.rink.nu [213.34.49.2]) by mx1.freebsd.org (Postfix) with ESMTP id 9EB198FC12; Mon, 6 Jul 2009 12:58:32 +0000 (UTC) (envelope-from rink@rink.nu) Received: from localhost (localhost [127.0.0.1]) by mx1.rink.nu (Postfix) with ESMTP id 4D6B86D42B; Mon, 6 Jul 2009 14:39:59 +0200 (CEST) X-Virus-Scanned: amavisd-new at rink.nu Received: from mx1.rink.nu ([213.34.49.2]) by localhost (gloom.rink.nu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id v2cUY-rKB7Rk; Mon, 6 Jul 2009 14:39:57 +0200 (CEST) Received: by mx1.rink.nu (Postfix, from userid 1000) id B1F616D423; Mon, 6 Jul 2009 14:39:57 +0200 (CEST) Date: Mon, 6 Jul 2009 14:39:57 +0200 From: Rink Springer To: Attilio Rao Message-ID: <20090706123957.GA76863@rink.nu> References: <200907060931.n669V4Zc074488@svn.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <200907060931.n669V4Zc074488@svn.freebsd.org> User-Agent: Mutt/1.5.19 (2009-01-05) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r195403 - head/lib/libthr/thread 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, 06 Jul 2009 12:58:33 -0000 On Mon, Jul 06, 2009 at 09:31:04AM +0000, Attilio Rao wrote: > Log: > In the current code, rdlock_count is not correctly handled for some cases. > The most notable is that it is not bumped in rwlock_rdlock_common() when > the hard path (__thr_rwlock_rdlock()) returns successfully. > This can lead to deadlocks in libthr when rwlocks recursion in read mode > happens. > Fix the interested parts by correctly handling rdlock_count. > > PR: threads/136345 > Reported by: rink > Tested by: rink > Reviewed by: jeff > Approved by: re (kib) > MFC: 2 weeks Thanks! -- Rink P.W. Springer - http://rink.nu "Doom, gloom and despair. I like it!" - Tiresias From owner-svn-src-head@FreeBSD.ORG Mon Jul 6 17:23:49 2009 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 4A91B106564A; Mon, 6 Jul 2009 17:23:49 +0000 (UTC) (envelope-from jfv@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 1F2BB8FC15; Mon, 6 Jul 2009 17:23:49 +0000 (UTC) (envelope-from jfv@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n66HNnPs087654; Mon, 6 Jul 2009 17:23:49 GMT (envelope-from jfv@svn.freebsd.org) Received: (from jfv@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n66HNnbn087652; Mon, 6 Jul 2009 17:23:49 GMT (envelope-from jfv@svn.freebsd.org) Message-Id: <200907061723.n66HNnbn087652@svn.freebsd.org> From: Jack F Vogel Date: Mon, 6 Jul 2009 17:23: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: r195409 - head/sys/dev/e1000 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, 06 Jul 2009 17:23:49 -0000 Author: jfv Date: Mon Jul 6 17:23:48 2009 New Revision: 195409 URL: http://svn.freebsd.org/changeset/base/195409 Log: The new method of reading the mac address from the RAR(0) register does not work on this old adapter, provide a local routine that does it the older way. Approved by: re Modified: head/sys/dev/e1000/e1000_82542.c Modified: head/sys/dev/e1000/e1000_82542.c ============================================================================== --- head/sys/dev/e1000/e1000_82542.c Mon Jul 6 14:15:12 2009 (r195408) +++ head/sys/dev/e1000/e1000_82542.c Mon Jul 6 17:23:48 2009 (r195409) @@ -1,6 +1,6 @@ /****************************************************************************** - Copyright (c) 2001-2008, Intel Corporation + Copyright (c) 2001-2009, Intel Corporation All rights reserved. Redistribution and use in source and binary forms, with or without @@ -49,6 +49,8 @@ static s32 e1000_led_on_82542(struct e1 static s32 e1000_led_off_82542(struct e1000_hw *hw); static void e1000_rar_set_82542(struct e1000_hw *hw, u8 *addr, u32 index); static void e1000_clear_hw_cntrs_82542(struct e1000_hw *hw); +static s32 e1000_read_mac_addr_82542(struct e1000_hw *hw); + /** * e1000_init_phy_params_82542 - Init PHY func ptrs. @@ -134,6 +136,8 @@ static s32 e1000_init_mac_params_82542(s mac->ops.clear_vfta = e1000_clear_vfta_generic; /* setting MTA */ mac->ops.mta_set = e1000_mta_set_generic; + /* read mac address */ + mac->ops.read_mac_addr = e1000_read_mac_addr_82542; /* set RAR */ mac->ops.rar_set = e1000_rar_set_82542; /* turn on/off LED */ @@ -554,3 +558,34 @@ static void e1000_clear_hw_cntrs_82542(s E1000_READ_REG(hw, E1000_PTC1023); E1000_READ_REG(hw, E1000_PTC1522); } + +/** + * e1000_read_mac_addr_82542 - Read device MAC address + * @hw: pointer to the HW structure + * + * Reads the device MAC address from the EEPROM and stores the value. + **/ +static s32 e1000_read_mac_addr_82542(struct e1000_hw *hw) +{ + s32 ret_val = E1000_SUCCESS; + u16 offset, nvm_data, i; + + DEBUGFUNC("e1000_read_mac_addr"); + + for (i = 0; i < ETH_ADDR_LEN; i += 2) { + offset = i >> 1; + ret_val = hw->nvm.ops.read(hw, offset, 1, &nvm_data); + if (ret_val) { + DEBUGOUT("NVM Read Error\n"); + goto out; + } + hw->mac.perm_addr[i] = (u8)(nvm_data & 0xFF); + hw->mac.perm_addr[i+1] = (u8)(nvm_data >> 8); + } + + for (i = 0; i < ETH_ADDR_LEN; i++) + hw->mac.addr[i] = hw->mac.perm_addr[i]; + +out: + return ret_val; +} From owner-svn-src-head@FreeBSD.ORG Mon Jul 6 18:10:27 2009 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 E1612106566C; Mon, 6 Jul 2009 18:10:27 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D02A88FC12; Mon, 6 Jul 2009 18:10:27 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n66IAR5o088648; Mon, 6 Jul 2009 18:10:27 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n66IARQJ088646; Mon, 6 Jul 2009 18:10:27 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <200907061810.n66IARQJ088646@svn.freebsd.org> From: John Baldwin Date: Mon, 6 Jul 2009 18:10: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: r195410 - 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: Mon, 06 Jul 2009 18:10:28 -0000 Author: jhb Date: Mon Jul 6 18:10:27 2009 New Revision: 195410 URL: http://svn.freebsd.org/changeset/base/195410 Log: MFi386: Add a 'show idt' command to DDB to display the non-default function pointers in the interrupt descriptor table. Approved by: re (kensmith) Modified: head/sys/amd64/amd64/machdep.c Modified: head/sys/amd64/amd64/machdep.c ============================================================================== --- head/sys/amd64/amd64/machdep.c Mon Jul 6 17:23:48 2009 (r195409) +++ head/sys/amd64/amd64/machdep.c Mon Jul 6 18:10:27 2009 (r195410) @@ -100,8 +100,9 @@ __FBSDID("$FreeBSD$"); #ifndef KDB #error KDB must be enabled in order for DDB to work! #endif -#endif #include +#include +#endif #include @@ -1083,6 +1084,30 @@ extern inthand_t IDTVEC(xmm), IDTVEC(dblfault), IDTVEC(fast_syscall), IDTVEC(fast_syscall32); +#ifdef DDB +/* + * Display the index and function name of any IDT entries that don't use + * the default 'rsvd' entry point. + */ +DB_SHOW_COMMAND(idt, db_show_idt) +{ + struct gate_descriptor *ip; + int idx; + uintptr_t func; + + ip = idt; + for (idx = 0; idx < NIDT && !db_pager_quit; idx++) { + func = ((long)ip->gd_hioffset << 16 | ip->gd_looffset); + if (func != (uintptr_t)&IDTVEC(rsvd)) { + db_printf("%3d\t", idx); + db_printsym(func, DB_STGY_PROC); + db_printf("\n"); + } + ip++; + } +} +#endif + void sdtossd(sd, ssd) struct user_segment_descriptor *sd; From owner-svn-src-head@FreeBSD.ORG Mon Jul 6 18:23:01 2009 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 5E717106567F; Mon, 6 Jul 2009 18:23:01 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 4BD648FC0A; Mon, 6 Jul 2009 18:23:01 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n66IN1XE089087; Mon, 6 Jul 2009 18:23:01 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n66IN1up089082; Mon, 6 Jul 2009 18:23:01 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <200907061823.n66IN1up089082@svn.freebsd.org> From: John Baldwin Date: Mon, 6 Jul 2009 18:23: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: r195415 - 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: Mon, 06 Jul 2009 18:23:02 -0000 Author: jhb Date: Mon Jul 6 18:23:00 2009 New Revision: 195415 URL: http://svn.freebsd.org/changeset/base/195415 Log: After the per-CPU IDT changes, the IDT vector of an interrupt could change when the interrupt was moved from one CPU to another. If the interrupt was enabled, then the old IDT vector needs to be disabled and the new IDT vector needs to be enabled. This was mostly masked prior to the recent MSI changes since in the older code almost all allocated IDT vectors were already enabled and the enabled vectors on the BSP during boot covered enough of the IDT range. However, after the MSI changes, MSI interrupts that were allocated but not enabled (e.g. DRM with MSI) during boot could result in an allocated IDT vector that wasn't enabled. The round-robin at the end of boot could place another interrupt at the same IDT vector without enabling the IDT vector causing trap 30 faults. Fix this by explicitly disabling/enabling the old and new IDT vectors for enabled interrupt sources when moving an interrupt between CPUs via the pic_assign_cpu() method. While here, fix a bug in my earlier changes so that an I/O APIC interrupt pin is left unchanged if ioapic_assign_cpu() fails to allocate a new IDT vector and returns ENOSPC. Approved by: re (kensmith) Modified: head/sys/amd64/amd64/io_apic.c head/sys/amd64/amd64/msi.c head/sys/i386/i386/io_apic.c head/sys/i386/i386/msi.c Modified: head/sys/amd64/amd64/io_apic.c ============================================================================== --- head/sys/amd64/amd64/io_apic.c Mon Jul 6 18:18:27 2009 (r195414) +++ head/sys/amd64/amd64/io_apic.c Mon Jul 6 18:23:00 2009 (r195415) @@ -327,7 +327,7 @@ ioapic_assign_cpu(struct intsrc *isrc, u { struct ioapic_intsrc *intpin = (struct ioapic_intsrc *)isrc; struct ioapic *io = (struct ioapic *)isrc->is_pic; - u_int old_vector; + u_int old_vector, new_vector; u_int old_id; /* @@ -348,11 +348,14 @@ ioapic_assign_cpu(struct intsrc *isrc, u * Allocate an APIC vector for this interrupt pin. Once * we have a vector we program the interrupt pin. */ - intpin->io_cpu = apic_id; - intpin->io_vector = apic_alloc_vector(apic_id, intpin->io_irq); - if (intpin->io_vector == 0) + new_vector = apic_alloc_vector(apic_id, intpin->io_irq); + if (new_vector == 0) return (ENOSPC); + intpin->io_cpu = apic_id; + intpin->io_vector = new_vector; + if (isrc->is_handlers > 0) + apic_enable_vector(intpin->io_cpu, intpin->io_vector); if (bootverbose) { printf("ioapic%u: routing intpin %u (", io->io_id, intpin->io_intpin); @@ -365,8 +368,11 @@ ioapic_assign_cpu(struct intsrc *isrc, u * Free the old vector after the new one is established. This is done * to prevent races where we could miss an interrupt. */ - if (old_vector) + if (old_vector) { + if (isrc->is_handlers > 0) + apic_disable_vector(old_id, old_vector); apic_free_vector(old_id, old_vector, intpin->io_irq); + } return (0); } Modified: head/sys/amd64/amd64/msi.c ============================================================================== --- head/sys/amd64/amd64/msi.c Mon Jul 6 18:18:27 2009 (r195414) +++ head/sys/amd64/amd64/msi.c Mon Jul 6 18:23:00 2009 (r195415) @@ -230,6 +230,8 @@ msi_assign_cpu(struct intsrc *isrc, u_in msi->msi_cpu = apic_id; msi->msi_vector = vector; + if (msi->msi_intsrc.is_handlers > 0) + apic_enable_vector(msi->msi_cpu, msi->msi_vector); if (bootverbose) printf("msi: Assigning %s IRQ %d to local APIC %u vector %u\n", msi->msi_msix ? "MSI-X" : "MSI", msi->msi_irq, @@ -238,6 +240,8 @@ msi_assign_cpu(struct intsrc *isrc, u_in sib = (struct msi_intsrc *)intr_lookup_source(msi->msi_irqs[i]); sib->msi_cpu = apic_id; sib->msi_vector = vector + i; + if (sib->msi_intsrc.is_handlers > 0) + apic_enable_vector(sib->msi_cpu, sib->msi_vector); if (bootverbose) printf( "msi: Assigning MSI IRQ %d to local APIC %u vector %u\n", @@ -249,9 +253,15 @@ msi_assign_cpu(struct intsrc *isrc, u_in * Free the old vector after the new one is established. This is done * to prevent races where we could miss an interrupt. */ + if (msi->msi_intsrc.is_handlers > 0) + apic_disable_vector(old_id, old_vector); apic_free_vector(old_id, old_vector, msi->msi_irq); - for (i = 1; i < msi->msi_count; i++) + for (i = 1; i < msi->msi_count; i++) { + sib = (struct msi_intsrc *)intr_lookup_source(msi->msi_irqs[i]); + if (sib->msi_intsrc.is_handlers > 0) + apic_disable_vector(old_id, old_vector + i); apic_free_vector(old_id, old_vector + i, msi->msi_irqs[i]); + } return (0); } Modified: head/sys/i386/i386/io_apic.c ============================================================================== --- head/sys/i386/i386/io_apic.c Mon Jul 6 18:18:27 2009 (r195414) +++ head/sys/i386/i386/io_apic.c Mon Jul 6 18:23:00 2009 (r195415) @@ -327,7 +327,7 @@ ioapic_assign_cpu(struct intsrc *isrc, u { struct ioapic_intsrc *intpin = (struct ioapic_intsrc *)isrc; struct ioapic *io = (struct ioapic *)isrc->is_pic; - u_int old_vector; + u_int old_vector, new_vector; u_int old_id; /* @@ -348,11 +348,14 @@ ioapic_assign_cpu(struct intsrc *isrc, u * Allocate an APIC vector for this interrupt pin. Once * we have a vector we program the interrupt pin. */ - intpin->io_cpu = apic_id; - intpin->io_vector = apic_alloc_vector(apic_id, intpin->io_irq); - if (intpin->io_vector == 0) + new_vector = apic_alloc_vector(apic_id, intpin->io_irq); + if (new_vector == 0) return (ENOSPC); + intpin->io_cpu = apic_id; + intpin->io_vector = new_vector; + if (isrc->is_handlers > 0) + apic_enable_vector(intpin->io_cpu, intpin->io_vector); if (bootverbose) { printf("ioapic%u: routing intpin %u (", io->io_id, intpin->io_intpin); @@ -365,8 +368,11 @@ ioapic_assign_cpu(struct intsrc *isrc, u * Free the old vector after the new one is established. This is done * to prevent races where we could miss an interrupt. */ - if (old_vector) + if (old_vector) { + if (isrc->is_handlers > 0) + apic_disable_vector(old_id, old_vector); apic_free_vector(old_id, old_vector, intpin->io_irq); + } return (0); } Modified: head/sys/i386/i386/msi.c ============================================================================== --- head/sys/i386/i386/msi.c Mon Jul 6 18:18:27 2009 (r195414) +++ head/sys/i386/i386/msi.c Mon Jul 6 18:23:00 2009 (r195415) @@ -230,6 +230,8 @@ msi_assign_cpu(struct intsrc *isrc, u_in msi->msi_cpu = apic_id; msi->msi_vector = vector; + if (msi->msi_intsrc.is_handlers > 0) + apic_enable_vector(msi->msi_cpu, msi->msi_vector); if (bootverbose) printf("msi: Assigning %s IRQ %d to local APIC %u vector %u\n", msi->msi_msix ? "MSI-X" : "MSI", msi->msi_irq, @@ -238,6 +240,8 @@ msi_assign_cpu(struct intsrc *isrc, u_in sib = (struct msi_intsrc *)intr_lookup_source(msi->msi_irqs[i]); sib->msi_cpu = apic_id; sib->msi_vector = vector + i; + if (sib->msi_intsrc.is_handlers > 0) + apic_enable_vector(sib->msi_cpu, sib->msi_vector); if (bootverbose) printf( "msi: Assigning MSI IRQ %d to local APIC %u vector %u\n", @@ -249,9 +253,15 @@ msi_assign_cpu(struct intsrc *isrc, u_in * Free the old vector after the new one is established. This is done * to prevent races where we could miss an interrupt. */ + if (msi->msi_intsrc.is_handlers > 0) + apic_disable_vector(old_id, old_vector); apic_free_vector(old_id, old_vector, msi->msi_irq); - for (i = 1; i < msi->msi_count; i++) + for (i = 1; i < msi->msi_count; i++) { + sib = (struct msi_intsrc *)intr_lookup_source(msi->msi_irqs[i]); + if (sib->msi_intsrc.is_handlers > 0) + apic_disable_vector(old_id, old_vector + i); apic_free_vector(old_id, old_vector + i, msi->msi_irqs[i]); + } return (0); } From owner-svn-src-head@FreeBSD.ORG Mon Jul 6 18:43:43 2009 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 445491065670; Mon, 6 Jul 2009 18:43:43 +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 18B8B8FC1B; Mon, 6 Jul 2009 18:43:43 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n66Ihgu3089543; Mon, 6 Jul 2009 18:43:42 GMT (envelope-from alc@svn.freebsd.org) Received: (from alc@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n66IhgmM089541; Mon, 6 Jul 2009 18:43:42 GMT (envelope-from alc@svn.freebsd.org) Message-Id: <200907061843.n66IhgmM089541@svn.freebsd.org> From: Alan Cox Date: Mon, 6 Jul 2009 18:43: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: r195416 - 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: Mon, 06 Jul 2009 18:43:43 -0000 Author: alc Date: Mon Jul 6 18:43:42 2009 New Revision: 195416 URL: http://svn.freebsd.org/changeset/base/195416 Log: When pmap_change_attr() changes the PAT setting on a kernel mapping, it has to simultaneously change the PAT setting for the same pages within the direct map region. This may require the demotion of a 2MB page mapping and the allocation of a page table page. This revision gives the highest possible priority (VM_ALLOC_INTERRUPT) to this page allocation, so that pmap_change_attr() is less likely to fail. (In general, kernel page table page allocations have the highest priority, so this is not creating a new precedent.) (Demotion of 1GB page mappings within the direct map already specifies VM_ALLOC_INTERRUPT to vm_page_alloc(), so only pmap_demote_pde() must be changed.) Approved by: re (kib) Modified: head/sys/amd64/amd64/pmap.c Modified: head/sys/amd64/amd64/pmap.c ============================================================================== --- head/sys/amd64/amd64/pmap.c Mon Jul 6 18:23:00 2009 (r195415) +++ head/sys/amd64/amd64/pmap.c Mon Jul 6 18:43:42 2009 (r195416) @@ -2218,11 +2218,19 @@ pmap_demote_pde(pmap_t pmap, pd_entry_t /* * Invalidate the 2MB page mapping and return "failure" if the * mapping was never accessed or the allocation of the new - * page table page fails. + * page table page fails. If the 2MB page mapping belongs to + * the direct map region of the kernel's address space, then + * the page allocation request specifies the highest possible + * priority (VM_ALLOC_INTERRUPT). Otherwise, the priority is + * normal. Page table pages are preallocated for every other + * part of the kernel address space, so the direct map region + * is the only part of the kernel address space that must be + * handled here. */ if ((oldpde & PG_A) == 0 || (mpte = vm_page_alloc(NULL, - pmap_pde_pindex(va), VM_ALLOC_NOOBJ | VM_ALLOC_NORMAL | - VM_ALLOC_WIRED)) == NULL) { + pmap_pde_pindex(va), (va >= DMAP_MIN_ADDRESS && va < + DMAP_MAX_ADDRESS ? VM_ALLOC_INTERRUPT : VM_ALLOC_NORMAL) | + VM_ALLOC_NOOBJ | VM_ALLOC_WIRED)) == NULL) { free = NULL; pmap_remove_pde(pmap, pde, trunc_2mpage(va), &free); pmap_invalidate_page(pmap, trunc_2mpage(va)); From owner-svn-src-head@FreeBSD.ORG Mon Jul 6 19:32:13 2009 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 9490E1065672; Mon, 6 Jul 2009 19:32:13 +0000 (UTC) (envelope-from joel@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 82AC58FC13; Mon, 6 Jul 2009 19:32:13 +0000 (UTC) (envelope-from joel@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n66JWDn7090518; Mon, 6 Jul 2009 19:32:13 GMT (envelope-from joel@svn.freebsd.org) Received: (from joel@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n66JWD41090516; Mon, 6 Jul 2009 19:32:13 GMT (envelope-from joel@svn.freebsd.org) Message-Id: <200907061932.n66JWD41090516@svn.freebsd.org> From: Joel Dahl Date: Mon, 6 Jul 2009 19:32: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: r195417 - head/share/man/man4 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, 06 Jul 2009 19:32:14 -0000 Author: joel (doc committer) Date: Mon Jul 6 19:32:13 2009 New Revision: 195417 URL: http://svn.freebsd.org/changeset/base/195417 Log: Document the new EQ and VPC features along with a few loader tunables. Reviewed by: ariff Approved by: re (blanket) Modified: head/share/man/man4/pcm.4 Modified: head/share/man/man4/pcm.4 ============================================================================== --- head/share/man/man4/pcm.4 Mon Jul 6 18:43:42 2009 (r195416) +++ head/share/man/man4/pcm.4 Mon Jul 6 19:32:13 2009 (r195417) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd June 23, 2009 +.Dd July 6, 2009 .Dt SOUND 4 .Os .Sh NAME @@ -141,6 +141,15 @@ To define default values for the differe set the channel to the preferred value using hints, e.g.: .Va hint.pcm.0.line Ns = Ns Qq Li 0 . This will mute the input channel per default. +.Ss EQ +The Parametric Software Equlizer (EQ) enables the use of +.Dq tone +controls (bass and treble). +Commonly used for ear-candy or frequency compensation due to the vast +difference in hardware quality. +EQ is disabled by default, but can be enabled with the +.Va hint.pcm. Ns Ao Ar X Ac Ns Va .eq +tunable. .Ss VCHANs Each device can optionally support more playback and recording channels than physical hardware provides by using @@ -151,15 +160,55 @@ or options can be configured via the .Xr sysctl 8 interface but can only be manipulated while the device is inactive. +.Ss VPC +FreeBSD supports independent and individual volume controls for each active +application, without touching the master +.Nm +volume. +This is sometimes referred to as Volume Per Channel (VPC). +The +.Tn VPC +feature is enabled by default. +.Ss Loader Tunables +The following loader tunables are used to set driver configuration at the +.Xr loader 8 +prompt before booting the kernel, or they can be stored in +.Pa /boot/loader.conf +in order to automatically set them before booting the kernel. +It is also possible to use +.Xr kenv 1 +to change these tunables before loading the +.Nm +driver. +The following tunables can not be changed during runtime using +.Xr sysctl 8 . +.Bl -tag -width indent +.It Va hint.pcm. Ns Ao Ar X Ac Ns Va .eq +Set to 1 or 0 to explicitly enable (1) or disable (0) the equalizer. +Requires a driver reload if changed. +Enabling this will make bass and treble controls appear in mixer applications. +This tunable is undefined by default. +Equalizing is disabled by default. +.It Va hint.pcm. Ns Ao Ar X Ac Ns Va .vpc +Set to 1 or 0 to explicitly enable (1) or disable (0) the +.Tn VPC +feature. +This tunable is undefined by default. +.Tn VPC +is however enabled by default. +.El .Ss Runtime Configuration There are a number of .Xr sysctl 8 -variables available. +variables available which can be modified during runtime. +These values can also be stored in +.Pa /etc/sysctl.conf +in order to automatically set them during the boot process. .Va hw.snd.* -tunables are global settings and +are global settings and .Va dev.pcm.* are device specific. -.Bl -tag -width ".Va hw.snd.report_soft_formats" -offset indent +.Bl -tag -width indent .It Va hw.snd.compat_linux_mmap Enable to allow PROT_EXEC page mappings. All Linux applications using sound and @@ -299,7 +348,9 @@ This means that any changes to the volum Enabling this will preserve the volume, at the cost of possible confusion when applications tries to re-open the same device. .It Va hw.snd.vpc_mixer_bypass -The recommended way to use the vpc feature is to teach applications to use +The recommended way to use the +.Tn VPC +feature is to teach applications to use the correct .Fn ioctl : .Dv SNDCTL_DSP_GETPLAYVOL, SNDCTL_DSP_SETPLAYVOL, From owner-svn-src-head@FreeBSD.ORG Mon Jul 6 20:51:55 2009 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 4B44B1065674; Mon, 6 Jul 2009 20:51:55 +0000 (UTC) (envelope-from sam@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E8B728FC24; Mon, 6 Jul 2009 20:51:54 +0000 (UTC) (envelope-from sam@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n66KpsL4091987; Mon, 6 Jul 2009 20:51:54 GMT (envelope-from sam@svn.freebsd.org) Received: (from sam@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n66KpsEc091984; Mon, 6 Jul 2009 20:51:54 GMT (envelope-from sam@svn.freebsd.org) Message-Id: <200907062051.n66KpsEc091984@svn.freebsd.org> From: Sam Leffler Date: Mon, 6 Jul 2009 20:51: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: r195418 - head/sys/dev/ath 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, 06 Jul 2009 20:51:55 -0000 Author: sam Date: Mon Jul 6 20:51:54 2009 New Revision: 195418 URL: http://svn.freebsd.org/changeset/base/195418 Log: Fix AR5416 and later parts when building with AH_DEBUG or similar defined: always define OS_REG_UNSWAPPED and use it in ath_hal_reg_{read,write}. Approved by: re (kib) Modified: head/sys/dev/ath/ah_osdep.c head/sys/dev/ath/ah_osdep.h Modified: head/sys/dev/ath/ah_osdep.c ============================================================================== --- head/sys/dev/ath/ah_osdep.c Mon Jul 6 19:32:13 2009 (r195417) +++ head/sys/dev/ath/ah_osdep.c Mon Jul 6 20:51:54 2009 (r195418) @@ -254,7 +254,7 @@ ath_hal_reg_write(struct ath_hal *ah, u_ } } #if _BYTE_ORDER == _BIG_ENDIAN - if (reg >= 0x4000 && reg < 0x5000) + if (OS_REG_UNSWAPPED(reg)) bus_space_write_4(tag, h, reg, val); else #endif @@ -269,7 +269,7 @@ ath_hal_reg_read(struct ath_hal *ah, u_i u_int32_t val; #if _BYTE_ORDER == _BIG_ENDIAN - if (reg >= 0x4000 && reg < 0x5000) + if (OS_REG_UNSWAPPED(reg)) val = bus_space_read_4(tag, h, reg); else #endif @@ -320,7 +320,7 @@ ath_hal_reg_write(struct ath_hal *ah, u_ bus_space_handle_t h = ah->ah_sh; #if _BYTE_ORDER == _BIG_ENDIAN - if (reg >= 0x4000 && reg < 0x5000) + if (OS_REG_UNSWAPPED(reg)) bus_space_write_4(tag, h, reg, val); else #endif @@ -335,7 +335,7 @@ ath_hal_reg_read(struct ath_hal *ah, u_i u_int32_t val; #if _BYTE_ORDER == _BIG_ENDIAN - if (reg >= 0x4000 && reg < 0x5000) + if (OS_REG_UNSWAPPED(reg)) val = bus_space_read_4(tag, h, reg); else #endif Modified: head/sys/dev/ath/ah_osdep.h ============================================================================== --- head/sys/dev/ath/ah_osdep.h Mon Jul 6 19:32:13 2009 (r195417) +++ head/sys/dev/ath/ah_osdep.h Mon Jul 6 20:51:54 2009 (r195418) @@ -69,14 +69,26 @@ typedef bus_space_handle_t HAL_BUS_HANDL struct ath_hal; /* + * The hardware registers are native little-endian byte order. + * Big-endian hosts are handled by enabling hardware byte-swap + * of register reads and writes at reset. But the PCI clock + * domain registers are not byte swapped! Thus, on big-endian + * platforms we have to explicitly byte-swap those registers. + * OS_REG_UNSWAPPED identifies the registers that need special handling. + */ +#if _BYTE_ORDER == _BIG_ENDIAN +#define OS_REG_UNSWAPPED(_reg) \ + (((_reg) >= 0x4000 && (_reg) < 0x5000) || \ + ((_reg) >= 0x7000 && (_reg) < 0x8000)) +#else /* _BYTE_ORDER == _LITTLE_ENDIAN */ +#define OS_REG_UNSWAPPED(_reg) (0) +#endif /* _BYTE_ORDER */ + +/* * Register read/write operations are either handled through * platform-dependent routines (or when debugging is enabled * with AH_DEBUG); or they are inline expanded using the macros - * defined below. For public builds we inline expand only for - * platforms where it is certain what the requirements are to - * read/write registers--typically they are memory-mapped and - * no explicit synchronization or memory invalidation operations - * are required (e.g. i386). + * defined below. */ #if defined(AH_DEBUG) || defined(AH_REGOPS_FUNC) || defined(AH_DEBUG_ALQ) #define OS_REG_WRITE(_ah, _reg, _val) ath_hal_reg_write(_ah, _reg, _val) @@ -94,13 +106,7 @@ extern u_int32_t ath_hal_reg_read(struct * Most of this code is collapsed at compile time because the * register values are constants. */ -#define AH_LITTLE_ENDIAN 1234 -#define AH_BIG_ENDIAN 4321 - #if _BYTE_ORDER == _BIG_ENDIAN -#define OS_REG_UNSWAPPED(_reg) \ - (((_reg) >= 0x4000 && (_reg) < 0x5000) || \ - ((_reg) >= 0x7000 && (_reg) < 0x8000)) #define OS_REG_WRITE(_ah, _reg, _val) do { \ if (OS_REG_UNSWAPPED(_reg)) \ bus_space_write_4((bus_space_tag_t)(_ah)->ah_st, \ @@ -116,7 +122,6 @@ extern u_int32_t ath_hal_reg_read(struct bus_space_read_stream_4((bus_space_tag_t)(_ah)->ah_st, \ (bus_space_handle_t)(_ah)->ah_sh, (_reg))) #else /* _BYTE_ORDER == _LITTLE_ENDIAN */ -#define OS_REG_UNSWAPPED(_reg) (0) #define OS_REG_WRITE(_ah, _reg, _val) \ bus_space_write_4((bus_space_tag_t)(_ah)->ah_st, \ (bus_space_handle_t)(_ah)->ah_sh, (_reg), (_val)) From owner-svn-src-head@FreeBSD.ORG Tue Jul 7 00:02:27 2009 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 469BD106564A; Tue, 7 Jul 2009 00:02:27 +0000 (UTC) (envelope-from kensmith@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 1A5848FC1C; Tue, 7 Jul 2009 00:02:27 +0000 (UTC) (envelope-from kensmith@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n6702Q1P096123; Tue, 7 Jul 2009 00:02:27 GMT (envelope-from kensmith@svn.freebsd.org) Received: (from kensmith@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n6702Q4s096121; Tue, 7 Jul 2009 00:02:26 GMT (envelope-from kensmith@svn.freebsd.org) Message-Id: <200907070002.n6702Q4s096121@svn.freebsd.org> From: Ken Smith Date: Tue, 7 Jul 2009 00:02: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: r195422 - 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: Tue, 07 Jul 2009 00:02:27 -0000 Author: kensmith Date: Tue Jul 7 00:02:26 2009 New Revision: 195422 URL: http://svn.freebsd.org/changeset/base/195422 Log: Bump for BETA1. Approved by: re (implicit) Modified: head/sys/conf/newvers.sh Modified: head/sys/conf/newvers.sh ============================================================================== --- head/sys/conf/newvers.sh Mon Jul 6 23:34:02 2009 (r195421) +++ head/sys/conf/newvers.sh Tue Jul 7 00:02:26 2009 (r195422) @@ -32,7 +32,7 @@ TYPE="FreeBSD" REVISION="8.0" -BRANCH="CURRENT" +BRANCH="BETA1" if [ "X${BRANCH_OVERRIDE}" != "X" ]; then BRANCH=${BRANCH_OVERRIDE} fi From owner-svn-src-head@FreeBSD.ORG Tue Jul 7 09:43:45 2009 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 0F09C10656CB; Tue, 7 Jul 2009 09:43:45 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E72898FC23; Tue, 7 Jul 2009 09:43:44 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n679hinY008700; Tue, 7 Jul 2009 09:43:44 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n679hin1008696; Tue, 7 Jul 2009 09:43:44 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <200907070943.n679hin1008696@svn.freebsd.org> From: Konstantin Belousov Date: Tue, 7 Jul 2009 09:43: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: r195423 - in head/sys: fs/fifofs kern 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, 07 Jul 2009 09:43:45 -0000 Author: kib Date: Tue Jul 7 09:43:44 2009 New Revision: 195423 URL: http://svn.freebsd.org/changeset/base/195423 Log: Fix poll(2) and select(2) for named pipes to return "ready for read" when all writers, observed by reader, exited. Use writer generation counter for fifo, and store the snapshot of the fifo generation in the f_seqcount field of struct file, that is otherwise unused for fifos. Set FreeBSD-undocumented POLLINIGNEOF flag only when file f_seqcount is equal to fifo' fi_wgen, and revert r89376. Fix POLLINIGNEOF for sockets and pipes, and return POLLHUP for them. Note that the patch does not fix not returning POLLHUP for fifos. PR: kern/94772 Submitted by: bde (original version) Reviewed by: rwatson, jilles Approved by: re (kensmith) MFC after: 6 weeks (might be) Modified: head/sys/fs/fifofs/fifo_vnops.c head/sys/kern/sys_pipe.c head/sys/kern/uipc_socket.c head/sys/sys/socketvar.h Modified: head/sys/fs/fifofs/fifo_vnops.c ============================================================================== --- head/sys/fs/fifofs/fifo_vnops.c Tue Jul 7 00:02:26 2009 (r195422) +++ head/sys/fs/fifofs/fifo_vnops.c Tue Jul 7 09:43:44 2009 (r195423) @@ -84,6 +84,7 @@ struct fifoinfo { struct socket *fi_writesock; long fi_readers; long fi_writers; + int fi_wgen; }; static vop_print_t fifo_print; @@ -232,6 +233,7 @@ fail1: sowwakeup(fip->fi_writesock); } } + fp->f_seqcount = fip->fi_wgen - fip->fi_writers; } if (ap->a_mode & FWRITE) { if ((ap->a_mode & O_NONBLOCK) && fip->fi_readers == 0) { @@ -279,6 +281,9 @@ fail1: fip->fi_writers--; if (fip->fi_writers == 0) { socantrcvmore(fip->fi_readsock); + mtx_lock(&fifo_mtx); + fip->fi_wgen++; + mtx_unlock(&fifo_mtx); fifo_cleanup(vp); } return (error); @@ -395,8 +400,12 @@ fifo_close(ap) } if (ap->a_fflag & FWRITE) { fip->fi_writers--; - if (fip->fi_writers == 0) + if (fip->fi_writers == 0) { socantrcvmore(fip->fi_readsock); + mtx_lock(&fifo_mtx); + fip->fi_wgen++; + mtx_unlock(&fifo_mtx); + } } fifo_cleanup(vp); return (0); @@ -634,28 +643,13 @@ fifo_poll_f(struct file *fp, int events, levents = events & (POLLIN | POLLINIGNEOF | POLLPRI | POLLRDNORM | POLLRDBAND); if ((fp->f_flag & FREAD) && levents) { - /* - * If POLLIN or POLLRDNORM is requested and POLLINIGNEOF is - * not, then convert the first two to the last one. This - * tells the socket poll function to ignore EOF so that we - * block if there is no writer (and no data). Callers can - * set POLLINIGNEOF to get non-blocking behavior. - */ - if (levents & (POLLIN | POLLRDNORM) && - !(levents & POLLINIGNEOF)) { - levents &= ~(POLLIN | POLLRDNORM); - levents |= POLLINIGNEOF; - } - filetmp.f_data = fip->fi_readsock; filetmp.f_cred = cred; + mtx_lock(&fifo_mtx); + if (fp->f_seqcount == fip->fi_wgen) + levents |= POLLINIGNEOF; + mtx_unlock(&fifo_mtx); revents |= soo_poll(&filetmp, levents, cred, td); - - /* Reverse the above conversion. */ - if ((revents & POLLINIGNEOF) && !(events & POLLINIGNEOF)) { - revents |= (events & (POLLIN | POLLRDNORM)); - revents &= ~POLLINIGNEOF; - } } levents = events & (POLLOUT | POLLWRNORM | POLLWRBAND); if ((fp->f_flag & FWRITE) && levents) { Modified: head/sys/kern/sys_pipe.c ============================================================================== --- head/sys/kern/sys_pipe.c Tue Jul 7 00:02:26 2009 (r195422) +++ head/sys/kern/sys_pipe.c Tue Jul 7 09:43:44 2009 (r195423) @@ -1353,8 +1353,7 @@ pipe_poll(fp, events, active_cred, td) #endif if (events & (POLLIN | POLLRDNORM)) if ((rpipe->pipe_state & PIPE_DIRECTW) || - (rpipe->pipe_buffer.cnt > 0) || - (rpipe->pipe_state & PIPE_EOF)) + (rpipe->pipe_buffer.cnt > 0)) revents |= events & (POLLIN | POLLRDNORM); if (events & (POLLOUT | POLLWRNORM)) @@ -1364,10 +1363,14 @@ pipe_poll(fp, events, active_cred, td) (wpipe->pipe_buffer.size - wpipe->pipe_buffer.cnt) >= PIPE_BUF)) revents |= events & (POLLOUT | POLLWRNORM); - if ((rpipe->pipe_state & PIPE_EOF) || - wpipe->pipe_present != PIPE_ACTIVE || - (wpipe->pipe_state & PIPE_EOF)) - revents |= POLLHUP; + if ((events & POLLINIGNEOF) == 0) { + if (rpipe->pipe_state & PIPE_EOF) { + revents |= (events & (POLLIN | POLLRDNORM)); + if (wpipe->pipe_present != PIPE_ACTIVE || + (wpipe->pipe_state & PIPE_EOF)) + revents |= POLLHUP; + } + } if (revents == 0) { if (events & (POLLIN | POLLRDNORM)) { Modified: head/sys/kern/uipc_socket.c ============================================================================== --- head/sys/kern/uipc_socket.c Tue Jul 7 00:02:26 2009 (r195422) +++ head/sys/kern/uipc_socket.c Tue Jul 7 09:43:44 2009 (r195423) @@ -2885,14 +2885,9 @@ sopoll_generic(struct socket *so, int ev SOCKBUF_LOCK(&so->so_snd); SOCKBUF_LOCK(&so->so_rcv); if (events & (POLLIN | POLLRDNORM)) - if (soreadable(so)) + if (soreadabledata(so)) revents |= events & (POLLIN | POLLRDNORM); - if (events & POLLINIGNEOF) - if (so->so_rcv.sb_cc >= so->so_rcv.sb_lowat || - !TAILQ_EMPTY(&so->so_comp) || so->so_error) - revents |= POLLINIGNEOF; - if (events & (POLLOUT | POLLWRNORM)) if (sowriteable(so)) revents |= events & (POLLOUT | POLLWRNORM); @@ -2901,10 +2896,16 @@ sopoll_generic(struct socket *so, int ev if (so->so_oobmark || (so->so_rcv.sb_state & SBS_RCVATMARK)) revents |= events & (POLLPRI | POLLRDBAND); + if ((events & POLLINIGNEOF) == 0) { + if (so->so_rcv.sb_state & SBS_CANTRCVMORE) { + revents |= events & (POLLIN | POLLRDNORM); + if (so->so_snd.sb_state & SBS_CANTSENDMORE) + revents |= POLLHUP; + } + } + if (revents == 0) { - if (events & - (POLLIN | POLLINIGNEOF | POLLPRI | POLLRDNORM | - POLLRDBAND)) { + if (events & (POLLIN | POLLPRI | POLLRDNORM | POLLRDBAND)) { selrecord(td, &so->so_rcv.sb_sel); so->so_rcv.sb_flags |= SB_SEL; } Modified: head/sys/sys/socketvar.h ============================================================================== --- head/sys/sys/socketvar.h Tue Jul 7 00:02:26 2009 (r195422) +++ head/sys/sys/socketvar.h Tue Jul 7 09:43:44 2009 (r195423) @@ -197,10 +197,11 @@ struct xsocket { ((so)->so_proto->pr_flags & PR_ATOMIC) /* can we read something from so? */ -#define soreadable(so) \ +#define soreadabledata(so) \ ((so)->so_rcv.sb_cc >= (so)->so_rcv.sb_lowat || \ - ((so)->so_rcv.sb_state & SBS_CANTRCVMORE) || \ !TAILQ_EMPTY(&(so)->so_comp) || (so)->so_error) +#define soreadable(so) \ + (soreadabledata(so) || ((so)->so_rcv.sb_state & SBS_CANTRCVMORE)) /* can we write something to so? */ #define sowriteable(so) \ From owner-svn-src-head@FreeBSD.ORG Tue Jul 7 13:28:06 2009 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 210901065675; Tue, 7 Jul 2009 13:28:06 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from pin.if.uz.zgora.pl (pin.if.uz.zgora.pl [212.109.128.251]) by mx1.freebsd.org (Postfix) with ESMTP id D508D8FC1C; Tue, 7 Jul 2009 13:28:05 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: by pin.if.uz.zgora.pl (Postfix, from userid 1001) id 09B0F39BA2; Tue, 7 Jul 2009 15:13:15 +0200 (CEST) Date: Tue, 7 Jul 2009 15:13:14 +0200 From: Edward Tomasz Napierala To: Jilles Tjoelker Message-ID: <20090707131314.GB31722@pin.if.uz.zgora.pl> References: <200907011552.n61FqJL5016996@svn.freebsd.org> <20090703142334.GA53614@stack.nl> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-2 Content-Disposition: inline In-Reply-To: <20090703142334.GA53614@stack.nl> User-Agent: Mutt/1.5.18 (2008-05-17) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r195243 - head/bin/chmod 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, 07 Jul 2009 13:28:06 -0000 On 0703T1623, Jilles Tjoelker wrote: > On Wed, Jul 01, 2009 at 03:52:19PM +0000, Edward Tomasz Napierala wrote: > > + ret = pathconf(ent->fts_accpath, _PC_ACL_NFS4); > > There doesn't seem to be anything like lpathconf() or > fpathconfat(AT_SYMLINK_NOFOLLOW), so this may not work properly for > symlinks (chmod -h). Working on it. I think the cleanest way to solve it is to add lpathconf(2). -- If you cut off my head, what would I say? Me and my head, or me and my body? From owner-svn-src-head@FreeBSD.ORG Tue Jul 7 13:58:48 2009 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 3C3F71065672; Tue, 7 Jul 2009 13:58:48 +0000 (UTC) (envelope-from joel@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 0FFC98FC17; Tue, 7 Jul 2009 13:58:48 +0000 (UTC) (envelope-from joel@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n67DwlLU020440; Tue, 7 Jul 2009 13:58:47 GMT (envelope-from joel@svn.freebsd.org) Received: (from joel@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n67DwlV0020438; Tue, 7 Jul 2009 13:58:47 GMT (envelope-from joel@svn.freebsd.org) Message-Id: <200907071358.n67DwlV0020438@svn.freebsd.org> From: Joel Dahl Date: Tue, 7 Jul 2009 13:58: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: r195424 - head/share/man/man4 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, 07 Jul 2009 13:58:48 -0000 Author: joel (doc committer) Date: Tue Jul 7 13:58:47 2009 New Revision: 195424 URL: http://svn.freebsd.org/changeset/base/195424 Log: Fix two typos and sort sysctls. PR: docs/136408 Approved by: re (blanket) Modified: head/share/man/man4/pcm.4 Modified: head/share/man/man4/pcm.4 ============================================================================== --- head/share/man/man4/pcm.4 Tue Jul 7 09:43:44 2009 (r195423) +++ head/share/man/man4/pcm.4 Tue Jul 7 13:58:47 2009 (r195424) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd July 6, 2009 +.Dd July 7, 2009 .Dt SOUND 4 .Os .Sh NAME @@ -237,19 +237,13 @@ rates. Maximum allowable sample rate. .It Va hw.snd.feeder_rate_min Minimum allowable sample rate. -.It Va hw.snd.feeder_rate_round -Sample rate rounding threshold, to avoid large prime division at the -cost of accuracy. -All requested sample rates will be rounded to the nearest threshold value. -Possible values range between 0 (disabled) and 500. -Default is 25. -.It Va hw.snd.feeder_polyphase_max +.It Va hw.snd.feeder_rate_polyphase_max Adjust to set the maximum number of allowed polyphase entries during the process of building resampling filters. Only applicable when the SINC interpolator is used. Default value is 183040. Set to 0 to disable polyphase resampling. -.It Va hw.snd.feeder_quality +.It Va hw.snd.feeder_rate_quality Sample rate converter quality. Default value is 1, linear interpolation. Available options include: @@ -277,6 +271,12 @@ taps and 90% bandwidth as quality values Continuation of the bandlimited SINC inteprolator, with 100dB stopband, 164 taps and 97% bandwidth as quality values. .El +.It Va hw.snd.feeder_rate_round +Sample rate rounding threshold, to avoid large prime division at the +cost of accuracy. +All requested sample rates will be rounded to the nearest threshold value. +Possible values range between 0 (disabled) and 500. +Default is 25. .It Va hw.snd.latency Configure the buffering latency. Only affects applications that do not explicitly request From owner-svn-src-head@FreeBSD.ORG Tue Jul 7 18:11:05 2009 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 CE3AE106566C; Tue, 7 Jul 2009 18:11:05 +0000 (UTC) (envelope-from sam@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id BC54C8FC13; Tue, 7 Jul 2009 18:11:05 +0000 (UTC) (envelope-from sam@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n67IB5Yt025410; Tue, 7 Jul 2009 18:11:05 GMT (envelope-from sam@svn.freebsd.org) Received: (from sam@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n67IB5eg025408; Tue, 7 Jul 2009 18:11:05 GMT (envelope-from sam@svn.freebsd.org) Message-Id: <200907071811.n67IB5eg025408@svn.freebsd.org> From: Sam Leffler Date: Tue, 7 Jul 2009 18:11: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: r195426 - head/sys/dev/ath/ath_hal/ar5416 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, 07 Jul 2009 18:11:06 -0000 Author: sam Date: Tue Jul 7 18:11:05 2009 New Revision: 195426 URL: http://svn.freebsd.org/changeset/base/195426 Log: Fix ar5416 and later parts on big-endian platforms: setup the h/w byte swizzler using the same technique used everywhere else. Approved by: re (kib) Modified: head/sys/dev/ath/ath_hal/ar5416/ar5416_reset.c Modified: head/sys/dev/ath/ath_hal/ar5416/ar5416_reset.c ============================================================================== --- head/sys/dev/ath/ath_hal/ar5416/ar5416_reset.c Tue Jul 7 16:10:53 2009 (r195425) +++ head/sys/dev/ath/ath_hal/ar5416/ar5416_reset.c Tue Jul 7 18:11:05 2009 (r195426) @@ -1045,7 +1045,7 @@ ar5416SetResetPowerOn(struct ath_hal *ah static HAL_BOOL ar5416SetReset(struct ath_hal *ah, int type) { - uint32_t tmpReg; + uint32_t tmpReg, mask; /* * Force wake @@ -1091,23 +1091,22 @@ ar5416SetReset(struct ath_hal *ah, int t /* Clear AHB reset */ OS_REG_WRITE(ah, AR_RC, 0); - /* Set register and descriptor swapping on - * Bigendian platforms on cold reset - */ -#ifdef __BIG_ENDIAN__ - if (type == HAL_RESET_COLD) { - uint32_t mask; - - HALDEBUG(ah, HAL_DEBUG_RESET, - "%s Applying descriptor swap\n", __func__); - - mask = INIT_CONFIG_STATUS | AR_CFG_SWRD | AR_CFG_SWRG; + if (type == HAL_RESET_COLD) { + if (isBigEndian()) { + /* + * Set CFG, little-endian for register + * and descriptor accesses. + */ + mask = INIT_CONFIG_STATUS | AR_CFG_SWRD | AR_CFG_SWRG; #ifndef AH_NEED_DESC_SWAP - mask |= AR_CFG_SWTD; + mask |= AR_CFG_SWTD; #endif - OS_REG_WRITE(ah, AR_CFG, LE_READ_4(&mask)); + HALDEBUG(ah, HAL_DEBUG_RESET, + "%s Applying descriptor swap\n", __func__); + OS_REG_WRITE(ah, AR_CFG, LE_READ_4(&mask)); + } else + OS_REG_WRITE(ah, AR_CFG, INIT_CONFIG_STATUS); } -#endif ar5416InitPLL(ah, AH_NULL); From owner-svn-src-head@FreeBSD.ORG Wed Jul 8 01:09:12 2009 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 E57731065753; Wed, 8 Jul 2009 01:09:12 +0000 (UTC) (envelope-from silby@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D3D4D8FC33; Wed, 8 Jul 2009 01:09:12 +0000 (UTC) (envelope-from silby@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n6819Cos033842; Wed, 8 Jul 2009 01:09:12 GMT (envelope-from silby@svn.freebsd.org) Received: (from silby@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n6819CEn033840; Wed, 8 Jul 2009 01:09:12 GMT (envelope-from silby@svn.freebsd.org) Message-Id: <200907080109.n6819CEn033840@svn.freebsd.org> From: Mike Silbersack Date: Wed, 8 Jul 2009 01:09: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: r195430 - 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, 08 Jul 2009 01:09:14 -0000 Author: silby Date: Wed Jul 8 01:09:12 2009 New Revision: 195430 URL: http://svn.freebsd.org/changeset/base/195430 Log: Increase HZ_VM from 10 to 100. While 10 hz saves cpu time under VM environments, it's too slow for FreeBSD to work properly. For example, ping at 10hz pings about every 600ms instead of about every second. Approved by: re (kib) Modified: head/sys/kern/subr_param.c Modified: head/sys/kern/subr_param.c ============================================================================== --- head/sys/kern/subr_param.c Tue Jul 7 19:55:09 2009 (r195429) +++ head/sys/kern/subr_param.c Wed Jul 8 01:09:12 2009 (r195430) @@ -58,7 +58,7 @@ __FBSDID("$FreeBSD$"); # define HZ 100 # endif # ifndef HZ_VM -# define HZ_VM 10 +# define HZ_VM 100 # endif #else # ifndef HZ_VM From owner-svn-src-head@FreeBSD.ORG Wed Jul 8 05:56:15 2009 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 485A01065670; Wed, 8 Jul 2009 05:56:15 +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 2B4198FC0A; Wed, 8 Jul 2009 05:56:15 +0000 (UTC) (envelope-from marcel@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n685uFIb040050; Wed, 8 Jul 2009 05:56:15 GMT (envelope-from marcel@svn.freebsd.org) Received: (from marcel@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n685uFsn040044; Wed, 8 Jul 2009 05:56:15 GMT (envelope-from marcel@svn.freebsd.org) Message-Id: <200907080556.n685uFsn040044@svn.freebsd.org> From: Marcel Moolenaar Date: Wed, 8 Jul 2009 05:56: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: r195436 - in head/sys: dev/ata geom geom/part 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: Wed, 08 Jul 2009 05:56:15 -0000 Author: marcel Date: Wed Jul 8 05:56:14 2009 New Revision: 195436 URL: http://svn.freebsd.org/changeset/base/195436 Log: Revert revisions 188839 and 188868. Use of the ioctl in geom_dev.c is invalid because the ioctl happens without prior open. The ioctl got introduced to provide backward compatibility for extended partitions, but it ended up not being used because it didn't work as expected. Since there are no consumers of the ioctl and the implementation is broken, the best fix is to remove the code entirely. Spotted by: phk Approved by: re (kensmith) Modified: head/sys/dev/ata/atapi-cd.c head/sys/geom/geom_dev.c head/sys/geom/part/g_part.c head/sys/geom/part/g_part_if.m head/sys/sys/disk.h Modified: head/sys/dev/ata/atapi-cd.c ============================================================================== --- head/sys/dev/ata/atapi-cd.c Wed Jul 8 02:31:35 2009 (r195435) +++ head/sys/dev/ata/atapi-cd.c Wed Jul 8 05:56:14 2009 (r195436) @@ -219,10 +219,7 @@ acd_geom_ioctl(struct g_provider *pp, u_ case CDIOCRESET: acd_test_ready(dev); break; - - case DIOCGPROVIDERALIAS: - break; - + default: acd_read_toc(dev); acd_prevent_allow(dev, 1); Modified: head/sys/geom/geom_dev.c ============================================================================== --- head/sys/geom/geom_dev.c Wed Jul 8 02:31:35 2009 (r195435) +++ head/sys/geom/geom_dev.c Wed Jul 8 05:56:14 2009 (r195436) @@ -113,7 +113,6 @@ g_dev_taste(struct g_class *mp, struct g { struct g_geom *gp; struct g_consumer *cp; - char *alias; int error; struct cdev *dev; @@ -135,17 +134,6 @@ g_dev_taste(struct g_class *mp, struct g gp->softc = dev; dev->si_drv1 = gp; dev->si_drv2 = cp; - - g_topology_unlock(); - - alias = g_malloc(MAXPATHLEN, M_WAITOK | M_ZERO); - error = (pp->geom->ioctl == NULL) ? ENODEV : - pp->geom->ioctl(pp, DIOCGPROVIDERALIAS, alias, 0, curthread); - if (!error && alias[0] != '\0') - make_dev_alias(dev, "%s", alias); - g_free(alias); - - g_topology_lock(); return (gp); } Modified: head/sys/geom/part/g_part.c ============================================================================== --- head/sys/geom/part/g_part.c Wed Jul 8 02:31:35 2009 (r195435) +++ head/sys/geom/part/g_part.c Wed Jul 8 05:56:14 2009 (r195436) @@ -29,7 +29,6 @@ __FBSDID("$FreeBSD$"); #include #include -#include #include #include #include @@ -92,7 +91,6 @@ static g_taste_t g_part_taste; static g_access_t g_part_access; static g_dumpconf_t g_part_dumpconf; -static g_ioctl_t g_part_ioctl; static g_orphan_t g_part_orphan; static g_spoiled_t g_part_spoiled; static g_start_t g_part_start; @@ -109,7 +107,6 @@ static struct g_class g_part_class = { /* Geom methods. */ .access = g_part_access, .dumpconf = g_part_dumpconf, - .ioctl = g_part_ioctl, .orphan = g_part_orphan, .spoiled = g_part_spoiled, .start = g_part_start, @@ -1611,31 +1608,6 @@ g_part_dumpconf(struct sbuf *sb, const c } } -static int -g_part_ioctl(struct g_provider *pp, u_long cmd, void *data, int fflag, - struct thread *td) -{ - struct g_geom *gp; - struct g_part_table *table; - struct g_part_entry *entry; - int error; - - gp = pp->geom; - table = gp->softc; - entry = pp->private; - - switch (cmd) { - case DIOCGPROVIDERALIAS: - error = G_PART_DEVALIAS(table, entry, data, MAXPATHLEN); - break; - default: - error = ENOTTY; - break; - } - - return (error); -} - static void g_part_orphan(struct g_consumer *cp) { Modified: head/sys/geom/part/g_part_if.m ============================================================================== --- head/sys/geom/part/g_part_if.m Wed Jul 8 02:31:35 2009 (r195435) +++ head/sys/geom/part/g_part_if.m Wed Jul 8 05:56:14 2009 (r195436) @@ -85,15 +85,6 @@ METHOD int destroy { struct g_part_parms *gpp; }; -# devalias() - return the name (if any) to be used as an alias for -# the device special file created for the partition entry. -METHOD int devalias { - struct g_part_table *table; - struct g_part_entry *entry; - char *buf; - size_t bufsz; -}; - # dumpconf() METHOD void dumpconf { struct g_part_table *table; Modified: head/sys/sys/disk.h ============================================================================== --- head/sys/sys/disk.h Wed Jul 8 02:31:35 2009 (r195435) +++ head/sys/sys/disk.h Wed Jul 8 05:56:14 2009 (r195436) @@ -104,10 +104,4 @@ void disk_err(struct bio *bp, const char * must be at least MAXPATHLEN bytes long. */ -#define DIOCGPROVIDERALIAS _IOR('d', 139, char[MAXPATHLEN]) - /*- - * Store the provider alias, if present, in a buffer. The buffer must - * be at least MAXPATHLEN bytes long. - */ - #endif /* _SYS_DISK_H_ */ From owner-svn-src-head@FreeBSD.ORG Wed Jul 8 06:00:21 2009 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 88282106564A; Wed, 8 Jul 2009 06:00:21 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 7686A8FC1B; Wed, 8 Jul 2009 06:00:21 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n6860L1r040263; Wed, 8 Jul 2009 06:00:21 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n6860L9D040261; Wed, 8 Jul 2009 06:00:21 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <200907080600.n6860L9D040261@svn.freebsd.org> From: Alexander Motin Date: Wed, 8 Jul 2009 06:00:21 +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: r195439 - head/sys/dev/ata/chipsets 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, 08 Jul 2009 06:00:21 -0000 Author: mav Date: Wed Jul 8 06:00:21 2009 New Revision: 195439 URL: http://svn.freebsd.org/changeset/base/195439 Log: Fix kernel panic, when ataahci driver is used on system with increased MAXPHYS. Current ataahci driver memory allocation scheme includes only 64 items in DMA S/G table, and so not guarantied to support transactions with more then 252K data. Approved by: re (kensmith) MFC after: 2 weeks Modified: head/sys/dev/ata/chipsets/ata-ahci.c Modified: head/sys/dev/ata/chipsets/ata-ahci.c ============================================================================== --- head/sys/dev/ata/chipsets/ata-ahci.c Wed Jul 8 06:00:18 2009 (r195438) +++ head/sys/dev/ata/chipsets/ata-ahci.c Wed Jul 8 06:00:21 2009 (r195439) @@ -914,7 +914,7 @@ ata_ahci_dmainit(device_t dev) ata_dmainit(dev); /* note start and stop are not used here */ ch->dma.setprd = ata_ahci_dmasetprd; - ch->dma.max_iosize = 8192 * DEV_BSIZE; + ch->dma.max_iosize = (ATA_AHCI_DMA_ENTRIES - 1) * PAGE_SIZE; if (ATA_INL(ctlr->r_res2, ATA_AHCI_CAP) & ATA_AHCI_CAP_64BIT) ch->dma.max_address = BUS_SPACE_MAXADDR; } From owner-svn-src-head@FreeBSD.ORG Wed Jul 8 06:07:23 2009 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 9FF88106566C; Wed, 8 Jul 2009 06:07:23 +0000 (UTC) (envelope-from cperciva@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 8D6F68FC22; Wed, 8 Jul 2009 06:07:23 +0000 (UTC) (envelope-from cperciva@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n6867NGl040469; Wed, 8 Jul 2009 06:07:23 GMT (envelope-from cperciva@svn.freebsd.org) Received: (from cperciva@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n6867NqU040467; Wed, 8 Jul 2009 06:07:23 GMT (envelope-from cperciva@svn.freebsd.org) Message-Id: <200907080607.n6867NqU040467@svn.freebsd.org> From: Colin Percival Date: Wed, 8 Jul 2009 06:07: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: r195441 - 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, 08 Jul 2009 06:07:24 -0000 Author: cperciva Date: Wed Jul 8 06:07:23 2009 New Revision: 195441 URL: http://svn.freebsd.org/changeset/base/195441 Log: Refactor code from installFixitCDROM into a new function, fixit_livefs_common. While doing so, improve style and reword some comments. This should not result in any functional changes, but the fixit_livefs_common function will be used by future code. Submitted by: randi Approved by: re (kensmith) Modified: head/usr.sbin/sysinstall/install.c Modified: head/usr.sbin/sysinstall/install.c ============================================================================== --- head/usr.sbin/sysinstall/install.c Wed Jul 8 06:01:37 2009 (r195440) +++ head/usr.sbin/sysinstall/install.c Wed Jul 8 06:07:23 2009 (r195441) @@ -65,6 +65,7 @@ int NCpus; static void create_termcap(void); static void fixit_common(void); +int fixit_livefs_common(dialogMenuItem *self); #define TERMCAP_FILE "/usr/share/misc/termcap" @@ -336,9 +337,6 @@ installFixitCDROM(dialogMenuItem *self) return DITEM_SUCCESS; variable_set2(SYSTEM_STATE, "fixit", 0); - (void)unlink("/mnt2"); - (void)rmdir("/mnt2"); - need_eject = 0; CDROMInitQuiet = 1; while (1) { @@ -363,53 +361,9 @@ installFixitCDROM(dialogMenuItem *self) } CDROMInitQuiet = 0; - /* Since the fixit code expects everything to be in /mnt2, and the CDROM mounting stuff /dist, do - * a little kludge dance here.. - */ - if (symlink("/dist", "/mnt2")) { - msgConfirm("Unable to symlink /mnt2 to the disc mount point. Please report this\n" - "unexpected failure to freebsd-bugs@FreeBSD.org."); - return DITEM_FAILURE; - } - - /* - * If /tmp points to /mnt2/tmp from a previous fixit floppy session, it's - * not very good for us if we point it to the CDROM now. Rather make it - * a directory in the root MFS then. Experienced admins will still be - * able to mount their disk's /tmp over this if they need. - */ - if (lstat("/tmp", &sb) == 0 && (sb.st_mode & S_IFMT) == S_IFLNK) - (void)unlink("/tmp"); - Mkdir("/tmp"); - - /* - * Since setuid binaries ignore LD_LIBRARY_PATH, we indeed need the - * ld.so.hints file. Fortunately, it's fairly small (~ 3 KB). - */ - if (!file_readable("/var/run/ld.so.hints")) { - Mkdir("/var/run"); - if (vsystem("/mnt2/rescue/ldconfig -s /mnt2/lib /mnt2/usr/lib")) { - msgConfirm("Warning: ldconfig could not create the ld.so hints file.\n" - "Dynamic executables from the disc likely won't work."); - } - } + if (DITEM_STATUS(fixit_livefs_common(self)) == DITEM_FAILURE) + return (DITEM_FAILURE); - /* Yet more iggly hardcoded pathnames. */ - Mkdir("/libexec"); - if (!file_readable("/libexec/ld.so") && file_readable("/mnt2/libexec/ld.so")) { - if (symlink("/mnt2/libexec/ld.so", "/libexec/ld.so")) - msgDebug("Couldn't link to ld.so - not necessarily a problem for ELF\n"); - } - if (!file_readable("/libexec/ld-elf.so.1")) { - if (symlink("/mnt2/libexec/ld-elf.so.1", "/libexec/ld-elf.so.1")) { - msgConfirm("Warning: could not create the symlink for ld-elf.so.1\n" - "Dynamic executables from the disc likely won't work."); - } - } - /* optional nicety */ - if (!file_readable("/usr/bin/vi")) - symlink("/mnt2/usr/bin/vi", "/usr/bin/vi"); - fixit_common(); mediaClose(); if (need_eject) msgConfirm("Please remove the FreeBSD fixit CDROM/DVD now."); @@ -552,6 +506,73 @@ fixit_common(void) dialog_clear(); } +/* + * Some path/lib setup is required for the livefs fixit image. Since there's + * more than one media type for livefs now, this has been broken off into it's + * own function. + */ +int +fixit_livefs_common(dialogMenuItem *self) +{ + struct stat sb; + + /* + * USB and CDROM media get mounted to /dist, but fixit code looks in + * /mnt2. + */ + unlink("/mnt2"); + rmdir("/mnt2"); + + if (symlink("/dist", "/mnt2")) { + msgConfirm("Unable to symlink /mnt2 to the disc mount point."); + return (DITEM_FAILURE); + } + + /* + * If /tmp points to /mnt2/tmp from a previous fixit floppy session, + * recreate it. + */ + if (lstat("/tmp", &sb) == 0 && (sb.st_mode & S_IFMT) == S_IFLNK) + unlink("/tmp"); + Mkdir("/tmp"); + + /* Generate a new ld.so.hints */ + if (!file_readable("/var/run/ld.so.hints")) { + Mkdir("/var/run"); + if (vsystem("/mnt2/rescue/ldconfig -s /mnt2/lib " + "/mnt2/usr/lib")) { + msgConfirm("Warning: ldconfig could not create the " + "ld.so hints file.\nDynamic executables from the " + "disc likely won't work."); + } + } + + /* Create required libexec symlinks. */ + Mkdir("/libexec"); + if (!file_readable("/libexec/ld.so") && + file_readable("/mnt2/libexec/ld.so")) { + if (symlink("/mnt2/libexec/ld.so", "/libexec/ld.so")) + msgDebug("Couldn't link to ld.so\n"); + } + + if (!file_readable("/libexec/ld-elf.so.1")) { + if (symlink("/mnt2/libexec/ld-elf.so.1", + "/libexec/ld-elf.so.1")) { + msgConfirm("Warning: could not create the symlink for " + "ld-elf.so.1\nDynamic executables from the disc " + "likely won't work."); + } + } + + /* $PATH doesn't include /mnt2 by default. Create convenient symlink. */ + if (!file_readable("/usr/bin/vi")) + symlink("/mnt2/usr/bin/vi", "/usr/bin/vi"); + + /* Shared code used by all fixit types. */ + fixit_common(); + + return (DITEM_SUCCESS); +} int installExpress(dialogMenuItem *self) From owner-svn-src-head@FreeBSD.ORG Wed Jul 8 06:07:51 2009 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 CBEF91065680; Wed, 8 Jul 2009 06:07:51 +0000 (UTC) (envelope-from cperciva@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B96D18FC24; Wed, 8 Jul 2009 06:07:51 +0000 (UTC) (envelope-from cperciva@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n6867phm040514; Wed, 8 Jul 2009 06:07:51 GMT (envelope-from cperciva@svn.freebsd.org) Received: (from cperciva@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n6867pZ6040509; Wed, 8 Jul 2009 06:07:51 GMT (envelope-from cperciva@svn.freebsd.org) Message-Id: <200907080607.n6867pZ6040509@svn.freebsd.org> From: Colin Percival Date: Wed, 8 Jul 2009 06:07:51 +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: r195442 - 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, 08 Jul 2009 06:07:52 -0000 Author: cperciva Date: Wed Jul 8 06:07:51 2009 New Revision: 195442 URL: http://svn.freebsd.org/changeset/base/195442 Log: Add support for using a livefs from a USB disk. Submitted by: randi Approved by: re (kensmith) Modified: head/usr.sbin/sysinstall/dispatch.c head/usr.sbin/sysinstall/install.c head/usr.sbin/sysinstall/menus.c head/usr.sbin/sysinstall/sysinstall.h Modified: head/usr.sbin/sysinstall/dispatch.c ============================================================================== --- head/usr.sbin/sysinstall/dispatch.c Wed Jul 8 06:07:23 2009 (r195441) +++ head/usr.sbin/sysinstall/dispatch.c Wed Jul 8 06:07:51 2009 (r195442) @@ -86,6 +86,7 @@ static struct _word { { "installFixupBase", installFixupBase }, { "installFixitHoloShell", installFixitHoloShell }, { "installFixitCDROM", installFixitCDROM }, + { "installFixitUSB", installFixitUSB }, { "installFixitFloppy", installFixitFloppy }, { "installFilesystems", installFilesystems }, { "installVarDefaults", installVarDefaults }, Modified: head/usr.sbin/sysinstall/install.c ============================================================================== --- head/usr.sbin/sysinstall/install.c Wed Jul 8 06:07:23 2009 (r195441) +++ head/usr.sbin/sysinstall/install.c Wed Jul 8 06:07:51 2009 (r195442) @@ -327,6 +327,33 @@ installFixitHoloShell(dialogMenuItem *se return DITEM_SUCCESS; } +/* + * Load the live filesystem from USB media. + */ +int +installFixitUSB(dialogMenuItem *self) +{ + if (!RunningAsInit) + return (DITEM_SUCCESS); + + variable_set2(SYSTEM_STATE, "fixit", 0); + + if (DITEM_STATUS(mediaSetUSB(NULL)) != DITEM_SUCCESS || + !DEVICE_INIT(mediaDevice)) { + msgConfirm("No USB devices found!"); + return (DITEM_FAILURE); + } else if (!file_readable("/dist/rescue/ldconfig")) { + msgConfirm("Unable to find a FreeBSD live filesystem."); + return (DITEM_FAILURE); + } + + if (DITEM_STATUS(fixit_livefs_common(self)) == DITEM_FAILURE) + return (DITEM_FAILURE); + + mediaClose(); + return (DITEM_SUCCESS); +} + int installFixitCDROM(dialogMenuItem *self) { Modified: head/usr.sbin/sysinstall/menus.c ============================================================================== --- head/usr.sbin/sysinstall/menus.c Wed Jul 8 06:07:23 2009 (r195441) +++ head/usr.sbin/sysinstall/menus.c Wed Jul 8 06:07:51 2009 (r195442) @@ -2173,8 +2173,9 @@ DMenu MenuFixit = { "Press F1 for more detailed repair instructions", "fixit", { { "X Exit", "Exit this menu (returning to previous)", NULL, dmenuExit }, - { "2 CDROM/DVD", "Use the \"live\" filesystem CDROM/DVD", NULL, installFixitCDROM }, - { "3 Floppy", "Use a floppy generated from the fixit image", NULL, installFixitFloppy }, - { "4 Shell", "Start an Emergency Holographic Shell", NULL, installFixitHoloShell }, + { "2 CDROM/DVD", "Use the live filesystem CDROM/DVD", NULL, installFixitCDROM }, + { "3 USB", "Use the live filesystem from a USB drive", NULL, installFixitUSB }, + { "4 Floppy", "Use a floppy generated from the fixit image", NULL, installFixitFloppy }, + { "5 Shell", "Start an Emergency Holographic Shell", NULL, installFixitHoloShell }, { NULL } }, }; Modified: head/usr.sbin/sysinstall/sysinstall.h ============================================================================== --- head/usr.sbin/sysinstall/sysinstall.h Wed Jul 8 06:07:23 2009 (r195441) +++ head/usr.sbin/sysinstall/sysinstall.h Wed Jul 8 06:07:51 2009 (r195442) @@ -680,6 +680,7 @@ extern int installExpress(dialogMenuItem extern int installStandard(dialogMenuItem *self); extern int installFixitHoloShell(dialogMenuItem *self); extern int installFixitCDROM(dialogMenuItem *self); +extern int installFixitUSB(dialogMenuItem *self); extern int installFixitFloppy(dialogMenuItem *self); extern int installFixupBase(dialogMenuItem *self); extern int installFixupKernel(dialogMenuItem *self, int dists); From owner-svn-src-head@FreeBSD.ORG Wed Jul 8 08:16:30 2009 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 9F9871065670; Wed, 8 Jul 2009 08:16:30 +0000 (UTC) (envelope-from phk@critter.freebsd.dk) Received: from phk.freebsd.dk (phk.freebsd.dk [130.225.244.222]) by mx1.freebsd.org (Postfix) with ESMTP id 629F28FC1E; Wed, 8 Jul 2009 08:16:30 +0000 (UTC) (envelope-from phk@critter.freebsd.dk) Received: from critter.freebsd.dk (unknown [192.168.64.3]) by phk.freebsd.dk (Postfix) with ESMTP id 052F369959; Wed, 8 Jul 2009 07:58:20 +0000 (UTC) Received: from critter.freebsd.dk (localhost [127.0.0.1]) by critter.freebsd.dk (8.14.3/8.14.3) with ESMTP id n687wKut092654; Wed, 8 Jul 2009 07:58:20 GMT (envelope-from phk@critter.freebsd.dk) To: Marcel Moolenaar From: "Poul-Henning Kamp" In-Reply-To: Your message of "Wed, 08 Jul 2009 05:56:14 GMT." <200907080556.n685uFsn040044@svn.freebsd.org> Date: Wed, 08 Jul 2009 07:58:20 +0000 Message-ID: <92653.1247039900@critter.freebsd.dk> Sender: phk@critter.freebsd.dk Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org Subject: Re: svn commit: r195436 - in head/sys: dev/ata geom geom/part 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: Wed, 08 Jul 2009 08:16:31 -0000 In message <200907080556.n685uFsn040044@svn.freebsd.org>, Marcel Moolenaar writ es: >Log: > Revert revisions 188839 and 188868. Use of the ioctl in geom_dev.c > is invalid because the ioctl happens without prior open. The ioctl > got introduced to provide backward compatibility for extended > partitions, but it ended up not being used because it didn't work > as expected. Since there are no consumers of the ioctl and the > implementation is broken, the best fix is to remove the code > entirely. > > Spotted by: phk For the record Really spotted by: scottl -- Poul-Henning Kamp | UNIX since Zilog Zeus 3.20 phk@FreeBSD.ORG | TCP/IP since RFC 956 FreeBSD committer | BSD since 4.3-tahoe Never attribute to malice what can adequately be explained by incompetence. From owner-svn-src-head@FreeBSD.ORG Wed Jul 8 10:16:17 2009 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 2475C106564A; Wed, 8 Jul 2009 10:16:17 +0000 (UTC) (envelope-from brian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id ECA108FC1A; Wed, 8 Jul 2009 10:16:16 +0000 (UTC) (envelope-from brian@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n68AGGHc045459; Wed, 8 Jul 2009 10:16:16 GMT (envelope-from brian@svn.freebsd.org) Received: (from brian@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n68AGGH7045455; Wed, 8 Jul 2009 10:16:16 GMT (envelope-from brian@svn.freebsd.org) Message-Id: <200907081016.n68AGGH7045455@svn.freebsd.org> From: Brian Somers Date: Wed, 8 Jul 2009 10:16: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: r195443 - in head: tools/regression/usr.bin/jot usr.bin/jot 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, 08 Jul 2009 10:16:17 -0000 Author: brian Date: Wed Jul 8 10:16:16 2009 New Revision: 195443 URL: http://svn.freebsd.org/changeset/base/195443 Log: Fix some uninitialise variables. PR: 136383 Submitted by: Ulrich Spoerlein - uqs at spoerlein dot net Approved by: re (kib) MFC after: 3 weeks Added: head/tools/regression/usr.bin/jot/regress.dddd.out (contents, props changed) Modified: head/tools/regression/usr.bin/jot/regress.sh head/usr.bin/jot/jot.c Added: head/tools/regression/usr.bin/jot/regress.dddd.out ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tools/regression/usr.bin/jot/regress.dddd.out Wed Jul 8 10:16:16 2009 (r195443) @@ -0,0 +1,100 @@ +1 +2 +3 +4 +5 +6 +7 +8 +9 +10 +11 +12 +13 +14 +15 +16 +17 +18 +19 +20 +21 +22 +23 +24 +25 +26 +27 +28 +29 +30 +31 +32 +33 +34 +35 +36 +37 +38 +39 +40 +41 +42 +43 +44 +45 +46 +47 +48 +49 +50 +51 +52 +53 +54 +55 +56 +57 +58 +59 +60 +61 +62 +63 +64 +65 +66 +67 +68 +69 +70 +71 +72 +73 +74 +75 +76 +77 +78 +79 +80 +81 +82 +83 +84 +85 +86 +87 +88 +89 +90 +91 +92 +93 +94 +95 +96 +97 +98 +99 +100 Modified: head/tools/regression/usr.bin/jot/regress.sh ============================================================================== --- head/tools/regression/usr.bin/jot/regress.sh Wed Jul 8 06:07:51 2009 (r195442) +++ head/tools/regression/usr.bin/jot/regress.sh Wed Jul 8 10:16:16 2009 (r195443) @@ -1,6 +1,6 @@ # $FreeBSD$ -echo 1..56 +echo 1..57 REGRESSION_START($1) @@ -20,6 +20,7 @@ REGRESSION_TEST(`dhdd', `jot - 20 - -') REGRESSION_TEST(`ddhh', `jot - - 120 2') REGRESSION_TEST(`ddhd', `jot - - 120 -') REGRESSION_TEST(`dddh', `jot - - - 2') +REGRESSION_TEST(`dddd', `jot - - - -') REGRESSION_TEST(`hhhh2', `jot 30 20 160 2') REGRESSION_TEST(`hhhd2', `jot 30 20 160 -') REGRESSION_TEST(`hhdh2', `jot 30 20 - 2') Modified: head/usr.bin/jot/jot.c ============================================================================== --- head/usr.bin/jot/jot.c Wed Jul 8 06:07:51 2009 (r195442) +++ head/usr.bin/jot/jot.c Wed Jul 8 10:16:16 2009 (r195443) @@ -101,13 +101,13 @@ main(int argc, char **argv) int ch; int mask = 0; int n = 0; - double begin; + double begin = BEGIN_DEF; double divisor; - double ender; - double s; + double ender = ENDER_DEF; + double s = STEP_DEF; double x, y; long i; - long reps; + long reps = REPS_DEF; while ((ch = getopt(argc, argv, "b:cnp:rs:w:")) != -1) switch (ch) { From owner-svn-src-head@FreeBSD.ORG Wed Jul 8 10:21:53 2009 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 444D6106566C; Wed, 8 Jul 2009 10:21:53 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 196BE8FC15; Wed, 8 Jul 2009 10:21:53 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n68ALqbp045653; Wed, 8 Jul 2009 10:21:52 GMT (envelope-from ed@svn.freebsd.org) Received: (from ed@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n68ALqsa045650; Wed, 8 Jul 2009 10:21:52 GMT (envelope-from ed@svn.freebsd.org) Message-Id: <200907081021.n68ALqsa045650@svn.freebsd.org> From: Ed Schouten Date: Wed, 8 Jul 2009 10: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: r195444 - 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, 08 Jul 2009 10:21:53 -0000 Author: ed Date: Wed Jul 8 10:21:52 2009 New Revision: 195444 URL: http://svn.freebsd.org/changeset/base/195444 Log: Fix regressions in return events of poll() on TTYs. As pointed out, POLLHUP should be generated, even if it hasn't been specified on input. It is also not allowed to return both POLLOUT and POLLHUP at the same time. Reported by: jilles Approved by: re (kib) Modified: head/sys/kern/tty.c head/sys/kern/tty_pts.c Modified: head/sys/kern/tty.c ============================================================================== --- head/sys/kern/tty.c Wed Jul 8 10:16:16 2009 (r195443) +++ head/sys/kern/tty.c Wed Jul 8 10:21:52 2009 (r195444) @@ -536,25 +536,23 @@ ttydev_poll(struct cdev *dev, int events int error, revents = 0; error = ttydev_enter(tp); - if (error) { - /* Don't return the error here, but the event mask. */ - return (events & - (POLLHUP|POLLIN|POLLRDNORM|POLLOUT|POLLWRNORM)); - } + if (error) + return ((events & (POLLIN|POLLRDNORM)) | POLLHUP); if (events & (POLLIN|POLLRDNORM)) { /* See if we can read something. */ if (ttydisc_read_poll(tp) > 0) revents |= events & (POLLIN|POLLRDNORM); } - if (events & (POLLOUT|POLLWRNORM)) { + + if (tp->t_flags & TF_ZOMBIE) { + /* Hangup flag on zombie state. */ + revents |= POLLHUP; + } else if (events & (POLLOUT|POLLWRNORM)) { /* See if we can write something. */ if (ttydisc_write_poll(tp) > 0) revents |= events & (POLLOUT|POLLWRNORM); } - if (tp->t_flags & TF_ZOMBIE) - /* Hangup flag on zombie state. */ - revents |= events & POLLHUP; if (revents == 0) { if (events & (POLLIN|POLLRDNORM)) Modified: head/sys/kern/tty_pts.c ============================================================================== --- head/sys/kern/tty_pts.c Wed Jul 8 10:16:16 2009 (r195443) +++ head/sys/kern/tty_pts.c Wed Jul 8 10:21:52 2009 (r195444) @@ -409,8 +409,7 @@ ptsdev_poll(struct file *fp, int events, if (psc->pts_flags & PTS_FINISHED) { /* Slave device is not opened. */ tty_unlock(tp); - return (events & - (POLLHUP|POLLIN|POLLRDNORM|POLLOUT|POLLWRNORM)); + return ((events & (POLLIN|POLLRDNORM)) | POLLHUP); } if (events & (POLLIN|POLLRDNORM)) { From owner-svn-src-head@FreeBSD.ORG Wed Jul 8 15:23:19 2009 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 26F58106566C; Wed, 8 Jul 2009 15:23:19 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 116D08FC1C; Wed, 8 Jul 2009 15:23:19 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n68FNIXJ055048; Wed, 8 Jul 2009 15:23:18 GMT (envelope-from trasz@svn.freebsd.org) Received: (from trasz@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n68FNIpi055036; Wed, 8 Jul 2009 15:23:18 GMT (envelope-from trasz@svn.freebsd.org) Message-Id: <200907081523.n68FNIpi055036@svn.freebsd.org> From: Edward Tomasz Napierala Date: Wed, 8 Jul 2009 15:23: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: r195458 - in head: include lib/libc/sys sys/bsm sys/compat/freebsd32 sys/compat/svr4 sys/i386/ibcs2 sys/kern 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: Wed, 08 Jul 2009 15:23:19 -0000 Author: trasz Date: Wed Jul 8 15:23:18 2009 New Revision: 195458 URL: http://svn.freebsd.org/changeset/base/195458 Log: There is an optimization in chmod(1), that makes it not to call chmod(2) if the new file mode is the same as it was before; however, this optimization must be disabled for filesystems that support NFSv4 ACLs. Chmod uses pathconf(2) to determine whether this is the case - however, pathconf(2) always follows symbolic links, while the 'chmod -h' doesn't. This change adds lpathconf(3) to make it possible to solve that problem in a clean way. Reviewed by: rwatson (earlier version) Approved by: re (kib) Modified: head/include/unistd.h head/lib/libc/sys/Makefile.inc head/lib/libc/sys/Symbol.map head/lib/libc/sys/pathconf.2 head/sys/bsm/audit_kevents.h head/sys/compat/freebsd32/syscalls.master head/sys/compat/svr4/svr4_stat.c head/sys/i386/ibcs2/ibcs2_misc.c head/sys/kern/syscalls.master head/sys/kern/vfs_syscalls.c head/sys/sys/syscallsubr.h Modified: head/include/unistd.h ============================================================================== --- head/include/unistd.h Wed Jul 8 15:02:56 2009 (r195457) +++ head/include/unistd.h Wed Jul 8 15:23:18 2009 (r195458) @@ -513,6 +513,7 @@ int initgroups(const char *, gid_t); int iruserok(unsigned long, int, const char *, const char *); int iruserok_sa(const void *, int, int, const char *, const char *); int issetugid(void); +long lpathconf(const char *, int); #ifndef _MKDTEMP_DECLARED char *mkdtemp(char *); #define _MKDTEMP_DECLARED Modified: head/lib/libc/sys/Makefile.inc ============================================================================== --- head/lib/libc/sys/Makefile.inc Wed Jul 8 15:02:56 2009 (r195457) +++ head/lib/libc/sys/Makefile.inc Wed Jul 8 15:23:18 2009 (r195458) @@ -159,6 +159,7 @@ MLINKS+=mq_send.2 mq_timedsend.2 MLINKS+=ntp_adjtime.2 ntp_gettime.2 MLINKS+=open.2 openat.2 MLINKS+=pathconf.2 fpathconf.2 +MLINKS+=pathconf.2 lpathconf.2 MLINKS+=read.2 pread.2 read.2 preadv.2 read.2 readv.2 MLINKS+=readlink.2 readlinkat.2 MLINKS+=recv.2 recvfrom.2 recv.2 recvmsg.2 Modified: head/lib/libc/sys/Symbol.map ============================================================================== --- head/lib/libc/sys/Symbol.map Wed Jul 8 15:02:56 2009 (r195457) +++ head/lib/libc/sys/Symbol.map Wed Jul 8 15:23:18 2009 (r195458) @@ -346,6 +346,7 @@ FBSD_1.1 { jail_set; jail_remove; linkat; + lpathconf; mkdirat; mkfifoat; mknodat; Modified: head/lib/libc/sys/pathconf.2 ============================================================================== --- head/lib/libc/sys/pathconf.2 Wed Jul 8 15:02:56 2009 (r195457) +++ head/lib/libc/sys/pathconf.2 Wed Jul 8 15:23:18 2009 (r195458) @@ -28,11 +28,12 @@ .\" @(#)pathconf.2 8.1 (Berkeley) 6/4/93 .\" $FreeBSD$ .\" -.Dd June 25, 2009 +.Dd July 7, 2009 .Dt PATHCONF 2 .Os .Sh NAME .Nm pathconf , +.Nm lpathconf , .Nm fpathconf .Nd get configurable pathname variables .Sh LIBRARY @@ -42,10 +43,13 @@ .Ft long .Fn pathconf "const char *path" "int name" .Ft long +.Fn lpathconf "const char *path" "int name" +.Ft long .Fn fpathconf "int fd" "int name" .Sh DESCRIPTION The -.Fn pathconf +.Fn pathconf , +.Fn lpathconf and .Fn fpathconf system calls provide a method for applications to determine the current @@ -53,7 +57,9 @@ value of a configurable system limit or with a pathname or file descriptor. .Pp For -.Fn pathconf , +.Fn pathconf +and +.Fn lpathconf , the .Fa path argument is the name of a file or directory. @@ -68,6 +74,18 @@ argument specifies the system variable t Symbolic constants for each name value are found in the include file .Li . .Pp +The +.Fn lpathconf +system call is like +.Fn pathconf +except in the case where the named file is a symbolic link, +in which case +.Fn lpathconf +returns information about the link, +while +.Fn pathconf +returns information about the file the link references. +.Pp The available values are as follows: .Pp .Bl -tag -width 6n @@ -239,3 +257,7 @@ and .Fn fpathconf system calls first appeared in .Bx 4.4 . +The +.Fn lpathconf +system call first appeared in +.Fx 8.0 . Modified: head/sys/bsm/audit_kevents.h ============================================================================== --- head/sys/bsm/audit_kevents.h Wed Jul 8 15:02:56 2009 (r195457) +++ head/sys/bsm/audit_kevents.h Wed Jul 8 15:23:18 2009 (r195458) @@ -597,6 +597,7 @@ #define AUE_PWRITE 43193 /* Darwin/FreeBSD. */ #define AUE_FSCTL 43194 /* Darwin. */ #define AUE_FFSCTL 43195 /* Darwin. */ +#define AUE_LPATHCONF 43196 /* FreeBSD. */ /* * Darwin BSM uses a number of AUE_O_* definitions, which are aliased to the Modified: head/sys/compat/freebsd32/syscalls.master ============================================================================== --- head/sys/compat/freebsd32/syscalls.master Wed Jul 8 15:02:56 2009 (r195457) +++ head/sys/compat/freebsd32/syscalls.master Wed Jul 8 15:23:18 2009 (r195458) @@ -900,3 +900,4 @@ struct msqid_ds32 *buf); } 512 AUE_SHMCTL STD { int freebsd32_shmctl(int shmid, int cmd, \ struct shmid_ds32 *buf); } +513 AUE_LPATHCONF STD { int lpathconf(char *path, int name); } Modified: head/sys/compat/svr4/svr4_stat.c ============================================================================== --- head/sys/compat/svr4/svr4_stat.c Wed Jul 8 15:02:56 2009 (r195457) +++ head/sys/compat/svr4/svr4_stat.c Wed Jul 8 15:23:18 2009 (r195458) @@ -37,6 +37,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -669,7 +670,7 @@ svr4_sys_pathconf(td, uap) return (0); default: CHECKALTEXIST(td, uap->path, &path); - error = kern_pathconf(td, path, UIO_SYSSPACE, name); + error = kern_pathconf(td, path, UIO_SYSSPACE, name, FOLLOW); free(path, M_TEMP); return (error); } Modified: head/sys/i386/ibcs2/ibcs2_misc.c ============================================================================== --- head/sys/i386/ibcs2/ibcs2_misc.c Wed Jul 8 15:02:56 2009 (r195457) +++ head/sys/i386/ibcs2/ibcs2_misc.c Wed Jul 8 15:23:18 2009 (r195458) @@ -66,6 +66,7 @@ __FBSDID("$FreeBSD$"); #include #include /* Must come after sys/malloc.h */ #include +#include #include #include #include @@ -763,7 +764,7 @@ ibcs2_pathconf(td, uap) CHECKALTEXIST(td, uap->path, &path); uap->name++; /* iBCS2 _PC_* defines are offset by one */ - error = kern_pathconf(td, path, UIO_SYSSPACE, uap->name); + error = kern_pathconf(td, path, UIO_SYSSPACE, uap->name, FOLLOW); free(path, M_TEMP); return (error); } Modified: head/sys/kern/syscalls.master ============================================================================== --- head/sys/kern/syscalls.master Wed Jul 8 15:02:56 2009 (r195457) +++ head/sys/kern/syscalls.master Wed Jul 8 15:23:18 2009 (r195458) @@ -910,5 +910,6 @@ struct msqid_ds *buf); } 512 AUE_SHMCTL NOSTD { int shmctl(int shmid, int cmd, \ struct shmid_ds *buf); } +513 AUE_LPATHCONF STD { int lpathconf(char *path, int name); } ; Please copy any additions and changes to the following compatability tables: ; sys/compat/freebsd32/syscalls.master Modified: head/sys/kern/vfs_syscalls.c ============================================================================== --- head/sys/kern/vfs_syscalls.c Wed Jul 8 15:02:56 2009 (r195457) +++ head/sys/kern/vfs_syscalls.c Wed Jul 8 15:23:18 2009 (r195458) @@ -2506,17 +2506,36 @@ pathconf(td, uap) } */ *uap; { - return (kern_pathconf(td, uap->path, UIO_USERSPACE, uap->name)); + return (kern_pathconf(td, uap->path, UIO_USERSPACE, uap->name, FOLLOW)); +} + +#ifndef _SYS_SYSPROTO_H_ +struct lpathconf_args { + char *path; + int name; +}; +#endif +int +lpathconf(td, uap) + struct thread *td; + register struct lpathconf_args /* { + char *path; + int name; + } */ *uap; +{ + + return (kern_pathconf(td, uap->path, UIO_USERSPACE, uap->name, NOFOLLOW)); } int -kern_pathconf(struct thread *td, char *path, enum uio_seg pathseg, int name) +kern_pathconf(struct thread *td, char *path, enum uio_seg pathseg, int name, + u_long flags) { struct nameidata nd; int error, vfslocked; - NDINIT(&nd, LOOKUP, FOLLOW | LOCKSHARED | LOCKLEAF | MPSAFE | - AUDITVNODE1, pathseg, path, td); + NDINIT(&nd, LOOKUP, LOCKSHARED | LOCKLEAF | MPSAFE | AUDITVNODE1 | + flags, pathseg, path, td); if ((error = namei(&nd)) != 0) return (error); vfslocked = NDHASGIANT(&nd); Modified: head/sys/sys/syscallsubr.h ============================================================================== --- head/sys/sys/syscallsubr.h Wed Jul 8 15:02:56 2009 (r195457) +++ head/sys/sys/syscallsubr.h Wed Jul 8 15:23:18 2009 (r195458) @@ -145,7 +145,7 @@ int kern_open(struct thread *td, char *p int kern_openat(struct thread *td, int fd, char *path, enum uio_seg pathseg, int flags, int mode); int kern_pathconf(struct thread *td, char *path, enum uio_seg pathseg, - int name); + int name, u_long flags); int kern_pipe(struct thread *td, int fildes[2]); int kern_preadv(struct thread *td, int fd, struct uio *auio, off_t offset); int kern_ptrace(struct thread *td, int req, pid_t pid, void *addr, From owner-svn-src-head@FreeBSD.ORG Wed Jul 8 15:25:27 2009 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 B43501065675; Wed, 8 Jul 2009 15:25:27 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 97FE88FC1E; Wed, 8 Jul 2009 15:25:27 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n68FPRAO055127; Wed, 8 Jul 2009 15:25:27 GMT (envelope-from trasz@svn.freebsd.org) Received: (from trasz@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n68FPR0U055120; Wed, 8 Jul 2009 15:25:27 GMT (envelope-from trasz@svn.freebsd.org) Message-Id: <200907081525.n68FPR0U055120@svn.freebsd.org> From: Edward Tomasz Napierala Date: Wed, 8 Jul 2009 15:25: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: r195459 - in head/sys: kern 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: Wed, 08 Jul 2009 15:25:28 -0000 Author: trasz Date: Wed Jul 8 15:25:27 2009 New Revision: 195459 URL: http://svn.freebsd.org/changeset/base/195459 Log: Regenerate after lpathconf(2) addition. Approved by: re (kib) Modified: head/sys/kern/init_sysent.c head/sys/kern/syscalls.c head/sys/kern/systrace_args.c head/sys/sys/syscall.h head/sys/sys/syscall.mk head/sys/sys/sysproto.h Modified: head/sys/kern/init_sysent.c ============================================================================== --- head/sys/kern/init_sysent.c Wed Jul 8 15:23:18 2009 (r195458) +++ head/sys/kern/init_sysent.c Wed Jul 8 15:25:27 2009 (r195459) @@ -3,7 +3,7 @@ * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD: head/sys/kern/syscalls.master 194910 2009-06-24 21:10:52Z jhb + * created from FreeBSD: head/sys/kern/syscalls.master 195458 2009-07-08 15:23:18Z trasz */ #include "opt_compat.h" @@ -547,4 +547,5 @@ struct sysent sysent[] = { { AS(__semctl_args), (sy_call_t *)lkmressys, AUE_NULL, NULL, 0, 0, 0 }, /* 510 = __semctl */ { AS(msgctl_args), (sy_call_t *)lkmressys, AUE_NULL, NULL, 0, 0, 0 }, /* 511 = msgctl */ { AS(shmctl_args), (sy_call_t *)lkmressys, AUE_NULL, NULL, 0, 0, 0 }, /* 512 = shmctl */ + { AS(lpathconf_args), (sy_call_t *)lpathconf, AUE_LPATHCONF, NULL, 0, 0, 0 }, /* 513 = lpathconf */ }; Modified: head/sys/kern/syscalls.c ============================================================================== --- head/sys/kern/syscalls.c Wed Jul 8 15:23:18 2009 (r195458) +++ head/sys/kern/syscalls.c Wed Jul 8 15:25:27 2009 (r195459) @@ -3,7 +3,7 @@ * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD: head/sys/kern/syscalls.master 194910 2009-06-24 21:10:52Z jhb + * created from FreeBSD: head/sys/kern/syscalls.master 195458 2009-07-08 15:23:18Z trasz */ const char *syscallnames[] = { @@ -520,4 +520,5 @@ const char *syscallnames[] = { "__semctl", /* 510 = __semctl */ "msgctl", /* 511 = msgctl */ "shmctl", /* 512 = shmctl */ + "lpathconf", /* 513 = lpathconf */ }; Modified: head/sys/kern/systrace_args.c ============================================================================== --- head/sys/kern/systrace_args.c Wed Jul 8 15:23:18 2009 (r195458) +++ head/sys/kern/systrace_args.c Wed Jul 8 15:25:27 2009 (r195459) @@ -3064,6 +3064,14 @@ systrace_args(int sysnum, void *params, *n_args = 3; break; } + /* lpathconf */ + case 513: { + struct lpathconf_args *p = params; + uarg[0] = (intptr_t) p->path; /* char * */ + iarg[1] = p->name; /* int */ + *n_args = 2; + break; + } default: *n_args = 0; break; @@ -8133,6 +8141,19 @@ systrace_setargdesc(int sysnum, int ndx, break; }; break; + /* lpathconf */ + case 513: + switch(ndx) { + case 0: + p = "char *"; + break; + case 1: + p = "int"; + break; + default: + break; + }; + break; default: break; }; Modified: head/sys/sys/syscall.h ============================================================================== --- head/sys/sys/syscall.h Wed Jul 8 15:23:18 2009 (r195458) +++ head/sys/sys/syscall.h Wed Jul 8 15:25:27 2009 (r195459) @@ -3,7 +3,7 @@ * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD: head/sys/kern/syscalls.master 194910 2009-06-24 21:10:52Z jhb + * created from FreeBSD: head/sys/kern/syscalls.master 195458 2009-07-08 15:23:18Z trasz */ #define SYS_syscall 0 @@ -427,4 +427,5 @@ #define SYS___semctl 510 #define SYS_msgctl 511 #define SYS_shmctl 512 -#define SYS_MAXSYSCALL 513 +#define SYS_lpathconf 513 +#define SYS_MAXSYSCALL 514 Modified: head/sys/sys/syscall.mk ============================================================================== --- head/sys/sys/syscall.mk Wed Jul 8 15:23:18 2009 (r195458) +++ head/sys/sys/syscall.mk Wed Jul 8 15:25:27 2009 (r195459) @@ -1,7 +1,7 @@ # FreeBSD system call names. # DO NOT EDIT-- this file is automatically generated. # $FreeBSD$ -# created from FreeBSD: head/sys/kern/syscalls.master 194910 2009-06-24 21:10:52Z jhb +# created from FreeBSD: head/sys/kern/syscalls.master 195458 2009-07-08 15:23:18Z trasz MIASM = \ syscall.o \ exit.o \ @@ -375,4 +375,5 @@ MIASM = \ closefrom.o \ __semctl.o \ msgctl.o \ - shmctl.o + shmctl.o \ + lpathconf.o Modified: head/sys/sys/sysproto.h ============================================================================== --- head/sys/sys/sysproto.h Wed Jul 8 15:23:18 2009 (r195458) +++ head/sys/sys/sysproto.h Wed Jul 8 15:25:27 2009 (r195459) @@ -3,7 +3,7 @@ * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD: head/sys/kern/syscalls.master 194910 2009-06-24 21:10:52Z jhb + * created from FreeBSD: head/sys/kern/syscalls.master 195458 2009-07-08 15:23:18Z trasz */ #ifndef _SYS_SYSPROTO_H_ @@ -1637,6 +1637,10 @@ struct shmctl_args { char cmd_l_[PADL_(int)]; int cmd; char cmd_r_[PADR_(int)]; char buf_l_[PADL_(struct shmid_ds *)]; struct shmid_ds * buf; char buf_r_[PADR_(struct shmid_ds *)]; }; +struct lpathconf_args { + char path_l_[PADL_(char *)]; char * path; char path_r_[PADR_(char *)]; + char name_l_[PADL_(int)]; int name; char name_r_[PADR_(int)]; +}; int nosys(struct thread *, struct nosys_args *); void sys_exit(struct thread *, struct sys_exit_args *); int fork(struct thread *, struct fork_args *); @@ -1994,6 +1998,7 @@ int closefrom(struct thread *, struct cl int __semctl(struct thread *, struct __semctl_args *); int msgctl(struct thread *, struct msgctl_args *); int shmctl(struct thread *, struct shmctl_args *); +int lpathconf(struct thread *, struct lpathconf_args *); #ifdef COMPAT_43 @@ -2665,6 +2670,7 @@ int freebsd7_shmctl(struct thread *, str #define SYS_AUE___semctl AUE_SEMCTL #define SYS_AUE_msgctl AUE_MSGCTL #define SYS_AUE_shmctl AUE_SHMCTL +#define SYS_AUE_lpathconf AUE_LPATHCONF #undef PAD_ #undef PADL_ From owner-svn-src-head@FreeBSD.ORG Wed Jul 8 15:46:30 2009 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 1991D1065674; Wed, 8 Jul 2009 15:46:30 +0000 (UTC) (envelope-from jamie@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 072A18FC15; Wed, 8 Jul 2009 15:46:30 +0000 (UTC) (envelope-from jamie@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n68FkT9c055617; Wed, 8 Jul 2009 15:46:29 GMT (envelope-from jamie@svn.freebsd.org) Received: (from jamie@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n68FkTej055615; Wed, 8 Jul 2009 15:46:29 GMT (envelope-from jamie@svn.freebsd.org) Message-Id: <200907081546.n68FkTej055615@svn.freebsd.org> From: Jamie Gritton Date: Wed, 8 Jul 2009 15:46: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: r195461 - head/usr.sbin/jail 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, 08 Jul 2009 15:46:30 -0000 Author: jamie Date: Wed Jul 8 15:46:29 2009 New Revision: 195461 URL: http://svn.freebsd.org/changeset/base/195461 Log: Fix a typo in the examples. Approved by: re (kib), bz (mentor) Modified: head/usr.sbin/jail/jail.8 Modified: head/usr.sbin/jail/jail.8 ============================================================================== --- head/usr.sbin/jail/jail.8 Wed Jul 8 15:26:34 2009 (r195460) +++ head/usr.sbin/jail/jail.8 Wed Jul 8 15:46:29 2009 (r195461) @@ -34,7 +34,7 @@ .\" .\" $FreeBSD$ .\" -.Dd June 23, 2009 +.Dd July 8, 2009 .Dt JAIL 8 .Os .Sh NAME @@ -619,7 +619,7 @@ script from within the jail. ifconfig ed0 inet alias 192.0.2.100/32 mount -t procfs proc /data/jail/192.0.2.100/proc jail path=/data/jail/192.0.2.100 host.hostname=testhostname \\ - ip4=addr.192.0.2.100 command=/bin/sh /etc/rc + ip4.addr=192.0.2.100 command=/bin/sh /etc/rc .Ed .Pp A few warnings will be produced, because most From owner-svn-src-head@FreeBSD.ORG Wed Jul 8 15:57:22 2009 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 C7009106566C; Wed, 8 Jul 2009 15:57:22 +0000 (UTC) (envelope-from jamie@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B43918FC15; Wed, 8 Jul 2009 15:57:22 +0000 (UTC) (envelope-from jamie@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n68FvMw7055871; Wed, 8 Jul 2009 15:57:22 GMT (envelope-from jamie@svn.freebsd.org) Received: (from jamie@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n68FvMFk055868; Wed, 8 Jul 2009 15:57:22 GMT (envelope-from jamie@svn.freebsd.org) Message-Id: <200907081557.n68FvMFk055868@svn.freebsd.org> From: Jamie Gritton Date: Wed, 8 Jul 2009 15:57: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: r195462 - head/usr.sbin/jls 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, 08 Jul 2009 15:57:23 -0000 Author: jamie Date: Wed Jul 8 15:57:22 2009 New Revision: 195462 URL: http://svn.freebsd.org/changeset/base/195462 Log: Give a more expected behavior to -[hns] options, defaulting to all parameters instead of ignoring the options and giving the old-style default output. Approved by: re (kib), bz (mentor) Modified: head/usr.sbin/jls/jls.8 head/usr.sbin/jls/jls.c Modified: head/usr.sbin/jls/jls.8 ============================================================================== --- head/usr.sbin/jls/jls.8 Wed Jul 8 15:46:29 2009 (r195461) +++ head/usr.sbin/jls/jls.8 Wed Jul 8 15:57:22 2009 (r195462) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd May 27, 2009 +.Dd July 8, 2009 .Dt JLS 8 .Os .Sh NAME @@ -54,6 +54,8 @@ for a description of some core parameter .Pp If no .Ar parameters +or any of the options +.Fl hns are given, the following four columns will be printed: jail identifier (jid), IP address (ip4.addr), hostname (host.hostname), and path (path). @@ -66,17 +68,20 @@ List as well as active jails. .It Fl h Print a header line containing the parameters listed. -If no parameters are given on the command line, the default output always -contains a header. +If no parameters are given on the command line, +.Va all +is assumed. .It Fl n Print parameters in .Dq name=value format, where each parameter is preceded by its name. -This option is ignored for the default four-column output. +If no parameters are given on the command line, +.Va all +is assumed. .It Fl q Put quotes around parameters if they contain spaces or quotes, or are the empty string. -.It Fl c +.It Fl s Print parameters suitable for passing to .Xr jail 8 , skipping read-only and unused parameters. Modified: head/usr.sbin/jls/jls.c ============================================================================== --- head/usr.sbin/jls/jls.c Wed Jul 8 15:46:29 2009 (r195461) +++ head/usr.sbin/jls/jls.c Wed Jul 8 15:57:22 2009 (r195462) @@ -88,7 +88,8 @@ main(int argc, char **argv) jname = optarg; break; case 'h': - pflags = (pflags & ~PRINT_SKIP) | PRINT_HEADER; + pflags = (pflags & ~(PRINT_SKIP | PRINT_VERBOSE)) | + PRINT_HEADER; break; case 'n': pflags = (pflags & ~PRINT_VERBOSE) | PRINT_NAMEVAL; @@ -101,7 +102,8 @@ main(int argc, char **argv) PRINT_NAMEVAL | PRINT_QUOTED | PRINT_SKIP; break; case 'v': - pflags = (pflags & ~(PRINT_NAMEVAL | PRINT_SKIP)) | + pflags = (pflags & + ~(PRINT_HEADER | PRINT_NAMEVAL | PRINT_SKIP)) | PRINT_VERBOSE; break; default: @@ -110,7 +112,9 @@ main(int argc, char **argv) /* Add the parameters to print. */ if (optind == argc) { - if (pflags & PRINT_VERBOSE) { + if (pflags & (PRINT_HEADER | PRINT_NAMEVAL)) + add_param("all", NULL, (size_t)0, NULL, JP_USER); + else if (pflags & PRINT_VERBOSE) { add_param("jid", NULL, (size_t)0, NULL, JP_USER); add_param("host.hostname", NULL, (size_t)0, NULL, JP_USER); @@ -122,9 +126,7 @@ main(int argc, char **argv) add_param("ip6.addr", NULL, (size_t)0, NULL, JP_USER | JP_OPT); } else { - pflags = (pflags & - ~(PRINT_NAMEVAL | PRINT_SKIP | PRINT_VERBOSE)) | - PRINT_DEFAULT; + pflags |= PRINT_DEFAULT; add_param("jid", NULL, (size_t)0, NULL, JP_USER); add_param("ip4.addr", NULL, (size_t)0, NULL, JP_USER); add_param("host.hostname", NULL, (size_t)0, NULL, From owner-svn-src-head@FreeBSD.ORG Wed Jul 8 16:26:44 2009 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 2DA5D106570C; Wed, 8 Jul 2009 16:26:44 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 1B73F8FC14; Wed, 8 Jul 2009 16:26:44 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n68GQi9Q056687; Wed, 8 Jul 2009 16:26:44 GMT (envelope-from trasz@svn.freebsd.org) Received: (from trasz@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n68GQhC3056685; Wed, 8 Jul 2009 16:26:43 GMT (envelope-from trasz@svn.freebsd.org) Message-Id: <200907081626.n68GQhC3056685@svn.freebsd.org> From: Edward Tomasz Napierala Date: Wed, 8 Jul 2009 16:26: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: r195468 - 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, 08 Jul 2009 16:26:44 -0000 Author: trasz Date: Wed Jul 8 16:26:43 2009 New Revision: 195468 URL: http://svn.freebsd.org/changeset/base/195468 Log: Fix freebsd32 version of lpathconf(2). Approved by: re (kib) Modified: head/sys/compat/freebsd32/syscalls.master Modified: head/sys/compat/freebsd32/syscalls.master ============================================================================== --- head/sys/compat/freebsd32/syscalls.master Wed Jul 8 16:25:47 2009 (r195467) +++ head/sys/compat/freebsd32/syscalls.master Wed Jul 8 16:26:43 2009 (r195468) @@ -900,4 +900,4 @@ struct msqid_ds32 *buf); } 512 AUE_SHMCTL STD { int freebsd32_shmctl(int shmid, int cmd, \ struct shmid_ds32 *buf); } -513 AUE_LPATHCONF STD { int lpathconf(char *path, int name); } +513 AUE_LPATHCONF NOPROTO { int lpathconf(char *path, int name); } From owner-svn-src-head@FreeBSD.ORG Wed Jul 8 16:30:34 2009 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 684B9106564A; Wed, 8 Jul 2009 16:30:34 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 55A628FC0C; Wed, 8 Jul 2009 16:30:34 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n68GUYSg056791; Wed, 8 Jul 2009 16:30:34 GMT (envelope-from trasz@svn.freebsd.org) Received: (from trasz@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n68GUYf1056786; Wed, 8 Jul 2009 16:30:34 GMT (envelope-from trasz@svn.freebsd.org) Message-Id: <200907081630.n68GUYf1056786@svn.freebsd.org> From: Edward Tomasz Napierala Date: Wed, 8 Jul 2009 16:30: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: r195469 - 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, 08 Jul 2009 16:30:34 -0000 Author: trasz Date: Wed Jul 8 16:30:34 2009 New Revision: 195469 URL: http://svn.freebsd.org/changeset/base/195469 Log: Regen the freebsd32 parts. Approved by: re (kib) Modified: head/sys/compat/freebsd32/freebsd32_proto.h head/sys/compat/freebsd32/freebsd32_syscall.h head/sys/compat/freebsd32/freebsd32_syscalls.c head/sys/compat/freebsd32/freebsd32_sysent.c Modified: head/sys/compat/freebsd32/freebsd32_proto.h ============================================================================== --- head/sys/compat/freebsd32/freebsd32_proto.h Wed Jul 8 16:26:43 2009 (r195468) +++ head/sys/compat/freebsd32/freebsd32_proto.h Wed Jul 8 16:30:34 2009 (r195469) @@ -3,7 +3,7 @@ * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD: head/sys/compat/freebsd32/syscalls.master 194910 2009-06-24 21:10:52Z jhb + * created from FreeBSD: head/sys/compat/freebsd32/syscalls.master 195468 2009-07-08 16:26:43Z trasz */ #ifndef _FREEBSD32_SYSPROTO_H_ Modified: head/sys/compat/freebsd32/freebsd32_syscall.h ============================================================================== --- head/sys/compat/freebsd32/freebsd32_syscall.h Wed Jul 8 16:26:43 2009 (r195468) +++ head/sys/compat/freebsd32/freebsd32_syscall.h Wed Jul 8 16:30:34 2009 (r195469) @@ -3,7 +3,7 @@ * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD: head/sys/compat/freebsd32/syscalls.master 194910 2009-06-24 21:10:52Z jhb + * created from FreeBSD: head/sys/compat/freebsd32/syscalls.master 195468 2009-07-08 16:26:43Z trasz */ #define FREEBSD32_SYS_syscall 0 @@ -381,4 +381,5 @@ #define FREEBSD32_SYS_freebsd32_semctl 510 #define FREEBSD32_SYS_freebsd32_msgctl 511 #define FREEBSD32_SYS_freebsd32_shmctl 512 -#define FREEBSD32_SYS_MAXSYSCALL 513 +#define FREEBSD32_SYS_lpathconf 513 +#define FREEBSD32_SYS_MAXSYSCALL 514 Modified: head/sys/compat/freebsd32/freebsd32_syscalls.c ============================================================================== --- head/sys/compat/freebsd32/freebsd32_syscalls.c Wed Jul 8 16:26:43 2009 (r195468) +++ head/sys/compat/freebsd32/freebsd32_syscalls.c Wed Jul 8 16:30:34 2009 (r195469) @@ -3,7 +3,7 @@ * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD: head/sys/compat/freebsd32/syscalls.master 194910 2009-06-24 21:10:52Z jhb + * created from FreeBSD: head/sys/compat/freebsd32/syscalls.master 195468 2009-07-08 16:26:43Z trasz */ const char *freebsd32_syscallnames[] = { @@ -520,4 +520,5 @@ const char *freebsd32_syscallnames[] = { "freebsd32_semctl", /* 510 = freebsd32_semctl */ "freebsd32_msgctl", /* 511 = freebsd32_msgctl */ "freebsd32_shmctl", /* 512 = freebsd32_shmctl */ + "lpathconf", /* 513 = lpathconf */ }; Modified: head/sys/compat/freebsd32/freebsd32_sysent.c ============================================================================== --- head/sys/compat/freebsd32/freebsd32_sysent.c Wed Jul 8 16:26:43 2009 (r195468) +++ head/sys/compat/freebsd32/freebsd32_sysent.c Wed Jul 8 16:30:34 2009 (r195469) @@ -3,7 +3,7 @@ * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD: head/sys/compat/freebsd32/syscalls.master 194910 2009-06-24 21:10:52Z jhb + * created from FreeBSD: head/sys/compat/freebsd32/syscalls.master 195468 2009-07-08 16:26:43Z trasz */ #include "opt_compat.h" @@ -557,4 +557,5 @@ struct sysent freebsd32_sysent[] = { { AS(freebsd32_semctl_args), (sy_call_t *)freebsd32_semctl, AUE_SEMCTL, NULL, 0, 0, 0 }, /* 510 = freebsd32_semctl */ { AS(freebsd32_msgctl_args), (sy_call_t *)freebsd32_msgctl, AUE_MSGCTL, NULL, 0, 0, 0 }, /* 511 = freebsd32_msgctl */ { AS(freebsd32_shmctl_args), (sy_call_t *)freebsd32_shmctl, AUE_SHMCTL, NULL, 0, 0, 0 }, /* 512 = freebsd32_shmctl */ + { AS(lpathconf_args), (sy_call_t *)lpathconf, AUE_LPATHCONF, NULL, 0, 0, 0 }, /* 513 = lpathconf */ }; From owner-svn-src-head@FreeBSD.ORG Wed Jul 8 19:47:03 2009 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 F00B41065674; Wed, 8 Jul 2009 19:47:03 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail08.syd.optusnet.com.au (mail08.syd.optusnet.com.au [211.29.132.189]) by mx1.freebsd.org (Postfix) with ESMTP id 8BE7A8FC16; Wed, 8 Jul 2009 19:47:03 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from c122-107-120-90.carlnfd1.nsw.optusnet.com.au (c122-107-120-90.carlnfd1.nsw.optusnet.com.au [122.107.120.90]) by mail08.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id n68Jl0CG030756 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Thu, 9 Jul 2009 05:47:01 +1000 Date: Thu, 9 Jul 2009 05:47:00 +1000 (EST) From: Bruce Evans X-X-Sender: bde@delplex.bde.org To: Mike Silbersack In-Reply-To: <200907080109.n6819CEn033840@svn.freebsd.org> Message-ID: <20090709045726.A46151@delplex.bde.org> References: <200907080109.n6819CEn033840@svn.freebsd.org> 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: r195430 - 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, 08 Jul 2009 19:47:04 -0000 On Wed, 8 Jul 2009, Mike Silbersack wrote: > Log: > Increase HZ_VM from 10 to 100. While 10 hz saves cpu time > under VM environments, it's too slow for FreeBSD to work > properly. For example, ping at 10hz pings about every 600ms > instead of about every second. It shouldn't be that bad -- the error should be at most 2 ticks in the worst case, and only 1/2 a tick on average. I thought that only the worst case is normal for ping. Apparently the 2-tick error gets doubled somewhere (maybe internally in select(2) and again in ping). I use a modified ping that makes ping attempt to send a packet at every multiple of the specified interval, instead of waiting for the specified interval "between" sending each packet as documented. All sleeps and timeouts in FreeBSD except ones generated by periodic itimers give an interval that is at least as large as the specified interval (unless interrupted by a signal). ping uses select(2) timeouts, so (HZ) timer granularity necessarily gives intervals of between 0 and 1 ticks too long (average half a tick too long), and due to misimplementation details they are up to 2 ticks too long (average 1.5 ticks too long?). ping doesn't try to compensate for this and probably shouldn't, since it couldn't do better than the implementation while maintaining the minimum interval. It could use periodic itimers. My version still uses select(), but checks timestamps so as to determine how much to reduce the interval to recover from previous intervals being too long. IIRC, it does this without using extra syscalls. However, a periodic itimer could do it with fewer than the normal number of syscalls. It would restore the use of SIGALRM, and avoiding SIGALRM is an important optimization by fenner, but I think using periodic itimers would make using SIGALRM best again. I should also use a modified ping that makes ping -f actually flood. A flood ping would send packets as fast as possible. ping -f only sends them when they come back, or 100 times per second, whichever is more. 100 times per second may have been a high rate in 1980 but it isn't now, but with your HZ = 10, 100 times per second is 20 times higher than is done. With HZ = 100, 100 times per second is only 2 times higher than is done. ping -i allows setting a smaller interval than ping -f (down to ping's internal bogus granularity of 1 ms), but small intervals won't actually work unless HZ is large, due to external timer granularity. Bruce From owner-svn-src-head@FreeBSD.ORG Wed Jul 8 21:45:48 2009 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 570F11065673; Wed, 8 Jul 2009 21:45:48 +0000 (UTC) (envelope-from jamie@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 461428FC08; Wed, 8 Jul 2009 21:45:48 +0000 (UTC) (envelope-from jamie@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n68Ljm5f063254; Wed, 8 Jul 2009 21:45:48 GMT (envelope-from jamie@svn.freebsd.org) Received: (from jamie@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n68LjmP0063252; Wed, 8 Jul 2009 21:45:48 GMT (envelope-from jamie@svn.freebsd.org) Message-Id: <200907082145.n68LjmP0063252@svn.freebsd.org> From: Jamie Gritton Date: Wed, 8 Jul 2009 21:45: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: r195477 - 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, 08 Jul 2009 21:45:48 -0000 Author: jamie Date: Wed Jul 8 21:45:48 2009 New Revision: 195477 URL: http://svn.freebsd.org/changeset/base/195477 Log: Remove crcopy call from seteuid now that it calls crcopysafe. Reviewed by: brooks Approved by: re (kib), bz (mentor) Modified: head/sys/kern/kern_prot.c Modified: head/sys/kern/kern_prot.c ============================================================================== --- head/sys/kern/kern_prot.c Wed Jul 8 18:37:05 2009 (r195476) +++ head/sys/kern/kern_prot.c Wed Jul 8 21:45:48 2009 (r195477) @@ -623,7 +623,6 @@ seteuid(struct thread *td, struct seteui /* * Everything's okay, do it. */ - crcopy(newcred, oldcred); if (oldcred->cr_uid != euid) { change_euid(newcred, euip); setsugid(p); From owner-svn-src-head@FreeBSD.ORG Thu Jul 9 01:59:00 2009 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 7CF1E106566B; Thu, 9 Jul 2009 01:59:00 +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 6B5E58FC16; Thu, 9 Jul 2009 01:59:00 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n691x0px068420; Thu, 9 Jul 2009 01:59:00 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n691x0DT068418; Thu, 9 Jul 2009 01:59:00 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <200907090159.n691x0DT068418@svn.freebsd.org> From: Pyun YongHyeon Date: Thu, 9 Jul 2009 01:59: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: r195484 - head/sys/dev/xl 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, 09 Jul 2009 01:59:00 -0000 Author: yongari Date: Thu Jul 9 01:58:59 2009 New Revision: 195484 URL: http://svn.freebsd.org/changeset/base/195484 Log: Make xl(4) build with Tx checksum offload. PR: kern/136409 Approved by: re (kib) Modified: head/sys/dev/xl/if_xl.c Modified: head/sys/dev/xl/if_xl.c ============================================================================== --- head/sys/dev/xl/if_xl.c Thu Jul 9 00:39:56 2009 (r195483) +++ head/sys/dev/xl/if_xl.c Thu Jul 9 01:58:59 2009 (r195484) @@ -2471,12 +2471,12 @@ xl_encap(struct xl_softc *sc, struct xl_ status = XL_TXSTAT_RND_DEFEAT; #ifndef XL905B_TXCSUM_BROKEN - if (m_head->m_pkthdr.csum_flags) { - if (m_head->m_pkthdr.csum_flags & CSUM_IP) + if ((*m_head)->m_pkthdr.csum_flags) { + if ((*m_head)->m_pkthdr.csum_flags & CSUM_IP) status |= XL_TXSTAT_IPCKSUM; - if (m_head->m_pkthdr.csum_flags & CSUM_TCP) + if ((*m_head)->m_pkthdr.csum_flags & CSUM_TCP) status |= XL_TXSTAT_TCPCKSUM; - if (m_head->m_pkthdr.csum_flags & CSUM_UDP) + if ((*m_head)->m_pkthdr.csum_flags & CSUM_UDP) status |= XL_TXSTAT_UDPCKSUM; } #endif From owner-svn-src-head@FreeBSD.ORG Thu Jul 9 09:34:11 2009 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 BC7E2106566C; Thu, 9 Jul 2009 09:34: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 9FBA98FC1A; Thu, 9 Jul 2009 09:34:11 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n699YBVq078119; Thu, 9 Jul 2009 09:34:11 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n699YBb4078107; Thu, 9 Jul 2009 09:34:11 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <200907090934.n699YBb4078107@svn.freebsd.org> From: Konstantin Belousov Date: Thu, 9 Jul 2009 09:34: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: r195486 - in head/sys/amd64: amd64 ia32 include linux32 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, 09 Jul 2009 09:34:12 -0000 Author: kib Date: Thu Jul 9 09:34:11 2009 New Revision: 195486 URL: http://svn.freebsd.org/changeset/base/195486 Log: Restore the segment registers and segment base MSRs for amd64 syscall return path only when neither thread was context switched while executing syscall code nor syscall explicitely modified LDT or MSRs. Save segment registers in trap handlers before interrupts are enabled, to not allow context switches to happen before registers are saved. Use separated byte in pcb for indication of fast/full return, since pcb_flags are not synchronized with context switches. The change puts back syscall microbenchmark numbers that were slowed down after commit of the support for LDT on amd64. Reviewed by: jeff Tested (and tested, and tested ...) by: pho Approved by: re (kensmith) Modified: head/sys/amd64/amd64/cpu_switch.S head/sys/amd64/amd64/exception.S head/sys/amd64/amd64/genassym.c head/sys/amd64/amd64/machdep.c head/sys/amd64/amd64/sys_machdep.c head/sys/amd64/amd64/vm_machdep.c head/sys/amd64/ia32/ia32_exception.S head/sys/amd64/ia32/ia32_reg.c head/sys/amd64/ia32/ia32_signal.c head/sys/amd64/include/pcb.h head/sys/amd64/linux32/linux32_sysvec.c Modified: head/sys/amd64/amd64/cpu_switch.S ============================================================================== --- head/sys/amd64/amd64/cpu_switch.S Thu Jul 9 09:12:16 2009 (r195485) +++ head/sys/amd64/amd64/cpu_switch.S Thu Jul 9 09:34:11 2009 (r195486) @@ -97,6 +97,7 @@ END(cpu_throw) ENTRY(cpu_switch) /* Switch to new thread. First, save context. */ movq TD_PCB(%rdi),%r8 + movb $1,PCB_FULL_IRET(%r8) movq (%rsp),%rax /* Hardware registers */ movq %r15,PCB_R15(%r8) Modified: head/sys/amd64/amd64/exception.S ============================================================================== --- head/sys/amd64/amd64/exception.S Thu Jul 9 09:12:16 2009 (r195485) +++ head/sys/amd64/amd64/exception.S Thu Jul 9 09:34:11 2009 (r195486) @@ -162,19 +162,20 @@ IDTVEC(align) .globl alltraps .type alltraps,@function alltraps: + movq %rdi,TF_RDI(%rsp) testb $SEL_RPL_MASK,TF_CS(%rsp) /* Did we come from kernel? */ jz alltraps_testi /* already running with kernel GS.base */ swapgs + movq PCPU(CURPCB),%rdi + movb $0,PCB_FULL_IRET(%rdi) movw %fs,TF_FS(%rsp) movw %gs,TF_GS(%rsp) movw %es,TF_ES(%rsp) movw %ds,TF_DS(%rsp) alltraps_testi: testl $PSL_I,TF_RFLAGS(%rsp) - jz alltraps_pushregs + jz alltraps_pushregs_no_rdi sti -alltraps_pushregs: - movq %rdi,TF_RDI(%rsp) alltraps_pushregs_no_rdi: movq %rsi,TF_RSI(%rsp) movq %rdx,TF_RDX(%rsp) @@ -233,14 +234,17 @@ calltrap: .globl alltraps_noen .type alltraps_noen,@function alltraps_noen: + movq %rdi,TF_RDI(%rsp) testb $SEL_RPL_MASK,TF_CS(%rsp) /* Did we come from kernel? */ jz 1f /* already running with kernel GS.base */ swapgs + movq PCPU(CURPCB),%rdi + movb $0,PCB_FULL_IRET(%rdi) 1: movw %fs,TF_FS(%rsp) movw %gs,TF_GS(%rsp) movw %es,TF_ES(%rsp) movw %ds,TF_DS(%rsp) - jmp alltraps_pushregs + jmp alltraps_pushregs_no_rdi IDTVEC(dblfault) subq $TF_ERR,%rsp @@ -278,12 +282,13 @@ IDTVEC(dblfault) IDTVEC(page) subq $TF_ERR,%rsp movl $T_PAGEFLT,TF_TRAPNO(%rsp) + movq %rdi,TF_RDI(%rsp) /* free up a GP register */ testb $SEL_RPL_MASK,TF_CS(%rsp) /* Did we come from kernel? */ jz 1f /* already running with kernel GS.base */ swapgs -1: - movq %rdi,TF_RDI(%rsp) /* free up a GP register */ - movq %cr2,%rdi /* preserve %cr2 before .. */ + movq PCPU(CURPCB),%rdi + movb $0,PCB_FULL_IRET(%rdi) +1: movq %cr2,%rdi /* preserve %cr2 before .. */ movq %rdi,TF_ADDR(%rsp) /* enabling interrupts. */ movw %fs,TF_FS(%rsp) movw %gs,TF_GS(%rsp) @@ -311,7 +316,9 @@ IDTVEC(prot) testb $SEL_RPL_MASK,TF_CS(%rsp) /* Did we come from kernel? */ jz 2f /* already running with kernel GS.base */ 1: swapgs -2: movw %fs,TF_FS(%rsp) +2: movq PCPU(CURPCB),%rdi + movb $1,PCB_FULL_IRET(%rdi) /* always full iret from GPF */ + movw %fs,TF_FS(%rsp) movw %gs,TF_GS(%rsp) movw %es,TF_ES(%rsp) movw %ds,TF_DS(%rsp) @@ -341,6 +348,8 @@ IDTVEC(fast_syscall) movw %gs,TF_GS(%rsp) movw %es,TF_ES(%rsp) movw %ds,TF_DS(%rsp) + movq PCPU(CURPCB),%r11 + movb $0,PCB_FULL_IRET(%r11) sti movq $KUDSEL,TF_SS(%rsp) movq $KUCSEL,TF_CS(%rsp) @@ -644,7 +653,8 @@ doreti_exit: */ testb $SEL_RPL_MASK,TF_CS(%rsp) jz ld_regs - + cmpb $0,PCB_FULL_IRET(%r8) + je ld_regs testl $TF_HASSEGS,TF_FLAGS(%rsp) je set_segs Modified: head/sys/amd64/amd64/genassym.c ============================================================================== --- head/sys/amd64/amd64/genassym.c Thu Jul 9 09:12:16 2009 (r195485) +++ head/sys/amd64/amd64/genassym.c Thu Jul 9 09:34:11 2009 (r195486) @@ -141,6 +141,7 @@ ASSYM(PCB_DR3, offsetof(struct pcb, pcb_ ASSYM(PCB_DR6, offsetof(struct pcb, pcb_dr6)); ASSYM(PCB_DR7, offsetof(struct pcb, pcb_dr7)); ASSYM(PCB_TSSP, offsetof(struct pcb, pcb_tssp)); +ASSYM(PCB_FULL_IRET, offsetof(struct pcb, pcb_full_iret)); ASSYM(PCB_DBREGS, PCB_DBREGS); ASSYM(PCB_32BIT, PCB_32BIT); ASSYM(PCB_GS32BIT, PCB_GS32BIT); Modified: head/sys/amd64/amd64/machdep.c ============================================================================== --- head/sys/amd64/amd64/machdep.c Thu Jul 9 09:12:16 2009 (r195485) +++ head/sys/amd64/amd64/machdep.c Thu Jul 9 09:34:11 2009 (r195486) @@ -382,6 +382,7 @@ sendsig(sig_t catcher, ksiginfo_t *ksi, regs->tf_fs = _ufssel; regs->tf_gs = _ugssel; regs->tf_flags = TF_HASSEGS; + td->td_pcb->pcb_full_iret = 1; PROC_LOCK(p); mtx_lock(&psp->ps_mtx); } @@ -483,6 +484,7 @@ sigreturn(td, uap) signotify(td); PROC_UNLOCK(p); td->td_pcb->pcb_flags |= PCB_FULLCTX; + td->td_pcb->pcb_full_iret = 1; return (EJUSTRETURN); } @@ -853,6 +855,7 @@ exec_setregs(td, entry, stack, ps_string pcb->pcb_gsbase = 0; pcb->pcb_flags &= ~(PCB_32BIT | PCB_GS32BIT); pcb->pcb_initial_fpucw = __INITIAL_FPUCW__; + pcb->pcb_full_iret = 1; bzero((char *)regs, sizeof(struct trapframe)); regs->tf_rip = entry; @@ -2031,6 +2034,7 @@ set_mcontext(struct thread *td, const mc td->td_pcb->pcb_gsbase = mcp->mc_gsbase; } td->td_pcb->pcb_flags |= PCB_FULLCTX; + td->td_pcb->pcb_full_iret = 1; return (0); } Modified: head/sys/amd64/amd64/sys_machdep.c ============================================================================== --- head/sys/amd64/amd64/sys_machdep.c Thu Jul 9 09:12:16 2009 (r195485) +++ head/sys/amd64/amd64/sys_machdep.c Thu Jul 9 09:34:11 2009 (r195486) @@ -103,6 +103,7 @@ sysarch_ldt(struct thread *td, struct sy error = amd64_get_ldt(td, largs); break; case I386_SET_LDT: + td->td_pcb->pcb_full_iret = 1; if (largs->descs != NULL) { lp = (struct user_segment_descriptor *) kmem_alloc(kernel_map, largs->num * @@ -132,6 +133,7 @@ update_gdt_gsbase(struct thread *td, uin if (td != curthread) return; + td->td_pcb->pcb_full_iret = 1; critical_enter(); sd = PCPU_GET(gs32p); sd->sd_lobase = base & 0xffffff; @@ -146,6 +148,7 @@ update_gdt_fsbase(struct thread *td, uin if (td != curthread) return; + td->td_pcb->pcb_full_iret = 1; critical_enter(); sd = PCPU_GET(fs32p); sd->sd_lobase = base & 0xffffff; @@ -201,6 +204,7 @@ sysarch(td, uap) if (!error) { pcb->pcb_fsbase = i386base; td->td_frame->tf_fs = _ufssel; + pcb->pcb_full_iret = 1; update_gdt_fsbase(td, i386base); } break; @@ -212,6 +216,7 @@ sysarch(td, uap) error = copyin(uap->parms, &i386base, sizeof(i386base)); if (!error) { pcb->pcb_gsbase = i386base; + pcb->pcb_full_iret = 1; td->td_frame->tf_gs = _ugssel; update_gdt_gsbase(td, i386base); } @@ -225,6 +230,7 @@ sysarch(td, uap) if (!error) { if (a64base < VM_MAXUSER_ADDRESS) { pcb->pcb_fsbase = a64base; + pcb->pcb_full_iret = 1; td->td_frame->tf_fs = _ufssel; } else error = EINVAL; @@ -240,6 +246,7 @@ sysarch(td, uap) if (!error) { if (a64base < VM_MAXUSER_ADDRESS) { pcb->pcb_gsbase = a64base; + pcb->pcb_full_iret = 1; td->td_frame->tf_gs = _ugssel; } else error = EINVAL; @@ -525,6 +532,7 @@ amd64_set_ldt(td, uap, descs) uap->start, uap->num, (void *)uap->descs); #endif + td->td_pcb->pcb_full_iret = 1; p = td->td_proc; if (descs == NULL) { /* Free descriptors */ Modified: head/sys/amd64/amd64/vm_machdep.c ============================================================================== --- head/sys/amd64/amd64/vm_machdep.c Thu Jul 9 09:12:16 2009 (r195485) +++ head/sys/amd64/amd64/vm_machdep.c Thu Jul 9 09:34:11 2009 (r195486) @@ -186,6 +186,9 @@ cpu_fork(td1, p2, td2, flags) /* As an i386, do not copy io permission bitmap. */ pcb2->pcb_tssp = NULL; + /* New segment registers. */ + pcb2->pcb_full_iret = 1; + /* Copy the LDT, if necessary. */ mdp1 = &td1->td_proc->p_md; mdp2 = &p2->p_md; @@ -336,6 +339,7 @@ cpu_set_upcall(struct thread *td, struct */ bcopy(td0->td_pcb, pcb2, sizeof(*pcb2)); pcb2->pcb_flags &= ~PCB_FPUINITDONE; + pcb2->pcb_full_iret = 1; /* * Create a new fresh stack for the new thread. @@ -450,6 +454,7 @@ cpu_set_user_tls(struct thread *td, void } #endif td->td_pcb->pcb_fsbase = (register_t)tls_base; + td->td_pcb->pcb_full_iret = 1; return (0); } Modified: head/sys/amd64/ia32/ia32_exception.S ============================================================================== --- head/sys/amd64/ia32/ia32_exception.S Thu Jul 9 09:12:16 2009 (r195485) +++ head/sys/amd64/ia32/ia32_exception.S Thu Jul 9 09:34:11 2009 (r195486) @@ -42,10 +42,16 @@ SUPERALIGN_TEXT IDTVEC(int0x80_syscall) swapgs - sti pushq $2 /* sizeof "int 0x80" */ subq $TF_ERR,%rsp /* skip over tf_trapno */ movq %rdi,TF_RDI(%rsp) + movq PCPU(CURPCB),%rdi + movb $0,PCB_FULL_IRET(%rdi) + movw %fs,TF_FS(%rsp) + movw %gs,TF_GS(%rsp) + movw %es,TF_ES(%rsp) + movw %ds,TF_DS(%rsp) + sti movq %rsi,TF_RSI(%rsp) movq %rdx,TF_RDX(%rsp) movq %rcx,TF_RCX(%rsp) @@ -60,10 +66,6 @@ IDTVEC(int0x80_syscall) movq %r13,TF_R13(%rsp) movq %r14,TF_R14(%rsp) movq %r15,TF_R15(%rsp) - movw %fs,TF_FS(%rsp) - movw %gs,TF_GS(%rsp) - movw %es,TF_ES(%rsp) - movw %ds,TF_DS(%rsp) movl $TF_HASSEGS,TF_FLAGS(%rsp) FAKE_MCOUNT(TF_RIP(%rsp)) movq %rsp, %rdi Modified: head/sys/amd64/ia32/ia32_reg.c ============================================================================== --- head/sys/amd64/ia32/ia32_reg.c Thu Jul 9 09:12:16 2009 (r195485) +++ head/sys/amd64/ia32/ia32_reg.c Thu Jul 9 09:34:11 2009 (r195486) @@ -125,6 +125,7 @@ set_regs32(struct thread *td, struct reg tp->tf_fs = regs->r_fs; tp->tf_es = regs->r_es; tp->tf_ds = regs->r_ds; + td->td_pcb->pcb_full_iret = 1; tp->tf_flags = TF_HASSEGS; tp->tf_rdi = regs->r_edi; tp->tf_rsi = regs->r_esi; Modified: head/sys/amd64/ia32/ia32_signal.c ============================================================================== --- head/sys/amd64/ia32/ia32_signal.c Thu Jul 9 09:12:16 2009 (r195485) +++ head/sys/amd64/ia32/ia32_signal.c Thu Jul 9 09:34:11 2009 (r195486) @@ -159,6 +159,7 @@ ia32_get_mcontext(struct thread *td, str ia32_get_fpcontext(td, mcp); mcp->mc_fsbase = td->td_pcb->pcb_fsbase; mcp->mc_gsbase = td->td_pcb->pcb_gsbase; + td->td_pcb->pcb_full_iret = 1; return (0); } @@ -201,6 +202,7 @@ ia32_set_mcontext(struct thread *td, con tp->tf_rsp = mcp->mc_esp; tp->tf_ss = mcp->mc_ss; td->td_pcb->pcb_flags |= PCB_FULLCTX; + td->td_pcb->pcb_full_iret = 1; return (0); } @@ -394,6 +396,7 @@ freebsd4_ia32_sendsig(sig_t catcher, ksi regs->tf_ss = _udatasel; regs->tf_ds = _udatasel; regs->tf_es = _udatasel; + td->td_pcb->pcb_full_iret = 1; /* leave user %fs and %gs untouched */ PROC_LOCK(p); mtx_lock(&psp->ps_mtx); @@ -514,6 +517,7 @@ ia32_sendsig(sig_t catcher, ksiginfo_t * regs->tf_ss = _udatasel; regs->tf_ds = _udatasel; regs->tf_es = _udatasel; + td->td_pcb->pcb_full_iret = 1; /* XXXKIB leave user %fs and %gs untouched */ PROC_LOCK(p); mtx_lock(&psp->ps_mtx); @@ -611,6 +615,7 @@ freebsd4_freebsd32_sigreturn(td, uap) SIG_CANTMASK(td->td_sigmask); signotify(td); PROC_UNLOCK(p); + td->td_pcb->pcb_full_iret = 1; return (EJUSTRETURN); } #endif /* COMPAT_FREEBSD4 */ @@ -702,6 +707,7 @@ freebsd32_sigreturn(td, uap) SIG_CANTMASK(td->td_sigmask); signotify(td); PROC_UNLOCK(p); + td->td_pcb->pcb_full_iret = 1; return (EJUSTRETURN); } @@ -747,5 +753,6 @@ ia32_setregs(td, entry, stack, ps_string /* Return via doreti so that we can change to a different %cs */ pcb->pcb_flags |= PCB_FULLCTX | PCB_32BIT; pcb->pcb_flags &= ~PCB_GS32BIT; + td->td_pcb->pcb_full_iret = 1; td->td_retval[1] = 0; } Modified: head/sys/amd64/include/pcb.h ============================================================================== --- head/sys/amd64/include/pcb.h Thu Jul 9 09:12:16 2009 (r195485) +++ head/sys/amd64/include/pcb.h Thu Jul 9 09:34:11 2009 (r195486) @@ -72,12 +72,13 @@ struct pcb { struct savefpu pcb_save; uint16_t pcb_initial_fpucw; - caddr_t pcb_onfault; /* copyin/out fault recovery */ + caddr_t pcb_onfault; /* copyin/out fault recovery */ /* 32-bit segment descriptor */ struct user_segment_descriptor pcb_gs32sd; /* local tss, with i/o bitmap; NULL for common */ struct amd64tss *pcb_tssp; + char pcb_full_iret; }; struct xpcb { Modified: head/sys/amd64/linux32/linux32_sysvec.c ============================================================================== --- head/sys/amd64/linux32/linux32_sysvec.c Thu Jul 9 09:12:16 2009 (r195485) +++ head/sys/amd64/linux32/linux32_sysvec.c Thu Jul 9 09:34:11 2009 (r195486) @@ -423,6 +423,7 @@ linux_rt_sendsig(sig_t catcher, ksiginfo regs->tf_fs = _ufssel; regs->tf_gs = _ugssel; regs->tf_flags = TF_HASSEGS; + td->td_pcb->pcb_full_iret = 1; PROC_LOCK(p); mtx_lock(&psp->ps_mtx); } @@ -545,6 +546,7 @@ linux_sendsig(sig_t catcher, ksiginfo_t regs->tf_fs = _ufssel; regs->tf_gs = _ugssel; regs->tf_flags = TF_HASSEGS; + td->td_pcb->pcb_full_iret = 1; PROC_LOCK(p); mtx_lock(&psp->ps_mtx); } @@ -645,6 +647,7 @@ linux_sigreturn(struct thread *td, struc regs->tf_rflags = eflags; regs->tf_rsp = frame.sf_sc.sc_esp_at_signal; regs->tf_ss = frame.sf_sc.sc_ss; + td->td_pcb->pcb_full_iret = 1; return (EJUSTRETURN); } @@ -746,6 +749,7 @@ linux_rt_sigreturn(struct thread *td, st regs->tf_rflags = eflags; regs->tf_rsp = context->sc_esp_at_signal; regs->tf_ss = context->sc_ss; + td->td_pcb->pcb_full_iret = 1; /* * call sigaltstack & ignore results.. @@ -864,6 +868,7 @@ exec_linux_setregs(td, entry, stack, ps_ regs->tf_flags = TF_HASSEGS; regs->tf_cs = _ucode32sel; regs->tf_rbx = ps_strings; + td->td_pcb->pcb_full_iret = 1; load_cr0(rcr0() | CR0_MP | CR0_TS); fpstate_drop(td); From owner-svn-src-head@FreeBSD.ORG Thu Jul 9 16:39:28 2009 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 C20C11065696; Thu, 9 Jul 2009 16:39:28 +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 AFB638FC14; Thu, 9 Jul 2009 16:39:28 +0000 (UTC) (envelope-from rnoland@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n69GdSfx090851; Thu, 9 Jul 2009 16:39:28 GMT (envelope-from rnoland@svn.freebsd.org) Received: (from rnoland@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n69GdSfj090847; Thu, 9 Jul 2009 16:39:28 GMT (envelope-from rnoland@svn.freebsd.org) Message-Id: <200907091639.n69GdSfj090847@svn.freebsd.org> From: Robert Noland Date: Thu, 9 Jul 2009 16:39: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: r195501 - 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, 09 Jul 2009 16:39:29 -0000 Author: rnoland Date: Thu Jul 9 16:39:28 2009 New Revision: 195501 URL: http://svn.freebsd.org/changeset/base/195501 Log: Add support for Radeon HD 4770 (RV740) chips. Approved by: re@ (kib) MFC after: 3 days Modified: head/sys/dev/drm/drm_pciids.h head/sys/dev/drm/r600_cp.c head/sys/dev/drm/radeon_drv.h Modified: head/sys/dev/drm/drm_pciids.h ============================================================================== --- head/sys/dev/drm/drm_pciids.h Thu Jul 9 15:41:17 2009 (r195500) +++ head/sys/dev/drm/drm_pciids.h Thu Jul 9 16:39:28 2009 (r195501) @@ -257,6 +257,11 @@ {0x1002, 0x940A, CHIP_R600|RADEON_NEW_MEMMAP, "ATI FireGL V8650"}, \ {0x1002, 0x940B, CHIP_R600|RADEON_NEW_MEMMAP, "ATI FireGL V8600"}, \ {0x1002, 0x940F, CHIP_R600|RADEON_NEW_MEMMAP, "ATI FireGL V7600"}, \ + {0x1002, 0x94A0, CHIP_RV740|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP, "ATI Mobility Radeon HD 4830"}, \ + {0x1002, 0x94A1, CHIP_RV740|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP, "ATI Mobility Radeon HD 4850"}, \ + {0x1002, 0x94B1, CHIP_RV740|RADEON_NEW_MEMMAP, "ATI RV740"}, \ + {0x1002, 0x94B3, CHIP_RV740|RADEON_NEW_MEMMAP, "ATI Radeon HD 4770"}, \ + {0x1002, 0x94B5, CHIP_RV740|RADEON_NEW_MEMMAP, "ATI Radeon HD 4770"}, \ {0x1002, 0x94C0, CHIP_RV610|RADEON_NEW_MEMMAP, "RV610"}, \ {0x1002, 0x94C1, CHIP_RV610|RADEON_NEW_MEMMAP, "Radeon HD 2400 XT"}, \ {0x1002, 0x94C3, CHIP_RV610|RADEON_NEW_MEMMAP, "Radeon HD 2400 Pro"}, \ Modified: head/sys/dev/drm/r600_cp.c ============================================================================== --- head/sys/dev/drm/r600_cp.c Thu Jul 9 15:41:17 2009 (r195500) +++ head/sys/dev/drm/r600_cp.c Thu Jul 9 16:39:28 2009 (r195501) @@ -421,7 +421,8 @@ static void r700_cp_load_microcode(drm_r cp = RV770_cp_microcode; break; case CHIP_RV730: - DRM_INFO("Loading RV730 Microcode\n"); + case CHIP_RV740: + DRM_INFO("Loading RV730/RV740 Microcode\n"); pfp = RV730_pfp_microcode; cp = RV730_cp_microcode; break; @@ -1244,6 +1245,31 @@ static void r700_gfx_init(struct drm_dev dev_priv->r700_sc_hiz_tile_fifo_size = 0x30; dev_priv->r700_sc_earlyz_tile_fifo_fize = 0x130; break; + case CHIP_RV740: + dev_priv->r600_max_pipes = 4; + dev_priv->r600_max_tile_pipes = 4; + dev_priv->r600_max_simds = 8; + dev_priv->r600_max_backends = 4; + dev_priv->r600_max_gprs = 256; + dev_priv->r600_max_threads = 248; + dev_priv->r600_max_stack_entries = 512; + dev_priv->r600_max_hw_contexts = 8; + dev_priv->r600_max_gs_threads = 16 * 2; + dev_priv->r600_sx_max_export_size = 256; + dev_priv->r600_sx_max_export_pos_size = 32; + dev_priv->r600_sx_max_export_smx_size = 224; + dev_priv->r600_sq_num_cf_insts = 2; + + dev_priv->r700_sx_num_of_sets = 7; + dev_priv->r700_sc_prim_fifo_size = 0x100; + dev_priv->r700_sc_hiz_tile_fifo_size = 0x30; + dev_priv->r700_sc_earlyz_tile_fifo_fize = 0x130; + + if (dev_priv->r600_sx_max_export_pos_size > 16) { + dev_priv->r600_sx_max_export_pos_size -= 16; + dev_priv->r600_sx_max_export_smx_size += 16; + } + break; case CHIP_RV730: dev_priv->r600_max_pipes = 2; dev_priv->r600_max_tile_pipes = 4; @@ -1263,6 +1289,11 @@ static void r700_gfx_init(struct drm_dev dev_priv->r700_sc_prim_fifo_size = 0xf9; dev_priv->r700_sc_hiz_tile_fifo_size = 0x30; dev_priv->r700_sc_earlyz_tile_fifo_fize = 0x130; + + if (dev_priv->r600_sx_max_export_pos_size > 16) { + dev_priv->r600_sx_max_export_pos_size -= 16; + dev_priv->r600_sx_max_export_smx_size += 16; + } break; case CHIP_RV710: dev_priv->r600_max_pipes = 2; @@ -1430,6 +1461,7 @@ static void r700_gfx_init(struct drm_dev case CHIP_RV770: sq_ms_fifo_sizes |= R600_FETCH_FIFO_HIWATER(0x1); break; + case CHIP_RV740: case CHIP_RV730: case CHIP_RV710: default: @@ -1507,6 +1539,7 @@ static void r700_gfx_init(struct drm_dev switch (dev_priv->flags & RADEON_FAMILY_MASK) { case CHIP_RV770: + case CHIP_RV740: case CHIP_RV730: gs_prim_buffer_depth = 384; break; Modified: head/sys/dev/drm/radeon_drv.h ============================================================================== --- head/sys/dev/drm/radeon_drv.h Thu Jul 9 15:41:17 2009 (r195500) +++ head/sys/dev/drm/radeon_drv.h Thu Jul 9 16:39:28 2009 (r195501) @@ -146,6 +146,7 @@ enum radeon_family { CHIP_RV670, CHIP_RS780, CHIP_RV770, + CHIP_RV740, CHIP_RV730, CHIP_RV710, CHIP_LAST, From owner-svn-src-head@FreeBSD.ORG Thu Jul 9 16:40:00 2009 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 A02521065778; Thu, 9 Jul 2009 16:40:00 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 818DA8FC1B; Thu, 9 Jul 2009 16:40:00 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n69Ge0U0090904; Thu, 9 Jul 2009 16:40:00 GMT (envelope-from trasz@svn.freebsd.org) Received: (from trasz@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n69Ge09M090898; Thu, 9 Jul 2009 16:40:00 GMT (envelope-from trasz@svn.freebsd.org) Message-Id: <200907091640.n69Ge09M090898@svn.freebsd.org> From: Edward Tomasz Napierala Date: Thu, 9 Jul 2009 16:40: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: r195502 - in head: bin/ps share/man/man5 usr.bin/fstat usr.bin/netstat usr.bin/sockstat 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, 09 Jul 2009 16:40:02 -0000 Author: trasz Date: Thu Jul 9 16:40:00 2009 New Revision: 195502 URL: http://svn.freebsd.org/changeset/base/195502 Log: Add manual page links to advertise procstat(1) a little better. Approved by: re (kib) Modified: head/bin/ps/ps.1 head/share/man/man5/procfs.5 head/usr.bin/fstat/fstat.1 head/usr.bin/netstat/netstat.1 head/usr.bin/sockstat/sockstat.1 Modified: head/bin/ps/ps.1 ============================================================================== --- head/bin/ps/ps.1 Thu Jul 9 16:39:28 2009 (r195501) +++ head/bin/ps/ps.1 Thu Jul 9 16:40:00 2009 (r195502) @@ -29,7 +29,7 @@ .\" @(#)ps.1 8.3 (Berkeley) 4/18/94 .\" $FreeBSD$ .\" -.Dd May 16, 2009 +.Dd July 9, 2009 .Dt PS 1 .Os .Sh NAME @@ -637,6 +637,7 @@ the mount point of .Xr kill 1 , .Xr pgrep 1 , .Xr pkill 1 , +.Xr procstat 1 , .Xr w 1 , .Xr kvm 3 , .Xr strftime 3 , Modified: head/share/man/man5/procfs.5 ============================================================================== --- head/share/man/man5/procfs.5 Thu Jul 9 16:39:28 2009 (r195501) +++ head/share/man/man5/procfs.5 Thu Jul 9 16:40:00 2009 (r195502) @@ -2,7 +2,7 @@ .\" Written by Garrett Wollman .\" This file is in the public domain. .\" -.Dd September 3, 2004 +.Dd July 9, 2009 .Dt PROCFS 5 .Os .Sh NAME @@ -252,6 +252,7 @@ file system on .Pp .Dl "mount -t procfs proc /proc" .Sh SEE ALSO +.Xr procstat 1 , .Xr mount 2 , .Xr sigaction 2 , .Xr unmount 2 , Modified: head/usr.bin/fstat/fstat.1 ============================================================================== --- head/usr.bin/fstat/fstat.1 Thu Jul 9 16:39:28 2009 (r195501) +++ head/usr.bin/fstat/fstat.1 Thu Jul 9 16:40:00 2009 (r195502) @@ -32,7 +32,7 @@ .\" @(#)fstat.1 8.3 (Berkeley) 2/25/94 .\" $FreeBSD$ .\" -.Dd March 27, 2002 +.Dd July 9, 2009 .Dt FSTAT 1 .Os .Sh NAME @@ -216,6 +216,7 @@ an arrow (``<-'' or ``->''), and a full .Sh SEE ALSO .Xr netstat 1 , .Xr nfsstat 1 , +.Xr procstat 1 , .Xr ps 1 , .Xr sockstat 1 , .Xr systat 1 , Modified: head/usr.bin/netstat/netstat.1 ============================================================================== --- head/usr.bin/netstat/netstat.1 Thu Jul 9 16:39:28 2009 (r195501) +++ head/usr.bin/netstat/netstat.1 Thu Jul 9 16:40:00 2009 (r195502) @@ -32,7 +32,7 @@ .\" @(#)netstat.1 8.8 (Berkeley) 4/18/94 .\" $FreeBSD$ .\" -.Dd February 15, 2009 +.Dd July 9, 2009 .Dt NETSTAT 1 .Os .Sh NAME @@ -490,6 +490,7 @@ queue. .Sh SEE ALSO .Xr fstat 1 , .Xr nfsstat 1 , +.Xr procstat 1 , .Xr ps 1 , .Xr sockstat 1 , .Xr bpf 4 , Modified: head/usr.bin/sockstat/sockstat.1 ============================================================================== --- head/usr.bin/sockstat/sockstat.1 Thu Jul 9 16:39:28 2009 (r195501) +++ head/usr.bin/sockstat/sockstat.1 Thu Jul 9 16:40:00 2009 (r195502) @@ -27,7 +27,7 @@ .\" .\" $FreeBSD$ .\" -.Dd May 18, 2008 +.Dd July 9, 2009 .Dt SOCKSTAT 1 .Os .Sh NAME @@ -153,6 +153,7 @@ to examine them instead. .Sh SEE ALSO .Xr fstat 1 , .Xr netstat 1 , +.Xr procstat 1 , .Xr inet 4 , .Xr inet6 4 , .Xr protocols 5 From owner-svn-src-head@FreeBSD.ORG Thu Jul 9 16:59:30 2009 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 291B1106564A; Thu, 9 Jul 2009 16:59:30 +0000 (UTC) (envelope-from joel@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 176288FC14; Thu, 9 Jul 2009 16:59:30 +0000 (UTC) (envelope-from joel@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n69GxTHT091364; Thu, 9 Jul 2009 16:59:29 GMT (envelope-from joel@svn.freebsd.org) Received: (from joel@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n69GxTlO091362; Thu, 9 Jul 2009 16:59:29 GMT (envelope-from joel@svn.freebsd.org) Message-Id: <200907091659.n69GxTlO091362@svn.freebsd.org> From: Joel Dahl Date: Thu, 9 Jul 2009 16:59: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: r195503 - head/share/man/man4 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, 09 Jul 2009 16:59:30 -0000 Author: joel (doc committer) Date: Thu Jul 9 16:59:29 2009 New Revision: 195503 URL: http://svn.freebsd.org/changeset/base/195503 Log: Adjust the description of hw.snd.feeder_rate_polyphase_max and hw.snd.compat_linux_mmap a bit. Submitted by: ariff Approved by: re (blanket) Modified: head/share/man/man4/pcm.4 Modified: head/share/man/man4/pcm.4 ============================================================================== --- head/share/man/man4/pcm.4 Thu Jul 9 16:40:00 2009 (r195502) +++ head/share/man/man4/pcm.4 Thu Jul 9 16:59:29 2009 (r195503) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd July 7, 2009 +.Dd July 9, 2009 .Dt SOUND 4 .Os .Sh NAME @@ -210,10 +210,22 @@ are global settings and are device specific. .Bl -tag -width indent .It Va hw.snd.compat_linux_mmap -Enable to allow PROT_EXEC page mappings. -All Linux applications using sound and +Linux .Xr mmap 2 -require this. +compability. +The following values are supported (default is 0): +.Bl -tag -width 2n +.It -1 +Force disabling/denying PROT_EXEC +.Xr mmap 2 +requests. +.It 0 +Auto detect proc/ABI type, allow +.Xr mmap 2 +for Linux applications, and deny for everything else. +.It 1 +Always allow PROT_EXEC page mappings. +.El .It Va hw.snd.default_auto Enable to automatically assign default sound unit to the most recent attached device. @@ -240,6 +252,8 @@ Minimum allowable sample rate. .It Va hw.snd.feeder_rate_polyphase_max Adjust to set the maximum number of allowed polyphase entries during the process of building resampling filters. +Disabling polyphase resampling has the benefit of reducing memory usage, at +the expense of slower and lower quality conversion. Only applicable when the SINC interpolator is used. Default value is 183040. Set to 0 to disable polyphase resampling. From owner-svn-src-head@FreeBSD.ORG Thu Jul 9 17:30:48 2009 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 5AF5C10656D5; Thu, 9 Jul 2009 17:30:48 +0000 (UTC) (envelope-from jilles@stack.nl) Received: from mx1.stack.nl (relay04.stack.nl [IPv6:2001:610:1108:5010::107]) by mx1.freebsd.org (Postfix) with ESMTP id D3B428FC18; Thu, 9 Jul 2009 17:30:47 +0000 (UTC) (envelope-from jilles@stack.nl) Received: from snail.stack.nl (snail.stack.nl [IPv6:2001:610:1108:5010::131]) by mx1.stack.nl (Postfix) with ESMTP id 8D9E0375831; Thu, 9 Jul 2009 19:30:46 +0200 (CEST) Received: by snail.stack.nl (Postfix, from userid 1677) id 7BA10228CC; Thu, 9 Jul 2009 19:30:46 +0200 (CEST) Date: Thu, 9 Jul 2009 19:30:46 +0200 From: Jilles Tjoelker To: Edward Tomasz Napierala Message-ID: <20090709173046.GA48155@stack.nl> References: <200907081523.n68FNIpi055036@svn.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <200907081523.n68FNIpi055036@svn.freebsd.org> User-Agent: Mutt/1.5.18 (2008-05-17) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r195458 - in head: include lib/libc/sys sys/bsm sys/compat/freebsd32 sys/compat/svr4 sys/i386/ibcs2 sys/kern 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: Thu, 09 Jul 2009 17:30:49 -0000 On Wed, Jul 08, 2009 at 03:23:18PM +0000, Edward Tomasz Napierala wrote: > Author: trasz > Date: Wed Jul 8 15:23:18 2009 > New Revision: 195458 > URL: http://svn.freebsd.org/changeset/base/195458 > Log: > There is an optimization in chmod(1), that makes it not to call chmod(2) > if the new file mode is the same as it was before; however, this > optimization must be disabled for filesystems that support NFSv4 ACLs. > Chmod uses pathconf(2) to determine whether this is the case - however, > pathconf(2) always follows symbolic links, while the 'chmod -h' doesn't. > This change adds lpathconf(3) to make it possible to solve that problem > in a clean way. I think pathconfat() would be nicer than adding a function that will not appear in standards and lacks a useful feature. Compare futimens() and utimensat() in the 2008 POSIX spec, and notice that there is no such thing as lutimes() in POSIX (it can be done with utimensat()). Another consideration is that lpathconf/pathconfat may be considered "new work". The problem I brought up can also be fixed by never using the optimization for symlinks. -- Jilles Tjoelker From owner-svn-src-head@FreeBSD.ORG Thu Jul 9 18:49:26 2009 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 81F5110656C1; Thu, 9 Jul 2009 18:49:26 +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 6F4CB8FC1B; Thu, 9 Jul 2009 18:49:26 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n69InQMJ093898; Thu, 9 Jul 2009 18:49:26 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n69InQDt093896; Thu, 9 Jul 2009 18:49:26 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <200907091849.n69InQDt093896@svn.freebsd.org> From: Konstantin Belousov Date: Thu, 9 Jul 2009 18:49: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: r195508 - 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: Thu, 09 Jul 2009 18:49:27 -0000 Author: kib Date: Thu Jul 9 18:49:26 2009 New Revision: 195508 URL: http://svn.freebsd.org/changeset/base/195508 Log: Extend the cn_flags field of the struct componentname to 64 bits to have more space for the flags, that is too close to be exhausted. While changing the KBI for name(9), use unsigned int for symlinks count. Suggested by: rwatson Approved by: re (kensmith) Modified: head/sys/sys/namei.h Modified: head/sys/sys/namei.h ============================================================================== --- head/sys/sys/namei.h Thu Jul 9 18:18:03 2009 (r195507) +++ head/sys/sys/namei.h Thu Jul 9 18:49:26 2009 (r195508) @@ -41,7 +41,7 @@ struct componentname { * Arguments to lookup. */ u_long cn_nameiop; /* namei operation */ - u_long cn_flags; /* flags to namei */ + u_int64_t cn_flags; /* flags to namei */ struct thread *cn_thread;/* thread requesting lookup */ struct ucred *cn_cred; /* credentials */ int cn_lkflags; /* Lock flags LK_EXCLUSIVE or LK_SHARED */ @@ -80,7 +80,7 @@ struct nameidata { */ size_t ni_pathlen; /* remaining chars in path */ char *ni_next; /* next location in pathname */ - u_long ni_loopcnt; /* count of symlinks encountered */ + u_int ni_loopcnt; /* count of symlinks encountered */ /* * Lookup parameters: this structure describes the subset of * information from the nameidata structure that is passed From owner-svn-src-head@FreeBSD.ORG Thu Jul 9 18:54:38 2009 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 E1F6D1065691; Thu, 9 Jul 2009 18:54:38 +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 CF7CE8FC14; Thu, 9 Jul 2009 18:54:38 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n69IscHd094061; Thu, 9 Jul 2009 18:54:38 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n69IscOQ094059; Thu, 9 Jul 2009 18:54:38 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <200907091854.n69IscOQ094059@svn.freebsd.org> From: Konstantin Belousov Date: Thu, 9 Jul 2009 18:54: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: r195509 - 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: Thu, 09 Jul 2009 18:54:40 -0000 Author: kib Date: Thu Jul 9 18:54:38 2009 New Revision: 195509 URL: http://svn.freebsd.org/changeset/base/195509 Log: The control terminal revocation at the session leader exit does not correctly checks for reclaimed vnode, possibly calling VOP_REVOKE for such vnode. If the terminal is already revoked, or devfs mount was forcibly unmounted, the revocation of doomed ctty vnode causes panic. Reported and tested by: lstewart Approved by: re (kensmith) MFC after: 2 weeks Modified: head/sys/kern/kern_exit.c Modified: head/sys/kern/kern_exit.c ============================================================================== --- head/sys/kern/kern_exit.c Thu Jul 9 18:49:26 2009 (r195508) +++ head/sys/kern/kern_exit.c Thu Jul 9 18:54:38 2009 (r195509) @@ -334,10 +334,11 @@ exit1(struct thread *td, int rv) tty_unlock(tp); } - if (ttyvp != NULL && ttyvp->v_type != VBAD) { + if (ttyvp != NULL) { sx_xunlock(&proctree_lock); - VOP_LOCK(ttyvp, LK_EXCLUSIVE); - VOP_REVOKE(ttyvp, REVOKEALL); + vn_lock(ttyvp, LK_EXCLUSIVE | LK_RETRY); + if (ttyvp->v_type != VBAD) + VOP_REVOKE(ttyvp, REVOKEALL); VOP_UNLOCK(ttyvp, 0); sx_xlock(&proctree_lock); } From owner-svn-src-head@FreeBSD.ORG Thu Jul 9 19:00:30 2009 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 2C2F81065670; Thu, 9 Jul 2009 19:00:30 +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 180AC8FC1E; Thu, 9 Jul 2009 19:00:30 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n69J0Uf9094243; Thu, 9 Jul 2009 19:00:30 GMT (envelope-from rmacklem@svn.freebsd.org) Received: (from rmacklem@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n69J0UaD094239; Thu, 9 Jul 2009 19:00:30 GMT (envelope-from rmacklem@svn.freebsd.org) Message-Id: <200907091900.n69J0UaD094239@svn.freebsd.org> From: Rick Macklem Date: Thu, 9 Jul 2009 19:00: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: r195510 - 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, 09 Jul 2009 19:00:30 -0000 Author: rmacklem Date: Thu Jul 9 19:00:29 2009 New Revision: 195510 URL: http://svn.freebsd.org/changeset/base/195510 Log: Since the nfscl_getclose() function both decremented open counts and, optionally, created a separate list of NFSv4 opens to be closed, it was possible for the associated OpenOwner to be free'd before the Open was closed. The problem was that the Open was taken off the OpenOwner list before the Close RPC was done and OpenOwners can be free'd once the list is empty. This patch separates out the case of doing the Close RPC into a separate function called nfscl_doclose() and simplifies nfsrpc_doclose() so that it closes a single open instead of a list of them. This avoids removing the Open from the OpenOwner list before doing the Close RPC. Approved by: re (kensmith), kib (mentor) Modified: head/sys/fs/nfs/nfs_var.h head/sys/fs/nfsclient/nfs_clrpcops.c head/sys/fs/nfsclient/nfs_clstate.c Modified: head/sys/fs/nfs/nfs_var.h ============================================================================== --- head/sys/fs/nfs/nfs_var.h Thu Jul 9 18:54:38 2009 (r195509) +++ head/sys/fs/nfs/nfs_var.h Thu Jul 9 19:00:29 2009 (r195510) @@ -457,7 +457,9 @@ void nfscl_initiate_recovery(struct nfsc int nfscl_hasexpired(struct nfsclclient *, u_int32_t, NFSPROC_T *); void nfscl_dumpstate(struct nfsmount *, int, int, int, int); void nfscl_dupopen(vnode_t, int); -int nfscl_getclose(vnode_t, struct nfsclclient **, struct nfsclopenhead *); +int nfscl_getclose(vnode_t, struct nfsclclient **); +int nfscl_doclose(vnode_t, struct nfsclclient **, NFSPROC_T *); +void nfsrpc_doclose(struct nfsmount *, struct nfsclopen *, NFSPROC_T *); int nfscl_deleg(mount_t, struct nfsclclient *, u_int8_t *, int, struct ucred *, NFSPROC_T *, struct nfscldeleg **); void nfscl_lockinit(struct nfsv4lock *); Modified: head/sys/fs/nfsclient/nfs_clrpcops.c ============================================================================== --- head/sys/fs/nfsclient/nfs_clrpcops.c Thu Jul 9 18:54:38 2009 (r195509) +++ head/sys/fs/nfsclient/nfs_clrpcops.c Thu Jul 9 19:00:29 2009 (r195510) @@ -81,8 +81,6 @@ static int nfsrpc_createv4(vnode_t , cha static int nfsrpc_locku(struct nfsrv_descript *, struct nfsmount *, struct nfscllockowner *, u_int64_t, u_int64_t, u_int32_t, struct ucred *, NFSPROC_T *, int); -static void nfsrpc_doclose(struct nfsmount *, struct nfsclopenhead *, - NFSPROC_T *); #ifdef NFS4_ACL_EXTATTR_NAME static int nfsrpc_setaclrpc(vnode_t, struct ucred *, NFSPROC_T *, struct acl *, nfsv4stateid_t *, void *); @@ -553,119 +551,117 @@ APPLESTATIC int nfsrpc_close(vnode_t vp, int doclose, NFSPROC_T *p) { struct nfsclclient *clp; - struct nfsclopenhead oh; int error; if (vnode_vtype(vp) != VREG) return (0); if (doclose) - error = nfscl_getclose(vp, &clp, &oh); + error = nfscl_doclose(vp, &clp, p); else - error = nfscl_getclose(vp, &clp, NULL); + error = nfscl_getclose(vp, &clp); if (error) return (error); - if (doclose && !LIST_EMPTY(&oh)) - nfsrpc_doclose(VFSTONFS(vnode_mount(vp)), &oh, p); nfscl_clientrelease(clp); return (0); } /* - * Close/free all the opens in the list. + * Close the open. */ -static void -nfsrpc_doclose(struct nfsmount *nmp, struct nfsclopenhead *ohp, NFSPROC_T *p) +APPLESTATIC void +nfsrpc_doclose(struct nfsmount *nmp, struct nfsclopen *op, NFSPROC_T *p) { struct nfsrv_descript nfsd, *nd = &nfsd; - struct nfsclopen *op, *nop; struct nfscllockowner *lp; struct nfscllock *lop, *nlop; struct ucred *tcred; u_int64_t off = 0, len = 0; u_int32_t type = NFSV4LOCKT_READ; - int error; + int error, do_unlock, trycnt; tcred = newnfs_getcred(); - op = LIST_FIRST(ohp); - while (op != NULL) { - nop = LIST_NEXT(op, nfso_list); - newnfs_copycred(&op->nfso_cred, tcred); - /* - * (Theoretically this could be done in the same - * compound as the close, but having multiple - * sequenced Ops in the same compound might be - * too scary for some servers.) - */ - if (op->nfso_posixlock) { - off = 0; - len = NFS64BITSSET; - type = NFSV4LOCKT_READ; - } - LIST_FOREACH(lp, &op->nfso_lock, nfsl_list) { - lop = LIST_FIRST(&lp->nfsl_lock); - while (lop != NULL) { - nlop = LIST_NEXT(lop, nfslo_list); + newnfs_copycred(&op->nfso_cred, tcred); + /* + * (Theoretically this could be done in the same + * compound as the close, but having multiple + * sequenced Ops in the same compound might be + * too scary for some servers.) + */ + if (op->nfso_posixlock) { + off = 0; + len = NFS64BITSSET; + type = NFSV4LOCKT_READ; + } + + /* + * Since this function is only called from VOP_INACTIVE(), no + * other thread will be manipulating this Open. As such, the + * lock lists are not being changed by other threads, so it should + * be safe to do this without locking. + */ + LIST_FOREACH(lp, &op->nfso_lock, nfsl_list) { + do_unlock = 1; + LIST_FOREACH_SAFE(lop, &lp->nfsl_lock, nfslo_list, nlop) { if (op->nfso_posixlock == 0) { - off = lop->nfslo_first; - len = lop->nfslo_end - lop->nfslo_first; - if (lop->nfslo_type == F_WRLCK) - type = NFSV4LOCKT_WRITE; - else - type = NFSV4LOCKT_READ; + off = lop->nfslo_first; + len = lop->nfslo_end - lop->nfslo_first; + if (lop->nfslo_type == F_WRLCK) + type = NFSV4LOCKT_WRITE; + else + type = NFSV4LOCKT_READ; } - if (lop == LIST_FIRST(&lp->nfsl_lock) || - op->nfso_posixlock == 0) { - NFSLOCKCLSTATE(); - nfscl_lockexcl(&lp->nfsl_rwlock, - NFSCLSTATEMUTEXPTR); - NFSUNLOCKCLSTATE(); - do { - error = nfsrpc_locku(nd, nmp, lp, off, len, - type, tcred, p, 0); - if ((nd->nd_repstat == NFSERR_GRACE || - nd->nd_repstat == NFSERR_DELAY) && - error == 0) - (void) nfs_catnap(PZERO, "nfs_close"); - } while ((nd->nd_repstat == NFSERR_GRACE || - nd->nd_repstat == NFSERR_DELAY) && error == 0); - NFSLOCKCLSTATE(); - nfscl_lockunlock(&lp->nfsl_rwlock); - NFSUNLOCKCLSTATE(); + if (do_unlock) { + trycnt = 0; + do { + error = nfsrpc_locku(nd, nmp, lp, off, + len, type, tcred, p, 0); + if ((nd->nd_repstat == NFSERR_GRACE || + nd->nd_repstat == NFSERR_DELAY) && + error == 0) + (void) nfs_catnap(PZERO, + "nfs_close"); + } while ((nd->nd_repstat == NFSERR_GRACE || + nd->nd_repstat == NFSERR_DELAY) && + error == 0 && trycnt++ < 5); + if (op->nfso_posixlock) + do_unlock = 0; } nfscl_freelock(lop, 0); - lop = nlop; - } } - NFSLOCKCLSTATE(); - nfscl_lockexcl(&op->nfso_own->nfsow_rwlock, NFSCLSTATEMUTEXPTR); - NFSUNLOCKCLSTATE(); - do { - error = nfscl_tryclose(op, tcred, nmp, p); - if (error == NFSERR_GRACE) - (void) nfs_catnap(PZERO, "nfs_close"); - } while (error == NFSERR_GRACE); - NFSLOCKCLSTATE(); - nfscl_lockunlock(&op->nfso_own->nfsow_rwlock); - NFSUNLOCKCLSTATE(); + } - /* - * Move the lockowner to nfsc_defunctlockowner, - * so the Renew thread will do the ReleaseLockOwner - * Op on it later. There might still be other - * opens using the same lockowner name. - */ - lp = LIST_FIRST(&op->nfso_lock); - if (lp != NULL) { - while (LIST_NEXT(lp, nfsl_list) != NULL) + /* + * There could be other Opens for different files on the same + * OpenOwner, so locking is required. + */ + NFSLOCKCLSTATE(); + nfscl_lockexcl(&op->nfso_own->nfsow_rwlock, NFSCLSTATEMUTEXPTR); + NFSUNLOCKCLSTATE(); + do { + error = nfscl_tryclose(op, tcred, nmp, p); + if (error == NFSERR_GRACE) + (void) nfs_catnap(PZERO, "nfs_close"); + } while (error == NFSERR_GRACE); + NFSLOCKCLSTATE(); + nfscl_lockunlock(&op->nfso_own->nfsow_rwlock); + + /* + * Move the lockowner to nfsc_defunctlockowner, + * so the Renew thread will do the ReleaseLockOwner + * Op on it later. There might still be other + * opens using the same lockowner name. + */ + lp = LIST_FIRST(&op->nfso_lock); + if (lp != NULL) { + while (LIST_NEXT(lp, nfsl_list) != NULL) lp = LIST_NEXT(lp, nfsl_list); - LIST_PREPEND(&nmp->nm_clp->nfsc_defunctlockowner, - &op->nfso_lock, lp, nfsl_list); - LIST_INIT(&op->nfso_lock); - } - nfscl_freeopen(op, 0); - op = nop; + LIST_PREPEND(&nmp->nm_clp->nfsc_defunctlockowner, + &op->nfso_lock, lp, nfsl_list); + LIST_INIT(&op->nfso_lock); } + nfscl_freeopen(op, 0); + NFSUNLOCKCLSTATE(); NFSFREECRED(tcred); } Modified: head/sys/fs/nfsclient/nfs_clstate.c ============================================================================== --- head/sys/fs/nfsclient/nfs_clstate.c Thu Jul 9 18:54:38 2009 (r195509) +++ head/sys/fs/nfsclient/nfs_clstate.c Thu Jul 9 19:00:29 2009 (r195510) @@ -450,7 +450,7 @@ nfscl_getstateid(vnode_t vp, u_int8_t *n { struct nfsclclient *clp; struct nfsclowner *owp; - struct nfsclopen *op; + struct nfsclopen *op = NULL; struct nfscllockowner *lp; struct nfscldeleg *dp; struct nfsnode *np; @@ -512,40 +512,40 @@ nfscl_getstateid(vnode_t vp, u_int8_t *n nfscl_filllockowner(p, own); error = nfscl_getopen(&clp->nfsc_owner, nfhp, fhlen, NULL, p, mode, NULL, &op); - if (error) { - NFSUNLOCKCLSTATE(); - return (error); - } - - /* now look for a lockowner */ - LIST_FOREACH(lp, &op->nfso_lock, nfsl_list) { - if (!NFSBCMP(lp->nfsl_owner, own, NFSV4CL_LOCKNAMELEN)) { - stateidp->seqid = lp->nfsl_stateid.seqid; - stateidp->other[0] = lp->nfsl_stateid.other[0]; - stateidp->other[1] = lp->nfsl_stateid.other[1]; - stateidp->other[2] = lp->nfsl_stateid.other[2]; - NFSUNLOCKCLSTATE(); - return (0); - } + if (error == 0) { + /* now look for a lockowner */ + LIST_FOREACH(lp, &op->nfso_lock, nfsl_list) { + if (!NFSBCMP(lp->nfsl_owner, own, + NFSV4CL_LOCKNAMELEN)) { + stateidp->seqid = + lp->nfsl_stateid.seqid; + stateidp->other[0] = + lp->nfsl_stateid.other[0]; + stateidp->other[1] = + lp->nfsl_stateid.other[1]; + stateidp->other[2] = + lp->nfsl_stateid.other[2]; + NFSUNLOCKCLSTATE(); + return (0); + } + } } - } else { - /* - * If p == NULL, it is a read ahead or write behind, - * so just look for any OpenOwner that will work. - */ + } + if (op == NULL) { + /* If not found, just look for any OpenOwner that will work. */ done = 0; owp = LIST_FIRST(&clp->nfsc_owner); while (!done && owp != NULL) { - LIST_FOREACH(op, &owp->nfsow_open, nfso_list) { - if (op->nfso_fhlen == fhlen && - !NFSBCMP(op->nfso_fh, nfhp, fhlen) && - (mode & op->nfso_mode) == mode) { - done = 1; - break; + LIST_FOREACH(op, &owp->nfsow_open, nfso_list) { + if (op->nfso_fhlen == fhlen && + !NFSBCMP(op->nfso_fh, nfhp, fhlen) && + (mode & op->nfso_mode) == mode) { + done = 1; + break; + } } - } - if (!done) - owp = LIST_NEXT(owp, nfsow_list); + if (!done) + owp = LIST_NEXT(owp, nfsow_list); } if (!done) { NFSUNLOCKCLSTATE(); @@ -2752,33 +2752,30 @@ nfscl_dupopen(vnode_t vp, int dupopens) /* * During close, find an open that needs to be dereferenced and * dereference it. If there are no more opens for this file, - * return the list of opens, so they can be closed on the - * server. As such, opens aren't closed on the server until - * all the opens for the file are closed off. + * log a message to that effect. + * Opens aren't actually Close'd until VOP_INACTIVE() is performed + * on the file's vnode. * This is the safe way, since it is difficult to identify - * which open the close is for. + * which open the close is for and I/O can be performed after the + * close(2) system call when a file is mmap'd. * If it returns 0 for success, there will be a referenced - * clp returned via clpp and a list of opens to close/free - * on ohp. + * clp returned via clpp. */ APPLESTATIC int -nfscl_getclose(vnode_t vp, struct nfsclclient **clpp, - struct nfsclopenhead *ohp) +nfscl_getclose(vnode_t vp, struct nfsclclient **clpp) { struct nfsclclient *clp; - struct nfsclowner *owp, *nowp; - struct nfsclopen *op, *nop; + struct nfsclowner *owp; + struct nfsclopen *op; struct nfscldeleg *dp; struct nfsfh *nfhp; - int error, notdecr, candelete; + int error, notdecr; error = nfscl_getcl(vp, NULL, NULL, &clp); if (error) return (error); *clpp = clp; - if (ohp != NULL) - LIST_INIT(ohp); nfhp = VTONFS(vp)->n_fhp; notdecr = 1; NFSLOCKCLSTATE(); @@ -2788,7 +2785,7 @@ nfscl_getclose(vnode_t vp, struct nfsclc * the server are DENY_NONE, I don't see a problem with hanging * onto them. (It is much easier to use one of the extant Opens * that I already have on the server when a Delegation is recalled - * than to do fresh Opens.) Someday, I might need to rethink this, but.. + * than to do fresh Opens.) Someday, I might need to rethink this, but. */ dp = nfscl_finddeleg(clp, nfhp->nfh_fh, nfhp->nfh_len); if (dp != NULL) { @@ -2813,9 +2810,7 @@ nfscl_getclose(vnode_t vp, struct nfsclc /* Now process the opens against the server. */ LIST_FOREACH(owp, &clp->nfsc_owner, nfsow_list) { - op = LIST_FIRST(&owp->nfsow_open); - while (op != NULL) { - nop = LIST_NEXT(op, nfso_list); + LIST_FOREACH(op, &owp->nfsow_open, nfso_list) { if (op->nfso_fhlen == nfhp->nfh_len && !NFSBCMP(op->nfso_fh, nfhp->nfh_fh, nfhp->nfh_len)) { @@ -2825,74 +2820,76 @@ nfscl_getclose(vnode_t vp, struct nfsclc op->nfso_opencnt--; } /* - * There are more opens, so just return after - * putting any opens already found back in the - * state list. + * There are more opens, so just return. */ if (op->nfso_opencnt > 0) { - if (ohp != NULL) { - /* Reattach open until later */ - op = LIST_FIRST(ohp); - while (op != NULL) { - nop = LIST_NEXT(op, nfso_list); - LIST_REMOVE(op, nfso_list); - LIST_INSERT_HEAD( - &op->nfso_own->nfsow_open, - op, nfso_list); - op = nop; - } - LIST_INIT(ohp); - } NFSUNLOCKCLSTATE(); return (0); } - - /* - * Move this entry to the list of opens to be - * returned. (If we find other open(s) still in - * use, it will be put back in the state list - * in the code just above.) - */ - if (ohp != NULL) { - LIST_REMOVE(op, nfso_list); - LIST_INSERT_HEAD(ohp, op, nfso_list); - } } - op = nop; } } + NFSUNLOCKCLSTATE(); + if (notdecr) + printf("nfscl: never fnd open\n"); + return (0); +} - if (dp != NULL && ohp != NULL) { - /* - * If we are flushing all writes against the server for this - * file upon close, we do not need to keep the local opens - * (against the delegation) if they all have an opencnt == 0, - * since there are now no opens on the file and no dirty blocks. - * If the writes aren't being flushed upon close, - * a test for "no dirty blocks to write back" would have to - * be added to this code. - */ - candelete = 1; - LIST_FOREACH(owp, &dp->nfsdl_owner, nfsow_list) { +APPLESTATIC int +nfscl_doclose(vnode_t vp, struct nfsclclient **clpp, NFSPROC_T *p) +{ + struct nfsclclient *clp; + struct nfsclowner *owp, *nowp; + struct nfsclopen *op; + struct nfscldeleg *dp; + struct nfsfh *nfhp; + int error; + + error = nfscl_getcl(vp, NULL, NULL, &clp); + if (error) + return (error); + *clpp = clp; + + nfhp = VTONFS(vp)->n_fhp; + NFSLOCKCLSTATE(); + /* + * First get rid of the local Open structures, which should be no + * longer in use. + */ + dp = nfscl_finddeleg(clp, nfhp->nfh_fh, nfhp->nfh_len); + if (dp != NULL) { + LIST_FOREACH_SAFE(owp, &dp->nfsdl_owner, nfsow_list, nowp) { op = LIST_FIRST(&owp->nfsow_open); - if (op != NULL && op->nfso_opencnt > 0) { - candelete = 0; - break; + if (op != NULL) { + KASSERT((op->nfso_opencnt == 0), + ("nfscl: bad open cnt on deleg")); + nfscl_freeopen(op, 1); } + nfscl_freeopenowner(owp, 1); } - if (candelete) { - LIST_FOREACH_SAFE(owp, &dp->nfsdl_owner, nfsow_list, - nowp) { - op = LIST_FIRST(&owp->nfsow_open); - if (op != NULL) - nfscl_freeopen(op, 1); - nfscl_freeopenowner(owp, 1); + } + + /* Now process the opens against the server. */ +lookformore: + LIST_FOREACH(owp, &clp->nfsc_owner, nfsow_list) { + op = LIST_FIRST(&owp->nfsow_open); + while (op != NULL) { + if (op->nfso_fhlen == nfhp->nfh_len && + !NFSBCMP(op->nfso_fh, nfhp->nfh_fh, + nfhp->nfh_len)) { + /* Found an open, close it. */ + KASSERT((op->nfso_opencnt == 0), + ("nfscl: bad open cnt on server")); + NFSUNLOCKCLSTATE(); + nfsrpc_doclose(VFSTONFS(vnode_mount(vp)), op, + p); + NFSLOCKCLSTATE(); + goto lookformore; } + op = LIST_NEXT(op, nfso_list); } } NFSUNLOCKCLSTATE(); - if (notdecr && ohp == NULL) - printf("nfscl: never fnd open\n"); return (0); } From owner-svn-src-head@FreeBSD.ORG Thu Jul 9 19:27:58 2009 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 5DB5B1065674; Thu, 9 Jul 2009 19:27:58 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 4AF538FC08; Thu, 9 Jul 2009 19:27:58 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n69JRwqa094874; Thu, 9 Jul 2009 19:27:58 GMT (envelope-from np@svn.freebsd.org) Received: (from np@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n69JRwVC094872; Thu, 9 Jul 2009 19:27:58 GMT (envelope-from np@svn.freebsd.org) Message-Id: <200907091927.n69JRwVC094872@svn.freebsd.org> From: Navdeep Parhar Date: Thu, 9 Jul 2009 19:27: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: r195512 - head/sys/dev/cxgb 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, 09 Jul 2009 19:27:59 -0000 Author: np Date: Thu Jul 9 19:27:58 2009 New Revision: 195512 URL: http://svn.freebsd.org/changeset/base/195512 Log: Fix cxgb(4) panic with jumbo frames. Reviewed by: kmacy Approved by: re (kib), gnn (mentor) Modified: head/sys/dev/cxgb/cxgb_sge.c Modified: head/sys/dev/cxgb/cxgb_sge.c ============================================================================== --- head/sys/dev/cxgb/cxgb_sge.c Thu Jul 9 19:02:17 2009 (r195511) +++ head/sys/dev/cxgb/cxgb_sge.c Thu Jul 9 19:27:58 2009 (r195512) @@ -2865,15 +2865,14 @@ get_packet(adapter_t *adap, unsigned int if ((sopeop == RSPQ_SOP_EOP) || (sopeop == RSPQ_SOP)) flags |= M_PKTHDR; + m_init(m, fl->zone, fl->buf_size, M_NOWAIT, MT_DATA, flags); if (fl->zone == zone_pack) { - m_init(m, zone_pack, MCLBYTES, M_NOWAIT, MT_DATA, flags); /* * restore clobbered data pointer */ m->m_data = m->m_ext.ext_buf; } else { m_cljset(m, cl, fl->type); - m->m_flags = flags; } m->m_len = len; } From owner-svn-src-head@FreeBSD.ORG Thu Jul 9 20:22:05 2009 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 C9F161065670; Thu, 9 Jul 2009 20:22:05 +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 9BBDF8FC14; Thu, 9 Jul 2009 20:22:05 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n69KM5Nn096181; Thu, 9 Jul 2009 20:22:05 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n69KM5Pq096177; Thu, 9 Jul 2009 20:22:05 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <200907092022.n69KM5Pq096177@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Thu, 9 Jul 2009 20:22: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: r195515 - in head/cddl/contrib/opensolaris: head lib/libzpool/common lib/libzpool/common/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: Thu, 09 Jul 2009 20:22:06 -0000 Author: pjd Date: Thu Jul 9 20:22:05 2009 New Revision: 195515 URL: http://svn.freebsd.org/changeset/base/195515 Log: The mutex_owned() macro should operate on kmutex_t and not on mutex_t. This fixes 'zdb ' crash. Reported by: avg Approved by: re (kib) Modified: head/cddl/contrib/opensolaris/head/thread.h head/cddl/contrib/opensolaris/lib/libzpool/common/kernel.c head/cddl/contrib/opensolaris/lib/libzpool/common/sys/zfs_context.h Modified: head/cddl/contrib/opensolaris/head/thread.h ============================================================================== --- head/cddl/contrib/opensolaris/head/thread.h Thu Jul 9 20:16:01 2009 (r195514) +++ head/cddl/contrib/opensolaris/head/thread.h Thu Jul 9 20:22:05 2009 (r195515) @@ -53,7 +53,6 @@ typedef pthread_rwlock_t rwlock_t; #define mutex_lock(l) pthread_mutex_lock(l) #define mutex_trylock(l) pthread_mutex_trylock(l) #define mutex_unlock(l) pthread_mutex_unlock(l) -#define mutex_owned(l) pthread_mutex_isowned_np(l) #define rwlock_init(l,f,a) pthread_rwlock_init(l,NULL) #define rwlock_destroy(l) pthread_rwlock_destroy(l) #define rw_rdlock(l) pthread_rwlock_rdlock(l) Modified: head/cddl/contrib/opensolaris/lib/libzpool/common/kernel.c ============================================================================== --- head/cddl/contrib/opensolaris/lib/libzpool/common/kernel.c Thu Jul 9 20:16:01 2009 (r195514) +++ head/cddl/contrib/opensolaris/lib/libzpool/common/kernel.c Thu Jul 9 20:22:05 2009 (r195515) @@ -115,6 +115,14 @@ zmutex_destroy(kmutex_t *mp) mp->initialized = B_FALSE; } +int +zmutex_owned(kmutex_t *mp) +{ + ASSERT(mp->initialized == B_TRUE); + + return (mp->m_owner == curthread); +} + void mutex_enter(kmutex_t *mp) { Modified: head/cddl/contrib/opensolaris/lib/libzpool/common/sys/zfs_context.h ============================================================================== --- head/cddl/contrib/opensolaris/lib/libzpool/common/sys/zfs_context.h Thu Jul 9 20:16:01 2009 (r195514) +++ head/cddl/contrib/opensolaris/lib/libzpool/common/sys/zfs_context.h Thu Jul 9 20:22:05 2009 (r195515) @@ -237,9 +237,11 @@ typedef struct kmutex { #define mutex_init(mp, b, c, d) zmutex_init((kmutex_t *)(mp)) #define mutex_destroy(mp) zmutex_destroy((kmutex_t *)(mp)) +#define mutex_owned(mp) zmutex_owned((kmutex_t *)(mp)) extern void zmutex_init(kmutex_t *mp); extern void zmutex_destroy(kmutex_t *mp); +extern int zmutex_owned(kmutex_t *mp); extern void mutex_enter(kmutex_t *mp); extern void mutex_exit(kmutex_t *mp); extern int mutex_tryenter(kmutex_t *mp); From owner-svn-src-head@FreeBSD.ORG Thu Jul 9 20:23:02 2009 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 2D8B31065670; Thu, 9 Jul 2009 20:23:02 +0000 (UTC) (envelope-from rdivacky@vlk.vlakno.cz) Received: from vlakno.cz (77-93-215-190.static.masterinter.net [77.93.215.190]) by mx1.freebsd.org (Postfix) with ESMTP id 47F288FC1D; Thu, 9 Jul 2009 20:23:01 +0000 (UTC) (envelope-from rdivacky@vlk.vlakno.cz) Received: from localhost (localhost [127.0.0.1]) by vlakno.cz (Postfix) with ESMTP id 6CFF39CB124; Thu, 9 Jul 2009 22:21:30 +0200 (CEST) X-Virus-Scanned: amavisd-new at vlakno.cz Received: from vlakno.cz ([127.0.0.1]) by localhost (lev.vlakno.cz [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id WHpiK0JJ7gO7; Thu, 9 Jul 2009 22:21:28 +0200 (CEST) Received: from vlk.vlakno.cz (localhost [127.0.0.1]) by vlakno.cz (Postfix) with ESMTP id 292C89CB26E; Thu, 9 Jul 2009 22:21:28 +0200 (CEST) Received: (from rdivacky@localhost) by vlk.vlakno.cz (8.14.3/8.14.3/Submit) id n69KLScM000798; Thu, 9 Jul 2009 22:21:28 +0200 (CEST) (envelope-from rdivacky) Date: Thu, 9 Jul 2009 22:21:28 +0200 From: Roman Divacky To: Pawel Jakub Dawidek Message-ID: <20090709202128.GA463@freebsd.org> References: <200907092022.n69KM5Pq096177@svn.freebsd.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <200907092022.n69KM5Pq096177@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: r195515 - in head/cddl/contrib/opensolaris: head lib/libzpool/common lib/libzpool/common/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: Thu, 09 Jul 2009 20:23:02 -0000 On Thu, Jul 09, 2009 at 08:22:05PM +0000, Pawel Jakub Dawidek wrote: > Author: pjd > Date: Thu Jul 9 20:22:05 2009 > New Revision: 195515 > URL: http://svn.freebsd.org/changeset/base/195515 > > Log: > The mutex_owned() macro should operate on kmutex_t and not on mutex_t. > This fixes 'zdb ' crash. > > Reported by: avg > Approved by: re (kib) no MFC of this? From owner-svn-src-head@FreeBSD.ORG Thu Jul 9 22:21:18 2009 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 D9CFF106566B; Thu, 9 Jul 2009 22:21:18 +0000 (UTC) (envelope-from ariff@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C7D0F8FC15; Thu, 9 Jul 2009 22:21:18 +0000 (UTC) (envelope-from ariff@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n69MLIFQ098926; Thu, 9 Jul 2009 22:21:18 GMT (envelope-from ariff@svn.freebsd.org) Received: (from ariff@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n69MLIwS098924; Thu, 9 Jul 2009 22:21:18 GMT (envelope-from ariff@svn.freebsd.org) Message-Id: <200907092221.n69MLIwS098924@svn.freebsd.org> From: Ariff Abdullah Date: Thu, 9 Jul 2009 22:21: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: r195519 - head/sys/dev/sound/pcm 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, 09 Jul 2009 22:21:19 -0000 Author: ariff Date: Thu Jul 9 22:21:18 2009 New Revision: 195519 URL: http://svn.freebsd.org/changeset/base/195519 Log: Rearrange shift operation to increase interpolation accuracy, further reducing conversion artifacts and better worst case SNR. Approved by: re (kib) Modified: head/sys/dev/sound/pcm/feeder_rate.c Modified: head/sys/dev/sound/pcm/feeder_rate.c ============================================================================== --- head/sys/dev/sound/pcm/feeder_rate.c Thu Jul 9 22:11:33 2009 (r195518) +++ head/sys/dev/sound/pcm/feeder_rate.c Thu Jul 9 22:21:18 2009 (r195519) @@ -882,18 +882,18 @@ z_coeff_interpolate(int32_t z, int32_t * zoo2 = z_coeff[2] - z_coeff[-1]; zoo3 = z_coeff[3] - z_coeff[-2]; - zoc0 = ((0x1ac2260dLL * zoe1) >> 30) + - ((0x0526cdcaLL * zoe2) >> 30) + ((0x00170c29LL * zoe3) >> 30); - zoc1 = ((0x14f8a49aLL * zoo1) >> 30) + - ((0x0d6d1109LL * zoo2) >> 30) + ((0x008cd4dcLL * zoo3) >> 30); - zoc2 = ((-0x0d3e94a4LL * zoe1) >> 30) + - ((0x0bddded4LL * zoe2) >> 30) + ((0x0160b5d0LL * zoe3) >> 30); - zoc3 = ((-0x0de10cc4LL * zoo1) >> 30) + - ((0x019b2a7dLL * zoo2) >> 30) + ((0x01cfe914LL * zoo3) >> 30); - zoc4 = ((0x02aa12d7LL * zoe1) >> 30) + - ((-0x03ff1bb3LL * zoe2) >> 30) + ((0x015508ddLL * zoe3) >> 30); - zoc5 = ((0x051d29e5LL * zoo1) >> 30) + - ((-0x028e7647LL * zoo2) >> 30) + ((0x0082d81aLL * zoo3) >> 30); + zoc0 = ((0x1ac2260dLL * zoe1) + (0x0526cdcaLL * zoe2) + + (0x00170c29LL * zoe3)) >> 30; + zoc1 = ((0x14f8a49aLL * zoo1) + (0x0d6d1109LL * zoo2) + + (0x008cd4dcLL * zoo3)) >> 30; + zoc2 = ((-0x0d3e94a4LL * zoe1) + (0x0bddded4LL * zoe2) + + (0x0160b5d0LL * zoe3)) >> 30; + zoc3 = ((-0x0de10cc4LL * zoo1) + (0x019b2a7dLL * zoo2) + + (0x01cfe914LL * zoo3)) >> 30; + zoc4 = ((0x02aa12d7LL * zoe1) + (-0x03ff1bb3LL * zoe2) + + (0x015508ddLL * zoe3)) >> 30; + zoc5 = ((0x051d29e5LL * zoo1) + (-0x028e7647LL * zoo2) + + (0x0082d81aLL * zoo3)) >> 30; coeff = (((((((((((((((int64_t)zoc5 * zoz) >> Z_SHIFT) + zoc4) * zoz) >> Z_SHIFT) + zoc3) * zoz) >> Z_SHIFT) + @@ -911,18 +911,18 @@ z_coeff_interpolate(int32_t z, int32_t * zoo2 = z_coeff[2] - z_coeff[-1]; zoo3 = z_coeff[3] - z_coeff[-2]; - zoc0 = ((0x1ac2260dLL * zoe1) >> 30) + - ((0x0526cdcaLL * zoe2) >> 30) + ((0x00170c29LL * zoe3) >> 30); - zoc1 = ((0x14f8a49aLL * zoo1) >> 30) + - ((0x0d6d1109LL * zoo2) >> 30) + ((0x008cd4dcLL * zoo3) >> 30); - zoc2 = ((-0x0d3e94a4LL * zoe1) >> 30) + - ((0x0bddded4LL * zoe2) >> 30) + ((0x0160b5d0LL * zoe3) >> 30); - zoc3 = ((-0x0de10cc4LL * zoo1) >> 30) + - ((0x019b2a7dLL * zoo2) >> 30) + ((0x01cfe914LL * zoo3) >> 30); - zoc4 = ((0x02aa12d7LL * zoe1) >> 30) + - ((-0x03ff1bb3LL * zoe2) >> 30) + ((0x015508ddLL * zoe3) >> 30); - zoc5 = ((0x051d29e5LL * zoo1) >> 30) + - ((-0x028e7647LL * zoo2) >> 30) + ((0x0082d81aLL * zoo3) >> 30); + zoc0 = ((0x1ac2260dLL * zoe1) + (0x0526cdcaLL * zoe2) + + (0x00170c29LL * zoe3)) >> 30; + zoc1 = ((0x14f8a49aLL * zoo1) + (0x0d6d1109LL * zoo2) + + (0x008cd4dcLL * zoo3)) >> 30; + zoc2 = ((-0x0d3e94a4LL * zoe1) + (0x0bddded4LL * zoe2) + + (0x0160b5d0LL * zoe3)) >> 30; + zoc3 = ((-0x0de10cc4LL * zoo1) + (0x019b2a7dLL * zoo2) + + (0x01cfe914LL * zoo3)) >> 30; + zoc4 = ((0x02aa12d7LL * zoe1) + (-0x03ff1bb3LL * zoe2) + + (0x015508ddLL * zoe3)) >> 30; + zoc5 = ((0x051d29e5LL * zoo1) + (-0x028e7647LL * zoo2) + + (0x0082d81aLL * zoo3)) >> 30; coeff = (((((((((((((((int64_t)zoc5 * zoz) >> Z_SHIFT) + zoc4) * zoz) >> Z_SHIFT) + zoc3) * zoz) >> Z_SHIFT) + @@ -940,18 +940,18 @@ z_coeff_interpolate(int32_t z, int32_t * zoo2 = z_coeff[2] - z_coeff[-1]; zoo3 = z_coeff[3] - z_coeff[-2]; - zoc0 = ((0x1aa9b47dLL * zoe1) >> 30) + - ((0x053d9944LL * zoe2) >> 30) + ((0x0018b23fLL * zoe3) >> 30); - zoc1 = ((0x14a104d1LL * zoo1) >> 30) + - ((0x0d7d2504LL * zoo2) >> 30) + ((0x0094b599LL * zoo3) >> 30); - zoc2 = ((-0x0d22530bLL * zoe1) >> 30) + - ((0x0bb37a2cLL * zoe2) >> 30) + ((0x016ed8e0LL * zoe3) >> 30); - zoc3 = ((-0x0d744b1cLL * zoo1) >> 30) + - ((0x01649591LL * zoo2) >> 30) + ((0x01dae93aLL * zoo3) >> 30); - zoc4 = ((0x02a7ee1bLL * zoe1) >> 30) + - ((-0x03fbdb24LL * zoe2) >> 30) + ((0x0153ed07LL * zoe3) >> 30); - zoc5 = ((0x04cf9b6cLL * zoo1) >> 30) + - ((-0x0266b378LL * zoo2) >> 30) + ((0x007a7c26LL * zoo3) >> 30); + zoc0 = ((0x1aa9b47dLL * zoe1) + (0x053d9944LL * zoe2) + + (0x0018b23fLL * zoe3)) >> 30; + zoc1 = ((0x14a104d1LL * zoo1) + (0x0d7d2504LL * zoo2) + + (0x0094b599LL * zoo3)) >> 30; + zoc2 = ((-0x0d22530bLL * zoe1) + (0x0bb37a2cLL * zoe2) + + (0x016ed8e0LL * zoe3)) >> 30; + zoc3 = ((-0x0d744b1cLL * zoo1) + (0x01649591LL * zoo2) + + (0x01dae93aLL * zoo3)) >> 30; + zoc4 = ((0x02a7ee1bLL * zoe1) + (-0x03fbdb24LL * zoe2) + + (0x0153ed07LL * zoe3)) >> 30; + zoc5 = ((0x04cf9b6cLL * zoo1) + (-0x0266b378LL * zoo2) + + (0x007a7c26LL * zoo3)) >> 30; coeff = (((((((((((((((int64_t)zoc5 * zoz) >> Z_SHIFT) + zoc4) * zoz) >> Z_SHIFT) + zoc3) * zoz) >> Z_SHIFT) + @@ -969,18 +969,18 @@ z_coeff_interpolate(int32_t z, int32_t * zoo2 = z_coeff[2] - z_coeff[-1]; zoo3 = z_coeff[3] - z_coeff[-2]; - zoc0 = ((0x1a8eda43LL * zoe1) >> 30) + - ((0x0556ee38LL * zoe2) >> 30) + ((0x001a3784LL * zoe3) >> 30); - zoc1 = ((0x143d863eLL * zoo1) >> 30) + - ((0x0d910e36LL * zoo2) >> 30) + ((0x009ca889LL * zoo3) >> 30); - zoc2 = ((-0x0d026821LL * zoe1) >> 30) + - ((0x0b837773LL * zoe2) >> 30) + ((0x017ef0c6LL * zoe3) >> 30); - zoc3 = ((-0x0cef1502LL * zoo1) >> 30) + - ((0x01207a8eLL * zoo2) >> 30) + ((0x01e936dbLL * zoo3) >> 30); - zoc4 = ((0x029fe643LL * zoe1) >> 30) + - ((-0x03ef3fc8LL * zoe2) >> 30) + ((0x014f5923LL * zoe3) >> 30); - zoc5 = ((0x043a9d08LL * zoo1) >> 30) + - ((-0x02154febLL * zoo2) >> 30) + ((0x00670dbdLL * zoo3) >> 30); + zoc0 = ((0x1a8eda43LL * zoe1) + (0x0556ee38LL * zoe2) + + (0x001a3784LL * zoe3)) >> 30; + zoc1 = ((0x143d863eLL * zoo1) + (0x0d910e36LL * zoo2) + + (0x009ca889LL * zoo3)) >> 30; + zoc2 = ((-0x0d026821LL * zoe1) + (0x0b837773LL * zoe2) + + (0x017ef0c6LL * zoe3)) >> 30; + zoc3 = ((-0x0cef1502LL * zoo1) + (0x01207a8eLL * zoo2) + + (0x01e936dbLL * zoo3)) >> 30; + zoc4 = ((0x029fe643LL * zoe1) + (-0x03ef3fc8LL * zoe2) + + (0x014f5923LL * zoe3)) >> 30; + zoc5 = ((0x043a9d08LL * zoo1) + (-0x02154febLL * zoo2) + + (0x00670dbdLL * zoo3)) >> 30; coeff = (((((((((((((((int64_t)zoc5 * zoz) >> Z_SHIFT) + zoc4) * zoz) >> Z_SHIFT) + zoc3) * zoz) >> Z_SHIFT) + @@ -998,18 +998,18 @@ z_coeff_interpolate(int32_t z, int32_t * zoo2 = z_coeff[2] - z_coeff[-1]; zoo3 = z_coeff[3] - z_coeff[-2]; - zoc0 = ((0x19edb6fdLL * zoe1) >> 30) + - ((0x05ebd062LL * zoe2) >> 30) + ((0x00267881LL * zoe3) >> 30); - zoc1 = ((0x1223af76LL * zoo1) >> 30) + - ((0x0de3dd6bLL * zoo2) >> 30) + ((0x00d683cdLL * zoo3) >> 30); - zoc2 = ((-0x0c3ee068LL * zoe1) >> 30) + - ((0x0a5c3769LL * zoe2) >> 30) + ((0x01e2aceaLL * zoe3) >> 30); - zoc3 = ((-0x0a8ab614LL * zoo1) >> 30) + - ((-0x0019522eLL * zoo2) >> 30) + ((0x022cefc7LL * zoo3) >> 30); - zoc4 = ((0x0276187dLL * zoe1) >> 30) + - ((-0x03a801e8LL * zoe2) >> 30) + ((0x0131d935LL * zoe3) >> 30); - zoc5 = ((0x02c373f5LL * zoo1) >> 30) + - ((-0x01275f83LL * zoo2) >> 30) + ((0x0018ee79LL * zoo3) >> 30); + zoc0 = ((0x19edb6fdLL * zoe1) + (0x05ebd062LL * zoe2) + + (0x00267881LL * zoe3)) >> 30; + zoc1 = ((0x1223af76LL * zoo1) + (0x0de3dd6bLL * zoo2) + + (0x00d683cdLL * zoo3)) >> 30; + zoc2 = ((-0x0c3ee068LL * zoe1) + (0x0a5c3769LL * zoe2) + + (0x01e2aceaLL * zoe3)) >> 30; + zoc3 = ((-0x0a8ab614LL * zoo1) + (-0x0019522eLL * zoo2) + + (0x022cefc7LL * zoo3)) >> 30; + zoc4 = ((0x0276187dLL * zoe1) + (-0x03a801e8LL * zoe2) + + (0x0131d935LL * zoe3)) >> 30; + zoc5 = ((0x02c373f5LL * zoo1) + (-0x01275f83LL * zoo2) + + (0x0018ee79LL * zoo3)) >> 30; coeff = (((((((((((((((int64_t)zoc5 * zoz) >> Z_SHIFT) + zoc4) * zoz) >> Z_SHIFT) + zoc3) * zoz) >> Z_SHIFT) + From owner-svn-src-head@FreeBSD.ORG Fri Jul 10 02:19:57 2009 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 E53EF106564A; Fri, 10 Jul 2009 02:19:57 +0000 (UTC) (envelope-from sam@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D44238FC16; Fri, 10 Jul 2009 02:19:57 +0000 (UTC) (envelope-from sam@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n6A2JvxA004315; Fri, 10 Jul 2009 02:19:57 GMT (envelope-from sam@svn.freebsd.org) Received: (from sam@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n6A2JvdC004313; Fri, 10 Jul 2009 02:19:57 GMT (envelope-from sam@svn.freebsd.org) Message-Id: <200907100219.n6A2JvdC004313@svn.freebsd.org> From: Sam Leffler Date: Fri, 10 Jul 2009 02:19: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: r195527 - head/sys/net80211 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, 10 Jul 2009 02:19:58 -0000 Author: sam Date: Fri Jul 10 02:19:57 2009 New Revision: 195527 URL: http://svn.freebsd.org/changeset/base/195527 Log: correctly set the tailq ptr when removing the last item in the q Approved by: re (kensmith) Modified: head/sys/net80211/ieee80211_ageq.c Modified: head/sys/net80211/ieee80211_ageq.c ============================================================================== --- head/sys/net80211/ieee80211_ageq.c Fri Jul 10 02:15:59 2009 (r195526) +++ head/sys/net80211/ieee80211_ageq.c Fri Jul 10 02:19:57 2009 (r195527) @@ -211,7 +211,6 @@ ieee80211_ageq_remove(struct ieee80211_a /* * Remove from forward list; tail pointer is harder. */ - *prev = m->m_nextpkt; if (aq->aq_tail == m) { KASSERT(m->m_nextpkt == NULL, ("not last")); if (aq->aq_head == m) { /* list empty */ @@ -223,6 +222,8 @@ ieee80211_ageq_remove(struct ieee80211_a offsetof(struct mbuf, m_nextpkt)); } } + *prev = m->m_nextpkt; + /* add to private list for return */ *phead = m; phead = &m->m_nextpkt; From owner-svn-src-head@FreeBSD.ORG Fri Jul 10 08:18:08 2009 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 A7F66106566B; Fri, 10 Jul 2009 08:18:08 +0000 (UTC) (envelope-from scottl@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 920D68FC08; Fri, 10 Jul 2009 08:18:08 +0000 (UTC) (envelope-from scottl@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n6A8I8KM011865; Fri, 10 Jul 2009 08:18:08 GMT (envelope-from scottl@svn.freebsd.org) Received: (from scottl@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n6A8I8p1011853; Fri, 10 Jul 2009 08:18:08 GMT (envelope-from scottl@svn.freebsd.org) Message-Id: <200907100818.n6A8I8p1011853@svn.freebsd.org> From: Scott Long Date: Fri, 10 Jul 2009 08:18: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: r195534 - in head: etc/mtree include lib/libcam sbin/camcontrol share/man/man4 sys/cam sys/cam/ata sys/cam/scsi sys/conf sys/dev/advansys sys/dev/ahci sys/dev/aic7xxx sys/dev/amd sys/de... 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, 10 Jul 2009 08:18:09 -0000 Author: scottl Date: Fri Jul 10 08:18:08 2009 New Revision: 195534 URL: http://svn.freebsd.org/changeset/base/195534 Log: Separate the parallel scsi knowledge out of the core of the XPT, and modularize it so that new transports can be created. Add a transport for SATA Add a periph+protocol layer for ATA Add a driver for AHCI-compliant hardware. Add a maxio field to CAM so that drivers can advertise their max I/O capability. Modify various drivers so that they are insulated from the value of MAXPHYS. The new ATA/SATA code supports AHCI-compliant hardware, and will override the classic ATA driver if it is loaded as a module at boot time or compiled into the kernel. The stack now support NCQ (tagged queueing) for increased performance on modern SATA drives. It also supports port multipliers. ATA drives are accessed via 'ada' device nodes. ATAPI drives are accessed via 'cd' device nodes. They can all be enumerated and manipulated via camcontrol, just like SCSI drives. SCSI commands are not translated to their ATA equivalents; ATA native commands are used throughout the entire stack, including camcontrol. See the camcontrol manpage for further details. Testing this code may require that you update your fstab, and possibly modify your BIOS to enable AHCI functionality, if available. This code is very experimental at the moment. The userland ABI/API has changed, so applications will need to be recompiled. It may change further in the near future. The 'ada' device name may also change as more infrastructure is completed in this project. The goal is to eventually put all CAM busses and devices until newbus, allowing for interesting topology and management options. Few functional changes will be seen with existing SCSI/SAS/FC drivers, though the userland ABI has still changed. In the future, transports specific modules for SAS and FC may appear in order to better support the topologies and capabilities of these technologies. The modularization of CAM and the addition of the ATA/SATA modules is meant to break CAM out of the mold of being specific to SCSI, letting it grow to be a framework for arbitrary transports and protocols. It also allows drivers to be written to support discrete hardware without jeopardizing the stability of non-related hardware. While only an AHCI driver is provided now, a Silicon Image driver is also in the works. Drivers for ICH1-4, ICH5-6, PIIX, classic IDE, and any other hardware is possible and encouraged. Help with new transports is also encouraged. Submitted by: scottl, mav Approved by: re Added: head/share/man/man4/ahci.4 (contents, props changed) head/sys/cam/ata/ head/sys/cam/ata/ata_all.c (contents, props changed) head/sys/cam/ata/ata_all.h (contents, props changed) head/sys/cam/ata/ata_da.c (contents, props changed) head/sys/cam/ata/ata_xpt.c (contents, props changed) head/sys/cam/cam_xpt_internal.h (contents, props changed) head/sys/cam/scsi/scsi_xpt.c (contents, props changed) head/sys/dev/ahci/ head/sys/dev/ahci/ahci.c (contents, props changed) head/sys/dev/ahci/ahci.h (contents, props changed) head/sys/modules/ahci/ head/sys/modules/ahci/Makefile (contents, props changed) Modified: head/etc/mtree/BSD.include.dist head/include/Makefile head/lib/libcam/Makefile head/sbin/camcontrol/camcontrol.8 head/sbin/camcontrol/camcontrol.c head/share/man/man4/Makefile head/sys/cam/cam.c head/sys/cam/cam.h head/sys/cam/cam_ccb.h head/sys/cam/cam_periph.c head/sys/cam/cam_xpt.c head/sys/cam/cam_xpt.h head/sys/cam/cam_xpt_periph.h head/sys/cam/scsi/scsi_all.c head/sys/cam/scsi/scsi_cd.c head/sys/cam/scsi/scsi_ch.c head/sys/cam/scsi/scsi_da.c head/sys/cam/scsi/scsi_pass.c head/sys/cam/scsi/scsi_pt.c head/sys/cam/scsi/scsi_sa.c head/sys/cam/scsi/scsi_ses.c head/sys/cam/scsi/scsi_sg.c head/sys/conf/files head/sys/dev/advansys/advansys.c head/sys/dev/advansys/advlib.h head/sys/dev/aic7xxx/aic79xx_osm.h head/sys/dev/aic7xxx/aic7xxx_osm.h head/sys/dev/amd/amd.h head/sys/dev/ata/atapi-cam.c head/sys/dev/ciss/ciss.c head/sys/dev/ciss/cissvar.h head/sys/dev/isp/isp_freebsd.h head/sys/dev/mfi/mfi.c head/sys/dev/mfi/mfivar.h head/sys/dev/mlx/mlx.c head/sys/dev/mlx/mlxvar.h head/sys/dev/mpt/mpt.h head/sys/dev/mpt/mpt_pci.c head/sys/dev/trm/trm.h head/sys/modules/Makefile head/sys/modules/cam/Makefile Modified: head/etc/mtree/BSD.include.dist ============================================================================== --- head/etc/mtree/BSD.include.dist Fri Jul 10 07:21:26 2009 (r195533) +++ head/etc/mtree/BSD.include.dist Fri Jul 10 08:18:08 2009 (r195534) @@ -78,6 +78,8 @@ .. .. cam + ata + .. scsi .. .. Modified: head/include/Makefile ============================================================================== --- head/include/Makefile Fri Jul 10 07:21:26 2009 (r195533) +++ head/include/Makefile Fri Jul 10 08:18:08 2009 (r195534) @@ -38,7 +38,7 @@ LDIRS= bsm cam geom net net80211 netatal nfs nfsclient nfsserver \ sys vm -LSUBDIRS= cam/scsi \ +LSUBDIRS= cam/ata cam/scsi \ dev/acpica dev/an dev/bktr dev/firewire dev/hwpmc \ dev/ic dev/iicbus ${_dev_ieee488} dev/lmc dev/ofw \ dev/pbio ${_dev_powermac_nvram} dev/ppbus dev/smbus \ Modified: head/lib/libcam/Makefile ============================================================================== --- head/lib/libcam/Makefile Fri Jul 10 07:21:26 2009 (r195533) +++ head/lib/libcam/Makefile Fri Jul 10 08:18:08 2009 (r195534) @@ -2,7 +2,8 @@ LIB= cam SHLIBDIR?= /lib -SRCS= camlib.c scsi_cmdparse.c scsi_all.c scsi_da.c scsi_sa.c cam.c +SRCS= camlib.c scsi_cmdparse.c scsi_all.c scsi_da.c scsi_sa.c cam.c \ + ata_all.c INCS= camlib.h DPADD= ${LIBSBUF} @@ -34,7 +35,8 @@ MLINKS+= cam.3 cam_open_device.3 \ cam_cdbparse.3 csio_encode_visit.3 \ cam_cdbparse.3 buff_encode_visit.3 -.PATH: ${.CURDIR}/../../sys/cam/scsi ${.CURDIR}/../../sys/cam +.PATH: ${.CURDIR}/../../sys/cam/scsi ${.CURDIR}/../../sys/cam/ata \ + ${.CURDIR}/../../sys/cam SDIR= ${.CURDIR}/../../sys CFLAGS+= -I${.CURDIR} -I${SDIR} Modified: head/sbin/camcontrol/camcontrol.8 ============================================================================== --- head/sbin/camcontrol/camcontrol.8 Fri Jul 10 07:21:26 2009 (r195533) +++ head/sbin/camcontrol/camcontrol.8 Fri Jul 10 08:18:08 2009 (r195534) @@ -27,7 +27,7 @@ .\" .\" $FreeBSD$ .\" -.Dd August 21, 2006 +.Dd June 29, 2009 .Dt CAMCONTROL 8 .Os .Sh NAME @@ -59,6 +59,10 @@ .Op Fl S .Op Fl R .Nm +.Ic identify +.Op device id +.Op generic args +.Nm .Ic reportluns .Op device id .Op generic args @@ -283,6 +287,8 @@ This is to aid in script writing. .It Fl R Print out transfer rate information. .El +.It Ic identify +Send a ATA identify command (0xec) to a device. .It Ic reportluns Send the SCSI REPORT LUNS (0xA0) command to the given device. By default, Modified: head/sbin/camcontrol/camcontrol.c ============================================================================== --- head/sbin/camcontrol/camcontrol.c Fri Jul 10 07:21:26 2009 (r195533) +++ head/sbin/camcontrol/camcontrol.c Fri Jul 10 08:18:08 2009 (r195534) @@ -32,6 +32,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include @@ -49,6 +50,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include "camcontrol.h" @@ -71,7 +73,8 @@ typedef enum { CAM_CMD_RATE = 0x0000000f, CAM_CMD_DETACH = 0x00000010, CAM_CMD_REPORTLUNS = 0x00000011, - CAM_CMD_READCAP = 0x00000012 + CAM_CMD_READCAP = 0x00000012, + CAM_CMD_IDENTIFY = 0x00000013 } cam_cmdmask; typedef enum { @@ -126,6 +129,7 @@ struct camcontrol_opts option_table[] = #ifndef MINIMALISTIC {"tur", CAM_CMD_TUR, CAM_ARG_NONE, NULL}, {"inquiry", CAM_CMD_INQUIRY, CAM_ARG_NONE, "DSR"}, + {"identify", CAM_CMD_IDENTIFY, CAM_ARG_NONE, NULL}, {"start", CAM_CMD_STARTSTOP, CAM_ARG_START_UNIT, NULL}, {"stop", CAM_CMD_STARTSTOP, CAM_ARG_NONE, NULL}, {"load", CAM_CMD_STARTSTOP, CAM_ARG_START_UNIT | CAM_ARG_EJECT, NULL}, @@ -401,19 +405,35 @@ getdevtree(void) } else skip_device = 0; - cam_strvis(vendor, dev_result->inq_data.vendor, + if (dev_result->protocol == PROTO_SCSI) { + cam_strvis(vendor, dev_result->inq_data.vendor, sizeof(dev_result->inq_data.vendor), sizeof(vendor)); - cam_strvis(product, + cam_strvis(product, dev_result->inq_data.product, sizeof(dev_result->inq_data.product), sizeof(product)); - cam_strvis(revision, + cam_strvis(revision, dev_result->inq_data.revision, sizeof(dev_result->inq_data.revision), sizeof(revision)); - sprintf(tmpstr, "<%s %s %s>", vendor, product, + sprintf(tmpstr, "<%s %s %s>", vendor, product, revision); + } else if (dev_result->protocol == PROTO_ATA || + dev_result->protocol == PROTO_SATAPM) { + cam_strvis(product, + dev_result->ident_data.model, + sizeof(dev_result->ident_data.model), + sizeof(product)); + cam_strvis(revision, + dev_result->ident_data.revision, + sizeof(dev_result->ident_data.revision), + sizeof(revision)); + sprintf(tmpstr, "<%s %s>", product, + revision); + } else { + sprintf(tmpstr, "<>"); + } if (need_close) { fprintf(stdout, ")\n"); need_close = 0; @@ -899,6 +919,14 @@ scsixferrate(struct cam_device *device) if ((spi->valid & CTS_SPI_VALID_SYNC_RATE) != 0) { freq = scsi_calc_syncsrate(spi->sync_period); speed = freq; + } else { + struct ccb_pathinq cpi; + + retval = get_cpi(device, &cpi); + if (retval == 0) { + speed = cpi.base_transfer_speed; + freq = 0; + } } fprintf(stdout, "%s%d: ", device->device_name, @@ -974,6 +1002,224 @@ xferrate_bailout: return(retval); } + +static void +atacapprint(struct ata_params *parm) +{ + u_int32_t lbasize = (u_int32_t)parm->lba_size_1 | + ((u_int32_t)parm->lba_size_2 << 16); + + u_int64_t lbasize48 = ((u_int64_t)parm->lba_size48_1) | + ((u_int64_t)parm->lba_size48_2 << 16) | + ((u_int64_t)parm->lba_size48_3 << 32) | + ((u_int64_t)parm->lba_size48_4 << 48); + + printf("\n"); + printf("Protocol "); + if (parm->satacapabilities && parm->satacapabilities != 0xffff) { + if (parm->satacapabilities & ATA_SATA_GEN2) + printf("SATA revision 2.x\n"); + else if (parm->satacapabilities & ATA_SATA_GEN1) + printf("SATA revision 1.x\n"); + else + printf("Unknown SATA revision\n"); + } + else + printf("ATA/ATAPI revision %d\n", ata_version(parm->version_major)); + printf("device model %.40s\n", parm->model); + printf("serial number %.20s\n", parm->serial); + printf("firmware revision %.8s\n", parm->revision); + + printf("cylinders %d\n", parm->cylinders); + printf("heads %d\n", parm->heads); + printf("sectors/track %d\n", parm->sectors); + + if (parm->config == ATA_PROTO_CFA || + (parm->support.command2 & ATA_SUPPORT_CFA)) + printf("CFA supported\n"); + + printf("lba%ssupported ", + parm->capabilities1 & ATA_SUPPORT_LBA ? " " : " not "); + if (lbasize) + printf("%d sectors\n", lbasize); + else + printf("\n"); + + printf("lba48%ssupported ", + parm->support.command2 & ATA_SUPPORT_ADDRESS48 ? " " : " not "); + if (lbasize48) + printf("%ju sectors\n", (uintmax_t)lbasize48); + else + printf("\n"); + + printf("dma%ssupported\n", + parm->capabilities1 & ATA_SUPPORT_DMA ? " " : " not "); + + printf("overlap%ssupported\n", + parm->capabilities1 & ATA_SUPPORT_OVERLAP ? " " : " not "); + + printf("\nFeature " + "Support Enable Value Vendor\n"); + + printf("write cache %s %s\n", + parm->support.command1 & ATA_SUPPORT_WRITECACHE ? "yes" : "no", + parm->enabled.command1 & ATA_SUPPORT_WRITECACHE ? "yes" : "no"); + + printf("read ahead %s %s\n", + parm->support.command1 & ATA_SUPPORT_LOOKAHEAD ? "yes" : "no", + parm->enabled.command1 & ATA_SUPPORT_LOOKAHEAD ? "yes" : "no"); + + if (parm->satacapabilities && parm->satacapabilities != 0xffff) { + printf("Native Command Queuing (NCQ) %s %s" + " %d/0x%02X\n", + parm->satacapabilities & ATA_SUPPORT_NCQ ? + "yes" : "no", " -", + (parm->satacapabilities & ATA_SUPPORT_NCQ) ? + ATA_QUEUE_LEN(parm->queue) : 0, + (parm->satacapabilities & ATA_SUPPORT_NCQ) ? + ATA_QUEUE_LEN(parm->queue) : 0); + } + printf("Tagged Command Queuing (TCQ) %s %s %d/0x%02X\n", + parm->support.command2 & ATA_SUPPORT_QUEUED ? "yes" : "no", + parm->enabled.command2 & ATA_SUPPORT_QUEUED ? "yes" : "no", + ATA_QUEUE_LEN(parm->queue), ATA_QUEUE_LEN(parm->queue)); + + printf("SMART %s %s\n", + parm->support.command1 & ATA_SUPPORT_SMART ? "yes" : "no", + parm->enabled.command1 & ATA_SUPPORT_SMART ? "yes" : "no"); + + printf("microcode download %s %s\n", + parm->support.command2 & ATA_SUPPORT_MICROCODE ? "yes" : "no", + parm->enabled.command2 & ATA_SUPPORT_MICROCODE ? "yes" : "no"); + + printf("security %s %s\n", + parm->support.command1 & ATA_SUPPORT_SECURITY ? "yes" : "no", + parm->enabled.command1 & ATA_SUPPORT_SECURITY ? "yes" : "no"); + + printf("power management %s %s\n", + parm->support.command1 & ATA_SUPPORT_POWERMGT ? "yes" : "no", + parm->enabled.command1 & ATA_SUPPORT_POWERMGT ? "yes" : "no"); + + printf("advanced power management %s %s %d/0x%02X\n", + parm->support.command2 & ATA_SUPPORT_APM ? "yes" : "no", + parm->enabled.command2 & ATA_SUPPORT_APM ? "yes" : "no", + parm->apm_value, parm->apm_value); + + printf("automatic acoustic management %s %s " + "%d/0x%02X %d/0x%02X\n", + parm->support.command2 & ATA_SUPPORT_AUTOACOUSTIC ? "yes" :"no", + parm->enabled.command2 & ATA_SUPPORT_AUTOACOUSTIC ? "yes" :"no", + ATA_ACOUSTIC_CURRENT(parm->acoustic), + ATA_ACOUSTIC_CURRENT(parm->acoustic), + ATA_ACOUSTIC_VENDOR(parm->acoustic), + ATA_ACOUSTIC_VENDOR(parm->acoustic)); +} + + +static int +ataidentify(struct cam_device *device, int retry_count, int timeout) +{ + union ccb *ccb; + struct ata_params *ident_buf; + int error = 0; + int16_t *ptr; + + ccb = cam_getccb(device); + + if (ccb == NULL) { + warnx("couldn't allocate CCB"); + return(1); + } + + /* cam_getccb cleans up the header, caller has to zero the payload */ + bzero(&(&ccb->ccb_h)[1], + sizeof(struct ccb_ataio) - sizeof(struct ccb_hdr)); + + ident_buf = (struct ata_params *)malloc( + sizeof(struct ata_params)); + + if (ident_buf == NULL) { + cam_freeccb(ccb); + warnx("can't malloc memory for identify\n"); + return(1); + } + bzero(ident_buf, sizeof(*ident_buf)); + + cam_fill_ataio(&ccb->ataio, + retry_count, + NULL, + /*flags*/CAM_DIR_IN, + MSG_SIMPLE_Q_TAG, + /*data_ptr*/(u_int8_t *)ident_buf, + /*dxfer_len*/sizeof(struct ata_params), + timeout ? timeout : 30 * 1000); +// if (periph->path->device->protocol == PROTO_ATA) + ata_36bit_cmd(&ccb->ataio, ATA_ATA_IDENTIFY, 0, 0, 0); +// else +// ata_36bit_cmd(&ccb->ataio, ATA_ATAPI_IDENTIFY, 0, 0, 0); + + /* Disable freezing the device queue */ + ccb->ccb_h.flags |= CAM_DEV_QFRZDIS; + + if (arglist & CAM_ARG_ERR_RECOVER) + ccb->ccb_h.flags |= CAM_PASS_ERR_RECOVER; + + if (cam_send_ccb(device, ccb) < 0) { + perror("error sending ATA identify"); + + if (arglist & CAM_ARG_VERBOSE) { + cam_error_print(device, ccb, CAM_ESF_ALL, + CAM_EPF_ALL, stderr); + } + + cam_freeccb(ccb); + return(1); + } + + if ((ccb->ccb_h.status & CAM_STATUS_MASK) != CAM_REQ_CMP) { + error = 1; + + if (arglist & CAM_ARG_VERBOSE) { + cam_error_print(device, ccb, CAM_ESF_ALL, + CAM_EPF_ALL, stderr); + } + } + + cam_freeccb(ccb); + + if (error != 0) { + free(ident_buf); + return(error); + } + + for (ptr = (int16_t *)ident_buf; + ptr < (int16_t *)ident_buf + sizeof(struct ata_params)/2; ptr++) { + *ptr = le16toh(*ptr); + } + if (strncmp(ident_buf->model, "FX", 2) && + strncmp(ident_buf->model, "NEC", 3) && + strncmp(ident_buf->model, "Pioneer", 7) && + strncmp(ident_buf->model, "SHARP", 5)) { + ata_bswap(ident_buf->model, sizeof(ident_buf->model)); + ata_bswap(ident_buf->revision, sizeof(ident_buf->revision)); + ata_bswap(ident_buf->serial, sizeof(ident_buf->serial)); + } + ata_btrim(ident_buf->model, sizeof(ident_buf->model)); + ata_bpack(ident_buf->model, ident_buf->model, sizeof(ident_buf->model)); + ata_btrim(ident_buf->revision, sizeof(ident_buf->revision)); + ata_bpack(ident_buf->revision, ident_buf->revision, sizeof(ident_buf->revision)); + ata_btrim(ident_buf->serial, sizeof(ident_buf->serial)); + ata_bpack(ident_buf->serial, ident_buf->serial, sizeof(ident_buf->serial)); + + fprintf(stdout, "%s%d: ", device->device_name, + device->dev_unit_num); + ata_print_ident(ident_buf); + atacapprint(ident_buf); + + free(ident_buf); + + return(0); +} #endif /* MINIMALISTIC */ /* @@ -3675,6 +3921,7 @@ usage(int verbose) " camcontrol periphlist [dev_id][-n dev_name] [-u unit]\n" " camcontrol tur [dev_id][generic args]\n" " camcontrol inquiry [dev_id][generic args] [-D] [-S] [-R]\n" +" camcontrol identify [dev_id][generic args]\n" " camcontrol reportluns [dev_id][generic args] [-c] [-l] [-r report]\n" " camcontrol readcap [dev_id][generic args] [-b] [-h] [-H] [-N]\n" " [-q] [-s]\n" @@ -3710,6 +3957,7 @@ usage(int verbose) "periphlist list all CAM peripheral drivers attached to a device\n" "tur send a test unit ready to the named device\n" "inquiry send a SCSI inquiry command to the named device\n" +"identify send a ATA identify command to the named device\n" "reportluns send a SCSI report luns command to the device\n" "readcap send a SCSI read capacity command to the device\n" "start send a Start Unit command to the device\n" @@ -4035,6 +4283,9 @@ main(int argc, char **argv) error = scsidoinquiry(cam_dev, argc, argv, combinedopt, retry_count, timeout); break; + case CAM_CMD_IDENTIFY: + error = ataidentify(cam_dev, retry_count, timeout); + break; case CAM_CMD_STARTSTOP: error = scsistart(cam_dev, arglist & CAM_ARG_START_UNIT, arglist & CAM_ARG_EJECT, retry_count, Modified: head/share/man/man4/Makefile ============================================================================== --- head/share/man/man4/Makefile Fri Jul 10 07:21:26 2009 (r195533) +++ head/share/man/man4/Makefile Fri Jul 10 08:18:08 2009 (r195534) @@ -23,6 +23,7 @@ MAN= aac.4 \ aha.4 \ ahb.4 \ ahc.4 \ + ahci.4 \ ahd.4 \ aio.4 \ alc.4 \ Added: head/share/man/man4/ahci.4 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/share/man/man4/ahci.4 Fri Jul 10 08:18:08 2009 (r195534) @@ -0,0 +1,132 @@ +.\" Copyright (c) 2009 Alexander Motin +.\" 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. +.\" 3. The name of the author may not be used to endorse or promote products +.\" derived from this software without specific prior written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR +.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES +.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. +.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, +.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT +.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF +.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +.\" +.\" $FreeBSD$ +.\" +.Dd June 26, 2009 +.Dt AHCI 4 +.Os +.Sh NAME +.Nm ahci +.Nd Serial ATA Advanced Host Controller Interface driver +.Sh SYNOPSIS +To compile this driver into the kernel, +place the following lines in your +kernel configuration file: +.Bd -ragged -offset indent +.Cd "device pci" +.Cd "device scbus" +.Cd "device ahci" +.Ed +.Pp +Alternatively, to load the driver as a +module at boot time, place the following line in +.Xr loader.conf 5 : +.Bd -literal -offset indent +ahci_load="YES" +.Ed +.Pp +The following tunables are settable from the loader: +.Bl -ohang +.It Va hint.ahci.X.msi +controls Message Signaled Interrupts (MSI) usage by the specified controller +.Bl -tag -compact +.It 0 +MSI disabled; +.It 1 +single MSI vector used, if supported (default); +.It 2 +multiple MSI vectors used, if supported; +.El +.It Va hint.ahcich.X.pm_level +controls SATA interface Power Management for specified channel, +allowing some power to be saved at the cost of additional command +latency. +Possible values: +.Bl -tag -compact +.It 0 +interface Power Management is disabled (default); +.It 1 +device is allowed to initiate PM state change, host is passive; +.It 2 +host initiates PARTIAL PM state transition every time port becomes idle; +.It 3 +host initiates SLUMBER PM state transition every time port becomes idle. +.El +Note that interface Power Management is not compatible with +device presence detection. +You will have to reset bus manually on device hot-plug. +.It Va hint.ahcich.X.sata_rev +setting to nonzero value limits maximum SATA revision (speed). +Values 1, 2 and 3 are respectively 1.5, 3 and 6Gbps. +.El +.Sh DESCRIPTION +This driver provides the CAM subsystem with native access to the +.Tn SATA +ports of AHCI-compatible controllers. +Each SATA port found is represented to CAM as a separate bus with one +target, or, if HBA supports Port Multipliers, 15 targets. +Most of the bus-management details are handled by the SATA-specific +transport of CAM. +Connected ATA disks are handled by the ATA protocol disk peripheral driver +.Xr ada 4 . +ATAPI devices are handled by the SCSI protocol peripheral drivers +.Xr cd 4 , +.Xr da 4 , +.Xr sa 4 , +etc. +.Pp +Driver features include support for Serial ATA and ATAPI devices, +Port Multipliers, hardware command queues (up to 32 commands per port), +Native Command Queuing, SATA interface Power Management, device hot-plug +and Message Signaled Interrupts. +.Pp +The Port Multiplier FIS Based Switching feature added in the AHCI 1.2 +specification, which is required for effective parallel operation of devices +behind Port Multipliers, is not yet supported. +.Pp +AHCI hardware is also supported by ataahci driver from +.Xr ata 4 +subsystem. If both drivers are loaded at the same time, this one will be +given precedence as the more functional of the two. +.Sh HARDWARE +The +.Nm +driver supports AHCI compatible controllers having PCI class 1 (mass storage), +subclass 6 (SATA) and programming interface 1 (AHCI). +.Sh SEE ALSO +.Xr ada 4 , +.Xr cd 4 , +.Xr da 4 , +.Xr sa 4 , +.Xr scsi 4 , +.Xr ata 4 +.Sh HISTORY +The +.Nm +driver first appeared in +.Fx 8.0 . +.Sh AUTHORS +.An Alexander Motin Aq mav@FreeBSD.org . Added: head/sys/cam/ata/ata_all.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/cam/ata/ata_all.c Fri Jul 10 08:18:08 2009 (r195534) @@ -0,0 +1,304 @@ +/*- + * Copyright (c) 2009 Alexander Motin + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer, + * without modification, immediately at the beginning of the file. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include + +#ifdef _KERNEL +#include + +#include +#include +#include +#include +#else +#include +#include +#include +#include +#ifndef min +#define min(a,b) (((a)<(b))?(a):(b)) +#endif +#endif + +#include +#include +#include +#include +#include +#include +#include +#include + +int +ata_version(int ver) +{ + int bit; + + if (ver == 0xffff) + return 0; + for (bit = 15; bit >= 0; bit--) + if (ver & (1<model, sizeof(ident_data->model), + sizeof(product)); + cam_strvis(revision, ident_data->revision, sizeof(ident_data->revision), + sizeof(revision)); + printf("<%s %s> ATA/ATAPI-%d", + product, revision, ata_version(ident_data->version_major)); + if (ident_data->satacapabilities && ident_data->satacapabilities != 0xffff) { + if (ident_data->satacapabilities & ATA_SATA_GEN2) + printf(" SATA 2.x"); + else if (ident_data->satacapabilities & ATA_SATA_GEN1) + printf(" SATA 1.x"); + else + printf(" SATA"); + } + printf(" device\n"); +} + +void +ata_36bit_cmd(struct ccb_ataio *ataio, uint8_t cmd, uint8_t features, + uint32_t lba, uint8_t sector_count) +{ + bzero(&ataio->cmd, sizeof(ataio->cmd)); + ataio->cmd.flags = 0; + ataio->cmd.command = cmd; + ataio->cmd.features = features; + ataio->cmd.lba_low = lba; + ataio->cmd.lba_mid = lba >> 8; + ataio->cmd.lba_high = lba >> 16; + ataio->cmd.device = 0x40 | ((lba >> 24) & 0x0f); + ataio->cmd.sector_count = sector_count; +} + +void +ata_48bit_cmd(struct ccb_ataio *ataio, uint8_t cmd, uint16_t features, + uint64_t lba, uint16_t sector_count) +{ + bzero(&ataio->cmd, sizeof(ataio->cmd)); + ataio->cmd.flags = CAM_ATAIO_48BIT; + ataio->cmd.command = cmd; + ataio->cmd.features = features; + ataio->cmd.lba_low = lba; + ataio->cmd.lba_mid = lba >> 8; + ataio->cmd.lba_high = lba >> 16; + ataio->cmd.device = 0x40; + ataio->cmd.lba_low_exp = lba >> 24; + ataio->cmd.lba_mid_exp = lba >> 32; + ataio->cmd.lba_high_exp = lba >> 40; + ataio->cmd.features_exp = features >> 8; + ataio->cmd.sector_count = sector_count; + ataio->cmd.sector_count_exp = sector_count >> 8; +} + +void +ata_ncq_cmd(struct ccb_ataio *ataio, uint8_t cmd, + uint64_t lba, uint16_t sector_count) +{ + bzero(&ataio->cmd, sizeof(ataio->cmd)); + ataio->cmd.flags = CAM_ATAIO_48BIT | CAM_ATAIO_FPDMA; + ataio->cmd.command = cmd; + ataio->cmd.features = sector_count; + ataio->cmd.lba_low = lba; + ataio->cmd.lba_mid = lba >> 8; + ataio->cmd.lba_high = lba >> 16; + ataio->cmd.device = 0x40; + ataio->cmd.lba_low_exp = lba >> 24; + ataio->cmd.lba_mid_exp = lba >> 32; + ataio->cmd.lba_high_exp = lba >> 40; + ataio->cmd.features_exp = sector_count >> 8; +} + +void +ata_reset_cmd(struct ccb_ataio *ataio) +{ + bzero(&ataio->cmd, sizeof(ataio->cmd)); + ataio->cmd.flags = CAM_ATAIO_CONTROL | CAM_ATAIO_NEEDRESULT; + ataio->cmd.control = 0x04; +} + +void +ata_pm_read_cmd(struct ccb_ataio *ataio, int reg, int port) +{ + bzero(&ataio->cmd, sizeof(ataio->cmd)); + ataio->cmd.flags = CAM_ATAIO_48BIT | CAM_ATAIO_NEEDRESULT; + ataio->cmd.command = ATA_READ_PM; + ataio->cmd.features = reg; + ataio->cmd.features_exp = reg >> 8; + ataio->cmd.device = port & 0x0f; +} + +void +ata_pm_write_cmd(struct ccb_ataio *ataio, int reg, int port, uint64_t val) +{ + bzero(&ataio->cmd, sizeof(ataio->cmd)); + ataio->cmd.flags = CAM_ATAIO_48BIT | CAM_ATAIO_NEEDRESULT; + ataio->cmd.command = ATA_WRITE_PM; + ataio->cmd.features = reg; + ataio->cmd.lba_low = val >> 8; + ataio->cmd.lba_mid = val >> 16; + ataio->cmd.lba_high = val >> 24; + ataio->cmd.device = port & 0x0f; + ataio->cmd.lba_low_exp = val >> 40; + ataio->cmd.lba_mid_exp = val >> 48; + ataio->cmd.lba_high_exp = val >> 56; + ataio->cmd.features_exp = reg >> 8; + ataio->cmd.sector_count = val; + ataio->cmd.sector_count_exp = val >> 32; +} + +void +ata_bswap(int8_t *buf, int len) +{ + u_int16_t *ptr = (u_int16_t*)(buf + len); + + while (--ptr >= (u_int16_t*)buf) + *ptr = be16toh(*ptr); +} + +void +ata_btrim(int8_t *buf, int len) +{ + int8_t *ptr; + + for (ptr = buf; ptr < buf+len; ++ptr) + if (!*ptr || *ptr == '_') + *ptr = ' '; + for (ptr = buf + len - 1; ptr >= buf && *ptr == ' '; --ptr) + *ptr = 0; +} + +void +ata_bpack(int8_t *src, int8_t *dst, int len) +{ + int i, j, blank; + + for (i = j = blank = 0 ; i < len; i++) { + if (blank && src[i] == ' ') continue; + if (blank && src[i] != ' ') { + dst[j++] = src[i]; + blank = 0; + continue; + } + if (src[i] == ' ') { + blank = 1; + if (i == 0) + continue; + } + dst[j++] = src[i]; + } + while (j < len) + dst[j++] = 0x00; +} + +int +ata_max_pmode(struct ata_params *ap) +{ + if (ap->atavalid & ATA_FLAG_64_70) { + if (ap->apiomodes & 0x02) + return ATA_PIO4; + if (ap->apiomodes & 0x01) + return ATA_PIO3; + } + if (ap->mwdmamodes & 0x04) + return ATA_PIO4; + if (ap->mwdmamodes & 0x02) + return ATA_PIO3; + if (ap->mwdmamodes & 0x01) + return ATA_PIO2; + if ((ap->retired_piomode & ATA_RETIRED_PIO_MASK) == 0x200) + return ATA_PIO2; + if ((ap->retired_piomode & ATA_RETIRED_PIO_MASK) == 0x100) + return ATA_PIO1; + if ((ap->retired_piomode & ATA_RETIRED_PIO_MASK) == 0x000) + return ATA_PIO0; + return ATA_PIO0; +} + +int +ata_max_wmode(struct ata_params *ap) +{ + if (ap->mwdmamodes & 0x04) + return ATA_WDMA2; + if (ap->mwdmamodes & 0x02) + return ATA_WDMA1; + if (ap->mwdmamodes & 0x01) + return ATA_WDMA0; + return -1; +} + +int +ata_max_umode(struct ata_params *ap) +{ + if (ap->atavalid & ATA_FLAG_88) { + if (ap->udmamodes & 0x40) + return ATA_UDMA6; + if (ap->udmamodes & 0x20) + return ATA_UDMA5; + if (ap->udmamodes & 0x10) + return ATA_UDMA4; + if (ap->udmamodes & 0x08) + return ATA_UDMA3; + if (ap->udmamodes & 0x04) + return ATA_UDMA2; + if (ap->udmamodes & 0x02) + return ATA_UDMA1; + if (ap->udmamodes & 0x01) + return ATA_UDMA0; + } + return -1; +} + +int +ata_max_mode(struct ata_params *ap, int mode, int maxmode) +{ + + if (maxmode && mode > maxmode) + mode = maxmode; + + if (mode >= ATA_UDMA0 && ata_max_umode(ap) > 0) + return (min(mode, ata_max_umode(ap))); + + if (mode >= ATA_WDMA0 && ata_max_wmode(ap) > 0) + return (min(mode, ata_max_wmode(ap))); + + if (mode > ata_max_pmode(ap)) + return (min(mode, ata_max_pmode(ap))); + + return (mode); +} + Added: head/sys/cam/ata/ata_all.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/cam/ata/ata_all.h Fri Jul 10 08:18:08 2009 (r195534) @@ -0,0 +1,105 @@ +/*- + * Copyright (c) 2009 Alexander Motin + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer, + * without modification, immediately at the beginning of the file. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#ifndef CAM_ATA_ALL_H +#define CAM_ATA_ALL_H 1 + +#include + +struct ccb_ataio; +struct cam_periph; +union ccb; + +struct ata_cmd { + u_int8_t flags; /* ATA command flags */ +#define CAM_ATAIO_48BIT 0x01 /* Command has 48-bit format */ +#define CAM_ATAIO_FPDMA 0x02 /* FPDMA command */ +#define CAM_ATAIO_CONTROL 0x04 /* Control, not a command */ +#define CAM_ATAIO_NEEDRESULT 0x08 /* Request requires result. */ + + u_int8_t command; + u_int8_t features; + + u_int8_t lba_low; + u_int8_t lba_mid; + u_int8_t lba_high; + u_int8_t device; + + u_int8_t lba_low_exp; + u_int8_t lba_mid_exp; + u_int8_t lba_high_exp; + u_int8_t features_exp; + + u_int8_t sector_count; + u_int8_t sector_count_exp; + u_int8_t control; +}; + +struct ata_res { + u_int8_t flags; /* ATA command flags */ +#define CAM_ATAIO_48BIT 0x01 /* Command has 48-bit format */ + + u_int8_t status; + u_int8_t error; + + u_int8_t lba_low; + u_int8_t lba_mid; + u_int8_t lba_high; + u_int8_t device; + + u_int8_t lba_low_exp; + u_int8_t lba_mid_exp; + u_int8_t lba_high_exp; + + u_int8_t sector_count; + u_int8_t sector_count_exp; +}; + +int ata_version(int ver); +void ata_print_ident(struct ata_params *ident_data); + +void ata_36bit_cmd(struct ccb_ataio *ataio, uint8_t cmd, uint8_t features, + uint32_t lba, uint8_t sector_count); +void ata_48bit_cmd(struct ccb_ataio *ataio, uint8_t cmd, uint16_t features, + uint64_t lba, uint16_t sector_count); +void ata_ncq_cmd(struct ccb_ataio *ataio, uint8_t cmd, + uint64_t lba, uint16_t sector_count); +void ata_reset_cmd(struct ccb_ataio *ataio); +void ata_pm_read_cmd(struct ccb_ataio *ataio, int reg, int port); +void ata_pm_write_cmd(struct ccb_ataio *ataio, int reg, int port, uint64_t val); + +void ata_bswap(int8_t *buf, int len); +void ata_btrim(int8_t *buf, int len); +void ata_bpack(int8_t *src, int8_t *dst, int len); + +int ata_max_pmode(struct ata_params *ap); +int ata_max_wmode(struct ata_params *ap); +int ata_max_umode(struct ata_params *ap); +int ata_max_mode(struct ata_params *ap, int mode, int maxmode); + +#endif Added: head/sys/cam/ata/ata_da.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/cam/ata/ata_da.c Fri Jul 10 08:18:08 2009 (r195534) @@ -0,0 +1,1144 @@ +/*- + * Copyright (c) 2009 Alexander Motin + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer, + * without modification, immediately at the beginning of the file. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@FreeBSD.ORG Fri Jul 10 08:23:31 2009 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 8F8031065672; Fri, 10 Jul 2009 08:23:31 +0000 (UTC) (envelope-from phk@critter.freebsd.dk) Received: from phk.freebsd.dk (phk.freebsd.dk [130.225.244.222]) by mx1.freebsd.org (Postfix) with ESMTP id 4F0278FC1B; Fri, 10 Jul 2009 08:23:31 +0000 (UTC) (envelope-from phk@critter.freebsd.dk) Received: from critter.freebsd.dk (unknown [192.168.64.3]) by phk.freebsd.dk (Postfix) with ESMTP id 2DE376995B; Fri, 10 Jul 2009 08:23:30 +0000 (UTC) Received: from critter.freebsd.dk (localhost [127.0.0.1]) by critter.freebsd.dk (8.14.3/8.14.3) with ESMTP id n6A8Nb08037132; Fri, 10 Jul 2009 08:23:38 GMT (envelope-from phk@critter.freebsd.dk) To: Scott Long From: "Poul-Henning Kamp" In-Reply-To: Your message of "Fri, 10 Jul 2009 08:18:08 GMT." <200907100818.n6A8I8p1011853@svn.freebsd.org> Date: Fri, 10 Jul 2009 08:23:37 +0000 Message-ID: <37131.1247214217@critter.freebsd.dk> Sender: phk@critter.freebsd.dk Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org Subject: Re: svn commit: r195534 - in head: etc/mtree include lib/libcam sbin/camcontrol share/man/man4 sys/cam sys/cam/ata sys/cam/scsi sys/conf sys/dev/advansys sys/dev/ahci sys/dev/aic7xxx sys/dev/amd sys/de... 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, 10 Jul 2009 08:23:32 -0000 In message <200907100818.n6A8I8p1011853@svn.freebsd.org>, Scott Long writes: > ATA drives are accessed via 'ada' device nodes. It there a particular good reason why we insist on making this silly mistake every five years ? I am pretty sure you were around when Justin won friends by renaming the SCSI disk devices ? -- Poul-Henning Kamp | UNIX since Zilog Zeus 3.20 phk@FreeBSD.ORG | TCP/IP since RFC 956 FreeBSD committer | BSD since 4.3-tahoe Never attribute to malice what can adequately be explained by incompetence. From owner-svn-src-head@FreeBSD.ORG Fri Jul 10 08:32:04 2009 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 2792C106564A; Fri, 10 Jul 2009 08:32:04 +0000 (UTC) (envelope-from scottl@samsco.org) Received: from pooker.samsco.org (pooker.samsco.org [168.103.85.57]) by mx1.freebsd.org (Postfix) with ESMTP id CA6E18FC19; Fri, 10 Jul 2009 08:32:03 +0000 (UTC) (envelope-from scottl@samsco.org) Received: from phobos.local (pooker.samsco.org [168.103.85.57]) by pooker.samsco.org (8.14.2/8.14.2) with ESMTP id n6A8VvGu023259; Fri, 10 Jul 2009 02:31:57 -0600 (MDT) (envelope-from scottl@samsco.org) Message-ID: <4A56FC7C.8060107@samsco.org> Date: Fri, 10 Jul 2009 02:31:56 -0600 From: Scott Long User-Agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X; en-US; rv:1.8.1.13) Gecko/20080313 SeaMonkey/1.1.9 MIME-Version: 1.0 To: Poul-Henning Kamp References: <37131.1247214217@critter.freebsd.dk> In-Reply-To: <37131.1247214217@critter.freebsd.dk> X-Enigmail-Version: 0.95.6 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-4.4 required=3.8 tests=ALL_TRUSTED,BAYES_00 autolearn=ham version=3.1.8 X-Spam-Checker-Version: SpamAssassin 3.1.8 (2007-02-13) on pooker.samsco.org Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org, Scott Long Subject: Re: svn commit: r195534 - in head: etc/mtree include lib/libcam sbin/camcontrol share/man/man4 sys/cam sys/cam/ata sys/cam/scsi sys/conf sys/dev/advansys sys/dev/ahci sys/dev/aic7xxx sys/dev/amd sys/de... 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, 10 Jul 2009 08:32:04 -0000 Poul-Henning Kamp wrote: > In message <200907100818.n6A8I8p1011853@svn.freebsd.org>, Scott Long writes: > >> ATA drives are accessed via 'ada' device nodes. > > It there a particular good reason why we insist on making this > silly mistake every five years ? > > I am pretty sure you were around when Justin won friends by renaming > the SCSI disk devices ? > 1. I clearly stated that the name is experimental and that a change in the future is possible. 2. If the name does change, and if it changes to either 'ad' or 'da', it can't happen until the newbus stuff is done first. I desperately need help with that, btw, starting with removing the need for Giant from newbus. Contact myself and/or Warner for details. 3. Exposing driver name details as the primary handle for users is something that I disagree with, and I'd ultimately like to see every direct-access block device in the system be called 'disk'. Or "phk". Or "bde" for all I care =-) 4. While feelings may have been hurt 12 years ago, life did, in fact, go on. Scott From owner-svn-src-head@FreeBSD.ORG Fri Jul 10 08:38:23 2009 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 DE733106564A; Fri, 10 Jul 2009 08:38:23 +0000 (UTC) (envelope-from phk@critter.freebsd.dk) Received: from phk.freebsd.dk (phk.freebsd.dk [130.225.244.222]) by mx1.freebsd.org (Postfix) with ESMTP id 9D77C8FC0C; Fri, 10 Jul 2009 08:38:23 +0000 (UTC) (envelope-from phk@critter.freebsd.dk) Received: from critter.freebsd.dk (unknown [192.168.64.3]) by phk.freebsd.dk (Postfix) with ESMTP id 96C0F69959; Fri, 10 Jul 2009 08:38:22 +0000 (UTC) Received: from critter.freebsd.dk (localhost [127.0.0.1]) by critter.freebsd.dk (8.14.3/8.14.3) with ESMTP id n6A8cUFP080356; Fri, 10 Jul 2009 08:38:31 GMT (envelope-from phk@critter.freebsd.dk) To: Scott Long From: "Poul-Henning Kamp" In-Reply-To: Your message of "Fri, 10 Jul 2009 02:31:56 CST." <4A56FC7C.8060107@samsco.org> Date: Fri, 10 Jul 2009 08:38:30 +0000 Message-ID: <80355.1247215110@critter.freebsd.dk> Sender: phk@critter.freebsd.dk Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org, Scott Long Subject: Re: svn commit: r195534 - in head: etc/mtree include lib/libcam sbin/camcontrol share/man/man4 sys/cam sys/cam/ata sys/cam/scsi sys/conf sys/dev/advansys sys/dev/ahci sys/dev/aic7xxx sys/dev/amd sys/de... 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, 10 Jul 2009 08:38:24 -0000 In message <4A56FC7C.8060107@samsco.org>, Scott Long writes: >1. I clearly stated that the name is experimental and that a change in >the future is possible. But what on earth is the point ?? You want to _avoid_ people testing your code ? >4. While feelings may have been hurt 12 years ago, life did, in fact, go >on. Yes, after a considerable number of "My system cannot find its harddisk any more" support emails. I'm all for unifying the namespace, but still remember how much pain the "didn't find that disk, lets renumber all of the rest of them" causes, so I tend to prefer physically bound names. -- Poul-Henning Kamp | UNIX since Zilog Zeus 3.20 phk@FreeBSD.ORG | TCP/IP since RFC 956 FreeBSD committer | BSD since 4.3-tahoe Never attribute to malice what can adequately be explained by incompetence. From owner-svn-src-head@FreeBSD.ORG Fri Jul 10 10:29:16 2009 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 63C9B106567A; Fri, 10 Jul 2009 10:29: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 525B48FC12; Fri, 10 Jul 2009 10:29:16 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n6AATGFA017109; Fri, 10 Jul 2009 10:29:16 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n6AATGrk017107; Fri, 10 Jul 2009 10:29:16 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <200907101029.n6AATGrk017107@svn.freebsd.org> From: Konstantin Belousov Date: Fri, 10 Jul 2009 10:29: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: r195535 - 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: Fri, 10 Jul 2009 10:29:17 -0000 Author: kib Date: Fri Jul 10 10:29:16 2009 New Revision: 195535 URL: http://svn.freebsd.org/changeset/base/195535 Log: When amd64 CPU cannot load segment descriptor during trap return to usermode, it generates GPF, that is mirrored to user mode as SIGSEGV. The offending register in mcontext should contain the value loading of which generated the GPF, and it is so on i386. On amd64, we currently report segment descriptor in tf_err, while segment register contains the corrected value loaded by trap handler. Fix the issue by behaving like i386, reloading segment register in trap frame after signal frame is pushed onto user stack. Noted and tested by: pho Approved by: re (kensmith) Modified: head/sys/amd64/amd64/exception.S Modified: head/sys/amd64/amd64/exception.S ============================================================================== --- head/sys/amd64/amd64/exception.S Fri Jul 10 08:18:08 2009 (r195534) +++ head/sys/amd64/amd64/exception.S Fri Jul 10 10:29:16 2009 (r195535) @@ -766,38 +766,38 @@ doreti_iret_fault: .globl ds_load_fault ds_load_fault: movl $T_PROTFLT,TF_TRAPNO(%rsp) - movzwl TF_DS(%rsp),%edx - movl %edx,TF_ERR(%rsp) + movq %rsp, %rdi + call trap movw $KUDSEL,TF_DS(%rsp) - jmp calltrap + jmp doreti ALIGN_TEXT .globl es_load_fault es_load_fault: movl $T_PROTFLT,TF_TRAPNO(%rsp) - movzwl TF_ES(%rsp),%edx - movl %edx,TF_ERR(%rsp) + movq %rsp, %rdi + call trap movw $KUDSEL,TF_ES(%rsp) - jmp calltrap + jmp doreti ALIGN_TEXT .globl fs_load_fault fs_load_fault: movl $T_PROTFLT,TF_TRAPNO(%rsp) - movzwl TF_FS(%rsp),%edx - movl %edx,TF_ERR(%rsp) + movq %rsp, %rdi + call trap movw $KUF32SEL,TF_FS(%rsp) - jmp calltrap + jmp doreti ALIGN_TEXT .globl gs_load_fault gs_load_fault: popfq movl $T_PROTFLT,TF_TRAPNO(%rsp) - movzwl TF_GS(%rsp),%edx - movl %edx,TF_ERR(%rsp) + movq %rsp, %rdi + call trap movw $KUG32SEL,TF_GS(%rsp) - jmp calltrap + jmp doreti #ifdef HWPMC_HOOKS ENTRY(end_exceptions) #endif From owner-svn-src-head@FreeBSD.ORG Fri Jul 10 11:21:36 2009 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 49081106566C; Fri, 10 Jul 2009 11:21:36 +0000 (UTC) (envelope-from des@des.no) Received: from tim.des.no (tim.des.no [194.63.250.121]) by mx1.freebsd.org (Postfix) with ESMTP id C3E0D8FC24; Fri, 10 Jul 2009 11:21:35 +0000 (UTC) (envelope-from des@des.no) Received: from ds4.des.no (des.no [84.49.246.2]) by smtp.des.no (Postfix) with ESMTP id 0F51C6D41D; Fri, 10 Jul 2009 13:21:35 +0200 (CEST) Received: by ds4.des.no (Postfix, from userid 1001) id DF46D844B5; Fri, 10 Jul 2009 13:21:34 +0200 (CEST) From: =?utf-8?Q?Dag-Erling_Sm=C3=B8rgrav?= To: "Poul-Henning Kamp" References: <80355.1247215110@critter.freebsd.dk> Date: Fri, 10 Jul 2009 13:21:34 +0200 In-Reply-To: <80355.1247215110@critter.freebsd.dk> (Poul-Henning Kamp's message of "Fri, 10 Jul 2009 08:38:30 +0000") Message-ID: <86skh4u6kh.fsf@ds4.des.no> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.92 (berkeley-unix) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Cc: svn-src-head@FreeBSD.org, Scott Long , src-committers@FreeBSD.org, Scott Long , svn-src-all@FreeBSD.org Subject: Re: svn commit: r195534 - in head: etc/mtree include lib/libcam sbin/camcontrol share/man/man4 sys/cam sys/cam/ata sys/cam/scsi sys/conf sys/dev/advansys sys/dev/ahci sys/dev/aic7xxx sys/dev/amd sys/de... 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, 10 Jul 2009 11:21:36 -0000 "Poul-Henning Kamp" writes: > I'm all for unifying the namespace, but still remember how much pain > the "didn't find that disk, lets renumber all of the rest of them" > causes, so I tend to prefer physically bound names. cXtYdZ for the win! DES --=20 Dag-Erling Sm=C3=B8rgrav - des@des.no From owner-svn-src-head@FreeBSD.ORG Fri Jul 10 11:56:51 2009 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 DCDE4106566B; Fri, 10 Jul 2009 11:56:51 +0000 (UTC) (envelope-from phk@critter.freebsd.dk) Received: from phk.freebsd.dk (phk.freebsd.dk [130.225.244.222]) by mx1.freebsd.org (Postfix) with ESMTP id 9AA738FC14; Fri, 10 Jul 2009 11:56:51 +0000 (UTC) (envelope-from phk@critter.freebsd.dk) Received: from critter.freebsd.dk (unknown [192.168.64.3]) by phk.freebsd.dk (Postfix) with ESMTP id 6880269959; Fri, 10 Jul 2009 11:56:50 +0000 (UTC) Received: from critter.freebsd.dk (localhost [127.0.0.1]) by critter.freebsd.dk (8.14.3/8.14.3) with ESMTP id n6ABuwca088239; Fri, 10 Jul 2009 11:56:58 GMT (envelope-from phk@critter.freebsd.dk) To: =?utf-8?Q?Dag-Erling_Sm=C3=B8rgrav?= From: "Poul-Henning Kamp" In-Reply-To: Your message of "Fri, 10 Jul 2009 13:21:34 +0200." <86skh4u6kh.fsf@ds4.des.no> Date: Fri, 10 Jul 2009 11:56:58 +0000 Message-ID: <88238.1247227018@critter.freebsd.dk> Sender: phk@critter.freebsd.dk Cc: svn-src-head@FreeBSD.org, Scott Long , src-committers@FreeBSD.org, Scott Long , svn-src-all@FreeBSD.org Subject: Re: svn commit: r195534 - in head: etc/mtree include lib/libcam sbin/camcontrol share/man/man4 sys/cam sys/cam/ata sys/cam/scsi sys/conf sys/dev/advansys sys/dev/ahci sys/dev/aic7xxx sys/dev/amd sys/de... 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, 10 Jul 2009 11:56:52 -0000 In message <86skh4u6kh.fsf@ds4.des.no>, =?utf-8?Q?Dag-Erling_Sm=C3=B8rgrav?= wr ites: >"Poul-Henning Kamp" writes: >> I'm all for unifying the namespace, but still remember how much pain >> the "didn't find that disk, lets renumber all of the rest of them" >> causes, so I tend to prefer physically bound names. > >cXtYdZ for the win! Actually, maybe the solution is to push glabel much more agrressively (ie: read sysinstall) -- Poul-Henning Kamp | UNIX since Zilog Zeus 3.20 phk@FreeBSD.ORG | TCP/IP since RFC 956 FreeBSD committer | BSD since 4.3-tahoe Never attribute to malice what can adequately be explained by incompetence. From owner-svn-src-head@FreeBSD.ORG Fri Jul 10 12:52:01 2009 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 3E2471065672; Fri, 10 Jul 2009 12:52:01 +0000 (UTC) (envelope-from ivoras@gmail.com) Received: from mail-ew0-f227.google.com (mail-ew0-f227.google.com [209.85.219.227]) by mx1.freebsd.org (Postfix) with ESMTP id 6A6E28FC22; Fri, 10 Jul 2009 12:51:59 +0000 (UTC) (envelope-from ivoras@gmail.com) Received: by ewy27 with SMTP id 27so161632ewy.43 for ; Fri, 10 Jul 2009 05:51:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:sender:received:in-reply-to :references:from:date:x-google-sender-auth:message-id:subject:to:cc :content-type:content-transfer-encoding; bh=WzRyiZCI+5HlOnQrurbaeUcIFBAZN+stjowsZeLo154=; b=othMzRd+flYHZ2ygj+dqT19VPHj4I0R/+bxlCtFkZ9N1N1pp4dZXRhWgCkvk2RHINX j0OURVojjBdopB+QLLO2PCNnF8u0VvOkruOUhFQgWTlDL6iUMu5s/JnC6J5bgpsO5DQU AuaOebU7a44CpxqpotSPg2UoAC1yzxyruA8wk= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:from:date :x-google-sender-auth:message-id:subject:to:cc:content-type :content-transfer-encoding; b=mwMmv9VJsmf9Vo/fMZvo6gAD2tc3OHJUAEpeSwsahghHIQm3Nzd0cwjS78FECLpX8X oCbFqP5v8oPy7Fj2Y8NZ6L4aUM6KtOID/alLSkzMxiQmmYMBhqe1IZVDv5Q2e9Wlbzzh 8+0epH9I331dQcZe4r4Vjhk+CzKOFmi4/BqkY= MIME-Version: 1.0 Sender: ivoras@gmail.com Received: by 10.210.43.11 with SMTP id q11mr1214018ebq.15.1247230319089; Fri, 10 Jul 2009 05:51:59 -0700 (PDT) In-Reply-To: <88238.1247227018@critter.freebsd.dk> References: <86skh4u6kh.fsf@ds4.des.no> <88238.1247227018@critter.freebsd.dk> From: Ivan Voras Date: Fri, 10 Jul 2009 14:51:39 +0200 X-Google-Sender-Auth: bf561e97becb881c Message-ID: <9bbcef730907100551l58e97392oefa5daf87efa477a@mail.gmail.com> To: Poul-Henning Kamp Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Cc: Scott Long , src-committers@freebsd.org, svn-src-all@freebsd.org, Scott Long , svn-src-head@freebsd.org, =?UTF-8?Q?Dag=2DErling_Sm=C3=B8rgrav?= Subject: Re: svn commit: r195534 - in head: etc/mtree include lib/libcam sbin/camcontrol share/man/man4 sys/cam sys/cam/ata sys/cam/scsi sys/conf sys/dev/advansys sys/dev/ahci sys/dev/aic7xxx sys/dev/amd sys/de... 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, 10 Jul 2009 12:52:02 -0000 2009/7/10 Poul-Henning Kamp : > In message <86skh4u6kh.fsf@ds4.des.no>, =?utf-8?Q?Dag-Erling_Sm=C3=B8rgrav?= wr > ites: >>"Poul-Henning Kamp" writes: >>> I'm all for unifying the namespace, but still remember how much pain >>> the "didn't find that disk, lets renumber all of the rest of them" >>> causes, so I tend to prefer physically bound names. >> >>cXtYdZ for the win! > > Actually, maybe the solution is to push glabel much more agrressively > (ie: read sysinstall) Publishing drive IDs from the driver to the GEOM layer will naturally and automatically provide a reasonable unique ID to be used by sysinstall et al. It's done for ATA, but AFAIK not for CAM. I'm a bit puzzled about that - it looks trivial? I see that "camcontrol inquiry -S" works: # camcontrol inquiry da0 -S B399P6A04GRS ...but apparently not in all cases - the same on another machine (a virtual machine under VMWare) doesn't print out anything. Then there are non-da devices: # camcontrol inquiry mfid0 -S camcontrol: cam_lookup_pass: CAMGETPASSTHRU ioctl failed cam_lookup_pass: No such file or directory cam_lookup_pass: either the pass driver isn't in your kernel cam_lookup_pass: or mfid0 doesn't exist I don't know enough about the SCSI drivers to conclude anything useful. From owner-svn-src-head@FreeBSD.ORG Fri Jul 10 14:15:53 2009 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 D6ADE1065672; Fri, 10 Jul 2009 14:15:53 +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 A950D8FC19; Fri, 10 Jul 2009 14:15:53 +0000 (UTC) (envelope-from thompsa@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n6AEFrBg022383; Fri, 10 Jul 2009 14:15:53 GMT (envelope-from thompsa@svn.freebsd.org) Received: (from thompsa@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n6AEFrb8022379; Fri, 10 Jul 2009 14:15:53 GMT (envelope-from thompsa@svn.freebsd.org) Message-Id: <200907101415.n6AEFrb8022379@svn.freebsd.org> From: Andrew Thompson Date: Fri, 10 Jul 2009 14:15: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: r195560 - head/lib/libusb 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, 10 Jul 2009 14:15:54 -0000 Author: thompsa Date: Fri Jul 10 14:15:53 2009 New Revision: 195560 URL: http://svn.freebsd.org/changeset/base/195560 Log: Sync the libusb 1.0 exported api to the latest GSoC code. - Fix possible uninitialised variables and null derefs - Support big transfers - Various bug fixes and style changes Submitted by: Sylvestre Gallon Sponsored by: Google Summer of Code 2009 Approved by: re (kib) Modified: head/lib/libusb/libusb.h head/lib/libusb/libusb10.c head/lib/libusb/libusb10.h head/lib/libusb/libusb10_desc.c head/lib/libusb/libusb10_io.c Modified: head/lib/libusb/libusb.h ============================================================================== --- head/lib/libusb/libusb.h Fri Jul 10 13:33:22 2009 (r195559) +++ head/lib/libusb/libusb.h Fri Jul 10 14:15:53 2009 (r195560) @@ -27,14 +27,16 @@ #ifndef __LIBUSB_H__ #define __LIBUSB_H__ +#include +#include +#include +#include + #include #include #include #include -#include -#include -#include #ifdef __cplusplus extern "C" { @@ -44,10 +46,6 @@ extern "C" { #endif -struct list_head { - struct list_head *prev, *next; -}; - /* libusb enums */ enum libusb_class_code { @@ -183,6 +181,33 @@ enum libusb_debug_level { LIBUSB_DEBUG_TRANSFER=2, }; +/* internal structures */ + +typedef struct libusb_pollfd { + int fd; + short events; +} libusb_pollfd; + +struct usb_pollfd { + TAILQ_ENTRY(usb_pollfd) list; + struct libusb_pollfd pollfd; +}; + +struct usb_transfer { + TAILQ_ENTRY(usb_transfer) list; + int num_iso_packets; + struct timeval timeout; + int transferred; + uint8_t flags; +}; + +struct usb_ep_tr { + TAILQ_ENTRY(usb_ep_tr) list; + uint8_t addr; + uint8_t idx; + uint8_t flags; + void *os_priv; +}; /* libusb structures */ typedef void (*libusb_pollfd_added_cb) (int fd, short events, void *user_data); @@ -194,16 +219,16 @@ typedef struct libusb_context { int ctrl_pipe[2]; - struct list_head usb_devs; + TAILQ_HEAD(usb_devs_list, libusb_device) usb_devs; pthread_mutex_t usb_devs_lock; - struct list_head open_devs; + TAILQ_HEAD(open_devs_list, libusb_device_handle) open_devs; pthread_mutex_t open_devs_lock; - struct list_head flying_transfers; + TAILQ_HEAD(flying_transfers_list, usb_transfer) flying_transfers; pthread_mutex_t flying_transfers_lock; - struct list_head pollfds; + TAILQ_HEAD(pollfds_list, usb_pollfd) pollfds; pthread_mutex_t pollfds_lock; unsigned int pollfd_modify; @@ -230,7 +255,7 @@ typedef struct libusb_device { uint8_t device_address; uint8_t num_configurations; - struct list_head list; + TAILQ_ENTRY(libusb_device) list; unsigned long session_data; void *os_priv; } libusb_device; @@ -239,9 +264,10 @@ typedef struct libusb_device_handle { pthread_mutex_t lock; unsigned long claimed_interfaces; - struct list_head list; + TAILQ_ENTRY(libusb_device_handle) list; struct libusb_device *dev; void *os_priv; + TAILQ_HEAD(ep_list, usb_ep_tr) ep_list; } libusb_device_handle; typedef struct libusb_device_descriptor { @@ -343,11 +369,6 @@ typedef struct libusb_transfer { struct libusb_iso_packet_descriptor iso_packet_desc[0]; } libusb_transfer __aligned(sizeof(void *)); -typedef struct libusb_pollfd { - int fd; - short events; -} libusb_pollfd; - /* Library initialisation */ void libusb_set_debug(libusb_context * ctx, int level); @@ -360,6 +381,7 @@ ssize_t libusb_get_device_list(libusb_co void libusb_free_device_list(libusb_device ** list, int unref_devices); uint8_t libusb_get_bus_number(libusb_device * dev); uint8_t libusb_get_device_address(libusb_device * dev); +int libusb_clear_halt(libusb_device_handle *devh, unsigned char endpoint); int libusb_get_max_packet_size(libusb_device * dev, unsigned char endpoint); libusb_device *libusb_ref_device(libusb_device * dev); void libusb_unref_device(libusb_device * dev); Modified: head/lib/libusb/libusb10.c ============================================================================== --- head/lib/libusb/libusb10.c Fri Jul 10 13:33:22 2009 (r195559) +++ head/lib/libusb/libusb10.c Fri Jul 10 14:15:53 2009 (r195560) @@ -75,8 +75,8 @@ libusb_init(libusb_context ** context) pthread_mutex_init(&ctx->usb_devs_lock, NULL); pthread_mutex_init(&ctx->open_devs_lock, NULL); - USB_LIST_INIT(&ctx->usb_devs); - USB_LIST_INIT(&ctx->open_devs); + TAILQ_INIT(&ctx->usb_devs); + TAILQ_INIT(&ctx->open_devs); pthread_mutex_init(&ctx->flying_transfers_lock, NULL); pthread_mutex_init(&ctx->pollfds_lock, NULL); @@ -85,8 +85,8 @@ libusb_init(libusb_context ** context) pthread_mutex_init(&ctx->event_waiters_lock, NULL); pthread_cond_init(&ctx->event_waiters_cond, NULL); - USB_LIST_INIT(&ctx->flying_transfers); - USB_LIST_INIT(&ctx->pollfds); + TAILQ_INIT(&ctx->flying_transfers); + TAILQ_INIT(&ctx->pollfds); ret = pipe(ctx->ctrl_pipe); if (ret < 0) { @@ -123,7 +123,7 @@ libusb_exit(libusb_context * ctx) { GET_CONTEXT(ctx); - dprintf(ctx, LIBUSB_DEBUG_FUNCTION, "libusb_exit enter"); + DPRINTF(ctx, LIBUSB_DEBUG_FUNCTION, "libusb_exit enter"); usb_remove_pollfd(ctx, ctx->ctrl_pipe[0]); close(ctx->ctrl_pipe[0]); close(ctx->ctrl_pipe[1]); @@ -135,7 +135,7 @@ libusb_exit(libusb_context * ctx) pthread_mutex_unlock(&default_context_lock); free(ctx); - dprintf(ctx, LIBUSB_DEBUG_FUNCTION, "libusb_exit leave"); + DPRINTF(ctx, LIBUSB_DEBUG_FUNCTION, "libusb_exit leave"); } /* Device handling and initialisation. */ @@ -150,7 +150,7 @@ libusb_get_device_list(libusb_context * int i; GET_CONTEXT(ctx); - dprintf(ctx, LIBUSB_DEBUG_FUNCTION, "libusb_get_device_list enter"); + DPRINTF(ctx, LIBUSB_DEBUG_FUNCTION, "libusb_get_device_list enter"); usb_backend = libusb20_be_alloc_default(); if (usb_backend == NULL) @@ -178,6 +178,10 @@ libusb_get_device_list(libusb_context * ddesc = libusb20_dev_get_device_desc(pdev); dev = malloc(sizeof(*dev)); if (dev == NULL) { + while (i != 0) { + libusb_unref_device((*list)[i - 1]); + i--; + } free(*list); libusb20_be_free(usb_backend); return (LIBUSB_ERROR_NO_MEM); @@ -194,7 +198,7 @@ libusb_get_device_list(libusb_context * dev->os_priv = pdev; pthread_mutex_lock(&ctx->usb_devs_lock); - LIST_ADD(&dev->list, &ctx->usb_devs); + TAILQ_INSERT_HEAD(&ctx->usb_devs, dev, list); pthread_mutex_unlock(&ctx->usb_devs_lock); (*list)[i] = libusb_ref_device(dev); @@ -203,7 +207,7 @@ libusb_get_device_list(libusb_context * (*list)[i] = NULL; libusb20_be_free(usb_backend); - dprintf(ctx, LIBUSB_DEBUG_FUNCTION, "libusb_get_device_list leave"); + DPRINTF(ctx, LIBUSB_DEBUG_FUNCTION, "libusb_get_device_list leave"); return (i); } @@ -219,7 +223,7 @@ libusb_free_device_list(libusb_device ** ctx = NULL; GET_CONTEXT(ctx); - dprintf(ctx, LIBUSB_DEBUG_FUNCTION, "libusb_free_device_list enter"); + DPRINTF(ctx, LIBUSB_DEBUG_FUNCTION, "libusb_free_device_list enter"); if (list == NULL) return ; @@ -229,7 +233,7 @@ libusb_free_device_list(libusb_device ** libusb_unref_device(list[i]); } free(list); - dprintf(ctx, LIBUSB_DEBUG_FUNCTION, "libusb_free_device_list leave"); + DPRINTF(ctx, LIBUSB_DEBUG_FUNCTION, "libusb_free_device_list leave"); } uint8_t @@ -239,11 +243,11 @@ libusb_get_bus_number(libusb_device * de ctx = NULL; GET_CONTEXT(ctx); - dprintf(ctx, LIBUSB_DEBUG_FUNCTION, "libusb_get_bus_number enter"); + DPRINTF(ctx, LIBUSB_DEBUG_FUNCTION, "libusb_get_bus_number enter"); if (dev == NULL) return (LIBUSB_ERROR_NO_DEVICE); - dprintf(ctx, LIBUSB_DEBUG_FUNCTION, "libusb_get_bus_number leave"); + DPRINTF(ctx, LIBUSB_DEBUG_FUNCTION, "libusb_get_bus_number leave"); return (dev->bus_number); } @@ -254,11 +258,11 @@ libusb_get_device_address(libusb_device ctx = NULL; GET_CONTEXT(ctx); - dprintf(ctx, LIBUSB_DEBUG_FUNCTION, "libusb_get_device_address enter"); + DPRINTF(ctx, LIBUSB_DEBUG_FUNCTION, "libusb_get_device_address enter"); if (dev == NULL) return (LIBUSB_ERROR_NO_DEVICE); - dprintf(ctx, LIBUSB_DEBUG_FUNCTION, "libusb_get_device_address leave"); + DPRINTF(ctx, LIBUSB_DEBUG_FUNCTION, "libusb_get_device_address leave"); return (dev->device_address); } @@ -274,7 +278,7 @@ libusb_get_max_packet_size(libusb_device ctx = NULL; GET_CONTEXT(ctx); - dprintf(ctx, LIBUSB_DEBUG_FUNCTION, "libusb_get_max_packet_size enter"); + DPRINTF(ctx, LIBUSB_DEBUG_FUNCTION, "libusb_get_max_packet_size enter"); if (dev == NULL) return (LIBUSB_ERROR_NO_DEVICE); @@ -299,7 +303,7 @@ libusb_get_max_packet_size(libusb_device out: libusb_free_config_descriptor(pdconf); - dprintf(ctx, LIBUSB_DEBUG_FUNCTION, "libusb_get_max_packet_size leave"); + DPRINTF(ctx, LIBUSB_DEBUG_FUNCTION, "libusb_get_max_packet_size leave"); return (ret); } @@ -310,7 +314,7 @@ libusb_ref_device(libusb_device * dev) ctx = NULL; GET_CONTEXT(ctx); - dprintf(ctx, LIBUSB_DEBUG_FUNCTION, "libusb_ref_device enter"); + DPRINTF(ctx, LIBUSB_DEBUG_FUNCTION, "libusb_ref_device enter"); if (dev == NULL) return (NULL); @@ -319,7 +323,7 @@ libusb_ref_device(libusb_device * dev) dev->refcnt++; pthread_mutex_unlock(&dev->lock); - dprintf(ctx, LIBUSB_DEBUG_FUNCTION, "libusb_ref_device leave"); + DPRINTF(ctx, LIBUSB_DEBUG_FUNCTION, "libusb_ref_device leave"); return (dev); } @@ -330,7 +334,7 @@ libusb_unref_device(libusb_device * dev) ctx = NULL; GET_CONTEXT(ctx); - dprintf(ctx, LIBUSB_DEBUG_FUNCTION, "libusb_unref_device enter"); + DPRINTF(ctx, LIBUSB_DEBUG_FUNCTION, "libusb_unref_device enter"); if (dev == NULL) return; @@ -341,13 +345,13 @@ libusb_unref_device(libusb_device * dev) if (dev->refcnt == 0) { pthread_mutex_lock(&dev->ctx->usb_devs_lock); - LIST_DEL(&dev->list); + TAILQ_REMOVE(&ctx->usb_devs, dev, list); pthread_mutex_unlock(&dev->ctx->usb_devs_lock); libusb20_dev_free(dev->os_priv); free(dev); } - dprintf(ctx, LIBUSB_DEBUG_FUNCTION, "libusb_unref_device leave"); + DPRINTF(ctx, LIBUSB_DEBUG_FUNCTION, "libusb_unref_device leave"); } int @@ -360,7 +364,7 @@ libusb_open(libusb_device * dev, libusb_ int err; GET_CONTEXT(ctx); - dprintf(ctx, LIBUSB_DEBUG_FUNCTION, "libusb_open enter"); + DPRINTF(ctx, LIBUSB_DEBUG_FUNCTION, "libusb_open enter"); dummy = 1; if (devh == NULL) @@ -378,6 +382,7 @@ libusb_open(libusb_device * dev, libusb_ memset(hdl, 0, sizeof(*hdl)); pthread_mutex_init(&hdl->lock, NULL); + TAILQ_INIT(&hdl->ep_list); hdl->dev = libusb_ref_device(dev); hdl->claimed_interfaces = 0; hdl->os_priv = dev->os_priv; @@ -390,7 +395,7 @@ libusb_open(libusb_device * dev, libusb_ } pthread_mutex_lock(&ctx->open_devs_lock); - LIST_ADD(&hdl->list, &ctx->open_devs); + TAILQ_INSERT_HEAD(&ctx->open_devs, hdl, list); pthread_mutex_unlock(&ctx->open_devs_lock); *devh = hdl; @@ -414,7 +419,7 @@ libusb_open(libusb_device * dev, libusb_ pthread_mutex_unlock(&ctx->pollfd_modify_lock); libusb_unlock_events(ctx); - dprintf(ctx, LIBUSB_DEBUG_FUNCTION, "libusb_open leave"); + DPRINTF(ctx, LIBUSB_DEBUG_FUNCTION, "libusb_open leave"); return (0); } @@ -429,7 +434,7 @@ libusb_open_device_with_vid_pid(libusb_c int i, j; GET_CONTEXT(ctx); - dprintf(ctx, LIBUSB_DEBUG_FUNCTION, "libusb_open_device_width_vid_pid enter"); + DPRINTF(ctx, LIBUSB_DEBUG_FUNCTION, "libusb_open_device_width_vid_pid enter"); devh = NULL; @@ -440,13 +445,15 @@ libusb_open_device_with_vid_pid(libusb_c pdev = (struct libusb20_device *)devs[j]->os_priv; pdesc = libusb20_dev_get_device_desc(pdev); if (pdesc->idVendor == vendor_id && - pdesc->idProduct == product_id) + pdesc->idProduct == product_id) { if (libusb_open(devs[j], &devh) < 0) devh = NULL; + break ; + } } libusb_free_device_list(devs, 1); - dprintf(ctx, LIBUSB_DEBUG_FUNCTION, "libusb_open_device_width_vid_pid leave"); + DPRINTF(ctx, LIBUSB_DEBUG_FUNCTION, "libusb_open_device_width_vid_pid leave"); return (devh); } @@ -455,6 +462,7 @@ libusb_close(libusb_device_handle * devh { libusb_context *ctx; struct libusb20_device *pdev; + struct usb_ep_tr *eptr; unsigned char dummy = 1; int err; @@ -465,7 +473,7 @@ libusb_close(libusb_device_handle * devh pdev = devh->os_priv; GET_CONTEXT(ctx); - dprintf(ctx, LIBUSB_DEBUG_FUNCTION, "libusb_close enter"); + DPRINTF(ctx, LIBUSB_DEBUG_FUNCTION, "libusb_close enter"); pthread_mutex_lock(&ctx->pollfd_modify_lock); ctx->pollfd_modify++; @@ -475,12 +483,21 @@ libusb_close(libusb_device_handle * devh if (err <= 0) { pthread_mutex_lock(&ctx->open_devs_lock); - LIST_DEL(&devh->list); + TAILQ_REMOVE(&ctx->open_devs, devh, list); pthread_mutex_unlock(&ctx->open_devs_lock); usb_remove_pollfd(ctx, libusb20_dev_get_fd(pdev)); - libusb_unref_device(devh->dev); libusb20_dev_close(pdev); + libusb_unref_device(devh->dev); + TAILQ_FOREACH(eptr, &devh->ep_list, list) { + TAILQ_REMOVE(&devh->ep_list, eptr, list); + libusb20_tr_close(((struct libusb20_transfer **) + eptr->os_priv)[0]); + if (eptr->flags) + libusb20_tr_close(((struct libusb20_transfer **) + eptr->os_priv)[1]); + free((struct libusb20_transfer **)eptr->os_priv); + } free(devh); pthread_mutex_lock(&ctx->pollfd_modify_lock); @@ -492,12 +509,21 @@ libusb_close(libusb_device_handle * devh read(ctx->ctrl_pipe[0], &dummy, sizeof(dummy)); pthread_mutex_lock(&ctx->open_devs_lock); - LIST_DEL(&devh->list); + TAILQ_REMOVE(&ctx->open_devs, devh, list); pthread_mutex_unlock(&ctx->open_devs_lock); usb_remove_pollfd(ctx, libusb20_dev_get_fd(pdev)); - libusb_unref_device(devh->dev); libusb20_dev_close(pdev); + libusb_unref_device(devh->dev); + TAILQ_FOREACH(eptr, &devh->ep_list, list) { + TAILQ_REMOVE(&devh->ep_list, eptr, list); + libusb20_tr_close(((struct libusb20_transfer **) + eptr->os_priv)[0]); + if (eptr->flags) + libusb20_tr_close(((struct libusb20_transfer **) + eptr->os_priv)[1]); + free((struct libusb20_transfer **)eptr->os_priv); + } free(devh); pthread_mutex_lock(&ctx->pollfd_modify_lock); @@ -505,7 +531,7 @@ libusb_close(libusb_device_handle * devh pthread_mutex_unlock(&ctx->pollfd_modify_lock); libusb_unlock_events(ctx); - dprintf(ctx, LIBUSB_DEBUG_FUNCTION, "libusb_close leave"); + DPRINTF(ctx, LIBUSB_DEBUG_FUNCTION, "libusb_close leave"); } libusb_device * @@ -515,12 +541,12 @@ libusb_get_device(libusb_device_handle * ctx = NULL; GET_CONTEXT(ctx); - dprintf(ctx, LIBUSB_DEBUG_FUNCTION, "libusb_get_device enter"); + DPRINTF(ctx, LIBUSB_DEBUG_FUNCTION, "libusb_get_device enter"); if (devh == NULL) return (NULL); - dprintf(ctx, LIBUSB_DEBUG_FUNCTION, "libusb_get_device leave"); + DPRINTF(ctx, LIBUSB_DEBUG_FUNCTION, "libusb_get_device leave"); return (devh->dev); } @@ -531,7 +557,7 @@ libusb_get_configuration(libusb_device_h ctx = NULL; GET_CONTEXT(ctx); - dprintf(ctx, LIBUSB_DEBUG_FUNCTION, "libusb_get_configuration enter"); + DPRINTF(ctx, LIBUSB_DEBUG_FUNCTION, "libusb_get_configuration enter"); if (devh == NULL || config == NULL) return (LIBUSB_ERROR_INVALID_PARAM); @@ -539,14 +565,10 @@ libusb_get_configuration(libusb_device_h *config = libusb20_dev_get_config_index((struct libusb20_device *) devh->dev->os_priv); - dprintf(ctx, LIBUSB_DEBUG_FUNCTION, "libusb_get_configuration leave"); + DPRINTF(ctx, LIBUSB_DEBUG_FUNCTION, "libusb_get_configuration leave"); return (0); } -/* - * XXX this code is wrong. need update. - */ - int libusb_set_configuration(libusb_device_handle * devh, int configuration) { @@ -555,16 +577,15 @@ libusb_set_configuration(libusb_device_h ctx = NULL; GET_CONTEXT(ctx); - dprintf(ctx, LIBUSB_DEBUG_FUNCTION, "libusb_set_configuration enter"); + DPRINTF(ctx, LIBUSB_DEBUG_FUNCTION, "libusb_set_configuration enter"); if (devh == NULL) return (LIBUSB_ERROR_INVALID_PARAM); pdev = (struct libusb20_device *)devh->dev->os_priv; - libusb20_dev_set_alt_index(pdev, libusb20_dev_get_config_index(pdev), - configuration); - dprintf(ctx, LIBUSB_DEBUG_FUNCTION, "libusb_set_configuration leave"); + libusb20_dev_set_config_index(pdev, configuration); + DPRINTF(ctx, LIBUSB_DEBUG_FUNCTION, "libusb_set_configuration leave"); return (0); } @@ -576,7 +597,7 @@ libusb_claim_interface(libusb_device_han ctx = NULL; GET_CONTEXT(ctx); - dprintf(ctx, LIBUSB_DEBUG_FUNCTION, "libusb_claim_interface enter"); + DPRINTF(ctx, LIBUSB_DEBUG_FUNCTION, "libusb_claim_interface enter"); if (dev == NULL) return (LIBUSB_ERROR_INVALID_PARAM); @@ -592,7 +613,7 @@ libusb_claim_interface(libusb_device_han dev->claimed_interfaces |= (1 << interface_number); pthread_mutex_unlock(&(dev->lock)); - dprintf(ctx, LIBUSB_DEBUG_FUNCTION, "libusb_claim_interface leave"); + DPRINTF(ctx, LIBUSB_DEBUG_FUNCTION, "libusb_claim_interface leave"); return (ret); } @@ -604,7 +625,7 @@ libusb_release_interface(libusb_device_h ctx = NULL; GET_CONTEXT(ctx); - dprintf(ctx, LIBUSB_DEBUG_FUNCTION, "libusb_release_interface enter"); + DPRINTF(ctx, LIBUSB_DEBUG_FUNCTION, "libusb_release_interface enter"); ret = 0; if (dev == NULL) @@ -621,7 +642,7 @@ libusb_release_interface(libusb_device_h dev->claimed_interfaces &= ~(1 << interface_number); pthread_mutex_unlock(&(dev->lock)); - dprintf(ctx, LIBUSB_DEBUG_FUNCTION, "libusb_release_interface leave"); + DPRINTF(ctx, LIBUSB_DEBUG_FUNCTION, "libusb_release_interface leave"); return (ret); } @@ -630,11 +651,10 @@ libusb_set_interface_alt_setting(libusb_ int interface_number, int alternate_setting) { libusb_context *ctx; - int ret; ctx = NULL; GET_CONTEXT(ctx); - dprintf(ctx, LIBUSB_DEBUG_FUNCTION, "libusb_set_interface_alt_setting enter"); + DPRINTF(ctx, LIBUSB_DEBUG_FUNCTION, "libusb_set_interface_alt_setting enter"); if (dev == NULL) return (LIBUSB_ERROR_INVALID_PARAM); @@ -653,7 +673,7 @@ libusb_set_interface_alt_setting(libusb_ alternate_setting) != 0) return (LIBUSB_ERROR_OTHER); - dprintf(ctx, LIBUSB_DEBUG_FUNCTION, "libusb_set_interface_alt_setting leave"); + DPRINTF(ctx, LIBUSB_DEBUG_FUNCTION, "libusb_set_interface_alt_setting leave"); return (0); } @@ -661,14 +681,19 @@ int libusb_clear_halt(libusb_device_handle * devh, unsigned char endpoint) { struct libusb20_transfer *xfer; + struct libusb20_device *pdev; libusb_context *ctx; int ret; ctx = NULL; GET_CONTEXT(ctx); - dprintf(ctx, LIBUSB_DEBUG_FUNCTION, "libusb_clear_halt enter"); - - GET_XFER(xfer, endpoint, devh->os_priv); + DPRINTF(ctx, LIBUSB_DEBUG_FUNCTION, "libusb_clear_halt enter"); + + pdev = devh->os_priv; + xfer = libusb20_tr_get_pointer(pdev, + ((endpoint / 0x40) | (endpoint * 4)) % (16 * 4)); + if (xfer == NULL) + return (LIBUSB_ERROR_NO_MEM); pthread_mutex_lock(&libusb20_lock); ret = libusb20_tr_open(xfer, 0, 0, endpoint); @@ -682,7 +707,7 @@ libusb_clear_halt(libusb_device_handle * libusb20_tr_close(xfer); pthread_mutex_unlock(&libusb20_lock); - dprintf(ctx, LIBUSB_DEBUG_FUNCTION, "libusb_clear_halt leave"); + DPRINTF(ctx, LIBUSB_DEBUG_FUNCTION, "libusb_clear_halt leave"); return (0); } @@ -693,13 +718,13 @@ libusb_reset_device(libusb_device_handle ctx = NULL; GET_CONTEXT(ctx); - dprintf(ctx, LIBUSB_DEBUG_FUNCTION, "libusb_reset_device enter"); + DPRINTF(ctx, LIBUSB_DEBUG_FUNCTION, "libusb_reset_device enter"); if (dev == NULL) return (LIBUSB20_ERROR_INVALID_PARAM); libusb20_dev_reset(dev->os_priv); - dprintf(ctx, LIBUSB_DEBUG_FUNCTION, "libusb_reset_device leave"); + DPRINTF(ctx, LIBUSB_DEBUG_FUNCTION, "libusb_reset_device leave"); return (0); } @@ -710,12 +735,12 @@ libusb_kernel_driver_active(libusb_devic ctx = NULL; GET_CONTEXT(ctx); - dprintf(ctx, LIBUSB_DEBUG_FUNCTION, "libusb_kernel_driver_active enter"); + DPRINTF(ctx, LIBUSB_DEBUG_FUNCTION, "libusb_kernel_driver_active enter"); if (devh == NULL) return (LIBUSB_ERROR_INVALID_PARAM); - dprintf(ctx, LIBUSB_DEBUG_FUNCTION, "libusb_kernel_driver_active leave"); + DPRINTF(ctx, LIBUSB_DEBUG_FUNCTION, "libusb_kernel_driver_active leave"); return (libusb20_dev_kernel_driver_active(devh->os_priv, interface)); } @@ -727,7 +752,7 @@ libusb_detach_kernel_driver(libusb_devic ctx = NULL; GET_CONTEXT(ctx); - dprintf(ctx, LIBUSB_DEBUG_FUNCTION, "libusb_detach_kernel_driver enter"); + DPRINTF(ctx, LIBUSB_DEBUG_FUNCTION, "libusb_detach_kernel_driver enter"); if (devh == NULL) return (LIBUSB_ERROR_INVALID_PARAM); @@ -736,7 +761,7 @@ libusb_detach_kernel_driver(libusb_devic if (libusb20_dev_detach_kernel_driver(pdev, interface) == LIBUSB20_ERROR_OTHER) return (LIBUSB_ERROR_OTHER); - dprintf(ctx, LIBUSB_DEBUG_FUNCTION, "libusb_detach_kernel_driver leave"); + DPRINTF(ctx, LIBUSB_DEBUG_FUNCTION, "libusb_detach_kernel_driver leave"); return (0); } @@ -751,12 +776,12 @@ libusb_attach_kernel_driver(libusb_devic ctx = NULL; GET_CONTEXT(ctx); - dprintf(ctx, LIBUSB_DEBUG_FUNCTION, "libusb_attach_kernel_driver enter"); + DPRINTF(ctx, LIBUSB_DEBUG_FUNCTION, "libusb_attach_kernel_driver enter"); if (devh == NULL) return (LIBUSB_ERROR_INVALID_PARAM); - dprintf(ctx, LIBUSB_DEBUG_FUNCTION, "libusb_attach_kernel_driver leave"); + DPRINTF(ctx, LIBUSB_DEBUG_FUNCTION, "libusb_attach_kernel_driver leave"); return (0); } @@ -772,7 +797,7 @@ libusb_alloc_transfer(int iso_packets) ctx = NULL; GET_CONTEXT(ctx); - dprintf(ctx, LIBUSB_DEBUG_FUNCTION, "libusb_alloc_transfer enter"); + DPRINTF(ctx, LIBUSB_DEBUG_FUNCTION, "libusb_alloc_transfer enter"); len = sizeof(struct libusb_transfer) + sizeof(struct usb_transfer) + @@ -788,7 +813,7 @@ libusb_alloc_transfer(int iso_packets) xfer = (struct libusb_transfer *) ((uint8_t *)bxfer + sizeof(struct usb_transfer)); - dprintf(ctx, LIBUSB_DEBUG_FUNCTION, "libusb_alloc_transfer leave"); + DPRINTF(ctx, LIBUSB_DEBUG_FUNCTION, "libusb_alloc_transfer leave"); return (xfer); } @@ -800,7 +825,7 @@ libusb_free_transfer(struct libusb_trans ctx = NULL; GET_CONTEXT(ctx); - dprintf(ctx, LIBUSB_DEBUG_FUNCTION, "libusb_free_transfer enter"); + DPRINTF(ctx, LIBUSB_DEBUG_FUNCTION, "libusb_free_transfer enter"); if (xfer == NULL) return ; @@ -809,10 +834,85 @@ libusb_free_transfer(struct libusb_trans sizeof(struct usb_transfer)); free(bxfer); - dprintf(ctx, LIBUSB_DEBUG_FUNCTION, "libusb_free_transfer leave"); + DPRINTF(ctx, LIBUSB_DEBUG_FUNCTION, "libusb_free_transfer leave"); return; } +static int +libusb_get_maxframe(struct libusb20_device *pdev, libusb_transfer *xfer) +{ + int ret; + int usb_speed; + + usb_speed = libusb20_dev_get_speed(pdev); + + switch (xfer->type) { + case LIBUSB_TRANSFER_TYPE_ISOCHRONOUS: + switch (usb_speed) { + case LIBUSB20_SPEED_LOW: + case LIBUSB20_SPEED_FULL: + ret = 60 * 1; + break ; + default : + ret = 60 * 8; + break ; + } + break ; + case LIBUSB_TRANSFER_TYPE_CONTROL: + ret = 2; + break ; + default: + ret = 1; + break ; + } + + return ret; +} + +static int +libusb_get_buffsize(struct libusb20_device *pdev, libusb_transfer *xfer) +{ + int ret; + int usb_speed; + + usb_speed = libusb20_dev_get_speed(pdev); + + switch (xfer->type) { + case LIBUSB_TRANSFER_TYPE_ISOCHRONOUS: + ret = 0; + break ; + case LIBUSB_TRANSFER_TYPE_CONTROL: + switch (usb_speed) { + case LIBUSB20_SPEED_LOW: + ret = 8; + break ; + case LIBUSB20_SPEED_FULL: + ret = 64; + break ; + default: + ret = 64; + break ; + } + ret += 8; + break ; + default : + switch (usb_speed) { + case LIBUSB20_SPEED_LOW: + ret = 256; + break ; + case LIBUSB20_SPEED_FULL: + ret = 4096; + break ; + default: + ret = 16384; + break ; + } + break ; + } + + return ret; +} + static void libusb10_proxy(struct libusb20_transfer *xfer) { @@ -820,6 +920,9 @@ libusb10_proxy(struct libusb20_transfer struct libusb20_device *pdev; libusb_transfer *usb_xfer; libusb_context *ctx; + uint32_t pos; + uint32_t max; + uint32_t size; uint8_t status; uint32_t iso_packets; int i; @@ -834,172 +937,97 @@ libusb10_proxy(struct libusb20_transfer switch (status) { case LIBUSB20_TRANSFER_COMPLETED: - dprintf(ctx, LIBUSB_DEBUG_TRANSFER, "LIBUSB20 SUBMIT"); - usb_xfer->actual_length += libusb20_tr_get_actual_length(xfer); - usb_xfer->callback(usb_xfer); - - pthread_mutex_lock(&ctx->flying_transfers_lock); - LIST_DEL(&usb_backend->list); - pthread_mutex_unlock(&ctx->flying_transfers_lock); + usb_backend->transferred += libusb20_tr_get_actual_length(xfer); + DPRINTF(ctx, LIBUSB_DEBUG_TRANSFER, "LIBUSB20 TRANSFER %i bytes", + usb_backend->transferred); + if (usb_backend->transferred != usb_xfer->length) + goto tr_start; + + DPRINTF(ctx, LIBUSB_DEBUG_TRANSFER, "LIBUSB20 TRANSFER COMPLETE"); + usb_handle_transfer_completion(usb_backend, LIBUSB_TRANSFER_COMPLETED); + break ; case LIBUSB20_TRANSFER_START: - dprintf(ctx, LIBUSB_DEBUG_TRANSFER, "LIBUSB20 START"); +tr_start: + DPRINTF(ctx, LIBUSB_DEBUG_TRANSFER, "LIBUSB20 START"); + max = libusb_get_buffsize(pdev, usb_xfer); + pos = usb_backend->transferred; + size = (usb_xfer->length - pos); + size = (size > max) ? max : size; usb_xfer->actual_length = 0; switch (usb_xfer->type) { case LIBUSB_TRANSFER_TYPE_CONTROL: - dprintf(ctx, LIBUSB_DEBUG_TRANSFER, "TYPE CTR"); + DPRINTF(ctx, LIBUSB_DEBUG_TRANSFER, "TYPE CTR"); libusb20_tr_setup_control(xfer, usb_xfer->buffer, - (void *)(((uint8_t *) usb_xfer->buffer) + + (void *)(((uint8_t *) &usb_xfer->buffer[pos]) + sizeof(libusb_control_setup)), usb_xfer->timeout); break ; case LIBUSB_TRANSFER_TYPE_ISOCHRONOUS: - dprintf(ctx, LIBUSB_DEBUG_TRANSFER, "TYPE ISO"); + DPRINTF(ctx, LIBUSB_DEBUG_TRANSFER, "TYPE ISO"); iso_packets = libusb20_tr_get_max_frames(xfer); if (usb_xfer->num_iso_packets > iso_packets) usb_xfer->num_iso_packets = iso_packets; for (i = 0 ; i < usb_xfer->num_iso_packets ; i++) { libusb20_tr_setup_isoc(xfer, - usb_xfer->buffer, usb_xfer->length, i); + &usb_xfer->buffer[pos], size, i); } libusb20_tr_set_total_frames(xfer, i); break ; case LIBUSB_TRANSFER_TYPE_BULK: - dprintf(ctx, LIBUSB_DEBUG_TRANSFER, "TYPE BULK"); - libusb20_tr_setup_bulk(xfer, usb_xfer->buffer, - usb_xfer->length, usb_xfer->timeout); + DPRINTF(ctx, LIBUSB_DEBUG_TRANSFER, "TYPE BULK"); + libusb20_tr_setup_bulk(xfer, &usb_xfer->buffer[pos], + size, usb_xfer->timeout); break ; case LIBUSB_TRANSFER_TYPE_INTERRUPT: - dprintf(ctx, LIBUSB_DEBUG_TRANSFER, "TYPE INTR"); - libusb20_tr_setup_intr(xfer, usb_xfer->buffer, - usb_xfer->length, usb_xfer->timeout); + DPRINTF(ctx, LIBUSB_DEBUG_TRANSFER, "TYPE INTR"); + libusb20_tr_setup_intr(xfer, &usb_xfer->buffer[pos], + size, usb_xfer->timeout); break ; } libusb20_tr_submit(xfer); - dprintf(ctx, LIBUSB_DEBUG_TRANSFER, "LIBUSB20 SUBMITED"); + DPRINTF(ctx, LIBUSB_DEBUG_TRANSFER, "LIBUSB20 SUBMITED"); break ; default: - if (ctx->debug == LIBUSB_DEBUG_TRANSFER) - printf("LIBUSB TRANSFER DEFAULT 0x%x\n", status); - usb_xfer->actual_length = 0; - usb_xfer->status = LIBUSB_TRANSFER_CANCELLED; - - pthread_mutex_lock(&ctx->flying_transfers_lock); - LIST_DEL(&usb_backend->list); - pthread_mutex_unlock(&ctx->flying_transfers_lock); - usb_xfer->callback(usb_xfer); - + DPRINTF(ctx, LIBUSB_DEBUG_TRANSFER, "TRANSFER DEFAULT 0x%x\n", + status); + usb_backend->transferred = 0; + usb_handle_transfer_completion(usb_backend, LIBUSB_TRANSFER_CANCELLED); break ; } switch (status) { case LIBUSB20_TRANSFER_COMPLETED: - dprintf(ctx, LIBUSB_DEBUG_TRANSFER, "STATUS COMPLETED"); + DPRINTF(ctx, LIBUSB_DEBUG_TRANSFER, "STATUS COMPLETED"); usb_xfer->status = LIBUSB_TRANSFER_COMPLETED; break ; case LIBUSB20_TRANSFER_OVERFLOW: - dprintf(ctx, LIBUSB_DEBUG_TRANSFER, "STATUS TR OVERFLOW"); + DPRINTF(ctx, LIBUSB_DEBUG_TRANSFER, "STATUS TR OVERFLOW"); usb_xfer->status = LIBUSB_TRANSFER_OVERFLOW; break ; case LIBUSB20_TRANSFER_NO_DEVICE: - dprintf(ctx, LIBUSB_DEBUG_TRANSFER, "STATUS TR NO DEVICE"); + DPRINTF(ctx, LIBUSB_DEBUG_TRANSFER, "STATUS TR NO DEVICE"); usb_xfer->status = LIBUSB_TRANSFER_NO_DEVICE; break ; case LIBUSB20_TRANSFER_STALL: - dprintf(ctx, LIBUSB_DEBUG_TRANSFER, "STATUS TR STALL"); + DPRINTF(ctx, LIBUSB_DEBUG_TRANSFER, "STATUS TR STALL"); usb_xfer->status = LIBUSB_TRANSFER_STALL; break ; case LIBUSB20_TRANSFER_CANCELLED: - dprintf(ctx, LIBUSB_DEBUG_TRANSFER, "STATUS TR CANCELLED"); + DPRINTF(ctx, LIBUSB_DEBUG_TRANSFER, "STATUS TR CANCELLED"); usb_xfer->status = LIBUSB_TRANSFER_CANCELLED; break ; case LIBUSB20_TRANSFER_TIMED_OUT: - dprintf(ctx, LIBUSB_DEBUG_TRANSFER, "STATUS TR TIMEOUT"); + DPRINTF(ctx, LIBUSB_DEBUG_TRANSFER, "STATUS TR TIMEOUT"); usb_xfer->status = LIBUSB_TRANSFER_TIMED_OUT; break ; case LIBUSB20_TRANSFER_ERROR: - dprintf(ctx, LIBUSB_DEBUG_TRANSFER, "ERROR"); + DPRINTF(ctx, LIBUSB_DEBUG_TRANSFER, "ERROR"); usb_xfer->status = LIBUSB_TRANSFER_ERROR; break ; } } -static int -libusb_get_maxframe(struct libusb20_device *pdev, libusb_transfer *xfer) -{ - int ret; - int usb_speed; - - usb_speed = libusb20_dev_get_speed(pdev); - - switch (xfer->type) { - case LIBUSB_TRANSFER_TYPE_ISOCHRONOUS: - switch (usb_speed) { - case LIBUSB20_SPEED_LOW: - case LIBUSB20_SPEED_FULL: - ret = 60 * 1; - break ; - default : - ret = 60 * 8; - break ; - } - break ; - case LIBUSB_TRANSFER_TYPE_CONTROL: - ret = 2; - break ; - default: - ret = 1; - break ; - } - - return ret; -} - -static int -libusb_get_buffsize(struct libusb20_device *pdev, libusb_transfer *xfer) -{ - int ret; - int usb_speed; - - usb_speed = libusb20_dev_get_speed(pdev); - - switch (xfer->type) { - case LIBUSB_TRANSFER_TYPE_ISOCHRONOUS: - ret = 0; - break ; - case LIBUSB_TRANSFER_TYPE_CONTROL: - switch (usb_speed) { - case LIBUSB20_SPEED_LOW: - ret = 8; - break ; - case LIBUSB20_SPEED_FULL: - ret = 64; - break ; - case LIBUSB20_SPEED_HIGH: - ret = 64; - break ; - } - /*add */ - ret += 8; - break ; - default : - switch (usb_speed) { - case LIBUSB20_SPEED_LOW: - ret = 256; - break ; - case LIBUSB20_SPEED_FULL: - ret = 4096; - break ; - default: - ret = 16384; - break ; - } - break ; - } - - return ret; -} - int libusb_submit_transfer(struct libusb_transfer *xfer) { *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@FreeBSD.ORG Fri Jul 10 15:26:34 2009 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 4960D106566B; Fri, 10 Jul 2009 15:26:34 +0000 (UTC) (envelope-from sam@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 37E1F8FC12; Fri, 10 Jul 2009 15:26:34 +0000 (UTC) (envelope-from sam@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n6AFQYic023993; Fri, 10 Jul 2009 15:26:34 GMT (envelope-from sam@svn.freebsd.org) Received: (from sam@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n6AFQYUN023991; Fri, 10 Jul 2009 15:26:34 GMT (envelope-from sam@svn.freebsd.org) Message-Id: <200907101526.n6AFQYUN023991@svn.freebsd.org> From: Sam Leffler Date: Fri, 10 Jul 2009 15:26: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: r195561 - head/sys/net80211 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, 10 Jul 2009 15:26:34 -0000 Author: sam Date: Fri Jul 10 15:26:33 2009 New Revision: 195561 URL: http://svn.freebsd.org/changeset/base/195561 Log: mark struct ieee80211req_maclist packed so sizeof works as intended on arm; fixes "list mac" Approved by: re (kensmith) Modified: head/sys/net80211/ieee80211_ioctl.h Modified: head/sys/net80211/ieee80211_ioctl.h ============================================================================== --- head/sys/net80211/ieee80211_ioctl.h Fri Jul 10 14:15:53 2009 (r195560) +++ head/sys/net80211/ieee80211_ioctl.h Fri Jul 10 15:26:33 2009 (r195561) @@ -302,7 +302,7 @@ enum { struct ieee80211req_maclist { uint8_t ml_macaddr[IEEE80211_ADDR_LEN]; -}; +} __packed; /* * Set the active channel list by IEEE channel #: each channel From owner-svn-src-head@FreeBSD.ORG Fri Jul 10 15:28:35 2009 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 2B81D1065676; Fri, 10 Jul 2009 15:28:35 +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 F332A8FC16; Fri, 10 Jul 2009 15:28:34 +0000 (UTC) (envelope-from rpaulo@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n6AFSYnm024064; Fri, 10 Jul 2009 15:28:34 GMT (envelope-from rpaulo@svn.freebsd.org) Received: (from rpaulo@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n6AFSYNk024058; Fri, 10 Jul 2009 15:28:34 GMT (envelope-from rpaulo@svn.freebsd.org) Message-Id: <200907101528.n6AFSYNk024058@svn.freebsd.org> From: Rui Paulo Date: Fri, 10 Jul 2009 15:28: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: r195562 - in head/sys/dev: ipw iwi iwn wpi 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, 10 Jul 2009 15:28:35 -0000 Author: rpaulo Date: Fri Jul 10 15:28:33 2009 New Revision: 195562 URL: http://svn.freebsd.org/changeset/base/195562 Log: For ic_opmode switch cases, provide a default label with a printf saying this opmode is not supported. Approved by: re (kib) Modified: head/sys/dev/ipw/if_ipw.c head/sys/dev/iwi/if_iwi.c head/sys/dev/iwn/if_iwn.c head/sys/dev/wpi/if_wpi.c Modified: head/sys/dev/ipw/if_ipw.c ============================================================================== --- head/sys/dev/ipw/if_ipw.c Fri Jul 10 15:26:33 2009 (r195561) +++ head/sys/dev/ipw/if_ipw.c Fri Jul 10 15:28:33 2009 (r195562) @@ -2462,6 +2462,9 @@ ipw_config(struct ipw_softc *sc) case IEEE80211_M_MONITOR: data = htole32(IPW_MODE_MONITOR); break; + default: + device_printf(sc->sc_dev, "unknown opmode %d\n", ic->ic_opmode); + return EINVAL; } DPRINTF(("Setting mode to %u\n", le32toh(data))); error = ipw_cmd(sc, IPW_CMD_SET_MODE, &data, sizeof data); Modified: head/sys/dev/iwi/if_iwi.c ============================================================================== --- head/sys/dev/iwi/if_iwi.c Fri Jul 10 15:26:33 2009 (r195561) +++ head/sys/dev/iwi/if_iwi.c Fri Jul 10 15:28:33 2009 (r195562) @@ -2208,7 +2208,8 @@ iwi_get_firmware(struct iwi_softc *sc, e &sc->fw_uc, "iwi_ucode_monitor"); break; default: - break; + device_printf(sc->sc_dev, "unknown opmode %d\n", opmode); + return EINVAL; } fp = sc->fw_fw.fp; if (fp == NULL) { Modified: head/sys/dev/iwn/if_iwn.c ============================================================================== --- head/sys/dev/iwn/if_iwn.c Fri Jul 10 15:26:33 2009 (r195561) +++ head/sys/dev/iwn/if_iwn.c Fri Jul 10 15:28:33 2009 (r195562) @@ -3916,7 +3916,8 @@ iwn_config(struct iwn_softc *sc) IWN_FILTER_CTL | IWN_FILTER_PROMISC); break; default: - break; + device_printf(sc->sc_dev, "unknown opmode %d\n", ic->ic_opmode); + return EINVAL; } sc->config.cck_mask = 0x0f; /* not yet negotiated */ sc->config.ofdm_mask = 0xff; /* not yet negotiated */ Modified: head/sys/dev/wpi/if_wpi.c ============================================================================== --- head/sys/dev/wpi/if_wpi.c Fri Jul 10 15:26:33 2009 (r195561) +++ head/sys/dev/wpi/if_wpi.c Fri Jul 10 15:28:33 2009 (r195562) @@ -2818,6 +2818,9 @@ wpi_config(struct wpi_softc *sc) sc->config.filter |= htole32(WPI_FILTER_MULTICAST | WPI_FILTER_CTL | WPI_FILTER_PROMISC); break; + default: + device_printf(sc->sc_dev, "unknown opmode %d\n", ic->ic_opmode); + return EINVAL; } sc->config.cck_mask = 0x0f; /* not yet negotiated */ sc->config.ofdm_mask = 0xff; /* not yet negotiated */ From owner-svn-src-head@FreeBSD.ORG Fri Jul 10 17:42:53 2009 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 DA216106566B; Fri, 10 Jul 2009 17:42:53 +0000 (UTC) (envelope-from scottl@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id ADE8C8FC08; Fri, 10 Jul 2009 17:42:53 +0000 (UTC) (envelope-from scottl@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n6AHgrjq027297; Fri, 10 Jul 2009 17:42:53 GMT (envelope-from scottl@svn.freebsd.org) Received: (from scottl@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n6AHgrvQ027295; Fri, 10 Jul 2009 17:42:53 GMT (envelope-from scottl@svn.freebsd.org) Message-Id: <200907101742.n6AHgrvQ027295@svn.freebsd.org> From: Scott Long Date: Fri, 10 Jul 2009 17:42: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: r195573 - head/sbin/camcontrol 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, 10 Jul 2009 17:42:54 -0000 Author: scottl Date: Fri Jul 10 17:42:53 2009 New Revision: 195573 URL: http://svn.freebsd.org/changeset/base/195573 Log: Fix alignment issue with ATA IDENTIFY structure. Approved by: re Modified: head/sbin/camcontrol/camcontrol.c Modified: head/sbin/camcontrol/camcontrol.c ============================================================================== --- head/sbin/camcontrol/camcontrol.c Fri Jul 10 17:22:41 2009 (r195572) +++ head/sbin/camcontrol/camcontrol.c Fri Jul 10 17:42:53 2009 (r195573) @@ -1121,7 +1121,7 @@ ataidentify(struct cam_device *device, i { union ccb *ccb; struct ata_params *ident_buf; - int error = 0; + u_int i, error = 0; int16_t *ptr; ccb = cam_getccb(device); @@ -1135,22 +1135,21 @@ ataidentify(struct cam_device *device, i bzero(&(&ccb->ccb_h)[1], sizeof(struct ccb_ataio) - sizeof(struct ccb_hdr)); - ident_buf = (struct ata_params *)malloc( - sizeof(struct ata_params)); + ptr = (uint16_t *)malloc(sizeof(struct ata_params)); - if (ident_buf == NULL) { + if (ptr == NULL) { cam_freeccb(ccb); warnx("can't malloc memory for identify\n"); return(1); } - bzero(ident_buf, sizeof(*ident_buf)); + bzero(ptr, sizeof(struct ata_params)); cam_fill_ataio(&ccb->ataio, retry_count, NULL, /*flags*/CAM_DIR_IN, MSG_SIMPLE_Q_TAG, - /*data_ptr*/(u_int8_t *)ident_buf, + /*data_ptr*/(u_int8_t *)ptr, /*dxfer_len*/sizeof(struct ata_params), timeout ? timeout : 30 * 1000); // if (periph->path->device->protocol == PROTO_ATA) @@ -1172,6 +1171,7 @@ ataidentify(struct cam_device *device, i CAM_EPF_ALL, stderr); } + free(ptr); cam_freeccb(ccb); return(1); } @@ -1188,14 +1188,14 @@ ataidentify(struct cam_device *device, i cam_freeccb(ccb); if (error != 0) { - free(ident_buf); + free(ptr); return(error); } - for (ptr = (int16_t *)ident_buf; - ptr < (int16_t *)ident_buf + sizeof(struct ata_params)/2; ptr++) { - *ptr = le16toh(*ptr); - } + for (i = 0; i < sizeof(struct ata_params) / 2; i++) + ptr[i] = le16toh(ptr[i]); + ident_buf = (struct ata_params *)ptr; + if (strncmp(ident_buf->model, "FX", 2) && strncmp(ident_buf->model, "NEC", 3) && strncmp(ident_buf->model, "Pioneer", 7) && From owner-svn-src-head@FreeBSD.ORG Fri Jul 10 21:17:27 2009 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 9C36D1065670; Fri, 10 Jul 2009 21:17:27 +0000 (UTC) (envelope-from mp@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 713668FC12; Fri, 10 Jul 2009 21:17:27 +0000 (UTC) (envelope-from mp@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n6ALHR0m032304; Fri, 10 Jul 2009 21:17:27 GMT (envelope-from mp@svn.freebsd.org) Received: (from mp@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n6ALHRIA032303; Fri, 10 Jul 2009 21:17:27 GMT (envelope-from mp@svn.freebsd.org) Message-Id: <200907102117.n6ALHRIA032303@svn.freebsd.org> From: Mark Peek Date: Fri, 10 Jul 2009 21:17: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: r195588 - head/contrib/tcsh 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, 10 Jul 2009 21:17:28 -0000 Author: mp Date: Fri Jul 10 21:17:27 2009 New Revision: 195588 URL: http://svn.freebsd.org/changeset/base/195588 Log: Bootstrap merge history. Approved by: re Modified: head/contrib/tcsh/ (props changed) From owner-svn-src-head@FreeBSD.ORG Sat Jul 11 05:35:08 2009 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 945311065674; Sat, 11 Jul 2009 05:35:08 +0000 (UTC) (envelope-from mp@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 810788FC18; Sat, 11 Jul 2009 05:35:08 +0000 (UTC) (envelope-from mp@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n6B5Z8EK043262; Sat, 11 Jul 2009 05:35:08 GMT (envelope-from mp@svn.freebsd.org) Received: (from mp@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n6B5Z8eq043254; Sat, 11 Jul 2009 05:35:08 GMT (envelope-from mp@svn.freebsd.org) Message-Id: <200907110535.n6B5Z8eq043254@svn.freebsd.org> From: Mark Peek Date: Sat, 11 Jul 2009 05:35: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: r195609 - head/contrib/tcsh 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, 11 Jul 2009 05:35:09 -0000 Author: mp Date: Sat Jul 11 05:35:08 2009 New Revision: 195609 URL: http://svn.freebsd.org/changeset/base/195609 Log: Update to tcsh 6.17.00. Approved by: re (kensmith) Added: head/contrib/tcsh/config.rpath - copied unchanged from r195602, vendor/tcsh/dist/config.rpath Deleted: head/contrib/tcsh/Makefile.ADMIN head/contrib/tcsh/RELEASE-PROCEDURE Modified: head/contrib/tcsh/ (props changed) head/contrib/tcsh/Fixes head/contrib/tcsh/Imakefile head/contrib/tcsh/Makefile.in head/contrib/tcsh/README head/contrib/tcsh/complete.tcsh head/contrib/tcsh/config.guess head/contrib/tcsh/config.h.in head/contrib/tcsh/config.sub head/contrib/tcsh/config_f.h head/contrib/tcsh/configure head/contrib/tcsh/configure.in head/contrib/tcsh/ed.chared.c head/contrib/tcsh/ed.decls.h head/contrib/tcsh/ed.h head/contrib/tcsh/ed.inputl.c head/contrib/tcsh/ed.screen.c head/contrib/tcsh/ed.term.h head/contrib/tcsh/ed.xmap.c head/contrib/tcsh/glob.c head/contrib/tcsh/host.defs head/contrib/tcsh/ma.setp.c head/contrib/tcsh/patchlevel.h head/contrib/tcsh/sh.c head/contrib/tcsh/sh.char.c head/contrib/tcsh/sh.char.h head/contrib/tcsh/sh.decls.h head/contrib/tcsh/sh.dir.c head/contrib/tcsh/sh.dol.c head/contrib/tcsh/sh.err.c head/contrib/tcsh/sh.exec.c head/contrib/tcsh/sh.exp.c head/contrib/tcsh/sh.file.c head/contrib/tcsh/sh.func.c head/contrib/tcsh/sh.glob.c head/contrib/tcsh/sh.h head/contrib/tcsh/sh.lex.c head/contrib/tcsh/sh.proc.c head/contrib/tcsh/sh.proc.h head/contrib/tcsh/sh.sem.c head/contrib/tcsh/sh.set.c head/contrib/tcsh/snames.h head/contrib/tcsh/tc.bind.c head/contrib/tcsh/tc.const.c head/contrib/tcsh/tc.decls.h head/contrib/tcsh/tc.func.c head/contrib/tcsh/tc.os.h head/contrib/tcsh/tc.sig.h head/contrib/tcsh/tc.str.c head/contrib/tcsh/tcsh.man head/contrib/tcsh/tw.color.c head/contrib/tcsh/tw.comp.c head/contrib/tcsh/tw.parse.c Modified: head/contrib/tcsh/Fixes ============================================================================== --- head/contrib/tcsh/Fixes Sat Jul 11 04:08:00 2009 (r195608) +++ head/contrib/tcsh/Fixes Sat Jul 11 05:35:08 2009 (r195609) @@ -1,3 +1,74 @@ + 21. V6.17.00 - 20090710 + 20. Fix dataroot autoconf issue. + 19. Fix directory stuff for unit tests. + 18. Fix small bug in history in loops. + 17. Provide newer config.{guess,sub} + 16. Fix gcc 4 warnings. + 15. Fix memory trashing bug introduced in 10. + 14. V6.16.01 - 20090624 + 13. add missing sigemptyset in goodbye() + 12. add rlimit swapsize from FreeBSD. + 11. restore behavior where a[n-] never prints an error. + 10. always save the whole command, not just the first 80 chars of it. + 9. fix short2str/short2qstr length adjustment in wide chars + (Vitezslav Crhonek) + 8. set histfile=/tmp/history.temp; set savehist=(100 merge); + alias precmd history -S. After that justpr is not restored and commands + don't execute. (Andriy Gapon) + 7. Fix "as" $ modifier from corrupting memory. + set t=demfonsftraftionf; echo $t:as/f// + 6. Make $% work with environment variable (Ron Johnston) + 5. Dragonfly script support (Matthias Schmidt, m65) + 4. Add autoexpand=onlyhistory (Don Estabrook, m66) + 3. Add history in loops (Laurence Darby, m48) + 2. Add missing colorls "rs" variable (Shlomi Fish, m70) + 1. Fix pts detection issue (Ruslan Ermilov) + + 33. V6.16.00 - 20080930 + 32. longjmp clobbered variable fixes. + 31. __GNX__ addition + 30. Windows fork fixes + 28. V6.15.02 - 20080830 + 27. Fix an eval free'ing botch (Per Hedeland) + 26. /bin/echo "`" coredumped because stderror() calls longjmp corrupting + the stack (Mark Davies). We should vet the code for all stderror() + calls that cleanup local stack variables. + 25. foo > ${undef} caused coredumps because of vfork() child corrupting + the state of the parent stack. + 24. $x[A-B] did not complain for A out of range. (Cai Xianchao) + 23. rename setp -> tcsh_setp to avoid conflict with mach (Javier Vasquez) + 22. Fix degree handling by defining __XPG4_CHAR_CLASS__ for solaris + (Mike Sullivan) + 21. Change 'od' to 'od -c' in tests so that they work on big endian machines. + (Martin Kraemer) + 20. Add environment variable COMMAND_LINE to be available in completions + (Marcin Konarski) + 19. V6.15.01 - 20070928 + 18. Evaluate expressions in the proper order (Li Zefan), controlled by + compat_expr. + 17. Don't need to flush() if we are silent. Prevents recursive error issue. + (joshua stein) + 16. Don't execute the jobcmd if the output is not a tty (Charles Ross) + 15. Quote the history in the examples (Johann 'Myrkraverk' Oskarsson) + 14. Mismatch clarification patch (Per Hedeland) + 13. Fix 'repeat n cmd &' abort() (Mike Sullivan) + 12. Fix octal parsing (Li Zefan) + 11. Fix pty detection for autologout setting (Kris Kennaway, Giorgos Keramidas) + 10. kill `foo` got stuck because sigchld was disabled too soon (Mark Peek) + 9. Avoid null pointer dereference in proc cwd (Kurt Miller) + 8. eval "foreach a b c" exits (Anthony Menasse) + 7. Quoting was broken in substitutions (Joe Wells) + 6. QNX patches via pkgsrc + 5. cd - twice from a directory that contained a glob pattern, + expands the glob twice (Mark Santcroos) + 4. MidnightBsd support (Lucas Holt) + 3. Fix history substitution core-dump with no history entries + 2. Merge two character tables that are the same (Martin Kraemer) + 1. On ancient 7 bit locales, punctuation characters are used to + denote special characters such as umlaut, adiaresis, etc. + These characters return true for isalpha/isalnum. Ignore them + because they break parsing (Martin Kraemer) + 74. V6.15.00 - 20070303 73. fix extension eating windows code (christos) 72. fix loop in %R history expansion (christos) Modified: head/contrib/tcsh/Imakefile ============================================================================== --- head/contrib/tcsh/Imakefile Sat Jul 11 04:08:00 2009 (r195608) +++ head/contrib/tcsh/Imakefile Sat Jul 11 05:35:08 2009 (r195609) @@ -1,5 +1,5 @@ XCOMM -XCOMM $tcsh: Imakefile,v 1.85 2006/03/02 18:46:44 christos Exp $ +XCOMM $tcsh: Imakefile,v 1.86 2007/03/19 23:25:02 christos Exp $ XCOMM XCOMM Imakefile for tcsh 6.12 XCOMM Marc Horowitz, MIT SIPB @@ -211,6 +211,10 @@ EXTF=mi.termios.c mi.wait.h mi.varargs.h # define ConfigH bsd4.4 # endif /* FreeBsdArchitecture */ +# ifdef MidnightBSDArchitecture +# define ConfigH bsd4.4 +# endif /* MidnightBsdArchitecture */ + # ifdef i386SVR4Architecture # define ConfigH sysv4 # ifdef DELL Modified: head/contrib/tcsh/Makefile.in ============================================================================== --- head/contrib/tcsh/Makefile.in Sat Jul 11 04:08:00 2009 (r195608) +++ head/contrib/tcsh/Makefile.in Sat Jul 11 05:35:08 2009 (r195609) @@ -1,4 +1,4 @@ -# $tcsh: Makefile.in,v 3.36 2006/08/24 20:56:31 christos Exp $ +# $tcsh: Makefile.in,v 3.40 2009/06/24 22:09:05 christos Exp $ # Makefile.in 4.3 6/11/83 # # C Shell with process control; VM/UNIX VAX Makefile @@ -248,7 +248,7 @@ CPP = @CPP@ # This is set by autoconf. # The -B tells gcc to use /bin/ld. This is to avoid using the gnu ld, which # on the suns does not know how to make dynamically linked binaries. CC = @CC@ # This is set by autoconf. -#CC= gcc -Wall -Wmissing-prototypes -Wstrict-prototypes -Wpointer-arith -Werror -Wmissing-declarations -Wredundant-decls -Wnested-externs -Wsign-compare -Wcast-qual -Wreturn-type -Wswitch -Wshadow -Wwrite-strings +#CC= gcc -Wall -Wmissing-prototypes -Wstrict-prototypes -Wpointer-arith -Werror -Wmissing-declarations -Wredundant-decls -Wnested-externs -Wsign-compare -Wcast-qual -Wreturn-type -Wswitch -Wshadow -Wwrite-strings -Wextra #CC= gcc -Wall -pipe -B/bin/ # -ansi -pedantic #CC= gcc -m486 -pipe -Wall # Generate code for Intel 486 (linux) #CC= shlicc # BSDI2.1 w/ shared libraries @@ -278,7 +278,7 @@ P= prefix=@prefix@ exec_prefix=@exec_prefix@ bindir=@bindir@ -mandir=@mandir@ +mandir=@datarootdir@/man MANSECT=1 DESTBIN=${DESTDIR}${bindir} DESTMAN=${DESTDIR}${mandir}/man${MANSECT} @@ -463,7 +463,7 @@ $(srcdir)/tests/package.m4: $(srcdir)/co echo 'm4_define([AT_PACKAGE_BUGREPORT], [@PACKAGE_BUGREPORT@])'; \ } >$(srcdir)/tests/package.m4 -$(srcdir)/tests/testsuite: tests/package.m4 tests/testsuite.at $(TESTFILES) +$(srcdir)/tests/testsuite: $(srcdir)/tests/package.m4 $(srcdir}/tests/testsuite.at $(TESTFILES) autom4te --language=autotest -I $(srcdir)/tests \ $(srcdir)/tests/testsuite.at -o $@.tmp mv $@.tmp $@ @@ -531,11 +531,16 @@ install.cygwin: install install.man cp ${srcdir}/WishList ${srcdir}/Y2K ${DESTDIR}${prefix}/share/doc/tcsh perl ${srcdir}/tcsh.man2html ${srcdir}/tcsh.man cp -rp tcsh.html ${DESTDIR}${prefix}/share/doc/tcsh + -mkdir -p ${DESTDIR}/etc/defaults/etc/profile.d -mkdir -p ${DESTDIR}/etc/profile.d -mkdir -p ${DESTDIR}/etc/postinstall - cp -p ${srcdir}/cygwin/etc/csh.* ${DESTDIR}/etc - cp -p ${srcdir}/cygwin/etc/profile.d/*.tcsh ${DESTDIR}/etc/profile.d - cp -p ${srcdir}/cygwin/etc/postinstall/tcsh.sh ${DESTDIR}/etc/postinstall + -mkdir -p ${DESTDIR}/etc/preremove + cp -p ${srcdir}/cygwin/csh.cshrc ${DESTDIR}/etc/defaults/etc + cp -p ${srcdir}/cygwin/csh.login ${DESTDIR}/etc/defaults/etc + cp -p ${srcdir}/cygwin/bindkey.tcsh ${DESTDIR}/etc/defaults/etc/profile.d + cp -p ${srcdir}/complete.tcsh ${DESTDIR}/etc/defaults/etc/profile.d + cp -p ${srcdir}/cygwin/postinstall.sh ${DESTDIR}/etc/postinstall/tcsh.sh + cp -p ${srcdir}/cygwin/preremove.sh ${DESTDIR}/etc/preremove/tcsh.sh # Amiga Unix #install.man: tcsh.man Modified: head/contrib/tcsh/README ============================================================================== --- head/contrib/tcsh/README Sat Jul 11 04:08:00 2009 (r195608) +++ head/contrib/tcsh/README Sat Jul 11 05:35:08 2009 (r195609) @@ -1,4 +1,4 @@ -This is tcsh version 6.15. Tcsh is a version of the Berkeley +This is tcsh version 6.17.00. Tcsh is a version of the Berkeley C-Shell, with the addition of: a command line editor, command and file name completion, listing, etc. and a bunch of small additions to the shell itself. Modified: head/contrib/tcsh/complete.tcsh ============================================================================== --- head/contrib/tcsh/complete.tcsh Sat Jul 11 04:08:00 2009 (r195608) +++ head/contrib/tcsh/complete.tcsh Sat Jul 11 05:35:08 2009 (r195609) @@ -1,5 +1,5 @@ # -# $tcsh: complete.tcsh,v 1.47 2006/03/02 18:46:44 christos Exp $ +# $tcsh: complete.tcsh,v 1.51 2007/10/01 21:51:59 christos Exp $ # example file using the new completion code # # Debian GNU/Linux @@ -38,18 +38,18 @@ endif if ($?_complete) then set noglob if ( ! $?hosts ) set hosts - foreach f ($HOME/.hosts /usr/local/etc/csh.hosts $HOME/.rhosts /etc/hosts.equiv) - if ( -r $f ) then - set hosts = ($hosts `grep -v "+" $f | grep -E -v "^#" | tr -s " " " " | cut -f 1`) + foreach f ("$HOME/.hosts" /usr/local/etc/csh.hosts "$HOME/.rhosts" /etc/hosts.equiv) + if ( -r "$f" ) then + set hosts = ($hosts `grep -v "+" "$f" | grep -E -v "^#" | tr -s " " " " | cut -f 1`) endif end - if ( -r $HOME/.netrc ) then - set f=`awk '/machine/ { print $2 }' < $HOME/.netrc` >& /dev/null + if ( -r "$HOME/.netrc" ) then + set f=`awk '/machine/ { print $2 }' < "$HOME/.netrc"` >& /dev/null set hosts=($hosts $f) endif - if ( -r $HOME/.ssh/known_hosts ) then - set f=`cat $HOME/.ssh/known_hosts | cut -f 1 -d \ ` >& /dev/null - set f=`cat $HOME/.ssh/known_hosts | cut -f 1 -d \ | sed -e 's/,/ /g'` >& /dev/null + if ( -r "$HOME/.ssh/known_hosts" ) then + set f=`cat "$HOME/.ssh/known_hosts" | cut -f 1 -d \ ` >& /dev/null + set f=`cat "$HOME/.ssh/known_hosts" | cut -f 1 -d \ | sed -e 's/,/ /g'` >& /dev/null set hosts=($hosts $f) endif unset f @@ -224,7 +224,7 @@ if ($?_complete) then # these should be merged with the MH completion hacks below - jgotts complete {refile,sprev,snext,scan,pick,rmm,inc,folder,show} \ - c@+@F:$HOME/Mail/@ + "c@+@F:$HOME/Mail/@" # these and interrupt handling from Jaap Vermeulen complete {rexec,rxexec,rxterm,rmterm} \ @@ -286,7 +286,7 @@ if ($?_complete) then complete setenv 'p/1/e/' 'c/*:/f/' # these and method of setting hosts from Kimmo Suominen - if ( -f $HOME/.mh_profile && -x "`which folders`" ) then + if ( -f "$HOME/.mh_profile" && -x "`which folders`" ) then if ( ! $?FOLDERS ) setenv FOLDERS "`folders -fast -recurse`" if ( ! $?MHA ) setenv MHA "`ali | sed -e '/^ /d' -e 's/:.*//'`" @@ -505,6 +505,19 @@ if ($?_complete) then logout rdiff release remove rtag status tag unedit \ update watch watchers)/' 'n/-a/(edit unedit commit \ all none)/' 'n/watch/(on off add remove)/' + complete svn 'C@file:///@`'"${HOME}/etc/tcsh/complete.d/svn"'`@@' \ + 'n@ls@(file:/// svn+ssh:// svn://)@@' \ + 'n@help@(add blame cat checkout \ + cleanup commit copy delete export help \ + import info list ls lock log merge mkdir \ + move propdel propedit propget proplist \ + propset resolved revert status switch unlock \ + update)@' 'p@1@(add blame cat checkout \ + cleanup commit copy delete export help \ + import info list ls lock log merge mkdir \ + move propdel propedit propget proplist \ + propset resolved revert status switch unlock \ + update)@' complete cxx 'p/*/f:*.{c++,cxx,c,cc,C,cpp}/' complete detex 'p/*/f:*.tex/' complete edquota 'n/*/u/' @@ -591,14 +604,14 @@ if ($?_complete) then flush-logs flush-status flush-tables flush-privileges \ kill password ping processlist reload refresh \ shutdown status variables version)/' - complete mutt c@-f=@F:${HOME}/Mail/@ \ + complete mutt "c@-f=@F:${HOME}/Mail/@" \ n/-a/f/ \ n/-F/f/ n/-H/f/ \ n/-s/x:''/ \ n/-e/x:''/ \ - n@-b@'`cat ${HOME}/.muttrc-alias | awk '"'"'{print $2 }'"'"\`@ \ - n@-c@'`cat ${HOME}/.muttrc-alias | awk '"'"'{print $2 }'"'"\`@ \ - n@*@'`cat ${HOME}/.muttrc-alias | awk '"'"'{print $2 }'"'"\`@ + n@-b@'`cat "${HOME}/.muttrc-alias" | awk '"'"'{print $2 }'"'"\`@ \ + n@-c@'`cat "${HOME}/.muttrc-alias" | awk '"'"'{print $2 }'"'"\`@ \ + n@*@'`cat "${HOME}/.muttrc-alias" | awk '"'"'{print $2 }'"'"\`@ complete ndc 'n/*/(status dumpdb reload stats trace notrace \ querylog start stop restart )/' if ($?traditional_complete) then @@ -711,14 +724,15 @@ if ($?_complete) then complete unsetenv n/*/e/ set _maildir = /var/mail - if (-r $HOME/.mailrc) then + if (-r "$HOME/.mailrc") then complete mail c/-/"(e i f n s u v)"/ c/*@/\$hosts/ \ - c@+@F:$HOME/Mail@ C@[./\$~]@f@ n/-s/x:''/ \ + "c@+@F:$HOME/Mail@" C@[./\$~]@f@ n/-s/x:''/ \ n@-u@T:$_maildir@ n/-f/f/ \ - n@*@'`sed -n s/alias//p $HOME/.mailrc | tr -s " " " " | cut -f 2`'@ + n@*@'`sed -n s/alias//p "$HOME/.mailrc" | \ + tr -s " " " " | cut -f 2`'@ else complete mail c/-/"(e i f n s u v)"/ c/*@/\$hosts/ \ - c@+@F:$HOME/Mail@ C@[./\$~]@f@ n/-s/x:''/ \ + "c@+@F:$HOME/Mail@" C@[./\$~]@f@ n/-s/x:''/ \ n@-u@T:$_maildir@ n/-f/f/ n/*/u/ endif unset _maildir @@ -1029,23 +1043,41 @@ n@public@'`[ -r /usr/man/manp ]&& \ls -1 N/{-C,--directory}/'`\ls $:-1`'/ \ n/-[0-7]/"(l m h)"/ - # Linux filesystems - complete mount c/-/"(a f F h l n o r s t U v V w)"/ n/-[hV]/n/ \ - n/-o/x:''/ n/-t/x:''/ \ - n/-L/x:'