From owner-svn-src-head@FreeBSD.ORG Sun Nov 30 00:10:56 2008 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3A4AF106567B; Sun, 30 Nov 2008 00:10:56 +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 2B8908FC1D; Sun, 30 Nov 2008 00:10:56 +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 mAU0Au8S066290; Sun, 30 Nov 2008 00:10:56 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mAU0AtBA066289; Sun, 30 Nov 2008 00:10:55 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <200811300010.mAU0AtBA066289@svn.freebsd.org> From: Alexander Motin Date: Sun, 30 Nov 2008 00:10: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: r185460 - 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: Sun, 30 Nov 2008 00:10:56 -0000 Author: mav Date: Sun Nov 30 00:10:55 2008 New Revision: 185460 URL: http://svn.freebsd.org/changeset/base/185460 Log: According to "Intel 64 and IA-32 Architectures Software Developer's Manual Volume 3B: System Programming Guide, Part 2", CPUs with family 0x6 and model above or 0xE and CPUs with family 0xF and model above or 0x3 have invariant TSC. Modified: head/sys/amd64/amd64/identcpu.c Modified: head/sys/amd64/amd64/identcpu.c ============================================================================== --- head/sys/amd64/amd64/identcpu.c Sun Nov 30 00:00:35 2008 (r185459) +++ head/sys/amd64/amd64/identcpu.c Sun Nov 30 00:10:55 2008 (r185460) @@ -368,7 +368,11 @@ printcpuinfo(void) tsc_is_invariant = 1; break; case CPU_VENDOR_INTEL: - if (amd_pminfo & AMDPM_TSC_INVARIANT) + if ((amd_pminfo & AMDPM_TSC_INVARIANT) || + (AMD64_CPU_FAMILY(cpu_id) == 0x6 && + AMD64_CPU_MODEL(cpu_id) >= 0xe) || + (AMD64_CPU_FAMILY(cpu_id) == 0xf && + AMD64_CPU_MODEL(cpu_id) >= 0x3)) tsc_is_invariant = 1; break; } From owner-svn-src-head@FreeBSD.ORG Sun Nov 30 00:11:48 2008 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id AAAED106564A; Sun, 30 Nov 2008 00:11:48 +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 9BBBE8FC14; Sun, 30 Nov 2008 00:11:48 +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 mAU0Bm1Z066361; Sun, 30 Nov 2008 00:11:48 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mAU0Bmw6066360; Sun, 30 Nov 2008 00:11:48 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <200811300011.mAU0Bmw6066360@svn.freebsd.org> From: Alexander Motin Date: Sun, 30 Nov 2008 00:11: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: r185461 - head/sys/i386/i386 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 30 Nov 2008 00:11:48 -0000 Author: mav Date: Sun Nov 30 00:11:48 2008 New Revision: 185461 URL: http://svn.freebsd.org/changeset/base/185461 Log: According to "Intel 64 and IA-32 Architectures Software Developer's Manual Volume 3B: System Programming Guide, Part 2", CPUs with family 0x6 and model above or 0xE and CPUs with family 0xF and model above or 0x3 have invariant TSC. Modified: head/sys/i386/i386/identcpu.c Modified: head/sys/i386/i386/identcpu.c ============================================================================== --- head/sys/i386/i386/identcpu.c Sun Nov 30 00:10:55 2008 (r185460) +++ head/sys/i386/i386/identcpu.c Sun Nov 30 00:11:48 2008 (r185461) @@ -872,7 +872,11 @@ printcpuinfo(void) tsc_is_invariant = 1; break; case CPU_VENDOR_INTEL: - if (amd_pminfo & AMDPM_TSC_INVARIANT) + if ((amd_pminfo & AMDPM_TSC_INVARIANT) || + (I386_CPU_FAMILY(cpu_id) == 0x6 && + I386_CPU_MODEL(cpu_id) >= 0xe) || + (I386_CPU_FAMILY(cpu_id) == 0xf && + I386_CPU_MODEL(cpu_id) >= 0x3)) tsc_is_invariant = 1; break; } From owner-svn-src-head@FreeBSD.ORG Sun Nov 30 05:10:15 2008 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1CECE1065672; Sun, 30 Nov 2008 05:10:15 +0000 (UTC) (envelope-from jkoshy@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 120138FC17; Sun, 30 Nov 2008 05:10:15 +0000 (UTC) (envelope-from jkoshy@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mAU5AEJB072679; Sun, 30 Nov 2008 05:10:14 GMT (envelope-from jkoshy@svn.freebsd.org) Received: (from jkoshy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mAU5AEP9072678; Sun, 30 Nov 2008 05:10:14 GMT (envelope-from jkoshy@svn.freebsd.org) Message-Id: <200811300510.mAU5AEP9072678@svn.freebsd.org> From: Joseph Koshy Date: Sun, 30 Nov 2008 05:10: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: r185465 - head/sys/dev/hwpmc X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 30 Nov 2008 05:10:15 -0000 Author: jkoshy Date: Sun Nov 30 05:10:14 2008 New Revision: 185465 URL: http://svn.freebsd.org/changeset/base/185465 Log: Improve a comment. Modified: head/sys/dev/hwpmc/hwpmc_logging.c Modified: head/sys/dev/hwpmc/hwpmc_logging.c ============================================================================== --- head/sys/dev/hwpmc/hwpmc_logging.c Sun Nov 30 04:44:46 2008 (r185464) +++ head/sys/dev/hwpmc/hwpmc_logging.c Sun Nov 30 05:10:14 2008 (r185465) @@ -281,15 +281,18 @@ pmclog_loop(void *arg) if ((lb = TAILQ_FIRST(&po->po_logbuffers)) == NULL) { mtx_unlock_spin(&po->po_mtx); - /* wakeup any processes waiting for a FLUSH */ + /* + * Wakeup the thread waiting for the + * PMC_OP_FLUSHLOG request to + * complete. + */ if (po->po_flags & PMC_PO_IN_FLUSH) { po->po_flags &= ~PMC_PO_IN_FLUSH; wakeup_one(po->po_kthread); } - - (void) msleep(po, &pmc_kthread_mtx, - PWAIT, "pmcloop", 0); + (void) msleep(po, &pmc_kthread_mtx, PWAIT, + "pmcloop", 0); continue; } From owner-svn-src-head@FreeBSD.ORG Sun Nov 30 05:55:25 2008 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 703E31065672; Sun, 30 Nov 2008 05:55:25 +0000 (UTC) (envelope-from jasone@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 682BA8FC08; Sun, 30 Nov 2008 05:55:25 +0000 (UTC) (envelope-from jasone@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mAU5tOHi074569; Sun, 30 Nov 2008 05:55:24 GMT (envelope-from jasone@svn.freebsd.org) Received: (from jasone@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mAU5tOZX074568; Sun, 30 Nov 2008 05:55:24 GMT (envelope-from jasone@svn.freebsd.org) Message-Id: <200811300555.mAU5tOZX074568@svn.freebsd.org> From: Jason Evans Date: Sun, 30 Nov 2008 05:55: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: r185468 - 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, 30 Nov 2008 05:55:25 -0000 Author: jasone Date: Sun Nov 30 05:55:24 2008 New Revision: 185468 URL: http://svn.freebsd.org/changeset/base/185468 Log: Do not spin when trying to lock on a single-CPU system. Reported by: davidxu Modified: head/lib/libc/stdlib/malloc.c Modified: head/lib/libc/stdlib/malloc.c ============================================================================== --- head/lib/libc/stdlib/malloc.c Sun Nov 30 05:45:18 2008 (r185467) +++ head/lib/libc/stdlib/malloc.c Sun Nov 30 05:55:24 2008 (r185468) @@ -1262,18 +1262,20 @@ malloc_spin_lock(pthread_mutex_t *lock) if (__isthreaded) { if (_pthread_mutex_trylock(lock) != 0) { - unsigned i; - volatile unsigned j; + /* Exponentially back off if there are multiple CPUs. */ + if (ncpus > 1) { + unsigned i; + volatile unsigned j; + + for (i = 1; i <= SPIN_LIMIT_2POW; i++) { + for (j = 0; j < (1U << i); j++) { + ret++; + CPU_SPINWAIT; + } - /* Exponentially back off. */ - for (i = 1; i <= SPIN_LIMIT_2POW; i++) { - for (j = 0; j < (1U << i); j++) { - ret++; - CPU_SPINWAIT; + if (_pthread_mutex_trylock(lock) == 0) + return (ret); } - - if (_pthread_mutex_trylock(lock) == 0) - return (ret); } /* From owner-svn-src-head@FreeBSD.ORG Sun Nov 30 08:40:04 2008 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id EB67E1065675; Sun, 30 Nov 2008 08:40:04 +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 E285D8FC0A; Sun, 30 Nov 2008 08:40:04 +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 mAU8e4DA081472; Sun, 30 Nov 2008 08:40:04 GMT (envelope-from imp@svn.freebsd.org) Received: (from imp@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mAU8e4P4081471; Sun, 30 Nov 2008 08:40:04 GMT (envelope-from imp@svn.freebsd.org) Message-Id: <200811300840.mAU8e4P4081471@svn.freebsd.org> From: Warner Losh Date: Sun, 30 Nov 2008 08:40: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: r185471 - 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: Sun, 30 Nov 2008 08:40:05 -0000 Author: imp Date: Sun Nov 30 08:40:04 2008 New Revision: 185471 URL: http://svn.freebsd.org/changeset/base/185471 Log: On FreeBSD, printing the version is centralized, so no need to repeat it here. I think that gonzo@ has also made this change to p4. Modified: head/sys/mips/mips/machdep.c Modified: head/sys/mips/mips/machdep.c ============================================================================== --- head/sys/mips/mips/machdep.c Sun Nov 30 07:25:03 2008 (r185470) +++ head/sys/mips/mips/machdep.c Sun Nov 30 08:40:04 2008 (r185471) @@ -168,8 +168,6 @@ cpu_startup(void *dummy) /* * Good {morning,afternoon,evening,night}. */ - printf("%s", version); - printf("real memory = %lu (%luK bytes)\n", ptoa(Maxmem), ptoa(Maxmem) / 1024); realmem = Maxmem; From owner-svn-src-head@FreeBSD.ORG Sun Nov 30 11:03:16 2008 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6C794106564A; Sun, 30 Nov 2008 11:03:16 +0000 (UTC) (envelope-from antoine@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 596CB8FC13; Sun, 30 Nov 2008 11:03:16 +0000 (UTC) (envelope-from antoine@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mAUB3GBY087736; Sun, 30 Nov 2008 11:03:16 GMT (envelope-from antoine@svn.freebsd.org) Received: (from antoine@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mAUB3GQ0087734; Sun, 30 Nov 2008 11:03:16 GMT (envelope-from antoine@svn.freebsd.org) Message-Id: <200811301103.mAUB3GQ0087734@svn.freebsd.org> From: Antoine Brodin Date: Sun, 30 Nov 2008 11:03: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: r185472 - 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, 30 Nov 2008 11:03:16 -0000 Author: antoine Date: Sun Nov 30 11:03:16 2008 New Revision: 185472 URL: http://svn.freebsd.org/changeset/base/185472 Log: Add more obsolete files. Modified: head/ObsoleteFiles.inc Modified: head/ObsoleteFiles.inc ============================================================================== --- head/ObsoleteFiles.inc Sun Nov 30 08:40:04 2008 (r185471) +++ head/ObsoleteFiles.inc Sun Nov 30 11:03:16 2008 (r185472) @@ -14,6 +14,11 @@ # The file is partitioned: OLD_FILES first, then OLD_LIBS and OLD_DIRS last. # +# 20081123: vfs_mountedon.9 removed +OLD_FILES+=usr/share/man/man9/vfs_mountedon.9.gz +# 20081023: FREE.9 and MALLOC.9 removed +OLD_FILES+=usr/share/man/man9/FREE.9.gz +OLD_FILES+=usr/share/man/man9/MALLOC.9.gz # 20080928: removal of inaccurate device_ids(9) manual page OLD_FILES+=usr/share/man/man9/device_ids.9.gz OLD_FILES+=usr/share/man/man9/major.9.gz From owner-svn-src-head@FreeBSD.ORG Sun Nov 30 12:21:48 2008 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E0A93106564A; Sun, 30 Nov 2008 12:21:46 +0000 (UTC) (envelope-from dfr@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 976D08FC12; Sun, 30 Nov 2008 12:21:46 +0000 (UTC) (envelope-from dfr@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mAUCLka0089662; Sun, 30 Nov 2008 12:21:46 GMT (envelope-from dfr@svn.freebsd.org) Received: (from dfr@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mAUCLkeF089660; Sun, 30 Nov 2008 12:21:46 GMT (envelope-from dfr@svn.freebsd.org) Message-Id: <200811301221.mAUCLkeF089660@svn.freebsd.org> From: Doug Rabson Date: Sun, 30 Nov 2008 12: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: r185473 - head/sys/dev/xen/netfront X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 30 Nov 2008 12:21:49 -0000 Author: dfr Date: Sun Nov 30 12:21:46 2008 New Revision: 185473 URL: http://svn.freebsd.org/changeset/base/185473 Log: Don't call ether_ioctl() with locks held. Loop in xn_rxeof() until the backend stops adding stuff to the ring otherwise we miss RX interrupts which kills performance. Modified: head/sys/dev/xen/netfront/netfront.c Modified: head/sys/dev/xen/netfront/netfront.c ============================================================================== --- head/sys/dev/xen/netfront/netfront.c Sun Nov 30 11:03:16 2008 (r185472) +++ head/sys/dev/xen/netfront/netfront.c Sun Nov 30 12:21:46 2008 (r185473) @@ -855,110 +855,112 @@ xn_rxeof(struct netfront_info *np) multicall_entry_t *mcl; struct mbuf *m; struct mbuf_head rxq, errq; - int err, pages_flipped = 0; + int err, pages_flipped = 0, work_to_do; - XN_RX_LOCK_ASSERT(np); - if (!netfront_carrier_ok(np)) - return; + do { + XN_RX_LOCK_ASSERT(np); + if (!netfront_carrier_ok(np)) + return; - mbufq_init(&errq); - mbufq_init(&rxq); + mbufq_init(&errq); + mbufq_init(&rxq); - ifp = np->xn_ifp; + ifp = np->xn_ifp; - rp = np->rx.sring->rsp_prod; - rmb(); /* Ensure we see queued responses up to 'rp'. */ + rp = np->rx.sring->rsp_prod; + rmb(); /* Ensure we see queued responses up to 'rp'. */ + + i = np->rx.rsp_cons; + while ((i != rp)) { + memcpy(rx, RING_GET_RESPONSE(&np->rx, i), sizeof(*rx)); + memset(extras, 0, sizeof(rinfo.extras)); - i = np->rx.rsp_cons; - while ((i != rp)) { - memcpy(rx, RING_GET_RESPONSE(&np->rx, i), sizeof(*rx)); - memset(extras, 0, sizeof(rinfo.extras)); - - m = NULL; - err = xennet_get_responses(np, &rinfo, rp, &m, - &pages_flipped); + m = NULL; + err = xennet_get_responses(np, &rinfo, rp, &m, + &pages_flipped); - if (unlikely(err)) { + if (unlikely(err)) { if (m) - mbufq_tail(&errq, m); - np->stats.rx_errors++; - i = np->rx.rsp_cons; - continue; - } + mbufq_tail(&errq, m); + np->stats.rx_errors++; + i = np->rx.rsp_cons; + continue; + } - m->m_pkthdr.rcvif = ifp; - if ( rx->flags & NETRXF_data_validated ) { - /* Tell the stack the checksums are okay */ - /* - * XXX this isn't necessarily the case - need to add - * check - */ + m->m_pkthdr.rcvif = ifp; + if ( rx->flags & NETRXF_data_validated ) { + /* Tell the stack the checksums are okay */ + /* + * XXX this isn't necessarily the case - need to add + * check + */ - m->m_pkthdr.csum_flags |= - (CSUM_IP_CHECKED | CSUM_IP_VALID | CSUM_DATA_VALID - | CSUM_PSEUDO_HDR); - m->m_pkthdr.csum_data = 0xffff; - } + m->m_pkthdr.csum_flags |= + (CSUM_IP_CHECKED | CSUM_IP_VALID | CSUM_DATA_VALID + | CSUM_PSEUDO_HDR); + m->m_pkthdr.csum_data = 0xffff; + } - np->stats.rx_packets++; - np->stats.rx_bytes += m->m_pkthdr.len; + np->stats.rx_packets++; + np->stats.rx_bytes += m->m_pkthdr.len; - mbufq_tail(&rxq, m); - np->rx.rsp_cons = ++i; - } + mbufq_tail(&rxq, m); + np->rx.rsp_cons = ++i; + } - if (pages_flipped) { - /* Some pages are no longer absent... */ + if (pages_flipped) { + /* Some pages are no longer absent... */ #ifdef notyet - balloon_update_driver_allowance(-pages_flipped); + balloon_update_driver_allowance(-pages_flipped); #endif - /* Do all the remapping work, and M->P updates, in one big - * hypercall. - */ - if (!!xen_feature(XENFEAT_auto_translated_physmap)) { - mcl = np->rx_mcl + pages_flipped; - mcl->op = __HYPERVISOR_mmu_update; - mcl->args[0] = (u_long)np->rx_mmu; - mcl->args[1] = pages_flipped; - mcl->args[2] = 0; - mcl->args[3] = DOMID_SELF; - (void)HYPERVISOR_multicall(np->rx_mcl, - pages_flipped + 1); + /* Do all the remapping work, and M->P updates, in one big + * hypercall. + */ + if (!!xen_feature(XENFEAT_auto_translated_physmap)) { + mcl = np->rx_mcl + pages_flipped; + mcl->op = __HYPERVISOR_mmu_update; + mcl->args[0] = (u_long)np->rx_mmu; + mcl->args[1] = pages_flipped; + mcl->args[2] = 0; + mcl->args[3] = DOMID_SELF; + (void)HYPERVISOR_multicall(np->rx_mcl, + pages_flipped + 1); + } } - } - while ((m = mbufq_dequeue(&errq))) - m_freem(m); - - /* - * Process all the mbufs after the remapping is complete. - * Break the mbuf chain first though. - */ - while ((m = mbufq_dequeue(&rxq)) != NULL) { - ifp->if_ipackets++; - - /* - * Do we really need to drop the rx lock? + while ((m = mbufq_dequeue(&errq))) + m_freem(m); + + /* + * Process all the mbufs after the remapping is complete. + * Break the mbuf chain first though. */ - XN_RX_UNLOCK(np); - /* Pass it up. */ - (*ifp->if_input)(ifp, m); - XN_RX_LOCK(np); - } + while ((m = mbufq_dequeue(&rxq)) != NULL) { + ifp->if_ipackets++; + + /* + * Do we really need to drop the rx lock? + */ + XN_RX_UNLOCK(np); + /* Pass it up. */ + (*ifp->if_input)(ifp, m); + XN_RX_LOCK(np); + } - np->rx.rsp_cons = i; + np->rx.rsp_cons = i; #if 0 - /* If we get a callback with very few responses, reduce fill target. */ - /* NB. Note exponential increase, linear decrease. */ - if (((np->rx.req_prod_pvt - np->rx.sring->rsp_prod) > - ((3*np->rx_target) / 4)) && (--np->rx_target < np->rx_min_target)) - np->rx_target = np->rx_min_target; + /* If we get a callback with very few responses, reduce fill target. */ + /* NB. Note exponential increase, linear decrease. */ + if (((np->rx.req_prod_pvt - np->rx.sring->rsp_prod) > + ((3*np->rx_target) / 4)) && (--np->rx_target < np->rx_min_target)) + np->rx_target = np->rx_min_target; #endif - network_alloc_rx_buffers(np); + network_alloc_rx_buffers(np); - np->rx.sring->rsp_event = i + 1; + RING_FINAL_CHECK_FOR_RESPONSES(&np->rx, work_to_do); + } while (work_to_do); } static void @@ -1437,9 +1439,11 @@ xn_ioctl(struct ifnet *ifp, u_long cmd, if (!(ifp->if_drv_flags & IFF_DRV_RUNNING)) xn_ifinit_locked(sc); arp_ifinit(ifp, ifa); - } else + XN_UNLOCK(sc); + } else { + XN_UNLOCK(sc); error = ether_ioctl(ifp, cmd, data); - XN_UNLOCK(sc); + } break; case SIOCSIFMTU: /* XXX can we alter the MTU on a VN ?*/ From owner-svn-src-head@FreeBSD.ORG Sun Nov 30 13:18:35 2008 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D5AA61065676; Sun, 30 Nov 2008 13:18:35 +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 C04A98FC14; Sun, 30 Nov 2008 13:18:35 +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 mAUDIZio091093; Sun, 30 Nov 2008 13:18:35 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mAUDIZHr091092; Sun, 30 Nov 2008 13:18:35 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <200811301318.mAUDIZHr091092@svn.freebsd.org> From: Konstantin Belousov Date: Sun, 30 Nov 2008 13:18: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: r185474 - head/share/man/man9 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 30 Nov 2008 13:18:36 -0000 Author: kib Date: Sun Nov 30 13:18:35 2008 New Revision: 185474 URL: http://svn.freebsd.org/changeset/base/185474 Log: Clarify the reason to not use the volatile string as an argument to CTR macros. Note the logging of file and line. Reviewed by: dchagin MFC after: 3 days Modified: head/share/man/man9/ktr.9 Modified: head/share/man/man9/ktr.9 ============================================================================== --- head/share/man/man9/ktr.9 Sun Nov 30 12:21:46 2008 (r185473) +++ head/share/man/man9/ktr.9 Sun Nov 30 13:18:35 2008 (r185474) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd December 27, 2005 +.Dd November 30, 2008 .Dt KTR 9 .Os .Sh NAME @@ -84,9 +84,16 @@ Following the .Fa format string are zero to five arguments referenced by .Fa format . +Each event is logged with a file name and source line number of the +originating CTR call, and a timestamp in addition to the log message. +.Pp +The event is stored in the circular buffer with supplied arguments as is, +and formatting is done at the dump time. +Do not use pointers to the objects with limited lifetime, for instance, +strings, because the pointer may become invalid when buffer is printed. +.Pp Note that the different macros differ only in the number of arguments each one takes, as indicated by its name. -Each event is logged with a timestamp in addition to the log message. .Pp The .Va ktr_entries @@ -121,13 +128,11 @@ mi_switch() * Pick a new current process and record its start time. */ ... - CTR3(KTR_PROC, "mi_switch: old proc %p (pid %d, %s)", p, p->p_pid, - p->p_comm); + CTR3(KTR_PROC, "mi_switch: old proc %p (pid %d)", p, p->p_pid); ... cpu_switch(); ... - CTR3(KTR_PROC, "mi_switch: new proc %p (pid %d, %s)", p, p->p_pid, - p->p_comm); + CTR3(KTR_PROC, "mi_switch: new proc %p (pid %d)", p, p->p_pid); ... } .Ed From owner-svn-src-head@FreeBSD.ORG Sun Nov 30 14:20:10 2008 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 431571065670; Sun, 30 Nov 2008 14:20:10 +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 2D9168FC1A; Sun, 30 Nov 2008 14:20:10 +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 mAUEK8lG092470; Sun, 30 Nov 2008 14:20:08 GMT (envelope-from luigi@svn.freebsd.org) Received: (from luigi@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mAUEK8cP092469; Sun, 30 Nov 2008 14:20:08 GMT (envelope-from luigi@svn.freebsd.org) Message-Id: <200811301420.mAUEK8cP092469@svn.freebsd.org> From: Luigi Rizzo Date: Sun, 30 Nov 2008 14:20: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: r185475 - head/usr.sbin/kldxref X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 30 Nov 2008 14:20:10 -0000 Author: luigi Date: Sun Nov 30 14:20:08 2008 New Revision: 185475 URL: http://svn.freebsd.org/changeset/base/185475 Log: Make the linker.hints file have mode 644 instead of 600. There is nothing secret in the file, and the missing read permission breaks diskless operation. MFC after: 4 weeks Modified: head/usr.sbin/kldxref/kldxref.c Modified: head/usr.sbin/kldxref/kldxref.c ============================================================================== --- head/usr.sbin/kldxref/kldxref.c Sun Nov 30 13:18:35 2008 (r185474) +++ head/usr.sbin/kldxref/kldxref.c Sun Nov 30 14:20:08 2008 (r185475) @@ -266,6 +266,8 @@ maketempfile(char *dest, const char *roo p = dest; strcpy(p, "lhint.XXXXXX"); fd = mkstemp(dest); + if (fd >= 0) + fchmod(fd, 0644); /* nothing secret in the file */ return ((fd == -1) ? NULL : fdopen(fd, "w+")); } From owner-svn-src-head@FreeBSD.ORG Sun Nov 30 15:35:24 2008 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DA22C106567B; Sun, 30 Nov 2008 15:35:24 +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 C52DC8FC12; Sun, 30 Nov 2008 15:35:24 +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 mAUFZO2Q094237; Sun, 30 Nov 2008 15:35:24 GMT (envelope-from csjp@svn.freebsd.org) Received: (from csjp@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mAUFZOHe094236; Sun, 30 Nov 2008 15:35:24 GMT (envelope-from csjp@svn.freebsd.org) Message-Id: <200811301535.mAUFZOHe094236@svn.freebsd.org> From: "Christian S.J. Peron" Date: Sun, 30 Nov 2008 15:35: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: r185476 - head/secure/usr.sbin/sshd X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 30 Nov 2008 15:35:25 -0000 Author: csjp Date: Sun Nov 30 15:35:24 2008 New Revision: 185476 URL: http://svn.freebsd.org/changeset/base/185476 Log: Enable getaudit_addr(2) for sshd again. This will un-break the subject BSM audit tokens for IPv6. Modified: head/secure/usr.sbin/sshd/Makefile Modified: head/secure/usr.sbin/sshd/Makefile ============================================================================== --- head/secure/usr.sbin/sshd/Makefile Sun Nov 30 14:20:08 2008 (r185475) +++ head/secure/usr.sbin/sshd/Makefile Sun Nov 30 15:35:24 2008 (r185476) @@ -26,7 +26,7 @@ DPADD= ${LIBSSH} ${LIBUTIL} ${LIBZ} ${LI LDADD= -lssh -lutil -lz -lwrap ${MINUSLPAM} .if ${MK_AUDIT} != "no" -CFLAGS+= -DUSE_BSM_AUDIT +CFLAGS+= -DUSE_BSM_AUDIT -DHAVE_GETAUDIT_ADDR DPADD+= ${LIBBSM} LDADD+= -lbsm .endif From owner-svn-src-head@FreeBSD.ORG Sun Nov 30 17:40:05 2008 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D2B2A1065672; Sun, 30 Nov 2008 17:40:05 +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 C2A268FC08; Sun, 30 Nov 2008 17:40:05 +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 mAUHe5Pp096926; Sun, 30 Nov 2008 17:40:05 GMT (envelope-from imp@svn.freebsd.org) Received: (from imp@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mAUHe5p4096925; Sun, 30 Nov 2008 17:40:05 GMT (envelope-from imp@svn.freebsd.org) Message-Id: <200811301740.mAUHe5p4096925@svn.freebsd.org> From: Warner Losh Date: Sun, 30 Nov 2008 17:40: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: r185477 - head/sys/arm/at91 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 30 Nov 2008 17:40:06 -0000 Author: imp Date: Sun Nov 30 17:40:05 2008 New Revision: 185477 URL: http://svn.freebsd.org/changeset/base/185477 Log: opt_at91.h isn't needed here at all anymore, since the board init routines have been split out. Remove it. This leaves only one instance of it in the tree that will be going away soon. Modified: head/sys/arm/at91/at91_machdep.c Modified: head/sys/arm/at91/at91_machdep.c ============================================================================== --- head/sys/arm/at91/at91_machdep.c Sun Nov 30 15:35:24 2008 (r185476) +++ head/sys/arm/at91/at91_machdep.c Sun Nov 30 17:40:05 2008 (r185477) @@ -44,7 +44,6 @@ */ #include "opt_msgbuf.h" -#include "opt_at91.h" #include __FBSDID("$FreeBSD$"); From owner-svn-src-head@FreeBSD.ORG Sun Nov 30 17:53:20 2008 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8AB51106564A; Sun, 30 Nov 2008 17:53:20 +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 7A4F58FC16; Sun, 30 Nov 2008 17:53:20 +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 mAUHrK0f097280; Sun, 30 Nov 2008 17:53:20 GMT (envelope-from sam@svn.freebsd.org) Received: (from sam@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mAUHrJtf097268; Sun, 30 Nov 2008 17:53:19 GMT (envelope-from sam@svn.freebsd.org) Message-Id: <200811301753.mAUHrJtf097268@svn.freebsd.org> From: Sam Leffler Date: Sun, 30 Nov 2008 17:53: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: r185478 - in head/sys: arm/conf conf X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 30 Nov 2008 17:53:20 -0000 Author: sam Date: Sun Nov 30 17:53:19 2008 New Revision: 185478 URL: http://svn.freebsd.org/changeset/base/185478 Log: enable use of modules but disable them by adding MODULES_OVERRIDE="" in each config file until we can sort out issues in the modules tree Reviewed by: imp MFC after: 1 month Modified: head/sys/arm/conf/AVILA head/sys/arm/conf/BWCT head/sys/arm/conf/CRB head/sys/arm/conf/DB-78XXX head/sys/arm/conf/DB-88F5XXX head/sys/arm/conf/DB-88F6XXX head/sys/arm/conf/GUMSTIX head/sys/arm/conf/KB920X head/sys/arm/conf/NSLU head/sys/arm/conf/SIMICS head/sys/arm/conf/SKYEYE head/sys/conf/Makefile.arm Modified: head/sys/arm/conf/AVILA ============================================================================== --- head/sys/arm/conf/AVILA Sun Nov 30 17:40:05 2008 (r185477) +++ head/sys/arm/conf/AVILA Sun Nov 30 17:53:19 2008 (r185478) @@ -30,6 +30,7 @@ options STARTUP_PAGETABLE_ADDR=0x100000 include "../xscale/ixp425/std.avila" #To statically compile in device wiring instead of /boot/device.hints hints "AVILA.hints" #Default places to look for devices. +makeoptions MODULES_OVERRIDE="" makeoptions DEBUG=-g #Build kernel with gdb(1) debug symbols makeoptions CONF_CFLAGS=-mcpu=xscale Modified: head/sys/arm/conf/BWCT ============================================================================== --- head/sys/arm/conf/BWCT Sun Nov 30 17:40:05 2008 (r185477) +++ head/sys/arm/conf/BWCT Sun Nov 30 17:53:19 2008 (r185478) @@ -27,6 +27,7 @@ include "../at91/std.bwct" #To statically compile in device wiring instead of /boot/device.hints #hints "hints.at91rm9200" hints "BWCT.hints" +makeoptions MODULES_OVERRIDE="" #makeoptions DEBUG=-g #Build kernel with gdb(1) debug symbols options DDB Modified: head/sys/arm/conf/CRB ============================================================================== --- head/sys/arm/conf/CRB Sun Nov 30 17:40:05 2008 (r185477) +++ head/sys/arm/conf/CRB Sun Nov 30 17:53:19 2008 (r185478) @@ -28,6 +28,7 @@ options STARTUP_PAGETABLE_ADDR=0x0000000 include "../xscale/i8134x/std.crb" #To statically compile in device wiring instead of /boot/device.hints #hints "GENERIC.hints" #Default places to look for devices. +makeoptions MODULES_OVERRIDE="" #makeoptions DEBUG=-g #Build kernel with gdb(1) debug symbols makeoptions CONF_CFLAGS=-mcpu=xscale Modified: head/sys/arm/conf/DB-78XXX ============================================================================== --- head/sys/arm/conf/DB-78XXX Sun Nov 30 17:40:05 2008 (r185477) +++ head/sys/arm/conf/DB-78XXX Sun Nov 30 17:53:19 2008 (r185478) @@ -8,6 +8,7 @@ ident DB-88F78XX include "../mv/discovery/std.db78xxx" options SOC_MV_DISCOVERY +makeoptions MODULES_OVERRIDE="" #makeoptions DEBUG=-g #Build kernel with gdb(1) debug symbols makeoptions WERROR="-Werror" Modified: head/sys/arm/conf/DB-88F5XXX ============================================================================== --- head/sys/arm/conf/DB-88F5XXX Sun Nov 30 17:40:05 2008 (r185477) +++ head/sys/arm/conf/DB-88F5XXX Sun Nov 30 17:53:19 2008 (r185478) @@ -8,6 +8,7 @@ ident DB-88F5XXX include "../mv/orion/std.db88f5xxx" options SOC_MV_ORION +makeoptions MODULES_OVERRIDE="" #makeoptions DEBUG=-g #Build kernel with gdb(1) debug symbols makeoptions WERROR="-Werror" Modified: head/sys/arm/conf/DB-88F6XXX ============================================================================== --- head/sys/arm/conf/DB-88F6XXX Sun Nov 30 17:40:05 2008 (r185477) +++ head/sys/arm/conf/DB-88F6XXX Sun Nov 30 17:53:19 2008 (r185478) @@ -8,6 +8,7 @@ ident DB-88F6XXX include "../mv/kirkwood/std.db88f6xxx" options SOC_MV_KIRKWOOD +makeoptions MODULES_OVERRIDE="" #makeoptions DEBUG=-g #Build kernel with gdb(1) debug symbols makeoptions WERROR="-Werror" Modified: head/sys/arm/conf/GUMSTIX ============================================================================== --- head/sys/arm/conf/GUMSTIX Sun Nov 30 17:40:05 2008 (r185477) +++ head/sys/arm/conf/GUMSTIX Sun Nov 30 17:53:19 2008 (r185478) @@ -34,6 +34,7 @@ options STARTUP_PAGETABLE_ADDR=0xa00000 include "../xscale/pxa/std.pxa" #To statically compile in device wiring instead of /boot/device.hints #hints "GENERIC.hints" #Default places to look for devices. +makeoptions MODULES_OVERRIDE="" makeoptions DEBUG=-g #Build kernel with gdb(1) debug symbols options HZ=100 Modified: head/sys/arm/conf/KB920X ============================================================================== --- head/sys/arm/conf/KB920X Sun Nov 30 17:40:05 2008 (r185477) +++ head/sys/arm/conf/KB920X Sun Nov 30 17:53:19 2008 (r185478) @@ -24,6 +24,7 @@ include "../at91/std.kb920x" # The AT91 platform doesn't use /boot/loader, so we have to statically wire # hints. hints "KB920X.hints" +makeoptions MODULES_OVERRIDE="" makeoptions DEBUG=-g #Build kernel with gdb(1) debug symbols options DDB Modified: head/sys/arm/conf/NSLU ============================================================================== --- head/sys/arm/conf/NSLU Sun Nov 30 17:40:05 2008 (r185477) +++ head/sys/arm/conf/NSLU Sun Nov 30 17:53:19 2008 (r185478) @@ -29,6 +29,7 @@ options STARTUP_PAGETABLE_ADDR=0x100000 include "../xscale/ixp425/std.avila" #To statically compile in device wiring instead of /boot/device.hints hints "NSLU.hints" #Default places to look for devices. +makeoptions MODULES_OVERRIDE="" makeoptions DEBUG=-g #Build kernel with gdb(1) debug symbols makeoptions CONF_CFLAGS=-mcpu=xscale Modified: head/sys/arm/conf/SIMICS ============================================================================== --- head/sys/arm/conf/SIMICS Sun Nov 30 17:40:05 2008 (r185477) +++ head/sys/arm/conf/SIMICS Sun Nov 30 17:53:19 2008 (r185478) @@ -25,6 +25,7 @@ options PHYSADDR=0xc0000000 include "../sa11x0/std.sa11x0" #To statically compile in device wiring instead of /boot/device.hints #hints "GENERIC.hints" #Default places to look for devices. +makeoptions MODULES_OVERRIDE="" makeoptions DEBUG=-g #Build kernel with gdb(1) debug symbols makeoptions CONF_CFLAGS=-mcpu=strongarm Modified: head/sys/arm/conf/SKYEYE ============================================================================== --- head/sys/arm/conf/SKYEYE Sun Nov 30 17:40:05 2008 (r185477) +++ head/sys/arm/conf/SKYEYE Sun Nov 30 17:53:19 2008 (r185478) @@ -26,6 +26,7 @@ options PHYSADDR=0xc0000000 include "../at91/std.kb920x" #To statically compile in device wiring instead of /boot/device.hints #hints "GENERIC.hints" #Default places to look for devices. +makeoptions MODULES_OVERRIDE="" makeoptions DEBUG=-g #Build kernel with gdb(1) debug symbols makeoptions CONF_CFLAGS=-mcpu=arm9 Modified: head/sys/conf/Makefile.arm ============================================================================== --- head/sys/conf/Makefile.arm Sun Nov 30 17:40:05 2008 (r185477) +++ head/sys/conf/Makefile.arm Sun Nov 30 17:53:19 2008 (r185478) @@ -19,9 +19,6 @@ # Which version of config(8) is required. %VERSREQ= 600004 -# Temporary stuff while we're still embryonic -NO_MODULES= - STD8X16FONT?= iso .if !defined(S) @@ -122,6 +119,8 @@ ${KERNEL_KO}.tramp: ${KERNEL_KO} $S/$M/$ rm ${KERNEL_KO}.tmp.gz ${KERNEL_KO}.tramp.noheader opt_kernname.h \ inflate-tramp.o tmphack.S +MKMODULESENV+= MACHINE=${MACHINE} + %BEFORE_DEPEND %OBJS From owner-svn-src-head@FreeBSD.ORG Sun Nov 30 18:27:11 2008 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 053F0106564A; Sun, 30 Nov 2008 18:27:11 +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 EA0A18FC1D; Sun, 30 Nov 2008 18:27:10 +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 mAUIRASh098008; Sun, 30 Nov 2008 18:27:10 GMT (envelope-from sam@svn.freebsd.org) Received: (from sam@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mAUIRA9H098006; Sun, 30 Nov 2008 18:27:10 GMT (envelope-from sam@svn.freebsd.org) Message-Id: <200811301827.mAUIRA9H098006@svn.freebsd.org> From: Sam Leffler Date: Sun, 30 Nov 2008 18:27: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: r185479 - 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: Sun, 30 Nov 2008 18:27:11 -0000 Author: sam Date: Sun Nov 30 18:27:10 2008 New Revision: 185479 URL: http://svn.freebsd.org/changeset/base/185479 Log: add frequency mapping for the Zcomax GZ-901 Modified: head/sys/dev/ath/if_ath.c Modified: head/sys/dev/ath/if_ath.c ============================================================================== --- head/sys/dev/ath/if_ath.c Sun Nov 30 17:53:19 2008 (r185478) +++ head/sys/dev/ath/if_ath.c Sun Nov 30 18:27:10 2008 (r185479) @@ -115,6 +115,7 @@ CTASSERT(ATH_BCBUF <= 8); (((u_int8_t *)(p))[2] << 16) | (((u_int8_t *)(p))[3] << 24))) #define CTRY_XR9 5001 /* Ubiquiti XR9 */ +#define CTRY_GZ901 5002 /* ZComax GZ-901 */ static struct ieee80211vap *ath_vap_create(struct ieee80211com *, const char name[IFNAMSIZ], int unit, int opmode, @@ -1339,9 +1340,11 @@ ath_mapchan(const struct ieee80211com *i if (IEEE80211_IS_CHAN_GSM(chan)) { if (ic->ic_regdomain.country == CTRY_XR9) - hc->channel = 2427 + (chan->ic_freq - 907); + hc->channel = 1520 + chan->ic_freq; + else if (ic->ic_regdomain.country == CTRY_GZ901) + hc->channel = 1544 + chan->ic_freq; else - hc->channel = 2422 + (922 - chan->ic_freq); + hc->channel = 3344 - chan->ic_freq; } else hc->channel = chan->ic_freq; #undef N @@ -5927,9 +5930,11 @@ getchannels(struct ath_softc *sc, int *n * We define special country codes to deal with this. */ if (cc == CTRY_XR9) - ichan->ic_freq = 907 + (ichan->ic_freq - 2427); + ichan->ic_freq = ichan->ic_freq - 1520; + else if (cc == CTRY_GZ901) + ichan->ic_freq = ichan->ic_freq - 1544; else - ichan->ic_freq = 922 + (2422 - ichan->ic_freq); + ichan->ic_freq = 3344 - ichan->ic_freq; ichan->ic_flags |= IEEE80211_CHAN_GSM; ichan->ic_ieee = ieee80211_mhz2ieee(ichan->ic_freq, ichan->ic_flags); From owner-svn-src-head@FreeBSD.ORG Sun Nov 30 18:34:28 2008 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1508A106564A; Sun, 30 Nov 2008 18:34:28 +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 057B78FC16; Sun, 30 Nov 2008 18:34:28 +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 mAUIYRo3098222; Sun, 30 Nov 2008 18:34:27 GMT (envelope-from sam@svn.freebsd.org) Received: (from sam@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mAUIYR0V098220; Sun, 30 Nov 2008 18:34:27 GMT (envelope-from sam@svn.freebsd.org) Message-Id: <200811301834.mAUIYR0V098220@svn.freebsd.org> From: Sam Leffler Date: Sun, 30 Nov 2008 18:34: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: r185480 - 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: Sun, 30 Nov 2008 18:34:28 -0000 Author: sam Date: Sun Nov 30 18:34:27 2008 New Revision: 185480 URL: http://svn.freebsd.org/changeset/base/185480 Log: some of the 11n parts can hang under certain conditions without necessary workarounds, add code to detect these hangs and distinguish them from other events; note this code is only invoked for anomalous conditions and (at the moment) is a noop because the hang detection code is in a new hal that's coming shortly Modified: head/sys/dev/ath/if_ath.c Modified: head/sys/dev/ath/if_ath.c ============================================================================== --- head/sys/dev/ath/if_ath.c Sun Nov 30 18:27:10 2008 (r185479) +++ head/sys/dev/ath/if_ath.c Sun Nov 30 18:34:27 2008 (r185480) @@ -1290,14 +1290,33 @@ ath_bmiss_vap(struct ieee80211vap *vap) sc->sc_stats.ast_bmiss_phantom++; } +static int +ath_hal_gethangstate(struct ath_hal *ah, uint32_t mask, uint32_t *hangs) +{ + uint32_t rsize; + void *sp; + + if (!ath_hal_getdiagstate(ah, 32, &mask, sizeof(&mask), &sp, &rsize)) + return 0; + KASSERT(rsize == sizeof(uint32_t), ("resultsize %u", rsize)); + *hangs = *(uint32_t *)sp; + return 1; +} + static void ath_bmiss_proc(void *arg, int pending) { struct ath_softc *sc = arg; struct ifnet *ifp = sc->sc_ifp; + uint32_t hangs; DPRINTF(sc, ATH_DEBUG_ANY, "%s: pending %u\n", __func__, pending); - ieee80211_beacon_miss(ifp->if_l2com); + + if (ath_hal_gethangstate(sc->sc_ah, 0xff, &hangs) && hangs != 0) { + if_printf(ifp, "bb hang detected (0x%x), reseting\n", hangs); + ath_reset(ifp); + } else + ieee80211_beacon_miss(ifp->if_l2com); } /* @@ -6324,7 +6343,14 @@ ath_watchdog(struct ifnet *ifp) struct ath_softc *sc = ifp->if_softc; if ((ifp->if_drv_flags & IFF_DRV_RUNNING) && !sc->sc_invalid) { - if_printf(ifp, "device timeout\n"); + uint32_t hangs; + + if (ath_hal_gethangstate(sc->sc_ah, 0xffff, &hangs) && + hangs != 0) { + if_printf(ifp, "%s hang detected (0x%x)\n", + hangs & 0xff ? "bb" : "mac", hangs); + } else + if_printf(ifp, "device timeout\n"); ath_reset(ifp); ifp->if_oerrors++; sc->sc_stats.ast_watchdog++; From owner-svn-src-head@FreeBSD.ORG Sun Nov 30 18:56:41 2008 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 83ACA1065672; Sun, 30 Nov 2008 18:56: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 740498FC19; Sun, 30 Nov 2008 18:56: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 mAUIuf77098778; Sun, 30 Nov 2008 18:56:41 GMT (envelope-from sam@svn.freebsd.org) Received: (from sam@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mAUIufvm098776; Sun, 30 Nov 2008 18:56:41 GMT (envelope-from sam@svn.freebsd.org) Message-Id: <200811301856.mAUIufvm098776@svn.freebsd.org> From: Sam Leffler Date: Sun, 30 Nov 2008 18:56: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: r185481 - 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: Sun, 30 Nov 2008 18:56:41 -0000 Author: sam Date: Sun Nov 30 18:56:41 2008 New Revision: 185481 URL: http://svn.freebsd.org/changeset/base/185481 Log: sync w/ p4 branch Modified: head/sys/dev/ath/if_ath.c Modified: head/sys/dev/ath/if_ath.c ============================================================================== --- head/sys/dev/ath/if_ath.c Sun Nov 30 18:34:27 2008 (r185480) +++ head/sys/dev/ath/if_ath.c Sun Nov 30 18:56:41 2008 (r185481) @@ -1266,7 +1266,8 @@ ath_fatal_proc(void *arg, int pending) static void ath_bmiss_vap(struct ieee80211vap *vap) { - struct ath_softc *sc = vap->iv_ic->ic_ifp->if_softc; + struct ifnet *ifp = vap->iv_ic->ic_ifp; + struct ath_softc *sc = ifp->if_softc; u_int64_t lastrx = sc->sc_lastrx; u_int64_t tsf = ath_hal_gettsf64(sc->sc_ah); u_int bmisstimeout = From owner-svn-src-head@FreeBSD.ORG Sun Nov 30 19:06:36 2008 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 40E2F1065679; Sun, 30 Nov 2008 19:06:36 +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 2FD628FC0C; Sun, 30 Nov 2008 19:06:36 +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 mAUJ6Z9P099037; Sun, 30 Nov 2008 19:06:35 GMT (envelope-from sam@svn.freebsd.org) Received: (from sam@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mAUJ6Z30099035; Sun, 30 Nov 2008 19:06:35 GMT (envelope-from sam@svn.freebsd.org) Message-Id: <200811301906.mAUJ6Z30099035@svn.freebsd.org> From: Sam Leffler Date: Sun, 30 Nov 2008 19:06: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: r185482 - head/sys/dev/ath/ath_rate/sample X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 30 Nov 2008 19:06:36 -0000 Author: sam Date: Sun Nov 30 19:06:35 2008 New Revision: 185482 URL: http://svn.freebsd.org/changeset/base/185482 Log: Major overhaul: o eliminate private state indexed by 802.11 rate codes; use the hal's rate tables directly to get the same info o calculate a mask of operational rates to optimize lookups and checks (instead of using for loops and similar) o optimize size bin operations o ignore rates marked as "do not use" in the hal phy tables o fix bug that caused upshifting to break in 11g once the rate dropped below 11Mb/s o add more intelligent multi-rate tx schedules o add support for 1/2 and 1/4 width channels o add dev.ath.X.sample_stats sysctl to dump runtime statistics to the console (needs to go up to a user app) o export more tuning knobs via sysctls (still a couple of magic constants) Modified: head/sys/dev/ath/ath_rate/sample/sample.c head/sys/dev/ath/ath_rate/sample/sample.h Modified: head/sys/dev/ath/ath_rate/sample/sample.c ============================================================================== --- head/sys/dev/ath/ath_rate/sample/sample.c Sun Nov 30 18:56:41 2008 (r185481) +++ head/sys/dev/ath/ath_rate/sample/sample.c Sun Nov 30 19:06:35 2008 (r185482) @@ -62,6 +62,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include /* XXX for ether_sprintf */ #include @@ -100,36 +101,35 @@ __FBSDID("$FreeBSD$"); * a few different packet sizes independently for each link. */ -#define STALE_FAILURE_TIMEOUT_MS 10000 -#define MIN_SWITCH_MS 1000 - static void ath_rate_ctl_reset(struct ath_softc *, struct ieee80211_node *); +static const int packet_size_bins[NUM_PACKET_SIZE_BINS] = { 250, 1600 }; + static __inline int size_to_bin(int size) { - int x = 0; - for (x = 0; x < NUM_PACKET_SIZE_BINS; x++) { - if (size <= packet_size_bins[x]) { - return x; - } - } +#if NUM_PACKET_SIZE_BINS > 1 + if (size <= packet_size_bins[0]) + return 0; +#endif +#if NUM_PACKET_SIZE_BINS > 2 + if (size <= packet_size_bins[1]) + return 1; +#endif +#if NUM_PACKET_SIZE_BINS > 3 + if (size <= packet_size_bins[2]) + return 2; +#endif +#if NUM_PACKET_SIZE_BINS > 4 +#error "add support for more packet sizes" +#endif return NUM_PACKET_SIZE_BINS-1; } -static __inline int -bin_to_size(int index) { - return packet_size_bins[index]; -} static __inline int -rate_to_ndx(struct sample_node *sn, int rate) { - int x = 0; - for (x = 0; x < sn->num_rates; x++) { - if (sn->rates[x].rate == rate) { - return x; - } - } - return -1; +bin_to_size(int index) +{ + return packet_size_bins[index]; } void @@ -143,336 +143,399 @@ ath_rate_node_cleanup(struct ath_softc * { } - /* - * returns the ndx with the lowest average_tx_time, + * Return the rix with the lowest average_tx_time, * or -1 if all the average_tx_times are 0. */ -static __inline int best_rate_ndx(struct sample_node *sn, int size_bin, - int require_acked_before) +static __inline int +pick_best_rate(struct sample_node *sn, const HAL_RATE_TABLE *rt, + int size_bin, int require_acked_before) { - int x = 0; - int best_rate_ndx = 0; - int best_rate_tt = 0; - for (x = 0; x < sn->num_rates; x++) { - int tt = sn->stats[size_bin][x].average_tx_time; - if (tt <= 0 || (require_acked_before && - !sn->stats[size_bin][x].packets_acked)) { + int best_rate_rix, best_rate_tt; + uint32_t mask; + int rix, tt; + + best_rate_rix = 0; + best_rate_tt = 0; + for (mask = sn->ratemask, rix = 0; mask != 0; mask >>= 1, rix++) { + if ((mask & 1) == 0) /* not a supported rate */ continue; - } - /* 9 megabits never works better than 12 */ - if (sn->rates[x].rate == 18) + tt = sn->stats[size_bin][rix].average_tx_time; + if (tt <= 0 || + (require_acked_before && + !sn->stats[size_bin][rix].packets_acked)) continue; /* don't use a bit-rate that has been failing */ - if (sn->stats[size_bin][x].successive_failures > 3) + if (sn->stats[size_bin][rix].successive_failures > 3) continue; - if (!best_rate_tt || best_rate_tt > tt) { + if (best_rate_tt == 0 || tt < best_rate_tt) { best_rate_tt = tt; - best_rate_ndx = x; + best_rate_rix = rix; } } - return (best_rate_tt) ? best_rate_ndx : -1; + return (best_rate_tt ? best_rate_rix : -1); } /* - * pick a good "random" bit-rate to sample other than the current one + * Pick a good "random" bit-rate to sample other than the current one. */ static __inline int -pick_sample_ndx(struct sample_node *sn, int size_bin) +pick_sample_rate(struct sample_softc *ssc , struct sample_node *sn, + const HAL_RATE_TABLE *rt, int size_bin) { - int x = 0; - int current_ndx = 0; - unsigned current_tt = 0; +#define DOT11RATE(ix) (rt->info[ix].dot11Rate & IEEE80211_RATE_VAL) + int current_rix, rix; + unsigned current_tt; + uint32_t mask; - current_ndx = sn->current_rate[size_bin]; - if (current_ndx < 0) { + current_rix = sn->current_rix[size_bin]; + if (current_rix < 0) { /* no successes yet, send at the lowest bit-rate */ return 0; } - - current_tt = sn->stats[size_bin][current_ndx].average_tx_time; - - for (x = 0; x < sn->num_rates; x++) { - int ndx = (sn->last_sample_ndx[size_bin]+1+x) % sn->num_rates; - /* don't sample the current bit-rate */ - if (ndx == current_ndx) + current_tt = sn->stats[size_bin][current_rix].average_tx_time; + + rix = sn->last_sample_rix[size_bin]+1; /* next sample rate */ + mask = sn->ratemask &~ (1<= rt->rateCount) + rix = 0; continue; + } /* this bit-rate is always worse than the current one */ - if (sn->stats[size_bin][ndx].perfect_tx_time > current_tt) - continue; + if (sn->stats[size_bin][rix].perfect_tx_time > current_tt) { + mask &= ~(1<stats[size_bin][ndx].last_tx < ((hz * STALE_FAILURE_TIMEOUT_MS)/1000) && - sn->stats[size_bin][ndx].successive_failures > 3) - continue; - - /* don't sample more than 2 indexes higher - * for rates higher than 11 megabits - */ - if (sn->rates[ndx].rate > 22 && ndx > current_ndx + 2) - continue; - - /* 9 megabits never works better than 12 */ - if (sn->rates[ndx].rate == 18) - continue; + if (sn->stats[size_bin][rix].successive_failures > ssc->max_successive_failures && + ticks - sn->stats[size_bin][rix].last_tx < ssc->stale_failure_timeout) { + mask &= ~(1<rates[current_ndx].rate == 22 && ndx > current_ndx + 1) - continue; + /* don't sample more than 2 rates higher for rates > 11M */ + if (DOT11RATE(rix) > 2*11 && rix > current_rix + 2) { + mask &= ~(1<last_sample_ndx[size_bin] = ndx; - return ndx; + sn->last_sample_rix[size_bin] = rix; + return rix; } - return current_ndx; + return current_rix; +#undef DOT11RATE } void ath_rate_findrate(struct ath_softc *sc, struct ath_node *an, int shortPreamble, size_t frameLen, - u_int8_t *rix, int *try0, u_int8_t *txrate) + u_int8_t *rix0, int *try0, u_int8_t *txrate) { +#define DOT11RATE(ix) (rt->info[ix].dot11Rate & IEEE80211_RATE_VAL) +#define RATE(ix) (DOT11RATE(ix) / 2) struct sample_node *sn = ATH_NODE_SAMPLE(an); struct sample_softc *ssc = ATH_SOFTC_SAMPLE(sc); struct ifnet *ifp = sc->sc_ifp; struct ieee80211com *ic = ifp->if_l2com; - int ndx, size_bin, mrr, best_ndx, change_rates; + const HAL_RATE_TABLE *rt = sc->sc_currates; + const int size_bin = size_to_bin(frameLen); + int rix, mrr, best_rix, change_rates; unsigned average_tx_time; + if (sn->static_rix != -1) { + rix = sn->static_rix; + *try0 = ATH_TXMAXTRY; + goto done; + } + mrr = sc->sc_mrretry && !(ic->ic_flags & IEEE80211_F_USEPROT); - size_bin = size_to_bin(frameLen); - best_ndx = best_rate_ndx(sn, size_bin, !mrr); - if (best_ndx >= 0) { - average_tx_time = sn->stats[size_bin][best_ndx].average_tx_time; + best_rix = pick_best_rate(sn, rt, size_bin, !mrr); + if (best_rix >= 0) { + average_tx_time = sn->stats[size_bin][best_rix].average_tx_time; } else { average_tx_time = 0; } - - if (sn->static_rate_ndx != -1) { - ndx = sn->static_rate_ndx; - *try0 = ATH_TXMAXTRY; - } else { - *try0 = mrr ? 2 : ATH_TXMAXTRY; - - if (sn->sample_tt[size_bin] < average_tx_time * (sn->packets_since_sample[size_bin]*ssc->ath_sample_rate/100)) { - /* - * we want to limit the time measuring the performance - * of other bit-rates to ath_sample_rate% of the - * total transmission time. - */ - ndx = pick_sample_ndx(sn, size_bin); - if (ndx != sn->current_rate[size_bin]) { - sn->current_sample_ndx[size_bin] = ndx; - } else { - sn->current_sample_ndx[size_bin] = -1; - } - sn->packets_since_sample[size_bin] = 0; - + /* + * Limit the time measuring the performance of other tx + * rates to sample_rate% of the total transmission time. + */ + if (sn->sample_tt[size_bin] < average_tx_time * (sn->packets_since_sample[size_bin]*ssc->sample_rate/100)) { + rix = pick_sample_rate(ssc, sn, rt, size_bin); + IEEE80211_NOTE(an->an_node.ni_vap, IEEE80211_MSG_RATECTL, + &an->an_node, "size %u sample rate %d current rate %d", + bin_to_size(size_bin), RATE(rix), + RATE(sn->current_rix[size_bin])); + if (rix != sn->current_rix[size_bin]) { + sn->current_sample_rix[size_bin] = rix; } else { - change_rates = 0; - if (!sn->packets_sent[size_bin] || best_ndx == -1) { - /* no packet has been sent successfully yet */ - for (ndx = sn->num_rates-1; ndx > 0; ndx--) { - /* - * pick the highest rate <= 36 Mbps - * that hasn't failed. - */ - if (sn->rates[ndx].rate <= 72 && - sn->stats[size_bin][ndx].successive_failures == 0) { - break; - } + sn->current_sample_rix[size_bin] = -1; + } + sn->packets_since_sample[size_bin] = 0; + } else { + change_rates = 0; + if (!sn->packets_sent[size_bin] || best_rix == -1) { + /* no packet has been sent successfully yet */ + for (rix = rt->rateCount-1; rix > 0; rix--) { + if ((sn->ratemask & (1<stats[size_bin][rix].successive_failures == 0) { + break; } - change_rates = 1; - best_ndx = ndx; - } else if (sn->packets_sent[size_bin] < 20) { - /* let the bit-rate switch quickly during the first few packets */ - change_rates = 1; - } else if (ticks - ((hz*MIN_SWITCH_MS)/1000) > sn->ticks_since_switch[size_bin]) { - /* 2 seconds have gone by */ - change_rates = 1; - } else if (average_tx_time * 2 < sn->stats[size_bin][sn->current_rate[size_bin]].average_tx_time) { - /* the current bit-rate is twice as slow as the best one */ - change_rates = 1; } + change_rates = 1; + best_rix = rix; + } else if (sn->packets_sent[size_bin] < 20) { + /* let the bit-rate switch quickly during the first few packets */ + change_rates = 1; + } else if (ticks - ssc->min_switch > sn->ticks_since_switch[size_bin]) { + /* min_switch seconds have gone by */ + change_rates = 1; + } else if (2*average_tx_time < sn->stats[size_bin][sn->current_rix[size_bin]].average_tx_time) { + /* the current bit-rate is twice as slow as the best one */ + change_rates = 1; + } - sn->packets_since_sample[size_bin]++; - - if (change_rates) { - if (best_ndx != sn->current_rate[size_bin]) { - IEEE80211_NOTE(an->an_node.ni_vap, - IEEE80211_MSG_RATECTL, - &an->an_node, + sn->packets_since_sample[size_bin]++; + + if (change_rates) { + if (best_rix != sn->current_rix[size_bin]) { + IEEE80211_NOTE(an->an_node.ni_vap, + IEEE80211_MSG_RATECTL, + &an->an_node, "%s: size %d switch rate %d (%d/%d) -> %d (%d/%d) after %d packets mrr %d", - __func__, - packet_size_bins[size_bin], - sn->rates[sn->current_rate[size_bin]].rate, - sn->stats[size_bin][sn->current_rate[size_bin]].average_tx_time, - sn->stats[size_bin][sn->current_rate[size_bin]].perfect_tx_time, - sn->rates[best_ndx].rate, - sn->stats[size_bin][best_ndx].average_tx_time, - sn->stats[size_bin][best_ndx].perfect_tx_time, - sn->packets_since_switch[size_bin], - mrr); - } - sn->packets_since_switch[size_bin] = 0; - sn->current_rate[size_bin] = best_ndx; - sn->ticks_since_switch[size_bin] = ticks; - /* - * Set the visible txrate for this node. - */ - an->an_node.ni_txrate = sn->rates[best_ndx].rate; + __func__, + bin_to_size(size_bin), + RATE(sn->current_rix[size_bin]), + sn->stats[size_bin][sn->current_rix[size_bin]].average_tx_time, + sn->stats[size_bin][sn->current_rix[size_bin]].perfect_tx_time, + RATE(best_rix), + sn->stats[size_bin][best_rix].average_tx_time, + sn->stats[size_bin][best_rix].perfect_tx_time, + sn->packets_since_switch[size_bin], + mrr); } - ndx = sn->current_rate[size_bin]; - sn->packets_since_switch[size_bin]++; + sn->packets_since_switch[size_bin] = 0; + sn->current_rix[size_bin] = best_rix; + sn->ticks_since_switch[size_bin] = ticks; + /* + * Set the visible txrate for this node. + */ + an->an_node.ni_txrate = DOT11RATE(best_rix); } + rix = sn->current_rix[size_bin]; + sn->packets_since_switch[size_bin]++; } - - KASSERT(ndx >= 0 && ndx < sn->num_rates, ("ndx is %d", ndx)); - - *rix = sn->rates[ndx].rix; - if (shortPreamble) { - *txrate = sn->rates[ndx].shortPreambleRateCode; - } else { - *txrate = sn->rates[ndx].rateCode; - } + *try0 = mrr ? sn->sched[rix].t0 : ATH_TXMAXTRY; +done: + KASSERT(rix >= 0 && rix < rt->rateCount, ("rix is %d", rix)); + + *rix0 = rix; + *txrate = rt->info[rix].rateCode + | (shortPreamble ? rt->info[rix].shortPreamble : 0); sn->packets_sent[size_bin]++; +#undef DOT11RATE +#undef RATE } +#define A(_r) \ + (((_r) == 6) ? 0 : (((_r) == 9) ? 1 : (((_r) == 12) ? 2 : \ + (((_r) == 18) ? 3 : (((_r) == 24) ? 4 : (((_r) == 36) ? 5 : \ + (((_r) == 48) ? 6 : (((_r) == 54) ? 7 : 0)))))))) +static const struct txschedule series_11a[] = { + { 3,A( 6), 3,A( 6), 0,A( 6), 0,A( 6) }, /* 6Mb/s */ + { 4,A( 9), 3,A( 6), 4,A( 6), 0,A( 6) }, /* 9Mb/s */ + { 4,A(12), 3,A( 6), 4,A( 6), 0,A( 6) }, /* 12Mb/s */ + { 4,A(18), 3,A( 12), 4,A( 6), 2,A( 6) }, /* 18Mb/s */ + { 4,A(24), 3,A( 18), 4,A( 12), 2,A( 6) }, /* 24Mb/s */ + { 4,A(36), 3,A( 24), 4,A( 18), 2,A( 6) }, /* 36Mb/s */ + { 4,A(48), 3,A( 36), 4,A( 24), 2,A(12) }, /* 48Mb/s */ + { 4,A(54), 3,A( 48), 4,A( 36), 2,A(24) } /* 54Mb/s */ +}; +#undef A + +#define G(_r) \ + (((_r) == 1) ? 0 : (((_r) == 2) ? 1 : (((_r) == 5.5) ? 2 : \ + (((_r) == 11) ? 3 : (((_r) == 6) ? 4 : (((_r) == 9) ? 5 : \ + (((_r) == 12) ? 6 : (((_r) == 18) ? 7 : (((_r) == 24) ? 8 : \ + (((_r) == 36) ? 9 : (((_r) == 48) ? 10 : (((_r) == 54) ? 11 : 0)))))))))))) +static const struct txschedule series_11g[] = { + { 3,G( 1), 3,G( 1), 0,G( 1), 0,G( 1) }, /* 1Mb/s */ + { 4,G( 2), 3,G( 1), 4,G( 1), 0,G( 1) }, /* 2Mb/s */ + { 4,G(5.5),3,G( 2), 4,G( 1), 2,G( 1) }, /* 5.5Mb/s */ + { 4,G(11), 3,G(5.5), 4,G( 2), 2,G( 1) }, /* 11Mb/s */ + { 4,G( 6), 3,G(5.5), 4,G( 2), 2,G( 1) }, /* 6Mb/s */ + { 4,G( 9), 3,G( 6), 4,G(5.5), 2,G( 1) }, /* 9Mb/s */ + { 4,G(12), 3,G( 11), 4,G(5.5), 2,G( 1) }, /* 12Mb/s */ + { 4,G(18), 3,G( 12), 4,G( 11), 2,G( 1) }, /* 18Mb/s */ + { 4,G(24), 3,G( 18), 4,G( 12), 2,G( 1) }, /* 24Mb/s */ + { 4,G(36), 3,G( 24), 4,G( 18), 2,G( 1) }, /* 36Mb/s */ + { 4,G(48), 3,G( 36), 4,G( 24), 2,G( 1) }, /* 48Mb/s */ + { 4,G(54), 3,G( 48), 4,G( 36), 2,G( 1) } /* 54Mb/s */ +}; +#undef G + +#define H(_r) \ + (((_r) == 3) ? 0 : (((_r) == 4.5) ? 1 : (((_r) == 6) ? 2 : \ + (((_r) == 9) ? 3 : (((_r) == 12) ? 4 : (((_r) == 18) ? 5 : \ + (((_r) == 24) ? 6 : (((_r) == 27) ? 7 : 0)))))))) +static const struct txschedule series_half[] = { + { 3,H( 3), 3,H( 3), 0,H( 3), 0,H( 3) }, /* 3Mb/s */ + { 4,H(4.5),3,H( 3), 4,H( 3), 0,H( 3) }, /* 4.5Mb/s */ + { 4,H( 6), 3,H( 3), 4,H( 3), 0,H( 3) }, /* 6Mb/s */ + { 4,H( 9), 3,H( 6), 4,H( 3), 2,H( 3) }, /* 9Mb/s */ + { 4,H(12), 3,H( 9), 4,H( 6), 2,H( 3) }, /* 12Mb/s */ + { 4,H(18), 3,H( 12), 4,H( 9), 2,H( 3) }, /* 18Mb/s */ + { 4,H(24), 3,H( 18), 4,H( 12), 2,H( 6) }, /* 24Mb/s */ + { 4,H(27), 3,H( 24), 4,H( 18), 2,H(12) } /* 27Mb/s */ +}; +#undef H + +#define Q(_r) \ + (((_r) == 1.5) ? 0 : (((_r) ==2.25) ? 1 : (((_r) == 3) ? 2 : \ + (((_r) == 4.5) ? 3 : (((_r) == 6) ? 4 : (((_r) == 9) ? 5 : \ + (((_r) == 12) ? 6 : (((_r) == 13.5)? 7 : 0)))))))) +static const struct txschedule series_quarter[] = { + { 3,Q( 1.5),3,Q(1.5), 0,Q(1.5), 0,Q(1.5) }, /* 1.5Mb/s */ + { 4,Q(2.25),3,Q(1.5), 4,Q(1.5), 0,Q(1.5) }, /*2.25Mb/s */ + { 4,Q( 3),3,Q(1.5), 4,Q(1.5), 0,Q(1.5) }, /* 3Mb/s */ + { 4,Q( 4.5),3,Q( 3), 4,Q(1.5), 2,Q(1.5) }, /* 4.5Mb/s */ + { 4,Q( 6),3,Q(4.5), 4,Q( 3), 2,Q(1.5) }, /* 6Mb/s */ + { 4,Q( 9),3,Q( 6), 4,Q(4.5), 2,Q(1.5) }, /* 9Mb/s */ + { 4,Q( 12),3,Q( 9), 4,Q( 6), 2,Q( 3) }, /* 12Mb/s */ + { 4,Q(13.5),3,Q( 12), 4,Q( 9), 2,Q( 6) } /*13.5Mb/s */ +}; +#undef Q + void ath_rate_setupxtxdesc(struct ath_softc *sc, struct ath_node *an, struct ath_desc *ds, int shortPreamble, u_int8_t rix) { struct sample_node *sn = ATH_NODE_SAMPLE(an); - int rateCode = -1; - int frame_size = 0; - int size_bin = 0; - int ndx = 0; - - size_bin = size_to_bin(frame_size); // TODO: it's correct that frame_size alway 0 ? - ndx = sn->current_rate[size_bin]; /* retry at the current bit-rate */ - - if (!sn->stats[size_bin][ndx].packets_acked) { - ndx = 0; /* use the lowest bit-rate */ - } + const struct txschedule *sched = &sn->sched[rix]; + const HAL_RATE_TABLE *rt = sc->sc_currates; + uint8_t rix1, s1code, rix2, s2code, rix3, s3code; - if (shortPreamble) { - rateCode = sn->rates[ndx].shortPreambleRateCode; - } else { - rateCode = sn->rates[ndx].rateCode; - } - ath_hal_setupxtxdesc(sc->sc_ah, ds - , rateCode, 3 /* series 1 */ - , sn->rates[0].rateCode, 3 /* series 2 */ - , 0, 0 /* series 3 */ - ); + /* XXX precalculate short preamble tables */ + rix1 = sched->r1; + s1code = rt->info[rix1].rateCode + | (shortPreamble ? rt->info[rix1].shortPreamble : 0); + rix2 = sched->r2; + s2code = rt->info[rix2].rateCode + | (shortPreamble ? rt->info[rix2].shortPreamble : 0); + rix3 = sched->r3; + s3code = rt->info[rix3].rateCode + | (shortPreamble ? rt->info[rix3].shortPreamble : 0); + ath_hal_setupxtxdesc(sc->sc_ah, ds, + s1code, sched->t1, /* series 1 */ + s2code, sched->t2, /* series 2 */ + s3code, sched->t3); /* series 3 */ } static void update_stats(struct ath_softc *sc, struct ath_node *an, int frame_size, - int ndx0, int tries0, - int ndx1, int tries1, - int ndx2, int tries2, - int ndx3, int tries3, + int rix0, int tries0, + int rix1, int tries1, + int rix2, int tries2, + int rix3, int tries3, int short_tries, int tries, int status) { struct sample_node *sn = ATH_NODE_SAMPLE(an); struct sample_softc *ssc = ATH_SOFTC_SAMPLE(sc); - int tt = 0; - int tries_so_far = 0; - int size_bin = 0; - int size = 0; - int rate = 0; - - size_bin = size_to_bin(frame_size); - size = bin_to_size(size_bin); + const int size_bin = size_to_bin(frame_size); + const int size = bin_to_size(size_bin); + int tt, tries_so_far; - if (!(0 <= ndx0 && ndx0 < sn->num_rates)) + if (!IS_RATE_DEFINED(sn, rix0)) return; - rate = sn->rates[ndx0].rate; + tt = calc_usecs_unicast_packet(sc, size, rix0, short_tries, + MIN(tries0, tries) - 1); + tries_so_far = tries0; - tt += calc_usecs_unicast_packet(sc, size, sn->rates[ndx0].rix, - short_tries, - MIN(tries0, tries) - 1); - tries_so_far += tries0; - if (tries1 && tries0 < tries) { - if (!(0 <= ndx1 && ndx1 < sn->num_rates)) + if (tries1 && tries_so_far < tries) { + if (!IS_RATE_DEFINED(sn, rix1)) return; - tt += calc_usecs_unicast_packet(sc, size, sn->rates[ndx1].rix, - short_tries, - MIN(tries1 + tries_so_far, tries) - tries_so_far - 1); + tt += calc_usecs_unicast_packet(sc, size, rix1, short_tries, + MIN(tries1 + tries_so_far, tries) - tries_so_far - 1); + tries_so_far += tries1; } - tries_so_far += tries1; - if (tries2 && tries0 + tries1 < tries) { - if (!(0 <= ndx2 && ndx2 < sn->num_rates)) + if (tries2 && tries_so_far < tries) { + if (!IS_RATE_DEFINED(sn, rix2)) return; - tt += calc_usecs_unicast_packet(sc, size, sn->rates[ndx2].rix, - short_tries, - MIN(tries2 + tries_so_far, tries) - tries_so_far - 1); + tt += calc_usecs_unicast_packet(sc, size, rix2, short_tries, + MIN(tries2 + tries_so_far, tries) - tries_so_far - 1); + tries_so_far += tries2; } - tries_so_far += tries2; - - if (tries3 && tries0 + tries1 + tries2 < tries) { - if (!(0 <= ndx3 && ndx3 < sn->num_rates)) + if (tries3 && tries_so_far < tries) { + if (!IS_RATE_DEFINED(sn, rix3)) return; - tt += calc_usecs_unicast_packet(sc, size, sn->rates[ndx3].rix, - short_tries, - MIN(tries3 + tries_so_far, tries) - tries_so_far - 1); + tt += calc_usecs_unicast_packet(sc, size, rix3, short_tries, + MIN(tries3 + tries_so_far, tries) - tries_so_far - 1); } - if (sn->stats[size_bin][ndx0].total_packets < (100 / (100 - ssc->ath_smoothing_rate))) { + + if (sn->stats[size_bin][rix0].total_packets < ssc->smoothing_minpackets) { /* just average the first few packets */ - int avg_tx = sn->stats[size_bin][ndx0].average_tx_time; - int packets = sn->stats[size_bin][ndx0].total_packets; - sn->stats[size_bin][ndx0].average_tx_time = (tt+(avg_tx*packets))/(packets+1); + int avg_tx = sn->stats[size_bin][rix0].average_tx_time; + int packets = sn->stats[size_bin][rix0].total_packets; + sn->stats[size_bin][rix0].average_tx_time = (tt+(avg_tx*packets))/(packets+1); } else { /* use a ewma */ - sn->stats[size_bin][ndx0].average_tx_time = - ((sn->stats[size_bin][ndx0].average_tx_time * ssc->ath_smoothing_rate) + - (tt * (100 - ssc->ath_smoothing_rate))) / 100; + sn->stats[size_bin][rix0].average_tx_time = + ((sn->stats[size_bin][rix0].average_tx_time * ssc->smoothing_rate) + + (tt * (100 - ssc->smoothing_rate))) / 100; } - if (status) { + if (status != 0) { int y; - sn->stats[size_bin][ndx0].successive_failures++; + sn->stats[size_bin][rix0].successive_failures++; for (y = size_bin+1; y < NUM_PACKET_SIZE_BINS; y++) { - /* also say larger packets failed since we - * assume if a small packet fails at a lower + /* + * Also say larger packets failed since we + * assume if a small packet fails at a * bit-rate then a larger one will also. */ - sn->stats[y][ndx0].successive_failures++; - sn->stats[y][ndx0].last_tx = ticks; - sn->stats[y][ndx0].tries += tries; - sn->stats[y][ndx0].total_packets++; + sn->stats[y][rix0].successive_failures++; + sn->stats[y][rix0].last_tx = ticks; + sn->stats[y][rix0].tries += tries; + sn->stats[y][rix0].total_packets++; } } else { - sn->stats[size_bin][ndx0].packets_acked++; - sn->stats[size_bin][ndx0].successive_failures = 0; + sn->stats[size_bin][rix0].packets_acked++; + sn->stats[size_bin][rix0].successive_failures = 0; } - sn->stats[size_bin][ndx0].tries += tries; - sn->stats[size_bin][ndx0].last_tx = ticks; - sn->stats[size_bin][ndx0].total_packets++; - + sn->stats[size_bin][rix0].tries += tries; + sn->stats[size_bin][rix0].last_tx = ticks; + sn->stats[size_bin][rix0].total_packets++; - if (ndx0 == sn->current_sample_ndx[size_bin]) { + if (rix0 == sn->current_sample_rix[size_bin]) { IEEE80211_NOTE(an->an_node.ni_vap, IEEE80211_MSG_RATECTL, &an->an_node, "%s: size %d %s sample rate %d tries (%d/%d) tt %d avg_tt (%d/%d)", __func__, size, status ? "FAIL" : "OK", - rate, short_tries, tries, tt, - sn->stats[size_bin][ndx0].average_tx_time, - sn->stats[size_bin][ndx0].perfect_tx_time); + rix0, short_tries, tries, tt, + sn->stats[size_bin][rix0].average_tx_time, + sn->stats[size_bin][rix0].perfect_tx_time); sn->sample_tt[size_bin] = tt; - sn->current_sample_ndx[size_bin] = -1; + sn->current_sample_rix[size_bin] = -1; } } @@ -492,19 +555,18 @@ ath_rate_tx_complete(struct ath_softc *s struct sample_node *sn = ATH_NODE_SAMPLE(an); const struct ath_tx_status *ts = &bf->bf_status.ds_txstat; const struct ath_desc *ds0 = &bf->bf_desc[0]; - int final_rate, short_tries, long_tries, frame_size; + int final_rix, short_tries, long_tries, frame_size; const HAL_RATE_TABLE *rt = sc->sc_currates; int mrr; - final_rate = sc->sc_hwmap[ - rt->rateCodeToIndex[ts->ts_rate &~ HAL_TXSTAT_ALTRATE]].ieeerate; + final_rix = rt->rateCodeToIndex[ts->ts_rate &~ HAL_TXSTAT_ALTRATE]; short_tries = ts->ts_shortretry; long_tries = ts->ts_longretry + 1; frame_size = ds0->ds_ctl0 & 0x0fff; /* low-order 12 bits of ds_ctl0 */ if (frame_size == 0) /* NB: should not happen */ frame_size = 1500; - if (sn->num_rates <= 0) { + if (sn->ratemask == 0) { IEEE80211_NOTE(an->an_node.ni_vap, IEEE80211_MSG_RATECTL, &an->an_node, "%s: size %d %s rate/try %d/%d no rates yet", @@ -516,9 +578,7 @@ ath_rate_tx_complete(struct ath_softc *s } mrr = sc->sc_mrretry && !(ic->ic_flags & IEEE80211_F_USEPROT); if (!mrr || !(ts->ts_rate & HAL_TXSTAT_ALTRATE)) { - int ndx = rate_to_ndx(sn, final_rate); - - if (ndx < 0) { + if (!IS_RATE_DEFINED(sn, final_rix)) { badrate(ifp, 0, ts->ts_rate, long_tries, ts->ts_status); return; } @@ -530,18 +590,18 @@ ath_rate_tx_complete(struct ath_softc *s __func__, bin_to_size(size_to_bin(frame_size)), ts->ts_status ? "FAIL" : "OK", - final_rate, short_tries, long_tries); + final_rix, short_tries, long_tries); update_stats(sc, an, frame_size, - ndx, long_tries, + final_rix, long_tries, 0, 0, 0, 0, 0, 0, short_tries, long_tries, ts->ts_status); } else { - int hwrate0, rate0, tries0, ndx0; - int hwrate1, rate1, tries1, ndx1; - int hwrate2, rate2, tries2, ndx2; - int hwrate3, rate3, tries3, ndx3; + int hwrate0, rix0, tries0; + int hwrate1, rix1, tries1; + int hwrate2, rix2, tries2; + int hwrate3, rix3, tries3; int finalTSIdx = ts->ts_finaltsi; /* @@ -559,30 +619,17 @@ ath_rate_tx_complete(struct ath_softc *s hwrate3 = MS(ds0->ds_ctl3, AR5416_XmitRate3); } - rate0 = sc->sc_hwmap[rt->rateCodeToIndex[hwrate0]].ieeerate; + rix0 = rt->rateCodeToIndex[hwrate0]; tries0 = MS(ds0->ds_ctl2, AR_XmitDataTries0); - ndx0 = rate_to_ndx(sn, rate0); - rate1 = sc->sc_hwmap[rt->rateCodeToIndex[hwrate1]].ieeerate; + rix1 = rt->rateCodeToIndex[hwrate1]; tries1 = MS(ds0->ds_ctl2, AR_XmitDataTries1); - ndx1 = rate_to_ndx(sn, rate1); - rate2 = sc->sc_hwmap[rt->rateCodeToIndex[hwrate2]].ieeerate; + rix2 = rt->rateCodeToIndex[hwrate2]; tries2 = MS(ds0->ds_ctl2, AR_XmitDataTries2); - ndx2 = rate_to_ndx(sn, rate2); - rate3 = sc->sc_hwmap[rt->rateCodeToIndex[hwrate3]].ieeerate; + rix3 = rt->rateCodeToIndex[hwrate3]; tries3 = MS(ds0->ds_ctl2, AR_XmitDataTries3); - ndx3 = rate_to_ndx(sn, rate3); - - if (tries0 && ndx0 < 0) - badrate(ifp, 0, hwrate0, tries0, ts->ts_status); - if (tries1 && ndx1 < 0) - badrate(ifp, 1, hwrate1, tries1, ts->ts_status); - if (tries2 && ndx2 < 0) - badrate(ifp, 2, hwrate2, tries2, ts->ts_status); - if (tries3 && ndx3 < 0) - badrate(ifp, 3, hwrate3, tries3, ts->ts_status); IEEE80211_NOTE(an->an_node.ni_vap, IEEE80211_MSG_RATECTL, &an->an_node, @@ -592,10 +639,19 @@ ath_rate_tx_complete(struct ath_softc *s finalTSIdx, long_tries, ts->ts_status ? "FAIL" : "OK", - rate0, tries0, - rate1, tries1, - rate2, tries2, - rate3, tries3); + rix0, tries0, + rix1, tries1, + rix2, tries2, + rix3, tries3); + + if (tries0 && !IS_RATE_DEFINED(sn, rix0)) + badrate(ifp, 0, hwrate0, tries0, ts->ts_status); + if (tries1 && !IS_RATE_DEFINED(sn, rix1)) + badrate(ifp, 1, hwrate1, tries1, ts->ts_status); + if (tries2 && !IS_RATE_DEFINED(sn, rix2)) + badrate(ifp, 2, hwrate2, tries2, ts->ts_status); + if (tries3 && !IS_RATE_DEFINED(sn, rix3)) + badrate(ifp, 3, hwrate3, tries3, ts->ts_status); /* * NB: series > 0 are not penalized for failure @@ -606,10 +662,10 @@ ath_rate_tx_complete(struct ath_softc *s */ if (tries0) { update_stats(sc, an, frame_size, - ndx0, tries0, - ndx1, tries1, - ndx2, tries2, - ndx3, tries3, + rix0, tries0, + rix1, tries1, + rix2, tries2, + rix3, tries3, short_tries, long_tries, long_tries > tries0); long_tries -= tries0; @@ -617,9 +673,9 @@ ath_rate_tx_complete(struct ath_softc *s if (tries1 && finalTSIdx > 0) { update_stats(sc, an, frame_size, - ndx1, tries1, - ndx2, tries2, - ndx3, tries3, + rix1, tries1, + rix2, tries2, + rix3, tries3, 0, 0, short_tries, long_tries, ts->ts_status); @@ -628,8 +684,8 @@ ath_rate_tx_complete(struct ath_softc *s if (tries2 && finalTSIdx > 1) { update_stats(sc, an, frame_size, - ndx2, tries2, - ndx3, tries3, + rix2, tries2, + rix3, tries3, 0, 0, 0, 0, short_tries, long_tries, @@ -639,7 +695,7 @@ ath_rate_tx_complete(struct ath_softc *s if (tries3 && finalTSIdx > 2) { update_stats(sc, an, frame_size, - ndx3, tries3, + rix3, tries3, 0, 0, 0, 0, 0, 0, @@ -656,6 +712,21 @@ ath_rate_newassoc(struct ath_softc *sc, ath_rate_ctl_reset(sc, &an->an_node); } +static const struct txschedule *mrr_schedules[IEEE80211_MODE_MAX+2] = { + NULL, /* IEEE80211_MODE_AUTO */ + series_11a, /* IEEE80211_MODE_11A */ + series_11g, /* IEEE80211_MODE_11B */ + series_11g, /* IEEE80211_MODE_11G */ + NULL, /* IEEE80211_MODE_FH */ + series_11a, /* IEEE80211_MODE_TURBO_A */ + series_11g, /* IEEE80211_MODE_TURBO_G */ + series_11a, /* IEEE80211_MODE_STURBO_A */ + series_11a, /* IEEE80211_MODE_11NA */ + series_11g, /* IEEE80211_MODE_11NG */ + series_half, /* IEEE80211_MODE_HALF */ + series_quarter, /* IEEE80211_MODE_QUARTER */ +}; + /* * Initialize the tables for a node. */ @@ -663,14 +734,22 @@ static void ath_rate_ctl_reset(struct ath_softc *sc, struct ieee80211_node *ni) { #define RATE(_ix) (ni->ni_rates.rs_rates[(_ix)] & IEEE80211_RATE_VAL) +#define DOT11RATE(_ix) (rt->info[(_ix)].dot11Rate & IEEE80211_RATE_VAL) struct ath_node *an = ATH_NODE(ni); const struct ieee80211_txparam *tp = ni->ni_txparms; struct sample_node *sn = ATH_NODE_SAMPLE(an); const HAL_RATE_TABLE *rt = sc->sc_currates; - int x, y, srate; + int x, y, srate, rix; KASSERT(rt != NULL, ("no rate table, mode %u", sc->sc_curmode)); - sn->static_rate_ndx = -1; + + KASSERT(sc->sc_curmode < IEEE80211_MODE_MAX+2, + ("curmode %u", sc->sc_curmode)); + sn->sched = mrr_schedules[sc->sc_curmode]; + KASSERT(sn->sched != NULL, + ("no mrr schedule for mode %u", sc->sc_curmode)); + + sn->static_rix = -1; if (tp != NULL && tp->ucastrate != IEEE80211_FIXED_RATE_NONE) { /* * A fixed rate is to be used; ic_fixed_rate is the @@ -689,122 +768,227 @@ ath_rate_ctl_reset(struct ath_softc *sc, * can fail. */ if (srate >= 0) - sn->static_rate_ndx = srate; + sn->static_rix = sc->sc_rixmap[srate]; } - sn->num_rates = ni->ni_rates.rs_nrates; - for (x = 0; x < ni->ni_rates.rs_nrates; x++) { - sn->rates[x].rate = ni->ni_rates.rs_rates[x] & IEEE80211_RATE_VAL; - sn->rates[x].rix = sc->sc_rixmap[sn->rates[x].rate]; - if (sn->rates[x].rix == 0xff) { - IEEE80211_NOTE(ni->ni_vap, IEEE80211_MSG_RATECTL, ni, - "%s: ignore bogus rix at %d", __func__, x); + /* + * Construct a bitmask of usable rates. This has all + * negotiated rates minus those marked by the hal as + * to be ignored for doing rate control. + */ + sn->ratemask = 0; + for (x = 0; x < ni->ni_rates.rs_nrates; x++) { + rix = sc->sc_rixmap[RATE(x)]; + if (rix == 0xff) continue; - } - sn->rates[x].rateCode = rt->info[sn->rates[x].rix].rateCode; - sn->rates[x].shortPreambleRateCode = - rt->info[sn->rates[x].rix].rateCode | - rt->info[sn->rates[x].rix].shortPreamble; + /* skip rates marked broken by hal */ + if (!rt->info[rix].valid) + continue; + KASSERT(rix < SAMPLE_MAXRATES, + ("rate %u has rix %d", RATE(x), rix)); + sn->ratemask |= 1<ni_vap, IEEE80211_MSG_RATECTL)) { + uint32_t mask; + ieee80211_note(ni->ni_vap, "[%6D] %s: size 1600 rate/tt", - __func__, ni->ni_macaddr, ":"); - for (x = 0; x < sn->num_rates; x++) { - if (sn->rates[x].rix == 0xff) + ni->ni_macaddr, ":", __func__); + for (mask = sn->ratemask, rix = 0; mask != 0; mask >>= 1, rix++) { + if ((mask & 1) == 0) continue; - printf(" %d/%d", sn->rates[x].rate, - calc_usecs_unicast_packet(sc, 1600, - sn->rates[x].rix, 0,0)); + printf(" %d/%d", DOT11RATE(rix) / 2, + calc_usecs_unicast_packet(sc, 1600, rix, 0,0)); } printf("\n"); } #endif for (y = 0; y < NUM_PACKET_SIZE_BINS; y++) { int size = bin_to_size(y); - int ndx = 0; + uint32_t mask; + sn->packets_sent[y] = 0; - sn->current_sample_ndx[y] = -1; - sn->last_sample_ndx[y] = 0; + sn->current_sample_rix[y] = -1; + sn->last_sample_rix[y] = 0; + /* XXX start with first valid rate */ + sn->current_rix[y] = ffs(sn->ratemask)-1; - for (x = 0; x < ni->ni_rates.rs_nrates; x++) { - sn->stats[y][x].successive_failures = 0; - sn->stats[y][x].tries = 0; - sn->stats[y][x].total_packets = 0; - sn->stats[y][x].packets_acked = 0; - sn->stats[y][x].last_tx = 0; + /* + * Initialize the statistics buckets; these are + * indexed by the rate code index. + */ + for (rix = 0, mask = sn->ratemask; mask != 0; rix++, mask >>= 1) { + if ((mask & 1) == 0) /* not a valid rate */ + continue; + sn->stats[y][rix].successive_failures = 0; + sn->stats[y][rix].tries = 0; + sn->stats[y][rix].total_packets = 0; + sn->stats[y][rix].packets_acked = 0; + sn->stats[y][rix].last_tx = 0; - sn->stats[y][x].perfect_tx_time = - calc_usecs_unicast_packet(sc, size, - sn->rates[x].rix, - 0, 0); - sn->stats[y][x].average_tx_time = sn->stats[y][x].perfect_tx_time; + sn->stats[y][rix].perfect_tx_time = + calc_usecs_unicast_packet(sc, size, rix, 0, 0); *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@FreeBSD.ORG Sun Nov 30 19:30:32 2008 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 47D64106564A; Sun, 30 Nov 2008 19:30:32 +0000 (UTC) (envelope-from jasone@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 376B98FC13; Sun, 30 Nov 2008 19:30:32 +0000 (UTC) (envelope-from jasone@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mAUJUV7j099584; Sun, 30 Nov 2008 19:30:31 GMT (envelope-from jasone@svn.freebsd.org) Received: (from jasone@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mAUJUVRo099583; Sun, 30 Nov 2008 19:30:31 GMT (envelope-from jasone@svn.freebsd.org) Message-Id: <200811301930.mAUJUVRo099583@svn.freebsd.org> From: Jason Evans Date: Sun, 30 Nov 2008 19:30: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: r185483 - 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, 30 Nov 2008 19:30:32 -0000 Author: jasone Date: Sun Nov 30 19:30:31 2008 New Revision: 185483 URL: http://svn.freebsd.org/changeset/base/185483 Log: Adjust an assertion to handle the case where a lock is contested, but spinning is avoided due to running on a single-CPU system. Reported by: stefanf Modified: head/lib/libc/stdlib/malloc.c Modified: head/lib/libc/stdlib/malloc.c ============================================================================== --- head/lib/libc/stdlib/malloc.c Sun Nov 30 19:06:35 2008 (r185482) +++ head/lib/libc/stdlib/malloc.c Sun Nov 30 19:30:31 2008 (r185483) @@ -1284,7 +1284,7 @@ malloc_spin_lock(pthread_mutex_t *lock) * inversion. */ _pthread_mutex_lock(lock); - assert((ret << BLOCK_COST_2POW) != 0); + assert((ret << BLOCK_COST_2POW) != 0 || ncpus == 1); return (ret << BLOCK_COST_2POW); } } From owner-svn-src-head@FreeBSD.ORG Sun Nov 30 19:58:03 2008 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id AD9F71065675; Sun, 30 Nov 2008 19:58:03 +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 9D0238FC17; Sun, 30 Nov 2008 19:58:03 +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 mAUJw3D9000326; Sun, 30 Nov 2008 19:58:03 GMT (envelope-from csjp@svn.freebsd.org) Received: (from csjp@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mAUJw3cq000325; Sun, 30 Nov 2008 19:58:03 GMT (envelope-from csjp@svn.freebsd.org) Message-Id: <200811301958.mAUJw3cq000325@svn.freebsd.org> From: "Christian S.J. Peron" Date: Sun, 30 Nov 2008 19:58: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: r185484 - head/sys/security/audit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 30 Nov 2008 19:58:03 -0000 Author: csjp Date: Sun Nov 30 19:58:03 2008 New Revision: 185484 URL: http://svn.freebsd.org/changeset/base/185484 Log: Partially roll back a revision which changed the error code being returned by getaudit(2). Some applications such has su, id will interpret E2BIG as requiring the use of getaudit_addr(2) to pull extended audit state (ip6) from the kernel. This change un-breaks the ABI when auditing has been activated on a system and the users are logged in via ip6. This is a RELENG_7_1 candidate. MFC after: 1 day Discussed with: rwatson Modified: head/sys/security/audit/audit_syscalls.c Modified: head/sys/security/audit/audit_syscalls.c ============================================================================== --- head/sys/security/audit/audit_syscalls.c Sun Nov 30 19:30:31 2008 (r185483) +++ head/sys/security/audit/audit_syscalls.c Sun Nov 30 19:58:03 2008 (r185484) @@ -510,7 +510,7 @@ getaudit(struct thread *td, struct getau if (error) return (error); if (cred->cr_audit.ai_termid.at_type == AU_IPv6) - return (ERANGE); + return (E2BIG); bzero(&ai, sizeof(ai)); ai.ai_auid = cred->cr_audit.ai_auid; ai.ai_mask = cred->cr_audit.ai_mask; From owner-svn-src-head@FreeBSD.ORG Sun Nov 30 20:48:57 2008 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8C02C1065676; Sun, 30 Nov 2008 20:48:57 +0000 (UTC) (envelope-from sam@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 7B6608FC17; Sun, 30 Nov 2008 20:48:57 +0000 (UTC) (envelope-from sam@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mAUKmvfo001377; Sun, 30 Nov 2008 20:48:57 GMT (envelope-from sam@svn.freebsd.org) Received: (from sam@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mAUKmvds001376; Sun, 30 Nov 2008 20:48:57 GMT (envelope-from sam@svn.freebsd.org) Message-Id: <200811302048.mAUKmvds001376@svn.freebsd.org> From: Sam Leffler Date: Sun, 30 Nov 2008 20:48: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: r185485 - head/sys/dev/if_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: Sun, 30 Nov 2008 20:48:57 -0000 Author: sam Date: Sun Nov 30 20:48:57 2008 New Revision: 185485 URL: http://svn.freebsd.org/changeset/base/185485 Log: hookup mcast and promisc callbacks Submitted by: "Paul B. Mahol" Modified: head/sys/dev/if_ndis/if_ndis.c Modified: head/sys/dev/if_ndis/if_ndis.c ============================================================================== --- head/sys/dev/if_ndis/if_ndis.c Sun Nov 30 19:58:03 2008 (r185484) +++ head/sys/dev/if_ndis/if_ndis.c Sun Nov 30 20:48:57 2008 (r185485) @@ -142,6 +142,8 @@ static void ndis_tick (void *); static void ndis_ticktask (device_object *, void *); static int ndis_raw_xmit (struct ieee80211_node *, struct mbuf *, const struct ieee80211_bpf_params *); +static void ndis_update_mcast (struct ifnet *ifp); +static void ndis_update_promisc (struct ifnet *ifp); static void ndis_start (struct ifnet *); static void ndis_starttask (device_object *, void *); static void ndis_resettask (device_object *, void *); @@ -915,6 +917,8 @@ got_crypto: //ic->ic_bss->ni_chan = ic->ic_bsschan; ic->ic_vap_create = ndis_vap_create; ic->ic_vap_delete = ndis_vap_delete; + ic->ic_update_mcast = ndis_update_mcast; + ic->ic_update_promisc = ndis_update_promisc; } else { ifmedia_init(&sc->ifmedia, IFM_IMASK, ndis_ifmedia_upd, @@ -1767,6 +1771,20 @@ ndis_raw_xmit(struct ieee80211_node *ni, } static void +ndis_update_mcast(struct ifnet *ifp) +{ + struct ndis_softc *sc = ifp->if_softc; + + ndis_setmulti(sc); +} + +static void +ndis_update_promisc(struct ifnet *ifp) +{ + /* not supported */ +} + +static void ndis_starttask(d, arg) device_object *d; void *arg; From owner-svn-src-head@FreeBSD.ORG Sun Nov 30 21:40:02 2008 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2DB861065670; Sun, 30 Nov 2008 21:40:02 +0000 (UTC) (envelope-from ivoras@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 1C54E8FC12; Sun, 30 Nov 2008 21:40:02 +0000 (UTC) (envelope-from ivoras@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mAULe1rU002679; Sun, 30 Nov 2008 21:40:01 GMT (envelope-from ivoras@svn.freebsd.org) Received: (from ivoras@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mAULe1T6002678; Sun, 30 Nov 2008 21:40:01 GMT (envelope-from ivoras@svn.freebsd.org) Message-Id: <200811302140.mAULe1T6002678@svn.freebsd.org> From: Ivan Voras Date: Sun, 30 Nov 2008 21:40: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: r185489 - head/lib/libc/sys X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 30 Nov 2008 21:40:02 -0000 Author: ivoras Date: Sun Nov 30 21:40:01 2008 New Revision: 185489 URL: http://svn.freebsd.org/changeset/base/185489 Log: It's silly to claim recv(2) is to be removed in favour of recvfrom(2) (at least at this time :) ). Approved by: gnn (mentor) Modified: head/lib/libc/sys/recv.2 Modified: head/lib/libc/sys/recv.2 ============================================================================== --- head/lib/libc/sys/recv.2 Sun Nov 30 21:06:23 2008 (r185488) +++ head/lib/libc/sys/recv.2 Sun Nov 30 21:40:01 2008 (r185489) @@ -83,7 +83,6 @@ with a null pointer passed as its .Fa from argument. -As it is redundant, it may not be supported in future releases. .Pp All three routines return the length of the message on successful completion. From owner-svn-src-head@FreeBSD.ORG Sun Nov 30 21:59:44 2008 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9BA601065672; Sun, 30 Nov 2008 21:59: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 8A8018FC17; Sun, 30 Nov 2008 21:59:44 +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 mAULxiS3003134; Sun, 30 Nov 2008 21:59:44 GMT (envelope-from sam@svn.freebsd.org) Received: (from sam@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mAULxilH003133; Sun, 30 Nov 2008 21:59:44 GMT (envelope-from sam@svn.freebsd.org) Message-Id: <200811302159.mAULxilH003133@svn.freebsd.org> From: Sam Leffler Date: Sun, 30 Nov 2008 21:59: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: r185490 - head/sys/dev/ath/ath_rate/sample X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 30 Nov 2008 21:59:44 -0000 Author: sam Date: Sun Nov 30 21:59:44 2008 New Revision: 185490 URL: http://svn.freebsd.org/changeset/base/185490 Log: cover up sun4v namespace pollution Modified: head/sys/dev/ath/ath_rate/sample/sample.c Modified: head/sys/dev/ath/ath_rate/sample/sample.c ============================================================================== --- head/sys/dev/ath/ath_rate/sample/sample.c Sun Nov 30 21:40:01 2008 (r185489) +++ head/sys/dev/ath/ath_rate/sample/sample.c Sun Nov 30 21:59:44 2008 (r185490) @@ -405,6 +405,9 @@ static const struct txschedule series_ha }; #undef H +#ifdef Q +#undef Q /* sun4v bogosity */ +#endif #define Q(_r) \ (((_r) == 1.5) ? 0 : (((_r) ==2.25) ? 1 : (((_r) == 3) ? 2 : \ (((_r) == 4.5) ? 3 : (((_r) == 6) ? 4 : (((_r) == 9) ? 5 : \ From owner-svn-src-head@FreeBSD.ORG Sun Nov 30 22:33:03 2008 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CD8791065675; Sun, 30 Nov 2008 22:33:03 +0000 (UTC) (envelope-from stas@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id BBF578FC0A; Sun, 30 Nov 2008 22:33:03 +0000 (UTC) (envelope-from stas@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mAUMX3Bt003943; Sun, 30 Nov 2008 22:33:03 GMT (envelope-from stas@svn.freebsd.org) Received: (from stas@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mAUMX3UZ003941; Sun, 30 Nov 2008 22:33:03 GMT (envelope-from stas@svn.freebsd.org) Message-Id: <200811302233.mAUMX3UZ003941@svn.freebsd.org> From: Stanislav Sedov Date: Sun, 30 Nov 2008 22:33: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: r185491 - in head/sys: arm/at91 conf X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 30 Nov 2008 22:33:03 -0000 Author: stas Date: Sun Nov 30 22:33:03 2008 New Revision: 185491 URL: http://svn.freebsd.org/changeset/base/185491 Log: - Obtain main clock frequency dynamically based on CKGR_MCFR register contents. - It is possible to override the dynamic configuration by using AT91C_MAIN_CLOCK option in kernel config. PR: arm/128961 (based on) Submitted by: Bjorn Konig Reviewed by: imp Approved by: kib (mentor, implicit) Modified: head/sys/arm/at91/at91_pmc.c head/sys/conf/options.arm Modified: head/sys/arm/at91/at91_pmc.c ============================================================================== --- head/sys/arm/at91/at91_pmc.c Sun Nov 30 21:59:44 2008 (r185490) +++ head/sys/arm/at91/at91_pmc.c Sun Nov 30 22:33:03 2008 (r185491) @@ -31,6 +31,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -54,7 +55,7 @@ static struct at91_pmc_softc { bus_space_handle_t sc_sh; struct resource *mem_res; /* Memory resource */ device_t dev; - int main_clock_hz; + unsigned int main_clock_hz; uint32_t pllb_init; } *pmc_softc; @@ -145,6 +146,18 @@ static struct at91_pmc_clock *const cloc &ohci_clk }; +#if !defined(AT91C_MAIN_CLOCK) +static const unsigned int at91_mainf_tbl[] = { + 3000000, 3276800, 3686400, 3840000, 4000000, + 4433619, 4915200, 5000000, 5242880, 6000000, + 6144000, 6400000, 6553600, 7159090, 7372800, + 7864320, 8000000, 9830400, 10000000, 11059200, + 12000000, 12288000, 13560000, 14318180, 14745600, + 16000000, 17344700, 18432000, 20000000 +}; +#define MAINF_TBL_LEN (sizeof(at91_mainf_tbl) / sizeof(*at91_mainf_tbl)) +#endif + static inline uint32_t RD4(struct at91_pmc_softc *sc, bus_size_t off) { @@ -301,7 +314,7 @@ fail: } static void -at91_pmc_init_clock(struct at91_pmc_softc *sc, int main_clock) +at91_pmc_init_clock(struct at91_pmc_softc *sc, unsigned int main_clock) { uint32_t mckr; int freq; @@ -384,21 +397,52 @@ at91_pmc_probe(device_t dev) return (0); } +#if !defined(AT91C_MAIN_CLOCK) +static unsigned int +at91_pmc_sense_mainf(struct at91_pmc_softc *sc) +{ + unsigned int ckgr_val; + unsigned int diff, matchdiff; + int i, match; + + ckgr_val = (RD4(sc, CKGR_MCFR) & CKGR_MCFR_MAINF_MASK) << 11; + + /* + * Try to find the standard frequency that match best. + */ + match = 0; + matchdiff = abs(ckgr_val - at91_mainf_tbl[0]); + for (i = 1; i < MAINF_TBL_LEN; i++) { + diff = abs(ckgr_val - at91_mainf_tbl[i]); + if (diff < matchdiff) { + match = i; + matchdiff = diff; + } + } + return (at91_mainf_tbl[match]); +} +#endif + static int at91_pmc_attach(device_t dev) { + unsigned int mainf; int err; pmc_softc = device_get_softc(dev); pmc_softc->dev = dev; if ((err = at91_pmc_activate(dev)) != 0) return err; -#if defined(AT91_TSC) | defined (AT91_BWCT) - at91_pmc_init_clock(pmc_softc, 16000000); + + /* + * Configure main clock frequency. + */ +#if !defined(AT91C_MAIN_CLOCK) + mainf = at91_pmc_sense_mainf(pmc_softc); #else - at91_pmc_init_clock(pmc_softc, 10000000); + mainf = AT91C_MAIN_CLOCK; #endif - + at91_pmc_init_clock(pmc_softc, mainf); return (0); } Modified: head/sys/conf/options.arm ============================================================================== --- head/sys/conf/options.arm Sun Nov 30 21:59:44 2008 (r185490) +++ head/sys/conf/options.arm Sun Nov 30 22:33:03 2008 (r185491) @@ -5,6 +5,7 @@ ARMFPE opt_global.h ARM_KERN_DIRECTMAP opt_vm.h ARM_USE_SMALL_ALLOC opt_global.h AT91C_MASTER_CLOCK opt_global.h +AT91C_MAIN_CLOCK opt_at91.h COUNTS_PER_SEC opt_timer.h CPU_SA1100 opt_global.h CPU_SA1110 opt_global.h From owner-svn-src-head@FreeBSD.ORG Sun Nov 30 22:40:11 2008 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 93061106564A; Sun, 30 Nov 2008 22:40:11 +0000 (UTC) (envelope-from stas@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 81E768FC0C; Sun, 30 Nov 2008 22:40:11 +0000 (UTC) (envelope-from stas@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mAUMeBrJ004176; Sun, 30 Nov 2008 22:40:11 GMT (envelope-from stas@svn.freebsd.org) Received: (from stas@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mAUMeBxa004175; Sun, 30 Nov 2008 22:40:11 GMT (envelope-from stas@svn.freebsd.org) Message-Id: <200811302240.mAUMeBxa004175@svn.freebsd.org> From: Stanislav Sedov Date: Sun, 30 Nov 2008 22:40: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: r185492 - head/sys/arm/at91 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 30 Nov 2008 22:40:11 -0000 Author: stas Date: Sun Nov 30 22:40:11 2008 New Revision: 185492 URL: http://svn.freebsd.org/changeset/base/185492 Log: - Get rid of extra include file, erroneously added by the previous commit. This include file was required by the first version of the patch. Approved by: kib (mentor, implicit) Modified: head/sys/arm/at91/at91_pmc.c Modified: head/sys/arm/at91/at91_pmc.c ============================================================================== --- head/sys/arm/at91/at91_pmc.c Sun Nov 30 22:33:03 2008 (r185491) +++ head/sys/arm/at91/at91_pmc.c Sun Nov 30 22:40:11 2008 (r185492) @@ -31,7 +31,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include #include From owner-svn-src-head@FreeBSD.ORG Sun Nov 30 22:58:27 2008 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8A6AA1065677; Sun, 30 Nov 2008 22:58:27 +0000 (UTC) (envelope-from stas@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 78E0E8FC19; Sun, 30 Nov 2008 22:58:27 +0000 (UTC) (envelope-from stas@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mAUMwRsr004626; Sun, 30 Nov 2008 22:58:27 GMT (envelope-from stas@svn.freebsd.org) Received: (from stas@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mAUMwRdZ004625; Sun, 30 Nov 2008 22:58:27 GMT (envelope-from stas@svn.freebsd.org) Message-Id: <200811302258.mAUMwRdZ004625@svn.freebsd.org> From: Stanislav Sedov Date: Sun, 30 Nov 2008 22:58: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: r185494 - head/sys/arm/arm X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 30 Nov 2008 22:58:27 -0000 Author: stas Date: Sun Nov 30 22:58:27 2008 New Revision: 185494 URL: http://svn.freebsd.org/changeset/base/185494 Log: - Get rid of unused variable in KTR checks. This allows ktr(4) enabled ARM kernel to compile. PR: arm/128897 Submitted by: Pankov Pavel Reviewed by: raj Approved by: kib (mentor, implicit) MFC after: 1 week Modified: head/sys/arm/arm/busdma_machdep.c Modified: head/sys/arm/arm/busdma_machdep.c ============================================================================== --- head/sys/arm/arm/busdma_machdep.c Sun Nov 30 22:40:14 2008 (r185493) +++ head/sys/arm/arm/busdma_machdep.c Sun Nov 30 22:58:27 2008 (r185494) @@ -673,9 +673,8 @@ _bus_dmamap_count_pages(bus_dma_tag_t dm bus_addr_t paddr; if ((map->pagesneeded == 0)) { - CTR4(KTR_BUSDMA, "lowaddr= %d Maxmem= %d, boundary= %d, " - "alignment= %d", dmat->lowaddr, ptoa((vm_paddr_t)Maxmem), - dmat->boundary, dmat->alignment); + CTR3(KTR_BUSDMA, "lowaddr= %d, boundary= %d, alignment= %d", + dmat->lowaddr, dmat->boundary, dmat->alignment); CTR2(KTR_BUSDMA, "map= %p, pagesneeded= %d", map, map->pagesneeded); /* From owner-svn-src-head@FreeBSD.ORG Sun Nov 30 23:38:44 2008 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9CF791065670; Sun, 30 Nov 2008 23:38:44 +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 8C5538FC13; Sun, 30 Nov 2008 23:38:44 +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 mAUNciwM005547; Sun, 30 Nov 2008 23:38:44 GMT (envelope-from marcel@svn.freebsd.org) Received: (from marcel@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mAUNci3a005546; Sun, 30 Nov 2008 23:38:44 GMT (envelope-from marcel@svn.freebsd.org) Message-Id: <200811302338.mAUNci3a005546@svn.freebsd.org> From: Marcel Moolenaar Date: Sun, 30 Nov 2008 23:38: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: r185495 - head/sbin/geom/class/part X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 30 Nov 2008 23:38:44 -0000 Author: marcel Date: Sun Nov 30 23:38:44 2008 New Revision: 185495 URL: http://svn.freebsd.org/changeset/base/185495 Log: Call gctl_free() after we processed the error string. It's being freed as part of the request. Modified: head/sbin/geom/class/part/geom_part.c Modified: head/sbin/geom/class/part/geom_part.c ============================================================================== --- head/sbin/geom/class/part/geom_part.c Sun Nov 30 22:58:27 2008 (r185494) +++ head/sbin/geom/class/part/geom_part.c Sun Nov 30 23:38:44 2008 (r185495) @@ -512,23 +512,29 @@ gpart_issue(struct gctl_req *req, unsign char buf[4096]; char *errmsg; const char *errstr; - int error; + int error, status; bzero(buf, sizeof(buf)); gctl_rw_param(req, "output", sizeof(buf), buf); errstr = gctl_issue(req); - gctl_free(req); if (errstr == NULL || errstr[0] == '\0') { if (buf[0] != '\0') printf("%s", buf); - exit(EXIT_SUCCESS); + status = EXIT_SUCCESS; + goto done; } error = strtol(errstr, &errmsg, 0); while (errmsg[0] == ' ') errmsg++; if (errmsg[0] != '\0') - errc(EXIT_FAILURE, error, "%s", errmsg); + warnc(error, "%s", errmsg); else - errc(EXIT_FAILURE, error, NULL); + warnc(error, NULL); + + status = EXIT_FAILURE; + + done: + gctl_free(req); + exit(status); } From owner-svn-src-head@FreeBSD.ORG Sun Nov 30 23:46:31 2008 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B274C1065670; Sun, 30 Nov 2008 23:46:31 +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 A1DB98FC12; Sun, 30 Nov 2008 23:46:31 +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 mAUNkVSh005750; Sun, 30 Nov 2008 23:46:31 GMT (envelope-from marcel@svn.freebsd.org) Received: (from marcel@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mAUNkVnt005749; Sun, 30 Nov 2008 23:46:31 GMT (envelope-from marcel@svn.freebsd.org) Message-Id: <200811302346.mAUNkVnt005749@svn.freebsd.org> From: Marcel Moolenaar Date: Sun, 30 Nov 2008 23:46: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: r185496 - head/sbin/geom/class/part X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 30 Nov 2008 23:46:31 -0000 Author: marcel Date: Sun Nov 30 23:46:31 2008 New Revision: 185496 URL: http://svn.freebsd.org/changeset/base/185496 Log: Print error messages as-is, when they don't conform to [ 'value'] These are error messages from (lib)geom itself. Modified: head/sbin/geom/class/part/geom_part.c Modified: head/sbin/geom/class/part/geom_part.c ============================================================================== --- head/sbin/geom/class/part/geom_part.c Sun Nov 30 23:38:44 2008 (r185495) +++ head/sbin/geom/class/part/geom_part.c Sun Nov 30 23:46:31 2008 (r185496) @@ -525,12 +525,15 @@ gpart_issue(struct gctl_req *req, unsign } error = strtol(errstr, &errmsg, 0); - while (errmsg[0] == ' ') - errmsg++; - if (errmsg[0] != '\0') - warnc(error, "%s", errmsg); - else - warnc(error, NULL); + if (errmsg != errstr) { + while (errmsg[0] == ' ') + errmsg++; + if (errmsg[0] != '\0') + warnc(error, "%s", errmsg); + else + warnc(error, NULL); + } else + warnx("%s", errmsg); status = EXIT_FAILURE; From owner-svn-src-head@FreeBSD.ORG Mon Dec 1 00:07:17 2008 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id EDABB1065676; Mon, 1 Dec 2008 00:07:17 +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 DD2688FC12; Mon, 1 Dec 2008 00:07:17 +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 mB107HBj006219; Mon, 1 Dec 2008 00:07:17 GMT (envelope-from marcel@svn.freebsd.org) Received: (from marcel@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mB107HW9006215; Mon, 1 Dec 2008 00:07:17 GMT (envelope-from marcel@svn.freebsd.org) Message-Id: <200812010007.mB107HW9006215@svn.freebsd.org> From: Marcel Moolenaar Date: Mon, 1 Dec 2008 00:07: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: r185497 - head/sys/geom/part X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 01 Dec 2008 00:07:18 -0000 Author: marcel Date: Mon Dec 1 00:07:17 2008 New Revision: 185497 URL: http://svn.freebsd.org/changeset/base/185497 Log: Allow boot code to be smaller than what the scheme expects. This effectively changes the boot code size to be an upper bound and makes the interface more flexible. Modified: head/sys/geom/part/g_part.c head/sys/geom/part/g_part_gpt.c head/sys/geom/part/g_part_mbr.c head/sys/geom/part/g_part_pc98.c Modified: head/sys/geom/part/g_part.c ============================================================================== --- head/sys/geom/part/g_part.c Sun Nov 30 23:46:31 2008 (r185496) +++ head/sys/geom/part/g_part.c Mon Dec 1 00:07:17 2008 (r185497) @@ -535,8 +535,8 @@ g_part_ctl_bootcode(struct gctl_req *req error = ENODEV; goto fail; } - if (gpp->gpp_codesize != sz) { - error = EINVAL; + if (gpp->gpp_codesize > sz) { + error = EFBIG; goto fail; } Modified: head/sys/geom/part/g_part_gpt.c ============================================================================== --- head/sys/geom/part/g_part_gpt.c Sun Nov 30 23:46:31 2008 (r185496) +++ head/sys/geom/part/g_part_gpt.c Mon Dec 1 00:07:17 2008 (r185497) @@ -374,9 +374,14 @@ static int g_part_gpt_bootcode(struct g_part_table *basetable, struct g_part_parms *gpp) { struct g_part_gpt_table *table; + size_t codesz; + codesz = DOSPARTOFF; table = (struct g_part_gpt_table *)basetable; - bcopy(gpp->gpp_codeptr, table->mbr, DOSPARTOFF); + bzero(table->mbr, codesz); + codesz = MIN(codesz, gpp->gpp_codesize); + if (codesz > 0) + bcopy(gpp->gpp_codeptr, table->mbr, codesz); return (0); } Modified: head/sys/geom/part/g_part_mbr.c ============================================================================== --- head/sys/geom/part/g_part_mbr.c Sun Nov 30 23:46:31 2008 (r185496) +++ head/sys/geom/part/g_part_mbr.c Mon Dec 1 00:07:17 2008 (r185497) @@ -213,9 +213,14 @@ static int g_part_mbr_bootcode(struct g_part_table *basetable, struct g_part_parms *gpp) { struct g_part_mbr_table *table; + size_t codesz; + codesz = DOSPARTOFF; table = (struct g_part_mbr_table *)basetable; - bcopy(gpp->gpp_codeptr, table->mbr, DOSPARTOFF); + bzero(table->mbr, codesz); + codesz = MIN(codesz, gpp->gpp_codesize); + if (codesz > 0) + bcopy(gpp->gpp_codeptr, table->mbr, codesz); return (0); } Modified: head/sys/geom/part/g_part_pc98.c ============================================================================== --- head/sys/geom/part/g_part_pc98.c Sun Nov 30 23:46:31 2008 (r185496) +++ head/sys/geom/part/g_part_pc98.c Mon Dec 1 00:07:17 2008 (r185497) @@ -209,9 +209,14 @@ static int g_part_pc98_bootcode(struct g_part_table *basetable, struct g_part_parms *gpp) { struct g_part_pc98_table *table; + size_t codesz; + codesz = DOSMAGICOFFSET; table = (struct g_part_pc98_table *)basetable; - bcopy(gpp->gpp_codeptr, table->boot, DOSMAGICOFFSET); + bzero(table->boot, codesz); + codesz = MIN(codesz, gpp->gpp_codesize); + if (codesz > 0) + bcopy(gpp->gpp_codeptr, table->boot, codesz); return (0); } From owner-svn-src-head@FreeBSD.ORG Mon Dec 1 00:45:51 2008 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E4D251065670; Mon, 1 Dec 2008 00:45:51 +0000 (UTC) (envelope-from alfred@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D503C8FC0C; Mon, 1 Dec 2008 00:45:51 +0000 (UTC) (envelope-from alfred@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mB10jpxw007147; Mon, 1 Dec 2008 00:45:51 GMT (envelope-from alfred@svn.freebsd.org) Received: (from alfred@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mB10jpmX007146; Mon, 1 Dec 2008 00:45:51 GMT (envelope-from alfred@svn.freebsd.org) Message-Id: <200812010045.mB10jpmX007146@svn.freebsd.org> From: Alfred Perlstein Date: Mon, 1 Dec 2008 00:45: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: r185499 - head X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 01 Dec 2008 00:45:52 -0000 Author: alfred Date: Mon Dec 1 00:45:51 2008 New Revision: 185499 URL: http://svn.freebsd.org/changeset/base/185499 Log: Provide a 'tinderbox' target that compiles enough of FreeBSD that a developer can rest reasonably assured that the tinderbox will not be broken. This target leverages most of 'universe' but will exit non-zero and output a summary at the end. "make tinderbox" Modified: head/Makefile Modified: head/Makefile ============================================================================== --- head/Makefile Mon Dec 1 00:23:12 2008 (r185498) +++ head/Makefile Mon Dec 1 00:45:51 2008 (r185499) @@ -267,6 +267,10 @@ make: .PHONY ${MMAKE} all && \ ${MMAKE} install DESTDIR=${MAKEPATH} BINDIR= +tinderbox: + cd ${.CURDIR} && \ + DOING_TINDERBOX=YES ${MAKE} ${JFLAG} universe + # # universe # @@ -274,14 +278,24 @@ make: .PHONY # with a reasonable chance of success, regardless of how old your # existing system is. # -.if make(universe) +.if make(universe) || make(tinderbox) TARGETS?=amd64 arm i386 ia64 pc98 powerpc sparc64 sun4v +.if defined(DOING_TINDERBOX) +FAILFILE=tinderbox.failed +MAKEFAIL=tee -a ${FAILFILE} +.else +MAKEFAIL=cat +.endif + universe: universe_prologue universe_prologue: @echo "--------------------------------------------------------------" @echo ">>> make universe started on ${STARTTIME}" @echo "--------------------------------------------------------------" +.if defined(DOING_TINDERBOX) + rm -f ${FAILFILE} +.endif .for target in ${TARGETS} KERNCONFS!= cd ${.CURDIR}/sys/${target}/conf && \ find [A-Z]*[A-Z] -type f -maxdepth 0 \ @@ -296,15 +310,15 @@ universe_${target}: ${MAKE} ${JFLAG} buildworld \ TARGET=${target} \ > _.${target}.buildworld 2>&1 || \ - echo "${target} world failed," \ - "check _.${target}.buildworld for details") + (echo "${target} world failed," \ + "check _.${target}.buildworld for details" | ${MAKEFAIL})) @echo ">> ${target} buildworld completed on `LC_ALL=C date`" .endif .if exists(${.CURDIR}/sys/${target}/conf/NOTES) @(cd ${.CURDIR}/sys/${target}/conf && env __MAKE_CONF=/dev/null \ ${MAKE} LINT > ${.CURDIR}/_.${target}.makeLINT 2>&1 || \ - echo "${target} 'make LINT' failed," \ - "check _.${target}.makeLINT for details") + (echo "${target} 'make LINT' failed," \ + "check _.${target}.makeLINT for details"| ${MAKEFAIL})) .endif .for kernel in ${KERNCONFS} @(cd ${.CURDIR} && env __MAKE_CONF=/dev/null \ @@ -312,8 +326,8 @@ universe_${target}: TARGET=${target} \ KERNCONF=${kernel} \ > _.${target}.${kernel} 2>&1 || \ - echo "${target} ${kernel} kernel failed," \ - "check _.${target}.${kernel} for details") + (echo "${target} ${kernel} kernel failed," \ + "check _.${target}.${kernel} for details"| ${MAKEFAIL})) .endfor @echo ">> ${target} completed on `LC_ALL=C date`" .endfor @@ -323,4 +337,11 @@ universe_epilogue: @echo ">>> make universe completed on `LC_ALL=C date`" @echo " (started ${STARTTIME})" @echo "--------------------------------------------------------------" +.if defined(DOING_TINDERBOX) + @if [ -e ${FAILFILE} ] ; then \ + echo "Tinderbox failed:" ;\ + cat ${FAILFILE} ;\ + exit 1 ;\ + fi +.endif .endif From owner-svn-src-head@FreeBSD.ORG Mon Dec 1 01:34:19 2008 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 12BAB1065672; Mon, 1 Dec 2008 01:34:19 +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 038948FC1A; Mon, 1 Dec 2008 01:34:19 +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 mB11YIdg008111; Mon, 1 Dec 2008 01:34:18 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mB11YI2B008110; Mon, 1 Dec 2008 01:34:18 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <200812010134.mB11YI2B008110@svn.freebsd.org> From: Alexander Motin Date: Mon, 1 Dec 2008 01:34: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: r185500 - head/sys/dev/ata X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 01 Dec 2008 01:34:19 -0000 Author: mav Date: Mon Dec 1 01:34:18 2008 New Revision: 185500 URL: http://svn.freebsd.org/changeset/base/185500 Log: Restore AHCI suspend/resume support, broken with modularization commit (rev 183724). Modified: head/sys/dev/ata/ata-pci.h Modified: head/sys/dev/ata/ata-pci.h ============================================================================== --- head/sys/dev/ata/ata-pci.h Mon Dec 1 00:45:51 2008 (r185499) +++ head/sys/dev/ata/ata-pci.h Mon Dec 1 01:34:18 2008 (r185500) @@ -449,8 +449,8 @@ static device_method_t __CONCAT(dname,_m DEVMETHOD(device_probe, __CONCAT(dname,_probe)), \ DEVMETHOD(device_attach, ata_pci_attach), \ DEVMETHOD(device_detach, ata_pci_detach), \ - DEVMETHOD(device_suspend, bus_generic_suspend), \ - DEVMETHOD(device_resume, bus_generic_resume), \ + DEVMETHOD(device_suspend, ata_pci_suspend), \ + DEVMETHOD(device_resume, ata_pci_resume), \ DEVMETHOD(device_shutdown, bus_generic_shutdown), \ DEVMETHOD(bus_alloc_resource, ata_pci_alloc_resource), \ DEVMETHOD(bus_release_resource, ata_pci_release_resource), \ From owner-svn-src-head@FreeBSD.ORG Mon Dec 1 01:54:55 2008 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B355E1065678; Mon, 1 Dec 2008 01:54:55 +0000 (UTC) (envelope-from davidxu@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A43E38FC1A; Mon, 1 Dec 2008 01:54:55 +0000 (UTC) (envelope-from davidxu@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mB11stVJ008617; Mon, 1 Dec 2008 01:54:55 GMT (envelope-from davidxu@svn.freebsd.org) Received: (from davidxu@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mB11stAX008616; Mon, 1 Dec 2008 01:54:55 GMT (envelope-from davidxu@svn.freebsd.org) Message-Id: <200812010154.mB11stAX008616@svn.freebsd.org> From: David Xu Date: Mon, 1 Dec 2008 01:54: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: r185502 - 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, 01 Dec 2008 01:54:55 -0000 Author: davidxu Date: Mon Dec 1 01:54:55 2008 New Revision: 185502 URL: http://svn.freebsd.org/changeset/base/185502 Log: Revision 184199 had not been fully reverted, add missing piece. Reported by: phk Modified: head/sys/kern/subr_sleepqueue.c Modified: head/sys/kern/subr_sleepqueue.c ============================================================================== --- head/sys/kern/subr_sleepqueue.c Mon Dec 1 01:45:52 2008 (r185501) +++ head/sys/kern/subr_sleepqueue.c Mon Dec 1 01:54:55 2008 (r185502) @@ -424,6 +424,10 @@ sleepq_catch_signals(void *wchan, int pr PROC_UNLOCK(p); thread_lock(td); PROC_SUNLOCK(p); + if (ret == 0) { + sleepq_switch(wchan, pri); + return (0); + } /* * There were pending signals and this thread is still * on the sleep queue, remove it from the sleep queue. From owner-svn-src-head@FreeBSD.ORG Mon Dec 1 02:16:35 2008 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BD674106564A; Mon, 1 Dec 2008 02:16:35 +0000 (UTC) (envelope-from scf@FreeBSD.org) Received: from mail.farley.org (farley.org [67.64.95.201]) by mx1.freebsd.org (Postfix) with ESMTP id 85BEF8FC13; Mon, 1 Dec 2008 02:16:35 +0000 (UTC) (envelope-from scf@FreeBSD.org) Received: from [192.168.1.204] (baba.farley.org [192.168.1.204]) by mail.farley.org (8.14.3/8.14.3) with ESMTP id mB12GWwl030147; Sun, 30 Nov 2008 20:16:32 -0600 (CST) (envelope-from scf@FreeBSD.org) Date: Sun, 30 Nov 2008 20:16:32 -0600 (CST) From: "Sean C. Farley" To: Robert Watson In-Reply-To: <200811270842.mAR8gwi3080974@svn.freebsd.org> Message-ID: References: <200811270842.mAR8gwi3080974@svn.freebsd.org> User-Agent: Alpine 2.00 (BSF 1167 2008-08-23) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Spam-Status: No, score=-4.4 required=3.0 tests=ALL_TRUSTED,BAYES_00 autolearn=ham version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on mail.farley.org Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org Subject: Re: svn commit: r185362 - head/share/man/man9 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 01 Dec 2008 02:16:35 -0000 On Thu, 27 Nov 2008, Robert Watson wrote: > Log: > Revert r184509: don't encourage the use of sysexits.h with err() and > errx(),, as there seems to be a general preference against this > practice. *snip* > if ((four = malloc(sizeof(struct foo))) == NULL) > - err(EX_OSERR, NULL); > + err(1, (char *)NULL); > if ((six = (int *)overflow()) == NULL) > - errx(EX_DATAERR, "number overflowed"); > + errx(1, "number overflowed"); Out of curiosity, why not EXIT_FAILURE instead of 1, at least in situations where including stdlib.h is allowed? Is it because EXIT_FAILURE is only required to be non-zero and not necessarily 1? Sean -- scf@FreeBSD.org From owner-svn-src-head@FreeBSD.ORG Mon Dec 1 03:00:27 2008 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4A759106567B; Mon, 1 Dec 2008 03:00:27 +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 3B7228FC0A; Mon, 1 Dec 2008 03:00:27 +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 mB130R5H010089; Mon, 1 Dec 2008 03:00:27 GMT (envelope-from attilio@svn.freebsd.org) Received: (from attilio@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mB130Rfp010088; Mon, 1 Dec 2008 03:00:27 GMT (envelope-from attilio@svn.freebsd.org) Message-Id: <200812010300.mB130Rfp010088@svn.freebsd.org> From: Attilio Rao Date: Mon, 1 Dec 2008 03:00: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: r185504 - 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, 01 Dec 2008 03:00:27 -0000 Author: attilio Date: Mon Dec 1 03:00:26 2008 New Revision: 185504 URL: http://svn.freebsd.org/changeset/base/185504 Log: Fix an inverted check introduced in r184554. Submitted by: tegge Pointy hat to: me Modified: head/sys/kern/vfs_mount.c Modified: head/sys/kern/vfs_mount.c ============================================================================== --- head/sys/kern/vfs_mount.c Mon Dec 1 02:13:32 2008 (r185503) +++ head/sys/kern/vfs_mount.c Mon Dec 1 03:00:26 2008 (r185504) @@ -1240,7 +1240,7 @@ dounmount(mp, flags, td) mp->mnt_kern_flag |= MNTK_UNMOUNTF; error = 0; if (mp->mnt_lockref) { - if (flags & MNT_FORCE) { + if ((flags & MNT_FORCE) == 0) { mp->mnt_kern_flag &= ~(MNTK_UNMOUNT | MNTK_NOINSMNTQ | MNTK_UNMOUNTF); if (mp->mnt_kern_flag & MNTK_MWAIT) { From owner-svn-src-head@FreeBSD.ORG Mon Dec 1 04:41:46 2008 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0C3F0106564A; Mon, 1 Dec 2008 04:41:46 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id F1A3F8FC18; Mon, 1 Dec 2008 04:41:45 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mB14fjRr012486; Mon, 1 Dec 2008 04:41:45 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mB14fj1M012485; Mon, 1 Dec 2008 04:41:45 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200812010441.mB14fj1M012485@svn.freebsd.org> From: Kip Macy Date: Mon, 1 Dec 2008 04:41: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: r185506 - head/sys/dev/cxgb X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 01 Dec 2008 04:41:46 -0000 Author: kmacy Date: Mon Dec 1 04:41:45 2008 New Revision: 185506 URL: http://svn.freebsd.org/changeset/base/185506 Log: Proper fix for tracking ifnet statistics Modified: head/sys/dev/cxgb/cxgb_main.c Modified: head/sys/dev/cxgb/cxgb_main.c ============================================================================== --- head/sys/dev/cxgb/cxgb_main.c Mon Dec 1 04:03:17 2008 (r185505) +++ head/sys/dev/cxgb/cxgb_main.c Mon Dec 1 04:41:45 2008 (r185506) @@ -2203,6 +2203,58 @@ cxgb_tick_handler(void *arg, int count) if (p->linkpoll_period) check_link_status(sc); + + for (i = 0; i < sc->params.nports; i++) { + struct port_info *pi = &sc->port[i]; + struct ifnet *ifp = pi->ifp; + struct mac_stats *mstats = &pi->mac.stats; + + ifp->if_opackets = + mstats->tx_frames_64 + + mstats->tx_frames_65_127 + + mstats->tx_frames_128_255 + + mstats->tx_frames_256_511 + + mstats->tx_frames_512_1023 + + mstats->tx_frames_1024_1518 + + mstats->tx_frames_1519_max; + + ifp->if_ipackets = + mstats->rx_frames_64 + + mstats->rx_frames_65_127 + + mstats->rx_frames_128_255 + + mstats->rx_frames_256_511 + + mstats->rx_frames_512_1023 + + mstats->rx_frames_1024_1518 + + mstats->rx_frames_1519_max; + + ifp->if_obytes = mstats->tx_octets; + ifp->if_ibytes = mstats->rx_octets; + ifp->if_omcasts = mstats->tx_mcast_frames; + ifp->if_imcasts = mstats->rx_mcast_frames; + + ifp->if_collisions = + mstats->tx_total_collisions; + + ifp->if_iqdrops = mstats->rx_cong_drops; + + ifp->if_oerrors = + mstats->tx_excess_collisions + + mstats->tx_underrun + + mstats->tx_len_errs + + mstats->tx_mac_internal_errs + + mstats->tx_excess_deferral + + mstats->tx_fcs_errs; + ifp->if_ierrors = + mstats->rx_jabber + + mstats->rx_data_errs + + mstats->rx_sequence_errs + + mstats->rx_runt + + mstats->rx_too_long + + mstats->rx_mac_internal_errs + + mstats->rx_short + + mstats->rx_fcs_errs; + } + sc->check_task_cnt++; /* From owner-svn-src-head@FreeBSD.ORG Mon Dec 1 04:42:39 2008 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D722A106564A; Mon, 1 Dec 2008 04:42:39 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C8E158FC0A; Mon, 1 Dec 2008 04:42:39 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mB14gdP5012541; Mon, 1 Dec 2008 04:42:39 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mB14gdi6012540; Mon, 1 Dec 2008 04:42:39 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200812010442.mB14gdi6012540@svn.freebsd.org> From: Kip Macy Date: Mon, 1 Dec 2008 04:42: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: r185507 - head/sys/dev/cxgb X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 01 Dec 2008 04:42:40 -0000 Author: kmacy Date: Mon Dec 1 04:42:39 2008 New Revision: 185507 URL: http://svn.freebsd.org/changeset/base/185507 Log: don't manually track statistics Modified: head/sys/dev/cxgb/cxgb_sge.c Modified: head/sys/dev/cxgb/cxgb_sge.c ============================================================================== --- head/sys/dev/cxgb/cxgb_sge.c Mon Dec 1 04:41:45 2008 (r185506) +++ head/sys/dev/cxgb/cxgb_sge.c Mon Dec 1 04:42:39 2008 (r185507) @@ -1890,11 +1890,6 @@ t3_free_tx_desc(struct sge_txq *q, int r buf_ring_scan(&q->txq_mr, txsd->mi.mi_base, __FILE__, __LINE__); #endif txsd->mi.mi_base = NULL; - /* - * XXX check for cache hit rate here - * - */ - q->port->ifp->if_opackets++; } else q->txq_skipped++; @@ -2509,7 +2504,6 @@ t3_rx_eth(struct adapter *adap, struct s m->m_pkthdr.rcvif = ifp; m->m_pkthdr.header = mtod(m, uint8_t *) + sizeof(*cpl) + ethpad; - ifp->if_ipackets++; #ifndef DISABLE_MBUF_IOVEC m_explode(m); #endif From owner-svn-src-head@FreeBSD.ORG Mon Dec 1 05:43:31 2008 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 306A51065670; Mon, 1 Dec 2008 05:43:30 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E35AF8FC13; Mon, 1 Dec 2008 05:43:30 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mB15hU3m013804; Mon, 1 Dec 2008 05:43:30 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mB15hU3N013803; Mon, 1 Dec 2008 05:43:30 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200812010543.mB15hU3N013803@svn.freebsd.org> From: Kip Macy Date: Mon, 1 Dec 2008 05:43: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: r185508 - head/sys/dev/cxgb X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 01 Dec 2008 05:43:31 -0000 Author: kmacy Date: Mon Dec 1 05:43:30 2008 New Revision: 185508 URL: http://svn.freebsd.org/changeset/base/185508 Log: Update internal mac stats every time the tick task is called if we don't do this "netstat -w 1" will frequently see negative differences in packets sent Modified: head/sys/dev/cxgb/cxgb_main.c Modified: head/sys/dev/cxgb/cxgb_main.c ============================================================================== --- head/sys/dev/cxgb/cxgb_main.c Mon Dec 1 04:42:39 2008 (r185507) +++ head/sys/dev/cxgb/cxgb_main.c Mon Dec 1 05:43:30 2008 (r185508) @@ -2185,7 +2185,7 @@ cxgb_tick(void *arg) if(sc->flags & CXGB_SHUTDOWN) return; - taskqueue_enqueue(sc->tq, &sc->tick_task); + taskqueue_enqueue(sc->tq, &sc->tick_task); callout_reset(&sc->cxgb_tick_ch, CXGB_TICKS(sc), cxgb_tick, sc); } @@ -2204,10 +2204,25 @@ cxgb_tick_handler(void *arg, int count) check_link_status(sc); + sc->check_task_cnt++; + + /* + * adapter lock can currently only be acquired after the + * port lock + */ + ADAPTER_UNLOCK(sc); + + if (p->rev == T3_REV_B2 && p->nports < 4 && sc->open_device_map) + check_t3b2_mac(sc); + for (i = 0; i < sc->params.nports; i++) { struct port_info *pi = &sc->port[i]; struct ifnet *ifp = pi->ifp; struct mac_stats *mstats = &pi->mac.stats; + PORT_LOCK(pi); + t3_mac_update_stats(&pi->mac); + PORT_UNLOCK(pi); + ifp->if_opackets = mstats->tx_frames_64 + @@ -2254,30 +2269,6 @@ cxgb_tick_handler(void *arg, int count) mstats->rx_short + mstats->rx_fcs_errs; } - - sc->check_task_cnt++; - - /* - * adapter lock can currently only be acquired after the - * port lock - */ - ADAPTER_UNLOCK(sc); - - if (p->rev == T3_REV_B2 && p->nports < 4 && sc->open_device_map) - check_t3b2_mac(sc); - - /* Update MAC stats if it's time to do so */ - if (!p->linkpoll_period || - (sc->check_task_cnt * p->linkpoll_period) / 10 >= - p->stats_update_period) { - for_each_port(sc, i) { - struct port_info *port = &sc->port[i]; - PORT_LOCK(port); - t3_mac_update_stats(&port->mac); - PORT_UNLOCK(port); - } - sc->check_task_cnt = 0; - } } static void From owner-svn-src-head@FreeBSD.ORG Mon Dec 1 05:44:08 2008 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D40DF1065672; Mon, 1 Dec 2008 05:44:08 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C650E8FC12; Mon, 1 Dec 2008 05:44:08 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mB15i8I4013873; Mon, 1 Dec 2008 05:44:08 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mB15i8ku013872; Mon, 1 Dec 2008 05:44:08 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200812010544.mB15i8ku013872@svn.freebsd.org> From: Kip Macy Date: Mon, 1 Dec 2008 05:44: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: r185509 - head/sys/dev/cxgb/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, 01 Dec 2008 05:44:08 -0000 Author: kmacy Date: Mon Dec 1 05:44:08 2008 New Revision: 185509 URL: http://svn.freebsd.org/changeset/base/185509 Log: null out m_next when marshalling a packet Modified: head/sys/dev/cxgb/sys/uipc_mvec.c Modified: head/sys/dev/cxgb/sys/uipc_mvec.c ============================================================================== --- head/sys/dev/cxgb/sys/uipc_mvec.c Mon Dec 1 05:43:30 2008 (r185508) +++ head/sys/dev/cxgb/sys/uipc_mvec.c Mon Dec 1 05:44:08 2008 (r185509) @@ -293,7 +293,9 @@ retry: /* * is an immediate mbuf or is from the packet zone */ - n = n->m_next; + mhead = n->m_next; + n->m_next = NULL; + n = mhead; } *nsegs = seg_count; *m = m0; From owner-svn-src-head@FreeBSD.ORG Mon Dec 1 07:13:34 2008 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 186731065673; Mon, 1 Dec 2008 07:13:34 +0000 (UTC) (envelope-from kientzle@freebsd.org) Received: from kientzle.com (kientzle.com [66.166.149.50]) by mx1.freebsd.org (Postfix) with ESMTP id E87F68FC0A; Mon, 1 Dec 2008 07:13:33 +0000 (UTC) (envelope-from kientzle@freebsd.org) Received: from [10.123.2.178] (p53.kientzle.com [66.166.149.53]) by kientzle.com (8.12.9/8.12.9) with ESMTP id mB17DXtv097632; Sun, 30 Nov 2008 23:13:33 -0800 (PST) (envelope-from kientzle@freebsd.org) Message-ID: <49338E98.7020104@freebsd.org> Date: Sun, 30 Nov 2008 23:13:28 -0800 From: Tim Kientzle User-Agent: Mozilla/5.0 (X11; U; FreeBSD i386; en-US; rv:1.7.12) Gecko/20060422 X-Accept-Language: en-us, en MIME-Version: 1.0 To: Alfred Perlstein References: <200812010045.mB10jpmX007146@svn.freebsd.org> In-Reply-To: <200812010045.mB10jpmX007146@svn.freebsd.org> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r185499 - head X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 01 Dec 2008 07:13:34 -0000 Alfred Perlstein wrote: > Author: alfred > Date: Mon Dec 1 00:45:51 2008 > New Revision: 185499 > URL: http://svn.freebsd.org/changeset/base/185499 > > Log: > Provide a 'tinderbox' target that compiles enough of FreeBSD that > a developer can rest reasonably assured that the tinderbox will not > be broken. This target leverages most of 'universe' but will exit > non-zero and output a summary at the end. > > "make tinderbox" Excellent! I seem to recall that the "real" tinderbox uses some slightly different build options from "make universe." It would be nice to reconcile that. Tim From owner-svn-src-head@FreeBSD.ORG Mon Dec 1 07:47:46 2008 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6221A1065670; Mon, 1 Dec 2008 07:47:46 +0000 (UTC) (envelope-from stas@FreeBSD.org) Received: from mr0.ht-systems.ru (mr0.ht-systems.ru [78.110.50.55]) by mx1.freebsd.org (Postfix) with ESMTP id D01F08FC08; Mon, 1 Dec 2008 07:47:45 +0000 (UTC) (envelope-from stas@FreeBSD.org) Received: from [85.21.245.235] (helo=orion.SpringDaemons.com) by smtp.ht-systems.ru with esmtpa (Exim 4.62) (envelope-from ) id 1L73VP-0008Cy-MZ; Mon, 01 Dec 2008 10:47:43 +0300 Received: from orion (localhost [127.0.0.1]) by orion.SpringDaemons.com (Postfix) with SMTP id 64004398F4; Mon, 1 Dec 2008 10:49:20 +0300 (MSK) Date: Mon, 1 Dec 2008 10:49:20 +0300 From: Stanislav Sedov To: Bruce Evans Message-Id: <20081201104920.4b001553.stas@FreeBSD.org> In-Reply-To: <20081101212937.D12448@delplex.bde.org> References: <200810311447.m9VElFtp083250@svn.freebsd.org> <20081101212937.D12448@delplex.bde.org> Organization: The FreeBSD Project X-XMPP: ssedov@jabber.ru X-Voice: +7 916 849 20 23 X-PGP-Fingerprint: F21E D6CC 5626 9609 6CE2 A385 2BF5 5993 EB26 9581 X-Mailer: carrier-pigeon 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, Robert Watson Subject: Re: svn commit: r184509 - head/share/man/man9 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 01 Dec 2008 07:47:46 -0000 -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On Sat, 1 Nov 2008 22:05:41 +1100 (EST) Bruce Evans mentioned: > On Fri, 31 Oct 2008, Robert Watson wrote: > > > Log: > > In style(9) examples of err() and errx(), use sysexits(3) errors rather > > than returning 1. > > style(9) was correct. Using sysexits(3) is a style bug in most cases, > especially in err() and errx() messages where there is a text message > and not just a cryptic error code. (Originally, in 4.4BSD, sysexits.3 > doesn't exist and /usr/src/admin/style/style had no mention of sysexits.h. > What /usr/src/admin/style/style had was a rule to not label every error > exit with a unique error code, since this gives a large undocumented > set of program-specific error codes which no one remembers. Using > sysexits gives the same results in practice -- it gives a large > documented set of generic error codes which no one remembers, so it > was a bug to change the rule from disallowing lots of error codes to > encouraging use of sysexits. In 4.4BSD-Lite2, sysexits.3 still doesn't > exist, and sysexits.h is only referred to in 11 .c files. This shows > that use of sysexits is very unusual in BSD code. Some FreeBSD users > like it and added it to style.9 and some FreeBSD .c files, so it is > just unusual in FreeBSD code.) > What is the benefit of using a single error exit code which theoretically can't say anything about the type of the error instead of probably cryptic set of documented error coded that could be later decrypted and analyzed at least? For me the code using named error codes looks much cleaner, and as all exit codes >0 threated as error, it seems that using sysexits codes should not hurt. Do we totally againast them from now, or these exit codes still could be used? - -- Stanislav Sedov ST4096-RIPE -----BEGIN PGP SIGNATURE----- iEYEARECAAYFAkkzlwAACgkQK/VZk+smlYHYyACffC6S9RSKNpHns8YXw6oycfBx hB4Anj0Va8aZIM8SEPdAk3vir/2tO+mq =PQc1 -----END PGP SIGNATURE----- From owner-svn-src-head@FreeBSD.ORG Mon Dec 1 10:04:39 2008 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 931AF1065672; Mon, 1 Dec 2008 10:04:39 +0000 (UTC) (envelope-from kevlo@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 81EA88FC1C; Mon, 1 Dec 2008 10:04:39 +0000 (UTC) (envelope-from kevlo@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mB1A4dBX019337; Mon, 1 Dec 2008 10:04:39 GMT (envelope-from kevlo@svn.freebsd.org) Received: (from kevlo@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mB1A4dus019336; Mon, 1 Dec 2008 10:04:39 GMT (envelope-from kevlo@svn.freebsd.org) Message-Id: <200812011004.mB1A4dus019336@svn.freebsd.org> From: Kevin Lo Date: Mon, 1 Dec 2008 10:04: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: r185511 - 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: Mon, 01 Dec 2008 10:04:39 -0000 Author: kevlo Date: Mon Dec 1 10:04:39 2008 New Revision: 185511 URL: http://svn.freebsd.org/changeset/base/185511 Log: The Netgear WG111v2 USB dongle contains a RTL8187 chip, not a GW3887 chip. Obtained from: OpenBSD Modified: head/sys/dev/usb/if_upgt.c Modified: head/sys/dev/usb/if_upgt.c ============================================================================== --- head/sys/dev/usb/if_upgt.c Mon Dec 1 07:13:52 2008 (r185510) +++ head/sys/dev/usb/if_upgt.c Mon Dec 1 10:04:39 2008 (r185511) @@ -194,7 +194,6 @@ static const struct usb_devno upgt_devs_ { USB_VENDOR_GLOBESPAN, USB_PRODUCT_GLOBESPAN_PRISM_GT_1 }, { USB_VENDOR_GLOBESPAN, USB_PRODUCT_GLOBESPAN_PRISM_GT_2 }, { USB_VENDOR_INTERSIL, USB_PRODUCT_INTERSIL_PRISM_GT }, - { USB_VENDOR_NETGEAR, USB_PRODUCT_NETGEAR_WG111V2_2 }, { USB_VENDOR_SMC, USB_PRODUCT_SMC_2862WG }, { USB_VENDOR_WISTRONNEWEB, USB_PRODUCT_WISTRONNEWEB_UR045G }, { USB_VENDOR_XYRATEX, USB_PRODUCT_XYRATEX_PRISM_GT_1 }, From owner-svn-src-head@FreeBSD.ORG Mon Dec 1 10:05:34 2008 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A42F01065678; Mon, 1 Dec 2008 10:05:34 +0000 (UTC) (envelope-from kevlo@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 798FB8FC18; Mon, 1 Dec 2008 10:05:34 +0000 (UTC) (envelope-from kevlo@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mB1A5YH5019394; Mon, 1 Dec 2008 10:05:34 GMT (envelope-from kevlo@svn.freebsd.org) Received: (from kevlo@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mB1A5YNl019393; Mon, 1 Dec 2008 10:05:34 GMT (envelope-from kevlo@svn.freebsd.org) Message-Id: <200812011005.mB1A5YNl019393@svn.freebsd.org> From: Kevin Lo Date: Mon, 1 Dec 2008 10:05: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: r185512 - head/share/man/man4 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 01 Dec 2008 10:05:34 -0000 Author: kevlo Date: Mon Dec 1 10:05:34 2008 New Revision: 185512 URL: http://svn.freebsd.org/changeset/base/185512 Log: Remove The Netgear WG111v2 support Modified: head/share/man/man4/upgt.4 Modified: head/share/man/man4/upgt.4 ============================================================================== --- head/share/man/man4/upgt.4 Mon Dec 1 10:04:39 2008 (r185511) +++ head/share/man/man4/upgt.4 Mon Dec 1 10:05:34 2008 (r185512) @@ -168,8 +168,6 @@ Gigaset USB Adapter 54 .It Inventel UR045G .It -Netgear WG111v2 -.It SMC EZ ConnectG SMC2862W-G .It Sagem XG703A From owner-svn-src-head@FreeBSD.ORG Mon Dec 1 10:16:25 2008 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D1CE3106564A; Mon, 1 Dec 2008 10:16:25 +0000 (UTC) (envelope-from stas@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B87898FC13; Mon, 1 Dec 2008 10:16:25 +0000 (UTC) (envelope-from stas@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mB1AGPxQ019674; Mon, 1 Dec 2008 10:16:25 GMT (envelope-from stas@svn.freebsd.org) Received: (from stas@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mB1AGPAZ019666; Mon, 1 Dec 2008 10:16:25 GMT (envelope-from stas@svn.freebsd.org) Message-Id: <200812011016.mB1AGPAZ019666@svn.freebsd.org> From: Stanislav Sedov Date: Mon, 1 Dec 2008 10:16: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: r185513 - in head/sys/arm: at91 mv sa11x0 xscale/i80321 xscale/i8134x xscale/ixp425 xscale/pxa X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 01 Dec 2008 10:16:25 -0000 Author: stas Date: Mon Dec 1 10:16:25 2008 New Revision: 185513 URL: http://svn.freebsd.org/changeset/base/185513 Log: - Fix spelling error in comments. PR: arm/128891 Submitted by: Pavel Pankov Approved by: kib (mentor) Modified: head/sys/arm/at91/at91_machdep.c head/sys/arm/mv/mv_machdep.c head/sys/arm/sa11x0/assabet_machdep.c head/sys/arm/xscale/i80321/ep80219_machdep.c head/sys/arm/xscale/i80321/iq31244_machdep.c head/sys/arm/xscale/i8134x/crb_machdep.c head/sys/arm/xscale/ixp425/avila_machdep.c head/sys/arm/xscale/pxa/pxa_machdep.c Modified: head/sys/arm/at91/at91_machdep.c ============================================================================== --- head/sys/arm/at91/at91_machdep.c Mon Dec 1 10:05:34 2008 (r185512) +++ head/sys/arm/at91/at91_machdep.c Mon Dec 1 10:16:25 2008 (r185513) @@ -341,7 +341,7 @@ initarm(void *arg, void *arg2) * but since we are boot strapping the addresses used for the read * may have just been remapped and thus the cache could be out * of sync. A re-clean after the switch will cure this. - * After booting there are no gross reloations of the kernel thus + * After booting there are no gross relocations of the kernel thus * this problem will not occur after initarm(). */ cpu_idcache_wbinv_all(); Modified: head/sys/arm/mv/mv_machdep.c ============================================================================== --- head/sys/arm/mv/mv_machdep.c Mon Dec 1 10:05:34 2008 (r185512) +++ head/sys/arm/mv/mv_machdep.c Mon Dec 1 10:16:25 2008 (r185513) @@ -579,7 +579,7 @@ initarm(void *mdp, void *unused __unused * but since we are boot strapping the addresses used for the read * may have just been remapped and thus the cache could be out * of sync. A re-clean after the switch will cure this. - * After booting there are no gross reloations of the kernel thus + * After booting there are no gross relocations of the kernel thus * this problem will not occur after initarm(). */ cpu_idcache_wbinv_all(); Modified: head/sys/arm/sa11x0/assabet_machdep.c ============================================================================== --- head/sys/arm/sa11x0/assabet_machdep.c Mon Dec 1 10:05:34 2008 (r185512) +++ head/sys/arm/sa11x0/assabet_machdep.c Mon Dec 1 10:16:25 2008 (r185513) @@ -375,7 +375,7 @@ initarm(void *arg, void *arg2) * but since we are boot strapping the addresses used for the read * may have just been remapped and thus the cache could be out * of sync. A re-clean after the switch will cure this. - * After booting there are no gross reloations of the kernel thus + * After booting there are no gross relocations of the kernel thus * this problem will not occur after initarm(). */ cpu_idcache_wbinv_all(); Modified: head/sys/arm/xscale/i80321/ep80219_machdep.c ============================================================================== --- head/sys/arm/xscale/i80321/ep80219_machdep.c Mon Dec 1 10:05:34 2008 (r185512) +++ head/sys/arm/xscale/i80321/ep80219_machdep.c Mon Dec 1 10:16:25 2008 (r185513) @@ -352,7 +352,7 @@ initarm(void *arg, void *arg2) * but since we are boot strapping the addresses used for the read * may have just been remapped and thus the cache could be out * of sync. A re-clean after the switch will cure this. - * After booting there are no gross reloations of the kernel thus + * After booting there are no gross relocations of the kernel thus * this problem will not occur after initarm(). */ cpu_idcache_wbinv_all(); Modified: head/sys/arm/xscale/i80321/iq31244_machdep.c ============================================================================== --- head/sys/arm/xscale/i80321/iq31244_machdep.c Mon Dec 1 10:05:34 2008 (r185512) +++ head/sys/arm/xscale/i80321/iq31244_machdep.c Mon Dec 1 10:16:25 2008 (r185513) @@ -350,7 +350,7 @@ initarm(void *arg, void *arg2) * but since we are boot strapping the addresses used for the read * may have just been remapped and thus the cache could be out * of sync. A re-clean after the switch will cure this. - * After booting there are no gross reloations of the kernel thus + * After booting there are no gross relocations of the kernel thus * this problem will not occur after initarm(). */ cpu_idcache_wbinv_all(); Modified: head/sys/arm/xscale/i8134x/crb_machdep.c ============================================================================== --- head/sys/arm/xscale/i8134x/crb_machdep.c Mon Dec 1 10:05:34 2008 (r185512) +++ head/sys/arm/xscale/i8134x/crb_machdep.c Mon Dec 1 10:16:25 2008 (r185513) @@ -332,7 +332,7 @@ initarm(void *arg, void *arg2) * but since we are boot strapping the addresses used for the read * may have just been remapped and thus the cache could be out * of sync. A re-clean after the switch will cure this. - * After booting there are no gross reloations of the kernel thus + * After booting there are no gross relocations of the kernel thus * this problem will not occur after initarm(). */ cpu_idcache_wbinv_all(); Modified: head/sys/arm/xscale/ixp425/avila_machdep.c ============================================================================== --- head/sys/arm/xscale/ixp425/avila_machdep.c Mon Dec 1 10:05:34 2008 (r185512) +++ head/sys/arm/xscale/ixp425/avila_machdep.c Mon Dec 1 10:16:25 2008 (r185513) @@ -418,7 +418,7 @@ initarm(void *arg, void *arg2) * but since we are boot strapping the addresses used for the read * may have just been remapped and thus the cache could be out * of sync. A re-clean after the switch will cure this. - * After booting there are no gross reloations of the kernel thus + * After booting there are no gross relocations of the kernel thus * this problem will not occur after initarm(). */ cpu_idcache_wbinv_all(); Modified: head/sys/arm/xscale/pxa/pxa_machdep.c ============================================================================== --- head/sys/arm/xscale/pxa/pxa_machdep.c Mon Dec 1 10:05:34 2008 (r185512) +++ head/sys/arm/xscale/pxa/pxa_machdep.c Mon Dec 1 10:16:25 2008 (r185513) @@ -330,7 +330,7 @@ initarm(void *arg, void *arg2) * but since we are boot strapping the addresses used for the read * may have just been remapped and thus the cache could be out * of sync. A re-clean after the switch will cure this. - * After booting there are no gross reloations of the kernel thus + * After booting there are no gross relocations of the kernel thus * this problem will not occur after initarm(). */ cpu_idcache_wbinv_all(); From owner-svn-src-head@FreeBSD.ORG Mon Dec 1 10:20:59 2008 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6FB921065676; Mon, 1 Dec 2008 10:20:59 +0000 (UTC) (envelope-from jasone@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 5DB9C8FC1E; Mon, 1 Dec 2008 10:20:59 +0000 (UTC) (envelope-from jasone@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mB1AKx3R019798; Mon, 1 Dec 2008 10:20:59 GMT (envelope-from jasone@svn.freebsd.org) Received: (from jasone@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mB1AKxwK019797; Mon, 1 Dec 2008 10:20:59 GMT (envelope-from jasone@svn.freebsd.org) Message-Id: <200812011020.mB1AKxwK019797@svn.freebsd.org> From: Jason Evans Date: Mon, 1 Dec 2008 10:20: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: r185514 - 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: Mon, 01 Dec 2008 10:20:59 -0000 Author: jasone Date: Mon Dec 1 10:20:59 2008 New Revision: 185514 URL: http://svn.freebsd.org/changeset/base/185514 Log: Fix a lock order reversal bug that could cause deadlock during fork(2). Reported by: kib Modified: head/lib/libc/stdlib/malloc.c Modified: head/lib/libc/stdlib/malloc.c ============================================================================== --- head/lib/libc/stdlib/malloc.c Mon Dec 1 10:16:25 2008 (r185513) +++ head/lib/libc/stdlib/malloc.c Mon Dec 1 10:20:59 2008 (r185514) @@ -5515,16 +5515,41 @@ _malloc_thread_cleanup(void) void _malloc_prefork(void) { - unsigned i; + bool again; + unsigned i, j; + arena_t *larenas[narenas], *tarenas[narenas]; /* Acquire all mutexes in a safe order. */ - malloc_spin_lock(&arenas_lock); - for (i = 0; i < narenas; i++) { - if (arenas[i] != NULL) - malloc_spin_lock(&arenas[i]->lock); - } - malloc_spin_unlock(&arenas_lock); + /* + * arenas_lock must be acquired after all of the arena mutexes, in + * order to avoid potential deadlock with arena_lock_balance[_hard](). + * Since arenas_lock protects the arenas array, the following code has + * to race with arenas_extend() callers until it succeeds in locking + * all arenas before locking arenas_lock. + */ + memset(larenas, 0, sizeof(arena_t *) * narenas); + do { + again = false; + + malloc_spin_lock(&arenas_lock); + for (i = 0; i < narenas; i++) { + if (arenas[i] != larenas[i]) { + memcpy(tarenas, arenas, sizeof(arena_t *) * + narenas); + malloc_spin_unlock(&arenas_lock); + for (j = 0; j < narenas; j++) { + if (larenas[j] != tarenas[j]) { + larenas[j] = tarenas[j]; + malloc_spin_lock( + &larenas[j]->lock); + } + } + again = true; + break; + } + } + } while (again); malloc_mutex_lock(&base_mtx); @@ -5539,6 +5564,7 @@ void _malloc_postfork(void) { unsigned i; + arena_t *larenas[narenas]; /* Release all mutexes, now that fork() has completed. */ @@ -5550,12 +5576,12 @@ _malloc_postfork(void) malloc_mutex_unlock(&base_mtx); - malloc_spin_lock(&arenas_lock); + memcpy(larenas, arenas, sizeof(arena_t *) * narenas); + malloc_spin_unlock(&arenas_lock); for (i = 0; i < narenas; i++) { - if (arenas[i] != NULL) - malloc_spin_unlock(&arenas[i]->lock); + if (larenas[i] != NULL) + malloc_spin_unlock(&larenas[i]->lock); } - malloc_spin_unlock(&arenas_lock); } /* From owner-svn-src-head@FreeBSD.ORG Mon Dec 1 11:21:09 2008 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3938C106567E; Mon, 1 Dec 2008 11:21:09 +0000 (UTC) (envelope-from des@des.no) Received: from tim.des.no (tim.des.no [194.63.250.121]) by mx1.freebsd.org (Postfix) with ESMTP id E650E8FC31; Mon, 1 Dec 2008 11:21:08 +0000 (UTC) (envelope-from des@des.no) Received: from ds4.des.no (des.no [84.49.246.2]) by smtp.des.no (Postfix) with ESMTP id EE30C6D43F; Mon, 1 Dec 2008 11:21:07 +0000 (UTC) Received: by ds4.des.no (Postfix, from userid 1001) id CECA8844A0; Mon, 1 Dec 2008 12:21:07 +0100 (CET) From: =?utf-8?Q?Dag-Erling_Sm=C3=B8rgrav?= To: Stanislav Sedov References: <200810311447.m9VElFtp083250@svn.freebsd.org> <20081101212937.D12448@delplex.bde.org> <20081201104920.4b001553.stas@FreeBSD.org> Date: Mon, 01 Dec 2008 12:21:07 +0100 In-Reply-To: <20081201104920.4b001553.stas@FreeBSD.org> (Stanislav Sedov's message of "Mon, 1 Dec 2008 10:49:20 +0300") Message-ID: <864p1orvj0.fsf@ds4.des.no> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (berkeley-unix) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Robert Watson , Bruce Evans Subject: Re: svn commit: r184509 - head/share/man/man9 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 01 Dec 2008 11:21:09 -0000 Stanislav Sedov writes: > What is the benefit of using a single error exit code which theoretically > can't say anything about the type of the error instead of probably cryptic > set of documented error coded that could be later decrypted and analyzed > at least? For me the code using named error codes looks much cleaner, and > as all exit codes >0 threated as error, it seems that using sysexits codes > should not hurt. Do we totally againast them from now, or these exit codes > still could be used? sysexits is actually nothing more than the documented exit codes for sendmail(8). Practically nothing else uses them, except procmail scripts, postfix filters and similar where you need to know if sendmail (or another MTA's drop-in replacement) succeeded - and even those usually only check for 75 (EX_TEMPFAIL). I think we have one or two utilities with documented exit codes other than 0 and 1. Everything else just returns "0 on success, and >0 if an error occurs"; we even have an mdoc macro (.Ex -std) for that exact phrase. DES --=20 Dag-Erling Sm=C3=B8rgrav - des@des.no From owner-svn-src-head@FreeBSD.ORG Mon Dec 1 11:25:07 2008 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5E05B1065677; Mon, 1 Dec 2008 11:25:07 +0000 (UTC) (envelope-from des@des.no) Received: from tim.des.no (tim.des.no [194.63.250.121]) by mx1.freebsd.org (Postfix) with ESMTP id 0D2488FC13; Mon, 1 Dec 2008 11:25:07 +0000 (UTC) (envelope-from des@des.no) Received: from ds4.des.no (des.no [84.49.246.2]) by smtp.des.no (Postfix) with ESMTP id 593A56D43F; Mon, 1 Dec 2008 11:25:06 +0000 (UTC) Received: by ds4.des.no (Postfix, from userid 1001) id 387D1844A0; Mon, 1 Dec 2008 12:25:06 +0100 (CET) From: =?utf-8?Q?Dag-Erling_Sm=C3=B8rgrav?= To: Tim Kientzle References: <200812010045.mB10jpmX007146@svn.freebsd.org> <49338E98.7020104@freebsd.org> Date: Mon, 01 Dec 2008 12:25:06 +0100 In-Reply-To: <49338E98.7020104@freebsd.org> (Tim Kientzle's message of "Sun, 30 Nov 2008 23:13:28 -0800") Message-ID: <863ah8rvcd.fsf@ds4.des.no> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (berkeley-unix) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, Alfred Perlstein , src-committers@freebsd.org Subject: Re: svn commit: r185499 - head X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 01 Dec 2008 11:25:07 -0000 Tim Kientzle writes: > Alfred Perlstein writes: > > Log: > > Provide a 'tinderbox' target that compiles enough of FreeBSD that > > a developer can rest reasonably assured that the tinderbox will not > > be broken. This target leverages most of 'universe' but will exit > > non-zero and output a summary at the end. > > "make tinderbox" > Excellent! I really don't see the point, especially now that 'make universe' will issue a warning on stdout for every build that fails. As I've tried to explain to Alfred, the tinderbox does nothing magical, and nothing that isn't already covered by 'make universe'. I also asked him to discuss any changes with Poul-Henning before committing them. > I seem to recall that the "real" tinderbox uses some slightly > different build options from "make universe." No, it doesn't. You can check for yourself - the complete command line and environment are included in the log file. From the latest amd64 build: TB --- 2008-12-01 07:01:04 - building world TB --- 2008-12-01 07:01:04 - MAKEOBJDIRPREFIX=3D/obj TB --- 2008-12-01 07:01:04 - PATH=3D/usr/bin:/usr/sbin:/bin:/sbin TB --- 2008-12-01 07:01:04 - TARGET=3Damd64 TB --- 2008-12-01 07:01:04 - TARGET_ARCH=3Damd64 TB --- 2008-12-01 07:01:04 - TZ=3DUTC TB --- 2008-12-01 07:01:04 - __MAKE_CONF=3D/dev/null TB --- 2008-12-01 07:01:04 - cd /src TB --- 2008-12-01 07:01:04 - /usr/bin/make -B buildworld DES --=20 Dag-Erling Sm=C3=B8rgrav - des@des.no From owner-svn-src-head@FreeBSD.ORG Mon Dec 1 13:25:55 2008 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 07DE61065675; Mon, 1 Dec 2008 13:25:55 +0000 (UTC) (envelope-from bright@elvis.mu.org) Received: from elvis.mu.org (elvis.mu.org [192.203.228.196]) by mx1.freebsd.org (Postfix) with ESMTP id E115B8FC12; Mon, 1 Dec 2008 13:25:54 +0000 (UTC) (envelope-from bright@elvis.mu.org) Received: by elvis.mu.org (Postfix, from userid 1192) id C7F5D1A3C36; Mon, 1 Dec 2008 05:25:54 -0800 (PST) Date: Mon, 1 Dec 2008 05:25:54 -0800 From: Alfred Perlstein To: Dag-Erling Sm??rgrav Message-ID: <20081201132554.GD27096@elvis.mu.org> References: <200812010045.mB10jpmX007146@svn.freebsd.org> <49338E98.7020104@freebsd.org> <863ah8rvcd.fsf@ds4.des.no> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <863ah8rvcd.fsf@ds4.des.no> User-Agent: Mutt/1.4.2.3i Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, Tim Kientzle , src-committers@freebsd.org Subject: Re: svn commit: r185499 - head X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 01 Dec 2008 13:25:55 -0000 * Dag-Erling Sm??rgrav [081201 03:25] wrote: > Tim Kientzle writes: > > Alfred Perlstein writes: > > > Log: > > > Provide a 'tinderbox' target that compiles enough of FreeBSD that > > > a developer can rest reasonably assured that the tinderbox will not > > > be broken. This target leverages most of 'universe' but will exit > > > non-zero and output a summary at the end. > > > "make tinderbox" > > Excellent! > > I really don't see the point, especially now that 'make universe' will > issue a warning on stdout for every build that fails. As I've tried to > explain to Alfred, the tinderbox does nothing magical, and nothing that > isn't already covered by 'make universe'. I also asked him to discuss > any changes with Poul-Henning before committing them. I'll summarize the changes here: Problems with make universe: 1) Make universe returns success on failure. 2) Make universe outputs the following on failure: -------------------------------------------------------------- make universe completed on `LC_ALL=C date`" (started ${STARTTIME})" -------------------------------------------------------------- This basically means you can't chain 'make universe' into something like "make tinderbox || (echo oops | mail -s tinderbox failed...)". The summary at the end "completed" is very misleading. The tinderbox target differs as follows: It returns an error if it fails. It outputs a summary of the failures at the end. The name reflects what its for. ("what the heck is a universe?") If you strongly believe that a target should return "true" on failure and/or output "i worked" on failure then I'm not sure how to approach that mindset, maybe you can help me understand where you're coming from on that? Where is the utility in it? Is there something I'm missing? thanks, -Alfred From owner-svn-src-head@FreeBSD.ORG Mon Dec 1 13:33:15 2008 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7FD31106567F; Mon, 1 Dec 2008 13:33:15 +0000 (UTC) (envelope-from bright@elvis.mu.org) Received: from elvis.mu.org (elvis.mu.org [192.203.228.196]) by mx1.freebsd.org (Postfix) with ESMTP id 686098FC2B; Mon, 1 Dec 2008 13:33:15 +0000 (UTC) (envelope-from bright@elvis.mu.org) Received: by elvis.mu.org (Postfix, from userid 1192) id 569451A3C3C; Mon, 1 Dec 2008 05:33:15 -0800 (PST) Date: Mon, 1 Dec 2008 05:33:15 -0800 From: Alfred Perlstein To: Tim Kientzle Message-ID: <20081201133315.GE27096@elvis.mu.org> References: <200812010045.mB10jpmX007146@svn.freebsd.org> <49338E98.7020104@freebsd.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <49338E98.7020104@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: r185499 - head X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 01 Dec 2008 13:33:15 -0000 * Tim Kientzle [081130 23:13] wrote: > Alfred Perlstein wrote: > >Author: alfred > >Date: Mon Dec 1 00:45:51 2008 > >New Revision: 185499 > >URL: http://svn.freebsd.org/changeset/base/185499 > > > >Log: > > Provide a 'tinderbox' target that compiles enough of FreeBSD that > > a developer can rest reasonably assured that the tinderbox will not > > be broken. This target leverages most of 'universe' but will exit > > non-zero and output a summary at the end. > > > > "make tinderbox" > > Excellent! > > I seem to recall that the "real" tinderbox uses > some slightly different build options from > "make universe." > > It would be nice to reconcile that. I'm hoping that DES will be forthcoming if such discrepancies exist so that we can reconcile them. Right now, from what I understand, he says that this is close enough to a tinderbox run to be useful. The only thing I didn't like was that it picks up all kernels sitting in my source tree. I should probably fix the 'tinderbox' target not to pick up my own kernels. Let me know what you think about that. -- - Alfred Perlstein From owner-svn-src-head@FreeBSD.ORG Mon Dec 1 13:35:05 2008 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CBB9F1065670; Mon, 1 Dec 2008 13:35:05 +0000 (UTC) (envelope-from des@des.no) Received: from tim.des.no (tim.des.no [194.63.250.121]) by mx1.freebsd.org (Postfix) with ESMTP id 7A67E8FC16; Mon, 1 Dec 2008 13:35:05 +0000 (UTC) (envelope-from des@des.no) Received: from ds4.des.no (des.no [84.49.246.2]) by smtp.des.no (Postfix) with ESMTP id CA4D16D449; Mon, 1 Dec 2008 13:35:04 +0000 (UTC) Received: by ds4.des.no (Postfix, from userid 1001) id B50ED84482; Mon, 1 Dec 2008 14:35:04 +0100 (CET) From: =?utf-8?Q?Dag-Erling_Sm=C3=B8rgrav?= To: Alfred Perlstein References: <200812010045.mB10jpmX007146@svn.freebsd.org> <49338E98.7020104@freebsd.org> <863ah8rvcd.fsf@ds4.des.no> <20081201132554.GD27096@elvis.mu.org> Date: Mon, 01 Dec 2008 14:35:04 +0100 In-Reply-To: <20081201132554.GD27096@elvis.mu.org> (Alfred Perlstein's message of "Mon, 1 Dec 2008 05:25:54 -0800") Message-ID: <863ah8qarb.fsf@ds4.des.no> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (berkeley-unix) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, Tim Kientzle , src-committers@freebsd.org Subject: Re: svn commit: r185499 - head X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 01 Dec 2008 13:35:05 -0000 Alfred Perlstein writes: > If you strongly believe that a target should return "true" on failure > and/or output "i worked" on failure I don't, and I don't understand why you think I do. I have stated very clearly that I don't like the universe target. > then I'm not sure how to approach > that mindset, maybe you can help me understand where you're coming from > on that? Where is the utility in it? Is there something I'm missing? You'll have to ask Poul-Henning, who wrote the universe target in the first place. DES --=20 Dag-Erling Sm=C3=B8rgrav - des@des.no From owner-svn-src-head@FreeBSD.ORG Mon Dec 1 13:40:34 2008 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A3DEE106564A; Mon, 1 Dec 2008 13:40:34 +0000 (UTC) (envelope-from phk@critter.freebsd.dk) Received: from phk.freebsd.dk (phk.freebsd.dk [130.225.244.222]) by mx1.freebsd.org (Postfix) with ESMTP id 0BC958FC14; Mon, 1 Dec 2008 13:40:34 +0000 (UTC) (envelope-from phk@critter.freebsd.dk) Received: from critter.freebsd.dk (unknown [192.168.61.3]) by phk.freebsd.dk (Postfix) with ESMTP id C6440170E5; Mon, 1 Dec 2008 13:40:32 +0000 (UTC) Received: from critter.freebsd.dk (localhost [127.0.0.1]) by critter.freebsd.dk (8.14.3/8.14.3) with ESMTP id mB1DeWFD083765; Mon, 1 Dec 2008 13:40:32 GMT (envelope-from phk@critter.freebsd.dk) To: =?utf-8?Q?Dag-Erling_Sm=C3=B8rgrav?= From: "Poul-Henning Kamp" In-Reply-To: Your message of "Mon, 01 Dec 2008 14:35:04 +0100." <863ah8qarb.fsf@ds4.des.no> Date: Mon, 01 Dec 2008 13:40:32 +0000 Message-ID: <83764.1228138832@critter.freebsd.dk> Sender: phk@critter.freebsd.dk Cc: svn-src-head@freebsd.org, Tim Kientzle , Alfred Perlstein , src-committers@freebsd.org, svn-src-all@freebsd.org Subject: Re: svn commit: r185499 - head X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 01 Dec 2008 13:40:34 -0000 In message <863ah8qarb.fsf@ds4.des.no>, =?utf-8?Q?Dag-Erling_Sm=C3=B8rgrav?= wr ites: >Alfred Perlstein writes: >> If you strongly believe that a target should return "true" on failure >> and/or output "i worked" on failure > >I don't, and I don't understand why you think I do. I have stated very >clearly that I don't like the universe target. I don't mind the universe target failing with the aggregate status code at the end, I have said that repeatedly. But I don't want it to stop working until it has tried compiling as much as possible. -- Poul-Henning Kamp | UNIX since Zilog Zeus 3.20 phk@FreeBSD.ORG | TCP/IP since RFC 956 FreeBSD committer | BSD since 4.3-tahoe Never attribute to malice what can adequately be explained by incompetence. From owner-svn-src-head@FreeBSD.ORG Mon Dec 1 13:58:07 2008 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0BCC1106579B; Mon, 1 Dec 2008 13:58:07 +0000 (UTC) (envelope-from phk@critter.freebsd.dk) Received: from phk.freebsd.dk (phk.freebsd.dk [130.225.244.222]) by mx1.freebsd.org (Postfix) with ESMTP id 4E8818FC17; Mon, 1 Dec 2008 13:58:06 +0000 (UTC) (envelope-from phk@critter.freebsd.dk) Received: from critter.freebsd.dk (unknown [192.168.61.3]) by phk.freebsd.dk (Postfix) with ESMTP id 429FB170EA; Mon, 1 Dec 2008 13:27:06 +0000 (UTC) Received: from critter.freebsd.dk (localhost [127.0.0.1]) by critter.freebsd.dk (8.14.3/8.14.3) with ESMTP id mB1DR5td083596; Mon, 1 Dec 2008 13:27:05 GMT (envelope-from phk@critter.freebsd.dk) To: Alfred Perlstein From: "Poul-Henning Kamp" In-Reply-To: Your message of "Mon, 01 Dec 2008 05:25:54 PST." <20081201132554.GD27096@elvis.mu.org> Date: Mon, 01 Dec 2008 13:27:05 +0000 Message-ID: <83595.1228138025@critter.freebsd.dk> Sender: phk@critter.freebsd.dk Cc: svn-src-head@freebsd.org, Dag-Erling Sm??rgrav , svn-src-all@freebsd.org, Tim Kientzle , src-committers@freebsd.org Subject: Re: svn commit: r185499 - head X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 01 Dec 2008 13:58:07 -0000 In message <20081201132554.GD27096@elvis.mu.org>, Alfred Perlstein writes: > The name reflects what its for. ("what the heck is a universe?") Something that contains all worlds. -- Poul-Henning Kamp | UNIX since Zilog Zeus 3.20 phk@FreeBSD.ORG | TCP/IP since RFC 956 FreeBSD committer | BSD since 4.3-tahoe Never attribute to malice what can adequately be explained by incompetence. From owner-svn-src-head@FreeBSD.ORG Mon Dec 1 14:13:07 2008 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7DE2B106567C; Mon, 1 Dec 2008 14:13:07 +0000 (UTC) (envelope-from bz@zabbadoz.net) Received: from mail.cksoft.de (mail.cksoft.de [62.111.66.27]) by mx1.freebsd.org (Postfix) with ESMTP id 94D508FC08; Mon, 1 Dec 2008 14:13:06 +0000 (UTC) (envelope-from bz@zabbadoz.net) Received: from localhost (amavis.str.cksoft.de [192.168.74.71]) by mail.cksoft.de (Postfix) with ESMTP id 0489441C6BB; Mon, 1 Dec 2008 14:55:06 +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 6eYEE6zC+gFm; Mon, 1 Dec 2008 14:55:05 +0100 (CET) Received: by mail.cksoft.de (Postfix, from userid 66) id 8714F41C6A1; Mon, 1 Dec 2008 14:55: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 4062D4448D5; Mon, 1 Dec 2008 13:54:49 +0000 (UTC) Date: Mon, 1 Dec 2008 13:54:49 +0000 (UTC) From: "Bjoern A. Zeeb" X-X-Sender: bz@maildrop.int.zabbadoz.net To: Alfred Perlstein In-Reply-To: <83764.1228138832@critter.freebsd.dk> Message-ID: <20081201134712.R80401@maildrop.int.zabbadoz.net> References: <83764.1228138832@critter.freebsd.dk> X-OpenPGP-Key: 0x14003F198FEFA3E77207EE8D2B58B8F83CCF1842 MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: svn-src-head@freebsd.org, Poul-Henning Kamp , src-committers@freebsd.org, svn-src-all@freebsd.org Subject: Re: svn commit: r185499 - head X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 01 Dec 2008 14:13:07 -0000 On Mon, 1 Dec 2008, Poul-Henning Kamp wrote: > In message <863ah8qarb.fsf@ds4.des.no>, =?utf-8?Q?Dag-Erling_Sm=C3=B8rgrav?= wr > ites: >> Alfred Perlstein writes: >>> If you strongly believe that a target should return "true" on failure >>> and/or output "i worked" on failure >> >> I don't, and I don't understand why you think I do. I have stated very >> clearly that I don't like the universe target. > > I don't mind the universe target failing with the aggregate status code > at the end, I have said that repeatedly. > > But I don't want it to stop working until it has tried compiling > as much as possible. so in case anyone with enough make foo can tell me why the initial echo "0" is not always (especially on a 2nd and further make universe run) executed, here's the patch for this: http://people.freebsd.org/~bz/make-universe.diff I especially had problems when I did make universe; rm _.*; make universe. When it comes to giving the tail of the build errors, I think it's really not usefull for several reasons: 1) if you have lots of build failures you lose the summary and the overview the next morning you resume your screen. 2) is it really make -jN clean? What does make do if there are less less jobs than told to do parallel builds for a universe? Once it starts to subdivide the jobs your build error is somewhere in your log but not necessarily at the end. If you want email notifications etc. go to projcvs and checkout the real tinderbox instead of overloading our base /Makefile. /bz -- Bjoern A. Zeeb Stop bit received. Insert coin for new game. From owner-svn-src-head@FreeBSD.ORG Mon Dec 1 14:15:11 2008 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id F36F8106567C; Mon, 1 Dec 2008 14:15:10 +0000 (UTC) (envelope-from kensmith@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C4DC68FC20; Mon, 1 Dec 2008 14:15:10 +0000 (UTC) (envelope-from kensmith@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mB1EFAZb026944; Mon, 1 Dec 2008 14:15:10 GMT (envelope-from kensmith@svn.freebsd.org) Received: (from kensmith@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mB1EFAWl026943; Mon, 1 Dec 2008 14:15:10 GMT (envelope-from kensmith@svn.freebsd.org) Message-Id: <200812011415.mB1EFAWl026943@svn.freebsd.org> From: Ken Smith Date: Mon, 1 Dec 2008 14:15: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: r185515 - head/sys/amd64 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 01 Dec 2008 14:15:11 -0000 Author: kensmith Date: Mon Dec 1 14:15:10 2008 New Revision: 185515 URL: http://svn.freebsd.org/changeset/base/185515 Log: Adjustments to make a tags file a bit more suitable to amd64. Reviewed by: peter Modified: head/sys/amd64/Makefile Modified: head/sys/amd64/Makefile ============================================================================== --- head/sys/amd64/Makefile Mon Dec 1 10:20:59 2008 (r185514) +++ head/sys/amd64/Makefile Mon Dec 1 14:15:10 2008 (r185515) @@ -1,39 +1,38 @@ # $FreeBSD$ # @(#)Makefile 8.1 (Berkeley) 6/11/93 -# Makefile for i386 links, tags file +# Makefile for amd64 links, tags file # SYS is normally set in Make.tags.inc -# SYS=/sys -SYS=/nsys +SYS=/sys -TAGDIR= i386 +TAGDIR= amd64 .include "../kern/Make.tags.inc" all: @echo "make links or tags only" -# Directories in which to place i386 tags links -DI386= apm i386 ibcs2 include isa linux +# Directories in which to place amd64 tags links +DAMD64= acpica amd64 ia32 include isa linux32 pci links:: -for i in ${COMMDIR1}; do \ (cd $$i && { rm -f tags; ln -s ../${TAGDIR}/tags tags; }) done -for i in ${COMMDIR2}; do \ (cd $$i && { rm -f tags; ln -s ../../${TAGDIR}/tags tags; }) done - -for i in ${DI386}; do \ + -for i in ${DAMD64}; do \ (cd $$i && { rm -f tags; ln -s ../tags tags; }) done -SI386= ${SYS}/i386/apm/*.[ch] \ - ${SYS}/i386/i386/*.[ch] ${SYS}/i386/ibcs2/*.[ch] \ - ${SYS}/i386/include/*.[ch] ${SYS}/i386/isa/*.[ch] \ - ${SYS}/i386/linux/*.[ch] -AI386= ${SYS}/i386/i386/*.s +SAMD64= ${SYS}/amd64/acpica/*.[ch] \ + ${SYS}/amd64/amd64/*.[ch] ${SYS}/amd64/ia32/*.[ch] \ + ${SYS}/amd64/include/*.[ch] ${SYS}/amd64/isa/*.[ch] \ + ${SYS}/amd64/linux32/*.[ch] ${SYS}/amd64/pci/*.[ch] +AAMD64= ${SYS}/amd64/amd64/*.S tags:: - -ctags -wdt ${COMM} ${SI386} - egrep "^ENTRY(.*)|^ALTENTRY(.*)" ${AI386} | \ + -ctags -wdt ${COMM} ${SAMD64} + egrep "^ENTRY(.*)|^ALTENTRY(.*)" ${AAMD64} | \ sed "s;\([^:]*\):\([^(]*\)(\([^, )]*\)\(.*\);\3 \1 /^\2(\3\4$$/;" \ >> tags sort -o tags tags From owner-svn-src-head@FreeBSD.ORG Mon Dec 1 14:33:35 2008 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 158131065675; Mon, 1 Dec 2008 14:33:35 +0000 (UTC) (envelope-from ru@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 00B368FC1D; Mon, 1 Dec 2008 14:33:35 +0000 (UTC) (envelope-from ru@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mB1EXYgn027386; Mon, 1 Dec 2008 14:33:34 GMT (envelope-from ru@svn.freebsd.org) Received: (from ru@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mB1EXYDD027385; Mon, 1 Dec 2008 14:33:34 GMT (envelope-from ru@svn.freebsd.org) Message-Id: <200812011433.mB1EXYDD027385@svn.freebsd.org> From: Ruslan Ermilov Date: Mon, 1 Dec 2008 14:33: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: r185516 - 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, 01 Dec 2008 14:33:35 -0000 Author: ru Date: Mon Dec 1 14:33:34 2008 New Revision: 185516 URL: http://svn.freebsd.org/changeset/base/185516 Log: Fix fread() to return a correct value on platforms where sizeof(int) != sizeof(size_t), i.e. on all 64-bit platforms. Reported by: Andrey V. Elsukov MFC after: 3 days Modified: head/lib/libc/stdio/fread.c Modified: head/lib/libc/stdio/fread.c ============================================================================== --- head/lib/libc/stdio/fread.c Mon Dec 1 14:15:10 2008 (r185515) +++ head/lib/libc/stdio/fread.c Mon Dec 1 14:33:34 2008 (r185516) @@ -50,7 +50,7 @@ __FBSDID("$FreeBSD$"); size_t fread(void * __restrict buf, size_t size, size_t count, FILE * __restrict fp) { - int ret; + size_t ret; FLOCKFILE(fp); ret = __fread(buf, size, count, fp); From owner-svn-src-head@FreeBSD.ORG Mon Dec 1 14:34:44 2008 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 069721065672; Mon, 1 Dec 2008 14:34:44 +0000 (UTC) (envelope-from kensmith@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 5ED268FC08; Mon, 1 Dec 2008 14:34:42 +0000 (UTC) (envelope-from kensmith@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mB1EYgYC027455; Mon, 1 Dec 2008 14:34:42 GMT (envelope-from kensmith@svn.freebsd.org) Received: (from kensmith@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mB1EYgVb027454; Mon, 1 Dec 2008 14:34:42 GMT (envelope-from kensmith@svn.freebsd.org) Message-Id: <200812011434.mB1EYgVb027454@svn.freebsd.org> From: Ken Smith Date: Mon, 1 Dec 2008 14:34: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: r185517 - 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, 01 Dec 2008 14:34:44 -0000 Author: kensmith Date: Mon Dec 1 14:34:42 2008 New Revision: 185517 URL: http://svn.freebsd.org/changeset/base/185517 Log: Catch up with the disappearance of sys/dev/hfa. Modified: head/sys/kern/Make.tags.inc Modified: head/sys/kern/Make.tags.inc ============================================================================== --- head/sys/kern/Make.tags.inc Mon Dec 1 14:33:34 2008 (r185516) +++ head/sys/kern/Make.tags.inc Mon Dec 1 14:34:42 2008 (r185517) @@ -16,7 +16,6 @@ COMM= ${SYS}/dev/advansys/*.[ch] \ ${SYS}/dev/buslogic/*.[ch] \ ${SYS}/dev/dpt/*.[ch] \ ${SYS}/dev/en/*.[ch] \ - ${SYS}/dev/hfa/*.[ch] \ ${SYS}/dev/iicbus/*.[ch] \ ${SYS}/dev/isp/*.[ch] \ ${SYS}/dev/pdq/*.[ch] \ From owner-svn-src-head@FreeBSD.ORG Mon Dec 1 15:02:00 2008 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id EE24D106567C; Mon, 1 Dec 2008 15:02:00 +0000 (UTC) (envelope-from ivoras@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D5F3D8FC0C; Mon, 1 Dec 2008 15:02:00 +0000 (UTC) (envelope-from ivoras@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mB1F20lW028196; Mon, 1 Dec 2008 15:02:00 GMT (envelope-from ivoras@svn.freebsd.org) Received: (from ivoras@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mB1F20Zi028195; Mon, 1 Dec 2008 15:02:00 GMT (envelope-from ivoras@svn.freebsd.org) Message-Id: <200812011502.mB1F20Zi028195@svn.freebsd.org> From: Ivan Voras Date: Mon, 1 Dec 2008 15:02: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: r185518 - head/sys/geom X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 01 Dec 2008 15:02:01 -0000 Author: ivoras Date: Mon Dec 1 15:02:00 2008 New Revision: 185518 URL: http://svn.freebsd.org/changeset/base/185518 Log: Trivial patch to show on which geom has the error been detected. Submitted by: Rick C. Petty Approved by: gnn (mentor) MFC after: 1 month Modified: head/sys/geom/geom_bsd.c Modified: head/sys/geom/geom_bsd.c ============================================================================== --- head/sys/geom/geom_bsd.c Mon Dec 1 14:34:42 2008 (r185517) +++ head/sys/geom/geom_bsd.c Mon Dec 1 15:02:00 2008 (r185518) @@ -136,7 +136,8 @@ g_bsd_modify(struct g_geom *gp, u_char * } if (rawoffset != 0 && (off_t)rawoffset != ms->mbroffset) - printf("WARNING: Expected rawoffset %jd, found %jd\n", + printf("WARNING: %s expected rawoffset %jd, found %jd\n", + gp->name, (intmax_t)ms->mbroffset/dl.d_secsize, (intmax_t)rawoffset/dl.d_secsize); From owner-svn-src-head@FreeBSD.ORG Mon Dec 1 15:27:02 2008 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 49E701065678; Mon, 1 Dec 2008 15:27:01 +0000 (UTC) (envelope-from keramida@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 344338FC1B; Mon, 1 Dec 2008 15:27:01 +0000 (UTC) (envelope-from keramida@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mB1FR1a8028956; Mon, 1 Dec 2008 15:27:01 GMT (envelope-from keramida@svn.freebsd.org) Received: (from keramida@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mB1FR1Hh028955; Mon, 1 Dec 2008 15:27:01 GMT (envelope-from keramida@svn.freebsd.org) Message-Id: <200812011527.mB1FR1Hh028955@svn.freebsd.org> From: Giorgos Keramidas Date: Mon, 1 Dec 2008 15:27: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: r185519 - 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: Mon, 01 Dec 2008 15:27:02 -0000 Author: keramida (doc committer) Date: Mon Dec 1 15:27:00 2008 New Revision: 185519 URL: http://svn.freebsd.org/changeset/base/185519 Log: The times(3) function returns the number of CLK_TCKs since the startup time of FreeBSD, not since the UNIX Epoch. PR: docs/122359 Submitted by: Viktor Štujber MFC after: 1 week Modified: head/lib/libc/gen/times.3 Modified: head/lib/libc/gen/times.3 ============================================================================== --- head/lib/libc/gen/times.3 Mon Dec 1 15:02:00 2008 (r185518) +++ head/lib/libc/gen/times.3 Mon Dec 1 15:27:00 2008 (r185519) @@ -28,7 +28,7 @@ .\" @(#)times.3 8.1 (Berkeley) 6/4/93 .\" $FreeBSD$ .\" -.Dd June 4, 1993 +.Dd December 1, 2008 .Dt TIMES 3 .Os .Sh NAME @@ -52,9 +52,13 @@ The .Fn times function returns the value of time in .Dv CLK_TCK Ns 's -of a second since -0 hours, 0 minutes, 0 seconds, January 1, 1970, Coordinated Universal -Time. +of a second since the system startup time. +The current value of +.Dv CLK_TCK , +the frequency of the statistics clock in ticks per second, may be +obtained through the +.Xr sysconf 3 +interface. .Pp It also fills in the structure pointed to by .Fa tp @@ -131,6 +135,7 @@ and .Xr getrusage 2 , .Xr gettimeofday 2 , .Xr wait 2 , +.Xr sysconf 3 , .Xr clocks 7 .Sh STANDARDS The From owner-svn-src-head@FreeBSD.ORG Mon Dec 1 16:43:08 2008 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DD2F01065673; Mon, 1 Dec 2008 16:43:08 +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 AEE928FC16; Mon, 1 Dec 2008 16:43:08 +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 mB1Gh8SH030875; Mon, 1 Dec 2008 16:43:08 GMT (envelope-from sam@svn.freebsd.org) Received: (from sam@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mB1Gh8o9030874; Mon, 1 Dec 2008 16:43:08 GMT (envelope-from sam@svn.freebsd.org) Message-Id: <200812011643.mB1Gh8o9030874@svn.freebsd.org> From: Sam Leffler Date: Mon, 1 Dec 2008 16:43: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: r185521 - head/sys/dev/ath/ath_hal X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 01 Dec 2008 16:43:09 -0000 Author: sam Date: Mon Dec 1 16:43:08 2008 New Revision: 185521 URL: http://svn.freebsd.org/changeset/base/185521 Log: import ath hal Added: head/sys/dev/ath/ath_hal/ - copied from r185520, projects/ath_hal/ From owner-svn-src-head@FreeBSD.ORG Mon Dec 1 16:53:03 2008 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8D9ED106564A; Mon, 1 Dec 2008 16:53:03 +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 749B68FC17; Mon, 1 Dec 2008 16:53:03 +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 mB1Gr3YV031163; Mon, 1 Dec 2008 16:53:03 GMT (envelope-from sam@svn.freebsd.org) Received: (from sam@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mB1Gr2Dv031130; Mon, 1 Dec 2008 16:53:02 GMT (envelope-from sam@svn.freebsd.org) Message-Id: <200812011653.mB1Gr2Dv031130@svn.freebsd.org> From: Sam Leffler Date: Mon, 1 Dec 2008 16:53: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: r185522 - in head: . share/man/man4 sys/amd64/conf sys/arm/conf sys/conf sys/contrib/dev/ath sys/dev/ath sys/dev/ath/ath_rate/amrr sys/dev/ath/ath_rate/onoe sys/dev/ath/ath_rate/sample ... X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 01 Dec 2008 16:53:03 -0000 Author: sam Date: Mon Dec 1 16:53:01 2008 New Revision: 185522 URL: http://svn.freebsd.org/changeset/base/185522 Log: Switch to ath hal source code. Note this removes the ath_hal module; the ath module now brings in the hal support. Kernel config files are almost backwards compatible; supplying device ath_hal gives you the same chip support that the binary hal did but you must also include options AH_SUPPORT_AR5416 to enable the extended format descriptors used by 11n parts. It is now possible to control the chip support included in a build by specifying exactly which chips are to be supported in the config file; consult ath_hal(4) for information. Deleted: head/sys/contrib/dev/ath/ head/sys/modules/ath_hal/ Modified: head/UPDATING head/share/man/man4/ath_hal.4 head/sys/amd64/conf/GENERIC head/sys/amd64/conf/NOTES head/sys/arm/conf/AVILA head/sys/conf/files head/sys/conf/files.amd64 head/sys/conf/files.arm head/sys/conf/files.i386 head/sys/conf/files.mips head/sys/conf/files.pc98 head/sys/conf/files.powerpc head/sys/conf/files.sparc64 head/sys/conf/kern.pre.mk head/sys/conf/options head/sys/dev/ath/ah_osdep.c head/sys/dev/ath/ah_osdep.h head/sys/dev/ath/ath_rate/amrr/amrr.c head/sys/dev/ath/ath_rate/onoe/onoe.c head/sys/dev/ath/ath_rate/sample/sample.c head/sys/dev/ath/if_ath.c head/sys/dev/ath/if_ath_pci.c head/sys/dev/ath/if_athvar.h head/sys/i386/conf/GENERIC head/sys/i386/conf/NOTES head/sys/i386/conf/PAE head/sys/mips/conf/IDT head/sys/mips/conf/SENTRY5 head/sys/modules/Makefile head/sys/modules/ath/Makefile head/sys/modules/ath_rate_amrr/Makefile head/sys/modules/ath_rate_onoe/Makefile head/sys/modules/ath_rate_sample/Makefile head/sys/pc98/conf/GENERIC head/sys/pc98/conf/NOTES head/sys/sparc64/conf/GENERIC head/sys/sys/param.h Modified: head/UPDATING ============================================================================== --- head/UPDATING Mon Dec 1 16:43:08 2008 (r185521) +++ head/UPDATING Mon Dec 1 16:53:01 2008 (r185522) @@ -22,6 +22,21 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 8. to maximize performance. (To disable malloc debugging, run ln -s aj /etc/malloc.conf.) +20081130: + __FreeBSD_version 800057 marks the switchover from the + binary ath hal to source code. Users must add the line: + + options ATH_SUPPORT_AR5416 + + to their kernel config files when specifying: + + device ath_hal + + The ath_hal module no longer exists; the code is now compiled + together with the driver in the ath module. It is now + possible to tailor chip support (i.e. reduce the set of chips + and thereby the code size); consult ath_hal(4) for details. + 20081121: __FreeBSD_version 800054 adds memory barriers to , new interfaces to ifnet to facilitate Modified: head/share/man/man4/ath_hal.4 ============================================================================== --- head/share/man/man4/ath_hal.4 Mon Dec 1 16:43:08 2008 (r185521) +++ head/share/man/man4/ath_hal.4 Mon Dec 1 16:53:01 2008 (r185522) @@ -1,5 +1,5 @@ .\"- -.\" Copyright (c) 2002, 2003 Sam Leffler, Errno Consulting +.\" Copyright (c) 2002-2008 Sam Leffler, Errno Consulting .\" All rights reserved. .\"" .\" Redistribution and use in source and binary forms, with or without @@ -12,9 +12,6 @@ .\" similar to the "NO WARRANTY" disclaimer below ("Disclaimer") and any .\" redistribution must be conditioned upon including a substantially .\" similar Disclaimer requirement for further binary redistribution. -.\" 3. Neither the names of the above-listed copyright holders nor the names -.\" of any contributors may be used to endorse or promote products derived -.\" from this software without specific prior written permission. .\" .\" NO WARRANTY .\" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS @@ -31,7 +28,7 @@ .\" .\" $FreeBSD$ .\"/ -.Dd August 26, 2004 +.Dd November 30, 2008 .Dt ATH_HAL 4 .Os .Sh NAME @@ -39,18 +36,44 @@ .Nd "Atheros Hardware Access Layer (HAL)" .Sh SYNOPSIS .Cd "device ath_hal" +.Cd "options AH_SUPPORT_AR5416" +or +.Cd "device ath_ar5210" +.Cd "device ath_ar5211" +.Cd "device ath_ar5212" +.Cd "device ath_rf2413" +.Cd "device ath_rf2417" +.Cd "device ath_rf2425" +.Cd "device ath_rf5111" +.Cd "device ath_rf5112" +.Cd "device ath_rf5413" +.Cd "device ath_ar5416" +.\".Cd "device ath_ar5312" +.\".Cd "device ath_rf2136" +.\".Cd "device ath_rf2137" +.Cd "device ath_ar9160" +.Cd "options AH_SUPPORT_AR5416" .Sh DESCRIPTION -The -.Nm -module provides hardware support for wireless network adapters based on -the Atheros AR5210, AR5211, and AR5212 chips. -This module is required by the +The hal provides hardware support for wireless network adapters based on +the Atheros AR5210, AR5211, AR5212, AR5416, and AR9160 chips. +This code is part of the .Xr ath 4 -driver. -.Pp -Devices supported by the +driver but configured separately to allow fine-grained control +over the set of chips supported. +Selecting .Nm -module come in either Cardbus or mini-PCI packages. +enables support for all PCI and Cardbus devices. +Note this includes AR5416 devices and must be accompanied by the +AH_SUPPORT_AR5416 +option to enable the extended hardware descriptor format used by +AR5416 and later devices. +.Pp +Devices supported come in either Cardbus or mini-PCI packages. +.Pp +Historically this code has been released in a binary-only form +and packaged as a separate module. +With the release of source code for the hal this is no longer true +and the code is tightly integrated with the driver. .Sh HARDWARE The following cards are among those supported by the .Nm @@ -105,16 +128,6 @@ The .Nm module first appeared in .Fx 5.2 . -.Sh CAVEATS -The -.Nm -module is constructed from a binary component and -operating system-dependent source code. -Redistribution and use in source and binary forms, without -modification, are permitted provided that the conditions -set forth in -.Pa sys/contrib/dev/ath/COPYRIGHT -are observed. .Sh BUGS See .Xr ath 4 Modified: head/sys/amd64/conf/GENERIC ============================================================================== --- head/sys/amd64/conf/GENERIC Mon Dec 1 16:43:08 2008 (r185521) +++ head/sys/amd64/conf/GENERIC Mon Dec 1 16:53:01 2008 (r185522) @@ -249,7 +249,8 @@ device wlan_tkip # 802.11 TKIP support device wlan_amrr # AMRR transmit rate control algorithm device an # Aironet 4500/4800 802.11 wireless NICs. device ath # Atheros pci/cardbus NIC's -device ath_hal # Atheros HAL (Hardware Access Layer) +device ath_hal # pci/cardbus chip support +options AH_SUPPORT_AR5416 # enable AR5416 tx/rx descriptors device ath_rate_sample # SampleRate tx rate control for ath device ral # Ralink Technology RT2500 wireless NICs. device wi # WaveLAN/Intersil/Symbol 802.11 wireless NICs. Modified: head/sys/amd64/conf/NOTES ============================================================================== --- head/sys/amd64/conf/NOTES Mon Dec 1 16:43:08 2008 (r185521) +++ head/sys/amd64/conf/NOTES Mon Dec 1 16:53:01 2008 (r185522) @@ -258,7 +258,6 @@ options DRM_DEBUG # Include debug print # Network interfaces: # -# ath: Atheros a/b/g WiFi adapters (requires ath_hal and wlan) # ed: Western Digital and SMC 80xx; Novell NE1000 and NE2000; 3Com 3C503 # HP PC Lan+, various PC Card devices # (requires miibus) @@ -284,12 +283,12 @@ device ral device ural device wpi -device ath -device ath_hal # Atheros HAL (includes binary component) -#device ath_rate_amrr # AMRR rate control for ath driver -#device ath_rate_onoe # Onoe rate control for ath driver -device ath_rate_sample # SampleRate rate control for the ath driver -#device wlan # 802.11 layer +device ath # Atheros pci/cardbus NIC's +device ath_hal # pci/cardbus chip support +options AH_SUPPORT_AR5416 # enable AR5416 tx/rx descriptors +device ath_rate_sample # SampleRate tx rate control for ath +#device ath_rate_amrr # AMRR rate control for ath driver +#device ath_rate_onoe # Onoe rate control for ath driver # #XXX this stores pointers in a 32bit field that is defined by the hardware Modified: head/sys/arm/conf/AVILA ============================================================================== --- head/sys/arm/conf/AVILA Mon Dec 1 16:43:08 2008 (r185521) +++ head/sys/arm/conf/AVILA Mon Dec 1 16:53:01 2008 (r185522) @@ -128,6 +128,7 @@ device wlan_tkip # 802.11 TKIP support device wlan_xauth device ath # Atheros pci/cardbus NIC's device ath_hal # Atheros HAL (Hardware Access Layer) +options AH_SUPPORT_AR5416 # enable AR5416 tx/rx descriptors device ath_rate_sample # SampleRate tx rate control for ath options ATH_DEBUG Modified: head/sys/conf/files ============================================================================== --- head/sys/conf/files Mon Dec 1 16:43:08 2008 (r185521) +++ head/sys/conf/files Mon Dec 1 16:53:01 2008 (r185522) @@ -503,18 +503,179 @@ dev/ata/atapi-fd.c optional atapifd dev/ata/atapi-tape.c optional atapist dev/ata/atapi-cam.c optional atapicam # -dev/ath/ah_osdep.c optional ath_hal \ +dev/ath/if_ath.c optional ath \ + compile-with "${NORMAL_C} -I$S/dev/ath" +dev/ath/if_ath_pci.c optional ath pci \ + compile-with "${NORMAL_C} -I$S/dev/ath" +dev/ath/ah_osdep.c optional ath \ + compile-with "${NORMAL_C} -I$S/dev/ath" +dev/ath/ath_hal/ah.c optional ath \ + compile-with "${NORMAL_C} -I$S/dev/ath" +dev/ath/ath_hal/ah_eeprom_v1.c optional ath_hal | ath_ar5210 \ + compile-with "${NORMAL_C} -I$S/dev/ath" +dev/ath/ath_hal/ah_eeprom_v3.c optional ath_hal | ath_ar5211 | ath_ar5212 \ compile-with "${NORMAL_C} -I$S/dev/ath" +dev/ath/ath_hal/ah_eeprom_v14.c optional ath_hal | ath_ar5416 | ath_ar9160 \ + compile-with "${NORMAL_C} -I$S/dev/ath" +dev/ath/ath_hal/ah_regdomain.c optional ath \ + compile-with "${NORMAL_C} -I$S/dev/ath" +dev/ath/ath_hal/ar5210/ar5210_attach.c optional ath_hal | ath_ar5210 \ + compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal" +dev/ath/ath_hal/ar5210/ar5210_beacon.c optional ath_hal | ath_ar5210 \ + compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal" +dev/ath/ath_hal/ar5210/ar5210_interrupts.c optional ath_hal | ath_ar5210 \ + compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal" +dev/ath/ath_hal/ar5210/ar5210_keycache.c optional ath_hal | ath_ar5210 \ + compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal" +dev/ath/ath_hal/ar5210/ar5210_misc.c optional ath_hal | ath_ar5210 \ + compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal" +dev/ath/ath_hal/ar5210/ar5210_phy.c optional ath_hal | ath_ar5210 \ + compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal" +dev/ath/ath_hal/ar5210/ar5210_power.c optional ath_hal | ath_ar5210 \ + compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal" +dev/ath/ath_hal/ar5210/ar5210_recv.c optional ath_hal | ath_ar5210 \ + compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal" +dev/ath/ath_hal/ar5210/ar5210_reset.c optional ath_hal | ath_ar5210 \ + compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal" +dev/ath/ath_hal/ar5210/ar5210_xmit.c optional ath_hal | ath_ar5210 \ + compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal" +dev/ath/ath_hal/ar5211/ar5211_attach.c optional ath_hal | ath_ar5211 \ + compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal" +dev/ath/ath_hal/ar5211/ar5211_beacon.c optional ath_hal | ath_ar5211 \ + compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal" +dev/ath/ath_hal/ar5211/ar5211_interrupts.c optional ath_hal | ath_ar5211 \ + compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal" +dev/ath/ath_hal/ar5211/ar5211_keycache.c optional ath_hal | ath_ar5211 \ + compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal" +dev/ath/ath_hal/ar5211/ar5211_misc.c optional ath_hal | ath_ar5211 \ + compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal" +dev/ath/ath_hal/ar5211/ar5211_phy.c optional ath_hal | ath_ar5211 \ + compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal" +dev/ath/ath_hal/ar5211/ar5211_power.c optional ath_hal | ath_ar5211 \ + compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal" +dev/ath/ath_hal/ar5211/ar5211_recv.c optional ath_hal | ath_ar5211 \ + compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal" +dev/ath/ath_hal/ar5211/ar5211_reset.c optional ath_hal | ath_ar5211 \ + compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal" +dev/ath/ath_hal/ar5211/ar5211_xmit.c optional ath_hal | ath_ar5211 \ + compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal" +dev/ath/ath_hal/ar5212/ar5212_ani.c \ + optional ath_hal | ath_ar5212 | ath_ar5416 | ath_ar9160 \ + compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal" +dev/ath/ath_hal/ar5212/ar5212_attach.c \ + optional ath_hal | ath_ar5212 | ath_ar5416 | ath_ar9160 \ + compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal" +dev/ath/ath_hal/ar5212/ar5212_beacon.c \ + optional ath_hal | ath_ar5212 | ath_ar5416 | ath_ar9160 \ + compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal" +dev/ath/ath_hal/ar5212/ar5212_eeprom.c \ + optional ath_hal | ath_ar5212 | ath_ar5416 | ath_ar9160 \ + compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal" +dev/ath/ath_hal/ar5212/ar5212_gpio.c \ + optional ath_hal | ath_ar5212 | ath_ar5416 | ath_ar9160 \ + compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal" +dev/ath/ath_hal/ar5212/ar5212_interrupts.c \ + optional ath_hal | ath_ar5212 | ath_ar5416 | ath_ar9160 \ + compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal" +dev/ath/ath_hal/ar5212/ar5212_keycache.c \ + optional ath_hal | ath_ar5212 | ath_ar5416 | ath_ar9160 \ + compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal" +dev/ath/ath_hal/ar5212/ar5212_misc.c \ + optional ath_hal | ath_ar5212 | ath_ar5416 | ath_ar9160 \ + compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal" +dev/ath/ath_hal/ar5212/ar5212_phy.c \ + optional ath_hal | ath_ar5212 | ath_ar5416 | ath_ar9160 \ + compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal" +dev/ath/ath_hal/ar5212/ar5212_power.c \ + optional ath_hal | ath_ar5212 | ath_ar5416 | ath_ar9160 \ + compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal" +dev/ath/ath_hal/ar5212/ar5212_recv.c \ + optional ath_hal | ath_ar5212 | ath_ar5416 | ath_ar9160 \ + compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal" +dev/ath/ath_hal/ar5212/ar5212_reset.c \ + optional ath_hal | ath_ar5212 | ath_ar5416 | ath_ar9160 \ + compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal" +dev/ath/ath_hal/ar5212/ar5212_rfgain.c \ + optional ath_hal | ath_ar5212 | ath_ar5416 | ath_ar9160 \ + compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal" +dev/ath/ath_hal/ar5212/ar5212_xmit.c \ + optional ath_hal | ath_ar5212 | ath_ar5416 | ath_ar9160 \ + compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal" +dev/ath/ath_hal/ar5212/ar2316.c optional ath_rf2316 \ + compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal" +dev/ath/ath_hal/ar5212/ar2317.c optional ath_rf2317 \ + compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal" +dev/ath/ath_hal/ar5212/ar2413.c optional ath_hal | ath_rf2413 \ + compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal" +dev/ath/ath_hal/ar5212/ar2425.c optional ath_hal | ath_rf2425 | ath_rf2417 \ + compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal" +dev/ath/ath_hal/ar5212/ar5111.c optional ath_hal | ath_rf5111 \ + compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal" +dev/ath/ath_hal/ar5212/ar5112.c optional ath_hal | ath_rf5112 \ + compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal" +dev/ath/ath_hal/ar5212/ar5413.c optional ath_hal | ath_rf5413 \ + compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal" +dev/ath/ath_hal/ar5416/ar2133.c optional ath_hal | ath_ar5416 | ath_ar9160 \ + compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal" +dev/ath/ath_hal/ar5416/ar5416_ani.c \ + optional ath_hal | ath_ar5416 | ath_ar9160 \ + compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal" +dev/ath/ath_hal/ar5416/ar5416_attach.c \ + optional ath_hal | ath_ar5416 | ath_ar9160 \ + compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal" +dev/ath/ath_hal/ar5416/ar5416_beacon.c \ + optional ath_hal | ath_ar5416 | ath_ar9160 \ + compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal" +dev/ath/ath_hal/ar5416/ar5416_cal.c \ + optional ath_hal | ath_ar5416 | ath_ar9160 \ + compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal" +dev/ath/ath_hal/ar5416/ar5416_cal_iq.c \ + optional ath_hal | ath_ar5416 | ath_ar9160 \ + compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal" +dev/ath/ath_hal/ar5416/ar5416_cal_adcgain.c \ + optional ath_hal | ath_ar5416 | ath_ar9160 \ + compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal" +dev/ath/ath_hal/ar5416/ar5416_cal_adcdc.c \ + optional ath_hal | ath_ar5416 | ath_ar9160 \ + compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal" +dev/ath/ath_hal/ar5416/ar5416_eeprom.c \ + optional ath_hal | ath_ar5416 | ath_ar9160 \ + compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal" +dev/ath/ath_hal/ar5416/ar5416_gpio.c \ + optional ath_hal | ath_ar5416 | ath_ar9160 \ + compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal" +dev/ath/ath_hal/ar5416/ar5416_interrupts.c \ + optional ath_hal | ath_ar5416 | ath_ar9160 \ + compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal" +dev/ath/ath_hal/ar5416/ar5416_keycache.c \ + optional ath_hal | ath_ar5416 | ath_ar9160 \ + compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal" +dev/ath/ath_hal/ar5416/ar5416_misc.c \ + optional ath_hal | ath_ar5416 | ath_ar9160 \ + compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal" +dev/ath/ath_hal/ar5416/ar5416_phy.c \ + optional ath_hal | ath_ar5416 | ath_ar9160 \ + compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal" +dev/ath/ath_hal/ar5416/ar5416_power.c \ + optional ath_hal | ath_ar5416 | ath_ar9160 \ + compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal" +dev/ath/ath_hal/ar5416/ar5416_recv.c \ + optional ath_hal | ath_ar5416 | ath_ar9160 \ + compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal" +dev/ath/ath_hal/ar5416/ar5416_reset.c \ + optional ath_hal | ath_ar5416 | ath_ar9160 \ + compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal" +dev/ath/ath_hal/ar5416/ar5416_xmit.c \ + optional ath_hal | ath_ar5416 | ath_ar9160 \ + compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal" +dev/ath/ath_hal/ar5416/ar9160_attach.c optional ath_hal | ath_ar9160 \ + compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal" dev/ath/ath_rate/amrr/amrr.c optional ath_rate_amrr \ compile-with "${NORMAL_C} -I$S/dev/ath" dev/ath/ath_rate/onoe/onoe.c optional ath_rate_onoe \ compile-with "${NORMAL_C} -I$S/dev/ath" dev/ath/ath_rate/sample/sample.c optional ath_rate_sample \ compile-with "${NORMAL_C} -I$S/dev/ath" -dev/ath/if_ath.c optional ath \ - compile-with "${NORMAL_C} -I$S/dev/ath" -dev/ath/if_ath_pci.c optional ath pci \ - compile-with "${NORMAL_C} -I$S/dev/ath" dev/bce/if_bce.c optional bce dev/bfe/if_bfe.c optional bfe dev/bge/if_bge.c optional bge Modified: head/sys/conf/files.amd64 ============================================================================== --- head/sys/conf/files.amd64 Mon Dec 1 16:43:08 2008 (r185521) +++ head/sys/conf/files.amd64 Mon Dec 1 16:53:01 2008 (r185522) @@ -47,16 +47,6 @@ ukbdmap.h optional ukbd_dflt_keymap \ no-obj no-implicit-rule before-depend \ clean "ukbdmap.h" # -hal.o optional ath_hal \ - dependency "$S/contrib/dev/ath/public/x86_64-elf.hal.o.uu" \ - compile-with "uudecode < $S/contrib/dev/ath/public/x86_64-elf.hal.o.uu" \ - no-implicit-rule -opt_ah.h optional ath_hal \ - dependency "$S/contrib/dev/ath/public/x86_64-elf.opt_ah.h" \ - compile-with "rm -f opt_ah.h; cp $S/contrib/dev/ath/public/x86_64-elf.opt_ah.h opt_ah.h" \ - no-obj no-implicit-rule before-depend \ - clean "opt_ah.h" -# nvenetlib.o optional nve pci \ dependency "$S/contrib/dev/nve/amd64/nvenetlib.o.bz2.uu" \ compile-with "uudecode $S/contrib/dev/nve/amd64/nvenetlib.o.bz2.uu ; bzip2 -df nvenetlib.o.bz2" \ Modified: head/sys/conf/files.arm ============================================================================== --- head/sys/conf/files.arm Mon Dec 1 16:43:08 2008 (r185521) +++ head/sys/conf/files.arm Mon Dec 1 16:53:01 2008 (r185522) @@ -51,13 +51,6 @@ geom/geom_bsd.c optional geom_bsd geom/geom_bsd_enc.c optional geom_bsd geom/geom_mbr.c optional geom_mbr geom/geom_mbr_enc.c optional geom_mbr -hal.o optional ath_hal \ - compile-with "ATH_HAL_CPU=`echo ${CONF_CFLAGS}|sed 's/.*-mcpu=\([a-zA-Z0-9]*\).*/\1/'`; ATH_ENDIAN=`if (echo ${CC}|grep mbig-endian>/dev/null); then echo be; else echo le; fi;`; uudecode < $S/contrib/dev/ath/public/$$ATH_HAL_CPU-$$ATH_ENDIAN-elf.hal.o.uu" \ - no-implicit-rule -opt_ah.h optional ath_hal \ - compile-with "ATH_HAL_CPU=`echo ${CONF_CFLAGS}|sed 's/.*-mcpu=\([a-zA-Z0-9]*\).*/\1/'`; ATH_ENDIAN=`if (echo ${CC}|grep mbig-endian>/dev/null); then echo be; else echo le; fi;`; rm -f opt_ah.h; cp $S/contrib/dev/ath/public/$$ATH_HAL_CPU-$$ATH_ENDIAN-elf.opt_ah.h opt_ah.h" \ - no-obj no-implicit-rule before-depend \ - clean "opt_ah.h" libkern/arm/divsi3.S standard libkern/arm/ffs.S standard libkern/arm/muldi3.c standard Modified: head/sys/conf/files.i386 ============================================================================== --- head/sys/conf/files.i386 Mon Dec 1 16:43:08 2008 (r185521) +++ head/sys/conf/files.i386 Mon Dec 1 16:53:01 2008 (r185522) @@ -46,16 +46,6 @@ ukbdmap.h optional ukbd_dflt_keymap \ no-obj no-implicit-rule before-depend \ clean "ukbdmap.h" # -hal.o optional ath_hal \ - dependency "$S/contrib/dev/ath/public/i386-elf.hal.o.uu" \ - compile-with "uudecode < $S/contrib/dev/ath/public/i386-elf.hal.o.uu" \ - no-implicit-rule -opt_ah.h optional ath_hal \ - dependency "$S/contrib/dev/ath/public/i386-elf.opt_ah.h" \ - compile-with "rm -f opt_ah.h; cp $S/contrib/dev/ath/public/i386-elf.opt_ah.h opt_ah.h" \ - no-obj no-implicit-rule before-depend \ - clean "opt_ah.h" -# nvenetlib.o optional nve pci \ dependency "$S/contrib/dev/nve/i386/nvenetlib.o.bz2.uu" \ compile-with "uudecode $S/contrib/dev/nve/i386/nvenetlib.o.bz2.uu ; bzip2 -df nvenetlib.o.bz2" \ Modified: head/sys/conf/files.mips ============================================================================== --- head/sys/conf/files.mips Mon Dec 1 16:43:08 2008 (r185521) +++ head/sys/conf/files.mips Mon Dec 1 16:53:01 2008 (r185522) @@ -75,13 +75,6 @@ geom/geom_bsd.c optional geom_bsd geom/geom_bsd_enc.c optional geom_bsd geom/geom_mbr.c optional geom_mbr geom/geom_mbr_enc.c optional geom_mbr -hal.o optional ath_hal \ - compile-with "ATH_HAL_CPU=mips; ATH_ENDIAN=`if ([ x${TARGET_BIG_ENDIAN} = x ]); then echo le; else echo be; fi;`; uudecode < $S/contrib/dev/ath/public/$$ATH_HAL_CPU-$$ATH_ENDIAN-elf.hal.o.uu" \ - no-implicit-rule -opt_ah.h optional ath_hal \ - compile-with "ATH_HAL_CPU=mips; ATH_ENDIAN=`if ([ x${TARGET_BIG_ENDIAN} = x ]); then echo le; else echo be; fi;`; rm -f opt_ah.h; cp $S/contrib/dev/ath/public/$$ATH_HAL_CPU-$$ATH_ENDIAN-elf.opt_ah.h opt_ah.h" \ - no-obj no-implicit-rule before-depend \ - clean "opt_ah.h" libkern/ashldi3.c standard libkern/ashrdi3.c standard libkern/divdi3.c standard Modified: head/sys/conf/files.pc98 ============================================================================== --- head/sys/conf/files.pc98 Mon Dec 1 16:43:08 2008 (r185521) +++ head/sys/conf/files.pc98 Mon Dec 1 16:53:01 2008 (r185522) @@ -38,16 +38,6 @@ ukbdmap.h optional ukbd_dflt_keymap \ no-obj no-implicit-rule before-depend \ clean "ukbdmap.h" # -hal.o optional ath_hal \ - dependency "$S/contrib/dev/ath/public/i386-elf.hal.o.uu" \ - compile-with "uudecode < $S/contrib/dev/ath/public/i386-elf.hal.o.uu" \ - no-implicit-rule -opt_ah.h optional ath_hal \ - dependency "$S/contrib/dev/ath/public/i386-elf.opt_ah.h" \ - compile-with "rm -f opt_ah.h; cp $S/contrib/dev/ath/public/i386-elf.opt_ah.h opt_ah.h" \ - no-obj no-implicit-rule before-depend \ - clean "opt_ah.h" -# compat/linprocfs/linprocfs.c optional linprocfs compat/linsysfs/linsysfs.c optional linsysfs compat/linux/linux_emul.c optional compat_linux Modified: head/sys/conf/files.powerpc ============================================================================== --- head/sys/conf/files.powerpc Mon Dec 1 16:43:08 2008 (r185521) +++ head/sys/conf/files.powerpc Mon Dec 1 16:53:01 2008 (r185522) @@ -14,16 +14,6 @@ font.h optional sc \ no-obj no-implicit-rule before-depend \ clean "font.h ${SC_DFLT_FONT}-8x14 ${SC_DFLT_FONT}-8x16 ${SC_DFLT_FONT}-8x8" # -hal.o optional ath_hal \ - dependency "$S/contrib/dev/ath/public/powerpc-be-elf.hal.o.uu" \ - compile-with "uudecode < $S/contrib/dev/ath/public/powerpc-be-elf.hal.o.uu" \ - no-implicit-rule -opt_ah.h optional ath_hal \ - dependency "$S/contrib/dev/ath/public/powerpc-be-elf.opt_ah.h" \ - compile-with "rm -f opt_ah.h; cp $S/contrib/dev/ath/public/powerpc-be-elf.opt_ah.h opt_ah.h" \ - no-obj no-implicit-rule before-depend \ - clean "opt_ah.h" -# crypto/blowfish/bf_enc.c optional crypto | ipsec crypto/des/des_enc.c optional crypto | ipsec | netsmb Modified: head/sys/conf/files.sparc64 ============================================================================== --- head/sys/conf/files.sparc64 Mon Dec 1 16:43:08 2008 (r185521) +++ head/sys/conf/files.sparc64 Mon Dec 1 16:53:01 2008 (r185522) @@ -22,16 +22,6 @@ ukbdmap.h optional ukbd_dflt_keymap \ no-obj no-implicit-rule before-depend \ clean "ukbdmap.h" # -hal.o optional ath_hal \ - dependency "$S/contrib/dev/ath/public/sparc64-be-elf.hal.o.uu" \ - compile-with "uudecode < $S/contrib/dev/ath/public/sparc64-be-elf.hal.o.uu" \ - no-implicit-rule -opt_ah.h optional ath_hal \ - dependency "$S/contrib/dev/ath/public/sparc64-be-elf.opt_ah.h" \ - compile-with "rm -f opt_ah.h; cp $S/contrib/dev/ath/public/sparc64-be-elf.opt_ah.h opt_ah.h" \ - no-obj no-implicit-rule before-depend \ - clean "opt_ah.h" -# crypto/blowfish/bf_enc.c optional crypto | ipsec crypto/des/des_enc.c optional crypto | ipsec | netsmb dev/atkbdc/atkbd.c optional atkbd atkbdc Modified: head/sys/conf/kern.pre.mk ============================================================================== --- head/sys/conf/kern.pre.mk Mon Dec 1 16:43:08 2008 (r185521) +++ head/sys/conf/kern.pre.mk Mon Dec 1 16:53:01 2008 (r185522) @@ -66,8 +66,8 @@ INCLUDES+= -I$S/contrib/ipfilter # ... and the same for pf INCLUDES+= -I$S/contrib/pf -# ... and the same for Atheros HAL -INCLUDES+= -I$S/dev/ath +# ... and the same for ath +INCLUDES+= -I$S/dev/ath -I$S/dev/ath/ath_hal # ... and the same for the NgATM stuff INCLUDES+= -I$S/contrib/ngatm Modified: head/sys/conf/options ============================================================================== --- head/sys/conf/options Mon Dec 1 16:43:08 2008 (r185521) +++ head/sys/conf/options Mon Dec 1 16:53:01 2008 (r185522) @@ -740,6 +740,21 @@ ATH_RXBUF opt_ath.h ATH_DIAGAPI opt_ath.h ATH_TX99_DIAG opt_ath.h +# options for the Atheros hal +AH_SUPPORT_AR5416 opt_ah.h + +AH_DEBUG opt_ah.h +AH_ASSERT opt_ah.h +AH_DEBUG_ALQ opt_ah.h +AH_REGOPS_FUNC opt_ah.h +AH_WRITE_REGDOMAIN opt_ah.h +AH_DEBUG_COUNTRY opt_ah.h +AH_WRITE_EEPROM opt_ah.h +AH_PRIVATE_DIAG opt_ah.h +AH_NEED_DESC_SWAP opt_ah.h +AH_USE_INIPDGAIN opt_ah.h +AH_SUPPORT_11D opt_ah.h + # options for the Marvell 8335 wireless driver MALO_DEBUG opt_malo.h MALO_TXBUF opt_malo.h Modified: head/sys/dev/ath/ah_osdep.c ============================================================================== --- head/sys/dev/ath/ah_osdep.c Mon Dec 1 16:43:08 2008 (r185521) +++ head/sys/dev/ath/ah_osdep.c Mon Dec 1 16:53:01 2008 (r185522) @@ -43,7 +43,7 @@ #include /* XXX for ether_sprintf */ -#include +#include /* * WiSoC boards overload the bus tag with information about the @@ -56,7 +56,7 @@ #define BUSTAG(ah) \ ((bus_space_tag_t) ((struct ar531x_config *)((ah)->ah_st))->tag) #else -#define BUSTAG(ah) ((bus_space_tag_t) (ah)->ah_st) +#define BUSTAG(ah) ((ah)->ah_st) #endif extern void ath_hal_printf(struct ath_hal *, const char*, ...) @@ -90,9 +90,6 @@ SYSCTL_INT(_hw_ath_hal, OID_AUTO, debug, TUNABLE_INT("hw.ath.hal.debug", &ath_hal_debug); #endif /* AH_DEBUG */ -SYSCTL_STRING(_hw_ath_hal, OID_AUTO, version, CTLFLAG_RD, ath_hal_version, 0, - "Atheros HAL version"); - /* NB: these are deprecated; they exist for now for compatibility */ int ath_hal_dma_beacon_response_time = 2; /* in TU's */ SYSCTL_INT(_hw_ath_hal, OID_AUTO, dma_brt, CTLFLAG_RW, @@ -195,7 +192,7 @@ HALDEBUGn(struct ath_hal *ah, u_int leve */ #include #include -#include +#include static struct alq *ath_hal_alq; static int ath_hal_alq_emitdev; /* need to emit DEVICE record */ @@ -273,7 +270,7 @@ void ath_hal_reg_write(struct ath_hal *ah, u_int32_t reg, u_int32_t val) { bus_space_tag_t tag = BUSTAG(ah); - bus_space_handle_t h = (bus_space_handle_t) ah->ah_sh; + bus_space_handle_t h = ah->ah_sh; if (ath_hal_alq) { struct ale *ale = ath_hal_alq_get(ah); @@ -297,7 +294,7 @@ u_int32_t ath_hal_reg_read(struct ath_hal *ah, u_int32_t reg) { bus_space_tag_t tag = BUSTAG(ah); - bus_space_handle_t h = (bus_space_handle_t) ah->ah_sh; + bus_space_handle_t h = ah->ah_sh; u_int32_t val; #if _BYTE_ORDER == _BIG_ENDIAN @@ -349,7 +346,7 @@ void ath_hal_reg_write(struct ath_hal *ah, u_int32_t reg, u_int32_t val) { bus_space_tag_t tag = BUSTAG(ah); - bus_space_handle_t h = (bus_space_handle_t) ah->ah_sh; + bus_space_handle_t h = ah->ah_sh; #if _BYTE_ORDER == _BIG_ENDIAN if (reg >= 0x4000 && reg < 0x5000) @@ -363,7 +360,7 @@ u_int32_t ath_hal_reg_read(struct ath_hal *ah, u_int32_t reg) { bus_space_tag_t tag = BUSTAG(ah); - bus_space_handle_t h = (bus_space_handle_t) ah->ah_sh; + bus_space_handle_t h = ah->ah_sh; u_int32_t val; #if _BYTE_ORDER == _BIG_ENDIAN @@ -415,37 +412,3 @@ ath_hal_memcpy(void *dst, const void *sr { return memcpy(dst, src, n); } - -/* - * Module glue. - */ - -static int -ath_hal_modevent(module_t mod, int type, void *unused) -{ - const char *sep; - int i; - - switch (type) { - case MOD_LOAD: - printf("ath_hal: %s (", ath_hal_version); - sep = ""; - for (i = 0; ath_hal_buildopts[i] != NULL; i++) { - printf("%s%s", sep, ath_hal_buildopts[i]); - sep = ", "; - } - printf(")\n"); - return 0; - case MOD_UNLOAD: - return 0; - } - return EINVAL; -} - -static moduledata_t ath_hal_mod = { - "ath_hal", - ath_hal_modevent, - 0 -}; -DECLARE_MODULE(ath_hal, ath_hal_mod, SI_SUB_DRIVERS, SI_ORDER_ANY); -MODULE_VERSION(ath_hal, 1); Modified: head/sys/dev/ath/ah_osdep.h ============================================================================== --- head/sys/dev/ath/ah_osdep.h Mon Dec 1 16:43:08 2008 (r185521) +++ head/sys/dev/ath/ah_osdep.h Mon Dec 1 16:53:01 2008 (r185522) @@ -33,13 +33,29 @@ /* * Atheros Hardware Access Layer (HAL) OS Dependent Definitions. */ +#include #include #include #include +#include #include /* + * Bus i/o type definitions. + */ +typedef void *HAL_SOFTC; +typedef bus_space_tag_t HAL_BUS_TAG; +typedef bus_space_handle_t HAL_BUS_HANDLE; + +/* + * Linker set writearounds for chip and RF backend registration. + */ +#define OS_DATA_SET(set, item) DATA_SET(set, item) +#define OS_SET_DECLARE(set, ptype) SET_DECLARE(set, ptype) +#define OS_SET_FOREACH(pvar, set) SET_FOREACH(pvar, set) + +/* * Delay n microseconds. */ extern void ath_hal_delay(int); Modified: head/sys/dev/ath/ath_rate/amrr/amrr.c ============================================================================== --- head/sys/dev/ath/ath_rate/amrr/amrr.c Mon Dec 1 16:43:08 2008 (r185521) +++ head/sys/dev/ath/ath_rate/amrr/amrr.c Mon Dec 1 16:53:01 2008 (r185522) @@ -78,7 +78,7 @@ __FBSDID("$FreeBSD$"); #include #include -#include +#include static int ath_rateinterval = 1000; /* rate ctl interval (ms) */ static int ath_rate_max_success_threshold = 10; Modified: head/sys/dev/ath/ath_rate/onoe/onoe.c ============================================================================== --- head/sys/dev/ath/ath_rate/onoe/onoe.c Mon Dec 1 16:43:08 2008 (r185521) +++ head/sys/dev/ath/ath_rate/onoe/onoe.c Mon Dec 1 16:53:01 2008 (r185522) @@ -67,7 +67,7 @@ __FBSDID("$FreeBSD$"); #include #include -#include +#include /* * Default parameters for the rate control algorithm. These are Modified: head/sys/dev/ath/ath_rate/sample/sample.c ============================================================================== --- head/sys/dev/ath/ath_rate/sample/sample.c Mon Dec 1 16:43:08 2008 (r185521) +++ head/sys/dev/ath/ath_rate/sample/sample.c Mon Dec 1 16:53:01 2008 (r185522) @@ -75,7 +75,7 @@ __FBSDID("$FreeBSD$"); #include #include -#include +#include /* * This file is an implementation of the SampleRate algorithm @@ -1018,5 +1018,4 @@ static moduledata_t sample_mod = { }; DECLARE_MODULE(ath_rate, sample_mod, SI_SUB_DRIVERS, SI_ORDER_FIRST); MODULE_VERSION(ath_rate, 1); -MODULE_DEPEND(ath_rate, ath_hal, 1, 1, 1); /* Atheros HAL */ MODULE_DEPEND(ath_rate, wlan, 1, 1, 1); Modified: head/sys/dev/ath/if_ath.c ============================================================================== --- head/sys/dev/ath/if_ath.c Mon Dec 1 16:43:08 2008 (r185521) +++ head/sys/dev/ath/if_ath.c Mon Dec 1 16:53:01 2008 (r185522) @@ -77,8 +77,7 @@ __FBSDID("$FreeBSD$"); #endif #include -#include -#include /* XXX for softled */ +#include /* XXX for softled */ #ifdef ATH_TX99_DIAG #include Modified: head/sys/dev/ath/if_ath_pci.c ============================================================================== --- head/sys/dev/ath/if_ath_pci.c Mon Dec 1 16:43:08 2008 (r185521) +++ head/sys/dev/ath/if_ath_pci.c Mon Dec 1 16:53:01 2008 (r185522) @@ -56,7 +56,6 @@ __FBSDID("$FreeBSD$"); #include #include -#include #include #include @@ -254,6 +253,5 @@ static devclass_t ath_devclass; DRIVER_MODULE(if_ath, pci, ath_pci_driver, ath_devclass, 0, 0); DRIVER_MODULE(if_ath, cardbus, ath_pci_driver, ath_devclass, 0, 0); MODULE_VERSION(if_ath, 1); -MODULE_DEPEND(if_ath, ath_hal, 1, 1, 1); /* Atheros HAL */ MODULE_DEPEND(if_ath, wlan, 1, 1, 1); /* 802.11 media layer */ MODULE_DEPEND(if_ath, ath_rate, 1, 1, 1); /* rate control algorithm */ Modified: head/sys/dev/ath/if_athvar.h ============================================================================== --- head/sys/dev/ath/if_athvar.h Mon Dec 1 16:43:08 2008 (r185521) +++ head/sys/dev/ath/if_athvar.h Mon Dec 1 16:53:01 2008 (r185522) @@ -35,8 +35,8 @@ #ifndef _DEV_ATH_ATHVAR_H #define _DEV_ATH_ATHVAR_H -#include -#include +#include +#include #include #include #include Modified: head/sys/i386/conf/GENERIC ============================================================================== --- head/sys/i386/conf/GENERIC Mon Dec 1 16:43:08 2008 (r185521) +++ head/sys/i386/conf/GENERIC Mon Dec 1 16:53:01 2008 (r185522) @@ -264,10 +264,11 @@ device wlan_tkip # 802.11 TKIP support device wlan_amrr # AMRR transmit rate control algorithm device an # Aironet 4500/4800 802.11 wireless NICs. device ath # Atheros pci/cardbus NIC's -device ath_hal # Atheros HAL (Hardware Access Layer) +device ath_hal # pci/cardbus chip support +options AH_SUPPORT_AR5416 # enable AR5416 tx/rx descriptors device ath_rate_sample # SampleRate tx rate control for ath device ral # Ralink Technology RT2500 wireless NICs. -device wi # WaveLAN/Intersil/Symbol 802.11 wireless NICs. +#device wi # WaveLAN/Intersil/Symbol 802.11 wireless NICs. #device wl # Older non 802.11 Wavelan wireless NIC. # Pseudo devices. Modified: head/sys/i386/conf/NOTES ============================================================================== --- head/sys/i386/conf/NOTES Mon Dec 1 16:43:08 2008 (r185521) +++ head/sys/i386/conf/NOTES Mon Dec 1 16:53:01 2008 (r185522) @@ -565,6 +565,20 @@ hint.ar.0.at="isa" hint.ar.0.port="0x300" hint.ar.0.irq="10" hint.ar.0.maddr="0xd0000" +device ath # Atheros pci/cardbus NIC's +device ath_hal # pci/cardbus chip support +#device ath_ar5210 # AR5210 chips +#device ath_ar5211 # AR5211 chips +#device ath_ar5212 # AR5212 chips +#device ath_rf2413 +#device ath_rf2417 +#device ath_rf2425 +#device ath_rf5111 +#device ath_rf5112 +#device ath_rf5413 +#device ath_ar5416 # AR5416 chips +options AH_SUPPORT_AR5416 # enable AR5416 tx/rx descriptors +device ath_rate_sample # SampleRate tx rate control for ath device ce device cp device cs @@ -617,13 +631,6 @@ options WLCACHE # enables the signal-s options WLDEBUG # enables verbose debugging output device wpi -device ath -device ath_hal # Atheros HAL (includes binary component) -#device ath_rate_amrr # AMRR rate control for ath driver -#device ath_rate_onoe # Onoe rate control for ath driver -device ath_rate_sample # SampleRate rate control for the ath driver -#device wlan # 802.11 layer - # # ATA raid adapters # Modified: head/sys/i386/conf/PAE ============================================================================== --- head/sys/i386/conf/PAE Mon Dec 1 16:43:08 2008 (r185521) +++ head/sys/i386/conf/PAE Mon Dec 1 16:53:01 2008 (r185522) @@ -78,7 +78,7 @@ nodevice xe nodevice an nodevice ath # Atheros pci/cardbus NIC's -nodevice ath_hal # Atheros HAL (Hardware Access Layer) +nodevice ath_hal nodevice ath_rate_sample # SampleRate tx rate control for ath nodevice ral nodevice wi Modified: head/sys/mips/conf/IDT ============================================================================== --- head/sys/mips/conf/IDT Mon Dec 1 16:43:08 2008 (r185521) +++ head/sys/mips/conf/IDT Mon Dec 1 16:53:01 2008 (r185522) @@ -44,7 +44,8 @@ device wlan # 802.11 support device wlan_wep # 802.11 WEP support device wlan_tkip # 802.11 TKIP support device ath # Atheros pci/cardbus NIC's -device ath_hal # Atheros HAL (Hardware Access Layer) +device ath_hal # pci/cardbus chip support +options AH_SUPPORT_AR5416 # enable AR5416 tx/rx descriptors device ath_rate_sample # SampleRate tx rate control for ath options ATH_DEBUG Modified: head/sys/mips/conf/SENTRY5 ============================================================================== --- head/sys/mips/conf/SENTRY5 Mon Dec 1 16:43:08 2008 (r185521) +++ head/sys/mips/conf/SENTRY5 Mon Dec 1 16:53:01 2008 (r185522) @@ -79,7 +79,8 @@ device miibus # attachments # pci devices # notyet: #device ath # in pci slot -#device ath_hal # in pci slot +#device ath_hal # pci chip support +#options AH_SUPPORT_AR5416 # enable AR5416 tx/rx descriptors device usb # USB Bus (required) device uhci # UHCI PCI->USB interface Modified: head/sys/modules/Makefile ============================================================================== --- head/sys/modules/Makefile Mon Dec 1 16:43:08 2008 (r185521) +++ head/sys/modules/Makefile Mon Dec 1 16:53:01 2008 (r185522) @@ -29,11 +29,10 @@ SUBDIR= ${_3dfx} \ ${_asmc} \ ${_asr} \ ata \ - ${_ath} \ - ${_ath_hal} \ - ${_ath_rate_amrr} \ - ${_ath_rate_onoe} \ - ${_ath_rate_sample} \ + ath \ + ath_rate_amrr \ + ath_rate_onoe \ + ath_rate_sample \ aue \ ${_auxio} \ axe \ @@ -376,11 +375,6 @@ _aout= aout _apm= apm _ar= ar _arcnet= arcnet -_ath= ath -_ath_hal= ath_hal -_ath_rate_amrr= ath_rate_amrr -_ath_rate_onoe= ath_rate_onoe -_ath_rate_sample=ath_rate_sample _bktr= bktr _cardbus= cardbus _cbb= cbb @@ -513,11 +507,6 @@ _agp= agp _an= an _arcmsr= arcmsr _asmc= asmc -_ath= ath -_ath_hal= ath_hal -_ath_rate_amrr= ath_rate_amrr -_ath_rate_onoe= ath_rate_onoe -_ath_rate_sample=ath_rate_sample _cardbus= cardbus _cbb= cbb _cmx= cmx @@ -625,11 +614,6 @@ _xe= xe .if ${MACHINE_ARCH} == "powerpc" _an= an -_ath= ath -_ath_hal= ath_hal -_ath_rate_amrr= ath_rate_amrr -_ath_rate_onoe= ath_rate_onoe -_ath_rate_sample=ath_rate_sample _bm= bm _nvram= powermac_nvram _smbfs= smbfs @@ -637,11 +621,6 @@ _upgt= upgt .endif .if ${MACHINE_ARCH} == "sparc64" -_ath= ath -_ath_hal= ath_hal -_ath_rate_amrr= ath_rate_amrr -_ath_rate_onoe= ath_rate_onoe -_ath_rate_sample=ath_rate_sample _auxio= auxio _em= em _i2c= i2c Modified: head/sys/modules/ath/Makefile ============================================================================== --- head/sys/modules/ath/Makefile Mon Dec 1 16:43:08 2008 (r185521) +++ head/sys/modules/ath/Makefile Mon Dec 1 16:53:01 2008 (r185522) @@ -1,5 +1,5 @@ # -# Copyright (c) 2002, 2003 Sam Leffler, Errno Consulting +# Copyright (c) 2002-2008 Sam Leffler, Errno Consulting # All rights reserved. # # Redistribution and use in source and binary forms, with or without @@ -12,13 +12,6 @@ # similar to the "NO WARRANTY" disclaimer below ("Disclaimer") and any # redistribution must be conditioned upon including a substantially # similar Disclaimer requirement for further binary redistribution. -# 3. Neither the names of the above-listed copyright holders nor the names -# of any contributors may be used to endorse or promote products derived -# from this software without specific prior written permission. -# -# Alternatively, this software may be distributed under the terms of the -# GNU General Public License ("GPL") version 2 as published by the Free -# Software Foundation. # # NO WARRANTY # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS @@ -36,30 +29,48 @@ # $FreeBSD$ # -.PATH: ${.CURDIR}/../../dev/ath +.PATH: ${.CURDIR}/../../dev/ath \ + ${.CURDIR}/../../dev/ath/ath_hal \ + ${.CURDIR}/../../dev/ath/ath_hal/ar5210 \ + ${.CURDIR}/../../dev/ath/ath_hal/ar5211 \ + ${.CURDIR}/../../dev/ath/ath_hal/ar5212 \ + ${.CURDIR}/../../dev/ath/ath_hal/ar5416 + +AR5210_SRCS=ah_eeprom_v1.c \ + ar5210_attach.c ar5210_beacon.c ar5210_interrupts.c \ + ar5210_keycache.c ar5210_misc.c ar5210_phy.c ar5210_power.c \ + ar5210_recv.c ar5210_reset.c ar5210_xmit.c +AR5211_SRCS=ar5211_attach.c ar5211_beacon.c ar5211_interrupts.c \ + ar5211_keycache.c ar5211_misc.c ar5211_phy.c ar5211_power.c \ + ar5211_recv.c ar5211_reset.c ar5211_xmit.c +AR5212_SRCS=ar5212_ani.c ar5212_attach.c ar5212_beacon.c ar5212_eeprom.c \ + ar5212_gpio.c ar5212_interrupts.c ar5212_keycache.c ar5212_misc.c \ + ar5212_phy.c ar5212_power.c ar5212_recv.c ar5212_reset.c \ + ar5212_rfgain.c ar5212_xmit.c \ + ar2413.c ar2425.c ar5111.c ar5112.c ar5413.c +AR5416_SRCS=ah_eeprom_v14.c \ + ar5416_ani.c ar5416_attach.c ar5416_beacon.c ar5416_cal.c \ + ar5416_cal_iq.c ar5416_cal_adcgain.c ar5416_cal_adcdc.c \ + ar5416_eeprom.c ar5416_gpio.c ar5416_interrupts.c ar5416_keycache.c \ + ar5416_misc.c ar5416_phy.c ar5416_power.c ar5416_recv.c \ + ar5416_reset.c ar5416_xmit.c \ + ar2133.c +AR9160_SRCS=ar9160_attach.c KMOD= if_ath SRCS= if_ath.c if_ath_pci.c -SRCS+= device_if.h bus_if.h pci_if.h opt_inet.h opt_ath.h opt_ah.h - -HAL= ${.CURDIR}/../../contrib/dev/ath -CFLAGS+= -I. -I${.CURDIR}/../../dev/ath -I${HAL} - -opt_ath.h: - echo > $@ +# NB: v3 eeprom support used by both AR5211 and AR5212; just include it +SRCS+= ah_osdep.c ah.c ah_regdomain.c ah_eeprom_v3.c +SRCS+= ${AR5210_SRCS} +SRCS+= ${AR5211_SRCS} +SRCS+= ${AR5212_SRCS} +SRCS+= ${AR5416_SRCS} +SRCS+= ${AR9160_SRCS} +SRCS+= device_if.h bus_if.h pci_if.h opt_inet.h opt_route.h opt_ath.h opt_ah.h -# patch for hal naming difference -.if ${MACHINE_ARCH} == "amd64" -ATH_MODULE_ARCH=x86_64 -.elif ${MACHINE_ARCH} == "sparc64" -ATH_MODULE_ARCH=sparc64-be -.elif ${MACHINE_ARCH} == "powerpc" -ATH_MODULE_ARCH=powerpc-be -.else -ATH_MODULE_ARCH=${MACHINE_ARCH} -.endif +CFLAGS+= -I. -I${.CURDIR}/../../dev/ath -I${.CURDIR}/../../dev/ath/ath_hal -opt_ah.h: ${HAL}/public/${ATH_MODULE_ARCH}-elf.opt_ah.h - cp ${HAL}/public/${ATH_MODULE_ARCH}-elf.opt_ah.h ${.TARGET} +opt_ah.h: + echo '#define AH_SUPPORT_AR5416 1' > $@ .include Modified: head/sys/modules/ath_rate_amrr/Makefile ============================================================================== --- head/sys/modules/ath_rate_amrr/Makefile Mon Dec 1 16:43:08 2008 (r185521) +++ head/sys/modules/ath_rate_amrr/Makefile Mon Dec 1 16:53:01 2008 (r185522) @@ -1,5 +1,5 @@ *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@FreeBSD.ORG Mon Dec 1 17:39:35 2008 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7B1491065673; Mon, 1 Dec 2008 17:39:35 +0000 (UTC) (envelope-from skv@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 65C8F8FC25; Mon, 1 Dec 2008 17:39:35 +0000 (UTC) (envelope-from skv@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mB1HdZaU032266; Mon, 1 Dec 2008 17:39:35 GMT (envelope-from skv@svn.freebsd.org) Received: (from skv@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mB1HdZmx032265; Mon, 1 Dec 2008 17:39:35 GMT (envelope-from skv@svn.freebsd.org) Message-Id: <200812011739.mB1HdZmx032265@svn.freebsd.org> From: Sergey Skvortsov Date: Mon, 1 Dec 2008 17:39: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: r185525 - head/usr.sbin/cron/crontab X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 01 Dec 2008 17:39:35 -0000 Author: skv (ports committer) Date: Mon Dec 1 17:39:34 2008 New Revision: 185525 URL: http://svn.freebsd.org/changeset/base/185525 Log: Fix typo. Approved by: ru Modified: head/usr.sbin/cron/crontab/crontab.5 Modified: head/usr.sbin/cron/crontab/crontab.5 ============================================================================== --- head/usr.sbin/cron/crontab/crontab.5 Mon Dec 1 17:29:41 2008 (r185524) +++ head/usr.sbin/cron/crontab/crontab.5 Mon Dec 1 17:39:34 2008 (r185525) @@ -118,7 +118,7 @@ is defined (and non-empty), mail is sent to the user so named. .Ev MAILTO may also be used to direct mail to multiple recipients -by seperating recipient users with a comma. +by separating recipient users with a comma. If .Ev MAILTO is defined but empty (MAILTO=""), no From owner-svn-src-head@FreeBSD.ORG Mon Dec 1 17:45:57 2008 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0ED31106564A; Mon, 1 Dec 2008 17:45:57 +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 ED9678FC16; Mon, 1 Dec 2008 17:45:56 +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 mB1Hju5a032511; Mon, 1 Dec 2008 17:45:56 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mB1HjuMG032510; Mon, 1 Dec 2008 17:45:56 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <200812011745.mB1HjuMG032510@svn.freebsd.org> From: Alexander Motin Date: Mon, 1 Dec 2008 17:45: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: r185527 - head/sys/dev/sdhci X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 01 Dec 2008 17:45:57 -0000 Author: mav Date: Mon Dec 1 17:45:56 2008 New Revision: 185527 URL: http://svn.freebsd.org/changeset/base/185527 Log: Add controller suspend/resume support. To be able to correctly suspend/resume with card inserted, respective support should be also implemented at mmc and mmcsd layers. Modified: head/sys/dev/sdhci/sdhci.c Modified: head/sys/dev/sdhci/sdhci.c ============================================================================== --- head/sys/dev/sdhci/sdhci.c Mon Dec 1 17:40:57 2008 (r185526) +++ head/sys/dev/sdhci/sdhci.c Mon Dec 1 17:45:56 2008 (r185527) @@ -802,6 +802,31 @@ sdhci_detach(device_t dev) } static int +sdhci_suspend(device_t dev) +{ + struct sdhci_softc *sc = device_get_softc(dev); + int i, err; + + err = bus_generic_suspend(dev); + if (err) + return (err); + for (i = 0; i < sc->num_slots; i++) + sdhci_reset(&sc->slots[i], SDHCI_RESET_ALL); + return (0); +} + +static int +sdhci_resume(device_t dev) +{ + struct sdhci_softc *sc = device_get_softc(dev); + int i; + + for (i = 0; i < sc->num_slots; i++) + sdhci_init(&sc->slots[i]); + return (bus_generic_resume(dev)); +} + +static int sdhci_update_ios(device_t brdev, device_t reqdev) { struct sdhci_slot *slot = device_get_ivars(reqdev); @@ -1508,6 +1533,8 @@ static device_method_t sdhci_methods[] = DEVMETHOD(device_probe, sdhci_probe), DEVMETHOD(device_attach, sdhci_attach), DEVMETHOD(device_detach, sdhci_detach), + DEVMETHOD(device_suspend, sdhci_suspend), + DEVMETHOD(device_resume, sdhci_resume), /* Bus interface */ DEVMETHOD(bus_read_ivar, sdhci_read_ivar), From owner-svn-src-head@FreeBSD.ORG Mon Dec 1 19:32:34 2008 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B41A21065670; Mon, 1 Dec 2008 19:32:34 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from server.baldwin.cx (bigknife-pt.tunnel.tserv9.chi1.ipv6.he.net [IPv6:2001:470:1f10:75::2]) by mx1.freebsd.org (Postfix) with ESMTP id 400AC8FC1E; Mon, 1 Dec 2008 19:32:34 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from localhost.corp.yahoo.com (john@localhost [IPv6:::1]) (authenticated bits=0) by server.baldwin.cx (8.14.3/8.14.3) with ESMTP id mB1JW7SW099801; Mon, 1 Dec 2008 14:32:28 -0500 (EST) (envelope-from jhb@freebsd.org) From: John Baldwin To: Konstantin Belousov Date: Mon, 1 Dec 2008 13:36:36 -0500 User-Agent: KMail/1.9.7 References: <200811221311.mAMDBBU8018510@svn.freebsd.org> In-Reply-To: <200811221311.mAMDBBU8018510@svn.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200812011336.37636.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH authentication, not delayed by milter-greylist-2.0.2 (server.baldwin.cx [IPv6:::1]); Mon, 01 Dec 2008 14:32:28 -0500 (EST) X-Virus-Scanned: ClamAV 0.93.1/8704/Mon Dec 1 11:39:36 2008 on server.baldwin.cx X-Virus-Status: Clean X-Spam-Status: No, score=-2.6 required=4.2 tests=AWL,BAYES_00,NO_RELAYS 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: r185170 - head/sys/ufs/ufs X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 01 Dec 2008 19:32:34 -0000 On Saturday 22 November 2008 08:11:11 am Konstantin Belousov wrote: > Author: kib > Date: Sat Nov 22 13:11:11 2008 > New Revision: 185170 > URL: http://svn.freebsd.org/changeset/base/185170 > > Log: > Busy ufs filesystem around block of code that does ".." lookup. Since > mnt_lock is before lock of any vnode on the mp, it uses LK_NOWAIT. Since > MNTK_UNMOUNT may be transient, pdp lock is dropped when vfs_busy() > failed, and operation is retried after some time. This way, ffs_vget() > is not called on the mp that may be in the process of being destroyed by > unmount. > > Check for the VI_DOOMED flag on pdp after its lock is reacquired, to > better detect some situations where directory containing ".." > entry is removed during the lookup. I'm not really sure it matters if the parent directory goes away because it will have deadfs vops so any subsequent operations will already fail, yes? Also, do you really need to grab the VI_LOCK just to check VI_DOOMED? Other places in the kernel check that flag while holding the vnode lock w/o acquiring the interlock. Since you are just doing a single atomic read the interlock doesn't actually close any races anyway. I think it just adds overhead. > Reviewed by: tegge, attilio (previous version) > Tested by: pho > MFC after: 1 month > > Modified: > head/sys/ufs/ufs/ufs_lookup.c > > Modified: head/sys/ufs/ufs/ufs_lookup.c > ============================================================================== > --- head/sys/ufs/ufs/ufs_lookup.c Sat Nov 22 12:36:15 2008 (r185169) > +++ head/sys/ufs/ufs/ufs_lookup.c Sat Nov 22 13:11:11 2008 (r185170) > @@ -157,6 +157,8 @@ ufs_lookup(ap) > int nameiop = cnp->cn_nameiop; > ino_t ino; > int ltype; > + int pdoomed; > + struct mount *mp; > > bp = NULL; > slotoffset = -1; > @@ -578,9 +580,32 @@ found: > pdp = vdp; > if (flags & ISDOTDOT) { > ltype = VOP_ISLOCKED(pdp); > + mp = pdp->v_mount; > + for (;;) { > + error = vfs_busy(mp, MBF_NOWAIT); > + if (error == 0) > + break; > + VOP_UNLOCK(pdp, 0); > + pause("ufs_dd", 1); > + vn_lock(pdp, ltype | LK_RETRY); > + VI_LOCK(pdp); > + pdoomed = pdp->v_iflag & VI_DOOMED; > + VI_UNLOCK(pdp); > + if (pdoomed) > + return (ENOENT); > + } > VOP_UNLOCK(pdp, 0); /* race to get the inode */ > - error = VFS_VGET(pdp->v_mount, ino, cnp->cn_lkflags, &tdp); > + error = VFS_VGET(mp, ino, cnp->cn_lkflags, &tdp); > + vfs_unbusy(mp); > vn_lock(pdp, ltype | LK_RETRY); > + VI_LOCK(pdp); > + pdoomed = pdp->v_iflag & VI_DOOMED; > + VI_UNLOCK(pdp); > + if (pdoomed) { > + if (error == 0) > + vput(tdp); > + error = ENOENT; > + } > if (error) > return (error); > *vpp = tdp; > -- John Baldwin From owner-svn-src-head@FreeBSD.ORG Mon Dec 1 19:32:40 2008 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8FD96106576F; Mon, 1 Dec 2008 19:32:40 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from server.baldwin.cx (bigknife-pt.tunnel.tserv9.chi1.ipv6.he.net [IPv6:2001:470:1f10:75::2]) by mx1.freebsd.org (Postfix) with ESMTP id 0DACB8FC1F; Mon, 1 Dec 2008 19:32:39 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from localhost.corp.yahoo.com (john@localhost [IPv6:::1]) (authenticated bits=0) by server.baldwin.cx (8.14.3/8.14.3) with ESMTP id mB1JW7SX099801; Mon, 1 Dec 2008 14:32:33 -0500 (EST) (envelope-from jhb@freebsd.org) From: John Baldwin To: Luigi Rizzo Date: Mon, 1 Dec 2008 13:58:15 -0500 User-Agent: KMail/1.9.7 References: <200811261801.mAQI1LRp062260@svn.freebsd.org> In-Reply-To: <200811261801.mAQI1LRp062260@svn.freebsd.org> MIME-Version: 1.0 Content-Disposition: inline Message-Id: <200812011358.15430.jhb@freebsd.org> Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-Greylist: Sender succeeded SMTP AUTH authentication, not delayed by milter-greylist-2.0.2 (server.baldwin.cx [IPv6:::1]); Mon, 01 Dec 2008 14:32:34 -0500 (EST) X-Virus-Scanned: ClamAV 0.93.1/8704/Mon Dec 1 11:39:36 2008 on server.baldwin.cx X-Virus-Status: Clean X-Spam-Status: No, score=-2.6 required=4.2 tests=AWL,BAYES_00,NO_RELAYS 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: r185339 - head/sys/boot/i386/boot0 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 01 Dec 2008 19:32:40 -0000 On Wednesday 26 November 2008 01:01:21 pm Luigi Rizzo wrote: > Author: luigi > Date: Wed Nov 26 18:01:21 2008 > New Revision: 185339 > URL: http://svn.freebsd.org/changeset/base/185339 > > Log: > Pass the pointer to the selected partition in %si to the next stage > boot code. The bug was introduced in rev.1.13, and went unnoticed > because FreeBSD's boot1 does not use it, but other systems might. > > (I have been struggling for almost a full day trying to figure out > why a syslinux'ed partition would not boot when started with the > FreeBSD /boot/boot0, only to realize that the bug was ours!) > > The space for the two extra bytes (push %si and pop %si) is reclaimed > by removing an extra CRLF that is printed before booting. > > The bug is not a major one but if there is time it might be a good > thing to merge it into the upcoming releases. Note that there is nothing (no standard, etc.) that requires any MBR boot loader to pass anything besides %dl (boot device ID) to other loaders. However, we did used to do this and had an 'XXX: what does %si carry?' comment that 1.13 removed. I would suggest adding a more expanded comment about '%si' in the block comment above this code where the old 'XXX' comment was detailing why %si is preserved. -- John Baldwin From owner-svn-src-head@FreeBSD.ORG Mon Dec 1 19:32:46 2008 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id AE1D8106564A; Mon, 1 Dec 2008 19:32:46 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from server.baldwin.cx (bigknife-pt.tunnel.tserv9.chi1.ipv6.he.net [IPv6:2001:470:1f10:75::2]) by mx1.freebsd.org (Postfix) with ESMTP id 3A1718FC2B; Mon, 1 Dec 2008 19:32:46 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from localhost.corp.yahoo.com (john@localhost [IPv6:::1]) (authenticated bits=0) by server.baldwin.cx (8.14.3/8.14.3) with ESMTP id mB1JW7SY099801; Mon, 1 Dec 2008 14:32:39 -0500 (EST) (envelope-from jhb@freebsd.org) From: John Baldwin To: Kostik Belousov Date: Mon, 1 Dec 2008 14:07:06 -0500 User-Agent: KMail/1.9.7 References: <200811220555.mAM5tuIJ007781@svn.freebsd.org> <3c1674c90811221651u338294frcdbd99b386733851@mail.gmail.com> <20081123154138.GS6408@deviant.kiev.zoral.com.ua> In-Reply-To: <20081123154138.GS6408@deviant.kiev.zoral.com.ua> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-15" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200812011407.06563.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH authentication, not delayed by milter-greylist-2.0.2 (server.baldwin.cx [IPv6:::1]); Mon, 01 Dec 2008 14:32:40 -0500 (EST) X-Virus-Scanned: ClamAV 0.93.1/8704/Mon Dec 1 11:39:36 2008 on server.baldwin.cx X-Virus-Status: Clean X-Spam-Status: No, score=-2.6 required=4.2 tests=AWL,BAYES_00,NO_RELAYS 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, Scott Long , src-committers@freebsd.org, Kip Macy Subject: Re: svn commit: r185162 - in head: . sys/amd64/include sys/arm/include sys/conf sys/dev/bce sys/dev/cxgb sys/dev/cxgb/sys sys/dev/cxgb/ulp/iw_cxgb sys/dev/mxge sys/dev/nxge sys/i386/include sys/i386/in... X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 01 Dec 2008 19:32:47 -0000 On Sunday 23 November 2008 10:41:38 am Kostik Belousov wrote: > On Sun, Nov 23, 2008 at 12:51:58AM +0000, Kip Macy wrote: > > On Sat, Nov 22, 2008 at 11:08 PM, Scott Long wrote: > > > Kostik Belousov wrote: > > >> > > >> On Sat, Nov 22, 2008 at 03:05:22PM -0700, Scott Long wrote: > > >>> > > >>> A neat hack would be for the kernel linker to scan the text and do a > > >>> drop-in replacement of the opcode that is appropriate for the platform. > > >>> I can't see how a CPU_XXX definition would work because it's just a > > >>> compile time construct, one that can be included with any kernel > > >>> compile. > > >> > > >> Yes, it is possible to do that. Less drastic change is to directly > > >> check features. I moved slow code to separate section to eliminate > > >> unconditional jump in fast path. > > >> Only compile-tested. > > >> > > > > > > As long as it works, I think it's a step in the right direction; I'm > > > assuming that cpu_feature is a symbol filled in at runtime and not a > > > macro for the cpuid instruction, right? > > > > > > Scott > > > > > > > i386/include/md_var.h: > > <..> > > extern u_int cpu_exthigh; > > extern u_int cpu_feature; > > extern u_int cpu_feature2; > > extern u_int amd_feature; > > extern u_int amd_feature2; > > <...> > > > > I'm not thrilled with it, but we can revisit the issue if it makes a > > measurable difference on someone's workload. > > Below is the updated patch. It includes changes made after private comments > by bde@ and uses symbolic definitions for the bits in the features words. > I thought about accessing a per-CPU word for serialized instruction in the > slow path, but decided that it does not beneficial.\ Is the branch really better than just doing what the atomic operations for mutexes, etc. do and just use 'lock addl $0,%esp' for a barrier in all cases on i386 and only bother with using the fancier instructions on amd64? Even amd64 doesn't use *fence yet for the atomic ops actually. I have had a patch to use it for years, but during testing there was no discernable difference between the existing 'lock addl' approach vs '*fence'. I'd much rather just use 486 code for all i386 machines than add a branch, esp. if the "optimization" the branch is doing isn't an actual optimization. -- John Baldwin From owner-svn-src-head@FreeBSD.ORG Mon Dec 1 21:00:25 2008 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C50FF10656E4; Mon, 1 Dec 2008 21:00:25 +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 B0E548FC1D; Mon, 1 Dec 2008 21:00:25 +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 mB1L0Puu037143; Mon, 1 Dec 2008 21:00:25 GMT (envelope-from kan@svn.freebsd.org) Received: (from kan@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mB1L0Pec037142; Mon, 1 Dec 2008 21:00:25 GMT (envelope-from kan@svn.freebsd.org) Message-Id: <200812012100.mB1L0Pec037142@svn.freebsd.org> From: Alexander Kabaev Date: Mon, 1 Dec 2008 21:00: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: r185531 - head/lib/libthr/thread X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 01 Dec 2008 21:00:25 -0000 Author: kan Date: Mon Dec 1 21:00:25 2008 New Revision: 185531 URL: http://svn.freebsd.org/changeset/base/185531 Log: Invoke _rtld_atfork_post earlier, before we reinitialize rtld locks by switching into single-thread mode. libthr ignores broken use of lock bitmaps used by default rtld locking implementation, this in turn turns lock handoff in _rtld_thread_init into NOP. This in turn makes child processes of forked multi-threaded programs to run with _thr_signal_block still in effect, with most signals blocked. Reported by: phk, kib Modified: head/lib/libthr/thread/thr_fork.c Modified: head/lib/libthr/thread/thr_fork.c ============================================================================== --- head/lib/libthr/thread/thr_fork.c Mon Dec 1 20:33:22 2008 (r185530) +++ head/lib/libthr/thread/thr_fork.c Mon Dec 1 21:00:25 2008 (r185531) @@ -158,6 +158,9 @@ _fork(void) /* clear other threads locked us. */ _thr_umutex_init(&curthread->lock); _thr_umutex_init(&_thr_atfork_lock); + + if (unlock_malloc) + _rtld_atfork_post(rtld_locks); _thr_setthreaded(0); /* reinitialize libc spinlocks. */ @@ -170,10 +173,8 @@ _fork(void) /* Ready to continue, unblock signals. */ _thr_signal_unblock(curthread); - if (unlock_malloc) { - _rtld_atfork_post(rtld_locks); + if (unlock_malloc) _malloc_postfork(); - } /* Run down atfork child handlers. */ TAILQ_FOREACH(af, &_thr_atfork_list, qe) { From owner-svn-src-head@FreeBSD.ORG Mon Dec 1 21:15:04 2008 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8BD481065672; Mon, 1 Dec 2008 21:15:04 +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 787698FC1C; Mon, 1 Dec 2008 21:15:04 +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 mB1LF4L6037502; Mon, 1 Dec 2008 21:15:04 GMT (envelope-from brueffer@svn.freebsd.org) Received: (from brueffer@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mB1LF4ps037501; Mon, 1 Dec 2008 21:15:04 GMT (envelope-from brueffer@svn.freebsd.org) Message-Id: <200812012115.mB1LF4ps037501@svn.freebsd.org> From: Christian Brueffer Date: Mon, 1 Dec 2008 21:15: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: r185532 - head/release/doc/en_US.ISO8859-1/hardware X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 01 Dec 2008 21:15:04 -0000 Author: brueffer Date: Mon Dec 1 21:15:04 2008 New Revision: 185532 URL: http://svn.freebsd.org/changeset/base/185532 Log: Add ixgbe(4) and upgt(4). Modified: head/release/doc/en_US.ISO8859-1/hardware/article.sgml Modified: head/release/doc/en_US.ISO8859-1/hardware/article.sgml ============================================================================== --- head/release/doc/en_US.ISO8859-1/hardware/article.sgml Mon Dec 1 21:00:25 2008 (r185531) +++ head/release/doc/en_US.ISO8859-1/hardware/article.sgml Mon Dec 1 21:15:04 2008 (r185532) @@ -712,6 +712,8 @@ &hwlist.ixgb; + &hwlist.ixgbe; + &hwlist.jme; &hwlist.kue; @@ -838,6 +840,8 @@ &hwlist.rum; + &hwlist.upgt; + &hwlist.ural; [&arch.amd64;, &arch.i386;, &arch.pc98;] Lucent From owner-svn-src-head@FreeBSD.ORG Mon Dec 1 21:32:23 2008 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 828111065707; Mon, 1 Dec 2008 21:32:23 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from mail.terabit.net.ua (mail.terabit.net.ua [195.137.202.147]) by mx1.freebsd.org (Postfix) with ESMTP id 164AB8FC0C; Mon, 1 Dec 2008 21:32:23 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from skuns.zoral.com.ua ([91.193.166.194] helo=mail.zoral.com.ua) by mail.terabit.net.ua with esmtps (TLSv1:AES256-SHA:256) (Exim 4.63 (FreeBSD)) (envelope-from ) id 1L7GNR-000AQ3-9g; Mon, 01 Dec 2008 23:32:21 +0200 Received: from deviant.kiev.zoral.com.ua (root@deviant.kiev.zoral.com.ua [10.1.1.148]) by mail.zoral.com.ua (8.14.2/8.14.2) with ESMTP id mB1LWINh096678 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Mon, 1 Dec 2008 23:32:18 +0200 (EET) (envelope-from kostikbel@gmail.com) Received: from deviant.kiev.zoral.com.ua (kostik@localhost [127.0.0.1]) by deviant.kiev.zoral.com.ua (8.14.3/8.14.3) with ESMTP id mB1LWHGG050969; Mon, 1 Dec 2008 23:32:17 +0200 (EET) (envelope-from kostikbel@gmail.com) Received: (from kostik@localhost) by deviant.kiev.zoral.com.ua (8.14.3/8.14.3/Submit) id mB1LWH70050967; Mon, 1 Dec 2008 23:32:17 +0200 (EET) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: deviant.kiev.zoral.com.ua: kostik set sender to kostikbel@gmail.com using -f Date: Mon, 1 Dec 2008 23:32:17 +0200 From: Kostik Belousov To: John Baldwin Message-ID: <20081201213217.GR3045@deviant.kiev.zoral.com.ua> References: <200811221311.mAMDBBU8018510@svn.freebsd.org> <200812011336.37636.jhb@freebsd.org> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="v4cNTr+tRGSs1txX" Content-Disposition: inline In-Reply-To: <200812011336.37636.jhb@freebsd.org> User-Agent: Mutt/1.4.2.3i X-Virus-Scanned: ClamAV version 0.93.3, clamav-milter version 0.93.3 on skuns.kiev.zoral.com.ua X-Virus-Status: Clean X-Spam-Status: No, score=-4.4 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00 autolearn=ham version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on skuns.kiev.zoral.com.ua X-Virus-Scanned: mail.terabit.net.ua 1L7GNR-000AQ3-9g e6ea09d767801372827fdea8673836b4 X-Terabit: YES Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r185170 - head/sys/ufs/ufs X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 01 Dec 2008 21:32:23 -0000 --v4cNTr+tRGSs1txX Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Mon, Dec 01, 2008 at 01:36:36PM -0500, John Baldwin wrote: > On Saturday 22 November 2008 08:11:11 am Konstantin Belousov wrote: > > Author: kib > > Date: Sat Nov 22 13:11:11 2008 > > New Revision: 185170 > > URL: http://svn.freebsd.org/changeset/base/185170 > >=20 > > Log: > > Busy ufs filesystem around block of code that does ".." lookup. Since > > mnt_lock is before lock of any vnode on the mp, it uses LK_NOWAIT. Si= nce > > MNTK_UNMOUNT may be transient, pdp lock is dropped when vfs_busy() > > failed, and operation is retried after some time. This way, ffs_vget() > > is not called on the mp that may be in the process of being destroyed= by > > unmount. > > =20 > > Check for the VI_DOOMED flag on pdp after its lock is reacquired, to > > better detect some situations where directory containing ".." > > entry is removed during the lookup. >=20 > I'm not really sure it matters if the parent directory goes away because = it=20 > will have deadfs vops so any subsequent operations will already fail, yes? Operations will fail. There is another race with parent directory being removed while pdp is unlocked. This can creep without tripping over deadfs operations for pdp. As Tor noted, the race may be considered as a security issue, allowing to escape the chroot. Check for reclamation cannot catch a move of pdp, this is why I specified the check as partial measure. >=20 > Also, do you really need to grab the VI_LOCK just to check VI_DOOMED? O= ther=20 > places in the kernel check that flag while holding the vnode lock w/o=20 > acquiring the interlock. Since you are just doing a single atomic read t= he=20 > interlock doesn't actually close any races anyway. I think it just adds= =20 > overhead. Yes, VI_DOOMED is set when both lock and interlock is held. I will remove interlock around the check. >=20 > > Reviewed by: tegge, attilio (previous version) > > Tested by: pho > > MFC after: 1 month > >=20 > > Modified: > > head/sys/ufs/ufs/ufs_lookup.c > >=20 > > Modified: head/sys/ufs/ufs/ufs_lookup.c > >=20 > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=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/ufs/ufs/ufs_lookup.c Sat Nov 22 12:36:15 2008 (r185169) > > +++ head/sys/ufs/ufs/ufs_lookup.c Sat Nov 22 13:11:11 2008 (r185170) > > @@ -157,6 +157,8 @@ ufs_lookup(ap) > > int nameiop =3D cnp->cn_nameiop; > > ino_t ino; > > int ltype; > > + int pdoomed; > > + struct mount *mp; > > =20 > > bp =3D NULL; > > slotoffset =3D -1; > > @@ -578,9 +580,32 @@ found: > > pdp =3D vdp; > > if (flags & ISDOTDOT) { > > ltype =3D VOP_ISLOCKED(pdp); > > + mp =3D pdp->v_mount; > > + for (;;) { > > + error =3D vfs_busy(mp, MBF_NOWAIT); > > + if (error =3D=3D 0) > > + break; > > + VOP_UNLOCK(pdp, 0); > > + pause("ufs_dd", 1); > > + vn_lock(pdp, ltype | LK_RETRY); > > + VI_LOCK(pdp); > > + pdoomed =3D pdp->v_iflag & VI_DOOMED; > > + VI_UNLOCK(pdp); > > + if (pdoomed) > > + return (ENOENT); > > + } > > VOP_UNLOCK(pdp, 0); /* race to get the inode */ > > - error =3D VFS_VGET(pdp->v_mount, ino, cnp->cn_lkflags, &tdp); > > + error =3D VFS_VGET(mp, ino, cnp->cn_lkflags, &tdp); > > + vfs_unbusy(mp); > > vn_lock(pdp, ltype | LK_RETRY); > > + VI_LOCK(pdp); > > + pdoomed =3D pdp->v_iflag & VI_DOOMED; > > + VI_UNLOCK(pdp); > > + if (pdoomed) { > > + if (error =3D=3D 0) > > + vput(tdp); > > + error =3D ENOENT; > > + } > > if (error) > > return (error); > > *vpp =3D tdp; > >=20 >=20 >=20 >=20 > --=20 > John Baldwin --v4cNTr+tRGSs1txX Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (FreeBSD) iEYEARECAAYFAkk0V+EACgkQC3+MBN1Mb4gTLgCgp1rQjMHM3kgoMCtr9z4rRZj3 WXcAmwTnDuAxe5QYEjvnKQArxRDdxOf0 =EIHL -----END PGP SIGNATURE----- --v4cNTr+tRGSs1txX-- From owner-svn-src-head@FreeBSD.ORG Mon Dec 1 21:42:25 2008 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B3BE71065678; Mon, 1 Dec 2008 21:42:25 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from mail.terabit.net.ua (mail.terabit.net.ua [195.137.202.147]) by mx1.freebsd.org (Postfix) with ESMTP id 3B17F8FC21; Mon, 1 Dec 2008 21:42:25 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from skuns.zoral.com.ua ([91.193.166.194] helo=mail.zoral.com.ua) by mail.terabit.net.ua with esmtps (TLSv1:AES256-SHA:256) (Exim 4.63 (FreeBSD)) (envelope-from ) id 1L7GX9-000B08-67; Mon, 01 Dec 2008 23:42:23 +0200 Received: from deviant.kiev.zoral.com.ua (root@deviant.kiev.zoral.com.ua [10.1.1.148]) by mail.zoral.com.ua (8.14.2/8.14.2) with ESMTP id mB1LgI4B097442 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Mon, 1 Dec 2008 23:42:18 +0200 (EET) (envelope-from kostikbel@gmail.com) Received: from deviant.kiev.zoral.com.ua (kostik@localhost [127.0.0.1]) by deviant.kiev.zoral.com.ua (8.14.3/8.14.3) with ESMTP id mB1LgIAh052131; Mon, 1 Dec 2008 23:42:18 +0200 (EET) (envelope-from kostikbel@gmail.com) Received: (from kostik@localhost) by deviant.kiev.zoral.com.ua (8.14.3/8.14.3/Submit) id mB1LgHEq052128; Mon, 1 Dec 2008 23:42:17 +0200 (EET) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: deviant.kiev.zoral.com.ua: kostik set sender to kostikbel@gmail.com using -f Date: Mon, 1 Dec 2008 23:42:17 +0200 From: Kostik Belousov To: John Baldwin Message-ID: <20081201214217.GS3045@deviant.kiev.zoral.com.ua> References: <200811220555.mAM5tuIJ007781@svn.freebsd.org> <3c1674c90811221651u338294frcdbd99b386733851@mail.gmail.com> <20081123154138.GS6408@deviant.kiev.zoral.com.ua> <200812011407.06563.jhb@freebsd.org> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="XMM+kVNHGkMezEqK" Content-Disposition: inline In-Reply-To: <200812011407.06563.jhb@freebsd.org> User-Agent: Mutt/1.4.2.3i X-Virus-Scanned: ClamAV version 0.93.3, clamav-milter version 0.93.3 on skuns.kiev.zoral.com.ua X-Virus-Status: Clean X-Spam-Status: No, score=-4.4 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00 autolearn=ham version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on skuns.kiev.zoral.com.ua X-Virus-Scanned: mail.terabit.net.ua 1L7GX9-000B08-67 79baff43112709b25938c8abce0361ff X-Terabit: YES Cc: Scott Long , src-committers@freebsd.org, Kip Macy , svn-src-all@freebsd.org, jfv@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r185162 - in head: . sys/amd64/include sys/arm/include sys/conf sys/dev/bce sys/dev/cxgb sys/dev/cxgb/sys sys/dev/cxgb/ulp/iw_cxgb sys/dev/mxge sys/dev/nxge sys/i386/include sys/i386/in... X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 01 Dec 2008 21:42:25 -0000 --XMM+kVNHGkMezEqK Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Mon, Dec 01, 2008 at 02:07:06PM -0500, John Baldwin wrote: > On Sunday 23 November 2008 10:41:38 am Kostik Belousov wrote: > > On Sun, Nov 23, 2008 at 12:51:58AM +0000, Kip Macy wrote: > > > On Sat, Nov 22, 2008 at 11:08 PM, Scott Long wrot= e: > > > > Kostik Belousov wrote: > > > >> > > > >> On Sat, Nov 22, 2008 at 03:05:22PM -0700, Scott Long wrote: > > > >>> > > > >>> A neat hack would be for the kernel linker to scan the text and d= o a > > > >>> drop-in replacement of the opcode that is appropriate for the=20 > platform. > > > >>> I can't see how a CPU_XXX definition would work because it's just= a > > > >>> compile time construct, one that can be included with any kernel > > > >>> compile. > > > >> > > > >> Yes, it is possible to do that. Less drastic change is to directly > > > >> check features. I moved slow code to separate section to eliminate > > > >> unconditional jump in fast path. > > > >> Only compile-tested. > > > >> > > > > > > > > As long as it works, I think it's a step in the right direction; I'm > > > > assuming that cpu_feature is a symbol filled in at runtime and not a > > > > macro for the cpuid instruction, right? > > > > > > > > Scott > > > > > > >=20 > > > i386/include/md_var.h: > > > <..> > > > extern u_int cpu_exthigh; > > > extern u_int cpu_feature; > > > extern u_int cpu_feature2; > > > extern u_int amd_feature; > > > extern u_int amd_feature2; > > > <...> > > >=20 > > > I'm not thrilled with it, but we can revisit the issue if it makes a > > > measurable difference on someone's workload. > >=20 > > Below is the updated patch. It includes changes made after private comm= ents > > by bde@ and uses symbolic definitions for the bits in the features word= s. > > I thought about accessing a per-CPU word for serialized instruction in = the > > slow path, but decided that it does not beneficial.\ >=20 > Is the branch really better than just doing what the atomic operations fo= r=20 > mutexes, etc. do and just use 'lock addl $0,%esp' for a barrier in all ca= ses=20 > on i386 and only bother with using the fancier instructions on amd64? Ev= en=20 > amd64 doesn't use *fence yet for the atomic ops actually. I have had a p= atch=20 > to use it for years, but during testing there was no discernable differen= ce=20 > between the existing 'lock addl' approach vs '*fence'. I'd much rather j= ust=20 > use 486 code for all i386 machines than add a branch, esp. if=20 > the "optimization" the branch is doing isn't an actual optimization. I do not insist. The branch is done only for arches that has no fence instructions. The section for the slow code is put after the main text, that should, according to Intel documentation, be predicted as not taken for the first execution. For reference, below is the latest version of the patch. I postponed the commit, in particular, because it touches ixgb, and Jack did not responded. diff --git a/sys/conf/ldscript.i386 b/sys/conf/ldscript.i386 index a94f32f..49d9636 100644 --- a/sys/conf/ldscript.i386 +++ b/sys/conf/ldscript.i386 @@ -45,6 +45,7 @@ SECTIONS .text : { *(.text) + *(.text.offpath) *(.stub) /* .gnu.warning sections are handled specially by elf32.em. */ *(.gnu.warning) diff --git a/sys/dev/iir/iir.c b/sys/dev/iir/iir.c index cbcb449..a01b685 100644 --- a/sys/dev/iir/iir.c +++ b/sys/dev/iir/iir.c @@ -403,7 +403,7 @@ iir_init(struct gdt_softc *gdt) gdt->oem_name[7]=3D'\0'; } else { /* Old method, based on PCI ID */ - if (gdt->sc_vendor =3D=3D INTEL_VENDOR_ID) + if (gdt->sc_vendor =3D=3D INTEL_VENDOR_ID_IIR) strcpy(gdt->oem_name,"Intel "); else=20 strcpy(gdt->oem_name,"ICP "); @@ -1447,7 +1447,7 @@ iir_action( struct cam_sim *sim, union ccb *ccb ) (bus =3D=3D gdt->sc_virt_bus ? 127 : gdt->sc_bus_id[bus]= ); cpi->base_transfer_speed =3D 3300; strncpy(cpi->sim_vid, "FreeBSD", SIM_IDLEN); - if (gdt->sc_vendor =3D=3D INTEL_VENDOR_ID) + if (gdt->sc_vendor =3D=3D INTEL_VENDOR_ID_IIR) strncpy(cpi->hba_vid, "Intel Corp.", HBA_IDLEN); else strncpy(cpi->hba_vid, "ICP vortex ", HBA_IDLEN); diff --git a/sys/dev/iir/iir.h b/sys/dev/iir/iir.h index dca493d..dbae7d2 100644 --- a/sys/dev/iir/iir.h +++ b/sys/dev/iir/iir.h @@ -63,7 +63,7 @@ #define GDT_DEVICE_ID_MAX 0x2ff #define GDT_DEVICE_ID_NEWRX 0x300 =20 -#define INTEL_VENDOR_ID 0x8086 +#define INTEL_VENDOR_ID_IIR 0x8086 #define INTEL_DEVICE_ID_IIR 0x600 =20 #define GDT_MAXBUS 6 /* XXX Why not 5? */ diff --git a/sys/dev/iir/iir_ctrl.c b/sys/dev/iir/iir_ctrl.c index e5fbac9..2af2aad 100644 --- a/sys/dev/iir/iir_ctrl.c +++ b/sys/dev/iir/iir_ctrl.c @@ -278,7 +278,7 @@ iir_ioctl(struct cdev *dev, u_long cmd, caddr_t cmdarg,= int flags, d_thread_t * return (ENXIO); /* only RP controllers */ p->ext_type =3D 0x6000 | gdt->sc_device; - if (gdt->sc_vendor =3D=3D INTEL_VENDOR_ID) { + if (gdt->sc_vendor =3D=3D INTEL_VENDOR_ID_IIR) { p->oem_id =3D OEM_ID_INTEL; p->type =3D 0xfd; /* new -> subdevice into ext_type */ diff --git a/sys/dev/iir/iir_pci.c b/sys/dev/iir/iir_pci.c index 528b7d7..0f420a1 100644 --- a/sys/dev/iir/iir_pci.c +++ b/sys/dev/iir/iir_pci.c @@ -164,7 +164,7 @@ MODULE_DEPEND(iir, cam, 1, 1, 1); static int iir_pci_probe(device_t dev) { - if (pci_get_vendor(dev) =3D=3D INTEL_VENDOR_ID && + if (pci_get_vendor(dev) =3D=3D INTEL_VENDOR_ID_IIR && pci_get_device(dev) =3D=3D INTEL_DEVICE_ID_IIR) { device_set_desc(dev, "Intel Integrated RAID Controller"); return (BUS_PROBE_DEFAULT); diff --git a/sys/dev/ixgb/if_ixgb.c b/sys/dev/ixgb/if_ixgb.c index c1d6858..df2f51a 100644 --- a/sys/dev/ixgb/if_ixgb.c +++ b/sys/dev/ixgb/if_ixgb.c @@ -72,8 +72,8 @@ char ixgb_copyright[] =3D "Copyright (c) 2001-= 2004 Intel Corporation."; static ixgb_vendor_info_t ixgb_vendor_info_array[] =3D { /* Intel(R) PRO/10000 Network Connection */ - {INTEL_VENDOR_ID, IXGB_DEVICE_ID_82597EX, PCI_ANY_ID, PCI_ANY_ID, 0}, - {INTEL_VENDOR_ID, IXGB_DEVICE_ID_82597EX_SR, PCI_ANY_ID, PCI_ANY_ID, 0}, + {INTEL_VENDOR_ID_IXGB, IXGB_DEVICE_ID_82597EX, PCI_ANY_ID, PCI_ANY_ID, 0}, + {INTEL_VENDOR_ID_IXGB, IXGB_DEVICE_ID_82597EX_SR, PCI_ANY_ID, PCI_ANY_ID,= 0}, /* required last entry */ {0, 0, 0, 0, 0} }; diff --git a/sys/dev/ixgb/ixgb_ids.h b/sys/dev/ixgb/ixgb_ids.h index a224f63..aa7dab8 100644 --- a/sys/dev/ixgb/ixgb_ids.h +++ b/sys/dev/ixgb/ixgb_ids.h @@ -40,7 +40,7 @@ ** The Device and Vendor IDs for 10 Gigabit MACs **********************************************************************/ =20 -#define INTEL_VENDOR_ID 0x8086 +#define INTEL_VENDOR_ID_IXGB 0x8086 #define INTEL_SUBVENDOR_ID 0x8086 =20 =20 diff --git a/sys/i386/include/atomic.h b/sys/i386/include/atomic.h index f6bcf0c..dbdc945 100644 --- a/sys/i386/include/atomic.h +++ b/sys/i386/include/atomic.h @@ -32,21 +32,47 @@ #error this file needs sys/cdefs.h as a prerequisite #endif =20 - -#if defined(I686_CPU) -#define mb() __asm__ __volatile__ ("mfence;": : :"memory") -#define wmb() __asm__ __volatile__ ("sfence;": : :"memory") -#define rmb() __asm__ __volatile__ ("lfence;": : :"memory") -#else -/* - * do we need a serializing instruction? - */ -#define mb() -#define wmb() -#define rmb() +#if defined(_KERNEL) +#include +#include +#define mb() __asm __volatile( \ + "testl %0,cpu_feature \n\ + je 2f \n\ + mfence \n\ +1: \n\ + .section .text.offpath \n\ +2: lock \n\ + addl $0,cpu_feature \n\ + jmp 1b \n\ + .text \n\ +" \ + : : "i"(CPUID_SSE2) : "memory") +#define wmb() __asm __volatile( \ + "testl %0,cpu_feature \n\ + je 2f \n\ + sfence \n\ +1: \n\ + .section .text.offpath \n\ +2: lock \n\ + addl $0,cpu_feature \n\ + jmp 1b \n\ + .text \n\ +" \ + : : "i"(CPUID_XMM) : "memory") +#define rmb() __asm __volatile( \ + "testl %0,cpu_feature \n\ + je 2f \n\ + lfence \n\ +1: \n\ + .section .text.offpath \n\ +2: lock \n\ + addl $0,cpu_feature \n\ + jmp 1b \n\ + .text \n\ +" \ + : : "i"(CPUID_SSE2) : "memory") #endif =20 - /* * Various simple operations on memory, each of which is atomic in the * presence of interrupts and multiple processors. --XMM+kVNHGkMezEqK Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (FreeBSD) iEYEARECAAYFAkk0WjkACgkQC3+MBN1Mb4h/3gCeIn7KsSx0QuDifzF1O/vpM/ZB ANEAoPFe6LxpczcFTSIbGAMOgXF5MlQ6 =0uZR -----END PGP SIGNATURE----- --XMM+kVNHGkMezEqK-- From owner-svn-src-head@FreeBSD.ORG Mon Dec 1 22:22:23 2008 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0C84B106564A for ; Mon, 1 Dec 2008 22:22:23 +0000 (UTC) (envelope-from asmrookie@gmail.com) Received: from ey-out-2122.google.com (ey-out-2122.google.com [74.125.78.24]) by mx1.freebsd.org (Postfix) with ESMTP id 87F3D8FC1B for ; Mon, 1 Dec 2008 22:22:22 +0000 (UTC) (envelope-from asmrookie@gmail.com) Received: by ey-out-2122.google.com with SMTP id 6so1106751eyi.7 for ; Mon, 01 Dec 2008 14:22:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:sender :to:subject:cc:in-reply-to:mime-version:content-type :content-transfer-encoding:content-disposition:references :x-google-sender-auth; bh=g5wMIqmvR5rKtZFHxLQLu+XernQ0d9SYmgbJ0n+NICo=; b=X4DrJxPk4aUc3Jys8FSMD/fnQfRjzX+J0UaUWW6wH9CIGg2xW3qloxiR7C2hEpU5HV e2PrIH1X0AnPNuKuzYNv0q4JugPMo5yTOYJvqlf7MGFN11l/0Jl/XeOBbuCC+YsEuh79 Q2lk7Rzic4lb+RJimB1gvI9WxTdZ/wuhszGPQ= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:sender:to:subject:cc:in-reply-to:mime-version :content-type:content-transfer-encoding:content-disposition :references:x-google-sender-auth; b=Ji13EWG3zFJcrEH88G9ozoqHFc7CBpV+zK9i6gBr5/HYxSBPZR61Se6JpOJ9+7gMGL rwBHEILNkym9ecPFIkpERRu8ztUqdx4SMzPPK4SKdrfmGtsKsk3PxQI+aZM8D6pQGd+I 2gJDTaxmmzcVRpTOCMLWTGGRfhL35gHUETJxQ= Received: by 10.86.84.5 with SMTP id h5mr6699089fgb.59.1228170140452; Mon, 01 Dec 2008 14:22:20 -0800 (PST) Received: by 10.86.30.17 with HTTP; Mon, 1 Dec 2008 14:22:20 -0800 (PST) Message-ID: <3bbf2fe10812011422x27b007fdp13c5dbbb1cfb557e@mail.gmail.com> Date: Mon, 1 Dec 2008 23:22:20 +0100 From: "Attilio Rao" Sender: asmrookie@gmail.com To: "John Baldwin" In-Reply-To: <200812011407.06563.jhb@freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <200811220555.mAM5tuIJ007781@svn.freebsd.org> <3c1674c90811221651u338294frcdbd99b386733851@mail.gmail.com> <20081123154138.GS6408@deviant.kiev.zoral.com.ua> <200812011407.06563.jhb@freebsd.org> X-Google-Sender-Auth: ba257e7afced6f96 Cc: Scott Long , src-committers@freebsd.org, Kip Macy , svn-src-all@freebsd.org, svn-src-head@freebsd.org, Kostik Belousov Subject: Re: svn commit: r185162 - in head: . sys/amd64/include sys/arm/include sys/conf sys/dev/bce sys/dev/cxgb sys/dev/cxgb/sys sys/dev/cxgb/ulp/iw_cxgb sys/dev/mxge sys/dev/nxge sys/i386/include sys/i386/in... X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 01 Dec 2008 22:22:23 -0000 2008/12/1, John Baldwin : > On Sunday 23 November 2008 10:41:38 am Kostik Belousov wrote: > > On Sun, Nov 23, 2008 at 12:51:58AM +0000, Kip Macy wrote: > > > On Sat, Nov 22, 2008 at 11:08 PM, Scott Long wrote: > > > > Kostik Belousov wrote: > > > >> > > > >> On Sat, Nov 22, 2008 at 03:05:22PM -0700, Scott Long wrote: > > > >>> > > > >>> A neat hack would be for the kernel linker to scan the text and do a > > > >>> drop-in replacement of the opcode that is appropriate for the > platform. > > > >>> I can't see how a CPU_XXX definition would work because it's just a > > > >>> compile time construct, one that can be included with any kernel > > > >>> compile. > > > >> > > > >> Yes, it is possible to do that. Less drastic change is to directly > > > >> check features. I moved slow code to separate section to eliminate > > > >> unconditional jump in fast path. > > > >> Only compile-tested. > > > >> > > > > > > > > As long as it works, I think it's a step in the right direction; I'm > > > > assuming that cpu_feature is a symbol filled in at runtime and not a > > > > macro for the cpuid instruction, right? > > > > > > > > Scott > > > > > > > > > > i386/include/md_var.h: > > > <..> > > > extern u_int cpu_exthigh; > > > extern u_int cpu_feature; > > > extern u_int cpu_feature2; > > > extern u_int amd_feature; > > > extern u_int amd_feature2; > > > <...> > > > > > > I'm not thrilled with it, but we can revisit the issue if it makes a > > > measurable difference on someone's workload. > > > > Below is the updated patch. It includes changes made after private comments > > by bde@ and uses symbolic definitions for the bits in the features words. > > I thought about accessing a per-CPU word for serialized instruction in the > > > slow path, but decided that it does not beneficial.\ > > Is the branch really better than just doing what the atomic operations for > mutexes, etc. do and just use 'lock addl $0,%esp' for a barrier in all cases > on i386 and only bother with using the fancier instructions on amd64? Even > amd64 doesn't use *fence yet for the atomic ops actually. I have had a patch > to use it for years, but during testing there was no discernable difference > between the existing 'lock addl' approach vs '*fence'. I'd much rather just > use 486 code for all i386 machines than add a branch, esp. if > the "optimization" the branch is doing isn't an actual optimization. This is exactly what I suggest in private and I'm supportive with this. Attilio -- Peace can only be achieved by understanding - A. Einstein From owner-svn-src-head@FreeBSD.ORG Mon Dec 1 22:33:50 2008 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E060C1065670; Mon, 1 Dec 2008 22:33:50 +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 D34B58FC16; Mon, 1 Dec 2008 22:33:50 +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 mB1MXor1039187; Mon, 1 Dec 2008 22:33:50 GMT (envelope-from kan@svn.freebsd.org) Received: (from kan@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mB1MXojv039186; Mon, 1 Dec 2008 22:33:50 GMT (envelope-from kan@svn.freebsd.org) Message-Id: <200812012233.mB1MXojv039186@svn.freebsd.org> From: Alexander Kabaev Date: Mon, 1 Dec 2008 22:33: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: r185533 - 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, 01 Dec 2008 22:33:51 -0000 Author: kan Date: Mon Dec 1 22:33:50 2008 New Revision: 185533 URL: http://svn.freebsd.org/changeset/base/185533 Log: Shared memory objects that have size which is not necessarily equal to exact multiple of system page size should still be allowed to be mapped in their entirety to match the regular vnode backed file behavior. Reported by: ed Reviewed by: jhb Modified: head/sys/kern/uipc_shm.c Modified: head/sys/kern/uipc_shm.c ============================================================================== --- head/sys/kern/uipc_shm.c Mon Dec 1 21:15:04 2008 (r185532) +++ head/sys/kern/uipc_shm.c Mon Dec 1 22:33:50 2008 (r185533) @@ -605,7 +605,8 @@ shm_mmap(struct shmfd *shmfd, vm_size_t * XXXRW: This validation is probably insufficient, and subject to * sign errors. It should be fixed. */ - if (foff >= shmfd->shm_size || foff + objsize > shmfd->shm_size) + if (foff >= shmfd->shm_size || + foff + objsize > round_page(shmfd->shm_size)) return (EINVAL); mtx_lock(&shm_timestamp_lock); From owner-svn-src-head@FreeBSD.ORG Mon Dec 1 23:09:58 2008 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A415F1065676; Mon, 1 Dec 2008 23:09:58 +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 990058FC12; Mon, 1 Dec 2008 23:09:58 +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 mB1N9waN039941; Mon, 1 Dec 2008 23:09:58 GMT (envelope-from sam@svn.freebsd.org) Received: (from sam@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mB1N9wBF039940; Mon, 1 Dec 2008 23:09:58 GMT (envelope-from sam@svn.freebsd.org) Message-Id: <200812012309.mB1N9wBF039940@svn.freebsd.org> From: Sam Leffler Date: Mon, 1 Dec 2008 23:09: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: r185534 - head X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 01 Dec 2008 23:09:58 -0000 Author: sam Date: Mon Dec 1 23:09:58 2008 New Revision: 185534 URL: http://svn.freebsd.org/changeset/base/185534 Log: correct typo Submitted by: Ole Vole Modified: head/UPDATING Modified: head/UPDATING ============================================================================== --- head/UPDATING Mon Dec 1 22:33:50 2008 (r185533) +++ head/UPDATING Mon Dec 1 23:09:58 2008 (r185534) @@ -26,7 +26,7 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 8. __FreeBSD_version 800057 marks the switchover from the binary ath hal to source code. Users must add the line: - options ATH_SUPPORT_AR5416 + options AH_SUPPORT_AR5416 to their kernel config files when specifying: From owner-svn-src-head@FreeBSD.ORG Tue Dec 2 00:39:51 2008 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0D1F01065673; Tue, 2 Dec 2008 00:39:51 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 03C3E8FC0C; Tue, 2 Dec 2008 00:39:51 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mB20domx041857; Tue, 2 Dec 2008 00:39:50 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mB20do9W041856; Tue, 2 Dec 2008 00:39:50 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200812020039.mB20do9W041856@svn.freebsd.org> From: Kip Macy Date: Tue, 2 Dec 2008 00:39: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: r185535 - head/sys/dev/cxgb/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, 02 Dec 2008 00:39:51 -0000 Author: kmacy Date: Tue Dec 2 00:39:50 2008 New Revision: 185535 URL: http://svn.freebsd.org/changeset/base/185535 Log: integrate use after free fixes from private branch Found by: kkenn@ Modified: head/sys/dev/cxgb/sys/uipc_mvec.c Modified: head/sys/dev/cxgb/sys/uipc_mvec.c ============================================================================== --- head/sys/dev/cxgb/sys/uipc_mvec.c Mon Dec 1 23:09:58 2008 (r185534) +++ head/sys/dev/cxgb/sys/uipc_mvec.c Tue Dec 2 00:39:50 2008 (r185535) @@ -1,6 +1,6 @@ /************************************************************************** * - * Copyright (c) 2007, Kip Macy kmacy@freebsd.org + * Copyright (c) 2007-2008, Kip Macy kmacy@freebsd.org * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -78,7 +78,6 @@ mi_init(void) return; else mi_inited++; - zone_miovec = uma_zcreate("MBUF IOVEC", MIOVBYTES, NULL, NULL, NULL, NULL, UMA_ALIGN_PTR, UMA_ZONE_MAXBUCKET); @@ -127,6 +126,8 @@ _mcl_collapse_mbuf(struct mbuf_iovec *mi mi->mi_tso_segsz = m->m_pkthdr.tso_segsz; #ifdef IFNET_MULTIQ mi->mi_rss_hash = m->m_pkthdr.rss_hash; + if(!SLIST_EMPTY(&m->m_pkthdr.tags)) + m_tag_delete_chain(m, NULL); #endif } if (m->m_type != MT_DATA) { @@ -147,13 +148,21 @@ _mcl_collapse_mbuf(struct mbuf_iovec *mi mi->mi_type = m->m_ext.ext_type; mi->mi_size = m->m_ext.ext_size; mi->mi_refcnt = m->m_ext.ref_cnt; - mi->mi_mbuf = m; + if (m->m_ext.ext_type == EXT_PACKET) { + mi->mi_mbuf = m; +#ifdef INVARIANTS + cxgb_pack_outstanding++; +#endif + } } else { mi->mi_base = (caddr_t)m; mi->mi_data = m->m_data; mi->mi_size = MSIZE; mi->mi_type = EXT_MBUF; mi->mi_refcnt = NULL; +#ifdef INVARIANTS + cxgb_mbufs_outstanding++; +#endif } KASSERT(mi->mi_len != 0, ("miov has len 0")); KASSERT(mi->mi_type > 0, ("mi_type is invalid")); @@ -193,15 +202,9 @@ busdma_map_sg_collapse(struct mbuf **m, struct mbuf *marray[TX_MAX_SEGS]; int i, type, seg_count, defragged = 0, err = 0; struct mbuf_vec *mv; - int skipped, freed, outstanding, pack_outstanding, mbuf_outstanding; - - + int skipped, freed; KASSERT(n->m_pkthdr.len, ("packet has zero header len")); - - if (n->m_flags & M_PKTHDR && !SLIST_EMPTY(&n->m_pkthdr.tags)) - m_tag_delete_chain(n, NULL); - if (n->m_pkthdr.len <= PIO_LEN) return (0); retry: @@ -209,14 +212,9 @@ retry: if (n->m_next == NULL) { busdma_map_mbuf_fast(n, segs); *nsegs = 1; - if ((n->m_flags & M_EXT) && - (n->m_ext.ext_type == EXT_PACKET)) - cxgb_pack_outstanding++; - else if ((n->m_flags & M_NOFREE) == 0) - cxgb_mbufs_outstanding++; return (0); } - skipped = freed = outstanding = pack_outstanding = mbuf_outstanding = 0; + skipped = freed = 0; while (n && seg_count < TX_MAX_SEGS) { marray[seg_count] = n; @@ -274,11 +272,9 @@ retry: if (n->m_len == 0) /* do nothing - free if mbuf or cluster */; else if ((n->m_flags & M_EXT) == 0) { - mbuf_outstanding++; goto skip; } else if ((n->m_flags & M_EXT) && (n->m_ext.ext_type == EXT_PACKET)) { - pack_outstanding++; goto skip; } else if (n->m_flags & M_NOFREE) goto skip; @@ -293,15 +289,11 @@ retry: /* * is an immediate mbuf or is from the packet zone */ - mhead = n->m_next; - n->m_next = NULL; - n = mhead; + n = n->m_next; } *nsegs = seg_count; *m = m0; DPRINTF("pktlen=%d m0=%p *m=%p m=%p\n", m0->m_pkthdr.len, m0, *m, m); - cxgb_mbufs_outstanding += mbuf_outstanding; - cxgb_pack_outstanding += pack_outstanding; return (0); err_out: m_freem(*m); @@ -310,41 +302,34 @@ err_out: } int -busdma_map_sg_vec(struct mbuf **m, struct mbuf **mret, bus_dma_segment_t *segs, int count) +busdma_map_sg_vec(struct mbuf **m, struct mbuf **mret, + bus_dma_segment_t *segs, int pkt_count) { struct mbuf *m0, **mp; struct mbuf_iovec *mi; struct mbuf_vec *mv; - int i; - - if (count > MAX_MIOVEC_IOV) { - if ((m0 = uma_zalloc_arg(zone_clust, NULL, M_NOWAIT)) == NULL) - return (ENOMEM); - m0->m_type = EXT_CLIOVEC; - } else { - if ((m0 = uma_zalloc_arg(zone_miovec, NULL, M_NOWAIT)) == NULL) - return (ENOMEM); - m0->m_type = EXT_IOVEC; - } + int i, type; + + if ((m0 = mcl_alloc(pkt_count, &type)) == NULL) + return (ENOMEM); - m0->m_flags = 0; - m0->m_pkthdr.len = m0->m_len = (*m)->m_len; /* not the real length but needs to be non-zero */ + memcpy(m0, *m, sizeof(struct m_hdr) + + sizeof(struct pkthdr)); + m0->m_type = type; mv = mtomv(m0); - mv->mv_count = count; + mv->mv_count = pkt_count; mv->mv_first = 0; - for (mp = m, i = 0, mi = mv->mv_vec; i < count; mp++, segs++, mi++, i++) { - if ((*mp)->m_flags & M_PKTHDR && !SLIST_EMPTY(&(*mp)->m_pkthdr.tags)) - m_tag_delete_chain(*mp, NULL); + for (mp = m, i = 0, mi = mv->mv_vec; i < pkt_count; + mp++, segs++, mi++, i++) { busdma_map_mbuf_fast(*mp, segs); _mcl_collapse_mbuf(mi, *mp); KASSERT(mi->mi_len, ("empty packet")); } - for (mp = m, i = 0; i < count; i++, mp++) { - (*mp)->m_next = (*mp)->m_nextpkt = NULL; - if (((*mp)->m_flags & (M_EXT|M_NOFREE)) == M_EXT) { + for (mp = m, i = 0; i < pkt_count; i++, mp++) { + if ((((*mp)->m_flags & (M_EXT|M_NOFREE)) == M_EXT) + && ((*mp)->m_ext.ext_type != EXT_PACKET)) { (*mp)->m_flags &= ~M_EXT; - cxgb_mbufs_outstanding--; m_free(*mp); } } @@ -359,17 +344,28 @@ mb_free_ext_fast(struct mbuf_iovec *mi, int dofree; caddr_t cl; - if (type == EXT_PACKET) { + cl = mi->mi_base; + switch (type) { + case EXT_PACKET: +#ifdef INVARIANTS cxgb_pack_outstanding--; +#endif m_free(mi->mi_mbuf); return; + case EXT_MBUF: + KASSERT((mi->mi_flags & M_NOFREE) == 0, ("no free set on mbuf")); +#ifdef INVARIANTS + cxgb_mbufs_outstanding--; +#endif + m_free_fast((struct mbuf *)cl); + return; + default: + break; } /* Account for lazy ref count assign. */ dofree = (mi->mi_refcnt == NULL); if (dofree == 0) { - KASSERT(mi->mi_type != EXT_MBUF, - ("refcnt must be null for mbuf")); if (*(mi->mi_refcnt) == 1 || atomic_fetchadd_int(mi->mi_refcnt, -1) == 1) dofree = 1; @@ -377,13 +373,7 @@ mb_free_ext_fast(struct mbuf_iovec *mi, if (dofree == 0) return; - cl = mi->mi_base; switch (type) { - case EXT_MBUF: - KASSERT((mi->mi_flags & M_NOFREE) == 0, ("no free set on mbuf")); - cxgb_mbufs_outstanding--; - m_free_fast((struct mbuf *)cl); - break; case EXT_CLUSTER: cxgb_cache_put(zone_clust, cl); break; From owner-svn-src-head@FreeBSD.ORG Tue Dec 2 00:48:08 2008 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9CF21106564A; Tue, 2 Dec 2008 00:48:08 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 94A468FC14; Tue, 2 Dec 2008 00:48:08 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mB20m83w042050; Tue, 2 Dec 2008 00:48:08 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mB20m8Gw042049; Tue, 2 Dec 2008 00:48:08 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200812020048.mB20m8Gw042049@svn.freebsd.org> From: Kip Macy Date: Tue, 2 Dec 2008 00:48: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: r185536 - head/sys/dev/cxgb/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, 02 Dec 2008 00:48:08 -0000 Author: kmacy Date: Tue Dec 2 00:48:08 2008 New Revision: 185536 URL: http://svn.freebsd.org/changeset/base/185536 Log: - fix multiqueue conditional - don't leak mbuf tags in the non-conditional case Found by: Navdeep Parhar Modified: head/sys/dev/cxgb/sys/uipc_mvec.c Modified: head/sys/dev/cxgb/sys/uipc_mvec.c ============================================================================== --- head/sys/dev/cxgb/sys/uipc_mvec.c Tue Dec 2 00:39:50 2008 (r185535) +++ head/sys/dev/cxgb/sys/uipc_mvec.c Tue Dec 2 00:48:08 2008 (r185536) @@ -124,11 +124,11 @@ _mcl_collapse_mbuf(struct mbuf_iovec *mi if (m->m_flags & M_PKTHDR) { mi->mi_ether_vtag = m->m_pkthdr.ether_vtag; mi->mi_tso_segsz = m->m_pkthdr.tso_segsz; -#ifdef IFNET_MULTIQ +#ifdef IFNET_MULTIQUEUE mi->mi_rss_hash = m->m_pkthdr.rss_hash; +#endif if(!SLIST_EMPTY(&m->m_pkthdr.tags)) m_tag_delete_chain(m, NULL); -#endif } if (m->m_type != MT_DATA) { mi->mi_data = NULL; From owner-svn-src-head@FreeBSD.ORG Tue Dec 2 00:51:56 2008 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7B3F21065670; Tue, 2 Dec 2008 00:51:56 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 730B28FC1C; Tue, 2 Dec 2008 00:51:56 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mB20puiY042160; Tue, 2 Dec 2008 00:51:56 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mB20puVd042159; Tue, 2 Dec 2008 00:51:56 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200812020051.mB20puVd042159@svn.freebsd.org> From: Kip Macy Date: Tue, 2 Dec 2008 00:51: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: r185537 - head/sys/dev/cxgb/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, 02 Dec 2008 00:51:56 -0000 Author: kmacy Date: Tue Dec 2 00:51:56 2008 New Revision: 185537 URL: http://svn.freebsd.org/changeset/base/185537 Log: The pkthdr field is flowid not rss_hash Modified: head/sys/dev/cxgb/sys/uipc_mvec.c Modified: head/sys/dev/cxgb/sys/uipc_mvec.c ============================================================================== --- head/sys/dev/cxgb/sys/uipc_mvec.c Tue Dec 2 00:48:08 2008 (r185536) +++ head/sys/dev/cxgb/sys/uipc_mvec.c Tue Dec 2 00:51:56 2008 (r185537) @@ -125,7 +125,7 @@ _mcl_collapse_mbuf(struct mbuf_iovec *mi mi->mi_ether_vtag = m->m_pkthdr.ether_vtag; mi->mi_tso_segsz = m->m_pkthdr.tso_segsz; #ifdef IFNET_MULTIQUEUE - mi->mi_rss_hash = m->m_pkthdr.rss_hash; + mi->mi_rss_hash = m->m_pkthdr.flowid; #endif if(!SLIST_EMPTY(&m->m_pkthdr.tags)) m_tag_delete_chain(m, NULL); From owner-svn-src-head@FreeBSD.ORG Tue Dec 2 02:12:34 2008 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E0011106567D; Tue, 2 Dec 2008 02:12:34 +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 D8B068FC16; Tue, 2 Dec 2008 02:12:34 +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 mB22CYql045212; Tue, 2 Dec 2008 02:12:34 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mB22CY5e045211; Tue, 2 Dec 2008 02:12:34 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <200812020212.mB22CY5e045211@svn.freebsd.org> From: Pyun YongHyeon Date: Tue, 2 Dec 2008 02:12: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: r185538 - head/sys/dev/fxp X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 02 Dec 2008 02:12:35 -0000 Author: yongari Date: Tue Dec 2 02:12:34 2008 New Revision: 185538 URL: http://svn.freebsd.org/changeset/base/185538 Log: Make sure to clear PMDR register by writing back power management events. Just reading PMDR register was not enough to have fxp(4) immuninize against received magic packets during system boot. Tested by: Alexey Shuvaev < shuvaev <> physik DOT uni-wuerzburg DOT de > Modified: head/sys/dev/fxp/if_fxp.c Modified: head/sys/dev/fxp/if_fxp.c ============================================================================== --- head/sys/dev/fxp/if_fxp.c Tue Dec 2 00:51:56 2008 (r185537) +++ head/sys/dev/fxp/if_fxp.c Tue Dec 2 02:12:34 2008 (r185538) @@ -857,7 +857,7 @@ fxp_attach(device_t dev) if ((sc->flags & FXP_FLAG_WOLCAP) != 0) { FXP_LOCK(sc); /* Clear wakeup events. */ - CSR_READ_1(sc, FXP_CSR_PMDR); + CSR_WRITE_1(sc, FXP_CSR_PMDR, CSR_READ_1(sc, FXP_CSR_PMDR)); fxp_init_body(sc); fxp_stop(sc); FXP_UNLOCK(sc); @@ -1050,10 +1050,9 @@ fxp_resume(device_t dev) /* Disable PME and clear PME status. */ pmstat &= ~PCIM_PSTAT_PMEENABLE; pci_write_config(sc->dev, pmc + PCIR_POWER_STATUS, pmstat, 2); - if ((sc->flags & FXP_FLAG_WOLCAP) != 0) { - /* Clear wakeup events. */ - CSR_READ_1(sc, FXP_CSR_PMDR); - } + if ((sc->flags & FXP_FLAG_WOLCAP) != 0) + CSR_WRITE_1(sc, FXP_CSR_PMDR, + CSR_READ_1(sc, FXP_CSR_PMDR)); } CSR_WRITE_4(sc, FXP_CSR_PORT, FXP_PORT_SELECTIVE_RESET); From owner-svn-src-head@FreeBSD.ORG Tue Dec 2 02:26:15 2008 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B95381065678; Tue, 2 Dec 2008 02:26:15 +0000 (UTC) (envelope-from peter@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B1B4F8FC1B; Tue, 2 Dec 2008 02:26:15 +0000 (UTC) (envelope-from peter@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mB22QFM3045543; Tue, 2 Dec 2008 02:26:15 GMT (envelope-from peter@svn.freebsd.org) Received: (from peter@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mB22QFtl045542; Tue, 2 Dec 2008 02:26:15 GMT (envelope-from peter@svn.freebsd.org) Message-Id: <200812020226.mB22QFtl045542@svn.freebsd.org> From: Peter Wemm Date: Tue, 2 Dec 2008 02:26: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: r185539 - in head/sys: arm/at91 dev/mn kern security/mac security/mac_bsdextended X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 02 Dec 2008 02:26:15 -0000 Author: peter Date: Tue Dec 2 02:26:15 2008 New Revision: 185539 URL: http://svn.freebsd.org/changeset/base/185539 Log: Delete a bunch of empty mergeinfo records caused by local copies. Modified: head/sys/arm/at91/at91_machdep.c (props changed) head/sys/arm/at91/board_bwct.c (props changed) head/sys/arm/at91/board_hl200.c (props changed) head/sys/arm/at91/board_kb920x.c (props changed) head/sys/arm/at91/board_tsc4370.c (props changed) head/sys/arm/at91/std.bwct (props changed) head/sys/arm/at91/std.hl200 (props changed) head/sys/arm/at91/std.tsc4370 (props changed) head/sys/dev/mn/if_mn.c (props changed) head/sys/kern/kern_cons.c (props changed) head/sys/security/mac/mac_cred.c (props changed) head/sys/security/mac_bsdextended/ugidfw_system.c (props changed) head/sys/security/mac_bsdextended/ugidfw_vnode.c (props changed) From owner-svn-src-head@FreeBSD.ORG Tue Dec 2 02:30:12 2008 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DB51C1065672; Tue, 2 Dec 2008 02:30:12 +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 D41FE8FC0A; Tue, 2 Dec 2008 02:30:12 +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 mB22UCm1045674; Tue, 2 Dec 2008 02:30:12 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mB22UCUs045672; Tue, 2 Dec 2008 02:30:12 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <200812020230.mB22UCUs045672@svn.freebsd.org> From: Pyun YongHyeon Date: Tue, 2 Dec 2008 02:30:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185540 - head/sys/dev/fxp X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 02 Dec 2008 02:30:13 -0000 Author: yongari Date: Tue Dec 2 02:30:12 2008 New Revision: 185540 URL: http://svn.freebsd.org/changeset/base/185540 Log: Add VLAN hardware tag insertion/stripping support. Tx/Rx checksum offload for VLAN frames are also supported. The VLAN hardware assistance is available only on 82550/82551 based controllers. While I'm here change the confusing name of bit1 in byte 22 of configuration block to vlan_drop_en. The bit controls whether hardware strips VLAN tagged frame or not. Special thanks to wpaul who sent valuable VLAN related information to me. Tested on: i386, sparc64 Modified: head/sys/dev/fxp/if_fxp.c head/sys/dev/fxp/if_fxpreg.h Modified: head/sys/dev/fxp/if_fxp.c ============================================================================== --- head/sys/dev/fxp/if_fxp.c Tue Dec 2 02:26:15 2008 (r185539) +++ head/sys/dev/fxp/if_fxp.c Tue Dec 2 02:30:12 2008 (r185540) @@ -830,6 +830,12 @@ fxp_attach(device_t dev) ifp->if_data.ifi_hdrlen = sizeof(struct ether_vlan_header); ifp->if_capabilities |= IFCAP_VLAN_MTU; ifp->if_capenable |= IFCAP_VLAN_MTU; /* the hw bits already set */ + if ((sc->flags & FXP_FLAG_EXT_RFA) != 0) { + ifp->if_capabilities |= IFCAP_VLAN_HWTAGGING | + IFCAP_VLAN_HWCSUM; + ifp->if_capenable |= IFCAP_VLAN_HWTAGGING | + IFCAP_VLAN_HWCSUM; + } /* * Let the system queue as many packets as we have available @@ -1554,6 +1560,12 @@ fxp_encap(struct fxp_softc *sc, struct m FXP_IPCB_TCP_PACKET | FXP_IPCB_TCPUDP_CHECKSUM_ENABLE; } + /* Configure VLAN hardware tag insertion. */ + if ((m->m_flags & M_VLANTAG) != 0) { + cbp->ipcb_vlan_id = htons(m->m_pkthdr.ether_vtag); + txp->tx_cb->ipcb_ip_activation_high |= + FXP_IPCB_INSERTVLAN_ENABLE; + } txp->tx_mbuf = m; txp->tx_cb->cb_status = 0; @@ -1913,6 +1925,12 @@ fxp_intr_body(struct fxp_softc *sc, stru /* Do IP checksum checking. */ if ((ifp->if_capenable & IFCAP_RXCSUM) != 0) fxp_rxcsum(sc, ifp, m, status, total_len); + if ((ifp->if_capenable & IFCAP_VLAN_HWTAGGING) != 0 && + (status & FXP_RFA_STATUS_VLAN) != 0) { + m->m_pkthdr.ether_vtag = + ntohs(rfa->rfax_vlan_id); + m->m_flags |= M_VLANTAG; + } /* * Drop locks before calling if_input() since it * may re-enter fxp_start() in the netisr case. @@ -2284,6 +2302,8 @@ fxp_init_body(struct fxp_softc *sc) cbp->multi_ia = 0; /* (don't) accept multiple IAs */ cbp->mc_all = sc->flags & FXP_FLAG_ALL_MCAST ? 1 : 0; cbp->gamla_rx = sc->flags & FXP_FLAG_EXT_RFA ? 1 : 0; + cbp->vlan_strip_en = ((sc->flags & FXP_FLAG_EXT_RFA) != 0 && + (ifp->if_capenable & IFCAP_VLAN_HWTAGGING) != 0) ? 1 : 0; if (sc->tunable_noflow || sc->revision == FXP_REV_82557) { /* @@ -2763,9 +2783,15 @@ fxp_ioctl(struct ifnet *ifp, u_long comm if (ifp->if_flags & IFF_UP) reinit++; } - if (reinit > 0) + if ((mask & IFCAP_VLAN_HWTAGGING) != 0 && + (ifp->if_capabilities & IFCAP_VLAN_HWTAGGING) != 0) { + ifp->if_capenable ^= IFCAP_VLAN_HWTAGGING; + reinit++; + } + if (reinit > 0 && ifp->if_flags & IFF_UP) fxp_init_body(sc); FXP_UNLOCK(sc); + VLAN_CAPABILITIES(ifp); break; default: Modified: head/sys/dev/fxp/if_fxpreg.h ============================================================================== --- head/sys/dev/fxp/if_fxpreg.h Tue Dec 2 02:26:15 2008 (r185539) +++ head/sys/dev/fxp/if_fxpreg.h Tue Dec 2 02:30:12 2008 (r185540) @@ -224,7 +224,7 @@ struct fxp_cb_config { /* Bytes 22 - 31 -- i82550 only */ u_int __FXP_BITFIELD3(gamla_rx:1, - vlan_drop_en:1, + vlan_strip_en:1, :6); uint8_t pad[9]; }; @@ -377,6 +377,7 @@ struct fxp_rfa { #define FXP_RFA_STATUS_RNR 0x0200 /* no resources */ #define FXP_RFA_STATUS_ALIGN 0x0400 /* alignment error */ #define FXP_RFA_STATUS_CRC 0x0800 /* CRC error */ +#define FXP_RFA_STATUS_VLAN 0x1000 /* VLAN tagged frame */ #define FXP_RFA_STATUS_OK 0x2000 /* packet received okay */ #define FXP_RFA_STATUS_C 0x8000 /* packet reception complete */ #define FXP_RFA_CONTROL_SF 0x08 /* simple/flexible memory mode */ From owner-svn-src-head@FreeBSD.ORG Tue Dec 2 03:39:35 2008 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7998B1065670; Tue, 2 Dec 2008 03:39:35 +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 72DA48FC13; Tue, 2 Dec 2008 03:39:35 +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 mB23dZre047353; Tue, 2 Dec 2008 03:39:35 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mB23dZvD047351; Tue, 2 Dec 2008 03:39:35 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <200812020339.mB23dZvD047351@svn.freebsd.org> From: Pyun YongHyeon Date: Tue, 2 Dec 2008 03:39: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: r185542 - in head/sys: dev/re 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, 02 Dec 2008 03:39:35 -0000 Author: yongari Date: Tue Dec 2 03:39:34 2008 New Revision: 185542 URL: http://svn.freebsd.org/changeset/base/185542 Log: Add 8168D support. Submitted by: Andrew < andrewwtulloch <> gmail DOT com > Modified: head/sys/dev/re/if_re.c head/sys/pci/if_rlreg.h Modified: head/sys/dev/re/if_re.c ============================================================================== --- head/sys/dev/re/if_re.c Tue Dec 2 02:32:13 2008 (r185541) +++ head/sys/dev/re/if_re.c Tue Dec 2 03:39:34 2008 (r185542) @@ -172,7 +172,7 @@ static struct rl_type re_devs[] = { { RT_VENDORID, RT_DEVICEID_8101E, 0, "RealTek 8101E/8102E/8102EL PCIe 10/100baseTX" }, { RT_VENDORID, RT_DEVICEID_8168, 0, - "RealTek 8168/8168B/8168C/8168CP/8111B/8111C/8111CP PCIe " + "RealTek 8168/8168B/8168C/8168CP/8168D/8111B/8111C/8111CP PCIe " "Gigabit Ethernet" }, { RT_VENDORID, RT_DEVICEID_8169, 0, "RealTek 8169/8169S/8169SB(L)/8110S/8110SB(L) Gigabit Ethernet" }, @@ -213,6 +213,7 @@ static struct rl_hwrev re_hwrevs[] = { { RL_HWREV_8168C, RL_8169, "8168C/8111C"}, { RL_HWREV_8168C_SPIN2, RL_8169, "8168C/8111C"}, { RL_HWREV_8168CP, RL_8169, "8168CP/8111CP"}, + { RL_HWREV_8168D, RL_8169, "8168D"}, { 0, 0, NULL } }; @@ -1225,6 +1226,7 @@ re_attach(device_t dev) case RL_HWREV_8168C: case RL_HWREV_8168C_SPIN2: case RL_HWREV_8168CP: + case RL_HWREV_8168D: sc->rl_flags |= RL_FLAG_INVMAR | RL_FLAG_PHYWAKE | RL_FLAG_PAR | RL_FLAG_DESCV2 | RL_FLAG_MACSTAT; /* Modified: head/sys/pci/if_rlreg.h ============================================================================== --- head/sys/pci/if_rlreg.h Tue Dec 2 02:32:13 2008 (r185541) +++ head/sys/pci/if_rlreg.h Tue Dec 2 03:39:34 2008 (r185542) @@ -157,6 +157,7 @@ #define RL_HWREV_8169_8110SB 0x10000000 #define RL_HWREV_8169_8110SC 0x18000000 #define RL_HWREV_8102EL 0x24800000 +#define RL_HWREV_8168D 0x28000000 #define RL_HWREV_8168_SPIN1 0x30000000 #define RL_HWREV_8100E 0x30800000 #define RL_HWREV_8101E 0x34000000 From owner-svn-src-head@FreeBSD.ORG Tue Dec 2 03:58:10 2008 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 82198106564A; Tue, 2 Dec 2008 03:58:10 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 7C1428FC14; Tue, 2 Dec 2008 03:58:10 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mB23wAVA047723; Tue, 2 Dec 2008 03:58:10 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mB23wAtL047722; Tue, 2 Dec 2008 03:58:10 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200812020358.mB23wAtL047722@svn.freebsd.org> From: Kip Macy Date: Tue, 2 Dec 2008 03:58: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: r185543 - 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, 02 Dec 2008 03:58:10 -0000 Author: kmacy Date: Tue Dec 2 03:58:10 2008 New Revision: 185543 URL: http://svn.freebsd.org/changeset/base/185543 Log: return ENOBUFS when ring is full Modified: head/sys/sys/buf_ring.h Modified: head/sys/sys/buf_ring.h ============================================================================== --- head/sys/sys/buf_ring.h Tue Dec 2 03:39:34 2008 (r185542) +++ head/sys/sys/buf_ring.h Tue Dec 2 03:58:10 2008 (r185543) @@ -92,7 +92,7 @@ buf_ring_enqueue(struct buf_ring *br, vo if (prod_next == cons_tail) { critical_exit(); - return (ENOSPC); + return (ENOBUFS); } success = atomic_cmpset_int(&br->br_prod_head, prod_head, From owner-svn-src-head@FreeBSD.ORG Tue Dec 2 04:45:34 2008 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 162D1106564A; Tue, 2 Dec 2008 04:45:34 +0000 (UTC) (envelope-from ps@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 10DBD8FC0A; Tue, 2 Dec 2008 04:45:34 +0000 (UTC) (envelope-from ps@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mB24jXN4048637; Tue, 2 Dec 2008 04:45:33 GMT (envelope-from ps@svn.freebsd.org) Received: (from ps@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mB24jXaS048636; Tue, 2 Dec 2008 04:45:33 GMT (envelope-from ps@svn.freebsd.org) Message-Id: <200812020445.mB24jXaS048636@svn.freebsd.org> From: Paul Saab Date: Tue, 2 Dec 2008 04:45: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: r185544 - head/sys/modules/ae X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 02 Dec 2008 04:45:34 -0000 Author: ps Date: Tue Dec 2 04:45:33 2008 New Revision: 185544 URL: http://svn.freebsd.org/changeset/base/185544 Log: Fix world by including opt_route.h Modified: head/sys/modules/ae/Makefile Modified: head/sys/modules/ae/Makefile ============================================================================== --- head/sys/modules/ae/Makefile Tue Dec 2 03:58:10 2008 (r185543) +++ head/sys/modules/ae/Makefile Tue Dec 2 04:45:33 2008 (r185544) @@ -3,6 +3,6 @@ .PATH: ${.CURDIR}/../../dev/ae KMOD= if_ae -SRCS= if_ae.c device_if.h bus_if.h pci_if.h miibus_if.h +SRCS= if_ae.c device_if.h bus_if.h pci_if.h miibus_if.h opt_route.h .include From owner-svn-src-head@FreeBSD.ORG Tue Dec 2 04:54:31 2008 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BE96D106564A; Tue, 2 Dec 2008 04:54:31 +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 B91408FC08; Tue, 2 Dec 2008 04:54:31 +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 mB24sVaT048876; Tue, 2 Dec 2008 04:54:31 GMT (envelope-from imp@svn.freebsd.org) Received: (from imp@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mB24sVNd048874; Tue, 2 Dec 2008 04:54:31 GMT (envelope-from imp@svn.freebsd.org) Message-Id: <200812020454.mB24sVNd048874@svn.freebsd.org> From: Warner Losh Date: Tue, 2 Dec 2008 04:54:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185545 - head/sys/dev/cardbus X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 02 Dec 2008 04:54:31 -0000 Author: imp Date: Tue Dec 2 04:54:31 2008 New Revision: 185545 URL: http://svn.freebsd.org/changeset/base/185545 Log: Don't call destroy_dev on the alias. This fixes half a dozen PRs I think. Modified: head/sys/dev/cardbus/cardbus_device.c head/sys/dev/cardbus/cardbusvar.h Modified: head/sys/dev/cardbus/cardbus_device.c ============================================================================== --- head/sys/dev/cardbus/cardbus_device.c Tue Dec 2 04:45:33 2008 (r185544) +++ head/sys/dev/cardbus/cardbus_device.c Tue Dec 2 04:54:31 2008 (r185545) @@ -112,15 +112,15 @@ cardbus_device_create(struct cardbus_sof device_t parent, device_t child) { uint32_t minor; + int unit; cardbus_device_buffer_cis(parent, child, &devi->sc_cis); minor = (device_get_unit(sc->sc_dev) << 8) + devi->pci.cfg.func; + unit = device_get_unit(sc->sc_dev); devi->sc_cisdev = make_dev(&cardbus_cdevsw, minor, 0, 0, 0666, - "cardbus%d.%d.cis", device_get_unit(sc->sc_dev), - devi->pci.cfg.func); + "cardbus%d.%d.cis", unit, devi->pci.cfg.func); if (devi->pci.cfg.func == 0) - devi->sc_cisdev_compat = make_dev_alias(devi->sc_cisdev, - "cardbus%d.cis", device_get_unit(sc->sc_dev)); + make_dev_alias(devi->sc_cisdev, "cardbus%d.cis", unit); devi->sc_cisdev->si_drv1 = devi; return (0); } @@ -130,8 +130,6 @@ cardbus_device_destroy(struct cardbus_de { if (devi->sc_cisdev) destroy_dev(devi->sc_cisdev); - if (devi->sc_cisdev_compat) - destroy_dev(devi->sc_cisdev_compat); return (0); } Modified: head/sys/dev/cardbus/cardbusvar.h ============================================================================== --- head/sys/dev/cardbus/cardbusvar.h Tue Dec 2 04:45:33 2008 (r185544) +++ head/sys/dev/cardbus/cardbusvar.h Tue Dec 2 04:54:31 2008 (r185545) @@ -60,7 +60,6 @@ struct cardbus_devinfo } funce; uint32_t fepresent; /* bit mask of funce values present */ struct cdev *sc_cisdev; - struct cdev *sc_cisdev_compat; struct cis_buffer sc_cis; }; From owner-svn-src-head@FreeBSD.ORG Tue Dec 2 05:05:55 2008 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D4A5C106564A; Tue, 2 Dec 2008 05:05:55 +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 895FB8FC22; Tue, 2 Dec 2008 05:05:55 +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 mB252rWJ029388; Mon, 1 Dec 2008 22:02:54 -0700 (MST) (envelope-from imp@bsdimp.com) Date: Mon, 01 Dec 2008 22:02:56 -0700 (MST) Message-Id: <20081201.220256.-399281305.imp@bsdimp.com> To: alfred@FreeBSD.org From: "M. Warner Losh" In-Reply-To: <20081201132554.GD27096@elvis.mu.org> References: <49338E98.7020104@freebsd.org> <863ah8rvcd.fsf@ds4.des.no> <20081201132554.GD27096@elvis.mu.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, des@des.no, svn-src-all@FreeBSD.org, kientzle@FreeBSD.org, src-committers@FreeBSD.org Subject: Re: svn commit: r185499 - 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: Tue, 02 Dec 2008 05:05:56 -0000 I thought the consensus was for universe to build *ALL* targets and then fail if ONE or MORE of the targets failed. I thought there was no consensus at all for a new target. Warner From owner-svn-src-head@FreeBSD.ORG Tue Dec 2 05:09:33 2008 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 55CD51065670; Tue, 2 Dec 2008 05:09:33 +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 206A18FC14; Tue, 2 Dec 2008 05:09:33 +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 mB2584F5029447; Mon, 1 Dec 2008 22:08:04 -0700 (MST) (envelope-from imp@bsdimp.com) Date: Mon, 01 Dec 2008 22:08:08 -0700 (MST) Message-Id: <20081201.220808.1649770636.imp@bsdimp.com> To: peter@FreeBSD.org From: "M. Warner Losh" In-Reply-To: <200812020226.mB22QFtl045542@svn.freebsd.org> References: <200812020226.mB22QFtl045542@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: r185539 - in head/sys: arm/at91 dev/mn kern security/mac security/mac_bsdextended X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 02 Dec 2008 05:09:33 -0000 In message: <200812020226.mB22QFtl045542@svn.freebsd.org> Peter Wemm writes: : Author: peter : Date: Tue Dec 2 02:26:15 2008 : New Revision: 185539 : URL: http://svn.freebsd.org/changeset/base/185539 : : Log: : Delete a bunch of empty mergeinfo records caused by local copies. : : Modified: : head/sys/arm/at91/at91_machdep.c (props changed) : head/sys/arm/at91/board_bwct.c (props changed) : head/sys/arm/at91/board_hl200.c (props changed) : head/sys/arm/at91/board_kb920x.c (props changed) : head/sys/arm/at91/board_tsc4370.c (props changed) : head/sys/arm/at91/std.bwct (props changed) : head/sys/arm/at91/std.hl200 (props changed) : head/sys/arm/at91/std.tsc4370 (props changed) : head/sys/dev/mn/if_mn.c (props changed) : head/sys/kern/kern_cons.c (props changed) : head/sys/security/mac/mac_cred.c (props changed) : head/sys/security/mac_bsdextended/ugidfw_system.c (props changed) : head/sys/security/mac_bsdextended/ugidfw_vnode.c (props changed) Is there some way the developer that does the copies can do this so you don't need to do this? Warner From owner-svn-src-head@FreeBSD.ORG Tue Dec 2 05:12:01 2008 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9B078106564A; Tue, 2 Dec 2008 05:12:01 +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 497478FC16; Tue, 2 Dec 2008 05:12:01 +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 mB25AbQq029486; Mon, 1 Dec 2008 22:10:37 -0700 (MST) (envelope-from imp@bsdimp.com) Date: Mon, 01 Dec 2008 22:10:40 -0700 (MST) Message-Id: <20081201.221040.-1350500631.imp@bsdimp.com> To: alfred@FreeBSD.org From: "M. Warner Losh" In-Reply-To: <20081201132554.GD27096@elvis.mu.org> References: <49338E98.7020104@freebsd.org> <863ah8rvcd.fsf@ds4.des.no> <20081201132554.GD27096@elvis.mu.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, des@des.no, svn-src-all@FreeBSD.org, kientzle@FreeBSD.org, src-committers@FreeBSD.org Subject: Re: svn commit: r185499 - 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: Tue, 02 Dec 2008 05:12:01 -0000 In message: <20081201132554.GD27096@elvis.mu.org> Alfred Perlstein writes: : * Dag-Erling Sm??rgrav [081201 03:25] wrote: : > Tim Kientzle writes: : > > Alfred Perlstein writes: : > > > Log: : > > > Provide a 'tinderbox' target that compiles enough of FreeBSD that : > > > a developer can rest reasonably assured that the tinderbox will not : > > > be broken. This target leverages most of 'universe' but will exit : > > > non-zero and output a summary at the end. : > > > "make tinderbox" : > > Excellent! : > : > I really don't see the point, especially now that 'make universe' will : > issue a warning on stdout for every build that fails. As I've tried to : > explain to Alfred, the tinderbox does nothing magical, and nothing that : > isn't already covered by 'make universe'. I also asked him to discuss : > any changes with Poul-Henning before committing them. : : I'll summarize the changes here: : : Problems with make universe: : 1) Make universe returns success on failure. : 2) Make universe outputs the following on failure: : -------------------------------------------------------------- : make universe completed on `LC_ALL=C date`" : (started ${STARTTIME})" : -------------------------------------------------------------- : : This basically means you can't chain 'make universe' into something : like "make tinderbox || (echo oops | mail -s tinderbox failed...)". : : The summary at the end "completed" is very misleading. : : The tinderbox target differs as follows: : : It returns an error if it fails. : It outputs a summary of the failures at the end. : The name reflects what its for. ("what the heck is a universe?") : : : If you strongly believe that a target should return "true" on failure : and/or output "i worked" on failure then I'm not sure how to approach : that mindset, maybe you can help me understand where you're coming from : on that? Where is the utility in it? Is there something I'm missing? I think you ignored the discussions that said that 'universe' should be modified to exit with an error when there was an error, but shouldn't bail out EARLY. There were even patches to do this. Based on that, why do something completely new and different? Warner From owner-svn-src-head@FreeBSD.ORG Tue Dec 2 06:50:08 2008 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4B2771065677; Tue, 2 Dec 2008 06:50:08 +0000 (UTC) (envelope-from bzeeb-lists@lists.zabbadoz.net) Received: from mail.cksoft.de (mail.cksoft.de [62.111.66.27]) by mx1.freebsd.org (Postfix) with ESMTP id 0E8BA8FC13; Tue, 2 Dec 2008 06:50:07 +0000 (UTC) (envelope-from bzeeb-lists@lists.zabbadoz.net) Received: from localhost (amavis.str.cksoft.de [192.168.74.71]) by mail.cksoft.de (Postfix) with ESMTP id 0AAEE41C615; Tue, 2 Dec 2008 07:50:06 +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 Zcwv5Z3-y4nL; Tue, 2 Dec 2008 07:50:05 +0100 (CET) Received: by mail.cksoft.de (Postfix, from userid 66) id 966BD41C5DC; Tue, 2 Dec 2008 07:50: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 6C4F14448D5; Tue, 2 Dec 2008 06:47:14 +0000 (UTC) Date: Tue, 2 Dec 2008 06:47:13 +0000 (UTC) From: "Bjoern A. Zeeb" X-X-Sender: bz@maildrop.int.zabbadoz.net To: Paul Saab In-Reply-To: <200812020445.mB24jXaS048636@svn.freebsd.org> Message-ID: <20081202064345.S80401@maildrop.int.zabbadoz.net> References: <200812020445.mB24jXaS048636@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: r185544 - head/sys/modules/ae X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 02 Dec 2008 06:50:08 -0000 On Tue, 2 Dec 2008, Paul Saab wrote: > Author: ps > Date: Tue Dec 2 04:45:33 2008 > New Revision: 185544 > URL: http://svn.freebsd.org/changeset/base/185544 > > Log: > Fix world by including opt_route.h Where did world fail for you? I assume what failed was a single direct module build? Per discussion on current@ we are working on this but it's a long list of files with awkward dependencies to go through. If that was the only problem, the manual module build, please let me know so I can back this out again as soon as the vimage header files are untangled. > Modified: > head/sys/modules/ae/Makefile > > Modified: head/sys/modules/ae/Makefile > ============================================================================== > --- head/sys/modules/ae/Makefile Tue Dec 2 03:58:10 2008 (r185543) > +++ head/sys/modules/ae/Makefile Tue Dec 2 04:45:33 2008 (r185544) > @@ -3,6 +3,6 @@ > .PATH: ${.CURDIR}/../../dev/ae > > KMOD= if_ae > -SRCS= if_ae.c device_if.h bus_if.h pci_if.h miibus_if.h > +SRCS= if_ae.c device_if.h bus_if.h pci_if.h miibus_if.h opt_route.h > > .include > -- Bjoern A. Zeeb Stop bit received. Insert coin for new game. From owner-svn-src-head@FreeBSD.ORG Tue Dec 2 06:50:26 2008 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D7F291065672; Tue, 2 Dec 2008 06:50:26 +0000 (UTC) (envelope-from peter@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D1B3D8FC0C; Tue, 2 Dec 2008 06:50:26 +0000 (UTC) (envelope-from peter@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mB26oQCc051434; Tue, 2 Dec 2008 06:50:26 GMT (envelope-from peter@svn.freebsd.org) Received: (from peter@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mB26oQVx051423; Tue, 2 Dec 2008 06:50:26 GMT (envelope-from peter@svn.freebsd.org) Message-Id: <200812020650.mB26oQVx051423@svn.freebsd.org> From: Peter Wemm Date: Tue, 2 Dec 2008 06:50: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: r185548 - in head: lib/libutil sys sys/contrib/pf sys/kern sys/sys usr.bin/procstat X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 02 Dec 2008 06:50:27 -0000 Author: peter Date: Tue Dec 2 06:50:26 2008 New Revision: 185548 URL: http://svn.freebsd.org/changeset/base/185548 Log: Merge user/peter/kinfo branch as of r185547 into head. This changes struct kinfo_filedesc and kinfo_vmentry such that they are same on both 32 and 64 bit platforms like i386/amd64 and won't require sysctl wrapping. Two new OIDs are assigned. The old ones are available under COMPAT_FREEBSD7 - but it isn't that simple. The superceded interface was never actually released on 7.x. The other main change is to pack the data passed to userland via the sysctl. kf_structsize and kve_structsize are reduced for the copyout. If you have a process with 100,000+ sockets open, the unpacked records require a 132MB+ copyout. With packing, it is "only" ~35MB. (Still seriously unpleasant, but not quite as devastating). A similar problem exists for the vmentry structure - have lots and lots of shared libraries and small mmaps and its copyout gets expensive too. My immediate problem is valgrind. It traditionally achieves this functionality by parsing procfs output, in a packed format. Secondly, when tracing 32 bit binaries on amd64 under valgrind, it uses a cross compiled 32 bit binary which ran directly into the differing data structures in 32 vs 64 bit mode. (valgrind uses this to track file descriptor operations and this therefore affected every single 32 bit binary) I've added two utility functions to libutil to unpack the structures into a fixed record length and to make it a little more convenient to use. Added: head/lib/libutil/kinfo_getfile.c - copied unchanged from r185545, user/peter/kinfo/lib/libutil/kinfo_getfile.c head/lib/libutil/kinfo_getvmmap.c - copied unchanged from r185545, user/peter/kinfo/lib/libutil/kinfo_getvmmap.c Modified: head/lib/libutil/ (props changed) head/lib/libutil/Makefile head/lib/libutil/libutil.h head/sys/ (props changed) head/sys/contrib/pf/ (props changed) head/sys/kern/kern_descrip.c head/sys/kern/kern_proc.c head/sys/sys/sysctl.h head/sys/sys/user.h head/usr.bin/procstat/ (props changed) head/usr.bin/procstat/Makefile head/usr.bin/procstat/procstat_files.c head/usr.bin/procstat/procstat_vm.c Modified: head/lib/libutil/Makefile ============================================================================== --- head/lib/libutil/Makefile Tue Dec 2 06:34:08 2008 (r185547) +++ head/lib/libutil/Makefile Tue Dec 2 06:50:26 2008 (r185548) @@ -9,7 +9,8 @@ LIB= util SHLIB_MAJOR= 7 SRCS= _secure_path.c auth.c expand_number.c flopen.c fparseln.c gr_util.c \ - hexdump.c humanize_number.c kld.c login.c login_auth.c login_cap.c \ + hexdump.c humanize_number.c kinfo_getfile.c kinfo_getvmmap.c kld.c \ + login.c login_auth.c login_cap.c \ login_class.c login_crypt.c login_ok.c login_times.c login_tty.c \ logout.c logwtmp.c pidfile.c property.c pty.c pw_util.c realhostname.c \ stub.c trimdomain.c uucplock.c Copied: head/lib/libutil/kinfo_getfile.c (from r185545, user/peter/kinfo/lib/libutil/kinfo_getfile.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/lib/libutil/kinfo_getfile.c Tue Dec 2 06:50:26 2008 (r185548, copy of r185545, user/peter/kinfo/lib/libutil/kinfo_getfile.c) @@ -0,0 +1,72 @@ +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include +#include + +#include "libutil.h" + +struct kinfo_file * +kinfo_getfile(pid_t pid, int *cntp) +{ + int mib[4]; + int error; + int cnt; + size_t len; + char *buf, *bp, *eb; + struct kinfo_file *kif, *kp, *kf; + + len = 0; + mib[0] = CTL_KERN; + mib[1] = KERN_PROC; + mib[2] = KERN_PROC_FILEDESC; + mib[3] = pid; + + error = sysctl(mib, 4, NULL, &len, NULL, 0); + if (error) + return (0); + len = len * 4 / 3; + buf = malloc(len); + if (buf == NULL) + return (0); + error = sysctl(mib, 4, buf, &len, NULL, 0); + if (error) { + free(buf); + return (0); + } + /* Pass 1: count items */ + cnt = 0; + bp = buf; + eb = buf + len; + while (bp < eb) { + kf = (struct kinfo_file *)bp; + bp += kf->kf_structsize; + cnt++; + } + + kif = calloc(cnt, sizeof(*kif)); + if (kif == NULL) { + free(buf); + return (0); + } + bp = buf; + eb = buf + len; + kp = kif; + /* Pass 2: unpack */ + while (bp < eb) { + kf = (struct kinfo_file *)bp; + /* Copy/expand into pre-zeroed buffer */ + memcpy(kp, kf, kf->kf_structsize); + /* Advance to next packed record */ + bp += kf->kf_structsize; + /* Set field size to fixed length, advance */ + kp->kf_structsize = sizeof(*kp); + kp++; + } + free(buf); + *cntp = cnt; + return (kif); /* Caller must free() return value */ +} Copied: head/lib/libutil/kinfo_getvmmap.c (from r185545, user/peter/kinfo/lib/libutil/kinfo_getvmmap.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/lib/libutil/kinfo_getvmmap.c Tue Dec 2 06:50:26 2008 (r185548, copy of r185545, user/peter/kinfo/lib/libutil/kinfo_getvmmap.c) @@ -0,0 +1,72 @@ +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include +#include + +#include "libutil.h" + +struct kinfo_vmentry * +kinfo_getvmmap(pid_t pid, int *cntp) +{ + int mib[4]; + int error; + int cnt; + size_t len; + char *buf, *bp, *eb; + struct kinfo_vmentry *kiv, *kp, *kv; + + len = 0; + mib[0] = CTL_KERN; + mib[1] = KERN_PROC; + mib[2] = KERN_PROC_VMMAP; + mib[3] = pid; + + error = sysctl(mib, 4, NULL, &len, NULL, 0); + if (error) + return (0); + len = len * 4 / 3; + buf = malloc(len); + if (buf == NULL) + return (0); + error = sysctl(mib, 4, buf, &len, NULL, 0); + if (error) { + free(buf); + return (0); + } + /* Pass 1: count items */ + cnt = 0; + bp = buf; + eb = buf + len; + while (bp < eb) { + kv = (struct kinfo_vmentry *)bp; + bp += kv->kve_structsize; + cnt++; + } + + kiv = calloc(cnt, sizeof(*kiv)); + if (kiv == NULL) { + free(buf); + return (0); + } + bp = buf; + eb = buf + len; + kp = kiv; + /* Pass 2: unpack */ + while (bp < eb) { + kv = (struct kinfo_vmentry *)bp; + /* Copy/expand into pre-zeroed buffer */ + memcpy(kp, kv, kv->kve_structsize); + /* Advance to next packed record */ + bp += kv->kve_structsize; + /* Set field size to fixed length, advance */ + kp->kve_structsize = sizeof(*kp); + kp++; + } + free(buf); + *cntp = cnt; + return (kiv); /* Caller must free() return value */ +} Modified: head/lib/libutil/libutil.h ============================================================================== --- head/lib/libutil/libutil.h Tue Dec 2 06:34:08 2008 (r185547) +++ head/lib/libutil/libutil.h Tue Dec 2 06:50:26 2008 (r185548) @@ -64,6 +64,8 @@ struct termios; struct winsize; struct utmp; struct in_addr; +struct kinfo_file; +struct kinfo_vmentry; __BEGIN_DECLS void clean_environment(const char * const *_white, @@ -100,6 +102,10 @@ int realhostname_sa(char *host, size_t h int kld_isloaded(const char *name); int kld_load(const char *name); +struct kinfo_file * + kinfo_getfile(pid_t _pid, int *_cntp); +struct kinfo_vmentry * + kinfo_getvmmap(pid_t _pid, int *_cntp); #ifdef _STDIO_H_ /* avoid adding new includes */ char *fparseln(FILE *, size_t *, size_t *, const char[3], int); Modified: head/sys/kern/kern_descrip.c ============================================================================== --- head/sys/kern/kern_descrip.c Tue Dec 2 06:34:08 2008 (r185547) +++ head/sys/kern/kern_descrip.c Tue Dec 2 06:50:26 2008 (r185548) @@ -2509,6 +2509,259 @@ sysctl_kern_file(SYSCTL_HANDLER_ARGS) SYSCTL_PROC(_kern, KERN_FILE, file, CTLTYPE_OPAQUE|CTLFLAG_RD, 0, 0, sysctl_kern_file, "S,xfile", "Entire file table"); +#ifdef KINFO_OFILE_SIZE +CTASSERT(sizeof(struct kinfo_ofile) == KINFO_OFILE_SIZE); +#endif + +#ifdef COMPAT_FREEBSD7 +static int +export_vnode_for_osysctl(struct vnode *vp, int type, + struct kinfo_ofile *kif, struct filedesc *fdp, struct sysctl_req *req) +{ + int error; + char *fullpath, *freepath; + int vfslocked; + + bzero(kif, sizeof(*kif)); + kif->kf_structsize = sizeof(*kif); + + vref(vp); + kif->kf_fd = type; + kif->kf_type = KF_TYPE_VNODE; + /* This function only handles directories. */ + KASSERT(vp->v_type == VDIR, ("export_vnode_for_osysctl: vnode not directory")); + kif->kf_vnode_type = KF_VTYPE_VDIR; + + /* + * This is not a true file descriptor, so we set a bogus refcount + * and offset to indicate these fields should be ignored. + */ + kif->kf_ref_count = -1; + kif->kf_offset = -1; + + freepath = NULL; + fullpath = "-"; + FILEDESC_SUNLOCK(fdp); + vn_fullpath(curthread, vp, &fullpath, &freepath); + vfslocked = VFS_LOCK_GIANT(vp->v_mount); + vrele(vp); + VFS_UNLOCK_GIANT(vfslocked); + strlcpy(kif->kf_path, fullpath, sizeof(kif->kf_path)); + if (freepath != NULL) + free(freepath, M_TEMP); + error = SYSCTL_OUT(req, kif, sizeof(*kif)); + FILEDESC_SLOCK(fdp); + return (error); +} + +/* + * Get per-process file descriptors for use by procstat(1), et al. + */ +static int +sysctl_kern_proc_ofiledesc(SYSCTL_HANDLER_ARGS) +{ + char *fullpath, *freepath; + struct kinfo_ofile *kif; + struct filedesc *fdp; + int error, i, *name; + struct socket *so; + struct vnode *vp; + struct file *fp; + struct proc *p; + struct tty *tp; + int vfslocked; + + name = (int *)arg1; + if ((p = pfind((pid_t)name[0])) == NULL) + return (ESRCH); + if ((error = p_candebug(curthread, p))) { + PROC_UNLOCK(p); + return (error); + } + fdp = fdhold(p); + PROC_UNLOCK(p); + if (fdp == NULL) + return (ENOENT); + kif = malloc(sizeof(*kif), M_TEMP, M_WAITOK); + FILEDESC_SLOCK(fdp); + if (fdp->fd_cdir != NULL) + export_vnode_for_osysctl(fdp->fd_cdir, KF_FD_TYPE_CWD, kif, + fdp, req); + if (fdp->fd_rdir != NULL) + export_vnode_for_osysctl(fdp->fd_rdir, KF_FD_TYPE_ROOT, kif, + fdp, req); + if (fdp->fd_jdir != NULL) + export_vnode_for_osysctl(fdp->fd_jdir, KF_FD_TYPE_JAIL, kif, + fdp, req); + for (i = 0; i < fdp->fd_nfiles; i++) { + if ((fp = fdp->fd_ofiles[i]) == NULL) + continue; + bzero(kif, sizeof(*kif)); + kif->kf_structsize = sizeof(*kif); + vp = NULL; + so = NULL; + tp = NULL; + kif->kf_fd = i; + switch (fp->f_type) { + case DTYPE_VNODE: + kif->kf_type = KF_TYPE_VNODE; + vp = fp->f_vnode; + break; + + case DTYPE_SOCKET: + kif->kf_type = KF_TYPE_SOCKET; + so = fp->f_data; + break; + + case DTYPE_PIPE: + kif->kf_type = KF_TYPE_PIPE; + break; + + case DTYPE_FIFO: + kif->kf_type = KF_TYPE_FIFO; + vp = fp->f_vnode; + vref(vp); + break; + + case DTYPE_KQUEUE: + kif->kf_type = KF_TYPE_KQUEUE; + break; + + case DTYPE_CRYPTO: + kif->kf_type = KF_TYPE_CRYPTO; + break; + + case DTYPE_MQUEUE: + kif->kf_type = KF_TYPE_MQUEUE; + break; + + case DTYPE_SHM: + kif->kf_type = KF_TYPE_SHM; + break; + + case DTYPE_SEM: + kif->kf_type = KF_TYPE_SEM; + break; + + case DTYPE_PTS: + kif->kf_type = KF_TYPE_PTS; + tp = fp->f_data; + break; + + default: + kif->kf_type = KF_TYPE_UNKNOWN; + break; + } + kif->kf_ref_count = fp->f_count; + if (fp->f_flag & FREAD) + kif->kf_flags |= KF_FLAG_READ; + if (fp->f_flag & FWRITE) + kif->kf_flags |= KF_FLAG_WRITE; + if (fp->f_flag & FAPPEND) + kif->kf_flags |= KF_FLAG_APPEND; + if (fp->f_flag & FASYNC) + kif->kf_flags |= KF_FLAG_ASYNC; + if (fp->f_flag & FFSYNC) + kif->kf_flags |= KF_FLAG_FSYNC; + if (fp->f_flag & FNONBLOCK) + kif->kf_flags |= KF_FLAG_NONBLOCK; + if (fp->f_flag & O_DIRECT) + kif->kf_flags |= KF_FLAG_DIRECT; + if (fp->f_flag & FHASLOCK) + kif->kf_flags |= KF_FLAG_HASLOCK; + kif->kf_offset = fp->f_offset; + if (vp != NULL) { + vref(vp); + switch (vp->v_type) { + case VNON: + kif->kf_vnode_type = KF_VTYPE_VNON; + break; + case VREG: + kif->kf_vnode_type = KF_VTYPE_VREG; + break; + case VDIR: + kif->kf_vnode_type = KF_VTYPE_VDIR; + break; + case VBLK: + kif->kf_vnode_type = KF_VTYPE_VBLK; + break; + case VCHR: + kif->kf_vnode_type = KF_VTYPE_VCHR; + break; + case VLNK: + kif->kf_vnode_type = KF_VTYPE_VLNK; + break; + case VSOCK: + kif->kf_vnode_type = KF_VTYPE_VSOCK; + break; + case VFIFO: + kif->kf_vnode_type = KF_VTYPE_VFIFO; + break; + case VBAD: + kif->kf_vnode_type = KF_VTYPE_VBAD; + break; + default: + kif->kf_vnode_type = KF_VTYPE_UNKNOWN; + break; + } + /* + * It is OK to drop the filedesc lock here as we will + * re-validate and re-evaluate its properties when + * the loop continues. + */ + freepath = NULL; + fullpath = "-"; + FILEDESC_SUNLOCK(fdp); + vn_fullpath(curthread, vp, &fullpath, &freepath); + vfslocked = VFS_LOCK_GIANT(vp->v_mount); + vrele(vp); + VFS_UNLOCK_GIANT(vfslocked); + strlcpy(kif->kf_path, fullpath, + sizeof(kif->kf_path)); + if (freepath != NULL) + free(freepath, M_TEMP); + FILEDESC_SLOCK(fdp); + } + if (so != NULL) { + struct sockaddr *sa; + + if (so->so_proto->pr_usrreqs->pru_sockaddr(so, &sa) + == 0 && sa->sa_len <= sizeof(kif->kf_sa_local)) { + bcopy(sa, &kif->kf_sa_local, sa->sa_len); + free(sa, M_SONAME); + } + if (so->so_proto->pr_usrreqs->pru_peeraddr(so, &sa) + == 00 && sa->sa_len <= sizeof(kif->kf_sa_peer)) { + bcopy(sa, &kif->kf_sa_peer, sa->sa_len); + free(sa, M_SONAME); + } + kif->kf_sock_domain = + so->so_proto->pr_domain->dom_family; + kif->kf_sock_type = so->so_type; + kif->kf_sock_protocol = so->so_proto->pr_protocol; + } + if (tp != NULL) { + strlcpy(kif->kf_path, tty_devname(tp), + sizeof(kif->kf_path)); + } + error = SYSCTL_OUT(req, kif, sizeof(*kif)); + if (error) + break; + } + FILEDESC_SUNLOCK(fdp); + fddrop(fdp); + free(kif, M_TEMP); + return (0); +} + +static SYSCTL_NODE(_kern_proc, KERN_PROC_OFILEDESC, ofiledesc, CTLFLAG_RD, + sysctl_kern_proc_ofiledesc, "Process ofiledesc entries"); +#endif /* COMPAT_FREEBSD7 */ + +#ifdef KINFO_FILE_SIZE +CTASSERT(sizeof(struct kinfo_file) == KINFO_FILE_SIZE); +#endif + static int export_vnode_for_sysctl(struct vnode *vp, int type, struct kinfo_file *kif, struct filedesc *fdp, struct sysctl_req *req) @@ -2518,7 +2771,6 @@ export_vnode_for_sysctl(struct vnode *vp int vfslocked; bzero(kif, sizeof(*kif)); - kif->kf_structsize = sizeof(*kif); vref(vp); kif->kf_fd = type; @@ -2544,7 +2796,11 @@ export_vnode_for_sysctl(struct vnode *vp strlcpy(kif->kf_path, fullpath, sizeof(kif->kf_path)); if (freepath != NULL) free(freepath, M_TEMP); - error = SYSCTL_OUT(req, kif, sizeof(*kif)); + /* Pack record size down */ + kif->kf_structsize = offsetof(struct kinfo_file, kf_path) + + strlen(kif->kf_path) + 1; + kif->kf_structsize = roundup(kif->kf_structsize, sizeof(uint64_t)); + error = SYSCTL_OUT(req, kif, kif->kf_structsize); FILEDESC_SLOCK(fdp); return (error); } @@ -2592,7 +2848,6 @@ sysctl_kern_proc_filedesc(SYSCTL_HANDLER if ((fp = fdp->fd_ofiles[i]) == NULL) continue; bzero(kif, sizeof(*kif)); - kif->kf_structsize = sizeof(*kif); vp = NULL; so = NULL; tp = NULL; @@ -2739,7 +2994,12 @@ sysctl_kern_proc_filedesc(SYSCTL_HANDLER strlcpy(kif->kf_path, tty_devname(tp), sizeof(kif->kf_path)); } - error = SYSCTL_OUT(req, kif, sizeof(*kif)); + /* Pack record size down */ + kif->kf_structsize = offsetof(struct kinfo_file, kf_path) + + strlen(kif->kf_path) + 1; + kif->kf_structsize = roundup(kif->kf_structsize, + sizeof(uint64_t)); + error = SYSCTL_OUT(req, kif, kif->kf_structsize); if (error) break; } Modified: head/sys/kern/kern_proc.c ============================================================================== --- head/sys/kern/kern_proc.c Tue Dec 2 06:34:08 2008 (r185547) +++ head/sys/kern/kern_proc.c Tue Dec 2 06:50:26 2008 (r185548) @@ -32,6 +32,7 @@ #include __FBSDID("$FreeBSD$"); +#include "opt_compat.h" #include "opt_ddb.h" #include "opt_kdtrace.h" #include "opt_ktrace.h" @@ -1337,13 +1338,18 @@ sysctl_kern_proc_sv_name(SYSCTL_HANDLER_ return (sysctl_handle_string(oidp, sv_name, 0, req)); } +#ifdef KINFO_OVMENTRY_SIZE +CTASSERT(sizeof(struct kinfo_ovmentry) == KINFO_OVMENTRY_SIZE); +#endif + +#ifdef COMPAT_FREEBSD7 static int -sysctl_kern_proc_vmmap(SYSCTL_HANDLER_ARGS) +sysctl_kern_proc_ovmmap(SYSCTL_HANDLER_ARGS) { vm_map_entry_t entry, tmp_entry; unsigned int last_timestamp; char *fullpath, *freepath; - struct kinfo_vmentry *kve; + struct kinfo_ovmentry *kve; struct vattr va; struct ucred *cred; int error, *name; @@ -1497,6 +1503,176 @@ sysctl_kern_proc_vmmap(SYSCTL_HANDLER_AR free(kve, M_TEMP); return (error); } +#endif /* COMPAT_FREEBSD7 */ + +#ifdef KINFO_VMENTRY_SIZE +CTASSERT(sizeof(struct kinfo_vmentry) == KINFO_VMENTRY_SIZE); +#endif + +static int +sysctl_kern_proc_vmmap(SYSCTL_HANDLER_ARGS) +{ + vm_map_entry_t entry, tmp_entry; + unsigned int last_timestamp; + char *fullpath, *freepath; + struct kinfo_vmentry *kve; + struct vattr va; + struct ucred *cred; + int error, *name; + struct vnode *vp; + struct proc *p; + vm_map_t map; + + name = (int *)arg1; + if ((p = pfind((pid_t)name[0])) == NULL) + return (ESRCH); + if (p->p_flag & P_WEXIT) { + PROC_UNLOCK(p); + return (ESRCH); + } + if ((error = p_candebug(curthread, p))) { + PROC_UNLOCK(p); + return (error); + } + _PHOLD(p); + PROC_UNLOCK(p); + + kve = malloc(sizeof(*kve), M_TEMP, M_WAITOK); + + map = &p->p_vmspace->vm_map; /* XXXRW: More locking required? */ + vm_map_lock_read(map); + for (entry = map->header.next; entry != &map->header; + entry = entry->next) { + vm_object_t obj, tobj, lobj; + vm_offset_t addr; + int vfslocked; + + if (entry->eflags & MAP_ENTRY_IS_SUB_MAP) + continue; + + bzero(kve, sizeof(*kve)); + + kve->kve_private_resident = 0; + obj = entry->object.vm_object; + if (obj != NULL) { + VM_OBJECT_LOCK(obj); + if (obj->shadow_count == 1) + kve->kve_private_resident = + obj->resident_page_count; + } + kve->kve_resident = 0; + addr = entry->start; + while (addr < entry->end) { + if (pmap_extract(map->pmap, addr)) + kve->kve_resident++; + addr += PAGE_SIZE; + } + + for (lobj = tobj = obj; tobj; tobj = tobj->backing_object) { + if (tobj != obj) + VM_OBJECT_LOCK(tobj); + if (lobj != obj) + VM_OBJECT_UNLOCK(lobj); + lobj = tobj; + } + + kve->kve_fileid = 0; + kve->kve_fsid = 0; + freepath = NULL; + fullpath = ""; + if (lobj) { + vp = NULL; + switch(lobj->type) { + case OBJT_DEFAULT: + kve->kve_type = KVME_TYPE_DEFAULT; + break; + case OBJT_VNODE: + kve->kve_type = KVME_TYPE_VNODE; + vp = lobj->handle; + vref(vp); + break; + case OBJT_SWAP: + kve->kve_type = KVME_TYPE_SWAP; + break; + case OBJT_DEVICE: + kve->kve_type = KVME_TYPE_DEVICE; + break; + case OBJT_PHYS: + kve->kve_type = KVME_TYPE_PHYS; + break; + case OBJT_DEAD: + kve->kve_type = KVME_TYPE_DEAD; + break; + default: + kve->kve_type = KVME_TYPE_UNKNOWN; + break; + } + if (lobj != obj) + VM_OBJECT_UNLOCK(lobj); + + kve->kve_ref_count = obj->ref_count; + kve->kve_shadow_count = obj->shadow_count; + VM_OBJECT_UNLOCK(obj); + if (vp != NULL) { + vn_fullpath(curthread, vp, &fullpath, + &freepath); + cred = curthread->td_ucred; + vfslocked = VFS_LOCK_GIANT(vp->v_mount); + vn_lock(vp, LK_SHARED | LK_RETRY); + if (VOP_GETATTR(vp, &va, cred) == 0) { + kve->kve_fileid = va.va_fileid; + kve->kve_fsid = va.va_fsid; + } + vput(vp); + VFS_UNLOCK_GIANT(vfslocked); + } + } else { + kve->kve_type = KVME_TYPE_NONE; + kve->kve_ref_count = 0; + kve->kve_shadow_count = 0; + } + + kve->kve_start = entry->start; + kve->kve_end = entry->end; + kve->kve_offset = entry->offset; + + if (entry->protection & VM_PROT_READ) + kve->kve_protection |= KVME_PROT_READ; + if (entry->protection & VM_PROT_WRITE) + kve->kve_protection |= KVME_PROT_WRITE; + if (entry->protection & VM_PROT_EXECUTE) + kve->kve_protection |= KVME_PROT_EXEC; + + if (entry->eflags & MAP_ENTRY_COW) + kve->kve_flags |= KVME_FLAG_COW; + if (entry->eflags & MAP_ENTRY_NEEDS_COPY) + kve->kve_flags |= KVME_FLAG_NEEDS_COPY; + + strlcpy(kve->kve_path, fullpath, sizeof(kve->kve_path)); + if (freepath != NULL) + free(freepath, M_TEMP); + + last_timestamp = map->timestamp; + vm_map_unlock_read(map); + /* Pack record size down */ + kve->kve_structsize = offsetof(struct kinfo_vmentry, kve_path) + + strlen(kve->kve_path) + 1; + kve->kve_structsize = roundup(kve->kve_structsize, + sizeof(uint64_t)); + error = SYSCTL_OUT(req, kve, kve->kve_structsize); + vm_map_lock_read(map); + if (error) + break; + if (last_timestamp + 1 != map->timestamp) { + vm_map_lookup_entry(map, addr - 1, &tmp_entry); + entry = tmp_entry; + } + } + vm_map_unlock_read(map); + PRELE(p); + free(kve, M_TEMP); + return (error); +} #if defined(STACK) || defined(DDB) static int @@ -1669,6 +1845,11 @@ static SYSCTL_NODE(_kern_proc, (KERN_PRO static SYSCTL_NODE(_kern_proc, (KERN_PROC_PROC | KERN_PROC_INC_THREAD), proc_td, CTLFLAG_RD, sysctl_kern_proc, "Return process table, no threads"); +#ifdef COMPAT_FREEBSD7 +static SYSCTL_NODE(_kern_proc, KERN_PROC_OVMMAP, ovmmap, CTLFLAG_RD, + sysctl_kern_proc_ovmmap, "Old Process vm map entries"); +#endif + static SYSCTL_NODE(_kern_proc, KERN_PROC_VMMAP, vmmap, CTLFLAG_RD, sysctl_kern_proc_vmmap, "Process vm map entries"); Modified: head/sys/sys/sysctl.h ============================================================================== --- head/sys/sys/sysctl.h Tue Dec 2 06:34:08 2008 (r185547) +++ head/sys/sys/sysctl.h Tue Dec 2 06:50:26 2008 (r185548) @@ -540,13 +540,16 @@ TAILQ_HEAD(sysctl_ctx_list, sysctl_ctx_e #define KERN_PROC_RGID 10 /* by real group id */ #define KERN_PROC_GID 11 /* by effective group id */ #define KERN_PROC_PATHNAME 12 /* path to executable */ -#define KERN_PROC_VMMAP 13 /* VM map entries for process */ -#define KERN_PROC_FILEDESC 14 /* File descriptors for process */ +#define KERN_PROC_OVMMAP 13 /* Old VM map entries for process */ +#define KERN_PROC_OFILEDESC 14 /* Old file descriptors for process */ #define KERN_PROC_KSTACK 15 /* Kernel stacks for process */ #define KERN_PROC_INC_THREAD 0x10 /* * modifier for pid, pgrp, tty, * uid, ruid, gid, rgid and proc + * This effectively uses 16-31 */ +#define KERN_PROC_VMMAP 32 /* VM map entries for process */ +#define KERN_PROC_FILEDESC 33 /* File descriptors for process */ /* * KERN_IPC identifiers Modified: head/sys/sys/user.h ============================================================================== --- head/sys/sys/user.h Tue Dec 2 06:34:08 2008 (r185547) +++ head/sys/sys/user.h Tue Dec 2 06:50:26 2008 (r185548) @@ -277,20 +277,55 @@ struct user { #define KF_FLAG_DIRECT 0x00000040 #define KF_FLAG_HASLOCK 0x00000080 -struct kinfo_file { +/* + * Old format. Has variable hidden padding due to alignment. + * This is a compatability hack for pre-build 7.1 packages. + */ +#if defined(__amd64__) +#define KINFO_OFILE_SIZE 1328 +#endif +#if defined(__i386__) +#define KINFO_OFILE_SIZE 1324 +#endif + +struct kinfo_ofile { int kf_structsize; /* Size of kinfo_file. */ int kf_type; /* Descriptor type. */ int kf_fd; /* Array index. */ int kf_ref_count; /* Reference count. */ int kf_flags; /* Flags. */ + /* XXX Hidden alignment padding here on amd64 */ off_t kf_offset; /* Seek location. */ int kf_vnode_type; /* Vnode type. */ int kf_sock_domain; /* Socket domain. */ int kf_sock_type; /* Socket type. */ int kf_sock_protocol; /* Socket protocol. */ - char kf_path[PATH_MAX]; /* Path to file, if any. */ + char kf_path[PATH_MAX]; /* Path to file, if any. */ + struct sockaddr_storage kf_sa_local; /* Socket address. */ + struct sockaddr_storage kf_sa_peer; /* Peer address. */ +}; + +#if defined(__amd64__) || defined(__i386__) +#define KINFO_FILE_SIZE 1392 +#endif + +struct kinfo_file { + int kf_structsize; /* Variable size of record. */ + int kf_type; /* Descriptor type. */ + int kf_fd; /* Array index. */ + int kf_ref_count; /* Reference count. */ + int kf_flags; /* Flags. */ + int _kf_pad0; /* Round to 64 bit alignment */ + uint64_t kf_offset; /* Seek location. */ + int kf_vnode_type; /* Vnode type. */ + int kf_sock_domain; /* Socket domain. */ + int kf_sock_type; /* Socket type. */ + int kf_sock_protocol; /* Socket protocol. */ struct sockaddr_storage kf_sa_local; /* Socket address. */ struct sockaddr_storage kf_sa_peer; /* Peer address. */ + int _kf_ispare[16]; /* Space for more stuff. */ + /* Truncated before copyout in sysctl */ + char kf_path[PATH_MAX]; /* Path to file, if any. */ }; /* @@ -313,11 +348,18 @@ struct kinfo_file { #define KVME_FLAG_COW 0x00000001 #define KVME_FLAG_NEEDS_COPY 0x00000002 -struct kinfo_vmentry { +#if defined(__amd64__) +#define KINFO_OVMENTRY_SIZE 1168 +#endif +#if defined(__i386__) +#define KINFO_OVMENTRY_SIZE 1128 +#endif + +struct kinfo_ovmentry { int kve_structsize; /* Size of kinfo_vmmapentry. */ int kve_type; /* Type of map entry. */ - void *kve_start; /* Starting pointer. */ - void *kve_end; /* Finishing pointer. */ + void *kve_start; /* Starting address. */ + void *kve_end; /* Finishing address. */ int kve_flags; /* Flags on map entry. */ int kve_resident; /* Number of resident pages. */ int kve_private_resident; /* Number of private pages. */ @@ -327,11 +369,35 @@ struct kinfo_vmentry { char kve_path[PATH_MAX]; /* Path to VM obj, if any. */ void *_kve_pspare[8]; /* Space for more stuff. */ off_t kve_offset; /* Mapping offset in object */ - uint64_t kve_fileid; /* inode number of vnode */ + uint64_t kve_fileid; /* inode number if vnode */ dev_t kve_fsid; /* dev_t of vnode location */ int _kve_ispare[3]; /* Space for more stuff. */ }; +#if defined(__amd64__) || defined(__i386__) +#define KINFO_VMENTRY_SIZE 1160 +#endif + +struct kinfo_vmentry { + int kve_structsize; /* Variable size of record. */ + int kve_type; /* Type of map entry. */ + uint64_t kve_start; /* Starting address. */ + uint64_t kve_end; /* Finishing address. */ + uint64_t kve_offset; /* Mapping offset in object */ + uint64_t kve_fileid; /* inode number if vnode */ + uint32_t kve_fsid; /* dev_t of vnode location */ + int kve_flags; /* Flags on map entry. */ + int kve_resident; /* Number of resident pages. */ + int kve_private_resident; /* Number of private pages. */ + int kve_protection; /* Protection bitmask. */ + int kve_ref_count; /* VM obj ref count. */ + int kve_shadow_count; /* VM obj shadow count. */ + int _kve_pad0; /* 64bit align next field */ + int _kve_ispare[16]; /* Space for more stuff. */ + /* Truncated before copyout in sysctl */ + char kve_path[PATH_MAX]; /* Path to VM obj, if any. */ +}; + /* * The KERN_PROC_KSTACK sysctl allows a process to dump the kernel stacks of * another process as a series of entries. Each stack is represented by a @@ -343,12 +409,15 @@ struct kinfo_vmentry { #define KKST_STATE_SWAPPED 1 /* Stack swapped out. */ #define KKST_STATE_RUNNING 2 /* Stack ephemeral. */ +#if defined(__amd64__) || defined(__i386__) +#define KINFO_KSTACK_SIZE 1096 +#endif + struct kinfo_kstack { lwpid_t kkst_tid; /* ID of thread. */ int kkst_state; /* Validity of stack. */ char kkst_trace[KKST_MAXLEN]; /* String representing stack. */ - void *_kkst_pspare[8]; /* Space for more stuff. */ - int _kkst_ispare[8]; /* Space for more stuff. */ + int _kkst_ispare[16]; /* Space for more stuff. */ }; #endif Modified: head/usr.bin/procstat/Makefile ============================================================================== --- head/usr.bin/procstat/Makefile Tue Dec 2 06:34:08 2008 (r185547) +++ head/usr.bin/procstat/Makefile Tue Dec 2 06:50:26 2008 (r185548) @@ -12,4 +12,8 @@ SRCS= procstat.c \ procstat_threads.c \ procstat_vm.c +LDADD+= -lutil +DPADD+= ${LIBUTIL} +WARNS?= 4 + .include Modified: head/usr.bin/procstat/procstat_files.c ============================================================================== --- head/usr.bin/procstat/procstat_files.c Tue Dec 2 06:34:08 2008 (r185547) +++ head/usr.bin/procstat/procstat_files.c Tue Dec 2 06:50:26 2008 (r185548) @@ -41,6 +41,7 @@ #include #include #include +#include #include "procstat.h" @@ -134,42 +135,18 @@ void procstat_files(pid_t pid, struct kinfo_proc *kipp) { struct kinfo_file *freep, *kif; - int error, name[4]; - unsigned int i; + int i, cnt; const char *str; - size_t len; if (!hflag) printf("%5s %-16s %4s %1s %1s %-8s %3s %7s %-3s %-12s\n", "PID", "COMM", "FD", "T", "V", "FLAGS", "REF", "OFFSET", "PRO", "NAME"); - name[0] = CTL_KERN; - name[1] = KERN_PROC; - name[2] = KERN_PROC_FILEDESC; - name[3] = pid; - - error = sysctl(name, 4, NULL, &len, NULL, 0); - if (error < 0 && errno != ESRCH && errno != EPERM) { - warn("sysctl: kern.proc.filedesc: %d", pid); - return; - } - if (error < 0) - return; - - freep = kif = malloc(len); - if (kif == NULL) - err(-1, "malloc"); - - if (sysctl(name, 4, kif, &len, NULL, 0) < 0) { - warn("sysctl: kern.proc.filedesc %d", pid); - free(freep); - return; - } - - for (i = 0; i < len / sizeof(*kif); i++, kif++) { - if (kif->kf_structsize != sizeof(*kif)) - errx(-1, "kinfo_file mismatch"); + freep = kinfo_getfile(pid, &cnt); + for (i = 0; i < cnt; i++) { + kif = &freep[i]; + printf("%5d ", pid); printf("%-16s ", kipp->ki_comm); switch (kif->kf_fd) { Modified: head/usr.bin/procstat/procstat_vm.c ============================================================================== --- head/usr.bin/procstat/procstat_vm.c Tue Dec 2 06:34:08 2008 (r185547) +++ head/usr.bin/procstat/procstat_vm.c Tue Dec 2 06:50:26 2008 (r185548) @@ -34,6 +34,7 @@ #include #include #include +#include #include "procstat.h" @@ -41,10 +42,9 @@ void procstat_vm(pid_t pid, struct kinfo_proc *kipp __unused) { struct kinfo_vmentry *freep, *kve; - int error, name[4], ptrwidth; - unsigned int i; + int ptrwidth; + int i, cnt; const char *str; - size_t len; ptrwidth = 2*sizeof(void *) + 2; if (!hflag) @@ -52,38 +52,9 @@ procstat_vm(pid_t pid, struct kinfo_proc "PID", ptrwidth, "START", ptrwidth, "END", "PRT", "RES", "PRES", "REF", "SHD", "FL", "TP", "PATH"); - name[0] = CTL_KERN; - name[1] = KERN_PROC; - name[2] = KERN_PROC_VMMAP; - name[3] = pid; - - len = 0; - error = sysctl(name, 4, NULL, &len, NULL, 0); - if (error < 0 && errno != ESRCH && errno != EPERM) { - warn("sysctl: kern.proc.vmmap: %d", pid); - return; - } - if (error < 0) - return; - - /* - * Especially if running procstat -sv, we may need room for more - * mappings when printing than were present when we queried, so pad - * out the allocation a bit. - */ - len += sizeof(*kve) * 3; - freep = kve = malloc(len); - if (kve == NULL) - err(-1, "malloc"); - if (sysctl(name, 4, kve, &len, NULL, 0) < 0) { - warn("sysctl: kern.proc.vmmap: %d", pid); - free(freep); - return; - } - - for (i = 0; i < (len / sizeof(*kve)); i++, kve++) { - if (kve->kve_structsize != sizeof(*kve)) - errx(-1, "kinfo_vmentry structure mismatch"); + freep = kinfo_getvmmap(pid, &cnt); + for (i = 0; i < cnt; i++) { + kve = &freep[i]; printf("%5d ", pid); printf("%*p ", ptrwidth, kve->kve_start); *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@FreeBSD.ORG Tue Dec 2 07:01:18 2008 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D03FF1065670; Tue, 2 Dec 2008 07:01:18 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id CCC048FC0A; Tue, 2 Dec 2008 07:01:18 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mB271IOR051799; Tue, 2 Dec 2008 07:01:18 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mB271IWm051798; Tue, 2 Dec 2008 07:01:18 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200812020701.mB271IWm051798@svn.freebsd.org> From: Kip Macy Date: Tue, 2 Dec 2008 07:01: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: r185549 - head/sys/dev/cxgb X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 02 Dec 2008 07:01:18 -0000 Author: kmacy Date: Tue Dec 2 07:01:18 2008 New Revision: 185549 URL: http://svn.freebsd.org/changeset/base/185549 Log: - fix bug where dnsperf would stop transmitting after a few seconds - break complex conditionals in to multiple lines to avoid wrapping - remove copious unused debug statements - be more aggressive about cleaning in the calling thread - eliminate usage of ENOSPC - increase number of iterations that cxgbsp can do - eliminate "initerr" usage to simplify ENOBUFS handling - when coalescing pass all packets to BPF - always set overrun if hardware queue is full Modified: head/sys/dev/cxgb/cxgb_multiq.c Modified: head/sys/dev/cxgb/cxgb_multiq.c ============================================================================== --- head/sys/dev/cxgb/cxgb_multiq.c Tue Dec 2 06:50:26 2008 (r185548) +++ head/sys/dev/cxgb/cxgb_multiq.c Tue Dec 2 07:01:18 2008 (r185549) @@ -128,7 +128,8 @@ cxgb_pcpu_enqueue_packet_(struct sge_qse txq->txq_drops++; m_freem(m); } - if (wakeup_tx_thread && ((txq->flags & TXQ_TRANSMITTING) == 0)) + if (wakeup_tx_thread && !err && + ((txq->flags & TXQ_TRANSMITTING) == 0)) wakeup(qs); return (err); @@ -195,7 +196,6 @@ cxgb_dequeue_packet(struct sge_txq *txq, return (0); if (txq->immpkt != NULL) { - DPRINTF("immediate packet\n"); m_vec[0] = txq->immpkt; txq->immpkt = NULL; return (1); @@ -209,8 +209,10 @@ cxgb_dequeue_packet(struct sge_txq *txq, count = 1; m_vec[0] = m; - if (m->m_pkthdr.tso_segsz > 0 || m->m_pkthdr.len > TX_WR_SIZE_MAX || - m->m_next != NULL || (coalesce_tx_enable == 0)) { + if (m->m_pkthdr.tso_segsz > 0 || + m->m_pkthdr.len > TX_WR_SIZE_MAX || + m->m_next != NULL || + (coalesce_tx_enable == 0)) { return (count); } @@ -218,8 +220,9 @@ cxgb_dequeue_packet(struct sge_txq *txq, for (m = buf_ring_peek(txq->txq_mr); m != NULL; m = buf_ring_peek(txq->txq_mr)) { - if (m->m_pkthdr.tso_segsz > 0 || - size + m->m_pkthdr.len > TX_WR_SIZE_MAX || m->m_next != NULL) + if (m->m_pkthdr.tso_segsz > 0 + || size + m->m_pkthdr.len > TX_WR_SIZE_MAX + || m->m_next != NULL) break; m0 = buf_ring_dequeue_sc(txq->txq_mr); @@ -315,39 +318,30 @@ cxgb_pcpu_start_(struct sge_qset *qs, st immpkt = NULL; } - if (initerr && initerr != ENOBUFS) { - if (cxgb_debug) - log(LOG_WARNING, "cxgb link down\n"); + if (initerr) { if (immpkt) m_freem(immpkt); + if (initerr == ENOBUFS && !tx_flush) + wakeup(qs); return (initerr); } if ((tx_flush && (desc_reclaimable(txq) > 0)) || - (desc_reclaimable(txq) > (TX_ETH_Q_SIZE>>1))) { - int reclaimed = 0; - - if (cxgb_debug) { - device_printf(qs->port->adapter->dev, - "cpuid=%d curcpu=%d reclaimable=%d txq=%p txq->cidx=%d txq->pidx=%d ", - qs->qs_cpuid, curcpu, desc_reclaimable(txq), - txq, txq->cidx, txq->pidx); - } - reclaimed = cxgb_pcpu_reclaim_tx(txq); - if (cxgb_debug) - printf("reclaimed=%d\n", reclaimed); + (desc_reclaimable(txq) > (TX_ETH_Q_SIZE>>3))) { + cxgb_pcpu_reclaim_tx(txq); } stopped = isset(&qs->txq_stopped, TXQ_ETH); - flush = (((!buf_ring_empty(txq->txq_mr) || (!IFQ_DRV_IS_EMPTY(&pi->ifp->if_snd))) && !stopped) || txq->immpkt); + flush = (( +#ifdef IFNET_MULTIQUEUE + !buf_ring_empty(txq->txq_mr) +#else + !IFQ_DRV_IS_EMPTY(&pi->ifp->if_snd) +#endif + && !stopped) || txq->immpkt); max_desc = tx_flush ? TX_ETH_Q_SIZE : TX_START_MAX_DESC; - - if (cxgb_debug) - DPRINTF("stopped=%d flush=%d max_desc=%d\n", - stopped, flush, max_desc); - err = flush ? cxgb_tx(qs, max_desc) : ENOSPC; - + err = flush ? cxgb_tx(qs, max_desc) : 0; if ((tx_flush && flush && err == 0) && (!buf_ring_empty(txq->txq_mr) || @@ -359,16 +353,13 @@ cxgb_pcpu_start_(struct sge_qset *qs, st sched_prio(td, PRI_MIN_TIMESHARE); thread_unlock(td); } - if (i > 50) { - if (cxgb_debug) - device_printf(qs->port->adapter->dev, + if (i > 200) { + device_printf(qs->port->adapter->dev, "exceeded max enqueue tries\n"); return (EBUSY); } goto retry; } - err = (initerr != 0) ? initerr : err; - return (err); } @@ -391,32 +382,22 @@ cxgb_pcpu_transmit(struct ifnet *ifp, st if (immpkt && (immpkt->m_pkthdr.flowid != 0)) { cookie = immpkt->m_pkthdr.flowid; qidx = cxgb_pcpu_cookie_to_qidx(pi, cookie); - DPRINTF("hash=0x%x qidx=%d cpu=%d\n", immpkt->m_pkthdr.flowid, qidx, curcpu); qs = &pi->adapter->sge.qs[qidx]; } else #endif qs = &pi->adapter->sge.qs[pi->first_qset]; txq = &qs->txq[TXQ_ETH]; - if (((sc->tunq_coalesce == 0) || (buf_ring_count(txq->txq_mr) >= TX_WR_COUNT_MAX) || (coalesce_tx_enable == 0)) && mtx_trylock(&txq->lock)) { - if (cxgb_debug) - printf("doing immediate transmit\n"); - txq->flags |= TXQ_TRANSMITTING; err = cxgb_pcpu_start_(qs, immpkt, FALSE); txq->flags &= ~TXQ_TRANSMITTING; - resid = (buf_ring_count(txq->txq_mr) > 64) || (desc_reclaimable(txq) > 64); mtx_unlock(&txq->lock); - } else if (immpkt) { - if (cxgb_debug) - printf("deferred coalesce=%jx ring_count=%d mtx_owned=%d\n", - sc->tunq_coalesce, buf_ring_count(txq->txq_mr), mtx_owned(&txq->lock)); - err = cxgb_pcpu_enqueue_packet_(qs, immpkt); - } - return ((err == ENOSPC) ? 0 : err); + } else if (immpkt) + return (cxgb_pcpu_enqueue_packet_(qs, immpkt)); + return ((err == EBUSY) ? 0 : err); } void @@ -624,29 +605,23 @@ cxgb_tx(struct sge_qset *qs, uint32_t tx txq = &qs->txq[TXQ_ETH]; ifp = qs->port->ifp; in_use_init = txq->in_use; - err = 0; - - for (i = 0; i < TX_WR_COUNT_MAX; i++) - m_vec[i] = NULL; + count = err = 0; mtx_assert(&txq->lock, MA_OWNED); while ((txq->in_use - in_use_init < txmax) && (txq->size > txq->in_use + TX_MAX_DESC)) { check_pkt_coalesce(qs); count = cxgb_dequeue_packet(txq, m_vec); - if (count == 0) { - err = ENOSPC; + if (count == 0) break; - } - ETHER_BPF_MTAP(ifp, m_vec[0]); + for (i = 0; i < count; i++) + ETHER_BPF_MTAP(ifp, m_vec[i]); if ((err = t3_encap(qs, m_vec, count)) != 0) break; txq->txq_enqueued += count; - m_vec[0] = NULL; } - if ((err == 0) && (txq->size <= txq->in_use + TX_MAX_DESC)) { - err = ENOBUFS; + if (txq->size <= txq->in_use + TX_MAX_DESC) { txq_fills++; setbit(&qs->txq_stopped, TXQ_ETH); } From owner-svn-src-head@FreeBSD.ORG Tue Dec 2 07:22:45 2008 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 017BC106564A for ; Tue, 2 Dec 2008 07:22:45 +0000 (UTC) (envelope-from peter@wemm.org) Received: from rv-out-0506.google.com (rv-out-0506.google.com [209.85.198.237]) by mx1.freebsd.org (Postfix) with ESMTP id E32538FC17 for ; Tue, 2 Dec 2008 07:22:44 +0000 (UTC) (envelope-from peter@wemm.org) Received: by rv-out-0506.google.com with SMTP id b25so2790080rvf.43 for ; Mon, 01 Dec 2008 23:22:44 -0800 (PST) Received: by 10.142.52.9 with SMTP id z9mr4819533wfz.82.1228202564470; Mon, 01 Dec 2008 23:22:44 -0800 (PST) Received: by 10.142.255.21 with HTTP; Mon, 1 Dec 2008 23:22:44 -0800 (PST) Message-ID: Date: Mon, 1 Dec 2008 23:22:44 -0800 From: "Peter Wemm" To: "M. Warner Losh" In-Reply-To: <20081201.220808.1649770636.imp@bsdimp.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <200812020226.mB22QFtl045542@svn.freebsd.org> <20081201.220808.1649770636.imp@bsdimp.com> Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r185539 - in head/sys: arm/at91 dev/mn kern security/mac security/mac_bsdextended X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 02 Dec 2008 07:22:45 -0000 On Mon, Dec 1, 2008 at 9:08 PM, M. Warner Losh wrote: > In message: <200812020226.mB22QFtl045542@svn.freebsd.org> > Peter Wemm writes: > : Author: peter > : Date: Tue Dec 2 02:26:15 2008 > : New Revision: 185539 > : URL: http://svn.freebsd.org/changeset/base/185539 > : > : Log: > : Delete a bunch of empty mergeinfo records caused by local copies. > : > : Modified: > : head/sys/arm/at91/at91_machdep.c (props changed) > : head/sys/arm/at91/board_bwct.c (props changed) > : head/sys/arm/at91/board_hl200.c (props changed) > : head/sys/arm/at91/board_kb920x.c (props changed) > : head/sys/arm/at91/board_tsc4370.c (props changed) > : head/sys/arm/at91/std.bwct (props changed) > : head/sys/arm/at91/std.hl200 (props changed) > : head/sys/arm/at91/std.tsc4370 (props changed) > : head/sys/dev/mn/if_mn.c (props changed) > : head/sys/kern/kern_cons.c (props changed) > : head/sys/security/mac/mac_cred.c (props changed) > : head/sys/security/mac_bsdextended/ugidfw_system.c (props changed) > : head/sys/security/mac_bsdextended/ugidfw_vnode.c (props changed) > > Is there some way the developer that does the copies can do this so > you don't need to do this? Yes. It sounds strange, but specify a full repo-relative path. instead of: $ cd head/sys/kern $ svn cp kern_tty.c kern_cons.c $ ..stuff.. $ svn commit you should do this: $ cd head/sys/kern $ svn cp $REPO/head/sys/kern/kern_tty.c kern_cons.c $ ..stuff.. $ svn commit The difference is that in the second form the command can chase inherited mergeinfo around wherever it may lead and make sure that side effects are accounted for. In the first form, the command doesn't have access to mergeinfo inheritance info so it has to make an empty 'I have no idea!' mergeinfo to block any inheritance that *might* be there. -- Peter Wemm - peter@wemm.org; peter@FreeBSD.org; peter@yahoo-inc.com; KI6FJV "All of this is for nothing if we don't go to the stars" - JMS/B5 "If Java had true garbage collection, most programs would delete themselves upon execution." -- Robert Sewell From owner-svn-src-head@FreeBSD.ORG Tue Dec 2 10:10:51 2008 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0D337106567A; Tue, 2 Dec 2008 10:10:51 +0000 (UTC) (envelope-from peter@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 01C5A8FC25; Tue, 2 Dec 2008 10:10:51 +0000 (UTC) (envelope-from peter@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mB2AAoaW055811; Tue, 2 Dec 2008 10:10:50 GMT (envelope-from peter@svn.freebsd.org) Received: (from peter@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mB2AAowJ055809; Tue, 2 Dec 2008 10:10:50 GMT (envelope-from peter@svn.freebsd.org) Message-Id: <200812021010.mB2AAowJ055809@svn.freebsd.org> From: Peter Wemm Date: Tue, 2 Dec 2008 10:10: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: r185553 - head/lib/libutil X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 02 Dec 2008 10:10:51 -0000 Author: peter Date: Tue Dec 2 10:10:50 2008 New Revision: 185553 URL: http://svn.freebsd.org/changeset/base/185553 Log: Attempt a quick bandaid for arm build breakage. I went to the trouble of maintaining alignment, but I'm not sure how to tell gcc this. Modified: head/lib/libutil/kinfo_getfile.c head/lib/libutil/kinfo_getvmmap.c Modified: head/lib/libutil/kinfo_getfile.c ============================================================================== --- head/lib/libutil/kinfo_getfile.c Tue Dec 2 08:23:45 2008 (r185552) +++ head/lib/libutil/kinfo_getfile.c Tue Dec 2 10:10:50 2008 (r185553) @@ -42,7 +42,7 @@ kinfo_getfile(pid_t pid, int *cntp) bp = buf; eb = buf + len; while (bp < eb) { - kf = (struct kinfo_file *)bp; + kf = (struct kinfo_file *)(uintptr_t)bp; bp += kf->kf_structsize; cnt++; } @@ -57,7 +57,7 @@ kinfo_getfile(pid_t pid, int *cntp) kp = kif; /* Pass 2: unpack */ while (bp < eb) { - kf = (struct kinfo_file *)bp; + kf = (struct kinfo_file *)(uintptr_t)bp; /* Copy/expand into pre-zeroed buffer */ memcpy(kp, kf, kf->kf_structsize); /* Advance to next packed record */ Modified: head/lib/libutil/kinfo_getvmmap.c ============================================================================== --- head/lib/libutil/kinfo_getvmmap.c Tue Dec 2 08:23:45 2008 (r185552) +++ head/lib/libutil/kinfo_getvmmap.c Tue Dec 2 10:10:50 2008 (r185553) @@ -42,7 +42,7 @@ kinfo_getvmmap(pid_t pid, int *cntp) bp = buf; eb = buf + len; while (bp < eb) { - kv = (struct kinfo_vmentry *)bp; + kv = (struct kinfo_vmentry *)(uintptr_t)bp; bp += kv->kve_structsize; cnt++; } @@ -57,7 +57,7 @@ kinfo_getvmmap(pid_t pid, int *cntp) kp = kiv; /* Pass 2: unpack */ while (bp < eb) { - kv = (struct kinfo_vmentry *)bp; + kv = (struct kinfo_vmentry *)(uintptr_t)bp; /* Copy/expand into pre-zeroed buffer */ memcpy(kp, kv, kv->kve_structsize); /* Advance to next packed record */ From owner-svn-src-head@FreeBSD.ORG Tue Dec 2 10:39:47 2008 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6A803106567E; Tue, 2 Dec 2008 10:39:47 +0000 (UTC) (envelope-from peter@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 5D05A8FC1E; Tue, 2 Dec 2008 10:39:47 +0000 (UTC) (envelope-from peter@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mB2AdltN056451; Tue, 2 Dec 2008 10:39:47 GMT (envelope-from peter@svn.freebsd.org) Received: (from peter@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mB2AdlAt056450; Tue, 2 Dec 2008 10:39:47 GMT (envelope-from peter@svn.freebsd.org) Message-Id: <200812021039.mB2AdlAt056450@svn.freebsd.org> From: Peter Wemm Date: Tue, 2 Dec 2008 10:39: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: r185554 - 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, 02 Dec 2008 10:39:47 -0000 Author: peter Date: Tue Dec 2 10:39:47 2008 New Revision: 185554 URL: http://svn.freebsd.org/changeset/base/185554 Log: kf_offset was supposed to be signed. Modified: head/sys/sys/user.h Modified: head/sys/sys/user.h ============================================================================== --- head/sys/sys/user.h Tue Dec 2 10:10:50 2008 (r185553) +++ head/sys/sys/user.h Tue Dec 2 10:39:47 2008 (r185554) @@ -316,7 +316,7 @@ struct kinfo_file { int kf_ref_count; /* Reference count. */ int kf_flags; /* Flags. */ int _kf_pad0; /* Round to 64 bit alignment */ - uint64_t kf_offset; /* Seek location. */ + int64_t kf_offset; /* Seek location. */ int kf_vnode_type; /* Vnode type. */ int kf_sock_domain; /* Socket domain. */ int kf_sock_type; /* Socket type. */ From owner-svn-src-head@FreeBSD.ORG Tue Dec 2 10:46:36 2008 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2E4671065672; Tue, 2 Dec 2008 10:46:36 +0000 (UTC) (envelope-from jkoshy@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 1FEBA8FC18; Tue, 2 Dec 2008 10:46:36 +0000 (UTC) (envelope-from jkoshy@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mB2AkZ00056619; Tue, 2 Dec 2008 10:46:35 GMT (envelope-from jkoshy@svn.freebsd.org) Received: (from jkoshy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mB2AkZFo056617; Tue, 2 Dec 2008 10:46:35 GMT (envelope-from jkoshy@svn.freebsd.org) Message-Id: <200812021046.mB2AkZFo056617@svn.freebsd.org> From: Joseph Koshy Date: Tue, 2 Dec 2008 10:46: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: r185555 - head/sys/dev/hwpmc X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 02 Dec 2008 10:46:36 -0000 Author: jkoshy Date: Tue Dec 2 10:46:35 2008 New Revision: 185555 URL: http://svn.freebsd.org/changeset/base/185555 Log: - Efficiency tweak: when checking for PMC overflows, only go to hardware for PMCs that have been configured for sampling. - Bug fix: acknowledge PMC hardware overflows irrespective of the the (software) PMC's state. Modified: head/sys/dev/hwpmc/hwpmc_amd.c head/sys/dev/hwpmc/hwpmc_ppro.c Modified: head/sys/dev/hwpmc/hwpmc_amd.c ============================================================================== --- head/sys/dev/hwpmc/hwpmc_amd.c Tue Dec 2 10:39:47 2008 (r185554) +++ head/sys/dev/hwpmc/hwpmc_amd.c Tue Dec 2 10:46:35 2008 (r185555) @@ -632,7 +632,6 @@ amd_intr(int cpu, struct trapframe *tf) uint32_t config, evsel, perfctr; struct pmc *pm; struct amd_cpu *pac; - struct pmc_hw *phw; pmc_value_t v; KASSERT(cpu >= 0 && cpu < pmc_cpu_max(), @@ -660,21 +659,19 @@ amd_intr(int cpu, struct trapframe *tf) for (i = 0; retval == 0 && i < AMD_NPMCS; i++) { - if (!AMD_PMC_HAS_OVERFLOWED(i)) - continue; - - phw = &pac->pc_amdpmcs[i]; - - KASSERT(phw != NULL, ("[amd,%d] null PHW pointer", __LINE__)); - - if ((pm = phw->phw_pmc) == NULL || - pm->pm_state != PMC_STATE_RUNNING || + if ((pm = pac->pc_amdpmcs[i].phw_pmc) == NULL || !PMC_IS_SAMPLING_MODE(PMC_TO_MODE(pm))) { continue; } + if (!AMD_PMC_HAS_OVERFLOWED(i)) + continue; + retval = 1; /* Found an interrupting PMC. */ + if (pm->pm_state != PMC_STATE_RUNNING) + continue; + /* Stop the PMC, reload count. */ evsel = AMD_PMC_EVSEL_0 + i; perfctr = AMD_PMC_PERFCTR_0 + i; Modified: head/sys/dev/hwpmc/hwpmc_ppro.c ============================================================================== --- head/sys/dev/hwpmc/hwpmc_ppro.c Tue Dec 2 10:39:47 2008 (r185554) +++ head/sys/dev/hwpmc/hwpmc_ppro.c Tue Dec 2 10:46:35 2008 (r185555) @@ -688,17 +688,19 @@ p6_intr(int cpu, struct trapframe *tf) for (ri = 0; ri < P6_NPMCS; ri++) { - if (!P6_PMC_HAS_OVERFLOWED(ri)) - continue; - if ((pm = pc->pc_p6pmcs[ri].phw_pmc) == NULL || - pm->pm_state != PMC_STATE_RUNNING || !PMC_IS_SAMPLING_MODE(PMC_TO_MODE(pm))) { continue; } + if (!P6_PMC_HAS_OVERFLOWED(ri)) + continue; + retval = 1; + if (pm->pm_state != PMC_STATE_RUNNING) + continue; + error = pmc_process_interrupt(cpu, pm, tf, TRAPF_USERMODE(tf)); if (error) From owner-svn-src-head@FreeBSD.ORG Tue Dec 2 11:12:51 2008 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 483A51065672; Tue, 2 Dec 2008 11:12:51 +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 38F5E8FC14; Tue, 2 Dec 2008 11:12:51 +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 mB2BCpl2058556; Tue, 2 Dec 2008 11:12:51 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mB2BCpWH058555; Tue, 2 Dec 2008 11:12:51 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <200812021112.mB2BCpWH058555@svn.freebsd.org> From: Konstantin Belousov Date: Tue, 2 Dec 2008 11:12: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: r185556 - head/sys/ufs/ufs X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 02 Dec 2008 11:12:51 -0000 Author: kib Date: Tue Dec 2 11:12:50 2008 New Revision: 185556 URL: http://svn.freebsd.org/changeset/base/185556 Log: Do not lock vnode interlock around reading of v_iflag to check VI_DOOMED. Read of the pointer is atomic, and flag cannot be set while vnode lock is held. Requested by: jhb MFC after: 1 month Modified: head/sys/ufs/ufs/ufs_lookup.c Modified: head/sys/ufs/ufs/ufs_lookup.c ============================================================================== --- head/sys/ufs/ufs/ufs_lookup.c Tue Dec 2 10:46:35 2008 (r185555) +++ head/sys/ufs/ufs/ufs_lookup.c Tue Dec 2 11:12:50 2008 (r185556) @@ -157,7 +157,6 @@ ufs_lookup(ap) int nameiop = cnp->cn_nameiop; ino_t ino; int ltype; - int pdoomed; struct mount *mp; bp = NULL; @@ -588,20 +587,14 @@ found: VOP_UNLOCK(pdp, 0); pause("ufs_dd", 1); vn_lock(pdp, ltype | LK_RETRY); - VI_LOCK(pdp); - pdoomed = pdp->v_iflag & VI_DOOMED; - VI_UNLOCK(pdp); - if (pdoomed) + if (pdp->v_iflag & VI_DOOMED) return (ENOENT); } VOP_UNLOCK(pdp, 0); /* race to get the inode */ error = VFS_VGET(mp, ino, cnp->cn_lkflags, &tdp); vfs_unbusy(mp); vn_lock(pdp, ltype | LK_RETRY); - VI_LOCK(pdp); - pdoomed = pdp->v_iflag & VI_DOOMED; - VI_UNLOCK(pdp); - if (pdoomed) { + if (pdp->v_iflag & VI_DOOMED) { if (error == 0) vput(tdp); error = ENOENT; From owner-svn-src-head@FreeBSD.ORG Tue Dec 2 11:14:17 2008 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3FAD61065672; Tue, 2 Dec 2008 11:14:17 +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 30ACD8FC17; Tue, 2 Dec 2008 11:14:17 +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 mB2BEH4v058630; Tue, 2 Dec 2008 11:14:17 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mB2BEHB3058629; Tue, 2 Dec 2008 11:14:17 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <200812021114.mB2BEHB3058629@svn.freebsd.org> From: Konstantin Belousov Date: Tue, 2 Dec 2008 11:14: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: r185557 - 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, 02 Dec 2008 11:14:17 -0000 Author: kib Date: Tue Dec 2 11:14:16 2008 New Revision: 185557 URL: http://svn.freebsd.org/changeset/base/185557 Log: Shared lookup makes it possible to create several negative cache entries for one name. Then, creating inode with that name would remove one entry, leaving others dormant. Reclaiming the vnode would uncover negative entries, causing false return of ENOENT from the calls like stat, that do not create inode. Prevent creation of the duplicated negative entries. Reported and debugged with: pho Reviewed by: jhb X-MFC: after shared lookup changes Modified: head/sys/kern/vfs_cache.c Modified: head/sys/kern/vfs_cache.c ============================================================================== --- head/sys/kern/vfs_cache.c Tue Dec 2 11:12:50 2008 (r185556) +++ head/sys/kern/vfs_cache.c Tue Dec 2 11:14:16 2008 (r185557) @@ -474,7 +474,7 @@ cache_enter(dvp, vp, cnp) struct vnode *vp; struct componentname *cnp; { - struct namecache *ncp; + struct namecache *ncp, *n2; struct nchashhead *ncpp; u_int32_t hash; int hold; @@ -530,8 +530,6 @@ cache_enter(dvp, vp, cnp) * name. */ if (vp) { - struct namecache *n2; - TAILQ_FOREACH(n2, &vp->v_cache_dst, nc_dst) { if (n2->nc_dvp == dvp && n2->nc_nlen == cnp->cn_namelen && @@ -541,7 +539,16 @@ cache_enter(dvp, vp, cnp) return; } } - } + } else { + TAILQ_FOREACH(n2, &ncneg, nc_dst) { + if (n2->nc_nlen == cnp->cn_namelen && + !bcmp(n2->nc_name, cnp->cn_nameptr, n2->nc_nlen)) { + CACHE_UNLOCK(); + cache_free(ncp); + return; + } + } + } numcache++; if (!vp) { From owner-svn-src-head@FreeBSD.ORG Tue Dec 2 11:58:32 2008 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8A57E1065670; Tue, 2 Dec 2008 11:58:32 +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 426FA8FC17; Tue, 2 Dec 2008 11:58:32 +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 mB2BwWub059498; Tue, 2 Dec 2008 11:58:32 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mB2BwW5g059495; Tue, 2 Dec 2008 11:58:32 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <200812021158.mB2BwW5g059495@svn.freebsd.org> From: Konstantin Belousov Date: Tue, 2 Dec 2008 11:58: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: r185558 - in head: lib/libthr/thread libexec/rtld-elf X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 02 Dec 2008 11:58:32 -0000 Author: kib Date: Tue Dec 2 11:58:31 2008 New Revision: 185558 URL: http://svn.freebsd.org/changeset/base/185558 Log: Provide custom simple allocator for rtld locks in libthr. The allocator does not use any external symbols, thus avoiding possible recursion into rtld to resolve symbols, when called. Reviewed by: kan, davidxu Tested by: rink MFC after: 1 month Modified: head/lib/libthr/thread/thr_fork.c head/lib/libthr/thread/thr_rtld.c head/libexec/rtld-elf/rtld_lock.h Modified: head/lib/libthr/thread/thr_fork.c ============================================================================== --- head/lib/libthr/thread/thr_fork.c Tue Dec 2 11:14:16 2008 (r185557) +++ head/lib/libthr/thread/thr_fork.c Tue Dec 2 11:58:31 2008 (r185558) @@ -106,7 +106,7 @@ _fork(void) pid_t ret; int errsave; int unlock_malloc; - int rtld_locks[16]; + int rtld_locks[MAX_RTLD_LOCKS]; if (!_thr_is_inited()) return (__sys_fork()); Modified: head/lib/libthr/thread/thr_rtld.c ============================================================================== --- head/lib/libthr/thread/thr_rtld.c Tue Dec 2 11:14:16 2008 (r185557) +++ head/lib/libthr/thread/thr_rtld.c Tue Dec 2 11:58:31 2008 (r185558) @@ -50,42 +50,42 @@ static int _thr_rtld_set_flag(int); static void _thr_rtld_wlock_acquire(void *); struct rtld_lock { - struct urwlock lock; - void *base; + struct urwlock lock; + char _pad[CACHE_LINE_SIZE - sizeof(struct urwlock)]; }; +static struct rtld_lock lock_place[MAX_RTLD_LOCKS] __aligned(CACHE_LINE_SIZE); +static int busy_places; + static void * _thr_rtld_lock_create(void) { - void *base; - char *p; - uintptr_t r; - struct rtld_lock *l; - size_t size; - - size = CACHE_LINE_SIZE; - while (size < sizeof(struct rtld_lock)) - size <<= 1; - base = calloc(1, size); - p = (char *)base; - if ((uintptr_t)p % CACHE_LINE_SIZE != 0) { - free(base); - base = calloc(1, size + CACHE_LINE_SIZE); - p = (char *)base; - if ((r = (uintptr_t)p % CACHE_LINE_SIZE) != 0) - p += CACHE_LINE_SIZE - r; + int locki; + struct rtld_lock *l; + static const char fail[] = "_thr_rtld_lock_create failed\n"; + + for (locki = 0; locki < MAX_RTLD_LOCKS; locki++) { + if ((busy_places & (1 << locki)) == 0) + break; } - l = (struct rtld_lock *)p; + if (locki == MAX_RTLD_LOCKS) { + write(2, fail, sizeof(fail) - 1); + return (NULL); + } + busy_places |= (1 << locki); + + l = &lock_place[locki]; l->lock.rw_flags = URWLOCK_PREFER_READER; - l->base = base; return (l); } static void _thr_rtld_lock_destroy(void *lock) { - struct rtld_lock *l = (struct rtld_lock *)lock; - free(l->base); + int locki; + + locki = (struct rtld_lock *)lock - &lock_place[0]; + busy_places &= ~(1 << locki); } #define SAVE_ERRNO() { \ Modified: head/libexec/rtld-elf/rtld_lock.h ============================================================================== --- head/libexec/rtld-elf/rtld_lock.h Tue Dec 2 11:14:16 2008 (r185557) +++ head/libexec/rtld-elf/rtld_lock.h Tue Dec 2 11:58:31 2008 (r185558) @@ -29,6 +29,7 @@ #define _RTLD_LOCK_H_ #define RTLI_VERSION 0x01 +#define MAX_RTLD_LOCKS 8 struct RtldLockInfo { From owner-svn-src-head@FreeBSD.ORG Tue Dec 2 12:55:11 2008 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8595B1065686; Tue, 2 Dec 2008 12:55:11 +0000 (UTC) (envelope-from des@des.no) Received: from tim.des.no (tim.des.no [194.63.250.121]) by mx1.freebsd.org (Postfix) with ESMTP id 3FEC28FC13; Tue, 2 Dec 2008 12:55:11 +0000 (UTC) (envelope-from des@des.no) Received: from ds4.des.no (des.no [84.49.246.2]) by smtp.des.no (Postfix) with ESMTP id 713A46D449; Tue, 2 Dec 2008 12:55:10 +0000 (UTC) Received: by ds4.des.no (Postfix, from userid 1001) id 5CCB6844F2; Tue, 2 Dec 2008 13:55:10 +0100 (CET) From: =?utf-8?Q?Dag-Erling_Sm=C3=B8rgrav?= To: Peter Wemm References: <200812021010.mB2AAowJ055809@svn.freebsd.org> Date: Tue, 02 Dec 2008 13:55:10 +0100 In-Reply-To: <200812021010.mB2AAowJ055809@svn.freebsd.org> (Peter Wemm's message of "Tue, 2 Dec 2008 10:10:50 +0000 (UTC)") Message-ID: <86r64q4tzl.fsf@ds4.des.no> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (berkeley-unix) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r185553 - head/lib/libutil X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 02 Dec 2008 12:55:11 -0000 Peter Wemm writes: > Log: > Attempt a quick bandaid for arm build breakage. I went to the trouble = of > maintaining alignment, but I'm not sure how to tell gcc this. There's no good way to do this. In an ideal world, you could add an assertion that the offset is a multiple of __alignof__(struct kinfo_foo), and gcc would understand, but I don't think that works in practice. Coverity will probably complain about this as well, but hopefully the cast will pacify it like it pacifies gcc. In pw_util and gr_util, scf@ and I solved a similar issue by using a wrapper struct, but that wouldn't work here. DES --=20 Dag-Erling Sm=C3=B8rgrav - des@des.no From owner-svn-src-head@FreeBSD.ORG Tue Dec 2 13:10:00 2008 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id F1CE4106564A; Tue, 2 Dec 2008 13:09:59 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail07.syd.optusnet.com.au (mail07.syd.optusnet.com.au [211.29.132.188]) by mx1.freebsd.org (Postfix) with ESMTP id 80B5B8FC1B; Tue, 2 Dec 2008 13:09:59 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from besplex.bde.org (c220-239-225-17.carlnfd1.nsw.optusnet.com.au [220.239.225.17]) by mail07.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id mB2D9thC017770 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Wed, 3 Dec 2008 00:09:56 +1100 Date: Wed, 3 Dec 2008 00:09:55 +1100 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Kostik Belousov In-Reply-To: <20081201214217.GS3045@deviant.kiev.zoral.com.ua> Message-ID: <20081202232222.N1514@besplex.bde.org> References: <200811220555.mAM5tuIJ007781@svn.freebsd.org> <3c1674c90811221651u338294frcdbd99b386733851@mail.gmail.com> <20081123154138.GS6408@deviant.kiev.zoral.com.ua> <200812011407.06563.jhb@freebsd.org> <20081201214217.GS3045@deviant.kiev.zoral.com.ua> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: Scott Long , src-committers@freebsd.org, Kip Macy , John Baldwin , svn-src-all@freebsd.org, jfv@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r185162 - in head: . sys/amd64/include sys/arm/include sys/conf sys/dev/bce sys/dev/cxgb sys/dev/cxgb/sys sys/dev/cxgb/ulp/iw_cxgb sys/dev/mxge sys/dev/nxge sys/i386/include sys/i386/in... X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 02 Dec 2008 13:10:00 -0000 On Mon, 1 Dec 2008, Kostik Belousov wrote: > On Mon, Dec 01, 2008 at 02:07:06PM -0500, John Baldwin wrote: >> On Sunday 23 November 2008 10:41:38 am Kostik Belousov wrote: >>> Below is the updated patch. It includes changes made after private comments >>> by bde@ and uses symbolic definitions for the bits in the features words. >>> I thought about accessing a per-CPU word for serialized instruction in the >>> slow path, but decided that it does not beneficial.\ >> >> Is the branch really better than just doing what the atomic operations for >> mutexes, etc. do and just use 'lock addl $0,%esp' for a barrier in all cases >> on i386 and only bother with using the fancier instructions on amd64? Even >> amd64 doesn't use *fence yet for the atomic ops actually. I have had a patch >> to use it for years, but during testing there was no discernable difference >> between the existing 'lock addl' approach vs '*fence'. I'd much rather just >> use 486 code for all i386 machines than add a branch, esp. if >> the "optimization" the branch is doing isn't an actual optimization. Hmm. > I do not insist. The branch is done only for arches that has no fence > instructions. The section for the slow code is put after the main text, > that should, according to Intel documentation, be predicted as not taken > for the first execution. > > For reference, below is the latest version of the patch. I postponed > the commit, in particular, because it touches ixgb, and Jack did > not responded. > ... > diff --git a/sys/i386/include/atomic.h b/sys/i386/include/atomic.h > index f6bcf0c..dbdc945 100644 > --- a/sys/i386/include/atomic.h > +++ b/sys/i386/include/atomic.h > @@ -32,21 +32,47 @@ > #error this file needs sys/cdefs.h as a prerequisite > #endif > > - > -#if defined(I686_CPU) > -#define mb() __asm__ __volatile__ ("mfence;": : :"memory") > -#define wmb() __asm__ __volatile__ ("sfence;": : :"memory") > -#define rmb() __asm__ __volatile__ ("lfence;": : :"memory") > -#else > -/* > - * do we need a serializing instruction? > - */ > -#define mb() > -#define wmb() > -#define rmb() > +#if defined(_KERNEL) Still have this style bug (if defined() instead of ifdef). > +#include Namespace pollution. This should be unnecessary because it is an error to include (or ) directly, at least in the kernel. The correct include is which supplies pollution by and and lots more as standard. There is included before . This order would now be wrong if you have added a dependency of on , but I can't see such a dependency... > +#include ... now I see it -- it is because is broken and has a dependency on . is supposed to contain only #define's for special registers, but it has 2 inline functions that use functions from , without even using #defines for the special registers that they use. Normally can be included without worrying about this dependency, thanks to the standard pollution, but now the standard pollution is broken. Namespace pollution. This is almost necessary for CPUID_* (it would be necessary if these macros were inlines, but with macros only files that use the macros would need the include and there might be few enough of them for this to be done for each, or could do it (ugh) and hthe order doesn't matter. Another advantage of 'lock addl' is that CPUID_* are not needed. Atomic ops would need the same treatment if they used *fence. > +#define mb() __asm __volatile( \ > + "testl %0,cpu_feature \n\ > + je 2f \n\ > + mfence \n\ > +1: \n\ Still have this style bug (no empty line before label that is not fallen into). I wasn't going to care about this, but then decided that the non-fall-through here is especially non-obvious. > + .section .text.offpath \n\ > +2: lock \n\ Still have this style bug (label on same line as instruction). > + addl $0,cpu_feature \n\ I wonder if adding to (%esp) is faster. It is at least smaller. > + jmp 1b \n\ Missing empty line as above. > + .text \n\ > +" \ > + : : "i"(CPUID_SSE2) : "memory") Missing space after "i" here and elsewhere. Bruce From owner-svn-src-head@FreeBSD.ORG Tue Dec 2 13:28:11 2008 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A1698106564A; Tue, 2 Dec 2008 13:28:11 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail01.syd.optusnet.com.au (mail01.syd.optusnet.com.au [211.29.132.182]) by mx1.freebsd.org (Postfix) with ESMTP id 1C7698FC1C; Tue, 2 Dec 2008 13:28:10 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from besplex.bde.org (c220-239-225-17.carlnfd1.nsw.optusnet.com.au [220.239.225.17]) by mail01.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id mB2DS7uo004699 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Wed, 3 Dec 2008 00:28:09 +1100 Date: Wed, 3 Dec 2008 00:28:07 +1100 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: "Sean C. Farley" In-Reply-To: Message-ID: <20081203001117.P1758@besplex.bde.org> References: <200811270842.mAR8gwi3080974@svn.freebsd.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org, Robert Watson Subject: Re: svn commit: r185362 - head/share/man/man9 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 02 Dec 2008 13:28:11 -0000 On Sun, 30 Nov 2008, Sean C. Farley wrote: > On Thu, 27 Nov 2008, Robert Watson wrote: > >> Log: >> Revert r184509: don't encourage the use of sysexits.h with err() and >> errx(),, as there seems to be a general preference against this >> practice. > > *snip* > >> if ((four = malloc(sizeof(struct foo))) == NULL) >> - err(EX_OSERR, NULL); >> + err(1, (char *)NULL); >> if ((six = (int *)overflow()) == NULL) >> - errx(EX_DATAERR, "number overflowed"); >> + errx(1, "number overflowed"); > > Out of curiosity, why not EXIT_FAILURE instead of 1, at least in > situations where including stdlib.h is allowed? Is it because > EXIT_FAILURE is only required to be non-zero and not necessarily 1? It is because KNF doesn't use EXIT_FAILURE, and style(9) is primarily to document what KNF does and not to change it. Another bug in r184509 is that it didn't just encourage use of sysexits.h but required it, by removing all examples of non-use of sysexits.h. A non-example rule in style.9 still requires use of sysexits.h for all nonzero exits, but is obviously wrong since it is inconsistent with the 2 examples shown in the above diff. Bruce From owner-svn-src-head@FreeBSD.ORG Tue Dec 2 14:19:54 2008 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3A2C4106564A; Tue, 2 Dec 2008 14:19:54 +0000 (UTC) (envelope-from ganbold@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 229548FC1F; Tue, 2 Dec 2008 14:19:54 +0000 (UTC) (envelope-from ganbold@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mB2EJrnc062614; Tue, 2 Dec 2008 14:19:53 GMT (envelope-from ganbold@svn.freebsd.org) Received: (from ganbold@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mB2EJrTd062613; Tue, 2 Dec 2008 14:19:53 GMT (envelope-from ganbold@svn.freebsd.org) Message-Id: <200812021419.mB2EJrTd062613@svn.freebsd.org> From: Ganbold Tsagaankhuu Date: Tue, 2 Dec 2008 14:19: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: r185561 - 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: Tue, 02 Dec 2008 14:19:54 -0000 Author: ganbold (doc committer) Date: Tue Dec 2 14:19:53 2008 New Revision: 185561 URL: http://svn.freebsd.org/changeset/base/185561 Log: Remove unused variable. Found with: Coverity Prevent(tm) CID: 3685 Approved by: jhb Modified: head/sys/amd64/amd64/intr_machdep.c Modified: head/sys/amd64/amd64/intr_machdep.c ============================================================================== --- head/sys/amd64/amd64/intr_machdep.c Tue Dec 2 13:36:38 2008 (r185560) +++ head/sys/amd64/amd64/intr_machdep.c Tue Dec 2 14:19:53 2008 (r185561) @@ -239,11 +239,8 @@ void intr_execute_handlers(struct intsrc *isrc, struct trapframe *frame) { struct intr_event *ie; - struct thread *td; int vector; - td = curthread; - /* * We count software interrupts when we process them. The * code here follows previous practice, but there's an From owner-svn-src-head@FreeBSD.ORG Tue Dec 2 14:57:49 2008 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E78D11065673; Tue, 2 Dec 2008 14:57:48 +0000 (UTC) (envelope-from luigi@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id CD4078FC17; Tue, 2 Dec 2008 14:57:48 +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 mB2Evmq5063420; Tue, 2 Dec 2008 14:57:48 GMT (envelope-from luigi@svn.freebsd.org) Received: (from luigi@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mB2Evmha063418; Tue, 2 Dec 2008 14:57:48 GMT (envelope-from luigi@svn.freebsd.org) Message-Id: <200812021457.mB2Evmha063418@svn.freebsd.org> From: Luigi Rizzo Date: Tue, 2 Dec 2008 14:57: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: r185562 - head/sys/boot/i386/boot0 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 02 Dec 2008 14:57:49 -0000 Author: luigi Date: Tue Dec 2 14:57:48 2008 New Revision: 185562 URL: http://svn.freebsd.org/changeset/base/185562 Log: This commits brings in a lot of documentation and some enhancement of the boot0.S code, with a number of compile-time selectable options, the most interesting one being the ability to select PXE booting. The code is completely compatible with the previous one, and with the boot0cfg program. Even the actual code is largely unmodified, with only minor rearrangements or fixes to make room for the new features. The behaviour of the standard build differs from the previous version in the following, minor things: + 'noupdate' is the default, which means the code does not write back the selection to disk. You can enable the feature at runtime with boot0cfg, or changing the flags in the Makefile. + a drive number of 0x00 (floppy, or USB in floppy emulation) is now accepted as valid. Previously, it was overridden with 0x80, meaning that the partition table coming from the media was used to access sectors on a possibly different media. You can revert to the previous mode building with -DCHECK_DRIVE, and you can always use the 'setdrv' option in boot0cfg + certain FAT or NTFS partitions are listed as WIN instead of DOS. + the 'bel' character on a bad selection is replaced by a '#' to make it clear that the system is not hang even if the machine does not have a speaker. This can be reverted back at compile time, or at runtime with an upcoming boot0cfg option. Additional features are available as compile time options, and may be become the default if deemed useful. In particular: + INT18/PXE boot (make -DPXE) This option enables booting through INT 18h (which on certain BIOSes can be hooked to PXE) by pressing F6. There is unfortunately no room to print the additional menu option. Also, to make room for the code, the 'Default: ' string is changed to 'Boot: ' + print current drive number (make -DTEST) Prints a line indicating the current drive number. This is useful to figure out what is going on for machines/bioses which remap drives in sometimes surprising ways. + disable numeric keys in console mode (make -DONLY_F_KEYS) Not really a significant option, but it is needed to make room for the -DTEST mode. + disable floppy support (make -DCHECK_DRIVE) Revert to the old behaviour of only accepting 0x80 and above as valid drive numbers. MFC after: 6 weeks Modified: head/sys/boot/i386/boot0/Makefile head/sys/boot/i386/boot0/boot0.S Modified: head/sys/boot/i386/boot0/Makefile ============================================================================== --- head/sys/boot/i386/boot0/Makefile Tue Dec 2 14:19:53 2008 (r185561) +++ head/sys/boot/i386/boot0/Makefile Tue Dec 2 14:57:48 2008 (r185562) @@ -6,11 +6,29 @@ BINMODE=${NOBINMODE} NO_MAN= SRCS= ${PROG}.S -# The default set of flags compiled into boot0. This enables update (writing -# the modified boot0 back to disk after running so that the selection made is -# saved), packet mode (detect and use the BIOS EDD extensions if we try to -# boot past the 1024 cylinder liimt), and booting from all valid slices. -BOOT_BOOT0_FLAGS?= 0x8f +# Additional options that you can specify with make OPTS="..." +# (these only apply to boot0.S) +# +# -DSIO do I/O using COM1: +# -DPXE fallback to INT18/PXE with F6 +# -DCHECK_DRIVE enable checking drive number +# -DONLY_F_KEYS accept only Fx keys in console +# -DTEST print drive number on entry +# +CFLAGS += ${OPTS} + +# Flags used in the boot0.S code: +# 0x0f all valid partitions enabled. +# 0x80 'packet', use BIOS EDD (LBA) extensions instead of CHS +# to read from disk. boot0.S does not check that the extensions +# are supported, but all modern BIOSes should have them. +# 0x40 'noupdate', disable writing boot0 back to disk so that +# the current selection is not preserved across reboots. +# 0x20 'setdrv', override the drive number supplied by the bios +# with the one in the boot sector. + +# Default boot flags: +BOOT_BOOT0_FLAGS?= 0xcf # The number of timer ticks to wait for a keypress before assuming the default # selection. Since there are 18.2 ticks per second, the default value of Modified: head/sys/boot/i386/boot0/boot0.S ============================================================================== --- head/sys/boot/i386/boot0/boot0.S Tue Dec 2 14:19:53 2008 (r185561) +++ head/sys/boot/i386/boot0/boot0.S Tue Dec 2 14:57:48 2008 (r185562) @@ -1,4 +1,5 @@ /* + * Copyright (c) 2008 Luigi Rizzo (mostly documentation) * Copyright (c) 2002 Bruce M. Simpson * Copyright (c) 1998 Robert Nordier * All rights reserved. @@ -16,50 +17,158 @@ * $FreeBSD$ */ -/* A 512-byte boot manager. */ -#ifdef SIO -/* ... using a serial console on COM1. */ +/* build options: */ +#ifdef SIO /* use serial console on COM1. */ #endif +#ifdef PXE /* enable PXE/INT18 booting with F6 */ +#endif + +#ifdef CHECK_DRIVE /* make sure we boot from a HD. */ +#endif + +#ifdef ONLY_F_KEYS /* Only F1..F6, no digits on console */ +#endif + +#ifdef TEST /* enable some test code */ +#ifndef ONLY_F_KEYS +#define ONLY_F_KEYS /* make room for the test code */ +#endif +#endif + +/* + * Note - this code uses many tricks to save space and fit in one sector. + * This includes using side effects of certain instructions, reusing + * register values from previous operations, etc. + * Be extremely careful when changing the code, even for simple things. + */ + +/* + * BOOT BLOCK STRUCTURE + * + * This code implements a Master Boot Record (MBR) for an Intel/PC disk. + * It is 512 bytes long and it is normally loaded by the BIOS (or another + * bootloader) at 0:0x7c00. This code depends on %cs:%ip being 0:0x7c00 + * + * The initial chunk of instructions is used as a signature by external + * tools (e.g. boot0cfg) which can manipulate the block itself. + * + * The area at offset 0x1b2 contains a magic string ('Drive '), also + * used as a signature to detect the block, and some variables that can + * be updated by boot0cfg (and optionally written back to the disk). + * These variables control the operation of the bootloader itself, + * e.g. which partitions to enable, the timeout, the use of LBA + * (called 'packet') or CHS mode, whether to force a drive number, + * and whether to write back the user's selection back to disk. + * + * As in every Master Boot Record, the partition table is at 0x1be, + * made of four 16-byte entries each containing: + * + * OFF SIZE DESCRIPTION + * 0 1 status (0x80: bootable, 0: non bootable) + * 1 3 start sector CHS + * 8:head, 6:sector, 2:cyl bit 9..8, 8:cyl bit 7..0 + * 4 1 partition type + * 5 3 end sector CHS + * 8 4 LBA of first sector + * 12 4 partition size in sectors + * + * and followed by the two bytes 0x55, 0xAA (MBR signature). + */ + + +/* + * BOOT BLOCK OPERATION + * + * On entry, the registers contain the following values: + * + * %cs:%ip 0:0x7c00 + * %dl drive number (0x80, 0x81, ... ) + * %si pointer to the partition table from which we were loaded. + * Some boot code (e.g. syslinux) use this info to relocate + * themselves, so we want to pass a valid one to the next stage. + * NOTE: the use of %is is not a standard. + * + * This boot block first relocates itself at a different address (0:0x600), + * to free the space at 0:0x7c00 for the next stage boot block. + * + * It then initializes some memory at 0:0x800 and above (pointed by %bp) + * to store the original drive number (%dl) passed to us, and to construct a + * fake partition entry. The latter is used by the disk I/O routine and, + * in some cases, passed in %si to the next stage boot code. + * + * The variables at 0x1b2 are accessed as negative offsets from %bp. + * + * After the relocation, the code scans the partition table printing + * out enabled partition or disks, and waits for user input. + * + * When a partition is selected, or a timeout expires, the currently + * selected partition is used to load the next stage boot code, + * %dl and %si are set appropriately as when we were called, and + * control is transferred to the newly loaded code at 0:0x7c00. + */ + +/* + * CONSTANTS + * + * NHRDRV is the address in segment 0 where the BIOS writes the + * total number of hard disks in the system. + * LOAD is the original load address and cannot be changed. + * ORIGIN is the relocation address. If you change it, you also need + * to change the value passed to the linker in the Makefile + * PRT_OFF is the location of the partition table (from the MBR standard). + * B0_OFF is the location of the data area, known to boot0cfg so + * it cannot be changed. + * MAGIC is the signature of a boot block. + */ + .set NHRDRV,0x475 # Number of hard drives .set ORIGIN,0x600 # Execution address - .set FAKE,0x800 # Partition entry .set LOAD,0x7c00 # Load address .set PRT_OFF,0x1be # Partition table - - .set TBL0SZ,0x3 # Table 0 size - .set TBL1SZ,0xa # Table 1 size + .set B0_OFF,0x1b2 # Offset of boot0 data .set MAGIC,0xaa55 # Magic: bootable - .set B0MAGIC,0xbb66 # Identification .set KEY_ENTER,0x1c # Enter key scan code .set KEY_F1,0x3b # F1 key scan code .set KEY_1,0x02 # #1 key scan code - .set ASCII_BEL,0x07 # ASCII code for + .set ASCII_BEL,'#' # ASCII code for .set ASCII_CR,0x0D # ASCII code for /* - * Addresses in the sector of embedded data values. - * Accessed with negative offsets from the end of the relocated sector (%ebp). - */ - .set _NXTDRV,-0x48 # Next drive - .set _OPT,-0x47 # Default option - .set _SETDRV,-0x46 # Drive to force - .set _FLAGS,-0x45 # Flags - .set _TICKS,-0x44 # Timeout ticks - .set _FAKE,0x0 # Fake partition entry - .set _MNUOPT,0xc # Menu options + * Offsets of variables in the block at B0_OFF, and in the volatile + * data area, computed as displacement from %bp. + * We need to define them as constant as the assembler cannot + * compute them in its single pass. + */ + .set _NXTDRV, -0x48 # Next drive + .set _OPT, -0x47 # Default option + .set _SETDRV, -0x46 # Drive to force + .set _FLAGS, -0x45 # Flags + .set SETDRV, 0x20 # the 'setdrv' flag + .set NOUPDATE, 0x40 # the 'noupdate' flag + .set USEPACKET, 0x80 # the 'packet' flag + .set _TICKS, -0x44 # Timeout ticks + .set _FAKE,0x0 # Fake partition table + .set _MNUOPT, 0x10 # Saved menu entries + .set TLEN, (desc_ofs - bootable_ids) # size of bootable ids .globl start # Entry point .code16 # This runs in real mode /* + * MAIN ENTRY POINT * Initialise segments and registers to known values. * segments start at 0. * The stack is immediately below the address we were loaded to. + * NOTE: the initial section of the code (up to movw $LOAD,%sp) + * is used by boot0cfg, together with the 'Drive ' string and + * the 0x55, 0xaa at the end, as an identifier for version 1.0 + * of the boot code. Do not change it. + * In version 1.0 the parameter table (_NEXTDRV etc) is at 0x1b9 */ start: cld # String ops inc xorw %ax,%ax # Zero @@ -68,257 +177,318 @@ start: cld # String ops inc movw %ax,%ss # Set up movw $LOAD,%sp # stack -/* - * Copy this code to the address it was linked for - */ + /* + * Copy this code to the address it was linked for, 0x600 by default. + */ movw %sp,%si # Source movw $start,%di # Destination movw $0x100,%cx # Word count rep # Relocate movsw # code -/* - * Set address for variable space beyond code, and clear it. - * Notice that this is also used to point to the values embedded in the block, - * by using negative offsets. - */ + /* + * After the code, (i.e. at %di+0, 0x800) create a partition entry, + * initialized to LBA 0 / CHS 0:0:1. + * Set %bp to point to the partition and also, with negative offsets, + * to the variables embedded in the bootblock (nextdrv and so on). + */ movw %di,%bp # Address variables movb $0x8,%cl # Words to clear rep # Zero stosw # them -/* - * Relocate to the new copy of the code. - */ - incb -0xe(%di) # Sector number - jmp main-LOAD+ORIGIN # To relocated code + incb -0xe(%di) # Set the S field to 1 + + jmp main-LOAD+ORIGIN # Jump to relocated code main: #if defined(SIO) && COMSPEED != 0 -/* - * Initialize the serial port. bioscom preserves the driver number in DX. - */ + /* + * Init the serial port. bioscom preserves the driver number in DX. + */ movw $COMSPEED,%ax # defined by Makefile callw bioscom #endif -/* - * Check what flags were loaded with us, specifically if a predefined drive - * number should be used. If what the bios gives us is bad, use the '0' in - * the block instead. - */ - testb $0x20,_FLAGS(%bp) # Set drive number? - jnz main.1 # Yes + + /* + * If the 'setdrv' flag is set in the boot sector, use the drive + * number from the boot sector at 'setdrv_num'. + * Optionally, do the same if the BIOS gives us an invalid number + * (note though that the override prevents booting from a floppy + * or a ZIP/flash drive in floppy emulation). + * The test costs 4 bytes of code so it is disabled by default. + */ + testb $SETDRV,_FLAGS(%bp) # Set drive number? +#ifndef CHECK_DRIVE /* disable drive checks */ + jz save_curdrive # no, use the default +#else + jnz disable_update # Yes testb %dl,%dl # Drive number valid? - js main.2 # Possibly (0x80 set) -/* - * Only update the boot-sector when there is a valid drive number or - * the drive number is set manually. - */ - orb $0x40,_FLAGS(%bp) # Disable updates -main.1: movb _SETDRV(%bp),%dl # Drive number to use -/* - * Whatever we decided to use, now store it into the fake - * partition entry that lives in the data space above us. - */ -main.2: movb %dl,_FAKE(%bp) # Save drive number - callw putn # To new line - pushw %dx # Save drive number -/* - * Start out with a pointer to the 4th byte of the first table entry - * so that after 4 iterations it's beyond the end of the sector - * and beyond a 256 byte boundary and has overflowed 8 bits (see next comment). - * Remember that the table starts 2 bytes earlier than you would expect - * as the bootable flag is after it in the block. - */ + js save_curdrive # Possibly (0x80 set) +#endif + /* + * Disable updates if the drive number is forced. + */ +disable_update: orb $NOUPDATE,_FLAGS(%bp) # Disable updates + movb _SETDRV(%bp),%dl # Use stored drive number + + /* + * Whatever drive we decided to use, store it at (%bp). The byte + * is normally used for the state of the partition (0x80 or 0x00), + * but we abuse it as it is very convenient to access at offset 0. + * The value is read back after 'check_selection' + */ +save_curdrive: movb %dl, (%bp) # Save drive number + pushw %dx # Also in the stack +#ifdef TEST /* test code, print internal bios drive */ + rolb $1, %dl + movw $drive, %si + call putkey +#endif + callw putn # Print a newline + /* + * Start out with a pointer to the 4th byte of the first table entry + * so that after 4 iterations it's beyond the end of the sector + * and beyond a 256 byte boundary. We use the latter trick to check for + * end of the loop without using an extra register (see start.5). + */ movw $(partbl+0x4),%bx # Partition table (+4) xorw %dx,%dx # Item number -/* - * Loop around on the partition table, printing values until we - * pass a 256 byte boundary. The end of loop test is at main.5. - */ -main.3: movb %ch,-0x4(%bx) # Zero active flag (ch == 0) + + /* + * Loop around on the partition table, printing values until we + * pass a 256 byte boundary. + */ +read_entry: movb %ch,-0x4(%bx) # Zero active flag (ch == 0) btw %dx,_FLAGS(%bp) # Entry enabled? - jnc main.5 # No -/* - * If any of the entries in the table are the same as the 'type' in the slice - * table entry, then this is an empty or non bootable partition. Skip it. - */ + jnc next_entry # No + /* + * Lookup type in the 'non_bootable_ids' table, skip matching entries. + * This is implemented is by setting %di to the start of the + * exclude table, and %cl to the length of the table itself. After the + * 'repne scasb' the zero flag is set if we found a match. + * If not, %di points to the beginning of the 'valid' types, + * which is what we need for the next check. + */ movb (%bx),%al # Load type - movw $tables,%di # Lookup tables - movb $TBL0SZ,%cl # Number of entries + movw $non_bootable_ids,%di # Lookup tables + movb $(bootable_ids-non_bootable_ids),%cl # length repne # Exclude scasb # partition? - je main.5 # Yes -/* - * Now scan the table of known types - */ - movb $TBL1SZ+1,%cl # Number of entries + je next_entry # Yes, ignore it + /* + * Now scan the table of bootable ids, which starts at %di and has + * length TLEN. On a match, %di points to the element following the + * match; the corresponding offset to the description is $(TLEN-1) + * bytes ahead. If we don't find a match, we hit the 'unknown' entry. + */ + movb $(TLEN),%cl # Number of entries repne # Locate scasb # type -/* - * Get the matching element in the next array. - */ - addw $TBL1SZ-1, %di # Adjust + /* + * Get the matching element in the next array. + * The byte at $(TLEN-1)(%di) contains the offset of the description + * string from %di, so we add the number and print the string. + */ + addw $(TLEN-1), %di # Adjust movb (%di),%cl # Partition addw %cx,%di # description callw putx # Display it -main.5: incw %dx # Next item + +next_entry: incw %dx # Next item addb $0x10,%bl # Next entry - jnc main.3 # Till done -/* - * Passed a 256 byte boundary; the table is finished. - * Add one to the drive number and check it is valid. - */ + jnc read_entry # Till done + /* + * We are past a 256 byte boundary: the partition table is finished. + * Add one to the drive number and check it is valid. + * Note that if we started from a floppy, %dl was 0 so we still + * get an entry for the next drive, which is the first Hard Disk. + */ popw %ax # Drive number subb $0x80-0x1,%al # Does next cmpb NHRDRV,%al # drive exist? (from BIOS?) - jb main.6 # Yes -/* - * If this is the only drive, don't display it as an option. - */ + jb print_drive # Yes + /* + * If this is the only drive, don't display it as an option. + */ decw %ax # Already drive 0? - jz main.7 # Yes -/* - * If it was illegal or we cycled through them, go back to drive 0. - */ + jz print_prompt # Yes + /* + * If it was illegal or we cycled through them, go back to drive 0. + */ xorb %al,%al # Drive 0 -/* - * Whatever drive we selected, make it an ascii digit and save it back to the - * "next drive" location in the loaded block in case we want to save it later - * for next time. This also is part of the printed drive string so add 0x80 - * to indicate end of string. - */ -main.6: addb $'0'|0x80,%al # Save next + /* + * Whatever drive we selected, make it an ascii digit and save it + * back to the "nxtdrv" location in case we want to save it to disk. + * This digit is also part of the printed drive string, so add 0x80 + * to indicate end of string. + */ +print_drive: addb $'0'|0x80,%al # Save next movb %al,_NXTDRV(%bp) # drive number movw $drive,%di # Display callw putx # item -/* - * Now that we've printed the drive (if we needed to), display a prompt. - */ -main.7: movw $prompt,%si # Display + /* + * Menu is complete, display a prompt followed by current selection. + * 'decw %si' makes the register point to the space after 'Default: ' + * so we do not see an extra CRLF on the screen. + */ +print_prompt: movw $prompt,%si # Display callw putstr # prompt movb _OPT(%bp),%dl # Display decw %si # default callw putkey # key - jmp main.7_1 # Skip beep -/* - * Users's last try was bad, beep in displeasure. - */ -main.10: movb $ASCII_BEL,%al # Signal - callw putchr # beep! + jmp start_input # Skip beep + /* - * Start of input loop. Take note of time + * Here we have the code waiting for user input or a timeout. */ -main.7_1: xorb %ah,%ah # BIOS: Get +beep: movb $ASCII_BEL,%al # Input error, print or beep + callw putchr + +start_input: + /* + * Actual Start of input loop. Take note of time + */ + xorb %ah,%ah # BIOS: Get int $0x1a # system time movw %dx,%di # Ticks when addw _TICKS(%bp),%di # timeout -/* - * Busy loop, looking for keystrokes but keeping one eye on the time. - */ -main.8: +read_key: + /* + * Busy loop, looking for keystrokes but keeping one eye on the time. + */ #ifndef SIO movb $0x1,%ah # BIOS: Check int $0x16 # for keypress - jnz main.11 # Have one #else /* SIO */ movb $0x03,%ah # BIOS: Read COM call bioscom testb $0x01,%ah # Check line status - jnz main.11 # (bit 1 indicates input) + # (bit 1 indicates input) #endif /* SIO */ - xorb %ah,%ah # BIOS: Get - int $0x1a # system time + jnz got_key # Have input + xorb %ah,%ah # BIOS: int 0x1a, 00 + int $0x1a # get system time cmpw %di,%dx # Timeout? - jb main.8 # No -/* - * If timed out or defaulting, come here. - */ -main.9: movb _OPT(%bp),%al # Load default - jmp main.12 # Join common code -/* - * Get the keystroke. - */ -main.11: + jb read_key # No + + /* + * Timed out or default selection + */ +use_default: movb _OPT(%bp),%al # Load default + jmp check_selection # Join common code + + /* + * Get the keystroke. + * ENTER or CR confirm the current selection (same as a timeout). + * Otherwise convert F1..F6 (or '1'..'6') to 0..5 and check if the + * selection is valid. + * The SIO code uses ascii chars, the console code uses scancodes. + */ +got_key: #ifndef SIO - xorb %ah,%ah # BIOS: Get - int $0x16 # keypress - movb %ah,%al # Scan code + xorb %ah,%ah # BIOS: int 0x16, 00 + int $0x16 # get keypress + movb %ah,%al # move scan code to %al + cmpb $KEY_ENTER,%al #else movb $0x02,%ah # BIOS: Receive call bioscom + cmpb $ASCII_CR,%al #endif -/* - * If it's CR act as if timed out. - */ -#ifndef SIO - cmpb $KEY_ENTER,%al # Enter pressed? -#else - cmpb $ASCII_CR,%al # Enter pressed? -#endif - je main.9 # Yes -/* - * Otherwise check if legal. If not ask again. - */ -#ifndef SIO - subb $KEY_F1,%al # Less F1 scan code - cmpb $0x4,%al # F1..F5? - jna main.12 # Yes + je use_default # enter -> default + /* + * Check if the key is acceptable, and loop back if not. + * The console (non-SIO) code looks at scancodes and accepts + * both F1..F6 and 1..6 (the latter costs 6 bytes of code), + * relying on the fact that F1..F6 have higher scancodes than 1..6 + * The SIO code only takes 1..6 + */ +#ifdef SIO /* SIO mode, use ascii values */ + subb $'1',%al # Subtract '1' ascii code +#else /* console mode -- use scancodes */ + subb $KEY_F1,%al /* Subtract F1 scan code */ +#if !defined(ONLY_F_KEYS) + cmpb $0x5,%al # F1..F6 + jna 3f # Yes subb $(KEY_1 - KEY_F1),%al # Less #1 scan code -#else - subb $'1',%al # Less '1' ascii character -#endif - cmpb $0x4,%al # #1..#5? - ja main.10 # No -/* - * We have a selection. If it's a bad selection go back to complain. - * The bits in MNUOPT were set when the options were printed. - * Anything not printed is not an option. - */ -main.12: cbtw # Option - btw %ax,_MNUOPT(%bp) # enabled? - jnc main.10 # No -/* - * Save the info in the original tables - * for rewriting to the disk. - */ + 3: +#endif /* ONLY_F_KEYS */ +#endif /* SIO */ + cmpb $0x5,%al # F1..F6 or 1..6 ? +#ifdef PXE /* enable PXE/INT18 using F6 */ + jne 1f; + int $0x18 # found F6, try INT18 + 1: +#endif /* PXE */ + jae beep # Not in F1..F5, beep + +check_selection: + /* + * We have a selection. If it's a bad selection go back to complain. + * The bits in MNUOPT were set when the options were printed. + * Anything not printed is not an option. + */ + cbtw # Extend (%ah=0 used later) + btw %ax,_MNUOPT(%bp) # Option enabled? + jnc beep # No + /* + * Save the info in the original tables + * for rewriting to the disk. + */ movb %al,_OPT(%bp) # Save option - movw $FAKE,%si # Partition for write - movb (%si),%dl # Drive number + + /* + * Make %si and %bx point to the fake partition at LBA 0 (CHS 0:0:1). + * Because the correct address is already in %bp, just use it. + * Set %dl with the drive number saved in byte 0. + * If we have pressed F5 or 5, then this is a good, fake value + * to present to the next stage boot code. + */ + movw %bp,%si # Partition for write + movb (%si),%dl # Drive number, saved above movw %si,%bx # Partition for read cmpb $0x4,%al # F5/#5 pressed? - pushf # Save - je main.13 # Yes + pushf # Save results for later + je 1f # Yes, F5 + + /* + * F1..F4 was pressed, so make %bx point to the currently + * selected partition, and leave the drive number unchanged. + */ shlb $0x4,%al # Point to addw $partbl,%ax # selected xchgw %bx,%ax # partition movb $0x80,(%bx) # Flag active -/* - * If not asked to do a write-back (flags 0x40) don't do one. - */ -main.13: pushw %bx # Save - testb $0x40,_FLAGS(%bp) # No updates? - jnz main.14 # Yes + /* + * If not asked to do a write-back (flags 0x40) don't do one. + * Around the call, save the partition pointer to %bx and + * restore to %si which is where the next stage expects it. + */ + 1: pushw %bx # Save + testb $NOUPDATE,_FLAGS(%bp) # No updates? + jnz 2f # skip update movw $start,%bx # Data to write movb $0x3,%ah # Write sector callw intx13 # to disk -main.14: popw %si # Restore - popf # Restore -/* - * If going to next drive, replace drive with selected one. - * Remember to un-ascii it. Hey 0x80 is already set, cool! - */ - jne main.15 # If not F5/#5 + 2: popw %si # Restore + + /* + * If going to next drive, replace drive with selected one. + * Remember to un-ascii it. Hey 0x80 is already set, cool! + */ + popf # Restore %al test results + jne 3f # If not F5/#5 movb _NXTDRV(%bp),%dl # Next drive subb $'0',%dl # number -/* - * Load selected bootsector to the LOAD location in RAM. - * If it fails to read or isn't marked bootable, treat it as a bad selection. - */ -main.15: movw $LOAD,%bx # Address for read + /* + * Load selected bootsector to the LOAD location in RAM. If read + * fails or there is no 0x55aa marker, treat it as a bad selection. + */ + 3: movw $LOAD,%bx # Address for read movb $0x2,%ah # Read sector callw intx13 # from disk - jc main.10 # If error + jc beep # If error cmpw $MAGIC,0x1fe(%bx) # Bootable? - jne main.10 # No + jne beep # No pushw %si # Save ptr to selected part. callw putn # Leave some space popw %si # Restore, next stage uses it @@ -326,6 +496,14 @@ main.15: movw $LOAD,%bx # Address for /* * Display routines + * putkey prints the option selected in %dl (F1..F5 or 1..5) followed by + * the string at %si + * putx: print the option in %dl followed by the string at %di + * also record the drive as valid. + * puts: print the string at %si followed by a crlf + * putn: print a crlf + * putstr: print the string at %si + * putchr: print the char in al */ putkey: #ifndef SIO @@ -337,8 +515,9 @@ putkey: jmp putstr.1 # Display the rest /* - * Display the option and note that it is a valid option. - * That last point is a bit tricky.. + * Display the option and record the drive as valid in the options. + * That last point is done using the btsw instruction which does + * a test and set. We don't care for the test part. */ putx: btsw %dx,_MNUOPT(%bp) # Enable menu option movw $item,%si # Display @@ -356,34 +535,43 @@ putstr.1: callw putchr # Display char jmp putstr # Continue putstr.2: andb $~0x80,%al # Clear MSB -#ifndef SIO putchr: +#ifndef SIO pushw %bx # Save movw $0x7,%bx # Page:attribute movb $0xe,%ah # BIOS: Display int $0x10 # character popw %bx # Restore - retw # To caller #else /* SIO */ -putchr: movb $0x01,%ah # BIOS: Send bioscom: pushw %dx # Save xorw %dx,%dx # Use COM1 int $0x14 # Character popw %dx # Restore - retw # To caller #endif /* SIO */ + retw # To caller /* One-sector disk I/O routine */ -intx13: movb 0x1(%si),%dh # Load head +/* + * %dl: drive, %si partition entry, %es:%bx transfer buffer. + * Load the CHS values and possibly the LBA address from the block + * at %si, and use the appropriate method to load the sector. + * Don't use packet mode for a floppy. + */ +intx13: # Prepare CHS parameters + movb 0x1(%si),%dh # Load head movw 0x2(%si),%cx # Load cylinder:sector movb $0x1,%al # Sector count pushw %si # Save movw %sp,%di # Save - testb $0x80,_FLAGS(%bp) # Use packet interface? - jz intx13.1 # No +#ifndef CHECK_DRIVE /* floppy support */ + testb %dl, %dl # is this a floppy ? + jz 1f # Yes, use CHS mode +#endif + testb $USEPACKET,_FLAGS(%bp) # Use packet interface? + jz 1f # No pushl $0x0 # Set the pushl 0x8(%si) # LBA address pushw %es # Set the transfer @@ -393,73 +581,95 @@ intx13: movb 0x1(%si),%dh # Load head movw %sp,%si # Packet pointer decw %ax # Verify off orb $0x40,%ah # Use disk packet -intx13.1: int $0x13 # BIOS: Disk I/O + 1: int $0x13 # BIOS: Disk I/O movw %di,%sp # Restore popw %si # Restore retw # To caller -/* Menu strings */ - +/* + * Various menu strings. 'item' goes after 'prompt' to save space. + * Also use shorter versions to make room for the PXE/INT18 code. + */ +#ifdef PXE +prompt: .ascii "\nBoot:" +item: .ascii " "; .byte ' '|0x80 +#else +prompt: .ascii "\nDefault:" item: .ascii " "; .byte ' '|0x80 -prompt: .ascii "\nDefault:"; .byte ' '|0x80 +#endif crlf: .ascii "\r"; .byte '\n'|0x80 /* Partition type tables */ -tables: -/* - * These entries identify invalid or NON BOOT types and partitions. - */ +non_bootable_ids: + /* + * These entries identify invalid or NON BOOT types and partitions. + * 0: empty, 5: DOS3 ext. partition, 0xf: WIN95 ext partition + */ .byte 0x0, 0x5, 0xf -/* - * These values indicate bootable types we know the names of. - */ +bootable_ids: + /* + * These values indicate bootable types we know the names of. + * 1: FAT12, 4: FAT16 <32M, 6: FAT16 > 32M, 7: NTFS + * 0xb: FAT32, 0xc: FAT32-LBA, 0xe: FAT16-LBA, + * 0x83: linux, 0xa5: FreeBSD, 0xa6: netbsd, 0xa9:openbsd + */ .byte 0x1, 0x6, 0x7, 0xb, 0xc, 0xe, 0x83 - .byte 0xa5, 0xa6, 0xa9 -/* - * These are offsets that match the known names above and point to the strings - * that will be printed. os_misc will be used if the search of the above table - * runs over. - */ - .byte os_dos-. # DOS - .byte os_dos-. # DOS - .byte os_dos-. # Windows - .byte os_dos-. # Windows - .byte os_dos-. # Windows - .byte os_dos-. # Windows - .byte os_linux-. # Linux - .byte os_freebsd-. # FreeBSD - .byte os_bsd-. # OpenBSD - .byte os_bsd-. # NetBSD + .byte 0xa5, 0xa6, 0xa9, 0x4 +desc_ofs: + /* + * Offsets that match the known types above, used to point to the + * actual partition name. The last entry must point to os_misc, + * which is used for non-matching names. + */ + .byte os_dos-. # 1, DOS + .byte os_dos-. # 6, DOS/WIN + .byte os_win-. # 7, Windows + .byte os_win-. # 11, Windows + .byte os_win-. # 12, Windows + .byte os_win-. # 14, Windows + .byte os_linux-. # 131, Linux + .byte os_freebsd-. # 165, FreeBSD + .byte os_bsd-. # 166, OpenBSD + .byte os_bsd-. # 169, NetBSD + .byte os_dos-. # 4, DOS .byte os_misc-. # Unknown -/* - * And here are the strings themselves. 0x80 or'd into a byte indicates - * the end of the string. (not so great for Russians but...) - */ -os_misc: .ascii "?"; .byte '?'|0x80 -os_dos: .ascii "DO"; .byte 'S'|0x80 + + /* + * And here are the strings themselves. The last byte of + * the string has bit 7 set. + */ +os_misc: .byte '?'|0x80 +os_dos: +#if !defined(TEST) /* DOS string only if room */ + .ascii "DO"; .byte 'S'|0x80 +#endif +os_win: .ascii "WI"; .byte 'N'|0x80 os_linux: .ascii "Linu"; .byte 'x'|0x80 os_freebsd: .ascii "Free" os_bsd: .ascii "BS"; .byte 'D'|0x80 - .org PRT_OFF-0xe,0x90 - - .word B0MAGIC # Magic number - + .org B0_OFF,0x90 /* - * These values are sometimes changed before writing back to the drive + * The boot0 version 1.0 parameter table. + * Do not move it nor change the "Drive " string, boot0cfg + * uses its offset and content to identify the boot sector. + * The other fields are sometimes changed before writing back to the drive * Be especially careful that nxtdrv: must come after drive:, as it * is part of the same string. */ drive: .ascii "Drive " nxtdrv: .byte 0x0 # Next drive number opt: .byte 0x0 # Option -setdrv: .byte 0x80 # Drive to force +setdrv_num: .byte 0x80 # Drive to force flags: .byte FLAGS # Flags ticks: .word TICKS # Delay + .org PRT_OFF /* * Here is the 64 byte partition table that fdisk would fiddle with. */ partbl: .fill 0x40,0x1,0x0 # Partition table .word MAGIC # Magic number + .org 0x200 # again, safety check +endblock: From owner-svn-src-head@FreeBSD.ORG Tue Dec 2 15:08:33 2008 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id AA83D1065678; Tue, 2 Dec 2008 15:08:33 +0000 (UTC) (envelope-from peter@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 869E28FC20; Tue, 2 Dec 2008 15:08:33 +0000 (UTC) (envelope-from peter@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mB2F8XF3063722; Tue, 2 Dec 2008 15:08:33 GMT (envelope-from peter@svn.freebsd.org) Received: (from peter@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mB2F8X76063721; Tue, 2 Dec 2008 15:08:33 GMT (envelope-from peter@svn.freebsd.org) Message-Id: <200812021508.mB2F8X76063721@svn.freebsd.org> From: Peter Wemm Date: Tue, 2 Dec 2008 15:08: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: r185563 - head/usr.bin/procstat X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 02 Dec 2008 15:08:33 -0000 Author: peter Date: Tue Dec 2 15:08:33 2008 New Revision: 185563 URL: http://svn.freebsd.org/changeset/base/185563 Log: Update format string for kve_start/end. Modified: head/usr.bin/procstat/procstat_vm.c Modified: head/usr.bin/procstat/procstat_vm.c ============================================================================== --- head/usr.bin/procstat/procstat_vm.c Tue Dec 2 14:57:48 2008 (r185562) +++ head/usr.bin/procstat/procstat_vm.c Tue Dec 2 15:08:33 2008 (r185563) @@ -34,6 +34,7 @@ #include #include #include +#include #include #include "procstat.h" @@ -56,8 +57,8 @@ procstat_vm(pid_t pid, struct kinfo_proc for (i = 0; i < cnt; i++) { kve = &freep[i]; printf("%5d ", pid); - printf("%*p ", ptrwidth, kve->kve_start); - printf("%*p ", ptrwidth, kve->kve_end); + printf("%#*jx ", ptrwidth, (uintmax_t)kve->kve_start); + printf("%#*jx ", ptrwidth, (uintmax_t)kve->kve_end); printf("%s", kve->kve_protection & KVME_PROT_READ ? "r" : "-"); printf("%s", kve->kve_protection & KVME_PROT_WRITE ? "w" : "-"); printf("%s ", kve->kve_protection & KVME_PROT_EXEC ? "x" : "-"); From owner-svn-src-head@FreeBSD.ORG Tue Dec 2 15:21:26 2008 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A2B161065672 for ; Tue, 2 Dec 2008 15:21:26 +0000 (UTC) (envelope-from peter@wemm.org) Received: from mail-qy0-f18.google.com (mail-qy0-f18.google.com [209.85.221.18]) by mx1.freebsd.org (Postfix) with ESMTP id 5CA5A8FC20 for ; Tue, 2 Dec 2008 15:21:26 +0000 (UTC) (envelope-from peter@wemm.org) Received: by qyk11 with SMTP id 11so3486732qyk.19 for ; Tue, 02 Dec 2008 07:21:25 -0800 (PST) Received: by 10.143.160.17 with SMTP id m17mr4914048wfo.298.1228231284877; Tue, 02 Dec 2008 07:21:24 -0800 (PST) Received: by 10.142.255.21 with HTTP; Tue, 2 Dec 2008 07:21:24 -0800 (PST) Message-ID: Date: Tue, 2 Dec 2008 07:21:24 -0800 From: "Peter Wemm" To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org In-Reply-To: <200812021508.mB2F8X76063721@svn.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <200812021508.mB2F8X76063721@svn.freebsd.org> Cc: Subject: Re: svn commit: r185563 - head/usr.bin/procstat X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 02 Dec 2008 15:21:26 -0000 On Tue, Dec 2, 2008 at 7:08 AM, Peter Wemm wrote: > Log: > Update format string for kve_start/end. I'm sorry everyone. This was really poor form. Lesson's I've learned: 1) When you test build, make sure you use the source tree that you actually applied the patches to. 2) Testing individual components of a change in isolation doesn't always catch that. (eg: the procstat change didn't cause a problem without the update in /usr/include) 3) I need some bandages for my foot. -Peter -- Peter Wemm - peter@wemm.org; peter@FreeBSD.org; peter@yahoo-inc.com; KI6FJV "All of this is for nothing if we don't go to the stars" - JMS/B5 "If Java had true garbage collection, most programs would delete themselves upon execution." -- Robert Sewell From owner-svn-src-head@FreeBSD.ORG Tue Dec 2 15:25:20 2008 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0B6BB1065672; Tue, 2 Dec 2008 15:25:20 +0000 (UTC) (envelope-from des@des.no) Received: from tim.des.no (tim.des.no [194.63.250.121]) by mx1.freebsd.org (Postfix) with ESMTP id B6AF08FC0A; Tue, 2 Dec 2008 15:25:19 +0000 (UTC) (envelope-from des@des.no) Received: from ds4.des.no (des.no [84.49.246.2]) by smtp.des.no (Postfix) with ESMTP id 037296D43F; Tue, 2 Dec 2008 15:25:19 +0000 (UTC) Received: by ds4.des.no (Postfix, from userid 1001) id D8A56844EE; Tue, 2 Dec 2008 16:25:18 +0100 (CET) From: =?utf-8?Q?Dag-Erling_Sm=C3=B8rgrav?= To: "Peter Wemm" References: <200812021508.mB2F8X76063721@svn.freebsd.org> Date: Tue, 02 Dec 2008 16:25:18 +0100 In-Reply-To: (Peter Wemm's message of "Tue, 2 Dec 2008 07:21:24 -0800") Message-ID: <861vwq4n1d.fsf@ds4.des.no> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (berkeley-unix) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r185563 - head/usr.bin/procstat X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 02 Dec 2008 15:25:20 -0000 "Peter Wemm" writes: > 3) I need some bandages for my foot. I thought feet were rwatson's specialty, and yours was screen doors? *ducks* *runs* DES --=20 Dag-Erling Sm=C3=B8rgrav - des@des.no From owner-svn-src-head@FreeBSD.ORG Tue Dec 2 15:42:47 2008 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DE7CC1065670; Tue, 2 Dec 2008 15:42:47 +0000 (UTC) (envelope-from gnn@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C56808FC08; Tue, 2 Dec 2008 15:42:47 +0000 (UTC) (envelope-from gnn@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mB2FgldS064505; Tue, 2 Dec 2008 15:42:47 GMT (envelope-from gnn@svn.freebsd.org) Received: (from gnn@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mB2FglPS064504; Tue, 2 Dec 2008 15:42:47 GMT (envelope-from gnn@svn.freebsd.org) Message-Id: <200812021542.mB2FglPS064504@svn.freebsd.org> From: "George V. Neville-Neil" Date: Tue, 2 Dec 2008 15:42: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: r185564 - head/sys/dev/cxgb/common X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 02 Dec 2008 15:42:48 -0000 Author: gnn Date: Tue Dec 2 15:42:47 2008 New Revision: 185564 URL: http://svn.freebsd.org/changeset/base/185564 Log: Bug fix from Chelsio which addresses the issue of the device resetting when it sees only received packets. In some cases where a device only recieves data it mistakenly thinks that its transmitting side is broken and resets the device. Obtained from: Chelsio Inc. MFC after: 3 days Modified: head/sys/dev/cxgb/common/cxgb_xgmac.c Modified: head/sys/dev/cxgb/common/cxgb_xgmac.c ============================================================================== --- head/sys/dev/cxgb/common/cxgb_xgmac.c Tue Dec 2 15:08:33 2008 (r185563) +++ head/sys/dev/cxgb/common/cxgb_xgmac.c Tue Dec 2 15:42:47 2008 (r185564) @@ -633,20 +633,15 @@ int t3b2_mac_watchdog_task(struct cmac * adapter_t *adap = mac->adapter; struct mac_stats *s = &mac->stats; unsigned int tx_mcnt = (unsigned int)s->tx_frames; - unsigned int rx_mcnt = (unsigned int)s->rx_frames; - unsigned int rx_xcnt; if (mac->multiport) { tx_mcnt = t3_read_reg(adap, A_XGM_STAT_TX_FRAME_LOW); - rx_mcnt = t3_read_reg(adap, A_XGM_STAT_RX_FRAMES_LOW); } else { tx_mcnt = (unsigned int)s->tx_frames; - rx_mcnt = (unsigned int)s->rx_frames; } status = 0; tx_xcnt = 1; /* By default tx_xcnt is making progress*/ tx_tcnt = mac->tx_tcnt; /* If tx_mcnt is progressing ignore tx_tcnt*/ - rx_xcnt = 1; /* By default rx_xcnt is making progress*/ if (tx_mcnt == mac->tx_mcnt && mac->rx_pause == s->rx_pause) { tx_xcnt = (G_TXSPI4SOPCNT(t3_read_reg(adap, A_XGM_TX_SPI4_SOP_EOP_CNT + @@ -657,11 +652,11 @@ int t3b2_mac_watchdog_task(struct cmac * tx_tcnt = (G_TXDROPCNTCH0RCVD(t3_read_reg(adap, A_TP_PIO_DATA))); } else { - goto rxcheck; + goto out; } } else { mac->toggle_cnt = 0; - goto rxcheck; + goto out; } if ((tx_tcnt != mac->tx_tcnt) && (mac->tx_xcnt == 0)) { @@ -674,22 +669,6 @@ int t3b2_mac_watchdog_task(struct cmac * } } else { mac->toggle_cnt = 0; - goto rxcheck; - } - -rxcheck: - if (rx_mcnt != mac->rx_mcnt) { - rx_xcnt = (G_TXSPI4SOPCNT(t3_read_reg(adap, - A_XGM_RX_SPI4_SOP_EOP_CNT + - mac->offset))) + - (s->rx_fifo_ovfl - mac->rx_ocnt); - mac->rx_ocnt = s->rx_fifo_ovfl; - } else - goto out; - - if (mac->rx_mcnt != s->rx_frames && rx_xcnt == 0 && mac->rx_xcnt == 0) { - if (!mac->multiport) - status = 2; goto out; } @@ -697,8 +676,6 @@ out: mac->tx_tcnt = tx_tcnt; mac->tx_xcnt = tx_xcnt; mac->tx_mcnt = s->tx_frames; - mac->rx_xcnt = rx_xcnt; - mac->rx_mcnt = s->rx_frames; mac->rx_pause = s->rx_pause; if (status == 1) { t3_write_reg(adap, A_XGM_TX_CTRL + mac->offset, 0); From owner-svn-src-head@FreeBSD.ORG Tue Dec 2 16:46:01 2008 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A174D1065673; Tue, 2 Dec 2008 16:46:01 +0000 (UTC) (envelope-from kensmith@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 896588FC19; Tue, 2 Dec 2008 16:46:01 +0000 (UTC) (envelope-from kensmith@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mB2Gk1ad065910; Tue, 2 Dec 2008 16:46:01 GMT (envelope-from kensmith@svn.freebsd.org) Received: (from kensmith@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mB2Gk1Xj065909; Tue, 2 Dec 2008 16:46:01 GMT (envelope-from kensmith@svn.freebsd.org) Message-Id: <200812021646.mB2Gk1Xj065909@svn.freebsd.org> From: Ken Smith Date: Tue, 2 Dec 2008 16:46: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: r185565 - head/etc X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 02 Dec 2008 16:46:01 -0000 Author: kensmith Date: Tue Dec 2 16:46:01 2008 New Revision: 185565 URL: http://svn.freebsd.org/changeset/base/185565 Log: The slip.log file got removed along with the MPSAFE tty work. If slip does ever come back it's probably best if its log file be something that gets added if the user decided they want to run slip instead of having it here unconditionally. Modified: head/etc/newsyslog.conf Modified: head/etc/newsyslog.conf ============================================================================== --- head/etc/newsyslog.conf Tue Dec 2 15:42:47 2008 (r185564) +++ head/etc/newsyslog.conf Tue Dec 2 16:46:01 2008 (r185565) @@ -33,7 +33,6 @@ /var/log/ppp.log root:network 640 3 100 * JC /var/log/security 600 10 100 * JC /var/log/sendmail.st 640 10 * 168 B -/var/log/slip.log root:network 640 3 100 * J /var/log/weekly.log 640 5 1 $W6D0 JN /var/log/wtmp 644 3 * @01T05 B /var/log/xferlog 600 7 100 * JC From owner-svn-src-head@FreeBSD.ORG Tue Dec 2 16:57:19 2008 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7832710656DC; Tue, 2 Dec 2008 16:57:19 +0000 (UTC) (envelope-from sam@freebsd.org) Received: from ebb.errno.com (ebb.errno.com [69.12.149.25]) by mx1.freebsd.org (Postfix) with ESMTP id 45E908FC23; Tue, 2 Dec 2008 16:57:19 +0000 (UTC) (envelope-from sam@freebsd.org) Received: from trouble.errno.com (trouble.errno.com [10.0.0.248]) (authenticated bits=0) by ebb.errno.com (8.13.6/8.12.6) with ESMTP id mB2GvIxP009870 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Tue, 2 Dec 2008 08:57:19 -0800 (PST) (envelope-from sam@freebsd.org) Message-ID: <493568EE.20609@freebsd.org> Date: Tue, 02 Dec 2008 08:57:18 -0800 From: Sam Leffler Organization: FreeBSD Project User-Agent: Thunderbird 2.0.0.9 (X11/20071125) MIME-Version: 1.0 To: "Bjoern A. Zeeb" References: <200812020445.mB24jXaS048636@svn.freebsd.org> <20081202064345.S80401@maildrop.int.zabbadoz.net> In-Reply-To: <20081202064345.S80401@maildrop.int.zabbadoz.net> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-DCC--Metrics: ebb.errno.com; whitelist Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Paul Saab Subject: Re: svn commit: r185544 - head/sys/modules/ae X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 02 Dec 2008 16:57:19 -0000 Bjoern A. Zeeb wrote: > On Tue, 2 Dec 2008, Paul Saab wrote: > >> Author: ps >> Date: Tue Dec 2 04:45:33 2008 >> New Revision: 185544 >> URL: http://svn.freebsd.org/changeset/base/185544 >> >> Log: >> Fix world by including opt_route.h > > Where did world fail for you? > > I assume what failed was a single direct module build? Per discussion > on current@ we are working on this but it's a long list of files with > awkward dependencies to go through. > > If that was the only problem, the manual module build, please let me > know so I can back this out again as soon as the vimage header files > are untangled. Note I added explicit opt_route.h to all the ath-related modules because I hit problems too. I must've missed the discussion on current@. Sam From owner-svn-src-head@FreeBSD.ORG Tue Dec 2 17:15:09 2008 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 12BB71065673; Tue, 2 Dec 2008 17:15:09 +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 B54998FC13; Tue, 2 Dec 2008 17:15:08 +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 9144341C711; Tue, 2 Dec 2008 18:15:06 +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 Psx0qMBwwu+g; Tue, 2 Dec 2008 18:15:06 +0100 (CET) Received: by mail.cksoft.de (Postfix, from userid 66) id 3D05041C70C; Tue, 2 Dec 2008 18:15:06 +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 538DA4448D5; Tue, 2 Dec 2008 17:15:00 +0000 (UTC) Date: Tue, 2 Dec 2008 17:15:00 +0000 (UTC) From: "Bjoern A. Zeeb" X-X-Sender: bz@maildrop.int.zabbadoz.net To: Sam Leffler In-Reply-To: <493568EE.20609@freebsd.org> Message-ID: <20081202170528.S80401@maildrop.int.zabbadoz.net> References: <200812020445.mB24jXaS048636@svn.freebsd.org> <20081202064345.S80401@maildrop.int.zabbadoz.net> <493568EE.20609@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, Paul Saab Subject: Re: svn commit: r185544 - head/sys/modules/ae X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 02 Dec 2008 17:15:09 -0000 On Tue, 2 Dec 2008, Sam Leffler wrote: Hi, > Bjoern A. Zeeb wrote: >> On Tue, 2 Dec 2008, Paul Saab wrote: >> >>> Author: ps >>> Date: Tue Dec 2 04:45:33 2008 >>> New Revision: 185544 >>> URL: http://svn.freebsd.org/changeset/base/185544 >>> >>> Log: >>> Fix world by including opt_route.h >> >> Where did world fail for you? >> >> I assume what failed was a single direct module build? Per discussion >> on current@ we are working on this but it's a long list of files with >> awkward dependencies to go through. >> >> If that was the only problem, the manual module build, please let me >> know so I can back this out again as soon as the vimage header files >> are untangled. > Note I added explicit opt_route.h to all the ath-related modules because I > hit problems too. I must've missed the discussion on current@. No problem and thanks for the note. I have removed them all and then readded the ones still (really) needed. The universe that is currently building doesn't have them in ath*/Makefiles and ae/Makefile anymore. Did a make depend in sys/modules/ and after the initial untangling we are down from ~390 to 14 modules still inlcuding vnet.h and thus depending on opt_route.h A veriosn of the patch is here: http://people.freebsd.org/~bz/20081202-v-h-06.diff There is more cleanup to follow afterwards. I also found quite a few other spots going through more >100 files... but that's initally unrelated and in my general "INET cleanup" pigeonhole. /bz -- Bjoern A. Zeeb Stop bit received. Insert coin for new game. From owner-svn-src-head@FreeBSD.ORG Tue Dec 2 18:13:29 2008 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id EC62310656A7; Tue, 2 Dec 2008 18:13:29 +0000 (UTC) (envelope-from kensmith@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D91BF8FC12; Tue, 2 Dec 2008 18:13:29 +0000 (UTC) (envelope-from kensmith@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mB2IDTrg067635; Tue, 2 Dec 2008 18:13:29 GMT (envelope-from kensmith@svn.freebsd.org) Received: (from kensmith@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mB2IDTig067634; Tue, 2 Dec 2008 18:13:29 GMT (envelope-from kensmith@svn.freebsd.org) Message-Id: <200812021813.mB2IDTig067634@svn.freebsd.org> From: Ken Smith Date: Tue, 2 Dec 2008 18:13: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: r185566 - head/etc X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 02 Dec 2008 18:13:30 -0000 Author: kensmith Date: Tue Dec 2 18:13:29 2008 New Revision: 185566 URL: http://svn.freebsd.org/changeset/base/185566 Log: Remove slip.log. Slip got removed as part of the MPSAFE tty work. If it does come back it would probably be better if users who were interested in slip added appropriate lines instead of this being here unconditionally. Reminded by: tut nhamon com ua Modified: head/etc/syslog.conf Modified: head/etc/syslog.conf ============================================================================== --- head/etc/syslog.conf Tue Dec 2 16:46:01 2008 (r185565) +++ head/etc/syslog.conf Tue Dec 2 18:13:29 2008 (r185566) @@ -26,7 +26,5 @@ cron.* /var/log/cron # news.crit /var/log/news/news.crit # news.err /var/log/news/news.err # news.notice /var/log/news/news.notice -!startslip -*.* /var/log/slip.log !ppp *.* /var/log/ppp.log From owner-svn-src-head@FreeBSD.ORG Tue Dec 2 19:09:09 2008 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2BCCC1065680; Tue, 2 Dec 2008 19:09:09 +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 18E698FC16; Tue, 2 Dec 2008 19:09:09 +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 mB2J98lN068826; Tue, 2 Dec 2008 19:09:08 GMT (envelope-from ed@svn.freebsd.org) Received: (from ed@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mB2J98SL068818; Tue, 2 Dec 2008 19:09:08 GMT (envelope-from ed@svn.freebsd.org) Message-Id: <200812021909.mB2J98SL068818@svn.freebsd.org> From: Ed Schouten Date: Tue, 2 Dec 2008 19:09: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: r185567 - in head/sys: amd64/conf i386/conf ia64/conf pc98/conf powerpc/conf sparc64/conf sun4v/conf X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 02 Dec 2008 19:09:09 -0000 Author: ed Date: Tue Dec 2 19:09:08 2008 New Revision: 185567 URL: http://svn.freebsd.org/changeset/base/185567 Log: Remove "[KEEP THIS!]" from COMPAT_43TTY. It's not really that important. Sgtty is a programming interface that has been replaced by termios over the years. In June we already removed , which exposes the ioctl()'s that are implemented by this interface. The importance of this flag is overrated right now. Modified: head/sys/amd64/conf/GENERIC head/sys/i386/conf/GENERIC head/sys/i386/conf/XEN head/sys/ia64/conf/GENERIC head/sys/pc98/conf/GENERIC head/sys/powerpc/conf/GENERIC head/sys/sparc64/conf/GENERIC head/sys/sun4v/conf/GENERIC Modified: head/sys/amd64/conf/GENERIC ============================================================================== --- head/sys/amd64/conf/GENERIC Tue Dec 2 18:13:29 2008 (r185566) +++ head/sys/amd64/conf/GENERIC Tue Dec 2 19:09:08 2008 (r185567) @@ -48,7 +48,7 @@ options PROCFS # Process filesystem ( options PSEUDOFS # Pseudo-filesystem framework options GEOM_PART_GPT # GUID Partition Tables. options GEOM_LABEL # Provides labelization -options COMPAT_43TTY # BSD 4.3 TTY compat [KEEP THIS!] +options COMPAT_43TTY # BSD 4.3 TTY compat (sgtty) options COMPAT_IA32 # Compatible with i386 binaries options COMPAT_FREEBSD4 # Compatible with FreeBSD4 options COMPAT_FREEBSD5 # Compatible with FreeBSD5 Modified: head/sys/i386/conf/GENERIC ============================================================================== --- head/sys/i386/conf/GENERIC Tue Dec 2 18:13:29 2008 (r185566) +++ head/sys/i386/conf/GENERIC Tue Dec 2 19:09:08 2008 (r185567) @@ -49,7 +49,7 @@ options PROCFS # Process filesystem ( options PSEUDOFS # Pseudo-filesystem framework options GEOM_PART_GPT # GUID Partition Tables. options GEOM_LABEL # Provides labelization -options COMPAT_43TTY # BSD 4.3 TTY compat [KEEP THIS!] +options COMPAT_43TTY # BSD 4.3 TTY compat (sgtty) options COMPAT_FREEBSD4 # Compatible with FreeBSD4 options COMPAT_FREEBSD5 # Compatible with FreeBSD5 options COMPAT_FREEBSD6 # Compatible with FreeBSD6 Modified: head/sys/i386/conf/XEN ============================================================================== --- head/sys/i386/conf/XEN Tue Dec 2 18:13:29 2008 (r185566) +++ head/sys/i386/conf/XEN Tue Dec 2 19:09:08 2008 (r185567) @@ -31,7 +31,7 @@ options PROCFS # Process filesystem ( options PSEUDOFS # Pseudo-filesystem framework options GEOM_PART_GPT # GUID Partition Tables. options GEOM_LABEL # Provides labelization -options COMPAT_43TTY # BSD 4.3 TTY compat [KEEP THIS!] +options COMPAT_43TTY # BSD 4.3 TTY compat (sgtty) options COMPAT_FREEBSD4 # Compatible with FreeBSD4 options COMPAT_FREEBSD5 # Compatible with FreeBSD5 options COMPAT_FREEBSD6 # Compatible with FreeBSD6 Modified: head/sys/ia64/conf/GENERIC ============================================================================== --- head/sys/ia64/conf/GENERIC Tue Dec 2 18:13:29 2008 (r185566) +++ head/sys/ia64/conf/GENERIC Tue Dec 2 19:09:08 2008 (r185567) @@ -27,7 +27,7 @@ makeoptions DEBUG=-g # Build kernel with options AUDIT # Security event auditing options CD9660 # ISO 9660 Filesystem -options COMPAT_43TTY # BSD 4.3 TTY compat [KEEP THIS!] +options COMPAT_43TTY # BSD 4.3 TTY compat (sgtty) options COMPAT_FREEBSD6 # Compatible with FreeBSD6 options COMPAT_FREEBSD7 # Compatible with FreeBSD7 options DDB # Support DDB Modified: head/sys/pc98/conf/GENERIC ============================================================================== --- head/sys/pc98/conf/GENERIC Tue Dec 2 18:13:29 2008 (r185566) +++ head/sys/pc98/conf/GENERIC Tue Dec 2 19:09:08 2008 (r185567) @@ -49,7 +49,7 @@ options PROCFS # Process filesystem ( options PSEUDOFS # Pseudo-filesystem framework options GEOM_PART_GPT # GUID Partition Tables. options GEOM_LABEL # Provides labelization -options COMPAT_43TTY # BSD 4.3 TTY compat [KEEP THIS!] +options COMPAT_43TTY # BSD 4.3 TTY compat (sgtty) options COMPAT_FREEBSD4 # Compatible with FreeBSD4 options COMPAT_FREEBSD5 # Compatible with FreeBSD5 options COMPAT_FREEBSD6 # Compatible with FreeBSD6 Modified: head/sys/powerpc/conf/GENERIC ============================================================================== --- head/sys/powerpc/conf/GENERIC Tue Dec 2 18:13:29 2008 (r185566) +++ head/sys/powerpc/conf/GENERIC Tue Dec 2 19:09:08 2008 (r185567) @@ -50,7 +50,7 @@ options PROCFS #Process filesystem (r options PSEUDOFS #Pseudo-filesystem framework options GEOM_PART_GPT #GUID Partition Tables. options GEOM_LABEL #Provides labelization -options COMPAT_43TTY #BSD 4.3 TTY compat [KEEP THIS!] +options COMPAT_43TTY #BSD 4.3 TTY compat (sgtty) options COMPAT_FREEBSD4 #Keep this for a while options COMPAT_FREEBSD5 #Compatible with FreeBSD5 options COMPAT_FREEBSD6 #Compatible with FreeBSD6 Modified: head/sys/sparc64/conf/GENERIC ============================================================================== --- head/sys/sparc64/conf/GENERIC Tue Dec 2 18:13:29 2008 (r185566) +++ head/sys/sparc64/conf/GENERIC Tue Dec 2 19:09:08 2008 (r185567) @@ -52,7 +52,7 @@ options PROCFS # Process filesystem ( options PSEUDOFS # Pseudo-filesystem framework options GEOM_PART_GPT # GUID Partition Tables. options GEOM_LABEL # Provides labelization -options COMPAT_43TTY # BSD 4.3 TTY compat [KEEP THIS!] +options COMPAT_43TTY # BSD 4.3 TTY compat (sgtty) options COMPAT_FREEBSD5 # Compatible with FreeBSD5 options COMPAT_FREEBSD6 # Compatible with FreeBSD6 options COMPAT_FREEBSD7 # Compatible with FreeBSD7 Modified: head/sys/sun4v/conf/GENERIC ============================================================================== --- head/sys/sun4v/conf/GENERIC Tue Dec 2 18:13:29 2008 (r185566) +++ head/sys/sun4v/conf/GENERIC Tue Dec 2 19:09:08 2008 (r185567) @@ -51,8 +51,8 @@ options PROCFS # Process filesystem ( options PSEUDOFS # Pseudo-filesystem framework options GEOM_PART_GPT # GUID Partition Tables. options GEOM_LABEL # Provides labelization -options COMPAT_43 # Compatible with BSD 4.3 [KEEP THIS!] -options COMPAT_43TTY # BSD 4.3 TTY compat [KEEP THIS!] +options COMPAT_43 # Compatible with BSD 4.3 (sgtty) +options COMPAT_43TTY # BSD 4.3 TTY compat (sgtty) options COMPAT_FREEBSD5 # Compatible with FreeBSD5 options SCSI_DELAY=5000 # Delay (in ms) before probing SCSI options KTRACE # ktrace(1) support From owner-svn-src-head@FreeBSD.ORG Tue Dec 2 19:49:41 2008 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9B67A1065670; Tue, 2 Dec 2008 19:49:41 +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 8A63A8FC1B; Tue, 2 Dec 2008 19:49:41 +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 mB2JnfOf069754; Tue, 2 Dec 2008 19:49:41 GMT (envelope-from phk@svn.freebsd.org) Received: (from phk@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mB2JnfZr069753; Tue, 2 Dec 2008 19:49:41 GMT (envelope-from phk@svn.freebsd.org) Message-Id: <200812021949.mB2JnfZr069753@svn.freebsd.org> From: Poul-Henning Kamp Date: Tue, 2 Dec 2008 19:49: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: r185568 - head/lib/libmd X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 02 Dec 2008 19:49:41 -0000 Author: phk Date: Tue Dec 2 19:49:41 2008 New Revision: 185568 URL: http://svn.freebsd.org/changeset/base/185568 Log: Make the "test" target test the compiled version, instead of the installed version of the md library. Modified: head/lib/libmd/Makefile Modified: head/lib/libmd/Makefile ============================================================================== --- head/lib/libmd/Makefile Tue Dec 2 19:09:08 2008 (r185567) +++ head/lib/libmd/Makefile Tue Dec 2 19:49:41 2008 (r185568) @@ -169,27 +169,27 @@ rmd160.ref: test: md2.ref md4.ref md5.ref sha0.ref rmd160.ref sha1.ref sha256.ref @${ECHO} if any of these test fail, the code produces wrong results @${ECHO} and should NOT be used. - ${CC} ${CFLAGS} ${LDFLAGS} -DMD=2 -o mddriver ${.CURDIR}/mddriver.c -L. -lmd + ${CC} ${CFLAGS} ${LDFLAGS} -DMD=2 -o mddriver ${.CURDIR}/mddriver.c ./libmd.a ./mddriver | cmp md2.ref - @${ECHO} MD2 passed test - ${CC} ${CFLAGS} ${LDFLAGS} -DMD=4 -o mddriver ${.CURDIR}/mddriver.c -L. -lmd + ${CC} ${CFLAGS} ${LDFLAGS} -DMD=4 -o mddriver ${.CURDIR}/mddriver.c libmd.a ./mddriver | cmp md4.ref - @${ECHO} MD4 passed test - ${CC} ${CFLAGS} ${LDFLAGS} -DMD=5 -o mddriver ${.CURDIR}/mddriver.c -L. -lmd + ${CC} ${CFLAGS} ${LDFLAGS} -DMD=5 -o mddriver ${.CURDIR}/mddriver.c libmd.a ./mddriver | cmp md5.ref - @${ECHO} MD5 passed test -rm -f mddriver - ${CC} ${CFLAGS} ${LDFLAGS} -o rmddriver ${.CURDIR}/rmddriver.c -L. -lmd + ${CC} ${CFLAGS} ${LDFLAGS} -o rmddriver ${.CURDIR}/rmddriver.c libmd.a ./rmddriver | cmp rmd160.ref - @${ECHO} RIPEMD160 passed test -rm -f rmddriver - ${CC} ${CFLAGS} ${LDFLAGS} -DSHA=0 -o shadriver ${.CURDIR}/shadriver.c -L. -lmd + ${CC} ${CFLAGS} ${LDFLAGS} -DSHA=0 -o shadriver ${.CURDIR}/shadriver.c libmd.a ./shadriver | cmp sha0.ref - @${ECHO} SHA-0 passed test - ${CC} ${CFLAGS} ${LDFLAGS} -DSHA=1 -o shadriver ${.CURDIR}/shadriver.c -L. -lmd + ${CC} ${CFLAGS} ${LDFLAGS} -DSHA=1 -o shadriver ${.CURDIR}/shadriver.c libmd.a ./shadriver | cmp sha1.ref - @${ECHO} SHA-1 passed test - ${CC} ${CFLAGS} ${LDFLAGS} -DSHA=256 -o shadriver ${.CURDIR}/shadriver.c -L. -lmd + ${CC} ${CFLAGS} ${LDFLAGS} -DSHA=256 -o shadriver ${.CURDIR}/shadriver.c libmd.a ./shadriver | cmp sha256.ref - @${ECHO} SHA-256 passed test -rm -f shadriver From owner-svn-src-head@FreeBSD.ORG Tue Dec 2 21:15:01 2008 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DE5291065672; Tue, 2 Dec 2008 21:15:01 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from server.baldwin.cx (bigknife-pt.tunnel.tserv9.chi1.ipv6.he.net [IPv6:2001:470:1f10:75::2]) by mx1.freebsd.org (Postfix) with ESMTP id 7A00F8FC18; Tue, 2 Dec 2008 21:15:01 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from localhost.corp.yahoo.com (john@localhost [IPv6:::1]) (authenticated bits=0) by server.baldwin.cx (8.14.3/8.14.3) with ESMTP id mB2LEsxI011443; Tue, 2 Dec 2008 16:14:55 -0500 (EST) (envelope-from jhb@freebsd.org) From: John Baldwin To: Konstantin Belousov Date: Tue, 2 Dec 2008 14:19:36 -0500 User-Agent: KMail/1.9.7 References: <200812021114.mB2BEHB3058629@svn.freebsd.org> In-Reply-To: <200812021114.mB2BEHB3058629@svn.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200812021419.37380.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH authentication, not delayed by milter-greylist-2.0.2 (server.baldwin.cx [IPv6:::1]); Tue, 02 Dec 2008 16:14:55 -0500 (EST) X-Virus-Scanned: ClamAV 0.93.1/8712/Tue Dec 2 12:14:43 2008 on server.baldwin.cx X-Virus-Status: Clean X-Spam-Status: No, score=-2.6 required=4.2 tests=AWL,BAYES_00,NO_RELAYS 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: r185557 - 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, 02 Dec 2008 21:15:02 -0000 On Tuesday 02 December 2008 06:14:17 am Konstantin Belousov wrote: > Author: kib > Date: Tue Dec 2 11:14:16 2008 > New Revision: 185557 > URL: http://svn.freebsd.org/changeset/base/185557 > > Log: > Shared lookup makes it possible to create several negative cache > entries for one name. Then, creating inode with that name would remove > one entry, leaving others dormant. Reclaiming the vnode would uncover > negative entries, causing false return of ENOENT from the calls like > stat, that do not create inode. > > Prevent creation of the duplicated negative entries. > > Reported and debugged with: pho > Reviewed by: jhb > X-MFC: after shared lookup changes Actually, the NFS client code already supports shared lookups in 6.x+, so I would suggest MFC'ing this in a week or so to both 6.x and 7.x. -- John Baldwin From owner-svn-src-head@FreeBSD.ORG Tue Dec 2 21:15:08 2008 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D89E1106576E; Tue, 2 Dec 2008 21:15:08 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from server.baldwin.cx (bigknife-pt.tunnel.tserv9.chi1.ipv6.he.net [IPv6:2001:470:1f10:75::2]) by mx1.freebsd.org (Postfix) with ESMTP id B42208FC0C; Tue, 2 Dec 2008 21:15:07 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from localhost.corp.yahoo.com (john@localhost [IPv6:::1]) (authenticated bits=0) by server.baldwin.cx (8.14.3/8.14.3) with ESMTP id mB2LEsxJ011443; Tue, 2 Dec 2008 16:15:01 -0500 (EST) (envelope-from jhb@freebsd.org) From: John Baldwin To: Luigi Rizzo Date: Tue, 2 Dec 2008 14:24:58 -0500 User-Agent: KMail/1.9.7 References: <200812021457.mB2Evmha063418@svn.freebsd.org> In-Reply-To: <200812021457.mB2Evmha063418@svn.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200812021425.00173.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH authentication, not delayed by milter-greylist-2.0.2 (server.baldwin.cx [IPv6:::1]); Tue, 02 Dec 2008 16:15:01 -0500 (EST) X-Virus-Scanned: ClamAV 0.93.1/8712/Tue Dec 2 12:14:43 2008 on server.baldwin.cx X-Virus-Status: Clean X-Spam-Status: No, score=-2.6 required=4.2 tests=AWL,BAYES_00,NO_RELAYS 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: r185562 - head/sys/boot/i386/boot0 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 02 Dec 2008 21:15:09 -0000 On Tuesday 02 December 2008 09:57:48 am Luigi Rizzo wrote: > Author: luigi > Date: Tue Dec 2 14:57:48 2008 > New Revision: 185562 > URL: http://svn.freebsd.org/changeset/base/185562 > > Log: > This commits brings in a lot of documentation and some enhancement > of the boot0.S code, with a number of compile-time selectable options, > the most interesting one being the ability to select PXE booting. > > The code is completely compatible with the previous one, and with > the boot0cfg program. Even the actual code is largely unmodified, > with only minor rearrangements or fixes to make room for the new > features. > > The behaviour of the standard build differs from the previous > version in the following, minor things: > > + 'noupdate' is the default, which means the code does not > write back the selection to disk. You can enable the feature > at runtime with boot0cfg, or changing the flags in the Makefile. > > + a drive number of 0x00 (floppy, or USB in floppy emulation) is > now accepted as valid. Previously, it was overridden with 0x80, > meaning that the partition table coming from the media was > used to access sectors on a possibly different media. > You can revert to the previous mode building with -DCHECK_DRIVE, > and you can always use the 'setdrv' option in boot0cfg I would flip this back to the original default. This was there to workaround certain broken BIOSes that incorrectly specified a drive of 0x00 when you booted from the hard drive (at least according to the comments). On such systems they will now fail to boot. MBR's aren't really supported on floppies, so you shouldn't ever have a legitmate %dl of 0x00. In the rare case that you do you could use the 'setdrv' option to boot0cfg. -- John Baldwin From owner-svn-src-head@FreeBSD.ORG Tue Dec 2 21:37:32 2008 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CE497106564A; Tue, 2 Dec 2008 21:37:32 +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 B91A48FC13; Tue, 2 Dec 2008 21:37:32 +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 mB2LbWw0072112; Tue, 2 Dec 2008 21:37:32 GMT (envelope-from bz@svn.freebsd.org) Received: (from bz@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mB2LbSDN072024; Tue, 2 Dec 2008 21:37:28 GMT (envelope-from bz@svn.freebsd.org) Message-Id: <200812022137.mB2LbSDN072024@svn.freebsd.org> From: "Bjoern A. Zeeb" Date: Tue, 2 Dec 2008 21:37: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: r185571 - in head/sys: compat/linprocfs compat/linux compat/svr4 contrib/altq/altq contrib/ipfilter/netinet contrib/pf/net contrib/rdma dev/cxgb/ulp/iw_cxgb dev/cxgb/ulp/tom kern module... X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 02 Dec 2008 21:37:33 -0000 Author: bz Date: Tue Dec 2 21:37:28 2008 New Revision: 185571 URL: http://svn.freebsd.org/changeset/base/185571 Log: Rather than using hidden includes (with cicular dependencies), directly include only the header files needed. This reduces the unneeded spamming of various headers into lots of files. For now, this leaves us with very few modules including vnet.h and thus needing to depend on opt_route.h. Reviewed by: brooks, gnn, des, zec, imp Sponsored by: The FreeBSD Foundation Modified: head/sys/compat/linprocfs/linprocfs.c head/sys/compat/linux/linux_ioctl.c head/sys/compat/linux/linux_socket.c head/sys/compat/svr4/svr4_sockio.c head/sys/contrib/altq/altq/altq_subr.c head/sys/contrib/ipfilter/netinet/ip_fil_freebsd.c head/sys/contrib/ipfilter/netinet/mlfk_ipl.c head/sys/contrib/pf/net/pf.c head/sys/contrib/pf/net/pf_if.c head/sys/contrib/pf/net/pf_ioctl.c head/sys/contrib/pf/net/pf_subr.c head/sys/contrib/rdma/rdma_cma.c head/sys/dev/cxgb/ulp/iw_cxgb/iw_cxgb.c head/sys/dev/cxgb/ulp/tom/cxgb_cpl_io.c head/sys/kern/kern_poll.c head/sys/kern/kern_uuid.c head/sys/modules/ae/Makefile head/sys/modules/ath/Makefile head/sys/modules/ath_rate_amrr/Makefile head/sys/modules/ath_rate_onoe/Makefile head/sys/modules/ath_rate_sample/Makefile head/sys/modules/bridgestp/Makefile head/sys/modules/cxgb/iw_cxgb/Makefile head/sys/modules/if_ef/Makefile head/sys/modules/if_vlan/Makefile head/sys/modules/ip_mroute_mod/Makefile head/sys/modules/ipfw/Makefile head/sys/modules/linprocfs/Makefile head/sys/modules/linux/Makefile head/sys/modules/netgraph/atm/atm/Makefile head/sys/modules/netgraph/ether/Makefile head/sys/modules/netgraph/gif/Makefile head/sys/modules/nfsclient/Makefile head/sys/modules/pf/Makefile head/sys/modules/wlan/Makefile head/sys/net/bridgestp.c head/sys/net/if.c head/sys/net/if_bridge.c head/sys/net/if_ef.c head/sys/net/if_ethersubr.c head/sys/net/if_faith.c head/sys/net/if_gre.c head/sys/net/if_loop.c head/sys/net/if_mib.c head/sys/net/if_spppsubr.c head/sys/net/if_stf.c head/sys/net/if_var.h head/sys/net/if_vlan.c head/sys/net/raw_cb.c head/sys/net/raw_usrreq.c head/sys/net/route.c head/sys/net/rtsock.c head/sys/net80211/ieee80211_ddb.c head/sys/netgraph/atm/ng_atm.c head/sys/netgraph/ng_eiface.c head/sys/netgraph/ng_ether.c head/sys/netgraph/ng_gif.c head/sys/netinet/if_ether.c head/sys/netinet/igmp.c head/sys/netinet/in.c head/sys/netinet/in.h head/sys/netinet/in_gif.c head/sys/netinet/in_mcast.c head/sys/netinet/in_pcb.c head/sys/netinet/in_rmx.c head/sys/netinet/ip6.h head/sys/netinet/ip_carp.c head/sys/netinet/ip_divert.c head/sys/netinet/ip_fastfwd.c head/sys/netinet/ip_fw2.c head/sys/netinet/ip_icmp.c head/sys/netinet/ip_id.c head/sys/netinet/ip_input.c head/sys/netinet/ip_ipsec.c head/sys/netinet/ip_mroute.c head/sys/netinet/ip_options.c head/sys/netinet/ip_output.c head/sys/netinet/raw_ip.c head/sys/netinet/sctp_os_bsd.h head/sys/netinet/tcp_hostcache.c head/sys/netinet/tcp_input.c head/sys/netinet/tcp_offload.c head/sys/netinet/tcp_output.c head/sys/netinet/tcp_reass.c head/sys/netinet/tcp_sack.c head/sys/netinet/tcp_subr.c head/sys/netinet/tcp_syncache.c head/sys/netinet/tcp_timer.c head/sys/netinet/tcp_timewait.c head/sys/netinet/tcp_usrreq.c head/sys/netinet/udp_usrreq.c head/sys/netinet/vinet.h head/sys/netinet6/dest6.c head/sys/netinet6/frag6.c head/sys/netinet6/icmp6.c head/sys/netinet6/in6.c head/sys/netinet6/in6_gif.c head/sys/netinet6/in6_ifattach.c head/sys/netinet6/in6_pcb.c head/sys/netinet6/in6_proto.c head/sys/netinet6/in6_rmx.c head/sys/netinet6/in6_src.c head/sys/netinet6/ip6_forward.c head/sys/netinet6/ip6_input.c head/sys/netinet6/ip6_ipsec.c head/sys/netinet6/ip6_mroute.c head/sys/netinet6/ip6_output.c head/sys/netinet6/mld6.c head/sys/netinet6/nd6.c head/sys/netinet6/nd6_nbr.c head/sys/netinet6/nd6_rtr.c head/sys/netinet6/raw_ip6.c head/sys/netinet6/route6.c head/sys/netinet6/scope6.c head/sys/netinet6/udp6_usrreq.c head/sys/netinet6/vinet6.h head/sys/netipsec/ipsec_input.c head/sys/netipsec/ipsec_output.c head/sys/netipsec/key.c head/sys/netipsec/keysock.c head/sys/netipsec/vipsec.h head/sys/netipsec/xform_ipip.c head/sys/nfsclient/bootp_subr.c head/sys/nfsclient/nfs_diskless.c head/sys/nfsclient/nfs_vnops.c Modified: head/sys/compat/linprocfs/linprocfs.c ============================================================================== --- head/sys/compat/linprocfs/linprocfs.c Tue Dec 2 20:50:37 2008 (r185570) +++ head/sys/compat/linprocfs/linprocfs.c Tue Dec 2 21:37:28 2008 (r185571) @@ -76,6 +76,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include Modified: head/sys/compat/linux/linux_ioctl.c ============================================================================== --- head/sys/compat/linux/linux_ioctl.c Tue Dec 2 20:50:37 2008 (r185570) +++ head/sys/compat/linux/linux_ioctl.c Tue Dec 2 21:37:28 2008 (r185571) @@ -63,6 +63,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #ifdef COMPAT_LINUX32 #include Modified: head/sys/compat/linux/linux_socket.c ============================================================================== --- head/sys/compat/linux/linux_socket.c Tue Dec 2 20:50:37 2008 (r185570) +++ head/sys/compat/linux/linux_socket.c Tue Dec 2 21:37:28 2008 (r185571) @@ -52,12 +52,15 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include #include #ifdef INET6 #include #include +#include +#include #endif #ifdef COMPAT_LINUX32 Modified: head/sys/compat/svr4/svr4_sockio.c ============================================================================== --- head/sys/compat/svr4/svr4_sockio.c Tue Dec 2 20:50:37 2008 (r185570) +++ head/sys/compat/svr4/svr4_sockio.c Tue Dec 2 21:37:28 2008 (r185571) @@ -39,6 +39,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include Modified: head/sys/contrib/altq/altq/altq_subr.c ============================================================================== --- head/sys/contrib/altq/altq/altq_subr.c Tue Dec 2 20:50:37 2008 (r185570) +++ head/sys/contrib/altq/altq/altq_subr.c Tue Dec 2 21:37:28 2008 (r185571) @@ -51,6 +51,7 @@ #include #include #include +#include #include #include Modified: head/sys/contrib/ipfilter/netinet/ip_fil_freebsd.c ============================================================================== --- head/sys/contrib/ipfilter/netinet/ip_fil_freebsd.c Tue Dec 2 20:50:37 2008 (r185570) +++ head/sys/contrib/ipfilter/netinet/ip_fil_freebsd.c Tue Dec 2 21:37:28 2008 (r185571) @@ -112,6 +112,9 @@ static const char rcsid[] = "@(#)$Id: ip #include "netinet/ip_scan.h" #endif #include "netinet/ip_pool.h" +#if defined(__FreeBSD_version) && (__FreeBSD_version >= 800056) +# include +#endif #if defined(__FreeBSD_version) && (__FreeBSD_version >= 300000) # include #endif Modified: head/sys/contrib/ipfilter/netinet/mlfk_ipl.c ============================================================================== --- head/sys/contrib/ipfilter/netinet/mlfk_ipl.c Tue Dec 2 20:50:37 2008 (r185570) +++ head/sys/contrib/ipfilter/netinet/mlfk_ipl.c Tue Dec 2 21:37:28 2008 (r185571) @@ -43,9 +43,7 @@ static int sysctl_ipf_int ( SYSCTL_HANDL static int ipf_modload(void); static int ipf_modunload(void); -#if __FreeBSD_version < 800055 SYSCTL_DECL(_net_inet); -#endif #define SYSCTL_IPF(parent, nbr, name, access, ptr, val, descr) \ SYSCTL_OID(parent, nbr, name, CTLTYPE_INT|access, \ ptr, val, sysctl_ipf_int, "I", descr); Modified: head/sys/contrib/pf/net/pf.c ============================================================================== --- head/sys/contrib/pf/net/pf.c Tue Dec 2 20:50:37 2008 (r185570) +++ head/sys/contrib/pf/net/pf.c Tue Dec 2 21:37:28 2008 (r185571) @@ -120,6 +120,9 @@ __FBSDID("$FreeBSD$"); #include #include #include +#ifdef __FreeBSD__ +#include +#endif #ifndef __FreeBSD__ #include @@ -139,6 +142,7 @@ __FBSDID("$FreeBSD$"); #ifdef __FreeBSD__ #include #include +#include #endif #endif /* INET6 */ Modified: head/sys/contrib/pf/net/pf_if.c ============================================================================== --- head/sys/contrib/pf/net/pf_if.c Tue Dec 2 20:50:37 2008 (r185570) +++ head/sys/contrib/pf/net/pf_if.c Tue Dec 2 21:37:28 2008 (r185571) @@ -54,10 +54,15 @@ __FBSDID("$FreeBSD$"); #include #endif #include +#ifdef __FreeBSD__ #include +#endif #include #include +#ifdef __FreeBSD__ +#include +#endif #include #include Modified: head/sys/contrib/pf/net/pf_ioctl.c ============================================================================== --- head/sys/contrib/pf/net/pf_ioctl.c Tue Dec 2 20:50:37 2008 (r185570) +++ head/sys/contrib/pf/net/pf_ioctl.c Tue Dec 2 21:37:28 2008 (r185571) @@ -102,6 +102,9 @@ __FBSDID("$FreeBSD$"); #include #include #include +#ifdef __FreeBSD__ +#include +#endif #include #include Modified: head/sys/contrib/pf/net/pf_subr.c ============================================================================== --- head/sys/contrib/pf/net/pf_subr.c Tue Dec 2 20:50:37 2008 (r185570) +++ head/sys/contrib/pf/net/pf_subr.c Tue Dec 2 21:37:28 2008 (r185571) @@ -65,6 +65,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include /* Modified: head/sys/contrib/rdma/rdma_cma.c ============================================================================== --- head/sys/contrib/rdma/rdma_cma.c Tue Dec 2 20:50:37 2008 (r185570) +++ head/sys/contrib/rdma/rdma_cma.c Tue Dec 2 21:37:28 2008 (r185571) @@ -51,6 +51,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include Modified: head/sys/dev/cxgb/ulp/iw_cxgb/iw_cxgb.c ============================================================================== --- head/sys/dev/cxgb/ulp/iw_cxgb/iw_cxgb.c Tue Dec 2 20:50:37 2008 (r185570) +++ head/sys/dev/cxgb/ulp/iw_cxgb/iw_cxgb.c Tue Dec 2 21:37:28 2008 (r185571) @@ -62,6 +62,9 @@ __FBSDID("$FreeBSD$"); #include #include +#if __FreeBSD_version >= 800056 +#include +#endif #include Modified: head/sys/dev/cxgb/ulp/tom/cxgb_cpl_io.c ============================================================================== --- head/sys/dev/cxgb/ulp/tom/cxgb_cpl_io.c Tue Dec 2 20:50:37 2008 (r185570) +++ head/sys/dev/cxgb/ulp/tom/cxgb_cpl_io.c Tue Dec 2 21:37:28 2008 (r185571) @@ -78,6 +78,9 @@ __FBSDID("$FreeBSD$"); #include #include #include +#if __FreeBSD_version >= 800056 +#include +#endif #include #include Modified: head/sys/kern/kern_poll.c ============================================================================== --- head/sys/kern/kern_poll.c Tue Dec 2 20:50:37 2008 (r185570) +++ head/sys/kern/kern_poll.c Tue Dec 2 21:37:28 2008 (r185571) @@ -40,6 +40,7 @@ __FBSDID("$FreeBSD$"); #include /* for IFF_* flags */ #include /* for NETISR_POLL */ +#include #include #include Modified: head/sys/kern/kern_uuid.c ============================================================================== --- head/sys/kern/kern_uuid.c Tue Dec 2 20:50:37 2008 (r185570) +++ head/sys/kern/kern_uuid.c Tue Dec 2 21:37:28 2008 (r185571) @@ -42,6 +42,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include /* * See also: Modified: head/sys/modules/ae/Makefile ============================================================================== --- head/sys/modules/ae/Makefile Tue Dec 2 20:50:37 2008 (r185570) +++ head/sys/modules/ae/Makefile Tue Dec 2 21:37:28 2008 (r185571) @@ -3,6 +3,6 @@ .PATH: ${.CURDIR}/../../dev/ae KMOD= if_ae -SRCS= if_ae.c device_if.h bus_if.h pci_if.h miibus_if.h opt_route.h +SRCS= if_ae.c device_if.h bus_if.h pci_if.h miibus_if.h .include Modified: head/sys/modules/ath/Makefile ============================================================================== --- head/sys/modules/ath/Makefile Tue Dec 2 20:50:37 2008 (r185570) +++ head/sys/modules/ath/Makefile Tue Dec 2 21:37:28 2008 (r185571) @@ -66,7 +66,7 @@ SRCS+= ${AR5211_SRCS} SRCS+= ${AR5212_SRCS} SRCS+= ${AR5416_SRCS} SRCS+= ${AR9160_SRCS} -SRCS+= device_if.h bus_if.h pci_if.h opt_inet.h opt_route.h opt_ath.h opt_ah.h +SRCS+= device_if.h bus_if.h pci_if.h opt_inet.h opt_ath.h opt_ah.h CFLAGS+= -I. -I${.CURDIR}/../../dev/ath -I${.CURDIR}/../../dev/ath/ath_hal Modified: head/sys/modules/ath_rate_amrr/Makefile ============================================================================== --- head/sys/modules/ath_rate_amrr/Makefile Tue Dec 2 20:50:37 2008 (r185570) +++ head/sys/modules/ath_rate_amrr/Makefile Tue Dec 2 21:37:28 2008 (r185571) @@ -33,7 +33,7 @@ KMOD= ath_rate SRCS= amrr.c -SRCS+= device_if.h bus_if.h pci_if.h opt_inet.h opt_route.h opt_ah.h opt_wlan.h +SRCS+= device_if.h bus_if.h pci_if.h opt_inet.h opt_ah.h opt_wlan.h CFLAGS+= -I. -I${.CURDIR}/../../dev/ath -I${.CURDIR}/../../dev/ath/ath_hal Modified: head/sys/modules/ath_rate_onoe/Makefile ============================================================================== --- head/sys/modules/ath_rate_onoe/Makefile Tue Dec 2 20:50:37 2008 (r185570) +++ head/sys/modules/ath_rate_onoe/Makefile Tue Dec 2 21:37:28 2008 (r185571) @@ -33,7 +33,7 @@ KMOD= ath_rate SRCS= onoe.c -SRCS+= device_if.h bus_if.h pci_if.h opt_inet.h opt_route.h opt_ah.h opt_wlan.h +SRCS+= device_if.h bus_if.h pci_if.h opt_inet.h opt_ah.h opt_wlan.h CFLAGS+= -I. -I${.CURDIR}/../../dev/ath -I${.CURDIR}/../../dev/ath/ath_hal Modified: head/sys/modules/ath_rate_sample/Makefile ============================================================================== --- head/sys/modules/ath_rate_sample/Makefile Tue Dec 2 20:50:37 2008 (r185570) +++ head/sys/modules/ath_rate_sample/Makefile Tue Dec 2 21:37:28 2008 (r185571) @@ -33,7 +33,7 @@ KMOD= ath_rate SRCS= sample.c -SRCS+= device_if.h bus_if.h pci_if.h opt_inet.h opt_route.h opt_ah.h opt_wlan.h +SRCS+= device_if.h bus_if.h pci_if.h opt_inet.h opt_ah.h opt_wlan.h CFLAGS+= -I. -I${.CURDIR}/../../dev/ath -I${.CURDIR}/../../dev/ath/ath_hal Modified: head/sys/modules/bridgestp/Makefile ============================================================================== --- head/sys/modules/bridgestp/Makefile Tue Dec 2 20:50:37 2008 (r185570) +++ head/sys/modules/bridgestp/Makefile Tue Dec 2 21:37:28 2008 (r185571) @@ -3,6 +3,6 @@ .PATH: ${.CURDIR}/../../net KMOD= bridgestp -SRCS= bridgestp.c +SRCS= bridgestp.c opt_route.h .include Modified: head/sys/modules/cxgb/iw_cxgb/Makefile ============================================================================== --- head/sys/modules/cxgb/iw_cxgb/Makefile Tue Dec 2 20:50:37 2008 (r185570) +++ head/sys/modules/cxgb/iw_cxgb/Makefile Tue Dec 2 21:37:28 2008 (r185571) @@ -7,7 +7,8 @@ KMOD= iw_cxgb SRCS= iw_cxgb.c iw_cxgb_cm.c iw_cxgb_hal.c SRCS+= iw_cxgb_provider.c iw_cxgb_qp.c iw_cxgb_resource.c SRCS+= iw_cxgb_ev.c iw_cxgb_mem.c iw_cxgb_dbg.c iw_cxgb_cq.c -SRCS+= bus_if.h device_if.h opt_sched.h pci_if.h pcib_if.h opt_ktr.h opt_inet.h +SRCS+= bus_if.h device_if.h opt_sched.h pci_if.h pcib_if.h opt_ktr.h +SRCS+= opt_inet.h opt_route.h CFLAGS+= -g -I${CXGB} #CFLAGS+= -DDEBUG Modified: head/sys/modules/if_ef/Makefile ============================================================================== --- head/sys/modules/if_ef/Makefile Tue Dec 2 20:50:37 2008 (r185570) +++ head/sys/modules/if_ef/Makefile Tue Dec 2 21:37:28 2008 (r185571) @@ -3,7 +3,7 @@ .PATH: ${.CURDIR}/../../net KMOD= if_ef -SRCS= if_ef.c opt_ipx.h opt_inet.h opt_ef.h +SRCS= if_ef.c opt_ipx.h opt_inet.h opt_ef.h opt_route.h .if defined(EFDEBUG) CFLAGS+= -DEF_DEBUG Modified: head/sys/modules/if_vlan/Makefile ============================================================================== --- head/sys/modules/if_vlan/Makefile Tue Dec 2 20:50:37 2008 (r185570) +++ head/sys/modules/if_vlan/Makefile Tue Dec 2 21:37:28 2008 (r185571) @@ -4,6 +4,6 @@ KMOD= if_vlan SRCS= if_vlan.c -SRCS+= opt_inet.h opt_vlan.h +SRCS+= opt_inet.h opt_vlan.h opt_route.h .include Modified: head/sys/modules/ip_mroute_mod/Makefile ============================================================================== --- head/sys/modules/ip_mroute_mod/Makefile Tue Dec 2 20:50:37 2008 (r185570) +++ head/sys/modules/ip_mroute_mod/Makefile Tue Dec 2 21:37:28 2008 (r185571) @@ -7,7 +7,7 @@ KMOD= ip_mroute SRCS= ip_mroute.c -SRCS+= opt_inet.h opt_mac.h opt_mrouting.h +SRCS+= opt_inet.h opt_mac.h opt_mrouting.h opt_route.h SRCS+= opt_inet6.h .if ${MK_INET6_SUPPORT} != "no" Modified: head/sys/modules/ipfw/Makefile ============================================================================== --- head/sys/modules/ipfw/Makefile Tue Dec 2 20:50:37 2008 (r185570) +++ head/sys/modules/ipfw/Makefile Tue Dec 2 21:37:28 2008 (r185571) @@ -6,7 +6,7 @@ KMOD= ipfw SRCS= ip_fw2.c ip_fw_pfil.c -SRCS+= opt_inet6.h opt_ipsec.h opt_mac.h +SRCS+= opt_inet6.h opt_ipsec.h opt_mac.h opt_route.h CFLAGS+= -DIPFIREWALL CFLAGS+= -I${.CURDIR}/../../contrib/pf Modified: head/sys/modules/linprocfs/Makefile ============================================================================== --- head/sys/modules/linprocfs/Makefile Tue Dec 2 20:50:37 2008 (r185570) +++ head/sys/modules/linprocfs/Makefile Tue Dec 2 21:37:28 2008 (r185571) @@ -5,7 +5,8 @@ KMOD= linprocfs SRCS= vnode_if.h \ linprocfs.c \ - opt_compat.h + opt_compat.h \ + opt_route.h .if ${MACHINE_ARCH} == "amd64" CFLAGS+=-DCOMPAT_LINUX32 Modified: head/sys/modules/linux/Makefile ============================================================================== --- head/sys/modules/linux/Makefile Tue Dec 2 20:50:37 2008 (r185570) +++ head/sys/modules/linux/Makefile Tue Dec 2 21:37:28 2008 (r185571) @@ -13,7 +13,7 @@ SRCS= linux${SFX}_dummy.c linux_emul.c l linux${SFX}_machdep.c linux_mib.c linux_misc.c linux_signal.c \ linux_socket.c linux_stats.c linux_sysctl.c linux${SFX}_sysent.c \ linux${SFX}_sysvec.c linux_uid16.c linux_util.c linux_time.c \ - opt_inet6.h opt_mac.h opt_compat.h opt_posix.h vnode_if.h \ + opt_inet6.h opt_route.h opt_mac.h opt_compat.h opt_posix.h vnode_if.h \ device_if.h bus_if.h assym.s # XXX: for assym.s Modified: head/sys/modules/netgraph/atm/atm/Makefile ============================================================================== --- head/sys/modules/netgraph/atm/atm/Makefile Tue Dec 2 20:50:37 2008 (r185570) +++ head/sys/modules/netgraph/atm/atm/Makefile Tue Dec 2 21:37:28 2008 (r185571) @@ -5,7 +5,7 @@ .PATH: ${.CURDIR}/../../../../netgraph/atm KMOD= ng_atm -SRCS= ng_atm.c +SRCS= ng_atm.c opt_route.h # CFLAGS+= -DNGATM_DEBUG .include Modified: head/sys/modules/netgraph/ether/Makefile ============================================================================== --- head/sys/modules/netgraph/ether/Makefile Tue Dec 2 20:50:37 2008 (r185570) +++ head/sys/modules/netgraph/ether/Makefile Tue Dec 2 21:37:28 2008 (r185571) @@ -1,6 +1,6 @@ # $FreeBSD$ KMOD= ng_ether -SRCS= ng_ether.c +SRCS= ng_ether.c opt_route.h .include Modified: head/sys/modules/netgraph/gif/Makefile ============================================================================== --- head/sys/modules/netgraph/gif/Makefile Tue Dec 2 20:50:37 2008 (r185570) +++ head/sys/modules/netgraph/gif/Makefile Tue Dec 2 21:37:28 2008 (r185571) @@ -1,7 +1,7 @@ # $FreeBSD$ KMOD= ng_gif -SRCS= ng_gif.c opt_inet.h opt_inet6.h +SRCS= ng_gif.c opt_inet.h opt_inet6.h opt_route.h .if !defined(KERNBUILDDIR) opt_inet.h: Modified: head/sys/modules/nfsclient/Makefile ============================================================================== --- head/sys/modules/nfsclient/Makefile Tue Dec 2 20:50:37 2008 (r185570) +++ head/sys/modules/nfsclient/Makefile Tue Dec 2 21:37:28 2008 (r185571) @@ -10,7 +10,7 @@ SRCS= vnode_if.h \ opt_inet.h opt_nfs.h opt_bootp.h opt_nfsroot.h SRCS+= nfs4_dev.c nfs4_idmap.c nfs4_socket.c nfs4_subs.c \ nfs4_vfs_subs.c nfs4_vfsops.c nfs4_vn_subs.c nfs4_vnops.c -SRCS+= opt_inet6.h opt_kgssapi.h +SRCS+= opt_inet6.h opt_kgssapi.h opt_route.h # USE THE RPCCLNT: CFLAGS+= -DRPCCLNT_DEBUG Modified: head/sys/modules/pf/Makefile ============================================================================== --- head/sys/modules/pf/Makefile Tue Dec 2 20:50:37 2008 (r185570) +++ head/sys/modules/pf/Makefile Tue Dec 2 21:37:28 2008 (r185571) @@ -9,7 +9,7 @@ KMOD= pf SRCS = pf.c pf_if.c pf_subr.c pf_osfp.c pf_ioctl.c pf_norm.c pf_table.c \ pf_ruleset.c \ in4_cksum.c \ - opt_pf.h opt_inet.h opt_inet6.h opt_bpf.h opt_mac.h + opt_pf.h opt_inet.h opt_inet6.h opt_bpf.h opt_mac.h opt_route.h CFLAGS+= -I${.CURDIR}/../../contrib/pf Modified: head/sys/modules/wlan/Makefile ============================================================================== --- head/sys/modules/wlan/Makefile Tue Dec 2 20:50:37 2008 (r185570) +++ head/sys/modules/wlan/Makefile Tue Dec 2 21:37:28 2008 (r185571) @@ -10,7 +10,8 @@ SRCS= ieee80211.c ieee80211_crypto.c iee ieee80211_regdomain.c ieee80211_ht.c \ ieee80211_adhoc.c ieee80211_hostap.c ieee80211_monitor.c \ ieee80211_sta.c ieee80211_wds.c ieee80211_ddb.c -SRCS+= bus_if.h device_if.h opt_inet.h opt_ipx.h opt_wlan.h opt_ddb.h +SRCS+= bus_if.h device_if.h opt_inet.h opt_ipx.h opt_wlan.h opt_ddb.h \ + opt_route.h .if !defined(KERNBUILDDIR) opt_wlan.h: Modified: head/sys/net/bridgestp.c ============================================================================== --- head/sys/net/bridgestp.c Tue Dec 2 20:50:37 2008 (r185570) +++ head/sys/net/bridgestp.c Tue Dec 2 21:37:28 2008 (r185571) @@ -56,6 +56,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include Modified: head/sys/net/if.c ============================================================================== --- head/sys/net/if.c Tue Dec 2 20:50:37 2008 (r185570) +++ head/sys/net/if.c Tue Dec 2 21:37:28 2008 (r185571) @@ -67,6 +67,7 @@ #include #include #include +#include #if defined(INET) || defined(INET6) /*XXX*/ @@ -79,6 +80,7 @@ #endif #ifdef INET #include +#include #endif #ifdef DEV_CARP #include Modified: head/sys/net/if_bridge.c ============================================================================== --- head/sys/net/if_bridge.c Tue Dec 2 20:50:37 2008 (r185570) +++ head/sys/net/if_bridge.c Tue Dec 2 21:37:28 2008 (r185571) @@ -115,9 +115,11 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #ifdef INET6 #include #include +#include #endif #ifdef DEV_CARP #include Modified: head/sys/net/if_ef.c ============================================================================== --- head/sys/net/if_ef.c Tue Dec 2 20:50:37 2008 (r185570) +++ head/sys/net/if_ef.c Tue Dec 2 21:37:28 2008 (r185571) @@ -50,6 +50,7 @@ #include #include #include +#include #ifdef INET #include Modified: head/sys/net/if_ethersubr.c ============================================================================== --- head/sys/net/if_ethersubr.c Tue Dec 2 20:50:37 2008 (r185570) +++ head/sys/net/if_ethersubr.c Tue Dec 2 21:37:28 2008 (r185571) @@ -63,6 +63,7 @@ #include #include #include +#include #if defined(INET) || defined(INET6) #include Modified: head/sys/net/if_faith.c ============================================================================== --- head/sys/net/if_faith.c Tue Dec 2 20:50:37 2008 (r185570) +++ head/sys/net/if_faith.c Tue Dec 2 21:37:28 2008 (r185571) @@ -77,6 +77,7 @@ #include #include #include +#include #endif #define FAITHNAME "faith" Modified: head/sys/net/if_gre.c ============================================================================== --- head/sys/net/if_gre.c Tue Dec 2 20:50:37 2008 (r185570) +++ head/sys/net/if_gre.c Tue Dec 2 21:37:28 2008 (r185571) @@ -79,6 +79,7 @@ #include #include #include +#include #else #error "Huh? if_gre without inet?" #endif Modified: head/sys/net/if_loop.c ============================================================================== --- head/sys/net/if_loop.c Tue Dec 2 20:50:37 2008 (r185570) +++ head/sys/net/if_loop.c Tue Dec 2 21:37:28 2008 (r185571) @@ -57,6 +57,7 @@ #include #include #include +#include #ifdef INET #include Modified: head/sys/net/if_mib.c ============================================================================== --- head/sys/net/if_mib.c Tue Dec 2 20:50:37 2008 (r185570) +++ head/sys/net/if_mib.c Tue Dec 2 21:37:28 2008 (r185571) @@ -38,6 +38,7 @@ #include #include +#include /* * A sysctl(3) MIB for generic interface information. This information Modified: head/sys/net/if_spppsubr.c ============================================================================== --- head/sys/net/if_spppsubr.c Tue Dec 2 20:50:37 2008 (r185570) +++ head/sys/net/if_spppsubr.c Tue Dec 2 21:37:28 2008 (r185571) @@ -56,6 +56,7 @@ #ifdef INET #include #include +#include #endif #ifdef INET6 Modified: head/sys/net/if_stf.c ============================================================================== --- head/sys/net/if_stf.c Tue Dec 2 20:50:37 2008 (r185570) +++ head/sys/net/if_stf.c Tue Dec 2 21:37:28 2008 (r185571) @@ -107,6 +107,7 @@ #include #include #include +#include #include #include Modified: head/sys/net/if_var.h ============================================================================== --- head/sys/net/if_var.h Tue Dec 2 20:50:37 2008 (r185570) +++ head/sys/net/if_var.h Tue Dec 2 21:37:28 2008 (r185571) @@ -720,8 +720,6 @@ int ether_poll_register(poll_handler_ int ether_poll_deregister(struct ifnet *ifp); #endif /* DEVICE_POLLING */ -#include - #endif /* _KERNEL */ #endif /* !_NET_IF_VAR_H_ */ Modified: head/sys/net/if_vlan.c ============================================================================== --- head/sys/net/if_vlan.c Tue Dec 2 20:50:37 2008 (r185570) +++ head/sys/net/if_vlan.c Tue Dec 2 21:37:28 2008 (r185571) @@ -64,6 +64,7 @@ #include #include #include +#include #define VLANNAME "vlan" #define VLAN_DEF_HWIDTH 4 Modified: head/sys/net/raw_cb.c ============================================================================== --- head/sys/net/raw_cb.c Tue Dec 2 20:50:37 2008 (r185570) +++ head/sys/net/raw_cb.c Tue Dec 2 21:37:28 2008 (r185571) @@ -46,6 +46,7 @@ #include #include +#include /* * Routines to manage the raw protocol control blocks. Modified: head/sys/net/raw_usrreq.c ============================================================================== --- head/sys/net/raw_usrreq.c Tue Dec 2 20:50:37 2008 (r185570) +++ head/sys/net/raw_usrreq.c Tue Dec 2 21:37:28 2008 (r185571) @@ -48,6 +48,7 @@ #include #include +#include MTX_SYSINIT(rawcb_mtx, &rawcb_mtx, "rawcb", MTX_DEF); Modified: head/sys/net/route.c ============================================================================== --- head/sys/net/route.c Tue Dec 2 20:50:37 2008 (r185570) +++ head/sys/net/route.c Tue Dec 2 21:37:28 2008 (r185571) @@ -57,9 +57,11 @@ #ifdef RADIX_MPATH #include #endif +#include #include #include +#include #include Modified: head/sys/net/rtsock.c ============================================================================== --- head/sys/net/rtsock.c Tue Dec 2 20:50:37 2008 (r185570) +++ head/sys/net/rtsock.c Tue Dec 2 21:37:28 2008 (r185571) @@ -54,6 +54,7 @@ #include #include #include +#include #include #ifdef INET6 Modified: head/sys/net80211/ieee80211_ddb.c ============================================================================== --- head/sys/net80211/ieee80211_ddb.c Tue Dec 2 20:50:37 2008 (r185570) +++ head/sys/net80211/ieee80211_ddb.c Tue Dec 2 21:37:28 2008 (r185571) @@ -44,6 +44,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include Modified: head/sys/netgraph/atm/ng_atm.c ============================================================================== --- head/sys/netgraph/atm/ng_atm.c Tue Dec 2 20:50:37 2008 (r185570) +++ head/sys/netgraph/atm/ng_atm.c Tue Dec 2 21:37:28 2008 (r185571) @@ -54,6 +54,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include Modified: head/sys/netgraph/ng_eiface.c ============================================================================== --- head/sys/netgraph/ng_eiface.c Tue Dec 2 20:50:37 2008 (r185570) +++ head/sys/netgraph/ng_eiface.c Tue Dec 2 21:37:28 2008 (r185571) @@ -43,6 +43,7 @@ #include #include #include +#include #include #include Modified: head/sys/netgraph/ng_ether.c ============================================================================== --- head/sys/netgraph/ng_ether.c Tue Dec 2 20:50:37 2008 (r185570) +++ head/sys/netgraph/ng_ether.c Tue Dec 2 21:37:28 2008 (r185571) @@ -63,6 +63,7 @@ #include #include #include +#include #include #include Modified: head/sys/netgraph/ng_gif.c ============================================================================== --- head/sys/netgraph/ng_gif.c Tue Dec 2 20:50:37 2008 (r185570) +++ head/sys/netgraph/ng_gif.c Tue Dec 2 21:37:28 2008 (r185571) @@ -84,6 +84,7 @@ #include #include #include +#include #include #include Modified: head/sys/netinet/if_ether.c ============================================================================== --- head/sys/netinet/if_ether.c Tue Dec 2 20:50:37 2008 (r185570) +++ head/sys/netinet/if_ether.c Tue Dec 2 21:37:28 2008 (r185571) @@ -61,10 +61,12 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include +#include #include #include Modified: head/sys/netinet/igmp.c ============================================================================== --- head/sys/netinet/igmp.c Tue Dec 2 20:50:37 2008 (r185570) +++ head/sys/netinet/igmp.c Tue Dec 2 21:37:28 2008 (r185571) @@ -61,6 +61,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include @@ -70,6 +71,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include Modified: head/sys/netinet/in.c ============================================================================== --- head/sys/netinet/in.c Tue Dec 2 20:50:37 2008 (r185570) +++ head/sys/netinet/in.c Tue Dec 2 21:37:28 2008 (r185571) @@ -53,6 +53,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include static int in_mask2len(struct in_addr *); static void in_len2mask(struct in_addr *, int); Modified: head/sys/netinet/in.h ============================================================================== --- head/sys/netinet/in.h Tue Dec 2 20:50:37 2008 (r185570) +++ head/sys/netinet/in.h Tue Dec 2 21:37:28 2008 (r185571) @@ -743,8 +743,4 @@ void in_ifdetach(struct ifnet *); #undef __KAME_NETINET_IN_H_INCLUDED_ #endif -#ifdef _KERNEL -#include -#endif - #endif /* !_NETINET_IN_H_*/ Modified: head/sys/netinet/in_gif.c ============================================================================== --- head/sys/netinet/in_gif.c Tue Dec 2 20:50:37 2008 (r185570) +++ head/sys/netinet/in_gif.c Tue Dec 2 21:37:28 2008 (r185571) @@ -59,6 +59,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #ifdef INET6 #include Modified: head/sys/netinet/in_mcast.c ============================================================================== --- head/sys/netinet/in_mcast.c Tue Dec 2 20:50:37 2008 (r185570) +++ head/sys/netinet/in_mcast.c Tue Dec 2 21:37:28 2008 (r185571) @@ -53,6 +53,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include @@ -60,6 +61,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #ifndef __SOCKUNION_DECLARED union sockunion { Modified: head/sys/netinet/in_pcb.c ============================================================================== --- head/sys/netinet/in_pcb.c Tue Dec 2 20:50:37 2008 (r185570) +++ head/sys/netinet/in_pcb.c Tue Dec 2 21:37:28 2008 (r185571) @@ -71,9 +71,11 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #ifdef INET6 #include #include +#include #endif /* INET6 */ Modified: head/sys/netinet/in_rmx.c ============================================================================== --- head/sys/netinet/in_rmx.c Tue Dec 2 20:50:37 2008 (r185570) +++ head/sys/netinet/in_rmx.c Tue Dec 2 21:37:28 2008 (r185571) @@ -55,9 +55,12 @@ __FBSDID("$FreeBSD$"); #include #include +#include + #include #include #include +#include extern int in_inithead(void **head, int off); Modified: head/sys/netinet/ip6.h ============================================================================== --- head/sys/netinet/ip6.h Tue Dec 2 20:50:37 2008 (r185570) +++ head/sys/netinet/ip6.h Tue Dec 2 21:37:28 2008 (r185571) @@ -347,8 +347,6 @@ do { \ } \ } while (/*CONSTCOND*/ 0) -#include - #endif /*_KERNEL*/ #endif /* not _NETINET_IP6_H_ */ Modified: head/sys/netinet/ip_carp.c ============================================================================== --- head/sys/netinet/ip_carp.c Tue Dec 2 20:50:37 2008 (r185570) +++ head/sys/netinet/ip_carp.c Tue Dec 2 21:37:28 2008 (r185571) @@ -74,6 +74,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #endif #ifdef INET6 @@ -82,6 +83,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #endif #include Modified: head/sys/netinet/ip_divert.c ============================================================================== --- head/sys/netinet/ip_divert.c Tue Dec 2 20:50:37 2008 (r185570) +++ head/sys/netinet/ip_divert.c Tue Dec 2 21:37:28 2008 (r185571) @@ -74,6 +74,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include Modified: head/sys/netinet/ip_fastfwd.c ============================================================================== --- head/sys/netinet/ip_fastfwd.c Tue Dec 2 20:50:37 2008 (r185570) +++ head/sys/netinet/ip_fastfwd.c Tue Dec 2 21:37:28 2008 (r185571) @@ -103,6 +103,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include Modified: head/sys/netinet/ip_fw2.c ============================================================================== --- head/sys/netinet/ip_fw2.c Tue Dec 2 20:50:37 2008 (r185570) +++ head/sys/netinet/ip_fw2.c Tue Dec 2 21:37:28 2008 (r185571) @@ -69,6 +69,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #define IPFW_INTERNAL /* Access to protected data structures in ip_fw.h. */ @@ -91,6 +92,8 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include + #include #include Modified: head/sys/netinet/ip_icmp.c ============================================================================== --- head/sys/netinet/ip_icmp.c Tue Dec 2 20:50:37 2008 (r185570) +++ head/sys/netinet/ip_icmp.c Tue Dec 2 21:37:28 2008 (r185571) @@ -61,6 +61,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #ifdef IPSEC #include Modified: head/sys/netinet/ip_id.c ============================================================================== --- head/sys/netinet/ip_id.c Tue Dec 2 20:50:37 2008 (r185570) +++ head/sys/netinet/ip_id.c Tue Dec 2 21:37:28 2008 (r185571) @@ -104,6 +104,7 @@ static int sysctl_ip_id_change(SYSCTL_HA MTX_SYSINIT(ip_id_mtx, &ip_id_mtx, "ip_id_mtx", MTX_DEF); +SYSCTL_DECL(_net_inet_ip); SYSCTL_PROC(_net_inet_ip, OID_AUTO, random_id_period, CTLTYPE_INT|CTLFLAG_RW, &array_size, 0, sysctl_ip_id_change, "IU", "IP ID Array size"); SYSCTL_INT(_net_inet_ip, OID_AUTO, random_id_collisions, CTLFLAG_RD, Modified: head/sys/netinet/ip_input.c ============================================================================== --- head/sys/netinet/ip_input.c Tue Dec 2 20:50:37 2008 (r185570) +++ head/sys/netinet/ip_input.c Tue Dec 2 21:37:28 2008 (r185571) @@ -60,6 +60,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include @@ -70,6 +71,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #ifdef DEV_CARP #include #endif Modified: head/sys/netinet/ip_ipsec.c ============================================================================== --- head/sys/netinet/ip_ipsec.c Tue Dec 2 20:50:37 2008 (r185570) +++ head/sys/netinet/ip_ipsec.c Tue Dec 2 21:37:28 2008 (r185571) @@ -55,6 +55,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include Modified: head/sys/netinet/ip_mroute.c ============================================================================== --- head/sys/netinet/ip_mroute.c Tue Dec 2 20:50:37 2008 (r185570) +++ head/sys/netinet/ip_mroute.c Tue Dec 2 21:37:28 2008 (r185571) @@ -96,6 +96,8 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include + #ifdef INET6 #include #include Modified: head/sys/netinet/ip_options.c ============================================================================== --- head/sys/netinet/ip_options.c Tue Dec 2 20:50:37 2008 (r185570) +++ head/sys/netinet/ip_options.c Tue Dec 2 21:37:28 2008 (r185571) @@ -63,6 +63,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include Modified: head/sys/netinet/ip_output.c ============================================================================== --- head/sys/netinet/ip_output.c Tue Dec 2 20:50:37 2008 (r185570) +++ head/sys/netinet/ip_output.c Tue Dec 2 21:37:28 2008 (r185571) @@ -59,6 +59,7 @@ __FBSDID("$FreeBSD$"); #ifdef RADIX_MPATH #include #endif +#include #include #include @@ -67,6 +68,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #ifdef IPSEC #include Modified: head/sys/netinet/raw_ip.c ============================================================================== --- head/sys/netinet/raw_ip.c Tue Dec 2 20:50:37 2008 (r185570) +++ head/sys/netinet/raw_ip.c Tue Dec 2 21:37:28 2008 (r185571) @@ -58,6 +58,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include @@ -69,6 +70,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #ifdef IPSEC #include Modified: head/sys/netinet/sctp_os_bsd.h ============================================================================== --- head/sys/netinet/sctp_os_bsd.h Tue Dec 2 20:50:37 2008 (r185570) +++ head/sys/netinet/sctp_os_bsd.h Tue Dec 2 21:37:28 2008 (r185571) @@ -77,7 +77,7 @@ __FBSDID("$FreeBSD$"); #include #include #include - +#include #ifdef IPSEC #include Modified: head/sys/netinet/tcp_hostcache.c ============================================================================== --- head/sys/netinet/tcp_hostcache.c Tue Dec 2 20:50:37 2008 (r185570) +++ head/sys/netinet/tcp_hostcache.c Tue Dec 2 21:37:28 2008 (r185571) @@ -92,6 +92,8 @@ __FBSDID("$FreeBSD$"); #endif #include #include +#include +#include #ifdef INET6 #include #endif Modified: head/sys/netinet/tcp_input.c ============================================================================== --- head/sys/netinet/tcp_input.c Tue Dec 2 20:50:37 2008 (r185570) +++ head/sys/netinet/tcp_input.c Tue Dec 2 21:37:28 2008 (r185571) @@ -87,6 +87,11 @@ __FBSDID("$FreeBSD$"); #ifdef TCPDEBUG #include #endif /* TCPDEBUG */ +#include + +#ifdef INET6 +#include +#endif #ifdef IPSEC #include Modified: head/sys/netinet/tcp_offload.c ============================================================================== --- head/sys/netinet/tcp_offload.c Tue Dec 2 20:50:37 2008 (r185570) +++ head/sys/netinet/tcp_offload.c Tue Dec 2 21:37:28 2008 (r185571) @@ -50,6 +50,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include uint32_t toedev_registration_count; Modified: head/sys/netinet/tcp_output.c ============================================================================== --- head/sys/netinet/tcp_output.c Tue Dec 2 20:50:37 2008 (r185570) +++ head/sys/netinet/tcp_output.c Tue Dec 2 21:37:28 2008 (r185571) @@ -51,6 +51,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include @@ -74,6 +75,7 @@ __FBSDID("$FreeBSD$"); #ifdef TCPDEBUG #include #endif +#include #ifdef IPSEC #include Modified: head/sys/netinet/tcp_reass.c ============================================================================== --- head/sys/netinet/tcp_reass.c Tue Dec 2 20:50:37 2008 (r185570) +++ head/sys/netinet/tcp_reass.c Tue Dec 2 21:37:28 2008 (r185571) @@ -73,6 +73,7 @@ __FBSDID("$FreeBSD$"); #ifdef TCPDEBUG #include #endif /* TCPDEBUG */ +#include #ifdef VIMAGE_GLOBALS static int tcp_reass_maxseg; Modified: head/sys/netinet/tcp_sack.c ============================================================================== --- head/sys/netinet/tcp_sack.c Tue Dec 2 20:50:37 2008 (r185570) *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@FreeBSD.ORG Tue Dec 2 21:50:10 2008 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 138DB1065670; Tue, 2 Dec 2008 21:50:10 +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 BE65A8FC16; Tue, 2 Dec 2008 21:50:09 +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 B97C941C667; Tue, 2 Dec 2008 22:50: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 TdnFlohRKOpP; Tue, 2 Dec 2008 22:50:05 +0100 (CET) Received: by mail.cksoft.de (Postfix, from userid 66) id 35D5141C65F; Tue, 2 Dec 2008 22:50: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 ACAA94448D5; Tue, 2 Dec 2008 21:46:18 +0000 (UTC) Date: Tue, 2 Dec 2008 21:46:18 +0000 (UTC) From: "Bjoern A. Zeeb" X-X-Sender: bz@maildrop.int.zabbadoz.net To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org In-Reply-To: <200812022137.mB2LbSDN072024@svn.freebsd.org> Message-ID: <20081202213950.U80401@maildrop.int.zabbadoz.net> References: <200812022137.mB2LbSDN072024@svn.freebsd.org> X-OpenPGP-Key: 0x14003F198FEFA3E77207EE8D2B58B8F83CCF1842 MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: Subject: Re: svn commit: r185571 - in head/sys: compat/linprocfs compat/linux compat/svr4 contrib/altq/altq contrib/ipfilter/netinet contrib/pf/net contrib/rdma dev/cxgb/ulp/iw_cxgb dev/cxgb/ulp/tom kern module... X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 02 Dec 2008 21:50:10 -0000 On Tue, 2 Dec 2008, Bjoern A. Zeeb wrote: Hi, > URL: http://svn.freebsd.org/changeset/base/185571 > > Log: > Rather than using hidden includes (with cicular dependencies), > directly include only the header files needed. This reduces the > unneeded spamming of various headers into lots of files. > > For now, this leaves us with very few modules including vnet.h > and thus needing to depend on opt_route.h. In case you are still seeing a problem building modules (related to all this) please let me know. I tried to catch as many as I could spot. As I said before there is more cleanup to follow the next days but I tried to keep as much of that out of this commit. /bz -- Bjoern A. Zeeb Stop bit received. Insert coin for new game. From owner-svn-src-head@FreeBSD.ORG Tue Dec 2 22:00:12 2008 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0FFB01065679; Tue, 2 Dec 2008 22:00:12 +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 C77AA8FC23; Tue, 2 Dec 2008 22:00:11 +0000 (UTC) (envelope-from luigi@onelab2.iet.unipi.it) Received: by onelab2.iet.unipi.it (Postfix, from userid 275) id 5536473098; Tue, 2 Dec 2008 22:48:21 +0100 (CET) Date: Tue, 2 Dec 2008 22:48:21 +0100 From: Luigi Rizzo To: John Baldwin Message-ID: <20081202214821.GA65840@onelab2.iet.unipi.it> References: <200812021457.mB2Evmha063418@svn.freebsd.org> <200812021425.00173.jhb@freebsd.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <200812021425.00173.jhb@freebsd.org> User-Agent: Mutt/1.4.2.3i Cc: svn-src-head@freebsd.org, Luigi Rizzo , src-committers@freebsd.org, svn-src-all@freebsd.org Subject: Re: svn commit: r185562 - head/sys/boot/i386/boot0 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 02 Dec 2008 22:00:12 -0000 On Tue, Dec 02, 2008 at 02:24:58PM -0500, John Baldwin wrote: > On Tuesday 02 December 2008 09:57:48 am Luigi Rizzo wrote: ... > > + a drive number of 0x00 (floppy, or USB in floppy emulation) is > > now accepted as valid. Previously, it was overridden with 0x80, > > meaning that the partition table coming from the media was > > used to access sectors on a possibly different media. > > You can revert to the previous mode building with -DCHECK_DRIVE, > > and you can always use the 'setdrv' option in boot0cfg > > I would flip this back to the original default. This was there to workaround > certain broken BIOSes that incorrectly specified a drive of 0x00 when you > booted from the hard drive (at least according to the comments). On such i don't have strong opinions on this, but i would really like to see some evidence on how relevant the original logic (and the comments in the code on broken BIOSes) are nowadays. That code dates back to 1998. On the contrary, I can point to a very current and widespread case with AMI Bioses which, in the "Auto" emulation mode for USB device, use %dl=0 for devices under 500MB or so; in this case the original boot0 did the wrong thing, because overriding with 0x80 causes reading from the wrong device. Granted, boot0cfg options can fix things for both cases. It's all a matter of what is the most reasonable default. cheers luigi From owner-svn-src-head@FreeBSD.ORG Tue Dec 2 22:33:02 2008 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C8872106568D; Tue, 2 Dec 2008 22:33:02 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from server.baldwin.cx (bigknife-pt.tunnel.tserv9.chi1.ipv6.he.net [IPv6:2001:470:1f10:75::2]) by mx1.freebsd.org (Postfix) with ESMTP id 427A18FC17; Tue, 2 Dec 2008 22:33:02 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from localhost.corp.yahoo.com (john@localhost [IPv6:::1]) (authenticated bits=0) by server.baldwin.cx (8.14.3/8.14.3) with ESMTP id mB2MWoEG011992; Tue, 2 Dec 2008 17:32:56 -0500 (EST) (envelope-from jhb@freebsd.org) From: John Baldwin To: Luigi Rizzo Date: Tue, 2 Dec 2008 17:18:20 -0500 User-Agent: KMail/1.9.7 References: <200812021457.mB2Evmha063418@svn.freebsd.org> <200812021425.00173.jhb@freebsd.org> <20081202214821.GA65840@onelab2.iet.unipi.it> In-Reply-To: <20081202214821.GA65840@onelab2.iet.unipi.it> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200812021718.20571.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH authentication, not delayed by milter-greylist-2.0.2 (server.baldwin.cx [IPv6:::1]); Tue, 02 Dec 2008 17:32:56 -0500 (EST) X-Virus-Scanned: ClamAV 0.93.1/8713/Tue Dec 2 14:59:31 2008 on server.baldwin.cx X-Virus-Status: Clean X-Spam-Status: No, score=-2.6 required=4.2 tests=AWL,BAYES_00,NO_RELAYS 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, Luigi Rizzo , src-committers@freebsd.org, svn-src-all@freebsd.org Subject: Re: svn commit: r185562 - head/sys/boot/i386/boot0 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 02 Dec 2008 22:33:03 -0000 On Tuesday 02 December 2008 04:48:21 pm Luigi Rizzo wrote: > On Tue, Dec 02, 2008 at 02:24:58PM -0500, John Baldwin wrote: > > On Tuesday 02 December 2008 09:57:48 am Luigi Rizzo wrote: > ... > > > + a drive number of 0x00 (floppy, or USB in floppy emulation) is > > > now accepted as valid. Previously, it was overridden with 0x80, > > > meaning that the partition table coming from the media was > > > used to access sectors on a possibly different media. > > > You can revert to the previous mode building with -DCHECK_DRIVE, > > > and you can always use the 'setdrv' option in boot0cfg > > > > I would flip this back to the original default. This was there to workaround > > certain broken BIOSes that incorrectly specified a drive of 0x00 when you > > booted from the hard drive (at least according to the comments). On such > > i don't have strong opinions on this, but i would really like to see some > evidence on how relevant the original logic (and the comments in the > code on broken BIOSes) are nowadays. That code dates back to 1998. > > On the contrary, I can point to a very current and widespread case with > AMI Bioses which, in the "Auto" emulation mode for USB device, use %dl=0 > for devices under 500MB or so; in this case the original boot0 did > the wrong thing, because overriding with 0x80 causes reading from the > wrong device. > > Granted, boot0cfg options can fix things for both cases. It's all a > matter of what is the most reasonable default. Agreed. I'm just very hesitant about changing the defaults of boot0 (or any of the boot code for that matter). -- John Baldwin From owner-svn-src-head@FreeBSD.ORG Tue Dec 2 22:45:01 2008 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BBEA81065676; Tue, 2 Dec 2008 22:45:01 +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 AAB888FC14; Tue, 2 Dec 2008 22:45:01 +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 mB2Mj1bZ073601; Tue, 2 Dec 2008 22:45:01 GMT (envelope-from brueffer@svn.freebsd.org) Received: (from brueffer@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mB2Mj15l073600; Tue, 2 Dec 2008 22:45:01 GMT (envelope-from brueffer@svn.freebsd.org) Message-Id: <200812022245.mB2Mj15l073600@svn.freebsd.org> From: Christian Brueffer Date: Tue, 2 Dec 2008 22:45: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: r185572 - 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, 02 Dec 2008 22:45:01 -0000 Author: brueffer Date: Tue Dec 2 22:45:01 2008 New Revision: 185572 URL: http://svn.freebsd.org/changeset/base/185572 Log: Improve grammar. Submitted by: Ben Kaduk Modified: head/share/man/man4/upgt.4 Modified: head/share/man/man4/upgt.4 ============================================================================== --- head/share/man/man4/upgt.4 Tue Dec 2 21:37:28 2008 (r185571) +++ head/share/man/man4/upgt.4 Tue Dec 2 22:45:01 2008 (r185572) @@ -140,7 +140,7 @@ driver can be configured at runtime with .\"users have to download these files on their own. This driver requires the .Nm upgtfw -firmware be installed before it will work. +firmware to be installed before it will work. The firmware files are not publicly available. A package of the firmware which can be installed via .Xr pkg_add 1 From owner-svn-src-head@FreeBSD.ORG Tue Dec 2 23:04:03 2008 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id EEDCE1065676; Tue, 2 Dec 2008 23:04:03 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from server.baldwin.cx (bigknife-pt.tunnel.tserv9.chi1.ipv6.he.net [IPv6:2001:470:1f10:75::2]) by mx1.freebsd.org (Postfix) with ESMTP id 8F9B28FC08; Tue, 2 Dec 2008 23:04:03 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from localhost.corp.yahoo.com (john@localhost [IPv6:::1]) (authenticated bits=0) by server.baldwin.cx (8.14.3/8.14.3) with ESMTP id mB2N3v6J012225; Tue, 2 Dec 2008 18:03:57 -0500 (EST) (envelope-from jhb@freebsd.org) From: John Baldwin To: Poul-Henning Kamp Date: Tue, 2 Dec 2008 18:03:45 -0500 User-Agent: KMail/1.9.7 References: <200812021949.mB2JnfZr069753@svn.freebsd.org> In-Reply-To: <200812021949.mB2JnfZr069753@svn.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200812021803.46021.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH authentication, not delayed by milter-greylist-2.0.2 (server.baldwin.cx [IPv6:::1]); Tue, 02 Dec 2008 18:03:57 -0500 (EST) X-Virus-Scanned: ClamAV 0.93.1/8713/Tue Dec 2 14:59:31 2008 on server.baldwin.cx X-Virus-Status: Clean X-Spam-Status: No, score=-2.6 required=4.2 tests=AWL,BAYES_00,NO_RELAYS 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: r185568 - head/lib/libmd X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 02 Dec 2008 23:04:04 -0000 On Tuesday 02 December 2008 02:49:41 pm Poul-Henning Kamp wrote: > Author: phk > Date: Tue Dec 2 19:49:41 2008 > New Revision: 185568 > URL: http://svn.freebsd.org/changeset/base/185568 > > Log: > Make the "test" target test the compiled version, instead of the > installed version of the md library. Perhaps use "${.OBJDIR}/libmd.a" rather than "./libmd.a" to be 'make obj' friendly (e.g. buildworld). You could even do something like this: .if exists(${.OBJDIR}/libmd.a) LIBMD= ${.OBJDIR}/libmd.a .else LIBMD= -lmd .endif so it falls back to the system library if you don't have one built (in case you want to test the system library for some reason). -- John Baldwin From owner-svn-src-head@FreeBSD.ORG Tue Dec 2 23:26:44 2008 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 57BC81065672; Tue, 2 Dec 2008 23:26:44 +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 425058FC12; Tue, 2 Dec 2008 23:26:44 +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 mB2NQiTQ074472; Tue, 2 Dec 2008 23:26:44 GMT (envelope-from rwatson@svn.freebsd.org) Received: (from rwatson@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mB2NQheJ074455; Tue, 2 Dec 2008 23:26:43 GMT (envelope-from rwatson@svn.freebsd.org) Message-Id: <200812022326.mB2NQheJ074455@svn.freebsd.org> From: Robert Watson Date: Tue, 2 Dec 2008 23:26:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185573 - in head: contrib/openbsm contrib/openbsm/bin contrib/openbsm/bin/audit contrib/openbsm/bin/auditd contrib/openbsm/bin/auditfilterd contrib/openbsm/bin/auditreduce contrib/open... X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 02 Dec 2008 23:26:44 -0000 Author: rwatson Date: Tue Dec 2 23:26:43 2008 New Revision: 185573 URL: http://svn.freebsd.org/changeset/base/185573 Log: Merge OpenBSM 1.1 alpha 2 from the OpenBSM vendor branch to head, both contrib/openbsm (svn merge) and sys/{bsm,security/audit} (manual merge). - Add OpenBSM contrib tree to include paths for audit(8) and auditd(8). - Merge support for new tokens, fixes to existing token generation to audit_bsm_token.c. - Synchronize bsm includes and definitions. OpenBSM history for imported revisions below for reference. MFC after: 1 month Sponsored by: Apple Inc. Obtained from: TrustedBSD Project -- OpenBSM 1.1 alpha 2 - Include files in OpenBSM are now broken out into two parts: library builds required solely for user space, and system includes, which may also be required for use in the kernels of systems integrating OpenBSM. Submitted by Stacey Son. - Configure option --with-native-includes allows forcing the use of native include for system includes, rather than the versions bundled with OpenBSM. This is intended specifically for platforms that ship OpenBSM, have adapted versions of the system includes in a kernel source tree, and will use the OpenBSM build infrastructure with an unmodified OpenBSM distribution, allowing the customized system includes to be used with the OpenBSM build. Submitted by Stacey Son. - Various strcpy()'s/strcat()'s have been changed to strlcpy()'s/strlcat()'s or asprintf(). Added compat/strlcpy.h for Linux. - Remove compatibility defines for old Darwin token constant names; now only BSM token names are provided and used. - Add support for extended header tokens, which contain space for information on the host generating the record. - Add support for setting extended host information in the kernel, which is used for setting host information in extended header tokens. The audit_control file now supports a "host" parameter which can be used by auditd to set the information; if not present, the kernel parameters won't be set and auditd uses unextended headers for records that it generates. OpenBSM 1.1 alpha 1 - Add option to auditreduce(1) which allows users to invert sense of matching, such that BSM records that do not match, are selected. - Fix bug in audit_write() where we commit an incomplete record in the event there is an error writing the subject token. This was submitted by Diego Giagio. - Build support for Mac OS X 10.5.1 submitted by Eric Hall. - Fix a bug which resulted in host XML attributes not being arguments so that const strings can be passed as arguments to tokens. This patch was submitted by Xin LI. - Modify the -m option so users can select more then one audit event. - For Mac OS X, added Mach IPC support for audit trigger messages. - Fixed a bug in getacna() which resulted in a locking problem on Mac OS X. - Added LOG_PERROR flag to openlog when -d option is used with auditd. - AUE events added for Mac OS X Leopard system calls. Added: head/contrib/openbsm/CREDITS - copied unchanged from r185494, vendor/openbsm/dist/CREDITS head/contrib/openbsm/INSTALL - copied unchanged from r185494, vendor/openbsm/dist/INSTALL head/contrib/openbsm/NEWS - copied unchanged from r185494, vendor/openbsm/dist/NEWS head/contrib/openbsm/bin/auditd/audit_triggers.defs - copied unchanged from r185494, vendor/openbsm/dist/bin/auditd/audit_triggers.defs head/contrib/openbsm/bin/auditd/auditd_control.defs - copied unchanged from r185494, vendor/openbsm/dist/bin/auditd/auditd_control.defs head/contrib/openbsm/compat/strlcpy.h - copied unchanged from r185494, vendor/openbsm/dist/compat/strlcpy.h head/contrib/openbsm/sys/ - copied from r185494, vendor/openbsm/dist/sys/ Deleted: head/contrib/openbsm/HISTORY Modified: head/contrib/openbsm/ (props changed) head/contrib/openbsm/LICENSE head/contrib/openbsm/Makefile.am head/contrib/openbsm/Makefile.in head/contrib/openbsm/README head/contrib/openbsm/TODO head/contrib/openbsm/VERSION head/contrib/openbsm/bin/Makefile.in head/contrib/openbsm/bin/audit/Makefile.am head/contrib/openbsm/bin/audit/Makefile.in head/contrib/openbsm/bin/audit/audit.8 head/contrib/openbsm/bin/audit/audit.c head/contrib/openbsm/bin/auditd/Makefile.am head/contrib/openbsm/bin/auditd/Makefile.in head/contrib/openbsm/bin/auditd/audit_warn.c head/contrib/openbsm/bin/auditd/auditd.8 head/contrib/openbsm/bin/auditd/auditd.c head/contrib/openbsm/bin/auditd/auditd.h head/contrib/openbsm/bin/auditfilterd/Makefile.am head/contrib/openbsm/bin/auditfilterd/Makefile.in head/contrib/openbsm/bin/auditfilterd/auditfilterd.c head/contrib/openbsm/bin/auditreduce/Makefile.am head/contrib/openbsm/bin/auditreduce/Makefile.in head/contrib/openbsm/bin/auditreduce/auditreduce.1 head/contrib/openbsm/bin/auditreduce/auditreduce.c head/contrib/openbsm/bin/auditreduce/auditreduce.h head/contrib/openbsm/bin/praudit/Makefile.am head/contrib/openbsm/bin/praudit/Makefile.in head/contrib/openbsm/bin/praudit/praudit.1 head/contrib/openbsm/bin/praudit/praudit.c head/contrib/openbsm/bsm/Makefile.am head/contrib/openbsm/bsm/Makefile.in head/contrib/openbsm/bsm/audit_uevents.h head/contrib/openbsm/bsm/libbsm.h head/contrib/openbsm/compat/clock_gettime.h head/contrib/openbsm/compat/strlcat.h head/contrib/openbsm/config/config.h head/contrib/openbsm/config/config.h.in head/contrib/openbsm/configure head/contrib/openbsm/configure.ac head/contrib/openbsm/etc/audit_event head/contrib/openbsm/libbsm/Makefile.am head/contrib/openbsm/libbsm/Makefile.in head/contrib/openbsm/libbsm/au_class.3 head/contrib/openbsm/libbsm/au_free_token.3 head/contrib/openbsm/libbsm/au_token.3 head/contrib/openbsm/libbsm/audit_submit.3 head/contrib/openbsm/libbsm/bsm_audit.c head/contrib/openbsm/libbsm/bsm_class.c head/contrib/openbsm/libbsm/bsm_control.c head/contrib/openbsm/libbsm/bsm_event.c head/contrib/openbsm/libbsm/bsm_flags.c head/contrib/openbsm/libbsm/bsm_io.c head/contrib/openbsm/libbsm/bsm_mask.c head/contrib/openbsm/libbsm/bsm_notify.c head/contrib/openbsm/libbsm/bsm_token.c head/contrib/openbsm/libbsm/bsm_user.c head/contrib/openbsm/libbsm/bsm_wrappers.c head/contrib/openbsm/man/Makefile.in head/contrib/openbsm/man/audit.2 head/contrib/openbsm/man/audit.log.5 head/contrib/openbsm/man/audit_class.5 head/contrib/openbsm/man/audit_control.5 head/contrib/openbsm/man/audit_event.5 head/contrib/openbsm/man/audit_user.5 head/contrib/openbsm/man/audit_warn.5 head/contrib/openbsm/man/auditctl.2 head/contrib/openbsm/man/auditon.2 head/contrib/openbsm/man/getaudit.2 head/contrib/openbsm/man/getauid.2 head/contrib/openbsm/man/setaudit.2 head/contrib/openbsm/man/setauid.2 head/contrib/openbsm/modules/Makefile.in head/contrib/openbsm/modules/auditfilter_noop/Makefile.am head/contrib/openbsm/modules/auditfilter_noop/Makefile.in head/contrib/openbsm/modules/auditfilter_noop/auditfilter_noop.c head/contrib/openbsm/test/Makefile.am head/contrib/openbsm/test/Makefile.in head/contrib/openbsm/test/bsm/Makefile.am head/contrib/openbsm/test/bsm/Makefile.in head/contrib/openbsm/tools/Makefile.am head/contrib/openbsm/tools/Makefile.in head/sys/bsm/audit.h head/sys/bsm/audit_internal.h head/sys/bsm/audit_kevents.h head/sys/bsm/audit_record.h head/sys/security/audit/audit_bsm_token.c head/usr.sbin/audit/Makefile head/usr.sbin/auditd/Makefile Copied: head/contrib/openbsm/CREDITS (from r185494, vendor/openbsm/dist/CREDITS) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/contrib/openbsm/CREDITS Tue Dec 2 23:26:43 2008 (r185573, copy of r185494, vendor/openbsm/dist/CREDITS) @@ -0,0 +1,33 @@ +OpenBSM Credits + +The following organizations and individuals have contributed substantially to +the development of OpenBSM: + + Apple Inc. + McAfee Research, McAfee, Inc. + SPARTA, Inc. + Robert Watson + Wayne Salamon + Suresh Krishnaswamy + Kevin Van Vechten + Tom Rhodes + Wojciech Koszek + Chunyang Yuan + Poul-Henning Kamp + Christian Brueffer + Olivier Houchard + Christian Peron + Martin Fong + Pawel Worach + Martin Englund + Ruslan Ermilov + Martin Voros + Diego Giagio + Alex Samorukov + Eric Hall + Xin LI + Stacey Son + +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 +OpenBSM implementation. Copied: head/contrib/openbsm/INSTALL (from r185494, vendor/openbsm/dist/INSTALL) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/contrib/openbsm/INSTALL Tue Dec 2 23:26:43 2008 (r185573, copy of r185494, vendor/openbsm/dist/INSTALL) @@ -0,0 +1,29 @@ +OpenBSM Build and Installation Instructions + +OpenBSM is currently built using autoconf and automake, which should allow +for building on a range of operating systems, including FreeBSD, Mac OS X, +and Linux. Depending on the availability of audit facilities in the +underlying operating system, some components that depend on kernel audit +support are built conditionally. Typically, build will be performed using: + + ./configure + make + +To install, use: + + make install + +You may wish to specify that the OpenBSM components not be installed in the +base system, rather in a specific directory. This may be done using the +--prefix argument to configure. If installing to a specific directory, +remember to update your library path so that running tools from that +directory the correct libbsm is used: + + ./configure --prefix=/home/rwatson/openbsm + make + make install + LD_LIBRARY_PATH=/home/rwatson/openbsm/libbsm ; export LD_LIBRARY_PATH + +You will need to manually propagate openbsm/etc/* into /etc/security on your +system; this is not done automatically so as to avoid disrupting the current +configuration. Currently, the locations of these files is not configurable. Modified: head/contrib/openbsm/LICENSE ============================================================================== --- head/contrib/openbsm/LICENSE Tue Dec 2 22:45:01 2008 (r185572) +++ head/contrib/openbsm/LICENSE Tue Dec 2 23:26:43 2008 (r185573) @@ -1,3 +1,5 @@ +OpenBSM Copyrights and Licensing + OpenBSM is covered by a number of copyrights, with licenses being either two or three clause BSD licenses. Individual file headers should be consulted for specific copyrights on specific components. The TrustedBSD Project would @@ -30,4 +32,4 @@ substantially similar licenses: * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. -$P4: //depot/projects/trustedbsd/openbsm/LICENSE#4 $ +$P4: //depot/projects/trustedbsd/openbsm/LICENSE#5 $ Modified: head/contrib/openbsm/Makefile.am ============================================================================== --- head/contrib/openbsm/Makefile.am Tue Dec 2 22:45:01 2008 (r185572) +++ head/contrib/openbsm/Makefile.am Tue Dec 2 23:26:43 2008 (r185573) @@ -1,5 +1,5 @@ # -# $P4: //depot/projects/trustedbsd/openbsm/Makefile.am#2 $ +# $P4: //depot/projects/trustedbsd/openbsm/Makefile.am#3 $ # SUBDIRS = \ @@ -7,7 +7,8 @@ SUBDIRS = \ libbsm \ bin \ man \ - modules + modules \ + sys EXTRA_DIST = \ CHANGELOG \ Modified: head/contrib/openbsm/Makefile.in ============================================================================== --- head/contrib/openbsm/Makefile.in Tue Dec 2 22:45:01 2008 (r185572) +++ head/contrib/openbsm/Makefile.in Tue Dec 2 23:26:43 2008 (r185573) @@ -15,7 +15,7 @@ @SET_MAKE@ # -# $P4: //depot/projects/trustedbsd/openbsm/Makefile.in#5 $ +# $P4: //depot/projects/trustedbsd/openbsm/Makefile.in#8 $ # VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ @@ -38,7 +38,7 @@ host_triplet = @host@ subdir = . DIST_COMMON = README $(am__configure_deps) $(srcdir)/Makefile.am \ $(srcdir)/Makefile.in $(top_srcdir)/config/config.h.in \ - $(top_srcdir)/configure TODO config/config.guess \ + $(top_srcdir)/configure INSTALL NEWS TODO config/config.guess \ config/config.sub config/depcomp config/install-sh \ config/ltmain.sh config/missing ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 @@ -116,6 +116,7 @@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ +MIG = @MIG@ MKDIR_P = @MKDIR_P@ OBJEXT = @OBJEXT@ PACKAGE = @PACKAGE@ @@ -187,7 +188,8 @@ SUBDIRS = \ libbsm \ bin \ man \ - modules + modules \ + sys EXTRA_DIST = \ CHANGELOG \ Copied: head/contrib/openbsm/NEWS (from r185494, vendor/openbsm/dist/NEWS) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/contrib/openbsm/NEWS Tue Dec 2 23:26:43 2008 (r185573, copy of r185494, vendor/openbsm/dist/NEWS) @@ -0,0 +1,351 @@ +OpenBSM Version History + +OpenBSM 1.1 alpha 2 + +- Include files in OpenBSM are now broken out into two parts: library builds + required solely for user space, and system includes, which may also be + required for use in the kernels of systems integrating OpenBSM. Submitted + by Stacey Son. +- Configure option --with-native-includes allows forcing the use of native + include for system includes, rather than the versions bundled with OpenBSM. + This is intended specifically for platforms that ship OpenBSM, have adapted + versions of the system includes in a kernel source tree, and will use the + OpenBSM build infrastructure with an unmodified OpenBSM distribution, + allowing the customized system includes to be used with the OpenBSM build. + Submitted by Stacey Son. +- Various strcpy()'s/strcat()'s have been changed to strlcpy()'s/strlcat()'s + or asprintf(). Added compat/strlcpy.h for Linux. +- Remove compatibility defines for old Darwin token constant names; now only + BSM token names are provided and used. +- Add support for extended header tokens, which contain space for information + on the host generating the record. +- Add support for setting extended host information in the kernel, which is + used for setting host information in extended header tokens. The + audit_control file now supports a "host" parameter which can be used by + auditd to set the information; if not present, the kernel parameters won't + be set and auditd uses unextended headers for records that it generates. + +OpenBSM 1.1 alpha 1 + +- Add option to auditreduce(1) which allows users to invert sense of + matching, such that BSM records that do not match, are selected. +- Fix bug in audit_write() where we commit an incomplete record in the + event there is an error writing the subject token. This was submitted + by Diego Giagio. +- Build support for Mac OS X 10.5.1 submitted by Eric Hall. +- Fix a bug which resulted in host XML attributes not being printed + while processing extended header tokens. This patch was submitted by + Martin Voros. +- Constification of function arguments so that const strings can be passed + as arguments to tokens. This patch was submitted by Xin LI. +- Modify the -m option so users can select more then one audit event. +- For Mac OS X, added Mach IPC support for audit trigger messages. +- Fixed a bug in getacna() which resulted in a locking problem on Mac OS X. +- Added LOG_PERROR flag to openlog when -d option is used with auditd. +- AUE events added for Mac OS X Leopard system calls. + +OpenBSM 1.0 + +- Fix bug in auditreduce(1) which resulted in a memory fault/crash when + the user specified an event name with -m. +- Remove AU_.* hard-coded audit class constants, as audit classes are now + entirely dynamically configured using /etc/security/audit_class. + +OpenBSM 1.0 alpha 15 + +- Fix bug when processing in_addr_ex tokens. +- Restore the behavior of printing the string/text specified while + auditing arg32 tokens. +- Synchronized audit event list to Solaris, picking up the *at(2) system call + definitions, now required for FreeBSD and Linux. Added additional events + for *at(2) system calls not present in Solaris. +- Bugs in auditreduce(1) fixed allowing partial date strings to be used in + filtering events. + +OpenBSM 1.0 alpha 14 + +- Fix endian issues when processing IPv6 addresses for extended subject + and process tokens. +- gcc41 warnings clean. +- Teach audit_submit(3) about getaudit_addr(2). +- Add support for zonename tokens. + +OpenBSM 1.0 alpha 13 + +- compat/clock_gettime.h now provides a compatibility implementation of + clock_gettime(), which fixes building on Mac OS X. +- Countless man page improvements, markup fixes, content fixs, etc. +- XML printing support via "praudit -x". +- audit.log.5 expanded to include additional BSM token types. +- Added encoding and decoding routines for process64_ex, process32_ex, + subject32_ex, header64, and attr64 tokens. +- Additional audit event identifiers for listen, mlockall/munlockall, + getpath, POSIX message queues, and mandatory access control. + +OpenBSM 1.0 alpha 12 + +- Correct bug in auditreduce which prevented the -c option from working + correctly when the user specifies to process successful or failed events. + The problem stemmed from not having access to the return token at the time + the initial preselection occurred, but now a second preselection process + occurs while processing the return token. +- getacfilesz(3) API added to read new audit_control(5) filesz setting, + which auditd(8) now sets the kernel audit trail rotation size to. +- auditreduce(1) now uses stdin if no file names are specified on the command + line; this was the documented behavior previously, but it was not + implemented. Be more specific in auditreduce(1)'s examples section about + what might be done with the output of auditreduce. +- Add audit_warn(5) closefile event so that administrators can hook + termination of an audit trail file. For example, this might be used to + compress the trail file after it is closed. +- auditreduce(1) now uses regular expressions for pathname matching. Users can + now supply one or more (comma delimited) regular expressions for searching + the pathnames. If one of the regular expressions is prefixed with a tilde + (~), and a path matches, it will be excluded from the search results. + +OpenBSM 1.0 alpha 11 + +- Reclassify certain read/write operations as having no class rather than the + fr/fw class; our default classes audit intent (open) not operations (read, + write). +- Introduce AUE_SYSCTL_WRITE event so that BSD/Darwin systems can audit reads + and writes of sysctls as separate events. Add additional kernel + environment and jail events for FreeBSD. +- Break AUDIT_TRIGGER_OPEN_NEW into two events, AUDIT_TRIGGER_ROTATE_USER + (issued by the user audit(8) tool) and AUDIT_TRIGGER_ROTATE_KERNEL (issued + by the kernel audit implementation) so that they can be distinguished. +- Disable rate limiting of rotate requests; as the kernel doesn't retransmit + a dropped request, the log file will otherwise grow indefinitely if the + trigger is dropped. +- Improve auditd debugging output. +- Fix a number of threading related bugs in audit_control file reading + routines. +- Add APIs au_poltostr() and au_strtopol() to convert between text + representations of audit_control policy flags and the flags passed to + auditon(A_SETPOLICY) and retrieved from auditon(A_GETPOLICY). +- Add API getacpol() to return the 'policy:' entry from audit_control, an + extension to the Solaris file format to allow specification of policy + persistent flags. +- Update audump to print the audit_control policy field. +- Update auditd to read the audit_control policy field and set the kernel + policy to match it when configuring/reconfiguring. Remove the -s and -h + arguments as these policies are now set via the configuration file. If a + policy line is not found in the configuration file, continue with the + current default of setting AUDIT_CNT. +- Fix bugs in the parsing of large execve(2) arguments and environmental + variable tokens; increase maximum parsed argument and variable count. +- configure now detects strlcat(), used by policy-related functions. +- Reference token and record sample files added to test tree. + +OpenBSM 1.0 alpha 10 + +- auditd now generates complete audit records for its events, as required for + application-submitted audit records in the FreeBSD kernel audit + implementation. + +OpenBSM 1.0 alpha 9 + +- Rename many OpenBSM-specific constants and API elements containing the + strings "BSM" and "bsm" to "AUDIT" and "audit", observing that this is true + for almost all existing constants and APIs. +- Instead of passing a per-instance cookie directly into all audit filter + APIs, pass in the audit filter daemon state pointer, which is then used by + the module using an audit_filter_{get,set}cookie() API. This will allow + future service APIs provided by the filter daemon to maintain their own + state -- for example, per-module preselection state. + +OpenBSM 1.0 alpha 8 + +- Correct typo in definition of AUR_INT. +- Adopt OpenSolaris constant values for AUDIT_* configuration flags. +- Arguments to au_to_exec_args() and au_to_exec_env() no longer const. +- Add kernel versions of au_to_exec_args() and au_to_exec_env(). +- Fix exec argument type that is printed for env strings from 'arg' to 'env'. +- New OpenBSM token version number assigned, constants added for other + commonly seen version numbers. +- OpenBSM-specific events assigned numbers in the 43xxx range to avoid future + collisions with Solaris. Darwin events renamed to AUE_DARWIN_foo, as they + are now deprecated numberings. +- autoconf now detects clock_gettime(), which is not available on Darwin. +- praudit output fixes relating to arg32 and arg64 tokens. +- Maximum record size updated to 64k-1 to match Solaris record size limit. +- Various style and comment cleanups in include files. + +OpenBSM 1.0 alpha 7 + +- Adopted Solaris-compatible format for subject32_ex and subject64_ex + tokens, which previously did not correctly implement variable length + address storage. +- Prefer inttypes.h to stdint.h; enhance queue.h detection to test for + TAILQ_FOREACH_SAFE(), which is present in recent BSD queue.h's, but not + older ones. OpenBSM now builds on some FreeBSD 4.x versions. +- New event types for extended attributes, ACLs, and scheduling. + +OpenBSM 1.0 alpha 6 + +- Use AU_TO_WRITE and AU_NO_TO_WRITE for the 'keep' argument to au_close(); + previously we used hard-coded 0 and 1 values. +- Add man page for au_open(), au_write(), au_close(), and + au_close_buffer(). +- Support a more complete range of data types for the arbitrary data token: + add AUR_CHAR (alias to AUR_BYTE), remove AUR_LONG, add AUR_INT32 (alias + to AUR_INT), add AUR_INT64. +- Add au_close_token(), which allows writing a single token_t to a memory + buffer. Not likely to be used much by applications, but useful for + writing test tools. +- Modify au_to_file() so that it accepts a timeval in user space, not just + kernel -- this is not a Solaris BSM API so can be modified without + causing compatibility issues. +- Define a new API, au_to_header32_tm(), which adds a struct timeval + argument to the ordinary au_to_header32(), which is now implemented by + wrapping au_to_header32_tm() and calling gettimeofday(). #ifndef KERNEL + the APIs that invoke gettimeofday(), rather than having a variable + definition. Don't try to retrieve time zone information using + gettimeofday(), as it's not needed, and introduces possible failure + modes. +- Don't perform byte order transformations on the addr/machine fields of + the terminal ID that appears in the process32/subject32 tokens. These + are assumed to be IP addresses, and as such, to be in network byte + order. +- Universally, APIs now assume that IP addresses and ports are provided + in network byte order. APIs now generally provide these types in + network byte order when decoding. +- Beginnings of an OpenBSM test framework can now be found in openbsm/test. + This code is not built or installed by default. +- auditd now assigns more appropriate syslog levels to its debugging and + error information. +- Support for audit filters introduced: audit filters are dynamically + loaded shared objects that run in the context of a new daemon, + auditfilterd. The daemon reads from an audit pipe and feeds both BSM and + parsed versions of records to shared objects using a module API. This + will provide a framework for the writing of intrusion detection services. +- New utility API, audit_submit(), added to capture common elements of audit + record submission for many applications. + +OpenBSM 1.0 alpha 5 + +- Update install notes to indicate /etc files are to be installed manually. +- On systems without LOG_SECURITY, use LOG_AUTH. +- Convert to autoconf/automake in order to move to a more portable (not + BSD-specific) build infrastructure, and more easy conditional building of + components. Currently, the primary feature loss is that automake does + not have native support for manual symlinks. This will be addressed in a + future OpenBSM release. +- Add compat/queue.h, to be used on systems dated BSD queue macro libraries + (as found on Linux). +- Rename CHANGELOG to HISTORY, as our change log doesn't follow some of the + existing conventions for a CHANGELOG. +- Some private data structures moved from audit.h to audit_internal.h to + prevent inappropriate use by applications and name space pollution. +- Improved detection and use of endian macros using autoconf. +- Avoid non-portable use of struct in6_addr, which is largely opaque. +- Avoid leaking BSD kernel socket related token code to user space in + bsm_token.c. +- Teach System V IPC calls to look for Linux naming variations for certain + struct ipc_perm fields. +- Test for audit system calls, and if not present, don't build + bsm_wrappers.c, bsm_notify.c, audit(8), and auditd(8), which rely on + those system calls. +- au_close() is not implemented on systems that don't have audit system + calls, but au_close_buffer() is. +- Work around missing BSDisms in bsm_wrapper.c. +- Fix nested includes so including libbsm.h in an application on Linux + picks up the necessary definitions. + +OpenBSM 1.0 alpha 4 + +- Remove "audit" user example from audit_user, as it's not present on most + systems. +- Add cannot_audit() function non-Darwin systems that wraps auditon(); + required by OpenSSH BSM support. Convert Darwin cannot_audit() into a + function rather than a macro. +- Library build fixed on Darwin following include file tweaks. The native + Darwin sys/audit.h conflicts with bsm/audit.h due to duplicate types, so + for now we force bsm_wrappers.c to not perform a nested include of + sys/audit.h. + +OpenBSM 1.0 alpha 3 + +- Man page formatting, cross reference, mlinks, and accuracy improvements. +- auditd and tools now compile and run on FreeBSD/arm. +- auditd will now fchown() the trail file to the audit review group, if + defined at compile-time. +- Added AUE_SYSARCH for FreeBSD. +- Definition of AUE_SETFSGID fixed for Linux. + +OpenBSM 1.0 alpha 2 + +- Man page formatting improvements. +- A number of new audit event identifiers for FreeBSD, Linux, and POSIX.1b + events. +- Remove 'tfm' class, unused in OpenBSM. + +OpenBSM 1.0 alpha 1 + +- Import of Darwin74 BSM drop +- Use 'syslog' for audit log warnings, rather than echoing to a file in + audit_warn. +- Compile using BSD make infrastructure. +- Integrate bsm/ include files from Darwin74 XNU drop into OpenBSM. +- Narrow set of symbols and defines that are exposed in user space: don't + compile in code relying on kernel-only types such as 'struct socket'. +- Add README, including basic build documentation. +- Compilation of Apple-specific notify and Machroutines now #ifdef __APPLE__. +- Staticize libbsm global variables to avoid leakage into applications. +- Add free_au_user_ent() so that au_user_ent's don't have to be leaked. +- Clean up bogus nul-termination checks in libbsm. +- Add libbsm API man pages: au_class.3 au_control.3 au_event.3 + au_free_token.3 au_io.3 au_mask.3 au_token.3 au_user.3 libbsm.3. +- Add man pages for BSM system calls: audit.2 auditctl.2 auditon.2 getaudit.2 + getauid.2 setaudit.2 setauid.2 +- Modify various libbsm interfaces to more consistently return 'errno' values + on failure. +- Break out au_close() into constituent parts, allowing records to be written + to memory as well as files. +- Prefix various defines with 'BSM_' to reduce name space pollution. +- Added audit_internal.h, which can be used by a kernel audit implementation + wanting to rely on libbsm components. +- Build with warnings, and eliminate warnings. +- Make libbsm endian-independent, storing and reading BSM are big endian + (network byte order) rather than native byte order. More consistently + print IP addresses using the IP address print routine. These changes + make use of sys/endian.h from *BSD; since this isn't present on Darwin, + add it to OpenBSM as compat/endian.h, which is used only on Darwin. +- Import of Darwin80 BSM drop, including 64-bit file IDs, better + documentation of private APIs, and bug fixes. +- White space cleanup. +- Add audit.log.5, a first cut at a man page documenting the BSM file format. +- Teach au_read_rec() to recognize stand-alone file tokens, which are present + at the beginning and end of Solaris audit trails. Technically, these + appear to violate the high level BSM spec, which suggests that all tokens + are present in records, but need to be supported. +- Implement HEADER64, ATTR64, SUBJECT64 token types, which make it possible + to run praudit(1) on basic Solaris BSM streams. +- Switched to Solaris spelling of token names; Darwin spellings are now + deprecated and will be removed in a future version of OpenBSM. +- Adopt Solaris model for representing IPv4 and IPv6 addresses. +- Prefer C99 types. +- Attempt to universally adopt the BSD style(9) coding style for + consistency. +- auditreduce(1) now has a usage message. +- Update support for auditctl(2) system call to support FreeBSD. +- Add support for /dev/audit as the trigger source on FreeBSD. +- Add additional event types for Darwin, FreeBSD, and Solaris. Annotate + conflicts (there are a few, unfortunately). Correct spellings, comment, + sort, etc. These include {get,set}res[ug]id(), sendfile(), lchflags(), + eaccess(), kqueue(), kevent(), poll(), lchmod(). +- Relicensed under a BSD license, many thanks to Apple, Inc! +- Many bug fixes, cleanups, thread safety in the class, control, event, + and user system audit databases. Annotate some persisting atomicity + bugs associated with the API and implementation. +- Add audump test tool. +- Adopt OpenSolaris BSM API memory semantics: caller allocates memory, + or static memory is returned for non-_r() versions of API calls. + _free() calls dropped as a result, and source code compatibility with + OpenSolaris improved significantly. +- Annotate BSM events with origin OS and compatibility information. +- auditd(8), audit(8) added to the OpenBSM distribution. auditd extended + to support reloading of kernel event table. +- Allow comments in /etc/security configuration files. + +$P4: //depot/projects/trustedbsd/openbsm/NEWS#9 $ Modified: head/contrib/openbsm/README ============================================================================== --- head/contrib/openbsm/README Tue Dec 2 22:45:01 2008 (r185572) +++ head/contrib/openbsm/README Tue Dec 2 23:26:43 2008 (r185573) @@ -1,4 +1,4 @@ -OpenBSM 1.0 +OpenBSM 1.1 alpha 1 Introduction @@ -16,12 +16,13 @@ may be found in the FreeBSD and Mac OS X OpenBSM consists of several directories: bin/ Audit-related command line tools - bsm/ System include files for BSM + bsm/ Library include files for BSM compat/ Compatibility code to build on various OS's etc/ Sample /etc/security configuration files libbsm/ Implementation of BSM library interfaces and man pages man/ System call and configuration file man pages modules/ Directory for auditfilterd module source + sys/ System include files for BSM test/ Test token sets and geneneration program tools/ Tool directory, including audump to dump databases @@ -34,66 +35,9 @@ The following programs are included with audump Debugging tool to parse and print audit databases praudit Tool to print audit trails - Building + Build and Installation -OpenBSM is currently built using autoconf and automake, which should allow -for building on a range of operating systems, including FreeBSD, Mac OS X, -and Linux. Depending on the availability of audit facilities in the -underlying operating system, some components that depend on kernel audit -support are built conditionally. Typically, build will be performed using: - - ./configure - make - -To install, use: - - make install - -You may wish to specify that the OpenBSM components not be installed in the -base system, rather in a specific directory. This may be done using the ---prefix argument to configure. If installing to a specific directory, -remember to update your library path so that running tools from that -directory the correct libbsm is used: - - ./configure --prefix=/home/rwatson/openbsm - make - make install - LD_LIBRARY_PATH=/home/rwatson/openbsm/libbsm ; export LD_LIBRARY_PATH - -You will need to manually propagate openbsm/etc/* into /etc on your system; -this is not done automatically so as to avoid disrupting the current -configuration. Currently, the locations of these files is not configurable. - - Credits - -The following organizations and individuals have contributed substantially to -the development of OpenBSM: - - Apple Computer, Inc. - McAfee Research, McAfee, Inc. - SPARTA, Inc. - Robert Watson - Wayne Salamon - Suresh Krishnaswamy - Kevin Van Vechten - Tom Rhodes - Wojciech Koszek - Chunyang Yuan - Poul-Henning Kamp - Christian Brueffer - Olivier Houchard - Christian Peron - Martin Fong - Pawel Worach - Martin Englund - Ruslan Ermilov - Martin Voros - Diego Giagio - Alex Samorukov - -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 -OpenBSM implementation. +Please see the file INSTALL for build and installation instructions. Contributions @@ -111,4 +55,4 @@ Information on TrustedBSD may be found o http://www.TrustedBSD.org/ -$P4: //depot/projects/trustedbsd/openbsm/README#24 $ +$P4: //depot/projects/trustedbsd/openbsm/README#32 $ Modified: head/contrib/openbsm/TODO ============================================================================== --- head/contrib/openbsm/TODO Tue Dec 2 22:45:01 2008 (r185572) +++ head/contrib/openbsm/TODO Tue Dec 2 23:26:43 2008 (r185573) @@ -1,5 +1,5 @@ -- Teach libbsm about any additional 64-bit token types that are present - in more recent Solaris versions. +OpenBSM TODO + - Build a regression test suite for libbsm that generates each token type and then compares the results with known good data. Make sure to test that things work properly with respect to endianness of the local @@ -18,5 +18,7 @@ trailer context. - Put hostname in trail file name. - Document audit_warn event arguments. +- Allow the path /etc/security to be configured at configure-time so that + alternative locations can be used. -$P4: //depot/projects/trustedbsd/openbsm/TODO#9 $ +$P4: //depot/projects/trustedbsd/openbsm/TODO#11 $ Modified: head/contrib/openbsm/VERSION ============================================================================== --- head/contrib/openbsm/VERSION Tue Dec 2 22:45:01 2008 (r185572) +++ head/contrib/openbsm/VERSION Tue Dec 2 23:26:43 2008 (r185573) @@ -1 +1 @@ -OPENBSM_1_0 +OPENBSM_1_1_ALPHA_2 Modified: head/contrib/openbsm/bin/Makefile.in ============================================================================== --- head/contrib/openbsm/bin/Makefile.in Tue Dec 2 22:45:01 2008 (r185572) +++ head/contrib/openbsm/bin/Makefile.in Tue Dec 2 23:26:43 2008 (r185573) @@ -15,7 +15,7 @@ @SET_MAKE@ # -# $P4: //depot/projects/trustedbsd/openbsm/bin/Makefile.in#5 $ +# $P4: //depot/projects/trustedbsd/openbsm/bin/Makefile.in#8 $ # VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ @@ -104,6 +104,7 @@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ +MIG = @MIG@ MKDIR_P = @MKDIR_P@ OBJEXT = @OBJEXT@ PACKAGE = @PACKAGE@ Modified: head/contrib/openbsm/bin/audit/Makefile.am ============================================================================== --- head/contrib/openbsm/bin/audit/Makefile.am Tue Dec 2 22:45:01 2008 (r185572) +++ head/contrib/openbsm/bin/audit/Makefile.am Tue Dec 2 23:26:43 2008 (r185573) @@ -1,10 +1,23 @@ # -# $P4: //depot/projects/trustedbsd/openbsm/bin/audit/Makefile.am#1 $ +# $P4: //depot/projects/trustedbsd/openbsm/bin/audit/Makefile.am#4 $ # -INCLUDES = -I$(top_srcdir) +if USE_NATIVE_INCLUDES +INCLUDES = -I$(top_builddir) -I$(top_srcdir) +else +INCLUDES = -I$(top_builddir) -I$(top_srcdir) -I$(top_srcdir)/sys +endif sbin_PROGRAMS = audit -audit_SOURCES = audit.c audit_LDADD = $(top_builddir)/libbsm/libbsm.la man8_MANS = audit.8 + +if USE_MACH_IPC +audit_SOURCES = auditd_control_user.c audit.c +CLEANFILES = auditd_control_user.c auditd_control_user.h + +auditd_control_user.c: $(top_srcdir)/bin/auditd/auditd_control.defs + $(MIG) -user auditd_control_user.c -header auditd_control_user.h -server /dev/null -sheader /dev/null $(top_srcdir)/bin/auditd/auditd_control.defs +else +audit_SOURCES = audit.c +endif Modified: head/contrib/openbsm/bin/audit/Makefile.in ============================================================================== --- head/contrib/openbsm/bin/audit/Makefile.in Tue Dec 2 22:45:01 2008 (r185572) +++ head/contrib/openbsm/bin/audit/Makefile.in Tue Dec 2 23:26:43 2008 (r185573) @@ -15,7 +15,7 @@ @SET_MAKE@ # -# $P4: //depot/projects/trustedbsd/openbsm/bin/audit/Makefile.in#4 $ +# $P4: //depot/projects/trustedbsd/openbsm/bin/audit/Makefile.in#9 $ # VPATH = @srcdir@ @@ -49,7 +49,10 @@ CONFIG_CLEAN_FILES = am__installdirs = "$(DESTDIR)$(sbindir)" "$(DESTDIR)$(man8dir)" sbinPROGRAMS_INSTALL = $(INSTALL_PROGRAM) PROGRAMS = $(sbin_PROGRAMS) -am_audit_OBJECTS = audit.$(OBJEXT) +am__audit_SOURCES_DIST = audit.c auditd_control_user.c +@USE_MACH_IPC_FALSE@am_audit_OBJECTS = audit.$(OBJEXT) +@USE_MACH_IPC_TRUE@am_audit_OBJECTS = auditd_control_user.$(OBJEXT) \ +@USE_MACH_IPC_TRUE@ audit.$(OBJEXT) audit_OBJECTS = $(am_audit_OBJECTS) audit_DEPENDENCIES = $(top_builddir)/libbsm/libbsm.la DEFAULT_INCLUDES = -I. -I$(top_builddir)/config@am__isrc@ @@ -65,7 +68,7 @@ LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLF --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \ $(LDFLAGS) -o $@ SOURCES = $(audit_SOURCES) -DIST_SOURCES = $(audit_SOURCES) +DIST_SOURCES = $(am__audit_SOURCES_DIST) man8dir = $(mandir)/man8 NROFF = nroff MANS = $(man8_MANS) @@ -113,6 +116,7 @@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ +MIG = @MIG@ MKDIR_P = @MKDIR_P@ OBJEXT = @OBJEXT@ PACKAGE = @PACKAGE@ @@ -179,10 +183,13 @@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ -INCLUDES = -I$(top_srcdir) -audit_SOURCES = audit.c +@USE_NATIVE_INCLUDES_FALSE@INCLUDES = -I$(top_builddir) -I$(top_srcdir) -I$(top_srcdir)/sys +@USE_NATIVE_INCLUDES_TRUE@INCLUDES = -I$(top_builddir) -I$(top_srcdir) audit_LDADD = $(top_builddir)/libbsm/libbsm.la man8_MANS = audit.8 +@USE_MACH_IPC_FALSE@audit_SOURCES = audit.c +@USE_MACH_IPC_TRUE@audit_SOURCES = auditd_control_user.c audit.c +@USE_MACH_IPC_TRUE@CLEANFILES = auditd_control_user.c auditd_control_user.h all: all-am .SUFFIXES: @@ -255,6 +262,7 @@ distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/audit.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/auditd_control_user.Po@am__quote@ .c.o: @am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @@ -426,6 +434,7 @@ install-strip: mostlyclean-generic: clean-generic: + -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) @@ -511,6 +520,9 @@ uninstall-man: uninstall-man8 tags uninstall uninstall-am uninstall-man uninstall-man8 \ uninstall-sbinPROGRAMS + +@USE_MACH_IPC_TRUE@auditd_control_user.c: $(top_srcdir)/bin/auditd/auditd_control.defs +@USE_MACH_IPC_TRUE@ $(MIG) -user auditd_control_user.c -header auditd_control_user.h -server /dev/null -sheader /dev/null $(top_srcdir)/bin/auditd/auditd_control.defs # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: Modified: head/contrib/openbsm/bin/audit/audit.8 ============================================================================== --- head/contrib/openbsm/bin/audit/audit.8 Tue Dec 2 22:45:01 2008 (r185572) +++ head/contrib/openbsm/bin/audit/audit.8 Tue Dec 2 23:26:43 2008 (r185573) @@ -1,4 +1,4 @@ -.\" Copyright (c) 2004 Apple Computer, Inc. +.\" Copyright (c) 2004 Apple Inc. .\" All rights reserved. .\" .\" Redistribution and use in source and binary forms, with or without @@ -10,7 +10,7 @@ .\" 2. Redistributions in binary form must reproduce the above copyright .\" notice, this list of conditions and the following disclaimer in the .\" documentation and/or other materials provided with the distribution. -.\" 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of +.\" 3. Neither the name of Apple Inc. ("Apple") nor the names of .\" its contributors may be used to endorse or promote products derived .\" from this software without specific prior written permission. .\" @@ -25,7 +25,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.8#10 $ +.\" $P4: //depot/projects/trustedbsd/openbsm/bin/audit/audit.8#11 $ .\" .Dd October 2, 2006 .Dt AUDIT 8 Modified: head/contrib/openbsm/bin/audit/audit.c ============================================================================== --- head/contrib/openbsm/bin/audit/audit.c Tue Dec 2 22:45:01 2008 (r185572) +++ head/contrib/openbsm/bin/audit/audit.c Tue Dec 2 23:26:43 2008 (r185573) @@ -1,5 +1,5 @@ -/* - * Copyright (c) 2005 Apple Computer, Inc. +/*- + * Copyright (c) 2005-2008 Apple Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -11,7 +11,7 @@ * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. - * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of + * 3. Neither the name of Apple Inc. ("Apple") nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * @@ -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#8 $ + * $P4: //depot/projects/trustedbsd/openbsm/bin/audit/audit.c#11 $ */ /* * Program to trigger the audit daemon with a message that is either: @@ -37,7 +37,12 @@ */ #include +#include +#ifdef HAVE_FULL_QUEUE_H #include +#else /* !HAVE_FULL_QUEUE_H */ +#include +#endif /* !HAVE_FULL_QUEUE_H */ #include #include @@ -47,6 +52,58 @@ #include #include + +static int send_trigger(unsigned int); + +#ifdef USE_MACH_IPC +#include +#include +#include +#include +#include +#include +#include + +#include "auditd_control_user.h" + +static int +send_trigger(unsigned int trigger) +{ + mach_port_t serverPort; + kern_return_t error; + + error = host_get_audit_control_port(mach_host_self(), &serverPort); + if (error != KERN_SUCCESS) { + mach_error("Cannot get auditd_control Mach port: ", error); + return (-1); + } + + error = auditd_control(serverPort, trigger); + if (error != KERN_SUCCESS) { + mach_error("Error sending trigger: ", error); + return (-1); + } + + return (0); +} + +#else /* ! USE_MACH_IPC */ + +static int +send_trigger(unsigned int trigger) +{ + int error; + + error = auditon(A_SENDTRIGGER, &trigger, sizeof(trigger)); + if (error != 0) { + perror("Error sending trigger"); + return (-1); + } + + return (0); +} +#endif /* ! USE_MACH_IPC */ + static void usage(void) { @@ -88,11 +145,9 @@ main(int argc, char **argv) break; } } - if (auditon(A_SENDTRIGGER, &trigger, sizeof(trigger)) < 0) { - perror("Error sending trigger"); + if (send_trigger(trigger) < 0) exit(-1); - } else { - printf("Trigger sent.\n"); - exit (0); - } + + printf("Trigger sent.\n"); + exit (0); } Modified: head/contrib/openbsm/bin/auditd/Makefile.am ============================================================================== --- head/contrib/openbsm/bin/auditd/Makefile.am Tue Dec 2 22:45:01 2008 (r185572) +++ head/contrib/openbsm/bin/auditd/Makefile.am Tue Dec 2 23:26:43 2008 (r185573) @@ -1,10 +1,26 @@ # -# $P4: //depot/projects/trustedbsd/openbsm/bin/auditd/Makefile.am#1 $ +# $P4: //depot/projects/trustedbsd/openbsm/bin/auditd/Makefile.am#4 $ # -INCLUDES = -I$(top_srcdir) +if USE_NATIVE_INCLUDES +INCLUDES = -I$(top_builddir) -I$(top_srcdir) +else +INCLUDES = -I$(top_builddir) -I$(top_srcdir) -I$(top_srcdir)/sys +endif sbin_PROGRAMS = auditd -auditd_SOURCES = audit_warn.c auditd.c auditd_LDADD = $(top_builddir)/libbsm/libbsm.la man8_MANS = auditd.8 + +if USE_MACH_IPC +auditd_SOURCES = auditd_control_server.c audit_triggers_server.c audit_warn.c auditd.c +CLEANFILES = auditd_control_server.c auditd_control_server.h audit_triggers_server.c audit_triggers_server.h + +auditd_control_server.c: auditd_control.defs + $(MIG) -user /dev/null -header /dev/null -server auditd_control_server.c -sheader auditd_control_server.h $(top_srcdir)/bin/auditd/auditd_control.defs + +audit_triggers_server.c: audit_triggers.defs + $(MIG) -user /dev/null -header /dev/null -server audit_triggers_server.c -sheader audit_triggers_server.h $(top_srcdir)/bin/auditd/audit_triggers.defs +else +auditd_SOURCES = audit_warn.c auditd.c +endif Modified: head/contrib/openbsm/bin/auditd/Makefile.in ============================================================================== --- head/contrib/openbsm/bin/auditd/Makefile.in Tue Dec 2 22:45:01 2008 (r185572) +++ head/contrib/openbsm/bin/auditd/Makefile.in Tue Dec 2 23:26:43 2008 (r185573) @@ -15,7 +15,7 @@ @SET_MAKE@ # -# $P4: //depot/projects/trustedbsd/openbsm/bin/auditd/Makefile.in#4 $ +# $P4: //depot/projects/trustedbsd/openbsm/bin/auditd/Makefile.in#9 $ # VPATH = @srcdir@ @@ -49,7 +49,14 @@ CONFIG_CLEAN_FILES = am__installdirs = "$(DESTDIR)$(sbindir)" "$(DESTDIR)$(man8dir)" sbinPROGRAMS_INSTALL = $(INSTALL_PROGRAM) PROGRAMS = $(sbin_PROGRAMS) -am_auditd_OBJECTS = audit_warn.$(OBJEXT) auditd.$(OBJEXT) +am__auditd_SOURCES_DIST = audit_warn.c auditd.c \ + auditd_control_server.c audit_triggers_server.c +@USE_MACH_IPC_FALSE@am_auditd_OBJECTS = audit_warn.$(OBJEXT) \ +@USE_MACH_IPC_FALSE@ auditd.$(OBJEXT) +@USE_MACH_IPC_TRUE@am_auditd_OBJECTS = \ +@USE_MACH_IPC_TRUE@ auditd_control_server.$(OBJEXT) \ +@USE_MACH_IPC_TRUE@ audit_triggers_server.$(OBJEXT) \ +@USE_MACH_IPC_TRUE@ audit_warn.$(OBJEXT) auditd.$(OBJEXT) auditd_OBJECTS = $(am_auditd_OBJECTS) auditd_DEPENDENCIES = $(top_builddir)/libbsm/libbsm.la DEFAULT_INCLUDES = -I. -I$(top_builddir)/config@am__isrc@ @@ -65,7 +72,7 @@ LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLF --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \ $(LDFLAGS) -o $@ SOURCES = $(auditd_SOURCES) -DIST_SOURCES = $(auditd_SOURCES) +DIST_SOURCES = $(am__auditd_SOURCES_DIST) man8dir = $(mandir)/man8 NROFF = nroff MANS = $(man8_MANS) @@ -113,6 +120,7 @@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ +MIG = @MIG@ MKDIR_P = @MKDIR_P@ OBJEXT = @OBJEXT@ PACKAGE = @PACKAGE@ @@ -179,10 +187,13 @@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ -INCLUDES = -I$(top_srcdir) -auditd_SOURCES = audit_warn.c auditd.c +@USE_NATIVE_INCLUDES_FALSE@INCLUDES = -I$(top_builddir) -I$(top_srcdir) -I$(top_srcdir)/sys +@USE_NATIVE_INCLUDES_TRUE@INCLUDES = -I$(top_builddir) -I$(top_srcdir) auditd_LDADD = $(top_builddir)/libbsm/libbsm.la man8_MANS = auditd.8 +@USE_MACH_IPC_FALSE@auditd_SOURCES = audit_warn.c auditd.c +@USE_MACH_IPC_TRUE@auditd_SOURCES = auditd_control_server.c audit_triggers_server.c audit_warn.c auditd.c +@USE_MACH_IPC_TRUE@CLEANFILES = auditd_control_server.c auditd_control_server.h audit_triggers_server.c audit_triggers_server.h all: all-am .SUFFIXES: @@ -254,8 +265,10 @@ mostlyclean-compile: distclean-compile: -rm -f *.tab.c +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/audit_triggers_server.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/audit_warn.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/auditd.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/auditd_control_server.Po@am__quote@ .c.o: @am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @@ -427,6 +440,7 @@ install-strip: mostlyclean-generic: clean-generic: + -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) @@ -512,6 +526,12 @@ uninstall-man: uninstall-man8 tags uninstall uninstall-am uninstall-man uninstall-man8 \ *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@FreeBSD.ORG Wed Dec 3 01:48:19 2008 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 52E981065676; Wed, 3 Dec 2008 01:48: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 41CAB8FC1B; Wed, 3 Dec 2008 01:48: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 mB31mJ6v077416; Wed, 3 Dec 2008 01:48:19 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mB31mJJD077415; Wed, 3 Dec 2008 01:48:19 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <200812030148.mB31mJJD077415@svn.freebsd.org> From: Xin LI Date: Wed, 3 Dec 2008 01:48: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: r185574 - 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, 03 Dec 2008 01:48:19 -0000 Author: delphij Date: Wed Dec 3 01:48:19 2008 New Revision: 185574 URL: http://svn.freebsd.org/changeset/base/185574 Log: Update bce(4)'s hardware list to reflect the recent update to driver. MFC after: 3 days Modified: head/share/man/man4/bce.4 Modified: head/share/man/man4/bce.4 ============================================================================== --- head/share/man/man4/bce.4 Tue Dec 2 23:26:43 2008 (r185573) +++ head/share/man/man4/bce.4 Wed Dec 3 01:48:19 2008 (r185574) @@ -28,12 +28,12 @@ .\" .\" $FreeBSD$ .\" -.Dd June 24, 2007 +.Dd December 2, 2008 .Dt BCE 4 .Os .Sh NAME .Nm bce -.Nd "Broadcom NetXtreme II (BCM5706/BCM5708) PCI/PCIe Gigabit Ethernet adapter driver" +.Nd "Broadcom NetXtreme II (BCM5706/5708/5709/5716) PCI/PCIe Gigabit Ethernet adapter driver" .Sh SYNOPSIS To compile this driver into the kernel, place the following lines in your @@ -53,12 +53,13 @@ if_bce_load="YES" The .Nm driver supports Broadcom's NetXtreme II product family, including the -BCM5706 and BCM5708 Ethernet controllers. +BCM5706, BCM5708, BCM5709 and BCM5716 Ethernet controllers. .Pp The NetXtreme II product family is composed of various Converged NIC (or CNIC) Ethernet controllers which support a TCP Offload Engine (TOE), Remote DMA (RDMA), and iSCSI acceleration, in addition to standard L2 Ethernet traffic, all on the same controller. +.Pp The following features are supported in the .Nm driver under @@ -136,10 +137,26 @@ following: .Pp .Bl -bullet -compact .It +Broadcom NetXtreme II BCM5706 1000Base-SX +.It +Broadcom NetXtreme II BCM5706 1000Base-T +.It +Broadcom NetXtreme II BCM5708 1000Base-SX +.It +Broadcom NetXtreme II BCM5708 1000Base-T +.It +Broadcom NetXtreme II BCM5709 1000Base-SX +.It +Broadcom NetXtreme II BCM5709 1000Base-T +.It +Broadcom NetXtreme II BCM5716 1000Base-T +.It Dell PowerEdge 1950 integrated BCM5708 NIC .It Dell PowerEdge 2950 integrated BCM5708 NIC .It +HP NC370F Multifunction Gigabit Server Adapter +.It HP NC370T Multifunction Gigabit Server Adapter .It HP NC370i Multifunction Gigabit Server Adapter From owner-svn-src-head@FreeBSD.ORG Wed Dec 3 03:20:18 2008 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CE45D106564A; Wed, 3 Dec 2008 03:20:18 +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 BD7168FC2B; Wed, 3 Dec 2008 03:20:18 +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 mB33KInH079469; Wed, 3 Dec 2008 03:20:18 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mB33KIE6079468; Wed, 3 Dec 2008 03:20:18 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <200812030320.mB33KIE6079468@svn.freebsd.org> From: Pyun YongHyeon Date: Wed, 3 Dec 2008 03:20: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: r185575 - 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: Wed, 03 Dec 2008 03:20:18 -0000 Author: yongari Date: Wed Dec 3 03:20:18 2008 New Revision: 185575 URL: http://svn.freebsd.org/changeset/base/185575 Log: Update if_iqdrops instead of if_ierrors when m_devget(9) fails. Modified: head/sys/pci/if_rl.c Modified: head/sys/pci/if_rl.c ============================================================================== --- head/sys/pci/if_rl.c Wed Dec 3 01:48:19 2008 (r185574) +++ head/sys/pci/if_rl.c Wed Dec 3 03:20:18 2008 (r185575) @@ -1302,18 +1302,13 @@ rl_rxeof(struct rl_softc *sc) if (total_len > wrap) { m = m_devget(rxbufpos, total_len, RL_ETHER_ALIGN, ifp, NULL); - if (m == NULL) { - ifp->if_ierrors++; - } else { + if (m != NULL) m_copyback(m, wrap, total_len - wrap, sc->rl_cdata.rl_rx_buf); - } cur_rx = (total_len - wrap + ETHER_CRC_LEN); } else { m = m_devget(rxbufpos, total_len, RL_ETHER_ALIGN, ifp, NULL); - if (m == NULL) - ifp->if_ierrors++; cur_rx += total_len + 4 + ETHER_CRC_LEN; } @@ -1321,8 +1316,10 @@ rl_rxeof(struct rl_softc *sc) cur_rx = (cur_rx + 3) & ~3; CSR_WRITE_2(sc, RL_CURRXADDR, cur_rx - 16); - if (m == NULL) + if (m == NULL) { + ifp->if_iqdrops++; continue; + } ifp->if_ipackets++; RL_UNLOCK(sc); From owner-svn-src-head@FreeBSD.ORG Wed Dec 3 08:56:01 2008 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id EB3081065679; Wed, 3 Dec 2008 08:56:01 +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 D93958FC13; Wed, 3 Dec 2008 08:56:01 +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 mB38u1CY086150; Wed, 3 Dec 2008 08:56:01 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mB38u1SG086149; Wed, 3 Dec 2008 08:56:01 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <200812030856.mB38u1SG086149@svn.freebsd.org> From: Pyun YongHyeon Date: Wed, 3 Dec 2008 08:56: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: r185576 - 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: Wed, 03 Dec 2008 08:56:02 -0000 Author: yongari Date: Wed Dec 3 08:56:01 2008 New Revision: 185576 URL: http://svn.freebsd.org/changeset/base/185576 Log: Add some PHY magic to enable PHY hibernation and 1000baseT/10baseT power adjustment. This change is required to guarantee correct operation on certain switches. Submitted by: Jie Yang < Jie.Yang <> Atheros com > Modified: head/sys/dev/ale/if_ale.c Modified: head/sys/dev/ale/if_ale.c ============================================================================== --- head/sys/dev/ale/if_ale.c Wed Dec 3 03:20:18 2008 (r185575) +++ head/sys/dev/ale/if_ale.c Wed Dec 3 08:56:01 2008 (r185576) @@ -385,6 +385,39 @@ ale_phy_reset(struct ale_softc *sc) GPHY_CTRL_EXT_RESET | GPHY_CTRL_HIB_EN | GPHY_CTRL_HIB_PULSE | GPHY_CTRL_SEL_ANA_RESET | GPHY_CTRL_PHY_PLL_ON); DELAY(1000); + +#define ATPHY_DBG_ADDR 0x1D +#define ATPHY_DBG_DATA 0x1E + + /* Enable hibernation mode. */ + ale_miibus_writereg(sc->ale_dev, sc->ale_phyaddr, + ATPHY_DBG_ADDR, 0x0B); + ale_miibus_writereg(sc->ale_dev, sc->ale_phyaddr, + ATPHY_DBG_DATA, 0xBC00); + /* Set Class A/B for all modes. */ + ale_miibus_writereg(sc->ale_dev, sc->ale_phyaddr, + ATPHY_DBG_ADDR, 0x00); + ale_miibus_writereg(sc->ale_dev, sc->ale_phyaddr, + ATPHY_DBG_DATA, 0x02EF); + /* Enable 10BT power saving. */ + ale_miibus_writereg(sc->ale_dev, sc->ale_phyaddr, + ATPHY_DBG_ADDR, 0x12); + ale_miibus_writereg(sc->ale_dev, sc->ale_phyaddr, + ATPHY_DBG_DATA, 0x4C04); + /* Adjust 1000T power. */ + ale_miibus_writereg(sc->ale_dev, sc->ale_phyaddr, + ATPHY_DBG_ADDR, 0x04); + ale_miibus_writereg(sc->ale_dev, sc->ale_phyaddr, + ATPHY_DBG_ADDR, 0x8BBB); + /* 10BT center tap voltage. */ + ale_miibus_writereg(sc->ale_dev, sc->ale_phyaddr, + ATPHY_DBG_ADDR, 0x05); + ale_miibus_writereg(sc->ale_dev, sc->ale_phyaddr, + ATPHY_DBG_ADDR, 0x2C46); + +#undef ATPHY_DBG_ADDR +#undef ATPHY_DBG_DATA + DELAY(1000); } static int From owner-svn-src-head@FreeBSD.ORG Wed Dec 3 09:01:13 2008 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 495D81065670; Wed, 3 Dec 2008 09:01:13 +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 378558FC14; Wed, 3 Dec 2008 09:01:13 +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 mB391Dj7086296; Wed, 3 Dec 2008 09:01:13 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mB391DHK086295; Wed, 3 Dec 2008 09:01:13 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <200812030901.mB391DHK086295@svn.freebsd.org> From: Pyun YongHyeon Date: Wed, 3 Dec 2008 09:01: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: r185577 - 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: Wed, 03 Dec 2008 09:01:13 -0000 Author: yongari Date: Wed Dec 3 09:01:12 2008 New Revision: 185577 URL: http://svn.freebsd.org/changeset/base/185577 Log: AR8113 also need to set DMA read burst value. This should fix occasional DMA read error seen on AR8113. Submitted by: Jie Yang < Jie.Yang <> Atheros com > Modified: head/sys/dev/ale/if_ale.c Modified: head/sys/dev/ale/if_ale.c ============================================================================== --- head/sys/dev/ale/if_ale.c Wed Dec 3 08:56:01 2008 (r185576) +++ head/sys/dev/ale/if_ale.c Wed Dec 3 09:01:12 2008 (r185577) @@ -2786,10 +2786,8 @@ ale_init_locked(struct ale_softc *sc) TX_JUMBO_THRESH_UNIT_SHIFT); } /* Configure TxQ. */ - reg = 0; - if ((sc->ale_flags & ALE_FLAG_JUMBO) != 0) - reg = (128 << (sc->ale_dma_rd_burst >> DMA_CFG_RD_BURST_SHIFT)) - << TXQ_CFG_TX_FIFO_BURST_SHIFT; + reg = (128 << (sc->ale_dma_rd_burst >> DMA_CFG_RD_BURST_SHIFT)) + << TXQ_CFG_TX_FIFO_BURST_SHIFT; reg |= (TXQ_CFG_TPD_BURST_DEFAULT << TXQ_CFG_TPD_BURST_SHIFT) & TXQ_CFG_TPD_BURST_MASK; CSR_WRITE_4(sc, ALE_TXQ_CFG, reg | TXQ_CFG_ENHANCED_MODE | TXQ_CFG_ENB); From owner-svn-src-head@FreeBSD.ORG Wed Dec 3 14:53:59 2008 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 805B21065670; Wed, 3 Dec 2008 14:53: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 6CE738FC19; Wed, 3 Dec 2008 14:53: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 mB3ErxhE093694; Wed, 3 Dec 2008 14:53:59 GMT (envelope-from luigi@svn.freebsd.org) Received: (from luigi@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mB3Erx4I093690; Wed, 3 Dec 2008 14:53:59 GMT (envelope-from luigi@svn.freebsd.org) Message-Id: <200812031453.mB3Erx4I093690@svn.freebsd.org> From: Luigi Rizzo Date: Wed, 3 Dec 2008 14:53: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: r185579 - in head: sys/boot/i386/boot0 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: Wed, 03 Dec 2008 14:53:59 -0000 Author: luigi Date: Wed Dec 3 14:53:59 2008 New Revision: 185579 URL: http://svn.freebsd.org/changeset/base/185579 Log: Another, hopefully final set of changes to boot0 and boot0cfg. boot0.S changes: + import a patch from Christoph Mallon to rearrange the various print functions and save another couple of bytes; + implement the suggestion in PR 70531 to enable booting from any valid partition because even the extended partitions that were previously in our kill list may contain a valid boot loader. This simplifies the code and saves some bytes; + followwing up PR 127764, implement conditional code to preserve the 'Volume ID' which might be used by other OS (NT, XP, Vista) and is located at offset 0x1b8. This requires a relocation of the parameter block within the boot sector -- there is no other possible workaround. To address this, boot0cfg has been updated to handle both versions of the boot code; + slightly rearrange the strings printed in the menus to make the code buildable with all options. Given the tight memory budget, this means that with certain options we need to shrink or remove certain labels. and especially: make -DVOLUME_LABEL -DPXE the default options. This means that the newly built boot0 block will preserve the Volume ID, and has the (hidden) option F6 to boot from INT18/PXE. I think the extra functionality is well worth the change. The most visible difference here is that the 'Default: ' string now becomes 'Boot: ' (it can be reverted to the old value but then we need to nuke 1/2 partition name or entries to make up for the extra room). boot0cfg changes: + modify the code to recognise the new boot0 structure (with the relocated options block to make room for the Volume id). + add two options, '-i xxxx-xxxx' to set the volume ID, -e c to modify the character printed in case of bad input PR: 127764 70531 Submitted by: Christoph Mallon (portions) MFC after: 4 weeks Modified: head/sys/boot/i386/boot0/Makefile head/sys/boot/i386/boot0/boot0.S head/usr.sbin/boot0cfg/boot0cfg.8 head/usr.sbin/boot0cfg/boot0cfg.c Modified: head/sys/boot/i386/boot0/Makefile ============================================================================== --- head/sys/boot/i386/boot0/Makefile Wed Dec 3 11:48:20 2008 (r185578) +++ head/sys/boot/i386/boot0/Makefile Wed Dec 3 14:53:59 2008 (r185579) @@ -9,12 +9,14 @@ SRCS= ${PROG}.S # Additional options that you can specify with make OPTS="..." # (these only apply to boot0.S) # +# -DVOLUME_SERIAL support volume serial number (NT, XP, Vista) # -DSIO do I/O using COM1: # -DPXE fallback to INT18/PXE with F6 # -DCHECK_DRIVE enable checking drive number # -DONLY_F_KEYS accept only Fx keys in console # -DTEST print drive number on entry # +OPTS ?= -DVOLUME_SERIAL -DPXE CFLAGS += ${OPTS} # Flags used in the boot0.S code: Modified: head/sys/boot/i386/boot0/boot0.S ============================================================================== --- head/sys/boot/i386/boot0/boot0.S Wed Dec 3 11:48:20 2008 (r185578) +++ head/sys/boot/i386/boot0/boot0.S Wed Dec 3 14:53:59 2008 (r185579) @@ -30,10 +30,16 @@ #ifdef ONLY_F_KEYS /* Only F1..F6, no digits on console */ #endif -#ifdef TEST /* enable some test code */ -#ifndef ONLY_F_KEYS -#define ONLY_F_KEYS /* make room for the test code */ +#ifdef VOLUME_SERIAL /* support Volume serial number */ +#define B0_BASE 0x1ae /* move the internal data area */ +#define SAVE_MEMORY +#else +#define B0_BASE 0x1b2 #endif + +#ifdef TEST /* enable some test code */ +#define SAVE_MEMORY +#define SAVE_MORE_MEMORY #endif /* @@ -118,7 +124,7 @@ * to change the value passed to the linker in the Makefile * PRT_OFF is the location of the partition table (from the MBR standard). * B0_OFF is the location of the data area, known to boot0cfg so - * it cannot be changed. + * it cannot be changed. Computed as a negative offset from 0x200 * MAGIC is the signature of a boot block. */ @@ -127,7 +133,7 @@ .set LOAD,0x7c00 # Load address .set PRT_OFF,0x1be # Partition table - .set B0_OFF,0x1b2 # Offset of boot0 data + .set B0_OFF,(B0_BASE-0x200) # Offset of boot0 data .set MAGIC,0xaa55 # Magic: bootable @@ -144,15 +150,16 @@ * We need to define them as constant as the assembler cannot * compute them in its single pass. */ - .set _NXTDRV, -0x48 # Next drive - .set _OPT, -0x47 # Default option - .set _SETDRV, -0x46 # Drive to force - .set _FLAGS, -0x45 # Flags + .set _NXTDRV, B0_OFF+6 # Next drive + .set _OPT, B0_OFF+7 # Default option + .set _SETDRV, B0_OFF+8 # Drive to force + .set _FLAGS, B0_OFF+9 # Flags .set SETDRV, 0x20 # the 'setdrv' flag .set NOUPDATE, 0x40 # the 'noupdate' flag .set USEPACKET, 0x80 # the 'packet' flag - .set _TICKS, -0x44 # Timeout ticks - .set _FAKE,0x0 # Fake partition table + + /* ticks is at a fixed position */ + .set _TICKS, (PRT_OFF - 0x200 - 2) # Timeout ticks .set _MNUOPT, 0x10 # Saved menu entries .set TLEN, (desc_ofs - bootable_ids) # size of bootable ids @@ -260,26 +267,16 @@ save_curdrive: movb %dl, (%bp) # Save read_entry: movb %ch,-0x4(%bx) # Zero active flag (ch == 0) btw %dx,_FLAGS(%bp) # Entry enabled? jnc next_entry # No - /* - * Lookup type in the 'non_bootable_ids' table, skip matching entries. - * This is implemented is by setting %di to the start of the - * exclude table, and %cl to the length of the table itself. After the - * 'repne scasb' the zero flag is set if we found a match. - * If not, %di points to the beginning of the 'valid' types, - * which is what we need for the next check. - */ movb (%bx),%al # Load type - movw $non_bootable_ids,%di # Lookup tables - movb $(bootable_ids-non_bootable_ids),%cl # length - repne # Exclude - scasb # partition? - je next_entry # Yes, ignore it + test %al, %al # skip empty partition + jz next_entry /* - * Now scan the table of bootable ids, which starts at %di and has + * Scan the table of bootable ids, which starts at %di and has * length TLEN. On a match, %di points to the element following the * match; the corresponding offset to the description is $(TLEN-1) * bytes ahead. If we don't find a match, we hit the 'unknown' entry. */ + movw $bootable_ids,%di # Lookup tables movb $(TLEN),%cl # Number of entries repne # Locate scasb # type @@ -500,19 +497,10 @@ check_selection: * the string at %si * putx: print the option in %dl followed by the string at %di * also record the drive as valid. - * puts: print the string at %si followed by a crlf * putn: print a crlf * putstr: print the string at %si * putchr: print the char in al */ -putkey: -#ifndef SIO - movb $'F',%al # Display - callw putchr # 'F' -#endif - movb $'1',%al # Prepare - addb %dl,%al # digit - jmp putstr.1 # Display the rest /* * Display the option and record the drive as valid in the options. @@ -523,17 +511,24 @@ putx: btsw %dx,_MNUOPT(%bp) # Enable m movw $item,%si # Display callw putkey # key movw %di,%si # Display the rest - -puts: callw putstr # Display string + callw putstr # Display string putn: movw $crlf,%si # To next line + jmp putstr +putkey: +#ifndef SIO + movb $'F',%al # Display + callw putchr # 'F' +#endif + movb $'1',%al # Prepare + addb %dl,%al # digit + +putstr.1: callw putchr # Display char putstr: lodsb # Get byte testb $0x80,%al # End of string? - jnz putstr.2 # Yes -putstr.1: callw putchr # Display char - jmp putstr # Continue -putstr.2: andb $~0x80,%al # Clear MSB + jz putstr.1 # No + andb $~0x80,%al # Clear MSB then print last putchr: #ifndef SIO @@ -601,38 +596,45 @@ crlf: .ascii "\r"; .byte '\n'|0x80 /* Partition type tables */ -non_bootable_ids: - /* - * These entries identify invalid or NON BOOT types and partitions. - * 0: empty, 5: DOS3 ext. partition, 0xf: WIN95 ext partition - */ - .byte 0x0, 0x5, 0xf bootable_ids: /* - * These values indicate bootable types we know the names of. - * 1: FAT12, 4: FAT16 <32M, 6: FAT16 > 32M, 7: NTFS - * 0xb: FAT32, 0xc: FAT32-LBA, 0xe: FAT16-LBA, - * 0x83: linux, 0xa5: FreeBSD, 0xa6: netbsd, 0xa9:openbsd - */ - .byte 0x1, 0x6, 0x7, 0xb, 0xc, 0xe, 0x83 - .byte 0xa5, 0xa6, 0xa9, 0x4 + * These values indicate bootable types we know about. + * Corresponding descriptions are at desc_ofs: + * Entries don't need to be sorted. + */ + .byte 0x1, 0x6, 0x7, 0xb, 0xc +#ifndef SAVE_MEMORY + .byte 0xe +#endif + .byte 0x83, 0xa5, 0xa6, 0xa9, 0x4 +#ifndef SAVE_MORE_MEMORY + .byte 0x5, 0xf +#endif + desc_ofs: /* * Offsets that match the known types above, used to point to the * actual partition name. The last entry must point to os_misc, * which is used for non-matching names. */ - .byte os_dos-. # 1, DOS - .byte os_dos-. # 6, DOS/WIN - .byte os_win-. # 7, Windows - .byte os_win-. # 11, Windows - .byte os_win-. # 12, Windows - .byte os_win-. # 14, Windows + .byte os_dos-. # 1, FAT12 DOS + .byte os_dos-. # 6, FAT16 <32M, DOS/WIN + .byte os_win-. # 7, FAT16 >=32M Windows + .byte os_win-. # 11, FAT32 + .byte os_win-. # 12, FAT32-LBA +#ifndef SAVE_MEMORY + .byte os_win-. # 14, FAT16-LBA +#endif .byte os_linux-. # 131, Linux .byte os_freebsd-. # 165, FreeBSD .byte os_bsd-. # 166, OpenBSD .byte os_bsd-. # 169, NetBSD - .byte os_dos-. # 4, DOS + .byte os_dos-. # 4, FAT16 < 32M +#ifndef SAVE_MORE_MEMORY + .byte os_ext-. # 5, DOS Ext + .byte os_ext-. # 15, DOS Ext-LBA +#endif + .byte os_misc-. # Unknown /* @@ -641,15 +643,18 @@ desc_ofs: */ os_misc: .byte '?'|0x80 os_dos: -#if !defined(TEST) /* DOS string only if room */ +#ifndef SAVE_MEMORY /* DOS string only if room */ .ascii "DO"; .byte 'S'|0x80 #endif os_win: .ascii "WI"; .byte 'N'|0x80 os_linux: .ascii "Linu"; .byte 'x'|0x80 os_freebsd: .ascii "Free" os_bsd: .ascii "BS"; .byte 'D'|0x80 +#ifndef SAVE_MORE_MEMORY +os_ext: .ascii "EX"; .byte 'T'|0x80 +#endif - .org B0_OFF,0x90 + .org (0x200 + B0_OFF),0x90 /* * The boot0 version 1.0 parameter table. * Do not move it nor change the "Drive " string, boot0cfg @@ -663,6 +668,9 @@ nxtdrv: .byte 0x0 # Next drive number opt: .byte 0x0 # Option setdrv_num: .byte 0x80 # Drive to force flags: .byte FLAGS # Flags +#ifdef VOLUME_SERIAL + .byte 0xa8,0xa8,0xa8,0xa8 # Volume Serial Number +#endif ticks: .word TICKS # Delay .org PRT_OFF Modified: head/usr.sbin/boot0cfg/boot0cfg.8 ============================================================================== --- head/usr.sbin/boot0cfg/boot0cfg.8 Wed Dec 3 11:48:20 2008 (r185578) +++ head/usr.sbin/boot0cfg/boot0cfg.8 Wed Dec 3 14:53:59 2008 (r185579) @@ -35,7 +35,9 @@ .Op Fl Bv .Op Fl b Ar boot0 .Op Fl d Ar drive +.Op Fl e Ar bell character .Op Fl f Ar file +.Op Fl i Ar volume-id .Op Fl m Ar mask .Op Fl o Ar options .Op Fl s Ar slice @@ -96,10 +98,17 @@ which contains the specified Typically this will be 0x80 for the first hard drive, 0x81 for the second hard drive, and so on; however any integer between 0 and 0xff is acceptable here. +.It Fl e Ar bell character +Set the character to be printed in case of input error. .It Fl f Ar file Specify that a backup copy of the preexisting MBR should be written to .Ar file . This file is created if it does not exist, and replaced if it does. +.It Fl i Ar volume-id +Specifies a volume-id (in the form XXXX-XXXX) to be saved at location +0x1b8 in the MBR. This information is sometimes used by NT, XP and Vista +to identify the disk drive. The option is only compatible with version 2.00 +of the 512-byte boot block. .It Fl m Ar mask Specify slices to be enabled/disabled, where .Ar mask Modified: head/usr.sbin/boot0cfg/boot0cfg.c ============================================================================== --- head/usr.sbin/boot0cfg/boot0cfg.c Wed Dec 3 11:48:20 2008 (r185578) +++ head/usr.sbin/boot0cfg/boot0cfg.c Wed Dec 3 14:53:59 2008 (r185579) @@ -1,4 +1,5 @@ /* + * Copyright (c) 2008 Luigi Rizzo * Copyright (c) 1999 Robert Nordier * All rights reserved. * @@ -44,13 +45,34 @@ __FBSDID("$FreeBSD$"); #define MBRSIZE 512 /* master boot record size */ -#define OFF_VERSION 0x1b0 /* offset: version number */ -#define OFF_OPT 0x1b9 /* offset: default boot option */ -#define OFF_DRIVE 0x1ba /* offset: setdrv drive */ -#define OFF_FLAGS 0x1bb /* offset: option flags */ -#define OFF_TICKS 0x1bc /* offset: clock ticks */ +#define OFF_VERSION 0x1b0 /* offset: version number, only boot0version */ +#define OFF_SERIAL 0x1b8 /* offset: volume serial number */ #define OFF_PTBL 0x1be /* offset: partition table */ #define OFF_MAGIC 0x1fe /* offset: magic number */ +/* + * Offsets to the parameters of the 512-byte boot block. + * For historical reasons they are set as macros + */ +struct opt_offsets { + int opt; + int drive; + int flags; + int ticks; +}; + +struct opt_offsets b0_ofs[] = { + { 0x0, 0x0, 0x0, 0x0 }, /* no boot block */ + { 0x1b9, 0x1ba, 0x1bb, 0x1bc }, /* original block */ + { 0x1b5, 0x1b6, 0x1b7, 0x1bc }, /* NT_SERIAL block */ +}; + +int b0_ver; /* boot block version set by boot0bs */ + +#define OFF_OPT (b0_ofs[b0_ver].opt) /* default boot option */ +#define OFF_DRIVE (b0_ofs[b0_ver].drive) /* setdrv drive */ +#define OFF_FLAGS (b0_ofs[b0_ver].flags) /* option flags */ +#define OFF_TICKS (b0_ofs[b0_ver].ticks) /* clock ticks */ + #define cv2(p) ((p)[0] | (p)[1] << 010) @@ -81,8 +103,12 @@ static int boot0version(const u_int8_t * static int boot0bs(const u_int8_t *); static void stropt(const char *, int *, int *); static int argtoi(const char *, int, int, int); +static int set_bell(u_int8_t *, int, int); static void usage(void); +unsigned vol_id[5]; /* 4 plus 1 for flag */ + +int v_flag; /* * Boot manager installation/configuration utility. */ @@ -93,9 +119,9 @@ main(int argc, char *argv[]) int boot0_size, mbr_size; const char *bpath, *fpath; char *disk; - int B_flag, v_flag, o_flag; + int B_flag, o_flag; int d_arg, m_arg, s_arg, t_arg; - int o_and, o_or; + int o_and, o_or, o_e = -1; int up, c; bpath = "/boot/boot0"; @@ -104,7 +130,7 @@ main(int argc, char *argv[]) d_arg = m_arg = s_arg = t_arg = -1; o_and = 0xff; o_or = 0; - while ((c = getopt(argc, argv, "Bvb:d:f:m:o:s:t:")) != -1) + while ((c = getopt(argc, argv, "Bvb:d:e:f:i:m:o:s:t:")) != -1) switch (c) { case 'B': B_flag = 1; @@ -118,9 +144,22 @@ main(int argc, char *argv[]) case 'd': d_arg = argtoi(optarg, 0, 0xff, 'd'); break; + case 'e': + if (optarg[0] == '0' && optarg[1] == 'x') + sscanf(optarg, "0x%02x", &o_e); + else + o_e = optarg[0]; + break; case 'f': fpath = optarg; break; + case 'i': + if (sscanf(optarg, "%02x%02x-%02x%02x", + vol_id, vol_id+1, vol_id+2, vol_id+3) == 4) + vol_id[4] = 1; + else + errx(1, "bad argument %s", optarg); + break; case 'm': m_arg = argtoi(optarg, 0, 0xf, 'm'); break; @@ -147,7 +186,10 @@ main(int argc, char *argv[]) up = B_flag || d_arg != -1 || m_arg != -1 || o_flag || s_arg != -1 || t_arg != -1; - /* open the disk and read in the existing mbr */ + /* open the disk and read in the existing mbr. Either here or + * when reading the block from disk, we do check for the version + * and abort if a suitable block is not found. + */ mbr_size = read_mbr(disk, &mbr, !B_flag); /* save the existing MBR if we are asked to do so */ @@ -164,6 +206,8 @@ main(int argc, char *argv[]) boot0_size = read_mbr(bpath, &boot0, 1); memcpy(boot0 + OFF_PTBL, mbr + OFF_PTBL, sizeof(struct dos_partition) * NDOSPART); + if (b0_ver == 2) /* volume serial number support */ + memcpy(boot0 + OFF_SERIAL, mbr + OFF_SERIAL, 4); } else { boot0 = mbr; boot0_size = mbr_size; @@ -191,6 +235,19 @@ main(int argc, char *argv[]) if (t_arg != -1) mk2(boot0 + OFF_TICKS, t_arg); + /* set the bell char */ + if (o_e != -1 && set_bell(boot0, o_e, 0) != -1) + up = 1; + + if (vol_id[4]) { + if (b0_ver != 2) + errx(1, "incompatible boot block, cannot set volume ID"); + boot0[OFF_SERIAL] = vol_id[0]; + boot0[OFF_SERIAL+1] = vol_id[1]; + boot0[OFF_SERIAL+2] = vol_id[2]; + boot0[OFF_SERIAL+3] = vol_id[3]; + up = 1; /* force update */ + } /* write the MBR back to disk */ if (up) write_mbr(disk, 0, boot0, boot0_size); @@ -208,6 +265,36 @@ main(int argc, char *argv[]) return 0; } +/* get or set the 'bell' character to be used in case of errors. + * Lookup for a certain code sequence, return -1 if not found. + */ +static int +set_bell(u_int8_t *mbr, int new_bell, int report) +{ + /* lookup sequence: 0x100 means skip, 0x200 means done */ + static unsigned seq[] = + { 0xb0, 0x100, 0xe8, 0x100, 0x100, 0x30, 0xe4, 0x200 }; + int ofs, i, c; + for (ofs = 0x60; ofs < 0x180; ofs++) { /* search range */ + if (mbr[ofs] != seq[0]) /* search initial pattern */ + continue; + for (i=0;; i++) { + if (seq[i] == 0x200) { /* found */ + c = mbr[ofs+1]; + if (!report) + mbr[ofs+1] = c = new_bell; + else + printf(" bell=%c (0x%x)", + (c >= ' ' && c < 0x7f) ? c : ' ', c); + return c; + } + if (seq[i] != 0x100 && seq[i] != mbr[ofs+i]) + break; + } + } + warn("bell not found"); + return -1; +} /* * Read in the MBR of the disk. If it is boot0, then use the version to * read in all of it if necessary. Use pointers to return a malloc'd @@ -218,6 +305,7 @@ read_mbr(const char *disk, u_int8_t **mb { u_int8_t buf[MBRSIZE]; int mbr_size, fd; + int ver; ssize_t n; if ((fd = open(disk, O_RDONLY)) == -1) @@ -229,7 +317,7 @@ read_mbr(const char *disk, u_int8_t **mb if (cv2(buf + OFF_MAGIC) != 0xaa55) errx(1, "%s: bad magic", disk); - if (!boot0bs(buf)) { + if (! (ver = boot0bs(buf))) { if (check_version) errx(1, "%s: unknown or incompatible boot code", disk); } else if (boot0version(buf) == 0x101) { @@ -338,9 +426,11 @@ display_mbr(u_int8_t *mbr) part[i].dp_size); printf("\n"); version = boot0version(mbr); - printf("version=%d.%d drive=0x%x mask=0x%x ticks=%u\noptions=", + printf("version=%d.%d drive=0x%x mask=0x%x ticks=%u", version >> 8, version & 0xff, mbr[OFF_DRIVE], mbr[OFF_FLAGS] & 0xf, cv2(mbr + OFF_TICKS)); + set_bell(mbr, 0, 1); + printf("\noptions="); for (i = 0; i < nopt; i++) { if (i) printf(","); @@ -349,6 +439,10 @@ display_mbr(u_int8_t *mbr) printf("%s", opttbl[i].tok); } printf("\n"); + if (b0_ver == 2) + printf("volume serial ID %02x%02x-%02x%02x\n", + mbr[OFF_SERIAL], mbr[OFF_SERIAL+1], + mbr[OFF_SERIAL+2], mbr[OFF_SERIAL+3]); printf("default_selection=F%d (", mbr[OFF_OPT] + 1); if (mbr[OFF_OPT] < 4) printf("Slice %d", mbr[OFF_OPT] + 1); @@ -364,16 +458,27 @@ display_mbr(u_int8_t *mbr) static int boot0version(const u_int8_t *bs) { - static u_int8_t idold[] = {0xfe, 0x45, 0xf2, 0xe9, 0x00, 0x8a}; - /* Check for old version, and return 0x100 if found. */ - if (memcmp(bs + 0x1c, idold, sizeof(idold)) == 0) - return 0x100; + int v = boot0bs(bs); + if (v != 0) + return v << 8; /* We have a newer boot0, so extract the version number and return it. */ return *(const int *)(bs + OFF_VERSION) & 0xffff; } +/* descriptor of a pattern to match. + * Start from the first entry trying to match the chunk of bytes, + * if you hit an entry with len=0 terminate the search and report + * off as the version. Otherwise skip to the next block after len=0 + * An entry with len=0, off=0 is the end marker. + */ +struct byte_pattern { + unsigned off; + unsigned len; + u_int8_t *key; +}; + /* * Decide if we have valid boot0 boot code by looking for * characteristic byte sequences at fixed offsets. @@ -381,23 +486,32 @@ boot0version(const u_int8_t *bs) static int boot0bs(const u_int8_t *bs) { + /* the initial code sequence */ static u_int8_t id0[] = {0xfc, 0x31, 0xc0, 0x8e, 0xc0, 0x8e, 0xd8, 0x8e, 0xd0, 0xbc, 0x00, 0x7c }; + /* the drive id */ static u_int8_t id1[] = {'D', 'r', 'i', 'v', 'e', ' '}; - static struct { - unsigned off; - unsigned len; - u_int8_t *key; - } ident[2] = { + static struct byte_pattern patterns[] = { {0x0, sizeof(id0), id0}, - {0x1b2, sizeof(id1), id1} + {0x1b2, sizeof(id1), id1}, + {1, 0, NULL}, + {0x0, sizeof(id0), id0}, /* version with NT support */ + {0x1ae, sizeof(id1), id1}, + {2, 0, NULL}, + {0, 0, NULL}, }; - unsigned int i; + struct byte_pattern *p = patterns; - for (i = 0; i < sizeof(ident) / sizeof(ident[0]); i++) - if (memcmp(bs + ident[i].off, ident[i].key, ident[i].len)) - return 0; - return 1; + for (; p->off || p->len; p++) { + if (p->len == 0) + break; + if (!memcmp(bs + p->off, p->key, p->len)) /* match */ + continue; + while (p->len) /* skip to next block */ + p++; + } + b0_ver = p->off; /* XXX ugly side effect */ + return p->off; } /* From owner-svn-src-head@FreeBSD.ORG Wed Dec 3 15:23:09 2008 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id F2AB5106564A; Wed, 3 Dec 2008 15:23:08 +0000 (UTC) (envelope-from jkoshy@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E1D368FC16; Wed, 3 Dec 2008 15:23:08 +0000 (UTC) (envelope-from jkoshy@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mB3FN8hE094397; Wed, 3 Dec 2008 15:23:08 GMT (envelope-from jkoshy@svn.freebsd.org) Received: (from jkoshy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mB3FN8w5094396; Wed, 3 Dec 2008 15:23:08 GMT (envelope-from jkoshy@svn.freebsd.org) Message-Id: <200812031523.mB3FN8w5094396@svn.freebsd.org> From: Joseph Koshy Date: Wed, 3 Dec 2008 15:23: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: r185582 - head/sys/dev/hwpmc X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 03 Dec 2008 15:23:09 -0000 Author: jkoshy Date: Wed Dec 3 15:23:08 2008 New Revision: 185582 URL: http://svn.freebsd.org/changeset/base/185582 Log: Add aliases that map architectural event names to fixed function counters. Modified: head/sys/dev/hwpmc/pmc_events.h Modified: head/sys/dev/hwpmc/pmc_events.h ============================================================================== --- head/sys/dev/hwpmc/pmc_events.h Wed Dec 3 15:10:31 2008 (r185581) +++ head/sys/dev/hwpmc/pmc_events.h Wed Dec 3 15:23:08 2008 (r185582) @@ -426,6 +426,11 @@ __PMC_EV(IAF, CPU_CLK_UNHALTED_REF) #define PMC_EV_IAF_FIRST PMC_EV_IAF_INSTR_RETIRED_ANY #define PMC_EV_IAF_LAST PMC_EV_IAF_CPU_CLK_UNHALTED_REF +#define __PMC_EV_ALIAS_IAF() \ +__PMC_EV_ALIAS("instruction-retired", IAF_INSTR_RETIRED_ANY) \ +__PMC_EV_ALIAS("unhalted-core-cycles", IAF_CPU_CLK_UNHALTED_CORE) \ +__PMC_EV_ALIAS("unhalted-reference-cycles", IAF_CPU_CLK_UNHALTED_REF) + /* * Events supported by programmable function counters present in * Intel Atom, Core and Core2 CPUs, from the "Intel 64 and IA-32 From owner-svn-src-head@FreeBSD.ORG Wed Dec 3 15:54:36 2008 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 556DE1065675; Wed, 3 Dec 2008 15:54:36 +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 448578FC12; Wed, 3 Dec 2008 15:54:36 +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 mB3FsaoJ095030; Wed, 3 Dec 2008 15:54:36 GMT (envelope-from bz@svn.freebsd.org) Received: (from bz@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mB3Fsa7A095029; Wed, 3 Dec 2008 15:54:36 GMT (envelope-from bz@svn.freebsd.org) Message-Id: <200812031554.mB3Fsa7A095029@svn.freebsd.org> From: "Bjoern A. Zeeb" Date: Wed, 3 Dec 2008 15:54: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: r185583 - head/sys/kern X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 03 Dec 2008 15:54:36 -0000 Author: bz Date: Wed Dec 3 15:54:35 2008 New Revision: 185583 URL: http://svn.freebsd.org/changeset/base/185583 Log: Fix a credential reference leak. [1] Close subtle but relatively unlikely race conditions when propagating the vnode write error to other active sessions tracing to the same vnode, without holding a reference on the vnode anymore. [2] PR: kern/126368 [1] Submitted by: rwatson [2] Reviewed by: kib, rwatson MFC after: 4 weeks Modified: head/sys/kern/kern_ktrace.c Modified: head/sys/kern/kern_ktrace.c ============================================================================== --- head/sys/kern/kern_ktrace.c Wed Dec 3 15:23:08 2008 (r185582) +++ head/sys/kern/kern_ktrace.c Wed Dec 3 15:54:35 2008 (r185583) @@ -907,12 +907,7 @@ ktr_writerequest(struct thread *td, stru */ mtx_lock(&ktrace_mtx); vp = td->td_proc->p_tracevp; - if (vp != NULL) - VREF(vp); cred = td->td_proc->p_tracecred; - if (cred != NULL) - crhold(cred); - mtx_unlock(&ktrace_mtx); /* * If vp is NULL, the vp has been cleared out from under this @@ -921,9 +916,13 @@ ktr_writerequest(struct thread *td, stru */ if (vp == NULL) { KASSERT(cred == NULL, ("ktr_writerequest: cred != NULL")); + mtx_unlock(&ktrace_mtx); return; } + VREF(vp); KASSERT(cred != NULL, ("ktr_writerequest: cred == NULL")); + crhold(cred); + mtx_unlock(&ktrace_mtx); kth = &req->ktr_header; datalen = data_lengths[(u_short)kth->ktr_type & ~KTR_DROP]; @@ -963,18 +962,26 @@ ktr_writerequest(struct thread *td, stru error = VOP_WRITE(vp, &auio, IO_UNIT | IO_APPEND, cred); VOP_UNLOCK(vp, 0); vn_finished_write(mp); - vrele(vp); - VFS_UNLOCK_GIANT(vfslocked); - if (!error) + crfree(cred); + if (!error) { + vrele(vp); + VFS_UNLOCK_GIANT(vfslocked); return; + } + VFS_UNLOCK_GIANT(vfslocked); + /* * If error encountered, give up tracing on this vnode. We defer * all the vrele()'s on the vnode until after we are finished walking * the various lists to avoid needlessly holding locks. + * NB: at this point we still hold the vnode reference that must + * not go away as we need the valid vnode to compare with. Thus let + * vrele_count start at 1 and the reference will be freed + * by the loop at the end after our last use of vp. */ log(LOG_NOTICE, "ktrace write failed, errno %d, tracing stopped\n", error); - vrele_count = 0; + vrele_count = 1; /* * First, clear this vnode from being used by any processes in the * system. From owner-svn-src-head@FreeBSD.ORG Wed Dec 3 16:29:12 2008 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CE59A1065676; Wed, 3 Dec 2008 16:29:12 +0000 (UTC) (envelope-from ambrisko@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id BB0BF8FC1F; Wed, 3 Dec 2008 16:29:12 +0000 (UTC) (envelope-from ambrisko@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mB3GTCDq095802; Wed, 3 Dec 2008 16:29:12 GMT (envelope-from ambrisko@svn.freebsd.org) Received: (from ambrisko@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mB3GTCLU095801; Wed, 3 Dec 2008 16:29:12 GMT (envelope-from ambrisko@svn.freebsd.org) Message-Id: <200812031629.mB3GTCLU095801@svn.freebsd.org> From: Doug Ambrisko Date: Wed, 3 Dec 2008 16:29: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: r185584 - head/sys/dev/mfi X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 03 Dec 2008 16:29:12 -0000 Author: ambrisko Date: Wed Dec 3 16:29:12 2008 New Revision: 185584 URL: http://svn.freebsd.org/changeset/base/185584 Log: Change new card identification names. Submitted by: LSI MFC after: 3 days Modified: head/sys/dev/mfi/mfi_pci.c Modified: head/sys/dev/mfi/mfi_pci.c ============================================================================== --- head/sys/dev/mfi/mfi_pci.c Wed Dec 3 15:54:35 2008 (r185583) +++ head/sys/dev/mfi/mfi_pci.c Wed Dec 3 16:29:12 2008 (r185584) @@ -119,10 +119,10 @@ struct mfi_ident { {0x1028, 0x0015, 0xffff, 0xffff, MFI_FLAGS_1064R, "Dell PERC 5/i"}, {0x1000, 0x0060, 0x1028, 0xffff, MFI_FLAGS_1078, "Dell PERC 6"}, {0x1000, 0x0060, 0xffff, 0xffff, MFI_FLAGS_1078, "LSI MegaSAS 1078"}, - {0x1000, 0x0079, 0x1028, 0x1f15, MFI_FLAGS_GEN2, "Dell PERC 607E Adapter"}, - {0x1000, 0x0079, 0x1028, 0x1f16, MFI_FLAGS_GEN2, "Dell PERC 607I Adapter"}, - {0x1000, 0x0079, 0x1028, 0x1f17, MFI_FLAGS_GEN2, "Dell PERC 607I Integrated"}, - {0x1000, 0x0079, 0x1028, 0x1f18, MFI_FLAGS_GEN2, "Dell PERC 607I Modular"}, + {0x1000, 0x0079, 0x1028, 0x1f15, MFI_FLAGS_GEN2, "Dell PERC H800 Adapter"}, + {0x1000, 0x0079, 0x1028, 0x1f16, MFI_FLAGS_GEN2, "Dell PERC H700 Adapter"}, + {0x1000, 0x0079, 0x1028, 0x1f17, MFI_FLAGS_GEN2, "Dell PERC H700 Integrated"}, + {0x1000, 0x0079, 0x1028, 0x1f18, MFI_FLAGS_GEN2, "Dell PERC H700 Modular"}, {0x1000, 0x0078, 0xffff, 0xffff, MFI_FLAGS_GEN2, "LSI MegaSAS Gen2"}, {0x1000, 0x0079, 0xffff, 0xffff, MFI_FLAGS_GEN2, "LSI MegaSAS Gen2"}, {0x1000, 0x007c, 0xffff, 0xffff, MFI_FLAGS_1078, "LSI MegaSAS 1078"}, From owner-svn-src-head@FreeBSD.ORG Wed Dec 3 17:30:36 2008 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CB57D1065675; Wed, 3 Dec 2008 17:30:36 +0000 (UTC) (envelope-from jkoshy@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id BA7978FC21; Wed, 3 Dec 2008 17:30:36 +0000 (UTC) (envelope-from jkoshy@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mB3HUaY3096971; Wed, 3 Dec 2008 17:30:36 GMT (envelope-from jkoshy@svn.freebsd.org) Received: (from jkoshy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mB3HUabM096968; Wed, 3 Dec 2008 17:30:36 GMT (envelope-from jkoshy@svn.freebsd.org) Message-Id: <200812031730.mB3HUabM096968@svn.freebsd.org> From: Joseph Koshy Date: Wed, 3 Dec 2008 17: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: r185585 - in head: lib/libpmc sys/dev/hwpmc X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 03 Dec 2008 17:30:36 -0000 Author: jkoshy Date: Wed Dec 3 17:30:36 2008 New Revision: 185585 URL: http://svn.freebsd.org/changeset/base/185585 Log: Fixes for Core2 Extreme support. Submitted by: "Artem Belevich" Modified: head/lib/libpmc/libpmc.c head/sys/dev/hwpmc/hwpmc_core.c head/sys/dev/hwpmc/hwpmc_intel.c Modified: head/lib/libpmc/libpmc.c ============================================================================== --- head/lib/libpmc/libpmc.c Wed Dec 3 16:29:12 2008 (r185584) +++ head/lib/libpmc/libpmc.c Wed Dec 3 17:30:36 2008 (r185585) @@ -603,7 +603,8 @@ iap_allocate_pmc(enum pmc_event pe, char if (n != 1) return (-1); } else if (cpu_info.pm_cputype == PMC_CPU_INTEL_ATOM || - cpu_info.pm_cputype == PMC_CPU_INTEL_CORE2) { + cpu_info.pm_cputype == PMC_CPU_INTEL_CORE2 || + cpu_info.pm_cputype == PMC_CPU_INTEL_CORE2EXTREME) { if (KWMATCH(p, IAP_KW_SNOOPRESPONSE)) { n = pmc_parse_mask(iap_snoopresponse_mask, p, &evmask); @@ -2273,6 +2274,7 @@ pmc_event_names_of_class(enum pmc_class count = PMC_EVENT_TABLE_SIZE(core); break; case PMC_CPU_INTEL_CORE2: + case PMC_CPU_INTEL_CORE2EXTREME: ev = core2_event_table; count = PMC_EVENT_TABLE_SIZE(core2); break; @@ -2455,6 +2457,7 @@ pmc_init(void) pmc_class_table[n] = &core_class_table_descr; break; case PMC_CPU_INTEL_CORE2: + case PMC_CPU_INTEL_CORE2EXTREME: PMC_MDEP_INIT(core2); pmc_class_table[n++] = &iaf_class_table_descr; pmc_class_table[n] = &core2_class_table_descr; @@ -2553,6 +2556,7 @@ _pmc_name_of_event(enum pmc_event pe, en evfence = core_event_table + PMC_EVENT_TABLE_SIZE(core); break; case PMC_CPU_INTEL_CORE2: + case PMC_CPU_INTEL_CORE2EXTREME: ev = core2_event_table; evfence = core2_event_table + PMC_EVENT_TABLE_SIZE(core2); break; Modified: head/sys/dev/hwpmc/hwpmc_core.c ============================================================================== --- head/sys/dev/hwpmc/hwpmc_core.c Wed Dec 3 16:29:12 2008 (r185584) +++ head/sys/dev/hwpmc/hwpmc_core.c Wed Dec 3 17:30:36 2008 (r185585) @@ -527,8 +527,8 @@ struct iap_event_descr { }; #define IAP_F_CC (1 << 0) /* CPU: Core */ -#define IAP_F_CC2 (1 << 1) /* CPU: Core2 */ -#define IAP_F_CC2E (1 << 2) /* CPU: Core2 Extreme */ +#define IAP_F_CC2 (1 << 1) /* CPU: Core2 family */ +#define IAP_F_CC2E (1 << 2) /* CPU: Core2 Extreme only */ #define IAP_F_CA (1 << 3) /* CPU: Atom */ #define IAP_F_FM (1 << 4) /* Fixed mask */ @@ -1111,7 +1111,7 @@ iap_allocate_pmc(int cpu, int ri, struct cpuflag = IAP_F_CC2; break; case PMC_CPU_INTEL_CORE2EXTREME: - cpuflag = IAP_F_CC2E; + cpuflag = IAP_F_CC2 | IAP_F_CC2E; break; } Modified: head/sys/dev/hwpmc/hwpmc_intel.c ============================================================================== --- head/sys/dev/hwpmc/hwpmc_intel.c Wed Dec 3 16:29:12 2008 (r185584) +++ head/sys/dev/hwpmc/hwpmc_intel.c Wed Dec 3 17:30:36 2008 (r185585) @@ -168,6 +168,7 @@ pmc_intel_initialize(void) case PMC_CPU_INTEL_ATOM: case PMC_CPU_INTEL_CORE: case PMC_CPU_INTEL_CORE2: + case PMC_CPU_INTEL_CORE2EXTREME: error = pmc_core_initialize(pmc_mdep, ncpus); break; @@ -238,6 +239,7 @@ pmc_intel_finalize(struct pmc_mdep *md) case PMC_CPU_INTEL_ATOM: case PMC_CPU_INTEL_CORE: case PMC_CPU_INTEL_CORE2: + case PMC_CPU_INTEL_CORE2EXTREME: pmc_core_finalize(md); break; From owner-svn-src-head@FreeBSD.ORG Wed Dec 3 17:54:10 2008 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 30B9F1065696; Wed, 3 Dec 2008 17:54:10 +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 1FE978FC1B; Wed, 3 Dec 2008 17:54:10 +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 mB3HsAku097436; Wed, 3 Dec 2008 17:54:10 GMT (envelope-from kan@svn.freebsd.org) Received: (from kan@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mB3Hs9kU097435; Wed, 3 Dec 2008 17:54:09 GMT (envelope-from kan@svn.freebsd.org) Message-Id: <200812031754.mB3Hs9kU097435@svn.freebsd.org> From: Alexander Kabaev Date: Wed, 3 Dec 2008 17:54: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: r185586 - head/sys/nfsserver X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 03 Dec 2008 17:54:10 -0000 Author: kan Date: Wed Dec 3 17:54:09 2008 New Revision: 185586 URL: http://svn.freebsd.org/changeset/base/185586 Log: Change nfsserver slightly so that it does not trip over the timestamp validation code on ZFS. Problem: when opening file with O_CREAT|O_EXCL NFS has to jump through extra hoops to ensure O_EXCL semantics. Namely, client supplies of 8 bytes (NFSX_V3CREATEVERF) bytes of verification data to uniquely identify this create request. Server then creates a new file with access mode 0, copies received 8 bytes into va_atime member of struct vattr and attempt to set the atime on file using VOP_SETATTR. If that succeeds, it fetches file attributes with VOP_GETATTR and verifies that atime timestamps match. If timestamps do not match, NFS server concludes it has probbaly lost the race to another process creating the file with the same name and bails with EEXIST. This scheme works OK when exported FS is FFS, but if underlying filesystem is ZFS _and_ server is running 64bit kernel, it breaks down due to sanity checking in zfs_setattr function, which refuses to accept any timestamps which have tv_sec that cannot be represented as 32bit int. Since struct timespec fields are 64 bit integers on 64bit platforms and server just copies NFSX_V3CREATEVERF bytes info va_atime, all eight bytes supplied by client end up in va_atime.tv_sec, forcing it out of valid 32bit range. The solution this change implements is simple: it treats NFSX_V3CREATEVERF as two 32bit integers and unpacks them separately into va_atime.tv_sec and va_atime.tv_nsec respectively, thus guaranteeing that tv_sec remains in 32 bit range and ZFS remains happy. Reviewed by: kib Modified: head/sys/nfsserver/nfs_serv.c Modified: head/sys/nfsserver/nfs_serv.c ============================================================================== --- head/sys/nfsserver/nfs_serv.c Wed Dec 3 17:30:36 2008 (r185585) +++ head/sys/nfsserver/nfs_serv.c Wed Dec 3 17:54:09 2008 (r185586) @@ -1669,13 +1669,12 @@ nfsrv_create(struct nfsrv_descript *nfsd caddr_t bpos; int error = 0, rdev, len, tsize, dirfor_ret = 1, diraft_ret = 1; int v3 = (nfsd->nd_flag & ND_NFSV3), how, exclusive_flag = 0; - caddr_t cp; struct mbuf *mb, *mreq; struct vnode *dirp = NULL; nfsfh_t nfh; fhandle_t *fhp; u_quad_t tempsize; - u_char cverf[NFSX_V3CREATEVERF]; + struct timespec cverf; struct mount *mp = NULL; int tvfslocked; int vfslocked; @@ -1754,8 +1753,11 @@ nfsrv_create(struct nfsrv_descript *nfsd nfsm_srvsattr(vap); break; case NFSV3CREATE_EXCLUSIVE: - cp = nfsm_dissect_nonblock(caddr_t, NFSX_V3CREATEVERF); - bcopy(cp, cverf, NFSX_V3CREATEVERF); + tl = nfsm_dissect_nonblock(u_int32_t *, + NFSX_V3CREATEVERF); + /* Unique bytes, endianness is not important. */ + cverf.tv_sec = tl[0]; + cverf.tv_nsec = tl[1]; exclusive_flag = 1; break; }; @@ -1801,8 +1803,7 @@ nfsrv_create(struct nfsrv_descript *nfsd if (exclusive_flag) { exclusive_flag = 0; VATTR_NULL(vap); - bcopy(cverf, (caddr_t)&vap->va_atime, - NFSX_V3CREATEVERF); + vap->va_atime = cverf; error = VOP_SETATTR(nd.ni_vp, vap, cred); } @@ -1886,7 +1887,7 @@ nfsrv_create(struct nfsrv_descript *nfsd } if (v3) { if (exclusive_flag && !error && - bcmp(cverf, (caddr_t)&vap->va_atime, NFSX_V3CREATEVERF)) + bcmp(&cverf, &vap->va_atime, sizeof (cverf))) error = EEXIST; if (dirp == nd.ni_dvp) diraft_ret = VOP_GETATTR(dirp, &diraft, cred); From owner-svn-src-head@FreeBSD.ORG Wed Dec 3 18:22:37 2008 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 018091065672; Wed, 3 Dec 2008 18:22:37 +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 E34EF8FC16; Wed, 3 Dec 2008 18:22:36 +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 mB3IMaTY098032; Wed, 3 Dec 2008 18:22:36 GMT (envelope-from luigi@svn.freebsd.org) Received: (from luigi@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mB3IMaFb098030; Wed, 3 Dec 2008 18:22:36 GMT (envelope-from luigi@svn.freebsd.org) Message-Id: <200812031822.mB3IMaFb098030@svn.freebsd.org> From: Luigi Rizzo Date: Wed, 3 Dec 2008 18:22: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: r185587 - head/sbin/newfs_msdos X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 03 Dec 2008 18:22:37 -0000 Author: luigi Date: Wed Dec 3 18:22:36 2008 New Revision: 185587 URL: http://svn.freebsd.org/changeset/base/185587 Log: Some useful operational extensions to newfs_msdos, especially when preparing images for emulators or flash devices: + option '-C size' to create the underlying image file with given size. Saves doing a 'dd' before, and especially it creates a sparse file + option '-@ offset' to build the FAT image at the specified offset in the image file or device; + make the cluster size adaptive on the filesystem size. Previously the default was 4k which is really unconvenient with large media; now it goes from 512 bytes to 32k depending on filesystem size (i still need to check whether it makes sense to go further up, to 64k or above); + fix default geometry when not specified on the command line, use 63 sectors/255 heads by default. Also trim the size so it exactly a multiple of a track, to avoid complaints in some filesystem code. + document all the above, plus some manual page clarifications. MFC after: 4 weeks Modified: head/sbin/newfs_msdos/newfs_msdos.8 head/sbin/newfs_msdos/newfs_msdos.c Modified: head/sbin/newfs_msdos/newfs_msdos.8 ============================================================================== --- head/sbin/newfs_msdos/newfs_msdos.8 Wed Dec 3 17:54:09 2008 (r185586) +++ head/sbin/newfs_msdos/newfs_msdos.8 Wed Dec 3 18:22:36 2008 (r185587) @@ -34,7 +34,9 @@ .Sh SYNOPSIS .Nm .Op Fl N +.Op Fl @ Ar offset .Op Fl B Ar boot +.Op Fl C Ar create-size .Op Fl F Ar FAT-type .Op Fl I Ar volid .Op Fl L Ar label @@ -59,7 +61,7 @@ .Sh DESCRIPTION The .Nm -utility creates a FAT12, FAT16, or FAT32 file system on device +utility creates a FAT12, FAT16, or FAT32 file system on device or file named .Ar special , using .Xr disktab 5 @@ -67,16 +69,39 @@ entry .Ar disktype to determine geometry, if required. .Pp +If +.Ar special +does not contain a +.Ar / , +it is assumed to be a device name and +.Ar /dev +is prepended to the name to construct the actual device name. +To work a file in the current directory use +.Ar ./filename +.Pp The options are as follow: .Bl -tag -width indent .It Fl N Do not create a file system: just print out parameters. +.It Fl @ Ar offset +Build the filesystem at the specified offset in bytes in the device or file. +A suffix s, k, m, g (lower or upper case) +appended to the offset specifies that the +number is in sectors, kilobytes, megabytes or gigabytes, respectively. .It Fl B Ar boot Get bootstrap from file. +.It Fl C Ar create-size +Create the image file with the specified size. A suffix character appended +to the size is interpreted as for the +.Fl @ +option. The file is created by truncating any existing file with the +same name, seeking just before the required size and writing +a single 0 byte. As a consequence, the space occupied on disk +may be smaller than the size specified as a parameter. .It Fl F Ar FAT-type FAT type (one of 12, 16, or 32). .It Fl I Ar volid -Volume ID. +Volume ID, a 32 bit number in decimal or hexadecimal (0x...) format. .It Fl L Ar label Volume label (up to 11 characters). The label should consist of @@ -99,6 +124,9 @@ acceptable number of sectors per cluster Sectors per cluster. Acceptable values are powers of 2 in the range 1 through 128. +If the block or cluster size are not specified, the code +uses a cluster between 512 bytes and 32K depending on +the filesystem size. .It Fl e Ar dirents Number of root directory entries (FAT12 and FAT16 only). .It Fl f Ar format @@ -132,6 +160,15 @@ File system size. Number of sectors per track. .El .Sh NOTES +If some parameters (e.g. size, number of sectors, etc.) are not specified +through options or disktype, the program tries to generate them +automatically. In particular, the size is determined as the +device or file size minus the offset specified with the +.Fl @ +option. When the geometry is not available, it is assumed to be +63 sectors, 255 heads. The size is then rounded to become +a multiple of the track size and avoid complaints by some filesystem code. +.Pp FAT file system parameters occupy a "Boot Sector BPB (BIOS Parameter Block)" in the first of the "reserved" sectors which precede the actual file system. @@ -167,20 +204,25 @@ The maximum file size is 4GB, even if th .Sh EXIT STATUS Exit status is 0 on success and 1 on error. .Sh EXAMPLES +Create a file system, using default parameters, on +.Pa /dev/ad0s1 : .Bd -literal -offset indent newfs_msdos /dev/ad0s1 .Ed .Pp -Create a file system, using default parameters, on -.Pa /dev/ad0s1 . +Create a standard 1.44M file system, with volume label +.Ar foo , +on +.Pa /dev/fd0 : .Bd -literal -offset indent newfs_msdos -f 1440 -L foo fd0 .Ed .Pp -Create a standard 1.44M file system, with volume label -.Ar foo , -on -.Pa /dev/fd0 . +Create a 30MB image file, with the FAT partition starting +63 sectors within the image file: +.Bd -literal -offset indent +newfs_msdos -C 30M -@63s ./somefile +.Ed .Sh SEE ALSO .Xr disktab 5 , .Xr disklabel 8 , Modified: head/sbin/newfs_msdos/newfs_msdos.c ============================================================================== --- head/sbin/newfs_msdos/newfs_msdos.c Wed Dec 3 17:54:09 2008 (r185586) +++ head/sbin/newfs_msdos/newfs_msdos.c Wed Dec 3 18:22:36 2008 (r185587) @@ -219,6 +219,7 @@ static void getdiskinfo(int, const char static void print_bpb(struct bpb *); static u_int ckgeom(const char *, u_int, const char *); static u_int argtou(const char *, u_int, u_int, const char *); +static off_t argtooff(const char *, const char *); static int oklabel(const char *); static void mklabel(u_int8_t *, const char *); static void setstr(u_int8_t *, const char *, size_t); @@ -230,7 +231,7 @@ static void usage(void); int main(int argc, char *argv[]) { - static char opts[] = "NB:F:I:L:O:S:a:b:c:e:f:h:i:k:m:n:o:r:s:u:"; + static char opts[] = "@:NB:C:F:I:L:O:S:a:b:c:e:f:h:i:k:m:n:o:r:s:u:"; static const char *opt_B, *opt_L, *opt_O, *opt_f; static u_int opt_F, opt_I, opt_S, opt_a, opt_b, opt_c, opt_e; static u_int opt_h, opt_i, opt_k, opt_m, opt_n, opt_o, opt_r; @@ -253,15 +254,22 @@ main(int argc, char *argv[]) time_t now; u_int fat, bss, rds, cls, dir, lsn, x, x1, x2; int ch, fd, fd1; + static off_t opt_create=0, opt_ofs=0; while ((ch = getopt(argc, argv, opts)) != -1) switch (ch) { + case '@': + opt_ofs = argtooff(optarg, "offset"); + break; case 'N': opt_N = 1; break; case 'B': opt_B = optarg; break; + case 'C': + opt_create = argtooff(optarg, "create size"); + break; case 'F': if (strcmp(optarg, "12") && strcmp(optarg, "16") && @@ -346,13 +354,27 @@ main(int argc, char *argv[]) err(1, NULL); } dtype = *argv; - if ((fd = open(fname, opt_N ? O_RDONLY : O_RDWR)) == -1 || + if (opt_create) { + off_t pos; + + if (opt_N) + errx(1, "create (-C) is incompatible with -N"); + fd = open(fname, O_RDWR | O_CREAT | O_TRUNC, 0644); + if (fd == -1) + errx(1, "failed to create %s", fname); + pos = lseek(fd, opt_create - 1, SEEK_SET); + if (write(fd, "\0", 1) != 1) + errx(1, "failed to initialize %lld bytes", opt_create); + pos = lseek(fd, 0, SEEK_SET); + } else if ((fd = open(fname, opt_N ? O_RDONLY : O_RDWR)) == -1 || fstat(fd, &sb)) err(1, "%s", fname); if (!opt_N) check_mounted(fname, sb.st_mode); if (!S_ISCHR(sb.st_mode)) - warnx("warning: %s is not a character device", fname); + warnx("warning, %s is not a character device", fname); + if (opt_ofs && opt_ofs != lseek(fd, opt_ofs, SEEK_SET)) + errx(1, "cannot seek to %lld", opt_ofs); memset(&bpb, 0, sizeof(bpb)); if (opt_f) { getstdfmt(opt_f, &bpb); @@ -371,8 +393,29 @@ main(int argc, char *argv[]) bpb.bsec = opt_s; if (oflag) bpb.hid = opt_o; - if (!(opt_f || (opt_h && opt_u && opt_S && opt_s && oflag))) + if (!(opt_f || (opt_h && opt_u && opt_S && opt_s && oflag))) { + off_t delta; getdiskinfo(fd, fname, dtype, oflag, &bpb); + bpb.bsec -= (opt_ofs / bpb.bps); + delta = bpb.bsec % bpb.spt; + if (delta != 0) { + warnx("trim %d sectors to adjust to a multiple of %d", + (int)delta, bpb.spt); + bpb.bsec -= delta; + } + if (bpb.spc == 0) { /* set defaults */ + if (bpb.bsec <= 6000) /* about 3MB -> 512 bytes */ + bpb.spc = 1; + else if (bpb.bsec <= (1<<17)) /* 64M -> 4k */ + bpb.spc = 8; + else if (bpb.bsec <= (1<<19)) /* 256M -> 8k */ + bpb.spc = 16; + else if (bpb.bsec <= (1<<21)) /* 1G -> 16k */ + bpb.spc = 32; + else + bpb.spc = 64; /* otherwise 32k */ + } + } if (!powerof2(bpb.bps)) errx(1, "bytes/sector (%u) is not a power of 2", bpb.bps); if (bpb.bps < MINBPS) @@ -561,7 +604,7 @@ main(int argc, char *argv[]) fat == 32 && bpb.bkbs != MAXU16 && bss <= bpb.bkbs && x >= bpb.bkbs) { x -= bpb.bkbs; - if (!x && lseek(fd1, 0, SEEK_SET)) + if (!x && lseek(fd1, opt_ofs, SEEK_SET)) err(1, "%s", bname); } if (opt_B && x < bss) { @@ -728,14 +771,13 @@ getdiskinfo(int fd, const char *fname, c if (ioctl(fd, DIOCGMEDIASIZE, &ms) == -1) { struct stat st; - bzero(&st, sizeof(st)); if (fstat(fd, &st)) err(1, "Cannot get disk size"); /* create a fake geometry for a file image */ ms = st.st_size; dlp.d_secsize = 512; - dlp.d_nsectors = 64; - dlp.d_ntracks = 32; + dlp.d_nsectors = 63; + dlp.d_ntracks = 255; dlp.d_secperunit = ms / dlp.d_secsize; lp = &dlp; } else if (ioctl(fd, FD_GTYPE, &type) != -1) { @@ -833,6 +875,56 @@ argtou(const char *arg, u_int lo, u_int } /* + * Same for off_t, with optional skmgpP suffix + */ +static off_t +argtooff(const char *arg, const char *msg) +{ + char *s; + off_t x; + + x = strtoll(arg, &s, 0); + /* allow at most one extra char */ + if (errno || x < 0 || (s[0] && s[1]) ) + errx(1, "%s: bad %s", arg, msg); + if (*s) { /* the extra char is the multiplier */ + switch (*s) { + default: + errx(1, "%s: bad %s", arg, msg); + /* notreached */ + + case 's': /* sector */ + case 'S': + x <<= 9; /* times 512 */ + break; + + case 'k': /* kilobyte */ + case 'K': + x <<= 10; /* times 1024 */ + break; + + case 'm': /* megabyte */ + case 'M': + x <<= 20; /* times 1024*1024 */ + break; + + case 'g': /* gigabyte */ + case 'G': + x <<= 30; /* times 1024*1024*1024 */ + break; + + case 'p': /* partition start */ + case 'P': /* partition start */ + case 'l': /* partition length */ + case 'L': /* partition length */ + errx(1, "%s: not supported yet %s", arg, msg); + /* notreached */ + } + } + return x; +} + +/* * Check a volume label. */ static int From owner-svn-src-head@FreeBSD.ORG Wed Dec 3 18:37:00 2008 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 62BB81065759; Wed, 3 Dec 2008 18:37:00 +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 506C38FC24; Wed, 3 Dec 2008 18:37:00 +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 mB3Ib006098334; Wed, 3 Dec 2008 18:37:00 GMT (envelope-from luigi@svn.freebsd.org) Received: (from luigi@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mB3Ib0pb098329; Wed, 3 Dec 2008 18:37:00 GMT (envelope-from luigi@svn.freebsd.org) Message-Id: <200812031837.mB3Ib0pb098329@svn.freebsd.org> From: Luigi Rizzo Date: Wed, 3 Dec 2008 18:37: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: r185588 - head/sbin/newfs X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 03 Dec 2008 18:37:00 -0000 Author: luigi Date: Wed Dec 3 18:36:59 2008 New Revision: 185588 URL: http://svn.freebsd.org/changeset/base/185588 Log: Enable operation of newfs on plain files, which is useful when you want to prepare disk images for emulators (though 'makefs' in port can do something similar). This relies on: + minor changes to pass the consistency checks even when working on a file; + an additional option, '-p partition' , to specify the disk partition to initialize; + some changes on the I/O routines to deal with partition offsets. The latter was a bit tricky to implement, see the details in newfs.h: in newfs, I/O is done through libufs which assumes that the file descriptor refers to the whole partition. Introducing support for the offset in libufs would require a non-backward compatible change in the library, to be dealt with a version bump or with symbol versioning. I felt both approaches to be overkill for this specific application, especially because there might be other changes to libufs that might become necessary in the near future. So I used the following trick: - read access is always done by calling bread() directly, so we just add the offset in the (few) places that call bread(); - write access is done through bwrite() and sbwrite(), which in turn calls bwrite(). To avoid rewriting sbwrite(), we supply our own version of bwrite() here, which takes precedence over the version in libufs. MFC after: 4 weeks Modified: head/sbin/newfs/Makefile head/sbin/newfs/mkfs.c head/sbin/newfs/newfs.8 head/sbin/newfs/newfs.c head/sbin/newfs/newfs.h Modified: head/sbin/newfs/Makefile ============================================================================== --- head/sbin/newfs/Makefile Wed Dec 3 18:22:36 2008 (r185587) +++ head/sbin/newfs/Makefile Wed Dec 3 18:36:59 2008 (r185588) @@ -1,10 +1,13 @@ # @(#)Makefile 8.2 (Berkeley) 3/27/94 # $FreeBSD$ +.PATH: ${.CURDIR}/../../sys/geom + PROG= newfs DPADD= ${LIBUFS} LDADD= -lufs -SRCS= newfs.c mkfs.c +SRCS= newfs.c mkfs.c geom_bsd_enc.c + WARNS?= 2 MAN= newfs.8 Modified: head/sbin/newfs/mkfs.c ============================================================================== --- head/sbin/newfs/mkfs.c Wed Dec 3 18:22:36 2008 (r185587) +++ head/sbin/newfs/mkfs.c Wed Dec 3 18:36:59 2008 (r185588) @@ -459,7 +459,7 @@ mkfs(struct partition *pp, char *fsys) * Wipe out old UFS1 superblock(s) if necessary. */ if (!Nflag && Oflag != 1) { - i = bread(&disk, SBLOCK_UFS1 / disk.d_bsize, chdummy, SBLOCKSIZE); + i = bread(&disk, part_ofs + SBLOCK_UFS1 / disk.d_bsize, chdummy, SBLOCKSIZE); if (i == -1) err(1, "can't read old UFS1 superblock: %s", disk.d_error); @@ -872,7 +872,7 @@ alloc(int size, int mode) { int i, d, blkno, frag; - bread(&disk, fsbtodb(&sblock, cgtod(&sblock, 0)), (char *)&acg, + bread(&disk, part_ofs + fsbtodb(&sblock, cgtod(&sblock, 0)), (char *)&acg, sblock.fs_cgsize); if (acg.cg_magic != CG_MAGIC) { printf("cg 0: bad magic number\n"); @@ -925,7 +925,7 @@ iput(union dinode *ip, ino_t ino) int c; c = ino_to_cg(&sblock, ino); - bread(&disk, fsbtodb(&sblock, cgtod(&sblock, 0)), (char *)&acg, + bread(&disk, part_ofs + fsbtodb(&sblock, cgtod(&sblock, 0)), (char *)&acg, sblock.fs_cgsize); if (acg.cg_magic != CG_MAGIC) { printf("cg 0: bad magic number\n"); @@ -942,7 +942,7 @@ iput(union dinode *ip, ino_t ino) exit(32); } d = fsbtodb(&sblock, ino_to_fsba(&sblock, ino)); - bread(&disk, d, (char *)iobuf, sblock.fs_bsize); + bread(&disk, part_ofs + d, (char *)iobuf, sblock.fs_bsize); if (sblock.fs_magic == FS_UFS1_MAGIC) ((struct ufs1_dinode *)iobuf)[ino_to_fsbo(&sblock, ino)] = ip->dp1; Modified: head/sbin/newfs/newfs.8 ============================================================================== --- head/sbin/newfs/newfs.8 Wed Dec 3 18:22:36 2008 (r185587) +++ head/sbin/newfs/newfs.8 Wed Dec 3 18:36:59 2008 (r185588) @@ -52,6 +52,7 @@ .Op Fl i Ar bytes .Op Fl m Ar free-space .Op Fl o Ar optimization +.Op Fl p Ar partition .Op Fl r Ar reserved .Op Fl s Ar size .Ar special @@ -201,6 +202,17 @@ the default is to optimize for See .Xr tunefs 8 for more details on how to set this option. +.It Fl p Ar partition +The partition name (a..h) you want to use in case the underlying image +is a file, so you don't have access to individual partitions through the +filesystem. +Can also be used with a device, e.g. +.Nm +.Fl p Ar f +.Ar /dev/da1s3 +is equivalent to +.Nm +.Ar /dev/da1s3f . .It Fl r Ar reserved The size, in sectors, of reserved space at the end of the partition specified in Modified: head/sbin/newfs/newfs.c ============================================================================== --- head/sbin/newfs/newfs.c Wed Dec 3 18:22:36 2008 (r185587) +++ head/sbin/newfs/newfs.c Wed Dec 3 18:36:59 2008 (r185588) @@ -139,6 +139,9 @@ u_char *volumelabel = NULL; /* volume la struct uufsd disk; /* libufs disk structure */ static char device[MAXPATHLEN]; +static u_char bootarea[BBSIZE]; +static int is_file; /* work on a file, not a device */ +static char *dkname; static char *disktype; static int unlabeled; @@ -147,6 +150,18 @@ static struct disklabel *getdisklabel(ch static void rewritelabel(char *s, struct disklabel *lp); static void usage(void); +ufs2_daddr_t part_ofs; /* partition offset in blocks, used with files */ + +/* + * need to replace the library's bwrite so that sbwrite uses this one + */ +ssize_t +bwrite(struct uufsd *disk, ufs2_daddr_t blockno, const void *data, size_t size) +{ + return pwrite(disk->d_fd, data, size, + (off_t)((part_ofs + blockno) * disk->d_bsize)); +} + int main(int argc, char *argv[]) { @@ -158,7 +173,9 @@ main(int argc, char *argv[]) intmax_t reserved; int ch, i; off_t mediasize; + char part_name; /* partition name, default to full disk */ + part_name = 'c'; reserved = 0; while ((ch = getopt(argc, argv, "EJL:NO:RS:T:UXa:b:c:d:e:f:g:h:i:lm:no:r:s:")) != -1) @@ -276,6 +293,11 @@ main(int argc, char *argv[]) *cp != '\0' || reserved < 0) errx(1, "%s: bad reserved size", optarg); break; + case 'p': + is_file = 1; + part_name = optarg[0]; + break; + case 's': errno = 0; fssize = strtoimax(optarg, &cp, 0); @@ -294,6 +316,8 @@ main(int argc, char *argv[]) usage(); special = argv[0]; + if (!special[0]) + err(1, "empty file/special name"); cp = strrchr(special, '/'); if (cp == 0) { /* @@ -303,7 +327,16 @@ main(int argc, char *argv[]) special = device; } - if (ufs_disk_fillout_blank(&disk, special) == -1 || + if (is_file) { + /* bypass ufs_disk_fillout_blank */ + bzero( &disk, sizeof(disk)); + disk.d_bsize = 1; + disk.d_name = special; + disk.d_fd = open(special, O_RDONLY); + if (disk.d_fd < 0 || + (!Nflag && ufs_disk_write(&disk) == -1)) + errx(1, "%s: ", special); + } else if (ufs_disk_fillout_blank(&disk, special) == -1 || (!Nflag && ufs_disk_write(&disk) == -1)) { if (disk.d_error != NULL) errx(1, "%s: %s", special, disk.d_error); @@ -312,22 +345,30 @@ main(int argc, char *argv[]) } if (fstat(disk.d_fd, &st) < 0) err(1, "%s", special); - if ((st.st_mode & S_IFMT) != S_IFCHR) - errx(1, "%s: not a character-special device", special); + if ((st.st_mode & S_IFMT) != S_IFCHR) { + warn("%s: not a character-special device", special); + is_file = 1; /* assume it is a file */ + dkname = special; + if (sectorsize == 0) + sectorsize = 512; + mediasize = st.st_size; + /* set fssize from the partition */ + } else { + part_name = special[strlen(special) - 1]; + if ((part_name < 'a' || part_name > 'h') && !isdigit(part_name)) + errx(1, "%s: can't figure out file system partition", + special); - if (sectorsize == 0) + if (sectorsize == 0) if (ioctl(disk.d_fd, DIOCGSECTORSIZE, §orsize) == -1) - sectorsize = 0; /* back out on error for safety */ - if (sectorsize && ioctl(disk.d_fd, DIOCGMEDIASIZE, &mediasize) != -1) + sectorsize = 0; /* back out on error for safety */ + if (sectorsize && ioctl(disk.d_fd, DIOCGMEDIASIZE, &mediasize) != -1) getfssize(&fssize, special, mediasize / sectorsize, reserved); + } pp = NULL; lp = getdisklabel(special); if (lp != NULL) { - cp = strchr(special, '\0'); - cp--; - if ((*cp < 'a' || *cp > 'h') && !isdigit(*cp)) - errx(1, "%s: can't figure out file system partition", - special); + cp = &part_name; if (isdigit(*cp)) pp = &lp->d_partitions[RAW_PART]; else @@ -346,6 +387,8 @@ main(int argc, char *argv[]) fsize = pp->p_fsize; if (bsize == 0) bsize = pp->p_frag * pp->p_fsize; + if (is_file) + part_ofs = pp->p_offset; } if (sectorsize <= 0) errx(1, "%s: no default sector size", special); @@ -414,6 +457,19 @@ getdisklabel(char *s) static struct disklabel lab; struct disklabel *lp; + if (is_file) { + if (read(disk.d_fd, bootarea, BBSIZE) != BBSIZE) + err(4, "cannot read bootarea"); + if (bsd_disklabel_le_dec( + bootarea + (0 /* labeloffset */ + + 1 /* labelsoffset */ * sectorsize), + &lab, MAXPARTITIONS)) + errx(1, "no valid label found"); + + lp = &lab; + return &lab; + } + if (ioctl(disk.d_fd, DIOCGDINFO, (char *)&lab) != -1) return (&lab); unlabeled++; @@ -432,6 +488,14 @@ rewritelabel(char *s, struct disklabel * return; lp->d_checksum = 0; lp->d_checksum = dkcksum(lp); + if (is_file) { + bsd_disklabel_le_enc(bootarea + 0 /* labeloffset */ + + 1 /* labelsoffset */ * sectorsize, lp); + lseek(disk.d_fd, 0, SEEK_SET); + if (write(disk.d_fd, bootarea, BBSIZE) != BBSIZE) + errx(1, "cannot write label"); + return; + } if (ioctl(disk.d_fd, DIOCWDINFO, (char *)lp) == -1) warn("ioctl (WDINFO): %s: can't rewrite disk label", s); } @@ -467,6 +531,7 @@ usage() fprintf(stderr, "\t-n do not create .snap directory\n"); fprintf(stderr, "\t-m minimum free space %%\n"); fprintf(stderr, "\t-o optimization preference (`space' or `time')\n"); + fprintf(stderr, "\t-p partition name (a..h)\n"); fprintf(stderr, "\t-r reserved sectors at the end of device\n"); fprintf(stderr, "\t-s file system size (sectors)\n"); exit(1); Modified: head/sbin/newfs/newfs.h ============================================================================== --- head/sbin/newfs/newfs.h Wed Dec 3 18:22:36 2008 (r185587) +++ head/sbin/newfs/newfs.h Wed Dec 3 18:36:59 2008 (r185588) @@ -70,4 +70,20 @@ extern int avgfilesperdir; /* expected n extern u_char *volumelabel; /* volume label for filesystem */ extern struct uufsd disk; /* libufs disk structure */ +/* + * To override a limitation in libufs, export the offset (in sectors) of the + * partition on the underlying media (file or disk). The value is used as + * an offset for all accesses to the media through bread(), which is only + * invoked directly in this program. + * For bwrite() we need a different approach, namely override the library + * version with one defined here. This is because bwrite() is called also + * by the library function sbwrite() which we cannot intercept nor want to + * rewrite. As a consequence, the internal version of bwrite() adds the + * partition offset itself when calling the underlying function, pwrite(). + * + * XXX This info really ought to go into the struct uufsd, at which point + * we can remove the above hack. + */ +extern ufs2_daddr_t part_ofs; /* partition offset in blocks */ + void mkfs (struct partition *, char *); From owner-svn-src-head@FreeBSD.ORG Wed Dec 3 18:45:38 2008 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DAF35106574E; Wed, 3 Dec 2008 18:45:38 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id CA3048FC1F; Wed, 3 Dec 2008 18:45:38 +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 mB3IjcMQ098536; Wed, 3 Dec 2008 18:45:38 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mB3IjcZC098534; Wed, 3 Dec 2008 18:45:38 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <200812031845.mB3IjcZC098534@svn.freebsd.org> From: John Baldwin Date: Wed, 3 Dec 2008 18:45: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: r185589 - head/sys/compat/freebsd32 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 03 Dec 2008 18:45:39 -0000 Author: jhb Date: Wed Dec 3 18:45:38 2008 New Revision: 185589 URL: http://svn.freebsd.org/changeset/base/185589 Log: When unloading a 32-bit system call module, restore the sysent vector in the 32-bit system call table instead of the main system call table. Modified: head/sys/compat/freebsd32/freebsd32_misc.c Modified: head/sys/compat/freebsd32/freebsd32_misc.c ============================================================================== --- head/sys/compat/freebsd32/freebsd32_misc.c Wed Dec 3 18:36:59 2008 (r185588) +++ head/sys/compat/freebsd32/freebsd32_misc.c Wed Dec 3 18:45:38 2008 (r185589) @@ -2774,7 +2774,7 @@ syscall32_module_handler(struct module * if (error) return (error); } - error = syscall_deregister(data->offset, &data->old_sysent); + error = syscall32_deregister(data->offset, &data->old_sysent); return (error); default: error = EOPNOTSUPP; From owner-svn-src-head@FreeBSD.ORG Wed Dec 3 19:17:56 2008 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CA7DB106564A; Wed, 3 Dec 2008 19:17:56 +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 mx1.freebsd.org (Postfix) with ESMTP id 5A5888FC0A; Wed, 3 Dec 2008 19:17:56 +0000 (UTC) (envelope-from peterjeremy@optushome.com.au) Received: from server.vk2pj.dyndns.org (c122-106-215-175.belrs3.nsw.optusnet.com.au [122.106.215.175]) by mail15.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id mB3JHrIU013852 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Thu, 4 Dec 2008 06:17:54 +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 mB3JHrHt076886; Thu, 4 Dec 2008 06:17:53 +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 mB3JHr2f076885; Thu, 4 Dec 2008 06:17:53 +1100 (EST) (envelope-from peter) Date: Thu, 4 Dec 2008 06:17:53 +1100 From: Peter Jeremy To: Luigi Rizzo Message-ID: <20081203191752.GA58682@server.vk2pj.dyndns.org> References: <200812021457.mB2Evmha063418@svn.freebsd.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="vtzGhvizbBRQ85DL" Content-Disposition: inline In-Reply-To: <200812021457.mB2Evmha063418@svn.freebsd.org> X-PGP-Key: http://members.optusnet.com.au/peterjeremy/pubkey.asc User-Agent: Mutt/1.5.18 (2008-05-17) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r185562 - head/sys/boot/i386/boot0 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 03 Dec 2008 19:17:56 -0000 --vtzGhvizbBRQ85DL Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On 2008-Dec-02 14:57:48 +0000, Luigi Rizzo wrote: >Log: > This commits brings in a lot of documentation and some enhancement > of the boot0.S code, with a number of compile-time selectable options, > the most interesting one being the ability to select PXE booting. Excellent. One typo I noticed: >+ * %si pointer to the partition table from which we were loaded. >+ * Some boot code (e.g. syslinux) use this info to relocate >+ * themselves, so we want to pass a valid one to the next stage. >+ * NOTE: the use of %is is not a standard. ^^^ should be %si. --=20 Peter Jeremy Please excuse any delays as the result of my ISP's inability to implement an MTA that is either RFC2821-compliant or matches their claimed behaviour. --vtzGhvizbBRQ85DL Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.9 (FreeBSD) iEYEARECAAYFAkk222AACgkQ/opHv/APuIdQ1gCfYJJsnxALS0OBQ3GSnwUQ6xZo 8ssAnR0Lh/zrD3fF7PsoTVv5d4/nwSTi =YFQr -----END PGP SIGNATURE----- --vtzGhvizbBRQ85DL-- From owner-svn-src-head@FreeBSD.ORG Wed Dec 3 21:43:11 2008 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B2A3A1065670; Wed, 3 Dec 2008 21:43:11 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from mail.terabit.net.ua (mail.terabit.net.ua [195.137.202.147]) by mx1.freebsd.org (Postfix) with ESMTP id 533C18FC12; Wed, 3 Dec 2008 21:43:11 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from skuns.zoral.com.ua ([91.193.166.194] helo=mail.zoral.com.ua) by mail.terabit.net.ua with esmtps (TLSv1:AES256-SHA:256) (Exim 4.63 (FreeBSD)) (envelope-from ) id 1L7zUz-0008fw-Dp; Wed, 03 Dec 2008 23:43:09 +0200 Received: from deviant.kiev.zoral.com.ua (root@deviant.kiev.zoral.com.ua [10.1.1.148]) by mail.zoral.com.ua (8.14.2/8.14.2) with ESMTP id mB3Lh6Yt015618 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Wed, 3 Dec 2008 23:43:06 +0200 (EET) (envelope-from kostikbel@gmail.com) Received: from deviant.kiev.zoral.com.ua (kostik@localhost [127.0.0.1]) by deviant.kiev.zoral.com.ua (8.14.3/8.14.3) with ESMTP id mB3Lh61i021179; Wed, 3 Dec 2008 23:43:06 +0200 (EET) (envelope-from kostikbel@gmail.com) Received: (from kostik@localhost) by deviant.kiev.zoral.com.ua (8.14.3/8.14.3/Submit) id mB3Lh6gp021177; Wed, 3 Dec 2008 23:43:06 +0200 (EET) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: deviant.kiev.zoral.com.ua: kostik set sender to kostikbel@gmail.com using -f Date: Wed, 3 Dec 2008 23:43:06 +0200 From: Kostik Belousov To: John Baldwin Message-ID: <20081203214306.GC2401@deviant.kiev.zoral.com.ua> References: <200812031845.mB3IjcZC098534@svn.freebsd.org> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="KN5l+BnMqAQyZLvT" Content-Disposition: inline In-Reply-To: <200812031845.mB3IjcZC098534@svn.freebsd.org> User-Agent: Mutt/1.4.2.3i X-Virus-Scanned: ClamAV version 0.93.3, clamav-milter version 0.93.3 on skuns.kiev.zoral.com.ua X-Virus-Status: Clean X-Spam-Status: No, score=-4.4 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00 autolearn=ham version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on skuns.kiev.zoral.com.ua X-Virus-Scanned: mail.terabit.net.ua 1L7zUz-0008fw-Dp ccecac5f561648f2dbea7f2cce705d91 X-Terabit: YES Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r185589 - head/sys/compat/freebsd32 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 03 Dec 2008 21:43:11 -0000 --KN5l+BnMqAQyZLvT Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, Dec 03, 2008 at 06:45:38PM +0000, John Baldwin wrote: > Author: jhb > Date: Wed Dec 3 18:45:38 2008 > New Revision: 185589 > URL: http://svn.freebsd.org/changeset/base/185589 >=20 > Log: > When unloading a 32-bit system call module, restore the sysent vector in > the 32-bit system call table instead of the main system call table. >=20 > Modified: > head/sys/compat/freebsd32/freebsd32_misc.c >=20 The module build glue is not committed into the svn, isn't it ? --KN5l+BnMqAQyZLvT Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (FreeBSD) iEYEARECAAYFAkk2/WkACgkQC3+MBN1Mb4iDEACdEyTrwLRXnNRbiSu49cl6QFSR zgEAoMVbdIpDw+Dxtj4ukT5RkCmacjNe =i9JN -----END PGP SIGNATURE----- --KN5l+BnMqAQyZLvT-- From owner-svn-src-head@FreeBSD.ORG Wed Dec 3 23:00:14 2008 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 040FE1065675; Wed, 3 Dec 2008 23:00: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 DDEF08FC08; Wed, 3 Dec 2008 23:00: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 mB3N00iB003903; Wed, 3 Dec 2008 23:00:00 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mB3N0023003902; Wed, 3 Dec 2008 23:00:00 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <200812032300.mB3N0023003902@svn.freebsd.org> From: Xin LI Date: Wed, 3 Dec 2008 23:00: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: r185593 - 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, 03 Dec 2008 23:00:14 -0000 Author: delphij Date: Wed Dec 3 23:00:00 2008 New Revision: 185593 URL: http://svn.freebsd.org/changeset/base/185593 Log: Don't attempt to clear status updates if we did not do a link state change. As a side effect, this makes the excessive interrupts to disappear which has been observed as a regression in recent stable/7. Reported by: many (on -stable@) Reviewed by: davidch Modified: head/sys/dev/bce/if_bce.c Modified: head/sys/dev/bce/if_bce.c ============================================================================== --- head/sys/dev/bce/if_bce.c Wed Dec 3 22:47:33 2008 (r185592) +++ head/sys/dev/bce/if_bce.c Wed Dec 3 23:00:00 2008 (r185593) @@ -7030,13 +7030,14 @@ bce_intr(void *xsc) /* Was it a link change interrupt? */ if ((status_attn_bits & STATUS_ATTN_BITS_LINK_STATE) != - (sc->status_block->status_attn_bits_ack & STATUS_ATTN_BITS_LINK_STATE)) + (sc->status_block->status_attn_bits_ack & STATUS_ATTN_BITS_LINK_STATE)) { bce_phy_intr(sc); - /* Clear any transient status updates during link state change. */ - REG_WR(sc, BCE_HC_COMMAND, - sc->hc_command | BCE_HC_COMMAND_COAL_NOW_WO_INT); - REG_RD(sc, BCE_HC_COMMAND); + /* Clear any transient status updates during link state change. */ + REG_WR(sc, BCE_HC_COMMAND, + sc->hc_command | BCE_HC_COMMAND_COAL_NOW_WO_INT); + REG_RD(sc, BCE_HC_COMMAND); + } /* If any other attention is asserted then the chip is toast. */ if (((status_attn_bits & ~STATUS_ATTN_BITS_LINK_STATE) != From owner-svn-src-head@FreeBSD.ORG Wed Dec 3 23:00:58 2008 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1F67C1065675; Wed, 3 Dec 2008 23:00:58 +0000 (UTC) (envelope-from mlaier@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 0D4F08FC1D; Wed, 3 Dec 2008 23:00:58 +0000 (UTC) (envelope-from mlaier@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mB3N0vsi003971; Wed, 3 Dec 2008 23:00:57 GMT (envelope-from mlaier@svn.freebsd.org) Received: (from mlaier@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mB3N0vZW003970; Wed, 3 Dec 2008 23:00:57 GMT (envelope-from mlaier@svn.freebsd.org) Message-Id: <200812032300.mB3N0vZW003970@svn.freebsd.org> From: Max Laier Date: Wed, 3 Dec 2008 23:00: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: r185594 - head/sbin/newfs_msdos X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 03 Dec 2008 23:00:58 -0000 Author: mlaier Date: Wed Dec 3 23:00:57 2008 New Revision: 185594 URL: http://svn.freebsd.org/changeset/base/185594 Log: Fix build - cast off_t to (intmax_t) for printing. Modified: head/sbin/newfs_msdos/newfs_msdos.c Modified: head/sbin/newfs_msdos/newfs_msdos.c ============================================================================== --- head/sbin/newfs_msdos/newfs_msdos.c Wed Dec 3 23:00:00 2008 (r185593) +++ head/sbin/newfs_msdos/newfs_msdos.c Wed Dec 3 23:00:57 2008 (r185594) @@ -42,6 +42,7 @@ static const char rcsid[] = #include #include #include +#include #include #include #include @@ -364,7 +365,7 @@ main(int argc, char *argv[]) errx(1, "failed to create %s", fname); pos = lseek(fd, opt_create - 1, SEEK_SET); if (write(fd, "\0", 1) != 1) - errx(1, "failed to initialize %lld bytes", opt_create); + errx(1, "failed to initialize %jd bytes", (intmax_t)opt_create); pos = lseek(fd, 0, SEEK_SET); } else if ((fd = open(fname, opt_N ? O_RDONLY : O_RDWR)) == -1 || fstat(fd, &sb)) @@ -374,7 +375,7 @@ main(int argc, char *argv[]) if (!S_ISCHR(sb.st_mode)) warnx("warning, %s is not a character device", fname); if (opt_ofs && opt_ofs != lseek(fd, opt_ofs, SEEK_SET)) - errx(1, "cannot seek to %lld", opt_ofs); + errx(1, "cannot seek to %jd", (intmax_t)opt_ofs); memset(&bpb, 0, sizeof(bpb)); if (opt_f) { getstdfmt(opt_f, &bpb); From owner-svn-src-head@FreeBSD.ORG Wed Dec 3 23:09:33 2008 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id AA0EC1065677 for ; Wed, 3 Dec 2008 23:09:33 +0000 (UTC) (envelope-from max@love2party.net) Received: from moutng.kundenserver.de (moutng.kundenserver.de [212.227.126.171]) by mx1.freebsd.org (Postfix) with ESMTP id 3BF9F8FC14 for ; Wed, 3 Dec 2008 23:09:33 +0000 (UTC) (envelope-from max@love2party.net) Received: from vampire.homelinux.org (dslb-088-066-034-206.pools.arcor-ip.net [88.66.34.206]) by mrelayeu.kundenserver.de (node=mrelayeu6) with ESMTP (Nemesis) id 0ML29c-1L80qZ1h6B-0003Dm; Thu, 04 Dec 2008 00:09:31 +0100 Received: (qmail 71122 invoked from network); 3 Dec 2008 23:09:31 -0000 Received: from fbsd8.laiers.local (192.168.4.151) by router.laiers.local with SMTP; 3 Dec 2008 23:09:31 -0000 From: Max Laier Organization: FreeBSD To: Max Laier Date: Thu, 4 Dec 2008 00:09:30 +0100 User-Agent: KMail/1.10.1 (FreeBSD/8.0-CURRENT; KDE/4.1.1; i386; ; ) References: <200812032300.mB3N0vZW003970@svn.freebsd.org> In-Reply-To: <200812032300.mB3N0vZW003970@svn.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200812040009.30837.max@love2party.net> X-Provags-ID: V01U2FsdGVkX18xKtb0liMmmT20A7cbpTAkQDINmp8bKdy70yf ZsnSGEnUX4pbB6sbhZ3ZeLQbW1Rb2JYQ0qMwHRNHJ3Md4Ubq0i 8b8ozS9kk+nTmrZ7NV07g== Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r185594 - head/sbin/newfs_msdos X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 03 Dec 2008 23:09:33 -0000 On Thursday 04 December 2008 00:00:57 Max Laier wrote: > Author: mlaier > Date: Wed Dec 3 23:00:57 2008 > New Revision: 185594 > URL: http://svn.freebsd.org/changeset/base/185594 > > Log: > Fix build - cast off_t to (intmax_t) for printing. I'd really like to typedef the int64 types "long long" on all architectures :-\ It's a big POLA violation in my opinion and causes quite a bit of porting headache. Or at least let's fix printf to understand that "long" types on 64bit architectures can be printed with %ll. Since they are - in fact - 64bit wide. But I keep reiterating this point - I guess I still don't understand the exact reason why we can't just do that. -- /"\ Best regards, | mlaier@freebsd.org \ / Max Laier | ICQ #67774661 X http://pf4freebsd.love2party.net/ | mlaier@EFnet / \ ASCII Ribbon Campaign | Against HTML Mail and News From owner-svn-src-head@FreeBSD.ORG Wed Dec 3 23:20:55 2008 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 91AA61065675; Wed, 3 Dec 2008 23:20:55 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from server.baldwin.cx (bigknife-pt.tunnel.tserv9.chi1.ipv6.he.net [IPv6:2001:470:1f10:75::2]) by mx1.freebsd.org (Postfix) with ESMTP id 319F88FC1C; Wed, 3 Dec 2008 23:20:55 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from localhost.corp.yahoo.com (john@localhost [IPv6:::1]) (authenticated bits=0) by server.baldwin.cx (8.14.3/8.14.3) with ESMTP id mB3NKmb7023424; Wed, 3 Dec 2008 18:20:49 -0500 (EST) (envelope-from jhb@freebsd.org) From: John Baldwin To: Kostik Belousov Date: Wed, 3 Dec 2008 18:03:03 -0500 User-Agent: KMail/1.9.7 References: <200812031845.mB3IjcZC098534@svn.freebsd.org> <20081203214306.GC2401@deviant.kiev.zoral.com.ua> In-Reply-To: <20081203214306.GC2401@deviant.kiev.zoral.com.ua> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-15" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200812031803.03650.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH authentication, not delayed by milter-greylist-2.0.2 (server.baldwin.cx [IPv6:::1]); Wed, 03 Dec 2008 18:20:49 -0500 (EST) X-Virus-Scanned: ClamAV 0.93.1/8718/Wed Dec 3 08:29:03 2008 on server.baldwin.cx X-Virus-Status: Clean X-Spam-Status: No, score=-2.6 required=4.2 tests=AWL,BAYES_00,NO_RELAYS 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: r185589 - head/sys/compat/freebsd32 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 03 Dec 2008 23:20:55 -0000 On Wednesday 03 December 2008 04:43:06 pm Kostik Belousov wrote: > On Wed, Dec 03, 2008 at 06:45:38PM +0000, John Baldwin wrote: > > Author: jhb > > Date: Wed Dec 3 18:45:38 2008 > > New Revision: 185589 > > URL: http://svn.freebsd.org/changeset/base/185589 > > > > Log: > > When unloading a 32-bit system call module, restore the sysent vector in > > the 32-bit system call table instead of the main system call table. > > > > Modified: > > head/sys/compat/freebsd32/freebsd32_misc.c > > > The module build glue is not committed into the svn, isn't it ? Err, it is. It's in freebsd32_util.h (SYSCALL32_MODULE, etc.). -- John Baldwin From owner-svn-src-head@FreeBSD.ORG Thu Dec 4 01:58:40 2008 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BA9141065672; Thu, 4 Dec 2008 01:58:40 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id AA1568FC1B; Thu, 4 Dec 2008 01:58:40 +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 mB41wesi007263; Thu, 4 Dec 2008 01:58:40 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mB41wexs007260; Thu, 4 Dec 2008 01:58:40 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <200812040158.mB41wexs007260@svn.freebsd.org> From: Pyun YongHyeon Date: Thu, 4 Dec 2008 01:58: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: r185596 - head/sys/dev/jme X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 04 Dec 2008 01:58:40 -0000 Author: yongari Date: Thu Dec 4 01:58:40 2008 New Revision: 185596 URL: http://svn.freebsd.org/changeset/base/185596 Log: Add support for newer JMC250/JMC260 revisions. o Chip full mask revision 2 or later controllers have to set correct Tx MAC and Tx offload clock depending on negotiated link speed. o JMC260 chip full mask revision 2 has a silicon bug that can't handle 64bit DMA addressing. Add workaround to the bug by limiting DMA address space to be within 32bit. o Valid FIFO space of receive control and status register was changed on chip full mask revision 2 or later controllers. For these controllers, use default 16QW as it's supposed to be the safest value for maximum PCIe compatibility. JMicron confirmed performance will not be reduced even if the FIFO space is set to 16QW. o When interface is put into suspend/shutdown state, remove Tx MAC and Tx offload clock to save more power. We don't need Tx clock at all in this state. o Added new register definition for chip full mask revision 2 or later controllers. Thanks to JMicron for their continuous support of FreeBSD. Modified: head/sys/dev/jme/if_jme.c head/sys/dev/jme/if_jmereg.h head/sys/dev/jme/if_jmevar.h Modified: head/sys/dev/jme/if_jme.c ============================================================================== --- head/sys/dev/jme/if_jme.c Thu Dec 4 01:24:21 2008 (r185595) +++ head/sys/dev/jme/if_jme.c Thu Dec 4 01:58:40 2008 (r185596) @@ -651,6 +651,13 @@ jme_attach(device_t dev) goto fail; } + if (CHIPMODE_REVFM(sc->jme_chip_rev) >= 2) { + if ((sc->jme_rev & DEVICEID_JMC2XX_MASK) == DEVICEID_JMC260 && + CHIPMODE_REVFM(sc->jme_chip_rev) == 2) + sc->jme_flags |= JME_FLAG_DMA32BIT; + sc->jme_flags |= JME_FLAG_TXCLK; + } + /* Reset the ethernet controller. */ jme_reset(sc); @@ -1007,6 +1014,8 @@ jme_dma_alloc(struct jme_softc *sc) int error, i; lowaddr = BUS_SPACE_MAXADDR; + if ((sc->jme_flags & JME_FLAG_DMA32BIT) != 0) + lowaddr = BUS_SPACE_MAXADDR_32BIT; again: /* Create parent ring tag. */ @@ -1106,25 +1115,32 @@ again: } sc->jme_rdata.jme_rx_ring_paddr = ctx.jme_busaddr; - /* Tx/Rx descriptor queue should reside within 4GB boundary. */ - tx_ring_end = sc->jme_rdata.jme_tx_ring_paddr + JME_TX_RING_SIZE; - rx_ring_end = sc->jme_rdata.jme_rx_ring_paddr + JME_RX_RING_SIZE; - if ((JME_ADDR_HI(tx_ring_end) != - JME_ADDR_HI(sc->jme_rdata.jme_tx_ring_paddr)) || - (JME_ADDR_HI(rx_ring_end) != - JME_ADDR_HI(sc->jme_rdata.jme_rx_ring_paddr))) { - device_printf(sc->jme_dev, "4GB boundary crossed, " - "switching to 32bit DMA address mode.\n"); - jme_dma_free(sc); - /* Limit DMA address space to 32bit and try again. */ - lowaddr = BUS_SPACE_MAXADDR_32BIT; - goto again; + if (lowaddr != BUS_SPACE_MAXADDR_32BIT) { + /* Tx/Rx descriptor queue should reside within 4GB boundary. */ + tx_ring_end = sc->jme_rdata.jme_tx_ring_paddr + + JME_TX_RING_SIZE; + rx_ring_end = sc->jme_rdata.jme_rx_ring_paddr + + JME_RX_RING_SIZE; + if ((JME_ADDR_HI(tx_ring_end) != + JME_ADDR_HI(sc->jme_rdata.jme_tx_ring_paddr)) || + (JME_ADDR_HI(rx_ring_end) != + JME_ADDR_HI(sc->jme_rdata.jme_rx_ring_paddr))) { + device_printf(sc->jme_dev, "4GB boundary crossed, " + "switching to 32bit DMA address mode.\n"); + jme_dma_free(sc); + /* Limit DMA address space to 32bit and try again. */ + lowaddr = BUS_SPACE_MAXADDR_32BIT; + goto again; + } } + lowaddr = BUS_SPACE_MAXADDR; + if ((sc->jme_flags & JME_FLAG_DMA32BIT) != 0) + lowaddr = BUS_SPACE_MAXADDR_32BIT; /* Create parent buffer tag. */ error = bus_dma_tag_create(bus_get_dma_tag(sc->jme_dev),/* parent */ 1, 0, /* algnmnt, boundary */ - BUS_SPACE_MAXADDR, /* lowaddr */ + lowaddr, /* lowaddr */ BUS_SPACE_MAXADDR, /* highaddr */ NULL, NULL, /* filter, filterarg */ BUS_SPACE_MAXSIZE_32BIT, /* maxsize */ @@ -1445,6 +1461,11 @@ jme_setwol(struct jme_softc *sc) JME_LOCK_ASSERT(sc); if (pci_find_extcap(sc->jme_dev, PCIY_PMG, &pmc) != 0) { + /* Remove Tx MAC/offload clock to save more power. */ + if ((sc->jme_flags & JME_FLAG_TXCLK) != 0) + CSR_WRITE_4(sc, JME_GHC, CSR_READ_4(sc, JME_GHC) & + ~(GHC_TX_OFFLD_CLK_100 | GHC_TX_MAC_CLK_100 | + GHC_TX_OFFLD_CLK_1000 | GHC_TX_MAC_CLK_1000)); /* No PME capability, PHY power down. */ jme_miibus_writereg(sc->jme_dev, sc->jme_phyaddr, MII_BMCR, BMCR_PDOWN); @@ -1466,7 +1487,11 @@ jme_setwol(struct jme_softc *sc) CSR_WRITE_4(sc, JME_PMCS, pmcs); CSR_WRITE_4(sc, JME_GPREG0, gpr); - + /* Remove Tx MAC/offload clock to save more power. */ + if ((sc->jme_flags & JME_FLAG_TXCLK) != 0) + CSR_WRITE_4(sc, JME_GHC, CSR_READ_4(sc, JME_GHC) & + ~(GHC_TX_OFFLD_CLK_100 | GHC_TX_MAC_CLK_100 | + GHC_TX_OFFLD_CLK_1000 | GHC_TX_MAC_CLK_1000)); /* Request PME. */ pmstat = pci_read_config(sc->jme_dev, pmc + PCIR_POWER_STATUS, 2); pmstat &= ~(PCIM_PSTAT_PME | PCIM_PSTAT_PMEENABLE); @@ -1941,6 +1966,7 @@ jme_mac_config(struct jme_softc *sc) { struct mii_data *mii; uint32_t ghc, gpreg, rxmac, txmac, txpause; + uint32_t txclk; JME_LOCK_ASSERT(sc); @@ -1950,6 +1976,7 @@ jme_mac_config(struct jme_softc *sc) DELAY(10); CSR_WRITE_4(sc, JME_GHC, 0); ghc = 0; + txclk = 0; rxmac = CSR_READ_4(sc, JME_RXMAC); rxmac &= ~RXMAC_FC_ENB; txmac = CSR_READ_4(sc, JME_TXMAC); @@ -1982,14 +2009,17 @@ jme_mac_config(struct jme_softc *sc) switch (IFM_SUBTYPE(mii->mii_media_active)) { case IFM_10_T: ghc |= GHC_SPEED_10; + txclk |= GHC_TX_OFFLD_CLK_100 | GHC_TX_MAC_CLK_100; break; case IFM_100_TX: ghc |= GHC_SPEED_100; + txclk |= GHC_TX_OFFLD_CLK_100 | GHC_TX_MAC_CLK_100; break; case IFM_1000_T: if ((sc->jme_flags & JME_FLAG_FASTETH) != 0) break; ghc |= GHC_SPEED_1000; + txclk |= GHC_TX_OFFLD_CLK_1000 | GHC_TX_MAC_CLK_1000; if ((IFM_OPTIONS(mii->mii_media_active) & IFM_FDX) == 0) txmac |= TXMAC_CARRIER_EXT | TXMAC_FRAME_BURST; break; @@ -2019,6 +2049,8 @@ jme_mac_config(struct jme_softc *sc) 0x1B, 0x0004); } } + if ((sc->jme_flags & JME_FLAG_TXCLK) != 0) + ghc |= txclk; CSR_WRITE_4(sc, JME_GHC, ghc); CSR_WRITE_4(sc, JME_RXMAC, rxmac); CSR_WRITE_4(sc, JME_TXMAC, txmac); @@ -2637,13 +2669,19 @@ jme_init_locked(struct jme_softc *sc) * decrease FIFO threshold to reduce the FIFO overruns for * frames larger than 4000 bytes. * For best performance of standard MTU sized frames use - * maximum allowable FIFO threshold, 128QW. + * maximum allowable FIFO threshold, 128QW. Note these do + * not hold on chip full mask verion >=2. For these + * controllers 64QW and 128QW are not valid value. */ - if ((ifp->if_mtu + ETHER_HDR_LEN + ETHER_VLAN_ENCAP_LEN + - ETHER_CRC_LEN) > JME_RX_FIFO_SIZE) + if (CHIPMODE_REVFM(sc->jme_chip_rev) >= 2) sc->jme_rxcsr |= RXCSR_FIFO_THRESH_16QW; - else - sc->jme_rxcsr |= RXCSR_FIFO_THRESH_128QW; + else { + if ((ifp->if_mtu + ETHER_HDR_LEN + ETHER_VLAN_ENCAP_LEN + + ETHER_CRC_LEN) > JME_RX_FIFO_SIZE) + sc->jme_rxcsr |= RXCSR_FIFO_THRESH_16QW; + else + sc->jme_rxcsr |= RXCSR_FIFO_THRESH_128QW; + } sc->jme_rxcsr |= sc->jme_rx_dma_size | RXCSR_RXQ_N_SEL(RXCSR_RXQ0); sc->jme_rxcsr |= RXCSR_DESC_RT_CNT(RXCSR_DESC_RT_CNT_DEFAULT); sc->jme_rxcsr |= RXCSR_DESC_RT_GAP_256 & RXCSR_DESC_RT_GAP_MASK; Modified: head/sys/dev/jme/if_jmereg.h ============================================================================== --- head/sys/dev/jme/if_jmereg.h Thu Dec 4 01:24:21 2008 (r185595) +++ head/sys/dev/jme/if_jmereg.h Thu Dec 4 01:58:40 2008 (r185596) @@ -239,8 +239,8 @@ #define RXCSR_FIFO_FTHRESH_MASK 0x30000000 #define RXCSR_FIFO_THRESH_16QW 0x00000000 #define RXCSR_FIFO_THRESH_32QW 0x04000000 -#define RXCSR_FIFO_THRESH_64QW 0x08000000 -#define RXCSR_FIFO_THRESH_128QW 0x0C000000 +#define RXCSR_FIFO_THRESH_64QW 0x08000000 /* JMC250/JMC260 REVFM < 2 */ +#define RXCSR_FIFO_THRESH_128QW 0x0C000000 /* JMC250/JMC260 REVFM < 2 */ #define RXCSR_FIFO_THRESH_MASK 0x0C000000 #define RXCSR_DMA_SIZE_16 0x00000000 #define RXCSR_DMA_SIZE_32 0x01000000 @@ -357,6 +357,16 @@ #define JME_GHC 0x0054 #define GHC_LOOPBACK 0x80000000 #define GHC_RESET 0x40000000 +#define GHC_RX_DMA_PWR_DIS 0x04000000 /* JMC250 REVFM >= 2 */ +#define GHC_FIFO_RD_PWR_DIS 0x02000000 /* JMC250 REVFM >= 2 */ +#define GHC_FIFO_WR_PWR_DIS 0x01000000 /* JMC250 REVFM >= 2 */ +#define GHC_TX_OFFLD_CLK_100 0x00800000 /* JMC250/JMC260 REVFM >= 2 */ +#define GHC_TX_OFFLD_CLK_1000 0x00400000 /* JMC250/JMC260 REVFM >= 2 */ +#define GHC_TX_OFFLD_CLK_DIS 0x00000000 /* JMC250/JMC260 REVFM >= 2 */ +#define GHC_TX_MAC_CLK_100 0x00200000 /* JMC250/JMC260 REVFM >= 2 */ +#define GHC_TX_MAC_CLK_1000 0x00100000 /* JMC250/JMC260 REVFM >= 2 */ +#define GHC_TX_MAC_CLK_DIS 0x00000000 /* JMC250/JMC260 REVFM >= 2 */ +#define GHC_AUTO_PHY_STAT_DIS 0x00000080 /* JMC250/JMC260 REVFM >= 2 */ #define GHC_FULL_DUPLEX 0x00000040 #define GHC_SPEED_UNKNOWN 0x00000000 #define GHC_SPEED_10 0x00000010 @@ -755,6 +765,10 @@ #define CHIPMODE_MODE_128P_MAC 0x00000003 #define CHIPMODE_MODE_128P_DBG 0x00000002 #define CHIPMODE_MODE_128P_PHY 0x00000000 +/* Chip full mask revision. */ +#define CHIPMODE_REVFM(x) ((x) & 0x0F) +/* Chip ECO revision. */ +#define CHIPMODE_REVECO(x) (((x) >> 4) & 0x0F) /* Shadow status base address high/low. */ #define JME_SHBASE_ADDR_HI 0x0848 Modified: head/sys/dev/jme/if_jmevar.h ============================================================================== --- head/sys/dev/jme/if_jmevar.h Thu Dec 4 01:24:21 2008 (r185595) +++ head/sys/dev/jme/if_jmevar.h Thu Dec 4 01:58:40 2008 (r185596) @@ -181,6 +181,8 @@ struct jme_softc { #define JME_FLAG_PMCAP 0x0020 #define JME_FLAG_FASTETH 0x0040 #define JME_FLAG_NOJUMBO 0x0080 +#define JME_FLAG_TXCLK 0x0100 +#define JME_FLAG_DMA32BIT 0x0200 #define JME_FLAG_DETACH 0x4000 #define JME_FLAG_LINK 0x8000 From owner-svn-src-head@FreeBSD.ORG Thu Dec 4 02:16:55 2008 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2499D1065670; Thu, 4 Dec 2008 02:16:55 +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 136DB8FC13; Thu, 4 Dec 2008 02:16:54 +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 mB42Grcd007644; Thu, 4 Dec 2008 02:16:53 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mB42Gr1S007641; Thu, 4 Dec 2008 02:16:53 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <200812040216.mB42Gr1S007641@svn.freebsd.org> From: Pyun YongHyeon Date: Thu, 4 Dec 2008 02:16: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: r185597 - head/sys/dev/jme X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 04 Dec 2008 02:16:55 -0000 Author: yongari Date: Thu Dec 4 02:16:53 2008 New Revision: 185597 URL: http://svn.freebsd.org/changeset/base/185597 Log: Add HW MAC counter support for newer JMC250/JMC260 revisions. Modified: head/sys/dev/jme/if_jme.c head/sys/dev/jme/if_jmereg.h head/sys/dev/jme/if_jmevar.h Modified: head/sys/dev/jme/if_jme.c ============================================================================== --- head/sys/dev/jme/if_jme.c Thu Dec 4 01:58:40 2008 (r185596) +++ head/sys/dev/jme/if_jme.c Thu Dec 4 02:16:53 2008 (r185597) @@ -150,6 +150,9 @@ static void jme_init_ssb(struct jme_soft static int jme_newbuf(struct jme_softc *, struct jme_rxdesc *); static void jme_set_vlan(struct jme_softc *); static void jme_set_filter(struct jme_softc *); +static void jme_stats_clear(struct jme_softc *); +static void jme_stats_save(struct jme_softc *); +static void jme_stats_update(struct jme_softc *); static int sysctl_int_range(SYSCTL_HANDLER_ARGS, int, int); static int sysctl_hw_jme_tx_coal_to(SYSCTL_HANDLER_ARGS); static int sysctl_hw_jme_tx_coal_pkt(SYSCTL_HANDLER_ARGS); @@ -656,6 +659,7 @@ jme_attach(device_t dev) CHIPMODE_REVFM(sc->jme_chip_rev) == 2) sc->jme_flags |= JME_FLAG_DMA32BIT; sc->jme_flags |= JME_FLAG_TXCLK; + sc->jme_flags |= JME_FLAG_HWMIB; } /* Reset the ethernet controller. */ @@ -887,35 +891,41 @@ jme_detach(device_t dev) return (0); } +#define JME_SYSCTL_STAT_ADD32(c, h, n, p, d) \ + SYSCTL_ADD_UINT(c, h, OID_AUTO, n, CTLFLAG_RD, p, 0, d) + static void jme_sysctl_node(struct jme_softc *sc) { + struct sysctl_ctx_list *ctx; + struct sysctl_oid_list *child, *parent; + struct sysctl_oid *tree; + struct jme_hw_stats *stats; int error; - SYSCTL_ADD_PROC(device_get_sysctl_ctx(sc->jme_dev), - SYSCTL_CHILDREN(device_get_sysctl_tree(sc->jme_dev)), OID_AUTO, - "tx_coal_to", CTLTYPE_INT | CTLFLAG_RW, &sc->jme_tx_coal_to, - 0, sysctl_hw_jme_tx_coal_to, "I", "jme tx coalescing timeout"); - - SYSCTL_ADD_PROC(device_get_sysctl_ctx(sc->jme_dev), - SYSCTL_CHILDREN(device_get_sysctl_tree(sc->jme_dev)), OID_AUTO, - "tx_coal_pkt", CTLTYPE_INT | CTLFLAG_RW, &sc->jme_tx_coal_pkt, - 0, sysctl_hw_jme_tx_coal_pkt, "I", "jme tx coalescing packet"); - - SYSCTL_ADD_PROC(device_get_sysctl_ctx(sc->jme_dev), - SYSCTL_CHILDREN(device_get_sysctl_tree(sc->jme_dev)), OID_AUTO, - "rx_coal_to", CTLTYPE_INT | CTLFLAG_RW, &sc->jme_rx_coal_to, - 0, sysctl_hw_jme_rx_coal_to, "I", "jme rx coalescing timeout"); - - SYSCTL_ADD_PROC(device_get_sysctl_ctx(sc->jme_dev), - SYSCTL_CHILDREN(device_get_sysctl_tree(sc->jme_dev)), OID_AUTO, - "rx_coal_pkt", CTLTYPE_INT | CTLFLAG_RW, &sc->jme_rx_coal_pkt, - 0, sysctl_hw_jme_rx_coal_pkt, "I", "jme rx coalescing packet"); - - SYSCTL_ADD_PROC(device_get_sysctl_ctx(sc->jme_dev), - SYSCTL_CHILDREN(device_get_sysctl_tree(sc->jme_dev)), OID_AUTO, - "process_limit", CTLTYPE_INT | CTLFLAG_RW, &sc->jme_process_limit, - 0, sysctl_hw_jme_proc_limit, "I", + stats = &sc->jme_stats; + ctx = device_get_sysctl_ctx(sc->jme_dev); + child = SYSCTL_CHILDREN(device_get_sysctl_tree(sc->jme_dev)); + + SYSCTL_ADD_PROC(ctx, child, OID_AUTO, "tx_coal_to", + CTLTYPE_INT | CTLFLAG_RW, &sc->jme_tx_coal_to, 0, + sysctl_hw_jme_tx_coal_to, "I", "jme tx coalescing timeout"); + + SYSCTL_ADD_PROC(ctx, child, OID_AUTO, "tx_coal_pkt", + CTLTYPE_INT | CTLFLAG_RW, &sc->jme_tx_coal_pkt, 0, + sysctl_hw_jme_tx_coal_pkt, "I", "jme tx coalescing packet"); + + SYSCTL_ADD_PROC(ctx, child, OID_AUTO, "rx_coal_to", + CTLTYPE_INT | CTLFLAG_RW, &sc->jme_rx_coal_to, 0, + sysctl_hw_jme_rx_coal_to, "I", "jme rx coalescing timeout"); + + SYSCTL_ADD_PROC(ctx, child, OID_AUTO, "rx_coal_pkt", + CTLTYPE_INT | CTLFLAG_RW, &sc->jme_rx_coal_pkt, 0, + sysctl_hw_jme_rx_coal_pkt, "I", "jme rx coalescing packet"); + + SYSCTL_ADD_PROC(ctx, child, OID_AUTO, "process_limit", + CTLTYPE_INT | CTLFLAG_RW, &sc->jme_process_limit, 0, + sysctl_hw_jme_proc_limit, "I", "max number of Rx events to process"); /* Pull in device tunables. */ @@ -984,8 +994,43 @@ jme_sysctl_node(struct jme_softc *sc) sc->jme_rx_coal_pkt = PCCRX_COAL_PKT_DEFAULT; } } + + if ((sc->jme_flags & JME_FLAG_HWMIB) == 0) + return; + + tree = SYSCTL_ADD_NODE(ctx, child, OID_AUTO, "stats", CTLFLAG_RD, + NULL, "JME statistics"); + parent = SYSCTL_CHILDREN(tree); + + /* Rx statistics. */ + tree = SYSCTL_ADD_NODE(ctx, parent, OID_AUTO, "rx", CTLFLAG_RD, + NULL, "Rx MAC statistics"); + child = SYSCTL_CHILDREN(tree); + JME_SYSCTL_STAT_ADD32(ctx, child, "good_frames", + &stats->rx_good_frames, "Good frames"); + JME_SYSCTL_STAT_ADD32(ctx, child, "crc_errs", + &stats->rx_crc_errs, "CRC errors"); + JME_SYSCTL_STAT_ADD32(ctx, child, "mii_errs", + &stats->rx_mii_errs, "MII errors"); + JME_SYSCTL_STAT_ADD32(ctx, child, "fifo_oflows", + &stats->rx_fifo_oflows, "FIFO overflows"); + JME_SYSCTL_STAT_ADD32(ctx, child, "desc_empty", + &stats->rx_desc_empty, "Descriptor empty"); + JME_SYSCTL_STAT_ADD32(ctx, child, "bad_frames", + &stats->rx_bad_frames, "Bad frames"); + + /* Tx statistics. */ + tree = SYSCTL_ADD_NODE(ctx, parent, OID_AUTO, "tx", CTLFLAG_RD, + NULL, "Tx MAC statistics"); + child = SYSCTL_CHILDREN(tree); + JME_SYSCTL_STAT_ADD32(ctx, child, "good_frames", + &stats->tx_good_frames, "Good frames"); + JME_SYSCTL_STAT_ADD32(ctx, child, "bad_frames", + &stats->tx_bad_frames, "Bad frames"); } +#undef JME_SYSCTL_STAT_ADD32 + struct jme_dmamap_arg { bus_addr_t jme_busaddr; }; @@ -2164,6 +2209,7 @@ jme_link_task(void *arg, int pending) /* Program MAC with resolved speed/duplex/flow-control. */ if ((sc->jme_flags & JME_FLAG_LINK) != 0) { jme_mac_config(sc); + jme_stats_clear(sc); CSR_WRITE_4(sc, JME_RXCSR, sc->jme_rxcsr); CSR_WRITE_4(sc, JME_TXCSR, sc->jme_txcsr); @@ -2553,6 +2599,7 @@ jme_tick(void *arg) * faster and limit the maximum delay to a hz. */ jme_txeof(sc); + jme_stats_update(sc); jme_watchdog(sc); callout_reset(&sc->jme_tick_ch, hz, jme_tick, sc); } @@ -2862,6 +2909,8 @@ jme_stop(struct jme_softc *sc) txd->tx_ndesc = 0; } } + jme_stats_update(sc); + jme_stats_save(sc); } static void @@ -3093,6 +3142,76 @@ jme_set_filter(struct jme_softc *sc) CSR_WRITE_4(sc, JME_RXMAC, rxcfg); } +static void +jme_stats_clear(struct jme_softc *sc) +{ + + JME_LOCK_ASSERT(sc); + + if ((sc->jme_flags & JME_FLAG_HWMIB) == 0) + return; + + /* Disable and clear counters. */ + CSR_WRITE_4(sc, JME_STATCSR, 0xFFFFFFFF); + /* Activate hw counters. */ + CSR_WRITE_4(sc, JME_STATCSR, 0); + CSR_READ_4(sc, JME_STATCSR); + bzero(&sc->jme_stats, sizeof(struct jme_hw_stats)); +} + +static void +jme_stats_save(struct jme_softc *sc) +{ + + JME_LOCK_ASSERT(sc); + + if ((sc->jme_flags & JME_FLAG_HWMIB) == 0) + return; + /* Save current counters. */ + bcopy(&sc->jme_stats, &sc->jme_ostats, sizeof(struct jme_hw_stats)); + /* Disable and clear counters. */ + CSR_WRITE_4(sc, JME_STATCSR, 0xFFFFFFFF); +} + +static void +jme_stats_update(struct jme_softc *sc) +{ + struct jme_hw_stats *stat, *ostat; + uint32_t reg; + + JME_LOCK_ASSERT(sc); + + if ((sc->jme_flags & JME_FLAG_HWMIB) == 0) + return; + stat = &sc->jme_stats; + ostat = &sc->jme_ostats; + stat->tx_good_frames = CSR_READ_4(sc, JME_STAT_TXGOOD); + stat->rx_good_frames = CSR_READ_4(sc, JME_STAT_RXGOOD); + reg = CSR_READ_4(sc, JME_STAT_CRCMII); + stat->rx_crc_errs = (reg & STAT_RX_CRC_ERR_MASK) >> + STAT_RX_CRC_ERR_SHIFT; + stat->rx_mii_errs = (reg & STAT_RX_MII_ERR_MASK) >> + STAT_RX_MII_ERR_SHIFT; + reg = CSR_READ_4(sc, JME_STAT_RXERR); + stat->rx_fifo_oflows = (reg & STAT_RXERR_OFLOW_MASK) >> + STAT_RXERR_OFLOW_SHIFT; + stat->rx_desc_empty = (reg & STAT_RXERR_MPTY_MASK) >> + STAT_RXERR_MPTY_SHIFT; + reg = CSR_READ_4(sc, JME_STAT_FAIL); + stat->rx_bad_frames = (reg & STAT_FAIL_RX_MASK) >> STAT_FAIL_RX_SHIFT; + stat->tx_bad_frames = (reg & STAT_FAIL_TX_MASK) >> STAT_FAIL_TX_SHIFT; + + /* Account for previous counters. */ + stat->rx_good_frames += ostat->rx_good_frames; + stat->rx_crc_errs += ostat->rx_crc_errs; + stat->rx_mii_errs += ostat->rx_mii_errs; + stat->rx_fifo_oflows += ostat->rx_fifo_oflows; + stat->rx_desc_empty += ostat->rx_desc_empty; + stat->rx_bad_frames += ostat->rx_bad_frames; + stat->tx_good_frames += ostat->tx_good_frames; + stat->tx_bad_frames += ostat->tx_bad_frames; +} + static int sysctl_int_range(SYSCTL_HANDLER_ARGS, int low, int high) { Modified: head/sys/dev/jme/if_jmereg.h ============================================================================== --- head/sys/dev/jme/if_jmereg.h Thu Dec 4 01:58:40 2008 (r185596) +++ head/sys/dev/jme/if_jmereg.h Thu Dec 4 02:16:53 2008 (r185597) @@ -199,6 +199,7 @@ #define TXMAC_IFG2_DEFAULT 0x40000000 #define TXMAC_IFG1_MASK 0x30000000 #define TXMAC_IFG1_DEFAULT 0x20000000 +#define TXMAC_PAUSE_CNT_MASK 0x00FF0000 #define TXMAC_THRESH_1_PKT 0x00000300 #define TXMAC_THRESH_1_2_PKT 0x00000200 #define TXMAC_THRESH_1_4_PKT 0x00000100 @@ -403,6 +404,44 @@ #define PMCS_MAGIC_FRAME_ENB 0x00000001 #define PMCS_WOL_ENB_MASK 0x0000FFFF +/* + * Statistic registers control and status. + * These statistics registers are valid only for JMC250/JMC260 REVFM >= 2. + */ +#define JME_STATCSR 0x0064 +#define STATCSR_RXMPT_DIS 0x00000080 +#define STATCSR_OFLOW_DIS 0x00000040 +#define STATCSR_MIIRXER_DIS 0x00000020 +#define STATCSR_CRCERR_DIS 0x00000010 +#define STATCSR_RXBAD_DIS 0x00000008 +#define STATCSR_RXGOOD_DIS 0x00000004 +#define STATCSR_TXBAD_DIS 0x00000002 +#define STATCSR_TXGOOD_DIS 0x00000001 + +#define JME_STAT_TXGOOD 0x0068 + +#define JME_STAT_RXGOOD 0x006C + +#define JME_STAT_CRCMII 0x0070 +#define STAT_RX_CRC_ERR_MASK 0xFFFF0000 +#define STAT_RX_MII_ERR_MASK 0x0000FFFF +#define STAT_RX_CRC_ERR_SHIFT 16 +#define STAT_RX_MII_ERR_SHIFT 0 + +#define JME_STAT_RXERR 0x0074 +#define STAT_RXERR_OFLOW_MASK 0xFFFF0000 +#define STAT_RXERR_MPTY_MASK 0x0000FFFF +#define STAT_RXERR_OFLOW_SHIFT 16 +#define STAT_RXERR_MPTY_SHIFT 0 + +#define JME_STAT_RESERVED1 0x0078 + +#define JME_STAT_FAIL 0x007C +#define STAT_FAIL_RX_MASK 0xFFFF0000 +#define STAT_FAIL_TX_MASK 0x0000FFFF +#define STAT_FAIL_RX_SHIFT 16 +#define STAT_FAIL_TX_SHIFT 0 + /* Giga PHY & EEPROM registers. */ #define JME_PHY_EEPROM_BASE_ADDR 0x0400 Modified: head/sys/dev/jme/if_jmevar.h ============================================================================== --- head/sys/dev/jme/if_jmevar.h Thu Dec 4 01:58:40 2008 (r185596) +++ head/sys/dev/jme/if_jmevar.h Thu Dec 4 02:16:53 2008 (r185597) @@ -154,6 +154,18 @@ struct jme_ring_data { (sizeof(struct jme_desc) * JME_RX_RING_CNT) #define JME_SSB_SIZE sizeof(struct jme_ssb) +/* Statistics counters. */ +struct jme_hw_stats { + uint32_t rx_good_frames; + uint32_t rx_crc_errs; + uint32_t rx_mii_errs; + uint32_t rx_fifo_oflows; + uint32_t rx_desc_empty; + uint32_t rx_bad_frames; + uint32_t tx_good_frames; + uint32_t tx_bad_frames; +}; + /* * Software state per device. */ @@ -183,9 +195,12 @@ struct jme_softc { #define JME_FLAG_NOJUMBO 0x0080 #define JME_FLAG_TXCLK 0x0100 #define JME_FLAG_DMA32BIT 0x0200 +#define JME_FLAG_HWMIB 0x0400 #define JME_FLAG_DETACH 0x4000 #define JME_FLAG_LINK 0x8000 + struct jme_hw_stats jme_ostats; + struct jme_hw_stats jme_stats; struct callout jme_tick_ch; struct jme_chain_data jme_cdata; struct jme_ring_data jme_rdata; From owner-svn-src-head@FreeBSD.ORG Thu Dec 4 07:28:13 2008 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7A37C1065670; Thu, 4 Dec 2008 07:28:13 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 67D598FC08; Thu, 4 Dec 2008 07:28:13 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mB47SDSj014169; Thu, 4 Dec 2008 07:28:13 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mB47SDqL014168; Thu, 4 Dec 2008 07:28:13 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200812040728.mB47SDqL014168@svn.freebsd.org> From: Kip Macy Date: Thu, 4 Dec 2008 07:28:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185604 - 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, 04 Dec 2008 07:28:13 -0000 Author: kmacy Date: Thu Dec 4 07:28:13 2008 New Revision: 185604 URL: http://svn.freebsd.org/changeset/base/185604 Log: fix initialization for case of normal kernbase remove unused shutdown code Modified: head/sys/i386/xen/xen_machdep.c Modified: head/sys/i386/xen/xen_machdep.c ============================================================================== --- head/sys/i386/xen/xen_machdep.c Thu Dec 4 05:19:49 2008 (r185603) +++ head/sys/i386/xen/xen_machdep.c Thu Dec 4 07:28:13 2008 (r185604) @@ -36,8 +36,10 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include +#include #include #include #include @@ -61,7 +63,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include #include @@ -851,6 +852,37 @@ initvalues(start_info_t *startinfo) xen_start_info = startinfo; xen_phys_machine = (xen_pfn_t *)startinfo->mfn_list; + IdlePTD = (pd_entry_t *)((uint8_t *)startinfo->pt_base + PAGE_SIZE); + l1_pages = 0; + +#ifdef PAE + l3_pages = 1; + l2_pages = 0; + IdlePDPT = (pd_entry_t *)startinfo->pt_base; + IdlePDPTma = xpmap_ptom(VTOP(startinfo->pt_base)); + for (i = (KERNBASE >> 30); + (i < 4) && (IdlePDPT[i] != 0); i++) + l2_pages++; + /* + * Note that only one page directory has been allocated at this point. + * Thus, if KERNBASE + */ + for (i = 0; i < l2_pages; i++) + IdlePTDma[i] = xpmap_ptom(VTOP(IdlePTD + i*PAGE_SIZE)); + + l2_pages = (l2_pages == 0) ? 1 : l2_pages; +#else + l3_pages = 0; + l2_pages = 1; +#endif + for (i = (((KERNBASE>>18) & PAGE_MASK)>>PAGE_SHIFT); + (i>PDRSHIFT)); i++) { + + if (IdlePTD[i] == 0) + break; + l1_pages++; + } + /* number of pages allocated after the pts + 1*/; cur_space = xen_start_info->pt_base + ((xen_start_info->nr_pt_frames) + 3 )*PAGE_SIZE; @@ -1123,220 +1155,6 @@ trap_info_t trap_table[] = { }; -static void -shutdown_handler(struct xenbus_watch *watch, - const char **vec, unsigned int len) -{ - char *str; - struct xenbus_transaction xbt; - int err, howto; - struct reboot_args uap; - - howto = 0; - - again: - err = xenbus_transaction_start(&xbt); - if (err) - return; - str = (char *)xenbus_read(xbt, "control", "shutdown", NULL); - /* Ignore read errors and empty reads. */ - if (XENBUS_IS_ERR_READ(str)) { - xenbus_transaction_end(xbt, 1); - return; - } - - xenbus_write(xbt, "control", "shutdown", ""); - - err = xenbus_transaction_end(xbt, 0); - if (err == EAGAIN) { - free(str, M_DEVBUF); - goto again; - } - - if (strcmp(str, "reboot") == 0) - howto = 0; - else if (strcmp(str, "poweroff") == 0) - howto |= (RB_POWEROFF | RB_HALT); - else if (strcmp(str, "halt") == 0) - howto |= RB_HALT; - else if (strcmp(str, "suspend") == 0) - howto = -1; - else { - printf("Ignoring shutdown request: %s\n", str); - goto done; - } -#ifdef notyet - if (howto == -1) { - do_suspend(NULL); - goto done; - } -#else - if (howto == -1) { - printf("suspend not currently supported\n"); - goto done; - } -#endif - uap.opt = howto; - reboot(curthread, &uap); - done: - free(str, M_DEVBUF); -} - -static struct xenbus_watch shutdown_watch = { - .node = "control/shutdown", - .callback = shutdown_handler -}; - - -void setup_shutdown_watcher(void *unused); - - -void -setup_shutdown_watcher(void *unused) -{ - if (register_xenbus_watch(&shutdown_watch)) - printf("Failed to set shutdown watcher\n"); -} - - -SYSINIT(shutdown, SI_SUB_RUN_SCHEDULER, SI_ORDER_ANY, setup_shutdown_watcher, NULL); - -#ifdef notyet - -static void -xen_suspend(void *ignore) -{ - int i, j, k, fpp; - - extern void time_resume(void); - extern unsigned long max_pfn; - extern unsigned long *pfn_to_mfn_frame_list_list; - extern unsigned long *pfn_to_mfn_frame_list[]; - -#ifdef CONFIG_SMP -#error "do_suspend must be run cpu 0 - need to create separate thread" - cpumask_t prev_online_cpus; - int vcpu_prepare(int vcpu); -#endif - - int err = 0; - - PANIC_IF(smp_processor_id() != 0); - -#if defined(CONFIG_SMP) && !defined(CONFIG_HOTPLUG_CPU) - if (num_online_cpus() > 1) { - printk(KERN_WARNING "Can't suspend SMP guests " - "without CONFIG_HOTPLUG_CPU\n"); - return -EOPNOTSUPP; - } -#endif - - xenbus_suspend(); - -#ifdef CONFIG_SMP - lock_cpu_hotplug(); - /* - * Take all other CPUs offline. We hold the hotplug semaphore to - * avoid other processes bringing up CPUs under our feet. - */ - cpus_clear(prev_online_cpus); - while (num_online_cpus() > 1) { - for_each_online_cpu(i) { - if (i == 0) - continue; - unlock_cpu_hotplug(); - err = cpu_down(i); - lock_cpu_hotplug(); - if (err != 0) { - printk(KERN_CRIT "Failed to take all CPUs " - "down: %d.\n", err); - goto out_reenable_cpus; - } - cpu_set(i, prev_online_cpus); - } - } -#endif /* CONFIG_SMP */ - - preempt_disable(); - - - __cli(); - preempt_enable(); -#ifdef SMP - unlock_cpu_hotplug(); -#endif - gnttab_suspend(); - - pmap_kremove(HYPERVISOR_shared_info); - - xen_start_info->store_mfn = mfn_to_pfn(xen_start_info->store_mfn); - xen_start_info->console.domU.mfn = mfn_to_pfn(xen_start_info->console.domU.mfn); - - /* - * We'll stop somewhere inside this hypercall. When it returns, - * we'll start resuming after the restore. - */ - HYPERVISOR_suspend(VTOMFN(xen_start_info)); - - pmap_kenter_ma(HYPERVISOR_shared_info, xen_start_info->shared_info); - set_fixmap(FIX_SHARED_INFO, xen_start_info->shared_info); - -#if 0 - memset(empty_zero_page, 0, PAGE_SIZE); -#endif - HYPERVISOR_shared_info->arch.pfn_to_mfn_frame_list_list = - VTOMFN(pfn_to_mfn_frame_list_list); - - fpp = PAGE_SIZE/sizeof(unsigned long); - for (i = 0, j = 0, k = -1; i < max_pfn; i += fpp, j++) { - if ((j % fpp) == 0) { - k++; - pfn_to_mfn_frame_list_list[k] = - VTOMFN(pfn_to_mfn_frame_list[k]); - j = 0; - } - pfn_to_mfn_frame_list[k][j] = - VTOMFN(&phys_to_machine_mapping[i]); - } - HYPERVISOR_shared_info->arch.max_pfn = max_pfn; - - gnttab_resume(); - - irq_resume(); - - time_resume(); - - __sti(); - - xencons_resume(); - -#ifdef CONFIG_SMP - for_each_cpu(i) - vcpu_prepare(i); - -#endif - /* - * Only resume xenbus /after/ we've prepared our VCPUs; otherwise - * the VCPU hotplug callback can race with our vcpu_prepare - */ - xenbus_resume(); - -#ifdef CONFIG_SMP - out_reenable_cpus: - for_each_cpu_mask(i, prev_online_cpus) { - j = cpu_up(i); - if ((j != 0) && !cpu_online(i)) { - printk(KERN_CRIT "Failed to bring cpu " - "%d back up (%d).\n", - i, j); - err = j; - } - } -#endif - return err; -} - -#endif /* notyet */ /********** CODE WORTH KEEPING ABOVE HERE *****************/ void xen_failsafe_handler(void); From owner-svn-src-head@FreeBSD.ORG Thu Dec 4 07:59:06 2008 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 194D7106564A; Thu, 4 Dec 2008 07:59:06 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 047938FC08; Thu, 4 Dec 2008 07:59:06 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mB47x58e014903; Thu, 4 Dec 2008 07:59:05 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mB47x5Pq014899; Thu, 4 Dec 2008 07:59:05 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200812040759.mB47x5Pq014899@svn.freebsd.org> From: Kip Macy Date: Thu, 4 Dec 2008 07:59: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: r185605 - in head/sys: conf dev/xen/blkfront dev/xen/netfront i386/include/xen i386/xen xen xen/xenbus X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 04 Dec 2008 07:59:06 -0000 Author: kmacy Date: Thu Dec 4 07:59:05 2008 New Revision: 185605 URL: http://svn.freebsd.org/changeset/base/185605 Log: Integrate 185578 from dfr Use newbus to managed devices Added: head/sys/xen/xenbus/xenbus_if.m (contents, props changed) head/sys/xen/xenbus/xenbusvar.h (contents, props changed) Deleted: head/sys/i386/include/xen/xenbus.h Modified: head/sys/conf/files head/sys/dev/xen/blkfront/blkfront.c head/sys/dev/xen/blkfront/block.h head/sys/dev/xen/netfront/netfront.c head/sys/i386/xen/xen_machdep.c head/sys/xen/gnttab.c head/sys/xen/gnttab.h head/sys/xen/xenbus/xenbus_client.c head/sys/xen/xenbus/xenbus_comms.c head/sys/xen/xenbus/xenbus_comms.h head/sys/xen/xenbus/xenbus_dev.c head/sys/xen/xenbus/xenbus_probe.c head/sys/xen/xenbus/xenbus_probe_backend.c head/sys/xen/xenbus/xenbus_xs.c Modified: head/sys/conf/files ============================================================================== --- head/sys/conf/files Thu Dec 4 07:28:13 2008 (r185604) +++ head/sys/conf/files Thu Dec 4 07:59:05 2008 (r185605) @@ -2763,10 +2763,14 @@ xen/evtchn/evtchn_dev.c o xen/xenbus/xenbus_client.c optional xen xen/xenbus/xenbus_comms.c optional xen xen/xenbus/xenbus_dev.c optional xen +xen/xenbus/xenbus_if.m optional xen xen/xenbus/xenbus_probe.c optional xen -xen/xenbus/xenbus_probe_backend.c optional xen +#xen/xenbus/xenbus_probe_backend.c optional xen xen/xenbus/xenbus_xs.c optional xen dev/xen/console/console.c optional xen dev/xen/console/xencons_ring.c optional xen dev/xen/blkfront/blkfront.c optional xen dev/xen/netfront/netfront.c optional xen +#dev/xen/xenpci/xenpci.c optional xen +#xen/xenbus/xenbus_newbus.c optional xenhvm + Modified: head/sys/dev/xen/blkfront/blkfront.c ============================================================================== --- head/sys/dev/xen/blkfront/blkfront.c Thu Dec 4 07:28:13 2008 (r185604) +++ head/sys/dev/xen/blkfront/blkfront.c Thu Dec 4 07:59:05 2008 (r185605) @@ -43,9 +43,10 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include +#include +#include #include #include @@ -53,15 +54,17 @@ __FBSDID("$FreeBSD$"); #include +#include "xenbus_if.h" + #define ASSERT(S) KASSERT(S, (#S)) /* prototypes */ struct xb_softc; static void xb_startio(struct xb_softc *sc); -static void connect(struct blkfront_info *); -static void blkfront_closing(struct xenbus_device *); -static int blkfront_remove(struct xenbus_device *); -static int talk_to_backend(struct xenbus_device *, struct blkfront_info *); -static int setup_blkring(struct xenbus_device *, struct blkfront_info *); +static void connect(device_t, struct blkfront_info *); +static void blkfront_closing(device_t); +static int blkfront_detach(device_t); +static int talk_to_backend(device_t, struct blkfront_info *); +static int setup_blkring(device_t, struct blkfront_info *); static void blkif_int(void *); #if 0 static void blkif_restart_queue(void *arg); @@ -136,22 +139,95 @@ pfn_to_mfn(vm_paddr_t pfn) } +/* + * Translate Linux major/minor to an appropriate name and unit + * number. For HVM guests, this allows us to use the same drive names + * with blkfront as the emulated drives, easing transition slightly. + */ +static void +blkfront_vdevice_to_unit(int vdevice, int *unit, const char **name) +{ + static struct vdev_info { + int major; + int shift; + int base; + const char *name; + } info[] = { + {3, 6, 0, "ad"}, /* ide0 */ + {22, 6, 2, "ad"}, /* ide1 */ + {33, 6, 4, "ad"}, /* ide2 */ + {34, 6, 6, "ad"}, /* ide3 */ + {56, 6, 8, "ad"}, /* ide4 */ + {57, 6, 10, "ad"}, /* ide5 */ + {88, 6, 12, "ad"}, /* ide6 */ + {89, 6, 14, "ad"}, /* ide7 */ + {90, 6, 16, "ad"}, /* ide8 */ + {91, 6, 18, "ad"}, /* ide9 */ + + {8, 4, 0, "da"}, /* scsi disk0 */ + {65, 4, 16, "da"}, /* scsi disk1 */ + {66, 4, 32, "da"}, /* scsi disk2 */ + {67, 4, 48, "da"}, /* scsi disk3 */ + {68, 4, 64, "da"}, /* scsi disk4 */ + {69, 4, 80, "da"}, /* scsi disk5 */ + {70, 4, 96, "da"}, /* scsi disk6 */ + {71, 4, 112, "da"}, /* scsi disk7 */ + {128, 4, 128, "da"}, /* scsi disk8 */ + {129, 4, 144, "da"}, /* scsi disk9 */ + {130, 4, 160, "da"}, /* scsi disk10 */ + {131, 4, 176, "da"}, /* scsi disk11 */ + {132, 4, 192, "da"}, /* scsi disk12 */ + {133, 4, 208, "da"}, /* scsi disk13 */ + {134, 4, 224, "da"}, /* scsi disk14 */ + {135, 4, 240, "da"}, /* scsi disk15 */ + + {202, 4, 0, "xbd"}, /* xbd */ + + {0, 0, 0, NULL}, + }; + int major = vdevice >> 8; + int minor = vdevice & 0xff; + int i; + + if (vdevice & (1 << 28)) { + *unit = (vdevice & ((1 << 28) - 1)) >> 8; + *name = "xbd"; + } + + for (i = 0; info[i].major; i++) { + if (info[i].major == major) { + *unit = info[i].base + (minor >> info[i].shift); + *name = info[i].name; + return; + } + } + + *unit = minor >> 4; + *name = "xbd"; +} + int -xlvbd_add(blkif_sector_t capacity, int unit, uint16_t vdisk_info, uint16_t sector_size, - struct blkfront_info *info) +xlvbd_add(device_t dev, blkif_sector_t capacity, + int vdevice, uint16_t vdisk_info, uint16_t sector_size, + struct blkfront_info *info) { struct xb_softc *sc; - int error = 0; - int unitno = unit - 767; + int unit, error = 0; + const char *name; + + blkfront_vdevice_to_unit(vdevice, &unit, &name); sc = (struct xb_softc *)malloc(sizeof(*sc), M_DEVBUF, M_WAITOK|M_ZERO); - sc->xb_unit = unitno; + sc->xb_unit = unit; sc->xb_info = info; info->sc = sc; + if (strcmp(name, "xbd")) + device_printf(dev, "attaching as %s%d\n", name, unit); + memset(&sc->xb_disk, 0, sizeof(sc->xb_disk)); sc->xb_disk = disk_alloc(); - sc->xb_disk->d_unit = unitno; + sc->xb_disk->d_unit = unit; sc->xb_disk->d_open = blkif_open; sc->xb_disk->d_close = blkif_close; sc->xb_disk->d_ioctl = blkif_ioctl; @@ -226,19 +302,33 @@ xb_strategy(struct bio *bp) return; } +static int +blkfront_probe(device_t dev) +{ + + if (!strcmp(xenbus_get_type(dev), "vbd")) { + device_set_desc(dev, "Virtual Block Device"); + device_quiet(dev); + return (0); + } -/* Setup supplies the backend dir, virtual device. + return (ENXIO); +} -We place an event channel and shared frame entries. -We watch backend to wait if it's ok. */ -static int blkfront_probe(struct xenbus_device *dev, - const struct xenbus_device_id *id) +/* + * Setup supplies the backend dir, virtual device. We place an event + * channel and shared frame entries. We watch backend to wait if it's + * ok. + */ +static int +blkfront_attach(device_t dev) { - int err, vdevice, i; + int err, vdevice, i, unit; struct blkfront_info *info; + const char *name; /* FIXME: Use dynamic device id if this is not set. */ - err = xenbus_scanf(XBT_NIL, dev->nodename, + err = xenbus_scanf(XBT_NIL, xenbus_get_node(dev), "virtual-device", "%i", &vdevice); if (err != 1) { xenbus_dev_fatal(dev, err, "reading virtual-device"); @@ -246,11 +336,11 @@ static int blkfront_probe(struct xenbus_ return (err); } - info = malloc(sizeof(*info), M_DEVBUF, M_NOWAIT|M_ZERO); - if (info == NULL) { - xenbus_dev_fatal(dev, ENOMEM, "allocating info structure"); - return ENOMEM; - } + blkfront_vdevice_to_unit(vdevice, &unit, &name); + if (!strcmp(name, "xbd")) + device_set_unit(dev, unit); + + info = device_get_softc(dev); /* * XXX debug only @@ -270,23 +360,20 @@ static int blkfront_probe(struct xenbus_ info->shadow[BLK_RING_SIZE-1].req.id = 0x0fffffff; /* Front end dir is a number, which is used as the id. */ - info->handle = strtoul(strrchr(dev->nodename,'/')+1, NULL, 0); - dev->dev_driver_data = info; + info->handle = strtoul(strrchr(xenbus_get_node(dev),'/')+1, NULL, 0); err = talk_to_backend(dev, info); if (err) { - free(info, M_DEVBUF); - dev->dev_driver_data = NULL; return err; } - return 0; + return (0); } - -static int blkfront_resume(struct xenbus_device *dev) +static int +blkfront_resume(device_t dev) { - struct blkfront_info *info = dev->dev_driver_data; + struct blkfront_info *info = device_get_softc(dev); int err; DPRINTK("blkfront_resume: %s\n", dev->nodename); @@ -301,8 +388,8 @@ static int blkfront_resume(struct xenbus } /* Common code used when first setting up, and when resuming. */ -static int talk_to_backend(struct xenbus_device *dev, - struct blkfront_info *info) +static int +talk_to_backend(device_t dev, struct blkfront_info *info) { const char *message = NULL; struct xenbus_transaction xbt; @@ -320,19 +407,24 @@ static int talk_to_backend(struct xenbus goto destroy_blkring; } - err = xenbus_printf(xbt, dev->nodename, + err = xenbus_printf(xbt, xenbus_get_node(dev), "ring-ref","%u", info->ring_ref); if (err) { message = "writing ring-ref"; goto abort_transaction; } - err = xenbus_printf(xbt, dev->nodename, + err = xenbus_printf(xbt, xenbus_get_node(dev), "event-channel", "%u", irq_to_evtchn_port(info->irq)); if (err) { message = "writing event-channel"; goto abort_transaction; } - + err = xenbus_printf(xbt, xenbus_get_node(dev), + "protocol", "%s", XEN_IO_PROTO_ABI_NATIVE); + if (err) { + message = "writing protocol"; + goto abort_transaction; + } err = xenbus_transaction_end(xbt, 0); if (err) { if (err == -EAGAIN) @@ -340,7 +432,7 @@ static int talk_to_backend(struct xenbus xenbus_dev_fatal(dev, err, "completing transaction"); goto destroy_blkring; } - xenbus_switch_state(dev, XenbusStateInitialised); + xenbus_set_state(dev, XenbusStateInitialised); return 0; @@ -355,7 +447,7 @@ static int talk_to_backend(struct xenbus } static int -setup_blkring(struct xenbus_device *dev, struct blkfront_info *info) +setup_blkring(device_t dev, struct blkfront_info *info) { blkif_sring_t *sring; int err; @@ -378,7 +470,7 @@ setup_blkring(struct xenbus_device *dev, } info->ring_ref = err; - err = bind_listening_port_to_irqhandler(dev->otherend_id, + err = bind_listening_port_to_irqhandler(xenbus_get_otherend_id(dev), "xbd", (driver_intr_t *)blkif_int, info, INTR_TYPE_BIO | INTR_MPSAFE, NULL); if (err <= 0) { @@ -398,10 +490,10 @@ setup_blkring(struct xenbus_device *dev, /** * Callback received when the backend's state changes. */ -static void backend_changed(struct xenbus_device *dev, - XenbusState backend_state) +static void +blkfront_backend_changed(device_t dev, XenbusState backend_state) { - struct blkfront_info *info = dev->dev_driver_data; + struct blkfront_info *info = device_get_softc(dev); DPRINTK("blkfront:backend_changed.\n"); @@ -416,7 +508,7 @@ static void backend_changed(struct xenbu break; case XenbusStateConnected: - connect(info); + connect(dev, info); break; case XenbusStateClosing: @@ -447,7 +539,7 @@ static void backend_changed(struct xenbu ** the details about the physical device - #sectors, size, etc). */ static void -connect(struct blkfront_info *info) +connect(device_t dev, struct blkfront_info *info) { unsigned long sectors, sector_size; unsigned int binfo; @@ -457,28 +549,34 @@ connect(struct blkfront_info *info) (info->connected == BLKIF_STATE_SUSPENDED) ) return; - DPRINTK("blkfront.c:connect:%s.\n", info->xbdev->otherend); + DPRINTK("blkfront.c:connect:%s.\n", xenbus_get_otherend_path(dev)); - err = xenbus_gather(XBT_NIL, info->xbdev->otherend, + err = xenbus_gather(XBT_NIL, xenbus_get_otherend_path(dev), "sectors", "%lu", §ors, "info", "%u", &binfo, "sector-size", "%lu", §or_size, NULL); if (err) { - xenbus_dev_fatal(info->xbdev, err, - "reading backend fields at %s", - info->xbdev->otherend); + xenbus_dev_fatal(dev, err, + "reading backend fields at %s", + xenbus_get_otherend_path(dev)); return; } - err = xenbus_gather(XBT_NIL, info->xbdev->otherend, + err = xenbus_gather(XBT_NIL, xenbus_get_otherend_path(dev), "feature-barrier", "%lu", &info->feature_barrier, NULL); if (err) info->feature_barrier = 0; - xlvbd_add(sectors, info->vdevice, binfo, sector_size, info); + device_printf(dev, "%juMB <%s> at %s", + (uintmax_t) sectors / (1048576 / sector_size), + device_get_desc(dev), + xenbus_get_node(dev)); + bus_print_child_footer(device_get_parent(dev), dev); - (void)xenbus_switch_state(info->xbdev, XenbusStateConnected); + xlvbd_add(dev, sectors, info->vdevice, binfo, sector_size, info); + + (void)xenbus_set_state(dev, XenbusStateConnected); /* Kick pending requests. */ mtx_lock(&blkif_io_lock); @@ -498,11 +596,12 @@ connect(struct blkfront_info *info) * the backend. Once is this done, we can switch to Closed in * acknowledgement. */ -static void blkfront_closing(struct xenbus_device *dev) +static void +blkfront_closing(device_t dev) { - struct blkfront_info *info = dev->dev_driver_data; + struct blkfront_info *info = device_get_softc(dev); - DPRINTK("blkfront_closing: %s removed\n", dev->nodename); + DPRINTK("blkfront_closing: %s removed\n", xenbus_get_node(dev)); if (info->mi) { DPRINTK("Calling xlvbd_del\n"); @@ -510,20 +609,19 @@ static void blkfront_closing(struct xenb info->mi = NULL; } - xenbus_switch_state(dev, XenbusStateClosed); + xenbus_set_state(dev, XenbusStateClosed); } -static int blkfront_remove(struct xenbus_device *dev) +static int +blkfront_detach(device_t dev) { - struct blkfront_info *info = dev->dev_driver_data; + struct blkfront_info *info = device_get_softc(dev); - DPRINTK("blkfront_remove: %s removed\n", dev->nodename); + DPRINTK("blkfront_remove: %s removed\n", xenbus_get_node(dev)); blkif_free(info, 0); - free(info, M_DEVBUF); - return 0; } @@ -631,8 +729,9 @@ blkif_close(struct disk *dp) /* Check whether we have been instructed to close. We will have ignored this request initially, as the device was still mounted. */ - struct xenbus_device * dev = sc->xb_info->xbdev; - XenbusState state = xenbus_read_driver_state(dev->otherend); + device_t dev = sc->xb_info->xbdev; + XenbusState state = + xenbus_read_driver_state(xenbus_get_otherend_path(dev)); if (state == XenbusStateClosing) blkfront_closing(dev); @@ -731,7 +830,7 @@ static int blkif_queue_request(struct bi gnttab_grant_foreign_access_ref( ref, - info->xbdev->otherend_id, + xenbus_get_otherend_id(info->xbdev), buffer_ma >> PAGE_SHIFT, ring_req->operation & 1 ); /* ??? */ info->shadow[id].frame[ring_req->nr_segments] = @@ -952,7 +1051,7 @@ blkif_recover(struct blkfront_info *info for (j = 0; j < req->nr_segments; j++) gnttab_grant_foreign_access_ref( req->seg[j].gref, - info->xbdev->otherend_id, + xenbus_get_otherend_id(info->xbdev), pfn_to_mfn(info->shadow[req->id].frame[j]), 0 /* assume not readonly */); @@ -963,7 +1062,7 @@ blkif_recover(struct blkfront_info *info free(copy, M_DEVBUF); - xenbus_switch_state(info->xbdev, XenbusStateConnected); + xenbus_set_state(info->xbdev, XenbusStateConnected); /* Now safe for us to use the shared ring */ mtx_lock(&blkif_io_lock); @@ -979,48 +1078,30 @@ blkif_recover(struct blkfront_info *info mtx_unlock(&blkif_io_lock); } -static int -blkfront_is_ready(struct xenbus_device *dev) -{ - struct blkfront_info *info = dev->dev_driver_data; - - return info->is_ready; -} - -static struct xenbus_device_id blkfront_ids[] = { - { "vbd" }, - { "" } -}; - - -static struct xenbus_driver blkfront = { - .name = "vbd", - .ids = blkfront_ids, - .probe = blkfront_probe, - .remove = blkfront_remove, - .resume = blkfront_resume, - .otherend_changed = backend_changed, - .is_ready = blkfront_is_ready, -}; - - - -static void -xenbus_init(void) -{ - xenbus_register_frontend(&blkfront); -} +/* ** Driver registration ** */ +static device_method_t blkfront_methods[] = { + /* Device interface */ + DEVMETHOD(device_probe, blkfront_probe), + DEVMETHOD(device_attach, blkfront_attach), + DEVMETHOD(device_detach, blkfront_detach), + DEVMETHOD(device_shutdown, bus_generic_shutdown), + DEVMETHOD(device_suspend, bus_generic_suspend), + DEVMETHOD(device_resume, blkfront_resume), + + /* Xenbus interface */ + DEVMETHOD(xenbus_backend_changed, blkfront_backend_changed), + + { 0, 0 } +}; + +static driver_t blkfront_driver = { + "xbd", + blkfront_methods, + sizeof(struct blkfront_info), +}; +devclass_t blkfront_devclass; + +DRIVER_MODULE(xbd, xenbus, blkfront_driver, blkfront_devclass, 0, 0); MTX_SYSINIT(ioreq, &blkif_io_lock, "BIO LOCK", MTX_NOWITNESS); /* XXX how does one enroll a lock? */ -SYSINIT(xbdev, SI_SUB_PSEUDO, SI_ORDER_SECOND, xenbus_init, NULL); - -/* - * Local variables: - * mode: C - * c-set-style: "BSD" - * c-basic-offset: 8 - * tab-width: 4 - * indent-tabs-mode: t - * End: - */ Modified: head/sys/dev/xen/blkfront/block.h ============================================================================== --- head/sys/dev/xen/blkfront/block.h Thu Dec 4 07:28:13 2008 (r185604) +++ head/sys/dev/xen/blkfront/block.h Thu Dec 4 07:59:05 2008 (r185605) @@ -60,7 +60,7 @@ struct xb_softc { */ struct blkfront_info { - struct xenbus_device *xbdev; + device_t xbdev; dev_t dev; struct gendisk *gd; int vdevice; @@ -89,7 +89,7 @@ struct blkfront_info /* Note that xlvbd_add doesn't call add_disk for you: you're expected to call add_disk on info->gd once the disk is properly connected up. */ -int xlvbd_add(blkif_sector_t capacity, int device, +int xlvbd_add(device_t, blkif_sector_t capacity, int device, uint16_t vdisk_info, uint16_t sector_size, struct blkfront_info *info); void xlvbd_del(struct blkfront_info *info); Modified: head/sys/dev/xen/netfront/netfront.c ============================================================================== --- head/sys/dev/xen/netfront/netfront.c Thu Dec 4 07:28:13 2008 (r185604) +++ head/sys/dev/xen/netfront/netfront.c Thu Dec 4 07:59:05 2008 (r185605) @@ -25,6 +25,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -64,13 +65,14 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include #include #include #include +#include +#include "xenbus_if.h" #define GRANT_INVALID_REF 0 @@ -116,19 +118,19 @@ static void xn_watchdog(struct ifnet *); static void show_device(struct netfront_info *sc); #ifdef notyet -static void netfront_closing(struct xenbus_device *dev); +static void netfront_closing(device_t dev); #endif static void netif_free(struct netfront_info *info); -static int netfront_remove(struct xenbus_device *dev); +static int netfront_detach(device_t dev); -static int talk_to_backend(struct xenbus_device *dev, struct netfront_info *info); -static int create_netdev(struct xenbus_device *dev, struct ifnet **ifp); +static int talk_to_backend(device_t dev, struct netfront_info *info); +static int create_netdev(device_t dev); static void netif_disconnect_backend(struct netfront_info *info); -static int setup_device(struct xenbus_device *dev, struct netfront_info *info); +static int setup_device(device_t dev, struct netfront_info *info); static void end_access(int ref, void *page); /* Xenolinux helper functions */ -static int network_connect(struct ifnet *ifp); +int network_connect(struct netfront_info *); static void xn_free_rx_ring(struct netfront_info *); @@ -221,7 +223,7 @@ struct netfront_info { grant_ref_t grant_rx_ref[NET_TX_RING_SIZE + 1]; #define TX_MAX_TARGET min(NET_RX_RING_SIZE, 256) - struct xenbus_device *xbdev; + device_t xbdev; int tx_ring_ref; int rx_ring_ref; uint8_t mac[ETHER_ADDR_LEN]; @@ -327,7 +329,7 @@ xennet_get_rx_ref(struct netfront_info * #define WPRINTK(fmt, args...) \ printf("[XEN] " fmt, ##args) #define DPRINTK(fmt, args...) \ - printf("[XEN] " fmt, ##args) + printf("[XEN] %s: " fmt, __func__, ##args) static __inline struct mbuf* @@ -340,15 +342,15 @@ makembuf (struct mbuf *buf) if (! m) return 0; - M_MOVE_PKTHDR(m, buf); + M_MOVE_PKTHDR(m, buf); - m_cljget(m, M_DONTWAIT, MJUMPAGESIZE); + m_cljget(m, M_DONTWAIT, MJUMPAGESIZE); m->m_pkthdr.len = buf->m_pkthdr.len; m->m_len = buf->m_len; - m_copydata(buf, 0, buf->m_pkthdr.len, mtod(m,caddr_t) ); + m_copydata(buf, 0, buf->m_pkthdr.len, mtod(m,caddr_t) ); m->m_ext.ext_arg1 = (caddr_t *)(uintptr_t)(vtophys(mtod(m,caddr_t)) >> PAGE_SHIFT); - + return m; } @@ -359,12 +361,12 @@ makembuf (struct mbuf *buf) * Return 0 on success, or errno on error. */ static int -xen_net_read_mac(struct xenbus_device *dev, uint8_t mac[]) +xen_net_read_mac(device_t dev, uint8_t mac[]) { char *s; int i; char *e; - char *macstr = xenbus_read(XBT_NIL, dev->nodename, "mac", NULL); + char *macstr = xenbus_read(XBT_NIL, xenbus_get_node(dev), "mac", NULL); if (IS_ERR(macstr)) { return PTR_ERR(macstr); } @@ -388,23 +390,28 @@ xen_net_read_mac(struct xenbus_device *d * Connected state. */ static int -netfront_probe(struct xenbus_device *dev, const struct xenbus_device_id *id) +netfront_probe(device_t dev) { + + if (!strcmp(xenbus_get_type(dev), "vif")) { + device_set_desc(dev, "Virtual Network Interface"); + return (0); + } + + return (ENXIO); +} + +static int +netfront_attach(device_t dev) +{ int err; - struct ifnet *ifp; - struct netfront_info *info; - printf("netfront_probe() \n"); - - err = create_netdev(dev, &ifp); + err = create_netdev(dev); if (err) { xenbus_dev_fatal(dev, err, "creating netdev"); return err; } - info = ifp->if_softc; - dev->dev_driver_data = info; - return 0; } @@ -416,11 +423,11 @@ netfront_probe(struct xenbus_device *dev * rest of the kernel. */ static int -netfront_resume(struct xenbus_device *dev) +netfront_resume(device_t dev) { - struct netfront_info *info = dev->dev_driver_data; + struct netfront_info *info = device_get_softc(dev); - DPRINTK("%s\n", dev->nodename); + DPRINTK("%s\n", xenbus_get_node(dev)); netif_disconnect_backend(info); return (0); @@ -429,15 +436,16 @@ netfront_resume(struct xenbus_device *de /* Common code used when first setting up, and when resuming. */ static int -talk_to_backend(struct xenbus_device *dev, struct netfront_info *info) +talk_to_backend(device_t dev, struct netfront_info *info) { const char *message; struct xenbus_transaction xbt; + const char *node = xenbus_get_node(dev); int err; err = xen_net_read_mac(dev, info->mac); if (err) { - xenbus_dev_fatal(dev, err, "parsing %s/mac", dev->nodename); + xenbus_dev_fatal(dev, err, "parsing %s/mac", node); goto out; } @@ -452,47 +460,47 @@ talk_to_backend(struct xenbus_device *de xenbus_dev_fatal(dev, err, "starting transaction"); goto destroy_ring; } - err = xenbus_printf(xbt, dev->nodename, "tx-ring-ref","%u", + err = xenbus_printf(xbt, node, "tx-ring-ref","%u", info->tx_ring_ref); if (err) { message = "writing tx ring-ref"; goto abort_transaction; } - err = xenbus_printf(xbt, dev->nodename, "rx-ring-ref","%u", + err = xenbus_printf(xbt, node, "rx-ring-ref","%u", info->rx_ring_ref); if (err) { message = "writing rx ring-ref"; goto abort_transaction; } - err = xenbus_printf(xbt, dev->nodename, + err = xenbus_printf(xbt, node, "event-channel", "%u", irq_to_evtchn_port(info->irq)); if (err) { message = "writing event-channel"; goto abort_transaction; } - err = xenbus_printf(xbt, dev->nodename, "request-rx-copy", "%u", + err = xenbus_printf(xbt, node, "request-rx-copy", "%u", info->copying_receiver); if (err) { message = "writing request-rx-copy"; goto abort_transaction; } - err = xenbus_printf(xbt, dev->nodename, "feature-rx-notify", "%d", 1); + err = xenbus_printf(xbt, node, "feature-rx-notify", "%d", 1); if (err) { message = "writing feature-rx-notify"; goto abort_transaction; } - err = xenbus_printf(xbt, dev->nodename, "feature-no-csum-offload", "%d", 1); + err = xenbus_printf(xbt, node, "feature-no-csum-offload", "%d", 1); if (err) { message = "writing feature-no-csum-offload"; goto abort_transaction; } - err = xenbus_printf(xbt, dev->nodename, "feature-sg", "%d", 1); + err = xenbus_printf(xbt, node, "feature-sg", "%d", 1); if (err) { message = "writing feature-sg"; goto abort_transaction; } #ifdef HAVE_TSO - err = xenbus_printf(xbt, dev->nodename, "feature-gso-tcpv4", "%d", 1); + err = xenbus_printf(xbt, node, "feature-gso-tcpv4", "%d", 1); if (err) { message = "writing feature-gso-tcpv4"; goto abort_transaction; @@ -520,7 +528,7 @@ talk_to_backend(struct xenbus_device *de static int -setup_device(struct xenbus_device *dev, struct netfront_info *info) +setup_device(device_t dev, struct netfront_info *info) { netif_tx_sring_t *txs; netif_rx_sring_t *rxs; @@ -563,9 +571,9 @@ setup_device(struct xenbus_device *dev, info->rx_ring_ref = err; #if 0 - network_connect(ifp); + network_connect(info); #endif - err = bind_listening_port_to_irqhandler(dev->otherend_id, + err = bind_listening_port_to_irqhandler(xenbus_get_otherend_id(dev), "xn", xn_intr, info, INTR_TYPE_NET | INTR_MPSAFE, NULL); if (err <= 0) { @@ -588,14 +596,13 @@ setup_device(struct xenbus_device *dev, * Callback received when the backend's state changes. */ static void -backend_changed(struct xenbus_device *dev, - XenbusState backend_state) +netfront_backend_changed(device_t dev, XenbusState newstate) { - struct netfront_info *sc = dev->dev_driver_data; + struct netfront_info *sc = device_get_softc(dev); - DPRINTK("\n"); - - switch (backend_state) { + DPRINTK("newstate=%d\n", newstate); + + switch (newstate) { case XenbusStateInitialising: case XenbusStateInitialised: case XenbusStateConnected: @@ -603,19 +610,19 @@ backend_changed(struct xenbus_device *de case XenbusStateClosed: case XenbusStateReconfigured: case XenbusStateReconfiguring: - break; + break; case XenbusStateInitWait: - if (dev->state != XenbusStateInitialising) + if (xenbus_get_state(dev) != XenbusStateInitialising) break; - if (network_connect(sc->xn_ifp) != 0) + if (network_connect(sc) != 0) break; - xenbus_switch_state(dev, XenbusStateConnected); + xenbus_set_state(dev, XenbusStateConnected); #ifdef notyet (void)send_fake_arp(netdev); #endif - break; break; + break; case XenbusStateClosing: - xenbus_frontend_closed(dev); + xenbus_set_state(dev, XenbusStateClosed); break; } } @@ -674,7 +681,8 @@ netif_release_tx_bufs(struct netfront_in if (((u_long)m) < KERNBASE) continue; gnttab_grant_foreign_access_ref(np->grant_tx_ref[i], - np->xbdev->otherend_id, virt_to_mfn(mtod(m, vm_offset_t)), + xenbus_get_otherend_id(np->xbdev), + virt_to_mfn(mtod(m, vm_offset_t)), GNTMAP_readonly); gnttab_release_grant_reference(&np->gref_tx_head, np->grant_tx_ref[i]); @@ -687,6 +695,7 @@ netif_release_tx_bufs(struct netfront_in static void network_alloc_rx_buffers(struct netfront_info *sc) { + int otherend_id = xenbus_get_otherend_id(sc->xbdev); unsigned short id; struct mbuf *m_new; int i, batch_target, notify; @@ -768,7 +777,7 @@ refill: if (sc->copying_receiver == 0) { gnttab_grant_foreign_transfer_ref(ref, - sc->xbdev->otherend_id, pfn); + otherend_id, pfn); sc->rx_pfn_array[nr_flips] = PFNTOMFN(pfn); if (!xen_feature(XENFEAT_auto_translated_physmap)) { /* Remove this page before passing @@ -781,7 +790,7 @@ refill: nr_flips++; } else { gnttab_grant_foreign_access_ref(ref, - sc->xbdev->otherend_id, + otherend_id, PFNTOMFN(pfn), 0); } req->id = id; @@ -1298,6 +1307,7 @@ xn_tick(void *xsc) static void xn_start_locked(struct ifnet *ifp) { + int otherend_id; unsigned short id; struct mbuf *m_head, *new_m; struct netfront_info *sc; @@ -1308,6 +1318,7 @@ xn_start_locked(struct ifnet *ifp) int notify; sc = ifp->if_softc; + otherend_id = xenbus_get_otherend_id(sc->xbdev); tx_bytes = 0; if (!netfront_carrier_ok(sc)) @@ -1337,7 +1348,7 @@ xn_start_locked(struct ifnet *ifp) ref = gnttab_claim_grant_reference(&sc->gref_tx_head); KASSERT((short)ref >= 0, ("Negative ref")); mfn = virt_to_mfn(mtod(new_m, vm_offset_t)); - gnttab_grant_foreign_access_ref(ref, sc->xbdev->otherend_id, + gnttab_grant_foreign_access_ref(ref, otherend_id, mfn, GNTMAP_readonly); tx->gref = sc->grant_tx_ref[id] = ref; tx->size = new_m->m_pkthdr.len; @@ -1543,23 +1554,19 @@ xn_stop(struct netfront_info *sc) } /* START of Xenolinux helper functions adapted to FreeBSD */ -static int -network_connect(struct ifnet *ifp) +int +network_connect(struct netfront_info *np) { - struct netfront_info *np; int i, requeue_idx, err; grant_ref_t ref; netif_rx_request_t *req; u_int feature_rx_copy, feature_rx_flip; - printf("network_connect\n"); - - np = ifp->if_softc; - err = xenbus_scanf(XBT_NIL, np->xbdev->otherend, + err = xenbus_scanf(XBT_NIL, xenbus_get_otherend_path(np->xbdev), "feature-rx-copy", "%u", &feature_rx_copy); if (err != 1) feature_rx_copy = 0; - err = xenbus_scanf(XBT_NIL, np->xbdev->otherend, + err = xenbus_scanf(XBT_NIL, xenbus_get_otherend_path(np->xbdev), "feature-rx-flip", "%u", &feature_rx_flip); if (err != 1) feature_rx_flip = 1; @@ -1576,7 +1583,7 @@ network_connect(struct ifnet *ifp) /* Recovery procedure: */ err = talk_to_backend(np->xbdev, np); if (err) - return (err); + return (err); /* Step 1: Reinitialise variables. */ netif_release_tx_bufs(np); @@ -1594,11 +1601,11 @@ network_connect(struct ifnet *ifp) if (!np->copying_receiver) { gnttab_grant_foreign_transfer_ref(ref, - np->xbdev->otherend_id, + xenbus_get_otherend_id(np->xbdev), vtophys(mtod(m, vm_offset_t))); } else { gnttab_grant_foreign_access_ref(ref, - np->xbdev->otherend_id, + xenbus_get_otherend_id(np->xbdev), vtophys(mtod(m, vm_offset_t)), 0); } req->gref = ref; @@ -1625,7 +1632,6 @@ network_connect(struct ifnet *ifp) return (0); } - static void show_device(struct netfront_info *sc) { @@ -1645,25 +1651,18 @@ show_device(struct netfront_info *sc) #endif } -static int ifno = 0; - /** Create a network device. * @param handle device handle */ -static int -create_netdev(struct xenbus_device *dev, struct ifnet **ifpp) +int +create_netdev(device_t dev) { int i; struct netfront_info *np; int err; struct ifnet *ifp; - np = (struct netfront_info *)malloc(sizeof(struct netfront_info), - M_DEVBUF, M_NOWAIT); *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@FreeBSD.ORG Thu Dec 4 09:57:56 2008 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E09D7106564A; Thu, 4 Dec 2008 09:57:56 +0000 (UTC) (envelope-from bright@elvis.mu.org) Received: from elvis.mu.org (elvis.mu.org [192.203.228.196]) by mx1.freebsd.org (Postfix) with ESMTP id BE6CB8FC17; Thu, 4 Dec 2008 09:57:56 +0000 (UTC) (envelope-from bright@elvis.mu.org) Received: by elvis.mu.org (Postfix, from userid 1192) id 81ED21A3C3A; Thu, 4 Dec 2008 01:57:56 -0800 (PST) Date: Thu, 4 Dec 2008 01:57:56 -0800 From: Alfred Perlstein To: "M. Warner Losh" Message-ID: <20081204095756.GP27096@elvis.mu.org> References: <49338E98.7020104@freebsd.org> <863ah8rvcd.fsf@ds4.des.no> <20081201132554.GD27096@elvis.mu.org> <20081201.221040.-1350500631.imp@bsdimp.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20081201.221040.-1350500631.imp@bsdimp.com> User-Agent: Mutt/1.4.2.3i Cc: svn-src-head@FreeBSD.org, des@des.no, svn-src-all@FreeBSD.org, kientzle@FreeBSD.org, src-committers@FreeBSD.org Subject: Re: svn commit: r185499 - head X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 04 Dec 2008 09:57:57 -0000 * M. Warner Losh [081201 21:12] wrote: > In message: <20081201132554.GD27096@elvis.mu.org> > Alfred Perlstein writes: > : * Dag-Erling Sm??rgrav [081201 03:25] wrote: > : > Tim Kientzle writes: > : > > Alfred Perlstein writes: > : > > > Log: > : > > > Provide a 'tinderbox' target that compiles enough of FreeBSD that > : > > > a developer can rest reasonably assured that the tinderbox will not > : > > > be broken. This target leverages most of 'universe' but will exit > : > > > non-zero and output a summary at the end. > : > > > "make tinderbox" > : > > Excellent! > : > > : > I really don't see the point, especially now that 'make universe' will > : > issue a warning on stdout for every build that fails. As I've tried to > : > explain to Alfred, the tinderbox does nothing magical, and nothing that > : > isn't already covered by 'make universe'. I also asked him to discuss > : > any changes with Poul-Henning before committing them. > : > : I'll summarize the changes here: > : > : Problems with make universe: > : 1) Make universe returns success on failure. > : 2) Make universe outputs the following on failure: > : -------------------------------------------------------------- > : make universe completed on `LC_ALL=C date`" > : (started ${STARTTIME})" > : -------------------------------------------------------------- > : > : This basically means you can't chain 'make universe' into something > : like "make tinderbox || (echo oops | mail -s tinderbox failed...)". > : > : The summary at the end "completed" is very misleading. > : > : The tinderbox target differs as follows: > : > : It returns an error if it fails. > : It outputs a summary of the failures at the end. > : The name reflects what its for. ("what the heck is a universe?") > : > : > : If you strongly believe that a target should return "true" on failure > : and/or output "i worked" on failure then I'm not sure how to approach > : that mindset, maybe you can help me understand where you're coming from > : on that? Where is the utility in it? Is there something I'm missing? > > I think you ignored the discussions that said that 'universe' should > be modified to exit with an error when there was an error, but > shouldn't bail out EARLY. There were even patches to do this. Interesting, I didn't see them and they weren't committed. The owner/maintainer of universe hasn't really stepped up to provide anything and ask me "hey Alfred, would this be helpful?" and the owner/maintainer of tinderbox has not either. Mostly the two of them have told me "you do it, or shut up", so I did it. > Based on that, why do something completely new and different? New and different? What? Maybe you can explain to me what's so earth shattering new and different about having a make target behave like most any other sane make target and have a name that is self-documenting? There is a 'tinderbox' target, which is named so that when someone says "gee, I wonder how to satisfy the tinderbox" they do not need to read a wiki, blog, handbook, manpage, check IRC, news group or mailing list archive to figure out, they can just run it and get something that makes sense. Anyhow, I don't really care what's done so as long as there's a top level target that does what I just committed, so if someone wants to redo how I did what I did in order to get the exact same results they can be my guest. I would hope that they have better things to do though. -- - Alfred Perlstein From owner-svn-src-head@FreeBSD.ORG Thu Dec 4 10:55:40 2008 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3C87C106567F; Thu, 4 Dec 2008 10:55:40 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail03.syd.optusnet.com.au (mail03.syd.optusnet.com.au [211.29.132.184]) by mx1.freebsd.org (Postfix) with ESMTP id 2D7498FC14; Thu, 4 Dec 2008 10:55:39 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from c122-107-116-223.carlnfd1.nsw.optusnet.com.au (c122-107-116-223.carlnfd1.nsw.optusnet.com.au [122.107.116.223]) by mail03.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id mB4AtSSU008617 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Thu, 4 Dec 2008 21:55:36 +1100 Date: Thu, 4 Dec 2008 21:55:28 +1100 (EST) From: Bruce Evans X-X-Sender: bde@delplex.bde.org To: Max Laier In-Reply-To: <200812040009.30837.max@love2party.net> Message-ID: <20081204213600.G4414@delplex.bde.org> References: <200812032300.mB3N0vZW003970@svn.freebsd.org> <200812040009.30837.max@love2party.net> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, Max Laier , src-committers@freebsd.org Subject: Re: svn commit: r185594 - head/sbin/newfs_msdos X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 04 Dec 2008 10:55:40 -0000 On Thu, 4 Dec 2008, Max Laier wrote: > On Thursday 04 December 2008 00:00:57 Max Laier wrote: >> Author: mlaier >> Date: Wed Dec 3 23:00:57 2008 >> New Revision: 185594 >> URL: http://svn.freebsd.org/changeset/base/185594 >> >> Log: >> Fix build - cast off_t to (intmax_t) for printing. intmax_t is declared in , but this patch gets it by including the full bloat of . However, is needed for a complete fix. Input of off_t's is still broken -- it uses strtoll(), but should use strtoimax() so as not to depend on the implementation of off_t and so as not to have style bugs (any use of long long). > I'd really like to typedef the int64 types "long long" on all architectures > :-\ It's a big POLA violation in my opinion and causes quite a bit of porting > headache. Or at least let's fix printf to understand that "long" types on > 64bit architectures can be printed with %ll. Since they are - in fact - 64bit > wide. > > But I keep reiterating this point - I guess I still don't understand the exact > reason why we can't just do that. This would break detection of the bug that you fixed. Printing off_t using either %ld or %lld is a bug, since off_t might not be either of long or long long. Having %ld (physically) incompatible with long long on 32-bit arches and %lld (only logically) incompatible with long long on 64-bit arches results in both errors being detected eventually. Bruce From owner-svn-src-head@FreeBSD.ORG Thu Dec 4 11:10:46 2008 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0C516106564A; Thu, 4 Dec 2008 11:10:46 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from mail.terabit.net.ua (mail.terabit.net.ua [195.137.202.147]) by mx1.freebsd.org (Postfix) with ESMTP id A07C98FC16; Thu, 4 Dec 2008 11:10:45 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from skuns.zoral.com.ua ([91.193.166.194] helo=mail.zoral.com.ua) by mail.terabit.net.ua with esmtps (TLSv1:AES256-SHA:256) (Exim 4.63 (FreeBSD)) (envelope-from ) id 1L8C6W-0007VV-Nd; Thu, 04 Dec 2008 13:10:44 +0200 Received: from deviant.kiev.zoral.com.ua (root@deviant.kiev.zoral.com.ua [10.1.1.148]) by mail.zoral.com.ua (8.14.2/8.14.2) with ESMTP id mB4BAfR9063220 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Thu, 4 Dec 2008 13:10:41 +0200 (EET) (envelope-from kostikbel@gmail.com) Received: from deviant.kiev.zoral.com.ua (kostik@localhost [127.0.0.1]) by deviant.kiev.zoral.com.ua (8.14.3/8.14.3) with ESMTP id mB4BAfCJ004195; Thu, 4 Dec 2008 13:10:41 +0200 (EET) (envelope-from kostikbel@gmail.com) Received: (from kostik@localhost) by deviant.kiev.zoral.com.ua (8.14.3/8.14.3/Submit) id mB4BAf6J004194; Thu, 4 Dec 2008 13:10:41 +0200 (EET) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: deviant.kiev.zoral.com.ua: kostik set sender to kostikbel@gmail.com using -f Date: Thu, 4 Dec 2008 13:10:41 +0200 From: Kostik Belousov To: John Baldwin Message-ID: <20081204111041.GB2038@deviant.kiev.zoral.com.ua> References: <200812031845.mB3IjcZC098534@svn.freebsd.org> <20081203214306.GC2401@deviant.kiev.zoral.com.ua> <200812031803.03650.jhb@freebsd.org> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="St7VIuEGZ6dlpu13" Content-Disposition: inline In-Reply-To: <200812031803.03650.jhb@freebsd.org> User-Agent: Mutt/1.4.2.3i X-Virus-Scanned: ClamAV version 0.93.3, clamav-milter version 0.93.3 on skuns.kiev.zoral.com.ua X-Virus-Status: Clean X-Spam-Status: No, score=-4.4 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00 autolearn=ham version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on skuns.kiev.zoral.com.ua X-Virus-Scanned: mail.terabit.net.ua 1L8C6W-0007VV-Nd a6abf0ff7d14172256db7b6f2a891386 X-Terabit: YES Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r185589 - head/sys/compat/freebsd32 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 04 Dec 2008 11:10:46 -0000 --St7VIuEGZ6dlpu13 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, Dec 03, 2008 at 06:03:03PM -0500, John Baldwin wrote: > On Wednesday 03 December 2008 04:43:06 pm Kostik Belousov wrote: > > On Wed, Dec 03, 2008 at 06:45:38PM +0000, John Baldwin wrote: > > > Author: jhb > > > Date: Wed Dec 3 18:45:38 2008 > > > New Revision: 185589 > > > URL: http://svn.freebsd.org/changeset/base/185589 > > >=20 > > > Log: > > > When unloading a 32-bit system call module, restore the sysent vect= or in > > > the 32-bit system call table instead of the main system call table. > > >=20 > > > Modified: > > > head/sys/compat/freebsd32/freebsd32_misc.c > > >=20 > > The module build glue is not committed into the svn, isn't it ? >=20 > Err, it is. It's in freebsd32_util.h (SYSCALL32_MODULE, etc.). I saw that, I would call it initialization glue. I mean that freebsd32 cannot be _load_ as module. --St7VIuEGZ6dlpu13 Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (FreeBSD) iEYEARECAAYFAkk3urAACgkQC3+MBN1Mb4j7mgCfVXss2QJLgrCbut5fJK3/tNEM tTcAoJrGe4QBCDcrvyJ364O/R+RF9TsA =un83 -----END PGP SIGNATURE----- --St7VIuEGZ6dlpu13-- From owner-svn-src-head@FreeBSD.ORG Thu Dec 4 12:42:28 2008 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CE872106564A; Thu, 4 Dec 2008 12:42:28 +0000 (UTC) (envelope-from des@des.no) Received: from tim.des.no (tim.des.no [194.63.250.121]) by mx1.freebsd.org (Postfix) with ESMTP id 866338FC0C; Thu, 4 Dec 2008 12:42:28 +0000 (UTC) (envelope-from des@des.no) Received: from ds4.des.no (des.no [84.49.246.2]) by smtp.des.no (Postfix) with ESMTP id 757D66D43F; Thu, 4 Dec 2008 12:42:27 +0000 (UTC) Received: by ds4.des.no (Postfix, from userid 1001) id 3AE638449A; Thu, 4 Dec 2008 13:42:27 +0100 (CET) From: =?utf-8?Q?Dag-Erling_Sm=C3=B8rgrav?= To: Alfred Perlstein References: <49338E98.7020104@freebsd.org> <863ah8rvcd.fsf@ds4.des.no> <20081201132554.GD27096@elvis.mu.org> <20081201.221040.-1350500631.imp@bsdimp.com> <20081204095756.GP27096@elvis.mu.org> Date: Thu, 04 Dec 2008 13:42:26 +0100 In-Reply-To: <20081204095756.GP27096@elvis.mu.org> (Alfred Perlstein's message of "Thu, 4 Dec 2008 01:57:56 -0800") Message-ID: <863ah4158t.fsf@ds4.des.no> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (berkeley-unix) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, kientzle@FreeBSD.org, "M. Warner Losh" , src-committers@FreeBSD.org Subject: Re: svn commit: r185499 - head X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 04 Dec 2008 12:42:28 -0000 Alfred Perlstein writes: > There is a 'tinderbox' target, which is named so that when someone > says "gee, I wonder how to satisfy the tinderbox" they do not need > to read a wiki, blog, handbook, manpage, check IRC, news group > or mailing list archive to figure out, they can just run it and > get something that makes sense. Please, let's not go there again. You know perfectly well that the tinderbox simply runs 'make buildworld'. It is no harder or easier to satisfy than our users. DES --=20 Dag-Erling Sm=C3=B8rgrav - des@des.no From owner-svn-src-head@FreeBSD.ORG Thu Dec 4 16:31:08 2008 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 821AF106564A; Thu, 4 Dec 2008 16:31:08 +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 711378FC14; Thu, 4 Dec 2008 16:31:08 +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 mB4GV8pv026153; Thu, 4 Dec 2008 16:31:08 GMT (envelope-from imp@svn.freebsd.org) Received: (from imp@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mB4GV8P8026152; Thu, 4 Dec 2008 16:31:08 GMT (envelope-from imp@svn.freebsd.org) Message-Id: <200812041631.mB4GV8P8026152@svn.freebsd.org> From: Warner Losh Date: Thu, 4 Dec 2008 16:31: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: r185614 - head/sys/cddl/contrib/opensolaris/uts/common/sys X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 04 Dec 2008 16:31:08 -0000 Author: imp Date: Thu Dec 4 16:31:08 2008 New Revision: 185614 URL: http://svn.freebsd.org/changeset/base/185614 Log: Put the MIPS support back in after it was removed in r185029. Modified: head/sys/cddl/contrib/opensolaris/uts/common/sys/isa_defs.h Modified: head/sys/cddl/contrib/opensolaris/uts/common/sys/isa_defs.h ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/sys/isa_defs.h Thu Dec 4 15:34:53 2008 (r185613) +++ head/sys/cddl/contrib/opensolaris/uts/common/sys/isa_defs.h Thu Dec 4 16:31:08 2008 (r185614) @@ -387,6 +387,49 @@ extern "C" { #define _DONT_USE_1275_GENERIC_NAMES #define _HAVE_CPUID_INSN +#elif defined(__mips__) + +/* + * Define the appropriate "processor characteristics" + */ +#define _STACK_GROWS_DOWNWARD +#define _LONG_LONG_LTOH +#define _BIT_FIELDS_LTOH +#define _IEEE_754 +#define _CHAR_IS_SIGNED +#define _BOOL_ALIGNMENT 1 +#define _CHAR_ALIGNMENT 1 +#define _SHORT_ALIGNMENT 2 +#define _INT_ALIGNMENT 4 +#define _FLOAT_ALIGNMENT 4 +#define _FLOAT_COMPLEX_ALIGNMENT 4 +#define _LONG_ALIGNMENT 4 +#define _LONG_LONG_ALIGNMENT 4 +#define _DOUBLE_ALIGNMENT 4 +#define _DOUBLE_COMPLEX_ALIGNMENT 4 +#define _LONG_DOUBLE_ALIGNMENT 4 +#define _LONG_DOUBLE_COMPLEX_ALIGNMENT 4 +#define _POINTER_ALIGNMENT 4 +#define _MAX_ALIGNMENT 4 +#define _ALIGNMENT_REQUIRED 0 + +#define _LONG_LONG_ALIGNMENT_32 _LONG_LONG_ALIGNMENT + +/* + * Define the appropriate "implementation choices". + */ +#define _ILP32 +#if !defined(_I32LPx) && defined(_KERNEL) +#define _I32LPx +#endif +#define _SUNOS_VTOC_16 +#define _DMA_USES_PHYSADDR +#define _FIRMWARE_NEEDS_FDISK +#define _PSM_MODULES +#define _RTC_CONFIG +#define _DONT_USE_1275_GENERIC_NAMES +#define _HAVE_CPUID_INSN + #elif defined(__powerpc__) /* From owner-svn-src-head@FreeBSD.ORG Thu Dec 4 16:35:42 2008 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id EC1A81065675; Thu, 4 Dec 2008 16:35:42 +0000 (UTC) (envelope-from bright@elvis.mu.org) Received: from elvis.mu.org (elvis.mu.org [192.203.228.196]) by mx1.freebsd.org (Postfix) with ESMTP id D5FE88FC13; Thu, 4 Dec 2008 16:35:42 +0000 (UTC) (envelope-from bright@elvis.mu.org) Received: by elvis.mu.org (Postfix, from userid 1192) id BFE251A3C3A; Thu, 4 Dec 2008 08:35:42 -0800 (PST) Date: Thu, 4 Dec 2008 08:35:42 -0800 From: Alfred Perlstein To: Dag-Erling Sm??rgrav Message-ID: <20081204163542.GQ27096@elvis.mu.org> References: <49338E98.7020104@freebsd.org> <863ah8rvcd.fsf@ds4.des.no> <20081201132554.GD27096@elvis.mu.org> <20081201.221040.-1350500631.imp@bsdimp.com> <20081204095756.GP27096@elvis.mu.org> <863ah4158t.fsf@ds4.des.no> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <863ah4158t.fsf@ds4.des.no> User-Agent: Mutt/1.4.2.3i Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, kientzle@FreeBSD.org, "M. Warner Losh" , src-committers@FreeBSD.org Subject: Re: svn commit: r185499 - head X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 04 Dec 2008 16:35:43 -0000 * Dag-Erling Sm??rgrav [081204 04:42] wrote: > Alfred Perlstein writes: > > There is a 'tinderbox' target, which is named so that when someone > > says "gee, I wonder how to satisfy the tinderbox" they do not need > > to read a wiki, blog, handbook, manpage, check IRC, news group > > or mailing list archive to figure out, they can just run it and > > get something that makes sense. > > Please, let's not go there again. You know perfectly well that the > tinderbox simply runs 'make buildworld'. It is no harder or easier to > satisfy than our users. Really? So a person on a i386 platform that touches let's say src/sys/proc.h will have quality checked via "make buildworld" to the degree that they know it won't break all other platforms too? -- - Alfred Perlstein From owner-svn-src-head@FreeBSD.ORG Thu Dec 4 16:39:06 2008 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 730D8106567B; Thu, 4 Dec 2008 16:39:06 +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 1A44C8FC0C; Thu, 4 Dec 2008 16:39:06 +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 mB4GaYax092863; Thu, 4 Dec 2008 09:36:34 -0700 (MST) (envelope-from imp@bsdimp.com) Date: Thu, 04 Dec 2008 09:36:42 -0700 (MST) Message-Id: <20081204.093642.778147376.imp@bsdimp.com> To: alfred@FreeBSD.org From: "M. Warner Losh" In-Reply-To: <20081204095756.GP27096@elvis.mu.org> References: <20081201132554.GD27096@elvis.mu.org> <20081201.221040.-1350500631.imp@bsdimp.com> <20081204095756.GP27096@elvis.mu.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, des@des.no, svn-src-all@FreeBSD.org, kientzle@FreeBSD.org, src-committers@FreeBSD.org Subject: Re: svn commit: r185499 - head X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 04 Dec 2008 16:39:06 -0000 In message: <20081204095756.GP27096@elvis.mu.org> Alfred Perlstein writes: : * M. Warner Losh [081201 21:12] wrote: : > In message: <20081201132554.GD27096@elvis.mu.org> : > Alfred Perlstein writes: : > : * Dag-Erling Sm??rgrav [081201 03:25] wrote: : > : > Tim Kientzle writes: : > : > > Alfred Perlstein writes: : > : > > > Log: : > : > > > Provide a 'tinderbox' target that compiles enough of FreeBSD that : > : > > > a developer can rest reasonably assured that the tinderbox will not : > : > > > be broken. This target leverages most of 'universe' but will exit : > : > > > non-zero and output a summary at the end. : > : > > > "make tinderbox" : > : > > Excellent! : > : > : > : > I really don't see the point, especially now that 'make universe' will : > : > issue a warning on stdout for every build that fails. As I've tried to : > : > explain to Alfred, the tinderbox does nothing magical, and nothing that : > : > isn't already covered by 'make universe'. I also asked him to discuss : > : > any changes with Poul-Henning before committing them. : > : : > : I'll summarize the changes here: : > : : > : Problems with make universe: : > : 1) Make universe returns success on failure. : > : 2) Make universe outputs the following on failure: : > : -------------------------------------------------------------- : > : make universe completed on `LC_ALL=C date`" : > : (started ${STARTTIME})" : > : -------------------------------------------------------------- : > : : > : This basically means you can't chain 'make universe' into something : > : like "make tinderbox || (echo oops | mail -s tinderbox failed...)". : > : : > : The summary at the end "completed" is very misleading. : > : : > : The tinderbox target differs as follows: : > : : > : It returns an error if it fails. : > : It outputs a summary of the failures at the end. : > : The name reflects what its for. ("what the heck is a universe?") : > : : > : : > : If you strongly believe that a target should return "true" on failure : > : and/or output "i worked" on failure then I'm not sure how to approach : > : that mindset, maybe you can help me understand where you're coming from : > : on that? Where is the utility in it? Is there something I'm missing? : > : > I think you ignored the discussions that said that 'universe' should : > be modified to exit with an error when there was an error, but : > shouldn't bail out EARLY. There were even patches to do this. : : Interesting, I didn't see them and they weren't committed. : : The owner/maintainer of universe hasn't really stepped up to : provide anything and ask me "hey Alfred, would this be helpful?" : and the owner/maintainer of tinderbox has not either. : : Mostly the two of them have told me "you do it, or shut up", so I : did it. Except in public there were others involved that had also done it. : > Based on that, why do something completely new and different? : : New and different? What? : : Maybe you can explain to me what's so earth shattering new and : different about having a make target behave like most any other : sane make target and have a name that is self-documenting? It invents a completely new target to do what the originator of universe said was the right behavior for universe. bz had even posted patches to make universe work this way. : There is a 'tinderbox' target, which is named so that when someone : says "gee, I wonder how to satisfy the tinderbox" they do not need : to read a wiki, blog, handbook, manpage, check IRC, news group : or mailing list archive to figure out, they can just run it and : get something that makes sense. 'Tinderbox' makes no sense to me because the tinderbox that's run only does one architecture. Your 'tindrebox' target does all the architectures, which doesn't make any sense to me. : Anyhow, I don't really care what's done so as long as there's a : top level target that does what I just committed, so if someone wants : to redo how I did what I did in order to get the exact same results : they can be my guest. : : I would hope that they have better things to do though. Why duplicate a bunch of code in the toplevel makefile and make it even more complicated than it already is? That way leads to long-term problems... Warner From owner-svn-src-head@FreeBSD.ORG Thu Dec 4 16:50:31 2008 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3F85B106564A; Thu, 4 Dec 2008 16:50:31 +0000 (UTC) (envelope-from des@des.no) Received: from tim.des.no (tim.des.no [194.63.250.121]) by mx1.freebsd.org (Postfix) with ESMTP id EEB568FC1A; Thu, 4 Dec 2008 16:50:30 +0000 (UTC) (envelope-from des@des.no) Received: from ds4.des.no (des.no [84.49.246.2]) by smtp.des.no (Postfix) with ESMTP id 165BA6D43F; Thu, 4 Dec 2008 16:50:30 +0000 (UTC) Received: by ds4.des.no (Postfix, from userid 1001) id F03A8844CF; Thu, 4 Dec 2008 17:50:29 +0100 (CET) From: =?utf-8?Q?Dag-Erling_Sm=C3=B8rgrav?= To: "Bjoern A. Zeeb" References: <200811291432.mATEWE2a053742@svn.freebsd.org> Date: Thu, 04 Dec 2008 17:50:29 +0100 In-Reply-To: <200811291432.mATEWE2a053742@svn.freebsd.org> (Bjoern A. Zeeb's message of "Sat, 29 Nov 2008 14:32:14 +0000 (UTC)") Message-ID: <86skp3yje2.fsf@ds4.des.no> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (berkeley-unix) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r185435 - in head: lib/libc/sys lib/libkvm share/man/man4 sys/compat/freebsd32 sys/kern sys/net sys/netinet sys/netinet6 sys/security/mac_bsdextended sys/sys usr.bin/cpuset usr.sbin/jai... X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 04 Dec 2008 16:50:31 -0000 "Bjoern A. Zeeb" writes: > Jails can have an unrestricted (no duplicate protection, etc.) name > in addition to the hostname. The jail name cannot be changed from > within a jail and is considered to be used for management purposes > or as audit-token in the future. Is there a specific reason why we allow duplicates? DES --=20 Dag-Erling Sm=C3=B8rgrav - des@des.no From owner-svn-src-head@FreeBSD.ORG Thu Dec 4 16:56:11 2008 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9B63F106564A; Thu, 4 Dec 2008 16:56:11 +0000 (UTC) (envelope-from des@des.no) Received: from tim.des.no (tim.des.no [194.63.250.121]) by mx1.freebsd.org (Postfix) with ESMTP id 55A928FC12; Thu, 4 Dec 2008 16:56:11 +0000 (UTC) (envelope-from des@des.no) Received: from ds4.des.no (des.no [84.49.246.2]) by smtp.des.no (Postfix) with ESMTP id 496E16D450; Thu, 4 Dec 2008 16:56:10 +0000 (UTC) Received: by ds4.des.no (Postfix, from userid 1001) id 2638B844D9; Thu, 4 Dec 2008 17:56:10 +0100 (CET) From: =?utf-8?Q?Dag-Erling_Sm=C3=B8rgrav?= To: "M. Warner Losh" References: <20081201132554.GD27096@elvis.mu.org> <20081201.221040.-1350500631.imp@bsdimp.com> <20081204095756.GP27096@elvis.mu.org> <20081204.093642.778147376.imp@bsdimp.com> Date: Thu, 04 Dec 2008 17:56:10 +0100 In-Reply-To: <20081204.093642.778147376.imp@bsdimp.com> (M. Warner Losh's message of "Thu, 04 Dec 2008 09:36:42 -0700 (MST)") Message-ID: <86oczryj4l.fsf@ds4.des.no> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (berkeley-unix) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, alfred@FreeBSD.org, kientzle@FreeBSD.org, src-committers@FreeBSD.org Subject: Re: svn commit: r185499 - head X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 04 Dec 2008 16:56:11 -0000 "M. Warner Losh" writes: > 'Tinderbox' makes no sense to me because the tinderbox that's run only > does one architecture. No, it runs 'make buildworld' for every supported architecture, for an appropriate definition of "supported". This is exactly what 'make universe' does, but the tinderbox has a lot of additional functionality related to scheduling, reporting, updating the source tree, selecting which kernels to build, cleaning the object directory ('rm -rf /usr/obj' or its moral equivalent is much faster than 'make cleandir'), etc. None of this changes how the actual build happens, though. DES --=20 Dag-Erling Sm=C3=B8rgrav - des@des.no From owner-svn-src-head@FreeBSD.ORG Thu Dec 4 17:08:53 2008 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E8AC81065670; Thu, 4 Dec 2008 17:08:53 +0000 (UTC) (envelope-from bright@elvis.mu.org) Received: from elvis.mu.org (elvis.mu.org [192.203.228.196]) by mx1.freebsd.org (Postfix) with ESMTP id D29AE8FC08; Thu, 4 Dec 2008 17:08:53 +0000 (UTC) (envelope-from bright@elvis.mu.org) Received: by elvis.mu.org (Postfix, from userid 1192) id B38241A3C3A; Thu, 4 Dec 2008 09:08:53 -0800 (PST) Date: Thu, 4 Dec 2008 09:08:53 -0800 From: Alfred Perlstein To: "M. Warner Losh" Message-ID: <20081204170853.GR27096@elvis.mu.org> References: <20081201132554.GD27096@elvis.mu.org> <20081201.221040.-1350500631.imp@bsdimp.com> <20081204095756.GP27096@elvis.mu.org> <20081204.093642.778147376.imp@bsdimp.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20081204.093642.778147376.imp@bsdimp.com> User-Agent: Mutt/1.4.2.3i Cc: svn-src-head@FreeBSD.org, des@des.no, svn-src-all@FreeBSD.org, kientzle@FreeBSD.org, src-committers@FreeBSD.org Subject: Re: svn commit: r185499 - head X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 04 Dec 2008 17:08:54 -0000 * M. Warner Losh [081204 08:39] wrote: > : > > : > I think you ignored the discussions that said that 'universe' should > : > be modified to exit with an error when there was an error, but > : > shouldn't bail out EARLY. There were even patches to do this. > : > : Interesting, I didn't see them and they weren't committed. > : > : The owner/maintainer of universe hasn't really stepped up to > : provide anything and ask me "hey Alfred, would this be helpful?" > : and the owner/maintainer of tinderbox has not either. > : > : Mostly the two of them have told me "you do it, or shut up", so I > : did it. > > Except in public there were others involved that had also done it. That's great, and the patches I saw posted didn't work. > : > Based on that, why do something completely new and different? > : > : New and different? What? > : > : Maybe you can explain to me what's so earth shattering new and > : different about having a make target behave like most any other > : sane make target and have a name that is self-documenting? > > It invents a completely new target to do what the originator of > universe said was the right behavior for universe. bz had even posted > patches to make universe work this way. 1) New target? - Yes, even an alias target is good if the name is self-documenting. 2) 'tinderbox' is bz's target, except (no offense to bz) mine works. > : There is a 'tinderbox' target, which is named so that when someone > : says "gee, I wonder how to satisfy the tinderbox" they do not need > : to read a wiki, blog, handbook, manpage, check IRC, news group > : or mailing list archive to figure out, they can just run it and > : get something that makes sense. > > 'Tinderbox' makes no sense to me because the tinderbox that's run only > does one architecture. Your 'tindrebox' target does all the > architectures, which doesn't make any sense to me. Really? Which arch does tinderbox check? I saw all this stuff going out that said: TB --- 2007-10-04 16:25:01 - tinderbox 2.3 running on freebsd-stable.sentex.ca TB --- 2007-10-04 16:25:01 - starting RELENG_6 tinderbox run for sparc64/sparc64 TB --- 2007-10-04 16:25:01 - cleaning the object tree TB --- 2007-10-04 16:25:37 - checking out the source tree TB --- 2007-10-04 16:25:37 - cd /tinderbox/RELENG_6/sparc64/sparc64 TB --- 2007-10-04 16:25:37 - /usr/bin/cvs -f -R -q -d/home/ncvs update -Pd -rRELENG_6 src TB --- 2007-06-05 21:49:46 - tinderbox 2.3 running on freebsd-stable.sentex.ca TB --- 2007-06-05 21:49:46 - starting RELENG_6 tinderbox run for i386/pc98 TB --- 2007-06-05 21:49:46 - cleaning the object tree TB --- 2007-06-05 21:50:54 - checking out the source tree TB --- 2007-06-05 21:50:54 - cd /tinderbox/RELENG_6/i386/pc98 TB --- 2007-06-05 21:50:54 - /usr/bin/cvs -f -R -q -d/home/ncvs update -Pd -rREL ENG_6 src Maybe this is old? It looks like tinderbox requires more than just i386... Here's a more recent one... : On Tuesday 04 November 2008, FreeBSD Tinderbox wrote: : > TB --- 2008-11-04 18:31:04 - tinderbox 2.3 running on : > freebsd-current.sentex.ca TB --- 2008-11-04 18:31:04 - starting HEAD : > tinderbox run for powerpc/powerpc TB --- 2008-11-04 18:31:04 - cleaning the : > object tree : > TB --- 2008-11-04 18:31:29 - cvsupping the source tree : > TB --- 2008-11-04 18:31:29 - /usr/bin/csup -r 3 -g -L 1 -h localhost -s : > /tinderbox/HEAD/powerpc/powerpc/supfile TB --- 2008-11-04 18:31:37 - : > building world (CFLAGS=-O -pipe) : > TB --- 2008-11-04 18:31:37 - cd /src : > TB --- 2008-11-04 18:31:37 - /usr/bin/make -B buildworld Are you sure tinderbox is only i386? I also have some mails from DES saying stuff like: [[ DES ]] > It's not mine, and Poul-Hennning has clearly stated that he doesn't want > it changed. I *have* provided a build-testing system that notifies you > of any breakage, and repeatedly encouraged people to use it instead of > 'make universe'. > > If you don't want to wait for 'make universe' or the tinderbox to > finish, there are other, faster ways of testing other architectures. > For instance, to verify that your code does not break sun4v: > > $ make toolchain TARGET=3Dsun4v > > This builds a cross-toolchain; you only need to do it once. > > $ make buildenv TARGET=3Dsun4v > > This will start a shell with the environment set up for a cross-build. > > $ cd where/my/code/is/located > $ make obj && make depend && make > > You only need to do 'make obj' once, but you have to re-run 'make > depend' any time you add or remove a source file or an #include > directive. > > If you're working on the kernel: > > $ make kernel-toolchain TARGET=3Dsun4v > > Again, you only need to do this once. Furthermore, kernel-toolchain is > a subset of toolchain, so you don't need to do the former if you've > already done the latter. > > $ make buildkernel TARGET=3Dsun4v KERNCONF=3DGENERIC > > (you can specify a customized config file instead of GENERIC, but make > sure it's in /sys/sun4v/conf) > > If what you're working on doesn't affect any modules, specify > -DNO_MODULES to speed things up. If something breaks and you need to > run it again, specify -DNO_KERNELCLEAN, and -DNO_KERNELDEPEND if you > haven't added or removed any source files or #include directives or > changed the config file. > : Anyhow, I don't really care what's done so as long as there's a > : top level target that does what I just committed, so if someone wants > : to redo how I did what I did in order to get the exact same results > : they can be my guest. > : > : I would hope that they have better things to do though. > > Why duplicate a bunch of code in the toplevel makefile and make it > even more complicated than it already is? That way leads to long-term > problems... It's not duplicated, it leverages the universe target by having a few ifdefs. Something I was nervous enough doing because I wasn't sure what phk was going to say about that. Anyhow, if someone wants to unifdef (or wants me to do it) such that what I've done becomes the tinderbox target and the same stuff is leveraged by "universe" (error exit + summary of failures at the end). I'm more than happy to do so. -- - Alfred Perlstein From owner-svn-src-head@FreeBSD.ORG Thu Dec 4 17:25:46 2008 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 66B091065672; Thu, 4 Dec 2008 17:25:46 +0000 (UTC) (envelope-from des@des.no) Received: from tim.des.no (tim.des.no [194.63.250.121]) by mx1.freebsd.org (Postfix) with ESMTP id EC6EE8FC19; Thu, 4 Dec 2008 17:25:45 +0000 (UTC) (envelope-from des@des.no) Received: from ds4.des.no (des.no [84.49.246.2]) by smtp.des.no (Postfix) with ESMTP id 159146D43F; Thu, 4 Dec 2008 17:25:45 +0000 (UTC) Received: by ds4.des.no (Postfix, from userid 1001) id EE37F844D9; Thu, 4 Dec 2008 18:25:44 +0100 (CET) From: =?utf-8?Q?Dag-Erling_Sm=C3=B8rgrav?= To: Alfred Perlstein References: <49338E98.7020104@freebsd.org> <863ah8rvcd.fsf@ds4.des.no> <20081201132554.GD27096@elvis.mu.org> <20081201.221040.-1350500631.imp@bsdimp.com> <20081204095756.GP27096@elvis.mu.org> <863ah4158t.fsf@ds4.des.no> <20081204163542.GQ27096@elvis.mu.org> Date: Thu, 04 Dec 2008 18:25:44 +0100 In-Reply-To: <20081204163542.GQ27096@elvis.mu.org> (Alfred Perlstein's message of "Thu, 4 Dec 2008 08:35:42 -0800") Message-ID: <86k5afyhrb.fsf@ds4.des.no> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (berkeley-unix) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, kientzle@FreeBSD.org, "M. Warner Losh" , src-committers@FreeBSD.org Subject: Re: svn commit: r185499 - head X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 04 Dec 2008 17:25:46 -0000 Alfred Perlstein writes: > Really? So a person on a i386 platform that touches let's say > src/sys/proc.h will have quality checked via "make buildworld" > to the degree that they know it won't break all other platforms > too? You are trying to turn this into a developers vs. tinderbox issue. It's not. The kind of mistakes that break the tinderbox directly affect users and other developers. If your changes affect MD code or relies on the size or endianness of specific types, you should cross-build to an architecture with different register width and endianness. I wish I didn't have to point this out; it should be obvious to anyone. After all, it's been almost ten years since we added our first non-i386 platform (alpha). I created the tinderbox precisely because obrien@ got mad at me for repeatedly breaking the alpha build. Most bit-width issues can be caught by cross-building to amd64 if you're working on i386, and to i386 if you're working on amd64. However, the most common bit-width-related mistake is to assume that various types (long, size_t, time_t etc) are the same size as int, so you are far less likely to break i386 (where they are) when working on amd64 (where they aren't) than the reverse. Endianness issues will usually only become apparent when you *run* the code, but they're usually a matter of network vs host order, and will therefore show up on both i386 and amd64. The final class of problems is those that arise from the use of MD interfaces that are implemented only on i386 and amd64. These two platforms are sufficiently similar that code written for one usually compiles and runs on the other, but it may not compile and run on, say, powerpc or sparc64. For instance, certain atomic operations are not implemented on arm (or weren't, the last time I looked). Therefore, you are probably better off cross-building to powerpc (32-bit big-endian) when working on amd64 (64-bit little-endian), and to sparc64 (64-bit big-endian) when working on i386 (32-bit little-endian). Cross-building is easy. It is described in build(7), which every committer should read. If anything in that man page is unclear, feel free to ask me, or ru@ if I'm unavailable - and to update the man page once you've been enlightened. DES --=20 Dag-Erling Sm=C3=B8rgrav - des@des.no From owner-svn-src-head@FreeBSD.ORG Thu Dec 4 18:08:38 2008 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 638571065673; Thu, 4 Dec 2008 18:08:38 +0000 (UTC) (envelope-from bright@elvis.mu.org) Received: from elvis.mu.org (elvis.mu.org [192.203.228.196]) by mx1.freebsd.org (Postfix) with ESMTP id 437A78FC1E; Thu, 4 Dec 2008 18:08:38 +0000 (UTC) (envelope-from bright@elvis.mu.org) Received: by elvis.mu.org (Postfix, from userid 1192) id F027D1A3C3A; Thu, 4 Dec 2008 10:08:37 -0800 (PST) Date: Thu, 4 Dec 2008 10:08:37 -0800 From: Alfred Perlstein To: Dag-Erling Sm??rgrav Message-ID: <20081204180837.GS27096@elvis.mu.org> References: <49338E98.7020104@freebsd.org> <863ah8rvcd.fsf@ds4.des.no> <20081201132554.GD27096@elvis.mu.org> <20081201.221040.-1350500631.imp@bsdimp.com> <20081204095756.GP27096@elvis.mu.org> <863ah4158t.fsf@ds4.des.no> <20081204163542.GQ27096@elvis.mu.org> <86k5afyhrb.fsf@ds4.des.no> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <86k5afyhrb.fsf@ds4.des.no> User-Agent: Mutt/1.4.2.3i Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, kientzle@FreeBSD.org, "M. Warner Losh" , src-committers@FreeBSD.org Subject: Re: svn commit: r185499 - head X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 04 Dec 2008 18:08:38 -0000 * Dag-Erling Sm??rgrav [081204 09:25] wrote: > Alfred Perlstein writes: > > Really? So a person on a i386 platform that touches let's say > > src/sys/proc.h will have quality checked via "make buildworld" > > to the degree that they know it won't break all other platforms > > too? > > You are trying to turn this into a developers vs. tinderbox issue. It's > not. The kind of mistakes that break the tinderbox directly affect > users and other developers. No, I'm trying to get a simple target that makes sense that will prevent people from breaking tinderbox. (failing that then turning tinderbox off because it's too complex) There's a lot below that I won't really comment on because I understand most of it and the parts I don't, I honestly don't care to! Here's something to consider: Lets just say it takes a developer about an hour or two to be "enlightened" as to a new system instead of just being told "hey run this one liner", you've just soaked up $number_of_committers * $enlightenment_time man hours. How many hours of enlightenment do we have versus code? That and, since the process requires "enlightenment", you've caused that developer to "page out" whatever they had in their head to work on, _every time they commit_. Soooooo frustrating. This adds up to frustration, mistakes and missed productivity. And that is what I am trying to address. And I'm done too! -Alfred > > If your changes affect MD code or relies on the size or endianness of > specific types, you should cross-build to an architecture with different > register width and endianness. I wish I didn't have to point this out; > it should be obvious to anyone. After all, it's been almost ten years > since we added our first non-i386 platform (alpha). I created the > tinderbox precisely because obrien@ got mad at me for repeatedly > breaking the alpha build. > > Most bit-width issues can be caught by cross-building to amd64 if you're > working on i386, and to i386 if you're working on amd64. However, the > most common bit-width-related mistake is to assume that various types > (long, size_t, time_t etc) are the same size as int, so you are far less > likely to break i386 (where they are) when working on amd64 (where they > aren't) than the reverse. > > Endianness issues will usually only become apparent when you *run* the > code, but they're usually a matter of network vs host order, and will > therefore show up on both i386 and amd64. > > The final class of problems is those that arise from the use of MD > interfaces that are implemented only on i386 and amd64. These two > platforms are sufficiently similar that code written for one usually > compiles and runs on the other, but it may not compile and run on, say, > powerpc or sparc64. For instance, certain atomic operations are not > implemented on arm (or weren't, the last time I looked). Therefore, you > are probably better off cross-building to powerpc (32-bit big-endian) > when working on amd64 (64-bit little-endian), and to sparc64 (64-bit > big-endian) when working on i386 (32-bit little-endian). > > Cross-building is easy. It is described in build(7), which every > committer should read. If anything in that man page is unclear, feel > free to ask me, or ru@ if I'm unavailable - and to update the man page > once you've been enlightened. > > DES > -- > Dag-Erling Sm??rgrav - des@des.no -- - Alfred Perlstein From owner-svn-src-head@FreeBSD.ORG Thu Dec 4 18:20:25 2008 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5CFAF1065673; Thu, 4 Dec 2008 18:20:25 +0000 (UTC) (envelope-from des@des.no) Received: from tim.des.no (tim.des.no [194.63.250.121]) by mx1.freebsd.org (Postfix) with ESMTP id 0C8928FC0A; Thu, 4 Dec 2008 18:20:25 +0000 (UTC) (envelope-from des@des.no) Received: from ds4.des.no (des.no [84.49.246.2]) by smtp.des.no (Postfix) with ESMTP id 23CAE6D44E; Thu, 4 Dec 2008 18:20:24 +0000 (UTC) Received: by ds4.des.no (Postfix, from userid 1001) id 0335D844C4; Thu, 4 Dec 2008 19:20:23 +0100 (CET) From: =?utf-8?Q?Dag-Erling_Sm=C3=B8rgrav?= To: Alfred Perlstein References: <49338E98.7020104@freebsd.org> <863ah8rvcd.fsf@ds4.des.no> <20081201132554.GD27096@elvis.mu.org> <20081201.221040.-1350500631.imp@bsdimp.com> <20081204095756.GP27096@elvis.mu.org> <863ah4158t.fsf@ds4.des.no> <20081204163542.GQ27096@elvis.mu.org> <86k5afyhrb.fsf@ds4.des.no> <20081204180837.GS27096@elvis.mu.org> Date: Thu, 04 Dec 2008 19:20:23 +0100 In-Reply-To: <20081204180837.GS27096@elvis.mu.org> (Alfred Perlstein's message of "Thu, 4 Dec 2008 10:08:37 -0800") Message-ID: <86vdtzx0ns.fsf@ds4.des.no> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (berkeley-unix) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, kientzle@FreeBSD.org, "M. Warner Losh" , src-committers@FreeBSD.org Subject: Re: svn commit: r185499 - head X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 04 Dec 2008 18:20:25 -0000 Alfred Perlstein writes: > No, I'm trying to get a simple target that makes sense that will > prevent people from breaking tinderbox. (failing that then turning > tinderbox off because it's too complex) Perhaps if you tell me what it is about the tinderbox that you don't understand, I could help you understand it. > Lets just say it takes a developer about an hour or two to be > "enlightened" as to a new system instead of just being told "hey > run this one liner", you've just soaked up $number_of_committers * > $enlightenment_time man hours. What is new about the build system? And why do you think it's a bad idea for committers to understand how it works? Do you really want to run an operating system written by people who do not understand how it is built? > That and, since the process requires "enlightenment", you've caused > that developer to "page out" whatever they had in their head to work > on, _every time they commit_. Soooooo frustrating. I wonder - does anybody else than you have that problem? Don't you think that once people understand how the build system works, they would be able to do this without much thought? As a bonus, they will also know how to rebuild just the parts they modified, instead of the entire tree, shaving hours off the edit-compile-test cycle. > And I'm done too! But in the process, you managed to piss off just about everybody who had an interest in the matter. DES --=20 Dag-Erling Sm=C3=B8rgrav - des@des.no From owner-svn-src-head@FreeBSD.ORG Thu Dec 4 18:50:08 2008 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 29574106564A; Thu, 4 Dec 2008 18:50:08 +0000 (UTC) (envelope-from bzeeb-lists@lists.zabbadoz.net) Received: from mail.cksoft.de (mail.cksoft.de [62.111.66.27]) by mx1.freebsd.org (Postfix) with ESMTP id D0B2B8FC16; Thu, 4 Dec 2008 18:50:07 +0000 (UTC) (envelope-from bzeeb-lists@lists.zabbadoz.net) Received: from localhost (amavis.str.cksoft.de [192.168.74.71]) by mail.cksoft.de (Postfix) with ESMTP id 010F641C72C; Thu, 4 Dec 2008 19:50: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 U91DWj0D75B7; Thu, 4 Dec 2008 19:50:05 +0100 (CET) Received: by mail.cksoft.de (Postfix, from userid 66) id 9C49141C6A1; Thu, 4 Dec 2008 19:50: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 E01744448D5; Thu, 4 Dec 2008 18:49:16 +0000 (UTC) Date: Thu, 4 Dec 2008 18:49:16 +0000 (UTC) From: "Bjoern A. Zeeb" X-X-Sender: bz@maildrop.int.zabbadoz.net To: =?utf-8?Q?Dag-Erling_Sm=C3=B8rgrav?= In-Reply-To: <86skp3yje2.fsf@ds4.des.no> Message-ID: <20081204184332.C80401@maildrop.int.zabbadoz.net> References: <200811291432.mATEWE2a053742@svn.freebsd.org> <86skp3yje2.fsf@ds4.des.no> X-OpenPGP-Key: 0x14003F198FEFA3E77207EE8D2B58B8F83CCF1842 MIME-Version: 1.0 Content-Type: MULTIPART/MIXED; BOUNDARY="0-1700529950-1228416556=:80401" Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r185435 - in head: lib/libc/sys lib/libkvm share/man/man4 sys/compat/freebsd32 sys/kern sys/net sys/netinet sys/netinet6 sys/security/mac_bsdextended sys/sys usr.bin/cpuset usr.sbin/jai... X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 04 Dec 2008 18:50:08 -0000 This message is in MIME format. The first part should be readable text, while the remaining parts are likely unreadable without MIME-aware tools. --0-1700529950-1228416556=:80401 Content-Type: TEXT/PLAIN; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: QUOTED-PRINTABLE On Thu, 4 Dec 2008, Dag-Erling Sm=F8rgrav wrote: > "Bjoern A. Zeeb" writes: >> Jails can have an unrestricted (no duplicate protection, etc.) name >> in addition to the hostname. The jail name cannot be changed from >> within a jail and is considered to be used for management purposes >> or as audit-token in the future. > > Is there a specific reason why we allow duplicates? Yes, so that people have a choice. You would have to take into account "DYING" jails with possibly duplicate names anyway. And it's a purely administrative name (cannot be changed from within the jail) so it's up to the administrator to have 2 "Customer Webserver" jails or a "Customer Webserver Tin" and a "Customer Webserver Box". BTW. in case people wonder how to set it (atm.) from rc.conf, you can use jail__flags. /bz --=20 Bjoern A. Zeeb Stop bit received. Insert coin for new game. --0-1700529950-1228416556=:80401-- From owner-svn-src-head@FreeBSD.ORG Thu Dec 4 19:48:14 2008 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 00FEC106573F; Thu, 4 Dec 2008 19:48:13 +0000 (UTC) (envelope-from bright@elvis.mu.org) Received: from elvis.mu.org (elvis.mu.org [192.203.228.196]) by mx1.freebsd.org (Postfix) with ESMTP id 5FCB68FC1D; Thu, 4 Dec 2008 19:48:13 +0000 (UTC) (envelope-from bright@elvis.mu.org) Received: by elvis.mu.org (Postfix, from userid 1192) id 46C291A3C3D; Thu, 4 Dec 2008 11:48:13 -0800 (PST) Date: Thu, 4 Dec 2008 11:48:13 -0800 From: Alfred Perlstein To: Dag-Erling Sm??rgrav Message-ID: <20081204194813.GT27096@elvis.mu.org> References: <49338E98.7020104@freebsd.org> <863ah8rvcd.fsf@ds4.des.no> <20081201132554.GD27096@elvis.mu.org> <20081201.221040.-1350500631.imp@bsdimp.com> <20081204095756.GP27096@elvis.mu.org> <863ah4158t.fsf@ds4.des.no> <20081204163542.GQ27096@elvis.mu.org> <86k5afyhrb.fsf@ds4.des.no> <20081204180837.GS27096@elvis.mu.org> <86vdtzx0ns.fsf@ds4.des.no> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <86vdtzx0ns.fsf@ds4.des.no> User-Agent: Mutt/1.4.2.3i Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, kientzle@FreeBSD.org, "M. Warner Losh" , src-committers@FreeBSD.org Subject: Re: svn commit: r185499 - head X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 04 Dec 2008 19:48:14 -0000 * Dag-Erling Sm??rgrav [081204 10:21] wrote: > Alfred Perlstein writes: > > No, I'm trying to get a simple target that makes sense that will > > prevent people from breaking tinderbox. (failing that then turning > > tinderbox off because it's too complex) > > Perhaps if you tell me what it is about the tinderbox that you don't > understand, I could help you understand it. I think I have all I need right now. I was getting confused because I was being told by multiple confused developers that "tinderbox" was different things because it's complicated. We should probably review all these committers and paddle them or yank their commit bits for being stupid or something. > > Lets just say it takes a developer about an hour or two to be > > "enlightened" as to a new system instead of just being told "hey > > run this one liner", you've just soaked up $number_of_committers * > > $enlightenment_time man hours. > > What is new about the build system? And why do you think it's a bad > idea for committers to understand how it works? Do you really want to > run an operating system written by people who do not understand how it > is built? It should not be a requirement that a developer need to know all this stuff. And by stuff I mean "how to roll my own tinderbox". I do find it amusing that you're asserting that _I'm_ saying this when I'm the only one it appears that could fix this target. :) I'm more concerned about developing anything where I have to work with people that don't take input on issues, yell at people for not understanding complex systems and winge for god knows how long about a 20 line patch just because it wasn't exactly "how they would have done it"... WHEN IN FACT THEY REFUSED AND WOULD NOT HAVE "DONE IT". > > That and, since the process requires "enlightenment", you've caused > > that developer to "page out" whatever they had in their head to work > > on, _every time they commit_. Soooooo frustrating. > > I wonder - does anybody else than you have that problem? Don't you > think that once people understand how the build system works, they would > be able to do this without much thought? As a bonus, they will also > know how to rebuild just the parts they modified, instead of the entire > tree, shaving hours off the edit-compile-test cycle. Yes, that's great, but it should be optional. We shouldn't beat things into people. > > And I'm done too! > > But in the process, you managed to piss off just about everybody who had > an interest in the matter. That was your choice. So far I'm not aware of anyone that's quit freebsd in the past few years due to anything I've done. (really done now) :) -- - Alfred Perlstein From owner-svn-src-head@FreeBSD.ORG Thu Dec 4 20:32:53 2008 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B93D21065673; Thu, 4 Dec 2008 20:32:53 +0000 (UTC) (envelope-from gnn@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A84518FC14; Thu, 4 Dec 2008 20:32:53 +0000 (UTC) (envelope-from gnn@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mB4KWr2B033881; Thu, 4 Dec 2008 20:32:53 GMT (envelope-from gnn@svn.freebsd.org) Received: (from gnn@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mB4KWrBG033880; Thu, 4 Dec 2008 20:32:53 GMT (envelope-from gnn@svn.freebsd.org) Message-Id: <200812042032.mB4KWrBG033880@svn.freebsd.org> From: "George V. Neville-Neil" Date: Thu, 4 Dec 2008 20:32:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185620 - head/sys/dev/cxgb/common X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 04 Dec 2008 20:32:53 -0000 Author: gnn Date: Thu Dec 4 20:32:53 2008 New Revision: 185620 URL: http://svn.freebsd.org/changeset/base/185620 Log: Fix a bug with the ael1006 PHY. The bug shows up as persistent but incomplete packet loss, of between 10-30%. The fix is to put the PHY into and take it out of local loopback mode when resetting the interface. Obtained from: Chelsio Inc. MFC after: 3 days Modified: head/sys/dev/cxgb/common/cxgb_ael1002.c Modified: head/sys/dev/cxgb/common/cxgb_ael1002.c ============================================================================== --- head/sys/dev/cxgb/common/cxgb_ael1002.c Thu Dec 4 20:04:25 2008 (r185619) +++ head/sys/dev/cxgb/common/cxgb_ael1002.c Thu Dec 4 20:32:53 2008 (r185620) @@ -205,6 +205,16 @@ static int ael1006_reset(struct cphy *ph t3_write_reg(phy->adapter, A_T3DBG_GPIO_EN, gpio_out); msleep(125); t3_phy_reset(phy, MDIO_DEV_PMA_PMD, wait); + + /* Phy loopback work around for ael1006 */ + /* Soft reset phy by toggling loopback */ + msleep(125); + /* Put phy into local loopback */ + t3_mdio_change_bits(phy, MDIO_DEV_PMA_PMD, MII_BMCR, 0, 1); + msleep(125); + /* Take phy out of local loopback */ + t3_mdio_change_bits(phy, MDIO_DEV_PMA_PMD, MII_BMCR, 1, 0); + return 0; } From owner-svn-src-head@FreeBSD.ORG Thu Dec 4 21:24:47 2008 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 66C43106567B; Thu, 4 Dec 2008 21:24:47 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from server.baldwin.cx (bigknife-pt.tunnel.tserv9.chi1.ipv6.he.net [IPv6:2001:470:1f10:75::2]) by mx1.freebsd.org (Postfix) with ESMTP id DE8538FC20; Thu, 4 Dec 2008 21:24:46 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from localhost.corp.yahoo.com (john@localhost [IPv6:::1]) (authenticated bits=0) by server.baldwin.cx (8.14.3/8.14.3) with ESMTP id mB4LOIOj033364; Thu, 4 Dec 2008 16:24:40 -0500 (EST) (envelope-from jhb@freebsd.org) From: John Baldwin To: Kostik Belousov Date: Thu, 4 Dec 2008 13:36:40 -0500 User-Agent: KMail/1.9.7 References: <200812031845.mB3IjcZC098534@svn.freebsd.org> <200812031803.03650.jhb@freebsd.org> <20081204111041.GB2038@deviant.kiev.zoral.com.ua> In-Reply-To: <20081204111041.GB2038@deviant.kiev.zoral.com.ua> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-15" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200812041336.40739.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH authentication, not delayed by milter-greylist-2.0.2 (server.baldwin.cx [IPv6:::1]); Thu, 04 Dec 2008 16:24:40 -0500 (EST) X-Virus-Scanned: ClamAV 0.93.1/8721/Thu Dec 4 08:26:10 2008 on server.baldwin.cx X-Virus-Status: Clean X-Spam-Status: No, score=-2.6 required=4.2 tests=AWL,BAYES_00,NO_RELAYS 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: r185589 - head/sys/compat/freebsd32 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 04 Dec 2008 21:24:47 -0000 On Thursday 04 December 2008 06:10:41 am Kostik Belousov wrote: > On Wed, Dec 03, 2008 at 06:03:03PM -0500, John Baldwin wrote: > > On Wednesday 03 December 2008 04:43:06 pm Kostik Belousov wrote: > > > On Wed, Dec 03, 2008 at 06:45:38PM +0000, John Baldwin wrote: > > > > Author: jhb > > > > Date: Wed Dec 3 18:45:38 2008 > > > > New Revision: 185589 > > > > URL: http://svn.freebsd.org/changeset/base/185589 > > > > > > > > Log: > > > > When unloading a 32-bit system call module, restore the sysent vector in > > > > the 32-bit system call table instead of the main system call table. > > > > > > > > Modified: > > > > head/sys/compat/freebsd32/freebsd32_misc.c > > > > > > > The module build glue is not committed into the svn, isn't it ? > > > > Err, it is. It's in freebsd32_util.h (SYSCALL32_MODULE, etc.). > > I saw that, I would call it initialization glue. I mean that freebsd32 > cannot be _load_ as module. No, this is about having other modules contain 32-bit system calls. For example, I have patches to enable 32-bit compat system calls for VFS_AIO that live in aio.ko. -- John Baldwin From owner-svn-src-head@FreeBSD.ORG Thu Dec 4 21:35:09 2008 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 317461065675 for ; Thu, 4 Dec 2008 21:35:09 +0000 (UTC) (envelope-from yanefbsd@gmail.com) Received: from rv-out-0506.google.com (rv-out-0506.google.com [209.85.198.233]) by mx1.freebsd.org (Postfix) with ESMTP id F19A88FC18 for ; Thu, 4 Dec 2008 21:35:08 +0000 (UTC) (envelope-from yanefbsd@gmail.com) Received: by rv-out-0506.google.com with SMTP id b25so4064349rvf.43 for ; Thu, 04 Dec 2008 13:35:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to :subject:cc:in-reply-to:mime-version:content-type :content-transfer-encoding:content-disposition:references; bh=2IX/OP+lIlA0paSb45aXeRX6uVQJg+zchs9jkmbe0Tc=; b=MpDgDOoOQse0a6Jb9RHSMcwpr/dG9J4/P1rK6lDtAPrfbmVtcRIsBmE/APL73HJXQC kImvPIqypgtgM4yZMbO/dJ7fzCjqk9ug0zp50oKk96i9YJDiv21XLqS1VaMSrvmZr/fl 8L5ySA3DWNlA2XxQIo0lc9/4GH88TkCmQ0AAc= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:cc:in-reply-to:mime-version :content-type:content-transfer-encoding:content-disposition :references; b=xGLiaVhIr8oKLvup3NapM8Lww8jvGbPqpojTUOBHwegzBG6Ong4NiVcP2Vfu+JWya3 zLlh96XTzFRsJ4jS3aqTgu41y2PV5DxL34l0mf0TVgG1IH2WtcYAMiDbtwVFFKWxCpFM 21LbOjgu3LzWCRzcNiX224L30JjJId/LjJNnQ= Received: by 10.141.176.4 with SMTP id d4mr7140842rvp.285.1228426508691; Thu, 04 Dec 2008 13:35:08 -0800 (PST) Received: by 10.140.158.13 with HTTP; Thu, 4 Dec 2008 13:35:08 -0800 (PST) Message-ID: <7d6fde3d0812041335u3134209at5a5f792e56290399@mail.gmail.com> Date: Thu, 4 Dec 2008 13:35:08 -0800 From: "Garrett Cooper" To: "Alfred Perlstein" In-Reply-To: <20081204194813.GT27096@elvis.mu.org> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <49338E98.7020104@freebsd.org> <20081201132554.GD27096@elvis.mu.org> <20081201.221040.-1350500631.imp@bsdimp.com> <20081204095756.GP27096@elvis.mu.org> <863ah4158t.fsf@ds4.des.no> <20081204163542.GQ27096@elvis.mu.org> <86k5afyhrb.fsf@ds4.des.no> <20081204180837.GS27096@elvis.mu.org> <86vdtzx0ns.fsf@ds4.des.no> <20081204194813.GT27096@elvis.mu.org> Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, kientzle@freebsd.org, svn-src-head@freebsd.org, Dag-Erling Sm??rgrav , "M. Warner Losh" Subject: Re: svn commit: r185499 - head X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 04 Dec 2008 21:35:09 -0000 On Thu, Dec 4, 2008 at 11:48 AM, Alfred Perlstein wrote: > * Dag-Erling Sm??rgrav [081204 10:21] wrote: >> Alfred Perlstein writes: >> > No, I'm trying to get a simple target that makes sense that will >> > prevent people from breaking tinderbox. (failing that then turning >> > tinderbox off because it's too complex) >> >> Perhaps if you tell me what it is about the tinderbox that you don't >> understand, I could help you understand it. > > I think I have all I need right now. I was getting confused > because I was being told by multiple confused developers that > "tinderbox" was different things because it's complicated. > > We should probably review all these committers and paddle them > or yank their commit bits for being stupid or something. > >> > Lets just say it takes a developer about an hour or two to be >> > "enlightened" as to a new system instead of just being told "hey >> > run this one liner", you've just soaked up $number_of_committers * >> > $enlightenment_time man hours. >> >> What is new about the build system? And why do you think it's a bad >> idea for committers to understand how it works? Do you really want to >> run an operating system written by people who do not understand how it >> is built? > > It should not be a requirement that a developer need to know > all this stuff. And by stuff I mean "how to roll my own tinderbox". > > I do find it amusing that you're asserting that _I'm_ saying this > when I'm the only one it appears that could fix this target. :) > > I'm more concerned about developing anything where I have to work > with people that don't take input on issues, yell at people for not > understanding complex systems and winge for god knows how long about > a 20 line patch just because it wasn't exactly "how they would have > done it"... WHEN IN FACT THEY REFUSED AND WOULD NOT HAVE "DONE IT". > >> > That and, since the process requires "enlightenment", you've caused >> > that developer to "page out" whatever they had in their head to work >> > on, _every time they commit_. Soooooo frustrating. >> >> I wonder - does anybody else than you have that problem? Don't you >> think that once people understand how the build system works, they would >> be able to do this without much thought? As a bonus, they will also >> know how to rebuild just the parts they modified, instead of the entire >> tree, shaving hours off the edit-compile-test cycle. > > Yes, that's great, but it should be optional. We shouldn't beat > things into people. > >> > And I'm done too! >> >> But in the process, you managed to piss off just about everybody who had >> an interest in the matter. > > That was your choice. So far I'm not aware of anyone that's quit > freebsd in the past few years due to anything I've done. > > (really done now) :) > > -- > - Alfred Perlstein Don't mean to stir up the hornet's nest any further, but I wanted to help constructively with this `issue': 1. I can see the logic behind what Alfred's doing, and I agree with it 100% with the following `terms': a. For generic kernel / userland codebase changes, a `tinderbox' target like Alfred put in, would be best for determining issues over the entire system. b. For codebase changes that are target/arch specific or contain target-specific driver code (for instance a MIPS specific net driver), it wouldn't really make sense to run Alfred's tinderbox for everything. c. For commit and after a merge, Alfred's `tinderbox' target should be executed. 2. I honestly think that the tinderbox target should be renamed to tinderfarm though, because I see the argument that DES is noting, mostly because of continuity. I do think that keeping a tinderfarm build target within the make system would be beneficial though, as it would allow the tinderbox Perl script to shrink and DES and I would be able to work out an agreement for making a tinderbox (/ tinderfarm?) script to be used as an overall functional and regression testing framework. 3. Devs understanding how the build system works to the extent where they can dig up manpages and become more proficient if necessary is crucial. I've seen some very negative effects of using wrapper scripts to execute builds, and I'd rather we not go this route, if at all possible. However, having a more abbreviated way of expressing builds is nice though, because most folks maintain this logic in wrapper scripts in local workspaces, and this information quickly gets out of date as time progresses :). 3. As for the issue with make universe, isn't there an equivalent to :: in pmake like there is in gmake? Targets can fail to build, but at least it'll continue moving on, and if the output messages are proper, one can note: `blah target failed' *shrugs*, and keep on moving on. Most devs should be using a break on build error make mode, whereas overall tinderfarm executions on the freebsd project servers shouldn't fail, IMHO. Thoughts? -Garrett From owner-svn-src-head@FreeBSD.ORG Fri Dec 5 04:43:26 2008 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2651D1065675; Fri, 5 Dec 2008 04:43:26 +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 1584B8FC13; Fri, 5 Dec 2008 04:43:26 +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 mB54hPSg043289; Fri, 5 Dec 2008 04:43:25 GMT (envelope-from imp@svn.freebsd.org) Received: (from imp@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mB54hPs8043288; Fri, 5 Dec 2008 04:43:25 GMT (envelope-from imp@svn.freebsd.org) Message-Id: <200812050443.mB54hPs8043288@svn.freebsd.org> From: Warner Losh Date: Fri, 5 Dec 2008 04:43: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: r185622 - head/sys/dev/pccbb X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 05 Dec 2008 04:43:26 -0000 Author: imp Date: Fri Dec 5 04:43:25 2008 New Revision: 185622 URL: http://svn.freebsd.org/changeset/base/185622 Log: Implement a method described in NetBSD PR 36652 for coping with the BAD VCC bit. Modified: head/sys/dev/pccbb/pccbb.c Modified: head/sys/dev/pccbb/pccbb.c ============================================================================== --- head/sys/dev/pccbb/pccbb.c Fri Dec 5 00:01:34 2008 (r185621) +++ head/sys/dev/pccbb/pccbb.c Fri Dec 5 04:43:25 2008 (r185622) @@ -837,7 +837,18 @@ cbb_power(device_t brdev, int volts) } if (status & CBB_STATE_BAD_VCC_REQ) { device_printf(sc->dev, "Bad Vcc requested\n"); - /* XXX Do we want to do something to mitigate things here? */ + /* + * Turn off the power, and try again. Retrigger other + * active interrupts via force register. From NetBSD + * PR 36652, coded by me to description there. + */ + sock_ctrl &= ~CBB_SOCKET_CTRL_VCCMASK; + sock_ctrl &= ~CBB_SOCKET_CTRL_VPPMASK; + cbb_set(sc, CBB_SOCKET_CONTROL, sock_ctrl); + status &= ~CBB_STATE_BAD_VCC_REQ; + status &= ~CBB_STATE_DATA_LOST; + status |= CBB_FORCE_CV_TEST; + cbb_set(sc, CBB_SOCKET_FORCE, status); goto done; } if (sc->chipset == CB_TOPIC97) { From owner-svn-src-head@FreeBSD.ORG Fri Dec 5 04:46:26 2008 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B7AC5106564A; Fri, 5 Dec 2008 04:46:26 +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 A66078FC14; Fri, 5 Dec 2008 04:46:26 +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 mB54kQlA043402; Fri, 5 Dec 2008 04:46:26 GMT (envelope-from imp@svn.freebsd.org) Received: (from imp@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mB54kQb0043401; Fri, 5 Dec 2008 04:46:26 GMT (envelope-from imp@svn.freebsd.org) Message-Id: <200812050446.mB54kQb0043401@svn.freebsd.org> From: Warner Losh Date: Fri, 5 Dec 2008 04:46: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: r185623 - head/sys/dev/pccbb X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 05 Dec 2008 04:46:26 -0000 Author: imp Date: Fri Dec 5 04:46:26 2008 New Revision: 185623 URL: http://svn.freebsd.org/changeset/base/185623 Log: Augment comments, and move things around a smidge. Modified: head/sys/dev/pccbb/pccbb.c Modified: head/sys/dev/pccbb/pccbb.c ============================================================================== --- head/sys/dev/pccbb/pccbb.c Fri Dec 5 04:43:25 2008 (r185622) +++ head/sys/dev/pccbb/pccbb.c Fri Dec 5 04:46:26 2008 (r185623) @@ -946,32 +946,32 @@ cbb_cardbus_reset(device_t brdev, device /* * Asserting reset for 20ms is necessary for most bridges. For some - * reason, the Ricoh RF5C47x bridges need it asserted for 400ms. + * reason, the Ricoh RF5C47x bridges need it asserted for 400ms. The + * root cause of this is unknown, and NetBSD does the same thing. */ delay = sc->chipset == CB_RF5C47X ? 400 : 20; PCI_MASK_CONFIG(brdev, CBBR_BRIDGECTRL, |CBBM_BRIDGECTRL_RESET, 2); pause("cbbP3", hz * delay / 1000); /* - * If a card exists and we're turning it on, take it out of reset. + * If a card exists and we're turning it on, take it out of reset. + * After clearing reset, wait up to 1.1s for the first configuration + * register (vendor/product) configuration register of device 0.0 to + * become != 0xffffffff. The PCMCIA PC Card Host System Specification + * says that when powering up the card, the PCI Spec v2.1 must be + * followed. In PCI spec v2.2 Table 4-6, Trhfa (Reset High to first + * Config Access) is at most 2^25 clocks, or just over 1s. Section + * 2.2.1 states any card not ready to participate in bus transactions + * must tristate its outputs. Therefore, any access to its + * configuration registers must be ignored. In that state, the config + * reg will read 0xffffffff. Section 6.2.1 states a vendor id of + * 0xffff is invalid, so this can never match a real card. Print a + * warning if it never returns a real id. The PCMCIA PC Card + * Electrical Spec Section 5.2.7.1 implies only device 0 is present on + * a cardbus bus, so that's the only register we check here. */ if (on && CBB_CARD_PRESENT(cbb_get(sc, CBB_SOCKET_STATE))) { /* - * After clearing reset, wait up to 1.1s for the first - * configuration register (vendor/product) configuration - * register of device 0.0 to become != 0xffffffff. The PCMCIA - * PC Card Host System Specification says that when powering - * up the card, the PCI Spec v2.1 must be followed. In PCI - * spec v2.2 Table 4-6, Trhfa (Reset High to first Config - * Access) is at most 2^25 clocks, or just over 1s. Section - * 2.2.1 states any card not ready to participate in bus - * transactions must tristate its outputs. Therefore, any - * access to its configuration registers must be ignored. In - * that state, the config reg will read 0xffffffff. Section - * 6.2.1 states a vendor id of 0xffff is invalid, so this can - * never match a real card. Print a warning if it never - * returns a real id. The PCMCIA PC Card Electrical Spec - * Section 5.2.7.1 implies only device 0. */ PCI_MASK_CONFIG(brdev, CBBR_BRIDGECTRL, &~CBBM_BRIDGECTRL_RESET, 2); From owner-svn-src-head@FreeBSD.ORG Fri Dec 5 04:48:04 2008 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 963271065673; Fri, 5 Dec 2008 04:48:04 +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 85AF18FC1C; Fri, 5 Dec 2008 04:48:04 +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 mB54m4Am043466; Fri, 5 Dec 2008 04:48:04 GMT (envelope-from imp@svn.freebsd.org) Received: (from imp@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mB54m4eL043465; Fri, 5 Dec 2008 04:48:04 GMT (envelope-from imp@svn.freebsd.org) Message-Id: <200812050448.mB54m4eL043465@svn.freebsd.org> From: Warner Losh Date: Fri, 5 Dec 2008 04:48: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: r185624 - head/sys/dev/pccbb X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 05 Dec 2008 04:48:04 -0000 Author: imp Date: Fri Dec 5 04:48:04 2008 New Revision: 185624 URL: http://svn.freebsd.org/changeset/base/185624 Log: Minor style nit. Modified: head/sys/dev/pccbb/pccbb.c Modified: head/sys/dev/pccbb/pccbb.c ============================================================================== --- head/sys/dev/pccbb/pccbb.c Fri Dec 5 04:46:26 2008 (r185623) +++ head/sys/dev/pccbb/pccbb.c Fri Dec 5 04:48:04 2008 (r185624) @@ -1045,8 +1045,8 @@ cbb_cardbus_mem_open(device_t brdev, int return (EINVAL); } - basereg = win*8 + CBBR_MEMBASE0; - limitreg = win*8 + CBBR_MEMLIMIT0; + basereg = win * 8 + CBBR_MEMBASE0; + limitreg = win * 8 + CBBR_MEMLIMIT0; pci_write_config(brdev, basereg, start, 4); pci_write_config(brdev, limitreg, end, 4); From owner-svn-src-head@FreeBSD.ORG Fri Dec 5 05:20:08 2008 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C12771065673; Fri, 5 Dec 2008 05:20:08 +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 9D45E8FC18; Fri, 5 Dec 2008 05:20:08 +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 mB55K8LR044142; Fri, 5 Dec 2008 05:20:08 GMT (envelope-from imp@svn.freebsd.org) Received: (from imp@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mB55K8kS044139; Fri, 5 Dec 2008 05:20:08 GMT (envelope-from imp@svn.freebsd.org) Message-Id: <200812050520.mB55K8kS044139@svn.freebsd.org> From: Warner Losh Date: Fri, 5 Dec 2008 05:20: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: r185625 - head/sys/dev/pccbb X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 05 Dec 2008 05:20:08 -0000 Author: imp Date: Fri Dec 5 05:20:08 2008 New Revision: 185625 URL: http://svn.freebsd.org/changeset/base/185625 Log: Move to using filter for the change interrupts. Also rework the power interrupt code to be more robust. I've been running these changes for over a year... With these changes, I don't see the ath card going into reset like the code in the tree. Modified: head/sys/dev/pccbb/pccbb.c head/sys/dev/pccbb/pccbb_pci.c head/sys/dev/pccbb/pccbbvar.h Modified: head/sys/dev/pccbb/pccbb.c ============================================================================== --- head/sys/dev/pccbb/pccbb.c Fri Dec 5 04:48:04 2008 (r185624) +++ head/sys/dev/pccbb/pccbb.c Fri Dec 5 05:20:08 2008 (r185625) @@ -344,7 +344,7 @@ cbb_detach(device_t brdev) sc->flags |= CBB_KTHREAD_DONE; while (sc->flags & CBB_KTHREAD_RUNNING) { DEVPRINTF((sc->dev, "Waiting for thread to die\n")); - cv_broadcast(&sc->cv); + wakeup(&sc->intrhand); msleep(sc->event_thread, &sc->mtx, PWAIT, "cbbun", 0); } mtx_unlock(&sc->mtx); @@ -353,8 +353,6 @@ cbb_detach(device_t brdev) bus_release_resource(brdev, SYS_RES_MEMORY, CBBR_SOCKBASE, sc->base_res); mtx_destroy(&sc->mtx); - cv_destroy(&sc->cv); - cv_destroy(&sc->powercv); return (0); } @@ -435,11 +433,8 @@ cbb_driver_added(device_t brdev, driver_ } free(devlist, M_TEMP); - if (wake > 0) { - mtx_lock(&sc->mtx); - cv_signal(&sc->cv); - mtx_unlock(&sc->mtx); - } + if (wake > 0) + wakeup(&sc->intrhand); } void @@ -519,12 +514,12 @@ cbb_event_thread(void *arg) * a chance to run. */ mtx_lock(&sc->mtx); - cbb_setb(sc, CBB_SOCKET_MASK, CBB_SOCKET_MASK_CD); - cv_wait(&sc->cv, &sc->mtx); + cbb_setb(sc, CBB_SOCKET_MASK, CBB_SOCKET_MASK_CD | CBB_SOCKET_MASK_CSTS); + msleep(&sc->intrhand, &sc->mtx, PZERO, "-", 0); err = 0; while (err != EWOULDBLOCK && (sc->flags & CBB_KTHREAD_DONE) == 0) - err = cv_timedwait(&sc->cv, &sc->mtx, hz / 4); + err = msleep(&sc->intrhand, &sc->mtx, PZERO, "-", hz / 5); } DEVPRINTF((sc->dev, "Thread terminating\n")); sc->flags &= ~CBB_KTHREAD_RUNNING; @@ -800,7 +795,7 @@ cbb_power(device_t brdev, int volts) sane = 10; while (!(cbb_get(sc, CBB_SOCKET_STATE) & CBB_STATE_POWER_CYCLE) && cnt == sc->powerintr && sane-- > 0) - cv_timedwait(&sc->powercv, &sc->mtx, hz / 20); + msleep(&sc->powerintr, &sc->mtx, PZERO, "-", hz / 20); mtx_unlock(&sc->mtx); /* * The TOPIC95B requires a little bit extra time to get @@ -1575,9 +1570,7 @@ cbb_resume(device_t self) cbb_setb(sc, CBB_SOCKET_MASK, CBB_SOCKET_MASK_CD); /* Signal the thread to wakeup. */ - mtx_lock(&sc->mtx); - cv_signal(&sc->cv); - mtx_unlock(&sc->mtx); + wakeup(&sc->intrhand); error = bus_generic_resume(self); Modified: head/sys/dev/pccbb/pccbb_pci.c ============================================================================== --- head/sys/dev/pccbb/pccbb_pci.c Fri Dec 5 04:48:04 2008 (r185624) +++ head/sys/dev/pccbb/pccbb_pci.c Fri Dec 5 05:20:08 2008 (r185625) @@ -117,7 +117,7 @@ __FBSDID("$FreeBSD$"); pci_read_config(DEV, REG, SIZE) MASK1) MASK2, SIZE) static void cbb_chipinit(struct cbb_softc *sc); -static void cbb_pci_intr(void *arg); +static int cbb_pci_filt(void *arg); static struct yenta_chipinfo { uint32_t yc_id; @@ -313,8 +313,6 @@ cbb_pci_attach(device_t brdev) parent = device_get_parent(brdev); mtx_init(&sc->mtx, device_get_nameunit(brdev), "cbb", MTX_DEF); - cv_init(&sc->cv, "cbb cv"); - cv_init(&sc->powercv, "cbb cv"); sc->chipset = cbb_chipset(pci_get_devid(brdev), NULL); sc->dev = brdev; sc->cbdev = NULL; @@ -332,7 +330,6 @@ cbb_pci_attach(device_t brdev) if (!sc->base_res) { device_printf(brdev, "Could not map register memory\n"); mtx_destroy(&sc->mtx); - cv_destroy(&sc->cv); return (ENOMEM); } else { DEVPRINTF((brdev, "Found memory at %08lx\n", @@ -416,7 +413,7 @@ cbb_pci_attach(device_t brdev) } if (bus_setup_intr(brdev, sc->irq_res, INTR_TYPE_AV | INTR_MPSAFE, - NULL, cbb_pci_intr, sc, &sc->intrhand)) { + cbb_pci_filt, NULL, sc, &sc->intrhand)) { device_printf(brdev, "couldn't establish interrupt\n"); goto err; } @@ -451,7 +448,6 @@ err: sc->base_res); } mtx_destroy(&sc->mtx); - cv_destroy(&sc->cv); return (ENOMEM); } @@ -686,11 +682,13 @@ cbb_pci_shutdown(device_t brdev) return (0); } -static void -cbb_pci_intr(void *arg) +#define DELTA (CBB_SOCKET_MASK_CD) +static int +cbb_pci_filt(void *arg) { struct cbb_softc *sc = arg; uint32_t sockevent; + int retval = FILTER_STRAY; /* * Read the socket event. Sometimes, the theory goes, the PCI @@ -705,9 +703,6 @@ cbb_pci_intr(void *arg) */ sockevent = cbb_get(sc, CBB_SOCKET_EVENT); if (sockevent != 0 && (sockevent & ~CBB_SOCKET_EVENT_VALID_MASK) == 0) { - /* ack the interrupt */ - cbb_set(sc, CBB_SOCKET_EVENT, sockevent); - /* * If anything has happened to the socket, we assume that * the card is no longer OK, and we shouldn't call its @@ -721,24 +716,24 @@ cbb_pci_intr(void *arg) * of the pccard software used a similar trick and achieved * excellent results. */ - if (sockevent & CBB_SOCKET_EVENT_CD) { - mtx_lock(&sc->mtx); - cbb_clrb(sc, CBB_SOCKET_MASK, CBB_SOCKET_MASK_CD); + if (sockevent & DELTA) { + cbb_clrb(sc, CBB_SOCKET_MASK, DELTA); + cbb_set(sc, CBB_SOCKET_EVENT, DELTA); sc->cardok = 0; cbb_disable_func_intr(sc); - cv_signal(&sc->cv); - mtx_unlock(&sc->mtx); + wakeup(&sc->intrhand); } /* * If we get a power interrupt, wakeup anybody that might * be waiting for one. */ if (sockevent & CBB_SOCKET_EVENT_POWER) { - mtx_lock(&sc->mtx); + cbb_clrb(sc, CBB_SOCKET_MASK, CBB_SOCKET_EVENT_POWER); + cbb_set(sc, CBB_SOCKET_EVENT, CBB_SOCKET_EVENT_POWER); sc->powerintr++; - cv_signal(&sc->powercv); - mtx_unlock(&sc->mtx); + wakeup((void *)&sc->powerintr); } + retval = FILTER_HANDLED; } /* * Some chips also require us to read the old ExCA registe for @@ -753,6 +748,7 @@ cbb_pci_intr(void *arg) * the event independent of the CBB_SOCKET_EVENT_CD above. */ exca_getb(&sc->exca[0], EXCA_CSC); + return retval; } /************************************************************************/ Modified: head/sys/dev/pccbb/pccbbvar.h ============================================================================== --- head/sys/dev/pccbb/pccbbvar.h Fri Dec 5 04:48:04 2008 (r185624) +++ head/sys/dev/pccbb/pccbbvar.h Fri Dec 5 05:20:08 2008 (r185625) @@ -67,8 +67,6 @@ struct cbb_softc { unsigned int secbus; unsigned int subbus; struct mtx mtx; - struct cv cv; - struct cv powercv; int cardok; u_int32_t flags; #define CBB_16BIT_CARD 0x20000000 @@ -89,7 +87,7 @@ struct cbb_softc { device_t cbdev; struct proc *event_thread; void (*chipinit)(struct cbb_softc *); - volatile int powerintr; + int powerintr; }; /* result of detect_card */ From owner-svn-src-head@FreeBSD.ORG Fri Dec 5 09:13:26 2008 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9B999106564A; Fri, 5 Dec 2008 09:13:26 +0000 (UTC) (envelope-from des@des.no) Received: from tim.des.no (tim.des.no [194.63.250.121]) by mx1.freebsd.org (Postfix) with ESMTP id 221278FC1B; Fri, 5 Dec 2008 09:13:26 +0000 (UTC) (envelope-from des@des.no) Received: from ds4.des.no (des.no [84.49.246.2]) by smtp.des.no (Postfix) with ESMTP id 4120E6D43F; Fri, 5 Dec 2008 09:13:25 +0000 (UTC) Received: by ds4.des.no (Postfix, from userid 1001) id 0BB1C844B1; Fri, 5 Dec 2008 10:13:24 +0100 (CET) From: =?utf-8?Q?Dag-Erling_Sm=C3=B8rgrav?= To: "Garrett Cooper" References: <49338E98.7020104@freebsd.org> <20081201132554.GD27096@elvis.mu.org> <20081201.221040.-1350500631.imp@bsdimp.com> <20081204095756.GP27096@elvis.mu.org> <863ah4158t.fsf@ds4.des.no> <20081204163542.GQ27096@elvis.mu.org> <86k5afyhrb.fsf@ds4.des.no> <20081204180837.GS27096@elvis.mu.org> <86vdtzx0ns.fsf@ds4.des.no> <20081204194813.GT27096@elvis.mu.org> <7d6fde3d0812041335u3134209at5a5f792e56290399@mail.gmail.com> Date: Fri, 05 Dec 2008 10:13:24 +0100 In-Reply-To: <7d6fde3d0812041335u3134209at5a5f792e56290399@mail.gmail.com> (Garrett Cooper's message of "Thu, 4 Dec 2008 13:35:08 -0800") Message-ID: <86iqpzhtmz.fsf@ds4.des.no> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (berkeley-unix) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, Alfred Perlstein , kientzle@freebsd.org, svn-src-head@freebsd.org, "M. Warner Losh" Subject: Re: svn commit: r185499 - 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: Fri, 05 Dec 2008 09:13:26 -0000 "Garrett Cooper" writes: > [...] I honestly think that the tinderbox target should be renamed to > tinderfarm [...] Bikeshed. There is already a 'universe' target that does everything Alfred wants except exit 1 on error. At least one working patch was put forward (by bz@) to make it do that, and phk@ agreed that it was a sensible thing to do. There is no need for a new target, and if there were, calling it tinderwhatever would be misleading at best. > [...] I do think that keeping a tinderfarm build target within the > make system would be beneficial though, as it would allow the > tinderbox Perl script to shrink [...] No, it wouldn't. > 3. As for the issue with make universe, isn't there an equivalent to > :: in pmake like there is in gmake? Targets can fail to build, but at > least it'll continue moving on, and if the output messages are proper, > one can note: `blah target failed' *shrugs*, and keep on moving on. This is a non-issue; "continue moving on" is how 'make universe' has always worked, and I added 'blah target failed' a week ago. DES --=20 Dag-Erling Sm=C3=B8rgrav - des@des.no From owner-svn-src-head@FreeBSD.ORG Fri Dec 5 11:34:36 2008 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CB4EA106564A; Fri, 5 Dec 2008 11:34:36 +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 BA43B8FC1E; Fri, 5 Dec 2008 11:34:36 +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 mB5BYa68053534; Fri, 5 Dec 2008 11:34:36 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mB5BYaXC053533; Fri, 5 Dec 2008 11:34:36 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <200812051134.mB5BYaXC053533@svn.freebsd.org> From: Konstantin Belousov Date: Fri, 5 Dec 2008 11:34: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: r185634 - 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, 05 Dec 2008 11:34:36 -0000 Author: kib Date: Fri Dec 5 11:34:36 2008 New Revision: 185634 URL: http://svn.freebsd.org/changeset/base/185634 Log: Improve db_backtrace() for compat ia32 on amd64. 32bit image enters the kernel via Xint0x80_syscall(). Submitted by: dchagin MFC after: 1 week Modified: head/sys/amd64/amd64/db_trace.c Modified: head/sys/amd64/amd64/db_trace.c ============================================================================== --- head/sys/amd64/amd64/db_trace.c Fri Dec 5 07:47:03 2008 (r185633) +++ head/sys/amd64/amd64/db_trace.c Fri Dec 5 11:34:36 2008 (r185634) @@ -27,6 +27,8 @@ #include __FBSDID("$FreeBSD$"); +#include "opt_compat.h" + #include #include #include @@ -318,6 +320,10 @@ db_nextframe(struct amd64_frame **fp, db frame_type = INTERRUPT; else if (strcmp(name, "Xfast_syscall") == 0) frame_type = SYSCALL; +#ifdef COMPAT_IA32 + else if (strcmp(name, "Xint0x80_syscall") == 0) + frame_type = SYSCALL; +#endif /* XXX: These are interrupts with trap frames. */ else if (strcmp(name, "Xtimerint") == 0 || strcmp(name, "Xcpustop") == 0 || From owner-svn-src-head@FreeBSD.ORG Fri Dec 5 13:40:25 2008 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id AF647106564A; Fri, 5 Dec 2008 13:40:25 +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 9DE2A8FC12; Fri, 5 Dec 2008 13:40:25 +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 mB5DePbm055900; Fri, 5 Dec 2008 13:40:25 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mB5DePgX055897; Fri, 5 Dec 2008 13:40:25 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <200812051340.mB5DePgX055897@svn.freebsd.org> From: John Baldwin Date: Fri, 5 Dec 2008 13:40: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: r185635 - in head/sys: kern sys X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 05 Dec 2008 13:40:25 -0000 Author: jhb Date: Fri Dec 5 13:40:25 2008 New Revision: 185635 URL: http://svn.freebsd.org/changeset/base/185635 Log: - Invoke MOD_QUIESCE on all modules in a linker file (kld) before unloading any modules. As a result, if any module veto's an unload request via MOD_QUIESCE, the entire set of modules for that linker file will remain loaded and active now rather than leaving the kld in a weird state where some modules are loaded and some are unloaded. - This also moves the logic for handling the "forced" unload flag out of kern_module.c and into kern_linker.c which is a bit cleaner. - Add a module_name() routine that returns the name of a module and use that instead of printing pointer values in debug messages when a module fails MOD_QUIESCE or MOD_UNLOAD. MFC after: 1 month Modified: head/sys/kern/kern_linker.c head/sys/kern/kern_module.c head/sys/sys/module.h Modified: head/sys/kern/kern_linker.c ============================================================================== --- head/sys/kern/kern_linker.c Fri Dec 5 11:34:36 2008 (r185634) +++ head/sys/kern/kern_linker.c Fri Dec 5 13:40:25 2008 (r185635) @@ -587,7 +587,30 @@ linker_file_unload(linker_file_t file, i " informing modules\n")); /* - * Inform any modules associated with this file. + * Quiesce all the modules to give them a chance to veto the unload. + */ + MOD_SLOCK; + for (mod = TAILQ_FIRST(&file->modules); mod; + mod = module_getfnext(mod)) { + + error = module_quiesce(mod); + if (error != 0 && flags != LINKER_UNLOAD_FORCE) { + KLD_DPF(FILE, ("linker_file_unload: module %s" + " vetoed unload\n", module_getname(mod))); + /* + * XXX: Do we need to tell all the quiesced modules + * that they can resume work now via a new module + * event? + */ + MOD_SUNLOCK; + return (error); + } + } + MOD_SUNLOCK; + + /* + * Inform any modules associated with this file that they are + * being be unloaded. */ MOD_XLOCK; for (mod = TAILQ_FIRST(&file->modules); mod; mod = next) { @@ -597,9 +620,9 @@ linker_file_unload(linker_file_t file, i /* * Give the module a chance to veto the unload. */ - if ((error = module_unload(mod, flags)) != 0) { - KLD_DPF(FILE, ("linker_file_unload: module %p" - " vetoes unload\n", mod)); + if ((error = module_unload(mod)) != 0) { + KLD_DPF(FILE, ("linker_file_unload: module %s" + " failed unload\n", mod)); return (error); } MOD_XLOCK; Modified: head/sys/kern/kern_module.c ============================================================================== --- head/sys/kern/kern_module.c Fri Dec 5 11:34:36 2008 (r185634) +++ head/sys/kern/kern_module.c Fri Dec 5 13:40:25 2008 (r185635) @@ -196,9 +196,7 @@ module_release(module_t mod) TAILQ_REMOVE(&modules, mod, link); if (mod->file) TAILQ_REMOVE(&mod->file->modules, mod, flink); - MOD_XUNLOCK; free(mod, M_MODULE); - MOD_XLOCK; } } @@ -232,16 +230,25 @@ module_lookupbyid(int modid) } int -module_unload(module_t mod, int flags) +module_quiesce(module_t mod) { int error; mtx_lock(&Giant); error = MOD_EVENT(mod, MOD_QUIESCE); + mtx_unlock(&Giant); if (error == EOPNOTSUPP || error == EINVAL) error = 0; - if (error == 0 || flags == LINKER_UNLOAD_FORCE) - error = MOD_EVENT(mod, MOD_UNLOAD); + return (error); +} + +int +module_unload(module_t mod) +{ + int error; + + mtx_lock(&Giant); + error = MOD_EVENT(mod, MOD_UNLOAD); mtx_unlock(&Giant); return (error); } @@ -262,6 +269,14 @@ module_getfnext(module_t mod) return (TAILQ_NEXT(mod, flink)); } +const char * +module_getname(module_t mod) +{ + + MOD_LOCK_ASSERT; + return (mod->name); +} + void module_setspecific(module_t mod, modspecific_t *datap) { Modified: head/sys/sys/module.h ============================================================================== --- head/sys/sys/module.h Fri Dec 5 11:34:36 2008 (r185634) +++ head/sys/sys/module.h Fri Dec 5 13:40:25 2008 (r185635) @@ -154,11 +154,13 @@ void module_register_init(const void *); int module_register(const struct moduledata *, struct linker_file *); module_t module_lookupbyname(const char *); module_t module_lookupbyid(int); +int module_quiesce(module_t); void module_reference(module_t); void module_release(module_t); -int module_unload(module_t, int flags); +int module_unload(module_t); int module_getid(module_t); module_t module_getfnext(module_t); +const char * module_getname(module_t); void module_setspecific(module_t, modspecific_t *); struct linker_file *module_file(module_t); From owner-svn-src-head@FreeBSD.ORG Fri Dec 5 14:37:14 2008 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DD3DA1065673; Fri, 5 Dec 2008 14:37:14 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id CBFBD8FC16; Fri, 5 Dec 2008 14:37:14 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mB5EbE34056992; Fri, 5 Dec 2008 14:37:14 GMT (envelope-from glebius@svn.freebsd.org) Received: (from glebius@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mB5EbEuk056991; Fri, 5 Dec 2008 14:37:14 GMT (envelope-from glebius@svn.freebsd.org) Message-Id: <200812051437.mB5EbEuk056991@svn.freebsd.org> From: Gleb Smirnoff Date: Fri, 5 Dec 2008 14:37: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: r185636 - 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, 05 Dec 2008 14:37:15 -0000 Author: glebius Date: Fri Dec 5 14:37:14 2008 New Revision: 185636 URL: http://svn.freebsd.org/changeset/base/185636 Log: In a case of CARP status change run through the if_link_state_change() routine, so that devd(8) and others are notified about link state change. Modified: head/sys/netinet/ip_carp.c Modified: head/sys/netinet/ip_carp.c ============================================================================== --- head/sys/netinet/ip_carp.c Fri Dec 5 13:40:25 2008 (r185635) +++ head/sys/netinet/ip_carp.c Fri Dec 5 14:37:14 2008 (r185636) @@ -2148,6 +2148,7 @@ carp_output(struct ifnet *ifp, struct mb static void carp_set_state(struct carp_softc *sc, int state) { + int link_state; if (sc->sc_carpdev) CARP_SCLOCK_ASSERT(sc); @@ -2158,16 +2159,16 @@ carp_set_state(struct carp_softc *sc, in sc->sc_state = state; switch (state) { case BACKUP: - SC2IFP(sc)->if_link_state = LINK_STATE_DOWN; + link_state = LINK_STATE_DOWN; break; case MASTER: - SC2IFP(sc)->if_link_state = LINK_STATE_UP; + link_state = LINK_STATE_UP; break; default: - SC2IFP(sc)->if_link_state = LINK_STATE_UNKNOWN; + link_state = LINK_STATE_UNKNOWN; break; } - rt_ifmsg(SC2IFP(sc)); + if_link_state_change(SC2IFP(sc), link_state); } void From owner-svn-src-head@FreeBSD.ORG Fri Dec 5 15:27:28 2008 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7237E1065673; Fri, 5 Dec 2008 15:27:28 +0000 (UTC) (envelope-from raj@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 613788FC22; Fri, 5 Dec 2008 15:27:28 +0000 (UTC) (envelope-from raj@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mB5FRS85058736; Fri, 5 Dec 2008 15:27:28 GMT (envelope-from raj@svn.freebsd.org) Received: (from raj@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mB5FRSn4058735; Fri, 5 Dec 2008 15:27:28 GMT (envelope-from raj@svn.freebsd.org) Message-Id: <200812051527.mB5FRSn4058735@svn.freebsd.org> From: Rafal Jaworowski Date: Fri, 5 Dec 2008 15:27: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: r185639 - head/sys/arm/mv X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 05 Dec 2008 15:27:28 -0000 Author: raj Date: Fri Dec 5 15:27:28 2008 New Revision: 185639 URL: http://svn.freebsd.org/changeset/base/185639 Log: Fix configuration of the PCI bridge. This got omitted in the initial import of this code. Modified: head/sys/arm/mv/mv_pci.c Modified: head/sys/arm/mv/mv_pci.c ============================================================================== --- head/sys/arm/mv/mv_pci.c Fri Dec 5 15:26:19 2008 (r185638) +++ head/sys/arm/mv/mv_pci.c Fri Dec 5 15:27:28 2008 (r185639) @@ -598,6 +598,10 @@ pcib_mbus_init_bridge(struct pcib_mbus_s mem_limit = mem_base + sc->sc_info->op_mem_size - 1; /* Configure I/O decode registers */ + pcib_mbus_write_config(sc->sc_dev, bus, slot, func, PCIR_IOBASEL_1, + io_base >> 8, 1); + pcib_mbus_write_config(sc->sc_dev, bus, slot, func, PCIR_IOBASEH_1, + io_base >> 16, 2); pcib_mbus_write_config(sc->sc_dev, bus, slot, func, PCIR_IOLIMITL_1, io_limit >> 8, 1); pcib_mbus_write_config(sc->sc_dev, bus, slot, func, PCIR_IOLIMITH_1, From owner-svn-src-head@FreeBSD.ORG Fri Dec 5 15:31:52 2008 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 08CA11065675; Fri, 5 Dec 2008 15:31:52 +0000 (UTC) (envelope-from raj@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id EC38D8FC13; Fri, 5 Dec 2008 15:31:51 +0000 (UTC) (envelope-from raj@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mB5FVpVh059444; Fri, 5 Dec 2008 15:31:51 GMT (envelope-from raj@svn.freebsd.org) Received: (from raj@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mB5FVp2V059443; Fri, 5 Dec 2008 15:31:51 GMT (envelope-from raj@svn.freebsd.org) Message-Id: <200812051531.mB5FVp2V059443@svn.freebsd.org> From: Rafal Jaworowski Date: Fri, 5 Dec 2008 15: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: r185640 - head/sys/arm/mv/orion X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 05 Dec 2008 15:31:52 -0000 Author: raj Date: Fri Dec 5 15:31:51 2008 New Revision: 185640 URL: http://svn.freebsd.org/changeset/base/185640 Log: Avoid confusion and adjust link address range of Marvell Orion kernel so it is the same as for Kirkwood and Discovery. Modified: head/sys/arm/mv/orion/std.db88f5xxx Modified: head/sys/arm/mv/orion/std.db88f5xxx ============================================================================== --- head/sys/arm/mv/orion/std.db88f5xxx Fri Dec 5 15:27:28 2008 (r185639) +++ head/sys/arm/mv/orion/std.db88f5xxx Fri Dec 5 15:31:51 2008 (r185640) @@ -3,11 +3,11 @@ include "../mv/std.mv" files "../mv/orion/files.db88f5xxx" -makeoptions KERNPHYSADDR=0x00400000 -makeoptions KERNVIRTADDR=0xc0400000 +makeoptions KERNPHYSADDR=0x00900000 +makeoptions KERNVIRTADDR=0xc0900000 -options KERNPHYSADDR=0x00400000 -options KERNVIRTADDR=0xc0400000 +options KERNPHYSADDR=0x00900000 +options KERNVIRTADDR=0xc0900000 options PHYSADDR=0x00000000 options PHYSMEM_SIZE=0x08000000 options STARTUP_PAGETABLE_ADDR=0x00100000 From owner-svn-src-head@FreeBSD.ORG Fri Dec 5 15:50:59 2008 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C2B71106564A; Fri, 5 Dec 2008 15:50:59 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B14AC8FC1E; Fri, 5 Dec 2008 15:50:59 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mB5FoxPa062500; Fri, 5 Dec 2008 15:50:59 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mB5FoxGg062499; Fri, 5 Dec 2008 15:50:59 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <200812051550.mB5FoxGg062499@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Fri, 5 Dec 2008 15:50: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: r185641 - head/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: Fri, 05 Dec 2008 15:50:59 -0000 Author: pjd Date: Fri Dec 5 15:50:59 2008 New Revision: 185641 URL: http://svn.freebsd.org/changeset/base/185641 Log: Add an easier example. Reviewed by: trasz Modified: head/lib/libc/string/strsep.3 Modified: head/lib/libc/string/strsep.3 ============================================================================== --- head/lib/libc/string/strsep.3 Fri Dec 5 15:31:51 2008 (r185640) +++ head/lib/libc/string/strsep.3 Fri Dec 5 15:50:59 2008 (r185641) @@ -31,7 +31,7 @@ .\" @(#)strsep.3 8.1 (Berkeley) 6/9/93 .\" $FreeBSD$ .\" -.Dd June 9, 1993 +.Dd December 5, 2008 .Dt STRSEP 3 .Os .Sh NAME @@ -81,6 +81,21 @@ returns .Sh EXAMPLES The following uses .Fn strsep +to parse a string, and prints each token in separate line: +.Bd -literal -offset indent +char *token, *string, *tofree; + +tofree = string = strdup("abc,def,ghi"); +assert(string != NULL); + +while ((token = strsep(&string, ",")) != NULL) + printf("%s\en", token); + +free(tofree); +.Ed +.Pp +The following uses +.Fn strsep to parse a string, containing tokens delimited by white space, into an argument vector: .Bd -literal -offset indent From owner-svn-src-head@FreeBSD.ORG Fri Dec 5 16:00:53 2008 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id AD3C61065672; Fri, 5 Dec 2008 16:00:53 +0000 (UTC) (envelope-from jamie@gritton.org) Received: from gritton.org (gritton.org [161.58.222.4]) by mx1.freebsd.org (Postfix) with ESMTP id 6E5558FC16; Fri, 5 Dec 2008 16:00:53 +0000 (UTC) (envelope-from jamie@gritton.org) Received: from glorfindel.gritton.org (c-76-27-80-223.hsd1.ut.comcast.net [76.27.80.223]) (authenticated bits=0) by gritton.org (8.13.6.20060614/8.13.6) with ESMTP id mB5FQdbt093563; Fri, 5 Dec 2008 08:26:40 -0700 (MST) Message-ID: <4939482F.4040404@gritton.org> Date: Fri, 05 Dec 2008 08:26:39 -0700 From: James Gritton User-Agent: Thunderbird 2.0.0.9 (X11/20080228) MIME-Version: 1.0 To: "Bjoern A. Zeeb" References: <200811291432.mATEWE2a053742@svn.freebsd.org> <86skp3yje2.fsf@ds4.des.no> <20081204184332.C80401@maildrop.int.zabbadoz.net> In-Reply-To: <20081204184332.C80401@maildrop.int.zabbadoz.net> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 8bit X-Virus-Scanned: ClamAV version 0.93, clamav-milter version 0.93 on gritton.org X-Virus-Status: Clean Cc: svn-src-head@freebsd.org, =?ISO-8859-1?Q?Dag-Erling_Sm=F8rgrav?= , svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r185435 - in head: lib/libc/sys lib/libkvm share/man/man4 sys/compat/freebsd32 sys/kern sys/net sys/netinet sys/netinet6 sys/security/mac_bsdextended sys/sys usr.bin/cpuset usr.sbin/jai... X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 05 Dec 2008 16:00:53 -0000 Bjoern A. Zeeb wrote: > On Thu, 4 Dec 2008, Dag-Erling Smørgrav wrote: >> "Bjoern A. Zeeb" writes: >>> Jails can have an unrestricted (no duplicate protection, etc.) name >>> in addition to the hostname. The jail name cannot be changed from >>> within a jail and is considered to be used for management purposes >>> or as audit-token in the future. >> >> Is there a specific reason why we allow duplicates? > > Yes, so that people have a choice. > > You would have to take into account "DYING" jails with possibly > duplicate names anyway. > > And it's a purely administrative name (cannot be changed from within > the jail) so it's up to the administrator to have 2 "Customer Webserver" > jails or a "Customer Webserver Tin" and a "Customer Webserver Box". > > BTW. in case people wonder how to set it (atm.) from rc.conf, you > can use jail__flags. My new (upcoming) jail framework patches also support names, but without allowing duplicates. This is necessary because jails can be looked up in the kernel by name as well as by ID. I handle the special case of "dying" jails, allowing a new jail to duplicate the name of one on the the way out. As far as people having a choice, I don't see any more reason to offer the choice of duplicate jail names than I do in offering duplicate login names. It just doesn't make sense in the context of what purpose I expect a name to serve. - Jamie From owner-svn-src-head@FreeBSD.ORG Fri Dec 5 16:43:12 2008 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C6A651065673; Fri, 5 Dec 2008 16:43:12 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from server.baldwin.cx (bigknife-pt.tunnel.tserv9.chi1.ipv6.he.net [IPv6:2001:470:1f10:75::2]) by mx1.freebsd.org (Postfix) with ESMTP id 6882A8FC0C; Fri, 5 Dec 2008 16:43:12 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from localhost.corp.yahoo.com (john@localhost [IPv6:::1]) (authenticated bits=0) by server.baldwin.cx (8.14.3/8.14.3) with ESMTP id mB5Gh07Z042953; Fri, 5 Dec 2008 11:43:06 -0500 (EST) (envelope-from jhb@freebsd.org) From: John Baldwin To: Warner Losh Date: Fri, 5 Dec 2008 11:22:16 -0500 User-Agent: KMail/1.9.7 References: <200812050520.mB55K8kS044139@svn.freebsd.org> In-Reply-To: <200812050520.mB55K8kS044139@svn.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200812051122.18694.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH authentication, not delayed by milter-greylist-2.0.2 (server.baldwin.cx [IPv6:::1]); Fri, 05 Dec 2008 11:43:06 -0500 (EST) X-Virus-Scanned: ClamAV 0.93.1/8727/Fri Dec 5 09:49:21 2008 on server.baldwin.cx X-Virus-Status: Clean X-Spam-Status: No, score=-2.6 required=4.2 tests=AWL,BAYES_00,NO_RELAYS 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: r185625 - head/sys/dev/pccbb X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 05 Dec 2008 16:43:12 -0000 On Friday 05 December 2008 12:20:08 am Warner Losh wrote: > Author: imp > Date: Fri Dec 5 05:20:08 2008 > New Revision: 185625 > URL: http://svn.freebsd.org/changeset/base/185625 > > Log: > Move to using filter for the change interrupts. Also rework the power > interrupt code to be more robust. I've been running these changes for > over a year... With these changes, I don't see the ath card going > into reset like the code in the tree. I would use '0' for the priority to msleep() instead of PZERO so that you just leave the priority alone and don't change it. -- John Baldwin From owner-svn-src-head@FreeBSD.ORG Fri Dec 5 16:47:31 2008 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 795D81065672; Fri, 5 Dec 2008 16:47:31 +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 687948FC25; Fri, 5 Dec 2008 16:47:31 +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 mB5GlVjt067731; Fri, 5 Dec 2008 16:47:31 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mB5GlVst067730; Fri, 5 Dec 2008 16:47:31 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <200812051647.mB5GlVst067730@svn.freebsd.org> From: John Baldwin Date: Fri, 5 Dec 2008 16:47: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: r185642 - head/sys/kern X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 05 Dec 2008 16:47:31 -0000 Author: jhb Date: Fri Dec 5 16:47:30 2008 New Revision: 185642 URL: http://svn.freebsd.org/changeset/base/185642 Log: When the SYSINIT() to load a module invokes the MOD_LOAD event successfully, move that module to the head of the associated linker file's list of modules. The end result is that once all the modules are loaded, they are sorted in the reverse of their load order. This causes the kernel linker to invoke the MOD_QUIESCE and MOD_UNLOAD events in the reverse of the order that MOD_LOAD was invoked. This means that the ordering of MOD_LOAD events that is set by the SI_* paramters to DECLARE_MODULE() are now honored in the same order they would be for SYSUNINIT() for the MOD_QUIESCE and MOD_UNLOAD events. MFC after: 1 month Modified: head/sys/kern/kern_module.c Modified: head/sys/kern/kern_module.c ============================================================================== --- head/sys/kern/kern_module.c Fri Dec 5 15:50:59 2008 (r185641) +++ head/sys/kern/kern_module.c Fri Dec 5 16:47:30 2008 (r185642) @@ -130,6 +130,21 @@ module_register_init(const void *arg) printf("module_register_init: MOD_LOAD (%s, %p, %p) error" " %d\n", data->name, (void *)data->evhand, data->priv, error); + } else { + MOD_XLOCK; + if (mod->file) { + /* + * Once a module is succesfully loaded, move + * it to the head of the module list for this + * linker file. This resorts the list so that + * when the kernel linker iterates over the + * modules to unload them, it will unload them + * in the reverse order they were loaded. + */ + TAILQ_REMOVE(&mod->file->modules, mod, flink); + TAILQ_INSERT_HEAD(&mod->file->modules, mod, flink); + } + MOD_XUNLOCK; } mtx_unlock(&Giant); } From owner-svn-src-head@FreeBSD.ORG Fri Dec 5 17:13:40 2008 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9B7471065677; Fri, 5 Dec 2008 17:13:40 +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 897B08FC1A; Fri, 5 Dec 2008 17:13:40 +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 mB5HDeDv068259; Fri, 5 Dec 2008 17:13:40 GMT (envelope-from luigi@svn.freebsd.org) Received: (from luigi@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mB5HDerC068258; Fri, 5 Dec 2008 17:13:40 GMT (envelope-from luigi@svn.freebsd.org) Message-Id: <200812051713.mB5HDerC068258@svn.freebsd.org> From: Luigi Rizzo Date: Fri, 5 Dec 2008 17:13: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: r185643 - head/lib/libstand X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 05 Dec 2008 17:13:40 -0000 Author: luigi Date: Fri Dec 5 17:13:40 2008 New Revision: 185643 URL: http://svn.freebsd.org/changeset/base/185643 Log: Some libstand/bootp.c extension (written by Danny Braniss, slightly revised/modified by me) to store dhcp options into kenv variables, so the information is available to the boot loader and can be used to customize the boot process. The change is totally unintrusive, essentially made of a single function to be called while parsing a dhcp response, and a couple of tables to classify options. The values extracted from dhcp options are stored in the kenv environment in one of these forms: + options whose name and type is known are saved as dhcp.name = value (string, or number/ip addresses lists) + unknown options are assumed to be strings and saved as dhcp.option-NNN = "value" + options listed as '__INDIR' and sent on the wire as e.g. option unknown-252 "some.name=the actual value" are saved as some.name = "the actual value" + options listed as '__ILIST' and sent on the wire as e.g. option unknown-249 "a.b=foo bar; c.d= 123; e.f=done" are saved as multiple values a.b="foo bar" c.d="123" e.f="done" As you can see there is quite a bit of flexibility on what can be passed to the loader or the kernel. For the time being the vendor-specific table is mostly disabled, because there is no standard set of options for FreeBSD, and I don't know all the pxe-specific vendor options. Also, applications using libstand may live in memory-constrained environments, so it makes sense to keep these tables as small as possible, especially considering that one can generate arbitrary name=value pairs using site-specific options of type __INDIR or __ILIST (there are 4 __ILIST and 5 __INDIR in the table, numbered 246..249 and 250..254). Actually, considering that probably 75% of the standard dhcp options are totally useless, it might make sense to remove them as well. Submitted by: Danny Braniss MFC after: 4 weeks Modified: head/lib/libstand/bootp.c Modified: head/lib/libstand/bootp.c ============================================================================== --- head/lib/libstand/bootp.c Fri Dec 5 16:47:30 2008 (r185642) +++ head/lib/libstand/bootp.c Fri Dec 5 17:13:40 2008 (r185643) @@ -47,6 +47,12 @@ __FBSDID("$FreeBSD$"); #define BOOTP_DEBUGxx #define SUPPORT_DHCP +#define DHCP_ENV_NOVENDOR 1 /* do not parse vendor options */ +#define DHCP_ENV_PXE 10 /* assume pxe vendor options */ +#define DHCP_ENV_FREEBSD 11 /* assume freebsd vendor options +/* set DHCP_ENV to one of the values above to export dhcp options to kenv */ +#define DHCP_ENV DHCP_ENV_NO_VENDOR + #include "stand.h" #include "net.h" #include "netif.h" @@ -72,6 +78,13 @@ static int vend_rfc1048(u_char *, u_int) static void vend_cmu(u_char *); #endif +#ifdef DHCP_ENV /* export the dhcp response to kenv */ +struct dhcp_opt; +static void setenv_(u_char *cp, u_char *ep, struct dhcp_opt *opts); +#else +#define setenv_(a, b, c) +#endif + #ifdef SUPPORT_DHCP static char expected_dhcpmsgtype = -1, dhcp_ok; struct in_addr dhcp_serverip; @@ -351,6 +364,8 @@ vend_rfc1048(cp, len) /* Step over magic cookie */ cp += sizeof(int); + setenv_(cp, ep, NULL); + while (cp < ep) { tag = *cp++; size = *cp++; @@ -412,3 +427,316 @@ vend_cmu(cp) } } #endif + +#ifdef DHCP_ENV +/* + * Parse DHCP options and store them into kenv variables. + * Original code from Danny Braniss, modifications by Luigi Rizzo. + * + * The parser is driven by tables which specify the type and name of + * each dhcp option and how it appears in kenv. + * The first entry in the list contains the prefix used to set the kenv + * name (including the . if needed), the last entry must have a 0 tag. + * Entries do not need to be sorted though it helps for readability. + * + * Certain vendor-specific tables can be enabled according to DHCP_ENV. + * Set it to 0 if you don't want any. + */ +enum opt_fmt { __NONE = 0, + __8 = 1, __16 = 2, __32 = 4, /* Unsigned fields, value=size */ + __IP, /* IPv4 address */ + __TXT, /* C string */ + __BYTES, /* byte sequence, printed %02x */ + __INDIR, /* name=value */ + __ILIST, /* name=value;name=value ... */ + __VE, /* vendor specific, recurse */ +}; + +struct dhcp_opt { + uint8_t tag; + uint8_t fmt; + const char *desc; +}; + +static struct dhcp_opt vndr_opt[] = { /* Vendor Specific Options */ +#if DHCP_ENV == DHCP_ENV_FREEBSD /* FreeBSD table in the original code */ + {0, 0, "FreeBSD"}, /* prefix */ + {1, __TXT, "kernel"}, + {2, __TXT, "kernelname"}, + {3, __TXT, "kernel_options"}, + {4, __IP, "usr-ip"}, + {5, __TXT, "conf-path"}, + {6, __TXT, "rc.conf0"}, + {7, __TXT, "rc.conf1"}, + {8, __TXT, "rc.conf2"}, + {9, __TXT, "rc.conf3"}, + {10, __TXT, "rc.conf4"}, + {11, __TXT, "rc.conf5"}, + {12, __TXT, "rc.conf6"}, + {13, __TXT, "rc.conf7"}, + {14, __TXT, "rc.conf8"}, + {15, __TXT, "rc.conf9"}, + + {20, __TXT, "boot.nfsroot.options"}, + + {245, __INDIR, ""}, + {246, __INDIR, ""}, + {247, __INDIR, ""}, + {248, __INDIR, ""}, + {249, __INDIR, ""}, + {250, __INDIR, ""}, + {251, __INDIR, ""}, + {252, __INDIR, ""}, + {253, __INDIR, ""}, + {254, __INDIR, ""}, + +#elif DHCP_ENV == DHCP_ENV_PXE /* some pxe options, RFC4578 */ + {0, 0, "pxe"}, /* prefix */ + {93, __16, "system-architecture"}, + {94, __BYTES, "network-interface"}, + {97, __BYTES, "machine-identifier"}, +#else /* default (empty) table */ + {0, 0, ""}, /* prefix */ +#endif + {0, __TXT, "%soption-%d"} +}; + +static struct dhcp_opt dhcp_opt[] = { + /* DHCP Option names, formats and codes, from RFC2132. */ + {0, 0, "dhcp."}, // prefix + {1, __IP, "subnet-mask"}, + {2, __32, "time-offset"}, /* this is signed */ + {3, __IP, "routers"}, + {4, __IP, "time-servers"}, + {5, __IP, "ien116-name-servers"}, + {6, __IP, "domain-name-servers"}, + {7, __IP, "log-servers"}, + {8, __IP, "cookie-servers"}, + {9, __IP, "lpr-servers"}, + {10, __IP, "impress-servers"}, + {11, __IP, "resource-location-servers"}, + {12, __TXT, "host-name"}, + {13, __16, "boot-size"}, + {14, __TXT, "merit-dump"}, + {15, __TXT, "domain-name"}, + {16, __IP, "swap-server"}, + {17, __TXT, "root-path"}, + {18, __TXT, "extensions-path"}, + {19, __8, "ip-forwarding"}, + {20, __8, "non-local-source-routing"}, + {21, __IP, "policy-filter"}, + {22, __16, "max-dgram-reassembly"}, + {23, __8, "default-ip-ttl"}, + {24, __32, "path-mtu-aging-timeout"}, + {25, __16, "path-mtu-plateau-table"}, + {26, __16, "interface-mtu"}, + {27, __8, "all-subnets-local"}, + {28, __IP, "broadcast-address"}, + {29, __8, "perform-mask-discovery"}, + {30, __8, "mask-supplier"}, + {31, __8, "perform-router-discovery"}, + {32, __IP, "router-solicitation-address"}, + {33, __IP, "static-routes"}, + {34, __8, "trailer-encapsulation"}, + {35, __32, "arp-cache-timeout"}, + {36, __8, "ieee802-3-encapsulation"}, + {37, __8, "default-tcp-ttl"}, + {38, __32, "tcp-keepalive-interval"}, + {39, __8, "tcp-keepalive-garbage"}, + {40, __TXT, "nis-domain"}, + {41, __IP, "nis-servers"}, + {42, __IP, "ntp-servers"}, + {43, __VE, "vendor-encapsulated-options"}, + {44, __IP, "netbios-name-servers"}, + {45, __IP, "netbios-dd-server"}, + {46, __8, "netbios-node-type"}, + {47, __TXT, "netbios-scope"}, + {48, __IP, "x-font-servers"}, + {49, __IP, "x-display-managers"}, + {50, __IP, "dhcp-requested-address"}, + {51, __32, "dhcp-lease-time"}, + {52, __8, "dhcp-option-overload"}, + {53, __8, "dhcp-message-type"}, + {54, __IP, "dhcp-server-identifier"}, + {55, __8, "dhcp-parameter-request-list"}, + {56, __TXT, "dhcp-message"}, + {57, __16, "dhcp-max-message-size"}, + {58, __32, "dhcp-renewal-time"}, + {59, __32, "dhcp-rebinding-time"}, + {60, __TXT, "vendor-class-identifier"}, + {61, __TXT, "dhcp-client-identifier"}, + {64, __TXT, "nisplus-domain"}, + {65, __IP, "nisplus-servers"}, + {66, __TXT, "tftp-server-name"}, + {67, __TXT, "bootfile-name"}, + {68, __IP, "mobile-ip-home-agent"}, + {69, __IP, "smtp-server"}, + {70, __IP, "pop-server"}, + {71, __IP, "nntp-server"}, + {72, __IP, "www-server"}, + {73, __IP, "finger-server"}, + {74, __IP, "irc-server"}, + {75, __IP, "streettalk-server"}, + {76, __IP, "streettalk-directory-assistance-server"}, + {77, __TXT, "user-class"}, + {85, __IP, "nds-servers"}, + {86, __TXT, "nds-tree-name"}, + {87, __TXT, "nds-context"}, + {210, __TXT, "authenticate"}, + + /* use the following entries for arbitrary variables */ + {246, __ILIST, ""}, + {247, __ILIST, ""}, + {248, __ILIST, ""}, + {249, __ILIST, ""}, + {250, __INDIR, ""}, + {251, __INDIR, ""}, + {252, __INDIR, ""}, + {253, __INDIR, ""}, + {254, __INDIR, ""}, + {0, __TXT, "%soption-%d"} +}; + +/* + * parse a dhcp response, set environment variables translating options + * names and values according to the tables above. Also set dhcp.tags + * to the list of selected tags. + */ +static void +setenv_(u_char *cp, u_char *ep, struct dhcp_opt *opts) +{ + u_char *ncp; + u_char tag; + char tags[512], *tp; /* the list of tags */ + +#define FLD_SEP ',' /* separator in list of elements */ + ncp = cp; + tp = tags; + if (opts == NULL) + opts = dhcp_opt; + + while (ncp < ep) { + unsigned int size; /* option size */ + char *vp, *endv, buf[256]; /* the value buffer */ + struct dhcp_opt *op; + + tag = *ncp++; /* extract tag and size */ + size = *ncp++; + cp = ncp; /* current payload */ + ncp += size; /* point to the next option */ + + if (tag == TAG_END) + break; + if (tag == 0) + continue; + + for (op = opts+1; op->tag && op->tag != tag; op++) + ; + /* if not found we end up on the default entry */ + + /* + * Copy data into the buffer. libstand does not have snprintf so we + * need to be careful with sprintf(). With strings, the source is + * always <256 char so shorter than the buffer so we are safe; with + * other arguments, the longest string is inet_ntoa which is 16 bytes + * so we make sure to have always enough room in the string before + * trying an sprint. + */ + vp = buf; + *vp = '\0'; + endv = buf + sizeof(buf) - 1 - 16; /* last valid write position */ + + switch(op->fmt) { + case __NONE: + break; /* should not happen */ + + case __VE: /* recurse, vendor specific */ + setenv_(cp, cp+size, vndr_opt); + break; + + case __IP: /* ip address */ + for (; size > 0 && vp < endv; size -= 4, cp += 4) { + struct in_addr in_ip; /* ip addresses */ + if (vp != buf) + *vp++ = FLD_SEP; + bcopy(cp, &in_ip.s_addr, sizeof(in_ip.s_addr)); + sprintf(vp, "%s", inet_ntoa(in_ip)); + vp += strlen(vp); + } + break; + + case __BYTES: /* opaque byte string */ + for (; size > 0 && vp < endv; size -= 1, cp += 1) { + sprintf(vp, "%02x", *cp); + vp += strlen(vp); + } + break; + + case __TXT: + bcopy(cp, buf, size); /* cannot overflow */ + buf[size] = 0; + break; + + case __32: + case __16: + case __8: /* op->fmt is also the length of each field */ + for (; size > 0 && vp < endv; size -= op->fmt, cp += op->fmt) { + uint32_t v; + if (op->fmt == __32) + v = (cp[0]<<24) + (cp[1]<<16) + (cp[2]<<8) + cp[3]; + else if (op->fmt == __16) + v = (cp[0]<<8) + cp[1]; + else + v = cp[0]; + if (vp != buf) + *vp++ = FLD_SEP; + sprintf(vp, "%u", v); + vp += strlen(vp); + } + break; + + case __INDIR: /* name=value */ + case __ILIST: /* name=value;name=value... */ + bcopy(cp, buf, size); /* cannot overflow */ + buf[size] = '\0'; + for (endv = buf; endv; endv = vp) { + u_char *s = NULL; /* semicolon ? */ + + /* skip leading whitespace */ + while (*endv && index(" \t\n\r", *endv)) + endv++; + vp = index(endv, '='); /* find name=value separator */ + if (!vp) + break; + *vp++ = 0; + if (op->fmt == __ILIST && (s = index(vp, ';'))) + *s++ = '\0'; + setenv(endv, vp, 1); + vp = s; /* prepare for next round */ + } + buf[0] = '\0'; /* option already done */ + } + + if (tp - tags < sizeof(tags) - 5) { /* add tag to the list */ + if (tp != tags) + *tp++ = FLD_SEP; + sprintf(tp, "%d", tag); + tp += strlen(tp); + } + if (buf[0]) { + char env[128]; /* the string name */ + + if (op->tag == 0) + sprintf(env, op->desc, opts[0].desc, tag); + else + sprintf(env, "%s%s", opts[0].desc, op->desc); + setenv(env, buf, 1); + } + } + if (tp != tags) { + char env[128]; /* the string name */ + sprintf(env, "%stags", opts[0].desc); + setenv(env, tags, 1); + } +} +#endif /* additional dhcp */ From owner-svn-src-head@FreeBSD.ORG Fri Dec 5 18:35:02 2008 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B8EE81065672 for ; Fri, 5 Dec 2008 18:35:02 +0000 (UTC) (envelope-from julian@elischer.org) Received: from outR.internet-mail-service.net (outr.internet-mail-service.net [216.240.47.241]) by mx1.freebsd.org (Postfix) with ESMTP id 979108FC14 for ; Fri, 5 Dec 2008 18:35:02 +0000 (UTC) (envelope-from julian@elischer.org) Received: from idiom.com (mx0.idiom.com [216.240.32.160]) by out.internet-mail-service.net (Postfix) with ESMTP id B6EAA24C9; Fri, 5 Dec 2008 10:22:35 -0800 (PST) X-Client-Authorized: MaGic Cook1e X-Client-Authorized: MaGic Cook1e X-Client-Authorized: MaGic Cook1e X-Client-Authorized: MaGic Cook1e X-Client-Authorized: MaGic Cook1e X-Client-Authorized: MaGic Cook1e Received: from julian-mac.elischer.org (home.elischer.org [216.240.48.38]) by idiom.com (Postfix) with ESMTP id 5CA842D6004; Fri, 5 Dec 2008 10:22:36 -0800 (PST) Message-ID: <4939716A.3080103@elischer.org> Date: Fri, 05 Dec 2008 10:22:34 -0800 From: Julian Elischer User-Agent: Thunderbird 2.0.0.18 (Macintosh/20081105) MIME-Version: 1.0 To: James Gritton References: <200811291432.mATEWE2a053742@svn.freebsd.org> <86skp3yje2.fsf@ds4.des.no> <20081204184332.C80401@maildrop.int.zabbadoz.net> <4939482F.4040404@gritton.org> In-Reply-To: <4939482F.4040404@gritton.org> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 8bit Cc: svn-src-head@freebsd.org, "Bjoern A. Zeeb" , svn-src-all@freebsd.org, src-committers@freebsd.org, =?ISO-8859-1?Q?Dag-Erling_Sm=F8rgrav?= Subject: Re: svn commit: r185435 - in head: lib/libc/sys lib/libkvm share/man/man4 sys/compat/freebsd32 sys/kern sys/net sys/netinet sys/netinet6 sys/security/mac_bsdextended sys/sys usr.bin/cpuset usr.sbin/jai... X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 05 Dec 2008 18:35:02 -0000 James Gritton wrote: > Bjoern A. Zeeb wrote: >> On Thu, 4 Dec 2008, Dag-Erling Smørgrav wrote: >>> "Bjoern A. Zeeb" writes: >>>> Jails can have an unrestricted (no duplicate protection, etc.) name >>>> in addition to the hostname. The jail name cannot be changed from >>>> within a jail and is considered to be used for management purposes >>>> or as audit-token in the future. >>> >>> Is there a specific reason why we allow duplicates? >> >> Yes, so that people have a choice. >> >> You would have to take into account "DYING" jails with possibly >> duplicate names anyway. >> >> And it's a purely administrative name (cannot be changed from within >> the jail) so it's up to the administrator to have 2 "Customer Webserver" >> jails or a "Customer Webserver Tin" and a "Customer Webserver Box". >> >> BTW. in case people wonder how to set it (atm.) from rc.conf, you >> can use jail__flags. > > My new (upcoming) jail framework patches also support names, but without > allowing duplicates. This is necessary because jails can be looked up > in the kernel by name as well as by ID. I handle the special case of > "dying" jails, allowing a new jail to duplicate the name of one on the > the way out. > > As far as people having a choice, I don't see any more reason to offer > the choice of duplicate jail names than I do in offering duplicate login > names. It just doesn't make sense in the context of what purpose I > expect a name to serve. hierarchical names make this even less sensible, > > - Jamie From owner-svn-src-head@FreeBSD.ORG Fri Dec 5 20:50:25 2008 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1B5D81065672; Fri, 5 Dec 2008 20:50:25 +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 0A15D8FC12; Fri, 5 Dec 2008 20:50:25 +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 mB5KoOYY072653; Fri, 5 Dec 2008 20:50:24 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mB5KoOcV072648; Fri, 5 Dec 2008 20:50:24 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <200812052050.mB5KoOcV072648@svn.freebsd.org> From: Konstantin Belousov Date: Fri, 5 Dec 2008 20: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: r185647 - in head/sys: kern sys X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 05 Dec 2008 20:50:25 -0000 Author: kib Date: Fri Dec 5 20:50:24 2008 New Revision: 185647 URL: http://svn.freebsd.org/changeset/base/185647 Log: Several threads in a process may do vfork() simultaneously. Then, all parent threads sleep on the parent' struct proc until corresponding child releases the vmspace. Each sleep is interlocked with proc mutex of the child, that triggers assertion in the sleepq_add(). The assertion requires that at any time, all simultaneous sleepers for the channel use the same interlock. Silent the assertion by using conditional variable allocated in the child. Broadcast the variable event on exec() and exit(). Since struct proc * sleep wait channel is overloaded for several unrelated events, I was unable to remove wakeups from the places where cv_broadcast() is added, except exec(). Reported and tested by: ganbold Suggested and reviewed by: jhb MFC after: 2 week Modified: head/sys/kern/kern_exec.c head/sys/kern/kern_exit.c head/sys/kern/kern_fork.c head/sys/kern/kern_proc.c head/sys/sys/proc.h Modified: head/sys/kern/kern_exec.c ============================================================================== --- head/sys/kern/kern_exec.c Fri Dec 5 20:40:02 2008 (r185646) +++ head/sys/kern/kern_exec.c Fri Dec 5 20:50:24 2008 (r185647) @@ -609,7 +609,7 @@ interpret: p->p_flag |= P_EXEC; if (p->p_pptr && (p->p_flag & P_PPWAIT)) { p->p_flag &= ~P_PPWAIT; - wakeup(p->p_pptr); + cv_broadcast(&p->p_pwait); } /* Modified: head/sys/kern/kern_exit.c ============================================================================== --- head/sys/kern/kern_exit.c Fri Dec 5 20:40:02 2008 (r185646) +++ head/sys/kern/kern_exit.c Fri Dec 5 20:50:24 2008 (r185647) @@ -543,6 +543,7 @@ exit1(struct thread *td, int rv) * proc lock. */ wakeup(p->p_pptr); + cv_broadcast(&p->p_pwait); sched_exit(p->p_pptr, td); PROC_SLOCK(p); p->p_state = PRS_ZOMBIE; @@ -774,6 +775,7 @@ loop: PROC_UNLOCK(p); tdsignal(t, NULL, SIGCHLD, p->p_ksi); wakeup(t); + cv_broadcast(&p->p_pwait); PROC_UNLOCK(t); sx_xunlock(&proctree_lock); return (0); Modified: head/sys/kern/kern_fork.c ============================================================================== --- head/sys/kern/kern_fork.c Fri Dec 5 20:40:02 2008 (r185646) +++ head/sys/kern/kern_fork.c Fri Dec 5 20:50:24 2008 (r185647) @@ -754,7 +754,7 @@ again: */ PROC_LOCK(p2); while (p2->p_flag & P_PPWAIT) - msleep(p1, &p2->p_mtx, PWAIT, "ppwait", 0); + cv_wait(&p2->p_pwait, &p2->p_mtx); PROC_UNLOCK(p2); /* Modified: head/sys/kern/kern_proc.c ============================================================================== --- head/sys/kern/kern_proc.c Fri Dec 5 20:40:02 2008 (r185646) +++ head/sys/kern/kern_proc.c Fri Dec 5 20:50:24 2008 (r185647) @@ -231,6 +231,7 @@ proc_init(void *mem, int size, int flags bzero(&p->p_mtx, sizeof(struct mtx)); mtx_init(&p->p_mtx, "process lock", NULL, MTX_DEF | MTX_DUPOK); mtx_init(&p->p_slock, "process slock", NULL, MTX_SPIN | MTX_RECURSE); + cv_init(&p->p_pwait, "ppwait"); TAILQ_INIT(&p->p_threads); /* all threads in proc */ EVENTHANDLER_INVOKE(process_init, p); p->p_stats = pstats_alloc(); Modified: head/sys/sys/proc.h ============================================================================== --- head/sys/sys/proc.h Fri Dec 5 20:40:02 2008 (r185646) +++ head/sys/sys/proc.h Fri Dec 5 20:50:24 2008 (r185647) @@ -40,6 +40,7 @@ #include /* For struct callout. */ #include /* For struct klist. */ +#include #ifndef _KERNEL #include #endif @@ -540,6 +541,7 @@ struct proc { STAILQ_HEAD(, ktr_request) p_ktr; /* (o) KTR event queue. */ LIST_HEAD(, mqueue_notifier) p_mqnotifier; /* (c) mqueue notifiers.*/ struct kdtrace_proc *p_dtrace; /* (*) DTrace-specific data. */ + struct cv p_pwait; /* (*) wait cv for exit/exec */ }; #define p_session p_pgrp->pg_session From owner-svn-src-head@FreeBSD.ORG Fri Dec 5 20:54:42 2008 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 045F21065672 for ; Fri, 5 Dec 2008 20:54:42 +0000 (UTC) (envelope-from julian@elischer.org) Received: from outG.internet-mail-service.net (outg.internet-mail-service.net [216.240.47.230]) by mx1.freebsd.org (Postfix) with ESMTP id DCEC28FC0A for ; Fri, 5 Dec 2008 20:54:41 +0000 (UTC) (envelope-from julian@elischer.org) Received: from idiom.com (mx0.idiom.com [216.240.32.160]) by out.internet-mail-service.net (Postfix) with ESMTP id 124A424E9; Fri, 5 Dec 2008 12:54:42 -0800 (PST) X-Client-Authorized: MaGic Cook1e X-Client-Authorized: MaGic Cook1e X-Client-Authorized: MaGic Cook1e X-Client-Authorized: MaGic Cook1e Received: from julian-mac.elischer.org (home.elischer.org [216.240.48.38]) by idiom.com (Postfix) with ESMTP id 3305A2D601B; Fri, 5 Dec 2008 12:54:42 -0800 (PST) Message-ID: <49399510.2030104@elischer.org> Date: Fri, 05 Dec 2008 12:54:40 -0800 From: Julian Elischer User-Agent: Thunderbird 2.0.0.18 (Macintosh/20081105) MIME-Version: 1.0 To: Konstantin Belousov References: <200812052050.mB5KoOcV072648@svn.freebsd.org> In-Reply-To: <200812052050.mB5KoOcV072648@svn.freebsd.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r185647 - in head/sys: kern sys X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 05 Dec 2008 20:54:42 -0000 Konstantin Belousov wrote: > Author: kib > Date: Fri Dec 5 20:50:24 2008 > New Revision: 185647 > URL: http://svn.freebsd.org/changeset/base/185647 > > Log: > Several threads in a process may do vfork() simultaneously. Then, all > parent threads sleep on the parent' struct proc until corresponding > child releases the vmspace. Each sleep is interlocked with proc mutex of > the child, that triggers assertion in the sleepq_add(). The assertion > requires that at any time, all simultaneous sleepers for the channel use > the same interlock. We DID have a thread_single() in the fork code so that only one thread would proceed through the fork itself at a time. However it was removed last year as it proved to be a problem in some cases. Maybe we need to look at replacing it in some way. > > Silent the assertion by using conditional variable allocated in the > child. Broadcast the variable event on exec() and exit(). > > Since struct proc * sleep wait channel is overloaded for several > unrelated events, I was unable to remove wakeups from the places where > cv_broadcast() is added, except exec(). > > Reported and tested by: ganbold > Suggested and reviewed by: jhb > MFC after: 2 week > > Modified: > head/sys/kern/kern_exec.c > head/sys/kern/kern_exit.c > head/sys/kern/kern_fork.c > head/sys/kern/kern_proc.c > head/sys/sys/proc.h > > Modified: head/sys/kern/kern_exec.c > ============================================================================== > --- head/sys/kern/kern_exec.c Fri Dec 5 20:40:02 2008 (r185646) > +++ head/sys/kern/kern_exec.c Fri Dec 5 20:50:24 2008 (r185647) > @@ -609,7 +609,7 @@ interpret: > p->p_flag |= P_EXEC; > if (p->p_pptr && (p->p_flag & P_PPWAIT)) { > p->p_flag &= ~P_PPWAIT; > - wakeup(p->p_pptr); > + cv_broadcast(&p->p_pwait); > } > > /* > > Modified: head/sys/kern/kern_exit.c > ============================================================================== > --- head/sys/kern/kern_exit.c Fri Dec 5 20:40:02 2008 (r185646) > +++ head/sys/kern/kern_exit.c Fri Dec 5 20:50:24 2008 (r185647) > @@ -543,6 +543,7 @@ exit1(struct thread *td, int rv) > * proc lock. > */ > wakeup(p->p_pptr); > + cv_broadcast(&p->p_pwait); > sched_exit(p->p_pptr, td); > PROC_SLOCK(p); > p->p_state = PRS_ZOMBIE; > @@ -774,6 +775,7 @@ loop: > PROC_UNLOCK(p); > tdsignal(t, NULL, SIGCHLD, p->p_ksi); > wakeup(t); > + cv_broadcast(&p->p_pwait); > PROC_UNLOCK(t); > sx_xunlock(&proctree_lock); > return (0); > > Modified: head/sys/kern/kern_fork.c > ============================================================================== > --- head/sys/kern/kern_fork.c Fri Dec 5 20:40:02 2008 (r185646) > +++ head/sys/kern/kern_fork.c Fri Dec 5 20:50:24 2008 (r185647) > @@ -754,7 +754,7 @@ again: > */ > PROC_LOCK(p2); > while (p2->p_flag & P_PPWAIT) > - msleep(p1, &p2->p_mtx, PWAIT, "ppwait", 0); > + cv_wait(&p2->p_pwait, &p2->p_mtx); > PROC_UNLOCK(p2); > > /* > > Modified: head/sys/kern/kern_proc.c > ============================================================================== > --- head/sys/kern/kern_proc.c Fri Dec 5 20:40:02 2008 (r185646) > +++ head/sys/kern/kern_proc.c Fri Dec 5 20:50:24 2008 (r185647) > @@ -231,6 +231,7 @@ proc_init(void *mem, int size, int flags > bzero(&p->p_mtx, sizeof(struct mtx)); > mtx_init(&p->p_mtx, "process lock", NULL, MTX_DEF | MTX_DUPOK); > mtx_init(&p->p_slock, "process slock", NULL, MTX_SPIN | MTX_RECURSE); > + cv_init(&p->p_pwait, "ppwait"); > TAILQ_INIT(&p->p_threads); /* all threads in proc */ > EVENTHANDLER_INVOKE(process_init, p); > p->p_stats = pstats_alloc(); > > Modified: head/sys/sys/proc.h > ============================================================================== > --- head/sys/sys/proc.h Fri Dec 5 20:40:02 2008 (r185646) > +++ head/sys/sys/proc.h Fri Dec 5 20:50:24 2008 (r185647) > @@ -40,6 +40,7 @@ > > #include /* For struct callout. */ > #include /* For struct klist. */ > +#include > #ifndef _KERNEL > #include > #endif > @@ -540,6 +541,7 @@ struct proc { > STAILQ_HEAD(, ktr_request) p_ktr; /* (o) KTR event queue. */ > LIST_HEAD(, mqueue_notifier) p_mqnotifier; /* (c) mqueue notifiers.*/ > struct kdtrace_proc *p_dtrace; /* (*) DTrace-specific data. */ > + struct cv p_pwait; /* (*) wait cv for exit/exec */ > }; > > #define p_session p_pgrp->pg_session From owner-svn-src-head@FreeBSD.ORG Fri Dec 5 21:03:56 2008 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D75A91065673; Fri, 5 Dec 2008 21:03:56 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from mail.terabit.net.ua (mail.terabit.net.ua [195.137.202.147]) by mx1.freebsd.org (Postfix) with ESMTP id 7A26F8FC08; Fri, 5 Dec 2008 21:03:56 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from skuns.zoral.com.ua ([91.193.166.194] helo=mail.zoral.com.ua) by mail.terabit.net.ua with esmtps (TLSv1:AES256-SHA:256) (Exim 4.63 (FreeBSD)) (envelope-from ) id 1L8hq4-0006AA-Hq; Fri, 05 Dec 2008 23:03:52 +0200 Received: from deviant.kiev.zoral.com.ua (root@deviant.kiev.zoral.com.ua [10.1.1.148]) by mail.zoral.com.ua (8.14.2/8.14.2) with ESMTP id mB5L3n70094534 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Fri, 5 Dec 2008 23:03:49 +0200 (EET) (envelope-from kostikbel@gmail.com) Received: from deviant.kiev.zoral.com.ua (kostik@localhost [127.0.0.1]) by deviant.kiev.zoral.com.ua (8.14.3/8.14.3) with ESMTP id mB5L3nPQ046255; Fri, 5 Dec 2008 23:03:49 +0200 (EET) (envelope-from kostikbel@gmail.com) Received: (from kostik@localhost) by deviant.kiev.zoral.com.ua (8.14.3/8.14.3/Submit) id mB5L3njG046254; Fri, 5 Dec 2008 23:03:49 +0200 (EET) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: deviant.kiev.zoral.com.ua: kostik set sender to kostikbel@gmail.com using -f Date: Fri, 5 Dec 2008 23:03:49 +0200 From: Kostik Belousov To: Julian Elischer Message-ID: <20081205210349.GQ2038@deviant.kiev.zoral.com.ua> References: <200812052050.mB5KoOcV072648@svn.freebsd.org> <49399510.2030104@elischer.org> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="H2kTGx6mr3R59oXC" Content-Disposition: inline In-Reply-To: <49399510.2030104@elischer.org> User-Agent: Mutt/1.4.2.3i X-Virus-Scanned: ClamAV version 0.93.3, clamav-milter version 0.93.3 on skuns.kiev.zoral.com.ua X-Virus-Status: Clean X-Spam-Status: No, score=-4.4 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00 autolearn=ham version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on skuns.kiev.zoral.com.ua X-Virus-Scanned: mail.terabit.net.ua 1L8hq4-0006AA-Hq 8c31ab556e3a6c0ec03eeb1f8f4a67fa X-Terabit: YES Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r185647 - in head/sys: kern sys X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 05 Dec 2008 21:03:57 -0000 --H2kTGx6mr3R59oXC Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Fri, Dec 05, 2008 at 12:54:40PM -0800, Julian Elischer wrote: > Konstantin Belousov wrote: > >Author: kib > >Date: Fri Dec 5 20:50:24 2008 > >New Revision: 185647 > >URL: http://svn.freebsd.org/changeset/base/185647 > > > >Log: > > Several threads in a process may do vfork() simultaneously. Then, all > > parent threads sleep on the parent' struct proc until corresponding > > child releases the vmspace. Each sleep is interlocked with proc mutex = of > > the child, that triggers assertion in the sleepq_add(). The assertion > > requires that at any time, all simultaneous sleepers for the channel u= se > > the same interlock. >=20 > We DID have a thread_single() in the fork code so that > only one thread would proceed through the fork itself at a time. > However it was removed last year as it proved to be a problem in some=20 > cases. Maybe we need to look at replacing it in some way. Yes, I know, and I considered restoring conditional single-threading for the vfork(). But it would immediately bring back all NFS client problems, associated with this (at least sleeping with vnode lock held and nfsbiod creation deadlocks). This is a second problem caused by removal of the single-threading. Nonetheless, I think that your change was right, and we shall just fix a corner cases. --H2kTGx6mr3R59oXC Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (FreeBSD) iEYEARECAAYFAkk5lzQACgkQC3+MBN1Mb4jDrwCfSHI2WPu10vxN2JOd4DKcCCvI P9IAnjw6MosZ2AjszKnkkv/TER0JlOwi =jl/g -----END PGP SIGNATURE----- --H2kTGx6mr3R59oXC-- From owner-svn-src-head@FreeBSD.ORG Fri Dec 5 21:17:54 2008 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 55C0E106564A; Fri, 5 Dec 2008 21:17:54 +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 451368FC13; Fri, 5 Dec 2008 21:17:54 +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 mB5LHsvR073412; Fri, 5 Dec 2008 21:17:54 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mB5LHshQ073411; Fri, 5 Dec 2008 21:17:54 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <200812052117.mB5LHshQ073411@svn.freebsd.org> From: Konstantin Belousov Date: Fri, 5 Dec 2008 21:17: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: r185651 - head/sys/i386/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: Fri, 05 Dec 2008 21:17:54 -0000 Author: kib Date: Fri Dec 5 21:17:54 2008 New Revision: 185651 URL: http://svn.freebsd.org/changeset/base/185651 Log: Unconditionally use locked addition of zero to tip of the stack for memory barriers on i386. It works as a serialization instruction on all IA32 CPUs. Alternative solution of using {s,l,}fence requires run-time checking of the presense of the corresponding SSE or SSE2 extensions, and possible boot-time patching of the kernel text. Suggested by: many Modified: head/sys/i386/include/atomic.h Modified: head/sys/i386/include/atomic.h ============================================================================== --- head/sys/i386/include/atomic.h Fri Dec 5 21:17:19 2008 (r185650) +++ head/sys/i386/include/atomic.h Fri Dec 5 21:17:54 2008 (r185651) @@ -32,20 +32,9 @@ #error this file needs sys/cdefs.h as a prerequisite #endif - -#if defined(I686_CPU) -#define mb() __asm__ __volatile__ ("mfence;": : :"memory") -#define wmb() __asm__ __volatile__ ("sfence;": : :"memory") -#define rmb() __asm__ __volatile__ ("lfence;": : :"memory") -#else -/* - * do we need a serializing instruction? - */ -#define mb() -#define wmb() -#define rmb() -#endif - +#define mb() __asm __volatile("lock;addl $0,(%esp)") +#define wmb() __asm __volatile("lock;addl $0,(%esp)") +#define rmb() __asm __volatile("lock;addl $0,(%esp)") /* * Various simple operations on memory, each of which is atomic in the From owner-svn-src-head@FreeBSD.ORG Fri Dec 5 21:19:25 2008 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 50945106568A; Fri, 5 Dec 2008 21:19:25 +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 400058FC23; Fri, 5 Dec 2008 21:19:25 +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 mB5LJP6M073492; Fri, 5 Dec 2008 21:19:25 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mB5LJPJp073491; Fri, 5 Dec 2008 21:19:25 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <200812052119.mB5LJPJp073491@svn.freebsd.org> From: John Baldwin Date: Fri, 5 Dec 2008 21: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: r185652 - head/sys/libkern X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 05 Dec 2008 21:19:25 -0000 Author: jhb Date: Fri Dec 5 21:19:24 2008 New Revision: 185652 URL: http://svn.freebsd.org/changeset/base/185652 Log: Add simple locking for the in-kernel iconv code. Translation operations do not need any locking. Opening and closing translators is serialized using an sx lock. Note: This depends on the earlier fix to kern_module.c to properly order MOD_UNLOAD events. MFC after: 2 months Modified: head/sys/libkern/iconv.c Modified: head/sys/libkern/iconv.c ============================================================================== --- head/sys/libkern/iconv.c Fri Dec 5 21:17:54 2008 (r185651) +++ head/sys/libkern/iconv.c Fri Dec 5 21:19:24 2008 (r185652) @@ -39,6 +39,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include "iconv_converter_if.h" @@ -52,6 +53,8 @@ MALLOC_DEFINE(M_ICONVDATA, "iconv_data", MODULE_VERSION(libiconv, 2); +static struct sx iconv_lock; + #ifdef notnow /* * iconv converter instance @@ -86,11 +89,16 @@ iconv_mod_unload(void) { struct iconv_cspair *csp; + sx_xlock(&iconv_lock); while ((csp = TAILQ_FIRST(&iconv_cslist)) != NULL) { if (csp->cp_refcount) return EBUSY; - iconv_unregister_cspair(csp); } + + while ((csp = TAILQ_FIRST(&iconv_cslist)) != NULL) + iconv_unregister_cspair(csp); + sx_xunlock(&iconv_lock); + sx_destroy(&iconv_lock); return 0; } @@ -102,6 +110,7 @@ iconv_mod_handler(module_t mod, int type switch (type) { case MOD_LOAD: error = 0; + sx_init(&iconv_lock, "iconv"); break; case MOD_UNLOAD: error = iconv_mod_unload(); @@ -311,7 +320,7 @@ iconv_sysctl_drvlist(SYSCTL_HANDLER_ARGS int error; error = 0; - + sx_slock(&iconv_lock); TAILQ_FOREACH(dcp, &iconv_converters, cc_link) { name = ICONV_CONVERTER_NAME(dcp); if (name == NULL) @@ -320,6 +329,7 @@ iconv_sysctl_drvlist(SYSCTL_HANDLER_ARGS if (error) break; } + sx_sunlock(&iconv_lock); if (error) return error; spc = 0; @@ -343,7 +353,7 @@ iconv_sysctl_cslist(SYSCTL_HANDLER_ARGS) error = 0; bzero(&csi, sizeof(csi)); csi.cs_version = ICONV_CSPAIR_INFO_VER; - + sx_slock(&iconv_lock); TAILQ_FOREACH(csp, &iconv_cslist, cp_link) { csi.cs_id = csp->cp_id; csi.cs_refcount = csp->cp_refcount; @@ -354,6 +364,7 @@ iconv_sysctl_cslist(SYSCTL_HANDLER_ARGS) if (error) break; } + sx_sunlock(&iconv_lock); return error; } @@ -387,9 +398,12 @@ iconv_sysctl_add(SYSCTL_HANDLER_ARGS) return EINVAL; if (iconv_lookupconv(din.ia_converter, &dcp) != 0) return EINVAL; + sx_xlock(&iconv_lock); error = iconv_register_cspair(din.ia_to, din.ia_from, dcp, NULL, &csp); - if (error) + if (error) { + sx_xunlock(&iconv_lock); return error; + } if (din.ia_datalen) { csp->cp_data = malloc(din.ia_datalen, M_ICONVDATA, M_WAITOK); error = copyin(din.ia_data, csp->cp_data, din.ia_datalen); @@ -400,10 +414,12 @@ iconv_sysctl_add(SYSCTL_HANDLER_ARGS) error = SYSCTL_OUT(req, &dout, sizeof(dout)); if (error) goto bad; + sx_xunlock(&iconv_lock); ICDEBUG("%s => %s, %d bytes\n",din.ia_from, din.ia_to, din.ia_datalen); return 0; bad: iconv_unregister_cspair(csp); + sx_xunlock(&iconv_lock); return error; } @@ -433,16 +449,22 @@ iconv_converter_handler(module_t mod, in switch (type) { case MOD_LOAD: + sx_xlock(&iconv_lock); error = iconv_register_converter(dcp); - if (error) + if (error) { + sx_xunlock(&iconv_lock); break; + } error = ICONV_CONVERTER_INIT(dcp); if (error) iconv_unregister_converter(dcp); + sx_xunlock(&iconv_lock); break; case MOD_UNLOAD: + sx_xlock(&iconv_lock); ICONV_CONVERTER_DONE(dcp); error = iconv_unregister_converter(dcp); + sx_xunlock(&iconv_lock); break; default: error = EINVAL; From owner-svn-src-head@FreeBSD.ORG Fri Dec 5 21:40:12 2008 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4CA83106576E; Fri, 5 Dec 2008 21:40:12 +0000 (UTC) (envelope-from gnn@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 3B51B8FC12; Fri, 5 Dec 2008 21:40:12 +0000 (UTC) (envelope-from gnn@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mB5LeCDf074057; Fri, 5 Dec 2008 21:40:12 GMT (envelope-from gnn@svn.freebsd.org) Received: (from gnn@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mB5LeCSG074056; Fri, 5 Dec 2008 21:40:12 GMT (envelope-from gnn@svn.freebsd.org) Message-Id: <200812052140.mB5LeCSG074056@svn.freebsd.org> From: "George V. Neville-Neil" Date: Fri, 5 Dec 2008 21:40: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: r185655 - head/sys/dev/cxgb X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 05 Dec 2008 21:40:12 -0000 Author: gnn Date: Fri Dec 5 21:40:11 2008 New Revision: 185655 URL: http://svn.freebsd.org/changeset/base/185655 Log: Re submit code to print the part and serial number for Chelsio cards. The original code was accidentally removed in another commit. MFC after: 1 day Modified: head/sys/dev/cxgb/cxgb_main.c Modified: head/sys/dev/cxgb/cxgb_main.c ============================================================================== --- head/sys/dev/cxgb/cxgb_main.c Fri Dec 5 21:32:30 2008 (r185654) +++ head/sys/dev/cxgb/cxgb_main.c Fri Dec 5 21:40:11 2008 (r185655) @@ -402,6 +402,8 @@ cxgb_controller_attach(device_t dev) int msi_needed, reg; #endif int must_load = 0; + char buf[80]; + sc = device_get_softc(dev); sc->dev = dev; sc->msi_count = 0; @@ -614,6 +616,11 @@ cxgb_controller_attach(device_t dev) G_FW_VERSION_MAJOR(vers), G_FW_VERSION_MINOR(vers), G_FW_VERSION_MICRO(vers)); + snprintf(buf, sizeof(buf), "%s\t E/C: %s S/N: %s", + ai->desc, + sc->params.vpd.ec, sc->params.vpd.sn); + device_set_desc_copy(dev, buf); + device_printf(sc->dev, "Firmware Version %s\n", &sc->fw_version[0]); callout_reset(&sc->cxgb_tick_ch, CXGB_TICKS(sc), cxgb_tick, sc); t3_add_attach_sysctls(sc); From owner-svn-src-head@FreeBSD.ORG Fri Dec 5 22:04:53 2008 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2C65E1065672; Fri, 5 Dec 2008 22:04:53 +0000 (UTC) (envelope-from schweikh@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 1B2018FC0A; Fri, 5 Dec 2008 22:04:53 +0000 (UTC) (envelope-from schweikh@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mB5M4r5O074629; Fri, 5 Dec 2008 22:04:53 GMT (envelope-from schweikh@svn.freebsd.org) Received: (from schweikh@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mB5M4qlY074628; Fri, 5 Dec 2008 22:04:52 GMT (envelope-from schweikh@svn.freebsd.org) Message-Id: <200812052204.mB5M4qlY074628@svn.freebsd.org> From: Jens Schweikhardt Date: Fri, 5 Dec 2008 22: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: r185656 - head/share/man/man7 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 05 Dec 2008 22:04:53 -0000 Author: schweikh Date: Fri Dec 5 22:04:52 2008 New Revision: 185656 URL: http://svn.freebsd.org/changeset/base/185656 Log: Correct a typo. Modified: head/share/man/man7/ports.7 Modified: head/share/man/man7/ports.7 ============================================================================== --- head/share/man/man7/ports.7 Fri Dec 5 21:40:11 2008 (r185655) +++ head/share/man/man7/ports.7 Fri Dec 5 22:04:52 2008 (r185656) @@ -322,7 +322,7 @@ To find ports that contain in either of the name, path, info fields, ignore the rest of the record. .Pp -By default the search is not case-nsensitive. +By default the search is not case-sensitive. In order to make it case-sensitive you can use the .Va icase variable: From owner-svn-src-head@FreeBSD.ORG Fri Dec 5 22:50:41 2008 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 87B981065673; Fri, 5 Dec 2008 22:50:41 +0000 (UTC) (envelope-from rdivacky@lev.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 3E5948FC0C; Fri, 5 Dec 2008 22:50:40 +0000 (UTC) (envelope-from rdivacky@lev.vlakno.cz) Received: from localhost (localhost [127.0.0.1]) by vlakno.cz (Postfix) with ESMTP id EBE139CB344; Fri, 5 Dec 2008 23:46:02 +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 3frPamQQhKUV; Fri, 5 Dec 2008 23:46:00 +0100 (CET) Received: from lev.vlakno.cz (localhost [127.0.0.1]) by vlakno.cz (Postfix) with ESMTP id BE8A29CB5AB; Fri, 5 Dec 2008 23:46:00 +0100 (CET) Received: (from rdivacky@localhost) by lev.vlakno.cz (8.14.2/8.14.2/Submit) id mB5Mk0ut017429; Fri, 5 Dec 2008 23:46:00 +0100 (CET) (envelope-from rdivacky) Date: Fri, 5 Dec 2008 23:46:00 +0100 From: Roman Divacky To: Konstantin Belousov Message-ID: <20081205224600.GA16948@freebsd.org> References: <200812052050.mB5KoOcV072648@svn.freebsd.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <200812052050.mB5KoOcV072648@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: r185647 - in head/sys: kern sys X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 05 Dec 2008 22:50:41 -0000 On Fri, Dec 05, 2008 at 08:50:24PM +0000, Konstantin Belousov wrote: > Author: kib > Date: Fri Dec 5 20:50:24 2008 > New Revision: 185647 > URL: http://svn.freebsd.org/changeset/base/185647 > > Log: > Several threads in a process may do vfork() simultaneously. Then, all > parent threads sleep on the parent' struct proc until corresponding > child releases the vmspace. Each sleep is interlocked with proc mutex of > the child, that triggers assertion in the sleepq_add(). The assertion > requires that at any time, all simultaneous sleepers for the channel use > the same interlock. > > Silent the assertion by using conditional variable allocated in the > child. Broadcast the variable event on exec() and exit(). > > Since struct proc * sleep wait channel is overloaded for several > unrelated events, I was unable to remove wakeups from the places where > cv_broadcast() is added, except exec(). are there any differences (performance etc.) in using condition variables instead of sleep/wakeup? From owner-svn-src-head@FreeBSD.ORG Fri Dec 5 23:00:16 2008 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id AED1C1065673; Fri, 5 Dec 2008 23:00:16 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from mail.terabit.net.ua (mail.terabit.net.ua [195.137.202.147]) by mx1.freebsd.org (Postfix) with ESMTP id 4F6138FC0C; Fri, 5 Dec 2008 23:00:16 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from skuns.zoral.com.ua ([91.193.166.194] helo=mail.zoral.com.ua) by mail.terabit.net.ua with esmtps (TLSv1:AES256-SHA:256) (Exim 4.63 (FreeBSD)) (envelope-from ) id 1L8jeh-000EwP-3w; Sat, 06 Dec 2008 01:00:15 +0200 Received: from deviant.kiev.zoral.com.ua (root@deviant.kiev.zoral.com.ua [10.1.1.148]) by mail.zoral.com.ua (8.14.2/8.14.2) with ESMTP id mB5N024x000565 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Sat, 6 Dec 2008 01:00:03 +0200 (EET) (envelope-from kostikbel@gmail.com) Received: from deviant.kiev.zoral.com.ua (kostik@localhost [127.0.0.1]) by deviant.kiev.zoral.com.ua (8.14.3/8.14.3) with ESMTP id mB5N022K058111; Sat, 6 Dec 2008 01:00:02 +0200 (EET) (envelope-from kostikbel@gmail.com) Received: (from kostik@localhost) by deviant.kiev.zoral.com.ua (8.14.3/8.14.3/Submit) id mB5N02Ox058110; Sat, 6 Dec 2008 01:00:02 +0200 (EET) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: deviant.kiev.zoral.com.ua: kostik set sender to kostikbel@gmail.com using -f Date: Sat, 6 Dec 2008 01:00:02 +0200 From: Kostik Belousov To: Roman Divacky Message-ID: <20081205230002.GX2038@deviant.kiev.zoral.com.ua> References: <200812052050.mB5KoOcV072648@svn.freebsd.org> <20081205224600.GA16948@freebsd.org> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="tgO4DUqb0GCKXXLG" Content-Disposition: inline In-Reply-To: <20081205224600.GA16948@freebsd.org> User-Agent: Mutt/1.4.2.3i X-Virus-Scanned: ClamAV version 0.93.3, clamav-milter version 0.93.3 on skuns.kiev.zoral.com.ua X-Virus-Status: Clean X-Spam-Status: No, score=-4.4 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00 autolearn=ham version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on skuns.kiev.zoral.com.ua X-Virus-Scanned: mail.terabit.net.ua 1L8jeh-000EwP-3w 6fc4ee964870f9d1fb5b45df9f6b6da5 X-Terabit: YES Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r185647 - in head/sys: kern sys X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 05 Dec 2008 23:00:16 -0000 --tgO4DUqb0GCKXXLG Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Fri, Dec 05, 2008 at 11:46:00PM +0100, Roman Divacky wrote: > On Fri, Dec 05, 2008 at 08:50:24PM +0000, Konstantin Belousov wrote: > > Author: kib > > Date: Fri Dec 5 20:50:24 2008 > > New Revision: 185647 > > URL: http://svn.freebsd.org/changeset/base/185647 > >=20 > > Log: > > Several threads in a process may do vfork() simultaneously. Then, all > > parent threads sleep on the parent' struct proc until corresponding > > child releases the vmspace. Each sleep is interlocked with proc mutex= of > > the child, that triggers assertion in the sleepq_add(). The assertion > > requires that at any time, all simultaneous sleepers for the channel = use > > the same interlock. > > =20 > > Silent the assertion by using conditional variable allocated in the > > child. Broadcast the variable event on exec() and exit(). > > =20 > > Since struct proc * sleep wait channel is overloaded for several > > unrelated events, I was unable to remove wakeups from the places where > > cv_broadcast() is added, except exec(). >=20 > are there any differences (performance etc.) in using condition variables > instead of sleep/wakeup? I do not think that there is any measurable difference. On the other hand, the patch makes struct proc bigger by int + pointer. This shall not be a problem too. Would I been able to convert _all_ uses of the struct proc * wait channel to cond vars operation, this may be measurable on some loads, since it would exclude spurious wakeups. --tgO4DUqb0GCKXXLG Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (FreeBSD) iEYEARECAAYFAkk5snIACgkQC3+MBN1Mb4jlrgCeOSR6qYzMOOnwNAJPHrBIt81D xFoAoLdHTMa7kmqMzcVYBIvLWVlUCi/j =97eS -----END PGP SIGNATURE----- --tgO4DUqb0GCKXXLG-- From owner-svn-src-head@FreeBSD.ORG Sat Dec 6 01:31:08 2008 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 55CB8106564A; Sat, 6 Dec 2008 01:31:08 +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 440568FC13; Sat, 6 Dec 2008 01:31:08 +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 mB61V7KB078930; Sat, 6 Dec 2008 01:31:07 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mB61V7xX078929; Sat, 6 Dec 2008 01:31:07 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <200812060131.mB61V7xX078929@svn.freebsd.org> From: Alexander Motin Date: Sat, 6 Dec 2008 01:31: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: r185661 - head/sys/dev/sdhci X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 06 Dec 2008 01:31:08 -0000 Author: mav Date: Sat Dec 6 01:31:07 2008 New Revision: 185661 URL: http://svn.freebsd.org/changeset/base/185661 Log: Forget current bus power settings on full reset. Chip must be reconfigured. Do not issue command if there is no card, clock or power. Controller will not detect command timeout without clock active. Modified: head/sys/dev/sdhci/sdhci.c Modified: head/sys/dev/sdhci/sdhci.c ============================================================================== --- head/sys/dev/sdhci/sdhci.c Sat Dec 6 01:11:45 2008 (r185660) +++ head/sys/dev/sdhci/sdhci.c Sat Dec 6 01:31:07 2008 (r185661) @@ -301,8 +301,10 @@ sdhci_reset(struct sdhci_slot *slot, uin WR1(slot, SDHCI_SOFTWARE_RESET, mask); - if (mask & SDHCI_RESET_ALL) + if (mask & SDHCI_RESET_ALL) { slot->clock = 0; + slot->power = 0; + } /* Wait max 100 ms */ timeout = 100; @@ -904,8 +906,11 @@ sdhci_start_command(struct sdhci_slot *s /* Read controller present state. */ state = RD4(slot, SDHCI_PRESENT_STATE); - /* Do not issue command if there is no card. */ - if ((state & SDHCI_CARD_PRESENT) == 0) { + /* Do not issue command if there is no card, clock or power. + * Controller will not detect timeout without clock active. */ + if ((state & SDHCI_CARD_PRESENT) == 0 || + slot->power == 0 || + slot->clock == 0) { cmd->error = MMC_ERR_FAILED; slot->req = NULL; slot->curcmd = NULL; From owner-svn-src-head@FreeBSD.ORG Sat Dec 6 01:59:53 2008 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7F4A41065672; Sat, 6 Dec 2008 01:59:53 +0000 (UTC) (envelope-from ganbold@micom.mng.net) Received: from publicd.ub.mng.net (publicd.ub.mng.net [202.179.0.88]) by mx1.freebsd.org (Postfix) with ESMTP id 2FDF28FC0C; Sat, 6 Dec 2008 01:59:52 +0000 (UTC) (envelope-from ganbold@micom.mng.net) Received: from [202.179.21.130] (helo=devil.micom.mng.net) by publicd.ub.mng.net with esmtpa (Exim 4.69 (FreeBSD)) (envelope-from ) id 1L8mSU-000G7N-Jc; Sat, 06 Dec 2008 09:59:50 +0800 Message-ID: <4939DC96.3040709@micom.mng.net> Date: Sat, 06 Dec 2008 09:59:50 +0800 From: Ganbold User-Agent: Thunderbird 2.0.0.17 (X11/20081020) MIME-Version: 1.0 To: Konstantin Belousov References: <200812052050.mB5KoOcV072648@svn.freebsd.org> In-Reply-To: <200812052050.mB5KoOcV072648@svn.freebsd.org> X-Enigmail-Version: 0.95.7 OpenPGP: id=78F6425E Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r185647 - in head/sys: kern sys X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 06 Dec 2008 01:59:53 -0000 Konstantin Belousov wrote: > Author: kib > Date: Fri Dec 5 20:50:24 2008 > New Revision: 185647 > URL: http://svn.freebsd.org/changeset/base/185647 > > Log: > Several threads in a process may do vfork() simultaneously. Then, all > parent threads sleep on the parent' struct proc until corresponding > child releases the vmspace. Each sleep is interlocked with proc mutex of > the child, that triggers assertion in the sleepq_add(). The assertion > requires that at any time, all simultaneous sleepers for the channel use > the same interlock. > > Silent the assertion by using conditional variable allocated in the > child. Broadcast the variable event on exec() and exit(). > > Since struct proc * sleep wait channel is overloaded for several > unrelated events, I was unable to remove wakeups from the places where > cv_broadcast() is added, except exec(). > > Reported and tested by: ganbold > Suggested and reviewed by: jhb > MFC after: 2 week > Thanks a lot, Konstantin. Ganbold > Modified: > head/sys/kern/kern_exec.c > head/sys/kern/kern_exit.c > head/sys/kern/kern_fork.c > head/sys/kern/kern_proc.c > head/sys/sys/proc.h > > Modified: head/sys/kern/kern_exec.c > ============================================================================== > --- head/sys/kern/kern_exec.c Fri Dec 5 20:40:02 2008 (r185646) > +++ head/sys/kern/kern_exec.c Fri Dec 5 20:50:24 2008 (r185647) > @@ -609,7 +609,7 @@ interpret: > p->p_flag |= P_EXEC; > if (p->p_pptr && (p->p_flag & P_PPWAIT)) { > p->p_flag &= ~P_PPWAIT; > - wakeup(p->p_pptr); > + cv_broadcast(&p->p_pwait); > } > > /* > > Modified: head/sys/kern/kern_exit.c > ============================================================================== > --- head/sys/kern/kern_exit.c Fri Dec 5 20:40:02 2008 (r185646) > +++ head/sys/kern/kern_exit.c Fri Dec 5 20:50:24 2008 (r185647) > @@ -543,6 +543,7 @@ exit1(struct thread *td, int rv) > * proc lock. > */ > wakeup(p->p_pptr); > + cv_broadcast(&p->p_pwait); > sched_exit(p->p_pptr, td); > PROC_SLOCK(p); > p->p_state = PRS_ZOMBIE; > @@ -774,6 +775,7 @@ loop: > PROC_UNLOCK(p); > tdsignal(t, NULL, SIGCHLD, p->p_ksi); > wakeup(t); > + cv_broadcast(&p->p_pwait); > PROC_UNLOCK(t); > sx_xunlock(&proctree_lock); > return (0); > > Modified: head/sys/kern/kern_fork.c > ============================================================================== > --- head/sys/kern/kern_fork.c Fri Dec 5 20:40:02 2008 (r185646) > +++ head/sys/kern/kern_fork.c Fri Dec 5 20:50:24 2008 (r185647) > @@ -754,7 +754,7 @@ again: > */ > PROC_LOCK(p2); > while (p2->p_flag & P_PPWAIT) > - msleep(p1, &p2->p_mtx, PWAIT, "ppwait", 0); > + cv_wait(&p2->p_pwait, &p2->p_mtx); > PROC_UNLOCK(p2); > > /* > > Modified: head/sys/kern/kern_proc.c > ============================================================================== > --- head/sys/kern/kern_proc.c Fri Dec 5 20:40:02 2008 (r185646) > +++ head/sys/kern/kern_proc.c Fri Dec 5 20:50:24 2008 (r185647) > @@ -231,6 +231,7 @@ proc_init(void *mem, int size, int flags > bzero(&p->p_mtx, sizeof(struct mtx)); > mtx_init(&p->p_mtx, "process lock", NULL, MTX_DEF | MTX_DUPOK); > mtx_init(&p->p_slock, "process slock", NULL, MTX_SPIN | MTX_RECURSE); > + cv_init(&p->p_pwait, "ppwait"); > TAILQ_INIT(&p->p_threads); /* all threads in proc */ > EVENTHANDLER_INVOKE(process_init, p); > p->p_stats = pstats_alloc(); > > Modified: head/sys/sys/proc.h > ============================================================================== > --- head/sys/sys/proc.h Fri Dec 5 20:40:02 2008 (r185646) > +++ head/sys/sys/proc.h Fri Dec 5 20:50:24 2008 (r185647) > @@ -40,6 +40,7 @@ > > #include /* For struct callout. */ > #include /* For struct klist. */ > +#include > #ifndef _KERNEL > #include > #endif > @@ -540,6 +541,7 @@ struct proc { > STAILQ_HEAD(, ktr_request) p_ktr; /* (o) KTR event queue. */ > LIST_HEAD(, mqueue_notifier) p_mqnotifier; /* (c) mqueue notifiers.*/ > struct kdtrace_proc *p_dtrace; /* (*) DTrace-specific data. */ > + struct cv p_pwait; /* (*) wait cv for exit/exec */ > }; > > #define p_session p_pgrp->pg_session > _______________________________________________ > 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" > > > > -- If you teach your children to like computers and to know how to gamble then they'll always be interested in something and won't come to no real harm. From owner-svn-src-head@FreeBSD.ORG Sat Dec 6 02:10:53 2008 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CC675106564A; Sat, 6 Dec 2008 02:10:53 +0000 (UTC) (envelope-from gnn@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id BA24D8FC0C; Sat, 6 Dec 2008 02:10:53 +0000 (UTC) (envelope-from gnn@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mB62Ar2d079734; Sat, 6 Dec 2008 02:10:53 GMT (envelope-from gnn@svn.freebsd.org) Received: (from gnn@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mB62ArHr079732; Sat, 6 Dec 2008 02:10:53 GMT (envelope-from gnn@svn.freebsd.org) Message-Id: <200812060210.mB62ArHr079732@svn.freebsd.org> From: "George V. Neville-Neil" Date: Sat, 6 Dec 2008 02:10: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: r185662 - in head/sys/dev/cxgb: . common X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 06 Dec 2008 02:10:53 -0000 Author: gnn Date: Sat Dec 6 02:10:53 2008 New Revision: 185662 URL: http://svn.freebsd.org/changeset/base/185662 Log: Bug fix to support N310 version of Chelsio cards (board ID 1088). Obtained from: Chelsio Inc. MFC after: 3 days Modified: head/sys/dev/cxgb/common/cxgb_t3_hw.c head/sys/dev/cxgb/cxgb_main.c Modified: head/sys/dev/cxgb/common/cxgb_t3_hw.c ============================================================================== --- head/sys/dev/cxgb/common/cxgb_t3_hw.c Sat Dec 6 01:31:07 2008 (r185661) +++ head/sys/dev/cxgb/common/cxgb_t3_hw.c Sat Dec 6 02:10:53 2008 (r185662) @@ -509,6 +509,12 @@ static struct adapter_info t3_adap_info[ F_GPIO6_OUT_VAL | F_GPIO7_OUT_VAL, { S_GPIO1, S_GPIO2, S_GPIO3, S_GPIO4 }, SUPPORTED_AUI, &mi1_mdio_ops, "Chelsio T304" }, + { 0 }, + { 1, 0, 0, 0, 0, + F_GPIO1_OEN | F_GPIO2_OEN | F_GPIO4_OEN | F_GPIO6_OEN | F_GPIO7_OEN | + F_GPIO10_OEN | F_GPIO1_OUT_VAL | F_GPIO6_OUT_VAL | F_GPIO10_OUT_VAL, + { S_GPIO9 }, SUPPORTED_10000baseT_Full | SUPPORTED_AUI, + &mi1_mdio_ext_ops, "Chelsio N310" } }; /* Modified: head/sys/dev/cxgb/cxgb_main.c ============================================================================== --- head/sys/dev/cxgb/cxgb_main.c Sat Dec 6 01:31:07 2008 (r185661) +++ head/sys/dev/cxgb/cxgb_main.c Sat Dec 6 02:10:53 2008 (r185662) @@ -281,6 +281,7 @@ struct cxgb_ident { {PCI_VENDOR_ID_CHELSIO, 0x0031, 3, "T3B20"}, {PCI_VENDOR_ID_CHELSIO, 0x0032, 1, "T3B02"}, {PCI_VENDOR_ID_CHELSIO, 0x0033, 4, "T3B04"}, + {PCI_VENDOR_ID_CHELSIO, 0x0035, 6, "N310E"}, {0, 0, 0, NULL} }; @@ -444,12 +445,14 @@ cxgb_controller_attach(device_t dev) return (ENXIO); } sc->udbs_rid = PCIR_BAR(2); - if ((sc->udbs_res = bus_alloc_resource_any(dev, SYS_RES_MEMORY, - &sc->udbs_rid, RF_ACTIVE)) == NULL) { + sc->udbs_res = NULL; + if (is_offload(sc) && + ((sc->udbs_res = bus_alloc_resource_any(dev, SYS_RES_MEMORY, + &sc->udbs_rid, RF_ACTIVE)) == NULL)) { device_printf(dev, "Cannot allocate BAR region 1\n"); error = ENXIO; goto out; - } + } snprintf(sc->lockbuf, ADAPTER_LOCK_NAME_LEN, "cxgb controller lock %d", device_get_unit(dev)); From owner-svn-src-head@FreeBSD.ORG Sat Dec 6 05:52:02 2008 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 525A21065670; Sat, 6 Dec 2008 05: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 416798FC08; Sat, 6 Dec 2008 05: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 mB65q1hM084190; Sat, 6 Dec 2008 05:52:01 GMT (envelope-from kientzle@svn.freebsd.org) Received: (from kientzle@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mB65q160084189; Sat, 6 Dec 2008 05:52:01 GMT (envelope-from kientzle@svn.freebsd.org) Message-Id: <200812060552.mB65q160084189@svn.freebsd.org> From: Tim Kientzle Date: Sat, 6 Dec 2008 05:52: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: r185664 - 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, 06 Dec 2008 05:52:02 -0000 Author: kientzle Date: Sat Dec 6 05:52:01 2008 New Revision: 185664 URL: http://svn.freebsd.org/changeset/base/185664 Log: 2 is more portable than STDERR_FILENO Modified: head/lib/libarchive/archive_check_magic.c Modified: head/lib/libarchive/archive_check_magic.c ============================================================================== --- head/lib/libarchive/archive_check_magic.c Sat Dec 6 05:41:25 2008 (r185663) +++ head/lib/libarchive/archive_check_magic.c Sat Dec 6 05:52:01 2008 (r185664) @@ -46,7 +46,7 @@ __FBSDID("$FreeBSD$"); static void errmsg(const char *m) { - write(STDERR_FILENO, m, strlen(m)); + write(2, m, strlen(m)); } static void From owner-svn-src-head@FreeBSD.ORG Sat Dec 6 05:53:05 2008 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6F69C106567A; Sat, 6 Dec 2008 05:53: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 5EA498FC08; Sat, 6 Dec 2008 05:53:05 +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 mB65r5Dh084247; Sat, 6 Dec 2008 05:53:05 GMT (envelope-from kientzle@svn.freebsd.org) Received: (from kientzle@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mB65r5Ub084246; Sat, 6 Dec 2008 05:53:05 GMT (envelope-from kientzle@svn.freebsd.org) Message-Id: <200812060553.mB65r5Ub084246@svn.freebsd.org> From: Tim Kientzle Date: Sat, 6 Dec 2008 05:53: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: r185665 - 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, 06 Dec 2008 05:53:05 -0000 Author: kientzle Date: Sat Dec 6 05:53:05 2008 New Revision: 185665 URL: http://svn.freebsd.org/changeset/base/185665 Log: Windows build now uses PLATFORM_CONFIG_H macro, so we can eliminate the special case for it. Modified: head/lib/libarchive/archive_platform.h Modified: head/lib/libarchive/archive_platform.h ============================================================================== --- head/lib/libarchive/archive_platform.h Sat Dec 6 05:52:01 2008 (r185664) +++ head/lib/libarchive/archive_platform.h Sat Dec 6 05:53:05 2008 (r185665) @@ -39,10 +39,7 @@ /* archive.h and archive_entry.h require this. */ #define __LIBARCHIVE_BUILD 1 -#ifdef _WIN32 -#include "config_windows.h" -#include "archive_windows.h" -#elif defined(PLATFORM_CONFIG_H) +#if defined(PLATFORM_CONFIG_H) /* Use hand-built config.h in environments that need it. */ #include PLATFORM_CONFIG_H #elif defined(HAVE_CONFIG_H) From owner-svn-src-head@FreeBSD.ORG Sat Dec 6 05:55:47 2008 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8A92E106564A; Sat, 6 Dec 2008 05:55:47 +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 795648FC13; Sat, 6 Dec 2008 05:55:47 +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 mB65tl7X084342; Sat, 6 Dec 2008 05:55:47 GMT (envelope-from kientzle@svn.freebsd.org) Received: (from kientzle@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mB65tl76084341; Sat, 6 Dec 2008 05:55:47 GMT (envelope-from kientzle@svn.freebsd.org) Message-Id: <200812060555.mB65tl76084341@svn.freebsd.org> From: Tim Kientzle Date: Sat, 6 Dec 2008 05:55: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: r185666 - 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, 06 Dec 2008 05:55:47 -0000 Author: kientzle Date: Sat Dec 6 05:55:46 2008 New Revision: 185666 URL: http://svn.freebsd.org/changeset/base/185666 Log: Minor portability: Declare 'r' only within the conditional block where it's used; S_ISLNK is more portable than S_ISLINK. Modified: head/lib/libarchive/archive_write_disk.c Modified: head/lib/libarchive/archive_write_disk.c ============================================================================== --- head/lib/libarchive/archive_write_disk.c Sat Dec 6 05:53:05 2008 (r185665) +++ head/lib/libarchive/archive_write_disk.c Sat Dec 6 05:55:46 2008 (r185666) @@ -518,7 +518,6 @@ write_data_block(struct archive_write_di { ssize_t bytes_written = 0; ssize_t block_size = 0, bytes_to_write; - int r; if (a->filesize == 0 || a->fd < 0) { archive_set_error(&a->archive, 0, @@ -528,6 +527,7 @@ write_data_block(struct archive_write_di if (a->flags & ARCHIVE_EXTRACT_SPARSE) { #if HAVE_STRUCT_STAT_ST_BLKSIZE + int r; if ((r = _archive_write_disk_lazy_stat(a)) != ARCHIVE_OK) return (r); block_size = a->pst->st_blksize; @@ -1752,7 +1752,7 @@ set_time(int fd, int mode, const char *n (void)mtime_nsec; /* UNUSED */ times.actime = atime; times.modtime = mtime; - if (S_ISLINK(mode)) + if (S_ISLNK(mode)) return (ARCHIVE_OK); return (utime(name, ×)); } From owner-svn-src-head@FreeBSD.ORG Sat Dec 6 05:56:44 2008 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5AE29106567A; Sat, 6 Dec 2008 05:56: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 49D518FC12; Sat, 6 Dec 2008 05:56: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 mB65uibK084397; Sat, 6 Dec 2008 05:56:44 GMT (envelope-from kientzle@svn.freebsd.org) Received: (from kientzle@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mB65ui5s084395; Sat, 6 Dec 2008 05:56:44 GMT (envelope-from kientzle@svn.freebsd.org) Message-Id: <200812060556.mB65ui5s084395@svn.freebsd.org> From: Tim Kientzle Date: Sat, 6 Dec 2008 05:56: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: r185667 - 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, 06 Dec 2008 05:56:44 -0000 Author: kientzle Date: Sat Dec 6 05:56:43 2008 New Revision: 185667 URL: http://svn.freebsd.org/changeset/base/185667 Log: New internal archive_string_concat utility function. Modified: head/lib/libarchive/archive_string.c head/lib/libarchive/archive_string.h Modified: head/lib/libarchive/archive_string.c ============================================================================== --- head/lib/libarchive/archive_string.c Sat Dec 6 05:55:46 2008 (r185666) +++ head/lib/libarchive/archive_string.c Sat Dec 6 05:56:43 2008 (r185667) @@ -70,6 +70,18 @@ __archive_string_copy(struct archive_str } void +__archive_string_concat(struct archive_string *dest, struct archive_string *src) +{ + if (src->length > 0) { + if (__archive_string_ensure(dest, dest->length + src->length + 1) == NULL) + __archive_errx(1, "Out of memory"); + memcpy(dest->s + dest->length, src->s, src->length); + dest->length += src->length; + dest->s[dest->length] = 0; + } +} + +void __archive_string_free(struct archive_string *as) { as->length = 0; Modified: head/lib/libarchive/archive_string.h ============================================================================== --- head/lib/libarchive/archive_string.h Sat Dec 6 05:55:46 2008 (r185666) +++ head/lib/libarchive/archive_string.h Sat Dec 6 05:56:43 2008 (r185667) @@ -92,6 +92,12 @@ __archive_string_copy(struct archive_str #define archive_string_copy(dest, src) \ __archive_string_copy(dest, src) +/* Concatenate one archive_string to another */ +void +__archive_string_concat(struct archive_string *dest, struct archive_string *src); +#define archive_string_concat(dest, src) \ + __archive_string_concat(dest, src) + /* Ensure that the underlying buffer is at least as large as the request. */ struct archive_string * __archive_string_ensure(struct archive_string *, size_t); From owner-svn-src-head@FreeBSD.ORG Sat Dec 6 05:58:25 2008 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 30BFD1065672; Sat, 6 Dec 2008 05:58: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 1FC4A8FC08; Sat, 6 Dec 2008 05:58: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 mB65wPVI084463; Sat, 6 Dec 2008 05:58:25 GMT (envelope-from kientzle@svn.freebsd.org) Received: (from kientzle@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mB65wPPq084462; Sat, 6 Dec 2008 05:58:25 GMT (envelope-from kientzle@svn.freebsd.org) Message-Id: <200812060558.mB65wPPq084462@svn.freebsd.org> From: Tim Kientzle Date: Sat, 6 Dec 2008 05:58: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: r185668 - 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, 06 Dec 2008 05:58:25 -0000 Author: kientzle Date: Sat Dec 6 05:58:24 2008 New Revision: 185668 URL: http://svn.freebsd.org/changeset/base/185668 Log: Recover from a test failure here. Modified: head/lib/libarchive/test/test_read_format_gtar_sparse.c Modified: head/lib/libarchive/test/test_read_format_gtar_sparse.c ============================================================================== --- head/lib/libarchive/test/test_read_format_gtar_sparse.c Sat Dec 6 05:56:43 2008 (r185667) +++ head/lib/libarchive/test/test_read_format_gtar_sparse.c Sat Dec 6 05:58:24 2008 (r185668) @@ -201,7 +201,10 @@ verify_archive_file(const char *name, st while (ac->filename != NULL) { struct contents *cts = ac->contents; - assertEqualIntA(a, 0, archive_read_next_header(a, &ae)); + if (!assertEqualIntA(a, 0, archive_read_next_header(a, &ae))) { + assert(0 == archive_read_finish(a)); + return; + } failure("Name mismatch in archive %s", name); assertEqualString(ac->filename, archive_entry_pathname(ae)); From owner-svn-src-head@FreeBSD.ORG Sat Dec 6 05:59:47 2008 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 01D9F106564A; Sat, 6 Dec 2008 05:59:47 +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 E4FBD8FC08; Sat, 6 Dec 2008 05:59: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 mB65xkJ1084521; Sat, 6 Dec 2008 05:59:46 GMT (envelope-from kientzle@svn.freebsd.org) Received: (from kientzle@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mB65xkPc084520; Sat, 6 Dec 2008 05:59:46 GMT (envelope-from kientzle@svn.freebsd.org) Message-Id: <200812060559.mB65xkPc084520@svn.freebsd.org> From: Tim Kientzle Date: Sat, 6 Dec 2008 05:59: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: r185669 - 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, 06 Dec 2008 05:59:47 -0000 Author: kientzle Date: Sat Dec 6 05:59:46 2008 New Revision: 185669 URL: http://svn.freebsd.org/changeset/base/185669 Log: Better reporting of test failures. 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 Dec 6 05:58:24 2008 (r185668) +++ head/lib/libarchive/test/test_read_pax_truncated.c Sat Dec 6 05:59:46 2008 (r185669) @@ -98,9 +98,13 @@ DEFINE_TEST(test_read_pax_truncated) * does not return an error if it can't consume * it.) */ if (i < 1536 + 512*((filedata_size + 511)/512) + 512) { - assertA(ARCHIVE_FATAL == archive_read_next_header(a, &ae)); + failure("i=%d minsize=%d", i, + 1536 + 512*((filedata_size + 511)/512) + 512); + assertEqualIntA(a, ARCHIVE_FATAL, + archive_read_next_header(a, &ae)); } else { - assertA(ARCHIVE_EOF == archive_read_next_header(a, &ae)); + assertEqualIntA(a, ARCHIVE_EOF, + archive_read_next_header(a, &ae)); } wrap_up: assert(0 == archive_read_close(a)); @@ -141,9 +145,11 @@ DEFINE_TEST(test_read_pax_truncated) * does not return an error if it can't consume * it.) */ if (i < 1536 + 512*((filedata_size + 511)/512) + 512) { - assertA(ARCHIVE_FATAL == archive_read_next_header(a, &ae)); + assertEqualIntA(a, ARCHIVE_FATAL, + archive_read_next_header(a, &ae)); } else { - assertA(ARCHIVE_EOF == archive_read_next_header(a, &ae)); + assertEqualIntA(a, ARCHIVE_EOF, + archive_read_next_header(a, &ae)); } wrap_up2: assert(0 == archive_read_close(a)); From owner-svn-src-head@FreeBSD.ORG Sat Dec 6 06:00:52 2008 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C549D1065673; Sat, 6 Dec 2008 06:00: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 B48AC8FC17; Sat, 6 Dec 2008 06:00: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 mB660q97084606; Sat, 6 Dec 2008 06:00:52 GMT (envelope-from kientzle@svn.freebsd.org) Received: (from kientzle@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mB660qUW084605; Sat, 6 Dec 2008 06:00:52 GMT (envelope-from kientzle@svn.freebsd.org) Message-Id: <200812060600.mB660qUW084605@svn.freebsd.org> From: Tim Kientzle Date: Sat, 6 Dec 2008 06:00: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: r185670 - 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, 06 Dec 2008 06:00:52 -0000 Author: kientzle Date: Sat Dec 6 06:00:52 2008 New Revision: 185670 URL: http://svn.freebsd.org/changeset/base/185670 Log: Style improvements. Modified: head/lib/libarchive/test/test_read_format_cpio_bin_bz2.c Modified: head/lib/libarchive/test/test_read_format_cpio_bin_bz2.c ============================================================================== --- head/lib/libarchive/test/test_read_format_cpio_bin_bz2.c Sat Dec 6 05:59:46 2008 (r185669) +++ head/lib/libarchive/test/test_read_format_cpio_bin_bz2.c Sat Dec 6 06:00:52 2008 (r185670) @@ -37,10 +37,12 @@ DEFINE_TEST(test_read_format_cpio_bin_bz 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)); + 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)); assert(archive_compression(a) == ARCHIVE_COMPRESSION_BZIP2); assert(archive_format(a) == ARCHIVE_FORMAT_CPIO_BIN_LE); assert(0 == archive_read_close(a)); From owner-svn-src-head@FreeBSD.ORG Sat Dec 6 06:01:50 2008 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B0D7B1065670; Sat, 6 Dec 2008 06:01: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 9FC628FC12; Sat, 6 Dec 2008 06:01: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 mB661oV7084659; Sat, 6 Dec 2008 06:01:50 GMT (envelope-from kientzle@svn.freebsd.org) Received: (from kientzle@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mB661ogY084658; Sat, 6 Dec 2008 06:01:50 GMT (envelope-from kientzle@svn.freebsd.org) Message-Id: <200812060601.mB661ogY084658@svn.freebsd.org> From: Tim Kientzle Date: Sat, 6 Dec 2008 06:01: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: r185671 - 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, 06 Dec 2008 06:01:50 -0000 Author: kientzle Date: Sat Dec 6 06:01:50 2008 New Revision: 185671 URL: http://svn.freebsd.org/changeset/base/185671 Log: Style: skipping() function correctly counts this as a skipped test. Modified: head/lib/libarchive/test/test_write_disk_perms.c Modified: head/lib/libarchive/test/test_write_disk_perms.c ============================================================================== --- head/lib/libarchive/test/test_write_disk_perms.c Sat Dec 6 06:00:52 2008 (r185670) +++ head/lib/libarchive/test/test_write_disk_perms.c Sat Dec 6 06:01:50 2008 (r185671) @@ -272,7 +272,7 @@ DEFINE_TEST(test_write_disk_perms) * Current user must belong to at least two groups or * else we can't test setting the GID to another group. */ - printf("Current user can't test gid restore: must belong to more than one group.\n"); + skipping("Current user can't test gid restore: must belong to more than one group."); } else { /* * Write a regular file with ARCHIVE_EXTRACT_PERM & SGID bit From owner-svn-src-head@FreeBSD.ORG Sat Dec 6 06:02:27 2008 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 344A01065676; Sat, 6 Dec 2008 06:02: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 2352D8FC1F; Sat, 6 Dec 2008 06:02: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 mB662RBW084708; Sat, 6 Dec 2008 06:02:27 GMT (envelope-from kientzle@svn.freebsd.org) Received: (from kientzle@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mB662RoX084707; Sat, 6 Dec 2008 06:02:27 GMT (envelope-from kientzle@svn.freebsd.org) Message-Id: <200812060602.mB662RoX084707@svn.freebsd.org> From: Tim Kientzle Date: Sat, 6 Dec 2008 06:02: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: r185672 - 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, 06 Dec 2008 06:02:27 -0000 Author: kientzle Date: Sat Dec 6 06:02:26 2008 New Revision: 185672 URL: http://svn.freebsd.org/changeset/base/185672 Log: Recover after test failure. Modified: head/lib/libarchive/test/test_write_format_cpio.c Modified: head/lib/libarchive/test/test_write_format_cpio.c ============================================================================== --- head/lib/libarchive/test/test_write_format_cpio.c Sat Dec 6 06:01:50 2008 (r185671) +++ head/lib/libarchive/test/test_write_format_cpio.c Sat Dec 6 06:02:26 2008 (r185672) @@ -134,7 +134,10 @@ test_format(int (*set_format)(struct arc assertA(0 == archive_read_support_compression_all(a)); assertA(0 == archive_read_open_memory(a, buff, used)); - assertEqualIntA(a, 0, archive_read_next_header(a, &ae)); + if (!assertEqualIntA(a, 0, archive_read_next_header(a, &ae))) { + archive_read_finish(a); + return; + } assertEqualInt(1, archive_entry_mtime(ae)); /* Not the same as above: cpio doesn't store hi-res times. */ From owner-svn-src-head@FreeBSD.ORG Sat Dec 6 06:12:25 2008 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0E17E106564A; Sat, 6 Dec 2008 06:12: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 F0DD88FC12; Sat, 6 Dec 2008 06:12:24 +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 mB66COYo084956; Sat, 6 Dec 2008 06:12:24 GMT (envelope-from kientzle@svn.freebsd.org) Received: (from kientzle@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mB66COVb084955; Sat, 6 Dec 2008 06:12:24 GMT (envelope-from kientzle@svn.freebsd.org) Message-Id: <200812060612.mB66COVb084955@svn.freebsd.org> From: Tim Kientzle Date: Sat, 6 Dec 2008 06:12: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: r185674 - 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, 06 Dec 2008 06:12:25 -0000 Author: kientzle Date: Sat Dec 6 06:12:24 2008 New Revision: 185674 URL: http://svn.freebsd.org/changeset/base/185674 Log: A couple of portability fixes from Joerg Sonnenberger Modified: head/lib/libarchive/archive_endian.h Modified: head/lib/libarchive/archive_endian.h ============================================================================== --- head/lib/libarchive/archive_endian.h Sat Dec 6 06:08:12 2008 (r185673) +++ head/lib/libarchive/archive_endian.h Sat Dec 6 06:12:24 2008 (r185674) @@ -35,14 +35,14 @@ #define ARCHIVE_ENDIAN_H_INCLUDED -/* Watcom C++ doesn't support 'inline' in C code. (For any version?) */ -#if defined( __WATCOMC__ ) - #define inline -#endif - -/* Visual C++ 6.0 doesn't support 'inline' in C code. (Does VC7? VC8?) */ -#if defined(_MSC_VER) - #define inline +/* + * Disabling inline keyword for compilers known to choke on it: + * - Watcom C++ in C code. (For any version?) + * - SGI MIPSpro + * - Microsoft Visual C++ 6.0 (supposedly newer versions too) + */ +#if defined(__WATCOMC__) || defined(__sgi) || defined(_MSC_VER) +#define inline #endif /* Alignment-agnostic encode/decode bytestream to/from little/big endian. */ From owner-svn-src-head@FreeBSD.ORG Sat Dec 6 06:17:18 2008 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9234F1065673; Sat, 6 Dec 2008 06:17:18 +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 7FFA68FC14; Sat, 6 Dec 2008 06:17:18 +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 mB66HIVw085075; Sat, 6 Dec 2008 06:17:18 GMT (envelope-from kientzle@svn.freebsd.org) Received: (from kientzle@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mB66HIY1085074; Sat, 6 Dec 2008 06:17:18 GMT (envelope-from kientzle@svn.freebsd.org) Message-Id: <200812060617.mB66HIY1085074@svn.freebsd.org> From: Tim Kientzle Date: Sat, 6 Dec 2008 06:17: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: r185675 - 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, 06 Dec 2008 06:17:18 -0000 Author: kientzle Date: Sat Dec 6 06:17:18 2008 New Revision: 185675 URL: http://svn.freebsd.org/changeset/base/185675 Log: Style fixes: * Wrap long declarations to fit 80 chars * #undef macros that shouldn't be exported * Organize the version-dependent conditionals a bit more consistently Speculative: * libarchive 3.0 will (eventually) use int64_t instead of off_t. This is an attempt to avoid some the headaches caused by Linux LFS. (I'll still have to do ugly things for the struct stat references in archive_entry.h, of course.) Modified: head/lib/libarchive/archive.h Modified: head/lib/libarchive/archive.h ============================================================================== --- head/lib/libarchive/archive.h Sat Dec 6 06:12:24 2008 (r185674) +++ head/lib/libarchive/archive.h Sat Dec 6 06:17:18 2008 (r185675) @@ -82,7 +82,6 @@ # define __LA_DECL #endif - #ifdef __cplusplus extern "C" { #endif @@ -114,13 +113,13 @@ extern "C" { * (ARCHIVE_API_VERSION * 1000000 + ARCHIVE_API_FEATURE * 1000) * #endif */ -#define ARCHIVE_VERSION_NUMBER 2005005 +#define ARCHIVE_VERSION_NUMBER 2005903 __LA_DECL int archive_version_number(void); /* * Textual name/version of the library, useful for version displays. */ -#define ARCHIVE_VERSION_STRING "libarchive 2.5.5" +#define ARCHIVE_VERSION_STRING "libarchive 2.5.903a" __LA_DECL const char * archive_version_string(void); #if ARCHIVE_VERSION_NUMBER < 3000000 @@ -185,20 +184,37 @@ struct archive_entry; */ /* Returns pointer and size of next block of data from archive. */ -typedef __LA_SSIZE_T archive_read_callback(struct archive *, void *_client_data, - const void **_buffer); +typedef __LA_SSIZE_T archive_read_callback(struct archive *, + void *_client_data, const void **_buffer); + /* Skips at most request bytes from archive and returns the skipped amount */ #if ARCHIVE_VERSION_NUMBER < 2000000 -typedef __LA_SSIZE_T archive_skip_callback(struct archive *, void *_client_data, - size_t request); +/* Libarchive 1.0 used ssize_t for the return, which is only 32 bits + * on most 32-bit platforms; not large enough. */ +typedef __LA_SSIZE_T archive_skip_callback(struct archive *, + void *_client_data, size_t request); +#elif ARCHIVE_VERSION_NUMBER < 3000000 +/* Libarchive 2.0 used off_t here, but that is a bad idea on Linux and a + * few other platforms where off_t varies with build settings. */ +typedef off_t archive_skip_callback(struct archive *, + void *_client_data, off_t request); #else -typedef off_t archive_skip_callback(struct archive *, void *_client_data, - off_t request); +/* Libarchive 3.0 uses int64_t here, which is actually guaranteed to be + * 64 bits on every platform. */ +typedef __LA_INT64_T archive_skip_callback(struct archive *, + void *_client_data, __LA_INT64_T request); #endif + /* Returns size actually written, zero on EOF, -1 on error. */ -typedef __LA_SSIZE_T archive_write_callback(struct archive *, void *_client_data, - const void *_buffer, size_t _length); +typedef __LA_SSIZE_T archive_write_callback(struct archive *, + void *_client_data, + const void *_buffer, size_t _length); + +#if ARCHIVE_VERSION_NUMBER < 3000000 +/* Open callback is actually never needed; remove it in libarchive 3.0. */ typedef int archive_open_callback(struct archive *, void *_client_data); +#endif + typedef int archive_close_callback(struct archive *, void *_client_data); /* @@ -209,6 +225,7 @@ typedef int archive_close_callback(struc #define ARCHIVE_COMPRESSION_BZIP2 2 #define ARCHIVE_COMPRESSION_COMPRESS 3 #define ARCHIVE_COMPRESSION_PROGRAM 4 +#define ARCHIVE_COMPRESSION_LZMA 5 /* * Codes returned by archive_format. @@ -333,15 +350,23 @@ __LA_DECL int archive_read_next_header __LA_DECL __LA_INT64_T archive_read_header_position(struct archive *); /* Read data from the body of an entry. Similar to read(2). */ -__LA_DECL __LA_SSIZE_T archive_read_data(struct archive *, void *, size_t); +__LA_DECL __LA_SSIZE_T archive_read_data(struct archive *, + void *, size_t); + /* * A zero-copy version of archive_read_data that also exposes the file offset * of each returned block. Note that the client has no way to specify * the desired size of the block. The API does guarantee that offsets will * be strictly increasing and that returned blocks will not overlap. */ +#if ARCHIVE_VERSION_NUMBER < 3000000 +__LA_DECL int archive_read_data_block(struct archive *a, + const void **buff, size_t *size, off_t *offset); +#else __LA_DECL int archive_read_data_block(struct archive *a, - const void **buff, size_t *size, off_t *offset); + const void **buff, size_t *size, + __LA_INT64_T *offset); +#endif /*- * Some convenience functions that are built on archive_read_data: @@ -350,8 +375,8 @@ __LA_DECL int archive_read_data_block( * 'into_fd': writes data to specified filedes */ __LA_DECL int archive_read_data_skip(struct archive *); -__LA_DECL int archive_read_data_into_buffer(struct archive *, void *buffer, - __LA_SSIZE_T len); +__LA_DECL int archive_read_data_into_buffer(struct archive *, + void *buffer, __LA_SSIZE_T len); __LA_DECL int archive_read_data_into_fd(struct archive *, int fd); /*- @@ -414,12 +439,11 @@ __LA_DECL void archive_read_extract_set __LA_DECL int archive_read_close(struct archive *); /* Release all resources and destroy the object. */ /* Note that archive_read_finish will call archive_read_close for you. */ -#if ARCHIVE_VERSION_NUMBER >= 2000000 -__LA_DECL int archive_read_finish(struct archive *); -#else -/* Temporarily allow library to compile with either 1.x or 2.0 API. */ +#if ARCHIVE_VERSION_NUMBER < 2000000 /* Erroneously declared to return void in libarchive 1.x */ __LA_DECL void archive_read_finish(struct archive *); +#else +__LA_DECL int archive_read_finish(struct archive *); #endif /*- @@ -491,22 +515,36 @@ __LA_DECL int archive_write_open_memor */ __LA_DECL int archive_write_header(struct archive *, struct archive_entry *); -#if ARCHIVE_VERSION_NUMBER >= 2000000 -__LA_DECL __LA_SSIZE_T archive_write_data(struct archive *, const void *, size_t); -#else -/* Temporarily allow library to compile with either 1.x or 2.0 API. */ +#if ARCHIVE_VERSION_NUMBER < 2000000 /* This was erroneously declared to return "int" in libarchive 1.x. */ -__LA_DECL int archive_write_data(struct archive *, const void *, size_t); +__LA_DECL int archive_write_data(struct archive *, + const void *, size_t); +#else +/* Libarchive 2.0 and later return ssize_t here. */ +__LA_DECL __LA_SSIZE_T archive_write_data(struct archive *, + const void *, size_t); +#endif + +#if ARCHIVE_VERSION_NUMBER < 3000000 +/* Libarchive 1.x and 2.x use off_t for the argument, but that's not + * stable on Linux. */ +__LA_DECL __LA_SSIZE_T archive_write_data_block(struct archive *, + const void *, size_t, off_t); +#else +/* Libarchive 3.0 uses explicit int64_t to ensure consistent 64-bit support. */ +__LA_DECL __LA_SSIZE_T archive_write_data_block(struct archive *, + const void *, size_t, __LA_INT64_T); #endif -__LA_DECL __LA_SSIZE_T archive_write_data_block(struct archive *, const void *, size_t, off_t); __LA_DECL int archive_write_finish_entry(struct archive *); __LA_DECL int archive_write_close(struct archive *); -#if ARCHIVE_VERSION_NUMBER >= 2000000 -__LA_DECL int archive_write_finish(struct archive *); -#else -/* Temporarily allow library to compile with either 1.x or 2.0 API. */ +#if ARCHIVE_VERSION_NUMBER < 2000000 /* Return value was incorrect in libarchive 1.x. */ __LA_DECL void archive_write_finish(struct archive *); +#else +/* Libarchive 2.x and later returns an error if this fails. */ +/* It can fail if the archive wasn't already closed, in which case + * archive_write_finish() will implicitly call archive_write_close(). */ +__LA_DECL int archive_write_finish(struct archive *); #endif /*- @@ -589,5 +627,9 @@ __LA_DECL void archive_copy_error(stru /* This is meaningless outside of this header. */ #undef __LA_DECL +#undef __LA_GID_T +#undef __LA_INT64_T +#undef __LA_SSIZE_T +#undef __LA_UID_T #endif /* !ARCHIVE_H_INCLUDED */ From owner-svn-src-head@FreeBSD.ORG Sat Dec 6 06:18:46 2008 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DCB5C1065675; Sat, 6 Dec 2008 06:18: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 CC03B8FC16; Sat, 6 Dec 2008 06:18: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 mB66IkFO085203; Sat, 6 Dec 2008 06:18:46 GMT (envelope-from kientzle@svn.freebsd.org) Received: (from kientzle@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mB66IkaG085202; Sat, 6 Dec 2008 06:18:46 GMT (envelope-from kientzle@svn.freebsd.org) Message-Id: <200812060618.mB66IkaG085202@svn.freebsd.org> From: Tim Kientzle Date: Sat, 6 Dec 2008 06:18: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: r185676 - 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, 06 Dec 2008 06:18:47 -0000 Author: kientzle Date: Sat Dec 6 06:18:46 2008 New Revision: 185676 URL: http://svn.freebsd.org/changeset/base/185676 Log: Structure declarations can't be dllexported. Modified: head/lib/libarchive/archive_entry.h Modified: head/lib/libarchive/archive_entry.h ============================================================================== --- head/lib/libarchive/archive_entry.h Sat Dec 6 06:17:18 2008 (r185675) +++ head/lib/libarchive/archive_entry.h Sat Dec 6 06:18:46 2008 (r185676) @@ -441,7 +441,7 @@ __LA_DECL int archive_entry_xattr_next(s * Note that archive_entry_size() is reset to zero if the file * body should not be written to the archive. Pay attention! */ -__LA_DECL struct archive_entry_linkresolver; +struct archive_entry_linkresolver; /* * There are three different strategies for marking hardlinks. From owner-svn-src-head@FreeBSD.ORG Sat Dec 6 06:20:21 2008 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6CCD4106564A; Sat, 6 Dec 2008 06:20:21 +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 5BB8B8FC08; Sat, 6 Dec 2008 06:20:21 +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 mB66KLwN085268; Sat, 6 Dec 2008 06:20:21 GMT (envelope-from kientzle@svn.freebsd.org) Received: (from kientzle@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mB66KLpp085267; Sat, 6 Dec 2008 06:20:21 GMT (envelope-from kientzle@svn.freebsd.org) Message-Id: <200812060620.mB66KLpp085267@svn.freebsd.org> From: Tim Kientzle Date: Sat, 6 Dec 2008 06:20: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: r185677 - 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, 06 Dec 2008 06:20:21 -0000 Author: kientzle Date: Sat Dec 6 06:20:21 2008 New Revision: 185677 URL: http://svn.freebsd.org/changeset/base/185677 Log: Use GCC-specific dead function markers only when using GCC. Modified: head/lib/libarchive/archive_private.h Modified: head/lib/libarchive/archive_private.h ============================================================================== --- head/lib/libarchive/archive_private.h Sat Dec 6 06:18:46 2008 (r185676) +++ head/lib/libarchive/archive_private.h Sat Dec 6 06:20:21 2008 (r185677) @@ -31,6 +31,13 @@ #include "archive.h" #include "archive_string.h" +#if defined(__GNUC__) && (__GNUC__ > 2 || \ + (__GNUC__ == 2 && __GNUC_MINOR__ >= 5)) +#define __LA_DEAD __attribute__((__noreturn__)) +#else +#define __LA_DEAD +#endif + #define ARCHIVE_WRITE_MAGIC (0xb0c5c0deU) #define ARCHIVE_READ_MAGIC (0xdeb0c5U) #define ARCHIVE_WRITE_DISK_MAGIC (0xc001b0c5U) @@ -92,7 +99,7 @@ struct archive { void __archive_check_magic(struct archive *, unsigned int magic, unsigned int state, const char *func); -void __archive_errx(int retvalue, const char *msg) __dead2; +void __archive_errx(int retvalue, const char *msg) __LA_DEAD; #define err_combine(a,b) ((a) < (b) ? (a) : (b)) From owner-svn-src-head@FreeBSD.ORG Sat Dec 6 06:23:37 2008 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B6C101065672; Sat, 6 Dec 2008 06:23: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 A55A88FC0C; Sat, 6 Dec 2008 06:23: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 mB66NbF3085370; Sat, 6 Dec 2008 06:23:37 GMT (envelope-from kientzle@svn.freebsd.org) Received: (from kientzle@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mB66Nb3C085369; Sat, 6 Dec 2008 06:23:37 GMT (envelope-from kientzle@svn.freebsd.org) Message-Id: <200812060623.mB66Nb3C085369@svn.freebsd.org> From: Tim Kientzle Date: Sat, 6 Dec 2008 06:23: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: r185678 - 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, 06 Dec 2008 06:23:37 -0000 Author: kientzle Date: Sat Dec 6 06:23:37 2008 New Revision: 185678 URL: http://svn.freebsd.org/changeset/base/185678 Log: Style: tabs after #define Modified: head/lib/libarchive/archive_private.h Modified: head/lib/libarchive/archive_private.h ============================================================================== --- head/lib/libarchive/archive_private.h Sat Dec 6 06:20:21 2008 (r185677) +++ head/lib/libarchive/archive_private.h Sat Dec 6 06:23:37 2008 (r185678) @@ -40,13 +40,13 @@ #define ARCHIVE_WRITE_MAGIC (0xb0c5c0deU) #define ARCHIVE_READ_MAGIC (0xdeb0c5U) -#define ARCHIVE_WRITE_DISK_MAGIC (0xc001b0c5U) +#define ARCHIVE_WRITE_DISK_MAGIC (0xc001b0c5U) #define ARCHIVE_STATE_ANY 0xFFFFU #define ARCHIVE_STATE_NEW 1U #define ARCHIVE_STATE_HEADER 2U #define ARCHIVE_STATE_DATA 4U -#define ARCHIVE_STATE_DATA_END 8U +#define ARCHIVE_STATE_DATA_END 8U #define ARCHIVE_STATE_EOF 0x10U #define ARCHIVE_STATE_CLOSED 0x20U #define ARCHIVE_STATE_FATAL 0x8000U From owner-svn-src-head@FreeBSD.ORG Sat Dec 6 06:45:15 2008 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D5C161065670; Sat, 6 Dec 2008 06:45: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 C2A6B8FC1C; Sat, 6 Dec 2008 06:45: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 mB66jFwh085841; Sat, 6 Dec 2008 06:45:15 GMT (envelope-from kientzle@svn.freebsd.org) Received: (from kientzle@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mB66jFQ7085836; Sat, 6 Dec 2008 06:45:15 GMT (envelope-from kientzle@svn.freebsd.org) Message-Id: <200812060645.mB66jFQ7085836@svn.freebsd.org> From: Tim Kientzle Date: Sat, 6 Dec 2008 06:45: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: r185679 - 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, 06 Dec 2008 06:45:16 -0000 Author: kientzle Date: Sat Dec 6 06:45:15 2008 New Revision: 185679 URL: http://svn.freebsd.org/changeset/base/185679 Log: MfP4: Big read filter refactoring. This is an attempt to eliminate a lot of redundant code from the read ("decompression") filters by changing them to juggle arbitrary-sized blocks and consolidate reblocking code at a single point in archive_read.c. Along the way, I've changed the internal read/consume API used by the format handlers to a slightly different style originally suggested by des@. It does seem to simplify a lot of common cases. The most dramatic change is, of course, to archive_read_support_compression_none(), which has just evaporated into a no-op as the blocking code this used to hold has all been moved up a level. There's at least one more big round of refactoring yet to come before the individual filters are as straightforward as I think they should be... Modified: head/lib/libarchive/archive_read.c head/lib/libarchive/archive_read_private.h head/lib/libarchive/archive_read_support_compression_all.c 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_none.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 Modified: head/lib/libarchive/archive_read.c ============================================================================== --- head/lib/libarchive/archive_read.c Sat Dec 6 06:23:37 2008 (r185678) +++ head/lib/libarchive/archive_read.c Sat Dec 6 06:45:15 2008 (r185679) @@ -53,9 +53,10 @@ __FBSDID("$FreeBSD$"); #include "archive_private.h" #include "archive_read_private.h" -static void choose_decompressor(struct archive_read *, const void*, size_t); +#define minimum(a, b) (a < b ? a : b) + +static int build_stream(struct archive_read *); static int choose_format(struct archive_read *); -static off_t dummy_skip(struct archive_read *, off_t); /* * Allocate, initialize and return a struct archive object. @@ -74,8 +75,15 @@ archive_read_new(void) a->archive.state = ARCHIVE_STATE_NEW; a->entry = archive_entry_new(); - /* We always support uncompressed archives. */ - archive_read_support_compression_none(&a->archive); + /* 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); } @@ -108,6 +116,33 @@ archive_read_open(struct archive *a, voi client_reader, NULL, client_closer); } +static ssize_t +client_read_proxy(struct archive_read_source *self, const void **buff) +{ + return (self->archive->client.reader)((struct archive *)self->archive, + self->data, buff); +} + +static int64_t +client_skip_proxy(struct archive_read_source *self, int64_t request) +{ + return (self->archive->client.skipper)((struct archive *)self->archive, + self->data, request); +} + +static int +client_close_proxy(struct archive_read_source *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); +} + + int archive_read_open2(struct archive *_a, void *client_data, archive_open_callback *client_opener, @@ -116,28 +151,15 @@ archive_read_open2(struct archive *_a, v archive_close_callback *client_closer) { struct archive_read *a = (struct archive_read *)_a; - const void *buffer; - ssize_t bytes_read; int e; - __archive_check_magic(_a, ARCHIVE_READ_MAGIC, ARCHIVE_STATE_NEW, "archive_read_open"); + __archive_check_magic(_a, ARCHIVE_READ_MAGIC, ARCHIVE_STATE_NEW, + "archive_read_open"); if (client_reader == NULL) __archive_errx(1, "No reader function provided to archive_read_open"); - /* - * Set these NULL initially. If the open or initial read fails, - * we'll leave them NULL to indicate that the file is invalid. - * (In particular, this helps ensure that the closer doesn't - * get called more than once.) - */ - a->client_opener = NULL; - a->client_reader = NULL; - a->client_skipper = NULL; - a->client_closer = NULL; - a->client_data = NULL; - /* Open data source. */ if (client_opener != NULL) { e =(client_opener)(&a->archive, client_data); @@ -149,129 +171,103 @@ archive_read_open2(struct archive *_a, v } } - /* Read first block now for compress format detection. */ - bytes_read = (client_reader)(&a->archive, client_data, &buffer); - - if (bytes_read < 0) { - /* If the first read fails, close before returning error. */ - if (client_closer) - (client_closer)(&a->archive, client_data); - /* client_reader should have already set error information. */ - return (ARCHIVE_FATAL); - } + /* 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; - /* Now that the client callbacks have worked, remember them. */ - 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; - - /* Select a decompression routine. */ - choose_decompressor(a, buffer, (size_t)bytes_read); - if (a->decompressor == NULL) - return (ARCHIVE_FATAL); + { + struct archive_read_source *source; - /* Initialize decompression routine with the first block of data. */ - e = (a->decompressor->init)(a, buffer, (size_t)bytes_read); + 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; + } + + /* 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) a->archive.state = ARCHIVE_STATE_HEADER; - /* - * If the decompressor didn't register a skip function, provide a - * dummy compression-layer skip function. - */ - if (a->decompressor->skip == NULL) - a->decompressor->skip = dummy_skip; - return (e); } /* - * Allow each registered decompression routine to bid on whether it - * wants to handle this stream. Return index of winning bidder. + * Allow each registered stream transform to bid on whether + * it wants to handle this stream. Repeat until we've finished + * building the pipeline. */ -static void -choose_decompressor(struct archive_read *a, - const void *buffer, size_t bytes_read) +static int +build_stream(struct archive_read *a) { - int decompression_slots, i, bid, best_bid; - struct decompressor_t *decompressor, *best_decompressor; + 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; - decompression_slots = sizeof(a->decompressors) / - sizeof(a->decompressors[0]); + /* 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); + } + + number_readers = sizeof(a->readers) / sizeof(a->readers[0]); best_bid = 0; - a->decompressor = NULL; - best_decompressor = NULL; + best_reader = NULL; - decompressor = a->decompressors; - for (i = 0; i < decompression_slots; i++) { - if (decompressor->bid) { - bid = (decompressor->bid)(buffer, bytes_read); - if (bid > best_bid || best_decompressor == 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_decompressor = decompressor; + best_reader = reader; } } - decompressor ++; } /* - * There were no bidders; this is a serious programmer error - * and demands a quick and definitive abort. - */ - if (best_decompressor == NULL) - __archive_errx(1, "No decompressors were registered; you " - "must call at least one " - "archive_read_support_compression_XXX function in order " - "to successfully read an archive."); - - /* - * There were bidders, but no non-zero bids; this means we can't - * support this stream. + * If we have a winner, it becomes the next stage in the pipeline. */ - if (best_bid < 1) { - archive_set_error(&a->archive, ARCHIVE_ERRNO_FILE_FORMAT, - "Unrecognized archive format"); - return; - } - - /* Record the best decompressor for this stream. */ - a->decompressor = best_decompressor; -} - -/* - * Dummy skip function, for use if the compression layer doesn't provide - * one: This code just reads data and discards it. - */ -static off_t -dummy_skip(struct archive_read * a, off_t request) -{ - const void * dummy_buffer; - ssize_t bytes_read; - off_t bytes_skipped; - - for (bytes_skipped = 0; request > 0;) { - bytes_read = (a->decompressor->read_ahead)(a, &dummy_buffer, 1); - if (bytes_read < 0) - return (bytes_read); - if (bytes_read == 0) { - /* Premature EOF. */ - archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC, - "Truncated input file (need to skip %jd bytes)", - (intmax_t)request); + if (best_reader != NULL) { + source = (best_reader->init)(a, best_reader, a->source, + block, bytes_read); + if (source == NULL) return (ARCHIVE_FATAL); - } - if (bytes_read > request) - bytes_read = (ssize_t)request; - (a->decompressor->consume)(a, (size_t)bytes_read); - request -= bytes_read; - bytes_skipped += bytes_read; + /* Record the best decompressor for this stream. */ + a->source = source; + /* Recurse to get next pipeline stage. */ + return (build_stream(a)); } - return (bytes_skipped); + /* 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); } /* @@ -598,23 +594,24 @@ archive_read_close(struct archive *_a) /* TODO: Clean up the formatters. */ - /* Clean up the decompressors. */ - n = sizeof(a->decompressors)/sizeof(a->decompressors[0]); + /* Clean up the stream pipeline. */ + if (a->source != NULL) { + r1 = (a->source->close)(a->source); + if (r1 < r) + r = r1; + a->source = NULL; + } + + /* Release the reader objects. */ + n = sizeof(a->readers)/sizeof(a->readers[0]); for (i = 0; i < n; i++) { - if (a->decompressors[i].finish != NULL) { - r1 = (a->decompressors[i].finish)(a); + if (a->readers[i].free != NULL) { + r1 = (a->readers[i].free)(&a->readers[i]); if (r1 < r) r = r1; } } - /* Close the client stream. */ - if (a->client_closer != NULL) { - r1 = ((a->client_closer)(&a->archive, a->client_data)); - if (r1 < r) - r = r1; - } - return (r); } @@ -651,6 +648,7 @@ 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); @@ -700,40 +698,350 @@ __archive_read_register_format(struct ar * Used internally by decompression routines to register their bid and * initialization functions. */ -struct decompressor_t * -__archive_read_register_compression(struct archive_read *a, - int (*bid)(const void *, size_t), - int (*init)(struct archive_read *, const void *, size_t)) +struct archive_reader * +__archive_read_get_reader(struct archive_read *a) { int i, number_slots; __archive_check_magic(&a->archive, ARCHIVE_READ_MAGIC, ARCHIVE_STATE_NEW, - "__archive_read_register_compression"); + "__archive_read_get_reader"); - number_slots = sizeof(a->decompressors) / sizeof(a->decompressors[0]); + number_slots = sizeof(a->readers) / sizeof(a->readers[0]); for (i = 0; i < number_slots; i++) { - if (a->decompressors[i].bid == bid) - return (a->decompressors + i); - if (a->decompressors[i].bid == NULL) { - a->decompressors[i].bid = bid; - a->decompressors[i].init = init; - return (a->decompressors + i); - } + if (a->readers[i].bid == NULL) + return (a->readers + i); } __archive_errx(1, "Not enough slots for compression registration"); return (NULL); /* Never actually executed. */ } -/* used internally to simplify read-ahead */ +/* + * The next three functions comprise the peek/consume internal I/O + * system used by archive format readers. This system allows fairly + * 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 + * 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 + * layer use a copy buffer to provide you with a contiguous block of + * data. The __archive_read_skip() is an optimization; it scans ahead + * very quickly (it usually translates into a seek() operation if + * you're reading uncompressed disk files). + * + * A couple of useful idioms: + * * "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 + * 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, + * emit all that's available (up to whatever limit you have), then + * repeat until you're done. + * * "I want to peek ahead by a large amount." Ask for 4k or so, then + * double and repeat until you get an error or have enough. Note + * that the I/O layer will likely end up expanding its copy buffer + * to fit your request, so use this technique cautiously. This + * technique is used, for example, by some of the format tasting + * code that has uncertain look-ahead needs. + * + * TODO: Someday, provide a more generic __archive_read_seek() for + * those cases where it's useful. This is tricky because there are lots + * of cases where seek() is not available (reading gzip data from a + * network socket, for instance), so there needs to be a good way to + * communicate whether seek() is available and users of that interface + * need to use non-seeking strategies whenever seek() is not available. + */ + +/* + * Looks ahead in the input stream: + * * If 'avail' pointer is provided, that returns number of bytes available + * in the current buffer, which may be much larger than requested. + * * If end-of-file, *avail gets set to zero. + * * If error, *avail gets error code. + * * If request can be met, returns pointer to data, returns NULL + * if request is not met. + * + * Note: If you just want "some data", ask for 1 byte and pay attention + * to *avail, which will have the actual amount available. If you + * know exactly how many bytes you need, just ask for that and treat + * a NULL return as an error. + * + * Important: This does NOT move the file pointer. See + * __archive_read_consume() below. + */ + +/* + * This is tricky. We need to provide our clients with pointers to + * contiguous blocks of memory but we want to avoid copying whenever + * possible. + * + * Mostly, this code returns pointers directly into the block of data + * provided by the client_read routine. It can do this unless the + * request would split across blocks. In that case, we have to copy + * into an internal buffer to combine reads. + */ const void * -__archive_read_ahead(struct archive_read *a, size_t len) +__archive_read_ahead(struct archive_read *a, size_t min, ssize_t *avail) { - const void *h; + ssize_t bytes_read; + size_t tocopy; - if ((a->decompressor->read_ahead)(a, &h, len) < (ssize_t)len) + if (a->fatal) { + if (avail) + *avail = ARCHIVE_FATAL; return (NULL); - return (h); + } + + /* + * Keep pulling more data until we can satisfy the request. + */ + for (;;) { + + /* + * If we can satisfy from the copy buffer, we're done. + */ + if (a->avail >= min) { + if (avail != NULL) + *avail = a->avail; + return (a->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) { + /* "Roll back" to client buffer. */ + a->client_avail += a->avail; + a->client_next -= a->avail; + /* Copy buffer is now empty. */ + a->avail = 0; + a->next = a->buffer; + /* Return data from client buffer. */ + if (avail != NULL) + *avail = a->client_avail; + return (a->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 we've used up the client data, get more. */ + if (a->client_avail <= 0) { + if (a->end_of_file) { + if (avail != NULL) + *avail = 0; + return (NULL); + } + bytes_read = (a->source->read)(a->source, + &a->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; + 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; + /* Return whatever we do have. */ + if (avail != NULL) + *avail = a->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; + } + else + { + /* + * We can't satisfy the request from the copy + * buffer or the existing client data, so we + * need to copy more client data over to the + * copy buffer. + */ + + /* Ensure the buffer is big enough. */ + if (min > a->buffer_size) { + size_t s, t; + char *p; + + /* Double the buffer; watch for overflow. */ + s = t = a->buffer_size; + while (s < min) { + t *= 2; + if (t <= s) { /* Integer overflow! */ + archive_set_error(&a->archive, + ENOMEM, + "Unable to allocate copy buffer"); + a->fatal = 1; + if (avail != NULL) + *avail = ARCHIVE_FATAL; + return (NULL); + } + s = t; + } + /* Now s >= min, so allocate a new buffer. */ + p = (char *)malloc(s); + if (p == NULL) { + archive_set_error(&a->archive, ENOMEM, + "Unable to allocate copy buffer"); + a->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; + } + + /* 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); + /* Don't waste time buffering more than we need to. */ + if (tocopy + a->avail > min) + tocopy = min - a->avail; + /* Don't copy more than is available. */ + if (tocopy > a->client_avail) + tocopy = a->client_avail; + + memcpy(a->next + a->avail, a->client_next, + tocopy); + /* Remove this data from client buffer. */ + a->client_next += tocopy; + a->client_avail -= tocopy; + /* add it to copy buffer. */ + a->avail += tocopy; + } + } +} + +/* + * Move the file pointer forward. This should be called after + * __archive_read_ahead() returns data to you. Don't try to move + * ahead by more than the amount of data available according to + * __archive_read_ahead(). + */ +/* + * Mark the appropriate data as used. Note that the request here will + * often be much smaller than the size of the previous read_ahead + * request. + */ +ssize_t +__archive_read_consume(struct archive_read *a, size_t request) +{ + if (a->avail > 0) { + /* Read came from copy buffer. */ + a->next += request; + a->avail -= request; + } else { + /* Read came from client buffer. */ + a->client_next += request; + a->client_avail -= request; + } + a->archive.file_position += request; + return (request); +} + +/* + * Move the file pointer ahead by an arbitrary amount. If you're + * reading uncompressed data from a disk file, this will actually + * translate into a seek() operation. Even in cases where seek() + * isn't feasible, this at least pushes the read-and-discard loop + * down closer to the data source. + */ +int64_t +__archive_read_skip(struct archive_read *a, int64_t request) +{ + off_t bytes_skipped, total_bytes_skipped = 0; + size_t min; + + if (a->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); + 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); + request -= bytes_skipped; + total_bytes_skipped += bytes_skipped; + } + if (request == 0) + return (total_bytes_skipped); + /* + * If a client_skipper was provided, try that first. + */ +#if ARCHIVE_API_VERSION < 2 + if ((a->source->skip != NULL) && (request < SSIZE_MAX)) { +#else + if (a->source->skip != NULL) { +#endif + bytes_skipped = (a->source->skip)(a->source, request); + if (bytes_skipped < 0) { /* error */ + a->client_total = a->client_avail = 0; + a->client_next = a->client_buff = NULL; + a->fatal = 1; + return (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; + } + /* + * Note that client_skipper will usually not satisfy the + * full request (due to low-level blocking concerns), + * so even if client_skipper is provided, we may still + * have to use ordinary reads to finish out the request. + */ + while (request > 0) { + const void* dummy_buffer; + ssize_t bytes_read; + dummy_buffer = __archive_read_ahead(a, 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, + "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); + total_bytes_skipped += bytes_read; + request -= bytes_read; + } + return (total_bytes_skipped); } Modified: head/lib/libarchive/archive_read_private.h ============================================================================== --- head/lib/libarchive/archive_read_private.h Sat Dec 6 06:23:37 2008 (r185678) +++ head/lib/libarchive/archive_read_private.h Sat Dec 6 06:45:15 2008 (r185679) @@ -32,6 +32,75 @@ #include "archive_string.h" #include "archive_private.h" +struct archive_read; +struct archive_reader; +struct archive_read_source; + +/* + * 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: + * * 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. + */ +struct archive_reader { + /* Configuration data for the reader. */ + 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 *); +}; + +/* + * A "source" is an instance of a reader. This structure is + * allocated and initialized by the init() method of a reader + * above. + */ +struct archive_read_source { + /* Essentially all sources 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. */ + /* Return next block. */ + ssize_t (*read)(struct archive_read_source *, 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); + /* My private data. */ + void *data; +}; + +/* + * The client source is almost the same as an internal source. + * + * TODO: Make archive_read_source 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. + */ +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 { struct archive archive; @@ -50,46 +119,30 @@ struct archive_read { off_t read_data_output_offset; size_t read_data_remaining; - /* Callbacks to open/read/write/close archive stream. */ - archive_open_callback *client_opener; - archive_read_callback *client_reader; - archive_skip_callback *client_skipper; - archive_close_callback *client_closer; - void *client_data; + /* Callbacks to open/read/write/close client archive stream. */ + struct archive_read_client client; + + /* Registered readers. */ + struct archive_reader readers[8]; + + /* Source */ + struct archive_read_source *source; /* File offset of beginning of most recently-read header. */ off_t header_position; - /* - * Decompressors have a very specific lifecycle: - * public setup function initializes a slot in this table - * 'config' holds minimal configuration data - * bid() examines a block of data and returns a bid [1] - * init() is called for successful bidder - * 'data' is initialized by init() - * read() returns a pointer to the next block of data - * consume() indicates how much data is used - * skip() ignores bytes of data - * finish() cleans up and frees 'data' and 'config' - * - * [1] General guideline: bid the number of bits that you actually - * test, e.g., 16 if you test a 2-byte magic value. - */ - struct decompressor_t { - void *config; - void *data; - int (*bid)(const void *buff, size_t); - int (*init)(struct archive_read *, - const void *buff, size_t); - int (*finish)(struct archive_read *); - ssize_t (*read_ahead)(struct archive_read *, - const void **, size_t); - ssize_t (*consume)(struct archive_read *, size_t); - off_t (*skip)(struct archive_read *, off_t); - } decompressors[4]; - /* Pointer to current decompressor. */ - struct decompressor_t *decompressor; + /* 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 @@ -124,12 +177,13 @@ int __archive_read_register_format(struc int (*read_data_skip)(struct archive_read *), int (*cleanup)(struct archive_read *)); -struct decompressor_t - *__archive_read_register_compression(struct archive_read *a, - int (*bid)(const void *, size_t), - int (*init)(struct archive_read *, const void *, size_t)); +struct archive_reader + *__archive_read_get_reader(struct archive_read *a); const void - *__archive_read_ahead(struct archive_read *, size_t); - + *__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); #endif Modified: head/lib/libarchive/archive_read_support_compression_all.c ============================================================================== --- head/lib/libarchive/archive_read_support_compression_all.c Sat Dec 6 06:23:37 2008 (r185678) +++ head/lib/libarchive/archive_read_support_compression_all.c Sat Dec 6 06:45:15 2008 (r185679) @@ -39,5 +39,11 @@ archive_read_support_compression_all(str #if HAVE_ZLIB_H 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 + * may not be feasible to include LZMA detection here. */ + /* archive_read_support_compression_lzma(a); */ +#endif return (ARCHIVE_OK); } Modified: head/lib/libarchive/archive_read_support_compression_bzip2.c ============================================================================== --- head/lib/libarchive/archive_read_support_compression_bzip2.c Sat Dec 6 06:23:37 2008 (r185678) +++ head/lib/libarchive/archive_read_support_compression_bzip2.c Sat Dec 6 06:45:15 2008 (r185679) @@ -51,30 +51,49 @@ __FBSDID("$FreeBSD$"); #if HAVE_BZLIB_H struct private_data { bz_stream stream; - char *uncompressed_buffer; - size_t uncompressed_buffer_size; - char *read_next; - int64_t total_out; + char *out_block; + size_t out_block_size; + char valid; /* True = decompressor is initialized */ char eof; /* True = found end of compressed data. */ }; -static int finish(struct archive_read *); -static ssize_t read_ahead(struct archive_read *, const void **, size_t); -static ssize_t read_consume(struct archive_read *, size_t); -static int drive_decompressor(struct archive_read *a, struct private_data *); +/* Bzip2 source */ +static ssize_t bzip2_source_read(struct archive_read_source *, const void **); +static int bzip2_source_close(struct archive_read_source *); #endif -/* These two functions are defined even if we lack the library. See below. */ -static int bid(const void *, size_t); -static int init(struct archive_read *, const void *, size_t); +/* + * Note that we can detect bzip2 archives even if we can't decompress + * them. (In fact, we like detecting them because we can give better + * 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 *); int archive_read_support_compression_bzip2(struct archive *_a) { struct archive_read *a = (struct archive_read *)_a; - if (__archive_read_register_compression(a, bid, init) != NULL) - return (ARCHIVE_OK); - return (ARCHIVE_FATAL); + struct archive_reader *reader = __archive_read_get_reader(a); + + if (reader == NULL) + return (ARCHIVE_FATAL); + + reader->data = NULL; + reader->bid = bzip2_reader_bid; + reader->init = bzip2_reader_init; + reader->free = bzip2_reader_free; + return (ARCHIVE_OK); +} + +static int +bzip2_reader_free(struct archive_reader *self){ + (void)self; /* UNUSED */ + return (ARCHIVE_OK); } /* @@ -85,11 +104,13 @@ archive_read_support_compression_bzip2(s * from verifying as much as we would like. */ static int -bid(const void *buff, size_t len) +bzip2_reader_bid(struct archive_reader *self, const void *buff, size_t len) { const unsigned char *buffer; int bits_checked; + (void)self; /* UNUSED */ + if (len < 1) return (0); @@ -150,16 +171,19 @@ bid(const void *buff, size_t len) * decompression. We can, however, still detect compressed archives * and emit a useful message. */ -static int -init(struct archive_read *a, const void *buff, size_t n) +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) { (void)a; /* UNUSED */ + (void)reader; /* UNUSED */ + (void)upstream; /* UNUSED */ (void)buff; /* UNUSED */ (void)n; /* UNUSED */ archive_set_error(&a->archive, -1, "This version of libarchive was compiled without bzip2 support"); - return (ARCHIVE_FATAL); + return (NULL); } @@ -168,37 +192,42 @@ init(struct archive_read *a, const void /* * Setup the callbacks. */ -static int -init(struct archive_read *a, const void *buff, size_t n) *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@FreeBSD.ORG Sat Dec 6 06:50:09 2008 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E49BD1065673; Sat, 6 Dec 2008 06:50: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 D2FCE8FC0C; Sat, 6 Dec 2008 06:50: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 mB66o94j085968; Sat, 6 Dec 2008 06:50:09 GMT (envelope-from kientzle@svn.freebsd.org) Received: (from kientzle@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mB66o991085967; Sat, 6 Dec 2008 06:50:09 GMT (envelope-from kientzle@svn.freebsd.org) Message-Id: <200812060650.mB66o991085967@svn.freebsd.org> From: Tim Kientzle Date: Sat, 6 Dec 2008 06:50:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185680 - 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, 06 Dec 2008 06:50:10 -0000 Author: kientzle Date: Sat Dec 6 06:50:09 2008 New Revision: 185680 URL: http://svn.freebsd.org/changeset/base/185680 Log: Conditionalize a bunch of debugging messages; this also eliminates what should be the only remaining stdio dependency. 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 Sat Dec 6 06:45:15 2008 (r185679) +++ head/lib/libarchive/archive_read_support_format_iso9660.c Sat Dec 6 06:50:09 2008 (r185680) @@ -224,7 +224,9 @@ static int archive_read_format_iso9660_r static int archive_read_format_iso9660_read_header(struct archive_read *, struct archive_entry *); static const char *build_pathname(struct archive_string *, struct file_info *); +#ifdef DEBUG static void dump_isodirrec(FILE *, const unsigned char *isodirrec); +#endif static time_t time_from_tm(struct tm *); static time_t isodate17(const unsigned char *); static time_t isodate7(const unsigned char *); @@ -558,6 +560,7 @@ parse_file_info(struct iso9660 *iso9660, parse_rockridge(iso9660, file, rr_start, rr_end); } +#ifdef DEBUG /* DEBUGGING: Warn about attributes I don't yet fully support. */ if ((flags & ~0x02) != 0) { fprintf(stderr, "\n ** Unrecognized flag: "); @@ -580,6 +583,7 @@ parse_file_info(struct iso9660 *iso9660, dump_isodirrec(stderr, isodirrec); fprintf(stderr, "\n"); } +#endif return (file); } @@ -854,6 +858,7 @@ parse_rockridge(struct iso9660 *iso9660, default: /* The FALLTHROUGHs above leave us here for * any unsupported extension. */ +#ifdef DEBUG { const unsigned char *t; fprintf(stderr, "\nUnsupported RRIP extension for %s\n", file->name); @@ -862,6 +867,8 @@ parse_rockridge(struct iso9660 *iso9660, fprintf(stderr, " %02x", *t); fprintf(stderr, "\n"); } +#endif + break; } @@ -903,7 +910,7 @@ next_entry_seek(struct archive_read *a, /* CE area precedes actual file data? Ignore it. */ if (file->ce_offset > file->offset) { -fprintf(stderr, " *** Discarding CE data.\n"); + /* fprintf(stderr, " *** Discarding CE data.\n"); */ file->ce_offset = 0; file->ce_size = 0; } @@ -1078,6 +1085,7 @@ build_pathname(struct archive_string *as return (as->s); } +#ifdef DEBUG static void dump_isodirrec(FILE *out, const unsigned char *isodirrec) { @@ -1102,3 +1110,4 @@ dump_isodirrec(FILE *out, const unsigned fprintf(out, " `%.*s'", toi(isodirrec + DR_name_len_offset, DR_name_len_size), isodirrec + DR_name_offset); } +#endif From owner-svn-src-head@FreeBSD.ORG Sat Dec 6 06:55:08 2008 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 190361065672; Sat, 6 Dec 2008 06:55: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 063C18FC08; Sat, 6 Dec 2008 06:55: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 mB66t7H3086103; Sat, 6 Dec 2008 06:55:07 GMT (envelope-from kientzle@svn.freebsd.org) Received: (from kientzle@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mB66t7Hv086102; Sat, 6 Dec 2008 06:55:07 GMT (envelope-from kientzle@svn.freebsd.org) Message-Id: <200812060655.mB66t7Hv086102@svn.freebsd.org> From: Tim Kientzle Date: Sat, 6 Dec 2008 06:55: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: r185681 - 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, 06 Dec 2008 06:55:08 -0000 Author: kientzle Date: Sat Dec 6 06:55:07 2008 New Revision: 185681 URL: http://svn.freebsd.org/changeset/base/185681 Log: General improvements to Rockridge parsing and ISO9660 format detection. 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 Sat Dec 6 06:50:09 2008 (r185680) +++ head/lib/libarchive/archive_read_support_format_iso9660.c Sat Dec 6 06:55:07 2008 (r185681) @@ -138,6 +138,15 @@ __FBSDID("$FreeBSD$"); #define PVD_reserved4_size 1 #define PVD_application_data_offset (PVD_reserved4_offset + PVD_reserved4_size) #define PVD_application_data_size 512 +#define PVD_reserved5_offset (PVD_application_data_offset + PVD_application_data_size) +#define PVD_reserved5_size (2048 - PVD_reserved5_offset) + +/* TODO: It would make future maintenance easier to just hardcode the + * above values. In particular, ECMA119 states the offsets as part of + * the standard. That would eliminate the need for the following check.*/ +#if PVD_reserved5_offset != 1395 +#error PVD offset and size definitions are wrong. +#endif /* Structure of an on-disk directory record. */ /* Note: ISO9660 stores each multi-byte integer twice, once in @@ -178,17 +187,20 @@ struct file_info { uint64_t size; /* File size in bytes. */ uint64_t ce_offset; /* Offset of CE */ uint64_t ce_size; /* Size of CE */ + time_t birthtime; /* File created time. */ time_t mtime; /* File last modified time. */ time_t atime; /* File last accessed time. */ - time_t ctime; /* File creation time. */ + time_t ctime; /* File attribute change time. */ uint64_t rdev; /* Device number */ mode_t mode; uid_t uid; gid_t gid; ino_t inode; int nlinks; - char *name; /* Null-terminated filename. */ + struct archive_string name; /* Pathname */ + char name_continues; /* Non-zero if name continues */ struct archive_string symlink; + char symlink_continues; /* Non-zero if link continues */ }; @@ -210,6 +222,7 @@ struct iso9660 { uint64_t current_position; ssize_t logical_block_size; + uint64_t volume_size; /* Total size of volume in bytes. */ off_t entry_sparse_offset; int64_t entry_bytes_remaining; @@ -224,7 +237,7 @@ static int archive_read_format_iso9660_r static int archive_read_format_iso9660_read_header(struct archive_read *, struct archive_entry *); static const char *build_pathname(struct archive_string *, struct file_info *); -#ifdef DEBUG +#if DEBUG static void dump_isodirrec(FILE *, const unsigned char *isodirrec); #endif static time_t time_from_tm(struct tm *); @@ -240,6 +253,12 @@ static struct file_info * static void parse_rockridge(struct iso9660 *iso9660, struct file_info *file, const unsigned char *start, const unsigned char *end); +static void parse_rockridge_NM1(struct file_info *, + const unsigned char *, int); +static void parse_rockridge_SL1(struct file_info *, + const unsigned char *, int); +static void parse_rockridge_TF1(struct file_info *, + const unsigned char *, int); static void release_file(struct iso9660 *, struct file_info *); static unsigned toi(const void *p, int n); @@ -316,13 +335,61 @@ static int isPVD(struct iso9660 *iso9660, const unsigned char *h) { struct file_info *file; + int i; + + /* Type of the Primary Volume Descriptor must be 1. */ + if (h[PVD_type_offset] != 1) + return (0); + + /* ID must be "CD001" */ + if (memcmp(h + PVD_id_offset, "CD001", 5) != 0) + return (0); - if (h[0] != 1) + /* PVD version must be 1. */ + if (h[PVD_version_offset] != 1) return (0); - if (memcmp(h+1, "CD001", 5) != 0) + + /* Reserved field must be 0. */ + if (h[PVD_reserved1_offset] != 0) return (0); + /* Reserved field must be 0. */ + for (i = 0; i < PVD_reserved2_size; ++i) + if (h[PVD_reserved2_offset + i] != 0) + return (0); + + /* Reserved field must be 0. */ + for (i = 0; i < PVD_reserved3_size; ++i) + if (h[PVD_reserved3_offset + i] != 0) + return (0); + + /* Logical block size must be > 0. */ + /* I've looked at Ecma 119 and can't find any stronger + * restriction on this field. */ iso9660->logical_block_size = toi(h + PVD_logical_block_size_offset, 2); + if (iso9660->logical_block_size <= 0) + return (0); + + iso9660->volume_size = iso9660->logical_block_size + * (uint64_t)toi(h + PVD_volume_space_size_offset, 4); + + /* File structure version must be 1 for ISO9660/ECMA119. */ + if (h[PVD_file_structure_version_offset] != 1) + return (0); + + + /* Reserved field must be 0. */ + for (i = 0; i < PVD_reserved4_size; ++i) + if (h[PVD_reserved4_offset + i] != 0) + return (0); + + /* Reserved field must be 0. */ + for (i = 0; i < PVD_reserved5_size; ++i) + if (h[PVD_reserved5_offset + i] != 0) + return (0); + + /* XXX TODO: Check other values for sanity; reject more + * malformed PVDs. XXX */ /* Store the root directory in the pending list. */ file = parse_file_info(iso9660, NULL, h + PVD_root_directory_record_offset); @@ -353,12 +420,22 @@ archive_read_format_iso9660_read_header( iso9660->entry_bytes_remaining = file->size; iso9660->entry_sparse_offset = 0; /* Offset for sparse-file-aware clients. */ + if (file->offset + file->size > iso9660->volume_size) { + archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC, + "File is beyond end-of-media: %s", file->name); + iso9660->entry_bytes_remaining = 0; + iso9660->entry_sparse_offset = 0; + release_file(iso9660, file); + return (ARCHIVE_WARN); + } + /* Set up the entry structure with information about this entry. */ archive_entry_set_mode(entry, file->mode); archive_entry_set_uid(entry, file->uid); archive_entry_set_gid(entry, file->gid); archive_entry_set_nlink(entry, file->nlinks); archive_entry_set_ino(entry, file->inode); + archive_entry_set_birthtime(entry, file->birthtime, 0); archive_entry_set_mtime(entry, file->mtime, 0); archive_entry_set_ctime(entry, file->ctime, 0); archive_entry_set_atime(entry, file->atime, 0); @@ -534,13 +611,7 @@ 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); - file->name = (char *)malloc(name_len + 1); - if (file->name == NULL) { - free(file); - return (NULL); - } - memcpy(file->name, isodirrec + DR_name_offset, name_len); - file->name[name_len] = '\0'; + archive_strncpy(&file->name, isodirrec + DR_name_offset, name_len); flags = *(isodirrec + DR_flags_offset); if (flags & 0x02) file->mode = AE_IFDIR | 0700; @@ -560,7 +631,7 @@ parse_file_info(struct iso9660 *iso9660, parse_rockridge(iso9660, file, rr_start, rr_end); } -#ifdef DEBUG +#if DEBUG /* DEBUGGING: Warn about attributes I don't yet fully support. */ if ((flags & ~0x02) != 0) { fprintf(stderr, "\n ** Unrecognized flag: "); @@ -584,7 +655,6 @@ parse_file_info(struct iso9660 *iso9660, fprintf(stderr, "\n"); } #endif - return (file); } @@ -624,6 +694,7 @@ parse_rockridge(struct iso9660 *iso9660, while (p + 4 < end /* Enough space for another entry. */ && p[0] >= 'A' && p[0] <= 'Z' /* Sanity-check 1st char of name. */ && p[1] >= 'A' && p[1] <= 'Z' /* Sanity-check 2nd char of name. */ + && p[2] >= 4 /* Sanity-check length. */ && p + p[2] <= end) { /* Sanity-check length. */ const unsigned char *data = p + 4; int data_length = p[2] - 4; @@ -636,61 +707,54 @@ parse_rockridge(struct iso9660 *iso9660, */ switch(p[0]) { case 'C': - if (p[0] == 'C' && p[1] == 'E' && version == 1) { - /* - * CE extension comprises: - * 8 byte sector containing extension - * 8 byte offset w/in above sector - * 8 byte length of continuation - */ - file->ce_offset = toi(data, 4) - * iso9660->logical_block_size - + toi(data + 8, 4); - file->ce_size = toi(data + 16, 4); + if (p[0] == 'C' && p[1] == 'E') { + if (version == 1 && data_length == 24) { + /* + * CE extension comprises: + * 8 byte sector containing extension + * 8 byte offset w/in above sector + * 8 byte length of continuation + */ + file->ce_offset = (uint64_t)toi(data, 4) + * iso9660->logical_block_size + + toi(data + 8, 4); + file->ce_size = toi(data + 16, 4); + /* If the result is rediculous, + * ignore it. */ + if (file->ce_offset + file->ce_size + > iso9660->volume_size) { + file->ce_offset = 0; + file->ce_size = 0; + } + } break; } /* FALLTHROUGH */ case 'N': - if (p[0] == 'N' && p[1] == 'M' && version == 1 - && *data == 0) { - /* NM extension with flag byte == 0 */ - /* - * NM extension comprises: - * one byte flag - * rest is long name - */ - /* TODO: Obey flags. */ - char *old_name = file->name; - - data++; /* Skip flag byte. */ - data_length--; - file->name = (char *)malloc(data_length + 1); - if (file->name != NULL) { - free(old_name); - memcpy(file->name, data, data_length); - file->name[data_length] = '\0'; - } else - file->name = old_name; + if (p[0] == 'N' && p[1] == 'M') { + if (version == 1) + parse_rockridge_NM1(file, + data, data_length); break; } /* FALLTHROUGH */ case 'P': - if (p[0] == 'P' && p[1] == 'D' && version == 1) { + if (p[0] == 'P' && p[1] == 'D') { /* * PD extension is padding; * contents are always ignored. */ break; } - if (p[0] == 'P' && p[1] == 'N' && version == 1) { - if (data_length == 16) { + if (p[0] == 'P' && p[1] == 'N') { + if (version == 1 && data_length == 16) { file->rdev = toi(data,4); file->rdev <<= 32; file->rdev |= toi(data + 8, 4); } break; } - if (p[0] == 'P' && p[1] == 'X' && version == 1) { + if (p[0] == 'P' && p[1] == 'X') { /* * PX extension comprises: * 8 bytes for mode, @@ -699,12 +763,22 @@ parse_rockridge(struct iso9660 *iso9660, * 8 bytes for gid, * 8 bytes for inode. */ - if (data_length == 32) { - file->mode = toi(data, 4); - file->nlinks = toi(data + 8, 4); - file->uid = toi(data + 16, 4); - file->gid = toi(data + 24, 4); - file->inode = toi(data + 32, 4); + if (version == 1) { + if (data_length >= 8) + file->mode + = toi(data, 4); + if (data_length >= 16) + file->nlinks + = toi(data + 8, 4); + if (data_length >= 24) + file->uid + = toi(data + 16, 4); + if (data_length >= 32) + file->gid + = toi(data + 24, 4); + if (data_length >= 40) + file->inode + = toi(data + 32, 4); } break; } @@ -721,56 +795,14 @@ parse_rockridge(struct iso9660 *iso9660, } /* FALLTHROUGH */ case 'S': - if (p[0] == 'S' && p[1] == 'L' && version == 1 - && *data == 0) { - int cont = 1; - /* SL extension with flags == 0 */ - /* TODO: handle non-zero flag values. */ - data++; /* Skip flag byte. */ - data_length--; - while (data_length > 0) { - unsigned char flag = *data++; - unsigned char nlen = *data++; - data_length -= 2; - - if (cont == 0) - archive_strcat(&file->symlink, "/"); - cont = 0; - - switch(flag) { - case 0x01: /* Continue */ - archive_strncat(&file->symlink, - (const char *)data, nlen); - cont = 1; - break; - case 0x02: /* Current */ - archive_strcat(&file->symlink, "."); - break; - case 0x04: /* Parent */ - archive_strcat(&file->symlink, ".."); - break; - case 0x08: /* Root */ - case 0x10: /* Volume root */ - archive_string_empty(&file->symlink); - break; - case 0x20: /* Hostname */ - archive_strcat(&file->symlink, "hostname"); - break; - case 0: - archive_strncat(&file->symlink, - (const char *)data, nlen); - break; - default: - /* TODO: issue a warning ? */ - break; - } - data += nlen; - data_length -= nlen; - } + if (p[0] == 'S' && p[1] == 'L') { + if (version == 1) + parse_rockridge_SL1(file, + data, data_length); break; } if (p[0] == 'S' && p[1] == 'P' - && version == 1 && data_length == 7 + && version == 1 && data_length == 3 && data[0] == (unsigned char)'\xbe' && data[1] == (unsigned char)'\xef') { /* @@ -806,62 +838,20 @@ parse_rockridge(struct iso9660 *iso9660, return; } case 'T': - if (p[0] == 'T' && p[1] == 'F' && version == 1) { - char flag = data[0]; - /* - * TF extension comprises: - * one byte flag - * create time (optional) - * modify time (optional) - * access time (optional) - * attribute time (optional) - * Time format and presence of fields - * is controlled by flag bits. - */ - data++; - if (flag & 0x80) { - /* Use 17-byte time format. */ - if (flag & 1) /* Create time. */ - data += 17; - if (flag & 2) { /* Modify time. */ - file->mtime = isodate17(data); - data += 17; - } - if (flag & 4) { /* Access time. */ - file->atime = isodate17(data); - data += 17; - } - if (flag & 8) { /* Attribute time. */ - file->ctime = isodate17(data); - data += 17; - } - } else { - /* Use 7-byte time format. */ - if (flag & 1) /* Create time. */ - data += 7; - if (flag & 2) { /* Modify time. */ - file->mtime = isodate7(data); - data += 7; - } - if (flag & 4) { /* Access time. */ - file->atime = isodate7(data); - data += 7; - } - if (flag & 8) { /* Attribute time. */ - file->ctime = isodate7(data); - data += 7; - } - } + if (p[0] == 'T' && p[1] == 'F') { + if (version == 1) + parse_rockridge_TF1(file, + data, data_length); break; } /* FALLTHROUGH */ default: /* The FALLTHROUGHs above leave us here for * any unsupported extension. */ -#ifdef DEBUG +#if DEBUG { const unsigned char *t; - fprintf(stderr, "\nUnsupported RRIP extension for %s\n", file->name); + fprintf(stderr, "\nUnsupported RRIP extension for %s\n", file->name.s); fprintf(stderr, " %c%c(%d):", p[0], p[1], data_length); for (t = data; t < data + data_length && t < data + 16; t++) fprintf(stderr, " %02x", *t); @@ -878,14 +868,222 @@ parse_rockridge(struct iso9660 *iso9660, } static void +parse_rockridge_NM1(struct file_info *file, const unsigned char *data, + int data_length) +{ + if (!file->name_continues) + archive_string_empty(&file->name); + file->name_continues = 0; + if (data_length < 1) + return; + /* + * NM version 1 extension comprises: + * 1 byte flag, value is one of: + * = 0: remainder is name + * = 1: remainder is name, next NM entry continues name + * = 2: "." + * = 4: ".." + * = 32: Implementation specific + * All other values are reserved. + */ + switch(data[0]) { + case 0: + if (data_length < 2) + return; + archive_strncat(&file->name, data + 1, data_length - 1); + break; + case 1: + if (data_length < 2) + return; + archive_strncat(&file->name, data + 1, data_length - 1); + file->name_continues = 1; + break; + case 2: + archive_strcat(&file->name, "."); + break; + case 4: + archive_strcat(&file->name, ".."); + break; + default: + return; + } + +} + +static void +parse_rockridge_TF1(struct file_info *file, const unsigned char *data, + int data_length) +{ + char flag; + /* + * TF extension comprises: + * one byte flag + * create time (optional) + * modify time (optional) + * access time (optional) + * attribute time (optional) + * Time format and presence of fields + * is controlled by flag bits. + */ + if (data_length < 1) + return; + flag = data[0]; + ++data; + --data_length; + if (flag & 0x80) { + /* Use 17-byte time format. */ + if ((flag & 1) && data_length >= 17) { + /* Create time. */ + file->birthtime = isodate17(data); + data += 17; + data_length -= 17; + } + if ((flag & 2) && data_length >= 17) { + /* Modify time. */ + file->mtime = isodate17(data); + data += 17; + data_length -= 17; + } + if ((flag & 4) && data_length >= 17) { + /* Access time. */ + file->atime = isodate17(data); + data += 17; + data_length -= 17; + } + if ((flag & 8) && data_length >= 17) { + /* Attribute change time. */ + file->ctime = isodate17(data); + data += 17; + data_length -= 17; + } + } else { + /* Use 7-byte time format. */ + if ((flag & 1) && data_length >= 7) { + /* Create time. */ + file->birthtime = isodate17(data); + data += 7; + data_length -= 7; + } + if ((flag & 2) && data_length >= 7) { + /* Modify time. */ + file->mtime = isodate7(data); + data += 7; + data_length -= 7; + } + if ((flag & 4) && data_length >= 7) { + /* Access time. */ + file->atime = isodate7(data); + data += 7; + data_length -= 7; + } + if ((flag & 8) && data_length >= 7) { + /* Attribute change time. */ + file->ctime = isodate7(data); + data += 7; + data_length -= 7; + } + } +} + +static void +parse_rockridge_SL1(struct file_info *file, const unsigned char *data, + int data_length) +{ + int component_continues = 1; + + if (!file->symlink_continues) + archive_string_empty(&file->symlink); + else + archive_strcat(&file->symlink, "/"); + file->symlink_continues = 0; + + /* + * Defined flag values: + * 0: This is the last SL record for this symbolic link + * 1: this symbolic link field continues in next SL entry + * All other values are reserved. + */ + if (data_length < 1) + return; + switch(*data) { + case 0: + break; + case 1: + file->symlink_continues = 1; + break; + default: + return; + } + ++data; /* Skip flag byte. */ + --data_length; + + /* + * SL extension body stores "components". + * Basically, this is a complicated way of storing + * a POSIX path. It also interferes with using + * symlinks for storing non-path data. + * + * Each component is 2 bytes (flag and length) + * possibly followed by name data. + */ + while (data_length >= 2) { + unsigned char flag = *data++; + unsigned char nlen = *data++; + data_length -= 2; + + if (!component_continues) + archive_strcat(&file->symlink, "/"); + component_continues = 0; + + switch(flag) { + case 0: /* Usual case, this is text. */ + if (data_length < nlen) + return; + archive_strncat(&file->symlink, + (const char *)data, nlen); + break; + case 0x01: /* Text continues in next component. */ + if (data_length < nlen) + return; + archive_strncat(&file->symlink, + (const char *)data, nlen); + component_continues = 1; + break; + case 0x02: /* Current dir. */ + archive_strcat(&file->symlink, "."); + break; + case 0x04: /* Parent dir. */ + archive_strcat(&file->symlink, ".."); + break; + case 0x08: /* Root of filesystem. */ + archive_string_empty(&file->symlink); + archive_strcat(&file->symlink, "/"); + break; + case 0x10: /* Undefined (historically "volume root" */ + archive_string_empty(&file->symlink); + archive_strcat(&file->symlink, "ROOT"); + break; + case 0x20: /* Undefined (historically "hostname") */ + archive_strcat(&file->symlink, "hostname"); + break; + default: + /* TODO: issue a warning ? */ + return; + } + data += nlen; + data_length -= nlen; + } +} + + +static void release_file(struct iso9660 *iso9660, struct file_info *file) { struct file_info *parent; if (file->refcount == 0) { parent = file->parent; - if (file->name) - free(file->name); + archive_string_free(&file->name); archive_string_free(&file->symlink); free(file); if (parent != NULL) { @@ -1074,18 +1272,18 @@ time_from_tm(struct tm *t) static const char * build_pathname(struct archive_string *as, struct file_info *file) { - if (file->parent != NULL && file->parent->name[0] != '\0') { + if (file->parent != NULL && archive_strlen(&file->parent->name) > 0) { build_pathname(as, file->parent); archive_strcat(as, "/"); } - if (file->name[0] == '\0') + if (archive_strlen(&file->name) == 0) archive_strcat(as, "."); else - archive_strcat(as, file->name); + archive_string_concat(as, &file->name); return (as->s); } -#ifdef DEBUG +#if DEBUG static void dump_isodirrec(FILE *out, const unsigned char *isodirrec) { From owner-svn-src-head@FreeBSD.ORG Sat Dec 6 06:57:45 2008 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E3B8F1065676; Sat, 6 Dec 2008 06:57: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 B89F58FC08; Sat, 6 Dec 2008 06:57: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 mB66vj6x086177; Sat, 6 Dec 2008 06:57:45 GMT (envelope-from kientzle@svn.freebsd.org) Received: (from kientzle@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mB66vjXM086176; Sat, 6 Dec 2008 06:57:45 GMT (envelope-from kientzle@svn.freebsd.org) Message-Id: <200812060657.mB66vjXM086176@svn.freebsd.org> From: Tim Kientzle Date: Sat, 6 Dec 2008 06:57: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: r185682 - 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, 06 Dec 2008 06:57:46 -0000 Author: kientzle Date: Sat Dec 6 06:57:45 2008 New Revision: 185682 URL: http://svn.freebsd.org/changeset/base/185682 Log: Strip ";1" and trailing "." from ISO9660 entries. This seems a better match for people's expectations. 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 Sat Dec 6 06:55:07 2008 (r185681) +++ head/lib/libarchive/archive_read_support_format_iso9660.c Sat Dec 6 06:57:45 2008 (r185682) @@ -593,6 +593,8 @@ parse_file_info(struct iso9660 *iso9660, { struct file_info *file; size_t name_len; + const unsigned char *rr_start, *rr_end; + const char *p; int flags; /* TODO: Sanity check that name_len doesn't exceed length, etc. */ @@ -610,8 +612,23 @@ parse_file_info(struct iso9660 *iso9660, file->size = toi(isodirrec + DR_size_offset, DR_size_size); 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); - archive_strncpy(&file->name, isodirrec + DR_name_offset, name_len); + 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); + + /* 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); + flags = *(isodirrec + DR_flags_offset); if (flags & 0x02) file->mode = AE_IFDIR | 0700; @@ -619,17 +636,7 @@ parse_file_info(struct iso9660 *iso9660, file->mode = AE_IFREG | 0400; /* Rockridge extensions overwrite information from above. */ - { - const unsigned char *rr_start, *rr_end; - rr_end = (const unsigned char *)isodirrec - + *(isodirrec + DR_length_offset); - rr_start = (const unsigned char *)(isodirrec + DR_name_offset - + name_len); - if ((name_len & 1) == 0) - rr_start++; - rr_start += iso9660->suspOffset; - parse_rockridge(iso9660, file, rr_start, rr_end); - } + parse_rockridge(iso9660, file, rr_start, rr_end); #if DEBUG /* DEBUGGING: Warn about attributes I don't yet fully support. */ @@ -690,6 +697,8 @@ parse_rockridge(struct iso9660 *iso9660, const unsigned char *p, const unsigned char *end) { (void)iso9660; /* UNUSED */ + file->name_continues = 0; + file->symlink_continues = 0; while (p + 4 < end /* Enough space for another entry. */ && p[0] >= 'A' && p[0] <= 'Z' /* Sanity-check 1st char of name. */ From owner-svn-src-head@FreeBSD.ORG Sat Dec 6 07:08:08 2008 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E05DD106564A; Sat, 6 Dec 2008 07:08: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 CCD9A8FC17; Sat, 6 Dec 2008 07:08: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 mB67884J086436; Sat, 6 Dec 2008 07:08:08 GMT (envelope-from kientzle@svn.freebsd.org) Received: (from kientzle@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mB6788wR086427; Sat, 6 Dec 2008 07:08:08 GMT (envelope-from kientzle@svn.freebsd.org) Message-Id: <200812060708.mB6788wR086427@svn.freebsd.org> From: Tim Kientzle Date: Sat, 6 Dec 2008 07:08: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: r185683 - 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, 06 Dec 2008 07:08:09 -0000 Author: kientzle Date: Sat Dec 6 07:08:08 2008 New Revision: 185683 URL: http://svn.freebsd.org/changeset/base/185683 Log: New tests: * support for bzip2 file with multiple concatenated bzip2 streams * support for bzip2 file with junk after bzip2 stream * support for gzip file with junk after gzip stream * "fuzz" tester randomly modifies a bunch of input files in order to try to crash libarchive (this found an amusing hang in the ISO9660 code when trying to read images that advertised a zero blocksize). This test is implemented, but commented out for now: * support for gzip file with multiple concatenated gzip streams Added: head/lib/libarchive/test/test_compat_bzip2.c (contents, props changed) head/lib/libarchive/test/test_compat_bzip2_1.tbz.uu (contents, props changed) head/lib/libarchive/test/test_compat_bzip2_2.tbz.uu (contents, props changed) head/lib/libarchive/test/test_compat_gzip.c (contents, props changed) head/lib/libarchive/test/test_compat_gzip_1.tgz.uu (contents, props changed) head/lib/libarchive/test/test_compat_gzip_2.tgz.uu (contents, props changed) head/lib/libarchive/test/test_fuzz.c (contents, props changed) head/lib/libarchive/test/test_fuzz_1.iso.uu (contents, props changed) Modified: head/lib/libarchive/test/Makefile Modified: head/lib/libarchive/test/Makefile ============================================================================== --- head/lib/libarchive/test/Makefile Sat Dec 6 06:57:45 2008 (r185682) +++ head/lib/libarchive/test/Makefile Sat Dec 6 07:08:08 2008 (r185683) @@ -13,12 +13,15 @@ TESTS= \ test_acl_pax.c \ test_archive_api_feature.c \ test_bad_fd.c \ + test_compat_bzip2.c \ test_compat_gtar.c \ + test_compat_gzip.c \ test_compat_tar_hardlink.c \ test_compat_zip.c \ test_empty_write.c \ test_entry.c \ test_entry_strmode.c \ + test_fuzz.c \ test_link_resolver.c \ test_pax_filename_encoding.c \ test_read_compress_program.c \ Added: head/lib/libarchive/test/test_compat_bzip2.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/lib/libarchive/test/test_compat_bzip2.c Sat Dec 6 07:08:08 2008 (r185683) @@ -0,0 +1,89 @@ +/*- + * Copyright (c) 2003-2008 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$"); + +/* + * Verify our ability to read sample files compatibly with bunzip2. + * + * In particular: + * * bunzip2 will read multiple bzip2 streams, concatenating the output + * * bunzip2 will stop at the end of a stream if the following data + * doesn't start with a bzip2 signature. + */ + +/* + * All of the sample files have the same contents; they're just + * compressed in different ways. + */ +static void +compat_bzip2(const char *name) +{ + const char *n[7] = { "f1", "f2", "f3", "d1/f1", "d1/f2", "d1/f3", NULL }; + struct archive_entry *ae; + struct archive *a; + int i,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)); + extract_reference_file(name); + assertEqualIntA(a, ARCHIVE_OK, archive_read_open_filename(a, name, 2)); + + /* Read entries, match up names with list above. */ + for (i = 0; i < 6; ++i) { + r = archive_read_next_header(a, &ae); + failure("Could not read file %d (%s) from %s", i, n[i], name); + assertEqualIntA(a, ARCHIVE_OK, r); + if (r != ARCHIVE_OK) { + archive_read_finish(a); + return; + } + assertEqualString(n[i], archive_entry_pathname(ae)); + } + + /* Verify the end-of-archive. */ + assertEqualIntA(a, ARCHIVE_EOF, archive_read_next_header(a, &ae)); + + /* Verify that the format detection worked. */ + assertEqualInt(archive_compression(a), ARCHIVE_COMPRESSION_BZIP2); + assertEqualInt(archive_format(a), ARCHIVE_FORMAT_TAR_USTAR); + + assertEqualInt(ARCHIVE_OK, archive_read_close(a)); +#if ARCHIVE_VERSION_NUMBER < 2000000 + archive_read_finish(a); +#else + assertEqualInt(ARCHIVE_OK, archive_read_finish(a)); +#endif +} + + +DEFINE_TEST(test_compat_bzip2) +{ + compat_bzip2("test_compat_bzip2_1.tbz"); + compat_bzip2("test_compat_bzip2_2.tbz"); +} + + Added: head/lib/libarchive/test/test_compat_bzip2_1.tbz.uu ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/lib/libarchive/test/test_compat_bzip2_1.tbz.uu Sat Dec 6 07:08:08 2008 (r185683) @@ -0,0 +1,24 @@ +$FreeBSD$ + +begin 644 test_compat_bzip2_1.tbz +M0EIH.3%!62936;12^)(``#-;D=$00`!_@``!8RT>$`0`$```""``5#5/*'J> +MD#(&30_5!H4_5-ZH`T``327U4@&L('"(9-%8<7&$I,`:7FXH+*\GV#JF<`PK29-8'OPDG36S\7HR&C(T:/U0:$U'I +MJ!ZC0`#VECO\[$10H'-Z@F*:6A1$H$V("2G0Q(U0(8=(7AK$S04#!)RXOAP% +MP:D%#Q;NO)\4UL23'2[\7````6YC1 +M$$`$?X```6,M'A`$`!````@@`'4-4S*,U!HT!HT?J@T)E-I--!H`![60EIH.3%!629364RNM^,```#?L-$00`#_@`0```AG +M+1X0`!`$```((`!U#5-,:1IH`TT,1^J#)&H]3U`T``!CX[_.[`F40.64EC"D +M()+?KX6,VP?6Y;F%5$XR[Y/D#*9),K3^+N2*<*$@9@ +MX6(`0EIH.3%!62936>ZM4*4```);D-$00`#O@``(9ST>$`0```@@`'0:IFC2 +M&F@!B:/U0:$R&H:&@`"KS^U=Y`BC`#FY2*9-8%%&13E$@%8ZF(&J!##]!#E` +MKVL'2LUW2.*C08`$)::#DQ05DF +?4UDI/)=P````0!!```0`(``A`(*#%W)%.%"0*3R7<``` +` +end Added: head/lib/libarchive/test/test_compat_bzip2_2.tbz.uu ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/lib/libarchive/test/test_compat_bzip2_2.tbz.uu Sat Dec 6 07:08:08 2008 (r185683) @@ -0,0 +1,11 @@ +$FreeBSD$ + +begin 644 test_compat_bzip2_2.tbz +M0EIH.3%!629361HI1P<``4#;D-$00`#_@``)9RT>$`0``!@P`/@#&$Q,F`F` +M`,83$R8"8``1133"1/2-J-#$/U3@;XVF9V'`Y3882XA$*KO6\WTL`]QU&J"8 +M$-=*Q$\@=`=QJ,TQ;3UH,NPT$-(!"HV&!ZO5D&@P-1D&1@'L<8&209QV9'G` +MW&PRZ0Q(-BT%&DG*DE.!U*#J.P]*#%-P9G`W9+34:#S&M`;@^1R^![C]:Y)U +MDF9/(\AR/@?P@^@I_B[DBG"A(#12C@X!3;VUE(&UOV=QL!06ER26`1T2G9F:EY)54XJ +MN>9`/*(`IX<(2#/D&F@GC`(Z``#S57',@'E&`TT,$I!EQ +M#;031@$5`0`Q!<\4Z`,``!^+"`B8OB))``-T97-T+7-P;&ET+G1A$0!3@\1D&;,-=!.&`5D``#7L]HO +MZ`,``!^+"`B8OB))``-T97-T+7-P;&ET+G1A57',@'E&`TT,$I!ER#;031@$>``"Y*#OBZ`,``!^+"`B8 +MOB))``-T97-T+7-P;&ET+G1A@ALXPP`]CXF=Q&A<:-UX>EN)C5M,AL;P +MO@V[0A=_.E39F2.B'*.?5QX2?Z\?XGE&27)F]L0)V>E_'7YY07\>OZ)Y1W6Q\!-J3!?H^Z_J7TG]%_"QK0?\]4[/>HZS^_^T\! +M_;>@@OY[=N2]6E\!JOH/P])_2OC^-X'YOV]+_]97@*K^A4K_C/Y;P/S?MZ5_ +MZRM`7?]<^L?_OR8P_P,`].D%,XR2*0`<``!4:&ES(&ES('5N Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DAE501065672; Sat, 6 Dec 2008 07:15: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 C93808FC1B; Sat, 6 Dec 2008 07:15: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 mB67FgMS086616; Sat, 6 Dec 2008 07:15:42 GMT (envelope-from kientzle@svn.freebsd.org) Received: (from kientzle@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mB67FgVA086614; Sat, 6 Dec 2008 07:15:42 GMT (envelope-from kientzle@svn.freebsd.org) Message-Id: <200812060715.mB67FgVA086614@svn.freebsd.org> From: Tim Kientzle Date: Sat, 6 Dec 2008 07:15: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: r185684 - head/usr.bin/cpio X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 06 Dec 2008 07:15:43 -0000 Author: kientzle Date: Sat Dec 6 07:15:42 2008 New Revision: 185684 URL: http://svn.freebsd.org/changeset/base/185684 Log: Make the GCC-specific __dead2 markers conditional on whether we're compiling under GCC. Modified: head/usr.bin/cpio/cpio.h head/usr.bin/cpio/cpio_platform.h Modified: head/usr.bin/cpio/cpio.h ============================================================================== --- head/usr.bin/cpio/cpio.h Sat Dec 6 07:08:08 2008 (r185683) +++ head/usr.bin/cpio/cpio.h Sat Dec 6 07:15:42 2008 (r185684) @@ -89,7 +89,7 @@ struct cpio { /* Name of this program; used in error reporting, initialized in main(). */ const char *cpio_progname; -void cpio_errc(int _eval, int _code, const char *fmt, ...) __dead2; +void cpio_errc(int _eval, int _code, const char *fmt, ...) __LA_DEAD; void cpio_warnc(int _code, const char *fmt, ...); int owner_parse(const char *, int *, int *); Modified: head/usr.bin/cpio/cpio_platform.h ============================================================================== --- head/usr.bin/cpio/cpio_platform.h Sat Dec 6 07:08:08 2008 (r185683) +++ head/usr.bin/cpio/cpio_platform.h Sat Dec 6 07:15:42 2008 (r185684) @@ -81,4 +81,12 @@ #endif #endif +/* How to mark functions that don't return. */ +#if defined(__GNUC__) && (__GNUC__ > 2 || \ + (__GNUC__ == 2 && __GNUC_MINOR__ >= 5)) +#define __LA_DEAD __attribute__((__noreturn__)) +#else +#define __LA_DEAD +#endif + #endif /* !CPIO_PLATFORM_H_INCLUDED */ From owner-svn-src-head@FreeBSD.ORG Sat Dec 6 07:30:40 2008 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 98A36106564A; Sat, 6 Dec 2008 07:30:40 +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 859278FC29; Sat, 6 Dec 2008 07:30:40 +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 mB67UeSt086937; Sat, 6 Dec 2008 07:30:40 GMT (envelope-from kientzle@svn.freebsd.org) Received: (from kientzle@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mB67Ue6H086932; Sat, 6 Dec 2008 07:30:40 GMT (envelope-from kientzle@svn.freebsd.org) Message-Id: <200812060730.mB67Ue6H086932@svn.freebsd.org> From: Tim Kientzle Date: Sat, 6 Dec 2008 07:30: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: r185685 - head/usr.bin/cpio X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 06 Dec 2008 07:30:40 -0000 Author: kientzle Date: Sat Dec 6 07:30:40 2008 New Revision: 185685 URL: http://svn.freebsd.org/changeset/base/185685 Log: Custom command line parser for cpio; this is a little more code but should be a lot fewer cross-platform compatibility headaches. Modified: head/usr.bin/cpio/Makefile head/usr.bin/cpio/cmdline.c head/usr.bin/cpio/config_freebsd.h head/usr.bin/cpio/cpio.c head/usr.bin/cpio/cpio.h Modified: head/usr.bin/cpio/Makefile ============================================================================== --- head/usr.bin/cpio/Makefile Sat Dec 6 07:15:42 2008 (r185684) +++ head/usr.bin/cpio/Makefile Sat Dec 6 07:30:40 2008 (r185685) @@ -3,7 +3,7 @@ .include PROG= bsdcpio -BSDCPIO_VERSION_STRING=1.0.0 +BSDCPIO_VERSION_STRING=1.1.0 SRCS= cpio.c cmdline.c err.c matching.c pathmatch.c WARNS?= 6 DPADD= ${LIBARCHIVE} ${LIBZ} ${LIBBZ2} Modified: head/usr.bin/cpio/cmdline.c ============================================================================== --- head/usr.bin/cpio/cmdline.c Sat Dec 6 07:15:42 2008 (r185684) +++ head/usr.bin/cpio/cmdline.c Sat Dec 6 07:30:40 2008 (r185685) @@ -31,18 +31,6 @@ __FBSDID("$FreeBSD$"); #ifdef HAVE_ERRNO_H #include #endif -#ifdef HAVE_GETOPT_LONG -#include -#else -struct option { - const char *name; - int has_arg; - int *flag; - int val; -}; -#define no_argument 0 -#define required_argument 1 -#endif #ifdef HAVE_GRP_H #include #endif @@ -60,119 +48,215 @@ struct option { #include "cpio.h" /* - * - * Option parsing routines for bsdcpio. - * - */ - - -static const char *cpio_opts = "0AaBC:F:O:cdE:f:H:hijLlmopR:rtuvW:yZz"; - -/* - * On systems that lack getopt_long, long options can be specified - * using -W longopt and -W longopt=value, e.g. "-W version" is the - * same as "--version" and "-W format=ustar" is the same as "--format - * ustar". This does not rely the GNU getopt() "W;" extension, so - * should work correctly on any system with a POSIX-compliant - * getopt(). + * Short options for cpio. Please keep this sorted. */ +static const char *short_options = "0AaBC:F:O:cdE:f:H:hijLlmopR:rtuvW:yZz"; /* - * If you add anything, be very careful to keep this list properly - * sorted, as the -W logic below relies on it. + * Long options for cpio. Please keep this sorted. */ -static const struct option cpio_longopts[] = { - { "create", no_argument, NULL, 'o' }, - { "extract", no_argument, NULL, 'i' }, - { "file", required_argument, NULL, 'F' }, - { "format", required_argument, NULL, 'H' }, - { "help", no_argument, NULL, 'h' }, - { "insecure", no_argument, NULL, OPTION_INSECURE }, - { "link", no_argument, NULL, 'l' }, - { "list", no_argument, NULL, 't' }, - { "make-directories", no_argument, NULL, 'd' }, - { "no-preserve-owner", no_argument, NULL, OPTION_NO_PRESERVE_OWNER }, - { "null", no_argument, NULL, '0' }, - { "owner", required_argument, NULL, 'R' }, - { "pass-through", no_argument, NULL, 'p' }, - { "preserve-modification-time", no_argument, NULL, 'm' }, - { "quiet", no_argument, NULL, OPTION_QUIET }, - { "unconditional", no_argument, NULL, 'u' }, - { "verbose", no_argument, NULL, 'v' }, - { "version", no_argument, NULL, OPTION_VERSION }, - { NULL, 0, NULL, 0 } +static const struct option { + const char *name; + int required; /* 1 if this option requires an argument */ + int equivalent; /* Equivalent short option. */ +} cpio_longopts[] = { + { "create", 0, 'o' }, + { "extract", 0, 'i' }, + { "file", 1, 'F' }, + { "format", 1, 'H' }, + { "help", 0, 'h' }, + { "insecure", 0, OPTION_INSECURE }, + { "link", 0, 'l' }, + { "list", 0, 't' }, + { "make-directories", 0, 'd' }, + { "no-preserve-owner", 0, OPTION_NO_PRESERVE_OWNER }, + { "null", 0, '0' }, + { "owner", 1, 'R' }, + { "pass-through", 0, 'p' }, + { "preserve-modification-time", 0, 'm' }, + { "quiet", 0, OPTION_QUIET }, + { "unconditional", 0, 'u' }, + { "verbose", 0, 'v' }, + { "version", 0, OPTION_VERSION }, + { NULL, 0, 0 } }; /* - * Parse command-line options using system-provided getopt() or getopt_long(). - * If option is -W, then parse argument as a long option. + * I used to try to select platform-provided getopt() or + * getopt_long(), but that caused a lot of headaches. In particular, + * I couldn't consistently use long options in the test harness + * because not all platforms have getopt_long(). That in turn led to + * overuse of the -W hack in the test harness, which made it rough to + * run the test harness against GNU cpio. (I periodically run the + * test harness here against GNU cpio as a sanity-check. Yes, + * I've found a couple of bugs in GNU cpio that way.) */ int cpio_getopt(struct cpio *cpio) { - char *p, *q; - const struct option *option, *option2; - int opt; - int option_index; - size_t option_length; - - option_index = -1; - -#ifdef HAVE_GETOPT_LONG - opt = getopt_long(cpio->argc, cpio->argv, cpio_opts, - cpio_longopts, &option_index); -#else - opt = getopt(cpio->argc, cpio->argv, cpio_opts); -#endif + enum { state_start = 0, state_next_word, state_short, state_long }; + static int state = state_start; + static char *opt_word; + + const struct option *popt, *match = NULL, *match2 = NULL; + const char *p, *long_prefix = "--"; + size_t optlength; + int opt = '?'; + int required = 0; + + cpio->optarg = NULL; + + /* First time through, initialize everything. */ + if (state == state_start) { + /* Skip program name. */ + ++cpio->argv; + --cpio->argc; + state = state_next_word; + } - /* Support long options through -W longopt=value */ - if (opt == 'W') { - p = optarg; - q = strchr(optarg, '='); - if (q != NULL) { - option_length = (size_t)(q - p); - optarg = q + 1; + /* + * We're ready to look at the next word in argv. + */ + if (state == state_next_word) { + /* No more arguments, so no more options. */ + if (cpio->argv[0] == NULL) + return (-1); + /* Doesn't start with '-', so no more options. */ + if (cpio->argv[0][0] != '-') + return (-1); + /* "--" marks end of options; consume it and return. */ + if (strcmp(cpio->argv[0], "--") == 0) { + ++cpio->argv; + --cpio->argc; + return (-1); + } + /* Get next word for parsing. */ + opt_word = *cpio->argv++; + --cpio->argc; + if (opt_word[1] == '-') { + /* Set up long option parser. */ + state = state_long; + opt_word += 2; /* Skip leading '--' */ } else { - option_length = strlen(p); - optarg = NULL; + /* Set up short option parser. */ + state = state_short; + ++opt_word; /* Skip leading '-' */ } - option = cpio_longopts; - while (option->name != NULL && - (strlen(option->name) < option_length || - strncmp(p, option->name, option_length) != 0 )) { - option++; - } - - if (option->name != NULL) { - option2 = option; - opt = option->val; - - /* If the first match was exact, we're done. */ - if (strncmp(p, option->name, strlen(option->name)) == 0) { - while (option->name != NULL) - option++; + } + + /* + * We're parsing a group of POSIX-style single-character options. + */ + if (state == state_short) { + /* Peel next option off of a group of short options. */ + opt = *opt_word++; + if (opt == '\0') { + /* End of this group; recurse to get next option. */ + state = state_next_word; + return cpio_getopt(cpio); + } + + /* Does this option take an argument? */ + p = strchr(short_options, opt); + if (p == NULL) + return ('?'); + if (p[1] == ':') + required = 1; + + /* If it takes an argument, parse that. */ + if (required) { + /* If arg is run-in, opt_word already points to it. */ + if (opt_word[0] == '\0') { + /* Otherwise, pick up the next word. */ + opt_word = *cpio->argv; + if (opt_word == NULL) { + cpio_warnc(0, + "Option -%c requires an argument", + opt); + return ('?'); + } + ++cpio->argv; + --cpio->argc; + } + if (opt == 'W') { + state = state_long; + long_prefix = "-W "; /* For clearer errors. */ } else { - /* Check if there's another match. */ - option++; - while (option->name != NULL && - (strlen(option->name) < option_length || - strncmp(p, option->name, option_length) != 0)) { - option++; + state = state_next_word; + cpio->optarg = opt_word; + } + } + } + + /* We're reading a long option, including -W long=arg convention. */ + if (state == state_long) { + /* After this long option, we'll be starting a new word. */ + state = state_next_word; + + /* Option name ends at '=' if there is one. */ + p = strchr(opt_word, '='); + if (p != NULL) { + optlength = (size_t)(p - opt_word); + cpio->optarg = (char *)(uintptr_t)(p + 1); + } else { + optlength = strlen(opt_word); + } + + /* Search the table for an unambiguous match. */ + for (popt = cpio_longopts; popt->name != NULL; popt++) { + /* Short-circuit if first chars don't match. */ + if (popt->name[0] != opt_word[0]) + continue; + /* If option is a prefix of name in table, record it.*/ + if (strncmp(opt_word, popt->name, optlength) == 0) { + match2 = match; /* Record up to two matches. */ + match = popt; + /* If it's an exact match, we're done. */ + if (strlen(popt->name) == optlength) { + match2 = NULL; /* Forget the others. */ + break; } } - if (option->name != NULL) - cpio_errc(1, 0, - "Ambiguous option %s " - "(matches both %s and %s)", - p, option2->name, option->name); - - if (option2->has_arg == required_argument - && optarg == NULL) - cpio_errc(1, 0, - "Option \"%s\" requires argument", p); + } + + /* Fail if there wasn't a unique match. */ + if (match == NULL) { + cpio_warnc(0, + "Option %s%s is not supported", + long_prefix, opt_word); + return ('?'); + } + if (match2 != NULL) { + cpio_warnc(0, + "Ambiguous option %s%s (matches --%s and --%s)", + long_prefix, opt_word, match->name, match2->name); + return ('?'); + } + + /* We've found a unique match; does it need an argument? */ + if (match->required) { + /* Argument required: get next word if necessary. */ + if (cpio->optarg == NULL) { + cpio->optarg = *cpio->argv; + if (cpio->optarg == NULL) { + cpio_warnc(0, + "Option %s%s requires an argument", + long_prefix, match->name); + return ('?'); + } + ++cpio->argv; + --cpio->argc; + } } else { - opt = '?'; + /* Argument forbidden: fail if there is one. */ + if (cpio->optarg != NULL) { + cpio_warnc(0, + "Option %s%s does not allow an argument", + long_prefix, match->name); + return ('?'); + } } + return (match->equivalent); } return (opt); Modified: head/usr.bin/cpio/config_freebsd.h ============================================================================== --- head/usr.bin/cpio/config_freebsd.h Sat Dec 6 07:15:42 2008 (r185684) +++ head/usr.bin/cpio/config_freebsd.h Sat Dec 6 07:30:40 2008 (r185685) @@ -52,7 +52,6 @@ #define HAVE_FNM_LEADING_DIR 1 #define HAVE_FTRUNCATE 1 #define HAVE_FUTIMES 1 -#define HAVE_GETOPT_LONG 1 #undef HAVE_GETXATTR #define HAVE_GRP_H 1 #define HAVE_INTTYPES_H 1 Modified: head/usr.bin/cpio/cpio.c ============================================================================== --- head/usr.bin/cpio/cpio.c Sat Dec 6 07:15:42 2008 (r185684) +++ head/usr.bin/cpio/cpio.c Sat Dec 6 07:30:40 2008 (r185685) @@ -161,9 +161,9 @@ main(int argc, char *argv[]) cpio->bytes_per_block = 5120; break; case 'C': /* NetBSD/OpenBSD */ - cpio->bytes_per_block = atoi(optarg); + cpio->bytes_per_block = atoi(cpio->optarg); if (cpio->bytes_per_block <= 0) - cpio_errc(1, 0, "Invalid blocksize %s", optarg); + cpio_errc(1, 0, "Invalid blocksize %s", cpio->optarg); break; case 'c': /* POSIX 1997 */ cpio->format = "odc"; @@ -172,22 +172,22 @@ main(int argc, char *argv[]) cpio->extract_flags &= ~ARCHIVE_EXTRACT_NO_AUTODIR; break; case 'E': /* NetBSD/OpenBSD */ - include_from_file(cpio, optarg); + include_from_file(cpio, cpio->optarg); break; case 'F': /* NetBSD/OpenBSD/GNU cpio */ - cpio->filename = optarg; + cpio->filename = cpio->optarg; break; case 'f': /* POSIX 1997 */ - exclude(cpio, optarg); + exclude(cpio, cpio->optarg); break; case 'H': /* GNU cpio (also --format) */ - cpio->format = optarg; + cpio->format = cpio->optarg; break; case 'h': long_help(); break; case 'I': /* NetBSD/OpenBSD */ - cpio->filename = optarg; + cpio->filename = cpio->optarg; break; case 'i': /* POSIX 1997 */ cpio->mode = opt; @@ -209,7 +209,7 @@ main(int argc, char *argv[]) cpio->extract_flags &= ~ARCHIVE_EXTRACT_OWNER; break; case 'O': /* GNU cpio */ - cpio->filename = optarg; + cpio->filename = cpio->optarg; break; case 'o': /* POSIX 1997 */ cpio->mode = opt; @@ -222,7 +222,7 @@ main(int argc, char *argv[]) cpio->quiet = 1; break; case 'R': /* GNU cpio, also --owner */ - if (owner_parse(optarg, &uid, &gid)) + if (owner_parse(cpio->optarg, &uid, &gid)) usage(); if (uid != -1) cpio->uid_override = uid; @@ -269,9 +269,6 @@ main(int argc, char *argv[]) /* TODO: Sanity-check args, error out on nonsensical combinations. */ - cpio->argc -= optind; - cpio->argv += optind; - switch (cpio->mode) { case 'o': mode_out(cpio); @@ -314,11 +311,7 @@ usage(void) fprintf(stderr, " List: %s -it < archive\n", p); fprintf(stderr, " Extract: %s -i < archive\n", p); fprintf(stderr, " Create: %s -o < filenames > archive\n", p); -#ifdef HAVE_GETOPT_LONG fprintf(stderr, " Help: %s --help\n", p); -#else - fprintf(stderr, " Help: %s -h\n", p); -#endif exit(1); } Modified: head/usr.bin/cpio/cpio.h ============================================================================== --- head/usr.bin/cpio/cpio.h Sat Dec 6 07:15:42 2008 (r185684) +++ head/usr.bin/cpio/cpio.h Sat Dec 6 07:30:40 2008 (r185685) @@ -42,8 +42,11 @@ * functions. */ struct cpio { + /* Option parsing */ + const char *optarg; + /* Options */ - char *filename; + const char *filename; char mode; /* -i -o -p */ char compress; /* -j, -y, or -z */ const char *format; /* -H format */ From owner-svn-src-head@FreeBSD.ORG Sat Dec 6 07:37:15 2008 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 059861065731; Sat, 6 Dec 2008 07:37: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 E819E8FC08; Sat, 6 Dec 2008 07:37:14 +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 mB67bEAr087093; Sat, 6 Dec 2008 07:37:14 GMT (envelope-from kientzle@svn.freebsd.org) Received: (from kientzle@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mB67bEAT087091; Sat, 6 Dec 2008 07:37:14 GMT (envelope-from kientzle@svn.freebsd.org) Message-Id: <200812060737.mB67bEAT087091@svn.freebsd.org> From: Tim Kientzle Date: Sat, 6 Dec 2008 07:37: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: r185686 - head/usr.bin/tar X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 06 Dec 2008 07:37:15 -0000 Author: kientzle Date: Sat Dec 6 07:37:14 2008 New Revision: 185686 URL: http://svn.freebsd.org/changeset/base/185686 Log: Only use GCC-specific __dead2 marker when building with GCC. Modified: head/usr.bin/tar/bsdtar.h head/usr.bin/tar/bsdtar_platform.h Modified: head/usr.bin/tar/bsdtar.h ============================================================================== --- head/usr.bin/tar/bsdtar.h Sat Dec 6 07:30:40 2008 (r185685) +++ head/usr.bin/tar/bsdtar.h Sat Dec 6 07:37:14 2008 (r185686) @@ -131,7 +131,7 @@ enum { void bsdtar_errc(struct bsdtar *, int _eval, int _code, - const char *fmt, ...) __dead2; + const char *fmt, ...) __LA_DEAD; int bsdtar_getopt(struct bsdtar *); void bsdtar_warnc(struct bsdtar *, int _code, const char *fmt, ...); void cleanup_exclusions(struct bsdtar *); Modified: head/usr.bin/tar/bsdtar_platform.h ============================================================================== --- head/usr.bin/tar/bsdtar_platform.h Sat Dec 6 07:30:40 2008 (r185685) +++ head/usr.bin/tar/bsdtar_platform.h Sat Dec 6 07:37:14 2008 (r185686) @@ -147,4 +147,14 @@ #endif #endif +/* How to mark functions that don't return. */ +/* This facilitates use of some newer static code analysis tools. */ +#undef __LA_DEAD +#if defined(__GNUC__) && (__GNUC__ > 2 || \ + (__GNUC__ == 2 && __GNUC_MINOR__ >= 5)) +#define __LA_DEAD __attribute__((__noreturn__)) +#else +#define __LA_DEAD +#endif + #endif /* !BSDTAR_PLATFORM_H_INCLUDED */ From owner-svn-src-head@FreeBSD.ORG Sat Dec 6 07:37:56 2008 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 29755106567D; Sat, 6 Dec 2008 07:37:56 +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 187758FC27; Sat, 6 Dec 2008 07:37:56 +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 mB67btot087138; Sat, 6 Dec 2008 07:37:55 GMT (envelope-from kientzle@svn.freebsd.org) Received: (from kientzle@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mB67btkO087137; Sat, 6 Dec 2008 07:37:55 GMT (envelope-from kientzle@svn.freebsd.org) Message-Id: <200812060737.mB67btkO087137@svn.freebsd.org> From: Tim Kientzle Date: Sat, 6 Dec 2008 07:37: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: r185687 - head/usr.bin/tar X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 06 Dec 2008 07:37:56 -0000 Author: kientzle Date: Sat Dec 6 07:37:55 2008 New Revision: 185687 URL: http://svn.freebsd.org/changeset/base/185687 Log: bsdtar always supports long options now, so we can remove a documentation disclaimer. Modified: head/usr.bin/tar/bsdtar.1 Modified: head/usr.bin/tar/bsdtar.1 ============================================================================== --- head/usr.bin/tar/bsdtar.1 Sat Dec 6 07:37:14 2008 (r185686) +++ head/usr.bin/tar/bsdtar.1 Sat Dec 6 07:37:55 2008 (r185687) @@ -607,8 +607,8 @@ and .Cm w options. .Pp -On systems that support getopt_long(), additional long options -are available to improve compatibility with other tar implementations. +Additional long options are provided to improve compatibility with other +tar implementations. .Sh SECURITY Certain security issues are common to many archiving programs, including .Nm . From owner-svn-src-head@FreeBSD.ORG Sat Dec 6 07:38:14 2008 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BDC9F1065670; Sat, 6 Dec 2008 07:38: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 ACA488FC16; Sat, 6 Dec 2008 07:38:14 +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 mB67cEgC087188; Sat, 6 Dec 2008 07:38:14 GMT (envelope-from kientzle@svn.freebsd.org) Received: (from kientzle@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mB67cEFP087187; Sat, 6 Dec 2008 07:38:14 GMT (envelope-from kientzle@svn.freebsd.org) Message-Id: <200812060738.mB67cEFP087187@svn.freebsd.org> From: Tim Kientzle Date: Sat, 6 Dec 2008 07:38: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: r185688 - head/usr.bin/tar X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 06 Dec 2008 07:38:14 -0000 Author: kientzle Date: Sat Dec 6 07:38:14 2008 New Revision: 185688 URL: http://svn.freebsd.org/changeset/base/185688 Log: bsdtar is synced up with 2.5.903a Modified: head/usr.bin/tar/Makefile Modified: head/usr.bin/tar/Makefile ============================================================================== --- head/usr.bin/tar/Makefile Sat Dec 6 07:37:55 2008 (r185687) +++ head/usr.bin/tar/Makefile Sat Dec 6 07:38:14 2008 (r185688) @@ -1,7 +1,7 @@ # $FreeBSD$ PROG= bsdtar -BSDTAR_VERSION_STRING=2.5.5 +BSDTAR_VERSION_STRING=2.5.903a SRCS= bsdtar.c cmdline.c getdate.y matching.c read.c siginfo.c subst.c tree.c util.c write.c WARNS?= 5 DPADD= ${LIBARCHIVE} ${LIBBZ2} ${LIBZ} From owner-svn-src-head@FreeBSD.ORG Sat Dec 6 09:28:46 2008 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6108A1065670; Sat, 6 Dec 2008 09:28:46 +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 4F11D8FC08; Sat, 6 Dec 2008 09:28:46 +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 mB69SkGu089233; Sat, 6 Dec 2008 09:28:46 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mB69SkOL089232; Sat, 6 Dec 2008 09:28:46 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <200812060928.mB69SkOL089232@svn.freebsd.org> From: Konstantin Belousov Date: Sat, 6 Dec 2008 09: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: r185689 - head/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: Sat, 06 Dec 2008 09:28:46 -0000 Author: kib Date: Sat Dec 6 09:28:46 2008 New Revision: 185689 URL: http://svn.freebsd.org/changeset/base/185689 Log: Order the str*.c files mostly alphabetical. Submitted by: Florian Smeets MFC after: 2 weeks Modified: head/lib/libc/string/Makefile.inc Modified: head/lib/libc/string/Makefile.inc ============================================================================== --- head/lib/libc/string/Makefile.inc Sat Dec 6 07:38:14 2008 (r185688) +++ head/lib/libc/string/Makefile.inc Sat Dec 6 09:28:46 2008 (r185689) @@ -9,9 +9,9 @@ CFLAGS+= -I${.CURDIR}/locale MISRCS+=bcmp.c bcopy.c bzero.c ffs.c ffsl.c ffsll.c fls.c flsl.c flsll.c \ index.c memccpy.c memchr.c memrchr.c memcmp.c \ memcpy.c memmem.c memmove.c memset.c rindex.c stpcpy.c strcasecmp.c \ - strcat.c strchr.c strcmp.c strcoll.c strcpy.c strcspn.c strdup.c \ - strerror.c strlcat.c strlcpy.c strlen.c strmode.c strncat.c strncmp.c \ - strncpy.c strcasestr.c strnstr.c \ + strcat.c strcasestr.c strchr.c strcmp.c strcoll.c strcpy.c strcspn.c \ + strdup.c strerror.c strlcat.c strlcpy.c strlen.c strmode.c strncat.c \ + strncmp.c strncpy.c strnstr.c \ strpbrk.c strrchr.c strsep.c strsignal.c strspn.c strstr.c strtok.c \ strxfrm.c swab.c wcscat.c wcschr.c wcscmp.c wcscoll.c wcscpy.c \ wcscspn.c wcsdup.c \ From owner-svn-src-head@FreeBSD.ORG Sat Dec 6 09:37:54 2008 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 792631065673; Sat, 6 Dec 2008 09:37:54 +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 66ADA8FC14; Sat, 6 Dec 2008 09:37:54 +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 mB69bsrZ089436; Sat, 6 Dec 2008 09:37:54 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mB69bs2w089432; Sat, 6 Dec 2008 09:37:54 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <200812060937.mB69bs2w089432@svn.freebsd.org> From: Konstantin Belousov Date: Sat, 6 Dec 2008 09:37: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: r185690 - head/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: Sat, 06 Dec 2008 09:37:54 -0000 Author: kib Date: Sat Dec 6 09:37:54 2008 New Revision: 185690 URL: http://svn.freebsd.org/changeset/base/185690 Log: Import the strndup(3) function. Copyright attribution is kept the same as in original NetBSD source. Submitted by: Florian Smeets Obtained from: NetBSD MFC after: 2 weeks Added: head/lib/libc/string/strndup.c (contents, props changed) Modified: head/lib/libc/string/Makefile.inc head/lib/libc/string/Symbol.map head/lib/libc/string/strdup.3 Modified: head/lib/libc/string/Makefile.inc ============================================================================== --- head/lib/libc/string/Makefile.inc Sat Dec 6 09:28:46 2008 (r185689) +++ head/lib/libc/string/Makefile.inc Sat Dec 6 09:37:54 2008 (r185690) @@ -11,7 +11,7 @@ MISRCS+=bcmp.c bcopy.c bzero.c ffs.c ffs memcpy.c memmem.c memmove.c memset.c rindex.c stpcpy.c strcasecmp.c \ strcat.c strcasestr.c strchr.c strcmp.c strcoll.c strcpy.c strcspn.c \ strdup.c strerror.c strlcat.c strlcpy.c strlen.c strmode.c strncat.c \ - strncmp.c strncpy.c strnstr.c \ + strncmp.c strncpy.c strndup.c strnstr.c \ strpbrk.c strrchr.c strsep.c strsignal.c strspn.c strstr.c strtok.c \ strxfrm.c swab.c wcscat.c wcschr.c wcscmp.c wcscoll.c wcscpy.c \ wcscspn.c wcsdup.c \ @@ -47,6 +47,7 @@ MLINKS+=strcat.3 strncat.3 MLINKS+=strchr.3 strrchr.3 MLINKS+=strcmp.3 strncmp.3 MLINKS+=strcpy.3 stpcpy.3 +MLINKS+=strdup.3 strndup.3 MLINKS+=strcpy.3 strncpy.3 MLINKS+=strerror.3 perror.3 strerror.3 sys_errlist.3 strerror.3 sys_nerr.3 MLINKS+=strerror.3 strerror_r.3 Modified: head/lib/libc/string/Symbol.map ============================================================================== --- head/lib/libc/string/Symbol.map Sat Dec 6 09:28:46 2008 (r185689) +++ head/lib/libc/string/Symbol.map Sat Dec 6 09:37:54 2008 (r185690) @@ -81,6 +81,7 @@ FBSD_1.1 { ffsll; flsll; memrchr; + strndup; }; FBSDprivate_1.0 { Modified: head/lib/libc/string/strdup.3 ============================================================================== --- head/lib/libc/string/strdup.3 Sat Dec 6 09:28:46 2008 (r185689) +++ head/lib/libc/string/strdup.3 Sat Dec 6 09:37:54 2008 (r185690) @@ -28,11 +28,12 @@ .\" @(#)strdup.3 8.1 (Berkeley) 6/9/93 .\" $FreeBSD$ .\" -.Dd June 9, 1993 +.Dd Dec 5, 2008 .Dt STRDUP 3 .Os .Sh NAME -.Nm strdup +.Nm strdup , +.Nm strndup .Nd save a copy of a string .Sh LIBRARY .Lb libc @@ -40,6 +41,8 @@ .In string.h .Ft char * .Fn strdup "const char *str" +.Ft char * +.Fn strndup "const char *str" "size_t len" .Sh DESCRIPTION The .Fn strdup @@ -56,6 +59,16 @@ If insufficient memory is available, NUL .Va errno is set to .Er ENOMEM . +.Pp +The +.Fn strndup +function copies at most +.Fa len +characters from the string +.Fa str +always +.Dv NUL +terminating the copied string. .Sh SEE ALSO .Xr free 3 , .Xr malloc 3 @@ -64,3 +77,7 @@ The .Fn strdup function first appeared in .Bx 4.4 . +The +.Fn strndup +function was added in +.Fx 8.0 . Added: head/lib/libc/string/strndup.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/lib/libc/string/strndup.c Sat Dec 6 09:37:54 2008 (r185690) @@ -0,0 +1,53 @@ +/* $NetBSD: strndup.c,v 1.3 2007/01/14 23:41:24 cbiere Exp $ */ + +/* + * Copyright (c) 1988, 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 +#include +#include + +char * +strndup(const char *str, size_t n) +{ + size_t len; + char *copy; + + for (len = 0; len < n && str[len]; len++) + continue; + + if ((copy = malloc(len + 1)) == NULL) + return (NULL); + memcpy(copy, str, len); + copy[len] = '\0'; + return (copy); +} From owner-svn-src-head@FreeBSD.ORG Sat Dec 6 10:34:24 2008 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8D3021065679; Sat, 6 Dec 2008 10:34:24 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail12.syd.optusnet.com.au (mail12.syd.optusnet.com.au [211.29.132.193]) by mx1.freebsd.org (Postfix) with ESMTP id 0EA3B8FC16; Sat, 6 Dec 2008 10:34:23 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from c122-106-153-252.carlnfd1.nsw.optusnet.com.au (c122-106-153-252.carlnfd1.nsw.optusnet.com.au [122.106.153.252]) by mail12.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id mB6AYKJl003642 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Sat, 6 Dec 2008 21:34:22 +1100 Date: Sat, 6 Dec 2008 21:34:21 +1100 (EST) From: Bruce Evans X-X-Sender: bde@delplex.bde.org To: Tim Kientzle In-Reply-To: <200812060715.mB67FgVA086614@svn.freebsd.org> Message-ID: <20081206212307.X5659@delplex.bde.org> References: <200812060715.mB67FgVA086614@svn.freebsd.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org Subject: Re: svn commit: r185684 - head/usr.bin/cpio X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 06 Dec 2008 10:34:24 -0000 On Sat, 6 Dec 2008, Tim Kientzle wrote: > Log: > Make the GCC-specific __dead2 markers conditional on whether > we're compiling under GCC. These are FreeBSD-specific. __dead is 4.4BSD-specific, but hasn't done anything since gcc-1.x. Though I added __dead2 to support gcc-2 in 1994, 4.4BSD didn't have it, and NetBSD 4 years ago doesn't define it or otherwise support the noreturn attribute in . Bruce From owner-svn-src-head@FreeBSD.ORG Sat Dec 6 11:21:10 2008 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DFA5D1065672; Sat, 6 Dec 2008 11:21:10 +0000 (UTC) (envelope-from danger@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id CE8028FC08; Sat, 6 Dec 2008 11:21:10 +0000 (UTC) (envelope-from danger@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mB6BLAY7092550; Sat, 6 Dec 2008 11:21:10 GMT (envelope-from danger@svn.freebsd.org) Received: (from danger@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mB6BLAXT092549; Sat, 6 Dec 2008 11:21:10 GMT (envelope-from danger@svn.freebsd.org) Message-Id: <200812061121.mB6BLAXT092549@svn.freebsd.org> From: Daniel Gerzo Date: Sat, 6 Dec 2008 11:21: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: r185692 - head/sys/boot/common X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 06 Dec 2008 11:21:11 -0000 Author: danger (doc committer) Date: Sat Dec 6 11:21:10 2008 New Revision: 185692 URL: http://svn.freebsd.org/changeset/base/185692 Log: - correct variable name PR: docs/129448 Submitted by: Kenyon Ralph MFC after: Revision 1.91 is merged Modified: head/sys/boot/common/loader.8 Modified: head/sys/boot/common/loader.8 ============================================================================== --- head/sys/boot/common/loader.8 Sat Dec 6 09:38:41 2008 (r185691) +++ head/sys/boot/common/loader.8 Sat Dec 6 11:21:10 2008 (r185692) @@ -454,7 +454,7 @@ if the script terminates with a non-zero or if a SIGTERM is delivered to the .Xr init 8 process (PID 1). -.It Va init_script +.It Va init_shell Defines the shell binary to be used for executing the various shell scripts. The default is .Dq Li /bin/sh . From owner-svn-src-head@FreeBSD.ORG Sat Dec 6 11:33:10 2008 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D1B0A1065675; Sat, 6 Dec 2008 11:33:10 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C096B8FC12; Sat, 6 Dec 2008 11:33:10 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mB6BXA4G092812; Sat, 6 Dec 2008 11:33:10 GMT (envelope-from trasz@svn.freebsd.org) Received: (from trasz@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mB6BXA1S092810; Sat, 6 Dec 2008 11:33:10 GMT (envelope-from trasz@svn.freebsd.org) Message-Id: <200812061133.mB6BXA1S092810@svn.freebsd.org> From: Edward Tomasz Napierala Date: Sat, 6 Dec 2008 11:33: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: r185693 - head/sys/geom/journal X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 06 Dec 2008 11:33:11 -0000 Author: trasz Date: Sat Dec 6 11:33:10 2008 New Revision: 185693 URL: http://svn.freebsd.org/changeset/base/185693 Log: Make it possible to use gjournal for the root filesystem. Previously, an unclean shutdown would make it impossible to mount rootfs at boot. PR: kern/128529 Reviewed by: pjd Approved by: rwatson (mentor) Sponsored by: FreeBSD Foundation Modified: head/sys/geom/journal/g_journal.c head/sys/geom/journal/g_journal.h Modified: head/sys/geom/journal/g_journal.c ============================================================================== --- head/sys/geom/journal/g_journal.c Sat Dec 6 11:21:10 2008 (r185692) +++ head/sys/geom/journal/g_journal.c Sat Dec 6 11:33:10 2008 (r185693) @@ -2108,6 +2108,12 @@ g_journal_worker(void *arg) g_topology_unlock(); last_write = time_second; + if (sc->sc_rootmount != NULL) { + GJ_DEBUG(1, "root_mount_rel %p", sc->sc_rootmount); + root_mount_rel(sc->sc_rootmount); + sc->sc_rootmount = NULL; + } + for (;;) { /* Get first request from the queue. */ mtx_lock(&sc->sc_mtx); @@ -2304,6 +2310,9 @@ g_journal_create(struct g_class *mp, str sc->sc_inactive.jj_queue = NULL; sc->sc_active.jj_queue = NULL; + sc->sc_rootmount = root_mount_hold("GJOURNAL"); + GJ_DEBUG(1, "root_mount_hold %p", sc->sc_rootmount); + callout_init(&sc->sc_callout, CALLOUT_MPSAFE); if (md->md_type != GJ_TYPE_COMPLETE) { /* @@ -2434,6 +2443,13 @@ g_journal_destroy(struct g_journal_softc sc->sc_flags |= (GJF_DEVICE_DESTROY | GJF_DEVICE_CLEAN); g_topology_unlock(); + + if (sc->sc_rootmount != NULL) { + GJ_DEBUG(1, "root_mount_rel %p", sc->sc_rootmount); + root_mount_rel(sc->sc_rootmount); + sc->sc_rootmount = NULL; + } + callout_drain(&sc->sc_callout); mtx_lock(&sc->sc_mtx); wakeup(sc); Modified: head/sys/geom/journal/g_journal.h ============================================================================== --- head/sys/geom/journal/g_journal.h Sat Dec 6 11:21:10 2008 (r185692) +++ head/sys/geom/journal/g_journal.h Sat Dec 6 11:33:10 2008 (r185693) @@ -163,6 +163,8 @@ struct g_journal_softc { struct callout sc_callout; struct proc *sc_worker; + + struct root_hold_token *sc_rootmount; }; #define sc_dprovider sc_dconsumer->provider #define sc_jprovider sc_jconsumer->provider From owner-svn-src-head@FreeBSD.ORG Sat Dec 6 13:19:54 2008 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B70F1106564A; Sat, 6 Dec 2008 13:19:54 +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 A49228FC08; Sat, 6 Dec 2008 13:19:54 +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 mB6DJseb094958; Sat, 6 Dec 2008 13:19:54 GMT (envelope-from rrs@svn.freebsd.org) Received: (from rrs@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mB6DJs0g094953; Sat, 6 Dec 2008 13:19:54 GMT (envelope-from rrs@svn.freebsd.org) Message-Id: <200812061319.mB6DJs0g094953@svn.freebsd.org> From: Randall Stewart Date: Sat, 6 Dec 2008 13:19: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: r185694 - 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: Sat, 06 Dec 2008 13:19:54 -0000 Author: rrs Date: Sat Dec 6 13:19:54 2008 New Revision: 185694 URL: http://svn.freebsd.org/changeset/base/185694 Log: Code from the hack-session known as the IETF (and a bit of debugging afterwards): - Fix protection code for notification generation. - Decouple associd from vtag - Allow vtags to have less strigent requirements in non-uniqueness. o don't pre-hash them when you issue one in a cookie. o Allow duplicates and use addresses and ports to discriminate amongst the duplicates during lookup. - Add support for the NAT draft draft-ietf-behave-sctpnat-00, this is still experimental and needs more extensive testing with the Jason Butt ipfw changes. - Support for the SENDER_DRY event to get DTLS in OpenSSL working with a set of patches from Michael Tuexen (hopefully heading to OpenSSL soon). - Update the support of SCTP-AUTH by Peter Lei. - Use macros for refcounting. - Fix MTU for UDP encapsulation. - Fix reporting back of unsent data. - Update assoc send counter handling to be consistent with endpoint sent counter. - Fix a bug in PR-SCTP. - Fix so we only send another FWD-TSN when a SACK arrives IF and only if the adv-peer-ack point progressed. However we still make sure a timer is running if we do have an adv_peer_ack point. - Fix PR-SCTP bug where chunks were retransmitted if they are sent unreliable but not abandoned yet. With the help of: Michael Teuxen and Peter Lei :-) MFC after: 4 weeks Modified: head/sys/netinet/sctp.h head/sys/netinet/sctp_asconf.c head/sys/netinet/sctp_asconf.h head/sys/netinet/sctp_auth.c head/sys/netinet/sctp_auth.h head/sys/netinet/sctp_constants.h head/sys/netinet/sctp_header.h head/sys/netinet/sctp_indata.c head/sys/netinet/sctp_indata.h head/sys/netinet/sctp_input.c head/sys/netinet/sctp_os_bsd.h head/sys/netinet/sctp_output.c head/sys/netinet/sctp_output.h head/sys/netinet/sctp_pcb.c head/sys/netinet/sctp_pcb.h head/sys/netinet/sctp_structs.h head/sys/netinet/sctp_sysctl.c head/sys/netinet/sctp_sysctl.h head/sys/netinet/sctp_timer.c head/sys/netinet/sctp_uio.h head/sys/netinet/sctp_usrreq.c head/sys/netinet/sctp_var.h head/sys/netinet/sctputil.c head/sys/netinet/sctputil.h head/sys/netinet6/sctp6_usrreq.c Modified: head/sys/netinet/sctp.h ============================================================================== --- head/sys/netinet/sctp.h Sat Dec 6 11:33:10 2008 (r185693) +++ head/sys/netinet/sctp.h Sat Dec 6 13:19:54 2008 (r185694) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2001-2007, by Cisco Systems, Inc. All rights reserved. + * Copyright (c) 2001-2008, by Cisco Systems, Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: @@ -111,6 +111,7 @@ struct sctp_paramhdr { /* explict EOR signalling */ #define SCTP_EXPLICIT_EOR 0x0000001b #define SCTP_REUSE_PORT 0x0000001c /* rw */ +#define SCTP_AUTH_DEACTIVATE_KEY 0x0000001d /* * read-only options @@ -154,6 +155,8 @@ struct sctp_paramhdr { /* CMT ON/OFF socket option */ #define SCTP_CMT_ON_OFF 0x00001200 #define SCTP_CMT_USE_DAC 0x00001201 +/* EY - NR_SACK on/off socket option */ +#define SCTP_NR_SACK_ON_OFF 0x00001300 /* JRS - Pluggable Congestion Control Socket option */ #define SCTP_PLUGGABLE_CC 0x00001202 @@ -293,11 +296,15 @@ struct sctp_paramhdr { #define SCTP_CAUSE_PROTOCOL_VIOLATION 0x000d /* Error causes from RFC5061 */ -#define SCTP_CAUSE_DELETING_LAST_ADDR 0xa0 -#define SCTP_CAUSE_RESOURCE_SHORTAGE 0xa1 -#define SCTP_CAUSE_DELETING_SRC_ADDR 0xa2 -#define SCTP_CAUSE_ILLEGAL_ASCONF_ACK 0xa3 -#define SCTP_CAUSE_REQUEST_REFUSED 0xa4 +#define SCTP_CAUSE_DELETING_LAST_ADDR 0x00a0 +#define SCTP_CAUSE_RESOURCE_SHORTAGE 0x00a1 +#define SCTP_CAUSE_DELETING_SRC_ADDR 0x00a2 +#define SCTP_CAUSE_ILLEGAL_ASCONF_ACK 0x00a3 +#define SCTP_CAUSE_REQUEST_REFUSED 0x00a4 + +/* Error causes from nat-draft */ +#define SCTP_CAUSE_NAT_COLLIDING_STATE 0x00b0 +#define SCTP_CAUSE_NAT_MISSING_STATE 0x00b1 /* Error causes from RFC4895 */ #define SCTP_CAUSE_UNSUPPORTED_HMACID 0x0105 @@ -364,6 +371,8 @@ struct sctp_error_unrecognized_chunk { #define SCTP_SHUTDOWN_COMPLETE 0x0e /* RFC4895 */ #define SCTP_AUTHENTICATION 0x0f +/* EY nr_sack chunk id*/ +#define SCTP_NR_SELECTIVE_ACK 0x10 /************0x40 series ***********/ /************0x80 series ***********/ /* RFC5061 */ @@ -406,6 +415,9 @@ struct sctp_error_unrecognized_chunk { /* ECN Nonce: SACK Chunk Specific Flags */ #define SCTP_SACK_NONCE_SUM 0x01 +/* EY nr_sack all bit - All bit is the 2nd LSB of nr_sack chunk flags*/ +/* if All bit is set in an nr-sack chunk, then all nr gap acks gap acks*/ +#define SCTP_NR_SACK_ALL_BIT 0x02 /* CMT DAC algorithm SACK flag */ #define SCTP_SACK_CMT_DAC 0x80 @@ -467,6 +479,7 @@ struct sctp_error_unrecognized_chunk { #define SCTP_PCB_FLAGS_NEEDS_MAPPED_V4 0x00800000 #define SCTP_PCB_FLAGS_MULTIPLE_ASCONFS 0x01000000 #define SCTP_PCB_FLAGS_PORTREUSE 0x02000000 +#define SCTP_PCB_FLAGS_DRYEVNT 0x04000000 /*- * mobility_features parameters (by micchie).Note * these features are applied against the Modified: head/sys/netinet/sctp_asconf.c ============================================================================== --- head/sys/netinet/sctp_asconf.c Sat Dec 6 11:33:10 2008 (r185693) +++ head/sys/netinet/sctp_asconf.c Sat Dec 6 13:19:54 2008 (r185694) @@ -761,6 +761,9 @@ sctp_handle_asconf(struct mbuf *m, unsig m_result = sctp_process_asconf_set_primary(m, aph, stcb, error); break; + case SCTP_NAT_VTAGS: + SCTPDBG(SCTP_DEBUG_ASCONF1, "handle_asconf: sees a NAT VTAG state parameter\n"); + break; case SCTP_SUCCESS_REPORT: /* not valid in an ASCONF chunk */ break; @@ -1349,6 +1352,7 @@ sctp_asconf_queue_mgmt(struct sctp_tcb * SCTPDBG(SCTP_DEBUG_ASCONF1, "asconf_queue_mgmt: failed to get memory!\n"); return (-1); } + aa->special_del = 0; /* fill in asconf address parameter fields */ /* top level elements are "networked" during send */ aa->ap.aph.ph.param_type = type; @@ -1555,6 +1559,7 @@ sctp_asconf_queue_sa_delete(struct sctp_ "sctp_asconf_queue_sa_delete: failed to get memory!\n"); return (-1); } + aa->special_del = 0; /* fill in asconf address parameter fields */ /* top level elements are "networked" during send */ aa->ap.aph.ph.param_type = SCTP_DEL_IP_ADDRESS; @@ -2691,6 +2696,7 @@ sctp_compose_asconf(struct sctp_tcb *stc * case) */ if (lookup_used == 0 && + (aa->special_del == 0) && aa->ap.aph.ph.param_type == SCTP_DEL_IP_ADDRESS) { struct sctp_ipv6addr_param *lookup; uint16_t p_size, addr_size; @@ -3234,3 +3240,195 @@ sctp_addr_mgmt_ep_sa(struct sctp_inpcb * } return (0); } + +void +sctp_asconf_send_nat_state_update(struct sctp_tcb *stcb, + struct sctp_nets *net) +{ + struct sctp_asconf_addr *aa; + struct sctp_ifa *sctp_ifap; + struct sctp_asconf_tag_param *vtag; + struct sockaddr_in *to; + +#ifdef INET6 + struct sockaddr_in6 *to6; + +#endif + if (net == NULL) { + SCTPDBG(SCTP_DEBUG_ASCONF1, "sctp_asconf_send_nat_state_update: Missing net\n"); + return; + } + if (stcb == NULL) { + SCTPDBG(SCTP_DEBUG_ASCONF1, "sctp_asconf_send_nat_state_update: Missing stcb\n"); + return; + } + /* + * Need to have in the asconf: - vtagparam(my_vtag/peer_vtag) - + * add(0.0.0.0) - del(0.0.0.0) - Any global addresses add(addr) + */ + SCTP_MALLOC(aa, struct sctp_asconf_addr *, sizeof(*aa), + SCTP_M_ASC_ADDR); + if (aa == NULL) { + /* didn't get memory */ + SCTPDBG(SCTP_DEBUG_ASCONF1, + "sctp_asconf_send_nat_state_update: failed to get memory!\n"); + return; + } + aa->special_del = 0; + /* fill in asconf address parameter fields */ + /* top level elements are "networked" during send */ + aa->ifa = NULL; + aa->sent = 0; /* clear sent flag */ + vtag = (struct sctp_asconf_tag_param *)&aa->ap.aph; + vtag->aph.ph.param_type = SCTP_NAT_VTAGS; + vtag->aph.ph.param_length = sizeof(struct sctp_asconf_tag_param); + vtag->local_vtag = htonl(stcb->asoc.my_vtag); + vtag->remote_vtag = htonl(stcb->asoc.peer_vtag); + TAILQ_INSERT_TAIL(&stcb->asoc.asconf_queue, aa, next); + + SCTP_MALLOC(aa, struct sctp_asconf_addr *, sizeof(*aa), + SCTP_M_ASC_ADDR); + if (aa == NULL) { + /* didn't get memory */ + SCTPDBG(SCTP_DEBUG_ASCONF1, + "sctp_asconf_send_nat_state_update: failed to get memory!\n"); + return; + } + memset(aa, 0, sizeof(struct sctp_asconf_addr)); + /* fill in asconf address parameter fields */ + /* ADD(0.0.0.0) */ + if (net->ro._l_addr.sa.sa_family == AF_INET) { + aa->ap.aph.ph.param_type = SCTP_ADD_IP_ADDRESS; + aa->ap.aph.ph.param_length = sizeof(struct sctp_asconf_addrv4_param); + aa->ap.addrp.ph.param_type = SCTP_IPV4_ADDRESS; + aa->ap.addrp.ph.param_length = sizeof(struct sctp_ipv4addr_param); + /* No need to add an address, we are using 0.0.0.0 */ + TAILQ_INSERT_TAIL(&stcb->asoc.asconf_queue, aa, next); + } +#ifdef INET6 + else if (net->ro._l_addr.sa.sa_family == AF_INET6) { + aa->ap.aph.ph.param_type = SCTP_ADD_IP_ADDRESS; + aa->ap.aph.ph.param_length = sizeof(struct sctp_asconf_addr_param); + aa->ap.addrp.ph.param_type = SCTP_IPV6_ADDRESS; + aa->ap.addrp.ph.param_length = sizeof(struct sctp_ipv6addr_param); + /* No need to add an address, we are using 0.0.0.0 */ + TAILQ_INSERT_TAIL(&stcb->asoc.asconf_queue, aa, next); + } +#endif /* INET6 */ + SCTP_MALLOC(aa, struct sctp_asconf_addr *, sizeof(*aa), + SCTP_M_ASC_ADDR); + if (aa == NULL) { + /* didn't get memory */ + SCTPDBG(SCTP_DEBUG_ASCONF1, + "sctp_asconf_send_nat_state_update: failed to get memory!\n"); + return; + } + memset(aa, 0, sizeof(struct sctp_asconf_addr)); + /* fill in asconf address parameter fields */ + /* ADD(0.0.0.0) */ + if (net->ro._l_addr.sa.sa_family == AF_INET) { + aa->ap.aph.ph.param_type = SCTP_ADD_IP_ADDRESS; + aa->ap.aph.ph.param_length = sizeof(struct sctp_asconf_addrv4_param); + aa->ap.addrp.ph.param_type = SCTP_IPV4_ADDRESS; + aa->ap.addrp.ph.param_length = sizeof(struct sctp_ipv4addr_param); + /* No need to add an address, we are using 0.0.0.0 */ + TAILQ_INSERT_TAIL(&stcb->asoc.asconf_queue, aa, next); + } +#ifdef INET6 + else if (net->ro._l_addr.sa.sa_family == AF_INET6) { + aa->ap.aph.ph.param_type = SCTP_DEL_IP_ADDRESS; + aa->ap.aph.ph.param_length = sizeof(struct sctp_asconf_addr_param); + aa->ap.addrp.ph.param_type = SCTP_IPV6_ADDRESS; + aa->ap.addrp.ph.param_length = sizeof(struct sctp_ipv6addr_param); + /* No need to add an address, we are using 0.0.0.0 */ + TAILQ_INSERT_TAIL(&stcb->asoc.asconf_queue, aa, next); + } +#endif /* INET6 */ + /* Now we must hunt the addresses and add all global addresses */ + if (stcb->sctp_ep->sctp_flags & SCTP_PCB_FLAGS_BOUNDALL) { + struct sctp_vrf *vrf = NULL; + struct sctp_ifn *sctp_ifnp; + uint32_t vrf_id; + + vrf_id = stcb->sctp_ep->def_vrf_id; + vrf = sctp_find_vrf(vrf_id); + if (vrf == NULL) { + goto skip_rest; + } + SCTP_IPI_ADDR_RLOCK(); + LIST_FOREACH(sctp_ifnp, &vrf->ifnlist, next_ifn) { + LIST_FOREACH(sctp_ifap, &sctp_ifnp->ifalist, next_ifa) { + if (sctp_ifap->address.sa.sa_family == AF_INET) { + to = &sctp_ifap->address.sin; + + if (IN4_ISPRIVATE_ADDRESS(&to->sin_addr)) { + continue; + } + if (IN4_ISLOOPBACK_ADDRESS(&to->sin_addr)) { + continue; + } + } +#ifdef INET6 + else if (sctp_ifap->address.sa.sa_family == AF_INET6) { + to6 = &sctp_ifap->address.sin6; + if (IN6_IS_ADDR_LOOPBACK(&to6->sin6_addr)) { + continue; + } + if (IN6_IS_ADDR_LINKLOCAL(&to6->sin6_addr)) { + continue; + } + } +#endif + sctp_asconf_queue_mgmt(stcb, sctp_ifap, SCTP_ADD_IP_ADDRESS); + } + } + SCTP_IPI_ADDR_RUNLOCK(); + } else { + struct sctp_laddr *laddr; + + LIST_FOREACH(laddr, &stcb->sctp_ep->sctp_addr_list, sctp_nxt_addr) { + if (laddr->ifa == NULL) { + continue; + } + if (laddr->ifa->localifa_flags & SCTP_BEING_DELETED) + /* + * Address being deleted by the system, dont + * list. + */ + continue; + if (laddr->action == SCTP_DEL_IP_ADDRESS) { + /* + * Address being deleted on this ep don't + * list. + */ + continue; + } + sctp_ifap = laddr->ifa; + if (sctp_ifap->address.sa.sa_family == AF_INET) { + to = &sctp_ifap->address.sin; + + if (IN4_ISPRIVATE_ADDRESS(&to->sin_addr)) { + continue; + } + if (IN4_ISLOOPBACK_ADDRESS(&to->sin_addr)) { + continue; + } + } +#ifdef INET6 + else if (sctp_ifap->address.sa.sa_family == AF_INET6) { + to6 = &sctp_ifap->address.sin6; + if (IN6_IS_ADDR_LOOPBACK(&to6->sin6_addr)) { + continue; + } + if (IN6_IS_ADDR_LINKLOCAL(&to6->sin6_addr)) { + continue; + } + } +#endif + sctp_asconf_queue_mgmt(stcb, sctp_ifap, SCTP_ADD_IP_ADDRESS); + } + } +skip_rest: + /* Now we must send the asconf into the queue */ + sctp_send_asconf(stcb, net, 0); +} Modified: head/sys/netinet/sctp_asconf.h ============================================================================== --- head/sys/netinet/sctp_asconf.h Sat Dec 6 11:33:10 2008 (r185693) +++ head/sys/netinet/sctp_asconf.h Sat Dec 6 13:19:54 2008 (r185694) @@ -86,6 +86,10 @@ extern void extern void sctp_net_immediate_retrans(struct sctp_tcb *, struct sctp_nets *); +extern void +sctp_asconf_send_nat_state_update(struct sctp_tcb *stcb, + struct sctp_nets *net); + extern int sctp_is_addr_pending(struct sctp_tcb *, struct sctp_ifa *); Modified: head/sys/netinet/sctp_auth.c ============================================================================== --- head/sys/netinet/sctp_auth.c Sat Dec 6 11:33:10 2008 (r185693) +++ head/sys/netinet/sctp_auth.c Sat Dec 6 13:19:54 2008 (r185694) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2001-2007, by Cisco Systems, Inc. All rights reserved. + * Copyright (c) 2001-2008, by Cisco Systems, Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: @@ -359,9 +359,11 @@ sctp_set_key(uint8_t * key, uint32_t key return (new_key); } -/* +/*- * given two keys of variable size, compute which key is "larger/smaller" - * returns: 1 if key1 > key2 -1 if key1 < key2 0 if key1 = key2 + * returns: 1 if key1 > key2 + * -1 if key1 < key2 + * 0 if key1 = key2 */ static int sctp_compare_key(sctp_key_t * key1, sctp_key_t * key2) @@ -531,13 +533,18 @@ sctp_alloc_sharedkey(void) } new_key->keyid = 0; new_key->key = NULL; + new_key->refcount = 1; + new_key->deactivated = 0; return (new_key); } void sctp_free_sharedkey(sctp_sharedkey_t * skey) { - if (skey != NULL) { + if (skey == NULL) + return; + + if (SCTP_DECREMENT_AND_CHECK_REFCOUNT(&skey->refcount)) { if (skey->key != NULL) sctp_free_key(skey->key); SCTP_FREE(skey, SCTP_M_AUTH_KY); @@ -556,40 +563,93 @@ sctp_find_sharedkey(struct sctp_keyhead return (NULL); } -void +int sctp_insert_sharedkey(struct sctp_keyhead *shared_keys, sctp_sharedkey_t * new_skey) { sctp_sharedkey_t *skey; if ((shared_keys == NULL) || (new_skey == NULL)) - return; + return (EINVAL); /* insert into an empty list? */ if (SCTP_LIST_EMPTY(shared_keys)) { LIST_INSERT_HEAD(shared_keys, new_skey, next); - return; + return (0); } /* insert into the existing list, ordered by key id */ LIST_FOREACH(skey, shared_keys, next) { if (new_skey->keyid < skey->keyid) { /* insert it before here */ LIST_INSERT_BEFORE(skey, new_skey, next); - return; + return (0); } else if (new_skey->keyid == skey->keyid) { /* replace the existing key */ + /* verify this key *can* be replaced */ + if ((skey->deactivated) && (skey->refcount > 1)) { + SCTPDBG(SCTP_DEBUG_AUTH1, + "can't replace shared key id %u\n", + new_skey->keyid); + return (EBUSY); + } SCTPDBG(SCTP_DEBUG_AUTH1, "replacing shared key id %u\n", new_skey->keyid); LIST_INSERT_BEFORE(skey, new_skey, next); LIST_REMOVE(skey, next); sctp_free_sharedkey(skey); - return; + return (0); } if (LIST_NEXT(skey, next) == NULL) { /* belongs at the end of the list */ LIST_INSERT_AFTER(skey, new_skey, next); - return; + return (0); + } + } + /* shouldn't reach here */ + return (0); +} + +void +sctp_auth_key_acquire(struct sctp_tcb *stcb, uint16_t key_id) +{ + sctp_sharedkey_t *skey; + + /* find the shared key */ + skey = sctp_find_sharedkey(&stcb->asoc.shared_keys, key_id); + + /* bump the ref count */ + if (skey) { + atomic_add_int(&skey->refcount, 1); + SCTPDBG(SCTP_DEBUG_AUTH2, + "%s: stcb %p key %u refcount acquire to %d\n", + __FUNCTION__, stcb, key_id, skey->refcount); + } +} + +void +sctp_auth_key_release(struct sctp_tcb *stcb, uint16_t key_id) +{ + sctp_sharedkey_t *skey; + + /* find the shared key */ + skey = sctp_find_sharedkey(&stcb->asoc.shared_keys, key_id); + + /* decrement the ref count */ + if (skey) { + sctp_free_sharedkey(skey); + SCTPDBG(SCTP_DEBUG_AUTH2, + "%s: stcb %p key %u refcount release to %d\n", + __FUNCTION__, stcb, key_id, skey->refcount); + + /* see if a notification should be generated */ + if ((skey->refcount <= 1) && (skey->deactivated)) { + /* notify ULP that key is no longer used */ + sctp_ulp_notify(SCTP_NOTIFY_AUTH_FREE_KEY, stcb, + key_id, 0, SCTP_SO_NOT_LOCKED); + SCTPDBG(SCTP_DEBUG_AUTH2, + "%s: stcb %p key %u no longer used, %d\n", + __FUNCTION__, stcb, key_id, skey->refcount); } } } @@ -623,7 +683,7 @@ sctp_copy_skeylist(const struct sctp_key LIST_FOREACH(skey, src, next) { new_skey = sctp_copy_sharedkey(skey); if (new_skey != NULL) { - sctp_insert_sharedkey(dest, new_skey); + (void)sctp_insert_sharedkey(dest, new_skey); count++; } } @@ -727,9 +787,9 @@ sctp_default_supported_hmaclist(void) return (new_list); } -/* - * HMAC algos are listed in priority/preference order find the best HMAC id - * to use for the peer based on local support +/*- + * HMAC algos are listed in priority/preference order + * find the best HMAC id to use for the peer based on local support */ uint16_t sctp_negotiate_hmacid(sctp_hmaclist_t * peer, sctp_hmaclist_t * local) @@ -760,9 +820,9 @@ sctp_negotiate_hmacid(sctp_hmaclist_t * return (SCTP_AUTH_HMAC_ID_RSVD); } -/* - * serialize the HMAC algo list and return space used caller must guarantee - * ptr has appropriate space +/*- + * serialize the HMAC algo list and return space used + * caller must guarantee ptr has appropriate space */ int sctp_serialize_hmaclist(sctp_hmaclist_t * list, uint8_t * ptr) @@ -994,7 +1054,7 @@ sctp_hmac_final(uint16_t hmac_algo, sctp } /* end switch */ } -/* +/*- * Keyed-Hashing for Message Authentication: FIPS 198 (RFC 2104) * * Compute the HMAC digest using the desired hash key, text, and HMAC @@ -1142,9 +1202,10 @@ sctp_hmac_m(uint16_t hmac_algo, uint8_t return (digestlen); } -/* +/*- * verify the HMAC digest using the desired hash key, text, and HMAC - * algorithm. Returns -1 on error, 0 on success. + * algorithm. + * Returns -1 on error, 0 on success. */ int sctp_verify_hmac(uint16_t hmac_algo, uint8_t * key, uint32_t keylen, @@ -1263,10 +1324,10 @@ sctp_auth_is_supported_hmac(sctp_hmaclis } -/* - * clear any cached key(s) if they match the given key id on an association - * the cached key(s) will be recomputed and re-cached at next use. ASSUMES - * TCB_LOCK is already held +/*- + * clear any cached key(s) if they match the given key id on an association. + * the cached key(s) will be recomputed and re-cached at next use. + * ASSUMES TCB_LOCK is already held */ void sctp_clear_cachedkeys(struct sctp_tcb *stcb, uint16_t keyid) @@ -1284,9 +1345,10 @@ sctp_clear_cachedkeys(struct sctp_tcb *s } } -/* +/*- * clear any cached key(s) if they match the given key id for all assocs on - * an association ASSUMES INP_WLOCK is already held + * an endpoint. + * ASSUMES INP_WLOCK is already held */ void sctp_clear_cachedkeys_ep(struct sctp_inpcb *inp, uint16_t keyid) @@ -1304,8 +1366,9 @@ sctp_clear_cachedkeys_ep(struct sctp_inp } } -/* - * delete a shared key from an association ASSUMES TCB_LOCK is already held +/*- + * delete a shared key from an association + * ASSUMES TCB_LOCK is already held */ int sctp_delete_sharedkey(struct sctp_tcb *stcb, uint16_t keyid) @@ -1316,7 +1379,7 @@ sctp_delete_sharedkey(struct sctp_tcb *s return (-1); /* is the keyid the assoc active sending key */ - if (keyid == stcb->asoc.authinfo.assoc_keyid) + if (keyid == stcb->asoc.authinfo.active_keyid) return (-1); /* does the key exist? */ @@ -1324,6 +1387,10 @@ sctp_delete_sharedkey(struct sctp_tcb *s if (skey == NULL) return (-1); + /* are there other refcount holders on the key? */ + if (skey->refcount > 1) + return (-1); + /* remove it */ LIST_REMOVE(skey, next); sctp_free_sharedkey(skey); /* frees skey->key as well */ @@ -1333,35 +1400,29 @@ sctp_delete_sharedkey(struct sctp_tcb *s return (0); } -/* - * deletes a shared key from the endpoint ASSUMES INP_WLOCK is already held +/*- + * deletes a shared key from the endpoint + * ASSUMES INP_WLOCK is already held */ int sctp_delete_sharedkey_ep(struct sctp_inpcb *inp, uint16_t keyid) { sctp_sharedkey_t *skey; - struct sctp_tcb *stcb; if (inp == NULL) return (-1); - /* is the keyid the active sending key on the endpoint or any assoc */ + /* is the keyid the active sending key on the endpoint */ if (keyid == inp->sctp_ep.default_keyid) return (-1); - LIST_FOREACH(stcb, &inp->sctp_asoc_list, sctp_tcblist) { - SCTP_TCB_LOCK(stcb); - if (keyid == stcb->asoc.authinfo.assoc_keyid) { - SCTP_TCB_UNLOCK(stcb); - return (-1); - } - SCTP_TCB_UNLOCK(stcb); - } /* does the key exist? */ skey = sctp_find_sharedkey(&inp->sctp_ep.shared_keys, keyid); if (skey == NULL) return (-1); + /* endpoint keys are not refcounted */ + /* remove it */ LIST_REMOVE(skey, next); sctp_free_sharedkey(skey); /* frees skey->key as well */ @@ -1371,60 +1432,36 @@ sctp_delete_sharedkey_ep(struct sctp_inp return (0); } -/* - * set the active key on an association ASSUME TCB_LOCK is already held +/*- + * set the active key on an association + * ASSUMES TCB_LOCK is already held */ int sctp_auth_setactivekey(struct sctp_tcb *stcb, uint16_t keyid) { sctp_sharedkey_t *skey = NULL; - sctp_key_t *key = NULL; - int using_ep_key = 0; /* find the key on the assoc */ skey = sctp_find_sharedkey(&stcb->asoc.shared_keys, keyid); if (skey == NULL) { - /* if not on the assoc, find the key on the endpoint */ - atomic_add_int(&stcb->asoc.refcnt, 1); - SCTP_TCB_UNLOCK(stcb); - SCTP_INP_RLOCK(stcb->sctp_ep); - SCTP_TCB_LOCK(stcb); - atomic_add_int(&stcb->asoc.refcnt, -1); - skey = sctp_find_sharedkey(&stcb->sctp_ep->sctp_ep.shared_keys, - keyid); - using_ep_key = 1; - } - if (skey == NULL) { /* that key doesn't exist */ - if (using_ep_key) { - SCTP_INP_RUNLOCK(stcb->sctp_ep); - } return (-1); } - /* get the shared key text */ - key = skey->key; - - /* free any existing cached key */ - if (stcb->asoc.authinfo.assoc_key != NULL) - sctp_free_key(stcb->asoc.authinfo.assoc_key); - /* compute a new assoc key and cache it */ - stcb->asoc.authinfo.assoc_key = - sctp_compute_hashkey(stcb->asoc.authinfo.random, - stcb->asoc.authinfo.peer_random, key); - stcb->asoc.authinfo.assoc_keyid = keyid; -#ifdef SCTP_DEBUG - if (SCTP_AUTH_DEBUG) - sctp_print_key(stcb->asoc.authinfo.assoc_key, "Assoc Key"); -#endif - - if (using_ep_key) { - SCTP_INP_RUNLOCK(stcb->sctp_ep); + if ((skey->deactivated) && (skey->refcount > 1)) { + /* can't reactivate a deactivated key with other refcounts */ + return (-1); } + /* set the (new) active key */ + stcb->asoc.authinfo.active_keyid = keyid; + /* reset the deactivated flag */ + skey->deactivated = 0; + return (0); } -/* - * set the active key on an endpoint ASSUMES INP_WLOCK is already held +/*- + * set the active key on an endpoint + * ASSUMES INP_WLOCK is already held */ int sctp_auth_setactivekey_ep(struct sctp_inpcb *inp, uint16_t keyid) @@ -1441,6 +1478,69 @@ sctp_auth_setactivekey_ep(struct sctp_in return (0); } +/*- + * deactivates a shared key from the association + * ASSUMES INP_WLOCK is already held + */ +int +sctp_deact_sharedkey(struct sctp_tcb *stcb, uint16_t keyid) +{ + sctp_sharedkey_t *skey; + + if (stcb == NULL) + return (-1); + + /* is the keyid the assoc active sending key */ + if (keyid == stcb->asoc.authinfo.active_keyid) + return (-1); + + /* does the key exist? */ + skey = sctp_find_sharedkey(&stcb->asoc.shared_keys, keyid); + if (skey == NULL) + return (-1); + + /* are there other refcount holders on the key? */ + if (skey->refcount == 1) { + /* no other users, send a notification for this key */ + sctp_ulp_notify(SCTP_NOTIFY_AUTH_FREE_KEY, stcb, keyid, 0, + SCTP_SO_LOCKED); + } + /* mark the key as deactivated */ + skey->deactivated = 1; + + return (0); +} + +/*- + * deactivates a shared key from the endpoint + * ASSUMES INP_WLOCK is already held + */ +int +sctp_deact_sharedkey_ep(struct sctp_inpcb *inp, uint16_t keyid) +{ + sctp_sharedkey_t *skey; + + if (inp == NULL) + return (-1); + + /* is the keyid the active sending key on the endpoint */ + if (keyid == inp->sctp_ep.default_keyid) + return (-1); + + /* does the key exist? */ + skey = sctp_find_sharedkey(&inp->sctp_ep.shared_keys, keyid); + if (skey == NULL) + return (-1); + + /* endpoint keys are not refcounted */ + + /* remove it */ + LIST_REMOVE(skey, next); + sctp_free_sharedkey(skey); /* frees skey->key as well */ + + return (0); +} + /* * get local authentication parameters from cookie (from INIT-ACK) */ @@ -1581,9 +1681,13 @@ sctp_auth_get_cookie_params(struct sctp_ /* negotiate what HMAC to use for the peer */ stcb->asoc.peer_hmac_id = sctp_negotiate_hmacid(stcb->asoc.peer_hmacs, stcb->asoc.local_hmacs); + /* copy defaults from the endpoint */ /* FIX ME: put in cookie? */ - stcb->asoc.authinfo.assoc_keyid = stcb->sctp_ep->sctp_ep.default_keyid; + stcb->asoc.authinfo.active_keyid = stcb->sctp_ep->sctp_ep.default_keyid; + /* copy out the shared key list (by reference) from the endpoint */ + (void)sctp_copy_skeylist(&stcb->sctp_ep->sctp_ep.shared_keys, + &stcb->asoc.shared_keys); } /* @@ -1591,7 +1695,7 @@ sctp_auth_get_cookie_params(struct sctp_ */ void sctp_fill_hmac_digest_m(struct mbuf *m, uint32_t auth_offset, - struct sctp_auth_chunk *auth, struct sctp_tcb *stcb) + struct sctp_auth_chunk *auth, struct sctp_tcb *stcb, uint16_t keyid) { uint32_t digestlen; sctp_sharedkey_t *skey; @@ -1603,15 +1707,15 @@ sctp_fill_hmac_digest_m(struct mbuf *m, /* zero the digest + chunk padding */ digestlen = sctp_get_hmac_digest_len(stcb->asoc.peer_hmac_id); bzero(auth->hmac, SCTP_SIZE32(digestlen)); - /* is an assoc key cached? */ - if (stcb->asoc.authinfo.assoc_key == NULL) { - skey = sctp_find_sharedkey(&stcb->asoc.shared_keys, - stcb->asoc.authinfo.assoc_keyid); - if (skey == NULL) { - /* not in the assoc list, so check the endpoint list */ - skey = sctp_find_sharedkey(&stcb->sctp_ep->sctp_ep.shared_keys, - stcb->asoc.authinfo.assoc_keyid); + + /* is the desired key cached? */ + if ((keyid != stcb->asoc.authinfo.assoc_keyid) || + (stcb->asoc.authinfo.assoc_key == NULL)) { + if (stcb->asoc.authinfo.assoc_key != NULL) { + /* free the old cached key */ + sctp_free_key(stcb->asoc.authinfo.assoc_key); } + skey = sctp_find_sharedkey(&stcb->asoc.shared_keys, keyid); /* the only way skey is NULL is if null key id 0 is used */ if (skey != NULL) key = skey->key; @@ -1621,6 +1725,7 @@ sctp_fill_hmac_digest_m(struct mbuf *m, stcb->asoc.authinfo.assoc_key = sctp_compute_hashkey(stcb->asoc.authinfo.random, stcb->asoc.authinfo.peer_random, key); + stcb->asoc.authinfo.assoc_keyid = keyid; SCTPDBG(SCTP_DEBUG_AUTH1, "caching key id %u\n", stcb->asoc.authinfo.assoc_keyid); #ifdef SCTP_DEBUG @@ -1630,11 +1735,10 @@ sctp_fill_hmac_digest_m(struct mbuf *m, #endif } /* set in the active key id */ - auth->shared_key_id = htons(stcb->asoc.authinfo.assoc_keyid); + auth->shared_key_id = htons(keyid); /* compute and fill in the digest */ - (void)sctp_compute_hmac_m(stcb->asoc.peer_hmac_id, - stcb->asoc.authinfo.assoc_key, + (void)sctp_compute_hmac_m(stcb->asoc.peer_hmac_id, stcb->asoc.authinfo.assoc_key, m, auth_offset, auth->hmac); } @@ -1671,9 +1775,11 @@ sctp_bzero_m(struct mbuf *m, uint32_t m_ } } -/* - * process the incoming Authentication chunk return codes: -1 on any - * authentication error 0 on authentication verification +/*- + * process the incoming Authentication chunk + * return codes: + * -1 on any authentication error + * 0 on authentication verification */ int sctp_handle_auth(struct sctp_tcb *stcb, struct sctp_auth_chunk *auth, @@ -1736,12 +1842,8 @@ sctp_handle_auth(struct sctp_tcb *stcb, if ((stcb->asoc.authinfo.recv_key == NULL) || (stcb->asoc.authinfo.recv_keyid != shared_key_id)) { /* find the shared key on the assoc first */ - skey = sctp_find_sharedkey(&stcb->asoc.shared_keys, shared_key_id); - if (skey == NULL) { - /* if not on the assoc, find it on the endpoint */ - skey = sctp_find_sharedkey(&stcb->sctp_ep->sctp_ep.shared_keys, - shared_key_id); - } + skey = sctp_find_sharedkey(&stcb->asoc.shared_keys, + shared_key_id); /* if the shared key isn't found, discard the chunk */ if (skey == NULL) { SCTP_STAT_INCR(sctps_recvivalkeyid); @@ -1758,7 +1860,8 @@ sctp_handle_auth(struct sctp_tcb *stcb, * *)stcb->asoc.authinfo.recv_keyid); */ sctp_notify_authentication(stcb, SCTP_AUTH_NEWKEY, - shared_key_id, stcb->asoc.authinfo.recv_keyid); + shared_key_id, stcb->asoc.authinfo.recv_keyid, + SCTP_SO_NOT_LOCKED); /* compute a new recv assoc key and cache it */ if (stcb->asoc.authinfo.recv_key != NULL) sctp_free_key(stcb->asoc.authinfo.recv_key); @@ -1801,7 +1904,11 @@ sctp_handle_auth(struct sctp_tcb *stcb, */ void sctp_notify_authentication(struct sctp_tcb *stcb, uint32_t indication, - uint16_t keyid, uint16_t alt_keyid) + uint16_t keyid, uint16_t alt_keyid, int so_locked +#if !defined(__APPLE__) && !defined(SCTP_SO_LOCK_TESTING) + SCTP_UNUSED +#endif +) { struct mbuf *m_notify; struct sctp_authkey_event *auth; @@ -1851,11 +1958,11 @@ sctp_notify_authentication(struct sctp_t /* not that we need this */ control->tail_mbuf = m_notify; sctp_add_to_readq(stcb->sctp_ep, stcb, control, - &stcb->sctp_socket->so_rcv, 1, SCTP_SO_NOT_LOCKED); + &stcb->sctp_socket->so_rcv, 1, so_locked); } -/* +/*- * validates the AUTHentication related parameters in an INIT/INIT-ACK * Note: currently only used for INIT as INIT-ACK is handled inline * with sctp_load_addresses_from_init() @@ -2027,7 +2134,11 @@ sctp_initialize_auth_params(struct sctp_ } } /* copy defaults from the endpoint */ - stcb->asoc.authinfo.assoc_keyid = inp->sctp_ep.default_keyid; + stcb->asoc.authinfo.active_keyid = inp->sctp_ep.default_keyid; + + /* copy out the shared key list (by reference) from the endpoint */ + (void)sctp_copy_skeylist(&inp->sctp_ep.shared_keys, + &stcb->asoc.shared_keys); /* now set the concatenated key (random + chunks + hmacs) */ #ifdef SCTP_AUTH_DRAFT_04 @@ -2135,11 +2246,13 @@ sctp_test_hmac_sha1(void) uint32_t digestlen = 20; int failed = 0; - /* - * test_case = 1 key = - * 0x0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b key_len = 20 - * data = "Hi There" data_len = 8 digest = - * 0xb617318655057264e28bc0b6fb378c8ef146be00 + /*- + * test_case = 1 + * key = 0x0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b + * key_len = 20 + * data = "Hi There" + * data_len = 8 + * digest = 0xb617318655057264e28bc0b6fb378c8ef146be00 */ keylen = 20; memset(key, 0x0b, keylen); @@ -2150,10 +2263,13 @@ sctp_test_hmac_sha1(void) text, textlen, digest, digestlen) < 0) failed++; - /* - * test_case = 2 key = "Jefe" key_len = 4 data = - * "what do ya want for nothing?" data_len = 28 digest = - * 0xeffcdf6ae5eb2fa2d27416d5f184df9c259a7c79 + /*- + * test_case = 2 + * key = "Jefe" + * key_len = 4 + * data = "what do ya want for nothing?" + * data_len = 28 + * digest = 0xeffcdf6ae5eb2fa2d27416d5f184df9c259a7c79 */ keylen = 4; strcpy(key, "Jefe"); @@ -2164,11 +2280,13 @@ sctp_test_hmac_sha1(void) text, textlen, digest, digestlen) < 0) failed++; - /* - * test_case = 3 key = - * 0xaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa key_len = 20 - * data = 0xdd repeated 50 times data_len = 50 digest - * = 0x125d7342b9ac11cd91a39af48aa17b4f63f175d3 + /*- + * test_case = 3 + * key = 0xaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa + * key_len = 20 + * data = 0xdd repeated 50 times + * data_len = 50 + * digest = 0x125d7342b9ac11cd91a39af48aa17b4f63f175d3 */ keylen = 20; memset(key, 0xaa, keylen); @@ -2179,11 +2297,13 @@ sctp_test_hmac_sha1(void) text, textlen, digest, digestlen) < 0) failed++; - /* - * test_case = 4 key = - * 0x0102030405060708090a0b0c0d0e0f10111213141516171819 key_len = 25 - * data = 0xcd repeated 50 times data_len = 50 digest - * = 0x4c9007f4026250c6bc8414f9bf50c86c2d7235da + /*- + * test_case = 4 + * key = 0x0102030405060708090a0b0c0d0e0f10111213141516171819 + * key_len = 25 + * data = 0xcd repeated 50 times + * data_len = 50 + * digest = 0x4c9007f4026250c6bc8414f9bf50c86c2d7235da */ keylen = 25; memcpy(key, "\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19", keylen); @@ -2194,12 +2314,14 @@ sctp_test_hmac_sha1(void) text, textlen, digest, digestlen) < 0) failed++; - /* - * test_case = 5 key = - * 0x0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c key_len = 20 - * data = "Test With Truncation" data_len = 20 digest - * = 0x4c1a03424b55e07fe7f27be1d58bb9324a9a5a04 digest-96 = *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@FreeBSD.ORG Sat Dec 6 13:23:53 2008 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5F8281065672; Sat, 6 Dec 2008 13:23:53 +0000 (UTC) (envelope-from ganbold@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 4E1768FC14; Sat, 6 Dec 2008 13:23:53 +0000 (UTC) (envelope-from ganbold@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mB6DNrlo095081; Sat, 6 Dec 2008 13:23:53 GMT (envelope-from ganbold@svn.freebsd.org) Received: (from ganbold@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mB6DNrL3095080; Sat, 6 Dec 2008 13:23:53 GMT (envelope-from ganbold@svn.freebsd.org) Message-Id: <200812061323.mB6DNrL3095080@svn.freebsd.org> From: Ganbold Tsagaankhuu Date: Sat, 6 Dec 2008 13:23: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: r185695 - head/tools/test/pthread_vfork X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 06 Dec 2008 13:23:53 -0000 Author: ganbold (doc committer) Date: Sat Dec 6 13:23:53 2008 New Revision: 185695 URL: http://svn.freebsd.org/changeset/base/185695 Log: This is simple testing program for revision 185647. It invokes multiple parallel threads and each thread calls vfork() system call. Approved by: kib Added: head/tools/test/pthread_vfork/ head/tools/test/pthread_vfork/pthread_vfork_test.c (contents, props changed) Added: head/tools/test/pthread_vfork/pthread_vfork_test.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tools/test/pthread_vfork/pthread_vfork_test.c Sat Dec 6 13:23:53 2008 (r185695) @@ -0,0 +1,81 @@ +/*- + * Copyright (c) 2008 Ganbold Tsagaankhuu + * 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 AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include +#include +#include +#include + +#define NUM_THREADS 100 + +void * +vfork_test(void *threadid) +{ + pid_t pid; + + for (;;) { + pid = vfork(); + if (pid == 0) + _exit(0); + else if (pid == -1) + err(1, "Failed to vfork"); + } + return (NULL); +} + +/* + * This program invokes multiple threads and each thread calls + * vfork() system call. + */ +int +main(void) +{ + pthread_t threads[NUM_THREADS]; + struct sigaction reapchildren; + int rc, t; + + memset(&reapchildren, 0, sizeof(reapchildren)); + reapchildren.sa_handler = SIG_IGN; + + /* Automatically reap zombies. */ + if (sigaction(SIGCHLD, &reapchildren, NULL) == -1) + err(1, "Could not sigaction(SIGCHLD)"); + + for (t = 0; t < NUM_THREADS; t++) { + rc = pthread_create(&threads[t], NULL, vfork_test, (void *)t); + if (rc) + errc(1, rc, "pthread_create"); + } + return (0); +} From owner-svn-src-head@FreeBSD.ORG Sat Dec 6 14:23:45 2008 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B7AAD1065670; Sat, 6 Dec 2008 14:23:45 +0000 (UTC) (envelope-from stas@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A6E778FC13; Sat, 6 Dec 2008 14:23:45 +0000 (UTC) (envelope-from stas@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mB6ENjtE096784; Sat, 6 Dec 2008 14:23:45 GMT (envelope-from stas@svn.freebsd.org) Received: (from stas@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mB6ENjW4096783; Sat, 6 Dec 2008 14:23:45 GMT (envelope-from stas@svn.freebsd.org) Message-Id: <200812061423.mB6ENjW4096783@svn.freebsd.org> From: Stanislav Sedov Date: Sat, 6 Dec 2008 14:23: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: r185707 - head/sys/dev/ae X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 06 Dec 2008 14:23:45 -0000 Author: stas Date: Sat Dec 6 14:23:45 2008 New Revision: 185707 URL: http://svn.freebsd.org/changeset/base/185707 Log: - Eliminate unused variable. [1] - Check for runt frames entering the stack. [2] Suggested by: ganbold[1], yongari[2] Approved by: kib (mentor) MFC after: 2 weeks Modified: head/sys/dev/ae/if_ae.c Modified: head/sys/dev/ae/if_ae.c ============================================================================== --- head/sys/dev/ae/if_ae.c Sat Dec 6 14:20:04 2008 (r185706) +++ head/sys/dev/ae/if_ae.c Sat Dec 6 14:23:45 2008 (r185707) @@ -1105,12 +1105,9 @@ ae_dmamap_cb(void *arg, bus_dma_segment_ static int ae_alloc_rings(ae_softc_t *sc) { - bus_dma_tag_t bustag; bus_addr_t busaddr; int error; - bustag = bus_get_dma_tag(sc->dev); - /* * Create parent DMA tag. */ @@ -1903,8 +1900,8 @@ ae_rxeof(ae_softc_t *sc, ae_rxd_t *rxd) if_printf(ifp, "Rx interrupt occuried.\n"); #endif size = le16toh(rxd->len) - ETHER_CRC_LEN; - if (size < 0) { - if_printf(ifp, "Negative length packet received."); + if (size < (ETHER_MIN_LEN - ETHER_CRC_LEN - ETHER_VLAN_ENCAP_LEN)) { + if_printf(ifp, "Runt frame received."); return (EIO); } From owner-svn-src-head@FreeBSD.ORG Sat Dec 6 14:45:04 2008 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id F1EE31065670; Sat, 6 Dec 2008 14:45:04 +0000 (UTC) (envelope-from ps@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E15888FC0A; Sat, 6 Dec 2008 14:45:04 +0000 (UTC) (envelope-from ps@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mB6Ej3IB097524; Sat, 6 Dec 2008 14:45:03 GMT (envelope-from ps@svn.freebsd.org) Received: (from ps@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mB6Ej3dh097523; Sat, 6 Dec 2008 14:45:03 GMT (envelope-from ps@svn.freebsd.org) Message-Id: <200812061445.mB6Ej3dh097523@svn.freebsd.org> From: Paul Saab Date: Sat, 6 Dec 2008 14:45: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: r185711 - head/sys/boot/zfs X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 06 Dec 2008 14:45:05 -0000 Author: ps Date: Sat Dec 6 14:45:03 2008 New Revision: 185711 URL: http://svn.freebsd.org/changeset/base/185711 Log: Correct include path for i386 specific includes. This allows zfs to boot on systems where the loader is built on amd64 systems. Modified: head/sys/boot/zfs/Makefile Modified: head/sys/boot/zfs/Makefile ============================================================================== --- head/sys/boot/zfs/Makefile Sat Dec 6 14:42:36 2008 (r185710) +++ head/sys/boot/zfs/Makefile Sat Dec 6 14:45:03 2008 (r185711) @@ -29,7 +29,7 @@ CFLAGS+= -Wformat -Wall .if ${MACHINE_ARCH} == "amd64" CLEANFILES+= machine machine: - ln -sf ${.CURDIR}/../../../i386/include machine + ln -sf ${.CURDIR}/../../i386/include machine .endif .include From owner-svn-src-head@FreeBSD.ORG Sat Dec 6 14:55:32 2008 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0679F1065672; Sat, 6 Dec 2008 14:55:32 +0000 (UTC) (envelope-from keramida@ceid.upatras.gr) Received: from igloo.linux.gr (igloo.linux.gr [62.1.205.36]) by mx1.freebsd.org (Postfix) with ESMTP id 728178FC08; Sat, 6 Dec 2008 14:55:31 +0000 (UTC) (envelope-from keramida@ceid.upatras.gr) Received: from kobe.laptop (adsl153-194.kln.forthnet.gr [62.1.244.194]) (authenticated bits=128) by igloo.linux.gr (8.14.3/8.14.3/Debian-5) with ESMTP id mB6EtLaL017234 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT); Sat, 6 Dec 2008 16:55:27 +0200 Received: from kobe.laptop (kobe.laptop [127.0.0.1]) by kobe.laptop (8.14.3/8.14.3) with ESMTP id mB6EtLhN036922; Sat, 6 Dec 2008 16:55:21 +0200 (EET) (envelope-from keramida@ceid.upatras.gr) Received: (from keramida@localhost) by kobe.laptop (8.14.3/8.14.3/Submit) id mB6EtKf5036921; Sat, 6 Dec 2008 16:55:20 +0200 (EET) (envelope-from keramida@ceid.upatras.gr) From: Giorgos Keramidas To: Konstantin Belousov References: <200812060937.mB69bs2w089432@svn.freebsd.org> Date: Sat, 06 Dec 2008 16:55:20 +0200 In-Reply-To: <200812060937.mB69bs2w089432@svn.freebsd.org> (Konstantin Belousov's message of "Sat, 6 Dec 2008 09:37:54 +0000 (UTC)") Message-ID: <87iqpxl5ev.fsf@kobe.laptop> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (berkeley-unix) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-MailScanner-ID: mB6EtLaL017234 X-Hellug-MailScanner: Found to be clean X-Hellug-MailScanner-SpamCheck: not spam, SpamAssassin (not cached, score=-4.004, required 5, autolearn=not spam, ALL_TRUSTED -1.80, AWL 0.40, BAYES_00 -2.60) X-Hellug-MailScanner-From: keramida@ceid.upatras.gr X-Spam-Status: No Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r185690 - head/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: Sat, 06 Dec 2008 14:55:32 -0000 On Sat, 6 Dec 2008 09:37:54 +0000 (UTC), Konstantin Belousov wrote: > Author: kib > Date: Sat Dec 6 09:37:54 2008 > New Revision: 185690 > URL: http://svn.freebsd.org/changeset/base/185690 > > Log: > Import the strndup(3) function. > Copyright attribution is kept the same as in original NetBSD source. Varnish has a mostly equivalent function with a slightly more "free" 2-clause BSD copyright: http://varnish.projects.linpro.no/browser/trunk/varnish-cache/lib/libvarnishcompat/strndup.c Maybe it's worth switching to that function, so we can remove the 4th clause some time later :) From owner-svn-src-head@FreeBSD.ORG Sat Dec 6 19:09:39 2008 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3DA481065670; Sat, 6 Dec 2008 19:09:39 +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 2A7248FC08; Sat, 6 Dec 2008 19:09:39 +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 mB6J9doA002689; Sat, 6 Dec 2008 19:09:39 GMT (envelope-from csjp@svn.freebsd.org) Received: (from csjp@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mB6J9dIv002688; Sat, 6 Dec 2008 19:09:39 GMT (envelope-from csjp@svn.freebsd.org) Message-Id: <200812061909.mB6J9dIv002688@svn.freebsd.org> From: "Christian S.J. Peron" Date: Sat, 6 Dec 2008 19:09: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: r185713 - 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: Sat, 06 Dec 2008 19:09:39 -0000 Author: csjp Date: Sat Dec 6 19:09:38 2008 New Revision: 185713 URL: http://svn.freebsd.org/changeset/base/185713 Log: in_rtalloc1(9) returns a locked route, so make sure that we use RTFREE_LOCKED() here. This macro makes sure the reference count on the route is being managed properly. This elimates another case which results in the following message being printed to the console: rtfree: 0xc841ee88 has 1 refs Reviewed by: bz MFC after: 2 weeks Modified: head/sys/netinet/if_ether.c Modified: head/sys/netinet/if_ether.c ============================================================================== --- head/sys/netinet/if_ether.c Sat Dec 6 14:50:46 2008 (r185712) +++ head/sys/netinet/if_ether.c Sat Dec 6 19:09:38 2008 (r185713) @@ -924,12 +924,12 @@ reply: * over who claims what Ether address. */ if (rt->rt_ifp == ifp) { - rtfree(rt); + RTFREE_LOCKED(rt); goto drop; } (void)memcpy(ar_tha(ah), ar_sha(ah), ah->ar_hln); (void)memcpy(ar_sha(ah), enaddr, ah->ar_hln); - rtfree(rt); + RTFREE_LOCKED(rt); /* * Also check that the node which sent the ARP packet @@ -948,10 +948,10 @@ reply: " from %s via %s, expecting %s\n", inet_ntoa(isaddr), ifp->if_xname, rt->rt_ifp->if_xname); - rtfree(rt); + RTFREE_LOCKED(rt); goto drop; } - rtfree(rt); + RTFREE_LOCKED(rt); #ifdef DEBUG_PROXY printf("arp: proxying for %s\n", From owner-svn-src-head@FreeBSD.ORG Sat Dec 6 19:21:56 2008 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BE5191065673; Sat, 6 Dec 2008 19:21:56 +0000 (UTC) (envelope-from keramida@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id AA6C38FC14; Sat, 6 Dec 2008 19:21:56 +0000 (UTC) (envelope-from keramida@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mB6JLuQV002938; Sat, 6 Dec 2008 19:21:56 GMT (envelope-from keramida@svn.freebsd.org) Received: (from keramida@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mB6JLu98002936; Sat, 6 Dec 2008 19:21:56 GMT (envelope-from keramida@svn.freebsd.org) Message-Id: <200812061921.mB6JLu98002936@svn.freebsd.org> From: Giorgos Keramidas Date: Sat, 6 Dec 2008 19:21: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: r185714 - head/usr.bin/wc X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 06 Dec 2008 19:21:57 -0000 Author: keramida (doc committer) Date: Sat Dec 6 19:21:56 2008 New Revision: 185714 URL: http://svn.freebsd.org/changeset/base/185714 Log: Add a -L option to wc(1), for finger compatibility with the GNU wc utility. The -L option can be used to report the length of the longest line wc has seen in one or more files. It is disabled by default, and wc uses the standard `-lwc'. Submitted by: Sheldon Givens, sheldon at sigsegv.ca Reviewed by: kib MFC after: 1 week Modified: head/usr.bin/wc/wc.1 head/usr.bin/wc/wc.c Modified: head/usr.bin/wc/wc.1 ============================================================================== --- head/usr.bin/wc/wc.1 Sat Dec 6 19:09:38 2008 (r185713) +++ head/usr.bin/wc/wc.1 Sat Dec 6 19:21:56 2008 (r185714) @@ -35,7 +35,7 @@ .\" @(#)wc.1 8.2 (Berkeley) 4/19/94 .\" $FreeBSD$ .\" -.Dd February 23, 2005 +.Dd December 6, 2008 .Dt WC 1 .Os .Sh NAME @@ -43,7 +43,7 @@ .Nd word, line, character, and byte count .Sh SYNOPSIS .Nm -.Op Fl clmw +.Op Fl Lclmw .Op Ar .Sh DESCRIPTION The @@ -71,6 +71,15 @@ the last file. .Pp The following options are available: .Bl -tag -width indent +.It Fl L +The number of characters in the longest input line +is written to the standard output. +When more then one +.Ar file +argument is specified, the longest input line of +.Em all +files is reported as the value of the final +.Dq total . .It Fl c The number of bytes in each input file is written to the standard output. @@ -129,6 +138,10 @@ and as well as the totals for both: .Pp .Dl "wc -mlw report1 report2" +.Pp +Find the longest line in a list of files: +.Pp +.Dl "wc -L file1 file2 file3 | fgrep total" .Sh COMPATIBILITY Historically, the .Nm @@ -154,6 +167,16 @@ in terms of the .Xr iswspace 3 function, as required by .St -p1003.2 . +.Pp +The +.Fl L +option is a non-standard +.Fx +extension, compatible with the +.Fl L +option of the GNU +.Nm +utility. .Sh SEE ALSO .Xr iswspace 3 .Sh STANDARDS Modified: head/usr.bin/wc/wc.c ============================================================================== --- head/usr.bin/wc/wc.c Sat Dec 6 19:09:38 2008 (r185713) +++ head/usr.bin/wc/wc.c Sat Dec 6 19:21:56 2008 (r185714) @@ -62,8 +62,8 @@ __FBSDID("$FreeBSD$"); #include #include -uintmax_t tlinect, twordct, tcharct; -int doline, doword, dochar, domulti; +uintmax_t tlinect, twordct, tcharct, tlongline; +int doline, doword, dochar, domulti, dolongline; static int cnt(const char *); static void usage(void); @@ -75,7 +75,7 @@ main(int argc, char *argv[]) (void) setlocale(LC_CTYPE, ""); - while ((ch = getopt(argc, argv, "clmw")) != -1) + while ((ch = getopt(argc, argv, "clmwL")) != -1) switch((char)ch) { case 'l': doline = 1; @@ -87,6 +87,9 @@ main(int argc, char *argv[]) dochar = 1; domulti = 0; break; + case 'L': + dolongline = 1; + break; case 'm': domulti = 1; dochar = 0; @@ -99,7 +102,7 @@ main(int argc, char *argv[]) argc -= optind; /* Wc's flags are on by default. */ - if (doline + doword + dochar + domulti == 0) + if (doline + doword + dochar + domulti + dolongline == 0) doline = doword = dochar = 1; errors = 0; @@ -125,6 +128,8 @@ main(int argc, char *argv[]) (void)printf(" %7ju", twordct); if (dochar || domulti) (void)printf(" %7ju", tcharct); + if (dolongline) + (void)printf(" %7ju", tlongline); (void)printf(" total\n"); } exit(errors == 0 ? 0 : 1); @@ -134,7 +139,7 @@ static int cnt(const char *file) { struct stat sb; - uintmax_t linect, wordct, charct; + uintmax_t linect, wordct, charct, llct, tmpll; int fd, len, warned; size_t clen; short gotsp; @@ -143,7 +148,7 @@ cnt(const char *file) wchar_t wch; mbstate_t mbs; - linect = wordct = charct = 0; + linect = wordct = charct = llct = tmpll = 0; if (file == NULL) { file = "stdin"; fd = STDIN_FILENO; @@ -168,8 +173,13 @@ cnt(const char *file) } charct += len; for (p = buf; len--; ++p) - if (*p == '\n') + if (*p == '\n') { + if (tmpll > llct) + llct = tmpll; + tmpll = 0; ++linect; + } else + tmpll++; } tlinect += linect; (void)printf(" %7ju", linect); @@ -177,6 +187,11 @@ cnt(const char *file) tcharct += charct; (void)printf(" %7ju", charct); } + if (dolongline) { + if (llct > tlongline) + tlongline = llct; + (void)printf(" %7ju", tlongline); + } (void)close(fd); return (0); } @@ -229,10 +244,16 @@ word: gotsp = 1; else if (clen == 0) clen = 1; charct++; + if (wch != L'\n') + tmpll++; len -= clen; p += clen; - if (wch == L'\n') + if (wch == L'\n') { + if (tmpll > llct) + llct = tmpll; + tmpll = 0; ++linect; + } if (iswspace(wch)) gotsp = 1; else if (gotsp) { @@ -256,6 +277,11 @@ word: gotsp = 1; tcharct += charct; (void)printf(" %7ju", charct); } + if (dolongline) { + if (llct > tlongline) + tlongline = llct; + (void)printf(" %7ju", llct); + } (void)close(fd); return (0); } @@ -263,6 +289,6 @@ word: gotsp = 1; static void usage() { - (void)fprintf(stderr, "usage: wc [-clmw] [file ...]\n"); + (void)fprintf(stderr, "usage: wc [-Lclmw] [file ...]\n"); exit(1); } From owner-svn-src-head@FreeBSD.ORG Sat Dec 6 19:37:53 2008 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 02F891065670; Sat, 6 Dec 2008 19:37:53 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E42F68FC0A; Sat, 6 Dec 2008 19:37:52 +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 mB6Jbq1h003274; Sat, 6 Dec 2008 19:37:52 GMT (envelope-from alc@svn.freebsd.org) Received: (from alc@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mB6JbqAI003273; Sat, 6 Dec 2008 19:37:52 GMT (envelope-from alc@svn.freebsd.org) Message-Id: <200812061937.mB6JbqAI003273@svn.freebsd.org> From: Alan Cox Date: Sat, 6 Dec 2008 19:37: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: r185715 - head/sys/amd64/amd64 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 06 Dec 2008 19:37:53 -0000 Author: alc Date: Sat Dec 6 19:37:52 2008 New Revision: 185715 URL: http://svn.freebsd.org/changeset/base/185715 Log: Change the default value for the flag enabling superpage mapping and promotion to "on". Reminded by: jhb Tested by: kris Modified: head/sys/amd64/amd64/pmap.c Modified: head/sys/amd64/amd64/pmap.c ============================================================================== --- head/sys/amd64/amd64/pmap.c Sat Dec 6 19:21:56 2008 (r185714) +++ head/sys/amd64/amd64/pmap.c Sat Dec 6 19:37:52 2008 (r185715) @@ -180,7 +180,7 @@ pt_entry_t pg_nx; SYSCTL_NODE(_vm, OID_AUTO, pmap, CTLFLAG_RD, 0, "VM/pmap parameters"); -static int pg_ps_enabled; +static int pg_ps_enabled = 1; SYSCTL_INT(_vm_pmap, OID_AUTO, pg_ps_enabled, CTLFLAG_RD, &pg_ps_enabled, 0, "Are large page mappings enabled?"); From owner-svn-src-head@FreeBSD.ORG Sat Dec 6 21:19:27 2008 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 817D0106564A; Sat, 6 Dec 2008 21:19:27 +0000 (UTC) (envelope-from thompsa@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 5E0C68FC0C; Sat, 6 Dec 2008 21:19:27 +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 mB6LJRI0005367; Sat, 6 Dec 2008 21:19:27 GMT (envelope-from thompsa@svn.freebsd.org) Received: (from thompsa@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mB6LJRT9005366; Sat, 6 Dec 2008 21:19:27 GMT (envelope-from thompsa@svn.freebsd.org) Message-Id: <200812062119.mB6LJRT9005366@svn.freebsd.org> From: Andrew Thompson Date: Sat, 6 Dec 2008 21:19:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185719 - 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: Sat, 06 Dec 2008 21:19:27 -0000 Author: thompsa Date: Sat Dec 6 21:19:26 2008 New Revision: 185719 URL: http://svn.freebsd.org/changeset/base/185719 Log: The startall variable should default to zero, otherwise the vap is restarted everytime an ioctl happens. While I am here, limit the locking scope to SIOCSIFFLAGS. Modified: head/sys/dev/usb/if_ural.c Modified: head/sys/dev/usb/if_ural.c ============================================================================== --- head/sys/dev/usb/if_ural.c Sat Dec 6 20:49:08 2008 (r185718) +++ head/sys/dev/usb/if_ural.c Sat Dec 6 21:19:26 2008 (r185719) @@ -1544,11 +1544,11 @@ ural_ioctl(struct ifnet *ifp, u_long cmd struct ural_softc *sc = ifp->if_softc; struct ieee80211com *ic = ifp->if_l2com; struct ifreq *ifr = (struct ifreq *) data; - int error = 0, startall = 1; + int error = 0, startall = 0; - RAL_LOCK(sc); switch (cmd) { case SIOCSIFFLAGS: + RAL_LOCK(sc); if (ifp->if_flags & IFF_UP) { if ((ifp->if_drv_flags & IFF_DRV_RUNNING) == 0) { ural_init_locked(sc); @@ -1559,6 +1559,9 @@ ural_ioctl(struct ifnet *ifp, u_long cmd if (ifp->if_drv_flags & IFF_DRV_RUNNING) ural_stop(sc); } + RAL_UNLOCK(sc); + if (startall) + ieee80211_start_all(ic); break; case SIOCGIFMEDIA: case SIOCSIFMEDIA: @@ -1568,10 +1571,6 @@ ural_ioctl(struct ifnet *ifp, u_long cmd error = ether_ioctl(ifp, cmd, data); break; } - RAL_UNLOCK(sc); - - if (startall) - ieee80211_start_all(ic); return error; } From owner-svn-src-head@FreeBSD.ORG Sat Dec 6 21:33:45 2008 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2BE0E1065670; Sat, 6 Dec 2008 21:33:45 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 184A68FC14; Sat, 6 Dec 2008 21:33:45 +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 mB6LXius005675; Sat, 6 Dec 2008 21:33:45 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mB6LXiUD005674; Sat, 6 Dec 2008 21:33:44 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <200812062133.mB6LXiUD005674@svn.freebsd.org> From: Konstantin Belousov Date: Sat, 6 Dec 2008 21:33: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: r185720 - head/sys/i386/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: Sat, 06 Dec 2008 21:33:45 -0000 Author: kib Date: Sat Dec 6 21:33:44 2008 New Revision: 185720 URL: http://svn.freebsd.org/changeset/base/185720 Log: Restore memory clobber, to cause mb on the compiler level too. Use more sane formatting of the assembler. Pointed out by: bde Modified: head/sys/i386/include/atomic.h Modified: head/sys/i386/include/atomic.h ============================================================================== --- head/sys/i386/include/atomic.h Sat Dec 6 21:19:26 2008 (r185719) +++ head/sys/i386/include/atomic.h Sat Dec 6 21:33:44 2008 (r185720) @@ -32,9 +32,9 @@ #error this file needs sys/cdefs.h as a prerequisite #endif -#define mb() __asm __volatile("lock;addl $0,(%esp)") -#define wmb() __asm __volatile("lock;addl $0,(%esp)") -#define rmb() __asm __volatile("lock;addl $0,(%esp)") +#define mb() __asm __volatile("lock; addl $0,(%%esp)" : : : "memory") +#define wmb() __asm __volatile("lock; addl $0,(%%esp)" : : : "memory") +#define rmb() __asm __volatile("lock; addl $0,(%%esp)" : : : "memory") /* * Various simple operations on memory, each of which is atomic in the From owner-svn-src-head@FreeBSD.ORG Sat Dec 6 21:41:28 2008 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3476A1065670; Sat, 6 Dec 2008 21:41:28 +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 1FD368FC1F; Sat, 6 Dec 2008 21:41:28 +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 mB6LfSBC005832; Sat, 6 Dec 2008 21:41:28 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mB6LfRLm005830; Sat, 6 Dec 2008 21:41:27 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <200812062141.mB6LfRLm005830@svn.freebsd.org> From: Alexander Motin Date: Sat, 6 Dec 2008 21:41: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: r185721 - head/sys/dev/mmc X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 06 Dec 2008 21:41:28 -0000 Author: mav Date: Sat Dec 6 21:41:27 2008 New Revision: 185721 URL: http://svn.freebsd.org/changeset/base/185721 Log: Implement suspend/resume for mmc and mmcsd drivers. Now it is possible to suspend/resume with inserted and active card. To reinitialize card on resume and to detect card change while suspended, implement bus rescan routines. It can also be used by controllers without card presence detection signals or with multiple cards per slot support. While there, cleanup msleep() usage. We have no any rights to exit without "request done" signal from driver as it could lead to modify after free. Modified: head/sys/dev/mmc/mmc.c head/sys/dev/mmc/mmcsd.c Modified: head/sys/dev/mmc/mmc.c ============================================================================== --- head/sys/dev/mmc/mmc.c Sat Dec 6 21:33:44 2008 (r185720) +++ head/sys/dev/mmc/mmc.c Sat Dec 6 21:41:27 2008 (r185721) @@ -108,6 +108,8 @@ struct mmc_ivars { static int mmc_probe(device_t dev); static int mmc_attach(device_t dev); static int mmc_detach(device_t dev); +static int mmc_suspend(device_t dev); +static int mmc_resume(device_t dev); #define MMC_LOCK(_sc) mtx_lock(&(_sc)->sc_mtx) #define MMC_UNLOCK(_sc) mtx_unlock(&(_sc)->sc_mtx) @@ -130,6 +132,8 @@ static int mmc_set_card_bus_width(struct static int mmc_app_send_scr(struct mmc_softc *sc, uint16_t rca, uint32_t *rawscr); static void mmc_app_decode_scr(uint32_t *raw_scr, struct mmc_scr *scr); static int mmc_send_ext_csd(struct mmc_softc *sc, uint8_t *rawextcsd); +static void mmc_scan(struct mmc_softc *sc); +static int mmc_delete_cards(struct mmc_softc *sc); static void mmc_ms_delay(int ms) @@ -166,29 +170,39 @@ static int mmc_detach(device_t dev) { struct mmc_softc *sc = device_get_softc(dev); - device_t *kids; - int i, nkid; + int err; - /* kill children [ph33r]. -sorbo */ - if (device_get_children(sc->dev, &kids, &nkid) != 0) - return (0); - for (i = 0; i < nkid; i++) { - device_t kid = kids[i]; - void *ivar = device_get_ivars(kid); - - device_detach(kid); - device_delete_child(sc->dev, kid); - free(ivar, M_DEVBUF); - } - free(kids, M_TEMP); + if ((err = mmc_delete_cards(sc)) != 0) + return (err); mmc_power_down(sc); - MMC_LOCK_DESTROY(sc); return (0); } static int +mmc_suspend(device_t dev) +{ + struct mmc_softc *sc = device_get_softc(dev); + int err; + + err = bus_generic_suspend(dev); + if (err) + return (err); + mmc_power_down(sc); + return (0); +} + +static int +mmc_resume(device_t dev) +{ + struct mmc_softc *sc = device_get_softc(dev); + + mmc_scan(sc); + return (bus_generic_resume(dev)); +} + +static int mmc_acquire_bus(device_t busdev, device_t dev) { struct mmc_softc *sc; @@ -265,12 +279,6 @@ mmc_release_bus(device_t busdev, device_ return (0); } -static void -mmc_rescan_cards(struct mmc_softc *sc) -{ - /* XXX: Look at the children and see if they respond to status */ -} - static uint32_t mmc_select_vdd(struct mmc_softc *sc, uint32_t ocr) { @@ -294,31 +302,25 @@ mmc_wakeup(struct mmc_request *req) { struct mmc_softc *sc; -/* printf("Wakeup for req %p done_data %p\n", req, req->done_data); */ sc = (struct mmc_softc *)req->done_data; MMC_LOCK(sc); req->flags |= MMC_REQ_DONE; - wakeup(req); MMC_UNLOCK(sc); + wakeup(req); } static int mmc_wait_for_req(struct mmc_softc *sc, struct mmc_request *req) { - int err; req->done = mmc_wakeup; req->done_data = sc; -/* printf("Submitting request %p sc %p\n", req, sc); */ MMCBR_REQUEST(device_get_parent(sc->dev), sc->dev, req); MMC_LOCK(sc); - do { - err = msleep(req, &sc->sc_mtx, PZERO | PCATCH, "mmcreq", - hz / 10); - } while (!(req->flags & MMC_REQ_DONE) && err == EAGAIN); -/* printf("Request %p done with error %d\n", req, err); */ + while ((req->flags & MMC_REQ_DONE) == 0) + msleep(req, &sc->sc_mtx, 0, "mmcreq", 0); MMC_UNLOCK(sc); - return (err); + return (0); } static int @@ -1060,25 +1062,41 @@ mmc_send_relative_addr(struct mmc_softc static void mmc_discover_cards(struct mmc_softc *sc) { - struct mmc_ivars *ivar; - int err; + struct mmc_ivars *ivar = NULL; + device_t *devlist; + int err, i, devcount, newcard; + uint32_t raw_cid[4]; uint32_t resp, sec_count; device_t child; uint16_t rca = 2; u_char switch_res[64]; while (1) { - ivar = malloc(sizeof(struct mmc_ivars), M_DEVBUF, - M_WAITOK | M_ZERO); - if (!ivar) - return; - err = mmc_all_send_cid(sc, ivar->raw_cid); + err = mmc_all_send_cid(sc, raw_cid); if (err == MMC_ERR_TIMEOUT) break; if (err != MMC_ERR_NONE) { device_printf(sc->dev, "Error reading CID %d\n", err); break; } + newcard = 1; + if ((err = device_get_children(sc->dev, &devlist, &devcount)) != 0) + return; + for (i = 0; i < devcount; i++) { + ivar = device_get_ivars(devlist[i]); + if (memcmp(ivar->raw_cid, raw_cid, sizeof(raw_cid)) == 0) { + newcard = 0; + break; + } + } + free(devlist, M_TEMP); + if (newcard) { + ivar = malloc(sizeof(struct mmc_ivars), M_DEVBUF, + M_WAITOK | M_ZERO); + if (!ivar) + return; + memcpy(ivar->raw_cid, raw_cid, sizeof(raw_cid)); + } if (mmcbr_get_ro(sc->dev)) ivar->read_only = 1; ivar->bus_width = bus_width_1; @@ -1121,9 +1139,11 @@ mmc_discover_cards(struct mmc_softc *sc) if ((mmcbr_get_caps(sc->dev) & MMC_CAP_4_BIT_DATA) && (ivar->scr.bus_widths & SD_SCR_BUS_WIDTH_4)) ivar->bus_width = bus_width_4; - /* Add device. */ - child = device_add_child(sc->dev, NULL, -1); - device_set_ivars(child, ivar); + if (newcard) { + /* Add device. */ + child = device_add_child(sc->dev, NULL, -1); + device_set_ivars(child, ivar); + } return; } mmc_decode_cid_mmc(ivar->raw_cid, &ivar->cid); @@ -1174,11 +1194,50 @@ mmc_discover_cards(struct mmc_softc *sc) ivar->bus_width = bus_width_1; ivar->timing = bus_timing_normal; } - /* Add device. */ - child = device_add_child(sc->dev, NULL, -1); - device_set_ivars(child, ivar); + if (newcard) { + /* Add device. */ + child = device_add_child(sc->dev, NULL, -1); + device_set_ivars(child, ivar); + } } - free(ivar, M_DEVBUF); +} + +static void +mmc_rescan_cards(struct mmc_softc *sc) +{ + struct mmc_ivars *ivar = NULL; + device_t *devlist; + int err, i, devcount; + + if ((err = device_get_children(sc->dev, &devlist, &devcount)) != 0) + return; + for (i = 0; i < devcount; i++) { + ivar = device_get_ivars(devlist[i]); + if (mmc_select_card(sc, ivar->rca)) { + device_delete_child(sc->dev, devlist[i]); + free(ivar, M_DEVBUF); + } + } + free(devlist, M_TEMP); + mmc_select_card(sc, 0); +} + +static int +mmc_delete_cards(struct mmc_softc *sc) +{ + struct mmc_ivars *ivar; + device_t *devlist; + int err, i, devcount; + + if ((err = device_get_children(sc->dev, &devlist, &devcount)) != 0) + return (err); + for (i = 0; i < devcount; i++) { + ivar = device_get_ivars(devlist[i]); + device_delete_child(sc->dev, devlist[i]); + free(ivar, M_DEVBUF); + } + free(devlist, M_TEMP); + return (0); } static void @@ -1205,7 +1264,7 @@ mmc_go_discovery(struct mmc_softc *sc) */ mmcbr_set_mode(dev, mode_mmc); if (mmc_send_op_cond(sc, 0, &ocr) != MMC_ERR_NONE) - return; /* Failed both, punt! XXX powerdown? */ + ocr = 0; /* Failed both, powerdown. */ } mmcbr_set_ocr(dev, mmc_select_vdd(sc, ocr)); if (mmcbr_get_ocr(dev) != 0) @@ -1220,8 +1279,11 @@ mmc_go_discovery(struct mmc_softc *sc) * Make sure that we have a mutually agreeable voltage to at least * one card on the bus. */ - if (mmcbr_get_ocr(dev) == 0) + if (mmcbr_get_ocr(dev) == 0) { + mmc_delete_cards(sc); + mmc_power_down(sc); return; + } /* * Reselect the cards after we've idled them above. */ @@ -1232,6 +1294,7 @@ mmc_go_discovery(struct mmc_softc *sc) } else mmc_send_op_cond(sc, mmcbr_get_ocr(dev), NULL); mmc_discover_cards(sc); + mmc_rescan_cards(sc); mmcbr_set_bus_mode(dev, pushpull); mmcbr_update_ios(dev); @@ -1292,17 +1355,11 @@ mmc_calculate_clock(struct mmc_softc *sc static void mmc_scan(struct mmc_softc *sc) { - device_t dev; + device_t dev = sc->dev; - dev = sc->dev; mmc_acquire_bus(dev, dev); - - if (mmcbr_get_power_mode(dev) == power_on) - mmc_rescan_cards(sc); mmc_go_discovery(sc); - mmc_release_bus(dev, dev); - /* XXX probe/attach/detach children? */ } static int @@ -1374,6 +1431,8 @@ static device_method_t mmc_methods[] = { DEVMETHOD(device_probe, mmc_probe), DEVMETHOD(device_attach, mmc_attach), DEVMETHOD(device_detach, mmc_detach), + DEVMETHOD(device_suspend, mmc_suspend), + DEVMETHOD(device_resume, mmc_resume), /* Bus interface */ DEVMETHOD(bus_read_ivar, mmc_read_ivar), Modified: head/sys/dev/mmc/mmcsd.c ============================================================================== --- head/sys/dev/mmc/mmcsd.c Sat Dec 6 21:33:44 2008 (r185720) +++ head/sys/dev/mmc/mmcsd.c Sat Dec 6 21:41:27 2008 (r185721) @@ -79,6 +79,7 @@ struct mmcsd_softc { struct bio_queue_head bio_queue; daddr_t eblock, eend; /* Range remaining after the last erase. */ int running; + int suspend; }; /* bus entry points */ @@ -163,6 +164,7 @@ mmcsd_attach(device_t dev) bioq_init(&sc->bio_queue); sc->running = 1; + sc->suspend = 0; sc->eblock = sc->eend = 0; kproc_create(&mmcsd_task, sc, &sc->p, 0, 0, "task: mmc/sd card"); @@ -174,16 +176,16 @@ mmcsd_detach(device_t dev) { struct mmcsd_softc *sc = device_get_softc(dev); - /* kill thread */ MMCSD_LOCK(sc); - sc->running = 0; - wakeup(sc); - MMCSD_UNLOCK(sc); - - /* wait for thread to finish. XXX probably want timeout. -sorbo */ - MMCSD_LOCK(sc); - while (sc->running != -1) - msleep(sc, &sc->sc_mtx, PRIBIO, "detach", 0); + sc->suspend = 0; + if (sc->running > 0) { + /* kill thread */ + sc->running = 0; + wakeup(sc); + /* wait for thread to finish. */ + while (sc->running != -1) + msleep(sc, &sc->sc_mtx, 0, "detach", 0); + } MMCSD_UNLOCK(sc); /* Flush the request queue. */ @@ -197,6 +199,41 @@ mmcsd_detach(device_t dev) } static int +mmcsd_suspend(device_t dev) +{ + struct mmcsd_softc *sc = device_get_softc(dev); + + MMCSD_LOCK(sc); + sc->suspend = 1; + if (sc->running > 0) { + /* kill thread */ + sc->running = 0; + wakeup(sc); + /* wait for thread to finish. */ + while (sc->running != -1) + msleep(sc, &sc->sc_mtx, 0, "detach", 0); + } + MMCSD_UNLOCK(sc); + return (0); +} + +static int +mmcsd_resume(device_t dev) +{ + struct mmcsd_softc *sc = device_get_softc(dev); + + MMCSD_LOCK(sc); + sc->suspend = 0; + if (sc->running <= 0) { + sc->running = 1; + MMCSD_UNLOCK(sc); + kproc_create(&mmcsd_task, sc, &sc->p, 0, 0, "task: mmc/sd card"); + } else + MMCSD_UNLOCK(sc); + return (0); +} + +static int mmcsd_open(struct disk *dp) { return (0); @@ -215,10 +252,10 @@ mmcsd_strategy(struct bio *bp) sc = (struct mmcsd_softc *)bp->bio_disk->d_drv1; MMCSD_LOCK(sc); - if (sc->running > 0) { + if (sc->running > 0 || sc->suspend > 0) { bioq_disksort(&sc->bio_queue, bp); - wakeup(sc); MMCSD_UNLOCK(sc); + wakeup(sc); } else { MMCSD_UNLOCK(sc); biofinish(bp, NULL, ENXIO); @@ -428,8 +465,8 @@ mmcsd_task(void *arg) out: /* tell parent we're done */ sc->running = -1; - wakeup(sc); MMCSD_UNLOCK(sc); + wakeup(sc); kproc_exit(0); } @@ -458,6 +495,8 @@ static device_method_t mmcsd_methods[] = DEVMETHOD(device_probe, mmcsd_probe), DEVMETHOD(device_attach, mmcsd_attach), DEVMETHOD(device_detach, mmcsd_detach), + DEVMETHOD(device_suspend, mmcsd_suspend), + DEVMETHOD(device_resume, mmcsd_resume), {0, 0}, }; From owner-svn-src-head@FreeBSD.ORG Sat Dec 6 21:52:32 2008 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C3E7E1065678; Sat, 6 Dec 2008 21:52:32 +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 B03168FC14; Sat, 6 Dec 2008 21:52:32 +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 mB6LqWFF006056; Sat, 6 Dec 2008 21:52:32 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mB6LqWW1006055; Sat, 6 Dec 2008 21:52:32 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <200812062152.mB6LqWW1006055@svn.freebsd.org> From: Alexander Motin Date: Sat, 6 Dec 2008 21:52: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: r185722 - head/sys/dev/sdhci X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 06 Dec 2008 21:52:32 -0000 Author: mav Date: Sat Dec 6 21:52:32 2008 New Revision: 185722 URL: http://svn.freebsd.org/changeset/base/185722 Log: Cleanup msleep() arguments. Move wakeup() out of the lock. Modified: head/sys/dev/sdhci/sdhci.c Modified: head/sys/dev/sdhci/sdhci.c ============================================================================== --- head/sys/dev/sdhci/sdhci.c Sat Dec 6 21:41:27 2008 (r185721) +++ head/sys/dev/sdhci/sdhci.c Sat Dec 6 21:52:32 2008 (r185722) @@ -1207,7 +1207,7 @@ sdhci_acquire_host(device_t brdev, devic SDHCI_LOCK(slot); while (slot->bus_busy) - msleep(slot, &slot->mtx, PZERO, "sdhciah", hz / 5); + msleep(slot, &slot->mtx, 0, "sdhciah", 0); slot->bus_busy++; /* Activate led. */ WR1(slot, SDHCI_HOST_CONTROL, slot->hostctrl |= SDHCI_CTRL_LED); @@ -1224,8 +1224,8 @@ sdhci_release_host(device_t brdev, devic /* Deactivate led. */ WR1(slot, SDHCI_HOST_CONTROL, slot->hostctrl &= ~SDHCI_CTRL_LED); slot->bus_busy--; - wakeup(slot); SDHCI_UNLOCK(slot); + wakeup(slot); return (0); } From owner-svn-src-head@FreeBSD.ORG Sat Dec 6 23:00:49 2008 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3C0C81065670; Sat, 6 Dec 2008 23:00: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 29AC18FC0A; Sat, 6 Dec 2008 23:00: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 mB6N0mV1007375; Sat, 6 Dec 2008 23:00:48 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mB6N0m6F007374; Sat, 6 Dec 2008 23:00:48 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <200812062300.mB6N0m6F007374@svn.freebsd.org> From: Alexander Motin Date: Sat, 6 Dec 2008 23:00: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: r185723 - head/sys/netgraph X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 06 Dec 2008 23:00:49 -0000 Author: mav Date: Sat Dec 6 23:00:48 2008 New Revision: 185723 URL: http://svn.freebsd.org/changeset/base/185723 Log: Carefully handle memory errors to keep peers compression/encryption state consistent. There are some cases reported where peers fatally getting out of sync without any visible reason. I hope this solve the problem. Modified: head/sys/netgraph/ng_mppc.c Modified: head/sys/netgraph/ng_mppc.c ============================================================================== --- head/sys/netgraph/ng_mppc.c Sat Dec 6 21:52:32 2008 (r185722) +++ head/sys/netgraph/ng_mppc.c Sat Dec 6 23:00:48 2008 (r185723) @@ -492,17 +492,18 @@ ng_mppc_compress(node_p node, struct mbu /* Work with contiguous regions of memory. */ inlen = m->m_pkthdr.len; inbuf = malloc(inlen, M_NETGRAPH_MPPC, M_NOWAIT); - if (inbuf == NULL) { - m_freem(m); - return (ENOMEM); - } + if (inbuf == NULL) + goto err1; m_copydata(m, 0, inlen, (caddr_t)inbuf); outlen = MPPC_MAX_BLOWUP(inlen); outbuf = malloc(outlen, M_NETGRAPH_MPPC, M_NOWAIT); if (outbuf == NULL) { - m_freem(m); free(inbuf, M_NETGRAPH_MPPC); +err1: + m_freem(m); + MPPC_InitCompressionHistory(d->history); + d->flushed = 1; return (ENOMEM); } @@ -538,8 +539,13 @@ ng_mppc_compress(node_p node, struct mbu free(outbuf, M_NETGRAPH_MPPC); /* Check m_devget() result. */ - if (m == NULL) + if (m == NULL) { + if (!d->flushed) { + MPPC_InitCompressionHistory(d->history); + d->flushed = 1; + } return (ENOMEM); + } } #endif @@ -551,6 +557,18 @@ ng_mppc_compress(node_p node, struct mbu /* Set header bits */ header |= MPPC_FLAG_ENCRYPTED; + /* We must own the mbuf chain exclusively to modify it. */ + m = m_unshare(m, M_DONTWAIT); + if (m == NULL) { + if (!d->flushed) { +#ifdef NETGRAPH_MPPC_COMPRESSION + MPPC_InitCompressionHistory(d->history); +#endif + d->flushed = 1; + } + return (ENOMEM); + } + /* Update key if it's time */ if ((d->cfg.bits & MPPE_STATELESS) != 0 || (d->cc & MPPE_UPDATE_MASK) == MPPE_UPDATE_FLAG) { @@ -562,11 +580,6 @@ ng_mppc_compress(node_p node, struct mbu rc4_init(&d->rc4, d->key, KEYLEN(d->cfg.bits)); } - /* We must own the mbuf chain exclusively to modify it. */ - m = m_unshare(m, M_DONTWAIT); - if (m == NULL) - return (ENOMEM); - /* Encrypt packet */ m1 = m; while (m1) { From owner-svn-src-head@FreeBSD.ORG Sat Dec 6 23:26:03 2008 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 634A01065677; Sat, 6 Dec 2008 23:26:03 +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 4D6FF8FC12; Sat, 6 Dec 2008 23:26:03 +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 mB6NQ31K007827; Sat, 6 Dec 2008 23:26:03 GMT (envelope-from nwhitehorn@svn.freebsd.org) Received: (from nwhitehorn@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mB6NQ39M007820; Sat, 6 Dec 2008 23:26:03 GMT (envelope-from nwhitehorn@svn.freebsd.org) Message-Id: <200812062326.mB6NQ39M007820@svn.freebsd.org> From: Nathan Whitehorn Date: Sat, 6 Dec 2008 23:26: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: r185724 - in head/sys: dev/adb powerpc/powermac X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 06 Dec 2008 23:26:03 -0000 Author: nwhitehorn Date: Sat Dec 6 23:26:02 2008 New Revision: 185724 URL: http://svn.freebsd.org/changeset/base/185724 Log: Fix some nasty race conditions in the VIA-CUDA driver that ended up preventing my right mouse button and keyboard LEDs from working due to mangled configuration packets. Fixed several other races and associated problems in the main ADB stack that were exposed while fixing this. Modified: head/sys/dev/adb/adb.h head/sys/dev/adb/adb_bus.c head/sys/dev/adb/adb_kbd.c head/sys/dev/adb/adb_mouse.c head/sys/dev/adb/adbvar.h head/sys/powerpc/powermac/cuda.c head/sys/powerpc/powermac/cudavar.h Modified: head/sys/dev/adb/adb.h ============================================================================== --- head/sys/dev/adb/adb.h Sat Dec 6 23:00:48 2008 (r185723) +++ head/sys/dev/adb/adb.h Sat Dec 6 23:26:02 2008 (r185724) @@ -68,7 +68,7 @@ uint8_t adb_get_device_type(device_t dev uint8_t adb_get_device_handler(device_t dev); uint8_t adb_set_device_handler(device_t dev, uint8_t newhandler); -uint8_t adb_read_register(device_t dev, u_char reg, size_t *len, void *data); +size_t adb_read_register(device_t dev, u_char reg, void *data); /* Bits for implementing ADB host bus adapters */ extern devclass_t adb_devclass; Modified: head/sys/dev/adb/adb_bus.c ============================================================================== --- head/sys/dev/adb/adb_bus.c Sat Dec 6 23:00:48 2008 (r185723) +++ head/sys/dev/adb/adb_bus.c Sat Dec 6 23:26:02 2008 (r185724) @@ -48,7 +48,7 @@ static void adb_bus_enumerate(void *xdev static void adb_probe_nomatch(device_t dev, device_t child); static int adb_print_child(device_t dev, device_t child); -static int adb_send_raw_packet_sync(device_t dev, uint8_t to, uint8_t command, uint8_t reg, int len, u_char *data); +static int adb_send_raw_packet_sync(device_t dev, uint8_t to, uint8_t command, uint8_t reg, int len, u_char *data, u_char *reply); static char *adb_device_string[] = { "HOST", "dongle", "keyboard", "mouse", "tablet", "modem", "RESERVED", "misc" @@ -118,8 +118,7 @@ adb_bus_enumerate(void *xdev) sc->packet_reply = 0; sc->autopoll_mask = 0; - - mtx_init(&sc->sc_sync_mtx,"adbsyn",NULL,MTX_DEF | MTX_RECURSE); + sc->sync_packet = 0xffff; /* Initialize devinfo */ for (i = 0; i < 16; i++) { @@ -128,7 +127,7 @@ adb_bus_enumerate(void *xdev) } /* Reset ADB bus */ - adb_send_raw_packet_sync(dev,0,ADB_COMMAND_BUS_RESET,0,0,NULL); + adb_send_raw_packet_sync(dev,0,ADB_COMMAND_BUS_RESET,0,0,NULL,NULL); DELAY(1500); /* Enumerate bus */ @@ -140,7 +139,7 @@ adb_bus_enumerate(void *xdev) do { reply = adb_send_raw_packet_sync(dev,i, - ADB_COMMAND_TALK,3,0,NULL); + ADB_COMMAND_TALK,3,0,NULL,NULL); if (reply) { /* If we got a response, relocate to next_free */ @@ -150,10 +149,10 @@ adb_bus_enumerate(void *xdev) r3 |= 0x00fe; adb_send_raw_packet_sync(dev,i, ADB_COMMAND_LISTEN,3, - sizeof(uint16_t),(u_char *)(&r3)); + sizeof(uint16_t),(u_char *)(&r3),NULL); adb_send_raw_packet_sync(dev,next_free, - ADB_COMMAND_TALK,3,0,NULL); + ADB_COMMAND_TALK,3,0,NULL,NULL); sc->devinfo[next_free].default_address = i; if (first_relocated < 0) @@ -169,9 +168,9 @@ adb_bus_enumerate(void *xdev) adb_send_raw_packet_sync(dev,first_relocated, ADB_COMMAND_LISTEN,3, - sizeof(uint16_t),(u_char *)(&r3)); + sizeof(uint16_t),(u_char *)(&r3),NULL); adb_send_raw_packet_sync(dev,i, - ADB_COMMAND_TALK,3,0,NULL); + ADB_COMMAND_TALK,3,0,NULL,NULL); sc->devinfo[i].default_address = i; sc->devinfo[(int)(first_relocated)].default_address = 0; @@ -194,10 +193,6 @@ adb_bus_enumerate(void *xdev) static int adb_bus_detach(device_t dev) { - struct adb_softc *sc = device_get_softc(dev); - - mtx_destroy(&sc->sc_sync_mtx); - return (bus_generic_detach(dev)); } @@ -230,6 +225,7 @@ adb_receive_raw_packet(device_t dev, u_c if (sc->sync_packet == command) { memcpy(sc->syncreg,data,(len > 8) ? 8 : len); atomic_store_rel_int(&sc->packet_reply,len + 1); + wakeup(sc); } if (sc->children[addr] != NULL) { @@ -317,12 +313,12 @@ adb_get_device_handler(device_t dev) static int adb_send_raw_packet_sync(device_t dev, uint8_t to, uint8_t command, - uint8_t reg, int len, u_char *data) + uint8_t reg, int len, u_char *data, u_char *reply) { u_char command_byte = 0; struct adb_softc *sc; int result = -1; - int i = 0; + int i = 1; sc = device_get_softc(dev); @@ -331,7 +327,8 @@ adb_send_raw_packet_sync(device_t dev, u command_byte |= reg; /* Wait if someone else has a synchronous request pending */ - mtx_lock(&sc->sc_sync_mtx); + while (!atomic_cmpset_int(&sc->sync_packet, 0xffff, command_byte)) + tsleep(sc, 0, "ADB sync", hz/10); sc->packet_reply = 0; sc->sync_packet = command_byte; @@ -343,21 +340,27 @@ adb_send_raw_packet_sync(device_t dev, u * Maybe the command got lost? Try resending and polling the * controller. */ - if (i > 40) + if (i % 40 == 0) ADB_HB_SEND_RAW_PACKET(sc->parent, command_byte, len, data, 1); - DELAY(100); + tsleep(sc, 0, "ADB sync", hz/10); i++; } result = sc->packet_reply - 1; + if (reply != NULL && result > 0) + memcpy(reply,sc->syncreg,result); + /* Clear packet sync */ sc->packet_reply = 0; - sc->sync_packet = 0xffff; /* We can't match a 16 bit value */ - mtx_unlock(&sc->sc_sync_mtx); + /* + * We can't match a value beyond 8 bits, so set sync_packet to + * 0xffff to avoid collisions. + */ + atomic_set_int(&sc->sync_packet, 0xffff); return (result); } @@ -375,37 +378,27 @@ adb_set_device_handler(device_t dev, uin newr3 = dinfo->register3 & 0xff00; newr3 |= (uint16_t)(newhandler); + adb_send_raw_packet_sync(sc->sc_dev,dinfo->address, ADB_COMMAND_LISTEN, + 3, sizeof(uint16_t), (u_char *)(&newr3), NULL); adb_send_raw_packet_sync(sc->sc_dev,dinfo->address, - ADB_COMMAND_LISTEN, 3, sizeof(uint16_t), (u_char *)(&newr3)); - adb_send_raw_packet_sync(sc->sc_dev,dinfo->address, - ADB_COMMAND_TALK, 3, 0, NULL); + ADB_COMMAND_TALK, 3, 0, NULL, NULL); return (dinfo->handler_id); } -uint8_t -adb_read_register(device_t dev, u_char reg, - size_t *len, void *data) +size_t +adb_read_register(device_t dev, u_char reg, void *data) { struct adb_softc *sc; struct adb_devinfo *dinfo; - size_t orig_len; + size_t result; dinfo = device_get_ivars(dev); sc = device_get_softc(device_get_parent(dev)); - orig_len = *len; - - mtx_lock(&sc->sc_sync_mtx); - - *len = adb_send_raw_packet_sync(sc->sc_dev,dinfo->address, - ADB_COMMAND_TALK, reg, 0, NULL); + result = adb_send_raw_packet_sync(sc->sc_dev,dinfo->address, + ADB_COMMAND_TALK, reg, 0, NULL, data); - if (*len > 0) - memcpy(data,sc->syncreg,*len); - - mtx_unlock(&sc->sc_sync_mtx); - - return ((*len > 0) ? 0 : -1); + return (result); } Modified: head/sys/dev/adb/adb_kbd.c ============================================================================== --- head/sys/dev/adb/adb_kbd.c Sat Dec 6 23:00:48 2008 (r185723) +++ head/sys/dev/adb/adb_kbd.c Sat Dec 6 23:26:02 2008 (r185724) @@ -271,11 +271,12 @@ adb_kbd_attach(device_t dev) } #endif - adb_set_autopoll(dev,1); - - /* Check (asynchronously) if we can read out the LED state from + /* Check if we can read out the LED state from this keyboard by reading the key state register */ - adb_send_packet(dev,ADB_COMMAND_TALK,2,0,NULL); + if (adb_read_register(dev, 2, NULL) == 2) + sc->have_led_control = 1; + + adb_set_autopoll(dev,1); return (0); } @@ -323,11 +324,6 @@ adb_kbd_receive_packet(device_t dev, u_c if (command != ADB_COMMAND_TALK) return 0; - if (reg == 2 && len == 2) { - sc->have_led_control = 1; - return 0; - } - if (reg != 0 || len != 2) return (0); Modified: head/sys/dev/adb/adb_mouse.c ============================================================================== --- head/sys/dev/adb/adb_mouse.c Sat Dec 6 23:00:48 2008 (r185723) +++ head/sys/dev/adb/adb_mouse.c Sat Dec 6 23:26:02 2008 (r185724) @@ -181,7 +181,7 @@ adb_mouse_attach(device_t dev) sc->mode.resolution = 200; break; case 4: - adb_read_register(dev,1,&r1_len,r1); + r1_len = adb_read_register(dev,1,r1); if (r1_len < 8) break; Modified: head/sys/dev/adb/adbvar.h ============================================================================== --- head/sys/dev/adb/adbvar.h Sat Dec 6 23:00:48 2008 (r185723) +++ head/sys/dev/adb/adbvar.h Sat Dec 6 23:26:02 2008 (r185724) @@ -40,7 +40,6 @@ struct adb_softc { device_t parent; struct intr_config_hook enum_hook; - struct mtx sc_sync_mtx; volatile int sync_packet; volatile int packet_reply; Modified: head/sys/powerpc/powermac/cuda.c ============================================================================== --- head/sys/powerpc/powermac/cuda.c Sat Dec 6 23:00:48 2008 (r185723) +++ head/sys/powerpc/powermac/cuda.c Sat Dec 6 23:26:02 2008 (r185724) @@ -65,10 +65,12 @@ static int cuda_probe(device_t); static int cuda_attach(device_t); static int cuda_detach(device_t); -static u_int cuda_adb_send(device_t dev, u_char command_byte, int len, +static u_int cuda_adb_send(device_t dev, u_char command_byte, int len, u_char *data, u_char poll); -static u_int cuda_adb_autopoll(device_t dev, uint16_t mask); -static void cuda_poll(device_t dev); +static u_int cuda_adb_autopoll(device_t dev, uint16_t mask); +static void cuda_poll(device_t dev); +static void cuda_send_inbound(struct cuda_softc *sc); +static void cuda_send_outbound(struct cuda_softc *sc); static device_method_t cuda_methods[] = { /* Device interface */ @@ -102,6 +104,8 @@ static devclass_t cuda_devclass; DRIVER_MODULE(cuda, macio, cuda_driver, cuda_devclass, 0, 0); DRIVER_MODULE(adb, cuda, adb_driver, adb_devclass, 0, 0); +MALLOC_DEFINE(M_CUDA, "cuda", "CUDA packet queue"); + static void cuda_intr(void *arg); static uint8_t cuda_read_reg(struct cuda_softc *sc, u_int offset); static void cuda_write_reg(struct cuda_softc *sc, u_int offset, uint8_t value); @@ -170,9 +174,11 @@ cuda_attach(device_t dev) sc->sc_waiting = 0; sc->sc_polling = 0; sc->sc_state = CUDA_NOTREADY; - sc->sc_error = 0; sc->sc_autopoll = 0; + STAILQ_INIT(&sc->sc_inq); + STAILQ_INIT(&sc->sc_outq); + /* Init CUDA */ reg = cuda_read_reg(sc, vDirB); @@ -335,42 +341,126 @@ cuda_send(void *cookie, int poll, int le { struct cuda_softc *sc = cookie; device_t dev = sc->sc_dev; + struct cuda_packet *pkt; if (sc->sc_state == CUDA_NOTREADY) - return -1; + return (-1); mtx_lock(&sc->sc_mutex); - if (sc->sc_state != CUDA_IDLE) { - if (sc->sc_waiting == 0) { - sc->sc_waiting = 1; - } else { - mtx_unlock(&sc->sc_mutex); - return -1; - } + pkt = malloc(sizeof(struct cuda_packet), M_CUDA, M_WAITOK); + pkt->len = length - 1; + pkt->type = msg[0]; + memcpy(pkt->data, &msg[1], pkt->len); + + STAILQ_INSERT_TAIL(&sc->sc_outq, pkt, pkt_q); + + /* + * If we already are sending a packet, we should bail now that this + * one has been added to the queue. + */ + + if (sc->sc_waiting) { + mtx_unlock(&sc->sc_mutex); + return (0); } - sc->sc_error = 0; - memcpy(sc->sc_out, msg, length); - sc->sc_out_length = length; + cuda_send_outbound(sc); + mtx_unlock(&sc->sc_mutex); + + if (sc->sc_polling || poll || cold) + cuda_poll(dev); + + return (0); +} + +static void +cuda_send_outbound(struct cuda_softc *sc) +{ + struct cuda_packet *pkt; + + mtx_assert(&sc->sc_mutex, MA_OWNED); + + pkt = STAILQ_FIRST(&sc->sc_outq); + if (pkt == NULL) + return; + + sc->sc_out_length = pkt->len + 1; + memcpy(sc->sc_out, &pkt->type, pkt->len + 1); sc->sc_sent = 0; - if (sc->sc_waiting != 1) { - DELAY(150); + free(pkt, M_CUDA); + STAILQ_REMOVE_HEAD(&sc->sc_outq, pkt_q); + + sc->sc_waiting = 1; + + cuda_poll(sc->sc_dev); + + DELAY(150); + + if (sc->sc_state == CUDA_IDLE && !cuda_intr_state(sc)) { sc->sc_state = CUDA_OUT; cuda_out(sc); cuda_write_reg(sc, vSR, sc->sc_out[0]); cuda_ack_off(sc); cuda_tip(sc); } - sc->sc_waiting = 1; - mtx_unlock(&sc->sc_mutex); +} - if (sc->sc_polling || poll || cold) { - cuda_poll(dev); +static void +cuda_send_inbound(struct cuda_softc *sc) +{ + device_t dev; + struct cuda_packet *pkt; + + dev = sc->sc_dev; + + mtx_lock(&sc->sc_mutex); + + while ((pkt = STAILQ_FIRST(&sc->sc_inq)) != NULL) { + STAILQ_REMOVE_HEAD(&sc->sc_inq, pkt_q); + + mtx_unlock(&sc->sc_mutex); + + /* check if we have a handler for this message */ + switch (pkt->type) { + case CUDA_ADB: + if (pkt->len > 2) { + adb_receive_raw_packet(sc->adb_bus, + pkt->data[0],pkt->data[1], + pkt->len - 2,&pkt->data[2]); + } else { + adb_receive_raw_packet(sc->adb_bus, + pkt->data[0],pkt->data[1],0,NULL); + } + break; + case CUDA_PSEUDO: + mtx_lock(&sc->sc_mutex); + if (pkt->data[0] == CMD_AUTOPOLL) + sc->sc_autopoll = 1; + mtx_unlock(&sc->sc_mutex); + break; + case CUDA_ERROR: + /* + * CUDA will throw errors if we miss a race between + * sending and receiving packets. This is already + * handled when we abort packet output to handle + * this packet in cuda_intr(). Thus, we ignore + * these messages. + */ + break; + default: + device_printf(dev,"unknown CUDA command %d\n", + pkt->type); + break; + } + + free(pkt,M_CUDA); + + mtx_lock(&sc->sc_mutex); } - return 0; + mtx_unlock(&sc->sc_mutex); } static void @@ -382,8 +472,7 @@ cuda_poll(device_t dev) !sc->sc_waiting) return; - if ((cuda_read_reg(sc, vIFR) & vSR_INT) == vSR_INT) - cuda_intr(dev); + cuda_intr(dev); } static void @@ -392,7 +481,7 @@ cuda_intr(void *arg) device_t dev; struct cuda_softc *sc; - int i, ending, type, restart_send; + int i, ending, restart_send, process_inbound; uint8_t reg; dev = (device_t)arg; @@ -401,7 +490,13 @@ cuda_intr(void *arg) mtx_lock(&sc->sc_mutex); restart_send = 0; + process_inbound = 0; reg = cuda_read_reg(sc, vIFR); + if ((reg & vSR_INT) != vSR_INT) { + mtx_unlock(&sc->sc_mutex); + return; + } + cuda_write_reg(sc, vIFR, 0x7f); /* Clear interrupt */ switch_start: @@ -450,13 +545,6 @@ switch_start: } else sc->sc_received++; - if (sc->sc_received > 3) { - if ((sc->sc_in[3] == CMD_IIC) && - (sc->sc_received > (sc->sc_i2c_read_len + 4))) { - ending = 1; - } - } - /* intr off means this is the last byte (end of frame) */ if (cuda_intr_state(sc) == 0) { ending = 1; @@ -465,42 +553,24 @@ switch_start: } if (ending == 1) { /* end of message? */ - sc->sc_in[0] = sc->sc_received - 1; + struct cuda_packet *pkt; /* reset vars and signal the end of this frame */ cuda_idle(sc); - /* check if we have a handler for this message */ - type = sc->sc_in[1]; + /* Queue up the packet */ + pkt = malloc(sizeof(struct cuda_packet), M_CUDA, + M_WAITOK); + + pkt->len = sc->sc_received - 2; + pkt->type = sc->sc_in[1]; + memcpy(pkt->data, &sc->sc_in[2], pkt->len); - switch (type) { - case CUDA_ADB: - if (sc->sc_received > 4) { - adb_receive_raw_packet(sc->adb_bus, - sc->sc_in[2],sc->sc_in[3], - sc->sc_received - 4,&sc->sc_in[4]); - } else { - adb_receive_raw_packet(sc->adb_bus, - sc->sc_in[2],sc->sc_in[3],0,NULL); - } - break; - case CUDA_PSEUDO: - if (sc->sc_in[3] == CMD_AUTOPOLL) - sc->sc_autopoll = 1; - break; - case CUDA_ERROR: - device_printf(dev,"CUDA Error\n"); - sc->sc_error = 1; - break; - default: - device_printf(dev,"unknown CUDA command %d\n", - type); - break; - } + STAILQ_INSERT_TAIL(&sc->sc_inq, pkt, pkt_q); sc->sc_state = CUDA_IDLE; - sc->sc_received = 0; + process_inbound = 1; /* * If there is something waiting to be sent out, @@ -526,6 +596,7 @@ switch_start: DELAY(150); goto switch_start; } + /* * If we got here, it's ok to start sending * so load the first byte and tell the chip @@ -558,7 +629,6 @@ switch_start: break; } if (sc->sc_out_length == sc->sc_sent) { /* check for done */ - sc->sc_waiting = 0; /* done writing */ sc->sc_state = CUDA_IDLE; /* signal bus is idle */ cuda_in(sc); @@ -579,14 +649,26 @@ switch_start: } mtx_unlock(&sc->sc_mutex); + + if (process_inbound) + cuda_send_inbound(sc); + + mtx_lock(&sc->sc_mutex); + /* If we have another packet waiting, set it up */ + if (!sc->sc_waiting && sc->sc_state == CUDA_IDLE) + cuda_send_outbound(sc); + + mtx_unlock(&sc->sc_mutex); + } static u_int -cuda_adb_send(device_t dev, u_char command_byte, int len, u_char *data, u_char poll) +cuda_adb_send(device_t dev, u_char command_byte, int len, u_char *data, + u_char poll) { struct cuda_softc *sc = device_get_softc(dev); - int i; uint8_t packet[16]; + int i; /* construct an ADB command packet and send it */ packet[0] = CUDA_ADB; @@ -594,15 +676,9 @@ cuda_adb_send(device_t dev, u_char comma for (i = 0; i < len; i++) packet[i + 2] = data[i]; - if (poll) - cuda_poll(dev); - cuda_send(sc, poll, len + 2, packet); - if (poll) - cuda_poll(dev); - - return 0; + return (0); } static u_int @@ -615,17 +691,14 @@ cuda_adb_autopoll(device_t dev, uint16_t if (cmd[2] == sc->sc_autopoll) { mtx_unlock(&sc->sc_mutex); - return 0; + return (0); } - while (sc->sc_state != CUDA_IDLE) - mtx_sleep(dev,&sc->sc_mutex,0,"cuda",1); - sc->sc_autopoll = -1; - cuda_send(sc, 0, 3, cmd); + cuda_send(sc, 1, 3, cmd); mtx_unlock(&sc->sc_mutex); - - return 0; + + return (0); } Modified: head/sys/powerpc/powermac/cudavar.h ============================================================================== --- head/sys/powerpc/powermac/cudavar.h Sat Dec 6 23:00:48 2008 (r185723) +++ head/sys/powerpc/powermac/cudavar.h Sat Dec 6 23:26:02 2008 (r185724) @@ -61,6 +61,16 @@ #define CUDA_IN 0x4 /* receiving data */ #define CUDA_POLLING 0x5 /* polling - II only */ +struct cuda_packet { + uint8_t len; + uint8_t type; + + uint8_t data[253]; + STAILQ_ENTRY(cuda_packet) pkt_q; +}; + +STAILQ_HEAD(cuda_pktq, cuda_packet); + struct cuda_softc { device_t sc_dev; int sc_memrid; @@ -73,22 +83,24 @@ struct cuda_softc { device_t adb_bus; - int sc_node; - volatile int sc_state; - int sc_waiting; - int sc_polling; - int sc_sent; - int sc_out_length; - int sc_received; - int sc_iic_done; - int sc_error; - volatile int sc_autopoll; + int sc_node; + volatile int sc_state; + int sc_waiting; + int sc_polling; + int sc_iic_done; + volatile int sc_autopoll; int sc_i2c_read_len; /* internal buffers */ - uint8_t sc_in[256]; - uint8_t sc_out[256]; + uint8_t sc_in[256]; + uint8_t sc_out[256]; + int sc_sent; + int sc_out_length; + int sc_received; + + struct cuda_pktq sc_inq; + struct cuda_pktq sc_outq; }; #endif /* _POWERPC_CUDAVAR_H_ */