From owner-svn-src-head@FreeBSD.ORG Sun Mar 1 04:57:24 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 5DEBE106566B; Sun, 1 Mar 2009 04:57:24 +0000 (UTC) (envelope-from bms@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 30E328FC12; Sun, 1 Mar 2009 04:57:24 +0000 (UTC) (envelope-from bms@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 n214vO18030950; Sun, 1 Mar 2009 04:57:24 GMT (envelope-from bms@svn.freebsd.org) Received: (from bms@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n214vODg030949; Sun, 1 Mar 2009 04:57:24 GMT (envelope-from bms@svn.freebsd.org) Message-Id: <200903010457.n214vODg030949@svn.freebsd.org> From: Bruce M Simpson Date: Sun, 1 Mar 2009 04:57:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r189204 - 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: Sun, 01 Mar 2009 04:57:24 -0000 Author: bms Date: Sun Mar 1 04:57:23 2009 New Revision: 189204 URL: http://svn.freebsd.org/changeset/base/189204 Log: In sys/tree.h: * Add RB_FOREACH_FROM() which continues traversal *at* the y-node provided. There is no pre-increment. * Nuke RB_FOREACH_SAFE as it was buggy; it would omit the final node. * Replace RB_FOREACH_SAFE() with a working implementation derived from RB_FOREACH_FROM(). The key observation is that we now only check the loop-control variable, but still cache the next member pointer. * Add RB_FOREACH_REVERSE_FROM() which continues backwards traversal *at* the y-node provided. There is no pre-increment. Typically this is used to back out of allocations made whilst walking an RB-tree. * Add RB_FOREACH_REVERSE_SAFE() which performs insertion and deletion safe backwards traversal. Modified: head/sys/sys/tree.h Modified: head/sys/sys/tree.h ============================================================================== --- head/sys/sys/tree.h Sun Mar 1 04:49:42 2009 (r189203) +++ head/sys/sys/tree.h Sun Mar 1 04:57:23 2009 (r189204) @@ -737,9 +737,14 @@ name##_RB_MINMAX(struct name *head, int (x) != NULL; \ (x) = name##_RB_NEXT(x)) +#define RB_FOREACH_FROM(x, name, y) \ + for ((x) = (y); \ + ((x) != NULL) && ((y) = name##_RB_NEXT(x), (x) != NULL); \ + (x) = (y)) + #define RB_FOREACH_SAFE(x, name, head, y) \ for ((x) = RB_MIN(name, head); \ - (x) != NULL && ((y) = name##_RB_NEXT(x)); \ + ((x) != NULL) && ((y) = name##_RB_NEXT(x), (x) != NULL); \ (x) = (y)) #define RB_FOREACH_REVERSE(x, name, head) \ @@ -747,4 +752,14 @@ name##_RB_MINMAX(struct name *head, int (x) != NULL; \ (x) = name##_RB_PREV(x)) +#define RB_FOREACH_REVERSE_FROM(x, name, y) \ + for ((x) = (y); \ + ((x) != NULL) && ((y) = name##_RB_PREV(x), (x) != NULL); \ + (x) = (y)) + +#define RB_FOREACH_REVERSE_SAFE(x, name, head, y) \ + for ((x) = RB_MAX(name, head); \ + ((x) != NULL) && ((y) = name##_RB_PREV(x), (x) != NULL); \ + (x) = (y)) + #endif /* _SYS_TREE_H_ */ From owner-svn-src-head@FreeBSD.ORG Sun Mar 1 05:44: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 7D2B0106564A; Sun, 1 Mar 2009 05:44:28 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 514CA8FC0C; Sun, 1 Mar 2009 05:44:28 +0000 (UTC) (envelope-from delphij@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 n215iSqb031891; Sun, 1 Mar 2009 05:44:28 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n215iSc7031890; Sun, 1 Mar 2009 05:44:28 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <200903010544.n215iSc7031890@svn.freebsd.org> From: Xin LI Date: Sun, 1 Mar 2009 05:44: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: r189207 - head/lib/libc/stdlib X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 01 Mar 2009 05:44:28 -0000 Author: delphij Date: Sun Mar 1 05:44:28 2009 New Revision: 189207 URL: http://svn.freebsd.org/changeset/base/189207 Log: "-isoC-99" should be spelled without 'c'. Modified: head/lib/libc/stdlib/atol.3 Modified: head/lib/libc/stdlib/atol.3 ============================================================================== --- head/lib/libc/stdlib/atol.3 Sun Mar 1 05:09:34 2009 (r189206) +++ head/lib/libc/stdlib/atol.3 Sun Mar 1 05:44:28 2009 (r189207) @@ -103,7 +103,7 @@ and is not required by .St -isoC or -.St -isoC-c99 , +.St -isoC-99 , but it is allowed by all of .St -isoC , St -isoC-99 and From owner-svn-src-head@FreeBSD.ORG Sun Mar 1 05:47:14 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 8D076106566C; Sun, 1 Mar 2009 05:47:14 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 616AB8FC18; Sun, 1 Mar 2009 05:47:14 +0000 (UTC) (envelope-from delphij@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 n215lEZq031977; Sun, 1 Mar 2009 05:47:14 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n215lE1P031976; Sun, 1 Mar 2009 05:47:14 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <200903010547.n215lE1P031976@svn.freebsd.org> From: Xin LI Date: Sun, 1 Mar 2009 05:47: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: r189208 - head/lib/libc/net 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, 01 Mar 2009 05:47:14 -0000 Author: delphij Date: Sun Mar 1 05:47:14 2009 New Revision: 189208 URL: http://svn.freebsd.org/changeset/base/189208 Log: Add a missing .El. Modified: head/lib/libc/net/rcmd.3 Modified: head/lib/libc/net/rcmd.3 ============================================================================== --- head/lib/libc/net/rcmd.3 Sun Mar 1 05:44:28 2009 (r189207) +++ head/lib/libc/net/rcmd.3 Sun Mar 1 05:47:14 2009 (r189208) @@ -245,6 +245,7 @@ When using the .Fn rcmd function, this variable is used as the program to run instead of .Xr rsh 1 . +.El .Sh DIAGNOSTICS The .Fn rcmd From owner-svn-src-head@FreeBSD.ORG Sun Mar 1 06:27: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 2B779106566C; Sun, 1 Mar 2009 06:27:04 +0000 (UTC) (envelope-from das@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 1A92C8FC1B; Sun, 1 Mar 2009 06:27:04 +0000 (UTC) (envelope-from das@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 n216R3AT032899; Sun, 1 Mar 2009 06:27:03 GMT (envelope-from das@svn.freebsd.org) Received: (from das@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n216R3c7032898; Sun, 1 Mar 2009 06:27:03 GMT (envelope-from das@svn.freebsd.org) Message-Id: <200903010627.n216R3c7032898@svn.freebsd.org> From: David Schultz Date: Sun, 1 Mar 2009 06:27:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r189209 - 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: Sun, 01 Mar 2009 06:27:04 -0000 Author: das Date: Sun Mar 1 06:27:03 2009 New Revision: 189209 URL: http://svn.freebsd.org/changeset/base/189209 Log: Fix a typo in the previous commit. Submitted by: Mel Modified: head/sys/sys/cdefs.h Modified: head/sys/sys/cdefs.h ============================================================================== --- head/sys/sys/cdefs.h Sun Mar 1 05:47:14 2009 (r189208) +++ head/sys/sys/cdefs.h Sun Mar 1 06:27:03 2009 (r189209) @@ -521,7 +521,7 @@ #if _POSIX_C_SOURCE >= 200809 #define __POSIX_VISIBLE 200809 #define __ISO_C_VISIBLE 1999 -#elif _POSIX_C_SOURCE >= 200121 +#elif _POSIX_C_SOURCE >= 200112 #define __POSIX_VISIBLE 200112 #define __ISO_C_VISIBLE 1999 #elif _POSIX_C_SOURCE >= 199506 From owner-svn-src-head@FreeBSD.ORG Sun Mar 1 07:08: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 6D2471065670; Sun, 1 Mar 2009 07:08:46 +0000 (UTC) (envelope-from rafan@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 5BC578FC12; Sun, 1 Mar 2009 07:08:46 +0000 (UTC) (envelope-from rafan@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 n2178kgN034438; Sun, 1 Mar 2009 07:08:46 GMT (envelope-from rafan@svn.freebsd.org) Received: (from rafan@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n2178k0T034437; Sun, 1 Mar 2009 07:08:46 GMT (envelope-from rafan@svn.freebsd.org) Message-Id: <200903010708.n2178k0T034437@svn.freebsd.org> From: Rong-En Fan Date: Sun, 1 Mar 2009 07:08:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r189216 - head/share/termcap 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, 01 Mar 2009 07:08:46 -0000 Author: rafan Date: Sun Mar 1 07:08:46 2009 New Revision: 189216 URL: http://svn.freebsd.org/changeset/base/189216 Log: - Remove kH (kp_kll) from screen. It has the identical key sequence as @7 (kp_end). As ncurses has the limitation that it returns the first matched key symbol, you can not use END in ncurses based program under screen (like ports/misc/mc). We did similar changes to xterm entry last year for exactly the same reason. PR: 132199 Submitted by: Timur I. Bakeyev MFC after: 2 month Modified: head/share/termcap/termcap.src Modified: head/share/termcap/termcap.src ============================================================================== --- head/share/termcap/termcap.src Sun Mar 1 07:06:44 2009 (r189215) +++ head/share/termcap/termcap.src Sun Mar 1 07:08:46 2009 (r189216) @@ -2771,7 +2771,7 @@ SC|screen|VT 100/ANSI X3.64 virtual term :ku=\EOA:kd=\EOB:kr=\EOC:kl=\EOD:kb=^H:\ :k1=\EOP:k2=\EOQ:k3=\EOR:k4=\EOS:k5=\E[15~:k6=\E[17~:\ :k7=\E[18~:k8=\E[19~:k9=\E[20~:k;=\E[21~:F1=\E[23~:F2=\E[24~:\ - :kh=\E[1~:kI=\E[2~:kD=\E[3~:kH=\E[4~:@7=\E[4~:kP=\E[5~:\ + :kh=\E[1~:kI=\E[2~:kD=\E[3~:@7=\E[4~:kP=\E[5~:\ :kN=\E[6~:eA=\E(B\E)0:as=^N:ae=^O:ti=\E[?1049h:te=\E[?1049l:\ :vi=\E[?25l:ve=\E[34h\E[?25h:vs=\E[34l:\ :Co#8:pa#64:AF=\E[3%dm:AB=\E[4%dm:op=\E[39;49m:AX:\ From owner-svn-src-head@FreeBSD.ORG Sun Mar 1 08:01: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 B411F106566B; Sun, 1 Mar 2009 08:01:38 +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 A28658FC13; Sun, 1 Mar 2009 08:01:38 +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 n2181cwv035772; Sun, 1 Mar 2009 08:01:38 GMT (envelope-from sam@svn.freebsd.org) Received: (from sam@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n2181cM5035771; Sun, 1 Mar 2009 08:01:38 GMT (envelope-from sam@svn.freebsd.org) Message-Id: <200903010801.n2181cM5035771@svn.freebsd.org> From: Sam Leffler Date: Sun, 1 Mar 2009 08:01: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: r189220 - head/usr.sbin/wpa/wpa_supplicant 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, 01 Mar 2009 08:01:39 -0000 Author: sam Date: Sun Mar 1 08:01:38 2009 New Revision: 189220 URL: http://svn.freebsd.org/changeset/base/189220 Log: use ansi prototypes Submitted by: Pawel Worach Modified: head/usr.sbin/wpa/wpa_supplicant/Packet32.c Modified: head/usr.sbin/wpa/wpa_supplicant/Packet32.c ============================================================================== --- head/usr.sbin/wpa/wpa_supplicant/Packet32.c Sun Mar 1 07:24:26 2009 (r189219) +++ head/usr.sbin/wpa/wpa_supplicant/Packet32.c Sun Mar 1 08:01:38 2009 (r189220) @@ -109,8 +109,7 @@ PacketGetVersion(void) } void * -PacketOpenAdapter(iface) - CHAR *iface; +PacketOpenAdapter(CHAR *iface) { struct adapter *a; int s; @@ -164,10 +163,7 @@ PacketOpenAdapter(iface) } int -PacketRequest(iface, set, oid) - void *iface; - BOOLEAN set; - PACKET_OID_DATA *oid; +PacketRequest(void *iface, BOOLEAN set, PACKET_OID_DATA *oid) { struct adapter *a; uint32_t retval; @@ -239,9 +235,7 @@ PacketRequest(iface, set, oid) } int -PacketGetAdapterNames(namelist, len) - CHAR *namelist; - ULONG *len; +PacketGetAdapterNames(CHAR *namelist, ULONG *len) { int mib[6]; size_t needed; @@ -341,8 +335,7 @@ PacketGetAdapterNames(namelist, len) } void -PacketCloseAdapter(iface) - void *iface; +PacketCloseAdapter(void *iface) { struct adapter *a; struct ifreq ifr; From owner-svn-src-head@FreeBSD.ORG Sun Mar 1 09:35: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 71F0B106566C; Sun, 1 Mar 2009 09:35:41 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 468048FC13; Sun, 1 Mar 2009 09:35:41 +0000 (UTC) (envelope-from bz@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 n219ZfPS037466; Sun, 1 Mar 2009 09:35:41 GMT (envelope-from bz@svn.freebsd.org) Received: (from bz@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n219ZfwD037465; Sun, 1 Mar 2009 09:35:41 GMT (envelope-from bz@svn.freebsd.org) Message-Id: <200903010935.n219ZfwD037465@svn.freebsd.org> From: "Bjoern A. Zeeb" Date: Sun, 1 Mar 2009 09:35: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: r189221 - 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: Sun, 01 Mar 2009 09:35:41 -0000 Author: bz Date: Sun Mar 1 09:35:41 2009 New Revision: 189221 URL: http://svn.freebsd.org/changeset/base/189221 Log: Add the new compile-time assertion macro CTASSERT_EQUAL(). It takes a positive integer constant (the expected value) and another positive integer, usually compile-time evaluated, e.g. CTASSERT_EQUAL(FOO_EXPECTED_SIZE, sizeof (struct foo)); While the classic CTASSERT() gives: error: size of array '__assert60' is negative this gives you: In function '__ctassert_equal_at_line_60': warning: '__expected_42_but_got[464ul]' is used uninitialized in this function and you can directly see the difference in the expected and the real value. CTASSERT_EQUAL() needs special compile time options to trigger thus keep it locally to this header. If it proves to be of general interest it can be moved to systm.h. Submitted by: jmallett Reviewed by: sam, warner, rwatson, jmallett (earlier versions) Modified: head/sys/sys/vimage.h Modified: head/sys/sys/vimage.h ============================================================================== --- head/sys/sys/vimage.h Sun Mar 1 08:01:38 2009 (r189220) +++ head/sys/sys/vimage.h Sun Mar 1 09:35:41 2009 (r189221) @@ -112,4 +112,28 @@ struct vnet_modlink { int vi_symlookup(struct kld_sym_lookup *, char *); void vnet_mod_register(const struct vnet_modinfo *); +/* + * x must be a positive integer constant (expected value), + * y must be compile-time evaluated to a positive integer, + * e.g. CTASSERT_EQUAL(FOO_EXPECTED_SIZE, sizeof (struct foo)); + * One needs to compile with -Wuninitialized and thus at least -O + * for this to trigger and -Werror if it should be fatal. + */ +#define CTASSERT_EQUAL(x, y) \ + static int __attribute__((__used__)) \ + __attribute__((__section__(".debug_ctassert_equal"))) \ + __CONCAT(__ctassert_equal_at_line_, __LINE__)(void); \ + \ + static int __attribute__((__used__)) \ + __attribute__((__section__(".debug_ctassert_equal"))) \ + __CONCAT(__ctassert_equal_at_line_, __LINE__)(void) \ + { \ + int __CONCAT(__CONCAT(__expected_, x), \ + _but_got)[(y) + (x)]; \ + __CONCAT(__CONCAT(__expected_, x), _but_got)[(x)] = 1; \ + return (__CONCAT(__CONCAT(__expected_, x), \ + _but_got)[(y)]); \ + } \ + struct __hack + #endif /* !_SYS_VIMAGE_H_ */ From owner-svn-src-head@FreeBSD.ORG Sun Mar 1 09:50: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 E1BC5106566B; Sun, 1 Mar 2009 09:50:13 +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 B63078FC0C; Sun, 1 Mar 2009 09:50:13 +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 n219oD9f037777; Sun, 1 Mar 2009 09:50:13 GMT (envelope-from ed@svn.freebsd.org) Received: (from ed@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n219oDtL037775; Sun, 1 Mar 2009 09:50:13 GMT (envelope-from ed@svn.freebsd.org) Message-Id: <200903010950.n219oDtL037775@svn.freebsd.org> From: Ed Schouten Date: Sun, 1 Mar 2009 09:50:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r189222 - 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: Sun, 01 Mar 2009 09:50:14 -0000 Author: ed Date: Sun Mar 1 09:50:13 2009 New Revision: 189222 URL: http://svn.freebsd.org/changeset/base/189222 Log: Improve my previous changes to the TTY code: also remove memcpy(). It's better to just use internal language constructs, because it is likely the compiler has a better opinion on whether to perform inlining, which is very likely to happen to struct winsize. Submitted by: Christoph Mallon Modified: head/sys/kern/tty.c head/sys/kern/tty_pts.c Modified: head/sys/kern/tty.c ============================================================================== --- head/sys/kern/tty.c Sun Mar 1 09:35:41 2009 (r189221) +++ head/sys/kern/tty.c Sun Mar 1 09:50:13 2009 (r189222) @@ -724,14 +724,14 @@ ttyil_ioctl(struct cdev *dev, u_long cmd switch (cmd) { case TIOCGETA: /* Obtain terminal flags through tcgetattr(). */ - memcpy(data, dev->si_drv2, sizeof(struct termios)); + *(struct termios*)data = *(struct termios*)dev->si_drv2; break; case TIOCSETA: /* Set terminal flags through tcsetattr(). */ error = priv_check(td, PRIV_TTY_SETA); if (error) break; - memcpy(dev->si_drv2, data, sizeof(struct termios)); + *(struct termios*)dev->si_drv2 = *(struct termios*)data; break; case TIOCGETD: *(int *)data = TTYDISC; @@ -1344,7 +1344,7 @@ tty_generic_ioctl(struct tty *tp, u_long return (0); case TIOCGETA: /* Obtain terminal flags through tcgetattr(). */ - memcpy(data, &tp->t_termios, sizeof(struct termios)); + *(struct termios*)data = tp->t_termios; return (0); case TIOCSETA: case TIOCSETAW: @@ -1568,13 +1568,13 @@ tty_generic_ioctl(struct tty *tp, u_long return (0); case TIOCGWINSZ: /* Obtain window size. */ - memcpy(data, &tp->t_winsize, sizeof(struct winsize)); + *(struct winsize*)data = tp->t_winsize; return (0); case TIOCSWINSZ: /* Set window size. */ if (bcmp(&tp->t_winsize, data, sizeof(struct winsize)) == 0) return (0); - memcpy(&tp->t_winsize, data, sizeof(struct winsize)); + tp->t_winsize = *(struct winsize*)data; tty_signal_pgrp(tp, SIGWINCH); return (0); case TIOCEXCL: Modified: head/sys/kern/tty_pts.c ============================================================================== --- head/sys/kern/tty_pts.c Sun Mar 1 09:35:41 2009 (r189221) +++ head/sys/kern/tty_pts.c Sun Mar 1 09:50:13 2009 (r189222) @@ -310,7 +310,7 @@ ptsdev_ioctl(struct file *fp, u_long cmd case TIOCGETA: /* Obtain terminal flags through tcgetattr(). */ tty_lock(tp); - memcpy(data, &tp->t_termios, sizeof(struct termios)); + *(struct termios*)data = tp->t_termios; tty_unlock(tp); return (0); #endif /* PTS_LINUX */ From owner-svn-src-head@FreeBSD.ORG Sun Mar 1 09:51: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 E83271065677; Sun, 1 Mar 2009 09:51:50 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D6F048FC18; Sun, 1 Mar 2009 09:51:50 +0000 (UTC) (envelope-from bz@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 n219poKw037836; Sun, 1 Mar 2009 09:51:50 GMT (envelope-from bz@svn.freebsd.org) Received: (from bz@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n219po8x037835; Sun, 1 Mar 2009 09:51:50 GMT (envelope-from bz@svn.freebsd.org) Message-Id: <200903010951.n219po8x037835@svn.freebsd.org> From: "Bjoern A. Zeeb" Date: Sun, 1 Mar 2009 09:51: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: r189223 - 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: Sun, 01 Mar 2009 09:51:51 -0000 Author: bz Date: Sun Mar 1 09:51:50 2009 New Revision: 189223 URL: http://svn.freebsd.org/changeset/base/189223 Log: Add the infrastructure and expected sizeof() values for each supported architecture to implement size-guards on the vimage vnet_* structures. As CTASSERT_EQUAL() needs special compile time options we back it by CTASSERT() in the default case. Unfortunately CTASSERT() triggers first, thus add an option to allow compilation with CTASSERT_EQUAL() only. See the comments how to get new values if you trigger the assert and what to do in that case. Reviewed by: rwatson, zec (earlier versions) Modified: head/sys/sys/vimage.h Modified: head/sys/sys/vimage.h ============================================================================== --- head/sys/sys/vimage.h Sun Mar 1 09:50:13 2009 (r189222) +++ head/sys/sys/vimage.h Sun Mar 1 09:51:50 2009 (r189223) @@ -113,6 +113,79 @@ int vi_symlookup(struct kld_sym_lookup * void vnet_mod_register(const struct vnet_modinfo *); /* + * Size-guards for the vimage structures. + * If you need to update the values you MUST increment __FreeBSD_version. + * See description further down to see how to get the new values. + */ +#ifdef __amd64__ +#define SIZEOF_vnet_net 464 +#define SIZEOF_vnet_net_LINT 5144 +#define SIZEOF_vnet_inet 4160 +#define SIZEOF_vnet_inet6 8800 +#define SIZEOF_vnet_ipsec 31160 +#endif +#ifdef __arm__ +#define SIZEOF_vnet_net 236 +#define SIZEOF_vnet_net_LINT 1 /* No LINT kernel yet. */ +#define SIZEOF_vnet_inet 2396 +#define SIZEOF_vnet_inet6 8536 +#define SIZEOF_vnet_ipsec 1 +#endif +#ifdef __i386__ /* incl. pc98 */ +#define SIZEOF_vnet_net 236 +#define SIZEOF_vnet_net_LINT 2576 +#define SIZEOF_vnet_inet 2396 +#define SIZEOF_vnet_inet6 8528 +#define SIZEOF_vnet_ipsec 31016 +#endif +#ifdef __ia64__ +#define SIZEOF_vnet_net 464 +#define SIZEOF_vnet_net_LINT 5144 +#define SIZEOF_vnet_inet 4160 +#define SIZEOF_vnet_inet6 8800 +#define SIZEOF_vnet_ipsec 31160 +#endif +#ifdef __mips__ +#define SIZEOF_vnet_net 236 +#define SIZEOF_vnet_net_LINT 1 /* No LINT kernel yet. */ +#define SIZEOF_vnet_inet 2432 +#define SIZEOF_vnet_inet6 8552 +#define SIZEOF_vnet_ipsec 1 +#endif +#ifdef __powerpc__ +#define SIZEOF_vnet_net 236 +#define SIZEOF_vnet_net_LINT 2576 +#define SIZEOF_vnet_inet 2432 +#define SIZEOF_vnet_inet6 8536 +#define SIZEOF_vnet_ipsec 31048 +#endif +#ifdef __sparc64__ /* incl. sun4v */ +#define SIZEOF_vnet_net 464 +#define SIZEOF_vnet_net_LINT 5144 +#define SIZEOF_vnet_inet 4160 +#define SIZEOF_vnet_inet6 8800 +#define SIZEOF_vnet_ipsec 31160 +#endif + +#ifdef COMPILING_LINT +#undef SIZEOF_vnet_net +#define SIZEOF_vnet_net SIZEOF_vnet_net_LINT +#endif + +#ifndef SIZEOF_vnet_net +#error "SIZEOF_vnet_net no defined for this architecture." +#endif +#ifndef SIZEOF_vnet_inet +#error "SIZEOF_vnet_inet no defined for this architecture." +#endif +#ifndef SIZEOF_vnet_inet6 +#error "SIZEOF_vnet_inet6 no defined for this architecture." +#endif +#ifndef SIZEOF_vnet_ipsec +#error "SIZEOF_vnet_ipsec no defined for this architecture." +#endif + +/* * x must be a positive integer constant (expected value), * y must be compile-time evaluated to a positive integer, * e.g. CTASSERT_EQUAL(FOO_EXPECTED_SIZE, sizeof (struct foo)); @@ -136,4 +209,30 @@ void vnet_mod_register(const struct vnet } \ struct __hack +/* + * x shall be the expected value (SIZEOF_vnet_* from above) + * and y shall be the real size (sizeof(struct vnet_*)). + * If you run into the CTASSERT() you want to compile a universe + * with COPTFLAGS+="-O -Wuninitialized -DVIMAGE_CHECK_SIZES". + * This should give you the errors for the proper values defined above. + * Make sure to re-run universe with the proper values afterwards - + * -DMAKE_JUST_KERNELS should be enough. + * + * Note: + * CTASSERT() takes precedence in the current FreeBSD world thus the + * CTASSERT_EQUAL() will not neccessarily trigger if one uses both. + * But as CTASSERT_EQUAL() needs special compile time options, we + * want the default case to be backed by CTASSERT(). + */ +#ifndef VIMAGE_CTASSERT +#ifdef VIMAGE_CHECK_SIZES +#define VIMAGE_CTASSERT(x, y) \ + CTASSERT_EQUAL(x, y) +#else +#define VIMAGE_CTASSERT(x, y) \ + CTASSERT_EQUAL(x, y); \ + CTASSERT(x == 0 || x == y) +#endif +#endif + #endif /* !_SYS_VIMAGE_H_ */ From owner-svn-src-head@FreeBSD.ORG Sun Mar 1 11:01: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 D133410656D7; Sun, 1 Mar 2009 11:01:01 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 610C78FC19; Sun, 1 Mar 2009 11:01:01 +0000 (UTC) (envelope-from bz@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 n21B114E041466; Sun, 1 Mar 2009 11:01:01 GMT (envelope-from bz@svn.freebsd.org) Received: (from bz@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n21B11eV041462; Sun, 1 Mar 2009 11:01:01 GMT (envelope-from bz@svn.freebsd.org) Message-Id: <200903011101.n21B11eV041462@svn.freebsd.org> From: "Bjoern A. Zeeb" Date: Sun, 1 Mar 2009 11:01: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: r189225 - in head/sys: net netinet netinet6 netipsec 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, 01 Mar 2009 11:01:02 -0000 Author: bz Date: Sun Mar 1 11:01:00 2009 New Revision: 189225 URL: http://svn.freebsd.org/changeset/base/189225 Log: Add size-guards evaluated at compile-time to the main struct vnet_* which are not in a module of their own like gif. Single kernel compiles and universe will fail if the size of the struct changes. Th expected values are given in sys/vimage.h. See the comments where how to handle this. Requested by: peter Modified: head/sys/net/vnet.h head/sys/netinet/vinet.h head/sys/netinet6/vinet6.h head/sys/netipsec/vipsec.h Modified: head/sys/net/vnet.h ============================================================================== --- head/sys/net/vnet.h Sun Mar 1 10:51:34 2009 (r189224) +++ head/sys/net/vnet.h Sun Mar 1 11:01:00 2009 (r189225) @@ -56,6 +56,9 @@ struct vnet_net { int _ether_ipfw; }; +/* Size guard. See sys/vimage.h. */ +VIMAGE_CTASSERT(SIZEOF_vnet_net, sizeof(struct vnet_net)); + #ifndef VIMAGE #ifndef VIMAGE_GLOBALS extern struct vnet_net vnet_net_0; Modified: head/sys/netinet/vinet.h ============================================================================== --- head/sys/netinet/vinet.h Sun Mar 1 10:51:34 2009 (r189224) +++ head/sys/netinet/vinet.h Sun Mar 1 11:01:00 2009 (r189225) @@ -196,6 +196,9 @@ struct vnet_inet { int _fw_one_pass; }; +/* Size guard. See sys/vimage.h. */ +VIMAGE_CTASSERT(SIZEOF_vnet_inet, sizeof(struct vnet_inet)); + #ifndef VIMAGE #ifndef VIMAGE_GLOBALS extern struct vnet_inet vnet_inet_0; Modified: head/sys/netinet6/vinet6.h ============================================================================== --- head/sys/netinet6/vinet6.h Sun Mar 1 10:51:34 2009 (r189224) +++ head/sys/netinet6/vinet6.h Sun Mar 1 11:01:00 2009 (r189225) @@ -155,6 +155,9 @@ struct vnet_inet6 { struct ip6_pktopts _ip6_opts; }; +/* Size guard. See sys/vimage.h. */ +VIMAGE_CTASSERT(SIZEOF_vnet_inet6, sizeof(struct vnet_inet6)); + #ifndef VIMAGE #ifndef VIMAGE_GLOBALS extern struct vnet_inet6 vnet_inet6_0; Modified: head/sys/netipsec/vipsec.h ============================================================================== --- head/sys/netipsec/vipsec.h Sun Mar 1 10:51:34 2009 (r189224) +++ head/sys/netipsec/vipsec.h Sun Mar 1 11:01:00 2009 (r189225) @@ -107,6 +107,9 @@ struct vnet_ipsec { LIST_HEAD(, secspacq) _spacqtree; }; +/* Size guard. See sys/vimage.h. */ +VIMAGE_CTASSERT(SIZEOF_vnet_ipsec, sizeof(struct vnet_ipsec)); + #ifndef VIMAGE #ifndef VIMAGE_GLOBALS extern struct vnet_ipsec vnet_ipsec_0; From owner-svn-src-head@FreeBSD.ORG Sun Mar 1 11:10:07 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 5CFA01065672; Sun, 1 Mar 2009 11:10:07 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from mail.cksoft.de (mail.cksoft.de [62.111.66.27]) by mx1.freebsd.org (Postfix) with ESMTP id 12CD48FC12; Sun, 1 Mar 2009 11:10:06 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from localhost (amavis.str.cksoft.de [192.168.74.71]) by mail.cksoft.de (Postfix) with ESMTP id C800241C67B; Sun, 1 Mar 2009 12:10:05 +0100 (CET) X-Virus-Scanned: amavisd-new at cksoft.de Received: from mail.cksoft.de ([62.111.66.27]) by localhost (amavis.str.cksoft.de [192.168.74.71]) (amavisd-new, port 10024) with ESMTP id oEJQwAxlFxH7; Sun, 1 Mar 2009 12:10:05 +0100 (CET) Received: by mail.cksoft.de (Postfix, from userid 66) id 6DB3841C62F; Sun, 1 Mar 2009 12:10:05 +0100 (CET) Received: from maildrop.int.zabbadoz.net (maildrop.int.zabbadoz.net [10.111.66.10]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.int.zabbadoz.net (Postfix) with ESMTP id 44A504448E6; Sun, 1 Mar 2009 11:05:58 +0000 (UTC) Date: Sun, 1 Mar 2009 11:05:57 +0000 (UTC) From: "Bjoern A. Zeeb" X-X-Sender: bz@maildrop.int.zabbadoz.net To: Peter Wemm In-Reply-To: Message-ID: <20090301101142.V96785@maildrop.int.zabbadoz.net> References: <200812132159.mBDLxIQv040799@svn.freebsd.org> X-OpenPGP-Key: 0x14003F198FEFA3E77207EE8D2B58B8F83CCF1842 MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r186057 - head/sys/netinet X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 01 Mar 2009 11:10:07 -0000 On Tue, 16 Dec 2008, Peter Wemm wrote: > On Sat, Dec 13, 2008 at 1:59 PM, Bjoern A. Zeeb wrote: >> De-virtualize the MD5 context for TCP initial seq number generation >> and make it a function local variable like we do almost everywhere >> inside the kernel. > [..] >> --- head/sys/netinet/vinet.h Sat Dec 13 21:17:46 2008 (r186056) >> +++ head/sys/netinet/vinet.h Sat Dec 13 21:59:18 2008 (r186057) >> @@ -142,7 +142,6 @@ struct vnet_inet { ... > I'm bitterly unhappy with this. Every time these structs are touched, > either directly or indirectly, there is a guaranteed ABI breakage with > kernel modules. > > There needs to be a __FreeBSD_version bump (or something similar) > every time any of these structures change, and any kernel modules > *must* be prevented from loading. It can't be a >= some version, it > has to be an exact match. ... > In the mean time, I'd like to see some compile-time asserts in there > to make sure there are no accidental size changes of this structure. This has finally happened, thanks to Juli Mallett now finding a good CTASSERT-a-like way that also prints the expected and the actual size. Without that I had found it was impossible to get the proper values for all architectures we support to be able to (cross) build or finish a universe when trying to implement this end of last year. /bz -- Bjoern A. Zeeb The greatest risk is not taking one. From owner-svn-src-head@FreeBSD.ORG Sun Mar 1 12:42: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 1BB791065675; Sun, 1 Mar 2009 12:42:55 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 08E998FC1E; Sun, 1 Mar 2009 12:42:55 +0000 (UTC) (envelope-from rwatson@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 n21CgsNp043574; Sun, 1 Mar 2009 12:42:54 GMT (envelope-from rwatson@svn.freebsd.org) Received: (from rwatson@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n21CgsV1043573; Sun, 1 Mar 2009 12:42:54 GMT (envelope-from rwatson@svn.freebsd.org) Message-Id: <200903011242.n21CgsV1043573@svn.freebsd.org> From: Robert Watson Date: Sun, 1 Mar 2009 12:42: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: r189230 - head/sys/net 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, 01 Mar 2009 12:42:57 -0000 Author: rwatson Date: Sun Mar 1 12:42:54 2009 New Revision: 189230 URL: http://svn.freebsd.org/changeset/base/189230 Log: Do a bit of struct ifnet cleanup in preparation for 8.0: group function pointers together, move padding to the bottom of the structure, and add two new integer spares due to attrition over time. Remove unused spare "flags" field, we can use one of the spare ints if we need it later. This change requires a rebuild of device driver modules that depend on the layout of ifnet for binary compatibility reasons. Discussed with: kmacy Modified: head/sys/net/if_var.h Modified: head/sys/net/if_var.h ============================================================================== --- head/sys/net/if_var.h Sun Mar 1 11:20:35 2009 (r189229) +++ head/sys/net/if_var.h Sun Mar 1 12:42:54 2009 (r189230) @@ -162,10 +162,13 @@ struct ifnet { (void *); int (*if_resolvemulti) /* validate/resolve multicast */ (struct ifnet *, struct sockaddr **, struct sockaddr *); + void (*if_qflush) /* flush any queues */ + (struct ifnet *); + int (*if_transmit) /* initiate output routine */ + (struct ifnet *, struct mbuf *); struct ifaddr *if_addr; /* pointer to link-level address */ void *if_llsoftc; /* link layer softc */ int if_drv_flags; /* driver-managed status flags */ - u_int if_spare_flags2; /* spare flags 2 */ struct ifaltq if_snd; /* output queue (includes altq) */ const u_int8_t *if_broadcastaddr; /* linklevel broadcast bytestring */ @@ -187,12 +190,14 @@ struct ifnet { /* protected by if_addr_mtx */ void *if_pf_kif; void *if_lagg; /* lagg glue */ - void *if_pspare[8]; /* TOE 3; vimage 3; general use 4 */ - void (*if_qflush) /* flush any queues */ - (struct ifnet *); - int (*if_transmit) /* initiate output routine */ - (struct ifnet *, struct mbuf *); - int if_ispare[2]; /* general use 2 */ + + /* + * Spare fields are added so that we can modify sensitive data + * structures without changing the kernel binary interface, and must + * be used with care where binary compatibility is required. + */ + void *if_pspare[8]; + int if_ispare[4]; }; typedef void if_init_f_t(void *); From owner-svn-src-head@FreeBSD.ORG Sun Mar 1 12:44: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 D70BE106566C; Sun, 1 Mar 2009 12:44:33 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C6EF18FC1A; Sun, 1 Mar 2009 12:44:33 +0000 (UTC) (envelope-from rwatson@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 n21CiXNB043660; Sun, 1 Mar 2009 12:44:33 GMT (envelope-from rwatson@svn.freebsd.org) Received: (from rwatson@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n21CiX26043659; Sun, 1 Mar 2009 12:44:33 GMT (envelope-from rwatson@svn.freebsd.org) Message-Id: <200903011244.n21CiX26043659@svn.freebsd.org> From: Robert Watson Date: Sun, 1 Mar 2009 12:44: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: r189231 - 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: Sun, 01 Mar 2009 12:44:35 -0000 Author: rwatson Date: Sun Mar 1 12:44:33 2009 New Revision: 189231 URL: http://svn.freebsd.org/changeset/base/189231 Log: Note that network device driver modules need rebuilding. Modified: head/UPDATING Modified: head/UPDATING ============================================================================== --- head/UPDATING Sun Mar 1 12:42:54 2009 (r189230) +++ head/UPDATING Sun Mar 1 12:44:33 2009 (r189231) @@ -22,6 +22,10 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 8. to maximize performance. (To disable malloc debugging, run ln -s aj /etc/malloc.conf.) +20090301: + The layout of struct ifnet has changed, requiring a rebuild of all + network device driver modules. + 20090227: The /dev handling for the new USB stack has changed, a buildworld/installworld is required for libusb20. From owner-svn-src-head@FreeBSD.ORG Sun Mar 1 13:18: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 6708B106564A; Sun, 1 Mar 2009 13:18:55 +0000 (UTC) (envelope-from luigi@onelab2.iet.unipi.it) Received: from onelab2.iet.unipi.it (onelab2.iet.unipi.it [131.114.9.129]) by mx1.freebsd.org (Postfix) with ESMTP id 299B58FC0A; Sun, 1 Mar 2009 13:18:55 +0000 (UTC) (envelope-from luigi@onelab2.iet.unipi.it) Received: by onelab2.iet.unipi.it (Postfix, from userid 275) id D795873098; Sun, 1 Mar 2009 14:23:50 +0100 (CET) Date: Sun, 1 Mar 2009 14:23:50 +0100 From: Luigi Rizzo To: Robert Watson Message-ID: <20090301132350.GB54337@onelab2.iet.unipi.it> References: <200903011242.n21CgsV1043573@svn.freebsd.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <200903011242.n21CgsV1043573@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: r189230 - head/sys/net 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, 01 Mar 2009 13:18:55 -0000 On Sun, Mar 01, 2009 at 12:42:54PM +0000, Robert Watson wrote: > Author: rwatson > Date: Sun Mar 1 12:42:54 2009 > New Revision: 189230 > URL: http://svn.freebsd.org/changeset/base/189230 > > Log: > Do a bit of struct ifnet cleanup in preparation for 8.0: group function > pointers together, move padding to the bottom of the structure, and add > two new integer spares due to attrition over time. Remove unused spare > "flags" field, we can use one of the spare ints if we need it later. > > This change requires a rebuild of device driver modules that depend on > the layout of ifnet for binary compatibility reasons. any chance to do similar things for other key kernel structures, such as mbufs and struct bio ? As an example, "struct bio" would benefit from at least one extra intptr_t field to be used for classification purposes (see some recent work we have been doing on disk scheduling). This is a rather trivial and unintrusive change. struct mbuf would benefit from a 'length' field, replacing the hardcoded MLEN/MHLEN. This field would allow us to do several things, e.g.: - use part of the data area to store m_tags instead of having to malloc() them separately; - support multiple (or perhaps even runtime-configurable) mbuf sizes (and corresponding uma zones), so people could experiment with larger MBUFS and perhaps figure out what is the performance impact of using mbuf+clusters instead of individual mbufs for basically every incoming packet. cheers luigi From owner-svn-src-head@FreeBSD.ORG Sun Mar 1 13:33: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 8162E1065675; Sun, 1 Mar 2009 13:33:50 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from cyrus.watson.org (cyrus.watson.org [65.122.17.42]) by mx1.freebsd.org (Postfix) with ESMTP id 5CB358FC0C; Sun, 1 Mar 2009 13:33:50 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from fledge.watson.org (fledge.watson.org [65.122.17.41]) by cyrus.watson.org (Postfix) with ESMTPS id 0383946B2A; Sun, 1 Mar 2009 08:33:50 -0500 (EST) Date: Sun, 1 Mar 2009 13:33:49 +0000 (GMT) From: Robert Watson X-X-Sender: robert@fledge.watson.org To: Luigi Rizzo In-Reply-To: <20090301132350.GB54337@onelab2.iet.unipi.it> Message-ID: References: <200903011242.n21CgsV1043573@svn.freebsd.org> <20090301132350.GB54337@onelab2.iet.unipi.it> User-Agent: Alpine 2.00 (BSF 1167 2008-08-23) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r189230 - head/sys/net 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, 01 Mar 2009 13:33:50 -0000 On Sun, 1 Mar 2009, Luigi Rizzo wrote: > On Sun, Mar 01, 2009 at 12:42:54PM +0000, Robert Watson wrote: >> Author: rwatson >> Date: Sun Mar 1 12:42:54 2009 >> New Revision: 189230 >> URL: http://svn.freebsd.org/changeset/base/189230 >> >> Log: >> Do a bit of struct ifnet cleanup in preparation for 8.0: group function >> pointers together, move padding to the bottom of the structure, and add >> two new integer spares due to attrition over time. Remove unused spare >> "flags" field, we can use one of the spare ints if we need it later. >> >> This change requires a rebuild of device driver modules that depend on >> the layout of ifnet for binary compatibility reasons. > > any chance to do similar things for other key kernel structures, such as > mbufs and struct bio ? > > As an example, "struct bio" would benefit from at least one extra intptr_t > field to be used for classification purposes (see some recent work we have > been doing on disk scheduling). This is a rather trivial and unintrusive > change. > > struct mbuf would benefit from a 'length' field, replacing the hardcoded > MLEN/MHLEN. This field would allow us to do several things, e.g.: Jeff has a large work-in-progress on mbufs, and so I don't want to go near that until all that work has shaken out. This includes support for variable-size mbufs and eliminating large amounts of cluster use (while retaining support for external storage, a we require that for zero-copy foo). If you haven't seen his posts about that work, you might want to give them a skim -- I think they were on arch@/net@. I thought bio was less sensitive to change since it was centrally allocated these days, or is that not the case? ifnet is decreasingly sensitive. Robert N M Watson Computer Laboratory University of Cambridge > - use part of the data area to store m_tags instead of having > to malloc() them separately; > - support multiple (or perhaps even runtime-configurable) mbuf sizes > (and corresponding uma zones), so people could experiment with > larger MBUFS and perhaps figure out what is the performance impact > of using mbuf+clusters instead of individual mbufs for basically > every incoming packet. > > cheers > luigi > From owner-svn-src-head@FreeBSD.ORG Sun Mar 1 14:26:24 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 796AB106566B; Sun, 1 Mar 2009 14:26:24 +0000 (UTC) (envelope-from dchagin@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 684CF8FC12; Sun, 1 Mar 2009 14:26:24 +0000 (UTC) (envelope-from dchagin@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 n21EQOkX045592; Sun, 1 Mar 2009 14:26:24 GMT (envelope-from dchagin@svn.freebsd.org) Received: (from dchagin@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n21EQOdp045591; Sun, 1 Mar 2009 14:26:24 GMT (envelope-from dchagin@svn.freebsd.org) Message-Id: <200903011426.n21EQOdp045591@svn.freebsd.org> From: Dmitry Chagin Date: Sun, 1 Mar 2009 14:26:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r189232 - 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: Sun, 01 Mar 2009 14:26:25 -0000 Author: dchagin Date: Sun Mar 1 14:26:24 2009 New Revision: 189232 URL: http://svn.freebsd.org/changeset/base/189232 Log: Fix range-check error introduced in r182292. Also do not do anything if all processors in the map are not available, simply return. Approved by: kib (mentor) MFC after: 1 week Modified: head/sys/kern/subr_smp.c Modified: head/sys/kern/subr_smp.c ============================================================================== --- head/sys/kern/subr_smp.c Sun Mar 1 12:44:33 2009 (r189231) +++ head/sys/kern/subr_smp.c Sun Mar 1 14:26:24 2009 (r189232) @@ -362,9 +362,11 @@ smp_rendezvous_cpus(cpumask_t map, return; } - for (i = 0; i < mp_maxid; i++) + for (i = 0; i <= mp_maxid; i++) if (((1 << i) & map) != 0 && !CPU_ABSENT(i)) ncpus++; + if (ncpus == 0) + return; /* obtain rendezvous lock */ mtx_lock_spin(&smp_ipi_mtx); From owner-svn-src-head@FreeBSD.ORG Sun Mar 1 14:27: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 20A9B106566C; Sun, 1 Mar 2009 14:27:55 +0000 (UTC) (envelope-from luigi@onelab2.iet.unipi.it) Received: from onelab2.iet.unipi.it (onelab2.iet.unipi.it [131.114.9.129]) by mx1.freebsd.org (Postfix) with ESMTP id D45AC8FC40; Sun, 1 Mar 2009 14:27:54 +0000 (UTC) (envelope-from luigi@onelab2.iet.unipi.it) Received: by onelab2.iet.unipi.it (Postfix, from userid 275) id 823B073098; Sun, 1 Mar 2009 15:32:50 +0100 (CET) Date: Sun, 1 Mar 2009 15:32:50 +0100 From: Luigi Rizzo To: Robert Watson Message-ID: <20090301143250.GA57294@onelab2.iet.unipi.it> References: <200903011242.n21CgsV1043573@svn.freebsd.org> <20090301132350.GB54337@onelab2.iet.unipi.it> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: 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: r189230 - head/sys/net 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, 01 Mar 2009 14:27:56 -0000 On Sun, Mar 01, 2009 at 01:33:49PM +0000, Robert Watson wrote: > On Sun, 1 Mar 2009, Luigi Rizzo wrote: ... > >any chance to do similar things for other key kernel structures, such as > >mbufs and struct bio ? > > > >As an example, "struct bio" would benefit from at least one extra intptr_t > >field to be used for classification purposes (see some recent work we have > >been doing on disk scheduling). This is a rather trivial and unintrusive > >change. > > > >struct mbuf would benefit from a 'length' field, replacing the hardcoded > >MLEN/MHLEN. This field would allow us to do several things, e.g.: > > Jeff has a large work-in-progress on mbufs, and so I don't want to go near > that until all that work has shaken out. This includes support for > variable-size mbufs and eliminating large amounts of cluster use (while > retaining support for external storage, a we require that for zero-copy > foo). If you haven't seen his posts about that work, you might want to give > them a skim -- I think they were on arch@/net@. ok thanks -- i did not see the posts but the things you explain are perfectly in sync with what I had in mind. > I thought bio was less sensitive to change since it was centrally allocated > these days, or is that not the case? you are probably right, probably it's just the case to add the field at the end so binary geom modules will not be affected by the change. cheers luigi From owner-svn-src-head@FreeBSD.ORG Sun Mar 1 14:40: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 8D68B106564A for ; Sun, 1 Mar 2009 14:40:16 +0000 (UTC) (envelope-from peterjeremy@optushome.com.au) Received: from fallbackmx07.syd.optusnet.com.au (fallbackmx07.syd.optusnet.com.au [211.29.132.9]) by mx1.freebsd.org (Postfix) with ESMTP id 58C6B8FC19 for ; Sun, 1 Mar 2009 14:40:15 +0000 (UTC) (envelope-from peterjeremy@optushome.com.au) Received: from mail15.syd.optusnet.com.au (mail15.syd.optusnet.com.au [211.29.132.196]) by fallbackmx07.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id n21AMUTt021957 for ; Sun, 1 Mar 2009 21:22:30 +1100 Received: from server.vk2pj.dyndns.org (c122-106-216-167.belrs3.nsw.optusnet.com.au [122.106.216.167]) by mail15.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id n21AM2nO021253 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Sun, 1 Mar 2009 21:22:03 +1100 X-Bogosity: Ham, spamicity=0.000000 Received: from server.vk2pj.dyndns.org (localhost.vk2pj.dyndns.org [127.0.0.1]) by server.vk2pj.dyndns.org (8.14.3/8.14.3) with ESMTP id n21AM1JG032392; Sun, 1 Mar 2009 21:22:01 +1100 (EST) (envelope-from peter@server.vk2pj.dyndns.org) Received: (from peter@localhost) by server.vk2pj.dyndns.org (8.14.3/8.14.3/Submit) id n21AM1mR032391; Sun, 1 Mar 2009 21:22:01 +1100 (EST) (envelope-from peter) Date: Sun, 1 Mar 2009 21:22:01 +1100 From: Peter Jeremy To: Ed Schouten Message-ID: <20090301102201.GC3540@server.vk2pj.dyndns.org> References: <200902271601.n1RG1eLE074671@svn.freebsd.org> <20090227160618.GF19161@hoeg.nl> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="xesSdrSSBC0PokLI" Content-Disposition: inline In-Reply-To: <20090227160618.GF19161@hoeg.nl> X-PGP-Key: http://members.optusnet.com.au/peterjeremy/pubkey.asc 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: r189109 - head/gnu/games 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, 01 Mar 2009 14:40:16 -0000 --xesSdrSSBC0PokLI Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On 2009-Feb-27 17:06:18 +0100, Ed Schouten wrote: >* Ed Schouten wrote: >> Remove empty directory structure. > >Hmmmm... Looks like there are many more: =2E.. > contrib/groff/addftinfo > contrib/groff/afmtodit > contrib/groff/eqn > contrib/groff/grn > contrib/groff/grodvi > contrib/groff/groff > contrib/groff/grog > contrib/groff/grohtml > contrib/groff/grolbp > contrib/groff/grolj4 > contrib/groff/grops > contrib/groff/grotty > contrib/groff/hpftodit > contrib/groff/include > contrib/groff/indxbib > contrib/groff/libbib > contrib/groff/libdriver > contrib/groff/libgroff > contrib/groff/lkbib > contrib/groff/lookbib > contrib/groff/mm/examples > contrib/groff/mm/mm > contrib/groff/nroff > contrib/groff/pfbtops > contrib/groff/pic > contrib/groff/refer > contrib/groff/soelim > contrib/groff/src/xditview > contrib/groff/tbl > contrib/groff/tfmtodit > contrib/groff/troff > contrib/groff/xditview Looking in the CVS repo, it looks like the files in these directories were all removed in the vendor branch of the groff v1.17 import but not from the trunk. This occurred in 2001 (ie well before the SVN conversion) so those directories are empty in head. I suspect something similar is true of the other directories. --=20 Peter Jeremy --xesSdrSSBC0PokLI Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.10 (FreeBSD) iEYEARECAAYFAkmqYckACgkQ/opHv/APuIfhEACeLnzFTAqZ08ZtxxjkwG9NlKwk 59QAn3QcHit479xDqELEwZL13E5giUf8 =jIoV -----END PGP SIGNATURE----- --xesSdrSSBC0PokLI-- From owner-svn-src-head@FreeBSD.ORG Sun Mar 1 14:44: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 E7CB1106564A; Sun, 1 Mar 2009 14:44:03 +0000 (UTC) (envelope-from sos@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D75DC8FC16; Sun, 1 Mar 2009 14:44:03 +0000 (UTC) (envelope-from sos@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 n21Ei3Ap046017; Sun, 1 Mar 2009 14:44:03 GMT (envelope-from sos@svn.freebsd.org) Received: (from sos@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n21Ei3Ma046016; Sun, 1 Mar 2009 14:44:03 GMT (envelope-from sos@svn.freebsd.org) Message-Id: <200903011444.n21Ei3Ma046016@svn.freebsd.org> From: Søren Schmidt Date: Sun, 1 Mar 2009 14:44:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r189233 - 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: Sun, 01 Mar 2009 14:44:04 -0000 Author: sos Date: Sun Mar 1 14:44:03 2009 New Revision: 189233 URL: http://svn.freebsd.org/changeset/base/189233 Log: Remove self. Modified: head/MAINTAINERS Modified: head/MAINTAINERS ============================================================================== --- head/MAINTAINERS Sun Mar 1 14:26:24 2009 (r189232) +++ head/MAINTAINERS Sun Mar 1 14:44:03 2009 (r189233) @@ -29,7 +29,6 @@ MAC Framework rwatson Pre-commit review MAC Modules rwatson Pre-commit review requested. contrib/openbsm rwatson Pre-commit review requested. sys/security/audit rwatson Pre-commit review requested. -ATA/IDE sos Pre-commit review requested. ahc(4) gibbs Pre-commit review requested. ahd(4) gibbs Pre-commit review requested. NEWCARD imp Pre-commit review requested. From owner-svn-src-head@FreeBSD.ORG Sun Mar 1 14:51:07 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 F0063106566C; Sun, 1 Mar 2009 14:51:07 +0000 (UTC) (envelope-from luigi@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id DEF708FC13; Sun, 1 Mar 2009 14:51:07 +0000 (UTC) (envelope-from luigi@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 n21Ep7FD046243; Sun, 1 Mar 2009 14:51:07 GMT (envelope-from luigi@svn.freebsd.org) Received: (from luigi@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n21Ep7jE046242; Sun, 1 Mar 2009 14:51:07 GMT (envelope-from luigi@svn.freebsd.org) Message-Id: <200903011451.n21Ep7jE046242@svn.freebsd.org> From: Luigi Rizzo Date: Sun, 1 Mar 2009 14:51:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r189234 - head/release/picobsd/bridge 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, 01 Mar 2009 14:51:08 -0000 Author: luigi Date: Sun Mar 1 14:51:07 2009 New Revision: 189234 URL: http://svn.freebsd.org/changeset/base/189234 Log: remove duplicate entries for isa and npx, they are in by default now Modified: head/release/picobsd/bridge/PICOBSD Modified: head/release/picobsd/bridge/PICOBSD ============================================================================== --- head/release/picobsd/bridge/PICOBSD Sun Mar 1 14:44:03 2009 (r189233) +++ head/release/picobsd/bridge/PICOBSD Sun Mar 1 14:51:07 2009 (r189234) @@ -45,7 +45,6 @@ options DUMMYNET device if_bridge options HZ=1000 -device isa device pci # Floppy drives @@ -68,9 +67,6 @@ device vga # VGA screen device sc -# Floating point support - do not disable. -device npx - # Serial (COM) ports device uart From owner-svn-src-head@FreeBSD.ORG Sun Mar 1 16:47: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 DD0471065678; Sun, 1 Mar 2009 16:47:49 +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 C99BF8FC1A; Sun, 1 Mar 2009 16:47:49 +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 n21GlnWB049102; Sun, 1 Mar 2009 16:47:49 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n21GlnAQ049101; Sun, 1 Mar 2009 16:47:49 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <200903011647.n21GlnAQ049101@svn.freebsd.org> From: Alexander Motin Date: Sun, 1 Mar 2009 16:47:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r189245 - 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: Sun, 01 Mar 2009 16:47:50 -0000 Author: mav Date: Sun Mar 1 16:47:49 2009 New Revision: 189245 URL: http://svn.freebsd.org/changeset/base/189245 Log: Comment out enabling FIS Based Switching inside ata_ahci_issue_cmd() as it done in other places. Until we have no support for command queueing we have no any benefit from FBS, while enabling it only here somehow leads to "port not ready" errors on Intel 63XXESB2 controller. Tested by: Larry Rosenman 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 Sun Mar 1 16:43:45 2009 (r189244) +++ head/sys/dev/ata/chipsets/ata-ahci.c Sun Mar 1 16:47:49 2009 (r189245) @@ -470,7 +470,7 @@ ata_ahci_issue_cmd(device_t dev, u_int16 clp->cmd_table_phys = htole64(ch->dma.work_bus + ATA_AHCI_CT_OFFSET); /* set PM port */ - ATA_OUTL(ctlr->r_res2, ATA_AHCI_P_FBS + offset, (port << 8) | 0x00000001); + //ATA_OUTL(ctlr->r_res2, ATA_AHCI_P_FBS + offset, (port << 8) | 0x00000001); /* issue command to controller */ ATA_OUTL(ctlr->r_res2, ATA_AHCI_P_CI + offset, 1); From owner-svn-src-head@FreeBSD.ORG Sun Mar 1 17:44: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 638361065672; Sun, 1 Mar 2009 17:44:31 +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 528208FC1B; Sun, 1 Mar 2009 17:44:31 +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 n21HiVPR050255; Sun, 1 Mar 2009 17:44:31 GMT (envelope-from ed@svn.freebsd.org) Received: (from ed@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n21HiV7a050254; Sun, 1 Mar 2009 17:44:31 GMT (envelope-from ed@svn.freebsd.org) Message-Id: <200903011744.n21HiV7a050254@svn.freebsd.org> From: Ed Schouten Date: Sun, 1 Mar 2009 17:44:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r189247 - 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: Sun, 01 Mar 2009 17:44:31 -0000 Author: ed Date: Sun Mar 1 17:44:31 2009 New Revision: 189247 URL: http://svn.freebsd.org/changeset/base/189247 Log: Hide __restrict from lint, just like we do with other keywords. Unlike GCC, LLVM defines __STDC_VERSION__ to 199901L by default. This means `restrict' keywords in files end up being given to lint, which results in errors during compilation of usr.bin/xlint. Other keywords are also expanded to nothing when using lint, so do the same with restrict. Modified: head/sys/sys/cdefs.h Modified: head/sys/sys/cdefs.h ============================================================================== --- head/sys/sys/cdefs.h Sun Mar 1 16:50:46 2009 (r189246) +++ head/sys/sys/cdefs.h Sun Mar 1 17:44:31 2009 (r189247) @@ -268,7 +268,7 @@ * software that is unaware of C99 keywords. */ #if !(__GNUC__ == 2 && __GNUC_MINOR__ == 95) -#if !defined(__STDC_VERSION__) || __STDC_VERSION__ < 199901 +#if !defined(__STDC_VERSION__) || __STDC_VERSION__ < 199901 || defined(lint) #define __restrict #else #define __restrict restrict From owner-svn-src-head@FreeBSD.ORG Sun Mar 1 18:57: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 EDC601065670; Sun, 1 Mar 2009 18:57:59 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id DC3E48FC15; Sun, 1 Mar 2009 18:57:59 +0000 (UTC) (envelope-from imp@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 n21Ivxvm051644; Sun, 1 Mar 2009 18:57:59 GMT (envelope-from imp@svn.freebsd.org) Received: (from imp@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n21IvxIA051643; Sun, 1 Mar 2009 18:57:59 GMT (envelope-from imp@svn.freebsd.org) Message-Id: <200903011857.n21IvxIA051643@svn.freebsd.org> From: Warner Losh Date: Sun, 1 Mar 2009 18:57: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: r189248 - 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: Sun, 01 Mar 2009 18:58:00 -0000 Author: imp Date: Sun Mar 1 18:57:59 2009 New Revision: 189248 URL: http://svn.freebsd.org/changeset/base/189248 Log: Add verbage about needing to remap libusb-0.1 to libusb20 to get old programs to work with the new usb stack. Modified: head/UPDATING Modified: head/UPDATING ============================================================================== --- head/UPDATING Sun Mar 1 17:44:31 2009 (r189247) +++ head/UPDATING Sun Mar 1 18:57:59 2009 (r189248) @@ -35,7 +35,8 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 8. module names reverted to their previous values (eg, usb, ehci, ohci, ums, ...). The old usb stack can be compiled in by prefixing the name with the letter 'o', the old usb modules have been removed. - Updating entry 20090216 for xorg may still apply. + Updating entry 20090216 for xorg and 20090215 for libmap may still + apply. 20090217: The rc.conf(5) option if_up_delay has been renamed to @@ -59,6 +60,12 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 8. that includes GENERIC then ensure that usb names are also changed over, eg uftdi -> usb2_serial_ftdi. + Older programs linked against the ports libusb 0.1 need to be + redirected to the new stack's libusb20. /etc/libmap.conf can + be used for this: + # Map old usb library to new one for usb2 stack + libusb-0.1.so.8 libusb20.so.1 + 20090203: The ichsmb(4) driver has been changed to require SMBus slave addresses be left-justified (xxxxxxx0b) rather than right-justified. From owner-svn-src-head@FreeBSD.ORG Sun Mar 1 19:04: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 D8D00106564A; Sun, 1 Mar 2009 19:04:04 +0000 (UTC) (envelope-from thompsa@FreeBSD.org) Received: from pele.citylink.co.nz (pele.citylink.co.nz [202.8.44.226]) by mx1.freebsd.org (Postfix) with ESMTP id 9827A8FC1B; Sun, 1 Mar 2009 19:04:04 +0000 (UTC) (envelope-from thompsa@FreeBSD.org) Received: from localhost (localhost [127.0.0.1]) by pele.citylink.co.nz (Postfix) with ESMTP id EAB33FF96; Mon, 2 Mar 2009 08:04:03 +1300 (NZDT) X-Virus-Scanned: Debian amavisd-new at citylink.co.nz Received: from pele.citylink.co.nz ([127.0.0.1]) by localhost (pele.citylink.co.nz [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id zJB4Q3f-rQ9G; Mon, 2 Mar 2009 08:03:59 +1300 (NZDT) Received: from citylink.fud.org.nz (unknown [202.8.44.45]) by pele.citylink.co.nz (Postfix) with ESMTP; Mon, 2 Mar 2009 08:03:59 +1300 (NZDT) Received: by citylink.fud.org.nz (Postfix, from userid 1001) id 45AF31142F; Mon, 2 Mar 2009 08:03:59 +1300 (NZDT) Date: Sun, 1 Mar 2009 11:03:59 -0800 From: Andrew Thompson To: Warner Losh Message-ID: <20090301190359.GA56939@citylink.fud.org.nz> References: <200903011857.n21IvxIA051643@svn.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <200903011857.n21IvxIA051643@svn.freebsd.org> User-Agent: Mutt/1.5.17 (2007-11-01) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r189248 - 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: Sun, 01 Mar 2009 19:04:05 -0000 On Sun, Mar 01, 2009 at 06:57:59PM +0000, Warner Losh wrote: > Author: imp > Date: Sun Mar 1 18:57:59 2009 > New Revision: 189248 > URL: http://svn.freebsd.org/changeset/base/189248 > > Log: > Add verbage about needing to remap libusb-0.1 to libusb20 to get old > programs to work with the new usb stack. FWIW stass is working on getting libusb foo put in the ports build at which stage there will be a proper symlink from libusb-0.1 to libusb20. Andrew From owner-svn-src-head@FreeBSD.ORG Sun Mar 1 19:25:40 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 8A46F1065785; Sun, 1 Mar 2009 19:25:40 +0000 (UTC) (envelope-from das@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 774F58FC0A; Sun, 1 Mar 2009 19:25:40 +0000 (UTC) (envelope-from das@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 n21JPe5n052224; Sun, 1 Mar 2009 19:25:40 GMT (envelope-from das@svn.freebsd.org) Received: (from das@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n21JPeLP052223; Sun, 1 Mar 2009 19:25:40 GMT (envelope-from das@svn.freebsd.org) Message-Id: <200903011925.n21JPeLP052223@svn.freebsd.org> From: David Schultz Date: Sun, 1 Mar 2009 19:25:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r189249 - head/lib/libc/stdio 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, 01 Mar 2009 19:25:41 -0000 Author: das Date: Sun Mar 1 19:25:40 2009 New Revision: 189249 URL: http://svn.freebsd.org/changeset/base/189249 Log: Use C99-style initializers. No functional change. Reviewed by: md5(1) Modified: head/lib/libc/stdio/findfp.c Modified: head/lib/libc/stdio/findfp.c ============================================================================== --- head/lib/libc/stdio/findfp.c Sun Mar 1 18:57:59 2009 (r189248) +++ head/lib/libc/stdio/findfp.c Sun Mar 1 19:25:40 2009 (r189249) @@ -53,10 +53,15 @@ int __sdidinit; #define NDYNAMIC 10 /* add ten more whenever necessary */ -#define std(flags, file) \ - {0,0,0,flags,file,{0},0,__sF+file,__sclose,__sread,__sseek,__swrite} - /* p r w flags file _bf z cookie close read seek write */ - +#define std(flags, file) { \ + ._flags = (flags), \ + ._file = (file), \ + ._cookie = __sF + (file), \ + ._close = __sclose, \ + ._read = __sread, \ + ._seek = __sseek, \ + ._write = __swrite, \ +} /* the usual - (stdin + stdout + stderr) */ static FILE usual[FOPEN_MAX - 3]; static struct glue uglue = { NULL, FOPEN_MAX - 3, usual }; From owner-svn-src-head@FreeBSD.ORG Sun Mar 1 20:22: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 B19D4106566B; Sun, 1 Mar 2009 20:22:30 +0000 (UTC) (envelope-from imp@bsdimp.com) Received: from harmony.bsdimp.com (bsdimp.com [199.45.160.85]) by mx1.freebsd.org (Postfix) with ESMTP id 47ED88FC12; Sun, 1 Mar 2009 20:22:30 +0000 (UTC) (envelope-from imp@bsdimp.com) Received: from localhost (localhost [127.0.0.1]) by harmony.bsdimp.com (8.14.2/8.14.1) with ESMTP id n21KJG10005195; Sun, 1 Mar 2009 13:19:16 -0700 (MST) (envelope-from imp@bsdimp.com) Date: Sun, 01 Mar 2009 13:19:37 -0700 (MST) Message-Id: <20090301.131937.1408561035.imp@bsdimp.com> To: thompsa@freebsd.org From: "M. Warner Losh" In-Reply-To: <20090301190359.GA56939@citylink.fud.org.nz> References: <200903011857.n21IvxIA051643@svn.freebsd.org> <20090301190359.GA56939@citylink.fud.org.nz> X-Mailer: Mew version 5.2 on Emacs 21.3 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r189248 - 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: Sun, 01 Mar 2009 20:22:31 -0000 In message: <20090301190359.GA56939@citylink.fud.org.nz> Andrew Thompson writes: : On Sun, Mar 01, 2009 at 06:57:59PM +0000, Warner Losh wrote: : > Author: imp : > Date: Sun Mar 1 18:57:59 2009 : > New Revision: 189248 : > URL: http://svn.freebsd.org/changeset/base/189248 : > : > Log: : > Add verbage about needing to remap libusb-0.1 to libusb20 to get old : > programs to work with the new usb stack. : : FWIW stass is working on getting libusb foo put in the ports build at : which stage there will be a proper symlink from libusb-0.1 to libusb20. Excellent! In the mean time, users will be able to use this hint... Warner From owner-svn-src-head@FreeBSD.ORG Sun Mar 1 22:50:14 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 B7D17106566C; Sun, 1 Mar 2009 22:50:14 +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 A621C8FC15; Sun, 1 Mar 2009 22:50:14 +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 n21MoELL056708; Sun, 1 Mar 2009 22:50:14 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n21MoEuK056707; Sun, 1 Mar 2009 22:50:14 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <200903012250.n21MoEuK056707@svn.freebsd.org> From: Alexander Motin Date: Sun, 1 Mar 2009 22:50: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: r189256 - 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: Sun, 01 Mar 2009 22:50:15 -0000 Author: mav Date: Sun Mar 1 22:50:14 2009 New Revision: 189256 URL: http://svn.freebsd.org/changeset/base/189256 Log: Give controller a chance to issue Soft Reset clear command before checking ready status. Most of controllers managed to issue coommand and set BUSY bit almost simultaneously, before we will read it, but at least JMicron JMB363 don't. Ignore timeout errors to keep old behavior when error there was impossible. For me this fixes timeout errors on the first command after channel attach or reinit. Boot in my case is not affected, as there is much time passing between reset and next command giving reset time to complete. 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 Sun Mar 1 22:48:18 2009 (r189255) +++ head/sys/dev/ata/chipsets/ata-ahci.c Sun Mar 1 22:50:14 2009 (r189256) @@ -683,8 +683,7 @@ ata_ahci_softreset(device_t dev, int por ctp->cfis[1] = port & 0x0f; //ctp->cfis[7] = ATA_D_LBA | ATA_D_IBM; ctp->cfis[15] = ATA_A_4BIT; - if (ata_ahci_issue_cmd(dev, 0, 0)) - return -1; + ata_ahci_issue_cmd(dev, 0, 1000); if (ata_ahci_wait_ready(dev, 1000)) { device_printf(dev, "software reset clear timeout\n"); From owner-svn-src-head@FreeBSD.ORG Sun Mar 1 22:52: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 8553F106566B; Sun, 1 Mar 2009 22:52:41 +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 59D1D8FC17; Sun, 1 Mar 2009 22:52:41 +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 n21MqfL2057029; Sun, 1 Mar 2009 22:52:41 GMT (envelope-from sam@svn.freebsd.org) Received: (from sam@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n21Mqfr5057028; Sun, 1 Mar 2009 22:52:41 GMT (envelope-from sam@svn.freebsd.org) Message-Id: <200903012252.n21Mqfr5057028@svn.freebsd.org> From: Sam Leffler Date: Sun, 1 Mar 2009 22:52: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: r189257 - head/contrib/wpa 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, 01 Mar 2009 22:52:42 -0000 Author: sam Date: Sun Mar 1 22:52:41 2009 New Revision: 189257 URL: http://svn.freebsd.org/changeset/base/189257 Log: add new combined wpa_supplicant+hostapd tree Added: head/contrib/wpa/ (props changed) From owner-svn-src-head@FreeBSD.ORG Mon Mar 2 02:22: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 159E21065670; Mon, 2 Mar 2009 02:22: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 DDF428FC19; Mon, 2 Mar 2009 02:22:49 +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 n222Mn0F061694; Mon, 2 Mar 2009 02:22:49 GMT (envelope-from sam@svn.freebsd.org) Received: (from sam@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n222MnTD061693; Mon, 2 Mar 2009 02:22:49 GMT (envelope-from sam@svn.freebsd.org) Message-Id: <200903020222.n222MnTD061693@svn.freebsd.org> From: Sam Leffler Date: Mon, 2 Mar 2009 02:22:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r189260 - head/contrib/wpa 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, 02 Mar 2009 02:22:50 -0000 Author: sam Date: Mon Mar 2 02:22:49 2009 New Revision: 189260 URL: http://svn.freebsd.org/changeset/base/189260 Log: remove Deleted: head/contrib/wpa/ From owner-svn-src-head@FreeBSD.ORG Mon Mar 2 02:23:47 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 A69CD1065674; Mon, 2 Mar 2009 02:23:47 +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 7BD558FC15; Mon, 2 Mar 2009 02:23:47 +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 n222NlEP061748; Mon, 2 Mar 2009 02:23:47 GMT (envelope-from sam@svn.freebsd.org) Received: (from sam@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n222Nl8n061747; Mon, 2 Mar 2009 02:23:47 GMT (envelope-from sam@svn.freebsd.org) Message-Id: <200903020223.n222Nl8n061747@svn.freebsd.org> From: Sam Leffler Date: Mon, 2 Mar 2009 02:23: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: r189261 - head/contrib/wpa 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, 02 Mar 2009 02:23:48 -0000 Author: sam Date: Mon Mar 2 02:23:47 2009 New Revision: 189261 URL: http://svn.freebsd.org/changeset/base/189261 Log: connect vendor wpa area to contrib Added: head/contrib/wpa/ - copied from r189260, vendor/wpa/dist/ From owner-svn-src-head@FreeBSD.ORG Mon Mar 2 02:26: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 A40C810656C7; Mon, 2 Mar 2009 02:26:53 +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 916208FC13; Mon, 2 Mar 2009 02:26:53 +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 n222QriI061857; Mon, 2 Mar 2009 02:26:53 GMT (envelope-from sam@svn.freebsd.org) Received: (from sam@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n222QrYe061851; Mon, 2 Mar 2009 02:26:53 GMT (envelope-from sam@svn.freebsd.org) Message-Id: <200903020226.n222QrYe061851@svn.freebsd.org> From: Sam Leffler Date: Mon, 2 Mar 2009 02:26: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: r189262 - in head/contrib/wpa: hostapd src/utils wpa_supplicant 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, 02 Mar 2009 02:26:54 -0000 Author: sam Date: Mon Mar 2 02:26:53 2009 New Revision: 189262 URL: http://svn.freebsd.org/changeset/base/189262 Log: bring in local changes for: CONFIG_DEBUG_SYSLOG CONFIG_TERMINATE_ONLASTIF EAP_SERVER Modified: head/contrib/wpa/hostapd/hostapd.c head/contrib/wpa/src/utils/wpa_debug.c head/contrib/wpa/wpa_supplicant/events.c head/contrib/wpa/wpa_supplicant/main.c head/contrib/wpa/wpa_supplicant/wpa_supplicant.c head/contrib/wpa/wpa_supplicant/wpa_supplicant_i.h Modified: head/contrib/wpa/hostapd/hostapd.c ============================================================================== --- head/contrib/wpa/hostapd/hostapd.c Mon Mar 2 02:23:47 2009 (r189261) +++ head/contrib/wpa/hostapd/hostapd.c Mon Mar 2 02:26:53 2009 (r189262) @@ -1910,10 +1910,12 @@ int main(int argc, char *argv[]) if (optind == argc) usage(); +#ifdef EAP_SERVER if (eap_server_register_methods()) { wpa_printf(MSG_ERROR, "Failed to register EAP methods"); return -1; } +#endif /* EAP_SERVER */ interfaces.count = argc - optind; @@ -2019,7 +2021,9 @@ int main(int argc, char *argv[]) closelog(); #endif /* CONFIG_NATIVE_WINDOWS */ +#ifdef EAP_SERVER eap_server_unregister_methods(); +#endif /* EAP_SERVER */ os_daemonize_terminate(pid_file); Modified: head/contrib/wpa/src/utils/wpa_debug.c ============================================================================== --- head/contrib/wpa/src/utils/wpa_debug.c Mon Mar 2 02:23:47 2009 (r189261) +++ head/contrib/wpa/src/utils/wpa_debug.c Mon Mar 2 02:26:53 2009 (r189262) @@ -16,6 +16,10 @@ #include "common.h" +#ifdef CONFIG_DEBUG_SYSLOG +#include +#endif /* CONFIG_DEBUG_SYSLOG */ + #ifdef CONFIG_DEBUG_FILE static FILE *out_file = NULL; @@ -23,6 +27,7 @@ static FILE *out_file = NULL; int wpa_debug_level = MSG_INFO; int wpa_debug_show_keys = 0; int wpa_debug_timestamp = 0; +int wpa_debug_syslog = 0; #ifndef CONFIG_NO_STDOUT_DEBUG @@ -44,6 +49,40 @@ void wpa_debug_print_timestamp(void) printf("%ld.%06u: ", (long) tv.sec, (unsigned int) tv.usec); } +void wpa_debug_open_syslog(void) +{ +#ifdef CONFIG_DEBUG_SYSLOG + openlog("wpa_supplicant", LOG_PID | LOG_NDELAY, LOG_DAEMON); + wpa_debug_syslog++; +#endif +} + +void wpa_debug_close_syslog(void) +{ +#ifdef CONFIG_DEBUG_SYSLOG + if (wpa_debug_syslog) + closelog(); +#endif +} + +#ifdef CONFIG_DEBUG_SYSLOG +static int syslog_priority(int level) +{ + switch (level) { + case MSG_MSGDUMP: + case MSG_DEBUG: + return LOG_DEBUG; + case MSG_INFO: + return LOG_NOTICE; + case MSG_WARNING: + return LOG_WARNING; + case MSG_ERROR: + return LOG_ERR; + } + return LOG_INFO; +} +#endif /* CONFIG_DEBUG_SYSLOG */ + /** * wpa_printf - conditional printf @@ -62,6 +101,11 @@ void wpa_printf(int level, char *fmt, .. va_start(ap, fmt); if (level >= wpa_debug_level) { +#ifdef CONFIG_DEBUG_SYSLOG + if (wpa_debug_syslog) { + vsyslog(syslog_priority(level), fmt, ap); + } else { +#endif /* CONFIG_DEBUG_SYSLOG */ wpa_debug_print_timestamp(); #ifdef CONFIG_DEBUG_FILE if (out_file) { @@ -74,6 +118,9 @@ void wpa_printf(int level, char *fmt, .. #ifdef CONFIG_DEBUG_FILE } #endif /* CONFIG_DEBUG_FILE */ +#ifdef CONFIG_DEBUG_SYSLOG + } +#endif /* CONFIG_DEBUG_SYSLOG */ } va_end(ap); } Modified: head/contrib/wpa/wpa_supplicant/events.c ============================================================================== --- head/contrib/wpa/wpa_supplicant/events.c Mon Mar 2 02:23:47 2009 (r189261) +++ head/contrib/wpa/wpa_supplicant/events.c Mon Mar 2 02:26:53 2009 (r189262) @@ -1011,6 +1011,18 @@ wpa_supplicant_event_michael_mic_failure } +#ifdef CONFIG_TERMINATE_ONLASTIF +static int any_interfaces(struct wpa_supplicant *head) +{ + struct wpa_supplicant *wpa_s; + + for (wpa_s = head; wpa_s != NULL; wpa_s = wpa_s->next) + if (!wpa_s->interface_removed) + return 1; + return 0; +} +#endif /* CONFIG_TERMINATE_ONLASTIF */ + static void wpa_supplicant_event_interface_status(struct wpa_supplicant *wpa_s, union wpa_event_data *data) @@ -1035,6 +1047,11 @@ wpa_supplicant_event_interface_status(st wpa_supplicant_mark_disassoc(wpa_s); l2_packet_deinit(wpa_s->l2); wpa_s->l2 = NULL; +#ifdef CONFIG_TERMINATE_ONLASTIF + /* check if last interface */ + if (!any_interfaces(wpa_s->global->ifaces)) + eloop_terminate(); +#endif /* CONFIG_TERMINATE_ONLASTIF */ break; } } Modified: head/contrib/wpa/wpa_supplicant/main.c ============================================================================== --- head/contrib/wpa/wpa_supplicant/main.c Mon Mar 2 02:23:47 2009 (r189261) +++ head/contrib/wpa/wpa_supplicant/main.c Mon Mar 2 02:26:53 2009 (r189262) @@ -26,11 +26,23 @@ static void usage(void) int i; printf("%s\n\n%s\n" "usage:\n" - " wpa_supplicant [-BddhKLqqtuvW] [-P] " + " wpa_supplicant [-BddhKLqq" +#ifdef CONFIG_DEBUG_SYSLOG + "s" +#endif /* CONFIG_DEBUG_SYSLOG */ + "t" +#ifdef CONFIG_CTRL_IFACE_DBUS + "u" +#endif /* CONFIG_CTRL_IFACE_DBUS */ + "vW] [-P] " "[-g] \\\n" " -i -c [-C] [-D] " "[-p] \\\n" - " [-b] [-f] \\\n" + " [-b]" +#ifdef CONFIG_DEBUG_FILE + " [-f]" +#endif /* CONFIG_DEBUG_FILE */ + " \\\n" " [-N -i -c [-C] " "[-D] \\\n" " [-p] [-b] ...]\n" @@ -58,6 +70,9 @@ static void usage(void) #endif /* CONFIG_DEBUG_FILE */ " -g = global ctrl_interface\n" " -K = include keys (passwords, etc.) in debug output\n" +#ifdef CONFIG_DEBUG_SYSLOG + " -s = log output to syslog instead of stdout\n" +#endif /* CONFIG_DEBUG_SYSLOG */ " -t = include timestamp in debug messages\n" " -h = show this help text\n" " -L = show license (GPL and BSD)\n"); @@ -72,7 +87,9 @@ static void usage(void) " -N = start describing new interface\n"); printf("example:\n" - " wpa_supplicant -Dwext -iwlan0 -c/etc/wpa_supplicant.conf\n"); + " wpa_supplicant -D%s -iwlan0 -c/etc/wpa_supplicant.conf\n", + wpa_supplicant_drivers[i] ? + wpa_supplicant_drivers[i]->name : "wext"); #endif /* CONFIG_NO_STDOUT_DEBUG */ } @@ -133,7 +150,7 @@ int main(int argc, char *argv[]) wpa_supplicant_fd_workaround(); for (;;) { - c = getopt(argc, argv, "b:Bc:C:D:df:g:hi:KLNp:P:qtuvW"); + c = getopt(argc, argv, "b:Bc:C:D:df:g:hi:KLNp:P:qstuvW"); if (c < 0) break; switch (c) { @@ -194,6 +211,11 @@ int main(int argc, char *argv[]) case 'q': params.wpa_debug_level++; break; +#ifdef CONFIG_DEBUG_SYSLOG + case 's': + params.wpa_debug_syslog++; + break; +#endif /* CONFIG_DEBUG_SYSLOG */ case 't': params.wpa_debug_timestamp++; break; Modified: head/contrib/wpa/wpa_supplicant/wpa_supplicant.c ============================================================================== --- head/contrib/wpa/wpa_supplicant/wpa_supplicant.c Mon Mar 2 02:23:47 2009 (r189261) +++ head/contrib/wpa/wpa_supplicant/wpa_supplicant.c Mon Mar 2 02:26:53 2009 (r189262) @@ -2016,6 +2016,8 @@ struct wpa_global * wpa_supplicant_init( return NULL; wpa_debug_open_file(params->wpa_debug_file_path); + if (params->wpa_debug_syslog) + wpa_debug_open_syslog(); ret = eap_peer_register_methods(); if (ret) { @@ -2166,5 +2168,6 @@ void wpa_supplicant_deinit(struct wpa_gl os_free(global->params.ctrl_interface); os_free(global); + wpa_debug_close_syslog(); wpa_debug_close_file(); } Modified: head/contrib/wpa/wpa_supplicant/wpa_supplicant_i.h ============================================================================== --- head/contrib/wpa/wpa_supplicant/wpa_supplicant_i.h Mon Mar 2 02:23:47 2009 (r189261) +++ head/contrib/wpa/wpa_supplicant/wpa_supplicant_i.h Mon Mar 2 02:26:53 2009 (r189262) @@ -156,6 +156,11 @@ struct wpa_params { * wpa_debug_file_path - Path of debug file or %NULL to use stdout */ const char *wpa_debug_file_path; + + /** + * wpa_debug_syslog - Enable log output through syslog + */ + const char *wpa_debug_syslog; }; /** From owner-svn-src-head@FreeBSD.ORG Mon Mar 2 02:28: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 A7B88106566B; Mon, 2 Mar 2009 02:28:22 +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 947238FC0A; Mon, 2 Mar 2009 02:28:22 +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 n222SMWf061927; Mon, 2 Mar 2009 02:28:22 GMT (envelope-from sam@svn.freebsd.org) Received: (from sam@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n222SMD1061919; Mon, 2 Mar 2009 02:28:22 GMT (envelope-from sam@svn.freebsd.org) Message-Id: <200903020228.n222SMD1061919@svn.freebsd.org> From: Sam Leffler Date: Mon, 2 Mar 2009 02:28: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: r189263 - in head/usr.sbin/wpa: . hostapd hostapd_cli wpa_cli wpa_supplicant 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, 02 Mar 2009 02:28:23 -0000 Author: sam Date: Mon Mar 2 02:28:22 2009 New Revision: 189263 URL: http://svn.freebsd.org/changeset/base/189263 Log: update to 0.6.8 Reviewed by: thompsa Modified: head/usr.sbin/wpa/Makefile.inc head/usr.sbin/wpa/hostapd/Makefile head/usr.sbin/wpa/hostapd/driver_freebsd.c head/usr.sbin/wpa/hostapd_cli/Makefile head/usr.sbin/wpa/wpa_cli/Makefile head/usr.sbin/wpa/wpa_supplicant/Makefile head/usr.sbin/wpa/wpa_supplicant/driver_freebsd.c head/usr.sbin/wpa/wpa_supplicant/driver_wired.c Modified: head/usr.sbin/wpa/Makefile.inc ============================================================================== --- head/usr.sbin/wpa/Makefile.inc Mon Mar 2 02:26:53 2009 (r189262) +++ head/usr.sbin/wpa/Makefile.inc Mon Mar 2 02:28:22 2009 (r189263) @@ -1,3 +1,27 @@ # $FreeBSD$ BINDIR?= /usr/sbin + +WPA_DISTDIR?= ${.CURDIR}/../../../contrib/wpa/ +WPA_SUPPLICANT_DISTDIR?=${WPA_DISTDIR}/wpa_supplicant +HOSTAPD_DISTDIR?= ${WPA_DISTDIR}/hostapd + +.PATH.c:${.CURDIR}/.. \ + ${WPA_DISTDIR}/src/common \ + ${WPA_DISTDIR}/src/crypto \ + ${WPA_DISTDIR}/src/eap_common \ + ${WPA_DISTDIR}/src/eapol_supp \ + ${WPA_DISTDIR}/src/l2_packet \ + ${WPA_DISTDIR}/src/utils + +CFLAGS+=-I${.CURDIR} +CFLAGS+=-I${WPA_DISTDIR}/src +CFLAGS+=-I${WPA_DISTDIR}/src/common +CFLAGS+=-I${WPA_DISTDIR}/src/crypto +CFLAGS+=-I${WPA_DISTDIR}/src/l2_packet +CFLAGS+=-I${WPA_DISTDIR}/src/utils + +CFLAGS+= -DCONFIG_CTRL_IFACE +CFLAGS+= -DCONFIG_CTRL_IFACE_UNIX + +.include Modified: head/usr.sbin/wpa/hostapd/Makefile ============================================================================== --- head/usr.sbin/wpa/hostapd/Makefile Mon Mar 2 02:26:53 2009 (r189262) +++ head/usr.sbin/wpa/hostapd/Makefile Mon Mar 2 02:28:22 2009 (r189263) @@ -1,30 +1,32 @@ # $FreeBSD$ -.include +.include "${.CURDIR}/../Makefile.inc" -HOSTAPD_DISTDIR?= ${.CURDIR}/../../../contrib/hostapd -.PATH: ${.CURDIR}/.. ${HOSTAPD_DISTDIR} +.PATH.c:${HOSTAPD_DISTDIR} \ + ${WPA_DISTDIR}/src/eap_server \ + ${WPA_DISTDIR}/src/radius \ PROG= hostapd -SRCS= hostapd.c eloop.c ieee802_1x.c eapol_sm.c radius.c md5.c rc4.c \ - common.c ieee802_11.c config.c ieee802_11_auth.c accounting.c \ - sta_info.c radius_client.c sha1.c wpa.c aes_wrap.c ctrl_iface.c \ - driver_conf.c os_unix.c preauth.c pmksa_cache.c beacon.c \ - hw_features.c wme.c ap_list.c reconfig.c mlme.c \ - vlan_init.c ieee802_11h.c l2_packet.c driver_freebsd.c -CLEANFILES=driver_conf.c +SRCS= accounting.c aes.c aes_wrap.c ap_list.c beacon.c common.c \ + config.c ctrl_iface.c drivers.c eapol_sm.c eap.c eap_common.c \ + eap_identity.c eap_methods.c eloop.c hostapd.c \ + hw_features.c ieee802_11.c ieee802_11_common.c ieee802_11_auth.c \ + ieee802_1x.c ip_addr.c md5.c mlme.c pmksa_cache.c radius.c \ + radius_client.c rc4.c sha1.c sta_info.c vlan_init.c wme.c \ + wpa.c wpa_auth_ie.c wpa_common.c wpa_debug.c wpabuf.c +SRCS+= l2_packet.c driver_freebsd.c os_unix.c MAN= hostapd.8 hostapd.conf.5 .if ${MK_EXAMPLES} != "no" FILESDIR= ${SHAREDIR}/examples/hostapd +.PATH: ${HOSTAPD_DISTDIR} FILES= hostapd.conf hostapd.eap_user hostapd.wpa_psk .endif -CFLAGS+= -I${.CURDIR} -I${HOSTAPD_DISTDIR} +CFLAGS+= -I${HOSTAPD_DISTDIR} + CFLAGS+= -DCONFIG_DRIVER_BSD -CFLAGS+= -DCONFIG_CTRL_IFACE -CFLAGS+= -DCONFIG_CTRL_IFACE_UNIX CFLAGS+= -DCONFIG_DRIVER_RADIUS_ACL .if ${MK_INET6} != "no" CFLAGS+= -DCONFIG_IPV6 @@ -34,21 +36,22 @@ DPADD+= ${LIBPCAP} LDADD+= -lpcap # User customizations for wpa_supplicant/hostapd build environment -CFLAGS+=${WPA_SUPPLICANT_CFLAGS} -#DPADD+=${WPA_SUPPLICANT_DPADD} -LDADD+=${WPA_SUPPLICANT_LDADD} -#LDFLAGS+=${WPA_SUPPLICANT_LDFLAGS} +CFLAGS+=${HOSTAPD_CFLAGS} +#DPADD+=${HOSTAPD_DPADD} +LDADD+=${HOSTAPD_LDADD} +#LDFLAGS+=${HOSTAPD_LDFLAGS} .if !empty(CFLAGS:M*-DEAP_SERVER) -SRCS+= eap.c eap_methods.c eap_identity.c +#SRCS+= eap.c eap_methods.c eap_identity.c .if ${MK_OPENSSL} != "no" && !defined(RELEASE_CRUNCH) CFLAGS+=-DEAP_TLS -DEAP_PEAP -DEAP_MSCHAPv2 -DEAP_PSK \ - -DEAP_TLV -DEAP_TLS_FUNCS -DEAP_TLS_OPENSSL -SRCS+= eap_tls.c eap_peap.c eap_mschapv2.c \ + -DEAP_TLS_FUNCS -DEAP_TLS_OPENSSL +SRCS+= crypto_openssl.c +SRCS+= eap_tls.c eap_peap.c eap_peap_common.c eap_mschapv2.c \ eap_psk.c eap_psk_common.c \ - eap_tlv.c eap_tls_common.c tls_openssl.c ms_funcs.c crypto.c + eap_tls_common.c tls_openssl.c ms_funcs.c chap.c CFLAGS+=-DEAP_TTLS -DEAP_MD5 SRCS+= eap_ttls.c eap_md5.c @@ -108,19 +111,4 @@ CFLAGS+= -DINTERNAL_MD5 SRCS+= tls_none.c .endif -driver_conf.c: Makefile - rm -f driver_conf.c - echo '/* THIS FILE AUTOMATICALLY GENERATED, DO NOT EDIT! */' \ - > driver_conf.c - echo '#include ' >> driver_conf.c - echo '#include ' >> driver_conf.c - echo '#include ' >> driver_conf.c - echo '#include ' >> driver_conf.c - echo '#include "hostapd.h"' >> driver_conf.c - echo '#include "driver.h"' >> driver_conf.c - echo "void bsd_driver_register(void);" >> driver_conf.c - echo 'void register_drivers(void) {' >> driver_conf.c - echo "bsd_driver_register();" >> driver_conf.c - echo '}' >> driver_conf.c - .include Modified: head/usr.sbin/wpa/hostapd/driver_freebsd.c ============================================================================== --- head/usr.sbin/wpa/hostapd/driver_freebsd.c Mon Mar 2 02:26:53 2009 (r189262) +++ head/usr.sbin/wpa/hostapd/driver_freebsd.c Mon Mar 2 02:28:22 2009 (r189263) @@ -27,23 +27,27 @@ #include +#undef RSN_VERSION +#undef WPA_VERSION +#undef WPA_OUI_TYPE +#undef WME_OUI_TYPE + #include "hostapd.h" #include "driver.h" #include "ieee802_1x.h" #include "ieee802_11_auth.h" #include "eloop.h" #include "sta_info.h" -#include "l2_packet.h" +#include "l2_packet/l2_packet.h" #include "eapol_sm.h" #include "wpa.h" -#include "radius.h" +#include "radius/radius.h" #include "ieee802_11.h" #include "common.h" #include "hostap_common.h" struct bsd_driver_data { - struct driver_ops ops; /* base class */ struct hostapd_data *hapd; /* back pointer */ char iface[IFNAMSIZ + 1]; @@ -53,7 +57,7 @@ struct bsd_driver_data { int wext_sock; /* socket for wireless events */ }; -static const struct driver_ops bsd_driver_ops; +static const struct wpa_driver_ops bsd_driver_ops; static int bsd_sta_deauth(void *priv, const u8 *addr, int reason_code); @@ -129,7 +133,7 @@ bsd_set_iface_flags(void *priv, int flag struct hostapd_data *hapd = drv->hapd; struct ifreq ifr; - HOSTAPD_DEBUG(HOSTAPD_DEBUG_VERBOSE, "%s: flags=0x%x\n", __func__, flags); + wpa_printf(MSG_DEBUG, "%s: flags=0x%x\n", __func__, flags); if (drv->ioctl_sock < 0) return -1; @@ -185,8 +189,7 @@ bsd_set_ieee8021x(const char *ifname, vo struct hostapd_data *hapd = drv->hapd; struct hostapd_bss_config *conf = hapd->conf; - HOSTAPD_DEBUG(HOSTAPD_DEBUG_VERBOSE, - "%s: enabled=%d\n", __func__, enabled); + wpa_printf(MSG_DEBUG, "%s: enabled=%d\n", __func__, enabled); if (!enabled) { /* XXX restore state */ @@ -218,8 +221,7 @@ bsd_set_privacy(const char *ifname, void struct bsd_driver_data *drv = priv; struct hostapd_data *hapd = drv->hapd; - HOSTAPD_DEBUG(HOSTAPD_DEBUG_MINIMAL, - "%s: enabled=%d\n", __func__, enabled); + wpa_printf(MSG_DEBUG, "%s: enabled=%d\n", __func__, enabled); return set80211param(priv, IEEE80211_IOC_PRIVACY, enabled); } @@ -231,8 +233,7 @@ bsd_set_sta_authorized(void *priv, const struct hostapd_data *hapd = drv->hapd; struct ieee80211req_mlme mlme; - HOSTAPD_DEBUG(HOSTAPD_DEBUG_VERBOSE, - "%s: addr=%s authorized=%d\n", + wpa_printf(MSG_DEBUG, "%s: addr=%s authorized=%d\n", __func__, ether_sprintf(addr), authorized); if (authorized) @@ -245,7 +246,8 @@ bsd_set_sta_authorized(void *priv, const } static int -bsd_sta_set_flags(void *priv, const u8 *addr, int flags_or, int flags_and) +bsd_sta_set_flags(void *priv, const u8 *addr, int total_flags, + int flags_or, int flags_and) { /* For now, only support setting Authorized flag */ if (flags_or & WLAN_STA_AUTHORIZED) @@ -262,8 +264,7 @@ bsd_del_key(void *priv, const unsigned c struct hostapd_data *hapd = drv->hapd; struct ieee80211req_del_key wk; - HOSTAPD_DEBUG(HOSTAPD_DEBUG_MINIMAL, - "%s: addr=%s key_idx=%d\n", + wpa_printf(MSG_DEBUG, "%s: addr=%s key_idx=%d\n", __func__, ether_sprintf(addr), key_idx); memset(&wk, 0, sizeof(wk)); @@ -290,8 +291,7 @@ bsd_set_key(const char *ifname, void *pr if (strcmp(alg, "none") == 0) return bsd_del_key(priv, addr, key_idx); - HOSTAPD_DEBUG(HOSTAPD_DEBUG_MINIMAL, - "%s: alg=%s addr=%s key_idx=%d\n", + wpa_printf(MSG_DEBUG, "%s: alg=%s addr=%s key_idx=%d\n", __func__, alg, ether_sprintf(addr), key_idx); if (strcmp(alg, "WEP") == 0) @@ -339,8 +339,8 @@ bsd_get_seqnum(const char *ifname, void struct hostapd_data *hapd = drv->hapd; struct ieee80211req_key wk; - HOSTAPD_DEBUG(HOSTAPD_DEBUG_MINIMAL, - "%s: addr=%s idx=%d\n", __func__, ether_sprintf(addr), idx); + wpa_printf(MSG_DEBUG, "%s: addr=%s idx=%d\n", + __func__, ether_sprintf(addr), idx); memset(&wk, 0, sizeof(wk)); if (addr == NULL) @@ -396,8 +396,7 @@ bsd_sta_clear_stats(void *priv, const u8 struct hostapd_data *hapd = drv->hapd; struct ieee80211req_sta_stats stats; - HOSTAPD_DEBUG(HOSTAPD_DEBUG_MINIMAL, "%s: addr=%s\n", - __func__, ether_sprintf(addr)); + wpa_printf(MSG_DEBUG, "%s: addr=%s\n", __func__, ether_sprintf(addr)); /* zero station statistics */ memset(&stats, 0, sizeof(stats)); @@ -419,7 +418,7 @@ bsd_set_opt_ie(const char *ifname, void ireq.i_data = (void *) ie; ireq.i_len = ie_len; - HOSTAPD_DEBUG(HOSTAPD_DEBUG_MINIMAL, "%s: set WPA+RSN ie (len %d)\n", + wpa_printf(MSG_DEBUG, "%s: set WPA+RSN ie (len %d)\n", __func__, ie_len); if (ioctl(drv->ioctl_sock, SIOCS80211, &ireq) < 0) { printf("Unable to set WPA+RSN ie\n"); @@ -435,8 +434,7 @@ bsd_sta_deauth(void *priv, const u8 *add struct hostapd_data *hapd = drv->hapd; struct ieee80211req_mlme mlme; - HOSTAPD_DEBUG(HOSTAPD_DEBUG_MINIMAL, - "%s: addr=%s reason_code=%d\n", + wpa_printf(MSG_DEBUG, "%s: addr=%s reason_code=%d\n", __func__, ether_sprintf(addr), reason_code); mlme.im_op = IEEE80211_MLME_DEAUTH; @@ -452,8 +450,7 @@ bsd_sta_disassoc(void *priv, const u8 *a struct hostapd_data *hapd = drv->hapd; struct ieee80211req_mlme mlme; - HOSTAPD_DEBUG(HOSTAPD_DEBUG_MINIMAL, - "%s: addr=%s reason_code=%d\n", + wpa_printf(MSG_DEBUG, "%s: addr=%s reason_code=%d\n", __func__, ether_sprintf(addr), reason_code); mlme.im_reason = reason_code; @@ -521,7 +518,7 @@ bsd_new_sta(struct bsd_driver_data *drv, } ielen = 2 + ie.wpa_ie[1]; res = wpa_validate_wpa_ie(hapd->wpa_auth, sta->wpa_sm, - ie.wpa_ie, ielen); + ie.wpa_ie, ielen, NULL, 0); if (res != WPA_IE_OK) { printf("WPA/RSN information element rejected? " "(res %u)\n", res); @@ -742,8 +739,7 @@ bsd_get_ssid(const char *ifname, void *p struct hostapd_data *hapd = drv->hapd; int ssid_len = get80211var(priv, IEEE80211_IOC_SSID, buf, len); - HOSTAPD_DEBUG(HOSTAPD_DEBUG_MINIMAL, "%s: ssid=\"%.*s\"\n", - __func__, ssid_len, buf); + wpa_printf(MSG_DEBUG, "%s: ssid=\"%.*s\"\n", __func__, ssid_len, buf); return ssid_len; } @@ -754,8 +750,7 @@ bsd_set_ssid(const char *ifname, void *p struct bsd_driver_data *drv = priv; struct hostapd_data *hapd = drv->hapd; - HOSTAPD_DEBUG(HOSTAPD_DEBUG_MINIMAL, "%s: ssid=\"%.*s\"\n", - __func__, len, buf); + wpa_printf(MSG_DEBUG, "%s: ssid=\"%.*s\"\n", __func__, len, buf); return set80211var(priv, IEEE80211_IOC_SSID, buf, len); } @@ -830,7 +825,7 @@ bsd_set_radius_acl_expire(void *priv, co } #endif /* CONFIG_DRIVER_RADIUS_ACL */ -static int +static void * bsd_init(struct hostapd_data *hapd) { struct bsd_driver_data *drv; @@ -842,7 +837,6 @@ bsd_init(struct hostapd_data *hapd) } memset(drv, 0, sizeof(*drv)); - drv->ops = bsd_driver_ops; drv->hapd = hapd; drv->ioctl_sock = socket(PF_INET, SOCK_DGRAM, 0); if (drv->ioctl_sock < 0) { @@ -872,8 +866,7 @@ bsd_init(struct hostapd_data *hapd) bsd_set_iface_flags(drv, -IFF_UP); /* mark down during setup */ - hapd->driver = &drv->ops; - return 0; + return drv; bad: if (drv != NULL) { if (drv->sock_xmit != NULL) @@ -882,7 +875,7 @@ bad: close(drv->ioctl_sock); free(drv); } - return -1; + return NULL; } @@ -891,8 +884,6 @@ bsd_deinit(void *priv) { struct bsd_driver_data *drv = priv; - drv->hapd->driver = NULL; - (void) bsd_set_iface_flags(drv, -IFF_UP); if (drv->ioctl_sock >= 0) close(drv->ioctl_sock); @@ -901,7 +892,7 @@ bsd_deinit(void *priv) free(drv); } -static const struct driver_ops bsd_driver_ops = { +const struct wpa_driver_ops wpa_driver_bsd_ops = { .name = "bsd", .init = bsd_init, .deinit = bsd_deinit, @@ -928,8 +919,3 @@ static const struct driver_ops bsd_drive .set_radius_acl_expire = bsd_set_radius_acl_expire, #endif }; - -void bsd_driver_register(void) -{ - driver_register(bsd_driver_ops.name, &bsd_driver_ops); -} Modified: head/usr.sbin/wpa/hostapd_cli/Makefile ============================================================================== --- head/usr.sbin/wpa/hostapd_cli/Makefile Mon Mar 2 02:26:53 2009 (r189262) +++ head/usr.sbin/wpa/hostapd_cli/Makefile Mon Mar 2 02:28:22 2009 (r189263) @@ -7,7 +7,7 @@ WPA_SUPPLICANT_DISTDIR?= ${CONTRIB}/wpa_ .PATH: ${HOSTAPD_DISTDIR} ${WPA_SUPPLICANT_DISTDIR} PROG= hostapd_cli -SRCS= hostapd_cli.c wpa_ctrl.c +SRCS= hostapd_cli.c wpa_ctrl.c os_unix.c CFLAGS+= -DCONFIG_CTRL_IFACE CFLAGS+= -DCONFIG_CTRL_IFACE_UNIX Modified: head/usr.sbin/wpa/wpa_cli/Makefile ============================================================================== --- head/usr.sbin/wpa/wpa_cli/Makefile Mon Mar 2 02:26:53 2009 (r189262) +++ head/usr.sbin/wpa/wpa_cli/Makefile Mon Mar 2 02:28:22 2009 (r189263) @@ -11,4 +11,8 @@ MAN= wpa_cli.8 CFLAGS+= -DCONFIG_CTRL_IFACE CFLAGS+= -DCONFIG_CTRL_IFACE_UNIX +#CFLAGS+= -DCONFIG_READLINE +#LDADD+= -ledit -ltermcap +#DPADD+= ${LIBEDIT} ${LIBTERMCAP} + .include Modified: head/usr.sbin/wpa/wpa_supplicant/Makefile ============================================================================== --- head/usr.sbin/wpa/wpa_supplicant/Makefile Mon Mar 2 02:26:53 2009 (r189262) +++ head/usr.sbin/wpa/wpa_supplicant/Makefile Mon Mar 2 02:28:22 2009 (r189263) @@ -1,14 +1,18 @@ # $FreeBSD$ -.include +.include "${.CURDIR}/../Makefile.inc" -WPA_SUPPLICANT_DISTDIR?= ${.CURDIR}/../../../contrib/wpa_supplicant -.PATH: ${.CURDIR}/.. ${WPA_SUPPLICANT_DISTDIR} +.PATH.c:${WPA_SUPPLICANT_DISTDIR} \ + ${WPA_DISTDIR}/src/drivers \ + ${WPA_DISTDIR}/src/eap_peer \ + ${WPA_DISTDIR}/src/rsn_supp PROG= wpa_supplicant -SRCS= config.c eloop.c common.c md5.c rc4.c sha1.c aes_wrap.c \ - wpa_supplicant.c events.c wpa.c preauth.c pmksa_cache.c \ - ctrl_iface.c ctrl_iface_unix.c l2_packet.c main.c drivers.c \ +SRCS= aes.c aes_wrap.c blacklist.c common.c config.c ctrl_iface.c \ + ctrl_iface_unix.c drivers.c eloop.c events.c l2_packet.c main.c \ + md5.c preauth.c pmksa_cache.c rc4.c scan.c scan_helpers.c sha1.c \ + wpa.c wpa_common.c wpa_debug.c wpa_ie.c wpa_supplicant.c \ + wpabuf.c wpas_glue.c \ driver_ndis.c Packet32.c \ driver_wired.c \ driver_freebsd.c os_unix.c @@ -17,15 +21,17 @@ MAN= wpa_supplicant.8 wpa_supplicant.con .if ${MK_EXAMPLES} != "no" FILESDIR= ${SHAREDIR}/examples/etc +.PATH: ${WPA_SUPPLICANT_DISTDIR} FILES= wpa_supplicant.conf .endif -CFLAGS+= -I${.CURDIR} -I${WPA_SUPPLICANT_DISTDIR} +CFLAGS+=-I${WPA_SUPPLICANT_DISTDIR} +CFLAGS+=-I${WPA_DISTDIR}/src/drivers +CFLAGS+=-I${WPA_DISTDIR}/src/rsn_supp + CFLAGS+= -DCONFIG_DRIVER_BSD CFLAGS+= -DCONFIG_DRIVER_NDIS CFLAGS+= -DCONFIG_DRIVER_WIRED -CFLAGS+= -DCONFIG_CTRL_IFACE -CFLAGS+= -DCONFIG_CTRL_IFACE_UNIX CFLAGS+= -DCONFIG_TERMINATE_ONLASTIF CFLAGS+= -DCONFIG_DEBUG_SYSLOG CFLAGS+= -g @@ -43,15 +49,19 @@ LDADD+=${WPA_SUPPLICANT_LDADD} #LDFLAGS+=${WPA_SUPPLICANT_LDFLAGS} .if ${MK_WPA_SUPPLICANT_EAPOL} != "no" -SRCS+= eapol_sm.c eap.c eap_methods.c +SRCS+= eapol_supp_sm.c eap.c eap_common.c eap_methods.c CFLAGS+= -DIEEE8021X_EAPOL .if ${MK_OPENSSL} != "no" && !defined(RELEASE_CRUNCH) CFLAGS+=-DEAP_TLS -DEAP_PEAP -DEAP_MSCHAPv2 -DEAP_LEAP -DEAP_PSK \ -DEAP_TLV -DEAP_TLS_FUNCS -DEAP_TLS_OPENSSL -SRCS+= eap_tls.c eap_peap.c eap_mschapv2.c eap_leap.c \ +SRCS+= chap.c crypto_openssl.c \ + eap_leap.c \ + eap_mschapv2.c \ + eap_peap.c eap_peap_common.c \ eap_psk.c eap_psk_common.c \ - eap_tlv.c eap_tls_common.c tls_openssl.c ms_funcs.c crypto.c + eap_tls.c eap_tls_common.c \ + mschapv2.c ms_funcs.c tls_openssl.c CFLAGS+=-DEAP_TTLS -DEAP_MD5 SRCS+= eap_ttls.c eap_md5.c Modified: head/usr.sbin/wpa/wpa_supplicant/driver_freebsd.c ============================================================================== --- head/usr.sbin/wpa/wpa_supplicant/driver_freebsd.c Mon Mar 2 02:26:53 2009 (r189262) +++ head/usr.sbin/wpa/wpa_supplicant/driver_freebsd.c Mon Mar 2 02:28:22 2009 (r189263) @@ -24,9 +24,8 @@ #include "common.h" #include "driver.h" #include "eloop.h" -#include "wpa_supplicant.h" #include "l2_packet.h" -#include "wpa.h" /* XXX for RSN_INFO_ELEM */ +#include "ieee802_11_defs.h" #include #include @@ -424,7 +423,7 @@ wpa_driver_bsd_associate(void *priv, str if (params->wpa_ie_len && set80211param(drv, IEEE80211_IOC_WPA, - params->wpa_ie[0] == RSN_INFO_ELEM ? 2 : 1) < 0) + params->wpa_ie[0] == WLAN_EID_RSN ? 2 : 1) < 0) return -1; memset(&mlme, 0, sizeof(mlme)); Modified: head/usr.sbin/wpa/wpa_supplicant/driver_wired.c ============================================================================== --- head/usr.sbin/wpa/wpa_supplicant/driver_wired.c Mon Mar 2 02:26:53 2009 (r189262) +++ head/usr.sbin/wpa/wpa_supplicant/driver_wired.c Mon Mar 2 02:28:22 2009 (r189263) @@ -21,7 +21,7 @@ #include "common.h" #include "driver.h" -#include "wpa_supplicant.h" +#include "wpa.h" static const u8 pae_group_addr[ETH_ALEN] = { 0x01, 0x80, 0xc2, 0x00, 0x00, 0x03 }; From owner-svn-src-head@FreeBSD.ORG Mon Mar 2 02:29: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 6D535106568A; Mon, 2 Mar 2009 02:29:18 +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 434A48FC1F; Mon, 2 Mar 2009 02:29:18 +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 n222TIPG061978; Mon, 2 Mar 2009 02:29:18 GMT (envelope-from sam@svn.freebsd.org) Received: (from sam@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n222TIAc061977; Mon, 2 Mar 2009 02:29:18 GMT (envelope-from sam@svn.freebsd.org) Message-Id: <200903020229.n222TIAc061977@svn.freebsd.org> From: Sam Leffler Date: Mon, 2 Mar 2009 02:29: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: r189264 - in head/contrib: hostapd wpa_supplicant 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, 02 Mar 2009 02:29:18 -0000 Author: sam Date: Mon Mar 2 02:29:17 2009 New Revision: 189264 URL: http://svn.freebsd.org/changeset/base/189264 Log: don't need these any more; we are now using a combined tree Deleted: head/contrib/hostapd/ head/contrib/wpa_supplicant/ From owner-svn-src-head@FreeBSD.ORG Mon Mar 2 02:44: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 1136B106566C; Mon, 2 Mar 2009 02:44:12 +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 F2F2D8FC15; Mon, 2 Mar 2009 02:44:11 +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 n222iBxW062320; Mon, 2 Mar 2009 02:44:11 GMT (envelope-from thompsa@svn.freebsd.org) Received: (from thompsa@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n222iBk3062302; Mon, 2 Mar 2009 02:44:11 GMT (envelope-from thompsa@svn.freebsd.org) Message-Id: <200903020244.n222iBk3062302@svn.freebsd.org> From: Andrew Thompson Date: Mon, 2 Mar 2009 02:44: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: r189265 - head/sys/dev/usb/serial 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, 02 Mar 2009 02:44:12 -0000 Author: thompsa Date: Mon Mar 2 02:44:10 2009 New Revision: 189265 URL: http://svn.freebsd.org/changeset/base/189265 Log: Move the serial drivers from Giant to using their own mutexs. Tested with: u3g, ubser, uplcom Modified: head/sys/dev/usb/serial/u3g.c head/sys/dev/usb/serial/uark.c head/sys/dev/usb/serial/ubsa.c head/sys/dev/usb/serial/ubser.c head/sys/dev/usb/serial/uchcom.c head/sys/dev/usb/serial/ucycom.c head/sys/dev/usb/serial/ufoma.c head/sys/dev/usb/serial/uftdi.c head/sys/dev/usb/serial/ugensa.c head/sys/dev/usb/serial/uipaq.c head/sys/dev/usb/serial/ulpt.c head/sys/dev/usb/serial/umct.c head/sys/dev/usb/serial/umodem.c head/sys/dev/usb/serial/umoscom.c head/sys/dev/usb/serial/uplcom.c head/sys/dev/usb/serial/uslcom.c head/sys/dev/usb/serial/uvisor.c head/sys/dev/usb/serial/uvscom.c Modified: head/sys/dev/usb/serial/u3g.c ============================================================================== --- head/sys/dev/usb/serial/u3g.c Mon Mar 2 02:29:17 2009 (r189264) +++ head/sys/dev/usb/serial/u3g.c Mon Mar 2 02:44:10 2009 (r189265) @@ -90,6 +90,7 @@ struct u3g_softc { struct usb2_xfer *sc_xfer[U3G_MAXPORTS][U3G_N_TRANSFER]; struct usb2_device *sc_udev; + struct mtx sc_mtx; uint8_t sc_lsr; /* local status register */ uint8_t sc_msr; /* U3G status register */ @@ -455,6 +456,7 @@ u3g_attach(device_t dev) u3g_config_tmp[n] = u3g_config[n]; device_set_usb2_desc(dev); + mtx_init(&sc->sc_mtx, "u3g", NULL, MTX_DEF); sc->sc_udev = uaa->device; @@ -488,7 +490,7 @@ u3g_attach(device_t dev) /* try to allocate a set of BULK endpoints */ error = usb2_transfer_setup(uaa->device, &x, sc->sc_xfer[m], u3g_config_tmp, U3G_N_TRANSFER, - &sc->sc_ucom[m], &Giant); + &sc->sc_ucom[m], &sc->sc_mtx); if (error) { /* next interface */ x++; @@ -502,8 +504,10 @@ u3g_attach(device_t dev) uaa->info.bIfaceIndex); /* set stall by default */ + mtx_lock(&sc->sc_mtx); usb2_transfer_set_stall(sc->sc_xfer[m][U3G_BULK_WR]); usb2_transfer_set_stall(sc->sc_xfer[m][U3G_BULK_RD]); + mtx_unlock(&sc->sc_mtx); m++; /* found one port */ i++; /* next endpoint index */ @@ -512,7 +516,7 @@ u3g_attach(device_t dev) sc->sc_numports = m; error = usb2_com_attach(&sc->sc_super_ucom, sc->sc_ucom, - sc->sc_numports, sc, &u3g_callback, &Giant); + sc->sc_numports, sc, &u3g_callback, &sc->sc_mtx); if (error) { DPRINTF("usb2_com_attach failed\n"); goto detach; @@ -542,6 +546,7 @@ u3g_detach(device_t dev) for (m = 0; m != U3G_MAXPORTS; m++) usb2_transfer_unsetup(sc->sc_xfer[m], U3G_N_TRANSFER); + mtx_destroy(&sc->sc_mtx); return (0); } Modified: head/sys/dev/usb/serial/uark.c ============================================================================== --- head/sys/dev/usb/serial/uark.c Mon Mar 2 02:29:17 2009 (r189264) +++ head/sys/dev/usb/serial/uark.c Mon Mar 2 02:44:10 2009 (r189265) @@ -73,6 +73,7 @@ struct uark_softc { struct usb2_xfer *sc_xfer[UARK_N_TRANSFER]; struct usb2_device *sc_udev; + struct mtx sc_mtx; uint8_t sc_msr; uint8_t sc_lsr; @@ -181,13 +182,14 @@ uark_attach(device_t dev) uint8_t iface_index; device_set_usb2_desc(dev); + mtx_init(&sc->sc_mtx, "uark", NULL, MTX_DEF); sc->sc_udev = uaa->device; iface_index = UARK_IFACE_INDEX; error = usb2_transfer_setup (uaa->device, &iface_index, sc->sc_xfer, - uark_xfer_config, UARK_N_TRANSFER, sc, &Giant); + uark_xfer_config, UARK_N_TRANSFER, sc, &sc->sc_mtx); if (error) { device_printf(dev, "allocating control USB " @@ -195,11 +197,13 @@ uark_attach(device_t dev) goto detach; } /* clear stall at first run */ + mtx_lock(&sc->sc_mtx); usb2_transfer_set_stall(sc->sc_xfer[UARK_BULK_DT_WR]); usb2_transfer_set_stall(sc->sc_xfer[UARK_BULK_DT_RD]); + mtx_unlock(&sc->sc_mtx); error = usb2_com_attach(&sc->sc_super_ucom, &sc->sc_ucom, 1, sc, - &uark_callback, &Giant); + &uark_callback, &sc->sc_mtx); if (error) { DPRINTF("usb2_com_attach failed\n"); goto detach; @@ -217,8 +221,8 @@ uark_detach(device_t dev) struct uark_softc *sc = device_get_softc(dev); usb2_com_detach(&sc->sc_super_ucom, &sc->sc_ucom, 1); - usb2_transfer_unsetup(sc->sc_xfer, UARK_N_TRANSFER); + mtx_destroy(&sc->sc_mtx); return (0); } Modified: head/sys/dev/usb/serial/ubsa.c ============================================================================== --- head/sys/dev/usb/serial/ubsa.c Mon Mar 2 02:29:17 2009 (r189264) +++ head/sys/dev/usb/serial/ubsa.c Mon Mar 2 02:44:10 2009 (r189265) @@ -153,6 +153,7 @@ struct ubsa_softc { struct usb2_xfer *sc_xfer[UBSA_N_TRANSFER]; struct usb2_device *sc_udev; + struct mtx sc_mtx; uint8_t sc_iface_no; /* interface number */ uint8_t sc_iface_index; /* interface index */ @@ -289,24 +290,27 @@ ubsa_attach(device_t dev) DPRINTF("sc=%p\n", sc); device_set_usb2_desc(dev); + mtx_init(&sc->sc_mtx, "ubsa", NULL, MTX_DEF); sc->sc_udev = uaa->device; sc->sc_iface_no = uaa->info.bIfaceNum; sc->sc_iface_index = UBSA_IFACE_INDEX; error = usb2_transfer_setup(uaa->device, &sc->sc_iface_index, - sc->sc_xfer, ubsa_config, UBSA_N_TRANSFER, sc, &Giant); + sc->sc_xfer, ubsa_config, UBSA_N_TRANSFER, sc, &sc->sc_mtx); if (error) { DPRINTF("could not allocate all pipes\n"); goto detach; } /* clear stall at first run */ + mtx_lock(&sc->sc_mtx); usb2_transfer_set_stall(sc->sc_xfer[UBSA_BULK_DT_WR]); usb2_transfer_set_stall(sc->sc_xfer[UBSA_BULK_DT_RD]); + mtx_unlock(&sc->sc_mtx); error = usb2_com_attach(&sc->sc_super_ucom, &sc->sc_ucom, 1, sc, - &ubsa_callback, &Giant); + &ubsa_callback, &sc->sc_mtx); if (error) { DPRINTF("usb2_com_attach failed\n"); goto detach; @@ -326,8 +330,8 @@ ubsa_detach(device_t dev) DPRINTF("sc=%p\n", sc); usb2_com_detach(&sc->sc_super_ucom, &sc->sc_ucom, 1); - usb2_transfer_unsetup(sc->sc_xfer, UBSA_N_TRANSFER); + mtx_destroy(&sc->sc_mtx); return (0); } Modified: head/sys/dev/usb/serial/ubser.c ============================================================================== --- head/sys/dev/usb/serial/ubser.c Mon Mar 2 02:29:17 2009 (r189264) +++ head/sys/dev/usb/serial/ubser.c Mon Mar 2 02:44:10 2009 (r189265) @@ -122,6 +122,7 @@ struct ubser_softc { struct usb2_xfer *sc_xfer[UBSER_N_TRANSFER]; struct usb2_device *sc_udev; + struct mtx sc_mtx; uint16_t sc_tx_size; @@ -227,6 +228,7 @@ ubser_attach(device_t dev) int error; device_set_usb2_desc(dev); + mtx_init(&sc->sc_mtx, "ubser", NULL, MTX_DEF); snprintf(sc->sc_name, sizeof(sc->sc_name), "%s", device_get_nameunit(dev)); @@ -258,7 +260,7 @@ ubser_attach(device_t dev) device_printf(dev, "found %i serials\n", sc->sc_numser); error = usb2_transfer_setup(uaa->device, &sc->sc_iface_index, - sc->sc_xfer, ubser_config, UBSER_N_TRANSFER, sc, &Giant); + sc->sc_xfer, ubser_config, UBSER_N_TRANSFER, sc, &sc->sc_mtx); if (error) { goto detach; } @@ -275,18 +277,16 @@ ubser_attach(device_t dev) } error = usb2_com_attach(&sc->sc_super_ucom, sc->sc_ucom, - sc->sc_numser, sc, &ubser_callback, &Giant); + sc->sc_numser, sc, &ubser_callback, &sc->sc_mtx); if (error) { goto detach; } - mtx_lock(&Giant); + mtx_lock(&sc->sc_mtx); usb2_transfer_set_stall(sc->sc_xfer[UBSER_BULK_DT_WR]); usb2_transfer_set_stall(sc->sc_xfer[UBSER_BULK_DT_RD]); - usb2_transfer_start(sc->sc_xfer[UBSER_BULK_DT_RD]); - - mtx_unlock(&Giant); + mtx_unlock(&sc->sc_mtx); return (0); /* success */ @@ -303,8 +303,8 @@ ubser_detach(device_t dev) DPRINTF("\n"); usb2_com_detach(&sc->sc_super_ucom, sc->sc_ucom, sc->sc_numser); - usb2_transfer_unsetup(sc->sc_xfer, UBSER_N_TRANSFER); + mtx_destroy(&sc->sc_mtx); return (0); } Modified: head/sys/dev/usb/serial/uchcom.c ============================================================================== --- head/sys/dev/usb/serial/uchcom.c Mon Mar 2 02:29:17 2009 (r189264) +++ head/sys/dev/usb/serial/uchcom.c Mon Mar 2 02:44:10 2009 (r189265) @@ -158,6 +158,7 @@ struct uchcom_softc { struct usb2_xfer *sc_xfer[UCHCOM_N_TRANSFER]; struct usb2_device *sc_udev; + struct mtx sc_mtx; uint8_t sc_dtr; /* local copy */ uint8_t sc_rts; /* local copy */ @@ -303,6 +304,7 @@ uchcom_attach(device_t dev) DPRINTFN(11, "\n"); device_set_usb2_desc(dev); + mtx_init(&sc->sc_mtx, "uchcom", NULL, MTX_DEF); sc->sc_udev = uaa->device; @@ -318,7 +320,7 @@ uchcom_attach(device_t dev) iface_index = UCHCOM_IFACE_INDEX; error = usb2_transfer_setup(uaa->device, &iface_index, sc->sc_xfer, uchcom_config_data, - UCHCOM_N_TRANSFER, sc, &Giant); + UCHCOM_N_TRANSFER, sc, &sc->sc_mtx); if (error) { DPRINTF("one or more missing USB endpoints, " @@ -338,11 +340,13 @@ uchcom_attach(device_t dev) sc->sc_rts = 1; /* clear stall at first run */ + mtx_lock(&sc->sc_mtx); usb2_transfer_set_stall(sc->sc_xfer[UCHCOM_BULK_DT_WR]); usb2_transfer_set_stall(sc->sc_xfer[UCHCOM_BULK_DT_RD]); + mtx_unlock(&sc->sc_mtx); error = usb2_com_attach(&sc->sc_super_ucom, &sc->sc_ucom, 1, sc, - &uchcom_callback, &Giant); + &uchcom_callback, &sc->sc_mtx); if (error) { goto detach; } @@ -361,8 +365,8 @@ uchcom_detach(device_t dev) DPRINTFN(11, "\n"); usb2_com_detach(&sc->sc_super_ucom, &sc->sc_ucom, 1); - usb2_transfer_unsetup(sc->sc_xfer, UCHCOM_N_TRANSFER); + mtx_destroy(&sc->sc_mtx); return (0); } Modified: head/sys/dev/usb/serial/ucycom.c ============================================================================== --- head/sys/dev/usb/serial/ucycom.c Mon Mar 2 02:29:17 2009 (r189264) +++ head/sys/dev/usb/serial/ucycom.c Mon Mar 2 02:44:10 2009 (r189265) @@ -71,6 +71,7 @@ struct ucycom_softc { struct usb2_device *sc_udev; struct usb2_xfer *sc_xfer[UCYCOM_N_TRANSFER]; + struct mtx sc_mtx; uint32_t sc_model; #define MODEL_CY7C63743 0x63743 @@ -204,6 +205,7 @@ ucycom_attach(device_t dev) sc->sc_udev = uaa->device; device_set_usb2_desc(dev); + mtx_init(&sc->sc_mtx, "ucycom", NULL, MTX_DEF); snprintf(sc->sc_name, sizeof(sc->sc_name), "%s", device_get_nameunit(dev)); @@ -250,14 +252,14 @@ ucycom_attach(device_t dev) iface_index = UCYCOM_IFACE_INDEX; error = usb2_transfer_setup(uaa->device, &iface_index, sc->sc_xfer, ucycom_config, UCYCOM_N_TRANSFER, - sc, &Giant); + sc, &sc->sc_mtx); if (error) { device_printf(dev, "allocating USB " "transfers failed!\n"); goto detach; } error = usb2_com_attach(&sc->sc_super_ucom, &sc->sc_ucom, 1, sc, - &ucycom_callback, &Giant); + &ucycom_callback, &sc->sc_mtx); if (error) { goto detach; @@ -281,8 +283,8 @@ ucycom_detach(device_t dev) struct ucycom_softc *sc = device_get_softc(dev); usb2_com_detach(&sc->sc_super_ucom, &sc->sc_ucom, 1); - usb2_transfer_unsetup(sc->sc_xfer, UCYCOM_N_TRANSFER); + mtx_destroy(&sc->sc_mtx); return (0); } Modified: head/sys/dev/usb/serial/ufoma.c ============================================================================== --- head/sys/dev/usb/serial/ufoma.c Mon Mar 2 02:29:17 2009 (r189264) +++ head/sys/dev/usb/serial/ufoma.c Mon Mar 2 02:44:10 2009 (r189265) @@ -160,6 +160,7 @@ struct ufoma_softc { struct usb2_com_super_softc sc_super_ucom; struct usb2_com_softc sc_ucom; struct cv sc_cv; + struct mtx sc_mtx; struct usb2_xfer *sc_ctrl_xfer[UFOMA_CTRL_ENDPT_MAX]; struct usb2_xfer *sc_bulk_xfer[UFOMA_BULK_ENDPT_MAX]; @@ -365,6 +366,7 @@ ufoma_attach(device_t dev) sc->sc_dev = dev; sc->sc_unit = device_get_unit(dev); + mtx_init(&sc->sc_mtx, "ufoma", NULL, MTX_DEF); usb2_cv_init(&sc->sc_cv, "CWAIT"); device_set_usb2_desc(dev); @@ -383,7 +385,7 @@ ufoma_attach(device_t dev) error = usb2_transfer_setup(uaa->device, &sc->sc_ctrl_iface_index, sc->sc_ctrl_xfer, - ufoma_ctrl_config, UFOMA_CTRL_ENDPT_MAX, sc, &Giant); + ufoma_ctrl_config, UFOMA_CTRL_ENDPT_MAX, sc, &sc->sc_mtx); if (error) { device_printf(dev, "allocating control USB " @@ -424,11 +426,13 @@ ufoma_attach(device_t dev) sc->sc_modetoactivate = mad->bMode[0]; /* clear stall at first run, if any */ + mtx_lock(&sc->sc_mtx); usb2_transfer_set_stall(sc->sc_bulk_xfer[UFOMA_BULK_ENDPT_WRITE]); usb2_transfer_set_stall(sc->sc_bulk_xfer[UFOMA_BULK_ENDPT_READ]); + mtx_unlock(&sc->sc_mtx); error = usb2_com_attach(&sc->sc_super_ucom, &sc->sc_ucom, 1, sc, - &ufoma_callback, &Giant); + &ufoma_callback, &sc->sc_mtx); if (error) { DPRINTF("usb2_com_attach failed\n"); goto detach; @@ -465,14 +469,13 @@ ufoma_detach(device_t dev) struct ufoma_softc *sc = device_get_softc(dev); usb2_com_detach(&sc->sc_super_ucom, &sc->sc_ucom, 1); - usb2_transfer_unsetup(sc->sc_ctrl_xfer, UFOMA_CTRL_ENDPT_MAX); - usb2_transfer_unsetup(sc->sc_bulk_xfer, UFOMA_BULK_ENDPT_MAX); if (sc->sc_modetable) { free(sc->sc_modetable, M_USBDEV); } + mtx_destroy(&sc->sc_mtx); usb2_cv_destroy(&sc->sc_cv); return (0); @@ -512,7 +515,7 @@ ufoma_cfg_link_state(struct ufoma_softc usb2_com_cfg_do_request(sc->sc_udev, &sc->sc_ucom, &req, sc->sc_modetable, 0, 1000); - error = usb2_cv_timedwait(&sc->sc_cv, &Giant, hz); + error = usb2_cv_timedwait(&sc->sc_cv, &sc->sc_mtx, hz); if (error) { DPRINTF("NO response\n"); @@ -534,7 +537,7 @@ ufoma_cfg_activate_state(struct ufoma_so usb2_com_cfg_do_request(sc->sc_udev, &sc->sc_ucom, &req, NULL, 0, 1000); - error = usb2_cv_timedwait(&sc->sc_cv, &Giant, + error = usb2_cv_timedwait(&sc->sc_cv, &sc->sc_mtx, (UFOMA_MAX_TIMEOUT * hz)); if (error) { DPRINTF("No response\n"); @@ -1035,7 +1038,7 @@ ufoma_modem_setup(device_t dev, struct u error = usb2_transfer_setup(uaa->device, &sc->sc_data_iface_index, sc->sc_bulk_xfer, - ufoma_bulk_config, UFOMA_BULK_ENDPT_MAX, sc, &Giant); + ufoma_bulk_config, UFOMA_BULK_ENDPT_MAX, sc, &sc->sc_mtx); if (error) { device_printf(dev, "allocating BULK USB " Modified: head/sys/dev/usb/serial/uftdi.c ============================================================================== --- head/sys/dev/usb/serial/uftdi.c Mon Mar 2 02:29:17 2009 (r189264) +++ head/sys/dev/usb/serial/uftdi.c Mon Mar 2 02:44:10 2009 (r189265) @@ -96,6 +96,7 @@ struct uftdi_softc { struct usb2_device *sc_udev; struct usb2_xfer *sc_xfer[UFTDI_N_TRANSFER]; device_t sc_dev; + struct mtx sc_mtx; uint32_t sc_unit; enum uftdi_type sc_type; @@ -259,6 +260,7 @@ uftdi_attach(device_t dev) sc->sc_unit = device_get_unit(dev); device_set_usb2_desc(dev); + mtx_init(&sc->sc_mtx, "uftdi", NULL, MTX_DEF); snprintf(sc->sc_name, sizeof(sc->sc_name), "%s", device_get_nameunit(dev)); @@ -280,7 +282,7 @@ uftdi_attach(device_t dev) error = usb2_transfer_setup(uaa->device, &sc->sc_iface_index, sc->sc_xfer, uftdi_config, - UFTDI_N_TRANSFER, sc, &Giant); + UFTDI_N_TRANSFER, sc, &sc->sc_mtx); if (error) { device_printf(dev, "allocating USB " @@ -290,8 +292,10 @@ uftdi_attach(device_t dev) sc->sc_ucom.sc_portno = FTDI_PIT_SIOA + uaa->info.bIfaceNum; /* clear stall at first run */ + mtx_lock(&sc->sc_mtx); usb2_transfer_set_stall(sc->sc_xfer[UFTDI_BULK_DT_WR]); usb2_transfer_set_stall(sc->sc_xfer[UFTDI_BULK_DT_RD]); + mtx_unlock(&sc->sc_mtx); /* set a valid "lcr" value */ @@ -301,7 +305,7 @@ uftdi_attach(device_t dev) FTDI_SIO_SET_DATA_BITS(8)); error = usb2_com_attach(&sc->sc_super_ucom, &sc->sc_ucom, 1, sc, - &uftdi_callback, &Giant); + &uftdi_callback, &sc->sc_mtx); if (error) { goto detach; } @@ -318,8 +322,8 @@ uftdi_detach(device_t dev) struct uftdi_softc *sc = device_get_softc(dev); usb2_com_detach(&sc->sc_super_ucom, &sc->sc_ucom, 1); - usb2_transfer_unsetup(sc->sc_xfer, UFTDI_N_TRANSFER); + mtx_destroy(&sc->sc_mtx); return (0); } Modified: head/sys/dev/usb/serial/ugensa.c ============================================================================== --- head/sys/dev/usb/serial/ugensa.c Mon Mar 2 02:29:17 2009 (r189264) +++ head/sys/dev/usb/serial/ugensa.c Mon Mar 2 02:44:10 2009 (r189265) @@ -221,8 +221,10 @@ ugensa_attach(device_t dev) goto detach; } /* clear stall at first run */ + mtx_lock(&sc->sc_mtx); usb2_transfer_set_stall(ssc->sc_xfer[UGENSA_BULK_DT_WR]); usb2_transfer_set_stall(ssc->sc_xfer[UGENSA_BULK_DT_RD]); + mtx_unlock(&sc->sc_mtx); /* initialize port number */ ssc->sc_usb2_com_ptr->sc_portno = sc->sc_niface; Modified: head/sys/dev/usb/serial/uipaq.c ============================================================================== --- head/sys/dev/usb/serial/uipaq.c Mon Mar 2 02:29:17 2009 (r189264) +++ head/sys/dev/usb/serial/uipaq.c Mon Mar 2 02:44:10 2009 (r189265) @@ -86,6 +86,7 @@ struct uipaq_softc { struct usb2_xfer *sc_xfer[UIPAQ_N_TRANSFER]; struct usb2_device *sc_udev; + struct mtx sc_mtx; uint16_t sc_line; @@ -1102,6 +1103,7 @@ uipaq_attach(device_t dev) sc->sc_udev = uaa->device; device_set_usb2_desc(dev); + mtx_init(&sc->sc_mtx, "uipaq", NULL, MTX_DEF); /* * Send magic bytes, cribbed from Linux ipaq driver that @@ -1125,17 +1127,19 @@ uipaq_attach(device_t dev) iface_index = UIPAQ_IFACE_INDEX; error = usb2_transfer_setup(uaa->device, &iface_index, sc->sc_xfer, uipaq_config_data, - UIPAQ_N_TRANSFER, sc, &Giant); + UIPAQ_N_TRANSFER, sc, &sc->sc_mtx); if (error) { goto detach; } /* clear stall at first run */ + mtx_lock(&sc->sc_mtx); usb2_transfer_set_stall(sc->sc_xfer[UIPAQ_BULK_DT_WR]); usb2_transfer_set_stall(sc->sc_xfer[UIPAQ_BULK_DT_RD]); + mtx_unlock(&sc->sc_mtx); error = usb2_com_attach(&sc->sc_super_ucom, &sc->sc_ucom, 1, sc, - &uipaq_callback, &Giant); + &uipaq_callback, &sc->sc_mtx); if (error) { goto detach; } @@ -1152,8 +1156,8 @@ uipaq_detach(device_t dev) struct uipaq_softc *sc = device_get_softc(dev); usb2_com_detach(&sc->sc_super_ucom, &sc->sc_ucom, 1); - usb2_transfer_unsetup(sc->sc_xfer, UIPAQ_N_TRANSFER); + mtx_destroy(&sc->sc_mtx); return (0); } Modified: head/sys/dev/usb/serial/ulpt.c ============================================================================== --- head/sys/dev/usb/serial/ulpt.c Mon Mar 2 02:29:17 2009 (r189264) +++ head/sys/dev/usb/serial/ulpt.c Mon Mar 2 02:44:10 2009 (r189265) @@ -636,9 +636,7 @@ ulpt_detach(device_t dev) mtx_unlock(&sc->sc_mtx); usb2_transfer_unsetup(sc->sc_xfer, ULPT_N_TRANSFER); - usb2_callout_drain(&sc->sc_watchdog); - mtx_destroy(&sc->sc_mtx); return (0); Modified: head/sys/dev/usb/serial/umct.c ============================================================================== --- head/sys/dev/usb/serial/umct.c Mon Mar 2 02:29:17 2009 (r189264) +++ head/sys/dev/usb/serial/umct.c Mon Mar 2 02:44:10 2009 (r189265) @@ -93,6 +93,7 @@ struct umct_softc { struct usb2_device *sc_udev; struct usb2_xfer *sc_xfer[UMCT_N_TRANSFER]; + struct mtx sc_mtx; uint32_t sc_unit; @@ -233,6 +234,7 @@ umct_attach(device_t dev) sc->sc_unit = device_get_unit(dev); device_set_usb2_desc(dev); + mtx_init(&sc->sc_mtx, "umct", NULL, MTX_DEF); snprintf(sc->sc_name, sizeof(sc->sc_name), "%s", device_get_nameunit(dev)); @@ -241,7 +243,7 @@ umct_attach(device_t dev) iface_index = UMCT_IFACE_INDEX; error = usb2_transfer_setup(uaa->device, &iface_index, - sc->sc_xfer, umct_config, UMCT_N_TRANSFER, sc, &Giant); + sc->sc_xfer, umct_config, UMCT_N_TRANSFER, sc, &sc->sc_mtx); if (error) { device_printf(dev, "allocating USB " @@ -274,7 +276,7 @@ umct_attach(device_t dev) } } error = usb2_com_attach(&sc->sc_super_ucom, &sc->sc_ucom, 1, sc, - &umct_callback, &Giant); + &umct_callback, &sc->sc_mtx); if (error) { goto detach; } @@ -291,8 +293,8 @@ umct_detach(device_t dev) struct umct_softc *sc = device_get_softc(dev); usb2_com_detach(&sc->sc_super_ucom, &sc->sc_ucom, 1); - usb2_transfer_unsetup(sc->sc_xfer, UMCT_N_TRANSFER); + mtx_destroy(&sc->sc_mtx); return (0); } Modified: head/sys/dev/usb/serial/umodem.c ============================================================================== --- head/sys/dev/usb/serial/umodem.c Mon Mar 2 02:29:17 2009 (r189264) +++ head/sys/dev/usb/serial/umodem.c Mon Mar 2 02:44:10 2009 (r189265) @@ -142,6 +142,7 @@ struct umodem_softc { struct usb2_xfer *sc_xfer[UMODEM_N_TRANSFER]; struct usb2_device *sc_udev; + struct mtx sc_mtx; uint16_t sc_line; @@ -288,6 +289,7 @@ umodem_attach(device_t dev) int error; device_set_usb2_desc(dev); + mtx_init(&sc->sc_mtx, "umodem", NULL, MTX_DEF); sc->sc_ctrl_iface_no = uaa->info.bIfaceNum; sc->sc_iface_index[1] = uaa->info.bIfaceIndex; @@ -348,17 +350,19 @@ umodem_attach(device_t dev) error = usb2_transfer_setup(uaa->device, sc->sc_iface_index, sc->sc_xfer, umodem_config, UMODEM_N_TRANSFER, - sc, &Giant); + sc, &sc->sc_mtx); if (error) { goto detach; } /* clear stall at first run */ + mtx_lock(&sc->sc_mtx); usb2_transfer_set_stall(sc->sc_xfer[UMODEM_BULK_WR]); usb2_transfer_set_stall(sc->sc_xfer[UMODEM_BULK_RD]); + mtx_unlock(&sc->sc_mtx); error = usb2_com_attach(&sc->sc_super_ucom, &sc->sc_ucom, 1, sc, - &umodem_callback, &Giant); + &umodem_callback, &sc->sc_mtx); if (error) { goto detach; } @@ -781,8 +785,8 @@ umodem_detach(device_t dev) DPRINTF("sc=%p\n", sc); usb2_com_detach(&sc->sc_super_ucom, &sc->sc_ucom, 1); - usb2_transfer_unsetup(sc->sc_xfer, UMODEM_N_TRANSFER); + mtx_destroy(&sc->sc_mtx); return (0); } Modified: head/sys/dev/usb/serial/umoscom.c ============================================================================== --- head/sys/dev/usb/serial/umoscom.c Mon Mar 2 02:29:17 2009 (r189264) +++ head/sys/dev/usb/serial/umoscom.c Mon Mar 2 02:44:10 2009 (r189265) @@ -166,6 +166,7 @@ struct umoscom_softc { struct usb2_xfer *sc_xfer[UMOSCOM_N_TRANSFER]; struct usb2_device *sc_udev; + struct mtx sc_mtx; uint8_t sc_mcr; uint8_t sc_lcr; @@ -300,20 +301,24 @@ umoscom_attach(device_t dev) device_set_desc(dev, "MOSCHIP USB Serial Port Adapter"); device_printf(dev, "\n"); + mtx_init(&sc->sc_mtx, "umoscom", NULL, MTX_DEF); + iface_index = UMOSCOM_IFACE_INDEX; error = usb2_transfer_setup(uaa->device, &iface_index, sc->sc_xfer, umoscom_config_data, - UMOSCOM_N_TRANSFER, sc, &Giant); + UMOSCOM_N_TRANSFER, sc, &sc->sc_mtx); if (error) { goto detach; } /* clear stall at first run */ + mtx_lock(&sc->sc_mtx); usb2_transfer_set_stall(sc->sc_xfer[UMOSCOM_BULK_DT_WR]); usb2_transfer_set_stall(sc->sc_xfer[UMOSCOM_BULK_DT_RD]); + mtx_unlock(&sc->sc_mtx); error = usb2_com_attach(&sc->sc_super_ucom, &sc->sc_ucom, 1, sc, - &umoscom_callback, &Giant); + &umoscom_callback, &sc->sc_mtx); if (error) { goto detach; } @@ -330,13 +335,9 @@ umoscom_detach(device_t dev) { struct umoscom_softc *sc = device_get_softc(dev); - mtx_lock(&Giant); - - mtx_unlock(&Giant); - usb2_com_detach(&sc->sc_super_ucom, &sc->sc_ucom, 1); - usb2_transfer_unsetup(sc->sc_xfer, UMOSCOM_N_TRANSFER); + mtx_destroy(&sc->sc_mtx); return (0); } Modified: head/sys/dev/usb/serial/uplcom.c ============================================================================== --- head/sys/dev/usb/serial/uplcom.c Mon Mar 2 02:29:17 2009 (r189264) +++ head/sys/dev/usb/serial/uplcom.c Mon Mar 2 02:44:10 2009 (r189265) @@ -145,6 +145,7 @@ struct uplcom_softc { struct usb2_xfer *sc_xfer[UPLCOM_N_TRANSFER]; struct usb2_device *sc_udev; + struct mtx sc_mtx; uint16_t sc_line; @@ -326,6 +327,7 @@ uplcom_attach(device_t dev) DPRINTFN(11, "\n"); device_set_usb2_desc(dev); + mtx_init(&sc->sc_mtx, "uplcom", NULL, MTX_DEF); DPRINTF("sc = %p\n", sc); @@ -370,7 +372,7 @@ uplcom_attach(device_t dev) error = usb2_transfer_setup(uaa->device, sc->sc_iface_index, sc->sc_xfer, uplcom_config_data, - UPLCOM_N_TRANSFER, sc, &Giant); + UPLCOM_N_TRANSFER, sc, &sc->sc_mtx); if (error) { DPRINTF("one or more missing USB endpoints, " "error=%s\n", usb2_errstr(error)); @@ -383,11 +385,13 @@ uplcom_attach(device_t dev) goto detach; } /* clear stall at first run */ + mtx_lock(&sc->sc_mtx); usb2_transfer_set_stall(sc->sc_xfer[UPLCOM_BULK_DT_WR]); usb2_transfer_set_stall(sc->sc_xfer[UPLCOM_BULK_DT_RD]); + mtx_unlock(&sc->sc_mtx); error = usb2_com_attach(&sc->sc_super_ucom, &sc->sc_ucom, 1, sc, - &uplcom_callback, &Giant); + &uplcom_callback, &sc->sc_mtx); if (error) { goto detach; } @@ -416,8 +420,8 @@ uplcom_detach(device_t dev) DPRINTF("sc=%p\n", sc); usb2_com_detach(&sc->sc_super_ucom, &sc->sc_ucom, 1); - usb2_transfer_unsetup(sc->sc_xfer, UPLCOM_N_TRANSFER); + mtx_destroy(&sc->sc_mtx); return (0); } Modified: head/sys/dev/usb/serial/uslcom.c ============================================================================== --- head/sys/dev/usb/serial/uslcom.c Mon Mar 2 02:29:17 2009 (r189264) +++ head/sys/dev/usb/serial/uslcom.c Mon Mar 2 02:44:10 2009 (r189265) @@ -96,6 +96,7 @@ struct uslcom_softc { struct usb2_xfer *sc_xfer[USLCOM_N_TRANSFER]; struct usb2_device *sc_udev; + struct mtx sc_mtx; uint8_t sc_msr; uint8_t sc_lsr; @@ -227,23 +228,26 @@ uslcom_attach(device_t dev) DPRINTFN(11, "\n"); device_set_usb2_desc(dev); + mtx_init(&sc->sc_mtx, "uslcom", NULL, MTX_DEF); sc->sc_udev = uaa->device; error = usb2_transfer_setup(uaa->device, &uaa->info.bIfaceIndex, sc->sc_xfer, uslcom_config, - USLCOM_N_TRANSFER, sc, &Giant); + USLCOM_N_TRANSFER, sc, &sc->sc_mtx); if (error) { DPRINTF("one or more missing USB endpoints, " "error=%s\n", usb2_errstr(error)); goto detach; } /* clear stall at first run */ + mtx_lock(&sc->sc_mtx); usb2_transfer_set_stall(sc->sc_xfer[USLCOM_BULK_DT_WR]); usb2_transfer_set_stall(sc->sc_xfer[USLCOM_BULK_DT_RD]); + mtx_unlock(&sc->sc_mtx); error = usb2_com_attach(&sc->sc_super_ucom, &sc->sc_ucom, 1, sc, - &uslcom_callback, &Giant); + &uslcom_callback, &sc->sc_mtx); if (error) { goto detach; } @@ -262,8 +266,8 @@ uslcom_detach(device_t dev) DPRINTF("sc=%p\n", sc); usb2_com_detach(&sc->sc_super_ucom, &sc->sc_ucom, 1); - usb2_transfer_unsetup(sc->sc_xfer, USLCOM_N_TRANSFER); + mtx_destroy(&sc->sc_mtx); return (0); } Modified: head/sys/dev/usb/serial/uvisor.c ============================================================================== --- head/sys/dev/usb/serial/uvisor.c Mon Mar 2 02:29:17 2009 (r189264) +++ head/sys/dev/usb/serial/uvisor.c Mon Mar 2 02:44:10 2009 (r189265) @@ -160,6 +160,7 @@ struct uvisor_softc { struct usb2_xfer *sc_xfer[UVISOR_N_TRANSFER]; struct usb2_device *sc_udev; + struct mtx sc_mtx; uint16_t sc_flag; #define UVISOR_FLAG_PALM4 0x0001 @@ -297,6 +298,8 @@ uvisor_attach(device_t dev) sizeof(uvisor_config_copy)); device_set_usb2_desc(dev); + mtx_init(&sc->sc_mtx, "uvisor", NULL, MTX_DEF); + sc->sc_udev = uaa->device; /* configure the device */ @@ -314,17 +317,19 @@ uvisor_attach(device_t dev) } error = usb2_transfer_setup(uaa->device, &sc->sc_iface_index, sc->sc_xfer, uvisor_config_copy, UVISOR_N_TRANSFER, - sc, &Giant); + sc, &sc->sc_mtx); if (error) { DPRINTF("could not allocate all pipes\n"); goto detach; } /* clear stall at first run */ + mtx_lock(&sc->sc_mtx); usb2_transfer_set_stall(sc->sc_xfer[UVISOR_BULK_DT_WR]); usb2_transfer_set_stall(sc->sc_xfer[UVISOR_BULK_DT_RD]); + mtx_unlock(&sc->sc_mtx); error = usb2_com_attach(&sc->sc_super_ucom, &sc->sc_ucom, 1, sc, - &uvisor_callback, &Giant); + &uvisor_callback, &sc->sc_mtx); if (error) { DPRINTF("usb2_com_attach failed\n"); goto detach; @@ -344,8 +349,8 @@ uvisor_detach(device_t dev) DPRINTF("sc=%p\n", sc); usb2_com_detach(&sc->sc_super_ucom, &sc->sc_ucom, 1); - usb2_transfer_unsetup(sc->sc_xfer, UVISOR_N_TRANSFER); + mtx_destroy(&sc->sc_mtx); return (0); } Modified: head/sys/dev/usb/serial/uvscom.c ============================================================================== --- head/sys/dev/usb/serial/uvscom.c Mon Mar 2 02:29:17 2009 (r189264) +++ head/sys/dev/usb/serial/uvscom.c Mon Mar 2 02:44:10 2009 (r189265) @@ -135,6 +135,7 @@ struct uvscom_softc { struct usb2_xfer *sc_xfer[UVSCOM_N_TRANSFER]; struct usb2_device *sc_udev; + struct mtx sc_mtx; uint16_t sc_line; /* line control register */ @@ -276,6 +277,7 @@ uvscom_attach(device_t dev) int error; device_set_usb2_desc(dev); + mtx_init(&sc->sc_mtx, "uvscom", NULL, MTX_DEF); sc->sc_udev = uaa->device; @@ -285,7 +287,7 @@ uvscom_attach(device_t dev) sc->sc_iface_index = UVSCOM_IFACE_INDEX; error = usb2_transfer_setup(uaa->device, &sc->sc_iface_index, - sc->sc_xfer, uvscom_config, UVSCOM_N_TRANSFER, sc, &Giant); + sc->sc_xfer, uvscom_config, UVSCOM_N_TRANSFER, sc, &sc->sc_mtx); if (error) { DPRINTF("could not allocate all USB transfers!\n"); @@ -294,18 +296,20 @@ uvscom_attach(device_t dev) sc->sc_line = UVSCOM_LINE_INIT; /* clear stall at first run */ + mtx_lock(&sc->sc_mtx); usb2_transfer_set_stall(sc->sc_xfer[UVSCOM_BULK_DT_WR]); usb2_transfer_set_stall(sc->sc_xfer[UVSCOM_BULK_DT_RD]); + mtx_unlock(&sc->sc_mtx); error = usb2_com_attach(&sc->sc_super_ucom, &sc->sc_ucom, 1, sc, - &uvscom_callback, &Giant); + &uvscom_callback, &sc->sc_mtx); if (error) { goto detach; } /* start interrupt pipe */ - mtx_lock(&Giant); + mtx_lock(&sc->sc_mtx); usb2_transfer_start(sc->sc_xfer[UVSCOM_INTR_DT_RD]); - mtx_unlock(&Giant); + mtx_unlock(&sc->sc_mtx); return (0); @@ -323,12 +327,12 @@ uvscom_detach(device_t dev) /* stop interrupt pipe */ - if (sc->sc_xfer[UVSCOM_INTR_DT_RD]) { + if (sc->sc_xfer[UVSCOM_INTR_DT_RD]) usb2_transfer_stop(sc->sc_xfer[UVSCOM_INTR_DT_RD]); - } - usb2_com_detach(&sc->sc_super_ucom, &sc->sc_ucom, 1); + usb2_com_detach(&sc->sc_super_ucom, &sc->sc_ucom, 1); usb2_transfer_unsetup(sc->sc_xfer, UVSCOM_N_TRANSFER); + mtx_destroy(&sc->sc_mtx); return (0); } From owner-svn-src-head@FreeBSD.ORG Mon Mar 2 02:51: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 83E66106566B; Mon, 2 Mar 2009 02:51:53 +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 595428FC0C; Mon, 2 Mar 2009 02:51:53 +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 n222prT2062576; Mon, 2 Mar 2009 02:51:53 GMT (envelope-from sam@svn.freebsd.org) Received: (from sam@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n222prIM062575; Mon, 2 Mar 2009 02:51:53 GMT (envelope-from sam@svn.freebsd.org) Message-Id: <200903020251.n222prIM062575@svn.freebsd.org> From: Sam Leffler Date: Mon, 2 Mar 2009 02:51: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: r189266 - head/contrib/wpa 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, 02 Mar 2009 02:51:53 -0000 Author: sam Date: Mon Mar 2 02:51:52 2009 New Revision: 189266 URL: http://svn.freebsd.org/changeset/base/189266 Log: bring along mergeinfo Submitted by: mlaier Modified: head/contrib/wpa/ (props changed) From owner-svn-src-head@FreeBSD.ORG Mon Mar 2 03:08: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 A54D9106566B; Mon, 2 Mar 2009 03:08:46 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 94EA68FC0A; Mon, 2 Mar 2009 03:08:46 +0000 (UTC) (envelope-from cy@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 n2238kt0063387; Mon, 2 Mar 2009 03:08:46 GMT (envelope-from cy@svn.freebsd.org) Received: (from cy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n2238kpb063385; Mon, 2 Mar 2009 03:08:46 GMT (envelope-from cy@svn.freebsd.org) Message-Id: <200903020308.n2238kpb063385@svn.freebsd.org> From: Cy Schubert Date: Mon, 2 Mar 2009 03:08:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r189267 - head/sbin/dump 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, 02 Mar 2009 03:08:47 -0000 Author: cy (ports committer) Date: Mon Mar 2 03:08:46 2009 New Revision: 189267 URL: http://svn.freebsd.org/changeset/base/189267 Log: Verify that the filesystem being referenced in fstab is indeed a UFS filesystem. This avoids confusion with nullfs and unionfs filesystems which reference the root of a UFS filesystem as a target. PR: 116849 Approved by: kib Modified: head/sbin/dump/optr.c Modified: head/sbin/dump/optr.c ============================================================================== --- head/sbin/dump/optr.c Mon Mar 2 02:51:52 2009 (r189266) +++ head/sbin/dump/optr.c Mon Mar 2 03:08:46 2009 (r189267) @@ -318,9 +318,10 @@ dump_getfstab(void) return; } while ((fs = getfsent()) != NULL) { - if (strcmp(fs->fs_type, FSTAB_RW) && + if ((strcmp(fs->fs_type, FSTAB_RW) && strcmp(fs->fs_type, FSTAB_RO) && - strcmp(fs->fs_type, FSTAB_RQ)) + strcmp(fs->fs_type, FSTAB_RQ)) || + strcmp(fs->fs_vfstype, "ufs")) continue; fs = allocfsent(fs); if ((pf = (struct pfstab *)malloc(sizeof (*pf))) == NULL) From owner-svn-src-head@FreeBSD.ORG Mon Mar 2 04:07: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 9E10E106564A; Mon, 2 Mar 2009 04:07:58 +0000 (UTC) (envelope-from das@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 72EA18FC0A; Mon, 2 Mar 2009 04:07:58 +0000 (UTC) (envelope-from das@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 n2247wL4064646; Mon, 2 Mar 2009 04:07:58 GMT (envelope-from das@svn.freebsd.org) Received: (from das@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n2247wwk064644; Mon, 2 Mar 2009 04:07:58 GMT (envelope-from das@svn.freebsd.org) Message-Id: <200903020407.n2247wwk064644@svn.freebsd.org> From: David Schultz Date: Mon, 2 Mar 2009 04:07: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: r189268 - head/lib/libc/stdio 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, 02 Mar 2009 04:07:59 -0000 Author: das Date: Mon Mar 2 04:07:58 2009 New Revision: 189268 URL: http://svn.freebsd.org/changeset/base/189268 Log: The argument corresponding to %zn is supposed to be an ssize_t *, not a size_t *, although the distinction is moot in practice. Modified: head/lib/libc/stdio/printf-pos.c head/lib/libc/stdio/printflocal.h Modified: head/lib/libc/stdio/printf-pos.c ============================================================================== --- head/lib/libc/stdio/printf-pos.c Mon Mar 2 03:08:46 2009 (r189267) +++ head/lib/libc/stdio/printf-pos.c Mon Mar 2 04:07:58 2009 (r189268) @@ -61,7 +61,7 @@ __FBSDID("$FreeBSD$"); enum typeid { T_UNUSED, TP_SHORT, T_INT, T_U_INT, TP_INT, T_LONG, T_U_LONG, TP_LONG, T_LLONG, T_U_LLONG, TP_LLONG, - T_PTRDIFFT, TP_PTRDIFFT, T_SSIZET, T_SIZET, TP_SIZET, + T_PTRDIFFT, TP_PTRDIFFT, T_SSIZET, T_SIZET, TP_SSIZET, T_INTMAXT, T_UINTMAXT, TP_INTMAXT, TP_VOID, TP_CHAR, TP_SCHAR, T_DOUBLE, T_LONG_DOUBLE, T_WINT, TP_WCHAR }; @@ -374,7 +374,7 @@ reswitch: switch (ch) { else if (flags & PTRDIFFT) error = addtype(&types, TP_PTRDIFFT); else if (flags & SIZET) - error = addtype(&types, TP_SIZET); + error = addtype(&types, TP_SSIZET); else if (flags & LLONGINT) error = addtype(&types, TP_LLONG); else if (flags & LONGINT) @@ -565,7 +565,7 @@ reswitch: switch (ch) { else if (flags & PTRDIFFT) error = addtype(&types, TP_PTRDIFFT); else if (flags & SIZET) - error = addtype(&types, TP_SIZET); + error = addtype(&types, TP_SSIZET); else if (flags & LLONGINT) error = addtype(&types, TP_LLONG); else if (flags & LONGINT) @@ -719,8 +719,8 @@ build_arg_table(struct typetable *types, case T_SSIZET: (*argtable) [n].sizearg = va_arg (ap, ssize_t); break; - case TP_SIZET: - (*argtable) [n].psizearg = va_arg (ap, size_t *); + case TP_SSIZET: + (*argtable) [n].pssizearg = va_arg (ap, ssize_t *); break; case T_INTMAXT: (*argtable) [n].intmaxarg = va_arg (ap, intmax_t); Modified: head/lib/libc/stdio/printflocal.h ============================================================================== --- head/lib/libc/stdio/printflocal.h Mon Mar 2 03:08:46 2009 (r189267) +++ head/lib/libc/stdio/printflocal.h Mon Mar 2 04:07:58 2009 (r189268) @@ -79,7 +79,7 @@ union arg { long *plongarg; long long *plonglongarg; ptrdiff_t *pptrdiffarg; - size_t *psizearg; + ssize_t *pssizearg; intmax_t *pintmaxarg; #ifndef NO_FLOATING_POINT double doublearg; From owner-svn-src-head@FreeBSD.ORG Mon Mar 2 04:10: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 2FA2C1065677; Mon, 2 Mar 2009 04:10:41 +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 1F56E8FC0A; Mon, 2 Mar 2009 04:10:41 +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 n224AfMm064731; Mon, 2 Mar 2009 04:10:41 GMT (envelope-from sam@svn.freebsd.org) Received: (from sam@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n224AfHf064730; Mon, 2 Mar 2009 04:10:41 GMT (envelope-from sam@svn.freebsd.org) Message-Id: <200903020410.n224AfHf064730@svn.freebsd.org> From: Sam Leffler Date: Mon, 2 Mar 2009 04:10: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: r189269 - head/usr.sbin/wpa/wpa_cli 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, 02 Mar 2009 04:10:41 -0000 Author: sam Date: Mon Mar 2 04:10:40 2009 New Revision: 189269 URL: http://svn.freebsd.org/changeset/base/189269 Log: update for 0.6.8 Modified: head/usr.sbin/wpa/wpa_cli/Makefile Modified: head/usr.sbin/wpa/wpa_cli/Makefile ============================================================================== --- head/usr.sbin/wpa/wpa_cli/Makefile Mon Mar 2 04:07:58 2009 (r189268) +++ head/usr.sbin/wpa/wpa_cli/Makefile Mon Mar 2 04:10:40 2009 (r189269) @@ -1,7 +1,8 @@ # $FreeBSD$ -WPA_SUPPLICANT_DISTDIR?= ${.CURDIR}/../../../contrib/wpa_supplicant -.PATH: ${WPA_SUPPLICANT_DISTDIR} +.include "${.CURDIR}/../Makefile.inc" + +.PATH.c:${WPA_SUPPLICANT_DISTDIR} PROG= wpa_cli SRCS= wpa_cli.c wpa_ctrl.c os_unix.c From owner-svn-src-head@FreeBSD.ORG Mon Mar 2 04:11: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 D2A4A1065672; Mon, 2 Mar 2009 04:11: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 C09E18FC18; Mon, 2 Mar 2009 04:11: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 n224BYcO064796; Mon, 2 Mar 2009 04:11:34 GMT (envelope-from sam@svn.freebsd.org) Received: (from sam@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n224BYo7064795; Mon, 2 Mar 2009 04:11:34 GMT (envelope-from sam@svn.freebsd.org) Message-Id: <200903020411.n224BYo7064795@svn.freebsd.org> From: Sam Leffler Date: Mon, 2 Mar 2009 04:11: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: r189270 - head/usr.sbin/wpa/hostapd_cli 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, 02 Mar 2009 04:11:36 -0000 Author: sam Date: Mon Mar 2 04:11:34 2009 New Revision: 189270 URL: http://svn.freebsd.org/changeset/base/189270 Log: update for 0.6.8 Modified: head/usr.sbin/wpa/hostapd_cli/Makefile Modified: head/usr.sbin/wpa/hostapd_cli/Makefile ============================================================================== --- head/usr.sbin/wpa/hostapd_cli/Makefile Mon Mar 2 04:10:40 2009 (r189269) +++ head/usr.sbin/wpa/hostapd_cli/Makefile Mon Mar 2 04:11:34 2009 (r189270) @@ -1,10 +1,8 @@ # $FreeBSD$ -CONTRIB= ${.CURDIR}/../../../contrib -HOSTAPD_DISTDIR?= ${CONTRIB}/hostapd -WPA_SUPPLICANT_DISTDIR?= ${CONTRIB}/wpa_supplicant +.include "${.CURDIR}/../Makefile.inc" -.PATH: ${HOSTAPD_DISTDIR} ${WPA_SUPPLICANT_DISTDIR} +.PATH.c:${HOSTAPD_DISTDIR} PROG= hostapd_cli SRCS= hostapd_cli.c wpa_ctrl.c os_unix.c From owner-svn-src-head@FreeBSD.ORG Mon Mar 2 04:11:42 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 D7CF81065782; Mon, 2 Mar 2009 04:11:42 +0000 (UTC) (envelope-from das@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C745E8FC0A; Mon, 2 Mar 2009 04:11:42 +0000 (UTC) (envelope-from das@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 n224BgUQ064834; Mon, 2 Mar 2009 04:11:42 GMT (envelope-from das@svn.freebsd.org) Received: (from das@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n224BgXF064833; Mon, 2 Mar 2009 04:11:42 GMT (envelope-from das@svn.freebsd.org) Message-Id: <200903020411.n224BgXF064833@svn.freebsd.org> From: David Schultz Date: Mon, 2 Mar 2009 04:11:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r189271 - head/lib/libc/stdio 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, 02 Mar 2009 04:11:43 -0000 Author: das Date: Mon Mar 2 04:11:42 2009 New Revision: 189271 URL: http://svn.freebsd.org/changeset/base/189271 Log: Rewrite asprintf() as a wrapper around vasprintf(), thus reducing the number of functions that have an incestuous relationship with the arcane innards of stdio. Replaced: head/lib/libc/stdio/asprintf.c (contents, props changed) - copied, changed from r189249, head/lib/libc/stdio/printf.c Copied and modified: head/lib/libc/stdio/asprintf.c (from r189249, head/lib/libc/stdio/printf.c) ============================================================================== --- head/lib/libc/stdio/printf.c Sun Mar 1 19:25:40 2009 (r189249, copy source) +++ head/lib/libc/stdio/asprintf.c Mon Mar 2 04:11:42 2009 (r189271) @@ -30,9 +30,6 @@ * SUCH DAMAGE. */ -#if defined(LIBC_SCCS) && !defined(lint) -static char sccsid[] = "@(#)printf.c 8.1 (Berkeley) 6/4/93"; -#endif /* LIBC_SCCS and not lint */ #include __FBSDID("$FreeBSD$"); @@ -40,13 +37,13 @@ __FBSDID("$FreeBSD$"); #include int -printf(char const * __restrict fmt, ...) +asprintf(char ** __restrict s, char const * __restrict fmt, ...) { int ret; va_list ap; va_start(ap, fmt); - ret = vfprintf(stdout, fmt, ap); + ret = vasprintf(s, fmt, ap); va_end(ap); return (ret); } From owner-svn-src-head@FreeBSD.ORG Mon Mar 2 04:12: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 EA95010656E0; Mon, 2 Mar 2009 04:12:41 +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 DA30E8FC17; Mon, 2 Mar 2009 04:12:41 +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 n224Cf3u064887; Mon, 2 Mar 2009 04:12:41 GMT (envelope-from sam@svn.freebsd.org) Received: (from sam@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n224Cfug064886; Mon, 2 Mar 2009 04:12:41 GMT (envelope-from sam@svn.freebsd.org) Message-Id: <200903020412.n224Cfug064886@svn.freebsd.org> From: Sam Leffler Date: Mon, 2 Mar 2009 04:12: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: r189272 - head/usr.sbin/wpa/wpa_passphrase 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, 02 Mar 2009 04:12:42 -0000 Author: sam Date: Mon Mar 2 04:12:41 2009 New Revision: 189272 URL: http://svn.freebsd.org/changeset/base/189272 Log: uupdate for 0.6.8 Modified: head/usr.sbin/wpa/wpa_passphrase/Makefile Modified: head/usr.sbin/wpa/wpa_passphrase/Makefile ============================================================================== --- head/usr.sbin/wpa/wpa_passphrase/Makefile Mon Mar 2 04:11:42 2009 (r189271) +++ head/usr.sbin/wpa/wpa_passphrase/Makefile Mon Mar 2 04:12:41 2009 (r189272) @@ -1,7 +1,8 @@ # $FreeBSD$ -WPA_SUPPLICANT_DISTDIR?= ${.CURDIR}/../../../contrib/wpa_supplicant -.PATH: ${WPA_SUPPLICANT_DISTDIR} +.include "${.CURDIR}/../Makefile.inc" + +.PATH.c:${WPA_SUPPLICANT_DISTDIR} PROG= wpa_passphrase SRCS= wpa_passphrase.c sha1.c md5.c From owner-svn-src-head@FreeBSD.ORG Mon Mar 2 04:35: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 2991D10656D6; Mon, 2 Mar 2009 04:35:53 +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 F186B8FC18; Mon, 2 Mar 2009 04:35:52 +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 n224Zq98065322; Mon, 2 Mar 2009 04:35:52 GMT (envelope-from marcel@svn.freebsd.org) Received: (from marcel@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n224Zq5w065321; Mon, 2 Mar 2009 04:35:52 GMT (envelope-from marcel@svn.freebsd.org) Message-Id: <200903020435.n224Zq5w065321@svn.freebsd.org> From: Marcel Moolenaar Date: Mon, 2 Mar 2009 04:35: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: r189273 - head/usr.sbin/boot0cfg 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, 02 Mar 2009 04:35:55 -0000 Author: marcel Date: Mon Mar 2 04:35:52 2009 New Revision: 189273 URL: http://svn.freebsd.org/changeset/base/189273 Log: Write the MBR by using the bootcode verb of the gpart class. The "write MBR" verb is kept for backward compatibility, but the DIOCSMBR ioctl has been removed. Modified: head/usr.sbin/boot0cfg/boot0cfg.c Modified: head/usr.sbin/boot0cfg/boot0cfg.c ============================================================================== --- head/usr.sbin/boot0cfg/boot0cfg.c Mon Mar 2 04:12:41 2009 (r189272) +++ head/usr.sbin/boot0cfg/boot0cfg.c Mon Mar 2 04:35:52 2009 (r189273) @@ -343,9 +343,8 @@ read_mbr(const char *disk, u_int8_t **mb static void write_mbr(const char *fname, int flags, u_int8_t *mbr, int mbr_size) { - int fd, p; + int fd; ssize_t n; - char *s; const char *errmsg; char *pname; struct gctl_req *grq; @@ -359,6 +358,13 @@ write_mbr(const char *fname, int flags, return; } + /* + * If we're called to write to a backup file, don't try to + * write through GEOM. It only generates additional errors. + */ + if (flags != 0) + return; + /* Try open it read only. */ fd = open(fname, O_RDONLY); if (fd == -1) { @@ -370,39 +376,28 @@ write_mbr(const char *fname, int flags, warn("error getting providername for %s", fname); return; } - if (flags != 0) - err(1, "%s", fname); + grq = gctl_get_handle(); + gctl_ro_param(grq, "class", -1, "PART"); + gctl_ro_param(grq, "geom", -1, pname); + gctl_ro_param(grq, "verb", -1, "bootcode"); + gctl_ro_param(grq, "bootcode", mbr_size, mbr); + gctl_ro_param(grq, "flags", -1, "C"); + errmsg = gctl_issue(grq); + if (errmsg == NULL) + goto out; + grq = gctl_get_handle(); gctl_ro_param(grq, "verb", -1, "write MBR"); gctl_ro_param(grq, "class", -1, "MBR"); gctl_ro_param(grq, "geom", -1, pname); gctl_ro_param(grq, "data", mbr_size, mbr); errmsg = gctl_issue(grq); - if (errmsg == NULL) { - free(pname); - return; - } - warnx("%s: %s", fname, pname); + if (errmsg != NULL) + err(1, "write_mbr: %s", fname); + +out: free(pname); gctl_free(grq); - -#ifdef DIOCSMBR - for (p = 1; p < 5; p++) { - asprintf(&s, "%ss%d", fname, p); - fd = open(s, O_RDONLY); - if (fd < 0) { - free(s); - continue; - } - n = ioctl(fd, DIOCSMBR, (mbr)); - if (n != 0) - err(1, "%s: ioctl DIOCSMBR", fname); - close(fd); - free(s); - return; - } -#endif - err(1, "write_mbr: %s", fname); } /* From owner-svn-src-head@FreeBSD.ORG Mon Mar 2 05:07: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 BF9F9106564A; Mon, 2 Mar 2009 05:07: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 6FEE68FC0C; Mon, 2 Mar 2009 05:07: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 n225752b065887; Mon, 2 Mar 2009 05:07:05 GMT (envelope-from sam@svn.freebsd.org) Received: (from sam@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n22575fI065886; Mon, 2 Mar 2009 05:07:05 GMT (envelope-from sam@svn.freebsd.org) Message-Id: <200903020507.n22575fI065886@svn.freebsd.org> From: Sam Leffler Date: Mon, 2 Mar 2009 05:07: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: r189274 - head/tools/tools/ath/athstats 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, 02 Mar 2009 05:07:07 -0000 Author: sam Date: Mon Mar 2 05:07:05 2009 New Revision: 189274 URL: http://svn.freebsd.org/changeset/base/189274 Log: add -b option to suppress the banner Modified: head/tools/tools/ath/athstats/main.c Modified: head/tools/tools/ath/athstats/main.c ============================================================================== --- head/tools/tools/ath/athstats/main.c Mon Mar 2 04:35:52 2009 (r189273) +++ head/tools/tools/ath/athstats/main.c Mon Mar 2 05:07:05 2009 (r189274) @@ -33,7 +33,7 @@ * Simple Atheros-specific tool to inspect and monitor network traffic * statistics. * - * athstats [-i interface] [-z] [-l] [-o fmtstring] [interval] + * athstats [-i interface] [-bz] [-l] [-o fmtstring] [interval] * * (default interface is ath0). If interval is specified a rolling output * a la netstat -i is displayed every interval seconds. The format of @@ -89,14 +89,17 @@ main(int argc, char *argv[]) { struct athstatfoo *wf; const char *ifname; - int c; + int c, banner = 1; ifname = getenv("ATH"); if (ifname == NULL) ifname = "ath0"; wf = athstats_new(ifname, getfmt("default")); - while ((c = getopt(argc, argv, "i:lo:z")) != -1) { + while ((c = getopt(argc, argv, "bi:lo:z")) != -1) { switch (c) { + case 'b': + banner = 0; + break; case 'i': wf->setifname(wf, optarg); break; @@ -127,7 +130,8 @@ main(int argc, char *argv[]) signalled = 0; alarm(interval); banner: - wf->print_header(wf, stdout); + if (banner) + wf->print_header(wf, stdout); line = 0; loop: if (line != 0) { From owner-svn-src-head@FreeBSD.ORG Mon Mar 2 05:37: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 69F0E1065670; Mon, 2 Mar 2009 05:37:08 +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 551D28FC19; Mon, 2 Mar 2009 05:37:08 +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 n225b8RS066476; Mon, 2 Mar 2009 05:37:08 GMT (envelope-from thompsa@svn.freebsd.org) Received: (from thompsa@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n225b6QS066433; Mon, 2 Mar 2009 05:37:06 GMT (envelope-from thompsa@svn.freebsd.org) Message-Id: <200903020537.n225b6QS066433@svn.freebsd.org> From: Andrew Thompson Date: Mon, 2 Mar 2009 05:37: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: r189275 - in head/sys/dev: ata sound/usb usb usb/bluetooth usb/image usb/input usb/misc usb/net usb/serial usb/storage usb/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: Mon, 02 Mar 2009 05:37:08 -0000 Author: thompsa Date: Mon Mar 2 05:37:05 2009 New Revision: 189275 URL: http://svn.freebsd.org/changeset/base/189275 Log: Rename the ushub device class back to uhub as it was in the old usb stack, moused(8) looks for "uhub/ums" to decide if needs to load the module. Reported by: Garrett Cooper Modified: head/sys/dev/ata/ata-usb.c head/sys/dev/sound/usb/uaudio.c head/sys/dev/usb/bluetooth/ng_ubt.c head/sys/dev/usb/bluetooth/ubtbcmfw.c head/sys/dev/usb/image/uscanner.c head/sys/dev/usb/input/uhid.c head/sys/dev/usb/input/ukbd.c head/sys/dev/usb/input/ums.c head/sys/dev/usb/misc/udbp.c head/sys/dev/usb/misc/ufm.c head/sys/dev/usb/net/if_aue.c head/sys/dev/usb/net/if_axe.c head/sys/dev/usb/net/if_cdce.c head/sys/dev/usb/net/if_cue.c head/sys/dev/usb/net/if_kue.c head/sys/dev/usb/net/if_rue.c head/sys/dev/usb/net/if_udav.c head/sys/dev/usb/serial/u3g.c head/sys/dev/usb/serial/uark.c head/sys/dev/usb/serial/ubsa.c head/sys/dev/usb/serial/ubser.c head/sys/dev/usb/serial/uchcom.c head/sys/dev/usb/serial/ucycom.c head/sys/dev/usb/serial/ufoma.c head/sys/dev/usb/serial/uftdi.c head/sys/dev/usb/serial/ugensa.c head/sys/dev/usb/serial/uipaq.c head/sys/dev/usb/serial/ulpt.c head/sys/dev/usb/serial/umct.c head/sys/dev/usb/serial/umodem.c head/sys/dev/usb/serial/umoscom.c head/sys/dev/usb/serial/uplcom.c head/sys/dev/usb/serial/uslcom.c head/sys/dev/usb/serial/uvisor.c head/sys/dev/usb/serial/uvscom.c head/sys/dev/usb/storage/umass.c head/sys/dev/usb/storage/urio.c head/sys/dev/usb/storage/ustorage_fs.c head/sys/dev/usb/usb_compat_linux.c head/sys/dev/usb/usb_hub.c head/sys/dev/usb/wlan/if_rum.c head/sys/dev/usb/wlan/if_ural.c head/sys/dev/usb/wlan/if_zyd.c Modified: head/sys/dev/ata/ata-usb.c ============================================================================== --- head/sys/dev/ata/ata-usb.c Mon Mar 2 05:07:05 2009 (r189274) +++ head/sys/dev/ata/ata-usb.c Mon Mar 2 05:37:05 2009 (r189275) @@ -271,7 +271,7 @@ static driver_t atausb2_driver = { .size = sizeof(struct atausb2_softc), }; -DRIVER_MODULE(atausb, ushub, atausb2_driver, atausb2_devclass, 0, 0); +DRIVER_MODULE(atausb, uhub, atausb2_driver, atausb2_devclass, 0, 0); MODULE_DEPEND(atausb, usb, 1, 1, 1); MODULE_VERSION(atausb, 1); Modified: head/sys/dev/sound/usb/uaudio.c ============================================================================== --- head/sys/dev/sound/usb/uaudio.c Mon Mar 2 05:07:05 2009 (r189274) +++ head/sys/dev/sound/usb/uaudio.c Mon Mar 2 05:37:05 2009 (r189275) @@ -3742,7 +3742,7 @@ umidi_detach(device_t dev) return (0); } -DRIVER_MODULE(uaudio, ushub, uaudio_driver, uaudio_devclass, NULL, 0); +DRIVER_MODULE(uaudio, uhub, uaudio_driver, uaudio_devclass, NULL, 0); MODULE_DEPEND(uaudio, usb, 1, 1, 1); MODULE_DEPEND(uaudio, sound, SOUND_MINVER, SOUND_PREFVER, SOUND_MAXVER); MODULE_VERSION(uaudio, 1); Modified: head/sys/dev/usb/bluetooth/ng_ubt.c ============================================================================== --- head/sys/dev/usb/bluetooth/ng_ubt.c Mon Mar 2 05:07:05 2009 (r189274) +++ head/sys/dev/usb/bluetooth/ng_ubt.c Mon Mar 2 05:37:05 2009 (r189275) @@ -1710,7 +1710,7 @@ static driver_t ubt_driver = .size = sizeof(struct ubt_softc), }; -DRIVER_MODULE(ng_ubt, ushub, ubt_driver, ubt_devclass, ubt_modevent, 0); +DRIVER_MODULE(ng_ubt, uhub, ubt_driver, ubt_devclass, ubt_modevent, 0); MODULE_VERSION(ng_ubt, NG_BLUETOOTH_VERSION); MODULE_DEPEND(ng_ubt, netgraph, NG_ABI_VERSION, NG_ABI_VERSION, NG_ABI_VERSION); MODULE_DEPEND(ng_ubt, ng_hci, NG_BLUETOOTH_VERSION, NG_BLUETOOTH_VERSION, NG_BLUETOOTH_VERSION); Modified: head/sys/dev/usb/bluetooth/ubtbcmfw.c ============================================================================== --- head/sys/dev/usb/bluetooth/ubtbcmfw.c Mon Mar 2 05:07:05 2009 (r189274) +++ head/sys/dev/usb/bluetooth/ubtbcmfw.c Mon Mar 2 05:37:05 2009 (r189275) @@ -157,7 +157,7 @@ static driver_t ubtbcmfw_driver = .size = sizeof(struct ubtbcmfw_softc), }; -DRIVER_MODULE(ubtbcmfw, ushub, ubtbcmfw_driver, ubtbcmfw_devclass, NULL, 0); +DRIVER_MODULE(ubtbcmfw, uhub, ubtbcmfw_driver, ubtbcmfw_devclass, NULL, 0); MODULE_DEPEND(ubtbcmfw, usb, 1, 1, 1); /* Modified: head/sys/dev/usb/image/uscanner.c ============================================================================== --- head/sys/dev/usb/image/uscanner.c Mon Mar 2 05:07:05 2009 (r189274) +++ head/sys/dev/usb/image/uscanner.c Mon Mar 2 05:37:05 2009 (r189275) @@ -200,7 +200,7 @@ static driver_t uscanner_driver = { .size = sizeof(struct uscanner_softc), }; -DRIVER_MODULE(uscanner, ushub, uscanner_driver, uscanner_devclass, NULL, 0); +DRIVER_MODULE(uscanner, uhub, uscanner_driver, uscanner_devclass, NULL, 0); MODULE_DEPEND(uscanner, usb, 1, 1, 1); /* Modified: head/sys/dev/usb/input/uhid.c ============================================================================== --- head/sys/dev/usb/input/uhid.c Mon Mar 2 05:07:05 2009 (r189274) +++ head/sys/dev/usb/input/uhid.c Mon Mar 2 05:37:05 2009 (r189275) @@ -783,5 +783,5 @@ static driver_t uhid_driver = { .size = sizeof(struct uhid_softc), }; -DRIVER_MODULE(uhid, ushub, uhid_driver, uhid_devclass, NULL, 0); +DRIVER_MODULE(uhid, uhub, uhid_driver, uhid_devclass, NULL, 0); MODULE_DEPEND(uhid, usb, 1, 1, 1); Modified: head/sys/dev/usb/input/ukbd.c ============================================================================== --- head/sys/dev/usb/input/ukbd.c Mon Mar 2 05:07:05 2009 (r189274) +++ head/sys/dev/usb/input/ukbd.c Mon Mar 2 05:37:05 2009 (r189275) @@ -1485,5 +1485,5 @@ static driver_t ukbd_driver = { .size = sizeof(struct ukbd_softc), }; -DRIVER_MODULE(ukbd, ushub, ukbd_driver, ukbd_devclass, ukbd_driver_load, 0); +DRIVER_MODULE(ukbd, uhub, ukbd_driver, ukbd_devclass, ukbd_driver_load, 0); MODULE_DEPEND(ukbd, usb, 1, 1, 1); Modified: head/sys/dev/usb/input/ums.c ============================================================================== --- head/sys/dev/usb/input/ums.c Mon Mar 2 05:07:05 2009 (r189274) +++ head/sys/dev/usb/input/ums.c Mon Mar 2 05:37:05 2009 (r189275) @@ -858,5 +858,5 @@ static driver_t ums_driver = { .size = sizeof(struct ums_softc), }; -DRIVER_MODULE(ums, ushub, ums_driver, ums_devclass, NULL, 0); +DRIVER_MODULE(ums, uhub, ums_driver, ums_devclass, NULL, 0); MODULE_DEPEND(ums, usb, 1, 1, 1); Modified: head/sys/dev/usb/misc/udbp.c ============================================================================== --- head/sys/dev/usb/misc/udbp.c Mon Mar 2 05:07:05 2009 (r189274) +++ head/sys/dev/usb/misc/udbp.c Mon Mar 2 05:37:05 2009 (r189275) @@ -246,7 +246,7 @@ static driver_t udbp_driver = { .size = sizeof(struct udbp_softc), }; -DRIVER_MODULE(udbp, ushub, udbp_driver, udbp_devclass, udbp_modload, 0); +DRIVER_MODULE(udbp, uhub, udbp_driver, udbp_devclass, udbp_modload, 0); MODULE_DEPEND(udbp, netgraph, NG_ABI_VERSION, NG_ABI_VERSION, NG_ABI_VERSION); MODULE_DEPEND(udbp, usb, 1, 1, 1); Modified: head/sys/dev/usb/misc/ufm.c ============================================================================== --- head/sys/dev/usb/misc/ufm.c Mon Mar 2 05:07:05 2009 (r189274) +++ head/sys/dev/usb/misc/ufm.c Mon Mar 2 05:37:05 2009 (r189275) @@ -104,7 +104,7 @@ static driver_t ufm_driver = { .size = sizeof(struct ufm_softc), }; -DRIVER_MODULE(ufm, ushub, ufm_driver, ufm_devclass, NULL, 0); +DRIVER_MODULE(ufm, uhub, ufm_driver, ufm_devclass, NULL, 0); MODULE_DEPEND(ufm, usb, 1, 1, 1); static int Modified: head/sys/dev/usb/net/if_aue.c ============================================================================== --- head/sys/dev/usb/net/if_aue.c Mon Mar 2 05:07:05 2009 (r189274) +++ head/sys/dev/usb/net/if_aue.c Mon Mar 2 05:37:05 2009 (r189275) @@ -261,7 +261,7 @@ static driver_t aue_driver = { static devclass_t aue_devclass; -DRIVER_MODULE(aue, ushub, aue_driver, aue_devclass, NULL, 0); +DRIVER_MODULE(aue, uhub, aue_driver, aue_devclass, NULL, 0); DRIVER_MODULE(miibus, aue, miibus_driver, miibus_devclass, 0, 0); MODULE_DEPEND(aue, uether, 1, 1, 1); MODULE_DEPEND(aue, usb, 1, 1, 1); Modified: head/sys/dev/usb/net/if_axe.c ============================================================================== --- head/sys/dev/usb/net/if_axe.c Mon Mar 2 05:07:05 2009 (r189274) +++ head/sys/dev/usb/net/if_axe.c Mon Mar 2 05:37:05 2009 (r189275) @@ -238,7 +238,7 @@ static driver_t axe_driver = { static devclass_t axe_devclass; -DRIVER_MODULE(axe, ushub, axe_driver, axe_devclass, NULL, 0); +DRIVER_MODULE(axe, uhub, axe_driver, axe_devclass, NULL, 0); DRIVER_MODULE(miibus, axe, miibus_driver, miibus_devclass, 0, 0); MODULE_DEPEND(axe, uether, 1, 1, 1); MODULE_DEPEND(axe, usb, 1, 1, 1); Modified: head/sys/dev/usb/net/if_cdce.c ============================================================================== --- head/sys/dev/usb/net/if_cdce.c Mon Mar 2 05:07:05 2009 (r189274) +++ head/sys/dev/usb/net/if_cdce.c Mon Mar 2 05:37:05 2009 (r189275) @@ -176,7 +176,7 @@ static driver_t cdce_driver = { static devclass_t cdce_devclass; -DRIVER_MODULE(cdce, ushub, cdce_driver, cdce_devclass, NULL, 0); +DRIVER_MODULE(cdce, uhub, cdce_driver, cdce_devclass, NULL, 0); MODULE_VERSION(cdce, 1); MODULE_DEPEND(cdce, uether, 1, 1, 1); MODULE_DEPEND(cdce, usb, 1, 1, 1); Modified: head/sys/dev/usb/net/if_cue.c ============================================================================== --- head/sys/dev/usb/net/if_cue.c Mon Mar 2 05:07:05 2009 (r189274) +++ head/sys/dev/usb/net/if_cue.c Mon Mar 2 05:37:05 2009 (r189275) @@ -155,7 +155,7 @@ static driver_t cue_driver = { static devclass_t cue_devclass; -DRIVER_MODULE(cue, ushub, cue_driver, cue_devclass, NULL, 0); +DRIVER_MODULE(cue, uhub, cue_driver, cue_devclass, NULL, 0); MODULE_DEPEND(cue, uether, 1, 1, 1); MODULE_DEPEND(cue, usb, 1, 1, 1); MODULE_DEPEND(cue, ether, 1, 1, 1); Modified: head/sys/dev/usb/net/if_kue.c ============================================================================== --- head/sys/dev/usb/net/if_kue.c Mon Mar 2 05:07:05 2009 (r189274) +++ head/sys/dev/usb/net/if_kue.c Mon Mar 2 05:37:05 2009 (r189275) @@ -198,7 +198,7 @@ static driver_t kue_driver = { static devclass_t kue_devclass; -DRIVER_MODULE(kue, ushub, kue_driver, kue_devclass, NULL, 0); +DRIVER_MODULE(kue, uhub, kue_driver, kue_devclass, NULL, 0); MODULE_DEPEND(kue, uether, 1, 1, 1); MODULE_DEPEND(kue, usb, 1, 1, 1); MODULE_DEPEND(kue, ether, 1, 1, 1); Modified: head/sys/dev/usb/net/if_rue.c ============================================================================== --- head/sys/dev/usb/net/if_rue.c Mon Mar 2 05:07:05 2009 (r189274) +++ head/sys/dev/usb/net/if_rue.c Mon Mar 2 05:37:05 2009 (r189275) @@ -194,7 +194,7 @@ static driver_t rue_driver = { static devclass_t rue_devclass; -DRIVER_MODULE(rue, ushub, rue_driver, rue_devclass, NULL, 0); +DRIVER_MODULE(rue, uhub, rue_driver, rue_devclass, NULL, 0); DRIVER_MODULE(miibus, rue, miibus_driver, miibus_devclass, 0, 0); MODULE_DEPEND(rue, uether, 1, 1, 1); MODULE_DEPEND(rue, usb, 1, 1, 1); Modified: head/sys/dev/usb/net/if_udav.c ============================================================================== --- head/sys/dev/usb/net/if_udav.c Mon Mar 2 05:07:05 2009 (r189274) +++ head/sys/dev/usb/net/if_udav.c Mon Mar 2 05:37:05 2009 (r189275) @@ -154,7 +154,7 @@ static driver_t udav_driver = { static devclass_t udav_devclass; -DRIVER_MODULE(udav, ushub, udav_driver, udav_devclass, NULL, 0); +DRIVER_MODULE(udav, uhub, udav_driver, udav_devclass, NULL, 0); DRIVER_MODULE(miibus, udav, miibus_driver, miibus_devclass, 0, 0); MODULE_DEPEND(udav, uether, 1, 1, 1); MODULE_DEPEND(udav, usb, 1, 1, 1); Modified: head/sys/dev/usb/serial/u3g.c ============================================================================== --- head/sys/dev/usb/serial/u3g.c Mon Mar 2 05:07:05 2009 (r189274) +++ head/sys/dev/usb/serial/u3g.c Mon Mar 2 05:37:05 2009 (r189275) @@ -154,7 +154,7 @@ static driver_t u3g_driver = { .size = sizeof(struct u3g_softc), }; -DRIVER_MODULE(u3g, ushub, u3g_driver, u3g_devclass, u3g_driver_loaded, 0); +DRIVER_MODULE(u3g, uhub, u3g_driver, u3g_devclass, u3g_driver_loaded, 0); MODULE_DEPEND(u3g, ucom, 1, 1, 1); MODULE_DEPEND(u3g, usb, 1, 1, 1); Modified: head/sys/dev/usb/serial/uark.c ============================================================================== --- head/sys/dev/usb/serial/uark.c Mon Mar 2 05:07:05 2009 (r189274) +++ head/sys/dev/usb/serial/uark.c Mon Mar 2 05:37:05 2009 (r189275) @@ -148,7 +148,7 @@ static driver_t uark_driver = { .size = sizeof(struct uark_softc), }; -DRIVER_MODULE(uark, ushub, uark_driver, uark_devclass, NULL, 0); +DRIVER_MODULE(uark, uhub, uark_driver, uark_devclass, NULL, 0); MODULE_DEPEND(uark, ucom, 1, 1, 1); MODULE_DEPEND(uark, usb, 1, 1, 1); Modified: head/sys/dev/usb/serial/ubsa.c ============================================================================== --- head/sys/dev/usb/serial/ubsa.c Mon Mar 2 05:07:05 2009 (r189274) +++ head/sys/dev/usb/serial/ubsa.c Mon Mar 2 05:37:05 2009 (r189275) @@ -259,7 +259,7 @@ static driver_t ubsa_driver = { .size = sizeof(struct ubsa_softc), }; -DRIVER_MODULE(ubsa, ushub, ubsa_driver, ubsa_devclass, NULL, 0); +DRIVER_MODULE(ubsa, uhub, ubsa_driver, ubsa_devclass, NULL, 0); MODULE_DEPEND(ubsa, ucom, 1, 1, 1); MODULE_DEPEND(ubsa, usb, 1, 1, 1); Modified: head/sys/dev/usb/serial/ubser.c ============================================================================== --- head/sys/dev/usb/serial/ubser.c Mon Mar 2 05:07:05 2009 (r189274) +++ head/sys/dev/usb/serial/ubser.c Mon Mar 2 05:37:05 2009 (r189275) @@ -197,7 +197,7 @@ static driver_t ubser_driver = { .size = sizeof(struct ubser_softc), }; -DRIVER_MODULE(ubser, ushub, ubser_driver, ubser_devclass, NULL, 0); +DRIVER_MODULE(ubser, uhub, ubser_driver, ubser_devclass, NULL, 0); MODULE_DEPEND(ubser, ucom, 1, 1, 1); MODULE_DEPEND(ubser, usb, 1, 1, 1); Modified: head/sys/dev/usb/serial/uchcom.c ============================================================================== --- head/sys/dev/usb/serial/uchcom.c Mon Mar 2 05:07:05 2009 (r189274) +++ head/sys/dev/usb/serial/uchcom.c Mon Mar 2 05:37:05 2009 (r189275) @@ -882,6 +882,6 @@ static driver_t uchcom_driver = { static devclass_t uchcom_devclass; -DRIVER_MODULE(uchcom, ushub, uchcom_driver, uchcom_devclass, NULL, 0); +DRIVER_MODULE(uchcom, uhub, uchcom_driver, uchcom_devclass, NULL, 0); MODULE_DEPEND(uchcom, ucom, 1, 1, 1); MODULE_DEPEND(uchcom, usb, 1, 1, 1); Modified: head/sys/dev/usb/serial/ucycom.c ============================================================================== --- head/sys/dev/usb/serial/ucycom.c Mon Mar 2 05:07:05 2009 (r189274) +++ head/sys/dev/usb/serial/ucycom.c Mon Mar 2 05:37:05 2009 (r189275) @@ -161,7 +161,7 @@ static driver_t ucycom_driver = { .size = sizeof(struct ucycom_softc), }; -DRIVER_MODULE(ucycom, ushub, ucycom_driver, ucycom_devclass, NULL, 0); +DRIVER_MODULE(ucycom, uhub, ucycom_driver, ucycom_devclass, NULL, 0); MODULE_DEPEND(ucycom, ucom, 1, 1, 1); MODULE_DEPEND(ucycom, usb, 1, 1, 1); Modified: head/sys/dev/usb/serial/ufoma.c ============================================================================== --- head/sys/dev/usb/serial/ufoma.c Mon Mar 2 05:07:05 2009 (r189274) +++ head/sys/dev/usb/serial/ufoma.c Mon Mar 2 05:37:05 2009 (r189275) @@ -311,7 +311,7 @@ static driver_t ufoma_driver = { .size = sizeof(struct ufoma_softc), }; -DRIVER_MODULE(ufoma, ushub, ufoma_driver, ufoma_devclass, NULL, 0); +DRIVER_MODULE(ufoma, uhub, ufoma_driver, ufoma_devclass, NULL, 0); MODULE_DEPEND(ufoma, ucom, 1, 1, 1); MODULE_DEPEND(ufoma, usb, 1, 1, 1); Modified: head/sys/dev/usb/serial/uftdi.c ============================================================================== --- head/sys/dev/usb/serial/uftdi.c Mon Mar 2 05:07:05 2009 (r189274) +++ head/sys/dev/usb/serial/uftdi.c Mon Mar 2 05:37:05 2009 (r189275) @@ -196,7 +196,7 @@ static driver_t uftdi_driver = { .size = sizeof(struct uftdi_softc), }; -DRIVER_MODULE(uftdi, ushub, uftdi_driver, uftdi_devclass, NULL, 0); +DRIVER_MODULE(uftdi, uhub, uftdi_driver, uftdi_devclass, NULL, 0); MODULE_DEPEND(uftdi, ucom, 1, 1, 1); MODULE_DEPEND(uftdi, usb, 1, 1, 1); Modified: head/sys/dev/usb/serial/ugensa.c ============================================================================== --- head/sys/dev/usb/serial/ugensa.c Mon Mar 2 05:07:05 2009 (r189274) +++ head/sys/dev/usb/serial/ugensa.c Mon Mar 2 05:37:05 2009 (r189275) @@ -145,7 +145,7 @@ static driver_t ugensa_driver = { .size = sizeof(struct ugensa_softc), }; -DRIVER_MODULE(ugensa, ushub, ugensa_driver, ugensa_devclass, NULL, 0); +DRIVER_MODULE(ugensa, uhub, ugensa_driver, ugensa_devclass, NULL, 0); MODULE_DEPEND(ugensa, ucom, 1, 1, 1); MODULE_DEPEND(ugensa, usb, 1, 1, 1); Modified: head/sys/dev/usb/serial/uipaq.c ============================================================================== --- head/sys/dev/usb/serial/uipaq.c Mon Mar 2 05:07:05 2009 (r189274) +++ head/sys/dev/usb/serial/uipaq.c Mon Mar 2 05:37:05 2009 (r189275) @@ -1069,7 +1069,7 @@ static driver_t uipaq_driver = { .size = sizeof(struct uipaq_softc), }; -DRIVER_MODULE(uipaq, ushub, uipaq_driver, uipaq_devclass, NULL, 0); +DRIVER_MODULE(uipaq, uhub, uipaq_driver, uipaq_devclass, NULL, 0); MODULE_DEPEND(uipaq, ucom, 1, 1, 1); MODULE_DEPEND(uipaq, usb, 1, 1, 1); Modified: head/sys/dev/usb/serial/ulpt.c ============================================================================== --- head/sys/dev/usb/serial/ulpt.c Mon Mar 2 05:07:05 2009 (r189274) +++ head/sys/dev/usb/serial/ulpt.c Mon Mar 2 05:37:05 2009 (r189275) @@ -717,6 +717,6 @@ static driver_t ulpt_driver = { .size = sizeof(struct ulpt_softc), }; -DRIVER_MODULE(ulpt, ushub, ulpt_driver, ulpt_devclass, NULL, 0); +DRIVER_MODULE(ulpt, uhub, ulpt_driver, ulpt_devclass, NULL, 0); MODULE_DEPEND(ulpt, usb, 1, 1, 1); MODULE_DEPEND(ulpt, ucom, 1, 1, 1); Modified: head/sys/dev/usb/serial/umct.c ============================================================================== --- head/sys/dev/usb/serial/umct.c Mon Mar 2 05:07:05 2009 (r189274) +++ head/sys/dev/usb/serial/umct.c Mon Mar 2 05:37:05 2009 (r189275) @@ -200,7 +200,7 @@ static driver_t umct_driver = { .size = sizeof(struct umct_softc), }; -DRIVER_MODULE(umct, ushub, umct_driver, umct_devclass, NULL, 0); +DRIVER_MODULE(umct, uhub, umct_driver, umct_devclass, NULL, 0); MODULE_DEPEND(umct, ucom, 1, 1, 1); MODULE_DEPEND(umct, usb, 1, 1, 1); Modified: head/sys/dev/usb/serial/umodem.c ============================================================================== --- head/sys/dev/usb/serial/umodem.c Mon Mar 2 05:07:05 2009 (r189274) +++ head/sys/dev/usb/serial/umodem.c Mon Mar 2 05:37:05 2009 (r189275) @@ -244,7 +244,7 @@ static driver_t umodem_driver = { .size = sizeof(struct umodem_softc), }; -DRIVER_MODULE(umodem, ushub, umodem_driver, umodem_devclass, NULL, 0); +DRIVER_MODULE(umodem, uhub, umodem_driver, umodem_devclass, NULL, 0); MODULE_DEPEND(umodem, ucom, 1, 1, 1); MODULE_DEPEND(umodem, usb, 1, 1, 1); MODULE_VERSION(umodem, UMODEM_MODVER); Modified: head/sys/dev/usb/serial/umoscom.c ============================================================================== --- head/sys/dev/usb/serial/umoscom.c Mon Mar 2 05:07:05 2009 (r189274) +++ head/sys/dev/usb/serial/umoscom.c Mon Mar 2 05:37:05 2009 (r189275) @@ -261,7 +261,7 @@ static driver_t umoscom_driver = { .size = sizeof(struct umoscom_softc), }; -DRIVER_MODULE(umoscom, ushub, umoscom_driver, umoscom_devclass, NULL, 0); +DRIVER_MODULE(umoscom, uhub, umoscom_driver, umoscom_devclass, NULL, 0); MODULE_DEPEND(umoscom, ucom, 1, 1, 1); MODULE_DEPEND(umoscom, usb, 1, 1, 1); Modified: head/sys/dev/usb/serial/uplcom.c ============================================================================== --- head/sys/dev/usb/serial/uplcom.c Mon Mar 2 05:07:05 2009 (r189274) +++ head/sys/dev/usb/serial/uplcom.c Mon Mar 2 05:37:05 2009 (r189275) @@ -291,7 +291,7 @@ static driver_t uplcom_driver = { .size = sizeof(struct uplcom_softc), }; -DRIVER_MODULE(uplcom, ushub, uplcom_driver, uplcom_devclass, NULL, 0); +DRIVER_MODULE(uplcom, uhub, uplcom_driver, uplcom_devclass, NULL, 0); MODULE_DEPEND(uplcom, ucom, 1, 1, 1); MODULE_DEPEND(uplcom, usb, 1, 1, 1); MODULE_VERSION(uplcom, UPLCOM_MODVER); Modified: head/sys/dev/usb/serial/uslcom.c ============================================================================== --- head/sys/dev/usb/serial/uslcom.c Mon Mar 2 05:07:05 2009 (r189274) +++ head/sys/dev/usb/serial/uslcom.c Mon Mar 2 05:37:05 2009 (r189275) @@ -194,7 +194,7 @@ static driver_t uslcom_driver = { .size = sizeof(struct uslcom_softc), }; -DRIVER_MODULE(uslcom, ushub, uslcom_driver, uslcom_devclass, NULL, 0); +DRIVER_MODULE(uslcom, uhub, uslcom_driver, uslcom_devclass, NULL, 0); MODULE_DEPEND(uslcom, ucom, 1, 1, 1); MODULE_DEPEND(uslcom, usb, 1, 1, 1); MODULE_VERSION(uslcom, 1); Modified: head/sys/dev/usb/serial/uvisor.c ============================================================================== --- head/sys/dev/usb/serial/uvisor.c Mon Mar 2 05:07:05 2009 (r189274) +++ head/sys/dev/usb/serial/uvisor.c Mon Mar 2 05:37:05 2009 (r189275) @@ -235,7 +235,7 @@ static driver_t uvisor_driver = { .size = sizeof(struct uvisor_softc), }; -DRIVER_MODULE(uvisor, ushub, uvisor_driver, uvisor_devclass, NULL, 0); +DRIVER_MODULE(uvisor, uhub, uvisor_driver, uvisor_devclass, NULL, 0); MODULE_DEPEND(uvisor, ucom, 1, 1, 1); MODULE_DEPEND(uvisor, usb, 1, 1, 1); Modified: head/sys/dev/usb/serial/uvscom.c ============================================================================== --- head/sys/dev/usb/serial/uvscom.c Mon Mar 2 05:07:05 2009 (r189274) +++ head/sys/dev/usb/serial/uvscom.c Mon Mar 2 05:37:05 2009 (r189275) @@ -247,7 +247,7 @@ static driver_t uvscom_driver = { .size = sizeof(struct uvscom_softc), }; -DRIVER_MODULE(uvscom, ushub, uvscom_driver, uvscom_devclass, NULL, 0); +DRIVER_MODULE(uvscom, uhub, uvscom_driver, uvscom_devclass, NULL, 0); MODULE_DEPEND(uvscom, ucom, 1, 1, 1); MODULE_DEPEND(uvscom, usb, 1, 1, 1); MODULE_VERSION(uvscom, UVSCOM_MODVER); Modified: head/sys/dev/usb/storage/umass.c ============================================================================== --- head/sys/dev/usb/storage/umass.c Mon Mar 2 05:07:05 2009 (r189274) +++ head/sys/dev/usb/storage/umass.c Mon Mar 2 05:37:05 2009 (r189275) @@ -1281,7 +1281,7 @@ static driver_t umass_driver = { .size = sizeof(struct umass_softc), }; -DRIVER_MODULE(umass, ushub, umass_driver, umass_devclass, NULL, 0); +DRIVER_MODULE(umass, uhub, umass_driver, umass_devclass, NULL, 0); MODULE_DEPEND(umass, usb, 1, 1, 1); MODULE_DEPEND(umass, cam, 1, 1, 1); Modified: head/sys/dev/usb/storage/urio.c ============================================================================== --- head/sys/dev/usb/storage/urio.c Mon Mar 2 05:07:05 2009 (r189274) +++ head/sys/dev/usb/storage/urio.c Mon Mar 2 05:37:05 2009 (r189275) @@ -183,7 +183,7 @@ static driver_t urio_driver = { .size = sizeof(struct urio_softc), }; -DRIVER_MODULE(urio, ushub, urio_driver, urio_devclass, NULL, 0); +DRIVER_MODULE(urio, uhub, urio_driver, urio_devclass, NULL, 0); MODULE_DEPEND(urio, usb, 1, 1, 1); static int Modified: head/sys/dev/usb/storage/ustorage_fs.c ============================================================================== --- head/sys/dev/usb/storage/ustorage_fs.c Mon Mar 2 05:07:05 2009 (r189274) +++ head/sys/dev/usb/storage/ustorage_fs.c Mon Mar 2 05:37:05 2009 (r189275) @@ -229,7 +229,7 @@ static driver_t ustorage_fs_driver = { static devclass_t ustorage_fs_devclass; -DRIVER_MODULE(ustorage_fs, ushub, ustorage_fs_driver, ustorage_fs_devclass, NULL, 0); +DRIVER_MODULE(ustorage_fs, uhub, ustorage_fs_driver, ustorage_fs_devclass, NULL, 0); MODULE_VERSION(ustorage_fs, 0); MODULE_DEPEND(ustorage_fs, usb, 1, 1, 1); Modified: head/sys/dev/usb/usb_compat_linux.c ============================================================================== --- head/sys/dev/usb/usb_compat_linux.c Mon Mar 2 05:07:05 2009 (r189274) +++ head/sys/dev/usb/usb_compat_linux.c Mon Mar 2 05:37:05 2009 (r189275) @@ -106,7 +106,7 @@ static driver_t usb_linux_driver = { static devclass_t usb_linux_devclass; -DRIVER_MODULE(usb_linux, ushub, usb_linux_driver, usb_linux_devclass, NULL, 0); +DRIVER_MODULE(usb_linux, uhub, usb_linux_driver, usb_linux_devclass, NULL, 0); /*------------------------------------------------------------------------* * usb_linux_lookup_id Modified: head/sys/dev/usb/usb_hub.c ============================================================================== --- head/sys/dev/usb/usb_hub.c Mon Mar 2 05:07:05 2009 (r189274) +++ head/sys/dev/usb/usb_hub.c Mon Mar 2 05:37:05 2009 (r189275) @@ -126,7 +126,7 @@ static devclass_t uhub_devclass; static driver_t uhub_driver = { - .name = "ushub", + .name = "uhub", .methods = (device_method_t[]){ DEVMETHOD(device_probe, uhub_probe), DEVMETHOD(device_attach, uhub_attach), @@ -144,8 +144,8 @@ static driver_t uhub_driver = .size = sizeof(struct uhub_softc) }; -DRIVER_MODULE(ushub, usbus, uhub_driver, uhub_devclass, 0, 0); -DRIVER_MODULE(ushub, ushub, uhub_driver, uhub_devclass, NULL, 0); +DRIVER_MODULE(uhub, usbus, uhub_driver, uhub_devclass, 0, 0); +DRIVER_MODULE(uhub, uhub, uhub_driver, uhub_devclass, NULL, 0); static void uhub_intr_callback(struct usb2_xfer *xfer) Modified: head/sys/dev/usb/wlan/if_rum.c ============================================================================== --- head/sys/dev/usb/wlan/if_rum.c Mon Mar 2 05:07:05 2009 (r189274) +++ head/sys/dev/usb/wlan/if_rum.c Mon Mar 2 05:37:05 2009 (r189275) @@ -2538,4 +2538,4 @@ static driver_t rum_driver = { static devclass_t rum_devclass; -DRIVER_MODULE(rum, ushub, rum_driver, rum_devclass, NULL, 0); +DRIVER_MODULE(rum, uhub, rum_driver, rum_devclass, NULL, 0); Modified: head/sys/dev/usb/wlan/if_ural.c ============================================================================== --- head/sys/dev/usb/wlan/if_ural.c Mon Mar 2 05:07:05 2009 (r189274) +++ head/sys/dev/usb/wlan/if_ural.c Mon Mar 2 05:37:05 2009 (r189275) @@ -375,7 +375,7 @@ static driver_t ural_driver = { static devclass_t ural_devclass; -DRIVER_MODULE(ural, ushub, ural_driver, ural_devclass, NULL, 0); +DRIVER_MODULE(ural, uhub, ural_driver, ural_devclass, NULL, 0); MODULE_DEPEND(ural, usb, 1, 1, 1); MODULE_DEPEND(ural, wlan, 1, 1, 1); MODULE_DEPEND(ural, wlan_amrr, 1, 1, 1); Modified: head/sys/dev/usb/wlan/if_zyd.c ============================================================================== --- head/sys/dev/usb/wlan/if_zyd.c Mon Mar 2 05:07:05 2009 (r189274) +++ head/sys/dev/usb/wlan/if_zyd.c Mon Mar 2 05:37:05 2009 (r189275) @@ -3172,7 +3172,7 @@ static driver_t zyd_driver = { static devclass_t zyd_devclass; -DRIVER_MODULE(zyd, ushub, zyd_driver, zyd_devclass, NULL, 0); +DRIVER_MODULE(zyd, uhub, zyd_driver, zyd_devclass, NULL, 0); MODULE_DEPEND(zyd, usb, 1, 1, 1); MODULE_DEPEND(zyd, wlan, 1, 1, 1); MODULE_DEPEND(zyd, wlan_amrr, 1, 1, 1); From owner-svn-src-head@FreeBSD.ORG Mon Mar 2 05:41:39 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 AD44F106577D; Mon, 2 Mar 2009 05:41:39 +0000 (UTC) (envelope-from marcus@marcuscom.com) Received: from creme-brulee.marcuscom.com (marcuscom-pt.tunnel.tserv1.fmt.ipv6.he.net [IPv6:2001:470:1f00:ffff::1279]) by mx1.freebsd.org (Postfix) with ESMTP id CC4798FC21; Mon, 2 Mar 2009 05:41:37 +0000 (UTC) (envelope-from marcus@marcuscom.com) Received: from [IPv6:2001:470:1f00:2464::4] (shumai.marcuscom.com [IPv6:2001:470:1f00:2464::4]) by creme-brulee.marcuscom.com (8.14.3/8.14.3) with ESMTP id n225hPV2033756; Mon, 2 Mar 2009 00:43:25 -0500 (EST) (envelope-from marcus@marcuscom.com) From: Joe Marcus Clarke To: Andrew Thompson In-Reply-To: <200903020537.n225b6QS066433@svn.freebsd.org> References: <200903020537.n225b6QS066433@svn.freebsd.org> Content-Type: multipart/signed; micalg="pgp-sha1"; protocol="application/pgp-signature"; boundary="=-uYl9YD0Goksb95MX5tUF" Organization: MarcusCom, Inc. Date: Mon, 02 Mar 2009 00:41:36 -0500 Message-Id: <1235972496.31933.29.camel@shumai.marcuscom.com> Mime-Version: 1.0 X-Mailer: Evolution 2.24.5 FreeBSD GNOME Team Port X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,NO_RELAYS autolearn=ham version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on creme-brulee.marcuscom.com Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r189275 - in head/sys/dev: ata sound/usb usb usb/bluetooth usb/image usb/input usb/misc usb/net usb/serial usb/storage usb/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: Mon, 02 Mar 2009 05:41:41 -0000 --=-uYl9YD0Goksb95MX5tUF Content-Type: text/plain Content-Transfer-Encoding: quoted-printable On Mon, 2009-03-02 at 05:37 +0000, Andrew Thompson wrote: > Author: thompsa > Date: Mon Mar 2 05:37:05 2009 > New Revision: 189275 > URL: http://svn.freebsd.org/changeset/base/189275 >=20 > Log: > Rename the ushub device class back to uhub as it was in the old usb sta= ck, > moused(8) looks for "uhub/ums" to decide if needs to load the module. This breaks hal. Can you bump __FreeBSD_version? Joe > =20 > Reported by: Garrett Cooper >=20 > Modified: > head/sys/dev/ata/ata-usb.c > head/sys/dev/sound/usb/uaudio.c > head/sys/dev/usb/bluetooth/ng_ubt.c > head/sys/dev/usb/bluetooth/ubtbcmfw.c > head/sys/dev/usb/image/uscanner.c > head/sys/dev/usb/input/uhid.c > head/sys/dev/usb/input/ukbd.c > head/sys/dev/usb/input/ums.c > head/sys/dev/usb/misc/udbp.c > head/sys/dev/usb/misc/ufm.c > head/sys/dev/usb/net/if_aue.c > head/sys/dev/usb/net/if_axe.c > head/sys/dev/usb/net/if_cdce.c > head/sys/dev/usb/net/if_cue.c > head/sys/dev/usb/net/if_kue.c > head/sys/dev/usb/net/if_rue.c > head/sys/dev/usb/net/if_udav.c > head/sys/dev/usb/serial/u3g.c > head/sys/dev/usb/serial/uark.c > head/sys/dev/usb/serial/ubsa.c > head/sys/dev/usb/serial/ubser.c > head/sys/dev/usb/serial/uchcom.c > head/sys/dev/usb/serial/ucycom.c > head/sys/dev/usb/serial/ufoma.c > head/sys/dev/usb/serial/uftdi.c > head/sys/dev/usb/serial/ugensa.c > head/sys/dev/usb/serial/uipaq.c > head/sys/dev/usb/serial/ulpt.c > head/sys/dev/usb/serial/umct.c > head/sys/dev/usb/serial/umodem.c > head/sys/dev/usb/serial/umoscom.c > head/sys/dev/usb/serial/uplcom.c > head/sys/dev/usb/serial/uslcom.c > head/sys/dev/usb/serial/uvisor.c > head/sys/dev/usb/serial/uvscom.c > head/sys/dev/usb/storage/umass.c > head/sys/dev/usb/storage/urio.c > head/sys/dev/usb/storage/ustorage_fs.c > head/sys/dev/usb/usb_compat_linux.c > head/sys/dev/usb/usb_hub.c > head/sys/dev/usb/wlan/if_rum.c > head/sys/dev/usb/wlan/if_ural.c > head/sys/dev/usb/wlan/if_zyd.c >=20 > Modified: head/sys/dev/ata/ata-usb.c > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- head/sys/dev/ata/ata-usb.c Mon Mar 2 05:07:05 2009 (r189274) > +++ head/sys/dev/ata/ata-usb.c Mon Mar 2 05:37:05 2009 (r189275) > @@ -271,7 +271,7 @@ static driver_t atausb2_driver =3D { > .size =3D sizeof(struct atausb2_softc), > }; > =20 > -DRIVER_MODULE(atausb, ushub, atausb2_driver, atausb2_devclass, 0, 0); > +DRIVER_MODULE(atausb, uhub, atausb2_driver, atausb2_devclass, 0, 0); > MODULE_DEPEND(atausb, usb, 1, 1, 1); > MODULE_VERSION(atausb, 1); > =20 >=20 > Modified: head/sys/dev/sound/usb/uaudio.c > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- head/sys/dev/sound/usb/uaudio.c Mon Mar 2 05:07:05 2009 (r189274) > +++ head/sys/dev/sound/usb/uaudio.c Mon Mar 2 05:37:05 2009 (r189275) > @@ -3742,7 +3742,7 @@ umidi_detach(device_t dev) > return (0); > } > =20 > -DRIVER_MODULE(uaudio, ushub, uaudio_driver, uaudio_devclass, NULL, 0); > +DRIVER_MODULE(uaudio, uhub, uaudio_driver, uaudio_devclass, NULL, 0); > MODULE_DEPEND(uaudio, usb, 1, 1, 1); > MODULE_DEPEND(uaudio, sound, SOUND_MINVER, SOUND_PREFVER, SOUND_MAXVER); > MODULE_VERSION(uaudio, 1); >=20 > Modified: head/sys/dev/usb/bluetooth/ng_ubt.c > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- head/sys/dev/usb/bluetooth/ng_ubt.c Mon Mar 2 05:07:05 2009 (r189274= ) > +++ head/sys/dev/usb/bluetooth/ng_ubt.c Mon Mar 2 05:37:05 2009 (r189275= ) > @@ -1710,7 +1710,7 @@ static driver_t ubt_driver =3D > .size =3D sizeof(struct ubt_softc), > }; > =20 > -DRIVER_MODULE(ng_ubt, ushub, ubt_driver, ubt_devclass, ubt_modevent, 0); > +DRIVER_MODULE(ng_ubt, uhub, ubt_driver, ubt_devclass, ubt_modevent, 0); > MODULE_VERSION(ng_ubt, NG_BLUETOOTH_VERSION); > MODULE_DEPEND(ng_ubt, netgraph, NG_ABI_VERSION, NG_ABI_VERSION, NG_ABI_V= ERSION); > MODULE_DEPEND(ng_ubt, ng_hci, NG_BLUETOOTH_VERSION, NG_BLUETOOTH_VERSION= , NG_BLUETOOTH_VERSION); >=20 > Modified: head/sys/dev/usb/bluetooth/ubtbcmfw.c > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- head/sys/dev/usb/bluetooth/ubtbcmfw.c Mon Mar 2 05:07:05 2009 (r1892= 74) > +++ head/sys/dev/usb/bluetooth/ubtbcmfw.c Mon Mar 2 05:37:05 2009 (r1892= 75) > @@ -157,7 +157,7 @@ static driver_t ubtbcmfw_driver =3D > .size =3D sizeof(struct ubtbcmfw_softc), > }; > =20 > -DRIVER_MODULE(ubtbcmfw, ushub, ubtbcmfw_driver, ubtbcmfw_devclass, NULL,= 0); > +DRIVER_MODULE(ubtbcmfw, uhub, ubtbcmfw_driver, ubtbcmfw_devclass, NULL, = 0); > MODULE_DEPEND(ubtbcmfw, usb, 1, 1, 1); > =20 > /* >=20 > Modified: head/sys/dev/usb/image/uscanner.c > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- head/sys/dev/usb/image/uscanner.c Mon Mar 2 05:07:05 2009 (r189274) > +++ head/sys/dev/usb/image/uscanner.c Mon Mar 2 05:37:05 2009 (r189275) > @@ -200,7 +200,7 @@ static driver_t uscanner_driver =3D { > .size =3D sizeof(struct uscanner_softc), > }; > =20 > -DRIVER_MODULE(uscanner, ushub, uscanner_driver, uscanner_devclass, NULL,= 0); > +DRIVER_MODULE(uscanner, uhub, uscanner_driver, uscanner_devclass, NULL, = 0); > MODULE_DEPEND(uscanner, usb, 1, 1, 1); > =20 > /* >=20 > Modified: head/sys/dev/usb/input/uhid.c > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- head/sys/dev/usb/input/uhid.c Mon Mar 2 05:07:05 2009 (r189274) > +++ head/sys/dev/usb/input/uhid.c Mon Mar 2 05:37:05 2009 (r189275) > @@ -783,5 +783,5 @@ static driver_t uhid_driver =3D { > .size =3D sizeof(struct uhid_softc), > }; > =20 > -DRIVER_MODULE(uhid, ushub, uhid_driver, uhid_devclass, NULL, 0); > +DRIVER_MODULE(uhid, uhub, uhid_driver, uhid_devclass, NULL, 0); > MODULE_DEPEND(uhid, usb, 1, 1, 1); >=20 > Modified: head/sys/dev/usb/input/ukbd.c > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- head/sys/dev/usb/input/ukbd.c Mon Mar 2 05:07:05 2009 (r189274) > +++ head/sys/dev/usb/input/ukbd.c Mon Mar 2 05:37:05 2009 (r189275) > @@ -1485,5 +1485,5 @@ static driver_t ukbd_driver =3D { > .size =3D sizeof(struct ukbd_softc), > }; > =20 > -DRIVER_MODULE(ukbd, ushub, ukbd_driver, ukbd_devclass, ukbd_driver_load,= 0); > +DRIVER_MODULE(ukbd, uhub, ukbd_driver, ukbd_devclass, ukbd_driver_load, = 0); > MODULE_DEPEND(ukbd, usb, 1, 1, 1); >=20 > Modified: head/sys/dev/usb/input/ums.c > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- head/sys/dev/usb/input/ums.c Mon Mar 2 05:07:05 2009 (r189274) > +++ head/sys/dev/usb/input/ums.c Mon Mar 2 05:37:05 2009 (r189275) > @@ -858,5 +858,5 @@ static driver_t ums_driver =3D { > .size =3D sizeof(struct ums_softc), > }; > =20 > -DRIVER_MODULE(ums, ushub, ums_driver, ums_devclass, NULL, 0); > +DRIVER_MODULE(ums, uhub, ums_driver, ums_devclass, NULL, 0); > MODULE_DEPEND(ums, usb, 1, 1, 1); >=20 > Modified: head/sys/dev/usb/misc/udbp.c > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- head/sys/dev/usb/misc/udbp.c Mon Mar 2 05:07:05 2009 (r189274) > +++ head/sys/dev/usb/misc/udbp.c Mon Mar 2 05:37:05 2009 (r189275) > @@ -246,7 +246,7 @@ static driver_t udbp_driver =3D { > .size =3D sizeof(struct udbp_softc), > }; > =20 > -DRIVER_MODULE(udbp, ushub, udbp_driver, udbp_devclass, udbp_modload, 0); > +DRIVER_MODULE(udbp, uhub, udbp_driver, udbp_devclass, udbp_modload, 0); > MODULE_DEPEND(udbp, netgraph, NG_ABI_VERSION, NG_ABI_VERSION, NG_ABI_VER= SION); > MODULE_DEPEND(udbp, usb, 1, 1, 1); > =20 >=20 > Modified: head/sys/dev/usb/misc/ufm.c > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- head/sys/dev/usb/misc/ufm.c Mon Mar 2 05:07:05 2009 (r189274) > +++ head/sys/dev/usb/misc/ufm.c Mon Mar 2 05:37:05 2009 (r189275) > @@ -104,7 +104,7 @@ static driver_t ufm_driver =3D { > .size =3D sizeof(struct ufm_softc), > }; > =20 > -DRIVER_MODULE(ufm, ushub, ufm_driver, ufm_devclass, NULL, 0); > +DRIVER_MODULE(ufm, uhub, ufm_driver, ufm_devclass, NULL, 0); > MODULE_DEPEND(ufm, usb, 1, 1, 1); > =20 > static int >=20 > Modified: head/sys/dev/usb/net/if_aue.c > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- head/sys/dev/usb/net/if_aue.c Mon Mar 2 05:07:05 2009 (r189274) > +++ head/sys/dev/usb/net/if_aue.c Mon Mar 2 05:37:05 2009 (r189275) > @@ -261,7 +261,7 @@ static driver_t aue_driver =3D { > =20 > static devclass_t aue_devclass; > =20 > -DRIVER_MODULE(aue, ushub, aue_driver, aue_devclass, NULL, 0); > +DRIVER_MODULE(aue, uhub, aue_driver, aue_devclass, NULL, 0); > DRIVER_MODULE(miibus, aue, miibus_driver, miibus_devclass, 0, 0); > MODULE_DEPEND(aue, uether, 1, 1, 1); > MODULE_DEPEND(aue, usb, 1, 1, 1); >=20 > Modified: head/sys/dev/usb/net/if_axe.c > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- head/sys/dev/usb/net/if_axe.c Mon Mar 2 05:07:05 2009 (r189274) > +++ head/sys/dev/usb/net/if_axe.c Mon Mar 2 05:37:05 2009 (r189275) > @@ -238,7 +238,7 @@ static driver_t axe_driver =3D { > =20 > static devclass_t axe_devclass; > =20 > -DRIVER_MODULE(axe, ushub, axe_driver, axe_devclass, NULL, 0); > +DRIVER_MODULE(axe, uhub, axe_driver, axe_devclass, NULL, 0); > DRIVER_MODULE(miibus, axe, miibus_driver, miibus_devclass, 0, 0); > MODULE_DEPEND(axe, uether, 1, 1, 1); > MODULE_DEPEND(axe, usb, 1, 1, 1); >=20 > Modified: head/sys/dev/usb/net/if_cdce.c > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- head/sys/dev/usb/net/if_cdce.c Mon Mar 2 05:07:05 2009 (r189274) > +++ head/sys/dev/usb/net/if_cdce.c Mon Mar 2 05:37:05 2009 (r189275) > @@ -176,7 +176,7 @@ static driver_t cdce_driver =3D { > =20 > static devclass_t cdce_devclass; > =20 > -DRIVER_MODULE(cdce, ushub, cdce_driver, cdce_devclass, NULL, 0); > +DRIVER_MODULE(cdce, uhub, cdce_driver, cdce_devclass, NULL, 0); > MODULE_VERSION(cdce, 1); > MODULE_DEPEND(cdce, uether, 1, 1, 1); > MODULE_DEPEND(cdce, usb, 1, 1, 1); >=20 > Modified: head/sys/dev/usb/net/if_cue.c > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- head/sys/dev/usb/net/if_cue.c Mon Mar 2 05:07:05 2009 (r189274) > +++ head/sys/dev/usb/net/if_cue.c Mon Mar 2 05:37:05 2009 (r189275) > @@ -155,7 +155,7 @@ static driver_t cue_driver =3D { > =20 > static devclass_t cue_devclass; > =20 > -DRIVER_MODULE(cue, ushub, cue_driver, cue_devclass, NULL, 0); > +DRIVER_MODULE(cue, uhub, cue_driver, cue_devclass, NULL, 0); > MODULE_DEPEND(cue, uether, 1, 1, 1); > MODULE_DEPEND(cue, usb, 1, 1, 1); > MODULE_DEPEND(cue, ether, 1, 1, 1); >=20 > Modified: head/sys/dev/usb/net/if_kue.c > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- head/sys/dev/usb/net/if_kue.c Mon Mar 2 05:07:05 2009 (r189274) > +++ head/sys/dev/usb/net/if_kue.c Mon Mar 2 05:37:05 2009 (r189275) > @@ -198,7 +198,7 @@ static driver_t kue_driver =3D { > =20 > static devclass_t kue_devclass; > =20 > -DRIVER_MODULE(kue, ushub, kue_driver, kue_devclass, NULL, 0); > +DRIVER_MODULE(kue, uhub, kue_driver, kue_devclass, NULL, 0); > MODULE_DEPEND(kue, uether, 1, 1, 1); > MODULE_DEPEND(kue, usb, 1, 1, 1); > MODULE_DEPEND(kue, ether, 1, 1, 1); >=20 > Modified: head/sys/dev/usb/net/if_rue.c > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- head/sys/dev/usb/net/if_rue.c Mon Mar 2 05:07:05 2009 (r189274) > +++ head/sys/dev/usb/net/if_rue.c Mon Mar 2 05:37:05 2009 (r189275) > @@ -194,7 +194,7 @@ static driver_t rue_driver =3D { > =20 > static devclass_t rue_devclass; > =20 > -DRIVER_MODULE(rue, ushub, rue_driver, rue_devclass, NULL, 0); > +DRIVER_MODULE(rue, uhub, rue_driver, rue_devclass, NULL, 0); > DRIVER_MODULE(miibus, rue, miibus_driver, miibus_devclass, 0, 0); > MODULE_DEPEND(rue, uether, 1, 1, 1); > MODULE_DEPEND(rue, usb, 1, 1, 1); >=20 > Modified: head/sys/dev/usb/net/if_udav.c > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- head/sys/dev/usb/net/if_udav.c Mon Mar 2 05:07:05 2009 (r189274) > +++ head/sys/dev/usb/net/if_udav.c Mon Mar 2 05:37:05 2009 (r189275) > @@ -154,7 +154,7 @@ static driver_t udav_driver =3D { > =20 > static devclass_t udav_devclass; > =20 > -DRIVER_MODULE(udav, ushub, udav_driver, udav_devclass, NULL, 0); > +DRIVER_MODULE(udav, uhub, udav_driver, udav_devclass, NULL, 0); > DRIVER_MODULE(miibus, udav, miibus_driver, miibus_devclass, 0, 0); > MODULE_DEPEND(udav, uether, 1, 1, 1); > MODULE_DEPEND(udav, usb, 1, 1, 1); >=20 > Modified: head/sys/dev/usb/serial/u3g.c > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- head/sys/dev/usb/serial/u3g.c Mon Mar 2 05:07:05 2009 (r189274) > +++ head/sys/dev/usb/serial/u3g.c Mon Mar 2 05:37:05 2009 (r189275) > @@ -154,7 +154,7 @@ static driver_t u3g_driver =3D { > .size =3D sizeof(struct u3g_softc), > }; > =20 > -DRIVER_MODULE(u3g, ushub, u3g_driver, u3g_devclass, u3g_driver_loaded, 0= ); > +DRIVER_MODULE(u3g, uhub, u3g_driver, u3g_devclass, u3g_driver_loaded, 0)= ; > MODULE_DEPEND(u3g, ucom, 1, 1, 1); > MODULE_DEPEND(u3g, usb, 1, 1, 1); > =20 >=20 > Modified: head/sys/dev/usb/serial/uark.c > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- head/sys/dev/usb/serial/uark.c Mon Mar 2 05:07:05 2009 (r189274) > +++ head/sys/dev/usb/serial/uark.c Mon Mar 2 05:37:05 2009 (r189275) > @@ -148,7 +148,7 @@ static driver_t uark_driver =3D { > .size =3D sizeof(struct uark_softc), > }; > =20 > -DRIVER_MODULE(uark, ushub, uark_driver, uark_devclass, NULL, 0); > +DRIVER_MODULE(uark, uhub, uark_driver, uark_devclass, NULL, 0); > MODULE_DEPEND(uark, ucom, 1, 1, 1); > MODULE_DEPEND(uark, usb, 1, 1, 1); > =20 >=20 > Modified: head/sys/dev/usb/serial/ubsa.c > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- head/sys/dev/usb/serial/ubsa.c Mon Mar 2 05:07:05 2009 (r189274) > +++ head/sys/dev/usb/serial/ubsa.c Mon Mar 2 05:37:05 2009 (r189275) > @@ -259,7 +259,7 @@ static driver_t ubsa_driver =3D { > .size =3D sizeof(struct ubsa_softc), > }; > =20 > -DRIVER_MODULE(ubsa, ushub, ubsa_driver, ubsa_devclass, NULL, 0); > +DRIVER_MODULE(ubsa, uhub, ubsa_driver, ubsa_devclass, NULL, 0); > MODULE_DEPEND(ubsa, ucom, 1, 1, 1); > MODULE_DEPEND(ubsa, usb, 1, 1, 1); > =20 >=20 > Modified: head/sys/dev/usb/serial/ubser.c > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- head/sys/dev/usb/serial/ubser.c Mon Mar 2 05:07:05 2009 (r189274) > +++ head/sys/dev/usb/serial/ubser.c Mon Mar 2 05:37:05 2009 (r189275) > @@ -197,7 +197,7 @@ static driver_t ubser_driver =3D { > .size =3D sizeof(struct ubser_softc), > }; > =20 > -DRIVER_MODULE(ubser, ushub, ubser_driver, ubser_devclass, NULL, 0); > +DRIVER_MODULE(ubser, uhub, ubser_driver, ubser_devclass, NULL, 0); > MODULE_DEPEND(ubser, ucom, 1, 1, 1); > MODULE_DEPEND(ubser, usb, 1, 1, 1); > =20 >=20 > Modified: head/sys/dev/usb/serial/uchcom.c > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- head/sys/dev/usb/serial/uchcom.c Mon Mar 2 05:07:05 2009 (r189274) > +++ head/sys/dev/usb/serial/uchcom.c Mon Mar 2 05:37:05 2009 (r189275) > @@ -882,6 +882,6 @@ static driver_t uchcom_driver =3D { > =20 > static devclass_t uchcom_devclass; > =20 > -DRIVER_MODULE(uchcom, ushub, uchcom_driver, uchcom_devclass, NULL, 0); > +DRIVER_MODULE(uchcom, uhub, uchcom_driver, uchcom_devclass, NULL, 0); > MODULE_DEPEND(uchcom, ucom, 1, 1, 1); > MODULE_DEPEND(uchcom, usb, 1, 1, 1); >=20 > Modified: head/sys/dev/usb/serial/ucycom.c > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- head/sys/dev/usb/serial/ucycom.c Mon Mar 2 05:07:05 2009 (r189274) > +++ head/sys/dev/usb/serial/ucycom.c Mon Mar 2 05:37:05 2009 (r189275) > @@ -161,7 +161,7 @@ static driver_t ucycom_driver =3D { > .size =3D sizeof(struct ucycom_softc), > }; > =20 > -DRIVER_MODULE(ucycom, ushub, ucycom_driver, ucycom_devclass, NULL, 0); > +DRIVER_MODULE(ucycom, uhub, ucycom_driver, ucycom_devclass, NULL, 0); > MODULE_DEPEND(ucycom, ucom, 1, 1, 1); > MODULE_DEPEND(ucycom, usb, 1, 1, 1); > =20 >=20 > Modified: head/sys/dev/usb/serial/ufoma.c > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- head/sys/dev/usb/serial/ufoma.c Mon Mar 2 05:07:05 2009 (r189274) > +++ head/sys/dev/usb/serial/ufoma.c Mon Mar 2 05:37:05 2009 (r189275) > @@ -311,7 +311,7 @@ static driver_t ufoma_driver =3D { > .size =3D sizeof(struct ufoma_softc), > }; > =20 > -DRIVER_MODULE(ufoma, ushub, ufoma_driver, ufoma_devclass, NULL, 0); > +DRIVER_MODULE(ufoma, uhub, ufoma_driver, ufoma_devclass, NULL, 0); > MODULE_DEPEND(ufoma, ucom, 1, 1, 1); > MODULE_DEPEND(ufoma, usb, 1, 1, 1); > =20 >=20 > Modified: head/sys/dev/usb/serial/uftdi.c > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- head/sys/dev/usb/serial/uftdi.c Mon Mar 2 05:07:05 2009 (r189274) > +++ head/sys/dev/usb/serial/uftdi.c Mon Mar 2 05:37:05 2009 (r189275) > @@ -196,7 +196,7 @@ static driver_t uftdi_driver =3D { > .size =3D sizeof(struct uftdi_softc), > }; > =20 > -DRIVER_MODULE(uftdi, ushub, uftdi_driver, uftdi_devclass, NULL, 0); > +DRIVER_MODULE(uftdi, uhub, uftdi_driver, uftdi_devclass, NULL, 0); > MODULE_DEPEND(uftdi, ucom, 1, 1, 1); > MODULE_DEPEND(uftdi, usb, 1, 1, 1); > =20 >=20 > Modified: head/sys/dev/usb/serial/ugensa.c > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- head/sys/dev/usb/serial/ugensa.c Mon Mar 2 05:07:05 2009 (r189274) > +++ head/sys/dev/usb/serial/ugensa.c Mon Mar 2 05:37:05 2009 (r189275) > @@ -145,7 +145,7 @@ static driver_t ugensa_driver =3D { > .size =3D sizeof(struct ugensa_softc), > }; > =20 > -DRIVER_MODULE(ugensa, ushub, ugensa_driver, ugensa_devclass, NULL, 0); > +DRIVER_MODULE(ugensa, uhub, ugensa_driver, ugensa_devclass, NULL, 0); > MODULE_DEPEND(ugensa, ucom, 1, 1, 1); > MODULE_DEPEND(ugensa, usb, 1, 1, 1); > =20 >=20 > Modified: head/sys/dev/usb/serial/uipaq.c > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- head/sys/dev/usb/serial/uipaq.c Mon Mar 2 05:07:05 2009 (r189274) > +++ head/sys/dev/usb/serial/uipaq.c Mon Mar 2 05:37:05 2009 (r189275) > @@ -1069,7 +1069,7 @@ static driver_t uipaq_driver =3D { > .size =3D sizeof(struct uipaq_softc), > }; > =20 > -DRIVER_MODULE(uipaq, ushub, uipaq_driver, uipaq_devclass, NULL, 0); > +DRIVER_MODULE(uipaq, uhub, uipaq_driver, uipaq_devclass, NULL, 0); > MODULE_DEPEND(uipaq, ucom, 1, 1, 1); > MODULE_DEPEND(uipaq, usb, 1, 1, 1); > =20 >=20 > Modified: head/sys/dev/usb/serial/ulpt.c > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- head/sys/dev/usb/serial/ulpt.c Mon Mar 2 05:07:05 2009 (r189274) > +++ head/sys/dev/usb/serial/ulpt.c Mon Mar 2 05:37:05 2009 (r189275) > @@ -717,6 +717,6 @@ static driver_t ulpt_driver =3D { > .size =3D sizeof(struct ulpt_softc), > }; > =20 > -DRIVER_MODULE(ulpt, ushub, ulpt_driver, ulpt_devclass, NULL, 0); > +DRIVER_MODULE(ulpt, uhub, ulpt_driver, ulpt_devclass, NULL, 0); > MODULE_DEPEND(ulpt, usb, 1, 1, 1); > MODULE_DEPEND(ulpt, ucom, 1, 1, 1); >=20 > Modified: head/sys/dev/usb/serial/umct.c > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- head/sys/dev/usb/serial/umct.c Mon Mar 2 05:07:05 2009 (r189274) > +++ head/sys/dev/usb/serial/umct.c Mon Mar 2 05:37:05 2009 (r189275) > @@ -200,7 +200,7 @@ static driver_t umct_driver =3D { > .size =3D sizeof(struct umct_softc), > }; > =20 > -DRIVER_MODULE(umct, ushub, umct_driver, umct_devclass, NULL, 0); > +DRIVER_MODULE(umct, uhub, umct_driver, umct_devclass, NULL, 0); > MODULE_DEPEND(umct, ucom, 1, 1, 1); > MODULE_DEPEND(umct, usb, 1, 1, 1); > =20 >=20 > Modified: head/sys/dev/usb/serial/umodem.c > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- head/sys/dev/usb/serial/umodem.c Mon Mar 2 05:07:05 2009 (r189274) > +++ head/sys/dev/usb/serial/umodem.c Mon Mar 2 05:37:05 2009 (r189275) > @@ -244,7 +244,7 @@ static driver_t umodem_driver =3D { > .size =3D sizeof(struct umodem_softc), > }; > =20 > -DRIVER_MODULE(umodem, ushub, umodem_driver, umodem_devclass, NULL, 0); > +DRIVER_MODULE(umodem, uhub, umodem_driver, umodem_devclass, NULL, 0); > MODULE_DEPEND(umodem, ucom, 1, 1, 1); > MODULE_DEPEND(umodem, usb, 1, 1, 1); > MODULE_VERSION(umodem, UMODEM_MODVER); >=20 > Modified: head/sys/dev/usb/serial/umoscom.c > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- head/sys/dev/usb/serial/umoscom.c Mon Mar 2 05:07:05 2009 (r189274) > +++ head/sys/dev/usb/serial/umoscom.c Mon Mar 2 05:37:05 2009 (r189275) > @@ -261,7 +261,7 @@ static driver_t umoscom_driver =3D { > .size =3D sizeof(struct umoscom_softc), > }; > =20 > -DRIVER_MODULE(umoscom, ushub, umoscom_driver, umoscom_devclass, NULL, 0)= ; > +DRIVER_MODULE(umoscom, uhub, umoscom_driver, umoscom_devclass, NULL, 0); > MODULE_DEPEND(umoscom, ucom, 1, 1, 1); > MODULE_DEPEND(umoscom, usb, 1, 1, 1); > =20 >=20 > Modified: head/sys/dev/usb/serial/uplcom.c > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- head/sys/dev/usb/serial/uplcom.c Mon Mar 2 05:07:05 2009 (r189274) > +++ head/sys/dev/usb/serial/uplcom.c Mon Mar 2 05:37:05 2009 (r189275) > @@ -291,7 +291,7 @@ static driver_t uplcom_driver =3D { > .size =3D sizeof(struct uplcom_softc), > }; > =20 > -DRIVER_MODULE(uplcom, ushub, uplcom_driver, uplcom_devclass, NULL, 0); > +DRIVER_MODULE(uplcom, uhub, uplcom_driver, uplcom_devclass, NULL, 0); > MODULE_DEPEND(uplcom, ucom, 1, 1, 1); > MODULE_DEPEND(uplcom, usb, 1, 1, 1); > MODULE_VERSION(uplcom, UPLCOM_MODVER); >=20 > Modified: head/sys/dev/usb/serial/uslcom.c > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- head/sys/dev/usb/serial/uslcom.c Mon Mar 2 05:07:05 2009 (r189274) > +++ head/sys/dev/usb/serial/uslcom.c Mon Mar 2 05:37:05 2009 (r189275) > @@ -194,7 +194,7 @@ static driver_t uslcom_driver =3D { > .size =3D sizeof(struct uslcom_softc), > }; > =20 > -DRIVER_MODULE(uslcom, ushub, uslcom_driver, uslcom_devclass, NULL, 0); > +DRIVER_MODULE(uslcom, uhub, uslcom_driver, uslcom_devclass, NULL, 0); > MODULE_DEPEND(uslcom, ucom, 1, 1, 1); > MODULE_DEPEND(uslcom, usb, 1, 1, 1); > MODULE_VERSION(uslcom, 1); >=20 > Modified: head/sys/dev/usb/serial/uvisor.c > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- head/sys/dev/usb/serial/uvisor.c Mon Mar 2 05:07:05 2009 (r189274) > +++ head/sys/dev/usb/serial/uvisor.c Mon Mar 2 05:37:05 2009 (r189275) > @@ -235,7 +235,7 @@ static driver_t uvisor_driver =3D { > .size =3D sizeof(struct uvisor_softc), > }; > =20 > -DRIVER_MODULE(uvisor, ushub, uvisor_driver, uvisor_devclass, NULL, 0); > +DRIVER_MODULE(uvisor, uhub, uvisor_driver, uvisor_devclass, NULL, 0); > MODULE_DEPEND(uvisor, ucom, 1, 1, 1); > MODULE_DEPEND(uvisor, usb, 1, 1, 1); > =20 >=20 > Modified: head/sys/dev/usb/serial/uvscom.c > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- head/sys/dev/usb/serial/uvscom.c Mon Mar 2 05:07:05 2009 (r189274) > +++ head/sys/dev/usb/serial/uvscom.c Mon Mar 2 05:37:05 2009 (r189275) > @@ -247,7 +247,7 @@ static driver_t uvscom_driver =3D { > .size =3D sizeof(struct uvscom_softc), > }; > =20 > -DRIVER_MODULE(uvscom, ushub, uvscom_driver, uvscom_devclass, NULL, 0); > +DRIVER_MODULE(uvscom, uhub, uvscom_driver, uvscom_devclass, NULL, 0); > MODULE_DEPEND(uvscom, ucom, 1, 1, 1); > MODULE_DEPEND(uvscom, usb, 1, 1, 1); > MODULE_VERSION(uvscom, UVSCOM_MODVER); >=20 > Modified: head/sys/dev/usb/storage/umass.c > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- head/sys/dev/usb/storage/umass.c Mon Mar 2 05:07:05 2009 (r189274) > +++ head/sys/dev/usb/storage/umass.c Mon Mar 2 05:37:05 2009 (r189275) > @@ -1281,7 +1281,7 @@ static driver_t umass_driver =3D { > .size =3D sizeof(struct umass_softc), > }; > =20 > -DRIVER_MODULE(umass, ushub, umass_driver, umass_devclass, NULL, 0); > +DRIVER_MODULE(umass, uhub, umass_driver, umass_devclass, NULL, 0); > MODULE_DEPEND(umass, usb, 1, 1, 1); > MODULE_DEPEND(umass, cam, 1, 1, 1); > =20 >=20 > Modified: head/sys/dev/usb/storage/urio.c > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- head/sys/dev/usb/storage/urio.c Mon Mar 2 05:07:05 2009 (r189274) > +++ head/sys/dev/usb/storage/urio.c Mon Mar 2 05:37:05 2009 (r189275) > @@ -183,7 +183,7 @@ static driver_t urio_driver =3D { > .size =3D sizeof(struct urio_softc), > }; > =20 > -DRIVER_MODULE(urio, ushub, urio_driver, urio_devclass, NULL, 0); > +DRIVER_MODULE(urio, uhub, urio_driver, urio_devclass, NULL, 0); > MODULE_DEPEND(urio, usb, 1, 1, 1); > =20 > static int >=20 > Modified: head/sys/dev/usb/storage/ustorage_fs.c > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- head/sys/dev/usb/storage/ustorage_fs.c Mon Mar 2 05:07:05 2009 (r189= 274) > +++ head/sys/dev/usb/storage/ustorage_fs.c Mon Mar 2 05:37:05 2009 (r189= 275) > @@ -229,7 +229,7 @@ static driver_t ustorage_fs_driver =3D { > =20 > static devclass_t ustorage_fs_devclass; > =20 > -DRIVER_MODULE(ustorage_fs, ushub, ustorage_fs_driver, ustorage_fs_devcla= ss, NULL, 0); > +DRIVER_MODULE(ustorage_fs, uhub, ustorage_fs_driver, ustorage_fs_devclas= s, NULL, 0); > MODULE_VERSION(ustorage_fs, 0); > MODULE_DEPEND(ustorage_fs, usb, 1, 1, 1); > =20 >=20 > Modified: head/sys/dev/usb/usb_compat_linux.c > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- head/sys/dev/usb/usb_compat_linux.c Mon Mar 2 05:07:05 2009 (r189274= ) > +++ head/sys/dev/usb/usb_compat_linux.c Mon Mar 2 05:37:05 2009 (r189275= ) > @@ -106,7 +106,7 @@ static driver_t usb_linux_driver =3D { > =20 > static devclass_t usb_linux_devclass; > =20 > -DRIVER_MODULE(usb_linux, ushub, usb_linux_driver, usb_linux_devclass, NU= LL, 0); > +DRIVER_MODULE(usb_linux, uhub, usb_linux_driver, usb_linux_devclass, NUL= L, 0); > =20 > /*----------------------------------------------------------------------= --* > * usb_linux_lookup_id >=20 > Modified: head/sys/dev/usb/usb_hub.c > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- head/sys/dev/usb/usb_hub.c Mon Mar 2 05:07:05 2009 (r189274) > +++ head/sys/dev/usb/usb_hub.c Mon Mar 2 05:37:05 2009 (r189275) > @@ -126,7 +126,7 @@ static devclass_t uhub_devclass; > =20 > static driver_t uhub_driver =3D > { > - .name =3D "ushub", > + .name =3D "uhub", > .methods =3D (device_method_t[]){ > DEVMETHOD(device_probe, uhub_probe), > DEVMETHOD(device_attach, uhub_attach), > @@ -144,8 +144,8 @@ static driver_t uhub_driver =3D > .size =3D sizeof(struct uhub_softc) > }; > =20 > -DRIVER_MODULE(ushub, usbus, uhub_driver, uhub_devclass, 0, 0); > -DRIVER_MODULE(ushub, ushub, uhub_driver, uhub_devclass, NULL, 0); > +DRIVER_MODULE(uhub, usbus, uhub_driver, uhub_devclass, 0, 0); > +DRIVER_MODULE(uhub, uhub, uhub_driver, uhub_devclass, NULL, 0); > =20 > static void > uhub_intr_callback(struct usb2_xfer *xfer) >=20 > Modified: head/sys/dev/usb/wlan/if_rum.c > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- head/sys/dev/usb/wlan/if_rum.c Mon Mar 2 05:07:05 2009 (r189274) > +++ head/sys/dev/usb/wlan/if_rum.c Mon Mar 2 05:37:05 2009 (r189275) > @@ -2538,4 +2538,4 @@ static driver_t rum_driver =3D { > =20 > static devclass_t rum_devclass; > =20 > -DRIVER_MODULE(rum, ushub, rum_driver, rum_devclass, NULL, 0); > +DRIVER_MODULE(rum, uhub, rum_driver, rum_devclass, NULL, 0); >=20 > Modified: head/sys/dev/usb/wlan/if_ural.c > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- head/sys/dev/usb/wlan/if_ural.c Mon Mar 2 05:07:05 2009 (r189274) > +++ head/sys/dev/usb/wlan/if_ural.c Mon Mar 2 05:37:05 2009 (r189275) > @@ -375,7 +375,7 @@ static driver_t ural_driver =3D { > =20 > static devclass_t ural_devclass; > =20 > -DRIVER_MODULE(ural, ushub, ural_driver, ural_devclass, NULL, 0); > +DRIVER_MODULE(ural, uhub, ural_driver, ural_devclass, NULL, 0); > MODULE_DEPEND(ural, usb, 1, 1, 1); > MODULE_DEPEND(ural, wlan, 1, 1, 1); > MODULE_DEPEND(ural, wlan_amrr, 1, 1, 1); >=20 > Modified: head/sys/dev/usb/wlan/if_zyd.c > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- head/sys/dev/usb/wlan/if_zyd.c Mon Mar 2 05:07:05 2009 (r189274) > +++ head/sys/dev/usb/wlan/if_zyd.c Mon Mar 2 05:37:05 2009 (r189275) > @@ -3172,7 +3172,7 @@ static driver_t zyd_driver =3D { > =20 > static devclass_t zyd_devclass; > =20 > -DRIVER_MODULE(zyd, ushub, zyd_driver, zyd_devclass, NULL, 0); > +DRIVER_MODULE(zyd, uhub, zyd_driver, zyd_devclass, NULL, 0); > MODULE_DEPEND(zyd, usb, 1, 1, 1); > MODULE_DEPEND(zyd, wlan, 1, 1, 1); > MODULE_DEPEND(zyd, wlan_amrr, 1, 1, 1); > _______________________________________________ > svn-src-all@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/svn-src-all > To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org" >=20 --=20 PGP Key : http://www.marcuscom.com/pgp.asc --=-uYl9YD0Goksb95MX5tUF Content-Type: application/pgp-signature; name="signature.asc" Content-Description: This is a digitally signed message part -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (FreeBSD) iEYEABECAAYFAkmrcY8ACgkQb2iPiv4Uz4dO/QCfevv/TJtKM21PlKIBmD7IqlVE 5qcAn3O0QvgwHegfjkqGKh5PVpygehBV =186O -----END PGP SIGNATURE----- --=-uYl9YD0Goksb95MX5tUF-- From owner-svn-src-head@FreeBSD.ORG Mon Mar 2 05:46: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 5B783106566C; Mon, 2 Mar 2009 05:46:26 +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 4AA898FC12; Mon, 2 Mar 2009 05:46:26 +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 n225kPKS066688; Mon, 2 Mar 2009 05:46:25 GMT (envelope-from thompsa@svn.freebsd.org) Received: (from thompsa@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n225kP4O066687; Mon, 2 Mar 2009 05:46:25 GMT (envelope-from thompsa@svn.freebsd.org) Message-Id: <200903020546.n225kP4O066687@svn.freebsd.org> From: Andrew Thompson Date: Mon, 2 Mar 2009 05:46:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r189276 - 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: Mon, 02 Mar 2009 05:46:26 -0000 Author: thompsa Date: Mon Mar 2 05:46:25 2009 New Revision: 189276 URL: http://svn.freebsd.org/changeset/base/189276 Log: Bump __FreeBSD_version for the ushub to uhub rename. Requested by: marcus Modified: head/sys/sys/param.h Modified: head/sys/sys/param.h ============================================================================== --- head/sys/sys/param.h Mon Mar 2 05:37:05 2009 (r189275) +++ head/sys/sys/param.h Mon Mar 2 05:46:25 2009 (r189276) @@ -57,7 +57,7 @@ * is created, otherwise 1. */ #undef __FreeBSD_version -#define __FreeBSD_version 800067 /* Master, propagated to newvers */ +#define __FreeBSD_version 800068 /* Master, propagated to newvers */ #ifndef LOCORE #include From owner-svn-src-head@FreeBSD.ORG Mon Mar 2 05:46: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 361FE106566B; Mon, 2 Mar 2009 05:46:53 +0000 (UTC) (envelope-from yanefbsd@gmail.com) Received: from mail-gx0-f176.google.com (mail-gx0-f176.google.com [209.85.217.176]) by mx1.freebsd.org (Postfix) with ESMTP id A6F418FC1C; Mon, 2 Mar 2009 05:46:52 +0000 (UTC) (envelope-from yanefbsd@gmail.com) Received: by gxk24 with SMTP id 24so5131454gxk.19 for ; Sun, 01 Mar 2009 21:46:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=qTfX+7lJ9rCdWJplfup/hSkpatwtAYtt77G7HiIhZ3c=; b=CPbIEt3mRRulNDz9QsrO4pYtDl4UffPHS1cMjlmHGvuw8CuvxQc/sm3MRNvNlubmQT TTAdeSOPDZ8PIfbXPd4QZOnFz5O5jSV6+P+CJNB07ISzbogUSta9gjw+F0tddlg4q2GI h02Xvt2iqi3FPUwizn2y4vbANr2Z6/KX+ScEE= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; b=TVM775O+n0kZufhTf5t5S3DjXbIBcTmq7sIudaZsXUuLyyyU3sqGOr3WFwI9Su3sMt zM0XypYp9wK7hnmb/DH/Nh1XRZusv7SF1TfHgDLNlmCGpOCC7kwbxqF1Gt79jqBTGrIr PFk5StcYRP1qGrI+vKDbB7APoTfwJzKMhXwnU= MIME-Version: 1.0 Received: by 10.90.53.5 with SMTP id b5mr2505813aga.56.1235972812072; Sun, 01 Mar 2009 21:46:52 -0800 (PST) In-Reply-To: <1235972496.31933.29.camel@shumai.marcuscom.com> References: <200903020537.n225b6QS066433@svn.freebsd.org> <1235972496.31933.29.camel@shumai.marcuscom.com> Date: Sun, 1 Mar 2009 21:46:52 -0800 Message-ID: <7d6fde3d0903012146r7696d91ev599dd11d08ef982f@mail.gmail.com> From: Garrett Cooper To: Joe Marcus Clarke Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Andrew Thompson Subject: Re: svn commit: r189275 - in head/sys/dev: ata sound/usb usb usb/bluetooth usb/image usb/input usb/misc usb/net usb/serial usb/storage usb/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: Mon, 02 Mar 2009 05:46:53 -0000 On Sun, Mar 1, 2009 at 9:41 PM, Joe Marcus Clarke wr= ote: > On Mon, 2009-03-02 at 05:37 +0000, Andrew Thompson wrote: >> Author: thompsa >> Date: Mon Mar =A02 05:37:05 2009 >> New Revision: 189275 >> URL: http://svn.freebsd.org/changeset/base/189275 >> >> Log: >> =A0 Rename the ushub device class back to uhub as it was in the old usb = stack, >> =A0 moused(8) looks for "uhub/ums" to decide if needs to load the module= . > > This breaks hal. =A0Can you bump __FreeBSD_version? > > Joe How does this break hal? -Garrett From owner-svn-src-head@FreeBSD.ORG Mon Mar 2 05:50: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 5254A106564A; Mon, 2 Mar 2009 05:50:09 +0000 (UTC) (envelope-from marcus@marcuscom.com) Received: from creme-brulee.marcuscom.com (marcuscom-pt.tunnel.tserv1.fmt.ipv6.he.net [IPv6:2001:470:1f00:ffff::1279]) by mx1.freebsd.org (Postfix) with ESMTP id CE15B8FC08; Mon, 2 Mar 2009 05:50:08 +0000 (UTC) (envelope-from marcus@marcuscom.com) Received: from [IPv6:2001:470:1f00:2464::4] (shumai.marcuscom.com [IPv6:2001:470:1f00:2464::4]) by creme-brulee.marcuscom.com (8.14.3/8.14.3) with ESMTP id n225puXV033853; Mon, 2 Mar 2009 00:51:56 -0500 (EST) (envelope-from marcus@marcuscom.com) From: Joe Marcus Clarke To: Garrett Cooper In-Reply-To: <7d6fde3d0903012146r7696d91ev599dd11d08ef982f@mail.gmail.com> References: <200903020537.n225b6QS066433@svn.freebsd.org> <1235972496.31933.29.camel@shumai.marcuscom.com> <7d6fde3d0903012146r7696d91ev599dd11d08ef982f@mail.gmail.com> Content-Type: multipart/signed; micalg="pgp-sha1"; protocol="application/pgp-signature"; boundary="=-MrcPwZdsJHhuM6iD/lnl" Organization: MarcusCom, Inc. Date: Mon, 02 Mar 2009 00:50:08 -0500 Message-Id: <1235973008.31933.32.camel@shumai.marcuscom.com> Mime-Version: 1.0 X-Mailer: Evolution 2.24.5 FreeBSD GNOME Team Port X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,NO_RELAYS autolearn=ham version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on creme-brulee.marcuscom.com Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Andrew Thompson Subject: Re: svn commit: r189275 - in head/sys/dev: ata sound/usb usb usb/bluetooth usb/image usb/input usb/misc usb/net usb/serial usb/storage usb/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: Mon, 02 Mar 2009 05:50:09 -0000 --=-MrcPwZdsJHhuM6iD/lnl Content-Type: text/plain Content-Transfer-Encoding: quoted-printable On Sun, 2009-03-01 at 21:46 -0800, Garrett Cooper wrote: > On Sun, Mar 1, 2009 at 9:41 PM, Joe Marcus Clarke = wrote: > > On Mon, 2009-03-02 at 05:37 +0000, Andrew Thompson wrote: > >> Author: thompsa > >> Date: Mon Mar 2 05:37:05 2009 > >> New Revision: 189275 > >> URL: http://svn.freebsd.org/changeset/base/189275 > >> > >> Log: > >> Rename the ushub device class back to uhub as it was in the old usb = stack, > >> moused(8) looks for "uhub/ums" to decide if needs to load the module= . > > > > This breaks hal. Can you bump __FreeBSD_version? > > > > Joe >=20 > How does this break hal? I was using ushub as a usb2 identifier to plug usb devices into the hal device tree. Simply adding uhub would cause problems with oldusb. Since Andrew just bumped __FreeBSD_version, I can adjust as needed. Joe --=20 PGP Key : http://www.marcuscom.com/pgp.asc --=-MrcPwZdsJHhuM6iD/lnl Content-Type: application/pgp-signature; name="signature.asc" Content-Description: This is a digitally signed message part -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (FreeBSD) iEYEABECAAYFAkmrc48ACgkQb2iPiv4Uz4ciVwCdHYD1ceLCKk1iTyUQOomWetuA XVMAn3CjIn8qSpSkfKon1PYL+c4UfHM6 =AaqH -----END PGP SIGNATURE----- --=-MrcPwZdsJHhuM6iD/lnl-- From owner-svn-src-head@FreeBSD.ORG Mon Mar 2 05:51: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 318CF106566B; Mon, 2 Mar 2009 05:51:15 +0000 (UTC) (envelope-from yanefbsd@gmail.com) Received: from mail-gx0-f176.google.com (mail-gx0-f176.google.com [209.85.217.176]) by mx1.freebsd.org (Postfix) with ESMTP id 8CA8D8FC12; Mon, 2 Mar 2009 05:51:14 +0000 (UTC) (envelope-from yanefbsd@gmail.com) Received: by gxk24 with SMTP id 24so5133508gxk.19 for ; Sun, 01 Mar 2009 21:51:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=8EEAE3MaP3I/HMvpLEsfOHgAvChFahTGBQdsNs1nYW0=; b=MAwbeMsRK8Hwo0VVN6A+bLiKoXB2PFP87ghXG+Yze7Ii+3aOjgrhpErye/n2QE870D TLx78gfT3yAl8fm5ROT3ft8AdbXlS/4zUlUVu7RwelLa5uCAqkwCQABdQ9qYnrVzaUAF P1eOJlMsVifWvHnCNemPLO4Wz1xbPmPmq1SB8= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; b=kHYjNx+NI3kVi8NnaTx8yZij1RV4GVaKmaOQbHwssA/Q2oOl04a5FlrmwuFK2hXZUz KaA9K8291L9D7YEjR+id8jlPNU7XA8i189T9qkTjC4Fr+sMokcLCc1PqXlhpsXdiJn9c fV4k+wSvtQtrl2khTVGlb9USMAE07HUlgMDb8= MIME-Version: 1.0 Received: by 10.90.56.17 with SMTP id e17mr641559aga.74.1235973074001; Sun, 01 Mar 2009 21:51:14 -0800 (PST) In-Reply-To: <1235973008.31933.32.camel@shumai.marcuscom.com> References: <200903020537.n225b6QS066433@svn.freebsd.org> <1235972496.31933.29.camel@shumai.marcuscom.com> <7d6fde3d0903012146r7696d91ev599dd11d08ef982f@mail.gmail.com> <1235973008.31933.32.camel@shumai.marcuscom.com> Date: Sun, 1 Mar 2009 21:51:13 -0800 Message-ID: <7d6fde3d0903012151hfe698d8he39c9c3596c723c2@mail.gmail.com> From: Garrett Cooper To: Joe Marcus Clarke Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Andrew Thompson Subject: Re: svn commit: r189275 - in head/sys/dev: ata sound/usb usb usb/bluetooth usb/image usb/input usb/misc usb/net usb/serial usb/storage usb/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: Mon, 02 Mar 2009 05:51:15 -0000 On Sun, Mar 1, 2009 at 9:50 PM, Joe Marcus Clarke wr= ote: > On Sun, 2009-03-01 at 21:46 -0800, Garrett Cooper wrote: >> On Sun, Mar 1, 2009 at 9:41 PM, Joe Marcus Clarke = wrote: >> > On Mon, 2009-03-02 at 05:37 +0000, Andrew Thompson wrote: >> >> Author: thompsa >> >> Date: Mon Mar =A02 05:37:05 2009 >> >> New Revision: 189275 >> >> URL: http://svn.freebsd.org/changeset/base/189275 >> >> >> >> Log: >> >> =A0 Rename the ushub device class back to uhub as it was in the old u= sb stack, >> >> =A0 moused(8) looks for "uhub/ums" to decide if needs to load the mod= ule. >> > >> > This breaks hal. =A0Can you bump __FreeBSD_version? >> > >> > Joe >> >> How does this break hal? > > I was using ushub as a usb2 identifier to plug usb devices into the hal > device tree. =A0Simply adding uhub would cause problems with oldusb. > Since Andrew just bumped __FreeBSD_version, I can adjust as needed. > > Joe Ok, fair enough -- thanks for the info :). -Garrett From owner-svn-src-head@FreeBSD.ORG Mon Mar 2 05:52:39 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 C4B2A106566C; Mon, 2 Mar 2009 05:52:39 +0000 (UTC) (envelope-from marcus@marcuscom.com) Received: from creme-brulee.marcuscom.com (marcuscom-pt.tunnel.tserv1.fmt.ipv6.he.net [IPv6:2001:470:1f00:ffff::1279]) by mx1.freebsd.org (Postfix) with ESMTP id 5FE8B8FC1A; Mon, 2 Mar 2009 05:52:39 +0000 (UTC) (envelope-from marcus@marcuscom.com) Received: from [IPv6:2001:470:1f00:2464::4] (shumai.marcuscom.com [IPv6:2001:470:1f00:2464::4]) by creme-brulee.marcuscom.com (8.14.3/8.14.3) with ESMTP id n225sQgS033877; Mon, 2 Mar 2009 00:54:26 -0500 (EST) (envelope-from marcus@marcuscom.com) From: Joe Marcus Clarke To: Andrew Thompson In-Reply-To: <200903020546.n225kP4O066687@svn.freebsd.org> References: <200903020546.n225kP4O066687@svn.freebsd.org> Content-Type: multipart/signed; micalg="pgp-sha1"; protocol="application/pgp-signature"; boundary="=-YTXbirfA0QIBHG8pvp4m" Organization: MarcusCom, Inc. Date: Mon, 02 Mar 2009 00:52:38 -0500 Message-Id: <1235973158.31933.33.camel@shumai.marcuscom.com> Mime-Version: 1.0 X-Mailer: Evolution 2.24.5 FreeBSD GNOME Team Port X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,NO_RELAYS autolearn=ham version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on creme-brulee.marcuscom.com Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r189276 - 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: Mon, 02 Mar 2009 05:52:40 -0000 --=-YTXbirfA0QIBHG8pvp4m Content-Type: text/plain Content-Transfer-Encoding: quoted-printable On Mon, 2009-03-02 at 05:46 +0000, Andrew Thompson wrote: > Author: thompsa > Date: Mon Mar 2 05:46:25 2009 > New Revision: 189276 > URL: http://svn.freebsd.org/changeset/base/189276 >=20 > Log: > Bump __FreeBSD_version for the ushub to uhub rename. Ughhh! Actually, I lied. I should have looked first. I used "usbus" to tie usb2 devices into the hal device tree. Sorry about that. In any event, this might help someone else. Joe --=20 PGP Key : http://www.marcuscom.com/pgp.asc --=-YTXbirfA0QIBHG8pvp4m Content-Type: application/pgp-signature; name="signature.asc" Content-Description: This is a digitally signed message part -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (FreeBSD) iEYEABECAAYFAkmrdCUACgkQb2iPiv4Uz4cKxACeKaoDKRvrkNqPxZGtVK28C6lJ yc8An1qpnrdqTIz5cXETnFnIsZPKonRF =1Joi -----END PGP SIGNATURE----- --=-YTXbirfA0QIBHG8pvp4m-- From owner-svn-src-head@FreeBSD.ORG Mon Mar 2 06:05: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 DD7DB106566C; Mon, 2 Mar 2009 06:05:15 +0000 (UTC) (envelope-from rnoland@FreeBSD.org) Received: from gizmo.2hip.net (gizmo.2hip.net [64.74.207.195]) by mx1.freebsd.org (Postfix) with ESMTP id 9AFD28FC0C; Mon, 2 Mar 2009 06:05:15 +0000 (UTC) (envelope-from rnoland@FreeBSD.org) Received: from [192.168.1.2] (adsl-1-207-68.bna.bellsouth.net [65.1.207.68]) (authenticated bits=0) by gizmo.2hip.net (8.14.3/8.14.3) with ESMTP id n2263sxU046567 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Mon, 2 Mar 2009 01:03:54 -0500 (EST) (envelope-from rnoland@FreeBSD.org) From: Robert Noland To: Joe Marcus Clarke In-Reply-To: <1235973158.31933.33.camel@shumai.marcuscom.com> References: <200903020546.n225kP4O066687@svn.freebsd.org> <1235973158.31933.33.camel@shumai.marcuscom.com> Content-Type: multipart/signed; micalg="pgp-sha1"; protocol="application/pgp-signature"; boundary="=-03vOy89zlJ4Ec3+tu+XP" Organization: FreeBSD Date: Mon, 02 Mar 2009 00:05:08 -0600 Message-Id: <1235973908.1236.41.camel@widget.2hip.net> Mime-Version: 1.0 X-Mailer: Evolution 2.24.4 FreeBSD GNOME Team Port X-Spam-Status: No, score=-1.6 required=5.0 tests=AWL,BAYES_00,RCVD_IN_PBL, RCVD_IN_SORBS_DUL,RDNS_DYNAMIC autolearn=no version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on gizmo.2hip.net Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Andrew Thompson Subject: Re: svn commit: r189276 - 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: Mon, 02 Mar 2009 06:05:16 -0000 --=-03vOy89zlJ4Ec3+tu+XP Content-Type: text/plain Content-Transfer-Encoding: quoted-printable On Mon, 2009-03-02 at 00:52 -0500, Joe Marcus Clarke wrote: > On Mon, 2009-03-02 at 05:46 +0000, Andrew Thompson wrote: > > Author: thompsa > > Date: Mon Mar 2 05:46:25 2009 > > New Revision: 189276 > > URL: http://svn.freebsd.org/changeset/base/189276 > >=20 > > Log: > > Bump __FreeBSD_version for the ushub to uhub rename. >=20 > Ughhh! Actually, I lied. I should have looked first. I used "usbus" > to tie usb2 devices into the hal device tree. Sorry about that. In any > event, this might help someone else. Numbers are cheap. ;) robert. > Joe --=20 Robert Noland FreeBSD --=-03vOy89zlJ4Ec3+tu+XP Content-Type: application/pgp-signature; name="signature.asc" Content-Description: This is a digitally signed message part -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.10 (FreeBSD) iEYEABECAAYFAkmrdxMACgkQM4TrQ4qfROOM1QCcDZlk9NWsgeLfY/vvKE1sxM+R BQ4Aniboi2XOT02HtwAv94Jz5LkwFf9i =ZV64 -----END PGP SIGNATURE----- --=-03vOy89zlJ4Ec3+tu+XP-- From owner-svn-src-head@FreeBSD.ORG Mon Mar 2 11:08: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 1CAFF1065777; Mon, 2 Mar 2009 11:08:01 +0000 (UTC) (envelope-from ed@hoeg.nl) Received: from palm.hoeg.nl (mx0.hoeg.nl [IPv6:2001:7b8:613:100::211]) by mx1.freebsd.org (Postfix) with ESMTP id 9A38D8FCD7; Mon, 2 Mar 2009 11:07:38 +0000 (UTC) (envelope-from ed@hoeg.nl) Received: by palm.hoeg.nl (Postfix, from userid 1000) id 0569A1CFEA; Mon, 2 Mar 2009 12:07:38 +0100 (CET) Date: Mon, 2 Mar 2009 12:07:37 +0100 From: Ed Schouten To: Robert Noland Message-ID: <20090302110737.GG19161@hoeg.nl> References: <200903020546.n225kP4O066687@svn.freebsd.org> <1235973158.31933.33.camel@shumai.marcuscom.com> <1235973908.1236.41.camel@widget.2hip.net> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="rbKG8BlqS9xyY7Uh" Content-Disposition: inline In-Reply-To: <1235973908.1236.41.camel@widget.2hip.net> User-Agent: Mutt/1.5.19 (2009-01-05) Cc: Joe Marcus Clarke , svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Andrew Thompson Subject: Re: svn commit: r189276 - 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: Mon, 02 Mar 2009 11:08:25 -0000 --rbKG8BlqS9xyY7Uh Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable * Robert Noland wrote: > On Mon, 2009-03-02 at 00:52 -0500, Joe Marcus Clarke wrote: > > On Mon, 2009-03-02 at 05:46 +0000, Andrew Thompson wrote: > > > Author: thompsa > > > Date: Mon Mar 2 05:46:25 2009 > > > New Revision: 189276 > > > URL: http://svn.freebsd.org/changeset/base/189276 > > >=20 > > > Log: > > > Bump __FreeBSD_version for the ushub to uhub rename. > >=20 > > Ughhh! Actually, I lied. I should have looked first. I used "usbus" > > to tie usb2 devices into the hal device tree. Sorry about that. In any > > event, this might help someone else. >=20 > Numbers are cheap. ;) Even though we only have 32 left before we reach 800100. 7.0-RELEASE carried the number 700100, but I guess nothing stops us from picking a different number. ;-) --=20 Ed Schouten WWW: http://80386.nl/ --rbKG8BlqS9xyY7Uh Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (FreeBSD) iEYEARECAAYFAkmrvfkACgkQ52SDGA2eCwVpHwCggTJ1YfIwsNsgojf6aMahamhv JvsAn1WxWIzareJqvGncGuBoUngTtgX+ =Smf5 -----END PGP SIGNATURE----- --rbKG8BlqS9xyY7Uh-- From owner-svn-src-head@FreeBSD.ORG Mon Mar 2 13:29: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 4A43F1065676; Mon, 2 Mar 2009 13:29:19 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 34C108FC20; Mon, 2 Mar 2009 13:29:19 +0000 (UTC) (envelope-from rwatson@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 n22DTJtQ077169; Mon, 2 Mar 2009 13:29:19 GMT (envelope-from rwatson@svn.freebsd.org) Received: (from rwatson@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n22DTIe3077152; Mon, 2 Mar 2009 13:29:18 GMT (envelope-from rwatson@svn.freebsd.org) Message-Id: <200903021329.n22DTIe3077152@svn.freebsd.org> From: Robert Watson Date: Mon, 2 Mar 2009 13:29: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: r189279 - in head: contrib/openbsm contrib/openbsm/bin/audit contrib/openbsm/bin/auditd contrib/openbsm/bsm contrib/openbsm/etc contrib/openbsm/libauditd contrib/openbsm/libbsm contrib/... 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, 02 Mar 2009 13:29:19 -0000 Author: rwatson Date: Mon Mar 2 13:29:18 2009 New Revision: 189279 URL: http://svn.freebsd.org/changeset/base/189279 Log: Merge OpenBSM 1.1 beta 1 from OpenBSM vendor branch to head, both contrib/openbsm (svn merge) and src/sys/{bsm,security/audit} (manual merge). OpenBSM history for imported revision below for reference. MFC after: 1 month Sponsored by: Apple, Inc. Obtained from: TrustedBSD Project OpenBSM 1.1 beta 1 - The filesz parameter in audit_control(5) now accepts suffixes: 'B' for Bytes, 'K' for Kilobytes, 'M' for Megabytes, and 'G' for Gigabytes. For legacy support no suffix defaults to bytes. - Audit trail log expiration support added. It is configured in audit_control(5) with the expire-after parameter. If there is no expire-after parameter in audit_control(5), the default, then the audit trail files are not expired and removed. See audit_control(5) for more information. - Change defaults in audit_control: warn at 5% rather than 20% free for audit partitions, rotate automatically at 2mb, and set the default policy to cnt,argv rather than cnt so that execve(2) arguments are captured if AUE_EXECVE events are audited. These may provide more usable defaults for many users. - Use au_domain_to_bsm(3) and au_socket_type_to_bsm(3) to convert au_to_socket_ex(3) arguments to BSM format. - Fix error encoding AUT_IPC_PERM tokens. Modified: head/contrib/openbsm/ (props changed) head/contrib/openbsm/CREDITS head/contrib/openbsm/NEWS head/contrib/openbsm/README head/contrib/openbsm/VERSION head/contrib/openbsm/bin/audit/audit.8 head/contrib/openbsm/bin/audit/audit.c head/contrib/openbsm/bin/auditd/audit_warn.c head/contrib/openbsm/bin/auditd/auditd.c head/contrib/openbsm/bin/auditd/auditd.h head/contrib/openbsm/bsm/auditd_lib.h head/contrib/openbsm/bsm/libbsm.h head/contrib/openbsm/configure head/contrib/openbsm/configure.ac head/contrib/openbsm/etc/audit_control head/contrib/openbsm/etc/audit_event head/contrib/openbsm/libauditd/auditd_lib.c head/contrib/openbsm/libbsm/au_control.3 head/contrib/openbsm/libbsm/au_domain.3 head/contrib/openbsm/libbsm/au_errno.3 head/contrib/openbsm/libbsm/bsm_control.c head/contrib/openbsm/libbsm/bsm_errno.c head/contrib/openbsm/libbsm/bsm_io.c head/contrib/openbsm/libbsm/bsm_token.c head/contrib/openbsm/man/audit_control.5 head/contrib/openbsm/man/auditon.2 head/contrib/openbsm/sys/bsm/audit.h head/contrib/openbsm/sys/bsm/audit_kevents.h head/contrib/openbsm/tools/audump.c head/sys/bsm/audit.h head/sys/bsm/audit_kevents.h head/sys/security/audit/audit_bsm_errno.c head/sys/security/audit/audit_bsm_token.c Modified: head/contrib/openbsm/CREDITS ============================================================================== --- head/contrib/openbsm/CREDITS Mon Mar 2 10:48:15 2009 (r189278) +++ head/contrib/openbsm/CREDITS Mon Mar 2 13:29:18 2009 (r189279) @@ -27,6 +27,7 @@ the development of OpenBSM: Eric Hall Xin LI Stacey Son + Todd Heberlein In addition, Coverity, Inc.'s Prevent(tm) static analysis tool and Gimpel Software's FlexeLint tool were used to identify a number of bugs in the Modified: head/contrib/openbsm/NEWS ============================================================================== --- head/contrib/openbsm/NEWS Mon Mar 2 10:48:15 2009 (r189278) +++ head/contrib/openbsm/NEWS Mon Mar 2 13:29:18 2009 (r189279) @@ -1,5 +1,24 @@ OpenBSM Version History +OpenBSM 1.1 beta 1 + +- The filesz parameter in audit_control(5) now accepts suffixes: 'B' for + Bytes, 'K' for Kilobytes, 'M' for Megabytes, and 'G' for Gigabytes. + For legacy support no suffix defaults to bytes. +- Audit trail log expiration support added. It is configured in + audit_control(5) with the expire-after parameter. If there is no + expire-after parameter in audit_control(5), the default, then the audit + trail files are not expired and removed. See audit_control(5) for + more information. +- Change defaults in audit_control: warn at 5% rather than 20% free for audit + partitions, rotate automatically at 2mb, and set the default policy to + cnt,argv rather than cnt so that execve(2) arguments are captured if + AUE_EXECVE events are audited. These may provide more usable defaults for + many users. +- Use au_domain_to_bsm(3) and au_socket_type_to_bsm(3) to convert + au_to_socket_ex(3) arguments to BSM format. +- Fix error encoding AUT_IPC_PERM tokens. + OpenBSM 1.1 alpha 5 - Stub libauditd(3) man page added. @@ -412,4 +431,4 @@ OpenBSM 1.0 alpha 1 to support reloading of kernel event table. - Allow comments in /etc/security configuration files. -$P4: //depot/projects/trustedbsd/openbsm/NEWS#27 $ +$P4: //depot/projects/trustedbsd/openbsm/NEWS#32 $ Modified: head/contrib/openbsm/README ============================================================================== --- head/contrib/openbsm/README Mon Mar 2 10:48:15 2009 (r189278) +++ head/contrib/openbsm/README Mon Mar 2 13:29:18 2009 (r189279) @@ -1,4 +1,4 @@ -OpenBSM 1.1 alpha 4 +OpenBSM 1.1 beta 1 Introduction @@ -56,4 +56,4 @@ Information on TrustedBSD may be found o http://www.TrustedBSD.org/ -$P4: //depot/projects/trustedbsd/openbsm/README#34 $ +$P4: //depot/projects/trustedbsd/openbsm/README#35 $ Modified: head/contrib/openbsm/VERSION ============================================================================== --- head/contrib/openbsm/VERSION Mon Mar 2 10:48:15 2009 (r189278) +++ head/contrib/openbsm/VERSION Mon Mar 2 13:29:18 2009 (r189279) @@ -1 +1 @@ -OPENBSM_1_1_ALPHA_5 +OPENBSM_1_1_BETA_1 Modified: head/contrib/openbsm/bin/audit/audit.8 ============================================================================== --- head/contrib/openbsm/bin/audit/audit.8 Mon Mar 2 10:48:15 2009 (r189278) +++ head/contrib/openbsm/bin/audit/audit.8 Mon Mar 2 13:29:18 2009 (r189279) @@ -1,4 +1,4 @@ -.\" Copyright (c) 2004 Apple Inc. +.\" Copyright (c) 2004-2009 Apple Inc. .\" All rights reserved. .\" .\" Redistribution and use in source and binary forms, with or without @@ -25,9 +25,9 @@ .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. .\" -.\" $P4: //depot/projects/trustedbsd/openbsm/bin/audit/audit.8#13 $ +.\" $P4: //depot/projects/trustedbsd/openbsm/bin/audit/audit.8#15 $ .\" -.Dd December 11, 2008 +.Dd January 29, 2009 .Dt AUDIT 8 .Os .Sh NAME @@ -35,7 +35,7 @@ .Nd audit management utility .Sh SYNOPSIS .Nm -.Fl i | n | s | t +.Fl e | i | n | s | t .Sh DESCRIPTION The .Nm @@ -43,6 +43,10 @@ utility controls the state of the audit One of the following flags is required as an argument to .Nm : .Bl -tag -width indent +.It Fl e +Forces the audit system to immediately remove audit log files that +meet the expiration criteria specified in the audit control file without +doing a log rotation. .It Fl i Initializes and starts auditing. This option is currently for Mac OS X only @@ -53,6 +57,8 @@ to be configured to run under .It Fl n Forces the audit system to close the existing audit log file and rotate to a new log file in a location specified in the audit control file. +Also, audit log files that meet the expiration criteria specified in the +audit control file will be removed. .It Fl s Specifies that the audit system should [re]synchronize its configuration from the audit control file. Modified: head/contrib/openbsm/bin/audit/audit.c ============================================================================== --- head/contrib/openbsm/bin/audit/audit.c Mon Mar 2 10:48:15 2009 (r189278) +++ head/contrib/openbsm/bin/audit/audit.c Mon Mar 2 13:29:18 2009 (r189279) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2005-2008 Apple Inc. + * Copyright (c) 2005-2009 Apple Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -26,7 +26,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $P4: //depot/projects/trustedbsd/openbsm/bin/audit/audit.c#13 $ + * $P4: //depot/projects/trustedbsd/openbsm/bin/audit/audit.c#14 $ */ /* * Program to trigger the audit daemon with a message that is either: @@ -68,12 +68,15 @@ static int send_trigger(unsigned int); #include "auditd_control.h" /* - * XXX the following is temporary until this can be added to the kernel + * XXX The following are temporary until these can be added to the kernel * audit.h header. */ #ifndef AUDIT_TRIGGER_INITIALIZE #define AUDIT_TRIGGER_INITIALIZE 7 #endif +#ifndef AUDIT_TRIGGER_EXPIRE_TRAILS +#define AUDIT_TRIGGER_EXPIRE_TRAILS 8 +#endif static int send_trigger(unsigned int trigger) @@ -125,7 +128,7 @@ static void usage(void) { - (void)fprintf(stderr, "Usage: audit -i | -n | -s | -t \n"); + (void)fprintf(stderr, "Usage: audit -e | -i | -n | -s | -t \n"); exit(-1); } @@ -141,9 +144,13 @@ main(int argc, char **argv) if (argc != 2) usage(); - while ((ch = getopt(argc, argv, "inst")) != -1) { + while ((ch = getopt(argc, argv, "einst")) != -1) { switch(ch) { + case 'e': + trigger = AUDIT_TRIGGER_EXPIRE_TRAILS; + break; + case 'i': trigger = AUDIT_TRIGGER_INITIALIZE; break; Modified: head/contrib/openbsm/bin/auditd/audit_warn.c ============================================================================== --- head/contrib/openbsm/bin/auditd/audit_warn.c Mon Mar 2 10:48:15 2009 (r189278) +++ head/contrib/openbsm/bin/auditd/audit_warn.c Mon Mar 2 13:29:18 2009 (r189279) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2005 Apple Inc. + * Copyright (c) 2005-2009 Apple Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -26,7 +26,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $P4: //depot/projects/trustedbsd/openbsm/bin/auditd/audit_warn.c#10 $ + * $P4: //depot/projects/trustedbsd/openbsm/bin/auditd/audit_warn.c#11 $ */ #include @@ -236,3 +236,18 @@ audit_warn_tmpfile(void) return (auditwarnlog(args)); } + +/* + * Indicates that this trail file has expired and was removed. + */ +int +audit_warn_expired(char *filename) +{ + char *args[3]; + + args[0] = EXPIRED_WARN; + args[1] = filename; + args[2] = NULL; + + return (auditwarnlog(args)); +} Modified: head/contrib/openbsm/bin/auditd/auditd.c ============================================================================== --- head/contrib/openbsm/bin/auditd/auditd.c Mon Mar 2 10:48:15 2009 (r189278) +++ head/contrib/openbsm/bin/auditd/auditd.c Mon Mar 2 13:29:18 2009 (r189279) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2004-2008 Apple Inc. + * Copyright (c) 2004-2009 Apple Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -26,7 +26,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $P4: //depot/projects/trustedbsd/openbsm/bin/auditd/auditd.c#41 $ + * $P4: //depot/projects/trustedbsd/openbsm/bin/auditd/auditd.c#43 $ */ #include @@ -67,12 +67,16 @@ #endif /* - * XXX the following is temporary until this can be added to the kernel + * XXX The following are temporary until these can be added to the kernel * audit.h header. */ #ifndef AUDIT_TRIGGER_INITIALIZE #define AUDIT_TRIGGER_INITIALIZE 7 #endif +#ifndef AUDIT_TRIGGER_EXPIRE_TRAILS +#define AUDIT_TRIGGER_EXPIRE_TRAILS 8 +#endif + /* * LaunchD flag (Mac OS X and, maybe, FreeBSD only.) See launchd(8) and @@ -166,7 +170,7 @@ close_lastfile(char *TS) /* Rename the last file -- append timestamp. */ if ((ptr = strstr(lastfile, NOT_TERMINATED)) != NULL) { - strlcpy(ptr, TS, TIMESTAMP_LEN); + memcpy(ptr, TS, POSTFIX_LEN); if (rename(oldname, lastfile) != 0) auditd_log_err( "Could not rename %s to %s: %m", oldname, @@ -275,6 +279,14 @@ do_trail_file(void) return (-1); } + /* + * Finally, see if there are any trail files to expire. + */ + err = auditd_expire_trails(audit_warn_expired); + if (err) + auditd_log_err("auditd_expire_trails(): %s", + auditd_strerror(err)); + return (0); } @@ -550,6 +562,14 @@ auditd_handle_trigger(int trigger) audit_setup(); break; + case AUDIT_TRIGGER_EXPIRE_TRAILS: + auditd_log_info("Got audit expire trails trigger"); + err = auditd_expire_trails(audit_warn_expired); + if (err) + auditd_log_err("auditd_expire_trails(): %s", + auditd_strerror(err)); + break; + default: auditd_log_err("Got unknown trigger %d", trigger); break; @@ -669,13 +689,18 @@ auditd_config_controls(void) */ err = auditd_set_host(); if (err) { - auditd_log_err("auditd_set_host() %s: %m", - auditd_strerror(err)); - ret = -1; + if (err == ADE_PARSE) { + auditd_log_notice( + "audit_control(5) may be missing 'host:' field"); + } else { + auditd_log_err("auditd_set_host() %s: %m", + auditd_strerror(err)); + ret = -1; + } } else auditd_log_debug( "Set audit host address information in kernel."); - + return (ret); } Modified: head/contrib/openbsm/bin/auditd/auditd.h ============================================================================== --- head/contrib/openbsm/bin/auditd/auditd.h Mon Mar 2 10:48:15 2009 (r189278) +++ head/contrib/openbsm/bin/auditd/auditd.h Mon Mar 2 13:29:18 2009 (r189279) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2005 Apple Inc. + * Copyright (c) 2005-2009 Apple Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -26,7 +26,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $P4: //depot/projects/trustedbsd/openbsm/bin/auditd/auditd.h#12 $ + * $P4: //depot/projects/trustedbsd/openbsm/bin/auditd/auditd.h#13 $ */ #ifndef _AUDITD_H_ @@ -57,6 +57,7 @@ #define POSTSIGTERM_WARN "postsigterm" #define SOFTLIM_WARN "soft" #define TMPFILE_WARN "tmpfile" +#define EXPIRED_WARN "expired" #define AUDITWARN_SCRIPT "/etc/security/audit_warn" #define AUDITD_PIDFILE "/var/run/auditd.pid" @@ -76,6 +77,7 @@ int audit_warn_nostart(void); int audit_warn_postsigterm(void); int audit_warn_soft(char *filename); int audit_warn_tmpfile(void); +int audit_warn_expired(char *filename); void auditd_openlog(int debug, gid_t gid); void auditd_log_err(const char *fmt, ...); Modified: head/contrib/openbsm/bsm/auditd_lib.h ============================================================================== --- head/contrib/openbsm/bsm/auditd_lib.h Mon Mar 2 10:48:15 2009 (r189278) +++ head/contrib/openbsm/bsm/auditd_lib.h Mon Mar 2 13:29:18 2009 (r189279) @@ -26,7 +26,7 @@ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. * - * $P4: //depot/projects/trustedbsd/openbsm/bsm/auditd_lib.h#3 $ + * $P4: //depot/projects/trustedbsd/openbsm/bsm/auditd_lib.h#4 $ */ #ifndef _BSM_AUDITD_LIB_H_ @@ -81,12 +81,14 @@ #define ADE_INVAL -16 /* Invalid argument. */ #define ADE_GETADDR -17 /* Error resolving address from hostname. */ #define ADE_ADDRFAM -18 /* Address family not supported. */ +#define ADE_EXPIRE -19 /* Error expiring audit trail files. */ /* * auditd_lib functions. */ const char *auditd_strerror(int errcode); int auditd_set_minfree(void); +int auditd_expire_trails(int (*warn_expired)(char *)); int auditd_read_dirs(int (*warn_soft)(char *), int (*warn_hard)(char *)); void auditd_close_dirs(void); int auditd_set_evcmap(void); Modified: head/contrib/openbsm/bsm/libbsm.h ============================================================================== --- head/contrib/openbsm/bsm/libbsm.h Mon Mar 2 10:48:15 2009 (r189278) +++ head/contrib/openbsm/bsm/libbsm.h Mon Mar 2 13:29:18 2009 (r189279) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2004-2008 Apple Inc. + * Copyright (c) 2004-2009 Apple Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -26,7 +26,7 @@ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. * - * $P4: //depot/projects/trustedbsd/openbsm/bsm/libbsm.h#41 $ + * $P4: //depot/projects/trustedbsd/openbsm/bsm/libbsm.h#42 $ */ #ifndef _LIBBSM_H_ @@ -76,13 +76,14 @@ #define AUDIT_CONTROL_FILE "/etc/security/audit_control" #define AUDIT_USER_FILE "/etc/security/audit_user" -#define DIR_CONTROL_ENTRY "dir" -#define MINFREE_CONTROL_ENTRY "minfree" -#define FILESZ_CONTROL_ENTRY "filesz" -#define FLAGS_CONTROL_ENTRY "flags" -#define NA_CONTROL_ENTRY "naflags" -#define POLICY_CONTROL_ENTRY "policy" +#define DIR_CONTROL_ENTRY "dir" +#define MINFREE_CONTROL_ENTRY "minfree" +#define FILESZ_CONTROL_ENTRY "filesz" +#define FLAGS_CONTROL_ENTRY "flags" +#define NA_CONTROL_ENTRY "naflags" +#define POLICY_CONTROL_ENTRY "policy" #define AUDIT_HOST_CONTROL_ENTRY "host" +#define EXPIRE_AFTER_CONTROL_ENTRY "expire-after" #define AU_CLASS_NAME_MAX 8 #define AU_CLASS_DESC_MAX 72 @@ -766,6 +767,7 @@ int getacflg(char *auditstr, int len) int getacna(char *auditstr, int len); int getacpol(char *auditstr, size_t len); int getachost(char *auditstr, size_t len); +int getacexpire(int *andflg, time_t *age, size_t *size); int getauditflagsbin(char *auditstr, au_mask_t *masks); int getauditflagschar(char *auditstr, au_mask_t *masks, int verbose); Modified: head/contrib/openbsm/configure ============================================================================== --- head/contrib/openbsm/configure Mon Mar 2 10:48:15 2009 (r189278) +++ head/contrib/openbsm/configure Mon Mar 2 13:29:18 2009 (r189279) @@ -1,7 +1,7 @@ #! /bin/sh # From configure.ac P4: //depot/projects/trustedbsd/openbsm/configure.ac#49 . # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.61 for OpenBSM 1.1alpha5. +# Generated by GNU Autoconf 2.61 for OpenBSM 1.1beta1. # # Report bugs to . # @@ -729,8 +729,8 @@ SHELL=${CONFIG_SHELL-/bin/sh} # Identity of this package. PACKAGE_NAME='OpenBSM' PACKAGE_TARNAME='openbsm' -PACKAGE_VERSION='1.1alpha5' -PACKAGE_STRING='OpenBSM 1.1alpha5' +PACKAGE_VERSION='1.1beta1' +PACKAGE_STRING='OpenBSM 1.1beta1' PACKAGE_BUGREPORT='trustedbsd-audit@TrustesdBSD.org' ac_unique_file="bin/auditreduce/auditreduce.c" @@ -1404,7 +1404,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures OpenBSM 1.1alpha5 to adapt to many kinds of systems. +\`configure' configures OpenBSM 1.1beta1 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1474,7 +1474,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of OpenBSM 1.1alpha5:";; + short | recursive ) echo "Configuration of OpenBSM 1.1beta1:";; esac cat <<\_ACEOF @@ -1580,7 +1580,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -OpenBSM configure 1.1alpha5 +OpenBSM configure 1.1beta1 generated by GNU Autoconf 2.61 Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, @@ -1594,7 +1594,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by OpenBSM $as_me 1.1alpha5, which was +It was created by OpenBSM $as_me 1.1beta1, which was generated by GNU Autoconf 2.61. Invocation command line was $ $0 $@ @@ -19076,7 +19076,7 @@ fi # Define the identity of the package. PACKAGE=OpenBSM - VERSION=1.1alpha5 + VERSION=1.1beta1 cat >>confdefs.h <<_ACEOF @@ -23584,7 +23584,7 @@ exec 6>&1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by OpenBSM $as_me 1.1alpha5, which was +This file was extended by OpenBSM $as_me 1.1beta1, which was generated by GNU Autoconf 2.61. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -23637,7 +23637,7 @@ Report bugs to ." _ACEOF cat >>$CONFIG_STATUS <<_ACEOF ac_cs_version="\\ -OpenBSM config.status 1.1alpha5 +OpenBSM config.status 1.1beta1 configured by $0, generated by GNU Autoconf 2.61, with options \\"`echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\" Modified: head/contrib/openbsm/configure.ac ============================================================================== --- head/contrib/openbsm/configure.ac Mon Mar 2 10:48:15 2009 (r189278) +++ head/contrib/openbsm/configure.ac Mon Mar 2 13:29:18 2009 (r189279) @@ -2,8 +2,8 @@ # Process this file with autoconf to produce a configure script. AC_PREREQ(2.59) -AC_INIT([OpenBSM], [1.1alpha5], [trustedbsd-audit@TrustesdBSD.org],[openbsm]) -AC_REVISION([$P4: //depot/projects/trustedbsd/openbsm/configure.ac#49 $]) +AC_INIT([OpenBSM], [1.1beta1], [trustedbsd-audit@TrustesdBSD.org],[openbsm]) +AC_REVISION([$P4: //depot/projects/trustedbsd/openbsm/configure.ac#50 $]) AC_CONFIG_SRCDIR([bin/auditreduce/auditreduce.c]) AC_CONFIG_AUX_DIR(config) AC_CONFIG_HEADER([config/config.h]) Modified: head/contrib/openbsm/etc/audit_control ============================================================================== --- head/contrib/openbsm/etc/audit_control Mon Mar 2 10:48:15 2009 (r189278) +++ head/contrib/openbsm/etc/audit_control Mon Mar 2 13:29:18 2009 (r189279) @@ -1,10 +1,10 @@ # -# $P4: //depot/projects/trustedbsd/openbsm/etc/audit_control#5 $ +# $P4: //depot/projects/trustedbsd/openbsm/etc/audit_control#6 $ # $FreeBSD$ # dir:/var/audit flags:lo -minfree:20 +minfree:5 naflags:lo -policy:cnt -filesz:0 +policy:cnt,argv +filesz:2097152 Modified: head/contrib/openbsm/etc/audit_event ============================================================================== --- head/contrib/openbsm/etc/audit_event Mon Mar 2 10:48:15 2009 (r189278) +++ head/contrib/openbsm/etc/audit_event Mon Mar 2 13:29:18 2009 (r189279) @@ -1,5 +1,5 @@ # -# $P4: //depot/projects/trustedbsd/openbsm/etc/audit_event#34 $ +# $P4: //depot/projects/trustedbsd/openbsm/etc/audit_event#36 $ # $FreeBSD$ # # The mapping between event identifiers and values is also hard-coded in @@ -491,7 +491,7 @@ 43128:AUE_MAC_GET_PID:mac_get_pid(2):pc 43129:AUE_MAC_GET_LINK:mac_get_link(2):fa 43130:AUE_MAC_SET_LINK:mac_set_link(2):fm -43131:AUE_MAC_EXECVE:mac_exeve(2):ex,pc +43131:AUE_MAC_EXECVE:mac_execve(2):ex,pc 43132:AUE_GETPATH_FROMFD:getpath_fromfd(2):fa 43133:AUE_GETPATH_FROMADDR:getpath_fromaddr(2):fa 43134:AUE_MQ_OPEN:mq_open(2):ip @@ -552,6 +552,8 @@ 43189:AUE_CAP_GETMODE:cap_getmode(2):pc 43190:AUE_POSIX_SPAWN:posix_spawn(2):pc 43191:AUE_FSGETPATH:fsgetpath(2):ot +43192:AUE_PREAD:pread(2):no +43193:AUE_PWRITE:pwrite(2):no # # Solaris userspace events. # Modified: head/contrib/openbsm/libauditd/auditd_lib.c ============================================================================== --- head/contrib/openbsm/libauditd/auditd_lib.c Mon Mar 2 10:48:15 2009 (r189278) +++ head/contrib/openbsm/libauditd/auditd_lib.c Mon Mar 2 13:29:18 2009 (r189279) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2008 Apple Inc. + * Copyright (c) 2008-2009 Apple Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -26,7 +26,7 @@ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. * - * $P4: //depot/projects/trustedbsd/openbsm/libauditd/auditd_lib.c#2 $ + * $P4: //depot/projects/trustedbsd/openbsm/libauditd/auditd_lib.c#7 $ */ #include @@ -52,6 +52,7 @@ #include #include +#include #include #include #include @@ -77,6 +78,11 @@ #define AUDIT_HARD_LIMIT_FREE_BLOCKS 4 #endif +/* + * Number of seconds to January 1, 2000 + */ +#define JAN_01_2000 946598400 + struct dir_ent { char *dirname; uint8_t softlim; @@ -85,7 +91,19 @@ struct dir_ent { }; static TAILQ_HEAD(, dir_ent) dir_q; -static int minval = -1; + +struct audit_trail { + time_t at_time; + char *at_path; + off_t at_size; + + TAILQ_ENTRY(audit_trail) at_trls; +}; + +static int auditd_minval = -1; + +static char auditd_host[MAXHOSTNAMELEN]; +static int auditd_hostlen = -1; static char *auditd_errmsg[] = { "no error", /* ADE_NOERR ( 0) */ @@ -107,6 +125,7 @@ static char *auditd_errmsg[] = { "invalid argument", /* ADE_INVAL (16) */ "could not resolve hostname to address", /* ADE_GETADDR (17) */ "address family not supported", /* ADE_ADDRFAM (18) */ + "error expiring audit trail files", /* ADE_EXPIRE (19) */ }; #define MAXERRCODE (sizeof(auditd_errmsg) / sizeof(auditd_errmsg[0])) @@ -165,7 +184,13 @@ affixdir(char *name, struct dir_ent *dir return (NULL); } - asprintf(&fn, "%s/%s", dirent->dirname, name); + /* + * If the host is set then also add the hostname to the filename. + */ + if (auditd_hostlen != -1) + asprintf(&fn, "%s/%s.%s", dirent->dirname, name, auditd_host); + else + asprintf(&fn, "%s/%s", dirent->dirname, name); return (fn); } @@ -204,16 +229,14 @@ insert_orderly(struct dir_ent *denew) int auditd_set_host(void) { - char hoststr[MAXHOSTNAMELEN]; struct sockaddr_in6 *sin6; struct sockaddr_in *sin; struct addrinfo *res; struct auditinfo_addr aia; int error, ret = ADE_NOERR; - if (getachost(hoststr, MAXHOSTNAMELEN) != 0) { - - ret = ADE_PARSE; + if (getachost(auditd_host, sizeof(auditd_host)) != 0) { + ret = ADE_PARSE; /* * To maintain reverse compatability with older audit_control @@ -229,7 +252,8 @@ auditd_set_host(void) ret = ADE_AUDITON; return (ret); } - error = getaddrinfo(hoststr, NULL, NULL, &res); + auditd_hostlen = strlen(auditd_host); + error = getaddrinfo(auditd_host, NULL, NULL, &res); if (error) return (ADE_GETADDR); switch (res->ai_family) { @@ -271,14 +295,14 @@ auditd_set_minfree(void) { au_qctrl_t qctrl; - if (getacmin(&minval) != 0) + if (getacmin(&auditd_minval) != 0) return (ADE_PARSE); if (auditon(A_GETQCTRL, &qctrl, sizeof(qctrl)) != 0) return (ADE_AUDITON); - if (qctrl.aq_minfree != minval) { - qctrl.aq_minfree = minval; + if (qctrl.aq_minfree != auditd_minval) { + qctrl.aq_minfree = auditd_minval; if (auditon(A_SETQCTRL, &qctrl, sizeof(qctrl)) != 0) return (ADE_AUDITON); } @@ -287,9 +311,259 @@ auditd_set_minfree(void) } /* + * Convert a trailname into a timestamp (seconds). Return 0 if the conversion + * was successful. + */ +static int +trailname_to_tstamp(char *fn, time_t *tstamp) +{ + struct tm tm; + char ts[TIMESTAMP_LEN]; + char *p; + + *tstamp = 0; + + /* + * Get the ending time stamp. + */ + if ((p = strchr(fn, '.')) == NULL) + return (1); + strlcpy(ts, ++p, TIMESTAMP_LEN); + if (strlen(ts) != POSTFIX_LEN) + return (1); + + bzero(&tm, sizeof(tm)); + + /* seconds (0-60) */ + p = ts + POSTFIX_LEN - 2; + tm.tm_sec = atol(p); + if (tm.tm_sec < 0 || tm.tm_sec > 60) + return (1); + + /* minutes (0-59) */ + *p = '\0'; p -= 2; + tm.tm_min = atol(p); + if (tm.tm_min < 0 || tm.tm_min > 59) + return (1); + + /* hours (0 - 23) */ + *p = '\0'; p -= 2; + tm.tm_hour = atol(p); + if (tm.tm_hour < 0 || tm.tm_hour > 23) + return (1); + + /* day of month (1-31) */ + *p = '\0'; p -= 2; + tm.tm_mday = atol(p); + if (tm.tm_mday < 1 || tm.tm_mday > 31) + return (1); + + /* month (0 - 11) */ + *p = '\0'; p -= 2; + tm.tm_mon = atol(p) - 1; + if (tm.tm_mon < 0 || tm.tm_mon > 11) + return (1); + + /* year (year - 1900) */ + *p = '\0'; p -= 4; + tm.tm_year = atol(p) - 1900; + if (tm.tm_year < 0) + return (1); + + *tstamp = timegm(&tm); + + return (0); +} + +/* + * Remove audit trails files according to the expiration conditions. Returns: + * ADE_NOERR on success or there is nothing to do. + * ADE_PARSE if error parsing audit_control(5). + * ADE_NOMEM if could not allocate memory. + * ADE_EXPIRE if there was an unespected error. + */ +int +auditd_expire_trails(int (*warn_expired)(char *)) +{ + int andflg, ret = ADE_NOERR; + size_t expire_size, total_size = 0L; + time_t expire_age, oldest_time, current_time = time(NULL); + struct dir_ent *traildir; + struct audit_trail *at; + char *afnp, *pn; + TAILQ_HEAD(au_trls_head, audit_trail) head = + TAILQ_HEAD_INITIALIZER(head); + struct stat stbuf; + char activefn[MAXPATHLEN]; + + /* + * Read the expiration conditions. If no conditions then return no + * error. + */ + if (getacexpire(&andflg, &expire_age, &expire_size) < 0) + return (ADE_PARSE); + if (!expire_age && !expire_size) + return (ADE_NOERR); + + /* + * Read the 'current' trail file name. Trim off directory path. + */ + activefn[0] = '\0'; + readlink(AUDIT_CURRENT_LINK, activefn, MAXPATHLEN - 1); + if ((afnp = strrchr(activefn, '/')) != NULL) + afnp++; + + + /* + * Build tail queue of the trail files. + */ + TAILQ_FOREACH(traildir, &dir_q, dirs) { + DIR *dirp; + struct dirent *dp; + + dirp = opendir(traildir->dirname); + while ((dp = readdir(dirp)) != NULL) { + time_t tstamp = 0; + struct audit_trail *new; + + /* + * Quickly filter non-trail files. + */ + if (dp->d_namlen != (FILENAME_LEN - 1) || +#ifdef DT_REG + dp->d_type != DT_REG || +#endif + dp->d_name[POSTFIX_LEN] != '.') + continue; + + if (asprintf(&pn, "%s/%s", traildir->dirname, + dp->d_name) < 0) { + ret = ADE_NOMEM; + break; + } + + if (stat(pn, &stbuf) < 0 || !S_ISREG(stbuf.st_mode)) { + free(pn); + continue; + } + + total_size += stbuf.st_size; + + /* + * If this is the 'current' audit trail then + * don't add it to the tail queue. + */ + if (NULL != afnp && + strncmp(dp->d_name, afnp, FILENAME_LEN) == 0) { + free(pn); + continue; + } + + /* + * Get the ending time stamp encoded in the trail + * name. If we can't read it or if it is older + * than Jan 1, 2000 then use the mtime. + */ + if (trailname_to_tstamp(dp->d_name, &tstamp) != 0 || + tstamp < JAN_01_2000) + tstamp = stbuf.st_mtime; + + /* + * If the time stamp is older than Jan 1, 2000 then + * update the mtime of the trail file to the current + * time. This is so we don't prematurely remove a trail + * file that was created while the system clock reset + * to the * "beginning of time" but later the system + * clock is set to the correct current time. + */ + if (current_time >= JAN_01_2000 && + tstamp < JAN_01_2000) { + struct timeval tv[2]; + + tstamp = stbuf.st_mtime = current_time; + TIMESPEC_TO_TIMEVAL(&tv[0], + &stbuf.st_atimespec); + TIMESPEC_TO_TIMEVAL(&tv[1], + &stbuf.st_mtimespec); + utimes(pn, tv); + } + + /* + * Allocate and populate the new entry. + */ + new = malloc(sizeof(*new)); + if (NULL == new) { + free(pn); + ret = ADE_NOMEM; + break; + } + new->at_time = tstamp; + new->at_size = stbuf.st_size; + new->at_path = pn; + + /* + * Check to see if we have a new head. Otherwise, + * walk the tailq from the tail first and do a simple + * insertion sort. + */ + if (TAILQ_EMPTY(&head) || + (new->at_time <= TAILQ_FIRST(&head)->at_time)) { + TAILQ_INSERT_HEAD(&head, new, at_trls); + continue; + } + + TAILQ_FOREACH_REVERSE(at, &head, au_trls_head, at_trls) + if (new->at_time >= at->at_time) { + TAILQ_INSERT_AFTER(&head, at, new, + at_trls); + break; + } + + } + } + + oldest_time = current_time - expire_age; + + /* + * Expire trail files, oldest (mtime) first, if the given + * conditions are met. + */ + at = TAILQ_FIRST(&head); + while (NULL != at) { + struct audit_trail *at_next = TAILQ_NEXT(at, at_trls); + + if (andflg) { + if ((expire_size && total_size > expire_size) && + (expire_age && at->at_time < oldest_time)) { + if (warn_expired) + (*warn_expired)(at->at_path); + if (unlink(at->at_path) < 0) + ret = ADE_EXPIRE; + total_size -= at->at_size; + } + } else { + if ((expire_size && total_size > expire_size) || + (expire_age && at->at_time < oldest_time)) { + if (warn_expired) + (*warn_expired)(at->at_path); + if (unlink(at->at_path) < 0) + ret = ADE_EXPIRE; + total_size -= at->at_size; + } + } + + free(at->at_path); + free(at); + at = at_next; + } + + return (ret); +} + +/* * Parses the "dir" entry in audit_control(5) into an ordered list. Also, will - * set the minfree value if not already set. Arguments include function - * pointers to audit_warn functions for soft and hard limits. Returns: + * set the minfree and host values if not already set. Arguments include + * function pointers to audit_warn functions for soft and hard limits. Returns: * ADE_NOERR on success, * ADE_PARSE error parsing audit_control(5), * ADE_AUDITON error getting/setting auditon(2) value, @@ -309,9 +583,12 @@ auditd_read_dirs(int (*warn_soft)(char * int scnt = 0; int hcnt = 0; - if (minval == -1 && (err = auditd_set_minfree()) != 0) + if (auditd_minval == -1 && (err = auditd_set_minfree()) != 0) return (err); + if (auditd_hostlen == -1) + auditd_set_host(); + /* * Init directory q. Force a re-read of the file the next time. */ @@ -329,7 +606,8 @@ auditd_read_dirs(int (*warn_soft)(char * while (getacdir(cur_dir, MAXNAMLEN) >= 0) { if (statfs(cur_dir, &sfs) < 0) continue; /* XXX should warn */ - soft = (sfs.f_bfree < (sfs.f_blocks / (100 / minval))) ? 1 : 0; + soft = (sfs.f_bfree < (sfs.f_blocks / (100 / auditd_minval))) ? + 1 : 0; hard = (sfs.f_bfree < AUDIT_HARD_LIMIT_FREE_BLOCKS) ? 1 : 0; if (soft) { if (warn_soft) @@ -367,7 +645,8 @@ void auditd_close_dirs(void) { free_dir_q(); - minval = -1; + auditd_minval = -1; + auditd_hostlen = -1; } @@ -549,7 +828,7 @@ auditd_swap_trail(char *TS, char **newfi } /* Try until we succeed. */ - while ((dirent = TAILQ_FIRST(&dir_q))) { + TAILQ_FOREACH(dirent, &dir_q, dirs) { if (dirent->hardlim) continue; if ((fn = affixdir(timestr, dirent)) == NULL) @@ -606,6 +885,28 @@ auditd_swap_trail(char *TS, char **newfi * ADE_NOERR on success, * ADE_SETAUDIT if setaudit(2) fails. */ +#ifdef __APPLE__ +int +auditd_prevent_audit(void) +{ + auditinfo_addr_t aia; + + /* + * To prevent event feedback cycles and avoid audit becoming stalled if *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@FreeBSD.ORG Mon Mar 2 15:22: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 B62C1106566B; Mon, 2 Mar 2009 15:22:01 +0000 (UTC) (envelope-from nwhitehorn@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A3A228FC08; Mon, 2 Mar 2009 15:22:01 +0000 (UTC) (envelope-from nwhitehorn@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 n22FM16P079404; Mon, 2 Mar 2009 15:22:01 GMT (envelope-from nwhitehorn@svn.freebsd.org) Received: (from nwhitehorn@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n22FM1mI079403; Mon, 2 Mar 2009 15:22:01 GMT (envelope-from nwhitehorn@svn.freebsd.org) Message-Id: <200903021522.n22FM1mI079403@svn.freebsd.org> From: Nathan Whitehorn Date: Mon, 2 Mar 2009 15:22: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: r189280 - head/sys/dev/ofw 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, 02 Mar 2009 15:22:02 -0000 Author: nwhitehorn Date: Mon Mar 2 15:22:01 2009 New Revision: 189280 URL: http://svn.freebsd.org/changeset/base/189280 Log: Some Apple I2C buses give the device's I2C address in a property with the name i2c-address instead of reg. Change the OFW I2C probe to check both locations for the address. Submitted by: Marco Trillo Reported by: Justin Hibbits Modified: head/sys/dev/ofw/ofw_iicbus.c Modified: head/sys/dev/ofw/ofw_iicbus.c ============================================================================== --- head/sys/dev/ofw/ofw_iicbus.c Mon Mar 2 13:29:18 2009 (r189279) +++ head/sys/dev/ofw/ofw_iicbus.c Mon Mar 2 15:22:01 2009 (r189280) @@ -118,8 +118,15 @@ ofw_iicbus_attach(device_t dev) node = ofw_bus_get_node(dev); for (child = OF_child(node); child != 0; child = OF_peer(child)) { - if (OF_getprop(child, "reg", &addr, sizeof(addr)) == -1) - continue; + /* + * Try to get the I2C address first from the i2c-address + * property, then try the reg property. It moves around + * on different systems. + */ + + if (OF_getprop(child, "i2c-address", &addr, sizeof(addr)) == -1) + if (OF_getprop(child, "reg", &addr, sizeof(addr)) == -1) + continue; /* * Now set up the I2C and OFW bus layer devinfo and add it From owner-svn-src-head@FreeBSD.ORG Mon Mar 2 16:11: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 723AB106564A; Mon, 2 Mar 2009 16:11:43 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from cyrus.watson.org (cyrus.watson.org [65.122.17.42]) by mx1.freebsd.org (Postfix) with ESMTP id 417A58FC17; Mon, 2 Mar 2009 16:11:43 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from server.baldwin.cx (pool-98-109-39-197.nwrknj.fios.verizon.net [98.109.39.197]) by cyrus.watson.org (Postfix) with ESMTPSA id C738646B43; Mon, 2 Mar 2009 11:11:42 -0500 (EST) Received: from localhost (john@localhost [127.0.0.1]) (authenticated bits=0) by server.baldwin.cx (8.14.3/8.14.3) with ESMTP id n22GBa8G077859; Mon, 2 Mar 2009 11:11:37 -0500 (EST) (envelope-from jhb@freebsd.org) From: John Baldwin To: Dmitry Chagin Date: Mon, 2 Mar 2009 10:15:50 -0500 User-Agent: KMail/1.9.7 References: <200903011426.n21EQOdp045591@svn.freebsd.org> In-Reply-To: <200903011426.n21EQOdp045591@svn.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200903021015.51292.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH authentication, not delayed by milter-greylist-2.0.2 (server.baldwin.cx [127.0.0.1]); Mon, 02 Mar 2009 11:11:37 -0500 (EST) X-Virus-Scanned: ClamAV 0.94.2/9061/Mon Mar 2 04:28:18 2009 on server.baldwin.cx X-Virus-Status: Clean X-Spam-Status: No, score=-4.4 required=4.2 tests=ALL_TRUSTED,AWL,BAYES_00 autolearn=ham version=3.1.3 X-Spam-Checker-Version: SpamAssassin 3.1.3 (2006-06-01) on server.baldwin.cx Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r189232 - head/sys/kern X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 Mar 2009 16:11:43 -0000 On Sunday 01 March 2009 9:26:24 am Dmitry Chagin wrote: > Author: dchagin > Date: Sun Mar 1 14:26:24 2009 > New Revision: 189232 > URL: http://svn.freebsd.org/changeset/base/189232 > > Log: > Fix range-check error introduced in r182292. Also do not do anything > if all processors in the map are not available, simply return. I think the ncpus == 0 case is arguably a panic offense FWIW. It would be a bug in the calling code for that to ever happen. -- John Baldwin From owner-svn-src-head@FreeBSD.ORG Mon Mar 2 16:11: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 4A2071065792; Mon, 2 Mar 2009 16:11:49 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from cyrus.watson.org (cyrus.watson.org [65.122.17.42]) by mx1.freebsd.org (Postfix) with ESMTP id 108FC8FC14; Mon, 2 Mar 2009 16:11:49 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from server.baldwin.cx (pool-98-109-39-197.nwrknj.fios.verizon.net [98.109.39.197]) by cyrus.watson.org (Postfix) with ESMTPSA id ABFD246B53; Mon, 2 Mar 2009 11:11:48 -0500 (EST) Received: from localhost (john@localhost [127.0.0.1]) (authenticated bits=0) by server.baldwin.cx (8.14.3/8.14.3) with ESMTP id n22GBa8H077859; Mon, 2 Mar 2009 11:11:43 -0500 (EST) (envelope-from jhb@freebsd.org) From: John Baldwin To: Ed Schouten Date: Mon, 2 Mar 2009 10:21:08 -0500 User-Agent: KMail/1.9.7 References: <200902281040.n1SAebV7006099@svn.freebsd.org> In-Reply-To: <200902281040.n1SAebV7006099@svn.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200903021021.09097.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH authentication, not delayed by milter-greylist-2.0.2 (server.baldwin.cx [127.0.0.1]); Mon, 02 Mar 2009 11:11:43 -0500 (EST) X-Virus-Scanned: ClamAV 0.94.2/9061/Mon Mar 2 04:28:18 2009 on server.baldwin.cx X-Virus-Status: Clean X-Spam-Status: No, score=-4.4 required=4.2 tests=ALL_TRUSTED,AWL,BAYES_00 autolearn=ham version=3.1.3 X-Spam-Checker-Version: SpamAssassin 3.1.3 (2006-06-01) on server.baldwin.cx Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r189150 - head/usr.bin/fstat 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, 02 Mar 2009 16:11:52 -0000 On Saturday 28 February 2009 5:40:37 am Ed Schouten wrote: > Author: ed > Date: Sat Feb 28 10:40:37 2009 > New Revision: 189150 > URL: http://svn.freebsd.org/changeset/base/189150 > > Log: > Fix compilation of fstat. > > The udev should now be obtained from the dosmount instead of the denode. Sorry. :( The fact that fstat does this is really gross. -- John Baldwin From owner-svn-src-head@FreeBSD.ORG Mon Mar 2 18:34:07 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 A453910657A1; Mon, 2 Mar 2009 18:34:07 +0000 (UTC) (envelope-from dchagin@dchagin.static.corbina.ru) Received: from contrabass.post.ru (contrabass.post.ru [85.21.78.5]) by mx1.freebsd.org (Postfix) with ESMTP id 4CF738FC08; Mon, 2 Mar 2009 18:34:07 +0000 (UTC) (envelope-from dchagin@dchagin.static.corbina.ru) Received: from corbina.ru (mail.post.ru [195.14.50.16]) by contrabass.post.ru (Postfix) with ESMTP id E199666025; Mon, 2 Mar 2009 21:10:34 +0300 (MSK) X-Virus-Scanned: by cgpav Uf39PSi9pFi9oFi9 Received: from [10.208.17.3] (HELO dchagin.static.corbina.ru) by corbina.ru (CommuniGate Pro SMTP 5.1.14) with ESMTPS id 1655489703; Mon, 02 Mar 2009 21:10:34 +0300 Received: from dchagin.static.corbina.ru (localhost.chd.net [127.0.0.1]) by dchagin.static.corbina.ru (8.14.3/8.14.3) with ESMTP id n22IAXsV010484; Mon, 2 Mar 2009 21:10:33 +0300 (MSK) (envelope-from dchagin@dchagin.static.corbina.ru) Received: (from dchagin@localhost) by dchagin.static.corbina.ru (8.14.3/8.14.3/Submit) id n22IASoS010483; Mon, 2 Mar 2009 21:10:28 +0300 (MSK) (envelope-from dchagin) Date: Mon, 2 Mar 2009 21:10:28 +0300 From: Chagin Dmitry To: John Baldwin Message-ID: <20090302181028.GA10447@dchagin.static.corbina.ru> References: <200903011426.n21EQOdp045591@svn.freebsd.org> <200903021015.51292.jhb@freebsd.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="pWyiEgJYm5f9v55/" Content-Disposition: inline In-Reply-To: <200903021015.51292.jhb@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: r189232 - head/sys/kern X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 Mar 2009 18:34:11 -0000 --pWyiEgJYm5f9v55/ Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Mon, Mar 02, 2009 at 10:15:50AM -0500, John Baldwin wrote: > On Sunday 01 March 2009 9:26:24 am Dmitry Chagin wrote: > > Author: dchagin > > Date: Sun Mar 1 14:26:24 2009 > > New Revision: 189232 > > URL: http://svn.freebsd.org/changeset/base/189232 > >=20 > > Log: > > Fix range-check error introduced in r182292. Also do not do anything > > if all processors in the map are not available, simply return. >=20 > I think the ncpus =3D=3D 0 case is arguably a panic offense FWIW. It wou= ld be a=20 > bug in the calling code for that to ever happen. >=20 =09 I think you are right, I will make changes and test it. --=20 Have fun! chd --pWyiEgJYm5f9v55/ Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.10 (FreeBSD) iEYEARECAAYFAkmsIRMACgkQ0t2Tb3OO/O1IZwCfUmPjIDpzzIxS7YyOr0hT07ZD R+sAn0Qebgj8uME/l/WwIZXUPOQR/JWg =S/Hh -----END PGP SIGNATURE----- --pWyiEgJYm5f9v55/-- From owner-svn-src-head@FreeBSD.ORG Mon Mar 2 18:43: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 E0ED410658D7; Mon, 2 Mar 2009 18:43:50 +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 B8B5B8FC29; Mon, 2 Mar 2009 18:43:50 +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 n22Ihow4083206; Mon, 2 Mar 2009 18:43:50 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n22Iho8d083201; Mon, 2 Mar 2009 18:43:50 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <200903021843.n22Iho8d083201@svn.freebsd.org> From: Konstantin Belousov Date: Mon, 2 Mar 2009 18:43: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: r189282 - in head/sys: amd64/amd64 fs/procfs kern X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 Mar 2009 18:44:03 -0000 Author: kib Date: Mon Mar 2 18:43:50 2009 New Revision: 189282 URL: http://svn.freebsd.org/changeset/base/189282 Log: Use the p_sysent->sv_flags flag SV_ILP32 to detect 32bit process executing on 64bit kernel. This eliminates the direct comparisions of p_sysent with &ia32_freebsd_sysvec, that were left intact after r185169. Modified: head/sys/amd64/amd64/vm_machdep.c head/sys/fs/procfs/procfs_dbregs.c head/sys/fs/procfs/procfs_fpregs.c head/sys/fs/procfs/procfs_regs.c head/sys/kern/sys_process.c Modified: head/sys/amd64/amd64/vm_machdep.c ============================================================================== --- head/sys/amd64/amd64/vm_machdep.c Mon Mar 2 16:55:19 2009 (r189281) +++ head/sys/amd64/amd64/vm_machdep.c Mon Mar 2 18:43:50 2009 (r189282) @@ -62,6 +62,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -80,12 +81,6 @@ __FBSDID("$FreeBSD$"); #include -#ifdef COMPAT_IA32 - -extern struct sysentvec ia32_freebsd_sysvec; - -#endif - static void cpu_reset_real(void); #ifdef SMP static void cpu_reset_proxy(void); @@ -331,7 +326,7 @@ cpu_set_upcall_kse(struct thread *td, vo cpu_thread_clean(td); #ifdef COMPAT_IA32 - if (td->td_proc->p_sysent == &ia32_freebsd_sysvec) { + if (td->td_proc->p_sysent->sv_flags & SV_ILP32) { /* * Set the trap frame to point at the beginning of the uts * function. @@ -377,7 +372,7 @@ cpu_set_user_tls(struct thread *td, void return (EINVAL); #ifdef COMPAT_IA32 - if (td->td_proc->p_sysent == &ia32_freebsd_sysvec) { + if (td->td_proc->p_sysent->sv_flags & SV_ILP32) { if (td == curthread) { critical_enter(); td->td_pcb->pcb_gsbase = (register_t)tls_base; Modified: head/sys/fs/procfs/procfs_dbregs.c ============================================================================== --- head/sys/fs/procfs/procfs_dbregs.c Mon Mar 2 16:55:19 2009 (r189281) +++ head/sys/fs/procfs/procfs_dbregs.c Mon Mar 2 18:43:50 2009 (r189282) @@ -51,6 +51,7 @@ #include #include #include +#include #include #include @@ -63,7 +64,6 @@ #include #include -extern struct sysentvec ia32_freebsd_sysvec; /* * PROC(write, dbregs, td2, &r) becomes * proc_write_dbregs(td2, &r) or @@ -107,8 +107,8 @@ procfs_doprocdbregs(PFS_FILL_ARGS) td2 = FIRST_THREAD_IN_PROC(p); #ifdef COMPAT_IA32 - if (td->td_proc->p_sysent == &ia32_freebsd_sysvec) { - if (td2->td_proc->p_sysent != &ia32_freebsd_sysvec) { + if (SV_CURPROC_FLAG(SV_ILP32)) { + if ((td2->td_proc->p_sysent->sv_flags & SV_ILP32) == 0) { PROC_UNLOCK(p); return (EINVAL); } Modified: head/sys/fs/procfs/procfs_fpregs.c ============================================================================== --- head/sys/fs/procfs/procfs_fpregs.c Mon Mar 2 16:55:19 2009 (r189281) +++ head/sys/fs/procfs/procfs_fpregs.c Mon Mar 2 18:43:50 2009 (r189282) @@ -45,6 +45,7 @@ #include #include #include +#include #include #include @@ -57,7 +58,6 @@ #include #include -extern struct sysentvec ia32_freebsd_sysvec; /* * PROC(write, fpregs, td2, &r) becomes * proc_write_fpregs(td2, &r) or @@ -102,8 +102,8 @@ procfs_doprocfpregs(PFS_FILL_ARGS) /* XXXKSE: */ td2 = FIRST_THREAD_IN_PROC(p); #ifdef COMPAT_IA32 - if (td->td_proc->p_sysent == &ia32_freebsd_sysvec) { - if (td2->td_proc->p_sysent != &ia32_freebsd_sysvec) { + if (SV_CURPROC_FLAG(SV_ILP32)) { + if ((td2->td_proc->p_sysent->sv_flags & SV_ILP32) == 0) { PROC_UNLOCK(p); return (EINVAL); } Modified: head/sys/fs/procfs/procfs_regs.c ============================================================================== --- head/sys/fs/procfs/procfs_regs.c Mon Mar 2 16:55:19 2009 (r189281) +++ head/sys/fs/procfs/procfs_regs.c Mon Mar 2 18:43:50 2009 (r189282) @@ -45,6 +45,7 @@ #include #include #include +#include #include #include @@ -57,7 +58,6 @@ #include #include -extern struct sysentvec ia32_freebsd_sysvec; /* * PROC(write, regs, td2, &r) becomes * proc_write_regs(td2, &r) or @@ -102,8 +102,8 @@ procfs_doprocregs(PFS_FILL_ARGS) /* XXXKSE: */ td2 = FIRST_THREAD_IN_PROC(p); #ifdef COMPAT_IA32 - if (td->td_proc->p_sysent == &ia32_freebsd_sysvec) { - if (td2->td_proc->p_sysent != &ia32_freebsd_sysvec) { + if (SV_CURPROC_FLAG(SV_ILP32)) { + if ((td2->td_proc->p_sysent->sv_flags & SV_ILP32) == 0) { PROC_UNLOCK(p); return (EINVAL); } Modified: head/sys/kern/sys_process.c ============================================================================== --- head/sys/kern/sys_process.c Mon Mar 2 16:55:19 2009 (r189281) +++ head/sys/kern/sys_process.c Mon Mar 2 18:43:50 2009 (r189282) @@ -39,6 +39,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -64,8 +65,6 @@ __FBSDID("$FreeBSD$"); #include #include -extern struct sysentvec ia32_freebsd_sysvec; - struct ptrace_io_desc32 { int piod_op; u_int32_t piod_offs; @@ -394,7 +393,7 @@ ptrace(struct thread *td, struct ptrace_ #ifdef COMPAT_IA32 int wrap32 = 0; - if (td->td_proc->p_sysent == &ia32_freebsd_sysvec) + if (SV_CURPROC_FLAG(SV_ILP32)) wrap32 = 1; #endif AUDIT_ARG(pid, uap->pid); @@ -581,8 +580,8 @@ kern_ptrace(struct thread *td, int req, * Test if we're a 32 bit client and what the target is. * Set the wrap controls accordingly. */ - if (td->td_proc->p_sysent == &ia32_freebsd_sysvec) { - if (td2->td_proc->p_sysent == &ia32_freebsd_sysvec) + if (SV_CURPROC_FLAG(SV_ILP32)) { + if (td2->td_proc->p_sysent->sv_flags & SV_ILP32) safe = 1; wrap32 = 1; } From owner-svn-src-head@FreeBSD.ORG Mon Mar 2 18:53: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 45A121065753; Mon, 2 Mar 2009 18:53:31 +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 274C58FC22; Mon, 2 Mar 2009 18:53:31 +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 n22IrVuZ083429; Mon, 2 Mar 2009 18:53:31 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n22IrUdx083424; Mon, 2 Mar 2009 18:53:30 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <200903021853.n22IrUdx083424@svn.freebsd.org> From: Konstantin Belousov Date: Mon, 2 Mar 2009 18:53: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: r189283 - in head: . lib/libc/sys sys/kern sys/sys usr.bin/ipcs 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, 02 Mar 2009 18:53:33 -0000 Author: kib Date: Mon Mar 2 18:53:30 2009 New Revision: 189283 URL: http://svn.freebsd.org/changeset/base/189283 Log: Correct types of variables used to track amount of allocated SysV shared memory from int to size_t. Implement a workaround for current ABI not allowing to properly save size for and report more then 2Gb sized segment of shared memory. This makes it possible to use > 2 Gb shared memory segments on 64bit architectures. Please note the new BUGS section in shmctl(2) and UPDATING note for limitations of this temporal solution. Reviewed by: csjp Tested by: Nikolay Dzham MFC after: 2 weeks Modified: head/UPDATING head/lib/libc/sys/shmctl.2 head/sys/kern/sysv_shm.c head/sys/sys/shm.h head/usr.bin/ipcs/ipcs.c Modified: head/UPDATING ============================================================================== --- head/UPDATING Mon Mar 2 18:43:50 2009 (r189282) +++ head/UPDATING Mon Mar 2 18:53:30 2009 (r189283) @@ -22,6 +22,14 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 8. to maximize performance. (To disable malloc debugging, run ln -s aj /etc/malloc.conf.) +20090302: + The workaround is committed to allow to create System V shared + memory segment of size > 2 Gb on the 64-bit architectures. + Due to limitation of the existing ABI, the shm_segsz member + of the struct shmid_ds, returned by shmctl(IPC_STAT) call is + wrong for large segments. Note that limits shall be explicitely + raised to allow such segments to be created. + 20090301: The layout of struct ifnet has changed, requiring a rebuild of all network device driver modules. Modified: head/lib/libc/sys/shmctl.2 ============================================================================== --- head/lib/libc/sys/shmctl.2 Mon Mar 2 18:43:50 2009 (r189282) +++ head/lib/libc/sys/shmctl.2 Mon Mar 2 18:53:30 2009 (r189283) @@ -133,6 +133,15 @@ the shared memory segment's owner or cre Permission denied due to mismatch between operation and mode of shared memory segment. .El +.Sh "BUGS" +The shm_segsz member of the +.Vt shmid_ds +structure has int type, that is too short to represent full range +of the values for segment size, which is allowed to be size_t. +If shared memory limits are raised to allow segments with size > 2 Gb +to be created, be aware that IPC_STAT call may return truncated value +for shm_segsz. +.El .Sh "SEE ALSO" .Xr shmat 2 , .Xr shmdt 2 , Modified: head/sys/kern/sysv_shm.c ============================================================================== --- head/sys/kern/sysv_shm.c Mon Mar 2 18:43:50 2009 (r189282) +++ head/sys/kern/sysv_shm.c Mon Mar 2 18:53:30 2009 (r189283) @@ -121,7 +121,8 @@ static sy_call_t *shmcalls[] = { #define SHMSEG_ALLOCATED 0x0800 #define SHMSEG_WANTED 0x1000 -static int shm_last_free, shm_nused, shm_committed, shmalloced; +static int shm_last_free, shm_nused, shmalloced; +size_t shm_committed; static struct shmid_kernel *shmsegs; struct shmmap_state { @@ -250,7 +251,7 @@ shm_deallocate_segment(shmseg) vm_object_deallocate(shmseg->u.shm_internal); shmseg->u.shm_internal = NULL; - size = round_page(shmseg->u.shm_segsz); + size = round_page(shmseg->shm_bsegsz); shm_committed -= btoc(size); shm_nused--; shmseg->u.shm_perm.mode = SHMSEG_FREE; @@ -270,7 +271,7 @@ shm_delete_mapping(struct vmspace *vm, s segnum = IPCID_TO_IX(shmmap_s->shmid); shmseg = &shmsegs[segnum]; - size = round_page(shmseg->u.shm_segsz); + size = round_page(shmseg->shm_bsegsz); result = vm_map_remove(&vm->vm_map, shmmap_s->va, shmmap_s->va + size); if (result != KERN_SUCCESS) return (EINVAL); @@ -390,7 +391,7 @@ kern_shmat(td, shmid, shmaddr, shmflg) error = EMFILE; goto done2; } - size = round_page(shmseg->u.shm_segsz); + size = round_page(shmseg->shm_bsegsz); #ifdef VM_PROT_READ_IS_EXEC prot = VM_PROT_READ | VM_PROT_EXECUTE; #else @@ -422,7 +423,8 @@ kern_shmat(td, shmid, shmaddr, shmflg) vm_object_reference(shmseg->u.shm_internal); rv = vm_map_find(&p->p_vmspace->vm_map, shmseg->u.shm_internal, - 0, &attach_va, size, (flags & MAP_FIXED)?0:1, prot, prot, 0); + 0, &attach_va, size, (flags & MAP_FIXED) ? VMFS_NO_SPACE : + VMFS_ANY_SPACE, prot, prot, 0); if (rv != KERN_SUCCESS) { vm_object_deallocate(shmseg->u.shm_internal); error = ENOMEM; @@ -720,7 +722,7 @@ shmget_existing(td, uap, mode, segnum) if (error != 0) return (error); #endif - if (uap->size && uap->size > shmseg->u.shm_segsz) + if (uap->size && uap->size > shmseg->shm_bsegsz) return (EINVAL); td->td_retval[0] = IXSEQ_TO_IPCID(segnum, shmseg->u.shm_perm); return (0); @@ -732,7 +734,8 @@ shmget_allocate_segment(td, uap, mode) struct shmget_args *uap; int mode; { - int i, segnum, shmid, size; + int i, segnum, shmid; + size_t size; struct ucred *cred = td->td_ucred; struct shmid_kernel *shmseg; vm_object_t shm_object; @@ -790,6 +793,7 @@ shmget_allocate_segment(td, uap, mode) shmseg->u.shm_perm.mode = (shmseg->u.shm_perm.mode & SHMSEG_WANTED) | (mode & ACCESSPERMS) | SHMSEG_ALLOCATED; shmseg->u.shm_segsz = uap->size; + shmseg->shm_bsegsz = uap->size; shmseg->u.shm_cpid = td->td_proc->p_pid; shmseg->u.shm_lpid = shmseg->u.shm_nattch = 0; shmseg->u.shm_atime = shmseg->u.shm_dtime = 0; Modified: head/sys/sys/shm.h ============================================================================== --- head/sys/sys/shm.h Mon Mar 2 18:43:50 2009 (r189282) +++ head/sys/sys/shm.h Mon Mar 2 18:53:30 2009 (r189283) @@ -108,6 +108,7 @@ struct shminfo { struct shmid_kernel { struct shmid_ds u; struct label *label; /* MAC label */ + size_t shm_bsegsz; }; extern struct shminfo shminfo; Modified: head/usr.bin/ipcs/ipcs.c ============================================================================== --- head/usr.bin/ipcs/ipcs.c Mon Mar 2 18:43:50 2009 (r189282) +++ head/usr.bin/ipcs/ipcs.c Mon Mar 2 18:53:30 2009 (r189283) @@ -452,8 +452,8 @@ print_kshmptr(int i, int option, struct kshmptr->u.shm_nattch); if (option & BIGGEST) - printf(" %12d", - kshmptr->u.shm_segsz); + printf(" %12zu", + kshmptr->shm_bsegsz); if (option & PID) printf(" %12d %12d", From owner-svn-src-head@FreeBSD.ORG Mon Mar 2 19:00: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 20D991065E45; Mon, 2 Mar 2009 19:00:46 +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 10E2F8FC2C; Mon, 2 Mar 2009 19:00:42 +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 n22J0fJ7083691; Mon, 2 Mar 2009 19:00:41 GMT (envelope-from rnoland@svn.freebsd.org) Received: (from rnoland@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n22J0fYQ083689; Mon, 2 Mar 2009 19:00:41 GMT (envelope-from rnoland@svn.freebsd.org) Message-Id: <200903021900.n22J0fYQ083689@svn.freebsd.org> From: Robert Noland Date: Mon, 2 Mar 2009 19:00: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: r189285 - head/sys/dev/pci 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, 02 Mar 2009 19:00:53 -0000 Author: rnoland Date: Mon Mar 2 19:00:41 2009 New Revision: 189285 URL: http://svn.freebsd.org/changeset/base/189285 Log: Disable INTx when enabling MSI/MSIX This addresses interrupt storms that were noticed after enabling MSI in drm. I think this is due to a loose interpretation of the PCI 2.3 spec, which states that a function using MSI is prohibitted from using INTx. It appears that some vendors interpretted that to mean that they should handle it in hardware, while others felt it was the drivers responsibility. This fix will also likely resolve interrupt storm related issues with devices other than drm. Reviewed by: jhb@ MFC after: 3 days Modified: head/sys/dev/pci/pci.c head/sys/dev/pci/pcireg.h Modified: head/sys/dev/pci/pci.c ============================================================================== --- head/sys/dev/pci/pci.c Mon Mar 2 19:00:31 2009 (r189284) +++ head/sys/dev/pci/pci.c Mon Mar 2 19:00:41 2009 (r189285) @@ -2864,6 +2864,8 @@ pci_setup_intr(device_t dev, device_t ch } mte->mte_handlers++; } + /* Disable INTx if we are using MSI/MSIX */ + pci_set_command_bit(dev, child, PCIM_CMD_INTxDIS); bad: if (error) { (void)bus_generic_teardown_intr(dev, child, irq, @@ -2918,6 +2920,8 @@ pci_teardown_intr(device_t dev, device_t if (mte->mte_handlers == 0) pci_mask_msix(child, rid - 1); } + /* Restore INTx capability for MSI/MSIX */ + pci_clear_command_bit(dev, child, PCIM_CMD_INTxDIS); } error = bus_generic_teardown_intr(dev, child, irq, cookie); if (device_get_parent(child) == dev && rid > 0) Modified: head/sys/dev/pci/pcireg.h ============================================================================== --- head/sys/dev/pci/pcireg.h Mon Mar 2 19:00:31 2009 (r189284) +++ head/sys/dev/pci/pcireg.h Mon Mar 2 19:00:41 2009 (r189285) @@ -60,6 +60,7 @@ #define PCIM_CMD_PERRESPEN 0x0040 #define PCIM_CMD_SERRESPEN 0x0100 #define PCIM_CMD_BACKTOBACK 0x0200 +#define PCIM_CMD_INTxDIS 0x0400 #define PCIR_STATUS 0x06 #define PCIM_STATUS_CAPPRESENT 0x0010 #define PCIM_STATUS_66CAPABLE 0x0020 From owner-svn-src-head@FreeBSD.ORG Mon Mar 2 19:42: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 9807C1065A47; Mon, 2 Mar 2009 19:42:01 +0000 (UTC) (envelope-from csjp@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 8480F8FC22; Mon, 2 Mar 2009 19:42:01 +0000 (UTC) (envelope-from csjp@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 n22Jg11G084537; Mon, 2 Mar 2009 19:42:01 GMT (envelope-from csjp@svn.freebsd.org) Received: (from csjp@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n22Jg1BG084536; Mon, 2 Mar 2009 19:42:01 GMT (envelope-from csjp@svn.freebsd.org) Message-Id: <200903021942.n22Jg1BG084536@svn.freebsd.org> From: "Christian S.J. Peron" Date: Mon, 2 Mar 2009 19:42: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: r189286 - head/sys/net 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, 02 Mar 2009 19:42:03 -0000 Author: csjp Date: Mon Mar 2 19:42:01 2009 New Revision: 189286 URL: http://svn.freebsd.org/changeset/base/189286 Log: Switch the default buffer mode in bpf(4) to zero-copy buffers. Discussed with: rwatson Modified: head/sys/net/bpf.c Modified: head/sys/net/bpf.c ============================================================================== --- head/sys/net/bpf.c Mon Mar 2 19:00:41 2009 (r189285) +++ head/sys/net/bpf.c Mon Mar 2 19:42:01 2009 (r189286) @@ -124,7 +124,7 @@ SYSCTL_NODE(_net, OID_AUTO, bpf, CTLFLAG int bpf_maxinsns = BPF_MAXINSNS; SYSCTL_INT(_net_bpf, OID_AUTO, maxinsns, CTLFLAG_RW, &bpf_maxinsns, 0, "Maximum bpf program instructions"); -static int bpf_zerocopy_enable = 0; +static int bpf_zerocopy_enable = 1; SYSCTL_INT(_net_bpf, OID_AUTO, zerocopy_enable, CTLFLAG_RW, &bpf_zerocopy_enable, 0, "Enable new zero-copy BPF buffer sessions"); SYSCTL_NODE(_net_bpf, OID_AUTO, stats, CTLFLAG_RW, From owner-svn-src-head@FreeBSD.ORG Mon Mar 2 20:51:39 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 9792C106566C; Mon, 2 Mar 2009 20:51:39 +0000 (UTC) (envelope-from kan@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 6BF688FC1C; Mon, 2 Mar 2009 20:51:39 +0000 (UTC) (envelope-from kan@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 n22KpdGB085951; Mon, 2 Mar 2009 20:51:39 GMT (envelope-from kan@svn.freebsd.org) Received: (from kan@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n22KpdfS085950; Mon, 2 Mar 2009 20:51:39 GMT (envelope-from kan@svn.freebsd.org) Message-Id: <200903022051.n22KpdfS085950@svn.freebsd.org> From: Alexander Kabaev Date: Mon, 2 Mar 2009 20:51:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r189287 - head/sys/kern X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 Mar 2009 20:51:40 -0000 Author: kan Date: Mon Mar 2 20:51:39 2009 New Revision: 189287 URL: http://svn.freebsd.org/changeset/base/189287 Log: Change vfs_busy to wait until an outcome of pending unmount operation is known and to retry or fail accordingly to that outcome. This fixes the problem with namespace traversing programs failing with random ENOENT errors if someone just happened to try to unmount that same filesystem at the same time. Reported by: dhw Reviewed by: kib, attilio Sponsored by: Juniper Networks, Inc. Modified: head/sys/kern/vfs_subr.c Modified: head/sys/kern/vfs_subr.c ============================================================================== --- head/sys/kern/vfs_subr.c Mon Mar 2 19:42:01 2009 (r189286) +++ head/sys/kern/vfs_subr.c Mon Mar 2 20:51:39 2009 (r189287) @@ -345,7 +345,19 @@ vfs_busy(struct mount *mp, int flags) MNT_ILOCK(mp); MNT_REF(mp); - if (mp->mnt_kern_flag & MNTK_UNMOUNT) { + /* + * If mount point is currenly being unmounted, sleep until the + * mount point fate is decided. If thread doing the unmounting fails, + * it will clear MNTK_UNMOUNT flag before waking us up, indicating + * that this mount point has survived the unmount attempt and vfs_busy + * should retry. Otherwise the unmounter thread will set MNTK_REFEXPIRE + * flag in addition to MNTK_UNMOUNT, indicating that mount point is + * about to be really destroyed. vfs_busy needs to release its + * reference on the mount point in this case and return with ENOENT, + * telling the caller that mount mount it tried to busy is no longer + * valid. + */ + while (mp->mnt_kern_flag & MNTK_UNMOUNT) { if (flags & MBF_NOWAIT || mp->mnt_kern_flag & MNTK_REFEXPIRE) { MNT_REL(mp); MNT_IUNLOCK(mp); @@ -357,12 +369,8 @@ vfs_busy(struct mount *mp, int flags) mtx_unlock(&mountlist_mtx); mp->mnt_kern_flag |= MNTK_MWAIT; msleep(mp, MNT_MTX(mp), PVFS, "vfs_busy", 0); - MNT_REL(mp); - MNT_IUNLOCK(mp); if (flags & MBF_MNTLSTLOCK) mtx_lock(&mountlist_mtx); - CTR1(KTR_VFS, "%s: failed busying after sleep", __func__); - return (ENOENT); } if (flags & MBF_MNTLSTLOCK) mtx_unlock(&mountlist_mtx); From owner-svn-src-head@FreeBSD.ORG Mon Mar 2 22:11: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 E0957106567F; Mon, 2 Mar 2009 22:11:49 +0000 (UTC) (envelope-from luigi@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A9F7F8FC1A; Mon, 2 Mar 2009 22:11:49 +0000 (UTC) (envelope-from luigi@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 n22MBn5E087520; Mon, 2 Mar 2009 22:11:49 GMT (envelope-from luigi@svn.freebsd.org) Received: (from luigi@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n22MBndb087518; Mon, 2 Mar 2009 22:11:49 GMT (envelope-from luigi@svn.freebsd.org) Message-Id: <200903022211.n22MBndb087518@svn.freebsd.org> From: Luigi Rizzo Date: Mon, 2 Mar 2009 22:11:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r189288 - head/sys/netinet X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 Mar 2009 22:11:53 -0000 Author: luigi Date: Mon Mar 2 22:11:48 2009 New Revision: 189288 URL: http://svn.freebsd.org/changeset/base/189288 Log: fw_debug has been unused for ages, so remove it from the list of sysctl_variables. I would also remove it from the VNET record but I am unsure if there is any ABI issue -- so for the time being just mark it as unused in ip_fw.h, and then we will collect the garbage at some appropriate time in the future. MFC after: 3 days Modified: head/sys/netinet/ip_fw.h head/sys/netinet/ip_fw2.c Modified: head/sys/netinet/ip_fw.h ============================================================================== --- head/sys/netinet/ip_fw.h Mon Mar 2 20:51:39 2009 (r189287) +++ head/sys/netinet/ip_fw.h Mon Mar 2 22:11:48 2009 (r189288) @@ -693,7 +693,7 @@ struct vnet_ipfw { int _fw_deny_unknown_exthdrs; int _fw_verbose; int _verbose_limit; - int _fw_debug; + int _fw_debug; /* actually unused */ int _autoinc_step; ipfw_dyn_rule **_ipfw_dyn_v; struct ip_fw_chain _layer3_chain; Modified: head/sys/netinet/ip_fw2.c ============================================================================== --- head/sys/netinet/ip_fw2.c Mon Mar 2 20:51:39 2009 (r189287) +++ head/sys/netinet/ip_fw2.c Mon Mar 2 22:11:48 2009 (r189288) @@ -165,7 +165,6 @@ struct table_entry { }; #ifdef VIMAGE_GLOBALS -static int fw_debug; static int autoinc_step; #endif @@ -181,8 +180,6 @@ SYSCTL_V_INT(V_NET, vnet_ipfw, _net_inet SYSCTL_V_INT(V_NET, vnet_inet, _net_inet_ip_fw, OID_AUTO, one_pass, CTLFLAG_RW | CTLFLAG_SECURE3, fw_one_pass, 0, "Only do a single pass through ipfw when using dummynet(4)"); -SYSCTL_V_INT(V_NET, vnet_ipfw, _net_inet_ip_fw, OID_AUTO, debug, CTLFLAG_RW, - fw_debug, 0, "Enable printing of debug ip_fw statements"); SYSCTL_V_INT(V_NET, vnet_ipfw, _net_inet_ip_fw, OID_AUTO, verbose, CTLFLAG_RW | CTLFLAG_SECURE3, fw_verbose, 0, "Log matches to ipfw rules"); @@ -4535,7 +4532,6 @@ ipfw_init(void) struct ip_fw default_rule; int error; - V_fw_debug = 1; V_autoinc_step = 100; /* bounded to 1..1000 in add_rule() */ V_ipfw_dyn_v = NULL; From owner-svn-src-head@FreeBSD.ORG Mon Mar 2 22:16: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 E4F9A1065758; Mon, 2 Mar 2009 22:16:50 +0000 (UTC) (envelope-from luigi@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C375E8FC4A; Mon, 2 Mar 2009 22:16:50 +0000 (UTC) (envelope-from luigi@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 n22MGoFf087673; Mon, 2 Mar 2009 22:16:50 GMT (envelope-from luigi@svn.freebsd.org) Received: (from luigi@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n22MGocC087672; Mon, 2 Mar 2009 22:16:50 GMT (envelope-from luigi@svn.freebsd.org) Message-Id: <200903022216.n22MGocC087672@svn.freebsd.org> From: Luigi Rizzo Date: Mon, 2 Mar 2009 22:16: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: r189289 - head/sys/netinet X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 Mar 2009 22:17:03 -0000 Author: luigi Date: Mon Mar 2 22:16:50 2009 New Revision: 189289 URL: http://svn.freebsd.org/changeset/base/189289 Log: curr_time is a 64 bit variable so SYSCTL_LONG is not appropriate as a handler. The variable was exported only for debugging, but there is little reason to do it now that the timekeeping is supported by various other variables. For the time being just comment out the sysctl, but I think this should go away. Modified: head/sys/netinet/ip_dummynet.c Modified: head/sys/netinet/ip_dummynet.c ============================================================================== --- head/sys/netinet/ip_dummynet.c Mon Mar 2 22:11:48 2009 (r189288) +++ head/sys/netinet/ip_dummynet.c Mon Mar 2 22:16:50 2009 (r189289) @@ -160,8 +160,10 @@ SYSCTL_DECL(_net_inet_ip); SYSCTL_NODE(_net_inet_ip, OID_AUTO, dummynet, CTLFLAG_RW, 0, "Dummynet"); SYSCTL_INT(_net_inet_ip_dummynet, OID_AUTO, hash_size, CTLFLAG_RW, &dn_hash_size, 0, "Default hash table size"); +#if 0 /* curr_time is 64 bit */ SYSCTL_LONG(_net_inet_ip_dummynet, OID_AUTO, curr_time, CTLFLAG_RD, &curr_time, 0, "Current tick"); +#endif SYSCTL_INT(_net_inet_ip_dummynet, OID_AUTO, ready_heap, CTLFLAG_RD, &ready_heap.size, 0, "Size of ready heap"); SYSCTL_INT(_net_inet_ip_dummynet, OID_AUTO, extract_heap, From owner-svn-src-head@FreeBSD.ORG Mon Mar 2 23:26: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 6E215106566B; Mon, 2 Mar 2009 23:26:31 +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 5A5268FC0A; Mon, 2 Mar 2009 23:26:31 +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 n22NQV0U089159; Mon, 2 Mar 2009 23:26:31 GMT (envelope-from jamie@svn.freebsd.org) Received: (from jamie@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n22NQVeb089153; Mon, 2 Mar 2009 23:26:31 GMT (envelope-from jamie@svn.freebsd.org) Message-Id: <200903022326.n22NQVeb089153@svn.freebsd.org> From: Jamie Gritton Date: Mon, 2 Mar 2009 23:26:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r189290 - in head: share/man/man9 sys/cddl/compat/opensolaris/kern sys/compat/freebsd32 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: Mon, 02 Mar 2009 23:26:32 -0000 Author: jamie Date: Mon Mar 2 23:26:30 2009 New Revision: 189290 URL: http://svn.freebsd.org/changeset/base/189290 Log: Extend the "vfsopt" mount options for more general use. Make struct vfsopt and the vfs_buildopts function public, and add some new fields to struct vfsopt (pos and seen), and new functions vfs_getopt_pos and vfs_opterror. Further extend the interface to allow reading options from the kernel in addition to sending them to the kernel, with vfs_setopt and related functions. While this allows the "name=value" option interface to be used for more than just FS mounts (planned use is for jails), it retains the current "vfsopt" name and requirement. Approved by: bz (mentor) Modified: head/share/man/man9/Makefile head/share/man/man9/vfs_getopt.9 head/sys/cddl/compat/opensolaris/kern/opensolaris_vfs.c head/sys/compat/freebsd32/freebsd32_misc.c head/sys/kern/vfs_mount.c head/sys/sys/mount.h Modified: head/share/man/man9/Makefile ============================================================================== --- head/share/man/man9/Makefile Mon Mar 2 22:16:50 2009 (r189289) +++ head/share/man/man9/Makefile Mon Mar 2 23:26:30 2009 (r189290) @@ -1243,7 +1243,10 @@ MLINKS+=vfs_getopt.9 vfs_copyopt.9 \ vfs_getopt.9 vfs_filteropt.9 \ vfs_getopt.9 vfs_flagopt.9 \ vfs_getopt.9 vfs_getopts.9 \ - vfs_getopt.9 vfs_scanopt.9 + vfs_getopt.9 vfs_scanopt.9 \ + vfs_getopt.9 vfs_setopt.9 \ + vfs_getopt.9 vfs_setopt_part.9 \ + vfs_getopt.9 vfs_setopts.9 MLINKS+=VFS_LOCK_GIANT.9 VFS_UNLOCK_GIANT.9 MLINKS+=vgone.9 vgonel.9 MLINKS+=vhold.9 vdrop.9 \ Modified: head/share/man/man9/vfs_getopt.9 ============================================================================== --- head/share/man/man9/vfs_getopt.9 Mon Mar 2 22:16:50 2009 (r189289) +++ head/share/man/man9/vfs_getopt.9 Mon Mar 2 23:26:30 2009 (r189290) @@ -26,7 +26,7 @@ .\" .\" $FreeBSD$ .\" -.Dd February 28, 2007 +.Dd March 2, 2009 .Dt VFS_GETOPT 9 .Os .Sh NAME @@ -35,7 +35,10 @@ .Nm vfs_flagopt , .Nm vfs_scanopt , .Nm vfs_copyopt , -.Nm vfs_filteropt +.Nm vfs_filteropt , +.Nm vfs_setopt , +.Nm vfs_setopt_part , +.Nm vfs_setopts .Nd "manipulate mount options and their values" .Sh SYNOPSIS .In sys/param.h @@ -62,6 +65,18 @@ .Fo vfs_filteropt .Fa "struct vfsoptlist *opts" "const char **legal" .Fc +.Ft int +.Fo vfs_setopt +.Fa "struct vfsoptlist *opts" "const char *name" "void *value" "int len" +.Fc +.Ft int +.Fo vfs_setopt_part +.Fa "struct vfsoptlist *opts" "const char *name" "void *value" "int len" +.Fc +.Ft int +.Fo vfs_setopts +.Fa "struct vfsoptlist *opts" "const char *name" "const char *value" +.Fc .Sh DESCRIPTION The .Fn vfs_getopt @@ -111,7 +126,7 @@ The .Fn vfs_scanopt function performs a .Xr vsscanf 3 -with the options value, using the given format, +with the option's value, using the given format, into the specified variable arguments. The value must be a string (i.e., .Dv NUL @@ -119,10 +134,10 @@ terminated). .Pp The .Fn vfs_copyopt -function creates a copy of the options value. +function creates a copy of the option's value. The .Fa len -argument must match the length of the options value exactly +argument must match the length of the option's value exactly (i.e., a larger buffer will still cause .Fn vfs_copyout to fail with @@ -134,6 +149,28 @@ function ensures that no unknown options A option is valid if its name matches one of the names in the list of legal names. An option may be prefixed with 'no', and still be considered valid. +.Pp +The +.Fn vfs_setopt +and +.Fn vfs_setopt_part +functions copy new data into the option's value. +In +.Fn vfs_setopt , +the +.Fa len +argument must match the length of the option's value exactly +(i.e., a larger buffer will still cause +.Fn vfs_copyout +to fail with +.Er EINVAL ) . +.Pp +The +.Fn vfs_setopts +function copies a new string into the option's value. +The string, including +.Dv NUL +byte, must be no longer than the option's length. .Sh RETURN VALUES The .Fn vfs_getopt @@ -179,7 +216,9 @@ not always mean the option does not exis .Pp The .Fn vfs_copyopt -function returns 0 if the copy was successful, +and +.Fn vfs_setopt +functions return 0 if the copy was successful, .Er EINVAL if the option was found but the lengths did not match, and .Er ENOENT @@ -190,6 +229,14 @@ The function returns 0 if all of the options are legal; otherwise, .Er EINVAL is returned. +.Pp +The +.Fn vfs_setopts +function returns 0 if the copy was successful, +.Er EINVAL +if the option was found but the string was too long, and +.Er ENOENT +if the option was not found. .Sh AUTHORS .An -nosplit This manual page was written by Modified: head/sys/cddl/compat/opensolaris/kern/opensolaris_vfs.c ============================================================================== --- head/sys/cddl/compat/opensolaris/kern/opensolaris_vfs.c Mon Mar 2 22:16:50 2009 (r189289) +++ head/sys/cddl/compat/opensolaris/kern/opensolaris_vfs.c Mon Mar 2 23:26:30 2009 (r189290) @@ -39,14 +39,6 @@ __FBSDID("$FreeBSD$"); MALLOC_DECLARE(M_MOUNT); -TAILQ_HEAD(vfsoptlist, vfsopt); -struct vfsopt { - TAILQ_ENTRY(vfsopt) link; - char *name; - void *value; - int len; -}; - void vfs_setmntopt(vfs_t *vfsp, const char *name, const char *arg, int flags __unused) @@ -64,6 +56,8 @@ vfs_setmntopt(vfs_t *vfsp, const char *n namesize = strlen(name) + 1; opt->name = malloc(namesize, M_MOUNT, M_WAITOK); strlcpy(opt->name, name, namesize); + opt->pos = -1; + opt->seen = 1; if (arg == NULL) { opt->value = NULL; @@ -80,22 +74,9 @@ vfs_setmntopt(vfs_t *vfsp, const char *n void vfs_clearmntopt(vfs_t *vfsp, const char *name) { - struct vfsopt *opt; - if (vfsp->mnt_opt == NULL) - return; /* TODO: Locking. */ - TAILQ_FOREACH(opt, vfsp->mnt_opt, link) { - if (strcmp(opt->name, name) == 0) - break; - } - if (opt != NULL) { - TAILQ_REMOVE(vfsp->mnt_opt, opt, link); - free(opt->name, M_MOUNT); - if (opt->value != NULL) - free(opt->value, M_MOUNT); - free(opt, M_MOUNT); - } + vfs_deleteopt(vfsp->mnt_opt, name); } int Modified: head/sys/compat/freebsd32/freebsd32_misc.c ============================================================================== --- head/sys/compat/freebsd32/freebsd32_misc.c Mon Mar 2 22:16:50 2009 (r189289) +++ head/sys/compat/freebsd32/freebsd32_misc.c Mon Mar 2 23:26:30 2009 (r189290) @@ -2639,8 +2639,7 @@ freebsd32_nmount(struct thread *td, } */ *uap) { struct uio *auio; - struct iovec *iov; - int error, k; + int error; AUDIT_ARG(fflags, uap->flags); @@ -2662,14 +2661,8 @@ freebsd32_nmount(struct thread *td, error = freebsd32_copyinuio(uap->iovp, uap->iovcnt, &auio); if (error) return (error); - for (iov = auio->uio_iov, k = 0; k < uap->iovcnt; ++k, ++iov) { - if (iov->iov_len > MMAXOPTIONLEN) { - free(auio, M_IOV); - return (EINVAL); - } - } - error = vfs_donmount(td, uap->flags, auio); + free(auio, M_IOV); return error; } Modified: head/sys/kern/vfs_mount.c ============================================================================== --- head/sys/kern/vfs_mount.c Mon Mar 2 22:16:50 2009 (r189289) +++ head/sys/kern/vfs_mount.c Mon Mar 2 23:26:30 2009 (r189290) @@ -78,7 +78,6 @@ static int vfs_domount(struct thread *td static int vfs_mountroot_ask(void); static int vfs_mountroot_try(const char *mountfrom); static void free_mntarg(struct mntarg *ma); -static int vfs_getopt_pos(struct vfsoptlist *opts, const char *name); static int usermount = 0; SYSCTL_INT(_vfs, OID_AUTO, usermount, CTLFLAG_RW, &usermount, 0, @@ -95,14 +94,6 @@ struct mntlist mountlist = TAILQ_HEAD_IN struct mtx mountlist_mtx; MTX_SYSINIT(mountlist, &mountlist_mtx, "mountlist", MTX_DEF); -TAILQ_HEAD(vfsoptlist, vfsopt); -struct vfsopt { - TAILQ_ENTRY(vfsopt) link; - char *name; - void *value; - int len; -}; - /* * The vnode of the system's root (/ in the filesystem, without chroot * active.) @@ -164,11 +155,6 @@ vfs_freeopt(struct vfsoptlist *opts, str free(opt->name, M_MOUNT); if (opt->value != NULL) free(opt->value, M_MOUNT); -#ifdef INVARIANTS - else if (opt->len != 0) - panic("%s: mount option with NULL value but length != 0", - __func__); -#endif free(opt, M_MOUNT); } @@ -204,6 +190,7 @@ vfs_deleteopt(struct vfsoptlist *opts, c static int vfs_equalopts(const char *opt1, const char *opt2) { + char *p; /* "opt" vs. "opt" or "noopt" vs. "noopt" */ if (strcmp(opt1, opt2) == 0) @@ -214,6 +201,17 @@ vfs_equalopts(const char *opt1, const ch /* "opt" vs. "noopt" */ if (strncmp(opt2, "no", 2) == 0 && strcmp(opt1, opt2 + 2) == 0) return (1); + while ((p = strchr(opt1, '.')) != NULL && + !strncmp(opt1, opt2, ++p - opt1)) { + opt2 += p - opt1; + opt1 = p; + /* "foo.noopt" vs. "foo.opt" */ + if (strncmp(opt1, "no", 2) == 0 && strcmp(opt1 + 2, opt2) == 0) + return (1); + /* "foo.opt" vs. "foo.noopt" */ + if (strncmp(opt2, "no", 2) == 0 && strcmp(opt1, opt2 + 2) == 0) + return (1); + } return (0); } @@ -244,34 +242,23 @@ vfs_sanitizeopts(struct vfsoptlist *opts /* * Build a linked list of mount options from a struct uio. */ -static int +int vfs_buildopts(struct uio *auio, struct vfsoptlist **options) { struct vfsoptlist *opts; struct vfsopt *opt; - size_t memused; + size_t memused, namelen, optlen; unsigned int i, iovcnt; - int error, namelen, optlen; + int error; opts = malloc(sizeof(struct vfsoptlist), M_MOUNT, M_WAITOK); TAILQ_INIT(opts); memused = 0; iovcnt = auio->uio_iovcnt; for (i = 0; i < iovcnt; i += 2) { - opt = malloc(sizeof(struct vfsopt), M_MOUNT, M_WAITOK); namelen = auio->uio_iov[i].iov_len; optlen = auio->uio_iov[i + 1].iov_len; - opt->name = malloc(namelen, M_MOUNT, M_WAITOK); - opt->value = NULL; - opt->len = 0; - - /* - * Do this early, so jumps to "bad" will free the current - * option. - */ - TAILQ_INSERT_TAIL(opts, opt, link); memused += sizeof(struct vfsopt) + optlen + namelen; - /* * Avoid consuming too much memory, and attempts to overflow * memused. @@ -283,6 +270,19 @@ vfs_buildopts(struct uio *auio, struct v goto bad; } + opt = malloc(sizeof(struct vfsopt), M_MOUNT, M_WAITOK); + opt->name = malloc(namelen, M_MOUNT, M_WAITOK); + opt->value = NULL; + opt->len = 0; + opt->pos = i / 2; + opt->seen = 0; + + /* + * Do this early, so jumps to "bad" will free the current + * option. + */ + TAILQ_INSERT_TAIL(opts, opt, link); + if (auio->uio_segflg == UIO_SYSSPACE) { bcopy(auio->uio_iov[i].iov_base, opt->name, namelen); } else { @@ -292,7 +292,7 @@ vfs_buildopts(struct uio *auio, struct v goto bad; } /* Ensure names are null-terminated strings. */ - if (opt->name[namelen - 1] != '\0') { + if (namelen == 0 || opt->name[namelen - 1] != '\0') { error = EINVAL; goto bad; } @@ -361,6 +361,7 @@ vfs_mergeopts(struct vfsoptlist *toopts, new->value = NULL; } new->len = opt->len; + new->seen = opt->seen; TAILQ_INSERT_TAIL(toopts, new, link); next: continue; @@ -380,8 +381,6 @@ nmount(td, uap) } */ *uap; { struct uio *auio; - struct iovec *iov; - unsigned int i; int error; u_int iovcnt; @@ -414,16 +413,6 @@ nmount(td, uap) __func__, error); return (error); } - iov = auio->uio_iov; - for (i = 0; i < iovcnt; i++) { - if (iov->iov_len > MMAXOPTIONLEN) { - free(auio, M_IOV); - CTR1(KTR_VFS, "%s: failed for invalid new auio", - __func__); - return (EINVAL); - } - iov++; - } error = vfs_donmount(td, uap->flags, auio); free(auio, M_IOV); @@ -692,6 +681,8 @@ vfs_donmount(struct thread *td, int fsfl noro_opt->name = strdup("noro", M_MOUNT); noro_opt->value = NULL; noro_opt->len = 0; + noro_opt->pos = -1; + noro_opt->seen = 1; TAILQ_INSERT_TAIL(optlist, noro_opt, link); } @@ -1611,6 +1602,22 @@ vfs_mount_error(struct mount *mp, const va_end(ap); } +void +vfs_opterror(struct vfsoptlist *opts, const char *fmt, ...) +{ + va_list ap; + int error, len; + char *errmsg; + + error = vfs_getopt(opts, "errmsg", (void **)&errmsg, &len); + if (error || errmsg == NULL || len <= 0) + return; + + va_start(ap, fmt); + vsnprintf(errmsg, (size_t)len, fmt, ap); + va_end(ap); +} + /* * Find and mount the root filesystem */ @@ -1880,6 +1887,7 @@ vfs_getopt(opts, name, buf, len) TAILQ_FOREACH(opt, opts, link) { if (strcmp(name, opt->name) == 0) { + opt->seen = 1; if (len != NULL) *len = opt->len; if (buf != NULL) @@ -1890,20 +1898,19 @@ vfs_getopt(opts, name, buf, len) return (ENOENT); } -static int +int vfs_getopt_pos(struct vfsoptlist *opts, const char *name) { struct vfsopt *opt; - int i; if (opts == NULL) return (-1); - i = 0; TAILQ_FOREACH(opt, opts, link) { - if (strcmp(name, opt->name) == 0) - return (i); - ++i; + if (strcmp(name, opt->name) == 0) { + opt->seen = 1; + return (opt->pos); + } } return (-1); } @@ -1917,7 +1924,9 @@ vfs_getopts(struct vfsoptlist *opts, con TAILQ_FOREACH(opt, opts, link) { if (strcmp(name, opt->name) != 0) continue; - if (((char *)opt->value)[opt->len - 1] != '\0') { + opt->seen = 1; + if (opt->len == 0 || + ((char *)opt->value)[opt->len - 1] != '\0') { *error = EINVAL; return (NULL); } @@ -1934,6 +1943,7 @@ vfs_flagopt(struct vfsoptlist *opts, con TAILQ_FOREACH(opt, opts, link) { if (strcmp(name, opt->name) == 0) { + opt->seen = 1; if (w != NULL) *w |= val; return (1); @@ -1956,6 +1966,7 @@ vfs_scanopt(struct vfsoptlist *opts, con TAILQ_FOREACH(opt, opts, link) { if (strcmp(name, opt->name) != 0) continue; + opt->seen = 1; if (opt->len == 0 || opt->value == NULL) return (0); if (((char *)opt->value)[opt->len - 1] != '\0') @@ -1968,6 +1979,67 @@ vfs_scanopt(struct vfsoptlist *opts, con return (0); } +int +vfs_setopt(struct vfsoptlist *opts, const char *name, void *value, int len) +{ + struct vfsopt *opt; + + TAILQ_FOREACH(opt, opts, link) { + if (strcmp(name, opt->name) != 0) + continue; + opt->seen = 1; + if (opt->value == NULL) + opt->len = len; + else { + if (opt->len != len) + return (EINVAL); + bcopy(value, opt->value, len); + } + return (0); + } + return (ENOENT); +} + +int +vfs_setopt_part(struct vfsoptlist *opts, const char *name, void *value, int len) +{ + struct vfsopt *opt; + + TAILQ_FOREACH(opt, opts, link) { + if (strcmp(name, opt->name) != 0) + continue; + opt->seen = 1; + if (opt->value == NULL) + opt->len = len; + else { + if (opt->len < len) + return (EINVAL); + opt->len = len; + bcopy(value, opt->value, len); + } + return (0); + } + return (ENOENT); +} + +int +vfs_setopts(struct vfsoptlist *opts, const char *name, const char *value) +{ + struct vfsopt *opt; + + TAILQ_FOREACH(opt, opts, link) { + if (strcmp(name, opt->name) != 0) + continue; + opt->seen = 1; + if (opt->value == NULL) + opt->len = strlen(value) + 1; + else if (strlcpy(opt->value, value, opt->len) >= opt->len) + return (EINVAL); + return (0); + } + return (ENOENT); +} + /* * Find and copy a mount option. * @@ -1989,6 +2061,7 @@ vfs_copyopt(opts, name, dest, len) TAILQ_FOREACH(opt, opts, link) { if (strcmp(name, opt->name) == 0) { + opt->seen = 1; if (len != opt->len) return (EINVAL); bcopy(opt->value, dest, opt->len); Modified: head/sys/sys/mount.h ============================================================================== --- head/sys/sys/mount.h Mon Mar 2 22:16:50 2009 (r189289) +++ head/sys/sys/mount.h Mon Mar 2 23:26:30 2009 (r189290) @@ -127,12 +127,18 @@ struct ostatfs { long f_spare[2]; /* unused spare */ }; -#define MMAXOPTIONLEN 65536 /* maximum length of a mount option */ - TAILQ_HEAD(vnodelst, vnode); -struct vfsoptlist; -struct vfsopt; +/* Mount options list */ +TAILQ_HEAD(vfsoptlist, vfsopt); +struct vfsopt { + TAILQ_ENTRY(vfsopt) link; + char *name; + void *value; + int len; + int pos; + int seen; +}; /* * Structure per mounted filesystem. Each mounted filesystem has an @@ -702,12 +708,21 @@ void vfs_mount_destroy(struct mount *); void vfs_event_signal(fsid_t *, u_int32_t, intptr_t); void vfs_freeopts(struct vfsoptlist *opts); void vfs_deleteopt(struct vfsoptlist *opts, const char *name); +int vfs_buildopts(struct uio *auio, struct vfsoptlist **options); int vfs_flagopt(struct vfsoptlist *opts, const char *name, u_int *w, u_int val); int vfs_getopt(struct vfsoptlist *, const char *, void **, int *); +int vfs_getopt_pos(struct vfsoptlist *opts, const char *name); char *vfs_getopts(struct vfsoptlist *, const char *, int *error); int vfs_copyopt(struct vfsoptlist *, const char *, void *, int); int vfs_filteropt(struct vfsoptlist *, const char **legal); +void vfs_opterror(struct vfsoptlist *opts, const char *fmt, ...); int vfs_scanopt(struct vfsoptlist *opts, const char *name, const char *fmt, ...); +int vfs_setopt(struct vfsoptlist *opts, const char *name, void *value, + int len); +int vfs_setopt_part(struct vfsoptlist *opts, const char *name, void *value, + int len); +int vfs_setopts(struct vfsoptlist *opts, const char *name, + const char *value); int vfs_setpublicfs /* set publicly exported fs */ (struct mount *, struct netexport *, struct export_args *); void vfs_msync(struct mount *, int); From owner-svn-src-head@FreeBSD.ORG Mon Mar 2 23:31: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 D423710656D3; Mon, 2 Mar 2009 23:31:15 +0000 (UTC) (envelope-from imp@bsdimp.com) Received: from harmony.bsdimp.com (bsdimp.com [199.45.160.85]) by mx1.freebsd.org (Postfix) with ESMTP id 90B158FC1D; Mon, 2 Mar 2009 23:31:15 +0000 (UTC) (envelope-from imp@bsdimp.com) Received: from localhost (localhost [127.0.0.1]) by harmony.bsdimp.com (8.14.2/8.14.1) with ESMTP id n22NTg3d033592; Mon, 2 Mar 2009 16:29:42 -0700 (MST) (envelope-from imp@bsdimp.com) Date: Mon, 02 Mar 2009 16:29:58 -0700 (MST) Message-Id: <20090302.162958.-8653806.imp@bsdimp.com> To: ed@80386.nl From: "M. Warner Losh" In-Reply-To: <20090302110737.GG19161@hoeg.nl> References: <1235973158.31933.33.camel@shumai.marcuscom.com> <1235973908.1236.41.camel@widget.2hip.net> <20090302110737.GG19161@hoeg.nl> X-Mailer: Mew version 5.2 on Emacs 21.3 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit Cc: src-committers@FreeBSD.org, rnoland@FreeBSD.org, svn-src-all@FreeBSD.org, svn-src-head@FreeBSD.org, thompsa@FreeBSD.org, marcus@marcuscom.com Subject: Re: svn commit: r189276 - 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: Mon, 02 Mar 2009 23:31:16 -0000 In message: <20090302110737.GG19161@hoeg.nl> Ed Schouten writes: : * Robert Noland wrote: : > On Mon, 2009-03-02 at 00:52 -0500, Joe Marcus Clarke wrote: : > > On Mon, 2009-03-02 at 05:46 +0000, Andrew Thompson wrote: : > > > Author: thompsa : > > > Date: Mon Mar 2 05:46:25 2009 : > > > New Revision: 189276 : > > > URL: http://svn.freebsd.org/changeset/base/189276 : > > > : > > > Log: : > > > Bump __FreeBSD_version for the ushub to uhub rename. : > > : > > Ughhh! Actually, I lied. I should have looked first. I used "usbus" : > > to tie usb2 devices into the hal device tree. Sorry about that. In any : > > event, this might help someone else. : > : > Numbers are cheap. ;) : : Even though we only have 32 left before we reach 800100. 7.0-RELEASE : carried the number 700100, but I guess nothing stops us from picking a : different number. ;-) Guess that means we gotta get busy on the 8.0 release :) Warner From owner-svn-src-head@FreeBSD.ORG Mon Mar 2 23:47: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 2865D1065677; Mon, 2 Mar 2009 23:47:19 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 152D78FC1F; Mon, 2 Mar 2009 23:47:19 +0000 (UTC) (envelope-from delphij@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 n22NlJbt089573; Mon, 2 Mar 2009 23:47:19 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n22NlIRF089556; Mon, 2 Mar 2009 23:47:18 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <200903022347.n22NlIRF089556@svn.freebsd.org> From: Xin LI Date: Mon, 2 Mar 2009 23:47: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: r189291 - in head/lib/libc/db: btree db hash mpool recno 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, 02 Mar 2009 23:47:19 -0000 Author: delphij Date: Mon Mar 2 23:47:18 2009 New Revision: 189291 URL: http://svn.freebsd.org/changeset/base/189291 Log: Diff reduction against OpenBSD: ANSI'fy prototypes. (This is part of a larger changeset which is intended to reduce diff only, thus some prototypes were left intact since they will be changed in the future). Verified with: md5(1) Modified: head/lib/libc/db/btree/bt_close.c head/lib/libc/db/btree/bt_conv.c head/lib/libc/db/btree/bt_debug.c head/lib/libc/db/btree/bt_delete.c head/lib/libc/db/btree/bt_get.c head/lib/libc/db/btree/bt_open.c head/lib/libc/db/btree/bt_overflow.c head/lib/libc/db/btree/bt_page.c head/lib/libc/db/btree/bt_put.c head/lib/libc/db/btree/bt_search.c head/lib/libc/db/btree/bt_seq.c head/lib/libc/db/btree/bt_split.c head/lib/libc/db/btree/bt_utils.c head/lib/libc/db/db/db.c head/lib/libc/db/hash/hash.c head/lib/libc/db/hash/hash_bigkey.c head/lib/libc/db/hash/hash_buf.c head/lib/libc/db/hash/hash_log2.c head/lib/libc/db/hash/hash_page.c head/lib/libc/db/mpool/mpool.c head/lib/libc/db/recno/rec_close.c head/lib/libc/db/recno/rec_delete.c head/lib/libc/db/recno/rec_get.c head/lib/libc/db/recno/rec_open.c head/lib/libc/db/recno/rec_put.c head/lib/libc/db/recno/rec_search.c head/lib/libc/db/recno/rec_seq.c head/lib/libc/db/recno/rec_utils.c Modified: head/lib/libc/db/btree/bt_close.c ============================================================================== --- head/lib/libc/db/btree/bt_close.c Mon Mar 2 23:26:30 2009 (r189290) +++ head/lib/libc/db/btree/bt_close.c Mon Mar 2 23:47:18 2009 (r189291) @@ -61,8 +61,7 @@ static int bt_meta(BTREE *); * RET_ERROR, RET_SUCCESS */ int -__bt_close(dbp) - DB *dbp; +__bt_close(DB *dbp) { BTREE *t; int fd; @@ -116,9 +115,7 @@ __bt_close(dbp) * RET_SUCCESS, RET_ERROR. */ int -__bt_sync(dbp, flags) - const DB *dbp; - u_int flags; +__bt_sync(const DB *dbp, u_int flags) { BTREE *t; int status; @@ -159,8 +156,7 @@ __bt_sync(dbp, flags) * RET_ERROR, RET_SUCCESS */ static int -bt_meta(t) - BTREE *t; +bt_meta(BTREE *t) { BTMETA m; void *p; Modified: head/lib/libc/db/btree/bt_conv.c ============================================================================== --- head/lib/libc/db/btree/bt_conv.c Mon Mar 2 23:26:30 2009 (r189290) +++ head/lib/libc/db/btree/bt_conv.c Mon Mar 2 23:47:18 2009 (r189291) @@ -56,10 +56,7 @@ static void mswap(PAGE *); * h: page to convert */ void -__bt_pgin(t, pg, pp) - void *t; - pgno_t pg; - void *pp; +__bt_pgin(void *t, pgno_t pg, void *pp) { PAGE *h; indx_t i, top; @@ -124,10 +121,7 @@ __bt_pgin(t, pg, pp) } void -__bt_pgout(t, pg, pp) - void *t; - pgno_t pg; - void *pp; +__bt_pgout(void *t, pgno_t pg, void *pp) { PAGE *h; indx_t i, top; @@ -198,8 +192,7 @@ __bt_pgout(t, pg, pp) * p: page to convert */ static void -mswap(pg) - PAGE *pg; +mswap(PAGE *pg) { char *p; Modified: head/lib/libc/db/btree/bt_debug.c ============================================================================== --- head/lib/libc/db/btree/bt_debug.c Mon Mar 2 23:26:30 2009 (r189290) +++ head/lib/libc/db/btree/bt_debug.c Mon Mar 2 23:47:18 2009 (r189291) @@ -53,8 +53,7 @@ __FBSDID("$FreeBSD$"); * dbp: pointer to the DB */ void -__bt_dump(dbp) - DB *dbp; +__bt_dump(DB *dbp) { BTREE *t; PAGE *h; @@ -97,8 +96,7 @@ __bt_dump(dbp) * h: pointer to the PAGE */ void -__bt_dmpage(h) - PAGE *h; +__bt_dmpage(PAGE *h) { BTMETA *m; char *sep; @@ -131,9 +129,7 @@ __bt_dmpage(h) * n: page number to dump. */ void -__bt_dnpage(dbp, pgno) - DB *dbp; - pgno_t pgno; +__bt_dnpage(DB *dbp, pgno_t pgno) { BTREE *t; PAGE *h; @@ -152,8 +148,7 @@ __bt_dnpage(dbp, pgno) * h: pointer to the PAGE */ void -__bt_dpage(h) - PAGE *h; +__bt_dpage(PAGE *h) { BINTERNAL *bi; BLEAF *bl; @@ -249,8 +244,7 @@ __bt_dpage(h) * dbp: pointer to the DB */ void -__bt_stat(dbp) - DB *dbp; +__bt_stat(DB *dbp) { extern u_long bt_cache_hit, bt_cache_miss, bt_pfxsaved, bt_rootsplit; extern u_long bt_sortsplit, bt_split; Modified: head/lib/libc/db/btree/bt_delete.c ============================================================================== --- head/lib/libc/db/btree/bt_delete.c Mon Mar 2 23:26:30 2009 (r189290) +++ head/lib/libc/db/btree/bt_delete.c Mon Mar 2 23:47:18 2009 (r189291) @@ -58,10 +58,7 @@ static int __bt_stkacq(BTREE *, PAGE **, * Return RET_SPECIAL if the key is not found. */ int -__bt_delete(dbp, key, flags) - const DB *dbp; - const DBT *key; - u_int flags; +__bt_delete(const DB *dbp, const DBT *key, u_int flags) { BTREE *t; CURSOR *c; @@ -139,10 +136,7 @@ __bt_delete(dbp, key, flags) * 0 on success, 1 on failure */ static int -__bt_stkacq(t, hp, c) - BTREE *t; - PAGE **hp; - CURSOR *c; +__bt_stkacq(BTREE *t, PAGE **hp, CURSOR *c) { BINTERNAL *bi; EPG *e; @@ -286,9 +280,7 @@ ret: mpool_put(t->bt_mp, h, 0); * RET_ERROR, RET_SUCCESS and RET_SPECIAL if the key not found. */ static int -__bt_bdelete(t, key) - BTREE *t; - const DBT *key; +__bt_bdelete(BTREE *t, const DBT *key) { EPG *e; PAGE *h; @@ -373,9 +365,7 @@ loop: if ((e = __bt_search(t, key, &exac * mpool_put's the page */ static int -__bt_pdelete(t, h) - BTREE *t; - PAGE *h; +__bt_pdelete(BTREE *t, PAGE *h) { BINTERNAL *bi; PAGE *pg; @@ -633,9 +623,7 @@ dup2: c->pg.pgno = e.page->pgno; * h: page to be deleted */ static int -__bt_relink(t, h) - BTREE *t; - PAGE *h; +__bt_relink(BTREE *t, PAGE *h) { PAGE *pg; Modified: head/lib/libc/db/btree/bt_get.c ============================================================================== --- head/lib/libc/db/btree/bt_get.c Mon Mar 2 23:26:30 2009 (r189290) +++ head/lib/libc/db/btree/bt_get.c Mon Mar 2 23:47:18 2009 (r189291) @@ -58,11 +58,7 @@ __FBSDID("$FreeBSD$"); * RET_ERROR, RET_SUCCESS and RET_SPECIAL if the key not found. */ int -__bt_get(dbp, key, data, flags) - const DB *dbp; - const DBT *key; - DBT *data; - u_int flags; +__bt_get(const DB *dbp, const DBT *key, DBT *data, u_int flags) { BTREE *t; EPG *e; Modified: head/lib/libc/db/btree/bt_open.c ============================================================================== --- head/lib/libc/db/btree/bt_open.c Mon Mar 2 23:26:30 2009 (r189290) +++ head/lib/libc/db/btree/bt_open.c Mon Mar 2 23:47:18 2009 (r189291) @@ -87,10 +87,7 @@ static int tmp(void); * */ DB * -__bt_open(fname, flags, mode, openinfo, dflags) - const char *fname; - int flags, mode, dflags; - const BTREEINFO *openinfo; +__bt_open(const char *fname, int flags, int mode, const BTREEINFO *openinfo, int dflags) { struct stat sb; BTMETA m; @@ -350,8 +347,7 @@ err: if (t) { * RET_ERROR, RET_SUCCESS */ static int -nroot(t) - BTREE *t; +nroot(BTREE *t) { PAGE *meta, *root; pgno_t npg; @@ -384,7 +380,7 @@ nroot(t) } static int -tmp() +tmp(void) { sigset_t set, oset; int fd; @@ -405,7 +401,7 @@ tmp() } static int -byteorder() +byteorder(void) { u_int32_t x; u_char *p; @@ -423,8 +419,7 @@ byteorder() } int -__bt_fd(dbp) - const DB *dbp; +__bt_fd(const DB *dbp) { BTREE *t; Modified: head/lib/libc/db/btree/bt_overflow.c ============================================================================== --- head/lib/libc/db/btree/bt_overflow.c Mon Mar 2 23:26:30 2009 (r189290) +++ head/lib/libc/db/btree/bt_overflow.c Mon Mar 2 23:47:18 2009 (r189291) @@ -75,12 +75,7 @@ __FBSDID("$FreeBSD$"); * RET_ERROR, RET_SUCCESS */ int -__ovfl_get(t, p, ssz, buf, bufsz) - BTREE *t; - void *p; - size_t *ssz; - void **buf; - size_t *bufsz; +__ovfl_get(BTREE *t, void *p, size_t *ssz, void **buf, size_t *bufsz) { PAGE *h; pgno_t pg; @@ -134,10 +129,7 @@ __ovfl_get(t, p, ssz, buf, bufsz) * RET_ERROR, RET_SUCCESS */ int -__ovfl_put(t, dbt, pg) - BTREE *t; - const DBT *dbt; - pgno_t *pg; +__ovfl_put(BTREE *t, const DBT *dbt, pgno_t *pg) { PAGE *h, *last; void *p; @@ -188,9 +180,7 @@ __ovfl_put(t, dbt, pg) * RET_ERROR, RET_SUCCESS */ int -__ovfl_delete(t, p) - BTREE *t; - void *p; +__ovfl_delete(BTREE *t, void *p) { PAGE *h; pgno_t pg; Modified: head/lib/libc/db/btree/bt_page.c ============================================================================== --- head/lib/libc/db/btree/bt_page.c Mon Mar 2 23:26:30 2009 (r189290) +++ head/lib/libc/db/btree/bt_page.c Mon Mar 2 23:47:18 2009 (r189291) @@ -55,9 +55,7 @@ __FBSDID("$FreeBSD$"); * mpool_put's the page. */ int -__bt_free(t, h) - BTREE *t; - PAGE *h; +__bt_free(BTREE *t, PAGE *h) { /* Insert the page at the head of the free list. */ h->prevpg = P_INVALID; @@ -81,9 +79,7 @@ __bt_free(t, h) * Pointer to a page, NULL on error. */ PAGE * -__bt_new(t, npg) - BTREE *t; - pgno_t *npg; +__bt_new(BTREE *t, pgno_t *npg) { PAGE *h; Modified: head/lib/libc/db/btree/bt_put.c ============================================================================== --- head/lib/libc/db/btree/bt_put.c Mon Mar 2 23:26:30 2009 (r189290) +++ head/lib/libc/db/btree/bt_put.c Mon Mar 2 23:47:18 2009 (r189291) @@ -62,11 +62,7 @@ static EPG *bt_fast(BTREE *, const DBT * * tree and R_NOOVERWRITE specified. */ int -__bt_put(dbp, key, data, flags) - const DB *dbp; - DBT *key; - const DBT *data; - u_int flags; +__bt_put(const DB *dbp, DBT *key, const DBT *data, u_int flags) { BTREE *t; DBT tkey, tdata; @@ -264,10 +260,7 @@ u_long bt_cache_hit, bt_cache_miss; * EPG for new record or NULL if not found. */ static EPG * -bt_fast(t, key, data, exactp) - BTREE *t; - const DBT *key, *data; - int *exactp; +bt_fast(BTREE *t, const DBT *key, const DBT *data, int *exactp) { PAGE *h; u_int32_t nbytes; Modified: head/lib/libc/db/btree/bt_search.c ============================================================================== --- head/lib/libc/db/btree/bt_search.c Mon Mar 2 23:26:30 2009 (r189290) +++ head/lib/libc/db/btree/bt_search.c Mon Mar 2 23:47:18 2009 (r189291) @@ -61,10 +61,7 @@ static int __bt_sprev(BTREE *, PAGE *, c * the bt_cur field of the tree. A pointer to the field is returned. */ EPG * -__bt_search(t, key, exactp) - BTREE *t; - const DBT *key; - int *exactp; +__bt_search(BTREE *t, const DBT *key, int *exactp) { PAGE *h; indx_t base, index, lim; @@ -146,11 +143,7 @@ next: BT_PUSH(t, h->pgno, index); * If an exact match found. */ static int -__bt_snext(t, h, key, exactp) - BTREE *t; - PAGE *h; - const DBT *key; - int *exactp; +__bt_snext(BTREE *t, PAGE *h, const DBT *key, int *exactp) { EPG e; @@ -185,11 +178,7 @@ __bt_snext(t, h, key, exactp) * If an exact match found. */ static int -__bt_sprev(t, h, key, exactp) - BTREE *t; - PAGE *h; - const DBT *key; - int *exactp; +__bt_sprev(BTREE *t, PAGE *h, const DBT *key, int *exactp) { EPG e; Modified: head/lib/libc/db/btree/bt_seq.c ============================================================================== --- head/lib/libc/db/btree/bt_seq.c Mon Mar 2 23:26:30 2009 (r189290) +++ head/lib/libc/db/btree/bt_seq.c Mon Mar 2 23:47:18 2009 (r189291) @@ -72,10 +72,7 @@ static int __bt_seqset(BTREE *, EPG *, D * RET_ERROR, RET_SUCCESS or RET_SPECIAL if there's no next key. */ int -__bt_seq(dbp, key, data, flags) - const DB *dbp; - DBT *key, *data; - u_int flags; +__bt_seq(const DB *dbp, DBT *key, DBT *data, u_int flags) { BTREE *t; EPG e; @@ -147,11 +144,7 @@ __bt_seq(dbp, key, data, flags) * RET_ERROR, RET_SUCCESS or RET_SPECIAL if there's no next key. */ static int -__bt_seqset(t, ep, key, flags) - BTREE *t; - EPG *ep; - DBT *key; - int flags; +__bt_seqset(BTREE *t, EPG *ep, DBT *key, int flags) { PAGE *h; pgno_t pg; @@ -235,10 +228,7 @@ __bt_seqset(t, ep, key, flags) * RET_ERROR, RET_SUCCESS or RET_SPECIAL if there's no next key. */ static int -__bt_seqadv(t, ep, flags) - BTREE *t; - EPG *ep; - int flags; +__bt_seqadv(BTREE *t, EPG *ep, int flags) { CURSOR *c; PAGE *h; @@ -337,11 +327,7 @@ usecurrent: F_CLR(c, CURS_AFTER | CURS_ * or RET_SPECIAL if no such key exists. */ static int -__bt_first(t, key, erval, exactp) - BTREE *t; - const DBT *key; - EPG *erval; - int *exactp; +__bt_first(BTREE *t, const DBT *key, EPG *erval, int *exactp) { PAGE *h; EPG *ep, save; Modified: head/lib/libc/db/btree/bt_split.c ============================================================================== --- head/lib/libc/db/btree/bt_split.c Mon Mar 2 23:26:30 2009 (r189290) +++ head/lib/libc/db/btree/bt_split.c Mon Mar 2 23:47:18 2009 (r189291) @@ -47,10 +47,10 @@ __FBSDID("$FreeBSD$"); #include "btree.h" static int bt_broot(BTREE *, PAGE *, PAGE *, PAGE *); -static PAGE *bt_page (BTREE *, PAGE *, PAGE **, PAGE **, indx_t *, size_t); +static PAGE *bt_page(BTREE *, PAGE *, PAGE **, PAGE **, indx_t *, size_t); static int bt_preserve(BTREE *, pgno_t); -static PAGE *bt_psplit (BTREE *, PAGE *, PAGE *, PAGE *, indx_t *, size_t); -static PAGE *bt_root (BTREE *, PAGE *, PAGE **, PAGE **, indx_t *, size_t); +static PAGE *bt_psplit(BTREE *, PAGE *, PAGE *, PAGE *, indx_t *, size_t); +static PAGE *bt_root(BTREE *, PAGE *, PAGE **, PAGE **, indx_t *, size_t); static int bt_rroot(BTREE *, PAGE *, PAGE *, PAGE *); static recno_t rec_total(PAGE *); @@ -74,13 +74,8 @@ u_long bt_rootsplit, bt_split, bt_sortsp * RET_ERROR, RET_SUCCESS */ int -__bt_split(t, sp, key, data, flags, ilen, argskip) - BTREE *t; - PAGE *sp; - const DBT *key, *data; - int flags; - size_t ilen; - u_int32_t argskip; +__bt_split(BTREE *t, PAGE *sp, const DBT *key, const DBT *data, int flags, + size_t ilen, u_int32_t argskip) { BINTERNAL *bi; BLEAF *bl, *tbl; @@ -336,11 +331,7 @@ err2: mpool_put(t->bt_mp, l, 0); * Pointer to page in which to insert or NULL on error. */ static PAGE * -bt_page(t, h, lp, rp, skip, ilen) - BTREE *t; - PAGE *h, **lp, **rp; - indx_t *skip; - size_t ilen; +bt_page(BTREE *t, PAGE *h, PAGE **lp, PAGE **rp, indx_t *skip, size_t ilen) { PAGE *l, *r, *tp; pgno_t npg; @@ -441,11 +432,7 @@ bt_page(t, h, lp, rp, skip, ilen) * Pointer to page in which to insert or NULL on error. */ static PAGE * -bt_root(t, h, lp, rp, skip, ilen) - BTREE *t; - PAGE *h, **lp, **rp; - indx_t *skip; - size_t ilen; +bt_root(BTREE *t, PAGE *h, PAGE **lp, PAGE **rp, indx_t *skip, size_t ilen) { PAGE *l, *r, *tp; pgno_t lnpg, rnpg; @@ -488,9 +475,7 @@ bt_root(t, h, lp, rp, skip, ilen) * RET_ERROR, RET_SUCCESS */ static int -bt_rroot(t, h, l, r) - BTREE *t; - PAGE *h, *l, *r; +bt_rroot(BTREE *t, PAGE *h, PAGE *l, PAGE *r) { char *dest; @@ -528,9 +513,7 @@ bt_rroot(t, h, l, r) * RET_ERROR, RET_SUCCESS */ static int -bt_broot(t, h, l, r) - BTREE *t; - PAGE *h, *l, *r; +bt_broot(BTREE *t, PAGE *h, PAGE *l, PAGE *r) { BINTERNAL *bi; BLEAF *bl; @@ -605,11 +588,7 @@ bt_broot(t, h, l, r) * Pointer to page in which to insert. */ static PAGE * -bt_psplit(t, h, l, r, pskip, ilen) - BTREE *t; - PAGE *h, *l, *r; - indx_t *pskip; - size_t ilen; +bt_psplit(BTREE *t, PAGE *h, PAGE *l, PAGE *r, indx_t *pskip, size_t ilen) { BINTERNAL *bi; BLEAF *bl; @@ -783,9 +762,7 @@ bt_psplit(t, h, l, r, pskip, ilen) * RET_SUCCESS, RET_ERROR. */ static int -bt_preserve(t, pg) - BTREE *t; - pgno_t pg; +bt_preserve(BTREE *t, pgno_t pg) { PAGE *h; @@ -811,8 +788,7 @@ bt_preserve(t, pg) * all the way back to bt_split/bt_rroot and it's not very clean. */ static recno_t -rec_total(h) - PAGE *h; +rec_total(PAGE *h) { recno_t recs; indx_t nxt, top; Modified: head/lib/libc/db/btree/bt_utils.c ============================================================================== --- head/lib/libc/db/btree/bt_utils.c Mon Mar 2 23:26:30 2009 (r189290) +++ head/lib/libc/db/btree/bt_utils.c Mon Mar 2 23:47:18 2009 (r189291) @@ -62,11 +62,7 @@ __FBSDID("$FreeBSD$"); * RET_SUCCESS, RET_ERROR. */ int -__bt_ret(t, e, key, rkey, data, rdata, copy) - BTREE *t; - EPG *e; - DBT *key, *rkey, *data, *rdata; - int copy; +__bt_ret(BTREE *t, EPG *e, DBT *key, DBT *rkey, DBT *data, DBT *rdata, int copy) { BLEAF *bl; void *p; @@ -148,10 +144,7 @@ dataonly: * > 0 if k1 is > record */ int -__bt_cmp(t, k1, e) - BTREE *t; - const DBT *k1; - EPG *e; +__bt_cmp(BTREE *t, const DBT *k1, EPG *e) { BINTERNAL *bi; BLEAF *bl; @@ -211,8 +204,7 @@ __bt_cmp(t, k1, e) * > 0 if a is > b */ int -__bt_defcmp(a, b) - const DBT *a, *b; +__bt_defcmp(const DBT *a, const DBT *b) { size_t len; u_char *p1, *p2; @@ -241,8 +233,7 @@ __bt_defcmp(a, b) * Number of bytes needed to distinguish b from a. */ size_t -__bt_defpfx(a, b) - const DBT *a, *b; +__bt_defpfx(const DBT *a, const DBT *b) { u_char *p1, *p2; size_t cnt, len; Modified: head/lib/libc/db/db/db.c ============================================================================== --- head/lib/libc/db/db/db.c Mon Mar 2 23:26:30 2009 (r189290) +++ head/lib/libc/db/db/db.c Mon Mar 2 23:47:18 2009 (r189291) @@ -42,12 +42,10 @@ __FBSDID("$FreeBSD$"); #include +static int __dberr(void); + DB * -dbopen(fname, flags, mode, type, openinfo) - const char *fname; - int flags, mode; - DBTYPE type; - const void *openinfo; +dbopen(const char *fname, int flags, int mode, DBTYPE type, const void *openinfo) { #define DB_FLAGS (DB_LOCK | DB_SHMEM | DB_TXN) @@ -72,7 +70,7 @@ dbopen(fname, flags, mode, type, openinf } static int -__dberr() +__dberr(void) { return (RET_ERROR); } @@ -84,14 +82,13 @@ __dberr() * dbp: pointer to the DB structure. */ void -__dbpanic(dbp) - DB *dbp; +__dbpanic(DB *dbp) { /* The only thing that can succeed is a close. */ - dbp->del = (int (*)())__dberr; - dbp->fd = (int (*)())__dberr; - dbp->get = (int (*)())__dberr; - dbp->put = (int (*)())__dberr; - dbp->seq = (int (*)())__dberr; - dbp->sync = (int (*)())__dberr; + dbp->del = (int (*)(const struct __db *, const DBT*, u_int))__dberr; + dbp->fd = (int (*)(const struct __db *))__dberr; + dbp->get = (int (*)(const struct __db *, const DBT*, DBT *, u_int))__dberr; + dbp->put = (int (*)(const struct __db *, DBT *, const DBT *, u_int))__dberr; + dbp->seq = (int (*)(const struct __db *, DBT *, DBT *, u_int))__dberr; + dbp->sync = (int (*)(const struct __db *, u_int))__dberr; } Modified: head/lib/libc/db/hash/hash.c ============================================================================== --- head/lib/libc/db/hash/hash.c Mon Mar 2 23:26:30 2009 (r189290) +++ head/lib/libc/db/hash/hash.c Mon Mar 2 23:47:18 2009 (r189291) @@ -92,11 +92,11 @@ int hash_accesses, hash_collisions, hash /************************** INTERFACE ROUTINES ***************************/ /* OPEN/CLOSE */ -extern DB * -__hash_open(file, flags, mode, info, dflags) - const char *file; - int flags, mode, dflags; - const HASHINFO *info; /* Special directives for create */ +/* ARGSUSED */ +DB * +__hash_open(const char *file, int flags, int mode, + const HASHINFO *info, /* Special directives for create */ + int dflags) { HTAB *hashp; struct stat statbuf; @@ -249,8 +249,7 @@ error0: } static int -hash_close(dbp) - DB *dbp; +hash_close(DB *dbp) { HTAB *hashp; int retval; @@ -265,8 +264,7 @@ hash_close(dbp) } static int -hash_fd(dbp) - const DB *dbp; +hash_fd(const DB *dbp) { HTAB *hashp; @@ -283,10 +281,7 @@ hash_fd(dbp) /************************** LOCAL CREATION ROUTINES **********************/ static HTAB * -init_hash(hashp, file, info) - HTAB *hashp; - const char *file; - const HASHINFO *info; +init_hash(HTAB *hashp, const char *file, const HASHINFO *info) { struct stat statbuf; int nelem; @@ -350,9 +345,7 @@ init_hash(hashp, file, info) * Returns 0 on No Error */ static int -init_htab(hashp, nelem) - HTAB *hashp; - int nelem; +init_htab(HTAB *hashp, int nelem) { int nbuckets, nsegs; int l2; @@ -396,8 +389,7 @@ init_htab(hashp, nelem) * structure, freeing all allocated space. */ static int -hdestroy(hashp) - HTAB *hashp; +hdestroy(HTAB *hashp) { int i, save_errno; @@ -456,9 +448,7 @@ hdestroy(hashp) * -1 ERROR */ static int -hash_sync(dbp, flags) - const DB *dbp; - u_int32_t flags; +hash_sync(const DB *dbp, u_int32_t flags) { HTAB *hashp; @@ -485,8 +475,7 @@ hash_sync(dbp, flags) * -1 indicates that errno should be set */ static int -flush_meta(hashp) - HTAB *hashp; +flush_meta(HTAB *hashp) { HASHHDR *whdrp; #if BYTE_ORDER == LITTLE_ENDIAN @@ -533,11 +522,7 @@ flush_meta(hashp) * -1 to indicate an internal ERROR (i.e. out of memory, etc) */ static int -hash_get(dbp, key, data, flag) - const DB *dbp; - const DBT *key; - DBT *data; - u_int32_t flag; +hash_get(const DB *dbp, const DBT *key, DBT *data, u_int32_t flag) { HTAB *hashp; @@ -550,11 +535,7 @@ hash_get(dbp, key, data, flag) } static int -hash_put(dbp, key, data, flag) - const DB *dbp; - DBT *key; - const DBT *data; - u_int32_t flag; +hash_put(const DB *dbp, DBT *key, const DBT *data, u_int32_t flag) { HTAB *hashp; @@ -573,10 +554,8 @@ hash_put(dbp, key, data, flag) } static int -hash_delete(dbp, key, flag) - const DB *dbp; - const DBT *key; - u_int32_t flag; /* Ignored */ +hash_delete(const DB *dbp, const DBT *key, + u_int32_t flag) /* Ignored */ { HTAB *hashp; @@ -596,10 +575,7 @@ hash_delete(dbp, key, flag) * Assume that hashp has been set in wrapper routine. */ static int -hash_access(hashp, action, key, val) - HTAB *hashp; - ACTION action; - DBT *key, *val; +hash_access(HTAB *hashp, ACTION action, DBT *key, DBT *val) { BUFHEAD *rbufp; BUFHEAD *bufp, *save_bufp; @@ -725,10 +701,7 @@ found: } static int -hash_seq(dbp, key, data, flag) - const DB *dbp; - DBT *key, *data; - u_int32_t flag; +hash_seq(const DB *dbp, DBT *key, DBT *data, u_int32_t flag) { u_int32_t bucket; BUFHEAD *bufp; @@ -814,9 +787,8 @@ hash_seq(dbp, key, data, flag) * 0 ==> OK * -1 ==> Error */ -extern int -__expand_table(hashp) - HTAB *hashp; +int +__expand_table(HTAB *hashp) { u_int32_t old_bucket, new_bucket; int dirsize, new_segnum, spare_ndx; @@ -870,9 +842,7 @@ __expand_table(hashp) * fails, then this routine can go away. */ static void * -hash_realloc(p_ptr, oldsize, newsize) - SEGMENT **p_ptr; - int oldsize, newsize; +hash_realloc(SEGMENT **p_ptr, int oldsize, int newsize) { void *p; @@ -885,11 +855,8 @@ hash_realloc(p_ptr, oldsize, newsize) return (p); } -extern u_int32_t -__call_hash(hashp, k, len) - HTAB *hashp; - char *k; - int len; +u_int32_t +__call_hash(HTAB *hashp, char *k, int len) { int n, bucket; @@ -906,9 +873,7 @@ __call_hash(hashp, k, len) * Returns 0 on success */ static int -alloc_segs(hashp, nsegs) - HTAB *hashp; - int nsegs; +alloc_segs(HTAB *hashp, int nsegs) { int i; SEGMENT store; @@ -940,8 +905,7 @@ alloc_segs(hashp, nsegs) * Hashp->hdr needs to be byteswapped. */ static void -swap_header_copy(srcp, destp) - HASHHDR *srcp, *destp; +swap_header_copy(HASHHDR *srcp, HASHHDR *destp) { int i; @@ -969,8 +933,7 @@ swap_header_copy(srcp, destp) } static void -swap_header(hashp) - HTAB *hashp; +swap_header(HTAB *hashp) { HASHHDR *hdrp; int i; Modified: head/lib/libc/db/hash/hash_bigkey.c ============================================================================== --- head/lib/libc/db/hash/hash_bigkey.c Mon Mar 2 23:26:30 2009 (r189290) +++ head/lib/libc/db/hash/hash_bigkey.c Mon Mar 2 23:47:18 2009 (r189291) @@ -82,11 +82,8 @@ static int collect_data(HTAB *, BUFHEAD * 0 ==> OK *-1 ==> ERROR */ -extern int -__big_insert(hashp, bufp, key, val) - HTAB *hashp; - BUFHEAD *bufp; - const DBT *key, *val; +int +__big_insert(HTAB *hashp, BUFHEAD *bufp, const DBT *key, const DBT *val) { u_int16_t *p; int key_size, n, val_size; @@ -182,10 +179,8 @@ __big_insert(hashp, bufp, key, val) * 0 => OK *-1 => ERROR */ -extern int -__big_delete(hashp, bufp) - HTAB *hashp; - BUFHEAD *bufp; +int +__big_delete(HTAB *hashp, BUFHEAD *bufp) { BUFHEAD *last_bfp, *rbufp; u_int16_t *bp, pageno; @@ -261,13 +256,8 @@ __big_delete(hashp, bufp) * -2 means key not found and this is big key/data * -3 error */ -extern int -__find_bigpair(hashp, bufp, ndx, key, size) - HTAB *hashp; - BUFHEAD *bufp; - int ndx; - char *key; - int size; +int +__find_bigpair(HTAB *hashp, BUFHEAD *bufp, int ndx, char *key, int size) { u_int16_t *bp; char *p; @@ -313,10 +303,8 @@ __find_bigpair(hashp, bufp, ndx, key, si * of the pair; 0 if there isn't any (i.e. big pair is the last key in the * bucket) */ -extern u_int16_t -__find_last_page(hashp, bpp) - HTAB *hashp; - BUFHEAD **bpp; +u_int16_t +__find_last_page(HTAB *hashp, BUFHEAD **bpp) { BUFHEAD *bufp; u_int16_t *bp, pageno; @@ -354,13 +342,8 @@ __find_last_page(hashp, bpp) * Return the data for the key/data pair that begins on this page at this * index (index should always be 1). */ -extern int -__big_return(hashp, bufp, ndx, val, set_current) - HTAB *hashp; - BUFHEAD *bufp; - int ndx; - DBT *val; - int set_current; +int +__big_return(HTAB *hashp, BUFHEAD *bufp, int ndx, DBT *val, int set_current) { BUFHEAD *save_p; u_int16_t *bp, len, off, save_addr; @@ -446,10 +429,7 @@ __big_return(hashp, bufp, ndx, val, set_ * allocate a buffer and copy the data as you recurse up. */ static int -collect_data(hashp, bufp, len, set) - HTAB *hashp; - BUFHEAD *bufp; - int len, set; +collect_data(HTAB *hashp, BUFHEAD *bufp, int len, int set) { u_int16_t *bp; char *p; @@ -501,12 +481,8 @@ collect_data(hashp, bufp, len, set) /* * Fill in the key and data for this big pair. */ -extern int -__big_keydata(hashp, bufp, key, val, set) - HTAB *hashp; - BUFHEAD *bufp; - DBT *key, *val; - int set; +int +__big_keydata(HTAB *hashp, BUFHEAD *bufp, DBT *key, DBT *val, int set) { key->size = collect_key(hashp, bufp, 0, val, set); if (key->size == -1) @@ -520,12 +496,7 @@ __big_keydata(hashp, bufp, key, val, set * collect the data, allocate a buffer and copy the key as you recurse up. */ static int -collect_key(hashp, bufp, len, val, set) - HTAB *hashp; - BUFHEAD *bufp; - int len; - DBT *val; - int set; +collect_key(HTAB *hashp, BUFHEAD *bufp, int len, DBT *val, int set) { BUFHEAD *xbp; char *p; @@ -564,16 +535,14 @@ collect_key(hashp, bufp, len, val, set) * 0 => OK * -1 => error */ -extern int -__big_split(hashp, op, np, big_keyp, addr, obucket, ret) - HTAB *hashp; - BUFHEAD *op; /* Pointer to where to put keys that go in old bucket */ - BUFHEAD *np; /* Pointer to new bucket page */ - /* Pointer to first page containing the big key/data */ - BUFHEAD *big_keyp; - int addr; /* Address of big_keyp */ - u_int32_t obucket;/* Old Bucket */ - SPLIT_RETURN *ret; +int +__big_split(HTAB *hashp, + BUFHEAD *op, /* Pointer to where to put keys that go in old bucket */ + BUFHEAD *np, /* Pointer to new bucket page */ + BUFHEAD *big_keyp, /* Pointer to first page containing the big key/data */ + int addr, /* Address of big_keyp */ + u_int32_t obucket, /* Old Bucket */ *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@FreeBSD.ORG Tue Mar 3 02:16: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 48C67106566C; Tue, 3 Mar 2009 02:16:13 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 351888FC19; Tue, 3 Mar 2009 02:16:13 +0000 (UTC) (envelope-from delphij@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 n232GCQo092357; Tue, 3 Mar 2009 02:16:12 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n232GCbC092350; Tue, 3 Mar 2009 02:16:12 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <200903030216.n232GCbC092350@svn.freebsd.org> From: Xin LI Date: Tue, 3 Mar 2009 02:16: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: r189292 - in head/lib/libc/db: btree recno 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, 03 Mar 2009 02:16:13 -0000 Author: delphij Date: Tue Mar 3 02:16:12 2009 New Revision: 189292 URL: http://svn.freebsd.org/changeset/base/189292 Log: Rename variable 'index' to 'idx' to avoid name collision with index(3), this commit does not affect any object code. Obtained from: OpenBSD Verified with: md5(1) Modified: head/lib/libc/db/btree/bt_delete.c head/lib/libc/db/btree/bt_put.c head/lib/libc/db/btree/bt_search.c head/lib/libc/db/btree/bt_seq.c head/lib/libc/db/recno/rec_delete.c head/lib/libc/db/recno/rec_put.c head/lib/libc/db/recno/rec_search.c Modified: head/lib/libc/db/btree/bt_delete.c ============================================================================== --- head/lib/libc/db/btree/bt_delete.c Mon Mar 2 23:47:18 2009 (r189291) +++ head/lib/libc/db/btree/bt_delete.c Tue Mar 3 02:16:12 2009 (r189292) @@ -142,7 +142,7 @@ __bt_stkacq(BTREE *t, PAGE **hp, CURSOR EPG *e; EPGNO *parent; PAGE *h; - indx_t index; + indx_t idx; pgno_t pgno; recno_t nextpg, prevpg; int exact, level; @@ -180,8 +180,8 @@ __bt_stkacq(BTREE *t, PAGE **hp, CURSOR /* Move to the next index. */ if (parent->index != NEXTINDEX(h) - 1) { - index = parent->index + 1; - BT_PUSH(t, h->pgno, index); + idx = parent->index + 1; + BT_PUSH(t, h->pgno, idx); break; } mpool_put(t->bt_mp, h, 0); @@ -190,7 +190,7 @@ __bt_stkacq(BTREE *t, PAGE **hp, CURSOR /* Restore the stack. */ while (level--) { /* Push the next level down onto the stack. */ - bi = GETBINTERNAL(h, index); + bi = GETBINTERNAL(h, idx); pgno = bi->pgno; BT_PUSH(t, pgno, 0); @@ -200,7 +200,7 @@ __bt_stkacq(BTREE *t, PAGE **hp, CURSOR /* Get the next level down. */ if ((h = mpool_get(t->bt_mp, pgno, 0)) == NULL) return (1); - index = 0; + idx = 0; } mpool_put(t->bt_mp, h, 0); if ((h = mpool_get(t->bt_mp, nextpg, 0)) == NULL) @@ -235,8 +235,8 @@ __bt_stkacq(BTREE *t, PAGE **hp, CURSOR /* Move to the next index. */ if (parent->index != 0) { - index = parent->index - 1; - BT_PUSH(t, h->pgno, index); + idx = parent->index - 1; + BT_PUSH(t, h->pgno, idx); break; } mpool_put(t->bt_mp, h, 0); @@ -245,7 +245,7 @@ __bt_stkacq(BTREE *t, PAGE **hp, CURSOR /* Restore the stack. */ while (level--) { /* Push the next level down onto the stack. */ - bi = GETBINTERNAL(h, index); + bi = GETBINTERNAL(h, idx); pgno = bi->pgno; /* Lose the currently pinned page. */ @@ -255,8 +255,8 @@ __bt_stkacq(BTREE *t, PAGE **hp, CURSOR if ((h = mpool_get(t->bt_mp, pgno, 0)) == NULL) return (1); - index = NEXTINDEX(h) - 1; - BT_PUSH(t, pgno, index); + idx = NEXTINDEX(h) - 1; + BT_PUSH(t, pgno, idx); } mpool_put(t->bt_mp, h, 0); if ((h = mpool_get(t->bt_mp, prevpg, 0)) == NULL) @@ -370,7 +370,7 @@ __bt_pdelete(BTREE *t, PAGE *h) BINTERNAL *bi; PAGE *pg; EPGNO *parent; - indx_t cnt, index, *ip, offset; + indx_t cnt, idx, *ip, offset; u_int32_t nksize; char *from; @@ -391,8 +391,8 @@ __bt_pdelete(BTREE *t, PAGE *h) if ((pg = mpool_get(t->bt_mp, parent->pgno, 0)) == NULL) return (RET_ERROR); - index = parent->index; - bi = GETBINTERNAL(pg, index); + idx = parent->index; + bi = GETBINTERNAL(pg, idx); /* Free any overflow pages. */ if (bi->flags & P_BIGKEY && @@ -424,11 +424,11 @@ __bt_pdelete(BTREE *t, PAGE *h) pg->upper += nksize; /* Adjust indices' offsets, shift the indices down. */ - offset = pg->linp[index]; - for (cnt = index, ip = &pg->linp[0]; cnt--; ++ip) + offset = pg->linp[idx]; + for (cnt = idx, ip = &pg->linp[0]; cnt--; ++ip) if (ip[0] < offset) ip[0] += nksize; - for (cnt = NEXTINDEX(pg) - index; --cnt; ++ip) + for (cnt = NEXTINDEX(pg) - idx; --cnt; ++ip) ip[0] = ip[1] < offset ? ip[1] + nksize : ip[1]; pg->lower -= sizeof(indx_t); } @@ -453,17 +453,13 @@ __bt_pdelete(BTREE *t, PAGE *h) * t: tree * key: referenced key * h: page - * index: index on page to delete + * idx: index on page to delete * * Returns: * RET_SUCCESS, RET_ERROR. */ int -__bt_dleaf(t, key, h, index) - BTREE *t; - const DBT *key; - PAGE *h; - u_int index; +__bt_dleaf(BTREE *t, const DBT *key, PAGE *h, u_int idx) { BLEAF *bl; indx_t cnt, *ip, offset; @@ -474,12 +470,12 @@ __bt_dleaf(t, key, h, index) /* If this record is referenced by the cursor, delete the cursor. */ if (F_ISSET(&t->bt_cursor, CURS_INIT) && !F_ISSET(&t->bt_cursor, CURS_ACQUIRE) && - t->bt_cursor.pg.pgno == h->pgno && t->bt_cursor.pg.index == index && - __bt_curdel(t, key, h, index)) + t->bt_cursor.pg.pgno == h->pgno && t->bt_cursor.pg.index == idx && + __bt_curdel(t, key, h, idx)) return (RET_ERROR); /* If the entry uses overflow pages, make them available for reuse. */ - to = bl = GETBLEAF(h, index); + to = bl = GETBLEAF(h, idx); if (bl->flags & P_BIGKEY && __ovfl_delete(t, bl->bytes) == RET_ERROR) return (RET_ERROR); if (bl->flags & P_BIGDATA && @@ -493,18 +489,18 @@ __bt_dleaf(t, key, h, index) h->upper += nbytes; /* Adjust the indices' offsets, shift the indices down. */ - offset = h->linp[index]; - for (cnt = index, ip = &h->linp[0]; cnt--; ++ip) + offset = h->linp[idx]; + for (cnt = idx, ip = &h->linp[0]; cnt--; ++ip) if (ip[0] < offset) ip[0] += nbytes; - for (cnt = NEXTINDEX(h) - index; --cnt; ++ip) + for (cnt = NEXTINDEX(h) - idx; --cnt; ++ip) ip[0] = ip[1] < offset ? ip[1] + nbytes : ip[1]; h->lower -= sizeof(indx_t); /* If the cursor is on this page, adjust it as necessary. */ if (F_ISSET(&t->bt_cursor, CURS_INIT) && !F_ISSET(&t->bt_cursor, CURS_ACQUIRE) && - t->bt_cursor.pg.pgno == h->pgno && t->bt_cursor.pg.index > index) + t->bt_cursor.pg.pgno == h->pgno && t->bt_cursor.pg.index > idx) --t->bt_cursor.pg.index; return (RET_SUCCESS); @@ -518,17 +514,13 @@ __bt_dleaf(t, key, h, index) * t: tree * key: referenced key (or NULL) * h: page - * index: index on page to delete + * idx: index on page to delete * * Returns: * RET_SUCCESS, RET_ERROR. */ static int -__bt_curdel(t, key, h, index) - BTREE *t; - const DBT *key; - PAGE *h; - u_int index; +__bt_curdel(BTREE *t, const DBT *key, PAGE *h, u_int idx) { CURSOR *c; EPG e; @@ -551,7 +543,7 @@ __bt_curdel(t, key, h, index) */ if (key == NULL) { e.page = h; - e.index = index; + e.index = idx; if ((status = __bt_ret(t, &e, &c->key, &c->key, NULL, NULL, 1)) != RET_SUCCESS) return (status); @@ -559,25 +551,25 @@ __bt_curdel(t, key, h, index) key = &c->key; } /* Check previous key, if not at the beginning of the page. */ - if (index > 0) { + if (idx > 0) { e.page = h; - e.index = index - 1; + e.index = idx - 1; if (__bt_cmp(t, key, &e) == 0) { F_SET(c, CURS_BEFORE); goto dup2; } } /* Check next key, if not at the end of the page. */ - if (index < NEXTINDEX(h) - 1) { + if (idx < NEXTINDEX(h) - 1) { e.page = h; - e.index = index + 1; + e.index = idx + 1; if (__bt_cmp(t, key, &e) == 0) { F_SET(c, CURS_AFTER); goto dup2; } } /* Check previous key if at the beginning of the page. */ - if (index == 0 && h->prevpg != P_INVALID) { + if (idx == 0 && h->prevpg != P_INVALID) { if ((pg = mpool_get(t->bt_mp, h->prevpg, 0)) == NULL) return (RET_ERROR); e.page = pg; @@ -589,7 +581,7 @@ __bt_curdel(t, key, h, index) mpool_put(t->bt_mp, pg, 0); } /* Check next key if at the end of the page. */ - if (index == NEXTINDEX(h) - 1 && h->nextpg != P_INVALID) { + if (idx == NEXTINDEX(h) - 1 && h->nextpg != P_INVALID) { if ((pg = mpool_get(t->bt_mp, h->nextpg, 0)) == NULL) return (RET_ERROR); e.page = pg; @@ -605,7 +597,7 @@ dup2: c->pg.pgno = e.page->pgno; } } e.page = h; - e.index = index; + e.index = idx; if (curcopy || (status = __bt_ret(t, &e, &c->key, &c->key, NULL, NULL, 1)) == RET_SUCCESS) { F_SET(c, CURS_ACQUIRE); Modified: head/lib/libc/db/btree/bt_put.c ============================================================================== --- head/lib/libc/db/btree/bt_put.c Mon Mar 2 23:47:18 2009 (r189291) +++ head/lib/libc/db/btree/bt_put.c Tue Mar 3 02:16:12 2009 (r189292) @@ -68,7 +68,7 @@ __bt_put(const DB *dbp, DBT *key, const DBT tkey, tdata; EPG *e; PAGE *h; - indx_t index, nxtindex; + indx_t idx, nxtindex; pgno_t pg; u_int32_t nbytes, tmp; int dflags, exact, status; @@ -149,7 +149,7 @@ storekey: if (__ovfl_put(t, key, &pg) = if (flags == R_CURSOR) { if ((h = mpool_get(t->bt_mp, t->bt_cursor.pg.pgno, 0)) == NULL) return (RET_ERROR); - index = t->bt_cursor.pg.index; + idx = t->bt_cursor.pg.index; goto delete; } @@ -161,7 +161,7 @@ storekey: if (__ovfl_put(t, key, &pg) = if ((e = __bt_search(t, key, &exact)) == NULL) return (RET_ERROR); h = e->page; - index = e->index; + idx = e->index; /* * Add the key/data pair to the tree. If an identical key is already @@ -183,7 +183,7 @@ storekey: if (__ovfl_put(t, key, &pg) = * Note, the delete may empty the page, so we need to put a * new entry into the page immediately. */ -delete: if (__bt_dleaf(t, key, h, index) == RET_ERROR) { +delete: if (__bt_dleaf(t, key, h, idx) == RET_ERROR) { mpool_put(t->bt_mp, h, 0); return (RET_ERROR); } @@ -199,35 +199,35 @@ delete: if (__bt_dleaf(t, key, h, index nbytes = NBLEAFDBT(key->size, data->size); if (h->upper - h->lower < nbytes + sizeof(indx_t)) { if ((status = __bt_split(t, h, key, - data, dflags, nbytes, index)) != RET_SUCCESS) + data, dflags, nbytes, idx)) != RET_SUCCESS) return (status); goto success; } - if (index < (nxtindex = NEXTINDEX(h))) - memmove(h->linp + index + 1, h->linp + index, - (nxtindex - index) * sizeof(indx_t)); + if (idx < (nxtindex = NEXTINDEX(h))) + memmove(h->linp + idx + 1, h->linp + idx, + (nxtindex - idx) * sizeof(indx_t)); h->lower += sizeof(indx_t); - h->linp[index] = h->upper -= nbytes; + h->linp[idx] = h->upper -= nbytes; dest = (char *)h + h->upper; WR_BLEAF(dest, key, data, dflags); /* If the cursor is on this page, adjust it as necessary. */ if (F_ISSET(&t->bt_cursor, CURS_INIT) && !F_ISSET(&t->bt_cursor, CURS_ACQUIRE) && - t->bt_cursor.pg.pgno == h->pgno && t->bt_cursor.pg.index >= index) + t->bt_cursor.pg.pgno == h->pgno && t->bt_cursor.pg.index >= idx) ++t->bt_cursor.pg.index; if (t->bt_order == NOT) { if (h->nextpg == P_INVALID) { - if (index == NEXTINDEX(h) - 1) { + if (idx == NEXTINDEX(h) - 1) { t->bt_order = FORWARD; - t->bt_last.index = index; + t->bt_last.index = idx; t->bt_last.pgno = h->pgno; } } else if (h->prevpg == P_INVALID) { - if (index == 0) { + if (idx == 0) { t->bt_order = BACK; t->bt_last.index = 0; t->bt_last.pgno = h->pgno; Modified: head/lib/libc/db/btree/bt_search.c ============================================================================== --- head/lib/libc/db/btree/bt_search.c Mon Mar 2 23:47:18 2009 (r189291) +++ head/lib/libc/db/btree/bt_search.c Tue Mar 3 02:16:12 2009 (r189292) @@ -64,7 +64,7 @@ EPG * __bt_search(BTREE *t, const DBT *key, int *exactp) { PAGE *h; - indx_t base, index, lim; + indx_t base, idx, lim; pgno_t pg; int cmp; @@ -76,7 +76,7 @@ __bt_search(BTREE *t, const DBT *key, in /* Do a binary search on the current page. */ t->bt_cur.page = h; for (base = 0, lim = NEXTINDEX(h); lim; lim >>= 1) { - t->bt_cur.index = index = base + (lim >> 1); + t->bt_cur.index = idx = base + (lim >> 1); if ((cmp = __bt_cmp(t, key, &t->bt_cur)) == 0) { if (h->flags & P_BLEAF) { *exactp = 1; @@ -85,7 +85,7 @@ __bt_search(BTREE *t, const DBT *key, in goto next; } if (cmp > 0) { - base = index + 1; + base = idx + 1; --lim; } } @@ -121,10 +121,10 @@ __bt_search(BTREE *t, const DBT *key, in * be a parent page for the key. If a split later occurs, the * inserted page will be to the right of the saved page. */ - index = base ? base - 1 : base; + idx = base ? base - 1 : base; -next: BT_PUSH(t, h->pgno, index); - pg = GETBINTERNAL(h, index)->pgno; +next: BT_PUSH(t, h->pgno, idx); + pg = GETBINTERNAL(h, idx)->pgno; mpool_put(t->bt_mp, h, 0); } } Modified: head/lib/libc/db/btree/bt_seq.c ============================================================================== --- head/lib/libc/db/btree/bt_seq.c Mon Mar 2 23:47:18 2009 (r189291) +++ head/lib/libc/db/btree/bt_seq.c Tue Mar 3 02:16:12 2009 (r189292) @@ -232,7 +232,7 @@ __bt_seqadv(BTREE *t, EPG *ep, int flags { CURSOR *c; PAGE *h; - indx_t index; + indx_t idx; pgno_t pg; int exact; @@ -270,15 +270,15 @@ __bt_seqadv(BTREE *t, EPG *ep, int flags */ if (F_ISSET(c, CURS_AFTER)) goto usecurrent; - index = c->pg.index; - if (++index == NEXTINDEX(h)) { + idx = c->pg.index; + if (++idx == NEXTINDEX(h)) { pg = h->nextpg; mpool_put(t->bt_mp, h, 0); if (pg == P_INVALID) return (RET_SPECIAL); if ((h = mpool_get(t->bt_mp, pg, 0)) == NULL) return (RET_ERROR); - index = 0; + idx = 0; } break; case R_PREV: /* Previous record. */ @@ -293,22 +293,22 @@ usecurrent: F_CLR(c, CURS_AFTER | CURS_ ep->index = c->pg.index; return (RET_SUCCESS); } - index = c->pg.index; - if (index == 0) { + idx = c->pg.index; + if (idx == 0) { pg = h->prevpg; mpool_put(t->bt_mp, h, 0); if (pg == P_INVALID) return (RET_SPECIAL); if ((h = mpool_get(t->bt_mp, pg, 0)) == NULL) return (RET_ERROR); - index = NEXTINDEX(h) - 1; + idx = NEXTINDEX(h) - 1; } else - --index; + --idx; break; } ep->page = h; - ep->index = index; + ep->index = idx; return (RET_SUCCESS); } @@ -421,13 +421,10 @@ __bt_first(BTREE *t, const DBT *key, EPG * Parameters: * t: the tree * pgno: page number - * index: page index + * idx: page index */ void -__bt_setcur(t, pgno, index) - BTREE *t; - pgno_t pgno; - u_int index; +__bt_setcur(BTREE *t, pgno_t pgno, u_int idx) { /* Lose any already deleted key. */ if (t->bt_cursor.key.data != NULL) { @@ -439,6 +436,6 @@ __bt_setcur(t, pgno, index) /* Update the cursor. */ t->bt_cursor.pg.pgno = pgno; - t->bt_cursor.pg.index = index; + t->bt_cursor.pg.index = idx; F_SET(&t->bt_cursor, CURS_INIT); } Modified: head/lib/libc/db/recno/rec_delete.c ============================================================================== --- head/lib/libc/db/recno/rec_delete.c Mon Mar 2 23:47:18 2009 (r189291) +++ head/lib/libc/db/recno/rec_delete.c Tue Mar 3 02:16:12 2009 (r189292) @@ -138,16 +138,13 @@ rec_rdelete(BTREE *t, recno_t nrec) * * Parameters: * t: tree - * index: index on current page to delete + * idx: index on current page to delete * * Returns: * RET_SUCCESS, RET_ERROR. */ int -__rec_dleaf(t, h, index) - BTREE *t; - PAGE *h; - u_int32_t index; +__rec_dleaf(BTREE *t, PAGE *h, u_int32_t idx) { RLEAF *rl; indx_t *ip, cnt, offset; @@ -165,7 +162,7 @@ __rec_dleaf(t, h, index) * down, overwriting the deleted record and its index. If the record * uses overflow pages, make them available for reuse. */ - to = rl = GETRLEAF(h, index); + to = rl = GETRLEAF(h, idx); if (rl->flags & P_BIGDATA && __ovfl_delete(t, rl->bytes) == RET_ERROR) return (RET_ERROR); nbytes = NRLEAF(rl); @@ -178,8 +175,8 @@ __rec_dleaf(t, h, index) memmove(from + nbytes, from, (char *)to - from); h->upper += nbytes; - offset = h->linp[index]; - for (cnt = &h->linp[index] - (ip = &h->linp[0]); cnt--; ++ip) + offset = h->linp[idx]; + for (cnt = &h->linp[idx] - (ip = &h->linp[0]); cnt--; ++ip) if (ip[0] < offset) ip[0] += nbytes; for (cnt = &h->linp[NEXTINDEX(h)] - ip; --cnt; ++ip) Modified: head/lib/libc/db/recno/rec_put.c ============================================================================== --- head/lib/libc/db/recno/rec_put.c Mon Mar 2 23:47:18 2009 (r189291) +++ head/lib/libc/db/recno/rec_put.c Tue Mar 3 02:16:12 2009 (r189292) @@ -191,7 +191,7 @@ __rec_iput(BTREE *t, recno_t nrec, const DBT tdata; EPG *e; PAGE *h; - indx_t index, nxtindex; + indx_t idx, nxtindex; pgno_t pg; u_int32_t nbytes; int dflags, status; @@ -222,7 +222,7 @@ __rec_iput(BTREE *t, recno_t nrec, const return (RET_ERROR); h = e->page; - index = e->index; + idx = e->index; /* * Add the specified key/data pair to the tree. The R_IAFTER and @@ -232,13 +232,13 @@ __rec_iput(BTREE *t, recno_t nrec, const */ switch (flags) { case R_IAFTER: - ++index; + ++idx; break; case R_IBEFORE: break; default: if (nrec < t->bt_nrecs && - __rec_dleaf(t, h, index) == RET_ERROR) { + __rec_dleaf(t, h, idx) == RET_ERROR) { mpool_put(t->bt_mp, h, 0); return (RET_ERROR); } @@ -252,18 +252,18 @@ __rec_iput(BTREE *t, recno_t nrec, const */ nbytes = NRLEAFDBT(data->size); if (h->upper - h->lower < nbytes + sizeof(indx_t)) { - status = __bt_split(t, h, NULL, data, dflags, nbytes, index); + status = __bt_split(t, h, NULL, data, dflags, nbytes, idx); if (status == RET_SUCCESS) ++t->bt_nrecs; return (status); } - if (index < (nxtindex = NEXTINDEX(h))) - memmove(h->linp + index + 1, h->linp + index, - (nxtindex - index) * sizeof(indx_t)); + if (idx < (nxtindex = NEXTINDEX(h))) + memmove(h->linp + idx + 1, h->linp + idx, + (nxtindex - idx) * sizeof(indx_t)); h->lower += sizeof(indx_t); - h->linp[index] = h->upper -= nbytes; + h->linp[idx] = h->upper -= nbytes; dest = (char *)h + h->upper; WR_RLEAF(dest, data, dflags); Modified: head/lib/libc/db/recno/rec_search.c ============================================================================== --- head/lib/libc/db/recno/rec_search.c Mon Mar 2 23:47:18 2009 (r189291) +++ head/lib/libc/db/recno/rec_search.c Tue Mar 3 02:16:12 2009 (r189292) @@ -61,7 +61,7 @@ __FBSDID("$FreeBSD$"); EPG * __rec_search(BTREE *t, recno_t recno, enum SRCHOP op) { - indx_t index; + indx_t idx; PAGE *h; EPGNO *parent; RINTERNAL *r; @@ -79,23 +79,23 @@ __rec_search(BTREE *t, recno_t recno, en t->bt_cur.index = recno - total; return (&t->bt_cur); } - for (index = 0, top = NEXTINDEX(h);;) { - r = GETRINTERNAL(h, index); - if (++index == top || total + r->nrecs > recno) + for (idx = 0, top = NEXTINDEX(h);;) { + r = GETRINTERNAL(h, idx); + if (++idx == top || total + r->nrecs > recno) break; total += r->nrecs; } - BT_PUSH(t, pg, index - 1); + BT_PUSH(t, pg, idx - 1); pg = r->pgno; switch (op) { case SDELETE: - --GETRINTERNAL(h, (index - 1))->nrecs; + --GETRINTERNAL(h, (idx - 1))->nrecs; mpool_put(t->bt_mp, h, MPOOL_DIRTY); break; case SINSERT: - ++GETRINTERNAL(h, (index - 1))->nrecs; + ++GETRINTERNAL(h, (idx - 1))->nrecs; mpool_put(t->bt_mp, h, MPOOL_DIRTY); break; case SEARCH: From owner-svn-src-head@FreeBSD.ORG Tue Mar 3 03:28: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 86EA01065673; Tue, 3 Mar 2009 03:28:09 +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 747E38FC24; Tue, 3 Mar 2009 03:28:09 +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 n233S97g093936; Tue, 3 Mar 2009 03:28:09 GMT (envelope-from kientzle@svn.freebsd.org) Received: (from kientzle@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n233S9c2093935; Tue, 3 Mar 2009 03:28:09 GMT (envelope-from kientzle@svn.freebsd.org) Message-Id: <200903030328.n233S9c2093935@svn.freebsd.org> From: Tim Kientzle Date: Tue, 3 Mar 2009 03:28: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: r189293 - head/lib/libarchive 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, 03 Mar 2009 03:28:10 -0000 Author: kientzle Date: Tue Mar 3 03:28:09 2009 New Revision: 189293 URL: http://svn.freebsd.org/changeset/base/189293 Log: Merge r272 from libarchive.googlecode.com: Fix building on MSVC6. Modified: head/lib/libarchive/archive_endian.h Modified: head/lib/libarchive/archive_endian.h ============================================================================== --- head/lib/libarchive/archive_endian.h Tue Mar 3 02:16:12 2009 (r189292) +++ head/lib/libarchive/archive_endian.h Tue Mar 3 03:28:09 2009 (r189293) @@ -41,8 +41,10 @@ * - SGI MIPSpro * - Microsoft Visual C++ 6.0 (supposedly newer versions too) */ -#if defined(__WATCOMC__) || defined(__sgi) || defined(_MSC_VER) +#if defined(__WATCOMC__) || defined(__sgi) #define inline +#elif defined(_MSC_VER) +#define inline __inline #endif /* Alignment-agnostic encode/decode bytestream to/from little/big endian. */ From owner-svn-src-head@FreeBSD.ORG Tue Mar 3 03:33: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 0DAE5106564A; Tue, 3 Mar 2009 03:33:26 +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 EF8EC8FC08; Tue, 3 Mar 2009 03:33:25 +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 n233XPd9094111; Tue, 3 Mar 2009 03:33:25 GMT (envelope-from kientzle@svn.freebsd.org) Received: (from kientzle@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n233XPBi094109; Tue, 3 Mar 2009 03:33:25 GMT (envelope-from kientzle@svn.freebsd.org) Message-Id: <200903030333.n233XPBi094109@svn.freebsd.org> From: Tim Kientzle Date: Tue, 3 Mar 2009 03:33:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r189294 - head/lib/libarchive 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, 03 Mar 2009 03:33:26 -0000 Author: kientzle Date: Tue Mar 3 03:33:25 2009 New Revision: 189294 URL: http://svn.freebsd.org/changeset/base/189294 Log: Merge r282 from libarchive.googlecode.com: Close multiple filters by walking the filter list in archive_read_close(). Modified: head/lib/libarchive/archive_read.c head/lib/libarchive/archive_read_support_compression_compress.c Modified: head/lib/libarchive/archive_read.c ============================================================================== --- head/lib/libarchive/archive_read.c Tue Mar 3 03:28:09 2009 (r189293) +++ head/lib/libarchive/archive_read.c Tue Mar 3 03:33:25 2009 (r189294) @@ -595,11 +595,12 @@ archive_read_close(struct archive *_a) /* TODO: Clean up the formatters. */ /* Clean up the stream pipeline. */ - if (a->source != NULL) { + while (a->source != NULL) { + struct archive_read_source *t = a->source->upstream; r1 = (a->source->close)(a->source); if (r1 < r) r = r1; - a->source = NULL; + a->source = t; } /* Release the reader objects. */ Modified: head/lib/libarchive/archive_read_support_compression_compress.c ============================================================================== --- head/lib/libarchive/archive_read_support_compression_compress.c Tue Mar 3 03:28:09 2009 (r189293) +++ head/lib/libarchive/archive_read_support_compression_compress.c Tue Mar 3 03:33:25 2009 (r189294) @@ -339,7 +339,6 @@ compress_source_close(struct archive_rea { struct private_data *state = (struct private_data *)self->data; - self->upstream->close(self->upstream); free(state->out_block); free(state); free(self); From owner-svn-src-head@FreeBSD.ORG Tue Mar 3 06:39: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 ADE0B106566B; Tue, 3 Mar 2009 06:39:38 +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 9BEB28FC12; Tue, 3 Mar 2009 06:39:38 +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 n236dcPm000462; Tue, 3 Mar 2009 06:39:38 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n236dcYs000461; Tue, 3 Mar 2009 06:39:38 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <200903030639.n236dcYs000461@svn.freebsd.org> From: Alexander Motin Date: Tue, 3 Mar 2009 06:39: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: r189295 - 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: Tue, 03 Mar 2009 06:39:39 -0000 Author: mav Date: Tue Mar 3 06:39:38 2009 New Revision: 189295 URL: http://svn.freebsd.org/changeset/base/189295 Log: Set PortMultiplier port only for SATA2 channels, where it is applicable. Doing it on old SATA controllers like Promise PDC20375 SATA150 breaks their operation. Tested by: marcus on PDC20375 Modified: head/sys/dev/ata/chipsets/ata-promise.c Modified: head/sys/dev/ata/chipsets/ata-promise.c ============================================================================== --- head/sys/dev/ata/chipsets/ata-promise.c Tue Mar 3 03:33:25 2009 (r189294) +++ head/sys/dev/ata/chipsets/ata-promise.c Tue Mar 3 06:39:38 2009 (r189295) @@ -690,8 +690,11 @@ ata_promise_mio_command(struct ata_reque ATA_OUTL(ctlr->r_res2, (ch->unit + 1) << 2, 0x00000001); - /* set portmultiplier port */ - ATA_OUTB(ctlr->r_res2, 0x4e8 + (ch->unit << 8), atadev->unit & 0x0f); + if ((ctlr->chip->cfg2 == PR_SATA2) || + ((ctlr->chip->cfg2 == PR_CMBO2) && (ch->unit < 2))) { + /* set portmultiplier port */ + ATA_OUTB(ctlr->r_res2, 0x4e8 + (ch->unit << 8), atadev->unit & 0x0f); + } /* XXX SOS add ATAPI commands support later */ switch (request->u.ata.command) { From owner-svn-src-head@FreeBSD.ORG Tue Mar 3 07:01: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 BF98E106566B; Tue, 3 Mar 2009 07:01:57 +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 AD58F8FC08; Tue, 3 Mar 2009 07:01:57 +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 n2371vSk000998; Tue, 3 Mar 2009 07:01:57 GMT (envelope-from kientzle@svn.freebsd.org) Received: (from kientzle@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n2371vcS000997; Tue, 3 Mar 2009 07:01:57 GMT (envelope-from kientzle@svn.freebsd.org) Message-Id: <200903030701.n2371vcS000997@svn.freebsd.org> From: Tim Kientzle Date: Tue, 3 Mar 2009 07:01: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: r189296 - head/lib/libarchive/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: Tue, 03 Mar 2009 07:01:58 -0000 Author: kientzle Date: Tue Mar 3 07:01:57 2009 New Revision: 189296 URL: http://svn.freebsd.org/changeset/base/189296 Log: Merge r294 from libarchive.googlecode.com: Skip testing for locale-based failures on systems where the "C" locale is so permissive that it cannot possibly fail. In particular, this fixes a test problem on Cygwin. Modified: head/lib/libarchive/test/test_pax_filename_encoding.c Modified: head/lib/libarchive/test/test_pax_filename_encoding.c ============================================================================== --- head/lib/libarchive/test/test_pax_filename_encoding.c Tue Mar 3 06:39:38 2009 (r189295) +++ head/lib/libarchive/test/test_pax_filename_encoding.c Tue Mar 3 07:01:57 2009 (r189296) @@ -210,6 +210,13 @@ DEFINE_TEST(test_pax_filename_encoding_3 return; } + /* If wctomb is broken, warn and return. */ + if (wctomb(buff, 0x1234) > 0) { + skipping("Cannot test conversion failures because \"C\" " + "locale on this system has no invalid characters."); + return; + } + assert((a = archive_write_new()) != NULL); assertEqualIntA(a, 0, archive_write_set_format_pax(a)); assertEqualIntA(a, 0, archive_write_set_compression_none(a)); From owner-svn-src-head@FreeBSD.ORG Tue Mar 3 07:16: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 F1FC1106566B; Tue, 3 Mar 2009 07:16:56 +0000 (UTC) (envelope-from marcus@marcuscom.com) Received: from creme-brulee.marcuscom.com (marcuscom-pt.tunnel.tserv1.fmt.ipv6.he.net [IPv6:2001:470:1f00:ffff::1279]) by mx1.freebsd.org (Postfix) with ESMTP id 857DE8FC23; Tue, 3 Mar 2009 07:16:56 +0000 (UTC) (envelope-from marcus@marcuscom.com) Received: from [IPv6:2001:470:1f00:2464::4] (shumai.marcuscom.com [IPv6:2001:470:1f00:2464::4]) by creme-brulee.marcuscom.com (8.14.3/8.14.3) with ESMTP id n237Imkv050278; Tue, 3 Mar 2009 02:18:48 -0500 (EST) (envelope-from marcus@marcuscom.com) From: Joe Marcus Clarke To: Alexander Motin In-Reply-To: <200903030639.n236dcYs000461@svn.freebsd.org> References: <200903030639.n236dcYs000461@svn.freebsd.org> Content-Type: multipart/signed; micalg="pgp-sha1"; protocol="application/pgp-signature"; boundary="=-5MWLXbR/UXM7HrEKzIDL" Organization: MarcusCom, Inc. Date: Tue, 03 Mar 2009 02:16:58 -0500 Message-Id: <1236064618.37252.169.camel@shumai.marcuscom.com> Mime-Version: 1.0 X-Mailer: Evolution 2.24.5 FreeBSD GNOME Team Port X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,NO_RELAYS autolearn=ham version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on creme-brulee.marcuscom.com Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r189295 - 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: Tue, 03 Mar 2009 07:16:57 -0000 --=-5MWLXbR/UXM7HrEKzIDL Content-Type: text/plain Content-Transfer-Encoding: quoted-printable On Tue, 2009-03-03 at 06:39 +0000, Alexander Motin wrote: > Author: mav > Date: Tue Mar 3 06:39:38 2009 > New Revision: 189295 > URL: http://svn.freebsd.org/changeset/base/189295 >=20 > Log: > Set PortMultiplier port only for SATA2 channels, where it is applicable= . > Doing it on old SATA controllers like Promise PDC20375 SATA150 breaks > their operation. Thanks! My Tinderbox machine thanks you as well. Joe > =20 > Tested by: marcus on PDC20375 >=20 > Modified: > head/sys/dev/ata/chipsets/ata-promise.c >=20 > Modified: head/sys/dev/ata/chipsets/ata-promise.c > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- head/sys/dev/ata/chipsets/ata-promise.c Tue Mar 3 03:33:25 2009 (r18= 9294) > +++ head/sys/dev/ata/chipsets/ata-promise.c Tue Mar 3 06:39:38 2009 (r18= 9295) > @@ -690,8 +690,11 @@ ata_promise_mio_command(struct ata_reque > =20 > ATA_OUTL(ctlr->r_res2, (ch->unit + 1) << 2, 0x00000001); > =20 > - /* set portmultiplier port */ > - ATA_OUTB(ctlr->r_res2, 0x4e8 + (ch->unit << 8), atadev->unit & 0x0f)= ; > + if ((ctlr->chip->cfg2 =3D=3D PR_SATA2) || > + ((ctlr->chip->cfg2 =3D=3D PR_CMBO2) && (ch->unit < 2))) { > + /* set portmultiplier port */ > + ATA_OUTB(ctlr->r_res2, 0x4e8 + (ch->unit << 8), atadev->unit & 0x0f); > + } > =20 > /* XXX SOS add ATAPI commands support later */ > switch (request->u.ata.command) { > _______________________________________________ > svn-src-all@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/svn-src-all > To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org" >=20 --=20 PGP Key : http://www.marcuscom.com/pgp.asc --=-5MWLXbR/UXM7HrEKzIDL Content-Type: application/pgp-signature; name="signature.asc" Content-Description: This is a digitally signed message part -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (FreeBSD) iEYEABECAAYFAkms2WkACgkQb2iPiv4Uz4eGlQCfWTtppeAPEPuKwLwCNL3XV2Pr FzYAn3bVb3EEB55dnoQHbkbtXJPvvGkc =Qhvk -----END PGP SIGNATURE----- --=-5MWLXbR/UXM7HrEKzIDL-- From owner-svn-src-head@FreeBSD.ORG Tue Mar 3 07:58: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 2B8341065677; Tue, 3 Mar 2009 07:58:02 +0000 (UTC) (envelope-from brueffer@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 19B528FC2B; Tue, 3 Mar 2009 07:58:02 +0000 (UTC) (envelope-from brueffer@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 n237w14C002183; Tue, 3 Mar 2009 07:58:01 GMT (envelope-from brueffer@svn.freebsd.org) Received: (from brueffer@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n237w1Dc002182; Tue, 3 Mar 2009 07:58:01 GMT (envelope-from brueffer@svn.freebsd.org) Message-Id: <200903030758.n237w1Dc002182@svn.freebsd.org> From: Christian Brueffer Date: Tue, 3 Mar 2009 07:58: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: r189298 - 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, 03 Mar 2009 07:58:03 -0000 Author: brueffer Date: Tue Mar 3 07:58:01 2009 New Revision: 189298 URL: http://svn.freebsd.org/changeset/base/189298 Log: Xref glxsb(4). MFC after: 3 days Modified: head/share/man/man4/crypto.4 Modified: head/share/man/man4/crypto.4 ============================================================================== --- head/share/man/man4/crypto.4 Tue Mar 3 07:56:42 2009 (r189297) +++ head/share/man/man4/crypto.4 Tue Mar 3 07:58:01 2009 (r189298) @@ -28,7 +28,7 @@ .\" .\" $FreeBSD$ .\" -.Dd August 1, 2007 +.Dd March 3, 2009 .Dt CRYPTO 4 .Os .Sh NAME @@ -106,6 +106,7 @@ asymmetric cryptographic features are po crypto access device .El .Sh SEE ALSO +.Xr glxsb 4 , .Xr hifn 4 , .Xr ipsec 4 , .Xr padlock 4 , From owner-svn-src-head@FreeBSD.ORG Tue Mar 3 09:04: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 872241065672; Tue, 3 Mar 2009 09:04:19 +0000 (UTC) (envelope-from nyan@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 750D48FC13; Tue, 3 Mar 2009 09:04:19 +0000 (UTC) (envelope-from nyan@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 n2394J5r003676; Tue, 3 Mar 2009 09:04:19 GMT (envelope-from nyan@svn.freebsd.org) Received: (from nyan@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n2394JNJ003670; Tue, 3 Mar 2009 09:04:19 GMT (envelope-from nyan@svn.freebsd.org) Message-Id: <200903030904.n2394JNJ003670@svn.freebsd.org> From: Takahashi Yoshihiro Date: Tue, 3 Mar 2009 09:04: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: r189300 - in head/release: amd64 i386 ia64 powerpc sparc64 sun4v 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, 03 Mar 2009 09:04:20 -0000 Author: nyan Date: Tue Mar 3 09:04:18 2009 New Revision: 189300 URL: http://svn.freebsd.org/changeset/base/189300 Log: Catch up with USB2 change. Remove the usbdevs and add the usbconfig. Spotted by: hrs Tested on: i386 Modified: head/release/amd64/boot_crunch.conf head/release/i386/boot_crunch.conf head/release/ia64/boot_crunch.conf head/release/powerpc/boot_crunch.conf head/release/sparc64/boot_crunch.conf head/release/sun4v/boot_crunch.conf Modified: head/release/amd64/boot_crunch.conf ============================================================================== --- head/release/amd64/boot_crunch.conf Tue Mar 3 08:14:43 2009 (r189299) +++ head/release/amd64/boot_crunch.conf Tue Mar 3 09:04:18 2009 (r189300) @@ -38,8 +38,8 @@ srcdirs /usr/src/usr.sbin progs arp progs ppp progs sysinstall -progs usbdevs +progs usbconfig libs -ll -ledit -lutil -lmd -lcrypt -lftpio -lz -lnetgraph libs -ldialog -lncurses -ldisk -lcam -lsbuf -lufs -ldevinfo -libs -lbsdxml -larchive -lbz2 +libs -lbsdxml -larchive -lbz2 -lusb20 Modified: head/release/i386/boot_crunch.conf ============================================================================== --- head/release/i386/boot_crunch.conf Tue Mar 3 08:14:43 2009 (r189299) +++ head/release/i386/boot_crunch.conf Tue Mar 3 09:04:18 2009 (r189300) @@ -38,8 +38,8 @@ srcdirs /usr/src/usr.sbin progs arp progs ppp progs sysinstall -progs usbdevs +progs usbconfig libs -ll -ledit -lutil -lmd -lcrypt -lftpio -lz -lnetgraph libs -ldialog -lncurses -ldisk -lcam -lsbuf -lufs -ldevinfo -libs -lbsdxml -larchive -lbz2 +libs -lbsdxml -larchive -lbz2 -lusb20 Modified: head/release/ia64/boot_crunch.conf ============================================================================== --- head/release/ia64/boot_crunch.conf Tue Mar 3 08:14:43 2009 (r189299) +++ head/release/ia64/boot_crunch.conf Tue Mar 3 09:04:18 2009 (r189300) @@ -42,8 +42,8 @@ srcdirs /usr/src/usr.sbin progs arp progs ppp progs sysinstall -progs usbdevs +progs usbconfig libs -ll -ledit -lutil -lmd -lcrypt -lftpio -lz -lnetgraph libs -ldialog -lncurses -ldisk -lcam -lkiconv -lsbuf -lufs -ldevinfo -libs -lgeom -lbsdxml -larchive -lbz2 +libs -lgeom -lbsdxml -larchive -lbz2 -lusb20 Modified: head/release/powerpc/boot_crunch.conf ============================================================================== --- head/release/powerpc/boot_crunch.conf Tue Mar 3 08:14:43 2009 (r189299) +++ head/release/powerpc/boot_crunch.conf Tue Mar 3 09:04:18 2009 (r189300) @@ -40,8 +40,8 @@ srcdirs /usr/src/usr.sbin progs arp progs ppp progs sysinstall -progs usbdevs +progs usbconfig libs -ll -ledit -lutil -lmd -lcrypt -lftpio -lz -lnetgraph libs -ldialog -lncurses -ldisk -lcam -lkiconv -lsbuf -lufs -libs -lbsdxml -larchive -lbz2 +libs -lbsdxml -larchive -lbz2 -lusb20 Modified: head/release/sparc64/boot_crunch.conf ============================================================================== --- head/release/sparc64/boot_crunch.conf Tue Mar 3 08:14:43 2009 (r189299) +++ head/release/sparc64/boot_crunch.conf Tue Mar 3 09:04:18 2009 (r189300) @@ -38,8 +38,8 @@ srcdirs /usr/src/usr.sbin progs arp progs ppp progs sysinstall -progs usbdevs +progs usbconfig libs -ll -ledit -lutil -lmd -lcrypt -lftpio -lz -lnetgraph libs -ldialog -lncurses -ldisk -lcam -lsbuf -lufs -lbsdxml -libs -larchive -lbz2 +libs -larchive -lbz2 -lusb20 Modified: head/release/sun4v/boot_crunch.conf ============================================================================== --- head/release/sun4v/boot_crunch.conf Tue Mar 3 08:14:43 2009 (r189299) +++ head/release/sun4v/boot_crunch.conf Tue Mar 3 09:04:18 2009 (r189300) @@ -38,8 +38,8 @@ srcdirs /usr/src/usr.sbin progs arp progs ppp progs sysinstall -progs usbdevs +progs usbconfig libs -ll -ledit -lutil -lmd -lcrypt -lftpio -lz -lnetgraph libs -ldialog -lncurses -ldisk -lcam -lsbuf -lufs -lbsdxml -libs -larchive -lbz2 +libs -larchive -lbz2 -lusb20 From owner-svn-src-head@FreeBSD.ORG Tue Mar 3 09:18: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 39ADA10656D1; Tue, 3 Mar 2009 09:18:59 +0000 (UTC) (envelope-from simon@benji.nitro.dk) Received: from mx.nitro.dk (zarniwoop.nitro.dk [83.92.207.38]) by mx1.freebsd.org (Postfix) with ESMTP id E8D568FC14; Tue, 3 Mar 2009 09:18:58 +0000 (UTC) (envelope-from simon@benji.nitro.dk) Received: from benji.nitro.dk (unknown [192.168.3.39]) by mx.nitro.dk (Postfix) with ESMTP id 4B9BB2D484B; Tue, 3 Mar 2009 09:18:58 +0000 (UTC) Received: by benji.nitro.dk (Postfix, from userid 2000) id 59C56FD38; Tue, 3 Mar 2009 10:18:57 +0100 (CET) Date: Tue, 3 Mar 2009 10:18:57 +0100 From: "Simon L. Nielsen" To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Message-ID: <20090303091856.GB1190@zaphod.nitro.dk> References: <200903020411.n224BgXF064833@svn.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <200903020411.n224BgXF064833@svn.freebsd.org> User-Agent: Mutt/1.5.18 (2008-05-17) Cc: Subject: Re: svn commit: r189271 - head/lib/libc/stdio 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, 03 Mar 2009 09:19:02 -0000 On 2009.03.02 04:11:42 +0000, David Schultz wrote: > Author: das > Date: Mon Mar 2 04:11:42 2009 > New Revision: 189271 > URL: http://svn.freebsd.org/changeset/base/189271 > > Log: > Rewrite asprintf() as a wrapper around vasprintf(), thus reducing the > number of functions that have an incestuous relationship with the > arcane innards of stdio. > > Replaced: > head/lib/libc/stdio/asprintf.c (contents, props changed) > - copied, changed from r189249, head/lib/libc/stdio/printf.c Just FYI, this commit "broke" (exposed a bug) in the svn2cvs exporter, so it's not running right now. -- Simon L. Nielsen From owner-svn-src-head@FreeBSD.ORG Tue Mar 3 11:57:29 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 CB370106566B; Tue, 3 Mar 2009 11:57:29 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B947A8FC1A; Tue, 3 Mar 2009 11:57:29 +0000 (UTC) (envelope-from rwatson@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 n23BvTlg010172; Tue, 3 Mar 2009 11:57:29 GMT (envelope-from rwatson@svn.freebsd.org) Received: (from rwatson@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n23BvTmL010171; Tue, 3 Mar 2009 11:57:29 GMT (envelope-from rwatson@svn.freebsd.org) Message-Id: <200903031157.n23BvTmL010171@svn.freebsd.org> From: Robert Watson Date: Tue, 3 Mar 2009 11:57: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: r189301 - head/contrib/openbsm/config X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Mar 2009 11:57:30 -0000 Author: rwatson Date: Tue Mar 3 11:57:29 2009 New Revision: 189301 URL: http://svn.freebsd.org/changeset/base/189301 Log: Update config.h for OpenBSM 1.1 beta1. MFC after: 1 month Modified: head/contrib/openbsm/config/config.h Modified: head/contrib/openbsm/config/config.h ============================================================================== --- head/contrib/openbsm/config/config.h Tue Mar 3 09:04:18 2009 (r189300) +++ head/contrib/openbsm/config/config.h Tue Mar 3 11:57:29 2009 (r189301) @@ -165,13 +165,13 @@ #define PACKAGE_NAME "OpenBSM" /* Define to the full name and version of this package. */ -#define PACKAGE_STRING "OpenBSM 1.1alpha4" +#define PACKAGE_STRING "OpenBSM 1.1beta1" /* Define to the one symbol short name of this package. */ #define PACKAGE_TARNAME "openbsm" /* Define to the version of this package. */ -#define PACKAGE_VERSION "1.1alpha4" +#define PACKAGE_VERSION "1.1beta1" /* Define as the return type of signal handlers (`int' or `void'). */ #define RETSIGTYPE void @@ -192,7 +192,7 @@ #define USE_NATIVE_INCLUDES /* Version number of package */ -#define VERSION "1.1alpha4" +#define VERSION "1.1beta1" /* Define to empty if `const' does not conform to ANSI C. */ /* #undef const */ From owner-svn-src-head@FreeBSD.ORG Tue Mar 3 13:05: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 8AAF9106564A; Tue, 3 Mar 2009 13:05:28 +0000 (UTC) (envelope-from das@FreeBSD.ORG) Received: from zim.MIT.EDU (ZIM.MIT.EDU [18.95.3.101]) by mx1.freebsd.org (Postfix) with ESMTP id 474648FC17; Tue, 3 Mar 2009 13:05:27 +0000 (UTC) (envelope-from das@FreeBSD.ORG) Received: from zim.MIT.EDU (localhost [127.0.0.1]) by zim.MIT.EDU (8.14.3/8.14.2) with ESMTP id n23D8mTT004679; Tue, 3 Mar 2009 08:08:48 -0500 (EST) (envelope-from das@FreeBSD.ORG) Received: (from das@localhost) by zim.MIT.EDU (8.14.3/8.14.2/Submit) id n23D8m0a004678; Tue, 3 Mar 2009 08:08:48 -0500 (EST) (envelope-from das@FreeBSD.ORG) Date: Tue, 3 Mar 2009 08:08:48 -0500 From: David Schultz To: "Simon L. Nielsen" Message-ID: <20090303130848.GA4636@zim.MIT.EDU> Mail-Followup-To: "Simon L. Nielsen" , src-committers@FreeBSD.ORG, svn-src-all@FreeBSD.ORG, svn-src-head@FreeBSD.ORG References: <200903020411.n224BgXF064833@svn.freebsd.org> <20090303091856.GB1190@zaphod.nitro.dk> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20090303091856.GB1190@zaphod.nitro.dk> Cc: svn-src-head@FreeBSD.ORG, svn-src-all@FreeBSD.ORG, src-committers@FreeBSD.ORG Subject: Re: svn commit: r189271 - head/lib/libc/stdio 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, 03 Mar 2009 13:05:29 -0000 On Tue, Mar 03, 2009, Simon L. Nielsen wrote: > On 2009.03.02 04:11:42 +0000, David Schultz wrote: > > Author: das > > Date: Mon Mar 2 04:11:42 2009 > > New Revision: 189271 > > URL: http://svn.freebsd.org/changeset/base/189271 > > > > Log: > > Rewrite asprintf() as a wrapper around vasprintf(), thus reducing the > > number of functions that have an incestuous relationship with the > > arcane innards of stdio. > > > > Replaced: > > head/lib/libc/stdio/asprintf.c (contents, props changed) > > - copied, changed from r189249, head/lib/libc/stdio/printf.c > > Just FYI, this commit "broke" (exposed a bug) in the svn2cvs exporter, > so it's not running right now. Oops. I wrote this by removing the unnecessarily long OpenBSD implementation, then using `svn cp' to make the new version a 2-line diff against printf.c (which more accurately reflects the provenance of the new implementation.) I guess the exporter didn't like that. How do we fix it? From owner-svn-src-head@FreeBSD.ORG Tue Mar 3 13:10:25 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 D7EC91065701; Tue, 3 Mar 2009 13:10:25 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C6C6E8FC26; Tue, 3 Mar 2009 13:10:25 +0000 (UTC) (envelope-from avg@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 n23DAPJE011599; Tue, 3 Mar 2009 13:10:25 GMT (envelope-from avg@svn.freebsd.org) Received: (from avg@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n23DAPMn011598; Tue, 3 Mar 2009 13:10:25 GMT (envelope-from avg@svn.freebsd.org) Message-Id: <200903031310.n23DAPMn011598@svn.freebsd.org> From: Andriy Gapon Date: Tue, 3 Mar 2009 13:10:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r189302 - head/sys/fs/udf 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, 03 Mar 2009 13:10:26 -0000 Author: avg Date: Tue Mar 3 13:10:25 2009 New Revision: 189302 URL: http://svn.freebsd.org/changeset/base/189302 Log: udf_readdir: do not advance offset if entry can not be uio-ed Previosly readdir missed some directory entries because there was no space for them in current uio but directory stream offset was advanced nevertheless. jhb has discoved the issue and provided a test-case. Reviewed by: bde Approved by: jhb (mentor) Modified: head/sys/fs/udf/udf_vnops.c Modified: head/sys/fs/udf/udf_vnops.c ============================================================================== --- head/sys/fs/udf/udf_vnops.c Tue Mar 3 11:57:29 2009 (r189301) +++ head/sys/fs/udf/udf_vnops.c Tue Mar 3 13:10:25 2009 (r189302) @@ -859,11 +859,11 @@ udf_readdir(struct vop_readdir_args *a) } if (error) break; + uio->uio_offset = ds->offset + ds->off; } /* tell the calling layer whether we need to be called again */ *a->a_eofflag = uiodir.eofflag; - uio->uio_offset = ds->offset + ds->off; if (error < 0) error = 0; From owner-svn-src-head@FreeBSD.ORG Tue Mar 3 13:12: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 52874106574C; Tue, 3 Mar 2009 13:12:13 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 3F5B28FC1D; Tue, 3 Mar 2009 13:12:13 +0000 (UTC) (envelope-from bz@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 n23DCD5X011678; Tue, 3 Mar 2009 13:12:13 GMT (envelope-from bz@svn.freebsd.org) Received: (from bz@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n23DCDAl011675; Tue, 3 Mar 2009 13:12:13 GMT (envelope-from bz@svn.freebsd.org) Message-Id: <200903031312.n23DCDAl011675@svn.freebsd.org> From: "Bjoern A. Zeeb" Date: Tue, 3 Mar 2009 13:12: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: r189303 - in head/sys: netinet netinet6 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, 03 Mar 2009 13:12:15 -0000 Author: bz Date: Tue Mar 3 13:12:12 2009 New Revision: 189303 URL: http://svn.freebsd.org/changeset/base/189303 Log: Start removing IPv6 Type 0 Routing header code. RH0 was deprecated by RFC 5095. While most of the code had been disabled by #if 0 already, leave a bit of infrastructure for possible RH2 code and a log message under BURN_BRIDGES in case a user still tries to send RH0 packets. Reviewed by: gnn (a bit back, earlier version) Modified: head/sys/netinet/ip6.h head/sys/netinet6/ip6_output.c head/sys/netinet6/route6.c Modified: head/sys/netinet/ip6.h ============================================================================== --- head/sys/netinet/ip6.h Tue Mar 3 13:10:25 2009 (r189302) +++ head/sys/netinet/ip6.h Tue Mar 3 13:12:12 2009 (r189303) @@ -219,7 +219,7 @@ struct ip6_rthdr { /* followed by routing type specific data */ } __packed; -/* Type 0 Routing header */ +/* Type 0 Routing header, deprecated by RFC 5095. */ struct ip6_rthdr0 { u_int8_t ip6r0_nxt; /* next header */ u_int8_t ip6r0_len; /* length in units of 8 octets */ Modified: head/sys/netinet6/ip6_output.c ============================================================================== --- head/sys/netinet6/ip6_output.c Tue Mar 3 13:10:25 2009 (r189302) +++ head/sys/netinet6/ip6_output.c Tue Mar 3 13:12:12 2009 (r189303) @@ -78,6 +78,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include @@ -443,40 +444,23 @@ skip_ipsec2:; struct ip6_rthdr *rh = (struct ip6_rthdr *)(mtod(exthdrs.ip6e_rthdr, struct ip6_rthdr *)); - struct ip6_rthdr0 *rh0; - struct in6_addr *addr; - struct sockaddr_in6 sa; + /* + * While this switch may look gratuitous, leave it in + * in favour of RH2 implementations, etc. + */ switch (rh->ip6r_type) { +#ifndef BURN_BRIDGES case IPV6_RTHDR_TYPE_0: - rh0 = (struct ip6_rthdr0 *)rh; - addr = (struct in6_addr *)(rh0 + 1); - - /* - * construct a sockaddr_in6 form of - * the first hop. - * - * XXX: we may not have enough - * information about its scope zone; - * there is no standard API to pass - * the information from the - * application. - */ - bzero(&sa, sizeof(sa)); - sa.sin6_family = AF_INET6; - sa.sin6_len = sizeof(sa); - sa.sin6_addr = addr[0]; - if ((error = sa6_embedscope(&sa, - V_ip6_use_defzone)) != 0) { - goto bad; - } - ip6->ip6_dst = sa.sin6_addr; - bcopy(&addr[1], &addr[0], sizeof(struct in6_addr) - * (rh0->ip6r0_segleft - 1)); - addr[rh0->ip6r0_segleft - 1] = finaldst; - /* XXX */ - in6_clearscope(addr + rh0->ip6r0_segleft - 1); - break; + /* + * According to RFC 5095 we should not implement + * it in any way but we may want to give the user + * a hint for now. + */ + log(LOG_INFO, "[%s:%d] IPv6 Type 0 Routing Headers are " + "deprecated.\n", __func__, __LINE__); + /* FALLTHROUGH */ +#endif default: /* is it possible? */ error = EINVAL; goto bad; Modified: head/sys/netinet6/route6.c ============================================================================== --- head/sys/netinet6/route6.c Tue Mar 3 13:10:25 2009 (r189302) +++ head/sys/netinet6/route6.c Tue Mar 3 13:12:12 2009 (r189303) @@ -53,12 +53,6 @@ __FBSDID("$FreeBSD$"); #include #include -#if 0 -static int ip6_rthdr0 __P((struct mbuf *, struct ip6_hdr *, - struct ip6_rthdr0 *)); - -#endif /* Disable route header processing. */ - /* * proto - is unused */ @@ -96,38 +90,22 @@ route6_input(struct mbuf **mp, int *offp } #endif + /* + * While this switch may look gratuitous, leave it in + * in favour of RH2 implementations, etc. + */ switch (rh->ip6r_type) { -#if 0 +#ifndef BURN_BRIDGES case IPV6_RTHDR_TYPE_0: - rhlen = (rh->ip6r_len + 1) << 3; -#ifndef PULLDOWN_TEST - /* - * note on option length: - * due to IP6_EXTHDR_CHECK assumption, we cannot handle - * very big routing header (max rhlen == 2048). - */ - IP6_EXTHDR_CHECK(m, off, rhlen, IPPROTO_DONE); -#else /* - * note on option length: - * maximum rhlen: 2048 - * max mbuf m_pulldown can handle: MCLBYTES == usually 2048 - * so, here we are assuming that m_pulldown can handle - * rhlen == 2048 case. this may not be a good thing to - * assume - we may want to avoid pulling it up altogether. + * According to RFC 5095, 3. Deprecation of RH0, + * we must handle RH0 like the default (unknown + * routing header type) case. */ - IP6_EXTHDR_GET(rh, struct ip6_rthdr *, m, off, rhlen); - if (rh == NULL) { - V_ip6stat.ip6s_tooshort++; - return IPPROTO_DONE; - } + /* FALLTHROUGH */ #endif - if (ip6_rthdr0(m, ip6, (struct ip6_rthdr0 *)rh)) - return (IPPROTO_DONE); - break; -#endif /* Disable route header 0 */ default: - /* unknown routing type */ + /* Unknown routing header type. */ if (rh->ip6r_segleft == 0) { rhlen = (rh->ip6r_len + 1) << 3; break; /* Final dst. Just ignore the header. */ @@ -141,107 +119,3 @@ route6_input(struct mbuf **mp, int *offp *offp += rhlen; return (rh->ip6r_nxt); } - -/* - * Type0 routing header processing - * - * RFC2292 backward compatibility warning: no support for strict/loose bitmap, - * as it was dropped between RFC1883 and RFC2460. - */ -#if 0 -static int -ip6_rthdr0(struct mbuf *m, struct ip6_hdr *ip6, struct ip6_rthdr0 *rh0) -{ - INIT_VNET_INET6(curvnet); - int addrs, index; - struct in6_addr *nextaddr, tmpaddr; - struct in6_ifaddr *ifa; - - if (rh0->ip6r0_segleft == 0) - return (0); - - if (rh0->ip6r0_len % 2 -#ifdef COMPAT_RFC1883 - || rh0->ip6r0_len > 46 -#endif - ) { - /* - * Type 0 routing header can't contain more than 23 addresses. - * RFC 2462: this limitation was removed since strict/loose - * bitmap field was deleted. - */ - V_ip6stat.ip6s_badoptions++; - icmp6_error(m, ICMP6_PARAM_PROB, ICMP6_PARAMPROB_HEADER, - (caddr_t)&rh0->ip6r0_len - (caddr_t)ip6); - return (-1); - } - - if ((addrs = rh0->ip6r0_len / 2) < rh0->ip6r0_segleft) { - V_ip6stat.ip6s_badoptions++; - icmp6_error(m, ICMP6_PARAM_PROB, ICMP6_PARAMPROB_HEADER, - (caddr_t)&rh0->ip6r0_segleft - (caddr_t)ip6); - return (-1); - } - - index = addrs - rh0->ip6r0_segleft; - rh0->ip6r0_segleft--; - nextaddr = ((struct in6_addr *)(rh0 + 1)) + index; - - /* - * reject invalid addresses. be proactive about malicious use of - * IPv4 mapped/compat address. - * XXX need more checks? - */ - if (IN6_IS_ADDR_MULTICAST(nextaddr) || - IN6_IS_ADDR_UNSPECIFIED(nextaddr) || - IN6_IS_ADDR_V4MAPPED(nextaddr) || - IN6_IS_ADDR_V4COMPAT(nextaddr)) { - V_ip6stat.ip6s_badoptions++; - m_freem(m); - return (-1); - } - if (IN6_IS_ADDR_MULTICAST(&ip6->ip6_dst) || - IN6_IS_ADDR_UNSPECIFIED(&ip6->ip6_dst) || - IN6_IS_ADDR_V4MAPPED(&ip6->ip6_dst) || - IN6_IS_ADDR_V4COMPAT(&ip6->ip6_dst)) { - V_ip6stat.ip6s_badoptions++; - m_freem(m); - return (-1); - } - - /* - * Determine the scope zone of the next hop, based on the interface - * of the current hop. [RFC4007, Section 9] - * Then disambiguate the scope zone for the next hop (if necessary). - */ - if ((ifa = ip6_getdstifaddr(m)) == NULL) - goto bad; - if (in6_setscope(nextaddr, ifa->ia_ifp, NULL) != 0) { - V_ip6stat.ip6s_badscope++; - goto bad; - } - - /* - * Swap the IPv6 destination address and nextaddr. Forward the packet. - */ - tmpaddr = *nextaddr; - *nextaddr = ip6->ip6_dst; - in6_clearscope(nextaddr); /* XXX */ - ip6->ip6_dst = tmpaddr; - -#ifdef COMPAT_RFC1883 - if (rh0->ip6r0_slmap[index / 8] & (1 << (7 - (index % 8)))) - ip6_forward(m, IPV6_SRCRT_NEIGHBOR); - else - ip6_forward(m, IPV6_SRCRT_NOTNEIGHBOR); -#else - ip6_forward(m, 1); -#endif - - return (-1); /* m would be freed in ip6_forward() */ - - bad: - m_freem(m); - return (-1); -} -#endif From owner-svn-src-head@FreeBSD.ORG Tue Mar 3 14:09: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 8A298106567A; Tue, 3 Mar 2009 14:09:08 +0000 (UTC) (envelope-from simon@benji.nitro.dk) Received: from mx.nitro.dk (zarniwoop.nitro.dk [83.92.207.38]) by mx1.freebsd.org (Postfix) with ESMTP id 448F28FC19; Tue, 3 Mar 2009 14:09:08 +0000 (UTC) (envelope-from simon@benji.nitro.dk) Received: from benji.nitro.dk (unknown [192.168.3.39]) by mx.nitro.dk (Postfix) with ESMTP id 939E72D484B; Tue, 3 Mar 2009 14:09:07 +0000 (UTC) Received: by benji.nitro.dk (Postfix, from userid 2000) id C80F9FD38; Tue, 3 Mar 2009 15:09:06 +0100 (CET) Date: Tue, 3 Mar 2009 15:09:06 +0100 From: "Simon L. Nielsen" To: src-committers@FreeBSD.ORG, svn-src-all@FreeBSD.ORG, svn-src-head@FreeBSD.ORG Message-ID: <20090303140906.GC1190@zaphod.nitro.dk> References: <200903020411.n224BgXF064833@svn.freebsd.org> <20090303091856.GB1190@zaphod.nitro.dk> <20090303130848.GA4636@zim.MIT.EDU> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20090303130848.GA4636@zim.MIT.EDU> User-Agent: Mutt/1.5.18 (2008-05-17) Cc: Subject: Re: svn commit: r189271 - head/lib/libc/stdio 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, 03 Mar 2009 14:09:11 -0000 On 2009.03.03 08:08:48 -0500, David Schultz wrote: > On Tue, Mar 03, 2009, Simon L. Nielsen wrote: > > On 2009.03.02 04:11:42 +0000, David Schultz wrote: > > > Author: das > > > Date: Mon Mar 2 04:11:42 2009 > > > New Revision: 189271 > > > URL: http://svn.freebsd.org/changeset/base/189271 > > > > > > Log: > > > Rewrite asprintf() as a wrapper around vasprintf(), thus reducing the > > > number of functions that have an incestuous relationship with the > > > arcane innards of stdio. > > > > > > Replaced: > > > head/lib/libc/stdio/asprintf.c (contents, props changed) > > > - copied, changed from r189249, head/lib/libc/stdio/printf.c > > > > Just FYI, this commit "broke" (exposed a bug) in the svn2cvs exporter, > > so it's not running right now. > > Oops. I wrote this by removing the unnecessarily long OpenBSD > implementation, then using `svn cp' to make the new version a > 2-line diff against printf.c (which more accurately reflects the > provenance of the new implementation.) I guess the exporter didn't > like that. How do we fix it? I don't think you did anything wrong, the svn2cvs exporter just gets rather unhappy if subversion says the same file is deleted and added in the same changeset which seems to happen for cases like this. Anyway, I first want to see if peter@ is around - if not I will have a look at it... -- Simon L. Nielsen From owner-svn-src-head@FreeBSD.ORG Tue Mar 3 15:50:25 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 13F411065676; Tue, 3 Mar 2009 15:50:25 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 02FE88FC14; Tue, 3 Mar 2009 15:50:25 +0000 (UTC) (envelope-from avg@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 n23FoOOG014624; Tue, 3 Mar 2009 15:50:24 GMT (envelope-from avg@svn.freebsd.org) Received: (from avg@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n23FoOUG014623; Tue, 3 Mar 2009 15:50:24 GMT (envelope-from avg@svn.freebsd.org) Message-Id: <200903031550.n23FoOUG014623@svn.freebsd.org> From: Andriy Gapon Date: Tue, 3 Mar 2009 15:50:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r189305 - head/sys/dev/ichwd 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, 03 Mar 2009 15:50:25 -0000 Author: avg Date: Tue Mar 3 15:50:24 2009 New Revision: 189305 URL: http://svn.freebsd.org/changeset/base/189305 Log: ichwd: correct range check for timeout value Approved by: jhb (mentor) Modified: head/sys/dev/ichwd/ichwd.c Modified: head/sys/dev/ichwd/ichwd.c ============================================================================== --- head/sys/dev/ichwd/ichwd.c Tue Mar 3 15:43:34 2009 (r189304) +++ head/sys/dev/ichwd/ichwd.c Tue Mar 3 15:50:24 2009 (r189305) @@ -220,8 +220,8 @@ ichwd_tmr_set(struct ichwd_softc *sc, un uint16_t tmr_val16 = ichwd_read_tco_2(sc, TCO_TMR2); tmr_val16 &= 0xfc00; - if (timeout > 0x0bff) - timeout = 0x0bff; + if (timeout > 0x03ff) + timeout = 0x03ff; tmr_val16 |= timeout; ichwd_write_tco_2(sc, TCO_TMR2, tmr_val16); } From owner-svn-src-head@FreeBSD.ORG Tue Mar 3 16:39: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 E97C5106567C; Tue, 3 Mar 2009 16:38:59 +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 D6FAA8FC0C; Tue, 3 Mar 2009 16:38:59 +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 n23Gcx81015527; Tue, 3 Mar 2009 16:38:59 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n23GcxZJ015525; Tue, 3 Mar 2009 16:38:59 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <200903031638.n23GcxZJ015525@svn.freebsd.org> From: John Baldwin Date: Tue, 3 Mar 2009 16:38: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: r189306 - head/sys/dev/pci 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, 03 Mar 2009 16:39:00 -0000 Author: jhb Date: Tue Mar 3 16:38:59 2009 New Revision: 189306 URL: http://svn.freebsd.org/changeset/base/189306 Log: Further refine the handling of resources for BARs in the PCI bus driver. A while back, Warner changed the PCI bus code to reserve resources when enumerating devices and simply give devices the previously allocated resources when they call bus_alloc_resource(). This ensures that address ranges being decoded by a BAR are always allocated in the nexus0 device (or whatever device the PCI bus gets its address space from) even if a device driver is not attached to the device. This patch extends this behavior further: - To let the PCI bus distinguish between a resource being allocated by a device driver vs. merely being allocated by the bus, use rman_set_device() to assign the device to the bus when it is owned by the bus and to the child device when it is allocated by the child device's driver. We can now prevent a device driver from allocating the same device twice. Doing so could result in odd things like allocating duplicate virtual memory to map the resource on some archs and leaking the original mapping. - When a PCI device driver releases a resource, don't pass the request all the way up the tree and release it in the nexus (or similar device) since the BAR is still active and decoding. Otherwise, another device could later allocate the same range even though it is still in use. Instead, deactivate the resource and assign it back to the PCI bus using rman_set_device(). - pci_delete_resource() will actually completely free a BAR including attemping to disable it. - Disable BAR decoding via the command register when sizing a BAR in pci_alloc_map() which is used to allocate resources for a BAR when the BIOS/firmware did not assign a usable resource range during boot. This mirrors an earlier fix to pci_add_map() which is used when to size BARs during boot. - Move the activation of I/O decoding in the PCI command register into pci_activate_resource() instead of doing it in pci_alloc_resource(). Previously we could actually enable decoding before a BAR was initialized via pci_alloc_map(). Glanced at by: bsdimp Modified: head/sys/dev/pci/pci.c head/sys/dev/pci/pci_private.h Modified: head/sys/dev/pci/pci.c ============================================================================== --- head/sys/dev/pci/pci.c Tue Mar 3 15:50:24 2009 (r189305) +++ head/sys/dev/pci/pci.c Tue Mar 3 16:38:59 2009 (r189306) @@ -136,7 +136,7 @@ static device_method_t pci_methods[] = { DEVMETHOD(bus_delete_resource, pci_delete_resource), DEVMETHOD(bus_alloc_resource, pci_alloc_resource), DEVMETHOD(bus_release_resource, bus_generic_rl_release_resource), - DEVMETHOD(bus_activate_resource, bus_generic_activate_resource), + DEVMETHOD(bus_activate_resource, pci_activate_resource), DEVMETHOD(bus_deactivate_resource, bus_generic_deactivate_resource), DEVMETHOD(bus_child_pnpinfo_str, pci_child_pnpinfo_str_method), DEVMETHOD(bus_child_location_str, pci_child_location_str_method), @@ -2294,8 +2294,8 @@ pci_add_map(device_t pcib, device_t bus, /* * Disable decoding via the command register before - * determining the BARs length since we will be placing them - * in a weird state. + * determining the BAR's length since we will be placing it in + * a weird state. */ cmd = PCIB_READ_CONFIG(pcib, b, s, f, PCIR_COMMAND, 2); PCIB_WRITE_CONFIG(pcib, b, s, f, PCIR_COMMAND, @@ -2336,7 +2336,10 @@ pci_add_map(device_t pcib, device_t bus, return (barlen); if (ln2range == 64) - /* Read the other half of a 64bit map register */ + /* + * Read the other half of a 64bit map register. We + * assume that the size of the BAR is less than 2^32. + */ base |= (uint64_t) PCIB_READ_CONFIG(pcib, b, s, f, reg + 4, 4) << 32; if (bootverbose) { printf("\tmap[%02x]: type %s, range %2d, base %#jx, size %2d", @@ -2422,8 +2425,10 @@ pci_add_map(device_t pcib, device_t bus, */ resource_list_delete(rl, type, reg); start = 0; - } else + } else { start = rman_get_start(res); + rman_set_device(res, bus); + } pci_write_config(dev, reg, start, 4); if (ln2range == 64) pci_write_config(dev, reg + 4, start >> 32, 4); @@ -2441,6 +2446,7 @@ static void pci_ata_maps(device_t pcib, device_t bus, device_t dev, int b, int s, int f, struct resource_list *rl, int force, uint32_t prefetchmask) { + struct resource *r; int rid, type, progif; #if 0 /* if this device supports PCI native addressing use it */ @@ -2463,12 +2469,14 @@ pci_ata_maps(device_t pcib, device_t bus } else { rid = PCIR_BAR(0); resource_list_add(rl, type, rid, 0x1f0, 0x1f7, 8); - resource_list_alloc(rl, bus, dev, type, &rid, 0x1f0, 0x1f7, 8, - 0); + r = resource_list_alloc(rl, bus, dev, type, &rid, 0x1f0, 0x1f7, + 8, 0); + rman_set_device(r, bus); rid = PCIR_BAR(1); resource_list_add(rl, type, rid, 0x3f6, 0x3f6, 1); - resource_list_alloc(rl, bus, dev, type, &rid, 0x3f6, 0x3f6, 1, - 0); + r = resource_list_alloc(rl, bus, dev, type, &rid, 0x3f6, 0x3f6, + 1, 0); + rman_set_device(r, bus); } if (progif & PCIP_STORAGE_IDE_MODESEC) { pci_add_map(pcib, bus, dev, b, s, f, PCIR_BAR(2), rl, force, @@ -2478,12 +2486,14 @@ pci_ata_maps(device_t pcib, device_t bus } else { rid = PCIR_BAR(2); resource_list_add(rl, type, rid, 0x170, 0x177, 8); - resource_list_alloc(rl, bus, dev, type, &rid, 0x170, 0x177, 8, - 0); + r = resource_list_alloc(rl, bus, dev, type, &rid, 0x170, 0x177, + 8, 0); + rman_set_device(r, bus); rid = PCIR_BAR(3); resource_list_add(rl, type, rid, 0x376, 0x376, 1); - resource_list_alloc(rl, bus, dev, type, &rid, 0x376, 0x376, 1, - 0); + r = resource_list_alloc(rl, bus, dev, type, &rid, 0x376, 0x376, + 1, 0); + rman_set_device(r, bus); } pci_add_map(pcib, bus, dev, b, s, f, PCIR_BAR(4), rl, force, prefetchmask & (1 << 4)); @@ -3391,6 +3401,7 @@ pci_alloc_map(device_t dev, device_t chi struct resource_list_entry *rle; struct resource *res; pci_addr_t map, testval; + uint16_t cmd; int mapsize; /* @@ -3402,12 +3413,21 @@ pci_alloc_map(device_t dev, device_t chi */ res = NULL; map = pci_read_config(child, *rid, 4); + + /* + * Disable decoding via the command register before + * determining the BAR's length since we will be placing it in + * a weird state. + */ + cmd = pci_read_config(child, PCIR_COMMAND, 2); + pci_write_config(child, PCIR_COMMAND, + cmd & ~(PCI_BAR_MEM(map) ? PCIM_CMD_MEMEN : PCIM_CMD_PORTEN), 2); + + /* Determine the BAR's length. */ pci_write_config(child, *rid, 0xffffffff, 4); testval = pci_read_config(child, *rid, 4); if (pci_maprange(testval) == 64) map |= (pci_addr_t)pci_read_config(child, *rid + 4, 4) << 32; - if (pci_mapbase(testval) == 0) - goto out; /* * Restore the original value of the BAR. We may have reprogrammed @@ -3415,6 +3435,11 @@ pci_alloc_map(device_t dev, device_t chi * we need the console device addressable. */ pci_write_config(child, *rid, map, 4); + pci_write_config(child, PCIR_COMMAND, cmd, 2); + + /* Ignore a BAR with a base of 0. */ + if (pci_mapbase(testval) == 0) + goto out; if (PCI_BAR_MEM(testval)) { if (type != SYS_RES_MEMORY) { @@ -3452,13 +3477,14 @@ pci_alloc_map(device_t dev, device_t chi * appropriate bar for that resource. */ res = BUS_ALLOC_RESOURCE(device_get_parent(dev), child, type, rid, - start, end, count, flags); + start, end, count, flags & ~RF_ACTIVE); if (res == NULL) { device_printf(child, "%#lx bytes of rid %#x res %d failed (%#lx, %#lx).\n", count, *rid, type, start, end); goto out; } + rman_set_device(res, dev); resource_list_add(rl, type, *rid, start, end, count); rle = resource_list_find(rl, type, *rid); if (rle == NULL) @@ -3472,10 +3498,10 @@ pci_alloc_map(device_t dev, device_t chi "Lazy allocation of %#lx bytes rid %#x type %d at %#lx\n", count, *rid, type, rman_get_start(res)); map = rman_get_start(res); -out:; pci_write_config(child, *rid, map, 4); if (pci_maprange(testval) == 64) pci_write_config(child, *rid + 4, map >> 32, 4); +out:; return (res); } @@ -3487,68 +3513,63 @@ pci_alloc_resource(device_t dev, device_ struct pci_devinfo *dinfo = device_get_ivars(child); struct resource_list *rl = &dinfo->resources; struct resource_list_entry *rle; + struct resource *res; pcicfgregs *cfg = &dinfo->cfg; + if (device_get_parent(child) != dev) + return (BUS_ALLOC_RESOURCE(device_get_parent(dev), child, + type, rid, start, end, count, flags)); + /* * Perform lazy resource allocation */ - if (device_get_parent(child) == dev) { - switch (type) { - case SYS_RES_IRQ: - /* - * Can't alloc legacy interrupt once MSI messages - * have been allocated. - */ - if (*rid == 0 && (cfg->msi.msi_alloc > 0 || - cfg->msix.msix_alloc > 0)) + switch (type) { + case SYS_RES_IRQ: + /* + * Can't alloc legacy interrupt once MSI messages have + * been allocated. + */ + if (*rid == 0 && (cfg->msi.msi_alloc > 0 || + cfg->msix.msix_alloc > 0)) + return (NULL); + + /* + * If the child device doesn't have an interrupt + * routed and is deserving of an interrupt, try to + * assign it one. + */ + if (*rid == 0 && !PCI_INTERRUPT_VALID(cfg->intline) && + (cfg->intpin != 0)) + pci_assign_interrupt(dev, child, 0); + break; + case SYS_RES_IOPORT: + case SYS_RES_MEMORY: + /* Allocate resources for this BAR if needed. */ + rle = resource_list_find(rl, type, *rid); + if (rle == NULL) { + res = pci_alloc_map(dev, child, type, rid, start, end, + count, flags); + if (res == NULL) return (NULL); - /* - * If the child device doesn't have an - * interrupt routed and is deserving of an - * interrupt, try to assign it one. - */ - if (*rid == 0 && !PCI_INTERRUPT_VALID(cfg->intline) && - (cfg->intpin != 0)) - pci_assign_interrupt(dev, child, 0); - break; - case SYS_RES_IOPORT: - case SYS_RES_MEMORY: - if (*rid < PCIR_BAR(cfg->nummaps)) { - /* - * Enable the I/O mode. We should - * also be assigning resources too - * when none are present. The - * resource_list_alloc kind of sorta does - * this... - */ - if (PCI_ENABLE_IO(dev, child, type)) - return (NULL); - } rle = resource_list_find(rl, type, *rid); - if (rle == NULL) - return (pci_alloc_map(dev, child, type, rid, - start, end, count, flags)); - break; } + /* - * If we've already allocated the resource, then - * return it now. But first we may need to activate - * it, since we don't allocate the resource as active - * above. Normally this would be done down in the - * nexus, but since we short-circuit that path we have - * to do its job here. Not sure if we should free the - * resource if it fails to activate. + * If the resource belongs to the bus, then give it to + * the child. We need to activate it if requested + * since the bus always allocates inactive resources. */ - rle = resource_list_find(rl, type, *rid); - if (rle != NULL && rle->res != NULL) { + if (rle != NULL && rle->res != NULL && + rman_get_device(rle->res) == dev) { if (bootverbose) device_printf(child, "Reserved %#lx bytes for rid %#x type %d at %#lx\n", rman_get_size(rle->res), *rid, type, rman_get_start(rle->res)); + rman_set_device(rle->res, child); if ((flags & RF_ACTIVE) && - bus_generic_activate_resource(dev, child, type, - *rid, rle->res) != 0) + bus_activate_resource(child, type, *rid, + rle->res) != 0) return (NULL); return (rle->res); } @@ -3557,6 +3578,59 @@ pci_alloc_resource(device_t dev, device_ start, end, count, flags)); } +int +pci_release_resource(device_t dev, device_t child, int type, int rid, + struct resource *r) +{ + int error; + + if (device_get_parent(child) != dev) + return (BUS_RELEASE_RESOURCE(device_get_parent(dev), child, + type, rid, r)); + + /* + * For BARs we don't actually want to release the resource. + * Instead, we deactivate the resource if needed and then give + * ownership of the BAR back to the bus. + */ + switch (type) { + case SYS_RES_IOPORT: + case SYS_RES_MEMORY: + if (rman_get_device(r) != child) + return (EINVAL); + if (rman_get_flags(r) & RF_ACTIVE) { + error = bus_deactivate_resource(child, type, rid, r); + if (error) + return (error); + } + rman_set_device(r, dev); + return (0); + } + return (bus_generic_rl_release_resource(dev, child, type, rid, r)); +} + +int +pci_activate_resource(device_t dev, device_t child, int type, int rid, + struct resource *r) +{ + int error; + + error = bus_generic_activate_resource(dev, child, type, rid, r); + if (error) + return (error); + + /* Enable decoding in the command register when activating BARs. */ + if (device_get_parent(child) == dev) { + switch (type) { + case SYS_RES_IOPORT: + case SYS_RES_MEMORY: + error = PCI_ENABLE_IO(dev, child, type); + break; + } + } + return (error); +} + void pci_delete_resource(device_t dev, device_t child, int type, int rid) { @@ -3570,27 +3644,34 @@ pci_delete_resource(device_t dev, device dinfo = device_get_ivars(child); rl = &dinfo->resources; rle = resource_list_find(rl, type, rid); - if (rle) { - if (rle->res) { - if (rman_get_device(rle->res) != dev || - rman_get_flags(rle->res) & RF_ACTIVE) { - device_printf(dev, "delete_resource: " - "Resource still owned by child, oops. " - "(type=%d, rid=%d, addr=%lx)\n", - rle->type, rle->rid, - rman_get_start(rle->res)); - return; - } - bus_release_resource(dev, type, rid, rle->res); + if (rle == NULL) + return; + + if (rle->res) { + if (rman_get_device(rle->res) != dev || + rman_get_flags(rle->res) & RF_ACTIVE) { + device_printf(dev, "delete_resource: " + "Resource still owned by child, oops. " + "(type=%d, rid=%d, addr=%lx)\n", + rle->type, rle->rid, + rman_get_start(rle->res)); + return; } - resource_list_delete(rl, type, rid); + + /* + * If this is a BAR, clear the BAR so it stops + * decoding before releasing the resource. + */ + switch (type) { + case SYS_RES_IOPORT: + case SYS_RES_MEMORY: + /* XXX: 64-bit BARs? */ + pci_write_config(child, rid, 0, 4); + break; + } + bus_release_resource(dev, type, rid, rle->res); } - /* - * Why do we turn off the PCI configuration BAR when we delete a - * resource? -- imp - */ - pci_write_config(child, rid, 0, 4); - BUS_DELETE_RESOURCE(device_get_parent(dev), child, type, rid); + resource_list_delete(rl, type, rid); } struct resource_list * Modified: head/sys/dev/pci/pci_private.h ============================================================================== --- head/sys/dev/pci/pci_private.h Tue Mar 3 15:50:24 2009 (r189305) +++ head/sys/dev/pci/pci_private.h Tue Mar 3 16:38:59 2009 (r189306) @@ -82,6 +82,10 @@ int pci_msix_count_method(device_t dev, struct resource *pci_alloc_resource(device_t dev, device_t child, int type, int *rid, u_long start, u_long end, u_long count, u_int flags); +int pci_release_resource(device_t dev, device_t child, int type, + int rid, struct resource *r); +int pci_activate_resource(device_t dev, device_t child, int type, + int rid, struct resource *r); void pci_delete_resource(device_t dev, device_t child, int type, int rid); struct resource_list *pci_get_resource_list (device_t dev, device_t child); From owner-svn-src-head@FreeBSD.ORG Tue Mar 3 17:02:52 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 7C86F1065719; Tue, 3 Mar 2009 17:02:52 +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 68A4E8FC14; Tue, 3 Mar 2009 17:02:52 +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 n23H2qUf016265; Tue, 3 Mar 2009 17:02:52 GMT (envelope-from kientzle@svn.freebsd.org) Received: (from kientzle@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n23H2pK9016248; Tue, 3 Mar 2009 17:02:51 GMT (envelope-from kientzle@svn.freebsd.org) Message-Id: <200903031702.n23H2pK9016248@svn.freebsd.org> From: Tim Kientzle Date: Tue, 3 Mar 2009 17:02: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: r189308 - in head/lib/libarchive: . 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: Tue, 03 Mar 2009 17:02:54 -0000 Author: kientzle Date: Tue Mar 3 17:02:51 2009 New Revision: 189308 URL: http://svn.freebsd.org/changeset/base/189308 Log: Merge r294:337,r348:350 from libarchive.googlecode.com: A lot of work to make libarchive work on Windows. Added: head/lib/libarchive/test/test_compat_gtar_1.tar.uu (contents, props changed) head/lib/libarchive/test/test_pax_filename_encoding.tar.uu (contents, props changed) head/lib/libarchive/test/test_read_format_gtar_sparse_1_13.tar.uu (contents, props changed) head/lib/libarchive/test/test_read_format_gtar_sparse_1_17.tar.uu (contents, props changed) head/lib/libarchive/test/test_read_format_gtar_sparse_1_17_posix00.tar.uu (contents, props changed) head/lib/libarchive/test/test_read_format_gtar_sparse_1_17_posix01.tar.uu (contents, props changed) head/lib/libarchive/test/test_read_format_gtar_sparse_1_17_posix10.tar.uu (contents, props changed) Deleted: head/lib/libarchive/test/test_compat_gtar_1.tgz.uu head/lib/libarchive/test/test_pax_filename_encoding.tar.gz.uu head/lib/libarchive/test/test_read_format_gtar_sparse_1_13.tgz.uu head/lib/libarchive/test/test_read_format_gtar_sparse_1_17.tgz.uu head/lib/libarchive/test/test_read_format_gtar_sparse_1_17_posix00.tgz.uu head/lib/libarchive/test/test_read_format_gtar_sparse_1_17_posix01.tgz.uu head/lib/libarchive/test/test_read_format_gtar_sparse_1_17_posix10.tgz.uu Modified: head/lib/libarchive/archive.h head/lib/libarchive/archive_entry.c head/lib/libarchive/archive_string.c head/lib/libarchive/archive_write_disk.c head/lib/libarchive/archive_write_set_format_pax.c head/lib/libarchive/test/ (props changed) head/lib/libarchive/test/main.c head/lib/libarchive/test/read_open_memory.c head/lib/libarchive/test/test.h head/lib/libarchive/test/test_acl_pax.c head/lib/libarchive/test/test_compat_bzip2.c head/lib/libarchive/test/test_compat_gtar.c head/lib/libarchive/test/test_compat_gzip.c head/lib/libarchive/test/test_compat_zip.c head/lib/libarchive/test/test_empty_write.c head/lib/libarchive/test/test_entry.c head/lib/libarchive/test/test_fuzz.c head/lib/libarchive/test/test_pax_filename_encoding.c head/lib/libarchive/test/test_read_compress_program.c head/lib/libarchive/test/test_read_extract.c head/lib/libarchive/test/test_read_format_cpio_bin_bz2.c head/lib/libarchive/test/test_read_format_cpio_bin_gz.c head/lib/libarchive/test/test_read_format_cpio_svr4_gzip.c head/lib/libarchive/test/test_read_format_empty.c head/lib/libarchive/test/test_read_format_gtar_gz.c head/lib/libarchive/test/test_read_format_gtar_sparse.c head/lib/libarchive/test/test_read_format_iso_gz.c head/lib/libarchive/test/test_read_format_isorr_bz2.c head/lib/libarchive/test/test_read_format_pax_bz2.c head/lib/libarchive/test/test_read_format_tbz.c head/lib/libarchive/test/test_read_format_tgz.c head/lib/libarchive/test/test_read_format_zip.c head/lib/libarchive/test/test_read_large.c head/lib/libarchive/test/test_tar_large.c head/lib/libarchive/test/test_ustar_filenames.c head/lib/libarchive/test/test_write_compress.c head/lib/libarchive/test/test_write_compress_program.c head/lib/libarchive/test/test_write_disk.c head/lib/libarchive/test/test_write_disk_hardlink.c head/lib/libarchive/test/test_write_disk_perms.c head/lib/libarchive/test/test_write_disk_secure.c head/lib/libarchive/test/test_write_format_ar.c head/lib/libarchive/test/test_write_format_cpio_newc.c head/lib/libarchive/test/test_write_format_cpio_odc.c head/lib/libarchive/test/test_write_format_tar.c head/lib/libarchive/test/test_write_format_tar_empty.c head/lib/libarchive/test/test_write_format_tar_ustar.c head/lib/libarchive/test/test_write_open_memory.c Modified: head/lib/libarchive/archive.h ============================================================================== --- head/lib/libarchive/archive.h Tue Mar 3 16:56:15 2009 (r189307) +++ head/lib/libarchive/archive.h Tue Mar 3 17:02:51 2009 (r189308) @@ -47,7 +47,11 @@ /* These should match the types used in 'struct stat' */ #ifdef _WIN32 #define __LA_INT64_T __int64 -#define __LA_SSIZE_T long +# if defined(_WIN64) +# define __LA_SSIZE_T __int64 +# else +# define __LA_SSIZE_T long +# endif #define __LA_UID_T unsigned int #define __LA_GID_T unsigned int #else Modified: head/lib/libarchive/archive_entry.c ============================================================================== --- head/lib/libarchive/archive_entry.c Tue Mar 3 16:56:15 2009 (r189307) +++ head/lib/libarchive/archive_entry.c Tue Mar 3 17:02:51 2009 (r189308) @@ -62,6 +62,9 @@ __FBSDID("$FreeBSD$"); #ifdef HAVE_WCHAR_H #include #endif +#ifdef _WIN32 +#include +#endif #include "archive.h" #include "archive_entry.h" @@ -227,9 +230,15 @@ aes_get_wcs(struct aes *aes) w = (wchar_t *)malloc((wcs_length + 1) * sizeof(wchar_t)); if (w == NULL) __archive_errx(1, "No memory for aes_get_wcs()"); +#ifndef _WIN32 r = mbstowcs(w, aes->aes_mbs.s, wcs_length); - w[wcs_length] = 0; +#else + r = MultiByteToWideChar(CP_ACP, MB_ERR_INVALID_CHARS, + aes->aes_mbs.s, (int)aes->aes_mbs.length, w, + (int)wcs_length); +#endif if (r > 0) { + w[r] = 0; aes->aes_set |= AES_SET_WCS; return (aes->aes_wcs = w); } Modified: head/lib/libarchive/archive_string.c ============================================================================== --- head/lib/libarchive/archive_string.c Tue Mar 3 16:56:15 2009 (r189307) +++ head/lib/libarchive/archive_string.c Tue Mar 3 17:02:51 2009 (r189308) @@ -40,6 +40,9 @@ __FBSDID("$FreeBSD$"); #ifdef HAVE_WCHAR_H #include #endif +#ifdef _WIN32 +#include +#endif #include "archive_private.h" #include "archive_string.h" @@ -175,6 +178,7 @@ __archive_strappend_int(struct archive_s return (as); } +#ifndef _WIN32 /* * Home-grown wctomb for UTF-8. */ @@ -375,3 +379,83 @@ __archive_string_utf8_w(struct archive_s *dest++ = L'\0'; return (ws); } + +#else + +static struct archive_string * +my_archive_strappend_w(struct archive_string *as, + unsigned int codepage, const wchar_t *w) +{ + char *p; + int l, wl; + BOOL useDefaultChar = FALSE; + + wl = (int)wcslen(w); + l = wl * 4 + 4; + p = malloc(l); + if (p == NULL) + __archive_errx(1, "Out of memory"); + /* To check a useDefaultChar is to simulate error handling of + * the my_wcstombs() which is running on non Windows system with + * wctomb(). + * And to set NULL for last argument is necessary when a codepage + * is not CP_ACP(current locale). + */ + l = WideCharToMultiByte(codepage, 0, w, wl, p, l, NULL, + (codepage == CP_ACP) ? &useDefaultChar : NULL); + if (l == 0 || useDefaultChar) { + free(p); + return (NULL); + } + __archive_string_append(as, p, l); + free(p); + return (as); +} + +/* + * Translates a wide character string into UTF-8 and appends + * to the archive_string. Note: returns NULL if conversion fails. + */ +struct archive_string * +__archive_strappend_w_utf8(struct archive_string *as, const wchar_t *w) +{ + + return (my_archive_strappend_w(as, CP_UTF8, w)); +} + +/* + * Translates a wide character string into current locale character set + * and appends to the archive_string. Note: returns NULL if conversion + * fails. + */ +struct archive_string * +__archive_strappend_w_mbs(struct archive_string *as, const wchar_t *w) +{ + + return (my_archive_strappend_w(as, CP_ACP, w)); +} + +/* + * Return a wide-character string by converting this archive_string + * from UTF-8. + */ +wchar_t * +__archive_string_utf8_w(struct archive_string *as) +{ + wchar_t *ws; + int n; + + ws = (wchar_t *)malloc((as->length + 1) * sizeof(wchar_t)); + if (ws == NULL) + __archive_errx(1, "Out of memory"); + n = MultiByteToWideChar(CP_UTF8, MB_ERR_INVALID_CHARS, + as->s, (int)as->length, ws, (int)as->length); + if (n == 0) { + free(ws); + return (NULL); + } + ws[n] = L'\0'; + return (ws); +} + +#endif /* !_WIN32 */ Modified: head/lib/libarchive/archive_write_disk.c ============================================================================== --- head/lib/libarchive/archive_write_disk.c Tue Mar 3 16:56:15 2009 (r189307) +++ head/lib/libarchive/archive_write_disk.c Tue Mar 3 17:02:51 2009 (r189308) @@ -83,6 +83,9 @@ __FBSDID("$FreeBSD$"); #ifdef HAVE_UTIME_H #include #endif +#ifdef _WIN32 +#include +#endif #include "archive.h" #include "archive_string.h" @@ -516,6 +519,9 @@ static ssize_t write_data_block(struct archive_write_disk *a, const char *buff, size_t size) { uint64_t start_size = size; +#if _WIN32 + HANDLE handle; +#endif ssize_t bytes_written = 0; ssize_t block_size = 0, bytes_to_write; @@ -524,6 +530,9 @@ write_data_block(struct archive_write_di "Attempt to write to an empty file"); return (ARCHIVE_WARN); } +#if _WIN32 + handle = (HANDLE)_get_osfhandle(a->fd); +#endif if (a->flags & ARCHIVE_EXTRACT_SPARSE) { #if HAVE_STRUCT_STAT_ST_BLKSIZE @@ -572,7 +581,23 @@ write_data_block(struct archive_write_di if (a->offset + bytes_to_write > block_end) bytes_to_write = block_end - a->offset; } - +#ifdef _WIN32 + /* Seek if necessary to the specified offset. */ + if (offset != a->fd_offset) { + LARGE_INTEGER distance; + distance.QuadPart = offset; + if (!SetFilePointerEx(handle, distance, NULL, FILE_BEGIN)) { + archive_set_error(&a->archive, _dosmaperr(GetLastError()), + "Seek failed"); + return (ARCHIVE_FATAL); + } + } + if (!WriteFile(handle, buff, bytes_to_write, &bytes_written, NULL)) { + archive_set_error(&a->archive, _dosmaperr(GetLastError()), + "Write failed"); + return (ARCHIVE_WARN); + } +#else /* Seek if necessary to the specified offset. */ if (a->offset != a->fd_offset) { if (lseek(a->fd, a->offset, SEEK_SET) < 0) { @@ -589,6 +614,7 @@ write_data_block(struct archive_write_di archive_set_error(&a->archive, errno, "Write failed"); return (ARCHIVE_WARN); } +#endif buff += bytes_written; size -= bytes_written; a->offset += bytes_written; @@ -1186,7 +1212,11 @@ _archive_write_close(struct archive *_a) if (p->fixup & TODO_TIMES) { #ifdef HAVE_UTIMES /* {f,l,}utimes() are preferred, when available. */ +#ifdef __timeval + struct __timeval times[2]; +#else struct timeval times[2]; +#endif times[0].tv_sec = p->atime; times[0].tv_usec = p->atime_nanos / 1000; #ifdef HAVE_STRUCT_STAT_ST_BIRTHTIME @@ -1717,7 +1747,11 @@ set_time(int fd, int mode, const char *n time_t atime, long atime_nsec, time_t mtime, long mtime_nsec) { +#ifdef __timeval + struct __timeval times[2]; +#else struct timeval times[2]; +#endif times[0].tv_sec = atime; times[0].tv_usec = atime_nsec / 1000; Modified: head/lib/libarchive/archive_write_set_format_pax.c ============================================================================== --- head/lib/libarchive/archive_write_set_format_pax.c Tue Mar 3 16:56:15 2009 (r189307) +++ head/lib/libarchive/archive_write_set_format_pax.c Tue Mar 3 17:02:51 2009 (r189308) @@ -203,6 +203,16 @@ utf8_encode(const wchar_t *wval) utf8len = 0; for (wp = wval; *wp != L'\0'; ) { wc = *wp++; + + if (wc >= 0xd800 && wc <= 0xdbff + && *wp >= 0xdc00 && *wp <= 0xdfff) { + /* This is a surrogate pair. Combine into a + * full Unicode value before encoding into + * UTF-8. */ + wc = (wc - 0xd800) << 10; /* High 10 bits */ + wc += (*wp++ - 0xdc00); /* Low 10 bits */ + wc += 0x10000; /* Skip BMP */ + } if (wc <= 0x7f) utf8len++; else if (wc <= 0x7ff) @@ -226,6 +236,12 @@ utf8_encode(const wchar_t *wval) for (wp = wval, p = utf8_value; *wp != L'\0'; ) { wc = *wp++; + if (wc >= 0xd800 && wc <= 0xdbff + && *wp >= 0xdc00 && *wp <= 0xdfff) { + /* Combine surrogate pair. */ + wc = (wc - 0xd800) << 10; + wc += *wp++ - 0xdc00 + 0x10000; + } if (wc <= 0x7f) { *p++ = (char)wc; } else if (wc <= 0x7ff) { Modified: head/lib/libarchive/test/main.c ============================================================================== --- head/lib/libarchive/test/main.c Tue Mar 3 16:56:15 2009 (r189307) +++ head/lib/libarchive/test/main.c Tue Mar 3 17:02:51 2009 (r189308) @@ -44,7 +44,7 @@ #define ENVBASE "LIBARCHIVE" /* Prefix for environment variables. */ #define EXTRA_DUMP(x) archive_error_string((struct archive *)(x)) #define EXTRA_VERSION archive_version() -#define KNOWNREF "test_compat_gtar_1.tgz.uu" +#define KNOWNREF "test_compat_gtar_1.tar.uu" __FBSDID("$FreeBSD$"); /* @@ -81,7 +81,20 @@ static int skips = 0; static int assertions = 0; /* Directory where uuencoded reference files can be found. */ -static char *refdir; +static const char *refdir; + + +#ifdef _WIN32 + +static void +invalid_paramter_handler(const wchar_t * expression, + const wchar_t * function, const wchar_t * file, + unsigned int line, uintptr_t pReserved) +{ + /* nop */ +} + +#endif /* * My own implementation of the standard assert() macro emits the @@ -751,7 +764,11 @@ static int test_run(int i, const char *t /* If there were no failures, we can remove the work dir. */ if (failures == failures_before) { if (!keep_temp_files && chdir(tmpdir) == 0) { +#ifndef _WIN32 systemf("rm -rf %s", tests[i].name); +#else + systemf("rmdir /S /Q %s", tests[i].name); +#endif } } /* Return appropriate status. */ @@ -844,19 +861,18 @@ extract_reference_file(const char *name) } static char * -get_refdir(const char *tmpdir) +get_refdir(void) { char tried[512] = { '\0' }; char buff[128]; char *pwd, *p; /* Get the current dir. */ - systemf("/bin/pwd > %s/refdir", tmpdir); - pwd = slurpfile(NULL, "%s/refdir", tmpdir); + /* XXX Visual C++ uses _getcwd() XXX */ + pwd = getcwd(NULL, 0); while (pwd[strlen(pwd) - 1] == '\n') pwd[strlen(pwd) - 1] = '\0'; printf("PWD: %s\n", pwd); - systemf("rm %s/refdir", tmpdir); /* Look for a known file. */ snprintf(buff, sizeof(buff), "%s", pwd); @@ -904,24 +920,24 @@ success: int main(int argc, char **argv) { static const int limit = sizeof(tests) / sizeof(tests[0]); - int i, tests_run = 0, tests_failed = 0, opt; + int i, tests_run = 0, tests_failed = 0, option; time_t now; char *refdir_alloc = NULL; - char *progname, *p; - const char *tmp; + const char *progname = LIBRARY "_test"; + const char *tmp, *option_arg, *p; char tmpdir[256]; char tmpdir_timestamp[256]; - /* - * Name of this program, used to build root of our temp directory - * tree. - */ - progname = p = argv[0]; - while (*p != '\0') { - if (*p == '/') - progname = p + 1; - ++p; - } + (void)argc; /* UNUSED */ + +#ifdef _WIN32 + /* To stop to run the default invalid parameter handler. */ + _set_invalid_parameter_handler(invalid_paramter_handler); + /* for open() to a binary mode. */ + _set_fmode(_O_BINARY); + /* Disable annoying assertion message box. */ + _CrtSetReportMode(_CRT_ASSERT, 0); +#endif #ifdef PROGRAM /* Get the target program from environment, if available. */ @@ -947,39 +963,60 @@ int main(int argc, char **argv) refdir = getenv(ENVBASE "_TEST_FILES"); /* - * Parse options. + * Parse options, without using getopt(), which isn't available + * on all platforms. */ - while ((opt = getopt(argc, argv, "dkp:qr:v")) != -1) { - switch (opt) { - case 'd': - dump_on_failure = 1; - break; - case 'k': - keep_temp_files = 1; - break; - case 'p': + ++argv; /* Skip program name */ + while (*argv != NULL) { + p = *argv++; + if (*p++ != '-') + usage(progname); + while (*p != '\0') { + option = *p++; + option_arg = NULL; + /* If 'opt' takes an argument, parse that. */ + if (option == 'p' || option == 'r') { + if (*p != '\0') + option_arg = p; + else if (*argv == NULL) { + fprintf(stderr, + "Option -%c requires argument.\n", + option); + usage(progname); + } else + option_arg = *argv++; + p = ""; /* End of this option word. */ + } + + /* Now, handle the option. */ + switch (option) { + case 'd': + dump_on_failure = 1; + break; + case 'k': + keep_temp_files = 1; + break; + case 'p': #ifdef PROGRAM - testprog = optarg; + testprog = option_arg; #else - usage(progname); + usage(progname); #endif - break; - case 'q': - quiet_flag++; - break; - case 'r': - refdir = optarg; - break; - case 'v': - verbose = 1; - break; - case '?': - default: - usage(progname); + break; + case 'q': + quiet_flag++; + break; + case 'r': + refdir = option_arg; + break; + case 'v': + verbose = 1; + break; + default: + usage(progname); + } } } - argc -= optind; - argv += optind; /* * Sanity-check that our options make sense. @@ -1016,7 +1053,7 @@ int main(int argc, char **argv) * the "usual places." */ if (refdir == NULL) - refdir = refdir_alloc = get_refdir(tmpdir); + refdir = refdir_alloc = get_refdir(); /* * Banner with basic information. @@ -1035,7 +1072,7 @@ int main(int argc, char **argv) /* * Run some or all of the individual tests. */ - if (argc == 0) { + if (*argv == NULL) { /* Default: Run all tests. */ for (i = 0; i < limit; i++) { if (test_run(i, tmpdir)) Modified: head/lib/libarchive/test/read_open_memory.c ============================================================================== --- head/lib/libarchive/test/read_open_memory.c Tue Mar 3 16:56:15 2009 (r189307) +++ head/lib/libarchive/test/read_open_memory.c Tue Mar 3 17:02:51 2009 (r189308) @@ -107,7 +107,7 @@ memory_read(struct archive *a, void *cli *buff = mine->copy_buff; mine->buffer += size; - return (size); + return ((ssize_t)size); } /* Modified: head/lib/libarchive/test/test.h ============================================================================== --- head/lib/libarchive/test/test.h Tue Mar 3 16:56:15 2009 (r189307) +++ head/lib/libarchive/test/test.h Tue Mar 3 17:02:51 2009 (r189308) @@ -45,7 +45,11 @@ #error Oops: No config.h and no pre-built configuration in test.h. #endif +#ifndef _WIN32 #include +#else +#include +#endif #include #include #include @@ -68,6 +72,16 @@ #define __FBSDID(a) /* null */ #endif +#ifdef _WIN32 +#define LOCALE_DE "deu" +#else +#define LOCALE_DE "de_DE.UTF-8" +#endif + +#ifndef O_BINARY +#define O_BINARY 0 +#endif + /* * Redefine DEFINE_TEST for use in defining the test functions. */ Modified: head/lib/libarchive/test/test_acl_pax.c ============================================================================== --- head/lib/libarchive/test/test_acl_pax.c Tue Mar 3 16:56:15 2009 (r189307) +++ head/lib/libarchive/test/test_acl_pax.c Tue Mar 3 17:02:51 2009 (r189308) @@ -454,7 +454,7 @@ DEFINE_TEST(test_acl_pax) /* Write out the data we generated to a file for manual inspection. */ assert(-1 < (fd = open("testout", O_WRONLY | O_CREAT | O_TRUNC, 0775))); - assert(used == (size_t)write(fd, buff, used)); + assert(used == (size_t)write(fd, buff, (unsigned int)used)); close(fd); /* Write out the reference data to a file for manual inspection. */ @@ -466,7 +466,7 @@ DEFINE_TEST(test_acl_pax) failure("Generated pax archive does not match reference; check 'testout' and 'reference' files."); assert(0 == memcmp(buff, reference, sizeof(reference))); failure("Generated pax archive does not match reference; check 'testout' and 'reference' files."); - assertEqualInt(used, sizeof(reference)); + assertEqualInt((int)used, sizeof(reference)); /* Read back each entry and check that the ACL data is right. */ assert(NULL != (a = archive_read_new())); Modified: head/lib/libarchive/test/test_compat_bzip2.c ============================================================================== --- head/lib/libarchive/test/test_compat_bzip2.c Tue Mar 3 16:56:15 2009 (r189307) +++ head/lib/libarchive/test/test_compat_bzip2.c Tue Mar 3 17:02:51 2009 (r189308) @@ -82,8 +82,12 @@ compat_bzip2(const char *name) DEFINE_TEST(test_compat_bzip2) { +#if HAVE_BZLIB_H compat_bzip2("test_compat_bzip2_1.tbz"); compat_bzip2("test_compat_bzip2_2.tbz"); +#else + skipping("Need bzlib"); +#endif } Modified: head/lib/libarchive/test/test_compat_gtar.c ============================================================================== --- head/lib/libarchive/test/test_compat_gtar.c Tue Mar 3 16:56:15 2009 (r189307) +++ head/lib/libarchive/test/test_compat_gtar.c Tue Mar 3 17:02:51 2009 (r189308) @@ -40,7 +40,7 @@ __FBSDID("$FreeBSD$"); static void test_compat_gtar_1(void) { - char name[] = "test_compat_gtar_1.tgz"; + char name[] = "test_compat_gtar_1.tar"; struct archive_entry *ae; struct archive *a; int r; @@ -99,7 +99,7 @@ test_compat_gtar_1(void) assertEqualIntA(a, ARCHIVE_EOF, archive_read_next_header(a, &ae)); /* Verify that the format detection worked. */ - assertEqualInt(archive_compression(a), ARCHIVE_COMPRESSION_GZIP); + assertEqualInt(archive_compression(a), ARCHIVE_COMPRESSION_NONE); assertEqualInt(archive_format(a), ARCHIVE_FORMAT_TAR_GNUTAR); assertEqualInt(ARCHIVE_OK, archive_read_close(a)); Added: head/lib/libarchive/test/test_compat_gtar_1.tar.uu ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/lib/libarchive/test/test_compat_gtar_1.tar.uu Tue Mar 3 17:02:51 2009 (r189308) @@ -0,0 +1,232 @@ +$FreeBSD$ +begin 644 test_compat_gtar_1.tar +M+B\N+T!,;VYG3&EN:P`````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M`````````````"`@("`@,"``("`@("`P(``@("`@(#`@`"`@("`@("`@,S$Q +M("`@("`@("`@("`P("`Q,# 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 2685F10657AE; Tue, 3 Mar 2009 17:07:28 +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 EF4B58FC1F; Tue, 3 Mar 2009 17:07:27 +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 n23H7Rfj016398; Tue, 3 Mar 2009 17:07:27 GMT (envelope-from kientzle@svn.freebsd.org) Received: (from kientzle@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n23H7RmL016396; Tue, 3 Mar 2009 17:07:27 GMT (envelope-from kientzle@svn.freebsd.org) Message-Id: <200903031707.n23H7RmL016396@svn.freebsd.org> From: Tim Kientzle Date: Tue, 3 Mar 2009 17:07: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: r189309 - head/lib/libarchive 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, 03 Mar 2009 17:07:29 -0000 Author: kientzle Date: Tue Mar 3 17:07:27 2009 New Revision: 189309 URL: http://svn.freebsd.org/changeset/base/189309 Log: Merge r340 from libarchive.googlecode.com: If zlib/bzlib aren't available, we can still detect gzip/bzip2 compressed streams, we just can't decompress them. Modified: head/lib/libarchive/archive_write_set_compression_bzip2.c head/lib/libarchive/archive_write_set_compression_gzip.c Modified: head/lib/libarchive/archive_write_set_compression_bzip2.c ============================================================================== --- head/lib/libarchive/archive_write_set_compression_bzip2.c Tue Mar 3 17:02:51 2009 (r189308) +++ head/lib/libarchive/archive_write_set_compression_bzip2.c Tue Mar 3 17:07:27 2009 (r189309) @@ -25,9 +25,6 @@ #include "archive_platform.h" -/* Don't compile this if we don't have bzlib. */ -#if HAVE_BZLIB_H - __FBSDID("$FreeBSD$"); #ifdef HAVE_ERRNO_H @@ -48,6 +45,16 @@ __FBSDID("$FreeBSD$"); #include "archive_private.h" #include "archive_write_private.h" +#ifndef HAVE_BZLIB_H +int +archive_write_set_compression_bzip2(struct archive *_a) +{ + /* Unsupported bzip2 compression, we don't have bzlib */ + return (ARCHIVE_FATAL); +} +#else +/* Don't compile this if we don't have bzlib. */ + struct private_data { bz_stream stream; int64_t total_in; Modified: head/lib/libarchive/archive_write_set_compression_gzip.c ============================================================================== --- head/lib/libarchive/archive_write_set_compression_gzip.c Tue Mar 3 17:02:51 2009 (r189308) +++ head/lib/libarchive/archive_write_set_compression_gzip.c Tue Mar 3 17:07:27 2009 (r189309) @@ -25,9 +25,6 @@ #include "archive_platform.h" -/* Don't compile this if we don't have zlib. */ -#if HAVE_ZLIB_H - __FBSDID("$FreeBSD$"); #ifdef HAVE_ERRNO_H @@ -48,6 +45,16 @@ __FBSDID("$FreeBSD$"); #include "archive_private.h" #include "archive_write_private.h" +#ifndef HAVE_ZLIB_H +int +archive_write_set_compression_gzip(struct archive *_a) +{ + /* Unsupported gzip compression, we don't have zlib */ + return (ARCHIVE_FATAL); +} +#else +/* Don't compile this if we don't have zlib. */ + struct private_data { z_stream stream; int64_t total_in; From owner-svn-src-head@FreeBSD.ORG Tue Mar 3 17: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 355F01065670; Tue, 3 Mar 2009 17:15:06 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 232FA8FC1B; Tue, 3 Mar 2009 17:15:06 +0000 (UTC) (envelope-from rwatson@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 n23HF6RG016676; Tue, 3 Mar 2009 17:15:06 GMT (envelope-from rwatson@svn.freebsd.org) Received: (from rwatson@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n23HF58A016673; Tue, 3 Mar 2009 17:15:05 GMT (envelope-from rwatson@svn.freebsd.org) Message-Id: <200903031715.n23HF58A016673@svn.freebsd.org> From: Robert Watson Date: Tue, 3 Mar 2009 17:15: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: r189311 - in head/sys: kern security/mac 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, 03 Mar 2009 17:15:06 -0000 Author: rwatson Date: Tue Mar 3 17:15:05 2009 New Revision: 189311 URL: http://svn.freebsd.org/changeset/base/189311 Log: Reduce the verbosity of SDT trace points for DTrace by defining several wrapper macros that allow trace points and arguments to be declared using a single macro rather than several. This means a lot less repetition and vertical space for each trace point. Use these macros when defining privilege and MAC Framework trace points. Reviewed by: jb MFC after: 1 week Modified: head/sys/kern/kern_priv.c head/sys/security/mac/mac_framework.c head/sys/sys/sdt.h Modified: head/sys/kern/kern_priv.c ============================================================================== --- head/sys/kern/kern_priv.c Tue Mar 3 17:10:14 2009 (r189310) +++ head/sys/kern/kern_priv.c Tue Mar 3 17:15:05 2009 (r189311) @@ -61,12 +61,8 @@ SYSCTL_INT(_security_bsd, OID_AUTO, suse TUNABLE_INT("security.bsd.suser_enabled", &suser_enabled); SDT_PROVIDER_DEFINE(priv); - -SDT_PROBE_DEFINE(priv, kernel, priv_check, priv_ok); -SDT_PROBE_ARGTYPE(priv, kernel, priv_check, priv_ok, 0, "int"); - -SDT_PROBE_DEFINE(priv, kernel, priv_check, priv_err); -SDT_PROBE_ARGTYPE(priv, kernel, priv_check, priv_err, 0, "int"); +SDT_PROBE_DEFINE1(priv, kernel, priv_check, priv_ok, "int"); +SDT_PROBE_DEFINE1(priv, kernel, priv_check, priv_err, "int"); /* * Check a credential for privilege. Lots of good reasons to deny privilege; Modified: head/sys/security/mac/mac_framework.c ============================================================================== --- head/sys/security/mac/mac_framework.c Tue Mar 3 17:10:14 2009 (r189310) +++ head/sys/security/mac/mac_framework.c Tue Mar 3 17:15:05 2009 (r189311) @@ -88,19 +88,10 @@ __FBSDID("$FreeBSD$"); * DTrace SDT provider for MAC. */ SDT_PROVIDER_DEFINE(mac); - -SDT_PROBE_DEFINE(mac, kernel, policy, modevent); -SDT_PROBE_ARGTYPE(mac, kernel, policy, modevent, 0, "int"); -SDT_PROBE_ARGTYPE(mac, kernel, policy, modevent, 1, +SDT_PROBE_DEFINE2(mac, kernel, policy, modevent, "int", "struct mac_policy_conf *mpc"); - -SDT_PROBE_DEFINE(mac, kernel, policy, register); -SDT_PROBE_ARGTYPE(mac, kernel, policy, register, 0, - "struct mac_policy_conf *"); - -SDT_PROBE_DEFINE(mac, kernel, policy, unregister); -SDT_PROBE_ARGTYPE(mac, kernel, policy, unregister, 0, - "struct mac_policy_conf *"); +SDT_PROBE_DEFINE1(mac, kernel, policy, register, "struct mac_policy_conf *"); +SDT_PROBE_DEFINE1(mac, kernel, policy, unregister, "struct mac_policy_conf *"); /* * Root sysctl node for all MAC and MAC policy controls. Modified: head/sys/sys/sdt.h ============================================================================== --- head/sys/sys/sdt.h Tue Mar 3 17:10:14 2009 (r189310) +++ head/sys/sys/sdt.h Tue Mar 3 17:15:05 2009 (r189311) @@ -53,6 +53,12 @@ #define SDT_PROBE(prov, mod, func, name, arg0, arg1, arg2, arg3, arg4) #define SDT_PROBE_ARGTYPE(prov, mod, func, name, num, type) +#define SDT_PROBE_DEFINE1(prov, mod, func, name, arg0) +#define SDT_PROBE_DEFINE2(prov, mod, func, name, arg0, arg1) +#define SDT_PROBE_DEFINE3(prov, mod, func, name, arg0, arg1, arg2) +#define SDT_PROBE_DEFINE4(prov, mod, func, name, arg0, arg1, arg2, arg3) +#define SDT_PROBE_DEFINE5(prov, mod, func, name, arg0, arg1, arg2, arg3, arg4) + #else /* @@ -156,6 +162,36 @@ struct sdt_provider { SI_SUB_KDTRACE, SI_ORDER_SECOND + 2, sdt_argtype_deregister, \ sdt_##prov##_##mod##_##func##_##name##num ) +#define SDT_PROBE_DEFINE1(prov, mod, func, name, arg0) \ + SDT_PROBE_DEFINE(prov, mod, func, name); \ + SDT_PROBE_ARGTYPE(prov, mod, func, name, 0, arg0) + +#define SDT_PROBE_DEFINE2(prov, mod, func, name, arg0, arg1) \ + SDT_PROBE_DEFINE(prov, mod, func, name); \ + SDT_PROBE_ARGTYPE(prov, mod, func, name, 0, arg0) \ + SDT_PROBE_ARGTYPE(prov, mod, func, name, 1, arg1) + +#define SDT_PROBE_DEFINE3(prov, mod, func, name, arg0, arg1, arg2) \ + SDT_PROBE_DEFINE(prov, mod, func, name); \ + SDT_PROBE_ARGTYPE(prov, mod, func, name, 0, arg0) \ + SDT_PROBE_ARGTYPE(prov, mod, func, name, 1, arg1) \ + SDT_PROBE_ARGTYPE(prov, mod, func, name, 2, arg2) + +#define SDT_PROBE_DEFINE4(prov, mod, func, name, arg0, arg1, arg2, arg3) \ + SDT_PROBE_DEFINE(prov, mod, func, name); \ + SDT_PROBE_ARGTYPE(prov, mod, func, name, 0, arg0) \ + SDT_PROBE_ARGTYPE(prov, mod, func, name, 1, arg1) \ + SDT_PROBE_ARGTYPE(prov, mod, func, name, 2, arg2) \ + SDT_PROBE_ARGTYPE(prov, mod, func, name, 3, arg3) + +#define SDT_PROBE_DEFINE5(prov, mod, func, name, arg0, arg1, arg2, arg3, arg4) \ + SDT_PROBE_DEFINE(prov, mod, func, name); \ + SDT_PROBE_ARGTYPE(prov, mod, func, name, 0, arg0) \ + SDT_PROBE_ARGTYPE(prov, mod, func, name, 1, arg1) \ + SDT_PROBE_ARGTYPE(prov, mod, func, name, 2, arg2) \ + SDT_PROBE_ARGTYPE(prov, mod, func, name, 3, arg3) \ + SDT_PROBE_ARGTYPE(prov, mod, func, name, 4, arg4) + typedef int (*sdt_argtype_listall_func_t)(struct sdt_argtype *, void *); typedef int (*sdt_probe_listall_func_t)(struct sdt_probe *, void *); typedef int (*sdt_provider_listall_func_t)(struct sdt_provider *, void *); From owner-svn-src-head@FreeBSD.ORG Tue Mar 3 17:34:10 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 44A4D1065677; Tue, 3 Mar 2009 17:34:10 +0000 (UTC) (envelope-from dchagin@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 321E68FC21; Tue, 3 Mar 2009 17:34:10 +0000 (UTC) (envelope-from dchagin@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 n23HYAWT017059; Tue, 3 Mar 2009 17:34:10 GMT (envelope-from dchagin@svn.freebsd.org) Received: (from dchagin@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n23HYATi017058; Tue, 3 Mar 2009 17:34:10 GMT (envelope-from dchagin@svn.freebsd.org) Message-Id: <200903031734.n23HYATi017058@svn.freebsd.org> From: Dmitry Chagin Date: Tue, 3 Mar 2009 17:34: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: r189313 - head/sys/kern X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Mar 2009 17:34:11 -0000 Author: dchagin Date: Tue Mar 3 17:34:09 2009 New Revision: 189313 URL: http://svn.freebsd.org/changeset/base/189313 Log: as suggested by jhb@, panic in case the ncpus == 0. it helps to catch bugs in the callers. Approved by: kib (mentor) MFC after: 5 days Modified: head/sys/kern/subr_smp.c Modified: head/sys/kern/subr_smp.c ============================================================================== --- head/sys/kern/subr_smp.c Tue Mar 3 17:16:26 2009 (r189312) +++ head/sys/kern/subr_smp.c Tue Mar 3 17:34:09 2009 (r189313) @@ -366,7 +366,7 @@ smp_rendezvous_cpus(cpumask_t map, if (((1 << i) & map) != 0 && !CPU_ABSENT(i)) ncpus++; if (ncpus == 0) - return; + panic("ncpus is 0 with map=0x%x", map); /* obtain rendezvous lock */ mtx_lock_spin(&smp_ipi_mtx); From owner-svn-src-head@FreeBSD.ORG Tue Mar 3 18:23: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 F07281065675; Tue, 3 Mar 2009 18:23:16 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C3BB88FC13; Tue, 3 Mar 2009 18:23:16 +0000 (UTC) (envelope-from rwatson@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 n23INGEO017986; Tue, 3 Mar 2009 18:23:16 GMT (envelope-from rwatson@svn.freebsd.org) Received: (from rwatson@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n23INGYU017985; Tue, 3 Mar 2009 18:23:16 GMT (envelope-from rwatson@svn.freebsd.org) Message-Id: <200903031823.n23INGYU017985@svn.freebsd.org> From: Robert Watson Date: Tue, 3 Mar 2009 18:23: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: r189314 - head/sys/sys X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Mar 2009 18:23:18 -0000 Author: rwatson Date: Tue Mar 3 18:23:16 2009 New Revision: 189314 URL: http://svn.freebsd.org/changeset/base/189314 Log: Adding missing ";"'s required by some SDT_PROBE_DEFINEx() macros. MFC after: 1 week Modified: head/sys/sys/sdt.h Modified: head/sys/sys/sdt.h ============================================================================== --- head/sys/sys/sdt.h Tue Mar 3 17:34:09 2009 (r189313) +++ head/sys/sys/sdt.h Tue Mar 3 18:23:16 2009 (r189314) @@ -168,28 +168,28 @@ struct sdt_provider { #define SDT_PROBE_DEFINE2(prov, mod, func, name, arg0, arg1) \ SDT_PROBE_DEFINE(prov, mod, func, name); \ - SDT_PROBE_ARGTYPE(prov, mod, func, name, 0, arg0) \ + SDT_PROBE_ARGTYPE(prov, mod, func, name, 0, arg0); \ SDT_PROBE_ARGTYPE(prov, mod, func, name, 1, arg1) #define SDT_PROBE_DEFINE3(prov, mod, func, name, arg0, arg1, arg2) \ SDT_PROBE_DEFINE(prov, mod, func, name); \ - SDT_PROBE_ARGTYPE(prov, mod, func, name, 0, arg0) \ - SDT_PROBE_ARGTYPE(prov, mod, func, name, 1, arg1) \ + SDT_PROBE_ARGTYPE(prov, mod, func, name, 0, arg0); \ + SDT_PROBE_ARGTYPE(prov, mod, func, name, 1, arg1); \ SDT_PROBE_ARGTYPE(prov, mod, func, name, 2, arg2) #define SDT_PROBE_DEFINE4(prov, mod, func, name, arg0, arg1, arg2, arg3) \ SDT_PROBE_DEFINE(prov, mod, func, name); \ - SDT_PROBE_ARGTYPE(prov, mod, func, name, 0, arg0) \ - SDT_PROBE_ARGTYPE(prov, mod, func, name, 1, arg1) \ - SDT_PROBE_ARGTYPE(prov, mod, func, name, 2, arg2) \ + SDT_PROBE_ARGTYPE(prov, mod, func, name, 0, arg0); \ + SDT_PROBE_ARGTYPE(prov, mod, func, name, 1, arg1); \ + SDT_PROBE_ARGTYPE(prov, mod, func, name, 2, arg2); \ SDT_PROBE_ARGTYPE(prov, mod, func, name, 3, arg3) #define SDT_PROBE_DEFINE5(prov, mod, func, name, arg0, arg1, arg2, arg3, arg4) \ SDT_PROBE_DEFINE(prov, mod, func, name); \ - SDT_PROBE_ARGTYPE(prov, mod, func, name, 0, arg0) \ - SDT_PROBE_ARGTYPE(prov, mod, func, name, 1, arg1) \ - SDT_PROBE_ARGTYPE(prov, mod, func, name, 2, arg2) \ - SDT_PROBE_ARGTYPE(prov, mod, func, name, 3, arg3) \ + SDT_PROBE_ARGTYPE(prov, mod, func, name, 0, arg0); \ + SDT_PROBE_ARGTYPE(prov, mod, func, name, 1, arg1); \ + SDT_PROBE_ARGTYPE(prov, mod, func, name, 2, arg2); \ + SDT_PROBE_ARGTYPE(prov, mod, func, name, 3, arg3); \ SDT_PROBE_ARGTYPE(prov, mod, func, name, 4, arg4) typedef int (*sdt_argtype_listall_func_t)(struct sdt_argtype *, void *); From owner-svn-src-head@FreeBSD.ORG Tue Mar 3 18:47: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 7F2DE106568C; Tue, 3 Mar 2009 18:47:33 +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 6D0028FC08; Tue, 3 Mar 2009 18:47:33 +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 n23IlXcr018457; Tue, 3 Mar 2009 18:47:33 GMT (envelope-from ed@svn.freebsd.org) Received: (from ed@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n23IlX7N018454; Tue, 3 Mar 2009 18:47:33 GMT (envelope-from ed@svn.freebsd.org) Message-Id: <200903031847.n23IlX7N018454@svn.freebsd.org> From: Ed Schouten Date: Tue, 3 Mar 2009 18:47: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: r189315 - in head/sys/netgraph: . atm 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, 03 Mar 2009 18:47:34 -0000 Author: ed Date: Tue Mar 3 18:47:33 2009 New Revision: 189315 URL: http://svn.freebsd.org/changeset/base/189315 Log: Make Netgraph compile with Clang. Clang disallows structs with variable length arrays to be nested inside other structs, because this is in violation with ISO C99. Even though we can keep bugging the LLVM folks about this issue, we'd better just fix our code to not do this. This code seems to be the only code in the entire source tree that does this. I haven't tested this patch by using the kernel modules in question, but Diane Bruce and I have compared disassembled versions of these kernel modules. We would have expected them to be exactly the same, but due to randomness in the register allocator and reordering of instructions, there were some minor differences. Approved by: julian Modified: head/sys/netgraph/atm/ng_ccatm.h head/sys/netgraph/ng_pppoe.c head/sys/netgraph/ng_pppoe.h Modified: head/sys/netgraph/atm/ng_ccatm.h ============================================================================== --- head/sys/netgraph/atm/ng_ccatm.h Tue Mar 3 18:23:16 2009 (r189314) +++ head/sys/netgraph/atm/ng_ccatm.h Tue Mar 3 18:47:33 2009 (r189315) @@ -166,7 +166,6 @@ struct ngm_ccatm_portlist { struct ccatm_op { uint32_t op; /* request code */ - u_char data[]; }; #endif Modified: head/sys/netgraph/ng_pppoe.c ============================================================================== --- head/sys/netgraph/ng_pppoe.c Tue Mar 3 18:23:16 2009 (r189314) +++ head/sys/netgraph/ng_pppoe.c Tue Mar 3 18:47:33 2009 (r189315) @@ -290,7 +290,7 @@ static int pppoe_send_event(sessp sp, en static __inline const struct pppoe_tag* next_tag(const struct pppoe_hdr* ph) { - return (const struct pppoe_tag*)(((const char*)&ph->tag[0]) + return (const struct pppoe_tag*)(((const char*)(ph + 1)) + ntohs(ph->length)); } @@ -303,7 +303,7 @@ static const struct pppoe_tag* get_tag(const struct pppoe_hdr* ph, uint16_t idx) { const char *const end = (const char *)next_tag(ph); - const struct pppoe_tag *pt = &ph->tag[0]; + const struct pppoe_tag *pt = (const void *)(ph + 1); const char *ptn; /* @@ -381,7 +381,7 @@ make_packet(sessp sp) { ("%s: called from wrong state", __func__)); CTR2(KTR_NET, "%20s: called %d", __func__, sp->Session_ID); - dp = (char *)wh->ph.tag; + dp = (char *)(&wh->ph + 1); for (count = 0, tag = sp->neg->tags; ((count < sp->neg->numtags) && (count < NUMTAGS)); tag++, count++) { @@ -434,12 +434,12 @@ pppoe_match_svc(node_p node, const struc if (neg->service_len != ntohs(tag->tag_len)) continue; - if (strncmp(tag->tag_data, neg->service.data, + if (strncmp((const char *)(tag + 1), neg->service.data, ntohs(tag->tag_len)) == 0) break; } CTR3(KTR_NET, "%20s: matched %p for %s", __func__, - sp?sp->hook:NULL, tag->tag_data); + sp?sp->hook:NULL, (const char *)(tag + 1)); return (sp?sp->hook:NULL); } @@ -583,7 +583,7 @@ pppoe_finduniq(node_p node, const struct hook_p hook = NULL; union uniq uniq; - bcopy(tag->tag_data, uniq.bytes, sizeof(void *)); + bcopy(tag + 1, uniq.bytes, sizeof(void *)); /* Cycle through all known hooks. */ LIST_FOREACH(hook, &node->nd_hooks, hk_hooks) { /* Skip any nonsession hook. */ @@ -1100,7 +1100,7 @@ send_acname(sessp sp, const struct pppoe sts = (struct ngpppoe_sts *)msg->data; tlen = min(NG_HOOKSIZ - 1, ntohs(tag->tag_len)); - strncpy(sts->hook, tag->tag_data, tlen); + strncpy(sts->hook, (const char *)(tag + 1), tlen); sts->hook[tlen] = '\0'; NG_SEND_MSG_ID(error, NG_HOOK_NODE(sp->hook), msg, sp->creator, 0); @@ -1438,7 +1438,8 @@ ng_pppoe_rcvdata_ether(hook_p hook, item break; } if (neg->ac_name_len != htons(tag->tag_len) || - strncmp(neg->ac_name.data, tag->tag_data, + strncmp(neg->ac_name.data, + (const char *)(tag + 1), neg->ac_name_len) != 0) { break; } @@ -1767,10 +1768,10 @@ ng_pppoe_disconnect(hook_p hook) * Add a General error message and adjust * sizes. */ - tag = wh->ph.tag; + tag = (void *)(&wh->ph + 1); tag->tag_type = PTT_GEN_ERR; tag->tag_len = htons((u_int16_t)msglen); - strncpy(tag->tag_data, SIGNOFF, msglen); + strncpy((char *)(tag + 1), SIGNOFF, msglen); m->m_pkthdr.len = (m->m_len += sizeof(*tag) + msglen); wh->ph.length = htons(sizeof(*tag) + msglen); @@ -1859,7 +1860,7 @@ scan_tags(sessp sp, const struct pppoe_h { const char *const end = (const char *)next_tag(ph); const char *ptn; - const struct pppoe_tag *pt = &ph->tag[0]; + const struct pppoe_tag *pt = (const void *)(ph + 1); /* * Keep processing tags while a tag header will still fit. Modified: head/sys/netgraph/ng_pppoe.h ============================================================================== --- head/sys/netgraph/ng_pppoe.h Tue Mar 3 18:23:16 2009 (r189314) +++ head/sys/netgraph/ng_pppoe.h Tue Mar 3 18:47:33 2009 (r189315) @@ -201,7 +201,6 @@ struct ngpppoe_sts { struct pppoe_tag { u_int16_t tag_type; u_int16_t tag_len; - char tag_data[]; }__packed; struct pppoe_hdr{ @@ -210,7 +209,6 @@ struct pppoe_hdr{ u_int8_t code; u_int16_t sid; u_int16_t length; - struct pppoe_tag tag[]; }__packed; From owner-svn-src-head@FreeBSD.ORG Tue Mar 3 18:53: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 6AE531065670; Tue, 3 Mar 2009 18:53:48 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 3F67D8FC08; Tue, 3 Mar 2009 18:53:48 +0000 (UTC) (envelope-from imp@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 n23IrmNa018619; Tue, 3 Mar 2009 18:53:48 GMT (envelope-from imp@svn.freebsd.org) Received: (from imp@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n23IrmuS018618; Tue, 3 Mar 2009 18:53:48 GMT (envelope-from imp@svn.freebsd.org) Message-Id: <200903031853.n23IrmuS018618@svn.freebsd.org> From: Warner Losh Date: Tue, 3 Mar 2009 18:53: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: r189316 - 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, 03 Mar 2009 18:53:49 -0000 Author: imp Date: Tue Mar 3 18:53:47 2009 New Revision: 189316 URL: http://svn.freebsd.org/changeset/base/189316 Log: Bump down the inline limit on MIPS. Modified: head/sys/conf/kern.mk Modified: head/sys/conf/kern.mk ============================================================================== --- head/sys/conf/kern.mk Tue Mar 3 18:47:33 2009 (r189315) +++ head/sys/conf/kern.mk Tue Mar 3 18:53:47 2009 (r189316) @@ -91,7 +91,7 @@ INLINE_LIMIT?= 15000 # .if ${MACHINE_ARCH} == "mips" CFLAGS+= -msoft-float -mno-dsp -INLINE_LIMIT?= 15000 +INLINE_LIMIT?= 8000 .endif # From owner-svn-src-head@FreeBSD.ORG Tue Mar 3 18:54: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 9F3B7106564A; Tue, 3 Mar 2009 18:54:57 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 8DFA88FC15; Tue, 3 Mar 2009 18:54:57 +0000 (UTC) (envelope-from imp@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 n23IsvFw018677; Tue, 3 Mar 2009 18:54:57 GMT (envelope-from imp@svn.freebsd.org) Received: (from imp@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n23Isvlh018676; Tue, 3 Mar 2009 18:54:57 GMT (envelope-from imp@svn.freebsd.org) Message-Id: <200903031854.n23Isvlh018676@svn.freebsd.org> From: Warner Losh Date: Tue, 3 Mar 2009 18:54: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: r189317 - head/sys/pci 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, 03 Mar 2009 18:54:58 -0000 Author: imp Date: Tue Mar 3 18:54:57 2009 New Revision: 189317 URL: http://svn.freebsd.org/changeset/base/189317 Log: The callback takes a void *, not a caddr_t * (sic). Except for the bb callback, which takes a caddr_t and not a caddr_t *. Modified: head/sys/pci/viapm.c Modified: head/sys/pci/viapm.c ============================================================================== --- head/sys/pci/viapm.c Tue Mar 3 18:53:47 2009 (r189316) +++ head/sys/pci/viapm.c Tue Mar 3 18:54:57 2009 (r189317) @@ -484,7 +484,7 @@ viapm_pro_detach(device_t dev) } static int -viabb_callback(device_t dev, int index, caddr_t *data) +viabb_callback(device_t dev, int index, caddr_t data) { return 0; } @@ -641,7 +641,7 @@ viapm_wait(struct viapm_softc *viapm) } static int -viasmb_callback(device_t dev, int index, caddr_t *data) +viasmb_callback(device_t dev, int index, void *data) { int error = 0; From owner-svn-src-head@FreeBSD.ORG Tue Mar 3 18:57: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 7A4611065686; Tue, 3 Mar 2009 18:57:59 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 68EE78FC2D; Tue, 3 Mar 2009 18:57:59 +0000 (UTC) (envelope-from imp@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 n23IvxPF018857; Tue, 3 Mar 2009 18:57:59 GMT (envelope-from imp@svn.freebsd.org) Received: (from imp@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n23IvxYj018854; Tue, 3 Mar 2009 18:57:59 GMT (envelope-from imp@svn.freebsd.org) Message-Id: <200903031857.n23IvxYj018854@svn.freebsd.org> From: Warner Losh Date: Tue, 3 Mar 2009 18:57: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: r189318 - head/sys/dev/pccard 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, 03 Mar 2009 18:58:00 -0000 Author: imp Date: Tue Mar 3 18:57:59 2009 New Revision: 189318 URL: http://svn.freebsd.org/changeset/base/189318 Log: Add in parsing of the disk FUNCE tuples. Modified: head/sys/dev/pccard/pccard.c head/sys/dev/pccard/pccardvar.h head/sys/dev/pccard/pccardvarp.h Modified: head/sys/dev/pccard/pccard.c ============================================================================== --- head/sys/dev/pccard/pccard.c Tue Mar 3 18:54:57 2009 (r189317) +++ head/sys/dev/pccard/pccard.c Tue Mar 3 18:57:59 2009 (r189318) @@ -1066,6 +1066,10 @@ pccard_read_ivar(device_t bus, device_t switch (which) { default: return (EINVAL); + case PCCARD_IVAR_FUNCE_DISK: + *(uint16_t *)result = pf->pf_funce_disk_interface | + (pf->pf_funce_disk_power << 8); + break; case PCCARD_IVAR_ETHADDR: bcopy(pf->pf_funce_lan_nid, result, ETHER_ADDR_LEN); break; Modified: head/sys/dev/pccard/pccardvar.h ============================================================================== --- head/sys/dev/pccard/pccardvar.h Tue Mar 3 18:54:57 2009 (r189317) +++ head/sys/dev/pccard/pccardvar.h Tue Mar 3 18:57:59 2009 (r189318) @@ -194,7 +194,8 @@ enum { PCCARD_IVAR_PRODUCT_STR,/* CIS strnig for "Product" */ PCCARD_IVAR_CIS3_STR, PCCARD_IVAR_CIS4_STR, - PCCARD_IVAR_FUNCTION + PCCARD_IVAR_FUNCTION, + PCCARD_IVAR_FUNCE_DISK }; #define PCCARD_ACCESSOR(A, B, T) \ @@ -211,6 +212,7 @@ PCCARD_ACCESSOR(product, PRODUCT, uint3 PCCARD_ACCESSOR(prodext, PRODEXT, uint16_t) PCCARD_ACCESSOR(function_number,FUNCTION_NUMBER, uint32_t) PCCARD_ACCESSOR(function, FUNCTION, uint32_t) +PCCARD_ACCESSOR(funce_disk, FUNCE_DISK, uint16_t) PCCARD_ACCESSOR(vendor_str, VENDOR_STR, const char *) PCCARD_ACCESSOR(product_str, PRODUCT_STR, const char *) PCCARD_ACCESSOR(cis3_str, CIS3_STR, const char *) @@ -250,3 +252,23 @@ enum { { NULL, PCMCIA_VENDOR_ ## v1, PCCARD_P(v1, p1), \ PCMCIA_CIS_ ## p2} #endif + +/* + * Defines to decoe the get_funce_disk return value. See the PCMCIA standard + * for all the details of what these bits mean. + */ +#define PFD_I_V_MASK 0x3 +#define PFD_I_V_NONE_REQUIRED 0x0 +#define PFD_I_V_REQ_MOD_ACC 0x1 +#define PFD_I_V_REQ_ACC 0x2 +#define PFD_I_V_REQ_ALWYS 0x1 +#define PFD_I_S 0x4 /* 0 rotating, 1 silicon */ +#define PFD_I_U 0x8 /* SN Uniq? */ +#define PFD_I_D 0x10 /* 0 - 1 drive, 1 - 2 drives */ +#define PFD_P_P0 0x100 +#define PFD_P_P1 0x200 +#define PFD_P_P2 0x400 +#define PFD_P_P3 0x800 +#define PFD_P_N 0x1000 /* 3f7/377 excluded? */ +#define PFD_P_E 0x2000 /* Index bit supported? */ +#define PFD_P_I 0x4000 /* twincard */ Modified: head/sys/dev/pccard/pccardvarp.h ============================================================================== --- head/sys/dev/pccard/pccardvarp.h Tue Mar 3 18:54:57 2009 (r189317) +++ head/sys/dev/pccard/pccardvarp.h Tue Mar 3 18:57:59 2009 (r189318) @@ -76,22 +76,7 @@ struct pccard_config_entry { struct pccard_funce_disk { uint8_t pfd_interface; -#define PFD_I_V_MASK 0x3 -#define PFD_I_V_NONE_REQUIRED 0x0 -#define PFD_I_V_REQ_MOD_ACC 0x1 -#define PFD_I_V_REQ_ACC 0x2 -#define PFD_I_V_REQ_ALWYS 0x1 -#define PFD_I_S 0x4 /* 0 rotating, 1 silicon */ -#define PFD_I_U 0x8 /* SN Uniq? */ -#define PFD_I_D 0x10 /* 0 - 1 drive, 1 - 2 drives */ uint8_t pfd_power; -#define PFD_P_P0 0x1 -#define PFD_P_P1 0x2 -#define PFD_P_P2 0x4 -#define PFD_P_P3 0x8 -#define PFD_P_N 0x10 /* 3f7/377 excluded? */ -#define PFD_P_E 0x20 /* Index bit supported? */ -#define PFD_P_I 0x40 /* twincard */ }; struct pccard_funce_lan { From owner-svn-src-head@FreeBSD.ORG Tue Mar 3 19:22:25 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 0196A1065670; Tue, 3 Mar 2009 19:22:25 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 96ABA8FC18; Tue, 3 Mar 2009 19:22:24 +0000 (UTC) (envelope-from imp@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 n23JMO1V019363; Tue, 3 Mar 2009 19:22:24 GMT (envelope-from imp@svn.freebsd.org) Received: (from imp@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n23JMO1P019362; Tue, 3 Mar 2009 19:22:24 GMT (envelope-from imp@svn.freebsd.org) Message-Id: <200903031922.n23JMO1P019362@svn.freebsd.org> From: Warner Losh Date: Tue, 3 Mar 2009 19:22:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r189319 - head/sys/mips/mips X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Mar 2009 19:22:26 -0000 Author: imp Date: Tue Mar 3 19:22:24 2009 New Revision: 189319 URL: http://svn.freebsd.org/changeset/base/189319 Log: make loop clearer that it isn't a mistake... Modified: head/sys/mips/mips/pmap.c Modified: head/sys/mips/mips/pmap.c ============================================================================== --- head/sys/mips/mips/pmap.c Tue Mar 3 18:57:59 2009 (r189318) +++ head/sys/mips/mips/pmap.c Tue Mar 3 19:22:24 2009 (r189319) @@ -409,7 +409,8 @@ again: kernel_segmap[j] = (pd_entry_t)(pgtab + (i * NPTEPG)); avail_start = phys_avail[0]; - for (i = 0; phys_avail[i + 2]; i += 2); + for (i = 0; phys_avail[i + 2]; i += 2) + continue; avail_end = phys_avail[i + 1]; /* From owner-svn-src-head@FreeBSD.ORG Tue Mar 3 19:38: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 3CE45106564A; Tue, 3 Mar 2009 19:38:57 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 2B40C8FC14; Tue, 3 Mar 2009 19:38:57 +0000 (UTC) (envelope-from bz@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 n23Jcugm019695; Tue, 3 Mar 2009 19:38:56 GMT (envelope-from bz@svn.freebsd.org) Received: (from bz@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n23Jcur7019694; Tue, 3 Mar 2009 19:38:56 GMT (envelope-from bz@svn.freebsd.org) Message-Id: <200903031938.n23Jcur7019694@svn.freebsd.org> From: "Bjoern A. Zeeb" Date: Tue, 3 Mar 2009 19:38:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r189320 - head/sys/sys X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Mar 2009 19:38:57 -0000 Author: bz Date: Tue Mar 3 19:38:56 2009 New Revision: 189320 URL: http://svn.freebsd.org/changeset/base/189320 Log: For the moment disable the VIMAGE_CTASSERTs as people have trouble while developing and compiling with kernel options that change the size of at least one structure. The current kernel build framework does not allow us to pass -Dxxx to module builds so we would possibly need a kernel option to disable the checks and that might not work for people just building modules alone. For now they helped to identify possibly API problems and bring those back into minds of developers seeking for better solutions. Problems reported by: kib, warner Reviewed by: warner Modified: head/sys/sys/vimage.h Modified: head/sys/sys/vimage.h ============================================================================== --- head/sys/sys/vimage.h Tue Mar 3 19:22:24 2009 (r189319) +++ head/sys/sys/vimage.h Tue Mar 3 19:38:56 2009 (r189320) @@ -224,6 +224,7 @@ void vnet_mod_register(const struct vnet * But as CTASSERT_EQUAL() needs special compile time options, we * want the default case to be backed by CTASSERT(). */ +#if 0 #ifndef VIMAGE_CTASSERT #ifdef VIMAGE_CHECK_SIZES #define VIMAGE_CTASSERT(x, y) \ @@ -234,5 +235,8 @@ void vnet_mod_register(const struct vnet CTASSERT(x == 0 || x == y) #endif #endif +#else +#define VIMAGE_CTASSERT(x, y) struct __hack +#endif #endif /* !_SYS_VIMAGE_H_ */ From owner-svn-src-head@FreeBSD.ORG Tue Mar 3 19:47: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 E2CF9106564A for ; Tue, 3 Mar 2009 19:47:30 +0000 (UTC) (envelope-from kabaev@gmail.com) Received: from qw-out-2122.google.com (qw-out-2122.google.com [74.125.92.27]) by mx1.freebsd.org (Postfix) with ESMTP id 928B48FC1E for ; Tue, 3 Mar 2009 19:47:30 +0000 (UTC) (envelope-from kabaev@gmail.com) Received: by qw-out-2122.google.com with SMTP id 3so2381569qwe.7 for ; Tue, 03 Mar 2009 11:47:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:date:from:to:cc:subject :message-id:in-reply-to:references:x-mailer:mime-version :content-type; bh=Zh33woNqK+dc5EL8RFfyNAPX8K0D9acuNUAnC8w9ozY=; b=i4TBHX6JhinDcjzIQnsILtvbTOstH0JDO2d991q4p18JBVcw2j1h0ku0llDmdyvZ/C 2eNdwK3lPQX2nDDrvx5nYpWS2FHbt/rG3i2JSJOOiU9ta8Cn6dWA2Lz984qiug3GZzV4 NycZdBM16qsoxoFhER1nGOS6+/DQSVloLBRg8= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=date:from:to:cc:subject:message-id:in-reply-to:references:x-mailer :mime-version:content-type; b=TH08AJTZEkgL8lrPSgyQZG2mKGXv6lsVqUIVNlE8n/iFtV+E/5ZRqpJMLOjnj2jmKK HHz81J+cV7DBLm5OcKrmVX0OWSVAftQiL/iZK9+ugveLAVJFby702JpD3dKmRLFYfXzQ o0l2YZ+D0SUZ2X6ZRT/r3siNNMBd4RGdOavdA= Received: by 10.224.74.9 with SMTP id s9mr10177063qaj.321.1236108075346; Tue, 03 Mar 2009 11:21:15 -0800 (PST) Received: from kan.dnsalias.net (c-98-217-224-113.hsd1.ma.comcast.net [98.217.224.113]) by mx.google.com with ESMTPS id 8sm235906qwj.46.2009.03.03.11.21.11 (version=SSLv3 cipher=RC4-MD5); Tue, 03 Mar 2009 11:21:13 -0800 (PST) Date: Tue, 3 Mar 2009 14:21:06 -0500 From: Alexander Kabaev To: Ed Schouten Message-ID: <20090303142106.0ee73d35@kan.dnsalias.net> In-Reply-To: <200903031847.n23IlX7N018454@svn.freebsd.org> References: <200903031847.n23IlX7N018454@svn.freebsd.org> X-Mailer: Claws Mail 3.5.0 (GTK+ 2.12.11; i386-portbld-freebsd8.0) Mime-Version: 1.0 Content-Type: multipart/signed; boundary="Sig_/XA3xMmQCB9EVQono.sATloK"; protocol="application/pgp-signature"; micalg=PGP-SHA1 Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r189315 - in head/sys/netgraph: . atm 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, 03 Mar 2009 19:47:31 -0000 --Sig_/XA3xMmQCB9EVQono.sATloK Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable On Tue, 3 Mar 2009 18:47:33 +0000 (UTC) Ed Schouten wrote: > Author: ed > Date: Tue Mar 3 18:47:33 2009 > New Revision: 189315 > URL: http://svn.freebsd.org/changeset/base/189315 >=20 > Log: > Make Netgraph compile with Clang. > =20 > Clang disallows structs with variable length arrays to be nested > inside other structs, because this is in violation with ISO C99. Even > though we can keep bugging the LLVM folks about this issue, we'd > better just fix our code to not do this. This code seems to be the > only code in the entire source tree that does this. > =20 > I haven't tested this patch by using the kernel modules in > question, but Diane Bruce and I have compared disassembled versions > of these kernel modules. We would have expected them to be exactly > the same, but due to randomness in the register allocator and > reordering of instructions, there were some minor differences. > =20 > Approved by: julian >=20 > Modified: > head/sys/netgraph/atm/ng_ccatm.h > head/sys/netgraph/ng_pppoe.c > head/sys/netgraph/ng_pppoe.h Hi, I hope I am not the only one to see this as a code regression from the code readability viewpoint. I think obfuscation of our sources just to bow to yet another head-strong compiler should stop. If LLVM cannot parse common code constructs, LLVM is NOT suitable for our kernel no matter how many paragraphs of language-lawyer-speak they use to justify it.=20 --=20 Alexander Kabaev --Sig_/XA3xMmQCB9EVQono.sATloK Content-Type: application/pgp-signature; name=signature.asc Content-Disposition: attachment; filename=signature.asc -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (FreeBSD) iD8DBQFJrYMiQ6z1jMm+XZYRAm/UAJ9WsPSwAv+tXFp087qPla64M+IXbgCgg9iN GxYKPlhQKOsp9fZG1eGQXIM= =/7ko -----END PGP SIGNATURE----- --Sig_/XA3xMmQCB9EVQono.sATloK-- From owner-svn-src-head@FreeBSD.ORG Tue Mar 3 19:58: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 5A5B1106566C; Tue, 3 Mar 2009 19:58:23 +0000 (UTC) (envelope-from kabaev@gmail.com) Received: from yx-out-2324.google.com (yx-out-2324.google.com [74.125.44.29]) by mx1.freebsd.org (Postfix) with ESMTP id C40A78FC15; Tue, 3 Mar 2009 19:58:22 +0000 (UTC) (envelope-from kabaev@gmail.com) Received: by yx-out-2324.google.com with SMTP id 31so1629732yxl.13 for ; Tue, 03 Mar 2009 11:58:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:date:from:to:cc:subject :message-id:in-reply-to:references:x-mailer:mime-version :content-type; bh=dUwypTS67hA70Sa7qVcXMooSoInWPDxVQEOIJSopvtw=; b=JMNwdLenbbamCQvDUWsTPxM4K0mGN1OVQRUk9/3WOiFAmBUG0XT5+yD4Y+kIsAas3N sOILLG08bTKyYrhOhIwHMF3C/fWGQwJ52ylbLOcMFYD9rMoBNnT3GYSLaFB1gMQ+qpzV AOVRLQvYgu/jglhIawmNJwKLKdl+WxjW7Ur5s= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=date:from:to:cc:subject:message-id:in-reply-to:references:x-mailer :mime-version:content-type; b=xxHrOeThcNOM8yKt+5KJV9DZnQNml443jyN6+HOWEwXvvlAIE9PGnR/AeXawLTJaED XYns4+kGWv8XUc3wiUeq5PdC/NyRBksdem5vsCpcWd28b1Ww7GuzyJEEqFVvJxBJs6ED 9raolUgt+mQ91mz23AdZkr39NeMNg4PgQS0rc= Received: by 10.150.135.2 with SMTP id i2mr13111796ybd.26.1236110301705; Tue, 03 Mar 2009 11:58:21 -0800 (PST) Received: from kan.dnsalias.net (c-98-217-224-113.hsd1.ma.comcast.net [98.217.224.113]) by mx.google.com with ESMTPS id n29sm20444557elf.10.2009.03.03.11.58.16 (version=SSLv3 cipher=RC4-MD5); Tue, 03 Mar 2009 11:58:19 -0800 (PST) Date: Tue, 3 Mar 2009 14:57:58 -0500 From: Alexander Kabaev To: Alexander Kabaev Message-ID: <20090303145758.47cb8740@kan.dnsalias.net> In-Reply-To: <20090303142106.0ee73d35@kan.dnsalias.net> References: <200903031847.n23IlX7N018454@svn.freebsd.org> <20090303142106.0ee73d35@kan.dnsalias.net> X-Mailer: Claws Mail 3.5.0 (GTK+ 2.12.11; i386-portbld-freebsd8.0) Mime-Version: 1.0 Content-Type: multipart/signed; boundary="Sig_/AcXEjVEgrmQ/l=F0NBhsyaz"; protocol="application/pgp-signature"; micalg=PGP-SHA1 Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Ed Schouten Subject: Re: svn commit: r189315 - in head/sys/netgraph: . atm 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, 03 Mar 2009 19:58:24 -0000 --Sig_/AcXEjVEgrmQ/l=F0NBhsyaz Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable On Tue, 3 Mar 2009 14:21:06 -0500 Alexander Kabaev wrote: Responding to myself: after looking at the original code, I think we traded one pre-existing ugliness for another, with latter being more standards compliant, so my objection is withdrawn. Apologies for the noise. --=20 Alexander Kabaev --Sig_/AcXEjVEgrmQ/l=F0NBhsyaz Content-Type: application/pgp-signature; name=signature.asc Content-Disposition: attachment; filename=signature.asc -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (FreeBSD) iD8DBQFJrYvGQ6z1jMm+XZYRApe3AKDWUKpieeSau7urQgmyzr9XrYKE4gCglkVN XTuxEt7/1P8ZCCiCAuF0JIw= =aUnA -----END PGP SIGNATURE----- --Sig_/AcXEjVEgrmQ/l=F0NBhsyaz-- From owner-svn-src-head@FreeBSD.ORG Tue Mar 3 20:30: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 B0F39106564A; Tue, 3 Mar 2009 20:30:23 +0000 (UTC) (envelope-from ed@hoeg.nl) Received: from palm.hoeg.nl (mx0.hoeg.nl [IPv6:2001:7b8:613:100::211]) by mx1.freebsd.org (Postfix) with ESMTP id 4B5748FC12; Tue, 3 Mar 2009 20:30:23 +0000 (UTC) (envelope-from ed@hoeg.nl) Received: by palm.hoeg.nl (Postfix, from userid 1000) id 83FA61CDD2; Tue, 3 Mar 2009 21:30:22 +0100 (CET) Date: Tue, 3 Mar 2009 21:30:22 +0100 From: Ed Schouten To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Message-ID: <20090303203022.GX19161@hoeg.nl> References: <200903031847.n23IlX7N018454@svn.freebsd.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="fYgRtaZIy+F1uhp1" Content-Disposition: inline In-Reply-To: <200903031847.n23IlX7N018454@svn.freebsd.org> User-Agent: Mutt/1.5.19 (2009-01-05) Cc: Subject: Re: svn commit: r189315 - in head/sys/netgraph: . atm 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, 03 Mar 2009 20:30:24 -0000 --fYgRtaZIy+F1uhp1 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hi all, You should now be able to compile all of LINT on amd64 using Clang! Happy hacking! --=20 Ed Schouten WWW: http://80386.nl/ --fYgRtaZIy+F1uhp1 Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (FreeBSD) iEYEARECAAYFAkmtk14ACgkQ52SDGA2eCwU5bwCdE1NjWkpTphLOFjWRX9ffB0Wn N8UAnjHW8ILMYIqTJWTtki+opN8+YZOK =cfn7 -----END PGP SIGNATURE----- --fYgRtaZIy+F1uhp1-- From owner-svn-src-head@FreeBSD.ORG Wed Mar 4 00:05:40 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 BE95F106566C; Wed, 4 Mar 2009 00:05:40 +0000 (UTC) (envelope-from davidch@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id AA8F68FC14; Wed, 4 Mar 2009 00:05:40 +0000 (UTC) (envelope-from davidch@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 n2405eK9024965; Wed, 4 Mar 2009 00:05:40 GMT (envelope-from davidch@svn.freebsd.org) Received: (from davidch@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n2405eLx024962; Wed, 4 Mar 2009 00:05:40 GMT (envelope-from davidch@svn.freebsd.org) Message-Id: <200903040005.n2405eLx024962@svn.freebsd.org> From: David Christensen Date: Wed, 4 Mar 2009 00:05:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r189325 - head/sys/dev/bce 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, 04 Mar 2009 00:05:41 -0000 Author: davidch Date: Wed Mar 4 00:05:40 2009 New Revision: 189325 URL: http://svn.freebsd.org/changeset/base/189325 Log: - Updated firmware to latest 4.6.X release. - Added missing firmware for 5709 A1 controllers. - Changed some debug statistic variable names to be more consistent. Submitted by: davidch MFC after: Two weeks Modified: head/sys/dev/bce/if_bce.c head/sys/dev/bce/if_bcefw.h head/sys/dev/bce/if_bcereg.h Modified: head/sys/dev/bce/if_bce.c ============================================================================== --- head/sys/dev/bce/if_bce.c Tue Mar 3 21:45:47 2009 (r189324) +++ head/sys/dev/bce/if_bce.c Wed Mar 4 00:05:40 2009 (r189325) @@ -38,7 +38,7 @@ __FBSDID("$FreeBSD$"); * BCM5708C B1, B2 * BCM5708S B1, B2 * BCM5709C A1, C0 - * BCM5716 C0 + * BCM5716C C0 * * The following controllers are not supported by this driver: * BCM5706C A0, A1 (pre-production) @@ -71,19 +71,19 @@ __FBSDID("$FreeBSD$"); /* 1073741824 = 1 in 2 */ /* Controls how often the l2_fhdr frame error check will fail. */ - int bce_debug_l2fhdr_status_check = 0; + int l2fhdr_error_sim_control = 0; /* Controls how often the unexpected attention check will fail. */ - int bce_debug_unexpected_attention = 0; + int unexpected_attention_sim_control = 0; /* Controls how often to simulate an mbuf allocation failure. */ - int bce_debug_mbuf_allocation_failure = 0; + int mbuf_alloc_failed_sim_control = 0; /* Controls how often to simulate a DMA mapping failure. */ - int bce_debug_dma_map_addr_failure = 0; + int dma_map_addr_failed_sim_control = 0; /* Controls how often to simulate a bootcode failure. */ - int bce_debug_bootcode_running_failure = 0; + int bootcode_running_failure_sim_control = 0; #endif /****************************************************************************/ @@ -495,7 +495,8 @@ SYSCTL_UINT(_hw_bce, OID_AUTO, msi_enabl /* ToDo: Add tunable to enable/disable strict MTU handling. */ /* Currently allows "loose" RX MTU checking (i.e. sets the */ /* H/W RX MTU to the size of the largest receive buffer, or */ -/* 2048 bytes). */ +/* 2048 bytes). This will cause a UNH failure but is more */ +/* desireable from a functional perspective. */ /****************************************************************************/ @@ -595,7 +596,7 @@ bce_print_adapter_info(struct bce_softc } /* Firmware version and device features. */ - printf("F/W (0x%08X); Flags( ", sc->bce_fw_ver); + printf("B/C (0x%08X); Flags( ", sc->bce_bc_ver); #ifdef ZERO_COPY_SOCKETS printf("SPLT "); #endif @@ -846,7 +847,7 @@ bce_attach(device_t dev) __FUNCTION__, sc->bce_shmem_base); /* Fetch the bootcode revision. */ - sc->bce_fw_ver = REG_RD_IND(sc, sc->bce_shmem_base + + sc->bce_bc_ver = REG_RD_IND(sc, sc->bce_shmem_base + BCE_DEV_INFO_BC_REV); /* Check if any management firmware is running. */ @@ -2863,20 +2864,16 @@ bce_dma_map_addr(void *arg, bus_dma_segm bus_addr_t *busaddr = arg; /* Simulate a mapping failure. */ - DBRUNIF(DB_RANDOMTRUE(bce_debug_dma_map_addr_failure), - printf("bce: %s(%d): Simulating DMA mapping error.\n", - __FILE__, __LINE__); + DBRUNIF(DB_RANDOMTRUE(dma_map_addr_failed_sim_control), error = ENOMEM); /* Check for an error and signal the caller that an error occurred. */ if (error) { - printf("bce %s(%d): DMA mapping error! error = %d, " - "nseg = %d\n", __FILE__, __LINE__, error, nseg); *busaddr = 0; - return; + } else { + *busaddr = segs->ds_addr; } - *busaddr = segs->ds_addr; return; } @@ -3272,6 +3269,11 @@ bce_dma_alloc(device_t dev) #else max_size = max_seg_size = MJUM9BYTES; #endif + max_segments = 1; + + DBPRINT(sc, BCE_INFO, "%s(): Creating rx_mbuf_tag (max size = 0x%jX " + "max segments = %d, max segment size = 0x%jX)\n", __FUNCTION__, + (uintmax_t) max_size, max_segments, (uintmax_t) max_seg_size); if (bus_dma_tag_create(sc->parent_tag, 1, @@ -3280,7 +3282,7 @@ bce_dma_alloc(device_t dev) BUS_SPACE_MAXADDR, NULL, NULL, max_size, - 1, + max_segments, max_seg_size, 0, NULL, NULL, @@ -4156,15 +4158,24 @@ bce_init_cpus(struct bce_softc *sc) if ((BCE_CHIP_NUM(sc) == BCE_CHIP_NUM_5709) || (BCE_CHIP_NUM(sc) == BCE_CHIP_NUM_5716)) { - bce_load_rv2p_fw(sc, bce_xi_rv2p_proc1, sizeof(bce_xi_rv2p_proc1), - RV2P_PROC1); - bce_load_rv2p_fw(sc, bce_xi_rv2p_proc2, sizeof(bce_xi_rv2p_proc2), - RV2P_PROC2); + + if ((BCE_CHIP_REV(sc) == BCE_CHIP_REV_Ax)) { + bce_load_rv2p_fw(sc, bce_xi90_rv2p_proc1, + sizeof(bce_xi90_rv2p_proc1), RV2P_PROC1); + bce_load_rv2p_fw(sc, bce_xi90_rv2p_proc2, + sizeof(bce_xi90_rv2p_proc2), RV2P_PROC2); + } else { + bce_load_rv2p_fw(sc, bce_xi_rv2p_proc1, + sizeof(bce_xi_rv2p_proc1), RV2P_PROC1); + bce_load_rv2p_fw(sc, bce_xi_rv2p_proc2, + sizeof(bce_xi_rv2p_proc2), RV2P_PROC2); + } + } else { - bce_load_rv2p_fw(sc, bce_rv2p_proc1, sizeof(bce_rv2p_proc1), - RV2P_PROC1); - bce_load_rv2p_fw(sc, bce_rv2p_proc2, sizeof(bce_rv2p_proc2), - RV2P_PROC2); + bce_load_rv2p_fw(sc, bce_rv2p_proc1, + sizeof(bce_rv2p_proc1), RV2P_PROC1); + bce_load_rv2p_fw(sc, bce_rv2p_proc2, + sizeof(bce_rv2p_proc2), RV2P_PROC2); } bce_init_rxp_cpu(sc); @@ -4727,7 +4738,7 @@ bce_blockinit(struct bce_softc *sc) /* Verify that bootcode is running. */ reg = REG_RD_IND(sc, sc->bce_shmem_base + BCE_DEV_INFO_SIGNATURE); - DBRUNIF(DB_RANDOMTRUE(bce_debug_bootcode_running_failure), + DBRUNIF(DB_RANDOMTRUE(bootcode_running_failure_sim_control), BCE_PRINTF("%s(%d): Simulating bootcode failure.\n", __FILE__, __LINE__); reg = 0); @@ -4814,9 +4825,9 @@ bce_get_rx_buf(struct bce_softc *sc, str if (m == NULL) { /* Simulate an mbuf allocation failure. */ - DBRUNIF(DB_RANDOMTRUE(bce_debug_mbuf_allocation_failure), - sc->mbuf_alloc_failed++; - sc->debug_mbuf_sim_alloc_failed++; + DBRUNIF(DB_RANDOMTRUE(mbuf_alloc_failed_sim_control), + sc->mbuf_alloc_failed_count++; + sc->mbuf_alloc_failed_sim_count++; rc = ENOBUFS; goto bce_get_rx_buf_exit); @@ -4831,7 +4842,7 @@ bce_get_rx_buf(struct bce_softc *sc, str #endif if (m_new == NULL) { - sc->mbuf_alloc_failed++; + sc->mbuf_alloc_failed_count++; rc = ENOBUFS; goto bce_get_rx_buf_exit; } @@ -4861,7 +4872,9 @@ bce_get_rx_buf(struct bce_softc *sc, str BCE_PRINTF("%s(%d): Error mapping mbuf into RX chain (%d)!\n", __FILE__, __LINE__, error); + sc->dma_map_addr_rx_failed_count++; m_freem(m_new); + DBRUN(sc->debug_rx_mbuf_alloc--); rc = ENOBUFS; @@ -4939,16 +4952,16 @@ bce_get_pg_buf(struct bce_softc *sc, str if (m == NULL) { /* Simulate an mbuf allocation failure. */ - DBRUNIF(DB_RANDOMTRUE(bce_debug_mbuf_allocation_failure), - sc->mbuf_alloc_failed++; - sc->debug_mbuf_sim_alloc_failed++; + DBRUNIF(DB_RANDOMTRUE(mbuf_alloc_failed_sim_control), + sc->mbuf_alloc_failed_count++; + sc->mbuf_alloc_failed_sim_count++; rc = ENOBUFS; goto bce_get_pg_buf_exit); /* This is a new mbuf allocation. */ m_new = m_getcl(M_DONTWAIT, MT_DATA, 0); if (m_new == NULL) { - sc->mbuf_alloc_failed++; + sc->mbuf_alloc_failed_count++; rc = ENOBUFS; goto bce_get_pg_buf_exit; } @@ -5766,20 +5779,20 @@ bce_rx_intr(struct bce_softc *sc) sc->free_rx_bd++; /* - * Frames received on the NetXteme II are prepended - * with an l2_fhdr structure which provides status - * information about the received frame (including - * VLAN tags and checksum info). The frames are also - * automatically adjusted to align the IP header - * (i.e. two null bytes are inserted before the - * Ethernet header). As a result the data DMA'd by - * the controller into the mbuf is as follows: + * Frames received on the NetXteme II are prepended with an + * l2_fhdr structure which provides status information about + * the received frame (including VLAN tags and checksum info). + * The frames are also automatically adjusted to align the IP + * header (i.e. two null bytes are inserted before the Ethernet + * header). As a result the data DMA'd by the controller into + * the mbuf is as follows: + * * +---------+-----+---------------------+-----+ * | l2_fhdr | pad | packet data | FCS | * +---------+-----+---------------------+-----+ - * The l2_fhdr needs to be checked and skipped and - * the FCS needs to be stripped before sending the - * packet up the stack. + * + * The l2_fhdr needs to be checked and skipped and the FCS needs + * to be stripped before sending the packet up the stack. */ l2fhdr = mtod(m0, struct l2_fhdr *); @@ -5894,8 +5907,9 @@ bce_rx_intr(struct bce_softc *sc) BCE_PRINTF("Invalid Ethernet frame size!\n"); m_print(m0, 128)); - DBRUNIF(DB_RANDOMTRUE(bce_debug_l2fhdr_status_check), + DBRUNIF(DB_RANDOMTRUE(l2fhdr_error_sim_control), BCE_PRINTF("Simulating l2_fhdr status error.\n"); + sc->l2fhdr_error_sim_count++; status = status | L2_FHDR_ERRORS_PHY_DECODE); /* Check the received frame for errors. */ @@ -5905,7 +5919,7 @@ bce_rx_intr(struct bce_softc *sc) /* Log the error and release the mbuf. */ ifp->if_ierrors++; - DBRUN(sc->l2fhdr_status_errors++); + sc->l2fhdr_error_count++; m_freem(m0); m0 = NULL; @@ -5946,10 +5960,7 @@ bce_rx_intr(struct bce_softc *sc) } } - /* - * If we received a packet with a vlan tag, - * attach that information to the packet. - */ + /* Attach the VLAN tag. */ if (status & L2_FHDR_STATUS_L2_VLAN_TAG) { #if __FreeBSD_version < 700000 VLAN_INPUT_TAG(ifp, m0, l2fhdr->l2_fhdr_vlan_tag, continue); @@ -5959,7 +5970,7 @@ bce_rx_intr(struct bce_softc *sc) #endif } - /* Pass the mbuf off to the upper layers. */ + /* Increment received packet statistics. */ ifp->if_ipackets++; bce_rx_int_next_rx: @@ -6273,14 +6284,17 @@ bce_init_locked(struct bce_softc *sc) DBPRINT(sc, BCE_INFO_LOAD, "%s(): rx_bd_mbuf_alloc_size = %d, rx_bce_mbuf_data_len = %d, " - "rx_bd_mbuf_align_pad = %d, pg_bd_mbuf_alloc_size = %d\n", - __FUNCTION__, sc->rx_bd_mbuf_alloc_size, sc->rx_bd_mbuf_data_len, - sc->rx_bd_mbuf_align_pad, sc->pg_bd_mbuf_alloc_size); + "rx_bd_mbuf_align_pad = %d\n", __FUNCTION__, + sc->rx_bd_mbuf_alloc_size, sc->rx_bd_mbuf_data_len, + sc->rx_bd_mbuf_align_pad); /* Program appropriate promiscuous/multicast filtering. */ bce_set_rx_mode(sc); #ifdef ZERO_COPY_SOCKETS + DBPRINT(sc, BCE_INFO_LOAD, "%s(): pg_bd_mbuf_alloc_size = %d\n", + __FUNCTION__, sc->pg_bd_mbuf_alloc_size); + /* Init page buffer descriptor chain. */ bce_init_pg_chain(sc); #endif @@ -6489,10 +6503,7 @@ bce_tx_encap_skip_tso: /* Check if the DMA mapping was successful */ if (error == EFBIG) { - /* The mbuf is too fragmented for our DMA mapping. */ - DBPRINT(sc, BCE_WARN, "%s(): fragmented mbuf (%d pieces)\n", - __FUNCTION__, nsegs); - DBRUN(bce_dump_mbuf(sc, m0);); + sc->fragmented_mbuf_count++; /* Try to defrag the mbuf. */ m0 = m_defrag(*m_head, M_DONTWAIT); @@ -6500,7 +6511,7 @@ bce_tx_encap_skip_tso: /* Defrag was unsuccessful */ m_freem(*m_head); *m_head = NULL; - sc->mbuf_alloc_failed++; + sc->mbuf_alloc_failed_count++; rc = ENOBUFS; goto bce_tx_encap_exit; } @@ -6513,7 +6524,7 @@ bce_tx_encap_skip_tso: /* Still getting an error after a defrag. */ if (error == ENOMEM) { /* Insufficient DMA buffers available. */ - sc->tx_dma_map_failures++; + sc->dma_map_addr_tx_failed_count++; rc = error; goto bce_tx_encap_exit; } else if (error != 0) { @@ -6523,19 +6534,19 @@ bce_tx_encap_skip_tso: __FILE__, __LINE__); m_freem(m0); *m_head = NULL; - sc->tx_dma_map_failures++; + sc->dma_map_addr_tx_failed_count++; rc = ENOBUFS; goto bce_tx_encap_exit; } } else if (error == ENOMEM) { /* Insufficient DMA buffers available. */ - sc->tx_dma_map_failures++; + sc->dma_map_addr_tx_failed_count++; rc = error; goto bce_tx_encap_exit; } else if (error != 0) { m_freem(m0); *m_head = NULL; - sc->tx_dma_map_failures++; + sc->dma_map_addr_tx_failed_count++; rc = error; goto bce_tx_encap_exit; } @@ -7040,9 +7051,10 @@ bce_intr(void *xsc) status_attn_bits = sc->status_block->status_attn_bits; - DBRUNIF(DB_RANDOMTRUE(bce_debug_unexpected_attention), - BCE_PRINTF("Simulating unexpected status attention bit set."); - status_attn_bits = status_attn_bits | STATUS_ATTN_BITS_PARITY_ERROR); + DBRUNIF(DB_RANDOMTRUE(unexpected_attention_sim_control), + BCE_PRINTF("Simulating unexpected status attention bit set."); + sc->unexpected_attention_sim_count++; + status_attn_bits = status_attn_bits | STATUS_ATTN_BITS_PARITY_ERROR); /* Was it a link change interrupt? */ if ((status_attn_bits & STATUS_ATTN_BITS_LINK_STATE) != @@ -7060,13 +7072,13 @@ bce_intr(void *xsc) (sc->status_block->status_attn_bits_ack & ~STATUS_ATTN_BITS_LINK_STATE))) { - DBRUN(sc->unexpected_attentions++); + sc->unexpected_attention_count++; BCE_PRINTF("%s(%d): Fatal attention detected: 0x%08X\n", __FILE__, __LINE__, sc->status_block->status_attn_bits); DBRUNMSG(BCE_FATAL, - if (bce_debug_unexpected_attention == 0) + if (unexpected_attention_sim_control == 0) bce_breakpoint(sc)); bce_init_locked(sc); @@ -7315,8 +7327,8 @@ bce_stats_update(struct bce_softc *sc) sc->stat_EtherStatsUndersizePkts = stats->stat_EtherStatsUndersizePkts; - sc->stat_EtherStatsOverrsizePkts = - stats->stat_EtherStatsOverrsizePkts; + sc->stat_EtherStatsOversizePkts = + stats->stat_EtherStatsOversizePkts; sc->stat_EtherStatsPktsRx64Octets = stats->stat_EtherStatsPktsRx64Octets; @@ -7420,7 +7432,7 @@ bce_stats_update(struct bce_softc *sc) /* ToDo: This method loses soft errors. */ ifp->if_ierrors = (u_long) sc->stat_EtherStatsUndersizePkts + - (u_long) sc->stat_EtherStatsOverrsizePkts + + (u_long) sc->stat_EtherStatsOversizePkts + (u_long) sc->stat_IfInMBUFDiscards + (u_long) sc->stat_Dot3StatsAlignmentErrors + (u_long) sc->stat_Dot3StatsFCSErrors + @@ -7871,6 +7883,91 @@ bce_add_sysctls(struct bce_softc *sc) #ifdef BCE_DEBUG SYSCTL_ADD_INT(ctx, children, OID_AUTO, + "l2fhdr_error_sim_control", + CTLFLAG_RW, &l2fhdr_error_sim_control, + 0, "Debug control to force l2fhdr errors"); + + SYSCTL_ADD_INT(ctx, children, OID_AUTO, + "l2fhdr_error_sim_count", + CTLFLAG_RD, &sc->l2fhdr_error_sim_count, + 0, "Number of simulated l2_fhdr errors"); +#endif + + SYSCTL_ADD_INT(ctx, children, OID_AUTO, + "l2fhdr_error_count", + CTLFLAG_RD, &sc->l2fhdr_error_count, + 0, "Number of l2_fhdr errors"); + +#ifdef BCE_DEBUG + SYSCTL_ADD_INT(ctx, children, OID_AUTO, + "mbuf_alloc_failed_sim_control", + CTLFLAG_RW, &mbuf_alloc_failed_sim_control, + 0, "Debug control to force mbuf allocation failures"); + + SYSCTL_ADD_INT(ctx, children, OID_AUTO, + "mbuf_alloc_failed_sim_count", + CTLFLAG_RD, &sc->mbuf_alloc_failed_sim_count, + 0, "Number of simulated mbuf cluster allocation failures"); +#endif + + SYSCTL_ADD_INT(ctx, children, OID_AUTO, + "mbuf_alloc_failed_count", + CTLFLAG_RD, &sc->mbuf_alloc_failed_count, + 0, "Number of mbuf allocation failures"); + + SYSCTL_ADD_INT(ctx, children, OID_AUTO, + "fragmented_mbuf_count", + CTLFLAG_RD, &sc->fragmented_mbuf_count, + 0, "Number of fragmented mbufs"); + +#ifdef BCE_DEBUG + SYSCTL_ADD_INT(ctx, children, OID_AUTO, + "dma_map_addr_failed_sim_control", + CTLFLAG_RW, &dma_map_addr_failed_sim_control, + 0, "Debug control to force DMA mapping failures"); + + /* ToDo: Figure out how to update this value in bce_dma_map_addr(). */ + SYSCTL_ADD_INT(ctx, children, OID_AUTO, + "dma_map_addr_failed_sim_count", + CTLFLAG_RD, &sc->dma_map_addr_failed_sim_count, + 0, "Number of simulated DMA mapping failures"); + +#endif + + SYSCTL_ADD_INT(ctx, children, OID_AUTO, + "dma_map_addr_rx_failed_count", + CTLFLAG_RD, &sc->dma_map_addr_rx_failed_count, + 0, "Number of RX DMA mapping failures"); + + SYSCTL_ADD_INT(ctx, children, OID_AUTO, + "dma_map_addr_tx_failed_count", + CTLFLAG_RD, &sc->dma_map_addr_tx_failed_count, + 0, "Number of TX DMA mapping failures"); + +#ifdef BCE_DEBUG + SYSCTL_ADD_INT(ctx, children, OID_AUTO, + "unexpected_attention_sim_control", + CTLFLAG_RW, &unexpected_attention_sim_control, + 0, "Debug control to simulate unexpected attentions"); + + SYSCTL_ADD_INT(ctx, children, OID_AUTO, + "unexpected_attention_sim_count", + CTLFLAG_RW, &sc->unexpected_attention_sim_count, + 0, "Number of simulated unexpected attentions"); +#endif + + SYSCTL_ADD_INT(ctx, children, OID_AUTO, + "unexpected_attention_count", + CTLFLAG_RW, &sc->unexpected_attention_count, + 0, "Number of unexpected attentions"); + +#ifdef BCE_DEBUG + SYSCTL_ADD_INT(ctx, children, OID_AUTO, + "debug_bootcode_running_failure", + CTLFLAG_RW, &bootcode_running_failure_sim_control, + 0, "Debug control to force bootcode running failures"); + + SYSCTL_ADD_INT(ctx, children, OID_AUTO, "rx_low_watermark", CTLFLAG_RD, &sc->rx_low_watermark, 0, "Lowest level of free rx_bd's"); @@ -7891,26 +7988,6 @@ bce_add_sysctls(struct bce_softc *sc) 0, "Number of times the TX chain was full"); SYSCTL_ADD_INT(ctx, children, OID_AUTO, - "l2fhdr_status_errors", - CTLFLAG_RD, &sc->l2fhdr_status_errors, - 0, "l2_fhdr status errors"); - - SYSCTL_ADD_INT(ctx, children, OID_AUTO, - "unexpected_attentions", - CTLFLAG_RD, &sc->unexpected_attentions, - 0, "Unexpected attentions"); - - SYSCTL_ADD_INT(ctx, children, OID_AUTO, - "lost_status_block_updates", - CTLFLAG_RD, &sc->lost_status_block_updates, - 0, "Lost status block updates"); - - SYSCTL_ADD_INT(ctx, children, OID_AUTO, - "debug_mbuf_sim_alloc_failed", - CTLFLAG_RD, &sc->debug_mbuf_sim_alloc_failed, - 0, "Simulated mbuf cluster allocation failures"); - - SYSCTL_ADD_INT(ctx, children, OID_AUTO, "requested_tso_frames", CTLFLAG_RD, &sc->requested_tso_frames, 0, "Number of TSO frames received"); @@ -7936,16 +8013,6 @@ bce_add_sysctls(struct bce_softc *sc) "TX interrupt time"); #endif - SYSCTL_ADD_INT(ctx, children, OID_AUTO, - "mbuf_alloc_failed", - CTLFLAG_RD, &sc->mbuf_alloc_failed, - 0, "mbuf cluster allocation failures"); - - SYSCTL_ADD_INT(ctx, children, OID_AUTO, - "tx_dma_map_failures", - CTLFLAG_RD, &sc->tx_dma_map_failures, - 0, "tx dma mapping failures"); - SYSCTL_ADD_ULONG(ctx, children, OID_AUTO, "stat_IfHcInOctets", CTLFLAG_RD, &sc->stat_IfHCInOctets, @@ -8062,9 +8129,9 @@ bce_add_sysctls(struct bce_softc *sc) 0, "Undersize packets"); SYSCTL_ADD_UINT(ctx, children, OID_AUTO, - "stat_EtherStatsOverrsizePkts", - CTLFLAG_RD, &sc->stat_EtherStatsOverrsizePkts, - 0, "stat_EtherStatsOverrsizePkts"); + "stat_EtherStatsOversizePkts", + CTLFLAG_RD, &sc->stat_EtherStatsOversizePkts, + 0, "stat_EtherStatsOversizePkts"); SYSCTL_ADD_UINT(ctx, children, OID_AUTO, "stat_EtherStatsPktsRx64Octets", @@ -9455,9 +9522,9 @@ bce_dump_stats_block(struct bce_softc *s BCE_PRINTF(" 0x%08X : EtherStatsUndersizePkts\n", sblk->stat_EtherStatsUndersizePkts); - if (sblk->stat_EtherStatsOverrsizePkts) + if (sblk->stat_EtherStatsOversizePkts) BCE_PRINTF(" 0x%08X : EtherStatsOverrsizePkts\n", - sblk->stat_EtherStatsOverrsizePkts); + sblk->stat_EtherStatsOversizePkts); if (sblk->stat_EtherStatsPktsRx64Octets) BCE_PRINTF(" 0x%08X : EtherStatsPktsRx64Octets\n", @@ -9724,13 +9791,9 @@ bce_dump_driver_state(struct bce_softc * sc->pg_low_watermark, sc->max_pg_bd); #endif - BCE_PRINTF(" 0x%08X - (sc->mbuf_alloc_failed) " + BCE_PRINTF(" 0x%08X - (sc->mbuf_alloc_failed_count) " "mbuf alloc failures\n", - sc->mbuf_alloc_failed); - - BCE_PRINTF(" 0x%08X - (sc->debug_mbuf_sim_alloc_failed) " - "simulated mbuf alloc failures\n", - sc->debug_mbuf_sim_alloc_failed); + sc->mbuf_alloc_failed_count); BCE_PRINTF(" 0x%08X - (sc->bce_flags) bce mac flags\n", sc->bce_flags); @@ -9762,7 +9825,7 @@ bce_dump_hw_state(struct bce_softc *sc) " Hardware State " "----------------------------\n"); - BCE_PRINTF("0x%08X - bootcode version\n", sc->bce_fw_ver); + BCE_PRINTF("0x%08X - bootcode version\n", sc->bce_bc_ver); val = REG_RD(sc, BCE_MISC_ENABLE_STATUS_BITS); BCE_PRINTF("0x%08X - (0x%06X) misc_enable_status_bits\n", @@ -9887,7 +9950,7 @@ bce_dump_bc_state(struct bce_softc *sc) " Bootcode State " "----------------------------\n"); - BCE_PRINTF("0x%08X - bootcode version\n", sc->bce_fw_ver); + BCE_PRINTF("0x%08X - bootcode version\n", sc->bce_bc_ver); val = REG_RD_IND(sc, sc->bce_shmem_base + BCE_BC_RESET_TYPE); BCE_PRINTF("0x%08X - (0x%06X) reset_type\n", Modified: head/sys/dev/bce/if_bcefw.h ============================================================================== --- head/sys/dev/bce/if_bcefw.h Tue Mar 3 21:45:47 2009 (r189324) +++ head/sys/dev/bce/if_bcefw.h Wed Mar 4 00:05:40 2009 (r189325) @@ -38,124 +38,124 @@ * accompanying it. */ -/* Firmware release 4.4.17 for BCM5706 and BCM5708 (b06). */ -/* Firmware release 4.4.21 for BCM5709 and BCM5716 (b09). */ +/* Firmware release 4.6.17 for BCM5706 and BCM5708 (b06). */ +/* Firmware release 4.6.16 for BCM5709 and BCM5716 (b09). */ int bce_COM_b06FwReleaseMajor = 0x1; int bce_COM_b06FwReleaseMinor = 0x0; int bce_COM_b06FwReleaseFix = 0x0; u32 bce_COM_b06FwStartAddr = 0x080000f8; u32 bce_COM_b06FwTextAddr = 0x08000000; -int bce_COM_b06FwTextLen = 0x4e94; +int bce_COM_b06FwTextLen = 0x4df0; u32 bce_COM_b06FwDataAddr = 0x00000000; int bce_COM_b06FwDataLen = 0x0; -u32 bce_COM_b06FwRodataAddr = 0x08004e94; +u32 bce_COM_b06FwRodataAddr = 0x08004df0; int bce_COM_b06FwRodataLen = 0x14; -u32 bce_COM_b06FwBssAddr = 0x08004ef8; +u32 bce_COM_b06FwBssAddr = 0x08004e58; int bce_COM_b06FwBssLen = 0xbc; -u32 bce_COM_b06FwSbssAddr = 0x08004ec0; +u32 bce_COM_b06FwSbssAddr = 0x08004e20; int bce_COM_b06FwSbssLen = 0x38; u32 bce_COM_b06FwSDataAddr = 0x00000000; int bce_COM_b06FwSDataLen = 0x0; -u32 bce_COM_b06FwText[(0x4e94/4) + 1] = { -0xa00003e, -0x0, 0x0, 0xd, 0x636f6d34, -0x2e342e31, 0x37000000, 0x4041102, 0x0, -0x3, 0x14, 0x32, 0x3, +u32 bce_COM_b06FwText[(0x4df0/4) + 1] = { +0xa00003e, 0x0, 0x0, +0xd, 0x636f6d34, 0x2e362e31, 0x37000000, +0x4061102, 0x0, 0x3, 0x14, +0x32, 0x3, 0x0, 0x0, +0x0, 0x0, 0x0, 0x10, +0x136, 0xea60, 0x1, 0x0, +0x0, 0x0, 0x8, 0x0, 0x0, 0x0, 0x0, 0x0, -0x0, 0x10, 0x136, 0xea60, -0x1, 0x0, 0x0, 0x0, -0x8, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, +0x0, 0x0, 0x0, 0x2, 0x0, 0x0, 0x0, 0x0, -0x0, 0x2, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, -0x0, 0x0, 0x0, 0x10, +0x0, 0x10, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, -0x0, 0x0, 0x10000003, 0x0, -0xd, 0xd, 0x3c020800, 0x24424ec0, -0x3c030800, 0x24634fb4, 0xac400000, 0x43202b, -0x1480fffd, 0x24420004, 0x3c1d0800, 0x37bd7ffc, -0x3a0f021, 0x3c100800, 0x261000f8, 0x3c1c0800, -0x279c4ec0, 0xe0002a8, 0x0, 0xd, -0x3c036010, 0x8c645000, 0x2402ff7f, 0x3c1a8000, -0x822024, 0x3484380c, 0x24020037, 0xac645000, -0xaf420008, 0x24020c80, 0xaf420024, 0x3c1b8008, -0x3c060800, 0x24c60794, 0x3c020800, 0x24424ef8, -0x2404001b, 0x2484ffff, 0xac460000, 0x481fffd, -0x24420004, 0x3c020800, 0x24420378, 0x3c010800, -0xac224f00, 0x3c020800, 0x24420678, 0x3c010800, -0xac224f04, 0x3c020800, 0x24420a08, 0x3c030800, -0x24630900, 0x3c040800, 0x2484093c, 0x3c050800, -0x24a53d98, 0x3c010800, 0xac224f48, 0x3c020800, -0x24420568, 0x3c010800, 0xac264f44, 0x3c010800, -0xac254f54, 0x3c010800, 0xac234f5c, 0x3c010800, -0xac224f60, 0x3c010800, 0xac244f64, 0x3c010800, -0xac234efc, 0x3c010800, 0xac204f08, 0x3c010800, -0xac204f0c, 0x3c010800, 0xac204f10, 0x3c010800, -0xac204f14, 0x3c010800, 0xac204f18, 0x3c010800, -0xac204f1c, 0x3c010800, 0xac204f20, 0x3c010800, -0xac244f24, 0x3c010800, 0xac204f28, 0x3c010800, -0xac204f2c, 0x3c010800, 0xac204f30, 0x3c010800, -0xac204f34, 0x3c010800, 0xac204f38, 0x3c010800, -0xac264f3c, 0x3c010800, 0xac264f40, 0x3c010800, -0xac204f4c, 0x3c010800, 0xac254f50, 0x3c010800, -0xac234f58, 0xa000751, 0x0, 0x3c030800, +0x10000003, 0x0, 0xd, 0xd, +0x3c020800, 0x24424e20, 0x3c030800, 0x24634f14, +0xac400000, 0x43202b, 0x1480fffd, 0x24420004, +0x3c1d0800, 0x37bd7ffc, 0x3a0f021, 0x3c100800, +0x261000f8, 0x3c1c0800, 0x279c4e20, 0xe0002bd, +0x0, 0xd, 0x3c036010, 0x8c645000, +0x2402ff7f, 0x3c1a8000, 0x822024, 0x3484380c, +0x24020037, 0xac645000, 0xaf420008, 0x24020c80, +0xaf420024, 0x3c1b8008, 0x3c060800, 0x24c607e8, +0x3c020800, 0x24424e58, 0x2404001b, 0x2484ffff, +0xac460000, 0x481fffd, 0x24420004, 0x3c020800, +0x24420380, 0x3c010800, 0xac224e60, 0x3c020800, +0x24420680, 0x3c010800, 0xac224e64, 0x3c020800, +0x24420dcc, 0x3c010800, 0xac224ea0, 0x3c020800, +0x24420a5c, 0x3c030800, 0x24630954, 0x3c040800, +0x24840990, 0x3c050800, 0x24a53c70, 0x3c010800, +0xac224ea8, 0x3c020800, 0x24420570, 0x3c010800, +0xac264ea4, 0x3c010800, 0xac254eb4, 0x3c010800, +0xac234ebc, 0x3c010800, 0xac224ec0, 0x3c010800, +0xac244ec4, 0x3c010800, 0xac234e5c, 0x3c010800, +0xac204e68, 0x3c010800, 0xac204e6c, 0x3c010800, +0xac204e70, 0x3c010800, 0xac204e74, 0x3c010800, +0xac204e78, 0x3c010800, 0xac204e7c, 0x3c010800, +0xac204e80, 0x3c010800, 0xac244e84, 0x3c010800, +0xac204e88, 0x3c010800, 0xac204e8c, 0x3c010800, +0xac204e90, 0x3c010800, 0xac204e94, 0x3c010800, +0xac204e98, 0x3c010800, 0xac264e9c, 0x3c010800, +0xac204eac, 0x3c010800, 0xac254eb0, 0x3c010800, +0xac234eb8, 0xa000707, 0x0, 0x3c030800, 0x8c630020, 0x8f820008, 0x10430003, 0x0, -0xa00055d, 0xaf830008, 0x3e00008, 0x0, +0xa00053f, 0xaf830008, 0x3e00008, 0x0, 0x27bdffe8, 0xafb00010, 0xafbf0014, 0x27500100, 0x92020009, 0x1040001a, 0x24030001, 0x3c020800, -0x8c420020, 0x10400016, 0x1821, 0xe00059b, -0x0, 0x96030008, 0x3c060800, 0x94c64f76, +0x8c420020, 0x10400016, 0x1821, 0xe000577, +0x0, 0x96030008, 0x3c060800, 0x94c64ed6, 0x8e040018, 0x8f820020, 0x9605000c, 0x31c00, 0x661825, 0xac440000, 0xac450004, 0x24040001, 0xac400008, 0xac40000c, 0xac400010, 0xac400014, -0xac400018, 0xe0005d3, 0xac43001c, 0x1821, +0xac400018, 0xe00059c, 0xac43001c, 0x1821, 0x8fbf0014, 0x8fb00010, 0x601021, 0x3e00008, 0x27bd0018, 0x27bdffe8, 0xafbf0010, 0x97420108, 0x30437000, 0x24022000, 0x1062000a, 0x28642001, 0x54800012, 0x8fbf0010, 0x24024000, 0x10620008, -0x24026000, 0x1062000a, 0x8fbf0010, 0xa0000f9, -0x1021, 0x8fbf0010, 0xa0000b9, 0x27bd0018, -0xe0004c3, 0x0, 0xa0000f8, 0x8fbf0010, -0xe000ff5, 0x0, 0x8fbf0010, 0x1021, +0x24026000, 0x1062000a, 0x8fbf0010, 0xa0000fb, +0x1021, 0x8fbf0010, 0xa0000bb, 0x27bd0018, +0xe000409, 0x0, 0xa0000fa, 0x8fbf0010, +0xe000fc9, 0x0, 0x8fbf0010, 0x1021, 0x3e00008, 0x27bd0018, 0x3c020800, 0x8c420020, -0x27bdffe8, 0x10400027, 0xafbf0010, 0xe00059b, +0x27bdffe8, 0x10400027, 0xafbf0010, 0xe000577, 0x0, 0x97420108, 0x9743010c, 0x8f850020, 0x3042003e, 0x3063ffff, 0x21400, 0x431025, -0xaca20000, 0x8f420100, 0x3c060800, 0x94c64f76, +0xaca20000, 0x8f420100, 0x3c060800, 0x94c64ed6, 0x8fbf0010, 0xaca20004, 0x97430116, 0x9744010e, 0x3c022000, 0x31c00, 0x3084ffff, 0x641825, 0xaca30008, 0xc23025, 0x97420110, 0x97430112, 0x24040001, 0x21400, 0x3063ffff, 0x431025, 0xaca2000c, 0x97420114, 0x27bd0018, 0x3042ffff, -0xaca20010, 0xaca00014, 0xaca00018, 0xa0005d3, +0xaca20010, 0xaca00014, 0xaca00018, 0xa00059c, 0xaca6001c, 0x8fbf0010, 0x3e00008, 0x27bd0018, 0x3c020800, 0x8c420020, 0x27bdffe8, 0x1040002a, -0xafbf0010, 0xe00059b, 0x0, 0x97420108, +0xafbf0010, 0xe000577, 0x0, 0x97420108, 0x9743010c, 0x8f850020, 0x3042003e, 0x3063ffff, 0x21400, 0x431025, 0xaca20000, 0x8f420100, -0x3c060800, 0x94c64f76, 0x8fbf0010, 0xaca20004, +0x3c060800, 0x94c64ed6, 0x8fbf0010, 0xaca20004, 0x97430116, 0x9744010e, 0x3c022000, 0x31c00, 0x3084ffff, 0x641825, 0xaca30008, 0xc23025, 0x97420110, 0x97430112, 0x24040001, 0x21400, 0x3063ffff, 0x431025, 0xaca2000c, 0x97420114, 0x27bd0018, 0x3042ffff, 0xaca20010, 0x8f420118, 0xaca20014, 0x9342010b, 0x304200ff, 0xaca20018, -0xa0005d3, 0xaca6001c, 0x8fbf0010, 0x3e00008, +0xa00059c, 0xaca6001c, 0x8fbf0010, 0x3e00008, 0x27bd0018, 0x27bdffe0, 0xafb00010, 0xafbf0018, 0xafb10014, 0x27500100, 0x9203000b, 0x2402001a, 0x96110008, 0x14620035, 0x2021, 0x32220001, 0x10400009, 0x0, 0x8e020000, 0x96030014, 0x211c2, 0x21040, 0x5a1021, 0xa4430080, -0xa000177, 0x32220002, 0xe000129, 0x0, +0xa000179, 0x32220002, 0xe00012b, 0x0, 0x3c020800, 0x8c420040, 0x24420001, 0x3c010800, 0xac220040, 0x32220002, 0x2202b, 0x3c020800, 0x8c420044, 0x32230004, 0x24420001, 0x3c010800, 0xac220044, 0x1060001a, 0x8fbf0018, 0x8f4202b8, 0x4410008, 0x24040001, 0x3c020800, 0x8c420060, -0x24420001, 0x3c010800, 0xac220060, 0xa00019a, +0x24420001, 0x3c010800, 0xac220060, 0xa00019c, 0x8fb10014, 0x8e020020, 0x96030016, 0x2021, 0xaf420280, 0x8e020004, 0xa7430284, 0xaf420288, 0x3c021000, 0xaf4202b8, 0x3c020800, 0x8c42005c, @@ -163,305 +163,286 @@ u32 bce_COM_b06FwText[(0x4e94/4) + 1] = 0x8fb10014, 0x8fb00010, 0x801021, 0x3e00008, 0x27bd0020, 0x27bdffe0, 0xafb00010, 0xafbf0018, 0xafb10014, 0x27500100, 0x9203000b, 0x24020003, -0x96110008, 0x14620035, 0x2021, 0x32220001, -0x10400009, 0x0, 0x8e020000, 0x96030014, -0x211c2, 0x21040, 0x5a1021, 0xa4430080, -0xa0001bb, 0x32220002, 0xe0000fb, 0x0, -0x3c020800, 0x8c420040, 0x24420001, 0x3c010800, -0xac220040, 0x32220002, 0x2202b, 0x3c020800, -0x8c420044, 0x32230004, 0x24420001, 0x3c010800, -0xac220044, 0x1060001a, 0x8fbf0018, 0x8f4202b8, -0x4410008, 0x24040001, 0x3c020800, 0x8c420060, -0x24420001, 0x3c010800, 0xac220060, 0xa0001de, -0x8fb10014, 0x8e020020, 0x96030016, 0x2021, +0x96110008, 0x14620048, 0x2021, 0x32220001, +0x10400008, 0x0, 0x8e020000, 0x96030014, +0x211c2, 0x21040, 0x5a1021, 0xa0001bb, +0xa4430080, 0xe0000fd, 0x0, 0x3c020800, +0x8c420040, 0x24420001, 0x3c010800, 0xac220040, +0x3c020800, 0x8c420044, 0x32230004, 0x24420001, +0x3c010800, 0xac220044, 0x1060001a, 0x32220002, +0x8f4202b8, 0x4430008, 0x8e020020, 0x3c020800, +0x8c420060, 0x24420001, 0x3c010800, 0xac220060, +0xa0001f1, 0x24040001, 0x96030016, 0x2021, 0xaf420280, 0x8e020004, 0xa7430284, 0xaf420288, 0x3c021000, 0xaf4202b8, 0x3c020800, 0x8c42005c, -0x24420001, 0x3c010800, 0xac22005c, 0x8fbf0018, -0x8fb10014, 0x8fb00010, 0x801021, 0x3e00008, -0x27bd0020, 0x93620000, 0x3e00008, 0xaf800004, -0x3e00008, 0x1021, 0x27bdffe8, 0xafbf0014, -0xafb00010, 0x8f420100, 0xaf420020, 0x8f420104, -0xaf4200a8, 0x9350010b, 0xe0001e2, 0x321000ff, -0x3c020800, 0x24424ef8, 0x101880, 0x2e10001c, -0x16000004, 0x621021, 0xe0001e5, 0xa0001fd, -0x0, 0x8c420000, 0x40f809, 0x0, +0x24420001, 0x3c010800, 0xac22005c, 0xa0001f2, +0x8fbf0018, 0x10400014, 0x2021, 0x8f430104, +0x3c026020, 0xac430014, 0x8c420004, 0x240301fe, +0x304203ff, 0x1443000c, 0x2021, 0x8f420100, +0x219c2, 0x2462fffc, 0x2c420008, 0x10400003, +0x24040002, 0x2462fffd, 0x442004, 0x3c026000, +0xac446914, 0x2021, 0x8fbf0018, 0x8fb10014, +0x8fb00010, 0x801021, 0x3e00008, 0x27bd0020, +0x93620000, 0x3e00008, 0xaf800004, 0x3e00008, +0x1021, 0x27bdffe8, 0xafbf0014, 0xafb00010, +0x8f420100, 0xaf420020, 0x8f420104, 0xaf4200a8, +0x9350010b, 0xe0001f7, 0x321000ff, 0x3c020800, +0x24424e58, 0x101880, 0x2e10001c, 0x16000004, +0x621021, 0xe0001fa, 0xa000212, 0x0, +0x8c420000, 0x40f809, 0x0, 0x10400005, +0x3c024000, 0x8f430104, 0x3c026020, 0xac430014, +0x3c024000, 0xaf420138, 0x3c020800, 0x8c420034, +0x8fbf0014, 0x8fb00010, 0x24420001, 0x3c010800, +0xac220034, 0x3e00008, 0x27bd0018, 0x27bdffe8, +0xafbf0010, 0x8f420140, 0xe0001f7, 0xaf420020, +0xe000393, 0x0, 0x3c024000, 0xaf420178, +0x3c030800, 0x24630038, 0x8c620000, 0x8fbf0010, +0x27bd0018, 0x24420001, 0x3e00008, 0xac620000, +0x27bdffe8, 0xafbf0010, 0x8f420180, 0xe0001f7, +0xaf420020, 0x8f430180, 0x24020f00, 0x14620005, +0x0, 0x8f420188, 0xa742009c, 0xa00024c, +0x3c024000, 0x93620000, 0x24030050, 0x304200ff, +0x14430008, 0x3c024000, 0xe000377, 0x0, +0x14400004, 0x3c024000, 0xe000e55, 0x0, +0x3c024000, 0xaf4201b8, 0x3c020800, 0x8c42003c, +0x8fbf0010, 0x24420001, 0x3c010800, 0xac22003c, +0x3e00008, 0x27bd0018, 0x3e00008, 0x1021, +0x8f430104, 0x8f820010, 0x10430008, 0x0, +0x3c020800, 0x8c420084, 0x24420001, 0x3c010800, +0xac220084, 0x8f420104, 0xaf820010, 0x3e00008, +0x0, 0x27bdffe8, 0xafbf0010, 0x27440100, +0x94820008, 0x30430002, 0x30420004, 0x1040001b, +0x0, 0x8f4202b8, 0x4410008, 0x24050001, +0x3c020800, 0x8c420060, 0x24420001, 0x3c010800, +0xac220060, 0xa000294, 0x8fbf0010, 0x8c820020, +0x94830016, 0x2821, 0xaf420280, 0x8c820004, +0xa7430284, 0xaf420288, 0x3c021000, 0xaf4202b8, +0x3c020800, 0x8c42005c, 0x24420001, 0x3c010800, +0xac22005c, 0xa000294, 0x8fbf0010, 0x10600008, +0x24050001, 0x3c020800, 0x8c420084, 0x24420001, +0x3c010800, 0xac220084, 0xa000294, 0x8fbf0010, +0x8f440100, 0xe000257, 0x0, 0x2821, +0x8fbf0010, 0xa01021, 0x3e00008, 0x27bd0018, +0x3c020800, 0x8c420088, 0x27430100, 0x9465000c, +0x24420001, 0x3c010800, 0xac220088, 0x8c640018, +0x3451021, 0x90454000, 0xaf440038, 0x8c62001c, +0x2403fff8, 0x52e00, 0x431024, 0x34420004, +0xaf42003c, 0x3c020005, 0xaf420030, 0x0, +0x0, 0x0, 0xaf450404, 0x0, +0x0, 0x0, 0x3c020006, 0x34420001, +0xaf420030, 0x0, 0x0, 0x0, +0x8f420000, 0x30420010, 0x1040fffd, 0x1021, +0x3e00008, 0x0, 0x27bdffe0, 0xafbf0018, +0xafb10014, 0xe000055, 0xafb00010, 0x3c028000, +0x34420070, 0x8c420000, 0xaf820014, 0xe0000b2, +0x0, 0x3c028000, 0x34460070, 0x3c030800, +0x8c6300a0, 0x3c020800, 0x8c4200a4, 0x10430004, +0x8f840014, 0x3c010800, 0xac2300a4, 0xa743009e, +0x8cca0000, 0x3c030800, 0x8c6300bc, 0x3c020800, +0x8c4200b8, 0x1442023, 0x641821, 0x4021, +0x64202b, 0x481021, 0x441021, 0x3c010800, +0xac2300bc, 0x3c010800, 0xac2200b8, 0x8f510000, +0x32220007, 0x1040ffe1, 0xaf8a0014, 0x8cc60000, +0x3c050800, 0x8ca500bc, 0x3c040800, 0x8c8400b8, +0xca3023, 0xa62821, 0x1021, 0xa6302b, +0x822021, 0x862021, 0x32270001, 0x3c010800, +0xac2500bc, 0x3c010800, 0xac2400b8, 0x10e00021, +0x32220002, 0x8f420100, 0xaf420020, 0x8f420104, +0xaf4200a8, 0x9342010b, 0xe0001f7, 0x305000ff, +0x2e02001c, 0x54400004, 0x101080, 0xe0001fa, +0xa00030b, 0x0, 0x3c030800, 0x24634e58, +0x431021, 0x8c420000, 0x40f809, 0x0, 0x10400005, 0x3c024000, 0x8f430104, 0x3c026020, 0xac430014, 0x3c024000, 0xaf420138, 0x3c020800, -0x8c420034, 0x8fbf0014, 0x8fb00010, 0x24420001, -0x3c010800, 0xac220034, 0x3e00008, 0x27bd0018, -0x27bdffe8, 0xafbf0010, 0x8f420140, 0xe0001e2, -0xaf420020, 0xe000380, 0x0, 0x3c024000, -0xaf420178, 0x3c030800, 0x24630038, 0x8c620000, -0x8fbf0010, 0x27bd0018, 0x24420001, 0x3e00008, -0xac620000, 0x27bdffe8, 0xafbf0010, 0x8f420180, -0xe0001e2, 0xaf420020, 0x8f430180, 0x24020f00, -0x14620005, 0x0, 0x8f420188, 0xa742009c, -0xa000237, 0x3c024000, 0x93620000, 0x24030050, -0x304200ff, 0x14430008, 0x3c024000, 0xe00035e, -0x0, 0x14400004, 0x3c024000, 0xe000e9f, -0x0, 0x3c024000, 0xaf4201b8, 0x3c020800, -0x8c42003c, 0x8fbf0010, 0x24420001, 0x3c010800, -0xac22003c, 0x3e00008, 0x27bd0018, 0x3e00008, -0x1021, 0x8f430104, 0x8f820010, 0x10430008, -0x0, 0x3c020800, 0x8c420084, 0x24420001, -0x3c010800, 0xac220084, 0x8f420104, 0xaf820010, -0x3e00008, 0x0, 0x27bdffe8, 0xafbf0010, -0x27440100, 0x94820008, 0x30430002, 0x30420004, -0x1040001b, 0x0, 0x8f4202b8, 0x4410008, -0x24050001, 0x3c020800, 0x8c420060, 0x24420001, -0x3c010800, 0xac220060, 0xa00027f, 0x8fbf0010, -0x8c820020, 0x94830016, 0x2821, 0xaf420280, -0x8c820004, 0xa7430284, 0xaf420288, 0x3c021000, -0xaf4202b8, 0x3c020800, 0x8c42005c, 0x24420001, -0x3c010800, 0xac22005c, 0xa00027f, 0x8fbf0010, -0x10600008, 0x24050001, 0x3c020800, 0x8c420084, -0x24420001, 0x3c010800, 0xac220084, 0xa00027f, -0x8fbf0010, 0x8f440100, 0xe000242, 0x0, -0x2821, 0x8fbf0010, 0xa01021, 0x3e00008, -0x27bd0018, 0x3c020800, 0x8c420088, 0x27430100, -0x9465000c, 0x24420001, 0x3c010800, 0xac220088, -0x8c640018, 0x3451021, 0x90454000, 0xaf440038, -0x8c62001c, 0x2403fff8, 0x52e00, 0x431024, -0x34420004, 0xaf42003c, 0x3c020005, 0xaf420030, -0x0, 0x0, 0x0, 0xaf450404, -0x0, 0x0, 0x0, 0x3c020006, -0x34420001, 0xaf420030, 0x0, 0x0, -0x0, 0x8f420000, 0x30420010, 0x1040fffd, -0x1021, 0x3e00008, 0x0, 0x27bdffe0, -0xafbf0018, 0xafb10014, 0xe000055, 0xafb00010, -0x3c028000, 0x34420070, 0x8c420000, 0xaf820014, -0xe0000b0, 0x0, 0x3c028000, 0x34460070, -0x3c030800, 0x8c6300a0, 0x3c020800, 0x8c4200a4, -0x10430004, 0x8f840014, 0x3c010800, 0xac2300a4, -0xa743009e, 0x8cca0000, 0x3c030800, 0x8c6300bc, -0x3c020800, 0x8c4200b8, 0x1442023, 0x641821, -0x4021, 0x64202b, 0x481021, 0x441021, -0x3c010800, 0xac2300bc, 0x3c010800, 0xac2200b8, -0x8f510000, 0x32220007, 0x1040ffe1, 0xaf8a0014, -0x8cc60000, 0x3c050800, 0x8ca500bc, 0x3c040800, -0x8c8400b8, 0xca3023, 0xa62821, 0x1021, -0xa6302b, 0x822021, 0x862021, 0x32270001, -0x3c010800, 0xac2500bc, 0x3c010800, 0xac2400b8, -0x10e00021, 0x32220002, 0x8f420100, 0xaf420020, -0x8f420104, 0xaf4200a8, 0x9342010b, 0xe0001e2, -0x305000ff, 0x2e02001c, 0x54400004, 0x101080, -0xe0001e5, 0xa0002f6, 0x0, 0x3c030800, -0x24634ef8, 0x431021, 0x8c420000, 0x40f809, -0x0, 0x10400005, 0x3c024000, 0x8f430104, -0x3c026020, 0xac430014, 0x3c024000, 0xaf420138, -0x3c020800, 0x8c420034, 0x24420001, 0x3c010800, -0xac220034, 0x32220002, 0x1040000e, 0x32220004, -0x8f420140, 0xe0001e2, 0xaf420020, 0xe000380, -0x0, 0x3c024000, 0xaf420178, 0x3c020800, -0x8c420038, 0x24420001, 0x3c010800, 0xac220038, -0x32220004, 0x1040ff9b, 0x3c028000, 0x8f420180, -0xe0001e2, 0xaf420020, 0x8f430180, 0x24020f00, -0x14620005, 0x0, 0x8f420188, 0xa742009c, -0xa00032b, 0x3c024000, 0x93620000, 0x24030050, -0x304200ff, 0x14430008, 0x3c024000, 0xe00035e, -0x0, 0x54400004, 0x3c024000, 0xe000e9f, -0x0, 0x3c024000, 0xaf4201b8, 0x3c020800, -0x8c42003c, 0x24420001, 0x3c010800, 0xac22003c, -0xa0002ae, 0x3c028000, 0x3c029000, 0x34420001, -0x822025, 0xaf440020, 0x8f420020, 0x440fffe, -0x0, 0x3e00008, 0x0, 0x3c028000, -0x34420001, 0x822025, 0x3e00008, 0xaf440020, -0x27bdffe0, 0xafb10014, 0xafb00010, 0x808821, -0xafbf0018, 0xe000333, 0x30b000ff, 0x9362007d, -0x2202021, 0x2028025, 0xa370007d, 0x8f700074, -0x3c028000, 0xe00033c, 0x2028024, 0x16000009, -0x8fbf0018, 0x8f4201f8, 0x440fffe, 0x24020002, -0xaf5101c0, 0xa34201c4, 0x3c021000, 0xaf4201f8, -0x8fbf0018, 0x8fb10014, 0x8fb00010, 0x3e00008, -0x27bd0020, 0x27bdffe8, 0xafbf0010, 0x8f440180, -0x97420184, 0x30420200, 0x10400005, 0x2821, -0xe0010b5, 0x0, 0xa000373, 0x24050001, -0x8f420188, 0x4400009, 0x8fbf0010, 0x8f420188, -0x3c03ff00, 0x431024, 0x3c030400, 0x14430003, -0x24050001, 0x9362003e, 0x8fbf0010, 0xa01021, -0x3e00008, 0x27bd0018, 0x8f420140, 0xaf420200, -0x3c021000, 0x3e00008, 0xaf420238, 0xa3600022, -0x8f440140, 0xa000341, 0x24050001, 0x27bdffe8, -0xafbf0014, 0xafb00010, 0x93620000, 0x24030020, -0x304200ff, 0x1043000b, 0x0, 0x93620000, -0x24030030, 0x304200ff, 0x10430006, 0x0, -0x93620000, 0x24030050, 0x304200ff, 0x1443005f, -0x8fbf0014, 0x93420148, 0x304200ff, 0x2443ffff, -0x2c620005, 0x10400059, 0x8fbf0014, 0x31080, *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@FreeBSD.ORG Wed Mar 4 00:58: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 5BB361065675; Wed, 4 Mar 2009 00:58:05 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 486138FC13; Wed, 4 Mar 2009 00:58:05 +0000 (UTC) (envelope-from delphij@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 n240w5c7026238; Wed, 4 Mar 2009 00:58:05 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n240w4SI026223; Wed, 4 Mar 2009 00:58:04 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <200903040058.n240w4SI026223@svn.freebsd.org> From: Xin LI Date: Wed, 4 Mar 2009 00:58: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: r189327 - in head/lib/libc/db: btree hash recno 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, 04 Mar 2009 00:58:05 -0000 Author: delphij Date: Wed Mar 4 00:58:04 2009 New Revision: 189327 URL: http://svn.freebsd.org/changeset/base/189327 Log: Style changes (including additional casts to shut up warnings). This commit does not affect MD5 of object file. Modified: head/lib/libc/db/btree/bt_delete.c head/lib/libc/db/btree/bt_open.c head/lib/libc/db/btree/bt_put.c head/lib/libc/db/btree/bt_seq.c head/lib/libc/db/btree/bt_split.c head/lib/libc/db/btree/bt_utils.c head/lib/libc/db/btree/btree.h head/lib/libc/db/hash/hash_bigkey.c head/lib/libc/db/hash/page.h head/lib/libc/db/recno/rec_close.c head/lib/libc/db/recno/rec_open.c head/lib/libc/db/recno/rec_put.c head/lib/libc/db/recno/rec_search.c head/lib/libc/db/recno/rec_seq.c head/lib/libc/db/recno/rec_utils.c Modified: head/lib/libc/db/btree/bt_delete.c ============================================================================== --- head/lib/libc/db/btree/bt_delete.c Wed Mar 4 00:56:48 2009 (r189326) +++ head/lib/libc/db/btree/bt_delete.c Wed Mar 4 00:58:04 2009 (r189327) @@ -146,7 +146,7 @@ __bt_stkacq(BTREE *t, PAGE **hp, CURSOR pgno_t pgno; recno_t nextpg, prevpg; int exact, level; - + /* * Find the first occurrence of the key in the tree. Toss the * currently locked page so we don't hit an already-locked page. @@ -262,7 +262,7 @@ __bt_stkacq(BTREE *t, PAGE **hp, CURSOR if ((h = mpool_get(t->bt_mp, prevpg, 0)) == NULL) return (1); } - + ret: mpool_put(t->bt_mp, h, 0); return ((*hp = mpool_get(t->bt_mp, c->pg.pgno, 0)) == NULL); @@ -390,7 +390,7 @@ __bt_pdelete(BTREE *t, PAGE *h) /* Get the parent page. */ if ((pg = mpool_get(t->bt_mp, parent->pgno, 0)) == NULL) return (RET_ERROR); - + idx = parent->index; bi = GETBINTERNAL(pg, idx); @@ -406,7 +406,7 @@ __bt_pdelete(BTREE *t, PAGE *h) * root page. If it's the rootpage, turn it back into an empty * leaf page. */ - if (NEXTINDEX(pg) == 1) + if (NEXTINDEX(pg) == 1) { if (pg->pgno == P_ROOT) { pg->lower = BTDATAOFF; pg->upper = t->bt_psize; @@ -416,7 +416,7 @@ __bt_pdelete(BTREE *t, PAGE *h) return (RET_ERROR); continue; } - else { + } else { /* Pack remaining key items at the end of the page. */ nksize = NBINTERNAL(bi->ksize); from = (char *)pg + pg->upper; @@ -551,7 +551,7 @@ __bt_curdel(BTREE *t, const DBT *key, PA key = &c->key; } /* Check previous key, if not at the beginning of the page. */ - if (idx > 0) { + if (idx > 0) { e.page = h; e.index = idx - 1; if (__bt_cmp(t, key, &e) == 0) { Modified: head/lib/libc/db/btree/bt_open.c ============================================================================== --- head/lib/libc/db/btree/bt_open.c Wed Mar 4 00:56:48 2009 (r189326) +++ head/lib/libc/db/btree/bt_open.c Wed Mar 4 00:58:04 2009 (r189327) @@ -197,7 +197,7 @@ __bt_open(const char *fname, int flags, default: goto einval; } - + if ((t->bt_fd = _open(fname, flags, mode)) < 0) goto err; Modified: head/lib/libc/db/btree/bt_put.c ============================================================================== --- head/lib/libc/db/btree/bt_put.c Wed Mar 4 00:56:48 2009 (r189326) +++ head/lib/libc/db/btree/bt_put.c Wed Mar 4 00:58:04 2009 (r189327) @@ -99,7 +99,7 @@ __bt_put(const DB *dbp, DBT *key, const */ if (F_ISSET(&t->bt_cursor, CURS_INIT) && !F_ISSET(&t->bt_cursor, - CURS_ACQUIRE | CURS_AFTER | CURS_BEFORE)) + CURS_ACQUIRE | CURS_AFTER | CURS_BEFORE)) break; /* FALLTHROUGH */ default: @@ -257,7 +257,7 @@ u_long bt_cache_hit, bt_cache_miss; * key: key to insert * * Returns: - * EPG for new record or NULL if not found. + * EPG for new record or NULL if not found. */ static EPG * bt_fast(BTREE *t, const DBT *key, const DBT *data, int *exactp) Modified: head/lib/libc/db/btree/bt_seq.c ============================================================================== --- head/lib/libc/db/btree/bt_seq.c Wed Mar 4 00:56:48 2009 (r189326) +++ head/lib/libc/db/btree/bt_seq.c Wed Mar 4 00:58:04 2009 (r189327) @@ -258,7 +258,7 @@ __bt_seqadv(BTREE *t, EPG *ep, int flags return (RET_ERROR); /* - * Find the next/previous record in the tree and point the cursor at + * Find the next/previous record in the tree and point the cursor at * it. The cursor may not be moved until a new key has been found. */ switch (flags) { @@ -348,7 +348,7 @@ __bt_first(BTREE *t, const DBT *key, EPG *erval = *ep; return (RET_SUCCESS); } - + /* * Walk backwards, as long as the entry matches and there are * keys left in the tree. Save a copy of each match in case Modified: head/lib/libc/db/btree/bt_split.c ============================================================================== --- head/lib/libc/db/btree/bt_split.c Wed Mar 4 00:56:48 2009 (r189326) +++ head/lib/libc/db/btree/bt_split.c Wed Mar 4 00:58:04 2009 (r189327) @@ -149,7 +149,7 @@ __bt_split(BTREE *t, PAGE *sp, const DBT if ((h = mpool_get(t->bt_mp, parent->pgno, 0)) == NULL) goto err2; - /* + /* * The new key goes ONE AFTER the index, because the split * was to the right. */ Modified: head/lib/libc/db/btree/bt_utils.c ============================================================================== --- head/lib/libc/db/btree/bt_utils.c Wed Mar 4 00:56:48 2009 (r189326) +++ head/lib/libc/db/btree/bt_utils.c Wed Mar 4 00:58:04 2009 (r189327) @@ -196,7 +196,7 @@ __bt_cmp(BTREE *t, const DBT *k1, EPG *e * * Parameters: * a: DBT #1 - * b: DBT #2 + * b: DBT #2 * * Returns: * < 0 if a is < b @@ -227,7 +227,7 @@ __bt_defcmp(const DBT *a, const DBT *b) * * Parameters: * a: DBT #1 - * b: DBT #2 + * b: DBT #2 * * Returns: * Number of bytes needed to distinguish b from a. Modified: head/lib/libc/db/btree/btree.h ============================================================================== --- head/lib/libc/db/btree/btree.h Wed Mar 4 00:56:48 2009 (r189326) +++ head/lib/libc/db/btree/btree.h Wed Mar 4 00:58:04 2009 (r189327) @@ -309,8 +309,8 @@ typedef struct _btree { CURSOR bt_cursor; /* cursor */ #define BT_PUSH(t, p, i) { \ - t->bt_sp->pgno = p; \ - t->bt_sp->index = i; \ + t->bt_sp->pgno = p; \ + t->bt_sp->index = i; \ ++t->bt_sp; \ } #define BT_POP(t) (t->bt_sp == t->bt_stack ? NULL : --t->bt_sp) Modified: head/lib/libc/db/hash/hash_bigkey.c ============================================================================== --- head/lib/libc/db/hash/hash_bigkey.c Wed Mar 4 00:56:48 2009 (r189326) +++ head/lib/libc/db/hash/hash_bigkey.c Wed Mar 4 00:58:04 2009 (r189327) @@ -412,8 +412,8 @@ __big_return(HTAB *hashp, BUFHEAD *bufp, return (0); } - val->size = collect_data(hashp, bufp, (int)len, set_current); - if (val->size == -1) + val->size = (size_t)collect_data(hashp, bufp, (int)len, set_current); + if (val->size == (size_t)-1) return (-1); if (save_p->addr != save_addr) { /* We are pretty short on buffers. */ @@ -484,8 +484,8 @@ collect_data(HTAB *hashp, BUFHEAD *bufp, int __big_keydata(HTAB *hashp, BUFHEAD *bufp, DBT *key, DBT *val, int set) { - key->size = collect_key(hashp, bufp, 0, val, set); - if (key->size == -1) + key->size = (size_t)collect_key(hashp, bufp, 0, val, set); + if (key->size == (size_t)-1) return (-1); key->data = (u_char *)hashp->tmp_key; return (0); @@ -544,12 +544,10 @@ __big_split(HTAB *hashp, u_int32_t obucket, /* Old Bucket */ SPLIT_RETURN *ret) { - BUFHEAD *tmpp; - u_int16_t *tp; - BUFHEAD *bp; + BUFHEAD *bp, *tmpp; DBT key, val; u_int32_t change; - u_int16_t free_space, n, off; + u_int16_t free_space, n, off, *tp; bp = big_keyp; @@ -561,7 +559,7 @@ __big_split(HTAB *hashp, if ( (ret->next_addr = __find_last_page(hashp, &big_keyp)) ) { if (!(ret->nextp = __get_buf(hashp, ret->next_addr, big_keyp, 0))) - return (-1);; + return (-1); } else ret->nextp = NULL; Modified: head/lib/libc/db/hash/page.h ============================================================================== --- head/lib/libc/db/hash/page.h Wed Mar 4 00:56:48 2009 (r189326) +++ head/lib/libc/db/hash/page.h Wed Mar 4 00:58:04 2009 (r189327) @@ -48,7 +48,7 @@ * +--------+---------------------+ * | F R E E A R E A | * +--------------+---------------+ - * | <---- - - - | data | + * | <---- - - - | data | * +--------+-----+----+----------+ * | key | data | key | * +--------+----------+----------+ Modified: head/lib/libc/db/recno/rec_close.c ============================================================================== --- head/lib/libc/db/recno/rec_close.c Wed Mar 4 00:56:48 2009 (r189326) +++ head/lib/libc/db/recno/rec_close.c Wed Mar 4 00:58:04 2009 (r189327) @@ -82,9 +82,10 @@ __rec_close(DB *dbp) if (F_ISSET(t, R_CLOSEFP)) { if (fclose(t->bt_rfp)) status = RET_ERROR; - } else + } else { if (_close(t->bt_rfd)) status = RET_ERROR; + } } if (__bt_close(dbp) == RET_ERROR) @@ -154,7 +155,7 @@ __rec_sync(const DB *dbp, u_int flags) status = (dbp->seq)(dbp, &key, &data, R_NEXT); } } else { - iov[1].iov_base = (char *)&t->bt_bval; + iov[1].iov_base = &t->bt_bval; iov[1].iov_len = 1; status = (dbp->seq)(dbp, &key, &data, R_FIRST); Modified: head/lib/libc/db/recno/rec_open.c ============================================================================== --- head/lib/libc/db/recno/rec_open.c Wed Mar 4 00:56:48 2009 (r189326) +++ head/lib/libc/db/recno/rec_open.c Wed Mar 4 00:58:04 2009 (r189327) @@ -203,7 +203,7 @@ slow: if ((t->bt_rfp = fdopen(rfd, "r" if (openinfo && openinfo->flags & R_SNAPSHOT && !F_ISSET(t, R_EOF | R_INMEM) && t->bt_irec(t, MAX_REC_NUMBER) == RET_ERROR) - goto err; + goto err; return (dbp); einval: errno = EINVAL; Modified: head/lib/libc/db/recno/rec_put.c ============================================================================== --- head/lib/libc/db/recno/rec_put.c Wed Mar 4 00:56:48 2009 (r189326) +++ head/lib/libc/db/recno/rec_put.c Wed Mar 4 00:58:04 2009 (r189327) @@ -169,7 +169,7 @@ einval: errno = EINVAL; t->bt_cursor.rcursor = nrec; break; } - + F_SET(t, R_MODIFIED); return (__rec_ret(t, NULL, nrec, key, NULL)); } Modified: head/lib/libc/db/recno/rec_search.c ============================================================================== --- head/lib/libc/db/recno/rec_search.c Wed Mar 4 00:56:48 2009 (r189326) +++ head/lib/libc/db/recno/rec_search.c Wed Mar 4 00:58:04 2009 (r189327) @@ -47,7 +47,7 @@ __FBSDID("$FreeBSD$"); * Parameters: * t: tree to search * recno: key to find - * op: search operation + * op: search operation * * Returns: * EPG for matching record, if any, or the EPG for the location of the @@ -87,7 +87,7 @@ __rec_search(BTREE *t, recno_t recno, en } BT_PUSH(t, pg, idx - 1); - + pg = r->pgno; switch (op) { case SDELETE: @@ -114,8 +114,8 @@ err: sverrno = errno; --GETRINTERNAL(h, parent->index)->nrecs; else ++GETRINTERNAL(h, parent->index)->nrecs; - mpool_put(t->bt_mp, h, MPOOL_DIRTY); - } + mpool_put(t->bt_mp, h, MPOOL_DIRTY); + } errno = sverrno; return (NULL); } Modified: head/lib/libc/db/recno/rec_seq.c ============================================================================== --- head/lib/libc/db/recno/rec_seq.c Wed Mar 4 00:56:48 2009 (r189326) +++ head/lib/libc/db/recno/rec_seq.c Wed Mar 4 00:58:04 2009 (r189327) @@ -103,7 +103,7 @@ __rec_seq(const DB *dbp, DBT *key, DBT * einval: errno = EINVAL; return (RET_ERROR); } - + if (t->bt_nrecs == 0 || nrec > t->bt_nrecs) { if (!F_ISSET(t, R_EOF | R_INMEM) && (status = t->bt_irec(t, nrec)) != RET_SUCCESS) Modified: head/lib/libc/db/recno/rec_utils.c ============================================================================== --- head/lib/libc/db/recno/rec_utils.c Wed Mar 4 00:56:48 2009 (r189326) +++ head/lib/libc/db/recno/rec_utils.c Wed Mar 4 00:58:04 2009 (r189327) @@ -51,7 +51,7 @@ __FBSDID("$FreeBSD$"); * e: key/data pair to be returned * nrec: record number * key: user's key structure - * data: user's data structure + * data: user's data structure * * Returns: * RET_SUCCESS, RET_ERROR. From owner-svn-src-head@FreeBSD.ORG Wed Mar 4 01:01: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 DE763106566B; Wed, 4 Mar 2009 01:01:26 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D2AA88FC14; Wed, 4 Mar 2009 01:01:26 +0000 (UTC) (envelope-from delphij@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 n2411QAE026366; Wed, 4 Mar 2009 01:01:26 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n2411QNW026364; Wed, 4 Mar 2009 01:01:26 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <200903040101.n2411QNW026364@svn.freebsd.org> From: Xin LI Date: Wed, 4 Mar 2009 01:01: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: r189328 - head/lib/libc/gen 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, 04 Mar 2009 01:01:28 -0000 Author: delphij Date: Wed Mar 4 01:01:26 2009 New Revision: 189328 URL: http://svn.freebsd.org/changeset/base/189328 Log: Sync license changes. Obtained from: NetBSD Modified: head/lib/libc/gen/lockf.3 head/lib/libc/gen/lockf.c Modified: head/lib/libc/gen/lockf.3 ============================================================================== --- head/lib/libc/gen/lockf.3 Wed Mar 4 00:58:04 2009 (r189327) +++ head/lib/libc/gen/lockf.3 Wed Mar 4 01:01:26 2009 (r189328) @@ -1,4 +1,4 @@ -.\" $NetBSD: lockf.3,v 1.2 1998/02/05 18:47:28 perry Exp $ +.\" $NetBSD: lockf.3,v 1.10 2008/04/30 13:10:50 martin Exp $ .\" .\" Copyright (c) 1997 The NetBSD Foundation, Inc. .\" All rights reserved. @@ -14,13 +14,6 @@ .\" 2. Redistributions in binary form must reproduce the above copyright .\" notice, this list of conditions and the following disclaimer in the .\" documentation and/or other materials provided with the distribution. -.\" 3. All advertising materials mentioning features or use of this software -.\" must display the following acknowledgement: -.\" This product includes software developed by the NetBSD -.\" Foundation, Inc. and its contributors. -.\" 4. Neither the name of The NetBSD Foundation nor the names of its -.\" contributors may be used to endorse or promote products derived -.\" from this software without specific prior written permission. .\" .\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS .\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED Modified: head/lib/libc/gen/lockf.c ============================================================================== --- head/lib/libc/gen/lockf.c Wed Mar 4 00:58:04 2009 (r189327) +++ head/lib/libc/gen/lockf.c Wed Mar 4 01:01:26 2009 (r189328) @@ -1,3 +1,4 @@ +/* $NetBSD: lockf.c,v 1.3 2008/04/28 20:22:59 martin Exp $ */ /*- * Copyright (c) 1997 The NetBSD Foundation, Inc. * All rights reserved. @@ -13,13 +14,6 @@ * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the NetBSD - * Foundation, Inc. and its contributors. - * 4. Neither the name of The NetBSD Foundation nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED @@ -34,7 +28,6 @@ * POSSIBILITY OF SUCH DAMAGE. */ -/* $NetBSD: lockf.c,v 1.1 1997/12/20 20:23:18 kleink Exp $ */ #include __FBSDID("$FreeBSD$"); @@ -45,10 +38,7 @@ __FBSDID("$FreeBSD$"); #include "un-namespace.h" int -lockf(filedes, function, size) - int filedes; - int function; - off_t size; +lockf(int filedes, int function, off_t size) { struct flock fl; int cmd; From owner-svn-src-head@FreeBSD.ORG Wed Mar 4 01:17: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 4263E1065676; Wed, 4 Mar 2009 01:17:06 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 07AF98FC18; Wed, 4 Mar 2009 01:17:06 +0000 (UTC) (envelope-from delphij@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 n241H5Tq026733; Wed, 4 Mar 2009 01:17:05 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n241H5aX026732; Wed, 4 Mar 2009 01:17:05 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <200903040117.n241H5aX026732@svn.freebsd.org> From: Xin LI Date: Wed, 4 Mar 2009 01:17: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: r189330 - head/lib/libc/db/hash 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, 04 Mar 2009 01:17:07 -0000 Author: delphij Date: Wed Mar 4 01:17:05 2009 New Revision: 189330 URL: http://svn.freebsd.org/changeset/base/189330 Log: Explicitly specify bit width for on-disk data structure. Obtained from: OpenBSD Modified: head/lib/libc/db/hash/hash.h Modified: head/lib/libc/db/hash/hash.h ============================================================================== --- head/lib/libc/db/hash/hash.h Wed Mar 4 01:10:38 2009 (r189329) +++ head/lib/libc/db/hash/hash.h Wed Mar 4 01:17:05 2009 (r189330) @@ -60,28 +60,28 @@ typedef BUFHEAD **SEGMENT; /* Hash Table Information */ typedef struct hashhdr { /* Disk resident portion */ - int magic; /* Magic NO for hash tables */ - int version; /* Version ID */ + int32_t magic; /* Magic NO for hash tables */ + int32_t version; /* Version ID */ u_int32_t lorder; /* Byte Order */ - int bsize; /* Bucket/Page Size */ - int bshift; /* Bucket shift */ - int dsize; /* Directory Size */ - int ssize; /* Segment Size */ - int sshift; /* Segment shift */ - int ovfl_point; /* Where overflow pages are being + int32_t bsize; /* Bucket/Page Size */ + int32_t bshift; /* Bucket shift */ + int32_t dsize; /* Directory Size */ + int32_t ssize; /* Segment Size */ + int32_t sshift; /* Segment shift */ + int32_t ovfl_point; /* Where overflow pages are being * allocated */ - int last_freed; /* Last overflow page freed */ - int max_bucket; /* ID of Maximum bucket in use */ - int high_mask; /* Mask to modulo into entire table */ - int low_mask; /* Mask to modulo into lower half of + int32_t last_freed; /* Last overflow page freed */ + int32_t max_bucket; /* ID of Maximum bucket in use */ + int32_t high_mask; /* Mask to modulo into entire table */ + int32_t low_mask; /* Mask to modulo into lower half of * table */ - int ffactor; /* Fill factor */ - int nkeys; /* Number of keys in hash table */ - int hdrpages; /* Size of table header */ - int h_charkey; /* value of hash(CHARKEY) */ + int32_t ffactor; /* Fill factor */ + int32_t nkeys; /* Number of keys in hash table */ + int32_t hdrpages; /* Size of table header */ + int32_t h_charkey; /* value of hash(CHARKEY) */ #define NCACHED 32 /* number of bit maps and spare * points */ - int spares[NCACHED];/* spare pages for overflow */ + int32_t spares[NCACHED];/* spare pages for overflow */ u_int16_t bitmaps[NCACHED]; /* address of overflow page * bitmaps */ } HASHHDR; From owner-svn-src-head@FreeBSD.ORG Wed Mar 4 01:31:10 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 6BDC7106564A; Wed, 4 Mar 2009 01:31:10 +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 59AAD8FC14; Wed, 4 Mar 2009 01:31:10 +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 n241VAtJ027012; Wed, 4 Mar 2009 01:31:10 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n241V9tM027011; Wed, 4 Mar 2009 01:31:09 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <200903040131.n241V9tM027011@svn.freebsd.org> From: Pyun YongHyeon Date: Wed, 4 Mar 2009 01:31: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: r189331 - head/tools/tools/ifinfo 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, 04 Mar 2009 01:31:11 -0000 Author: yongari Date: Wed Mar 4 01:31:09 2009 New Revision: 189331 URL: http://svn.freebsd.org/changeset/base/189331 Log: Make ifinfo build. The struct if_data members ifi_recvquota and ifi_xmitquota were renamed to ifi_spare_char1 and ifi_spare_char2 respectively. Modified: head/tools/tools/ifinfo/ifinfo.c Modified: head/tools/tools/ifinfo/ifinfo.c ============================================================================== --- head/tools/tools/ifinfo/ifinfo.c Wed Mar 4 01:17:05 2009 (r189330) +++ head/tools/tools/ifinfo/ifinfo.c Wed Mar 4 01:31:09 2009 (r189331) @@ -169,8 +169,8 @@ printit(const struct ifmibdata *ifmd, co ifmd->ifmd_data.ifi_physical)); printf("\taddress length: %d\n", ifmd->ifmd_data.ifi_addrlen); printf("\theader length: %d\n", ifmd->ifmd_data.ifi_hdrlen); - printf("\treceive quota: %d\n", ifmd->ifmd_data.ifi_recvquota); - printf("\ttransmit quota: %d\n", ifmd->ifmd_data.ifi_xmitquota); + printf("\treceive spare char1: %u\n", ifmd->ifmd_data.ifi_spare_char1); + printf("\ttransmit spare char2: %u\n", ifmd->ifmd_data.ifi_spare_char2); printf("\tmtu: %lu\n", ifmd->ifmd_data.ifi_mtu); printf("\tmetric: %lu\n", ifmd->ifmd_data.ifi_metric); printf("\tline rate: %lu bit/s\n", ifmd->ifmd_data.ifi_baudrate); From owner-svn-src-head@FreeBSD.ORG Wed Mar 4 01:58: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 2BFA2106566B; Wed, 4 Mar 2009 01:58:49 +0000 (UTC) (envelope-from bms@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 008B68FC24; Wed, 4 Mar 2009 01:58:49 +0000 (UTC) (envelope-from bms@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 n241wmhe027757; Wed, 4 Mar 2009 01:58:48 GMT (envelope-from bms@svn.freebsd.org) Received: (from bms@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n241wmnE027756; Wed, 4 Mar 2009 01:58:48 GMT (envelope-from bms@svn.freebsd.org) Message-Id: <200903040158.n241wmnE027756@svn.freebsd.org> From: Bruce M Simpson Date: Wed, 4 Mar 2009 01:58: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: r189335 - head/lib/libc/net 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, 04 Mar 2009 01:58:50 -0000 Author: bms Date: Wed Mar 4 01:58:48 2009 New Revision: 189335 URL: http://svn.freebsd.org/changeset/base/189335 Log: Update copyright. Modified: head/lib/libc/net/sourcefilter.c Modified: head/lib/libc/net/sourcefilter.c ============================================================================== --- head/lib/libc/net/sourcefilter.c Wed Mar 4 01:50:00 2009 (r189334) +++ head/lib/libc/net/sourcefilter.c Wed Mar 4 01:58:48 2009 (r189335) @@ -1,6 +1,6 @@ /*- - * Copyright (c) 2007 Bruce M. Simpson. - * All rights reserved + * Copyright (c) 2007-2009 Bruce Simpson. + * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -10,21 +10,18 @@ * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. - * 4. Neither the name of Bruce M. Simpson nor the names of other - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. * - * THIS SOFTWARE IS PROVIDED BY BRUCE M. SIMPSON AND AFFILIATES - * ``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 BRUCE M. SIMPSON OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. */ #include From owner-svn-src-head@FreeBSD.ORG Wed Mar 4 01:59:14 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 C4F711065677; Wed, 4 Mar 2009 01:59:14 +0000 (UTC) (envelope-from bms@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B2D1C8FC1A; Wed, 4 Mar 2009 01:59:14 +0000 (UTC) (envelope-from bms@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 n241xExE027803; Wed, 4 Mar 2009 01:59:14 GMT (envelope-from bms@svn.freebsd.org) Received: (from bms@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n241xE6w027802; Wed, 4 Mar 2009 01:59:14 GMT (envelope-from bms@svn.freebsd.org) Message-Id: <200903040159.n241xE6w027802@svn.freebsd.org> From: Bruce M Simpson Date: Wed, 4 Mar 2009 01:59: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: r189336 - head/lib/libc/net 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, 04 Mar 2009 01:59:15 -0000 Author: bms Date: Wed Mar 4 01:59:14 2009 New Revision: 189336 URL: http://svn.freebsd.org/changeset/base/189336 Log: Considerably improve the wording of this man page. Modified: head/lib/libc/net/sourcefilter.3 Modified: head/lib/libc/net/sourcefilter.3 ============================================================================== --- head/lib/libc/net/sourcefilter.3 Wed Mar 4 01:58:48 2009 (r189335) +++ head/lib/libc/net/sourcefilter.3 Wed Mar 4 01:59:14 2009 (r189336) @@ -1,15 +1,19 @@ -.\" Copyright (c) 2007 Bruce M. Simpson. All rights reserved. +.\" Copyright (c) 2007-2009 Bruce Simpson. +.\" 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 Bruce M. Simpson ``AS IS'' AND +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -.\" ARE DISCLAIMED. IN NO EVENT SHALL Bruce M. Simpson BE LIABLE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) @@ -20,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd June 12, 2007 +.Dd February 13, 2009 .Dt SOURCEFILTER 3 .Os .Sh NAME @@ -78,25 +82,34 @@ retrieve the multicast source address fi and a multicast .Fa group . .Pp -The protocol-independent functions -.Fn getsourcefilter +The functions +.Fn getipv4sourcefilter and -.Fn setsourcefilter -allow an application to join a multicast group on an interface by -passing its index for the -.Fa interface -argument. +.Fn getsourcefilter +allow an application to discover the filter mode, and +source filter entries, +for an existing group membership. +.Pp +The kernel will always return the number of source filter +entries on the socket for that group in +.Fa *numsrc . +If the +.Fa *numsrc +argument is non-zero, the kernel will attempt to return up to +.Fa *numsrc +filter entries in the array pointed to by +.Fa slist . The -argument. -.Fa grouplen -argument specifies the size of the structure pointed to by -.Fa group . +.Fa *numsrc +argument may be set to 0, in which case the +.Fa slist +argument will be ignored. .Pp For the .Fn setipv4sourcefilter and .Fn setsourcefilter -functions. +functions, the .Fa fmode argument may be used to place the socket into inclusive or exclusive @@ -110,14 +123,57 @@ The argument specifies the number of source entries in the .Fa slist array. -A value of 0 will remove all source filters from the socket. -The changes will be communicated to IGMPv3 and/or MLDv2 routers +If the +.Fa numsrc +argument has a value of 0, +all source filters will be removed from the socket. +Removing all source filters from a membership which is in the +.Dv MCAST_INCLUDE +filter mode will cause the group to be left on that socket. +.Pp +The protocol-independent function +.Fn setsourcefilter +allows an application to join a multicast group on an interface +which may not have an assigned protocol address, +by passing its index for the +.Fa interface +argument. +.Pp +Any changes made by these functions +will be communicated to IGMPv3 and/or MLDv2 routers on the local network as appropriate. +If no IGMPv3 or MLDv2 routers are present, changes in the source filter +lists made by these functions will not cause +state changes to be transmitted, with the exception of any +change which causes a group to be joined or left. +The kernel will continue to maintain the source filter state +regardless of the IGMP or MLD version in use on the link. .Sh IMPLEMENTATION NOTES The IPv4 specific versions of these functions are implemented in terms of the protocol-independent functions. Application writers are encouraged to use the protocol-independent functions -for efficiency, and upwards compatibility with IPv6 networks. +for efficiency, and forwards compatibility with IPv6 networks. +.Pp +For the protocol-independent functions +.Fn getsourcefilter +and +.Fn setsourcefilter , +the argument +.Fa grouplen +argument specifies the size of the structure pointed to by +.Fa group . +This is required in order to differentiate between different +address families. +.Pp +Currently +.Fx +does not support source address selection for the IPv4 +protocol family, therefore the use of multicast APIs with +an unnumbered IPv4 interface is +.Em not recommended. +In all cases, the first assigned IPv4 address on the interface +will be used as the source address of IGMP control traffic. +If this address is removed or changed, the results are undefined. .Sh RETURN VALUES .Rv -std getsourcefilter getipv4sourcefilter setsourcefilter setipv4sourcefilter .Sh ERRORS @@ -164,7 +220,8 @@ operation. .Sh SEE ALSO .Xr ip 4 , .Xr ip6 4 , -.Xr multicast 4 +.Xr multicast 4, +.Xr ifmcstat 8 .Rs .%A D. Thaler .%A B. Fenner From owner-svn-src-head@FreeBSD.ORG Wed Mar 4 02:00:14 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 A145610656C0; Wed, 4 Mar 2009 02:00:14 +0000 (UTC) (envelope-from bms@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 8F2F28FC1C; Wed, 4 Mar 2009 02:00:14 +0000 (UTC) (envelope-from bms@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 n2420Esj027893; Wed, 4 Mar 2009 02:00:14 GMT (envelope-from bms@svn.freebsd.org) Received: (from bms@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n2420Elb027892; Wed, 4 Mar 2009 02:00:14 GMT (envelope-from bms@svn.freebsd.org) Message-Id: <200903040200.n2420Elb027892@svn.freebsd.org> From: Bruce M Simpson Date: Wed, 4 Mar 2009 02:00: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: r189337 - 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: Wed, 04 Mar 2009 02:00:15 -0000 Author: bms Date: Wed Mar 4 02:00:14 2009 New Revision: 189337 URL: http://svn.freebsd.org/changeset/base/189337 Log: Add source-specific multicast (SSM) option documentation. Modified: head/share/man/man4/ip.4 Modified: head/share/man/man4/ip.4 ============================================================================== --- head/share/man/man4/ip.4 Wed Mar 4 01:59:14 2009 (r189336) +++ head/share/man/man4/ip.4 Wed Mar 4 02:00:14 2009 (r189337) @@ -32,7 +32,7 @@ .\" @(#)ip.4 8.2 (Berkeley) 11/30/93 .\" $FreeBSD$ .\" -.Dd April 9, 2007 +.Dd February 13, 2009 .Dt IP 4 .Os .Sh NAME @@ -404,8 +404,9 @@ group and if multicast loopback has not Multicast datagrams with TTL greater than 1 may be forwarded to other networks if a multicast router is attached to the local network. .Pp -For hosts with multiple interfaces, each multicast transmission is -sent from the primary network interface. +For hosts with multiple interfaces, where an interface has not +been specified for a multicast group membership, +each multicast transmission is sent from the primary network interface. The .Dv IP_MULTICAST_IF option overrides the default for @@ -423,12 +424,25 @@ to specify the default interface. .Pp To specify an interface by index, an instance of .Vt ip_mreqn -should be passed instead. +may be passed instead. The .Vt imr_ifindex member should be set to the index of the desired interface, or 0 to specify the default interface. The kernel differentiates between these two structures by their size. +.Pp +The use of +.Vt IP_MULTICAST_IF +is +.Em not recommended , +as multicast memberships are scoped to each +individual interface. +It is supported for legacy use only by applications, +such as routing daemons, which expect to +be able to transmit link-local IPv4 multicast datagrams (224.0.0.0/24) +on multiple interfaces, +without requesting an individual membership for each interface. +.Pp .\" An interface's local IP address and multicast capability can be obtained via the @@ -485,24 +499,32 @@ struct ip_mreq { .Ed .Pp .Va imr_interface -should be set to -.Dv INADDR_ANY -to choose the default multicast interface, -or the +should be set to the .Tn IP address of a particular multicast-capable interface if the host is multihomed. -.\" TODO: Remove this piece when the RFC 3678 API is implemented and -.\" the RFC 1724 hack is removed. -Since -.Fx 4.4 , +It may be set to +.Dv INADDR_ANY +to choose the default interface, although this is not recommended; +this is considered to be the first interface corresponding +to the default route. +Otherwise, the first multicast-capable interface +configured in the system will be used. +.Pp +Prior to +.Fx 7.0 , if the .Va imr_interface member is within the network range .Li 0.0.0.0/8 , it is treated as an interface index in the system interface MIB, as per the RIP Version 2 MIB Extension (RFC-1724). -.\" TODO: Update this piece when IPv4 source-address selection is implemented. +In versions of +.Fx +since 7.0, this behavior is no longer supported. +Developers should +instead use the RFC 3678 multicast source filter APIs; in particular, +.Dv MCAST_JOIN_GROUP . .Pp Up to .Dv IP_MAX_MEMBERSHIPS @@ -511,24 +533,123 @@ Membership is associated with a single i programs running on multihomed hosts may need to join the same group on more than one interface. .Pp +To drop a membership, use: +.Bd -literal +struct ip_mreq mreq; +setsockopt(s, IPPROTO_IP, IP_DROP_MEMBERSHIP, &mreq, sizeof(mreq)); +.Ed +.Pp +where +.Fa mreq +contains the same values as used to add the membership. +Memberships are dropped when the socket is closed or the process exits. +.\" TODO: Update this piece when IPv4 source-address selection is implemented. +.Pp The IGMP protocol uses the primary IP address of the interface as its identifier for group membership. +This is the first IP address configured on the interface. +If this address is removed or changed, the results are +undefined, as the IGMP membership state will then be inconsistent. If multiple IP aliases are configured on the same interface, they will be ignored. +.Pp This shortcoming was addressed in IPv6; MLDv2 requires that the unique link-local address for an interface is used to identify an MLDv2 listener. +.Ss "Source-Specific Multicast Options" +Since +.Fx 8.0 , +the use of Source-Specific Multicast (SSM) is supported. +These extensions require an IGMPv3 multicast router in order to +make best use of them. +If a legacy multicast router is present on the link, +.Fx +will simply downgrade to the version of IGMP spoken by the router, +and the benefits of source filtering on the upstream link +will not be present, although the kernel will continue to +squelch transmissions from blocked sources. +.Pp +Each group membership on a socket now has a filter mode: +.Bl -tag -width MCAST_EXCLUDE +.It Dv MCAST_EXCLUDE +Datagrams sent to this group are accepted, +unless the source is in a list of blocked source addresses. +.It Dv MCAST_INCLUDE +Datagrams sent to this group are accepted +only if the source is in a list of accepted source addresses. +.El .Pp -To drop a membership, use: +Groups joined using the legacy +.Dv IP_ADD_MEMBERSHIP +option are placed in exclusive-mode, +and are able to request that certain sources are blocked or allowed. +This is known as the +.Em delta-based API . +.Pp +To block a multicast source on an existing group membership: .Bd -literal -struct ip_mreq mreq; -setsockopt(s, IPPROTO_IP, IP_DROP_MEMBERSHIP, &mreq, sizeof(mreq)); +struct ip_mreq_source mreqs; +setsockopt(s, IPPROTO_IP, IP_BLOCK_SOURCE, &mreqs, sizeof(mreqs)); .Ed .Pp where -.Fa mreq -contains the same values as used to add the membership. -Memberships are dropped when the socket is closed or the process exits. +.Fa mreqs +is the following structure: +.Bd -literal +struct ip_mreq_source { + struct in_addr imr_multiaddr; /* IP multicast address of group */ + struct in_addr imr_sourceaddr; /* IP address of source */ + struct in_addr imr_interface; /* local IP address of interface */ +} +.Ed +.Va imr_sourceaddr +should be set to the address of the source to be blocked. +.Pp +To unblock a multicast source on an existing group: +.Bd -literal +struct ip_mreq_source mreqs; +setsockopt(s, IPPROTO_IP, IP_UNBLOCK_SOURCE, &mreqs, sizeof(mreqs)); +.Ed +.Pp +The +.Dv IP_BLOCK_SOURCE +and +.Dv IP_UNBLOCK_SOURCE +options are +.Em not permitted +for inclusive-mode group memberships. +.Pp +To join a multicast group in +.Dv MCAST_INCLUDE +mode with a single source, +or add another source to an existing inclusive-mode membership: +.Bd -literal +struct ip_mreq_source mreqs; +setsockopt(s, IPPROTO_IP, IP_ADD_SOURCE_MEMBERSHIP, &mreqs, sizeof(mreqs)); +.Ed +.Pp +To leave a single source from an existing group in inclusive mode: +.Bd -literal +struct ip_mreq_source mreqs; +setsockopt(s, IPPROTO_IP, IP_DROP_SOURCE_MEMBERSHIP, &mreqs, sizeof(mreqs)); +.Ed +If this is the last accepted source for the group, the membership +will be dropped. +.Pp +The +.Dv IP_ADD_SOURCE_MEMBERSHIP +and +.Dv IP_DROP_SOURCE_MEMBERSHIP +options are +.Em not accepted +for exclusive-mode group memberships. +However, both exclusive and inclusive mode memberships +support the use of the +.Em full-state API +documented in RFC 3678. +For management of source filter lists using this API, +please refer to +.Xr sourcefilter 3 . .\"----------------------- .Ss "Raw IP Sockets" .Pp @@ -676,7 +797,16 @@ field was not equal to the length of the .Xr icmp 4 , .Xr inet 4 , .Xr intro 4 , -.Xr multicast 4 +.Xr multicast 4 , +.Xr sourcefilter 3 +.Rs +.%A D. Thaler +.%A B. Fenner +.%A B. Quinn +.%T "Socket Interface Extensions for Multicast Source Filters" +.%N RFC 3678 +.%D Jan 2004 +.Re .Sh HISTORY The .Nm From owner-svn-src-head@FreeBSD.ORG Wed Mar 4 02:00: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 82C291065676; Wed, 4 Mar 2009 02:00:34 +0000 (UTC) (envelope-from bms@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 71B8B8FC0A; Wed, 4 Mar 2009 02:00:34 +0000 (UTC) (envelope-from bms@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 n2420Yww027936; Wed, 4 Mar 2009 02:00:34 GMT (envelope-from bms@svn.freebsd.org) Received: (from bms@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n2420YqD027935; Wed, 4 Mar 2009 02:00:34 GMT (envelope-from bms@svn.freebsd.org) Message-Id: <200903040200.n2420YqD027935@svn.freebsd.org> From: Bruce M Simpson Date: Wed, 4 Mar 2009 02:00: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: r189338 - 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: Wed, 04 Mar 2009 02:00:35 -0000 Author: bms Date: Wed Mar 4 02:00:34 2009 New Revision: 189338 URL: http://svn.freebsd.org/changeset/base/189338 Log: Add cross-reference to sourcefilter(3). Modified: head/share/man/man4/multicast.4 Modified: head/share/man/man4/multicast.4 ============================================================================== --- head/share/man/man4/multicast.4 Wed Mar 4 02:00:14 2009 (r189337) +++ head/share/man/man4/multicast.4 Wed Mar 4 02:00:34 2009 (r189338) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd March 18, 2007 +.Dd February 13, 2009 .Dt MULTICAST 4 .Os .\" @@ -954,6 +954,7 @@ after the previous upcall. .Xr recvmsg 2 , .Xr setsockopt 2 , .Xr socket 2 , +.Xr sourcefilter 3 , .Xr icmp6 4 , .Xr inet 4 , .Xr inet6 4 , From owner-svn-src-head@FreeBSD.ORG Wed Mar 4 02:08:20 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 A77161065670; Wed, 4 Mar 2009 02:08:20 +0000 (UTC) (envelope-from bms@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 959928FC18; Wed, 4 Mar 2009 02:08:20 +0000 (UTC) (envelope-from bms@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 n2428KTt028117; Wed, 4 Mar 2009 02:08:20 GMT (envelope-from bms@svn.freebsd.org) Received: (from bms@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n2428KQY028116; Wed, 4 Mar 2009 02:08:20 GMT (envelope-from bms@svn.freebsd.org) Message-Id: <200903040208.n2428KQY028116@svn.freebsd.org> From: Bruce M Simpson Date: Wed, 4 Mar 2009 02:08:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r189339 - head/usr.sbin/mtest 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, 04 Mar 2009 02:08:21 -0000 Author: bms Date: Wed Mar 4 02:08:20 2009 New Revision: 189339 URL: http://svn.freebsd.org/changeset/base/189339 Log: Update mtest(8) manual page. Modified: head/usr.sbin/mtest/mtest.8 Modified: head/usr.sbin/mtest/mtest.8 ============================================================================== --- head/usr.sbin/mtest/mtest.8 Wed Mar 4 02:00:34 2009 (r189338) +++ head/usr.sbin/mtest/mtest.8 Wed Mar 4 02:08:20 2009 (r189339) @@ -1,8 +1,32 @@ .\" +.\" Copyright (c) 2007-2009 Bruce Simpson. +.\" 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$ .\" -.\" The following requests are required for all man pages. -.Dd March 8, 2007 +.Dd March 3, 2009 .Os .Dt MTEST 8 .Sh NAME @@ -17,19 +41,33 @@ utility is a small program for testing the multicast membership socket operations and ioctls. It accepts the following commands, interactively: -.Bl -tag -width "a ifname e.e.e.e.e.e" -compact -offset indent -.It Ic j Ar g.g.g.g Ar i.i.i.i +.Bl -tag -width "a ifname e.e.e.e e.e.e.e" -compact -offset indent +.It Ic j Ar g.g.g.g Ar i.i.i.i Op Ar s.s.s.s Join the IP group address .Ar g.g.g.g on the interface with address .Ar i.i.i.i . +.Pp +If an optional source +.Ar s.s.s.s +is specified, a source-specific join will be performed; +if +.Nm +is already a member of the group, the source +will be added to its filter list. +.Pp .Ar i.i.i.i -may be specified as 0.0.0.0 to use the default interface. -.It Ic l Ar g.g.g.g Ar i.i.i.i +may be specified as 0.0.0.0 to use the default interface, +although this is legacy behaviour and is not recommended, +as group memberships are keyed to each individual link. +.It Ic l Ar g.g.g.g Ar i.i.i.i Op Ar s.s.s.s Leave the IP group address .Ar g.g.g.g on the interface with address .Ar i.i.i.i . +If a source +.Ar s.s.s.s +is specified, only that source will be left. .It Ic a Ar ifname Ar e.e.e.e.e.e Join the Ethernet group address .Ar e.e.e.e.e.e @@ -115,5 +153,6 @@ Quit the program. .Re .Sh AUTHORS .An -split +.An "Bruce Simpson" .An "Steve Deering" .An "Wilbert De Graaf" From owner-svn-src-head@FreeBSD.ORG Wed Mar 4 02:09: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 39E701065672; Wed, 4 Mar 2009 02:09:13 +0000 (UTC) (envelope-from bms@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 18F7A8FC17; Wed, 4 Mar 2009 02:09:13 +0000 (UTC) (envelope-from bms@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 n2429CaU028173; Wed, 4 Mar 2009 02:09:12 GMT (envelope-from bms@svn.freebsd.org) Received: (from bms@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n2429Cj6028172; Wed, 4 Mar 2009 02:09:12 GMT (envelope-from bms@svn.freebsd.org) Message-Id: <200903040209.n2429Cj6028172@svn.freebsd.org> From: Bruce M Simpson Date: Wed, 4 Mar 2009 02: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: r189340 - head/usr.sbin/mtest 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, 04 Mar 2009 02:09:13 -0000 Author: bms Date: Wed Mar 4 02:09:12 2009 New Revision: 189340 URL: http://svn.freebsd.org/changeset/base/189340 Log: Add full SSM stack support to mtest(8) diagnostic tool. Modified: head/usr.sbin/mtest/mtest.c Modified: head/usr.sbin/mtest/mtest.c ============================================================================== --- head/usr.sbin/mtest/mtest.c Wed Mar 4 02:08:20 2009 (r189339) +++ head/usr.sbin/mtest/mtest.c Wed Mar 4 02:09:12 2009 (r189340) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2007 Bruce M. Simpson. + * Copyright (c) 2007-2009 Bruce Simpson. * Copyright (c) 2000 Wilbert De Graaf. * All rights reserved. * @@ -55,26 +55,21 @@ __FBSDID("$FreeBSD$"); #include #include -/* The following two socket options are private to the kernel and libc. */ - -#ifndef IP_SETMSFILTER -#define IP_SETMSFILTER 74 /* atomically set filter list */ -#endif -#ifndef IP_GETMSFILTER -#define IP_GETMSFILTER 75 /* get filter list */ -#endif - static void process_file(char *, int); static void process_cmd(char*, int, FILE *fp); static void usage(void); -#ifdef WITH_IGMPV3 -static int inaddr_cmp(const void *a, const void *b); -#endif #define MAX_ADDRS 20 #define STR_SIZE 20 #define LINE_LENGTH 80 +static int +inaddr_cmp(const void *a, const void *b) +{ + return ((int)((const struct in_addr *)a)->s_addr - + ((const struct in_addr *)b)->s_addr); +} + int main(int argc, char **argv) { @@ -145,17 +140,13 @@ process_cmd(char *cmd, int s, FILE *fp _ char str1[STR_SIZE]; char str2[STR_SIZE]; char str3[STR_SIZE]; -#ifdef WITH_IGMPV3 - char filtbuf[IP_MSFILTER_SIZE(MAX_ADDRS)]; -#endif + struct in_addr sources[MAX_ADDRS]; struct ifreq ifr; struct ip_mreq imr; struct ip_mreq_source imrs; -#ifdef WITH_IGMPV3 - struct ip_msfilter *imsfp; -#endif char *line; - int n, opt, f, flags; + uint32_t fmode; + int i, n, opt, f, flags; line = cmd; while (isblank(*++line)) @@ -181,20 +172,51 @@ process_cmd(char *cmd, int s, FILE *fp _ case 'j': case 'l': - sscanf(line, "%s %s", str1, str2); - if (((imr.imr_multiaddr.s_addr = inet_addr(str1)) == - INADDR_NONE) || - ((imr.imr_interface.s_addr = inet_addr(str2)) == - INADDR_NONE)) { - printf("-1\n"); - break; + str3[0] = '\0'; + sscanf(line, "%s %s %s", str1, str2, str3); + if ((imrs.imr_sourceaddr.s_addr = inet_addr(str3)) != + INADDR_NONE) { + /* + * inclusive mode join with source, possibly + * on existing membership. + */ + if (((imrs.imr_multiaddr.s_addr = inet_addr(str1)) == + INADDR_NONE) || + ((imrs.imr_interface.s_addr = inet_addr(str2)) == + INADDR_NONE)) { + printf("-1\n"); + break; + } + opt = (*cmd == 'j') ? IP_ADD_SOURCE_MEMBERSHIP : + IP_DROP_SOURCE_MEMBERSHIP; + if (setsockopt( s, IPPROTO_IP, opt, &imrs, + sizeof(imrs)) != 0) { + warn("setsockopt %s", (*cmd == 'j') ? + "IP_ADD_SOURCE_MEMBERSHIP" : + "IP_DROP_SOURCE_MEMBERSHIP"); + } else { + printf("ok\n"); + } + } else { + /* exclusive mode join w/o source. */ + if (((imr.imr_multiaddr.s_addr = inet_addr(str1)) == + INADDR_NONE) || + ((imr.imr_interface.s_addr = inet_addr(str2)) == + INADDR_NONE)) { + printf("-1\n"); + break; + } + opt = (*cmd == 'j') ? IP_ADD_MEMBERSHIP : + IP_DROP_MEMBERSHIP; + if (setsockopt( s, IPPROTO_IP, opt, &imr, + sizeof(imr)) != 0) { + warn("setsockopt %s", (*cmd == 'j') ? + "IP_ADD_MEMBERSHIP" : + "IP_DROP_MEMBERSHIP"); + } else { + printf("ok\n"); + } } - opt = (*cmd == 'j') ? IP_ADD_MEMBERSHIP : IP_DROP_MEMBERSHIP; - if (setsockopt( s, IPPROTO_IP, opt, &imr, - sizeof(imr)) != 0) - warn("setsockopt IP_ADD_MEMBERSHIP/IP_DROP_MEMBERSHIP"); - else - printf("ok\n"); break; case 'a': @@ -233,6 +255,7 @@ process_cmd(char *cmd, int s, FILE *fp _ printf("warning: IFF_ALLMULTI cannot be set from userland " "in FreeBSD; command ignored.\n"); break; + case 'p': if (sscanf(line, "%s %u", ifr.ifr_name, &f) != 2) { printf("-1\n"); @@ -257,7 +280,6 @@ process_cmd(char *cmd, int s, FILE *fp _ printf( "changed to 0x%08x\n", flags ); break; -#ifdef WITH_IGMPV3 /* * Set the socket to include or exclude filter mode, and * add some sources to the filterlist, using the full-state, @@ -265,42 +287,38 @@ process_cmd(char *cmd, int s, FILE *fp _ */ case 'i': case 'e': - /* XXX: SIOCSIPMSFILTER will be made an internal API. */ + n = 0; + fmode = (*cmd == 'i') ? MCAST_INCLUDE : MCAST_EXCLUDE; if ((sscanf(line, "%s %s %d", str1, str2, &n)) != 3) { printf("-1\n"); break; } - imsfp = (struct ip_msfilter *)filtbuf; - if (((imsfp->imsf_multiaddr.s_addr = inet_addr(str1)) == + /* recycle imrs struct for convenience */ + if (((imrs.imr_multiaddr.s_addr = inet_addr(str1)) == INADDR_NONE) || - ((imsfp->imsf_interface.s_addr = inet_addr(str2)) == - INADDR_NONE) || (n > MAX_ADDRS)) { + ((imrs.imr_interface.s_addr = inet_addr(str2)) == + INADDR_NONE) || (n < 0 || n > MAX_ADDRS)) { printf("-1\n"); break; } - imsfp->imsf_fmode = (*cmd == 'i') ? MCAST_INCLUDE : - MCAST_EXCLUDE; - imsfp->imsf_numsrc = n; for (i = 0; i < n; i++) { fgets(str1, sizeof(str1), fp); - if ((imsfp->imsf_slist[i].s_addr = inet_addr(str1)) == + if ((sources[i].s_addr = inet_addr(str1)) == INADDR_NONE) { printf("-1\n"); return; } } - if (ioctl(s, SIOCSIPMSFILTER, imsfp) != 0) - warn("setsockopt SIOCSIPMSFILTER"); + if (setipv4sourcefilter(s, imrs.imr_interface, + imrs.imr_multiaddr, fmode, n, sources) != 0) + warn("getipv4sourcefilter"); else printf("ok\n"); break; -#endif /* WITH_IGMPV3 */ /* * Allow or block traffic from a source, using the * delta based api. - * XXX: Currently we allow this to be used with the ASM-only - * implementation of RFC3678 in FreeBSD 7. */ case 't': case 'b': @@ -314,24 +332,14 @@ process_cmd(char *cmd, int s, FILE *fp _ printf("-1\n"); break; } - -#ifdef WITH_IGMPV3 - /* XXX: SIOCSIPMSFILTER will be made an internal API. */ - /* First determine out current filter mode. */ - imsfp = (struct ip_msfilter *)filtbuf; - imsfp->imsf_multiaddr.s_addr = imrs.imr_multiaddr.s_addr; - imsfp->imsf_interface.s_addr = imrs.imr_interface.s_addr; - imsfp->imsf_numsrc = 5; - if (ioctl(s, SIOCSIPMSFILTER, imsfp) != 0) { - /* It's only okay for 't' to fail */ - if (*cmd != 't') { - warn("ioctl SIOCSIPMSFILTER"); - break; - } else { - imsfp->imsf_fmode = MCAST_INCLUDE; - } + /* First determine our current filter mode. */ + n = 0; + if (getipv4sourcefilter(s, imrs.imr_interface, + imrs.imr_multiaddr, &fmode, &n, NULL) != 0) { + warn("getipv4sourcefilter"); + break; } - if (imsfp->imsf_fmode == MCAST_EXCLUDE) { + if (fmode == MCAST_EXCLUDE) { /* Any source */ opt = (*cmd == 't') ? IP_UNBLOCK_SOURCE : IP_BLOCK_SOURCE; @@ -340,60 +348,37 @@ process_cmd(char *cmd, int s, FILE *fp _ opt = (*cmd == 't') ? IP_ADD_SOURCE_MEMBERSHIP : IP_DROP_SOURCE_MEMBERSHIP; } -#else /* !WITH_IGMPV3 */ - /* - * Don't look before we leap; we may only block or unblock - * sources on a socket in exclude mode. - */ - opt = (*cmd == 't') ? IP_UNBLOCK_SOURCE : IP_BLOCK_SOURCE; -#endif /* WITH_IGMPV3 */ if (setsockopt(s, IPPROTO_IP, opt, &imrs, sizeof(imrs)) == -1) warn("ioctl IP_ADD_SOURCE_MEMBERSHIP/IP_DROP_SOURCE_MEMBERSHIP/IP_UNBLOCK_SOURCE/IP_BLOCK_SOURCE"); else printf("ok\n"); break; -#ifdef WITH_IGMPV3 case 'g': - /* XXX: SIOCSIPMSFILTER will be made an internal API. */ if ((sscanf(line, "%s %s %d", str1, str2, &n)) != 3) { printf("-1\n"); break; } - imsfp = (struct ip_msfilter *)filtbuf; - if (((imsfp->imsf_multiaddr.s_addr = inet_addr(str1)) == + /* recycle imrs struct for convenience */ + if (((imrs.imr_multiaddr.s_addr = inet_addr(str1)) == INADDR_NONE) || - ((imsfp->imsf_interface.s_addr = inet_addr(str2)) == + ((imrs.imr_interface.s_addr = inet_addr(str2)) == INADDR_NONE) || (n < 0 || n > MAX_ADDRS)) { printf("-1\n"); break; } - imsfp->imsf_numsrc = n; - if (ioctl(s, SIOCSIPMSFILTER, imsfp) != 0) { - warn("setsockopt SIOCSIPMSFILTER"); + if (getipv4sourcefilter(s, imrs.imr_interface, + imrs.imr_multiaddr, &fmode, &n, sources) != 0) { + warn("getipv4sourcefilter"); break; } - printf("%s\n", (imsfp->imsf_fmode == MCAST_INCLUDE) ? - "include" : "exclude"); - printf("%d\n", imsfp->imsf_numsrc); - if (n >= imsfp->imsf_numsrc) { - n = imsfp->imsf_numsrc; - qsort(imsfp->imsf_slist, n, sizeof(struct in_addr), - &inaddr_cmp); - for (i = 0; i < n; i++) - printf("%s\n", inet_ntoa(imsfp->imsf_slist[i])); - } - break; -#endif /* !WITH_IGMPV3 */ - -#ifndef WITH_IGMPV3 - case 'i': - case 'e': - case 'g': - printf("warning: IGMPv3 is not supported by this version " - "of FreeBSD; command ignored.\n"); + printf("%s\n", (fmode == MCAST_INCLUDE) ? "include" : + "exclude"); + printf("%d\n", n); + qsort(sources, n, sizeof(struct in_addr), &inaddr_cmp); + for (i = 0; i < n; i++) + printf("%s\n", inet_ntoa(sources[i])); break; -#endif /* WITH_IGMPV3 */ case '\n': break; @@ -407,31 +392,18 @@ static void usage(void) { - printf("j g.g.g.g i.i.i.i - join IP multicast group\n"); - printf("l g.g.g.g i.i.i.i - leave IP multicast group\n"); + printf("j g.g.g.g i.i.i.i [s.s.s.s] - join IP multicast group\n"); + printf("l g.g.g.g i.i.i.i [s.s.s.s] - leave IP multicast group\n"); printf("a ifname e.e.e.e.e.e - add ether multicast address\n"); printf("d ifname e.e.e.e.e.e - delete ether multicast address\n"); printf("m ifname 1/0 - set/clear ether allmulti flag\n"); printf("p ifname 1/0 - set/clear ether promisc flag\n"); -#ifdef WITH_IGMPv3 printf("i g.g.g.g i.i.i.i n - set n include mode src filter\n"); printf("e g.g.g.g i.i.i.i n - set n exclude mode src filter\n"); -#endif printf("t g.g.g.g i.i.i.i s.s.s.s - allow traffic from src\n"); printf("b g.g.g.g i.i.i.i s.s.s.s - block traffic from src\n"); -#ifdef WITH_IGMPV3 printf("g g.g.g.g i.i.i.i n - get and show n src filters\n"); -#endif printf("f filename - read command(s) from file\n"); printf("s seconds - sleep for some time\n"); printf("q - quit\n"); } - -#ifdef WITH_IGMPV3 -static int -inaddr_cmp(const void *a, const void *b) -{ - return((int)((const struct in_addr *)a)->s_addr - - ((const struct in_addr *)b)->s_addr); -} -#endif From owner-svn-src-head@FreeBSD.ORG Wed Mar 4 02:12: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 8F4A71065679; Wed, 4 Mar 2009 02:12:30 +0000 (UTC) (envelope-from bms@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 638E98FC08; Wed, 4 Mar 2009 02:12:30 +0000 (UTC) (envelope-from bms@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 n242CUCK028307; Wed, 4 Mar 2009 02:12:30 GMT (envelope-from bms@svn.freebsd.org) Received: (from bms@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n242CUa0028306; Wed, 4 Mar 2009 02:12:30 GMT (envelope-from bms@svn.freebsd.org) Message-Id: <200903040212.n242CUa0028306@svn.freebsd.org> From: Bruce M Simpson Date: Wed, 4 Mar 2009 02:12: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: r189341 - head/usr.sbin/ifmcstat 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, 04 Mar 2009 02:12:31 -0000 Author: bms Date: Wed Mar 4 02:12:29 2009 New Revision: 189341 URL: http://svn.freebsd.org/changeset/base/189341 Log: Add printb.c utility file, but do not yet connect it to the build. Added: head/usr.sbin/ifmcstat/printb.c (contents, props changed) Added: head/usr.sbin/ifmcstat/printb.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/usr.sbin/ifmcstat/printb.c Wed Mar 4 02:12:29 2009 (r189341) @@ -0,0 +1,64 @@ +/* + * Copyright (c) 1983, 1993 + * The Regents of the University of California. 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. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include + +/* + * Print a value a la the %b format of the kernel's printf + */ +void +printb(const char *s, unsigned int v, const char *bits) +{ + int i, any = 0; + char c; + + if (bits && *bits == 8) + printf("%s=%o", s, v); + else + printf("%s=%x", s, v); + bits++; + if (bits) { + putchar('<'); + while ((i = *bits++) != '\0') { + if (v & (1 << (i-1))) { + if (any) + putchar(','); + any = 1; + for (; (c = *bits) > 32; bits++) + putchar(c); + } else + for (; *bits > 32; bits++) + ; + } + putchar('>'); + } +} From owner-svn-src-head@FreeBSD.ORG Wed Mar 4 02:51: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 4FFE01065672; Wed, 4 Mar 2009 02:51:23 +0000 (UTC) (envelope-from bms@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 24C758FC22; Wed, 4 Mar 2009 02:51:23 +0000 (UTC) (envelope-from bms@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 n242pNxC029148; Wed, 4 Mar 2009 02:51:23 GMT (envelope-from bms@svn.freebsd.org) Received: (from bms@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n242pMtM029146; Wed, 4 Mar 2009 02:51:23 GMT (envelope-from bms@svn.freebsd.org) Message-Id: <200903040251.n242pMtM029146@svn.freebsd.org> From: Bruce M Simpson Date: Wed, 4 Mar 2009 02:51:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r189343 - head/sys/netinet X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 04 Mar 2009 02:51:23 -0000 Author: bms Date: Wed Mar 4 02:51:22 2009 New Revision: 189343 URL: http://svn.freebsd.org/changeset/base/189343 Log: Add function ip_checkrouteralert(), which will be used by IGMPv3 to check for the IPv4 Router Alert [RFC2113] option in a pulled-up IP mbuf chain. Modified: head/sys/netinet/ip_options.c head/sys/netinet/ip_options.h Modified: head/sys/netinet/ip_options.c ============================================================================== --- head/sys/netinet/ip_options.c Wed Mar 4 02:38:38 2009 (r189342) +++ head/sys/netinet/ip_options.c Wed Mar 4 02:51:22 2009 (r189343) @@ -683,3 +683,64 @@ bad: (void)m_free(m); return (EINVAL); } + +/* + * Check for the presence of the IP Router Alert option [RFC2113] + * in the header of an IPv4 datagram. + * + * This call is not intended for use from the forwarding path; it is here + * so that protocol domains may check for the presence of the option. + * Given how FreeBSD's IPv4 stack is currently structured, the Router Alert + * option does not have much relevance to the implementation, though this + * may change in future. + * Router alert options SHOULD be passed if running in IPSTEALTH mode and + * we are not the endpoint. + * Length checks on individual options should already have been peformed + * by ip_dooptions() therefore they are folded under INVARIANTS here. + * + * Return zero if not present or options are invalid, non-zero if present. + */ +int +ip_checkrouteralert(struct mbuf *m) +{ + struct ip *ip = mtod(m, struct ip *); + u_char *cp; + int opt, optlen, cnt, found_ra; + + found_ra = 0; + cp = (u_char *)(ip + 1); + cnt = (ip->ip_hl << 2) - sizeof (struct ip); + for (; cnt > 0; cnt -= optlen, cp += optlen) { + opt = cp[IPOPT_OPTVAL]; + if (opt == IPOPT_EOL) + break; + if (opt == IPOPT_NOP) + optlen = 1; + else { +#ifdef INVARIANTS + if (cnt < IPOPT_OLEN + sizeof(*cp)) + break; +#endif + optlen = cp[IPOPT_OLEN]; +#ifdef INVARIANTS + if (optlen < IPOPT_OLEN + sizeof(*cp) || optlen > cnt) + break; +#endif + } + switch (opt) { + case IPOPT_RA: +#ifdef INVARIANTS + if (optlen != IPOPT_OFFSET + sizeof(uint16_t) || + (*((uint16_t *)&cp[IPOPT_OFFSET]) != 0)) + break; + else +#endif + found_ra = 1; + break; + default: + break; + } + } + + return (found_ra); +} Modified: head/sys/netinet/ip_options.h ============================================================================== --- head/sys/netinet/ip_options.h Wed Mar 4 02:38:38 2009 (r189342) +++ head/sys/netinet/ip_options.h Wed Mar 4 02:51:22 2009 (r189343) @@ -49,6 +49,7 @@ struct ipopt_tag { extern int ip_doopts; /* process or ignore IP options */ +int ip_checkrouteralert(struct mbuf *); int ip_dooptions(struct mbuf *, int); struct mbuf *ip_insertoptions(struct mbuf *, struct mbuf *, int *); int ip_optcopy(struct ip *, struct ip *); From owner-svn-src-head@FreeBSD.ORG Wed Mar 4 02:54: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 2F5C31065672; Wed, 4 Mar 2009 02:54:12 +0000 (UTC) (envelope-from bms@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 1E9128FC25; Wed, 4 Mar 2009 02:54:12 +0000 (UTC) (envelope-from bms@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 n242sBUg029230; Wed, 4 Mar 2009 02:54:11 GMT (envelope-from bms@svn.freebsd.org) Received: (from bms@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n242sBQU029229; Wed, 4 Mar 2009 02:54:11 GMT (envelope-from bms@svn.freebsd.org) Message-Id: <200903040254.n242sBQU029229@svn.freebsd.org> From: Bruce M Simpson Date: Wed, 4 Mar 2009 02:54: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: r189344 - head/sys/net 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, 04 Mar 2009 02:54:12 -0000 Author: bms Date: Wed Mar 4 02:54:11 2009 New Revision: 189344 URL: http://svn.freebsd.org/changeset/base/189344 Log: Reserve a netisr slot for the IGMPv3 output queue. Modified: head/sys/net/netisr.h Modified: head/sys/net/netisr.h ============================================================================== --- head/sys/net/netisr.h Wed Mar 4 02:51:22 2009 (r189343) +++ head/sys/net/netisr.h Wed Mar 4 02:54:11 2009 (r189344) @@ -46,6 +46,7 @@ */ #define NETISR_POLL 0 /* polling callback, must be first */ #define NETISR_IP 2 /* same as AF_INET */ +#define NETISR_IGMP 3 /* IGMPv3 output queue */ #define NETISR_ROUTE 14 /* routing socket */ #define NETISR_AARP 15 /* Appletalk ARP */ #define NETISR_ATALK2 16 /* Appletalk phase 2 */ From owner-svn-src-head@FreeBSD.ORG Wed Mar 4 02:55: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 53EDB1065670; Wed, 4 Mar 2009 02:55:05 +0000 (UTC) (envelope-from bms@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 42D5A8FC25; Wed, 4 Mar 2009 02:55:05 +0000 (UTC) (envelope-from bms@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 n242t5Ba029309; Wed, 4 Mar 2009 02:55:05 GMT (envelope-from bms@svn.freebsd.org) Received: (from bms@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n242t5kt029308; Wed, 4 Mar 2009 02:55:05 GMT (envelope-from bms@svn.freebsd.org) Message-Id: <200903040255.n242t5kt029308@svn.freebsd.org> From: Bruce M Simpson Date: Wed, 4 Mar 2009 02:55: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: r189345 - 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: Wed, 04 Mar 2009 02:55:05 -0000 Author: bms Date: Wed Mar 4 02:55:04 2009 New Revision: 189345 URL: http://svn.freebsd.org/changeset/base/189345 Log: Overlay a uint16_t field suitable for use by the IGMPv3 code. It is used to maintain the number of group records contained in a pending IGMPv3 output mbuf chain. Modified: head/sys/sys/mbuf.h Modified: head/sys/sys/mbuf.h ============================================================================== --- head/sys/sys/mbuf.h Wed Mar 4 02:54:11 2009 (r189344) +++ head/sys/sys/mbuf.h Wed Mar 4 02:55:04 2009 (r189345) @@ -122,9 +122,13 @@ struct pkthdr { int csum_flags; /* flags regarding checksum */ int csum_data; /* data field used by csum routines */ u_int16_t tso_segsz; /* TSO segment size */ - u_int16_t ether_vtag; /* Ethernet 802.1p+q vlan tag */ + union { + u_int16_t vt_vtag; /* Ethernet 802.1p+q vlan tag */ + u_int16_t vt_nrecs; /* # of IGMPv3 records in this chain */ + } PH_vt; SLIST_HEAD(packet_tags, m_tag) tags; /* list of packet tags */ }; +#define ether_vtag PH_vt.vt_vtag /* * Description of external storage mapped into mbuf; valid only if M_EXT is From owner-svn-src-head@FreeBSD.ORG Wed Mar 4 03:01: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 9DC05106566C; Wed, 4 Mar 2009 03:01:05 +0000 (UTC) (envelope-from bms@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 4778E8FC0C; Wed, 4 Mar 2009 03:01:05 +0000 (UTC) (envelope-from bms@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 n24315c5029582; Wed, 4 Mar 2009 03:01:05 GMT (envelope-from bms@svn.freebsd.org) Received: (from bms@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n24315RT029581; Wed, 4 Mar 2009 03:01:05 GMT (envelope-from bms@svn.freebsd.org) Message-Id: <200903040301.n24315RT029581@svn.freebsd.org> From: Bruce M Simpson Date: Wed, 4 Mar 2009 03:01: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: r189346 - head/sys/netinet X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 04 Mar 2009 03:01:06 -0000 Author: bms Date: Wed Mar 4 03:01:05 2009 New Revision: 189346 URL: http://svn.freebsd.org/changeset/base/189346 Log: Add various defines/macros required by IGMPv3: * MCAST_UNDEFINED state. * in_allhosts() macro (group is 224.0.0.1). This uses a const endian comparison. * IP_MAX_GROUP_SRC_FILTER, IP_MAX_SOCK_SRC_FILTER default resource limits. Modified: head/sys/netinet/in.h Modified: head/sys/netinet/in.h ============================================================================== --- head/sys/netinet/in.h Wed Mar 4 02:55:04 2009 (r189345) +++ head/sys/netinet/in.h Wed Mar 4 03:01:05 2009 (r189346) @@ -501,7 +501,14 @@ __END_DECLS */ #define IP_MIN_MEMBERSHIPS 31 #define IP_MAX_MEMBERSHIPS 4095 -#define IP_MAX_SOURCE_FILTER 1024 /* # of filters per socket, per group */ +#define IP_MAX_SOURCE_FILTER 1024 /* XXX to be unused */ + +/* + * Default resource limits for IPv4 multicast source filtering. + * These may be modified by sysctl. + */ +#define IP_MAX_GROUP_SRC_FILTER 512 /* sources per group */ +#define IP_MAX_SOCK_SRC_FILTER 128 /* sources per socket/group */ /* * Argument structure for IP_ADD_MEMBERSHIP and IP_DROP_MEMBERSHIP. @@ -584,6 +591,7 @@ int getsourcefilter(int, uint32_t, struc /* * Filter modes; also used to represent per-socket filter mode internally. */ +#define MCAST_UNDEFINED 0 /* fmode: not yet defined */ #define MCAST_INCLUDE 1 /* fmode: include these source(s) */ #define MCAST_EXCLUDE 2 /* fmode: exclude these source(s) */ @@ -731,6 +739,7 @@ void in_ifdetach(struct ifnet *); #define in_hosteq(s, t) ((s).s_addr == (t).s_addr) #define in_nullhost(x) ((x).s_addr == INADDR_ANY) +#define in_allhosts(x) ((x).s_addr == htonl(INADDR_ALLHOSTS_GROUP)) #define satosin(sa) ((struct sockaddr_in *)(sa)) #define sintosa(sin) ((struct sockaddr *)(sin)) From owner-svn-src-head@FreeBSD.ORG Wed Mar 4 03:22: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 EC856106564A; Wed, 4 Mar 2009 03:22:03 +0000 (UTC) (envelope-from bms@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id DB0C58FC0C; Wed, 4 Mar 2009 03:22:03 +0000 (UTC) (envelope-from bms@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 n243M33K030110; Wed, 4 Mar 2009 03:22:03 GMT (envelope-from bms@svn.freebsd.org) Received: (from bms@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n243M3mh030109; Wed, 4 Mar 2009 03:22:03 GMT (envelope-from bms@svn.freebsd.org) Message-Id: <200903040322.n243M3mh030109@svn.freebsd.org> From: Bruce M Simpson Date: Wed, 4 Mar 2009 03:22:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r189347 - head/sys/netinet X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 04 Mar 2009 03:22:04 -0000 Author: bms Date: Wed Mar 4 03:22:03 2009 New Revision: 189347 URL: http://svn.freebsd.org/changeset/base/189347 Log: Merge header file definitions used by the new IGMPv3 implementation. This is a partial merge. Compatibility defines are retained for the existing IGMPv2 implementation. Modified: head/sys/netinet/igmp.h Modified: head/sys/netinet/igmp.h ============================================================================== --- head/sys/netinet/igmp.h Wed Mar 4 03:01:05 2009 (r189346) +++ head/sys/netinet/igmp.h Wed Mar 4 03:22:03 2009 (r189347) @@ -45,8 +45,11 @@ * MULTICAST Revision: 3.5.1.2 */ +/* Minimum length of any IGMP protocol message. */ +#define IGMP_MINLEN 8 + /* - * IGMP packet format. + * IGMPv1/v2 query and host report format. */ struct igmp { u_char igmp_type; /* version & type of IGMP message */ @@ -55,6 +58,9 @@ struct igmp { struct in_addr igmp_group; /* group address being reported */ }; /* (zero for queries) */ +/* + * IGMP v3 query format. + */ struct igmpv3 { u_char igmp_type; /* version & type of IGMP message */ u_char igmp_code; /* subtype for routing msgs */ @@ -66,6 +72,12 @@ struct igmpv3 { u_short igmp_numsrc; /* number of sources */ /*struct in_addr igmp_sources[1];*/ /* source addresses */ }; +#define IGMP_V3_QUERY_MINLEN 12 +#define IGMP_EXP(x) (((x) >> 4) & 0x07) +#define IGMP_MANT(x) ((x) & 0x0f) +#define IGMP_QRESV(x) (((x) >> 4) & 0x0f) +#define IGMP_SFLAG(x) (((x) >> 3) & 0x01) +#define IGMP_QRV(x) ((x) & 0x07) struct igmp_grouprec { u_char ig_type; /* record type */ @@ -74,58 +86,76 @@ struct igmp_grouprec { struct in_addr ig_group; /* group address being reported */ /*struct in_addr ig_sources[1];*/ /* source addresses */ }; +#define IGMP_GRPREC_HDRLEN 8 +/* + * IGMPv3 host membership report header. + */ struct igmp_report { - u_char ir_type; /* record type */ - u_char ir_rsv1; /* reserved */ + u_char ir_type; /* IGMP_v3_HOST_MEMBERSHIP_REPORT */ + u_char ir_rsv1; /* must be zero */ u_short ir_cksum; /* checksum */ - u_short ir_rsv2; /* reserved */ + u_short ir_rsv2; /* must be zero */ u_short ir_numgrps; /* number of group records */ - struct igmp_grouprec ir_groups[1]; /* group records */ + /*struct igmp_grouprec ir_groups[1];*/ /* group records */ }; - -#define IGMP_MINLEN 8 -#define IGMP_HDRLEN 8 -#define IGMP_GRPREC_HDRLEN 8 -#define IGMP_PREPEND 0 - -#if 0 -#define IGMP_QRV(pigmp) ((pigmp)->igmp_misc & (0x07)) /* XXX */ -#define IGMP_MAXSOURCES(len) (((len) - 12) >> 2) /* XXX */ -#endif +#define IGMP_V3_REPORT_MINLEN 8 +#define IGMP_V3_REPORT_MAXRECS 65535 /* * Message types, including version number. */ -#define IGMP_MEMBERSHIP_QUERY 0x11 /* membership query */ -#define IGMP_V1_MEMBERSHIP_REPORT 0x12 /* Ver. 1 membership report */ -#define IGMP_V2_MEMBERSHIP_REPORT 0x16 /* Ver. 2 membership report */ -#define IGMP_V2_LEAVE_GROUP 0x17 /* Leave-group message */ - +#define IGMP_HOST_MEMBERSHIP_QUERY 0x11 /* membership query */ +#define IGMP_v1_HOST_MEMBERSHIP_REPORT 0x12 /* Ver. 1 membership report */ #define IGMP_DVMRP 0x13 /* DVMRP routing message */ -#define IGMP_PIM 0x14 /* PIM routing message */ - -#define IGMP_MTRACE_RESP 0x1e /* traceroute resp.(to sender)*/ -#define IGMP_MTRACE 0x1f /* mcast traceroute messages */ +#define IGMP_PIM 0x14 /* PIM routing message */ +#define IGMP_v2_HOST_MEMBERSHIP_REPORT 0x16 /* Ver. 2 membership report */ +#define IGMP_HOST_LEAVE_MESSAGE 0x17 /* Leave-group message */ +#define IGMP_MTRACE_REPLY 0x1e /* mtrace(8) reply */ +#define IGMP_MTRACE_QUERY 0x1f /* mtrace(8) probe */ +#define IGMP_v3_HOST_MEMBERSHIP_REPORT 0x22 /* Ver. 3 membership report */ -#define IGMP_V3_MEMBERSHIP_REPORT 0x22 /* Ver. 3 membership report */ +#ifndef BURN_BRIDGES +/* + * Legacy FreeBSD definitions for the above message types. + */ +#define IGMP_MEMBERSHIP_QUERY IGMP_HOST_MEMBERSHIP_QUERY +#define IGMP_V1_MEMBERSHIP_REPORT IGMP_v1_HOST_MEMBERSHIP_REPORT +#define IGMP_V2_MEMBERSHIP_REPORT IGMP_v2_HOST_MEMBERSHIP_REPORT +#define IGMP_MTRACE_RESP IGMP_MTRACE_REPLY +#define IGMP_MTRACE IGMP_MTRACE_QUERY +#define IGMP_V2_LEAVE_GROUP IGMP_HOST_LEAVE_MESSAGE +#define IGMP_V3_MEMBERSHIP_REPORT IGMP_v3_HOST_MEMBERSHIP_REPORT +#endif /* BURN_BRIDGES */ -#define IGMP_MAX_HOST_REPORT_DELAY 10 /* max delay for response to */ - /* query (in seconds) according */ - /* to RFC1112 */ +/* + * IGMPv3 report modes. + */ +#define IGMP_DO_NOTHING 0 /* don't send a record */ +#define IGMP_MODE_IS_INCLUDE 1 /* MODE_IN */ +#define IGMP_MODE_IS_EXCLUDE 2 /* MODE_EX */ +#define IGMP_CHANGE_TO_INCLUDE_MODE 3 /* TO_IN */ +#define IGMP_CHANGE_TO_EXCLUDE_MODE 4 /* TO_EX */ +#define IGMP_ALLOW_NEW_SOURCES 5 /* ALLOW_NEW */ +#define IGMP_BLOCK_OLD_SOURCES 6 /* BLOCK_OLD */ +/* + * IGMPv3 query types. + */ +#define IGMP_V3_GENERAL_QUERY 1 +#define IGMP_V3_GROUP_QUERY 2 +#define IGMP_V3_GROUP_SOURCE_QUERY 3 -#define IGMP_TIMER_SCALE 10 /* denotes that the igmp code field */ - /* specifies time in 10th of seconds*/ +/* + * Maximum report interval for IGMP v1/v2 host membership reports [RFC 1112] + */ +#define IGMP_V1V2_MAX_RI 10 +#define IGMP_MAX_HOST_REPORT_DELAY IGMP_V1V2_MAX_RI /* - * The following four defininitions are for backwards compatibility. - * They should be removed as soon as all applications are updated to - * use the new constant names. + * IGMP_TIMER_SCALE denotes that the igmp code field specifies + * time in tenths of a second. */ -#define IGMP_HOST_MEMBERSHIP_QUERY IGMP_MEMBERSHIP_QUERY -#define IGMP_HOST_MEMBERSHIP_REPORT IGMP_V1_MEMBERSHIP_REPORT -#define IGMP_HOST_NEW_MEMBERSHIP_REPORT IGMP_V2_MEMBERSHIP_REPORT -#define IGMP_HOST_LEAVE_MESSAGE IGMP_V2_LEAVE_GROUP +#define IGMP_TIMER_SCALE 10 #endif /* _NETINET_IGMP_H_ */ From owner-svn-src-head@FreeBSD.ORG Wed Mar 4 03:30: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 DB075106564A; Wed, 4 Mar 2009 03:30:21 +0000 (UTC) (envelope-from das@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C9B1D8FC08; Wed, 4 Mar 2009 03:30:21 +0000 (UTC) (envelope-from das@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 n243ULff030288; Wed, 4 Mar 2009 03:30:21 GMT (envelope-from das@svn.freebsd.org) Received: (from das@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n243ULV5030287; Wed, 4 Mar 2009 03:30:21 GMT (envelope-from das@svn.freebsd.org) Message-Id: <200903040330.n243ULV5030287@svn.freebsd.org> From: David Schultz Date: Wed, 4 Mar 2009 03:30: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: r189348 - head/lib/libc/gen 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, 04 Mar 2009 03:30:22 -0000 Author: das Date: Wed Mar 4 03:30:21 2009 New Revision: 189348 URL: http://svn.freebsd.org/changeset/base/189348 Log: Fix a file descriptor leak in fts_child(). Obtained from: NetBSD Modified: head/lib/libc/gen/fts.c Modified: head/lib/libc/gen/fts.c ============================================================================== --- head/lib/libc/gen/fts.c Wed Mar 4 03:22:03 2009 (r189347) +++ head/lib/libc/gen/fts.c Wed Mar 4 03:30:21 2009 (r189348) @@ -570,8 +570,10 @@ fts_children(sp, instr) if ((fd = _open(".", O_RDONLY, 0)) < 0) return (NULL); sp->fts_child = fts_build(sp, instr); - if (fchdir(fd)) + if (fchdir(fd)) { + (void)_close(fd); return (NULL); + } (void)_close(fd); return (sp->fts_child); } From owner-svn-src-head@FreeBSD.ORG Wed Mar 4 03:31:10 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 C82FE106564A; Wed, 4 Mar 2009 03:31:10 +0000 (UTC) (envelope-from das@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B74BC8FC19; Wed, 4 Mar 2009 03:31:10 +0000 (UTC) (envelope-from das@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 n243VAuE030343; Wed, 4 Mar 2009 03:31:10 GMT (envelope-from das@svn.freebsd.org) Received: (from das@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n243VAXr030342; Wed, 4 Mar 2009 03:31:10 GMT (envelope-from das@svn.freebsd.org) Message-Id: <200903040331.n243VAXr030342@svn.freebsd.org> From: David Schultz Date: Wed, 4 Mar 2009 03:31: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: r189349 - head/include X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 04 Mar 2009 03:31:11 -0000 Author: das Date: Wed Mar 4 03:31:10 2009 New Revision: 189349 URL: http://svn.freebsd.org/changeset/base/189349 Log: - Add getsubopt and mkdtemp to the POSIX.1-2008 namespace. - Add mkstemp to the POSIX.1-2008 and BSD namespaces. - Remove mktemp from the XSI namespace. Modified: head/include/stdlib.h Modified: head/include/stdlib.h ============================================================================== --- head/include/stdlib.h Wed Mar 4 03:30:21 2009 (r189348) +++ head/include/stdlib.h Wed Mar 4 03:31:10 2009 (r189349) @@ -164,6 +164,18 @@ int setenv(const char *, const char *, int unsetenv(const char *); #endif +#if __POSIX_VISIBLE >= 200809 || __XSI_VISIBLE +int getsubopt(char **, char *const *, char **); +#ifndef _MKDTEMP_DECLARED +char *mkdtemp(char *); +#define _MKDTEMP_DECLARED +#endif +#ifndef _MKSTEMP_DECLARED +int mkstemp(char *); +#define _MKSTEMP_DECLARED +#endif +#endif /* __POSIX_VISIBLE >= 200809 || __XSI_VISIBLE */ + /* * The only changes to the XSI namespace in revision 6 were the deletion * of the ttyslot() and valloc() functions, which FreeBSD never declared @@ -178,18 +190,13 @@ double drand48(void); double erand48(unsigned short[3]); /* char *fcvt(double, int, int * __restrict, int * __restrict); */ /* char *gcvt(double, int, int * __restrict, int * __restrict); */ -int getsubopt(char **, char *const *, char **); int grantpt(int); char *initstate(unsigned long /* XSI requires u_int */, char *, long); long jrand48(unsigned short[3]); char *l64a(long); void lcong48(unsigned short[7]); long lrand48(void); -#ifndef _MKSTEMP_DECLARED -int mkstemp(char *); -#define _MKSTEMP_DECLARED -#endif -#ifndef _MKTEMP_DECLARED +#if !defined(_MKTEMP_DECLARED) && __XSI_VISIBLE <= 600 char *mktemp(char *); #define _MKTEMP_DECLARED #endif From owner-svn-src-head@FreeBSD.ORG Wed Mar 4 03:31:52 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 2BC31106566C; Wed, 4 Mar 2009 03:31:52 +0000 (UTC) (envelope-from das@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 1AB958FC1A; Wed, 4 Mar 2009 03:31:52 +0000 (UTC) (envelope-from das@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 n243Vp0L030393; Wed, 4 Mar 2009 03:31:51 GMT (envelope-from das@svn.freebsd.org) Received: (from das@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n243Vpmn030392; Wed, 4 Mar 2009 03:31:51 GMT (envelope-from das@svn.freebsd.org) Message-Id: <200903040331.n243Vpmn030392@svn.freebsd.org> From: David Schultz Date: Wed, 4 Mar 2009 03:31: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: r189350 - head/include X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 04 Mar 2009 03:31:52 -0000 Author: das Date: Wed Mar 4 03:31:51 2009 New Revision: 189350 URL: http://svn.freebsd.org/changeset/base/189350 Log: - Remove bcmp, bcopy, bzero, index, and rindex from the POSIX.1-2008 namespace. - Add ffs to the XSI namespace. Modified: head/include/strings.h Modified: head/include/strings.h ============================================================================== --- head/include/strings.h Wed Mar 4 03:31:10 2009 (r189349) +++ head/include/strings.h Wed Mar 4 03:31:51 2009 (r189350) @@ -38,10 +38,14 @@ typedef __size_t size_t; #endif __BEGIN_DECLS +#if __BSD_VISIBLE || __POSIX_VISIBLE <= 200112 int bcmp(const void *, const void *, size_t) __pure; /* LEGACY */ void bcopy(const void *, void *, size_t); /* LEGACY */ void bzero(void *, size_t); /* LEGACY */ +#endif +#if __XSI_VISIBLE int ffs(int) __pure2; +#endif #ifdef __BSD_VISIBLE int ffsl(long) __pure2; int ffsll(long long) __pure2; @@ -49,8 +53,10 @@ int fls(int) __pure2; int flsl(long) __pure2; int flsll(long long) __pure2; #endif +#if __BSD_VISIBLE || __POSIX_VISIBLE <= 200112 char *index(const char *, int) __pure; /* LEGACY */ char *rindex(const char *, int) __pure; /* LEGACY */ +#endif int strcasecmp(const char *, const char *) __pure; int strncasecmp(const char *, const char *, size_t) __pure; __END_DECLS From owner-svn-src-head@FreeBSD.ORG Wed Mar 4 03:32:29 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 F2CA8106564A; Wed, 4 Mar 2009 03:32:28 +0000 (UTC) (envelope-from das@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C17038FC26; Wed, 4 Mar 2009 03:32:28 +0000 (UTC) (envelope-from das@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 n243WSa2030447; Wed, 4 Mar 2009 03:32:28 GMT (envelope-from das@svn.freebsd.org) Received: (from das@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n243WS9D030446; Wed, 4 Mar 2009 03:32:28 GMT (envelope-from das@svn.freebsd.org) Message-Id: <200903040332.n243WS9D030446@svn.freebsd.org> From: David Schultz Date: Wed, 4 Mar 2009 03:32: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: r189351 - head/include X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 04 Mar 2009 03:32:29 -0000 Author: das Date: Wed Mar 4 03:32:28 2009 New Revision: 189351 URL: http://svn.freebsd.org/changeset/base/189351 Log: - Add getsid, fchdir, getpgid, lchown, pread, pwrite, truncate, *at, and fexecve to the POSIX.1-2008 namespace. - Remove getwd, ualarm, usleep, and vfork from the XSI namespace. - Remove mkdtemp from the POSIX.1-2008 namespace (should be in stdlib.h). Modified: head/include/unistd.h Modified: head/include/unistd.h ============================================================================== --- head/include/unistd.h Wed Mar 4 03:31:51 2009 (r189350) +++ head/include/unistd.h Wed Mar 4 03:32:28 2009 (r189351) @@ -413,6 +413,33 @@ int setegid(gid_t); int seteuid(uid_t); #endif +/* 1003.1-2008 */ +#if __POSIX_VISIBLE >= 200809 || __XSI_VISIBLE +int getsid(pid_t _pid); +int fchdir(int); +int getpgid(pid_t _pid); +int lchown(const char *, uid_t, gid_t); +ssize_t pread(int, void *, size_t, off_t); +ssize_t pwrite(int, const void *, size_t, off_t); + +/* See comment at ftruncate() above. */ +#ifndef _TRUNCATE_DECLARED +#define _TRUNCATE_DECLARED +int truncate(const char *, off_t); +#endif +#endif /* __POSIX_VISIBLE >= 200809 || __XSI_VISIBLE */ + +#if __POSIX_VISIBLE >= 200809 || __BSD_VISIBLE +int faccessat(int, const char *, int, int); +int fchmodat(int, const char *, mode_t, int); +int fchownat(int, const char *, uid_t, gid_t, int); +int fexecve(int, char *const [], char *const []); +int linkat(int, const char *, int, const char *, int); +ssize_t readlinkat(int, const char * __restrict, char * __restrict, size_t); +int symlinkat(const char *, int, const char *); +int unlinkat(int, const char *, int); +#endif /* __POSIX_VISIBLE >= 200809 || __BSD_VISIBLE */ + /* * symlink() was originally in POSIX.1a, which was withdrawn after * being overtaken by events (1003.1-2001). It was in XPG4.2, and of @@ -427,16 +454,9 @@ int symlink(const char * __restrict, co char *crypt(const char *, const char *); /* char *ctermid(char *); */ /* XXX ??? */ int encrypt(char *, int); -int fchdir(int); long gethostid(void); -int getpgid(pid_t _pid); -int getsid(pid_t _pid); -char *getwd(char *); /* LEGACY: obsoleted by getcwd() */ -int lchown(const char *, uid_t, gid_t); int lockf(int, int, off_t); int nice(int); -ssize_t pread(int, void *, size_t, off_t); -ssize_t pwrite(int, const void *, size_t, off_t); int setpgrp(pid_t _pid, pid_t _pgrp); /* obsoleted by setpgid() */ int setregid(gid_t, gid_t); int setreuid(uid_t, uid_t); @@ -447,15 +467,7 @@ void swab(const void * __restrict, void #endif /* _SWAB_DECLARED */ void sync(void); -useconds_t ualarm(useconds_t, useconds_t); -int usleep(useconds_t); -pid_t vfork(void); -/* See comment at ftruncate() above. */ -#ifndef _TRUNCATE_DECLARED -#define _TRUNCATE_DECLARED -int truncate(const char *, off_t); -#endif #endif /* __XSI_VISIBLE */ #if __XSI_VISIBLE <= 500 || __BSD_VISIBLE @@ -467,6 +479,14 @@ char *getpass(const char *); void *sbrk(intptr_t); #endif +#if __XSI_VISIBLE <= 600 || __BSD_VISIBLE +char *getwd(char *); /* obsoleted by getcwd() */ +useconds_t + ualarm(useconds_t, useconds_t); +int usleep(useconds_t); +pid_t vfork(void); +#endif + #if __BSD_VISIBLE struct timeval; /* select(2) */ int acct(const char *); @@ -494,7 +514,10 @@ 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); +#ifndef _MKDTEMP_DECLARED char *mkdtemp(char *); +#define _MKDTEMP_DECLARED +#endif #ifndef _MKNOD_DECLARED int mknod(const char *, mode_t, dev_t); #define _MKNOD_DECLARED @@ -560,17 +583,6 @@ void *valloc(size_t); /* obsoleted by extern int optreset; /* getopt(3) external variable */ #endif #endif /* __BSD_VISIBLE */ - -#if __BSD_VISIBLE -int faccessat(int, const char *, int, int); -int fchmodat(int, const char *, mode_t, int); -int fchownat(int, const char *, uid_t, gid_t, int); -int fexecve(int, char *const [], char *const []); -int linkat(int, const char *, int, const char *, int); -ssize_t readlinkat(int, const char * __restrict, char * __restrict, size_t); -int symlinkat(const char *, int, const char *); -int unlinkat(int, const char *, int); -#endif /* __BSD_VISIBLE */ __END_DECLS #endif /* !_UNISTD_H_ */ From owner-svn-src-head@FreeBSD.ORG Wed Mar 4 03:32:56 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 6786B106566C; Wed, 4 Mar 2009 03:32:56 +0000 (UTC) (envelope-from das@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 56B788FC21; Wed, 4 Mar 2009 03:32:56 +0000 (UTC) (envelope-from das@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 n243WuWa030490; Wed, 4 Mar 2009 03:32:56 GMT (envelope-from das@svn.freebsd.org) Received: (from das@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n243WuGm030489; Wed, 4 Mar 2009 03:32:56 GMT (envelope-from das@svn.freebsd.org) Message-Id: <200903040332.n243WuGm030489@svn.freebsd.org> From: David Schultz Date: Wed, 4 Mar 2009 03:32:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r189352 - head/include X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 04 Mar 2009 03:32:57 -0000 Author: das Date: Wed Mar 4 03:32:56 2009 New Revision: 189352 URL: http://svn.freebsd.org/changeset/base/189352 Log: Add psignal to the POSIX.1-2008 namespace. Modified: head/include/signal.h Modified: head/include/signal.h ============================================================================== --- head/include/signal.h Wed Mar 4 03:32:28 2009 (r189351) +++ head/include/signal.h Wed Mar 4 03:32:56 2009 (r189352) @@ -95,6 +95,10 @@ int sigpause(int); int siginterrupt(int, int); #endif +#if __POSIX_VISIBLE >= 200809 || __BSD_VISIBLE +void psignal(unsigned int, const char *); +#endif + #if __BSD_VISIBLE int sigblock(int); struct __ucontext; /* XXX spec requires a complete declaration. */ @@ -102,7 +106,6 @@ int sigreturn(const struct __ucontext *) int sigsetmask(int); int sigstack(const struct sigstack *, struct sigstack *); int sigvec(int, struct sigvec *, struct sigvec *); -void psignal(unsigned int, const char *); #endif __END_DECLS From owner-svn-src-head@FreeBSD.ORG Wed Mar 4 03:33: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 C22951065672; Wed, 4 Mar 2009 03:33:21 +0000 (UTC) (envelope-from das@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B16CD8FC0C; Wed, 4 Mar 2009 03:33:21 +0000 (UTC) (envelope-from das@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 n243XLaV030552; Wed, 4 Mar 2009 03:33:21 GMT (envelope-from das@svn.freebsd.org) Received: (from das@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n243XLuv030551; Wed, 4 Mar 2009 03:33:21 GMT (envelope-from das@svn.freebsd.org) Message-Id: <200903040333.n243XLuv030551@svn.freebsd.org> From: David Schultz Date: Wed, 4 Mar 2009 03:33: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: r189353 - 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: Wed, 04 Mar 2009 03:33:22 -0000 Author: das Date: Wed Mar 4 03:33:21 2009 New Revision: 189353 URL: http://svn.freebsd.org/changeset/base/189353 Log: Add openat to the POSIX.1-2008 namespace. Modified: head/sys/sys/fcntl.h Modified: head/sys/sys/fcntl.h ============================================================================== --- head/sys/sys/fcntl.h Wed Mar 4 03:32:56 2009 (r189352) +++ head/sys/sys/fcntl.h Wed Mar 4 03:33:21 2009 (r189353) @@ -278,7 +278,9 @@ __BEGIN_DECLS int open(const char *, int, ...); int creat(const char *, mode_t); int fcntl(int, int, ...); +#if __BSD_VISIBLE || __POSIX_VISIBLE >= 200809 int openat(int, const char *, int, ...); +#endif #if __BSD_VISIBLE int flock(int, int); #endif From owner-svn-src-head@FreeBSD.ORG Wed Mar 4 03:33: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 E7DF8106566B; Wed, 4 Mar 2009 03:33:38 +0000 (UTC) (envelope-from das@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D67388FC0C; Wed, 4 Mar 2009 03:33:38 +0000 (UTC) (envelope-from das@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 n243Xcg4030594; Wed, 4 Mar 2009 03:33:38 GMT (envelope-from das@svn.freebsd.org) Received: (from das@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n243Xcf3030593; Wed, 4 Mar 2009 03:33:38 GMT (envelope-from das@svn.freebsd.org) Message-Id: <200903040333.n243Xcf3030593@svn.freebsd.org> From: David Schultz Date: Wed, 4 Mar 2009 03:33: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: r189354 - 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: Wed, 04 Mar 2009 03:33:39 -0000 Author: das Date: Wed Mar 4 03:33:38 2009 New Revision: 189354 URL: http://svn.freebsd.org/changeset/base/189354 Log: Add *at to the POSIX.1-2008 namespace. Modified: head/sys/sys/stat.h Modified: head/sys/sys/stat.h ============================================================================== --- head/sys/sys/stat.h Wed Mar 4 03:33:21 2009 (r189353) +++ head/sys/sys/stat.h Wed Mar 4 03:33:38 2009 (r189354) @@ -330,7 +330,7 @@ int mknod(const char *, mode_t, dev_t); #endif int stat(const char * __restrict, struct stat * __restrict); mode_t umask(mode_t); -#if __BSD_VISIBLE +#if __BSD_VISIBLE || __POSIX_VISIBLE >= 200809 int fstatat(int, const char *, struct stat *, int); int mkdirat(int, const char *, mode_t); int mkfifoat(int, const char *, mode_t); From owner-svn-src-head@FreeBSD.ORG Wed Mar 4 03:35: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 BAF4D10656D0; Wed, 4 Mar 2009 03:35:03 +0000 (UTC) (envelope-from das@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A9AC18FC18; Wed, 4 Mar 2009 03:35:03 +0000 (UTC) (envelope-from das@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 n243Z3bi030672; Wed, 4 Mar 2009 03:35:03 GMT (envelope-from das@svn.freebsd.org) Received: (from das@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n243Z3On030671; Wed, 4 Mar 2009 03:35:03 GMT (envelope-from das@svn.freebsd.org) Message-Id: <200903040335.n243Z3On030671@svn.freebsd.org> From: David Schultz Date: Wed, 4 Mar 2009 03:35:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r189355 - head/include X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 04 Mar 2009 03:35:04 -0000 Author: das Date: Wed Mar 4 03:35:03 2009 New Revision: 189355 URL: http://svn.freebsd.org/changeset/base/189355 Log: Add renameat to the POSIX.1-2008 namespace. Modified: head/include/stdio.h Modified: head/include/stdio.h ============================================================================== --- head/include/stdio.h Wed Mar 4 03:33:38 2009 (r189354) +++ head/include/stdio.h Wed Mar 4 03:35:03 2009 (r189355) @@ -344,6 +344,7 @@ char *tempnam(const char *, const char * #if __BSD_VISIBLE || __POSIX_VISIBLE >= 200809 ssize_t getdelim(char ** __restrict, size_t * __restrict, int, FILE * __restrict); +int renameat(int, const char *, int, const char *); /* * Every programmer and his dog wrote functions called getline() @@ -379,7 +380,6 @@ void fcloseall(void); char *fgetln(FILE *, size_t *); __const char *fmtcheck(const char *, const char *) __format_arg(2); int fpurge(FILE *); -int renameat(int, const char *, int, const char *); void setbuffer(FILE *, char *, int); int setlinebuf(FILE *); int vasprintf(char **, const char *, __va_list) From owner-svn-src-head@FreeBSD.ORG Wed Mar 4 03:38: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 E7B55106566C; Wed, 4 Mar 2009 03:38:51 +0000 (UTC) (envelope-from das@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D48DF8FC0C; Wed, 4 Mar 2009 03:38:51 +0000 (UTC) (envelope-from das@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 n243cpEc030786; Wed, 4 Mar 2009 03:38:51 GMT (envelope-from das@svn.freebsd.org) Received: (from das@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n243cp0Q030779; Wed, 4 Mar 2009 03:38:51 GMT (envelope-from das@svn.freebsd.org) Message-Id: <200903040338.n243cp0Q030779@svn.freebsd.org> From: David Schultz Date: Wed, 4 Mar 2009 03:38: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: r189356 - in head: include lib/libc/stdio 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, 04 Mar 2009 03:38:52 -0000 Author: das Date: Wed Mar 4 03:38:51 2009 New Revision: 189356 URL: http://svn.freebsd.org/changeset/base/189356 Log: Add dprintf() and vdprintf() from POSIX.1-2008. Like getline(), dprintf() is a simple wrapper around another function, so we may as well implement it. But also like getline(), we can't prototype it by default right now because it would break too many ports. Added: head/lib/libc/stdio/dprintf.c (contents, props changed) head/lib/libc/stdio/vdprintf.c (contents, props changed) Modified: head/include/stdio.h head/lib/libc/stdio/Makefile.inc head/lib/libc/stdio/Symbol.map head/lib/libc/stdio/printf.3 head/lib/libc/stdio/stdio.3 Modified: head/include/stdio.h ============================================================================== --- head/include/stdio.h Wed Mar 4 03:35:03 2009 (r189355) +++ head/include/stdio.h Wed Mar 4 03:38:51 2009 (r189356) @@ -345,12 +345,14 @@ char *tempnam(const char *, const char * ssize_t getdelim(char ** __restrict, size_t * __restrict, int, FILE * __restrict); int renameat(int, const char *, int, const char *); +int vdprintf(int, const char * __restrict, __va_list); /* - * Every programmer and his dog wrote functions called getline() - * before POSIX.1-2008 came along and decided to usurp the name, so we - * don't prototype getline() by default unless one of the following is true: - * a) the app has requested it specifically by defining _WITH_GETLINE + * Every programmer and his dog wrote functions called getline() and dprintf() + * before POSIX.1-2008 came along and decided to usurp the names, so we + * don't prototype them by default unless one of the following is true: + * a) the app has requested them specifically by defining _WITH_GETLINE or + * _WITH_DPRINTF, respectively * b) the app has requested a POSIX.1-2008 environment via _POSIX_C_SOURCE * c) the app defines a GNUism such as _BSD_SOURCE or _GNU_SOURCE */ @@ -368,6 +370,20 @@ int renameat(int, const char *, int, co ssize_t getline(char ** __restrict, size_t * __restrict, FILE * __restrict); #endif +#ifndef _WITH_DPRINTF +#if defined(_BSD_SOURCE) || defined(_GNU_SOURCE) +#define _WITH_DPRINTF +#elif defined(_POSIX_C_SOURCE) +#if _POSIX_C_SOURCE > 200809 +#define _WITH_DPRINTF +#endif +#endif +#endif + +#ifdef _WITH_DPRINTF +int dprintf(int, const char * __restrict, ...); +#endif + #endif /* __BSD_VISIBLE || __POSIX_VISIBLE >= 200809 */ /* Modified: head/lib/libc/stdio/Makefile.inc ============================================================================== --- head/lib/libc/stdio/Makefile.inc Wed Mar 4 03:35:03 2009 (r189355) +++ head/lib/libc/stdio/Makefile.inc Wed Mar 4 03:38:51 2009 (r189356) @@ -4,7 +4,8 @@ # stdio sources .PATH: ${.CURDIR}/stdio -SRCS+= _flock_stub.c asprintf.c clrerr.c fclose.c fcloseall.c fdopen.c \ +SRCS+= _flock_stub.c asprintf.c clrerr.c dprintf.c \ + fclose.c fcloseall.c fdopen.c \ feof.c ferror.c fflush.c fgetc.c fgetln.c fgetpos.c fgets.c fgetwc.c \ fgetwln.c fgetws.c \ fileno.c findfp.c flags.c fopen.c fprintf.c fpurge.c fputc.c fputs.c \ @@ -17,7 +18,7 @@ SRCS+= _flock_stub.c asprintf.c clrerr.c refill.c remove.c rewind.c rget.c scanf.c setbuf.c setbuffer.c \ setvbuf.c snprintf.c sprintf.c sscanf.c stdio.c swprintf.c swscanf.c \ tempnam.c tmpfile.c \ - tmpnam.c ungetc.c ungetwc.c vasprintf.c vfprintf.c \ + tmpnam.c ungetc.c ungetwc.c vasprintf.c vdprintf.c vfprintf.c \ vfscanf.c \ vfwprintf.c vfwscanf.c vprintf.c vscanf.c vsnprintf.c vsprintf.c \ vsscanf.c \ @@ -57,9 +58,9 @@ MLINKS+=getc.3 fgetc.3 getc.3 getc_unloc MLINKS+=getline.3 getdelim.3 MLINKS+=getwc.3 fgetwc.3 getwc.3 getwchar.3 MLINKS+=mktemp.3 mkdtemp.3 mktemp.3 mkstemp.3 mktemp.3 mkstemps.3 -MLINKS+=printf.3 asprintf.3 printf.3 fprintf.3 \ +MLINKS+=printf.3 asprintf.3 printf.3 dprintf.3 printf.3 fprintf.3 \ printf.3 snprintf.3 printf.3 sprintf.3 \ - printf.3 vasprintf.3 \ + printf.3 vasprintf.3 printf.3 vdprintf.3 \ printf.3 vfprintf.3 printf.3 vprintf.3 printf.3 vsnprintf.3 \ printf.3 vsprintf.3 MLINKS+=putc.3 fputc.3 putc.3 putc_unlocked.3 putc.3 putchar.3 \ Modified: head/lib/libc/stdio/Symbol.map ============================================================================== --- head/lib/libc/stdio/Symbol.map Wed Mar 4 03:35:03 2009 (r189355) +++ head/lib/libc/stdio/Symbol.map Wed Mar 4 03:38:51 2009 (r189356) @@ -111,8 +111,10 @@ FBSD_1.0 { }; FBSD_1.1 { + dprintf; getdelim; getline; + vdprintf; }; FBSDprivate_1.0 { Added: head/lib/libc/stdio/dprintf.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/lib/libc/stdio/dprintf.c Wed Mar 4 03:38:51 2009 (r189356) @@ -0,0 +1,46 @@ +/*- + * Copyright (c) 2009 David Schultz + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +__FBSDID("$FreeBSD$"); + +#define _WITH_DPRINTF +#include "namespace.h" +#include +#include +#include "un-namespace.h" + +int +dprintf(int fd, const char * __restrict fmt, ...) +{ + va_list ap; + int ret; + + va_start(ap, fmt); + ret = vdprintf(fd, fmt, ap); + va_end(ap); + return (ret); +} Modified: head/lib/libc/stdio/printf.3 ============================================================================== --- head/lib/libc/stdio/printf.3 Wed Mar 4 03:35:03 2009 (r189355) +++ head/lib/libc/stdio/printf.3 Wed Mar 4 03:38:51 2009 (r189356) @@ -32,16 +32,17 @@ .\" @(#)printf.3 8.1 (Berkeley) 6/4/93 .\" $FreeBSD$ .\" -.Dd October 16, 2004 +.Dd March 3, 2009 .Dt PRINTF 3 .Os .Sh NAME -.Nm printf , fprintf , sprintf , snprintf , asprintf , -.Nm vprintf , vfprintf, vsprintf , vsnprintf , vasprintf +.Nm printf , fprintf , sprintf , snprintf , asprintf , dprintf , +.Nm vprintf , vfprintf, vsprintf , vsnprintf , vasprintf, vdprintf .Nd formatted output conversion .Sh LIBRARY .Lb libc .Sh SYNOPSIS +.Fd "#define _WITH_DPRINTF" .In stdio.h .Ft int .Fn printf "const char * restrict format" ... @@ -53,6 +54,8 @@ .Fn snprintf "char * restrict str" "size_t size" "const char * restrict format" ... .Ft int .Fn asprintf "char **ret" "const char *format" ... +.Ft int +.Fn dprintf "int" "const char * restrict format" ... .In stdarg.h .Ft int .Fn vprintf "const char * restrict format" "va_list ap" @@ -64,6 +67,8 @@ .Fn vsnprintf "char * restrict str" "size_t size" "const char * restrict format" "va_list ap" .Ft int .Fn vasprintf "char **ret" "const char *format" "va_list ap" +.Ft int +.Fn vdprintf "int fd" "const char * restrict format" "va_list ap" .Sh DESCRIPTION The .Fn printf @@ -83,6 +88,10 @@ and .Fn vfprintf write output to the given output .Fa stream ; +.Fn dprintf +and +.Fn vdprintf +write output to the given file descriptor; .Fn sprintf , .Fn snprintf , .Fn vsprintf , @@ -771,6 +780,57 @@ for later interpolation by Always use the proper secure idiom: .Pp .Dl "snprintf(buffer, sizeof(buffer), \*q%s\*q, string);" +.Sh COMPATIBILITY +Many application writers used the name +.Va dprintf +before the +.Fn dprintf +function was introduced in +.St -p1003.1 , +so a prototype is not provided by default in order to avoid +compatibility problems. +Applications that wish to use the +.Fn dprintf +function described herein should either request a strict +.St -p1003.1-2008 +environment by defining the macro +.Dv _POSIX_C_SOURCE +to the value 200809 or greater, or by defining the macro +.Dv _WITH_DPRINTF , +prior to the inclusion of +.In stdio.h . +For compatibility with GNU libc, defining either +.Dv _BSD_SOURCE +or +.Dv _GNU_SOURCE +prior to the inclusion of +.In stdio.h +will also make +.Fn dprintf +available. +.Pp +The conversion formats +.Cm \&%D , \&%O , +and +.Cm %U +are not standard and +are provided only for backward compatibility. +The effect of padding the +.Cm %p +format with zeros (either by the +.Cm 0 +flag or by specifying a precision), and the benign effect (i.e., none) +of the +.Cm # +flag on +.Cm %n +and +.Cm %p +conversions, as well as other +nonsensical combinations such as +.Cm %Ld , +are not standard; such combinations +should be avoided. .Sh ERRORS In addition to the errors documented for the .Xr write 2 @@ -810,7 +870,13 @@ With the same reservation, the and .Fn vsnprintf functions conform to -.St -isoC-99 . +.St -isoC-99 , +while +.Fn dprintf +and +.Fn vdprintf +conform to +.St -p1003.1-2008 . .Sh HISTORY The functions .Fn asprintf @@ -828,30 +894,13 @@ from .An Todd C. Miller Aq Todd.Miller@courtesan.com for .Ox 2.3 . -.Sh BUGS -The conversion formats -.Cm \&%D , \&%O , -and -.Cm %U -are not standard and -are provided only for backward compatibility. -The effect of padding the -.Cm %p -format with zeros (either by the -.Cm 0 -flag or by specifying a precision), and the benign effect (i.e., none) -of the -.Cm # -flag on -.Cm %n +The +.Fn dprintf and -.Cm %p -conversions, as well as other -nonsensical combinations such as -.Cm %Ld , -are not standard; such combinations -should be avoided. -.Pp +.Fn vdprintf +functions were added in +.Fx 8.0 . +.Sh BUGS The .Nm family of functions do not correctly handle multibyte characters in the Modified: head/lib/libc/stdio/stdio.3 ============================================================================== --- head/lib/libc/stdio/stdio.3 Wed Mar 4 03:35:03 2009 (r189355) +++ head/lib/libc/stdio/stdio.3 Wed Mar 4 03:38:51 2009 (r189356) @@ -28,7 +28,7 @@ .\" @(#)stdio.3 8.7 (Berkeley) 4/19/94 .\" $FreeBSD$ .\" -.Dd February 28, 2009 +.Dd March 3, 2009 .Dt STDIO 3 .Os .Sh NAME @@ -243,6 +243,7 @@ library conforms to .It Sy "Function Description" .It "asprintf formatted output conversion" .It "clearerr check and reset stream status" +.It "dprintf formatted output conversion" .It "fclose close a stream" .It "fdopen stream open functions" .It "feof check and reset stream status" @@ -313,6 +314,7 @@ library conforms to .It "ungetc un-get character from input stream" .It "ungetwc un-get wide character from input stream" .It "vasprintf formatted output conversion" +.It "vdprintf formatted output conversion" .It "vfprintf formatted output conversion" .It "vfscanf input format conversion" .It "vfwprintf formatted wide character output conversion" Added: head/lib/libc/stdio/vdprintf.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/lib/libc/stdio/vdprintf.c Wed Mar 4 03:38:51 2009 (r189356) @@ -0,0 +1,66 @@ +/*- + * Copyright (c) 2009 David Schultz + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include "namespace.h" +#include +#include +#include +#include +#include "un-namespace.h" + +#include "local.h" + +int +vdprintf(int fd, const char * __restrict fmt, va_list ap) +{ + FILE f; + unsigned char buf[BUFSIZ]; + int ret; + + if (fd > SHRT_MAX) { + errno = EMFILE; + return (EOF); + } + + f._p = buf; + f._w = sizeof(buf); + f._flags = __SWR; + f._file = fd; + f._cookie = &f; + f._write = __swrite; + f._bf._base = buf; + f._bf._size = sizeof(buf); + f._orientation = 0; + bzero(&f._mbstate, sizeof(f._mbstate)); + + if ((ret = __vfprintf(&f, fmt, ap)) < 0) + return (ret); + + return (__fflush(&f) ? EOF : ret); +} From owner-svn-src-head@FreeBSD.ORG Wed Mar 4 03:40: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 4163B106566B; Wed, 4 Mar 2009 03:40:03 +0000 (UTC) (envelope-from bms@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 302D08FC13; Wed, 4 Mar 2009 03:40:03 +0000 (UTC) (envelope-from bms@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 n243e3qI030859; Wed, 4 Mar 2009 03:40:03 GMT (envelope-from bms@svn.freebsd.org) Received: (from bms@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n243e3sm030858; Wed, 4 Mar 2009 03:40:03 GMT (envelope-from bms@svn.freebsd.org) Message-Id: <200903040340.n243e3sm030858@svn.freebsd.org> From: Bruce M Simpson Date: Wed, 4 Mar 2009 03:40:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r189357 - head/sys/netinet X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 04 Mar 2009 03:40:03 -0000 Author: bms Date: Wed Mar 4 03:40:02 2009 New Revision: 189357 URL: http://svn.freebsd.org/changeset/base/189357 Log: Add sysctl net.inet.ip.mcast.loop. This controls whether or not IPv4 multicast sends are looped back to senders by default on a stack-wide basis, rather than relying on the socket option. Note that the sysctl only applies to newly created multicast sockets. Modified: head/sys/netinet/in_mcast.c Modified: head/sys/netinet/in_mcast.c ============================================================================== --- head/sys/netinet/in_mcast.c Wed Mar 4 03:38:51 2009 (r189356) +++ head/sys/netinet/in_mcast.c Wed Mar 4 03:40:02 2009 (r189357) @@ -121,6 +121,13 @@ static int inp_leave_group(struct inpcb static int inp_set_multicast_if(struct inpcb *, struct sockopt *); static int inp_set_source_filters(struct inpcb *, struct sockopt *); +SYSCTL_NODE(_net_inet_ip, OID_AUTO, mcast, CTLFLAG_RW, 0, "IPv4 multicast"); + +int in_mcast_loop = IP_DEFAULT_MULTICAST_LOOP; +SYSCTL_INT(_net_inet_ip_mcast, OID_AUTO, loop, CTLFLAG_RW | CTLFLAG_TUN, + &in_mcast_loop, 0, "Loopback multicast datagrams by default"); +TUNABLE_INT("net.inet.ip.mcast.loop", &in_mcast_loop); + /* * Resize the ip_moptions vector to the next power-of-two minus 1. * May be called with locks held; do not sleep. @@ -695,7 +702,7 @@ inp_findmoptions(struct inpcb *inp) imo->imo_multicast_addr.s_addr = INADDR_ANY; imo->imo_multicast_vif = -1; imo->imo_multicast_ttl = IP_DEFAULT_MULTICAST_TTL; - imo->imo_multicast_loop = IP_DEFAULT_MULTICAST_LOOP; + imo->imo_multicast_loop = in_mcast_loop; imo->imo_num_memberships = 0; imo->imo_max_memberships = IP_MIN_MEMBERSHIPS; imo->imo_membership = immp; From owner-svn-src-head@FreeBSD.ORG Wed Mar 4 03:45: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 A4EF3106566C; Wed, 4 Mar 2009 03:45:02 +0000 (UTC) (envelope-from das@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 794A38FC1A; Wed, 4 Mar 2009 03:45:02 +0000 (UTC) (envelope-from das@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 n243j2Do030992; Wed, 4 Mar 2009 03:45:02 GMT (envelope-from das@svn.freebsd.org) Received: (from das@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n243j2Y5030991; Wed, 4 Mar 2009 03:45:02 GMT (envelope-from das@svn.freebsd.org) Message-Id: <200903040345.n243j2Y5030991@svn.freebsd.org> From: David Schultz Date: Wed, 4 Mar 2009 03:45: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: r189358 - in head/contrib/gdtoa: . 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: Wed, 04 Mar 2009 03:45:03 -0000 Author: das Date: Wed Mar 4 03:45:02 2009 New Revision: 189358 URL: http://svn.freebsd.org/changeset/base/189358 Log: Remove some unused vendor files. Deleted: head/contrib/gdtoa/test/ head/contrib/gdtoa/xsum0.out From owner-svn-src-head@FreeBSD.ORG Wed Mar 4 03:45: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 506F91065673; Wed, 4 Mar 2009 03:45:35 +0000 (UTC) (envelope-from bms@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 3EB318FC14; Wed, 4 Mar 2009 03:45:35 +0000 (UTC) (envelope-from bms@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 n243jZUM031040; Wed, 4 Mar 2009 03:45:35 GMT (envelope-from bms@svn.freebsd.org) Received: (from bms@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n243jZsQ031038; Wed, 4 Mar 2009 03:45:35 GMT (envelope-from bms@svn.freebsd.org) Message-Id: <200903040345.n243jZsQ031038@svn.freebsd.org> From: Bruce M Simpson Date: Wed, 4 Mar 2009 03:45:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r189359 - head/sys/netinet X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 04 Mar 2009 03:45:36 -0000 Author: bms Date: Wed Mar 4 03:45:34 2009 New Revision: 189359 URL: http://svn.freebsd.org/changeset/base/189359 Log: In ip_output(), do not acquire the IN_MULTI_LOCK(), and do not attempt to perform a group lookup. This is a socket layer lock, and the bottom half of IP really has no business taking it. Use the value of the in_mcast_loop sysctl to determine if we should loop back by default, in the absence of any multicast socket options. Because the check on group membership is now deferred to the input path, an m_copym() is now required. This should increase multicast send performance where the source has not requested loopback, although this has not been benchmarked or measured. It is also a necessary change for IN_MULTI_LOCK to become non-recursive, which is required in order to implement IGMPv3 in a thread-safe way. Modified: head/sys/netinet/ip_output.c Modified: head/sys/netinet/ip_output.c ============================================================================== --- head/sys/netinet/ip_output.c Wed Mar 4 03:45:02 2009 (r189358) +++ head/sys/netinet/ip_output.c Wed Mar 4 03:45:34 2009 (r189359) @@ -112,6 +112,7 @@ static void ip_mloopback (struct ifnet *, struct mbuf *, struct sockaddr_in *, int); +extern int in_mcast_loop; extern struct protosw inetsw[]; /* @@ -293,8 +294,6 @@ again: mtu = ifp->if_mtu; } if (IN_MULTICAST(ntohl(ip->ip_dst.s_addr))) { - struct in_multi *inm; - m->m_flags |= M_MCAST; /* * IP destination address is multicast. Make sure "dst" @@ -334,20 +333,17 @@ again: ip->ip_src = IA_SIN(ia)->sin_addr; } - IN_MULTI_LOCK(); - IN_LOOKUP_MULTI(ip->ip_dst, ifp, inm); - if (inm != NULL && - (imo == NULL || imo->imo_multicast_loop)) { - IN_MULTI_UNLOCK(); + if ((imo == NULL && in_mcast_loop) || + (imo && imo->imo_multicast_loop)) { /* - * If we belong to the destination multicast group - * on the outgoing interface, and the caller did not - * forbid loopback, loop back a copy. + * Loop back multicast datagram if not expressly + * forbidden to do so, even if we are not a member + * of the group; ip_input() will filter it later, + * thus deferring a hash lookup and mutex acquisition + * at the expense of a cheap copy using m_copym(). */ ip_mloopback(ifp, m, dst, hlen); - } - else { - IN_MULTI_UNLOCK(); + } else { /* * If we are acting as a multicast router, perform * multicast forwarding as if the packet had just @@ -382,8 +378,9 @@ again: * back, above, but must not be transmitted on a network. * Also, multicasts addressed to the loopback interface * are not sent -- the above call to ip_mloopback() will - * loop back a copy if this host actually belongs to the - * destination group on the loopback interface. + * loop back a copy. ip_input() will drop the copy if + * this host does not belong to the destination group on + * the loopback interface. */ if (ip->ip_ttl == 0 || ifp->if_flags & IFF_LOOPBACK) { m_freem(m); @@ -758,7 +755,7 @@ smart_frag_failure: /* * In the first mbuf, leave room for the link header, then * copy the original IP header including options. The payload - * goes into an additional mbuf chain returned by m_copy(). + * goes into an additional mbuf chain returned by m_copym(). */ m->m_data += max_linkhdr; mhip = mtod(m, struct ip *); @@ -777,7 +774,7 @@ smart_frag_failure: } else mhip->ip_off |= IP_MF; mhip->ip_len = htons((u_short)(len + mhlen)); - m->m_next = m_copy(m0, off, len); + m->m_next = m_copym(m0, off, len, M_DONTWAIT); if (m->m_next == NULL) { /* copy failed */ m_free(m); error = ENOBUFS; /* ??? */ From owner-svn-src-head@FreeBSD.ORG Wed Mar 4 03:47: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 DBC0F106564A; Wed, 4 Mar 2009 03:47:57 +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 AF1E38FC18; Wed, 4 Mar 2009 03:47:57 +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 n243lvXT031114; Wed, 4 Mar 2009 03:47:57 GMT (envelope-from thompsa@svn.freebsd.org) Received: (from thompsa@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n243lvm6031111; Wed, 4 Mar 2009 03:47:57 GMT (envelope-from thompsa@svn.freebsd.org) Message-Id: <200903040347.n243lvm6031111@svn.freebsd.org> From: Andrew Thompson Date: Wed, 4 Mar 2009 03:47: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: r189360 - in head: share/man/man4 sys/dev/usb sys/dev/usb/serial 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, 04 Mar 2009 03:47:58 -0000 Author: thompsa Date: Wed Mar 4 03:47:57 2009 New Revision: 189360 URL: http://svn.freebsd.org/changeset/base/189360 Log: Add Mobile Action MA-620 Infrared Adapter. PR: usb/125072 Submitted by: Alexander Logvinov MFC after: 1 week Modified: head/share/man/man4/uplcom.4 head/sys/dev/usb/serial/uplcom.c head/sys/dev/usb/usbdevs Modified: head/share/man/man4/uplcom.4 ============================================================================== --- head/share/man/man4/uplcom.4 Wed Mar 4 03:45:34 2009 (r189359) +++ head/share/man/man4/uplcom.4 Wed Mar 4 03:47:57 2009 (r189360) @@ -98,6 +98,8 @@ I/O DATA USB-RSAQ2 .It I/O DATA USB-RSAQ3 .It +Mobile Action MA-620 Infrared Adapter +.It PLANEX USB-RS232 URS-03 .It RATOC REX-USB60 Modified: head/sys/dev/usb/serial/uplcom.c ============================================================================== --- head/sys/dev/usb/serial/uplcom.c Wed Mar 4 03:45:34 2009 (r189359) +++ head/sys/dev/usb/serial/uplcom.c Wed Mar 4 03:47:57 2009 (r189360) @@ -274,6 +274,9 @@ static const struct usb2_device_id uplco {USB_UPL(USB_VENDOR_PROLIFIC, USB_PRODUCT_PROLIFIC_PHAROS, 0, 0xFFFF, TYPE_PL2303)}, /* Willcom W-SIM */ {USB_UPL(USB_VENDOR_PROLIFIC2, USB_PRODUCT_PROLIFIC2_WSIM, 0, 0xFFFF, TYPE_PL2303X)}, + /* Mobile Action MA-620 Infrared Adapter */ + {USB_UPL(USB_VENDOR_MOBILEACTION, USB_PRODUCT_MOBILEACTION_MA620, 0, 0xFFFF, TYPE_PL2303X)}, + }; static device_method_t uplcom_methods[] = { Modified: head/sys/dev/usb/usbdevs ============================================================================== --- head/sys/dev/usb/usbdevs Wed Mar 4 03:45:34 2009 (r189359) +++ head/sys/dev/usb/usbdevs Wed Mar 4 03:47:57 2009 (r189360) @@ -1767,6 +1767,9 @@ product MITSUMI CDRRW 0x0000 CD-R/RW Dr product MITSUMI BT_DONGLE 0x641f Bluetooth USB dongle product MITSUMI FDD 0x6901 USB FDD +/* Mobile Action products */ +product MOBILEACTION MA620 0x0620 MA-620 Infrared Adapter + /* Mobility products */ product MOBILITY EA 0x0204 Ethernet product MOBILITY EASIDOCK 0x0304 EasiDock Ethernet From owner-svn-src-head@FreeBSD.ORG Wed Mar 4 06:01: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 2E735106566B; Wed, 4 Mar 2009 06:01:28 +0000 (UTC) (envelope-from das@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 1299D8FC2D; Wed, 4 Mar 2009 06:01:28 +0000 (UTC) (envelope-from das@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 n2461Rbc033549; Wed, 4 Mar 2009 06:01:27 GMT (envelope-from das@svn.freebsd.org) Received: (from das@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n2461RCf033543; Wed, 4 Mar 2009 06:01:27 GMT (envelope-from das@svn.freebsd.org) Message-Id: <200903040601.n2461RCf033543@svn.freebsd.org> From: David Schultz Date: Wed, 4 Mar 2009 06:01: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: r189361 - in head: include lib/libc/string 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, 04 Mar 2009 06:01:28 -0000 Author: das Date: Wed Mar 4 06:01:27 2009 New Revision: 189361 URL: http://svn.freebsd.org/changeset/base/189361 Log: Add wcpcpy(3) and wcpncpy(3). Added: head/lib/libc/string/wcpcpy.c (contents, props changed) - copied, changed from r189360, head/lib/libc/string/stpcpy.c head/lib/libc/string/wcpncpy.c (contents, props changed) - copied, changed from r189360, head/lib/libc/string/stpncpy.c Modified: head/include/wchar.h head/lib/libc/string/Makefile.inc head/lib/libc/string/Symbol.map head/lib/libc/string/wmemchr.3 Modified: head/include/wchar.h ============================================================================== --- head/include/wchar.h Wed Mar 4 03:47:57 2009 (r189360) +++ head/include/wchar.h Wed Mar 4 06:01:27 2009 (r189361) @@ -213,6 +213,8 @@ int wcwidth(wchar_t); #if __POSIX_VISIBLE >= 200809 || __BSD_VISIBLE size_t mbsnrtowcs(wchar_t * __restrict, const char ** __restrict, size_t, size_t, mbstate_t * __restrict); +wchar_t *wcpcpy(wchar_t __restrict *, const wchar_t * __restrict); +wchar_t *wcpncpy(wchar_t __restrict *, const wchar_t * __restrict, size_t); wchar_t *wcsdup(const wchar_t *) __malloc_like; int wcscasecmp(const wchar_t *, const wchar_t *); int wcsncasecmp(const wchar_t *, const wchar_t *, size_t n); Modified: head/lib/libc/string/Makefile.inc ============================================================================== --- head/lib/libc/string/Makefile.inc Wed Mar 4 03:47:57 2009 (r189360) +++ head/lib/libc/string/Makefile.inc Wed Mar 4 06:01:27 2009 (r189361) @@ -14,7 +14,7 @@ MISRCS+=bcmp.c bcopy.c bzero.c ffs.c ffs strdup.c strerror.c strlcat.c strlcpy.c strlen.c strmode.c strncat.c \ strncmp.c strncpy.c strndup.c strnlen.c strnstr.c \ strpbrk.c strrchr.c strsep.c strsignal.c strspn.c strstr.c strtok.c \ - strxfrm.c swab.c wcscasecmp.c wcscat.c \ + strxfrm.c swab.c wcpcpy.c wcpncpy.c wcscasecmp.c wcscat.c \ wcschr.c wcscmp.c wcscoll.c wcscpy.c wcscspn.c wcsdup.c \ wcslcat.c wcslcpy.c wcslen.c wcsncasecmp.c wcsncat.c wcsncmp.c \ wcsncpy.c wcsnlen.c wcspbrk.c \ @@ -61,7 +61,9 @@ MLINKS+=strlen.3 strnlen.3 MLINKS+=strstr.3 strcasestr.3 \ strstr.3 strnstr.3 MLINKS+=strtok.3 strtok_r.3 -MLINKS+=wmemchr.3 wcscasecmp.3 \ +MLINKS+=wmemchr.3 wcpcpy.3 \ + wmemchr.3 wcpncpy.3 \ + wmemchr.3 wcscasecmp.3 \ wmemchr.3 wcscat.3 \ wmemchr.3 wcschr.3 \ wmemchr.3 wcscmp.3 \ Modified: head/lib/libc/string/Symbol.map ============================================================================== --- head/lib/libc/string/Symbol.map Wed Mar 4 03:47:57 2009 (r189360) +++ head/lib/libc/string/Symbol.map Wed Mar 4 06:01:27 2009 (r189361) @@ -84,6 +84,8 @@ FBSD_1.1 { stpncpy; strndup; strnlen; + wcpcpy; + wcpncpy; wcscasecmp; wcsncasecmp; wcsnlen; Copied and modified: head/lib/libc/string/wcpcpy.c (from r189360, head/lib/libc/string/stpcpy.c) ============================================================================== --- head/lib/libc/string/stpcpy.c Wed Mar 4 03:47:57 2009 (r189360, copy source) +++ head/lib/libc/string/wcpcpy.c Wed Mar 4 06:01:27 2009 (r189361) @@ -35,10 +35,10 @@ static char sccsid[] = "@(#)strcpy.c 8.1 #include __FBSDID("$FreeBSD$"); -#include +#include -char * -stpcpy(char * __restrict to, const char * __restrict from) +wchar_t * +wcpcpy(wchar_t * __restrict to, const wchar_t * __restrict from) { for (; (*to = *from); ++from, ++to); Copied and modified: head/lib/libc/string/wcpncpy.c (from r189360, head/lib/libc/string/stpncpy.c) ============================================================================== --- head/lib/libc/string/stpncpy.c Wed Mar 4 03:47:57 2009 (r189360, copy source) +++ head/lib/libc/string/wcpncpy.c Wed Mar 4 06:01:27 2009 (r189361) @@ -27,17 +27,17 @@ #include __FBSDID("$FreeBSD$"); -#include +#include -char * -stpncpy(char * __restrict dst, const char * __restrict src, size_t n) +wchar_t * +wcpncpy(wchar_t * __restrict dst, const wchar_t * __restrict src, size_t n) { for (; n--; dst++, src++) { if (!(*dst = *src)) { - char *ret = dst; + wchar_t *ret = dst; while (n--) - *++dst = '\0'; + *++dst = L'\0'; return (ret); } } Modified: head/lib/libc/string/wmemchr.3 ============================================================================== --- head/lib/libc/string/wmemchr.3 Wed Mar 4 03:47:57 2009 (r189360) +++ head/lib/libc/string/wmemchr.3 Wed Mar 4 06:01:27 2009 (r189361) @@ -35,7 +35,7 @@ .\" .\" $FreeBSD$ .\" -.Dd February 28, 2009 +.Dd March 4, 2009 .Dt WMEMCHR 3 .Os .Sh NAME @@ -44,6 +44,8 @@ .Nm wmemcpy , .Nm wmemmove , .Nm wmemset , +.Nm wcpcpy , +.Nm wcpncpy , .Nm wcscasecmp , .Nm wcscat , .Nm wcschr , @@ -78,6 +80,10 @@ .Fn wmemmove "wchar_t *s1" "const wchar_t *s2" "size_t n" .Ft wchar_t * .Fn wmemset "wchar_t *s" "wchar_t c" "size_t n" +.Ft wchar_t * +.Fn wcpcpy "wchar_t *s1" "wchar_t *s2" +.Ft wchar_t * +.Fn wcpncpy "wchar_t *s1" "wchar_t *s2" "size_t n" .Ft int .Fn wcscasecmp "const wchar_t *s1" "const wchar_t *s2" .Ft wchar_t * @@ -128,6 +134,8 @@ counterpart, such as .Xr memcpy 3 , .Xr memmove 3 , .Xr memset 3 , +.Xr stpcpy 3 , +.Xr stpncpy 3 , .Xr strcasecmp 3 , .Xr strcat 3 , .Xr strchr 3 , @@ -150,6 +158,8 @@ counterpart, such as These functions conform to .St -isoC-99 , with the exception of +.Fn wcpcpy , +.Fn wcpncpy , .Fn wcscasecmp , .Fn wcsdup , .Fn wcsncasecmp , From owner-svn-src-head@FreeBSD.ORG Wed Mar 4 12:14: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 EB480106567A; Wed, 4 Mar 2009 12:14:33 +0000 (UTC) (envelope-from dchagin@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D639B8FC1F; Wed, 4 Mar 2009 12:14:33 +0000 (UTC) (envelope-from dchagin@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 n24CEXKD041842; Wed, 4 Mar 2009 12:14:33 GMT (envelope-from dchagin@svn.freebsd.org) Received: (from dchagin@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n24CEXmG041836; Wed, 4 Mar 2009 12:14:33 GMT (envelope-from dchagin@svn.freebsd.org) Message-Id: <200903041214.n24CEXmG041836@svn.freebsd.org> From: Dmitry Chagin Date: Wed, 4 Mar 2009 12:14: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: r189362 - in head/sys: amd64/linux32 compat/linux i386/linux 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, 04 Mar 2009 12:14:35 -0000 Author: dchagin Date: Wed Mar 4 12:14:33 2009 New Revision: 189362 URL: http://svn.freebsd.org/changeset/base/189362 Log: Add AT_PLATFORM, AT_HWCAP and AT_CLKTCK auxiliary vector entries which are used by glibc. This silents the message "2.4+ kernel w/o ELF notes?" from some programs at start, among them are top and pkill. Do the assignment of the vector entries in elf_linux_fixup() as it is done in glibc. Fix some minor style issues. Submitted by: Marcin Cieslak Approved by: kib (mentor) MFC after: 1 week Modified: head/sys/amd64/linux32/linux.h head/sys/amd64/linux32/linux32_sysvec.c head/sys/compat/linux/linux_misc.c head/sys/compat/linux/linux_misc.h head/sys/i386/linux/linux.h head/sys/i386/linux/linux_sysvec.c Modified: head/sys/amd64/linux32/linux.h ============================================================================== --- head/sys/amd64/linux32/linux.h Wed Mar 4 06:01:27 2009 (r189361) +++ head/sys/amd64/linux32/linux.h Wed Mar 4 12:14:33 2009 (r189362) @@ -108,6 +108,10 @@ typedef struct { #define LINUX_CTL_MAXNAME 10 +#define LINUX_AT_COUNT 16 /* Count of used aux entry types. + * Keep this synchronized with + * elf_linux_fixup() code. + */ struct l___sysctl_args { l_uintptr_t name; Modified: head/sys/amd64/linux32/linux32_sysvec.c ============================================================================== --- head/sys/amd64/linux32/linux32_sysvec.c Wed Mar 4 06:01:27 2009 (r189361) +++ head/sys/amd64/linux32/linux32_sysvec.c Wed Mar 4 12:14:33 2009 (r189362) @@ -78,6 +78,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include @@ -106,6 +107,8 @@ MALLOC_DEFINE(M_LINUX, "linux", "Linux m #define LINUX_SYS_linux_rt_sendsig 0 #define LINUX_SYS_linux_sendsig 0 +const char *linux_platform = "i686"; +static int linux_szplatform; extern char linux_sigcode[]; extern int linux_szsigcode; @@ -246,7 +249,12 @@ elf_linux_fixup(register_t **stack_base, { Elf32_Auxargs *args; Elf32_Addr *base; - Elf32_Addr *pos; + Elf32_Addr *pos, *uplatform; + struct linux32_ps_strings *arginfo; + + arginfo = (struct linux32_ps_strings *)LINUX32_PS_STRINGS; + uplatform = (Elf32_Addr *)((caddr_t)arginfo - linux_szsigcode - + linux_szplatform); KASSERT(curthread->td_proc == imgp->proc, ("unsafe elf_linux_fixup(), should be curproc")); @@ -254,8 +262,8 @@ elf_linux_fixup(register_t **stack_base, args = (Elf32_Auxargs *)imgp->auxargs; pos = base + (imgp->args->argc + imgp->args->envc + 2); - if (args->execfd != -1) - AUXARGS_ENTRY_32(pos, AT_EXECFD, args->execfd); + AUXARGS_ENTRY_32(pos, LINUX_AT_HWCAP, cpu_feature); + AUXARGS_ENTRY_32(pos, LINUX_AT_CLKTCK, hz); AUXARGS_ENTRY_32(pos, AT_PHDR, args->phdr); AUXARGS_ENTRY_32(pos, AT_PHENT, args->phent); AUXARGS_ENTRY_32(pos, AT_PHNUM, args->phnum); @@ -263,10 +271,14 @@ elf_linux_fixup(register_t **stack_base, AUXARGS_ENTRY_32(pos, AT_FLAGS, args->flags); AUXARGS_ENTRY_32(pos, AT_ENTRY, args->entry); AUXARGS_ENTRY_32(pos, AT_BASE, args->base); + AUXARGS_ENTRY_32(pos, LINUX_AT_SECURE, 0); AUXARGS_ENTRY_32(pos, AT_UID, imgp->proc->p_ucred->cr_ruid); AUXARGS_ENTRY_32(pos, AT_EUID, imgp->proc->p_ucred->cr_svuid); AUXARGS_ENTRY_32(pos, AT_GID, imgp->proc->p_ucred->cr_rgid); AUXARGS_ENTRY_32(pos, AT_EGID, imgp->proc->p_ucred->cr_svgid); + AUXARGS_ENTRY_32(pos, LINUX_AT_PLATFORM, PTROUT(uplatform)); + if (args->execfd != -1) + AUXARGS_ENTRY_32(pos, AT_EXECFD, args->execfd); AUXARGS_ENTRY_32(pos, AT_NULL, 0); free(imgp->auxargs, M_TEMP); @@ -857,23 +869,27 @@ linux_copyout_strings(struct image_param char *stringp, *destp; u_int32_t *stack_base; struct linux32_ps_strings *arginfo; - int sigcodesz; /* * Calculate string base and vector table pointers. * Also deal with signal trampoline code for this exec type. */ arginfo = (struct linux32_ps_strings *)LINUX32_PS_STRINGS; - sigcodesz = *(imgp->proc->p_sysent->sv_szsigcode); - destp = (caddr_t)arginfo - sigcodesz - SPARE_USRSPACE - - roundup((ARG_MAX - imgp->args->stringspace), sizeof(char *)); + destp = (caddr_t)arginfo - linux_szsigcode - SPARE_USRSPACE - + linux_szplatform - roundup((ARG_MAX - imgp->args->stringspace), + sizeof(char *)); /* * install sigcode */ - if (sigcodesz) - copyout(imgp->proc->p_sysent->sv_sigcode, - ((caddr_t)arginfo - sigcodesz), sigcodesz); + copyout(imgp->proc->p_sysent->sv_sigcode, + ((caddr_t)arginfo - linux_szsigcode), linux_szsigcode); + + /* + * Install LINUX_PLATFORM + */ + copyout(linux_platform, ((caddr_t)arginfo - linux_szsigcode - + linux_szplatform), linux_szplatform); /* * If we have a valid auxargs ptr, prepare some room @@ -885,7 +901,7 @@ linux_copyout_strings(struct image_param * lower compatibility. */ imgp->auxarg_size = (imgp->auxarg_size) ? imgp->auxarg_size : - (AT_COUNT * 2); + (LINUX_AT_COUNT * 2); /* * The '+ 2' is for the null pointers at the end of each of * the arg and env vector sets,and imgp->auxarg_size is room @@ -919,14 +935,14 @@ linux_copyout_strings(struct image_param /* * Fill in "ps_strings" struct for ps, w, etc. */ - suword32(&arginfo->ps_argvstr, (u_int32_t)(intptr_t)vectp); + suword32(&arginfo->ps_argvstr, (uint32_t)(intptr_t)vectp); suword32(&arginfo->ps_nargvstr, argc); /* * Fill in argument portion of vector table. */ for (; argc > 0; --argc) { - suword32(vectp++, (u_int32_t)(intptr_t)destp); + suword32(vectp++, (uint32_t)(intptr_t)destp); while (*stringp++ != 0) destp++; destp++; @@ -935,14 +951,14 @@ linux_copyout_strings(struct image_param /* a null vector table pointer separates the argp's from the envp's */ suword32(vectp++, 0); - suword32(&arginfo->ps_envstr, (u_int32_t)(intptr_t)vectp); + suword32(&arginfo->ps_envstr, (uint32_t)(intptr_t)vectp); suword32(&arginfo->ps_nenvstr, envc); /* * Fill in environment portion of vector table. */ for (; envc > 0; --envc) { - suword32(vectp++, (u_int32_t)(intptr_t)destp); + suword32(vectp++, (uint32_t)(intptr_t)destp); while (*stringp++ != 0) destp++; destp++; @@ -1089,6 +1105,8 @@ linux_elf_modevent(module_t mod, int typ linux_schedtail, NULL, 1000); linux_exec_tag = EVENTHANDLER_REGISTER(process_exec, linux_proc_exec, NULL, 1000); + linux_szplatform = roundup(strlen(linux_platform) + 1, + sizeof(char *)); if (bootverbose) printf("Linux ELF exec handler installed\n"); } else Modified: head/sys/compat/linux/linux_misc.c ============================================================================== --- head/sys/compat/linux/linux_misc.c Wed Mar 4 06:01:27 2009 (r189361) +++ head/sys/compat/linux/linux_misc.c Wed Mar 4 12:14:33 2009 (r189362) @@ -92,10 +92,6 @@ __FBSDID("$FreeBSD$"); #include #include -#ifdef __i386__ -#include -#endif - #define BSD_TO_LINUX_SIGNAL(sig) \ (((sig) <= LINUX_SIGTBLSZ) ? bsd_to_linux_signal[_SIG_IDX(sig)] : sig) @@ -731,34 +727,8 @@ linux_newuname(struct thread *td, struct *p = '\0'; break; } -#ifdef __i386__ - { - const char *class; - - switch (cpu_class) { - case CPUCLASS_686: - class = "i686"; - break; - case CPUCLASS_586: - class = "i586"; - break; - case CPUCLASS_486: - class = "i486"; - break; - default: - class = "i386"; - } - strlcpy(utsname.machine, class, LINUX_MAX_UTSNAME); - } -#elif defined(__amd64__) /* XXX: Linux can change 'personality'. */ -#ifdef COMPAT_LINUX32 - strlcpy(utsname.machine, "i686", LINUX_MAX_UTSNAME); -#else - strlcpy(utsname.machine, "x86_64", LINUX_MAX_UTSNAME); -#endif /* COMPAT_LINUX32 */ -#else /* something other than i386 or amd64 - assume we and Linux agree */ - strlcpy(utsname.machine, machine, LINUX_MAX_UTSNAME); -#endif /* __i386__ */ + strlcpy(utsname.machine, linux_platform, LINUX_MAX_UTSNAME); + mtx_lock(&hostname_mtx); strlcpy(utsname.domainname, V_domainname, LINUX_MAX_UTSNAME); mtx_unlock(&hostname_mtx); Modified: head/sys/compat/linux/linux_misc.h ============================================================================== --- head/sys/compat/linux/linux_misc.h Wed Mar 4 06:01:27 2009 (r189361) +++ head/sys/compat/linux/linux_misc.h Wed Mar 4 12:14:33 2009 (r189362) @@ -45,4 +45,19 @@ #define LINUX_MREMAP_MAYMOVE 1 #define LINUX_MREMAP_FIXED 2 +extern const char *linux_platform; + +/* + * Non-standard aux entry types used in Linux ELF binaries. + */ + +#define LINUX_AT_PLATFORM 15 /* String identifying CPU */ +#define LINUX_AT_HWCAP 16 /* CPU capabilities */ +#define LINUX_AT_CLKTCK 17 /* frequency at which times() increments */ +#define LINUX_AT_SECURE 23 /* secure mode boolean */ +#define LINUX_AT_BASE_PLATFORM 24 /* string identifying real platform, may + * differ from AT_PLATFORM. + */ +#define LINUX_AT_EXECFN 31 /* filename of program */ + #endif /* _LINUX_MISC_H_ */ Modified: head/sys/i386/linux/linux.h ============================================================================== --- head/sys/i386/linux/linux.h Wed Mar 4 06:01:27 2009 (r189361) +++ head/sys/i386/linux/linux.h Wed Mar 4 12:14:33 2009 (r189362) @@ -102,6 +102,10 @@ typedef struct { #define LINUX_CTL_MAXNAME 10 +#define LINUX_AT_COUNT 16 /* Count of used aux entry types. + * Keep this synchronized with + * elf_linux_fixup() code. + */ struct l___sysctl_args { l_int *name; Modified: head/sys/i386/linux/linux_sysvec.c ============================================================================== --- head/sys/i386/linux/linux_sysvec.c Wed Mar 4 06:01:27 2009 (r189361) +++ head/sys/i386/linux/linux_sysvec.c Wed Mar 4 12:14:33 2009 (r189362) @@ -58,6 +58,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include @@ -65,6 +66,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include @@ -107,6 +109,10 @@ static void linux_prepsyscall(struct tra static void linux_sendsig(sig_t catcher, ksiginfo_t *ksi, sigset_t *mask); static void exec_linux_setregs(struct thread *td, u_long entry, u_long stack, u_long ps_strings); +static register_t *linux_copyout_strings(struct image_params *imgp); + +static int linux_szplatform; +const char *linux_platform; extern LIST_HEAD(futex_list, futex) futex_list; extern struct sx futex_sx; @@ -231,22 +237,30 @@ linux_fixup(register_t **stack_base, str **stack_base = (intptr_t)(void *)argv; (*stack_base)--; **stack_base = imgp->args->argc; - return 0; + return (0); } static int elf_linux_fixup(register_t **stack_base, struct image_params *imgp) { + struct proc *p; Elf32_Auxargs *args; + Elf32_Addr *uplatform; + struct ps_strings *arginfo; register_t *pos; KASSERT(curthread->td_proc == imgp->proc, ("unsafe elf_linux_fixup(), should be curproc")); + + p = imgp->proc; + arginfo = (struct ps_strings *)p->p_sysent->sv_psstrings; + uplatform = (Elf32_Addr *)((caddr_t)arginfo - linux_szsigcode - + linux_szplatform); args = (Elf32_Auxargs *)imgp->auxargs; pos = *stack_base + (imgp->args->argc + imgp->args->envc + 2); - if (args->execfd != -1) - AUXARGS_ENTRY(pos, AT_EXECFD, args->execfd); + AUXARGS_ENTRY(pos, LINUX_AT_HWCAP, cpu_feature); + AUXARGS_ENTRY(pos, LINUX_AT_CLKTCK, hz); AUXARGS_ENTRY(pos, AT_PHDR, args->phdr); AUXARGS_ENTRY(pos, AT_PHENT, args->phent); AUXARGS_ENTRY(pos, AT_PHNUM, args->phnum); @@ -254,10 +268,14 @@ elf_linux_fixup(register_t **stack_base, AUXARGS_ENTRY(pos, AT_FLAGS, args->flags); AUXARGS_ENTRY(pos, AT_ENTRY, args->entry); AUXARGS_ENTRY(pos, AT_BASE, args->base); + AUXARGS_ENTRY(pos, LINUX_AT_SECURE, 0); AUXARGS_ENTRY(pos, AT_UID, imgp->proc->p_ucred->cr_ruid); AUXARGS_ENTRY(pos, AT_EUID, imgp->proc->p_ucred->cr_svuid); AUXARGS_ENTRY(pos, AT_GID, imgp->proc->p_ucred->cr_rgid); AUXARGS_ENTRY(pos, AT_EGID, imgp->proc->p_ucred->cr_svgid); + AUXARGS_ENTRY(pos, LINUX_AT_PLATFORM, PTROUT(uplatform)); + if (args->execfd != -1) + AUXARGS_ENTRY(pos, AT_EXECFD, args->execfd); AUXARGS_ENTRY(pos, AT_NULL, 0); free(imgp->auxargs, M_TEMP); @@ -265,9 +283,125 @@ elf_linux_fixup(register_t **stack_base, (*stack_base)--; **stack_base = (register_t)imgp->args->argc; - return 0; + return (0); } +/* + * Copied from kern/kern_exec.c + */ +static register_t * +linux_copyout_strings(struct image_params *imgp) +{ + int argc, envc; + char **vectp; + char *stringp, *destp; + register_t *stack_base; + struct ps_strings *arginfo; + struct proc *p; + + /* + * Calculate string base and vector table pointers. + * Also deal with signal trampoline code for this exec type. + */ + p = imgp->proc; + arginfo = (struct ps_strings *)p->p_sysent->sv_psstrings; + destp = (caddr_t)arginfo - linux_szsigcode - SPARE_USRSPACE - + linux_szplatform - roundup((ARG_MAX - imgp->args->stringspace), + sizeof(char *)); + + /* + * install sigcode + */ + copyout(p->p_sysent->sv_sigcode, ((caddr_t)arginfo - + linux_szsigcode), linux_szsigcode); + + /* + * install LINUX_PLATFORM + */ + copyout(linux_platform, ((caddr_t)arginfo - linux_szsigcode - + linux_szplatform), linux_szplatform); + + /* + * If we have a valid auxargs ptr, prepare some room + * on the stack. + */ + if (imgp->auxargs) { + /* + * 'AT_COUNT*2' is size for the ELF Auxargs data. This is for + * lower compatibility. + */ + imgp->auxarg_size = (imgp->auxarg_size) ? imgp->auxarg_size : + (LINUX_AT_COUNT * 2); + /* + * The '+ 2' is for the null pointers at the end of each of + * the arg and env vector sets,and imgp->auxarg_size is room + * for argument of Runtime loader. + */ + vectp = (char **)(destp - (imgp->args->argc + + imgp->args->envc + 2 + imgp->auxarg_size) * sizeof(char *)); + } else { + /* + * The '+ 2' is for the null pointers at the end of each of + * the arg and env vector sets + */ + vectp = (char **)(destp - (imgp->args->argc + imgp->args->envc + 2) * + sizeof(char *)); + } + + /* + * vectp also becomes our initial stack base + */ + stack_base = (register_t *)vectp; + + stringp = imgp->args->begin_argv; + argc = imgp->args->argc; + envc = imgp->args->envc; + + /* + * Copy out strings - arguments and environment. + */ + copyout(stringp, destp, ARG_MAX - imgp->args->stringspace); + + /* + * Fill in "ps_strings" struct for ps, w, etc. + */ + suword(&arginfo->ps_argvstr, (long)(intptr_t)vectp); + suword(&arginfo->ps_nargvstr, argc); + + /* + * Fill in argument portion of vector table. + */ + for (; argc > 0; --argc) { + suword(vectp++, (long)(intptr_t)destp); + while (*stringp++ != 0) + destp++; + destp++; + } + + /* a null vector table pointer separates the argp's from the envp's */ + suword(vectp++, 0); + + suword(&arginfo->ps_envstr, (long)(intptr_t)vectp); + suword(&arginfo->ps_nenvstr, envc); + + /* + * Fill in environment portion of vector table. + */ + for (; envc > 0; --envc) { + suword(vectp++, (long)(intptr_t)destp); + while (*stringp++ != 0) + destp++; + destp++; + } + + /* end of vector table is a null pointer */ + suword(vectp, 0); + + return (stack_base); +} + + + extern int _ucodesel, _udatasel; extern unsigned long linux_sznonrtsigcode; @@ -808,6 +942,25 @@ exec_linux_setregs(struct thread *td, u_ fldcw(&control); } +static void +linux_get_machine(const char **dst) +{ + + switch (cpu_class) { + case CPUCLASS_686: + *dst = "i686"; + break; + case CPUCLASS_586: + *dst = "i586"; + break; + case CPUCLASS_486: + *dst = "i486"; + break; + default: + *dst = "i386"; + } +} + struct sysentvec linux_sysvec = { .sv_size = LINUX_SYS_MAXSYSCALL, .sv_table = linux_sysent, @@ -863,7 +1016,7 @@ struct sysentvec elf_linux_sysvec = { .sv_usrstack = USRSTACK, .sv_psstrings = PS_STRINGS, .sv_stackprot = VM_PROT_ALL, - .sv_copyout_strings = exec_copyout_strings, + .sv_copyout_strings = linux_copyout_strings, .sv_setregs = exec_linux_setregs, .sv_fixlimit = NULL, .sv_maxssiz = NULL, @@ -929,6 +1082,9 @@ linux_elf_modevent(module_t mod, int typ NULL, 1000); linux_exec_tag = EVENTHANDLER_REGISTER(process_exec, linux_proc_exec, NULL, 1000); + linux_get_machine(&linux_platform); + linux_szplatform = roundup(strlen(linux_platform) + 1, + sizeof(char *)); if (bootverbose) printf("Linux ELF exec handler installed\n"); } else From owner-svn-src-head@FreeBSD.ORG Wed Mar 4 13:26: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 853D6106566C; Wed, 4 Mar 2009 13:26:36 +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 38CCF8FC14; Wed, 4 Mar 2009 13:26:35 +0000 (UTC) (envelope-from rdivacky@vlk.vlakno.cz) Received: from localhost (localhost [127.0.0.1]) by vlakno.cz (Postfix) with ESMTP id 1848E9CB0DD; Wed, 4 Mar 2009 14:23:12 +0100 (CET) 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 nGb4WjZKjrPK; Wed, 4 Mar 2009 14:23:06 +0100 (CET) Received: from vlk.vlakno.cz (localhost [127.0.0.1]) by vlakno.cz (Postfix) with ESMTP id 58EC09CB113; Wed, 4 Mar 2009 14:23:06 +0100 (CET) Received: (from rdivacky@localhost) by vlk.vlakno.cz (8.14.3/8.14.3/Submit) id n24DN6WF046610; Wed, 4 Mar 2009 14:23:06 +0100 (CET) (envelope-from rdivacky) Date: Wed, 4 Mar 2009 14:23:06 +0100 From: Roman Divacky To: Dmitry Chagin Message-ID: <20090304132306.GA46344@freebsd.org> References: <200903041214.n24CEXmG041836@svn.freebsd.org> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="qDbXVdCdHGoSgWSk" Content-Disposition: inline In-Reply-To: <200903041214.n24CEXmG041836@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: r189362 - in head/sys: amd64/linux32 compat/linux i386/linux 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, 04 Mar 2009 13:26:37 -0000 --qDbXVdCdHGoSgWSk Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, Mar 04, 2009 at 12:14:33PM +0000, Dmitry Chagin wrote: > Author: dchagin > Date: Wed Mar 4 12:14:33 2009 > New Revision: 189362 > URL: http://svn.freebsd.org/changeset/base/189362 >=20 > Log: > Add AT_PLATFORM, AT_HWCAP and AT_CLKTCK auxiliary vector entries which > are used by glibc. This silents the message "2.4+ kernel w/o ELF notes?" > from some programs at start, among them are top and pkill. > =20 > Do the assignment of the vector entries in elf_linux_fixup() > as it is done in glibc. > =20 > Fix some minor style issues. cool! have you tested this works with 2.4 emulation? I think it might break it as I am quite sure the aux tags changed between 2.4 and 2.6. we might need to scrap 2.4 emulation altogether in 8.x roman --qDbXVdCdHGoSgWSk Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.10 (FreeBSD) iEYEARECAAYFAkmugLEACgkQLVEj6D3CBEzmUwCdF9qc7Lfael4Pm3U5pJoCCxKy bIUAnA9jIiUi3LpasRCtE3vlbw2AOlX+ =EDj5 -----END PGP SIGNATURE----- --qDbXVdCdHGoSgWSk-- From owner-svn-src-head@FreeBSD.ORG Wed Mar 4 13:46: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 1FC97106564A; Wed, 4 Mar 2009 13:46:49 +0000 (UTC) (envelope-from dchagin@dchagin.static.corbina.ru) Received: from contrabass.post.ru (contrabass.post.ru [85.21.78.5]) by mx1.freebsd.org (Postfix) with ESMTP id B7DC68FC1B; Wed, 4 Mar 2009 13:46:48 +0000 (UTC) (envelope-from dchagin@dchagin.static.corbina.ru) Received: from corbina.ru (mail.post.ru [195.14.50.16]) by contrabass.post.ru (Postfix) with ESMTP id D3E2065E42; Wed, 4 Mar 2009 16:46:46 +0300 (MSK) X-Virus-Scanned: by cgpav Uf39PSi9pFi9oFi9 Received: from [10.208.17.3] (HELO dchagin.static.corbina.ru) by corbina.ru (CommuniGate Pro SMTP 5.1.14) with ESMTPS id 1659931457; Wed, 04 Mar 2009 16:46:46 +0300 Received: from dchagin.static.corbina.ru (localhost.chd.net [127.0.0.1]) by dchagin.static.corbina.ru (8.14.3/8.14.3) with ESMTP id n24Dki3u006129; Wed, 4 Mar 2009 16:46:44 +0300 (MSK) (envelope-from dchagin@dchagin.static.corbina.ru) Received: (from dchagin@localhost) by dchagin.static.corbina.ru (8.14.3/8.14.3/Submit) id n24DkdKB006128; Wed, 4 Mar 2009 16:46:39 +0300 (MSK) (envelope-from dchagin) Date: Wed, 4 Mar 2009 16:46:39 +0300 From: Chagin Dmitry To: Roman Divacky Message-ID: <20090304134639.GA5968@dchagin.static.corbina.ru> References: <200903041214.n24CEXmG041836@svn.freebsd.org> <20090304132306.GA46344@freebsd.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="EeQfGwPcQSOJBaQU" Content-Disposition: inline In-Reply-To: <20090304132306.GA46344@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: r189362 - in head/sys: amd64/linux32 compat/linux i386/linux 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, 04 Mar 2009 13:46:51 -0000 --EeQfGwPcQSOJBaQU Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, Mar 04, 2009 at 02:23:06PM +0100, Roman Divacky wrote: > On Wed, Mar 04, 2009 at 12:14:33PM +0000, Dmitry Chagin wrote: > > Author: dchagin > > Date: Wed Mar 4 12:14:33 2009 > > New Revision: 189362 > > URL: http://svn.freebsd.org/changeset/base/189362 > >=20 > > Log: > > Add AT_PLATFORM, AT_HWCAP and AT_CLKTCK auxiliary vector entries which > > are used by glibc. This silents the message "2.4+ kernel w/o ELF note= s?" > > from some programs at start, among them are top and pkill. > > =20 > > Do the assignment of the vector entries in elf_linux_fixup() > > as it is done in glibc. > > =20 > > Fix some minor style issues. >=20 > cool! have you tested this works with 2.4 emulation? I think it might > break it as I am quite sure the aux tags changed between 2.4 and 2.6. >=20 > we might need to scrap 2.4 emulation altogether in 8.x >=20 hi Roman! glibc do: for (av =3D _dl_auxv; av->a_type !=3D AT_NULL; set_seen (av++)) switch (av->a_type) { case AT_PHDR: phdr =3D (void *) av->a_un.a_val; break; etc....., and how it can be broken by adding new AT entries? --=20 Have fun! chd --EeQfGwPcQSOJBaQU Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.10 (FreeBSD) iEYEARECAAYFAkmuhj4ACgkQ0t2Tb3OO/O0clACeNLlMrVzoKnAAY+eSi/ck4HUi L7kAnjyiLH0BpX6Zi7/o5oXCPWTP7UtB =yJqd -----END PGP SIGNATURE----- --EeQfGwPcQSOJBaQU-- From owner-svn-src-head@FreeBSD.ORG Wed Mar 4 13:49: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 B2D531065679; Wed, 4 Mar 2009 13:49:12 +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 648668FC12; Wed, 4 Mar 2009 13:49:12 +0000 (UTC) (envelope-from rdivacky@vlk.vlakno.cz) Received: from localhost (localhost [127.0.0.1]) by vlakno.cz (Postfix) with ESMTP id 372839CB113; Wed, 4 Mar 2009 14:45:50 +0100 (CET) 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 Cc2KfDM-x1+c; Wed, 4 Mar 2009 14:45:38 +0100 (CET) Received: from vlk.vlakno.cz (localhost [127.0.0.1]) by vlakno.cz (Postfix) with ESMTP id 7D66C9CB189; Wed, 4 Mar 2009 14:45:38 +0100 (CET) Received: (from rdivacky@localhost) by vlk.vlakno.cz (8.14.3/8.14.3/Submit) id n24DjcDw049782; Wed, 4 Mar 2009 14:45:38 +0100 (CET) (envelope-from rdivacky) Date: Wed, 4 Mar 2009 14:45:38 +0100 From: Roman Divacky To: Chagin Dmitry Message-ID: <20090304134538.GA49621@freebsd.org> References: <200903041214.n24CEXmG041836@svn.freebsd.org> <20090304132306.GA46344@freebsd.org> <20090304134639.GA5968@dchagin.static.corbina.ru> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="VbJkn9YxBvnuCH5J" Content-Disposition: inline In-Reply-To: <20090304134639.GA5968@dchagin.static.corbina.ru> 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: r189362 - in head/sys: amd64/linux32 compat/linux i386/linux 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, 04 Mar 2009 13:49:13 -0000 --VbJkn9YxBvnuCH5J Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, Mar 04, 2009 at 04:46:39PM +0300, Chagin Dmitry wrote: > On Wed, Mar 04, 2009 at 02:23:06PM +0100, Roman Divacky wrote: > > On Wed, Mar 04, 2009 at 12:14:33PM +0000, Dmitry Chagin wrote: > > > Author: dchagin > > > Date: Wed Mar 4 12:14:33 2009 > > > New Revision: 189362 > > > URL: http://svn.freebsd.org/changeset/base/189362 > > >=20 > > > Log: > > > Add AT_PLATFORM, AT_HWCAP and AT_CLKTCK auxiliary vector entries wh= ich > > > are used by glibc. This silents the message "2.4+ kernel w/o ELF no= tes?" > > > from some programs at start, among them are top and pkill. > > > =20 > > > Do the assignment of the vector entries in elf_linux_fixup() > > > as it is done in glibc. > > > =20 > > > Fix some minor style issues. > >=20 > > cool! have you tested this works with 2.4 emulation? I think it might > > break it as I am quite sure the aux tags changed between 2.4 and 2.6. > >=20 > > we might need to scrap 2.4 emulation altogether in 8.x > >=20 >=20 >=20 > hi Roman! >=20 > glibc do: >=20 > for (av =3D _dl_auxv; av->a_type !=3D AT_NULL; set_seen (av++)) > switch (av->a_type) > { > case AT_PHDR: > phdr =3D (void *) av->a_un.a_val; > break; >=20 > etc....., and how it can be broken by adding new AT entries? ah... it's correct then thnx! --VbJkn9YxBvnuCH5J Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.10 (FreeBSD) iEYEARECAAYFAkmuhgEACgkQLVEj6D3CBExAwACeMG4e0R6khBQq7JrbTp/rIbdc V6cAn15RHYtE5vM/R44rp5qexWjgdtzK =CNpS -----END PGP SIGNATURE----- --VbJkn9YxBvnuCH5J-- From owner-svn-src-head@FreeBSD.ORG Wed Mar 4 13:53: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 DA8A81065672; Wed, 4 Mar 2009 13:53:57 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C8E578FC15; Wed, 4 Mar 2009 13:53:57 +0000 (UTC) (envelope-from avg@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 n24Drv7A044318; Wed, 4 Mar 2009 13:53:57 GMT (envelope-from avg@svn.freebsd.org) Received: (from avg@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n24DrvBt044317; Wed, 4 Mar 2009 13:53:57 GMT (envelope-from avg@svn.freebsd.org) Message-Id: <200903041353.n24DrvBt044317@svn.freebsd.org> From: Andriy Gapon Date: Wed, 4 Mar 2009 13:53: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: r189363 - head/sys/fs/udf 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, 04 Mar 2009 13:53:58 -0000 Author: avg Date: Wed Mar 4 13:53:57 2009 New Revision: 189363 URL: http://svn.freebsd.org/changeset/base/189363 Log: udf_strategy: remove redundant comment We fail mapping for any udf_bmap_internal error and there can be different reasons for it, so no need to (over-)emphasize files with data in fentry. Submitted by: bde Approved by: jhb Modified: head/sys/fs/udf/udf_vnops.c Modified: head/sys/fs/udf/udf_vnops.c ============================================================================== --- head/sys/fs/udf/udf_vnops.c Wed Mar 4 12:14:33 2009 (r189362) +++ head/sys/fs/udf/udf_vnops.c Wed Mar 4 13:53:57 2009 (r189363) @@ -1018,10 +1018,6 @@ udf_strategy(struct vop_strategy_args *a node = VTON(vp); if (bp->b_blkno == bp->b_lblkno) { - /* - * Files that are embedded in the fentry don't translate well - * to a block number. Reject. - */ offset = lblktosize(node->udfmp, bp->b_lblkno); error = udf_bmap_internal(node, offset, §or, &maxsize); if (error) { From owner-svn-src-head@FreeBSD.ORG Wed Mar 4 13:54:10 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 EE66C10656F7; Wed, 4 Mar 2009 13:54:10 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id DCEDB8FC19; Wed, 4 Mar 2009 13:54:10 +0000 (UTC) (envelope-from avg@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 n24DsA4Z044365; Wed, 4 Mar 2009 13:54:10 GMT (envelope-from avg@svn.freebsd.org) Received: (from avg@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n24DsAVr044364; Wed, 4 Mar 2009 13:54:10 GMT (envelope-from avg@svn.freebsd.org) Message-Id: <200903041354.n24DsAVr044364@svn.freebsd.org> From: Andriy Gapon Date: Wed, 4 Mar 2009 13:54: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: r189364 - head/sys/fs/udf 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, 04 Mar 2009 13:54:11 -0000 Author: avg Date: Wed Mar 4 13:54:10 2009 New Revision: 189364 URL: http://svn.freebsd.org/changeset/base/189364 Log: udf: use truly unique directory cookie 'off' is an offset within current block, so there is a good chance it can be non-unique, so use complete offset. Submitted by: bde Approved by: jhb Modified: head/sys/fs/udf/udf_vnops.c Modified: head/sys/fs/udf/udf_vnops.c ============================================================================== --- head/sys/fs/udf/udf_vnops.c Wed Mar 4 13:53:57 2009 (r189363) +++ head/sys/fs/udf/udf_vnops.c Wed Mar 4 13:54:10 2009 (r189364) @@ -738,7 +738,7 @@ udf_getfid(struct udf_dirstream *ds) * Update the offset. Align on a 4 byte boundary because the * UDF spec says so. */ - ds->this_off = ds->off; + ds->this_off = ds->offset + ds->off; if (!ds->fid_fragment) { ds->off += (total_fid_size + 3) & ~0x03; } else { From owner-svn-src-head@FreeBSD.ORG Wed Mar 4 15:45: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 F12B6106566B; Wed, 4 Mar 2009 15:45:34 +0000 (UTC) (envelope-from das@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id DFDFB8FC12; Wed, 4 Mar 2009 15:45:34 +0000 (UTC) (envelope-from das@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 n24FjY0o046466; Wed, 4 Mar 2009 15:45:34 GMT (envelope-from das@svn.freebsd.org) Received: (from das@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n24FjYP3046465; Wed, 4 Mar 2009 15:45:34 GMT (envelope-from das@svn.freebsd.org) Message-Id: <200903041545.n24FjYP3046465@svn.freebsd.org> From: David Schultz Date: Wed, 4 Mar 2009 15:45: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: r189365 - head/include X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 04 Mar 2009 15:45:35 -0000 Author: das Date: Wed Mar 4 15:45:34 2009 New Revision: 189365 URL: http://svn.freebsd.org/changeset/base/189365 Log: Put the restrict qualifiers in the right place in the wcp[n]cpy prototypes. Submitted by: Pawel Worach Modified: head/include/wchar.h Modified: head/include/wchar.h ============================================================================== --- head/include/wchar.h Wed Mar 4 13:54:10 2009 (r189364) +++ head/include/wchar.h Wed Mar 4 15:45:34 2009 (r189365) @@ -213,8 +213,8 @@ int wcwidth(wchar_t); #if __POSIX_VISIBLE >= 200809 || __BSD_VISIBLE size_t mbsnrtowcs(wchar_t * __restrict, const char ** __restrict, size_t, size_t, mbstate_t * __restrict); -wchar_t *wcpcpy(wchar_t __restrict *, const wchar_t * __restrict); -wchar_t *wcpncpy(wchar_t __restrict *, const wchar_t * __restrict, size_t); +wchar_t *wcpcpy(wchar_t * __restrict, const wchar_t * __restrict); +wchar_t *wcpncpy(wchar_t * __restrict, const wchar_t * __restrict, size_t); wchar_t *wcsdup(const wchar_t *) __malloc_like; int wcscasecmp(const wchar_t *, const wchar_t *); int wcsncasecmp(const wchar_t *, const wchar_t *, size_t n); From owner-svn-src-head@FreeBSD.ORG Wed Mar 4 18:23: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 B7D5110658B2; Wed, 4 Mar 2009 18:23:48 +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 A18C38FC1D; Wed, 4 Mar 2009 18:23:48 +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 n24INmKN049525; Wed, 4 Mar 2009 18:23:48 GMT (envelope-from rnoland@svn.freebsd.org) Received: (from rnoland@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n24INmcc049524; Wed, 4 Mar 2009 18:23:48 GMT (envelope-from rnoland@svn.freebsd.org) Message-Id: <200903041823.n24INmcc049524@svn.freebsd.org> From: Robert Noland Date: Wed, 4 Mar 2009 18: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: r189367 - head/sys/dev/pci 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, 04 Mar 2009 18:23:52 -0000 Author: rnoland Date: Wed Mar 4 18:23:48 2009 New Revision: 189367 URL: http://svn.freebsd.org/changeset/base/189367 Log: Extend the management of PCIM_CMD_INTxDIS. We now explicitly enable INTx during bus_setup_intr() if it is needed. Several of the ata drivers were managing this bit internally. This is better handled in pci and it should work for all drivers now. We also mask INTx during bus_teardown_intr() by setting this bit. Reviewed by: jhb MFC after: 3 days Modified: head/sys/dev/pci/pci.c Modified: head/sys/dev/pci/pci.c ============================================================================== --- head/sys/dev/pci/pci.c Wed Mar 4 16:21:00 2009 (r189366) +++ head/sys/dev/pci/pci.c Wed Mar 4 18:23:48 2009 (r189367) @@ -2825,14 +2825,24 @@ pci_setup_intr(device_t dev, device_t ch if (error) return (error); - /* - * If this is a direct child, check to see if the interrupt is - * MSI or MSI-X. If so, ask our parent to map the MSI and give - * us the address and data register values. If we fail for some - * reason, teardown the interrupt handler. - */ + /* If this is not a direct child, just bail out. */ + if (device_get_parent(child) != dev) { + *cookiep = cookie; + return(0); + } + rid = rman_get_rid(irq); - if (device_get_parent(child) == dev && rid > 0) { + if (rid == 0) { + /* Make sure that INTx is enabled */ + pci_clear_command_bit(dev, child, PCIM_CMD_INTxDIS); + } else { + /* + * Check to see if the interrupt is MSI or MSI-X. + * Ask our parent to map the MSI and give + * us the address and data register values. + * If we fail for some reason, teardown the + * interrupt handler. + */ dinfo = device_get_ivars(child); if (dinfo->cfg.msi.msi_alloc > 0) { if (dinfo->cfg.msi.msi_addr == 0) { @@ -2874,7 +2884,8 @@ pci_setup_intr(device_t dev, device_t ch } mte->mte_handlers++; } - /* Disable INTx if we are using MSI/MSIX */ + + /* Make sure that INTx is disabled if we are using MSI/MSIX */ pci_set_command_bit(dev, child, PCIM_CMD_INTxDIS); bad: if (error) { @@ -2896,16 +2907,24 @@ pci_teardown_intr(device_t dev, device_t struct pci_devinfo *dinfo; int error, rid; - /* - * If this is a direct child, check to see if the interrupt is - * MSI or MSI-X. If so, decrement the appropriate handlers - * count and mask the MSI-X message, or disable MSI messages - * if the count drops to 0. - */ if (irq == NULL || !(rman_get_flags(irq) & RF_ACTIVE)) return (EINVAL); + + /* If this isn't a direct child, just bail out */ + if (device_get_parent(child) != dev) + return(bus_generic_teardown_intr(dev, child, irq, cookie)); + rid = rman_get_rid(irq); - if (device_get_parent(child) == dev && rid > 0) { + if (rid > 0) { + /* Mask INTx */ + pci_set_command_bit(dev, child, PCIM_CMD_INTxDIS); + } else { + /* + * Check to see if the interrupt is MSI or MSI-X. If so, + * decrement the appropriate handlers count and mask the + * MSI-X message, or disable MSI messages if the count + * drops to 0. + */ dinfo = device_get_ivars(child); rle = resource_list_find(&dinfo->resources, SYS_RES_IRQ, rid); if (rle->res != irq) @@ -2930,11 +2949,9 @@ pci_teardown_intr(device_t dev, device_t if (mte->mte_handlers == 0) pci_mask_msix(child, rid - 1); } - /* Restore INTx capability for MSI/MSIX */ - pci_clear_command_bit(dev, child, PCIM_CMD_INTxDIS); } error = bus_generic_teardown_intr(dev, child, irq, cookie); - if (device_get_parent(child) == dev && rid > 0) + if (rid > 0) KASSERT(error == 0, ("%s: generic teardown failed for MSI/MSI-X", __func__)); return (error); From owner-svn-src-head@FreeBSD.ORG Wed Mar 4 18:25:40 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 99AB51065A3C; Wed, 4 Mar 2009 18:25:40 +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 8071B8FC20; Wed, 4 Mar 2009 18:25:40 +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 n24IPebL049609; Wed, 4 Mar 2009 18:25:40 GMT (envelope-from rnoland@svn.freebsd.org) Received: (from rnoland@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n24IPe2N049601; Wed, 4 Mar 2009 18:25:40 GMT (envelope-from rnoland@svn.freebsd.org) Message-Id: <200903041825.n24IPe2N049601@svn.freebsd.org> From: Robert Noland Date: Wed, 4 Mar 2009 18:25:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r189368 - 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, 04 Mar 2009 18:25:46 -0000 Author: rnoland Date: Wed Mar 4 18:25:39 2009 New Revision: 189368 URL: http://svn.freebsd.org/changeset/base/189368 Log: Remove the local management of INTx as this is now taken care of by pci. Reviewed by: jhb MFC after: 3 days Modified: head/sys/dev/ata/chipsets/ata-acerlabs.c head/sys/dev/ata/chipsets/ata-ahci.c head/sys/dev/ata/chipsets/ata-intel.c head/sys/dev/ata/chipsets/ata-marvell.c head/sys/dev/ata/chipsets/ata-nvidia.c head/sys/dev/ata/chipsets/ata-siliconimage.c head/sys/dev/ata/chipsets/ata-sis.c head/sys/dev/ata/chipsets/ata-via.c Modified: head/sys/dev/ata/chipsets/ata-acerlabs.c ============================================================================== --- head/sys/dev/ata/chipsets/ata-acerlabs.c Wed Mar 4 18:23:48 2009 (r189367) +++ head/sys/dev/ata/chipsets/ata-acerlabs.c Wed Mar 4 18:25:39 2009 (r189368) @@ -113,10 +113,6 @@ ata_ali_chipinit(device_t dev) if ((ctlr->chip->chipid == ATA_ALI_5288) && (ata_ahci_chipinit(dev) != ENXIO)) return 0; - - /* enable PCI interrupt */ - pci_write_config(dev, PCIR_COMMAND, - pci_read_config(dev, PCIR_COMMAND, 2) & ~0x0400, 2); break; case ALI_NEW: Modified: head/sys/dev/ata/chipsets/ata-ahci.c ============================================================================== --- head/sys/dev/ata/chipsets/ata-ahci.c Wed Mar 4 18:23:48 2009 (r189367) +++ head/sys/dev/ata/chipsets/ata-ahci.c Wed Mar 4 18:25:39 2009 (r189368) @@ -135,10 +135,6 @@ ata_ahci_chipinit(device_t dev) ctlr->suspend = ata_ahci_suspend; ctlr->resume = ata_ahci_ctlr_reset; - /* enable PCI interrupt */ - pci_write_config(dev, PCIR_COMMAND, - pci_read_config(dev, PCIR_COMMAND, 2) & ~0x0400, 2); - /* announce we support the HW */ version = ATA_INL(ctlr->r_res2, ATA_AHCI_VS); device_printf(dev, Modified: head/sys/dev/ata/chipsets/ata-intel.c ============================================================================== --- head/sys/dev/ata/chipsets/ata-intel.c Wed Mar 4 18:23:48 2009 (r189367) +++ head/sys/dev/ata/chipsets/ata-intel.c Wed Mar 4 18:25:39 2009 (r189368) @@ -213,10 +213,6 @@ ata_intel_chipinit(device_t dev) ctlr->setmode = ata_intel_sata_setmode; else ctlr->setmode = ata_sata_setmode; - - /* enable PCI interrupt */ - pci_write_config(dev, PCIR_COMMAND, - pci_read_config(dev, PCIR_COMMAND, 2) & ~0x0400, 2); } return 0; } Modified: head/sys/dev/ata/chipsets/ata-marvell.c ============================================================================== --- head/sys/dev/ata/chipsets/ata-marvell.c Wed Mar 4 18:23:48 2009 (r189367) +++ head/sys/dev/ata/chipsets/ata-marvell.c Wed Mar 4 18:25:39 2009 (r189368) @@ -212,9 +212,6 @@ ata_marvell_edma_chipinit(device_t dev) ATA_OUTL(ctlr->r_res1, 0x01d64, 0x000000ff/*HC0*/ | 0x0001fe00/*HC1*/ | /*(1<<19) | (1<<20) | (1<<21) |*/(1<<22) | (1<<24) | (0x7f << 25)); - /* enable PCI interrupt */ - pci_write_config(dev, PCIR_COMMAND, - pci_read_config(dev, PCIR_COMMAND, 2) & ~0x0400, 2); return 0; } Modified: head/sys/dev/ata/chipsets/ata-nvidia.c ============================================================================== --- head/sys/dev/ata/chipsets/ata-nvidia.c Wed Mar 4 18:23:48 2009 (r189367) +++ head/sys/dev/ata/chipsets/ata-nvidia.c Wed Mar 4 18:25:39 2009 (r189368) @@ -183,11 +183,6 @@ ata_nvidia_chipinit(device_t dev) /* enable device and PHY state change interrupts */ ATA_OUTB(ctlr->r_res2, offset + 1, 0xdd); } - - /* enable PCI interrupt */ - pci_write_config(dev, PCIR_COMMAND, - pci_read_config(dev, PCIR_COMMAND, 2) & ~0x0400,2); - } ctlr->setmode = ata_sata_setmode; } Modified: head/sys/dev/ata/chipsets/ata-siliconimage.c ============================================================================== --- head/sys/dev/ata/chipsets/ata-siliconimage.c Wed Mar 4 18:23:48 2009 (r189367) +++ head/sys/dev/ata/chipsets/ata-siliconimage.c Wed Mar 4 18:25:39 2009 (r189368) @@ -150,10 +150,6 @@ ata_sii_chipinit(device_t dev) ATA_OUTL(ctlr->r_res1, 0x0040, 0x80000000); DELAY(10000); ATA_OUTL(ctlr->r_res1, 0x0040, 0x0000000f); - - /* enable PCI interrupt */ - pci_write_config(dev, PCIR_COMMAND, - pci_read_config(dev, PCIR_COMMAND, 2) & ~0x0400, 2); break; case SII_MEMIO: Modified: head/sys/dev/ata/chipsets/ata-sis.c ============================================================================== --- head/sys/dev/ata/chipsets/ata-sis.c Wed Mar 4 18:23:48 2009 (r189367) +++ head/sys/dev/ata/chipsets/ata-sis.c Wed Mar 4 18:25:39 2009 (r189368) @@ -189,10 +189,6 @@ ata_sis_chipinit(device_t dev) ctlr->ch_attach = ata_sis_ch_attach; ctlr->ch_detach = ata_pci_ch_detach; ctlr->reset = ata_sis_reset; - - /* enable PCI interrupt */ - pci_write_config(dev, PCIR_COMMAND, - pci_read_config(dev, PCIR_COMMAND, 2) & ~0x0400,2); } ctlr->setmode = ata_sata_setmode; return 0; Modified: head/sys/dev/ata/chipsets/ata-via.c ============================================================================== --- head/sys/dev/ata/chipsets/ata-via.c Wed Mar 4 18:23:48 2009 (r189367) +++ head/sys/dev/ata/chipsets/ata-via.c Wed Mar 4 18:25:39 2009 (r189368) @@ -143,10 +143,6 @@ ata_via_chipinit(device_t dev) ctlr->ch_attach = ata_via_ch_attach; ctlr->ch_detach = ata_via_ch_detach; ctlr->reset = ata_via_reset; - - /* enable PCI interrupt */ - pci_write_config(dev, PCIR_COMMAND, - pci_read_config(dev, PCIR_COMMAND, 2) & ~0x0400,2); } if (ctlr->chip->cfg2 & VIABAR) { From owner-svn-src-head@FreeBSD.ORG Wed Mar 4 18:36: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 08785106571D; Wed, 4 Mar 2009 18:36:49 +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 CF0168FC08; Wed, 4 Mar 2009 18:36:48 +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 n24Iam4K049855; Wed, 4 Mar 2009 18:36:48 GMT (envelope-from ed@svn.freebsd.org) Received: (from ed@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n24Iamjg049854; Wed, 4 Mar 2009 18:36:48 GMT (envelope-from ed@svn.freebsd.org) Message-Id: <200903041836.n24Iamjg049854@svn.freebsd.org> From: Ed Schouten Date: Wed, 4 Mar 2009 18:36: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: r189369 - head/usr.sbin/IPXrouted 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, 04 Mar 2009 18:36:50 -0000 Author: ed Date: Wed Mar 4 18:36:48 2009 New Revision: 189369 URL: http://svn.freebsd.org/changeset/base/189369 Log: Make IPXrouted compile using Clang by using ANSI function declarations. Because of integer promotion, Clang doesn't allow ANSI prototypes to be mixed with K&R declarations. Submitted by: Pawel Worach Modified: head/usr.sbin/IPXrouted/tables.c Modified: head/usr.sbin/IPXrouted/tables.c ============================================================================== --- head/usr.sbin/IPXrouted/tables.c Wed Mar 4 18:25:39 2009 (r189368) +++ head/usr.sbin/IPXrouted/tables.c Wed Mar 4 18:36:48 2009 (r189369) @@ -64,8 +64,7 @@ struct rthash nethash[ROUTEHASHSIZ]; * Lookup dst in the tables for an exact match. */ struct rt_entry * -rtlookup(dst) - struct sockaddr *dst; +rtlookup(struct sockaddr *dst) { register struct rt_entry *rt; register struct rthash *rh; @@ -90,8 +89,7 @@ rtlookup(dst) * Find a route to dst as the kernel would. */ struct rt_entry * -rtfind(dst) - struct sockaddr *dst; +rtfind(struct sockaddr *dst) { register struct rt_entry *rt; register struct rthash *rh; @@ -118,10 +116,8 @@ rtfind(dst) } void -rtadd(dst, gate, metric, ticks, state) - struct sockaddr *dst, *gate; - short metric, ticks; - int state; +rtadd(struct sockaddr *dst, struct sockaddr *gate, short metric, + short ticks, int state) { struct afhash h; register struct rt_entry *rt; @@ -171,11 +167,8 @@ rtadd(dst, gate, metric, ticks, state) } void -rtadd_clone(ort, dst, gate, metric, ticks, state) - struct rt_entry *ort; - struct sockaddr *dst, *gate; - short metric, ticks; - int state; +rtadd_clone(struct rt_entry *ort, struct sockaddr *dst, + struct sockaddr *gate, short metric, short ticks, int state) { struct afhash h; register struct rt_entry *rt; @@ -216,10 +209,8 @@ rtadd_clone(ort, dst, gate, metric, tick } void -rtchange(rt, gate, metric, ticks) - struct rt_entry *rt; - struct sockaddr *gate; - short metric, ticks; +rtchange(struct rt_entry *rt, struct sockaddr *gate, short metric, + short ticks) { int doioctl = 0, metricchanged = 0; struct rtuentry oldroute; @@ -337,8 +328,7 @@ rtchange(rt, gate, metric, ticks) } void -rtdelete(rt) - struct rt_entry *rt; +rtdelete(struct rt_entry *rt) { struct sockaddr *sa = &(rt->rt_router); @@ -380,9 +370,7 @@ rtinit(void) int seqno; int -rtioctl(action, ort) - int action; - struct rtuentry *ort; +rtioctl(int action, struct rtuentry *ort) { #ifndef RTM_ADD if (install == 0) From owner-svn-src-head@FreeBSD.ORG Wed Mar 4 18:51: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 B6E7C106566B; Wed, 4 Mar 2009 18:51:36 +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 6C8A58FC1D; Wed, 4 Mar 2009 18:51:34 +0000 (UTC) (envelope-from rdivacky@vlk.vlakno.cz) Received: from localhost (localhost [127.0.0.1]) by vlakno.cz (Postfix) with ESMTP id 8A5D99CB0EF; Wed, 4 Mar 2009 19:48:11 +0100 (CET) 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 e6PF39RoRYjq; Wed, 4 Mar 2009 19:47:59 +0100 (CET) Received: from vlk.vlakno.cz (localhost [127.0.0.1]) by vlakno.cz (Postfix) with ESMTP id C9E9C9CB113; Wed, 4 Mar 2009 19:47:59 +0100 (CET) Received: (from rdivacky@localhost) by vlk.vlakno.cz (8.14.3/8.14.3/Submit) id n24IlxpW006803; Wed, 4 Mar 2009 19:47:59 +0100 (CET) (envelope-from rdivacky) Date: Wed, 4 Mar 2009 19:47:59 +0100 From: Roman Divacky To: Ed Schouten Message-ID: <20090304184759.GA6614@freebsd.org> References: <200903041836.n24Iamjg049854@svn.freebsd.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <200903041836.n24Iamjg049854@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: r189369 - head/usr.sbin/IPXrouted 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, 04 Mar 2009 18:51:40 -0000 On Wed, Mar 04, 2009 at 06:36:48PM +0000, Ed Schouten wrote: > Author: ed > Date: Wed Mar 4 18:36:48 2009 > New Revision: 189369 > URL: http://svn.freebsd.org/changeset/base/189369 > > Log: > Make IPXrouted compile using Clang by using ANSI function declarations. > > Because of integer promotion, Clang doesn't allow ANSI prototypes to be > mixed with K&R declarations. it allows mixing that. it just does not accept the cases where the promotion to int rule is broken. ie. it does what ISO C says says it should do. unlike gcc From owner-svn-src-head@FreeBSD.ORG Wed Mar 4 20:54: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 54F75106564A; Wed, 4 Mar 2009 20:54:43 +0000 (UTC) (envelope-from rrs@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 42FB58FC0A; Wed, 4 Mar 2009 20:54:43 +0000 (UTC) (envelope-from rrs@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 n24KshaX052739; Wed, 4 Mar 2009 20:54:43 GMT (envelope-from rrs@svn.freebsd.org) Received: (from rrs@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n24KshNx052736; Wed, 4 Mar 2009 20:54:43 GMT (envelope-from rrs@svn.freebsd.org) Message-Id: <200903042054.n24KshNx052736@svn.freebsd.org> From: Randall Stewart Date: Wed, 4 Mar 2009 20:54: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: r189371 - head/sys/netinet X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 04 Mar 2009 20:54:43 -0000 Author: rrs Date: Wed Mar 4 20:54:42 2009 New Revision: 189371 URL: http://svn.freebsd.org/changeset/base/189371 Log: - PR-SCTP bug, where the CUM-ACK was not being updated into the advance_peer_ack point so we would incorrectly send a wrong value in the FWD-TSN - PR-SCTP bug, where an PR packet is used for a window probe which could incorrectly get the packet moved back into the send_queue, which will cause major issues and should not happen. - Fix a trace to use the proper macro. Modified: head/sys/netinet/sctp_constants.h head/sys/netinet/sctp_indata.c head/sys/netinet/sctp_os_bsd.h Modified: head/sys/netinet/sctp_constants.h ============================================================================== --- head/sys/netinet/sctp_constants.h Wed Mar 4 20:26:39 2009 (r189370) +++ head/sys/netinet/sctp_constants.h Wed Mar 4 20:54:42 2009 (r189371) @@ -228,8 +228,9 @@ __FBSDID("$FreeBSD$"); #define SCTP_MAP_TSN_ENTERS 119 #define SCTP_THRESHOLD_CLEAR 120 #define SCTP_THRESHOLD_INCR 121 +#define SCTP_FLIGHT_LOG_DWN_WP_FWD 122 -#define SCTP_LOG_MAX_TYPES 122 +#define SCTP_LOG_MAX_TYPES 123 /* * To turn on various logging, you must first enable 'options KTR' and * you might want to bump the entires 'options KTR_ENTRIES=80000'. Modified: head/sys/netinet/sctp_indata.c ============================================================================== --- head/sys/netinet/sctp_indata.c Wed Mar 4 20:26:39 2009 (r189370) +++ head/sys/netinet/sctp_indata.c Wed Mar 4 20:54:42 2009 (r189371) @@ -4182,6 +4182,18 @@ sctp_window_probe_recovery(struct sctp_t struct sctp_tmit_chunk *chk; /* First setup this one and get it moved back */ + sctp_flight_size_decrease(tp1); + sctp_total_flight_decrease(stcb, tp1); + tp1->window_probe = 0; + if ((tp1->sent == SCTP_FORWARD_TSN_SKIP) || (tp1->data == NULL)) { + /* TSN's skipped we do NOT move back. */ + sctp_misc_ints(SCTP_FLIGHT_LOG_DWN_WP_FWD, + tp1->whoTo->flight_size, + tp1->book_size, + (uintptr_t) tp1->whoTo, + tp1->rec.data.TSN_seq); + return; + } tp1->sent = SCTP_DATAGRAM_UNSENT; if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_FLIGHT_LOGGING_ENABLE) { sctp_misc_ints(SCTP_FLIGHT_LOG_DOWN_WP, @@ -4190,8 +4202,6 @@ sctp_window_probe_recovery(struct sctp_t (uintptr_t) tp1->whoTo, tp1->rec.data.TSN_seq); } - sctp_flight_size_decrease(tp1); - sctp_total_flight_decrease(stcb, tp1); TAILQ_REMOVE(&asoc->sent_queue, tp1, sctp_next); TAILQ_INSERT_HEAD(&asoc->send_queue, tp1, sctp_next); asoc->sent_queue_cnt--; @@ -4480,10 +4490,6 @@ sctp_express_handle_sack(struct sctp_tcb asoc->total_flight = 0; asoc->total_flight_count = 0; } - /* Fix up the a-p-a-p for future PR-SCTP sends */ - if (compare_with_wrap(cumack, asoc->advanced_peer_ack_point, MAX_TSN)) { - asoc->advanced_peer_ack_point = cumack; - } /* ECN Nonce updates */ if (asoc->ecn_nonce_allowed) { if (asoc->nonce_sum_check) { @@ -4699,6 +4705,14 @@ again: stcb->sctp_ep, stcb, asoc->primary_destination); } } + /*********************************************/ + /* Here we perform PR-SCTP procedures */ + /* (section 4.2) */ + /*********************************************/ + /* C1. update advancedPeerAckPoint */ + if (compare_with_wrap(cumack, asoc->advanced_peer_ack_point, MAX_TSN)) { + asoc->advanced_peer_ack_point = cumack; + } /* PR-Sctp issues need to be addressed too */ if ((asoc->peer_supports_prsctp) && (asoc->pr_sctp_cnt > 0)) { struct sctp_tmit_chunk *lchk; @@ -5446,14 +5460,6 @@ done_with_it: sctp_strike_gap_ack_chunks(stcb, asoc, biggest_tsn_acked, biggest_tsn_newly_acked, this_sack_lowest_newack, accum_moved); } - /*********************************************/ - /* Here we perform PR-SCTP procedures */ - /* (section 4.2) */ - /*********************************************/ - /* C1. update advancedPeerAckPoint */ - if (compare_with_wrap(cum_ack, asoc->advanced_peer_ack_point, MAX_TSN)) { - asoc->advanced_peer_ack_point = cum_ack; - } /* JRS - Use the congestion control given in the CC module */ asoc->cc_functions.sctp_cwnd_update_after_fr(stcb, asoc); @@ -5615,6 +5621,10 @@ again: done_once = 1; goto again; } + /* Fix up the a-p-a-p for future PR-SCTP sends */ + if (compare_with_wrap(cum_ack, asoc->advanced_peer_ack_point, MAX_TSN)) { + asoc->advanced_peer_ack_point = cum_ack; + } /* C2. try to further move advancedPeerAckPoint ahead */ if ((asoc->peer_supports_prsctp) && (asoc->pr_sctp_cnt > 0)) { struct sctp_tmit_chunk *lchk; Modified: head/sys/netinet/sctp_os_bsd.h ============================================================================== --- head/sys/netinet/sctp_os_bsd.h Wed Mar 4 20:26:39 2009 (r189370) +++ head/sys/netinet/sctp_os_bsd.h Wed Mar 4 20:54:42 2009 (r189371) @@ -196,7 +196,7 @@ MALLOC_DECLARE(SCTP_M_SOCKOPT); #define SCTP_PRINTF(params...) printf(params) #ifdef SCTP_LTRACE_CHUNKS -#define SCTP_LTRACE_CHK(a, b, c, d) if(SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_LTRACE_CHUNK_ENABLE) CTR6(KTR_SUBSYS, "SCTP:%d[%d]:%x-%x-%x-%x", SCTP_LOG_CHUNK_PROC, 0, a, b, c, d) +#define SCTP_LTRACE_CHK(a, b, c, d) if(SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_LTRACE_CHUNK_ENABLE) SCTP_CTR6(KTR_SUBSYS, "SCTP:%d[%d]:%x-%x-%x-%x", SCTP_LOG_CHUNK_PROC, 0, a, b, c, d) #else #define SCTP_LTRACE_CHK(a, b, c, d) #endif From owner-svn-src-head@FreeBSD.ORG Wed Mar 4 20:58: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 B2D691065672; Wed, 4 Mar 2009 20:58:49 +0000 (UTC) (envelope-from imp@bsdimp.com) Received: from harmony.bsdimp.com (bsdimp.com [199.45.160.85]) by mx1.freebsd.org (Postfix) with ESMTP id 6D97F8FC2B; Wed, 4 Mar 2009 20:58:49 +0000 (UTC) (envelope-from imp@bsdimp.com) Received: from localhost (localhost [127.0.0.1]) by harmony.bsdimp.com (8.14.2/8.14.1) with ESMTP id n24KtoSS090160; Wed, 4 Mar 2009 13:55:50 -0700 (MST) (envelope-from imp@bsdimp.com) Date: Wed, 04 Mar 2009 13:56:06 -0700 (MST) Message-Id: <20090304.135606.1649768480.imp@bsdimp.com> To: rnoland@FreeBSD.org From: "M. Warner Losh" In-Reply-To: <200903041823.n24INmcc049524@svn.freebsd.org> References: <200903041823.n24INmcc049524@svn.freebsd.org> X-Mailer: Mew version 5.2 on Emacs 21.3 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org Subject: Re: svn commit: r189367 - head/sys/dev/pci 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, 04 Mar 2009 20:58:50 -0000 In message: <200903041823.n24INmcc049524@svn.freebsd.org> Robert Noland writes: : Author: rnoland : Date: Wed Mar 4 18:23:48 2009 : New Revision: 189367 : URL: http://svn.freebsd.org/changeset/base/189367 : : Log: : Extend the management of PCIM_CMD_INTxDIS. : : We now explicitly enable INTx during bus_setup_intr() if it is needed. : Several of the ata drivers were managing this bit internally. This is : better handled in pci and it should work for all drivers now. : : We also mask INTx during bus_teardown_intr() by setting this bit. : : Reviewed by: jhb : MFC after: 3 days Note: the INTxDIS bit is new in PCI 3.0, and has no effect on earlier devices. This should be highlighted in the comments somewhere... Warner From owner-svn-src-head@FreeBSD.ORG Wed Mar 4 21:04: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 27DA31065707; Wed, 4 Mar 2009 21:04:53 +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 943238FC1B; Wed, 4 Mar 2009 21:04:52 +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 n24L4qF2053294; Wed, 4 Mar 2009 21:04:52 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n24L4qMc053293; Wed, 4 Mar 2009 21:04:52 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <200903042104.n24L4qMc053293@svn.freebsd.org> From: John Baldwin Date: Wed, 4 Mar 2009 21:04: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: r189373 - head/sys/dev/pci 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, 04 Mar 2009 21:04:54 -0000 Author: jhb Date: Wed Mar 4 21:04:52 2009 New Revision: 189373 URL: http://svn.freebsd.org/changeset/base/189373 Log: The recent PCI resource allocation fixes exposed a bug where the same BAR could be allocated twice by different children of a vgapci0 device. To fix this, change the vgapci0 device to track references on its associated resources so that they are only allocated once from the parent PCI bus and released when no children are using them. Previously this leaked a small amount of KVA on at least some architectures. Modified: head/sys/dev/pci/vga_pci.c Modified: head/sys/dev/pci/vga_pci.c ============================================================================== --- head/sys/dev/pci/vga_pci.c Wed Mar 4 20:58:22 2009 (r189372) +++ head/sys/dev/pci/vga_pci.c Wed Mar 4 21:04:52 2009 (r189373) @@ -42,12 +42,20 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include +#include #include #include +struct vga_resource { + struct resource *vr_res; + int vr_refs; +}; + struct vga_pci_softc { device_t vga_msi_child; /* Child driver using MSI. */ + struct vga_resource vga_res[PCIR_MAX_BAR_0 + 1]; }; static int @@ -130,7 +138,27 @@ static struct resource * vga_pci_alloc_resource(device_t dev, device_t child, int type, int *rid, u_long start, u_long end, u_long count, u_int flags) { + struct vga_pci_softc *sc; + int bar; + switch (type) { + case SYS_RES_MEMORY: + case SYS_RES_IOPORT: + /* + * For BARs, we cache the resource so that we only allocate it + * from the PCI bus once. + */ + bar = PCI_RID2BAR(*rid); + if (bar < 0 || bar > PCIR_MAX_BAR_0) + return (NULL); + sc = device_get_softc(dev); + if (sc->vga_res[bar].vr_res == NULL) + sc->vga_res[bar].vr_res = bus_alloc_resource(dev, type, + rid, start, end, count, flags); + if (sc->vga_res[bar].vr_res != NULL) + sc->vga_res[bar].vr_refs++; + return (sc->vga_res[bar].vr_res); + } return (bus_alloc_resource(dev, type, rid, start, end, count, flags)); } @@ -138,6 +166,37 @@ static int vga_pci_release_resource(device_t dev, device_t child, int type, int rid, struct resource *r) { + struct vga_pci_softc *sc; + int bar, error; + + switch (type) { + case SYS_RES_MEMORY: + case SYS_RES_IOPORT: + /* + * For BARs, we release the resource from the PCI bus + * when the last child reference goes away. + */ + bar = PCI_RID2BAR(rid); + if (bar < 0 || bar > PCIR_MAX_BAR_0) + return (EINVAL); + sc = device_get_softc(dev); + if (sc->vga_res[bar].vr_res == NULL) + return (EINVAL); + KASSERT(sc->vga_res[bar].vr_res == r, + ("vga_pci resource mismatch")); + if (sc->vga_res[bar].vr_refs > 1) { + sc->vga_res[bar].vr_refs--; + return (0); + } + KASSERT(sc->vga_res[bar].vr_refs > 0, + ("vga_pci resource reference count underflow")); + error = bus_release_resource(dev, type, rid, r); + if (error == 0) { + sc->vga_res[bar].vr_res = NULL; + sc->vga_res[bar].vr_refs = 0; + } + return (error); + } return (bus_release_resource(dev, type, rid, r)); } From owner-svn-src-head@FreeBSD.ORG Wed Mar 4 22:05:25 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 D92C41065672; Wed, 4 Mar 2009 22:05:25 +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 C7F9E8FC1F; Wed, 4 Mar 2009 22:05:25 +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 n24M5Png054675; Wed, 4 Mar 2009 22:05:25 GMT (envelope-from sam@svn.freebsd.org) Received: (from sam@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n24M5Pav054674; Wed, 4 Mar 2009 22:05:25 GMT (envelope-from sam@svn.freebsd.org) Message-Id: <200903042205.n24M5Pav054674@svn.freebsd.org> From: Sam Leffler Date: Wed, 4 Mar 2009 22:05:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r189377 - 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: Wed, 04 Mar 2009 22:05:26 -0000 Author: sam Date: Wed Mar 4 22:05:25 2009 New Revision: 189377 URL: http://svn.freebsd.org/changeset/base/189377 Log: add the desired channel to the scan list if not already present and compatible with other scan controls Modified: head/sys/net80211/ieee80211_scan_sta.c Modified: head/sys/net80211/ieee80211_scan_sta.c ============================================================================== --- head/sys/net80211/ieee80211_scan_sta.c Wed Mar 4 21:40:08 2009 (r189376) +++ head/sys/net80211/ieee80211_scan_sta.c Wed Mar 4 22:05:25 2009 (r189377) @@ -476,6 +476,18 @@ checktable(const struct scanlist *scan, return 0; } +static int +onscanlist(const struct ieee80211_scan_state *ss, + const struct ieee80211_channel *c) +{ + int i; + + for (i = 0; i < ss->ss_last; i++) + if (ss->ss_chans[i] == c) + return 1; + return 0; +} + static void sweepchannels(struct ieee80211_scan_state *ss, struct ieee80211vap *vap, const struct scanlist table[]) @@ -524,6 +536,21 @@ sweepchannels(struct ieee80211_scan_stat /* Add channel to scanning list. */ ss->ss_chans[ss->ss_last++] = c; } + /* + * Explicitly add any desired channel if: + * - not already on the scan list + * - allowed by any desired mode constraint + * - there is space in the scan list + * This allows the channel to be used when the filtering + * mechanisms would otherwise elide it (e.g HT, turbo). + */ + c = vap->iv_des_chan; + if (c != IEEE80211_CHAN_ANYC && + !onscanlist(ss, c) && + (vap->iv_des_mode == IEEE80211_MODE_AUTO || + vap->iv_des_mode == ieee80211_chan2mode(c)) && + ss->ss_last < IEEE80211_SCAN_MAX) + ss->ss_chans[ss->ss_last++] = c; } static void From owner-svn-src-head@FreeBSD.ORG Thu Mar 5 00:04: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 7FEB1106564A; Thu, 5 Mar 2009 00:04:33 +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 39D0C8FC1C; Thu, 5 Mar 2009 00:04:33 +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 n2504WAY056880; Thu, 5 Mar 2009 00:04:32 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n2504Wsi056879; Thu, 5 Mar 2009 00:04:32 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <200903050004.n2504Wsi056879@svn.freebsd.org> From: Pyun YongHyeon Date: Thu, 5 Mar 2009 00:04:32 +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: r189379 - head/sys/dev/ale 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, 05 Mar 2009 00:04:34 -0000 Author: yongari Date: Thu Mar 5 00:04:32 2009 New Revision: 189379 URL: http://svn.freebsd.org/changeset/base/189379 Log: Now pci(4) handles PCIM_CMD_INTxDIS so there is no need to poke this bit in driver. Modified: head/sys/dev/ale/if_ale.c Modified: head/sys/dev/ale/if_ale.c ============================================================================== --- head/sys/dev/ale/if_ale.c Wed Mar 4 22:22:30 2009 (r189378) +++ head/sys/dev/ale/if_ale.c Thu Mar 5 00:04:32 2009 (r189379) @@ -1543,20 +1543,11 @@ ale_resume(device_t dev) struct ale_softc *sc; struct ifnet *ifp; int pmc; - uint16_t cmd, pmstat; + uint16_t pmstat; sc = device_get_softc(dev); ALE_LOCK(sc); - /* - * Clear INTx emulation disable for hardwares that - * is set in resume event. From Linux. - */ - cmd = pci_read_config(sc->ale_dev, PCIR_COMMAND, 2); - if ((cmd & 0x0400) != 0) { - cmd &= ~0x0400; - pci_write_config(sc->ale_dev, PCIR_COMMAND, cmd, 2); - } if (pci_find_extcap(sc->ale_dev, PCIY_PMG, &pmc) == 0) { /* Disable PME and clear PME status. */ pmstat = pci_read_config(sc->ale_dev, From owner-svn-src-head@FreeBSD.ORG Thu Mar 5 00:15: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 067B7106566C; Thu, 5 Mar 2009 00:15:44 +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 CC50E8FC08; Thu, 5 Mar 2009 00:15:43 +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 n250Fho3057115; Thu, 5 Mar 2009 00:15:43 GMT (envelope-from sam@svn.freebsd.org) Received: (from sam@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n250FhZZ057112; Thu, 5 Mar 2009 00:15:43 GMT (envelope-from sam@svn.freebsd.org) Message-Id: <200903050015.n250FhZZ057112@svn.freebsd.org> From: Sam Leffler Date: Thu, 5 Mar 2009 00:15: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: r189380 - 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: Thu, 05 Mar 2009 00:15:44 -0000 Author: sam Date: Thu Mar 5 00:15:43 2009 New Revision: 189380 URL: http://svn.freebsd.org/changeset/base/189380 Log: add a sysctl to ena/dis frobbing cca Modified: head/sys/dev/ath/if_ath.c head/sys/dev/ath/if_athvar.h Modified: head/sys/dev/ath/if_ath.c ============================================================================== --- head/sys/dev/ath/if_ath.c Thu Mar 5 00:04:32 2009 (r189379) +++ head/sys/dev/ath/if_ath.c Thu Mar 5 00:15:43 2009 (r189380) @@ -6861,6 +6861,22 @@ ath_sysctl_intmit(SYSCTL_HANDLER_ARGS) return !ath_hal_setintmit(sc->sc_ah, intmit) ? EINVAL : 0; } +#ifdef ATH_SUPPORT_TDMA +static int +ath_sysctl_setcca(SYSCTL_HANDLER_ARGS) +{ + struct ath_softc *sc = arg1; + int setcca, error; + + setcca = sc->sc_setcca; + error = sysctl_handle_int(oidp, &setcca, 0, req); + if (error || !req->newptr) + return error; + sc->sc_setcca = (setcca != 0); + return 0; +} +#endif /* ATH_SUPPORT_TDMA */ + static void ath_sysctlattach(struct ath_softc *sc) { @@ -6974,6 +6990,9 @@ ath_sysctlattach(struct ath_softc *sc) SYSCTL_ADD_INT(ctx, SYSCTL_CHILDREN(tree), OID_AUTO, "superframe", CTLFLAG_RD, &sc->sc_tdmabintval, 0, "TDMA calculated super frame"); + SYSCTL_ADD_PROC(ctx, SYSCTL_CHILDREN(tree), OID_AUTO, + "setcca", CTLTYPE_INT | CTLFLAG_RW, sc, 0, + ath_sysctl_setcca, "I", "enable CCA control"); } #endif } @@ -7423,7 +7442,8 @@ ath_tdma_config(struct ath_softc *sc, st ath_hal_intrset(ah, 0); ath_beaconq_config(sc); /* setup h/w beacon q */ - ath_hal_setcca(ah, AH_FALSE); /* disable CCA */ + if (sc->sc_setcca) + ath_hal_setcca(ah, AH_FALSE); /* disable CCA */ ath_tdma_bintvalsetup(sc, tdma); /* calculate beacon interval */ ath_tdma_settimers(sc, sc->sc_tdmabintval, sc->sc_tdmabintval | HAL_BEACON_RESET_TSF); Modified: head/sys/dev/ath/if_athvar.h ============================================================================== --- head/sys/dev/ath/if_athvar.h Thu Mar 5 00:04:32 2009 (r189379) +++ head/sys/dev/ath/if_athvar.h Thu Mar 5 00:15:43 2009 (r189380) @@ -255,6 +255,7 @@ struct ath_softc { sc_wmetkipmic:1,/* can do WME+TKIP MIC */ sc_resume_up: 1,/* on resume, start all vaps */ sc_tdma : 1,/* TDMA in use */ + sc_setcca : 1,/* set/clr CCA with TDMA */ sc_resetcal : 1;/* reset cal state next trip */ uint32_t sc_eerd; /* regdomain from EEPROM */ uint32_t sc_eecc; /* country code from EEPROM */ From owner-svn-src-head@FreeBSD.ORG Thu Mar 5 00:31: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 820081065674; Thu, 5 Mar 2009 00:31:49 +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 6F02C8FC1B; Thu, 5 Mar 2009 00:31:49 +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 n250VnIm057451; Thu, 5 Mar 2009 00:31:49 GMT (envelope-from kientzle@svn.freebsd.org) Received: (from kientzle@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n250Vngs057445; Thu, 5 Mar 2009 00:31:49 GMT (envelope-from kientzle@svn.freebsd.org) Message-Id: <200903050031.n250Vngs057445@svn.freebsd.org> From: Tim Kientzle Date: Thu, 5 Mar 2009 00:31:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r189381 - head/lib/libarchive/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: Thu, 05 Mar 2009 00:31:50 -0000 Author: kientzle Date: Thu Mar 5 00:31:48 2009 New Revision: 189381 URL: http://svn.freebsd.org/changeset/base/189381 Log: Merge r341,r345,r346,347 from libarchive.googlecode.com: Style fixes to test harness and a few extra guards to detect tests that can't succeed on certain platforms. Modified: head/lib/libarchive/test/main.c head/lib/libarchive/test/test.h head/lib/libarchive/test/test_read_compress_program.c head/lib/libarchive/test/test_read_format_cpio_bin_Z.c head/lib/libarchive/test/test_read_format_cpio_svr4c_Z.c head/lib/libarchive/test/test_read_format_tz.c Modified: head/lib/libarchive/test/main.c ============================================================================== --- head/lib/libarchive/test/main.c Thu Mar 5 00:15:43 2009 (r189380) +++ head/lib/libarchive/test/main.c Thu Mar 5 00:31:48 2009 (r189381) @@ -33,6 +33,9 @@ #include #include #include +#ifdef _WIN32 +#include +#endif /* * This same file is used pretty much verbatim for all test harnesses. @@ -907,6 +910,10 @@ get_refdir(void) strncat(tried, "\n", sizeof(tried) - strlen(tried) - 1); } + /* You should have to add "$(TargetDir)" to + * Properties > Configuration Properties > Debugging > Working Directory, + * if you are running libarchive_test.exe on Visual Studio. + */ printf("Unable to locate known reference file %s\n", KNOWNREF); printf(" Checked following directories:\n%s\n", tried); exit(1); @@ -966,7 +973,7 @@ int main(int argc, char **argv) * Parse options, without using getopt(), which isn't available * on all platforms. */ - ++argv; /* Skip program name */ + ++argv; --argc;/* Skip program name */ while (*argv != NULL) { p = *argv++; if (*p++ != '-') Modified: head/lib/libarchive/test/test.h ============================================================================== --- head/lib/libarchive/test/test.h Thu Mar 5 00:15:43 2009 (r189380) +++ head/lib/libarchive/test/test.h Thu Mar 5 00:31:48 2009 (r189381) @@ -73,6 +73,7 @@ #endif #ifdef _WIN32 +#define snprintf sprintf_s #define LOCALE_DE "deu" #else #define LOCALE_DE "de_DE.UTF-8" Modified: head/lib/libarchive/test/test_read_compress_program.c ============================================================================== --- head/lib/libarchive/test/test_read_compress_program.c Thu Mar 5 00:15:43 2009 (r189380) +++ head/lib/libarchive/test/test_read_compress_program.c Thu Mar 5 00:31:48 2009 (r189381) @@ -42,16 +42,20 @@ DEFINE_TEST(test_read_compress_program) struct archive_entry *ae; struct archive *a; assert((a = archive_read_new()) != NULL); - assertEqualIntA(a, 0, archive_read_support_compression_none(a)); + assertEqualIntA(a, ARCHIVE_OK, + archive_read_support_compression_none(a)); r = archive_read_support_compression_program(a, "gunzip"); if (r == ARCHIVE_FATAL) { skipping("archive_read_support_compression_program() unsupported on this platform"); return; } assertEqualIntA(a, ARCHIVE_OK, r); - assert(0 == archive_read_support_format_all(a)); - assertEqualIntA(a, 0, archive_read_open_memory(a, archive, sizeof(archive))); - assertEqualIntA(a, 0, archive_read_next_header(a, &ae)); + assertEqualIntA(a, ARCHIVE_OK, + archive_read_support_format_all(a)); + assertEqualIntA(a, ARCHIVE_OK, + archive_read_open_memory(a, archive, sizeof(archive))); + assertEqualIntA(a, ARCHIVE_OK, + archive_read_next_header(a, &ae)); assert(archive_compression(a) == ARCHIVE_COMPRESSION_PROGRAM); assert(archive_format(a) == ARCHIVE_FORMAT_TAR_USTAR); assert(0 == archive_read_close(a)); Modified: head/lib/libarchive/test/test_read_format_cpio_bin_Z.c ============================================================================== --- head/lib/libarchive/test/test_read_format_cpio_bin_Z.c Thu Mar 5 00:15:43 2009 (r189380) +++ head/lib/libarchive/test/test_read_format_cpio_bin_Z.c Thu Mar 5 00:31:48 2009 (r189381) @@ -36,17 +36,24 @@ DEFINE_TEST(test_read_format_cpio_bin_Z) struct archive_entry *ae; struct archive *a; assert((a = archive_read_new()) != NULL); - assertA(0 == archive_read_support_compression_all(a)); - assertA(0 == archive_read_support_format_all(a)); - assertA(0 == archive_read_open_memory(a, archive, sizeof(archive))); - assertA(0 == archive_read_next_header(a, &ae)); - assertA(archive_compression(a) == ARCHIVE_COMPRESSION_COMPRESS); - assertA(archive_format(a) == ARCHIVE_FORMAT_CPIO_BIN_LE); - assert(0 == archive_read_close(a)); + assertEqualIntA(a, ARCHIVE_OK, + archive_read_support_compression_all(a)); + assertEqualIntA(a, ARCHIVE_OK, + archive_read_support_format_all(a)); + assertEqualIntA(a, ARCHIVE_OK, + archive_read_open_memory(a, archive, sizeof(archive))); + assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae)); + failure("archive_compression_name(a)=\"%s\"", + archive_compression_name(a)); + assertEqualInt(archive_compression(a), ARCHIVE_COMPRESSION_COMPRESS); + failure("archive_format_name(a)=\"%s\"", + archive_format_name(a)); + assertEqualInt(archive_format(a), ARCHIVE_FORMAT_CPIO_BIN_LE); + assertEqualIntA(a, ARCHIVE_OK, archive_read_close(a)); #if ARCHIVE_VERSION_NUMBER < 2000000 archive_read_finish(a); #else - assert(0 == archive_read_finish(a)); + assertEqualInt(ARCHIVE_OK, archive_read_finish(a)); #endif } Modified: head/lib/libarchive/test/test_read_format_cpio_svr4c_Z.c ============================================================================== --- head/lib/libarchive/test/test_read_format_cpio_svr4c_Z.c Thu Mar 5 00:15:43 2009 (r189380) +++ head/lib/libarchive/test/test_read_format_cpio_svr4c_Z.c Thu Mar 5 00:31:48 2009 (r189381) @@ -39,17 +39,23 @@ DEFINE_TEST(test_read_format_cpio_svr4c_ struct archive *a; /* printf("Archive address: start=%X, end=%X\n", archive, archive+sizeof(archive)); */ assert((a = archive_read_new()) != NULL); - assertA(0 == archive_read_support_compression_all(a)); - assertA(0 == archive_read_support_format_all(a)); - assertA(0 == archive_read_open_memory(a, archive, sizeof(archive))); - assertA(0 == archive_read_next_header(a, &ae)); - assertA(archive_compression(a) == ARCHIVE_COMPRESSION_COMPRESS); - assertA(archive_format(a) == ARCHIVE_FORMAT_CPIO_SVR4_CRC); - assert(0 == archive_read_close(a)); + assertEqualIntA(a, ARCHIVE_OK, + archive_read_support_compression_all(a)); + assertEqualIntA(a, ARCHIVE_OK, + archive_read_support_format_all(a)); + assertEqualIntA(a, ARCHIVE_OK, + archive_read_open_memory(a, archive, sizeof(archive))); + assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae)); + failure("archive_compression_name(a)=\"%s\"", + archive_compression_name(a)); + assertEqualInt(archive_compression(a), ARCHIVE_COMPRESSION_COMPRESS); + failure("archive_format_name(a)=\"%s\"", archive_format_name(a)); + assertEqualInt(archive_format(a), ARCHIVE_FORMAT_CPIO_SVR4_CRC); + assertEqualIntA(a, ARCHIVE_OK, archive_read_close(a)); #if ARCHIVE_VERSION_NUMBER < 2000000 archive_read_finish(a); #else - assert(0 == archive_read_finish(a)); + assertEqualInt(ARCHIVE_OK, archive_read_finish(a)); #endif } Modified: head/lib/libarchive/test/test_read_format_tz.c ============================================================================== --- head/lib/libarchive/test/test_read_format_tz.c Thu Mar 5 00:15:43 2009 (r189380) +++ head/lib/libarchive/test/test_read_format_tz.c Thu Mar 5 00:31:48 2009 (r189381) @@ -39,17 +39,22 @@ DEFINE_TEST(test_read_format_tz) struct archive_entry *ae; struct archive *a; assert((a = archive_read_new()) != NULL); - assertA(0 == archive_read_support_compression_all(a)); - assertA(0 == archive_read_support_format_all(a)); - assertA(0 == archive_read_open_memory(a, archive, sizeof(archive))); - assertA(0 == archive_read_next_header(a, &ae)); - assertA(archive_compression(a) == ARCHIVE_COMPRESSION_COMPRESS); - assertA(archive_format(a) == ARCHIVE_FORMAT_TAR_USTAR); - assert(0 == archive_read_close(a)); + assertEqualIntA(a, ARCHIVE_OK, + archive_read_support_compression_all(a)); + assertEqualIntA(a, ARCHIVE_OK, archive_read_support_format_all(a)); + assertEqualIntA(a, ARCHIVE_OK, + archive_read_open_memory(a, archive, sizeof(archive))); + assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae)); + failure("archive_compression_name(a)=\"%s\"", + archive_compression_name(a)); + assertEqualInt(archive_compression(a), ARCHIVE_COMPRESSION_COMPRESS); + failure("archive_format_name(a)=\"%s\"", archive_format_name(a)); + assertEqualInt(archive_format(a), ARCHIVE_FORMAT_TAR_USTAR); + assertEqualIntA(a, ARCHIVE_OK, archive_read_close(a)); #if ARCHIVE_VERSION_NUMBER < 2000000 archive_read_finish(a); #else - assert(0 == archive_read_finish(a)); + assertEqualInt(ARCHIVE_OK, archive_read_finish(a)); #endif } From owner-svn-src-head@FreeBSD.ORG Thu Mar 5 00:35: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 4221D1065676; Thu, 5 Mar 2009 00:35:22 +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 3085D8FC17; Thu, 5 Mar 2009 00:35:22 +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 n250ZMT2057566; Thu, 5 Mar 2009 00:35:22 GMT (envelope-from kientzle@svn.freebsd.org) Received: (from kientzle@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n250ZMdZ057565; Thu, 5 Mar 2009 00:35:22 GMT (envelope-from kientzle@svn.freebsd.org) Message-Id: <200903050035.n250ZMdZ057565@svn.freebsd.org> From: Tim Kientzle Date: Thu, 5 Mar 2009 00:35: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: r189382 - head/lib/libarchive 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, 05 Mar 2009 00:35:23 -0000 Author: kientzle Date: Thu Mar 5 00:35:21 2009 New Revision: 189382 URL: http://svn.freebsd.org/changeset/base/189382 Log: Merge r344 from libarchive.googlecode.com: __LA_INT64_T and __LA_SSIZE_T are part of the public API and therefore need to be exposed. This is ugly; I'd like to find a better solution for this. Modified: head/lib/libarchive/archive.h Modified: head/lib/libarchive/archive.h ============================================================================== --- head/lib/libarchive/archive.h Thu Mar 5 00:31:48 2009 (r189381) +++ head/lib/libarchive/archive.h Thu Mar 5 00:35:21 2009 (r189382) @@ -629,11 +629,14 @@ __LA_DECL void archive_copy_error(stru } #endif -/* This is meaningless outside of this header. */ +/* These are meaningless outside of this header. */ #undef __LA_DECL #undef __LA_GID_T -#undef __LA_INT64_T -#undef __LA_SSIZE_T #undef __LA_UID_T +/* These need to remain defined because they're used in the + * callback type definitions. XXX Fix this. This is ugly. XXX */ +/* #undef __LA_INT64_T */ +/* #undef __LA_SSIZE_T */ + #endif /* !ARCHIVE_H_INCLUDED */ From owner-svn-src-head@FreeBSD.ORG Thu Mar 5 00:36:14 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 223D4106564A; Thu, 5 Mar 2009 00:36:14 +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 EACFF8FC27; Thu, 5 Mar 2009 00:36:13 +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 n250aDCQ057619; Thu, 5 Mar 2009 00:36:13 GMT (envelope-from kientzle@svn.freebsd.org) Received: (from kientzle@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n250aDXc057618; Thu, 5 Mar 2009 00:36:13 GMT (envelope-from kientzle@svn.freebsd.org) Message-Id: <200903050036.n250aDXc057618@svn.freebsd.org> From: Tim Kientzle Date: Thu, 5 Mar 2009 00:36: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: r189383 - head/lib/libarchive 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, 05 Mar 2009 00:36:14 -0000 Author: kientzle Date: Thu Mar 5 00:36:13 2009 New Revision: 189383 URL: http://svn.freebsd.org/changeset/base/189383 Log: Merge r342 from libarchive.googlecode.com: Remove some Windows special casing. Modified: head/lib/libarchive/archive_write_disk.c Modified: head/lib/libarchive/archive_write_disk.c ============================================================================== --- head/lib/libarchive/archive_write_disk.c Thu Mar 5 00:35:21 2009 (r189382) +++ head/lib/libarchive/archive_write_disk.c Thu Mar 5 00:36:13 2009 (r189383) @@ -83,9 +83,6 @@ __FBSDID("$FreeBSD$"); #ifdef HAVE_UTIME_H #include #endif -#ifdef _WIN32 -#include -#endif #include "archive.h" #include "archive_string.h" @@ -519,9 +516,6 @@ static ssize_t write_data_block(struct archive_write_disk *a, const char *buff, size_t size) { uint64_t start_size = size; -#if _WIN32 - HANDLE handle; -#endif ssize_t bytes_written = 0; ssize_t block_size = 0, bytes_to_write; @@ -530,9 +524,6 @@ write_data_block(struct archive_write_di "Attempt to write to an empty file"); return (ARCHIVE_WARN); } -#if _WIN32 - handle = (HANDLE)_get_osfhandle(a->fd); -#endif if (a->flags & ARCHIVE_EXTRACT_SPARSE) { #if HAVE_STRUCT_STAT_ST_BLKSIZE @@ -581,26 +572,9 @@ write_data_block(struct archive_write_di if (a->offset + bytes_to_write > block_end) bytes_to_write = block_end - a->offset; } -#ifdef _WIN32 /* Seek if necessary to the specified offset. */ if (offset != a->fd_offset) { - LARGE_INTEGER distance; - distance.QuadPart = offset; - if (!SetFilePointerEx(handle, distance, NULL, FILE_BEGIN)) { - archive_set_error(&a->archive, _dosmaperr(GetLastError()), - "Seek failed"); - return (ARCHIVE_FATAL); - } - } - if (!WriteFile(handle, buff, bytes_to_write, &bytes_written, NULL)) { - archive_set_error(&a->archive, _dosmaperr(GetLastError()), - "Write failed"); - return (ARCHIVE_WARN); - } -#else - /* Seek if necessary to the specified offset. */ - if (a->offset != a->fd_offset) { - if (lseek(a->fd, a->offset, SEEK_SET) < 0) { + if (lseek(a->fd, offset, SEEK_SET) < 0) { archive_set_error(&a->archive, errno, "Seek failed"); return (ARCHIVE_FATAL); @@ -614,7 +588,6 @@ write_data_block(struct archive_write_di archive_set_error(&a->archive, errno, "Write failed"); return (ARCHIVE_WARN); } -#endif buff += bytes_written; size -= bytes_written; a->offset += bytes_written; From owner-svn-src-head@FreeBSD.ORG Thu Mar 5 00:41: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 02402106564A; Thu, 5 Mar 2009 00:41:03 +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 E53A08FC0A; Thu, 5 Mar 2009 00:41:02 +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 n250f20q057755; Thu, 5 Mar 2009 00:41:02 GMT (envelope-from kientzle@svn.freebsd.org) Received: (from kientzle@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n250f2uV057754; Thu, 5 Mar 2009 00:41:02 GMT (envelope-from kientzle@svn.freebsd.org) Message-Id: <200903050041.n250f2uV057754@svn.freebsd.org> From: Tim Kientzle Date: Thu, 5 Mar 2009 00:41:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r189384 - head/lib/libarchive/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: Thu, 05 Mar 2009 00:41:03 -0000 Author: kientzle Date: Thu Mar 5 00:41:02 2009 New Revision: 189384 URL: http://svn.freebsd.org/changeset/base/189384 Log: Merge r362 from libarchive.googlecode.com: Minor fix to custom argument parser. Modified: head/lib/libarchive/test/main.c Modified: head/lib/libarchive/test/main.c ============================================================================== --- head/lib/libarchive/test/main.c Thu Mar 5 00:36:13 2009 (r189383) +++ head/lib/libarchive/test/main.c Thu Mar 5 00:41:02 2009 (r189384) @@ -975,9 +975,10 @@ int main(int argc, char **argv) */ ++argv; --argc;/* Skip program name */ while (*argv != NULL) { + if (**argv != '-') + break; p = *argv++; - if (*p++ != '-') - usage(progname); + ++p; /* Skip '-' */ while (*p != '\0') { option = *p++; option_arg = NULL; From owner-svn-src-head@FreeBSD.ORG Thu Mar 5 00:42: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 3C194106566B; Thu, 5 Mar 2009 00:42:51 +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 2ACC98FC0C; Thu, 5 Mar 2009 00:42:51 +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 n250gpqd057822; Thu, 5 Mar 2009 00:42:51 GMT (envelope-from kientzle@svn.freebsd.org) Received: (from kientzle@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n250gpKd057821; Thu, 5 Mar 2009 00:42:51 GMT (envelope-from kientzle@svn.freebsd.org) Message-Id: <200903050042.n250gpKd057821@svn.freebsd.org> From: Tim Kientzle Date: Thu, 5 Mar 2009 00:42: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: r189385 - head/lib/libarchive/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: Thu, 05 Mar 2009 00:42:51 -0000 Author: kientzle Date: Thu Mar 5 00:42:50 2009 New Revision: 189385 URL: http://svn.freebsd.org/changeset/base/189385 Log: Merge r357 from libarchive.googlecode.com: bzip2 compression support can always be enabled even if bzlib doesn't exist on this platform; don't give up until we fail to open the file. Modified: head/lib/libarchive/test/test_read_format_isorr_bz2.c Modified: head/lib/libarchive/test/test_read_format_isorr_bz2.c ============================================================================== --- head/lib/libarchive/test/test_read_format_isorr_bz2.c Thu Mar 5 00:41:02 2009 (r189384) +++ head/lib/libarchive/test/test_read_format_isorr_bz2.c Thu Mar 5 00:42:50 2009 (r189385) @@ -55,15 +55,15 @@ DEFINE_TEST(test_read_format_isorr_bz2) extract_reference_file(refname); assert((a = archive_read_new()) != NULL); - r = archive_read_support_compression_bzip2(a); + assertEqualInt(0, archive_read_support_compression_bzip2(a)); + assertEqualInt(0, archive_read_support_format_all(a)); + r = archive_read_open_filename(a, refname, 10240); if (r == ARCHIVE_FATAL) { skipping("Bzip2 decompression unsupported on this platform"); archive_read_finish(a); return; } assertEqualInt(0, r); - assertEqualInt(0, archive_read_support_format_all(a)); - assertEqualInt(0, archive_read_open_filename(a, refname, 10240)); /* First entry is '.' root directory. */ assertEqualInt(0, archive_read_next_header(a, &ae)); From owner-svn-src-head@FreeBSD.ORG Thu Mar 5 00:44: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 7B2801065670; Thu, 5 Mar 2009 00:44:12 +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 4FBA68FC1C; Thu, 5 Mar 2009 00:44:12 +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 n250iCCu057896; Thu, 5 Mar 2009 00:44:12 GMT (envelope-from kientzle@svn.freebsd.org) Received: (from kientzle@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n250iCfk057894; Thu, 5 Mar 2009 00:44:12 GMT (envelope-from kientzle@svn.freebsd.org) Message-Id: <200903050044.n250iCfk057894@svn.freebsd.org> From: Tim Kientzle Date: Thu, 5 Mar 2009 00:44: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: r189386 - head/lib/libarchive 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, 05 Mar 2009 00:44:13 -0000 Author: kientzle Date: Thu Mar 5 00:44:12 2009 New Revision: 189386 URL: http://svn.freebsd.org/changeset/base/189386 Log: Merge r356 and r358 from libarchive.googlecode.com: Remove a Windows special case from archive_entry.c, add one to archive_check_magic.c. Modified: head/lib/libarchive/archive_check_magic.c head/lib/libarchive/archive_entry.c Modified: head/lib/libarchive/archive_check_magic.c ============================================================================== --- head/lib/libarchive/archive_check_magic.c Thu Mar 5 00:42:50 2009 (r189385) +++ head/lib/libarchive/archive_check_magic.c Thu Mar 5 00:44:12 2009 (r189386) @@ -40,6 +40,10 @@ __FBSDID("$FreeBSD$"); #ifdef HAVE_UNISTD_H #include #endif +#ifdef _WIN32 +#include +#include +#endif #include "archive_private.h" @@ -52,6 +56,10 @@ errmsg(const char *m) static void diediedie(void) { +#if defined(_WIN32) && defined(_DEBUG) + /* Cause a breakpoint exception */ + DebugBreak(); +#endif *(char *)0 = 1; /* Deliberately segfault and force a coredump. */ _exit(1); /* If that didn't work, just exit with an error. */ } Modified: head/lib/libarchive/archive_entry.c ============================================================================== --- head/lib/libarchive/archive_entry.c Thu Mar 5 00:42:50 2009 (r189385) +++ head/lib/libarchive/archive_entry.c Thu Mar 5 00:44:12 2009 (r189386) @@ -62,9 +62,6 @@ __FBSDID("$FreeBSD$"); #ifdef HAVE_WCHAR_H #include #endif -#ifdef _WIN32 -#include -#endif #include "archive.h" #include "archive_entry.h" @@ -230,13 +227,7 @@ aes_get_wcs(struct aes *aes) w = (wchar_t *)malloc((wcs_length + 1) * sizeof(wchar_t)); if (w == NULL) __archive_errx(1, "No memory for aes_get_wcs()"); -#ifndef _WIN32 r = mbstowcs(w, aes->aes_mbs.s, wcs_length); -#else - r = MultiByteToWideChar(CP_ACP, MB_ERR_INVALID_CHARS, - aes->aes_mbs.s, (int)aes->aes_mbs.length, w, - (int)wcs_length); -#endif if (r > 0) { w[r] = 0; aes->aes_set |= AES_SET_WCS; From owner-svn-src-head@FreeBSD.ORG Thu Mar 5 00:57: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 0F960106564A; Thu, 5 Mar 2009 00:57:02 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id F145E8FC23; Thu, 5 Mar 2009 00:57:01 +0000 (UTC) (envelope-from delphij@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 n250v1d2058225; Thu, 5 Mar 2009 00:57:01 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n250v1dn058221; Thu, 5 Mar 2009 00:57:01 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <200903050057.n250v1dn058221@svn.freebsd.org> From: Xin LI Date: Thu, 5 Mar 2009 00:57: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: r189387 - in head/lib/libc/db: btree recno 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, 05 Mar 2009 00:57:02 -0000 Author: delphij Date: Thu Mar 5 00:57:01 2009 New Revision: 189387 URL: http://svn.freebsd.org/changeset/base/189387 Log: Our realloc(3) and reallocf(3) can handle NULL, which turns it into a malloc(3) call, so don't test if a pointer is NULL. Obtained from: OpenBSD (in spirit) Modified: head/lib/libc/db/btree/bt_overflow.c head/lib/libc/db/btree/bt_utils.c head/lib/libc/db/recno/rec_get.c head/lib/libc/db/recno/rec_utils.c Modified: head/lib/libc/db/btree/bt_overflow.c ============================================================================== --- head/lib/libc/db/btree/bt_overflow.c Thu Mar 5 00:44:12 2009 (r189386) +++ head/lib/libc/db/btree/bt_overflow.c Thu Mar 5 00:57:01 2009 (r189387) @@ -92,7 +92,7 @@ __ovfl_get(BTREE *t, void *p, size_t *ss #endif /* Make the buffer bigger as necessary. */ if (*bufsz < sz) { - *buf = (char *)(*buf == NULL ? malloc(sz) : reallocf(*buf, sz)); + *buf = reallocf(*buf, sz); if (*buf == NULL) return (RET_ERROR); *bufsz = sz; Modified: head/lib/libc/db/btree/bt_utils.c ============================================================================== --- head/lib/libc/db/btree/bt_utils.c Thu Mar 5 00:44:12 2009 (r189386) +++ head/lib/libc/db/btree/bt_utils.c Thu Mar 5 00:57:01 2009 (r189387) @@ -84,8 +84,7 @@ __bt_ret(BTREE *t, EPG *e, DBT *key, DBT key->data = rkey->data; } else if (copy || F_ISSET(t, B_DB_LOCK)) { if (bl->ksize > rkey->size) { - p = (void *)(rkey->data == NULL ? - malloc(bl->ksize) : realloc(rkey->data, bl->ksize)); + p = realloc(rkey->data, bl->ksize); if (p == NULL) return (RET_ERROR); rkey->data = p; @@ -111,9 +110,7 @@ dataonly: } else if (copy || F_ISSET(t, B_DB_LOCK)) { /* Use +1 in case the first record retrieved is 0 length. */ if (bl->dsize + 1 > rdata->size) { - p = (void *)(rdata->data == NULL ? - malloc(bl->dsize + 1) : - realloc(rdata->data, bl->dsize + 1)); + p = realloc(rdata->data, bl->dsize + 1); if (p == NULL) return (RET_ERROR); rdata->data = p; Modified: head/lib/libc/db/recno/rec_get.c ============================================================================== --- head/lib/libc/db/recno/rec_get.c Thu Mar 5 00:44:12 2009 (r189386) +++ head/lib/libc/db/recno/rec_get.c Thu Mar 5 00:57:01 2009 (r189387) @@ -122,9 +122,7 @@ __rec_fpipe(BTREE *t, recno_t top) u_char *p; if (t->bt_rdata.size < t->bt_reclen) { - t->bt_rdata.data = t->bt_rdata.data == NULL ? - malloc(t->bt_reclen) : - reallocf(t->bt_rdata.data, t->bt_reclen); + t->bt_rdata.data = reallocf(t->bt_rdata.data, t->bt_reclen); if (t->bt_rdata.data == NULL) return (RET_ERROR); t->bt_rdata.size = t->bt_reclen; @@ -193,9 +191,7 @@ __rec_vpipe(BTREE *t, recno_t top) if (sz == 0) { len = p - (u_char *)t->bt_rdata.data; t->bt_rdata.size += (sz = 256); - t->bt_rdata.data = t->bt_rdata.data == NULL ? - malloc(t->bt_rdata.size) : - reallocf(t->bt_rdata.data, t->bt_rdata.size); + t->bt_rdata.data = reallocf(t->bt_rdata.data, t->bt_rdata.size); if (t->bt_rdata.data == NULL) return (RET_ERROR); p = (u_char *)t->bt_rdata.data + len; @@ -230,9 +226,7 @@ __rec_fmap(BTREE *t, recno_t top) size_t len; if (t->bt_rdata.size < t->bt_reclen) { - t->bt_rdata.data = t->bt_rdata.data == NULL ? - malloc(t->bt_reclen) : - reallocf(t->bt_rdata.data, t->bt_reclen); + t->bt_rdata.data = reallocf(t->bt_rdata.data, t->bt_reclen); if (t->bt_rdata.data == NULL) return (RET_ERROR); t->bt_rdata.size = t->bt_reclen; Modified: head/lib/libc/db/recno/rec_utils.c ============================================================================== --- head/lib/libc/db/recno/rec_utils.c Thu Mar 5 00:44:12 2009 (r189386) +++ head/lib/libc/db/recno/rec_utils.c Thu Mar 5 00:57:01 2009 (r189387) @@ -67,9 +67,7 @@ __rec_ret(BTREE *t, EPG *e, recno_t nrec /* We have to copy the key, it's not on the page. */ if (sizeof(recno_t) > t->bt_rkey.size) { - p = (void *)(t->bt_rkey.data == NULL ? - malloc(sizeof(recno_t)) : - realloc(t->bt_rkey.data, sizeof(recno_t))); + p = realloc(t->bt_rkey.data, sizeof(recno_t)); if (p == NULL) return (RET_ERROR); t->bt_rkey.data = p; @@ -97,9 +95,7 @@ dataonly: } else if (F_ISSET(t, B_DB_LOCK)) { /* Use +1 in case the first record retrieved is 0 length. */ if (rl->dsize + 1 > t->bt_rdata.size) { - p = (void *)(t->bt_rdata.data == NULL ? - malloc(rl->dsize + 1) : - realloc(t->bt_rdata.data, rl->dsize + 1)); + p = realloc(t->bt_rdata.data, rl->dsize + 1); if (p == NULL) return (RET_ERROR); t->bt_rdata.data = p; From owner-svn-src-head@FreeBSD.ORG Thu Mar 5 01:59: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 3988B1065670; Thu, 5 Mar 2009 01:59:50 +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 27EED8FC0C; Thu, 5 Mar 2009 01:59:50 +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 n251xo6T059358; Thu, 5 Mar 2009 01:59:50 GMT (envelope-from kientzle@svn.freebsd.org) Received: (from kientzle@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n251xoFP059357; Thu, 5 Mar 2009 01:59:50 GMT (envelope-from kientzle@svn.freebsd.org) Message-Id: <200903050159.n251xoFP059357@svn.freebsd.org> From: Tim Kientzle Date: Thu, 5 Mar 2009 01:59: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: r189388 - head/lib/libarchive 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, 05 Mar 2009 01:59:50 -0000 Author: kientzle Date: Thu Mar 5 01:59:49 2009 New Revision: 189388 URL: http://svn.freebsd.org/changeset/base/189388 Log: Correct r189383, which mis-merged a change from libarchive.googlecode.com. Modified: head/lib/libarchive/archive_write_disk.c Modified: head/lib/libarchive/archive_write_disk.c ============================================================================== --- head/lib/libarchive/archive_write_disk.c Thu Mar 5 00:57:01 2009 (r189387) +++ head/lib/libarchive/archive_write_disk.c Thu Mar 5 01:59:49 2009 (r189388) @@ -573,8 +573,8 @@ write_data_block(struct archive_write_di bytes_to_write = block_end - a->offset; } /* Seek if necessary to the specified offset. */ - if (offset != a->fd_offset) { - if (lseek(a->fd, offset, SEEK_SET) < 0) { + if (a->offset != a->fd_offset) { + if (lseek(a->fd, a->offset, SEEK_SET) < 0) { archive_set_error(&a->archive, errno, "Seek failed"); return (ARCHIVE_FATAL); From owner-svn-src-head@FreeBSD.ORG Thu Mar 5 02:03: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 7C706106566B; Thu, 5 Mar 2009 02:03:06 +0000 (UTC) (envelope-from rnoland@FreeBSD.org) Received: from gizmo.2hip.net (gizmo.2hip.net [64.74.207.195]) by mx1.freebsd.org (Postfix) with ESMTP id 41AAF8FC17; Thu, 5 Mar 2009 02:03:06 +0000 (UTC) (envelope-from rnoland@FreeBSD.org) Received: from [192.168.1.2] (adsl-154-199-160.ard.bellsouth.net [72.154.199.160]) (authenticated bits=0) by gizmo.2hip.net (8.14.3/8.14.3) with ESMTP id n2521iOd069121 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Wed, 4 Mar 2009 21:01:44 -0500 (EST) (envelope-from rnoland@FreeBSD.org) From: Robert Noland To: "M. Warner Losh" In-Reply-To: <20090304.135606.1649768480.imp@bsdimp.com> References: <200903041823.n24INmcc049524@svn.freebsd.org> <20090304.135606.1649768480.imp@bsdimp.com> Content-Type: multipart/signed; micalg="pgp-sha1"; protocol="application/pgp-signature"; boundary="=-2527ctG2K/UVgikmk7VI" Organization: FreeBSD Date: Wed, 04 Mar 2009 20:02:52 -0600 Message-Id: <1236218572.1384.19.camel@widget.2hip.net> Mime-Version: 1.0 X-Mailer: Evolution 2.24.4 FreeBSD GNOME Team Port X-Spam-Status: No, score=-1.6 required=5.0 tests=AWL,BAYES_00,RCVD_IN_PBL, RCVD_IN_SORBS_DUL,RDNS_DYNAMIC autolearn=no version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on gizmo.2hip.net Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org Subject: Re: svn commit: r189367 - head/sys/dev/pci 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, 05 Mar 2009 02:03:06 -0000 --=-2527ctG2K/UVgikmk7VI Content-Type: text/plain Content-Transfer-Encoding: quoted-printable On Wed, 2009-03-04 at 13:56 -0700, M. Warner Losh wrote: > In message: <200903041823.n24INmcc049524@svn.freebsd.org> > Robert Noland writes: > : Author: rnoland > : Date: Wed Mar 4 18:23:48 2009 > : New Revision: 189367 > : URL: http://svn.freebsd.org/changeset/base/189367 > :=20 > : Log: > : Extend the management of PCIM_CMD_INTxDIS. > : =20 > : We now explicitly enable INTx during bus_setup_intr() if it is needed= . > : Several of the ata drivers were managing this bit internally. This i= s > : better handled in pci and it should work for all drivers now. > : =20 > : We also mask INTx during bus_teardown_intr() by setting this bit. > : =20 > : Reviewed by: jhb > : MFC after: 3 days >=20 > Note: the INTxDIS bit is new in PCI 3.0, and has no effect on earlier > devices. This should be highlighted in the comments somewhere... It is documented in 2.3 as well, I'm not sure about previous versions of the spec though. robert. > Warner --=20 Robert Noland FreeBSD --=-2527ctG2K/UVgikmk7VI Content-Type: application/pgp-signature; name="signature.asc" Content-Description: This is a digitally signed message part -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.10 (FreeBSD) iEYEABECAAYFAkmvMswACgkQM4TrQ4qfROM+0QCcDnmzqVPICx9Xh3/Qn5n9Vxf+ tasAn2yNgO+I2QEqayb+e7q0EuXb/79h =ukXp -----END PGP SIGNATURE----- --=-2527ctG2K/UVgikmk7VI-- From owner-svn-src-head@FreeBSD.ORG Thu Mar 5 02:19:42 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 DEE9E1065673; Thu, 5 Mar 2009 02:19:42 +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 CB88A8FC13; Thu, 5 Mar 2009 02:19:42 +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 n252JghI059767; Thu, 5 Mar 2009 02:19:42 GMT (envelope-from kientzle@svn.freebsd.org) Received: (from kientzle@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n252Jg2F059763; Thu, 5 Mar 2009 02:19:42 GMT (envelope-from kientzle@svn.freebsd.org) Message-Id: <200903050219.n252Jg2F059763@svn.freebsd.org> From: Tim Kientzle Date: Thu, 5 Mar 2009 02:19: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: r189389 - in head/lib/libarchive: . 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: Thu, 05 Mar 2009 02:19:43 -0000 Author: kientzle Date: Thu Mar 5 02:19:42 2009 New Revision: 189389 URL: http://svn.freebsd.org/changeset/base/189389 Log: Merge r364, r378, r379, r393, and r539 from libarchive.googlecode.com: This is the last phase of the "big decompression refactor" that puts a lazy reblocking layer between each pair of read filters. I've also changed the terminology for this area---the two kinds of objects are now called "read filters" and "read filter bidders"---and moved ownership of these objects to the archive_read core. This greatly simplifies implementing new read filters, which can now use peek/consume I/O semantics both for bidding (arbitrary look-ahead!) and for reading streams (look-ahead simplifies handling concatenated streams, for instance). The first merge here is the overhaul proper; the remainder are small fixes to correct errors in the initial implementation. Modified: head/lib/libarchive/archive_read.c head/lib/libarchive/archive_read_private.h head/lib/libarchive/archive_read_support_compression_bzip2.c head/lib/libarchive/archive_read_support_compression_compress.c head/lib/libarchive/archive_read_support_compression_gzip.c head/lib/libarchive/archive_read_support_compression_program.c head/lib/libarchive/test/test_read_position.c Modified: head/lib/libarchive/archive_read.c ============================================================================== --- head/lib/libarchive/archive_read.c Thu Mar 5 01:59:49 2009 (r189388) +++ head/lib/libarchive/archive_read.c Thu Mar 5 02:19:42 2009 (r189389) @@ -75,16 +75,6 @@ archive_read_new(void) a->archive.state = ARCHIVE_STATE_NEW; a->entry = archive_entry_new(); - /* Initialize reblocking logic. */ - a->buffer_size = 64 * 1024; /* 64k */ - a->buffer = (char *)malloc(a->buffer_size); - a->next = a->buffer; - if (a->buffer == NULL) { - archive_entry_free(a->entry); - free(a); - return (NULL); - } - return (&a->archive); } @@ -117,28 +107,33 @@ archive_read_open(struct archive *a, voi } static ssize_t -client_read_proxy(struct archive_read_source *self, const void **buff) +client_read_proxy(struct archive_read_filter *self, const void **buff) { - return (self->archive->client.reader)((struct archive *)self->archive, + ssize_t r; + r = (self->archive->client.reader)(&self->archive->archive, self->data, buff); + self->archive->archive.raw_position += r; + return (r); } static int64_t -client_skip_proxy(struct archive_read_source *self, int64_t request) +client_skip_proxy(struct archive_read_filter *self, int64_t request) { - return (self->archive->client.skipper)((struct archive *)self->archive, + int64_t r; + r = (self->archive->client.skipper)(&self->archive->archive, self->data, request); + self->archive->archive.raw_position += r; + return (r); } static int -client_close_proxy(struct archive_read_source *self) +client_close_proxy(struct archive_read_filter *self) { int r = ARCHIVE_OK; if (self->archive->client.closer != NULL) r = (self->archive->client.closer)((struct archive *)self->archive, self->data); - free(self); return (r); } @@ -151,6 +146,7 @@ archive_read_open2(struct archive *_a, v archive_close_callback *client_closer) { struct archive_read *a = (struct archive_read *)_a; + struct archive_read_filter *filter; int e; __archive_check_magic(_a, ARCHIVE_READ_MAGIC, ARCHIVE_STATE_NEW, @@ -172,27 +168,21 @@ archive_read_open2(struct archive *_a, v } /* Save the client functions and mock up the initial source. */ - a->client.opener = client_opener; /* Do we need to remember this? */ a->client.reader = client_reader; a->client.skipper = client_skipper; a->client.closer = client_closer; - a->client.data = client_data; - { - struct archive_read_source *source; - - source = calloc(1, sizeof(*source)); - if (source == NULL) - return (ARCHIVE_FATAL); - source->reader = NULL; - source->upstream = NULL; - source->archive = a; - source->data = client_data; - source->read = client_read_proxy; - source->skip = client_skip_proxy; - source->close = client_close_proxy; - a->source = source; - } + filter = calloc(1, sizeof(*filter)); + if (filter == NULL) + return (ARCHIVE_FATAL); + filter->bidder = NULL; + filter->upstream = NULL; + filter->archive = a; + filter->data = client_data; + filter->read = client_read_proxy; + filter->skip = client_skip_proxy; + filter->close = client_close_proxy; + a->filter = filter; /* In case there's no filter. */ a->archive.compression_code = ARCHIVE_COMPRESSION_NONE; @@ -214,60 +204,49 @@ archive_read_open2(struct archive *_a, v static int build_stream(struct archive_read *a) { - int number_readers, i, bid, best_bid; - struct archive_reader *reader, *best_reader; - struct archive_read_source *source; - const void *block; - ssize_t bytes_read; - - /* Read first block now for compress format detection. */ - bytes_read = (a->source->read)(a->source, &block); - if (bytes_read < 0) { - /* If the first read fails, close before returning error. */ - if (a->source->close != NULL) { - (a->source->close)(a->source); - a->source = NULL; - } - /* source->read should have already set error information. */ - return (ARCHIVE_FATAL); - } + int number_bidders, i, bid, best_bid; + struct archive_read_filter_bidder *bidder, *best_bidder; + struct archive_read_filter *filter; + int r; - number_readers = sizeof(a->readers) / sizeof(a->readers[0]); + for (;;) { + number_bidders = sizeof(a->bidders) / sizeof(a->bidders[0]); - best_bid = 0; - best_reader = NULL; + best_bid = 0; + best_bidder = NULL; - reader = a->readers; - for (i = 0, reader = a->readers; i < number_readers; i++, reader++) { - if (reader->bid != NULL) { - bid = (reader->bid)(reader, block, bytes_read); - if (bid > best_bid) { - best_bid = bid; - best_reader = reader; + bidder = a->bidders; + for (i = 0; i < number_bidders; i++, bidder++) { + if (bidder->bid != NULL) { + bid = (bidder->bid)(bidder, a->filter); + if (bid > best_bid) { + best_bid = bid; + best_bidder = bidder; + } } } - } - /* - * If we have a winner, it becomes the next stage in the pipeline. - */ - if (best_reader != NULL) { - source = (best_reader->init)(a, best_reader, a->source, - block, bytes_read); - if (source == NULL) + /* If no bidder, we're done. */ + if (best_bidder == NULL) { + a->archive.compression_name = a->filter->name; + a->archive.compression_code = a->filter->code; + return (ARCHIVE_OK); + } + + filter + = (struct archive_read_filter *)calloc(1, sizeof(*filter)); + if (filter == NULL) return (ARCHIVE_FATAL); - /* Record the best decompressor for this stream. */ - a->source = source; - /* Recurse to get next pipeline stage. */ - return (build_stream(a)); + filter->bidder = best_bidder; + filter->archive = a; + filter->upstream = a->filter; + r = (best_bidder->init)(filter); + if (r != ARCHIVE_OK) { + free(filter); + return (r); + } + a->filter = filter; } - - /* Save first block of data. */ - a->client_buff = block; - a->client_total = bytes_read; - a->client_next = a->client_buff; - a->client_avail = a->client_total; - return (ARCHIVE_OK); } /* @@ -594,20 +573,24 @@ archive_read_close(struct archive *_a) /* TODO: Clean up the formatters. */ - /* Clean up the stream pipeline. */ - while (a->source != NULL) { - struct archive_read_source *t = a->source->upstream; - r1 = (a->source->close)(a->source); - if (r1 < r) - r = r1; - a->source = t; + /* Clean up the filter pipeline. */ + while (a->filter != NULL) { + struct archive_read_filter *t = a->filter->upstream; + if (a->filter->close != NULL) { + r1 = (a->filter->close)(a->filter); + if (r1 < r) + r = r1; + } + free(a->filter->buffer); + free(a->filter); + a->filter = t; } - /* Release the reader objects. */ - n = sizeof(a->readers)/sizeof(a->readers[0]); + /* Release the bidder objects. */ + n = sizeof(a->bidders)/sizeof(a->bidders[0]); for (i = 0; i < n; i++) { - if (a->readers[i].free != NULL) { - r1 = (a->readers[i].free)(&a->readers[i]); + if (a->bidders[i].free != NULL) { + r1 = (a->bidders[i].free)(&a->bidders[i]); if (r1 < r) r = r1; } @@ -649,7 +632,6 @@ archive_read_finish(struct archive *_a) if (a->entry) archive_entry_free(a->entry); a->archive.magic = 0; - free(a->buffer); free(a); #if ARCHIVE_API_VERSION > 1 return (r); @@ -699,20 +681,20 @@ __archive_read_register_format(struct ar * Used internally by decompression routines to register their bid and * initialization functions. */ -struct archive_reader * -__archive_read_get_reader(struct archive_read *a) +struct archive_read_filter_bidder * +__archive_read_get_bidder(struct archive_read *a) { int i, number_slots; __archive_check_magic(&a->archive, ARCHIVE_READ_MAGIC, ARCHIVE_STATE_NEW, - "__archive_read_get_reader"); + "__archive_read_get_bidder"); - number_slots = sizeof(a->readers) / sizeof(a->readers[0]); + number_slots = sizeof(a->bidders) / sizeof(a->bidders[0]); for (i = 0; i < number_slots; i++) { - if (a->readers[i].bid == NULL) - return (a->readers + i); + if (a->bidders[i].bid == NULL) + return (a->bidders + i); } __archive_errx(1, "Not enough slots for compression registration"); @@ -725,7 +707,7 @@ __archive_read_get_reader(struct archive * flexible read-ahead and allows the I/O code to operate in a * zero-copy manner most of the time. * - * In the ideal case, block providers give the I/O code blocks of data + * In the ideal case, filters generate blocks of data * and __archive_read_ahead() just returns pointers directly into * those blocks. Then __archive_read_consume() just bumps those * pointers. Only if your request would span blocks does the I/O @@ -738,7 +720,7 @@ __archive_read_get_reader(struct archive * * "I just want some data." Ask for 1 byte and pay attention to * the "number of bytes available" from __archive_read_ahead(). * You can consume more than you asked for; you just can't consume - * more than is available right now. If you consume everything that's + * more than is available. If you consume everything that's * immediately available, the next read_ahead() call will pull * the next block. * * "I want to output a large block of data." As above, ask for 1 byte, @@ -790,10 +772,17 @@ __archive_read_get_reader(struct archive const void * __archive_read_ahead(struct archive_read *a, size_t min, ssize_t *avail) { + return (__archive_read_filter_ahead(a->filter, min, avail)); +} + +const void * +__archive_read_filter_ahead(struct archive_read_filter *filter, + size_t min, ssize_t *avail) +{ ssize_t bytes_read; size_t tocopy; - if (a->fatal) { + if (filter->fatal) { if (avail) *avail = ARCHIVE_FATAL; return (NULL); @@ -807,68 +796,68 @@ __archive_read_ahead(struct archive_read /* * If we can satisfy from the copy buffer, we're done. */ - if (a->avail >= min) { + if (filter->avail >= min) { if (avail != NULL) - *avail = a->avail; - return (a->next); + *avail = filter->avail; + return (filter->next); } /* * We can satisfy directly from client buffer if everything * currently in the copy buffer is still in the client buffer. */ - if (a->client_total >= a->client_avail + a->avail - && a->client_avail + a->avail >= min) { + if (filter->client_total >= filter->client_avail + filter->avail + && filter->client_avail + filter->avail >= min) { /* "Roll back" to client buffer. */ - a->client_avail += a->avail; - a->client_next -= a->avail; + filter->client_avail += filter->avail; + filter->client_next -= filter->avail; /* Copy buffer is now empty. */ - a->avail = 0; - a->next = a->buffer; + filter->avail = 0; + filter->next = filter->buffer; /* Return data from client buffer. */ if (avail != NULL) - *avail = a->client_avail; - return (a->client_next); + *avail = filter->client_avail; + return (filter->client_next); } /* Move data forward in copy buffer if necessary. */ - if (a->next > a->buffer && - a->next + min > a->buffer + a->buffer_size) { - if (a->avail > 0) - memmove(a->buffer, a->next, a->avail); - a->next = a->buffer; + if (filter->next > filter->buffer && + filter->next + min > filter->buffer + filter->buffer_size) { + if (filter->avail > 0) + memmove(filter->buffer, filter->next, filter->avail); + filter->next = filter->buffer; } /* If we've used up the client data, get more. */ - if (a->client_avail <= 0) { - if (a->end_of_file) { + if (filter->client_avail <= 0) { + if (filter->end_of_file) { if (avail != NULL) *avail = 0; return (NULL); } - bytes_read = (a->source->read)(a->source, - &a->client_buff); + bytes_read = (filter->read)(filter, + &filter->client_buff); if (bytes_read < 0) { /* Read error. */ - a->client_total = a->client_avail = 0; - a->client_next = a->client_buff = NULL; - a->fatal = 1; + filter->client_total = filter->client_avail = 0; + filter->client_next = filter->client_buff = NULL; + filter->fatal = 1; if (avail != NULL) *avail = ARCHIVE_FATAL; return (NULL); } if (bytes_read == 0) { /* Premature end-of-file. */ - a->client_total = a->client_avail = 0; - a->client_next = a->client_buff = NULL; - a->end_of_file = 1; + filter->client_total = filter->client_avail = 0; + filter->client_next = filter->client_buff = NULL; + filter->end_of_file = 1; /* Return whatever we do have. */ if (avail != NULL) - *avail = a->avail; + *avail = filter->avail; return (NULL); } - a->archive.raw_position += bytes_read; - a->client_total = bytes_read; - a->client_avail = a->client_total; - a->client_next = a->client_buff; + filter->position += bytes_read; + filter->client_total = bytes_read; + filter->client_avail = filter->client_total; + filter->client_next = filter->client_buff; } else { @@ -880,19 +869,22 @@ __archive_read_ahead(struct archive_read */ /* Ensure the buffer is big enough. */ - if (min > a->buffer_size) { + if (min > filter->buffer_size) { size_t s, t; char *p; /* Double the buffer; watch for overflow. */ - s = t = a->buffer_size; + s = t = filter->buffer_size; + if (s == 0) + s = min; while (s < min) { t *= 2; if (t <= s) { /* Integer overflow! */ - archive_set_error(&a->archive, - ENOMEM, + archive_set_error( + &filter->archive->archive, + ENOMEM, "Unable to allocate copy buffer"); - a->fatal = 1; + filter->fatal = 1; if (avail != NULL) *avail = ARCHIVE_FATAL; return (NULL); @@ -902,39 +894,41 @@ __archive_read_ahead(struct archive_read /* Now s >= min, so allocate a new buffer. */ p = (char *)malloc(s); if (p == NULL) { - archive_set_error(&a->archive, ENOMEM, + archive_set_error( + &filter->archive->archive, + ENOMEM, "Unable to allocate copy buffer"); - a->fatal = 1; + filter->fatal = 1; if (avail != NULL) *avail = ARCHIVE_FATAL; return (NULL); } /* Move data into newly-enlarged buffer. */ - if (a->avail > 0) - memmove(p, a->next, a->avail); - free(a->buffer); - a->next = a->buffer = p; - a->buffer_size = s; + if (filter->avail > 0) + memmove(p, filter->next, filter->avail); + free(filter->buffer); + filter->next = filter->buffer = p; + filter->buffer_size = s; } /* We can add client data to copy buffer. */ /* First estimate: copy to fill rest of buffer. */ - tocopy = (a->buffer + a->buffer_size) - - (a->next + a->avail); + tocopy = (filter->buffer + filter->buffer_size) + - (filter->next + filter->avail); /* Don't waste time buffering more than we need to. */ - if (tocopy + a->avail > min) - tocopy = min - a->avail; + if (tocopy + filter->avail > min) + tocopy = min - filter->avail; /* Don't copy more than is available. */ - if (tocopy > a->client_avail) - tocopy = a->client_avail; + if (tocopy > filter->client_avail) + tocopy = filter->client_avail; - memcpy(a->next + a->avail, a->client_next, + memcpy(filter->next + filter->avail, filter->client_next, tocopy); /* Remove this data from client buffer. */ - a->client_next += tocopy; - a->client_avail -= tocopy; + filter->client_next += tocopy; + filter->client_avail -= tocopy; /* add it to copy buffer. */ - a->avail += tocopy; + filter->avail += tocopy; } } } @@ -953,16 +947,25 @@ __archive_read_ahead(struct archive_read ssize_t __archive_read_consume(struct archive_read *a, size_t request) { - if (a->avail > 0) { + ssize_t r; + r = __archive_read_filter_consume(a->filter, request); + a->archive.file_position += r; + return (r); +} + +ssize_t +__archive_read_filter_consume(struct archive_read_filter * filter, + size_t request) +{ + if (filter->avail > 0) { /* Read came from copy buffer. */ - a->next += request; - a->avail -= request; + filter->next += request; + filter->avail -= request; } else { /* Read came from client buffer. */ - a->client_next += request; - a->client_avail -= request; + filter->client_next += request; + filter->client_avail -= request; } - a->archive.file_position += request; return (request); } @@ -976,23 +979,29 @@ __archive_read_consume(struct archive_re int64_t __archive_read_skip(struct archive_read *a, int64_t request) { + return (__archive_read_filter_skip(a->filter, request)); +} + +int64_t +__archive_read_filter_skip(struct archive_read_filter *filter, int64_t request) +{ off_t bytes_skipped, total_bytes_skipped = 0; size_t min; - if (a->fatal) + if (filter->fatal) return (-1); /* * If there is data in the buffers already, use that first. */ - if (a->avail > 0) { - min = minimum(request, (off_t)a->avail); - bytes_skipped = __archive_read_consume(a, min); + if (filter->avail > 0) { + min = minimum(request, (off_t)filter->avail); + bytes_skipped = __archive_read_consume(filter->archive, min); request -= bytes_skipped; total_bytes_skipped += bytes_skipped; } - if (a->client_avail > 0) { - min = minimum(request, (off_t)a->client_avail); - bytes_skipped = __archive_read_consume(a, min); + if (filter->client_avail > 0) { + min = minimum(request, (off_t)filter->client_avail); + bytes_skipped = __archive_read_consume(filter->archive, min); request -= bytes_skipped; total_bytes_skipped += bytes_skipped; } @@ -1002,23 +1011,22 @@ __archive_read_skip(struct archive_read * If a client_skipper was provided, try that first. */ #if ARCHIVE_API_VERSION < 2 - if ((a->source->skip != NULL) && (request < SSIZE_MAX)) { + if ((filter->skip != NULL) && (request < SSIZE_MAX)) { #else - if (a->source->skip != NULL) { + if (filter->skip != NULL) { #endif - bytes_skipped = (a->source->skip)(a->source, request); + bytes_skipped = (filter->skip)(filter, request); if (bytes_skipped < 0) { /* error */ - a->client_total = a->client_avail = 0; - a->client_next = a->client_buff = NULL; - a->fatal = 1; + filter->client_total = filter->client_avail = 0; + filter->client_next = filter->client_buff = NULL; + filter->fatal = 1; return (bytes_skipped); } + filter->archive->archive.file_position += bytes_skipped; total_bytes_skipped += bytes_skipped; - a->archive.file_position += bytes_skipped; request -= bytes_skipped; - a->client_next = a->client_buff; - a->archive.raw_position += bytes_skipped; - a->client_avail = a->client_total = 0; + filter->client_next = filter->client_buff; + filter->client_avail = filter->client_total = 0; } /* * Note that client_skipper will usually not satisfy the @@ -1029,18 +1037,20 @@ __archive_read_skip(struct archive_read while (request > 0) { const void* dummy_buffer; ssize_t bytes_read; - dummy_buffer = __archive_read_ahead(a, 1, &bytes_read); + dummy_buffer = __archive_read_ahead(filter->archive, + 1, &bytes_read); if (bytes_read < 0) return (bytes_read); if (bytes_read == 0) { /* We hit EOF before we satisfied the skip request. */ - archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC, + archive_set_error(&filter->archive->archive, + ARCHIVE_ERRNO_MISC, "Truncated input file (need to skip %jd bytes)", (intmax_t)request); return (ARCHIVE_FATAL); } min = (size_t)(minimum(bytes_read, request)); - bytes_read = __archive_read_consume(a, min); + bytes_read = __archive_read_consume(filter->archive, min); total_bytes_skipped += bytes_read; request -= bytes_read; } Modified: head/lib/libarchive/archive_read_private.h ============================================================================== --- head/lib/libarchive/archive_read_private.h Thu Mar 5 01:59:49 2009 (r189388) +++ head/lib/libarchive/archive_read_private.h Thu Mar 5 02:19:42 2009 (r189389) @@ -33,72 +33,80 @@ #include "archive_private.h" struct archive_read; -struct archive_reader; -struct archive_read_source; +struct archive_read_filter_bidder; +struct archive_read_filter; /* - * A "reader" knows how to provide blocks. That can include something - * that reads blocks from disk or socket or a transformation layer - * that reads blocks from another source and transforms them. This - * includes decompression and decryption filters. - * - * How bidding works: + * How bidding works for filters: * * The bid manager reads the first block from the current source. * * It shows that block to each registered bidder. - * * The winning bidder is initialized (with the block and information - * about the source) - * * The winning bidder becomes the new source and the process repeats - * This ends only when no reader provides a non-zero bid. + * * The bid manager creates a new filter structure for the winning + * bidder and gives the winning bidder a chance to initialize it. + * * The new filter becomes the top filter in the archive_read structure + * and we repeat the process. + * This ends only when no bidder provides a non-zero bid. */ -struct archive_reader { - /* Configuration data for the reader. */ +struct archive_read_filter_bidder { + /* Configuration data for the bidder. */ void *data; - /* Bidder is handed the initial block from its source. */ - int (*bid)(struct archive_reader *, const void *buff, size_t); - /* Init() is given the archive, upstream source, and the initial - * block above. It returns a populated source structure. */ - struct archive_read_source *(*init)(struct archive_read *, - struct archive_reader *, struct archive_read_source *source, - const void *, size_t); - /* Release the reader and any configuration data it allocated. */ - int (*free)(struct archive_reader *); + /* Taste the upstream filter to see if we handle this. */ + int (*bid)(struct archive_read_filter_bidder *, + struct archive_read_filter *); + /* Initialize a newly-created filter. */ + int (*init)(struct archive_read_filter *); + /* Release the bidder's configuration data. */ + int (*free)(struct archive_read_filter_bidder *); }; /* - * A "source" is an instance of a reader. This structure is - * allocated and initialized by the init() method of a reader - * above. + * This structure is allocated within the archive_read core + * and initialized by archive_read and the init() method of the + * corresponding bidder above. */ -struct archive_read_source { - /* Essentially all sources will need these values, so +struct archive_read_filter { + /* Essentially all filters will need these values, so * just declare them here. */ - struct archive_reader *reader; /* Reader that I'm an instance of. */ - struct archive_read_source *upstream; /* Who I get blocks from. */ - struct archive_read *archive; /* associated archive. */ + struct archive_read_filter_bidder *bidder; /* My bidder. */ + struct archive_read_filter *upstream; /* Who I read from. */ + struct archive_read *archive; /* Associated archive. */ /* Return next block. */ - ssize_t (*read)(struct archive_read_source *, const void **); + ssize_t (*read)(struct archive_read_filter *, const void **); /* Skip forward this many bytes. */ - int64_t (*skip)(struct archive_read_source *self, int64_t request); - /* Close (recursively) and free(self). */ - int (*close)(struct archive_read_source *self); + int64_t (*skip)(struct archive_read_filter *self, int64_t request); + /* Close (just this filter) and free(self). */ + int (*close)(struct archive_read_filter *self); /* My private data. */ void *data; + + const char *name; + int code; + + /* Used by reblocking logic. */ + char *buffer; + size_t buffer_size; + char *next; /* Current read location. */ + size_t avail; /* Bytes in my buffer. */ + const void *client_buff; /* Client buffer information. */ + size_t client_total; + const char *client_next; + size_t client_avail; + int64_t position; + char end_of_file; + char fatal; }; /* - * The client source is almost the same as an internal source. + * The client looks a lot like a filter, so we just wrap it here. * - * TODO: Make archive_read_source and archive_read_client identical so + * TODO: Make archive_read_filter and archive_read_client identical so * that users of the library can easily register their own * transformation filters. This will probably break the API/ABI and - * so should be deferred until libarchive 3.0. + * so should be deferred at least until libarchive 3.0. */ struct archive_read_client { - archive_open_callback *opener; archive_read_callback *reader; archive_skip_callback *skipper; archive_close_callback *closer; - void *data; }; struct archive_read { @@ -122,28 +130,15 @@ struct archive_read { /* Callbacks to open/read/write/close client archive stream. */ struct archive_read_client client; - /* Registered readers. */ - struct archive_reader readers[8]; + /* Registered filter bidders. */ + struct archive_read_filter_bidder bidders[8]; - /* Source */ - struct archive_read_source *source; + /* Last filter in chain */ + struct archive_read_filter *filter; /* File offset of beginning of most recently-read header. */ off_t header_position; - - /* Used by reblocking logic. */ - char *buffer; - size_t buffer_size; - char *next; /* Current read location. */ - size_t avail; /* Bytes in my buffer. */ - const void *client_buff; /* Client buffer information. */ - size_t client_total; - const char *client_next; - size_t client_avail; - char end_of_file; - char fatal; - /* * Format detection is mostly the same as compression * detection, with one significant difference: The bidders @@ -177,13 +172,14 @@ int __archive_read_register_format(struc int (*read_data_skip)(struct archive_read *), int (*cleanup)(struct archive_read *)); -struct archive_reader - *__archive_read_get_reader(struct archive_read *a); +struct archive_read_filter_bidder + *__archive_read_get_bidder(struct archive_read *a); -const void - *__archive_read_ahead(struct archive_read *, size_t, ssize_t *); -ssize_t - __archive_read_consume(struct archive_read *, size_t); -int64_t - __archive_read_skip(struct archive_read *, int64_t); +const void *__archive_read_ahead(struct archive_read *, size_t, ssize_t *); +const void *__archive_read_filter_ahead(struct archive_read_filter *, + size_t, ssize_t *); +ssize_t __archive_read_consume(struct archive_read *, size_t); +ssize_t __archive_read_filter_consume(struct archive_read_filter *, size_t); +int64_t __archive_read_skip(struct archive_read *, int64_t); +int64_t __archive_read_filter_skip(struct archive_read_filter *, int64_t); #endif Modified: head/lib/libarchive/archive_read_support_compression_bzip2.c ============================================================================== --- head/lib/libarchive/archive_read_support_compression_bzip2.c Thu Mar 5 01:59:49 2009 (r189388) +++ head/lib/libarchive/archive_read_support_compression_bzip2.c Thu Mar 5 02:19:42 2009 (r189389) @@ -57,9 +57,9 @@ struct private_data { char eof; /* True = found end of compressed data. */ }; -/* Bzip2 source */ -static ssize_t bzip2_source_read(struct archive_read_source *, const void **); -static int bzip2_source_close(struct archive_read_source *); +/* Bzip2 filter */ +static ssize_t bzip2_filter_read(struct archive_read_filter *, const void **); +static int bzip2_filter_close(struct archive_read_filter *); #endif /* @@ -68,17 +68,15 @@ static int bzip2_source_close(struct arc * error messages.) So the bid framework here gets compiled even * if bzlib is unavailable. */ -static int bzip2_reader_bid(struct archive_reader *, const void *, size_t); -static struct archive_read_source *bzip2_reader_init(struct archive_read *, - struct archive_reader *, struct archive_read_source *, - const void *, size_t); -static int bzip2_reader_free(struct archive_reader *); +static int bzip2_reader_bid(struct archive_read_filter_bidder *, struct archive_read_filter *); +static int bzip2_reader_init(struct archive_read_filter *); +static int bzip2_reader_free(struct archive_read_filter_bidder *); int archive_read_support_compression_bzip2(struct archive *_a) { struct archive_read *a = (struct archive_read *)_a; - struct archive_reader *reader = __archive_read_get_reader(a); + struct archive_read_filter_bidder *reader = __archive_read_get_bidder(a); if (reader == NULL) return (ARCHIVE_FATAL); @@ -91,7 +89,7 @@ archive_read_support_compression_bzip2(s } static int -bzip2_reader_free(struct archive_reader *self){ +bzip2_reader_free(struct archive_read_filter_bidder *self){ (void)self; /* UNUSED */ return (ARCHIVE_OK); } @@ -104,61 +102,38 @@ bzip2_reader_free(struct archive_reader * from verifying as much as we would like. */ static int -bzip2_reader_bid(struct archive_reader *self, const void *buff, size_t len) +bzip2_reader_bid(struct archive_read_filter_bidder *self, struct archive_read_filter *filter) { const unsigned char *buffer; + size_t avail; int bits_checked; (void)self; /* UNUSED */ - if (len < 1) + /* Minimal bzip2 archive is 14 bytes. */ + buffer = __archive_read_filter_ahead(filter, 14, &avail); + if (buffer == NULL) return (0); - buffer = (const unsigned char *)buff; + /* First three bytes must be "BZh" */ bits_checked = 0; - if (buffer[0] != 'B') /* Verify first ID byte. */ + if (buffer[0] != 'B' || buffer[1] != 'Z' || buffer[2] != 'h') return (0); - bits_checked += 8; - if (len < 2) - return (bits_checked); - - if (buffer[1] != 'Z') /* Verify second ID byte. */ - return (0); - bits_checked += 8; - if (len < 3) - return (bits_checked); - - if (buffer[2] != 'h') /* Verify third ID byte. */ - return (0); - bits_checked += 8; - if (len < 4) - return (bits_checked); + bits_checked += 24; + /* Next follows a compression flag which must be an ASCII digit. */ if (buffer[3] < '1' || buffer[3] > '9') return (0); bits_checked += 5; - if (len < 5) - return (bits_checked); /* After BZh[1-9], there must be either a data block * which begins with 0x314159265359 or an end-of-data * marker of 0x177245385090. */ - - if (buffer[4] == 0x31) { - /* Verify the data block signature. */ - size_t s = len; - if (s > 10) s = 10; - if (memcmp(buffer + 4, "\x31\x41\x59\x26\x53\x59", s - 4) != 0) - return (0); - bits_checked += 8 * (s - 4); - } else if (buffer[4] == 0x17) { - /* Verify the end-of-data marker. */ - size_t s = len; - if (s > 10) s = 10; - if (memcmp(buffer + 4, "\x17\x72\x45\x38\x50\x90", s - 4) != 0) - return (0); - bits_checked += 8 * (s - 4); - } else + if (memcmp(buffer + 4, "\x31\x41\x59\x26\x53\x59", 6) == 0) + bits_checked += 48; + else if (memcmp(buffer + 4, "\x17\x72\x45\x38\x50\x90", 6) == 0) + bits_checked += 48; + else return (0); return (bits_checked); @@ -171,19 +146,13 @@ bzip2_reader_bid(struct archive_reader * * decompression. We can, however, still detect compressed archives * and emit a useful message. */ -static struct archive_read_source * -bzip2_reader_init(struct archive_read *a, struct archive_reader *reader, - struct archive_read_source *upstream, const void *buff, size_t n) +static int +bzip2_reader_init(struct archive_read_filter *self) { - (void)a; /* UNUSED */ - (void)reader; /* UNUSED */ - (void)upstream; /* UNUSED */ - (void)buff; /* UNUSED */ - (void)n; /* UNUSED */ - archive_set_error(&a->archive, -1, + archive_set_error(&self->archive->archive, -1, "This version of libarchive was compiled without bzip2 support"); - return (NULL); + return (ARCHIVE_FATAL); } @@ -192,67 +161,45 @@ bzip2_reader_init(struct archive_read *a /* * Setup the callbacks. */ -static struct archive_read_source * -bzip2_reader_init(struct archive_read *a, struct archive_reader *reader, - struct archive_read_source *upstream, const void *buff, size_t n) +static int +bzip2_reader_init(struct archive_read_filter *self) { static const size_t out_block_size = 64 * 1024; void *out_block; - struct archive_read_source *self; struct private_data *state; - (void)reader; /* UNUSED */ + self->code = ARCHIVE_COMPRESSION_BZIP2; + self->name = "bzip2"; - a->archive.compression_code = ARCHIVE_COMPRESSION_BZIP2; - a->archive.compression_name = "bzip2"; - - self = calloc(sizeof(*self), 1); state = (struct private_data *)calloc(sizeof(*state), 1); out_block = (unsigned char *)malloc(out_block_size); if (self == NULL || state == NULL || out_block == NULL) { - archive_set_error(&a->archive, ENOMEM, - "Can't allocate data for %s decompression", - a->archive.compression_name); + archive_set_error(&self->archive->archive, ENOMEM, + "Can't allocate data for bzip2 decompression"); free(out_block); free(state); - free(self); - return (NULL); + return (ARCHIVE_FATAL); } - - self->archive = a; self->data = state; state->out_block_size = out_block_size; state->out_block = out_block; - self->upstream = upstream; - self->read = bzip2_source_read; + self->read = bzip2_filter_read; self->skip = NULL; /* not supported */ - self->close = bzip2_source_close; - - /* - * A bug in bzlib.h: stream.next_in should be marked 'const' - * but isn't (the library never alters data through the *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@FreeBSD.ORG Thu Mar 5 02:37: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 750981065672; Thu, 5 Mar 2009 02:37:06 +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 61DD58FC1E; Thu, 5 Mar 2009 02:37:06 +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 n252b6CV060166; Thu, 5 Mar 2009 02:37:06 GMT (envelope-from kientzle@svn.freebsd.org) Received: (from kientzle@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n252b63N060164; Thu, 5 Mar 2009 02:37:06 GMT (envelope-from kientzle@svn.freebsd.org) Message-Id: <200903050237.n252b63N060164@svn.freebsd.org> From: Tim Kientzle Date: Thu, 5 Mar 2009 02:37: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: r189390 - in head/lib/libarchive: . 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: Thu, 05 Mar 2009 02:37:07 -0000 Author: kientzle Date: Thu Mar 5 02:37:05 2009 New Revision: 189390 URL: http://svn.freebsd.org/changeset/base/189390 Log: Merge r551,r561 from libarchive.googlecode.com: Update gzip read filter to fully take advantage of the new peek/consume I/O support. In particular, this now properly handles concatenated gzip streams. Modified: head/lib/libarchive/archive_read_support_compression_gzip.c head/lib/libarchive/test/test_compat_gzip.c Modified: head/lib/libarchive/archive_read_support_compression_gzip.c ============================================================================== --- head/lib/libarchive/archive_read_support_compression_gzip.c Thu Mar 5 02:19:42 2009 (r189389) +++ head/lib/libarchive/archive_read_support_compression_gzip.c Thu Mar 5 02:37:05 2009 (r189390) @@ -51,14 +51,11 @@ __FBSDID("$FreeBSD$"); #ifdef HAVE_ZLIB_H struct private_data { z_stream stream; + char in_stream; unsigned char *out_block; size_t out_block_size; int64_t total_out; unsigned long crc; - int header_count; - char header_done; - char header_state; - char header_flags; char eof; /* True = found end of compressed data. */ }; @@ -72,10 +69,14 @@ static int gzip_filter_close(struct arch * them. (In fact, we like detecting them because we can give better * error messages.) So the bid framework here gets compiled even * if zlib is unavailable. + * + * TODO: If zlib is unavailable, gzip_bidder_init() should + * use the compress_program framework to try to fire up an external + * gunzip program. */ -static int gzip_bidder_bid(struct archive_read_filter_bidder *, struct archive_read_filter *); +static int gzip_bidder_bid(struct archive_read_filter_bidder *, + struct archive_read_filter *); static int gzip_bidder_init(struct archive_read_filter *); -static int gzip_bidder_free(struct archive_read_filter_bidder *); int archive_read_support_compression_gzip(struct archive *_a) @@ -89,62 +90,116 @@ archive_read_support_compression_gzip(st bidder->data = NULL; bidder->bid = gzip_bidder_bid; bidder->init = gzip_bidder_init; - bidder->free = gzip_bidder_free; - return (ARCHIVE_OK); -} - -static int -gzip_bidder_free(struct archive_read_filter_bidder *self){ - (void)self; /* UNUSED */ + bidder->free = NULL; /* No data, so no cleanup necessary. */ return (ARCHIVE_OK); } /* - * Test whether we can handle this data. + * Read and verify the header. * - * This logic returns zero if any part of the signature fails. It - * also tries to Do The Right Thing if a very short buffer prevents us - * from verifying as much as we would like. + * Returns zero if the header couldn't be validated, else returns + * number of bytes in header. If pbits is non-NULL, it receives a + * count of bits verified, suitable for use by bidder. */ static int -gzip_bidder_bid(struct archive_read_filter_bidder *self, - struct archive_read_filter *filter) +peek_at_header(struct archive_read_filter *filter, int *pbits) { - const unsigned char *buffer; - size_t avail; - int bits_checked; - - (void)self; /* UNUSED */ - - buffer = __archive_read_filter_ahead(filter, 8, &avail); - if (buffer == NULL) + const unsigned char *p; + ssize_t avail, len; + int bits = 0; + int header_flags; + + /* Start by looking at the first ten bytes of the header, which + * is all fixed layout. */ + len = 10; + p = __archive_read_filter_ahead(filter, len, &avail); + if (p == NULL || avail == 0) return (0); - - bits_checked = 0; - if (buffer[0] != 037) /* Verify first ID byte. */ + if (p[0] != 037) return (0); - bits_checked += 8; - - if (buffer[1] != 0213) /* Verify second ID byte. */ + bits += 8; + if (p[1] != 0213) return (0); - bits_checked += 8; - - if (buffer[2] != 8) /* Compression must be 'deflate'. */ + bits += 8; + if (p[2] != 8) /* We only support deflation. */ return (0); - bits_checked += 8; + bits += 8; + if ((p[3] & 0xE0)!= 0) /* No reserved flags set. */ + return (0); + bits += 3; + header_flags = p[3]; + /* Bytes 4-7 are mod time. */ + /* Byte 8 is deflate flags. */ + /* XXXX TODO: return deflate flags back to consume_header for use + in initializing the decompressor. */ + /* Byte 9 is OS. */ + + /* Optional extra data: 2 byte length plus variable body. */ + if (header_flags & 4) { + p = __archive_read_filter_ahead(filter, len + 2, &avail); + if (p == NULL) + return (0); + len += ((int)p[len + 1] << 8) | (int)p[len]; + } - if ((buffer[3] & 0xE0)!= 0) /* No reserved flags set. */ + /* Null-terminated optional filename. */ + if (header_flags & 8) { + do { + ++len; + if (avail < len) + p = __archive_read_filter_ahead(filter, + len, &avail); + if (p == NULL) + return (0); + } while (p[len - 1] != 0); + } + + /* Null-terminated optional comment. */ + if (header_flags & 16) { + do { + ++len; + if (avail < len) + p = __archive_read_filter_ahead(filter, + len, &avail); + if (p == NULL) + return (0); + } while (p[len - 1] != 0); + } + + /* Optional header CRC */ + if ((header_flags & 2)) { + p = __archive_read_filter_ahead(filter, len + 2, &avail); + if (p == NULL) + return (0); +#if 0 + int hcrc = ((int)p[len + 1] << 8) | (int)p[len]; + int crc = /* XXX TODO: Compute header CRC. */; + if (crc != hcrc) return (0); - bits_checked += 3; + bits += 16; +#endif + len += 2; + } + + if (pbits != NULL) + *pbits = bits; + return (len); +} + +/* + * Bidder just verifies the header and returns the number of verified bits. + */ +static int +gzip_bidder_bid(struct archive_read_filter_bidder *self, + struct archive_read_filter *filter) +{ + int bits_checked; - /* - * TODO: Verify more; in particular, gzip has an optional - * header CRC, which would give us 16 more verified bits. We - * may also be able to verify certain constraints on other - * fields. - */ + (void)self; /* UNUSED */ - return (bits_checked); + if (peek_at_header(filter, &bits_checked)) + return (bits_checked); + return (0); } @@ -185,8 +240,7 @@ gzip_bidder_init(struct archive_read_fil free(out_block); free(state); archive_set_error(&self->archive->archive, ENOMEM, - "Can't allocate data for %s decompression", - self->name); + "Can't allocate data for gzip decompression"); return (ARCHIVE_FATAL); } @@ -197,148 +251,99 @@ gzip_bidder_init(struct archive_read_fil self->skip = NULL; /* not supported */ self->close = gzip_filter_close; - state->crc = crc32(0L, NULL, 0); - state->header_done = 0; /* We've not yet begun to parse header... */ + state->in_stream = 0; /* We're not actually within a stream yet. */ return (ARCHIVE_OK); } static int -header(struct archive_read_filter *self) +consume_header(struct archive_read_filter *self) { struct private_data *state; - int ret, b; + ssize_t avail; + size_t len; + int ret; state = (struct private_data *)self->data; - /* - * If still parsing the header, interpret the - * next byte. - */ - b = *(state->stream.next_in++); - state->stream.avail_in--; - - /* - * Simple state machine to parse the GZip header one byte at - * a time. If you see a way to make this easier to understand, - * please let me know. ;-) - */ - switch (state->header_state) { - case 0: /* First byte of signature. */ - /* We only return EOF for a failure here. */ - if (b != 037) - return (ARCHIVE_EOF); - state->header_state = 1; + /* If this is a real header, consume it. */ + len = peek_at_header(self->upstream, NULL); + if (len == 0) + return (ARCHIVE_EOF); + __archive_read_filter_consume(self->upstream, len); + + /* Initialize CRC accumulator. */ + state->crc = crc32(0L, NULL, 0); + + /* Initialize compression library. */ + state->stream.next_in = (unsigned char *)(uintptr_t) + __archive_read_filter_ahead(self->upstream, 1, &avail); + state->stream.avail_in = avail; + ret = inflateInit2(&(state->stream), + -15 /* Don't check for zlib header */); + + /* Decipher the error code. */ + switch (ret) { + case Z_OK: + state->in_stream = 1; + return (ARCHIVE_OK); + case Z_STREAM_ERROR: + archive_set_error(&self->archive->archive, + ARCHIVE_ERRNO_MISC, + "Internal error initializing compression library: " + "invalid setup parameter"); break; - case 1: /* Second byte of signature. */ - case 2: /* Compression type must be 8 == deflate. */ - if (b != (0xff & "\037\213\010"[(int)state->header_state])) { - archive_set_error(&self->archive->archive, - ARCHIVE_ERRNO_MISC, - "Invalid GZip header (saw %d at offset %d)", - b, state->header_state); - return (ARCHIVE_FATAL); - } - ++state->header_state; + case Z_MEM_ERROR: + archive_set_error(&self->archive->archive, ENOMEM, + "Internal error initializing compression library: " + "out of memory"); break; - case 3: /* GZip flags. */ - state->header_flags = b; - state->header_state = 4; + case Z_VERSION_ERROR: + archive_set_error(&self->archive->archive, + ARCHIVE_ERRNO_MISC, + "Internal error initializing compression library: " + "invalid library version"); break; - case 4: case 5: case 6: case 7: /* Mod time. */ - case 8: /* Deflate flags. */ - case 9: /* OS. */ - ++state->header_state; + default: + archive_set_error(&self->archive->archive, + ARCHIVE_ERRNO_MISC, + "Internal error initializing compression library: " + " Zlib error %d", ret); break; - case 10: /* Optional Extra: First byte of Length. */ - if ((state->header_flags & 4)) { - state->header_count = 255 & (int)b; - state->header_state = 11; - break; - } - /* Fall through if no Optional Extra field. */ - case 11: /* Optional Extra: Second byte of Length. */ - if ((state->header_flags & 4)) { - state->header_count - = (0xff00 & ((int)b << 8)) | state->header_count; - state->header_state = 12; - break; - } - /* Fall through if no Optional Extra field. */ - case 12: /* Optional Extra Field: counted length. */ - if ((state->header_flags & 4)) { - --state->header_count; - if (state->header_count == 0) state->header_state = 13; - else state->header_state = 12; - break; - } - /* Fall through if no Optional Extra field. */ - case 13: /* Optional Original Filename. */ - if ((state->header_flags & 8)) { - if (b == 0) state->header_state = 14; - else state->header_state = 13; - break; - } - /* Fall through if no Optional Original Filename. */ - case 14: /* Optional Comment. */ - if ((state->header_flags & 16)) { - if (b == 0) state->header_state = 15; - else state->header_state = 14; - break; - } - /* Fall through if no Optional Comment. */ - case 15: /* Optional Header CRC: First byte. */ - if ((state->header_flags & 2)) { - state->header_state = 16; - break; - } - /* Fall through if no Optional Header CRC. */ - case 16: /* Optional Header CRC: Second byte. */ - if ((state->header_flags & 2)) { - state->header_state = 17; - break; - } - /* Fall through if no Optional Header CRC. */ - case 17: /* First byte of compressed data. */ - state->header_done = 1; /* done with header */ - state->stream.avail_in++; /* Discard first byte. */ - state->stream.next_in--; - - /* Initialize compression library. */ - ret = inflateInit2(&(state->stream), - -15 /* Don't check for zlib header */); + } + return (ARCHIVE_FATAL); +} - /* Decipher the error code. */ - switch (ret) { - case Z_OK: - return (ARCHIVE_OK); - case Z_STREAM_ERROR: - archive_set_error(&self->archive->archive, - ARCHIVE_ERRNO_MISC, - "Internal error initializing compression library: " - "invalid setup parameter"); - break; - case Z_MEM_ERROR: - archive_set_error(&self->archive->archive, ENOMEM, - "Internal error initializing compression library: " - "out of memory"); - break; - case Z_VERSION_ERROR: - archive_set_error(&self->archive->archive, - ARCHIVE_ERRNO_MISC, - "Internal error initializing compression library: " - "invalid library version"); - break; - default: - archive_set_error(&self->archive->archive, - ARCHIVE_ERRNO_MISC, - "Internal error initializing compression library: " - " Zlib error %d", ret); - break; - } +static int +consume_trailer(struct archive_read_filter *self) +{ + struct private_data *state; + const unsigned char *p; + ssize_t avail; + + state = (struct private_data *)self->data; + + state->in_stream = 0; + switch (inflateEnd(&(state->stream))) { + case Z_OK: + break; + default: + archive_set_error(&self->archive->archive, + ARCHIVE_ERRNO_MISC, + "Failed to clean up gzip decompressor"); return (ARCHIVE_FATAL); } + /* GZip trailer is a fixed 8 byte structure. */ + p = __archive_read_filter_ahead(self->upstream, 8, &avail); + if (p == NULL || avail == 0) + return (ARCHIVE_FATAL); + + /* XXX TODO: Verify the length and CRC. */ + + /* We've verified the trailer, so consume it now. */ + __archive_read_filter_consume(self->upstream, 8); + return (ARCHIVE_OK); } @@ -346,12 +351,11 @@ static ssize_t gzip_filter_read(struct archive_read_filter *self, const void **p) { struct private_data *state; - size_t read_avail, decompressed; - const void *read_buf; + size_t decompressed; + ssize_t avail_in; int ret; state = (struct private_data *)self->data; - read_avail = 0; /* Empty our output buffer. */ state->stream.next_out = state->out_block; @@ -359,62 +363,47 @@ gzip_filter_read(struct archive_read_fil /* Try to fill the output buffer. */ while (state->stream.avail_out > 0 && !state->eof) { - /* If the last upstream block is done, get another one. */ - if (state->stream.avail_in == 0) { - read_buf = __archive_read_filter_ahead(self->upstream, - 1, &ret); - if (read_buf == NULL) - return (ARCHIVE_FATAL); - /* stream.next_in is really const, but zlib - * doesn't declare it so. */ - state->stream.next_in - = (unsigned char *)(uintptr_t)read_buf; - state->stream.avail_in = ret; - /* There is no more data, return whatever we have. */ - if (ret == 0) { + /* If we're not in a stream, read a header + * and initialize the decompression library. */ + if (!state->in_stream) { + ret = consume_header(self); + if (ret == ARCHIVE_EOF) { state->eof = 1; break; } - __archive_read_filter_consume(self->upstream, ret); - } - - /* If we're still parsing header bytes, walk through those. */ - if (!state->header_done) { - ret = header(self); if (ret < ARCHIVE_OK) return (ret); - if (ret == ARCHIVE_EOF) - state->eof = 1; - } else { - /* Decompress as much as we can in one pass. */ - /* XXX Skip trailer XXX */ - ret = inflate(&(state->stream), 0); - switch (ret) { - case Z_STREAM_END: /* Found end of stream. */ - switch (inflateEnd(&(state->stream))) { - case Z_OK: - break; - default: - archive_set_error(&self->archive->archive, - ARCHIVE_ERRNO_MISC, - "Failed to clean up gzip decompressor"); - return (ARCHIVE_FATAL); - } - /* zlib has been torn down */ - state->header_done = 0; - state->eof = 1; - /* FALL THROUGH */ - case Z_OK: /* Decompressor made some progress. */ - /* If we filled our buffer, update stats and return. */ - break; - default: - /* Return an error. */ - archive_set_error(&self->archive->archive, - ARCHIVE_ERRNO_MISC, - "%s decompression failed", - self->archive->archive.compression_name); - return (ARCHIVE_FATAL); - } + } + + /* Peek at the next available data. */ + /* ZLib treats stream.next_in as const but doesn't declare + * it so, hence this ugly cast. */ + state->stream.next_in = (unsigned char *)(uintptr_t) + __archive_read_filter_ahead(self->upstream, 1, &avail_in); + if (state->stream.next_in == NULL) + return (ARCHIVE_FATAL); + state->stream.avail_in = avail_in; + + /* Decompress and consume some of that data. */ + ret = inflate(&(state->stream), 0); + switch (ret) { + case Z_OK: /* Decompressor made some progress. */ + __archive_read_filter_consume(self->upstream, + avail_in - state->stream.avail_in); + break; + case Z_STREAM_END: /* Found end of stream. */ + __archive_read_filter_consume(self->upstream, + avail_in - state->stream.avail_in); + /* Consume the stream trailer; release the + * decompression library. */ + ret = consume_trailer(self); + break; + default: + /* Return an error. */ + archive_set_error(&self->archive->archive, + ARCHIVE_ERRNO_MISC, + "gzip decompression failed"); + return (ARCHIVE_FATAL); } } @@ -426,7 +415,6 @@ gzip_filter_read(struct archive_read_fil else *p = state->out_block; return (decompressed); - } /* @@ -441,15 +429,14 @@ gzip_filter_close(struct archive_read_fi state = (struct private_data *)self->data; ret = ARCHIVE_OK; - if (state->header_done) { + if (state->in_stream) { switch (inflateEnd(&(state->stream))) { case Z_OK: break; default: archive_set_error(&(self->archive->archive), - ARCHIVE_ERRNO_MISC, - "Failed to clean up %s compressor", - self->archive->archive.compression_name); + ARCHIVE_ERRNO_MISC, + "Failed to clean up gzip compressor"); ret = ARCHIVE_FATAL; } } Modified: head/lib/libarchive/test/test_compat_gzip.c ============================================================================== --- head/lib/libarchive/test/test_compat_gzip.c Thu Mar 5 02:19:42 2009 (r189389) +++ head/lib/libarchive/test/test_compat_gzip.c Thu Mar 5 02:37:05 2009 (r189390) @@ -86,7 +86,7 @@ DEFINE_TEST(test_compat_gzip) /* This sample has been 'split', each piece compressed separately, * then concatenated. Gunzip will emit the concatenated result. */ /* Not supported in libarchive 2.6 and earlier */ - /* verify("test_compat_gzip_1.tgz"); */ + verify("test_compat_gzip_1.tgz"); /* This sample has been compressed as a single stream, but then * some unrelated garbage text has been appended to the end. */ verify("test_compat_gzip_2.tgz"); From owner-svn-src-head@FreeBSD.ORG Thu Mar 5 02:43: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 354A0106567D; Thu, 5 Mar 2009 02:43:48 +0000 (UTC) (envelope-from imp@bsdimp.com) Received: from harmony.bsdimp.com (bsdimp.com [199.45.160.85]) by mx1.freebsd.org (Postfix) with ESMTP id E305E8FC26; Thu, 5 Mar 2009 02:43:47 +0000 (UTC) (envelope-from imp@bsdimp.com) Received: from localhost (localhost [127.0.0.1]) by harmony.bsdimp.com (8.14.2/8.14.1) with ESMTP id n252feYN093986; Wed, 4 Mar 2009 19:41:41 -0700 (MST) (envelope-from imp@bsdimp.com) Date: Wed, 04 Mar 2009 19:41:58 -0700 (MST) Message-Id: <20090304.194158.1159134197.imp@bsdimp.com> To: rnoland@freebsd.org From: "M. Warner Losh" In-Reply-To: <1236218572.1384.19.camel@widget.2hip.net> References: <200903041823.n24INmcc049524@svn.freebsd.org> <20090304.135606.1649768480.imp@bsdimp.com> <1236218572.1384.19.camel@widget.2hip.net> X-Mailer: Mew version 5.2 on Emacs 21.3 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r189367 - head/sys/dev/pci 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, 05 Mar 2009 02:43:49 -0000 In message: <1236218572.1384.19.camel@widget.2hip.net> Robert Noland writes: : On Wed, 2009-03-04 at 13:56 -0700, M. Warner Losh wrote: : > In message: <200903041823.n24INmcc049524@svn.freebsd.org> : > Robert Noland writes: : > : Author: rnoland : > : Date: Wed Mar 4 18:23:48 2009 : > : New Revision: 189367 : > : URL: http://svn.freebsd.org/changeset/base/189367 : > : : > : Log: : > : Extend the management of PCIM_CMD_INTxDIS. : > : : > : We now explicitly enable INTx during bus_setup_intr() if it is needed. : > : Several of the ata drivers were managing this bit internally. This is : > : better handled in pci and it should work for all drivers now. : > : : > : We also mask INTx during bus_teardown_intr() by setting this bit. : > : : > : Reviewed by: jhb : > : MFC after: 3 days : > : > Note: the INTxDIS bit is new in PCI 3.0, and has no effect on earlier : > devices. This should be highlighted in the comments somewhere... : : It is documented in 2.3 as well, I'm not sure about previous versions of : the spec though. It isn't in 2.2, and even after 2.3 it is "optional". Warner From owner-svn-src-head@FreeBSD.ORG Thu Mar 5 03:43: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 B471E1065672; Thu, 5 Mar 2009 03:43:59 +0000 (UTC) (envelope-from rnoland@FreeBSD.org) Received: from gizmo.2hip.net (gizmo.2hip.net [64.74.207.195]) by mx1.freebsd.org (Postfix) with ESMTP id 5CAA48FC1B; Thu, 5 Mar 2009 03:43:59 +0000 (UTC) (envelope-from rnoland@FreeBSD.org) Received: from [192.168.1.2] (adsl-154-199-160.ard.bellsouth.net [72.154.199.160]) (authenticated bits=0) by gizmo.2hip.net (8.14.3/8.14.3) with ESMTP id n253gaE2069589 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Wed, 4 Mar 2009 22:42:36 -0500 (EST) (envelope-from rnoland@FreeBSD.org) From: Robert Noland To: "M. Warner Losh" In-Reply-To: <20090304.194158.1159134197.imp@bsdimp.com> References: <200903041823.n24INmcc049524@svn.freebsd.org> <20090304.135606.1649768480.imp@bsdimp.com> <1236218572.1384.19.camel@widget.2hip.net> <20090304.194158.1159134197.imp@bsdimp.com> Content-Type: multipart/signed; micalg="pgp-sha1"; protocol="application/pgp-signature"; boundary="=-S/RAOrr6zvYInzWMUC7w" Organization: FreeBSD Date: Wed, 04 Mar 2009 21:43:49 -0600 Message-Id: <1236224629.1384.22.camel@widget.2hip.net> Mime-Version: 1.0 X-Mailer: Evolution 2.24.4 FreeBSD GNOME Team Port X-Spam-Status: No, score=-1.6 required=5.0 tests=AWL,BAYES_00,RCVD_IN_PBL, RCVD_IN_SORBS_DUL,RDNS_DYNAMIC autolearn=no version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on gizmo.2hip.net Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r189367 - head/sys/dev/pci 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, 05 Mar 2009 03:44:00 -0000 --=-S/RAOrr6zvYInzWMUC7w Content-Type: text/plain Content-Transfer-Encoding: quoted-printable On Wed, 2009-03-04 at 19:41 -0700, M. Warner Losh wrote: > In message: <1236218572.1384.19.camel@widget.2hip.net> > Robert Noland writes: > : On Wed, 2009-03-04 at 13:56 -0700, M. Warner Losh wrote: > : > In message: <200903041823.n24INmcc049524@svn.freebsd.org> > : > Robert Noland writes: > : > : Author: rnoland > : > : Date: Wed Mar 4 18:23:48 2009 > : > : New Revision: 189367 > : > : URL: http://svn.freebsd.org/changeset/base/189367 > : > :=20 > : > : Log: > : > : Extend the management of PCIM_CMD_INTxDIS. > : > : =20 > : > : We now explicitly enable INTx during bus_setup_intr() if it is ne= eded. > : > : Several of the ata drivers were managing this bit internally. Th= is is > : > : better handled in pci and it should work for all drivers now. > : > : =20 > : > : We also mask INTx during bus_teardown_intr() by setting this bit. > : > : =20 > : > : Reviewed by: jhb > : > : MFC after: 3 days > : >=20 > : > Note: the INTxDIS bit is new in PCI 3.0, and has no effect on earlier > : > devices. This should be highlighted in the comments somewhere... > :=20 > : It is documented in 2.3 as well, I'm not sure about previous versions o= f > : the spec though. >=20 > It isn't in 2.2, and even after 2.3 it is "optional". The bit should be unused if it isn't supported by a given piece of hardware. If it doesn't do anything, we are no worse off than before. I don't think this will cause any harm, only goodness when it is supported. robert. > Warner --=20 Robert Noland FreeBSD --=-S/RAOrr6zvYInzWMUC7w Content-Type: application/pgp-signature; name="signature.asc" Content-Description: This is a digitally signed message part -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.10 (FreeBSD) iEYEABECAAYFAkmvSnUACgkQM4TrQ4qfRONodgCfXG9uEeviU8kvytHg8tIQLns3 Nn4AniorNYMTQFFuGeoxK2N4/iGz+pwJ =QsuV -----END PGP SIGNATURE----- --=-S/RAOrr6zvYInzWMUC7w-- From owner-svn-src-head@FreeBSD.ORG Thu Mar 5 04:04: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 F3FE6106564A; Thu, 5 Mar 2009 04:04:03 +0000 (UTC) (envelope-from imp@bsdimp.com) Received: from harmony.bsdimp.com (bsdimp.com [199.45.160.85]) by mx1.freebsd.org (Postfix) with ESMTP id ABFB98FC18; Thu, 5 Mar 2009 04:04:03 +0000 (UTC) (envelope-from imp@bsdimp.com) Received: from localhost (localhost [127.0.0.1]) by harmony.bsdimp.com (8.14.2/8.14.1) with ESMTP id n25434Sw095653; Wed, 4 Mar 2009 21:03:04 -0700 (MST) (envelope-from imp@bsdimp.com) Date: Wed, 04 Mar 2009 21:03:22 -0700 (MST) Message-Id: <20090304.210322.1353606728.imp@bsdimp.com> To: rnoland@FreeBSD.org From: "M. Warner Losh" In-Reply-To: <1236224629.1384.22.camel@widget.2hip.net> References: <1236218572.1384.19.camel@widget.2hip.net> <20090304.194158.1159134197.imp@bsdimp.com> <1236224629.1384.22.camel@widget.2hip.net> X-Mailer: Mew version 5.2 on Emacs 21.3 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org Subject: Re: svn commit: r189367 - head/sys/dev/pci 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, 05 Mar 2009 04:04:04 -0000 In message: <1236224629.1384.22.camel@widget.2hip.net> Robert Noland writes: : On Wed, 2009-03-04 at 19:41 -0700, M. Warner Losh wrote: : > In message: <1236218572.1384.19.camel@widget.2hip.net> : > Robert Noland writes: : > : On Wed, 2009-03-04 at 13:56 -0700, M. Warner Losh wrote: : > : > In message: <200903041823.n24INmcc049524@svn.freebsd.org> : > : > Robert Noland writes: : > : > : Author: rnoland : > : > : Date: Wed Mar 4 18:23:48 2009 : > : > : New Revision: 189367 : > : > : URL: http://svn.freebsd.org/changeset/base/189367 : > : > : : > : > : Log: : > : > : Extend the management of PCIM_CMD_INTxDIS. : > : > : : > : > : We now explicitly enable INTx during bus_setup_intr() if it is needed. : > : > : Several of the ata drivers were managing this bit internally. This is : > : > : better handled in pci and it should work for all drivers now. : > : > : : > : > : We also mask INTx during bus_teardown_intr() by setting this bit. : > : > : : > : > : Reviewed by: jhb : > : > : MFC after: 3 days : > : > : > : > Note: the INTxDIS bit is new in PCI 3.0, and has no effect on earlier : > : > devices. This should be highlighted in the comments somewhere... : > : : > : It is documented in 2.3 as well, I'm not sure about previous versions of : > : the spec though. : > : > It isn't in 2.2, and even after 2.3 it is "optional". : : The bit should be unused if it isn't supported by a given piece of : hardware. If it doesn't do anything, we are no worse off than before. : I don't think this will cause any harm, only goodness when it is : supported. Yes. I agree. This is just the sort of bit, however, that people looking for an interrupt storm would latch on to as being just the ticket... Which is why I suggested a comment... Warner From owner-svn-src-head@FreeBSD.ORG Thu Mar 5 05:31:07 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 E8229106566C; Thu, 5 Mar 2009 05:31:07 +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 78D938FC12; Thu, 5 Mar 2009 05:31:07 +0000 (UTC) (envelope-from scottl@samsco.org) Received: from phobos.local ([192.168.254.200]) (authenticated bits=0) by pooker.samsco.org (8.14.2/8.14.2) with ESMTP id n255Uxrb092131; Wed, 4 Mar 2009 22:30:59 -0700 (MST) (envelope-from scottl@samsco.org) Message-ID: <49AF6393.6060402@samsco.org> Date: Wed, 04 Mar 2009 22:30:59 -0700 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: "M. Warner Losh" References: <1236218572.1384.19.camel@widget.2hip.net> <20090304.194158.1159134197.imp@bsdimp.com> <1236224629.1384.22.camel@widget.2hip.net> <20090304.210322.1353606728.imp@bsdimp.com> In-Reply-To: <20090304.210322.1353606728.imp@bsdimp.com> 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, rnoland@FreeBSD.org Subject: Re: svn commit: r189367 - head/sys/dev/pci 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, 05 Mar 2009 05:31:08 -0000 M. Warner Losh wrote: > In message: <1236224629.1384.22.camel@widget.2hip.net> > Robert Noland writes: > : On Wed, 2009-03-04 at 19:41 -0700, M. Warner Losh wrote: > : > In message: <1236218572.1384.19.camel@widget.2hip.net> > : > Robert Noland writes: > : > : On Wed, 2009-03-04 at 13:56 -0700, M. Warner Losh wrote: > : > : > In message: <200903041823.n24INmcc049524@svn.freebsd.org> > : > : > Robert Noland writes: > : > : > : Author: rnoland > : > : > : Date: Wed Mar 4 18:23:48 2009 > : > : > : New Revision: 189367 > : > : > : URL: http://svn.freebsd.org/changeset/base/189367 > : > : > : > : > : > : Log: > : > : > : Extend the management of PCIM_CMD_INTxDIS. > : > : > : > : > : > : We now explicitly enable INTx during bus_setup_intr() if it is needed. > : > : > : Several of the ata drivers were managing this bit internally. This is > : > : > : better handled in pci and it should work for all drivers now. > : > : > : > : > : > : We also mask INTx during bus_teardown_intr() by setting this bit. > : > : > : > : > : > : Reviewed by: jhb > : > : > : MFC after: 3 days > : > : > > : > : > Note: the INTxDIS bit is new in PCI 3.0, and has no effect on earlier > : > : > devices. This should be highlighted in the comments somewhere... > : > : > : > : It is documented in 2.3 as well, I'm not sure about previous versions of > : > : the spec though. > : > > : > It isn't in 2.2, and even after 2.3 it is "optional". > : > : The bit should be unused if it isn't supported by a given piece of > : hardware. If it doesn't do anything, we are no worse off than before. > : I don't think this will cause any harm, only goodness when it is > : supported. > > Yes. I agree. This is just the sort of bit, however, that people > looking for an interrupt storm would latch on to as being just the > ticket... Which is why I suggested a comment... Well, the other risk is that devices that claim strict PCI 2.0, 2.1, or 2.2 compatibility might treat this bit as "undefined" and thus eligible for a SERR condition, or even reassign it for proprietary use. I think that this risk is small, but non-zero. I think that as long as we only manipulate this bit in conjunction with MSI, we should be fine. But yes, it must be stressed that this bit is not some magical cure-all for interrupt storms, nor is it an appropriate mechanism for handling arbitrary interrupts in an interrupt handler. Scott From owner-svn-src-head@FreeBSD.ORG Thu Mar 5 06:26: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 E01CD106566B; Thu, 5 Mar 2009 06:26:08 +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 C2F398FC18; Thu, 5 Mar 2009 06:26:08 +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 n256Q8b9065011; Thu, 5 Mar 2009 06:26:08 GMT (envelope-from kientzle@svn.freebsd.org) Received: (from kientzle@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n256Q8U2065008; Thu, 5 Mar 2009 06:26:08 GMT (envelope-from kientzle@svn.freebsd.org) Message-Id: <200903050626.n256Q8U2065008@svn.freebsd.org> From: Tim Kientzle Date: Thu, 5 Mar 2009 06:26: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: r189392 - head/lib/libarchive 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, 05 Mar 2009 06:26:09 -0000 Author: kientzle Date: Thu Mar 5 06:26:08 2009 New Revision: 189392 URL: http://svn.freebsd.org/changeset/base/189392 Log: Argh. r189389 was supposed to include r539 from libarchive.googlecode.com but those compile fixes somehow got lost. This should fix the build. Modified: head/lib/libarchive/archive_read_support_compression_bzip2.c head/lib/libarchive/archive_read_support_compression_compress.c head/lib/libarchive/archive_read_support_format_cpio.c Modified: head/lib/libarchive/archive_read_support_compression_bzip2.c ============================================================================== --- head/lib/libarchive/archive_read_support_compression_bzip2.c Thu Mar 5 03:18:22 2009 (r189391) +++ head/lib/libarchive/archive_read_support_compression_bzip2.c Thu Mar 5 06:26:08 2009 (r189392) @@ -105,7 +105,7 @@ static int bzip2_reader_bid(struct archive_read_filter_bidder *self, struct archive_read_filter *filter) { const unsigned char *buffer; - size_t avail; + ssize_t avail; int bits_checked; (void)self; /* UNUSED */ @@ -200,7 +200,7 @@ bzip2_filter_read(struct archive_read_fi struct private_data *state; size_t read_avail, decompressed; unsigned char *read_buf; - int ret; + ssize_t ret; state = (struct private_data *)self->data; read_avail = 0; Modified: head/lib/libarchive/archive_read_support_compression_compress.c ============================================================================== --- head/lib/libarchive/archive_read_support_compression_compress.c Thu Mar 5 03:18:22 2009 (r189391) +++ head/lib/libarchive/archive_read_support_compression_compress.c Thu Mar 5 06:26:08 2009 (r189392) @@ -168,7 +168,7 @@ compress_bidder_bid(struct archive_read_ struct archive_read_filter *filter) { const unsigned char *buffer; - size_t avail; + ssize_t avail; int bits_checked; (void)self; /* UNUSED */ @@ -410,7 +410,8 @@ static int getbits(struct archive_read_filter *self, int n) { struct private_data *state = (struct private_data *)self->data; - int code, ret; + int code; + ssize_t ret; static const int mask[] = { 0x00, 0x01, 0x03, 0x07, 0x0f, 0x1f, 0x3f, 0x7f, 0xff, 0x1ff, 0x3ff, 0x7ff, 0xfff, 0x1fff, 0x3fff, 0x7fff, 0xffff Modified: head/lib/libarchive/archive_read_support_format_cpio.c ============================================================================== --- head/lib/libarchive/archive_read_support_format_cpio.c Thu Mar 5 03:18:22 2009 (r189391) +++ head/lib/libarchive/archive_read_support_format_cpio.c Thu Mar 5 06:26:08 2009 (r189392) @@ -329,7 +329,8 @@ find_newc_header(struct archive_read *a) { const void *h; const char *p, *q; - size_t skip, bytes, skipped = 0; + size_t skip, skipped = 0; + ssize_t bytes; for (;;) { h = __archive_read_ahead(a, sizeof(struct cpio_newc_header), &bytes); @@ -463,7 +464,8 @@ find_odc_header(struct archive_read *a) { const void *h; const char *p, *q; - size_t skip, bytes, skipped = 0; + size_t skip, skipped = 0; + ssize_t bytes; for (;;) { h = __archive_read_ahead(a, sizeof(struct cpio_odc_header), &bytes); From owner-svn-src-head@FreeBSD.ORG Thu Mar 5 07:26:39 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 B10641065670; Thu, 5 Mar 2009 07:26:39 +0000 (UTC) (envelope-from rnoland@FreeBSD.org) Received: from gizmo.2hip.net (gizmo.2hip.net [64.74.207.195]) by mx1.freebsd.org (Postfix) with ESMTP id 72ADA8FC1C; Thu, 5 Mar 2009 07:26:39 +0000 (UTC) (envelope-from rnoland@FreeBSD.org) Received: from [192.168.1.2] (adsl-154-199-160.ard.bellsouth.net [72.154.199.160]) (authenticated bits=0) by gizmo.2hip.net (8.14.3/8.14.3) with ESMTP id n257PFJ9070575 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Thu, 5 Mar 2009 02:25:16 -0500 (EST) (envelope-from rnoland@FreeBSD.org) From: Robert Noland To: Scott Long In-Reply-To: <49AF6393.6060402@samsco.org> References: <1236218572.1384.19.camel@widget.2hip.net> <20090304.194158.1159134197.imp@bsdimp.com> <1236224629.1384.22.camel@widget.2hip.net> <20090304.210322.1353606728.imp@bsdimp.com> <49AF6393.6060402@samsco.org> Content-Type: multipart/signed; micalg="pgp-sha1"; protocol="application/pgp-signature"; boundary="=-Twpvwl4HYjM/MkyK6pdr" Organization: FreeBSD Date: Thu, 05 Mar 2009 01:26:29 -0600 Message-Id: <1236237989.1384.34.camel@widget.2hip.net> Mime-Version: 1.0 X-Mailer: Evolution 2.24.4 FreeBSD GNOME Team Port X-Spam-Status: No, score=-1.6 required=5.0 tests=AWL,BAYES_00,RCVD_IN_PBL, RCVD_IN_SORBS_DUL,RDNS_DYNAMIC autolearn=no version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on gizmo.2hip.net Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org, "M. Warner Losh" Subject: Re: svn commit: r189367 - head/sys/dev/pci 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, 05 Mar 2009 07:26:40 -0000 --=-Twpvwl4HYjM/MkyK6pdr Content-Type: text/plain Content-Transfer-Encoding: quoted-printable On Wed, 2009-03-04 at 22:30 -0700, Scott Long wrote: > M. Warner Losh wrote: > > In message: <1236224629.1384.22.camel@widget.2hip.net> > > Robert Noland writes: > > : On Wed, 2009-03-04 at 19:41 -0700, M. Warner Losh wrote: > > : > In message: <1236218572.1384.19.camel@widget.2hip.net> > > : > Robert Noland writes: > > : > : On Wed, 2009-03-04 at 13:56 -0700, M. Warner Losh wrote: > > : > : > In message: <200903041823.n24INmcc049524@svn.freebsd.org> > > : > : > Robert Noland writes: > > : > : > : Author: rnoland > > : > : > : Date: Wed Mar 4 18:23:48 2009 > > : > : > : New Revision: 189367 > > : > : > : URL: http://svn.freebsd.org/changeset/base/189367 > > : > : > :=20 > > : > : > : Log: > > : > : > : Extend the management of PCIM_CMD_INTxDIS. > > : > : > : =20 > > : > : > : We now explicitly enable INTx during bus_setup_intr() if it= is needed. > > : > : > : Several of the ata drivers were managing this bit internall= y. This is > > : > : > : better handled in pci and it should work for all drivers no= w. > > : > : > : =20 > > : > : > : We also mask INTx during bus_teardown_intr() by setting thi= s bit. > > : > : > : =20 > > : > : > : Reviewed by: jhb > > : > : > : MFC after: 3 days > > : > : >=20 > > : > : > Note: the INTxDIS bit is new in PCI 3.0, and has no effect on e= arlier > > : > : > devices. This should be highlighted in the comments somewhere.= .. > > : > :=20 > > : > : It is documented in 2.3 as well, I'm not sure about previous vers= ions of > > : > : the spec though. > > : >=20 > > : > It isn't in 2.2, and even after 2.3 it is "optional". > > :=20 > > : The bit should be unused if it isn't supported by a given piece of > > : hardware. If it doesn't do anything, we are no worse off than before= . > > : I don't think this will cause any harm, only goodness when it is > > : supported. > >=20 > > Yes. I agree. This is just the sort of bit, however, that people > > looking for an interrupt storm would latch on to as being just the > > ticket... Which is why I suggested a comment... >=20 > Well, the other risk is that devices that claim strict PCI 2.0, 2.1, or > 2.2 compatibility might treat this bit as "undefined" and thus eligible > for a SERR condition, or even reassign it for proprietary use. I think > that this risk is small, but non-zero. I think that as long as we only > manipulate this bit in conjunction with MSI, we should be fine. But > yes, it must be stressed that this bit is not some magical cure-all for > interrupt storms, nor is it an appropriate mechanism for handling > arbitrary interrupts in an interrupt handler. I'm happy to add a comment, I'm just not certain what that comment should be. I don't find where it is marked as optional in the 2.3 spec, though I do find the part about interrupt pins being optional... robert. > Scott --=20 Robert Noland FreeBSD --=-Twpvwl4HYjM/MkyK6pdr Content-Type: application/pgp-signature; name="signature.asc" Content-Description: This is a digitally signed message part -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.10 (FreeBSD) iEYEABECAAYFAkmvfqUACgkQM4TrQ4qfROPRRACghysoqwMzVHuQ6u5uwcOZIr1h ZFwAn2j+Ok2bJhxbziKRGoW5TpEQUC9P =SFlt -----END PGP SIGNATURE----- --=-Twpvwl4HYjM/MkyK6pdr-- From owner-svn-src-head@FreeBSD.ORG Thu Mar 5 08:01:20 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 24FEE1065675; Thu, 5 Mar 2009 08:01:20 +0000 (UTC) (envelope-from luigi@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id EDB078FC08; Thu, 5 Mar 2009 08:01:19 +0000 (UTC) (envelope-from luigi@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 n2581JJR066775; Thu, 5 Mar 2009 08:01:19 GMT (envelope-from luigi@svn.freebsd.org) Received: (from luigi@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n2581J9u066774; Thu, 5 Mar 2009 08:01:19 GMT (envelope-from luigi@svn.freebsd.org) Message-Id: <200903050801.n2581J9u066774@svn.freebsd.org> From: Luigi Rizzo Date: Thu, 5 Mar 2009 08:01: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: r189394 - head/sbin/ipfw X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 05 Mar 2009 08:01:20 -0000 Author: luigi Date: Thu Mar 5 08:01:19 2009 New Revision: 189394 URL: http://svn.freebsd.org/changeset/base/189394 Log: mark a function static, as it is Modified: head/sbin/ipfw/altq.c Modified: head/sbin/ipfw/altq.c ============================================================================== --- head/sbin/ipfw/altq.c Thu Mar 5 07:42:47 2009 (r189393) +++ head/sbin/ipfw/altq.c Thu Mar 5 08:01:19 2009 (r189394) @@ -121,7 +121,7 @@ altq_name_to_qid(const char *name) return altq->qid; } -const char * +static const char * altq_qid_to_name(u_int32_t qid) { struct pf_altq *altq; From owner-svn-src-head@FreeBSD.ORG Thu Mar 5 08:01: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 1CAFA106568F; Thu, 5 Mar 2009 08:01:59 +0000 (UTC) (envelope-from luigi@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 0B1BC8FC14; Thu, 5 Mar 2009 08:01:59 +0000 (UTC) (envelope-from luigi@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 n2581whH066870; Thu, 5 Mar 2009 08:01:58 GMT (envelope-from luigi@svn.freebsd.org) Received: (from luigi@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n2581wU6066869; Thu, 5 Mar 2009 08:01:58 GMT (envelope-from luigi@svn.freebsd.org) Message-Id: <200903050801.n2581wU6066869@svn.freebsd.org> From: Luigi Rizzo Date: Thu, 5 Mar 2009 08:01:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r189395 - head/sbin/ipfw X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 05 Mar 2009 08:02:00 -0000 Author: luigi Date: Thu Mar 5 08:01:58 2009 New Revision: 189395 URL: http://svn.freebsd.org/changeset/base/189395 Log: remove some signed/unsigned and one const/!const warning Modified: head/sbin/ipfw/nat.c Modified: head/sbin/ipfw/nat.c ============================================================================== --- head/sbin/ipfw/nat.c Thu Mar 5 08:01:19 2009 (r189394) +++ head/sbin/ipfw/nat.c Thu Mar 5 08:01:58 2009 (r189395) @@ -319,7 +319,7 @@ StrToAddrAndPortRange (const char* str, */ static int -setup_redir_addr(char *spool_buf, int len, +setup_redir_addr(char *spool_buf, unsigned int len, int *_ac, char ***_av) { char **av, *sep; /* Token separator. */ @@ -384,7 +384,7 @@ nospace: } static int -setup_redir_port(char *spool_buf, int len, +setup_redir_port(char *spool_buf, unsigned int len, int *_ac, char ***_av) { char **av, *sep, *protoName; @@ -575,7 +575,7 @@ nospace: } static int -setup_redir_proto(char *spool_buf, int len, +setup_redir_proto(char *spool_buf, unsigned int len, int *_ac, char ***_av) { char **av; @@ -858,8 +858,8 @@ ipfw_config_nat(int ac, char **av) if (!co.do_quiet) { /* After every modification, we show the resultant rule. */ int _ac = 3; - char *_av[] = {"show", "config", id}; - ipfw_show_nat(_ac, _av); + const char *_av[] = {"show", "config", id}; + ipfw_show_nat(_ac, (char **)(void *)_av); } } From owner-svn-src-head@FreeBSD.ORG Thu Mar 5 08:08: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 D33021065675; Thu, 5 Mar 2009 08:08:09 +0000 (UTC) (envelope-from luigi@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C221D8FC1C; Thu, 5 Mar 2009 08:08:09 +0000 (UTC) (envelope-from luigi@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 n25889xU067031; Thu, 5 Mar 2009 08:08:09 GMT (envelope-from luigi@svn.freebsd.org) Received: (from luigi@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n25889QH067030; Thu, 5 Mar 2009 08:08:09 GMT (envelope-from luigi@svn.freebsd.org) Message-Id: <200903050808.n25889QH067030@svn.freebsd.org> From: Luigi Rizzo Date: Thu, 5 Mar 2009 08:08: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: r189396 - head/sbin/ipfw X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 05 Mar 2009 08:08:10 -0000 Author: luigi Date: Thu Mar 5 08:08:09 2009 New Revision: 189396 URL: http://svn.freebsd.org/changeset/base/189396 Log: move a variable declaration to the beginning of the block (unfortunately, it is far away; we need to pack this code in a better way). Modified: head/sbin/ipfw/main.c Modified: head/sbin/ipfw/main.c ============================================================================== --- head/sbin/ipfw/main.c Thu Mar 5 08:01:58 2009 (r189395) +++ head/sbin/ipfw/main.c Thu Mar 5 08:08:09 2009 (r189396) @@ -104,6 +104,7 @@ ipfw_main(int oldac, char **oldav) const char *errstr; char **av, **save_av; int do_acct = 0; /* Show packet/byte count */ + int try_next = 0; /* set if pipe cmd not found */ #define WHITESP " \t\f\v\n\r" if (oldac < 2) @@ -332,7 +333,6 @@ ipfw_main(int oldac, char **oldav) av[1] = p; } - int try_next = 0; if (co.use_set == 0) { if (_substrcmp(*av, "add") == 0) ipfw_add(ac, av); From owner-svn-src-head@FreeBSD.ORG Thu Mar 5 08:57: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 4B089106566C; Thu, 5 Mar 2009 08:57:36 +0000 (UTC) (envelope-from rodrigc@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 392408FC16; Thu, 5 Mar 2009 08:57:36 +0000 (UTC) (envelope-from rodrigc@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 n258vage067923; Thu, 5 Mar 2009 08:57:36 GMT (envelope-from rodrigc@svn.freebsd.org) Received: (from rodrigc@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n258vajL067921; Thu, 5 Mar 2009 08:57:36 GMT (envelope-from rodrigc@svn.freebsd.org) Message-Id: <200903050857.n258vajL067921@svn.freebsd.org> From: Craig Rodrigues Date: Thu, 5 Mar 2009 08:57:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r189397 - head/sbin/mount 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, 05 Mar 2009 08:57:36 -0000 Author: rodrigc Date: Thu Mar 5 08:57:35 2009 New Revision: 189397 URL: http://svn.freebsd.org/changeset/base/189397 Log: Add a -o mountprog parameter to mount which explicitly allows an alternative program to be used for mounting a file system. Ideally, all file systems should be converted to pass string arguments to nmount(), so that /sbin/mount can handle them. However, certain file systems such as FUSE have not done this, and want to have their own userland mount programs. For example, to mount an NTFS file system with the FUSE NTFS driver: mount -t ntfs -o mountprog=/usr/local/bin/ntfs-3g /dev/acd0 /mnt or via an fstab entry: /dev/acd0 /mnt ntfs ro,noauto,mountprog=/usr/local/bin/ntfs-3g 0 0 PR: 120784 Requested by: Dominic Fandrey Modified: head/sbin/mount/mount.8 head/sbin/mount/mount.c Modified: head/sbin/mount/mount.8 ============================================================================== --- head/sbin/mount/mount.8 Thu Mar 5 08:08:09 2009 (r189396) +++ head/sbin/mount/mount.8 Thu Mar 5 08:57:35 2009 (r189397) @@ -163,6 +163,15 @@ is run with the flag but without the .Fl l flag. +.It Cm mountprog Ns = Ns Aq Ar program +Force +.Nm +to use the specified program to mount the file system, instead of calling +.Xr nmount 2 +directly. For example: +.Bd -literal +mount -t foofs -o mountprog=/mydir/fooprog /dev/acd0 /mnt +.Ed .It Cm multilabel Enable multi-label Mandatory Access Control, or MAC, on the specified file system. Modified: head/sbin/mount/mount.c ============================================================================== --- head/sbin/mount/mount.c Thu Mar 5 08:08:09 2009 (r189396) +++ head/sbin/mount/mount.c Thu Mar 5 08:57:35 2009 (r189397) @@ -129,6 +129,8 @@ remountable_fs_names[] = { static const char userquotaeq[] = "userquota="; static const char groupquotaeq[] = "groupquota="; +static char *mountprog = NULL; + static int use_mountprog(const char *vfstype) { @@ -143,6 +145,9 @@ use_mountprog(const char *vfstype) NULL }; + if (mountprog != NULL) + return (1); + for (i = 0; fs[i] != NULL; ++i) { if (strcmp(vfstype, fs[i]) == 0) return (1); @@ -165,8 +170,10 @@ exec_mountprog(const char *name, const c /* Go find an executable. */ execvP(execname, _PATH_SYSPATH, argv); if (errno == ENOENT) { - warn("exec %s not found in %s", execname, - _PATH_SYSPATH); + warn("exec %s not found", execname); + if (execname[0] != '/') { + warnx("in path: %s", _PATH_SYSPATH); + } } exit(1); default: /* Parent. */ @@ -558,13 +565,16 @@ mountfs(const char *vfstype, const char mnt_argv.c = -1; append_arg(&mnt_argv, execname); mangle(optbuf, &mnt_argv); + if (mountprog != NULL) + strcpy(execname, mountprog); + append_arg(&mnt_argv, strdup(spec)); append_arg(&mnt_argv, strdup(name)); append_arg(&mnt_argv, NULL); if (debug) { if (use_mountprog(vfstype)) - printf("exec: mount_%s", vfstype); + printf("exec: %s", execname); else printf("mount -t %s", vfstype); for (i = 1; i < mnt_argv.c; i++) @@ -681,7 +691,7 @@ catopt(char *s0, const char *s1) void mangle(char *options, struct cpa *a) { - char *p, *s; + char *p, *s, *val; for (s = options; (p = strsep(&s, ",")) != NULL;) if (*p != '\0') { @@ -703,6 +713,22 @@ mangle(char *options, struct cpa *a) * before mountd starts. */ continue; + } else if (strncmp(p, "mountprog", 9) == 0) { + /* + * "mountprog" is used to force the use of + * userland mount programs. + */ + val = strchr(p, '='); + if (val != NULL) { + ++val; + if (*val != '\0') + mountprog = strdup(val); + } + + if (mountprog == NULL) { + errx(1, "Need value for -o mountprog"); + } + continue; } else if (strcmp(p, "userquota") == 0) { continue; } else if (strncmp(p, userquotaeq, From owner-svn-src-head@FreeBSD.ORG Thu Mar 5 11:45: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 74CFC1065675; Thu, 5 Mar 2009 11:45:43 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 63DDB8FC08; Thu, 5 Mar 2009 11:45:43 +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 n25Bjh2u072667; Thu, 5 Mar 2009 11:45:43 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n25BjhvE072666; Thu, 5 Mar 2009 11:45:43 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <200903051145.n25BjhvE072666@svn.freebsd.org> From: Konstantin Belousov Date: Thu, 5 Mar 2009 11:45: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: r189398 - 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, 05 Mar 2009 11:45:44 -0000 Author: kib Date: Thu Mar 5 11:45:42 2009 New Revision: 189398 URL: http://svn.freebsd.org/changeset/base/189398 Log: Systematically use vm_size_t to specify the size of the segment for VM KPI. Do not overload the local variable size in kern_shmat() due to vm_size_t change. Fix style bug by adding explicit comparision with 0. Discussed with: bde MFC after: 1 week Modified: head/sys/kern/sysv_shm.c Modified: head/sys/kern/sysv_shm.c ============================================================================== --- head/sys/kern/sysv_shm.c Thu Mar 5 08:57:35 2009 (r189397) +++ head/sys/kern/sysv_shm.c Thu Mar 5 11:45:42 2009 (r189398) @@ -122,7 +122,7 @@ static sy_call_t *shmcalls[] = { #define SHMSEG_WANTED 0x1000 static int shm_last_free, shm_nused, shmalloced; -size_t shm_committed; +vm_size_t shm_committed; static struct shmid_kernel *shmsegs; struct shmmap_state { @@ -245,7 +245,7 @@ static void shm_deallocate_segment(shmseg) struct shmid_kernel *shmseg; { - size_t size; + vm_size_t size; GIANT_REQUIRED; @@ -265,7 +265,7 @@ shm_delete_mapping(struct vmspace *vm, s { struct shmid_kernel *shmseg; int segnum, result; - size_t size; + vm_size_t size; GIANT_REQUIRED; @@ -362,8 +362,8 @@ kern_shmat(td, shmid, shmaddr, shmflg) mtx_lock(&Giant); shmmap_s = p->p_vmspace->vm_shm; if (shmmap_s == NULL) { - size = shminfo.shmseg * sizeof(struct shmmap_state); - shmmap_s = malloc(size, M_SHM, M_WAITOK); + shmmap_s = malloc(shminfo.shmseg * sizeof(struct shmmap_state), + M_SHM, M_WAITOK); for (i = 0; i < shminfo.shmseg; i++) shmmap_s[i].shmid = -1; p->p_vmspace->vm_shm = shmmap_s; @@ -722,7 +722,7 @@ shmget_existing(td, uap, mode, segnum) if (error != 0) return (error); #endif - if (uap->size && uap->size > shmseg->shm_bsegsz) + if (uap->size != 0 && uap->size > shmseg->shm_bsegsz) return (EINVAL); td->td_retval[0] = IXSEQ_TO_IPCID(segnum, shmseg->u.shm_perm); return (0); From owner-svn-src-head@FreeBSD.ORG Thu Mar 5 12:04: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 EB5B310658F7; Thu, 5 Mar 2009 12:04:42 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id AC83C8FC23; Thu, 5 Mar 2009 12:04:42 +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 n25C4g55073028; Thu, 5 Mar 2009 12:04:42 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n25C4g6c073026; Thu, 5 Mar 2009 12:04:42 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <200903051204.n25C4g6c073026@svn.freebsd.org> From: Konstantin Belousov Date: Thu, 5 Mar 2009 12:04: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: r189399 - in 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: Thu, 05 Mar 2009 12:05:04 -0000 Author: kib Date: Thu Mar 5 12:04:42 2009 New Revision: 189399 URL: http://svn.freebsd.org/changeset/base/189399 Log: Hopefully, improve the grammar and wording in the changes to shmctl(2) manpage and UPDATING entry 20090302. UPDATING changes suggested by bf2006a yahoo com. man page corrections by bde. Modified: head/UPDATING head/lib/libc/sys/shmctl.2 Modified: head/UPDATING ============================================================================== --- head/UPDATING Thu Mar 5 11:45:42 2009 (r189398) +++ head/UPDATING Thu Mar 5 12:04:42 2009 (r189399) @@ -23,11 +23,11 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 8. ln -s aj /etc/malloc.conf.) 20090302: - The workaround is committed to allow to create System V shared - memory segment of size > 2 Gb on the 64-bit architectures. - Due to limitation of the existing ABI, the shm_segsz member + A workaround is committed to allow the creation of System V shared + memory segment of size > 2 GB on the 64-bit architectures. + Due to a limitation of the existing ABI, the shm_segsz member of the struct shmid_ds, returned by shmctl(IPC_STAT) call is - wrong for large segments. Note that limits shall be explicitely + wrong for large segments. Note that limits must be explicitely raised to allow such segments to be created. 20090301: Modified: head/lib/libc/sys/shmctl.2 ============================================================================== --- head/lib/libc/sys/shmctl.2 Thu Mar 5 11:45:42 2009 (r189398) +++ head/lib/libc/sys/shmctl.2 Thu Mar 5 12:04:42 2009 (r189399) @@ -134,12 +134,13 @@ Permission denied due to mismatch betwee shared memory segment. .El .Sh "BUGS" +The segment size has size_t type. The shm_segsz member of the .Vt shmid_ds -structure has int type, that is too short to represent full range -of the values for segment size, which is allowed to be size_t. -If shared memory limits are raised to allow segments with size > 2 Gb -to be created, be aware that IPC_STAT call may return truncated value +structure has type int, which is too short to represent the full range +of values for a segment size. +If shared memory limits are raised to allow segments with size > 2 GB +to be created, be aware that IPC_STAT call may return a truncated value for shm_segsz. .El .Sh "SEE ALSO" From owner-svn-src-head@FreeBSD.ORG Thu Mar 5 15:28: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 EAB1B106564A; Thu, 5 Mar 2009 15:28:46 +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 D93188FC0C; Thu, 5 Mar 2009 15:28:46 +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 n25FSksO084891; Thu, 5 Mar 2009 15:28:46 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n25FSkrJ084890; Thu, 5 Mar 2009 15:28:46 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <200903051528.n25FSkrJ084890@svn.freebsd.org> From: John Baldwin Date: Thu, 5 Mar 2009 15:28:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r189400 - head/sys/dev/pci 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, 05 Mar 2009 15:28:47 -0000 Author: jhb Date: Thu Mar 5 15:28:46 2009 New Revision: 189400 URL: http://svn.freebsd.org/changeset/base/189400 Log: Honor the prefetchable flag in memory BARs by setting the RF_PREFETCHABLE flag when calling bus_alloc_resource() to allocate resources from a parent PCI bridge. For PCI-PCI bridges this asks the bridge to satisfy the request using the prefetchable memory range rather than the normal memory range. Reviewed by: imp Reported by: scottl MFC after: 1 week Modified: head/sys/dev/pci/pci.c Modified: head/sys/dev/pci/pci.c ============================================================================== --- head/sys/dev/pci/pci.c Thu Mar 5 12:04:42 2009 (r189399) +++ head/sys/dev/pci/pci.c Thu Mar 5 15:28:46 2009 (r189400) @@ -2313,9 +2313,11 @@ pci_add_map(device_t pcib, device_t bus, PCIB_WRITE_CONFIG(pcib, b, s, f, reg, map, 4); PCIB_WRITE_CONFIG(pcib, b, s, f, PCIR_COMMAND, cmd, 2); - if (PCI_BAR_MEM(map)) + if (PCI_BAR_MEM(map)) { type = SYS_RES_MEMORY; - else + if (map & PCIM_BAR_MEM_PREFETCH) + prefetch = 1; + } else type = SYS_RES_IOPORT; ln2size = pci_mapsize(testval); ln2range = pci_maprange(testval); @@ -3488,6 +3490,8 @@ pci_alloc_map(device_t dev, device_t chi count = 1UL << mapsize; if (RF_ALIGNMENT(flags) < mapsize) flags = (flags & ~RF_ALIGNMENT_MASK) | RF_ALIGNMENT_LOG2(mapsize); + if (PCI_BAR_MEM(testval) && (testval & PCIM_BAR_MEM_PREFETCH)) + flags |= RF_PREFETCHABLE; /* * Allocate enough resource, and then write back the From owner-svn-src-head@FreeBSD.ORG Thu Mar 5 15:33: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 76CDD10656FD; Thu, 5 Mar 2009 15:33:04 +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 566E88FC1D; Thu, 5 Mar 2009 15:33:04 +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 n25FX43p085398; Thu, 5 Mar 2009 15:33:04 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n25FX4qX085396; Thu, 5 Mar 2009 15:33:04 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <200903051533.n25FX4qX085396@svn.freebsd.org> From: John Baldwin Date: Thu, 5 Mar 2009 15:33: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: r189401 - head/sys/dev/pci 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, 05 Mar 2009 15:33:05 -0000 Author: jhb Date: Thu Mar 5 15:33:04 2009 New Revision: 189401 URL: http://svn.freebsd.org/changeset/base/189401 Log: Always read/write the full 64-bit value of 64-bit BARs. Specifically, when determining the size of a BAR by writing all 1's to the BAR and reading back the result, always operate on the full 64-bit size. Reviewed by: imp MFC after: 1 month Modified: head/sys/dev/pci/pci.c head/sys/dev/pci/pcireg.h Modified: head/sys/dev/pci/pci.c ============================================================================== --- head/sys/dev/pci/pci.c Thu Mar 5 15:28:46 2009 (r189400) +++ head/sys/dev/pci/pci.c Thu Mar 5 15:33:04 2009 (r189401) @@ -71,10 +71,10 @@ __FBSDID("$FreeBSD$"); #define ACPI_PWR_FOR_SLEEP(x, y, z) #endif -static uint32_t pci_mapbase(unsigned mapreg); -static const char *pci_maptype(unsigned mapreg); -static int pci_mapsize(unsigned testval); -static int pci_maprange(unsigned mapreg); +static pci_addr_t pci_mapbase(uint64_t mapreg); +static const char *pci_maptype(uint64_t mapreg); +static int pci_mapsize(uint64_t testval); +static int pci_maprange(uint64_t mapreg); static void pci_fixancient(pcicfgregs *cfg); static int pci_porten(device_t pcib, int b, int s, int f); @@ -316,8 +316,8 @@ pci_find_device(uint16_t vendor, uint16_ /* return base address of memory or port map */ -static uint32_t -pci_mapbase(uint32_t mapreg) +static pci_addr_t +pci_mapbase(uint64_t mapreg) { if (PCI_BAR_MEM(mapreg)) @@ -329,7 +329,7 @@ pci_mapbase(uint32_t mapreg) /* return map type of memory or port map */ static const char * -pci_maptype(unsigned mapreg) +pci_maptype(uint64_t mapreg) { if (PCI_BAR_IO(mapreg)) @@ -342,7 +342,7 @@ pci_maptype(unsigned mapreg) /* return log2 of map size decoded for memory or port map */ static int -pci_mapsize(uint32_t testval) +pci_mapsize(uint64_t testval) { int ln2size; @@ -361,7 +361,7 @@ pci_mapsize(uint32_t testval) /* return log2 of address range supported by map register */ static int -pci_maprange(unsigned mapreg) +pci_maprange(uint64_t mapreg) { int ln2range = 0; @@ -2279,8 +2279,7 @@ pci_add_map(device_t pcib, device_t bus, int b, int s, int f, int reg, struct resource_list *rl, int force, int prefetch) { - uint32_t map; - pci_addr_t base; + pci_addr_t base, map; pci_addr_t start, end, count; uint8_t ln2size; uint8_t ln2range; @@ -2291,6 +2290,10 @@ pci_add_map(device_t pcib, device_t bus, struct resource *res; map = PCIB_READ_CONFIG(pcib, b, s, f, reg, 4); + ln2range = pci_maprange(map); + if (ln2range == 64) + map |= (uint64_t)PCIB_READ_CONFIG(pcib, b, s, f, reg + 4, 4) << + 32; /* * Disable decoding via the command register before @@ -2308,9 +2311,16 @@ pci_add_map(device_t pcib, device_t bus, */ PCIB_WRITE_CONFIG(pcib, b, s, f, reg, 0xffffffff, 4); testval = PCIB_READ_CONFIG(pcib, b, s, f, reg, 4); + if (ln2range == 64) { + PCIB_WRITE_CONFIG(pcib, b, s, f, reg + 4, 0xffffffff, 4); + testval |= (uint64_t)PCIB_READ_CONFIG(pcib, b, s, f, reg + 4, + 4) << 32; + } /* Restore the BAR and command register. */ PCIB_WRITE_CONFIG(pcib, b, s, f, reg, map, 4); + if (ln2range == 64) + PCIB_WRITE_CONFIG(pcib, b, s, f, reg + 4, map >> 32, 4); PCIB_WRITE_CONFIG(pcib, b, s, f, PCIR_COMMAND, cmd, 2); if (PCI_BAR_MEM(map)) { @@ -2320,7 +2330,6 @@ pci_add_map(device_t pcib, device_t bus, } else type = SYS_RES_IOPORT; ln2size = pci_mapsize(testval); - ln2range = pci_maprange(testval); base = pci_mapbase(map); barlen = ln2range == 64 ? 2 : 1; @@ -2337,12 +2346,6 @@ pci_add_map(device_t pcib, device_t bus, (type == SYS_RES_IOPORT && ln2size < 2)) return (barlen); - if (ln2range == 64) - /* - * Read the other half of a 64bit map register. We - * assume that the size of the BAR is less than 2^32. - */ - base |= (uint64_t) PCIB_READ_CONFIG(pcib, b, s, f, reg + 4, 4) << 32; if (bootverbose) { printf("\tmap[%02x]: type %s, range %2d, base %#jx, size %2d", reg, pci_maptype(map), ln2range, (uintmax_t)base, ln2size); @@ -3421,7 +3424,7 @@ pci_alloc_map(device_t dev, device_t chi struct resource *res; pci_addr_t map, testval; uint16_t cmd; - int mapsize; + int maprange, mapsize; /* * Weed out the bogons, and figure out how large the BAR/map @@ -3432,6 +3435,9 @@ pci_alloc_map(device_t dev, device_t chi */ res = NULL; map = pci_read_config(child, *rid, 4); + maprange = pci_maprange(map); + if (maprange == 64) + map |= (pci_addr_t)pci_read_config(child, *rid + 4, 4) << 32; /* * Disable decoding via the command register before @@ -3445,8 +3451,11 @@ pci_alloc_map(device_t dev, device_t chi /* Determine the BAR's length. */ pci_write_config(child, *rid, 0xffffffff, 4); testval = pci_read_config(child, *rid, 4); - if (pci_maprange(testval) == 64) - map |= (pci_addr_t)pci_read_config(child, *rid + 4, 4) << 32; + if (maprange == 64) { + pci_write_config(child, *rid + 4, 0xffffffff, 4); + testval |= (pci_addr_t)pci_read_config(child, *rid + 4, 4) << + 32; + } /* * Restore the original value of the BAR. We may have reprogrammed @@ -3454,6 +3463,8 @@ pci_alloc_map(device_t dev, device_t chi * we need the console device addressable. */ pci_write_config(child, *rid, map, 4); + if (maprange == 64) + pci_write_config(child, *rid + 4, map, 4); pci_write_config(child, PCIR_COMMAND, cmd, 2); /* Ignore a BAR with a base of 0. */ @@ -3520,7 +3531,7 @@ pci_alloc_map(device_t dev, device_t chi count, *rid, type, rman_get_start(res)); map = rman_get_start(res); pci_write_config(child, *rid, map, 4); - if (pci_maprange(testval) == 64) + if (maprange == 64) pci_write_config(child, *rid + 4, map >> 32, 4); out:; return (res); Modified: head/sys/dev/pci/pcireg.h ============================================================================== --- head/sys/dev/pci/pcireg.h Thu Mar 5 15:28:46 2009 (r189400) +++ head/sys/dev/pci/pcireg.h Thu Mar 5 15:33:04 2009 (r189401) @@ -132,7 +132,7 @@ #define PCIM_BAR_MEM_1MB 2 /* Locate below 1MB in PCI <= 2.1 */ #define PCIM_BAR_MEM_64 4 #define PCIM_BAR_MEM_PREFETCH 0x00000008 -#define PCIM_BAR_MEM_BASE 0xfffffff0 +#define PCIM_BAR_MEM_BASE 0xfffffffffffffff0ULL #define PCIM_BAR_IO_RESERVED 0x00000002 #define PCIM_BAR_IO_BASE 0xfffffffc #define PCIR_CIS 0x28 From owner-svn-src-head@FreeBSD.ORG Thu Mar 5 16:03: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 B4D0D1065670; Thu, 5 Mar 2009 16:03:44 +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 A2C348FC1C; Thu, 5 Mar 2009 16:03:44 +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 n25G3iIB088718; Thu, 5 Mar 2009 16:03:44 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n25G3iqq088716; Thu, 5 Mar 2009 16:03:44 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <200903051603.n25G3iqq088716@svn.freebsd.org> From: John Baldwin Date: Thu, 5 Mar 2009 16:03: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: r189404 - in head/sys: amd64/acpica i386/acpica 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, 05 Mar 2009 16:03:45 -0000 Author: jhb Date: Thu Mar 5 16:03:44 2009 New Revision: 189404 URL: http://svn.freebsd.org/changeset/base/189404 Log: At least one BIOS bogusly includes duplicate entries for I/O APICs. The bogus entries have a starting IRQ that is invalid (> 255, so won't fit into a PCI intline config register). It had the side effect of breaking MSI by "claiming" several IRQs in the MSI range. Fix this by ignoring such I/O APICs. MFC after: 2 weeks Modified: head/sys/amd64/acpica/madt.c head/sys/i386/acpica/madt.c Modified: head/sys/amd64/acpica/madt.c ============================================================================== --- head/sys/amd64/acpica/madt.c Thu Mar 5 15:50:39 2009 (r189403) +++ head/sys/amd64/acpica/madt.c Thu Mar 5 16:03:44 2009 (r189404) @@ -483,6 +483,10 @@ madt_parse_apics(ACPI_SUBTABLE_HEADER *e apic->Id); if (ioapics[apic->Id].io_apic != NULL) panic("%s: Double APIC ID %u", __func__, apic->Id); + if (apic->GlobalIrqBase >= FIRST_MSI_INT) { + printf("MADT: Ignoring bogus I/O APIC ID %u", apic->Id); + break; + } ioapics[apic->Id].io_apic = ioapic_create(apic->Address, apic->Id, apic->GlobalIrqBase); ioapics[apic->Id].io_vector = apic->GlobalIrqBase; Modified: head/sys/i386/acpica/madt.c ============================================================================== --- head/sys/i386/acpica/madt.c Thu Mar 5 15:50:39 2009 (r189403) +++ head/sys/i386/acpica/madt.c Thu Mar 5 16:03:44 2009 (r189404) @@ -482,6 +482,10 @@ madt_parse_apics(ACPI_SUBTABLE_HEADER *e apic->Id); if (ioapics[apic->Id].io_apic != NULL) panic("%s: Double APIC ID %u", __func__, apic->Id); + if (apic->GlobalIrqBase >= FIRST_MSI_INT) { + printf("MADT: Ignoring bogus I/O APIC ID %u", apic->Id); + break; + } ioapics[apic->Id].io_apic = ioapic_create(apic->Address, apic->Id, apic->GlobalIrqBase); ioapics[apic->Id].io_vector = apic->GlobalIrqBase; From owner-svn-src-head@FreeBSD.ORG Thu Mar 5 16:15: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 F3F36106566B; Thu, 5 Mar 2009 16:15:07 +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 D6A748FC15; Thu, 5 Mar 2009 16:15:07 +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 n25GF7f9090003; Thu, 5 Mar 2009 16:15:07 GMT (envelope-from thompsa@svn.freebsd.org) Received: (from thompsa@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n25GF7kL090002; Thu, 5 Mar 2009 16:15:07 GMT (envelope-from thompsa@svn.freebsd.org) Message-Id: <200903051615.n25GF7kL090002@svn.freebsd.org> From: Andrew Thompson Date: Thu, 5 Mar 2009 16:15:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r189405 - head/sys/dev/usb/serial 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, 05 Mar 2009 16:15:08 -0000 Author: thompsa Date: Thu Mar 5 16:15:07 2009 New Revision: 189405 URL: http://svn.freebsd.org/changeset/base/189405 Log: Add support for the UNION interface descriptor, used by Nokia phones. PR: usb/117185 Modified: head/sys/dev/usb/serial/umodem.c Modified: head/sys/dev/usb/serial/umodem.c ============================================================================== --- head/sys/dev/usb/serial/umodem.c Thu Mar 5 16:03:44 2009 (r189404) +++ head/sys/dev/usb/serial/umodem.c Thu Mar 5 16:15:07 2009 (r189405) @@ -69,6 +69,7 @@ __FBSDID("$FreeBSD$"); /* * Comm Class spec: http://www.usb.org/developers/devclass_docs/usbccs10.pdf * http://www.usb.org/developers/devclass_docs/usbcdc11.pdf + * http://www.usb.org/developers/devclass_docs/cdc_wmc10.zip */ /* @@ -253,8 +254,6 @@ static int umodem_probe(device_t dev) { struct usb2_attach_arg *uaa = device_get_ivars(dev); - uint8_t cm; - uint8_t acm; int error; DPRINTFN(11, "\n"); @@ -263,19 +262,6 @@ umodem_probe(device_t dev) return (ENXIO); } error = usb2_lookup_id_by_uaa(umodem_devs, sizeof(umodem_devs), uaa); - if (error) { - return (error); - } - if (uaa->driver_info == NULL) { - /* some modems do not have any capabilities */ - return (error); - } - umodem_get_caps(uaa, &cm, &acm); - if (!(cm & USB_CDC_CM_DOES_CM) || - !(cm & USB_CDC_CM_OVER_DATA) || - !(acm & USB_CDC_ACM_HAS_LINE)) { - error = ENXIO; - } return (error); } @@ -285,6 +271,7 @@ umodem_attach(device_t dev) struct usb2_attach_arg *uaa = device_get_ivars(dev); struct umodem_softc *sc = device_get_softc(dev); struct usb2_cdc_cm_descriptor *cmd; + struct usb2_cdc_union_descriptor *cud; uint8_t i; int error; @@ -302,10 +289,20 @@ umodem_attach(device_t dev) cmd = umodem_get_desc(uaa, UDESC_CS_INTERFACE, UDESCSUB_CDC_CM); if ((cmd == NULL) || (cmd->bLength < sizeof(*cmd))) { - device_printf(dev, "no CM descriptor!\n"); - goto detach; + + cud = usb2_find_descriptor(uaa->device, NULL, + uaa->info.bIfaceIndex, UDESC_CS_INTERFACE, + 0 - 1, UDESCSUB_CDC_UNION, 0 - 1); + + if ((cud == NULL) || (cud->bLength < sizeof(*cud))) { + device_printf(dev, "no CM or union descriptor!\n"); + goto detach; + } + + sc->sc_data_iface_no = cud->bSlaveInterface[0]; + } else { + sc->sc_data_iface_no = cmd->bDataInterface; } - sc->sc_data_iface_no = cmd->bDataInterface; device_printf(dev, "data interface %d, has %sCM over " "data, has %sbreak\n", @@ -419,21 +416,19 @@ umodem_get_caps(struct usb2_attach_arg * struct usb2_cdc_cm_descriptor *cmd; struct usb2_cdc_acm_descriptor *cad; - *cm = *acm = 0; - cmd = umodem_get_desc(uaa, UDESC_CS_INTERFACE, UDESCSUB_CDC_CM); if ((cmd == NULL) || (cmd->bLength < sizeof(*cmd))) { - DPRINTF("no CM desc\n"); - return; - } - *cm = cmd->bmCapabilities; + DPRINTF("no CM desc (faking one)\n"); + *cm = USB_CDC_CM_DOES_CM | USB_CDC_CM_OVER_DATA; + } else + *cm = cmd->bmCapabilities; cad = umodem_get_desc(uaa, UDESC_CS_INTERFACE, UDESCSUB_CDC_ACM); if ((cad == NULL) || (cad->bLength < sizeof(*cad))) { DPRINTF("no ACM desc\n"); - return; - } - *acm = cad->bmCapabilities; + *acm = 0; + } else + *acm = cad->bmCapabilities; } static void From owner-svn-src-head@FreeBSD.ORG Thu Mar 5 16:22: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 16D011065672; Thu, 5 Mar 2009 16:22:33 +0000 (UTC) (envelope-from vanhu@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 04AC88FC1D; Thu, 5 Mar 2009 16:22:33 +0000 (UTC) (envelope-from vanhu@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 n25GMWO6090859; Thu, 5 Mar 2009 16:22:32 GMT (envelope-from vanhu@svn.freebsd.org) Received: (from vanhu@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n25GMWee090858; Thu, 5 Mar 2009 16:22:32 GMT (envelope-from vanhu@svn.freebsd.org) Message-Id: <200903051622.n25GMWee090858@svn.freebsd.org> From: VANHULLEBUS Yvan Date: Thu, 5 Mar 2009 16:22:32 +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: r189406 - head/sys/netipsec 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, 05 Mar 2009 16:22:33 -0000 Author: vanhu Date: Thu Mar 5 16:22:32 2009 New Revision: 189406 URL: http://svn.freebsd.org/changeset/base/189406 Log: SAs are valid (but dying) when they reached soft lifetime, even if they have never been used. Approved by: gnn(mentor) MFC after: 2 weeks Modified: head/sys/netipsec/key.c Modified: head/sys/netipsec/key.c ============================================================================== --- head/sys/netipsec/key.c Thu Mar 5 16:15:07 2009 (r189405) +++ head/sys/netipsec/key.c Thu Mar 5 16:22:32 2009 (r189406) @@ -4154,22 +4154,15 @@ key_flush_sad(time_t now) /* check SOFT lifetime */ if (sav->lft_s->addtime != 0 && now - sav->created > sav->lft_s->addtime) { - /* - * check SA to be used whether or not. - * when SA hasn't been used, delete it. + key_sa_chgstate(sav, SADB_SASTATE_DYING); + /* Actually, only send expire message if SA has been used, as it + * was done before, but should we always send such message, and let IKE + * daemon decide if it should be renegociated or not ? + * XXX expire message will actually NOT be sent if SA is only used + * after soft lifetime has been reached, see below (DYING state) */ - if (sav->lft_c->usetime == 0) { - key_sa_chgstate(sav, SADB_SASTATE_DEAD); - KEY_FREESAV(&sav); - } else { - key_sa_chgstate(sav, SADB_SASTATE_DYING); - /* - * XXX If we keep to send expire - * message in the status of - * DYING. Do remove below code. - */ + if (sav->lft_c->usetime != 0) key_expire(sav); - } } /* check SOFT lifetime by bytes */ /* From owner-svn-src-head@FreeBSD.ORG Thu Mar 5 16:43: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 CB49F106566B; Thu, 5 Mar 2009 16:43:33 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B7D1D8FC1D; Thu, 5 Mar 2009 16:43:33 +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 n25GhXEc093051; Thu, 5 Mar 2009 16:43:33 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n25GhX0K093049; Thu, 5 Mar 2009 16:43:33 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <200903051643.n25GhX0K093049@svn.freebsd.org> From: John Baldwin Date: Thu, 5 Mar 2009 16:43: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: r189407 - in head/sys/dev: puc uart 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, 05 Mar 2009 16:43:34 -0000 Author: jhb Date: Thu Mar 5 16:43:33 2009 New Revision: 189407 URL: http://svn.freebsd.org/changeset/base/189407 Log: Add support for the single-port NetMos NM9835 serial adapter. The puc(4) entry is a specific entry to override the generic NetMos entry so that puc(4) will leave this device alone and let uart(4) claim it. Submitted by: Navdeep Parhar nparhar @ gmail Reviewed by: marcel MFC after: 1 week Modified: head/sys/dev/puc/pucdata.c head/sys/dev/uart/uart_bus_pci.c Modified: head/sys/dev/puc/pucdata.c ============================================================================== --- head/sys/dev/puc/pucdata.c Thu Mar 5 16:22:32 2009 (r189406) +++ head/sys/dev/puc/pucdata.c Thu Mar 5 16:43:33 2009 (r189407) @@ -761,6 +761,18 @@ const struct puc_cfg puc_pci_devices[] = PUC_PORT_2P, 0x10, 8, 0, }, + /* + * This is more specific than the generic NM9835 entry that follows, and + * is placed here to _prevent_ puc from claiming this single port card. + * + * uart(4) will claim this device. + */ + { 0x9710, 0x9835, 0x1000, 1, + "NetMos NM9835 based 1-port serial", + DEFAULT_RCLK, + PUC_PORT_1S, 0x10, 4, 0, + }, + { 0x9710, 0x9835, 0xffff, 0, "NetMos NM9835 Dual UART and 1284 Printer port", DEFAULT_RCLK, Modified: head/sys/dev/uart/uart_bus_pci.c ============================================================================== --- head/sys/dev/uart/uart_bus_pci.c Thu Mar 5 16:22:32 2009 (r189406) +++ head/sys/dev/uart/uart_bus_pci.c Thu Mar 5 16:43:33 2009 (r189407) @@ -110,6 +110,7 @@ static struct pci_id pci_ns8250_ids[] = { 0x1415, 0x950b, 0xffff, 0, "Oxford Semiconductor OXCB950 Cardbus 16950 UART", 0x10, 16384000 }, { 0x151f, 0x0000, 0xffff, 0, "TOPIC Semiconductor TP560 56k modem", 0x10 }, +{ 0x9710, 0x9835, 0x1000, 1, "NetMos NM9835 Serial Port", 0x10 }, { 0xdeaf, 0x9051, 0xffff, 0, "Middle Digital PC Weasel Serial Port", 0x10 }, { 0xffff, 0, 0xffff, 0, NULL, 0, 0} }; From owner-svn-src-head@FreeBSD.ORG Thu Mar 5 16:52: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 1AB0F106568E; Thu, 5 Mar 2009 16:52:51 +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 08AA38FC25; Thu, 5 Mar 2009 16:52:51 +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 n25GqoTU093883; Thu, 5 Mar 2009 16:52:50 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n25GqoOH093882; Thu, 5 Mar 2009 16:52:50 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <200903051652.n25GqoOH093882@svn.freebsd.org> From: John Baldwin Date: Thu, 5 Mar 2009 16:52: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: r189411 - head/sys/amd64/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: Thu, 05 Mar 2009 16:52:52 -0000 Author: jhb Date: Thu Mar 5 16:52:50 2009 New Revision: 189411 URL: http://svn.freebsd.org/changeset/base/189411 Log: Move the PCB flag macros up next to the 'pcb_flags' member in the struct. Modified: head/sys/amd64/include/pcb.h Modified: head/sys/amd64/include/pcb.h ============================================================================== --- head/sys/amd64/include/pcb.h Thu Mar 5 16:49:13 2009 (r189410) +++ head/sys/amd64/include/pcb.h Thu Mar 5 16:52:50 2009 (r189411) @@ -56,6 +56,12 @@ struct pcb { register_t pcb_fsbase; register_t pcb_gsbase; u_long pcb_flags; +#define PCB_DBREGS 0x02 /* process using debug registers */ +#define PCB_FPUINITDONE 0x08 /* fpu state is initialized */ +#define PCB_GS32BIT 0x20 /* linux gs switch */ +#define PCB_32BIT 0x40 /* process has 32 bit context (segs etc) */ +#define PCB_FULLCTX 0x80 /* full context restore on sysret */ + u_int32_t pcb_ds; u_int32_t pcb_es; u_int32_t pcb_fs; @@ -68,11 +74,6 @@ struct pcb { u_int64_t pcb_dr7; struct savefpu pcb_save; -#define PCB_DBREGS 0x02 /* process using debug registers */ -#define PCB_FPUINITDONE 0x08 /* fpu state is initialized */ -#define PCB_GS32BIT 0x20 /* linux gs switch */ -#define PCB_32BIT 0x40 /* process has 32 bit context (segs etc) */ -#define PCB_FULLCTX 0x80 /* full context restore on sysret */ caddr_t pcb_onfault; /* copyin/out fault recovery */ From owner-svn-src-head@FreeBSD.ORG Thu Mar 5 16:56: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 8D18510656FD; Thu, 5 Mar 2009 16:56:16 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 7A67F8FC25; Thu, 5 Mar 2009 16:56:16 +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 n25GuGTd094023; Thu, 5 Mar 2009 16:56:16 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n25GuGTQ094020; Thu, 5 Mar 2009 16:56:16 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <200903051656.n25GuGTQ094020@svn.freebsd.org> From: John Baldwin Date: Thu, 5 Mar 2009 16:56: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: r189412 - in head/sys/amd64: amd64 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: Thu, 05 Mar 2009 16:56:17 -0000 Author: jhb Date: Thu Mar 5 16:56:16 2009 New Revision: 189412 URL: http://svn.freebsd.org/changeset/base/189412 Log: A few cleanups to the FPU code on amd64: - fpudna() always returned 1 since amd64 CPUs always have FPUs. Change the function to return void and adjust the calling code in trap() to assume the return 1 case is the only case. - Remove fpu_cleanstate_ready as it is always true when it is tested. Also, only initialize fpu_cleanstate when fpuinit() is called on the BSP. Reviewed by: bde Modified: head/sys/amd64/amd64/fpu.c head/sys/amd64/amd64/trap.c head/sys/amd64/include/fpu.h Modified: head/sys/amd64/amd64/fpu.c ============================================================================== --- head/sys/amd64/amd64/fpu.c Thu Mar 5 16:52:50 2009 (r189411) +++ head/sys/amd64/amd64/fpu.c Thu Mar 5 16:56:16 2009 (r189412) @@ -102,10 +102,11 @@ SYSCTL_INT(_hw, HW_FLOATINGPT, floatingp NULL, 1, "Floating point instructions executed in hardware"); static struct savefpu fpu_cleanstate; -static bool_t fpu_cleanstate_ready; /* - * Initialize floating point unit. + * Initialize the floating point unit. On the boot CPU we generate a + * clean state that is used to initialize the floating point unit when + * it is first used by a process. */ void fpuinit(void) @@ -115,22 +116,22 @@ fpuinit(void) u_short control; savecrit = intr_disable(); - PCPU_SET(fpcurthread, 0); stop_emulating(); fninit(); control = __INITIAL_FPUCW__; fldcw(&control); mxcsr = __INITIAL_MXCSR__; ldmxcsr(mxcsr); - fxsave(&fpu_cleanstate); - if (fpu_cleanstate.sv_env.en_mxcsr_mask) - cpu_mxcsr_mask = fpu_cleanstate.sv_env.en_mxcsr_mask; - else - cpu_mxcsr_mask = 0xFFBF; + if (PCPU_GET(cpuid) == 0) { + fxsave(&fpu_cleanstate); + if (fpu_cleanstate.sv_env.en_mxcsr_mask) + cpu_mxcsr_mask = fpu_cleanstate.sv_env.en_mxcsr_mask; + else + cpu_mxcsr_mask = 0xFFBF; + bzero(fpu_cleanstate.sv_fp, sizeof(fpu_cleanstate.sv_fp)); + bzero(fpu_cleanstate.sv_xmm, sizeof(fpu_cleanstate.sv_xmm)); + } start_emulating(); - bzero(fpu_cleanstate.sv_fp, sizeof(fpu_cleanstate.sv_fp)); - bzero(fpu_cleanstate.sv_xmm, sizeof(fpu_cleanstate.sv_xmm)); - fpu_cleanstate_ready = 1; intr_restore(savecrit); } @@ -384,8 +385,8 @@ fputrap() static int err_count = 0; -int -fpudna() +void +fpudna(void) { struct pcb *pcb; register_t s; @@ -395,7 +396,7 @@ fpudna() printf("fpudna: fpcurthread == curthread %d times\n", ++err_count); stop_emulating(); - return (1); + return; } if (PCPU_GET(fpcurthread) != NULL) { printf("fpudna: fpcurthread = %p (%d), curthread = %p (%d)\n", @@ -428,8 +429,6 @@ fpudna() } else fxrstor(&pcb->pcb_save); intr_restore(s); - - return (1); } /* @@ -457,10 +456,7 @@ fpugetregs(struct thread *td, struct sav register_t s; if ((td->td_pcb->pcb_flags & PCB_FPUINITDONE) == 0) { - if (fpu_cleanstate_ready) - bcopy(&fpu_cleanstate, addr, sizeof(fpu_cleanstate)); - else - bzero(addr, sizeof(*addr)); + bcopy(&fpu_cleanstate, addr, sizeof(fpu_cleanstate)); return (_MC_FPOWNED_NONE); } s = intr_disable(); Modified: head/sys/amd64/amd64/trap.c ============================================================================== --- head/sys/amd64/amd64/trap.c Thu Mar 5 16:52:50 2009 (r189411) +++ head/sys/amd64/amd64/trap.c Thu Mar 5 16:56:16 2009 (r189412) @@ -416,13 +416,8 @@ trap(struct trapframe *frame) case T_DNA: /* transparent fault (due to context switch "late") */ - if (fpudna()) - goto userout; - printf("pid %d killed due to lack of floating point\n", - p->p_pid); - i = SIGKILL; - ucode = 0; - break; + fpudna(); + goto userout; case T_FPOPFLT: /* FPU operand fetch fault */ ucode = ILL_COPROC; @@ -450,11 +445,9 @@ trap(struct trapframe *frame) * XXX this should be fatal unless the kernel has * registered such use. */ - if (fpudna()) { - printf("fpudna in kernel mode!\n"); - goto out; - } - break; + fpudna(); + printf("fpudna in kernel mode!\n"); + goto out; case T_STKFLT: /* stack fault */ break; Modified: head/sys/amd64/include/fpu.h ============================================================================== --- head/sys/amd64/include/fpu.h Thu Mar 5 16:52:50 2009 (r189411) +++ head/sys/amd64/include/fpu.h Thu Mar 5 16:56:16 2009 (r189412) @@ -97,7 +97,7 @@ struct savefpu { #define __INITIAL_MXCSR_MASK__ 0xFFBF #ifdef _KERNEL -int fpudna(void); +void fpudna(void); void fpudrop(void); void fpuexit(struct thread *td); int fpuformat(void); From owner-svn-src-head@FreeBSD.ORG Thu Mar 5 18:11: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 37DC1106564A; Thu, 5 Mar 2009 18:11:27 +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 25AB68FC1E; Thu, 5 Mar 2009 18:11:27 +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 n25IBRsY095552; Thu, 5 Mar 2009 18:11:27 GMT (envelope-from alc@svn.freebsd.org) Received: (from alc@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n25IBRj7095551; Thu, 5 Mar 2009 18:11:27 GMT (envelope-from alc@svn.freebsd.org) Message-Id: <200903051811.n25IBRj7095551@svn.freebsd.org> From: Alan Cox Date: Thu, 5 Mar 2009 18:11: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: r189415 - 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: Thu, 05 Mar 2009 18:11:27 -0000 Author: alc Date: Thu Mar 5 18:11:26 2009 New Revision: 189415 URL: http://svn.freebsd.org/changeset/base/189415 Log: Make pmap_copy() more TLB friendly. Specifically, make it use the kernel's direct map instead of the pmap's recursive mapping to access the lowest level in the page table. MFC after: 6 weeks Modified: head/sys/amd64/amd64/pmap.c Modified: head/sys/amd64/amd64/pmap.c ============================================================================== --- head/sys/amd64/amd64/pmap.c Thu Mar 5 18:03:46 2009 (r189414) +++ head/sys/amd64/amd64/pmap.c Thu Mar 5 18:11:26 2009 (r189415) @@ -3481,9 +3481,6 @@ pmap_copy(pmap_t dst_pmap, pmap_t src_pm if (dst_addr != src_addr) return; - if (!pmap_is_current(src_pmap)) - return; - vm_page_lock_queues(); if (dst_pmap < src_pmap) { PMAP_LOCK(dst_pmap); @@ -3545,14 +3542,16 @@ pmap_copy(pmap_t dst_pmap, pmap_t src_pm continue; } - srcmpte = PHYS_TO_VM_PAGE(srcptepaddr & PG_FRAME); + srcptepaddr &= PG_FRAME; + srcmpte = PHYS_TO_VM_PAGE(srcptepaddr); KASSERT(srcmpte->wire_count > 0, ("pmap_copy: source page table page is unused")); if (va_next > end_addr) va_next = end_addr; - src_pte = vtopte(addr); + src_pte = (pt_entry_t *)PHYS_TO_DMAP(srcptepaddr); + src_pte = &src_pte[pmap_pte_index(addr)]; while (addr < va_next) { pt_entry_t ptetemp; ptetemp = *src_pte; From owner-svn-src-head@FreeBSD.ORG Thu Mar 5 18:27: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 051711065673; Thu, 5 Mar 2009 18:27:17 +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 CC31F8FC12; Thu, 5 Mar 2009 18:27:16 +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 n25IRGSe095884; Thu, 5 Mar 2009 18:27:16 GMT (envelope-from attilio@svn.freebsd.org) Received: (from attilio@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n25IRGwZ095883; Thu, 5 Mar 2009 18:27:16 GMT (envelope-from attilio@svn.freebsd.org) Message-Id: <200903051827.n25IRGwZ095883@svn.freebsd.org> From: Attilio Rao Date: Thu, 5 Mar 2009 18:27: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: r189416 - in head/lib/libthread_db: . arch/amd64 arch/i386 arch/ia64 arch/powerpc arch/sparc64 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 05 Mar 2009 18:27:17 -0000 Author: attilio Date: Thu Mar 5 18:27:16 2009 New Revision: 189416 URL: http://svn.freebsd.org/changeset/base/189416 Log: libc_r_* library is no more required, so just axe it. Approved by: marcel, emaste Sponsored by: Sandvine Incorporated Deleted: head/lib/libthread_db/arch/amd64/libc_r_md.c head/lib/libthread_db/arch/i386/libc_r_md.c head/lib/libthread_db/arch/ia64/libc_r_md.c head/lib/libthread_db/arch/powerpc/libc_r_md.c head/lib/libthread_db/arch/sparc64/libc_r_md.c head/lib/libthread_db/libc_r_db.c From owner-svn-src-head@FreeBSD.ORG Thu Mar 5 18:30: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 AB2171065679; Thu, 5 Mar 2009 18:30:50 +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 9820D8FC08; Thu, 5 Mar 2009 18:30:50 +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 n25IUoBa096056; Thu, 5 Mar 2009 18:30:50 GMT (envelope-from kientzle@svn.freebsd.org) Received: (from kientzle@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n25IUoHN096055; Thu, 5 Mar 2009 18:30:50 GMT (envelope-from kientzle@svn.freebsd.org) Message-Id: <200903051830.n25IUoHN096055@svn.freebsd.org> From: Tim Kientzle Date: Thu, 5 Mar 2009 18:30: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: r189417 - head/lib/libarchive/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: Thu, 05 Mar 2009 18:30:51 -0000 Author: kientzle Date: Thu Mar 5 18:30:50 2009 New Revision: 189417 URL: http://svn.freebsd.org/changeset/base/189417 Log: Merge r386,r395,r451 from libarchive.googlecode.com: On Windows, break into the debugger on test setup failures (otherwise, the console window just goes away and you can't see what went wrong). On all platforms, clean up a stray buffer before exiting. Modified: head/lib/libarchive/test/main.c Modified: head/lib/libarchive/test/main.c ============================================================================== --- head/lib/libarchive/test/main.c Thu Mar 5 18:27:16 2009 (r189416) +++ head/lib/libarchive/test/main.c Thu Mar 5 18:30:50 2009 (r189417) @@ -35,6 +35,8 @@ #include #ifdef _WIN32 #include +#include +#include #endif /* @@ -910,10 +912,13 @@ get_refdir(void) strncat(tried, "\n", sizeof(tried) - strlen(tried) - 1); } +#if defined(_WIN32) && defined(_DEBUG) /* You should have to add "$(TargetDir)" to * Properties > Configuration Properties > Debugging > Working Directory, * if you are running libarchive_test.exe on Visual Studio. */ + DebugBreak(); +#endif printf("Unable to locate known reference file %s\n", KNOWNREF); printf(" Checked following directories:\n%s\n", tried); exit(1); @@ -1092,6 +1097,7 @@ int main(int argc, char **argv) i = atoi(*argv); if (**argv < '0' || **argv > '9' || i < 0 || i >= limit) { printf("*** INVALID Test %s\n", *argv); + free(refdir_alloc); usage(progname); } else { if (test_run(i, tmpdir)) From owner-svn-src-head@FreeBSD.ORG Thu Mar 5 18:32: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 A8F9C10656C1; Thu, 5 Mar 2009 18:32:43 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 8C5038FC23; Thu, 5 Mar 2009 18:32:43 +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 n25IWhqv096137; Thu, 5 Mar 2009 18:32:43 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n25IWhNK096134; Thu, 5 Mar 2009 18:32:43 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <200903051832.n25IWhNK096134@svn.freebsd.org> From: John Baldwin Date: Thu, 5 Mar 2009 18:32: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: r189418 - in head/sys/i386: i386 include isa X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 05 Mar 2009 18:32:44 -0000 Author: jhb Date: Thu Mar 5 18:32:43 2009 New Revision: 189418 URL: http://svn.freebsd.org/changeset/base/189418 Log: Some cleanups to the i386 FPU support: - Remove the control word parameter to npxinit(). It was always set to __INITIAL_NPXCW__. - Remove npx_cleanstate_ready as the cleanstate is always initalized when it is used. - Improve the handling of the case when the FPU isn't present. Now the npx0 device no longer succeeds in its probe so all of npx_attach() is skipped. Also, we allow this case with SMP (though that shouldn't actually occur as all i386 systems that support SMP have FPUs) now. SMP was only an issue back when we had an FPU emulator which was not per-CPU. - MFamd64: Clear some of the state in npx_cleanstate rather than leaving it as garbage. - MFamd64: When a user thread first uses the FPU, use npx_cleanstate for the initial FPU state. Reviewed by: bde Modified: head/sys/i386/i386/mp_machdep.c head/sys/i386/include/npx.h head/sys/i386/isa/npx.c Modified: head/sys/i386/i386/mp_machdep.c ============================================================================== --- head/sys/i386/i386/mp_machdep.c Thu Mar 5 18:30:50 2009 (r189417) +++ head/sys/i386/i386/mp_machdep.c Thu Mar 5 18:32:43 2009 (r189418) @@ -575,7 +575,7 @@ init_secondary(void) cpu_setregs(); /* set up FPU state on the AP */ - npxinit(__INITIAL_NPXCW__); + npxinit(); /* set up SSE registers */ enable_sse(); Modified: head/sys/i386/include/npx.h ============================================================================== --- head/sys/i386/include/npx.h Thu Mar 5 18:30:50 2009 (r189417) +++ head/sys/i386/include/npx.h Thu Mar 5 18:32:43 2009 (r189418) @@ -151,7 +151,7 @@ void npxdrop(void); void npxexit(struct thread *td); int npxformat(void); int npxgetregs(struct thread *td, union savefpu *addr); -void npxinit(u_short control); +void npxinit(void); void npxsave(union savefpu *addr); void npxsetregs(struct thread *td, union savefpu *addr); int npxtrap(void); Modified: head/sys/i386/isa/npx.c ============================================================================== --- head/sys/i386/isa/npx.c Thu Mar 5 18:30:50 2009 (r189417) +++ head/sys/i386/isa/npx.c Thu Mar 5 18:32:43 2009 (r189418) @@ -174,7 +174,6 @@ static volatile u_int npx_intrs_while_p static volatile u_int npx_traps_while_probing; static union savefpu npx_cleanstate; -static bool_t npx_cleanstate_ready; static bool_t npx_ex16; static bool_t npx_exists; static bool_t npx_irq13; @@ -376,19 +375,14 @@ npx_probe(dev) return (0); } /* - * Worse, even IRQ13 is broken. Use emulator. + * Worse, even IRQ13 is broken. */ } } - /* - * Probe failed, but we want to get to npxattach to initialize the - * emulator and say that it has been installed. XXX handle devices - * that aren't really devices better. - */ -#ifdef SMP - if (mp_ncpus > 1) - panic("npx0 cannot be emulated on an SMP system"); -#endif + + /* Probe failed. Floating point simply won't work. */ + device_printf(dev, "WARNING: no FPU!\n"); + /* FALLTHROUGH */ no_irq13: idt[IDT_MF] = save_idt_npxtrap; @@ -397,7 +391,7 @@ no_irq13: bus_release_resource(dev, SYS_RES_IRQ, irq_rid, irq_res); } bus_release_resource(dev, SYS_RES_IOPORT, ioport_rid, ioport_res); - return (0); + return (npx_exists ? 0 : ENXIO); } /* @@ -414,32 +408,34 @@ npx_attach(dev) if (npx_irq13) device_printf(dev, "IRQ 13 interface\n"); - else if (!npx_ex16) - device_printf(dev, "WARNING: no FPU!\n"); else if (!device_is_quiet(dev) || bootverbose) device_printf(dev, "INT 16 interface\n"); - npxinit(__INITIAL_NPXCW__); + npxinit(); - if (npx_cleanstate_ready == 0) { - s = intr_disable(); - stop_emulating(); - fpusave(&npx_cleanstate); - start_emulating(); + s = intr_disable(); + stop_emulating(); + fpusave(&npx_cleanstate); + start_emulating(); #ifdef CPU_ENABLE_SSE - if (cpu_fxsr) { - if (npx_cleanstate.sv_xmm.sv_env.en_mxcsr_mask) - cpu_mxcsr_mask = - npx_cleanstate.sv_xmm.sv_env.en_mxcsr_mask; - else - cpu_mxcsr_mask = 0xFFBF; - } + if (cpu_fxsr) { + if (npx_cleanstate.sv_xmm.sv_env.en_mxcsr_mask) + cpu_mxcsr_mask = + npx_cleanstate.sv_xmm.sv_env.en_mxcsr_mask; + else + cpu_mxcsr_mask = 0xFFBF; + bzero(npx_cleanstate.sv_xmm.sv_fp, + sizeof(npx_cleanstate.sv_xmm.sv_fp)); + bzero(npx_cleanstate.sv_xmm.sv_xmm, + sizeof(npx_cleanstate.sv_xmm.sv_xmm)); + /* XXX might need even more zeroing. */ + } else #endif - npx_cleanstate_ready = 1; - intr_restore(s); - } + bzero(npx_cleanstate.sv_87.sv_ac, + sizeof(npx_cleanstate.sv_87.sv_ac)); + intr_restore(s); #ifdef I586_CPU_XXX - if (cpu_class == CPUCLASS_586 && npx_ex16 && npx_exists && + if (cpu_class == CPUCLASS_586 && npx_ex16 && timezero("i586_bzero()", i586_bzero) < timezero("bzero()", bzero) * 4 / 5) { if (!(flags & NPX_DISABLE_I586_OPTIMIZED_BCOPY)) @@ -460,10 +456,11 @@ npx_attach(dev) * Initialize floating point unit. */ void -npxinit(u_short control) +npxinit(void) { static union savefpu dummy; register_t savecrit; + u_short control; if (!npx_exists) return; @@ -480,6 +477,7 @@ npxinit(u_short control) if (cpu_fxsr) fninit(); #endif + control = __INITIAL_NPXCW__; fldcw(&control); start_emulating(); intr_restore(savecrit); @@ -760,14 +758,10 @@ npxtrap() static int err_count = 0; int -npxdna() +npxdna(void) { struct pcb *pcb; register_t s; -#ifdef CPU_ENABLE_SSE - int mxcsr; -#endif - u_short control; if (!npx_exists) return (0); @@ -796,17 +790,9 @@ npxdna() /* * This is the first time this thread has used the FPU or * the PCB doesn't contain a clean FPU state. Explicitly - * initialize the FPU and load the default control word. + * load sanitized registers. */ - fninit(); - control = __INITIAL_NPXCW__; - fldcw(&control); -#ifdef CPU_ENABLE_SSE - if (cpu_fxsr) { - mxcsr = __INITIAL_MXCSR__; - ldmxcsr(mxcsr); - } -#endif + fpurstor(&npx_cleanstate); pcb->pcb_flags |= PCB_NPXINITDONE; } else { /* @@ -904,10 +890,7 @@ npxgetregs(td, addr) return (_MC_FPOWNED_NONE); if ((td->td_pcb->pcb_flags & PCB_NPXINITDONE) == 0) { - if (npx_cleanstate_ready) - bcopy(&npx_cleanstate, addr, sizeof(npx_cleanstate)); - else - bzero(addr, sizeof(*addr)); + bcopy(&npx_cleanstate, addr, sizeof(npx_cleanstate)); return (_MC_FPOWNED_NONE); } s = intr_disable(); From owner-svn-src-head@FreeBSD.ORG Thu Mar 5 18:38: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 3CB87106564A; Thu, 5 Mar 2009 18:38:37 +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 2ADB98FC0C; Thu, 5 Mar 2009 18:38:37 +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 n25Icbwd096289; Thu, 5 Mar 2009 18:38:37 GMT (envelope-from kientzle@svn.freebsd.org) Received: (from kientzle@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n25IcbTo096288; Thu, 5 Mar 2009 18:38:37 GMT (envelope-from kientzle@svn.freebsd.org) Message-Id: <200903051838.n25IcbTo096288@svn.freebsd.org> From: Tim Kientzle Date: Thu, 5 Mar 2009 18:38:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r189419 - head/lib/libarchive 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, 05 Mar 2009 18:38:37 -0000 Author: kientzle Date: Thu Mar 5 18:38:36 2009 New Revision: 189419 URL: http://svn.freebsd.org/changeset/base/189419 Log: Merge r389 from libarchive.googlecode.com: Fix a memory leak in ISO9660 handler structure whenever a file entry has a nonsensical CE offset. Modified: head/lib/libarchive/archive_read_support_format_iso9660.c Modified: head/lib/libarchive/archive_read_support_format_iso9660.c ============================================================================== --- head/lib/libarchive/archive_read_support_format_iso9660.c Thu Mar 5 18:32:43 2009 (r189418) +++ head/lib/libarchive/archive_read_support_format_iso9660.c Thu Mar 5 18:38:36 2009 (r189419) @@ -414,8 +414,10 @@ archive_read_format_iso9660_read_header( /* Get the next entry that appears after the current offset. */ r = next_entry_seek(a, iso9660, &file); - if (r != ARCHIVE_OK) + if (r != ARCHIVE_OK) { + release_file(iso9660, file); return (r); + } iso9660->entry_bytes_remaining = file->size; iso9660->entry_sparse_offset = 0; /* Offset for sparse-file-aware clients. */ @@ -1093,6 +1095,9 @@ release_file(struct iso9660 *iso9660, st { struct file_info *parent; + if (file == NULL) + return; + if (file->refcount == 0) { parent = file->parent; archive_string_free(&file->name); From owner-svn-src-head@FreeBSD.ORG Thu Mar 5 18:43:54 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 8DBEA1065693; Thu, 5 Mar 2009 18:43:54 +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 7C0E48FC1A; Thu, 5 Mar 2009 18:43:54 +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 n25Ihsk8096423; Thu, 5 Mar 2009 18:43:54 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n25Ihs7n096422; Thu, 5 Mar 2009 18:43:54 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <200903051843.n25Ihs7n096422@svn.freebsd.org> From: John Baldwin Date: Thu, 5 Mar 2009 18:43: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: r189420 - head/sys/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: Thu, 05 Mar 2009 18:43:55 -0000 Author: jhb Date: Thu Mar 5 18:43:54 2009 New Revision: 189420 URL: http://svn.freebsd.org/changeset/base/189420 Log: Remove unused arg from npxinit(). Forgot to commit this file in the last i386 FPU change. Modified: head/sys/i386/xen/mp_machdep.c Modified: head/sys/i386/xen/mp_machdep.c ============================================================================== --- head/sys/i386/xen/mp_machdep.c Thu Mar 5 18:38:36 2009 (r189419) +++ head/sys/i386/xen/mp_machdep.c Thu Mar 5 18:43:54 2009 (r189420) @@ -566,7 +566,7 @@ init_secondary(void) invlpg(addr); /* set up FPU state on the AP */ - npxinit(__INITIAL_NPXCW__); + npxinit(); #if 0 /* set up SSE registers */ From owner-svn-src-head@FreeBSD.ORG Thu Mar 5 19:10: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 01C4E1065676; Thu, 5 Mar 2009 19:10:18 +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 E40098FC0A; Thu, 5 Mar 2009 19:10:17 +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 n25JAHBY096976; Thu, 5 Mar 2009 19:10:17 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n25JAHUb096975; Thu, 5 Mar 2009 19:10:17 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <200903051910.n25JAHUb096975@svn.freebsd.org> From: John Baldwin Date: Thu, 5 Mar 2009 19:10:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r189421 - head/sys/isa X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 05 Mar 2009 19:10:18 -0000 Author: jhb Date: Thu Mar 5 19:10:17 2009 New Revision: 189421 URL: http://svn.freebsd.org/changeset/base/189421 Log: Allow syscons to work on amd64 and i386 without any hints: - Enable keyboard autodetection by default for ISA syscons attachments. - If there are no syscons hints at all, assume there is a single sc0 device anyway. The console probe will still fail unless a VGA adapter is found. MFC after: 2 weeks Modified: head/sys/isa/syscons_isa.c Modified: head/sys/isa/syscons_isa.c ============================================================================== --- head/sys/isa/syscons_isa.c Thu Mar 5 18:43:54 2009 (r189420) +++ head/sys/isa/syscons_isa.c Thu Mar 5 19:10:17 2009 (r189421) @@ -101,7 +101,9 @@ scprobe(device_t dev) static int scattach(device_t dev) { - return sc_attach_unit(device_get_unit(dev), device_get_flags(dev)); + + return (sc_attach_unit(device_get_unit(dev), device_get_flags(dev) | + SC_AUTODETECT_KBD)); } static int @@ -238,8 +240,10 @@ sc_get_cons_priority(int *unit, int *fla *flags = f; } } - if (*unit < 0) - return CN_DEAD; + if (*unit < 0) { + *unit = 0; + *flags = 0; + } #if 0 return ((*flags & SC_KERNEL_CONSOLE) ? CN_INTERNAL : CN_NORMAL); #endif From owner-svn-src-head@FreeBSD.ORG Thu Mar 5 19:20: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 DB3B91065678; Thu, 5 Mar 2009 19:20:17 +0000 (UTC) (envelope-from thompsa@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C9DCE8FC0C; Thu, 5 Mar 2009 19:20:17 +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 n25JKHLe097211; Thu, 5 Mar 2009 19:20:17 GMT (envelope-from thompsa@svn.freebsd.org) Received: (from thompsa@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n25JKHPb097210; Thu, 5 Mar 2009 19:20:17 GMT (envelope-from thompsa@svn.freebsd.org) Message-Id: <200903051920.n25JKHPb097210@svn.freebsd.org> From: Andrew Thompson Date: Thu, 5 Mar 2009 19:20:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r189422 - head/sys/dev/usb X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 05 Mar 2009 19:20:18 -0000 Author: thompsa Date: Thu Mar 5 19:20:17 2009 New Revision: 189422 URL: http://svn.freebsd.org/changeset/base/189422 Log: Fix usb2_poll not to return an error number as the function return value is a bitmask of events. Pointed out by: HPS Modified: head/sys/dev/usb/usb_dev.c Modified: head/sys/dev/usb/usb_dev.c ============================================================================== --- head/sys/dev/usb/usb_dev.c Thu Mar 5 19:10:17 2009 (r189421) +++ head/sys/dev/usb/usb_dev.c Thu Mar 5 19:20:17 2009 (r189422) @@ -1072,16 +1072,12 @@ usb2_poll(struct cdev* dev, int events, struct usb2_cdev_privdata* cpd; struct usb2_fifo *f; struct usb2_mbuf *m; - int fflags; - int err, revents; - - err = devfs_get_cdevpriv((void **)&cpd); - if (err != 0) - return (err); + int fflags, revents; - err = usb2_ref_device(cpd, 0 /* no uref */ ); - if (err) - return (POLLHUP); + if (devfs_get_cdevpriv((void **)&cpd) != 0 || + usb2_ref_device(cpd, 0) != 0) + return (events & + (POLLHUP|POLLIN|POLLRDNORM|POLLOUT|POLLWRNORM)); fflags = cpd->fflags; From owner-svn-src-head@FreeBSD.ORG Thu Mar 5 19:42: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 EB0D81065672; Thu, 5 Mar 2009 19:42:11 +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 CFCCF8FC0C; Thu, 5 Mar 2009 19:42:11 +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 n25JgBPF097623; Thu, 5 Mar 2009 19:42:11 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n25JgBh2097613; Thu, 5 Mar 2009 19:42:11 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <200903051942.n25JgBh2097613@svn.freebsd.org> From: John Baldwin Date: Thu, 5 Mar 2009 19:42: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: r189423 - in head/sys: amd64/amd64 amd64/ia32 amd64/include amd64/linux32 compat/linux i386/i386 i386/include i386/isa i386/linux 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, 05 Mar 2009 19:42:12 -0000 Author: jhb Date: Thu Mar 5 19:42:11 2009 New Revision: 189423 URL: http://svn.freebsd.org/changeset/base/189423 Log: A better fix for handling different FPU initial control words for different ABIs: - Store the FPU initial control word in the pcb for each thread. - When first using the FPU, load the initial control word after restoring the clean state if it is not the standard control word. - Provide a correct control word for Linux/i386 binaries under FreeBSD/amd64. - Adjust the control word returned for fpugetregs()/npxgetregs() when a thread hasn't used the FPU yet to reflect the real initial control word for the current ABI. - The Linux/i386 ABI for FreeBSD/i386 now properly sets the right control word instead of trashing whatever the current state of the FPU is. Reviewed by: bde Modified: head/sys/amd64/amd64/fpu.c head/sys/amd64/amd64/machdep.c head/sys/amd64/ia32/ia32_signal.c head/sys/amd64/include/pcb.h head/sys/amd64/linux32/linux32_sysvec.c head/sys/compat/linux/linux_misc.h head/sys/i386/i386/machdep.c head/sys/i386/include/pcb.h head/sys/i386/isa/npx.c head/sys/i386/linux/linux_sysvec.c Modified: head/sys/amd64/amd64/fpu.c ============================================================================== --- head/sys/amd64/amd64/fpu.c Thu Mar 5 19:20:17 2009 (r189422) +++ head/sys/amd64/amd64/fpu.c Thu Mar 5 19:42:11 2009 (r189423) @@ -390,7 +390,6 @@ fpudna(void) { struct pcb *pcb; register_t s; - u_short control; if (PCPU_GET(fpcurthread) == curthread) { printf("fpudna: fpcurthread == curthread %d times\n", @@ -421,10 +420,8 @@ fpudna(void) * explicitly load sanitized registers. */ fxrstor(&fpu_cleanstate); - if (pcb->pcb_flags & PCB_32BIT) { - control = __INITIAL_FPUCW_I386__; - fldcw(&control); - } + if (pcb->pcb_initial_fpucw != __INITIAL_FPUCW__) + fldcw(&pcb->pcb_initial_fpucw); pcb->pcb_flags |= PCB_FPUINITDONE; } else fxrstor(&pcb->pcb_save); @@ -457,6 +454,7 @@ fpugetregs(struct thread *td, struct sav if ((td->td_pcb->pcb_flags & PCB_FPUINITDONE) == 0) { bcopy(&fpu_cleanstate, addr, sizeof(fpu_cleanstate)); + addr->sv_env.en_cw = td->td_pcb->pcb_initial_fpucw; return (_MC_FPOWNED_NONE); } s = intr_disable(); Modified: head/sys/amd64/amd64/machdep.c ============================================================================== --- head/sys/amd64/amd64/machdep.c Thu Mar 5 19:20:17 2009 (r189422) +++ head/sys/amd64/amd64/machdep.c Thu Mar 5 19:42:11 2009 (r189423) @@ -716,7 +716,7 @@ SYSCTL_PROC(_machdep, OID_AUTO, idle, CT idle_sysctl, "A", "currently selected idle function"); /* - * Clear registers on exec + * Reset registers to default values on exec. */ void exec_setregs(td, entry, stack, ps_strings) @@ -743,6 +743,7 @@ exec_setregs(td, entry, stack, ps_string pcb->pcb_es = _udatasel; pcb->pcb_fs = _udatasel; pcb->pcb_gs = _udatasel; + pcb->pcb_initial_fpucw = __INITIAL_FPUCW__; bzero((char *)regs, sizeof(struct trapframe)); regs->tf_rip = entry; Modified: head/sys/amd64/ia32/ia32_signal.c ============================================================================== --- head/sys/amd64/ia32/ia32_signal.c Thu Mar 5 19:20:17 2009 (r189422) +++ head/sys/amd64/ia32/ia32_signal.c Thu Mar 5 19:42:11 2009 (r189423) @@ -729,6 +729,7 @@ ia32_setregs(td, entry, stack, ps_string pcb->pcb_es = _udatasel; pcb->pcb_fs = _udatasel; pcb->pcb_gs = _udatasel; + pcb->pcb_initial_fpucw = __INITIAL_FPUCW_I386__; bzero((char *)regs, sizeof(struct trapframe)); regs->tf_rip = entry; Modified: head/sys/amd64/include/pcb.h ============================================================================== --- head/sys/amd64/include/pcb.h Thu Mar 5 19:20:17 2009 (r189422) +++ head/sys/amd64/include/pcb.h Thu Mar 5 19:42:11 2009 (r189423) @@ -74,6 +74,7 @@ struct pcb { u_int64_t pcb_dr7; struct savefpu pcb_save; + uint16_t pcb_initial_fpucw; caddr_t pcb_onfault; /* copyin/out fault recovery */ Modified: head/sys/amd64/linux32/linux32_sysvec.c ============================================================================== --- head/sys/amd64/linux32/linux32_sysvec.c Thu Mar 5 19:20:17 2009 (r189422) +++ head/sys/amd64/linux32/linux32_sysvec.c Thu Mar 5 19:42:11 2009 (r189423) @@ -841,6 +841,7 @@ exec_linux_setregs(td, entry, stack, ps_ pcb->pcb_es = _udatasel; pcb->pcb_fs = _udatasel; pcb->pcb_gs = _udatasel; + pcb->pcb_initial_fpucw = __LINUX_NPXCW__; bzero((char *)regs, sizeof(struct trapframe)); regs->tf_rip = entry; Modified: head/sys/compat/linux/linux_misc.h ============================================================================== --- head/sys/compat/linux/linux_misc.h Thu Mar 5 19:20:17 2009 (r189422) +++ head/sys/compat/linux/linux_misc.h Thu Mar 5 19:42:11 2009 (r189423) @@ -60,4 +60,9 @@ extern const char *linux_platform; */ #define LINUX_AT_EXECFN 31 /* filename of program */ +/* Linux sets the i387 to extended precision. */ +#if defined(__i386__) || defined(__amd64__) +#define __LINUX_NPXCW__ 0x37f +#endif + #endif /* _LINUX_MISC_H_ */ Modified: head/sys/i386/i386/machdep.c ============================================================================== --- head/sys/i386/i386/machdep.c Thu Mar 5 19:20:17 2009 (r189422) +++ head/sys/i386/i386/machdep.c Thu Mar 5 19:42:11 2009 (r189423) @@ -1362,7 +1362,7 @@ SYSCTL_PROC(_machdep, OID_AUTO, idle, CT idle_sysctl, "A", "currently selected idle function"); /* - * Clear registers on exec + * Reset registers to default values on exec. */ void exec_setregs(td, entry, stack, ps_strings) @@ -1427,6 +1427,7 @@ exec_setregs(td, entry, stack, ps_string * emulators don't provide an entry point for initialization. */ td->td_pcb->pcb_flags &= ~FP_SOFTFP; + pcb->pcb_initial_npxcw = __INITIAL_NPXCW__; /* * Drop the FP state if we hold it, so that the process gets a Modified: head/sys/i386/include/pcb.h ============================================================================== --- head/sys/i386/include/pcb.h Thu Mar 5 19:20:17 2009 (r189422) +++ head/sys/i386/include/pcb.h Thu Mar 5 19:42:11 2009 (r189423) @@ -61,6 +61,7 @@ struct pcb { int pcb_dr7; union savefpu pcb_save; + uint16_t pcb_initial_npxcw; u_int pcb_flags; #define FP_SOFTFP 0x01 /* process using software fltng pnt emulator */ #define PCB_DBREGS 0x02 /* process using debug registers */ Modified: head/sys/i386/isa/npx.c ============================================================================== --- head/sys/i386/isa/npx.c Thu Mar 5 19:20:17 2009 (r189422) +++ head/sys/i386/isa/npx.c Thu Mar 5 19:42:11 2009 (r189423) @@ -141,11 +141,19 @@ void stop_emulating(void); (cpu_fxsr ? \ (thread)->td_pcb->pcb_save.sv_xmm.sv_env.en_sw : \ (thread)->td_pcb->pcb_save.sv_87.sv_env.en_sw) +#define SET_FPU_CW(savefpu, value) do { \ + if (cpu_fxsr) \ + (savefpu)->sv_xmm.sv_env.en_cw = (value); \ + else \ + (savefpu)->sv_87.sv_env.en_cw = (value); \ +} while (0) #else /* CPU_ENABLE_SSE */ #define GET_FPU_CW(thread) \ (thread->td_pcb->pcb_save.sv_87.sv_env.en_cw) #define GET_FPU_SW(thread) \ (thread->td_pcb->pcb_save.sv_87.sv_env.en_sw) +#define SET_FPU_CW(savefpu, value) \ + (savefpu)->sv_87.sv_env.en_cw = (value) #endif /* CPU_ENABLE_SSE */ typedef u_char bool_t; @@ -793,6 +801,8 @@ npxdna(void) * load sanitized registers. */ fpurstor(&npx_cleanstate); + if (pcb->pcb_initial_npxcw != __INITIAL_NPXCW__) + fldcw(&pcb->pcb_initial_npxcw); pcb->pcb_flags |= PCB_NPXINITDONE; } else { /* @@ -891,6 +901,7 @@ npxgetregs(td, addr) if ((td->td_pcb->pcb_flags & PCB_NPXINITDONE) == 0) { bcopy(&npx_cleanstate, addr, sizeof(npx_cleanstate)); + SET_FPU_CW(addr, td->td_pcb->pcb_initial_npxcw); return (_MC_FPOWNED_NONE); } s = intr_disable(); Modified: head/sys/i386/linux/linux_sysvec.c ============================================================================== --- head/sys/i386/linux/linux_sysvec.c Thu Mar 5 19:20:17 2009 (r189422) +++ head/sys/i386/linux/linux_sysvec.c Thu Mar 5 19:42:11 2009 (r189423) @@ -89,9 +89,6 @@ MALLOC_DEFINE(M_LINUX, "linux", "Linux m #define LINUX_SYS_linux_rt_sendsig 0 #define LINUX_SYS_linux_sendsig 0 -#define fldcw(addr) __asm("fldcw %0" : : "m" (*(addr))) -#define __LINUX_NPXCW__ 0x37f - extern char linux_sigcode[]; extern int linux_szsigcode; @@ -930,16 +927,15 @@ static void exec_linux_setregs(struct thread *td, u_long entry, u_long stack, u_long ps_strings) { - static const u_short control = __LINUX_NPXCW__; struct pcb *pcb = td->td_pcb; exec_setregs(td, entry, stack, ps_strings); /* Linux sets %gs to 0, we default to _udatasel */ - pcb->pcb_gs = 0; load_gs(0); + pcb->pcb_gs = 0; + load_gs(0); - /* Linux sets the i387 to extended precision. */ - fldcw(&control); + pcb->pcb_initial_npxcw = __LINUX_NPXCW__; } static void From owner-svn-src-head@FreeBSD.ORG Thu Mar 5 19:46:50 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 1033) id A4F1C1065670; Thu, 5 Mar 2009 19:46:50 +0000 (UTC) Date: Thu, 5 Mar 2009 19:46:50 +0000 From: Alexey Dokuchaev To: Andrew Thompson Message-ID: <20090305194650.GA25469@FreeBSD.org> References: <200903051615.n25GF7kL090002@svn.freebsd.org> Mime-Version: 1.0 Content-Type: text/plain; charset=koi8-r Content-Disposition: inline In-Reply-To: <200903051615.n25GF7kL090002@svn.freebsd.org> User-Agent: Mutt/1.4.2.1i Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r189405 - head/sys/dev/usb/serial 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, 05 Mar 2009 19:46:51 -0000 On Thu, Mar 05, 2009 at 04:15:07PM +0000, Andrew Thompson wrote: > Author: thompsa > Date: Thu Mar 5 16:15:07 2009 > New Revision: 189405 > URL: http://svn.freebsd.org/changeset/base/189405 > > Log: > Add support for the UNION interface descriptor, used by Nokia phones. > > PR: usb/117185 Thanks! ./danfe From owner-svn-src-head@FreeBSD.ORG Thu Mar 5 21:18: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 23DFA106566B; Thu, 5 Mar 2009 21:18:11 +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 CAB708FC17; Thu, 5 Mar 2009 21:18:10 +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 n25LIAGr099477; Thu, 5 Mar 2009 21:18:10 GMT (envelope-from kientzle@svn.freebsd.org) Received: (from kientzle@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n25LIASs099472; Thu, 5 Mar 2009 21:18:10 GMT (envelope-from kientzle@svn.freebsd.org) Message-Id: <200903052118.n25LIASs099472@svn.freebsd.org> From: Tim Kientzle Date: Thu, 5 Mar 2009 21:18:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r189424 - head/lib/libarchive 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, 05 Mar 2009 21:18:12 -0000 Author: kientzle Date: Thu Mar 5 21:18:10 2009 New Revision: 189424 URL: http://svn.freebsd.org/changeset/base/189424 Log: Merge r390,r391,r392,r397 from libarchive.googlecode.com: Virtualize "close" and "finish" across both read and write interfaces. (Someday, "finish" should be renamed to "free" to better reflect what it actually does...) Modified: head/lib/libarchive/archive_private.h head/lib/libarchive/archive_read.c head/lib/libarchive/archive_virtual.c head/lib/libarchive/archive_write.c head/lib/libarchive/archive_write_disk.c Modified: head/lib/libarchive/archive_private.h ============================================================================== --- head/lib/libarchive/archive_private.h Thu Mar 5 19:42:11 2009 (r189423) +++ head/lib/libarchive/archive_private.h Thu Mar 5 21:18:10 2009 (r189424) @@ -52,8 +52,8 @@ #define ARCHIVE_STATE_FATAL 0x8000U struct archive_vtable { - int (*archive_write_close)(struct archive *); - int (*archive_write_finish)(struct archive *); + int (*archive_close)(struct archive *); + int (*archive_finish)(struct archive *); int (*archive_write_header)(struct archive *, struct archive_entry *); int (*archive_write_finish_entry)(struct archive *); Modified: head/lib/libarchive/archive_read.c ============================================================================== --- head/lib/libarchive/archive_read.c Thu Mar 5 19:42:11 2009 (r189423) +++ head/lib/libarchive/archive_read.c Thu Mar 5 21:18:10 2009 (r189424) @@ -57,6 +57,22 @@ __FBSDID("$FreeBSD$"); static int build_stream(struct archive_read *); static int choose_format(struct archive_read *); +static struct archive_vtable *archive_read_vtable(void); +static int _archive_read_close(struct archive *); +static int _archive_read_finish(struct archive *); + +static struct archive_vtable * +archive_read_vtable(void) +{ + static struct archive_vtable av; + static int inited = 0; + + if (!inited) { + av.archive_finish = _archive_read_finish; + av.archive_close = _archive_read_close; + } + return (&av); +} /* * Allocate, initialize and return a struct archive object. @@ -74,6 +90,7 @@ archive_read_new(void) a->archive.state = ARCHIVE_STATE_NEW; a->entry = archive_entry_new(); + a->archive.vtable = archive_read_vtable(); return (&a->archive); } @@ -134,6 +151,7 @@ client_close_proxy(struct archive_read_f if (self->archive->client.closer != NULL) r = (self->archive->client.closer)((struct archive *)self->archive, self->data); + self->data = NULL; return (r); } @@ -556,8 +574,8 @@ archive_read_data_block(struct archive * * Don't assume we actually read anything or performed any non-trivial * initialization. */ -int -archive_read_close(struct archive *_a) +static int +_archive_read_close(struct archive *_a) { struct archive_read *a = (struct archive_read *)_a; int r = ARCHIVE_OK, r1 = ARCHIVE_OK; @@ -602,13 +620,8 @@ archive_read_close(struct archive *_a) /* * Release memory and other resources. */ -#if ARCHIVE_API_VERSION > 1 int -#else -/* Temporarily allow library to compile with either 1.x or 2.0 API. */ -void -#endif -archive_read_finish(struct archive *_a) +_archive_read_finish(struct archive *_a) { struct archive_read *a = (struct archive_read *)_a; int i; Modified: head/lib/libarchive/archive_virtual.c ============================================================================== --- head/lib/libarchive/archive_virtual.c Thu Mar 5 19:42:11 2009 (r189423) +++ head/lib/libarchive/archive_virtual.c Thu Mar 5 21:18:10 2009 (r189424) @@ -33,25 +33,37 @@ __FBSDID("$FreeBSD$"); int archive_write_close(struct archive *a) { - return ((a->vtable->archive_write_close)(a)); + return ((a->vtable->archive_close)(a)); +} + +int +archive_read_close(struct archive *a) +{ + return ((a->vtable->archive_close)(a)); } #if ARCHIVE_API_VERSION > 1 int archive_write_finish(struct archive *a) { - return ((a->vtable->archive_write_finish)(a)); + return ((a->vtable->archive_finish)(a)); } #else /* Temporarily allow library to compile with either 1.x or 2.0 API. */ void archive_write_finish(struct archive *a) { - (void)(a->vtable->archive_write_finish)(a); + (void)(a->vtable->archive_finish)(a); } #endif int +archive_read_finish(struct archive *a) +{ + return ((a->vtable->archive_finish)(a)); +} + +int archive_write_header(struct archive *a, struct archive_entry *entry) { return ((a->vtable->archive_write_header)(a, entry)); Modified: head/lib/libarchive/archive_write.c ============================================================================== --- head/lib/libarchive/archive_write.c Thu Mar 5 19:42:11 2009 (r189423) +++ head/lib/libarchive/archive_write.c Thu Mar 5 21:18:10 2009 (r189424) @@ -72,8 +72,8 @@ archive_write_vtable(void) static int inited = 0; if (!inited) { - av.archive_write_close = _archive_write_close; - av.archive_write_finish = _archive_write_finish; + av.archive_close = _archive_write_close; + av.archive_finish = _archive_write_finish; av.archive_write_header = _archive_write_header; av.archive_write_finish_entry = _archive_write_finish_entry; av.archive_write_data = _archive_write_data; Modified: head/lib/libarchive/archive_write_disk.c ============================================================================== --- head/lib/libarchive/archive_write_disk.c Thu Mar 5 19:42:11 2009 (r189423) +++ head/lib/libarchive/archive_write_disk.c Thu Mar 5 21:18:10 2009 (r189424) @@ -278,8 +278,8 @@ archive_write_disk_vtable(void) static int inited = 0; if (!inited) { - av.archive_write_close = _archive_write_close; - av.archive_write_finish = _archive_write_finish; + av.archive_close = _archive_write_close; + av.archive_finish = _archive_write_finish; av.archive_write_header = _archive_write_header; av.archive_write_finish_entry = _archive_write_finish_entry; av.archive_write_data = _archive_write_data; From owner-svn-src-head@FreeBSD.ORG Fri Mar 6 04:21: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 A07A410656DB; Fri, 6 Mar 2009 04:21:23 +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 73DE58FC14; Fri, 6 Mar 2009 04:21:23 +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 n264LNDX007728; Fri, 6 Mar 2009 04:21:23 GMT (envelope-from kientzle@svn.freebsd.org) Received: (from kientzle@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n264LNvU007726; Fri, 6 Mar 2009 04:21:23 GMT (envelope-from kientzle@svn.freebsd.org) Message-Id: <200903060421.n264LNvU007726@svn.freebsd.org> From: Tim Kientzle Date: Fri, 6 Mar 2009 04:21:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r189427 - in head/lib/libarchive: . 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: Fri, 06 Mar 2009 04:21:24 -0000 Author: kientzle Date: Fri Mar 6 04:21:23 2009 New Revision: 189427 URL: http://svn.freebsd.org/changeset/base/189427 Log: Merge r394,r396 from libarchive.googlecode.com: Plug some memory leaks in the ACL test, correctly mark that FreeBSD has acl_get_perm_np(). Modified: head/lib/libarchive/config_freebsd.h head/lib/libarchive/test/test_acl_freebsd.c Modified: head/lib/libarchive/config_freebsd.h ============================================================================== --- head/lib/libarchive/config_freebsd.h Fri Mar 6 01:34:30 2009 (r189426) +++ head/lib/libarchive/config_freebsd.h Fri Mar 6 04:21:23 2009 (r189427) @@ -28,6 +28,7 @@ /* FreeBSD 5.0 and later have ACL support. */ #if __FreeBSD__ > 4 #define HAVE_ACL_CREATE_ENTRY 1 +#define HAVE_ACL_GET_PERM_NP 1 #define HAVE_ACL_INIT 1 #define HAVE_ACL_SET_FD 1 #define HAVE_ACL_SET_FD_NP 1 Modified: head/lib/libarchive/test/test_acl_freebsd.c ============================================================================== --- head/lib/libarchive/test/test_acl_freebsd.c Fri Mar 6 01:34:30 2009 (r189426) +++ head/lib/libarchive/test/test_acl_freebsd.c Fri Mar 6 04:21:23 2009 (r189427) @@ -72,6 +72,8 @@ set_acls(struct archive_entry *ae, struc static int acl_match(acl_entry_t aclent, struct myacl_t *myacl) { + gid_t g, *gp; + uid_t u, *up; acl_tag_t tag_type; acl_permset_t opaque_ps; int permset = 0; @@ -97,7 +99,10 @@ acl_match(acl_entry_t aclent, struct mya case ACL_USER: if (myacl->tag != ARCHIVE_ENTRY_ACL_USER) return (0); - if ((uid_t)myacl->qual != *(uid_t *)acl_get_qualifier(aclent)) + up = acl_get_qualifier(aclent); + u = *up; + acl_free(up); + if ((uid_t)myacl->qual != u) return (0); break; case ACL_GROUP_OBJ: @@ -106,7 +111,10 @@ acl_match(acl_entry_t aclent, struct mya case ACL_GROUP: if (myacl->tag != ARCHIVE_ENTRY_ACL_GROUP) return (0); - if ((gid_t)myacl->qual != *(gid_t *)acl_get_qualifier(aclent)) + gp = acl_get_qualifier(aclent); + g = *gp; + acl_free(gp); + if ((gid_t)myacl->qual != g) return (0); break; case ACL_MASK: @@ -200,10 +208,13 @@ DEFINE_TEST(test_acl_freebsd) /* Create a test file and try to set an ACL on it. */ fd = open("pretest", O_WRONLY | O_CREAT | O_EXCL, 0777); failure("Could not create test file?!"); - if (!assert(fd >= 0)) + if (!assert(fd >= 0)) { + acl_free(acl); return; + } n = acl_set_fd(fd, acl); + acl_free(acl); if (n != 0 && errno == EOPNOTSUPP) { close(fd); skipping("ACL tests require that ACL support be enabled on the filesystem"); @@ -239,5 +250,6 @@ DEFINE_TEST(test_acl_freebsd) acl = acl_get_file("test0", ACL_TYPE_ACCESS); assert(acl != (acl_t)NULL); compare_acls(acl, acls2); + acl_free(acl); #endif } From owner-svn-src-head@FreeBSD.ORG Fri Mar 6 04:22: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 C927B106566C; Fri, 6 Mar 2009 04:22:34 +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 B75688FC1D; Fri, 6 Mar 2009 04:22:34 +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 n264MYoU007795; Fri, 6 Mar 2009 04:22:34 GMT (envelope-from kientzle@svn.freebsd.org) Received: (from kientzle@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n264MY3l007794; Fri, 6 Mar 2009 04:22:34 GMT (envelope-from kientzle@svn.freebsd.org) Message-Id: <200903060422.n264MY3l007794@svn.freebsd.org> From: Tim Kientzle Date: Fri, 6 Mar 2009 04:22: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: r189428 - head/lib/libarchive 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, 06 Mar 2009 04:22:35 -0000 Author: kientzle Date: Fri Mar 6 04:22:34 2009 New Revision: 189428 URL: http://svn.freebsd.org/changeset/base/189428 Log: Merge r398 from libarchive.googlecode.com: Check that bidder object was allocated before we try to use it. Modified: head/lib/libarchive/archive_read_support_compression_program.c Modified: head/lib/libarchive/archive_read_support_compression_program.c ============================================================================== --- head/lib/libarchive/archive_read_support_compression_program.c Fri Mar 6 04:21:23 2009 (r189427) +++ head/lib/libarchive/archive_read_support_compression_program.c Fri Mar 6 04:22:34 2009 (r189428) @@ -109,12 +109,12 @@ archive_read_support_compression_program struct archive_read_filter_bidder *bidder = __archive_read_get_bidder(a); struct program_bidder *state; - state = (struct program_bidder *)calloc(sizeof (*state), 1); + if (bidder == NULL) + return (ARCHIVE_FATAL); + state = (struct program_bidder *)calloc(sizeof (*state), 1); if (state == NULL) return (ARCHIVE_FATAL); - if (bidder == NULL) - return (ARCHIVE_FATAL); state->cmd = strdup(cmd); state->bid = INT_MAX; From owner-svn-src-head@FreeBSD.ORG Fri Mar 6 04:35: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 BFF8D106566C; Fri, 6 Mar 2009 04:35:31 +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 ABF7E8FC0A; Fri, 6 Mar 2009 04:35:31 +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 n264ZV4Z008099; Fri, 6 Mar 2009 04:35:31 GMT (envelope-from kientzle@svn.freebsd.org) Received: (from kientzle@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n264ZVhT008091; Fri, 6 Mar 2009 04:35:31 GMT (envelope-from kientzle@svn.freebsd.org) Message-Id: <200903060435.n264ZVhT008091@svn.freebsd.org> From: Tim Kientzle Date: Fri, 6 Mar 2009 04:35:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r189429 - in head/lib/libarchive: . 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: Fri, 06 Mar 2009 04:35:32 -0000 Author: kientzle Date: Fri Mar 6 04:35:31 2009 New Revision: 189429 URL: http://svn.freebsd.org/changeset/base/189429 Log: Merge r399,401,402,405,415,430,440,452,453,458,506,533,536,538,544,590 from libarchive.googlecode.com: Add a new "archive_read_disk" API that provides the important service of reading metadata from the disk. In particular, this will make it possible to remove all knowledge of extended attributes, ACLs, etc, from clients such as bsdtar and bsdcpio. Closely related, this API also provides pluggable uid->uname and gid->gname lookup and caching services similar to the uname->uid and gname->gid services provided by archive_write_disk. Remember this is also required for correct ACL management. Documentation is still pending... Added: head/lib/libarchive/archive_read_disk.c (contents, props changed) head/lib/libarchive/archive_read_disk_entry_from_file.c (contents, props changed) head/lib/libarchive/archive_read_disk_private.h (contents, props changed) head/lib/libarchive/archive_read_disk_set_standard_lookup.c (contents, props changed) head/lib/libarchive/test/test_read_disk.c (contents, props changed) Modified: head/lib/libarchive/Makefile head/lib/libarchive/archive.h head/lib/libarchive/archive_private.h head/lib/libarchive/config_freebsd.h head/lib/libarchive/test/Makefile Modified: head/lib/libarchive/Makefile ============================================================================== --- head/lib/libarchive/Makefile Fri Mar 6 04:22:34 2009 (r189428) +++ head/lib/libarchive/Makefile Fri Mar 6 04:35:31 2009 (r189429) @@ -25,6 +25,9 @@ SRCS= archive_check_magic.c \ archive_entry_link_resolver.c \ archive_read.c \ archive_read_data_into_fd.c \ + archive_read_disk.c \ + archive_read_disk_entry_from_file.c \ + archive_read_disk_set_standard_lookup.c \ archive_read_extract.c \ archive_read_open_fd.c \ archive_read_open_file.c \ Modified: head/lib/libarchive/archive.h ============================================================================== --- head/lib/libarchive/archive.h Fri Mar 6 04:22:34 2009 (r189428) +++ head/lib/libarchive/archive.h Fri Mar 6 04:35:31 2009 (r189429) @@ -36,6 +36,7 @@ * platform macros. */ +#include #include /* Linux requires this for off_t */ #if !defined(__WATCOMC__) && !defined(_MSC_VER) /* Header unavailable on Watcom C or MS Visual C++. */ @@ -605,6 +606,40 @@ __LA_DECL int archive_write_disk_set_us void (* /* cleanup */)(void *)); /* + * ARCHIVE_READ_DISK API + * + * This is still evolving and somewhat experimental. + */ +__LA_DECL struct archive *archive_read_disk_new(void); +/* The names for symlink modes here correspond to an old BSD + * command-line argument convention: -L, -P, -H */ +/* Follow all symlinks. */ +__LA_DECL int archive_read_disk_set_symlink_logical(struct archive *); +/* Follow no symlinks. */ +__LA_DECL int archive_read_disk_set_symlink_physical(struct archive *); +/* Follow symlink initially, then not. */ +__LA_DECL int archive_read_disk_set_symlink_hybrid(struct archive *); +/* TODO: Handle Linux stat32/stat64 ugliness. */ +__LA_DECL int archive_read_disk_entry_from_file(struct archive *, + struct archive_entry *, int /* fd */, const struct stat *); +/* Look up gname for gid or uname for uid. */ +/* Default implementations are very, very stupid. */ +__LA_DECL const char *archive_read_disk_gname(struct archive *, __LA_GID_T); +__LA_DECL const char *archive_read_disk_uname(struct archive *, __LA_UID_T); +/* "Standard" implementation uses getpwuid_r, getgrgid_r and caches the + * results for performance. */ +__LA_DECL int archive_read_disk_set_standard_lookup(struct archive *); +/* You can install your own lookups if you like. */ +__LA_DECL int archive_read_disk_set_gname_lookup(struct archive *, + void * /* private_data */, + const char *(* /* lookup_fn */)(void *, __LA_GID_T), + void (* /* cleanup_fn */)(void *)); +__LA_DECL int archive_read_disk_set_uname_lookup(struct archive *, + void * /* private_data */, + const char *(* /* lookup_fn */)(void *, __LA_UID_T), + void (* /* cleanup_fn */)(void *)); + +/* * Accessor functions to read/set various information in * the struct archive object: */ Modified: head/lib/libarchive/archive_private.h ============================================================================== --- head/lib/libarchive/archive_private.h Fri Mar 6 04:22:34 2009 (r189428) +++ head/lib/libarchive/archive_private.h Fri Mar 6 04:35:31 2009 (r189429) @@ -41,6 +41,7 @@ #define ARCHIVE_WRITE_MAGIC (0xb0c5c0deU) #define ARCHIVE_READ_MAGIC (0xdeb0c5U) #define ARCHIVE_WRITE_DISK_MAGIC (0xc001b0c5U) +#define ARCHIVE_READ_DISK_MAGIC (0xbadb0c5U) #define ARCHIVE_STATE_ANY 0xFFFFU #define ARCHIVE_STATE_NEW 1U Added: head/lib/libarchive/archive_read_disk.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/lib/libarchive/archive_read_disk.c Fri Mar 6 04:35:31 2009 (r189429) @@ -0,0 +1,198 @@ +/*- + * Copyright (c) 2003-2009 Tim Kientzle + * 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 + * in this position and unchanged. + * 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(S) ``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(S) 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 "archive_platform.h" +__FBSDID("$FreeBSD$"); + +#include "archive.h" +#include "archive_string.h" +#include "archive_entry.h" +#include "archive_private.h" +#include "archive_read_disk_private.h" + +static int _archive_read_finish(struct archive *); +static int _archive_read_close(struct archive *); +static const char *trivial_lookup_gname(void *, gid_t gid); +static const char *trivial_lookup_uname(void *, uid_t uid); + +static struct archive_vtable * +archive_read_disk_vtable(void) +{ + static struct archive_vtable av; + static int inited = 0; + + if (!inited) { + av.archive_finish = _archive_read_finish; + av.archive_close = _archive_read_close; + } + return (&av); +} + +const char * +archive_read_disk_gname(struct archive *_a, gid_t gid) +{ + struct archive_read_disk *a = (struct archive_read_disk *)_a; + if (a->lookup_gname != NULL) + return ((*a->lookup_gname)(a->lookup_gname_data, gid)); + return (NULL); +} + +const char * +archive_read_disk_uname(struct archive *_a, uid_t uid) +{ + struct archive_read_disk *a = (struct archive_read_disk *)_a; + if (a->lookup_uname != NULL) + return ((*a->lookup_uname)(a->lookup_uname_data, uid)); + return (NULL); +} + +int +archive_read_disk_set_gname_lookup(struct archive *_a, + void *private_data, + const char * (*lookup_gname)(void *private, gid_t gid), + void (*cleanup_gname)(void *private)) +{ + struct archive_read_disk *a = (struct archive_read_disk *)_a; + __archive_check_magic(&a->archive, ARCHIVE_READ_DISK_MAGIC, + ARCHIVE_STATE_ANY, "archive_read_disk_set_gname_lookup"); + + if (a->cleanup_gname != NULL && a->lookup_gname_data != NULL) + (a->cleanup_gname)(a->lookup_gname_data); + + a->lookup_gname = lookup_gname; + a->cleanup_gname = cleanup_gname; + a->lookup_gname_data = private_data; + return (ARCHIVE_OK); +} + +int +archive_read_disk_set_uname_lookup(struct archive *_a, + void *private_data, + const char * (*lookup_uname)(void *private, uid_t uid), + void (*cleanup_uname)(void *private)) +{ + struct archive_read_disk *a = (struct archive_read_disk *)_a; + __archive_check_magic(&a->archive, ARCHIVE_READ_DISK_MAGIC, + ARCHIVE_STATE_ANY, "archive_read_disk_set_uname_lookup"); + + if (a->cleanup_uname != NULL && a->lookup_uname_data != NULL) + (a->cleanup_uname)(a->lookup_uname_data); + + a->lookup_uname = lookup_uname; + a->cleanup_uname = cleanup_uname; + a->lookup_uname_data = private_data; + return (ARCHIVE_OK); +} + +/* + * Create a new archive_read_disk object and initialize it with global state. + */ +struct archive * +archive_read_disk_new(void) +{ + struct archive_read_disk *a; + + a = (struct archive_read_disk *)malloc(sizeof(*a)); + if (a == NULL) + return (NULL); + memset(a, 0, sizeof(*a)); + a->archive.magic = ARCHIVE_READ_DISK_MAGIC; + /* We're ready to write a header immediately. */ + a->archive.state = ARCHIVE_STATE_HEADER; + a->archive.vtable = archive_read_disk_vtable(); + a->lookup_uname = trivial_lookup_uname; + a->lookup_gname = trivial_lookup_gname; + return (&a->archive); +} + +static int +_archive_read_finish(struct archive *_a) +{ + struct archive_read_disk *a = (struct archive_read_disk *)_a; + + if (a->cleanup_gname != NULL && a->lookup_gname_data != NULL) + (a->cleanup_gname)(a->lookup_gname_data); + if (a->cleanup_uname != NULL && a->lookup_uname_data != NULL) + (a->cleanup_uname)(a->lookup_uname_data); + archive_string_free(&a->archive.error_string); + free(a); + return (ARCHIVE_OK); +} + +static int +_archive_read_close(struct archive *_a) +{ + (void)_a; /* UNUSED */ + return (ARCHIVE_OK); +} + +int +archive_read_disk_set_symlink_logical(struct archive *_a) +{ + struct archive_read_disk *a = (struct archive_read_disk *)_a; + a->symlink_mode = 'L'; + a->follow_symlinks = 1; + return (ARCHIVE_OK); +} + +int +archive_read_disk_set_symlink_physical(struct archive *_a) +{ + struct archive_read_disk *a = (struct archive_read_disk *)_a; + a->symlink_mode = 'P'; + a->follow_symlinks = 0; + return (ARCHIVE_OK); +} + +int +archive_read_disk_set_symlink_hybrid(struct archive *_a) +{ + struct archive_read_disk *a = (struct archive_read_disk *)_a; + a->symlink_mode = 'H'; + a->follow_symlinks = 1; /* Follow symlinks initially. */ + return (ARCHIVE_OK); +} + +/* + * Trivial implementations of gname/uname lookup functions. + * These are normally overridden by the client, but these stub + * versions ensure that we always have something that works. + */ +static const char * +trivial_lookup_gname(void *private_data, gid_t gid) +{ + (void)private_data; /* UNUSED */ + (void)gid; /* UNUSED */ + return (NULL); +} + +static const char * +trivial_lookup_uname(void *private_data, uid_t uid) +{ + (void)private_data; /* UNUSED */ + (void)uid; /* UNUSED */ + return (NULL); +} Added: head/lib/libarchive/archive_read_disk_entry_from_file.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/lib/libarchive/archive_read_disk_entry_from_file.c Fri Mar 6 04:35:31 2009 (r189429) @@ -0,0 +1,537 @@ +/*- + * Copyright (c) 2003-2009 Tim Kientzle + * 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(S) ``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(S) 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 "archive_platform.h" +__FBSDID("$FreeBSD$"); + +#ifdef HAVE_SYS_TYPES_H +/* Mac OSX requires sys/types.h before sys/acl.h. */ +#include +#endif +#ifdef HAVE_SYS_ACL_H +#include +#endif +#ifdef HAVE_SYS_EXTATTR_H +#include +#endif +#ifdef HAVE_SYS_PARAM_H +#include +#endif +#ifdef HAVE_SYS_STAT_H +#include +#endif +#ifdef HAVE_ACL_LIBACL_H +#include +#endif +#ifdef HAVE_ATTR_XATTR_H +#include +#endif +#ifdef HAVE_ERRNO_H +#include +#endif +#ifdef HAVE_LIMITS_H +#include +#endif +#ifdef HAVE_WINDOWS_H +#include +#endif + +#include "archive.h" +#include "archive_entry.h" +#include "archive_private.h" +#include "archive_read_disk_private.h" + +/* + * Linux and FreeBSD plug this obvious hole in POSIX.1e in + * different ways. + */ +#if HAVE_ACL_GET_PERM +#define ACL_GET_PERM acl_get_perm +#elif HAVE_ACL_GET_PERM_NP +#define ACL_GET_PERM acl_get_perm_np +#endif + +static int setup_acls_posix1e(struct archive_read_disk *, + struct archive_entry *, int fd); +static int setup_xattrs(struct archive_read_disk *, + struct archive_entry *, int fd); + +int +archive_read_disk_entry_from_file(struct archive *_a, + struct archive_entry *entry, + int fd, const struct stat *st) +{ + struct archive_read_disk *a = (struct archive_read_disk *)_a; + const char *path; + struct stat s; + int initial_fd = fd; + int r, r1; + + path = archive_entry_sourcepath(entry); + if (path == NULL) + path = archive_entry_pathname(entry); + +#ifdef EXT2_IOC_GETFLAGS + /* Linux requires an extra ioctl to pull the flags. Although + * this is an extra step, it has a nice side-effect: We get an + * open file descriptor which we can use in the subsequent lookups. */ + if ((S_ISREG(st->st_mode) || S_ISDIR(st->st_mode))) { + if (fd < 0) + fd = open(pathname, O_RDONLY | O_NONBLOCK); + if (fd >= 0) { + unsigned long stflags; + int r = ioctl(fd, EXT2_IOC_GETFLAGS, &stflags); + if (r == 0 && stflags != 0) + archive_entry_set_fflags(entry, stflags, 0); + } + } +#endif + + if (st == NULL) { +#if HAVE_FSTAT + if (fd >= 0) { + if (fstat(fd, &s) != 0) + return (ARCHIVE_FATAL); + } else +#endif +#if HAVE_LSTAT + if (!a->follow_symlinks) { + if (lstat(path, &s) != 0) + return (ARCHIVE_FATAL); + } else +#endif + if (stat(path, &s) != 0) + return (ARCHIVE_FATAL); + st = &s; + } + archive_entry_copy_stat(entry, st); + +#ifdef HAVE_STRUCT_STAT_ST_FLAGS + /* On FreeBSD, we get flags for free with the stat. */ + /* TODO: Does this belong in copy_stat()? */ + if (st->st_flags != 0) + archive_entry_set_fflags(entry, st->st_flags, 0); +#endif + +#ifdef HAVE_READLINK + if (S_ISLNK(st->st_mode)) { + char linkbuffer[PATH_MAX + 1]; + int lnklen = readlink(path, linkbuffer, PATH_MAX); + if (lnklen < 0) { + archive_set_error(&a->archive, errno, + "Couldn't read link data"); + return (ARCHIVE_WARN); + } + linkbuffer[lnklen] = 0; + archive_entry_set_symlink(entry, linkbuffer); + } +#endif + + r = setup_acls_posix1e(a, entry, fd); + r1 = setup_xattrs(a, entry, fd); + if (r1 < r) + r = r1; + /* If we opened the file earlier in this function, close it. */ + if (initial_fd != fd) + close(fd); + return (r); +} + +#ifdef HAVE_POSIX_ACL +static void setup_acl_posix1e(struct archive_read_disk *a, + struct archive_entry *entry, acl_t acl, int archive_entry_acl_type); + +static int +setup_acls_posix1e(struct archive_read_disk *a, + struct archive_entry *entry, int fd) +{ + const char *accpath; + acl_t acl; + + accpath = archive_entry_sourcepath(entry); + if (accpath == NULL) + accpath = archive_entry_pathname(entry); + + archive_entry_acl_clear(entry); + + /* Retrieve access ACL from file. */ + if (fd >= 0) + acl = acl_get_fd(fd); +#if HAVE_ACL_GET_LINK_NP + else if (!a->follow_symlinks) + acl = acl_get_link_np(accpath, ACL_TYPE_ACCESS); +#endif + else + acl = acl_get_file(accpath, ACL_TYPE_ACCESS); + if (acl != NULL) { + setup_acl_posix1e(a, entry, acl, + ARCHIVE_ENTRY_ACL_TYPE_ACCESS); + acl_free(acl); + } + + /* Only directories can have default ACLs. */ + if (S_ISDIR(archive_entry_mode(entry))) { + acl = acl_get_file(accpath, ACL_TYPE_DEFAULT); + if (acl != NULL) { + setup_acl_posix1e(a, entry, acl, + ARCHIVE_ENTRY_ACL_TYPE_DEFAULT); + acl_free(acl); + } + } + return (ARCHIVE_OK); +} + +/* + * Translate POSIX.1e ACL into libarchive internal structure. + */ +static void +setup_acl_posix1e(struct archive_read_disk *a, + struct archive_entry *entry, acl_t acl, int archive_entry_acl_type) +{ + acl_tag_t acl_tag; + acl_entry_t acl_entry; + acl_permset_t acl_permset; + int s, ae_id, ae_tag, ae_perm; + const char *ae_name; + + s = acl_get_entry(acl, ACL_FIRST_ENTRY, &acl_entry); + while (s == 1) { + ae_id = -1; + ae_name = NULL; + + acl_get_tag_type(acl_entry, &acl_tag); + if (acl_tag == ACL_USER) { + ae_id = (int)*(uid_t *)acl_get_qualifier(acl_entry); + ae_name = archive_read_disk_uname(&a->archive, ae_id); + ae_tag = ARCHIVE_ENTRY_ACL_USER; + } else if (acl_tag == ACL_GROUP) { + ae_id = (int)*(gid_t *)acl_get_qualifier(acl_entry); + ae_name = archive_read_disk_gname(&a->archive, ae_id); + ae_tag = ARCHIVE_ENTRY_ACL_GROUP; + } else if (acl_tag == ACL_MASK) { + ae_tag = ARCHIVE_ENTRY_ACL_MASK; + } else if (acl_tag == ACL_USER_OBJ) { + ae_tag = ARCHIVE_ENTRY_ACL_USER_OBJ; + } else if (acl_tag == ACL_GROUP_OBJ) { + ae_tag = ARCHIVE_ENTRY_ACL_GROUP_OBJ; + } else if (acl_tag == ACL_OTHER) { + ae_tag = ARCHIVE_ENTRY_ACL_OTHER; + } else { + /* Skip types that libarchive can't support. */ + continue; + } + + acl_get_permset(acl_entry, &acl_permset); + ae_perm = 0; + /* + * acl_get_perm() is spelled differently on different + * platforms; see above. + */ + if (ACL_GET_PERM(acl_permset, ACL_EXECUTE)) + ae_perm |= ARCHIVE_ENTRY_ACL_EXECUTE; + if (ACL_GET_PERM(acl_permset, ACL_READ)) + ae_perm |= ARCHIVE_ENTRY_ACL_READ; + if (ACL_GET_PERM(acl_permset, ACL_WRITE)) + ae_perm |= ARCHIVE_ENTRY_ACL_WRITE; + + archive_entry_acl_add_entry(entry, + archive_entry_acl_type, ae_perm, ae_tag, + ae_id, ae_name); + + s = acl_get_entry(acl, ACL_NEXT_ENTRY, &acl_entry); + } +} +#else +static int +setup_acls_posix1e(struct archive_read_disk *a, + struct archive_entry *entry, int fd) +{ + (void)a; /* UNUSED */ + (void)entry; /* UNUSED */ + (void)fd; /* UNUSED */ + return (ARCHIVE_OK); +} +#endif + +#if HAVE_LISTXATTR && HAVE_LLISTXATTR && HAVE_GETXATTR && HAVE_LGETXATTR + +/* + * Linux extended attribute support. + * + * TODO: By using a stack-allocated buffer for the first + * call to getxattr(), we might be able to avoid the second + * call entirely. We only need the second call if the + * stack-allocated buffer is too small. But a modest buffer + * of 1024 bytes or so will often be big enough. Same applies + * to listxattr(). + */ + + +static int +setup_xattr(struct archive_read_disk *a, + struct archive_entry *entry, const char *name, int fd) +{ + ssize_t size; + void *value = NULL; + const char *accpath; + + (void)fd; /* UNUSED */ + + accpath = archive_entry_sourcepath(entry); + if (accpath == NULL) + accpath = archive_entry_pathname(entry); + + if (!a->follow_symlinks) + size = lgetxattr(accpath, name, NULL, 0); + else + size = getxattr(accpath, name, NULL, 0); + + if (size == -1) { + archive_set_error(&a->archive, errno, + "Couldn't query extended attribute"); + return (ARCHIVE_WARN); + } + + if (size > 0 && (value = malloc(size)) == NULL) { + archive_set_error(&a->archive, errno, "Out of memory"); + return (ARCHIVE_FATAL); + } + + if (!a->follow_symlinks) + size = lgetxattr(accpath, name, value, size); + else + size = getxattr(accpath, name, value, size); + + if (size == -1) { + archive_set_error(&a->archive, errno, + "Couldn't read extended attribute"); + return (ARCHIVE_WARN); + } + + archive_entry_xattr_add_entry(entry, name, value, size); + + free(value); + return (ARCHIVE_OK); +} + +static int +setup_xattrs(struct archive_read_disk *a, + struct archive_entry *entry, int fd) +{ + char *list, *p; + const char *path; + ssize_t list_size; + + + path = archive_entry_sourcepath(entry); + if (path == NULL) + path = archive_entry_pathname(entry); + + if (!a->follow_symlinks) + list_size = llistxattr(path, NULL, 0); + else + list_size = listxattr(path, NULL, 0); + + if (list_size == -1) { + if (errno == ENOTSUP) + return (ARCHIVE_OK); + archive_set_error(&a->archive, errno, + "Couldn't list extended attributes"); + return (ARCHIVE_WARN); + } + + if (list_size == 0) + return (ARCHIVE_OK); + + if ((list = malloc(list_size)) == NULL) { + archive_set_error(&a->archive, errno, "Out of memory"); + return (ARCHIVE_FATAL); + } + + if (!a->follow_symlinks) + list_size = llistxattr(path, list, list_size); + else + list_size = listxattr(path, list, list_size); + + if (list_size == -1) { + archive_set_error(&a->archive, errno, + "Couldn't retrieve extended attributes"); + free(list); + return (ARCHIVE_WARN); + } + + for (p = list; (p - list) < list_size; p += strlen(p) + 1) { + if (strncmp(p, "system.", 7) == 0 || + strncmp(p, "xfsroot.", 8) == 0) + continue; + setup_xattr(a, entry, p, fd); + } + + free(list); + return (ARCHIVE_OK); +} + +#elif HAVE_EXTATTR_GET_FILE && HAVE_EXTATTR_LIST_FILE + +/* + * FreeBSD extattr interface. + */ + +/* TODO: Implement this. Follow the Linux model above, but + * with FreeBSD-specific system calls, of course. Be careful + * to not include the system extattrs that hold ACLs; we handle + * those separately. + */ +int +setup_xattr(struct archive_read_disk *a, struct archive_entry *entry, + int namespace, const char *name, const char *fullname, int fd); + +int +setup_xattr(struct archive_read_disk *a, struct archive_entry *entry, + int namespace, const char *name, const char *fullname, int fd) +{ + ssize_t size; + void *value = NULL; + const char *accpath; + + (void)fd; /* UNUSED */ + + accpath = archive_entry_sourcepath(entry); + if (accpath == NULL) + accpath = archive_entry_pathname(entry); + + if (!a->follow_symlinks) + size = extattr_get_link(accpath, namespace, name, NULL, 0); + else + size = extattr_get_file(accpath, namespace, name, NULL, 0); + + if (size == -1) { + archive_set_error(&a->archive, errno, + "Couldn't query extended attribute"); + return (ARCHIVE_WARN); + } + + if (size > 0 && (value = malloc(size)) == NULL) { + archive_set_error(&a->archive, errno, "Out of memory"); + return (ARCHIVE_FATAL); + } + + if (!a->follow_symlinks) + size = extattr_get_link(accpath, namespace, name, value, size); + else + size = extattr_get_file(accpath, namespace, name, value, size); + + if (size == -1) { + archive_set_error(&a->archive, errno, + "Couldn't read extended attribute"); + return (ARCHIVE_WARN); + } + + archive_entry_xattr_add_entry(entry, fullname, value, size); + + free(value); + return (ARCHIVE_OK); +} + +static int +setup_xattrs(struct archive_read_disk *a, + struct archive_entry *entry, int fd) +{ + char buff[512]; + char *list, *p; + ssize_t list_size; + const char *path; + int namespace = EXTATTR_NAMESPACE_USER; + + path = archive_entry_sourcepath(entry); + if (path == NULL) + path = archive_entry_pathname(entry); + + if (!a->follow_symlinks) + list_size = extattr_list_link(path, namespace, NULL, 0); + else + list_size = extattr_list_file(path, namespace, NULL, 0); + + if (list_size == -1 && errno == EOPNOTSUPP) + return (ARCHIVE_OK); + if (list_size == -1) { + archive_set_error(&a->archive, errno, + "Couldn't list extended attributes"); + return (ARCHIVE_WARN); + } + + if (list_size == 0) + return (ARCHIVE_OK); + + if ((list = malloc(list_size)) == NULL) { + archive_set_error(&a->archive, errno, "Out of memory"); + return (ARCHIVE_FATAL); + } + + if (!a->follow_symlinks) + list_size = extattr_list_link(path, namespace, list, list_size); + else + list_size = extattr_list_file(path, namespace, list, list_size); + + if (list_size == -1) { + archive_set_error(&a->archive, errno, + "Couldn't retrieve extended attributes"); + free(list); + return (ARCHIVE_WARN); + } + + p = list; + while ((p - list) < list_size) { + size_t len = 255 & (int)*p; + char *name; + + strcpy(buff, "user."); + name = buff + strlen(buff); + memcpy(name, p + 1, len); + name[len] = '\0'; + setup_xattr(a, entry, namespace, name, buff, fd); + p += 1 + len; + } + + free(list); + return (ARCHIVE_OK); +} + +#else + +/* + * Generic (stub) extended attribute support. + */ +static int +setup_xattrs(struct archive_read_disk *a, + struct archive_entry *entry, int fd) +{ + (void)a; /* UNUSED */ + (void)entry; /* UNUSED */ + (void)fd; /* UNUSED */ + return (ARCHIVE_OK); +} + +#endif Added: head/lib/libarchive/archive_read_disk_private.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/lib/libarchive/archive_read_disk_private.h Fri Mar 6 04:35:31 2009 (r189429) @@ -0,0 +1,58 @@ +/*- + * Copyright (c) 2003-2009 Tim Kientzle + * 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 + * in this position and unchanged. + * 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(S) ``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(S) 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 ARCHIVE_READ_DISK_PRIVATE_H_INCLUDED +#define ARCHIVE_READ_DISK_PRIVATE_H_INCLUDED + +struct archive_read_disk { + struct archive archive; + + /* + * Symlink mode is one of 'L'ogical, 'P'hysical, or 'H'ybrid, + * following an old BSD convention. 'L' follows all symlinks, + * 'P' follows none, 'H' follows symlinks only for the first + * item. + */ + char symlink_mode; + + /* + * Since symlink interaction changes, we need to track whether + * we're following symlinks for the current item. 'L' mode above + * sets this true, 'P' sets it false, 'H' changes it as we traverse. + */ + char follow_symlinks; /* Either 'L' or 'P'. */ + + const char * (*lookup_gname)(void *private, gid_t gid); + void (*cleanup_gname)(void *private); + void *lookup_gname_data; + const char * (*lookup_uname)(void *private, gid_t gid); + void (*cleanup_uname)(void *private); + void *lookup_uname_data; +}; + +#endif Added: head/lib/libarchive/archive_read_disk_set_standard_lookup.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/lib/libarchive/archive_read_disk_set_standard_lookup.c Fri Mar 6 04:35:31 2009 (r189429) @@ -0,0 +1,229 @@ +/*- + * Copyright (c) 2003-2007 Tim Kientzle + * 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(S) ``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(S) 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 "archive_platform.h" +__FBSDID("$FreeBSD$"); + +#ifdef HAVE_SYS_TYPES_H +#include +#endif +#ifdef HAVE_ERRNO_H +#include +#endif +#ifdef HAVE_GRP_H +#include +#endif +#ifdef HAVE_PWD_H +#include +#endif +#ifdef HAVE_STDLIB_H +#include +#endif +#ifdef HAVE_STRING_H +#include +#endif + +#include "archive.h" + +#ifdef _WIN32 +int +archive_read_disk_set_standard_lookup(struct archive *a) +{ + archive_set_error(a, -1, "Standard lookups not available on Windows"); + return (ARCHIVE_FATAL); +} +#else +#define name_cache_size 127 + +static const char * const NO_NAME = "(noname)"; + +struct name_cache { + struct archive *archive; + int probes; + int hits; + size_t size; + struct { + id_t id; + const char *name; + } cache[name_cache_size]; +}; + +static const char * lookup_gname(void *, gid_t); +static const char * lookup_uname(void *, uid_t); +static void cleanup(void *); +static const char * lookup_gname_helper(struct archive *, id_t gid); +static const char * lookup_uname_helper(struct archive *, id_t uid); + +/* + * Installs functions that use getpwuid()/getgrgid()---along with + * a simple cache to accelerate such lookups---into the archive_read_disk + * object. This is in a separate file because getpwuid()/getgrgid() + * can pull in a LOT of library code (including NIS/LDAP functions, which + * pull in DNS resolveers, etc). This can easily top 500kB, which makes + * it inappropriate for some space-constrained applications. + * + * Applications that are size-sensitive may want to just use the + * real default functions (defined in archive_read_disk.c) that just + * use the uid/gid without the lookup. Or define your own custom functions + * if you prefer. + */ +int +archive_read_disk_set_standard_lookup(struct archive *a) +{ + struct name_cache *ucache = malloc(sizeof(struct name_cache)); + struct name_cache *gcache = malloc(sizeof(struct name_cache)); + + if (ucache == NULL || gcache == NULL) { + archive_set_error(a, ENOMEM, + "Can't allocate uname/gname lookup cache"); + free(ucache); + free(gcache); + return (ARCHIVE_FATAL); + } + + memset(ucache, 0, sizeof(*ucache)); + ucache->archive = a; + ucache->size = name_cache_size; + memset(gcache, 0, sizeof(*gcache)); + gcache->archive = a; + gcache->size = name_cache_size; + + archive_read_disk_set_gname_lookup(a, gcache, lookup_gname, cleanup); + archive_read_disk_set_uname_lookup(a, ucache, lookup_uname, cleanup); + + return (ARCHIVE_OK); +} + +static void +cleanup(void *data) +{ + struct name_cache *cache = (struct name_cache *)data; *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@FreeBSD.ORG Fri Mar 6 04:50:39 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 C0FDB1065670; Fri, 6 Mar 2009 04:50:39 +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 AE6E28FC0C; Fri, 6 Mar 2009 04:50:39 +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 n264od3G008382; Fri, 6 Mar 2009 04:50:39 GMT (envelope-from kientzle@svn.freebsd.org) Received: (from kientzle@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n264odVW008380; Fri, 6 Mar 2009 04:50:39 GMT (envelope-from kientzle@svn.freebsd.org) Message-Id: <200903060450.n264odVW008380@svn.freebsd.org> From: Tim Kientzle Date: Fri, 6 Mar 2009 04:50:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r189430 - head/lib/libarchive 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, 06 Mar 2009 04:50:40 -0000 Author: kientzle Date: Fri Mar 6 04:50:39 2009 New Revision: 189430 URL: http://svn.freebsd.org/changeset/base/189430 Log: Merge r407,r508 from libarchive.googlecode.com: Correctly handle Zip entries that are zero length but stored with deflate. This is arguably a silly thing to do (deflating a zero-length file actually makes it bigger) but apparently quite a few Zip writers do this. This was broken in two places: archive_write_disk disliked being asked to write data to zero-length files (even if the write was zero-length) and zip_read_file_header tripped over itself when non-regular files had compressed bodies. Modified: head/lib/libarchive/archive_read_support_format_zip.c head/lib/libarchive/archive_write_disk.c Modified: head/lib/libarchive/archive_read_support_format_zip.c ============================================================================== --- head/lib/libarchive/archive_read_support_format_zip.c Fri Mar 6 04:35:31 2009 (r189429) +++ head/lib/libarchive/archive_read_support_format_zip.c Fri Mar 6 04:50:39 2009 (r189430) @@ -75,7 +75,6 @@ struct zip { /* Flags to mark progress of decompression. */ char decompress_init; char end_of_entry; - char end_of_entry_cleanup; unsigned long crc32; ssize_t filename_length; @@ -298,7 +297,6 @@ archive_read_format_zip_read_header(stru zip = (struct zip *)(a->format->data); zip->decompress_init = 0; zip->end_of_entry = 0; - zip->end_of_entry_cleanup = 0; zip->entry_uncompressed_bytes_read = 0; zip->entry_compressed_bytes_read = 0; zip->entry_crc32 = crc32(0, NULL, 0); @@ -373,7 +371,7 @@ archive_read_format_zip_read_header(stru return (ARCHIVE_FATAL); } -int +static int zip_read_file_header(struct archive_read *a, struct archive_entry *entry, struct zip *zip) { @@ -499,45 +497,6 @@ archive_read_format_zip_read_data(struct * ARCHIVE_EOF this time. */ if (zip->end_of_entry) { - if (!zip->end_of_entry_cleanup) { - if (zip->flags & ZIP_LENGTH_AT_END) { - const char *p; - - if ((p = __archive_read_ahead(a, 16, NULL)) == NULL) { - archive_set_error(&a->archive, - ARCHIVE_ERRNO_FILE_FORMAT, - "Truncated ZIP end-of-file record"); - return (ARCHIVE_FATAL); - } - zip->crc32 = archive_le32dec(p + 4); - zip->compressed_size = archive_le32dec(p + 8); - zip->uncompressed_size = archive_le32dec(p + 12); - __archive_read_consume(a, 16); - } - - /* Check file size, CRC against these values. */ - if (zip->compressed_size != zip->entry_compressed_bytes_read) { - archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC, - "ZIP compressed data is wrong size"); - return (ARCHIVE_WARN); - } - /* Size field only stores the lower 32 bits of the actual size. */ - if ((zip->uncompressed_size & UINT32_MAX) - != (zip->entry_uncompressed_bytes_read & UINT32_MAX)) { - archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC, - "ZIP uncompressed data is wrong size"); - return (ARCHIVE_WARN); - } - /* Check computed CRC against header */ - if (zip->crc32 != zip->entry_crc32) { - archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC, - "ZIP bad CRC: 0x%lx should be 0x%lx", - zip->entry_crc32, zip->crc32); - return (ARCHIVE_WARN); - } - /* End-of-entry cleanup done. */ - zip->end_of_entry_cleanup = 1; - } *offset = zip->entry_uncompressed_bytes_read; *size = 0; *buff = NULL; @@ -580,6 +539,44 @@ archive_read_format_zip_read_data(struct if (*size) zip->entry_crc32 = crc32(zip->entry_crc32, *buff, *size); + /* If we hit the end, swallow any end-of-data marker. */ + if (zip->end_of_entry) { + if (zip->flags & ZIP_LENGTH_AT_END) { + const char *p; + + if ((p = __archive_read_ahead(a, 16, NULL)) == NULL) { + archive_set_error(&a->archive, + ARCHIVE_ERRNO_FILE_FORMAT, + "Truncated ZIP end-of-file record"); + return (ARCHIVE_FATAL); + } + zip->crc32 = archive_le32dec(p + 4); + zip->compressed_size = archive_le32dec(p + 8); + zip->uncompressed_size = archive_le32dec(p + 12); + __archive_read_consume(a, 16); + } + /* Check file size, CRC against these values. */ + if (zip->compressed_size != zip->entry_compressed_bytes_read) { + archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC, + "ZIP compressed data is wrong size"); + return (ARCHIVE_WARN); + } + /* Size field only stores the lower 32 bits of the actual size. */ + if ((zip->uncompressed_size & UINT32_MAX) + != (zip->entry_uncompressed_bytes_read & UINT32_MAX)) { + archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC, + "ZIP uncompressed data is wrong size"); + return (ARCHIVE_WARN); + } + /* Check computed CRC against header */ + if (zip->crc32 != zip->entry_crc32) { + archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC, + "ZIP bad CRC: 0x%lx should be 0x%lx", + zip->entry_crc32, zip->crc32); + return (ARCHIVE_WARN); + } + } + /* Return EOF immediately if this is a non-regular file. */ if (AE_IFREG != (zip->mode & AE_IFMT)) return (ARCHIVE_EOF); @@ -761,7 +758,7 @@ archive_read_format_zip_read_data_skip(s zip = (struct zip *)(a->format->data); /* If we've already read to end of data, we're done. */ - if (zip->end_of_entry_cleanup) + if (zip->end_of_entry) return (ARCHIVE_OK); /* @@ -788,7 +785,7 @@ archive_read_format_zip_read_data_skip(s return (ARCHIVE_FATAL); /* This entry is finished and done. */ - zip->end_of_entry_cleanup = zip->end_of_entry = 1; + zip->end_of_entry = 1; return (ARCHIVE_OK); } Modified: head/lib/libarchive/archive_write_disk.c ============================================================================== --- head/lib/libarchive/archive_write_disk.c Fri Mar 6 04:35:31 2009 (r189429) +++ head/lib/libarchive/archive_write_disk.c Fri Mar 6 04:50:39 2009 (r189430) @@ -519,6 +519,9 @@ write_data_block(struct archive_write_di ssize_t bytes_written = 0; ssize_t block_size = 0, bytes_to_write; + if (size == 0) + return (ARCHIVE_OK); + if (a->filesize == 0 || a->fd < 0) { archive_set_error(&a->archive, 0, "Attempt to write to an empty file"); From owner-svn-src-head@FreeBSD.ORG Fri Mar 6 04:55:52 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 5945E106566C; Fri, 6 Mar 2009 04:55:52 +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 460098FC13; Fri, 6 Mar 2009 04:55:52 +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 n264tqRn008533; Fri, 6 Mar 2009 04:55:52 GMT (envelope-from kientzle@svn.freebsd.org) Received: (from kientzle@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n264tqMa008529; Fri, 6 Mar 2009 04:55:52 GMT (envelope-from kientzle@svn.freebsd.org) Message-Id: <200903060455.n264tqMa008529@svn.freebsd.org> From: Tim Kientzle Date: Fri, 6 Mar 2009 04:55: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: r189431 - in head/lib/libarchive: . 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: Fri, 06 Mar 2009 04:55:52 -0000 Author: kientzle Date: Fri Mar 6 04:55:51 2009 New Revision: 189431 URL: http://svn.freebsd.org/changeset/base/189431 Log: Merge r416 from libarchive.googlecode.com: Restoring POSIX.1e Extended Attributes on FreeBSD, part 1 This implements the basic ability to restore extended attributes on FreeBSD, including a test suite. Added: head/lib/libarchive/test/test_extattr_freebsd.c (contents, props changed) Modified: head/lib/libarchive/archive_write_disk.c head/lib/libarchive/config_freebsd.h head/lib/libarchive/test/Makefile Modified: head/lib/libarchive/archive_write_disk.c ============================================================================== --- head/lib/libarchive/archive_write_disk.c Fri Mar 6 04:50:39 2009 (r189430) +++ head/lib/libarchive/archive_write_disk.c Fri Mar 6 04:55:51 2009 (r189431) @@ -33,6 +33,9 @@ __FBSDID("$FreeBSD$"); #ifdef HAVE_SYS_ACL_H #include #endif +#ifdef HAVE_SYS_EXTATTR_H +#include +#endif #ifdef HAVE_ATTR_XATTR_H #include #endif @@ -411,6 +414,8 @@ _archive_write_header(struct archive *_a a->todo |= TODO_TIMES; if (a->flags & ARCHIVE_EXTRACT_ACL) a->todo |= TODO_ACLS; + if (a->flags & ARCHIVE_EXTRACT_XATTR) + a->todo |= TODO_XATTR; if (a->flags & ARCHIVE_EXTRACT_FFLAGS) a->todo |= TODO_FFLAGS; if (a->flags & ARCHIVE_EXTRACT_SECURE_SYMLINKS) { @@ -425,6 +430,17 @@ _archive_write_header(struct archive *_a ret = restore_entry(a); + /* + * On the GNU tar mailing list, some people working with new + * Linux filesystems observed that system xattrs used as + * layout hints need to be restored before the file contents + * are written, so this can't be done at file close. + */ + if (a->todo & TODO_XATTR) { + int r2 = set_xattrs(a); + if (r2 < ret) ret = r2; + } + #ifdef HAVE_FCHDIR /* If we changed directory above, restore it here. */ if (a->restore_pwd >= 0) { @@ -720,14 +736,18 @@ _archive_write_finish_entry(struct archi int r2 = set_acls(a); if (r2 < ret) ret = r2; } - if (a->todo & TODO_XATTR) { - int r2 = set_xattrs(a); - if (r2 < ret) ret = r2; - } + /* + * Some flags prevent file modification; they must be restored after + * file contents are written. + */ if (a->todo & TODO_FFLAGS) { int r2 = set_fflags(a); if (r2 < ret) ret = r2; } + /* + * Time has to be restored after all other metadata; + * otherwise atime will get changed. + */ if (a->todo & TODO_TIMES) { int r2 = set_times(a); if (r2 < ret) ret = r2; @@ -1012,7 +1032,8 @@ restore_entry(struct archive_write_disk if (en) { /* Everything failed; give up here. */ - archive_set_error(&a->archive, en, "Can't create '%s'", a->name); + archive_set_error(&a->archive, en, "Can't create '%s'", + a->name); return (ARCHIVE_FAILED); } @@ -1657,7 +1678,8 @@ create_dir(struct archive_write_disk *a, if (stat(path, &st) == 0 && S_ISDIR(st.st_mode)) return (ARCHIVE_OK); - archive_set_error(&a->archive, errno, "Failed to create dir '%s'", path); + archive_set_error(&a->archive, errno, "Failed to create dir '%s'", + path); return (ARCHIVE_FAILED); } @@ -2326,6 +2348,71 @@ set_xattrs(struct archive_write_disk *a) } return (ret); } +#elif HAVE_EXTATTR_SET_FILE +/* + * Restore extended attributes - FreeBSD implementation + */ +static int +set_xattrs(struct archive_write_disk *a) +{ + struct archive_entry *entry = a->entry; + static int warning_done = 0; + int ret = ARCHIVE_OK; + int i = archive_entry_xattr_reset(entry); + + while (i--) { + const char *name; + const void *value; + size_t size; + archive_entry_xattr_next(entry, &name, &value, &size); + if (name != NULL) { + int e; + int namespace; + + if (strncmp(name, "user.", 5) == 0) { + /* "user." attributes go to user namespace */ + name += 5; + namespace = EXTATTR_NAMESPACE_USER; + } else { + /* Warn about other extended attributes. */ + archive_set_error(&a->archive, + ARCHIVE_ERRNO_FILE_FORMAT, + "Can't restore extended attribute ``%s''", + name); + ret = ARCHIVE_WARN; + continue; + } + errno = 0; +#if HAVE_EXTATTR_SET_FD + if (a->fd >= 0) + e = extattr_set_fd(a->fd, namespace, name, value, size); + else +#endif + /* TODO: should we use extattr_set_link() instead? */ + { + e = extattr_set_file(archive_entry_pathname(entry), + namespace, name, value, size); + } + if (e != (int)size) { + if (errno == ENOTSUP) { + if (!warning_done) { + warning_done = 1; + archive_set_error(&a->archive, errno, + "Cannot restore extended " + "attributes on this file " + "system"); + } + } else { + archive_set_error(&a->archive, errno, + "Failed to set extended attribute"); + } + + ret = ARCHIVE_WARN; + } + } + } + return (ret); +} #else /* * Restore extended attributes - stub implementation for unsupported systems Modified: head/lib/libarchive/config_freebsd.h ============================================================================== --- head/lib/libarchive/config_freebsd.h Fri Mar 6 04:50:39 2009 (r189430) +++ head/lib/libarchive/config_freebsd.h Fri Mar 6 04:55:51 2009 (r189431) @@ -25,7 +25,7 @@ * $FreeBSD$ */ -/* FreeBSD 5.0 and later have ACL support. */ +/* FreeBSD 5.0 and later have ACL and extattr support. */ #if __FreeBSD__ > 4 #define HAVE_ACL_CREATE_ENTRY 1 #define HAVE_ACL_GET_PERM_NP 1 @@ -101,7 +101,6 @@ #define HAVE_STRUCT_STAT_ST_BIRTHTIMESPEC_TV_NSEC 1 #define HAVE_STRUCT_STAT_ST_FLAGS 1 #define HAVE_STRUCT_STAT_ST_MTIMESPEC_TV_NSEC 1 -#define HAVE_SYS_ACL_H 1 #define HAVE_SYS_IOCTL_H 1 #define HAVE_SYS_SELECT_H 1 #define HAVE_SYS_STAT_H 1 Modified: head/lib/libarchive/test/Makefile ============================================================================== --- head/lib/libarchive/test/Makefile Fri Mar 6 04:50:39 2009 (r189430) +++ head/lib/libarchive/test/Makefile Fri Mar 6 04:55:51 2009 (r189431) @@ -21,6 +21,7 @@ TESTS= \ test_empty_write.c \ test_entry.c \ test_entry_strmode.c \ + test_extattr_freebsd.c \ test_fuzz.c \ test_link_resolver.c \ test_pax_filename_encoding.c \ Added: head/lib/libarchive/test/test_extattr_freebsd.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/lib/libarchive/test/test_extattr_freebsd.c Fri Mar 6 04:55:51 2009 (r189431) @@ -0,0 +1,154 @@ +/*- + * Copyright (c) 2003-2009 Tim Kientzle + * 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(S) ``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(S) 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 "test.h" +__FBSDID("$FreeBSD$"); + +#if defined(__FreeBSD__) && __FreeBSD__ > 4 +#include +#endif + +/* + * Verify extended attribute restore-to-disk. This test is FreeBSD-specific. + */ + +DEFINE_TEST(test_extattr_freebsd) +{ +#if !defined(__FreeBSD__) + skipping("FreeBSD-specific extattr restore test"); +#elif __FreeBSD__ < 5 + skipping("extattr restore supported only on FreeBSD 5.0 and later"); +#else + char buff[64]; + struct stat st; + struct archive *a; + struct archive_entry *ae; + int n, fd; + int extattr_privilege_bug = 0; + + /* + * First, do a quick manual set/read of an extended attribute + * to verify that the local filesystem does support it. If it + * doesn't, we'll simply skip the remaining tests. + */ + /* Create a test file and try to set an ACL on it. */ + fd = open("pretest", O_RDWR | O_CREAT, 0777); + failure("Could not create test file?!"); + if (!assert(fd >= 0)) + return; + + errno = 0; + n = extattr_set_fd(fd, EXTATTR_NAMESPACE_USER, "testattr", "1234", 4); + if (n != 4 && errno == EOPNOTSUPP) { + close(fd); + skipping("extattr tests require that extattr support be enabled on the filesystem"); + return; + } + failure("extattr_set_fd(): errno=%d (%s)", errno, strerror(errno)); + assertEqualInt(4, n); + close(fd); + + /* + * Repeat the above, but with file permissions set to 0000. + * This should work (extattr_set_fd() should follow fd + * permissions, not file permissions), but is known broken on + * some versions of FreeBSD. + */ + fd = open("pretest2", O_RDWR | O_CREAT, 00000); + failure("Could not create test file?!"); + if (!assert(fd >= 0)) + return; + + n = extattr_set_fd(fd, EXTATTR_NAMESPACE_USER, "testattr", "1234", 4); + if (n != 4) { + skipping("Restoring xattr to an unwritable file (broken in some versions of FreeBSD"); + extattr_privilege_bug = 1; + } + close(fd); + + /* Create a write-to-disk object. */ + assert(NULL != (a = archive_write_disk_new())); + archive_write_disk_set_options(a, + ARCHIVE_EXTRACT_TIME | ARCHIVE_EXTRACT_PERM | ARCHIVE_EXTRACT_XATTR); + + /* Populate an archive entry with an extended attribute. */ + ae = archive_entry_new(); + assert(ae != NULL); + archive_entry_set_pathname(ae, "test0"); + archive_entry_set_mtime(ae, 123456, 7890); + archive_entry_set_size(ae, 0); + archive_entry_set_mode(ae, 0755); + archive_entry_xattr_add_entry(ae, "user.foo", "12345", 5); + assertEqualIntA(a, ARCHIVE_OK, archive_write_header(a, ae)); + archive_entry_free(ae); + + /* Another entry; similar but with mode = 0. */ + ae = archive_entry_new(); + assert(ae != NULL); + archive_entry_set_pathname(ae, "test1"); + archive_entry_set_mtime(ae, 12345678, 7890); + archive_entry_set_size(ae, 0); + archive_entry_set_mode(ae, 0); + archive_entry_xattr_add_entry(ae, "user.bar", "123456", 6); + if (extattr_privilege_bug) + /* If the bug is here, write_header will return warning. */ + assertEqualIntA(a, ARCHIVE_WARN, + archive_write_header(a, ae)); + else + assertEqualIntA(a, ARCHIVE_OK, + archive_write_header(a, ae)); + archive_entry_free(ae); + + /* Close the archive. */ + assertEqualIntA(a, ARCHIVE_OK, archive_write_close(a)); + assertEqualInt(ARCHIVE_OK, archive_write_finish(a)); + + /* Verify the data on disk. */ + assertEqualInt(0, stat("test0", &st)); + assertEqualInt(st.st_mtime, 123456); + /* Verify extattr */ + n = extattr_get_file("test0", EXTATTR_NAMESPACE_USER, + "foo", buff, sizeof(buff)); + if (assertEqualInt(n, 5)) { + buff[n] = '\0'; + assertEqualString(buff, "12345"); + } + + /* Verify the data on disk. */ + assertEqualInt(0, stat("test1", &st)); + assertEqualInt(st.st_mtime, 12345678); + /* Verify extattr */ + n = extattr_get_file("test1", EXTATTR_NAMESPACE_USER, + "bar", buff, sizeof(buff)); + if (extattr_privilege_bug) { + /* If we have the bug, the extattr won't have been written. */ + assertEqualInt(n, -1); + } else { + if (assertEqualInt(n, 6)) { + buff[n] = '\0'; + assertEqualString(buff, "123456"); + } + } +#endif +} From owner-svn-src-head@FreeBSD.ORG Fri Mar 6 05:04: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 559071065672; Fri, 6 Mar 2009 05:04:16 +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 431058FC12; Fri, 6 Mar 2009 05:04:16 +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 n2654Fjt008733; Fri, 6 Mar 2009 05:04:15 GMT (envelope-from kientzle@svn.freebsd.org) Received: (from kientzle@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n2654FGK008731; Fri, 6 Mar 2009 05:04:15 GMT (envelope-from kientzle@svn.freebsd.org) Message-Id: <200903060504.n2654FGK008731@svn.freebsd.org> From: Tim Kientzle Date: Fri, 6 Mar 2009 05:04:15 +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: r189432 - in head/lib/libarchive: . 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: Fri, 06 Mar 2009 05:04:16 -0000 Author: kientzle Date: Fri Mar 6 05:04:15 2009 New Revision: 189432 URL: http://svn.freebsd.org/changeset/base/189432 Log: Merge r435,r443 from libarchive.googlecode.com: Read config files from include path; this makes it easier to support multiple build frameworks. Modified: head/lib/libarchive/archive_platform.h head/lib/libarchive/test/test.h Modified: head/lib/libarchive/archive_platform.h ============================================================================== --- head/lib/libarchive/archive_platform.h Fri Mar 6 04:55:51 2009 (r189431) +++ head/lib/libarchive/archive_platform.h Fri Mar 6 05:04:15 2009 (r189432) @@ -44,7 +44,7 @@ #include PLATFORM_CONFIG_H #elif defined(HAVE_CONFIG_H) /* Most POSIX platforms use the 'configure' script to build config.h */ -#include "../config.h" +#include "config.h" #else /* Warn if the library hasn't been (automatically or manually) configured. */ #error Oops: No config.h and no pre-built configuration in archive_platform.h. Modified: head/lib/libarchive/test/test.h ============================================================================== --- head/lib/libarchive/test/test.h Fri Mar 6 04:55:51 2009 (r189431) +++ head/lib/libarchive/test/test.h Fri Mar 6 05:04:15 2009 (r189432) @@ -33,13 +33,13 @@ */ #if defined(HAVE_CONFIG_H) /* Most POSIX platforms use the 'configure' script to build config.h */ -#include "../../config.h" +#include "config.h" #elif defined(__FreeBSD__) /* Building as part of FreeBSD system requires a pre-built config.h. */ -#include "../config_freebsd.h" +#include "config_freebsd.h" #elif defined(_WIN32) /* Win32 can't run the 'configure' script. */ -#include "../config_windows.h" +#include "config_windows.h" #else /* Warn if the library hasn't been (automatically or manually) configured. */ #error Oops: No config.h and no pre-built configuration in test.h. From owner-svn-src-head@FreeBSD.ORG Fri Mar 6 05:07: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 9E9E8106564A; Fri, 6 Mar 2009 05:07:03 +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 8C87C8FC0A; Fri, 6 Mar 2009 05:07:03 +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 n265737K008834; Fri, 6 Mar 2009 05:07:03 GMT (envelope-from kientzle@svn.freebsd.org) Received: (from kientzle@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n26573IK008833; Fri, 6 Mar 2009 05:07:03 GMT (envelope-from kientzle@svn.freebsd.org) Message-Id: <200903060507.n26573IK008833@svn.freebsd.org> From: Tim Kientzle Date: Fri, 6 Mar 2009 05:07:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r189433 - head/lib/libarchive/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: Fri, 06 Mar 2009 05:07:04 -0000 Author: kientzle Date: Fri Mar 6 05:07:03 2009 New Revision: 189433 URL: http://svn.freebsd.org/changeset/base/189433 Log: Merge r420,r494 from libarchive.googlecode.com: Prettify the test harness a bit: remove a dead comment, tweak the wording of the summary report. Modified: head/lib/libarchive/test/main.c Modified: head/lib/libarchive/test/main.c ============================================================================== --- head/lib/libarchive/test/main.c Fri Mar 6 05:04:15 2009 (r189432) +++ head/lib/libarchive/test/main.c Fri Mar 6 05:07:03 2009 (r189433) @@ -913,10 +913,6 @@ get_refdir(void) } #if defined(_WIN32) && defined(_DEBUG) - /* You should have to add "$(TargetDir)" to - * Properties > Configuration Properties > Debugging > Working Directory, - * if you are running libarchive_test.exe on Visual Studio. - */ DebugBreak(); #endif printf("Unable to locate known reference file %s\n", KNOWNREF); @@ -1117,7 +1113,7 @@ int main(int argc, char **argv) tests_failed, tests_run); printf(" Total of %d assertions checked.\n", assertions); printf(" Total of %d assertions failed.\n", failures); - printf(" Total of %d assertions skipped.\n", skips); + printf(" Total of %d reported skips.\n", skips); } free(refdir_alloc); From owner-svn-src-head@FreeBSD.ORG Fri Mar 6 05:13: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 083C91065670; Fri, 6 Mar 2009 05:13:13 +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 EA7548FC16; Fri, 6 Mar 2009 05:13:12 +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 n265DC8w008983; Fri, 6 Mar 2009 05:13:12 GMT (envelope-from kientzle@svn.freebsd.org) Received: (from kientzle@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n265DCck008982; Fri, 6 Mar 2009 05:13:12 GMT (envelope-from kientzle@svn.freebsd.org) Message-Id: <200903060513.n265DCck008982@svn.freebsd.org> From: Tim Kientzle Date: Fri, 6 Mar 2009 05:13:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r189434 - head/lib/libarchive 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, 06 Mar 2009 05:13:13 -0000 Author: kientzle Date: Fri Mar 6 05:13:12 2009 New Revision: 189434 URL: http://svn.freebsd.org/changeset/base/189434 Log: Merge r457 from libarchive.googlecode.com: Stop appending strerror() information to error strings. This caused a lot of unnecessary duplication in error messages; in particular, there are a few cases where error messages get copied from one archive object to another and this would cause the strerror() info to get appended each time. Modified: head/lib/libarchive/archive_util.c Modified: head/lib/libarchive/archive_util.c ============================================================================== --- head/lib/libarchive/archive_util.c Fri Mar 6 05:07:03 2009 (r189433) +++ head/lib/libarchive/archive_util.c Fri Mar 6 05:13:12 2009 (r189434) @@ -155,10 +155,6 @@ void archive_set_error(struct archive *a, int error_number, const char *fmt, ...) { va_list ap; -#ifdef HAVE_STRERROR_R - char errbuff[512]; -#endif - char *errp; a->archive_error_number = error_number; if (fmt == NULL) { @@ -169,21 +165,6 @@ archive_set_error(struct archive *a, int va_start(ap, fmt); archive_string_vsprintf(&(a->error_string), fmt, ap); va_end(ap); - if (error_number > 0) { - archive_strcat(&(a->error_string), ": "); -#ifdef HAVE_STRERROR_R -#ifdef STRERROR_R_CHAR_P - errp = strerror_r(error_number, errbuff, sizeof(errbuff)); -#else - strerror_r(error_number, errbuff, sizeof(errbuff)); - errp = errbuff; -#endif -#else - /* Note: this is not threadsafe! */ - errp = strerror(error_number); -#endif - archive_strcat(&(a->error_string), errp); - } a->error = a->error_string.s; } From owner-svn-src-head@FreeBSD.ORG Fri Mar 6 05:14: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 C0EC41065674; Fri, 6 Mar 2009 05:14:55 +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 AE03F8FC1D; Fri, 6 Mar 2009 05:14:55 +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 n265EtA2009050; Fri, 6 Mar 2009 05:14:55 GMT (envelope-from kientzle@svn.freebsd.org) Received: (from kientzle@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n265Etn3009047; Fri, 6 Mar 2009 05:14:55 GMT (envelope-from kientzle@svn.freebsd.org) Message-Id: <200903060514.n265Etn3009047@svn.freebsd.org> From: Tim Kientzle Date: Fri, 6 Mar 2009 05:14:55 +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: r189435 - head/lib/libarchive 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, 06 Mar 2009 05:14:56 -0000 Author: kientzle Date: Fri Mar 6 05:14:55 2009 New Revision: 189435 URL: http://svn.freebsd.org/changeset/base/189435 Log: Merge r505 from libarchive.googlecode.com: Fix %ju support. Simplify the code here a bit by making the int formatting functions static to archive_string_sprintf.c, which is the only place this has ever been used. Modified: head/lib/libarchive/archive_string.c head/lib/libarchive/archive_string.h head/lib/libarchive/archive_string_sprintf.c Modified: head/lib/libarchive/archive_string.c ============================================================================== --- head/lib/libarchive/archive_string.c Fri Mar 6 05:13:12 2009 (r189434) +++ head/lib/libarchive/archive_string.c Fri Mar 6 05:14:55 2009 (r189435) @@ -163,21 +163,6 @@ __archive_strappend_char(struct archive_ return (__archive_string_append(as, &c, 1)); } -struct archive_string * -__archive_strappend_int(struct archive_string *as, int d, int base) -{ - static const char *digits = "0123456789abcdef"; - - if (d < 0) { - __archive_strappend_char(as, '-'); - d = -d; - } - if (d >= base) - __archive_strappend_int(as, d/base, base); - __archive_strappend_char(as, digits[d % base]); - return (as); -} - #ifndef _WIN32 /* * Home-grown wctomb for UTF-8. Modified: head/lib/libarchive/archive_string.h ============================================================================== --- head/lib/libarchive/archive_string.h Fri Mar 6 05:13:12 2009 (r189434) +++ head/lib/libarchive/archive_string.h Fri Mar 6 05:14:55 2009 (r189435) @@ -66,11 +66,6 @@ struct archive_string * __archive_strappend_char(struct archive_string *, char); #define archive_strappend_char __archive_strappend_char -/* Append an integer in the specified base (2 <= base <= 16). */ -struct archive_string * -__archive_strappend_int(struct archive_string *as, int d, int base); -#define archive_strappend_int __archive_strappend_int - /* Convert a wide-char string to UTF-8 and append the result. */ struct archive_string * __archive_strappend_w_utf8(struct archive_string *, const wchar_t *); Modified: head/lib/libarchive/archive_string_sprintf.c ============================================================================== --- head/lib/libarchive/archive_string_sprintf.c Fri Mar 6 05:13:12 2009 (r189434) +++ head/lib/libarchive/archive_string_sprintf.c Fri Mar 6 05:14:55 2009 (r189435) @@ -32,7 +32,7 @@ __FBSDID("$FreeBSD$"); * implementing this function in terms of vsnprintf() requires * two calls (one to determine the size, another to format the * result), which in turn requires duplicating the argument list - * using va_copy, which isn't yet universally available. + * using va_copy, which isn't yet universally available. * * So, I've implemented a bare minimum of printf()-like capability * here. This is only used to format error messages, so doesn't @@ -44,6 +44,30 @@ __FBSDID("$FreeBSD$"); #include "archive_string.h" #include "archive_private.h" +/* + * Utility functions to format signed/unsigned integers and append + * them to an archive_string. + */ +static void +append_uint(struct archive_string *as, uintmax_t d, unsigned base) +{ + static const char *digits = "0123456789abcdef"; + if (d >= base) + append_uint(as, d/base, base); + archive_strappend_char(as, digits[d % base]); +} + +static void +append_int(struct archive_string *as, intmax_t d, unsigned base) +{ + if (d < 0) { + archive_strappend_char(as, '-'); + d = -d; + } + append_uint(as, d, base); +} + + void __archive_string_sprintf(struct archive_string *as, const char *fmt, ...) { @@ -75,7 +99,6 @@ __archive_string_vsprintf(struct archive return; } - long_flag = '\0'; for (p = fmt; *p != '\0'; p++) { const char *saved_p = p; @@ -86,6 +109,7 @@ __archive_string_vsprintf(struct archive p++; + long_flag = '\0'; switch(*p) { case 'j': long_flag = 'j'; @@ -111,7 +135,7 @@ __archive_string_vsprintf(struct archive case 'l': s = va_arg(ap, long); break; default: s = va_arg(ap, int); break; } - archive_strappend_int(as, s, 10); + append_int(as, s, 10); break; case 's': p2 = va_arg(ap, char *); @@ -126,9 +150,9 @@ __archive_string_vsprintf(struct archive } /* Format it in the correct base. */ switch (*p) { - case 'o': archive_strappend_int(as, u, 8); break; - case 'u': archive_strappend_int(as, u, 10); break; - default: archive_strappend_int(as, u, 16); break; + case 'o': append_uint(as, u, 8); break; + case 'u': append_uint(as, u, 10); break; + default: append_uint(as, u, 16); break; } break; default: From owner-svn-src-head@FreeBSD.ORG Fri Mar 6 05:38: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 C8F65106564A; Fri, 6 Mar 2009 05:38:53 +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 9CCC28FC19; Fri, 6 Mar 2009 05:38:53 +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 n265crLw009526; Fri, 6 Mar 2009 05:38:53 GMT (envelope-from kientzle@svn.freebsd.org) Received: (from kientzle@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n265crOO009525; Fri, 6 Mar 2009 05:38:53 GMT (envelope-from kientzle@svn.freebsd.org) Message-Id: <200903060538.n265crOO009525@svn.freebsd.org> From: Tim Kientzle Date: Fri, 6 Mar 2009 05:38: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: r189436 - head/lib/libarchive 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, 06 Mar 2009 05:38:54 -0000 Author: kientzle Date: Fri Mar 6 05:38:53 2009 New Revision: 189436 URL: http://svn.freebsd.org/changeset/base/189436 Log: Merge r403,702,721 from libarchive.googlecode.com: Handle odd pathnames on Windows by mapping '\\' to '/' and converting illegal characters to '_'. Modified: head/lib/libarchive/archive_write_disk.c Modified: head/lib/libarchive/archive_write_disk.c ============================================================================== --- head/lib/libarchive/archive_write_disk.c Fri Mar 6 05:14:55 2009 (r189435) +++ head/lib/libarchive/archive_write_disk.c Fri Mar 6 05:38:53 2009 (r189436) @@ -1466,6 +1466,57 @@ check_symlinks(struct archive_write_disk return (ARCHIVE_OK); } +#ifdef _WIN32 +/* + * 1. Convert a path separator from '\' to '/' . + * We shouldn't check multi-byte character directly because some + * character-set have been using the '\' character for a part of + * its multibyte character code. + * 2. Replace unusable characters in Windows with underscore('_'). + * See also : http://msdn.microsoft.com/en-us/library/aa365247.aspx + */ +static void +cleanup_pathname_win(struct archive_write_disk *a) +{ + wchar_t wc; + char *p; + size_t alen, l; + + alen = 0; + l = 0; + for (p = a->name; *p != '\0'; p++) { + ++alen; + if (*p == '\\') + l = 1; + /* Rewrite the path name if its character is a unusable. */ + if (*p == ':' || *p == '*' || *p == '?' || *p == '"' || + *p == '<' || *p == '>' || *p == '|') + *p = '_'; + } + if (alen == 0 || l == 0) + return; + /* + * Convert path separator. + */ + p = a->name; + while (*p != '\0' && alen) { + l = mbtowc(&wc, p, alen); + if (l == -1) { + while (*p != '\0') { + if (*p == '\\') + *p = '/'; + ++p; + } + break; + } + if (l == 1 && wc == L'\\') + *p = '/'; + p += l; + alen -= l; + } +} +#endif + /* * Canonicalize the pathname. In particular, this strips duplicate * '/' characters, '.' elements, and trailing '/'. It also raises an @@ -1485,6 +1536,9 @@ cleanup_pathname(struct archive_write_di return (ARCHIVE_FAILED); } +#ifdef _WIN32 + cleanup_pathname_win(a); +#endif /* Skip leading '/'. */ if (*src == '/') separator = *src++; From owner-svn-src-head@FreeBSD.ORG Fri Mar 6 05:40: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 B7547106566B; Fri, 6 Mar 2009 05:40:09 +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 A578F8FC0C; Fri, 6 Mar 2009 05:40:09 +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 n265e9Bs009596; Fri, 6 Mar 2009 05:40:09 GMT (envelope-from kientzle@svn.freebsd.org) Received: (from kientzle@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n265e9O6009595; Fri, 6 Mar 2009 05:40:09 GMT (envelope-from kientzle@svn.freebsd.org) Message-Id: <200903060540.n265e9O6009595@svn.freebsd.org> From: Tim Kientzle Date: Fri, 6 Mar 2009 05:40: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: r189437 - head/lib/libarchive/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: Fri, 06 Mar 2009 05:40:10 -0000 Author: kientzle Date: Fri Mar 6 05:40:09 2009 New Revision: 189437 URL: http://svn.freebsd.org/changeset/base/189437 Log: Merge r448 from libarchive.googlecode.com: Suppress testing write_disk failures on Windows for now. Someday this will be revisited. Modified: head/lib/libarchive/test/test_write_disk_failures.c Modified: head/lib/libarchive/test/test_write_disk_failures.c ============================================================================== --- head/lib/libarchive/test/test_write_disk_failures.c Fri Mar 6 05:38:53 2009 (r189436) +++ head/lib/libarchive/test/test_write_disk_failures.c Fri Mar 6 05:40:09 2009 (r189437) @@ -34,7 +34,7 @@ __FBSDID("$FreeBSD$"); DEFINE_TEST(test_write_disk_failures) { -#if ARCHIVE_VERSION_NUMBER < 1009000 +#if ARCHIVE_VERSION_NUMBER < 1009000 || defined(_WIN32) skipping("archive_write_disk interface"); #else struct archive_entry *ae; From owner-svn-src-head@FreeBSD.ORG Fri Mar 6 05:58: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 9DFB31065687; Fri, 6 Mar 2009 05:58:57 +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 8ACC28FC16; Fri, 6 Mar 2009 05:58:57 +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 n265wvcn009976; Fri, 6 Mar 2009 05:58:57 GMT (envelope-from kientzle@svn.freebsd.org) Received: (from kientzle@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n265wuv1009950; Fri, 6 Mar 2009 05:58:56 GMT (envelope-from kientzle@svn.freebsd.org) Message-Id: <200903060558.n265wuv1009950@svn.freebsd.org> From: Tim Kientzle Date: Fri, 6 Mar 2009 05:58:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r189438 - head/lib/libarchive 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, 06 Mar 2009 05:58:58 -0000 Author: kientzle Date: Fri Mar 6 05:58:56 2009 New Revision: 189438 URL: http://svn.freebsd.org/changeset/base/189438 Log: Merge r491,493,500,507,510,530,543 from libarchive.googlecode.com: This implements the new generic options framework that provides a way to override format- and compression-specific parameters. Modified: head/lib/libarchive/archive.h head/lib/libarchive/archive_private.h head/lib/libarchive/archive_read.c head/lib/libarchive/archive_read_private.h head/lib/libarchive/archive_read_support_compression_bzip2.c head/lib/libarchive/archive_read_support_compression_compress.c head/lib/libarchive/archive_read_support_compression_gzip.c head/lib/libarchive/archive_read_support_compression_program.c head/lib/libarchive/archive_read_support_format_ar.c head/lib/libarchive/archive_read_support_format_cpio.c head/lib/libarchive/archive_read_support_format_empty.c head/lib/libarchive/archive_read_support_format_iso9660.c head/lib/libarchive/archive_read_support_format_mtree.c head/lib/libarchive/archive_read_support_format_tar.c head/lib/libarchive/archive_read_support_format_zip.c head/lib/libarchive/archive_util.c head/lib/libarchive/archive_write.c head/lib/libarchive/archive_write_private.h head/lib/libarchive/archive_write_set_compression_gzip.c head/lib/libarchive/archive_write_set_format_ar.c head/lib/libarchive/archive_write_set_format_cpio.c head/lib/libarchive/archive_write_set_format_cpio_newc.c head/lib/libarchive/archive_write_set_format_mtree.c head/lib/libarchive/archive_write_set_format_pax.c head/lib/libarchive/archive_write_set_format_shar.c head/lib/libarchive/archive_write_set_format_ustar.c Modified: head/lib/libarchive/archive.h ============================================================================== --- head/lib/libarchive/archive.h Fri Mar 6 05:40:09 2009 (r189437) +++ head/lib/libarchive/archive.h Fri Mar 6 05:58:56 2009 (r189438) @@ -384,6 +384,19 @@ __LA_DECL int archive_read_data_into_b void *buffer, __LA_SSIZE_T len); __LA_DECL int archive_read_data_into_fd(struct archive *, int fd); +/* + * Set read options. + */ +/* Apply option string to the format only. */ +__LA_DECL int archive_read_set_format_options(struct archive *_a, + const char *s); +/* Apply option string to the filter only. */ +__LA_DECL int archive_read_set_filter_options(struct archive *_a, + const char *s); +/* Apply option string to both the format and the filter. */ +__LA_DECL int archive_read_set_options(struct archive *_a, + const char *s); + /*- * Convenience function to recreate the current entry (whose header * has just been read) on disk. @@ -552,6 +565,20 @@ __LA_DECL void archive_write_finish(st __LA_DECL int archive_write_finish(struct archive *); #endif +/* + * Set write options. + */ +/* Apply option string to the format only. */ +__LA_DECL int archive_write_set_format_options(struct archive *_a, + const char *s); +/* Apply option string to the compressor only. */ +__LA_DECL int archive_write_set_compressor_options(struct archive *_a, + const char *s); +/* Apply option string to both the format and the compressor. */ +__LA_DECL int archive_write_set_options(struct archive *_a, + const char *s); + + /*- * To create objects on disk: * 1) Ask archive_write_disk_new for a new archive_write_disk object. Modified: head/lib/libarchive/archive_private.h ============================================================================== --- head/lib/libarchive/archive_private.h Fri Mar 6 05:40:09 2009 (r189437) +++ head/lib/libarchive/archive_private.h Fri Mar 6 05:58:56 2009 (r189438) @@ -102,6 +102,9 @@ void __archive_check_magic(struct archiv void __archive_errx(int retvalue, const char *msg) __LA_DEAD; +int __archive_parse_options(const char *p, const char *fn, + int keysize, char *key, int valsize, char *val); + #define err_combine(a,b) ((a) < (b) ? (a) : (b)) #endif Modified: head/lib/libarchive/archive_read.c ============================================================================== --- head/lib/libarchive/archive_read.c Fri Mar 6 05:40:09 2009 (r189437) +++ head/lib/libarchive/archive_read.c Fri Mar 6 05:58:56 2009 (r189438) @@ -108,6 +108,95 @@ archive_read_extract_set_skip_file(struc a->skip_file_ino = i; } +/* + * Set read options for the format. + */ +int +archive_read_set_format_options(struct archive *_a, const char *s) +{ + struct archive_read *a; + char key[64], val[64]; + int len, r; + + a = (struct archive_read *)_a; + if (a->format == NULL || a->format->options == NULL || + a->format->name == NULL) + /* This format does not support option. */ + return (ARCHIVE_OK); + + while ((len = __archive_parse_options(s, a->format->name, + sizeof(key), key, sizeof(val), val)) > 0) { + if (val[0] == '\0') + r = a->format->options(a, key, NULL); + else + r = a->format->options(a, key, val); + if (r == ARCHIVE_FATAL) + return (r); + s += len; + } + if (len < 0) { + archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC, + "Illegal format options."); + return (ARCHIVE_WARN); + } + return (ARCHIVE_OK); +} + +/* + * Set read options for the filter. + */ +int +archive_read_set_filter_options(struct archive *_a, const char *s) +{ + struct archive_read *a; + struct archive_read_filter *filter; + struct archive_read_filter_bidder *bidder; + char key[64], val[64]; + int len, r; + + a = (struct archive_read *)_a; + filter = a->filter; + len = 0; + for (filter = a->filter; filter != NULL; filter = filter->upstream) { + bidder = filter->bidder; + if (bidder->options == NULL) + /* This bidder does not support option */ + continue; + while ((len = __archive_parse_options(s, filter->name, + sizeof(key), key, sizeof(val), val)) > 0) { + if (val[0] == '\0') + r = bidder->options(bidder, key, NULL); + else + r = bidder->options(bidder, key, val); + if (r == ARCHIVE_FATAL) + return (r); + s += len; + } + } + if (len < 0) { + archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC, + "Illegal format options."); + return (ARCHIVE_WARN); + } + return (ARCHIVE_OK); +} + +/* + * Set read options for the format and the filter. + */ +int +archive_read_set_options(struct archive *_a, const char *s) +{ + int r; + + r = archive_read_set_format_options(_a, s); + if (r != ARCHIVE_OK) + return (r); + r = archive_read_set_filter_options(_a, s); + if (r != ARCHIVE_OK) + return (r); + return (ARCHIVE_OK); +} /* * Open the archive @@ -658,7 +747,9 @@ _archive_read_finish(struct archive *_a) int __archive_read_register_format(struct archive_read *a, void *format_data, + const char *name, int (*bid)(struct archive_read *), + int (*options)(struct archive_read *, const char *, const char *), int (*read_header)(struct archive_read *, struct archive_entry *), int (*read_data)(struct archive_read *, const void **, size_t *, off_t *), int (*read_data_skip)(struct archive_read *), @@ -677,11 +768,13 @@ __archive_read_register_format(struct ar return (ARCHIVE_WARN); /* We've already installed */ if (a->formats[i].bid == NULL) { a->formats[i].bid = bid; + a->formats[i].options = options; a->formats[i].read_header = read_header; a->formats[i].read_data = read_data; a->formats[i].read_data_skip = read_data_skip; a->formats[i].cleanup = cleanup; a->formats[i].data = format_data; + a->formats[i].name = name; return (ARCHIVE_OK); } } Modified: head/lib/libarchive/archive_read_private.h ============================================================================== --- head/lib/libarchive/archive_read_private.h Fri Mar 6 05:40:09 2009 (r189437) +++ head/lib/libarchive/archive_read_private.h Fri Mar 6 05:58:56 2009 (r189438) @@ -54,6 +54,9 @@ struct archive_read_filter_bidder { struct archive_read_filter *); /* Initialize a newly-created filter. */ int (*init)(struct archive_read_filter *); + /* Set an option for the filter bidder. */ + int (*options)(struct archive_read_filter_bidder *, + const char *key, const char *value); /* Release the bidder's configuration data. */ int (*free)(struct archive_read_filter_bidder *); }; @@ -149,7 +152,10 @@ struct archive_read { struct archive_format_descriptor { void *data; + const char *name; int (*bid)(struct archive_read *); + int (*options)(struct archive_read *, const char *key, + const char *value); int (*read_header)(struct archive_read *, struct archive_entry *); int (*read_data)(struct archive_read *, const void **, size_t *, off_t *); int (*read_data_skip)(struct archive_read *); @@ -166,7 +172,9 @@ struct archive_read { int __archive_read_register_format(struct archive_read *a, void *format_data, + const char *name, int (*bid)(struct archive_read *), + int (*options)(struct archive_read *, const char *, const char *), int (*read_header)(struct archive_read *, struct archive_entry *), int (*read_data)(struct archive_read *, const void **, size_t *, off_t *), int (*read_data_skip)(struct archive_read *), Modified: head/lib/libarchive/archive_read_support_compression_bzip2.c ============================================================================== --- head/lib/libarchive/archive_read_support_compression_bzip2.c Fri Mar 6 05:40:09 2009 (r189437) +++ head/lib/libarchive/archive_read_support_compression_bzip2.c Fri Mar 6 05:58:56 2009 (r189438) @@ -84,6 +84,7 @@ archive_read_support_compression_bzip2(s reader->data = NULL; reader->bid = bzip2_reader_bid; reader->init = bzip2_reader_init; + reader->options = NULL; reader->free = bzip2_reader_free; return (ARCHIVE_OK); } Modified: head/lib/libarchive/archive_read_support_compression_compress.c ============================================================================== --- head/lib/libarchive/archive_read_support_compression_compress.c Fri Mar 6 05:40:09 2009 (r189437) +++ head/lib/libarchive/archive_read_support_compression_compress.c Fri Mar 6 05:58:56 2009 (r189438) @@ -152,6 +152,7 @@ archive_read_support_compression_compres bidder->data = NULL; bidder->bid = compress_bidder_bid; bidder->init = compress_bidder_init; + bidder->options = NULL; bidder->free = compress_bidder_free; return (ARCHIVE_OK); } Modified: head/lib/libarchive/archive_read_support_compression_gzip.c ============================================================================== --- head/lib/libarchive/archive_read_support_compression_gzip.c Fri Mar 6 05:40:09 2009 (r189437) +++ head/lib/libarchive/archive_read_support_compression_gzip.c Fri Mar 6 05:58:56 2009 (r189438) @@ -90,7 +90,8 @@ archive_read_support_compression_gzip(st bidder->data = NULL; bidder->bid = gzip_bidder_bid; bidder->init = gzip_bidder_init; - bidder->free = NULL; /* No data, so no cleanup necessary. */ + bidder->options = NULL; + bidder->free = NULL; return (ARCHIVE_OK); } Modified: head/lib/libarchive/archive_read_support_compression_program.c ============================================================================== --- head/lib/libarchive/archive_read_support_compression_program.c Fri Mar 6 05:40:09 2009 (r189437) +++ head/lib/libarchive/archive_read_support_compression_program.c Fri Mar 6 05:58:56 2009 (r189438) @@ -122,6 +122,7 @@ archive_read_support_compression_program bidder->data = state; bidder->bid = program_bidder_bid; bidder->init = program_bidder_init; + bidder->options = NULL; bidder->free = program_bidder_free; return (ARCHIVE_OK); } Modified: head/lib/libarchive/archive_read_support_format_ar.c ============================================================================== --- head/lib/libarchive/archive_read_support_format_ar.c Fri Mar 6 05:40:09 2009 (r189437) +++ head/lib/libarchive/archive_read_support_format_ar.c Fri Mar 6 05:58:56 2009 (r189438) @@ -105,7 +105,9 @@ archive_read_support_format_ar(struct ar r = __archive_read_register_format(a, ar, + "ar", archive_read_format_ar_bid, + NULL, archive_read_format_ar_read_header, archive_read_format_ar_read_data, archive_read_format_ar_skip, Modified: head/lib/libarchive/archive_read_support_format_cpio.c ============================================================================== --- head/lib/libarchive/archive_read_support_format_cpio.c Fri Mar 6 05:40:09 2009 (r189437) +++ head/lib/libarchive/archive_read_support_format_cpio.c Fri Mar 6 05:58:56 2009 (r189438) @@ -150,7 +150,9 @@ archive_read_support_format_cpio(struct r = __archive_read_register_format(a, cpio, + "cpio", archive_read_format_cpio_bid, + NULL, archive_read_format_cpio_read_header, archive_read_format_cpio_read_data, NULL, Modified: head/lib/libarchive/archive_read_support_format_empty.c ============================================================================== --- head/lib/libarchive/archive_read_support_format_empty.c Fri Mar 6 05:40:09 2009 (r189437) +++ head/lib/libarchive/archive_read_support_format_empty.c Fri Mar 6 05:58:56 2009 (r189438) @@ -44,7 +44,9 @@ archive_read_support_format_empty(struct r = __archive_read_register_format(a, NULL, + NULL, archive_read_format_empty_bid, + NULL, archive_read_format_empty_read_header, archive_read_format_empty_read_data, NULL, Modified: head/lib/libarchive/archive_read_support_format_iso9660.c ============================================================================== --- head/lib/libarchive/archive_read_support_format_iso9660.c Fri Mar 6 05:40:09 2009 (r189437) +++ head/lib/libarchive/archive_read_support_format_iso9660.c Fri Mar 6 05:58:56 2009 (r189438) @@ -279,7 +279,9 @@ archive_read_support_format_iso9660(stru r = __archive_read_register_format(a, iso9660, + "iso9660", archive_read_format_iso9660_bid, + NULL, archive_read_format_iso9660_read_header, archive_read_format_iso9660_read_data, archive_read_format_iso9660_read_data_skip, Modified: head/lib/libarchive/archive_read_support_format_mtree.c ============================================================================== --- head/lib/libarchive/archive_read_support_format_mtree.c Fri Mar 6 05:40:09 2009 (r189437) +++ head/lib/libarchive/archive_read_support_format_mtree.c Fri Mar 6 05:58:56 2009 (r189438) @@ -148,8 +148,8 @@ archive_read_support_format_mtree(struct memset(mtree, 0, sizeof(*mtree)); mtree->fd = -1; - r = __archive_read_register_format(a, mtree, - mtree_bid, read_header, read_data, skip, cleanup); + r = __archive_read_register_format(a, mtree, "mtree", + mtree_bid, NULL, read_header, read_data, skip, cleanup); if (r != ARCHIVE_OK) free(mtree); Modified: head/lib/libarchive/archive_read_support_format_tar.c ============================================================================== --- head/lib/libarchive/archive_read_support_format_tar.c Fri Mar 6 05:40:09 2009 (r189437) +++ head/lib/libarchive/archive_read_support_format_tar.c Fri Mar 6 05:58:56 2009 (r189438) @@ -253,8 +253,9 @@ archive_read_support_format_tar(struct a } memset(tar, 0, sizeof(*tar)); - r = __archive_read_register_format(a, tar, + r = __archive_read_register_format(a, tar, "tar", archive_read_format_tar_bid, + NULL, archive_read_format_tar_read_header, archive_read_format_tar_read_data, archive_read_format_tar_skip, Modified: head/lib/libarchive/archive_read_support_format_zip.c ============================================================================== --- head/lib/libarchive/archive_read_support_format_zip.c Fri Mar 6 05:40:09 2009 (r189437) +++ head/lib/libarchive/archive_read_support_format_zip.c Fri Mar 6 05:58:56 2009 (r189438) @@ -153,7 +153,9 @@ archive_read_support_format_zip(struct a r = __archive_read_register_format(a, zip, + "zip", archive_read_format_zip_bid, + NULL, archive_read_format_zip_read_header, archive_read_format_zip_read_data, archive_read_format_zip_read_data_skip, Modified: head/lib/libarchive/archive_util.c ============================================================================== --- head/lib/libarchive/archive_util.c Fri Mar 6 05:40:09 2009 (r189437) +++ head/lib/libarchive/archive_util.c Fri Mar 6 05:58:56 2009 (r189438) @@ -1,4 +1,5 @@ /*- + * Copyright (c) 2009 Michihiro NAKAJIMA * Copyright (c) 2003-2007 Tim Kientzle * All rights reserved. * @@ -186,3 +187,195 @@ __archive_errx(int retvalue, const char write(2, "\n", 1); exit(retvalue); } + +/* + * Parse option strings + * Detail of option format. + * - The option can accept: + * "opt-name", "!opt-name", "opt-name=value". + * + * - The option entries are separated by comma. + * e.g "compression=9,opt=XXX,opt-b=ZZZ" + * + * - The name of option string consist of '-' and alphabet + * but character '-' cannot be used for the first character. + * (Regular expression is [a-z][-a-z]+) + * + * - For a specfic format/filter, using the format name with ':'. + * e.g "zip:compression=9" + * (This "compression=9" option entry is for "zip" format only) + * + * If another entries follow it, those are not for + * the specfic format/filter. + * e.g handle "zip:compression=9,opt=XXX,opt-b=ZZZ" + * "zip" format/filter handler will get "compression=9" + * all format/filter handler will get "opt=XXX" + * all format/filter handler will get "opt-b=ZZZ" + * + * - Whitespace and tab are bypassed. + * + */ +int +__archive_parse_options(const char *p, const char *fn, int keysize, char *key, + int valsize, char *val) +{ + const char *p_org; + int apply; + int kidx, vidx; + int negative; + enum { + /* Requested for initialization. */ + INIT, + /* Finding format/filter-name and option-name. */ + F_BOTH, + /* Finding option-name only. + * (already detected format/filter-name) */ + F_NAME, + /* Getting option-value. */ + G_VALUE, + } state; + + p_org = p; + state = INIT; + kidx = vidx = negative = 0; + apply = 1; + while (*p) { + switch (state) { + case INIT: + kidx = vidx = 0; + negative = 0; + apply = 1; + state = F_BOTH; + break; + case F_BOTH: + case F_NAME: + if ((*p >= 'a' && *p <= 'z') || + (*p >= '0' && *p <= '9') || *p == '-') { + if (kidx == 0 && !(*p >= 'a' && *p <= 'z')) + /* Illegal sequence. */ + return (-1); + if (kidx >= keysize -1) + /* Too many characters. */ + return (-1); + key[kidx++] = *p++; + } else if (*p == '!') { + if (kidx != 0) + /* Illegal sequence. */ + return (-1); + negative = 1; + ++p; + } else if (*p == ',') { + if (kidx == 0) + /* Illegal sequence. */ + return (-1); + if (!negative) + val[vidx++] = '1'; + /* We have got boolean option data. */ + ++p; + if (apply) + goto complete; + else + /* This option does not apply to the + * format which the fn variable + * indicate. */ + state = INIT; + } else if (*p == ':') { + /* obuf data is format name */ + if (state == F_NAME) + /* We already found it. */ + return (-1); + if (kidx == 0) + /* Illegal sequence. */ + return (-1); + if (negative) + /* We cannot accept "!format-name:". */ + return (-1); + key[kidx] = '\0'; + if (strcmp(fn, key) != 0) + /* This option does not apply to the + * format which the fn variable + * indicate. */ + apply = 0; + kidx = 0; + ++p; + state = F_NAME; + } else if (*p == '=') { + if (kidx == 0) + /* Illegal sequence. */ + return (-1); + if (negative) + /* We cannot accept "!opt-name=value". */ + return (-1); + ++p; + state = G_VALUE; + } else if (*p == ' ') { + /* Pass the space character */ + ++p; + } else { + /* Illegal character. */ + return (-1); + } + break; + case G_VALUE: + if (*p == ',') { + if (vidx == 0) + /* Illegal sequence. */ + return (-1); + /* We have got option data. */ + ++p; + if (apply) + goto complete; + else + /* This option does not apply to the + * format which the fn variable + * indicate. */ + state = INIT; + } else if (*p == ' ') { + /* Pass the space character */ + ++p; + } else { + if (vidx >= valsize -1) + /* Too many characters. */ + return (-1); + val[vidx++] = *p++; + } + break; + } + } + + switch (state) { + case F_BOTH: + case F_NAME: + if (kidx != 0) { + if (!negative) + val[vidx++] = '1'; + /* We have got boolean option. */ + if (apply) + /* This option apply to the format which the + * fn variable indicate. */ + goto complete; + } + break; + case G_VALUE: + if (vidx == 0) + /* Illegal sequence. */ + return (-1); + /* We have got option value. */ + if (apply) + /* This option apply to the format which the fn + * variable indicate. */ + goto complete; + break; + case INIT:/* nothing */ + break; + } + + /* End of Option string. */ + return (0); + +complete: + key[kidx] = '\0'; + val[vidx] = '\0'; + /* Return a size which we've consumed for detecting option */ + return ((int)(p - p_org)); +} Modified: head/lib/libarchive/archive_write.c ============================================================================== --- head/lib/libarchive/archive_write.c Fri Mar 6 05:40:09 2009 (r189437) +++ head/lib/libarchive/archive_write.c Fri Mar 6 05:58:56 2009 (r189438) @@ -125,6 +125,87 @@ archive_write_new(void) } /* + * Set write options for the format. Returns 0 if successful. + */ +int +archive_write_set_format_options(struct archive *_a, const char *s) +{ + struct archive_write *a = (struct archive_write *)_a; + char key[64], val[64]; + int len, r; + + if (a->format_options == NULL) + /* This format does not support option. */ + return (ARCHIVE_OK); + + while ((len = __archive_parse_options(s, a->format_name, + sizeof(key), key, sizeof(val), val)) > 0) { + if (val[0] == '\0') + r = a->format_options(a, key, NULL); + else + r = a->format_options(a, key, val); + if (r == ARCHIVE_FATAL) + return (r); + s += len; + } + if (len < 0) { + archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC, + "Illegal format options."); + return (ARCHIVE_WARN); + } + return (ARCHIVE_OK); +} + +/* + * Set write options for the compressor. Returns 0 if successful. + */ +int +archive_write_set_compressor_options(struct archive *_a, const char *s) +{ + struct archive_write *a = (struct archive_write *)_a; + char key[64], val[64]; + int len, r; + + if (a->compressor.options == NULL) + /* This compressor does not support option. */ + return (ARCHIVE_OK); + + while ((len = __archive_parse_options(s, a->archive.compression_name, + sizeof(key), key, sizeof(val), val)) > 0) { + if (val[0] == '\0') + r = a->compressor.options(a, key, NULL); + else + r = a->compressor.options(a, key, val); + if (r == ARCHIVE_FATAL) + return (r); + s += len; + } + if (len < 0) { + archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC, + "Illegal format options."); + return (ARCHIVE_WARN); + } + return (ARCHIVE_OK); +} + +/* + * Set write options for the format and the compressor. Returns 0 if successful. + */ +int +archive_write_set_options(struct archive *_a, const char *s) +{ + int r; + + r = archive_write_set_format_options(_a, s); + if (r != ARCHIVE_OK) + return (r); + r = archive_write_set_compressor_options(_a, s); + if (r != ARCHIVE_OK) + return (r); + return (ARCHIVE_OK); +} + +/* * Set the block size. Returns 0 if successful. */ int Modified: head/lib/libarchive/archive_write_private.h ============================================================================== --- head/lib/libarchive/archive_write_private.h Fri Mar 6 05:40:09 2009 (r189437) +++ head/lib/libarchive/archive_write_private.h Fri Mar 6 05:58:56 2009 (r189438) @@ -77,6 +77,8 @@ struct archive_write { void *data; void *config; int (*init)(struct archive_write *); + int (*options)(struct archive_write *, + const char *key, const char *value); int (*finish)(struct archive_write *); int (*write)(struct archive_write *, const void *, size_t); } compressor; @@ -86,7 +88,10 @@ struct archive_write { * initialized by archive_write_set_format_XXX() calls. */ void *format_data; + const char *format_name; int (*format_init)(struct archive_write *); + int (*format_options)(struct archive_write *, + const char *key, const char *value); int (*format_finish)(struct archive_write *); int (*format_destroy)(struct archive_write *); int (*format_finish_entry)(struct archive_write *); Modified: head/lib/libarchive/archive_write_set_compression_gzip.c ============================================================================== --- head/lib/libarchive/archive_write_set_compression_gzip.c Fri Mar 6 05:40:09 2009 (r189437) +++ head/lib/libarchive/archive_write_set_compression_gzip.c Fri Mar 6 05:58:56 2009 (r189438) @@ -61,6 +61,8 @@ struct private_data { unsigned char *compressed; size_t compressed_buffer_size; unsigned long crc; + /* Options */ + int compression_level; }; @@ -73,6 +75,8 @@ struct private_data { static int archive_compressor_gzip_finish(struct archive_write *); static int archive_compressor_gzip_init(struct archive_write *); +static int archive_compressor_gzip_options(struct archive_write *, + const char *, const char *); static int archive_compressor_gzip_write(struct archive_write *, const void *, size_t); static int drive_compressor(struct archive_write *, struct private_data *, @@ -143,6 +147,7 @@ archive_compressor_gzip_init(struct arch state->compressed_buffer_size = a->bytes_per_block; state->compressed = (unsigned char *)malloc(state->compressed_buffer_size); state->crc = crc32(0L, NULL, 0); + state->compression_level = Z_DEFAULT_COMPRESSION; if (state->compressed == NULL) { archive_set_error(&a->archive, ENOMEM, @@ -169,12 +174,13 @@ archive_compressor_gzip_init(struct arch state->stream.next_out += 10; state->stream.avail_out -= 10; + a->compressor.options = archive_compressor_gzip_options; a->compressor.write = archive_compressor_gzip_write; a->compressor.finish = archive_compressor_gzip_finish; /* Initialize compression library. */ ret = deflateInit2(&(state->stream), - Z_DEFAULT_COMPRESSION, + state->compression_level, Z_DEFLATED, -15 /* < 0 to suppress zlib header */, 8, @@ -213,6 +219,57 @@ archive_compressor_gzip_init(struct arch } /* + * Set write options. + */ +static int +archive_compressor_gzip_options(struct archive_write *a, const char *key, + const char *value) +{ + struct private_data *state; + int ret; + + state = (struct private_data *)a->compressor.data; + if (strcmp(key, "compression-level") == 0) { + int level; + + if (value == NULL || !(value[0] >= '0' && value[0] <= '9') || + value[1] != '\0') + return (ARCHIVE_WARN); + level = value[0] - '0'; + if (level == state->compression_level) + return (ARCHIVE_OK); + + ret = deflateParams(&(state->stream), level, + Z_DEFAULT_STRATEGY); + if (ret == Z_OK) { + state->compression_level = level; + return (ARCHIVE_OK); + } + switch (ret) { + case Z_STREAM_ERROR: + archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC, + "Internal error updating params " + "compression library: state was inconsistent " + "or parameter was invalid"); + break; + case Z_BUF_ERROR: + archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC, + "Internal error updating params " + "compression library: out buffer was zero"); + break; + default: + archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC, + "Internal error updatng params " + "compression library"); + break; + } + return (ARCHIVE_FATAL); + } + + return (ARCHIVE_WARN); +} + +/* * Write data to the compressed stream. */ static int Modified: head/lib/libarchive/archive_write_set_format_ar.c ============================================================================== --- head/lib/libarchive/archive_write_set_format_ar.c Fri Mar 6 05:40:09 2009 (r189437) +++ head/lib/libarchive/archive_write_set_format_ar.c Fri Mar 6 05:58:56 2009 (r189438) @@ -125,6 +125,7 @@ archive_write_set_format_ar(struct archi memset(ar, 0, sizeof(*ar)); a->format_data = ar; + a->format_name = "ar"; a->format_write_header = archive_write_ar_header; a->format_write_data = archive_write_ar_data; a->format_finish = archive_write_ar_finish; Modified: head/lib/libarchive/archive_write_set_format_cpio.c ============================================================================== --- head/lib/libarchive/archive_write_set_format_cpio.c Fri Mar 6 05:40:09 2009 (r189437) +++ head/lib/libarchive/archive_write_set_format_cpio.c Fri Mar 6 05:58:56 2009 (r189438) @@ -92,6 +92,7 @@ archive_write_set_format_cpio(struct arc a->format_data = cpio; a->pad_uncompressed = 1; + a->format_name = "cpio"; a->format_write_header = archive_write_cpio_header; a->format_write_data = archive_write_cpio_data; a->format_finish_entry = archive_write_cpio_finish_entry; Modified: head/lib/libarchive/archive_write_set_format_cpio_newc.c ============================================================================== --- head/lib/libarchive/archive_write_set_format_cpio_newc.c Fri Mar 6 05:40:09 2009 (r189437) +++ head/lib/libarchive/archive_write_set_format_cpio_newc.c Fri Mar 6 05:58:56 2009 (r189438) @@ -97,6 +97,7 @@ archive_write_set_format_cpio_newc(struc a->format_data = cpio; a->pad_uncompressed = 1; + a->format_name = "cpio"; a->format_write_header = archive_write_newc_header; a->format_write_data = archive_write_newc_data; a->format_finish_entry = archive_write_newc_finish_entry; Modified: head/lib/libarchive/archive_write_set_format_mtree.c ============================================================================== --- head/lib/libarchive/archive_write_set_format_mtree.c Fri Mar 6 05:40:09 2009 (r189437) +++ head/lib/libarchive/archive_write_set_format_mtree.c Fri Mar 6 05:58:56 2009 (r189438) @@ -107,6 +107,20 @@ archive_write_mtree_header(struct archiv return (ARCHIVE_OK); } +#if 0 +static void +strappend_bin(struct archive_string *s, const unsigned char *bin, int n) +{ + static const char hex[] = "0123456789abcdef"; + int i; + + for (i = 0; i < n; i++) { + archive_strappend_char(s, hex[bin[i] >> 4]); + archive_strappend_char(s, hex[bin[i] & 0x0f]); + } +} +#endif + static int archive_write_mtree_finish_entry(struct archive_write *a) { @@ -248,6 +262,7 @@ archive_write_set_format_mtree(struct ar a->format_destroy = archive_write_mtree_destroy; a->pad_uncompressed = 0; + a->format_name = "mtree"; a->format_write_header = archive_write_mtree_header; a->format_finish = archive_write_mtree_finish; a->format_write_data = archive_write_mtree_data; Modified: head/lib/libarchive/archive_write_set_format_pax.c ============================================================================== --- head/lib/libarchive/archive_write_set_format_pax.c Fri Mar 6 05:40:09 2009 (r189437) +++ head/lib/libarchive/archive_write_set_format_pax.c Fri Mar 6 05:58:56 2009 (r189438) @@ -111,6 +111,7 @@ archive_write_set_format_pax(struct arch a->format_data = pax; a->pad_uncompressed = 1; + a->format_name = "pax"; a->format_write_header = archive_write_pax_header; a->format_write_data = archive_write_pax_data; a->format_finish = archive_write_pax_finish; Modified: head/lib/libarchive/archive_write_set_format_shar.c ============================================================================== --- head/lib/libarchive/archive_write_set_format_shar.c Fri Mar 6 05:40:09 2009 (r189437) +++ head/lib/libarchive/archive_write_set_format_shar.c Fri Mar 6 05:58:56 2009 (r189438) @@ -121,6 +121,7 @@ archive_write_set_format_shar(struct arc a->format_data = shar; a->pad_uncompressed = 0; + a->format_name = "shar"; a->format_write_header = archive_write_shar_header; a->format_finish = archive_write_shar_finish; a->format_destroy = archive_write_shar_destroy; Modified: head/lib/libarchive/archive_write_set_format_ustar.c ============================================================================== --- head/lib/libarchive/archive_write_set_format_ustar.c Fri Mar 6 05:40:09 2009 (r189437) +++ head/lib/libarchive/archive_write_set_format_ustar.c Fri Mar 6 05:58:56 2009 (r189438) @@ -181,6 +181,7 @@ archive_write_set_format_ustar(struct ar a->format_data = ustar; a->pad_uncompressed = 1; /* Mimic gtar in this respect. */ + a->format_name = "ustar"; a->format_write_header = archive_write_ustar_header; a->format_write_data = archive_write_ustar_data; a->format_finish = archive_write_ustar_finish; From owner-svn-src-head@FreeBSD.ORG Fri Mar 6 06:13: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 3CDD8106564A; Fri, 6 Mar 2009 06:13:27 +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 2B48C8FC19; Fri, 6 Mar 2009 06:13:27 +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 n266DP5c010301; Fri, 6 Mar 2009 06:13:25 GMT (envelope-from kientzle@svn.freebsd.org) Received: (from kientzle@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n266DPwH010300; Fri, 6 Mar 2009 06:13:25 GMT (envelope-from kientzle@svn.freebsd.org) Message-Id: <200903060613.n266DPwH010300@svn.freebsd.org> From: Tim Kientzle Date: Fri, 6 Mar 2009 06:13:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r189439 - head/lib/libarchive 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, 06 Mar 2009 06:13:27 -0000 Author: kientzle Date: Fri Mar 6 06:13:25 2009 New Revision: 189439 URL: http://svn.freebsd.org/changeset/base/189439 Log: Merge r541,r542 from libarchive.googlecode.com: Two sign mismatches in the Zip reader. Modified: head/lib/libarchive/archive_read_support_format_zip.c Modified: head/lib/libarchive/archive_read_support_format_zip.c ============================================================================== --- head/lib/libarchive/archive_read_support_format_zip.c Fri Mar 6 05:58:56 2009 (r189438) +++ head/lib/libarchive/archive_read_support_format_zip.c Fri Mar 6 06:13:25 2009 (r189439) @@ -172,7 +172,7 @@ archive_read_format_zip_bid(struct archi { const char *p; const void *buff; - size_t bytes_avail, offset; + ssize_t bytes_avail, offset; if ((p = __archive_read_ahead(a, 4, NULL)) == NULL) return (-1); @@ -241,7 +241,8 @@ skip_sfx(struct archive_read *a) { const void *h; const char *p, *q; - size_t skip, bytes; + size_t skip; + ssize_t bytes; /* * TODO: We should be able to skip forward by a bunch From owner-svn-src-head@FreeBSD.ORG Fri Mar 6 06:14: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 5F3A61065670; Fri, 6 Mar 2009 06:14:44 +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 4D9C38FC0C; Fri, 6 Mar 2009 06:14:44 +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 n266EiRG010359; Fri, 6 Mar 2009 06:14:44 GMT (envelope-from kientzle@svn.freebsd.org) Received: (from kientzle@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n266EiSD010358; Fri, 6 Mar 2009 06:14:44 GMT (envelope-from kientzle@svn.freebsd.org) Message-Id: <200903060614.n266EiSD010358@svn.freebsd.org> From: Tim Kientzle Date: Fri, 6 Mar 2009 06:14: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: r189440 - head/lib/libarchive 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, 06 Mar 2009 06:14:44 -0000 Author: kientzle Date: Fri Mar 6 06:14:44 2009 New Revision: 189440 URL: http://svn.freebsd.org/changeset/base/189440 Log: Merge r668 from libarchive.googlecode.com: Style correction to the 'ar' reader: Don't redefine 'isdigit' and don't create a macro that's only used once. Modified: head/lib/libarchive/archive_read_support_format_ar.c Modified: head/lib/libarchive/archive_read_support_format_ar.c ============================================================================== --- head/lib/libarchive/archive_read_support_format_ar.c Fri Mar 6 06:13:25 2009 (r189439) +++ head/lib/libarchive/archive_read_support_format_ar.c Fri Mar 6 06:14:44 2009 (r189440) @@ -72,8 +72,6 @@ struct ar { #define AR_fmag_offset 58 #define AR_fmag_size 2 -#define isdigit(x) (x) >= '0' && (x) <= '9' - static int archive_read_format_ar_bid(struct archive_read *a); static int archive_read_format_ar_cleanup(struct archive_read *a); static int archive_read_format_ar_read_data(struct archive_read *a, @@ -309,8 +307,10 @@ archive_read_format_ar_read_header(struc /* * GNU variant handles long filenames by storing / * to indicate a name stored in the filename table. + * XXX TODO: Verify that it's all digits... Don't be fooled + * by "/9xyz" XXX */ - if (filename[0] == '/' && isdigit(filename[1])) { + if (filename[0] == '/' && filename[1] >= '0' && filename[1] <= '9') { number = ar_atol10(h + AR_name_offset + 1, AR_name_size - 1); /* * If we can't look up the real name, warn and return From owner-svn-src-head@FreeBSD.ORG Fri Mar 6 11:03: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 321A4106567C; Fri, 6 Mar 2009 11:03:53 +0000 (UTC) (envelope-from rrs@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 1F95C8FC17; Fri, 6 Mar 2009 11:03:53 +0000 (UTC) (envelope-from rrs@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 n26B3quU017375; Fri, 6 Mar 2009 11:03:52 GMT (envelope-from rrs@svn.freebsd.org) Received: (from rrs@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n26B3qpo017373; Fri, 6 Mar 2009 11:03:52 GMT (envelope-from rrs@svn.freebsd.org) Message-Id: <200903061103.n26B3qpo017373@svn.freebsd.org> From: Randall Stewart Date: Fri, 6 Mar 2009 11:03: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: r189444 - head/sys/netinet X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 06 Mar 2009 11:03:53 -0000 Author: rrs Date: Fri Mar 6 11:03:52 2009 New Revision: 189444 URL: http://svn.freebsd.org/changeset/base/189444 Log: Fixes for window probes: 1) WP should never be marked unless flight size is 0 2) When recovering from wp if the peer ack's it we don't mark for retran 3) When recovering, we must assure a timer is still running. Modified: head/sys/netinet/sctp_indata.c head/sys/netinet/sctp_output.c Modified: head/sys/netinet/sctp_indata.c ============================================================================== --- head/sys/netinet/sctp_indata.c Fri Mar 6 10:45:57 2009 (r189443) +++ head/sys/netinet/sctp_indata.c Fri Mar 6 11:03:52 2009 (r189444) @@ -4179,13 +4179,8 @@ sctp_window_probe_recovery(struct sctp_t struct sctp_nets *net, struct sctp_tmit_chunk *tp1) { - struct sctp_tmit_chunk *chk; - - /* First setup this one and get it moved back */ - sctp_flight_size_decrease(tp1); - sctp_total_flight_decrease(stcb, tp1); tp1->window_probe = 0; - if ((tp1->sent == SCTP_FORWARD_TSN_SKIP) || (tp1->data == NULL)) { + if ((tp1->sent >= SCTP_DATAGRAM_ACKED) || (tp1->data == NULL)) { /* TSN's skipped we do NOT move back. */ sctp_misc_ints(SCTP_FLIGHT_LOG_DWN_WP_FWD, tp1->whoTo->flight_size, @@ -4194,7 +4189,12 @@ sctp_window_probe_recovery(struct sctp_t tp1->rec.data.TSN_seq); return; } - tp1->sent = SCTP_DATAGRAM_UNSENT; + /* First setup this by shrinking flight */ + sctp_flight_size_decrease(tp1); + sctp_total_flight_decrease(stcb, tp1); + /* Now mark for resend */ + tp1->sent = SCTP_DATAGRAM_RESEND; + asoc->sent_queue_retran_cnt++; if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_FLIGHT_LOGGING_ENABLE) { sctp_misc_ints(SCTP_FLIGHT_LOG_DOWN_WP, tp1->whoTo->flight_size, @@ -4202,26 +4202,6 @@ sctp_window_probe_recovery(struct sctp_t (uintptr_t) tp1->whoTo, tp1->rec.data.TSN_seq); } - TAILQ_REMOVE(&asoc->sent_queue, tp1, sctp_next); - TAILQ_INSERT_HEAD(&asoc->send_queue, tp1, sctp_next); - asoc->sent_queue_cnt--; - asoc->send_queue_cnt++; - /* - * Now all guys marked for RESEND on the sent_queue must be moved - * back too. - */ - TAILQ_FOREACH(chk, &asoc->sent_queue, sctp_next) { - if (chk->sent == SCTP_DATAGRAM_RESEND) { - /* Another chunk to move */ - chk->sent = SCTP_DATAGRAM_UNSENT; - /* It should not be in flight */ - TAILQ_REMOVE(&asoc->sent_queue, chk, sctp_next); - TAILQ_INSERT_AFTER(&asoc->send_queue, tp1, chk, sctp_next); - asoc->sent_queue_cnt--; - asoc->send_queue_cnt++; - sctp_ucount_decr(asoc->sent_queue_retran_cnt); - } - } } void @@ -4552,8 +4532,9 @@ sctp_express_handle_sack(struct sctp_tcb again: j = 0; TAILQ_FOREACH(net, &asoc->nets, sctp_next) { + int to_ticks; + if (win_probe_recovery && (net->window_probe)) { - net->window_probe = 0; win_probe_recovered = 1; /* * Find first chunk that was used with window probe @@ -4562,25 +4543,35 @@ again: /* sa_ignore FREED_MEMORY */ TAILQ_FOREACH(tp1, &asoc->sent_queue, sctp_next) { if (tp1->window_probe) { - /* move back to data send queue */ sctp_window_probe_recovery(stcb, asoc, net, tp1); break; } } } + if (net->RTO == 0) { + to_ticks = MSEC_TO_TICKS(stcb->asoc.initial_rto); + } else { + to_ticks = MSEC_TO_TICKS(net->RTO); + } if (net->flight_size) { - int to_ticks; - - if (net->RTO == 0) { - to_ticks = MSEC_TO_TICKS(stcb->asoc.initial_rto); - } else { - to_ticks = MSEC_TO_TICKS(net->RTO); - } j++; (void)SCTP_OS_TIMER_START(&net->rxt_timer.timer, to_ticks, sctp_timeout_handler, &net->rxt_timer); + if (net->window_probe) { + net->window_probe = 0; + } } else { - if (SCTP_OS_TIMER_PENDING(&net->rxt_timer.timer)) { + if (net->window_probe) { + /* + * In window probes we must assure a timer + * is still running there + */ + net->window_probe = 0; + if (!SCTP_OS_TIMER_PENDING(&net->rxt_timer.timer)) { + SCTP_OS_TIMER_START(&net->rxt_timer.timer, to_ticks, + sctp_timeout_handler, &net->rxt_timer); + } + } else if (SCTP_OS_TIMER_PENDING(&net->rxt_timer.timer)) { sctp_timer_stop(SCTP_TIMER_TYPE_SEND, stcb->sctp_ep, stcb, net, SCTP_FROM_SCTP_INDATA + SCTP_LOC_22); @@ -5563,7 +5554,6 @@ again: j = 0; TAILQ_FOREACH(net, &asoc->nets, sctp_next) { if (win_probe_recovery && (net->window_probe)) { - net->window_probe = 0; win_probe_recovered = 1; /*- * Find first chunk that was used with @@ -5582,8 +5572,21 @@ again: j++; sctp_timer_start(SCTP_TIMER_TYPE_SEND, stcb->sctp_ep, stcb, net); + if (net->window_probe) { + } } else { - if (SCTP_OS_TIMER_PENDING(&net->rxt_timer.timer)) { + if (net->window_probe) { + /* + * In window probes we must assure a timer + * is still running there + */ + + if (!SCTP_OS_TIMER_PENDING(&net->rxt_timer.timer)) { + sctp_timer_start(SCTP_TIMER_TYPE_SEND, + stcb->sctp_ep, stcb, net); + + } + } else if (SCTP_OS_TIMER_PENDING(&net->rxt_timer.timer)) { sctp_timer_stop(SCTP_TIMER_TYPE_SEND, stcb->sctp_ep, stcb, net, SCTP_FROM_SCTP_INDATA + SCTP_LOC_22); @@ -6553,8 +6556,9 @@ sctp_express_handle_nr_sack(struct sctp_ again: j = 0; TAILQ_FOREACH(net, &asoc->nets, sctp_next) { + int to_ticks; + if (win_probe_recovery && (net->window_probe)) { - net->window_probe = 0; win_probe_recovered = 1; /* * Find first chunk that was used with window probe @@ -6569,19 +6573,29 @@ again: } } } + if (net->RTO == 0) { + to_ticks = MSEC_TO_TICKS(stcb->asoc.initial_rto); + } else { + to_ticks = MSEC_TO_TICKS(net->RTO); + } if (net->flight_size) { - int to_ticks; - if (net->RTO == 0) { - to_ticks = MSEC_TO_TICKS(stcb->asoc.initial_rto); - } else { - to_ticks = MSEC_TO_TICKS(net->RTO); - } j++; (void)SCTP_OS_TIMER_START(&net->rxt_timer.timer, to_ticks, sctp_timeout_handler, &net->rxt_timer); + if (net->window_probe) { + net->window_probe = 0; + } } else { - if (SCTP_OS_TIMER_PENDING(&net->rxt_timer.timer)) { + if (net->window_probe) { + /* + * In window probes we must assure a timer + * is still running there + */ + net->window_probe = 0; + (void)SCTP_OS_TIMER_START(&net->rxt_timer.timer, to_ticks, + sctp_timeout_handler, &net->rxt_timer); + } else if (SCTP_OS_TIMER_PENDING(&net->rxt_timer.timer)) { sctp_timer_stop(SCTP_TIMER_TYPE_SEND, stcb->sctp_ep, stcb, net, SCTP_FROM_SCTP_INDATA + SCTP_LOC_22); @@ -8111,7 +8125,6 @@ again: j = 0; TAILQ_FOREACH(net, &asoc->nets, sctp_next) { if (win_probe_recovery && (net->window_probe)) { - net->window_probe = 0; win_probe_recovered = 1; /*- * Find first chunk that was used with @@ -8130,8 +8143,15 @@ again: j++; sctp_timer_start(SCTP_TIMER_TYPE_SEND, stcb->sctp_ep, stcb, net); + if (net->window_probe) { + net->window_probe = 0; + } } else { - if (SCTP_OS_TIMER_PENDING(&net->rxt_timer.timer)) { + if (net->window_probe) { + net->window_probe = 0; + sctp_timer_start(SCTP_TIMER_TYPE_SEND, + stcb->sctp_ep, stcb, net); + } else if (SCTP_OS_TIMER_PENDING(&net->rxt_timer.timer)) { sctp_timer_stop(SCTP_TIMER_TYPE_SEND, stcb->sctp_ep, stcb, net, SCTP_FROM_SCTP_INDATA + SCTP_LOC_22); Modified: head/sys/netinet/sctp_output.c ============================================================================== --- head/sys/netinet/sctp_output.c Fri Mar 6 10:45:57 2009 (r189443) +++ head/sys/netinet/sctp_output.c Fri Mar 6 11:03:52 2009 (r189444) @@ -10036,7 +10036,7 @@ again_one_more_time: SCTP_STAT_INCR_COUNTER64(sctps_fragusrmsgs); } if ((mtu == 0) || (r_mtu == 0) || (one_chunk)) { - if (one_chunk) { + if ((one_chunk) && (stcb->asoc.total_flight == 0)) { data_list[0]->window_probe = 1; net->window_probe = 1; } From owner-svn-src-head@FreeBSD.ORG Fri Mar 6 11:10: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 5E12B106566B; Fri, 6 Mar 2009 11:10:31 +0000 (UTC) (envelope-from nyan@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 4C88C8FC0C; Fri, 6 Mar 2009 11:10:31 +0000 (UTC) (envelope-from nyan@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 n26BAV7A017538; Fri, 6 Mar 2009 11:10:31 GMT (envelope-from nyan@svn.freebsd.org) Received: (from nyan@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n26BAVTW017537; Fri, 6 Mar 2009 11:10:31 GMT (envelope-from nyan@svn.freebsd.org) Message-Id: <200903061110.n26BAVTW017537@svn.freebsd.org> From: Takahashi Yoshihiro Date: Fri, 6 Mar 2009 11:10:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r189445 - head/sys/pc98/cbus X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 06 Mar 2009 11:10:31 -0000 Author: nyan Date: Fri Mar 6 11:10:31 2009 New Revision: 189445 URL: http://svn.freebsd.org/changeset/base/189445 Log: MFi386: part of 189421 - If there are no syscons hints at all, assume there is a single sc0 device anyway. The console probe will still fail unless a VGA adapter is found. Modified: head/sys/pc98/cbus/syscons_cbus.c Modified: head/sys/pc98/cbus/syscons_cbus.c ============================================================================== --- head/sys/pc98/cbus/syscons_cbus.c Fri Mar 6 11:03:52 2009 (r189444) +++ head/sys/pc98/cbus/syscons_cbus.c Fri Mar 6 11:10:31 2009 (r189445) @@ -203,8 +203,10 @@ sc_get_cons_priority(int *unit, int *fla *flags = f; } } - if (*unit < 0) - return CN_DEAD; + if (*unit < 0) { + *unit = 0; + *flags = 0; + } return CN_INTERNAL; } From owner-svn-src-head@FreeBSD.ORG Fri Mar 6 11:15:24 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 8FB41106566B; Fri, 6 Mar 2009 11:15:24 +0000 (UTC) (envelope-from nyan@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 7E0188FC13; Fri, 6 Mar 2009 11:15:24 +0000 (UTC) (envelope-from nyan@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 n26BFOfq017668; Fri, 6 Mar 2009 11:15:24 GMT (envelope-from nyan@svn.freebsd.org) Received: (from nyan@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n26BFOml017667; Fri, 6 Mar 2009 11:15:24 GMT (envelope-from nyan@svn.freebsd.org) Message-Id: <200903061115.n26BFOml017667@svn.freebsd.org> From: Takahashi Yoshihiro Date: Fri, 6 Mar 2009 11:15:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r189446 - head/sys/pc98/pc98 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, 06 Mar 2009 11:15:25 -0000 Author: nyan Date: Fri Mar 6 11:15:24 2009 New Revision: 189446 URL: http://svn.freebsd.org/changeset/base/189446 Log: MFi386: 189423 A better fix for handling different FPU initial control words for different ABIs. Modified: head/sys/pc98/pc98/machdep.c Modified: head/sys/pc98/pc98/machdep.c ============================================================================== --- head/sys/pc98/pc98/machdep.c Fri Mar 6 11:10:31 2009 (r189445) +++ head/sys/pc98/pc98/machdep.c Fri Mar 6 11:15:24 2009 (r189446) @@ -1161,7 +1161,7 @@ cpu_idle_wakeup(int cpu) void (*cpu_idle_hook)(void) = cpu_idle_default; /* - * Clear registers on exec + * Reset registers to default values on exec. */ void exec_setregs(td, entry, stack, ps_strings) @@ -1226,6 +1226,7 @@ exec_setregs(td, entry, stack, ps_string * emulators don't provide an entry point for initialization. */ td->td_pcb->pcb_flags &= ~FP_SOFTFP; + pcb->pcb_initial_npxcw = __INITIAL_NPXCW__; /* * Drop the FP state if we hold it, so that the process gets a From owner-svn-src-head@FreeBSD.ORG Fri Mar 6 11:24:42 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 AE6611065674; Fri, 6 Mar 2009 11:24:42 +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 9856F8FC0A; Fri, 6 Mar 2009 11:24:42 +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 n26BOgf2017858; Fri, 6 Mar 2009 11:24:42 GMT (envelope-from rnoland@svn.freebsd.org) Received: (from rnoland@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n26BOgvi017857; Fri, 6 Mar 2009 11:24:42 GMT (envelope-from rnoland@svn.freebsd.org) Message-Id: <200903061124.n26BOgvi017857@svn.freebsd.org> From: Robert Noland Date: Fri, 6 Mar 2009 11:24: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: r189447 - head/sys/dev/pci 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, 06 Mar 2009 11:24:44 -0000 Author: rnoland Date: Fri Mar 6 11:24:42 2009 New Revision: 189447 URL: http://svn.freebsd.org/changeset/base/189447 Log: Invert the logic error for the MSI/MSIX vs INTx case. Pointyhat to: me MFC after: 3 days Modified: head/sys/dev/pci/pci.c Modified: head/sys/dev/pci/pci.c ============================================================================== --- head/sys/dev/pci/pci.c Fri Mar 6 11:15:24 2009 (r189446) +++ head/sys/dev/pci/pci.c Fri Mar 6 11:24:42 2009 (r189447) @@ -2920,7 +2920,7 @@ pci_teardown_intr(device_t dev, device_t return(bus_generic_teardown_intr(dev, child, irq, cookie)); rid = rman_get_rid(irq); - if (rid > 0) { + if (rid == 0) { /* Mask INTx */ pci_set_command_bit(dev, child, PCIM_CMD_INTxDIS); } else { From owner-svn-src-head@FreeBSD.ORG Fri Mar 6 13:24:56 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 77526106564A; Fri, 6 Mar 2009 13:24:56 +0000 (UTC) (envelope-from phk@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 6614B8FC16; Fri, 6 Mar 2009 13:24:56 +0000 (UTC) (envelope-from phk@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 n26DOudA020048; Fri, 6 Mar 2009 13:24:56 GMT (envelope-from phk@svn.freebsd.org) Received: (from phk@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n26DOs1v020045; Fri, 6 Mar 2009 13:24:54 GMT (envelope-from phk@svn.freebsd.org) Message-Id: <200903061324.n26DOs1v020045@svn.freebsd.org> From: Poul-Henning Kamp Date: Fri, 6 Mar 2009 13:24: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: r189448 - head/games/fortune/datfiles 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, 06 Mar 2009 13:24:56 -0000 Author: phk Date: Fri Mar 6 13:24:54 2009 New Revision: 189448 URL: http://svn.freebsd.org/changeset/base/189448 Log: Too good to pass. Modified: head/games/fortune/datfiles/fortunes Modified: head/games/fortune/datfiles/fortunes ============================================================================== --- head/games/fortune/datfiles/fortunes Fri Mar 6 11:24:42 2009 (r189447) +++ head/games/fortune/datfiles/fortunes Fri Mar 6 13:24:54 2009 (r189448) @@ -50799,6 +50799,14 @@ Things are more like they used to be tha Things are not always what they seem. -- Phaedrus % +Things Charles Darwin did not say: + +Finches, eh ? Seen one, seem 'em all. +% +Things Charles Darwin did not say: + +Nah, it's only a theory - I don't think it should be taught in schools. +% Things equal to nothing else are equal to each other. % Things fall apart; the centre cannot hold. From owner-svn-src-head@FreeBSD.ORG Fri Mar 6 14:53:52 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 1C17D106564A; Fri, 6 Mar 2009 14:53:52 +0000 (UTC) (envelope-from joerg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E43708FC21; Fri, 6 Mar 2009 14:53:51 +0000 (UTC) (envelope-from joerg@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 n26ErpdI021827; Fri, 6 Mar 2009 14:53:51 GMT (envelope-from joerg@svn.freebsd.org) Received: (from joerg@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n26ErpMc021825; Fri, 6 Mar 2009 14:53:51 GMT (envelope-from joerg@svn.freebsd.org) Message-Id: <200903061453.n26ErpMc021825@svn.freebsd.org> From: Joerg Wunsch Date: Fri, 6 Mar 2009 14:53: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: r189449 - in head/sys/dev/usb: . serial 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, 06 Mar 2009 14:53:52 -0000 Author: joerg Date: Fri Mar 6 14:53:51 2009 New Revision: 189449 URL: http://svn.freebsd.org/changeset/base/189449 Log: Add a couple of more things to the FTDI driver I came across: . Dresden Elektronik "Wireless Handheld Terminal" . Atmel STK541 "Zigbee Controller" MFC after: 1 week Modified: head/sys/dev/usb/serial/uftdi.c head/sys/dev/usb/usbdevs Modified: head/sys/dev/usb/serial/uftdi.c ============================================================================== --- head/sys/dev/usb/serial/uftdi.c Fri Mar 6 13:24:54 2009 (r189448) +++ head/sys/dev/usb/serial/uftdi.c Fri Mar 6 14:53:51 2009 (r189449) @@ -201,7 +201,9 @@ MODULE_DEPEND(uftdi, ucom, 1, 1, 1); MODULE_DEPEND(uftdi, usb, 1, 1, 1); static struct usb2_device_id uftdi_devs[] = { + {USB_VPI(USB_VENDOR_ATMEL, USB_PRODUCT_ATMEL_STK541, UFTDI_TYPE_8U232AM)}, {USB_VPI(USB_VENDOR_DRESDENELEKTRONIK, USB_PRODUCT_DRESDENELEKTRONIK_SENSORTERMINALBOARD, UFTDI_TYPE_8U232AM)}, + {USB_VPI(USB_VENDOR_DRESDENELEKTRONIK, USB_PRODUCT_DRESDENELEKTRONIK_WIRELESSHANDHELDTERMINAL, UFTDI_TYPE_8U232AM)}, {USB_VPI(USB_VENDOR_FTDI, USB_PRODUCT_FTDI_SERIAL_8U100AX, UFTDI_TYPE_SIO)}, {USB_VPI(USB_VENDOR_FTDI, USB_PRODUCT_FTDI_SERIAL_2232C, UFTDI_TYPE_8U232AM)}, {USB_VPI(USB_VENDOR_FTDI, USB_PRODUCT_FTDI_SERIAL_8U232AM, UFTDI_TYPE_8U232AM)}, Modified: head/sys/dev/usb/usbdevs ============================================================================== --- head/sys/dev/usb/usbdevs Fri Mar 6 13:24:54 2009 (r189448) +++ head/sys/dev/usb/usbdevs Fri Mar 6 14:53:51 2009 (r189449) @@ -911,6 +911,7 @@ product ATHEROS2 AR5523_3 0x0005 AR5523 product ATHEROS2 AR5523_3_NF 0x0006 AR5523 (no firmware) /* Atmel Comp. products */ +product ATMEL STK541 0x2109 Zigbee Controller product ATMEL UHB124 0x3301 UHB124 hub product ATMEL DWL120 0x7603 DWL-120 Wireless Adapter product ATMEL BW002 0x7605 BW002 Wireless Adapter @@ -1174,6 +1175,7 @@ product DRAYTEK VIGOR550 0x0550 Vigor550 /* dresden elektronik products */ product DRESDENELEKTRONIK SENSORTERMINALBOARD 0x0001 SensorTerminalBoard +product DRESDENELEKTRONIK WIRELESSHANDHELDTERMINAL 0x0004 Wireless Handheld Terminal /* Dynastream Innovations */ product DYNASTREAM ANTDEVBOARD 0x1003 ANT dev board From owner-svn-src-head@FreeBSD.ORG Fri Mar 6 15:27: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 BCC8E1065700; Fri, 6 Mar 2009 15:27:27 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from cyrus.watson.org (cyrus.watson.org [65.122.17.42]) by mx1.freebsd.org (Postfix) with ESMTP id 8B9478FC15; Fri, 6 Mar 2009 15:27:27 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from server.baldwin.cx (pool-98-109-39-197.nwrknj.fios.verizon.net [98.109.39.197]) by cyrus.watson.org (Postfix) with ESMTPSA id 342FB46BB2; Fri, 6 Mar 2009 10:27:27 -0500 (EST) Received: from localhost (john@localhost [127.0.0.1]) (authenticated bits=0) by server.baldwin.cx (8.14.3/8.14.3) with ESMTP id n26FRLdV014146; Fri, 6 Mar 2009 10:27:21 -0500 (EST) (envelope-from jhb@freebsd.org) From: John Baldwin To: Takahashi Yoshihiro Date: Fri, 6 Mar 2009 10:00:12 -0500 User-Agent: KMail/1.9.7 References: <200903061115.n26BFOml017667@svn.freebsd.org> In-Reply-To: <200903061115.n26BFOml017667@svn.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200903061000.12429.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH authentication, not delayed by milter-greylist-2.0.2 (server.baldwin.cx [127.0.0.1]); Fri, 06 Mar 2009 10:27:21 -0500 (EST) X-Virus-Scanned: ClamAV 0.94.2/9077/Thu Mar 5 21:48:57 2009 on server.baldwin.cx X-Virus-Status: Clean X-Spam-Status: No, score=-4.4 required=4.2 tests=ALL_TRUSTED,AWL,BAYES_00 autolearn=ham version=3.1.3 X-Spam-Checker-Version: SpamAssassin 3.1.3 (2006-06-01) on server.baldwin.cx Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r189446 - head/sys/pc98/pc98 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, 06 Mar 2009 15:27:28 -0000 On Friday 06 March 2009 6:15:24 am Takahashi Yoshihiro wrote: > Author: nyan > Date: Fri Mar 6 11:15:24 2009 > New Revision: 189446 > URL: http://svn.freebsd.org/changeset/base/189446 > > Log: > MFi386: 189423 > > A better fix for handling different FPU initial control words for different > ABIs. Gah, sorry I missed this. :( -- John Baldwin From owner-svn-src-head@FreeBSD.ORG Fri Mar 6 15:35: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 DBFAB1065673; Fri, 6 Mar 2009 15:35:37 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C98928FC08; Fri, 6 Mar 2009 15:35:37 +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 n26FZb2g022678; Fri, 6 Mar 2009 15:35:37 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n26FZblQ022673; Fri, 6 Mar 2009 15:35:37 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <200903061535.n26FZblQ022673@svn.freebsd.org> From: Konstantin Belousov Date: Fri, 6 Mar 2009 15:35: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: r189450 - in head/sys: fs/devfs 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: Fri, 06 Mar 2009 15:35:38 -0000 Author: kib Date: Fri Mar 6 15:35:37 2009 New Revision: 189450 URL: http://svn.freebsd.org/changeset/base/189450 Log: Extract the no_poll() and vop_nopoll() code into the common routine poll_no_poll(). Return a poll_no_poll() result from devfs_poll_f() when filedescriptor does not reference the live cdev, instead of ENXIO. Noted and tested by: hps MFC after: 1 week Modified: head/sys/fs/devfs/devfs_vnops.c head/sys/kern/kern_conf.c head/sys/kern/sys_generic.c head/sys/kern/vfs_default.c head/sys/sys/systm.h Modified: head/sys/fs/devfs/devfs_vnops.c ============================================================================== --- head/sys/fs/devfs/devfs_vnops.c Fri Mar 6 14:53:51 2009 (r189449) +++ head/sys/fs/devfs/devfs_vnops.c Fri Mar 6 15:35:37 2009 (r189450) @@ -1014,7 +1014,7 @@ devfs_poll_f(struct file *fp, int events fpop = td->td_fpop; error = devfs_fp_check(fp, &dev, &dsw); if (error) - return (error); + return (poll_no_poll(events)); error = dsw->d_poll(dev, events, td); td->td_fpop = fpop; dev_relthread(dev); Modified: head/sys/kern/kern_conf.c ============================================================================== --- head/sys/kern/kern_conf.c Fri Mar 6 14:53:51 2009 (r189449) +++ head/sys/kern/kern_conf.c Fri Mar 6 15:35:37 2009 (r189450) @@ -312,18 +312,8 @@ no_strategy(struct bio *bp) static int no_poll(struct cdev *dev __unused, int events, struct thread *td __unused) { - /* - * Return true for read/write. If the user asked for something - * special, return POLLNVAL, so that clients have a way of - * determining reliably whether or not the extended - * functionality is present without hard-coding knowledge - * of specific filesystem implementations. - * Stay in sync with vop_nopoll(). - */ - if (events & ~POLLSTANDARD) - return (POLLNVAL); - return (events & (POLLIN | POLLOUT | POLLRDNORM | POLLWRNORM)); + return (poll_no_poll(events)); } #define no_dump (dumper_t *)enodev Modified: head/sys/kern/sys_generic.c ============================================================================== --- head/sys/kern/sys_generic.c Fri Mar 6 14:53:51 2009 (r189449) +++ head/sys/kern/sys_generic.c Fri Mar 6 15:35:37 2009 (r189450) @@ -731,6 +731,22 @@ out: return (error); } +int +poll_no_poll(int events) +{ + /* + * Return true for read/write. If the user asked for something + * special, return POLLNVAL, so that clients have a way of + * determining reliably whether or not the extended + * functionality is present without hard-coding knowledge + * of specific filesystem implementations. + */ + if (events & ~POLLSTANDARD) + return (POLLNVAL); + + return (events & (POLLIN | POLLOUT | POLLRDNORM | POLLWRNORM)); +} + #ifndef _SYS_SYSPROTO_H_ struct select_args { int nd; Modified: head/sys/kern/vfs_default.c ============================================================================== --- head/sys/kern/vfs_default.c Fri Mar 6 14:53:51 2009 (r189449) +++ head/sys/kern/vfs_default.c Fri Mar 6 15:35:37 2009 (r189450) @@ -354,18 +354,8 @@ vop_nopoll(ap) struct thread *a_td; } */ *ap; { - /* - * Return true for read/write. If the user asked for something - * special, return POLLNVAL, so that clients have a way of - * determining reliably whether or not the extended - * functionality is present without hard-coding knowledge - * of specific filesystem implementations. - * Stay in sync with kern_conf.c::no_poll(). - */ - if (ap->a_events & ~POLLSTANDARD) - return (POLLNVAL); - return (ap->a_events & (POLLIN | POLLOUT | POLLRDNORM | POLLWRNORM)); + return (poll_no_poll(ap->a_events)); } /* Modified: head/sys/sys/systm.h ============================================================================== --- head/sys/sys/systm.h Fri Mar 6 14:53:51 2009 (r189449) +++ head/sys/sys/systm.h Fri Mar 6 15:35:37 2009 (r189450) @@ -317,6 +317,8 @@ struct cdev; dev_t dev2udev(struct cdev *x); const char *devtoname(struct cdev *cdev); +int poll_no_poll(int events); + /* XXX: Should be void nanodelay(u_int nsec); */ void DELAY(int usec); From owner-svn-src-head@FreeBSD.ORG Fri Mar 6 17:04: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 505F11065674; Fri, 6 Mar 2009 17:04:48 +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 3E3B78FC16; Fri, 6 Mar 2009 17:04:48 +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 n26H4mg3024477; Fri, 6 Mar 2009 17:04:48 GMT (envelope-from thompsa@svn.freebsd.org) Received: (from thompsa@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n26H4mYp024476; Fri, 6 Mar 2009 17:04:48 GMT (envelope-from thompsa@svn.freebsd.org) Message-Id: <200903061704.n26H4mYp024476@svn.freebsd.org> From: Andrew Thompson Date: Fri, 6 Mar 2009 17:04: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: r189452 - head/sys/dev/usb/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: Fri, 06 Mar 2009 17:04:48 -0000 Author: thompsa Date: Fri Mar 6 17:04:47 2009 New Revision: 189452 URL: http://svn.freebsd.org/changeset/base/189452 Log: Ensure the cached rq pointer is still valid before waking up the address, the zyd_cmd function may have timed out. It wouldnt cause a panic but could wakeup someone. Spotted by: HPS Modified: head/sys/dev/usb/wlan/if_zyd.c Modified: head/sys/dev/usb/wlan/if_zyd.c ============================================================================== --- head/sys/dev/usb/wlan/if_zyd.c Fri Mar 6 16:47:50 2009 (r189451) +++ head/sys/dev/usb/wlan/if_zyd.c Fri Mar 6 17:04:47 2009 (r189452) @@ -796,10 +796,14 @@ zyd_intr_write_callback(struct usb2_xfer switch (USB_GET_STATE(xfer)) { case USB_ST_TRANSFERRED: - rqp = xfer->priv_fifo; - DPRINTF(sc, ZYD_DEBUG_CMD, "command %p transferred\n", rqp); - if ((rqp->flags & ZYD_CMD_FLAG_READ) == 0) - wakeup(rqp); /* wakeup caller */ + DPRINTF(sc, ZYD_DEBUG_CMD, "command %p transferred\n", + xfer->priv_fifo); + STAILQ_FOREACH(rqp, &sc->sc_rqh, rq) { + /* Ensure the cached rq pointer is still valid */ + if (rqp == xfer->priv_fifo && + (rqp->flags & ZYD_CMD_FLAG_READ) == 0) + wakeup(rqp); /* wakeup caller */ + } /* FALLTHROUGH */ case USB_ST_SETUP: From owner-svn-src-head@FreeBSD.ORG Fri Mar 6 17:13: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 29F7B1065677; Fri, 6 Mar 2009 17:13:13 +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 17E048FC12; Fri, 6 Mar 2009 17:13:13 +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 n26HDCrW024680; Fri, 6 Mar 2009 17:13:12 GMT (envelope-from thompsa@svn.freebsd.org) Received: (from thompsa@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n26HDCe9024679; Fri, 6 Mar 2009 17:13:12 GMT (envelope-from thompsa@svn.freebsd.org) Message-Id: <200903061713.n26HDCe9024679@svn.freebsd.org> From: Andrew Thompson Date: Fri, 6 Mar 2009 17:13:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r189453 - head/sys/dev/usb/controller 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, 06 Mar 2009 17:13:13 -0000 Author: thompsa Date: Fri Mar 6 17:13:12 2009 New Revision: 189453 URL: http://svn.freebsd.org/changeset/base/189453 Log: MFp4 //depot/projects/usb@158692 Workaround a EHCI performance problem by issuing a doorbell after queueing a bulk xfer. Submitted by: Hans Petter Selasky Modified: head/sys/dev/usb/controller/ehci.c Modified: head/sys/dev/usb/controller/ehci.c ============================================================================== --- head/sys/dev/usb/controller/ehci.c Fri Mar 6 17:04:47 2009 (r189452) +++ head/sys/dev/usb/controller/ehci.c Fri Mar 6 17:13:12 2009 (r189453) @@ -2189,12 +2189,21 @@ static void ehci_device_bulk_start(struct usb2_xfer *xfer) { ehci_softc_t *sc = EHCI_BUS2SC(xfer->xroot->bus); + uint32_t temp; /* setup TD's and QH */ ehci_setup_standard_chain(xfer, &sc->sc_async_p_last); /* put transfer on interrupt queue */ ehci_transfer_intr_enqueue(xfer); + + /* XXX Performance quirk: Some Host Controllers have a too low + * interrupt rate. Issue an IAAD to stimulate the Host + * Controller after queueing the BULK transfer. + */ + temp = EOREAD4(sc, EHCI_USBCMD); + if (!(temp & EHCI_CMD_IAAD)) + EOWRITE4(sc, EHCI_USBCMD, temp | EHCI_CMD_IAAD); } struct usb2_pipe_methods ehci_device_bulk_methods = From owner-svn-src-head@FreeBSD.ORG Fri Mar 6 17:40: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 5B4E210656CA; Fri, 6 Mar 2009 17:40:58 +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 49A2B8FC22; Fri, 6 Mar 2009 17:40:58 +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 n26Hew0s025205; Fri, 6 Mar 2009 17:40:58 GMT (envelope-from alc@svn.freebsd.org) Received: (from alc@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n26HewOc025204; Fri, 6 Mar 2009 17:40:58 GMT (envelope-from alc@svn.freebsd.org) Message-Id: <200903061740.n26HewOc025204@svn.freebsd.org> From: Alan Cox Date: Fri, 6 Mar 2009 17:40: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: r189454 - 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, 06 Mar 2009 17:40:59 -0000 Author: alc Date: Fri Mar 6 17:40:58 2009 New Revision: 189454 URL: http://svn.freebsd.org/changeset/base/189454 Log: If the PDE is known, then use the direct mapping instead of the recursive mapping to access the PTE. Modified: head/sys/amd64/amd64/pmap.c Modified: head/sys/amd64/amd64/pmap.c ============================================================================== --- head/sys/amd64/amd64/pmap.c Fri Mar 6 17:13:12 2009 (r189453) +++ head/sys/amd64/amd64/pmap.c Fri Mar 6 17:40:58 2009 (r189454) @@ -3801,7 +3801,9 @@ pmap_remove_pages(pmap_t pmap) if ((tpte & PG_PS) != 0) pte = pde; else { - pte = vtopte(pv->pv_va); + pte = (pt_entry_t *)PHYS_TO_DMAP(tpte & + PG_FRAME); + pte = &pte[pmap_pte_index(pv->pv_va)]; tpte = *pte & ~PG_PTE_PAT; } @@ -4494,7 +4496,7 @@ pmap_change_attr_locked(vm_offset_t va, if (!pmap_demote_pde(kernel_pmap, pde, tmpva)) return (ENOMEM); } - pte = vtopte(tmpva); + pte = pmap_pde_to_pte(pde, tmpva); if (*pte == 0) return (EINVAL); tmpva += PAGE_SIZE; @@ -4570,7 +4572,7 @@ pmap_change_attr_locked(vm_offset_t va, } else { if (cache_bits_pte < 0) cache_bits_pte = pmap_cache_bits(mode, 0); - pte = vtopte(tmpva); + pte = pmap_pde_to_pte(pde, tmpva); if ((*pte & PG_PTE_CACHE) != cache_bits_pte) { pmap_pte_attr(pte, cache_bits_pte); if (!changed) From owner-svn-src-head@FreeBSD.ORG Fri Mar 6 20:17: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 AB254106564A; Fri, 6 Mar 2009 20:17:16 +0000 (UTC) (envelope-from lulf@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 991628FC12; Fri, 6 Mar 2009 20:17:16 +0000 (UTC) (envelope-from lulf@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 n26KHGRS028163; Fri, 6 Mar 2009 20:17:16 GMT (envelope-from lulf@svn.freebsd.org) Received: (from lulf@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n26KHG0r028162; Fri, 6 Mar 2009 20:17:16 GMT (envelope-from lulf@svn.freebsd.org) Message-Id: <200903062017.n26KHG0r028162@svn.freebsd.org> From: Ulf Lilleengen Date: Fri, 6 Mar 2009 20:17:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r189455 - head/contrib/csup 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, 06 Mar 2009 20:17:17 -0000 Author: lulf Date: Fri Mar 6 20:17:16 2009 New Revision: 189455 URL: http://svn.freebsd.org/changeset/base/189455 Log: - Try to handle rcsfile write failures in the same way as cvsup, as they are not necessarily fatal. If the file was incorrectly written, the checksum will detect it and the file will be retransferred. Modified: head/contrib/csup/updater.c Modified: head/contrib/csup/updater.c ============================================================================== --- head/contrib/csup/updater.c Fri Mar 6 17:40:58 2009 (r189454) +++ head/contrib/csup/updater.c Fri Mar 6 20:17:16 2009 (r189455) @@ -1682,7 +1682,7 @@ updater_rcsedit(struct updater *up, stru stream_close(dest); rcsfile_free(rf); if (error) - return (UPDATER_ERR_PROTO); + lprintf(-1, "Error writing %s\n", name); finish: sr->sr_clientattr = fattr_frompath(path, FATTR_NOFOLLOW); From owner-svn-src-head@FreeBSD.ORG Fri Mar 6 20:40:10 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 1B0B31065672; Fri, 6 Mar 2009 20:40:10 +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 E291E8FC1C; Fri, 6 Mar 2009 20:40:09 +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 n26Ke93h028584; Fri, 6 Mar 2009 20:40:09 GMT (envelope-from sam@svn.freebsd.org) Received: (from sam@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n26Ke9iZ028583; Fri, 6 Mar 2009 20:40:09 GMT (envelope-from sam@svn.freebsd.org) Message-Id: <200903062040.n26Ke9iZ028583@svn.freebsd.org> From: Sam Leffler Date: Fri, 6 Mar 2009 20:40: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: r189456 - head/sys/arm/xscale/ixp425 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, 06 Mar 2009 20:40:10 -0000 Author: sam Date: Fri Mar 6 20:40:09 2009 New Revision: 189456 URL: http://svn.freebsd.org/changeset/base/189456 Log: o simplify code in ixppcib_conf_setup o fixup debug printfs Modified: head/sys/arm/xscale/ixp425/ixp425_pci.c Modified: head/sys/arm/xscale/ixp425/ixp425_pci.c ============================================================================== --- head/sys/arm/xscale/ixp425/ixp425_pci.c Fri Mar 6 20:17:16 2009 (r189455) +++ head/sys/arm/xscale/ixp425/ixp425_pci.c Fri Mar 6 20:40:09 2009 (r189456) @@ -352,21 +352,15 @@ ixppcib_conf_setup(struct ixppcib_softc int reg) { if (bus == 0) { - if (slot == 0 && func == 0) { - PCI_CSR_WRITE_4(sc, PCI_NP_AD, (reg & ~3)); - } else { - bus &= 0xff; - slot &= 0x1f; - func &= 0x07; - /* configuration type 0 */ - PCI_CSR_WRITE_4(sc, PCI_NP_AD, (1U << (32 - slot)) | - (func << 8) | (reg & ~3)); - } + /* configuration type 0 */ + PCI_CSR_WRITE_4(sc, PCI_NP_AD, + (1U << (32 - (slot & 0x1f))) | + ((func & 0x7) << 8) | (reg & ~3)); } else { - /* configuration type 1 */ + /* configuration type 1 */ PCI_CSR_WRITE_4(sc, PCI_NP_AD, - (bus << 16) | (slot << 11) | - (func << 8) | (reg & ~3) | 1); + (bus << 16) | (slot << 11) | + (func << 8) | (reg & ~3) | 1); } } @@ -392,9 +386,9 @@ ixppcib_read_config(device_t dev, u_int ret >>= (reg & 3) * 8; ret &= 0xffffffff >> ((4 - bytes) * 8); #if 0 - device_printf(dev, "read config: %u:%u:%u %#x(%d) = %#x\n", bus, slot, func, reg, bytes, ret); + device_printf(dev, "%s: %u:%u:%u %#x(%d) = %#x\n", + __func__, bus, slot, func, reg, bytes, ret); #endif - /* check & clear PCI abort */ data = PCI_CSR_READ_4(sc, PCI_ISR); if (data & ISR_PFE) { @@ -414,9 +408,9 @@ ixppcib_write_config(device_t dev, u_int u_int32_t data; #if 0 - device_printf(dev, "write config: %u:%u:%u %#x(%d) = %#x\n", bus, slot, func, reg, bytes, val); + device_printf(dev, "%s: %u:%u:%u %#x(%d) = %#x\n", + __func__, bus, slot, func, reg, bytes, val); #endif - ixppcib_conf_setup(sc, bus, slot, func, reg & ~3); /* Byte enables are active low, so not them first */ From owner-svn-src-head@FreeBSD.ORG Fri Mar 6 23:22:10 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 01EA31065670; Fri, 6 Mar 2009 23:22:10 +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 E3E658FC18; Fri, 6 Mar 2009 23:22:09 +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 n26NM90K031494; Fri, 6 Mar 2009 23:22:09 GMT (envelope-from sam@svn.freebsd.org) Received: (from sam@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n26NM9ZZ031493; Fri, 6 Mar 2009 23:22:09 GMT (envelope-from sam@svn.freebsd.org) Message-Id: <200903062322.n26NM9ZZ031493@svn.freebsd.org> From: Sam Leffler Date: Fri, 6 Mar 2009 23:22: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: r189457 - head/sys/arm/xscale/ixp425 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, 06 Mar 2009 23:22:10 -0000 Author: sam Date: Fri Mar 6 23:22:09 2009 New Revision: 189457 URL: http://svn.freebsd.org/changeset/base/189457 Log: fix legacy usb configuration Modified: head/sys/arm/xscale/ixp425/files.ixp425 Modified: head/sys/arm/xscale/ixp425/files.ixp425 ============================================================================== --- head/sys/arm/xscale/ixp425/files.ixp425 Fri Mar 6 20:40:09 2009 (r189456) +++ head/sys/arm/xscale/ixp425/files.ixp425 Fri Mar 6 23:22:09 2009 (r189457) @@ -47,4 +47,4 @@ IxNpeMicrocode.dat optional npe_fw \ arm/xscale/ixp425/ixp425_qmgr.c optional qmgr # dev/usb/controller/ehci_ixp4xx.c optional ehci usb -legacy/dev/usb/ehci_ixp4xx.c optional ehci ousb +legacy/dev/usb/ehci_ixp4xx.c optional oehci ousb From owner-svn-src-head@FreeBSD.ORG Fri Mar 6 23:26: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 862851065678; Fri, 6 Mar 2009 23:26: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 5A8108FC1C; Fri, 6 Mar 2009 23:26: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 n26NQosA031651; Fri, 6 Mar 2009 23:26:50 GMT (envelope-from sam@svn.freebsd.org) Received: (from sam@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n26NQo07031649; Fri, 6 Mar 2009 23:26:50 GMT (envelope-from sam@svn.freebsd.org) Message-Id: <200903062326.n26NQo07031649@svn.freebsd.org> From: Sam Leffler Date: Fri, 6 Mar 2009 23:26: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: r189459 - head/sys/arm/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: Fri, 06 Mar 2009 23:26:51 -0000 Author: sam Date: Fri Mar 6 23:26:50 2009 New Revision: 189459 URL: http://svn.freebsd.org/changeset/base/189459 Log: legacy USB is required on these platforms at the moment Modified: head/sys/arm/conf/AVILA head/sys/arm/conf/CAMBRIA Modified: head/sys/arm/conf/AVILA ============================================================================== --- head/sys/arm/conf/AVILA Fri Mar 6 23:22:23 2009 (r189458) +++ head/sys/arm/conf/AVILA Fri Mar 6 23:26:50 2009 (r189459) @@ -129,14 +129,15 @@ device ath_ar5416 options AH_SUPPORT_AR5416 device ath_ar9160 -device usb +makeoptions WITH_LEGACY +device ousb #options USB_DEBUG -device ohci -device ehci -#device umass -#device scbus # SCSI bus (required for SCSI) -#device da # Direct Access (disks) +device oohci +device oehci +device oumass +device scbus # SCSI bus (required for SCSI) +device da # Direct Access (disks) -#device ural -#device zyd +#device oural +#device ozyd #device wlan_amrr Modified: head/sys/arm/conf/CAMBRIA ============================================================================== --- head/sys/arm/conf/CAMBRIA Fri Mar 6 23:22:23 2009 (r189458) +++ head/sys/arm/conf/CAMBRIA Fri Mar 6 23:26:50 2009 (r189459) @@ -98,15 +98,6 @@ device if_bridge device md device random # Entropy device -# NB: 2 USB 2.0 ports standard -device usb -options USB_EHCI_BIG_ENDIAN_DESC # handle big-endian byte order -#options USB_DEBUG -device ehci -device umass -device scbus # SCSI bus (required for SCSI) -device da # Direct Access (disks) - # Wireless NIC cards device wlan # 802.11 support options IEEE80211_DEBUG @@ -142,6 +133,16 @@ device ath_rf5413 #device ath_rf9280 #device ath_ar9285 -device ural -device zyd -device wlan_amrr +# NB: 2 USB 2.0 ports standard +makeoptions WITH_LEGACY +device ousb +options USB_EHCI_BIG_ENDIAN_DESC # handle big-endian byte order +#options USB_DEBUG +device oehci +device oumass +device scbus # SCSI bus (required for SCSI) +device da # Direct Access (disks) + +#device oural +#device ozyd +#device wlan_amrr From owner-svn-src-head@FreeBSD.ORG Fri Mar 6 23:27:47 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 77217106568D; Fri, 6 Mar 2009 23:27:47 +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 656028FC27; Fri, 6 Mar 2009 23:27:47 +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 n26NRl3a031710; Fri, 6 Mar 2009 23:27:47 GMT (envelope-from sam@svn.freebsd.org) Received: (from sam@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n26NRl62031707; Fri, 6 Mar 2009 23:27:47 GMT (envelope-from sam@svn.freebsd.org) Message-Id: <200903062327.n26NRl62031707@svn.freebsd.org> From: Sam Leffler Date: Fri, 6 Mar 2009 23:27: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: r189460 - head/sys/arm/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: Fri, 06 Mar 2009 23:27:48 -0000 Author: sam Date: Fri Mar 6 23:27:47 2009 New Revision: 189460 URL: http://svn.freebsd.org/changeset/base/189460 Log: enable tdma support by default; many people using these boards are using them to setup tdma p2p links Modified: head/sys/arm/conf/AVILA head/sys/arm/conf/CAMBRIA Modified: head/sys/arm/conf/AVILA ============================================================================== --- head/sys/arm/conf/AVILA Fri Mar 6 23:26:50 2009 (r189459) +++ head/sys/arm/conf/AVILA Fri Mar 6 23:27:47 2009 (r189460) @@ -102,12 +102,14 @@ device random # Entrop # Wireless NIC cards device wlan # 802.11 support options IEEE80211_DEBUG +options IEEE80211_SUPPORT_TDMA device wlan_wep # 802.11 WEP support device wlan_ccmp # 802.11 CCMP support device wlan_tkip # 802.11 TKIP support device wlan_xauth device ath # Atheros pci/cardbus NIC's +options ATH_SUPPORT_TDMA options ATH_DEBUG options ATH_DIAGAPI #options ATH_TX99_DIAG Modified: head/sys/arm/conf/CAMBRIA ============================================================================== --- head/sys/arm/conf/CAMBRIA Fri Mar 6 23:26:50 2009 (r189459) +++ head/sys/arm/conf/CAMBRIA Fri Mar 6 23:27:47 2009 (r189460) @@ -101,12 +101,14 @@ device random # Entrop # Wireless NIC cards device wlan # 802.11 support options IEEE80211_DEBUG +options IEEE80211_SUPPORT_TDMA device wlan_wep # 802.11 WEP support device wlan_ccmp # 802.11 CCMP support device wlan_tkip # 802.11 TKIP support device wlan_xauth device ath # Atheros pci/cardbus NIC's +options ATH_SUPPORT_TDMA options ATH_DEBUG options ATH_DIAGAPI #options ATH_TX99_DIAG From owner-svn-src-head@FreeBSD.ORG Fri Mar 6 23:29: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 1289F106564A; Fri, 6 Mar 2009 23:29:01 +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 DA6448FC17; Fri, 6 Mar 2009 23:29:00 +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 n26NT0Vd031771; Fri, 6 Mar 2009 23:29:00 GMT (envelope-from sam@svn.freebsd.org) Received: (from sam@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n26NT06d031770; Fri, 6 Mar 2009 23:29:00 GMT (envelope-from sam@svn.freebsd.org) Message-Id: <200903062329.n26NT06d031770@svn.freebsd.org> From: Sam Leffler Date: Fri, 6 Mar 2009 23:29: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: r189461 - head/sys/arm/xscale/ixp425 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, 06 Mar 2009 23:29:01 -0000 Author: sam Date: Fri Mar 6 23:29:00 2009 New Revision: 189461 URL: http://svn.freebsd.org/changeset/base/189461 Log: remove unneeded static mappings for NPE and MAC regions; these are already mapped through the IO region so never used Reviewed by: imp, thompsa Modified: head/sys/arm/xscale/ixp425/avila_machdep.c Modified: head/sys/arm/xscale/ixp425/avila_machdep.c ============================================================================== --- head/sys/arm/xscale/ixp425/avila_machdep.c Fri Mar 6 23:27:47 2009 (r189460) +++ head/sys/arm/xscale/ixp425/avila_machdep.c Fri Mar 6 23:29:00 2009 (r189461) @@ -174,23 +174,6 @@ static const struct pmap_devmap ixp425_d { IXP425_QMGR_VBASE, IXP425_QMGR_HWBASE, IXP425_QMGR_SIZE, VM_PROT_READ|VM_PROT_WRITE, PTE_NOCACHE, }, - /* NPE-A Memory Space */ - { IXP425_NPE_A_VBASE, IXP425_NPE_A_HWBASE, IXP425_NPE_A_SIZE, - VM_PROT_READ|VM_PROT_WRITE, PTE_NOCACHE, }, - /* NPE-B Memory Space */ - { IXP425_NPE_B_VBASE, IXP425_NPE_B_HWBASE, IXP425_NPE_B_SIZE, - VM_PROT_READ|VM_PROT_WRITE, PTE_NOCACHE, }, - /* NPE-C Memory Space */ - { IXP425_NPE_C_VBASE, IXP425_NPE_C_HWBASE, IXP425_NPE_C_SIZE, - VM_PROT_READ|VM_PROT_WRITE, PTE_NOCACHE, }, - - /* MAC-B Memory Space */ - { IXP425_MAC_B_VBASE, IXP425_MAC_B_HWBASE, IXP425_MAC_B_SIZE, - VM_PROT_READ|VM_PROT_WRITE, PTE_NOCACHE, }, - /* MAC-C Memory Space */ - { IXP425_MAC_C_VBASE, IXP425_MAC_C_HWBASE, IXP425_MAC_C_SIZE, - VM_PROT_READ|VM_PROT_WRITE, PTE_NOCACHE, }, - { 0 }, }; @@ -220,23 +203,6 @@ static const struct pmap_devmap ixp435_d { IXP425_QMGR_VBASE, IXP425_QMGR_HWBASE, IXP425_QMGR_SIZE, VM_PROT_READ|VM_PROT_WRITE, PTE_NOCACHE, }, - /* NPE-A Memory Space */ - { IXP425_NPE_A_VBASE, IXP425_NPE_A_HWBASE, IXP425_NPE_A_SIZE, - VM_PROT_READ|VM_PROT_WRITE, PTE_NOCACHE, }, - /* NPE-C Memory Space */ - { IXP425_NPE_C_VBASE, IXP425_NPE_C_HWBASE, IXP425_NPE_C_SIZE, - VM_PROT_READ|VM_PROT_WRITE, PTE_NOCACHE, }, - - /* MAC-C Memory Space */ - { IXP425_MAC_C_VBASE, IXP425_MAC_C_HWBASE, IXP425_MAC_C_SIZE, - VM_PROT_READ|VM_PROT_WRITE, PTE_NOCACHE, }, - /* MAC-B Memory Space */ - { IXP425_MAC_B_VBASE, IXP425_MAC_B_HWBASE, IXP425_MAC_B_SIZE, - VM_PROT_READ|VM_PROT_WRITE, PTE_NOCACHE, }, - /* MAC-A Memory Space */ - { IXP435_MAC_A_VBASE, IXP435_MAC_A_HWBASE, IXP435_MAC_A_SIZE, - VM_PROT_READ|VM_PROT_WRITE, PTE_NOCACHE, }, - /* USB1 Memory Space */ { IXP435_USB1_VBASE, IXP435_USB1_HWBASE, IXP435_USB1_SIZE, VM_PROT_READ|VM_PROT_WRITE, PTE_NOCACHE, }, From owner-svn-src-head@FreeBSD.ORG Fri Mar 6 23:30:07 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 DC84D1065673; Fri, 6 Mar 2009 23:30:07 +0000 (UTC) (envelope-from emax@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C959C8FC1F; Fri, 6 Mar 2009 23:30:07 +0000 (UTC) (envelope-from emax@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 n26NU7e5031842; Fri, 6 Mar 2009 23:30:07 GMT (envelope-from emax@svn.freebsd.org) Received: (from emax@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n26NU7cY031836; Fri, 6 Mar 2009 23:30:07 GMT (envelope-from emax@svn.freebsd.org) Message-Id: <200903062330.n26NU7cY031836@svn.freebsd.org> From: Maksim Yevmenkin Date: Fri, 6 Mar 2009 23:30:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r189462 - head/lib/libbluetooth 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, 06 Mar 2009 23:30:08 -0000 Author: emax Date: Fri Mar 6 23:30:07 2009 New Revision: 189462 URL: http://svn.freebsd.org/changeset/base/189462 Log: Add Bluetooth compatibility shims. Inspired by Linux BlueZ and NetBSD. Discussed with: Iain Hibbert plunky -at- rya-online -dot- net of NetBSD MFC after: 1 month Added: head/lib/libbluetooth/dev.c (contents, props changed) head/lib/libbluetooth/hci.c (contents, props changed) Modified: head/lib/libbluetooth/Makefile head/lib/libbluetooth/bluetooth.3 head/lib/libbluetooth/bluetooth.c head/lib/libbluetooth/bluetooth.h Modified: head/lib/libbluetooth/Makefile ============================================================================== --- head/lib/libbluetooth/Makefile Fri Mar 6 23:29:00 2009 (r189461) +++ head/lib/libbluetooth/Makefile Fri Mar 6 23:30:07 2009 (r189462) @@ -9,7 +9,7 @@ CFLAGS+= -I${.CURDIR} -I${.CURDIR}/../.. SHLIB_MAJOR= 3 -SRCS= bluetooth.c +SRCS= bluetooth.c dev.c hci.c INCS= bluetooth.h MLINKS+= bluetooth.3 bt_gethostbyname.3 @@ -27,6 +27,12 @@ MLINKS+= bluetooth.3 bt_endprotoent.3 MLINKS+= bluetooth.3 bt_ntoa.3 MLINKS+= bluetooth.3 bt_aton.3 +MLINKS+= bluetooth.3 bt_devaddr.3 +MLINKS+= bluetooth.3 bt_devname.3 + +MLINKS+= bluetooth.3 bt_devinfo.3 +MLINKS+= bluetooth.3 bt_devenum.3 + MLINKS+= bluetooth.3 bdaddr_same.3 MLINKS+= bluetooth.3 bdaddr_any.3 MLINKS+= bluetooth.3 bdaddr_copy.3 Modified: head/lib/libbluetooth/bluetooth.3 ============================================================================== --- head/lib/libbluetooth/bluetooth.3 Fri Mar 6 23:29:00 2009 (r189461) +++ head/lib/libbluetooth/bluetooth.3 Fri Mar 6 23:30:07 2009 (r189462) @@ -1,4 +1,4 @@ -.\" Copyright (c) 2003 Maksim Yevmenkin +.\" Copyright (c) 2003-2009 Maksim Yevmenkin .\" All rights reserved. .\" .\" Redistribution and use in source and binary forms, with or without @@ -25,7 +25,7 @@ .\" $Id: bluetooth.3,v 1.5 2003/05/20 23:04:30 max Exp $ .\" $FreeBSD$ .\" -.Dd August 13, 2008 +.Dd February 13, 2009 .Dt BLUETOOTH 3 .Os .Sh NAME @@ -74,6 +74,16 @@ .Ft const char * .Fn bt_ntoa "const bdaddr_t *ba" "char *str" .Ft int +.Fn bt_devaddr "const char *devname" "bdaddr_t *addr" +.Ft int +.Fn bt_devname "char *devname" "const bdaddr_t *addr" +.Ft int +.Fn (bt_devenum_cb_t) "int s" "struct bt_devinfo const *di" "void *arg" +.Ft int +.Fn bt_devinfo "struct bt_devinfo *di" +.Ft int +.Fn bt_devenum "bt_devenum_cb_t *cb" "void *arg" +.Ft int .Fn bdaddr_same "const bdaddr_t *a" "const bdaddr_t *b" .Ft int .Fn bdaddr_any "const bdaddr_t *a" @@ -197,6 +207,110 @@ It is up to the caller to ensure that pr If no buffer was provided then internal static buffer will be used. .Pp The +.Fn bt_devaddr +function interprets the specified +.Fa devname +string as the address or device name of a Bluetooth device on the local system, +and places the device address in the provided +.Fa bdaddr , +if any. +The function returns 1 if the string was successfully interpreted, +or 0 if the string did not match any local device. +The +.Fn bt_devname +function takes a Bluetooth device address and copies the local device +name associated with that address into the buffer provided, +if any. +Caller must ensure that provided buffer is at least +.Dv HCI_DEVNAME_SIZE +characters in size. +The function returns 1 when the device was found, +otherwise 0. +.Pp +The +.Fn bt_devinfo +function populates prodivded +.Vt bt_devinfo +structure with the information about given Bluetooth device. +The caller is expected to pass Bluetooth device name in the +.Fa devname +field of the passed +.Vt bt_devinfo +structure. +The function returns 0 when successful, +otherwise -1. +The +.Vt bt_devinfo +structure is defined as follows +.Bd -literal -offset indent +struct bt_devinfo +{ + char devname[HCI_DEVNAME_SIZE]; + + uint32_t state; + + bdaddr_t bdaddr; + uint16_t _reserved0; + + uint8_t features[HCI_DEVFEATURES_SIZE]; + + /* buffer info */ + uint16_t _reserved1; + uint16_t cmd_free; + uint16_t sco_size; + uint16_t sco_pkts; + uint16_t sco_free; + uint16_t acl_size; + uint16_t acl_pkts; + uint16_t acl_free; + + /* stats */ + uint32_t cmd_sent; + uint32_t evnt_recv; + uint32_t acl_recv; + uint32_t acl_sent; + uint32_t sco_recv; + uint32_t sco_sent; + uint32_t bytes_recv; + uint32_t bytes_sent; + + /* misc/specific */ + uint16_t link_policy_info; + uint16_t packet_type_info; + uint16_t role_switch_info; + uint16_t debug; + + uint8_t _padding[20]; +}; +.Ed +.Pp +The +.Fn bt_devenum +function enumerates Bluetooth devices present in the system. +For every device found, +the function will call provided +.Fa cb +callback function which should be of +.Vt bt_devenum_cb_t +type. +The callback function is passed a +.Dv HCI +socket +.Fa s , +fully populated +.Vt bt_devinfo +structure +.Fa di +and +.Fa arg +argument provided to the +.Fn bt_devenum . +The callback function can stop enumeration by returning a value +that is greater than zero. +The function returns number of successfully enumerated devices, +or -1 if an error occurred. +.Pp +The .Fn bdaddr_same , .Fn bdaddr_any and @@ -287,7 +401,8 @@ on EOF or error. .Xr getprotobynumber 3 , .Xr herror 3 , .Xr inet_aton 3 , -.Xr inet_ntoa 3 +.Xr inet_ntoa 3 , +.Xr ng_hci 4 .Sh CAVEAT The .Fn bt_gethostent @@ -312,6 +427,20 @@ The function opens and/or rewinds the .Pa /etc/bluetooth/protocols file. +.Pp +The +.Fn bt_devenum +function enumerates up to +.Dv HCI_DEVMAX +Bluetooth devices. +During enumeration the +.Fn bt_devenum +function uses the same +.Dv HCI +socket. +The function guarantees that the socket, +passed to the callback function, +will be bound and connected to the Bluetooth device being enumerated. .Sh AUTHORS .An Maksim Yevmenkin Aq m_evmenkin@yahoo.com .Sh BUGS Modified: head/lib/libbluetooth/bluetooth.c ============================================================================== --- head/lib/libbluetooth/bluetooth.c Fri Mar 6 23:29:00 2009 (r189461) +++ head/lib/libbluetooth/bluetooth.c Fri Mar 6 23:30:07 2009 (r189462) @@ -1,7 +1,9 @@ /* * bluetooth.c - * - * Copyright (c) 2001-2003 Maksim Yevmenkin + */ + +/*- + * Copyright (c) 2001-2009 Maksim Yevmenkin * All rights reserved. * * Redistribution and use in source and binary forms, with or without Modified: head/lib/libbluetooth/bluetooth.h ============================================================================== --- head/lib/libbluetooth/bluetooth.h Fri Mar 6 23:29:00 2009 (r189461) +++ head/lib/libbluetooth/bluetooth.h Fri Mar 6 23:30:07 2009 (r189462) @@ -1,7 +1,9 @@ /* * bluetooth.h - * - * Copyright (c) 2001-2003 Maksim Yevmenkin + */ + +/*- + * Copyright (c) 2001-2009 Maksim Yevmenkin * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -35,9 +37,12 @@ #include #include #include +#include #include #include +#include #include +#include #include #include #include @@ -72,6 +77,63 @@ void bt_endprotoent (v char const * bt_ntoa (bdaddr_t const *ba, char *str); int bt_aton (char const *str, bdaddr_t *ba); +/* bt_devXXXX() functions (inspired by NetBSD) */ +int bt_devaddr (char const *devname, bdaddr_t *addr); +int bt_devname (char *devname, bdaddr_t const *addr); + +/* + * Bluetooth HCI functions + */ + +#define HCI_DEVMAX 32 /* arbitrary */ +#define HCI_DEVNAME_SIZE NG_NODESIZ +#define HCI_DEVFEATURES_SIZE NG_HCI_FEATURES_SIZE + +struct bt_devinfo +{ + char devname[HCI_DEVNAME_SIZE]; + + uint32_t state; /* device/implementation specific */ + + bdaddr_t bdaddr; + uint16_t _reserved0; + + uint8_t features[HCI_DEVFEATURES_SIZE]; + + /* buffer info */ + uint16_t _reserved1; + uint16_t cmd_free; + uint16_t sco_size; + uint16_t sco_pkts; + uint16_t sco_free; + uint16_t acl_size; + uint16_t acl_pkts; + uint16_t acl_free; + + /* stats */ + uint32_t cmd_sent; + uint32_t evnt_recv; + uint32_t acl_recv; + uint32_t acl_sent; + uint32_t sco_recv; + uint32_t sco_sent; + uint32_t bytes_recv; + uint32_t bytes_sent; + + /* misc/specific */ + uint16_t link_policy_info; + uint16_t packet_type_info; + uint16_t role_switch_info; + uint16_t debug; + + uint8_t _padding[20]; /* leave space for future additions */ +}; + +typedef int (bt_devenum_cb_t)(int, struct bt_devinfo const *, void *); + +int bt_devinfo (struct bt_devinfo *di); +int bt_devenum (bt_devenum_cb_t *cb, void *arg); + /* * bdaddr utility functions (from NetBSD) */ Added: head/lib/libbluetooth/dev.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/lib/libbluetooth/dev.c Fri Mar 6 23:30:07 2009 (r189462) @@ -0,0 +1,95 @@ +/* + * dev.c + */ + +/*- + * Copyright (c) 2009 Maksim Yevmenkin + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#include +#include +#include + +struct bt_devaddr_match_arg +{ + char devname[HCI_DEVNAME_SIZE]; + bdaddr_t const *bdaddr; +}; + +static bt_devenum_cb_t bt_devaddr_match; + +int +bt_devaddr(char const *devname, bdaddr_t *addr) +{ + struct bt_devinfo di; + + strlcpy(di.devname, devname, sizeof(di.devname)); + + if (bt_devinfo(&di) < 0) + return (0); + + if (addr != NULL) + bdaddr_copy(addr, &di.bdaddr); + + return (1); +} + +int +bt_devname(char *devname, bdaddr_t const *addr) +{ + struct bt_devaddr_match_arg arg; + + memset(&arg, 0, sizeof(arg)); + arg.bdaddr = addr; + + if (bt_devenum(&bt_devaddr_match, &arg) < 0) + return (0); + + if (arg.devname[0] == '\0') { + errno = ENXIO; + return (0); + } + + if (devname != NULL) + strlcpy(devname, arg.devname, HCI_DEVNAME_SIZE); + + return (1); +} + +static int +bt_devaddr_match(int s, struct bt_devinfo const *di, void *arg) +{ + struct bt_devaddr_match_arg *m = (struct bt_devaddr_match_arg *)arg; + + if (!bdaddr_same(&di->bdaddr, m->bdaddr)) + return (0); + + strlcpy(m->devname, di->devname, sizeof(m->devname)); + + return (1); +} + Added: head/lib/libbluetooth/hci.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/lib/libbluetooth/hci.c Fri Mar 6 23:30:07 2009 (r189462) @@ -0,0 +1,246 @@ +/* + * hci.c + */ + +/*- + * Copyright (c) 2009 Maksim Yevmenkin + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#include +#include +#include +#include +#include + +static char * bt_dev2node (char const *devname, char *nodename, int nnlen); + +int +bt_devinfo(struct bt_devinfo *di) +{ + union { + struct ng_btsocket_hci_raw_node_state r0; + struct ng_btsocket_hci_raw_node_bdaddr r1; + struct ng_btsocket_hci_raw_node_features r2; + struct ng_btsocket_hci_raw_node_buffer r3; + struct ng_btsocket_hci_raw_node_stat r4; + struct ng_btsocket_hci_raw_node_link_policy_mask r5; + struct ng_btsocket_hci_raw_node_packet_mask r6; + struct ng_btsocket_hci_raw_node_role_switch r7; + struct ng_btsocket_hci_raw_node_debug r8; + } rp; + struct sockaddr_hci ha; + int s, rval; + + if (di == NULL) { + errno = EINVAL; + return (-1); + } + + memset(&ha, 0, sizeof(ha)); + ha.hci_len = sizeof(ha); + ha.hci_family = AF_BLUETOOTH; + + if (bt_aton(di->devname, &rp.r1.bdaddr)) { + if (!bt_devname(ha.hci_node, &rp.r1.bdaddr)) + return (-1); + } else if (bt_dev2node(di->devname, ha.hci_node, + sizeof(ha.hci_node)) == NULL) { + errno = ENXIO; + return (-1); + } + + s = socket(PF_BLUETOOTH, SOCK_RAW, BLUETOOTH_PROTO_HCI); + if (s < 0) + return (-1); + + rval = -1; + + if (bind(s, (struct sockaddr *) &ha, sizeof(ha)) < 0 || + connect(s, (struct sockaddr *) &ha, sizeof(ha)) < 0) + goto bad; + strlcpy(di->devname, ha.hci_node, sizeof(di->devname)); + + if (ioctl(s, SIOC_HCI_RAW_NODE_GET_STATE, &rp.r0, sizeof(rp.r0)) < 0) + goto bad; + di->state = rp.r0.state; + + if (ioctl(s, SIOC_HCI_RAW_NODE_GET_BDADDR, &rp.r1, sizeof(rp.r1)) < 0) + goto bad; + bdaddr_copy(&di->bdaddr, &rp.r1.bdaddr); + + if (ioctl(s, SIOC_HCI_RAW_NODE_GET_FEATURES, &rp.r2, sizeof(rp.r2)) < 0) + goto bad; + memcpy(di->features, rp.r2.features, sizeof(di->features)); + + if (ioctl(s, SIOC_HCI_RAW_NODE_GET_BUFFER, &rp.r3, sizeof(rp.r3)) < 0) + goto bad; + di->cmd_free = rp.r3.buffer.cmd_free; + di->sco_size = rp.r3.buffer.sco_size; + di->sco_pkts = rp.r3.buffer.sco_pkts; + di->sco_free = rp.r3.buffer.sco_free; + di->acl_size = rp.r3.buffer.acl_size; + di->acl_pkts = rp.r3.buffer.acl_pkts; + di->acl_free = rp.r3.buffer.acl_free; + + if (ioctl(s, SIOC_HCI_RAW_NODE_GET_STAT, &rp.r4, sizeof(rp.r4)) < 0) + goto bad; + di->cmd_sent = rp.r4.stat.cmd_sent; + di->evnt_recv = rp.r4.stat.evnt_recv; + di->acl_recv = rp.r4.stat.acl_recv; + di->acl_sent = rp.r4.stat.acl_sent; + di->sco_recv = rp.r4.stat.sco_recv; + di->sco_sent = rp.r4.stat.sco_sent; + di->bytes_recv = rp.r4.stat.bytes_recv; + di->bytes_sent = rp.r4.stat.bytes_sent; + + if (ioctl(s, SIOC_HCI_RAW_NODE_GET_LINK_POLICY_MASK, + &rp.r5, sizeof(rp.r5)) < 0) + goto bad; + di->link_policy_info = rp.r5.policy_mask; + + if (ioctl(s, SIOC_HCI_RAW_NODE_GET_PACKET_MASK, + &rp.r6, sizeof(rp.r6)) < 0) + goto bad; + di->packet_type_info = rp.r6.packet_mask; + + if (ioctl(s, SIOC_HCI_RAW_NODE_GET_ROLE_SWITCH, + &rp.r7, sizeof(rp.r7)) < 0) + goto bad; + di->role_switch_info = rp.r7.role_switch; + + if (ioctl(s, SIOC_HCI_RAW_NODE_GET_DEBUG, &rp.r8, sizeof(rp.r8)) < 0) + goto bad; + di->debug = rp.r8.debug; + + rval = 0; +bad: + close(s); + + return (rval); +} + +int +bt_devenum(bt_devenum_cb_t cb, void *arg) +{ + struct ng_btsocket_hci_raw_node_list_names rp; + struct bt_devinfo di; + struct sockaddr_hci ha; + int s, i, count; + + rp.num_names = HCI_DEVMAX; + rp.names = (struct nodeinfo *) calloc(rp.num_names, + sizeof(struct nodeinfo)); + if (rp.names == NULL) { + errno = ENOMEM; + return (-1); + } + + memset(&ha, 0, sizeof(ha)); + ha.hci_len = sizeof(ha); + ha.hci_family = AF_BLUETOOTH; + ha.hci_node[0] = 'x'; + + s = socket(PF_BLUETOOTH, SOCK_RAW, BLUETOOTH_PROTO_HCI); + if (s < 0) { + free(rp.names); + + return (-1); + } + + if (bind(s, (struct sockaddr *) &ha, sizeof(ha)) < 0 || + connect(s, (struct sockaddr *) &ha, sizeof(ha)) < 0 || + ioctl(s, SIOC_HCI_RAW_NODE_LIST_NAMES, &rp, sizeof(rp)) < 0) { + close(s); + free(rp.names); + + return (-1); + } + + for (count = 0, i = 0; i < rp.num_names; i ++) { + strlcpy(di.devname, rp.names[i].name, sizeof(di.devname)); + if (bt_devinfo(&di) < 0) + continue; + + count ++; + + if (cb == NULL) + continue; + + strlcpy(ha.hci_node, rp.names[i].name, sizeof(ha.hci_node)); + if (bind(s, (struct sockaddr *) &ha, sizeof(ha)) < 0 || + connect(s, (struct sockaddr *) &ha, sizeof(ha)) < 0) + continue; + + if ((*cb)(s, &di, arg) > 0) + break; + } + + close (s); + free(rp.names); + + return (count); +} + +static char * +bt_dev2node(char const *devname, char *nodename, int nnlen) +{ + static char const * bt_dev_prefix[] = { + "btccc", /* 3Com Bluetooth PC-CARD */ + "h4", /* UART/serial Bluetooth devices */ + "ubt", /* Bluetooth USB devices */ + NULL /* should be last */ + }; + + static char _nodename[HCI_DEVNAME_SIZE]; + char const **p; + char *ep; + int plen, unit; + + if (nodename == NULL) { + nodename = _nodename; + nnlen = HCI_DEVNAME_SIZE; + } + + for (p = bt_dev_prefix; *p != NULL; p ++) { + plen = strlen(*p); + if (strncmp(devname, *p, plen) != 0) + continue; + + unit = strtoul(devname + plen, &ep, 10); + if (*ep != '\0' && + strcmp(ep, "hci") != 0 && + strcmp(ep, "l2cap") != 0) + return (NULL); /* can't make sense of device name */ + + snprintf(nodename, nnlen, "%s%uhci", *p, unit); + + return (nodename); + } + + return (NULL); +} + From owner-svn-src-head@FreeBSD.ORG Fri Mar 6 23:32: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 3591F106566C; Fri, 6 Mar 2009 23:32:46 +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 23D368FC1A; Fri, 6 Mar 2009 23:32:46 +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 n26NWkum031926; Fri, 6 Mar 2009 23:32:46 GMT (envelope-from sam@svn.freebsd.org) Received: (from sam@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n26NWkSa031925; Fri, 6 Mar 2009 23:32:46 GMT (envelope-from sam@svn.freebsd.org) Message-Id: <200903062332.n26NWkSa031925@svn.freebsd.org> From: Sam Leffler Date: Fri, 6 Mar 2009 23:32:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r189463 - head/sys/arm/xscale/ixp425 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, 06 Mar 2009 23:32:46 -0000 Author: sam Date: Fri Mar 6 23:32:45 2009 New Revision: 189463 URL: http://svn.freebsd.org/changeset/base/189463 Log: Cleanup virtual device mapping some more: o improves understandability by replacing numerous relative address calculations with fixed addresses; everything should now match up more easily with the vm layout shown at the top of the file o move the expansion bus chip select regions to be contiguous with the expansion bus configuration area; this is not exploited right now but allows map consolidation in the future o leave a gap between the expansion bus regions and the pci config space in case we want to map more exp bus cs regions Reviewed by: imp, thompsa Modified: head/sys/arm/xscale/ixp425/ixp425reg.h Modified: head/sys/arm/xscale/ixp425/ixp425reg.h ============================================================================== --- head/sys/arm/xscale/ixp425/ixp425reg.h Fri Mar 6 23:30:07 2009 (r189462) +++ head/sys/arm/xscale/ixp425/ixp425reg.h Fri Mar 6 23:32:45 2009 (r189463) @@ -88,22 +88,27 @@ * SDRAM/DDR Memory Controller * F020 0000 --------------------------- IXP425_MCU_VBASE * - * F001 7000 EHCI USB 2 (IXP435) - * F001 6000 EHCI USB 1 (IXP435) - * F020 6000 --------------------------- + * EHCI USB 2 (IXP435) + * F001 D000 --------------------------- IXP435_USB2_VBASE + * EHCI USB 1 (IXP435) + * F001 C000 --------------------------- IXP435_USB1_VBASE * Queue manager - * F001 2000 --------------------------- IXP425_QMGR_VBASE + * F001 8000 --------------------------- IXP425_QMGR_VBASE * PCI Configuration and Status - * F001 1000 --------------------------- IXP425_PCI_VBASE + * F001 7000 --------------------------- IXP425_PCI_VBASE + * + * (NB: gap for future addition of EXP CS5-7) + * F001 4000 Expansion Bus Chip Select 4 + * F001 3000 Expansion Bus Chip Select 3 + * F001 2000 Expansion Bus Chip Select 2 + * F001 1000 Expansion Bus Chip Select 1 * Expansion Bus Configuration * F001 0000 --------------------------- IXP425_EXP_VBASE - * F000 F000 Expansion Bus Chip Select 4 - * F000 E000 Expansion Bus Chip Select 3 - * F000 D000 Expansion Bus Chip Select 2 - * F000 C000 Expansion Bus Chip Select 1 + * + * F000 C000 MAC-A (IXP435) * F000 B000 USB (option on IXP425) * F000 A000 MAC-B (IXP425) | MAC-C (IXP435) - * F000 9000 MAC-A + * F000 9000 MAC-A (IXP425) * F000 8000 NPE-C * F000 7000 NPE-B (IXP425) * F000 6000 NPE-A @@ -125,8 +130,7 @@ #define IXP425_IO_HWBASE 0xc8000000UL #define IXP425_IO_SIZE 0x00010000UL -/* Offset */ - +/* Physical/Virtual addresss offsets */ #define IXP425_UART0_OFFSET 0x00000000UL #define IXP425_UART1_OFFSET 0x00001000UL #define IXP425_PMC_OFFSET 0x00002000UL @@ -139,6 +143,7 @@ #define IXP425_MAC_B_OFFSET 0x00009000UL /* Ethernet MAC on NPE-B */ #define IXP425_MAC_C_OFFSET 0x0000a000UL /* Ethernet MAC on NPE-C */ #define IXP425_USB_OFFSET 0x0000b000UL + #define IXP435_MAC_A_OFFSET 0x0000c000UL /* Ethernet MAC on NPE-A */ #define IXP425_REG_SIZE 0x1000 @@ -322,9 +327,8 @@ * Expansion Bus Configuration Space. */ #define IXP425_EXP_HWBASE 0xc4000000UL -#define IXP425_EXP_VBASE (IXP425_IO_VBASE + IXP425_IO_SIZE) - /* 0xf0010000 */ -#define IXP425_EXP_SIZE IXP425_REG_SIZE /* 0x1000 */ +#define IXP425_EXP_VBASE 0xf0010000UL +#define IXP425_EXP_SIZE 0x1000 /* offset */ #define EXP_TIMING_CS0_OFFSET 0x0000 @@ -436,9 +440,8 @@ * PCI */ #define IXP425_PCI_HWBASE 0xc0000000 -#define IXP425_PCI_VBASE (IXP425_EXP_VBASE + IXP425_EXP_SIZE) - /* 0xf0011000 */ -#define IXP425_PCI_SIZE IXP425_REG_SIZE /* 0x1000 */ +#define IXP425_PCI_VBASE 0xf0017000UL +#define IXP425_PCI_SIZE 0x1000 #define IXP425_AHB_OFFSET 0x00000000UL /* AHB bus */ @@ -612,7 +615,7 @@ * Queue Manager */ #define IXP425_QMGR_HWBASE 0x60000000UL -#define IXP425_QMGR_VBASE (IXP425_PCI_VBASE + IXP425_PCI_SIZE) +#define IXP425_QMGR_VBASE 0xf0018000UL #define IXP425_QMGR_SIZE 0x4000 /* @@ -650,24 +653,26 @@ #define IXP425_EXP_BUS_CSx_HWBASE(i) \ (IXP425_EXP_BUS_HWBASE + (i)*IXP425_EXP_BUS_SIZE) +#define IXP425_EXP_BUS_CSx_SIZE 0x1000 #define IXP425_EXP_BUS_CSx_VBASE(i) \ - (IXP425_MAC_B_VBASE + (i)*IXP425_MAC_B_SIZE) + (0xF0011000UL + (((i)-1)*IXP425_EXP_BUS_CSx_SIZE)) +/* NB: CS0 is special; it maps flash */ #define IXP425_EXP_BUS_CS0_HWBASE IXP425_EXP_BUS_CSx_HWBASE(0) #define IXP425_EXP_BUS_CS0_VBASE 0xFD000000UL #define IXP425_EXP_BUS_CS0_SIZE 0x01000000 /* NB: 16M */ #define IXP425_EXP_BUS_CS1_HWBASE IXP425_EXP_BUS_CSx_HWBASE(1) #define IXP425_EXP_BUS_CS1_VBASE IXP425_EXP_BUS_CSx_VBASE(1) -#define IXP425_EXP_BUS_CS1_SIZE 0x1000 +#define IXP425_EXP_BUS_CS1_SIZE IXP425_EXP_BUS_CSx_SIZE #define IXP425_EXP_BUS_CS2_HWBASE IXP425_EXP_BUS_CSx_HWBASE(2) #define IXP425_EXP_BUS_CS2_VBASE IXP425_EXP_BUS_CSx_VBASE(2) -#define IXP425_EXP_BUS_CS2_SIZE 0x1000 +#define IXP425_EXP_BUS_CS2_SIZE IXP425_EXP_BUS_CSx_SIZE #define IXP425_EXP_BUS_CS3_HWBASE IXP425_EXP_BUS_CSx_HWBASE(3) #define IXP425_EXP_BUS_CS3_VBASE IXP425_EXP_BUS_CSx_VBASE(3) -#define IXP425_EXP_BUS_CS3_SIZE 0x1000 +#define IXP425_EXP_BUS_CS3_SIZE IXP425_EXP_BUS_CSx_SIZE #define IXP425_EXP_BUS_CS4_HWBASE IXP425_EXP_BUS_CSx_HWBASE(4) #define IXP425_EXP_BUS_CS4_VBASE IXP425_EXP_BUS_CSx_VBASE(4) -#define IXP425_EXP_BUS_CS4_SIZE 0x1000 +#define IXP425_EXP_BUS_CS4_SIZE IXP425_EXP_BUS_CSx_SIZE /* NB: not mapped (yet) */ #define IXP425_EXP_BUS_CS5_HWBASE IXP425_EXP_BUS_CSx_HWBASE(5) @@ -689,11 +694,11 @@ #define CAMBRIA_CFSEL0_SIZE 0x40000 #define IXP435_USB1_HWBASE 0xcd000000UL /* USB host controller 1 */ -#define IXP435_USB1_VBASE (IXP425_QMGR_VBASE + IXP425_QMGR_SIZE) +#define IXP435_USB1_VBASE 0xf001C000UL #define IXP435_USB1_SIZE 0x1000 /* NB: only uses 0x300 */ #define IXP435_USB2_HWBASE 0xce000000UL /* USB host controller 2 */ -#define IXP435_USB2_VBASE (IXP435_USB1_VBASE + IXP435_USB1_SIZE) +#define IXP435_USB2_VBASE 0xf001D000UL #define IXP435_USB2_SIZE 0x1000 /* NB: only uses 0x300 */ #endif /* _IXP425REG_H_ */ From owner-svn-src-head@FreeBSD.ORG Sat Mar 7 00:25: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 CB8A71065673; Sat, 7 Mar 2009 00:25:33 +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 B7EE68FC13; Sat, 7 Mar 2009 00:25:33 +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 n270PXQT032943; Sat, 7 Mar 2009 00:25:33 GMT (envelope-from kientzle@svn.freebsd.org) Received: (from kientzle@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n270PXVD032938; Sat, 7 Mar 2009 00:25:33 GMT (envelope-from kientzle@svn.freebsd.org) Message-Id: <200903070025.n270PXVD032938@svn.freebsd.org> From: Tim Kientzle Date: Sat, 7 Mar 2009 00:25: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: r189464 - in head/lib/libarchive: . 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: Sat, 07 Mar 2009 00:25:34 -0000 Author: kientzle Date: Sat Mar 7 00:25:33 2009 New Revision: 189464 URL: http://svn.freebsd.org/changeset/base/189464 Log: Merge r659 from libarchive.googlecode.com: Correctly report "none" as the compression name when no other read filter bid. Add some assertions to various tests to verify that read filters are properly setting the textual name as well as the compression code. Modified: head/lib/libarchive/archive_read.c head/lib/libarchive/test/test_compat_bzip2.c head/lib/libarchive/test/test_compat_gzip.c head/lib/libarchive/test/test_read_format_cpio_bin_Z.c head/lib/libarchive/test/test_read_format_tar.c Modified: head/lib/libarchive/archive_read.c ============================================================================== --- head/lib/libarchive/archive_read.c Fri Mar 6 23:32:45 2009 (r189463) +++ head/lib/libarchive/archive_read.c Sat Mar 7 00:25:33 2009 (r189464) @@ -289,12 +289,10 @@ archive_read_open2(struct archive *_a, v filter->read = client_read_proxy; filter->skip = client_skip_proxy; filter->close = client_close_proxy; + filter->name = "none"; + filter->code = ARCHIVE_COMPRESSION_NONE; a->filter = filter; - /* In case there's no filter. */ - a->archive.compression_code = ARCHIVE_COMPRESSION_NONE; - a->archive.compression_name = "none"; - /* Build out the input pipeline. */ e = build_stream(a); if (e == ARCHIVE_OK) Modified: head/lib/libarchive/test/test_compat_bzip2.c ============================================================================== --- head/lib/libarchive/test/test_compat_bzip2.c Fri Mar 6 23:32:45 2009 (r189463) +++ head/lib/libarchive/test/test_compat_bzip2.c Sat Mar 7 00:25:33 2009 (r189464) @@ -69,6 +69,7 @@ compat_bzip2(const char *name) /* Verify that the format detection worked. */ assertEqualInt(archive_compression(a), ARCHIVE_COMPRESSION_BZIP2); + assertEqualString(archive_compression_name(a), "bzip2"); assertEqualInt(archive_format(a), ARCHIVE_FORMAT_TAR_USTAR); assertEqualInt(ARCHIVE_OK, archive_read_close(a)); Modified: head/lib/libarchive/test/test_compat_gzip.c ============================================================================== --- head/lib/libarchive/test/test_compat_gzip.c Fri Mar 6 23:32:45 2009 (r189463) +++ head/lib/libarchive/test/test_compat_gzip.c Sat Mar 7 00:25:33 2009 (r189464) @@ -69,6 +69,7 @@ verify(const char *name) /* Verify that the format detection worked. */ assertEqualInt(archive_compression(a), ARCHIVE_COMPRESSION_GZIP); + assertEqualString(archive_compression_name(a), "gzip"); assertEqualInt(archive_format(a), ARCHIVE_FORMAT_TAR_USTAR); assertEqualInt(ARCHIVE_OK, archive_read_close(a)); Modified: head/lib/libarchive/test/test_read_format_cpio_bin_Z.c ============================================================================== --- head/lib/libarchive/test/test_read_format_cpio_bin_Z.c Fri Mar 6 23:32:45 2009 (r189463) +++ head/lib/libarchive/test/test_read_format_cpio_bin_Z.c Sat Mar 7 00:25:33 2009 (r189464) @@ -46,6 +46,7 @@ DEFINE_TEST(test_read_format_cpio_bin_Z) failure("archive_compression_name(a)=\"%s\"", archive_compression_name(a)); assertEqualInt(archive_compression(a), ARCHIVE_COMPRESSION_COMPRESS); + assertEqualString(archive_compression_name(a), "compress (.Z)"); failure("archive_format_name(a)=\"%s\"", archive_format_name(a)); assertEqualInt(archive_format(a), ARCHIVE_FORMAT_CPIO_BIN_LE); Modified: head/lib/libarchive/test/test_read_format_tar.c ============================================================================== --- head/lib/libarchive/test/test_read_format_tar.c Fri Mar 6 23:32:45 2009 (r189463) +++ head/lib/libarchive/test/test_read_format_tar.c Sat Mar 7 00:25:33 2009 (r189464) @@ -71,6 +71,7 @@ static void verifyEmpty(void) assertA(0 == archive_read_open_memory(a, archiveEmpty, 512)); assertEqualIntA(a, ARCHIVE_EOF, archive_read_next_header(a, &ae)); assertEqualInt(archive_compression(a), ARCHIVE_COMPRESSION_NONE); + assertEqualString(archive_compression_name(a), "none"); failure("512 zero bytes should be recognized as a tar archive."); assertEqualInt(archive_format(a), ARCHIVE_FORMAT_TAR); From owner-svn-src-head@FreeBSD.ORG Sat Mar 7 00:36: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 1D0301065670; Sat, 7 Mar 2009 00:36:51 +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 E48018FC08; Sat, 7 Mar 2009 00:36:50 +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 n270aoo7033174; Sat, 7 Mar 2009 00:36:50 GMT (envelope-from kientzle@svn.freebsd.org) Received: (from kientzle@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n270ao7G033172; Sat, 7 Mar 2009 00:36:50 GMT (envelope-from kientzle@svn.freebsd.org) Message-Id: <200903070036.n270ao7G033172@svn.freebsd.org> From: Tim Kientzle Date: Sat, 7 Mar 2009 00:36: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: r189465 - head/lib/libarchive 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, 07 Mar 2009 00:36:51 -0000 Author: kientzle Date: Sat Mar 7 00:36:50 2009 New Revision: 189465 URL: http://svn.freebsd.org/changeset/base/189465 Log: Merge r283,r529 from libarchive.googlecode.com: Fix ext2_fs.h includes for Linux. Modified: head/lib/libarchive/archive_entry.c head/lib/libarchive/archive_write_disk.c Modified: head/lib/libarchive/archive_entry.c ============================================================================== --- head/lib/libarchive/archive_entry.c Sat Mar 7 00:25:33 2009 (r189464) +++ head/lib/libarchive/archive_entry.c Sat Mar 7 00:36:50 2009 (r189465) @@ -39,18 +39,22 @@ __FBSDID("$FreeBSD$"); #include #endif #endif -#ifdef HAVE_EXT2FS_EXT2_FS_H -#include /* for Linux file flags */ -#endif #ifdef HAVE_LIMITS_H #include #endif #ifdef HAVE_LINUX_FS_H #include /* for Linux file flags */ #endif +/* + * Some Linux distributions have both linux/ext2_fs.h and ext2fs/ext2_fs.h. + * As the include guards don't agree, the order of include is important. + */ #ifdef HAVE_LINUX_EXT2_FS_H #include /* for Linux file flags */ #endif +#if defined(HAVE_EXT2FS_EXT2_FS_H) && !defined(__CYGWIN__) +#include /* for Linux file flags */ +#endif #include #include #ifdef HAVE_STDLIB_H Modified: head/lib/libarchive/archive_write_disk.c ============================================================================== --- head/lib/libarchive/archive_write_disk.c Sat Mar 7 00:25:33 2009 (r189464) +++ head/lib/libarchive/archive_write_disk.c Sat Mar 7 00:36:50 2009 (r189465) @@ -51,10 +51,6 @@ __FBSDID("$FreeBSD$"); #ifdef HAVE_SYS_UTIME_H #include #endif - -#ifdef HAVE_EXT2FS_EXT2_FS_H -#include /* for Linux file flags */ -#endif #ifdef HAVE_ERRNO_H #include #endif @@ -67,6 +63,16 @@ __FBSDID("$FreeBSD$"); #ifdef HAVE_LINUX_FS_H #include /* for Linux file flags */ #endif +/* + * Some Linux distributions have both linux/ext2_fs.h and ext2fs/ext2_fs.h. + * As the include guards don't agree, the order of include is important. + */ +#ifdef HAVE_LINUX_EXT2_FS_H +#include /* for Linux file flags */ +#endif +#if defined(HAVE_EXT2FS_EXT2_FS_H) && !defined(__CYGWIN__) +#include /* Linux file flags, broken on Cygwin */ +#endif #ifdef HAVE_LIMITS_H #include #endif From owner-svn-src-head@FreeBSD.ORG Sat Mar 7 00:52: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 9D4DD106564A; Sat, 7 Mar 2009 00:52:02 +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 8A8B18FC0A; Sat, 7 Mar 2009 00:52:02 +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 n270q2Ik033474; Sat, 7 Mar 2009 00:52:02 GMT (envelope-from kientzle@svn.freebsd.org) Received: (from kientzle@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n270q20w033470; Sat, 7 Mar 2009 00:52:02 GMT (envelope-from kientzle@svn.freebsd.org) Message-Id: <200903070052.n270q20w033470@svn.freebsd.org> From: Tim Kientzle Date: Sat, 7 Mar 2009 00:52: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: r189466 - head/lib/libarchive 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, 07 Mar 2009 00:52:03 -0000 Author: kientzle Date: Sat Mar 7 00:52:02 2009 New Revision: 189466 URL: http://svn.freebsd.org/changeset/base/189466 Log: Merge r552,r559 from libarchive.googlecode.com: Support high-resolution timestamps on Tru64, AIX, and GNU Hurd. Thanks to Björn Jacke. Modified: head/lib/libarchive/archive_entry_copy_stat.c head/lib/libarchive/archive_entry_stat.c head/lib/libarchive/archive_read_support_format_mtree.c head/lib/libarchive/archive_write_disk.c Modified: head/lib/libarchive/archive_entry_copy_stat.c ============================================================================== --- head/lib/libarchive/archive_entry_copy_stat.c Sat Mar 7 00:36:50 2009 (r189465) +++ head/lib/libarchive/archive_entry_copy_stat.c Sat Mar 7 00:52:02 2009 (r189466) @@ -43,6 +43,18 @@ archive_entry_copy_stat(struct archive_e archive_entry_set_atime(entry, st->st_atime, st->st_atim.tv_nsec); archive_entry_set_ctime(entry, st->st_ctime, st->st_ctim.tv_nsec); archive_entry_set_mtime(entry, st->st_mtime, st->st_mtim.tv_nsec); +#elif HAVE_STRUCT_STAT_ST_MTIME_N + archive_entry_set_atime(entry, st->st_atime, st->st_atime_n); + archive_entry_set_ctime(entry, st->st_ctime, st->st_ctime_n); + archive_entry_set_mtime(entry, st->st_mtime, st->st_mtime_n); +#elif HAVE_STRUCT_STAT_ST_UMTIME + archive_entry_set_atime(entry, st->st_atime, st->st_uatime * 1000); + archive_entry_set_ctime(entry, st->st_ctime, st->st_uctime * 1000); + archive_entry_set_mtime(entry, st->st_mtime, st->st_umtime * 1000); +#elif HAVE_STRUCT_STAT_ST_MTIME_USEC + archive_entry_set_atime(entry, st->st_atime, st->st_atime_usec * 1000); + archive_entry_set_ctime(entry, st->st_ctime, st->st_ctime_usec * 1000); + archive_entry_set_mtime(entry, st->st_mtime, st->st_mtime_usec * 1000); #else archive_entry_set_atime(entry, st->st_atime, 0); archive_entry_set_ctime(entry, st->st_ctime, 0); Modified: head/lib/libarchive/archive_entry_stat.c ============================================================================== --- head/lib/libarchive/archive_entry_stat.c Sat Mar 7 00:36:50 2009 (r189465) +++ head/lib/libarchive/archive_entry_stat.c Sat Mar 7 00:52:02 2009 (r189466) @@ -90,6 +90,18 @@ archive_entry_stat(struct archive_entry st->st_atim.tv_nsec = archive_entry_atime_nsec(entry); st->st_ctim.tv_nsec = archive_entry_ctime_nsec(entry); st->st_mtim.tv_nsec = archive_entry_mtime_nsec(entry); +#elif HAVE_STRUCT_STAT_ST_MTIME_N + st->st_atime_n = archive_entry_atime_nsec(entry); + st->st_ctime_n = archive_entry_ctime_nsec(entry); + st->st_mtime_n = archive_entry_mtime_nsec(entry); +#elif HAVE_STRUCT_STAT_ST_UMTIME + st->st_uatime = archive_entry_atime_nsec(entry) / 1000; + st->st_uctime = archive_entry_ctime_nsec(entry) / 1000; + st->st_umtime = archive_entry_mtime_nsec(entry) / 1000; +#elif HAVE_STRUCT_STAT_ST_MTIME_USEC + st->st_atime_usec = archive_entry_atime_nsec(entry) / 1000; + st->st_ctime_usec = archive_entry_ctime_nsec(entry) / 1000; + st->st_mtime_usec = archive_entry_mtime_nsec(entry) / 1000; #endif #if HAVE_STRUCT_STAT_ST_BIRTHTIMESPEC_TV_NSEC st->st_birthtimespec.tv_nsec = archive_entry_birthtime_nsec(entry); Modified: head/lib/libarchive/archive_read_support_format_mtree.c ============================================================================== --- head/lib/libarchive/archive_read_support_format_mtree.c Sat Mar 7 00:36:50 2009 (r189465) +++ head/lib/libarchive/archive_read_support_format_mtree.c Sat Mar 7 00:52:02 2009 (r189466) @@ -672,6 +672,15 @@ parse_file(struct archive_read *a, struc #elif HAVE_STRUCT_STAT_ST_MTIM_TV_NSEC archive_entry_set_mtime(entry, st->st_mtime, st->st_mtim.tv_nsec); +#elif HAVE_STRUCT_STAT_ST_MTIME_N + archive_entry_set_mtime(entry, st->st_mtime, + st->st_mtime_n); +#elif HAVE_STRUCT_STAT_ST_UMTIME + archive_entry_set_mtime(entry, st->st_mtime, + st->st_umtime*1000); +#elif HAVE_STRUCT_STAT_ST_MTIME_USEC + archive_entry_set_mtime(entry, st->st_mtime, + st->st_mtime_usec*1000); #else archive_entry_set_mtime(entry, st->st_mtime, 0); #endif Modified: head/lib/libarchive/archive_write_disk.c ============================================================================== --- head/lib/libarchive/archive_write_disk.c Sat Mar 7 00:36:50 2009 (r189465) +++ head/lib/libarchive/archive_write_disk.c Sat Mar 7 00:52:02 2009 (r189466) @@ -2535,19 +2535,25 @@ older(struct stat *st, struct archive_en /* Definitely older. */ if (st->st_mtimespec.tv_nsec < archive_entry_mtime_nsec(entry)) return (1); - /* Definitely younger. */ - if (st->st_mtimespec.tv_nsec > archive_entry_mtime_nsec(entry)) - return (0); #elif HAVE_STRUCT_STAT_ST_MTIM_TV_NSEC /* Definitely older. */ if (st->st_mtim.tv_nsec < archive_entry_mtime_nsec(entry)) return (1); - /* Definitely older. */ - if (st->st_mtim.tv_nsec > archive_entry_mtime_nsec(entry)) - return (0); +#elif HAVE_STRUCT_STAT_ST_MTIME_N + /* older. */ + if (st->st_mtime_n < archive_entry_mtime_nsec(entry)) + return (1); +#elif HAVE_STRUCT_STAT_ST_UMTIME + /* older. */ + if (st->st_umtime * 1000 < archive_entry_mtime_nsec(entry)) + return (1); +#elif HAVE_STRUCT_STAT_ST_MTIME_USEC + /* older. */ + if (st->st_mtime_usec * 1000 < archive_entry_mtime_nsec(entry)) + return (1); #else /* This system doesn't have high-res timestamps. */ #endif - /* Same age, so not older. */ + /* Same age or newer, so not older. */ return (0); } From owner-svn-src-head@FreeBSD.ORG Sat Mar 7 01:08: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 EF3FB106566B; Sat, 7 Mar 2009 01:08:16 +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 DD6AA8FC19; Sat, 7 Mar 2009 01:08:16 +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 n2718GcN033816; Sat, 7 Mar 2009 01:08:16 GMT (envelope-from kientzle@svn.freebsd.org) Received: (from kientzle@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n2718GjI033815; Sat, 7 Mar 2009 01:08:16 GMT (envelope-from kientzle@svn.freebsd.org) Message-Id: <200903070108.n2718GjI033815@svn.freebsd.org> From: Tim Kientzle Date: Sat, 7 Mar 2009 01:08: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: r189467 - head/lib/libarchive 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, 07 Mar 2009 01:08:17 -0000 Author: kientzle Date: Sat Mar 7 01:08:16 2009 New Revision: 189467 URL: http://svn.freebsd.org/changeset/base/189467 Log: Minor whitespace adjustment to reduce diffs with libarchive.googlecode.com. Modified: head/lib/libarchive/archive_private.h Modified: head/lib/libarchive/archive_private.h ============================================================================== --- head/lib/libarchive/archive_private.h Sat Mar 7 00:52:02 2009 (r189466) +++ head/lib/libarchive/archive_private.h Sat Mar 7 01:08:16 2009 (r189467) @@ -41,7 +41,7 @@ #define ARCHIVE_WRITE_MAGIC (0xb0c5c0deU) #define ARCHIVE_READ_MAGIC (0xdeb0c5U) #define ARCHIVE_WRITE_DISK_MAGIC (0xc001b0c5U) -#define ARCHIVE_READ_DISK_MAGIC (0xbadb0c5U) +#define ARCHIVE_READ_DISK_MAGIC (0xbadb0c5U) #define ARCHIVE_STATE_ANY 0xFFFFU #define ARCHIVE_STATE_NEW 1U From owner-svn-src-head@FreeBSD.ORG Sat Mar 7 01:12: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 C15B6106566B; Sat, 7 Mar 2009 01:12:01 +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 AEEED8FC0C; Sat, 7 Mar 2009 01:12:01 +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 n271C1Su033926; Sat, 7 Mar 2009 01:12:01 GMT (envelope-from kientzle@svn.freebsd.org) Received: (from kientzle@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n271C1x9033925; Sat, 7 Mar 2009 01:12:01 GMT (envelope-from kientzle@svn.freebsd.org) Message-Id: <200903070112.n271C1x9033925@svn.freebsd.org> From: Tim Kientzle Date: Sat, 7 Mar 2009 01:12: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: r189468 - head/lib/libarchive/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: Sat, 07 Mar 2009 01:12:02 -0000 Author: kientzle Date: Sat Mar 7 01:12:01 2009 New Revision: 189468 URL: http://svn.freebsd.org/changeset/base/189468 Log: Merge the rest of r453 from libarchive.googlecode.com: Test using libarchive APIs to read extended attributes from disk on FreeBSD. Modified: head/lib/libarchive/test/test_extattr_freebsd.c Modified: head/lib/libarchive/test/test_extattr_freebsd.c ============================================================================== --- head/lib/libarchive/test/test_extattr_freebsd.c Sat Mar 7 01:08:16 2009 (r189467) +++ head/lib/libarchive/test/test_extattr_freebsd.c Sat Mar 7 01:12:01 2009 (r189468) @@ -41,6 +41,9 @@ DEFINE_TEST(test_extattr_freebsd) skipping("extattr restore supported only on FreeBSD 5.0 and later"); #else char buff[64]; + const char *xname; + const void *xval; + size_t xsize; struct stat st; struct archive *a; struct archive_entry *ae; @@ -150,5 +153,21 @@ DEFINE_TEST(test_extattr_freebsd) assertEqualString(buff, "123456"); } } + + /* Use libarchive APIs to read the file back into an entry and + * verify that the extattr was read correctly. */ + assert((a = archive_read_disk_new()) != NULL); + assert((ae = archive_entry_new()) != NULL); + archive_entry_set_pathname(ae, "test0"); + assertEqualInt(ARCHIVE_OK, + archive_read_disk_entry_from_file(a, ae, -1, NULL)); + assertEqualInt(1, archive_entry_xattr_reset(ae)); + assertEqualInt(ARCHIVE_OK, + archive_entry_xattr_next(ae, &xname, &xval, &xsize)); + assertEqualString(xname, "user.foo"); + assertEqualInt(xsize, 5); + assertEqualMem(xval, "12345", xsize); + assertEqualIntA(a, ARCHIVE_OK, archive_read_close(a)); + assertEqualInt(ARCHIVE_OK, archive_read_finish(a)); #endif } From owner-svn-src-head@FreeBSD.ORG Sat Mar 7 01:17:14 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 041EA106566B; Sat, 7 Mar 2009 01:17:14 +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 CC5958FC12; Sat, 7 Mar 2009 01:17:13 +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 n271HDAH034059; Sat, 7 Mar 2009 01:17:13 GMT (envelope-from kientzle@svn.freebsd.org) Received: (from kientzle@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n271HDLr034058; Sat, 7 Mar 2009 01:17:13 GMT (envelope-from kientzle@svn.freebsd.org) Message-Id: <200903070117.n271HDLr034058@svn.freebsd.org> From: Tim Kientzle Date: Sat, 7 Mar 2009 01:17: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: r189469 - head/lib/libarchive 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, 07 Mar 2009 01:17:14 -0000 Author: kientzle Date: Sat Mar 7 01:17:13 2009 New Revision: 189469 URL: http://svn.freebsd.org/changeset/base/189469 Log: Merge r564,r566 from libarchive.googlecode.com: Fix segfault when specifying an option and the current format doesn't have an options handler. Modified: head/lib/libarchive/archive_read.c Modified: head/lib/libarchive/archive_read.c ============================================================================== --- head/lib/libarchive/archive_read.c Sat Mar 7 01:12:01 2009 (r189468) +++ head/lib/libarchive/archive_read.c Sat Mar 7 01:17:13 2009 (r189469) @@ -115,24 +115,30 @@ int archive_read_set_format_options(struct archive *_a, const char *s) { struct archive_read *a; + struct archive_format_descriptor *format; char key[64], val[64]; + size_t i; int len, r; a = (struct archive_read *)_a; - if (a->format == NULL || a->format->options == NULL || - a->format->name == NULL) - /* This format does not support option. */ - return (ARCHIVE_OK); - - while ((len = __archive_parse_options(s, a->format->name, - sizeof(key), key, sizeof(val), val)) > 0) { - if (val[0] == '\0') - r = a->format->options(a, key, NULL); - else - r = a->format->options(a, key, val); - if (r == ARCHIVE_FATAL) - return (r); - s += len; + len = 0; + for (i = 0; i < sizeof(a->formats)/sizeof(a->formats[0]); i++) { + format = &a->formats[i]; + if (format == NULL || format->options == NULL || + format->name == NULL) + /* This format does not support option. */ + continue; + + while ((len = __archive_parse_options(s, format->name, + sizeof(key), key, sizeof(val), val)) > 0) { + if (val[0] == '\0') + r = format->options(a, key, NULL); + else + r = format->options(a, key, val); + if (r == ARCHIVE_FATAL) + return (r); + s += len; + } } if (len < 0) { archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC, @@ -159,6 +165,8 @@ archive_read_set_filter_options(struct a len = 0; for (filter = a->filter; filter != NULL; filter = filter->upstream) { bidder = filter->bidder; + if (bidder == NULL) + continue; if (bidder->options == NULL) /* This bidder does not support option */ continue; From owner-svn-src-head@FreeBSD.ORG Sat Mar 7 01:18: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 3A8951065768; Sat, 7 Mar 2009 01:18:31 +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 282858FC0A; Sat, 7 Mar 2009 01:18:31 +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 n271IVNH034167; Sat, 7 Mar 2009 01:18:31 GMT (envelope-from kientzle@svn.freebsd.org) Received: (from kientzle@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n271IVFE034166; Sat, 7 Mar 2009 01:18:31 GMT (envelope-from kientzle@svn.freebsd.org) Message-Id: <200903070118.n271IVFE034166@svn.freebsd.org> From: Tim Kientzle Date: Sat, 7 Mar 2009 01:18:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r189471 - head/lib/libarchive 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, 07 Mar 2009 01:18:32 -0000 Author: kientzle Date: Sat Mar 7 01:18:30 2009 New Revision: 189471 URL: http://svn.freebsd.org/changeset/base/189471 Log: Merge r608 from libarchive.googlecode.com: Clear a newly-allocated bidder object. Modified: head/lib/libarchive/archive_read.c Modified: head/lib/libarchive/archive_read.c ============================================================================== --- head/lib/libarchive/archive_read.c Sat Mar 7 01:18:21 2009 (r189470) +++ head/lib/libarchive/archive_read.c Sat Mar 7 01:18:30 2009 (r189471) @@ -805,8 +805,10 @@ __archive_read_get_bidder(struct archive number_slots = sizeof(a->bidders) / sizeof(a->bidders[0]); for (i = 0; i < number_slots; i++) { - if (a->bidders[i].bid == NULL) + if (a->bidders[i].bid == NULL) { + memset(a->bidders + i, 0, sizeof(a->bidders[0])); return (a->bidders + i); + } } __archive_errx(1, "Not enough slots for compression registration"); From owner-svn-src-head@FreeBSD.ORG Sat Mar 7 01:21: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 BD9F8106566C; Sat, 7 Mar 2009 01:21: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 AA91A8FC14; Sat, 7 Mar 2009 01:21: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 n271Lkc7034271; Sat, 7 Mar 2009 01:21:46 GMT (envelope-from kientzle@svn.freebsd.org) Received: (from kientzle@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n271LkLJ034266; Sat, 7 Mar 2009 01:21:46 GMT (envelope-from kientzle@svn.freebsd.org) Message-Id: <200903070121.n271LkLJ034266@svn.freebsd.org> From: Tim Kientzle Date: Sat, 7 Mar 2009 01:21:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r189472 - in head/lib/libarchive: . 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: Sat, 07 Mar 2009 01:21:47 -0000 Author: kientzle Date: Sat Mar 7 01:21:46 2009 New Revision: 189472 URL: http://svn.freebsd.org/changeset/base/189472 Log: Merge r714,r715 from libarchive.googlecode.com: Fix Debian bug #516577. Don't crash if client does not provide a skip function. Extend one of the test cases to use archive_read_open2() with only a read callback. Modified: head/lib/libarchive/archive_read.c head/lib/libarchive/test/read_open_memory.c head/lib/libarchive/test/test.h head/lib/libarchive/test/test_read_pax_truncated.c Modified: head/lib/libarchive/archive_read.c ============================================================================== --- head/lib/libarchive/archive_read.c Sat Mar 7 01:18:30 2009 (r189471) +++ head/lib/libarchive/archive_read.c Sat Mar 7 01:21:46 2009 (r189472) @@ -234,6 +234,8 @@ static int64_t client_skip_proxy(struct archive_read_filter *self, int64_t request) { int64_t r; + if (self->archive->client.skipper == NULL) + return (0); r = (self->archive->client.skipper)(&self->archive->archive, self->data, request); self->archive->archive.raw_position += r; Modified: head/lib/libarchive/test/read_open_memory.c ============================================================================== --- head/lib/libarchive/test/read_open_memory.c Sat Mar 7 01:18:30 2009 (r189471) +++ head/lib/libarchive/test/read_open_memory.c Sat Mar 7 01:21:46 2009 (r189472) @@ -54,10 +54,30 @@ static ssize_t memory_read_skip(struct a static off_t memory_read_skip(struct archive *, void *, off_t request); #endif static ssize_t memory_read(struct archive *, void *, const void **buff); +static int read_open_memory_internal(struct archive *a, void *buff, + size_t size, size_t read_size, int fullapi); + int read_open_memory(struct archive *a, void *buff, size_t size, size_t read_size) { + return read_open_memory_internal(a, buff, size, read_size, 1); +} + +/* + * As above, but don't register any optional part of the API, to verify + * that internals work correctly with just the minimal entry points. + */ +int +read_open_memory2(struct archive *a, void *buff, size_t size, size_t read_size) +{ + return read_open_memory_internal(a, buff, size, read_size, 0); +} + +static int +read_open_memory_internal(struct archive *a, void *buff, + size_t size, size_t read_size, int fullapi) +{ struct read_memory_data *mine; mine = (struct read_memory_data *)malloc(sizeof(*mine)); @@ -71,8 +91,12 @@ read_open_memory(struct archive *a, void mine->read_size = read_size; mine->copy_buff_size = read_size + 64; mine->copy_buff = malloc(mine->copy_buff_size); - return (archive_read_open2(a, mine, memory_read_open, - memory_read, memory_read_skip, memory_read_close)); + if (fullapi) + return (archive_read_open2(a, mine, memory_read_open, + memory_read, memory_read_skip, memory_read_close)); + else + return (archive_read_open2(a, mine, NULL, + memory_read, NULL, NULL)); } /* Modified: head/lib/libarchive/test/test.h ============================================================================== --- head/lib/libarchive/test/test.h Sat Mar 7 01:18:30 2009 (r189471) +++ head/lib/libarchive/test/test.h Sat Mar 7 01:21:46 2009 (r189472) @@ -166,6 +166,8 @@ void extract_reference_file(const char * /* Special customized read-from-memory interface. */ int read_open_memory(struct archive *, void *, size_t, size_t); +/* "2" version exercises a slightly different set of libarchive APIs. */ +int read_open_memory2(struct archive *, void *, size_t, size_t); /* * ARCHIVE_VERSION_STAMP first appeared in 1.9 and libarchive 2.2.4. Modified: head/lib/libarchive/test/test_read_pax_truncated.c ============================================================================== --- head/lib/libarchive/test/test_read_pax_truncated.c Sat Mar 7 01:18:30 2009 (r189471) +++ head/lib/libarchive/test/test_read_pax_truncated.c Sat Mar 7 01:21:46 2009 (r189472) @@ -72,7 +72,7 @@ DEFINE_TEST(test_read_pax_truncated) assert((a = archive_read_new()) != NULL); assertA(0 == archive_read_support_format_all(a)); assertA(0 == archive_read_support_compression_all(a)); - assertA(0 == read_open_memory(a, buff, i, 13)); + assertA(0 == read_open_memory2(a, buff, i, 13)); if (i < 1536) { assertEqualIntA(a, ARCHIVE_FATAL, archive_read_next_header(a, &ae)); From owner-svn-src-head@FreeBSD.ORG Sat Mar 7 02:09: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 284F71065674; Sat, 7 Mar 2009 02:09:22 +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 0ADF58FC1D; Sat, 7 Mar 2009 02:09:22 +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 n2729Ll5035178; Sat, 7 Mar 2009 02:09:21 GMT (envelope-from kientzle@svn.freebsd.org) Received: (from kientzle@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n2729Lg3035175; Sat, 7 Mar 2009 02:09:21 GMT (envelope-from kientzle@svn.freebsd.org) Message-Id: <200903070209.n2729Lg3035175@svn.freebsd.org> From: Tim Kientzle Date: Sat, 7 Mar 2009 02:09: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: r189473 - in head/lib/libarchive: . 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: Sat, 07 Mar 2009 02:09:22 -0000 Author: kientzle Date: Sat Mar 7 02:09:21 2009 New Revision: 189473 URL: http://svn.freebsd.org/changeset/base/189473 Log: Merge r658 from libarchive.googlecode.com: Only flush and close the file if it was actually opened. Test for this case. Added: head/lib/libarchive/test/test_read_file_nonexistent.c (contents, props changed) Modified: head/lib/libarchive/archive_read_open_filename.c head/lib/libarchive/test/Makefile Modified: head/lib/libarchive/archive_read_open_filename.c ============================================================================== --- head/lib/libarchive/archive_read_open_filename.c Sat Mar 7 01:21:46 2009 (r189472) +++ head/lib/libarchive/archive_read_open_filename.c Sat Mar 7 02:09:21 2009 (r189473) @@ -238,30 +238,32 @@ file_close(struct archive *a, void *clie (void)a; /* UNUSED */ - /* - * Sometimes, we should flush the input before closing. - * Regular files: faster to just close without flush. - * Devices: must not flush (user might need to - * read the "next" item on a non-rewind device). - * Pipes and sockets: must flush (otherwise, the - * program feeding the pipe or socket may complain). - * Here, I flush everything except for regular files and - * device nodes. - */ - if (!S_ISREG(mine->st_mode) - && !S_ISCHR(mine->st_mode) - && !S_ISBLK(mine->st_mode)) { - ssize_t bytesRead; - do { - bytesRead = read(mine->fd, mine->buffer, - mine->block_size); - } while (bytesRead > 0); + /* Only flush and close if open succeeded. */ + if (mine->fd >= 0) { + /* + * Sometimes, we should flush the input before closing. + * Regular files: faster to just close without flush. + * Devices: must not flush (user might need to + * read the "next" item on a non-rewind device). + * Pipes and sockets: must flush (otherwise, the + * program feeding the pipe or socket may complain). + * Here, I flush everything except for regular files and + * device nodes. + */ + if (!S_ISREG(mine->st_mode) + && !S_ISCHR(mine->st_mode) + && !S_ISBLK(mine->st_mode)) { + ssize_t bytesRead; + do { + bytesRead = read(mine->fd, mine->buffer, + mine->block_size); + } while (bytesRead > 0); + } + /* If a named file was opened, then it needs to be closed. */ + if (mine->filename[0] != '\0') + close(mine->fd); } - /* If a named file was opened, then it needs to be closed. */ - if (mine->filename[0] != '\0') - close(mine->fd); - if (mine->buffer != NULL) - free(mine->buffer); + free(mine->buffer); free(mine); return (ARCHIVE_OK); } Modified: head/lib/libarchive/test/Makefile ============================================================================== --- head/lib/libarchive/test/Makefile Sat Mar 7 01:21:46 2009 (r189472) +++ head/lib/libarchive/test/Makefile Sat Mar 7 02:09:21 2009 (r189473) @@ -29,6 +29,7 @@ TESTS= \ test_read_data_large.c \ test_read_disk.c \ test_read_extract.c \ + test_read_file_nonexistent.c \ test_read_format_ar.c \ test_read_format_cpio_bin.c \ test_read_format_cpio_bin_Z.c \ Added: head/lib/libarchive/test/test_read_file_nonexistent.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/lib/libarchive/test/test_read_file_nonexistent.c Sat Mar 7 02:09:21 2009 (r189473) @@ -0,0 +1,37 @@ +/*- + * Copyright (c) 2003-2009 Tim Kientzle + * 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(S) ``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(S) 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 "test.h" +__FBSDID("$FreeBSD$"); + +DEFINE_TEST(test_read_file_nonexistent) +{ + struct archive* a = archive_read_new(); + assertEqualInt(ARCHIVE_OK, archive_read_support_format_all(a)); + assertEqualInt(ARCHIVE_FATAL, + archive_read_open_filename(a, "notexistent.tar", 512)); + archive_read_finish(a); +} + + From owner-svn-src-head@FreeBSD.ORG Sat Mar 7 02:24: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 195FD106564A; Sat, 7 Mar 2009 02:24:33 +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 05CF88FC1D; Sat, 7 Mar 2009 02:24:33 +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 n272OXw3035561; Sat, 7 Mar 2009 02:24:33 GMT (envelope-from kientzle@svn.freebsd.org) Received: (from kientzle@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n272OWqU035556; Sat, 7 Mar 2009 02:24:32 GMT (envelope-from kientzle@svn.freebsd.org) Message-Id: <200903070224.n272OWqU035556@svn.freebsd.org> From: Tim Kientzle Date: Sat, 7 Mar 2009 02:24:32 +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: r189474 - in head/lib/libarchive: . 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: Sat, 07 Mar 2009 02:24:33 -0000 Author: kientzle Date: Sat Mar 7 02:24:32 2009 New Revision: 189474 URL: http://svn.freebsd.org/changeset/base/189474 Log: Merge r558,567,569,571,581,582,583,598 from libarchive.googlecode.com: Support Joliet extensions. This currently ignores Rockridge extensions if both exist on the same disk unless the '!joliet' option is provided. e.g.: tar -xvf example.iso --options '!joliet' Thanks to: Andreas Henriksson Added: head/lib/libarchive/test/test_read_format_isojoliet_bz2.c (contents, props changed) head/lib/libarchive/test/test_read_format_isojoliet_bz2.iso.bz2.uu (contents, props changed) head/lib/libarchive/test/test_read_format_isojolietrr_bz2.iso.bz2.uu (contents, props changed) Modified: head/lib/libarchive/archive_read_support_format_iso9660.c head/lib/libarchive/test/test_read_format_iso_gz.c Modified: head/lib/libarchive/archive_read_support_format_iso9660.c ============================================================================== --- head/lib/libarchive/archive_read_support_format_iso9660.c Sat Mar 7 02:09:21 2009 (r189473) +++ head/lib/libarchive/archive_read_support_format_iso9660.c Sat Mar 7 02:24:32 2009 (r189474) @@ -1,5 +1,6 @@ /*- * Copyright (c) 2003-2007 Tim Kientzle + * Copyright (c) 2009 Andreas Henriksson * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -148,6 +149,28 @@ __FBSDID("$FreeBSD$"); #error PVD offset and size definitions are wrong. #endif + +/* Structure of optional on-disk supplementary volume descriptor. */ +#define SVD_type_offset 0 +#define SVD_type_size 1 +#define SVD_id_offset (SVD_type_offset + SVD_type_size) +#define SVD_id_size 5 +#define SVD_version_offset (SVD_id_offset + SVD_id_size) +#define SVD_version_size 1 +/* ... */ +#define SVD_volume_space_size_offset 80 +#define SVD_volume_space_size_size 8 +#define SVD_escape_sequences_offset (SVD_volume_space_size_offset + SVD_volume_space_size_size) +#define SVD_escape_sequences_size 32 +/* ... */ +#define SVD_logical_block_size_offset 128 +#define SVD_logical_block_size_size 4 +/* ... */ +#define SVD_root_directory_record_offset 156 +#define SVD_root_directory_record_size 34 +/* ... */ +/* FIXME: validate correctness of last SVD entry offset. */ + /* Structure of an on-disk directory record. */ /* Note: ISO9660 stores each multi-byte integer twice, once in * each byte order. The sizes here are the size of just one @@ -175,10 +198,6 @@ __FBSDID("$FreeBSD$"); #define DR_name_len_size 1 #define DR_name_offset 33 -/* - * Our private data. - */ - /* In-memory storage for a directory record. */ struct file_info { struct file_info *parent; @@ -207,9 +226,13 @@ struct file_info { struct iso9660 { int magic; #define ISO9660_MAGIC 0x96609660 + + int option_ignore_joliet; + struct archive_string pathname; char seenRockridge; /* Set true if RR extensions are used. */ unsigned char suspOffset; + char seenJoliet; uint64_t previous_offset; uint64_t previous_size; @@ -230,6 +253,8 @@ struct iso9660 { static void add_entry(struct iso9660 *iso9660, struct file_info *file); static int archive_read_format_iso9660_bid(struct archive_read *); +static int archive_read_format_iso9660_options(struct archive_read *, + const char *, const char *); static int archive_read_format_iso9660_cleanup(struct archive_read *); static int archive_read_format_iso9660_read_data(struct archive_read *, const void **, size_t *, off_t *); @@ -243,6 +268,7 @@ static void dump_isodirrec(FILE *, const static time_t time_from_tm(struct tm *); static time_t isodate17(const unsigned char *); static time_t isodate7(const unsigned char *); +static int isJolietSVD(struct iso9660 *, const unsigned char *); static int isPVD(struct iso9660 *, const unsigned char *); static struct file_info *next_entry(struct iso9660 *); static int next_entry_seek(struct archive_read *a, struct iso9660 *iso9660, @@ -281,7 +307,7 @@ archive_read_support_format_iso9660(stru iso9660, "iso9660", archive_read_format_iso9660_bid, - NULL, + archive_read_format_iso9660_options, archive_read_format_iso9660_read_header, archive_read_format_iso9660_read_data, archive_read_format_iso9660_read_data_skip, @@ -299,9 +325,9 @@ static int archive_read_format_iso9660_bid(struct archive_read *a) { struct iso9660 *iso9660; - ssize_t bytes_read; + ssize_t bytes_read, brsvd; const void *h; - const unsigned char *p; + const unsigned char *p, *psvd; int bid; iso9660 = (struct iso9660 *)(a->format->data); @@ -320,6 +346,17 @@ archive_read_format_iso9660_bid(struct a bytes_read -= 32768; p += 32768; + /* Check each volume descriptor to locate possible SVD with Joliet. */ + for (brsvd = bytes_read, psvd = p; + !iso9660->option_ignore_joliet && brsvd > 2048; + brsvd -= 2048, psvd += 2048) { + bid = isJolietSVD(iso9660, psvd); + if (bid > 0) + return (bid); + if (*p == '\177') /* End-of-volume-descriptor marker. */ + break; + } + /* Check each volume descriptor to locate the PVD. */ for (; bytes_read > 2048; bytes_read -= 2048, p += 2048) { bid = isPVD(iso9660, p); @@ -334,6 +371,88 @@ archive_read_format_iso9660_bid(struct a } static int +archive_read_format_iso9660_options(struct archive_read *a, + const char *key, const char *val) +{ + struct iso9660 *iso9660; + + iso9660 = (struct iso9660 *)(a->format->data); + + if (strcmp(key, "joliet") == 0) { + if (val == NULL || strcmp(val, "off") == 0 || + strcmp(val, "ignore") == 0 || + strcmp(val, "disable") == 0 || + strcmp(val, "0") == 0) + iso9660->option_ignore_joliet = 1; + else + iso9660->option_ignore_joliet = 0; + return (ARCHIVE_OK); + } + + /* Note: The "warn" return is just to inform the options + * supervisor that we didn't handle it. It will generate + * a suitable error if noone used this option. */ + return (ARCHIVE_WARN); +} + +static int +isJolietSVD(struct iso9660 *iso9660, const unsigned char *h) +{ + struct file_info *file; + const unsigned char *p; + + /* Type 2 means it's a SVD. */ + if (h[SVD_type_offset] != 2) + return (0); + + /* ID must be "CD001" */ + if (memcmp(h + SVD_id_offset, "CD001", 5) != 0) + return (0); + + /* FIXME: do more validations according to joliet spec. */ + + /* check if this SVD contains joliet extension! */ + p = h + SVD_escape_sequences_offset; + /* N.B. Joliet spec says p[1] == '\\', but.... */ + if (p[0] == '%' && p[1] == '/') { + int level = 0; + + if (p[2] == '@') + level = 1; + else if (p[2] == 'C') + level = 2; + else if (p[2] == 'E') + level = 3; + else /* not joliet */ + return (0); + + iso9660->seenJoliet = level; + + } else /* not joliet */ + return (0); + + iso9660->logical_block_size = toi(h + SVD_logical_block_size_offset, 2); + if (iso9660->logical_block_size <= 0) + return (0); + + iso9660->volume_size = iso9660->logical_block_size + * (uint64_t)toi(h + SVD_volume_space_size_offset, 4); + +#if DEBUG + fprintf(stderr, "Joliet UCS-2 level %d with " + "logical block size:%d, volume size:%d\n", + iso9660->seenJoliet, + iso9660->logical_block_size, iso9660->volume_size); +#endif + + /* Store the root directory in the pending list. */ + file = parse_file_info(iso9660, NULL, h + SVD_root_directory_record_offset); + add_entry(iso9660, file); + + return (48); +} + +static int isPVD(struct iso9660 *iso9660, const unsigned char *h) { struct file_info *file; @@ -507,6 +626,11 @@ archive_read_format_iso9660_read_header( p += *p) { struct file_info *child; + /* N.B.: these special directory identifiers + * are 8 bit "values" even on a + * Joliet CD with UCS-2 (16bit) encoding. + */ + /* Skip '.' entry. */ if (*(p + DR_name_len_offset) == 1 && *(p + DR_name_offset) == '\0') @@ -601,7 +725,7 @@ parse_file_info(struct iso9660 *iso9660, struct file_info *file; size_t name_len; const unsigned char *rr_start, *rr_end; - const char *p; + const unsigned char *p; int flags; /* TODO: Sanity check that name_len doesn't exceed length, etc. */ @@ -620,23 +744,68 @@ parse_file_info(struct iso9660 *iso9660, file->mtime = isodate7(isodirrec + DR_date_offset); file->ctime = file->atime = file->mtime; - name_len = (size_t)*(const unsigned char *)(isodirrec + DR_name_len_offset); + name_len = (size_t)isodirrec[DR_name_len_offset]; p = isodirrec + DR_name_offset; /* Rockridge extensions (if any) follow name. Compute this * before fidgeting the name_len below. */ rr_start = p + name_len + (name_len & 1 ? 0 : 1) + iso9660->suspOffset; - rr_end = (const unsigned char *)isodirrec - + *(isodirrec + DR_length_offset); + rr_end = isodirrec + isodirrec[DR_length_offset]; + + if (iso9660->seenJoliet) { + /* Joliet names are max 64 chars (128 bytes) according to spec, + * but genisoimage (and others?) will allow you to have more. + */ + wchar_t wbuff[64+1], *wp; + const unsigned char *c; + + /* TODO: warn when name_len > 128 ? */ + + /* convert BE UTF-16 to wchar_t */ + for (c = p, wp = wbuff; + c < (p + name_len) && + wp < (wbuff + sizeof(wbuff)/sizeof(*wbuff) - 1); + c += 2) { + *wp++ = (((255 & (int)c[0]) << 8) | (255 & (int)c[1])); + } + *wp = L'\0'; - /* Chop off trailing ';1' from files. */ - if (name_len > 2 && p[name_len - 1] == '1' && p[name_len - 2] == ';') - name_len -= 2; - /* Chop off trailing '.' from filenames. */ - if (name_len > 1 && p[name_len - 1] == '.') - --name_len; - archive_strncpy(&file->name, p, name_len); +#if 0 /* untested code, is it at all useful on Joliet? */ + /* trim trailing first version and dot from filename. + * + * Remember we where in UTF-16BE land! + * SEPARATOR 1 (.) and SEPARATOR 2 (;) are both + * 16 bits big endian characters on Joliet. + * + * TODO: sanitize filename? + * Joliet allows any UCS-2 char except: + * *, /, :, ;, ? and \. + */ + /* Chop off trailing ';1' from files. */ + if (*(wp-2) == ';' && *(wp-1) == '1') { + wp-=2; + *wp = L'\0'; + } - flags = *(isodirrec + DR_flags_offset); + /* Chop off trailing '.' from filenames. */ + if (*(wp-1) == '.') + *(--wp) = L'\0'; +#endif + + /* store the result in the file name field. */ + archive_strappend_w_utf8(&file->name, wbuff); + } else { + /* Chop off trailing ';1' from files. */ + if (name_len > 2 && p[name_len - 2] == ';' && + p[name_len - 1] == '1') + name_len -= 2; + /* Chop off trailing '.' from filenames. */ + if (name_len > 1 && p[name_len - 1] == '.') + --name_len; + + archive_strncpy(&file->name, (const char *)p, name_len); + } + + flags = isodirrec[DR_flags_offset]; if (flags & 0x02) file->mode = AE_IFDIR | 0700; else @@ -884,8 +1053,8 @@ parse_rockridge(struct iso9660 *iso9660, } static void -parse_rockridge_NM1(struct file_info *file, const unsigned char *data, - int data_length) +parse_rockridge_NM1(struct file_info *file, + const unsigned char *data, int data_length) { if (!file->name_continues) archive_string_empty(&file->name); @@ -906,12 +1075,12 @@ parse_rockridge_NM1(struct file_info *fi case 0: if (data_length < 2) return; - archive_strncat(&file->name, data + 1, data_length - 1); + archive_strncat(&file->name, (const char *)data + 1, data_length - 1); break; case 1: if (data_length < 2) return; - archive_strncat(&file->name, data + 1, data_length - 1); + archive_strncat(&file->name, (const char *)data + 1, data_length - 1); file->name_continues = 1; break; case 2: Modified: head/lib/libarchive/test/test_read_format_iso_gz.c ============================================================================== --- head/lib/libarchive/test/test_read_format_iso_gz.c Sat Mar 7 02:09:21 2009 (r189473) +++ head/lib/libarchive/test/test_read_format_iso_gz.c Sat Mar 7 02:24:32 2009 (r189474) @@ -57,17 +57,20 @@ DEFINE_TEST(test_read_format_iso_gz) struct archive_entry *ae; struct archive *a; assert((a = archive_read_new()) != NULL); - assert(0 == archive_read_support_compression_all(a)); - assert(0 == archive_read_support_format_all(a)); - assert(0 == archive_read_open_memory(a, archive, sizeof(archive))); - assert(0 == archive_read_next_header(a, &ae)); - assert(archive_compression(a) == ARCHIVE_COMPRESSION_GZIP); - assert(archive_format(a) == ARCHIVE_FORMAT_ISO9660); - assert(0 == archive_read_close(a)); + assertEqualIntA(a, ARCHIVE_OK, + archive_read_support_compression_all(a)); + assertEqualIntA(a, ARCHIVE_OK, + archive_read_support_format_all(a)); + assertEqualIntA(a, ARCHIVE_OK, + archive_read_open_memory(a, archive, sizeof(archive))); + assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae)); + assertEqualInt(archive_compression(a), ARCHIVE_COMPRESSION_GZIP); + assertEqualInt(archive_format(a), ARCHIVE_FORMAT_ISO9660); + assertEqualIntA(a, ARCHIVE_OK, archive_read_close(a)); #if ARCHIVE_VERSION_NUMBER < 2000000 archive_read_finish(a); #else - assert(0 == archive_read_finish(a)); + assertEqualInt(ARCHIVE_OK, archive_read_finish(a)); #endif #else skipping("Need zlib"); Added: head/lib/libarchive/test/test_read_format_isojoliet_bz2.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/lib/libarchive/test/test_read_format_isojoliet_bz2.c Sat Mar 7 02:24:32 2009 (r189474) @@ -0,0 +1,198 @@ +/*- + * Copyright (c) 2003-2007 Tim Kientzle + * All rights reserved. + * + * Based on libarchive/test/test_read_format_isorr_bz2.c with + * bugs introduced by Andreas Henriksson for + * testing ISO9660 image with Joliet extension. + * + * 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(S) ``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(S) 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 "test.h" +__FBSDID("$FreeBSD$"); + +/* +Execute the following to rebuild the data for this program: + tail -n +35 test_read_format_isojoliet_bz2.c | /bin/sh + +rm -rf /tmp/iso +mkdir /tmp/iso +mkdir /tmp/iso/dir +echo "hello" >/tmp/iso/long-joliet-file-name.textfile +ln /tmp/iso/long-joliet-file-name.textfile /tmp/iso/hardlink +(cd /tmp/iso; ln -s long-joliet-file-name.textfile symlink) +if [ "$(uname -s)" = "Linux" ]; then # gnu coreutils touch doesn't have -h +TZ=utc touch -afm -t 197001020000.01 /tmp/iso /tmp/iso/long-joliet-file-name.textfile /tmp/iso/dir +TZ=utc touch -afm -t 197001030000.02 /tmp/iso/symlink +else +TZ=utc touch -afhm -t 197001020000.01 /tmp/iso /tmp/iso/long-joliet-file-name.textfile /tmp/iso/dir +TZ=utc touch -afhm -t 197001030000.02 /tmp/iso/symlink +fi +mkhybrid -J -uid 1 -gid 2 /tmp/iso | bzip2 > test_read_format_isojoliet_bz2.iso.bz2 +F=test_read_format_isojoliet_bz2.iso.bz2 +uuencode $F $F > $F.uu +exit 1 + */ + +static void +joliettest(int withrr) +{ + const char *refname = "test_read_format_isojoliet_bz2.iso.bz2"; + struct archive_entry *ae; + struct archive *a; + const void *p; + size_t size; + off_t offset; + int r; + + if (withrr) { + refname = "test_read_format_isojolietrr_bz2.iso.bz2"; + } + + extract_reference_file(refname); + assert((a = archive_read_new()) != NULL); + assertEqualInt(0, archive_read_support_compression_bzip2(a)); + assertEqualInt(0, archive_read_support_format_all(a)); + r = archive_read_open_filename(a, refname, 10240); + if (r == ARCHIVE_FATAL) { + skipping("Bzip2 decompression unsupported on this platform"); + archive_read_finish(a); + return; + } + assertEqualInt(0, r); + + /* First entry is '.' root directory. */ + assertEqualInt(0, archive_read_next_header(a, &ae)); + assertEqualString(".", archive_entry_pathname(ae)); + assert(S_ISDIR(archive_entry_stat(ae)->st_mode)); + assertEqualInt(2048, archive_entry_size(ae)); + assertEqualInt(86401, archive_entry_mtime(ae)); + assertEqualInt(0, archive_entry_mtime_nsec(ae)); + assertEqualInt(86401, archive_entry_ctime(ae)); + assertEqualInt(0, archive_entry_stat(ae)->st_nlink); + assertEqualInt(0, archive_entry_uid(ae)); + assertEqualIntA(a, ARCHIVE_EOF, + archive_read_data_block(a, &p, &size, &offset)); + assertEqualInt((int)size, 0); + + /* A directory. */ + assertEqualInt(0, archive_read_next_header(a, &ae)); + assertEqualString("dir", archive_entry_pathname(ae)); + assert(S_ISDIR(archive_entry_stat(ae)->st_mode)); + assertEqualInt(2048, archive_entry_size(ae)); + assertEqualInt(86401, archive_entry_mtime(ae)); + assertEqualInt(86401, archive_entry_atime(ae)); + if (withrr) { + assertEqualInt(2, archive_entry_stat(ae)->st_nlink); + assertEqualInt(1, archive_entry_uid(ae)); + assertEqualInt(2, archive_entry_gid(ae)); + } + + /* A hardlink to the regular file. */ + assertEqualInt(0, archive_read_next_header(a, &ae)); + assertEqualString("hardlink", archive_entry_pathname(ae)); + assert(S_ISREG(archive_entry_stat(ae)->st_mode)); + if (withrr) { + assertEqualString("long-joliet-file-name.textfile", + archive_entry_hardlink(ae)); + } + assertEqualInt(6, archive_entry_size(ae)); + assertEqualInt(0, archive_read_data_block(a, &p, &size, &offset)); + assertEqualInt(6, (int)size); + assertEqualInt(0, offset); + assertEqualInt(0, memcmp(p, "hello\n", 6)); + if (withrr) { + assertEqualInt(86401, archive_entry_mtime(ae)); + assertEqualInt(86401, archive_entry_atime(ae)); + assertEqualInt(2, archive_entry_stat(ae)->st_nlink); + assertEqualInt(1, archive_entry_uid(ae)); + assertEqualInt(2, archive_entry_gid(ae)); + } + + /* A regular file. */ + assertEqualInt(0, archive_read_next_header(a, &ae)); + assertEqualString("long-joliet-file-name.textfile", archive_entry_pathname(ae)); + assert(S_ISREG(archive_entry_stat(ae)->st_mode)); + assertEqualInt(6, archive_entry_size(ae)); + if (withrr) { + assertEqualInt(86401, archive_entry_mtime(ae)); + assertEqualInt(86401, archive_entry_atime(ae)); + assertEqualInt(2, archive_entry_stat(ae)->st_nlink); + assertEqualInt(1, archive_entry_uid(ae)); + assertEqualInt(2, archive_entry_gid(ae)); + } + + /* A symlink to the regular file. */ + assertEqualInt(0, archive_read_next_header(a, &ae)); + assertEqualString("symlink", archive_entry_pathname(ae)); + if (withrr) { + assert(S_ISLNK(archive_entry_stat(ae)->st_mode)); + assertEqualString("long-joliet-file-name.textfile", + archive_entry_symlink(ae)); + } + assertEqualInt(0, archive_entry_size(ae)); + assertEqualInt(172802, archive_entry_mtime(ae)); + assertEqualInt(172802, archive_entry_atime(ae)); + if (withrr) { + assertEqualInt(1, archive_entry_stat(ae)->st_nlink); + assertEqualInt(1, archive_entry_uid(ae)); + assertEqualInt(2, archive_entry_gid(ae)); + } + + /* End of archive. */ + assertEqualInt(ARCHIVE_EOF, archive_read_next_header(a, &ae)); + + /* Verify archive format. */ + assertEqualInt(archive_compression(a), ARCHIVE_COMPRESSION_BZIP2); + if (withrr) { + assertEqualInt(archive_format(a), + ARCHIVE_FORMAT_ISO9660_ROCKRIDGE); + } + + /* Close the archive. */ + assertEqualInt(0, archive_read_close(a)); +#if ARCHIVE_VERSION_NUMBER < 2000000 + archive_read_finish(a); +#else + assertEqualInt(0, archive_read_finish(a)); +#endif +} + + +DEFINE_TEST(test_read_format_isojoliet_bz2) +{ + joliettest(0); +} + + +DEFINE_TEST(test_read_format_isojolietrr_bz2) +{ + /* XXXX This doesn't work today; can it be made to work? */ +#if 0 + joliettest(1); +#else + skipping("Mixed Joliet/RR not fully supported yet."); +#endif +} + + + + Added: head/lib/libarchive/test/test_read_format_isojoliet_bz2.iso.bz2.uu ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/lib/libarchive/test/test_read_format_isojoliet_bz2.iso.bz2.uu Sat Mar 7 02:24:32 2009 (r189474) @@ -0,0 +1,30 @@ +$FreeBSD$ +begin 644 test_read_format_isojoliet_bz2.iso.bz2 +M0EIH.3%!62936??^FX(``/9_^__?1_?^8__L/__?8:?_W&8@Z@$`9``008"` +M``+)"-`$/@=NN!W8[`8#23*GY-3U$](,0:`:`&"`9``9``T-'J::>B/4``#0 +MIM$9&IA-!-0'I`>HT`&1Z@``T`!H`:#0'H(,E-(-3-$-&AB-`8C0`R9#1A`# +M1A/1`&@,@!H'``#0`-`&@``-&(`!H`````&@`D1)H0B-1O)&4V2:9#"9/4/2 +M`/4>H'J-#(83U/$R@WZJ#>J&CREP**.W2R[".$_:J#$"N5P7:?.#4-4/..?K +M!KG\G]P="PX^ADTP4^Y%[1+0V,;$*HTA&\V'@+*$<.M-0L@CLZ\Z(B=]`3`4%B"00B`FF@!-]HK<2. +M)?&IAD^/KKM>TRY#@+H5W781AM)P\\-4$&88^S$WX"2$=(X7(?,=$?H.A')A +M`%2T4:GEQRL:WS4Q=4SU(F>*JM1UEK\V`5P$L[9[D*;FBNEC^GPMAH8T>K&> +MQ)_.TSB;5G`P>)20L5V6':NL^M38\&.')5))BO/*5`\P%H!`D7B2](0T)?Y0"`M3A6)'=($UL$@I$0$RBA0F4.!DAM`/@ +M!V,L#/`+FC!;C.K58BA"1P\H1LVXG\@^"8IJ@0*0>TP@8F#0R^(M($"`"#I" +M`.FD45RN3EH2^8X6C/LKMKA;@K,T&ZZ%&PIJW%:>FG[.F=KGJ_O.(K`+0#!@ +MQK&-G6!">H`4_/.<\CK)K+S/I/"?`9JG,TS^C1FI[O3NN(`Q^:*`Z1WEO()6 +MZ*!0@MSD*1?AE*V5[='!>>O%XL8LXIOQB\@CIBM%\0JD'+MAR$"@T'8M;JFM +MLHN7HG1S:F]+B'BZ)SJ(=0,6*Z791QW+3RNI(7!E!)'@.B$(934!)D0=U#%# +MV21)DA=@4;RM?@RLG1[`,A:"YQF2!`P`2B)#APE)`^\F8V +M5_U]0O,4AE6?->8U4$<2N%TC-HD%($@9'E1DCQZ&B:X4\IUV83HQ7)A'8I511-P`;=!!).^8X*0NHMB+.&!W"009 +M,<;0G^>BA6F[;A;X2B!%?BP&(G7&@(,*O-QP;;1*`*6"F:X8D"Y$/T,(1JM' +M$>\,IQ&V6;/)!\)0C$,[;`O,`9A-HRHQ8@^PLT.?=7RL[2789J_J86!HF0T" +M3%@,A$VPC(:A@3(\&9-TZP2>KA*D>D;<^L4(H=EUT419R5`$A(R(Y-^O ++_B[DBG"A(>_]-P0` +` +end Added: head/lib/libarchive/test/test_read_format_isojolietrr_bz2.iso.bz2.uu ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/lib/libarchive/test/test_read_format_isojolietrr_bz2.iso.bz2.uu Sat Mar 7 02:24:32 2009 (r189474) @@ -0,0 +1,29 @@ +$FreeBSD$ +begin 644 test_read_format_isojolietrr_bz2.iso.bz2 +M0EIH.3%!6293695"/:0``/9_^__?1??^8_WL/__?8:?_W&8@Z@$`9``008"` +M``+)"-`$/@36`T;`8#*3*GY3U-$R`T::`&F@`!HQ`T9&FC0T!Z@8C0``-"-$ +M9&IA-!3U`9`:-``]0``#0T!H`](`'J9!P`---``9```-```-```R``&AH`<` +M#330`&0``#0``#0``,@`!H:`"1$FIBFBGE/&H;4/5!H&GJ9,C(&3]4>H&T@! +MX4S4_23)^I!^J&,I:"BCP:NQU49CQU07@K5:%N+FASC:#&<_H!T3^C_8,EAR +M>AAY@*??BYHEH;&-B%4:0N+*$9NC-0L@CJ9)U!$ST`F*D.$$@A"`320`3$S7*"&2:*6P36])5 +M/UEPPP-G5GGH*!-7B20Y.4AU"9MM0?K(C+%&%#XTJCZZ.GH)4JHJ2)5-QVD^9IA` +MJ%BPT5G;#K;5KM8^'@["26TJX1E,$$=G]($UUB04B("910H3*'`R0R@/,#L98&B`7-& +M"[C.G57E"$CP=BMVJ(CYQYJ5$37&!`J`\K""HB!0#0RZ(M($"`9Q##2WW*HJ +M);;2U[_KWUN>.EE\=W@T_FK1D:C59VF:FHGY.JASX+#OO(K0+@#!@Q]C&S&H +M`7LV-TZ>LFMC7W3@.V;-37Q'^&I-3X>E;:0!I<(H#U#>7?02J"@4(*Z"%P[! +M6EG=HX+CKQ:+0*\$Q3=05!208:0Y"@I%)<\JQ^N8_<147'#8&2%E+]X01#.8H+0J!NJ=8/99+F^C?B4L"NABYS:$@T +M'/CG%2[+1.R0(O$0N!93,D"!H`F$B'`C,2"&!,YML_<*Q@:I#GK1GP-FSA<4[2H)(;4,0KAA2WE9%>%ON#\AF6`/K>AZ1ANTM,HF-?E[&N9,4K"B`+BOD +M8@EUE%*/R3*BB??@W::!E$)SBI"^BVHM`:'\%!%LYRN"?R"*%<;]L%PA*8D6 +M&308D=DJ0@QK`WG%UU,P`J:*I[QA@7209C/",;1QGP#*<9E+.QRP=LH1>,W6 +M!<9P9GG`,J,5X?86:?0MKY&=E+J,Q^(SV!J&$TR2_.,A$X(1A-HSDR/.S#PG +ILA)[>>5(]8W)ZY0BAMDR3TMM%$6 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 88E381065670; Sat, 7 Mar 2009 02:29:43 +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 76AB08FC12; Sat, 7 Mar 2009 02:29:43 +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 n272ThKT035748; Sat, 7 Mar 2009 02:29:43 GMT (envelope-from kientzle@svn.freebsd.org) Received: (from kientzle@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n272ThkM035747; Sat, 7 Mar 2009 02:29:43 GMT (envelope-from kientzle@svn.freebsd.org) Message-Id: <200903070229.n272ThkM035747@svn.freebsd.org> From: Tim Kientzle Date: Sat, 7 Mar 2009 02:29: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: r189475 - head/lib/libarchive 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, 07 Mar 2009 02:29:44 -0000 Author: kientzle Date: Sat Mar 7 02:29:43 2009 New Revision: 189475 URL: http://svn.freebsd.org/changeset/base/189475 Log: Merge r591 from libarchive.googlecode.com: signed/unsigned fixes. Modified: head/lib/libarchive/archive_read_support_compression_bzip2.c Modified: head/lib/libarchive/archive_read_support_compression_bzip2.c ============================================================================== --- head/lib/libarchive/archive_read_support_compression_bzip2.c Sat Mar 7 02:24:32 2009 (r189474) +++ head/lib/libarchive/archive_read_support_compression_bzip2.c Sat Mar 7 02:29:43 2009 (r189475) @@ -200,7 +200,7 @@ bzip2_filter_read(struct archive_read_fi { struct private_data *state; size_t read_avail, decompressed; - unsigned char *read_buf; + const char *read_buf; ssize_t ret; state = (struct private_data *)self->data; @@ -262,11 +262,11 @@ bzip2_filter_read(struct archive_read_fi /* stream.next_in is really const, but bzlib * doesn't declare it so. */ - read_buf = (unsigned char *)(uintptr_t) + read_buf = __archive_read_filter_ahead(self->upstream, 1, &ret); if (read_buf == NULL) return (ARCHIVE_FATAL); - state->stream.next_in = read_buf; + state->stream.next_in = (char *)(uintptr_t)read_buf; state->stream.avail_in = ret; /* There is no more data, return whatever we have. */ if (ret == 0) { @@ -280,7 +280,7 @@ bzip2_filter_read(struct archive_read_fi /* Decompress as much as we can in one pass. */ ret = BZ2_bzDecompress(&(state->stream)); __archive_read_filter_consume(self->upstream, - (unsigned char *)state->stream.next_in - read_buf); + state->stream.next_in - read_buf); switch (ret) { case BZ_STREAM_END: /* Found end of stream. */ From owner-svn-src-head@FreeBSD.ORG Sat Mar 7 02:47: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 EDE08106564A; Sat, 7 Mar 2009 02:47:04 +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 DA7A28FC12; Sat, 7 Mar 2009 02:47:04 +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 n272l4e7036142; Sat, 7 Mar 2009 02:47:04 GMT (envelope-from kientzle@svn.freebsd.org) Received: (from kientzle@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n272l4r7036138; Sat, 7 Mar 2009 02:47:04 GMT (envelope-from kientzle@svn.freebsd.org) Message-Id: <200903070247.n272l4r7036138@svn.freebsd.org> From: Tim Kientzle Date: Sat, 7 Mar 2009 02:47: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: r189476 - head/lib/libarchive 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, 07 Mar 2009 02:47:05 -0000 Author: kientzle Date: Sat Mar 7 02:47:04 2009 New Revision: 189476 URL: http://svn.freebsd.org/changeset/base/189476 Log: Merge r550,584,587,609,647,674 from libarchive.googlecode.com: Refactor the read_compression_program to add two new abilities: * Public API: You can now include a signature string when you register a program; the program will run only on input that matches the signature string. * Internal API: You can use the init() function to instantiate an external program as part of a filter pipeline. This can be used for graceful fallback (if zlib is unavailable, use external gzip instead) and to use external programs with bidders that are more sophisticated than a static signature check. Modified: head/lib/libarchive/archive.h head/lib/libarchive/archive_read_private.h head/lib/libarchive/archive_read_support_compression_program.c head/lib/libarchive/archive_write_set_compression_program.c Modified: head/lib/libarchive/archive.h ============================================================================== --- head/lib/libarchive/archive.h Sat Mar 7 02:29:43 2009 (r189475) +++ head/lib/libarchive/archive.h Sat Mar 7 02:47:04 2009 (r189476) @@ -300,6 +300,9 @@ __LA_DECL int archive_read_support_com __LA_DECL int archive_read_support_compression_none(struct archive *); __LA_DECL int archive_read_support_compression_program(struct archive *, const char *command); +__LA_DECL int archive_read_support_compression_program_signature + (struct archive *, const char *, + const void * /* match */, size_t); __LA_DECL int archive_read_support_format_all(struct archive *); __LA_DECL int archive_read_support_format_ar(struct archive *); Modified: head/lib/libarchive/archive_read_private.h ============================================================================== --- head/lib/libarchive/archive_read_private.h Sat Mar 7 02:29:43 2009 (r189475) +++ head/lib/libarchive/archive_read_private.h Sat Mar 7 02:47:04 2009 (r189476) @@ -190,4 +190,5 @@ ssize_t __archive_read_consume(struct ar ssize_t __archive_read_filter_consume(struct archive_read_filter *, size_t); int64_t __archive_read_skip(struct archive_read *, int64_t); int64_t __archive_read_filter_skip(struct archive_read_filter *, int64_t); +int __archive_read_program(struct archive_read_filter *, const char *); #endif Modified: head/lib/libarchive/archive_read_support_compression_program.c ============================================================================== --- head/lib/libarchive/archive_read_support_compression_program.c Sat Mar 7 02:29:43 2009 (r189475) +++ head/lib/libarchive/archive_read_support_compression_program.c Sat Mar 7 02:47:04 2009 (r189476) @@ -26,27 +26,6 @@ #include "archive_platform.h" __FBSDID("$FreeBSD$"); - -/* This capability is only available on POSIX systems. */ -#if !defined(HAVE_PIPE) || !defined(HAVE_FCNTL) || \ - !(defined(HAVE_FORK) || defined(HAVE_VFORK)) - -#include "archive.h" - -/* - * On non-Posix systems, allow the program to build, but choke if - * this function is actually invoked. - */ -int -archive_read_support_compression_program(struct archive *_a, const char *cmd) -{ - archive_set_error(_a, -1, - "External compression programs not supported on this platform"); - return (ARCHIVE_FATAL); -} - -#else - #ifdef HAVE_SYS_WAIT_H # include #endif @@ -73,13 +52,70 @@ archive_read_support_compression_program #include "archive_private.h" #include "archive_read_private.h" +int +archive_read_support_compression_program(struct archive *a, const char *cmd) +{ + return (archive_read_support_compression_program_signature(a, cmd, NULL, 0)); +} + + +/* This capability is only available on POSIX systems. */ +#if (!defined(HAVE_PIPE) || !defined(HAVE_FCNTL) || \ + !(defined(HAVE_FORK) || defined(HAVE_VFORK))) && !defined(_WIN32) + +/* + * On non-Posix systems, allow the program to build, but choke if + * this function is actually invoked. + */ +int +archive_read_support_compression_program_signature(struct archive *_a, + const char *cmd, void *signature, size_t signature_len) +{ + (void)_a; /* UNUSED */ + (void)cmd; /* UNUSED */ + (void)signature; /* UNUSED */ + (void)signature_len; /* UNUSED */ + + archive_set_error(_a, -1, + "External compression programs not supported on this platform"); + return (ARCHIVE_FATAL); +} + +int +__archive_read_program(struct archive_read_filter *self, const char *cmd) +{ + (void)self; /* UNUSED */ + (void)cmd; /* UNUSED */ + + archive_set_error(&self->archive->archive, -1, + "External compression programs not supported on this platform"); + return (ARCHIVE_FATAL); +} + +#else + #include "filter_fork.h" +/* + * The bidder object stores the command and the signature to watch for. + * The 'inhibit' entry here is used to ensure that unchecked filters never + * bid twice in the same pipeline. + */ struct program_bidder { char *cmd; - int bid; + void *signature; + size_t signature_len; + int inhibit; }; +static int program_bidder_bid(struct archive_read_filter_bidder *, + struct archive_read_filter *upstream); +static int program_bidder_init(struct archive_read_filter *); +static int program_bidder_free(struct archive_read_filter_bidder *); + +/* + * The actual filter needs to track input and output data. + */ struct program_filter { char *description; pid_t child; @@ -87,38 +123,43 @@ struct program_filter { char *out_buf; size_t out_buf_len; - - const char *child_in_buf; - size_t child_in_buf_avail; }; -static int program_bidder_bid(struct archive_read_filter_bidder *, - struct archive_read_filter *upstream); -static int program_bidder_init(struct archive_read_filter *); -static int program_bidder_free(struct archive_read_filter_bidder *); - static ssize_t program_filter_read(struct archive_read_filter *, const void **); static int program_filter_close(struct archive_read_filter *); - int -archive_read_support_compression_program(struct archive *_a, const char *cmd) +archive_read_support_compression_program_signature(struct archive *_a, + const char *cmd, const void *signature, size_t signature_len) { struct archive_read *a = (struct archive_read *)_a; - struct archive_read_filter_bidder *bidder = __archive_read_get_bidder(a); + struct archive_read_filter_bidder *bidder; struct program_bidder *state; + /* + * Get a bidder object from the read core. + */ + bidder = __archive_read_get_bidder(a); if (bidder == NULL) return (ARCHIVE_FATAL); + /* + * Allocate our private state. + */ state = (struct program_bidder *)calloc(sizeof (*state), 1); if (state == NULL) return (ARCHIVE_FATAL); - state->cmd = strdup(cmd); - state->bid = INT_MAX; + if (signature != NULL && signature_len > 0) { + state->signature_len = signature_len; + state->signature = malloc(signature_len); + memcpy(state->signature, signature, signature_len); + } + /* + * Fill in the bidder object. + */ bidder->data = state; bidder->bid = program_bidder_bid; bidder->init = program_bidder_init; @@ -132,133 +173,125 @@ program_bidder_free(struct archive_read_ { struct program_bidder *state = (struct program_bidder *)self->data; free(state->cmd); + free(state->signature); free(self->data); return (ARCHIVE_OK); } /* - * If the user used us to register, they must really want us to - * handle it, so we always bid INT_MAX the first time we're called. - * After that, we always return zero, lest we end up instantiating - * an infinite pipeline. + * If we do have a signature, bid only if that matches. + * + * If there's no signature, we bid INT_MAX the first time + * we're called, then never bid again. */ static int program_bidder_bid(struct archive_read_filter_bidder *self, struct archive_read_filter *upstream) { struct program_bidder *state = self->data; - int bid = state->bid; - - (void)upstream; /* UNUSED */ + const char *p; - state->bid = 0; /* Don't bid again on this pipeline. */ + /* If we have a signature, use that to match. */ + if (state->signature_len > 0) { + p = __archive_read_filter_ahead(upstream, + state->signature_len, NULL); + if (p == NULL) + return (0); + /* No match, so don't bid. */ + if (memcmp(p, state->signature, state->signature_len) != 0) + return (0); + return (state->signature_len * 8); + } - return (bid); /* Default: We'll take it if we haven't yet bid. */ + /* Otherwise, bid once and then never bid again. */ + if (state->inhibit) + return (0); + state->inhibit = 1; + return (INT_MAX); } /* * Use select() to decide whether the child is ready for read or write. */ - static ssize_t child_read(struct archive_read_filter *self, char *buf, size_t buf_len) { struct program_filter *state = self->data; - ssize_t ret, requested; - const void *child_buf; - - if (state->child_stdout == -1) - return (-1); + ssize_t ret, requested, avail; + const char *p; - if (buf_len == 0) - return (-1); - -restart_read: requested = buf_len > SSIZE_MAX ? SSIZE_MAX : buf_len; - do { - ret = read(state->child_stdout, buf, requested); - } while (ret == -1 && errno == EINTR); - - if (ret > 0) - return (ret); - if (ret == 0 || (ret == -1 && errno == EPIPE)) { - close(state->child_stdout); - state->child_stdout = -1; - return (0); - } - if (ret == -1 && errno != EAGAIN) - return (-1); + for (;;) { + do { + ret = read(state->child_stdout, buf, requested); + } while (ret == -1 && errno == EINTR); + + if (ret > 0) + return (ret); + if (ret == 0 || (ret == -1 && errno == EPIPE)) { + close(state->child_stdout); + state->child_stdout = -1; + return (0); + } + if (ret == -1 && errno != EAGAIN) + return (-1); - if (state->child_in_buf_avail == 0) { - child_buf = state->child_in_buf; - child_buf = __archive_read_filter_ahead(self->upstream, - 1, &ret); - state->child_in_buf = (const char *)child_buf; + if (state->child_stdin == -1) { + /* Block until child has some I/O ready. */ + __archive_check_child(state->child_stdin, + state->child_stdout); + continue; + } - if (ret < 0) { + /* Get some more data from upstream. */ + p = __archive_read_filter_ahead(self->upstream, 1, &avail); + if (p == NULL) { close(state->child_stdin); state->child_stdin = -1; fcntl(state->child_stdout, F_SETFL, 0); - return (-1); + if (avail < 0) + return (avail); + continue; } - if (ret == 0) { + + do { + ret = write(state->child_stdin, p, avail); + } while (ret == -1 && errno == EINTR); + + if (ret > 0) { + /* Consume whatever we managed to write. */ + __archive_read_filter_consume(self->upstream, ret); + } else if (ret == -1 && errno == EAGAIN) { + /* Block until child has some I/O ready. */ + __archive_check_child(state->child_stdin, + state->child_stdout); + } else { + /* Write failed. */ close(state->child_stdin); state->child_stdin = -1; fcntl(state->child_stdout, F_SETFL, 0); - goto restart_read; + /* If it was a bad error, we're done; otherwise + * it was EPIPE or EOF, and we can still read + * from the child. */ + if (ret == -1 && errno != EPIPE) + return (-1); } - __archive_read_filter_consume(self->upstream, ret); - state->child_in_buf_avail = ret; - } - - if (state->child_stdin == -1) { - fcntl(state->child_stdout, F_SETFL, 0); - __archive_check_child(state->child_stdin, state->child_stdout); - goto restart_read; - } - - do { - ret = write(state->child_stdin, state->child_in_buf, - state->child_in_buf_avail); - } while (ret == -1 && errno == EINTR); - - if (ret > 0) { - state->child_in_buf += ret; - state->child_in_buf_avail -= ret; - goto restart_read; - } else if (ret == -1 && errno == EAGAIN) { - __archive_check_child(state->child_stdin, state->child_stdout); - goto restart_read; - } else if (ret == 0 || (ret == -1 && errno == EPIPE)) { - close(state->child_stdin); - state->child_stdin = -1; - fcntl(state->child_stdout, F_SETFL, 0); - goto restart_read; - } else { - close(state->child_stdin); - state->child_stdin = -1; - fcntl(state->child_stdout, F_SETFL, 0); - return (-1); } } -static int -program_bidder_init(struct archive_read_filter *self) +int +__archive_read_program(struct archive_read_filter *self, const char *cmd) { struct program_filter *state; - struct program_bidder *bidder_state; static const size_t out_buf_len = 65536; char *out_buf; char *description; const char *prefix = "Program: "; - - bidder_state = (struct program_bidder *)self->bidder->data; - - state = (struct program_filter *)malloc(sizeof(*state)); + state = (struct program_filter *)calloc(1, sizeof(*state)); out_buf = (char *)malloc(out_buf_len); - description = (char *)malloc(strlen(prefix) + strlen(bidder_state->cmd) + 1); + description = (char *)malloc(strlen(prefix) + strlen(cmd) + 1); if (state == NULL || out_buf == NULL || description == NULL) { archive_set_error(&self->archive->archive, ENOMEM, "Can't allocate input data"); @@ -271,13 +304,13 @@ program_bidder_init(struct archive_read_ self->code = ARCHIVE_COMPRESSION_PROGRAM; state->description = description; strcpy(state->description, prefix); - strcat(state->description, bidder_state->cmd); + strcat(state->description, cmd); self->name = state->description; state->out_buf = out_buf; state->out_buf_len = out_buf_len; - if ((state->child = __archive_create_child(bidder_state->cmd, + if ((state->child = __archive_create_child(cmd, &state->child_stdin, &state->child_stdout)) == -1) { free(state->out_buf); free(state); @@ -295,24 +328,35 @@ program_bidder_init(struct archive_read_ return (ARCHIVE_OK); } +static int +program_bidder_init(struct archive_read_filter *self) +{ + struct program_bidder *bidder_state; + + bidder_state = (struct program_bidder *)self->bidder->data; + return (__archive_read_program(self, bidder_state->cmd)); +} + static ssize_t program_filter_read(struct archive_read_filter *self, const void **buff) { struct program_filter *state; - ssize_t bytes, total; + ssize_t bytes; + size_t total; char *p; state = (struct program_filter *)self->data; total = 0; p = state->out_buf; - while (state->child_stdout != -1) { + while (state->child_stdout != -1 && total < state->out_buf_len) { bytes = child_read(self, p, state->out_buf_len - total); if (bytes < 0) return (bytes); if (bytes == 0) break; total += bytes; + p += bytes; } *buff = state->out_buf; Modified: head/lib/libarchive/archive_write_set_compression_program.c ============================================================================== --- head/lib/libarchive/archive_write_set_compression_program.c Sat Mar 7 02:29:43 2009 (r189475) +++ head/lib/libarchive/archive_write_set_compression_program.c Sat Mar 7 02:47:04 2009 (r189476) @@ -28,8 +28,8 @@ __FBSDID("$FreeBSD$"); /* This capability is only available on POSIX systems. */ -#if !defined(HAVE_PIPE) || !defined(HAVE_FCNTL) || \ - !(defined(HAVE_FORK) || defined(HAVE_VFORK)) +#if (!defined(HAVE_PIPE) || !defined(HAVE_FCNTL) || \ + !(defined(HAVE_FORK) || defined(HAVE_VFORK))) && !defined(_WIN32) #include "archive.h" /* From owner-svn-src-head@FreeBSD.ORG Sat Mar 7 02:51: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 5DF22106564A; Sat, 7 Mar 2009 02:51:19 +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 312498FC13; Sat, 7 Mar 2009 02:51:19 +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 n272pJdt036285; Sat, 7 Mar 2009 02:51:19 GMT (envelope-from kientzle@svn.freebsd.org) Received: (from kientzle@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n272pJLq036283; Sat, 7 Mar 2009 02:51:19 GMT (envelope-from kientzle@svn.freebsd.org) Message-Id: <200903070251.n272pJLq036283@svn.freebsd.org> From: Tim Kientzle Date: Sat, 7 Mar 2009 02:51: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: r189477 - head/lib/libarchive 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, 07 Mar 2009 02:51:19 -0000 Author: kientzle Date: Sat Mar 7 02:51:18 2009 New Revision: 189477 URL: http://svn.freebsd.org/changeset/base/189477 Log: Merge r585,r669 from libarchive.googlecode.com: If zlib is unavailable, use external "gunzip" instead. With this in place, we can unconditionally enable gzip read support. Modified: head/lib/libarchive/archive_read_support_compression_all.c head/lib/libarchive/archive_read_support_compression_gzip.c Modified: head/lib/libarchive/archive_read_support_compression_all.c ============================================================================== --- head/lib/libarchive/archive_read_support_compression_all.c Sat Mar 7 02:47:04 2009 (r189476) +++ head/lib/libarchive/archive_read_support_compression_all.c Sat Mar 7 02:51:18 2009 (r189477) @@ -36,9 +36,8 @@ archive_read_support_compression_all(str #endif /* The decompress code doesn't use an outside library. */ archive_read_support_compression_compress(a); -#if HAVE_ZLIB_H + /* Gzip decompress falls back to "gunzip" command-line. */ archive_read_support_compression_gzip(a); -#endif #if HAVE_LZMADEC_H /* LZMA bidding is subject to false positives because * the LZMA file format has a very weak signature. It Modified: head/lib/libarchive/archive_read_support_compression_gzip.c ============================================================================== --- head/lib/libarchive/archive_read_support_compression_gzip.c Sat Mar 7 02:47:04 2009 (r189476) +++ head/lib/libarchive/archive_read_support_compression_gzip.c Sat Mar 7 02:51:18 2009 (r189477) @@ -91,7 +91,7 @@ archive_read_support_compression_gzip(st bidder->bid = gzip_bidder_bid; bidder->init = gzip_bidder_init; bidder->options = NULL; - bidder->free = NULL; + bidder->free = NULL; /* No data, so no cleanup necessary. */ return (ARCHIVE_OK); } @@ -212,12 +212,14 @@ gzip_bidder_bid(struct archive_read_filt * and emit a useful message. */ static int -gzip_bidder_init(struct archive_read_filter *filter) +gzip_bidder_init(struct archive_read_filter *self) { + int r; - archive_set_error(&filter->archive->archive, -1, - "This version of libarchive was compiled without gzip support"); - return (ARCHIVE_FATAL); + r = __archive_read_program(self, "gunzip"); + self->code = ARCHIVE_COMPRESSION_GZIP; + self->name = "gzip"; + return (r); } #else From owner-svn-src-head@FreeBSD.ORG Sat Mar 7 02:58: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 D4321106566B; Sat, 7 Mar 2009 02:58:15 +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 C1FA88FC0C; Sat, 7 Mar 2009 02:58:15 +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 n272wFlN036468; Sat, 7 Mar 2009 02:58:15 GMT (envelope-from kientzle@svn.freebsd.org) Received: (from kientzle@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n272wFxZ036467; Sat, 7 Mar 2009 02:58:15 GMT (envelope-from kientzle@svn.freebsd.org) Message-Id: <200903070258.n272wFxZ036467@svn.freebsd.org> From: Tim Kientzle Date: Sat, 7 Mar 2009 02:58:15 +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: r189478 - head/lib/libarchive 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, 07 Mar 2009 02:58:16 -0000 Author: kientzle Date: Sat Mar 7 02:58:15 2009 New Revision: 189478 URL: http://svn.freebsd.org/changeset/base/189478 Log: Merge r511,r513,r607 from libarchive.googlecode.com: Mtree reader tweaks: Support nanosecond timestamps, handle attributes broken across multiple lines. Modified: head/lib/libarchive/archive_read_support_format_mtree.c Modified: head/lib/libarchive/archive_read_support_format_mtree.c ============================================================================== --- head/lib/libarchive/archive_read_support_format_mtree.c Sat Mar 7 02:51:18 2009 (r189477) +++ head/lib/libarchive/archive_read_support_format_mtree.c Sat Mar 7 02:58:15 2009 (r189478) @@ -891,8 +891,17 @@ parse_keyword(struct archive_read *a, st break; } if (strcmp(key, "time") == 0) { + time_t m; + long ns; + *parsed_kws |= MTREE_HAS_MTIME; - archive_entry_set_mtime(entry, mtree_atol10(&val), 0); + m = (time_t)mtree_atol10(&val); + if (*val == '.') { + ++val; + ns = (long)mtree_atol10(&val); + } else + ns = 0; + archive_entry_set_mtime(entry, m, ns); break; } if (strcmp(key, "type") == 0) { @@ -1225,6 +1234,7 @@ readline(struct archive_read *a, struct { ssize_t bytes_read; ssize_t total_size = 0; + ssize_t find_off = 0; const void *t; const char *s; void *p; @@ -1262,9 +1272,7 @@ readline(struct archive_read *a, struct /* Null terminate. */ mtree->line.s[total_size] = '\0'; /* If we found an unescaped '\n', clean up and return. */ - if (p == NULL) - continue; - for (u = mtree->line.s; *u; ++u) { + for (u = mtree->line.s + find_off; *u; ++u) { if (u[0] == '\n') { *start = mtree->line.s; return total_size; @@ -1285,8 +1293,12 @@ readline(struct archive_read *a, struct memmove(u, u + 1, total_size - (u - mtree->line.s) + 1); --total_size; - continue; + ++u; + break; } + if (u[1] == '\0') + break; } + find_off = u - mtree->line.s; } } From owner-svn-src-head@FreeBSD.ORG Sat Mar 7 03:00: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 3C0B41065670; Sat, 7 Mar 2009 03:00:45 +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 2A2BC8FC19; Sat, 7 Mar 2009 03:00:45 +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 n2730jJI036578; Sat, 7 Mar 2009 03:00:45 GMT (envelope-from kientzle@svn.freebsd.org) Received: (from kientzle@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n2730jOf036577; Sat, 7 Mar 2009 03:00:45 GMT (envelope-from kientzle@svn.freebsd.org) Message-Id: <200903070300.n2730jOf036577@svn.freebsd.org> From: Tim Kientzle Date: Sat, 7 Mar 2009 03:00: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: r189479 - head/lib/libarchive 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, 07 Mar 2009 03:00:45 -0000 Author: kientzle Date: Sat Mar 7 03:00:44 2009 New Revision: 189479 URL: http://svn.freebsd.org/changeset/base/189479 Log: Merge r723 from libarchive.googlecode.com: Don't try to restore owner or SUID bits on Windows; just ignore them. Modified: head/lib/libarchive/archive_write_disk.c Modified: head/lib/libarchive/archive_write_disk.c ============================================================================== --- head/lib/libarchive/archive_write_disk.c Sat Mar 7 02:58:15 2009 (r189478) +++ head/lib/libarchive/archive_write_disk.c Sat Mar 7 03:00:44 2009 (r189479) @@ -414,8 +414,10 @@ _archive_write_header(struct archive *_a a->mode &= ~S_ISVTX; a->mode &= ~a->user_umask; } +#ifndef _WIN32 if (a->flags & ARCHIVE_EXTRACT_OWNER) a->todo |= TODO_OWNER; +#endif if (a->flags & ARCHIVE_EXTRACT_TIME) a->todo |= TODO_TIMES; if (a->flags & ARCHIVE_EXTRACT_ACL) @@ -1942,6 +1944,7 @@ set_mode(struct archive_write_disk *a, i return (r); if (a->pst->st_gid != a->gid) { mode &= ~ S_ISGID; +#ifndef _WIN32 if (a->flags & ARCHIVE_EXTRACT_OWNER) { /* * This is only an error if you @@ -1954,16 +1957,19 @@ set_mode(struct archive_write_disk *a, i "Can't restore SGID bit"); r = ARCHIVE_WARN; } +#endif } /* While we're here, double-check the UID. */ if (a->pst->st_uid != a->uid && (a->todo & TODO_SUID)) { mode &= ~ S_ISUID; +#ifndef _WIN32 if (a->flags & ARCHIVE_EXTRACT_OWNER) { archive_set_error(&a->archive, -1, "Can't restore SUID bit"); r = ARCHIVE_WARN; } +#endif } a->todo &= ~TODO_SGID_CHECK; a->todo &= ~TODO_SUID_CHECK; @@ -1975,11 +1981,13 @@ set_mode(struct archive_write_disk *a, i */ if (a->user_uid != a->uid) { mode &= ~ S_ISUID; +#ifndef _WIN32 if (a->flags & ARCHIVE_EXTRACT_OWNER) { archive_set_error(&a->archive, -1, "Can't make file SUID"); r = ARCHIVE_WARN; } +#endif } a->todo &= ~TODO_SUID_CHECK; } From owner-svn-src-head@FreeBSD.ORG Sat Mar 7 03:04: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 65157106564A; Sat, 7 Mar 2009 03:04:06 +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 531018FC1A; Sat, 7 Mar 2009 03:04:06 +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 n2734655036791; Sat, 7 Mar 2009 03:04:06 GMT (envelope-from kientzle@svn.freebsd.org) Received: (from kientzle@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n27346Gl036790; Sat, 7 Mar 2009 03:04:06 GMT (envelope-from kientzle@svn.freebsd.org) Message-Id: <200903070304.n27346Gl036790@svn.freebsd.org> From: Tim Kientzle Date: Sat, 7 Mar 2009 03:04: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: r189480 - head/lib/libarchive 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, 07 Mar 2009 03:04:06 -0000 Author: kientzle Date: Sat Mar 7 03:04:06 2009 New Revision: 189480 URL: http://svn.freebsd.org/changeset/base/189480 Log: Merge r540 from libarchive.googlecode.com: Interix doesn't have inttypes.h either. Modified: head/lib/libarchive/archive.h Modified: head/lib/libarchive/archive.h ============================================================================== --- head/lib/libarchive/archive.h Sat Mar 7 03:00:44 2009 (r189479) +++ head/lib/libarchive/archive.h Sat Mar 7 03:04:06 2009 (r189480) @@ -38,8 +38,8 @@ #include #include /* Linux requires this for off_t */ -#if !defined(__WATCOMC__) && !defined(_MSC_VER) -/* Header unavailable on Watcom C or MS Visual C++. */ +#if !defined(__WATCOMC__) && !defined(_MSC_VER) && !defined(__INTERIX) +/* Header unavailable on Watcom C or MS Visual C++ or SFU. */ #include /* int64_t, etc. */ #endif #include /* For FILE * */ From owner-svn-src-head@FreeBSD.ORG Sat Mar 7 03: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 132EF106564A; Sat, 7 Mar 2009 03:16:16 +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 B43018FC0C; Sat, 7 Mar 2009 03:16:16 +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 n273GGl8037209; Sat, 7 Mar 2009 03:16:16 GMT (envelope-from kientzle@svn.freebsd.org) Received: (from kientzle@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n273GGj6037204; Sat, 7 Mar 2009 03:16:16 GMT (envelope-from kientzle@svn.freebsd.org) Message-Id: <200903070316.n273GGj6037204@svn.freebsd.org> From: Tim Kientzle Date: Sat, 7 Mar 2009 03: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: r189481 - head/lib/libarchive/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: Sat, 07 Mar 2009 03:16:17 -0000 Author: kientzle Date: Sat Mar 7 03:16:16 2009 New Revision: 189481 URL: http://svn.freebsd.org/changeset/base/189481 Log: Merge r280,281,496,595,675,712 from libarchive.googlecode.com: Various test improvements, including some work on Windows compatibility and an extra check to verify that no test leaves open file descriptors around. Modified: head/lib/libarchive/test/main.c head/lib/libarchive/test/test.h head/lib/libarchive/test/test_read_compress_program.c head/lib/libarchive/test/test_read_extract.c head/lib/libarchive/test/test_write_compress_program.c Modified: head/lib/libarchive/test/main.c ============================================================================== --- head/lib/libarchive/test/main.c Sat Mar 7 03:04:06 2009 (r189480) +++ head/lib/libarchive/test/main.c Sat Mar 7 03:16:16 2009 (r189481) @@ -62,7 +62,11 @@ __FBSDID("$FreeBSD$"); */ #undef DEFINE_TEST #define DEFINE_TEST(name) void name(void); +#ifdef LIST_H +#include LIST_H +#else #include "list.h" +#endif /* Interix doesn't define these in a standard header. */ #if __INTERIX__ @@ -343,10 +347,10 @@ test_assert_equal_string(const char *fil file, line); fprintf(stderr, " %s = ", e1); strdump(v1); - fprintf(stderr, " (length %d)\n", v1 == NULL ? 0 : strlen(v1)); + fprintf(stderr, " (length %d)\n", v1 == NULL ? 0 : (int)strlen(v1)); fprintf(stderr, " %s = ", e2); strdump(v2); - fprintf(stderr, " (length %d)\n", v2 == NULL ? 0 : strlen(v2)); + fprintf(stderr, " (length %d)\n", v2 == NULL ? 0 : (int)strlen(v2)); report_failure(extra); return (0); } @@ -421,7 +425,7 @@ hexdump(const char *p, const char *ref, char sep; for(i=0; i < l; i+=16) { - fprintf(stderr, "%04x", i + offset); + fprintf(stderr, "%04x", (unsigned)(i + offset)); sep = ' '; for (j = 0; j < 16 && i + j < l; j++) { if (ref != NULL && p[i + j] != ref[i + j]) @@ -718,9 +722,30 @@ slurpfile(size_t * sizep, const char *fm #undef DEFINE_TEST #define DEFINE_TEST(n) { n, #n }, struct { void (*func)(void); const char *name; } tests[] = { +#ifdef LIST_H + #include LIST_H +#else #include "list.h" +#endif }; +static void +close_descriptors(int warn) +{ + int i; + int left_open = 0; + + for (i = 3; i < 100; ++i) { + if (close(i) == 0) + ++left_open; + } + if (warn && left_open > 0) { + fprintf(stderr, " ** %d descriptors unclosed\n", left_open); + failures += left_open; + report_failure(NULL); + } +} + /* * Each test is run in a private work dir. Those work dirs * do have consistent and predictable names, in case a group @@ -762,8 +787,12 @@ static int test_run(int i, const char *t } /* Explicitly reset the locale before each test. */ setlocale(LC_ALL, "C"); + /* Make sure there are no stray descriptors going into the test. */ + close_descriptors(0); /* Run the actual test. */ (*tests[i].func)(); + /* Close stray descriptors, record as errors against this test. */ + close_descriptors(1); /* Summarize the results of this test. */ summarize(); /* If there were no failures, we can remove the work dir. */ @@ -865,6 +894,32 @@ extract_reference_file(const char *name) fclose(in); } +#ifdef _WIN32 +#define DEV_NULL "NUL" +#else +#define DEV_NULL "/dev/null" +#endif + +const char * +external_gzip_program(int un) +{ + const char *extprog; + + if (un) { + extprog = "gunzip"; + if (systemf("%s -V >" DEV_NULL " 2>" DEV_NULL, extprog) == 0) + return (extprog); + extprog = "gzip -d"; + if (systemf("%s -V >" DEV_NULL " 2>" DEV_NULL, extprog) == 0) + return (extprog); + } else { + extprog = "gzip"; + if (systemf("%s -V >" DEV_NULL " 2>" DEV_NULL, extprog) == 0) + return (extprog); + } + return (NULL); +} + static char * get_refdir(void) { @@ -873,7 +928,6 @@ get_refdir(void) char *pwd, *p; /* Get the current dir. */ - /* XXX Visual C++ uses _getcwd() XXX */ pwd = getcwd(NULL, 0); while (pwd[strlen(pwd) - 1] == '\n') pwd[strlen(pwd) - 1] = '\0'; @@ -974,7 +1028,7 @@ int main(int argc, char **argv) * Parse options, without using getopt(), which isn't available * on all platforms. */ - ++argv; --argc;/* Skip program name */ + ++argv; /* Skip program name */ while (*argv != NULL) { if (**argv != '-') break; Modified: head/lib/libarchive/test/test.h ============================================================================== --- head/lib/libarchive/test/test.h Sat Mar 7 03:04:06 2009 (r189480) +++ head/lib/libarchive/test/test.h Sat Mar 7 03:16:16 2009 (r189481) @@ -157,6 +157,9 @@ char *slurpfile(size_t *, const char *fm /* Extracts named reference file to the current directory. */ void extract_reference_file(const char *); +/* Get external gzip program name */ +const char *external_gzip_program(int un); + /* * Special interfaces for libarchive test harness. */ Modified: head/lib/libarchive/test/test_read_compress_program.c ============================================================================== --- head/lib/libarchive/test/test_read_compress_program.c Sat Mar 7 03:04:06 2009 (r189480) +++ head/lib/libarchive/test/test_read_compress_program.c Sat Mar 7 03:16:16 2009 (r189481) @@ -41,12 +41,20 @@ DEFINE_TEST(test_read_compress_program) #else struct archive_entry *ae; struct archive *a; + const char *extprog; + + if ((extprog = external_gzip_program(1)) == NULL) { + skipping("There is no gzip uncompression " + "program in this platform"); + return; + } assert((a = archive_read_new()) != NULL); assertEqualIntA(a, ARCHIVE_OK, archive_read_support_compression_none(a)); - r = archive_read_support_compression_program(a, "gunzip"); + r = archive_read_support_compression_program(a, extprog); if (r == ARCHIVE_FATAL) { - skipping("archive_read_support_compression_program() unsupported on this platform"); + skipping("archive_read_support_compression_program() " + "unsupported on this platform"); return; } assertEqualIntA(a, ARCHIVE_OK, r); Modified: head/lib/libarchive/test/test_read_extract.c ============================================================================== --- head/lib/libarchive/test/test_read_extract.c Sat Mar 7 03:04:06 2009 (r189480) +++ head/lib/libarchive/test/test_read_extract.c Sat Mar 7 03:16:16 2009 (r189481) @@ -158,6 +158,7 @@ DEFINE_TEST(test_read_extract) failure("The file on disk could not be opened."); assert(fd != 0); bytes_read = read(fd, buff, FILE_BUFF_SIZE); + close(fd); failure("The file contents read from disk are the wrong size"); assert(bytes_read == FILE_BUFF_SIZE); failure("The file contents on disk do not match the file contents that were put into the archive."); Modified: head/lib/libarchive/test/test_write_compress_program.c ============================================================================== --- head/lib/libarchive/test/test_write_compress_program.c Sat Mar 7 03:04:06 2009 (r189480) +++ head/lib/libarchive/test/test_write_compress_program.c Sat Mar 7 03:16:16 2009 (r189481) @@ -38,14 +38,21 @@ DEFINE_TEST(test_write_compress_program) size_t used; int blocksize = 1024; int r; + const char *extprog; + if ((extprog = external_gzip_program(0)) == NULL) { + skipping("There is no gzip compression " + "program in this platform"); + return; + } /* Create a new archive in memory. */ /* Write it through an external "gzip" program. */ assert((a = archive_write_new()) != NULL); assertA(0 == archive_write_set_format_ustar(a)); - r = archive_write_set_compression_program(a, "gzip"); + r = archive_write_set_compression_program(a, extprog); if (r == ARCHIVE_FATAL) { - skipping("Write compression via external program unsupported on this platform"); + skipping("Write compression via external " + "program unsupported on this platform"); archive_write_finish(a); return; } @@ -84,7 +91,32 @@ DEFINE_TEST(test_write_compress_program) assertA(0 == archive_read_support_compression_all(a)); assertA(0 == archive_read_open_memory(a, buff, used)); - assertA(0 == archive_read_next_header(a, &ae)); + r = archive_read_next_header(a, &ae); + if (r != ARCHIVE_OK) { + if (strcmp(archive_error_string(a), + "Unrecognized archive format") == 0) { + skipping("This version of libarchive was compiled " + "without gzip support"); + assert(0 == archive_read_finish(a)); + /* + * Try using an external "gunzip","gzip -d" program + */ + if ((extprog = external_gzip_program(1)) == NULL) { + skipping("There is no gzip uncompression " + "program in this platform"); + return; + } + assert((a = archive_read_new()) != NULL); + assertEqualIntA(a, ARCHIVE_OK, + archive_read_support_compression_none(a)); + assertEqualIntA(a, ARCHIVE_OK, + archive_read_support_compression_program(a, extprog)); + assertA(0 == archive_read_support_format_all(a)); + assertA(0 == archive_read_open_memory(a, buff, used)); + r = archive_read_next_header(a, &ae); + } + } + assertA(0 == r); assert(1 == archive_entry_mtime(ae)); assert(0 == archive_entry_atime(ae)); From owner-svn-src-head@FreeBSD.ORG Sat Mar 7 03:30: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 9886C106566B; Sat, 7 Mar 2009 03:30:36 +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 84FE08FC17; Sat, 7 Mar 2009 03:30:36 +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 n273UaFM037554; Sat, 7 Mar 2009 03:30:36 GMT (envelope-from kientzle@svn.freebsd.org) Received: (from kientzle@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n273UaAN037553; Sat, 7 Mar 2009 03:30:36 GMT (envelope-from kientzle@svn.freebsd.org) Message-Id: <200903070330.n273UaAN037553@svn.freebsd.org> From: Tim Kientzle Date: Sat, 7 Mar 2009 03:30:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r189482 - head/lib/libarchive/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: Sat, 07 Mar 2009 03:30:37 -0000 Author: kientzle Date: Sat Mar 7 03:30:35 2009 New Revision: 189482 URL: http://svn.freebsd.org/changeset/base/189482 Log: Merge r335,653,676 from libarchive.googlecode.com: Instead of conditioning tests on HAVE_ZLIB, etc, just ask libarchive for the service and handle the failure coming back from libarchive. This gives us better test coverage of common client usage where clients simply try to use libarchive services and handle the errors coming back instead of trying to second-guess which libarchive services are compiled in. Modified: head/lib/libarchive/test/test.h head/lib/libarchive/test/test_compat_bzip2.c head/lib/libarchive/test/test_compat_gzip.c head/lib/libarchive/test/test_compat_zip.c head/lib/libarchive/test/test_fuzz.c head/lib/libarchive/test/test_read_format_cpio_bin_bz2.c head/lib/libarchive/test/test_read_format_cpio_bin_gz.c head/lib/libarchive/test/test_read_format_cpio_svr4_gzip.c head/lib/libarchive/test/test_read_format_gtar_gz.c head/lib/libarchive/test/test_read_format_iso_gz.c head/lib/libarchive/test/test_read_format_pax_bz2.c head/lib/libarchive/test/test_read_format_tbz.c head/lib/libarchive/test/test_read_format_tgz.c head/lib/libarchive/test/test_read_format_zip.c head/lib/libarchive/test/test_write_compress_program.c Modified: head/lib/libarchive/test/test.h ============================================================================== --- head/lib/libarchive/test/test.h Sat Mar 7 03:16:16 2009 (r189481) +++ head/lib/libarchive/test/test.h Sat Mar 7 03:30:35 2009 (r189482) @@ -189,3 +189,14 @@ int read_open_memory2(struct archive *, test_assert_equal_int(__FILE__, __LINE__, (v1), #v1, (v2), #v2, (a)) #define assertEqualStringA(a,v1,v2) \ test_assert_equal_string(__FILE__, __LINE__, (v1), #v1, (v2), #v2, (a)) + +/* + * A compression is not supported + * Use this define after archive_read_next_header() is called + */ +#define UnsupportedCompress(r, a) \ + (r != ARCHIVE_OK && \ + (strcmp(archive_error_string(a), \ + "Unrecognized archive format") == 0 && \ + archive_compression(a) == ARCHIVE_COMPRESSION_NONE)) + Modified: head/lib/libarchive/test/test_compat_bzip2.c ============================================================================== --- head/lib/libarchive/test/test_compat_bzip2.c Sat Mar 7 03:16:16 2009 (r189481) +++ head/lib/libarchive/test/test_compat_bzip2.c Sat Mar 7 03:30:35 2009 (r189482) @@ -55,6 +55,12 @@ compat_bzip2(const char *name) /* Read entries, match up names with list above. */ for (i = 0; i < 6; ++i) { r = archive_read_next_header(a, &ae); + if (UnsupportedCompress(r, a)) { + skipping("Skipping BZIP2 compression check: " + "This version of libarchive was compiled " + "without bzip2 support"); + goto finish; + } failure("Could not read file %d (%s) from %s", i, n[i], name); assertEqualIntA(a, ARCHIVE_OK, r); if (r != ARCHIVE_OK) { @@ -73,6 +79,7 @@ compat_bzip2(const char *name) assertEqualInt(archive_format(a), ARCHIVE_FORMAT_TAR_USTAR); assertEqualInt(ARCHIVE_OK, archive_read_close(a)); +finish: #if ARCHIVE_VERSION_NUMBER < 2000000 archive_read_finish(a); #else @@ -83,12 +90,8 @@ compat_bzip2(const char *name) DEFINE_TEST(test_compat_bzip2) { -#if HAVE_BZLIB_H compat_bzip2("test_compat_bzip2_1.tbz"); compat_bzip2("test_compat_bzip2_2.tbz"); -#else - skipping("Need bzlib"); -#endif } Modified: head/lib/libarchive/test/test_compat_gzip.c ============================================================================== --- head/lib/libarchive/test/test_compat_gzip.c Sat Mar 7 03:16:16 2009 (r189481) +++ head/lib/libarchive/test/test_compat_gzip.c Sat Mar 7 03:30:35 2009 (r189482) @@ -55,6 +55,12 @@ verify(const char *name) /* Read entries, match up names with list above. */ for (i = 0; i < 6; ++i) { r = archive_read_next_header(a, &ae); + if (UnsupportedCompress(r, a)) { + skipping("Skipping GZIP compression check: " + "This version of libarchive was compiled " + "without gzip support"); + goto finish; + } failure("Could not read file %d (%s) from %s", i, n[i], name); assertEqualIntA(a, ARCHIVE_OK, r); if (r != ARCHIVE_OK) { @@ -73,6 +79,7 @@ verify(const char *name) assertEqualInt(archive_format(a), ARCHIVE_FORMAT_TAR_USTAR); assertEqualInt(ARCHIVE_OK, archive_read_close(a)); +finish: #if ARCHIVE_VERSION_NUMBER < 2000000 archive_read_finish(a); #else @@ -83,7 +90,6 @@ verify(const char *name) DEFINE_TEST(test_compat_gzip) { -#if HAVE_ZLIB_H /* This sample has been 'split', each piece compressed separately, * then concatenated. Gunzip will emit the concatenated result. */ /* Not supported in libarchive 2.6 and earlier */ @@ -91,9 +97,6 @@ DEFINE_TEST(test_compat_gzip) /* This sample has been compressed as a single stream, but then * some unrelated garbage text has been appended to the end. */ verify("test_compat_gzip_2.tgz"); -#else - skipping("Need zlib"); -#endif } Modified: head/lib/libarchive/test/test_compat_zip.c ============================================================================== --- head/lib/libarchive/test/test_compat_zip.c Sat Mar 7 03:16:16 2009 (r189481) +++ head/lib/libarchive/test/test_compat_zip.c Sat Mar 7 03:30:35 2009 (r189482) @@ -32,6 +32,7 @@ test_compat_zip_1(void) char name[] = "test_compat_zip_1.zip"; struct archive_entry *ae; struct archive *a; + int r; assert((a = archive_read_new()) != NULL); assertEqualIntA(a, ARCHIVE_OK, archive_read_support_compression_all(a)); @@ -44,7 +45,16 @@ test_compat_zip_1(void) assertEqualString("META-INF/MANIFEST.MF", archive_entry_pathname(ae)); /* Read second entry. */ - assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae)); + r = archive_read_next_header(a, &ae); + if (r != ARCHIVE_OK) { + if (strcmp(archive_error_string(a), + "libarchive compiled without deflate support (no libz)") == 0) { + skipping("Skipping ZIP compression check: %s", + archive_error_string(a)); + goto finish; + } + } + assertEqualIntA(a, ARCHIVE_OK, r); assertEqualString("tmp.class", archive_entry_pathname(ae)); assertEqualIntA(a, ARCHIVE_EOF, archive_read_next_header(a, &ae)); @@ -53,6 +63,7 @@ test_compat_zip_1(void) assertEqualInt(archive_format(a), ARCHIVE_FORMAT_ZIP); assertEqualInt(ARCHIVE_OK, archive_read_close(a)); +finish: #if ARCHIVE_VERSION_NUMBER < 2000000 archive_read_finish(a); #else @@ -63,11 +74,7 @@ test_compat_zip_1(void) DEFINE_TEST(test_compat_zip) { -#if HAVE_ZLIB_H test_compat_zip_1(); -#else - skipping("Need zlib"); -#endif } Modified: head/lib/libarchive/test/test_fuzz.c ============================================================================== --- head/lib/libarchive/test/test_fuzz.c Sat Mar 7 03:16:16 2009 (r189481) +++ head/lib/libarchive/test/test_fuzz.c Sat Mar 7 03:30:35 2009 (r189482) @@ -51,19 +51,13 @@ __FBSDID("$FreeBSD$"); static const char * files[] = { "test_fuzz_1.iso", -#if HAVE_BZLIB_H "test_compat_bzip2_1.tbz", -#endif "test_compat_gtar_1.tar", "test_compat_tar_hardlink_1.tar", -#if HAVE_ZLIB_H "test_compat_zip_1.zip", -#endif "test_read_format_gtar_sparse_1_17_posix10_modified.tar", "test_read_format_tar_empty_filename.tar", -#if HAVE_ZLIB_H "test_read_format_zip.zip", -#endif NULL }; @@ -72,9 +66,11 @@ DEFINE_TEST(test_fuzz) const char **filep; for (filep = files; *filep != NULL; ++filep) { + struct archive_entry *ae; + struct archive *a; char *rawimage, *image; size_t size; - int i; + int i, r; extract_reference_file(*filep); rawimage = slurpfile(&size, *filep); @@ -83,9 +79,37 @@ DEFINE_TEST(test_fuzz) assert(image != NULL); srand(time(NULL)); + assert((a = archive_read_new()) != NULL); + assert(0 == archive_read_support_compression_all(a)); + assert(0 == archive_read_support_format_all(a)); + assert(0 == archive_read_open_memory(a, rawimage, size)); + r = archive_read_next_header(a, &ae); + if (UnsupportedCompress(r, a)) { + skipping("Skipping GZIP/BZIP2 compression check: " + "This version of libarchive was compiled " + "without gzip/bzip2 support"); + assert(0 == archive_read_close(a)); + assert(0 == archive_read_finish(a)); + continue; + } + assert(0 == r); + if (r == ARCHIVE_OK) { + char buff[20]; + + r = archive_read_data(a, buff, 19); + if (r < ARCHIVE_OK && strcmp(archive_error_string(a), + "libarchive compiled without deflate support (no libz)") == 0) { + skipping("Skipping ZIP compression check: %s", + archive_error_string(a)); + assert(0 == archive_read_close(a)); + assert(0 == archive_read_finish(a)); + continue; + } + } + assert(0 == archive_read_close(a)); + assert(0 == archive_read_finish(a)); + for (i = 0; i < 100; ++i) { - struct archive_entry *ae; - struct archive *a; int j, fd, numbytes; /* Fuzz < 1% of the bytes in the archive. */ Modified: head/lib/libarchive/test/test_read_format_cpio_bin_bz2.c ============================================================================== --- head/lib/libarchive/test/test_read_format_cpio_bin_bz2.c Sat Mar 7 03:16:16 2009 (r189481) +++ head/lib/libarchive/test/test_read_format_cpio_bin_bz2.c Sat Mar 7 03:30:35 2009 (r189482) @@ -34,27 +34,33 @@ static unsigned char archive[] = { DEFINE_TEST(test_read_format_cpio_bin_bz2) { -#if HAVE_BZLIB_H struct archive_entry *ae; struct archive *a; + int r; + assert((a = archive_read_new()) != NULL); assertEqualIntA(a, ARCHIVE_OK, archive_read_support_compression_all(a)); assertEqualIntA(a, ARCHIVE_OK, archive_read_support_format_all(a)); assertEqualIntA(a, ARCHIVE_OK, archive_read_open_memory(a, archive, sizeof(archive))); - assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae)); + r = archive_read_next_header(a, &ae); + if (UnsupportedCompress(r, a)) { + skipping("Skipping BZ2 compression check: " + "This version of libarchive was compiled " + "without bz2 support"); + goto finish; + } + assertEqualIntA(a, ARCHIVE_OK, r); assert(archive_compression(a) == ARCHIVE_COMPRESSION_BZIP2); assert(archive_format(a) == ARCHIVE_FORMAT_CPIO_BIN_LE); assert(0 == archive_read_close(a)); +finish: #if ARCHIVE_VERSION_NUMBER < 2000000 archive_read_finish(a); #else assert(0 == archive_read_finish(a)); #endif -#else - skipping("Need bzlib"); -#endif } Modified: head/lib/libarchive/test/test_read_format_cpio_bin_gz.c ============================================================================== --- head/lib/libarchive/test/test_read_format_cpio_bin_gz.c Sat Mar 7 03:16:16 2009 (r189481) +++ head/lib/libarchive/test/test_read_format_cpio_bin_gz.c Sat Mar 7 03:30:35 2009 (r189482) @@ -33,25 +33,31 @@ static unsigned char archive[] = { DEFINE_TEST(test_read_format_cpio_bin_gz) { -#if HAVE_ZLIB_H struct archive_entry *ae; struct archive *a; + int r; + assert((a = archive_read_new()) != NULL); assert(0 == archive_read_support_compression_all(a)); assert(0 == archive_read_support_format_all(a)); assert(0 == archive_read_open_memory(a, archive, sizeof(archive))); - assert(0 == archive_read_next_header(a, &ae)); + r = archive_read_next_header(a, &ae); + if (UnsupportedCompress(r, a)) { + skipping("Skipping GZIP compression check: " + "This version of libarchive was compiled " + "without gzip support"); + goto finish; + } + assert(0 == r); assert(archive_compression(a) == ARCHIVE_COMPRESSION_GZIP); assert(archive_format(a) == ARCHIVE_FORMAT_CPIO_BIN_LE); assert(0 == archive_read_close(a)); +finish: #if ARCHIVE_VERSION_NUMBER < 2000000 archive_read_finish(a); #else assert(0 == archive_read_finish(a)); #endif -#else - skipping("Need zlib"); -#endif } Modified: head/lib/libarchive/test/test_read_format_cpio_svr4_gzip.c ============================================================================== --- head/lib/libarchive/test/test_read_format_cpio_svr4_gzip.c Sat Mar 7 03:16:16 2009 (r189481) +++ head/lib/libarchive/test/test_read_format_cpio_svr4_gzip.c Sat Mar 7 03:30:35 2009 (r189482) @@ -34,25 +34,31 @@ static unsigned char archive[] = { DEFINE_TEST(test_read_format_cpio_svr4_gzip) { -#if HAVE_ZLIB_H struct archive_entry *ae; struct archive *a; + int r; + assert((a = archive_read_new()) != NULL); assert(0 == archive_read_support_compression_all(a)); assert(0 == archive_read_support_format_all(a)); assert(0 == archive_read_open_memory(a, archive, sizeof(archive))); - assert(0 == archive_read_next_header(a, &ae)); + r = archive_read_next_header(a, &ae); + if (UnsupportedCompress(r, a)) { + skipping("Skipping GZIP compression check: " + "This version of libarchive was compiled " + "without gzip support"); + goto finish; + } + assert(0 == r); assert(archive_compression(a) == ARCHIVE_COMPRESSION_GZIP); assert(archive_format(a) == ARCHIVE_FORMAT_CPIO_SVR4_NOCRC); assert(0 == archive_read_close(a)); +finish: #if ARCHIVE_VERSION_NUMBER < 2000000 archive_read_finish(a); #else assert(0 == archive_read_finish(a)); #endif -#else - skipping("Need zlib"); -#endif } Modified: head/lib/libarchive/test/test_read_format_gtar_gz.c ============================================================================== --- head/lib/libarchive/test/test_read_format_gtar_gz.c Sat Mar 7 03:16:16 2009 (r189481) +++ head/lib/libarchive/test/test_read_format_gtar_gz.c Sat Mar 7 03:30:35 2009 (r189482) @@ -34,25 +34,31 @@ static unsigned char archive[] = { DEFINE_TEST(test_read_format_gtar_gz) { -#if HAVE_ZLIB_H struct archive_entry *ae; struct archive *a; + int r; + assert((a = archive_read_new()) != NULL); assert(0 == archive_read_support_compression_all(a)); assert(0 == archive_read_support_format_all(a)); assert(0 == archive_read_open_memory(a, archive, sizeof(archive))); - assert(0 == archive_read_next_header(a, &ae)); + r = archive_read_next_header(a, &ae); + if (UnsupportedCompress(r, a)) { + skipping("Skipping GZIP compression check: " + "This version of libarchive was compiled " + "without gzip support"); + goto finish; + } + assert(0 == r); assert(archive_compression(a) == ARCHIVE_COMPRESSION_GZIP); assert(archive_format(a) == ARCHIVE_FORMAT_TAR_GNUTAR); assert(0 == archive_read_close(a)); +finish: #if ARCHIVE_VERSION_NUMBER < 2000000 archive_read_finish(a); #else assert(0 == archive_read_finish(a)); #endif -#else - skipping("Need zlib"); -#endif } Modified: head/lib/libarchive/test/test_read_format_iso_gz.c ============================================================================== --- head/lib/libarchive/test/test_read_format_iso_gz.c Sat Mar 7 03:16:16 2009 (r189481) +++ head/lib/libarchive/test/test_read_format_iso_gz.c Sat Mar 7 03:30:35 2009 (r189482) @@ -53,9 +53,10 @@ static unsigned char archive[] = { DEFINE_TEST(test_read_format_iso_gz) { -#if HAVE_ZLIB_H struct archive_entry *ae; struct archive *a; + int r; + assert((a = archive_read_new()) != NULL); assertEqualIntA(a, ARCHIVE_OK, archive_read_support_compression_all(a)); @@ -63,18 +64,23 @@ DEFINE_TEST(test_read_format_iso_gz) archive_read_support_format_all(a)); assertEqualIntA(a, ARCHIVE_OK, archive_read_open_memory(a, archive, sizeof(archive))); - assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae)); + r = archive_read_next_header(a, &ae); + if (UnsupportedCompress(r, a)) { + skipping("Skipping GZIP compression check: " + "This version of libarchive was compiled " + "without gzip support"); + goto finish; + } + assertEqualIntA(a, ARCHIVE_OK, r); assertEqualInt(archive_compression(a), ARCHIVE_COMPRESSION_GZIP); assertEqualInt(archive_format(a), ARCHIVE_FORMAT_ISO9660); assertEqualIntA(a, ARCHIVE_OK, archive_read_close(a)); +finish: #if ARCHIVE_VERSION_NUMBER < 2000000 archive_read_finish(a); #else assertEqualInt(ARCHIVE_OK, archive_read_finish(a)); #endif -#else - skipping("Need zlib"); -#endif } Modified: head/lib/libarchive/test/test_read_format_pax_bz2.c ============================================================================== --- head/lib/libarchive/test/test_read_format_pax_bz2.c Sat Mar 7 03:16:16 2009 (r189481) +++ head/lib/libarchive/test/test_read_format_pax_bz2.c Sat Mar 7 03:30:35 2009 (r189482) @@ -42,25 +42,31 @@ static unsigned char archive[] = { DEFINE_TEST(test_read_format_pax_bz2) { -#if HAVE_BZLIB_H struct archive_entry *ae; struct archive *a; + int r; + assert((a = archive_read_new()) != NULL); assert(0 == archive_read_support_compression_all(a)); assert(0 == archive_read_support_format_all(a)); assert(0 == archive_read_open_memory(a, archive, sizeof(archive))); - assert(0 == archive_read_next_header(a, &ae)); + r = archive_read_next_header(a, &ae); + if (UnsupportedCompress(r, a)) { + skipping("Skipping BZIP2 compression check: " + "This version of libarchive was compiled " + "without bzip2 support"); + goto finish; + } + assert(0 == r); assert(archive_compression(a) == ARCHIVE_COMPRESSION_BZIP2); assert(archive_format(a) == ARCHIVE_FORMAT_TAR_PAX_INTERCHANGE); assert(0 == archive_read_close(a)); +finish: #if ARCHIVE_VERSION_NUMBER < 2000000 archive_read_finish(a); #else assert(0 == archive_read_finish(a)); #endif -#else - skipping("Need bzlib"); -#endif } Modified: head/lib/libarchive/test/test_read_format_tbz.c ============================================================================== --- head/lib/libarchive/test/test_read_format_tbz.c Sat Mar 7 03:16:16 2009 (r189481) +++ head/lib/libarchive/test/test_read_format_tbz.c Sat Mar 7 03:30:35 2009 (r189482) @@ -35,25 +35,31 @@ static unsigned char archive[] = { DEFINE_TEST(test_read_format_tbz) { -#if HAVE_BZLIB_H struct archive_entry *ae; struct archive *a; + int r; + assert((a = archive_read_new()) != NULL); assert(0 == archive_read_support_compression_all(a)); assert(0 == archive_read_support_format_all(a)); assert(0 == archive_read_open_memory(a, archive, sizeof(archive))); - assert(0 == archive_read_next_header(a, &ae)); + r = archive_read_next_header(a, &ae); + if (UnsupportedCompress(r, a)) { + skipping("Skipping BZIP2 compression check: " + "This version of libarchive was compiled " + "without bzip2 support"); + goto finish; + } + assert(0 == r); assert(archive_compression(a) == ARCHIVE_COMPRESSION_BZIP2); assert(archive_format(a) == ARCHIVE_FORMAT_TAR_USTAR); assert(0 == archive_read_close(a)); +finish: #if ARCHIVE_VERSION_NUMBER < 2000000 archive_read_finish(a); #else assert(0 == archive_read_finish(a)); #endif -#else - skipping("Need bzlib"); -#endif } Modified: head/lib/libarchive/test/test_read_format_tgz.c ============================================================================== --- head/lib/libarchive/test/test_read_format_tgz.c Sat Mar 7 03:16:16 2009 (r189481) +++ head/lib/libarchive/test/test_read_format_tgz.c Sat Mar 7 03:30:35 2009 (r189482) @@ -34,25 +34,31 @@ static unsigned char archive[] = { DEFINE_TEST(test_read_format_tgz) { -#if HAVE_ZLIB_H struct archive_entry *ae; struct archive *a; + int r; + assert((a = archive_read_new()) != NULL); assert(0 == archive_read_support_compression_all(a)); assert(0 == archive_read_support_format_all(a)); assert(0 == archive_read_open_memory(a, archive, sizeof(archive))); - assert(0 == archive_read_next_header(a, &ae)); + r = archive_read_next_header(a, &ae); + if (UnsupportedCompress(r, a)) { + skipping("Skipping GZIP compression check: " + "This version of libarchive was compiled " + "without gzip support"); + goto finish; + } + assert(0 == r); assert(archive_compression(a) == ARCHIVE_COMPRESSION_GZIP); assert(archive_format(a) == ARCHIVE_FORMAT_TAR_USTAR); assert(0 == archive_read_close(a)); +finish: #if ARCHIVE_VERSION_NUMBER < 2000000 archive_read_finish(a); #else assert(0 == archive_read_finish(a)); #endif -#else - skipping("Need zlib"); -#endif } Modified: head/lib/libarchive/test/test_read_format_zip.c ============================================================================== --- head/lib/libarchive/test/test_read_format_zip.c Sat Mar 7 03:16:16 2009 (r189481) +++ head/lib/libarchive/test/test_read_format_zip.c Sat Mar 7 03:30:35 2009 (r189482) @@ -33,7 +33,6 @@ __FBSDID("$FreeBSD$"); DEFINE_TEST(test_read_format_zip) { -#if HAVE_ZLIB_H const char *refname = "test_read_format_zip.zip"; struct archive_entry *ae; struct archive *a; @@ -41,6 +40,7 @@ DEFINE_TEST(test_read_format_zip) const void *pv; size_t s; off_t o; + int r; extract_reference_file(refname); assert((a = archive_read_new()) != NULL); @@ -59,7 +59,16 @@ DEFINE_TEST(test_read_format_zip) assertEqualInt(1179604289, archive_entry_mtime(ae)); assertEqualInt(18, archive_entry_size(ae)); failure("archive_read_data() returns number of bytes read"); - assertEqualInt(18, archive_read_data(a, buff, 19)); + r = archive_read_data(a, buff, 19); + if (r < ARCHIVE_OK) { + if (strcmp(archive_error_string(a), + "libarchive compiled without deflate support (no libz)") == 0) { + skipping("Skipping ZIP compression check: %s", + archive_error_string(a)); + goto finish; + } + } + assertEqualInt(18, r); assert(0 == memcmp(buff, "hello\nhello\nhello\n", 18)); assertA(0 == archive_read_next_header(a, &ae)); assertEqualString("file2", archive_entry_pathname(ae)); @@ -72,15 +81,12 @@ DEFINE_TEST(test_read_format_zip) assertA(archive_compression(a) == ARCHIVE_COMPRESSION_NONE); assertA(archive_format(a) == ARCHIVE_FORMAT_ZIP); assert(0 == archive_read_close(a)); - +finish: #if ARCHIVE_VERSION_NUMBER < 2000000 archive_read_finish(a); #else assert(0 == archive_read_finish(a)); #endif -#else - skipping("Need zlib"); -#endif } Modified: head/lib/libarchive/test/test_write_compress_program.c ============================================================================== --- head/lib/libarchive/test/test_write_compress_program.c Sat Mar 7 03:16:16 2009 (r189481) +++ head/lib/libarchive/test/test_write_compress_program.c Sat Mar 7 03:30:35 2009 (r189482) @@ -92,29 +92,26 @@ DEFINE_TEST(test_write_compress_program) assertA(0 == archive_read_open_memory(a, buff, used)); r = archive_read_next_header(a, &ae); - if (r != ARCHIVE_OK) { - if (strcmp(archive_error_string(a), - "Unrecognized archive format") == 0) { - skipping("This version of libarchive was compiled " - "without gzip support"); - assert(0 == archive_read_finish(a)); - /* - * Try using an external "gunzip","gzip -d" program - */ - if ((extprog = external_gzip_program(1)) == NULL) { - skipping("There is no gzip uncompression " - "program in this platform"); - return; - } - assert((a = archive_read_new()) != NULL); - assertEqualIntA(a, ARCHIVE_OK, - archive_read_support_compression_none(a)); - assertEqualIntA(a, ARCHIVE_OK, - archive_read_support_compression_program(a, extprog)); - assertA(0 == archive_read_support_format_all(a)); - assertA(0 == archive_read_open_memory(a, buff, used)); - r = archive_read_next_header(a, &ae); + if (UnsupportedCompress(r, a)) { + skipping("This version of libarchive was compiled " + "without gzip support"); + assert(0 == archive_read_finish(a)); + /* + * Try using an external "gunzip","gzip -d" program + */ + if ((extprog = external_gzip_program(1)) == NULL) { + skipping("There is no gzip uncompression " + "program in this platform"); + return; } + assert((a = archive_read_new()) != NULL); + assertEqualIntA(a, ARCHIVE_OK, + archive_read_support_compression_none(a)); + assertEqualIntA(a, ARCHIVE_OK, + archive_read_support_compression_program(a, extprog)); + assertA(0 == archive_read_support_format_all(a)); + assertA(0 == archive_read_open_memory(a, buff, used)); + r = archive_read_next_header(a, &ae); } assertA(0 == r); From owner-svn-src-head@FreeBSD.ORG Sat Mar 7 03:34: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 031D6106564A; Sat, 7 Mar 2009 03:34:35 +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 E53888FC17; Sat, 7 Mar 2009 03:34:34 +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 n273YYuM037682; Sat, 7 Mar 2009 03:34:34 GMT (envelope-from kientzle@svn.freebsd.org) Received: (from kientzle@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n273YYDa037681; Sat, 7 Mar 2009 03:34:34 GMT (envelope-from kientzle@svn.freebsd.org) Message-Id: <200903070334.n273YYDa037681@svn.freebsd.org> From: Tim Kientzle Date: Sat, 7 Mar 2009 03:34: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: r189483 - head/lib/libarchive/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: Sat, 07 Mar 2009 03:34:35 -0000 Author: kientzle Date: Sat Mar 7 03:34:34 2009 New Revision: 189483 URL: http://svn.freebsd.org/changeset/base/189483 Log: Merge r596,r690 from libarchive.googlecode.com: Minor style and compile warning fixes for test_read_pax_truncated.c. Modified: head/lib/libarchive/test/test_read_pax_truncated.c Modified: head/lib/libarchive/test/test_read_pax_truncated.c ============================================================================== --- head/lib/libarchive/test/test_read_pax_truncated.c Sat Mar 7 03:30:35 2009 (r189482) +++ head/lib/libarchive/test/test_read_pax_truncated.c Sat Mar 7 03:34:34 2009 (r189483) @@ -29,9 +29,8 @@ DEFINE_TEST(test_read_pax_truncated) { struct archive_entry *ae; struct archive *a; - ssize_t used, i; - size_t buff_size = 1000000; - ssize_t filedata_size = 100000; + size_t used, i, buff_size = 1000000; + size_t filedata_size = 100000; char *buff = malloc(buff_size); char *buff2 = malloc(buff_size); char *filedata = malloc(filedata_size); @@ -40,7 +39,8 @@ DEFINE_TEST(test_read_pax_truncated) assert((a = archive_write_new()) != NULL); assertA(0 == archive_write_set_format_pax(a)); assertA(0 == archive_write_set_compression_none(a)); - assertA(0 == archive_write_open_memory(a, buff, buff_size, &used)); + assertEqualIntA(a, ARCHIVE_OK, + archive_write_open_memory(a, buff, buff_size, &used)); /* * Write a file to it. @@ -56,7 +56,8 @@ DEFINE_TEST(test_read_pax_truncated) archive_entry_set_size(ae, filedata_size); assertA(0 == archive_write_header(a, ae)); archive_entry_free(ae); - assertA(filedata_size == archive_write_data(a, filedata, filedata_size)); + assertA((ssize_t)filedata_size + == archive_write_data(a, filedata, filedata_size)); /* Close out the archive. */ assertA(0 == archive_write_close(a)); From owner-svn-src-head@FreeBSD.ORG Sat Mar 7 03:41:29 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 98F92106566B; Sat, 7 Mar 2009 03:41:29 +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 86D698FC0A; Sat, 7 Mar 2009 03:41:29 +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 n273fT0S037858; Sat, 7 Mar 2009 03:41:29 GMT (envelope-from kientzle@svn.freebsd.org) Received: (from kientzle@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n273fTIq037857; Sat, 7 Mar 2009 03:41:29 GMT (envelope-from kientzle@svn.freebsd.org) Message-Id: <200903070341.n273fTIq037857@svn.freebsd.org> From: Tim Kientzle Date: Sat, 7 Mar 2009 03:41: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: r189484 - head/lib/libarchive/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: Sat, 07 Mar 2009 03:41:30 -0000 Author: kientzle Date: Sat Mar 7 03:41:29 2009 New Revision: 189484 URL: http://svn.freebsd.org/changeset/base/189484 Log: Merge r348 from libarchive.googlecode.com: Suppress testing invalid conversions if there aren't any. In particular, Cygwin's "C" locale has no invalid inputs for wctomb(). Modified: head/lib/libarchive/test/test_pax_filename_encoding.c Modified: head/lib/libarchive/test/test_pax_filename_encoding.c ============================================================================== --- head/lib/libarchive/test/test_pax_filename_encoding.c Sat Mar 7 03:34:34 2009 (r189483) +++ head/lib/libarchive/test/test_pax_filename_encoding.c Sat Mar 7 03:41:29 2009 (r189484) @@ -217,6 +217,13 @@ DEFINE_TEST(test_pax_filename_encoding_3 return; } + /* If wctomb is broken, warn and return. */ + if (wctomb(buff, 0x1234) > 0) { + skipping("Cannot test conversion failures because \"C\" " + "locale on this system has no invalid characters."); + return; + } + assert((a = archive_write_new()) != NULL); assertEqualIntA(a, 0, archive_write_set_format_pax(a)); assertEqualIntA(a, 0, archive_write_set_compression_none(a)); From owner-svn-src-head@FreeBSD.ORG Sat Mar 7 07:19:25 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 7CC59106564A; Sat, 7 Mar 2009 07:19:25 +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 6B2CE8FC17; Sat, 7 Mar 2009 07:19:25 +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 n277JP4I042001; Sat, 7 Mar 2009 07:19:25 GMT (envelope-from kientzle@svn.freebsd.org) Received: (from kientzle@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n277JPSN042000; Sat, 7 Mar 2009 07:19:25 GMT (envelope-from kientzle@svn.freebsd.org) Message-Id: <200903070719.n277JPSN042000@svn.freebsd.org> From: Tim Kientzle Date: Sat, 7 Mar 2009 07:19:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r189486 - head/lib/libarchive/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: Sat, 07 Mar 2009 07:19:25 -0000 Author: kientzle Date: Sat Mar 7 07:19:25 2009 New Revision: 189486 URL: http://svn.freebsd.org/changeset/base/189486 Log: Fix spelling. Modified: head/lib/libarchive/test/main.c Modified: head/lib/libarchive/test/main.c ============================================================================== --- head/lib/libarchive/test/main.c Sat Mar 7 05:39:55 2009 (r189485) +++ head/lib/libarchive/test/main.c Sat Mar 7 07:19:25 2009 (r189486) @@ -96,7 +96,7 @@ static const char *refdir; #ifdef _WIN32 static void -invalid_paramter_handler(const wchar_t * expression, +invalid_parameter_handler(const wchar_t * expression, const wchar_t * function, const wchar_t * file, unsigned int line, uintptr_t pReserved) { @@ -994,7 +994,7 @@ int main(int argc, char **argv) #ifdef _WIN32 /* To stop to run the default invalid parameter handler. */ - _set_invalid_parameter_handler(invalid_paramter_handler); + _set_invalid_parameter_handler(invalid_parameter_handler); /* for open() to a binary mode. */ _set_fmode(_O_BINARY); /* Disable annoying assertion message box. */ From owner-svn-src-head@FreeBSD.ORG Sat Mar 7 07:23: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 1988D106564A; Sat, 7 Mar 2009 07:23:05 +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 F12CB8FC14; Sat, 7 Mar 2009 07:23:04 +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 n277N4x7042124; Sat, 7 Mar 2009 07:23:04 GMT (envelope-from kientzle@svn.freebsd.org) Received: (from kientzle@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n277N4Cf042123; Sat, 7 Mar 2009 07:23:04 GMT (envelope-from kientzle@svn.freebsd.org) Message-Id: <200903070723.n277N4Cf042123@svn.freebsd.org> From: Tim Kientzle Date: Sat, 7 Mar 2009 07:23: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: r189487 - head/lib/libarchive/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: Sat, 07 Mar 2009 07:23:05 -0000 Author: kientzle Date: Sat Mar 7 07:23:04 2009 New Revision: 189487 URL: http://svn.freebsd.org/changeset/base/189487 Log: Merge r718 from libarchive.googlecode.com: Some additional tests of restoring files to disk with unusual characters, specifically to exercise Windows issues. Modified: head/lib/libarchive/test/test_write_disk.c Modified: head/lib/libarchive/test/test_write_disk.c ============================================================================== --- head/lib/libarchive/test/test_write_disk.c Sat Mar 7 07:19:25 2009 (r189486) +++ head/lib/libarchive/test/test_write_disk.c Sat Mar 7 07:23:04 2009 (r189487) @@ -218,6 +218,46 @@ static void create_reg_file4(struct arch failure(msg); assertEqualInt(st.st_size, sizeof(data)); } + +#ifdef _WIN32 +static void create_reg_file_win(struct archive_entry *ae, const char *msg) +{ + static const char data[]="abcdefghijklmnopqrstuvwxyz"; + struct archive *ad; + struct stat st; + char *p, *fname; + size_t l; + + /* Write the entry to disk. */ + assert((ad = archive_write_disk_new()) != NULL); + archive_write_disk_set_options(ad, ARCHIVE_EXTRACT_TIME); + failure("%s", msg); + archive_entry_set_size(ae, sizeof(data)); + archive_entry_set_mtime(ae, 123456789, 0); + assertEqualIntA(ad, 0, archive_write_header(ad, ae)); + assertEqualInt(sizeof(data), archive_write_data(ad, data, sizeof(data))); + assertEqualIntA(ad, 0, archive_write_finish_entry(ad)); +#if ARCHIVE_VERSION_NUMBER < 2000000 + archive_write_finish(ad); +#else + assertEqualInt(0, archive_write_finish(ad)); +#endif + /* Test the entries on disk. */ + l = strlen(archive_entry_pathname(ae)); + fname = malloc(l + 1); + assert(NULL != fname); + strcpy(fname, archive_entry_pathname(ae)); + /* Replace unusable characters in Windows to '_' */ + for (p = fname; *p != '\0'; p++) + if (*p == ':' || *p == '*' || *p == '?' || + *p == '"' || *p == '<' || *p == '>' || *p == '|') + *p = '_'; + assert(0 == stat(fname, &st)); + failure("st.st_mode=%o archive_entry_mode(ae)=%o", + st.st_mode, archive_entry_mode(ae)); + assertEqualInt(st.st_size, sizeof(data)); +} +#endif /* _WIN32 */ #endif DEFINE_TEST(test_write_disk) @@ -285,5 +325,23 @@ DEFINE_TEST(test_write_disk) archive_entry_set_mode(ae, S_IFREG | 0744); create(ae, "Test creating a file over an existing dir."); archive_entry_free(ae); + +#ifdef _WIN32 + /* A file with unusable characters in its file name. */ + assert((ae = archive_entry_new()) != NULL); + archive_entry_copy_pathname(ae, "f:i*l?e\"fl|e"); + archive_entry_set_mode(ae, S_IFREG | 0755); + create_reg_file_win(ae, "Test creating a regular file" + " with unusable characters in its file name"); + archive_entry_free(ae); + + /* A file with unusable characters in its directory name. */ + assert((ae = archive_entry_new()) != NULL); + archive_entry_copy_pathname(ae, "d:i*r?e\"co|ry/file1"); + archive_entry_set_mode(ae, S_IFREG | 0755); + create_reg_file_win(ae, "Test creating a regular file" + " with unusable characters in its file name"); + archive_entry_free(ae); +#endif /* _WIN32 */ #endif } From owner-svn-src-head@FreeBSD.ORG Sat Mar 7 07:26: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 0F40F10656C2; Sat, 7 Mar 2009 07:26:23 +0000 (UTC) (envelope-from weongyo@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id EF9F38FC14; Sat, 7 Mar 2009 07:26:22 +0000 (UTC) (envelope-from weongyo@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 n277QMkA042218; Sat, 7 Mar 2009 07:26:22 GMT (envelope-from weongyo@svn.freebsd.org) Received: (from weongyo@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n277QMH2042213; Sat, 7 Mar 2009 07:26:22 GMT (envelope-from weongyo@svn.freebsd.org) Message-Id: <200903070726.n277QMH2042213@svn.freebsd.org> From: Weongyo Jeong Date: Sat, 7 Mar 2009 07:26: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: r189488 - in head/sys: compat/ndis dev/if_ndis modules/if_ndis modules/ndis 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, 07 Mar 2009 07:26:23 -0000 Author: weongyo Date: Sat Mar 7 07:26:22 2009 New Revision: 189488 URL: http://svn.freebsd.org/changeset/base/189488 Log: o port NDIS USB support from USB1 to the new usb(USB2). o implement URB_FUNCTION_ABORT_PIPE handling. o remove unused code related with canceling the timer list for USB drivers. o whitespace cleanup and style(9) Obtained from: hps's original patch Modified: head/sys/compat/ndis/hal_var.h head/sys/compat/ndis/kern_ndis.c head/sys/compat/ndis/kern_windrv.c head/sys/compat/ndis/ndis_var.h head/sys/compat/ndis/ntoskrnl_var.h head/sys/compat/ndis/pe_var.h head/sys/compat/ndis/resource_var.h head/sys/compat/ndis/subr_hal.c head/sys/compat/ndis/subr_ndis.c head/sys/compat/ndis/subr_ntoskrnl.c head/sys/compat/ndis/subr_pe.c head/sys/compat/ndis/subr_usbd.c head/sys/compat/ndis/usbd_var.h head/sys/dev/if_ndis/if_ndis.c head/sys/dev/if_ndis/if_ndis_pccard.c head/sys/dev/if_ndis/if_ndis_pci.c head/sys/dev/if_ndis/if_ndis_usb.c head/sys/dev/if_ndis/if_ndisvar.h head/sys/modules/if_ndis/Makefile head/sys/modules/ndis/Makefile Modified: head/sys/compat/ndis/hal_var.h ============================================================================== --- head/sys/compat/ndis/hal_var.h Sat Mar 7 07:23:04 2009 (r189487) +++ head/sys/compat/ndis/hal_var.h Sat Mar 7 07:26:22 2009 (r189488) @@ -48,6 +48,7 @@ extern image_patch_table hal_functbl[]; __BEGIN_DECLS extern int hal_libinit(void); extern int hal_libfini(void); +extern struct mtx *hal_getdisplock(void); extern uint8_t KfAcquireSpinLock(kspin_lock *); extern void KfReleaseSpinLock(kspin_lock *, uint8_t); extern uint8_t KfRaiseIrql(uint8_t); Modified: head/sys/compat/ndis/kern_ndis.c ============================================================================== --- head/sys/compat/ndis/kern_ndis.c Sat Mar 7 07:23:04 2009 (r189487) +++ head/sys/compat/ndis/kern_ndis.c Sat Mar 7 07:26:22 2009 (r189488) @@ -65,8 +65,8 @@ __FBSDID("$FreeBSD$"); #include #include -#include -#include +#include +#include #include #include @@ -322,7 +322,7 @@ ndis_create_sysctls(arg) #else TAILQ_FOREACH(e, device_get_sysctl_ctx(sc->ndis_dev), link) { #endif - oidp = e->entry; + oidp = e->entry; if (strcasecmp(oidp->oid_name, vals->nc_cfgkey) == 0) break; oidp = NULL; @@ -571,7 +571,7 @@ ndis_convert_res(arg) struct resource_list brl_rev; struct resource_list_entry *n; #endif - int error = 0; + int error = 0; sc = arg; block = sc->ndis_block; @@ -1231,7 +1231,7 @@ ndis_init_nic(arg) { struct ndis_softc *sc; ndis_miniport_block *block; - ndis_init_handler initfunc; + ndis_init_handler initfunc; ndis_status status, openstatus = 0; ndis_medium mediumarray[NdisMediumMax]; uint32_t chosenmedium, i; @@ -1250,8 +1250,8 @@ ndis_init_nic(arg) for (i = 0; i < NdisMediumMax; i++) mediumarray[i] = i; - status = MSCALL6(initfunc, &openstatus, &chosenmedium, - mediumarray, NdisMediumMax, block, block); + status = MSCALL6(initfunc, &openstatus, &chosenmedium, + mediumarray, NdisMediumMax, block, block); /* * If the init fails, blow away the other exported routines @@ -1398,7 +1398,7 @@ NdisAddDevice(drv, pdo) sc = device_get_softc(pdo->do_devext); - if (sc->ndis_iftype == PCMCIABus || sc->ndis_iftype == PCIBus) { + if (sc->ndis_iftype == PCMCIABus || sc->ndis_iftype == PCIBus) { error = bus_setup_intr(sc->ndis_dev, sc->ndis_irq, INTR_TYPE_NET | INTR_MPSAFE, NULL, ntoskrnl_intr, NULL, &sc->ndis_intrhand); @@ -1431,7 +1431,7 @@ NdisAddDevice(drv, pdo) * Stash pointers to the miniport block and miniport * characteristics info in the if_ndis softc so the * UNIX wrapper driver can get to them later. - */ + */ sc->ndis_block = block; sc->ndis_chars = IoGetDriverObjectExtension(drv, (void *)1); Modified: head/sys/compat/ndis/kern_windrv.c ============================================================================== --- head/sys/compat/ndis/kern_windrv.c Sat Mar 7 07:23:04 2009 (r189487) +++ head/sys/compat/ndis/kern_windrv.c Sat Mar 7 07:26:22 2009 (r189488) @@ -56,8 +56,7 @@ __FBSDID("$FreeBSD$"); #include #endif -#include -#include +#include #include #include @@ -95,7 +94,7 @@ windrv_libinit(void) { STAILQ_INIT(&drvdb_head); mtx_init(&drvdb_mtx, "Windows driver DB lock", - "Windows internal lock", MTX_DEF); + "Windows internal lock", MTX_DEF); /* * PCI and pccard devices don't need to use IRPs to @@ -286,7 +285,7 @@ windrv_unload(mod, img, len) if (drv == NULL) return(ENOENT); - /* + /* * Destroy any custom extensions that may have been added. */ drv = r->windrv_object; @@ -341,7 +340,7 @@ windrv_load(mod, img, len, bustype, devl */ ptr = (uint32_t *)(img + 8); - if (*ptr == WINDRV_LOADED) + if (*ptr == WINDRV_LOADED) goto skipreloc; /* Perform text relocation */ @@ -390,7 +389,7 @@ skipreloc: free (new, M_DEVBUF); return (ENOMEM); } - + /* Allocate a driver extension structure too. */ drv->dro_driverext = malloc(sizeof(driver_extension), @@ -544,7 +543,7 @@ windrv_bus_attach(drv, name) new->windrv_devlist = NULL; new->windrv_regvals = NULL; - mtx_lock(&drvdb_mtx); + mtx_lock(&drvdb_mtx); STAILQ_INSERT_HEAD(&drvdb_head, new, link); mtx_unlock(&drvdb_mtx); @@ -727,41 +726,41 @@ static int windrv_wrap_stdcall(funcptr, static int windrv_wrap_fastcall(funcptr, funcptr *, int); static int windrv_wrap_regparm(funcptr, funcptr *); -extern void x86_fastcall_wrap(void); -extern void x86_fastcall_wrap_call(void); -extern void x86_fastcall_wrap_arg(void); -extern void x86_fastcall_wrap_end(void); +extern void x86_fastcall_wrap(void); +extern void x86_fastcall_wrap_call(void); +extern void x86_fastcall_wrap_arg(void); +extern void x86_fastcall_wrap_end(void); static int windrv_wrap_fastcall(func, wrap, argcnt) - funcptr func; - funcptr *wrap; + funcptr func; + funcptr *wrap; int8_t argcnt; { - funcptr p; - vm_offset_t *calladdr; + funcptr p; + vm_offset_t *calladdr; uint8_t *argaddr; - vm_offset_t wrapstart, wrapend, wrapcall, wraparg; + vm_offset_t wrapstart, wrapend, wrapcall, wraparg; - wrapstart = (vm_offset_t)&x86_fastcall_wrap; - wrapend = (vm_offset_t)&x86_fastcall_wrap_end; - wrapcall = (vm_offset_t)&x86_fastcall_wrap_call; - wraparg = (vm_offset_t)&x86_fastcall_wrap_arg; + wrapstart = (vm_offset_t)&x86_fastcall_wrap; + wrapend = (vm_offset_t)&x86_fastcall_wrap_end; + wrapcall = (vm_offset_t)&x86_fastcall_wrap_call; + wraparg = (vm_offset_t)&x86_fastcall_wrap_arg; - /* Allocate a new wrapper instance. */ + /* Allocate a new wrapper instance. */ - p = malloc((wrapend - wrapstart), M_DEVBUF, M_NOWAIT); - if (p == NULL) - return(ENOMEM); + p = malloc((wrapend - wrapstart), M_DEVBUF, M_NOWAIT); + if (p == NULL) + return(ENOMEM); - /* Copy over the code. */ + /* Copy over the code. */ bcopy((char *)wrapstart, p, (wrapend - wrapstart)); - /* Insert the function address into the new wrapper instance. */ + /* Insert the function address into the new wrapper instance. */ calladdr = (vm_offset_t *)((char *)p + ((wrapcall - wrapstart) + 1)); - *calladdr = (vm_offset_t)func; + *calladdr = (vm_offset_t)func; argcnt -= 2; if (argcnt < 1) @@ -770,96 +769,96 @@ windrv_wrap_fastcall(func, wrap, argcnt) argaddr = (u_int8_t *)((char *)p + ((wraparg - wrapstart) + 1)); *argaddr = argcnt * sizeof(uint32_t); - *wrap = p; + *wrap = p; - return(0); + return(0); } -extern void x86_stdcall_wrap(void); -extern void x86_stdcall_wrap_call(void); -extern void x86_stdcall_wrap_arg(void); -extern void x86_stdcall_wrap_end(void); +extern void x86_stdcall_wrap(void); +extern void x86_stdcall_wrap_call(void); +extern void x86_stdcall_wrap_arg(void); +extern void x86_stdcall_wrap_end(void); static int windrv_wrap_stdcall(func, wrap, argcnt) - funcptr func; - funcptr *wrap; + funcptr func; + funcptr *wrap; uint8_t argcnt; { - funcptr p; - vm_offset_t *calladdr; + funcptr p; + vm_offset_t *calladdr; uint8_t *argaddr; - vm_offset_t wrapstart, wrapend, wrapcall, wraparg; + vm_offset_t wrapstart, wrapend, wrapcall, wraparg; - wrapstart = (vm_offset_t)&x86_stdcall_wrap; - wrapend = (vm_offset_t)&x86_stdcall_wrap_end; - wrapcall = (vm_offset_t)&x86_stdcall_wrap_call; - wraparg = (vm_offset_t)&x86_stdcall_wrap_arg; + wrapstart = (vm_offset_t)&x86_stdcall_wrap; + wrapend = (vm_offset_t)&x86_stdcall_wrap_end; + wrapcall = (vm_offset_t)&x86_stdcall_wrap_call; + wraparg = (vm_offset_t)&x86_stdcall_wrap_arg; - /* Allocate a new wrapper instance. */ + /* Allocate a new wrapper instance. */ - p = malloc((wrapend - wrapstart), M_DEVBUF, M_NOWAIT); - if (p == NULL) - return(ENOMEM); + p = malloc((wrapend - wrapstart), M_DEVBUF, M_NOWAIT); + if (p == NULL) + return(ENOMEM); - /* Copy over the code. */ + /* Copy over the code. */ bcopy((char *)wrapstart, p, (wrapend - wrapstart)); - /* Insert the function address into the new wrapper instance. */ + /* Insert the function address into the new wrapper instance. */ calladdr = (vm_offset_t *)((char *)p + ((wrapcall - wrapstart) + 1)); - *calladdr = (vm_offset_t)func; + *calladdr = (vm_offset_t)func; argaddr = (u_int8_t *)((char *)p + ((wraparg - wrapstart) + 1)); *argaddr = argcnt * sizeof(uint32_t); - *wrap = p; + *wrap = p; - return(0); + return(0); } -extern void x86_regparm_wrap(void); -extern void x86_regparm_wrap_call(void); -extern void x86_regparm_wrap_end(void); +extern void x86_regparm_wrap(void); +extern void x86_regparm_wrap_call(void); +extern void x86_regparm_wrap_end(void); static int windrv_wrap_regparm(func, wrap) - funcptr func; - funcptr *wrap; + funcptr func; + funcptr *wrap; { - funcptr p; - vm_offset_t *calladdr; - vm_offset_t wrapstart, wrapend, wrapcall; + funcptr p; + vm_offset_t *calladdr; + vm_offset_t wrapstart, wrapend, wrapcall; - wrapstart = (vm_offset_t)&x86_regparm_wrap; - wrapend = (vm_offset_t)&x86_regparm_wrap_end; - wrapcall = (vm_offset_t)&x86_regparm_wrap_call; + wrapstart = (vm_offset_t)&x86_regparm_wrap; + wrapend = (vm_offset_t)&x86_regparm_wrap_end; + wrapcall = (vm_offset_t)&x86_regparm_wrap_call; - /* Allocate a new wrapper instance. */ + /* Allocate a new wrapper instance. */ - p = malloc((wrapend - wrapstart), M_DEVBUF, M_NOWAIT); - if (p == NULL) - return(ENOMEM); + p = malloc((wrapend - wrapstart), M_DEVBUF, M_NOWAIT); + if (p == NULL) + return(ENOMEM); - /* Copy over the code. */ + /* Copy over the code. */ - bcopy(x86_regparm_wrap, p, (wrapend - wrapstart)); + bcopy(x86_regparm_wrap, p, (wrapend - wrapstart)); - /* Insert the function address into the new wrapper instance. */ + /* Insert the function address into the new wrapper instance. */ calladdr = (vm_offset_t *)((char *)p + ((wrapcall - wrapstart) + 1)); - *calladdr = (vm_offset_t)func; + *calladdr = (vm_offset_t)func; - *wrap = p; + *wrap = p; - return(0); + return(0); } int windrv_wrap(func, wrap, argcnt, ftype) - funcptr func; - funcptr *wrap; + funcptr func; + funcptr *wrap; int argcnt; int ftype; { Modified: head/sys/compat/ndis/ndis_var.h ============================================================================== --- head/sys/compat/ndis/ndis_var.h Sat Mar 7 07:23:04 2009 (r189487) +++ head/sys/compat/ndis/ndis_var.h Sat Mar 7 07:26:22 2009 (r189488) @@ -33,7 +33,7 @@ */ #ifndef _NDIS_VAR_H_ -#define _NDIS_VAR_H_ +#define _NDIS_VAR_H_ /* Forward declarations */ struct ndis_miniport_block; @@ -55,122 +55,122 @@ typedef uint8_t ndis_kirql; * NT status codes. */ -#define NDIS_STATUS_SUCCESS 0 -#define NDIS_STATUS_PENDING 0x00000103 -#define NDIS_STATUS_NOT_RECOGNIZED 0x00010001 -#define NDIS_STATUS_NOT_COPIED 0x00010002 -#define NDIS_STATUS_NOT_ACCEPTED 0x00010003 -#define NDIS_STATUS_CALL_ACTIVE 0x00010007 -#define NDIS_STATUS_ONLINE 0x40010003 -#define NDIS_STATUS_RESET_START 0x40010004 -#define NDIS_STATUS_RESET_END 0x40010005 -#define NDIS_STATUS_RING_STATUS 0x40010006 -#define NDIS_STATUS_CLOSED 0x40010007 -#define NDIS_STATUS_WAN_LINE_UP 0x40010008 -#define NDIS_STATUS_WAN_LINE_DOWN 0x40010009 -#define NDIS_STATUS_WAN_FRAGMENT 0x4001000A -#define NDIS_STATUS_MEDIA_CONNECT 0x4001000B -#define NDIS_STATUS_MEDIA_DISCONNECT 0x4001000C -#define NDIS_STATUS_HARDWARE_LINE_UP 0x4001000D -#define NDIS_STATUS_HARDWARE_LINE_DOWN 0x4001000E -#define NDIS_STATUS_INTERFACE_UP 0x4001000F -#define NDIS_STATUS_INTERFACE_DOWN 0x40010010 -#define NDIS_STATUS_MEDIA_BUSY 0x40010011 -#define NDIS_STATUS_MEDIA_SPECIFIC_INDICATION 0x40010012 -#define NDIS_STATUS_WW_INDICATION NDIS_STATUS_MEDIA_SPECIFIC_INDICATION -#define NDIS_STATUS_LINK_SPEED_CHANGE 0x40010013 -#define NDIS_STATUS_WAN_GET_STATS 0x40010014 -#define NDIS_STATUS_WAN_CO_FRAGMENT 0x40010015 -#define NDIS_STATUS_WAN_CO_LINKPARAMS 0x40010016 -#define NDIS_STATUS_NOT_RESETTABLE 0x80010001 -#define NDIS_STATUS_SOFT_ERRORS 0x80010003 -#define NDIS_STATUS_HARD_ERRORS 0x80010004 -#define NDIS_STATUS_BUFFER_OVERFLOW 0x80000005 -#define NDIS_STATUS_FAILURE 0xC0000001 -#define NDIS_STATUS_RESOURCES 0xC000009A -#define NDIS_STATUS_CLOSING 0xC0010002 -#define NDIS_STATUS_BAD_VERSION 0xC0010004 -#define NDIS_STATUS_BAD_CHARACTERISTICS 0xC0010005 -#define NDIS_STATUS_ADAPTER_NOT_FOUND 0xC0010006 -#define NDIS_STATUS_OPEN_FAILED 0xC0010007 -#define NDIS_STATUS_DEVICE_FAILED 0xC0010008 -#define NDIS_STATUS_MULTICAST_FULL 0xC0010009 -#define NDIS_STATUS_MULTICAST_EXISTS 0xC001000A -#define NDIS_STATUS_MULTICAST_NOT_FOUND 0xC001000B -#define NDIS_STATUS_REQUEST_ABORTED 0xC001000C -#define NDIS_STATUS_RESET_IN_PROGRESS 0xC001000D -#define NDIS_STATUS_CLOSING_INDICATING 0xC001000E -#define NDIS_STATUS_NOT_SUPPORTED 0xC00000BB -#define NDIS_STATUS_INVALID_PACKET 0xC001000F -#define NDIS_STATUS_OPEN_LIST_FULL 0xC0010010 -#define NDIS_STATUS_ADAPTER_NOT_READY 0xC0010011 -#define NDIS_STATUS_ADAPTER_NOT_OPEN 0xC0010012 -#define NDIS_STATUS_NOT_INDICATING 0xC0010013 -#define NDIS_STATUS_INVALID_LENGTH 0xC0010014 -#define NDIS_STATUS_INVALID_DATA 0xC0010015 -#define NDIS_STATUS_BUFFER_TOO_SHORT 0xC0010016 -#define NDIS_STATUS_INVALID_OID 0xC0010017 -#define NDIS_STATUS_ADAPTER_REMOVED 0xC0010018 -#define NDIS_STATUS_UNSUPPORTED_MEDIA 0xC0010019 -#define NDIS_STATUS_GROUP_ADDRESS_IN_USE 0xC001001A -#define NDIS_STATUS_FILE_NOT_FOUND 0xC001001B -#define NDIS_STATUS_ERROR_READING_FILE 0xC001001C -#define NDIS_STATUS_ALREADY_MAPPED 0xC001001D -#define NDIS_STATUS_RESOURCE_CONFLICT 0xC001001E -#define NDIS_STATUS_NO_CABLE 0xC001001F -#define NDIS_STATUS_INVALID_SAP 0xC0010020 -#define NDIS_STATUS_SAP_IN_USE 0xC0010021 -#define NDIS_STATUS_INVALID_ADDRESS 0xC0010022 -#define NDIS_STATUS_VC_NOT_ACTIVATED 0xC0010023 -#define NDIS_STATUS_DEST_OUT_OF_ORDER 0xC0010024 -#define NDIS_STATUS_VC_NOT_AVAILABLE 0xC0010025 -#define NDIS_STATUS_CELLRATE_NOT_AVAILABLE 0xC0010026 -#define NDIS_STATUS_INCOMPATABLE_QOS 0xC0010027 -#define NDIS_STATUS_AAL_PARAMS_UNSUPPORTED 0xC0010028 -#define NDIS_STATUS_NO_ROUTE_TO_DESTINATION 0xC0010029 -#define NDIS_STATUS_TOKEN_RING_OPEN_ERROR 0xC0011000 -#define NDIS_STATUS_INVALID_DEVICE_REQUEST 0xC0000010 -#define NDIS_STATUS_NETWORK_UNREACHABLE 0xC000023C +#define NDIS_STATUS_SUCCESS 0 +#define NDIS_STATUS_PENDING 0x00000103 +#define NDIS_STATUS_NOT_RECOGNIZED 0x00010001 +#define NDIS_STATUS_NOT_COPIED 0x00010002 +#define NDIS_STATUS_NOT_ACCEPTED 0x00010003 +#define NDIS_STATUS_CALL_ACTIVE 0x00010007 +#define NDIS_STATUS_ONLINE 0x40010003 +#define NDIS_STATUS_RESET_START 0x40010004 +#define NDIS_STATUS_RESET_END 0x40010005 +#define NDIS_STATUS_RING_STATUS 0x40010006 +#define NDIS_STATUS_CLOSED 0x40010007 +#define NDIS_STATUS_WAN_LINE_UP 0x40010008 +#define NDIS_STATUS_WAN_LINE_DOWN 0x40010009 +#define NDIS_STATUS_WAN_FRAGMENT 0x4001000A +#define NDIS_STATUS_MEDIA_CONNECT 0x4001000B +#define NDIS_STATUS_MEDIA_DISCONNECT 0x4001000C +#define NDIS_STATUS_HARDWARE_LINE_UP 0x4001000D +#define NDIS_STATUS_HARDWARE_LINE_DOWN 0x4001000E +#define NDIS_STATUS_INTERFACE_UP 0x4001000F +#define NDIS_STATUS_INTERFACE_DOWN 0x40010010 +#define NDIS_STATUS_MEDIA_BUSY 0x40010011 +#define NDIS_STATUS_MEDIA_SPECIFIC_INDICATION 0x40010012 +#define NDIS_STATUS_WW_INDICATION NDIS_STATUS_MEDIA_SPECIFIC_INDICATION +#define NDIS_STATUS_LINK_SPEED_CHANGE 0x40010013 +#define NDIS_STATUS_WAN_GET_STATS 0x40010014 +#define NDIS_STATUS_WAN_CO_FRAGMENT 0x40010015 +#define NDIS_STATUS_WAN_CO_LINKPARAMS 0x40010016 +#define NDIS_STATUS_NOT_RESETTABLE 0x80010001 +#define NDIS_STATUS_SOFT_ERRORS 0x80010003 +#define NDIS_STATUS_HARD_ERRORS 0x80010004 +#define NDIS_STATUS_BUFFER_OVERFLOW 0x80000005 +#define NDIS_STATUS_FAILURE 0xC0000001 +#define NDIS_STATUS_RESOURCES 0xC000009A +#define NDIS_STATUS_CLOSING 0xC0010002 +#define NDIS_STATUS_BAD_VERSION 0xC0010004 +#define NDIS_STATUS_BAD_CHARACTERISTICS 0xC0010005 +#define NDIS_STATUS_ADAPTER_NOT_FOUND 0xC0010006 +#define NDIS_STATUS_OPEN_FAILED 0xC0010007 +#define NDIS_STATUS_DEVICE_FAILED 0xC0010008 +#define NDIS_STATUS_MULTICAST_FULL 0xC0010009 +#define NDIS_STATUS_MULTICAST_EXISTS 0xC001000A +#define NDIS_STATUS_MULTICAST_NOT_FOUND 0xC001000B +#define NDIS_STATUS_REQUEST_ABORTED 0xC001000C +#define NDIS_STATUS_RESET_IN_PROGRESS 0xC001000D +#define NDIS_STATUS_CLOSING_INDICATING 0xC001000E +#define NDIS_STATUS_NOT_SUPPORTED 0xC00000BB +#define NDIS_STATUS_INVALID_PACKET 0xC001000F +#define NDIS_STATUS_OPEN_LIST_FULL 0xC0010010 +#define NDIS_STATUS_ADAPTER_NOT_READY 0xC0010011 +#define NDIS_STATUS_ADAPTER_NOT_OPEN 0xC0010012 +#define NDIS_STATUS_NOT_INDICATING 0xC0010013 +#define NDIS_STATUS_INVALID_LENGTH 0xC0010014 +#define NDIS_STATUS_INVALID_DATA 0xC0010015 +#define NDIS_STATUS_BUFFER_TOO_SHORT 0xC0010016 +#define NDIS_STATUS_INVALID_OID 0xC0010017 +#define NDIS_STATUS_ADAPTER_REMOVED 0xC0010018 +#define NDIS_STATUS_UNSUPPORTED_MEDIA 0xC0010019 +#define NDIS_STATUS_GROUP_ADDRESS_IN_USE 0xC001001A +#define NDIS_STATUS_FILE_NOT_FOUND 0xC001001B +#define NDIS_STATUS_ERROR_READING_FILE 0xC001001C +#define NDIS_STATUS_ALREADY_MAPPED 0xC001001D +#define NDIS_STATUS_RESOURCE_CONFLICT 0xC001001E +#define NDIS_STATUS_NO_CABLE 0xC001001F +#define NDIS_STATUS_INVALID_SAP 0xC0010020 +#define NDIS_STATUS_SAP_IN_USE 0xC0010021 +#define NDIS_STATUS_INVALID_ADDRESS 0xC0010022 +#define NDIS_STATUS_VC_NOT_ACTIVATED 0xC0010023 +#define NDIS_STATUS_DEST_OUT_OF_ORDER 0xC0010024 +#define NDIS_STATUS_VC_NOT_AVAILABLE 0xC0010025 +#define NDIS_STATUS_CELLRATE_NOT_AVAILABLE 0xC0010026 +#define NDIS_STATUS_INCOMPATABLE_QOS 0xC0010027 +#define NDIS_STATUS_AAL_PARAMS_UNSUPPORTED 0xC0010028 +#define NDIS_STATUS_NO_ROUTE_TO_DESTINATION 0xC0010029 +#define NDIS_STATUS_TOKEN_RING_OPEN_ERROR 0xC0011000 +#define NDIS_STATUS_INVALID_DEVICE_REQUEST 0xC0000010 +#define NDIS_STATUS_NETWORK_UNREACHABLE 0xC000023C /* * NDIS event codes. They are usually reported to NdisWriteErrorLogEntry(). */ -#define EVENT_NDIS_RESOURCE_CONFLICT 0xC0001388 -#define EVENT_NDIS_OUT_OF_RESOURCE 0xC0001389 -#define EVENT_NDIS_HARDWARE_FAILURE 0xC000138A -#define EVENT_NDIS_ADAPTER_NOT_FOUND 0xC000138B -#define EVENT_NDIS_INTERRUPT_CONNECT 0xC000138C -#define EVENT_NDIS_DRIVER_FAILURE 0xC000138D -#define EVENT_NDIS_BAD_VERSION 0xC000138E -#define EVENT_NDIS_TIMEOUT 0x8000138F -#define EVENT_NDIS_NETWORK_ADDRESS 0xC0001390 -#define EVENT_NDIS_UNSUPPORTED_CONFIGURATION 0xC0001391 -#define EVENT_NDIS_INVALID_VALUE_FROM_ADAPTER 0xC0001392 -#define EVENT_NDIS_MISSING_CONFIGURATION_PARAMETER 0xC0001393 -#define EVENT_NDIS_BAD_IO_BASE_ADDRESS 0xC0001394 -#define EVENT_NDIS_RECEIVE_SPACE_SMALL 0x40001395 -#define EVENT_NDIS_ADAPTER_DISABLED 0x80001396 -#define EVENT_NDIS_IO_PORT_CONFLICT 0x80001397 -#define EVENT_NDIS_PORT_OR_DMA_CONFLICT 0x80001398 -#define EVENT_NDIS_MEMORY_CONFLICT 0x80001399 -#define EVENT_NDIS_INTERRUPT_CONFLICT 0x8000139A -#define EVENT_NDIS_DMA_CONFLICT 0x8000139B -#define EVENT_NDIS_INVALID_DOWNLOAD_FILE_ERROR 0xC000139C -#define EVENT_NDIS_MAXRECEIVES_ERROR 0x8000139D -#define EVENT_NDIS_MAXTRANSMITS_ERROR 0x8000139E -#define EVENT_NDIS_MAXFRAMESIZE_ERROR 0x8000139F -#define EVENT_NDIS_MAXINTERNALBUFS_ERROR 0x800013A0 -#define EVENT_NDIS_MAXMULTICAST_ERROR 0x800013A1 -#define EVENT_NDIS_PRODUCTID_ERROR 0x800013A2 -#define EVENT_NDIS_LOBE_FAILUE_ERROR 0x800013A3 -#define EVENT_NDIS_SIGNAL_LOSS_ERROR 0x800013A4 -#define EVENT_NDIS_REMOVE_RECEIVED_ERROR 0x800013A5 -#define EVENT_NDIS_TOKEN_RING_CORRECTION 0x400013A6 -#define EVENT_NDIS_ADAPTER_CHECK_ERROR 0xC00013A7 -#define EVENT_NDIS_RESET_FAILURE_ERROR 0x800013A8 -#define EVENT_NDIS_CABLE_DISCONNECTED_ERROR 0x800013A9 -#define EVENT_NDIS_RESET_FAILURE_CORRECTION 0x800013AA +#define EVENT_NDIS_RESOURCE_CONFLICT 0xC0001388 +#define EVENT_NDIS_OUT_OF_RESOURCE 0xC0001389 +#define EVENT_NDIS_HARDWARE_FAILURE 0xC000138A +#define EVENT_NDIS_ADAPTER_NOT_FOUND 0xC000138B +#define EVENT_NDIS_INTERRUPT_CONNECT 0xC000138C +#define EVENT_NDIS_DRIVER_FAILURE 0xC000138D +#define EVENT_NDIS_BAD_VERSION 0xC000138E +#define EVENT_NDIS_TIMEOUT 0x8000138F +#define EVENT_NDIS_NETWORK_ADDRESS 0xC0001390 +#define EVENT_NDIS_UNSUPPORTED_CONFIGURATION 0xC0001391 +#define EVENT_NDIS_INVALID_VALUE_FROM_ADAPTER 0xC0001392 +#define EVENT_NDIS_MISSING_CONFIGURATION_PARAMETER 0xC0001393 +#define EVENT_NDIS_BAD_IO_BASE_ADDRESS 0xC0001394 +#define EVENT_NDIS_RECEIVE_SPACE_SMALL 0x40001395 +#define EVENT_NDIS_ADAPTER_DISABLED 0x80001396 +#define EVENT_NDIS_IO_PORT_CONFLICT 0x80001397 +#define EVENT_NDIS_PORT_OR_DMA_CONFLICT 0x80001398 +#define EVENT_NDIS_MEMORY_CONFLICT 0x80001399 +#define EVENT_NDIS_INTERRUPT_CONFLICT 0x8000139A +#define EVENT_NDIS_DMA_CONFLICT 0x8000139B +#define EVENT_NDIS_INVALID_DOWNLOAD_FILE_ERROR 0xC000139C +#define EVENT_NDIS_MAXRECEIVES_ERROR 0x8000139D +#define EVENT_NDIS_MAXTRANSMITS_ERROR 0x8000139E +#define EVENT_NDIS_MAXFRAMESIZE_ERROR 0x8000139F +#define EVENT_NDIS_MAXINTERNALBUFS_ERROR 0x800013A0 +#define EVENT_NDIS_MAXMULTICAST_ERROR 0x800013A1 +#define EVENT_NDIS_PRODUCTID_ERROR 0x800013A2 +#define EVENT_NDIS_LOBE_FAILUE_ERROR 0x800013A3 +#define EVENT_NDIS_SIGNAL_LOSS_ERROR 0x800013A4 +#define EVENT_NDIS_REMOVE_RECEIVED_ERROR 0x800013A5 +#define EVENT_NDIS_TOKEN_RING_CORRECTION 0x400013A6 +#define EVENT_NDIS_ADAPTER_CHECK_ERROR 0xC00013A7 +#define EVENT_NDIS_RESET_FAILURE_ERROR 0x800013A8 +#define EVENT_NDIS_CABLE_DISCONNECTED_ERROR 0x800013A9 +#define EVENT_NDIS_RESET_FAILURE_CORRECTION 0x800013AA /* * NDIS OIDs used by the queryinfo/setinfo routines. @@ -181,178 +181,178 @@ typedef uint8_t ndis_kirql; */ /* Required OIDs */ -#define OID_GEN_SUPPORTED_LIST 0x00010101 -#define OID_GEN_HARDWARE_STATUS 0x00010102 -#define OID_GEN_MEDIA_SUPPORTED 0x00010103 -#define OID_GEN_MEDIA_IN_USE 0x00010104 -#define OID_GEN_MAXIMUM_LOOKAHEAD 0x00010105 -#define OID_GEN_MAXIMUM_FRAME_SIZE 0x00010106 -#define OID_GEN_LINK_SPEED 0x00010107 -#define OID_GEN_TRANSMIT_BUFFER_SPACE 0x00010108 -#define OID_GEN_RECEIVE_BUFFER_SPACE 0x00010109 -#define OID_GEN_TRANSMIT_BLOCK_SIZE 0x0001010A -#define OID_GEN_RECEIVE_BLOCK_SIZE 0x0001010B -#define OID_GEN_VENDOR_ID 0x0001010C -#define OID_GEN_VENDOR_DESCRIPTION 0x0001010D -#define OID_GEN_CURRENT_PACKET_FILTER 0x0001010E -#define OID_GEN_CURRENT_LOOKAHEAD 0x0001010F -#define OID_GEN_DRIVER_VERSION 0x00010110 -#define OID_GEN_MAXIMUM_TOTAL_SIZE 0x00010111 -#define OID_GEN_PROTOCOL_OPTIONS 0x00010112 -#define OID_GEN_MAC_OPTIONS 0x00010113 -#define OID_GEN_MEDIA_CONNECT_STATUS 0x00010114 -#define OID_GEN_MAXIMUM_SEND_PACKETS 0x00010115 -#define OID_GEN_VENDOR_DRIVER_VERSION 0x00010116 -#define OID_GEN_SUPPORTED_GUIDS 0x00010117 -#define OID_GEN_NETWORK_LAYER_ADDRESSES 0x00010118 /* Set only */ -#define OID_GEN_TRANSPORT_HEADER_OFFSET 0x00010119 /* Set only */ -#define OID_GEN_MACHINE_NAME 0x0001021A -#define OID_GEN_RNDIS_CONFIG_PARAMETER 0x0001021B /* Set only */ -#define OID_GEN_VLAN_ID 0x0001021C +#define OID_GEN_SUPPORTED_LIST 0x00010101 +#define OID_GEN_HARDWARE_STATUS 0x00010102 +#define OID_GEN_MEDIA_SUPPORTED 0x00010103 +#define OID_GEN_MEDIA_IN_USE 0x00010104 +#define OID_GEN_MAXIMUM_LOOKAHEAD 0x00010105 +#define OID_GEN_MAXIMUM_FRAME_SIZE 0x00010106 +#define OID_GEN_LINK_SPEED 0x00010107 +#define OID_GEN_TRANSMIT_BUFFER_SPACE 0x00010108 +#define OID_GEN_RECEIVE_BUFFER_SPACE 0x00010109 +#define OID_GEN_TRANSMIT_BLOCK_SIZE 0x0001010A +#define OID_GEN_RECEIVE_BLOCK_SIZE 0x0001010B +#define OID_GEN_VENDOR_ID 0x0001010C +#define OID_GEN_VENDOR_DESCRIPTION 0x0001010D +#define OID_GEN_CURRENT_PACKET_FILTER 0x0001010E +#define OID_GEN_CURRENT_LOOKAHEAD 0x0001010F +#define OID_GEN_DRIVER_VERSION 0x00010110 +#define OID_GEN_MAXIMUM_TOTAL_SIZE 0x00010111 +#define OID_GEN_PROTOCOL_OPTIONS 0x00010112 +#define OID_GEN_MAC_OPTIONS 0x00010113 +#define OID_GEN_MEDIA_CONNECT_STATUS 0x00010114 +#define OID_GEN_MAXIMUM_SEND_PACKETS 0x00010115 +#define OID_GEN_VENDOR_DRIVER_VERSION 0x00010116 +#define OID_GEN_SUPPORTED_GUIDS 0x00010117 +#define OID_GEN_NETWORK_LAYER_ADDRESSES 0x00010118 /* Set only */ +#define OID_GEN_TRANSPORT_HEADER_OFFSET 0x00010119 /* Set only */ +#define OID_GEN_MACHINE_NAME 0x0001021A +#define OID_GEN_RNDIS_CONFIG_PARAMETER 0x0001021B /* Set only */ +#define OID_GEN_VLAN_ID 0x0001021C /* Optional OIDs. */ -#define OID_GEN_MEDIA_CAPABILITIES 0x00010201 -#define OID_GEN_PHYSICAL_MEDIUM 0x00010202 +#define OID_GEN_MEDIA_CAPABILITIES 0x00010201 +#define OID_GEN_PHYSICAL_MEDIUM 0x00010202 /* Required statistics OIDs. */ -#define OID_GEN_XMIT_OK 0x00020101 -#define OID_GEN_RCV_OK 0x00020102 -#define OID_GEN_XMIT_ERROR 0x00020103 -#define OID_GEN_RCV_ERROR 0x00020104 -#define OID_GEN_RCV_NO_BUFFER 0x00020105 +#define OID_GEN_XMIT_OK 0x00020101 +#define OID_GEN_RCV_OK 0x00020102 +#define OID_GEN_XMIT_ERROR 0x00020103 +#define OID_GEN_RCV_ERROR 0x00020104 +#define OID_GEN_RCV_NO_BUFFER 0x00020105 /* Optional OID statistics */ -#define OID_GEN_DIRECTED_BYTES_XMIT 0x00020201 -#define OID_GEN_DIRECTED_FRAMES_XMIT 0x00020202 -#define OID_GEN_MULTICAST_BYTES_XMIT 0x00020203 -#define OID_GEN_MULTICAST_FRAMES_XMIT 0x00020204 -#define OID_GEN_BROADCAST_BYTES_XMIT 0x00020205 -#define OID_GEN_BROADCAST_FRAMES_XMIT 0x00020206 -#define OID_GEN_DIRECTED_BYTES_RCV 0x00020207 -#define OID_GEN_DIRECTED_FRAMES_RCV 0x00020208 -#define OID_GEN_MULTICAST_BYTES_RCV 0x00020209 -#define OID_GEN_MULTICAST_FRAMES_RCV 0x0002020A -#define OID_GEN_BROADCAST_BYTES_RCV 0x0002020B -#define OID_GEN_BROADCAST_FRAMES_RCV 0x0002020C -#define OID_GEN_RCV_CRC_ERROR 0x0002020D -#define OID_GEN_TRANSMIT_QUEUE_LENGTH 0x0002020E -#define OID_GEN_GET_TIME_CAPS 0x0002020F -#define OID_GEN_GET_NETCARD_TIME 0x00020210 -#define OID_GEN_NETCARD_LOAD 0x00020211 -#define OID_GEN_DEVICE_PROFILE 0x00020212 +#define OID_GEN_DIRECTED_BYTES_XMIT 0x00020201 +#define OID_GEN_DIRECTED_FRAMES_XMIT 0x00020202 +#define OID_GEN_MULTICAST_BYTES_XMIT 0x00020203 +#define OID_GEN_MULTICAST_FRAMES_XMIT 0x00020204 +#define OID_GEN_BROADCAST_BYTES_XMIT 0x00020205 +#define OID_GEN_BROADCAST_FRAMES_XMIT 0x00020206 +#define OID_GEN_DIRECTED_BYTES_RCV 0x00020207 +#define OID_GEN_DIRECTED_FRAMES_RCV 0x00020208 +#define OID_GEN_MULTICAST_BYTES_RCV 0x00020209 +#define OID_GEN_MULTICAST_FRAMES_RCV 0x0002020A +#define OID_GEN_BROADCAST_BYTES_RCV 0x0002020B +#define OID_GEN_BROADCAST_FRAMES_RCV 0x0002020C +#define OID_GEN_RCV_CRC_ERROR 0x0002020D +#define OID_GEN_TRANSMIT_QUEUE_LENGTH 0x0002020E +#define OID_GEN_GET_TIME_CAPS 0x0002020F +#define OID_GEN_GET_NETCARD_TIME 0x00020210 +#define OID_GEN_NETCARD_LOAD 0x00020211 +#define OID_GEN_DEVICE_PROFILE 0x00020212 /* 802.3 (ethernet) OIDs */ -#define OID_802_3_PERMANENT_ADDRESS 0x01010101 -#define OID_802_3_CURRENT_ADDRESS 0x01010102 -#define OID_802_3_MULTICAST_LIST 0x01010103 -#define OID_802_3_MAXIMUM_LIST_SIZE 0x01010104 -#define OID_802_3_MAC_OPTIONS 0x01010105 -#define NDIS_802_3_MAC_OPTION_PRIORITY 0x00000001 -#define OID_802_3_RCV_ERROR_ALIGNMENT 0x01020101 -#define OID_802_3_XMIT_ONE_COLLISION 0x01020102 -#define OID_802_3_XMIT_MORE_COLLISIONS 0x01020103 -#define OID_802_3_XMIT_DEFERRED 0x01020201 -#define OID_802_3_XMIT_MAX_COLLISIONS 0x01020202 -#define OID_802_3_RCV_OVERRUN 0x01020203 -#define OID_802_3_XMIT_UNDERRUN 0x01020204 -#define OID_802_3_XMIT_HEARTBEAT_FAILURE 0x01020205 -#define OID_802_3_XMIT_TIMES_CRS_LOST 0x01020206 -#define OID_802_3_XMIT_LATE_COLLISIONS 0x01020207 +#define OID_802_3_PERMANENT_ADDRESS 0x01010101 +#define OID_802_3_CURRENT_ADDRESS 0x01010102 +#define OID_802_3_MULTICAST_LIST 0x01010103 +#define OID_802_3_MAXIMUM_LIST_SIZE 0x01010104 +#define OID_802_3_MAC_OPTIONS 0x01010105 +#define NDIS_802_3_MAC_OPTION_PRIORITY 0x00000001 +#define OID_802_3_RCV_ERROR_ALIGNMENT 0x01020101 +#define OID_802_3_XMIT_ONE_COLLISION 0x01020102 +#define OID_802_3_XMIT_MORE_COLLISIONS 0x01020103 +#define OID_802_3_XMIT_DEFERRED 0x01020201 +#define OID_802_3_XMIT_MAX_COLLISIONS 0x01020202 +#define OID_802_3_RCV_OVERRUN 0x01020203 +#define OID_802_3_XMIT_UNDERRUN 0x01020204 +#define OID_802_3_XMIT_HEARTBEAT_FAILURE 0x01020205 +#define OID_802_3_XMIT_TIMES_CRS_LOST 0x01020206 +#define OID_802_3_XMIT_LATE_COLLISIONS 0x01020207 /* PnP and power management OIDs */ -#define OID_PNP_CAPABILITIES 0xFD010100 -#define OID_PNP_SET_POWER 0xFD010101 -#define OID_PNP_QUERY_POWER 0xFD010102 -#define OID_PNP_ADD_WAKE_UP_PATTERN 0xFD010103 -#define OID_PNP_REMOVE_WAKE_UP_PATTERN 0xFD010104 -#define OID_PNP_WAKE_UP_PATTERN_LIST 0xFD010105 -#define OID_PNP_ENABLE_WAKE_UP 0xFD010106 +#define OID_PNP_CAPABILITIES 0xFD010100 +#define OID_PNP_SET_POWER 0xFD010101 +#define OID_PNP_QUERY_POWER 0xFD010102 +#define OID_PNP_ADD_WAKE_UP_PATTERN 0xFD010103 +#define OID_PNP_REMOVE_WAKE_UP_PATTERN 0xFD010104 +#define OID_PNP_WAKE_UP_PATTERN_LIST 0xFD010105 +#define OID_PNP_ENABLE_WAKE_UP 0xFD010106 /* * These are the possible power states for * OID_PNP_SET_POWER and OID_PNP_QUERY_POWER. */ -#define NDIS_POWERSTATE_UNSPEC 0 -#define NDIS_POWERSTATE_D0 1 -#define NDIS_POWERSTATE_D1 2 -#define NDIS_POWERSTATE_D2 3 -#define NDIS_POWERSTATE_D3 4 +#define NDIS_POWERSTATE_UNSPEC 0 +#define NDIS_POWERSTATE_D0 1 +#define NDIS_POWERSTATE_D1 2 +#define NDIS_POWERSTATE_D2 3 +#define NDIS_POWERSTATE_D3 4 /* * These are used with the MiniportPnpEventNotify() method. */ -#define NDIS_POWERPROFILE_BATTERY 0 -#define NDIS_POWERPROFILE_ACONLINE 1 +#define NDIS_POWERPROFILE_BATTERY 0 +#define NDIS_POWERPROFILE_ACONLINE 1 -#define NDIS_PNP_EVENT_QUERY_REMOVED 0 -#define NDIS_PNP_EVENT_REMOVED 1 -#define NDIS_PNP_EVENT_SURPRISE_REMOVED 2 -#define NDIS_PNP_EVENT_QUERY_STOPPED 3 -#define NDIS_PNP_EVENT_STOPPED 4 -#define NDIS_PNP_EVENT_PROFILECHANGED 5 +#define NDIS_PNP_EVENT_QUERY_REMOVED 0 +#define NDIS_PNP_EVENT_REMOVED 1 +#define NDIS_PNP_EVENT_SURPRISE_REMOVED 2 +#define NDIS_PNP_EVENT_QUERY_STOPPED 3 +#define NDIS_PNP_EVENT_STOPPED 4 +#define NDIS_PNP_EVENT_PROFILECHANGED 5 /* PnP/PM Statistics (Optional). */ -#define OID_PNP_WAKE_UP_OK 0xFD020200 -#define OID_PNP_WAKE_UP_ERROR 0xFD020201 +#define OID_PNP_WAKE_UP_OK 0xFD020200 +#define OID_PNP_WAKE_UP_ERROR 0xFD020201 /* The following bits are defined for OID_PNP_ENABLE_WAKE_UP */ -#define NDIS_PNP_WAKE_UP_MAGIC_PACKET 0x00000001 -#define NDIS_PNP_WAKE_UP_PATTERN_MATCH 0x00000002 -#define NDIS_PNP_WAKE_UP_LINK_CHANGE 0x00000004 +#define NDIS_PNP_WAKE_UP_MAGIC_PACKET 0x00000001 +#define NDIS_PNP_WAKE_UP_PATTERN_MATCH 0x00000002 +#define NDIS_PNP_WAKE_UP_LINK_CHANGE 0x00000004 /* 802.11 OIDs */ -#define OID_802_11_BSSID 0x0D010101 -#define OID_802_11_SSID 0x0D010102 -#define OID_802_11_NETWORK_TYPES_SUPPORTED 0x0D010203 -#define OID_802_11_NETWORK_TYPE_IN_USE 0x0D010204 -#define OID_802_11_TX_POWER_LEVEL 0x0D010205 -#define OID_802_11_RSSI 0x0D010206 -#define OID_802_11_RSSI_TRIGGER 0x0D010207 -#define OID_802_11_INFRASTRUCTURE_MODE 0x0D010108 -#define OID_802_11_FRAGMENTATION_THRESHOLD 0x0D010209 -#define OID_802_11_RTS_THRESHOLD 0x0D01020A -#define OID_802_11_NUMBER_OF_ANTENNAS 0x0D01020B -#define OID_802_11_RX_ANTENNA_SELECTED 0x0D01020C -#define OID_802_11_TX_ANTENNA_SELECTED 0x0D01020D -#define OID_802_11_SUPPORTED_RATES 0x0D01020E -#define OID_802_11_DESIRED_RATES 0x0D010210 -#define OID_802_11_CONFIGURATION 0x0D010211 -#define OID_802_11_STATISTICS 0x0D020212 -#define OID_802_11_ADD_WEP 0x0D010113 -#define OID_802_11_REMOVE_WEP 0x0D010114 -#define OID_802_11_DISASSOCIATE 0x0D010115 -#define OID_802_11_POWER_MODE 0x0D010216 -#define OID_802_11_BSSID_LIST 0x0D010217 -#define OID_802_11_AUTHENTICATION_MODE 0x0D010118 -#define OID_802_11_PRIVACY_FILTER 0x0D010119 -#define OID_802_11_BSSID_LIST_SCAN 0x0D01011A -#define OID_802_11_WEP_STATUS 0x0D01011B -#define OID_802_11_ENCRYPTION_STATUS OID_802_11_WEP_STATUS -#define OID_802_11_RELOAD_DEFAULTS 0x0D01011C -#define OID_802_11_ADD_KEY 0x0D01011D -#define OID_802_11_REMOVE_KEY 0x0D01011E -#define OID_802_11_ASSOCIATION_INFORMATION 0x0D01011F -#define OID_802_11_TEST 0x0D010120 -#define OID_802_11_CAPABILITY 0x0D010122 -#define OID_802_11_PMKID 0x0D010123 +#define OID_802_11_BSSID 0x0D010101 +#define OID_802_11_SSID 0x0D010102 +#define OID_802_11_NETWORK_TYPES_SUPPORTED 0x0D010203 +#define OID_802_11_NETWORK_TYPE_IN_USE 0x0D010204 +#define OID_802_11_TX_POWER_LEVEL 0x0D010205 +#define OID_802_11_RSSI 0x0D010206 +#define OID_802_11_RSSI_TRIGGER 0x0D010207 +#define OID_802_11_INFRASTRUCTURE_MODE 0x0D010108 +#define OID_802_11_FRAGMENTATION_THRESHOLD 0x0D010209 +#define OID_802_11_RTS_THRESHOLD 0x0D01020A +#define OID_802_11_NUMBER_OF_ANTENNAS 0x0D01020B +#define OID_802_11_RX_ANTENNA_SELECTED 0x0D01020C +#define OID_802_11_TX_ANTENNA_SELECTED 0x0D01020D +#define OID_802_11_SUPPORTED_RATES 0x0D01020E +#define OID_802_11_DESIRED_RATES 0x0D010210 +#define OID_802_11_CONFIGURATION 0x0D010211 +#define OID_802_11_STATISTICS 0x0D020212 +#define OID_802_11_ADD_WEP 0x0D010113 +#define OID_802_11_REMOVE_WEP 0x0D010114 +#define OID_802_11_DISASSOCIATE 0x0D010115 +#define OID_802_11_POWER_MODE 0x0D010216 +#define OID_802_11_BSSID_LIST 0x0D010217 +#define OID_802_11_AUTHENTICATION_MODE 0x0D010118 +#define OID_802_11_PRIVACY_FILTER 0x0D010119 +#define OID_802_11_BSSID_LIST_SCAN 0x0D01011A +#define OID_802_11_WEP_STATUS 0x0D01011B +#define OID_802_11_ENCRYPTION_STATUS OID_802_11_WEP_STATUS +#define OID_802_11_RELOAD_DEFAULTS 0x0D01011C +#define OID_802_11_ADD_KEY 0x0D01011D +#define OID_802_11_REMOVE_KEY 0x0D01011E +#define OID_802_11_ASSOCIATION_INFORMATION 0x0D01011F +#define OID_802_11_TEST 0x0D010120 +#define OID_802_11_CAPABILITY 0x0D010122 +#define OID_802_11_PMKID 0x0D010123 /* structures/definitions for 802.11 */ -#define NDIS_80211_NETTYPE_11FH 0x00000000 -#define NDIS_80211_NETTYPE_11DS 0x00000001 -#define NDIS_80211_NETTYPE_11OFDM5 0x00000002 -#define NDIS_80211_NETTYPE_11OFDM24 0x00000003 -#define NDIS_80211_NETTYPE_AUTO 0x00000004 +#define NDIS_80211_NETTYPE_11FH 0x00000000 +#define NDIS_80211_NETTYPE_11DS 0x00000001 +#define NDIS_80211_NETTYPE_11OFDM5 0x00000002 +#define NDIS_80211_NETTYPE_11OFDM24 0x00000003 +#define NDIS_80211_NETTYPE_AUTO 0x00000004 struct ndis_80211_nettype_list { uint32_t ntl_items; uint32_t ntl_type[1]; }; -#define NDIS_80211_POWERMODE_CAM 0x00000000 -#define NDIS_80211_POWERMODE_MAX_PSP 0x00000001 -#define NDIS_80211_POWERMODE_FAST_PSP 0x00000002 +#define NDIS_80211_POWERMODE_CAM 0x00000000 +#define NDIS_80211_POWERMODE_MAX_PSP 0x00000001 +#define NDIS_80211_POWERMODE_FAST_PSP 0x00000002 typedef uint32_t ndis_80211_power; /* Power in milliwatts */ typedef uint32_t ndis_80211_rssi; /* Signal strength in dBm */ @@ -405,21 +405,21 @@ struct ndis_80211_wep { typedef struct ndis_80211_wep ndis_80211_wep; -#define NDIS_80211_WEPKEY_TX 0x80000000 -#define NDIS_80211_WEPKEY_PERCLIENT 0x40000000 +#define NDIS_80211_WEPKEY_TX 0x80000000 +#define NDIS_80211_WEPKEY_PERCLIENT 0x40000000 -#define NDIS_80211_NET_INFRA_IBSS 0x00000000 -#define NDIS_80211_NET_INFRA_BSS 0x00000001 -#define NDIS_80211_NET_INFRA_AUTO 0x00000002 - -#define NDIS_80211_AUTHMODE_OPEN 0x00000000 -#define NDIS_80211_AUTHMODE_SHARED 0x00000001 -#define NDIS_80211_AUTHMODE_AUTO 0x00000002 -#define NDIS_80211_AUTHMODE_WPA 0x00000003 -#define NDIS_80211_AUTHMODE_WPAPSK 0x00000004 -#define NDIS_80211_AUTHMODE_WPANONE 0x00000005 -#define NDIS_80211_AUTHMODE_WPA2 0x00000006 -#define NDIS_80211_AUTHMODE_WPA2PSK 0x00000007 +#define NDIS_80211_NET_INFRA_IBSS 0x00000000 +#define NDIS_80211_NET_INFRA_BSS 0x00000001 +#define NDIS_80211_NET_INFRA_AUTO 0x00000002 + +#define NDIS_80211_AUTHMODE_OPEN 0x00000000 +#define NDIS_80211_AUTHMODE_SHARED 0x00000001 +#define NDIS_80211_AUTHMODE_AUTO 0x00000002 +#define NDIS_80211_AUTHMODE_WPA 0x00000003 +#define NDIS_80211_AUTHMODE_WPAPSK 0x00000004 +#define NDIS_80211_AUTHMODE_WPANONE 0x00000005 +#define NDIS_80211_AUTHMODE_WPA2 0x00000006 +#define NDIS_80211_AUTHMODE_WPA2PSK 0x00000007 typedef uint8_t ndis_80211_rates[8]; typedef uint8_t ndis_80211_rates_ex[16]; @@ -494,26 +494,26 @@ typedef uint32_t ndis_80211_fragthresh; typedef uint32_t ndis_80211_rtsthresh; typedef uint32_t ndis_80211_antenna; -#define NDIS_80211_PRIVFILT_ACCEPTALL 0x00000000 -#define NDIS_80211_PRIVFILT_8021XWEP 0x00000001 +#define NDIS_80211_PRIVFILT_ACCEPTALL 0x00000000 +#define NDIS_80211_PRIVFILT_8021XWEP 0x00000001 -#define NDIS_80211_WEPSTAT_ENABLED 0x00000000 -#define NDIS_80211_WEPSTAT_ENC1ENABLED NDIS_80211_WEPSTAT_ENABLED -#define NDIS_80211_WEPSTAT_DISABLED 0x00000001 -#define NDIS_80211_WEPSTAT_ENCDISABLED NDIS_80211_WEPSTAT_DISABLED -#define NDIS_80211_WEPSTAT_KEYABSENT 0x00000002 -#define NDIS_80211_WEPSTAT_ENC1KEYABSENT NDIS_80211_WEPSTAT_KEYABSENT -#define NDIS_80211_WEPSTAT_NOTSUPPORTED 0x00000003 -#define NDIS_80211_WEPSTAT_ENCNOTSUPPORTED NDIS_80211_WEPSTAT_NOTSUPPORTED -#define NDIS_80211_WEPSTAT_ENC2ENABLED 0x00000004 -#define NDIS_80211_WEPSTAT_ENC2KEYABSENT 0x00000005 -#define NDIS_80211_WEPSTAT_ENC3ENABLED 0x00000006 -#define NDIS_80211_WEPSTAT_ENC3KEYABSENT 0x00000007 +#define NDIS_80211_WEPSTAT_ENABLED 0x00000000 +#define NDIS_80211_WEPSTAT_ENC1ENABLED NDIS_80211_WEPSTAT_ENABLED +#define NDIS_80211_WEPSTAT_DISABLED 0x00000001 +#define NDIS_80211_WEPSTAT_ENCDISABLED NDIS_80211_WEPSTAT_DISABLED +#define NDIS_80211_WEPSTAT_KEYABSENT 0x00000002 +#define NDIS_80211_WEPSTAT_ENC1KEYABSENT NDIS_80211_WEPSTAT_KEYABSENT +#define NDIS_80211_WEPSTAT_NOTSUPPORTED 0x00000003 +#define NDIS_80211_WEPSTAT_ENCNOTSUPPORTED NDIS_80211_WEPSTAT_NOTSUPPORTED +#define NDIS_80211_WEPSTAT_ENC2ENABLED 0x00000004 +#define NDIS_80211_WEPSTAT_ENC2KEYABSENT 0x00000005 +#define NDIS_80211_WEPSTAT_ENC3ENABLED 0x00000006 +#define NDIS_80211_WEPSTAT_ENC3KEYABSENT 0x00000007 -#define NDIS_80211_RELOADDEFAULT_WEP 0x00000000 +#define NDIS_80211_RELOADDEFAULT_WEP 0x00000000 -#define NDIS_80211_STATUSTYPE_AUTH 0x00000000 -#define NDIS_80211_STATUSTYPE_PMKIDLIST 0x00000001 +#define NDIS_80211_STATUSTYPE_AUTH 0x00000000 +#define NDIS_80211_STATUSTYPE_PMKIDLIST 0x00000001 struct ndis_80211_status_indication { uint32_t nsi_type; @@ -521,10 +521,10 @@ struct ndis_80211_status_indication { typedef struct ndis_80211_status_indication ndis_80211_status_indication; -#define NDIS_802_11_AUTH_REQUEST_REAUTH 0x01 -#define NDIS_802_11_AUTH_REQUEST_KEYUPDATE 0x02 -#define NDIS_802_11_AUTH_REQUEST_PAIRWISE_ERROR 0x06 -#define NDIS_802_11_AUTH_REQUEST_GROUP_ERROR 0x0E +#define NDIS_802_11_AUTH_REQUEST_REAUTH 0x01 +#define NDIS_802_11_AUTH_REQUEST_KEYUPDATE 0x02 +#define NDIS_802_11_AUTH_REQUEST_PAIRWISE_ERROR 0x06 +#define NDIS_802_11_AUTH_REQUEST_GROUP_ERROR 0x0E struct ndis_80211_auth_request { uint32_t nar_len; @@ -554,13 +554,13 @@ struct ndis_80211_remove_key { typedef struct ndis_80211_remove_key ndis_80211_remove_key; *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@FreeBSD.ORG Sat Mar 7 10:21: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 B465D106566C; Sat, 7 Mar 2009 10:21:37 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A1DD88FC14; Sat, 7 Mar 2009 10:21:37 +0000 (UTC) (envelope-from rwatson@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 n27ALbLn045504; Sat, 7 Mar 2009 10:21:37 GMT (envelope-from rwatson@svn.freebsd.org) Received: (from rwatson@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n27ALbRj045503; Sat, 7 Mar 2009 10:21:37 GMT (envelope-from rwatson@svn.freebsd.org) Message-Id: <200903071021.n27ALbRj045503@svn.freebsd.org> From: Robert Watson Date: Sat, 7 Mar 2009 10:21: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: r189489 - head/sys/net 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, 07 Mar 2009 10:21:38 -0000 Author: rwatson Date: Sat Mar 7 10:21:37 2009 New Revision: 189489 URL: http://svn.freebsd.org/changeset/base/189489 Log: Clarify some comments, fix some types, and rename ZBUF_FLAG_IMMUTABLE to ZBUF_FLAG_ASSIGNED to make it clear why the buffer can't be written to: it is assigned to userspace. Modified: head/sys/net/bpf_zerocopy.c Modified: head/sys/net/bpf_zerocopy.c ============================================================================== --- head/sys/net/bpf_zerocopy.c Sat Mar 7 07:26:22 2009 (r189488) +++ head/sys/net/bpf_zerocopy.c Sat Mar 7 10:21:37 2009 (r189489) @@ -91,7 +91,7 @@ __FBSDID("$FreeBSD$"); * knows that the space is not available. */ struct zbuf { - vm_offset_t zb_uaddr; /* User address, may be stale. */ + vm_offset_t zb_uaddr; /* User address at time of setup. */ size_t zb_size; /* Size of buffer, incl. header. */ u_int zb_numpages; /* Number of pages. */ int zb_flags; /* Flags on zbuf. */ @@ -104,7 +104,7 @@ struct zbuf { * buffer may remain in the store position as a result of the user process * not yet having acknowledged the buffer in the hold position yet. */ -#define ZBUF_FLAG_IMMUTABLE 0x00000001 /* Set when owned by user. */ +#define ZBUF_FLAG_ASSIGNED 0x00000001 /* Set when owned by user. */ /* * Release a page we've previously wired. @@ -262,8 +262,8 @@ bpf_zerocopy_append_bytes(struct bpf_d * src_bytes = (u_char *)src; zb = (struct zbuf *)buf; - KASSERT((zb->zb_flags & ZBUF_FLAG_IMMUTABLE) == 0, - ("bpf_zerocopy_append_bytes: ZBUF_FLAG_IMMUTABLE")); + KASSERT((zb->zb_flags & ZBUF_FLAG_ASSIGNED) == 0, + ("bpf_zerocopy_append_bytes: ZBUF_FLAG_ASSIGNED")); /* * Scatter-gather copy to user pages mapped into kernel address space @@ -314,8 +314,8 @@ bpf_zerocopy_append_mbuf(struct bpf_d *d m = (struct mbuf *)src; zb = (struct zbuf *)buf; - KASSERT((zb->zb_flags & ZBUF_FLAG_IMMUTABLE) == 0, - ("bpf_zerocopy_append_mbuf: ZBUF_FLAG_IMMUTABLE")); + KASSERT((zb->zb_flags & ZBUF_FLAG_ASSIGNED) == 0, + ("bpf_zerocopy_append_mbuf: ZBUF_FLAG_ASSIGNED")); /* * Scatter gather both from an mbuf chain and to a user page set @@ -374,8 +374,8 @@ bpf_zerocopy_buffull(struct bpf_d *d) zb = (struct zbuf *)d->bd_sbuf; KASSERT(zb != NULL, ("bpf_zerocopy_buffull: zb == NULL")); - if ((zb->zb_flags & ZBUF_FLAG_IMMUTABLE) == 0) { - zb->zb_flags |= ZBUF_FLAG_IMMUTABLE; + if ((zb->zb_flags & ZBUF_FLAG_ASSIGNED) == 0) { + zb->zb_flags |= ZBUF_FLAG_ASSIGNED; zb->zb_header->bzh_kernel_len = d->bd_slen; atomic_add_rel_int(&zb->zb_header->bzh_kernel_gen, 1); } @@ -384,9 +384,8 @@ bpf_zerocopy_buffull(struct bpf_d *d) /* * Notification from the BPF framework that a buffer has moved into the held * slot on a descriptor. Zero-copy BPF will update the shared page to let - * the user process know and flag the buffer as immutable if it hasn't - * already been marked immutable due to filling while it was in the store - * position. + * the user process know and flag the buffer as assigned if it hasn't already + * been marked assigned due to filling while it was in the store position. * * Note: identical logic as in bpf_zerocopy_buffull(), except that we operate * on bd_hbuf and bd_hlen. @@ -402,8 +401,8 @@ bpf_zerocopy_bufheld(struct bpf_d *d) zb = (struct zbuf *)d->bd_hbuf; KASSERT(zb != NULL, ("bpf_zerocopy_bufheld: zb == NULL")); - if ((zb->zb_flags & ZBUF_FLAG_IMMUTABLE) == 0) { - zb->zb_flags |= ZBUF_FLAG_IMMUTABLE; + if ((zb->zb_flags & ZBUF_FLAG_ASSIGNED) == 0) { + zb->zb_flags |= ZBUF_FLAG_ASSIGNED; zb->zb_header->bzh_kernel_len = d->bd_hlen; atomic_add_rel_int(&zb->zb_header->bzh_kernel_gen, 1); } @@ -411,7 +410,8 @@ bpf_zerocopy_bufheld(struct bpf_d *d) /* * Notification from the BPF framework that the free buffer has been been - * re-assigned. This happens when the user ackknowledges the buffer. + * rotated out of the held position to the free position. This happens when + * the user acknowledges the held buffer. */ void bpf_zerocopy_buf_reclaimed(struct bpf_d *d) @@ -422,9 +422,9 @@ bpf_zerocopy_buf_reclaimed(struct bpf_d ("bpf_zerocopy_reclaim_buf: not in zbuf mode")); KASSERT(d->bd_fbuf != NULL, - ("bpf_zerocopy_buf_reclaimed: NULL free buff")); + ("bpf_zerocopy_buf_reclaimed: NULL free buf")); zb = (struct zbuf *)d->bd_fbuf; - zb->zb_flags &= ~ZBUF_FLAG_IMMUTABLE; + zb->zb_flags &= ~ZBUF_FLAG_ASSIGNED; } /* @@ -467,7 +467,7 @@ bpf_zerocopy_canwritebuf(struct bpf_d *d zb = (struct zbuf *)d->bd_sbuf; KASSERT(zb != NULL, ("bpf_zerocopy_canwritebuf: bd_sbuf NULL")); - if (zb->zb_flags & ZBUF_FLAG_IMMUTABLE) + if (zb->zb_flags & ZBUF_FLAG_ASSIGNED) return (0); return (1); } @@ -510,7 +510,7 @@ bpf_zerocopy_ioctl_getzmax(struct thread /* * Ioctl to force rotation of the two buffers, if there's any data available. - * This can be used by user space to implement time outs when waiting for a + * This can be used by user space to implement timeouts when waiting for a * buffer to fill. */ int From owner-svn-src-head@FreeBSD.ORG Sat Mar 7 17:07:29 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 DF352106566B; Sat, 7 Mar 2009 17:07:29 +0000 (UTC) (envelope-from csjp@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id CE64C8FC13; Sat, 7 Mar 2009 17:07:29 +0000 (UTC) (envelope-from csjp@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 n27H7Tgx057997; Sat, 7 Mar 2009 17:07:29 GMT (envelope-from csjp@svn.freebsd.org) Received: (from csjp@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n27H7TCk057996; Sat, 7 Mar 2009 17:07:29 GMT (envelope-from csjp@svn.freebsd.org) Message-Id: <200903071707.n27H7TCk057996@svn.freebsd.org> From: "Christian S.J. Peron" Date: Sat, 7 Mar 2009 17:07: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: r189490 - head/sys/net 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, 07 Mar 2009 17:07:30 -0000 Author: csjp Date: Sat Mar 7 17:07:29 2009 New Revision: 189490 URL: http://svn.freebsd.org/changeset/base/189490 Log: Mark the bpf stats sysctl as being mpsafe. We do not require Giant here. Modified: head/sys/net/bpf.c Modified: head/sys/net/bpf.c ============================================================================== --- head/sys/net/bpf.c Sat Mar 7 10:21:37 2009 (r189489) +++ head/sys/net/bpf.c Sat Mar 7 17:07:29 2009 (r189490) @@ -127,7 +127,7 @@ SYSCTL_INT(_net_bpf, OID_AUTO, maxinsns, static int bpf_zerocopy_enable = 1; SYSCTL_INT(_net_bpf, OID_AUTO, zerocopy_enable, CTLFLAG_RW, &bpf_zerocopy_enable, 0, "Enable new zero-copy BPF buffer sessions"); -SYSCTL_NODE(_net_bpf, OID_AUTO, stats, CTLFLAG_RW, +SYSCTL_NODE(_net_bpf, OID_AUTO, stats, CTLFLAG_MPSAFE | CTLFLAG_RW, bpf_stats_sysctl, "bpf statistics portal"); static d_open_t bpfopen; From owner-svn-src-head@FreeBSD.ORG Sat Mar 7 18:08: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 78806106566B; Sat, 7 Mar 2009 18:08:59 +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 66EBB8FC0C; Sat, 7 Mar 2009 18:08:59 +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 n27I8xYA059128; Sat, 7 Mar 2009 18:08:59 GMT (envelope-from thompsa@svn.freebsd.org) Received: (from thompsa@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n27I8xIG059127; Sat, 7 Mar 2009 18:08:59 GMT (envelope-from thompsa@svn.freebsd.org) Message-Id: <200903071808.n27I8xIG059127@svn.freebsd.org> From: Andrew Thompson Date: Sat, 7 Mar 2009 18:08: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: r189491 - head/sys/dev/usb/controller 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, 07 Mar 2009 18:09:00 -0000 Author: thompsa Date: Sat Mar 7 18:08:59 2009 New Revision: 189491 URL: http://svn.freebsd.org/changeset/base/189491 Log: Fix some missed htole32 conversions to htoehci32. Reviewed by: hps Modified: head/sys/dev/usb/controller/ehci.c Modified: head/sys/dev/usb/controller/ehci.c ============================================================================== --- head/sys/dev/usb/controller/ehci.c Sat Mar 7 17:07:29 2009 (r189490) +++ head/sys/dev/usb/controller/ehci.c Sat Mar 7 18:08:59 2009 (r189491) @@ -1776,8 +1776,8 @@ ehci_setup_standard_chain(struct usb2_xf temp.qtd_status &= htoehci32(temp.sc, EHCI_QTD_SET_CERR(3)); - temp.qtd_status |= htole32 - (EHCI_QTD_ACTIVE | + temp.qtd_status |= htoehci32(temp.sc, + EHCI_QTD_ACTIVE | EHCI_QTD_SET_PID(EHCI_QTD_PID_SETUP) | EHCI_QTD_SET_TOGGLE(0)); @@ -2591,13 +2591,13 @@ ehci_device_isoc_fs_enter(struct usb2_xf td->sitd_mask = htoehci32(sc, sitd_mask); if (nframes == 0) { - td->sitd_status = htole32 - (EHCI_SITD_IOC | + td->sitd_status = htoehci32(sc, + EHCI_SITD_IOC | EHCI_SITD_ACTIVE | EHCI_SITD_SET_LEN(*plen)); } else { - td->sitd_status = htole32 - (EHCI_SITD_ACTIVE | + td->sitd_status = htoehci32(sc, + EHCI_SITD_ACTIVE | EHCI_SITD_SET_LEN(*plen)); } usb2_pc_cpu_flush(td->page_cache); @@ -2670,8 +2670,8 @@ ehci_device_isoc_hs_open(struct usb2_xfe td->itd_status[7] = 0; /* set endpoint and address */ - td->itd_bp[0] = htole32 - (EHCI_ITD_SET_ADDR(xfer->address) | + td->itd_bp[0] = htoehci32(sc, + EHCI_ITD_SET_ADDR(xfer->address) | EHCI_ITD_SET_ENDPT(UE_GET_ADDR(xfer->endpoint))); temp = From owner-svn-src-head@FreeBSD.ORG Sat Mar 7 19:08: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 7B94B1065673; Sat, 7 Mar 2009 19:08:59 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 691CA8FC12; Sat, 7 Mar 2009 19:08:59 +0000 (UTC) (envelope-from marius@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 n27J8xwP060401; Sat, 7 Mar 2009 19:08:59 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n27J8w27060398; Sat, 7 Mar 2009 19:08:58 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <200903071908.n27J8w27060398@svn.freebsd.org> From: Marius Strobl Date: Sat, 7 Mar 2009 19:08: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: r189494 - in head/sys: net netinet netinet6 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, 07 Mar 2009 19:08:59 -0000 Author: marius Date: Sat Mar 7 19:08:58 2009 New Revision: 189494 URL: http://svn.freebsd.org/changeset/base/189494 Log: On architectures with strict alignment requirements compensate the misalignment of the IP header that prepending the EtherIP header might have caused. PR: 131921 MFC after: 1 week Modified: head/sys/net/if_gif.h head/sys/netinet/in_gif.c head/sys/netinet6/in6_gif.c Modified: head/sys/net/if_gif.h ============================================================================== --- head/sys/net/if_gif.h Sat Mar 7 18:57:03 2009 (r189493) +++ head/sys/net/if_gif.h Sat Mar 7 19:08:58 2009 (r189494) @@ -100,6 +100,8 @@ struct etherip_header { #define ETHERIP_VER_VERS_MASK 0x0f #define ETHERIP_VER_RSVD_MASK 0xf0 #define ETHERIP_VERSION 0x03 +/* mbuf adjust factor to force 32-bit alignment of IP header */ +#define ETHERIP_ALIGN 2 /* Prototypes */ void gif_input(struct mbuf *, int, struct ifnet *); Modified: head/sys/netinet/in_gif.c ============================================================================== --- head/sys/netinet/in_gif.c Sat Mar 7 18:57:03 2009 (r189493) +++ head/sys/netinet/in_gif.c Sat Mar 7 19:08:58 2009 (r189494) @@ -102,7 +102,7 @@ in_gif_output(struct ifnet *ifp, int fam struct sockaddr_in *sin_dst = (struct sockaddr_in *)sc->gif_pdst; struct ip iphdr; /* capsule IP header, host byte ordered */ struct etherip_header eiphdr; - int proto, error; + int error, len, proto; u_int8_t tos; GIF_LOCK_ASSERT(sc); @@ -186,13 +186,27 @@ in_gif_output(struct ifnet *ifp, int fam &iphdr.ip_tos, &tos); /* prepend new IP header */ - M_PREPEND(m, sizeof(struct ip), M_DONTWAIT); - if (m && m->m_len < sizeof(struct ip)) - m = m_pullup(m, sizeof(struct ip)); + len = sizeof(struct ip); +#ifndef __NO_STRICT_ALIGNMENT + if (family == AF_LINK) + len += ETHERIP_ALIGN; +#endif + M_PREPEND(m, len, M_DONTWAIT); + if (m != NULL && m->m_len < len) + m = m_pullup(m, len); if (m == NULL) { printf("ENOBUFS in in_gif_output %d\n", __LINE__); return ENOBUFS; } +#ifndef __NO_STRICT_ALIGNMENT + if (family == AF_LINK) { + len = mtod(m, vm_offset_t) & 3; + KASSERT(len == 0 || len == ETHERIP_ALIGN, + ("in_gif_output: unexpected misalignment")); + m->m_data += len; + m->m_len -= ETHERIP_ALIGN; + } +#endif bcopy(&iphdr, mtod(m, struct ip *), sizeof(struct ip)); M_SETFIB(m, sc->gif_fibnum); Modified: head/sys/netinet6/in6_gif.c ============================================================================== --- head/sys/netinet6/in6_gif.c Sat Mar 7 18:57:03 2009 (r189493) +++ head/sys/netinet6/in6_gif.c Sat Mar 7 19:08:58 2009 (r189494) @@ -98,7 +98,7 @@ in6_gif_output(struct ifnet *ifp, struct sockaddr_in6 *sin6_dst = (struct sockaddr_in6 *)sc->gif_pdst; struct ip6_hdr *ip6; struct etherip_header eiphdr; - int proto, error; + int error, len, proto; u_int8_t itos, otos; GIF_LOCK_ASSERT(sc); @@ -166,13 +166,27 @@ in6_gif_output(struct ifnet *ifp, } /* prepend new IP header */ - M_PREPEND(m, sizeof(struct ip6_hdr), M_DONTWAIT); - if (m && m->m_len < sizeof(struct ip6_hdr)) - m = m_pullup(m, sizeof(struct ip6_hdr)); + len = sizeof(struct ip6_hdr); +#ifndef __NO_STRICT_ALIGNMENT + if (family == AF_LINK) + len += ETHERIP_ALIGN; +#endif + M_PREPEND(m, len, M_DONTWAIT); + if (m != NULL && m->m_len < len) + m = m_pullup(m, len); if (m == NULL) { printf("ENOBUFS in in6_gif_output %d\n", __LINE__); return ENOBUFS; } +#ifndef __NO_STRICT_ALIGNMENT + if (family == AF_LINK) { + len = mtod(m, vm_offset_t) & 3; + KASSERT(len == 0 || len == ETHERIP_ALIGN, + ("in6_gif_output: unexpected misalignment")); + m->m_data += len; + m->m_len -= ETHERIP_ALIGN; + } +#endif ip6 = mtod(m, struct ip6_hdr *); ip6->ip6_flow = 0; From owner-svn-src-head@FreeBSD.ORG Sat Mar 7 19:49:47 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 A990F1065672; Sat, 7 Mar 2009 19:49:47 +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 952BD8FC1B; Sat, 7 Mar 2009 19:49:47 +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 n27Jnlvs061194; Sat, 7 Mar 2009 19:49:47 GMT (envelope-from thompsa@svn.freebsd.org) Received: (from thompsa@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n27JnlTM061191; Sat, 7 Mar 2009 19:49:47 GMT (envelope-from thompsa@svn.freebsd.org) Message-Id: <200903071949.n27JnlTM061191@svn.freebsd.org> From: Andrew Thompson Date: Sat, 7 Mar 2009 19:49: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: r189496 - head/sys/dev/usb/controller 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, 07 Mar 2009 19:49:48 -0000 Author: thompsa Date: Sat Mar 7 19:49:47 2009 New Revision: 189496 URL: http://svn.freebsd.org/changeset/base/189496 Log: (re)merge r186415,186416 from the old usb stack; o add Transaction Translator support (still missing ISOC xfers) o add EHCI_SCFLG_BIGEMMIO flag to force big-endian byte-select to be set in USBMODE o split reset work into new public routine ehci_reset so bus shim drivers can force big-endian byte-select before ehci_init o enable TT and big-endian MMIO o force a reset before ehci_init to get byte-select setup Also go back to using USB_EHCI_BIG_ENDIAN_DESC at compile time to enable the byteswapping and reduce diffs to the original commits. This fixes the new USB stack on the Cambria board. Modified: head/sys/dev/usb/controller/ehci.c head/sys/dev/usb/controller/ehci.h head/sys/dev/usb/controller/ehci_ixp4xx.c Modified: head/sys/dev/usb/controller/ehci.c ============================================================================== --- head/sys/dev/usb/controller/ehci.c Sat Mar 7 19:13:59 2009 (r189495) +++ head/sys/dev/usb/controller/ehci.c Sat Mar 7 19:49:47 2009 (r189496) @@ -120,23 +120,6 @@ struct ehci_std_temp { uint8_t short_frames_ok; }; -/* - * Byte-order conversion functions. - */ -static uint32_t -htoehci32(ehci_softc_t *sc, const uint32_t v) -{ - return ((sc->sc_flags & EHCI_SCFLG_BIGEDESC) ? - htobe32(v) : htole32(v)); -} - -static uint32_t -ehci32toh(ehci_softc_t *sc, const uint32_t v) -{ - return ((sc->sc_flags & EHCI_SCFLG_BIGEDESC) ? - be32toh(v) : le32toh(v)); -} - void ehci_iterate_hw_softc(struct usb2_bus *bus, usb2_bus_mem_sub_cb_t *cb) { @@ -168,45 +151,64 @@ ehci_iterate_hw_softc(struct usb2_bus *b } } -static usb2_error_t -ehci_hc_reset(ehci_softc_t *sc) +usb2_error_t +ehci_reset(ehci_softc_t *sc) { uint32_t hcr; - uint32_t n; - - EOWRITE4(sc, EHCI_USBCMD, 0); /* Halt controller */ + int i; - for (n = 0; n != 100; n++) { - usb2_pause_mtx(&sc->sc_bus.bus_mtx, hz / 1000); - hcr = EOREAD4(sc, EHCI_USBSTS); - if (hcr & EHCI_STS_HCH) { - hcr = 0; - break; + EOWRITE4(sc, EHCI_USBCMD, EHCI_CMD_HCRESET); + for (i = 0; i < 100; i++) { + usb2_pause_mtx(NULL, hz / 1000); + hcr = EOREAD4(sc, EHCI_USBCMD) & EHCI_CMD_HCRESET; + if (!hcr) { + if (sc->sc_flags & (EHCI_SCFLG_SETMODE | EHCI_SCFLG_BIGEMMIO)) { + /* + * Force USBMODE as requested. Controllers + * may have multiple operating modes. + */ + uint32_t usbmode = EOREAD4(sc, EHCI_USBMODE); + if (sc->sc_flags & EHCI_SCFLG_SETMODE) { + usbmode = (usbmode &~ EHCI_UM_CM) | EHCI_UM_CM_HOST; + device_printf(sc->sc_bus.bdev, + "set host controller mode\n"); + } + if (sc->sc_flags & EHCI_SCFLG_BIGEMMIO) { + usbmode = (usbmode &~ EHCI_UM_ES) | EHCI_UM_ES_BE; + device_printf(sc->sc_bus.bdev, + "set big-endian mode\n"); + } + EOWRITE4(sc, EHCI_USBMODE, usbmode); + } + return (0); } } + device_printf(sc->sc_bus.bdev, "reset timeout\n"); + return (USB_ERR_IOERROR); +} - /* - * Fall through and try reset anyway even though - * Table 2-9 in the EHCI spec says this will result - * in undefined behavior. - */ +static usb2_error_t +ehci_hcreset(ehci_softc_t *sc) +{ + uint32_t hcr; + int i; - EOWRITE4(sc, EHCI_USBCMD, EHCI_CMD_HCRESET); - for (n = 0; n != 100; n++) { - usb2_pause_mtx(&sc->sc_bus.bus_mtx, hz / 1000); - hcr = EOREAD4(sc, EHCI_USBCMD); - if (!(hcr & EHCI_CMD_HCRESET)) { - if (sc->sc_flags & EHCI_SCFLG_SETMODE) - EOWRITE4(sc, 0x68, 0x3); - hcr = 0; + EOWRITE4(sc, EHCI_USBCMD, 0); /* Halt controller */ + for (i = 0; i < 100; i++) { + usb2_pause_mtx(NULL, hz / 1000); + hcr = EOREAD4(sc, EHCI_USBSTS) & EHCI_STS_HCH; + if (hcr) break; - } } + if (!hcr) + /* + * Fall through and try reset anyway even though + * Table 2-9 in the EHCI spec says this will result + * in undefined behavior. + */ + device_printf(sc->sc_bus.bdev, "stop timeout\n"); - if (hcr) { - return (USB_ERR_IOERROR); - } - return (0); + return ehci_reset(sc); } usb2_error_t @@ -257,9 +259,7 @@ ehci_init(ehci_softc_t *sc) /* Reset the controller */ DPRINTF("%s: resetting\n", device_get_nameunit(sc->sc_bus.bdev)); - USB_BUS_LOCK(&sc->sc_bus); - err = ehci_hc_reset(sc); - USB_BUS_UNLOCK(&sc->sc_bus); + err = ehci_hcreset(sc); if (err) { device_printf(sc->sc_bus.bdev, "reset timeout\n"); return (err); @@ -293,21 +293,21 @@ ehci_init(ehci_softc_t *sc) sc->sc_intr_p_last[i] = qh; qh->qh_self = - htoehci32(sc, buf_res.physaddr) | - htoehci32(sc, EHCI_LINK_QH); + htohc32(sc, buf_res.physaddr) | + htohc32(sc, EHCI_LINK_QH); qh->qh_endp = - htoehci32(sc, EHCI_QH_SET_EPS(EHCI_QH_SPEED_HIGH)); + htohc32(sc, EHCI_QH_SET_EPS(EHCI_QH_SPEED_HIGH)); qh->qh_endphub = - htoehci32(sc, EHCI_QH_SET_MULT(1)); + htohc32(sc, EHCI_QH_SET_MULT(1)); qh->qh_curqtd = 0; qh->qh_qtd.qtd_next = - htoehci32(sc, EHCI_LINK_TERMINATE); + htohc32(sc, EHCI_LINK_TERMINATE); qh->qh_qtd.qtd_altnext = - htoehci32(sc, EHCI_LINK_TERMINATE); + htohc32(sc, EHCI_LINK_TERMINATE); qh->qh_qtd.qtd_status = - htoehci32(sc, EHCI_QTD_HALTED); + htohc32(sc, EHCI_QTD_HALTED); } /* @@ -342,7 +342,7 @@ ehci_init(ehci_softc_t *sc) qh = sc->sc_intr_p_last[0]; /* the last (1ms) QH terminates */ - qh->qh_link = htoehci32(sc, EHCI_LINK_TERMINATE); + qh->qh_link = htohc32(sc, EHCI_LINK_TERMINATE); } for (i = 0; i < EHCI_VIRTUAL_FRAMELIST_COUNT; i++) { ehci_sitd_t *sitd; @@ -363,11 +363,11 @@ ehci_init(ehci_softc_t *sc) /* initialize full speed isochronous */ sitd->sitd_self = - htoehci32(sc, buf_res.physaddr) | - htoehci32(sc, EHCI_LINK_SITD); + htohc32(sc, buf_res.physaddr) | + htohc32(sc, EHCI_LINK_SITD); sitd->sitd_back = - htoehci32(sc, EHCI_LINK_TERMINATE); + htohc32(sc, EHCI_LINK_TERMINATE); sitd->sitd_next = sc->sc_intr_p_last[i | (EHCI_VIRTUAL_FRAMELIST_COUNT / 2)]->qh_self; @@ -388,8 +388,8 @@ ehci_init(ehci_softc_t *sc) /* initialize high speed isochronous */ itd->itd_self = - htoehci32(sc, buf_res.physaddr) | - htoehci32(sc, EHCI_LINK_ITD); + htohc32(sc, buf_res.physaddr) | + htohc32(sc, EHCI_LINK_ITD); itd->itd_next = sitd->sitd_self; @@ -434,20 +434,20 @@ ehci_init(ehci_softc_t *sc) /* init dummy QH that starts the async list */ qh->qh_self = - htoehci32(sc, buf_res.physaddr) | - htoehci32(sc, EHCI_LINK_QH); + htohc32(sc, buf_res.physaddr) | + htohc32(sc, EHCI_LINK_QH); /* fill the QH */ qh->qh_endp = - htoehci32(sc, EHCI_QH_SET_EPS(EHCI_QH_SPEED_HIGH) | EHCI_QH_HRECL); - qh->qh_endphub = htoehci32(sc, EHCI_QH_SET_MULT(1)); + htohc32(sc, EHCI_QH_SET_EPS(EHCI_QH_SPEED_HIGH) | EHCI_QH_HRECL); + qh->qh_endphub = htohc32(sc, EHCI_QH_SET_MULT(1)); qh->qh_link = qh->qh_self; qh->qh_curqtd = 0; /* fill the overlay qTD */ - qh->qh_qtd.qtd_next = htoehci32(sc, EHCI_LINK_TERMINATE); - qh->qh_qtd.qtd_altnext = htoehci32(sc, EHCI_LINK_TERMINATE); - qh->qh_qtd.qtd_status = htoehci32(sc, EHCI_QTD_HALTED); + qh->qh_qtd.qtd_next = htohc32(sc, EHCI_LINK_TERMINATE); + qh->qh_qtd.qtd_altnext = htohc32(sc, EHCI_LINK_TERMINATE); + qh->qh_qtd.qtd_status = htohc32(sc, EHCI_QTD_HALTED); } /* flush all cache into memory */ @@ -507,13 +507,12 @@ ehci_detach(ehci_softc_t *sc) usb2_callout_stop(&sc->sc_tmo_pcd); EOWRITE4(sc, EHCI_USBINTR, sc->sc_eintrs); + USB_BUS_UNLOCK(&sc->sc_bus); - if (ehci_hc_reset(sc)) { + if (ehci_hcreset(sc)) { DPRINTF("reset failed!\n"); } - USB_BUS_UNLOCK(&sc->sc_bus); - /* XXX let stray task complete */ usb2_pause_mtx(NULL, hz / 20); @@ -646,12 +645,9 @@ ehci_shutdown(ehci_softc_t *sc) { DPRINTF("stopping the HC\n"); - USB_BUS_LOCK(&sc->sc_bus); - - if (ehci_hc_reset(sc)) { + if (ehci_hcreset(sc)) { DPRINTF("reset failed!\n"); } - USB_BUS_UNLOCK(&sc->sc_bus); } #if USB_DEBUG @@ -737,7 +733,7 @@ ehci_dump_regs(ehci_softc_t *sc) static void ehci_dump_link(ehci_softc_t *sc, uint32_t link, int type) { - link = ehci32toh(sc, link); + link = hc32toh(sc, link); printf("0x%08x", link); if (link & EHCI_LINK_TERMINATE) printf(""); @@ -773,7 +769,7 @@ ehci_dump_qtd(ehci_softc_t *sc, ehci_qtd printf(" altnext="); ehci_dump_link(sc, qtd->qtd_altnext, 0); printf("\n"); - s = ehci32toh(sc, qtd->qtd_status); + s = hc32toh(sc, qtd->qtd_status); printf(" status=0x%08x: toggle=%d bytes=0x%x ioc=%d c_page=0x%x\n", s, EHCI_QTD_GET_TOGGLE(s), EHCI_QTD_GET_BYTES(s), EHCI_QTD_GET_IOC(s), EHCI_QTD_GET_C_PAGE(s)); @@ -790,11 +786,11 @@ ehci_dump_qtd(ehci_softc_t *sc, ehci_qtd for (s = 0; s < 5; s++) { printf(" buffer[%d]=0x%08x\n", s, - ehci32toh(sc, qtd->qtd_buffer[s])); + hc32toh(sc, qtd->qtd_buffer[s])); } for (s = 0; s < 5; s++) { printf(" buffer_hi[%d]=0x%08x\n", s, - ehci32toh(sc, qtd->qtd_buffer_hi[s])); + hc32toh(sc, qtd->qtd_buffer_hi[s])); } } @@ -804,9 +800,9 @@ ehci_dump_sqtd(ehci_softc_t *sc, ehci_qt uint8_t temp; usb2_pc_cpu_invalidate(sqtd->page_cache); - printf("QTD(%p) at 0x%08x:\n", sqtd, ehci32toh(sc, sqtd->qtd_self)); + printf("QTD(%p) at 0x%08x:\n", sqtd, hc32toh(sc, sqtd->qtd_self)); ehci_dump_qtd(sc, sqtd); - temp = (sqtd->qtd_next & htoehci32(sc, EHCI_LINK_TERMINATE)) ? 1 : 0; + temp = (sqtd->qtd_next & htohc32(sc, EHCI_LINK_TERMINATE)) ? 1 : 0; return (temp); } @@ -832,11 +828,11 @@ ehci_dump_sqh(ehci_softc_t *sc, ehci_qh_ uint32_t endphub; usb2_pc_cpu_invalidate(qh->page_cache); - printf("QH(%p) at 0x%08x:\n", qh, ehci32toh(sc, qh->qh_self) & ~0x1F); + printf("QH(%p) at 0x%08x:\n", qh, hc32toh(sc, qh->qh_self) & ~0x1F); printf(" link="); ehci_dump_link(sc, qh->qh_link, 1); printf("\n"); - endp = ehci32toh(sc, qh->qh_endp); + endp = hc32toh(sc, qh->qh_endp); printf(" endp=0x%08x\n", endp); printf(" addr=0x%02x inact=%d endpt=%d eps=%d dtc=%d hrecl=%d\n", EHCI_QH_GET_ADDR(endp), EHCI_QH_GET_INACT(endp), @@ -845,7 +841,7 @@ ehci_dump_sqh(ehci_softc_t *sc, ehci_qh_ printf(" mpl=0x%x ctl=%d nrl=%d\n", EHCI_QH_GET_MPL(endp), EHCI_QH_GET_CTL(endp), EHCI_QH_GET_NRL(endp)); - endphub = ehci32toh(sc, qh->qh_endphub); + endphub = hc32toh(sc, qh->qh_endphub); printf(" endphub=0x%08x\n", endphub); printf(" smask=0x%02x cmask=0x%02x huba=0x%02x port=%d mult=%d\n", EHCI_QH_GET_SMASK(endphub), EHCI_QH_GET_CMASK(endphub), @@ -862,73 +858,73 @@ static void ehci_dump_sitd(ehci_softc_t *sc, ehci_sitd_t *sitd) { usb2_pc_cpu_invalidate(sitd->page_cache); - printf("SITD(%p) at 0x%08x\n", sitd, ehci32toh(sc, sitd->sitd_self) & ~0x1F); - printf(" next=0x%08x\n", ehci32toh(sc, sitd->sitd_next)); + printf("SITD(%p) at 0x%08x\n", sitd, hc32toh(sc, sitd->sitd_self) & ~0x1F); + printf(" next=0x%08x\n", hc32toh(sc, sitd->sitd_next)); printf(" portaddr=0x%08x dir=%s addr=%d endpt=0x%x port=0x%x huba=0x%x\n", - ehci32toh(sc, sitd->sitd_portaddr), - (sitd->sitd_portaddr & htoehci32(sc, EHCI_SITD_SET_DIR_IN)) + hc32toh(sc, sitd->sitd_portaddr), + (sitd->sitd_portaddr & htohc32(sc, EHCI_SITD_SET_DIR_IN)) ? "in" : "out", - EHCI_SITD_GET_ADDR(ehci32toh(sc, sitd->sitd_portaddr)), - EHCI_SITD_GET_ENDPT(ehci32toh(sc, sitd->sitd_portaddr)), - EHCI_SITD_GET_PORT(ehci32toh(sc, sitd->sitd_portaddr)), - EHCI_SITD_GET_HUBA(ehci32toh(sc, sitd->sitd_portaddr))); - printf(" mask=0x%08x\n", ehci32toh(sc, sitd->sitd_mask)); - printf(" status=0x%08x <%s> len=0x%x\n", ehci32toh(sc, sitd->sitd_status), - (sitd->sitd_status & htoehci32(sc, EHCI_SITD_ACTIVE)) ? "ACTIVE" : "", - EHCI_SITD_GET_LEN(ehci32toh(sc, sitd->sitd_status))); + EHCI_SITD_GET_ADDR(hc32toh(sc, sitd->sitd_portaddr)), + EHCI_SITD_GET_ENDPT(hc32toh(sc, sitd->sitd_portaddr)), + EHCI_SITD_GET_PORT(hc32toh(sc, sitd->sitd_portaddr)), + EHCI_SITD_GET_HUBA(hc32toh(sc, sitd->sitd_portaddr))); + printf(" mask=0x%08x\n", hc32toh(sc, sitd->sitd_mask)); + printf(" status=0x%08x <%s> len=0x%x\n", hc32toh(sc, sitd->sitd_status), + (sitd->sitd_status & htohc32(sc, EHCI_SITD_ACTIVE)) ? "ACTIVE" : "", + EHCI_SITD_GET_LEN(hc32toh(sc, sitd->sitd_status))); printf(" back=0x%08x, bp=0x%08x,0x%08x,0x%08x,0x%08x\n", - ehci32toh(sc, sitd->sitd_back), - ehci32toh(sc, sitd->sitd_bp[0]), - ehci32toh(sc, sitd->sitd_bp[1]), - ehci32toh(sc, sitd->sitd_bp_hi[0]), - ehci32toh(sc, sitd->sitd_bp_hi[1])); + hc32toh(sc, sitd->sitd_back), + hc32toh(sc, sitd->sitd_bp[0]), + hc32toh(sc, sitd->sitd_bp[1]), + hc32toh(sc, sitd->sitd_bp_hi[0]), + hc32toh(sc, sitd->sitd_bp_hi[1])); } static void ehci_dump_itd(ehci_softc_t *sc, ehci_itd_t *itd) { usb2_pc_cpu_invalidate(itd->page_cache); - printf("ITD(%p) at 0x%08x\n", itd, ehci32toh(sc, itd->itd_self) & ~0x1F); - printf(" next=0x%08x\n", ehci32toh(sc, itd->itd_next)); - printf(" status[0]=0x%08x; <%s>\n", ehci32toh(sc, itd->itd_status[0]), - (itd->itd_status[0] & htoehci32(sc, EHCI_ITD_ACTIVE)) ? "ACTIVE" : ""); - printf(" status[1]=0x%08x; <%s>\n", ehci32toh(sc, itd->itd_status[1]), - (itd->itd_status[1] & htoehci32(sc, EHCI_ITD_ACTIVE)) ? "ACTIVE" : ""); - printf(" status[2]=0x%08x; <%s>\n", ehci32toh(sc, itd->itd_status[2]), - (itd->itd_status[2] & htoehci32(sc, EHCI_ITD_ACTIVE)) ? "ACTIVE" : ""); - printf(" status[3]=0x%08x; <%s>\n", ehci32toh(sc, itd->itd_status[3]), - (itd->itd_status[3] & htoehci32(sc, EHCI_ITD_ACTIVE)) ? "ACTIVE" : ""); - printf(" status[4]=0x%08x; <%s>\n", ehci32toh(sc, itd->itd_status[4]), - (itd->itd_status[4] & htoehci32(sc, EHCI_ITD_ACTIVE)) ? "ACTIVE" : ""); - printf(" status[5]=0x%08x; <%s>\n", ehci32toh(sc, itd->itd_status[5]), - (itd->itd_status[5] & htoehci32(sc, EHCI_ITD_ACTIVE)) ? "ACTIVE" : ""); - printf(" status[6]=0x%08x; <%s>\n", ehci32toh(sc, itd->itd_status[6]), - (itd->itd_status[6] & htoehci32(sc, EHCI_ITD_ACTIVE)) ? "ACTIVE" : ""); - printf(" status[7]=0x%08x; <%s>\n", ehci32toh(sc, itd->itd_status[7]), - (itd->itd_status[7] & htoehci32(sc, EHCI_ITD_ACTIVE)) ? "ACTIVE" : ""); - printf(" bp[0]=0x%08x\n", ehci32toh(sc, itd->itd_bp[0])); + printf("ITD(%p) at 0x%08x\n", itd, hc32toh(sc, itd->itd_self) & ~0x1F); + printf(" next=0x%08x\n", hc32toh(sc, itd->itd_next)); + printf(" status[0]=0x%08x; <%s>\n", hc32toh(sc, itd->itd_status[0]), + (itd->itd_status[0] & htohc32(sc, EHCI_ITD_ACTIVE)) ? "ACTIVE" : ""); + printf(" status[1]=0x%08x; <%s>\n", hc32toh(sc, itd->itd_status[1]), + (itd->itd_status[1] & htohc32(sc, EHCI_ITD_ACTIVE)) ? "ACTIVE" : ""); + printf(" status[2]=0x%08x; <%s>\n", hc32toh(sc, itd->itd_status[2]), + (itd->itd_status[2] & htohc32(sc, EHCI_ITD_ACTIVE)) ? "ACTIVE" : ""); + printf(" status[3]=0x%08x; <%s>\n", hc32toh(sc, itd->itd_status[3]), + (itd->itd_status[3] & htohc32(sc, EHCI_ITD_ACTIVE)) ? "ACTIVE" : ""); + printf(" status[4]=0x%08x; <%s>\n", hc32toh(sc, itd->itd_status[4]), + (itd->itd_status[4] & htohc32(sc, EHCI_ITD_ACTIVE)) ? "ACTIVE" : ""); + printf(" status[5]=0x%08x; <%s>\n", hc32toh(sc, itd->itd_status[5]), + (itd->itd_status[5] & htohc32(sc, EHCI_ITD_ACTIVE)) ? "ACTIVE" : ""); + printf(" status[6]=0x%08x; <%s>\n", hc32toh(sc, itd->itd_status[6]), + (itd->itd_status[6] & htohc32(sc, EHCI_ITD_ACTIVE)) ? "ACTIVE" : ""); + printf(" status[7]=0x%08x; <%s>\n", hc32toh(sc, itd->itd_status[7]), + (itd->itd_status[7] & htohc32(sc, EHCI_ITD_ACTIVE)) ? "ACTIVE" : ""); + printf(" bp[0]=0x%08x\n", hc32toh(sc, itd->itd_bp[0])); printf(" addr=0x%02x; endpt=0x%01x\n", - EHCI_ITD_GET_ADDR(ehci32toh(sc, itd->itd_bp[0])), - EHCI_ITD_GET_ENDPT(ehci32toh(sc, itd->itd_bp[0]))); - printf(" bp[1]=0x%08x\n", ehci32toh(sc, itd->itd_bp[1])); + EHCI_ITD_GET_ADDR(hc32toh(sc, itd->itd_bp[0])), + EHCI_ITD_GET_ENDPT(hc32toh(sc, itd->itd_bp[0]))); + printf(" bp[1]=0x%08x\n", hc32toh(sc, itd->itd_bp[1])); printf(" dir=%s; mpl=0x%02x\n", - (ehci32toh(sc, itd->itd_bp[1]) & EHCI_ITD_SET_DIR_IN) ? "in" : "out", - EHCI_ITD_GET_MPL(ehci32toh(sc, itd->itd_bp[1]))); + (hc32toh(sc, itd->itd_bp[1]) & EHCI_ITD_SET_DIR_IN) ? "in" : "out", + EHCI_ITD_GET_MPL(hc32toh(sc, itd->itd_bp[1]))); printf(" bp[2..6]=0x%08x,0x%08x,0x%08x,0x%08x,0x%08x\n", - ehci32toh(sc, itd->itd_bp[2]), - ehci32toh(sc, itd->itd_bp[3]), - ehci32toh(sc, itd->itd_bp[4]), - ehci32toh(sc, itd->itd_bp[5]), - ehci32toh(sc, itd->itd_bp[6])); + hc32toh(sc, itd->itd_bp[2]), + hc32toh(sc, itd->itd_bp[3]), + hc32toh(sc, itd->itd_bp[4]), + hc32toh(sc, itd->itd_bp[5]), + hc32toh(sc, itd->itd_bp[6])); printf(" bp_hi=0x%08x,0x%08x,0x%08x,0x%08x,\n" " 0x%08x,0x%08x,0x%08x\n", - ehci32toh(sc, itd->itd_bp_hi[0]), - ehci32toh(sc, itd->itd_bp_hi[1]), - ehci32toh(sc, itd->itd_bp_hi[2]), - ehci32toh(sc, itd->itd_bp_hi[3]), - ehci32toh(sc, itd->itd_bp_hi[4]), - ehci32toh(sc, itd->itd_bp_hi[5]), - ehci32toh(sc, itd->itd_bp_hi[6])); + hc32toh(sc, itd->itd_bp_hi[0]), + hc32toh(sc, itd->itd_bp_hi[1]), + hc32toh(sc, itd->itd_bp_hi[2]), + hc32toh(sc, itd->itd_bp_hi[3]), + hc32toh(sc, itd->itd_bp_hi[4]), + hc32toh(sc, itd->itd_bp_hi[5]), + hc32toh(sc, itd->itd_bp_hi[6])); } static void @@ -1148,7 +1144,7 @@ ehci_non_isoc_done_sub(struct usb2_xfer while (1) { usb2_pc_cpu_invalidate(td->page_cache); - status = ehci32toh(sc, td->qtd_status); + status = hc32toh(sc, td->qtd_status); len = EHCI_QTD_GET_BYTES(status); @@ -1305,13 +1301,13 @@ ehci_check_transfer(struct usb2_xfer *xf td = xfer->td_transfer_last; usb2_pc_cpu_invalidate(td->page_cache); - status = ehci32toh(sc, td->sitd_status); + status = hc32toh(sc, td->sitd_status); /* also check if first is complete */ td = xfer->td_transfer_first; usb2_pc_cpu_invalidate(td->page_cache); - status |= ehci32toh(sc, td->sitd_status); + status |= hc32toh(sc, td->sitd_status); if (!(status & EHCI_SITD_ACTIVE)) { ehci_device_done(xfer, USB_ERR_NORMAL_COMPLETION); @@ -1340,7 +1336,7 @@ ehci_check_transfer(struct usb2_xfer *xf td->itd_status[6] | td->itd_status[7]; /* if no transactions are active we continue */ - if (!(status & htoehci32(sc, EHCI_ITD_ACTIVE))) { + if (!(status & htohc32(sc, EHCI_ITD_ACTIVE))) { ehci_device_done(xfer, USB_ERR_NORMAL_COMPLETION); goto transferred; } @@ -1357,7 +1353,7 @@ ehci_check_transfer(struct usb2_xfer *xf while (1) { usb2_pc_cpu_invalidate(td->page_cache); - status = ehci32toh(sc, td->qtd_status); + status = hc32toh(sc, td->qtd_status); /* * if there is an active TD the transfer isn't done @@ -1553,7 +1549,7 @@ ehci_setup_standard_chain_sub(struct ehc uint8_t shortpkt_old; uint8_t precompute; - qtd_altnext = htoehci32(temp->sc, EHCI_LINK_TERMINATE); + qtd_altnext = htohc32(temp->sc, EHCI_LINK_TERMINATE); td_alt_next = NULL; buf_offset = 0; shortpkt_old = temp->shortpkt; @@ -1611,7 +1607,7 @@ restart: td->qtd_status = temp->qtd_status | - htoehci32(temp->sc, EHCI_QTD_SET_BYTES(average)); + htohc32(temp->sc, EHCI_QTD_SET_BYTES(average)); if (average == 0) { @@ -1620,7 +1616,7 @@ restart: /* update data toggle, ZLP case */ temp->qtd_status ^= - htoehci32(temp->sc, EHCI_QTD_TOGGLE_MASK); + htohc32(temp->sc, EHCI_QTD_TOGGLE_MASK); } td->len = 0; @@ -1641,7 +1637,7 @@ restart: if (((average + temp->max_frame_size - 1) / temp->max_frame_size) & 1) { temp->qtd_status ^= - htoehci32(temp->sc, EHCI_QTD_TOGGLE_MASK); + htohc32(temp->sc, EHCI_QTD_TOGGLE_MASK); } } td->len = average; @@ -1654,7 +1650,7 @@ restart: usb2_get_page(temp->pc, buf_offset, &buf_res); td->qtd_buffer[0] = - htoehci32(temp->sc, buf_res.physaddr); + htohc32(temp->sc, buf_res.physaddr); td->qtd_buffer_hi[0] = 0; x = 1; @@ -1664,7 +1660,7 @@ restart: buf_offset += EHCI_PAGE_SIZE; usb2_get_page(temp->pc, buf_offset, &buf_res); td->qtd_buffer[x] = - htoehci32(temp->sc, + htohc32(temp->sc, buf_res.physaddr & (~0xFFF)); td->qtd_buffer_hi[x] = 0; x++; @@ -1681,7 +1677,7 @@ restart: buf_offset += average; usb2_get_page(temp->pc, buf_offset - 1, &buf_res); td->qtd_buffer[x] = - htoehci32(temp->sc, + htohc32(temp->sc, buf_res.physaddr & (~0xFFF)); td->qtd_buffer_hi[x] = 0; } @@ -1757,7 +1753,7 @@ ehci_setup_standard_chain(struct usb2_xf if (xfer->pipe->toggle_next) { /* DATA1 is next */ temp.qtd_status |= - htoehci32(temp.sc, EHCI_QTD_SET_TOGGLE(1)); + htohc32(temp.sc, EHCI_QTD_SET_TOGGLE(1)); } temp.auto_data_toggle = 0; } else { @@ -1767,7 +1763,7 @@ ehci_setup_standard_chain(struct usb2_xf if (usb2_get_speed(xfer->xroot->udev) != USB_SPEED_HIGH) { /* max 3 retries */ temp.qtd_status |= - htoehci32(temp.sc, EHCI_QTD_SET_CERR(3)); + htohc32(temp.sc, EHCI_QTD_SET_CERR(3)); } /* check if we should prepend a setup message */ @@ -1775,8 +1771,8 @@ ehci_setup_standard_chain(struct usb2_xf if (xfer->flags_int.control_hdr) { temp.qtd_status &= - htoehci32(temp.sc, EHCI_QTD_SET_CERR(3)); - temp.qtd_status |= htoehci32(temp.sc, + htohc32(temp.sc, EHCI_QTD_SET_CERR(3)); + temp.qtd_status |= htohc32(temp.sc, EHCI_QTD_ACTIVE | EHCI_QTD_SET_PID(EHCI_QTD_PID_SETUP) | EHCI_QTD_SET_TOGGLE(0)); @@ -1807,7 +1803,7 @@ ehci_setup_standard_chain(struct usb2_xf /* keep previous data toggle and error count */ temp.qtd_status &= - htoehci32(temp.sc, EHCI_QTD_SET_CERR(3) | + htohc32(temp.sc, EHCI_QTD_SET_CERR(3) | EHCI_QTD_SET_TOGGLE(1)); if (temp.len == 0) { @@ -1827,9 +1823,9 @@ ehci_setup_standard_chain(struct usb2_xf temp.qtd_status |= (UE_GET_DIR(xfer->endpoint) == UE_DIR_IN) ? - htoehci32(temp.sc, EHCI_QTD_ACTIVE | + htohc32(temp.sc, EHCI_QTD_ACTIVE | EHCI_QTD_SET_PID(EHCI_QTD_PID_IN)) : - htoehci32(temp.sc, EHCI_QTD_ACTIVE | + htohc32(temp.sc, EHCI_QTD_ACTIVE | EHCI_QTD_SET_PID(EHCI_QTD_PID_OUT)); ehci_setup_standard_chain_sub(&temp); @@ -1845,14 +1841,14 @@ ehci_setup_standard_chain(struct usb2_xf * direction. */ - temp.qtd_status &= htoehci32(temp.sc, EHCI_QTD_SET_CERR(3) | + temp.qtd_status &= htohc32(temp.sc, EHCI_QTD_SET_CERR(3) | EHCI_QTD_SET_TOGGLE(1)); temp.qtd_status |= (UE_GET_DIR(xfer->endpoint) == UE_DIR_OUT) ? - htoehci32(temp.sc, EHCI_QTD_ACTIVE | + htohc32(temp.sc, EHCI_QTD_ACTIVE | EHCI_QTD_SET_PID(EHCI_QTD_PID_IN) | EHCI_QTD_SET_TOGGLE(1)) : - htoehci32(temp.sc, EHCI_QTD_ACTIVE | + htohc32(temp.sc, EHCI_QTD_ACTIVE | EHCI_QTD_SET_PID(EHCI_QTD_PID_OUT) | EHCI_QTD_SET_TOGGLE(1)); @@ -1865,9 +1861,9 @@ ehci_setup_standard_chain(struct usb2_xf td = temp.td; /* the last TD terminates the transfer: */ - td->qtd_next = htoehci32(temp.sc, EHCI_LINK_TERMINATE); - td->qtd_altnext = htoehci32(temp.sc, EHCI_LINK_TERMINATE); - td->qtd_status |= htoehci32(temp.sc, EHCI_QTD_IOC); + td->qtd_next = htohc32(temp.sc, EHCI_LINK_TERMINATE); + td->qtd_altnext = htohc32(temp.sc, EHCI_LINK_TERMINATE); + td->qtd_status |= htohc32(temp.sc, EHCI_QTD_IOC); usb2_pc_cpu_flush(td->page_cache); @@ -1919,7 +1915,7 @@ ehci_setup_standard_chain(struct usb2_xf } } - qh->qh_endp = htoehci32(temp.sc, qh_endp); + qh->qh_endp = htohc32(temp.sc, qh_endp); qh_endphub = (EHCI_QH_SET_MULT(xfer->max_packet_count & 3) | @@ -1928,29 +1924,29 @@ ehci_setup_standard_chain(struct usb2_xf EHCI_QH_SET_HUBA(xfer->xroot->udev->hs_hub_addr) | EHCI_QH_SET_PORT(xfer->xroot->udev->hs_port_no)); - qh->qh_endphub = htoehci32(temp.sc, qh_endphub); - qh->qh_curqtd = htoehci32(temp.sc, 0); + qh->qh_endphub = htohc32(temp.sc, qh_endphub); + qh->qh_curqtd = htohc32(temp.sc, 0); /* fill the overlay qTD */ - qh->qh_qtd.qtd_status = htoehci32(temp.sc, 0); + qh->qh_qtd.qtd_status = htohc32(temp.sc, 0); if (temp.auto_data_toggle) { /* let the hardware compute the data toggle */ - qh->qh_endp &= htoehci32(temp.sc, ~EHCI_QH_DTC); + qh->qh_endp &= htohc32(temp.sc, ~EHCI_QH_DTC); if (xfer->pipe->toggle_next) { /* DATA1 is next */ qh->qh_qtd.qtd_status |= - htoehci32(temp.sc, EHCI_QTD_SET_TOGGLE(1)); + htohc32(temp.sc, EHCI_QTD_SET_TOGGLE(1)); } } td = xfer->td_transfer_first; qh->qh_qtd.qtd_next = td->qtd_self; qh->qh_qtd.qtd_altnext = - htoehci32(temp.sc, EHCI_LINK_TERMINATE); + htohc32(temp.sc, EHCI_LINK_TERMINATE); usb2_pc_cpu_flush(qh->page_cache); @@ -2027,7 +2023,7 @@ ehci_isoc_fs_done(ehci_softc_t *sc, stru } #endif usb2_pc_cpu_invalidate(td->page_cache); - status = ehci32toh(sc, td->sitd_status); + status = hc32toh(sc, td->sitd_status); len = EHCI_SITD_GET_LEN(status); @@ -2080,7 +2076,7 @@ ehci_isoc_hs_done(ehci_softc_t *sc, stru #endif usb2_pc_cpu_invalidate(td->page_cache); - status = ehci32toh(sc, td->itd_status[td_no]); + status = hc32toh(sc, td->itd_status[td_no]); len = EHCI_ITD_GET_LEN(status); @@ -2377,7 +2373,7 @@ ehci_device_isoc_fs_open(struct usb2_xfe if (UE_GET_DIR(xfer->endpoint) == UE_DIR_IN) { sitd_portaddr |= EHCI_SITD_SET_DIR_IN; } - sitd_portaddr = htoehci32(sc, sitd_portaddr); + sitd_portaddr = htohc32(sc, sitd_portaddr); /* initialize all TD's */ @@ -2394,7 +2390,7 @@ ehci_device_isoc_fs_open(struct usb2_xfe * * micro-frame usage (8 microframes per 1ms) */ - td->sitd_back = htoehci32(sc, EHCI_LINK_TERMINATE); + td->sitd_back = htohc32(sc, EHCI_LINK_TERMINATE); usb2_pc_cpu_flush(td->page_cache); } @@ -2541,7 +2537,7 @@ ehci_device_isoc_fs_enter(struct usb2_xf * non-zero length */ usb2_get_page(xfer->frbuffers, buf_offset, &buf_res); - td->sitd_bp[0] = htoehci32(sc, buf_res.physaddr); + td->sitd_bp[0] = htohc32(sc, buf_res.physaddr); buf_offset += *plen; /* * NOTE: We need to subtract one from the offset so @@ -2586,17 +2582,17 @@ ehci_device_isoc_fs_enter(struct usb2_xf sitd_mask = (EHCI_SITD_SET_SMASK(sa) | EHCI_SITD_SET_CMASK(sb)); - td->sitd_bp[1] = htoehci32(sc, temp); + td->sitd_bp[1] = htohc32(sc, temp); - td->sitd_mask = htoehci32(sc, sitd_mask); + td->sitd_mask = htohc32(sc, sitd_mask); if (nframes == 0) { - td->sitd_status = htoehci32(sc, + td->sitd_status = htohc32(sc, EHCI_SITD_IOC | EHCI_SITD_ACTIVE | EHCI_SITD_SET_LEN(*plen)); } else { - td->sitd_status = htoehci32(sc, + td->sitd_status = htohc32(sc, EHCI_SITD_ACTIVE | EHCI_SITD_SET_LEN(*plen)); } @@ -2670,7 +2666,7 @@ ehci_device_isoc_hs_open(struct usb2_xfe td->itd_status[7] = 0; /* set endpoint and address */ - td->itd_bp[0] = htoehci32(sc, + td->itd_bp[0] = htohc32(sc, EHCI_ITD_SET_ADDR(xfer->address) | EHCI_ITD_SET_ENDPT(UE_GET_ADDR(xfer->endpoint))); @@ -2682,10 +2678,10 @@ ehci_device_isoc_hs_open(struct usb2_xfe temp |= EHCI_ITD_SET_DIR_IN; } /* set maximum packet size */ - td->itd_bp[1] = htoehci32(sc, temp); + td->itd_bp[1] = htohc32(sc, temp); /* set transfer multiplier */ - td->itd_bp[2] = htoehci32(sc, xfer->max_packet_count & 3); + td->itd_bp[2] = htohc32(sc, xfer->max_packet_count & 3); usb2_pc_cpu_flush(td->page_cache); } @@ -2807,7 +2803,7 @@ ehci_device_isoc_hs_enter(struct usb2_xf status = (EHCI_ITD_SET_LEN(*plen) | EHCI_ITD_ACTIVE | EHCI_ITD_SET_PG(0)); - td->itd_status[td_no] = htoehci32(sc, status); + td->itd_status[td_no] = htohc32(sc, status); itd_offset[td_no] = buf_offset; buf_offset += *plen; plen++; @@ -2830,14 +2826,14 @@ ehci_device_isoc_hs_enter(struct usb2_xf /* get page address */ page_addr = buf_res.physaddr & ~0xFFF; /* update page address */ - td->itd_bp[0] &= htoehci32(sc, 0xFFF); - td->itd_bp[0] |= htoehci32(sc, page_addr); + td->itd_bp[0] &= htohc32(sc, 0xFFF); + td->itd_bp[0] |= htohc32(sc, page_addr); for (x = 0; x != td_no; x++) { /* set page number and page offset */ status = (EHCI_ITD_SET_PG(page_no) | (buf_res.physaddr & 0xFFF)); - td->itd_status[x] |= htoehci32(sc, status); + td->itd_status[x] |= htohc32(sc, status); /* get next page offset */ if (itd_offset[x + 1] == buf_offset) { @@ -2860,14 +2856,14 @@ ehci_device_isoc_hs_enter(struct usb2_xf } page_no++; /* update page address */ - td->itd_bp[page_no] &= htoehci32(sc, 0xFFF); - td->itd_bp[page_no] |= htoehci32(sc, page_addr); + td->itd_bp[page_no] &= htohc32(sc, 0xFFF); + td->itd_bp[page_no] |= htohc32(sc, page_addr); } } } /* set IOC bit if we are complete */ if (nframes == 0) { - td->itd_status[7] |= htoehci32(sc, EHCI_ITD_IOC); + td->itd_status[7] |= htohc32(sc, EHCI_ITD_IOC); } usb2_pc_cpu_flush(td->page_cache); #if USB_DEBUG @@ -3300,7 +3296,7 @@ ehci_root_ctrl_done(struct usb2_xfer *xf } v = EOREAD4(sc, EHCI_PORTSC(index)); DPRINTFN(9, "port status=0x%04x\n", v); - if (sc->sc_flags & EHCI_SCFLG_FORCESPEED) { + if (sc->sc_flags & (EHCI_SCFLG_FORCESPEED | EHCI_SCFLG_TT)) { if ((v & 0xc000000) == 0x8000000) i = UPS_HIGH_SPEED; else if ((v & 0xc000000) == 0x4000000) @@ -3369,7 +3365,8 @@ ehci_root_ctrl_done(struct usb2_xfer *xf break; } #endif - if (EHCI_PS_IS_LOWSPEED(v)) { + if (EHCI_PS_IS_LOWSPEED(v) && + (sc->sc_flags & EHCI_SCFLG_TT) == 0) { /* Low speed device, give up ownership. */ ehci_disown(sc, index, 1); break; @@ -3398,11 +3395,9 @@ ehci_root_ctrl_done(struct usb2_xfer *xf std->err = USB_ERR_TIMEOUT; goto done; } - if (!(v & EHCI_PS_PE)) { - /* - * Not a high speed device, give up - * ownership. - */ + if (!(v & EHCI_PS_PE) && + (sc->sc_flags & EHCI_SCFLG_TT) == 0) { + /* Not a high speed device, give up ownership.*/ ehci_disown(sc, index, 0); break; } @@ -3662,7 +3657,7 @@ alloc_dma_set: td = page_info.buffer; /* init TD */ - td->itd_self = htoehci32(sc, page_info.physaddr | EHCI_LINK_ITD); + td->itd_self = htohc32(sc, page_info.physaddr | EHCI_LINK_ITD); td->obj_next = last_obj; td->page_cache = pc + n; @@ -3686,7 +3681,7 @@ alloc_dma_set: td = page_info.buffer; /* init TD */ - td->sitd_self = htoehci32(sc, page_info.physaddr | EHCI_LINK_SITD); + td->sitd_self = htohc32(sc, page_info.physaddr | EHCI_LINK_SITD); td->obj_next = last_obj; td->page_cache = pc + n; @@ -3710,7 +3705,7 @@ alloc_dma_set: qtd = page_info.buffer; /* init TD */ - qtd->qtd_self = htoehci32(sc, page_info.physaddr); + qtd->qtd_self = htohc32(sc, page_info.physaddr); qtd->obj_next = last_obj; qtd->page_cache = pc + n; @@ -3738,7 +3733,7 @@ alloc_dma_set: qh = page_info.buffer; /* init QH */ - qh->qh_self = htoehci32(sc, page_info.physaddr | EHCI_LINK_QH); + qh->qh_self = htohc32(sc, page_info.physaddr | EHCI_LINK_QH); qh->obj_next = last_obj; qh->page_cache = pc + n; Modified: head/sys/dev/usb/controller/ehci.h ============================================================================== --- head/sys/dev/usb/controller/ehci.h Sat Mar 7 19:13:59 2009 (r189495) +++ head/sys/dev/usb/controller/ehci.h Sat Mar 7 19:49:47 2009 (r189496) @@ -520,8 +520,67 @@ typedef struct ehci_softc { #define EOWRITE4(sc, a, x) \ bus_space_write_4((sc)->sc_io_tag, (sc)->sc_io_hdl, (sc)->sc_offs+(a), (x)) +#ifdef USB_EHCI_BIG_ENDIAN_DESC +/* + * Handle byte order conversion between host and ``host controller''. + * Typically the latter is little-endian but some controllers require + * big-endian in which case we may need to manually swap. + */ +static __inline uint32_t +htohc32(const struct ehci_softc *sc, const uint32_t v) +{ + return sc->sc_flags & EHCI_SCFLG_BIGEDESC ? htobe32(v) : htole32(v); +} + +static __inline uint16_t +htohc16(const struct ehci_softc *sc, const uint16_t v) +{ + return sc->sc_flags & EHCI_SCFLG_BIGEDESC ? htobe16(v) : htole16(v); +} + +static __inline uint32_t +hc32toh(const struct ehci_softc *sc, const uint32_t v) +{ + return sc->sc_flags & EHCI_SCFLG_BIGEDESC ? be32toh(v) : le32toh(v); +} + +static __inline uint16_t +hc16toh(const struct ehci_softc *sc, const uint16_t v) +{ + return sc->sc_flags & EHCI_SCFLG_BIGEDESC ? be16toh(v) : le16toh(v); +} +#else +/* + * Normal little-endian only conversion routines. + */ +static __inline uint32_t +htohc32(const struct ehci_softc *sc, const uint32_t v) +{ + return htole32(v); +} + +static __inline uint16_t +htohc16(const struct ehci_softc *sc, const uint16_t v) +{ + return htole16(v); +} + +static __inline uint32_t +hc32toh(const struct ehci_softc *sc, const uint32_t v) +{ + return le32toh(v); +} + +static __inline uint16_t +hc16toh(const struct ehci_softc *sc, const uint16_t v) +{ + return le16toh(v); +} +#endif + usb2_bus_mem_cb_t ehci_iterate_hw_softc; +usb2_error_t ehci_reset(ehci_softc_t *sc); usb2_error_t ehci_init(ehci_softc_t *sc); void ehci_detach(struct ehci_softc *sc); void ehci_suspend(struct ehci_softc *sc); Modified: head/sys/dev/usb/controller/ehci_ixp4xx.c ============================================================================== --- head/sys/dev/usb/controller/ehci_ixp4xx.c Sat Mar 7 19:13:59 2009 (r189495) +++ head/sys/dev/usb/controller/ehci_ixp4xx.c Sat Mar 7 19:49:47 2009 (r189496) @@ -211,6 +211,7 @@ ehci_ixp_attach(device_t self) | EHCI_SCFLG_BIGEMMIO | EHCI_SCFLG_NORESTERM ; + (void) ehci_reset(sc); err = ehci_init(sc); if (!err) { From owner-svn-src-head@FreeBSD.ORG Sat Mar 7 19:54: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 E1A41106566B; Sat, 7 Mar 2009 19:54:30 +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 CFAD08FC22; Sat, 7 Mar 2009 19:54:30 +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 n27JsUnu061309; Sat, 7 Mar 2009 19:54:30 GMT (envelope-from thompsa@svn.freebsd.org) Received: (from thompsa@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n27JsUdA061307; Sat, 7 Mar 2009 19:54:30 GMT (envelope-from thompsa@svn.freebsd.org) Message-Id: <200903071954.n27JsUdA061307@svn.freebsd.org> From: Andrew Thompson Date: Sat, 7 Mar 2009 19:54: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: r189497 - in head/sys: amd64/conf i386/conf X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 07 Mar 2009 19:54:31 -0000 Author: thompsa Date: Sat Mar 7 19:54:30 2009 New Revision: 189497 URL: http://svn.freebsd.org/changeset/base/189497 Log: Reenable ndis in the LINT build now that it has been updated for USB. Thanks to HPS and Weongyo. Modified: head/sys/amd64/conf/NOTES head/sys/i386/conf/NOTES Modified: head/sys/amd64/conf/NOTES ============================================================================== --- head/sys/amd64/conf/NOTES Sat Mar 7 19:49:47 2009 (r189496) +++ head/sys/amd64/conf/NOTES Sat Mar 7 19:54:30 2009 (r189497) @@ -509,5 +509,5 @@ options VM_KMEM_SIZE_MAX options VM_KMEM_SIZE_SCALE # Enable NDIS binary driver support -#options NDISAPI -#device ndis +options NDISAPI +device ndis Modified: head/sys/i386/conf/NOTES ============================================================================== --- head/sys/i386/conf/NOTES Sat Mar 7 19:49:47 2009 (r189496) +++ head/sys/i386/conf/NOTES Sat Mar 7 19:54:30 2009 (r189497) @@ -882,8 +882,8 @@ options DEBUG_SVR4 # enable verbose deb device streams # STREAMS network driver (required for svr4). # Enable NDIS binary driver support -#options NDISAPI -#device ndis +options NDISAPI +device ndis ##################################################################### From owner-svn-src-head@FreeBSD.ORG Sat Mar 7 21:36: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 D745A106566C; Sat, 7 Mar 2009 21:36:57 +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 C23D08FC08; Sat, 7 Mar 2009 21:36:57 +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 n27LavLr063384; Sat, 7 Mar 2009 21:36:57 GMT (envelope-from rnoland@svn.freebsd.org) Received: (from rnoland@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n27Lavnv063380; Sat, 7 Mar 2009 21:36:57 GMT (envelope-from rnoland@svn.freebsd.org) Message-Id: <200903072136.n27Lavnv063380@svn.freebsd.org> From: Robert Noland Date: Sat, 7 Mar 2009 21:36: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: r189499 - in head/sys: conf dev/drm modules/drm/radeon 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, 07 Mar 2009 21:36:58 -0000 Author: rnoland Date: Sat Mar 7 21:36:57 2009 New Revision: 189499 URL: http://svn.freebsd.org/changeset/base/189499 Log: Import support for ATI Radeon R600 and R700 series chips. Tested on an HD3850 (RV670) on loan from Warren Block. Currently, you need one of the following for this to be useful: x11-drivers/xf86-video-radeonhd-devel (not tested) xf86-video-ati from git (EXA works, xv is too fast) xf86-video-radeonhd from git (EXA works, xv works) There is no 3d support available from dri just yet. MFC after: 2 weeks Added: head/sys/dev/drm/r600_cp.c (contents, props changed) head/sys/dev/drm/r600_microcode.h (contents, props changed) Modified: head/sys/conf/files head/sys/dev/drm/drm_pciids.h head/sys/dev/drm/radeon_cp.c head/sys/dev/drm/radeon_drm.h head/sys/dev/drm/radeon_drv.h head/sys/dev/drm/radeon_irq.c head/sys/dev/drm/radeon_state.c head/sys/modules/drm/radeon/Makefile Modified: head/sys/conf/files ============================================================================== --- head/sys/conf/files Sat Mar 7 20:39:42 2009 (r189498) +++ head/sys/conf/files Sat Mar 7 21:36:57 2009 (r189499) @@ -801,6 +801,7 @@ dev/drm/r128_irq.c optional r128drm dev/drm/r128_state.c optional r128drm \ compile-with "${NORMAL_C} -finline-limit=13500" dev/drm/r300_cmdbuf.c optional radeondrm +dev/drm/r600_cp.c optional radeondrm dev/drm/radeon_cp.c optional radeondrm dev/drm/radeon_drv.c optional radeondrm dev/drm/radeon_irq.c optional radeondrm Modified: head/sys/dev/drm/drm_pciids.h ============================================================================== --- head/sys/dev/drm/drm_pciids.h Sat Mar 7 20:39:42 2009 (r189498) +++ head/sys/dev/drm/drm_pciids.h Sat Mar 7 21:36:57 2009 (r189499) @@ -240,12 +240,123 @@ {0x1002, 0x7297, CHIP_RV560|RADEON_NEW_MEMMAP, "ATI RV560"}, \ {0x1002, 0x7834, CHIP_RS300|RADEON_IS_IGP|RADEON_NEW_MEMMAP, "ATI Radeon RS350 9000/9100 IGP"}, \ {0x1002, 0x7835, CHIP_RS300|RADEON_IS_IGP|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP, "ATI Radeon RS350 Mobility IGP"}, \ + {0x1002, 0x793f, CHIP_RS600|RADEON_IS_IGP|RADEON_NEW_MEMMAP, "ATI Radeon X1200"}, \ + {0x1002, 0x7941, CHIP_RS600|RADEON_IS_IGP|RADEON_NEW_MEMMAP, "ATI Radeon X1200"}, \ + {0x1002, 0x7942, CHIP_RS600|RADEON_IS_IGP|RADEON_NEW_MEMMAP, "ATI Radeon X1200"}, \ {0x1002, 0x791e, CHIP_RS690|RADEON_IS_IGP|RADEON_NEW_MEMMAP|RADEON_IS_IGPGART, "ATI Radeon RS690 X1250 IGP"}, \ {0x1002, 0x791f, CHIP_RS690|RADEON_IS_IGP|RADEON_NEW_MEMMAP|RADEON_IS_IGPGART, "ATI Radeon RS690 X1270 IGP"}, \ {0x1002, 0x796c, CHIP_RS740|RADEON_IS_IGP|RADEON_NEW_MEMMAP|RADEON_IS_IGPGART, "ATI Radeon RS740 HD2100 IGP"}, \ {0x1002, 0x796d, CHIP_RS740|RADEON_IS_IGP|RADEON_NEW_MEMMAP|RADEON_IS_IGPGART, "ATI Radeon RS740 HD2100 IGP"}, \ {0x1002, 0x796e, CHIP_RS740|RADEON_IS_IGP|RADEON_NEW_MEMMAP|RADEON_IS_IGPGART, "ATI Radeon RS740 HD2100 IGP"}, \ {0x1002, 0x796f, CHIP_RS740|RADEON_IS_IGP|RADEON_NEW_MEMMAP|RADEON_IS_IGPGART, "ATI Radeon RS740 HD2100 IGP"}, \ + {0x1002, 0x9400, CHIP_R600|RADEON_NEW_MEMMAP, "ATI Radeon HD 2900 XT"}, \ + {0x1002, 0x9401, CHIP_R600|RADEON_NEW_MEMMAP, "ATI Radeon HD 2900 XT"}, \ + {0x1002, 0x9402, CHIP_R600|RADEON_NEW_MEMMAP, "ATI Radeon HD 2900 XT"}, \ + {0x1002, 0x9403, CHIP_R600|RADEON_NEW_MEMMAP, "ATI Radeon HD 2900 Pro"}, \ + {0x1002, 0x9405, CHIP_R600|RADEON_NEW_MEMMAP, "ATI Radeon HD 2900 GT"}, \ + {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, 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"}, \ + {0x1002, 0x94C4, CHIP_RV610|RADEON_NEW_MEMMAP, "Radeon HD 2400 PRO AGP"}, \ + {0x1002, 0x94C5, CHIP_RV610|RADEON_NEW_MEMMAP, "FireGL V4000"}, \ + {0x1002, 0x94C6, CHIP_RV610|RADEON_NEW_MEMMAP, "RV610"}, \ + {0x1002, 0x94C7, CHIP_RV610|RADEON_NEW_MEMMAP, "ATI Radeon HD 2350"}, \ + {0x1002, 0x94C8, CHIP_RV610|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP, "ATI Mobility Radeon HD 2400 XT"}, \ + {0x1002, 0x94C9, CHIP_RV610|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP, "ATI Mobility Radeon HD 2400"}, \ + {0x1002, 0x94CB, CHIP_RV610|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP, "ATI RADEON E2400"}, \ + {0x1002, 0x94CC, CHIP_RV610|RADEON_NEW_MEMMAP, "ATI RV610"}, \ + {0x1002, 0x94CD, CHIP_RV610|RADEON_NEW_MEMMAP, "ATI FireMV 2260"}, \ + {0x1002, 0x9500, CHIP_RV670|RADEON_NEW_MEMMAP, "ATI RV670"}, \ + {0x1002, 0x9501, CHIP_RV670|RADEON_NEW_MEMMAP, "ATI Radeon HD3870"}, \ + {0x1002, 0x9504, CHIP_RV670|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP, "ATI Mobility Radeon HD 3850"}, \ + {0x1002, 0x9505, CHIP_RV670|RADEON_NEW_MEMMAP, "ATI Radeon HD3850"}, \ + {0x1002, 0x9506, CHIP_RV670|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP, "ATI Mobility Radeon HD 3850 X2"}, \ + {0x1002, 0x9507, CHIP_RV670|RADEON_NEW_MEMMAP, "ATI RV670"}, \ + {0x1002, 0x9508, CHIP_RV670|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP, "ATI Mobility Radeon HD 3870"}, \ + {0x1002, 0x9509, CHIP_RV670|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP, "ATI Mobility Radeon HD 3870 X2"}, \ + {0x1002, 0x950F, CHIP_RV670|RADEON_NEW_MEMMAP, "ATI Radeon HD3870 X2"}, \ + {0x1002, 0x9511, CHIP_RV670|RADEON_NEW_MEMMAP, "ATI FireGL V7700"}, \ + {0x1002, 0x9515, CHIP_RV670|RADEON_NEW_MEMMAP, "ATI Radeon HD3850"}, \ + {0x1002, 0x9517, CHIP_RV670|RADEON_NEW_MEMMAP, "ATI Radeon HD3690"}, \ + {0x1002, 0x9519, CHIP_RV670|RADEON_NEW_MEMMAP, "AMD Firestream 9170"}, \ + {0x1002, 0x9580, CHIP_RV630|RADEON_NEW_MEMMAP, "ATI RV630"}, \ + {0x1002, 0x9581, CHIP_RV630|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP, "ATI Mobility Radeon HD 2600"}, \ + {0x1002, 0x9583, CHIP_RV630|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP, "ATI Mobility Radeon HD 2600 XT"}, \ + {0x1002, 0x9586, CHIP_RV630|RADEON_NEW_MEMMAP, "ATI Radeon HD 2600 XT AGP"}, \ + {0x1002, 0x9587, CHIP_RV630|RADEON_NEW_MEMMAP, "ATI Radeon HD 2600 Pro AGP"}, \ + {0x1002, 0x9588, CHIP_RV630|RADEON_NEW_MEMMAP, "ATI Radeon HD 2600 XT"}, \ + {0x1002, 0x9589, CHIP_RV630|RADEON_NEW_MEMMAP, "ATI Radeon HD 2600 Pro"}, \ + {0x1002, 0x958A, CHIP_RV630|RADEON_NEW_MEMMAP, "ATI Gemini RV630"}, \ + {0x1002, 0x958B, CHIP_RV630|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP, "ATI Gemini Mobility Radeon HD 2600 XT"}, \ + {0x1002, 0x958C, CHIP_RV630|RADEON_NEW_MEMMAP, "ATI FireGL V5600"}, \ + {0x1002, 0x958D, CHIP_RV630|RADEON_NEW_MEMMAP, "ATI FireGL V3600"}, \ + {0x1002, 0x958E, CHIP_RV630|RADEON_NEW_MEMMAP, "ATI Radeon HD 2600 LE"}, \ + {0x1002, 0x958F, CHIP_RV630|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP, "ATI Mobility FireGL Graphics Processor"}, \ + {0x1002, 0x95C0, CHIP_RV620|RADEON_NEW_MEMMAP, "ATI Radeon HD 3470"}, \ + {0x1002, 0x95C5, CHIP_RV620|RADEON_NEW_MEMMAP, "ATI Radeon HD 3450"}, \ + {0x1002, 0x95C6, CHIP_RV620|RADEON_NEW_MEMMAP, "ATI Radeon HD 3450"}, \ + {0x1002, 0x95C7, CHIP_RV620|RADEON_NEW_MEMMAP, "ATI Radeon HD 3430"}, \ + {0x1002, 0x95C9, CHIP_RV620|RADEON_NEW_MEMMAP, "ATI Radeon HD 3450"}, \ + {0x1002, 0x95C2, CHIP_RV620|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP, "ATI Mobility Radeon HD 3430"}, \ + {0x1002, 0x95C4, CHIP_RV620|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP, "ATI Mobility Radeon HD 3400 Series"}, \ + {0x1002, 0x95CC, CHIP_RV620|RADEON_NEW_MEMMAP, "ATI FirePro V3700"}, \ + {0x1002, 0x95CD, CHIP_RV620|RADEON_NEW_MEMMAP, "ATI FireMV 2450"}, \ + {0x1002, 0x95CE, CHIP_RV620|RADEON_NEW_MEMMAP, "ATI FireMV 2260"}, \ + {0x1002, 0x95CF, CHIP_RV620|RADEON_NEW_MEMMAP, "ATI FireMV 2260"}, \ + {0x1002, 0x9590, CHIP_RV635|RADEON_NEW_MEMMAP, "ATI ATI Radeon HD 3600 Series"}, \ + {0x1002, 0x9596, CHIP_RV635|RADEON_NEW_MEMMAP, "ATI ATI Radeon HD 3650 AGP"}, \ + {0x1002, 0x9597, CHIP_RV635|RADEON_NEW_MEMMAP, "ATI ATI Radeon HD 3600 PRO"}, \ + {0x1002, 0x9598, CHIP_RV635|RADEON_NEW_MEMMAP, "ATI ATI Radeon HD 3600 XT"}, \ + {0x1002, 0x9599, CHIP_RV635|RADEON_NEW_MEMMAP, "ATI ATI Radeon HD 3600 PRO"}, \ + {0x1002, 0x9591, CHIP_RV635|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP, "ATI Mobility Radeon HD 3650"}, \ + {0x1002, 0x9593, CHIP_RV635|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP, "ATI Mobility Radeon HD 3670"}, \ + {0x1002, 0x9595, CHIP_RV635|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP, "ATI Mobility FireGL V5700"}, \ + {0x1002, 0x959B, CHIP_RV635|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP, "ATI Mobility FireGL V5725"}, \ + {0x1002, 0x9610, CHIP_RS780|RADEON_NEW_MEMMAP|RADEON_IS_IGP, "ATI Radeon HD 3200 Graphics"}, \ + {0x1002, 0x9611, CHIP_RS780|RADEON_NEW_MEMMAP|RADEON_IS_IGP, "ATI Radeon 3100 Graphics"}, \ + {0x1002, 0x9612, CHIP_RS780|RADEON_NEW_MEMMAP|RADEON_IS_IGP, "ATI Radeon HD 3200 Graphics"}, \ + {0x1002, 0x9613, CHIP_RS780|RADEON_NEW_MEMMAP|RADEON_IS_IGP, "ATI Radeon 3100 Graphics"}, \ + {0x1002, 0x9614, CHIP_RS780|RADEON_NEW_MEMMAP|RADEON_IS_IGP, "ATI Radeon 3300 Graphics"}, \ + {0x1002, 0x9440, CHIP_RV770|RADEON_NEW_MEMMAP, "ATI Radeon 4800 Series"}, \ + {0x1002, 0x9441, CHIP_RV770|RADEON_NEW_MEMMAP, "ATI Radeon 4870 X2"}, \ + {0x1002, 0x9442, CHIP_RV770|RADEON_NEW_MEMMAP, "ATI Radeon 4800 Series"}, \ + {0x1002, 0x944C, CHIP_RV770|RADEON_NEW_MEMMAP, "ATI Radeon 4800 Series"}, \ + {0x1002, 0x9450, CHIP_RV770|RADEON_NEW_MEMMAP, "AMD FireStream 9270"}, \ + {0x1002, 0x9452, CHIP_RV770|RADEON_NEW_MEMMAP, "AMD FireStream 9250"}, \ + {0x1002, 0x9444, CHIP_RV770|RADEON_NEW_MEMMAP, "ATI FirePro V8750 (FireGL)"}, \ + {0x1002, 0x9446, CHIP_RV770|RADEON_NEW_MEMMAP, "ATI FirePro V7760 (FireGL)"}, \ + {0x1002, 0x9456, CHIP_RV770|RADEON_NEW_MEMMAP, "ATI FirePro V8700 (FireGL)"}, \ + {0x1002, 0x944E, CHIP_RV770|RADEON_NEW_MEMMAP, "ATI FirePro RV770"}, \ + {0x1002, 0x944A, CHIP_RV770|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP, "ATI Mobility Radeon HD 4850"}, \ + {0x1002, 0x944B, CHIP_RV770|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP, "ATI Mobility Radeon HD 4850 X2"}, \ + {0x1002, 0x945A, CHIP_RV770|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP, "ATI Mobility Radeon HD 4870"}, \ + {0x1002, 0x945B, CHIP_RV770|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP, "ATI Mobility Radeon M98"}, \ + {0x1002, 0x946A, CHIP_RV770|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP, "ATI FirePro M7750"}, \ + {0x1002, 0x946B, CHIP_RV770|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP, "ATI M98"}, \ + {0x1002, 0x947A, CHIP_RV770|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP, "ATI M98"}, \ + {0x1002, 0x947B, CHIP_RV770|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP, "ATI M98"}, \ + {0x1002, 0x9487, CHIP_RV730|RADEON_NEW_MEMMAP, "ATI Radeon RV730 (AGP)"}, \ + {0x1002, 0x948F, CHIP_RV730|RADEON_NEW_MEMMAP, "ATI Radeon RV730 (AGP)"}, \ + {0x1002, 0x9490, CHIP_RV730|RADEON_NEW_MEMMAP, "ATI Radeon HD 4670"}, \ + {0x1002, 0x9498, CHIP_RV730|RADEON_NEW_MEMMAP, "ATI Radeon HD 4650"}, \ + {0x1002, 0x9480, CHIP_RV730|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP, "ATI Mobility Radeon HD 4650"}, \ + {0x1002, 0x9488, CHIP_RV730|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP, "ATI Mobility Radeon HD 4670"}, \ + {0x1002, 0x9489, CHIP_RV730|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP, "ATI FirePro M5750"}, \ + {0x1002, 0x9491, CHIP_RV730|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP, "ATI RADEON E4600"}, \ + {0x1002, 0x949C, CHIP_RV730|RADEON_NEW_MEMMAP, "ATI FirePro V7750 (FireGL)"}, \ + {0x1002, 0x949E, CHIP_RV730|RADEON_NEW_MEMMAP, "ATI FirePro V5700 (FireGL)"}, \ + {0x1002, 0x949F, CHIP_RV730|RADEON_NEW_MEMMAP, "ATI FirePro V3750 (FireGL)"}, \ + {0x1002, 0x9540, CHIP_RV710|RADEON_NEW_MEMMAP, "ATI Radeon HD 4550"}, \ + {0x1002, 0x9541, CHIP_RV710|RADEON_NEW_MEMMAP, "ATI Radeon RV710"}, \ + {0x1002, 0x9542, CHIP_RV710|RADEON_NEW_MEMMAP, "ATI Radeon RV710"}, \ + {0x1002, 0x954E, CHIP_RV710|RADEON_NEW_MEMMAP, "ATI Radeon RV710"}, \ + {0x1002, 0x954F, CHIP_RV710|RADEON_NEW_MEMMAP, "ATI Radeon HD 4350"}, \ + {0x1002, 0x9552, CHIP_RV710|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP, "ATI Mobility Radeon 4300 Series"}, \ + {0x1002, 0x9553, CHIP_RV710|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP, "ATI Mobility Radeon 4500 Series"}, \ + {0x1002, 0x9555, CHIP_RV710|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP, "ATI Mobility Radeon 4500 Series"}, \ {0, 0, 0, NULL} #define r128_PCI_IDS \ Added: head/sys/dev/drm/r600_cp.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/dev/drm/r600_cp.c Sat Mar 7 21:36:57 2009 (r189499) @@ -0,0 +1,2258 @@ +/*- + * Copyright 2008-2009 Advanced Micro Devices, Inc. + * Copyright 2008 Red Hat Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE COPYRIGHT HOLDER(S) AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + * + * Authors: + * Dave Airlie + * Alex Deucher + */ + +#include +__FBSDID("$FreeBSD$"); + +#include "dev/drm/drmP.h" +#include "dev/drm/drm.h" +#include "dev/drm/radeon_drm.h" +#include "dev/drm/radeon_drv.h" + +#include "dev/drm/r600_microcode.h" + +# define ATI_PCIGART_PAGE_SIZE 4096 /**< PCI GART page size */ +# define ATI_PCIGART_PAGE_MASK (~(ATI_PCIGART_PAGE_SIZE-1)) + +#define R600_PTE_VALID (1 << 0) +#define R600_PTE_SYSTEM (1 << 1) +#define R600_PTE_SNOOPED (1 << 2) +#define R600_PTE_READABLE (1 << 5) +#define R600_PTE_WRITEABLE (1 << 6) + +/* MAX values used for gfx init */ +#define R6XX_MAX_SH_GPRS 256 +#define R6XX_MAX_TEMP_GPRS 16 +#define R6XX_MAX_SH_THREADS 256 +#define R6XX_MAX_SH_STACK_ENTRIES 4096 +#define R6XX_MAX_BACKENDS 8 +#define R6XX_MAX_BACKENDS_MASK 0xff +#define R6XX_MAX_SIMDS 8 +#define R6XX_MAX_SIMDS_MASK 0xff +#define R6XX_MAX_PIPES 8 +#define R6XX_MAX_PIPES_MASK 0xff + +#define R7XX_MAX_SH_GPRS 256 +#define R7XX_MAX_TEMP_GPRS 16 +#define R7XX_MAX_SH_THREADS 256 +#define R7XX_MAX_SH_STACK_ENTRIES 4096 +#define R7XX_MAX_BACKENDS 8 +#define R7XX_MAX_BACKENDS_MASK 0xff +#define R7XX_MAX_SIMDS 16 +#define R7XX_MAX_SIMDS_MASK 0xffff +#define R7XX_MAX_PIPES 8 +#define R7XX_MAX_PIPES_MASK 0xff + +static int r600_do_wait_for_fifo(drm_radeon_private_t *dev_priv, int entries) +{ + int i; + + dev_priv->stats.boxes |= RADEON_BOX_WAIT_IDLE; + + for (i = 0; i < dev_priv->usec_timeout; i++) { + int slots; + if ((dev_priv->flags & RADEON_FAMILY_MASK) >= CHIP_RV770) + slots = (RADEON_READ(R600_GRBM_STATUS) + & R700_CMDFIFO_AVAIL_MASK); + else + slots = (RADEON_READ(R600_GRBM_STATUS) + & R600_CMDFIFO_AVAIL_MASK); + if (slots >= entries) + return 0; + DRM_UDELAY(1); + } + DRM_INFO("wait for fifo failed status : 0x%08X 0x%08X\n", + RADEON_READ(R600_GRBM_STATUS), + RADEON_READ(R600_GRBM_STATUS2)); + + return -EBUSY; +} + +static int r600_do_wait_for_idle(drm_radeon_private_t *dev_priv) +{ + int i, ret; + + dev_priv->stats.boxes |= RADEON_BOX_WAIT_IDLE; + + if ((dev_priv->flags & RADEON_FAMILY_MASK) >= CHIP_RV770) + ret = r600_do_wait_for_fifo(dev_priv, 8); + else + ret = r600_do_wait_for_fifo(dev_priv, 16); + if (ret) + return ret; + for (i = 0; i < dev_priv->usec_timeout; i++) { + if (!(RADEON_READ(R600_GRBM_STATUS) & R600_GUI_ACTIVE)) + return 0; + DRM_UDELAY(1); + } + DRM_INFO("wait idle failed status : 0x%08X 0x%08X\n", + RADEON_READ(R600_GRBM_STATUS), + RADEON_READ(R600_GRBM_STATUS2)); + + return -EBUSY; +} + +void r600_page_table_cleanup(struct drm_device *dev, struct drm_ati_pcigart_info *gart_info) +{ +#ifdef __linux__ + struct drm_sg_mem *entry = dev->sg; + int max_pages; + int pages; + int i; +#endif + if (gart_info->bus_addr) { +#ifdef __linux__ + max_pages = (gart_info->table_size / sizeof(u32)); + pages = (entry->pages <= max_pages) + ? entry->pages : max_pages; + + for (i = 0; i < pages; i++) { + if (!entry->busaddr[i]) + break; + pci_unmap_single(dev->pdev, entry->busaddr[i], + PAGE_SIZE, PCI_DMA_TODEVICE); + } +#endif + if (gart_info->gart_table_location == DRM_ATI_GART_MAIN) + gart_info->bus_addr = 0; + } +} + +/* R600 has page table setup */ +int r600_page_table_init(struct drm_device *dev) +{ + drm_radeon_private_t *dev_priv = dev->dev_private; + struct drm_ati_pcigart_info *gart_info = &dev_priv->gart_info; + struct drm_sg_mem *entry = dev->sg; + int ret = 0; + int i, j; + int max_pages, pages; + u64 *pci_gart, page_base; + dma_addr_t entry_addr; + + /* okay page table is available - lets rock */ + + /* PTEs are 64-bits */ + pci_gart = (u64 *)gart_info->addr; + + max_pages = (gart_info->table_size / sizeof(u64)); + pages = (entry->pages <= max_pages) ? entry->pages : max_pages; + + memset(pci_gart, 0, max_pages * sizeof(u64)); + + for (i = 0; i < pages; i++) { +#ifdef __linux__ + entry->busaddr[i] = pci_map_single(dev->pdev, + page_address(entry-> + pagelist[i]), + PAGE_SIZE, PCI_DMA_TODEVICE); + if (entry->busaddr[i] == 0) { + DRM_ERROR("unable to map PCIGART pages!\n"); + r600_page_table_cleanup(dev, gart_info); + ret = -EINVAL; + goto done; + } +#endif + entry_addr = entry->busaddr[i]; + for (j = 0; j < (PAGE_SIZE / ATI_PCIGART_PAGE_SIZE); j++) { + page_base = (u64) entry_addr & ATI_PCIGART_PAGE_MASK; + page_base |= R600_PTE_VALID | R600_PTE_SYSTEM | R600_PTE_SNOOPED; + page_base |= R600_PTE_READABLE | R600_PTE_WRITEABLE; + + *pci_gart = page_base; + + if ((i % 128) == 0) + DRM_DEBUG("page entry %d: 0x%016llx\n", + i, (unsigned long long)page_base); + pci_gart++; + entry_addr += ATI_PCIGART_PAGE_SIZE; + } + } +#ifdef __linux__ +done: +#endif + return ret; +} + +static void r600_vm_flush_gart_range(struct drm_device *dev) +{ + drm_radeon_private_t *dev_priv = dev->dev_private; + u32 resp, countdown = 1000; + RADEON_WRITE(R600_VM_CONTEXT0_INVALIDATION_LOW_ADDR, dev_priv->gart_vm_start >> 12); + RADEON_WRITE(R600_VM_CONTEXT0_INVALIDATION_HIGH_ADDR, (dev_priv->gart_vm_start + dev_priv->gart_size - 1) >> 12); + RADEON_WRITE(R600_VM_CONTEXT0_REQUEST_RESPONSE, 2); + + do { + resp = RADEON_READ(R600_VM_CONTEXT0_REQUEST_RESPONSE); + countdown--; + DRM_UDELAY(1); + } while (((resp & 0xf0) == 0) && countdown); +} + +static void r600_vm_init(struct drm_device *dev) +{ + drm_radeon_private_t *dev_priv = dev->dev_private; + /* initialise the VM to use the page table we constructed up there */ + u32 vm_c0, i; + u32 mc_rd_a; + u32 vm_l2_cntl, vm_l2_cntl3; + /* okay set up the PCIE aperture type thingo */ + RADEON_WRITE(R600_MC_VM_SYSTEM_APERTURE_LOW_ADDR, dev_priv->gart_vm_start >> 12); + RADEON_WRITE(R600_MC_VM_SYSTEM_APERTURE_HIGH_ADDR, (dev_priv->gart_vm_start + dev_priv->gart_size - 1) >> 12); + RADEON_WRITE(R600_MC_VM_SYSTEM_APERTURE_DEFAULT_ADDR, 0); + + /* setup MC RD a */ + mc_rd_a = R600_MCD_L1_TLB | R600_MCD_L1_FRAG_PROC | R600_MCD_SYSTEM_ACCESS_MODE_IN_SYS | + R600_MCD_SYSTEM_APERTURE_UNMAPPED_ACCESS_PASS_THRU | R600_MCD_EFFECTIVE_L1_TLB_SIZE(5) | + R600_MCD_EFFECTIVE_L1_QUEUE_SIZE(5) | R600_MCD_WAIT_L2_QUERY; + + RADEON_WRITE(R600_MCD_RD_A_CNTL, mc_rd_a); + RADEON_WRITE(R600_MCD_RD_B_CNTL, mc_rd_a); + + RADEON_WRITE(R600_MCD_WR_A_CNTL, mc_rd_a); + RADEON_WRITE(R600_MCD_WR_B_CNTL, mc_rd_a); + + RADEON_WRITE(R600_MCD_RD_GFX_CNTL, mc_rd_a); + RADEON_WRITE(R600_MCD_WR_GFX_CNTL, mc_rd_a); + + RADEON_WRITE(R600_MCD_RD_SYS_CNTL, mc_rd_a); + RADEON_WRITE(R600_MCD_WR_SYS_CNTL, mc_rd_a); + + RADEON_WRITE(R600_MCD_RD_HDP_CNTL, mc_rd_a | R600_MCD_L1_STRICT_ORDERING); + RADEON_WRITE(R600_MCD_WR_HDP_CNTL, mc_rd_a /*| R600_MCD_L1_STRICT_ORDERING*/); + + RADEON_WRITE(R600_MCD_RD_PDMA_CNTL, mc_rd_a); + RADEON_WRITE(R600_MCD_WR_PDMA_CNTL, mc_rd_a); + + RADEON_WRITE(R600_MCD_RD_SEM_CNTL, mc_rd_a | R600_MCD_SEMAPHORE_MODE); + RADEON_WRITE(R600_MCD_WR_SEM_CNTL, mc_rd_a); + + vm_l2_cntl = R600_VM_L2_CACHE_EN | R600_VM_L2_FRAG_PROC | R600_VM_ENABLE_PTE_CACHE_LRU_W; + vm_l2_cntl |= R600_VM_L2_CNTL_QUEUE_SIZE(7); + RADEON_WRITE(R600_VM_L2_CNTL, vm_l2_cntl); + + RADEON_WRITE(R600_VM_L2_CNTL2, 0); + vm_l2_cntl3 = (R600_VM_L2_CNTL3_BANK_SELECT_0(0) | + R600_VM_L2_CNTL3_BANK_SELECT_1(1) | + R600_VM_L2_CNTL3_CACHE_UPDATE_MODE(2)); + RADEON_WRITE(R600_VM_L2_CNTL3, vm_l2_cntl3); + + vm_c0 = R600_VM_ENABLE_CONTEXT | R600_VM_PAGE_TABLE_DEPTH_FLAT; + + RADEON_WRITE(R600_VM_CONTEXT0_CNTL, vm_c0); + + vm_c0 &= ~R600_VM_ENABLE_CONTEXT; + + /* disable all other contexts */ + for (i = 1; i < 8; i++) + RADEON_WRITE(R600_VM_CONTEXT0_CNTL + (i * 4), vm_c0); + + RADEON_WRITE(R600_VM_CONTEXT0_PAGE_TABLE_BASE_ADDR, dev_priv->gart_info.bus_addr >> 12); + RADEON_WRITE(R600_VM_CONTEXT0_PAGE_TABLE_START_ADDR, dev_priv->gart_vm_start >> 12); + RADEON_WRITE(R600_VM_CONTEXT0_PAGE_TABLE_END_ADDR, (dev_priv->gart_vm_start + dev_priv->gart_size - 1) >> 12); + + r600_vm_flush_gart_range(dev); +} + +/* load r600 microcode */ +static void r600_cp_load_microcode(drm_radeon_private_t *dev_priv) +{ + int i; + + r600_do_cp_stop(dev_priv); + + RADEON_WRITE(R600_CP_RB_CNTL, + R600_RB_NO_UPDATE | + R600_RB_BLKSZ(15) | + R600_RB_BUFSZ(3)); + + RADEON_WRITE(R600_GRBM_SOFT_RESET, R600_SOFT_RESET_CP); + RADEON_READ(R600_GRBM_SOFT_RESET); + DRM_UDELAY(15000); + RADEON_WRITE(R600_GRBM_SOFT_RESET, 0); + + RADEON_WRITE(R600_CP_ME_RAM_WADDR, 0); + + if (((dev_priv->flags & RADEON_FAMILY_MASK) == CHIP_R600)) { + DRM_INFO("Loading R600 CP Microcode\n"); + for (i = 0; i < PM4_UCODE_SIZE; i++) { + RADEON_WRITE(R600_CP_ME_RAM_DATA, + R600_cp_microcode[i][0]); + RADEON_WRITE(R600_CP_ME_RAM_DATA, + R600_cp_microcode[i][1]); + RADEON_WRITE(R600_CP_ME_RAM_DATA, + R600_cp_microcode[i][2]); + } + + RADEON_WRITE(R600_CP_PFP_UCODE_ADDR, 0); + DRM_INFO("Loading R600 PFP Microcode\n"); + for (i = 0; i < PFP_UCODE_SIZE; i++) + RADEON_WRITE(R600_CP_PFP_UCODE_DATA, R600_pfp_microcode[i]); + } else if (((dev_priv->flags & RADEON_FAMILY_MASK) == CHIP_RV610)) { + DRM_INFO("Loading RV610 CP Microcode\n"); + for (i = 0; i < PM4_UCODE_SIZE; i++) { + RADEON_WRITE(R600_CP_ME_RAM_DATA, + RV610_cp_microcode[i][0]); + RADEON_WRITE(R600_CP_ME_RAM_DATA, + RV610_cp_microcode[i][1]); + RADEON_WRITE(R600_CP_ME_RAM_DATA, + RV610_cp_microcode[i][2]); + } + + RADEON_WRITE(R600_CP_PFP_UCODE_ADDR, 0); + DRM_INFO("Loading RV610 PFP Microcode\n"); + for (i = 0; i < PFP_UCODE_SIZE; i++) + RADEON_WRITE(R600_CP_PFP_UCODE_DATA, RV610_pfp_microcode[i]); + } else if (((dev_priv->flags & RADEON_FAMILY_MASK) == CHIP_RV630)) { + DRM_INFO("Loading RV630 CP Microcode\n"); + for (i = 0; i < PM4_UCODE_SIZE; i++) { + RADEON_WRITE(R600_CP_ME_RAM_DATA, + RV630_cp_microcode[i][0]); + RADEON_WRITE(R600_CP_ME_RAM_DATA, + RV630_cp_microcode[i][1]); + RADEON_WRITE(R600_CP_ME_RAM_DATA, + RV630_cp_microcode[i][2]); + } + + RADEON_WRITE(R600_CP_PFP_UCODE_ADDR, 0); + DRM_INFO("Loading RV630 PFP Microcode\n"); + for (i = 0; i < PFP_UCODE_SIZE; i++) + RADEON_WRITE(R600_CP_PFP_UCODE_DATA, RV630_pfp_microcode[i]); + } else if (((dev_priv->flags & RADEON_FAMILY_MASK) == CHIP_RV620)) { + DRM_INFO("Loading RV620 CP Microcode\n"); + for (i = 0; i < PM4_UCODE_SIZE; i++) { + RADEON_WRITE(R600_CP_ME_RAM_DATA, + RV620_cp_microcode[i][0]); + RADEON_WRITE(R600_CP_ME_RAM_DATA, + RV620_cp_microcode[i][1]); + RADEON_WRITE(R600_CP_ME_RAM_DATA, + RV620_cp_microcode[i][2]); + } + + RADEON_WRITE(R600_CP_PFP_UCODE_ADDR, 0); + DRM_INFO("Loading RV620 PFP Microcode\n"); + for (i = 0; i < PFP_UCODE_SIZE; i++) + RADEON_WRITE(R600_CP_PFP_UCODE_DATA, RV620_pfp_microcode[i]); + } else if (((dev_priv->flags & RADEON_FAMILY_MASK) == CHIP_RV635)) { + DRM_INFO("Loading RV635 CP Microcode\n"); + for (i = 0; i < PM4_UCODE_SIZE; i++) { + RADEON_WRITE(R600_CP_ME_RAM_DATA, + RV635_cp_microcode[i][0]); + RADEON_WRITE(R600_CP_ME_RAM_DATA, + RV635_cp_microcode[i][1]); + RADEON_WRITE(R600_CP_ME_RAM_DATA, + RV635_cp_microcode[i][2]); + } + + RADEON_WRITE(R600_CP_PFP_UCODE_ADDR, 0); + DRM_INFO("Loading RV635 PFP Microcode\n"); + for (i = 0; i < PFP_UCODE_SIZE; i++) + RADEON_WRITE(R600_CP_PFP_UCODE_DATA, RV635_pfp_microcode[i]); + } else if (((dev_priv->flags & RADEON_FAMILY_MASK) == CHIP_RV670)) { + DRM_INFO("Loading RV670 CP Microcode\n"); + for (i = 0; i < PM4_UCODE_SIZE; i++) { + RADEON_WRITE(R600_CP_ME_RAM_DATA, + RV670_cp_microcode[i][0]); + RADEON_WRITE(R600_CP_ME_RAM_DATA, + RV670_cp_microcode[i][1]); + RADEON_WRITE(R600_CP_ME_RAM_DATA, + RV670_cp_microcode[i][2]); + } + + RADEON_WRITE(R600_CP_PFP_UCODE_ADDR, 0); + DRM_INFO("Loading RV670 PFP Microcode\n"); + for (i = 0; i < PFP_UCODE_SIZE; i++) + RADEON_WRITE(R600_CP_PFP_UCODE_DATA, RV670_pfp_microcode[i]); + } else if (((dev_priv->flags & RADEON_FAMILY_MASK) == CHIP_RS780)) { + DRM_INFO("Loading RS780 CP Microcode\n"); + for (i = 0; i < PM4_UCODE_SIZE; i++) { + RADEON_WRITE(R600_CP_ME_RAM_DATA, + RV670_cp_microcode[i][0]); + RADEON_WRITE(R600_CP_ME_RAM_DATA, + RV670_cp_microcode[i][1]); + RADEON_WRITE(R600_CP_ME_RAM_DATA, + RV670_cp_microcode[i][2]); + } + + RADEON_WRITE(R600_CP_PFP_UCODE_ADDR, 0); + DRM_INFO("Loading RS780 PFP Microcode\n"); + for (i = 0; i < PFP_UCODE_SIZE; i++) + RADEON_WRITE(R600_CP_PFP_UCODE_DATA, RV670_pfp_microcode[i]); + } + RADEON_WRITE(R600_CP_PFP_UCODE_ADDR, 0); + RADEON_WRITE(R600_CP_ME_RAM_WADDR, 0); + RADEON_WRITE(R600_CP_ME_RAM_RADDR, 0); + +} + +static void r700_vm_init(struct drm_device *dev) +{ + drm_radeon_private_t *dev_priv = dev->dev_private; + /* initialise the VM to use the page table we constructed up there */ + u32 vm_c0, i; + u32 mc_vm_md_l1; + u32 vm_l2_cntl, vm_l2_cntl3; + /* okay set up the PCIE aperture type thingo */ + RADEON_WRITE(R700_MC_VM_SYSTEM_APERTURE_LOW_ADDR, dev_priv->gart_vm_start >> 12); + RADEON_WRITE(R700_MC_VM_SYSTEM_APERTURE_HIGH_ADDR, (dev_priv->gart_vm_start + dev_priv->gart_size - 1) >> 12); + RADEON_WRITE(R700_MC_VM_SYSTEM_APERTURE_DEFAULT_ADDR, 0); + + mc_vm_md_l1 = R700_ENABLE_L1_TLB | + R700_ENABLE_L1_FRAGMENT_PROCESSING | + R700_SYSTEM_ACCESS_MODE_IN_SYS | + R700_SYSTEM_APERTURE_UNMAPPED_ACCESS_PASS_THRU | + R700_EFFECTIVE_L1_TLB_SIZE(5) | + R700_EFFECTIVE_L1_QUEUE_SIZE(5); + + RADEON_WRITE(R700_MC_VM_MD_L1_TLB0_CNTL, mc_vm_md_l1); + RADEON_WRITE(R700_MC_VM_MD_L1_TLB1_CNTL, mc_vm_md_l1); + RADEON_WRITE(R700_MC_VM_MD_L1_TLB2_CNTL, mc_vm_md_l1); + RADEON_WRITE(R700_MC_VM_MB_L1_TLB0_CNTL, mc_vm_md_l1); + RADEON_WRITE(R700_MC_VM_MB_L1_TLB1_CNTL, mc_vm_md_l1); + RADEON_WRITE(R700_MC_VM_MB_L1_TLB2_CNTL, mc_vm_md_l1); + RADEON_WRITE(R700_MC_VM_MB_L1_TLB3_CNTL, mc_vm_md_l1); + + vm_l2_cntl = R600_VM_L2_CACHE_EN | R600_VM_L2_FRAG_PROC | R600_VM_ENABLE_PTE_CACHE_LRU_W; + vm_l2_cntl |= R700_VM_L2_CNTL_QUEUE_SIZE(7); + RADEON_WRITE(R600_VM_L2_CNTL, vm_l2_cntl); + + RADEON_WRITE(R600_VM_L2_CNTL2, 0); + vm_l2_cntl3 = R700_VM_L2_CNTL3_BANK_SELECT(0) | R700_VM_L2_CNTL3_CACHE_UPDATE_MODE(2); + RADEON_WRITE(R600_VM_L2_CNTL3, vm_l2_cntl3); + + vm_c0 = R600_VM_ENABLE_CONTEXT | R600_VM_PAGE_TABLE_DEPTH_FLAT; + + RADEON_WRITE(R600_VM_CONTEXT0_CNTL, vm_c0); + + vm_c0 &= ~R600_VM_ENABLE_CONTEXT; + + /* disable all other contexts */ + for (i = 1; i < 8; i++) + RADEON_WRITE(R600_VM_CONTEXT0_CNTL + (i * 4), vm_c0); + + RADEON_WRITE(R700_VM_CONTEXT0_PAGE_TABLE_BASE_ADDR, dev_priv->gart_info.bus_addr >> 12); + RADEON_WRITE(R700_VM_CONTEXT0_PAGE_TABLE_START_ADDR, dev_priv->gart_vm_start >> 12); + RADEON_WRITE(R700_VM_CONTEXT0_PAGE_TABLE_END_ADDR, (dev_priv->gart_vm_start + dev_priv->gart_size - 1) >> 12); + + r600_vm_flush_gart_range(dev); +} + +/* load r600 microcode */ +static void r700_cp_load_microcode(drm_radeon_private_t *dev_priv) +{ + int i; + + r600_do_cp_stop(dev_priv); + + RADEON_WRITE(R600_CP_RB_CNTL, + R600_RB_NO_UPDATE | + (15 << 8) | + (3 << 0)); + + RADEON_WRITE(R600_GRBM_SOFT_RESET, R600_SOFT_RESET_CP); + RADEON_READ(R600_GRBM_SOFT_RESET); + DRM_UDELAY(15000); + RADEON_WRITE(R600_GRBM_SOFT_RESET, 0); + + + if (((dev_priv->flags & RADEON_FAMILY_MASK) == CHIP_RV770)) { + RADEON_WRITE(R600_CP_PFP_UCODE_ADDR, 0); + DRM_INFO("Loading RV770 PFP Microcode\n"); + for (i = 0; i < R700_PFP_UCODE_SIZE; i++) + RADEON_WRITE(R600_CP_PFP_UCODE_DATA, RV770_pfp_microcode[i]); + RADEON_WRITE(R600_CP_PFP_UCODE_ADDR, 0); + + RADEON_WRITE(R600_CP_ME_RAM_WADDR, 0); + DRM_INFO("Loading RV770 CP Microcode\n"); + for (i = 0; i < R700_PM4_UCODE_SIZE; i++) + RADEON_WRITE(R600_CP_ME_RAM_DATA, RV770_cp_microcode[i]); + RADEON_WRITE(R600_CP_ME_RAM_WADDR, 0); + + } else if (((dev_priv->flags & RADEON_FAMILY_MASK) == CHIP_RV730)) { + RADEON_WRITE(R600_CP_PFP_UCODE_ADDR, 0); + DRM_INFO("Loading RV730 PFP Microcode\n"); + for (i = 0; i < R700_PFP_UCODE_SIZE; i++) + RADEON_WRITE(R600_CP_PFP_UCODE_DATA, RV730_pfp_microcode[i]); + RADEON_WRITE(R600_CP_PFP_UCODE_ADDR, 0); + + RADEON_WRITE(R600_CP_ME_RAM_WADDR, 0); + DRM_INFO("Loading RV730 CP Microcode\n"); + for (i = 0; i < R700_PM4_UCODE_SIZE; i++) + RADEON_WRITE(R600_CP_ME_RAM_DATA, RV730_cp_microcode[i]); + RADEON_WRITE(R600_CP_ME_RAM_WADDR, 0); + + } else if (((dev_priv->flags & RADEON_FAMILY_MASK) == CHIP_RV710)) { + RADEON_WRITE(R600_CP_PFP_UCODE_ADDR, 0); + DRM_INFO("Loading RV710 PFP Microcode\n"); + for (i = 0; i < R700_PFP_UCODE_SIZE; i++) + RADEON_WRITE(R600_CP_PFP_UCODE_DATA, RV710_pfp_microcode[i]); + RADEON_WRITE(R600_CP_PFP_UCODE_ADDR, 0); + + RADEON_WRITE(R600_CP_ME_RAM_WADDR, 0); + DRM_INFO("Loading RV710 CP Microcode\n"); + for (i = 0; i < R700_PM4_UCODE_SIZE; i++) + RADEON_WRITE(R600_CP_ME_RAM_DATA, RV710_cp_microcode[i]); + RADEON_WRITE(R600_CP_ME_RAM_WADDR, 0); + + } + RADEON_WRITE(R600_CP_PFP_UCODE_ADDR, 0); + RADEON_WRITE(R600_CP_ME_RAM_WADDR, 0); + RADEON_WRITE(R600_CP_ME_RAM_RADDR, 0); + +} + +static void r600_test_writeback(drm_radeon_private_t *dev_priv) +{ + u32 tmp; + + /* Start with assuming that writeback doesn't work */ + dev_priv->writeback_works = 0; + + /* Writeback doesn't seem to work everywhere, test it here and possibly + * enable it if it appears to work + */ + radeon_write_ring_rptr(dev_priv, R600_SCRATCHOFF(1), 0); + + RADEON_WRITE(R600_SCRATCH_REG1, 0xdeadbeef); + + for (tmp = 0; tmp < dev_priv->usec_timeout; tmp++) { + u32 val; + + val = radeon_read_ring_rptr(dev_priv, R600_SCRATCHOFF(1)); + if (val == 0xdeadbeef) + break; + DRM_UDELAY(1); + } + + if (tmp < dev_priv->usec_timeout) { + dev_priv->writeback_works = 1; + DRM_INFO("writeback test succeeded in %d usecs\n", tmp); + } else { + dev_priv->writeback_works = 0; + DRM_INFO("writeback test failed\n"); + } + if (radeon_no_wb == 1) { + dev_priv->writeback_works = 0; + DRM_INFO("writeback forced off\n"); + } + + if (!dev_priv->writeback_works) { + /* Disable writeback to avoid unnecessary bus master transfer */ + RADEON_WRITE(R600_CP_RB_CNTL, RADEON_READ(R600_CP_RB_CNTL) | + RADEON_RB_NO_UPDATE); + RADEON_WRITE(R600_SCRATCH_UMSK, 0); + } +} + +int r600_do_engine_reset(struct drm_device *dev) +{ + drm_radeon_private_t *dev_priv = dev->dev_private; + u32 cp_ptr, cp_me_cntl, cp_rb_cntl; + + DRM_INFO("Resetting GPU\n"); + + cp_ptr = RADEON_READ(R600_CP_RB_WPTR); + cp_me_cntl = RADEON_READ(R600_CP_ME_CNTL); + RADEON_WRITE(R600_CP_ME_CNTL, R600_CP_ME_HALT); + + RADEON_WRITE(R600_GRBM_SOFT_RESET, 0x7fff); + RADEON_READ(R600_GRBM_SOFT_RESET); + DRM_UDELAY(50); + RADEON_WRITE(R600_GRBM_SOFT_RESET, 0); + RADEON_READ(R600_GRBM_SOFT_RESET); + + RADEON_WRITE(R600_CP_RB_WPTR_DELAY, 0); + cp_rb_cntl = RADEON_READ(R600_CP_RB_CNTL); + RADEON_WRITE(R600_CP_RB_CNTL, R600_RB_RPTR_WR_ENA); + + RADEON_WRITE(R600_CP_RB_RPTR_WR, cp_ptr); + RADEON_WRITE(R600_CP_RB_WPTR, cp_ptr); + RADEON_WRITE(R600_CP_RB_CNTL, cp_rb_cntl); + RADEON_WRITE(R600_CP_ME_CNTL, cp_me_cntl); + + /* Reset the CP ring */ + r600_do_cp_reset(dev_priv); + + /* The CP is no longer running after an engine reset */ + dev_priv->cp_running = 0; + + /* Reset any pending vertex, indirect buffers */ + radeon_freelist_reset(dev); + + return 0; + +} + +static u32 r600_get_tile_pipe_to_backend_map(u32 num_tile_pipes, + u32 num_backends, + u32 backend_disable_mask) +{ + u32 backend_map = 0; + u32 enabled_backends_mask; + u32 enabled_backends_count; + u32 cur_pipe; + u32 swizzle_pipe[R6XX_MAX_PIPES]; + u32 cur_backend; + u32 i; + + if (num_tile_pipes > R6XX_MAX_PIPES) + num_tile_pipes = R6XX_MAX_PIPES; + if (num_tile_pipes < 1) + num_tile_pipes = 1; + if (num_backends > R6XX_MAX_BACKENDS) + num_backends = R6XX_MAX_BACKENDS; + if (num_backends < 1) + num_backends = 1; + + enabled_backends_mask = 0; + enabled_backends_count = 0; + for (i = 0; i < R6XX_MAX_BACKENDS; ++i) { + if (((backend_disable_mask >> i) & 1) == 0) { + enabled_backends_mask |= (1 << i); + ++enabled_backends_count; + } + if (enabled_backends_count == num_backends) + break; + } + + if (enabled_backends_count == 0) { + enabled_backends_mask = 1; + enabled_backends_count = 1; + } + + if (enabled_backends_count != num_backends) + num_backends = enabled_backends_count; + + memset((uint8_t *)&swizzle_pipe[0], 0, sizeof(u32) * R6XX_MAX_PIPES); + switch (num_tile_pipes) { + case 1: + swizzle_pipe[0] = 0; + break; + case 2: + swizzle_pipe[0] = 0; + swizzle_pipe[1] = 1; + break; + case 3: + swizzle_pipe[0] = 0; + swizzle_pipe[1] = 1; + swizzle_pipe[2] = 2; + break; + case 4: + swizzle_pipe[0] = 0; + swizzle_pipe[1] = 1; + swizzle_pipe[2] = 2; + swizzle_pipe[3] = 3; + break; + case 5: + swizzle_pipe[0] = 0; + swizzle_pipe[1] = 1; + swizzle_pipe[2] = 2; + swizzle_pipe[3] = 3; + swizzle_pipe[4] = 4; + break; + case 6: + swizzle_pipe[0] = 0; + swizzle_pipe[1] = 2; + swizzle_pipe[2] = 4; + swizzle_pipe[3] = 5; + swizzle_pipe[4] = 1; + swizzle_pipe[5] = 3; + break; + case 7: + swizzle_pipe[0] = 0; + swizzle_pipe[1] = 2; + swizzle_pipe[2] = 4; + swizzle_pipe[3] = 6; + swizzle_pipe[4] = 1; + swizzle_pipe[5] = 3; + swizzle_pipe[6] = 5; + break; + case 8: + swizzle_pipe[0] = 0; + swizzle_pipe[1] = 2; + swizzle_pipe[2] = 4; + swizzle_pipe[3] = 6; + swizzle_pipe[4] = 1; + swizzle_pipe[5] = 3; + swizzle_pipe[6] = 5; + swizzle_pipe[7] = 7; + break; + } + + cur_backend = 0; + for (cur_pipe = 0; cur_pipe < num_tile_pipes; ++cur_pipe) { + while (((1 << cur_backend) & enabled_backends_mask) == 0) + cur_backend = (cur_backend + 1) % R6XX_MAX_BACKENDS; + + backend_map |= (u32)(((cur_backend & 3) << (swizzle_pipe[cur_pipe] * 2))); + + cur_backend = (cur_backend + 1) % R6XX_MAX_BACKENDS; + } + + return backend_map; +} + +static int r600_count_pipe_bits(uint32_t val) +{ + int i, ret = 0; + for (i = 0; i < 32; i++) { + ret += val & 1; + val >>= 1; + } + return ret; +} + +static void r600_gfx_init(struct drm_device *dev, + drm_radeon_private_t *dev_priv) +{ + int i, j, num_qd_pipes; + u32 sx_debug_1; + u32 tc_cntl; + u32 arb_pop; + u32 num_gs_verts_per_thread; + u32 vgt_gs_per_es; + u32 gs_prim_buffer_depth = 0; + u32 sq_ms_fifo_sizes; + u32 sq_config; + u32 sq_gpr_resource_mgmt_1 = 0; + u32 sq_gpr_resource_mgmt_2 = 0; + u32 sq_thread_resource_mgmt = 0; + u32 sq_stack_resource_mgmt_1 = 0; + u32 sq_stack_resource_mgmt_2 = 0; + u32 hdp_host_path_cntl; + u32 backend_map; + u32 gb_tiling_config = 0; + u32 cc_rb_backend_disable = 0; + u32 cc_gc_shader_pipe_config = 0; + u32 ramcfg; + + /* setup chip specs */ + switch (dev_priv->flags & RADEON_FAMILY_MASK) { + case CHIP_R600: + dev_priv->r600_max_pipes = 4; + dev_priv->r600_max_tile_pipes = 8; + dev_priv->r600_max_simds = 4; + dev_priv->r600_max_backends = 4; + dev_priv->r600_max_gprs = 256; + dev_priv->r600_max_threads = 192; + dev_priv->r600_max_stack_entries = 256; + dev_priv->r600_max_hw_contexts = 8; + dev_priv->r600_max_gs_threads = 16; + dev_priv->r600_sx_max_export_size = 128; + dev_priv->r600_sx_max_export_pos_size = 16; + dev_priv->r600_sx_max_export_smx_size = 128; + dev_priv->r600_sq_num_cf_insts = 2; + break; + case CHIP_RV630: + case CHIP_RV635: + dev_priv->r600_max_pipes = 2; + dev_priv->r600_max_tile_pipes = 2; + dev_priv->r600_max_simds = 3; + dev_priv->r600_max_backends = 1; + dev_priv->r600_max_gprs = 128; + dev_priv->r600_max_threads = 192; + dev_priv->r600_max_stack_entries = 128; + dev_priv->r600_max_hw_contexts = 8; + dev_priv->r600_max_gs_threads = 4; + dev_priv->r600_sx_max_export_size = 128; + dev_priv->r600_sx_max_export_pos_size = 16; + dev_priv->r600_sx_max_export_smx_size = 128; + dev_priv->r600_sq_num_cf_insts = 2; + break; + case CHIP_RV610: + case CHIP_RS780: + case CHIP_RV620: + dev_priv->r600_max_pipes = 1; + dev_priv->r600_max_tile_pipes = 1; + dev_priv->r600_max_simds = 2; + dev_priv->r600_max_backends = 1; + dev_priv->r600_max_gprs = 128; + dev_priv->r600_max_threads = 192; + dev_priv->r600_max_stack_entries = 128; + dev_priv->r600_max_hw_contexts = 4; + dev_priv->r600_max_gs_threads = 4; + dev_priv->r600_sx_max_export_size = 128; + dev_priv->r600_sx_max_export_pos_size = 16; + dev_priv->r600_sx_max_export_smx_size = 128; + dev_priv->r600_sq_num_cf_insts = 1; + break; + case CHIP_RV670: + dev_priv->r600_max_pipes = 4; + dev_priv->r600_max_tile_pipes = 4; + dev_priv->r600_max_simds = 4; + dev_priv->r600_max_backends = 4; + dev_priv->r600_max_gprs = 192; + dev_priv->r600_max_threads = 192; + dev_priv->r600_max_stack_entries = 256; + dev_priv->r600_max_hw_contexts = 8; + dev_priv->r600_max_gs_threads = 16; + dev_priv->r600_sx_max_export_size = 128; + dev_priv->r600_sx_max_export_pos_size = 16; + dev_priv->r600_sx_max_export_smx_size = 128; + dev_priv->r600_sq_num_cf_insts = 2; + break; + default: + break; + } + + /* Initialize HDP */ + j = 0; + for (i = 0; i < 32; i++) { + RADEON_WRITE((0x2c14 + j), 0x00000000); + RADEON_WRITE((0x2c18 + j), 0x00000000); + RADEON_WRITE((0x2c1c + j), 0x00000000); + RADEON_WRITE((0x2c20 + j), 0x00000000); + RADEON_WRITE((0x2c24 + j), 0x00000000); + j += 0x18; + } + + RADEON_WRITE(R600_GRBM_CNTL, R600_GRBM_READ_TIMEOUT(0xff)); + + /* setup tiling, simd, pipe config */ + ramcfg = RADEON_READ(R600_RAMCFG); + + switch (dev_priv->r600_max_tile_pipes) { + case 1: + gb_tiling_config |= R600_PIPE_TILING(0); + break; + case 2: + gb_tiling_config |= R600_PIPE_TILING(1); + break; + case 4: + gb_tiling_config |= R600_PIPE_TILING(2); + break; + case 8: + gb_tiling_config |= R600_PIPE_TILING(3); + break; + default: + break; + } + + gb_tiling_config |= R600_BANK_TILING((ramcfg >> R600_NOOFBANK_SHIFT) & R600_NOOFBANK_MASK); + + gb_tiling_config |= R600_GROUP_SIZE(0); + + if (((ramcfg >> R600_NOOFROWS_SHIFT) & R600_NOOFROWS_MASK) > 3) { + gb_tiling_config |= R600_ROW_TILING(3); *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@FreeBSD.ORG Sat Mar 7 22:05: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 5DCEA106564A; Sat, 7 Mar 2009 22:05:59 +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 307528FC13; Sat, 7 Mar 2009 22:05:59 +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 n27M5xb1063956; Sat, 7 Mar 2009 22:05:59 GMT (envelope-from marcel@svn.freebsd.org) Received: (from marcel@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n27M5xKe063954; Sat, 7 Mar 2009 22:05:59 GMT (envelope-from marcel@svn.freebsd.org) Message-Id: <200903072205.n27M5xKe063954@svn.freebsd.org> From: Marcel Moolenaar Date: Sat, 7 Mar 2009 22:05: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: r189500 - head/sys/boot/i386/boot2 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, 07 Mar 2009 22:06:00 -0000 Author: marcel Date: Sat Mar 7 22:05:58 2009 New Revision: 189500 URL: http://svn.freebsd.org/changeset/base/189500 Log: Revert the part of change 107879 that employs the unused bytes after the disklabel in the 2nd sector for boot code. Even with both UFS1 and UFS2 supported, there's enough bytes left that we don't have to nibble from the disklabel. Thus, the entire 2nd sector is now reserved for the disklabel, which makes the bootcode compatible again with disklabels that have more than 8 partitions -- such as those created and supported by gpart. i386: 135 bytes available amd64: 151 bytes available Ok'd by: jhb Modified: head/sys/boot/i386/boot2/Makefile head/sys/boot/i386/boot2/boot1.S Modified: head/sys/boot/i386/boot2/Makefile ============================================================================== --- head/sys/boot/i386/boot2/Makefile Sat Mar 7 21:36:57 2009 (r189499) +++ head/sys/boot/i386/boot2/Makefile Sat Mar 7 22:05:58 2009 (r189500) @@ -70,7 +70,7 @@ boot2.ld: boot2.ldr boot2.bin ${BTXKERN} -o ${.TARGET} -P 1 boot2.bin boot2.ldr: - dd if=/dev/zero of=${.TARGET} bs=276 count=1 + dd if=/dev/zero of=${.TARGET} bs=512 count=1 boot2.bin: boot2.out objcopy -S -O binary boot2.out ${.TARGET} Modified: head/sys/boot/i386/boot2/boot1.S ============================================================================== --- head/sys/boot/i386/boot2/boot1.S Sat Mar 7 21:36:57 2009 (r189499) +++ head/sys/boot/i386/boot2/boot1.S Sat Mar 7 22:05:58 2009 (r189500) @@ -19,7 +19,7 @@ .set MEM_REL,0x700 # Relocation address .set MEM_ARG,0x900 # Arguments .set MEM_ORG,0x7c00 # Origin - .set MEM_BUF,0x8cec # Load area + .set MEM_BUF,0x8c00 # Load area .set MEM_BTX,0x9000 # BTX start .set MEM_JMP,0x9010 # BTX entry point .set MEM_USR,0xa000 # Client start @@ -172,9 +172,9 @@ main.4: xor %dx,%dx # Partition:drive * Ok, we have a slice and drive in %dx now, so use that to locate and load * boot2. %si references the start of the slice we are looking for, so go * ahead and load up the first 16 sectors (boot1 + boot2) from that. When - * we read it in, we conveniently use 0x8cec as our transfer buffer. Thus, - * boot1 ends up at 0x8cec, and boot2 starts at 0x8cec + 0x200 = 0x8eec. - * The first part of boot2 is the disklabel, which is 0x114 bytes long. + * we read it in, we conveniently use 0x8c00 as our transfer buffer. Thus, + * boot1 ends up at 0x8c00, and boot2 starts at 0x8c00 + 0x200 = 0x8e00. + * The first part of boot2 is the disklabel, which is 0x200 bytes long. * The second part is BTX, which is thus loaded into 0x9000, which is where * it also runs from. The boot2.bin binary starts right after the end of * BTX, so we have to figure out where the start of it is and then move the From owner-svn-src-head@FreeBSD.ORG Sat Mar 7 22:17: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 43FAA1065670; Sat, 7 Mar 2009 22:17:45 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 17D708FC18; Sat, 7 Mar 2009 22:17:45 +0000 (UTC) (envelope-from rwatson@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 n27MHibD064314; Sat, 7 Mar 2009 22:17:44 GMT (envelope-from rwatson@svn.freebsd.org) Received: (from rwatson@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n27MHiw3064313; Sat, 7 Mar 2009 22:17:44 GMT (envelope-from rwatson@svn.freebsd.org) Message-Id: <200903072217.n27MHiw3064313@svn.freebsd.org> From: Robert Watson Date: Sat, 7 Mar 2009 22:17: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: r189501 - head/sys/net 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, 07 Mar 2009 22:17:45 -0000 Author: rwatson Date: Sat Mar 7 22:17:44 2009 New Revision: 189501 URL: http://svn.freebsd.org/changeset/base/189501 Log: When resetting a BPF descriptor, properly check that zero-copy buffers are not currently owned by userspace before clearing or rotating them. Otherwise we may not play by the rules of the shared memory protocol, potentially corrupting packet data or causing userspace applications that are playing by the rules to spin due to being notified that a buffer is complete but the shared memory header not reflecting that. This behavior was seen with pflogd by a number of reporters; note that this fix is not sufficient to get pflogd properly working with zero-copy BPF, due to pflogd opening the BPF device before forking, leading to the shared memory buffer not being propery inherited in the privilege-separated child. We're still deciding how to fix that problem. This change exposes buffer-model specific strategy information in reset_d(), which will be fixed at a later date once we've decided how best to improve the BPF buffer abstraction. Reviewed by: csjp Reported by: keramida Modified: head/sys/net/bpf.c Modified: head/sys/net/bpf.c ============================================================================== --- head/sys/net/bpf.c Sat Mar 7 22:05:58 2009 (r189500) +++ head/sys/net/bpf.c Sat Mar 7 22:17:44 2009 (r189501) @@ -898,22 +898,28 @@ bpfwrite(struct cdev *dev, struct uio *u } /* - * Reset a descriptor by flushing its packet buffer and clearing the - * receive and drop counts. + * Reset a descriptor by flushing its packet buffer and clearing the receive + * and drop counts. This is doable for kernel-only buffers, but with + * zero-copy buffers, we can't write to (or rotate) buffers that are + * currently owned by userspace. It would be nice if we could encapsulate + * this logic in the buffer code rather than here. */ static void reset_d(struct bpf_d *d) { mtx_assert(&d->bd_mtx, MA_OWNED); - if (d->bd_hbuf) { + + if ((d->bd_hbuf != NULL) && + (d->bd_bufmode != BPF_BUFMODE_ZBUF || bpf_canfreebuf(d))) { /* Free the hold buffer. */ d->bd_fbuf = d->bd_hbuf; d->bd_hbuf = NULL; + d->bd_hlen = 0; bpf_buf_reclaimed(d); } - d->bd_slen = 0; - d->bd_hlen = 0; + if (bpf_canwritebuf(d)) + d->bd_slen = 0; d->bd_rcount = 0; d->bd_dcount = 0; d->bd_fcount = 0;