From owner-svn-src-head@FreeBSD.ORG Sun Oct 30 02:19:39 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 94D011065670; Sun, 30 Oct 2011 02:19:39 +0000 (UTC) (envelope-from marcel@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 6ACBD8FC13; Sun, 30 Oct 2011 02:19:39 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p9U2Jd1W043472; Sun, 30 Oct 2011 02:19:39 GMT (envelope-from marcel@svn.freebsd.org) Received: (from marcel@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p9U2Jd2q043468; Sun, 30 Oct 2011 02:19:39 GMT (envelope-from marcel@svn.freebsd.org) Message-Id: <201110300219.p9U2Jd2q043468@svn.freebsd.org> From: Marcel Moolenaar Date: Sun, 30 Oct 2011 02:19: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: r226925 - in head/sys: amd64/amd64 i386/i386 kern X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 30 Oct 2011 02:19:39 -0000 Author: marcel Date: Sun Oct 30 02:19:39 2011 New Revision: 226925 URL: http://svn.freebsd.org/changeset/base/226925 Log: Revert rev. 226893: subr_syscall.c is being included from C files and on amd64 with FREEBSD32 enabled, this means that systrace_probe_func gets defined twice. Modified: head/sys/amd64/amd64/trap.c head/sys/i386/i386/trap.c head/sys/kern/subr_syscall.c Modified: head/sys/amd64/amd64/trap.c ============================================================================== --- head/sys/amd64/amd64/trap.c Sun Oct 30 01:24:56 2011 (r226924) +++ head/sys/amd64/amd64/trap.c Sun Oct 30 02:19:39 2011 (r226925) @@ -104,6 +104,13 @@ dtrace_trap_func_t dtrace_trap_func; dtrace_doubletrap_func_t dtrace_doubletrap_func; /* + * This is a hook which is initialised by the systrace module + * when it is loaded. This keeps the DTrace syscall provider + * implementation opaque. + */ +systrace_probe_func_t systrace_probe_func; + +/* * These hooks are necessary for the pid, usdt and fasttrap providers. */ dtrace_fasttrap_probe_ptr_t dtrace_fasttrap_probe_ptr; Modified: head/sys/i386/i386/trap.c ============================================================================== --- head/sys/i386/i386/trap.c Sun Oct 30 01:24:56 2011 (r226924) +++ head/sys/i386/i386/trap.c Sun Oct 30 02:19:39 2011 (r226925) @@ -113,6 +113,13 @@ dtrace_trap_func_t dtrace_trap_func; dtrace_doubletrap_func_t dtrace_doubletrap_func; /* + * This is a hook which is initialised by the systrace module + * when it is loaded. This keeps the DTrace syscall provider + * implementation opaque. + */ +systrace_probe_func_t systrace_probe_func; + +/* * These hooks are necessary for the pid, usdt and fasttrap providers. */ dtrace_fasttrap_probe_ptr_t dtrace_fasttrap_probe_ptr; Modified: head/sys/kern/subr_syscall.c ============================================================================== --- head/sys/kern/subr_syscall.c Sun Oct 30 01:24:56 2011 (r226924) +++ head/sys/kern/subr_syscall.c Sun Oct 30 02:19:39 2011 (r226925) @@ -52,15 +52,6 @@ __FBSDID("$FreeBSD$"); #endif #include -#ifdef KDTRACE_HOOKS -/* - * This is a hook which is initialised by the systrace module - * when it is loaded. This keeps the DTrace syscall provider - * implementation opaque. - */ -systrace_probe_func_t systrace_probe_func; -#endif - static inline int syscallenter(struct thread *td, struct syscall_args *sa) { From owner-svn-src-head@FreeBSD.ORG Sun Oct 30 04:04:41 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 222141065670; Sun, 30 Oct 2011 04:04:41 +0000 (UTC) (envelope-from dougb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id ECA108FC0A; Sun, 30 Oct 2011 04:04:40 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p9U44evt047075; Sun, 30 Oct 2011 04:04:40 GMT (envelope-from dougb@svn.freebsd.org) Received: (from dougb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p9U44efm047073; Sun, 30 Oct 2011 04:04:40 GMT (envelope-from dougb@svn.freebsd.org) Message-Id: <201110300404.p9U44efm047073@svn.freebsd.org> From: Doug Barton Date: Sun, 30 Oct 2011 04:04: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: r226927 - head/usr.bin/calendar/calendars X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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 Oct 2011 04:04:41 -0000 Author: dougb Date: Sun Oct 30 04:04:40 2011 New Revision: 226927 URL: http://svn.freebsd.org/changeset/base/226927 Log: Add birth date for Ken Thompson Add birth and death dates for Steve Jobs Update birth and add death date for Dennis Ritchie PR: bin/162157 Submitted by: Niclas Zeising Modified: head/usr.bin/calendar/calendars/calendar.birthday Modified: head/usr.bin/calendar/calendars/calendar.birthday ============================================================================== --- head/usr.bin/calendar/calendars/calendar.birthday Sun Oct 30 02:36:49 2011 (r226926) +++ head/usr.bin/calendar/calendars/calendar.birthday Sun Oct 30 04:04:40 2011 (r226927) @@ -42,6 +42,7 @@ 01/30 Franklin Delano Roosevelt born in Hyde Park, New York, 1882 01/31 Jackie Robinson born, 1919 02/03 Gertrude Stein born, 1874 +02/04 Ken Thompson, creator of unix, born, 1943 02/05 Alex Harvey (SAHB) is born in Glasgow, Scotland, 1935 02/06 King George VI of UK dies; his daughter becomes Elizabeth II, 1952 02/07 Sinclair Lewis born, 1885 @@ -68,6 +69,7 @@ 02/22 Pierre Jules Cesar Janssen born, 1838, found hydrogen in the sun 02/23 W.E.B. DuBois born, 1868 02/24 Winslow Homer born, 1836 +02/24 Steve Jobs born, 1955 02/25 George Harrison born in Liverpool, England, 1943 02/25 Renoir born, 1841 02/26 Dominique Francois Jean Arago born, 1786; @@ -212,7 +214,7 @@ 09/08 Richard ``the Lionheart'', king of England born in Oxford, 1157 09/08 Peter Sellers born in Southsea, England, 1925 09/09 Chinese Communist Party Chairman Mao Tse-Tung dies at age 82, 1976 -09/09 Dennis Ritchie born, 1941 +09/09 Dennis MacAlistair Ritchie, creater of C, born, 1941 09/12 Jesse Owens born, 1913 09/13 Walter Reed born, 1851 09/15 Agatha Christie born in Torquay, England, 1890 @@ -239,6 +241,8 @@ 10/02 Mohandas K. Gandhi born at Porbandar, Kathiawad, India, 1869 10/04 John V. Atanasoff born, 1903 10/05 Ray Kroc (founder of McDonald's) born, 1902 +10/05 Steve Jobs died at the age of 56, 2011 +10/12 Dennis MacAlistair Ritchie died at the age of 70, 2011 10/13 Lenny Bruce is born in New York City, 1925 10/13 Virgil (Publius Vergilius Maro) born near Mantua, Italy, 70 BC 10/14 Dwight David Eisenhower, 34th President of the United States, born in From owner-svn-src-head@FreeBSD.ORG Sun Oct 30 05:06:14 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 93137106566C; Sun, 30 Oct 2011 05:06:14 +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 827368FC12; Sun, 30 Oct 2011 05:06:14 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p9U56E2q049049; Sun, 30 Oct 2011 05:06:14 GMT (envelope-from alc@svn.freebsd.org) Received: (from alc@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p9U56E3l049042; Sun, 30 Oct 2011 05:06:14 GMT (envelope-from alc@svn.freebsd.org) Message-Id: <201110300506.p9U56E3l049042@svn.freebsd.org> From: Alan Cox Date: Sun, 30 Oct 2011 05:06: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: r226928 - head/sys/vm X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 30 Oct 2011 05:06:14 -0000 Author: alc Date: Sun Oct 30 05:06:14 2011 New Revision: 226928 URL: http://svn.freebsd.org/changeset/base/226928 Log: Eliminate vm_phys_bootstrap_alloc(). It was a failed attempt at eliminating duplicated code in the various pmap implementations. Micro-optimize vm_phys_free_pages(). Introduce vm_phys_free_contig(). It is fast routine for freeing an arbitrary number of physically contiguous pages. In particular, it doesn't require the number of pages to be a power of two. Use "u_long" instead of "unsigned long". Bruce Evans (bde@) has convinced me that the "boundary" parameters to kmem_alloc_contig(), vm_phys_alloc_contig(), and vm_reserv_reclaim_contig() should be of type "vm_paddr_t" and not "u_long". Make this change. Modified: head/sys/vm/vm_contig.c head/sys/vm/vm_extern.h head/sys/vm/vm_phys.c head/sys/vm/vm_phys.h head/sys/vm/vm_reserv.c head/sys/vm/vm_reserv.h Modified: head/sys/vm/vm_contig.c ============================================================================== --- head/sys/vm/vm_contig.c Sun Oct 30 04:04:40 2011 (r226927) +++ head/sys/vm/vm_contig.c Sun Oct 30 05:06:14 2011 (r226928) @@ -335,7 +335,8 @@ contigmapping(vm_map_t map, vm_size_t si vm_offset_t kmem_alloc_contig(vm_map_t map, vm_size_t size, int flags, vm_paddr_t low, - vm_paddr_t high, u_long alignment, u_long boundary, vm_memattr_t memattr) + vm_paddr_t high, u_long alignment, vm_paddr_t boundary, + vm_memattr_t memattr) { vm_offset_t ret; vm_page_t pages; Modified: head/sys/vm/vm_extern.h ============================================================================== --- head/sys/vm/vm_extern.h Sun Oct 30 04:04:40 2011 (r226927) +++ head/sys/vm/vm_extern.h Sun Oct 30 05:06:14 2011 (r226928) @@ -44,7 +44,7 @@ vm_offset_t kmem_alloc(vm_map_t, vm_size vm_offset_t kmem_alloc_attr(vm_map_t map, vm_size_t size, int flags, vm_paddr_t low, vm_paddr_t high, vm_memattr_t memattr); vm_offset_t kmem_alloc_contig(vm_map_t map, vm_size_t size, int flags, - vm_paddr_t low, vm_paddr_t high, u_long alignment, u_long boundary, + vm_paddr_t low, vm_paddr_t high, u_long alignment, vm_paddr_t boundary, vm_memattr_t memattr); vm_offset_t kmem_alloc_nofault(vm_map_t, vm_size_t); vm_offset_t kmem_alloc_nofault_space(vm_map_t, vm_size_t, int); Modified: head/sys/vm/vm_phys.c ============================================================================== --- head/sys/vm/vm_phys.c Sun Oct 30 04:04:40 2011 (r226927) +++ head/sys/vm/vm_phys.c Sun Oct 30 05:06:14 2011 (r226928) @@ -490,26 +490,6 @@ vm_phys_alloc_freelist_pages(int flind, } /* - * Allocate physical memory from phys_avail[]. - */ -vm_paddr_t -vm_phys_bootstrap_alloc(vm_size_t size, unsigned long alignment) -{ - vm_paddr_t pa; - int i; - - size = round_page(size); - for (i = 0; phys_avail[i + 1] != 0; i += 2) { - if (phys_avail[i + 1] - phys_avail[i] < size) - continue; - pa = phys_avail[i]; - phys_avail[i] += size; - return (pa); - } - panic("vm_phys_bootstrap_alloc"); -} - -/* * Find the vm_page corresponding to the given physical address. */ vm_page_t @@ -554,7 +534,7 @@ vm_phys_free_pages(vm_page_t m, int orde { struct vm_freelist *fl; struct vm_phys_seg *seg; - vm_paddr_t pa, pa_buddy; + vm_paddr_t pa; vm_page_t m_buddy; KASSERT(m->order == VM_NFREEORDER, @@ -566,25 +546,26 @@ vm_phys_free_pages(vm_page_t m, int orde KASSERT(order < VM_NFREEORDER, ("vm_phys_free_pages: order %d is out of range", order)); mtx_assert(&vm_page_queue_free_mtx, MA_OWNED); - pa = VM_PAGE_TO_PHYS(m); seg = &vm_phys_segs[m->segind]; - while (order < VM_NFREEORDER - 1) { - pa_buddy = pa ^ (1 << (PAGE_SHIFT + order)); - if (pa_buddy < seg->start || - pa_buddy >= seg->end) - break; - m_buddy = &seg->first_page[atop(pa_buddy - seg->start)]; - if (m_buddy->order != order) - break; - fl = (*seg->free_queues)[m_buddy->pool]; - TAILQ_REMOVE(&fl[m_buddy->order].pl, m_buddy, pageq); - fl[m_buddy->order].lcnt--; - m_buddy->order = VM_NFREEORDER; - if (m_buddy->pool != m->pool) - vm_phys_set_pool(m->pool, m_buddy, order); - order++; - pa &= ~((1 << (PAGE_SHIFT + order)) - 1); - m = &seg->first_page[atop(pa - seg->start)]; + if (order < VM_NFREEORDER - 1) { + pa = VM_PAGE_TO_PHYS(m); + do { + pa ^= ((vm_paddr_t)1 << (PAGE_SHIFT + order)); + if (pa < seg->start || pa >= seg->end) + break; + m_buddy = &seg->first_page[atop(pa - seg->start)]; + if (m_buddy->order != order) + break; + fl = (*seg->free_queues)[m_buddy->pool]; + TAILQ_REMOVE(&fl[order].pl, m_buddy, pageq); + fl[order].lcnt--; + m_buddy->order = VM_NFREEORDER; + if (m_buddy->pool != m->pool) + vm_phys_set_pool(m->pool, m_buddy, order); + order++; + pa &= ~(((vm_paddr_t)1 << (PAGE_SHIFT + order)) - 1); + m = &seg->first_page[atop(pa - seg->start)]; + } while (order < VM_NFREEORDER - 1); } m->order = order; fl = (*seg->free_queues)[m->pool]; @@ -593,6 +574,47 @@ vm_phys_free_pages(vm_page_t m, int orde } /* + * Free a contiguous, arbitrarily sized set of physical pages. + * + * The free page queues must be locked. + */ +void +vm_phys_free_contig(vm_page_t m, u_long npages) +{ + u_int n; + int order; + + /* + * Avoid unnecessary coalescing by freeing the pages in the largest + * possible power-of-two-sized subsets. + */ + mtx_assert(&vm_page_queue_free_mtx, MA_OWNED); + for (;; npages -= n) { + /* + * Unsigned "min" is used here so that "order" is assigned + * "VM_NFREEORDER - 1" when "m"'s physical address is zero + * or the low-order bits of its physical address are zero + * because the size of a physical address exceeds the size of + * a long. + */ + order = min(ffsl(VM_PAGE_TO_PHYS(m) >> PAGE_SHIFT) - 1, + VM_NFREEORDER - 1); + n = 1 << order; + if (npages < n) + break; + vm_phys_free_pages(m, order); + m += n; + } + /* The residual "npages" is less than "1 << (VM_NFREEORDER - 1)". */ + for (; npages > 0; npages -= n) { + order = flsl(npages) - 1; + n = 1 << order; + vm_phys_free_pages(m, order); + m += n; + } +} + +/* * Set the pool for a contiguous, power of two-sized set of physical pages. */ void @@ -728,14 +750,15 @@ vm_phys_zero_pages_idle(void) * "alignment" and "boundary" must be a power of two. */ vm_page_t -vm_phys_alloc_contig(unsigned long npages, vm_paddr_t low, vm_paddr_t high, - unsigned long alignment, unsigned long boundary) +vm_phys_alloc_contig(u_long npages, vm_paddr_t low, vm_paddr_t high, + u_long alignment, vm_paddr_t boundary) { struct vm_freelist *fl; struct vm_phys_seg *seg; struct vnode *vp; vm_paddr_t pa, pa_last, size; vm_page_t deferred_vdrop_list, m, m_ret; + u_long npages_end; int domain, flind, i, oind, order, pind; #if VM_NDOMAIN > 1 @@ -848,13 +871,10 @@ done: deferred_vdrop_list = m; } } - for (; i < roundup2(npages, 1 << imin(oind, order)); i++) { - m = &m_ret[i]; - KASSERT(m->order == VM_NFREEORDER, - ("vm_phys_alloc_contig: page %p has unexpected order %d", - m, m->order)); - vm_phys_free_pages(m, 0); - } + /* Return excess pages to the free lists. */ + npages_end = roundup2(npages, 1 << imin(oind, order)); + if (npages < npages_end) + vm_phys_free_contig(&m_ret[npages], npages_end - npages); mtx_unlock(&vm_page_queue_free_mtx); while (deferred_vdrop_list != NULL) { vdrop((struct vnode *)deferred_vdrop_list->pageq.tqe_prev); Modified: head/sys/vm/vm_phys.h ============================================================================== --- head/sys/vm/vm_phys.h Sun Oct 30 04:04:40 2011 (r226927) +++ head/sys/vm/vm_phys.h Sun Oct 30 05:06:14 2011 (r226928) @@ -50,12 +50,11 @@ struct mem_affinity { extern struct mem_affinity *mem_affinity; void vm_phys_add_page(vm_paddr_t pa); -vm_page_t vm_phys_alloc_contig(unsigned long npages, - vm_paddr_t low, vm_paddr_t high, - unsigned long alignment, unsigned long boundary); +vm_page_t vm_phys_alloc_contig(u_long npages, vm_paddr_t low, vm_paddr_t high, + u_long alignment, vm_paddr_t boundary); vm_page_t vm_phys_alloc_freelist_pages(int flind, int pool, int order); vm_page_t vm_phys_alloc_pages(int pool, int order); -vm_paddr_t vm_phys_bootstrap_alloc(vm_size_t size, unsigned long alignment); +void vm_phys_free_contig(vm_page_t m, u_long npages); void vm_phys_free_pages(vm_page_t m, int order); void vm_phys_init(void); void vm_phys_set_pool(int pool, vm_page_t m, int order); Modified: head/sys/vm/vm_reserv.c ============================================================================== --- head/sys/vm/vm_reserv.c Sun Oct 30 04:04:40 2011 (r226927) +++ head/sys/vm/vm_reserv.c Sun Oct 30 05:06:14 2011 (r226928) @@ -628,7 +628,7 @@ vm_reserv_reclaim_inactive(void) */ boolean_t vm_reserv_reclaim_contig(vm_paddr_t size, vm_paddr_t low, vm_paddr_t high, - unsigned long alignment, unsigned long boundary) + u_long alignment, vm_paddr_t boundary) { vm_paddr_t pa, pa_length; vm_reserv_t rv; Modified: head/sys/vm/vm_reserv.h ============================================================================== --- head/sys/vm/vm_reserv.h Sun Oct 30 04:04:40 2011 (r226927) +++ head/sys/vm/vm_reserv.h Sun Oct 30 05:06:14 2011 (r226928) @@ -49,8 +49,7 @@ void vm_reserv_init(void); int vm_reserv_level_iffullpop(vm_page_t m); boolean_t vm_reserv_reactivate_page(vm_page_t m); boolean_t vm_reserv_reclaim_contig(vm_paddr_t size, vm_paddr_t low, - vm_paddr_t high, unsigned long alignment, - unsigned long boundary); + vm_paddr_t high, u_long alignment, vm_paddr_t boundary); boolean_t vm_reserv_reclaim_inactive(void); void vm_reserv_rename(vm_page_t m, vm_object_t new_object, vm_object_t old_object, vm_pindex_t old_object_offset); From owner-svn-src-head@FreeBSD.ORG Sun Oct 30 12:33:20 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3DECB106566B; Sun, 30 Oct 2011 12:33:20 +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 2E20E8FC18; Sun, 30 Oct 2011 12:33:20 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p9UCXJwo068474; Sun, 30 Oct 2011 12:33:19 GMT (envelope-from brueffer@svn.freebsd.org) Received: (from brueffer@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p9UCXJun068472; Sun, 30 Oct 2011 12:33:19 GMT (envelope-from brueffer@svn.freebsd.org) Message-Id: <201110301233.p9UCXJun068472@svn.freebsd.org> From: Christian Brueffer Date: Sun, 30 Oct 2011 12:33: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: r226937 - head/libexec/rshd X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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 Oct 2011 12:33:20 -0000 Author: brueffer Date: Sun Oct 30 12:33:19 2011 New Revision: 226937 URL: http://svn.freebsd.org/changeset/base/226937 Log: Fix a misplaced parenthesis. PR: 162164 Submitted by: Henning Petersen MFC after: 1 week Modified: head/libexec/rshd/rshd.c Modified: head/libexec/rshd/rshd.c ============================================================================== --- head/libexec/rshd/rshd.c Sun Oct 30 12:23:06 2011 (r226936) +++ head/libexec/rshd/rshd.c Sun Oct 30 12:33:19 2011 (r226937) @@ -317,7 +317,7 @@ doit(struct sockaddr *fromp) } if ((pam_err = pam_set_item(pamh, PAM_RUSER, ruser)) != PAM_SUCCESS || - (pam_err = pam_set_item(pamh, PAM_RHOST, rhost) != PAM_SUCCESS)) { + (pam_err = pam_set_item(pamh, PAM_RHOST, rhost)) != PAM_SUCCESS) { syslog(LOG_ERR|LOG_AUTH, "pam_set_item(): %s", pam_strerror(pamh, pam_err)); rshd_errx(1, "Login incorrect."); From owner-svn-src-head@FreeBSD.ORG Sun Oct 30 14:55:13 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A24E0106564A; Sun, 30 Oct 2011 14:55:13 +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 87D188FC13; Sun, 30 Oct 2011 14:55:13 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p9UEt0G9072949; Sun, 30 Oct 2011 14:55:00 GMT (envelope-from kevlo@svn.freebsd.org) Received: (from kevlo@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p9UEt0gA072947; Sun, 30 Oct 2011 14:55:00 GMT (envelope-from kevlo@svn.freebsd.org) Message-Id: <201110301455.p9UEt0gA072947@svn.freebsd.org> From: Kevin Lo Date: Sun, 30 Oct 2011 14:55: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: r226938 - head/sys/contrib/pf/net X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 30 Oct 2011 14:55:13 -0000 Author: kevlo Date: Sun Oct 30 14:55:00 2011 New Revision: 226938 URL: http://svn.freebsd.org/changeset/base/226938 Log: Add missing PF_UNLOCK in pf_test Reviewed by: bz Modified: head/sys/contrib/pf/net/pf.c Modified: head/sys/contrib/pf/net/pf.c ============================================================================== --- head/sys/contrib/pf/net/pf.c Sun Oct 30 12:33:19 2011 (r226937) +++ head/sys/contrib/pf/net/pf.c Sun Oct 30 14:55:00 2011 (r226938) @@ -7176,11 +7176,15 @@ pf_test6(int dir, struct ifnet *ifp, str } #ifdef __FreeBSD__ - if (pd.pf_mtag->flags & PF_TAG_GENERATED) + if (pd.pf_mtag->flags & PF_TAG_GENERATED) { + PF_UNLOCK(); #else if (m->m_pkthdr.pf.flags & PF_TAG_GENERATED) #endif return (PF_PASS); +#ifdef __FreeBSD__ + } +#endif /* We do IP header normalization and packet reassembly here */ if (pf_normalize_ip6(m0, dir, kif, &reason, &pd) != PF_PASS) { From owner-svn-src-head@FreeBSD.ORG Sun Oct 30 15:21:27 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 821D2106564A; Sun, 30 Oct 2011 15:21:27 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 71C818FC18; Sun, 30 Oct 2011 15:21:27 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p9UFLRoT073785; Sun, 30 Oct 2011 15:21:27 GMT (envelope-from trasz@svn.freebsd.org) Received: (from trasz@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p9UFLR1u073782; Sun, 30 Oct 2011 15:21:27 GMT (envelope-from trasz@svn.freebsd.org) Message-Id: <201110301521.p9UFLR1u073782@svn.freebsd.org> From: Edward Tomasz Napierala Date: Sun, 30 Oct 2011 15:21: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: r226939 - head/bin/ps X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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 Oct 2011 15:21:27 -0000 Author: trasz Date: Sun Oct 30 15:21:27 2011 New Revision: 226939 URL: http://svn.freebsd.org/changeset/base/226939 Log: For processes with no controlling terminal, display "-" in the TTY column instead of "?". Submitted by: arundel Modified: head/bin/ps/print.c head/bin/ps/ps.1 Modified: head/bin/ps/print.c ============================================================================== --- head/bin/ps/print.c Sun Oct 30 14:55:00 2011 (r226938) +++ head/bin/ps/print.c Sun Oct 30 15:21:27 2011 (r226939) @@ -362,7 +362,7 @@ tdev(KINFO *k, VARENT *ve) v = ve->var; dev = k->ki_p->ki_tdev; if (dev == NODEV) - str = strdup("??"); + str = strdup("-"); else asprintf(&str, "%#jx", (uintmax_t)dev); @@ -379,7 +379,7 @@ tname(KINFO *k, VARENT *ve) v = ve->var; dev = k->ki_p->ki_tdev; if (dev == NODEV || (ttname = devname(dev, S_IFCHR)) == NULL) - str = strdup("?? "); + str = strdup("- "); else { if (strncmp(ttname, "tty", 3) == 0 || strncmp(ttname, "cua", 3) == 0) @@ -403,7 +403,7 @@ longtname(KINFO *k, VARENT *ve) v = ve->var; dev = k->ki_p->ki_tdev; if (dev == NODEV || (ttname = devname(dev, S_IFCHR)) == NULL) - ttname = "??"; + ttname = "-"; return (strdup(ttname)); } Modified: head/bin/ps/ps.1 ============================================================================== --- head/bin/ps/ps.1 Sun Oct 30 14:55:00 2011 (r226938) +++ head/bin/ps/ps.1 Sun Oct 30 15:21:27 2011 (r226939) @@ -29,7 +29,7 @@ .\" @(#)ps.1 8.3 (Berkeley) 4/18/94 .\" $FreeBSD$ .\" -.Dd October 1, 2011 +.Dd October 30, 2011 .Dt PS 1 .Os .Sh NAME @@ -437,6 +437,10 @@ This is followed by a .Ql - if the process can no longer reach that controlling terminal (i.e., it has been revoked). +A +.Ql - +without a preceding two letter abbreviation or pseudo-terminal device number +indicates a process which never had a controlling terminal. The full pathname of the controlling terminal is available via the .Cm tty keyword. From owner-svn-src-head@FreeBSD.ORG Sun Oct 30 16:29:05 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4187E106564A; Sun, 30 Oct 2011 16:29:05 +0000 (UTC) (envelope-from rmh@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 2F4C08FC12; Sun, 30 Oct 2011 16:29:05 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p9UGT5uv075885; Sun, 30 Oct 2011 16:29:05 GMT (envelope-from rmh@svn.freebsd.org) Received: (from rmh@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p9UGT5NG075878; Sun, 30 Oct 2011 16:29:05 GMT (envelope-from rmh@svn.freebsd.org) Message-Id: <201110301629.p9UGT5NG075878@svn.freebsd.org> From: Robert Millan Date: Sun, 30 Oct 2011 16:29: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: r226940 - in head/cddl: lib/libzfs sbin/zfs sbin/zpool usr.bin/zinject usr.bin/ztest usr.sbin/zdb X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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 Oct 2011 16:29:05 -0000 Author: rmh Date: Sun Oct 30 16:29:04 2011 New Revision: 226940 URL: http://svn.freebsd.org/changeset/base/226940 Log: Fix a few gratuitous library dependencies. Some of the ZFS utilities are linked with libraries they don't use: - zinject doesn't use libavl - ztest doesn't use libz - zdb uses neither libavl nor libz - zfs uses neither libbsdxml nor libm, nor libsbuf - zpool uses neither libbsdxml nor libm, nor libsbuf In addition, libzfs needs libm because it uses pow(), however it isn't linked with -lm. This went unnoticed because all its users had -lm before. Reviewed by: pjd, mm Approved by: kib (mentor) MFC after: 1 week Modified: head/cddl/lib/libzfs/Makefile head/cddl/sbin/zfs/Makefile head/cddl/sbin/zpool/Makefile head/cddl/usr.bin/zinject/Makefile head/cddl/usr.bin/ztest/Makefile head/cddl/usr.sbin/zdb/Makefile Modified: head/cddl/lib/libzfs/Makefile ============================================================================== --- head/cddl/lib/libzfs/Makefile Sun Oct 30 15:21:27 2011 (r226939) +++ head/cddl/lib/libzfs/Makefile Sun Oct 30 16:29:04 2011 (r226940) @@ -6,8 +6,8 @@ .PATH: ${.CURDIR}/../../../cddl/contrib/opensolaris/lib/libzfs/common LIB= zfs -DPADD= ${LIBMD} ${LIBPTHREAD} ${LIBUMEM} ${LIBUTIL} -LDADD= -lmd -lpthread -lumem -lutil +DPADD= ${LIBMD} ${LIBPTHREAD} ${LIBUMEM} ${LIBUTIL} ${LIBM} +LDADD= -lmd -lpthread -lumem -lutil -lm SRCS= deviceid.c \ fsshare.c \ Modified: head/cddl/sbin/zfs/Makefile ============================================================================== --- head/cddl/sbin/zfs/Makefile Sun Oct 30 15:21:27 2011 (r226939) +++ head/cddl/sbin/zfs/Makefile Sun Oct 30 16:29:04 2011 (r226940) @@ -21,8 +21,8 @@ CFLAGS+= -I${.CURDIR}/../../../sys/cddl/ CFLAGS+= -I${.CURDIR}/../../../sys/cddl/contrib/opensolaris/uts/common/sys CFLAGS+= -I${.CURDIR}/../../../sys/cddl/contrib/opensolaris/common/zfs -DPADD= ${LIBBSDXML} ${LIBGEOM} ${LIBM} ${LIBNVPAIR} ${LIBSBUF} ${LIBUMEM} \ +DPADD= ${LIBGEOM} ${LIBNVPAIR} ${LIBUMEM} \ ${LIBUTIL} ${LIBUUTIL} ${LIBZFS} -LDADD= -lbsdxml -lgeom -lm -lnvpair -lsbuf -lumem -lutil -luutil -lzfs +LDADD= -lgeom -lnvpair -lumem -lutil -luutil -lzfs .include Modified: head/cddl/sbin/zpool/Makefile ============================================================================== --- head/cddl/sbin/zpool/Makefile Sun Oct 30 15:21:27 2011 (r226939) +++ head/cddl/sbin/zpool/Makefile Sun Oct 30 16:29:04 2011 (r226940) @@ -26,8 +26,8 @@ CFLAGS+= -I${.CURDIR}/../../../sys/cddl/ CFLAGS+= -I${.CURDIR}/../../../cddl/contrib/opensolaris/lib/libzpool/common CFLAGS+= -I${.CURDIR}/../../../cddl/contrib/opensolaris/cmd/stat/common -DPADD= ${LIBAVL} ${LIBBSDXML} ${LIBGEOM} ${LIBM} ${LIBNVPAIR} ${LIBSBUF} \ +DPADD= ${LIBAVL} ${LIBGEOM} ${LIBNVPAIR} \ ${LIBUMEM} ${LIBUTIL} ${LIBUUTIL} ${LIBZFS} -LDADD= -lavl -lbsdxml -lgeom -lm -lnvpair -lsbuf -lumem -lutil -luutil -lzfs +LDADD= -lavl -lgeom -lnvpair -lumem -lutil -luutil -lzfs .include Modified: head/cddl/usr.bin/zinject/Makefile ============================================================================== --- head/cddl/usr.bin/zinject/Makefile Sun Oct 30 15:21:27 2011 (r226939) +++ head/cddl/usr.bin/zinject/Makefile Sun Oct 30 16:29:04 2011 (r226940) @@ -19,8 +19,8 @@ CFLAGS+= -I${.CURDIR}/../../../sys/cddl/ CFLAGS+= -I${.CURDIR}/../../contrib/opensolaris/head CFLAGS+= -I${.CURDIR}/../../lib/libumem -DPADD= ${LIBAVL} ${LIBGEOM} ${LIBM} ${LIBNVPAIR} ${LIBUMEM} ${LIBUUTIL} \ +DPADD= ${LIBGEOM} ${LIBM} ${LIBNVPAIR} ${LIBUMEM} ${LIBUUTIL} \ ${LIBZFS} ${LIBZPOOL} -LDADD= -lavl -lgeom -lm -lnvpair -lumem -luutil -lzfs -lzpool +LDADD= -lgeom -lm -lnvpair -lumem -luutil -lzfs -lzpool .include Modified: head/cddl/usr.bin/ztest/Makefile ============================================================================== --- head/cddl/usr.bin/ztest/Makefile Sun Oct 30 15:21:27 2011 (r226939) +++ head/cddl/usr.bin/ztest/Makefile Sun Oct 30 16:29:04 2011 (r226940) @@ -18,8 +18,8 @@ CFLAGS+= -I${.CURDIR}/../../contrib/open CFLAGS+= -I${.CURDIR}/../../lib/libumem DPADD= ${LIBM} ${LIBNVPAIR} ${LIBUMEM} ${LIBZPOOL} \ - ${LIBPTHREAD} ${LIBZ} ${LIBAVL} -LDADD= -lm -lnvpair -lumem -lzpool -lpthread -lz -lavl + ${LIBPTHREAD} ${LIBAVL} +LDADD= -lm -lnvpair -lumem -lzpool -lpthread -lavl CSTD= c99 Modified: head/cddl/usr.sbin/zdb/Makefile ============================================================================== --- head/cddl/usr.sbin/zdb/Makefile Sun Oct 30 15:21:27 2011 (r226939) +++ head/cddl/usr.sbin/zdb/Makefile Sun Oct 30 16:29:04 2011 (r226940) @@ -23,9 +23,9 @@ CFLAGS+= -I${.CURDIR}/../../../sys/cddl/ CFLAGS+= -I${.CURDIR}/../../../cddl/contrib/opensolaris/head CFLAGS+= -I${.CURDIR}/../../lib/libumem -DPADD= ${LIBAVL} ${LIBGEOM} ${LIBM} ${LIBNVPAIR} ${LIBPTHREAD} ${LIBUMEM} \ - ${LIBUUTIL} ${LIBZ} ${LIBZFS} ${LIBZPOOL} -LDADD= -lavl -lgeom -lm -lnvpair -lpthread -lumem -luutil -lz -lzfs -lzpool +DPADD= ${LIBGEOM} ${LIBM} ${LIBNVPAIR} ${LIBPTHREAD} ${LIBUMEM} \ + ${LIBUUTIL} ${LIBZFS} ${LIBZPOOL} +LDADD= -lgeom -lm -lnvpair -lpthread -lumem -luutil -lzfs -lzpool .include From owner-svn-src-head@FreeBSD.ORG Sun Oct 30 20:55:33 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 75DAD106564A; Sun, 30 Oct 2011 20:55:33 +0000 (UTC) (envelope-from dougb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 2D2F58FC08; Sun, 30 Oct 2011 20:55:33 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p9UKtXoJ084323; Sun, 30 Oct 2011 20:55:33 GMT (envelope-from dougb@svn.freebsd.org) Received: (from dougb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p9UKtXmW084321; Sun, 30 Oct 2011 20:55:33 GMT (envelope-from dougb@svn.freebsd.org) Message-Id: <201110302055.p9UKtXmW084321@svn.freebsd.org> From: Doug Barton Date: Sun, 30 Oct 2011 20:55: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: r226942 - head/usr.bin/calendar/calendars X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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 Oct 2011 20:55:33 -0000 Author: dougb Date: Sun Oct 30 20:55:32 2011 New Revision: 226942 URL: http://svn.freebsd.org/changeset/base/226942 Log: Fix typo from r226927 Submitted by: scf Modified: head/usr.bin/calendar/calendars/calendar.birthday Modified: head/usr.bin/calendar/calendars/calendar.birthday ============================================================================== --- head/usr.bin/calendar/calendars/calendar.birthday Sun Oct 30 20:45:27 2011 (r226941) +++ head/usr.bin/calendar/calendars/calendar.birthday Sun Oct 30 20:55:32 2011 (r226942) @@ -214,7 +214,7 @@ 09/08 Richard ``the Lionheart'', king of England born in Oxford, 1157 09/08 Peter Sellers born in Southsea, England, 1925 09/09 Chinese Communist Party Chairman Mao Tse-Tung dies at age 82, 1976 -09/09 Dennis MacAlistair Ritchie, creater of C, born, 1941 +09/09 Dennis MacAlistair Ritchie, creator of C, born, 1941 09/12 Jesse Owens born, 1913 09/13 Walter Reed born, 1851 09/15 Agatha Christie born in Torquay, England, 1890 From owner-svn-src-head@FreeBSD.ORG Sun Oct 30 21:17:43 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0DF431065672; Sun, 30 Oct 2011 21:17:43 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id F11718FC08; Sun, 30 Oct 2011 21:17:42 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p9ULHgGO085251; Sun, 30 Oct 2011 21:17:42 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p9ULHgLD085245; Sun, 30 Oct 2011 21:17:42 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201110302117.p9ULHgLD085245@svn.freebsd.org> From: Marius Strobl Date: Sun, 30 Oct 2011 21:17: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: r226947 - in head/sys: dev/esp sparc64/sbus X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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 Oct 2011 21:17:43 -0000 Author: marius Date: Sun Oct 30 21:17:42 2011 New Revision: 226947 URL: http://svn.freebsd.org/changeset/base/226947 Log: - Use device_t rather than the NetBSDish struct device. - Move esp_devclass to ncr53c9x.c in order to allow different bus front-ends to use it. - Use KOBJMETHOD_END. - Remove the gl_clear_latched_intr hook as it's not needed for any of the chips nor the front-ends supported in FreeBSD and likely never will be. - Correct the DMA constraints used in the SBus front-end, the LSI64854 isn't limited to 32-bit DMA. - The ESP200 also only supports up to 64k transfers. - Don't let the DMA and SBus front-end supply a maximum transfer size larger than MAXPHYS as that's the maximum the upper layers use and we otherwise just waste resources unnecessarily. - Initialize the ECB callout and don't zero the handle when returning ECBs to the free list so that ncr53c9x_callout() actually is called with the driver lock held. - On detach the driver lock should be held across cam_sim_free() according to isp(4) and a panic received. - Check the return value of NCRDMA_SETUP(), i.e. bus_dmamap_load(9), and try to handle failures gracefully. - In ncr53c9x_action() replace N calls to xpt_done() in a switch with just one at the end. - On XPT_PATH_INQ report "NCR" rather than "Sun" as the vendor as the former is somewhat more correct as well as the maximum supported transfer size via maxio in order to take advantage of controllers that that can handle more than DFLTPHYS. - Print the number of MESSAGE (EXTENDED) rejected. - Fix the path encoded in the multiple inclusion protection of ncr53c9xvar.h. - Correct the DMA constraints used in the LSI64854 core to not exceed the maximum supported transfer size and include the boundary so we don't need to check on every setup of a DMA transfer. - Let the bus DMA map callbacks do nothing in case of an error. - Correctly handle > 64k transfers for FAS366 in the LSI64854. A new feature flag NCR_F_LARGEXFER was introduced so we just need to check for this one and not for individual controllers supporting large transfers in several places. - Let the LSI64854 core load transfer buffers using BUS_DMA_NOWAIT as the NCR53C9x core can't handle EINPROGRESS. Due to lack of bounce buffers support, sparc64 doesn't actually use EINPROGRESS and likely never will, as an example for writing additional front-ends for the NCR53C9x core it makes sense to set BUS_DMA_NOWAIT anyway though. - Some minor cleanup. Modified: head/sys/dev/esp/esp_sbus.c head/sys/dev/esp/ncr53c9x.c head/sys/dev/esp/ncr53c9xvar.h head/sys/sparc64/sbus/lsi64854.c head/sys/sparc64/sbus/lsi64854var.h Modified: head/sys/dev/esp/esp_sbus.c ============================================================================== --- head/sys/dev/esp/esp_sbus.c Sun Oct 30 21:03:12 2011 (r226946) +++ head/sys/dev/esp/esp_sbus.c Sun Oct 30 21:17:42 2011 (r226947) @@ -68,13 +68,13 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include #include #include -#include #include #include @@ -92,7 +92,7 @@ __FBSDID("$FreeBSD$"); struct esp_softc { struct ncr53c9x_softc sc_ncr53c9x; /* glue to MI code */ - struct device *sc_dev; + device_t sc_dev; struct resource *sc_res; @@ -102,8 +102,6 @@ struct esp_softc { struct lsi64854_softc *sc_dma; /* pointer to my DMA */ }; -static devclass_t esp_devclass; - static int esp_probe(device_t); static int esp_dma_attach(device_t); static int esp_dma_detach(device_t); @@ -118,7 +116,8 @@ static device_method_t esp_dma_methods[] DEVMETHOD(device_detach, esp_dma_detach), DEVMETHOD(device_suspend, esp_suspend), DEVMETHOD(device_resume, esp_resume), - {0, 0} + + KOBJMETHOD_END }; static driver_t esp_dma_driver = { @@ -136,7 +135,8 @@ static device_method_t esp_sbus_methods[ DEVMETHOD(device_detach, esp_sbus_detach), DEVMETHOD(device_suspend, esp_suspend), DEVMETHOD(device_resume, esp_resume), - {0, 0} + + KOBJMETHOD_END }; static driver_t esp_sbus_driver = { @@ -175,7 +175,6 @@ static const struct ncr53c9x_glue const esp_dma_go, esp_dma_stop, esp_dma_isactive, - NULL, /* gl_clear_latched_intr */ }; static int @@ -245,9 +244,9 @@ esp_sbus_attach(device_t dev) BUS_SPACE_MAXADDR, /* lowaddr */ BUS_SPACE_MAXADDR, /* highaddr */ NULL, NULL, /* filter, filterarg */ - BUS_SPACE_MAXSIZE_32BIT, /* maxsize */ - 0, /* nsegments */ - BUS_SPACE_MAXSIZE_32BIT, /* maxsegsize */ + BUS_SPACE_MAXSIZE, /* maxsize */ + BUS_SPACE_UNRESTRICTED, /* nsegments */ + BUS_SPACE_MAXSIZE, /* maxsegsize */ 0, /* flags */ NULL, NULL, /* no locking */ &lsc->sc_parent_dmat); @@ -292,8 +291,10 @@ esp_sbus_attach(device_t dev) } for (i = 0; i < nchildren; i++) { if (device_is_attached(children[i]) && - sbus_get_slot(children[i]) == sbus_get_slot(dev) && - strcmp(ofw_bus_get_name(children[i]), "dma") == 0) { + sbus_get_slot(children[i]) == + sbus_get_slot(dev) && + strcmp(ofw_bus_get_name(children[i]), + "dma") == 0) { /* XXX hackery */ esc->sc_dma = (struct lsi64854_softc *) device_get_softc(children[i]); @@ -453,13 +454,6 @@ espattach(struct esp_softc *esc, const s NCR_LOCK_INIT(sc); - /* Attach the DMA engine. */ - error = lsi64854_attach(esc->sc_dma); - if (error != 0) { - device_printf(esc->sc_dev, "lsi64854_attach failed\n"); - goto fail_lock; - } - sc->sc_id = OF_getscsinitid(esc->sc_dev); #ifdef ESP_SBUS_DEBUG @@ -516,9 +510,9 @@ espattach(struct esp_softc *esc, const s NCR_WRITE_REG(sc, NCR_CFG2, sc->sc_cfg2); if ((NCR_READ_REG(sc, NCR_CFG2) & ~NCRCFG2_RSVD) != - (NCRCFG2_SCSI2 | NCRCFG2_RPE)) { + (NCRCFG2_SCSI2 | NCRCFG2_RPE)) sc->sc_rev = NCR_VARIANT_ESP100; - } else { + else { sc->sc_cfg2 = NCRCFG2_SCSI2; NCR_WRITE_REG(sc, NCR_CFG2, sc->sc_cfg2); sc->sc_cfg3 = 0; @@ -526,9 +520,9 @@ espattach(struct esp_softc *esc, const s sc->sc_cfg3 = (NCRCFG3_CDB | NCRCFG3_FCLK); NCR_WRITE_REG(sc, NCR_CFG3, sc->sc_cfg3); if (NCR_READ_REG(sc, NCR_CFG3) != - (NCRCFG3_CDB | NCRCFG3_FCLK)) { + (NCRCFG3_CDB | NCRCFG3_FCLK)) sc->sc_rev = NCR_VARIANT_ESP100A; - } else { + else { /* NCRCFG2_FE enables > 64K transfers. */ sc->sc_cfg2 |= NCRCFG2_FE; sc->sc_cfg3 = 0; @@ -543,9 +537,11 @@ espattach(struct esp_softc *esc, const s case 0x02: if ((uid & 0x07) == 0x02) - sc->sc_rev = NCR_VARIANT_FAS216; + sc->sc_rev = + NCR_VARIANT_FAS216; else - sc->sc_rev = NCR_VARIANT_FAS236; + sc->sc_rev = + NCR_VARIANT_FAS236; break; case 0x0a: @@ -560,7 +556,8 @@ espattach(struct esp_softc *esc, const s */ device_printf(esc->sc_dev, "Unknown chip\n"); - goto fail_lsi; + error = ENXIO; + goto fail_lock; } } } @@ -571,12 +568,6 @@ espattach(struct esp_softc *esc, const s #endif /* - * XXX minsync and maxxfer _should_ be set up in MI code, - * XXX but it appears to have some dependency on what sort - * XXX of DMA we're hooked up to, etc. - */ - - /* * This is the value used to start sync negotiations * Note that the NCR register "SYNCTP" is programmed * in "clocks per byte", and has a minimum value of 4. @@ -587,31 +578,27 @@ espattach(struct esp_softc *esc, const s */ sc->sc_minsync = 1000 / sc->sc_freq; + /* + * Except for some variants the maximum transfer size is 64k. + */ + sc->sc_maxxfer = 64 * 1024; sc->sc_maxoffset = 15; sc->sc_extended_geom = 1; /* * Alas, we must now modify the value a bit, because it's - * only valid when can switch on FASTCLK and FASTSCSI bits - * in config register 3... + * only valid when we can switch on FASTCLK and FASTSCSI bits + * in the config register 3... */ switch (sc->sc_rev) { case NCR_VARIANT_ESP100: sc->sc_maxwidth = MSG_EXT_WDTR_BUS_8_BIT; - sc->sc_maxxfer = 64 * 1024; sc->sc_minsync = 0; /* No synch on old chip? */ break; case NCR_VARIANT_ESP100A: - sc->sc_maxwidth = MSG_EXT_WDTR_BUS_8_BIT; - sc->sc_maxxfer = 64 * 1024; - /* Min clocks/byte is 5 */ - sc->sc_minsync = ncr53c9x_cpb2stp(sc, 5); - break; - case NCR_VARIANT_ESP200: sc->sc_maxwidth = MSG_EXT_WDTR_BUS_8_BIT; - sc->sc_maxxfer = 16 * 1024 * 1024; /* Min clocks/byte is 5 */ sc->sc_minsync = ncr53c9x_cpb2stp(sc, 5); break; @@ -642,6 +629,19 @@ espattach(struct esp_softc *esc, const s break; } + /* + * Given that we allocate resources based on sc->sc_maxxfer it doesn't + * make sense to supply a value higher than the maximum actually used. + */ + sc->sc_maxxfer = min(sc->sc_maxxfer, MAXPHYS); + + /* Attach the DMA engine. */ + error = lsi64854_attach(esc->sc_dma); + if (error != 0) { + device_printf(esc->sc_dev, "lsi64854_attach failed\n"); + goto fail_lock; + } + /* Establish interrupt channel. */ i = 0; if ((esc->sc_irqres = bus_alloc_resource_any(esc->sc_dev, SYS_RES_IRQ, Modified: head/sys/dev/esp/ncr53c9x.c ============================================================================== --- head/sys/dev/esp/ncr53c9x.c Sun Oct 30 21:03:12 2011 (r226946) +++ head/sys/dev/esp/ncr53c9x.c Sun Oct 30 21:17:42 2011 (r226947) @@ -123,6 +123,8 @@ __FBSDID("$FreeBSD$"); #include #include +devclass_t esp_devclass; + MODULE_DEPEND(esp, cam, 1, 1, 1); #ifdef NCR53C9X_DEBUG @@ -179,8 +181,7 @@ static inline int ncr53c9x_stp2cpb(struc #define NCR_SET_COUNT(sc, size) do { \ NCR_WRITE_REG((sc), NCR_TCL, (size)); \ NCR_WRITE_REG((sc), NCR_TCM, (size) >> 8); \ - if ((sc->sc_cfg2 & NCRCFG2_FE) || \ - (sc->sc_rev == NCR_VARIANT_FAS366)) \ + if ((sc->sc_features & NCR_F_LARGEXFER) != 0) \ NCR_WRITE_REG((sc), NCR_TCH, (size) >> 16); \ if (sc->sc_rev == NCR_VARIANT_FAS366) \ NCR_WRITE_REG(sc, NCR_RCH, 0); \ @@ -391,6 +392,7 @@ ncr53c9x_attach(struct ncr53c9x_softc *s ecb = &sc->ecb_array[i]; ecb->sc = sc; ecb->tag_id = i; + callout_init_mtx(&ecb->ch, &sc->sc_lock, 0); TAILQ_INSERT_HEAD(&sc->free_list, ecb, free_links); } @@ -449,10 +451,10 @@ ncr53c9x_detach(struct ncr53c9x_softc *s xpt_register_async(0, ncr53c9x_async, sc->sc_sim, sc->sc_path); xpt_free_path(sc->sc_path); xpt_bus_deregister(cam_sim_path(sc->sc_sim)); + cam_sim_free(sc->sc_sim, TRUE); NCR_UNLOCK(sc); - cam_sim_free(sc->sc_sim, TRUE); free(sc->ecb_array, M_DEVBUF); free(sc->sc_tinfo, M_DEVBUF); if (sc->sc_imess_self) @@ -504,6 +506,8 @@ ncr53c9x_reset(struct ncr53c9x_softc *sc /* FALLTHROUGH */ case NCR_VARIANT_ESP100A: sc->sc_features |= NCR_F_SELATN3; + if ((sc->sc_cfg2 & NCRCFG2_FE) != 0) + sc->sc_features |= NCR_F_LARGEXFER; NCR_WRITE_REG(sc, NCR_CFG2, sc->sc_cfg2); /* FALLTHROUGH */ case NCR_VARIANT_ESP100: @@ -514,8 +518,8 @@ ncr53c9x_reset(struct ncr53c9x_softc *sc break; case NCR_VARIANT_FAS366: - sc->sc_features |= - NCR_F_HASCFG3 | NCR_F_FASTSCSI | NCR_F_SELATN3; + sc->sc_features |= NCR_F_HASCFG3 | NCR_F_FASTSCSI | + NCR_F_SELATN3 | NCR_F_LARGEXFER; sc->sc_cfg3 = NCRFASCFG3_FASTCLK | NCRFASCFG3_OBAUTO; if (sc->sc_id > 7) sc->sc_cfg3 |= NCRFASCFG3_IDBIT3; @@ -711,9 +715,6 @@ ncr53c9x_readregs(struct ncr53c9x_softc sc->sc_espintr = NCR_READ_REG(sc, NCR_INTR); - if (sc->sc_glue->gl_clear_latched_intr != NULL) - (*sc->sc_glue->gl_clear_latched_intr)(sc); - /* * Determine the SCSI bus phase, return either a real SCSI bus phase * or some pseudo phase we use to detect certain exceptions. @@ -806,7 +807,7 @@ ncr53c9x_select(struct ncr53c9x_softc *s struct ncr53c9x_tinfo *ti; uint8_t *cmd; size_t dmasize; - int clen, selatn3, selatns; + int clen, error, selatn3, selatns; int lun = ecb->ccb->ccb_h.target_lun; int target = ecb->ccb->ccb_h.target_id; @@ -887,13 +888,19 @@ ncr53c9x_select(struct ncr53c9x_softc *s dmasize = clen; sc->sc_cmdlen = clen; sc->sc_cmdp = cmd; - NCRDMA_SETUP(sc, &sc->sc_cmdp, &sc->sc_cmdlen, 0, &dmasize); + error = NCRDMA_SETUP(sc, &sc->sc_cmdp, &sc->sc_cmdlen, 0, + &dmasize); + if (error != 0) { + sc->sc_cmdlen = 0; + sc->sc_cmdp = NULL; + goto cmd; + } + /* Program the SCSI counter. */ NCR_SET_COUNT(sc, dmasize); /* Load the count in. */ - /* if (sc->sc_rev != NCR_VARIANT_FAS366) */ - NCRCMD(sc, NCRCMD_NOP | NCRCMD_DMA); + NCRCMD(sc, NCRCMD_NOP | NCRCMD_DMA); /* And get the target's attention. */ if (selatn3) { @@ -906,6 +913,7 @@ ncr53c9x_select(struct ncr53c9x_softc *s return; } +cmd: /* * Who am I? This is where we tell the target that we are * happy for it to disconnect etc. @@ -989,13 +997,11 @@ ncr53c9x_action(struct cam_sim *sim, uni case XPT_RESET_BUS: ncr53c9x_init(sc, 1); ccb->ccb_h.status = CAM_REQ_CMP; - xpt_done(ccb); - return; + break; case XPT_CALC_GEOMETRY: cam_calc_geometry(&ccb->ccg, sc->sc_extended_geom); - xpt_done(ccb); - return; + break; case XPT_PATH_INQ: cpi = &ccb->cpi; @@ -1009,19 +1015,19 @@ ncr53c9x_action(struct cam_sim *sim, uni cpi->max_target = sc->sc_ntarg - 1; cpi->max_lun = 7; cpi->initiator_id = sc->sc_id; - cpi->bus_id = 0; - cpi->base_transfer_speed = 3300; strncpy(cpi->sim_vid, "FreeBSD", SIM_IDLEN); - strncpy(cpi->hba_vid, "Sun", HBA_IDLEN); + strncpy(cpi->hba_vid, "NCR", HBA_IDLEN); strncpy(cpi->dev_name, cam_sim_name(sim), DEV_IDLEN); cpi->unit_number = cam_sim_unit(sim); - cpi->transport = XPORT_SPI; - cpi->transport_version = 2; + cpi->bus_id = 0; + cpi->base_transfer_speed = 3300; cpi->protocol = PROTO_SCSI; cpi->protocol_version = SCSI_REV_2; + cpi->transport = XPORT_SPI; + cpi->transport_version = 2; + cpi->maxio = sc->sc_maxxfer; ccb->ccb_h.status = CAM_REQ_CMP; - xpt_done(ccb); - return; + break; case XPT_GET_TRAN_SETTINGS: cts = &ccb->cts; @@ -1064,28 +1070,24 @@ ncr53c9x_action(struct cam_sim *sim, uni CTS_SPI_VALID_DISC; scsi->valid = CTS_SCSI_VALID_TQ; ccb->ccb_h.status = CAM_REQ_CMP; - xpt_done(ccb); - return; + break; case XPT_ABORT: device_printf(sc->sc_dev, "XPT_ABORT called\n"); ccb->ccb_h.status = CAM_FUNC_NOTAVAIL; - xpt_done(ccb); - return; + break; case XPT_TERM_IO: device_printf(sc->sc_dev, "XPT_TERM_IO called\n"); ccb->ccb_h.status = CAM_FUNC_NOTAVAIL; - xpt_done(ccb); - return; + break; case XPT_RESET_DEV: case XPT_SCSI_IO: if (ccb->ccb_h.target_id < 0 || ccb->ccb_h.target_id >= sc->sc_ntarg) { ccb->ccb_h.status = CAM_PATH_INVALID; - xpt_done(ccb); - return; + goto done; } /* Get an ECB to use. */ ecb = ncr53c9x_get_ecb(sc); @@ -1097,8 +1099,7 @@ ncr53c9x_action(struct cam_sim *sim, uni xpt_freeze_simq(sim, 1); ccb->ccb_h.status = CAM_REQUEUE_REQ; device_printf(sc->sc_dev, "unable to allocate ecb\n"); - xpt_done(ccb); - return; + goto done; } /* Initialize ecb. */ @@ -1127,7 +1128,7 @@ ncr53c9x_action(struct cam_sim *sim, uni ecb->flags |= ECB_READY; if (sc->sc_state == NCR_IDLE) ncr53c9x_sched(sc); - break; + return; case XPT_SET_TRAN_SETTINGS: cts = &ccb->cts; @@ -1165,16 +1166,16 @@ ncr53c9x_action(struct cam_sim *sim, uni } ccb->ccb_h.status = CAM_REQ_CMP; - xpt_done(ccb); - return; + break; default: device_printf(sc->sc_dev, "Unhandled function code %d\n", ccb->ccb_h.func_code); ccb->ccb_h.status = CAM_PROVIDE_FAIL; - xpt_done(ccb); - return; } + +done: + xpt_done(ccb); } /* @@ -2030,8 +2031,8 @@ gotit: default: xpt_print_path(ecb->ccb->ccb_h.path); - printf("unrecognized MESSAGE EXTENDED;" - " sending REJECT\n"); + printf("unrecognized MESSAGE EXTENDED 0x%x;" + " sending REJECT\n", sc->sc_imess[2]); goto reject; } break; @@ -2039,7 +2040,8 @@ gotit: default: NCR_MSGS(("ident ")); xpt_print_path(ecb->ccb->ccb_h.path); - printf("unrecognized MESSAGE; sending REJECT\n"); + printf("unrecognized MESSAGE 0x%x; sending REJECT\n", + sc->sc_imess[0]); /* FALLTHROUGH */ reject: ncr53c9x_sched_msgout(SEND_REJECT); @@ -2109,6 +2111,7 @@ ncr53c9x_msgout(struct ncr53c9x_softc *s struct ncr53c9x_tinfo *ti; struct ncr53c9x_ecb *ecb; size_t size; + int error; #ifdef NCR53C9X_DEBUG int i; #endif @@ -2246,17 +2249,14 @@ ncr53c9x_msgout(struct ncr53c9x_softc *s NCR_MSGS(("> ")); } #endif - if (sc->sc_rev == NCR_VARIANT_FAS366) { - /* - * XXX FIFO size - */ - ncr53c9x_flushfifo(sc); - ncr53c9x_wrfifo(sc, sc->sc_omp, sc->sc_omlen); - NCRCMD(sc, NCRCMD_TRANS); - } else { + + if (sc->sc_rev != NCR_VARIANT_FAS366) { /* (Re)send the message. */ size = ulmin(sc->sc_omlen, sc->sc_maxxfer); - NCRDMA_SETUP(sc, &sc->sc_omp, &sc->sc_omlen, 0, &size); + error = NCRDMA_SETUP(sc, &sc->sc_omp, &sc->sc_omlen, 0, &size); + if (error != 0) + goto cmd; + /* Program the SCSI counter. */ NCR_SET_COUNT(sc, size); @@ -2264,7 +2264,16 @@ ncr53c9x_msgout(struct ncr53c9x_softc *s NCRCMD(sc, NCRCMD_NOP | NCRCMD_DMA); NCRCMD(sc, NCRCMD_TRANS | NCRCMD_DMA); NCRDMA_GO(sc); + return; } + +cmd: + /* + * XXX FIFO size + */ + ncr53c9x_flushfifo(sc); + ncr53c9x_wrfifo(sc, sc->sc_omp, sc->sc_omlen); + NCRCMD(sc, NCRCMD_TRANS); } void @@ -2299,7 +2308,7 @@ ncr53c9x_intr1(struct ncr53c9x_softc *sc struct ncr53c9x_tinfo *ti; struct timeval cur, wait; size_t size; - int i, nfifo; + int error, i, nfifo; uint8_t msg; NCR_LOCK_ASSERT(sc, MA_OWNED); @@ -2974,8 +2983,14 @@ msgin: size = ecb->clen; sc->sc_cmdlen = size; sc->sc_cmdp = (void *)&ecb->cmd.cmd; - NCRDMA_SETUP(sc, &sc->sc_cmdp, &sc->sc_cmdlen, + error = NCRDMA_SETUP(sc, &sc->sc_cmdp, &sc->sc_cmdlen, 0, &size); + if (error != 0) { + sc->sc_cmdlen = 0; + sc->sc_cmdp = NULL; + goto cmd; + } + /* Program the SCSI counter. */ NCR_SET_COUNT(sc, size); @@ -2985,30 +3000,51 @@ msgin: /* Start the command transfer. */ NCRCMD(sc, NCRCMD_TRANS | NCRCMD_DMA); NCRDMA_GO(sc); - } else { - ncr53c9x_wrfifo(sc, (uint8_t *)&ecb->cmd.cmd, - ecb->clen); - NCRCMD(sc, NCRCMD_TRANS); + sc->sc_prevphase = COMMAND_PHASE; + break; } +cmd: + ncr53c9x_wrfifo(sc, (uint8_t *)&ecb->cmd.cmd, ecb->clen); + NCRCMD(sc, NCRCMD_TRANS); sc->sc_prevphase = COMMAND_PHASE; break; case DATA_OUT_PHASE: NCR_PHASE(("DATA_OUT_PHASE [%ld] ", (long)sc->sc_dleft)); + sc->sc_prevphase = DATA_OUT_PHASE; NCRCMD(sc, NCRCMD_FLUSH); size = ulmin(sc->sc_dleft, sc->sc_maxxfer); - NCRDMA_SETUP(sc, &sc->sc_dp, &sc->sc_dleft, 0, &size); - sc->sc_prevphase = DATA_OUT_PHASE; + error = NCRDMA_SETUP(sc, &sc->sc_dp, &sc->sc_dleft, 0, &size); goto setup_xfer; case DATA_IN_PHASE: NCR_PHASE(("DATA_IN_PHASE ")); + sc->sc_prevphase = DATA_IN_PHASE; if (sc->sc_rev == NCR_VARIANT_ESP100) NCRCMD(sc, NCRCMD_FLUSH); size = ulmin(sc->sc_dleft, sc->sc_maxxfer); - NCRDMA_SETUP(sc, &sc->sc_dp, &sc->sc_dleft, 1, &size); - sc->sc_prevphase = DATA_IN_PHASE; - setup_xfer: + error = NCRDMA_SETUP(sc, &sc->sc_dp, &sc->sc_dleft, 1, &size); +setup_xfer: + if (error != 0) { + switch (error) { + case EFBIG: + ecb->ccb->ccb_h.status |= CAM_REQ_TOO_BIG; + break; + case EINPROGRESS: + panic("%s: cannot deal with deferred DMA", + __func__); + case EINVAL: + ecb->ccb->ccb_h.status |= CAM_REQ_INVALID; + break; + case ENOMEM: + ecb->ccb->ccb_h.status |= CAM_REQUEUE_REQ; + break; + default: + ecb->ccb->ccb_h.status |= CAM_REQ_CMP_ERR; + } + goto finish; + } + /* Target returned to data phase: wipe "done" memory */ ecb->flags &= ~ECB_TENTATIVE_DONE; Modified: head/sys/dev/esp/ncr53c9xvar.h ============================================================================== --- head/sys/dev/esp/ncr53c9xvar.h Sun Oct 30 21:03:12 2011 (r226946) +++ head/sys/dev/esp/ncr53c9xvar.h Sun Oct 30 21:17:42 2011 (r226947) @@ -68,8 +68,8 @@ /* $FreeBSD$ */ -#ifndef _DEV_IC_NCR53C9XVAR_H_ -#define _DEV_IC_NCR53C9XVAR_H_ +#ifndef _NCR53C9XVAR_H_ +#define _NCR53C9XVAR_H_ #include @@ -115,7 +115,8 @@ * scsi_status,sense_data}. */ struct ncr53c9x_ecb { - /* These fields are preserved between alloc and free */ + /* These fields are preserved between alloc and free. */ + struct callout ch; struct ncr53c9x_softc *sc; int tag_id; int flags; @@ -130,7 +131,6 @@ struct ncr53c9x_ecb { #define ECB_RESET 0x80 #define ECB_TENTATIVE_DONE 0x100 int timeout; - struct callout ch; struct { uint8_t msg[3]; /* Selection Id msg and tags */ @@ -290,7 +290,7 @@ extern int ncr53c9x_debug; struct ncr53c9x_softc; /* - * Function switch used as glue to MD code. + * Function switch used as glue to MD code */ struct ncr53c9x_glue { /* Mandatory entry points. */ @@ -304,9 +304,6 @@ struct ncr53c9x_glue { void (*gl_dma_go)(struct ncr53c9x_softc *); void (*gl_dma_stop)(struct ncr53c9x_softc *); int (*gl_dma_isactive)(struct ncr53c9x_softc *); - - /* Optional entry points. */ - void (*gl_clear_latched_intr)(struct ncr53c9x_softc *); }; struct ncr53c9x_softc { @@ -330,7 +327,7 @@ struct ncr53c9x_softc { uint8_t sc_ccf; /* Clock Conversion */ uint8_t sc_timeout; - /* register copies, see espreadregs() */ + /* register copies, see ncr53c9x_readregs() */ uint8_t sc_espintr; uint8_t sc_espstat; uint8_t sc_espstep; @@ -415,6 +412,7 @@ struct ncr53c9x_softc { #define NCR_F_FASTSCSI 0x02 /* chip supports Fast mode */ #define NCR_F_DMASELECT 0x04 /* can do dmaselect */ #define NCR_F_SELATN3 0x08 /* chip supports SELATN3 command */ +#define NCR_F_LARGEXFER 0x10 /* chip supports transfers > 64k */ /* values for sc_msgout */ #define SEND_DEV_RESET 0x0001 @@ -499,8 +497,10 @@ struct ncr53c9x_softc { #define ncr53c9x_cpb2stp(sc, cpb) \ ((250 * (cpb)) / (sc)->sc_freq) +extern devclass_t esp_devclass; + int ncr53c9x_attach(struct ncr53c9x_softc *sc); int ncr53c9x_detach(struct ncr53c9x_softc *sc); void ncr53c9x_intr(void *arg); -#endif /* _DEV_IC_NCR53C9XVAR_H_ */ +#endif /* _NCR53C9XVAR_H_ */ Modified: head/sys/sparc64/sbus/lsi64854.c ============================================================================== --- head/sys/sparc64/sbus/lsi64854.c Sun Oct 30 21:03:12 2011 (r226946) +++ head/sys/sparc64/sbus/lsi64854.c Sun Oct 30 21:17:42 2011 (r226947) @@ -94,7 +94,12 @@ int lsi64854debug = 0; #define DPRINTF(a,x) #endif -#define MAX_DMA_SZ (16*1024*1024) +/* + * The rules say we cannot transfer more than the limit of this DMA chip (64k + * for old and 16Mb for new), and we cannot cross a 16Mb boundary. + */ +#define MAX_DMA_SZ (64 * 1024) +#define BOUNDARY (16 * 1024 * 1024) static void lsi64854_reset(struct lsi64854_softc *); static void lsi64854_map_scsi(void *, bus_dma_segment_t *, int, int); @@ -125,6 +130,7 @@ lsi64854_attach(struct lsi64854_softc *s lockfunc = NULL; lockfuncarg = NULL; + sc->sc_maxdmasize = MAX_DMA_SZ; switch (sc->sc_channel) { case L64854_CHANNEL_SCSI: @@ -135,6 +141,7 @@ lsi64854_attach(struct lsi64854_softc *s } lockfunc = busdma_lock_mutex; lockfuncarg = &nsc->sc_lock; + sc->sc_maxdmasize = nsc->sc_maxxfer; sc->intr = lsi64854_scsi_intr; sc->setup = lsi64854_setup; break; @@ -153,13 +160,13 @@ lsi64854_attach(struct lsi64854_softc *s if (sc->setup != NULL) { error = bus_dma_tag_create( sc->sc_parent_dmat, /* parent */ - 1, 0, /* alignment, boundary */ + 1, BOUNDARY, /* alignment, boundary */ BUS_SPACE_MAXADDR, /* lowaddr */ BUS_SPACE_MAXADDR, /* highaddr */ NULL, NULL, /* filter, filterarg */ - MAX_DMA_SZ, /* maxsize */ + sc->sc_maxdmasize, /* maxsize */ 1, /* nsegments */ - MAX_DMA_SZ, /* maxsegsize */ + sc->sc_maxdmasize, /* maxsegsize */ BUS_DMA_ALLOCNOW, /* flags */ lockfunc, lockfuncarg, /* lockfunc, lockfuncarg */ &sc->sc_buffer_dmat); @@ -250,24 +257,25 @@ lsi64854_detach(struct lsi64854_softc *s * other revs: D_ESC_R_PEND bit reads as 0 \ */ \ DMAWAIT(sc, L64854_GCSR(sc) & D_ESC_R_PEND, "R_PEND", dontpanic);\ - if (sc->sc_rev != DMAREV_HME) { \ - /* \ - * Select drain bit based on revision \ - * also clears errors and D_TC flag \ - */ \ - csr = L64854_GCSR(sc); \ - if (sc->sc_rev == DMAREV_1 || sc->sc_rev == DMAREV_0) \ - csr |= D_ESC_DRAIN; \ - else \ - csr |= L64854_INVALIDATE; \ + if (sc->sc_rev != DMAREV_HME) { \ + /* \ + * Select drain bit based on revision \ + * also clears errors and D_TC flag \ + */ \ + csr = L64854_GCSR(sc); \ + if (sc->sc_rev == DMAREV_1 || sc->sc_rev == DMAREV_0) \ + csr |= D_ESC_DRAIN; \ + else \ + csr |= L64854_INVALIDATE; \ \ - L64854_SCSR(sc,csr); \ + L64854_SCSR(sc, csr); \ } \ /* \ * Wait for draining to finish \ * rev0 & rev1 call this PACKCNT \ */ \ - DMAWAIT(sc, L64854_GCSR(sc) & L64854_DRAINING, "DRAINING", dontpanic);\ + DMAWAIT(sc, L64854_GCSR(sc) & L64854_DRAINING, "DRAINING", \ + dontpanic); \ } while (/* CONSTCOND */0) #define DMA_FLUSH(sc, dontpanic) do { \ @@ -282,12 +290,14 @@ lsi64854_detach(struct lsi64854_softc *s csr = L64854_GCSR(sc); \ csr &= ~(L64854_WRITE|L64854_EN_DMA); /* no-ops on ENET */ \ csr |= L64854_INVALIDATE; /* XXX FAS ? */ \ - L64854_SCSR(sc,csr); \ + L64854_SCSR(sc, csr); \ } while (/* CONSTCOND */0) static void lsi64854_reset(struct lsi64854_softc *sc) { + bus_dma_tag_t dmat; + bus_dmamap_t dmam; uint32_t csr; DMA_FLUSH(sc, 1); @@ -296,10 +306,11 @@ lsi64854_reset(struct lsi64854_softc *sc DPRINTF(LDB_ANY, ("%s: csr 0x%x\n", __func__, csr)); if (sc->sc_dmasize != 0) { - bus_dmamap_sync(sc->sc_buffer_dmat, sc->sc_dmamap, - (csr & D_WRITE) != 0 ? BUS_DMASYNC_PREREAD : - BUS_DMASYNC_PREWRITE); - bus_dmamap_unload(sc->sc_buffer_dmat, sc->sc_dmamap); + dmat = sc->sc_buffer_dmat; + dmam = sc->sc_dmamap; + bus_dmamap_sync(dmat, dmam, (csr & D_WRITE) != 0 ? + BUS_DMASYNC_PREREAD : BUS_DMASYNC_PREWRITE); + bus_dmamap_unload(dmat, dmam); } if (sc->sc_rev == DMAREV_HME) @@ -364,15 +375,16 @@ lsi64854_map_scsi(void *arg, bus_dma_seg sc = (struct lsi64854_softc *)arg; + if (error != 0) + return; if (nseg != 1) panic("%s: cannot map %d segments\n", __func__, nseg); bus_dmamap_sync(sc->sc_buffer_dmat, sc->sc_dmamap, - sc->sc_datain ? BUS_DMASYNC_PREREAD : BUS_DMASYNC_PREWRITE); + sc->sc_datain != 0 ? BUS_DMASYNC_PREREAD : BUS_DMASYNC_PREWRITE); bus_write_4(sc->sc_res, L64854_REG_ADDR, segs[0].ds_addr); } -#define DMAMAX(a) (MAX_DMA_SZ - ((a) & (MAX_DMA_SZ - 1))) /* * setup a DMA transfer */ @@ -381,6 +393,7 @@ lsi64854_setup(struct lsi64854_softc *sc int datain, size_t *dmasize) { long bcnt; + int error; uint32_t csr; DMA_FLUSH(sc, 0); @@ -392,15 +405,12 @@ lsi64854_setup(struct lsi64854_softc *sc sc->sc_dmalen = len; sc->sc_datain = datain; - /* - * The rules say we cannot transfer more than the limit - * of this DMA chip (64k for old and 16Mb for new), - * and we cannot cross a 16Mb boundary. - */ - *dmasize = sc->sc_dmasize = - ulmin(*dmasize, DMAMAX((size_t)*sc->sc_dmaaddr)); + KASSERT(*dmasize <= sc->sc_maxdmasize, + ("%s: transfer size %ld too large", __func__, (long)*dmasize)); - DPRINTF(LDB_ANY, ("%s: dmasize=%ld\n", __func__, (long)sc->sc_dmasize)); + sc->sc_dmasize = *dmasize; + + DPRINTF(LDB_ANY, ("%s: dmasize=%ld\n", __func__, (long)*dmasize)); /* * XXX what length? @@ -412,24 +422,31 @@ lsi64854_setup(struct lsi64854_softc *sc bus_write_4(sc->sc_res, L64854_REG_CNT, *dmasize); } - /* Program the DMA address */ - if (sc->sc_dmasize != 0) - if (bus_dmamap_load(sc->sc_buffer_dmat, sc->sc_dmamap, - *sc->sc_dmaaddr, sc->sc_dmasize, lsi64854_map_scsi, sc, 0)) - panic("%s: cannot allocate DVMA address", __func__); + /* + * Load the transfer buffer and program the DMA address. + * Note that the NCR53C9x core can't handle EINPROGRESS so we set + * BUS_DMA_NOWAIT. + */ + if (*dmasize != 0) { + error = bus_dmamap_load(sc->sc_buffer_dmat, sc->sc_dmamap, + *sc->sc_dmaaddr, *dmasize, lsi64854_map_scsi, sc, + BUS_DMA_NOWAIT); + if (error != 0) + return (error); + } if (sc->sc_rev == DMAREV_ESC) { /* DMA ESC chip bug work-around */ - bcnt = sc->sc_dmasize; + bcnt = *dmasize; if (((bcnt + (long)*sc->sc_dmaaddr) & PAGE_MASK_8K) != 0) bcnt = roundup(bcnt, PAGE_SIZE_8K); bus_write_4(sc->sc_res, L64854_REG_CNT, bcnt); } - /* Setup DMA control register */ + /* Setup the DMA control register. */ csr = L64854_GCSR(sc); - if (datain) + if (datain != 0) csr |= L64854_WRITE; else csr &= ~L64854_WRITE; @@ -455,19 +472,23 @@ lsi64854_scsi_intr(void *arg) { struct lsi64854_softc *sc = arg; struct ncr53c9x_softc *nsc = sc->sc_client; - int trans, resid; + bus_dma_tag_t dmat; + bus_dmamap_t dmam; + size_t dmasize; + int lxfer, resid, trans; uint32_t csr; csr = L64854_GCSR(sc); DPRINTF(LDB_SCSI, ("%s: addr 0x%x, csr %b\n", __func__, - bus_read_4(sc->sc_res, L64854_REG_ADDR), csr, DDMACSR_BITS)); + bus_read_4(sc->sc_res, L64854_REG_ADDR), csr, DDMACSR_BITS)); - if (csr & (D_ERR_PEND|D_SLAVE_ERR)) { - device_printf(sc->sc_dev, "error: csr=%b\n", csr, DDMACSR_BITS); - csr &= ~D_EN_DMA; /* Stop DMA */ + if (csr & (D_ERR_PEND | D_SLAVE_ERR)) { + device_printf(sc->sc_dev, "error: csr=%b\n", csr, + DDMACSR_BITS); + csr &= ~D_EN_DMA; /* Stop DMA. */ /* Invalidate the queue; SLAVE_ERR bit is write-to-clear */ - csr |= D_INVALIDATE|D_SLAVE_ERR; + csr |= D_INVALIDATE | D_SLAVE_ERR; L64854_SCSR(sc, csr); return (-1); } @@ -483,10 +504,11 @@ lsi64854_scsi_intr(void *arg) L64854_SCSR(sc, csr); sc->sc_active = 0; - if (sc->sc_dmasize == 0) { - /* A "Transfer Pad" operation completed */ - DPRINTF(LDB_SCSI, ("%s: discarded %d bytes (tcl=%d, tcm=%d)\n", - __func__, NCR_READ_REG(nsc, NCR_TCL) | + dmasize = sc->sc_dmasize; + if (dmasize == 0) { + /* A "Transfer Pad" operation completed. */ + DPRINTF(LDB_SCSI, ("%s: discarded %d bytes (tcl=%d, " + "tcm=%d)\n", __func__, NCR_READ_REG(nsc, NCR_TCL) | (NCR_READ_REG(nsc, NCR_TCM) << 8), NCR_READ_REG(nsc, NCR_TCL), NCR_READ_REG(nsc, NCR_TCM))); return (0); @@ -499,7 +521,7 @@ lsi64854_scsi_intr(void *arg) * as residual since the NCR53C9X counter registers get decremented * as bytes are clocked into the FIFO. */ - if (!(csr & D_WRITE) && + if ((csr & D_WRITE) == 0 && (resid = (NCR_READ_REG(nsc, NCR_FFLAG) & NCRFIFO_FF)) != 0) { DPRINTF(LDB_SCSI, ("%s: empty esp FIFO of %d ", __func__, resid)); @@ -509,22 +531,21 @@ lsi64854_scsi_intr(void *arg) } if ((nsc->sc_espstat & NCRSTAT_TC) == 0) { + lxfer = nsc->sc_features & NCR_F_LARGEXFER; /* - * `Terminal count' is off, so read the residue + * "Terminal count" is off, so read the residue * out of the NCR53C9X counter registers. */ resid += (NCR_READ_REG(nsc, NCR_TCL) | (NCR_READ_REG(nsc, NCR_TCM) << 8) | - ((nsc->sc_cfg2 & NCRCFG2_FE) ? - (NCR_READ_REG(nsc, NCR_TCH) << 16) : 0)); + (lxfer != 0 ? (NCR_READ_REG(nsc, NCR_TCH) << 16) : 0)); - if (resid == 0 && sc->sc_dmasize == 65536 && - (nsc->sc_cfg2 & NCRCFG2_FE) == 0) - /* A transfer of 64K is encoded as `TCL=TCM=0' */ + if (resid == 0 && dmasize == 65536 && lxfer == 0) + /* A transfer of 64k is encoded as TCL=TCM=0. */ resid = 65536; } - trans = sc->sc_dmasize - resid; + trans = dmasize - resid; if (trans < 0) { /* transferred < 0? */ #if 0 /* @@ -533,21 +554,22 @@ lsi64854_scsi_intr(void *arg) * another target. As such, don't print the warning. */ device_printf(sc->sc_dev, "xfer (%d) > req (%d)\n", trans, - sc->sc_dmasize); + dmasize); #endif - trans = sc->sc_dmasize; + trans = dmasize; } DPRINTF(LDB_SCSI, ("%s: tcl=%d, tcm=%d, tch=%d; trans=%d, resid=%d\n", __func__, NCR_READ_REG(nsc, NCR_TCL), NCR_READ_REG(nsc, NCR_TCM), - (nsc->sc_cfg2 & NCRCFG2_FE) ? NCR_READ_REG(nsc, NCR_TCH) : 0, - trans, resid)); + (nsc->sc_sc_features & NCR_F_LARGEXFER) != 0 ? + NCR_READ_REG(nsc, NCR_TCH) : 0, trans, resid)); - if (sc->sc_dmasize != 0) { - bus_dmamap_sync(sc->sc_buffer_dmat, sc->sc_dmamap, - (csr & D_WRITE) != 0 ? BUS_DMASYNC_POSTREAD : - BUS_DMASYNC_POSTWRITE); - bus_dmamap_unload(sc->sc_buffer_dmat, sc->sc_dmamap); + if (dmasize != 0) { + dmat = sc->sc_buffer_dmat; *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@FreeBSD.ORG Sun Oct 30 21:19:14 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 447C4106566B; Sun, 30 Oct 2011 21:19:14 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 34E158FC08; Sun, 30 Oct 2011 21:19:14 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p9ULJEjt085331; Sun, 30 Oct 2011 21:19:14 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p9ULJEuU085329; Sun, 30 Oct 2011 21:19:14 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201110302119.p9ULJEuU085329@svn.freebsd.org> From: Marius Strobl Date: Sun, 30 Oct 2011 21:19: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: r226948 - head/sys/sparc64/sbus X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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 Oct 2011 21:19:14 -0000 Author: marius Date: Sun Oct 30 21:19:13 2011 New Revision: 226948 URL: http://svn.freebsd.org/changeset/base/226948 Log: Correct the DMA constraints, the LSI64854 isn't limited to 32-bit DMA. Modified: head/sys/sparc64/sbus/dma_sbus.c Modified: head/sys/sparc64/sbus/dma_sbus.c ============================================================================== --- head/sys/sparc64/sbus/dma_sbus.c Sun Oct 30 21:17:42 2011 (r226947) +++ head/sys/sparc64/sbus/dma_sbus.c Sun Oct 30 21:19:13 2011 (r226948) @@ -233,9 +233,9 @@ dma_attach(device_t dev) BUS_SPACE_MAXADDR, /* lowaddr */ BUS_SPACE_MAXADDR, /* highaddr */ NULL, NULL, /* filter, filterarg */ - BUS_SPACE_MAXSIZE_32BIT, /* maxsize */ - 0, /* nsegments */ - BUS_SPACE_MAXSIZE_32BIT, /* maxsegsize */ + BUS_SPACE_MAXSIZE, /* maxsize */ + BUS_SPACE_UNRESTRICTED, /* nsegments */ + BUS_SPACE_MAXSIZE, /* maxsegsize */ 0, /* flags */ NULL, NULL, /* no locking */ &lsc->sc_parent_dmat); From owner-svn-src-head@FreeBSD.ORG Sun Oct 30 21:42:35 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 83921106564A; Sun, 30 Oct 2011 21:42:35 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 73FCE8FC14; Sun, 30 Oct 2011 21:42:35 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p9ULgZ4A086049; Sun, 30 Oct 2011 21:42:35 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p9ULgZTD086047; Sun, 30 Oct 2011 21:42:35 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201110302142.p9ULgZTD086047@svn.freebsd.org> From: Marius Strobl Date: Sun, 30 Oct 2011 21:42: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: r226949 - head/sys/sparc64/sbus X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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 Oct 2011 21:42:35 -0000 Author: marius Date: Sun Oct 30 21:42:35 2011 New Revision: 226949 URL: http://svn.freebsd.org/changeset/base/226949 Log: Actually, limit to 32-bit DMA for the transfer buffers as the address is written into a 32-bit register. Modified: head/sys/sparc64/sbus/lsi64854.c Modified: head/sys/sparc64/sbus/lsi64854.c ============================================================================== --- head/sys/sparc64/sbus/lsi64854.c Sun Oct 30 21:19:13 2011 (r226948) +++ head/sys/sparc64/sbus/lsi64854.c Sun Oct 30 21:42:35 2011 (r226949) @@ -161,7 +161,7 @@ lsi64854_attach(struct lsi64854_softc *s error = bus_dma_tag_create( sc->sc_parent_dmat, /* parent */ 1, BOUNDARY, /* alignment, boundary */ - BUS_SPACE_MAXADDR, /* lowaddr */ + BUS_SPACE_MAXADDR_32BIT, /* lowaddr */ BUS_SPACE_MAXADDR, /* highaddr */ NULL, NULL, /* filter, filterarg */ sc->sc_maxdmasize, /* maxsize */ @@ -462,7 +462,7 @@ lsi64854_setup(struct lsi64854_softc *sc /* * Pseudo (chained) interrupt from the esp driver to kick the - * current running DMA transfer. Called from ncr53c9x_intr() + * current running DMA transfer. Called from ncr53c9x_intr() * for now. * * return 1 if it was a DMA continue. From owner-svn-src-head@FreeBSD.ORG Sun Oct 30 21:45:36 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CA9B01065677; Sun, 30 Oct 2011 21:45:36 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id BB2408FC21; Sun, 30 Oct 2011 21:45:36 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p9ULjaAg086182; Sun, 30 Oct 2011 21:45:36 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p9ULjaWB086180; Sun, 30 Oct 2011 21:45:36 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201110302145.p9ULjaWB086180@svn.freebsd.org> From: Marius Strobl Date: Sun, 30 Oct 2011 21:45: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: r226950 - head/sys/dev/esp X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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 Oct 2011 21:45:36 -0000 Author: marius Date: Sun Oct 30 21:45:36 2011 New Revision: 226950 URL: http://svn.freebsd.org/changeset/base/226950 Log: Add multiple inclusion protection. Modified: head/sys/dev/esp/ncr53c9xreg.h Modified: head/sys/dev/esp/ncr53c9xreg.h ============================================================================== --- head/sys/dev/esp/ncr53c9xreg.h Sun Oct 30 21:42:35 2011 (r226949) +++ head/sys/dev/esp/ncr53c9xreg.h Sun Oct 30 21:45:36 2011 (r226950) @@ -31,6 +31,9 @@ /* $FreeBSD$ */ +#ifndef _NCR53C9XREG_H_ +#define _NCR53C9XREG_H_ + /* * Register addresses, relative to some base address */ @@ -288,3 +291,4 @@ #define NCRFAS_STAT2_OSHUTTLE 0x40 /* next byte from FIFO is MSB */ #define NCRFAS_STAT2_EMPTY 0x80 /* FIFO is empty */ +#endif /* _NCR53C9XREG_H_ */ From owner-svn-src-head@FreeBSD.ORG Sun Oct 30 22:20:17 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 75A721065670; Sun, 30 Oct 2011 22:20:17 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 6554B8FC0C; Sun, 30 Oct 2011 22:20:17 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p9UMKHOH087328; Sun, 30 Oct 2011 22:20:17 GMT (envelope-from dim@svn.freebsd.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p9UMKHD9087326; Sun, 30 Oct 2011 22:20:17 GMT (envelope-from dim@svn.freebsd.org) Message-Id: <201110302220.p9UMKHD9087326@svn.freebsd.org> From: Dimitry Andric Date: Sun, 30 Oct 2011 22:20:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r226951 - head/contrib/llvm/tools/clang/lib/Basic X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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 Oct 2011 22:20:17 -0000 Author: dim Date: Sun Oct 30 22:20:17 2011 New Revision: 226951 URL: http://svn.freebsd.org/changeset/base/226951 Log: Pull in r143305 and r143312 from upstream clang trunk, so using "clang -march=native" on AMD K10 family processors no longer errors out with "unknown target CPU 'amdfam10'". This also enables use of SSE4A. Reported by: David Marec MFC after: 3 days Modified: head/contrib/llvm/tools/clang/lib/Basic/Targets.cpp Modified: head/contrib/llvm/tools/clang/lib/Basic/Targets.cpp ============================================================================== --- head/contrib/llvm/tools/clang/lib/Basic/Targets.cpp Sun Oct 30 21:45:36 2011 (r226950) +++ head/contrib/llvm/tools/clang/lib/Basic/Targets.cpp Sun Oct 30 22:20:17 2011 (r226951) @@ -1282,6 +1282,7 @@ class X86TargetInfo : public TargetInfo CK_K8SSE3, CK_Opteron, CK_OpteronSSE3, + CK_AMDFAM10, /// This specification is deprecated and will be removed in the future. /// Users should prefer \see CK_K8. @@ -1381,6 +1382,7 @@ public: .Case("k8-sse3", CK_K8SSE3) .Case("opteron", CK_Opteron) .Case("opteron-sse3", CK_OpteronSSE3) + .Case("amdfam10", CK_AMDFAM10) .Case("x86-64", CK_x86_64) .Case("geode", CK_Geode) .Default(CK_Generic); @@ -1441,6 +1443,7 @@ public: case CK_K8SSE3: case CK_Opteron: case CK_OpteronSSE3: + case CK_AMDFAM10: case CK_x86_64: return true; } @@ -1459,12 +1462,10 @@ void X86TargetInfo::getDefaultFeatures(l Features["ssse3"] = false; Features["sse41"] = false; Features["sse42"] = false; + Features["sse4a"] = false; Features["aes"] = false; Features["avx"] = false; - // LLVM does not currently recognize this. - // Features["sse4a"] = false; - // FIXME: This *really* should not be here. // X86_64 always has SSE2. @@ -1561,6 +1562,11 @@ void X86TargetInfo::getDefaultFeatures(l setFeatureEnabled(Features, "sse3", true); setFeatureEnabled(Features, "3dnowa", true); break; + case CK_AMDFAM10: + setFeatureEnabled(Features, "sse3", true); + setFeatureEnabled(Features, "sse4a", true); + setFeatureEnabled(Features, "3dnowa", true); + break; case CK_C3_2: setFeatureEnabled(Features, "mmx", true); setFeatureEnabled(Features, "sse", true); @@ -1604,6 +1610,8 @@ bool X86TargetInfo::setFeatureEnabled(ll else if (Name == "avx") Features["avx"] = Features["sse"] = Features["sse2"] = Features["sse3"] = Features["ssse3"] = Features["sse41"] = Features["sse42"] = true; + else if (Name == "sse4a") + Features["sse4a"] = true; } else { if (Name == "mmx") Features["mmx"] = Features["3dnow"] = Features["3dnowa"] = false; @@ -1630,6 +1638,8 @@ bool X86TargetInfo::setFeatureEnabled(ll Features["aes"] = false; else if (Name == "avx") Features["avx"] = false; + else if (Name == "sse4a") + Features["sse4a"] = false; } return true; @@ -1826,6 +1836,11 @@ void X86TargetInfo::getTargetDefines(con Builder.defineMacro("__k8__"); Builder.defineMacro("__tune_k8__"); break; + case CK_AMDFAM10: + Builder.defineMacro("__amdfam10"); + Builder.defineMacro("__amdfam10__"); + Builder.defineMacro("__tune_amdfam10__"); + break; case CK_Geode: Builder.defineMacro("__geode"); Builder.defineMacro("__geode__"); From owner-svn-src-head@FreeBSD.ORG Mon Oct 31 04:25:26 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 1033) id 811AB106568D; Mon, 31 Oct 2011 04:25:26 +0000 (UTC) Date: Mon, 31 Oct 2011 04:25:26 +0000 From: Alexey Dokuchaev To: Marius Strobl Message-ID: <20111031042526.GA57014@FreeBSD.org> References: <201110302117.p9ULHgLD085245@svn.freebsd.org> Mime-Version: 1.0 Content-Type: text/plain; charset=koi8-r Content-Disposition: inline In-Reply-To: <201110302117.p9ULHgLD085245@svn.freebsd.org> User-Agent: Mutt/1.4.2.1i Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r226947 - in head/sys: dev/esp sparc64/sbus X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 31 Oct 2011 04:25:26 -0000 On Sun, Oct 30, 2011 at 09:17:42PM +0000, Marius Strobl wrote: > Author: marius > Date: Sun Oct 30 21:17:42 2011 > New Revision: 226947 > URL: http://svn.freebsd.org/changeset/base/226947 > > Log: > - Use device_t rather than the NetBSDish struct device. Hmm, I though that style(9) advises against this practice: Avoid using typedefs for structure types. Typedefs are problematic because they do not properly hide their underlying type; [...] When convention requires a typedef, make its name match the struct tag. Avoid typedefs ending in _t, except as specified in Standard C or by POSIX. Does these rules not apply for struct device for some reason? ./danfe From owner-svn-src-head@FreeBSD.ORG Mon Oct 31 05:11:19 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6FF4E106564A; Mon, 31 Oct 2011 05:11:19 +0000 (UTC) (envelope-from julian@freebsd.org) Received: from vps1.elischer.org (vps1.elischer.org [204.109.63.16]) by mx1.freebsd.org (Postfix) with ESMTP id 3EC0A8FC17; Mon, 31 Oct 2011 05:11:18 +0000 (UTC) Received: from julian-mac.elischer.org (home-nat.elischer.org [67.100.89.137]) (authenticated bits=0) by vps1.elischer.org (8.14.4/8.14.4) with ESMTP id p9V4VEYi089679 (version=TLSv1/SSLv3 cipher=DHE-RSA-CAMELLIA256-SHA bits=256 verify=NO); Sun, 30 Oct 2011 21:31:19 -0700 (PDT) (envelope-from julian@freebsd.org) Message-ID: <4EAE248E.1060507@freebsd.org> Date: Sun, 30 Oct 2011 21:31:10 -0700 From: Julian Elischer User-Agent: Mozilla/5.0 (Macintosh; U; PPC Mac OS X 10.4; en-US; rv:1.9.2.23) Gecko/20110920 Thunderbird/3.1.15 MIME-Version: 1.0 To: Alexey Dokuchaev References: <201110302117.p9ULHgLD085245@svn.freebsd.org> <20111031042526.GA57014@FreeBSD.org> In-Reply-To: <20111031042526.GA57014@FreeBSD.org> Content-Type: text/plain; charset=KOI8-R; format=flowed Content-Transfer-Encoding: 7bit Cc: svn-src-head@freebsd.org, Marius Strobl , src-committers@freebsd.org, svn-src-all@freebsd.org Subject: Re: svn commit: r226947 - in head/sys: dev/esp sparc64/sbus X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 31 Oct 2011 05:11:19 -0000 On 10/30/11 9:25 PM, Alexey Dokuchaev wrote: > On Sun, Oct 30, 2011 at 09:17:42PM +0000, Marius Strobl wrote: >> Author: marius >> Date: Sun Oct 30 21:17:42 2011 >> New Revision: 226947 >> URL: http://svn.freebsd.org/changeset/base/226947 >> >> Log: >> - Use device_t rather than the NetBSDish struct device. > Hmm, I though that style(9) advises against this practice: > > Avoid using typedefs for structure types. Typedefs are problematic > because they do not properly hide their underlying type; [...] > > When convention requires a typedef, make its name match the struct tag. > Avoid typedefs ending in _t, except as specified in Standard C or by > POSIX. > > Does these rules not apply for struct device for some reason? > > ./danfe > I agree we should be trying to get rid of the blah_t horrors. I think this went the wrong direction. From owner-svn-src-head@FreeBSD.ORG Mon Oct 31 08:59:17 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D3CC7106566C; Mon, 31 Oct 2011 08:59:17 +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 B98AC8FC12; Mon, 31 Oct 2011 08:59:17 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p9V8xHm0007408; Mon, 31 Oct 2011 08:59:17 GMT (envelope-from ed@svn.freebsd.org) Received: (from ed@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p9V8xHSr007401; Mon, 31 Oct 2011 08:59:17 GMT (envelope-from ed@svn.freebsd.org) Message-Id: <201110310859.p9V8xHSr007401@svn.freebsd.org> From: Ed Schouten Date: Mon, 31 Oct 2011 08:59: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: r226961 - in head/bin: cat ln mkdir mv rm test X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 31 Oct 2011 08:59:17 -0000 Author: ed Date: Mon Oct 31 08:59:17 2011 New Revision: 226961 URL: http://svn.freebsd.org/changeset/base/226961 Log: Put some static keywords in the source code. For these simple utilities, it doesn't harm to make all global variables static. In fact, this allows the compiler to perform better forms of optimisation and analysis. Modified: head/bin/cat/cat.c head/bin/ln/ln.c head/bin/mkdir/mkdir.c head/bin/mv/mv.c head/bin/rm/rm.c head/bin/test/test.c Modified: head/bin/cat/cat.c ============================================================================== --- head/bin/cat/cat.c Mon Oct 31 08:48:27 2011 (r226960) +++ head/bin/cat/cat.c Mon Oct 31 08:59:17 2011 (r226961) @@ -64,9 +64,9 @@ __FBSDID("$FreeBSD$"); #include #include -int bflag, eflag, nflag, sflag, tflag, vflag; -int rval; -const char *filename; +static int bflag, eflag, nflag, sflag, tflag, vflag; +static int rval; +static const char *filename; static void usage(void); static void scanfiles(char *argv[], int cooked); Modified: head/bin/ln/ln.c ============================================================================== --- head/bin/ln/ln.c Mon Oct 31 08:48:27 2011 (r226960) +++ head/bin/ln/ln.c Mon Oct 31 08:59:17 2011 (r226961) @@ -54,16 +54,16 @@ __FBSDID("$FreeBSD$"); #include #include -int fflag; /* Unlink existing files. */ -int Fflag; /* Remove empty directories also. */ -int hflag; /* Check new name for symlink first. */ -int iflag; /* Interactive mode. */ -int Pflag; /* Create hard links to symlinks. */ -int sflag; /* Symbolic, not hard, link. */ -int vflag; /* Verbose output. */ -int wflag; /* Warn if symlink target does not +static int fflag; /* Unlink existing files. */ +static int Fflag; /* Remove empty directories also. */ +static int hflag; /* Check new name for symlink first. */ +static int iflag; /* Interactive mode. */ +static int Pflag; /* Create hard links to symlinks. */ +static int sflag; /* Symbolic, not hard, link. */ +static int vflag; /* Verbose output. */ +static int wflag; /* Warn if symlink target does not * exist, and -f is not enabled. */ -char linkch; +static char linkch; int linkit(const char *, const char *, int); void usage(void); Modified: head/bin/mkdir/mkdir.c ============================================================================== --- head/bin/mkdir/mkdir.c Mon Oct 31 08:48:27 2011 (r226960) +++ head/bin/mkdir/mkdir.c Mon Oct 31 08:59:17 2011 (r226961) @@ -56,7 +56,7 @@ __FBSDID("$FreeBSD$"); static int build(char *, mode_t); static void usage(void); -int vflag; +static int vflag; int main(int argc, char *argv[]) Modified: head/bin/mv/mv.c ============================================================================== --- head/bin/mv/mv.c Mon Oct 31 08:48:27 2011 (r226960) +++ head/bin/mv/mv.c Mon Oct 31 08:59:17 2011 (r226961) @@ -68,7 +68,7 @@ __FBSDID("$FreeBSD$"); /* Exit code for a failed exec. */ #define EXEC_FAILED 127 -int fflg, iflg, nflg, vflg; +static int fflg, iflg, nflg, vflg; static int copy(const char *, const char *); static int do_move(const char *, const char *); Modified: head/bin/rm/rm.c ============================================================================== --- head/bin/rm/rm.c Mon Oct 31 08:48:27 2011 (r226960) +++ head/bin/rm/rm.c Mon Oct 31 08:59:17 2011 (r226961) @@ -57,10 +57,10 @@ __FBSDID("$FreeBSD$"); #include #include -int dflag, eval, fflag, iflag, Pflag, vflag, Wflag, stdin_ok; -int rflag, Iflag; -uid_t uid; -volatile sig_atomic_t info; +static int dflag, eval, fflag, iflag, Pflag, vflag, Wflag, stdin_ok; +static int rflag, Iflag; +static uid_t uid; +static volatile sig_atomic_t info; int check(char *, char *, struct stat *); int check2(char **); Modified: head/bin/test/test.c ============================================================================== --- head/bin/test/test.c Mon Oct 31 08:48:27 2011 (r226960) +++ head/bin/test/test.c Mon Oct 31 08:59:17 2011 (r226961) @@ -118,7 +118,7 @@ enum token_types { PAREN }; -struct t_op { +static struct t_op { const char *op_text; short op_num, op_type; } const ops [] = { @@ -165,10 +165,10 @@ struct t_op { {0, 0, 0} }; -struct t_op const *t_wp_op; -int nargc; -char **t_wp; -int parenlevel; +static struct t_op const *t_wp_op; +static int nargc; +static char **t_wp; +static int parenlevel; static int aexpr(enum token); static int binop(void); From owner-svn-src-head@FreeBSD.ORG Mon Oct 31 10:53:27 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9C489106566B; Mon, 31 Oct 2011 10:53:27 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 8C9308FC08; Mon, 31 Oct 2011 10:53:27 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p9VArRMf013181; Mon, 31 Oct 2011 10:53:27 GMT (envelope-from ae@svn.freebsd.org) Received: (from ae@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p9VArRK2013179; Mon, 31 Oct 2011 10:53:27 GMT (envelope-from ae@svn.freebsd.org) Message-Id: <201110311053.p9VArRK2013179@svn.freebsd.org> From: "Andrey V. Elsukov" Date: Mon, 31 Oct 2011 10:53: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: r226966 - head/sys/dev/md X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 31 Oct 2011 10:53:27 -0000 Author: ae Date: Mon Oct 31 10:53:27 2011 New Revision: 226966 URL: http://svn.freebsd.org/changeset/base/226966 Log: Add information about MD_READONLY and MD_COMPRESS flags to the configuration dump. MFC after: 1 week Modified: head/sys/dev/md/md.c Modified: head/sys/dev/md/md.c ============================================================================== --- head/sys/dev/md/md.c Mon Oct 31 09:27:10 2011 (r226965) +++ head/sys/dev/md/md.c Mon Oct 31 10:53:27 2011 (r226966) @@ -1370,6 +1370,11 @@ g_md_dumpconf(struct sbuf *sb, const cha indent, (uintmax_t) mp->fwsectors); sbuf_printf(sb, "%s%ju\n", indent, (uintmax_t) mp->mediasize); + sbuf_printf(sb, "%s%s\n", indent, + (mp->flags & MD_COMPRESS) == 0 ? "off": "on"); + sbuf_printf(sb, "%s%s\n", indent, + (mp->flags & MD_READONLY) == 0 ? "read-write": + "read-only"); sbuf_printf(sb, "%s%s\n", indent, type); if (mp->type == MD_VNODE && mp->vnode != NULL) From owner-svn-src-head@FreeBSD.ORG Mon Oct 31 13:01:21 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E9A731065674; Mon, 31 Oct 2011 13:01:21 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail02.syd.optusnet.com.au (mail02.syd.optusnet.com.au [211.29.132.183]) by mx1.freebsd.org (Postfix) with ESMTP id 6A0058FC16; Mon, 31 Oct 2011 13:01:21 +0000 (UTC) Received: from c122-106-165-191.carlnfd1.nsw.optusnet.com.au (c122-106-165-191.carlnfd1.nsw.optusnet.com.au [122.106.165.191]) by mail02.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id p9VD1GY0025647 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Tue, 1 Nov 2011 00:01:18 +1100 Date: Tue, 1 Nov 2011 00:01:16 +1100 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Alexey Dokuchaev In-Reply-To: <20111031042526.GA57014@FreeBSD.org> Message-ID: <20111031233854.Y1523@besplex.bde.org> References: <201110302117.p9ULHgLD085245@svn.freebsd.org> <20111031042526.GA57014@FreeBSD.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: svn-src-head@freebsd.org, Marius Strobl , src-committers@freebsd.org, svn-src-all@freebsd.org Subject: Re: svn commit: r226947 - in head/sys: dev/esp sparc64/sbus X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 31 Oct 2011 13:01:22 -0000 On Mon, 31 Oct 2011, Alexey Dokuchaev wrote: > On Sun, Oct 30, 2011 at 09:17:42PM +0000, Marius Strobl wrote: >> Log: >> - Use device_t rather than the NetBSDish struct device. > > Hmm, I though that style(9) advises against this practice: > > Avoid using typedefs for structure types. Typedefs are problematic > because they do not properly hide their underlying type; [...] > > When convention requires a typedef, make its name match the struct tag. > Avoid typedefs ending in _t, except as specified in Standard C or by > POSIX. > > Does these rules not apply for struct device for some reason? Yes (they don't apply here). device_t is one of a few properly opaque typedefs for struct pointers. 'struct device' is only (completely) declared in kern/subr_bus.c. Thus the implementation details of it obviously cannot escape to drivers. Most of the APIs in are supposed to be like this. But `typedef struct kobj_class driver_t' and `#define driver_method_t kobj_method_t' are gross exceptions. has to include for dereferencing these, and kobj.h breaks the rule by providing both typedefs for struct pointers and complete struct declarations. Bruce From owner-svn-src-head@FreeBSD.ORG Mon Oct 31 15:01:48 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 23E6A106564A; Mon, 31 Oct 2011 15:01:48 +0000 (UTC) (envelope-from pho@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 1410E8FC17; Mon, 31 Oct 2011 15:01:48 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p9VF1lfi020690; Mon, 31 Oct 2011 15:01:47 GMT (envelope-from pho@svn.freebsd.org) Received: (from pho@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p9VF1lrf020688; Mon, 31 Oct 2011 15:01:47 GMT (envelope-from pho@svn.freebsd.org) Message-Id: <201110311501.p9VF1lrf020688@svn.freebsd.org> From: Peter Holm Date: Mon, 31 Oct 2011 15:01: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: r226967 - 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, 31 Oct 2011 15:01:48 -0000 Author: pho Date: Mon Oct 31 15:01:47 2011 New Revision: 226967 URL: http://svn.freebsd.org/changeset/base/226967 Log: The kern_renameat() looks up the fvp using the DELETE flag, which causes the removal of the name cache entry for fvp. Reported by: Anton Yuzhaninov In collaboration with: kib MFC after: 1 week Modified: head/sys/ufs/ufs/ufs_vnops.c Modified: head/sys/ufs/ufs/ufs_vnops.c ============================================================================== --- head/sys/ufs/ufs/ufs_vnops.c Mon Oct 31 10:53:27 2011 (r226966) +++ head/sys/ufs/ufs/ufs_vnops.c Mon Oct 31 15:01:47 2011 (r226967) @@ -1519,6 +1519,13 @@ relock: cache_purge(fdvp); } error = ufs_dirremove(fdvp, fip, fcnp->cn_flags, 0); + /* + * As the relookup of the fvp is done in two steps: + * ufs_lookup_ino() and then VFS_VGET(), another thread might do a + * normal lookup of the from name just before the VFS_VGET() call, + * causing the cache entry to be re-instantiated. + */ + cache_purge(fvp); unlockout: vput(fdvp); From owner-svn-src-head@FreeBSD.ORG Mon Oct 31 16:33:04 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 618EE106566C; Mon, 31 Oct 2011 16:33:04 +0000 (UTC) (envelope-from pluknet@gmail.com) Received: from mail-fx0-f54.google.com (mail-fx0-f54.google.com [209.85.161.54]) by mx1.freebsd.org (Postfix) with ESMTP id 6F46C8FC1C; Mon, 31 Oct 2011 16:33:03 +0000 (UTC) Received: by faar19 with SMTP id r19so8136367faa.13 for ; Mon, 31 Oct 2011 09:33:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=7iBU6FYPekzqcX3LzOETad6o4DHu9DSJTO9LXUz86KI=; b=toN3e9M9PcjgJCdwexFzHgijbSiIZUOB/ygHNxT0BdNserEZEIKeJxmeEZEXhnK3FO xXvg2AzPvfiyI5Yxwk87KQ4XH5LhYNHgt6crIUkfzQ7jmKm2+prFIv02XBRo2Rru2jPH CYvun5C0iwB1Vsa/KlZ0DAXNB6Ag2ZJw0+2/A= MIME-Version: 1.0 Received: by 10.182.59.5 with SMTP id v5mr3002757obq.78.1320078781645; Mon, 31 Oct 2011 09:33:01 -0700 (PDT) Sender: pluknet@gmail.com Received: by 10.182.89.41 with HTTP; Mon, 31 Oct 2011 09:33:01 -0700 (PDT) In-Reply-To: <201110300506.p9U56E3l049042@svn.freebsd.org> References: <201110300506.p9U56E3l049042@svn.freebsd.org> Date: Mon, 31 Oct 2011 19:33:01 +0300 X-Google-Sender-Auth: 6M2N4BX3H6aIzcsZjknutbVoZ1Q Message-ID: From: Sergey Kandaurov To: Alan Cox Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r226928 - head/sys/vm X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 31 Oct 2011 16:33:04 -0000 On 30 October 2011 09:06, Alan Cox wrote: > Author: alc > Date: Sun Oct 30 05:06:14 2011 > New Revision: 226928 > URL: http://svn.freebsd.org/changeset/base/226928 > > Log: > =A0Eliminate vm_phys_bootstrap_alloc(). =A0It was a failed attempt at > =A0eliminating duplicated code in the various pmap implementations. > > =A0Micro-optimize vm_phys_free_pages(). > > =A0Introduce vm_phys_free_contig(). =A0It is fast routine for freeing an > =A0arbitrary number of physically contiguous pages. =A0In particular, it > =A0doesn't require the number of pages to be a power of two. > > =A0Use "u_long" instead of "unsigned long". > > =A0Bruce Evans (bde@) has convinced me that the "boundary" parameters > =A0to kmem_alloc_contig(), vm_phys_alloc_contig(), and > =A0vm_reserv_reclaim_contig() should be of type "vm_paddr_t" and not > =A0"u_long". =A0Make this change. Hello. After updating to this revision I constantly get random mtrash_ctor() assertions. [most often during make installkernel, otherwise idle.] Below is one of them (previous memory consumers in panicstr differ). Memory modified after free 0xfffffe0002700800(120) val=3D0 @ 0xfffffe000270= 0800 panic: Most recently used by proc-args cpuid =3D 1 KDB: stack backtrace: db_trace_self_wrapper() at 0xffffffff802e009a =3D db_trace_self_wrapper+0x2= a kdb_backtrace() at 0xffffffff80486f17 =3D kdb_backtrace+0x37 panic() at 0xffffffff8044f87e =3D panic+0x2ee mtrash_ctor() at 0xffffffff8068c904 =3D mtrash_ctor+0x84 uma_zalloc_arg() at 0xffffffff8068c16c =3D uma_zalloc_arg+0x2dc malloc() at 0xffffffff8043abd6 =3D malloc+0xc6 pargs_alloc() at 0xffffffff804425d3 =3D pargs_alloc+0x23 kern_execve() at 0xffffffff8041cb47 =3D kern_execve+0x1277 sys_execve() at 0xffffffff8041ce6d =3D sys_execve+0x3d amd64_syscall() at 0xffffffff806c6319 =3D amd64_syscall+0x299 Xfast_syscall() at 0xffffffff806b16b7 =3D Xfast_syscall+0xf7 --- syscall (59, FreeBSD ELF64, sys_execve), rip =3D 0x800d4cbec, rsp =3D 0x7fffffffd1a8, rbp =3D 0x8014124a0 --- --=20 wbr, pluknet From owner-svn-src-head@FreeBSD.ORG Mon Oct 31 16:42:05 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B6C6C106564A; Mon, 31 Oct 2011 16:42:05 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from cyrus.watson.org (cyrus.watson.org [65.122.17.42]) by mx1.freebsd.org (Postfix) with ESMTP id 8EC148FC15; Mon, 31 Oct 2011 16:42:05 +0000 (UTC) Received: from bigwig.baldwin.cx (66.111.2.69.static.nyinternet.net [66.111.2.69]) by cyrus.watson.org (Postfix) with ESMTPSA id 31B2846B0A; Mon, 31 Oct 2011 12:42:05 -0400 (EDT) Received: from jhbbsd.localnet (unknown [209.249.190.124]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id A482B8A02E; Mon, 31 Oct 2011 12:42:04 -0400 (EDT) From: John Baldwin To: Peter Holm Date: Mon, 31 Oct 2011 12:41:41 -0400 User-Agent: KMail/1.13.5 (FreeBSD/8.2-CBSD-20110714-p8; KDE/4.5.5; amd64; ; ) References: <201110311501.p9VF1lrf020688@svn.freebsd.org> In-Reply-To: <201110311501.p9VF1lrf020688@svn.freebsd.org> MIME-Version: 1.0 Content-Type: Text/Plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <201110311241.42067.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.6 (bigwig.baldwin.cx); Mon, 31 Oct 2011 12:42:04 -0400 (EDT) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r226967 - 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, 31 Oct 2011 16:42:05 -0000 On Monday, October 31, 2011 11:01:47 am Peter Holm wrote: > Author: pho > Date: Mon Oct 31 15:01:47 2011 > New Revision: 226967 > URL: http://svn.freebsd.org/changeset/base/226967 > > Log: > The kern_renameat() looks up the fvp using the DELETE flag, which causes > the removal of the name cache entry for fvp. > > Reported by: Anton Yuzhaninov > In collaboration with: kib > MFC after: 1 week Hmm, the log message doesn't seem to quite match the change? Was it truncated? > Modified: > head/sys/ufs/ufs/ufs_vnops.c > > Modified: head/sys/ufs/ufs/ufs_vnops.c > ============================================================================== > --- head/sys/ufs/ufs/ufs_vnops.c Mon Oct 31 10:53:27 2011 (r226966) > +++ head/sys/ufs/ufs/ufs_vnops.c Mon Oct 31 15:01:47 2011 (r226967) > @@ -1519,6 +1519,13 @@ relock: > cache_purge(fdvp); > } > error = ufs_dirremove(fdvp, fip, fcnp->cn_flags, 0); > + /* > + * As the relookup of the fvp is done in two steps: > + * ufs_lookup_ino() and then VFS_VGET(), another thread might do a > + * normal lookup of the from name just before the VFS_VGET() call, > + * causing the cache entry to be re-instantiated. > + */ > + cache_purge(fvp); > > unlockout: > vput(fdvp); > -- John Baldwin From owner-svn-src-head@FreeBSD.ORG Mon Oct 31 17:30:47 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 32F0E106564A; Mon, 31 Oct 2011 17:30:47 +0000 (UTC) (envelope-from alc@rice.edu) Received: from mh1.mail.rice.edu (mh1.mail.rice.edu [128.42.201.20]) by mx1.freebsd.org (Postfix) with ESMTP id EF0C98FC16; Mon, 31 Oct 2011 17:30:46 +0000 (UTC) Received: from mh1.mail.rice.edu (localhost.localdomain [127.0.0.1]) by mh1.mail.rice.edu (Postfix) with ESMTP id 81D28291AAF; Mon, 31 Oct 2011 12:13:22 -0500 (CDT) Received: from mh1.mail.rice.edu (localhost.localdomain [127.0.0.1]) by mh1.mail.rice.edu (Postfix) with ESMTP id 72D16297603; Mon, 31 Oct 2011 12:13:22 -0500 (CDT) X-Virus-Scanned: by amavis-2.6.4 at mh1.mail.rice.edu, auth channel Received: from mh1.mail.rice.edu ([127.0.0.1]) by mh1.mail.rice.edu (mh1.mail.rice.edu [127.0.0.1]) (amavis, port 10026) with ESMTP id 4gLz-lsylwvg; Mon, 31 Oct 2011 12:13:22 -0500 (CDT) Received: from adsl-216-63-78-18.dsl.hstntx.swbell.net (adsl-216-63-78-18.dsl.hstntx.swbell.net [216.63.78.18]) (using TLSv1 with cipher RC4-MD5 (128/128 bits)) (No client certificate requested) (Authenticated sender: alc) by mh1.mail.rice.edu (Postfix) with ESMTPSA id 6E77E291AAF; Mon, 31 Oct 2011 12:13:21 -0500 (CDT) Message-ID: <4EAED730.5080205@rice.edu> Date: Mon, 31 Oct 2011 12:13:20 -0500 From: Alan Cox User-Agent: Mozilla/5.0 (X11; U; FreeBSD i386; en-US; rv:1.9.2.17) Gecko/20110620 Thunderbird/3.1.10 MIME-Version: 1.0 To: Sergey Kandaurov References: <201110300506.p9U56E3l049042@svn.freebsd.org> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: Alan Cox , svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r226928 - head/sys/vm X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 31 Oct 2011 17:30:47 -0000 On 10/31/2011 11:33, Sergey Kandaurov wrote: > On 30 October 2011 09:06, Alan Cox wrote: >> Author: alc >> Date: Sun Oct 30 05:06:14 2011 >> New Revision: 226928 >> URL: http://svn.freebsd.org/changeset/base/226928 >> >> Log: >> Eliminate vm_phys_bootstrap_alloc(). It was a failed attempt at >> eliminating duplicated code in the various pmap implementations. >> >> Micro-optimize vm_phys_free_pages(). >> >> Introduce vm_phys_free_contig(). It is fast routine for freeing an >> arbitrary number of physically contiguous pages. In particular, it >> doesn't require the number of pages to be a power of two. >> >> Use "u_long" instead of "unsigned long". >> >> Bruce Evans (bde@) has convinced me that the "boundary" parameters >> to kmem_alloc_contig(), vm_phys_alloc_contig(), and >> vm_reserv_reclaim_contig() should be of type "vm_paddr_t" and not >> "u_long". Make this change. > Hello. > > After updating to this revision I constantly get random mtrash_ctor() > assertions. [most often during make installkernel, otherwise idle.] > > Below is one of them (previous memory consumers in panicstr differ). > > Memory modified after free 0xfffffe0002700800(120) val=0 @ 0xfffffe0002700800 > panic: Most recently used by proc-args > > cpuid = 1 > KDB: stack backtrace: > db_trace_self_wrapper() at 0xffffffff802e009a = db_trace_self_wrapper+0x2a > kdb_backtrace() at 0xffffffff80486f17 = kdb_backtrace+0x37 > panic() at 0xffffffff8044f87e = panic+0x2ee > mtrash_ctor() at 0xffffffff8068c904 = mtrash_ctor+0x84 > uma_zalloc_arg() at 0xffffffff8068c16c = uma_zalloc_arg+0x2dc > malloc() at 0xffffffff8043abd6 = malloc+0xc6 > pargs_alloc() at 0xffffffff804425d3 = pargs_alloc+0x23 > kern_execve() at 0xffffffff8041cb47 = kern_execve+0x1277 > sys_execve() at 0xffffffff8041ce6d = sys_execve+0x3d > amd64_syscall() at 0xffffffff806c6319 = amd64_syscall+0x299 > Xfast_syscall() at 0xffffffff806b16b7 = Xfast_syscall+0xf7 > --- syscall (59, FreeBSD ELF64, sys_execve), rip = 0x800d4cbec, rsp = > 0x7fffffffd1a8, rbp = 0x8014124a0 --- > > I've not experienced anything like this, and I can't really see a direct connection between the above crash and the change. So, the only thing that I can suggest is reverting one piece of the change at a time. Please try this first: Index: vm/vm_phys.c =================================================================== --- vm/vm_phys.c (revision 226968) +++ vm/vm_phys.c (working copy) @@ -758,7 +758,6 @@ vm_phys_alloc_contig(u_long npages, vm_paddr_t low struct vnode *vp; vm_paddr_t pa, pa_last, size; vm_page_t deferred_vdrop_list, m, m_ret; - u_long npages_end; int domain, flind, i, oind, order, pind; #if VM_NDOMAIN > 1 @@ -871,10 +870,13 @@ done: deferred_vdrop_list = m; } } - /* Return excess pages to the free lists. */ - npages_end = roundup2(npages, 1 << imin(oind, order)); - if (npages < npages_end) - vm_phys_free_contig(&m_ret[npages], npages_end - npages); + for (; i < roundup2(npages, 1 << imin(oind, order)); i++) { + m = &m_ret[i]; + KASSERT(m->order == VM_NFREEORDER, + ("vm_phys_alloc_contig: page %p has unexpected order %d", + m, m->order)); + vm_phys_free_pages(m, 0); + } mtx_unlock(&vm_page_queue_free_mtx); while (deferred_vdrop_list != NULL) { vdrop((struct vnode *)deferred_vdrop_list->pageq.tqe_prev); From owner-svn-src-head@FreeBSD.ORG Mon Oct 31 17:37:30 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0EB8F1065677 for ; Mon, 31 Oct 2011 17:37:30 +0000 (UTC) (envelope-from pho@holm.cc) Received: from relay00.pair.com (relay00.pair.com [209.68.5.9]) by mx1.freebsd.org (Postfix) with SMTP id BC7A88FC0A for ; Mon, 31 Oct 2011 17:37:29 +0000 (UTC) Received: (qmail 488 invoked from network); 31 Oct 2011 17:10:45 -0000 Received: from 87.58.144.241 (HELO x2.osted.lan) (87.58.144.241) by relay00.pair.com with SMTP; 31 Oct 2011 17:10:45 -0000 X-pair-Authenticated: 87.58.144.241 Received: from x2.osted.lan (localhost [127.0.0.1]) by x2.osted.lan (8.14.4/8.14.4) with ESMTP id p9VHAhBJ029715; Mon, 31 Oct 2011 18:10:43 +0100 (CET) (envelope-from pho@x2.osted.lan) Received: (from pho@localhost) by x2.osted.lan (8.14.4/8.14.4/Submit) id p9VHAh2U029714; Mon, 31 Oct 2011 18:10:43 +0100 (CET) (envelope-from pho) Date: Mon, 31 Oct 2011 18:10:43 +0100 From: Peter Holm To: John Baldwin Message-ID: <20111031171043.GB29244@x2.osted.lan> References: <201110311501.p9VF1lrf020688@svn.freebsd.org> <201110311241.42067.jhb@freebsd.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201110311241.42067.jhb@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: r226967 - 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, 31 Oct 2011 17:37:30 -0000 On Mon, Oct 31, 2011 at 12:41:41PM -0400, John Baldwin wrote: > On Monday, October 31, 2011 11:01:47 am Peter Holm wrote: > > Author: pho > > Date: Mon Oct 31 15:01:47 2011 > > New Revision: 226967 > > URL: http://svn.freebsd.org/changeset/base/226967 > > > > Log: > > The kern_renameat() looks up the fvp using the DELETE flag, which causes > > the removal of the name cache entry for fvp. > > > > Reported by: Anton Yuzhaninov > > In collaboration with: kib > > MFC after: 1 week > > Hmm, the log message doesn't seem to quite match the change? Was it > truncated? > No, it was a misunderstanding on my part. The log message should have read: "Added missing cache purge of from argument." - Peter > > Modified: > > head/sys/ufs/ufs/ufs_vnops.c > > > > Modified: head/sys/ufs/ufs/ufs_vnops.c > > > ============================================================================== > > --- head/sys/ufs/ufs/ufs_vnops.c Mon Oct 31 10:53:27 2011 (r226966) > > +++ head/sys/ufs/ufs/ufs_vnops.c Mon Oct 31 15:01:47 2011 (r226967) > > @@ -1519,6 +1519,13 @@ relock: > > cache_purge(fdvp); > > } > > error = ufs_dirremove(fdvp, fip, fcnp->cn_flags, 0); > > + /* > > + * As the relookup of the fvp is done in two steps: > > + * ufs_lookup_ino() and then VFS_VGET(), another thread might do a > > + * normal lookup of the from name just before the VFS_VGET() call, > > + * causing the cache entry to be re-instantiated. > > + */ > > + cache_purge(fvp); > > > > unlockout: > > vput(fdvp); > > > > -- > John Baldwin From owner-svn-src-head@FreeBSD.ORG Mon Oct 31 19:42:38 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx2.freebsd.org (mx2.freebsd.org [IPv6:2001:4f8:fff6::35]) by hub.freebsd.org (Postfix) with ESMTP id 8B912106564A; Mon, 31 Oct 2011 19:42:38 +0000 (UTC) (envelope-from dougb@FreeBSD.org) Received: from 172-17-198-245.globalsuite.net (hub.freebsd.org [IPv6:2001:4f8:fff6::36]) by mx2.freebsd.org (Postfix) with ESMTP id F045C162D75; Mon, 31 Oct 2011 19:42:37 +0000 (UTC) Message-ID: <4EAEFA2D.7090607@FreeBSD.org> Date: Mon, 31 Oct 2011 12:42:37 -0700 From: Doug Barton Organization: http://SupersetSolutions.com/ User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:7.0.1) Gecko/20111001 Thunderbird/7.0.1 MIME-Version: 1.0 To: Peter Holm References: <201110311501.p9VF1lrf020688@svn.freebsd.org> <201110311241.42067.jhb@freebsd.org> <20111031171043.GB29244@x2.osted.lan> In-Reply-To: <20111031171043.GB29244@x2.osted.lan> X-Enigmail-Version: undefined OpenPGP: id=1A1ABC84 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, John Baldwin Subject: Re: svn commit: r226967 - 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, 31 Oct 2011 19:42:38 -0000 On 10/31/2011 10:10, Peter Holm wrote: > No, it was a misunderstanding on my part. > > The log message should have read: > "Added missing cache purge of from argument." So perhaps a forced commit? -- Nothin' ever doesn't change, but nothin' changes much. -- OK Go Breadth of IT experience, and depth of knowledge in the DNS. Yours for the right price. :) http://SupersetSolutions.com/ From owner-svn-src-head@FreeBSD.ORG Mon Oct 31 20:02:46 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id EB9E1106566C; Mon, 31 Oct 2011 20:02:45 +0000 (UTC) (envelope-from pluknet@gmail.com) Received: from mail-dy0-f54.google.com (mail-dy0-f54.google.com [209.85.220.54]) by mx1.freebsd.org (Postfix) with ESMTP id 08B1A8FC1F; Mon, 31 Oct 2011 20:02:44 +0000 (UTC) Received: by dye36 with SMTP id 36so345521dye.13 for ; Mon, 31 Oct 2011 13:02:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=ofHpF1or3Jl0ClSWNlLcrI64wYhQ6ms9EMneGIpkx14=; b=r1+85MYhjRz+mG3FDJuziyFzT/CtQuWmnKq1hEMpfRKG8vIFcZsFQOcrbaNYqTV4hd Y7M548DkpAXjx8Zdfuw2gFqV/xJVwBAsWP2HG+Hzyid7P9IhRP0tlNpKmrHQoV5xirqs 5ovKRDTNuzgAg+FpuSyvaywZKLJCLDPfmNkSM= MIME-Version: 1.0 Received: by 10.182.59.5 with SMTP id v5mr3184480obq.78.1320091362393; Mon, 31 Oct 2011 13:02:42 -0700 (PDT) Sender: pluknet@gmail.com Received: by 10.182.89.41 with HTTP; Mon, 31 Oct 2011 13:02:42 -0700 (PDT) In-Reply-To: <4EAED730.5080205@rice.edu> References: <201110300506.p9U56E3l049042@svn.freebsd.org> <4EAED730.5080205@rice.edu> Date: Mon, 31 Oct 2011 23:02:42 +0300 X-Google-Sender-Auth: R2jD6sHWC4-4lIAVcO_8Rz-GnLE Message-ID: From: Sergey Kandaurov To: Alan Cox Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Cc: Alan Cox , svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r226928 - head/sys/vm X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 31 Oct 2011 20:02:46 -0000 On 31 October 2011 21:13, Alan Cox wrote: > On 10/31/2011 11:33, Sergey Kandaurov wrote: >> >> On 30 October 2011 09:06, Alan Cox =A0wrote: >>> >>> Author: alc >>> Date: Sun Oct 30 05:06:14 2011 >>> New Revision: 226928 >>> URL: http://svn.freebsd.org/changeset/base/226928 >>> >>> Log: >>> =A0Eliminate vm_phys_bootstrap_alloc(). =A0It was a failed attempt at >>> =A0eliminating duplicated code in the various pmap implementations. >>> >>> =A0Micro-optimize vm_phys_free_pages(). >>> >>> =A0Introduce vm_phys_free_contig(). =A0It is fast routine for freeing a= n >>> =A0arbitrary number of physically contiguous pages. =A0In particular, i= t >>> =A0doesn't require the number of pages to be a power of two. >>> >>> =A0Use "u_long" instead of "unsigned long". >>> >>> =A0Bruce Evans (bde@) has convinced me that the "boundary" parameters >>> =A0to kmem_alloc_contig(), vm_phys_alloc_contig(), and >>> =A0vm_reserv_reclaim_contig() should be of type "vm_paddr_t" and not >>> =A0"u_long". =A0Make this change. >> >> Hello. >> >> After updating to this revision I constantly get random mtrash_ctor() >> assertions. [most often during make installkernel, otherwise idle.] >> >> Below is one of them (previous memory consumers in panicstr differ). >> >> Memory modified after free 0xfffffe0002700800(120) val=3D0 @ >> 0xfffffe0002700800 >> panic: Most recently used by proc-args >> >> cpuid =3D 1 >> KDB: stack backtrace: >> db_trace_self_wrapper() at 0xffffffff802e009a =3D db_trace_self_wrapper+= 0x2a >> kdb_backtrace() at 0xffffffff80486f17 =3D kdb_backtrace+0x37 >> panic() at 0xffffffff8044f87e =3D panic+0x2ee >> mtrash_ctor() at 0xffffffff8068c904 =3D mtrash_ctor+0x84 >> uma_zalloc_arg() at 0xffffffff8068c16c =3D uma_zalloc_arg+0x2dc >> malloc() at 0xffffffff8043abd6 =3D malloc+0xc6 >> pargs_alloc() at 0xffffffff804425d3 =3D pargs_alloc+0x23 >> kern_execve() at 0xffffffff8041cb47 =3D kern_execve+0x1277 >> sys_execve() at 0xffffffff8041ce6d =3D sys_execve+0x3d >> amd64_syscall() at 0xffffffff806c6319 =3D amd64_syscall+0x299 >> Xfast_syscall() at 0xffffffff806b16b7 =3D Xfast_syscall+0xf7 >> --- syscall (59, FreeBSD ELF64, sys_execve), rip =3D 0x800d4cbec, rsp = =3D >> 0x7fffffffd1a8, rbp =3D 0x8014124a0 --- >> >> > > I've not experienced anything like this, and I can't really see a direct > connection between the above crash and the change. =A0So, the only thing = that > I can suggest is reverting one piece of the change at a time. =A0Please t= ry > this first: > I'm sorry. It appears that was due to regression in my local changes which triggered coinciding with this revision. I just reproduced it without your change. Sorry for noise. --=20 wbr, pluknet From owner-svn-src-head@FreeBSD.ORG Mon Oct 31 20:24:33 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 839F01065670; Mon, 31 Oct 2011 20:24:33 +0000 (UTC) (envelope-from pho@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 731EF8FC12; Mon, 31 Oct 2011 20:24:33 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p9VKOXa3032796; Mon, 31 Oct 2011 20:24:33 GMT (envelope-from pho@svn.freebsd.org) Received: (from pho@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p9VKOXuR032794; Mon, 31 Oct 2011 20:24:33 GMT (envelope-from pho@svn.freebsd.org) Message-Id: <201110312024.p9VKOXuR032794@svn.freebsd.org> From: Peter Holm Date: Mon, 31 Oct 2011 20:24: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: r226971 - 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, 31 Oct 2011 20:24:33 -0000 Author: pho Date: Mon Oct 31 20:24:33 2011 New Revision: 226971 URL: http://svn.freebsd.org/changeset/base/226971 Log: Fix the wrong commit log message for r226967: "Added missing cache purge of from argument" and fix the comment. Modified: head/sys/ufs/ufs/ufs_vnops.c Modified: head/sys/ufs/ufs/ufs_vnops.c ============================================================================== --- head/sys/ufs/ufs/ufs_vnops.c Mon Oct 31 20:03:09 2011 (r226970) +++ head/sys/ufs/ufs/ufs_vnops.c Mon Oct 31 20:24:33 2011 (r226971) @@ -1520,6 +1520,8 @@ relock: } error = ufs_dirremove(fdvp, fip, fcnp->cn_flags, 0); /* + * The kern_renameat() looks up the fvp using the DELETE flag, which + * causes the removal of the name cache entry for fvp. * As the relookup of the fvp is done in two steps: * ufs_lookup_ino() and then VFS_VGET(), another thread might do a * normal lookup of the from name just before the VFS_VGET() call, From owner-svn-src-head@FreeBSD.ORG Mon Oct 31 20:30:43 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx2.freebsd.org (mx2.freebsd.org [IPv6:2001:4f8:fff6::35]) by hub.freebsd.org (Postfix) with ESMTP id 73F861065670; Mon, 31 Oct 2011 20:30:43 +0000 (UTC) (envelope-from dougb@FreeBSD.org) Received: from 172-17-198-245.globalsuite.net (hub.freebsd.org [IPv6:2001:4f8:fff6::36]) by mx2.freebsd.org (Postfix) with ESMTP id 333BC15F112; Mon, 31 Oct 2011 20:30:34 +0000 (UTC) Message-ID: <4EAF0569.7020207@FreeBSD.org> Date: Mon, 31 Oct 2011 13:30:33 -0700 From: Doug Barton Organization: http://SupersetSolutions.com/ User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:7.0.1) Gecko/20111001 Thunderbird/7.0.1 MIME-Version: 1.0 To: Peter Holm References: <201110312024.p9VKOXuR032794@svn.freebsd.org> In-Reply-To: <201110312024.p9VKOXuR032794@svn.freebsd.org> X-Enigmail-Version: undefined OpenPGP: id=1A1ABC84 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r226971 - 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, 31 Oct 2011 20:30:43 -0000 On 10/31/2011 13:24, Peter Holm wrote: > Fix the wrong commit log message for r226967 Awesome, thanks! -- Nothin' ever doesn't change, but nothin' changes much. -- OK Go Breadth of IT experience, and depth of knowledge in the DNS. Yours for the right price. :) http://SupersetSolutions.com/ From owner-svn-src-head@FreeBSD.ORG Tue Nov 1 01:28:33 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E80ED106566B; Tue, 1 Nov 2011 01:28:33 +0000 (UTC) (envelope-from peter@wemm.org) Received: from mail-vx0-f182.google.com (mail-vx0-f182.google.com [209.85.220.182]) by mx1.freebsd.org (Postfix) with ESMTP id 5C1858FC08; Tue, 1 Nov 2011 01:28:33 +0000 (UTC) Received: by vcbfk26 with SMTP id fk26so2234435vcb.13 for ; Mon, 31 Oct 2011 18:28:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=wemm.org; s=google; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=S58T6Os+VNQKrkoBKaXRLCKzdTNRfHUUBh69zHC+Z+s=; b=gArTEwXcDa2smqC+/QLJ+9XsyabQy41FRjphMQ234ssShMbaDni/IxYWgmePFS/P2x U8/1MF3FKG3PyvMyyJz9hRo7N9safsFOi8N1SWw8x/NCqEbrzc/SMsoDiIZzLZn2PFg4 fulnk1IGZsdBP3WdM/3YatwwbkseRqZPStWIM= MIME-Version: 1.0 Received: by 10.220.7.72 with SMTP id c8mr2438527vcc.149.1320109560873; Mon, 31 Oct 2011 18:06:00 -0700 (PDT) Received: by 10.221.13.130 with HTTP; Mon, 31 Oct 2011 18:06:00 -0700 (PDT) In-Reply-To: <4EAEFA2D.7090607@FreeBSD.org> References: <201110311501.p9VF1lrf020688@svn.freebsd.org> <201110311241.42067.jhb@freebsd.org> <20111031171043.GB29244@x2.osted.lan> <4EAEFA2D.7090607@FreeBSD.org> Date: Mon, 31 Oct 2011 18:06:00 -0700 Message-ID: From: Peter Wemm To: Doug Barton Content-Type: text/plain; charset=ISO-8859-1 Cc: svn-src-head@freebsd.org, Peter Holm , svn-src-all@freebsd.org, src-committers@freebsd.org, John Baldwin Subject: Re: svn commit: r226967 - 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, 01 Nov 2011 01:28:34 -0000 On Mon, Oct 31, 2011 at 12:42 PM, Doug Barton wrote: > On 10/31/2011 10:10, Peter Holm wrote: >> No, it was a misunderstanding on my part. >> >> The log message should have read: >> "Added missing cache purge of from argument." > > So perhaps a forced commit? No such thing anymore. -- 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 Nov 1 01:31:26 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A0235106564A; Tue, 1 Nov 2011 01:31:26 +0000 (UTC) (envelope-from delphij@delphij.net) Received: from anubis.delphij.net (anubis.delphij.net [IPv6:2001:470:1:117::25]) by mx1.freebsd.org (Postfix) with ESMTP id 8017F8FC18; Tue, 1 Nov 2011 01:31:26 +0000 (UTC) Received: from delta.delphij.net (drawbridge.ixsystems.com [206.40.55.65]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by anubis.delphij.net (Postfix) with ESMTPSA id 2A306F771; Mon, 31 Oct 2011 18:31:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=delphij.net; s=anubis; t=1320111086; bh=WjU4FjAxSWg6U1rRMDzDKJ5BnqN52B+z9gbDjXwaArY=; h=Message-ID:Date:From:Reply-To:MIME-Version:To:CC:Subject: References:In-Reply-To:Content-Type:Content-Transfer-Encoding; b=lIWtwgbZocihm8VHIQAhaknetF9w9Vzvx+UCDca24qWmibg3ys/C205hm/TvRdrUA 53x0ZAgDIznRpFJuVaGPzlGpYdGde1H6K//OCOZXcZQBBdbKtkZnaeIm6NBsDEkx6q 3y4Gw4lTPEJc2Av/h0MBqMRQKqnB8O1p+6gOCJnU= Message-ID: <4EAF4BEC.5000408@delphij.net> Date: Mon, 31 Oct 2011 18:31:24 -0700 From: Xin LI Organization: The FreeBSD Project MIME-Version: 1.0 To: Peter Wemm References: <201110311501.p9VF1lrf020688@svn.freebsd.org> <201110311241.42067.jhb@freebsd.org> <20111031171043.GB29244@x2.osted.lan> <4EAEFA2D.7090607@FreeBSD.org> In-Reply-To: OpenPGP: id=3FCA37C1; url=http://www.delphij.net/delphij.asc Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: Doug Barton , John Baldwin , Peter Holm , svn-src-all@freebsd.org, src-committers@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r226967 - head/sys/ufs/ufs X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: d@delphij.net List-Id: 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, 01 Nov 2011 01:31:26 -0000 -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA256 On 10/31/11 18:06, Peter Wemm wrote: > On Mon, Oct 31, 2011 at 12:42 PM, Doug Barton > wrote: >> On 10/31/2011 10:10, Peter Holm wrote: >>> No, it was a misunderstanding on my part. >>> >>> The log message should have read: "Added missing cache purge of >>> from argument." >> >> So perhaps a forced commit? > > No such thing anymore. I think it's a little bit tricky but still possible? (edit the file and add non-semantic change, for instance a blank line at the end) svn ci (enter commit message) ^Z <-- important (revert the files to previous state) fg and save. Cheers, - -- Xin LI https://www.delphij.net/ FreeBSD - The Power to Serve! Live free or die -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.18 (FreeBSD) iQEcBAEBCAAGBQJOr0vrAAoJEATO+BI/yjfB690H/2w16ovVzxvgwyIRF3eaZ8H3 GoXsyviUTJ0bnn8pCDba+aS/L6MyxQqOqC3Brl/i6X1/K9eKMvGsfUYRk4oZFimH g5vbsTLtvZlukRfnwyCRKSwyQk7utqtf1yx0Ae1HijVEkGKYQXDEYGdcQwZJb2aD eC8DU0sUjE2oR3/pymvrT9SHOId/5LHZTof7f3wQHEtaXCstkbHuiqsCIhO2UgAE Y+YwEJ1BEZmM8jbI04TQmpOjtddBIRfLIdEbl3pEoQDEhHPKBRHSFK7vTUyT9LFR KDQWm0OFhbL3OekSDKM/clMPvhTUz0kj+2aN+VD6wkU8kaBg10+YrNIz0+B2lgs= =DymR -----END PGP SIGNATURE----- From owner-svn-src-head@FreeBSD.ORG Tue Nov 1 02:01:55 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9D12D1065675; Tue, 1 Nov 2011 02:01:55 +0000 (UTC) (envelope-from edwin@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 8BCE78FC16; Tue, 1 Nov 2011 02:01:55 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pA121tga043433; Tue, 1 Nov 2011 02:01:55 GMT (envelope-from edwin@svn.freebsd.org) Received: (from edwin@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pA121t41043427; Tue, 1 Nov 2011 02:01:55 GMT (envelope-from edwin@svn.freebsd.org) Message-Id: <201111010201.pA121t41043427@svn.freebsd.org> From: Edwin Groothuis Date: Tue, 1 Nov 2011 02:01: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: r226976 - head/contrib/tzdata X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 01 Nov 2011 02:01:55 -0000 Author: edwin Date: Tue Nov 1 02:01:55 2011 New Revision: 226976 URL: http://svn.freebsd.org/changeset/base/226976 Log: MFV of r226974, tzdata2011n - Fiji will end DST on 22 January 2012. - Moldova split into two timezones has been cancelled. - Cuba will end DST on 13 November 2011 Obtained from: ftp://ftp.iana.org/tz/releases/ Modified: head/contrib/tzdata/australasia head/contrib/tzdata/backward head/contrib/tzdata/europe head/contrib/tzdata/northamerica head/contrib/tzdata/zone.tab Directory Properties: head/contrib/tzdata/ (props changed) Modified: head/contrib/tzdata/australasia ============================================================================== --- head/contrib/tzdata/australasia Tue Nov 1 01:34:54 2011 (r226975) +++ head/contrib/tzdata/australasia Tue Nov 1 02:01:55 2011 (r226976) @@ -1,5 +1,5 @@ #
-# @(#)australasia	8.28
+# @(#)australasia	8.29
 # This file is in the public domain, so clarified as of
 # 2009-05-17 by Arthur David Olson.
 
@@ -308,6 +308,20 @@ Zone	Indian/Cocos	6:27:40	-	LMT	1900
 # advance at 2am to 3am on October 23, 2011 and one hour back at 3am to 
 # 2am on February 26 next year.
 
+# From Ken Rylander (2011-10-24)
+# Another change to the Fiji DST end date. In the TZ database the end date for
+# Fiji DST 2012, is currently Feb 26. This has been changed to Jan 22.
+#
+# 
+# http://www.fiji.gov.fj/index.php?option=com_content&view=article&id=5017:amendments-to-daylight-savings&catid=71:press-releases&Itemid=155
+# 
+# states:
+#
+# The end of daylight saving scheduled initially for the 26th of February 2012
+# has been brought forward to the 22nd of January 2012.
+# The commencement of daylight saving will remain unchanged and start
+# on the  23rd of October, 2011.
+
 # Rule	NAME	FROM	TO	TYPE	IN	ON	AT	SAVE	LETTER/S
 Rule	Fiji	1998	1999	-	Nov	Sun>=1	2:00	1:00	S
 Rule	Fiji	1999	2000	-	Feb	lastSun	3:00	0	-
@@ -316,7 +330,7 @@ Rule	Fiji	2010	only	-	Mar	lastSun	3:00	0
 Rule	Fiji	2010	only	-	Oct	24	2:00	1:00	S
 Rule	Fiji	2011	only	-	Mar	Sun>=1	3:00	0	-
 Rule	Fiji	2011	only	-	Oct	23	2:00	1:00	S
-Rule	Fiji	2012	only	-	Feb	26	3:00	0	-
+Rule	Fiji	2012	only	-	Jan	22	3:00	0	-
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
 Zone	Pacific/Fiji	11:53:40 -	LMT	1915 Oct 26	# Suva
 			12:00	Fiji	FJ%sT	# Fiji Time

Modified: head/contrib/tzdata/backward
==============================================================================
--- head/contrib/tzdata/backward	Tue Nov  1 01:34:54 2011	(r226975)
+++ head/contrib/tzdata/backward	Tue Nov  1 02:01:55 2011	(r226976)
@@ -1,5 +1,5 @@
 # 
-# @(#)backward	8.10
+# @(#)backward	8.11
 # This file is in the public domain, so clarified as of
 # 2009-05-17 by Arthur David Olson.
 
@@ -67,6 +67,7 @@ Link	America/Havana		Cuba
 Link	Africa/Cairo		Egypt
 Link	Europe/Dublin		Eire
 Link	Europe/London		Europe/Belfast
+Link	Europe/Chisinau		Europe/Tiraspol
 Link	Europe/London		GB
 Link	Europe/London		GB-Eire
 Link	Etc/GMT			GMT+0

Modified: head/contrib/tzdata/europe
==============================================================================
--- head/contrib/tzdata/europe	Tue Nov  1 01:34:54 2011	(r226975)
+++ head/contrib/tzdata/europe	Tue Nov  1 02:01:55 2011	(r226976)
@@ -1,5 +1,5 @@
 # 
-# @(#)europe	8.39
+# @(#)europe	8.40
 # This file is in the public domain, so clarified as of
 # 2009-05-17 by Arthur David Olson.
 
@@ -1678,6 +1678,18 @@ Zone	Europe/Malta	0:58:04 -	LMT	1893 Nov
 # a pre-1880 LMT offset of 1:58:32.
 #
 # (which agrees with the earlier entry that had been removed)
+#
+# From Alexander Krivenyshev (2011-10-26)
+# NO need to divide Moldova into two timezones at this point.
+# As of today, Transnistria (Pridnestrovie)- Tiraspol reversed its own
+# decision to abolish DST this winter. 
+# Following Moldova and neighboring Ukraine- Transnistria (Pridnestrovie)-
+# Tiraspol will go back to winter time on October 30, 2011.
+# News from Moldova (in russian):
+# 
+# http://ru.publika.md/link_317061.html
+# 
+
 
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
 Zone	Europe/Chisinau	1:55:20 -	LMT	1880
@@ -1694,21 +1706,6 @@ Zone	Europe/Chisinau	1:55:20 -	LMT	1880
 # See Romania commentary for the guessed 1997 transition to EU rules.
 			2:00	EU	EE%sT
 
-Zone	Europe/Tiraspol	1:58:32 -	LMT	1880
-			1:55	-	CMT	1918 Feb 15 # Chisinau MT
-			1:44:24	-	BMT	1931 Jul 24 # Bucharest MT
-			2:00	Romania	EE%sT	1940 Aug 15
-			2:00	1:00	EEST	1941 Jul 17
-			1:00	C-Eur	CE%sT	1944 Aug 24
-			3:00	Russia	MSK/MSD	1990
-			3:00	-	MSK	1990 May 6
-			2:00	-	EET	1991
-			2:00	Russia	EE%sT	1992
-			2:00	E-Eur	EE%sT	1997
-# See Romania commentary for the guessed 1997 transition to EU rules.
-			2:00	EU	EE%sT	2011 Mar lastSun 1:00u
-			3:00	-	FET # Further-eastern European Time
-
 # Monaco
 # Shanks & Pottenger give 0:09:20 for Paris Mean Time; go with Howse's
 # more precise 0:09:21.

Modified: head/contrib/tzdata/northamerica
==============================================================================
--- head/contrib/tzdata/northamerica	Tue Nov  1 01:34:54 2011	(r226975)
+++ head/contrib/tzdata/northamerica	Tue Nov  1 02:01:55 2011	(r226976)
@@ -1,5 +1,5 @@
 # 
-# @(#)northamerica	8.50
+# @(#)northamerica	8.51
 # This file is in the public domain, so clarified as of
 # 2009-05-17 by Arthur David Olson.
 
@@ -2690,6 +2690,20 @@ Zone America/Costa_Rica	-5:36:20 -	LMT	1
 # 
 # http://www.timeanddate.com/news/time/cuba-starts-dst-2011.html
 # 
+#
+# From Steffen Thorsen (2011-10-30)
+# Cuba will end DST two weeks later this year. Instead of going back 
+# tonight, it has been delayed to 2011-11-13 at 01:00.
+#
+# One source (Spanish)
+# 
+# http://www.radioangulo.cu/noticias/cuba/17105-cuba-restablecera-el-horario-del-meridiano-de-greenwich.html
+# 
+#
+# Our page:
+# 
+# http://www.timeanddate.com/news/time/cuba-time-changes-2011.html
+# 
 
 # Rule	NAME	FROM	TO	TYPE	IN	ON	AT	SAVE	LETTER/S
 Rule	Cuba	1928	only	-	Jun	10	0:00	1:00	D
@@ -2721,12 +2735,14 @@ Rule	Cuba	1997	only	-	Oct	12	0:00s	0	S
 Rule	Cuba	1998	1999	-	Mar	lastSun	0:00s	1:00	D
 Rule	Cuba	1998	2003	-	Oct	lastSun	0:00s	0	S
 Rule	Cuba	2000	2004	-	Apr	Sun>=1	0:00s	1:00	D
-Rule	Cuba	2006	max	-	Oct	lastSun	0:00s	0	S
+Rule	Cuba	2006	2010	-	Oct	lastSun	0:00s	0	S
 Rule	Cuba	2007	only	-	Mar	Sun>=8	0:00s	1:00	D
 Rule	Cuba	2008	only	-	Mar	Sun>=15	0:00s	1:00	D
 Rule	Cuba	2009	2010	-	Mar	Sun>=8	0:00s	1:00	D
 Rule	Cuba	2011	only	-	Mar	Sun>=15	0:00s	1:00	D
+Rule	Cuba	2011	only	-	Nov	13	0:00s	0	S
 Rule	Cuba	2012	max	-	Mar	Sun>=8	0:00s	1:00	D
+Rule	Cuba	2012	max	-	Oct	lastSun	0:00s	0	S
 
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
 Zone	America/Havana	-5:29:28 -	LMT	1890

Modified: head/contrib/tzdata/zone.tab
==============================================================================
--- head/contrib/tzdata/zone.tab	Tue Nov  1 01:34:54 2011	(r226975)
+++ head/contrib/tzdata/zone.tab	Tue Nov  1 02:01:55 2011	(r226976)
@@ -1,5 +1,5 @@
 # 
-# @(#)zone.tab	8.50
+# @(#)zone.tab	8.52
 # This file is in the public domain, so clarified as of
 # 2009-05-17 by Arthur David Olson.
 #
@@ -257,8 +257,7 @@ LV	+5657+02406	Europe/Riga
 LY	+3254+01311	Africa/Tripoli
 MA	+3339-00735	Africa/Casablanca
 MC	+4342+00723	Europe/Monaco
-MD	+4700+02850	Europe/Chisinau	most locations
-MD	+4651+02938	Europe/Tiraspol	Pridnestrovie
+MD	+4700+02850	Europe/Chisinau
 ME	+4226+01916	Europe/Podgorica
 MF	+1804-06305	America/Marigot
 MG	-1855+04731	Indian/Antananarivo

From owner-svn-src-head@FreeBSD.ORG  Tue Nov  1 02:07:43 2011
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: by hub.freebsd.org (Postfix, from userid 1033)
	id 615E11065677; Tue,  1 Nov 2011 02:07:43 +0000 (UTC)
Date: Tue, 1 Nov 2011 02:07:43 +0000
From: Alexey Dokuchaev 
To: Bruce Evans 
Message-ID: <20111101020743.GA14822@FreeBSD.org>
References: <201110302117.p9ULHgLD085245@svn.freebsd.org>
	<20111031042526.GA57014@FreeBSD.org>
	<20111031233854.Y1523@besplex.bde.org>
Mime-Version: 1.0
Content-Type: text/plain; charset=koi8-r
Content-Disposition: inline
In-Reply-To: <20111031233854.Y1523@besplex.bde.org>
User-Agent: Mutt/1.4.2.1i
Cc: svn-src-head@freebsd.org, Marius Strobl ,
	src-committers@freebsd.org, svn-src-all@freebsd.org
Subject: Re: svn commit: r226947 - in head/sys: dev/esp sparc64/sbus
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: 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, 01 Nov 2011 02:07:43 -0000

On Tue, Nov 01, 2011 at 12:01:16AM +1100, Bruce Evans wrote:
> On Mon, 31 Oct 2011, Alexey Dokuchaev wrote:
> >   When convention requires a typedef, make its name match the struct tag.
> >   Avoid typedefs ending in _t, except as specified in Standard C or by
> >   POSIX.
> >
> > Do these rules not apply for struct device for some reason?
> 
> Yes (they don't apply here).  device_t is one of a few properly opaque
> typedefs for struct pointers.  'struct device' is only (completely)
> declared in kern/subr_bus.c.  Thus the implementation details of it
> obviously cannot escape to drivers.  Most of the APIs in 
> are supposed to be like this.  But `typedef struct kobj_class driver_t'
> and `#define driver_method_t kobj_method_t' are gross exceptions.
>  has to include  for dereferencing these, and
> kobj.h breaks the rule by providing both typedefs for struct pointers
> and complete struct declarations.

Thanks for detailed explanation Bruce.

./danfe

From owner-svn-src-head@FreeBSD.ORG  Tue Nov  1 08:57:49 2011
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 93EAB106566B;
	Tue,  1 Nov 2011 08:57: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 840A88FC13;
	Tue,  1 Nov 2011 08:57:49 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pA18vnAr057516;
	Tue, 1 Nov 2011 08:57:49 GMT (envelope-from mav@svn.freebsd.org)
Received: (from mav@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id pA18vnjm057514;
	Tue, 1 Nov 2011 08:57:49 GMT (envelope-from mav@svn.freebsd.org)
Message-Id: <201111010857.pA18vnjm057514@svn.freebsd.org>
From: Alexander Motin 
Date: Tue, 1 Nov 2011 08:57:49 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r226985 - 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: Tue, 01 Nov 2011 08:57:49 -0000

Author: mav
Date: Tue Nov  1 08:57:49 2011
New Revision: 226985
URL: http://svn.freebsd.org/changeset/base/226985

Log:
  Workaround the problem introduced by combination of r162200 and r215687.
  r162200 delays provider orphanization until all running requests complete,
  to workaround broken orphan() method implementation in some classes.
  r215687 removes persistent periodic (10Hz) event thread wake ups.
  Together these changes can indefinitely delay orphanization until some
  other event wake up the event thread. One consequence of this is inability
  of CAM to destroy device disconnected when busy and, as consequence, create
  new one after reconnection.
  
  While the best solution would be to revert r162200, it is not easy, as
  some classes still look broken in that way. Instead conditionally wake up
  event thread if there are some providers waiting for orphanization.
  
  MFC after:	1 week

Modified:
  head/sys/geom/geom_event.c

Modified: head/sys/geom/geom_event.c
==============================================================================
--- head/sys/geom/geom_event.c	Tue Nov  1 08:24:01 2011	(r226984)
+++ head/sys/geom/geom_event.c	Tue Nov  1 08:57:49 2011	(r226985)
@@ -294,7 +294,7 @@ g_run_events()
 		} else {
 			g_topology_unlock();
 			msleep(&g_wait_event, &g_eventlock, PRIBIO | PDROP,
-			    "-", 0);
+			    "-", TAILQ_EMPTY(&g_doorstep) ? 0 : hz / 10);
 		}
 	}
 	/* NOTREACHED */

From owner-svn-src-head@FreeBSD.ORG  Tue Nov  1 09:28:48 2011
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 3372E106564A;
	Tue,  1 Nov 2011 09:28:48 +0000 (UTC)
	(envelope-from fabient@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 2360E8FC0A;
	Tue,  1 Nov 2011 09:28:48 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pA19SmvN058459;
	Tue, 1 Nov 2011 09:28:48 GMT (envelope-from fabient@svn.freebsd.org)
Received: (from fabient@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id pA19SmSP058457;
	Tue, 1 Nov 2011 09:28:48 GMT (envelope-from fabient@svn.freebsd.org)
Message-Id: <201111010928.pA19SmSP058457@svn.freebsd.org>
From: Fabien Thomas 
Date: Tue, 1 Nov 2011 09:28: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: r226986 - head/usr.sbin/pmcstat
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Tue, 01 Nov 2011 09:28:48 -0000

Author: fabient
Date: Tue Nov  1 09:28:47 2011
New Revision: 226986
URL: http://svn.freebsd.org/changeset/base/226986

Log:
  Two bugs fixed:
  - Do not close stdout or stderr when redirecting to file.
  - Correctly handle error code to detect when no buffer available.
  
  MFC after:	1 month

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

Modified: head/usr.sbin/pmcstat/pmcstat.c
==============================================================================
--- head/usr.sbin/pmcstat/pmcstat.c	Tue Nov  1 08:57:49 2011	(r226985)
+++ head/usr.sbin/pmcstat/pmcstat.c	Tue Nov  1 09:28:47 2011	(r226986)
@@ -796,7 +796,9 @@ main(int argc, char **argv)
 			break;
 
 		case 'o':	/* outputfile */
-			if (args.pa_printfile != NULL)
+			if (args.pa_printfile != NULL &&
+			    args.pa_printfile != stdout &&
+			    args.pa_printfile != stderr)
 				(void) fclose(args.pa_printfile);
 			if ((args.pa_printfile = fopen(optarg, "w")) == NULL)
 				errx(EX_OSERR, "ERROR: cannot open \"%s\" for "
@@ -1394,7 +1396,7 @@ main(int argc, char **argv)
 
 		case EVFILT_TIMER: /* print out counting PMCs */
 			if ((args.pa_flags & FLAG_DO_TOP) &&
-			     pmc_flush_logfile() != ENOBUFS)
+			     pmc_flush_logfile() == 0)
 				do_read = 1;
 			do_print = 1;
 			break;

From owner-svn-src-head@FreeBSD.ORG  Tue Nov  1 12:33:06 2011
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id EF04E106564A;
	Tue,  1 Nov 2011 12:33:06 +0000 (UTC) (envelope-from pho@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id DF7618FC18;
	Tue,  1 Nov 2011 12:33:06 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pA1CX6wr067145;
	Tue, 1 Nov 2011 12:33:06 GMT (envelope-from pho@svn.freebsd.org)
Received: (from pho@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id pA1CX6BK067143;
	Tue, 1 Nov 2011 12:33:06 GMT (envelope-from pho@svn.freebsd.org)
Message-Id: <201111011233.pA1CX6BK067143@svn.freebsd.org>
From: Peter Holm 
Date: Tue, 1 Nov 2011 12:33:06 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r226987 - head/sys/fs/tmpfs
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: 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, 01 Nov 2011 12:33:07 -0000

Author: pho
Date: Tue Nov  1 12:33:06 2011
New Revision: 226987
URL: http://svn.freebsd.org/changeset/base/226987

Log:
  Added missing cache purge of from argument for rename().
  
  Reported by:	Anton Yuzhaninov 
  In collaboration with:	kib
  MFC after:	1 week

Modified:
  head/sys/fs/tmpfs/tmpfs_vnops.c

Modified: head/sys/fs/tmpfs/tmpfs_vnops.c
==============================================================================
--- head/sys/fs/tmpfs/tmpfs_vnops.c	Tue Nov  1 09:28:47 2011	(r226986)
+++ head/sys/fs/tmpfs/tmpfs_vnops.c	Tue Nov  1 12:33:06 2011	(r226987)
@@ -1138,6 +1138,7 @@ tmpfs_rename(struct vop_rename_args *v)
 		 * really reclaimed. */
 		tmpfs_free_dirent(VFS_TO_TMPFS(tvp->v_mount), de, TRUE);
 	}
+	cache_purge(fvp);
 
 	error = 0;
 

From owner-svn-src-head@FreeBSD.ORG  Tue Nov  1 16:14:00 2011
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 09D56106564A;
	Tue,  1 Nov 2011 16:14:00 +0000 (UTC)
	(envelope-from marius@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id EA9518FC08;
	Tue,  1 Nov 2011 16:13:59 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pA1GDxCI074237;
	Tue, 1 Nov 2011 16:13:59 GMT (envelope-from marius@svn.freebsd.org)
Received: (from marius@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id pA1GDxHQ074224;
	Tue, 1 Nov 2011 16:13:59 GMT (envelope-from marius@svn.freebsd.org)
Message-Id: <201111011613.pA1GDxHQ074224@svn.freebsd.org>
From: Marius Strobl 
Date: Tue, 1 Nov 2011 16:13: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: r226995 - in head/sys: arm/conf conf dev/bm dev/dc
	dev/mii dev/nge dev/sis dev/smc dev/ste dev/stge dev/tl
	dev/wb dev/xl modules/mii 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, 01 Nov 2011 16:14:00 -0000

Author: marius
Date: Tue Nov  1 16:13:59 2011
New Revision: 226995
URL: http://svn.freebsd.org/changeset/base/226995

Log:
  - Import the common MII bitbang'ing code from NetBSD and convert drivers to
    take advantage of it instead of duplicating it. This reduces the size of
    the i386 GENERIC kernel by about 4k. The only potential in-tree user left
    unconverted is xe(4), which generally should be changed to use miibus(4)
    instead of implementing PHY handling on its own, as otherwise it makes not
    much sense to add a dependency on miibus(4)/mii_bitbang(4) to xe(4) just
    for the MII bitbang'ing code. The common MII bitbang'ing code also is
    useful in the embedded space for using GPIO pins to implement MII access.
  - Based on lessons learnt with dc(4) (see r185750), add bus barriers to the
    MII bitbang read and write functions of the other drivers converted in
    order to ensure the intended ordering. Given that register access via an
    index register as well as register bank/window switching is subject to the
    same problem, also add bus barriers to the respective functions of smc(4),
    tl(4) and xl(4).
  - Sprinkle some const.
  
  Thanks to the following testers:
  Andrew Bliznak (nge(4)), nwhitehorn@ (bm(4)), yongari@ (sis(4) and ste(4))
  Thanks to Hans-Joerg Sirtl for supplying hardware to test stge(4).
  
  Reviewed by:	yongari (subset of drivers)
  Obtained from:	NetBSD (partially)

Added:
  head/sys/dev/mii/mii_bitbang.c   (contents, props changed)
  head/sys/dev/mii/mii_bitbang.h   (contents, props changed)
Modified:
  head/sys/arm/conf/GUMSTIX
  head/sys/conf/NOTES
  head/sys/conf/files
  head/sys/dev/bm/if_bm.c
  head/sys/dev/bm/if_bmreg.h
  head/sys/dev/bm/if_bmvar.h
  head/sys/dev/dc/if_dc.c
  head/sys/dev/dc/if_dcreg.h
  head/sys/dev/nge/if_nge.c
  head/sys/dev/nge/if_ngereg.h
  head/sys/dev/sis/if_sis.c
  head/sys/dev/sis/if_sisreg.h
  head/sys/dev/smc/if_smc.c
  head/sys/dev/ste/if_ste.c
  head/sys/dev/ste/if_stereg.h
  head/sys/dev/stge/if_stge.c
  head/sys/dev/stge/if_stgereg.h
  head/sys/dev/tl/if_tl.c
  head/sys/dev/tl/if_tlreg.h
  head/sys/dev/wb/if_wb.c
  head/sys/dev/wb/if_wbreg.h
  head/sys/dev/xl/if_xl.c
  head/sys/dev/xl/if_xlreg.h
  head/sys/modules/mii/Makefile
  head/sys/pci/if_rl.c
  head/sys/pci/if_rlreg.h

Modified: head/sys/arm/conf/GUMSTIX
==============================================================================
--- head/sys/arm/conf/GUMSTIX	Tue Nov  1 16:11:44 2011	(r226994)
+++ head/sys/arm/conf/GUMSTIX	Tue Nov  1 16:13:59 2011	(r226995)
@@ -70,6 +70,7 @@ options 	PREEMPTION
 device		loop
 device		ether
 device		mii
+device		mii_bitbang
 device		smc
 device		smcphy
 device		uart

Modified: head/sys/conf/NOTES
==============================================================================
--- head/sys/conf/NOTES	Tue Nov  1 16:11:44 2011	(r226994)
+++ head/sys/conf/NOTES	Tue Nov  1 16:13:59 2011	(r226995)
@@ -1846,13 +1846,15 @@ device		puc
 # MII bus support is required for many PCI Ethernet NICs,
 # namely those which use MII-compliant transceivers or implement
 # transceiver control interfaces that operate like an MII.  Adding
-# "device miibus" to the kernel config pulls in support for
-# the generic miibus API and all of the PHY drivers, including a
-# generic one for PHYs that aren't specifically handled by an
-# individual driver.  Support for specific PHYs may be built by adding
-# "device mii" then adding the appropriate PHY driver.
-device  	miibus		# MII support including all PHYs
+# "device miibus" to the kernel config pulls in support for the generic
+# miibus API, the common support for for bit-bang'ing the MII and all
+# of the PHY drivers, including a generic one for PHYs that aren't
+# specifically handled by an individual driver.  Support for specific
+# PHYs may be built by adding "device mii", "device mii_bitbang" if
+# needed by the NIC driver and then adding the appropriate PHY driver.
 device  	mii		# Minimal MII support
+device  	mii_bitbang	# Common module for bit-bang'ing the MII
+device  	miibus		# MII support w/ bit-bang'ing and all PHYs
 
 device  	acphy		# Altima Communications AC101
 device  	amphy		# AMD AM79c873 / Davicom DM910{1,2}

Modified: head/sys/conf/files
==============================================================================
--- head/sys/conf/files	Tue Nov  1 16:11:44 2011	(r226994)
+++ head/sys/conf/files	Tue Nov  1 16:13:59 2011	(r226995)
@@ -1425,6 +1425,7 @@ dev/mii/ip1000phy.c		optional miibus | i
 dev/mii/jmphy.c			optional miibus | jmphy
 dev/mii/lxtphy.c		optional miibus | lxtphy
 dev/mii/mii.c			optional miibus | mii
+dev/mii/mii_bitbang.c		optional miibus | mii_bitbang
 dev/mii/mii_physubr.c		optional miibus | mii
 dev/mii/miibus_if.m		optional miibus | mii
 dev/mii/mlphy.c			optional miibus | mlphy

Modified: head/sys/dev/bm/if_bm.c
==============================================================================
--- head/sys/dev/bm/if_bm.c	Tue Nov  1 16:11:44 2011	(r226994)
+++ head/sys/dev/bm/if_bm.c	Tue Nov  1 16:13:59 2011	(r226995)
@@ -63,6 +63,7 @@ __FBSDID("$FreeBSD$");
 #include 
 
 #include 
+#include 
 #include 
 
 #include 
@@ -105,17 +106,28 @@ static void bm_tick		(void *xsc);
 static int bm_ifmedia_upd	(struct ifnet *);
 static void bm_ifmedia_sts	(struct ifnet *, struct ifmediareq *);
 
-static void bm_miicsr_dwrite	(struct bm_softc *, u_int16_t);
-static void bm_mii_writebit	(struct bm_softc *, int);
-static int bm_mii_readbit	(struct bm_softc *);
-static void bm_mii_sync		(struct bm_softc *);
-static void bm_mii_send		(struct bm_softc *, u_int32_t, int);
-static int bm_mii_readreg	(struct bm_softc *, struct bm_mii_frame *);
-static int bm_mii_writereg	(struct bm_softc *, struct bm_mii_frame *);
 static int bm_miibus_readreg	(device_t, int, int);
 static int bm_miibus_writereg	(device_t, int, int, int);
 static void bm_miibus_statchg	(device_t);
 
+/*
+ * MII bit-bang glue
+ */
+static uint32_t bm_mii_bitbang_read(device_t);
+static void bm_mii_bitbang_write(device_t, uint32_t);
+
+static const struct mii_bitbang_ops bm_mii_bitbang_ops = {
+	bm_mii_bitbang_read,
+	bm_mii_bitbang_write,
+	{
+		BM_MII_DATAOUT,	/* MII_BIT_MDO */
+		BM_MII_DATAIN,	/* MII_BIT_MDI */
+		BM_MII_CLK,	/* MII_BIT_MDC */
+		BM_MII_OENABLE,	/* MII_BIT_DIR_HOST_PHY */
+		0,		/* MII_BIT_DIR_PHY_HOST */
+	}
+};
+
 static device_method_t bm_methods[] = {
 	/* Device interface */
 	DEVMETHOD(device_probe,		bm_probe),
@@ -150,171 +162,36 @@ DRIVER_MODULE(miibus, bm, miibus_driver,
  */
 
 /*
- * Write to the MII csr, introducing a delay to allow valid
- * MII clock pulses to be formed
- */
-static void
-bm_miicsr_dwrite(struct bm_softc *sc, u_int16_t val)
-{
-	CSR_WRITE_2(sc, BM_MII_CSR, val);
-	/*
-	 * Assume this is a clock toggle and generate a 1us delay
-	 * to cover both MII's 160ns high/low minimum and 400ns
-	 * cycle miniumum
-	 */
-	DELAY(1);
-}
-
-/*
- * Write a bit to the MII bus.
- */
-static void
-bm_mii_writebit(struct bm_softc *sc, int bit)
-{
-	u_int16_t regval;
-
-	regval = BM_MII_OENABLE;
-	if (bit)
-		regval |= BM_MII_DATAOUT;
-
-	bm_miicsr_dwrite(sc, regval);
-	bm_miicsr_dwrite(sc, regval | BM_MII_CLK);
-	bm_miicsr_dwrite(sc, regval);
-}
-
-/*
- * Read a bit from the MII bus.
- */
-static int
-bm_mii_readbit(struct bm_softc *sc)
-{
-	u_int16_t regval, bitin;
-
-	/* ~BM_MII_OENABLE */
-	regval = 0;
-
-	bm_miicsr_dwrite(sc, regval);
-	bm_miicsr_dwrite(sc, regval | BM_MII_CLK);
-	bm_miicsr_dwrite(sc, regval);
-	bitin = CSR_READ_2(sc, BM_MII_CSR) & BM_MII_DATAIN;
-
-	return (bitin == BM_MII_DATAIN);
-}
-
-/*
- * Sync the PHYs by setting data bit and strobing the clock 32 times.
+ * Write the MII serial port for the MII bit-bang module.
  */
 static void
-bm_mii_sync(struct bm_softc *sc)
+bm_mii_bitbang_write(device_t dev, uint32_t val)
 {
-	int i;
-	u_int16_t regval;
-
-	regval = BM_MII_OENABLE | BM_MII_DATAOUT;
-
-	bm_miicsr_dwrite(sc, regval);
-	for (i = 0; i < 32; i++) {
-		bm_miicsr_dwrite(sc, regval | BM_MII_CLK);
-		bm_miicsr_dwrite(sc, regval);
-	}
-}
-
-/*
- * Clock a series of bits through the MII.
- */
-static void
-bm_mii_send(struct bm_softc *sc, u_int32_t bits, int cnt)
-{
-	int i;
-
-	for (i = (0x1 << (cnt - 1)); i; i >>= 1)
-		bm_mii_writebit(sc, bits & i);
-}
-
-/*
- * Read a PHY register through the MII.
- */
-static int
-bm_mii_readreg(struct bm_softc *sc, struct bm_mii_frame *frame)
-{
-	int i, ack, bit;
-
-	/*
-	 * Set up frame for RX.
-	 */
-	frame->mii_stdelim = BM_MII_STARTDELIM;
-	frame->mii_opcode = BM_MII_READOP;
-	frame->mii_turnaround = 0;
-	frame->mii_data = 0;
-
-	/*
-	 * Sync the PHYs
-	 */
-	bm_mii_sync(sc);
-
-	/*
-	 * Send command/address info
-	 */
-	bm_mii_send(sc, frame->mii_stdelim, 2);
-	bm_mii_send(sc, frame->mii_opcode, 2);
-	bm_mii_send(sc, frame->mii_phyaddr, 5);
-	bm_mii_send(sc, frame->mii_regaddr, 5);
-
-	/*
-	 * Check for ack.
-	 */
-	ack = bm_mii_readbit(sc);
-
-	/*
-	 * Now try reading data bits. If the ack failed, we still
-	 * need to clock through 16 cycles to keep the PHY(s) in sync.
-	 */
-	for (i = 0x8000; i; i >>= 1) {
-		bit = bm_mii_readbit(sc);
-		if (!ack && bit)
-			frame->mii_data |= i;
-	}
+	struct bm_softc *sc;
 
-	/*
-	 * Skip through idle bit-times
-	 */
-	bm_mii_writebit(sc, 0);
-	bm_mii_writebit(sc, 0);
+	sc = device_get_softc(dev);
 
-	return ((ack) ? 1 : 0);
+	CSR_WRITE_2(sc, BM_MII_CSR, val);
+	CSR_BARRIER(sc, BM_MII_CSR, 2,
+	    BUS_SPACE_BARRIER_READ | BUS_SPACE_BARRIER_WRITE);
 }
 
 /*
- * Write to a PHY register through the MII.
+ * Read the MII serial port for the MII bit-bang module.
  */
-static int
-bm_mii_writereg(struct bm_softc *sc, struct bm_mii_frame *frame)
+static uint32_t
+bm_mii_bitbang_read(device_t dev)
 {
-	/*
-	 * Set up frame for tx
-	 */
-	frame->mii_stdelim = BM_MII_STARTDELIM;
-	frame->mii_opcode = BM_MII_WRITEOP;
-	frame->mii_turnaround = BM_MII_TURNAROUND;
-
-	/*
-	 * Sync the phy and start the bitbang write sequence
-	 */
-	bm_mii_sync(sc);
+	struct bm_softc *sc;
+	uint32_t reg;
 
-	bm_mii_send(sc, frame->mii_stdelim, 2);
-	bm_mii_send(sc, frame->mii_opcode, 2);
-	bm_mii_send(sc, frame->mii_phyaddr, 5);
-	bm_mii_send(sc, frame->mii_regaddr, 5);
-	bm_mii_send(sc, frame->mii_turnaround, 2);
-	bm_mii_send(sc, frame->mii_data, 16);
+	sc = device_get_softc(dev);
 
-	/*
-	 * Idle bit.
-	 */
-	bm_mii_writebit(sc, 0);
+	reg = CSR_READ_2(sc, BM_MII_CSR);
+	CSR_BARRIER(sc, BM_MII_CSR, 2,
+	    BUS_SPACE_BARRIER_READ | BUS_SPACE_BARRIER_WRITE);
 
-	return (0);
+	return (reg);
 }
 
 /*
@@ -323,34 +200,15 @@ bm_mii_writereg(struct bm_softc *sc, str
 static int
 bm_miibus_readreg(device_t dev, int phy, int reg)
 {
-	struct bm_softc *sc;
-	struct bm_mii_frame frame;
-
-	sc = device_get_softc(dev);
-	bzero(&frame, sizeof(frame));
-
-	frame.mii_phyaddr = phy;
-	frame.mii_regaddr = reg;
 
-	bm_mii_readreg(sc, &frame);
-
-	return (frame.mii_data);
+	return (mii_bitbang_readreg(dev, &bm_mii_bitbang_ops, phy, reg));
 }
 
 static int
 bm_miibus_writereg(device_t dev, int phy, int reg, int data)
 {
-	struct bm_softc *sc;
-	struct bm_mii_frame frame;
-
-	sc = device_get_softc(dev);
-	bzero(&frame, sizeof(frame));
-
-	frame.mii_phyaddr = phy;
-	frame.mii_regaddr = reg;
-	frame.mii_data = data;
 
-	bm_mii_writereg(sc, &frame);
+	mii_bitbang_readreg(dev, &bm_mii_bitbang_ops, phy, reg);
 
 	return (0);
 }

Modified: head/sys/dev/bm/if_bmreg.h
==============================================================================
--- head/sys/dev/bm/if_bmreg.h	Tue Nov  1 16:11:44 2011	(r226994)
+++ head/sys/dev/bm/if_bmreg.h	Tue Nov  1 16:13:59 2011	(r226995)
@@ -129,14 +129,6 @@
 #define BM_MII_DATAIN	0x0008		/* MDIO data in */
 
 /*
- * MII constants
- */
-#define BM_MII_STARTDELIM	0x01
-#define BM_MII_READOP		0x02
-#define BM_MII_WRITEOP		0x01
-#define BM_MII_TURNAROUND	0x02
-
-/*
  * Various flags
  */
 
@@ -174,3 +166,5 @@
 #define	CSR_READ_1(sc, reg)		\
 	bus_read_1(sc->sc_memr, reg)
 
+#define CSR_BARRIER(sc, reg, length, flags)				\
+	bus_barrier(sc->sc_memr, reg, length, flags)

Modified: head/sys/dev/bm/if_bmvar.h
==============================================================================
--- head/sys/dev/bm/if_bmvar.h	Tue Nov  1 16:11:44 2011	(r226994)
+++ head/sys/dev/bm/if_bmvar.h	Tue Nov  1 16:13:59 2011	(r226995)
@@ -46,7 +46,6 @@
 /*
  * software state for transmit job mbufs (may be elements of mbuf chains)
  */
-
 struct bm_txsoft {
 	struct mbuf *txs_mbuf;		/* head of our mbuf chain */
 	bus_dmamap_t txs_dmamap;	/* our DMA map */
@@ -71,7 +70,6 @@ struct bm_rxsoft {
 	bus_dma_segment_t segment;
 };
 
-
 struct bm_softc {
 	struct ifnet    	*sc_ifp;
 	struct mtx		sc_mtx;	
@@ -113,13 +111,3 @@ struct bm_softc {
 
 	dbdma_channel_t		*sc_txdma, *sc_rxdma;
 };
-
-struct bm_mii_frame {
-	u_int8_t		mii_stdelim;
-	u_int8_t		mii_opcode;
-	u_int8_t		mii_phyaddr;
-	u_int8_t		mii_regaddr;
-	u_int8_t		mii_turnaround;
-	u_int16_t		mii_data;
-};
-

Modified: head/sys/dev/dc/if_dc.c
==============================================================================
--- head/sys/dev/dc/if_dc.c	Tue Nov  1 16:11:44 2011	(r226994)
+++ head/sys/dev/dc/if_dc.c	Tue Nov  1 16:13:59 2011	(r226995)
@@ -122,6 +122,7 @@ __FBSDID("$FreeBSD$");
 #include 
 
 #include 
+#include 
 #include 
 
 #include 
@@ -149,7 +150,7 @@ MODULE_DEPEND(dc, miibus, 1, 1, 1);
 /*
  * Various supported device vendors/types and their names.
  */
-static const struct dc_type dc_devs[] = {
+static const struct dc_type const dc_devs[] = {
 	{ DC_DEVID(DC_VENDORID_DEC, DC_DEVICEID_21143), 0,
 		"Intel 21143 10/100BaseTX" },
 	{ DC_DEVID(DC_VENDORID_DAVICOM, DC_DEVICEID_DM9009), 0,
@@ -272,12 +273,6 @@ static void dc_eeprom_getword_xircom(str
 static void dc_eeprom_width(struct dc_softc *);
 static void dc_read_eeprom(struct dc_softc *, caddr_t, int, int, int);
 
-static void dc_mii_writebit(struct dc_softc *, int);
-static int dc_mii_readbit(struct dc_softc *);
-static void dc_mii_sync(struct dc_softc *);
-static void dc_mii_send(struct dc_softc *, uint32_t, int);
-static int dc_mii_readreg(struct dc_softc *, struct dc_mii_frame *);
-static int dc_mii_writereg(struct dc_softc *, struct dc_mii_frame *);
 static int dc_miibus_readreg(device_t, int, int);
 static int dc_miibus_writereg(device_t, int, int, int);
 static void dc_miibus_statchg(device_t);
@@ -307,6 +302,24 @@ static int dc_decode_leaf_sym(struct dc_
 static void dc_apply_fixup(struct dc_softc *, int);
 static int dc_check_multiport(struct dc_softc *);
 
+/*
+ * MII bit-bang glue
+ */
+static uint32_t dc_mii_bitbang_read(device_t);
+static void dc_mii_bitbang_write(device_t, uint32_t);
+
+static const struct mii_bitbang_ops dc_mii_bitbang_ops = {
+	dc_mii_bitbang_read,
+	dc_mii_bitbang_write,
+	{
+		DC_SIO_MII_DATAOUT,	/* MII_BIT_MDO */
+		DC_SIO_MII_DATAIN,	/* MII_BIT_MDI */
+		DC_SIO_MII_CLK,		/* MII_BIT_MDC */
+		0,			/* MII_BIT_DIR_HOST_PHY */
+		DC_SIO_MII_DIR,		/* MII_BIT_DIR_PHY_HOST */
+	}
+};
+
 #ifdef DC_USEIOSPACE
 #define	DC_RES			SYS_RES_IOPORT
 #define	DC_RID			DC_PCI_CFBIO
@@ -611,185 +624,45 @@ dc_read_eeprom(struct dc_softc *sc, cadd
 }
 
 /*
- * The following two routines are taken from the Macronix 98713
- * Application Notes pp.19-21.
- */
-/*
- * Write a bit to the MII bus.
+ * Write the MII serial port for the MII bit-bang module.
  */
 static void
-dc_mii_writebit(struct dc_softc *sc, int bit)
+dc_mii_bitbang_write(device_t dev, uint32_t val)
 {
-	uint32_t reg;
+	struct dc_softc *sc;
 
-	reg = DC_SIO_ROMCTL_WRITE | (bit != 0 ? DC_SIO_MII_DATAOUT : 0);
-	CSR_WRITE_4(sc, DC_SIO, reg);
-	CSR_BARRIER_4(sc, DC_SIO,
-	    BUS_SPACE_BARRIER_READ | BUS_SPACE_BARRIER_WRITE);
-	DELAY(1);
+	sc = device_get_softc(dev);
 
-	CSR_WRITE_4(sc, DC_SIO, reg | DC_SIO_MII_CLK);
-	CSR_BARRIER_4(sc, DC_SIO,
-	    BUS_SPACE_BARRIER_READ | BUS_SPACE_BARRIER_WRITE);
-	DELAY(1);
-	CSR_WRITE_4(sc, DC_SIO, reg);
+	CSR_WRITE_4(sc, DC_SIO, val);
 	CSR_BARRIER_4(sc, DC_SIO,
 	    BUS_SPACE_BARRIER_READ | BUS_SPACE_BARRIER_WRITE);
-	DELAY(1);
 }
 
 /*
- * Read a bit from the MII bus.
+ * Read the MII serial port for the MII bit-bang module.
  */
-static int
-dc_mii_readbit(struct dc_softc *sc)
+static uint32_t
+dc_mii_bitbang_read(device_t dev)
 {
-	uint32_t reg;
-
-	reg = DC_SIO_ROMCTL_READ | DC_SIO_MII_DIR;
-	CSR_WRITE_4(sc, DC_SIO, reg);
-	CSR_BARRIER_4(sc, DC_SIO,
-	    BUS_SPACE_BARRIER_READ | BUS_SPACE_BARRIER_WRITE);
-	DELAY(1);
-	(void)CSR_READ_4(sc, DC_SIO);
-	CSR_WRITE_4(sc, DC_SIO, reg | DC_SIO_MII_CLK);
-	CSR_BARRIER_4(sc, DC_SIO,
-	    BUS_SPACE_BARRIER_READ | BUS_SPACE_BARRIER_WRITE);
-	DELAY(1);
-	CSR_WRITE_4(sc, DC_SIO, reg);
-	CSR_BARRIER_4(sc, DC_SIO,
-	    BUS_SPACE_BARRIER_READ | BUS_SPACE_BARRIER_WRITE);
-	DELAY(1);
-	if (CSR_READ_4(sc, DC_SIO) & DC_SIO_MII_DATAIN)
-		return (1);
-
-	return (0);
-}
+	struct dc_softc *sc;
+	uint32_t val;
 
-/*
- * Sync the PHYs by setting data bit and strobing the clock 32 times.
- */
-static void
-dc_mii_sync(struct dc_softc *sc)
-{
-	int i;
+	sc = device_get_softc(dev);
 
-	CSR_WRITE_4(sc, DC_SIO, DC_SIO_ROMCTL_WRITE);
+	val = CSR_READ_4(sc, DC_SIO);
 	CSR_BARRIER_4(sc, DC_SIO,
 	    BUS_SPACE_BARRIER_READ | BUS_SPACE_BARRIER_WRITE);
-	DELAY(1);
-
-	for (i = 0; i < 32; i++)
-		dc_mii_writebit(sc, 1);
-}
-
-/*
- * Clock a series of bits through the MII.
- */
-static void
-dc_mii_send(struct dc_softc *sc, uint32_t bits, int cnt)
-{
-	int i;
-
-	for (i = (0x1 << (cnt - 1)); i; i >>= 1)
-		dc_mii_writebit(sc, bits & i);
-}
 
-/*
- * Read an PHY register through the MII.
- */
-static int
-dc_mii_readreg(struct dc_softc *sc, struct dc_mii_frame *frame)
-{
-	int i;
-
-	/*
-	 * Set up frame for RX.
-	 */
-	frame->mii_stdelim = DC_MII_STARTDELIM;
-	frame->mii_opcode = DC_MII_READOP;
-
-	/*
-	 * Sync the PHYs.
-	 */
-	dc_mii_sync(sc);
-
-	/*
-	 * Send command/address info.
-	 */
-	dc_mii_send(sc, frame->mii_stdelim, 2);
-	dc_mii_send(sc, frame->mii_opcode, 2);
-	dc_mii_send(sc, frame->mii_phyaddr, 5);
-	dc_mii_send(sc, frame->mii_regaddr, 5);
-
-	/*
-	 * Now try reading data bits.  If the turnaround failed, we still
-	 * need to clock through 16 cycles to keep the PHY(s) in sync.
-	 */
-	frame->mii_turnaround = dc_mii_readbit(sc);
-	if (frame->mii_turnaround != 0) {
-		for (i = 0; i < 16; i++)
-			dc_mii_readbit(sc);
-		goto fail;
-	}
-	for (i = 0x8000; i; i >>= 1) {
-		if (dc_mii_readbit(sc))
-			frame->mii_data |= i;
-	}
-
-fail:
-
-	/* Clock the idle bits. */
-	dc_mii_writebit(sc, 0);
-	dc_mii_writebit(sc, 0);
-
-	if (frame->mii_turnaround != 0)
-		return (1);
-	return (0);
-}
-
-/*
- * Write to a PHY register through the MII.
- */
-static int
-dc_mii_writereg(struct dc_softc *sc, struct dc_mii_frame *frame)
-{
-
-	/*
-	 * Set up frame for TX.
-	 */
-	frame->mii_stdelim = DC_MII_STARTDELIM;
-	frame->mii_opcode = DC_MII_WRITEOP;
-	frame->mii_turnaround = DC_MII_TURNAROUND;
-
-	/*
-	 * Sync the PHYs.
-	 */
-	dc_mii_sync(sc);
-
-	dc_mii_send(sc, frame->mii_stdelim, 2);
-	dc_mii_send(sc, frame->mii_opcode, 2);
-	dc_mii_send(sc, frame->mii_phyaddr, 5);
-	dc_mii_send(sc, frame->mii_regaddr, 5);
-	dc_mii_send(sc, frame->mii_turnaround, 2);
-	dc_mii_send(sc, frame->mii_data, 16);
-
-	/* Clock the idle bits. */
-	dc_mii_writebit(sc, 0);
-	dc_mii_writebit(sc, 0);
-
-	return (0);
+	return (val);
 }
 
 static int
 dc_miibus_readreg(device_t dev, int phy, int reg)
 {
-	struct dc_mii_frame frame;
-	struct dc_softc	 *sc;
+	struct dc_softc *sc;
 	int i, rval, phy_reg = 0;
 
 	sc = device_get_softc(dev);
-	bzero(&frame, sizeof(frame));
 
 	if (sc->dc_pmode != DC_PMODE_MII) {
 		if (phy == (MII_NPHY - 1)) {
@@ -881,34 +754,29 @@ dc_miibus_readreg(device_t dev, int phy,
 		}
 
 		rval = CSR_READ_4(sc, phy_reg) & 0x0000FFFF;
-
 		if (rval == 0xFFFF)
 			return (0);
 		return (rval);
 	}
 
-	frame.mii_phyaddr = phy;
-	frame.mii_regaddr = reg;
 	if (sc->dc_type == DC_TYPE_98713) {
 		phy_reg = CSR_READ_4(sc, DC_NETCFG);
 		CSR_WRITE_4(sc, DC_NETCFG, phy_reg & ~DC_NETCFG_PORTSEL);
 	}
-	dc_mii_readreg(sc, &frame);
+	rval = mii_bitbang_readreg(dev, &dc_mii_bitbang_ops, phy, reg);
 	if (sc->dc_type == DC_TYPE_98713)
 		CSR_WRITE_4(sc, DC_NETCFG, phy_reg);
 
-	return (frame.mii_data);
+	return (rval);
 }
 
 static int
 dc_miibus_writereg(device_t dev, int phy, int reg, int data)
 {
 	struct dc_softc *sc;
-	struct dc_mii_frame frame;
 	int i, phy_reg = 0;
 
 	sc = device_get_softc(dev);
-	bzero(&frame, sizeof(frame));
 
 	if (DC_IS_PNIC(sc)) {
 		CSR_WRITE_4(sc, DC_PN_MII, DC_PN_MIIOPCODE_WRITE |
@@ -964,15 +832,11 @@ dc_miibus_writereg(device_t dev, int phy
 		return (0);
 	}
 
-	frame.mii_phyaddr = phy;
-	frame.mii_regaddr = reg;
-	frame.mii_data = data;
-
 	if (sc->dc_type == DC_TYPE_98713) {
 		phy_reg = CSR_READ_4(sc, DC_NETCFG);
 		CSR_WRITE_4(sc, DC_NETCFG, phy_reg & ~DC_NETCFG_PORTSEL);
 	}
-	dc_mii_writereg(sc, &frame);
+	mii_bitbang_writereg(dev, &dc_mii_bitbang_ops, phy, reg, data);
 	if (sc->dc_type == DC_TYPE_98713)
 		CSR_WRITE_4(sc, DC_NETCFG, phy_reg);
 

Modified: head/sys/dev/dc/if_dcreg.h
==============================================================================
--- head/sys/dev/dc/if_dcreg.h	Tue Nov  1 16:11:44 2011	(r226994)
+++ head/sys/dev/dc/if_dcreg.h	Tue Nov  1 16:13:59 2011	(r226995)
@@ -531,27 +531,9 @@ struct dc_mediainfo {
 struct dc_type {
 	uint32_t		dc_devid;
 	uint8_t			dc_minrev;
-	char			*dc_name;
+	const char		*dc_name;
 };
 
-struct dc_mii_frame {
-	uint8_t			mii_stdelim;
-	uint8_t			mii_opcode;
-	uint8_t			mii_phyaddr;
-	uint8_t			mii_regaddr;
-	uint8_t			mii_turnaround;
-	uint16_t		mii_data;
-};
-
-/*
- * MII constants
- */
-#define	DC_MII_STARTDELIM	0x01
-#define	DC_MII_READOP		0x02
-#define	DC_MII_WRITEOP		0x01
-#define	DC_MII_TURNAROUND	0x02
-
-
 /*
  * Registers specific to clone devices.
  * This mainly relates to RX filter programming: not all 21x4x clones
@@ -827,7 +809,7 @@ struct dc_softc {
 #define	CSR_READ_4(sc, reg)		\
 	bus_space_read_4(sc->dc_btag, sc->dc_bhandle, reg)
 
-#define	CSR_BARRIER_4(sc, reg, flags)		\
+#define	CSR_BARRIER_4(sc, reg, flags)					\
 	bus_space_barrier(sc->dc_btag, sc->dc_bhandle, reg, 4, flags)
 
 #define	DC_TIMEOUT		1000

Added: head/sys/dev/mii/mii_bitbang.c
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/sys/dev/mii/mii_bitbang.c	Tue Nov  1 16:13:59 2011	(r226995)
@@ -0,0 +1,180 @@
+/*	$NetBSD: mii_bitbang.c,v 1.12 2008/05/04 17:06:09 xtraeme Exp $	*/
+
+/*-
+ * Copyright (c) 1999 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Jason R. Thorpe of the Numerical Aerospace Simulation Facility,
+ * NASA Ames Research Center.
+ *
+ * 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 didevlaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following didevlaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. 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 FOUNDATION 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.
+ */
+
+/*
+ * Common module for bit-bang'ing the MII.
+ */
+
+#include 
+__FBSDID("$FreeBSD$");
+
+#include 
+#include 
+#include 
+
+#include 
+#include 
+
+MODULE_VERSION(mii_bitbang, 1);
+
+static void mii_bitbang_sendbits(device_t dev, mii_bitbang_ops_t ops,
+    uint32_t data, int nbits);
+
+#define	MWRITE(x)							\
+do {									\
+	ops->mbo_write(dev, (x));					\
+	DELAY(1);							\
+} while (/* CONSTCOND */ 0)
+
+#define	MREAD		ops->mbo_read(dev)
+
+#define	MDO		ops->mbo_bits[MII_BIT_MDO]
+#define	MDI		ops->mbo_bits[MII_BIT_MDI]
+#define	MDC		ops->mbo_bits[MII_BIT_MDC]
+#define	MDIRPHY		ops->mbo_bits[MII_BIT_DIR_HOST_PHY]
+#define	MDIRHOST	ops->mbo_bits[MII_BIT_DIR_PHY_HOST]
+
+/*
+ * mii_bitbang_sync:
+ *
+ *	Synchronize the MII.
+ */
+void
+mii_bitbang_sync(device_t dev, mii_bitbang_ops_t ops)
+{
+	int i;
+	uint32_t v;
+
+	v = MDIRPHY | MDO;
+
+	MWRITE(v);
+	for (i = 0; i < 32; i++) {
+		MWRITE(v | MDC);
+		MWRITE(v);
+	}
+}
+
+/*
+ * mii_bitbang_sendbits:
+ *
+ *	Send a series of bits to the MII.
+ */
+static void
+mii_bitbang_sendbits(device_t dev, mii_bitbang_ops_t ops, uint32_t data,
+    int nbits)
+{
+	int i;
+	uint32_t v;
+
+	v = MDIRPHY;
+	MWRITE(v);
+
+	for (i = 1 << (nbits - 1); i != 0; i >>= 1) {
+		if (data & i)
+			v |= MDO;
+		else
+			v &= ~MDO;
+		MWRITE(v);
+		MWRITE(v | MDC);
+		MWRITE(v);
+	}
+}
+
+/*
+ * mii_bitbang_readreg:
+ *
+ *	Read a PHY register by bit-bang'ing the MII.
+ */
+int
+mii_bitbang_readreg(device_t dev, mii_bitbang_ops_t ops, int phy, int reg)
+{
+	int i, error, val;
+
+	mii_bitbang_sync(dev, ops);
+
+	mii_bitbang_sendbits(dev, ops, MII_COMMAND_START, 2);
+	mii_bitbang_sendbits(dev, ops, MII_COMMAND_READ, 2);
+	mii_bitbang_sendbits(dev, ops, phy, 5);
+	mii_bitbang_sendbits(dev, ops, reg, 5);
+
+	/* Switch direction to PHY->host, without a clock transition. */
+	MWRITE(MDIRHOST);
+
+	/* Turnaround clock. */
+	MWRITE(MDIRHOST | MDC);
+	MWRITE(MDIRHOST);
+
+	/* Check for error. */
+	error = MREAD & MDI;
+
+	/* Idle clock. */
+	MWRITE(MDIRHOST | MDC);
+	MWRITE(MDIRHOST);
+
+	val = 0;
+	for (i = 0; i < 16; i++) {
+		val <<= 1;
+		/* Read data prior to clock low-high transition. */
+		if (error == 0 && (MREAD & MDI) != 0)
+			val |= 1;
+
+		MWRITE(MDIRHOST | MDC);
+		MWRITE(MDIRHOST);
+	}
+
+	/* Set direction to host->PHY, without a clock transition. */
+	MWRITE(MDIRPHY);
+
+	return (error != 0 ? 0 : val);
+}
+
+/*
+ * mii_bitbang_writereg:
+ *
+ *	Write a PHY register by bit-bang'ing the MII.
+ */
+void
+mii_bitbang_writereg(device_t dev, mii_bitbang_ops_t ops, int phy, int reg,
+    int val)
+{
+
+	mii_bitbang_sync(dev, ops);
+
+	mii_bitbang_sendbits(dev, ops, MII_COMMAND_START, 2);
+	mii_bitbang_sendbits(dev, ops, MII_COMMAND_WRITE, 2);
+	mii_bitbang_sendbits(dev, ops, phy, 5);
+	mii_bitbang_sendbits(dev, ops, reg, 5);
+	mii_bitbang_sendbits(dev, ops, MII_COMMAND_ACK, 2);
+	mii_bitbang_sendbits(dev, ops, val, 16);
+
+	MWRITE(MDIRPHY);
+}

Added: head/sys/dev/mii/mii_bitbang.h
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/sys/dev/mii/mii_bitbang.h	Tue Nov  1 16:13:59 2011	(r226995)
@@ -0,0 +1,54 @@
+/*	$NetBSD: mii_bitbang.h,v 1.6 2009/05/12 14:31:27 cegger Exp $	*/
+
+/*-
+ * Copyright (c) 1999 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Jason R. Thorpe of the Numerical Aerospace Simulation Facility,
+ * NASA Ames Research Center.
+ *
+ * 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 NETBSD FOUNDATION, INC. 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 FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ * $FreeBSD$
+ */
+
+#define	MII_BIT_MDO		0	/* data out (host->PHY) */
+#define	MII_BIT_MDI		1	/* data in (PHY->host) */
+#define	MII_BIT_MDC		2	/* clock */
+#define	MII_BIT_DIR_HOST_PHY	3	/* set direction: host->PHY */
+#define	MII_BIT_DIR_PHY_HOST	4	/* set direction: PHY->host */
+#define	MII_NBITS		5
+
+struct mii_bitbang_ops {
+	uint32_t	(*mbo_read)(device_t);
+	void		(*mbo_write)(device_t, uint32_t);
+	uint32_t	mbo_bits[MII_NBITS];
+};
+
+typedef	const struct mii_bitbang_ops *mii_bitbang_ops_t;
+
+int	mii_bitbang_readreg(device_t dev, mii_bitbang_ops_t ops,
+	    int phy, int reg);
+void	mii_bitbang_sync(device_t dev, mii_bitbang_ops_t ops);
+void	mii_bitbang_writereg(device_t dev, mii_bitbang_ops_t ops,
+	    int phy, int reg, int val);

Modified: head/sys/dev/nge/if_nge.c
==============================================================================
--- head/sys/dev/nge/if_nge.c	Tue Nov  1 16:11:44 2011	(r226994)
+++ head/sys/dev/nge/if_nge.c	Tue Nov  1 16:13:59 2011	(r226995)
@@ -117,6 +117,7 @@ __FBSDID("$FreeBSD$");
 #include 
 
 #include 
+#include 
 #include 
 
 #include 
@@ -138,7 +139,7 @@ MODULE_DEPEND(nge, miibus, 1, 1, 1);
 /*
  * Various supported device vendors/types and their names.
  */
-static struct nge_type nge_devs[] = {
+static const struct nge_type const nge_devs[] = {
 	{ NGE_VENDORID, NGE_DEVICEID,
 	    "National Semiconductor Gigabit Ethernet" },
 	{ 0, 0, NULL }
@@ -180,11 +181,6 @@ static void nge_eeprom_putbyte(struct ng
 static void nge_eeprom_getword(struct nge_softc *, int, uint16_t *);
 static void nge_read_eeprom(struct nge_softc *, caddr_t, int, int);
 
-static void nge_mii_sync(struct nge_softc *);
-static void nge_mii_send(struct nge_softc *, uint32_t, int);
-static int nge_mii_readreg(struct nge_softc *, struct nge_mii_frame *);
-static int nge_mii_writereg(struct nge_softc *, struct nge_mii_frame *);
-
 static int nge_miibus_readreg(device_t, int, int);
 static int nge_miibus_writereg(device_t, int, int, int);
 static void nge_miibus_statchg(device_t);
@@ -200,6 +196,24 @@ static void nge_sysctl_node(struct nge_s
 static int sysctl_int_range(SYSCTL_HANDLER_ARGS, int, int);
 static int sysctl_hw_nge_int_holdoff(SYSCTL_HANDLER_ARGS);
 
+/*
+ * MII bit-bang glue
+ */

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

From owner-svn-src-head@FreeBSD.ORG  Tue Nov  1 17:04:43 2011
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 27E001065670;
	Tue,  1 Nov 2011 17:04:43 +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 173648FC12;
	Tue,  1 Nov 2011 17:04:43 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pA1H4gmL076028;
	Tue, 1 Nov 2011 17:04:42 GMT (envelope-from mav@svn.freebsd.org)
Received: (from mav@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id pA1H4gmm076026;
	Tue, 1 Nov 2011 17:04:42 GMT (envelope-from mav@svn.freebsd.org)
Message-Id: <201111011704.pA1H4gmm076026@svn.freebsd.org>
From: Alexander Motin 
Date: Tue, 1 Nov 2011 17:04:42 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r226998 - head/sys/geom/stripe
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: 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, 01 Nov 2011 17:04:43 -0000

Author: mav
Date: Tue Nov  1 17:04:42 2011
New Revision: 226998
URL: http://svn.freebsd.org/changeset/base/226998

Log:
  Refactor disk disconnection and geom destruction handling sequences.
  Do not close/destroy opened consumer directly in case of disconnect. Instead
  keep it existing until it will be closed in regular way in response to
  upstream provider destruction. Delay geom destruction in the same way.
  Previous implementation could destroy consumers still having active
  requests and worked only because of global workaround made on GEOM level.

Modified:
  head/sys/geom/stripe/g_stripe.c

Modified: head/sys/geom/stripe/g_stripe.c
==============================================================================
--- head/sys/geom/stripe/g_stripe.c	Tue Nov  1 16:56:42 2011	(r226997)
+++ head/sys/geom/stripe/g_stripe.c	Tue Nov  1 17:04:42 2011	(r226998)
@@ -160,28 +160,35 @@ static void
 g_stripe_remove_disk(struct g_consumer *cp)
 {
 	struct g_stripe_softc *sc;
-	u_int no;
 
+	g_topology_assert();
 	KASSERT(cp != NULL, ("Non-valid disk in %s.", __func__));
-	sc = (struct g_stripe_softc *)cp->private;
+	sc = (struct g_stripe_softc *)cp->geom->softc;
 	KASSERT(sc != NULL, ("NULL sc in %s.", __func__));
-	no = cp->index;
 
-	G_STRIPE_DEBUG(0, "Disk %s removed from %s.", cp->provider->name,
-	    sc->sc_name);
+	if (cp->private == NULL) {
+		G_STRIPE_DEBUG(0, "Disk %s removed from %s.",
+		    cp->provider->name, sc->sc_name);
+		cp->private = (void *)(uintptr_t)-1;
+	}
 
-	sc->sc_disks[no] = NULL;
 	if (sc->sc_provider != NULL) {
 		sc->sc_provider->flags |= G_PF_WITHER;
+		G_STRIPE_DEBUG(0, "Device %s deactivated.",
+		    sc->sc_provider->name);
 		g_orphan_provider(sc->sc_provider, ENXIO);
 		sc->sc_provider = NULL;
-		G_STRIPE_DEBUG(0, "Device %s removed.", sc->sc_name);
 	}
 
 	if (cp->acr > 0 || cp->acw > 0 || cp->ace > 0)
-		g_access(cp, -cp->acr, -cp->acw, -cp->ace);
+		return;
+	sc->sc_disks[cp->index] = NULL;
+	cp->index = 0;
 	g_detach(cp);
 	g_destroy_consumer(cp);
+	/* If there are no valid disks anymore, remove device. */
+	if (LIST_EMPTY(&sc->sc_geom->consumer))
+		g_stripe_destroy(sc, 1);
 }
 
 static void
@@ -197,36 +204,20 @@ g_stripe_orphan(struct g_consumer *cp)
 		return;
 
 	g_stripe_remove_disk(cp);
-	/* If there are no valid disks anymore, remove device. */
-	if (g_stripe_nvalid(sc) == 0)
-		g_stripe_destroy(sc, 1);
 }
 
 static int
 g_stripe_access(struct g_provider *pp, int dr, int dw, int de)
 {
-	struct g_consumer *cp1, *cp2;
+	struct g_consumer *cp1, *cp2, *tmp;
 	struct g_stripe_softc *sc;
 	struct g_geom *gp;
 	int error;
 
+	g_topology_assert();
 	gp = pp->geom;
 	sc = gp->softc;
-
-	if (sc == NULL) {
-		/*
-		 * It looks like geom is being withered.
-		 * In that case we allow only negative requests.
-		 */
-		KASSERT(dr <= 0 && dw <= 0 && de <= 0,
-		    ("Positive access request (device=%s).", pp->name));
-		if ((pp->acr + dr) == 0 && (pp->acw + dw) == 0 &&
-		    (pp->ace + de) == 0) {
-			G_STRIPE_DEBUG(0, "Device %s definitely destroyed.",
-			    gp->name);
-		}
-		return (0);
-	}
+	KASSERT(sc != NULL, ("NULL sc in %s.", __func__));
 
 	/* On first open, grab an extra "exclusive" bit */
 	if (pp->acr == 0 && pp->acw == 0 && pp->ace == 0)
@@ -235,22 +226,23 @@ g_stripe_access(struct g_provider *pp, i
 	if ((pp->acr + dr) == 0 && (pp->acw + dw) == 0 && (pp->ace + de) == 0)
 		de--;
 
-	error = ENXIO;
-	LIST_FOREACH(cp1, &gp->consumer, consumer) {
+	LIST_FOREACH_SAFE(cp1, &gp->consumer, consumer, tmp) {
 		error = g_access(cp1, dr, dw, de);
-		if (error == 0)
-			continue;
-		/*
-		 * If we fail here, backout all previous changes.
-		 */
-		LIST_FOREACH(cp2, &gp->consumer, consumer) {
-			if (cp1 == cp2)
-				return (error);
-			g_access(cp2, -dr, -dw, -de);
+		if (error != 0)
+			goto fail;
+		if (cp1->acr == 0 && cp1->acw == 0 && cp1->ace == 0 &&
+		    cp1->private != NULL) {
+			g_stripe_remove_disk(cp1); /* May destroy geom. */
 		}
-		/* NOTREACHED */
 	}
+	return (0);
 
+fail:
+	LIST_FOREACH(cp2, &gp->consumer, consumer) {
+		if (cp1 == cp2)
+			break;
+		g_access(cp2, -dr, -dw, -de);
+	}
 	return (error);
 }
 
@@ -652,6 +644,7 @@ g_stripe_check_and_run(struct g_stripe_s
 	off_t mediasize, ms;
 	u_int no, sectorsize = 0;
 
+	g_topology_assert();
 	if (g_stripe_nvalid(sc) != sc->sc_ndisks)
 		return;
 
@@ -681,7 +674,7 @@ g_stripe_check_and_run(struct g_stripe_s
 	sc->sc_provider->stripeoffset = 0;
 	g_error_provider(sc->sc_provider, 0);
 
-	G_STRIPE_DEBUG(0, "Device %s activated.", sc->sc_name);
+	G_STRIPE_DEBUG(0, "Device %s activated.", sc->sc_provider->name);
 }
 
 static int
@@ -722,6 +715,7 @@ g_stripe_add_disk(struct g_stripe_softc 
 	struct g_geom *gp;
 	int error;
 
+	g_topology_assert();
 	/* Metadata corrupted? */
 	if (no >= sc->sc_ndisks)
 		return (EINVAL);
@@ -734,6 +728,8 @@ g_stripe_add_disk(struct g_stripe_softc 
 	fcp = LIST_FIRST(&gp->consumer);
 
 	cp = g_new_consumer(gp);
+	cp->private = NULL;
+	cp->index = no;
 	error = g_attach(cp, pp);
 	if (error != 0) {
 		g_destroy_consumer(cp);
@@ -764,12 +760,8 @@ g_stripe_add_disk(struct g_stripe_softc 
 		}
 	}
 
-	cp->private = sc;
-	cp->index = no;
 	sc->sc_disks[no] = cp;
-
 	G_STRIPE_DEBUG(0, "Disk %s attached to %s.", pp->name, sc->sc_name);
-
 	g_stripe_check_and_run(sc);
 
 	return (0);
@@ -789,6 +781,7 @@ g_stripe_create(struct g_class *mp, cons
 	struct g_geom *gp;
 	u_int no;
 
+	g_topology_assert();
 	G_STRIPE_DEBUG(1, "Creating device %s (id=%u).", md->md_name,
 	    md->md_id);
 
@@ -850,8 +843,8 @@ static int
 g_stripe_destroy(struct g_stripe_softc *sc, boolean_t force)
 {
 	struct g_provider *pp;
+	struct g_consumer *cp, *cp1;
 	struct g_geom *gp;
-	u_int no;
 
 	g_topology_assert();
 
@@ -871,24 +864,22 @@ g_stripe_destroy(struct g_stripe_softc *
 		}
 	}
 
-	for (no = 0; no < sc->sc_ndisks; no++) {
-		if (sc->sc_disks[no] != NULL)
-			g_stripe_remove_disk(sc->sc_disks[no]);
+	gp = sc->sc_geom;
+	LIST_FOREACH_SAFE(cp, &gp->consumer, consumer, cp1) {
+		g_stripe_remove_disk(cp);
+		if (cp1 == NULL)
+			return (0);	/* Recursion happened. */
 	}
+	if (!LIST_EMPTY(&gp->consumer))
+		return (EINPROGRESS);
 
-	gp = sc->sc_geom;
 	gp->softc = NULL;
 	KASSERT(sc->sc_provider == NULL, ("Provider still exists? (device=%s)",
 	    gp->name));
 	free(sc->sc_disks, M_STRIPE);
 	free(sc, M_STRIPE);
-
-	pp = LIST_FIRST(&gp->provider);
-	if (pp == NULL || (pp->acr == 0 && pp->acw == 0 && pp->ace == 0))
-		G_STRIPE_DEBUG(0, "Device %s destroyed.", gp->name);
-
+	G_STRIPE_DEBUG(0, "Device %s destroyed.", gp->name);
 	g_wither_geom(gp, ENXIO);
-
 	return (0);
 }
 

From owner-svn-src-head@FreeBSD.ORG  Tue Nov  1 17:57:21 2011
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 777BA106564A;
	Tue,  1 Nov 2011 17:57:21 +0000 (UTC)
	(envelope-from marius@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 5CED38FC15;
	Tue,  1 Nov 2011 17:57:21 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pA1HvLex077610;
	Tue, 1 Nov 2011 17:57:21 GMT (envelope-from marius@svn.freebsd.org)
Received: (from marius@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id pA1HvLMf077606;
	Tue, 1 Nov 2011 17:57:21 GMT (envelope-from marius@svn.freebsd.org)
Message-Id: <201111011757.pA1HvLMf077606@svn.freebsd.org>
From: Marius Strobl 
Date: Tue, 1 Nov 2011 17:57: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: r227000 - in head/sys/dev/ata: . chipsets
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Tue, 01 Nov 2011 17:57:21 -0000

Author: marius
Date: Tue Nov  1 17:57:21 2011
New Revision: 227000
URL: http://svn.freebsd.org/changeset/base/227000

Log:
  In r225931 I've missed the only other driver using the pointer returned
  by rman_get_virtual(9) to access device registers sparc64 currently cares
  about.
  Ideally ata(4) should just be converted to access these using bus_space(9)
  read/write functions instead as there's really no reason to do it the
  former way. However, this part of ata-siliconimage.c should go away in
  favor of siis(4) sooner or later anyway and I don't have the hardware to
  actually test the SX4 bits of ata-promise.c.
  Also ideally the other architectures should also properly handle the
  BUS_SPACE_MAP_LINEAR flag of bus_space_map(9) so this code wouldn't need
  to be #ifdef'ed.

Modified:
  head/sys/dev/ata/ata-pci.c
  head/sys/dev/ata/chipsets/ata-promise.c
  head/sys/dev/ata/chipsets/ata-siliconimage.c

Modified: head/sys/dev/ata/ata-pci.c
==============================================================================
--- head/sys/dev/ata/ata-pci.c	Tue Nov  1 17:18:57 2011	(r226999)
+++ head/sys/dev/ata/ata-pci.c	Tue Nov  1 17:57:21 2011	(r227000)
@@ -153,10 +153,20 @@ ata_pci_detach(device_t dev)
     }
     if (ctlr->chipdeinit != NULL)
 	ctlr->chipdeinit(dev);
-    if (ctlr->r_res2)
+    if (ctlr->r_res2) {
+#ifdef __sparc64__
+	bus_space_unmap(rman_get_bustag(ctlr->r_res2),
+	    rman_get_bushandle(ctlr->r_res2), rman_get_size(ctlr->r_res2));
+#endif
 	bus_release_resource(dev, ctlr->r_type2, ctlr->r_rid2, ctlr->r_res2);
-    if (ctlr->r_res1)
+    }
+    if (ctlr->r_res1) {
+#ifdef __sparc64__
+	bus_space_unmap(rman_get_bustag(ctlr->r_res1),
+	    rman_get_bushandle(ctlr->r_res1), rman_get_size(ctlr->r_res1));
+#endif
 	bus_release_resource(dev, ctlr->r_type1, ctlr->r_rid1, ctlr->r_res1);
+    }
 
     return 0;
 }
@@ -775,7 +785,6 @@ driver_t ata_pcichannel_driver = {
 
 DRIVER_MODULE(ata, atapci, ata_pcichannel_driver, ata_devclass, 0, 0);
 
-
 /*
  * misc support fucntions
  */
@@ -936,4 +945,3 @@ ata_mode2idx(int mode)
 	return (mode & ATA_MODE_MASK) + 5;
     return (mode & ATA_MODE_MASK) - ATA_PIO0;
 }
-

Modified: head/sys/dev/ata/chipsets/ata-promise.c
==============================================================================
--- head/sys/dev/ata/chipsets/ata-promise.c	Tue Nov  1 17:18:57 2011	(r226999)
+++ head/sys/dev/ata/chipsets/ata-promise.c	Tue Nov  1 17:57:21 2011	(r227000)
@@ -94,7 +94,6 @@ static void ata_promise_next_hpkt(struct
 #define PR_SATA		0x40
 #define PR_SATA2	0x80
 
-
 /*
  * Promise chipset support functions
  */
@@ -250,6 +249,14 @@ ata_promise_chipinit(device_t dev)
 						    &ctlr->r_rid1, RF_ACTIVE)))
 	    goto failnfree;
 
+#ifdef __sparc64__
+	if (ctlr->chip->cfg2 == PR_SX4X &&
+	    !bus_space_map(rman_get_bustag(ctlr->r_res1),
+	    rman_get_bushandle(ctlr->r_res1), rman_get_size(ctlr->r_res1),
+	    BUS_SPACE_MAP_LINEAR, NULL))
+		goto failnfree;
+#endif
+
 	ctlr->r_type2 = SYS_RES_MEMORY;
 	ctlr->r_rid2 = PCIR_BAR(3);
 	if (!(ctlr->r_res2 = bus_alloc_resource_any(dev, ctlr->r_type2,

Modified: head/sys/dev/ata/chipsets/ata-siliconimage.c
==============================================================================
--- head/sys/dev/ata/chipsets/ata-siliconimage.c	Tue Nov  1 17:18:57 2011	(r226999)
+++ head/sys/dev/ata/chipsets/ata-siliconimage.c	Tue Nov  1 17:57:21 2011	(r227000)
@@ -80,7 +80,6 @@ static void ata_siiprb_dmainit(device_t 
 #define SII_BUG		0x04
 #define SII_4CH		0x08
 
-
 /*
  * Silicon Image Inc. (SiI) (former CMD) chipset support functions
  */
@@ -141,6 +140,17 @@ ata_sii_chipinit(device_t dev)
 	    bus_release_resource(dev, ctlr->r_type1, ctlr->r_rid1,ctlr->r_res1);
 	    return ENXIO;
 	}
+#ifdef __sparc64__
+	if (!bus_space_map(rman_get_bustag(ctlr->r_res2),
+	    rman_get_bushandle(ctlr->r_res2), rman_get_size(ctlr->r_res2),
+	    BUS_SPACE_MAP_LINEAR, NULL)) {
+	    	bus_release_resource(dev, ctlr->r_type1, ctlr->r_rid1,
+		    ctlr->r_res1);
+		bus_release_resource(dev, ctlr->r_type2, ctlr->r_rid2,
+		    ctlr->r_res2);
+		return (ENXIO);
+	}
+#endif
 	ctlr->ch_attach = ata_siiprb_ch_attach;
 	ctlr->ch_detach = ata_siiprb_ch_detach;
 	ctlr->reset = ata_siiprb_reset;
@@ -432,7 +442,6 @@ ata_sii_setmode(device_t dev, int target
 	return (mode);
 }
 
-
 struct ata_siiprb_dma_prdentry {
     u_int64_t addr;
     u_int32_t count;

From owner-svn-src-head@FreeBSD.ORG  Tue Nov  1 18:28:33 2011
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id E2F28106566C;
	Tue,  1 Nov 2011 18:28:33 +0000 (UTC)
	(envelope-from marius@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id D2FFD8FC0A;
	Tue,  1 Nov 2011 18:28:33 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pA1ISXgk078664;
	Tue, 1 Nov 2011 18:28:33 GMT (envelope-from marius@svn.freebsd.org)
Received: (from marius@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id pA1ISXNT078662;
	Tue, 1 Nov 2011 18:28:33 GMT (envelope-from marius@svn.freebsd.org)
Message-Id: <201111011828.pA1ISXNT078662@svn.freebsd.org>
From: Marius Strobl 
Date: Tue, 1 Nov 2011 18:28:33 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r227001 - head/sys/dev/mpt
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: 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, 01 Nov 2011 18:28:34 -0000

Author: marius
Date: Tue Nov  1 18:28:33 2011
New Revision: 227001
URL: http://svn.freebsd.org/changeset/base/227001

Log:
  Increase the IOC port initialization timeouts by ten times to what the
  corresponding Linux driver uses. This allows mpt(4) to still recognize
  all good SATA devices in presence of a defective one, which takes about
  45 seconds.
  In the long term we probably should implement the logic used by mpt2sas(4)
  allowing IOC port initialization to complete at a later time.
  
  Submitted by:	Andrew Boyer
  MFC after:	3 days

Modified:
  head/sys/dev/mpt/mpt.c

Modified: head/sys/dev/mpt/mpt.c
==============================================================================
--- head/sys/dev/mpt/mpt.c	Tue Nov  1 17:57:21 2011	(r227000)
+++ head/sys/dev/mpt/mpt.c	Tue Nov  1 18:28:33 2011	(r227001)
@@ -2084,7 +2084,7 @@ mpt_send_port_enable(struct mpt_softc *m
 
 	mpt_send_cmd(mpt, req);
 	error = mpt_wait_req(mpt, req, REQ_STATE_DONE, REQ_STATE_DONE,
-	    FALSE, (mpt->is_sas || mpt->is_fc)? 30000 : 3000);
+	    FALSE, (mpt->is_sas || mpt->is_fc)? 300000 : 30000);
 	if (error != 0) {
 		mpt_prt(mpt, "port %d enable timed out\n", port);
 		return (-1);

From owner-svn-src-head@FreeBSD.ORG  Tue Nov  1 20:56:19 2011
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 84848106564A;
	Tue,  1 Nov 2011 20:56: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 73DE08FC16;
	Tue,  1 Nov 2011 20:56:19 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pA1KuJfM083267;
	Tue, 1 Nov 2011 20:56:19 GMT (envelope-from mav@svn.freebsd.org)
Received: (from mav@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id pA1KuJrt083264;
	Tue, 1 Nov 2011 20:56:19 GMT (envelope-from mav@svn.freebsd.org)
Message-Id: <201111012056.pA1KuJrt083264@svn.freebsd.org>
From: Alexander Motin 
Date: Tue, 1 Nov 2011 20:56: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: r227004 - head/sys/geom/concat
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: 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, 01 Nov 2011 20:56:19 -0000

Author: mav
Date: Tue Nov  1 20:56:19 2011
New Revision: 227004
URL: http://svn.freebsd.org/changeset/base/227004

Log:
  Refactor disk disconnection and geom destruction handling sequences.
  Do not close/destroy opened consumer directly in case of disconnect. Instead
  keep it existing until it will be closed in regular way in response to
  upstream provider destruction. Delay geom destruction in the same way.
  Previous implementation could destroy consumers still having active
  requests and worked only because of global workaround made on GEOM level.

Modified:
  head/sys/geom/concat/g_concat.c
  head/sys/geom/concat/g_concat.h

Modified: head/sys/geom/concat/g_concat.c
==============================================================================
--- head/sys/geom/concat/g_concat.c	Tue Nov  1 19:29:03 2011	(r227003)
+++ head/sys/geom/concat/g_concat.c	Tue Nov  1 20:56:19 2011	(r227004)
@@ -117,25 +117,33 @@ g_concat_remove_disk(struct g_concat_dis
 	struct g_consumer *cp;
 	struct g_concat_softc *sc;
 
+	g_topology_assert();
 	KASSERT(disk->d_consumer != NULL, ("Non-valid disk in %s.", __func__));
 	sc = disk->d_softc;
 	cp = disk->d_consumer;
 
-	G_CONCAT_DEBUG(0, "Disk %s removed from %s.", cp->provider->name,
-	    sc->sc_name);
+	if (!disk->d_removed) {
+		G_CONCAT_DEBUG(0, "Disk %s removed from %s.",
+		    cp->provider->name, sc->sc_name);
+		disk->d_removed = 1;
+	}
 
-	disk->d_consumer = NULL;
 	if (sc->sc_provider != NULL) {
 		sc->sc_provider->flags |= G_PF_WITHER;
+		G_CONCAT_DEBUG(0, "Device %s deactivated.",
+		    sc->sc_provider->name);
 		g_orphan_provider(sc->sc_provider, ENXIO);
 		sc->sc_provider = NULL;
-		G_CONCAT_DEBUG(0, "Device %s removed.", sc->sc_name);
 	}
 
 	if (cp->acr > 0 || cp->acw > 0 || cp->ace > 0)
-		g_access(cp, -cp->acr, -cp->acw, -cp->ace);
+		return;
+	disk->d_consumer = NULL;
 	g_detach(cp);
 	g_destroy_consumer(cp);
+	/* If there are no valid disks anymore, remove device. */
+	if (LIST_EMPTY(&sc->sc_geom->consumer))
+		g_concat_destroy(sc, 1);
 }
 
 static void
@@ -155,37 +163,18 @@ g_concat_orphan(struct g_consumer *cp)
 	if (disk == NULL)	/* Possible? */
 		return;
 	g_concat_remove_disk(disk);
-
-	/* If there are no valid disks anymore, remove device. */
-	if (g_concat_nvalid(sc) == 0)
-		g_concat_destroy(sc, 1);
 }
 
 static int
 g_concat_access(struct g_provider *pp, int dr, int dw, int de)
 {
-	struct g_consumer *cp1, *cp2;
-	struct g_concat_softc *sc;
+	struct g_consumer *cp1, *cp2, *tmp;
+	struct g_concat_disk *disk;
 	struct g_geom *gp;
 	int error;
 
+	g_topology_assert();
 	gp = pp->geom;
-	sc = gp->softc;
-
-	if (sc == NULL) {
-		/*
-		 * It looks like geom is being withered.
-		 * In that case we allow only negative requests.
-		 */
-		KASSERT(dr <= 0 && dw <= 0 && de <= 0,
-		    ("Positive access request (device=%s).", pp->name));
-		if ((pp->acr + dr) == 0 && (pp->acw + dw) == 0 &&
-		    (pp->ace + de) == 0) {
-			G_CONCAT_DEBUG(0, "Device %s definitely destroyed.",
-			    gp->name);
-		}
-		return (0);
-	}
 
 	/* On first open, grab an extra "exclusive" bit */
 	if (pp->acr == 0 && pp->acw == 0 && pp->ace == 0)
@@ -194,22 +183,24 @@ g_concat_access(struct g_provider *pp, i
 	if ((pp->acr + dr) == 0 && (pp->acw + dw) == 0 && (pp->ace + de) == 0)
 		de--;
 
-	error = ENXIO;
-	LIST_FOREACH(cp1, &gp->consumer, consumer) {
+	LIST_FOREACH_SAFE(cp1, &gp->consumer, consumer, tmp) {
 		error = g_access(cp1, dr, dw, de);
-		if (error == 0)
-			continue;
-		/*
-		 * If we fail here, backout all previous changes.
-		 */
-		LIST_FOREACH(cp2, &gp->consumer, consumer) {
-			if (cp1 == cp2)
-				return (error);
-			g_access(cp2, -dr, -dw, -de);
+		if (error != 0)
+			goto fail;
+		disk = cp1->private;
+		if (cp1->acr == 0 && cp1->acw == 0 && cp1->ace == 0 &&
+		    disk->d_removed) {
+			g_concat_remove_disk(disk); /* May destroy geom. */
 		}
-		/* NOTREACHED */
 	}
+	return (0);
 
+fail:
+	LIST_FOREACH(cp2, &gp->consumer, consumer) {
+		if (cp1 == cp2)
+			break;
+		g_access(cp2, -dr, -dw, -de);
+	}
 	return (error);
 }
 
@@ -391,6 +382,7 @@ g_concat_check_and_run(struct g_concat_s
 	u_int no, sectorsize = 0;
 	off_t start;
 
+	g_topology_assert();
 	if (g_concat_nvalid(sc) != sc->sc_ndisks)
 		return;
 
@@ -419,7 +411,7 @@ g_concat_check_and_run(struct g_concat_s
 	sc->sc_provider = pp;
 	g_error_provider(pp, 0);
 
-	G_CONCAT_DEBUG(0, "Device %s activated.", sc->sc_name);
+	G_CONCAT_DEBUG(0, "Device %s activated.", sc->sc_provider->name);
 }
 
 static int
@@ -461,6 +453,7 @@ g_concat_add_disk(struct g_concat_softc 
 	struct g_geom *gp;
 	int error;
 
+	g_topology_assert();
 	/* Metadata corrupted? */
 	if (no >= sc->sc_ndisks)
 		return (EINVAL);
@@ -509,6 +502,7 @@ g_concat_add_disk(struct g_concat_softc 
 	disk->d_softc = sc;
 	disk->d_start = 0;	/* not yet */
 	disk->d_end = 0;	/* not yet */
+	disk->d_removed = 0;
 
 	G_CONCAT_DEBUG(0, "Disk %s attached to %s.", pp->name, sc->sc_name);
 
@@ -576,8 +570,8 @@ static int
 g_concat_destroy(struct g_concat_softc *sc, boolean_t force)
 {
 	struct g_provider *pp;
+	struct g_consumer *cp, *cp1;
 	struct g_geom *gp;
-	u_int no;
 
 	g_topology_assert();
 
@@ -597,24 +591,23 @@ g_concat_destroy(struct g_concat_softc *
 		}
 	}
 
-	for (no = 0; no < sc->sc_ndisks; no++) {
-		if (sc->sc_disks[no].d_consumer != NULL)
-			g_concat_remove_disk(&sc->sc_disks[no]);
+	gp = sc->sc_geom;
+	LIST_FOREACH_SAFE(cp, &gp->consumer, consumer, cp1) {
+		g_concat_remove_disk(cp->private);
+		if (cp1 == NULL)
+			return (0);	/* Recursion happened. */
 	}
+	if (!LIST_EMPTY(&gp->consumer))
+		return (EINPROGRESS);
 
-	gp = sc->sc_geom;
 	gp->softc = NULL;
 	KASSERT(sc->sc_provider == NULL, ("Provider still exists? (device=%s)",
 	    gp->name));
 	free(sc->sc_disks, M_CONCAT);
 	free(sc, M_CONCAT);
 
-	pp = LIST_FIRST(&gp->provider);
-	if (pp == NULL || (pp->acr == 0 && pp->acw == 0 && pp->ace == 0))
-		G_CONCAT_DEBUG(0, "Device %s destroyed.", gp->name);
-
+	G_CONCAT_DEBUG(0, "Device %s destroyed.", gp->name);
 	g_wither_geom(gp, ENXIO);
-
 	return (0);
 }
 

Modified: head/sys/geom/concat/g_concat.h
==============================================================================
--- head/sys/geom/concat/g_concat.h	Tue Nov  1 19:29:03 2011	(r227003)
+++ head/sys/geom/concat/g_concat.h	Tue Nov  1 20:56:19 2011	(r227004)
@@ -72,6 +72,7 @@ struct g_concat_disk {
 	struct g_concat_softc	*d_softc;
 	off_t			 d_start;
 	off_t			 d_end;
+	int			 d_removed;
 };
 
 struct g_concat_softc {

From owner-svn-src-head@FreeBSD.ORG  Tue Nov  1 21:26:58 2011
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 3CFE7106564A;
	Tue,  1 Nov 2011 21:26:58 +0000 (UTC)
	(envelope-from marius@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 29E2D8FC08;
	Tue,  1 Nov 2011 21:26:58 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pA1LQw2E084296;
	Tue, 1 Nov 2011 21:26:58 GMT (envelope-from marius@svn.freebsd.org)
Received: (from marius@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id pA1LQvhv084284;
	Tue, 1 Nov 2011 21:26:58 GMT (envelope-from marius@svn.freebsd.org)
Message-Id: <201111012126.pA1LQvhv084284@svn.freebsd.org>
From: Marius Strobl 
Date: Tue, 1 Nov 2011 21:26: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: r227006 - in head: . sys/amd64/conf sys/conf
	sys/dev/esp sys/i386/conf sys/modules sys/modules/esp
	sys/pc98/conf sys/sparc64/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, 01 Nov 2011 21:26:58 -0000

Author: marius
Date: Tue Nov  1 21:26:57 2011
New Revision: 227006
URL: http://svn.freebsd.org/changeset/base/227006

Log:
  Add a PCI front-end to esp(4) allowing it to support AMD Am53C974 and
  replace amd(4) with the former in the amd64, i386 and pc98 GENERIC kernel
  configuration files. Besides duplicating functionality, amd(4), which
  previously also supported the AMD Am53C974, unlike esp(4) is no longer
  maintained and has accumulated enough bit rot over time to always cause
  a panic during boot as long as at least one target is attached to it
  (see PR 124667).
  
  PR:		124667
  Obtained from:	NetBSD (based on)
  MFC after:	3 days

Added:
  head/sys/dev/esp/am53c974reg.h   (contents, props changed)
  head/sys/dev/esp/esp_pci.c   (contents, props changed)
Modified:
  head/UPDATING
  head/sys/amd64/conf/GENERIC
  head/sys/conf/NOTES
  head/sys/conf/files
  head/sys/i386/conf/GENERIC
  head/sys/modules/Makefile
  head/sys/modules/esp/Makefile
  head/sys/pc98/conf/GENERIC
  head/sys/sparc64/conf/GENERIC

Modified: head/UPDATING
==============================================================================
--- head/UPDATING	Tue Nov  1 21:21:36 2011	(r227005)
+++ head/UPDATING	Tue Nov  1 21:26:57 2011	(r227006)
@@ -22,6 +22,10 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 10
 	machines to maximize performance.  (To disable malloc debugging, run
 	ln -s aj /etc/malloc.conf.)
 
+20111101:
+	The broken amd(4) driver has been replaced with esp(4) in the amd64,
+	i386 and pc98 GENERIC kernel configuration files.
+
 20110930:
 	sysinstall has been removed
 

Modified: head/sys/amd64/conf/GENERIC
==============================================================================
--- head/sys/amd64/conf/GENERIC	Tue Nov  1 21:21:36 2011	(r227005)
+++ head/sys/amd64/conf/GENERIC	Tue Nov  1 21:26:57 2011	(r227006)
@@ -107,7 +107,7 @@ options 	AHC_REG_PRETTY_PRINT	# Print re
 device		ahd		# AHA39320/29320 and onboard AIC79xx devices
 options 	AHD_REG_PRETTY_PRINT	# Print register bitfields in debug
 					# output.  Adds ~215k to driver.
-device		amd		# AMD 53C974 (Tekram DC-390(T))
+device		esp		# AMD Am53C974 (Tekram DC-390(T))
 device		hptiop		# Highpoint RocketRaid 3xxx series
 device		isp		# Qlogic family
 #device		ispfw		# Firmware for QLogic HBAs- normally a module

Modified: head/sys/conf/NOTES
==============================================================================
--- head/sys/conf/NOTES	Tue Nov  1 21:21:36 2011	(r227005)
+++ head/sys/conf/NOTES	Tue Nov  1 21:26:57 2011	(r227006)
@@ -1459,7 +1459,9 @@ options 	TEKEN_UTF8		# UTF-8 output hand
 #      such as the Tekram DC-390(T).
 # bt:  Most Buslogic controllers: including BT-445, BT-54x, BT-64x, BT-74x,
 #      BT-75x, BT-946, BT-948, BT-956, BT-958, SDC3211B, SDC3211F, SDC3222F
-# esp: NCR53c9x.  Only for SBUS hardware right now.
+# esp: Emulex ESP, NCR 53C9x and QLogic FAS families based controllers
+#      including the AMD Am53C974 (found on devices such as the Tekram
+#      DC-390(T)) and the Sun ESP and FAS families of controllers
 # isp: Qlogic ISP 1020, 1040 and 1040B PCI SCSI host adapters,
 #      ISP 1240 Dual Ultra SCSI, ISP 1080 and 1280 (Dual) Ultra2,
 #      ISP 12160 Ultra3 SCSI,

Modified: head/sys/conf/files
==============================================================================
--- head/sys/conf/files	Tue Nov  1 21:21:36 2011	(r227005)
+++ head/sys/conf/files	Tue Nov  1 21:26:57 2011	(r227006)
@@ -1064,6 +1064,7 @@ dev/ep/if_ep_eisa.c		optional ep eisa
 dev/ep/if_ep_isa.c		optional ep isa
 dev/ep/if_ep_mca.c		optional ep mca
 dev/ep/if_ep_pccard.c		optional ep pccard
+dev/esp/esp_pci.c		optional esp pci
 dev/esp/ncr53c9x.c		optional esp
 dev/ex/if_ex.c			optional ex
 dev/ex/if_ex_isa.c		optional ex isa

Added: head/sys/dev/esp/am53c974reg.h
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/sys/dev/esp/am53c974reg.h	Tue Nov  1 21:26:57 2011	(r227006)
@@ -0,0 +1,72 @@
+/*	$NetBSD: pcscpreg.h,v 1.2 2008/04/28 20:23:55 martin Exp $	*/
+
+/*-
+ * Copyright (c) 1998 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Izumi Tsutsui.
+ *
+ * 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 NETBSD FOUNDATION, INC. 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 FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/* $FreeBSD$ */
+
+#ifndef _AM53C974_H_
+#define	_AM53C974_H_
+
+/*
+ * Am53c974 DMA engine registers
+ */
+
+#define	DMA_CMD		0x40 		/* Command */
+#define	 DMACMD_RSVD	0xFFFFFF28	/* reserved */
+#define	 DMACMD_DIR	0x00000080	/* Transfer Direction (read:1) */
+#define	 DMACMD_INTE	0x00000040	/* DMA Interrupt Enable	*/
+#define	 DMACMD_MDL	0x00000010	/* Map to Memory Description List */
+#define	 DMACMD_DIAG	0x00000004	/* Diagnostic */
+#define	 DMACMD_CMD	0x00000003	/* Command Code Bit */
+#define	  DMACMD_IDLE	0x00000000	/*  Idle */
+#define	  DMACMD_BLAST	0x00000001	/*  Blast */
+#define	  DMACMD_ABORT	0x00000002	/*  Abort */
+#define	  DMACMD_START	0x00000003	/*  Start */
+
+#define	DMA_STC		0x44		/* Start Transfer Count */
+#define	DMA_SPA		0x48		/* Start Physical Address */
+#define	DMA_WBC		0x4C		/* Working Byte Counter */
+#define	DMA_WAC		0x50		/* Working Address Counter */
+
+#define	DMA_STAT	0x54		/* Status Register */
+#define	 DMASTAT_RSVD	0xFFFFFF80	/* reserved */
+#define	 DMASTAT_PABT	0x00000040	/* PCI master/target Abort */
+#define	 DMASTAT_BCMP	0x00000020	/* BLAST Complete */
+#define	 DMASTAT_SINT	0x00000010	/* SCSI Interrupt */
+#define	 DMASTAT_DONE	0x00000008	/* DMA Transfer Terminated */
+#define	 DMASTAT_ABT	0x00000004	/* DMA Transfer Aborted */
+#define	 DMASTAT_ERR	0x00000002	/* DMA Transfer Error */
+#define	 DMASTAT_PWDN	0x00000001	/* Power Down Indicator */
+
+#define	DMA_SMDLA	0x58	/* Starting Memory Descpritor List Address */
+#define	DMA_WMAC	0x5C	/* Working MDL Counter */
+#define	DMA_SBAC	0x70	/* SCSI Bus and Control */
+
+#endif /* _AM53C974_H_ */

Added: head/sys/dev/esp/esp_pci.c
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/sys/dev/esp/esp_pci.c	Tue Nov  1 21:26:57 2011	(r227006)
@@ -0,0 +1,654 @@
+/*-
+ * Copyright (c) 2011 Marius Strobl 
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+/*	$NetBSD: pcscp.c,v 1.45 2010/11/13 13:52:08 uebayasi Exp $	*/
+
+/*-
+ * Copyright (c) 1997, 1998, 1999 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Jason R. Thorpe of the Numerical Aerospace Simulation Facility,
+ * NASA Ames Research Center; Izumi Tsutsui.
+ *
+ * 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 NETBSD FOUNDATION, INC. 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 FOUNDATION 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.
+ */
+
+/*
+ * esp_pci.c: device dependent code for AMD Am53c974 (PCscsi-PCI)
+ * written by Izumi Tsutsui 
+ *
+ * Technical manual available at
+ * http://www.amd.com/files/connectivitysolutions/networking/archivednetworking/19113.pdf
+ */
+
+#include 
+__FBSDID("$FreeBSD$");
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+
+#include 
+#include 
+#include 
+
+#include 
+#include 
+
+#include 
+#include 
+
+#include 
+
+#define	PCI_DEVICE_ID_AMD53C974	0x20201022
+
+struct esp_pci_softc {
+	struct ncr53c9x_softc	sc_ncr53c9x;	/* glue to MI code */
+	struct device		*sc_dev;
+
+	struct resource *sc_res[2];
+#define	ESP_PCI_RES_INTR	0
+#define	ESP_PCI_RES_IO		1
+
+	bus_dma_tag_t		sc_pdmat;
+
+	bus_dma_tag_t		sc_xferdmat;	/* DMA tag for transfers */
+	bus_dmamap_t		sc_xferdmam;	/* DMA map for transfers */
+
+	void			*sc_ih;		/* interrupt handler */
+
+	size_t			sc_dmasize;	/* DMA size */
+	void			**sc_dmaaddr;	/* DMA address */
+	size_t			*sc_dmalen;	/* DMA length */
+	int			sc_active;	/* DMA state */
+	int			sc_datain;	/* DMA Data Direction */
+};
+
+static struct resource_spec esp_pci_res_spec[] = {
+	{ SYS_RES_IRQ, 0, RF_SHAREABLE | RF_ACTIVE },	/* ESP_PCI_RES_INTR */
+	{ SYS_RES_IOPORT, PCIR_BAR(0), RF_ACTIVE },	/* ESP_PCI_RES_IO */
+	{ -1, 0 }
+};
+
+#define	READ_DMAREG(sc, reg)						\
+	bus_read_4((sc)->sc_res[ESP_PCI_RES_IO], (reg))
+#define	WRITE_DMAREG(sc, reg, var)					\
+	bus_write_4((sc)->sc_res[ESP_PCI_RES_IO], (reg), (var))
+
+#define	READ_ESPREG(sc, reg)						\
+	bus_read_1((sc)->sc_res[ESP_PCI_RES_IO], (reg) << 2)
+#define	WRITE_ESPREG(sc, reg, val)					\
+	bus_write_1((sc)->sc_res[ESP_PCI_RES_IO], (reg) << 2, (val))
+
+static int	esp_pci_probe(device_t);
+static int	esp_pci_attach(device_t);
+static int	esp_pci_detach(device_t);
+static int	esp_pci_suspend(device_t);
+static int	esp_pci_resume(device_t);
+
+static device_method_t esp_pci_methods[] = {
+	DEVMETHOD(device_probe,		esp_pci_probe),
+	DEVMETHOD(device_attach,	esp_pci_attach),
+	DEVMETHOD(device_detach,	esp_pci_detach),
+	DEVMETHOD(device_suspend,	esp_pci_suspend),
+	DEVMETHOD(device_resume,	esp_pci_resume),
+
+	KOBJMETHOD_END
+};
+
+static driver_t esp_pci_driver = {
+	"esp",
+	esp_pci_methods,
+	sizeof(struct esp_pci_softc)
+};
+
+DRIVER_MODULE(esp, pci, esp_pci_driver, esp_devclass, 0, 0);
+MODULE_DEPEND(esp, pci, 1, 1, 1);
+
+/*
+ * Functions and the switch for the MI code
+ */
+static void	esp_pci_dma_go(struct ncr53c9x_softc *);
+static int	esp_pci_dma_intr(struct ncr53c9x_softc *);
+static int	esp_pci_dma_isactive(struct ncr53c9x_softc *);
+
+static int	esp_pci_dma_isintr(struct ncr53c9x_softc *);
+static void	esp_pci_dma_reset(struct ncr53c9x_softc *);
+static int	esp_pci_dma_setup(struct ncr53c9x_softc *, void **, size_t *,
+		    int, size_t *);
+static void	esp_pci_dma_stop(struct ncr53c9x_softc *);
+static void	esp_pci_write_reg(struct ncr53c9x_softc *, int, uint8_t);
+static uint8_t	esp_pci_read_reg(struct ncr53c9x_softc *, int);
+static void	esp_pci_xfermap(void *arg, bus_dma_segment_t *segs, int nseg,
+		    int error);
+
+static struct ncr53c9x_glue esp_pci_glue = {
+	esp_pci_read_reg,
+	esp_pci_write_reg,
+	esp_pci_dma_isintr,
+	esp_pci_dma_reset,
+	esp_pci_dma_intr,
+	esp_pci_dma_setup,
+	esp_pci_dma_go,
+	esp_pci_dma_stop,
+	esp_pci_dma_isactive,
+};
+
+static int
+esp_pci_probe(device_t dev)
+{
+
+	if (pci_get_devid(dev) == PCI_DEVICE_ID_AMD53C974) {
+		device_set_desc(dev, "AMD Am53C974 Fast-SCSI");
+		return (BUS_PROBE_DEFAULT);
+	}
+
+	return (ENXIO);
+}
+
+/*
+ * Attach this instance, and then all the sub-devices
+ */
+static int
+esp_pci_attach(device_t dev)
+{
+	struct esp_pci_softc *esc;
+	struct ncr53c9x_softc *sc;
+	int error;
+
+	esc = device_get_softc(dev);
+	sc = &esc->sc_ncr53c9x;
+
+	NCR_LOCK_INIT(sc);
+
+	esc->sc_dev = dev;
+	sc->sc_glue = &esp_pci_glue;
+
+	pci_enable_busmaster(dev);
+
+	error = bus_alloc_resources(dev, esp_pci_res_spec, esc->sc_res);
+	if (error != 0) {
+		device_printf(dev, "failed to allocate resources\n");
+		bus_release_resources(dev, esp_pci_res_spec, esc->sc_res);
+		return (error);
+	}
+
+	error = bus_dma_tag_create(bus_get_dma_tag(dev), 1, 0,
+	    BUS_SPACE_MAXADDR_32BIT, BUS_SPACE_MAXADDR, NULL, NULL,
+	    BUS_SPACE_MAXSIZE_32BIT, BUS_SPACE_UNRESTRICTED,
+	    BUS_SPACE_MAXSIZE_32BIT, 0, NULL, NULL, &esc->sc_pdmat);
+	if (error != 0) {
+		device_printf(dev, "cannot create parent DMA tag\n");
+		goto fail_res;
+	}
+
+	/*
+	 * XXX More of this should be in ncr53c9x_attach(), but
+	 * XXX should we really poke around the chip that much in
+	 * XXX the MI code?  Think about this more...
+	 */
+
+	/*
+	 * Set up static configuration info.
+	 *
+	 * XXX we should read the configuration from the EEPROM.
+	 */
+	sc->sc_id = 7;
+	sc->sc_cfg1 = sc->sc_id | NCRCFG1_PARENB;
+	sc->sc_cfg2 = NCRCFG2_SCSI2 | NCRCFG2_FE;
+	sc->sc_cfg3 = NCRAMDCFG3_IDM | NCRAMDCFG3_FCLK;
+	sc->sc_cfg4 = NCRAMDCFG4_GE12NS | NCRAMDCFG4_RADE;
+	sc->sc_rev = NCR_VARIANT_AM53C974;
+	sc->sc_features = NCR_F_FASTSCSI | NCR_F_DMASELECT;
+	sc->sc_cfg3_fscsi = NCRAMDCFG3_FSCSI;
+	sc->sc_freq = 40; /* MHz */
+
+	/*
+	 * This is the value used to start sync negotiations
+	 * Note that the NCR register "SYNCTP" is programmed
+	 * in "clocks per byte", and has a minimum value of 4.
+	 * The SCSI period used in negotiation is one-fourth
+	 * of the time (in nanoseconds) needed to transfer one byte.
+	 * Since the chip's clock is given in MHz, we have the following
+	 * formula: 4 * period = (1000 / freq) * 4
+	 */
+	sc->sc_minsync = 1000 / sc->sc_freq;
+
+	sc->sc_maxxfer = DFLTPHYS;	/* see below */
+	sc->sc_maxoffset = 15;
+	sc->sc_extended_geom = 1;
+
+#define	MDL_SEG_SIZE	0x1000	/* 4kbyte per segment */
+
+	/*
+	 * Create the DMA tag and map for the data transfers.
+	 *
+	 * Note: given that bus_dma(9) only adheres to the requested alignment
+	 * for the first segment (and that also only for bus_dmamem_alloc()ed
+	 * DMA maps) we can't use the Memory Descriptor List.  However, also
+	 * when not using the MDL, the maximum transfer size apparently is
+	 * limited to 4k so we have to split transfers up, which plain sucks.
+	 */
+	error = bus_dma_tag_create(esc->sc_pdmat, PAGE_SIZE, 0,
+	    BUS_SPACE_MAXADDR_32BIT, BUS_SPACE_MAXADDR, NULL, NULL,
+	    MDL_SEG_SIZE, 1, MDL_SEG_SIZE, BUS_DMA_ALLOCNOW,
+	    busdma_lock_mutex, &sc->sc_lock, &esc->sc_xferdmat);
+	if (error != 0) {
+		device_printf(dev, "cannot create transfer DMA tag\n");
+		goto fail_pdmat;
+	}
+	error = bus_dmamap_create(esc->sc_xferdmat, 0, &esc->sc_xferdmam);
+	if (error != 0) {
+		device_printf(dev, "cannnot create transfer DMA map\n");
+		goto fail_xferdmat;
+	}
+
+	error = bus_setup_intr(dev, esc->sc_res[ESP_PCI_RES_INTR],
+	    INTR_MPSAFE | INTR_TYPE_CAM, NULL, ncr53c9x_intr, sc,
+	    &esc->sc_ih);
+	if (error != 0) {
+		device_printf(dev, "cannot set up interrupt\n");
+		goto fail_xferdmam;
+	}
+
+	/* Do the common parts of attachment. */
+	sc->sc_dev = esc->sc_dev;
+	error = ncr53c9x_attach(sc);
+	if (error != 0) {
+		device_printf(esc->sc_dev, "ncr53c9x_attach failed\n");
+		goto fail_intr;
+	}
+
+	return (0);
+
+ fail_intr:
+	 bus_teardown_intr(esc->sc_dev, esc->sc_res[ESP_PCI_RES_INTR],
+	    esc->sc_ih);
+ fail_xferdmam:
+	bus_dmamap_destroy(esc->sc_xferdmat, esc->sc_xferdmam);
+ fail_xferdmat:
+	bus_dma_tag_destroy(esc->sc_xferdmat);
+ fail_pdmat:
+	bus_dma_tag_destroy(esc->sc_pdmat);
+ fail_res:
+	bus_release_resources(dev, esp_pci_res_spec, esc->sc_res);
+	NCR_LOCK_DESTROY(sc);
+
+	return (error);
+}
+
+static int
+esp_pci_detach(device_t dev)
+{
+	struct ncr53c9x_softc *sc;
+	struct esp_pci_softc *esc;
+	int error;
+
+	esc = device_get_softc(dev);
+	sc = &esc->sc_ncr53c9x;
+
+	bus_teardown_intr(esc->sc_dev, esc->sc_res[ESP_PCI_RES_INTR],
+	    esc->sc_ih);
+	error = ncr53c9x_detach(sc);
+	if (error != 0)
+		return (error);
+	bus_dmamap_destroy(esc->sc_xferdmat, esc->sc_xferdmam);
+	bus_dma_tag_destroy(esc->sc_xferdmat);
+	bus_dma_tag_destroy(esc->sc_pdmat);
+	bus_release_resources(dev, esp_pci_res_spec, esc->sc_res);
+	NCR_LOCK_DESTROY(sc);
+
+	return (0);
+}
+
+static int
+esp_pci_suspend(device_t dev)
+{
+
+	return (ENXIO);
+}
+
+static int
+esp_pci_resume(device_t dev)
+{
+
+	return (ENXIO);
+}
+
+static void
+esp_pci_xfermap(void *arg, bus_dma_segment_t *segs, int nsegs, int error)
+{
+	struct esp_pci_softc *esc = (struct esp_pci_softc *)arg;
+
+	if (error != 0)
+		return;
+
+	KASSERT(nsegs == 1, ("%s: bad transfer segment count %d", __func__,
+	    nsegs));
+	KASSERT(segs[0].ds_len <= MDL_SEG_SIZE,
+	    ("%s: bad transfer segment length %ld", __func__,
+	    (long)segs[0].ds_len));
+
+	/* Program the DMA Starting Physical Address. */
+	WRITE_DMAREG(esc, DMA_SPA, segs[0].ds_addr);
+}
+
+/*
+ * Glue functions
+ */
+
+static uint8_t
+esp_pci_read_reg(struct ncr53c9x_softc *sc, int reg)
+{
+	struct esp_pci_softc *esc = (struct esp_pci_softc *)sc;
+
+	return (READ_ESPREG(esc, reg));
+}
+
+static void
+esp_pci_write_reg(struct ncr53c9x_softc *sc, int reg, uint8_t v)
+{
+	struct esp_pci_softc *esc = (struct esp_pci_softc *)sc;
+
+	WRITE_ESPREG(esc, reg, v);
+}
+
+static int
+esp_pci_dma_isintr(struct ncr53c9x_softc *sc)
+{
+	struct esp_pci_softc *esc = (struct esp_pci_softc *)sc;
+
+	return (READ_ESPREG(esc, NCR_STAT) & NCRSTAT_INT) != 0;
+}
+
+static void
+esp_pci_dma_reset(struct ncr53c9x_softc *sc)
+{
+	struct esp_pci_softc *esc = (struct esp_pci_softc *)sc;
+
+	WRITE_DMAREG(esc, DMA_CMD, DMACMD_IDLE);
+
+	esc->sc_active = 0;
+}
+
+static int
+esp_pci_dma_intr(struct ncr53c9x_softc *sc)
+{
+	struct esp_pci_softc *esc = (struct esp_pci_softc *)sc;
+	bus_dma_tag_t xferdmat;
+	bus_dmamap_t xferdmam;
+	size_t dmasize;
+	int datain, i, resid, trans;
+	uint32_t dmastat;
+	char *p = NULL;
+
+	xferdmat = esc->sc_xferdmat;
+	xferdmam = esc->sc_xferdmam;
+	datain = esc->sc_datain;
+
+	dmastat = READ_DMAREG(esc, DMA_STAT);
+
+	if ((dmastat & DMASTAT_ERR) != 0) {
+		/* XXX not tested... */
+		WRITE_DMAREG(esc, DMA_CMD, DMACMD_ABORT | (datain != 0 ?
+		    DMACMD_DIR : 0));
+
+		device_printf(esc->sc_dev, "DMA error detected; Aborting.\n");
+		bus_dmamap_sync(xferdmat, xferdmam, datain != 0 ?
+		    BUS_DMASYNC_POSTREAD : BUS_DMASYNC_POSTWRITE);
+		bus_dmamap_unload(xferdmat, xferdmam);
+		return (-1);
+	}
+
+	if ((dmastat & DMASTAT_ABT) != 0) {
+		/* XXX what should be done? */
+		device_printf(esc->sc_dev, "DMA aborted.\n");
+		WRITE_DMAREG(esc, DMA_CMD, DMACMD_IDLE | (datain != 0 ?
+		    DMACMD_DIR : 0));
+		esc->sc_active = 0;
+		return (0);
+	}
+
+	KASSERT(esc->sc_active != 0, ("%s: DMA wasn't active", __func__));
+
+	/* DMA has stopped. */
+
+	esc->sc_active = 0;
+
+	dmasize = esc->sc_dmasize;
+	if (dmasize == 0) {
+		/* A "Transfer Pad" operation completed. */
+		NCR_DMA(("%s: discarded %d bytes (tcl=%d, tcm=%d)\n",
+		    __func__, READ_ESPREG(esc, NCR_TCL) |
+		    (READ_ESPREG(esc, NCR_TCM) << 8),
+		    READ_ESPREG(esc, NCR_TCL), READ_ESPREG(esc, NCR_TCM)));
+		return (0);
+	}
+
+	resid = 0;
+	/*
+	 * If a transfer onto the SCSI bus gets interrupted by the device
+	 * (e.g. for a SAVEPOINTER message), the data in the FIFO counts
+	 * as residual since the ESP counter registers get decremented as
+	 * bytes are clocked into the FIFO.
+	 */
+	if (datain == 0 &&
+	    (resid = (READ_ESPREG(esc, NCR_FFLAG) & NCRFIFO_FF)) != 0)
+		NCR_DMA(("%s: empty esp FIFO of %d ", __func__, resid));
+
+	if ((sc->sc_espstat & NCRSTAT_TC) == 0) {
+		/*
+		 * "Terminal count" is off, so read the residue
+		 * out of the ESP counter registers.
+		 */
+		if (datain != 0) {
+			resid = READ_ESPREG(esc, NCR_FFLAG) & NCRFIFO_FF;
+			while (resid > 1)
+				resid =
+				    READ_ESPREG(esc, NCR_FFLAG) & NCRFIFO_FF;
+			WRITE_DMAREG(esc, DMA_CMD, DMACMD_BLAST | DMACMD_DIR);
+
+			for (i = 0; i < 0x8000; i++) /* XXX 0x8000 ? */
+				if ((READ_DMAREG(esc, DMA_STAT) &
+				    DMASTAT_BCMP) != 0)
+					break;
+
+			/* See the below comments... */
+			if (resid != 0)
+				p = *esc->sc_dmaaddr;
+		}
+
+		resid += READ_ESPREG(esc, NCR_TCL) |
+		    (READ_ESPREG(esc, NCR_TCM) << 8) |
+		    (READ_ESPREG(esc, NCR_TCH) << 16);
+	} else
+		while ((dmastat & DMASTAT_DONE) == 0)
+			dmastat = READ_DMAREG(esc, DMA_STAT);
+
+	WRITE_DMAREG(esc, DMA_CMD, DMACMD_IDLE | (datain != 0 ?
+	    DMACMD_DIR : 0));
+
+	/* Sync the transfer buffer. */
+	bus_dmamap_sync(xferdmat, xferdmam, datain != 0 ?
+	    BUS_DMASYNC_POSTREAD : BUS_DMASYNC_POSTWRITE);
+	bus_dmamap_unload(xferdmat, xferdmam);
+
+	trans = dmasize - resid;
+
+	/*
+	 * From the technical manual notes:
+	 *
+	 * "In some odd byte conditions, one residual byte will be left
+	 *  in the SCSI FIFO, and the FIFO flags will never count to 0.
+	 *  When this happens, the residual byte should be retrieved
+	 *  via PIO following completion of the BLAST operation."
+	 */
+	if (p != NULL) {
+		p += trans;
+		*p = READ_ESPREG(esc, NCR_FIFO);
+		trans++;
+	}
+
+	if (trans < 0) {			/* transferred < 0 ? */
+#if 0
+		/*
+		 * This situation can happen in perfectly normal operation
+		 * if the ESP is reselected while using DMA to select
+		 * another target.  As such, don't print the warning.
+		 */
+		device_printf(dev, "xfer (%d) > req (%d)\n", trans, dmasize);
+#endif
+		trans = dmasize;
+	}
+
+	NCR_DMA(("%s: tcl=%d, tcm=%d, tch=%d; trans=%d, resid=%d\n", __func__,
+	    READ_ESPREG(esc, NCR_TCL), READ_ESPREG(esc, NCR_TCM),
+	    READ_ESPREG(esc, NCR_TCH), trans, resid));
+
+	*esc->sc_dmalen -= trans;
+	*esc->sc_dmaaddr = (char *)*esc->sc_dmaaddr + trans;
+
+	return (0);
+}
+
+static int
+esp_pci_dma_setup(struct ncr53c9x_softc *sc, void **addr, size_t *len,
+    int datain, size_t *dmasize)
+{
+	struct esp_pci_softc *esc = (struct esp_pci_softc *)sc;
+	int error;
+
+	WRITE_DMAREG(esc, DMA_CMD, DMACMD_IDLE | (datain != 0 ? DMACMD_DIR :
+	    0));
+
+	*dmasize = esc->sc_dmasize = ulmin(*dmasize, MDL_SEG_SIZE);
+	esc->sc_dmaaddr = addr;
+	esc->sc_dmalen = len;
+	esc->sc_datain = datain;
+
+	/*
+	 * There's no need to set up DMA for a "Transfer Pad" operation.
+	 */
+	if (*dmasize == 0)
+		return (0);
+
+	/* Set the transfer length. */
+	WRITE_DMAREG(esc, DMA_STC, *dmasize);
+
+	/*
+	 * Load the transfer buffer and program the DMA address.
+	 * Note that the NCR53C9x core can't handle EINPROGRESS so we set
+	 * BUS_DMA_NOWAIT.
+	 */
+	error = bus_dmamap_load(esc->sc_xferdmat, esc->sc_xferdmam,
+	    *esc->sc_dmaaddr, *dmasize, esp_pci_xfermap, sc, BUS_DMA_NOWAIT);
+
+	return (error);
+}
+
+static void
+esp_pci_dma_go(struct ncr53c9x_softc *sc)
+{
+	struct esp_pci_softc *esc = (struct esp_pci_softc *)sc;
+	int datain;
+
+	datain = esc->sc_datain;
+
+	/* No DMA transfer for a "Transfer Pad" operation */
+	if (esc->sc_dmasize == 0)
+		return;
+
+	/* Sync the transfer buffer. */
+	bus_dmamap_sync(esc->sc_xferdmat, esc->sc_xferdmam, datain != 0 ?
+	    BUS_DMASYNC_PREREAD : BUS_DMASYNC_PREWRITE);
+
+	/* Set the DMA engine to the IDLE state. */
+	/* XXX DMA Transfer Interrupt Enable bit is broken? */
+	WRITE_DMAREG(esc, DMA_CMD, DMACMD_IDLE | /* DMACMD_INTE | */
+	    (datain != 0 ? DMACMD_DIR : 0));
+
+	/* Issue a DMA start command. */
+	WRITE_DMAREG(esc, DMA_CMD, DMACMD_START | /* DMACMD_INTE | */
+	    (datain != 0 ? DMACMD_DIR : 0));
+
+	esc->sc_active = 1;
+}
+
+static void
+esp_pci_dma_stop(struct ncr53c9x_softc *sc)
+{
+	struct esp_pci_softc *esc = (struct esp_pci_softc *)sc;
+
+	/* DMA stop */
+	/* XXX what should we do here ? */
+	WRITE_DMAREG(esc, DMA_CMD,
+	    DMACMD_ABORT | (esc->sc_datain != 0 ? DMACMD_DIR : 0));
+	bus_dmamap_unload(esc->sc_xferdmat, esc->sc_xferdmam);
+
+	esc->sc_active = 0;
+}
+
+static int
+esp_pci_dma_isactive(struct ncr53c9x_softc *sc)
+{
+	struct esp_pci_softc *esc = (struct esp_pci_softc *)sc;
+
+	/* XXX should we check esc->sc_active? */
+	if ((READ_DMAREG(esc, DMA_CMD) & DMACMD_CMD) != DMACMD_IDLE)
+		return (1);
+
+	return (0);
+}

Modified: head/sys/i386/conf/GENERIC
==============================================================================
--- head/sys/i386/conf/GENERIC	Tue Nov  1 21:21:36 2011	(r227005)
+++ head/sys/i386/conf/GENERIC	Tue Nov  1 21:26:57 2011	(r227006)
@@ -110,7 +110,7 @@ options 	AHC_REG_PRETTY_PRINT	# Print re
 device		ahd		# AHA39320/29320 and onboard AIC79xx devices
 options 	AHD_REG_PRETTY_PRINT	# Print register bitfields in debug
 					# output.  Adds ~215k to driver.
-device		amd		# AMD 53C974 (Tekram DC-390(T))
+device		esp		# AMD Am53C974 (Tekram DC-390(T))
 device		hptiop		# Highpoint RocketRaid 3xxx series
 device		isp		# Qlogic family
 #device		ispfw		# Firmware for QLogic HBAs- normally a module

Modified: head/sys/modules/Makefile
==============================================================================
--- head/sys/modules/Makefile	Tue Nov  1 21:21:36 2011	(r227005)
+++ head/sys/modules/Makefile	Tue Nov  1 21:26:57 2011	(r227006)
@@ -89,6 +89,7 @@ SUBDIR=	${_3dfx} \
 	en \
 	${_ep} \
 	${_epic} \
+	esp \
 	${_et} \
 	${_ex} \
 	${_exca} \

Modified: head/sys/modules/esp/Makefile
==============================================================================
--- head/sys/modules/esp/Makefile	Tue Nov  1 21:21:36 2011	(r227005)
+++ head/sys/modules/esp/Makefile	Tue Nov  1 21:26:57 2011	(r227006)
@@ -3,7 +3,8 @@
 .PATH: ${.CURDIR}/../../dev/esp
 
 KMOD=	esp
-SRCS=	device_if.h ${esp_sbus} bus_if.h ncr53c9x.c ${ofw_bus_if} opt_cam.h
+SRCS=	device_if.h esp_pci.c ${esp_sbus} bus_if.h ncr53c9x.c ${ofw_bus_if}
+SRCS+=	opt_cam.h pci_if.h
 
 .if ${MACHINE} == "sparc64"
 ofw_bus_if=	ofw_bus_if.h

Modified: head/sys/pc98/conf/GENERIC
==============================================================================
--- head/sys/pc98/conf/GENERIC	Tue Nov  1 21:21:36 2011	(r227005)
+++ head/sys/pc98/conf/GENERIC	Tue Nov  1 21:26:57 2011	(r227006)
@@ -101,7 +101,7 @@ device		siis		# SiliconImage SiI3124/SiI
 # SCSI Controllers
 device		adv		# Advansys SCSI adapters
 device		ahc		# AHA2940 and onboard AIC7xxx devices
-device		amd		# AMD 53C974 (Tekram DC-390(T))
+device		esp		# AMD Am53C974 (Tekram DC-390(T))
 device		isp		# Qlogic family
 #device		ncr		# NCR/Symbios Logic
 device		sym		# NCR/Symbios Logic (newer chipsets + those of `ncr')

Modified: head/sys/sparc64/conf/GENERIC
==============================================================================
--- head/sys/sparc64/conf/GENERIC	Tue Nov  1 21:21:36 2011	(r227005)
+++ head/sys/sparc64/conf/GENERIC	Tue Nov  1 21:26:57 2011	(r227006)
@@ -103,11 +103,11 @@ device		ahc		# AHA2940 and onboard AIC7x
 options 	AHC_ALLOW_MEMIO	# Attempt to use memory mapped I/O
 options 	AHC_REG_PRETTY_PRINT	# Print register bitfields in debug
 					# output.  Adds ~128k to driver.
+device		esp		# AMD Am53C974, Sun ESP and FAS	families
 device		isp		# Qlogic family
 device		ispfw		# Firmware module for Qlogic host adapters
 device		mpt		# LSI-Logic MPT-Fusion
 device		sym		# NCR/Symbios/LSI Logic 53C8XX/53C1010/53C1510D
-device		esp		# NCR53c9x (FEPS/FAS366)
 
 # ATA/SCSI peripherals
 device		scbus		# SCSI bus (required for ATA/SCSI)

From owner-svn-src-head@FreeBSD.ORG  Tue Nov  1 23:12:23 2011
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 428621065675;
	Tue,  1 Nov 2011 23:12:23 +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 32F158FC0C;
	Tue,  1 Nov 2011 23:12:23 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pA1NCNab089114;
	Tue, 1 Nov 2011 23:12:23 GMT (envelope-from mav@svn.freebsd.org)
Received: (from mav@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id pA1NCNuY089112;
	Tue, 1 Nov 2011 23:12:23 GMT (envelope-from mav@svn.freebsd.org)
Message-Id: <201111012312.pA1NCNuY089112@svn.freebsd.org>
From: Alexander Motin 
Date: Tue, 1 Nov 2011 23:12:23 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r227009 - 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: Tue, 01 Nov 2011 23:12:23 -0000

Author: mav
Date: Tue Nov  1 23:12:22 2011
New Revision: 227009
URL: http://svn.freebsd.org/changeset/base/227009

Log:
  Make orphan() method in geom_dev asynchronous using destroy_dev_sched_cb()
  instead of destroy_dev(). It moves device destruction waiting out of the
  topology lock and so fixes dead lock between orphanization and closing.
  Real provider and geom destruction called from swi context after device
  destroyed as callback of the destroy_dev_sched_cb().

Modified:
  head/sys/geom/geom_dev.c

Modified: head/sys/geom/geom_dev.c
==============================================================================
--- head/sys/geom/geom_dev.c	Tue Nov  1 22:22:46 2011	(r227008)
+++ head/sys/geom/geom_dev.c	Tue Nov  1 23:12:22 2011	(r227009)
@@ -506,6 +506,32 @@ g_dev_strategy(struct bio *bp)
  */
 
 static void
+g_dev_cleanup(void *arg)
+{
+	struct g_geom *gp;
+	struct g_consumer *cp;
+
+	mtx_unlock(&Giant);
+	cp = arg;
+	gp = cp->geom;
+	g_trace(G_T_TOPOLOGY, "g_dev_cleanup(%p(%s))", cp, cp->provider->name);
+
+	/* Wait for the cows to come home */
+	while (cp->nstart != cp->nend)
+		pause("gdevcleanup", hz / 10);
+
+	g_topology_lock();
+	if (cp->acr > 0 || cp->acw > 0 || cp->ace > 0)
+		g_access(cp, -cp->acr, -cp->acw, -cp->ace);
+
+	g_detach(cp);
+	g_destroy_consumer(cp);
+	g_destroy_geom(gp);
+	g_topology_unlock();
+	mtx_lock(&Giant);
+}
+
+static void
 g_dev_orphan(struct g_consumer *cp)
 {
 	struct g_geom *gp;
@@ -521,18 +547,7 @@ g_dev_orphan(struct g_consumer *cp)
 		set_dumper(NULL);
 
 	/* Destroy the struct cdev *so we get no more requests */
-	destroy_dev(dev);
-
-	/* Wait for the cows to come home */
-	while (cp->nstart != cp->nend)
-		pause("gdevorphan", hz / 10);
-
-	if (cp->acr > 0 || cp->acw > 0 || cp->ace > 0)
-		g_access(cp, -cp->acr, -cp->acw, -cp->ace);
-
-	g_detach(cp);
-	g_destroy_consumer(cp);
-	g_destroy_geom(gp);
+	destroy_dev_sched_cb(dev, g_dev_cleanup, cp);
 }
 
 DECLARE_GEOM_CLASS(g_dev_class, g_dev);

From owner-svn-src-head@FreeBSD.ORG  Wed Nov  2 04:21:21 2011
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 5FD0C1065670;
	Wed,  2 Nov 2011 04:21:21 +0000 (UTC)
	(envelope-from dougb@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 4FDC48FC0A;
	Wed,  2 Nov 2011 04:21:21 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pA24LLO8099457;
	Wed, 2 Nov 2011 04:21:21 GMT (envelope-from dougb@svn.freebsd.org)
Received: (from dougb@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id pA24LLgJ099455;
	Wed, 2 Nov 2011 04:21:21 GMT (envelope-from dougb@svn.freebsd.org)
Message-Id: <201111020421.pA24LLgJ099455@svn.freebsd.org>
From: Doug Barton 
Date: Wed, 2 Nov 2011 04:21: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: r227011 - head/usr.sbin/tzsetup
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: 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, 02 Nov 2011 04:21:21 -0000

Author: dougb
Date: Wed Nov  2 04:21:20 2011
New Revision: 227011
URL: http://svn.freebsd.org/changeset/base/227011

Log:
  If the user is moving from any other time zone to UTC we need
  to delete any old /var/db/zoneinfo file that may exist so that
  tzsetup -r does the right thing.

Modified:
  head/usr.sbin/tzsetup/tzsetup.c

Modified: head/usr.sbin/tzsetup/tzsetup.c
==============================================================================
--- head/usr.sbin/tzsetup/tzsetup.c	Wed Nov  2 00:21:03 2011	(r227010)
+++ head/usr.sbin/tzsetup/tzsetup.c	Wed Nov  2 04:21:20 2011	(r227011)
@@ -565,6 +565,18 @@ install_zoneinfo_file(const char *zonein
 
 				return (DITEM_FAILURE | DITEM_RECREATE);
 			}
+			if (unlink(path_db) < 0 && errno != ENOENT) {
+				snprintf(title, sizeof(title), "Error");
+				snprintf(prompt, sizeof(prompt),
+				     "Could not delete %s: %s", path_db,
+				     strerror(errno));
+				if (usedialog)
+					dialog_mesgbox(title, prompt, 8, 72);
+				else
+					fprintf(stderr, "%s\n", prompt);
+
+				return (DITEM_FAILURE | DITEM_RECREATE);
+			}
 			return (DITEM_LEAVE_MENU);
 		}
 		

From owner-svn-src-head@FreeBSD.ORG  Wed Nov  2 05:42:51 2011
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id A2D92106566C;
	Wed,  2 Nov 2011 05:42:51 +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 5F39A8FC16;
	Wed,  2 Nov 2011 05:42:51 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pA25gpoi002099;
	Wed, 2 Nov 2011 05:42:51 GMT (envelope-from alc@svn.freebsd.org)
Received: (from alc@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id pA25gpAi002096;
	Wed, 2 Nov 2011 05:42:51 GMT (envelope-from alc@svn.freebsd.org)
Message-Id: <201111020542.pA25gpAi002096@svn.freebsd.org>
From: Alan Cox 
Date: Wed, 2 Nov 2011 05:42:51 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r227012 - in head/sys: mips/mips vm
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 02 Nov 2011 05:42:51 -0000

Author: alc
Date: Wed Nov  2 05:42:51 2011
New Revision: 227012
URL: http://svn.freebsd.org/changeset/base/227012

Log:
  Add support for VM_ALLOC_WIRED and VM_ALLOC_ZERO to vm_page_alloc_freelist()
  and use these new options in the mips pmap.
  
  Wake up the page daemon in vm_page_alloc_freelist() if the number of free
  and cached pages becomes too low.
  
  Tidy up vm_page_alloc_init().  In particular, add a comment about an
  important restriction on its use.
  
  Tested by:	jchandra@

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

Modified: head/sys/mips/mips/pmap.c
==============================================================================
--- head/sys/mips/mips/pmap.c	Wed Nov  2 04:21:20 2011	(r227011)
+++ head/sys/mips/mips/pmap.c	Wed Nov  2 05:42:51 2011	(r227012)
@@ -1077,7 +1077,8 @@ pmap_alloc_direct_page(unsigned int inde
 {
 	vm_page_t m;
 
-	m = vm_page_alloc_freelist(VM_FREELIST_DIRECT, req);
+	m = vm_page_alloc_freelist(VM_FREELIST_DIRECT, req | VM_ALLOC_WIRED |
+	    VM_ALLOC_ZERO);
 	if (m == NULL)
 		return (NULL);
 
@@ -1085,8 +1086,6 @@ pmap_alloc_direct_page(unsigned int inde
 		pmap_zero_page(m);
 
 	m->pindex = index;
-	atomic_add_int(&cnt.v_wire_count, 1);
-	m->wire_count = 1;
 	return (m);
 }
 

Modified: head/sys/vm/vm_page.c
==============================================================================
--- head/sys/vm/vm_page.c	Wed Nov  2 04:21:20 2011	(r227011)
+++ head/sys/vm/vm_page.c	Wed Nov  2 05:42:51 2011	(r227012)
@@ -1482,6 +1482,8 @@ vm_page_alloc(vm_object_t object, vm_pin
  * Initialize a page that has been freshly dequeued from a freelist.
  * The caller has to drop the vnode returned, if it is not NULL.
  *
+ * This function may only be used to initialize unmanaged pages.
+ *
  * To be called with vm_page_queue_free_mtx held.
  */
 struct vnode *
@@ -1507,11 +1509,12 @@ vm_page_alloc_init(vm_page_t m)
 	mtx_assert(&vm_page_queue_free_mtx, MA_OWNED);
 	drop = NULL;
 	if ((m->flags & PG_CACHED) != 0) {
+		KASSERT((m->flags & PG_ZERO) == 0,
+		    ("vm_page_alloc_init: cached page %p is PG_ZERO", m));
 		m->valid = 0;
 		m_object = m->object;
 		vm_page_cache_remove(m);
-		if (m_object->type == OBJT_VNODE &&
-		    m_object->cache == NULL)
+		if (m_object->type == OBJT_VNODE && m_object->cache == NULL)
 			drop = m_object->handle;
 	} else {
 		KASSERT(VM_PAGE_IS_FREE(m),
@@ -1519,9 +1522,9 @@ vm_page_alloc_init(vm_page_t m)
 		KASSERT(m->valid == 0,
 		    ("vm_page_alloc_init: free page %p is valid", m));
 		cnt.v_free_count--;
+		if ((m->flags & PG_ZERO) != 0)
+			vm_page_zero_count--;
 	}
-	if (m->flags & PG_ZERO)
-		vm_page_zero_count--;
 	/* Don't clear the PG_ZERO flag; we'll need it later. */
 	m->flags &= PG_ZERO;
 	m->aflags = 0;
@@ -1532,16 +1535,28 @@ vm_page_alloc_init(vm_page_t m)
 
 /*
  * 	vm_page_alloc_freelist:
- * 
- *	Allocate a page from the specified freelist.
- *	Only the ALLOC_CLASS values in req are honored, other request flags
- *	are ignored.
+ *
+ *	Allocate a physical page from the specified free page list.
+ *
+ *	The caller must always specify an allocation class.
+ *
+ *	allocation classes:
+ *	VM_ALLOC_NORMAL		normal process request
+ *	VM_ALLOC_SYSTEM		system *really* needs a page
+ *	VM_ALLOC_INTERRUPT	interrupt time request
+ *
+ *	optional allocation flags:
+ *	VM_ALLOC_WIRED		wire the allocated page
+ *	VM_ALLOC_ZERO		prefer a zeroed page
+ *
+ *	This routine may not sleep.
  */
 vm_page_t
 vm_page_alloc_freelist(int flind, int req)
 {
 	struct vnode *drop;
 	vm_page_t m;
+	u_int flags;
 	int page_req;
 
 	m = NULL;
@@ -1563,8 +1578,26 @@ vm_page_alloc_freelist(int flind, int re
 	}
 	drop = vm_page_alloc_init(m);
 	mtx_unlock(&vm_page_queue_free_mtx);
-	if (drop)
+
+	/*
+	 * Initialize the page.  Only the PG_ZERO flag is inherited.
+	 */
+	flags = 0;
+	if ((req & VM_ALLOC_ZERO) != 0)
+		flags = PG_ZERO;
+	m->flags &= flags;
+	if ((req & VM_ALLOC_WIRED) != 0) {
+		/*
+		 * The page lock is not required for wiring a page that does
+		 * not belong to an object.
+		 */
+		atomic_add_int(&cnt.v_wire_count, 1);
+		m->wire_count = 1;
+	}
+	if (drop != NULL)
 		vdrop(drop);
+	if (vm_paging_needed())
+		pagedaemon_wakeup();
 	return (m);
 }
 

From owner-svn-src-head@FreeBSD.ORG  Wed Nov  2 07:40:23 2011
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id CF378106564A;
	Wed,  2 Nov 2011 07:40:23 +0000 (UTC)
	(envelope-from dougb@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id BEA408FC08;
	Wed,  2 Nov 2011 07:40:23 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pA27eN1P005759;
	Wed, 2 Nov 2011 07:40:23 GMT (envelope-from dougb@svn.freebsd.org)
Received: (from dougb@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id pA27eN00005756;
	Wed, 2 Nov 2011 07:40:23 GMT (envelope-from dougb@svn.freebsd.org)
Message-Id: <201111020740.pA27eN00005756@svn.freebsd.org>
From: Doug Barton 
Date: Wed, 2 Nov 2011 07:40:23 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r227013 - head/usr.sbin/mergemaster
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: 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, 02 Nov 2011 07:40:24 -0000

Author: dougb
Date: Wed Nov  2 07:40:23 2011
New Revision: 227013
URL: http://svn.freebsd.org/changeset/base/227013

Log:
  1. Add a new option, --run-updates, to always or never run the newalises,
     pwd_mkdb, etc. updates at the end of the comparison.
  
  2. Add an update to the end to handle /etc/localtime, if it exists.
     If /var/db/zoneinfo exists, automatically update /etc/localtime,
     which should (hopefully) be safe to do. If not, prompt the user
     to run tzsetup.
  
  3. Update run_it_now(), the function that handles input for the updates,
     to make sure that we got a valid answer, and to handle the --run-updates
     option if supplied.

Modified:
  head/usr.sbin/mergemaster/mergemaster.8
  head/usr.sbin/mergemaster/mergemaster.sh

Modified: head/usr.sbin/mergemaster/mergemaster.8
==============================================================================
--- head/usr.sbin/mergemaster/mergemaster.8	Wed Nov  2 05:42:51 2011	(r227012)
+++ head/usr.sbin/mergemaster/mergemaster.8	Wed Nov  2 07:40:23 2011	(r227013)
@@ -24,7 +24,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd August 9, 2011
+.Dd November 1, 2011
 .Dt MERGEMASTER 8
 .Os
 .Sh NAME
@@ -34,6 +34,7 @@
 .Nm
 .Op Fl scrvhpCP
 .Op Fl a|iFU
+.Op Fl -run-updates=[always|never]
 .Op Fl m Ar /path/to/sources
 .Op Fl t Ar /path/to/temp/root
 .Op Fl d
@@ -246,6 +247,11 @@ rc file.
 Attempt to auto upgrade files that have not been user modified.
 This option can be dangerous when there are critical changes
 in the new versions that affect your running system.
+.It Fl -run-updates=[always|never]
+Specify always or never to run newaliases, pwd_mkdb, etc.
+at the end of the comparison run.
+If this option is omitted the default is to prompt the user
+for each update as necessary.
 .It Fl m Ar /path/to/sources
 Specify the path to the directory where you want to do the
 .Xr make 1 .
@@ -365,6 +371,9 @@ with all values commented out:
 # ***DANGEROUS***
 #AUTO_UPGRADE=
 #
+# Either always or never run newaliases, pwd_mkdb at the end (--run-updates)
+#RUN_UPDATES=
+#
 # Compare /etc/rc.conf[.local] to /etc/defaults/rc.conf (-C)
 #COMP_CONFS=
 #

Modified: head/usr.sbin/mergemaster/mergemaster.sh
==============================================================================
--- head/usr.sbin/mergemaster/mergemaster.sh	Wed Nov  2 05:42:51 2011	(r227012)
+++ head/usr.sbin/mergemaster/mergemaster.sh	Wed Nov  2 07:40:23 2011	(r227013)
@@ -15,7 +15,7 @@ PATH=/bin:/usr/bin:/usr/sbin
 display_usage () {
   VERSION_NUMBER=`grep "[$]FreeBSD:" $0 | cut -d ' ' -f 4`
   echo "mergemaster version ${VERSION_NUMBER}"
-  echo 'Usage: mergemaster [-scrvhpCP] [-a|[-iFU]]'
+  echo 'Usage: mergemaster [-scrvhpCP] [-a|[-iFU]] [--run-updates=always|never]'
   echo '    [-m /path] [-t /path] [-d] [-u N] [-w N] [-A arch] [-D /path]'
   echo "Options:"
   echo "  -s  Strict comparison (diff every pair of files)"
@@ -31,6 +31,7 @@ display_usage () {
   echo '  -P  Preserve files that are overwritten'
   echo "  -U  Attempt to auto upgrade files that have not been user modified"
   echo '      ***DANGEROUS***'
+  echo '  --run-updates=  Specify always or never to run newalises, pwd_mkdb, etc.'
   echo ''
   echo "  -m /path/directory  Specify location of source to do the make in"
   echo "  -t /path/directory  Specify temp root directory"
@@ -262,6 +263,20 @@ if [ -r "$HOME/.mergemasterrc" ]; then
   . "$HOME/.mergemasterrc"
 fi
 
+for var in "$@" ; do
+  case "$var" in
+  --run-updates*)
+    RUN_UPDATES=`echo ${var#--run-updates=} | tr [:upper:] [:lower:]`
+    ;;
+  *)
+    newopts="$newopts $var"
+    ;;
+  esac
+done
+
+set -- $newopts
+unset var newopts
+
 # Check the command line options
 #
 while getopts ":ascrvhipCPm:t:du:w:D:A:FU" COMMAND_LINE_ARGUMENT ; do
@@ -1224,34 +1239,43 @@ case "${AUTO_UPGRADED_FILES}" in
 esac
 
 run_it_now () {
-  case "${AUTO_RUN}" in
-  '')
-    unset YES_OR_NO
-    echo ''
-    echo -n '    Would you like to run it now? y or n [n] '
-    read YES_OR_NO
+  [ -n "$AUTO_RUN" ] && return
+
+  local answer
+
+  echo ''
+  while : ; do
+    if [ "$RUN_UPDATES" = always ]; then
+      answer=y
+    elif [ "$RUN_UPDATES" = never ]; then
+      answer=n
+    else
+      echo -n '    Would you like to run it now? y or n [n] '
+      read answer
+    fi
 
-    case "${YES_OR_NO}" in
+    case "$answer" in
     y)
       echo "    Running ${1}"
       echo ''
       eval "${1}"
+      return
       ;;
     ''|n)
-      echo ''
-      echo "       *** Cancelled"
-      echo ''
+      if [ ! "$RUN_UPDATES" = never ]; then
+        echo ''
+        echo "       *** Cancelled"
+        echo ''
+      fi
       echo "    Make sure to run ${1} yourself"
+      return
       ;;
     *)
       echo ''
-      echo "       *** Sorry, I do not understand your answer (${YES_OR_NO})"
+      echo "       *** Sorry, I do not understand your answer (${answer})"
       echo ''
-      echo "    Make sure to run ${1} yourself"
     esac
-    ;;
-  *) ;;
-  esac
+  done
 }
 
 case "${NEED_NEWALIASES}" in
@@ -1310,6 +1334,19 @@ case "${NEED_PWD_MKDB}" in
   ;;
 esac
 
+if [ -e "${DESTDIR}/etc/localtime" ]; then	# Ignore if TZ == UTC
+  echo ''
+  if [ -f "${DESTDIR}/var/db/zoneinfo" ]; then
+    echo "*** Reinstalling `cat ${DESTDIR}/var/db/zoneinfo` as ${DESTDIR}/etc/localtime"
+    [ -n "${DESTDIR}" ] && tzs_args="-C ${DESTDIR}"
+    tzsetup $tzs_args -r
+  else
+    echo "*** There is no ${DESTDIR}/var/db/zoneinfo file to update ${DESTDIR}/etc/localtime."
+    echo '    You should run tzsetup'
+    run_it_now tzsetup
+  fi
+fi
+
 echo ''
 
 if [ -r "${MM_EXIT_SCRIPT}" ]; then

From owner-svn-src-head@FreeBSD.ORG  Wed Nov  2 09:24:59 2011
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 9E6B3106564A;
	Wed,  2 Nov 2011 09:24:59 +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 8E2E68FC08;
	Wed,  2 Nov 2011 09:24:59 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pA29Oxq8009137;
	Wed, 2 Nov 2011 09:24:59 GMT (envelope-from mav@svn.freebsd.org)
Received: (from mav@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id pA29OxUV009135;
	Wed, 2 Nov 2011 09:24:59 GMT (envelope-from mav@svn.freebsd.org)
Message-Id: <201111020924.pA29OxUV009135@svn.freebsd.org>
From: Alexander Motin 
Date: Wed, 2 Nov 2011 09:24: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: r227015 - 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: Wed, 02 Nov 2011 09:24:59 -0000

Author: mav
Date: Wed Nov  2 09:24:59 2011
New Revision: 227015
URL: http://svn.freebsd.org/changeset/base/227015

Log:
  Add mutex and two flags to make orphan() call properly asynchronous:
   - delay consumer closing and detaching on orphan() until all I/Os complete;
   - prevent new I/Os submission after orphan() called.
  Previous implementation could destroy consumers still having active
  requests and worked only because of global workaround made on GEOM level.

Modified:
  head/sys/geom/geom_vfs.c

Modified: head/sys/geom/geom_vfs.c
==============================================================================
--- head/sys/geom/geom_vfs.c	Wed Nov  2 08:23:40 2011	(r227014)
+++ head/sys/geom/geom_vfs.c	Wed Nov  2 09:24:59 2011	(r227015)
@@ -31,7 +31,9 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 #include 
+#include 
 #include 
 #include 	/* XXX Temporary for VFS_LOCK_GIANT */
 
@@ -45,6 +47,13 @@ __FBSDID("$FreeBSD$");
  */
 #include 
 
+struct g_vfs_softc {
+	struct mtx	 sc_mtx;
+	struct bufobj	*sc_bo;
+	int		 sc_active;
+	int		 sc_orphaned;
+};
+
 static struct buf_ops __g_vfs_bufops = {
 	.bop_name =	"GEOM_VFS",
 	.bop_write =	bufwrite,
@@ -66,21 +75,29 @@ static struct g_class g_vfs_class = {
 DECLARE_GEOM_CLASS(g_vfs_class, g_vfs);
 
 static void
+g_vfs_destroy(void *arg, int flags __unused)
+{
+	struct g_consumer *cp;
+
+	g_topology_assert();
+	cp = arg;
+	if (cp->acr > 0 || cp->acw > 0 || cp->ace > 0)
+		g_access(cp, -cp->acr, -cp->acw, -cp->ace);
+	g_detach(cp);
+	if (cp->geom->softc == NULL)
+		g_wither_geom(cp->geom, ENXIO);
+}
+
+static void
 g_vfs_done(struct bio *bip)
 {
+	struct g_consumer *cp;
+	struct g_vfs_softc *sc;
 	struct buf *bp;
-	int vfslocked;
-
-	/*
-	 * Provider ('bio_to') could have withered away sometime
-	 * between incrementing the 'nend' in g_io_deliver() and now,
-	 * making 'bio_to' a dangling pointer.  We cannot do that
-	 * in g_wither_geom(), as it would require going over
-	 * the 'g_bio_run_up' list, resetting the pointer.
-	 */
-	if (bip->bio_from->provider == NULL)
-		bip->bio_to = NULL;
+	int vfslocked, destroy;
 
+	cp = bip->bio_from;
+	sc = cp->geom->softc;
 	if (bip->bio_error) {
 		printf("g_vfs_done():");
 		g_print_bio(bip);
@@ -93,6 +110,13 @@ g_vfs_done(struct bio *bip)
 		bp->b_ioflags |= BIO_ERROR;
 	bp->b_resid = bp->b_bcount - bip->bio_completed;
 	g_destroy_bio(bip);
+
+	mtx_lock(&sc->sc_mtx);
+	destroy = ((--sc->sc_active) == 0 && sc->sc_orphaned);
+	mtx_unlock(&sc->sc_mtx);
+	if (destroy)
+		g_post_event(g_vfs_destroy, cp, M_WAITOK, NULL);
+
 	vfslocked = VFS_LOCK_GIANT(((struct mount *)NULL));
 	bufdone(bp);
 	VFS_UNLOCK_GIANT(vfslocked);
@@ -101,17 +125,20 @@ g_vfs_done(struct bio *bip)
 void
 g_vfs_strategy(struct bufobj *bo, struct buf *bp)
 {
+	struct g_vfs_softc *sc;
 	struct g_consumer *cp;
 	struct bio *bip;
 	int vfslocked;
 
 	cp = bo->bo_private;
-	/* G_VALID_CONSUMER(cp); We likely lack topology lock */
+	sc = cp->geom->softc;
 
 	/*
 	 * If the provider has orphaned us, just return EXIO.
 	 */
-	if (cp->provider == NULL) {
+	mtx_lock(&sc->sc_mtx);
+	if (sc->sc_orphaned) {
+		mtx_unlock(&sc->sc_mtx);
 		bp->b_error = ENXIO;
 		bp->b_ioflags |= BIO_ERROR;
 		vfslocked = VFS_LOCK_GIANT(((struct mount *)NULL));
@@ -119,6 +146,8 @@ g_vfs_strategy(struct bufobj *bo, struct
 		VFS_UNLOCK_GIANT(vfslocked);
 		return;
 	}
+	sc->sc_active++;
+	mtx_unlock(&sc->sc_mtx);
 
 	bip = g_alloc_bio();
 	bip->bio_cmd = bp->b_iocmd;
@@ -134,14 +163,20 @@ static void
 g_vfs_orphan(struct g_consumer *cp)
 {
 	struct g_geom *gp;
+	struct g_vfs_softc *sc;
+	int destroy;
 
 	g_topology_assert();
 
 	gp = cp->geom;
+	sc = gp->softc;
 	g_trace(G_T_TOPOLOGY, "g_vfs_orphan(%p(%s))", cp, gp->name);
-	if (cp->acr > 0 || cp->acw > 0 || cp->ace > 0)
-		g_access(cp, -cp->acr, -cp->acw, -cp->ace);
-	g_detach(cp);
+	mtx_lock(&sc->sc_mtx);
+	sc->sc_orphaned = 1;
+	destroy = (sc->sc_active == 0);
+	mtx_unlock(&sc->sc_mtx);
+	if (destroy)
+		g_vfs_destroy(cp, 0);
 
 	/*
 	 * Do not destroy the geom.  Filesystem will do that during unmount.
@@ -154,6 +189,7 @@ g_vfs_open(struct vnode *vp, struct g_co
 	struct g_geom *gp;
 	struct g_provider *pp;
 	struct g_consumer *cp;
+	struct g_vfs_softc *sc;
 	struct bufobj *bo;
 	int vfslocked;
 	int error;
@@ -169,6 +205,10 @@ g_vfs_open(struct vnode *vp, struct g_co
 	if (pp == NULL)
 		return (ENOENT);
 	gp = g_new_geomf(&g_vfs_class, "%s.%s", fsname, pp->name);
+	sc = g_malloc(sizeof(*sc), M_WAITOK | M_ZERO);
+	mtx_init(&sc->sc_mtx, "g_vfs", NULL, MTX_DEF);
+	sc->sc_bo = bo;
+	gp->softc = sc;
 	cp = g_new_consumer(gp);
 	g_attach(cp, pp);
 	error = g_access(cp, 1, wr, wr);
@@ -184,7 +224,6 @@ g_vfs_open(struct vnode *vp, struct g_co
 	bo->bo_ops = g_vfs_bufops;
 	bo->bo_private = cp;
 	bo->bo_bsize = pp->sectorsize;
-	gp->softc = bo;
 
 	return (error);
 }
@@ -193,13 +232,17 @@ void
 g_vfs_close(struct g_consumer *cp)
 {
 	struct g_geom *gp;
-	struct bufobj *bo;
+	struct g_vfs_softc *sc;
 
 	g_topology_assert();
 
 	gp = cp->geom;
-	bo = gp->softc;
-	bufobj_invalbuf(bo, V_SAVE, 0, 0);
-	bo->bo_private = cp->private;
-	g_wither_geom_close(gp, ENXIO);
+	sc = gp->softc;
+	bufobj_invalbuf(sc->sc_bo, V_SAVE, 0, 0);
+	sc->sc_bo->bo_private = cp->private;
+	gp->softc = NULL;
+	mtx_destroy(&sc->sc_mtx);
+	if (!sc->sc_orphaned || cp->provider == NULL)
+		g_wither_geom_close(gp, ENXIO);
+	g_free(sc);
 }

From owner-svn-src-head@FreeBSD.ORG  Wed Nov  2 12:13:16 2011
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id B3FB0106566B;
	Wed,  2 Nov 2011 12:13:16 +0000 (UTC)
	(envelope-from pluknet@gmail.com)
Received: from mail-vw0-f54.google.com (mail-vw0-f54.google.com
	[209.85.212.54])
	by mx1.freebsd.org (Postfix) with ESMTP id 383598FC13;
	Wed,  2 Nov 2011 12:13:16 +0000 (UTC)
Received: by vws11 with SMTP id 11so92697vws.13
	for ; Wed, 02 Nov 2011 05:13:15 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma;
	h=mime-version:sender:in-reply-to:references:date
	:x-google-sender-auth:message-id:subject:from:to:cc:content-type
	:content-transfer-encoding;
	bh=Nw7klDHl1zRHltEhJasUdac/B93CuDOiK1J5z4FbsXs=;
	b=Yd18YUxK13tFxcdfLWh8i5ZLkUkXU2oiRfjQlE+oBaFkJfvtAHAdZVR1AW7e134iln
	Dsrarb6P92t3QkYhFsGSQNFcNX61qPmnTXV4db5Hq/Et0ekS+GVbp25ST4GEabf1D/5B
	eFjOrLXOl6fhPWWlSdxS2Bko8xEA4iiwnY0Tw=
MIME-Version: 1.0
Received: by 10.182.59.5 with SMTP id v5mr813472obq.78.1320235995373; Wed, 02
	Nov 2011 05:13:15 -0700 (PDT)
Sender: pluknet@gmail.com
Received: by 10.182.89.41 with HTTP; Wed, 2 Nov 2011 05:13:15 -0700 (PDT)
In-Reply-To: <201109271327.p8RDRHs8024689@svn.freebsd.org>
References: <201109271327.p8RDRHs8024689@svn.freebsd.org>
Date: Wed, 2 Nov 2011 15:13:15 +0300
X-Google-Sender-Auth: srXTREdA9PZG1moFCxfYONohENo
Message-ID: 
From: Sergey Kandaurov 
To: "Bjoern A. Zeeb" 
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org,
	src-committers@freebsd.org
Subject: Re: svn commit: r225793 - in head/sys: modules/ipfw netinet/ipfw
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 02 Nov 2011 12:13:16 -0000

On 27 September 2011 17:27, Bjoern A. Zeeb  wrote:
> Author: bz
> Date: Tue Sep 27 13:27:17 2011
> New Revision: 225793
> URL: http://svn.freebsd.org/changeset/base/225793
>
> Log:
> =A0Unbreak no-ip and no-inet6 module builds with ipfw. =A0For now continu=
e to
> =A0build the ip_fw_pfil.c hooks and ipfw even in case of no-ip under the
> =A0assumption that the private L2 hook (which hopefully eventually will b=
e a
> =A0pfil hook as well) can still be useful.
>
> =A0Allow building the module without inet as well.
>
> =A0Glanced at by: =A0 =A0 =A0 =A0jhb
> =A0MFC after: =A0 =A03 days
>
> Modified:
> =A0head/sys/modules/ipfw/Makefile
> =A0head/sys/netinet/ipfw/ip_fw_pfil.c
>
> Modified: head/sys/modules/ipfw/Makefile
> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D
> --- head/sys/modules/ipfw/Makefile =A0 =A0 =A0Tue Sep 27 13:20:41 2011 =
=A0 =A0 =A0 =A0(r225792)
> +++ head/sys/modules/ipfw/Makefile =A0 =A0 =A0Tue Sep 27 13:27:17 2011 =
=A0 =A0 =A0 =A0(r225793)
> @@ -8,7 +8,7 @@ KMOD=3D =A0 ipfw
> =A0SRCS=3D =A0ip_fw2.c ip_fw_pfil.c
> =A0SRCS+=3D ip_fw_dynamic.c ip_fw_log.c
> =A0SRCS+=3D ip_fw_sockopt.c ip_fw_table.c
> -SRCS+=3D opt_inet6.h opt_ipfw.h opt_ipsec.h
> +SRCS+=3D opt_inet.h opt_inet6.h opt_ipfw.h opt_ipsec.h
>
> =A0CFLAGS+=3D -DIPFIREWALL
> =A0CFLAGS+=3D -I${.CURDIR}/../../contrib/pf
> @@ -22,6 +22,10 @@ CFLAGS+=3D -I${.CURDIR}/../../contrib/pf
> =A0#
>
> =A0.if !defined(KERNBUILDDIR)
> +.if ${MK_INET_SUPPORT} !=3D "no"
> +opt_inet.h:
> + =A0 =A0 =A0 echo "#define INET 1" > ${.TARGET}
> +.endif
> =A0.if ${MK_INET6_SUPPORT} !=3D "no"
> =A0opt_inet6.h:
> =A0 =A0 =A0 =A0echo "#define INET6 1" > ${.TARGET}
>
> Modified: head/sys/netinet/ipfw/ip_fw_pfil.c
> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D
> --- head/sys/netinet/ipfw/ip_fw_pfil.c =A0Tue Sep 27 13:20:41 2011 =A0 =
=A0 =A0 =A0(r225792)
> +++ head/sys/netinet/ipfw/ip_fw_pfil.c =A0Tue Sep 27 13:27:17 2011 =A0 =
=A0 =A0 =A0(r225793)
> @@ -31,11 +31,11 @@ __FBSDID("$FreeBSD$");
> =A0#if !defined(KLD_MODULE)
> =A0#include "opt_ipdn.h"
> =A0#include "opt_inet.h"
> +#include "opt_inet6.h"
> =A0#ifndef INET
> =A0#error IPFIREWALL requires INET.
> =A0#endif /* INET */
> =A0#endif /* KLD_MODULE */
> -#include "opt_inet6.h"

Hello.

This chunk seems to stop building inet6 part of ipfw.ko w/ INET6 enabled ke=
rnel.

Found by /etc/rc.d/ipfw restart:
[...]
/etc/rc.d/ipfw: WARNING: failed to enable IPv6 firewall

i.e. sysctl net.inet6.ip6.fw.enable doesn't present.

Reversion of this hunk fixed the problem.
NO_INET[46] lints aren't tested though.

--=20
wbr,
pluknet

From owner-svn-src-head@FreeBSD.ORG  Wed Nov  2 13:12:04 2011
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id EDC38106566B;
	Wed,  2 Nov 2011 13:12:04 +0000 (UTC) (envelope-from bz@freebsd.org)
Received: from mx1.sbone.de (bird.sbone.de [46.4.1.90])
	by mx1.freebsd.org (Postfix) with ESMTP id 73D398FC15;
	Wed,  2 Nov 2011 13:12:04 +0000 (UTC)
Received: from mail.sbone.de (mail.sbone.de [IPv6:fde9:577b:c1a9:31::2013:587])
	(using TLSv1 with cipher ADH-CAMELLIA256-SHA (256/256 bits))
	(No client certificate requested)
	by mx1.sbone.de (Postfix) with ESMTPS id A8CA225D385E;
	Wed,  2 Nov 2011 12:53:32 +0000 (UTC)
Received: from content-filter.sbone.de (content-filter.sbone.de
	[IPv6:fde9:577b:c1a9:31::2013:2742])
	(using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits))
	(No client certificate requested)
	by mail.sbone.de (Postfix) with ESMTPS id CA442BD4077;
	Wed,  2 Nov 2011 12:53:31 +0000 (UTC)
X-Virus-Scanned: amavisd-new at sbone.de
Received: from mail.sbone.de ([IPv6:fde9:577b:c1a9:31::2013:587])
	by content-filter.sbone.de (content-filter.sbone.de
	[fde9:577b:c1a9:31::2013:2742]) (amavisd-new, port 10024)
	with ESMTP id oQo1aB3DqwN2; Wed,  2 Nov 2011 12:53:30 +0000 (UTC)
Received: from nv.sbone.de (nv.sbone.de [IPv6:fde9:577b:c1a9:31::2013:138])
	(using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits))
	(No client certificate requested)
	by mail.sbone.de (Postfix) with ESMTPSA id DEC5EBD40A5;
	Wed,  2 Nov 2011 12:53:29 +0000 (UTC)
Date: Wed, 2 Nov 2011 12:53:29 +0000 (UTC)
From: "Bjoern A. Zeeb" 
To: Sergey Kandaurov 
In-Reply-To: 
Message-ID: 
References: <201109271327.p8RDRHs8024689@svn.freebsd.org>
	
X-OpenPGP-Key-Id: 0x14003F198FEFA3E77207EE8D2B58B8F83CCF1842
MIME-Version: 1.0
Content-Type: MULTIPART/MIXED; BOUNDARY="0-1689620518-1320238410=:68690"
Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org,
	src-committers@freebsd.org
Subject: Re: svn commit: r225793 - in head/sys: modules/ipfw netinet/ipfw
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 02 Nov 2011 13:12:05 -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-1689620518-1320238410=:68690
Content-Type: TEXT/PLAIN; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8BIT

On Wed, 2 Nov 2011, Sergey Kandaurov wrote:

> On 27 September 2011 17:27, Bjoern A. Zeeb  wrote:
>> Author: bz
>> Date: Tue Sep 27 13:27:17 2011
>> New Revision: 225793
>> URL: http://svn.freebsd.org/changeset/base/225793
>>
>> Log:
>>  Unbreak no-ip and no-inet6 module builds with ipfw.  For now continue to
>>  build the ip_fw_pfil.c hooks and ipfw even in case of no-ip under the
>>  assumption that the private L2 hook (which hopefully eventually will be a
>>  pfil hook as well) can still be useful.
>>
>>  Allow building the module without inet as well.
>>
>>  Glanced at by:        jhb
>>  MFC after:    3 days
>>
>> Modified:
>>  head/sys/modules/ipfw/Makefile
>>  head/sys/netinet/ipfw/ip_fw_pfil.c
>>
>> Modified: head/sys/modules/ipfw/Makefile
>> ==============================================================================
>> --- head/sys/modules/ipfw/Makefile      Tue Sep 27 13:20:41 2011        (r225792)
>> +++ head/sys/modules/ipfw/Makefile      Tue Sep 27 13:27:17 2011        (r225793)
>> @@ -8,7 +8,7 @@ KMOD=   ipfw
>>  SRCS=  ip_fw2.c ip_fw_pfil.c
>>  SRCS+= ip_fw_dynamic.c ip_fw_log.c
>>  SRCS+= ip_fw_sockopt.c ip_fw_table.c
>> -SRCS+= opt_inet6.h opt_ipfw.h opt_ipsec.h
>> +SRCS+= opt_inet.h opt_inet6.h opt_ipfw.h opt_ipsec.h
>>
>>  CFLAGS+= -DIPFIREWALL
>>  CFLAGS+= -I${.CURDIR}/../../contrib/pf
>> @@ -22,6 +22,10 @@ CFLAGS+= -I${.CURDIR}/../../contrib/pf
>>  #
>>
>>  .if !defined(KERNBUILDDIR)
>> +.if ${MK_INET_SUPPORT} != "no"
>> +opt_inet.h:
>> +       echo "#define INET 1" > ${.TARGET}
>> +.endif
>>  .if ${MK_INET6_SUPPORT} != "no"
>>  opt_inet6.h:
>>        echo "#define INET6 1" > ${.TARGET}
>>
>> Modified: head/sys/netinet/ipfw/ip_fw_pfil.c
>> ==============================================================================
>> --- head/sys/netinet/ipfw/ip_fw_pfil.c  Tue Sep 27 13:20:41 2011        (r225792)
>> +++ head/sys/netinet/ipfw/ip_fw_pfil.c  Tue Sep 27 13:27:17 2011        (r225793)
>> @@ -31,11 +31,11 @@ __FBSDID("$FreeBSD$");
>>  #if !defined(KLD_MODULE)
>>  #include "opt_ipdn.h"
>>  #include "opt_inet.h"
>> +#include "opt_inet6.h"
>>  #ifndef INET
>>  #error IPFIREWALL requires INET.
>>  #endif /* INET */
>>  #endif /* KLD_MODULE */
>> -#include "opt_inet6.h"
>
> Hello.
>
> This chunk seems to stop building inet6 part of ipfw.ko w/ INET6 enabled kernel.
>
> Found by /etc/rc.d/ipfw restart:
> [...]
> /etc/rc.d/ipfw: WARNING: failed to enable IPv6 firewall
>
> i.e. sysctl net.inet6.ip6.fw.enable doesn't present.
>
> Reversion of this hunk fixed the problem.
> NO_INET[46] lints aren't tested though.


Just to double-check -- this only happens for you if you build and
use the module, not when you link it into the kernel?

As in that case I do have:
lion3#  sysctl net.inet6.ip6.fw.enable 
net.inet6.ip6.fw.enable: 1


What's your src.conf and make.conf files looking like in /etc should
you have them?  Any WITHOUT_INET6 or WITHOUT_INET6_SUPPORT in there?

/bz

-- 
Bjoern A. Zeeb                                 You have to have visions!
          Stop bit received. Insert coin for new address family.
--0-1689620518-1320238410=:68690--

From owner-svn-src-head@FreeBSD.ORG  Wed Nov  2 13:35:35 2011
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 973DB106564A;
	Wed,  2 Nov 2011 13:35:35 +0000 (UTC)
	(envelope-from pluknet@gmail.com)
Received: from mail-vx0-f182.google.com (mail-vx0-f182.google.com
	[209.85.220.182])
	by mx1.freebsd.org (Postfix) with ESMTP id EC0FE8FC0C;
	Wed,  2 Nov 2011 13:35:34 +0000 (UTC)
Received: by vcbfk26 with SMTP id fk26so211563vcb.13
	for ; Wed, 02 Nov 2011 06:35:34 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma;
	h=mime-version:sender:in-reply-to:references:date
	:x-google-sender-auth:message-id:subject:from:to:cc:content-type
	:content-transfer-encoding;
	bh=vLa373BGYxIcP8e6bLdwWviSRQl/k+XMBUR6/v/uDNc=;
	b=D3SFnmp46sAMOfj5Nr6NgOcX40tEHKocUfE7mz7F0nmnQvoIaEogBYAw/IsXFJ43GR
	4WvGF8USP86luJk8Pp7XLVh4Wl7rpJAhNCPm77k81tZE5oPubqoJM+RavlB3+o+SeAat
	WxOkIREAFe+j68/3g7eoTfqPcdEpRH/21UtsA=
MIME-Version: 1.0
Received: by 10.182.110.1 with SMTP id hw1mr901048obb.38.1320240934097; Wed,
	02 Nov 2011 06:35:34 -0700 (PDT)
Sender: pluknet@gmail.com
Received: by 10.182.89.41 with HTTP; Wed, 2 Nov 2011 06:35:34 -0700 (PDT)
In-Reply-To: 
References: <201109271327.p8RDRHs8024689@svn.freebsd.org>
	
	
Date: Wed, 2 Nov 2011 16:35:34 +0300
X-Google-Sender-Auth: p_4trOgU7Ch6_CWxhnhSGpVp8dU
Message-ID: 
From: Sergey Kandaurov 
To: "Bjoern A. Zeeb" 
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org,
	src-committers@freebsd.org
Subject: Re: svn commit: r225793 - in head/sys: modules/ipfw netinet/ipfw
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 02 Nov 2011 13:35:35 -0000

On 2 November 2011 16:53, Bjoern A. Zeeb  wrote:
> On Wed, 2 Nov 2011, Sergey Kandaurov wrote:
>
>> On 27 September 2011 17:27, Bjoern A. Zeeb  wrote:
>>>
>>> Author: bz
>>> Date: Tue Sep 27 13:27:17 2011
>>> New Revision: 225793
>>> URL: http://svn.freebsd.org/changeset/base/225793
>>>
>>> Log:
>>> =A0Unbreak no-ip and no-inet6 module builds with ipfw. =A0For now conti=
nue to
>>> =A0build the ip_fw_pfil.c hooks and ipfw even in case of no-ip under th=
e
>>> =A0assumption that the private L2 hook (which hopefully eventually will=
 be
>>> a
>>> =A0pfil hook as well) can still be useful.
>>>
>>> =A0Allow building the module without inet as well.
>>>
>>> =A0Glanced at by: =A0 =A0 =A0 =A0jhb
>>> =A0MFC after: =A0 =A03 days
>>>
>>> Modified:
>>> =A0head/sys/modules/ipfw/Makefile
>>> =A0head/sys/netinet/ipfw/ip_fw_pfil.c
>>>
>>> Modified: head/sys/modules/ipfw/Makefile
>>>
>>> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D
>>> --- head/sys/modules/ipfw/Makefile =A0 =A0 =A0Tue Sep 27 13:20:41 2011
>>> =A0(r225792)
>>> +++ head/sys/modules/ipfw/Makefile =A0 =A0 =A0Tue Sep 27 13:27:17 2011
>>> =A0(r225793)
>>> @@ -8,7 +8,7 @@ KMOD=3D =A0 ipfw
>>> =A0SRCS=3D =A0ip_fw2.c ip_fw_pfil.c
>>> =A0SRCS+=3D ip_fw_dynamic.c ip_fw_log.c
>>> =A0SRCS+=3D ip_fw_sockopt.c ip_fw_table.c
>>> -SRCS+=3D opt_inet6.h opt_ipfw.h opt_ipsec.h
>>> +SRCS+=3D opt_inet.h opt_inet6.h opt_ipfw.h opt_ipsec.h
>>>
>>> =A0CFLAGS+=3D -DIPFIREWALL
>>> =A0CFLAGS+=3D -I${.CURDIR}/../../contrib/pf
>>> @@ -22,6 +22,10 @@ CFLAGS+=3D -I${.CURDIR}/../../contrib/pf
>>> =A0#
>>>
>>> =A0.if !defined(KERNBUILDDIR)
>>> +.if ${MK_INET_SUPPORT} !=3D "no"
>>> +opt_inet.h:
>>> + =A0 =A0 =A0 echo "#define INET 1" > ${.TARGET}
>>> +.endif
>>> =A0.if ${MK_INET6_SUPPORT} !=3D "no"
>>> =A0opt_inet6.h:
>>> =A0 =A0 =A0 =A0echo "#define INET6 1" > ${.TARGET}
>>>
>>> Modified: head/sys/netinet/ipfw/ip_fw_pfil.c
>>>
>>> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D
>>> --- head/sys/netinet/ipfw/ip_fw_pfil.c =A0Tue Sep 27 13:20:41 2011
>>> =A0(r225792)
>>> +++ head/sys/netinet/ipfw/ip_fw_pfil.c =A0Tue Sep 27 13:27:17 2011
>>> =A0(r225793)
>>> @@ -31,11 +31,11 @@ __FBSDID("$FreeBSD$");
>>> =A0#if !defined(KLD_MODULE)
>>> =A0#include "opt_ipdn.h"
>>> =A0#include "opt_inet.h"
>>> +#include "opt_inet6.h"
>>> =A0#ifndef INET
>>> =A0#error IPFIREWALL requires INET.
>>> =A0#endif /* INET */
>>> =A0#endif /* KLD_MODULE */
>>> -#include "opt_inet6.h"
>>
>> Hello.
>>
>> This chunk seems to stop building inet6 part of ipfw.ko w/ INET6 enabled
>> kernel.
>>
>> Found by /etc/rc.d/ipfw restart:
>> [...]
>> /etc/rc.d/ipfw: WARNING: failed to enable IPv6 firewall
>>
>> i.e. sysctl net.inet6.ip6.fw.enable doesn't present.
>>
>> Reversion of this hunk fixed the problem.
>> NO_INET[46] lints aren't tested though.
>
>
> Just to double-check -- this only happens for you if you build and
> use the module, not when you link it into the kernel?
>
> As in that case I do have:
> lion3# =A0sysctl net.inet6.ip6.fw.enable net.inet6.ip6.fw.enable: 1

ipfw is built and installed as a module as part of make kernel target.
There is no ipfw related options in KERNCONF itself.
ipfw.ko loads during rc(8) phase.

> What's your src.conf and make.conf files looking like in /etc should
> you have them? =A0Any WITHOUT_INET6 or WITHOUT_INET6_SUPPORT in there?

Nothing suspicious.

# cat /etc/src.conf
WITHOUT_CLANG=3D  yes

# cat /etc/make.conf
MODULES_OVERRIDE=3D       coretemp libalias nfsclient nfslockd nfslock \
                        nfs_common krpc nfssvc ipfw linux linprocfs \
                        mac_biba netgraph cyclic opensolaris dtrace \
                        dtrace/dtraceall cpufreq nullfs
KERNCONF=3DTST
WRKDIRPREFIX=3D/usr/works
# added by use.perl 2010-11-29 19:07:35
PERL_VERSION=3D5.10.1
WITHOUT_X11=3Dyes

(TST config has extra debugging changes, oldnfs and commented out devices.)

--=20
wbr,
pluknet

From owner-svn-src-head@FreeBSD.ORG  Wed Nov  2 13:43:17 2011
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 649291065670;
	Wed,  2 Nov 2011 13:43:17 +0000 (UTC)
	(envelope-from pawel@dawidek.net)
Received: from mail.dawidek.net (60.wheelsystems.com [83.12.187.60])
	by mx1.freebsd.org (Postfix) with ESMTP id 040FD8FC0C;
	Wed,  2 Nov 2011 13:43:17 +0000 (UTC)
Received: from localhost (58.wheelsystems.com [83.12.187.58])
	by mail.dawidek.net (Postfix) with ESMTPSA id AED71F04;
	Wed,  2 Nov 2011 14:43:14 +0100 (CET)
Date: Wed, 2 Nov 2011 14:42:26 +0100
From: Pawel Jakub Dawidek 
To: Alexander Motin 
Message-ID: <20111102134226.GA1656@garage.freebsd.pl>
References: <201111020924.pA29OxUV009135@svn.freebsd.org>
MIME-Version: 1.0
Content-Type: multipart/signed; micalg=pgp-sha1;
	protocol="application/pgp-signature"; boundary="1yeeQ81UyVL57Vl7"
Content-Disposition: inline
In-Reply-To: <201111020924.pA29OxUV009135@svn.freebsd.org>
X-OS: FreeBSD 9.0-CURRENT amd64
User-Agent: Mutt/1.5.21 (2010-09-15)
Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org,
	src-committers@freebsd.org
Subject: Re: svn commit: r227015 - 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: Wed, 02 Nov 2011 13:43:17 -0000


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

On Wed, Nov 02, 2011 at 09:24:59AM +0000, Alexander Motin wrote:
> Author: mav
> Date: Wed Nov  2 09:24:59 2011
> New Revision: 227015
> URL: http://svn.freebsd.org/changeset/base/227015
>=20
> Log:
>   Add mutex and two flags to make orphan() call properly asynchronous:
>    - delay consumer closing and detaching on orphan() until all I/Os comp=
lete;
>    - prevent new I/Os submission after orphan() called.
>   Previous implementation could destroy consumers still having active
>   requests and worked only because of global workaround made on GEOM leve=
l.

Alexander, I'm not sure I agree with your recent changes to address
this. The checks in GEOM were there to avoid the need for counting
outstanding I/O requests in every single GEOM class.

Why do you think the checks in GEOM are not good enough?

Can we design solution that can be implemented in the framework itself,
so simple GEOM classes can stay simple?

--=20
Pawel Jakub Dawidek                       http://www.wheelsystems.com
FreeBSD committer                         http://www.FreeBSD.org
Am I Evil? Yes, I Am!                     http://yomoli.com

--1yeeQ81UyVL57Vl7
Content-Type: application/pgp-signature

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

iEYEARECAAYFAk6xSMIACgkQForvXbEpPzR76ACfcnD2VIq+gZP/9wz8VrlaZrwE
McUAnj2DgGFLNV5j6g068uyWkM0C3qs8
=eTX9
-----END PGP SIGNATURE-----

--1yeeQ81UyVL57Vl7--

From owner-svn-src-head@FreeBSD.ORG  Wed Nov  2 14:28:36 2011
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id BE4EA106564A;
	Wed,  2 Nov 2011 14:28:36 +0000 (UTC)
	(envelope-from maxim@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id AE7A28FC0C;
	Wed,  2 Nov 2011 14:28:36 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pA2ESacJ025473;
	Wed, 2 Nov 2011 14:28:36 GMT (envelope-from maxim@svn.freebsd.org)
Received: (from maxim@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id pA2ESa32025471;
	Wed, 2 Nov 2011 14:28:36 GMT (envelope-from maxim@svn.freebsd.org)
Message-Id: <201111021428.pA2ESa32025471@svn.freebsd.org>
From: Maxim Konovalov 
Date: Wed, 2 Nov 2011 14:28: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: r227020 - head/share/misc
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 02 Nov 2011 14:28:36 -0000

Author: maxim
Date: Wed Nov  2 14:28:36 2011
New Revision: 227020
URL: http://svn.freebsd.org/changeset/base/227020

Log:
  OpenBSD 5.0 added.

Modified:
  head/share/misc/bsd-family-tree

Modified: head/share/misc/bsd-family-tree
==============================================================================
--- head/share/misc/bsd-family-tree	Wed Nov  2 14:23:57 2011	(r227019)
+++ head/share/misc/bsd-family-tree	Wed Nov  2 14:28:36 2011	(r227020)
@@ -248,6 +248,9 @@ FreeBSD 5.2           |      |          
  |    8.2      7.4    |      |                 |               DragonFly 2.10.1
  |     v              |      |             OpenBSD 4.9                 |
  |                    |      |                 |                       |
+ |                    |      |                 |                       |
+ |                    |      |             OpenBSD 5.0                 |
+ |                    |      |                 |                       |
 FreeBSD 9 -current    |  NetBSD -current  OpenBSD -current             |
  |                    |      |                 |                       |
  v                    v      v                 v                       v
@@ -534,6 +537,7 @@ FreeBSD 7.4		2011-02-24 [FBD]
 FreeBSD 8.2		2011-02-24 [FBD]
 DragonFly 2.10.1	2011-04-26 [DFB]
 OpenBSD 4.9		2011-05-01 [OBD]
+OpenBSD 5.0		2011-11-01 [OBD]
 
 Bibliography
 ------------------------

From owner-svn-src-head@FreeBSD.ORG  Wed Nov  2 15:09:47 2011
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id D147D106566C;
	Wed,  2 Nov 2011 15:09:47 +0000 (UTC)
	(envelope-from mavbsd@gmail.com)
Received: from mail-ey0-f182.google.com (mail-ey0-f182.google.com
	[209.85.215.182])
	by mx1.freebsd.org (Postfix) with ESMTP id A4EF28FC12;
	Wed,  2 Nov 2011 15:09:46 +0000 (UTC)
Received: by eyd10 with SMTP id 10so315079eyd.13
	for ; Wed, 02 Nov 2011 08:09:45 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma;
	h=sender:message-id:date:from:user-agent:mime-version:to:cc:subject
	:references:in-reply-to:content-type:content-transfer-encoding;
	bh=tmTTEKLOik0FzEyhJDS901yl0Kq8lfduQW8kp6bnHu0=;
	b=CNaptAv2inEQiWJJWUhv+G2HaJnU5mZIaOTgSzjUiabVubGo5X3lcaFMryi1iTEopN
	1sH5O2ovT5JLjzNDfb+hDZkZ4dNh0jx8JYcYZoFiDQjQBzx43A0qTjVdzb7BpbhMieae
	WKeBKSIfeB2JaabKq5EIuYnQi+HF+DvAgBtZA=
Received: by 10.213.10.73 with SMTP id o9mr642721ebo.40.1320246585775;
	Wed, 02 Nov 2011 08:09:45 -0700 (PDT)
Received: from mavbook2.mavhome.dp.ua (pc.mavhome.dp.ua. [212.86.226.226])
	by mx.google.com with ESMTPS id z58sm7454557eea.3.2011.11.02.08.09.43
	(version=TLSv1/SSLv3 cipher=OTHER);
	Wed, 02 Nov 2011 08:09:44 -0700 (PDT)
Sender: Alexander Motin 
Message-ID: <4EB15D36.9020409@FreeBSD.org>
Date: Wed, 02 Nov 2011 17:09:42 +0200
From: Alexander Motin 
User-Agent: Mozilla/5.0 (X11; FreeBSD amd64;
	rv:7.0.1) Gecko/20111003 Thunderbird/7.0.1
MIME-Version: 1.0
To: Pawel Jakub Dawidek 
References: <201111020924.pA29OxUV009135@svn.freebsd.org>
	<20111102134226.GA1656@garage.freebsd.pl>
In-Reply-To: <20111102134226.GA1656@garage.freebsd.pl>
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org,
	src-committers@freebsd.org
Subject: Re: svn commit: r227015 - 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: Wed, 02 Nov 2011 15:09:48 -0000

On 11/02/11 15:42, Pawel Jakub Dawidek wrote:
> On Wed, Nov 02, 2011 at 09:24:59AM +0000, Alexander Motin wrote:
>> Author: mav
>> Date: Wed Nov  2 09:24:59 2011
>> New Revision: 227015
>> URL: http://svn.freebsd.org/changeset/base/227015
>>
>> Log:
>>   Add mutex and two flags to make orphan() call properly asynchronous:
>>    - delay consumer closing and detaching on orphan() until all I/Os complete;
>>    - prevent new I/Os submission after orphan() called.
>>   Previous implementation could destroy consumers still having active
>>   requests and worked only because of global workaround made on GEOM level.
> 
> Alexander, I'm not sure I agree with your recent changes to address
> this. The checks in GEOM were there to avoid the need for counting
> outstanding I/O requests in every single GEOM class.

Sorry, I've sent you letter last week asking for your opinion on this
problem, but got no response. :(

> Why do you think the checks in GEOM are not good enough?

Mostly because nstart increment and request submission are not locked.
There are race windows between start() call, request submission and
consumer detach: start() method may get provider pointer that will not
be valid in time of the request submission.

According geom(4), that race should be closed by assumption that
provider should not be closed until all active requests are completed.
Kind of reference counting, done by top consumers, such as geom_dev or
geom_vfs. That is what I am trying to fix with my changes.

Also I don't very like idea of periodic polling, trying to catch moment
when nstart == nend. As soon as at that time we haven't called orphan()
method yet, requests may go infinitely, even though each will be aborted
quickly. It looks dirty at least.

Counting of outstanding I/O requests needed only for classes that for
some reason can't follow that assumption. For example, geom_vfs releases
provider as soon as it orphans, not waiting for close() call from file
system. Another example is gmirror -- we want to drop single
disconnected disk while upstream provider is still working and won't be
closed.

> Can we design solution that can be implemented in the framework itself,
> so simple GEOM classes can stay simple?

Simple classes without special needs around access() method and
especially with one consumer should stay simple. All they should do on
orphan() call is just forward orphan() call up, calling some
g_wither_XXX() and not trying to forcefully close consumer, and let
things happen naturally.

The problem is that start() and bio_done() methods are not locked now,
but same time they expect topology not to change under them. I am not
sure how can it be simplified globally, unless we want to lock all of
them with topology lock.

-- 
Alexander Motin

From owner-svn-src-head@FreeBSD.ORG  Wed Nov  2 15:18:11 2011
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 9ED4E1065670;
	Wed,  2 Nov 2011 15:18:11 +0000 (UTC) (envelope-from bz@freebsd.org)
Received: from mx1.sbone.de (bird.sbone.de [46.4.1.90])
	by mx1.freebsd.org (Postfix) with ESMTP id B604B8FC0C;
	Wed,  2 Nov 2011 15:18:10 +0000 (UTC)
Received: from mail.sbone.de (mail.sbone.de [IPv6:fde9:577b:c1a9:31::2013:587])
	(using TLSv1 with cipher ADH-CAMELLIA256-SHA (256/256 bits))
	(No client certificate requested)
	by mx1.sbone.de (Postfix) with ESMTPS id 8DF3325D3892;
	Wed,  2 Nov 2011 15:17:39 +0000 (UTC)
Received: from content-filter.sbone.de (content-filter.sbone.de
	[IPv6:fde9:577b:c1a9:31::2013:2742])
	(using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits))
	(No client certificate requested)
	by mail.sbone.de (Postfix) with ESMTPS id A9A77BD40AC;
	Wed,  2 Nov 2011 15:17:38 +0000 (UTC)
X-Virus-Scanned: amavisd-new at sbone.de
Received: from mail.sbone.de ([IPv6:fde9:577b:c1a9:31::2013:587])
	by content-filter.sbone.de (content-filter.sbone.de
	[fde9:577b:c1a9:31::2013:2742]) (amavisd-new, port 10024)
	with ESMTP id rcsPbEBc-euj; Wed,  2 Nov 2011 15:17:36 +0000 (UTC)
Received: from nv.sbone.de (nv.sbone.de [IPv6:fde9:577b:c1a9:31::2013:138])
	(using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits))
	(No client certificate requested)
	by mail.sbone.de (Postfix) with ESMTPSA id 9F6F5BD40A5;
	Wed,  2 Nov 2011 15:17:36 +0000 (UTC)
Date: Wed, 2 Nov 2011 15:17:36 +0000 (UTC)
From: "Bjoern A. Zeeb" 
To: Sergey Kandaurov 
In-Reply-To: 
Message-ID: 
References: <201109271327.p8RDRHs8024689@svn.freebsd.org>
	
	
	
X-OpenPGP-Key-Id: 0x14003F198FEFA3E77207EE8D2B58B8F83CCF1842
MIME-Version: 1.0
Content-Type: MULTIPART/MIXED; BOUNDARY="0-1886949233-1320247056=:68690"
Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org,
	src-committers@freebsd.org
Subject: Re: svn commit: r225793 - in head/sys: modules/ipfw netinet/ipfw
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 02 Nov 2011 15:18:11 -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-1886949233-1320247056=:68690
Content-Type: TEXT/PLAIN; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8BIT

On Wed, 2 Nov 2011, Sergey Kandaurov wrote:

> On 2 November 2011 16:53, Bjoern A. Zeeb  wrote:
>> On Wed, 2 Nov 2011, Sergey Kandaurov wrote:
>>
>>> On 27 September 2011 17:27, Bjoern A. Zeeb  wrote:
>>>>
>>>> Author: bz
>>>> Date: Tue Sep 27 13:27:17 2011
>>>> New Revision: 225793
>>>> URL: http://svn.freebsd.org/changeset/base/225793
>>>>
>>>> Log:
>>>>  Unbreak no-ip and no-inet6 module builds with ipfw.  For now continue to
>>>>  build the ip_fw_pfil.c hooks and ipfw even in case of no-ip under the
>>>>  assumption that the private L2 hook (which hopefully eventually will be
>>>> a
>>>>  pfil hook as well) can still be useful.
>>>>
>>>>  Allow building the module without inet as well.
>>>>
>>>>  Glanced at by:        jhb
>>>>  MFC after:    3 days
>>>>
>>>> Modified:
>>>>  head/sys/modules/ipfw/Makefile
>>>>  head/sys/netinet/ipfw/ip_fw_pfil.c
>>>>
>>>> Modified: head/sys/modules/ipfw/Makefile
>>>>
>>>> ==============================================================================
>>>> --- head/sys/modules/ipfw/Makefile      Tue Sep 27 13:20:41 2011
>>>>  (r225792)
>>>> +++ head/sys/modules/ipfw/Makefile      Tue Sep 27 13:27:17 2011
>>>>  (r225793)
>>>> @@ -8,7 +8,7 @@ KMOD=   ipfw
>>>>  SRCS=  ip_fw2.c ip_fw_pfil.c
>>>>  SRCS+= ip_fw_dynamic.c ip_fw_log.c
>>>>  SRCS+= ip_fw_sockopt.c ip_fw_table.c
>>>> -SRCS+= opt_inet6.h opt_ipfw.h opt_ipsec.h
>>>> +SRCS+= opt_inet.h opt_inet6.h opt_ipfw.h opt_ipsec.h
>>>>
>>>>  CFLAGS+= -DIPFIREWALL
>>>>  CFLAGS+= -I${.CURDIR}/../../contrib/pf
>>>> @@ -22,6 +22,10 @@ CFLAGS+= -I${.CURDIR}/../../contrib/pf
>>>>  #
>>>>
>>>>  .if !defined(KERNBUILDDIR)
>>>> +.if ${MK_INET_SUPPORT} != "no"
>>>> +opt_inet.h:
>>>> +       echo "#define INET 1" > ${.TARGET}
>>>> +.endif
>>>>  .if ${MK_INET6_SUPPORT} != "no"
>>>>  opt_inet6.h:
>>>>        echo "#define INET6 1" > ${.TARGET}
>>>>
>>>> Modified: head/sys/netinet/ipfw/ip_fw_pfil.c
>>>>
>>>> ==============================================================================
>>>> --- head/sys/netinet/ipfw/ip_fw_pfil.c  Tue Sep 27 13:20:41 2011
>>>>  (r225792)
>>>> +++ head/sys/netinet/ipfw/ip_fw_pfil.c  Tue Sep 27 13:27:17 2011
>>>>  (r225793)
>>>> @@ -31,11 +31,11 @@ __FBSDID("$FreeBSD$");
>>>>  #if !defined(KLD_MODULE)
>>>>  #include "opt_ipdn.h"
>>>>  #include "opt_inet.h"
>>>> +#include "opt_inet6.h"
>>>>  #ifndef INET
>>>>  #error IPFIREWALL requires INET.
>>>>  #endif /* INET */
>>>>  #endif /* KLD_MODULE */
>>>> -#include "opt_inet6.h"
>>>
>>> Hello.
>>>
>>> This chunk seems to stop building inet6 part of ipfw.ko w/ INET6 enabled
>>> kernel.
>>>
>>> Found by /etc/rc.d/ipfw restart:
>>> [...]
>>> /etc/rc.d/ipfw: WARNING: failed to enable IPv6 firewall
>>>
>>> i.e. sysctl net.inet6.ip6.fw.enable doesn't present.
>>>
>>> Reversion of this hunk fixed the problem.
>>> NO_INET[46] lints aren't tested though.
>>
>>
>> Just to double-check -- this only happens for you if you build and
>> use the module, not when you link it into the kernel?
>>
>> As in that case I do have:
>> lion3#  sysctl net.inet6.ip6.fw.enable net.inet6.ip6.fw.enable: 1
>
> ipfw is built and installed as a module as part of make kernel target.

Can you try to see if this fixes the problem?
http://people.freebsd.org/~bz/20111102-01-ipfw-kld.diff

Please not that in the module case we'd most likely also built out
some INET parts, not just INET6 once -- silently.

/bz

-- 
Bjoern A. Zeeb                                 You have to have visions!
          Stop bit received. Insert coin for new address family.
--0-1886949233-1320247056=:68690--

From owner-svn-src-head@FreeBSD.ORG  Wed Nov  2 18:06:23 2011
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 7232B1065687;
	Wed,  2 Nov 2011 18:06:23 +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 4729A8FC0A;
	Wed,  2 Nov 2011 18:06:23 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pA2I6NaT032238;
	Wed, 2 Nov 2011 18:06:23 GMT (envelope-from kib@svn.freebsd.org)
Received: (from kib@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id pA2I6Na9032235;
	Wed, 2 Nov 2011 18:06:23 GMT (envelope-from kib@svn.freebsd.org)
Message-Id: <201111021806.pA2I6Na9032235@svn.freebsd.org>
From: Konstantin Belousov 
Date: Wed, 2 Nov 2011 18:06:23 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r227023 - head/lib/libc/amd64/gen
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 02 Nov 2011 18:06:23 -0000

Author: kib
Date: Wed Nov  2 18:06:22 2011
New Revision: 227023
URL: http://svn.freebsd.org/changeset/base/227023

Log:
  Make sure that stack is 16-byte aligned before calling a function,
  as it is required by amd64 ABI. Add a comment for the places were
  the stack is accidentally properly aligned already.
  
  PR:	amd64/162214
  Submitted by:	yamayan 
  MFC after:	1 week

Modified:
  head/lib/libc/amd64/gen/setjmp.S
  head/lib/libc/amd64/gen/sigsetjmp.S

Modified: head/lib/libc/amd64/gen/setjmp.S
==============================================================================
--- head/lib/libc/amd64/gen/setjmp.S	Wed Nov  2 17:40:21 2011	(r227022)
+++ head/lib/libc/amd64/gen/setjmp.S	Wed Nov  2 18:06:22 2011	(r227023)
@@ -54,6 +54,7 @@ ENTRY(setjmp)
 	movq	$1,%rdi			/* SIG_BLOCK       */
 	movq	$0,%rsi			/* (sigset_t*)set  */
 	leaq	72(%rcx),%rdx		/* 9,10; (sigset_t*)oset */
+	/* stack is 16-byte aligned */
 	call	PIC_PLT(CNAME(_sigprocmask))
 	popq	%rdi
 	movq	%rdi,%rcx
@@ -81,7 +82,9 @@ ENTRY(__longjmp)
 	movq	$3,%rdi			/* SIG_SETMASK     */
 	leaq	72(%rdx),%rsi		/* (sigset_t*)set  */
 	movq	$0,%rdx			/* (sigset_t*)oset */
+	subq	$0x8,%rsp		/* make the stack 16-byte aligned */
 	call	PIC_PLT(CNAME(_sigprocmask))
+	addq	$0x8,%rsp
 	popq	%rsi
 	popq	%rdi			/* jmpbuf */
 	movq	%rdi,%rdx

Modified: head/lib/libc/amd64/gen/sigsetjmp.S
==============================================================================
--- head/lib/libc/amd64/gen/sigsetjmp.S	Wed Nov  2 17:40:21 2011	(r227022)
+++ head/lib/libc/amd64/gen/sigsetjmp.S	Wed Nov  2 18:06:22 2011	(r227023)
@@ -62,6 +62,7 @@ ENTRY(sigsetjmp)
 	movq	$1,%rdi			/* SIG_BLOCK       */
 	movq	$0,%rsi			/* (sigset_t*)set  */
 	leaq	72(%rcx),%rdx		/* 9,10 (sigset_t*)oset */
+	/* stack is 16-byte aligned */
 	call	PIC_PLT(CNAME(_sigprocmask))
 	popq	%rdi
 2:	movq	%rdi,%rcx
@@ -90,7 +91,9 @@ ENTRY(__siglongjmp)
 	movq	$3,%rdi			/* SIG_SETMASK     */
 	leaq	72(%rdx),%rsi		/* (sigset_t*)set  */
 	movq	$0,%rdx			/* (sigset_t*)oset */
+	subq	$0x8,%rsp		/* make the stack 16-byte aligned */
 	call	PIC_PLT(CNAME(_sigprocmask))
+	addq	$0x8,%rsp
 	popq	%rsi
 	popq	%rdi			/* jmpbuf */
 2:	movq	%rdi,%rdx

From owner-svn-src-head@FreeBSD.ORG  Wed Nov  2 18:08:31 2011
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id F3F9C106564A;
	Wed,  2 Nov 2011 18:08:30 +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 CA7DB8FC1D;
	Wed,  2 Nov 2011 18:08:30 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pA2I8U8B032333;
	Wed, 2 Nov 2011 18:08:30 GMT (envelope-from kib@svn.freebsd.org)
Received: (from kib@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id pA2I8Udk032330;
	Wed, 2 Nov 2011 18:08:30 GMT (envelope-from kib@svn.freebsd.org)
Message-Id: <201111021808.pA2I8Udk032330@svn.freebsd.org>
From: Konstantin Belousov 
Date: Wed, 2 Nov 2011 18:08: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: r227024 - head/lib/libc/i386/gen
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 02 Nov 2011 18:08:31 -0000

Author: kib
Date: Wed Nov  2 18:08:30 2011
New Revision: 227024
URL: http://svn.freebsd.org/changeset/base/227024

Log:
  Despite official i386 ABI does not mandate any stack alignment besides
  the word alignment, some versions of gcc do require 16-byte alignment.
  Make sure the stack is 16-byte aligned before calling a subroutine.
  
  Inspired by:	PR amd64/162214
  MFC after:	1 week

Modified:
  head/lib/libc/i386/gen/setjmp.S
  head/lib/libc/i386/gen/sigsetjmp.S

Modified: head/lib/libc/i386/gen/setjmp.S
==============================================================================
--- head/lib/libc/i386/gen/setjmp.S	Wed Nov  2 18:06:22 2011	(r227023)
+++ head/lib/libc/i386/gen/setjmp.S	Wed Nov  2 18:08:30 2011	(r227024)
@@ -51,12 +51,19 @@ __FBSDID("$FreeBSD$");
 ENTRY(setjmp)
 	movl	4(%esp),%ecx
 	PIC_PROLOGUE
+#ifdef PIC
+	subl	$12,%esp		/* make the stack 16-byte aligned */
+#endif
 	leal	28(%ecx), %eax
 	pushl	%eax			/* (sigset_t*)oset */
 	pushl	$0			/* (sigset_t*)set  */
 	pushl	$1			/* SIG_BLOCK       */
 	call	PIC_PLT(CNAME(_sigprocmask))
+#ifdef PIC
+	addl	$24,%esp
+#else
 	addl	$12,%esp
+#endif
 	PIC_EPILOGUE
 	movl	4(%esp),%ecx
 	movl	0(%esp),%edx
@@ -76,12 +83,19 @@ END(setjmp)
 ENTRY(__longjmp)
 	movl	4(%esp),%edx
 	PIC_PROLOGUE
+#ifdef PIC
+	subl	$12,%esp		/* make the stack 16-byte aligned */
+#endif
 	pushl	$0			/* (sigset_t*)oset */
 	leal	28(%edx), %eax
 	pushl	%eax			/* (sigset_t*)set  */
 	pushl	$3			/* SIG_SETMASK     */
 	call	PIC_PLT(CNAME(_sigprocmask))
+#ifdef PIC
+	addl	$24,%esp
+#else
 	addl	$12,%esp
+#endif
 	PIC_EPILOGUE
 	movl	4(%esp),%edx
 	movl	8(%esp),%eax

Modified: head/lib/libc/i386/gen/sigsetjmp.S
==============================================================================
--- head/lib/libc/i386/gen/sigsetjmp.S	Wed Nov  2 18:06:22 2011	(r227023)
+++ head/lib/libc/i386/gen/sigsetjmp.S	Wed Nov  2 18:08:30 2011	(r227024)
@@ -60,12 +60,19 @@ ENTRY(sigsetjmp)
 	testl	%eax,%eax
 	jz	2f
 	PIC_PROLOGUE
+#ifdef PIC
+	subl	$12,%esp		/* make the stack 16-byte aligned */
+#endif
 	leal	28(%ecx), %eax
 	pushl	%eax			/* (sigset_t*)oset */
 	pushl	$0			/* (sigset_t*)set  */
 	pushl	$1			/* SIG_BLOCK       */
 	call	PIC_PLT(CNAME(_sigprocmask))
+#ifdef PIC
+	addl	$24,%esp
+#else
 	addl	$12,%esp
+#endif
 	PIC_EPILOGUE
 	movl	4(%esp),%ecx
 2:	movl	0(%esp),%edx
@@ -87,12 +94,19 @@ ENTRY(__siglongjmp)
 	cmpl	$0,44(%edx)
 	jz	2f
 	PIC_PROLOGUE
+#ifdef PIC
+	subl	$12,%esp		/* make the stack 16-byte aligned */
+#endif
 	pushl	$0			/* (sigset_t*)oset */
 	leal	28(%edx), %eax
 	pushl	%eax			/* (sigset_t*)set  */
 	pushl	$3			/* SIG_SETMASK     */
 	call	PIC_PLT(CNAME(_sigprocmask))
+#ifdef PIC
+	addl	$24,%esp
+#else
 	addl	$12,%esp
+#endif
 	PIC_EPILOGUE
 	movl	4(%esp),%edx
 2:	movl	8(%esp),%eax

From owner-svn-src-head@FreeBSD.ORG  Wed Nov  2 18:26:47 2011
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 9DB28106566C;
	Wed,  2 Nov 2011 18:26:47 +0000 (UTC)
	(envelope-from pluknet@gmail.com)
Received: from mail-vx0-f182.google.com (mail-vx0-f182.google.com
	[209.85.220.182])
	by mx1.freebsd.org (Postfix) with ESMTP id 177768FC08;
	Wed,  2 Nov 2011 18:26:46 +0000 (UTC)
Received: by vcbfk26 with SMTP id fk26so657274vcb.13
	for ; Wed, 02 Nov 2011 11:26:46 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma;
	h=mime-version:sender:in-reply-to:references:date
	:x-google-sender-auth:message-id:subject:from:to:cc:content-type
	:content-transfer-encoding;
	bh=V8JVJiAKzQL/38PlxwMoylnPHd2yII6d4f5Mbeo0u9k=;
	b=TDr7s6Z8tV0NF4Rl6E3R/mBdfadQfdyBLu9JdCcxLvWrxcIFN4XtkF2MRFvf2wflkg
	cDOhBpz0ZI5ZEGKP6YgUXQkDK25xouA49xZfAUPdLduVpr2233OcXcYCfr0jhTywkQoa
	+vJxxgIJ6MbSPBj7xQEvF7q2ktRL1GjZw3xT4=
MIME-Version: 1.0
Received: by 10.182.110.1 with SMTP id hw1mr1136294obb.38.1320258406289; Wed,
	02 Nov 2011 11:26:46 -0700 (PDT)
Sender: pluknet@gmail.com
Received: by 10.182.89.41 with HTTP; Wed, 2 Nov 2011 11:26:46 -0700 (PDT)
In-Reply-To: 
References: <201109271327.p8RDRHs8024689@svn.freebsd.org>
	
	
	
	
Date: Wed, 2 Nov 2011 21:26:46 +0300
X-Google-Sender-Auth: IMlazqwJFLMecc4U3T1MOLSeI5g
Message-ID: 
From: Sergey Kandaurov 
To: "Bjoern A. Zeeb" 
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org,
	src-committers@freebsd.org
Subject: Re: svn commit: r225793 - in head/sys: modules/ipfw netinet/ipfw
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 02 Nov 2011 18:26:47 -0000

On 2 November 2011 19:17, Bjoern A. Zeeb  wrote:
> On Wed, 2 Nov 2011, Sergey Kandaurov wrote:
>
>> On 2 November 2011 16:53, Bjoern A. Zeeb  wrote:
>>>
>>> On Wed, 2 Nov 2011, Sergey Kandaurov wrote:
>>>
>>>> On 27 September 2011 17:27, Bjoern A. Zeeb  wrote:
>>>>>
>>>>> Author: bz
>>>>> Date: Tue Sep 27 13:27:17 2011
>>>>> New Revision: 225793
>>>>> URL: http://svn.freebsd.org/changeset/base/225793
>>>>>
>>>>> Log:
>>>>> =A0Unbreak no-ip and no-inet6 module builds with ipfw. =A0For now con=
tinue
>>>>> to
>>>>> =A0build the ip_fw_pfil.c hooks and ipfw even in case of no-ip under =
the
>>>>> =A0assumption that the private L2 hook (which hopefully eventually wi=
ll
>>>>> be
>>>>> a
>>>>> =A0pfil hook as well) can still be useful.
>>>>>
>>>>> =A0Allow building the module without inet as well.
>>>>>
>>>>> =A0Glanced at by: =A0 =A0 =A0 =A0jhb
>>>>> =A0MFC after: =A0 =A03 days
>>>>>
>>>>> Modified:
>>>>> =A0head/sys/modules/ipfw/Makefile
>>>>> =A0head/sys/netinet/ipfw/ip_fw_pfil.c
>>>>>
>>>>> Modified: head/sys/modules/ipfw/Makefile
>>>>>
>>>>>
>>>>> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D
>>>>> --- head/sys/modules/ipfw/Makefile =A0 =A0 =A0Tue Sep 27 13:20:41 201=
1
>>>>> =A0(r225792)
>>>>> +++ head/sys/modules/ipfw/Makefile =A0 =A0 =A0Tue Sep 27 13:27:17 201=
1
>>>>> =A0(r225793)
>>>>> @@ -8,7 +8,7 @@ KMOD=3D =A0 ipfw
>>>>> =A0SRCS=3D =A0ip_fw2.c ip_fw_pfil.c
>>>>> =A0SRCS+=3D ip_fw_dynamic.c ip_fw_log.c
>>>>> =A0SRCS+=3D ip_fw_sockopt.c ip_fw_table.c
>>>>> -SRCS+=3D opt_inet6.h opt_ipfw.h opt_ipsec.h
>>>>> +SRCS+=3D opt_inet.h opt_inet6.h opt_ipfw.h opt_ipsec.h
>>>>>
>>>>> =A0CFLAGS+=3D -DIPFIREWALL
>>>>> =A0CFLAGS+=3D -I${.CURDIR}/../../contrib/pf
>>>>> @@ -22,6 +22,10 @@ CFLAGS+=3D -I${.CURDIR}/../../contrib/pf
>>>>> =A0#
>>>>>
>>>>> =A0.if !defined(KERNBUILDDIR)
>>>>> +.if ${MK_INET_SUPPORT} !=3D "no"
>>>>> +opt_inet.h:
>>>>> + =A0 =A0 =A0 echo "#define INET 1" > ${.TARGET}
>>>>> +.endif
>>>>> =A0.if ${MK_INET6_SUPPORT} !=3D "no"
>>>>> =A0opt_inet6.h:
>>>>> =A0 =A0 =A0 =A0echo "#define INET6 1" > ${.TARGET}
>>>>>
>>>>> Modified: head/sys/netinet/ipfw/ip_fw_pfil.c
>>>>>
>>>>>
>>>>> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D
>>>>> --- head/sys/netinet/ipfw/ip_fw_pfil.c =A0Tue Sep 27 13:20:41 2011
>>>>> =A0(r225792)
>>>>> +++ head/sys/netinet/ipfw/ip_fw_pfil.c =A0Tue Sep 27 13:27:17 2011
>>>>> =A0(r225793)
>>>>> @@ -31,11 +31,11 @@ __FBSDID("$FreeBSD$");
>>>>> =A0#if !defined(KLD_MODULE)
>>>>> =A0#include "opt_ipdn.h"
>>>>> =A0#include "opt_inet.h"
>>>>> +#include "opt_inet6.h"
>>>>> =A0#ifndef INET
>>>>> =A0#error IPFIREWALL requires INET.
>>>>> =A0#endif /* INET */
>>>>> =A0#endif /* KLD_MODULE */
>>>>> -#include "opt_inet6.h"
>>>>
>>>> Hello.
>>>>
>>>> This chunk seems to stop building inet6 part of ipfw.ko w/ INET6 enabl=
ed
>>>> kernel.
>>>>
>>>> Found by /etc/rc.d/ipfw restart:
>>>> [...]
>>>> /etc/rc.d/ipfw: WARNING: failed to enable IPv6 firewall
>>>>
>>>> i.e. sysctl net.inet6.ip6.fw.enable doesn't present.
>>>>
>>>> Reversion of this hunk fixed the problem.
>>>> NO_INET[46] lints aren't tested though.
>>>
>>>
>>> Just to double-check -- this only happens for you if you build and
>>> use the module, not when you link it into the kernel?
>>>
>>> As in that case I do have:
>>> lion3# =A0sysctl net.inet6.ip6.fw.enable net.inet6.ip6.fw.enable: 1
>>
>> ipfw is built and installed as a module as part of make kernel target.
>
> Can you try to see if this fixes the problem?
> http://people.freebsd.org/~bz/20111102-01-ipfw-kld.diff
>
> Please not that in the module case we'd most likely also built out
> some INET parts, not just INET6 once -- silently.
>

Hmm.. It is compiled differently when is built standalone and
as part of make buildkernel.

If built from sys/modules/ipfw:

# make
Warning: Object directory not changed from original /usr/src/sys/modules/ip=
fw
cc -O2 -pipe -DIPFIREWALL -fno-strict-aliasing -Werror -D_KERNEL
-DKLD_MODULE -nostdinc  -I/usr/src/sys/modules/ipfw/../../contrib/pf
-I. -I@ -I@/contrib/altq -finline-limit=3D8000 --param
inline-unit-growth=3D100 --param large-function-growth=3D1000 -fno-common
-fno-omit-frame-pointer  -mno-sse -mcmodel=3Dkernel -mno-red-zone
-mno-mmx -msoft-float  -fno-asynchronous-unwind-tables -ffreestanding
-fstack-protector -std=3Diso9899:1999 -fstack-protector -Wall
-Wredundant-decls -Wnested-externs -Wstrict-prototypes
-Wmissing-prototypes -Wpointer-arith -Winline -Wcast-qual  -Wundef
-Wno-pointer-sign -fformat-extensions  -Wmissing-include-dirs
-fdiagnostics-show-option -c
/usr/src/sys/modules/ipfw/../../netinet/ipfw/ip_fw2.c
/usr/src/sys/modules/ipfw/../../netinet/ipfw/ip_fw2.c:34:26: error:
opt_ipdivert.h: No such file or directory
/usr/src/sys/modules/ipfw/../../netinet/ipfw/ip_fw2.c:35:22: error:
opt_ipdn.h: No such file or directory
*** Error code 1

# ls sys/modules/ipfw/opt*
sys/modules/ipfw/opt_inet.h     sys/modules/ipfw/opt_ipfw.h
sys/modules/ipfw/opt_inet6.h    sys/modules/ipfw/opt_ipsec.h

Maybe add the missing opt* into module's Makefile?

Index: sys/modules/ipfw/Makefile
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- sys/modules/ipfw/Makefile   (revision 226966)
+++ sys/modules/ipfw/Makefile   (working copy)
@@ -8,7 +8,8 @@
 SRCS=3D  ip_fw2.c ip_fw_pfil.c
 SRCS+=3D ip_fw_dynamic.c ip_fw_log.c
 SRCS+=3D ip_fw_sockopt.c ip_fw_table.c
-SRCS+=3D opt_inet.h opt_inet6.h opt_ipfw.h opt_ipsec.h
+SRCS+=3D opt_inet.h opt_inet6.h opt_ipdivert.h opt_ipdn.h opt_ipfw.h opt_i=
psec.h
+SRCS+=3D opt_compat.h    # for a local change

 CFLAGS+=3D -DIPFIREWALL
 CFLAGS+=3D -I${.CURDIR}/../../contrib/pf



And successfully as part of make buildkernel (w/o the above change to Makef=
ile):

[...]
=3D=3D=3D> ipfw (all)
cc -O2 -pipe -DIPFIREWALL -fno-strict-aliasing -Werror -D_KERNEL
-DKLD_MODULE -nostdinc  -I/usr/src/sys/modules/ipfw/../../contrib/pf
-DHAVE_KERNEL_OPTION_HEADERS -include
/usr/obj/usr/src/sys/TST/opt_global.h -I. -I@ -I@/contrib/altq
-finline-limit=3D8000 --param inline-unit-growth=3D100 --param
large-function-growth=3D1000 -fno-common -g -fno-omit-frame-pointer
-I/usr/obj/usr/src/sys/TST  -mno-sse -mcmodel=3Dkernel -mno-red-zone
-mno-mmx -msoft-float  -fno-asynchronous-unwind-tables -ffreestanding
-fstack-protector -std=3Diso9899:1999 -fstack-protector -Wall
-Wredundant-decls -Wnested-externs -Wstrict-prototypes
-Wmissing-prototypes -Wpointer-arith -Winline -Wcast-qual  -Wundef
-Wno-pointer-sign -fformat-extensions  -Wmissing-include-dirs
-fdiagnostics-show-option -c
/usr/src/sys/modules/ipfw/../../netinet/ipfw/ip_fw2.c
cc -O2 -pipe -DIPFIREWALL -fno-strict-aliasing -Werror -D_KERNEL
-DKLD_MODULE -nostdinc  -I/usr/src/sys/modules/ipfw/../../contrib/pf
-DHAVE_KERNEL_OPTION_HEADERS -include
/usr/obj/usr/src/sys/TST/opt_global.h -I. -I@ -I@/contrib/altq
-finline-limit=3D8000 --param inline-unit-growth=3D100 --param
large-function-growth=3D1000 -fno-common -g -fno-omit-frame-pointer
-I/usr/obj/usr/src/sys/TST  -mno-sse -mcmodel=3Dkernel -mno-red-zone
-mno-mmx -msoft-float  -fno-asynchronous-unwind-tables -ffreestanding
-fstack-protector -std=3Diso9899:1999 -fstack-protector -Wall
-Wredundant-decls -Wnested-externs -Wstrict-prototypes
-Wmissing-prototypes -Wpointer-arith -Winline -Wcast-qual  -Wundef
-Wno-pointer-sign -fformat-extensions  -Wmissing-include-dirs
-fdiagnostics-show-option -c
/usr/src/sys/modules/ipfw/../../netinet/ipfw/ip_fw_pfil.c
cc -O2 -pipe -DIPFIREWALL -fno-strict-aliasing -Werror -D_KERNEL
-DKLD_MODULE -nostdinc  -I/usr/src/sys/modules/ipfw/../../contrib/pf
-DHAVE_KERNEL_OPTION_HEADERS -include
/usr/obj/usr/src/sys/TST/opt_global.h -I. -I@ -I@/contrib/altq
-finline-limit=3D8000 --param inline-unit-growth=3D100 --param
large-function-growth=3D1000 -fno-common -g -fno-omit-frame-pointer
-I/usr/obj/usr/src/sys/TST  -mno-sse -mcmodel=3Dkernel -mno-red-zone
-mno-mmx -msoft-float  -fno-asynchronous-unwind-tables -ffreestanding
-fstack-protector -std=3Diso9899:1999 -fstack-protector -Wall
-Wredundant-decls -Wnested-externs -Wstrict-prototypes
-Wmissing-prototypes -Wpointer-arith -Winline -Wcast-qual  -Wundef
-Wno-pointer-sign -fformat-extensions  -Wmissing-include-dirs
-fdiagnostics-show-option -c
/usr/src/sys/modules/ipfw/../../netinet/ipfw/ip_fw_dynamic.c
cc -O2 -pipe -DIPFIREWALL -fno-strict-aliasing -Werror -D_KERNEL
-DKLD_MODULE -nostdinc  -I/usr/src/sys/modules/ipfw/../../contrib/pf
-DHAVE_KERNEL_OPTION_HEADERS -include
/usr/obj/usr/src/sys/TST/opt_global.h -I. -I@ -I@/contrib/altq
-finline-limit=3D8000 --param inline-unit-growth=3D100 --param
large-function-growth=3D1000 -fno-common -g -fno-omit-frame-pointer
-I/usr/obj/usr/src/sys/TST  -mno-sse -mcmodel=3Dkernel -mno-red-zone
-mno-mmx -msoft-float  -fno-asynchronous-unwind-tables -ffreestanding
-fstack-protector -std=3Diso9899:1999 -fstack-protector -Wall
-Wredundant-decls -Wnested-externs -Wstrict-prototypes
-Wmissing-prototypes -Wpointer-arith -Winline -Wcast-qual  -Wundef
-Wno-pointer-sign -fformat-extensions  -Wmissing-include-dirs
-fdiagnostics-show-option -c
/usr/src/sys/modules/ipfw/../../netinet/ipfw/ip_fw_log.c
ctfconvert -L VERSION -g ip_fw_pfil.o
ctfconvert -L VERSION -g ip_fw_log.o
cc -O2 -pipe -DIPFIREWALL -fno-strict-aliasing -Werror -D_KERNEL
-DKLD_MODULE -nostdinc  -I/usr/src/sys/modules/ipfw/../../contrib/pf
-DHAVE_KERNEL_OPTION_HEADERS -include
/usr/obj/usr/src/sys/TST/opt_global.h -I. -I@ -I@/contrib/altq
-finline-limit=3D8000 --param inline-unit-growth=3D100 --param
large-function-growth=3D1000 -fno-common -g -fno-omit-frame-pointer
-I/usr/obj/usr/src/sys/TST  -mno-sse -mcmodel=3Dkernel -mno-red-zone
-mno-mmx -msoft-float  -fno-asynchronous-unwind-tables -ffreestanding
-fstack-protector -std=3Diso9899:1999 -fstack-protector -Wall
-Wredundant-decls -Wnested-externs -Wstrict-prototypes
-Wmissing-prototypes -Wpointer-arith -Winline -Wcast-qual  -Wundef
-Wno-pointer-sign -fformat-extensions  -Wmissing-include-dirs
-fdiagnostics-show-option -c
/usr/src/sys/modules/ipfw/../../netinet/ipfw/ip_fw_sockopt.c
cc -O2 -pipe -DIPFIREWALL -fno-strict-aliasing -Werror -D_KERNEL
-DKLD_MODULE -nostdinc  -I/usr/src/sys/modules/ipfw/../../contrib/pf
-DHAVE_KERNEL_OPTION_HEADERS -include
/usr/obj/usr/src/sys/TST/opt_global.h -I. -I@ -I@/contrib/altq
-finline-limit=3D8000 --param inline-unit-growth=3D100 --param
large-function-growth=3D1000 -fno-common -g -fno-omit-frame-pointer
-I/usr/obj/usr/src/sys/TST  -mno-sse -mcmodel=3Dkernel -mno-red-zone
-mno-mmx -msoft-float  -fno-asynchronous-unwind-tables -ffreestanding
-fstack-protector -std=3Diso9899:1999 -fstack-protector -Wall
-Wredundant-decls -Wnested-externs -Wstrict-prototypes
-Wmissing-prototypes -Wpointer-arith -Winline -Wcast-qual  -Wundef
-Wno-pointer-sign -fformat-extensions  -Wmissing-include-dirs
-fdiagnostics-show-option -c
/usr/src/sys/modules/ipfw/../../netinet/ipfw/ip_fw_table.c
ctfconvert -L VERSION -g ip_fw_dynamic.o
ctfconvert -L VERSION -g ip_fw_table.o
ctfconvert -L VERSION -g ip_fw_sockopt.o
ctfconvert -L VERSION -g ip_fw2.o
ld  -d -warn-common -r -d -o ipfw.ko.debug ip_fw2.o ip_fw_pfil.o
ip_fw_dynamic.o ip_fw_log.o ip_fw_sockopt.o ip_fw_table.o
:> export_syms
awk -f /usr/src/sys/conf/kmod_syms.awk ipfw.ko.debug  export_syms |
xargs -J% objcopy % ipfw.ko.debug
objcopy --only-keep-debug ipfw.ko.debug ipfw.ko.symbols
objcopy --strip-debug --add-gnu-debuglink=3Dipfw.ko.symbols ipfw.ko.debug i=
pfw.ko
[...]

--=20
wbr,
pluknet

From owner-svn-src-head@FreeBSD.ORG  Wed Nov  2 20:45:44 2011
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id B8C731065670;
	Wed,  2 Nov 2011 20:45:44 +0000 (UTC)
	(envelope-from cognet@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id A86FA8FC16;
	Wed,  2 Nov 2011 20:45:44 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pA2KjiYp037590;
	Wed, 2 Nov 2011 20:45:44 GMT (envelope-from cognet@svn.freebsd.org)
Received: (from cognet@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id pA2KjiYS037588;
	Wed, 2 Nov 2011 20:45:44 GMT (envelope-from cognet@svn.freebsd.org)
Message-Id: <201111022045.pA2KjiYS037588@svn.freebsd.org>
From: Olivier Houchard 
Date: Wed, 2 Nov 2011 20:45: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: r227032 - head/sys/dev/uart
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 02 Nov 2011 20:45:44 -0000

Author: cognet
Date: Wed Nov  2 20:45:44 2011
New Revision: 227032
URL: http://svn.freebsd.org/changeset/base/227032

Log:
  Disable the TX ready interrupts once we received one, some UART won't clear
  the IIR_TXRDY bit upon reading.
  
  Reviewed by:	marcel

Modified:
  head/sys/dev/uart/uart_dev_ns8250.c

Modified: head/sys/dev/uart/uart_dev_ns8250.c
==============================================================================
--- head/sys/dev/uart/uart_dev_ns8250.c	Wed Nov  2 20:11:19 2011	(r227031)
+++ head/sys/dev/uart/uart_dev_ns8250.c	Wed Nov  2 20:45:44 2011	(r227032)
@@ -582,9 +582,11 @@ static int
 ns8250_bus_ipend(struct uart_softc *sc)
 {
 	struct uart_bas *bas;
+	struct ns8250_softc *ns8250;
 	int ipend;
 	uint8_t iir, lsr;
 
+	ns8250 = (struct ns8250_softc *)sc;
 	bas = &sc->sc_bas;
 	uart_lock(sc->sc_hwmtx);
 	iir = uart_getreg(bas, REG_IIR);
@@ -602,9 +604,10 @@ ns8250_bus_ipend(struct uart_softc *sc)
 		if (lsr & LSR_RXRDY)
 			ipend |= SER_INT_RXREADY;
 	} else {
-		if (iir & IIR_TXRDY)
+		if (iir & IIR_TXRDY) {
 			ipend |= SER_INT_TXIDLE;
-		else
+			uart_setreg(bas, REG_IER, ns8250->ier);
+		} else
 			ipend |= SER_INT_SIGCHG;
 	}
 	if (ipend == 0)

From owner-svn-src-head@FreeBSD.ORG  Wed Nov  2 20:58:47 2011
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id DCEEB106566C;
	Wed,  2 Nov 2011 20:58:47 +0000 (UTC)
	(envelope-from pluknet@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id CC6078FC0A;
	Wed,  2 Nov 2011 20:58:47 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pA2KwlqC038065;
	Wed, 2 Nov 2011 20:58:47 GMT (envelope-from pluknet@svn.freebsd.org)
Received: (from pluknet@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id pA2KwlpX038062;
	Wed, 2 Nov 2011 20:58:47 GMT (envelope-from pluknet@svn.freebsd.org)
Message-Id: <201111022058.pA2KwlpX038062@svn.freebsd.org>
From: Sergey Kandaurov 
Date: Wed, 2 Nov 2011 20:58:47 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r227034 - head/sys/netinet
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 02 Nov 2011 20:58:48 -0000

Author: pluknet
Date: Wed Nov  2 20:58:47 2011
New Revision: 227034
URL: http://svn.freebsd.org/changeset/base/227034

Log:
  Restore sysctl names for tcp_sendspace/tcp_recvspace.
  
  They seem to be changed unintentionally in r226437, and there were no
  any mentions of renaming in commit log message.
  
  Reported by:	Anton Yuzhaninov 

Modified:
  head/sys/netinet/tcp_input.c
  head/sys/netinet/tcp_output.c

Modified: head/sys/netinet/tcp_input.c
==============================================================================
--- head/sys/netinet/tcp_input.c	Wed Nov  2 20:55:55 2011	(r227033)
+++ head/sys/netinet/tcp_input.c	Wed Nov  2 20:58:47 2011	(r227034)
@@ -185,7 +185,7 @@ SYSCTL_VNET_INT(_net_inet_tcp, OID_AUTO,
 
 VNET_DEFINE(int, tcp_recvspace) = 1024*64;
 #define	V_tcp_recvspace	VNET(tcp_recvspace)
-SYSCTL_VNET_INT(_net_inet_tcp, TCPCTL_RECVSPACE, tcp_recvspace, CTLFLAG_RW,
+SYSCTL_VNET_INT(_net_inet_tcp, TCPCTL_RECVSPACE, recvspace, CTLFLAG_RW,
     &VNET_NAME(tcp_recvspace), 0, "Initial receive socket buffer size");
 
 VNET_DEFINE(int, tcp_do_autorcvbuf) = 1;

Modified: head/sys/netinet/tcp_output.c
==============================================================================
--- head/sys/netinet/tcp_output.c	Wed Nov  2 20:55:55 2011	(r227033)
+++ head/sys/netinet/tcp_output.c	Wed Nov  2 20:58:47 2011	(r227034)
@@ -97,7 +97,7 @@ SYSCTL_VNET_INT(_net_inet_tcp, OID_AUTO,
 
 VNET_DEFINE(int, tcp_sendspace) = 1024*32;
 #define	V_tcp_sendspace	VNET(tcp_sendspace)
-SYSCTL_VNET_INT(_net_inet_tcp, TCPCTL_SENDSPACE, tcp_sendspace, CTLFLAG_RW,
+SYSCTL_VNET_INT(_net_inet_tcp, TCPCTL_SENDSPACE, sendspace, CTLFLAG_RW,
 	&VNET_NAME(tcp_sendspace), 0, "Initial send socket buffer size");
 
 VNET_DEFINE(int, tcp_do_autosndbuf) = 1;

From owner-svn-src-head@FreeBSD.ORG  Wed Nov  2 21:54:48 2011
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id E3DA81065672;
	Wed,  2 Nov 2011 21:54:48 +0000 (UTC) (envelope-from bz@FreeBSD.org)
Received: from mx1.sbone.de (bird.sbone.de [46.4.1.90])
	by mx1.freebsd.org (Postfix) with ESMTP id 3E2C48FC19;
	Wed,  2 Nov 2011 21:54:48 +0000 (UTC)
Received: from mail.sbone.de (mail.sbone.de [IPv6:fde9:577b:c1a9:31::2013:587])
	(using TLSv1 with cipher ADH-CAMELLIA256-SHA (256/256 bits))
	(No client certificate requested)
	by mx1.sbone.de (Postfix) with ESMTPS id E6B1725D3899;
	Wed,  2 Nov 2011 21:54:16 +0000 (UTC)
Received: from content-filter.sbone.de (content-filter.sbone.de
	[IPv6:fde9:577b:c1a9:31::2013:2742])
	(using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits))
	(No client certificate requested)
	by mail.sbone.de (Postfix) with ESMTPS id 10588BD40F9;
	Wed,  2 Nov 2011 21:54:16 +0000 (UTC)
X-Virus-Scanned: amavisd-new at sbone.de
Received: from mail.sbone.de ([IPv6:fde9:577b:c1a9:31::2013:587])
	by content-filter.sbone.de (content-filter.sbone.de
	[fde9:577b:c1a9:31::2013:2742]) (amavisd-new, port 10024)
	with ESMTP id GhfIevDHDd1p; Wed,  2 Nov 2011 21:54:14 +0000 (UTC)
Received: from nv.sbone.de (nv.sbone.de [IPv6:fde9:577b:c1a9:31::2013:138])
	(using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits))
	(No client certificate requested)
	by mail.sbone.de (Postfix) with ESMTPSA id 4B177BD40EC;
	Wed,  2 Nov 2011 21:54:14 +0000 (UTC)
Date: Wed, 2 Nov 2011 21:54:13 +0000 (UTC)
From: "Bjoern A. Zeeb" 
To: Sergey Kandaurov 
In-Reply-To: 
Message-ID: 
References: <201109271327.p8RDRHs8024689@svn.freebsd.org>
	
	
	
	
X-OpenPGP-Key-Id: 0x14003F198FEFA3E77207EE8D2B58B8F83CCF1842
MIME-Version: 1.0
Content-Type: MULTIPART/MIXED; BOUNDARY="0-863113531-1320270854=:68690"
Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org,
	src-committers@freebsd.org
Subject: Re: svn commit: r225793 - in head/sys: modules/ipfw netinet/ipfw
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 02 Nov 2011 21:54:49 -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-863113531-1320270854=:68690
Content-Type: TEXT/PLAIN; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8BIT

On Wed, 2 Nov 2011, Bjoern A. Zeeb wrote:

> On Wed, 2 Nov 2011, Sergey Kandaurov wrote:
>
>> On 2 November 2011 16:53, Bjoern A. Zeeb  wrote:
>>> On Wed, 2 Nov 2011, Sergey Kandaurov wrote:
>>> 
>>>> On 27 September 2011 17:27, Bjoern A. Zeeb  wrote:
>>>>> 
>>>>> Author: bz
>>>>> Date: Tue Sep 27 13:27:17 2011
>>>>> New Revision: 225793
>>>>> URL: http://svn.freebsd.org/changeset/base/225793
>>>>> 
>>>>> Log:
>>>>>  Unbreak no-ip and no-inet6 module builds with ipfw.  For now continue 
>>>>> to
>>>>>  build the ip_fw_pfil.c hooks and ipfw even in case of no-ip under the
>>>>>  assumption that the private L2 hook (which hopefully eventually will be
>>>>> a
>>>>>  pfil hook as well) can still be useful.
>>>>> 
>>>>>  Allow building the module without inet as well.
>>>>> 
>>>>>  Glanced at by:        jhb
>>>>>  MFC after:    3 days
>>>>> 
>>>>> Modified:
>>>>>  head/sys/modules/ipfw/Makefile
>>>>>  head/sys/netinet/ipfw/ip_fw_pfil.c
>>>>> 
>>>>> Modified: head/sys/modules/ipfw/Makefile
>>>>> 
>>>>> ==============================================================================
>>>>> --- head/sys/modules/ipfw/Makefile      Tue Sep 27 13:20:41 2011
>>>>>  (r225792)
>>>>> +++ head/sys/modules/ipfw/Makefile      Tue Sep 27 13:27:17 2011
>>>>>  (r225793)
>>>>> @@ -8,7 +8,7 @@ KMOD=   ipfw
>>>>>  SRCS=  ip_fw2.c ip_fw_pfil.c
>>>>>  SRCS+= ip_fw_dynamic.c ip_fw_log.c
>>>>>  SRCS+= ip_fw_sockopt.c ip_fw_table.c
>>>>> -SRCS+= opt_inet6.h opt_ipfw.h opt_ipsec.h
>>>>> +SRCS+= opt_inet.h opt_inet6.h opt_ipfw.h opt_ipsec.h
>>>>> 
>>>>>  CFLAGS+= -DIPFIREWALL
>>>>>  CFLAGS+= -I${.CURDIR}/../../contrib/pf
>>>>> @@ -22,6 +22,10 @@ CFLAGS+= -I${.CURDIR}/../../contrib/pf
>>>>>  #
>>>>> 
>>>>>  .if !defined(KERNBUILDDIR)
>>>>> +.if ${MK_INET_SUPPORT} != "no"
>>>>> +opt_inet.h:
>>>>> +       echo "#define INET 1" > ${.TARGET}
>>>>> +.endif
>>>>>  .if ${MK_INET6_SUPPORT} != "no"
>>>>>  opt_inet6.h:
>>>>>        echo "#define INET6 1" > ${.TARGET}
>>>>> 
>>>>> Modified: head/sys/netinet/ipfw/ip_fw_pfil.c
>>>>> 
>>>>> ==============================================================================
>>>>> --- head/sys/netinet/ipfw/ip_fw_pfil.c  Tue Sep 27 13:20:41 2011
>>>>>  (r225792)
>>>>> +++ head/sys/netinet/ipfw/ip_fw_pfil.c  Tue Sep 27 13:27:17 2011
>>>>>  (r225793)
>>>>> @@ -31,11 +31,11 @@ __FBSDID("$FreeBSD$");
>>>>>  #if !defined(KLD_MODULE)
>>>>>  #include "opt_ipdn.h"
>>>>>  #include "opt_inet.h"
>>>>> +#include "opt_inet6.h"
>>>>>  #ifndef INET
>>>>>  #error IPFIREWALL requires INET.
>>>>>  #endif /* INET */
>>>>>  #endif /* KLD_MODULE */
>>>>> -#include "opt_inet6.h"
>>>> 
>>>> Hello.
>>>> 
>>>> This chunk seems to stop building inet6 part of ipfw.ko w/ INET6 enabled
>>>> kernel.
>>>> 
>>>> Found by /etc/rc.d/ipfw restart:
>>>> [...]
>>>> /etc/rc.d/ipfw: WARNING: failed to enable IPv6 firewall
>>>> 
>>>> i.e. sysctl net.inet6.ip6.fw.enable doesn't present.
>>>> 
>>>> Reversion of this hunk fixed the problem.
>>>> NO_INET[46] lints aren't tested though.
>>> 
>>> 
>>> Just to double-check -- this only happens for you if you build and
>>> use the module, not when you link it into the kernel?
>>> 
>>> As in that case I do have:
>>> lion3#  sysctl net.inet6.ip6.fw.enable net.inet6.ip6.fw.enable: 1
>> 
>> ipfw is built and installed as a module as part of make kernel target.
>
> Can you try to see if this fixes the problem?
> http://people.freebsd.org/~bz/20111102-01-ipfw-kld.diff
>
> Please not that in the module case we'd most likely also built out
> some INET parts, not just INET6 once -- silently.

here's an updated patch that cleans up some more:

http://people.freebsd.org/~bz/20111102-03-ipfw-kld.diff

Any other testers and reviewers welcome as well.

-- 
Bjoern A. Zeeb                                 You have to have visions!
          Stop bit received. Insert coin for new address family.
--0-863113531-1320270854=:68690--

From owner-svn-src-head@FreeBSD.ORG  Wed Nov  2 23:22:51 2011
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 3B0FD106564A;
	Wed,  2 Nov 2011 23:22:51 +0000 (UTC)
	(envelope-from marius@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 2AB4A8FC13;
	Wed,  2 Nov 2011 23:22:51 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pA2NMpHH042886;
	Wed, 2 Nov 2011 23:22:51 GMT (envelope-from marius@svn.freebsd.org)
Received: (from marius@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id pA2NMpGL042884;
	Wed, 2 Nov 2011 23:22:51 GMT (envelope-from marius@svn.freebsd.org)
Message-Id: <201111022322.pA2NMpGL042884@svn.freebsd.org>
From: Marius Strobl 
Date: Wed, 2 Nov 2011 23:22: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: r227042 - head/sys/dev/tl
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: 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, 02 Nov 2011 23:22:51 -0000

Author: marius
Date: Wed Nov  2 23:22:50 2011
New Revision: 227042
URL: http://svn.freebsd.org/changeset/base/227042

Log:
  Remove variable initialized but no longer actually used since r226995.
  
  Found with:	Coverity Prevent(tm)
  CID:		10044

Modified:
  head/sys/dev/tl/if_tl.c

Modified: head/sys/dev/tl/if_tl.c
==============================================================================
--- head/sys/dev/tl/if_tl.c	Wed Nov  2 23:18:19 2011	(r227041)
+++ head/sys/dev/tl/if_tl.c	Wed Nov  2 23:22:50 2011	(r227042)
@@ -920,12 +920,9 @@ static void
 tl_hardreset(dev)
 	device_t		dev;
 {
-	struct tl_softc		*sc;
 	int			i;
 	u_int16_t		flags;
 
-	sc = device_get_softc(dev);
-
 	mii_bitbang_sync(dev, &tl_mii_bitbang_ops);
 
 	flags = BMCR_LOOP|BMCR_ISO|BMCR_PDOWN;

From owner-svn-src-head@FreeBSD.ORG  Wed Nov  2 23:23:19 2011
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id EA80A106564A;
	Wed,  2 Nov 2011 23:23:19 +0000 (UTC)
	(envelope-from marius@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id C0A718FC0A;
	Wed,  2 Nov 2011 23:23:19 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pA2NNJ6d042938;
	Wed, 2 Nov 2011 23:23:19 GMT (envelope-from marius@svn.freebsd.org)
Received: (from marius@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id pA2NNJAL042936;
	Wed, 2 Nov 2011 23:23:19 GMT (envelope-from marius@svn.freebsd.org)
Message-Id: <201111022323.pA2NNJAL042936@svn.freebsd.org>
From: Marius Strobl 
Date: Wed, 2 Nov 2011 23:23: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: r227043 - head/sys/dev/re
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: 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, 02 Nov 2011 23:23:20 -0000

Author: marius
Date: Wed Nov  2 23:23:19 2011
New Revision: 227043
URL: http://svn.freebsd.org/changeset/base/227043

Log:
  Sprinkle some const.

Modified:
  head/sys/dev/re/if_re.c

Modified: head/sys/dev/re/if_re.c
==============================================================================
--- head/sys/dev/re/if_re.c	Wed Nov  2 23:22:50 2011	(r227042)
+++ head/sys/dev/re/if_re.c	Wed Nov  2 23:23:19 2011	(r227043)
@@ -171,7 +171,7 @@ TUNABLE_INT("hw.re.prefer_iomap", &prefe
 /*
  * Various supported device vendors/types and their names.
  */
-static struct rl_type re_devs[] = {
+static const struct rl_type const re_devs[] = {
 	{ DLINK_VENDORID, DLINK_DEVICEID_528T, 0,
 	    "D-Link DGE-528(T) Gigabit Ethernet Adapter" },
 	{ DLINK_VENDORID, DLINK_DEVICEID_530T_REVC, 0,
@@ -194,8 +194,8 @@ static struct rl_type re_devs[] = {
 	    "US Robotics 997902 (RTL8169S) Gigabit Ethernet" }
 };
 
-static struct rl_hwrev re_hwrevs[] = {
-	{ RL_HWREV_8139, RL_8139,  "", RL_MTU },
+static const struct rl_hwrev const re_hwrevs[] = {
+	{ RL_HWREV_8139, RL_8139, "", RL_MTU },
 	{ RL_HWREV_8139A, RL_8139, "A", RL_MTU },
 	{ RL_HWREV_8139AG, RL_8139, "A-G", RL_MTU },
 	{ RL_HWREV_8139B, RL_8139, "B", RL_MTU },
@@ -868,7 +868,7 @@ re_diag(struct rl_softc *sc)
 		device_printf(sc->rl_dev, "expected TX data: %6D/%6D/0x%x\n",
 		    dst, ":", src, ":", ETHERTYPE_IP);
 		device_printf(sc->rl_dev, "received RX data: %6D/%6D/0x%x\n",
-		    eh->ether_dhost, ":",  eh->ether_shost, ":",
+		    eh->ether_dhost, ":", eh->ether_shost, ":",
 		    ntohs(eh->ether_type));
 		device_printf(sc->rl_dev, "You may have a defective 32-bit "
 		    "NIC plugged into a 64-bit PCI slot.\n");
@@ -903,7 +903,7 @@ done:
 static int
 re_probe(device_t dev)
 {
-	struct rl_type		*t;
+	const struct rl_type	*t;
 	uint16_t		devid, vendor;
 	uint16_t		revid, sdevid;
 	int			i;
@@ -1183,7 +1183,7 @@ re_attach(device_t dev)
 	u_int16_t		as[ETHER_ADDR_LEN / 2];
 	struct rl_softc		*sc;
 	struct ifnet		*ifp;
-	struct rl_hwrev		*hw_rev;
+	const struct rl_hwrev	*hw_rev;
 	int			hwrev;
 	u_int16_t		devid, re_did = 0;
 	int			error = 0, i, phy, rid;

From owner-svn-src-head@FreeBSD.ORG  Wed Nov  2 23:40:22 2011
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 60F02106566B;
	Wed,  2 Nov 2011 23:40:22 +0000 (UTC) (envelope-from des@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 5045F8FC13;
	Wed,  2 Nov 2011 23:40:22 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pA2NeLwR043460;
	Wed, 2 Nov 2011 23:40:21 GMT (envelope-from des@svn.freebsd.org)
Received: (from des@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id pA2NeLEB043458;
	Wed, 2 Nov 2011 23:40:21 GMT (envelope-from des@svn.freebsd.org)
Message-Id: <201111022340.pA2NeLEB043458@svn.freebsd.org>
From: Dag-Erling Smorgrav 
Date: Wed, 2 Nov 2011 23:40:21 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r227044 - head/lib/libpam/modules/pam_unix
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: 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, 02 Nov 2011 23:40:22 -0000

Author: des
Date: Wed Nov  2 23:40:21 2011
New Revision: 227044
URL: http://svn.freebsd.org/changeset/base/227044

Log:
  Note that pam_unix(8) does not respect PAM_CHANGE_EXPIRED_AUTHTOK.

Modified:
  head/lib/libpam/modules/pam_unix/pam_unix.8

Modified: head/lib/libpam/modules/pam_unix/pam_unix.8
==============================================================================
--- head/lib/libpam/modules/pam_unix/pam_unix.8	Wed Nov  2 23:23:19 2011	(r227043)
+++ head/lib/libpam/modules/pam_unix/pam_unix.8	Wed Nov  2 23:40:21 2011	(r227044)
@@ -199,3 +199,9 @@ password database.
 .Xr pam 8 ,
 .Xr pw 8 ,
 .Xr yp 8
+.Sh BUGS
+The
+.Nm
+module ignores the
+.Dv PAM_CHANGE_EXPIRED_AUTHTOK
+flag.

From owner-svn-src-head@FreeBSD.ORG  Thu Nov  3 07:52:21 2011
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 8FD211065670;
	Thu,  3 Nov 2011 07:52:21 +0000 (UTC)
	(envelope-from pawel@dawidek.net)
Received: from mail.dawidek.net (60.wheelsystems.com [83.12.187.60])
	by mx1.freebsd.org (Postfix) with ESMTP id BA4878FC18;
	Thu,  3 Nov 2011 07:52:20 +0000 (UTC)
Received: from localhost (58.wheelsystems.com [83.12.187.58])
	by mail.dawidek.net (Postfix) with ESMTPSA id 485B92F3;
	Thu,  3 Nov 2011 08:52:19 +0100 (CET)
Date: Thu, 3 Nov 2011 08:51:32 +0100
From: Pawel Jakub Dawidek 
To: Alexander Motin 
Message-ID: <20111103075132.GA1682@garage.freebsd.pl>
References: <201111020924.pA29OxUV009135@svn.freebsd.org>
	<20111102134226.GA1656@garage.freebsd.pl>
	<4EB15D36.9020409@FreeBSD.org>
MIME-Version: 1.0
Content-Type: multipart/signed; micalg=pgp-sha1;
	protocol="application/pgp-signature"; boundary="T4sUOijqQbZv57TR"
Content-Disposition: inline
In-Reply-To: <4EB15D36.9020409@FreeBSD.org>
X-OS: FreeBSD 9.0-CURRENT amd64
User-Agent: Mutt/1.5.21 (2010-09-15)
Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org,
	src-committers@freebsd.org
Subject: Re: svn commit: r227015 - 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: Thu, 03 Nov 2011 07:52:21 -0000


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

On Wed, Nov 02, 2011 at 05:09:42PM +0200, Alexander Motin wrote:
> On 11/02/11 15:42, Pawel Jakub Dawidek wrote:
> > On Wed, Nov 02, 2011 at 09:24:59AM +0000, Alexander Motin wrote:
> >> Author: mav
> >> Date: Wed Nov  2 09:24:59 2011
> >> New Revision: 227015
> >> URL: http://svn.freebsd.org/changeset/base/227015
> >>
> >> Log:
> >>   Add mutex and two flags to make orphan() call properly asynchronous:
> >>    - delay consumer closing and detaching on orphan() until all I/Os c=
omplete;
> >>    - prevent new I/Os submission after orphan() called.
> >>   Previous implementation could destroy consumers still having active
> >>   requests and worked only because of global workaround made on GEOM l=
evel.
> >=20
> > Alexander, I'm not sure I agree with your recent changes to address
> > this. The checks in GEOM were there to avoid the need for counting
> > outstanding I/O requests in every single GEOM class.
>=20
> Sorry, I've sent you letter last week asking for your opinion on this
> problem, but got no response. :(

I did not receive it, sorry.

> > Why do you think the checks in GEOM are not good enough?
>=20
> Mostly because nstart increment and request submission are not locked.
> There are race windows between start() call, request submission and
> consumer detach: start() method may get provider pointer that will not
> be valid in time of the request submission.
>=20
> According geom(4), that race should be closed by assumption that
> provider should not be closed until all active requests are completed.
> Kind of reference counting, done by top consumers, such as geom_dev or
> geom_vfs. That is what I am trying to fix with my changes.
>=20
> Also I don't very like idea of periodic polling, trying to catch moment
> when nstart =3D=3D nend. As soon as at that time we haven't called orphan=
()
> method yet, requests may go infinitely, even though each will be aborted
> quickly. It looks dirty at least.
>=20
> Counting of outstanding I/O requests needed only for classes that for
> some reason can't follow that assumption. For example, geom_vfs releases
> provider as soon as it orphans, not waiting for close() call from file
> system. Another example is gmirror -- we want to drop single
> disconnected disk while upstream provider is still working and won't be
> closed.

Ok, I can see your point now. You are right. The check that nstart is
equal to nend I added was not to fix races within one class. IIRC I was
seeing panics there with simple classes that only forward orphan events,
so even if provider's error was set and no new I/O requests were coming,
we could destroy orphaned provider even if there were still in-flight
requests. I was a bit confused, because you were refering to the check I
added and I don't think it is really related.

> > Can we design solution that can be implemented in the framework itself,
> > so simple GEOM classes can stay simple?
>=20
> Simple classes without special needs around access() method and
> especially with one consumer should stay simple. All they should do on
> orphan() call is just forward orphan() call up, calling some
> g_wither_XXX() and not trying to forcefully close consumer, and let
> things happen naturally.
>=20
> The problem is that start() and bio_done() methods are not locked now,
> but same time they expect topology not to change under them. I am not
> sure how can it be simplified globally, unless we want to lock all of
> them with topology lock.

--=20
Pawel Jakub Dawidek                       http://www.wheelsystems.com
FreeBSD committer                         http://www.FreeBSD.org
Am I Evil? Yes, I Am!                     http://yomoli.com

--T4sUOijqQbZv57TR
Content-Type: application/pgp-signature

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

iEYEARECAAYFAk6ySAMACgkQForvXbEpPzTWwgCgpTH1CxznkLEdLordlt9+yvYL
+SoAoL1xgwZY0mDnH5z1A/iWHYFjQmKA
=LUib
-----END PGP SIGNATURE-----

--T4sUOijqQbZv57TR--

From owner-svn-src-head@FreeBSD.ORG  Thu Nov  3 08:34:42 2011
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 4A8F1106566C;
	Thu,  3 Nov 2011 08:34:42 +0000 (UTC)
	(envelope-from mavbsd@gmail.com)
Received: from mail-ey0-f182.google.com (mail-ey0-f182.google.com
	[209.85.215.182])
	by mx1.freebsd.org (Postfix) with ESMTP id 0D8538FC17;
	Thu,  3 Nov 2011 08:34:40 +0000 (UTC)
Received: by eyd10 with SMTP id 10so1241233eyd.13
	for ; Thu, 03 Nov 2011 01:34:40 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma;
	h=sender:message-id:date:from:user-agent:mime-version:to:cc:subject
	:references:in-reply-to:x-enigmail-version:content-type
	:content-transfer-encoding;
	bh=1oq0WsaZFI3pG1BdtJ7TeIk9E+5Xkx1x+cTrwBbEXgI=;
	b=rCD24DK9fQq+VFhYrJduZZCo0TiXNYXAfkz7OUVswNekfCNmPwb8Gmofs/qW2ykR0D
	jVn7LDZSmIGKVzFQ5PYQD7+mccSDtgi/XdvelB8djPn3brRhtnAUzii2BKZ6X7josfvX
	YOFDh/HU3JRLct7N265bvMpeWnljU2PiU1yWk=
Received: by 10.14.3.232 with SMTP id 80mr724546eeh.117.1320309279874;
	Thu, 03 Nov 2011 01:34:39 -0700 (PDT)
Received: from mavbook.mavhome.dp.ua (pc.mavhome.dp.ua. [212.86.226.226])
	by mx.google.com with ESMTPS id q28sm13632627eea.6.2011.11.03.01.34.38
	(version=SSLv3 cipher=OTHER); Thu, 03 Nov 2011 01:34:38 -0700 (PDT)
Sender: Alexander Motin 
Message-ID: <4EB2521D.2090704@FreeBSD.org>
Date: Thu, 03 Nov 2011 10:34:37 +0200
From: Alexander Motin 
User-Agent: Mozilla/5.0 (X11; FreeBSD amd64;
	rv:6.0.2) Gecko/20110910 Thunderbird/6.0.2
MIME-Version: 1.0
To: Pawel Jakub Dawidek 
References: <201111020924.pA29OxUV009135@svn.freebsd.org>
	<20111102134226.GA1656@garage.freebsd.pl>
	<4EB15D36.9020409@FreeBSD.org>
	<20111103075132.GA1682@garage.freebsd.pl>
In-Reply-To: <20111103075132.GA1682@garage.freebsd.pl>
X-Enigmail-Version: undefined
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org,
	src-committers@freebsd.org
Subject: Re: svn commit: r227015 - 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: Thu, 03 Nov 2011 08:34:42 -0000

On 03.11.2011 09:51, Pawel Jakub Dawidek wrote:
> On Wed, Nov 02, 2011 at 05:09:42PM +0200, Alexander Motin wrote:
>> On 11/02/11 15:42, Pawel Jakub Dawidek wrote:
>>> On Wed, Nov 02, 2011 at 09:24:59AM +0000, Alexander Motin wrote:
>>>> Author: mav
>>>> Date: Wed Nov  2 09:24:59 2011
>>>> New Revision: 227015
>>>> URL: http://svn.freebsd.org/changeset/base/227015
>>>>
>>>> Log:
>>>>   Add mutex and two flags to make orphan() call properly asynchronous:
>>>>    - delay consumer closing and detaching on orphan() until all I/Os complete;
>>>>    - prevent new I/Os submission after orphan() called.
>>>>   Previous implementation could destroy consumers still having active
>>>>   requests and worked only because of global workaround made on GEOM level.
>>>
>>> Alexander, I'm not sure I agree with your recent changes to address
>>> this. The checks in GEOM were there to avoid the need for counting
>>> outstanding I/O requests in every single GEOM class.
>>
>> Sorry, I've sent you letter last week asking for your opinion on this
>> problem, but got no response. :(
> 
> I did not receive it, sorry.
> 
>>> Why do you think the checks in GEOM are not good enough?
>>
>> Mostly because nstart increment and request submission are not locked.
>> There are race windows between start() call, request submission and
>> consumer detach: start() method may get provider pointer that will not
>> be valid in time of the request submission.
>>
>> According geom(4), that race should be closed by assumption that
>> provider should not be closed until all active requests are completed.
>> Kind of reference counting, done by top consumers, such as geom_dev or
>> geom_vfs. That is what I am trying to fix with my changes.
>>
>> Also I don't very like idea of periodic polling, trying to catch moment
>> when nstart == nend. As soon as at that time we haven't called orphan()
>> method yet, requests may go infinitely, even though each will be aborted
>> quickly. It looks dirty at least.
>>
>> Counting of outstanding I/O requests needed only for classes that for
>> some reason can't follow that assumption. For example, geom_vfs releases
>> provider as soon as it orphans, not waiting for close() call from file
>> system. Another example is gmirror -- we want to drop single
>> disconnected disk while upstream provider is still working and won't be
>> closed.
> 
> Ok, I can see your point now. You are right. The check that nstart is
> equal to nend I added was not to fix races within one class. IIRC I was
> seeing panics there with simple classes that only forward orphan events,
> so even if provider's error was set and no new I/O requests were coming,
> we could destroy orphaned provider even if there were still in-flight
> requests. I was a bit confused, because you were refering to the check I
> added and I don't think it is really related.

Your check does good job to the original problem, reducing the race
window from huge start() -- bio_done() to two small start() -- nstart++
and nend++ -- bio_done(). It protects geoms below the broken one (panics
I see without check usually happen on random level below the real
source), but it does not protect the broken geom itself. Proper orphan()
methods protect both.

-- 
Alexander Motin

From owner-svn-src-head@FreeBSD.ORG  Thu Nov  3 09:09:05 2011
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id ECF75106566C;
	Thu,  3 Nov 2011 09:09:05 +0000 (UTC)
	(envelope-from pluknet@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id DCD968FC16;
	Thu,  3 Nov 2011 09:09:05 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pA3995AM061490;
	Thu, 3 Nov 2011 09:09:05 GMT (envelope-from pluknet@svn.freebsd.org)
Received: (from pluknet@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id pA3995RD061488;
	Thu, 3 Nov 2011 09:09:05 GMT (envelope-from pluknet@svn.freebsd.org)
Message-Id: <201111030909.pA3995RD061488@svn.freebsd.org>
From: Sergey Kandaurov 
Date: Thu, 3 Nov 2011 09:09: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: r227055 - head/sys/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: Thu, 03 Nov 2011 09:09:06 -0000

Author: pluknet
Date: Thu Nov  3 09:09:05 2011
New Revision: 227055
URL: http://svn.freebsd.org/changeset/base/227055

Log:
  Remove a couple of write-only variables.

Modified:
  head/sys/netinet6/icmp6.c

Modified: head/sys/netinet6/icmp6.c
==============================================================================
--- head/sys/netinet6/icmp6.c	Thu Nov  3 05:44:00 2011	(r227054)
+++ head/sys/netinet6/icmp6.c	Thu Nov  3 09:09:05 2011	(r227055)
@@ -2351,8 +2351,6 @@ icmp6_redirect_input(struct mbuf *m, int
 	int icmp6len = ntohs(ip6->ip6_plen);
 	char *lladdr = NULL;
 	int lladdrlen = 0;
-	u_char *redirhdr = NULL;
-	int redirhdrlen = 0;
 	struct rtentry *rt = NULL;
 	int is_router;
 	int is_onlink;
@@ -2488,11 +2486,6 @@ icmp6_redirect_input(struct mbuf *m, int
 		lladdrlen = ndopts.nd_opts_tgt_lladdr->nd_opt_len << 3;
 	}
 
-	if (ndopts.nd_opts_rh) {
-		redirhdrlen = ndopts.nd_opts_rh->nd_opt_rh_len;
-		redirhdr = (u_char *)(ndopts.nd_opts_rh + 1); /* xxx */
-	}
-
 	if (lladdr && ((ifp->if_addrlen + 2 + 7) & ~7) != lladdrlen) {
 		nd6log((LOG_INFO,
 		    "icmp6_redirect_input: lladdrlen mismatch for %s "

From owner-svn-src-head@FreeBSD.ORG  Thu Nov  3 12:03:04 2011
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 04582106568D;
	Thu,  3 Nov 2011 12:03:04 +0000 (UTC)
	(envelope-from pluknet@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id E7E438FC2F;
	Thu,  3 Nov 2011 12:03:03 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pA3C33rw069670;
	Thu, 3 Nov 2011 12:03:03 GMT (envelope-from pluknet@svn.freebsd.org)
Received: (from pluknet@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id pA3C33QM069667;
	Thu, 3 Nov 2011 12:03:03 GMT (envelope-from pluknet@svn.freebsd.org)
Message-Id: <201111031203.pA3C33QM069667@svn.freebsd.org>
From: Sergey Kandaurov 
Date: Thu, 3 Nov 2011 12:03: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: r227056 - in head/sys: boot/common conf
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 03 Nov 2011 12:03:04 -0000

Author: pluknet
Date: Thu Nov  3 12:03:03 2011
New Revision: 227056
URL: http://svn.freebsd.org/changeset/base/227056

Log:
  Remove the remnants of /stand/sysinstall.
  
  loader.8:	Sync the default init_path list with kern/init_main.c.
  
  NOTES:		Replace with /rescue/init in the INIT_PATH kernel option.

Modified:
  head/sys/boot/common/loader.8
  head/sys/conf/NOTES

Modified: head/sys/boot/common/loader.8
==============================================================================
--- head/sys/boot/common/loader.8	Thu Nov  3 09:09:05 2011	(r227055)
+++ head/sys/boot/common/loader.8	Thu Nov  3 12:03:03 2011	(r227056)
@@ -443,7 +443,7 @@ Sets the list of binaries which the kern
 process.
 The first matching binary is used.
 The default list is
-.Dq Li /sbin/init:/sbin/oinit:/sbin/init.bak:\:/rescue/init:/stand/sysinstall .
+.Dq Li /sbin/init:/sbin/oinit:/sbin/init.bak:\:/rescue/init .
 .It Va init_script
 If set to a valid file name in the root file system,
 instructs

Modified: head/sys/conf/NOTES
==============================================================================
--- head/sys/conf/NOTES	Thu Nov  3 09:09:05 2011	(r227055)
+++ head/sys/conf/NOTES	Thu Nov  3 12:03:03 2011	(r227056)
@@ -2813,7 +2813,7 @@ options 	UBSEC_RNDTEST	# enable rndtest 
 # Embedded system options:
 #
 # An embedded system might want to run something other than init.
-options 	INIT_PATH=/sbin/init:/stand/sysinstall
+options 	INIT_PATH=/sbin/init:/rescue/init
 
 # Debug options
 options 	BUS_DEBUG	# enable newbus debugging

From owner-svn-src-head@FreeBSD.ORG  Thu Nov  3 14:36:56 2011
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id EFBB9106566B;
	Thu,  3 Nov 2011 14:36:56 +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 DF6BC8FC1F;
	Thu,  3 Nov 2011 14:36:56 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pA3Eausb074440;
	Thu, 3 Nov 2011 14:36:56 GMT (envelope-from attilio@svn.freebsd.org)
Received: (from attilio@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id pA3EauWL074438;
	Thu, 3 Nov 2011 14:36:56 GMT (envelope-from attilio@svn.freebsd.org)
Message-Id: <201111031436.pA3EauWL074438@svn.freebsd.org>
From: Attilio Rao 
Date: Thu, 3 Nov 2011 14:36: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: r227058 - head/sys/kern
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 03 Nov 2011 14:36:57 -0000

Author: attilio
Date: Thu Nov  3 14:36:56 2011
New Revision: 227058
URL: http://svn.freebsd.org/changeset/base/227058

Log:
  Disable interrupt and preemption for smp_rendezvous() also in the
  UP/!SMP case.
  The callbacks may be relying on this feature and having 2 different
  ways to deal with them is not correct.
  
  Reported by:	rstone
  Reviewed by:	jhb
  MFC after:	2 weeks

Modified:
  head/sys/kern/subr_smp.c

Modified: head/sys/kern/subr_smp.c
==============================================================================
--- head/sys/kern/subr_smp.c	Thu Nov  3 12:24:44 2011	(r227057)
+++ head/sys/kern/subr_smp.c	Thu Nov  3 14:36:56 2011	(r227058)
@@ -415,13 +415,16 @@ smp_rendezvous_cpus(cpuset_t map,
 {
 	int curcpumap, i, ncpus = 0;
 
+	/* Look comments in the !SMP case. */
 	if (!smp_started) {
+		spinlock_enter();
 		if (setup_func != NULL)
 			setup_func(arg);
 		if (action_func != NULL)
 			action_func(arg);
 		if (teardown_func != NULL)
 			teardown_func(arg);
+		spinlock_exit();
 		return;
 	}
 
@@ -666,12 +669,18 @@ smp_rendezvous_cpus(cpuset_t map,
 	void (*teardown_func)(void *),
 	void *arg)
 {
+	/*
+	 * In the !SMP case we just need to ensure the same initial conditions
+	 * as the SMP case.
+	 */
+	spinlock_enter();
 	if (setup_func != NULL)
 		setup_func(arg);
 	if (action_func != NULL)
 		action_func(arg);
 	if (teardown_func != NULL)
 		teardown_func(arg);
+	spinlock_exit();
 }
 
 void
@@ -681,12 +690,15 @@ smp_rendezvous(void (*setup_func)(void *
 	       void *arg)
 {
 
+	/* Look comments in the smp_rendezvous_cpus() case. */
+	spinlock_enter();
 	if (setup_func != NULL)
 		setup_func(arg);
 	if (action_func != NULL)
 		action_func(arg);
 	if (teardown_func != NULL)
 		teardown_func(arg);
+	spinlock_exit();
 }
 
 /*

From owner-svn-src-head@FreeBSD.ORG  Thu Nov  3 14:38:03 2011
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 7587C106566C;
	Thu,  3 Nov 2011 14:38:03 +0000 (UTC)
	(envelope-from rmacklem@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 652368FC0C;
	Thu,  3 Nov 2011 14:38:03 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pA3Ec3hv074506;
	Thu, 3 Nov 2011 14:38:03 GMT (envelope-from rmacklem@svn.freebsd.org)
Received: (from rmacklem@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id pA3Ec3xL074504;
	Thu, 3 Nov 2011 14:38:03 GMT (envelope-from rmacklem@svn.freebsd.org)
Message-Id: <201111031438.pA3Ec3xL074504@svn.freebsd.org>
From: Rick Macklem 
Date: Thu, 3 Nov 2011 14:38: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: r227059 - head/sys/rpc
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: 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, 03 Nov 2011 14:38:03 -0000

Author: rmacklem
Date: Thu Nov  3 14:38:03 2011
New Revision: 227059
URL: http://svn.freebsd.org/changeset/base/227059

Log:
  Both a crash reported on freebsd-current on Oct. 18 under the
  subject heading "mtx_lock() of destroyed mutex on NFS" and
  PR# 156168 appear to be caused by clnt_dg_destroy() closing
  down the socket prematurely. When to close down the socket
  is controlled by a reference count (cs_refs), but clnt_dg_create()
  checks for sb_upcall being non-NULL to decide if a new socket
  is needed. I believe the crashes were caused by the following race:
    clnt_dg_destroy() finds cs_refs == 0 and decides to delete socket
    clnt_dg_destroy() then loses race with clnt_dg_create() for
      acquisition of the SOCKBUF_LOCK()
    clnt_dg_create() finds sb_upcall != NULL and increments cs_refs to 1
    clnt_dg_destroy() then acquires SOCKBUF_LOCK(), sets sb_upcall to
      NULL and destroys socket
  
  This patch fixes the above race by changing clnt_dg_destroy() so
  that it acquires SOCKBUF_LOCK() before testing cs_refs.
  
  Tested by:	bz
  PR:		156168
  Reviewed by:	dfr
  MFC after:	2 weeks

Modified:
  head/sys/rpc/clnt_dg.c

Modified: head/sys/rpc/clnt_dg.c
==============================================================================
--- head/sys/rpc/clnt_dg.c	Thu Nov  3 14:36:56 2011	(r227058)
+++ head/sys/rpc/clnt_dg.c	Thu Nov  3 14:38:03 2011	(r227059)
@@ -1001,12 +1001,12 @@ clnt_dg_destroy(CLIENT *cl)
 	cs = cu->cu_socket->so_rcv.sb_upcallarg;
 	clnt_dg_close(cl);
 
+	SOCKBUF_LOCK(&cu->cu_socket->so_rcv);
 	mtx_lock(&cs->cs_lock);
 
 	cs->cs_refs--;
 	if (cs->cs_refs == 0) {
 		mtx_unlock(&cs->cs_lock);
-		SOCKBUF_LOCK(&cu->cu_socket->so_rcv);
 		soupcall_clear(cu->cu_socket, SO_RCV);
 		clnt_dg_upcallsdone(cu->cu_socket, cs);
 		SOCKBUF_UNLOCK(&cu->cu_socket->so_rcv);
@@ -1015,6 +1015,7 @@ clnt_dg_destroy(CLIENT *cl)
 		lastsocketref = TRUE;
 	} else {
 		mtx_unlock(&cs->cs_lock);
+		SOCKBUF_UNLOCK(&cu->cu_socket->so_rcv);
 		lastsocketref = FALSE;
 	}
 

From owner-svn-src-head@FreeBSD.ORG  Thu Nov  3 18:33:30 2011
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id D6905106564A;
	Thu,  3 Nov 2011 18:33:30 +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 BC5C48FC15;
	Thu,  3 Nov 2011 18:33:30 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pA3IXUPT081869;
	Thu, 3 Nov 2011 18:33:30 GMT (envelope-from mlaier@svn.freebsd.org)
Received: (from mlaier@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id pA3IXUpk081867;
	Thu, 3 Nov 2011 18:33:30 GMT (envelope-from mlaier@svn.freebsd.org)
Message-Id: <201111031833.pA3IXUpk081867@svn.freebsd.org>
From: Max Laier 
Date: Thu, 3 Nov 2011 18:33: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: r227061 - head/sys/net
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 03 Nov 2011 18:33:31 -0000

Author: mlaier
Date: Thu Nov  3 18:33:30 2011
New Revision: 227061
URL: http://svn.freebsd.org/changeset/base/227061

Log:
  Fix a use-after-free/redzone issue in the routing code.
  
  Reported by (repeatedly):	Mike Tancsa
  Prodded by (repeatedly):	bz
  Forgotten by (repeatedly):	mlaier
  MFC after:			2 weeks

Modified:
  head/sys/net/rtsock.c

Modified: head/sys/net/rtsock.c
==============================================================================
--- head/sys/net/rtsock.c	Thu Nov  3 18:09:11 2011	(r227060)
+++ head/sys/net/rtsock.c	Thu Nov  3 18:33:30 2011	(r227061)
@@ -166,7 +166,7 @@ static void	rt_setmetrics(u_long which, 
 			struct rt_metrics_lite *out);
 static void	rt_getmetrics(const struct rt_metrics_lite *in,
 			struct rt_metrics *out);
-static void	rt_dispatch(struct mbuf *, const struct sockaddr *);
+static void	rt_dispatch(struct mbuf *, sa_family_t);
 
 static struct netisr_handler rtsock_nh = {
 	.nh_name = "rtsock",
@@ -545,6 +545,7 @@ route_output(struct mbuf *m, struct sock
 	int len, error = 0;
 	struct ifnet *ifp = NULL;
 	union sockaddr_union saun;
+	sa_family_t saf = AF_UNSPEC;
 
 #define senderr(e) { error = e; goto flush;}
 	if (m == NULL || ((m->m_len < sizeof(long)) &&
@@ -581,6 +582,7 @@ route_output(struct mbuf *m, struct sock
 	    (info.rti_info[RTAX_GATEWAY] != NULL &&
 	     info.rti_info[RTAX_GATEWAY]->sa_family >= AF_MAX))
 		senderr(EINVAL);
+	saf = info.rti_info[RTAX_DST]->sa_family;
 	/*
 	 * Verify that the caller has the appropriate privilege; RTM_GET
 	 * is the only operation the non-superuser is allowed.
@@ -926,10 +928,10 @@ flush:
 			 */
 			unsigned short family = rp->rcb_proto.sp_family;
 			rp->rcb_proto.sp_family = 0;
-			rt_dispatch(m, info.rti_info[RTAX_DST]);
+			rt_dispatch(m, saf);
 			rp->rcb_proto.sp_family = family;
 		} else
-			rt_dispatch(m, info.rti_info[RTAX_DST]);
+			rt_dispatch(m, saf);
 	}
 	/* info.rti_info[RTAX_DST] (used above) can point inside of rtm */
 	if (rtm)
@@ -1185,7 +1187,7 @@ rt_missmsg_fib(int type, struct rt_addri
 	rtm->rtm_flags = RTF_DONE | flags;
 	rtm->rtm_errno = error;
 	rtm->rtm_addrs = rtinfo->rti_addrs;
-	rt_dispatch(m, sa);
+	rt_dispatch(m, sa ? sa->sa_family : AF_UNSPEC);
 }
 
 void
@@ -1217,7 +1219,7 @@ rt_ifmsg(struct ifnet *ifp)
 	ifm->ifm_flags = ifp->if_flags | ifp->if_drv_flags;
 	ifm->ifm_data = ifp->if_data;
 	ifm->ifm_addrs = 0;
-	rt_dispatch(m, NULL);
+	rt_dispatch(m, AF_UNSPEC);
 }
 
 /*
@@ -1295,7 +1297,7 @@ rt_newaddrmsg_fib(int cmd, struct ifaddr
 			M_SETFIB(m, fibnum);
 			m->m_flags |= RTS_FILTER_FIB;
 		}
-		rt_dispatch(m, sa);
+		rt_dispatch(m, sa ? sa->sa_family : AF_UNSPEC);
 	}
 }
 
@@ -1338,7 +1340,7 @@ rt_newmaddrmsg(int cmd, struct ifmultiad
 	    __func__));
 	ifmam->ifmam_index = ifp->if_index;
 	ifmam->ifmam_addrs = info.rti_addrs;
-	rt_dispatch(m, ifma->ifma_addr);
+	rt_dispatch(m, ifma->ifma_addr ? ifma->ifma_addr->sa_family : AF_UNSPEC);
 }
 
 static struct mbuf *
@@ -1398,7 +1400,7 @@ rt_ieee80211msg(struct ifnet *ifp, int w
 		if (m->m_flags & M_PKTHDR)
 			m->m_pkthdr.len += data_len;
 		mtod(m, struct if_announcemsghdr *)->ifan_msglen += data_len;
-		rt_dispatch(m, NULL);
+		rt_dispatch(m, AF_UNSPEC);
 	}
 }
 
@@ -1414,11 +1416,11 @@ rt_ifannouncemsg(struct ifnet *ifp, int 
 
 	m = rt_makeifannouncemsg(ifp, RTM_IFANNOUNCE, what, &info);
 	if (m != NULL)
-		rt_dispatch(m, NULL);
+		rt_dispatch(m, AF_UNSPEC);
 }
 
 static void
-rt_dispatch(struct mbuf *m, const struct sockaddr *sa)
+rt_dispatch(struct mbuf *m, sa_family_t saf)
 {
 	struct m_tag *tag;
 
@@ -1427,14 +1429,14 @@ rt_dispatch(struct mbuf *m, const struct
 	 * use when injecting the mbuf into the routing socket buffer from
 	 * the netisr.
 	 */
-	if (sa != NULL) {
+	if (saf != AF_UNSPEC) {
 		tag = m_tag_get(PACKET_TAG_RTSOCKFAM, sizeof(unsigned short),
 		    M_NOWAIT);
 		if (tag == NULL) {
 			m_freem(m);
 			return;
 		}
-		*(unsigned short *)(tag + 1) = sa->sa_family;
+		*(unsigned short *)(tag + 1) = saf;
 		m_tag_prepend(m, tag);
 	}
 #ifdef VIMAGE

From owner-svn-src-head@FreeBSD.ORG  Thu Nov  3 18:55:19 2011
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 16A76106566B;
	Thu,  3 Nov 2011 18:55:19 +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 069AE8FC17;
	Thu,  3 Nov 2011 18:55:19 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pA3ItIM1082538;
	Thu, 3 Nov 2011 18:55:18 GMT (envelope-from kib@svn.freebsd.org)
Received: (from kib@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id pA3ItInA082536;
	Thu, 3 Nov 2011 18:55:18 GMT (envelope-from kib@svn.freebsd.org)
Message-Id: <201111031855.pA3ItInA082536@svn.freebsd.org>
From: Konstantin Belousov 
Date: Thu, 3 Nov 2011 18:55: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: r227062 - head/sys/fs/devfs
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: 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, 03 Nov 2011 18:55:19 -0000

Author: kib
Date: Thu Nov  3 18:55:18 2011
New Revision: 227062
URL: http://svn.freebsd.org/changeset/base/227062

Log:
  Fix kernel panic when d_fdopen csw method is called for NULL fp.
  This may happen when kernel consumer calls VOP_OPEN().
  
  Reported by:	Tavis Ormandy  through delphij
  MFC after:	3 days

Modified:
  head/sys/fs/devfs/devfs_vnops.c

Modified: head/sys/fs/devfs/devfs_vnops.c
==============================================================================
--- head/sys/fs/devfs/devfs_vnops.c	Thu Nov  3 18:33:30 2011	(r227061)
+++ head/sys/fs/devfs/devfs_vnops.c	Thu Nov  3 18:55:18 2011	(r227062)
@@ -1050,6 +1050,10 @@ devfs_open(struct vop_open_args *ap)
 	dsw = dev_refthread(dev, &ref);
 	if (dsw == NULL)
 		return (ENXIO);
+	if (fp == NULL && dsw->d_fdopen != NULL) {
+		dev_relthread(dev, ref);
+		return (ENXIO);
+	}
 
 	vlocked = VOP_ISLOCKED(vp);
 	VOP_UNLOCK(vp, 0);

From owner-svn-src-head@FreeBSD.ORG  Thu Nov  3 21:20:22 2011
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id E4E14106566C;
	Thu,  3 Nov 2011 21:20:22 +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 D19938FC0C;
	Thu,  3 Nov 2011 21:20:22 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pA3LKMNW087270;
	Thu, 3 Nov 2011 21:20:22 GMT (envelope-from bz@svn.freebsd.org)
Received: (from bz@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id pA3LKMu6087259;
	Thu, 3 Nov 2011 21:20:22 GMT (envelope-from bz@svn.freebsd.org)
Message-Id: <201111032120.pA3LKMu6087259@svn.freebsd.org>
From: "Bjoern A. Zeeb" 
Date: Thu, 3 Nov 2011 21:20:22 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r227064 - in head: share/man/man4 sys/conf
	sys/dev/qlxgb sys/modules sys/modules/qlxgb
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: 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, 03 Nov 2011 21:20:23 -0000

Author: bz
Date: Thu Nov  3 21:20:22 2011
New Revision: 227064
URL: http://svn.freebsd.org/changeset/base/227064

Log:
  Add QLogic 10 Gigabit Ethernet & CNA Adapter Driver version 1.30
  for 3200 and 8200 series cards.
  
  Submitted by:	David C Somayajulu (david.somayajulu@qlogic.com),
  		Qlogic Corporation
  MFC After:	3 days

Added:
  head/share/man/man4/qlxgb.4   (contents, props changed)
  head/sys/dev/qlxgb/
  head/sys/dev/qlxgb/README.txt   (contents, props changed)
  head/sys/dev/qlxgb/qla_dbg.c   (contents, props changed)
  head/sys/dev/qlxgb/qla_dbg.h   (contents, props changed)
  head/sys/dev/qlxgb/qla_def.h   (contents, props changed)
  head/sys/dev/qlxgb/qla_glbl.h   (contents, props changed)
  head/sys/dev/qlxgb/qla_hw.c   (contents, props changed)
  head/sys/dev/qlxgb/qla_hw.h   (contents, props changed)
  head/sys/dev/qlxgb/qla_inline.h   (contents, props changed)
  head/sys/dev/qlxgb/qla_ioctl.c   (contents, props changed)
  head/sys/dev/qlxgb/qla_ioctl.h   (contents, props changed)
  head/sys/dev/qlxgb/qla_isr.c   (contents, props changed)
  head/sys/dev/qlxgb/qla_misc.c   (contents, props changed)
  head/sys/dev/qlxgb/qla_os.c   (contents, props changed)
  head/sys/dev/qlxgb/qla_os.h   (contents, props changed)
  head/sys/dev/qlxgb/qla_reg.h   (contents, props changed)
  head/sys/dev/qlxgb/qla_ver.h   (contents, props changed)
  head/sys/modules/qlxgb/
  head/sys/modules/qlxgb/Makefile   (contents, props changed)
Modified:
  head/share/man/man4/Makefile
  head/sys/conf/files.amd64
  head/sys/modules/Makefile

Modified: head/share/man/man4/Makefile
==============================================================================
--- head/share/man/man4/Makefile	Thu Nov  3 20:29:20 2011	(r227063)
+++ head/share/man/man4/Makefile	Thu Nov  3 21:20:22 2011	(r227064)
@@ -347,6 +347,7 @@ MAN=	aac.4 \
 	pts.4 \
 	pty.4 \
 	puc.4 \
+	${_qlxgb.4} \
 	ral.4 \
 	random.4 \
 	rc.4 \
@@ -713,6 +714,10 @@ _xen.4=		xen.4
 MLINKS+=lindev.4 full.4
 .endif
 
+.if ${MACHINE_CPUARCH} == "amd64"
+_qlxgb.4=	qlxgb.4
+.endif
+
 .if ${MACHINE_CPUARCH} == "powerpc"
 _atp.4=		atp.4
 .endif

Added: head/share/man/man4/qlxgb.4
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/share/man/man4/qlxgb.4	Thu Nov  3 21:20:22 2011	(r227064)
@@ -0,0 +1,93 @@
+.\"-
+.\" Copyright (c) 2011 "Bjoern A. Zeeb" 
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\"    notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\"    notice, this list of conditions and the following disclaimer in the
+.\"    documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd November 3, 2011
+.Dt QLXGB 4
+.Os
+.Sh NAME
+.Nm qlxgb
+.Nd "QLogic 10 Gigabit Ethernet & CNA Adapter Driver"
+.Sh SYNOPSIS
+To compile this driver into the kernel,
+place the following lines in your
+kernel configuration file:
+.Bd -ragged -offset indent
+.Cd "device qlxgb"
+.Ed
+.Pp
+To load the driver as a
+module at boot time, place the following line in
+.Xr loader.conf 5 :
+.Bd -literal -offset indent
+if_qlxgb_load="YES"
+.Ed
+.Sh DESCRIPTION
+The
+.Nm
+driver supports IPv4 checksum offload,
+TCP and UDP checksum offload for both IPv4 and IPv6,
+Large Segment Offload for both IPv4 and IPv6,
+Jumbo frames, VLAN Tag, and
+Receive Side scaling.
+For further hardware information, see
+.Pa http://www.qlogic.com/ .
+.Sh HARDWARE
+The
+.Nm
+driver supports 10 Gigabit Ethernet & CNA Adapter based on the following
+chipsets:
+.Pp
+.Bl -bullet -compact
+.It
+QLogic 3200 series
+.It
+QLogic 8200 series
+.El
+.Sh SUPPORT
+For support questions please contact your QLogic approved reseller or
+QLogic Technical Support at
+.Pa http://support.qlogic.com ,
+or by E-mail at
+.Aq support@qlogic.com .
+.Sh SEE ALSO
+.Xr altq 4 ,
+.Xr arp 4 ,
+.Xr netintro 4 ,
+.Xr ng_ether 4 ,
+.Xr ifconfig 8
+.Sh HISTORY
+The
+.Nm
+device driver first appeared in
+.Fx 10.0 .
+.Sh AUTHORS
+.An -nosplit
+The
+.Nm
+driver was written by
+.An David C Somayajulu
+at Qlogic Corporation.

Modified: head/sys/conf/files.amd64
==============================================================================
--- head/sys/conf/files.amd64	Thu Nov  3 20:29:20 2011	(r227063)
+++ head/sys/conf/files.amd64	Thu Nov  3 21:20:22 2011	(r227064)
@@ -208,6 +208,12 @@ dev/lindev/lindev.c		optional	lindev
 dev/nfe/if_nfe.c		optional	nfe pci
 dev/nve/if_nve.c		optional	nve pci
 dev/nvram/nvram.c		optional	nvram isa
+dev/qlxgb/qla_dbg.c		optional	qlxgb pci
+dev/qlxgb/qla_hw.c		optional	qlxgb pci
+dev/qlxgb/qla_ioctl.c		optional	qlxgb pci
+dev/qlxgb/qla_isr.c		optional	qlxgb pci
+dev/qlxgb/qla_misc.c		optional	qlxgb pci
+dev/qlxgb/qla_os.c		optional	qlxgb pci
 dev/sio/sio.c			optional	sio
 dev/sio/sio_isa.c		optional	sio isa
 dev/sio/sio_pccard.c		optional	sio pccard

Added: head/sys/dev/qlxgb/README.txt
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/sys/dev/qlxgb/README.txt	Thu Nov  3 21:20:22 2011	(r227064)
@@ -0,0 +1,99 @@
+# $FreeBSD$
+
+			README File
+	QLogic 3200 and 8200 series Single/Dual Port
+10 Gigabit Ethernet & CNA Adapter Driver for FreeBSD 7.x/8.x/9.x
+
+		QLogic Corporation.
+		All rights reserved. 
+
+
+Table of Contents
+1. Package Contents 
+2. OS Support
+3. Supported Features
+4. Using the Driver
+   4.1 Installing the driver
+   4.2 Removing the driver
+5. Driver Parameters
+6. Additional Notes
+7. Contacting Support
+
+1. Package Contents 
+ * Documentation 
+   - README (this document) version:1.0
+   - Release Notes Version:1.0
+ * Driver (if_qlxgb.ko)
+	- FreeBSD 7.x/8.x/9.x
+ * Firmware: pre-flashed on QLogic adapter;
+
+2. OS Support
+
+The Qlogic 10Gigabit Ethernet/CNA driver is compatible with the 
+following OS platforms:
+ * FreeBSD 7.x/8.x/9.x (64-bit) [Intel EM64T, AMD64]
+
+3. Supported Features
+10Gigabit Ethernet NIC/CNA driver supports following features
+
+* Large Segment Offload over TCP IPV4
+* Large Segment Offload over TCP IPV6
+* Receive Side scaling
+* TCP over IPv4 checksum offload
+* UDP over IPv4 checksum offload
+* IPV4 checksum offload
+* TCP over IPv6 checksum offload
+* UDP over IPv6 checksum offload
+* Jumbo frames
+* VLAN Tag
+
+
+4. Using the driver
+
+ 4.1 Installing the driver
+
+   - copy the driver file (if_qlxgb.ko) into some directory (say qla_driver)
+   - cd 
+   - kldload -v ./if_qlxgb.ko
+
+ 4.2 Removing the driver
+ 
+  - kldunload if_qlxgb
+
+5. Parameters to set prior to installing the driver
+
+   - Add the following lines to /etc/sysctl.conf and reboot the machine prior
+     to installing the driver
+   
+	kern.ipc.nmbjumbo9=262144
+	net.inet.tcp.recvbuf_max=262144
+	net.inet.tcp.recvbuf_inc=16384
+	kern.ipc.nmbclusters=1000000
+	kern.ipc.maxsockbuf=2097152
+	net.inet.tcp.recvspace=131072
+	net.inet.tcp.sendbuf_max=262144
+	net.inet.tcp.sendspace=65536
+ 
+   - If you do not want to reboot the system please run the following commands
+
+	login or su to root
+
+	sysctl kern.ipc.nmbjumbo9=262144
+	sysctl net.inet.tcp.recvbuf_max=262144
+	sysctl net.inet.tcp.recvbuf_inc=16384
+	sysctl kern.ipc.nmbclusters=1000000
+	sysctl kern.ipc.maxsockbuf=2097152
+	sysctl net.inet.tcp.recvspace=131072
+	sysctl net.inet.tcp.sendbuf_max=262144
+	sysctl net.inet.tcp.sendspace=65536
+
+6. Contacting Support 
+Please feel free to contact your QLogic approved reseller or QLogic 
+Technical Support at any phase of integration for assistance. QLogic
+Technical Support can be reached by the following methods: 
+Web:    http://support.qlogic.com
+E-mail: support@qlogic.com
+(c) Copyright 2011. All rights reserved worldwide. QLogic, the QLogic 
+logo, and the Powered by QLogic logo are registered trademarks of
+QLogic Corporation. All other brand and product names are trademarks 
+or registered trademarks of their respective owners. 

Added: head/sys/dev/qlxgb/qla_dbg.c
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/sys/dev/qlxgb/qla_dbg.c	Thu Nov  3 21:20:22 2011	(r227064)
@@ -0,0 +1,263 @@
+/*
+ * Copyright (c) 2010-2011 Qlogic Corporation
+ * 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 COPYRIGHT HOLDERS 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 COPYRIGHT OWNER 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.
+ */
+/*
+ * File : qla_dbg.c
+ * Author : David C Somayajulu, Qlogic Corporation, Aliso Viejo, CA 92656.
+ */
+
+#include 
+__FBSDID("$FreeBSD$");
+
+#include "qla_os.h"
+#include "qla_reg.h"
+#include "qla_hw.h"
+#include "qla_def.h"
+#include "qla_inline.h"
+#include "qla_ver.h"
+#include "qla_glbl.h"
+#include "qla_dbg.h"
+
+
+uint32_t dbg_level = 0 ;
+/*
+ * Name: qla_dump_buf32
+ * Function: dumps a buffer as 32 bit words
+ */
+void qla_dump_buf32(qla_host_t *ha, char *msg, void *dbuf32, uint32_t len32)
+{
+        device_t dev;
+	uint32_t i = 0;
+	uint32_t *buf;
+
+        dev = ha->pci_dev;
+	buf = dbuf32;
+
+	device_printf(dev, "%s: %s dump start\n", __func__, msg);
+
+	while (len32 >= 4) {
+		device_printf(dev,"0x%08x: 0x%08x 0x%08x 0x%08x 0x%08x\n",
+			i, buf[0], buf[1], buf[2], buf[3]);
+		i += 4 * 4;
+		len32 -= 4;
+		buf += 4;
+	}
+	switch (len32) {
+	case 1:
+		device_printf(dev,"0x%08x: 0x%08x\n", i, buf[0]);
+		break;
+	case 2:
+		device_printf(dev,"0x%08x: 0x%08x 0x%08x\n", i, buf[0], buf[1]);
+		break;
+	case 3:
+		device_printf(dev,"0x%08x: 0x%08x 0x%08x 0x%08x\n",
+			i, buf[0], buf[1], buf[2]);
+		break;
+	default:
+		break;
+	}
+	device_printf(dev, "%s: %s dump end\n", __func__, msg);
+}
+
+/*
+ * Name: qla_dump_buf16
+ * Function: dumps a buffer as 16 bit words
+ */
+void qla_dump_buf16(qla_host_t *ha, char *msg, void *dbuf16, uint32_t len16)
+{
+        device_t dev;
+	uint32_t i = 0;
+	uint16_t *buf;
+
+        dev = ha->pci_dev;
+	buf = dbuf16;
+
+	device_printf(dev, "%s: %s dump start\n", __func__, msg);
+
+	while (len16 >= 8) {
+		device_printf(dev,"0x%08x: 0x%04x 0x%04x 0x%04x 0x%04x"
+			" 0x%04x 0x%04x 0x%04x 0x%04x\n", i, buf[0],
+			buf[1], buf[2], buf[3], buf[4], buf[5], buf[6], buf[7]);
+		i += 16;
+		len16 -= 8;
+		buf += 8;
+	}
+	switch (len16) {
+	case 1:
+		device_printf(dev,"0x%08x: 0x%04x\n", i, buf[0]);
+		break;
+	case 2:
+		device_printf(dev,"0x%08x: 0x%04x 0x%04x\n", i, buf[0], buf[1]);
+		break;
+	case 3:
+		device_printf(dev,"0x%08x: 0x%04x 0x%04x 0x%04x\n",
+			i, buf[0], buf[1], buf[2]);
+		break;
+	case 4:
+		device_printf(dev,"0x%08x: 0x%04x 0x%04x 0x%04x 0x%04x\n", i,
+			buf[0], buf[1], buf[2], buf[3]);
+		break;
+	case 5:
+		device_printf(dev,"0x%08x:"
+			" 0x%04x 0x%04x 0x%04x 0x%04x 0x%04x\n", i,
+			buf[0], buf[1], buf[2], buf[3], buf[4]);
+		break;
+	case 6:
+		device_printf(dev,"0x%08x:"
+			" 0x%04x 0x%04x 0x%04x 0x%04x 0x%04x 0x%04x\n", i,
+			buf[0], buf[1], buf[2], buf[3], buf[4], buf[5]);
+		break;
+	case 7:
+		device_printf(dev,"0x%04x: 0x%04x 0x%04x 0x%04x 0x%04x"
+			" 0x%04x 0x%04x 0x%04x\n", i, buf[0], buf[1],
+			buf[2], buf[3], buf[4], buf[5], buf[6]);
+		break;
+	default:
+		break;
+	}
+	device_printf(dev, "%s: %s dump end\n", __func__, msg);
+}
+
+/*
+ * Name: qla_dump_buf8
+ * Function: dumps a buffer as bytes
+ */
+void qla_dump_buf8(qla_host_t *ha, char *msg, void *dbuf, uint32_t len)
+{
+        device_t dev;
+	uint32_t i = 0;
+	uint8_t *buf;
+
+        dev = ha->pci_dev;
+	buf = dbuf;
+
+	device_printf(dev, "%s: %s 0x%x dump start\n", __func__, msg, len);
+	
+	while (len >= 16) {
+		device_printf(dev,"0x%08x:"
+			" %02x %02x %02x %02x %02x %02x %02x %02x"
+			" %02x %02x %02x %02x %02x %02x %02x %02x\n", i,
+			buf[0], buf[1], buf[2], buf[3],
+			buf[4], buf[5], buf[6], buf[7],
+			buf[8], buf[9], buf[10], buf[11],
+			buf[12], buf[13], buf[14], buf[15]);
+		i += 16;
+		len -= 16;
+		buf += 16;
+	}
+	switch (len) {
+	case 1:
+		device_printf(dev,"0x%08x: %02x\n", i, buf[0]);
+		break;
+	case 2:
+		device_printf(dev,"0x%08x: %02x %02x\n", i, buf[0], buf[1]);
+		break;
+	case 3:
+		device_printf(dev,"0x%08x: %02x %02x %02x\n",
+			i, buf[0], buf[1], buf[2]);
+		break;
+	case 4:
+		device_printf(dev,"0x%08x: %02x %02x %02x %02x\n", i,
+			buf[0], buf[1], buf[2], buf[3]);
+		break;
+	case 5:
+		device_printf(dev,"0x%08x:"
+			" %02x %02x %02x %02x %02x\n", i,
+			buf[0], buf[1], buf[2], buf[3], buf[4]);
+		break;
+	case 6:
+		device_printf(dev,"0x%08x:"
+			" %02x %02x %02x %02x %02x %02x\n", i,
+			buf[0], buf[1], buf[2], buf[3], buf[4], buf[5]);
+		break;
+	case 7:
+		device_printf(dev,"0x%08x:"
+			" %02x %02x %02x %02x %02x %02x %02x\n", i,
+			buf[0], buf[1], buf[2], buf[3], buf[4], buf[5], buf[6]);
+		break;
+	case 8:
+		device_printf(dev,"0x%08x:"
+			" %02x %02x %02x %02x %02x %02x %02x %02x\n", i,
+			buf[0], buf[1], buf[2], buf[3], buf[4], buf[5], buf[6],
+			buf[7]);
+		break;
+	case 9:
+		device_printf(dev,"0x%08x:"
+			" %02x %02x %02x %02x %02x %02x %02x %02x"
+			" %02x\n", i,
+			buf[0], buf[1], buf[2], buf[3], buf[4], buf[5], buf[6],
+			buf[7], buf[8]);
+		break;
+	case 10:
+		device_printf(dev,"0x%08x:"
+			" %02x %02x %02x %02x %02x %02x %02x %02x"
+			" %02x %02x\n", i,
+			buf[0], buf[1], buf[2], buf[3], buf[4], buf[5], buf[6],
+			buf[7], buf[8], buf[9]);
+		break;
+	case 11:
+		device_printf(dev,"0x%08x:"
+			" %02x %02x %02x %02x %02x %02x %02x %02x"
+			" %02x %02x %02x\n", i,
+			buf[0], buf[1], buf[2], buf[3], buf[4], buf[5], buf[6],
+			buf[7], buf[8], buf[9], buf[10]);
+		break;
+	case 12:
+		device_printf(dev,"0x%08x:"
+			" %02x %02x %02x %02x %02x %02x %02x %02x"
+			" %02x %02x %02x %02x\n", i,
+			buf[0], buf[1], buf[2], buf[3], buf[4], buf[5], buf[6],
+			buf[7], buf[8], buf[9], buf[10], buf[11]);
+		break;
+	case 13:
+		device_printf(dev,"0x%08x:"
+			" %02x %02x %02x %02x %02x %02x %02x %02x"
+			" %02x %02x %02x %02x %02x\n", i,
+			buf[0], buf[1], buf[2], buf[3], buf[4], buf[5], buf[6],
+			buf[7], buf[8], buf[9], buf[10], buf[11], buf[12]);
+		break;
+	case 14:
+		device_printf(dev,"0x%08x:"
+			" %02x %02x %02x %02x %02x %02x %02x %02x"
+			" %02x %02x %02x %02x %02x %02x\n", i,
+			buf[0], buf[1], buf[2], buf[3], buf[4], buf[5], buf[6],
+			buf[7], buf[8], buf[9], buf[10], buf[11], buf[12],
+			buf[13]);
+		break;
+	case 15:
+		device_printf(dev,"0x%08x:"
+			" %02x %02x %02x %02x %02x %02x %02x %02x"
+			" %02x %02x %02x %02x %02x %02x %02x\n", i,
+			buf[0], buf[1], buf[2], buf[3], buf[4], buf[5], buf[6],
+			buf[7], buf[8], buf[9], buf[10], buf[11], buf[12],
+			buf[13], buf[14]);
+		break;
+	default:
+		break;
+	}
+	
+	device_printf(dev, "%s: %s dump end\n", __func__, msg);
+}

Added: head/sys/dev/qlxgb/qla_dbg.h
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/sys/dev/qlxgb/qla_dbg.h	Thu Nov  3 21:20:22 2011	(r227064)
@@ -0,0 +1,85 @@
+/*
+ * Copyright (c) 2010-2011 Qlogic Corporation
+ * 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 COPYRIGHT HOLDERS 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 COPYRIGHT OWNER OR CONTRIBUTORS BE
+ *  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ *  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ *  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ *  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ *  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ *  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ *  POSSIBILITY OF SUCH DAMAGE.
+ *
+ * $FreeBSD$
+ */
+
+/*
+ * File : qla_dbg.h
+ * Author : David C Somayajulu, Qlogic Corporation, Aliso Viejo, CA 92656.
+ */
+
+#ifndef _QL_DBG_H_
+#define _QL_DBG_H_
+
+extern uint32_t dbg_level;
+
+extern void qla_dump_buf8(qla_host_t *ha, char *str, void *dbuf,
+		uint32_t len);
+extern void qla_dump_buf16(qla_host_t *ha, char *str, void *dbuf,
+		uint32_t len16);
+extern void qla_dump_buf32(qla_host_t *ha, char *str, void *dbuf,
+		uint32_t len32);
+
+
+#define DBG 1
+
+#if DBG
+
+#define QL_DPRINT1(x)	if (dbg_level & 0x0001) device_printf x
+#define QL_DPRINT2(x)	if (dbg_level & 0x0002) device_printf x
+#define QL_DPRINT4(x)	if (dbg_level & 0x0004) device_printf x
+#define QL_DPRINT8(x)	if (dbg_level & 0x0008) device_printf x
+#define QL_DPRINT10(x)	if (dbg_level & 0x0010) device_printf x
+#define QL_DPRINT20(x)	if (dbg_level & 0x0020) device_printf x
+#define QL_DPRINT40(x)	if (dbg_level & 0x0040) device_printf x
+#define QL_DPRINT80(x)	if (dbg_level & 0x0080) device_printf x
+
+#define QL_DUMP_BUFFER8(h, s, b, n) if (dbg_level & 0x08000000)\
+					qla_dump_buf8(h, s, b, n)
+#define QL_DUMP_BUFFER16(h, s, b, n) if (dbg_level & 0x08000000)\
+					qla_dump_buf16(h, s, b, n)
+#define QL_DUMP_BUFFER32(h, s, b, n) if (dbg_level & 0x08000000)\
+					qla_dump_buf32(h, s, b, n)
+
+#else
+
+#define QL_DPRINT1(x)
+#define QL_DPRINT2(x)
+#define QL_DPRINT4(x)
+#define QL_DPRINT8(x)
+#define QL_DPRINT10(x)
+#define QL_DPRINT20(x)
+#define QL_DPRINT40(x)
+#define QL_DPRINT80(x)
+
+#define QL_DUMP_BUFFER8(h, s, b, n)
+#define QL_DUMP_BUFFER16(h, s, b, n)
+#define QL_DUMP_BUFFER32(h, s, b, n)
+
+#endif
+
+#endif /* #ifndef _QL_DBG_H_ */

Added: head/sys/dev/qlxgb/qla_def.h
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/sys/dev/qlxgb/qla_def.h	Thu Nov  3 21:20:22 2011	(r227064)
@@ -0,0 +1,208 @@
+/*
+ * Copyright (c) 2010-2011 Qlogic Corporation
+ * 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 COPYRIGHT HOLDERS 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 COPYRIGHT OWNER OR CONTRIBUTORS BE
+ *  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ *  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ *  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ *  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ *  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ *  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ *  POSSIBILITY OF SUCH DAMAGE.
+ *
+ * $FreeBSD$
+ */
+
+/*
+ * File: qla_def.h
+ * Author : David C Somayajulu, Qlogic Corporation, Aliso Viejo, CA 92656.
+ */
+
+#ifndef _QLA_DEF_H_
+#define _QLA_DEF_H_
+
+#define BIT_0                   (0x1 << 0)
+#define BIT_1                   (0x1 << 1)
+#define BIT_2                   (0x1 << 2)
+#define BIT_3                   (0x1 << 3)
+#define BIT_4                   (0x1 << 4)
+#define BIT_5                   (0x1 << 5)
+#define BIT_6                   (0x1 << 6)
+#define BIT_7                   (0x1 << 7)
+#define BIT_8                   (0x1 << 8)
+#define BIT_9                   (0x1 << 9)
+#define BIT_10                  (0x1 << 10)
+#define BIT_11                  (0x1 << 11)
+#define BIT_12                  (0x1 << 12)
+#define BIT_13                  (0x1 << 13)
+#define BIT_14                  (0x1 << 14)
+#define BIT_15                  (0x1 << 15)
+#define BIT_16                  (0x1 << 16)
+#define BIT_17                  (0x1 << 17)
+#define BIT_18                  (0x1 << 18)
+#define BIT_19                  (0x1 << 19)
+#define BIT_20                  (0x1 << 20)
+#define BIT_21                  (0x1 << 21)
+#define BIT_22                  (0x1 << 22)
+#define BIT_23                  (0x1 << 23)
+#define BIT_24                  (0x1 << 24)
+#define BIT_25                  (0x1 << 25)
+#define BIT_26                  (0x1 << 26)
+#define BIT_27                  (0x1 << 27)
+#define BIT_28                  (0x1 << 28)
+#define BIT_29                  (0x1 << 29)
+#define BIT_30                  (0x1 << 30)
+#define BIT_31                  (0x1 << 31)
+
+struct qla_rx_buf {
+	struct mbuf	*m_head;
+	bus_dmamap_t	map;
+	bus_addr_t      paddr;
+	uint32_t	handle;
+	void		*next;
+};
+typedef struct qla_rx_buf qla_rx_buf_t;
+
+struct qla_tx_buf {
+	struct mbuf	*m_head;
+	bus_dmamap_t	map;
+};
+typedef struct qla_tx_buf qla_tx_buf_t;
+
+#define QLA_MAX_SEGMENTS	63	/* maximum # of segs in a sg list */
+#define QLA_MAX_FRAME_SIZE	MJUM9BYTES
+#define QLA_STD_FRAME_SIZE	1514
+#define QLA_MAX_TSO_FRAME_SIZE	(64 * 1024 - 1)
+
+/* Number of MSIX/MSI Vectors required */
+#define Q8_MSI_COUNT		4
+
+struct qla_ivec {
+	struct resource		*irq;
+	void			*handle;
+	int			irq_rid;
+	void			*ha;
+	struct task		rcv_task;
+	struct taskqueue	*rcv_tq;
+};
+
+typedef struct qla_ivec qla_ivec_t;
+
+#define QLA_WATCHDOG_CALLOUT_TICKS	1
+
+/*
+ * Adapter structure contains the hardware independant information of the
+ * pci function.
+ */
+struct qla_host {
+        volatile struct {
+                volatile uint32_t
+			qla_watchdog_active  :1,
+			qla_watchdog_exit    :1,
+			qla_watchdog_pause   :1,
+			lro_init	:1,
+			stop_rcv	:1,
+			link_up		:1,
+			parent_tag	:1,
+			lock_init	:1;
+        } flags;
+
+	device_t		pci_dev;
+
+	uint8_t			pci_func;
+	uint16_t		watchdog_ticks;
+	uint8_t			resvd;
+
+        /* ioctl related */
+        struct cdev             *ioctl_dev;
+
+	/* register mapping */
+	struct resource		*pci_reg;
+	int			reg_rid;
+
+	/* interrupts */
+	struct resource         *irq;
+	int			msix_count;
+	void			*intr_handle;
+	qla_ivec_t		irq_vec[Q8_MSI_COUNT];
+	
+	/* parent dma tag */
+	bus_dma_tag_t           parent_tag;
+
+	/* interface to o.s */
+	struct ifnet		*ifp;
+
+	struct ifmedia		media;
+	uint16_t		max_frame_size;
+	uint16_t		rsrvd0;
+	int			if_flags;
+
+	/* hardware access lock */
+	struct mtx		hw_lock;
+	volatile uint32_t	hw_lock_held;
+
+	/* transmit and receive buffers */
+	qla_tx_buf_t		tx_buf[NUM_TX_DESCRIPTORS];
+	bus_dma_tag_t		tx_tag;
+	struct mtx		tx_lock;
+	struct task		tx_task;
+	struct taskqueue	*tx_tq;
+	struct callout		tx_callout;
+
+	qla_rx_buf_t		rx_buf[NUM_RX_DESCRIPTORS];
+	qla_rx_buf_t		rx_jbuf[NUM_RX_JUMBO_DESCRIPTORS];
+	bus_dma_tag_t		rx_tag;
+
+	struct mtx		rx_lock;
+	struct mtx		rxj_lock;
+
+	/* stats */
+	uint32_t		err_m_getcl;
+	uint32_t		err_m_getjcl;
+	uint32_t		err_tx_dmamap_create;
+	uint32_t		err_tx_dmamap_load;
+	uint32_t		err_tx_defrag;
+
+	uint64_t		rx_frames;
+	uint64_t		rx_bytes;
+
+	uint64_t		tx_frames;
+	uint64_t		tx_bytes;
+
+        uint32_t                fw_ver_major;
+        uint32_t                fw_ver_minor;
+        uint32_t                fw_ver_sub;
+        uint32_t                fw_ver_build;
+
+	/* hardware specific */
+	qla_hw_t		hw;
+
+	/* debug stuff */
+	volatile const char 	*qla_lock;
+	volatile const char	*qla_unlock;
+};
+typedef struct qla_host qla_host_t;
+
+/* note that align has to be a power of 2 */
+#define QL_ALIGN(size, align) (size + (align - 1)) & ~(align - 1);
+#define QL_MIN(x, y) ((x < y) ? x : y)
+
+#define QL_RUNNING(ifp) \
+		((ifp->if_drv_flags & (IFF_DRV_RUNNING | IFF_DRV_OACTIVE)) == \
+			IFF_DRV_RUNNING)
+
+#endif /* #ifndef _QLA_DEF_H_ */

Added: head/sys/dev/qlxgb/qla_glbl.h
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/sys/dev/qlxgb/qla_glbl.h	Thu Nov  3 21:20:22 2011	(r227064)
@@ -0,0 +1,109 @@
+/*
+ * Copyright (c) 2010-2011 Qlogic Corporation
+ * 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 COPYRIGHT HOLDERS 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 COPYRIGHT OWNER OR CONTRIBUTORS BE
+ *  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ *  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ *  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ *  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ *  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ *  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ *  POSSIBILITY OF SUCH DAMAGE.
+ *
+ * $FreeBSD$
+ */
+/*
+ * File: qla_glbl.h
+ * Author : David C Somayajulu, Qlogic Corporation, Aliso Viejo, CA 92656.
+ * Content: Contains prototypes of the exported functions from each file.
+ */
+#ifndef _QLA_GLBL_H_
+#define _QLA_GLBL_H_
+
+/*
+ * from qla_isr.c
+ */
+extern void qla_isr(void *arg);
+extern void qla_rcv(void *context, int pending);
+
+/*
+ * from qla_os.c
+ */
+extern uint32_t std_replenish;
+extern uint32_t jumbo_replenish;
+extern uint32_t rcv_pkt_thres;
+extern uint32_t rcv_pkt_thres_d;
+extern uint32_t snd_pkt_thres;
+extern uint32_t free_pkt_thres;
+
+extern int qla_alloc_dmabuf(qla_host_t *ha, qla_dma_t *dma_buf);
+extern void qla_free_dmabuf(qla_host_t *ha, qla_dma_t *dma_buf);
+extern void qla_start(struct ifnet *ifp);
+extern int qla_get_mbuf(qla_host_t *ha, qla_rx_buf_t *rxb, struct mbuf *nmp,
+	        uint32_t jumbo);
+
+
+/*
+ * from qla_flash.c
+ */
+extern int qla_flash_rd32_words(qla_host_t *ha, uint32_t addr,
+		uint32_t *val, uint32_t num);
+extern int qla_flash_rd32(qla_host_t *ha, uint32_t addr, uint32_t *val);
+
+/*
+ * from qla_hw.c
+ */
+extern int qla_get_msix_count(qla_host_t *ha);
+extern int qla_alloc_dma(qla_host_t *ha);
+extern void qla_free_dma(qla_host_t *ha);
+extern void qla_hw_add_sysctls(qla_host_t *ha);
+extern int qla_hw_send(qla_host_t *ha, bus_dma_segment_t *segs, int nsegs,
+		uint32_t *tx_idx, struct mbuf *mp);
+extern int qla_init_hw_if(qla_host_t *ha);
+extern void qla_get_hw_caps(qla_host_t *ha);
+extern void qla_hw_set_multi(qla_host_t *ha, uint8_t *mta, uint32_t mcnt,
+	uint32_t add_multi);
+extern void qla_del_hw_if(qla_host_t *ha);
+extern void qla_set_promisc(qla_host_t *ha);
+extern void qla_set_allmulti(qla_host_t *ha);
+extern void qla_reset_promisc_allmulti(qla_host_t *ha);
+extern void qla_config_ipv4_addr(qla_host_t *ha, uint32_t ipv4_addr);
+extern int qla_hw_tx_compl(qla_host_t *ha);
+extern void qla_update_link_state(qla_host_t *ha);
+extern void qla_hw_tx_done(qla_host_t *ha);
+extern int qla_config_lro(qla_host_t *ha);
+extern void qla_free_lro(qla_host_t *ha);
+extern int qla_set_max_mtu(qla_host_t *ha, uint32_t mtu, uint16_t cntxt_id);
+extern void qla_hw_stop_rcv(qla_host_t *ha);
+
+/*
+ * from qla_misc.c
+ */
+extern int qla_init_hw(qla_host_t *ha);
+extern int qla_rdwr_indreg32(qla_host_t *ha, uint32_t addr, uint32_t *val,
+		uint32_t rd);
+extern int qla_rd_flash32(qla_host_t *ha, uint32_t addr, uint32_t *data);
+
+/*
+ * from qla_ioctl.c
+ */
+extern int qla_make_cdev(qla_host_t *ha);
+extern void qla_del_cdev(qla_host_t *ha);
+extern int qla_eioctl(struct cdev *dev, u_long cmd, caddr_t data, int fflag,
+		struct thread *td);
+
+#endif /* #ifndef_QLA_GLBL_H_ */

Added: head/sys/dev/qlxgb/qla_hw.c
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/sys/dev/qlxgb/qla_hw.c	Thu Nov  3 21:20:22 2011	(r227064)
@@ -0,0 +1,1776 @@
+/*
+ * Copyright (c) 2010-2011 Qlogic Corporation
+ * 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 COPYRIGHT HOLDERS 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 COPYRIGHT OWNER 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.
+ */
+
+/*
+ * File: qla_hw.c
+ * Author : David C Somayajulu, Qlogic Corporation, Aliso Viejo, CA 92656.
+ * Content: Contains Hardware dependant functions
+ */
+
+#include 
+__FBSDID("$FreeBSD$");
+
+#include "qla_os.h"
+#include "qla_reg.h"
+#include "qla_hw.h"
+#include "qla_def.h"
+#include "qla_inline.h"
+#include "qla_ver.h"
+#include "qla_glbl.h"
+#include "qla_dbg.h"
+
+static uint32_t sysctl_num_rds_rings = 2;
+static uint32_t sysctl_num_sds_rings = 4;
+
+/*
+ * Static Functions
+ */
+
+static void qla_init_cntxt_regions(qla_host_t *ha);
+static int qla_issue_cmd(qla_host_t *ha, qla_cdrp_t *cdrp);
+static int qla_fw_cmd(qla_host_t *ha, void *fw_cmd, uint32_t size);
+static int qla_config_mac_addr(qla_host_t *ha, uint8_t *mac_addr,
+		uint16_t cntxt_id, uint32_t add_multi);
+static void qla_del_rcv_cntxt(qla_host_t *ha);
+static int qla_init_rcv_cntxt(qla_host_t *ha);
+static void qla_del_xmt_cntxt(qla_host_t *ha);
+static int qla_init_xmt_cntxt(qla_host_t *ha);
+static int qla_get_max_rds(qla_host_t *ha);
+static int qla_get_max_sds(qla_host_t *ha);
+static int qla_get_max_rules(qla_host_t *ha);
+static int qla_get_max_rcv_cntxts(qla_host_t *ha);
+static int qla_get_max_tx_cntxts(qla_host_t *ha);
+static int qla_get_max_mtu(qla_host_t *ha);
+static int qla_get_max_lro(qla_host_t *ha);
+static int qla_get_flow_control(qla_host_t *ha);
+static void qla_hw_tx_done_locked(qla_host_t *ha);
+
+int
+qla_get_msix_count(qla_host_t *ha)
+{
+	return (sysctl_num_sds_rings);
+}
+
+/*
+ * Name: qla_hw_add_sysctls
+ * Function: Add P3Plus specific sysctls
+ */
+void
+qla_hw_add_sysctls(qla_host_t *ha)
+{
+        device_t	dev;
+

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

From owner-svn-src-head@FreeBSD.ORG  Fri Nov  4 03:39:31 2011
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id DAF0B106566B;
	Fri,  4 Nov 2011 03:39: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 CAEDC8FC12;
	Fri,  4 Nov 2011 03:39:31 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pA43dV2h099486;
	Fri, 4 Nov 2011 03:39:31 GMT (envelope-from jhb@svn.freebsd.org)
Received: (from jhb@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id pA43dVt9099483;
	Fri, 4 Nov 2011 03:39:31 GMT (envelope-from jhb@svn.freebsd.org)
Message-Id: <201111040339.pA43dVt9099483@svn.freebsd.org>
From: John Baldwin 
Date: Fri, 4 Nov 2011 03:39: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: r227069 - in head/sys: fs/devfs 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, 04 Nov 2011 03:39:32 -0000

Author: jhb
Date: Fri Nov  4 03:39:31 2011
New Revision: 227069
URL: http://svn.freebsd.org/changeset/base/227069

Log:
  Move the cleanup of f_cdevpriv when the reference count of a devfs
  file descriptor drops to zero out of _fdrop() and into devfs_close_f()
  as it is only relevant for devfs file descriptors.
  
  Reviewed by:	kib
  MFC after:	1 week

Modified:
  head/sys/fs/devfs/devfs_vnops.c
  head/sys/kern/kern_descrip.c

Modified: head/sys/fs/devfs/devfs_vnops.c
==============================================================================
--- head/sys/fs/devfs/devfs_vnops.c	Fri Nov  4 02:34:52 2011	(r227068)
+++ head/sys/fs/devfs/devfs_vnops.c	Fri Nov  4 03:39:31 2011	(r227069)
@@ -604,6 +604,13 @@ devfs_close_f(struct file *fp, struct th
 	td->td_fpop = fp;
 	error = vnops.fo_close(fp, td);
 	td->td_fpop = fpop;
+
+	/*
+	 * The f_cdevpriv cannot be assigned non-NULL value while we
+	 * are destroying the file.
+	 */
+	if (fp->f_cdevpriv != NULL)
+		devfs_fpdrop(fp);
 	return (error);
 }
 

Modified: head/sys/kern/kern_descrip.c
==============================================================================
--- head/sys/kern/kern_descrip.c	Fri Nov  4 02:34:52 2011	(r227068)
+++ head/sys/kern/kern_descrip.c	Fri Nov  4 03:39:31 2011	(r227069)
@@ -2575,12 +2575,6 @@ _fdrop(struct file *fp, struct thread *t
 		panic("fdrop: count %d", fp->f_count);
 	if (fp->f_ops != &badfileops)
 		error = fo_close(fp, td);
-	/*
-	 * The f_cdevpriv cannot be assigned non-NULL value while we
-	 * are destroying the file.
-	 */
-	if (fp->f_cdevpriv != NULL)
-		devfs_fpdrop(fp);
 	atomic_subtract_int(&openfiles, 1);
 	crfree(fp->f_cred);
 	uma_zfree(file_zone, fp);

From owner-svn-src-head@FreeBSD.ORG  Fri Nov  4 04:02:51 2011
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 554211065670;
	Fri,  4 Nov 2011 04:02:51 +0000 (UTC) (envelope-from jhb@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 42AEB8FC13;
	Fri,  4 Nov 2011 04:02:51 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pA442p48000338;
	Fri, 4 Nov 2011 04:02:51 GMT (envelope-from jhb@svn.freebsd.org)
Received: (from jhb@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id pA442oYZ000317;
	Fri, 4 Nov 2011 04:02:50 GMT (envelope-from jhb@svn.freebsd.org)
Message-Id: <201111040402.pA442oYZ000317@svn.freebsd.org>
From: John Baldwin 
Date: Fri, 4 Nov 2011 04:02: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: r227070 - in head: lib/libc/sys sys/compat/freebsd32
	sys/kern sys/sys sys/vm
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 04 Nov 2011 04:02:51 -0000

Author: jhb
Date: Fri Nov  4 04:02:50 2011
New Revision: 227070
URL: http://svn.freebsd.org/changeset/base/227070

Log:
  Add the posix_fadvise(2) system call.  It is somewhat similar to
  madvise(2) except that it operates on a file descriptor instead of a
  memory region.  It is currently only supported on regular files.
  
  Just as with madvise(2), the advice given to posix_fadvise(2) can be
  divided into two types.  The first type provide hints about data access
  patterns and are used in the file read and write routines to modify the
  I/O flags passed down to VOP_READ() and VOP_WRITE().  These modes are
  thus filesystem independent.  Note that to ease implementation (and
  since this API is only advisory anyway), only a single non-normal
  range is allowed per file descriptor.
  
  The second type of hints are used to hint to the OS that data will or
  will not be used.  These hints are implemented via a new VOP_ADVISE().
  A default implementation is provided which does nothing for the WILLNEED
  request and attempts to move any clean pages to the cache page queue for
  the DONTNEED request.  This latter case required two other changes.
  First, a new V_CLEANONLY flag was added to vinvalbuf().  This requests
  vinvalbuf() to only flush clean buffers for the vnode from the buffer
  cache and to not remove any backing pages from the vnode.  This is
  used to ensure clean pages are not wired into the buffer cache before
  attempting to move them to the cache page queue.  The second change adds
  a new vm_object_page_cache() method.  This method is somewhat similar to
  vm_object_page_remove() except that instead of freeing each page in the
  specified range, it attempts to move clean pages to the cache queue if
  possible.
  
  To preserve the ABI of struct file, the f_cdevpriv pointer is now reused
  in a union to point to the currently active advice region if one is
  present for regular files.
  
  Reviewed by:	jilles, kib, arch@
  Approved by:	re (kib)
  MFC after:	1 month

Added:
  head/lib/libc/sys/posix_fadvise.2   (contents, props changed)
Modified:
  head/lib/libc/sys/Makefile.inc
  head/lib/libc/sys/Symbol.map
  head/lib/libc/sys/madvise.2
  head/sys/compat/freebsd32/freebsd32_misc.c
  head/sys/compat/freebsd32/syscalls.master
  head/sys/kern/syscalls.master
  head/sys/kern/vfs_default.c
  head/sys/kern/vfs_subr.c
  head/sys/kern/vfs_syscalls.c
  head/sys/kern/vfs_vnops.c
  head/sys/kern/vnode_if.src
  head/sys/sys/fcntl.h
  head/sys/sys/file.h
  head/sys/sys/param.h
  head/sys/sys/vnode.h
  head/sys/vm/vm_object.c
  head/sys/vm/vm_object.h

Modified: head/lib/libc/sys/Makefile.inc
==============================================================================
--- head/lib/libc/sys/Makefile.inc	Fri Nov  4 03:39:31 2011	(r227069)
+++ head/lib/libc/sys/Makefile.inc	Fri Nov  4 04:02:50 2011	(r227070)
@@ -96,7 +96,8 @@ MAN+=	abort2.2 accept.2 access.2 acct.2 
 	mq_setattr.2 \
 	msgctl.2 msgget.2 msgrcv.2 msgsnd.2 \
 	msync.2 munmap.2 nanosleep.2 nfssvc.2 ntp_adjtime.2 open.2 \
-	pathconf.2 pdfork.2 pipe.2 poll.2 posix_fallocate.2 posix_openpt.2 profil.2 \
+	pathconf.2 pdfork.2 pipe.2 poll.2 posix_fadvise.2 posix_fallocate.2 \
+	posix_openpt.2 profil.2 \
 	pselect.2 ptrace.2 quotactl.2 \
 	read.2 readlink.2 reboot.2 recv.2 rename.2 revoke.2 rfork.2 rmdir.2 \
 	rtprio.2

Modified: head/lib/libc/sys/Symbol.map
==============================================================================
--- head/lib/libc/sys/Symbol.map	Fri Nov  4 03:39:31 2011	(r227069)
+++ head/lib/libc/sys/Symbol.map	Fri Nov  4 04:02:50 2011	(r227070)
@@ -378,6 +378,10 @@ FBSD_1.2 {
 	setloginclass;
 };
 
+FBSD_1.3 {
+	posix_fadvise;
+};
+
 FBSDprivate_1.0 {
 	___acl_aclcheck_fd;
 	__sys___acl_aclcheck_fd;

Modified: head/lib/libc/sys/madvise.2
==============================================================================
--- head/lib/libc/sys/madvise.2	Fri Nov  4 03:39:31 2011	(r227069)
+++ head/lib/libc/sys/madvise.2	Fri Nov  4 04:02:50 2011	(r227070)
@@ -169,7 +169,8 @@ was specified and the process does not h
 .Xr mincore 2 ,
 .Xr mprotect 2 ,
 .Xr msync 2 ,
-.Xr munmap 2
+.Xr munmap 2 ,
+.Xr posix_fadvise 2
 .Sh STANDARDS
 The
 .Fn posix_madvise

Added: head/lib/libc/sys/posix_fadvise.2
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/lib/libc/sys/posix_fadvise.2	Fri Nov  4 04:02:50 2011	(r227070)
@@ -0,0 +1,139 @@
+.\" Copyright (c) 1991, 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.
+.\"
+.\"	@(#)madvise.2	8.1 (Berkeley) 6/9/93
+.\" $FreeBSD$
+.\"
+.Dd October 26, 2011
+.Dt POSIX_FADVISE 2
+.Os
+.Sh NAME
+.Nm posix_fadvise
+.Nd give advice about use of file data
+.Sh LIBRARY
+.Lb libc
+.Sh SYNOPSIS
+.In fcntl.h
+.Ft int
+.Fn posix_fadvise "int fd" "off_t offset" "off_t len" "int advice"
+.Sh DESCRIPTION
+The
+.Fn posix_fadvise
+system call
+allows a process to describe to the system its data access behavior for an
+open file descriptor
+.Fa fd .
+The advice covers the data starting at offset
+.Fa offset
+and continuing for
+.Fa len
+bytes.
+If
+.Fa len
+is zero,
+all data from
+.Fa offset
+to the end of the file is covered.
+.Pp
+The behavior is specified by the
+.Fa advice
+parameter and may be one of:
+.Bl -tag -width POSIX_FADV_SEQUENTIAL
+.It Dv POSIX_FADV_NORMAL
+Tells the system to revert to the default data access behavior.
+.It Dv POSIX_FADV_RANDOM
+Is a hint that file data will be accessed randomly,
+and prefetching is likely not advantageous.
+.It Dv POSIX_FADV_SEQUENTIAL
+Tells the system that file data will be accessed sequentially.
+This currently does nothing as the default behavior uses heuristics to
+detect sequential behavior.
+.It Dv POSIX_FADV_WILLNEED
+Tells the system that the specified data will be accessed in the near future.
+The system may initiate an asychronous read of the data if it is not already
+present in memory.
+.It Dv POSIX_FADV_DONTNEED
+Tells the system that the specified data will not be accessed in the near
+future.
+The system may decrease the in-memory priority of clean data within the
+specified range and future access to this data may require a read operation.
+.It Dv POSIX_FADV_NOREUSE
+Tells the system that the specified data will only be accessed once and
+then not reused.
+Accesses to data within the specified range are treated as if the file
+descriptor has the
+.Dv O_DIRECT
+flag enabled.
+.El
+.Pp
+.Sh RETURN VALUES
+.Rv -std posix_fadvise
+.Sh ERRORS
+The
+.Fn posix_fadvise
+system call will fail if:
+.Bl -tag -width Er
+.It Bq Er EBADF
+The
+.Fa fd
+argument is not a valid file descriptor.
+.It Bq Er EINVAL
+The
+.Fa advice
+argument is not valid.
+.It Bq Er EINVAL
+The
+.Fa offset
+or
+.Fa len
+arguments are negative,
+or
+.Fa offset
++
+.Fa len
+is greater than the maximum file size.
+.It Bq Er ENODEV
+The
+.Fa fd
+argument does not refer to a regular file.
+.It Bq Er ESPIPE
+The
+.Fa fd
+argument is associated with a pipe or FIFO.
+.El
+.Sh SEE ALSO
+.Xr madvise 2
+.Sh STANDARDS
+The
+.Fn posix_fadvise
+interface conforms to
+.St -p1003.1-2001 .
+.Sh HISTORY
+The
+.Fn posix_fadvise
+system call first appeared in
+.Fx 10.0 .

Modified: head/sys/compat/freebsd32/freebsd32_misc.c
==============================================================================
--- head/sys/compat/freebsd32/freebsd32_misc.c	Fri Nov  4 03:39:31 2011	(r227069)
+++ head/sys/compat/freebsd32/freebsd32_misc.c	Fri Nov  4 04:02:50 2011	(r227070)
@@ -2835,3 +2835,16 @@ freebsd32_posix_fallocate(struct thread 
 	ap.len = PAIR32TO64(off_t, uap->len);
 	return (sys_posix_fallocate(td, &ap));
 }
+
+int
+freebsd32_posix_fadvise(struct thread *td,
+    struct freebsd32_posix_fadvise_args *uap)
+{
+	struct posix_fadvise_args ap;
+
+	ap.fd = uap->fd;
+	ap.offset = PAIR32TO64(off_t, uap->offset);
+	ap.len = PAIR32TO64(off_t, uap->len);
+	ap.advice = uap->advice;
+	return (sys_posix_fadvise(td, &ap));
+}

Modified: head/sys/compat/freebsd32/syscalls.master
==============================================================================
--- head/sys/compat/freebsd32/syscalls.master	Fri Nov  4 03:39:31 2011	(r227069)
+++ head/sys/compat/freebsd32/syscalls.master	Fri Nov  4 04:02:50 2011	(r227070)
@@ -991,4 +991,7 @@
 530	AUE_NULL	STD	{ int freebsd32_posix_fallocate(int fd,\
 				    uint32_t offset1, uint32_t offset2,\
 				    uint32_t len1, uint32_t len2); }
-531	AUE_NULL	UNIMPL	posix_fadvise
+531	AUE_NULL	STD	{ int freebsd32_posix_fadvise(int fd, \
+				    uint32_t offset1, uint32_t offset2,\
+				    uint32_t len1, uint32_t len2, \
+				    int advice); }

Modified: head/sys/kern/syscalls.master
==============================================================================
--- head/sys/kern/syscalls.master	Fri Nov  4 03:39:31 2011	(r227069)
+++ head/sys/kern/syscalls.master	Fri Nov  4 04:02:50 2011	(r227070)
@@ -947,6 +947,7 @@
 				    size_t outbuflen); }
 530	AUE_NULL	STD	{ int posix_fallocate(int fd, \
 				    off_t offset, off_t len); }
-531	AUE_NULL	UNIMPL	posix_fadvise
+531	AUE_NULL	STD	{ int posix_fadvise(int fd, off_t offset, \
+				    off_t len, int advice); }
 ; Please copy any additions and changes to the following compatability tables:
 ; sys/compat/freebsd32/syscalls.master

Modified: head/sys/kern/vfs_default.c
==============================================================================
--- head/sys/kern/vfs_default.c	Fri Nov  4 03:39:31 2011	(r227069)
+++ head/sys/kern/vfs_default.c	Fri Nov  4 04:02:50 2011	(r227070)
@@ -96,6 +96,7 @@ struct vop_vector default_vnodeops = {
 
 	.vop_access =		vop_stdaccess,
 	.vop_accessx =		vop_stdaccessx,
+	.vop_advise =		vop_stdadvise,
 	.vop_advlock =		vop_stdadvlock,
 	.vop_advlockasync =	vop_stdadvlockasync,
 	.vop_advlockpurge =	vop_stdadvlockpurge,
@@ -984,6 +985,58 @@ vop_stdallocate(struct vop_allocate_args
 	return (error);
 }
 
+int
+vop_stdadvise(struct vop_advise_args *ap)
+{
+	struct vnode *vp;
+	off_t start, end;
+	int error, vfslocked;
+
+	vp = ap->a_vp;
+	switch (ap->a_advice) {
+	case POSIX_FADV_WILLNEED:
+		/*
+		 * Do nothing for now.  Filesystems should provide a
+		 * custom method which starts an asynchronous read of
+		 * the requested region.
+		 */
+		error = 0;
+		break;
+	case POSIX_FADV_DONTNEED:
+		/*
+		 * Flush any open FS buffers and then remove pages
+		 * from the backing VM object.  Using vinvalbuf() here
+		 * is a bit heavy-handed as it flushes all buffers for
+		 * the given vnode, not just the buffers covering the
+		 * requested range.
+		 */
+		error = 0;
+		vfslocked = VFS_LOCK_GIANT(vp->v_mount);
+		vn_lock(vp, LK_EXCLUSIVE | LK_RETRY);
+		if (vp->v_iflag & VI_DOOMED) {
+			VOP_UNLOCK(vp, 0);
+			VFS_UNLOCK_GIANT(vfslocked);
+			break;
+		}
+		vinvalbuf(vp, V_CLEANONLY, 0, 0);
+		if (vp->v_object != NULL) {
+			start = trunc_page(ap->a_start);
+			end = round_page(ap->a_end);
+			VM_OBJECT_LOCK(vp->v_object);
+			vm_object_page_cache(vp->v_object, OFF_TO_IDX(start),
+			    OFF_TO_IDX(end));
+			VM_OBJECT_UNLOCK(vp->v_object);
+		}
+		VOP_UNLOCK(vp, 0);
+		VFS_UNLOCK_GIANT(vfslocked);
+		break;
+	default:
+		error = EINVAL;
+		break;
+	}
+	return (error);
+}
+
 /*
  * vfs default ops
  * used to fill the vfs function table to get reasonable default return values.

Modified: head/sys/kern/vfs_subr.c
==============================================================================
--- head/sys/kern/vfs_subr.c	Fri Nov  4 03:39:31 2011	(r227069)
+++ head/sys/kern/vfs_subr.c	Fri Nov  4 04:02:50 2011	(r227070)
@@ -1191,7 +1191,7 @@ bufobj_invalbuf(struct bufobj *bo, int f
 	do {
 		error = flushbuflist(&bo->bo_clean,
 		    flags, bo, slpflag, slptimeo);
-		if (error == 0)
+		if (error == 0 && !(flags & V_CLEANONLY))
 			error = flushbuflist(&bo->bo_dirty,
 			    flags, bo, slpflag, slptimeo);
 		if (error != 0 && error != EAGAIN) {
@@ -1220,7 +1220,8 @@ bufobj_invalbuf(struct bufobj *bo, int f
 	/*
 	 * Destroy the copy in the VM cache, too.
 	 */
-	if (bo->bo_object != NULL && (flags & (V_ALT | V_NORMAL)) == 0) {
+	if (bo->bo_object != NULL &&
+	    (flags & (V_ALT | V_NORMAL | V_CLEANONLY)) == 0) {
 		VM_OBJECT_LOCK(bo->bo_object);
 		vm_object_page_remove(bo->bo_object, 0, 0, (flags & V_SAVE) ?
 		    OBJPR_CLEANONLY : 0);
@@ -1229,7 +1230,7 @@ bufobj_invalbuf(struct bufobj *bo, int f
 
 #ifdef INVARIANTS
 	BO_LOCK(bo);
-	if ((flags & (V_ALT | V_NORMAL)) == 0 &&
+	if ((flags & (V_ALT | V_NORMAL | V_CLEANONLY)) == 0 &&
 	    (bo->bo_dirty.bv_cnt > 0 || bo->bo_clean.bv_cnt > 0))
 		panic("vinvalbuf: flush failed");
 	BO_UNLOCK(bo);

Modified: head/sys/kern/vfs_syscalls.c
==============================================================================
--- head/sys/kern/vfs_syscalls.c	Fri Nov  4 03:39:31 2011	(r227069)
+++ head/sys/kern/vfs_syscalls.c	Fri Nov  4 04:02:50 2011	(r227070)
@@ -86,6 +86,8 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 
+static MALLOC_DEFINE(M_FADVISE, "fadvise", "posix_fadvise(2) information");
+
 SDT_PROVIDER_DEFINE(vfs);
 SDT_PROBE_DEFINE(vfs, , stat, mode, mode);
 SDT_PROBE_ARGTYPE(vfs, , stat, mode, 0, "char *");
@@ -4845,3 +4847,135 @@ sys_posix_fallocate(struct thread *td, s
 
 	return (kern_posix_fallocate(td, uap->fd, uap->offset, uap->len));
 }
+
+/*
+ * Unlike madvise(2), we do not make a best effort to remember every
+ * possible caching hint.  Instead, we remember the last setting with
+ * the exception that we will allow POSIX_FADV_NORMAL to adjust the
+ * region of any current setting.
+ */
+int
+sys_posix_fadvise(struct thread *td, struct posix_fadvise_args *uap)
+{
+	struct fadvise_info *fa, *new;
+	struct file *fp;
+	struct vnode *vp;
+	off_t end;
+	int error;
+
+	if (uap->offset < 0 || uap->len < 0 ||
+	    uap->offset > OFF_MAX - uap->len)
+		return (EINVAL);
+	switch (uap->advice) {
+	case POSIX_FADV_SEQUENTIAL:
+	case POSIX_FADV_RANDOM:
+	case POSIX_FADV_NOREUSE:
+		new = malloc(sizeof(*fa), M_FADVISE, M_WAITOK);
+		break;
+	case POSIX_FADV_NORMAL:
+	case POSIX_FADV_WILLNEED:
+	case POSIX_FADV_DONTNEED:
+		new = NULL;
+		break;
+	default:
+		return (EINVAL);
+	}
+	/* XXX: CAP_POSIX_FADVISE? */
+	error = fget(td, uap->fd, 0, &fp);
+	if (error != 0)
+		goto out;
+	
+	switch (fp->f_type) {
+	case DTYPE_VNODE:
+		break;
+	case DTYPE_PIPE:
+	case DTYPE_FIFO:
+		error = ESPIPE;
+		goto out;
+	default:
+		error = ENODEV;
+		goto out;
+	}
+	vp = fp->f_vnode;
+	if (vp->v_type != VREG) {
+		error = ENODEV;
+		goto out;
+	}
+	if (uap->len == 0)
+		end = OFF_MAX;
+	else
+		end = uap->offset + uap->len - 1;
+	switch (uap->advice) {
+	case POSIX_FADV_SEQUENTIAL:
+	case POSIX_FADV_RANDOM:
+	case POSIX_FADV_NOREUSE:
+		/*
+		 * Try to merge any existing non-standard region with
+		 * this new region if possible, otherwise create a new
+		 * non-standard region for this request.
+		 */
+		mtx_pool_lock(mtxpool_sleep, fp);
+		fa = fp->f_advice;
+		if (fa != NULL && fa->fa_advice == uap->advice &&
+		    ((fa->fa_start <= end && fa->fa_end >= uap->offset) ||
+		    (end != OFF_MAX && fa->fa_start == end + 1) ||
+		    (fa->fa_end != OFF_MAX && fa->fa_end + 1 == uap->offset))) {
+			if (uap->offset < fa->fa_start)
+				fa->fa_start = uap->offset;
+			if (end > fa->fa_end)
+				fa->fa_end = end;
+		} else {
+			new->fa_advice = uap->advice;
+			new->fa_start = uap->offset;
+			new->fa_end = end;
+			fp->f_advice = new;
+			new = fa;
+		}
+		mtx_pool_unlock(mtxpool_sleep, fp);
+		break;
+	case POSIX_FADV_NORMAL:
+		/*
+		 * If a the "normal" region overlaps with an existing
+		 * non-standard region, trim or remove the
+		 * non-standard region.
+		 */
+		mtx_pool_lock(mtxpool_sleep, fp);
+		fa = fp->f_advice;
+		if (fa != NULL) {
+			if (uap->offset <= fa->fa_start &&
+			    end >= fa->fa_end) {
+				new = fa;
+				fp->f_advice = NULL;
+			} else if (uap->offset <= fa->fa_start &&
+			    end >= fa->fa_start)
+				fa->fa_start = end + 1;
+			else if (uap->offset <= fa->fa_end &&
+			    end >= fa->fa_end)
+				fa->fa_end = uap->offset - 1;
+			else if (uap->offset >= fa->fa_start &&
+			    end <= fa->fa_end) {
+				/*
+				 * If the "normal" region is a middle
+				 * portion of the existing
+				 * non-standard region, just remove
+				 * the whole thing rather than picking
+				 * one side or the other to
+				 * preserve.
+				 */
+				new = fa;
+				fp->f_advice = NULL;
+			}
+		}
+		mtx_pool_unlock(mtxpool_sleep, fp);
+		break;
+	case POSIX_FADV_WILLNEED:
+	case POSIX_FADV_DONTNEED:
+		error = VOP_ADVISE(vp, uap->offset, end, uap->advice);
+		break;
+	}
+out:
+	if (fp != NULL)
+		fdrop(fp, td);
+	free(new, M_FADVISE);
+	return (error);
+}

Modified: head/sys/kern/vfs_vnops.c
==============================================================================
--- head/sys/kern/vfs_vnops.c	Fri Nov  4 03:39:31 2011	(r227069)
+++ head/sys/kern/vfs_vnops.c	Fri Nov  4 04:02:50 2011	(r227070)
@@ -518,7 +518,7 @@ vn_read(fp, uio, active_cred, flags, td)
 	struct vnode *vp;
 	int error, ioflag;
 	struct mtx *mtxp;
-	int vfslocked;
+	int advice, vfslocked;
 
 	KASSERT(uio->uio_td == td, ("uio_td %p is not td %p",
 	    uio->uio_td, td));
@@ -529,27 +529,48 @@ vn_read(fp, uio, active_cred, flags, td)
 		ioflag |= IO_NDELAY;
 	if (fp->f_flag & O_DIRECT)
 		ioflag |= IO_DIRECT;
+	advice = POSIX_FADV_NORMAL;
 	vfslocked = VFS_LOCK_GIANT(vp->v_mount);
 	/*
 	 * According to McKusick the vn lock was protecting f_offset here.
 	 * It is now protected by the FOFFSET_LOCKED flag.
 	 */
-	if ((flags & FOF_OFFSET) == 0) {
+	if ((flags & FOF_OFFSET) == 0 || fp->f_advice != NULL) {
 		mtxp = mtx_pool_find(mtxpool_sleep, fp);
 		mtx_lock(mtxp);
-		while(fp->f_vnread_flags & FOFFSET_LOCKED) {
-			fp->f_vnread_flags |= FOFFSET_LOCK_WAITING;
-			msleep(&fp->f_vnread_flags, mtxp, PUSER -1,
-			    "vnread offlock", 0);
+		if ((flags & FOF_OFFSET) == 0) {
+			while (fp->f_vnread_flags & FOFFSET_LOCKED) {
+				fp->f_vnread_flags |= FOFFSET_LOCK_WAITING;
+				msleep(&fp->f_vnread_flags, mtxp, PUSER -1,
+				    "vnread offlock", 0);
+			}
+			fp->f_vnread_flags |= FOFFSET_LOCKED;
+			uio->uio_offset = fp->f_offset;
 		}
-		fp->f_vnread_flags |= FOFFSET_LOCKED;
+		if (fp->f_advice != NULL &&
+		    uio->uio_offset >= fp->f_advice->fa_start &&
+		    uio->uio_offset + uio->uio_resid <= fp->f_advice->fa_end)
+			advice = fp->f_advice->fa_advice;
 		mtx_unlock(mtxp);
-		vn_lock(vp, LK_SHARED | LK_RETRY);
-		uio->uio_offset = fp->f_offset;
-	} else
-		vn_lock(vp, LK_SHARED | LK_RETRY);
+	}
+	vn_lock(vp, LK_SHARED | LK_RETRY);
 
-	ioflag |= sequential_heuristic(uio, fp);
+	switch (advice) {
+	case POSIX_FADV_NORMAL:
+	case POSIX_FADV_SEQUENTIAL:
+		ioflag |= sequential_heuristic(uio, fp);
+		break;
+	case POSIX_FADV_RANDOM:
+		/* Disable read-ahead for random I/O. */
+		break;
+	case POSIX_FADV_NOREUSE:
+		/*
+		 * Request the underlying FS to discard the buffers
+		 * and pages after the I/O is complete.
+		 */
+		ioflag |= IO_DIRECT;
+		break;
+	}
 
 #ifdef MAC
 	error = mac_vnode_check_read(active_cred, fp->f_cred, vp);
@@ -584,7 +605,8 @@ vn_write(fp, uio, active_cred, flags, td
 	struct vnode *vp;
 	struct mount *mp;
 	int error, ioflag, lock_flags;
-	int vfslocked;
+	struct mtx *mtxp;
+	int advice, vfslocked;
 
 	KASSERT(uio->uio_td == td, ("uio_td %p is not td %p",
 	    uio->uio_td, td));
@@ -618,7 +640,33 @@ vn_write(fp, uio, active_cred, flags, td
 	vn_lock(vp, lock_flags | LK_RETRY);
 	if ((flags & FOF_OFFSET) == 0)
 		uio->uio_offset = fp->f_offset;
-	ioflag |= sequential_heuristic(uio, fp);
+	advice = POSIX_FADV_NORMAL;
+	if (fp->f_advice != NULL) {
+		mtxp = mtx_pool_find(mtxpool_sleep, fp);
+		mtx_lock(mtxp);
+		if (fp->f_advice != NULL &&
+		    uio->uio_offset >= fp->f_advice->fa_start &&
+		    uio->uio_offset + uio->uio_resid <= fp->f_advice->fa_end)
+			advice = fp->f_advice->fa_advice;
+		mtx_unlock(mtxp);
+	}
+	switch (advice) {
+	case POSIX_FADV_NORMAL:
+	case POSIX_FADV_SEQUENTIAL:
+		ioflag |= sequential_heuristic(uio, fp);
+		break;
+	case POSIX_FADV_RANDOM:
+		/* XXX: Is this correct? */
+		break;
+	case POSIX_FADV_NOREUSE:
+		/*
+		 * Request the underlying FS to discard the buffers
+		 * and pages after the I/O is complete.
+		 */
+		ioflag |= IO_DIRECT;
+		break;
+	}
+
 #ifdef MAC
 	error = mac_vnode_check_write(active_cred, fp->f_cred, vp);
 	if (error == 0)

Modified: head/sys/kern/vnode_if.src
==============================================================================
--- head/sys/kern/vnode_if.src	Fri Nov  4 03:39:31 2011	(r227069)
+++ head/sys/kern/vnode_if.src	Fri Nov  4 04:02:50 2011	(r227070)
@@ -628,3 +628,12 @@ vop_allocate {
 	INOUT off_t *offset;
 	INOUT off_t *len;
 };
+
+%% advise	vp	U U U
+
+vop_advise {
+	IN struct vnode *vp;
+	IN off_t start;
+	IN off_t end;
+	IN int advice;
+};

Modified: head/sys/sys/fcntl.h
==============================================================================
--- head/sys/sys/fcntl.h	Fri Nov  4 03:39:31 2011	(r227069)
+++ head/sys/sys/fcntl.h	Fri Nov  4 04:02:50 2011	(r227070)
@@ -277,9 +277,17 @@ struct oflock {
 #define	LOCK_UN		0x08		/* unlock file */
 #endif
 
+#if __POSIX_VISIBLE >= 200112
 /*
- * XXX missing posix_fadvise() and POSIX_FADV_* macros.
+ * Advice to posix_fadvise
  */
+#define	POSIX_FADV_NORMAL	0	/* no special treatment */
+#define	POSIX_FADV_RANDOM	1	/* expect random page references */
+#define	POSIX_FADV_SEQUENTIAL	2	/* expect sequential page references */
+#define	POSIX_FADV_WILLNEED	3	/* will need these pages */
+#define	POSIX_FADV_DONTNEED	4	/* dont need these pages */
+#define	POSIX_FADV_NOREUSE	5	/* access data only once */
+#endif
 
 #ifndef _KERNEL
 __BEGIN_DECLS
@@ -293,6 +301,7 @@ int	flock(int, int);
 int	openat(int, const char *, int, ...);
 #endif
 #if __BSD_VISIBLE || __POSIX_VISIBLE >= 200112
+int	posix_fadvise(int, off_t, off_t, int);
 int	posix_fallocate(int, off_t, off_t);
 #endif
 __END_DECLS

Modified: head/sys/sys/file.h
==============================================================================
--- head/sys/sys/file.h	Fri Nov  4 03:39:31 2011	(r227069)
+++ head/sys/sys/file.h	Fri Nov  4 04:02:50 2011	(r227070)
@@ -122,6 +122,12 @@ struct fileops {
  * none	not locked
  */
 
+struct fadvise_info {
+	int		fa_advice;	/* (f) FADV_* type. */
+	off_t		fa_start;	/* (f) Region start. */
+	off_t		fa_end;		/* (f) Region end. */
+};
+
 struct file {
 	void		*f_data;	/* file descriptor specific data */
 	struct fileops	*f_ops;		/* File operations */
@@ -136,7 +142,11 @@ struct file {
 	 */
 	int		f_seqcount;	/* Count of sequential accesses. */
 	off_t		f_nextoff;	/* next expected read/write offset. */
-	struct cdev_privdata *f_cdevpriv; /* (d) Private data for the cdev. */
+	union {
+		struct cdev_privdata *fvn_cdevpriv;
+					/* (d) Private data for the cdev. */
+		struct fadvise_info *fvn_advice;
+	} f_vnun;
 	/*
 	 *  DFLAG_SEEKABLE specific fields
 	 */
@@ -147,6 +157,9 @@ struct file {
 	void		*f_label;	/* Place-holder for MAC label. */
 };
 
+#define	f_cdevpriv	f_vnun.fvn_cdevpriv
+#define	f_advice	f_vnun.fvn_advice
+
 #define	FOFFSET_LOCKED       0x1
 #define	FOFFSET_LOCK_WAITING 0x2		 
 

Modified: head/sys/sys/param.h
==============================================================================
--- head/sys/sys/param.h	Fri Nov  4 03:39:31 2011	(r227069)
+++ head/sys/sys/param.h	Fri Nov  4 04:02:50 2011	(r227070)
@@ -58,7 +58,7 @@
  *		in the range 5 to 9.
  */
 #undef __FreeBSD_version
-#define __FreeBSD_version 1000000	/* Master, propagated to newvers */
+#define __FreeBSD_version 1000001	/* Master, propagated to newvers */
 
 #ifdef _KERNEL
 #define	P_OSREL_SIGWAIT		700000

Modified: head/sys/sys/vnode.h
==============================================================================
--- head/sys/sys/vnode.h	Fri Nov  4 03:39:31 2011	(r227069)
+++ head/sys/sys/vnode.h	Fri Nov  4 04:02:50 2011	(r227070)
@@ -384,6 +384,7 @@ extern int		vttoif_tab[];
 #define	V_SAVE		0x0001	/* vinvalbuf: sync file first */
 #define	V_ALT		0x0002	/* vinvalbuf: invalidate only alternate bufs */
 #define	V_NORMAL	0x0004	/* vinvalbuf: invalidate only regular bufs */
+#define	V_CLEANONLY	0x0008	/* vinvalbuf: invalidate only clean bufs */
 #define	REVOKEALL	0x0001	/* vop_revoke: revoke all aliases */
 #define	V_WAIT		0x0001	/* vn_start_write: sleep for suspend */
 #define	V_NOWAIT	0x0002	/* vn_start_write: don't sleep for suspend */
@@ -685,6 +686,7 @@ int	vop_stdunlock(struct vop_unlock_args
 int	vop_nopoll(struct vop_poll_args *);
 int	vop_stdaccess(struct vop_access_args *ap);
 int	vop_stdaccessx(struct vop_accessx_args *ap);
+int	vop_stdadvise(struct vop_advise_args *ap);
 int	vop_stdadvlock(struct vop_advlock_args *ap);
 int	vop_stdadvlockasync(struct vop_advlockasync_args *ap);
 int	vop_stdadvlockpurge(struct vop_advlockpurge_args *ap);

Modified: head/sys/vm/vm_object.c
==============================================================================
--- head/sys/vm/vm_object.c	Fri Nov  4 03:39:31 2011	(r227069)
+++ head/sys/vm/vm_object.c	Fri Nov  4 04:02:50 2011	(r227070)
@@ -1863,6 +1863,60 @@ skipmemq:
 }
 
 /*
+ *	vm_object_page_cache:
+ *
+ *	For the given object, attempt to move the specified clean
+ *	pages to the cache queue.  If a page is wired for any reason,
+ *	then it will not be changed.  Pages are specified by the given
+ *	range ["start", "end").  As a special case, if "end" is zero,
+ *	then the range extends from "start" to the end of the object.
+ *	Any mappings to the specified pages are removed before the
+ *	pages are moved to the cache queue.
+ *
+ *	This operation should only be performed on objects that
+ *	contain managed pages.
+ *
+ *	The object must be locked.
+ */
+void
+vm_object_page_cache(vm_object_t object, vm_pindex_t start, vm_pindex_t end)
+{
+	struct mtx *mtx, *new_mtx;
+	vm_page_t p, next;
+
+	VM_OBJECT_LOCK_ASSERT(object, MA_OWNED);
+	KASSERT((object->type != OBJT_DEVICE && object->type != OBJT_SG &&
+	    object->type != OBJT_PHYS),
+	    ("vm_object_page_cache: illegal object %p", object));
+	if (object->resident_page_count == 0)
+		return;
+	p = vm_page_find_least(object, start);
+
+	/*
+	 * Here, the variable "p" is either (1) the page with the least pindex
+	 * greater than or equal to the parameter "start" or (2) NULL. 
+	 */
+	mtx = NULL;
+	for (; p != NULL && (p->pindex < end || end == 0); p = next) {
+		next = TAILQ_NEXT(p, listq);
+
+		/*
+		 * Avoid releasing and reacquiring the same page lock.
+		 */
+		new_mtx = vm_page_lockptr(p);
+		if (mtx != new_mtx) {
+			if (mtx != NULL)
+				mtx_unlock(mtx);
+			mtx = new_mtx;
+			mtx_lock(mtx);
+		}
+		vm_page_try_to_cache(p);
+	}
+	if (mtx != NULL)
+		mtx_unlock(mtx);
+}
+
+/*
  *	Populate the specified range of the object with valid pages.  Returns
  *	TRUE if the range is successfully populated and FALSE otherwise.
  *

Modified: head/sys/vm/vm_object.h
==============================================================================
--- head/sys/vm/vm_object.h	Fri Nov  4 03:39:31 2011	(r227069)
+++ head/sys/vm/vm_object.h	Fri Nov  4 04:02:50 2011	(r227070)
@@ -223,6 +223,8 @@ void vm_object_destroy (vm_object_t);
 void vm_object_terminate (vm_object_t);
 void vm_object_set_writeable_dirty (vm_object_t);
 void vm_object_init (void);
+void vm_object_page_cache(vm_object_t object, vm_pindex_t start,
+    vm_pindex_t end);
 void vm_object_page_clean(vm_object_t object, vm_ooffset_t start,
     vm_ooffset_t end, int flags);
 void vm_object_page_remove(vm_object_t object, vm_pindex_t start,

From owner-svn-src-head@FreeBSD.ORG  Fri Nov  4 04:06:32 2011
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 11F97106566B;
	Fri,  4 Nov 2011 04:06:32 +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 007708FC15;
	Fri,  4 Nov 2011 04:06:32 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pA446VmX000491;
	Fri, 4 Nov 2011 04:06:31 GMT (envelope-from jhb@svn.freebsd.org)
Received: (from jhb@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id pA446V7F000479;
	Fri, 4 Nov 2011 04:06:31 GMT (envelope-from jhb@svn.freebsd.org)
Message-Id: <201111040406.pA446V7F000479@svn.freebsd.org>
From: John Baldwin 
Date: Fri, 4 Nov 2011 04:06: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: r227071 - in head/sys: compat/freebsd32 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, 04 Nov 2011 04:06:32 -0000

Author: jhb
Date: Fri Nov  4 04:06:31 2011
New Revision: 227071
URL: http://svn.freebsd.org/changeset/base/227071

Log:
  Regen.

Modified:
  head/sys/compat/freebsd32/freebsd32_proto.h
  head/sys/compat/freebsd32/freebsd32_syscall.h
  head/sys/compat/freebsd32/freebsd32_syscalls.c
  head/sys/compat/freebsd32/freebsd32_sysent.c
  head/sys/compat/freebsd32/freebsd32_systrace_args.c
  head/sys/kern/init_sysent.c
  head/sys/kern/syscalls.c
  head/sys/kern/systrace_args.c
  head/sys/sys/syscall.h
  head/sys/sys/syscall.mk
  head/sys/sys/sysproto.h

Modified: head/sys/compat/freebsd32/freebsd32_proto.h
==============================================================================
--- head/sys/compat/freebsd32/freebsd32_proto.h	Fri Nov  4 04:02:50 2011	(r227070)
+++ head/sys/compat/freebsd32/freebsd32_proto.h	Fri Nov  4 04:06:31 2011	(r227071)
@@ -3,7 +3,7 @@
  *
  * DO NOT EDIT-- this file is automatically generated.
  * $FreeBSD$
- * created from FreeBSD: head/sys/compat/freebsd32/syscalls.master 226364 2011-10-14 11:46:46Z jhb 
+ * created from FreeBSD: head/sys/compat/freebsd32/syscalls.master 227070 2011-11-04 04:02:50Z jhb 
  */
 
 #ifndef _FREEBSD32_SYSPROTO_H_
@@ -580,6 +580,14 @@ struct freebsd32_posix_fallocate_args {
 	char len1_l_[PADL_(uint32_t)]; uint32_t len1; char len1_r_[PADR_(uint32_t)];
 	char len2_l_[PADL_(uint32_t)]; uint32_t len2; char len2_r_[PADR_(uint32_t)];
 };
+struct freebsd32_posix_fadvise_args {
+	char fd_l_[PADL_(int)]; int fd; char fd_r_[PADR_(int)];
+	char offset1_l_[PADL_(uint32_t)]; uint32_t offset1; char offset1_r_[PADR_(uint32_t)];
+	char offset2_l_[PADL_(uint32_t)]; uint32_t offset2; char offset2_r_[PADR_(uint32_t)];
+	char len1_l_[PADL_(uint32_t)]; uint32_t len1; char len1_r_[PADR_(uint32_t)];
+	char len2_l_[PADL_(uint32_t)]; uint32_t len2; char len2_r_[PADR_(uint32_t)];
+	char advice_l_[PADL_(int)]; int advice; char advice_r_[PADR_(int)];
+};
 #if !defined(PAD64_REQUIRED) && defined(__powerpc__)
 #define PAD64_REQUIRED
 #endif
@@ -690,6 +698,7 @@ int	freebsd32_msgctl(struct thread *, st
 int	freebsd32_shmctl(struct thread *, struct freebsd32_shmctl_args *);
 int	freebsd32_pselect(struct thread *, struct freebsd32_pselect_args *);
 int	freebsd32_posix_fallocate(struct thread *, struct freebsd32_posix_fallocate_args *);
+int	freebsd32_posix_fadvise(struct thread *, struct freebsd32_posix_fadvise_args *);
 
 #ifdef COMPAT_43
 
@@ -1065,6 +1074,7 @@ int	freebsd7_freebsd32_shmctl(struct thr
 #define	FREEBSD32_SYS_AUE_freebsd32_shmctl	AUE_SHMCTL
 #define	FREEBSD32_SYS_AUE_freebsd32_pselect	AUE_SELECT
 #define	FREEBSD32_SYS_AUE_freebsd32_posix_fallocate	AUE_NULL
+#define	FREEBSD32_SYS_AUE_freebsd32_posix_fadvise	AUE_NULL
 
 #undef PAD_
 #undef PADL_

Modified: head/sys/compat/freebsd32/freebsd32_syscall.h
==============================================================================
--- head/sys/compat/freebsd32/freebsd32_syscall.h	Fri Nov  4 04:02:50 2011	(r227070)
+++ head/sys/compat/freebsd32/freebsd32_syscall.h	Fri Nov  4 04:06:31 2011	(r227071)
@@ -3,7 +3,7 @@
  *
  * DO NOT EDIT-- this file is automatically generated.
  * $FreeBSD$
- * created from FreeBSD: head/sys/compat/freebsd32/syscalls.master 226364 2011-10-14 11:46:46Z jhb 
+ * created from FreeBSD: head/sys/compat/freebsd32/syscalls.master 227070 2011-11-04 04:02:50Z jhb 
  */
 
 #define	FREEBSD32_SYS_syscall	0
@@ -424,4 +424,5 @@
 #define	FREEBSD32_SYS_rctl_add_rule	528
 #define	FREEBSD32_SYS_rctl_remove_rule	529
 #define	FREEBSD32_SYS_freebsd32_posix_fallocate	530
+#define	FREEBSD32_SYS_freebsd32_posix_fadvise	531
 #define	FREEBSD32_SYS_MAXSYSCALL	532

Modified: head/sys/compat/freebsd32/freebsd32_syscalls.c
==============================================================================
--- head/sys/compat/freebsd32/freebsd32_syscalls.c	Fri Nov  4 04:02:50 2011	(r227070)
+++ head/sys/compat/freebsd32/freebsd32_syscalls.c	Fri Nov  4 04:06:31 2011	(r227071)
@@ -3,7 +3,7 @@
  *
  * DO NOT EDIT-- this file is automatically generated.
  * $FreeBSD$
- * created from FreeBSD: head/sys/compat/freebsd32/syscalls.master 226364 2011-10-14 11:46:46Z jhb 
+ * created from FreeBSD: head/sys/compat/freebsd32/syscalls.master 227070 2011-11-04 04:02:50Z jhb 
  */
 
 const char *freebsd32_syscallnames[] = {
@@ -554,5 +554,5 @@ const char *freebsd32_syscallnames[] = {
 	"rctl_add_rule",			/* 528 = rctl_add_rule */
 	"rctl_remove_rule",			/* 529 = rctl_remove_rule */
 	"freebsd32_posix_fallocate",			/* 530 = freebsd32_posix_fallocate */
-	"#531",			/* 531 = posix_fadvise */
+	"freebsd32_posix_fadvise",			/* 531 = freebsd32_posix_fadvise */
 };

Modified: head/sys/compat/freebsd32/freebsd32_sysent.c
==============================================================================
--- head/sys/compat/freebsd32/freebsd32_sysent.c	Fri Nov  4 04:02:50 2011	(r227070)
+++ head/sys/compat/freebsd32/freebsd32_sysent.c	Fri Nov  4 04:06:31 2011	(r227071)
@@ -3,7 +3,7 @@
  *
  * DO NOT EDIT-- this file is automatically generated.
  * $FreeBSD$
- * created from FreeBSD: head/sys/compat/freebsd32/syscalls.master 226364 2011-10-14 11:46:46Z jhb 
+ * created from FreeBSD: head/sys/compat/freebsd32/syscalls.master 227070 2011-11-04 04:02:50Z jhb 
  */
 
 #include "opt_compat.h"
@@ -591,5 +591,5 @@ struct sysent freebsd32_sysent[] = {
 	{ AS(rctl_add_rule_args), (sy_call_t *)sys_rctl_add_rule, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 528 = rctl_add_rule */
 	{ AS(rctl_remove_rule_args), (sy_call_t *)sys_rctl_remove_rule, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 529 = rctl_remove_rule */
 	{ AS(freebsd32_posix_fallocate_args), (sy_call_t *)freebsd32_posix_fallocate, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 530 = freebsd32_posix_fallocate */
-	{ 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0, 0, SY_THR_ABSENT },			/* 531 = posix_fadvise */
+	{ AS(freebsd32_posix_fadvise_args), (sy_call_t *)freebsd32_posix_fadvise, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 531 = freebsd32_posix_fadvise */
 };

Modified: head/sys/compat/freebsd32/freebsd32_systrace_args.c
==============================================================================
--- head/sys/compat/freebsd32/freebsd32_systrace_args.c	Fri Nov  4 04:02:50 2011	(r227070)
+++ head/sys/compat/freebsd32/freebsd32_systrace_args.c	Fri Nov  4 04:06:31 2011	(r227071)
@@ -3034,6 +3034,18 @@ systrace_args(int sysnum, void *params, 
 		*n_args = 5;
 		break;
 	}
+	/* freebsd32_posix_fadvise */
+	case 531: {
+		struct freebsd32_posix_fadvise_args *p = params;
+		iarg[0] = p->fd; /* int */
+		uarg[1] = p->offset1; /* uint32_t */
+		uarg[2] = p->offset2; /* uint32_t */
+		uarg[3] = p->len1; /* uint32_t */
+		uarg[4] = p->len2; /* uint32_t */
+		iarg[5] = p->advice; /* int */
+		*n_args = 6;
+		break;
+	}
 	default:
 		*n_args = 0;
 		break;
@@ -8093,6 +8105,31 @@ systrace_setargdesc(int sysnum, int ndx,
 			break;
 		};
 		break;
+	/* freebsd32_posix_fadvise */
+	case 531:
+		switch(ndx) {
+		case 0:
+			p = "int";
+			break;
+		case 1:
+			p = "uint32_t";
+			break;
+		case 2:
+			p = "uint32_t";
+			break;
+		case 3:
+			p = "uint32_t";
+			break;
+		case 4:
+			p = "uint32_t";
+			break;
+		case 5:
+			p = "int";
+			break;
+		default:
+			break;
+		};
+		break;
 	default:
 		break;
 	};

Modified: head/sys/kern/init_sysent.c
==============================================================================
--- head/sys/kern/init_sysent.c	Fri Nov  4 04:02:50 2011	(r227070)
+++ head/sys/kern/init_sysent.c	Fri Nov  4 04:06:31 2011	(r227071)
@@ -3,7 +3,7 @@
  *
  * DO NOT EDIT-- this file is automatically generated.
  * $FreeBSD$
- * created from FreeBSD: head/sys/kern/syscalls.master 224987 2011-08-18 22:51:30Z jonathan 
+ * created from FreeBSD: head/sys/kern/syscalls.master 227070 2011-11-04 04:02:50Z jhb 
  */
 
 #include "opt_compat.h"
@@ -565,5 +565,5 @@ struct sysent sysent[] = {
 	{ AS(rctl_add_rule_args), (sy_call_t *)sys_rctl_add_rule, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 528 = rctl_add_rule */
 	{ AS(rctl_remove_rule_args), (sy_call_t *)sys_rctl_remove_rule, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 529 = rctl_remove_rule */
 	{ AS(posix_fallocate_args), (sy_call_t *)sys_posix_fallocate, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 530 = posix_fallocate */
-	{ 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0, 0, SY_THR_ABSENT },			/* 531 = posix_fadvise */
+	{ AS(posix_fadvise_args), (sy_call_t *)sys_posix_fadvise, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 531 = posix_fadvise */
 };

Modified: head/sys/kern/syscalls.c
==============================================================================
--- head/sys/kern/syscalls.c	Fri Nov  4 04:02:50 2011	(r227070)
+++ head/sys/kern/syscalls.c	Fri Nov  4 04:06:31 2011	(r227071)
@@ -3,7 +3,7 @@
  *
  * DO NOT EDIT-- this file is automatically generated.
  * $FreeBSD$
- * created from FreeBSD: head/sys/kern/syscalls.master 224987 2011-08-18 22:51:30Z jonathan 
+ * created from FreeBSD: head/sys/kern/syscalls.master 227070 2011-11-04 04:02:50Z jhb 
  */
 
 const char *syscallnames[] = {
@@ -538,5 +538,5 @@ const char *syscallnames[] = {
 	"rctl_add_rule",			/* 528 = rctl_add_rule */
 	"rctl_remove_rule",			/* 529 = rctl_remove_rule */
 	"posix_fallocate",			/* 530 = posix_fallocate */
-	"#531",			/* 531 = posix_fadvise */
+	"posix_fadvise",			/* 531 = posix_fadvise */
 };

Modified: head/sys/kern/systrace_args.c
==============================================================================
--- head/sys/kern/systrace_args.c	Fri Nov  4 04:02:50 2011	(r227070)
+++ head/sys/kern/systrace_args.c	Fri Nov  4 04:06:31 2011	(r227071)
@@ -3234,6 +3234,16 @@ systrace_args(int sysnum, void *params, 
 		*n_args = 3;
 		break;
 	}
+	/* posix_fadvise */
+	case 531: {
+		struct posix_fadvise_args *p = params;
+		iarg[0] = p->fd; /* int */
+		iarg[1] = p->offset; /* off_t */
+		iarg[2] = p->len; /* off_t */
+		iarg[3] = p->advice; /* int */
+		*n_args = 4;
+		break;
+	}
 	default:
 		*n_args = 0;
 		break;
@@ -8603,6 +8613,25 @@ systrace_setargdesc(int sysnum, int ndx,
 			break;
 		};
 		break;
+	/* posix_fadvise */
+	case 531:
+		switch(ndx) {
+		case 0:
+			p = "int";
+			break;
+		case 1:
+			p = "off_t";
+			break;
+		case 2:
+			p = "off_t";
+			break;
+		case 3:
+			p = "int";
+			break;
+		default:
+			break;
+		};
+		break;
 	default:
 		break;
 	};

Modified: head/sys/sys/syscall.h
==============================================================================
--- head/sys/sys/syscall.h	Fri Nov  4 04:02:50 2011	(r227070)
+++ head/sys/sys/syscall.h	Fri Nov  4 04:06:31 2011	(r227071)
@@ -3,7 +3,7 @@
  *
  * DO NOT EDIT-- this file is automatically generated.
  * $FreeBSD$
- * created from FreeBSD: head/sys/kern/syscalls.master 224987 2011-08-18 22:51:30Z jonathan 
+ * created from FreeBSD: head/sys/kern/syscalls.master 227070 2011-11-04 04:02:50Z jhb 
  */
 
 #define	SYS_syscall	0
@@ -446,4 +446,5 @@
 #define	SYS_rctl_add_rule	528
 #define	SYS_rctl_remove_rule	529
 #define	SYS_posix_fallocate	530
+#define	SYS_posix_fadvise	531
 #define	SYS_MAXSYSCALL	532

Modified: head/sys/sys/syscall.mk
==============================================================================
--- head/sys/sys/syscall.mk	Fri Nov  4 04:02:50 2011	(r227070)
+++ head/sys/sys/syscall.mk	Fri Nov  4 04:06:31 2011	(r227071)
@@ -1,7 +1,7 @@
 # FreeBSD system call names.
 # DO NOT EDIT-- this file is automatically generated.
 # $FreeBSD$
-# created from FreeBSD: head/sys/kern/syscalls.master 224987 2011-08-18 22:51:30Z jonathan 
+# created from FreeBSD: head/sys/kern/syscalls.master 227070 2011-11-04 04:02:50Z jhb 
 MIASM =  \
 	syscall.o \
 	exit.o \
@@ -394,4 +394,5 @@ MIASM =  \
 	rctl_get_limits.o \
 	rctl_add_rule.o \
 	rctl_remove_rule.o \
-	posix_fallocate.o
+	posix_fallocate.o \
+	posix_fadvise.o

Modified: head/sys/sys/sysproto.h
==============================================================================
--- head/sys/sys/sysproto.h	Fri Nov  4 04:02:50 2011	(r227070)
+++ head/sys/sys/sysproto.h	Fri Nov  4 04:06:31 2011	(r227071)
@@ -3,7 +3,7 @@
  *
  * DO NOT EDIT-- this file is automatically generated.
  * $FreeBSD$
- * created from FreeBSD: head/sys/kern/syscalls.master 224987 2011-08-18 22:51:30Z jonathan 
+ * created from FreeBSD: head/sys/kern/syscalls.master 227070 2011-11-04 04:02:50Z jhb 
  */
 
 #ifndef _SYS_SYSPROTO_H_
@@ -1733,6 +1733,12 @@ struct posix_fallocate_args {
 	char offset_l_[PADL_(off_t)]; off_t offset; char offset_r_[PADR_(off_t)];
 	char len_l_[PADL_(off_t)]; off_t len; char len_r_[PADR_(off_t)];
 };
+struct posix_fadvise_args {
+	char fd_l_[PADL_(int)]; int fd; char fd_r_[PADR_(int)];
+	char offset_l_[PADL_(off_t)]; off_t offset; char offset_r_[PADR_(off_t)];
+	char len_l_[PADL_(off_t)]; off_t len; char len_r_[PADR_(off_t)];
+	char advice_l_[PADL_(int)]; int advice; char advice_r_[PADR_(int)];
+};
 int	nosys(struct thread *, struct nosys_args *);
 void	sys_sys_exit(struct thread *, struct sys_exit_args *);
 int	sys_fork(struct thread *, struct fork_args *);
@@ -2109,6 +2115,7 @@ int	sys_rctl_get_limits(struct thread *,
 int	sys_rctl_add_rule(struct thread *, struct rctl_add_rule_args *);
 int	sys_rctl_remove_rule(struct thread *, struct rctl_remove_rule_args *);
 int	sys_posix_fallocate(struct thread *, struct posix_fallocate_args *);
+int	sys_posix_fadvise(struct thread *, struct posix_fadvise_args *);
 
 #ifdef COMPAT_43
 
@@ -2799,6 +2806,7 @@ int	freebsd7_shmctl(struct thread *, str
 #define	SYS_AUE_rctl_add_rule	AUE_NULL
 #define	SYS_AUE_rctl_remove_rule	AUE_NULL
 #define	SYS_AUE_posix_fallocate	AUE_NULL
+#define	SYS_AUE_posix_fadvise	AUE_NULL
 
 #undef PAD_
 #undef PADL_

From owner-svn-src-head@FreeBSD.ORG  Fri Nov  4 04:41:58 2011
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id DB076106566C;
	Fri,  4 Nov 2011 04:41:58 +0000 (UTC) (envelope-from alc@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id CB71B8FC08;
	Fri,  4 Nov 2011 04:41:58 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pA44fwtX001671;
	Fri, 4 Nov 2011 04:41:58 GMT (envelope-from alc@svn.freebsd.org)
Received: (from alc@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id pA44fwGc001669;
	Fri, 4 Nov 2011 04:41:58 GMT (envelope-from alc@svn.freebsd.org)
Message-Id: <201111040441.pA44fwGc001669@svn.freebsd.org>
From: Alan Cox 
Date: Fri, 4 Nov 2011 04:41: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: r227072 - head/sys/vm
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 04 Nov 2011 04:41:59 -0000

Author: alc
Date: Fri Nov  4 04:41:58 2011
New Revision: 227072
URL: http://svn.freebsd.org/changeset/base/227072

Log:
  Simplify the implementation of the failure case in kmem_alloc_attr().

Modified:
  head/sys/vm/vm_contig.c

Modified: head/sys/vm/vm_contig.c
==============================================================================
--- head/sys/vm/vm_contig.c	Fri Nov  4 04:06:31 2011	(r227071)
+++ head/sys/vm/vm_contig.c	Fri Nov  4 04:41:58 2011	(r227072)
@@ -258,8 +258,8 @@ kmem_alloc_attr(vm_map_t map, vm_size_t 
 retry:
 		m = vm_phys_alloc_contig(1, low, high, PAGE_SIZE, 0);
 		if (m == NULL) {
+			VM_OBJECT_UNLOCK(object);
 			if (tries < ((flags & M_NOWAIT) != 0 ? 1 : 3)) {
-				VM_OBJECT_UNLOCK(object);
 				vm_map_unlock(map);
 				vm_contig_grow_cache(tries, low, high);
 				vm_map_lock(map);
@@ -267,13 +267,12 @@ retry:
 				tries++;
 				goto retry;
 			}
-			while (i != 0) {
-				i -= PAGE_SIZE;
-				m = vm_page_lookup(object, OFF_TO_IDX(offset +
-				    i));
-				vm_page_free(m);
-			}
-			VM_OBJECT_UNLOCK(object);
+			/*
+			 * Since the pages that were allocated by any previous
+			 * iterations of this loop are not busy, they can be
+			 * freed by vm_object_page_remove(), which is called
+			 * by vm_map_delete().
+			 */
 			vm_map_delete(map, addr, addr + size);
 			vm_map_unlock(map);
 			return (0);

From owner-svn-src-head@FreeBSD.ORG  Fri Nov  4 07:23:57 2011
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 4153E1065672
	for ; Fri,  4 Nov 2011 07:23:57 +0000 (UTC)
	(envelope-from villa.alberto@gmail.com)
Received: from mail-wy0-f182.google.com (mail-wy0-f182.google.com
	[74.125.82.182])
	by mx1.freebsd.org (Postfix) with ESMTP id 4E3698FC0A
	for ; Fri,  4 Nov 2011 07:23:55 +0000 (UTC)
Received: by wyg36 with SMTP id 36so2745340wyg.13
	for ; Fri, 04 Nov 2011 00:23:55 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma;
	h=sender:from:organization:to:subject:date:user-agent:cc:references
	:in-reply-to:mime-version:content-type:content-transfer-encoding
	:message-id; bh=/LeCppGW+80YnxdwgVwchqcB5g/Ir5yKJAs3wpIGgaI=;
	b=TTW+pp0/stoUOUW9c8asdakA0Bi1Up+zLfBAb+mDMaCvf9hwkgofhyf3PvDPxIVdqt
	x6frrhFkFjKDGd6b14TAO4fxlq5A0jTGpUdxERPif+Bnh4EjhflBsWsWw5L9YlXvT7VN
	fc8SwNcyOVyU391tOXcGcUx3/PqzFel//EJBU=
Received: by 10.227.59.207 with SMTP id m15mr16515241wbh.12.1320391435120;
	Fri, 04 Nov 2011 00:23:55 -0700 (PDT)
Received: from woodstock.peanuts (wifinat-16.polito.it. [130.192.232.16])
	by mx.google.com with ESMTPS id fr4sm14470220wbb.0.2011.11.04.00.23.54
	(version=SSLv3 cipher=OTHER); Fri, 04 Nov 2011 00:23:54 -0700 (PDT)
Sender: Alberto Villa 
From: Alberto Villa 
Organization: The FreeBSD Project
To: svn-src-head@freebsd.org
Date: Fri, 4 Nov 2011 08:23:47 +0100
User-Agent: KMail/1.13.7 (FreeBSD/9.0-RC1; KDE/4.7.2; amd64; ; )
References: <201111040402.pA442oYZ000317@svn.freebsd.org>
In-Reply-To: <201111040402.pA442oYZ000317@svn.freebsd.org>
MIME-Version: 1.0
Content-Type: multipart/signed; boundary="nextPart2910288.EjliSkT16r";
	protocol="application/pgp-signature"; micalg=pgp-sha1
Content-Transfer-Encoding: 7bit
Message-Id: <201111040823.52084.avilla@freebsd.org>
Cc: svn-src-all@freebsd.org, src-committers@freebsd.org,
	John Baldwin 
Subject: Re: svn commit: r227070 - in head: lib/libc/sys
	sys/compat/freebsd32 sys/kern sys/sys sys/vm
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 04 Nov 2011 07:23:57 -0000

--nextPart2910288.EjliSkT16r
Content-Type: Text/Plain;
  charset="utf-8"
Content-Transfer-Encoding: quoted-printable

On Friday 04 November 2011 05:02:50 John Baldwin wrote:
> Author: jhb
> Date: Fri Nov  4 04:02:50 2011
> New Revision: 227070
> URL: http://svn.freebsd.org/changeset/base/227070
>=20
> Log:
>   Add the posix_fadvise(2) system call.

Shouldn't you define _POSIX_ADVISORY_INFO to 200112L in=20
sys/sys/unistd.h?
=2D-=20
Alberto Villa, FreeBSD committer 
http://people.FreeBSD.org/~avilla

Without adventure, civilization is in full decay.
		-- Alfred North Whitehead

--nextPart2910288.EjliSkT16r
Content-Type: application/pgp-signature; name=signature.asc 
Content-Description: This is a digitally signed message part.

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

iJwEAAECAAYFAk6zkwcACgkQ3xiC6kQ1CovzDAP+JjyKsiSDlrq99oGdwdmkklno
+Cy+JxVFzK7CZL83HiQT3ccuMl6dn9M9DikoeH6ubvkBMcaN3kyjK+GAazJAc3pe
n+WFB8EMujslpwbNiJ5H+hYarsRePbBUvu5epPVu02L+TwpOQHHvLNEpwpaAC2cE
TCgPal1HGMYhxa3Hqv0=
=9bxn
-----END PGP SIGNATURE-----

--nextPart2910288.EjliSkT16r--

From owner-svn-src-head@FreeBSD.ORG  Fri Nov  4 09:19:19 2011
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 1295F1065673;
	Fri,  4 Nov 2011 09:19:19 +0000 (UTC)
	(envelope-from hselasky@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 026EB8FC13;
	Fri,  4 Nov 2011 09:19:19 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pA49JIBi010242;
	Fri, 4 Nov 2011 09:19:18 GMT (envelope-from hselasky@svn.freebsd.org)
Received: (from hselasky@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id pA49JIIu010240;
	Fri, 4 Nov 2011 09:19:18 GMT (envelope-from hselasky@svn.freebsd.org)
Message-Id: <201111040919.pA49JIIu010240@svn.freebsd.org>
From: Hans Petter Selasky 
Date: Fri, 4 Nov 2011 09:19: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: r227075 - 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: Fri, 04 Nov 2011 09:19:19 -0000

Author: hselasky
Date: Fri Nov  4 09:19:18 2011
New Revision: 227075
URL: http://svn.freebsd.org/changeset/base/227075

Log:
  Fix for panic at USB controller attach failure during cold boot.
  
  Reported by:	Jan Henrik Sylvester, Xin LI and more.
  MFC after:	3 days

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

Modified: head/sys/dev/usb/usb_process.c
==============================================================================
--- head/sys/dev/usb/usb_process.c	Fri Nov  4 06:56:59 2011	(r227074)
+++ head/sys/dev/usb/usb_process.c	Fri Nov  4 09:19:18 2011	(r227075)
@@ -67,11 +67,13 @@ static int usb_pcount;
 #define	USB_THREAD_CREATE(f, s, p, ...) \
 		kproc_kthread_add((f), (s), &usbproc, (p), RFHIGHPID, \
 		    0, "usb", __VA_ARGS__)
+#define	USB_THREAD_SUSPEND_CHECK() kthread_suspend_check()
 #define	USB_THREAD_SUSPEND(p)   kthread_suspend(p,0)
 #define	USB_THREAD_EXIT(err)	kthread_exit()
 #else
 #define	USB_THREAD_CREATE(f, s, p, ...) \
 		kthread_create((f), (s), (p), RFHIGHPID, 0, __VA_ARGS__)
+#define	USB_THREAD_SUSPEND_CHECK() kthread_suspend_check()
 #define	USB_THREAD_SUSPEND(p)   kthread_suspend(p,0)
 #define	USB_THREAD_EXIT(err)	kthread_exit(err)
 #endif
@@ -98,6 +100,9 @@ usb_process(void *arg)
 	struct usb_proc_msg *pm;
 	struct thread *td;
 
+	/* in case of attach error, check for suspended */
+	USB_THREAD_SUSPEND_CHECK();
+
 	/* adjust priority */
 	td = curthread;
 	thread_lock(td);

From owner-svn-src-head@FreeBSD.ORG  Fri Nov  4 13:32:14 2011
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 26CDC106564A;
	Fri,  4 Nov 2011 13:32:14 +0000 (UTC)
	(envelope-from adrian@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 1720B8FC15;
	Fri,  4 Nov 2011 13:32:14 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pA4DWDZB020100;
	Fri, 4 Nov 2011 13:32:13 GMT (envelope-from adrian@svn.freebsd.org)
Received: (from adrian@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id pA4DWDOG020098;
	Fri, 4 Nov 2011 13:32:13 GMT (envelope-from adrian@svn.freebsd.org)
Message-Id: <201111041332.pA4DWDOG020098@svn.freebsd.org>
From: Adrian Chadd 
Date: Fri, 4 Nov 2011 13:32:13 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r227080 - head/sys/dev/ath/ath_hal/ar5416
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 04 Nov 2011 13:32:14 -0000

Author: adrian
Date: Fri Nov  4 13:32:13 2011
New Revision: 227080
URL: http://svn.freebsd.org/changeset/base/227080

Log:
  Call the correct chipset power routine when disabling the AR5416 and later NICs.

Modified:
  head/sys/dev/ath/ath_hal/ar5416/ar5416_reset.c

Modified: head/sys/dev/ath/ath_hal/ar5416/ar5416_reset.c
==============================================================================
--- head/sys/dev/ath/ath_hal/ar5416/ar5416_reset.c	Fri Nov  4 13:31:03 2011	(r227079)
+++ head/sys/dev/ath/ath_hal/ar5416/ar5416_reset.c	Fri Nov  4 13:32:13 2011	(r227080)
@@ -1178,7 +1178,7 @@ ar5416GetRfgain(struct ath_hal *ah)
 HAL_BOOL
 ar5416Disable(struct ath_hal *ah)
 {
-	if (!ar5212SetPowerMode(ah, HAL_PM_AWAKE, AH_TRUE))
+	if (!ar5416SetPowerMode(ah, HAL_PM_AWAKE, AH_TRUE))
 		return AH_FALSE;
 	if (! ar5416SetResetReg(ah, HAL_RESET_COLD))
 		return AH_FALSE;

From owner-svn-src-head@FreeBSD.ORG  Fri Nov  4 13:36:02 2011
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id D386E106564A;
	Fri,  4 Nov 2011 13:36:02 +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 C0DB68FC12;
	Fri,  4 Nov 2011 13:36:02 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pA4Da24g020295;
	Fri, 4 Nov 2011 13:36:02 GMT (envelope-from ed@svn.freebsd.org)
Received: (from ed@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id pA4Da2M8020263;
	Fri, 4 Nov 2011 13:36:02 GMT (envelope-from ed@svn.freebsd.org)
Message-Id: <201111041336.pA4Da2M8020263@svn.freebsd.org>
From: Ed Schouten 
Date: Fri, 4 Nov 2011 13:36: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: r227081 - in head/sbin: atm/atmconfig badsect
	camcontrol ccdconfig devfs dmesg dumpfs fdisk ffsinfo fsck
	fsck_msdosfs fsirand growfs init mount mount_cd9660
	mount_nullfs mount_udf natd ...
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: 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, 04 Nov 2011 13:36:02 -0000

Author: ed
Date: Fri Nov  4 13:36:02 2011
New Revision: 227081
URL: http://svn.freebsd.org/changeset/base/227081

Log:
  Add missing static keywords for global variables to tools in sbin/.
  
  These tools declare global variables without using the static keyword,
  even though their use is limited to a single C-file, or without placing
  an extern declaration of them in the proper header file.

Modified:
  head/sbin/atm/atmconfig/atmconfig_device.c
  head/sbin/atm/atmconfig/diag.c
  head/sbin/atm/atmconfig/main.c
  head/sbin/badsect/badsect.c
  head/sbin/camcontrol/camcontrol.c
  head/sbin/ccdconfig/ccdconfig.c
  head/sbin/devfs/rule.c
  head/sbin/dmesg/dmesg.c
  head/sbin/dumpfs/dumpfs.c
  head/sbin/fdisk/fdisk.c
  head/sbin/ffsinfo/ffsinfo.c
  head/sbin/fsck/fsck.c
  head/sbin/fsck/preen.c
  head/sbin/fsck_msdosfs/dir.c
  head/sbin/fsirand/fsirand.c
  head/sbin/growfs/growfs.c
  head/sbin/init/init.c
  head/sbin/mount/mount.c
  head/sbin/mount/mount_fs.c
  head/sbin/mount_cd9660/mount_cd9660.c
  head/sbin/mount_nullfs/mount_nullfs.c
  head/sbin/mount_udf/mount_udf.c
  head/sbin/natd/natd.c
  head/sbin/newfs/mkfs.c
  head/sbin/newfs/newfs.h
  head/sbin/rcorder/rcorder.c
  head/sbin/recoverdisk/recoverdisk.c
  head/sbin/shutdown/shutdown.c
  head/sbin/swapon/swapon.c
  head/sbin/tunefs/tunefs.c
  head/sbin/umount/umount.c

Modified: head/sbin/atm/atmconfig/atmconfig_device.c
==============================================================================
--- head/sbin/atm/atmconfig/atmconfig_device.c	Fri Nov  4 13:32:13 2011	(r227080)
+++ head/sbin/atm/atmconfig/atmconfig_device.c	Fri Nov  4 13:36:02 2011	(r227081)
@@ -103,7 +103,7 @@ static struct atmhw_list atmhw_list;
 /*
  * Read ATM hardware table
  */
-const struct snmp_table atmhw_table = {
+static const struct snmp_table atmhw_table = {
 	OIDX_begemotAtmHWTable,
 	OIDX_begemotAtmIfTableLastChange, 2,
 	sizeof(struct atmhw),

Modified: head/sbin/atm/atmconfig/diag.c
==============================================================================
--- head/sbin/atm/atmconfig/diag.c	Fri Nov  4 13:32:13 2011	(r227080)
+++ head/sbin/atm/atmconfig/diag.c	Fri Nov  4 13:36:02 2011	(r227081)
@@ -57,7 +57,7 @@ static void diag_phy_print(int, char *[]
 static void diag_phy_stats(int, char *[]);
 static void diag_stats(int, char *[]);
 
-const struct cmdtab diag_phy_tab[] = {
+static const struct cmdtab diag_phy_tab[] = {
 	{ "show",	NULL, 		diag_phy_show },
 	{ "set",	NULL, 		diag_phy_set },
 	{ "stats",	NULL,		diag_phy_stats },

Modified: head/sbin/atm/atmconfig/main.c
==============================================================================
--- head/sbin/atm/atmconfig/main.c	Fri Nov  4 13:32:13 2011	(r227080)
+++ head/sbin/atm/atmconfig/main.c	Fri Nov  4 13:36:02 2011	(r227081)
@@ -48,7 +48,7 @@ __FBSDID("$FreeBSD$");
 #include "private.h"
 
 /* verbosity level */
-int verbose;
+static int verbose;
 
 /* notitle option */
 static int notitle;

Modified: head/sbin/badsect/badsect.c
==============================================================================
--- head/sbin/badsect/badsect.c	Fri Nov  4 13:32:13 2011	(r227080)
+++ head/sbin/badsect/badsect.c	Fri Nov  4 13:36:02 2011	(r227081)
@@ -71,9 +71,9 @@ __FBSDID("$FreeBSD$");
 
 #define sblock	disk.d_fs
 #define	acg	disk.d_cg
-struct	uufsd disk;
-struct	fs *fs = &sblock;
-int	errs;
+static struct	uufsd disk;
+static struct	fs *fs = &sblock;
+static int	errs;
 
 int	chkuse(daddr_t, int);
 

Modified: head/sbin/camcontrol/camcontrol.c
==============================================================================
--- head/sbin/camcontrol/camcontrol.c	Fri Nov  4 13:32:13 2011	(r227080)
+++ head/sbin/camcontrol/camcontrol.c	Fri Nov  4 13:36:02 2011	(r227081)
@@ -140,7 +140,7 @@ static const char smppc_opts[] = "a:A:d:
 static const char smpphylist_opts[] = "lq";
 #endif
 
-struct camcontrol_opts option_table[] = {
+static struct camcontrol_opts option_table[] = {
 #ifndef MINIMALISTIC
 	{"tur", CAM_CMD_TUR, CAM_ARG_NONE, NULL},
 	{"inquiry", CAM_CMD_INQUIRY, CAM_ARG_NONE, "DSR"},
@@ -207,8 +207,8 @@ struct cam_devlist {
 	path_id_t path_id;
 };
 
-cam_cmdmask cmdlist;
-cam_argmask arglist;
+static cam_cmdmask cmdlist;
+static cam_argmask arglist;
 
 camcontrol_optret getoption(struct camcontrol_opts *table, char *arg,
 			    uint32_t *cmdnum, cam_argmask *argnum,
@@ -4646,7 +4646,7 @@ bailout:
 	return (error);
 }
 
-struct camcontrol_opts phy_ops[] = {
+static struct camcontrol_opts phy_ops[] = {
 	{"nop", SMP_PC_PHY_OP_NOP, CAM_ARG_NONE, NULL},
 	{"linkreset", SMP_PC_PHY_OP_LINK_RESET, CAM_ARG_NONE, NULL},
 	{"hardreset", SMP_PC_PHY_OP_HARD_RESET, CAM_ARG_NONE, NULL},

Modified: head/sbin/ccdconfig/ccdconfig.c
==============================================================================
--- head/sbin/ccdconfig/ccdconfig.c	Fri Nov  4 13:32:13 2011	(r227080)
+++ head/sbin/ccdconfig/ccdconfig.c	Fri Nov  4 13:36:02 2011	(r227081)
@@ -59,7 +59,7 @@ static	int lineno = 0;
 static	int verbose = 0;
 static	const char *ccdconf = _PATH_CCDCONF;
 
-struct	flagval {
+static struct flagval {
 	const char	*fv_flag;
 	int		fv_val;
 } flagvaltab[] = {

Modified: head/sbin/devfs/rule.c
==============================================================================
--- head/sbin/devfs/rule.c	Fri Nov  4 13:32:13 2011	(r227080)
+++ head/sbin/devfs/rule.c	Fri Nov  4 13:36:02 2011	(r227081)
@@ -76,7 +76,7 @@ static struct intstr ist_type[] = {
 	{ NULL,			-1 }
 };
 
-devfs_rsnum in_rsnum;
+static devfs_rsnum in_rsnum;
 
 int
 rule_main(int ac, char **av)

Modified: head/sbin/dmesg/dmesg.c
==============================================================================
--- head/sbin/dmesg/dmesg.c	Fri Nov  4 13:32:13 2011	(r227080)
+++ head/sbin/dmesg/dmesg.c	Fri Nov  4 13:36:02 2011	(r227081)
@@ -60,11 +60,9 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 
-char s_msgbufp[] = "_msgbufp";
-
-struct nlist nl[] = {
+static struct nlist nl[] = {
 #define	X_MSGBUF	0
-	{ s_msgbufp, 0, 0, 0, 0 },
+	{ "_msgbufp", 0, 0, 0, 0 },
 	{ NULL, 0, 0, 0, 0 },
 };
 

Modified: head/sbin/dumpfs/dumpfs.c
==============================================================================
--- head/sbin/dumpfs/dumpfs.c	Fri Nov  4 13:32:13 2011	(r227080)
+++ head/sbin/dumpfs/dumpfs.c	Fri Nov  4 13:36:02 2011	(r227081)
@@ -77,7 +77,7 @@ static const char rcsid[] =
 #define	afs	disk.d_fs
 #define	acg	disk.d_cg
 
-struct uufsd disk;
+static struct uufsd disk;
 
 int	dumpfs(const char *);
 int	dumpfsid(void);

Modified: head/sbin/fdisk/fdisk.c
==============================================================================
--- head/sbin/fdisk/fdisk.c	Fri Nov  4 13:32:13 2011	(r227080)
+++ head/sbin/fdisk/fdisk.c	Fri Nov  4 13:36:02 2011	(r227081)
@@ -47,7 +47,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 
-int iotest;
+static int iotest;
 
 #define NO_DISK_SECTORS ((u_int32_t)-1)
 #define NO_TRACK_CYLINDERS 1023

Modified: head/sbin/ffsinfo/ffsinfo.c
==============================================================================
--- head/sbin/ffsinfo/ffsinfo.c	Fri Nov  4 13:32:13 2011	(r227080)
+++ head/sbin/ffsinfo/ffsinfo.c	Fri Nov  4 13:36:02 2011	(r227081)
@@ -79,7 +79,7 @@ static const char rcsid[] =
 int	_dbg_lvl_ = (DL_INFO); /* DL_TRC */
 #endif /* FS_DEBUG */
 
-struct uufsd disk;
+static struct uufsd disk;
 
 #define sblock disk.d_fs
 #define acg    disk.d_cg

Modified: head/sbin/fsck/fsck.c
==============================================================================
--- head/sbin/fsck/fsck.c	Fri Nov  4 13:32:13 2011	(r227080)
+++ head/sbin/fsck/fsck.c	Fri Nov  4 13:36:02 2011	(r227081)
@@ -65,7 +65,7 @@ __FBSDID("$FreeBSD$");
 
 static enum { IN_LIST, NOT_IN_LIST } which = NOT_IN_LIST;
 
-TAILQ_HEAD(fstypelist, entry) opthead, selhead;
+static TAILQ_HEAD(fstypelist, entry) opthead, selhead;
 
 struct entry {
 	char *type;

Modified: head/sbin/fsck/preen.c
==============================================================================
--- head/sbin/fsck/preen.c	Fri Nov  4 13:32:13 2011	(r227080)
+++ head/sbin/fsck/preen.c	Fri Nov  4 13:36:02 2011	(r227081)
@@ -62,7 +62,7 @@ struct partentry {
 	char		  	*p_type;	/* file system type */
 };
 
-TAILQ_HEAD(part, partentry) badh;
+static TAILQ_HEAD(part, partentry) badh;
 
 struct diskentry {
 	TAILQ_ENTRY(diskentry) 	    d_entries;
@@ -71,7 +71,7 @@ struct diskentry {
 	int			    d_pid;	/* 0 or pid of fsck proc */
 };
 
-TAILQ_HEAD(disk, diskentry) diskh;
+static TAILQ_HEAD(disk, diskentry) diskh;
 
 static int nrun = 0, ndisks = 0;
 

Modified: head/sbin/fsck_msdosfs/dir.c
==============================================================================
--- head/sbin/fsck_msdosfs/dir.c	Fri Nov  4 13:32:13 2011	(r227080)
+++ head/sbin/fsck_msdosfs/dir.c	Fri Nov  4 13:36:02 2011	(r227081)
@@ -153,7 +153,7 @@ freeDirTodo(struct dirTodoNode *dt)
 /*
  * The stack of unread directories
  */
-struct dirTodoNode *pendingDirectories = NULL;
+static struct dirTodoNode *pendingDirectories = NULL;
 
 /*
  * Return the full pathname for a directory entry.

Modified: head/sbin/fsirand/fsirand.c
==============================================================================
--- head/sbin/fsirand/fsirand.c	Fri Nov  4 13:32:13 2011	(r227080)
+++ head/sbin/fsirand/fsirand.c	Fri Nov  4 13:36:02 2011	(r227081)
@@ -60,7 +60,7 @@ int fsirand(char *);
  */
 static int sblock_try[] = SBLOCKSEARCH;
 
-int printonly = 0, force = 0, ignorelabel = 0;
+static int printonly = 0, force = 0, ignorelabel = 0;
 
 int
 main(int argc, char *argv[])

Modified: head/sbin/growfs/growfs.c
==============================================================================
--- head/sbin/growfs/growfs.c	Fri Nov  4 13:32:13 2011	(r227080)
+++ head/sbin/growfs/growfs.c	Fri Nov  4 13:36:02 2011	(r227081)
@@ -116,7 +116,7 @@ union dinode {
 	} while (0)
 static ufs2_daddr_t 	inoblk;			/* inode block address */
 static char		inobuf[MAXBSIZE];	/* inode block */
-ino_t			maxino;			/* last valid inode */
+static ino_t		maxino;			/* last valid inode */
 static int		unlabeled;     /* unlabeled partition, e.g. vinum volume etc. */
 
 /*

Modified: head/sbin/init/init.c
==============================================================================
--- head/sbin/init/init.c	Fri Nov  4 13:32:13 2011	(r227080)
+++ head/sbin/init/init.c	Fri Nov  4 13:36:02 2011	(r227081)
@@ -126,14 +126,14 @@ static state_func_t death_single(void);
 
 static state_func_t run_script(const char *);
 
-enum { AUTOBOOT, FASTBOOT } runcom_mode = AUTOBOOT;
+static enum { AUTOBOOT, FASTBOOT } runcom_mode = AUTOBOOT;
 #define FALSE	0
 #define TRUE	1
 
-int Reboot = FALSE;
-int howto = RB_AUTOBOOT;
+static int Reboot = FALSE;
+static int howto = RB_AUTOBOOT;
 
-int devfs;
+static int devfs;
 
 static void transition(state_t);
 static state_t requested_transition;

Modified: head/sbin/mount/mount.c
==============================================================================
--- head/sbin/mount/mount.c	Fri Nov  4 13:32:13 2011	(r227080)
+++ head/sbin/mount/mount.c	Fri Nov  4 13:36:02 2011	(r227081)
@@ -66,7 +66,7 @@ __FBSDID("$FreeBSD$");
 #define MOUNT_META_OPTION_FSTAB		"fstab"
 #define MOUNT_META_OPTION_CURRENT	"current"
 
-int debug, fstab_style, verbose;
+static int debug, fstab_style, verbose;
 
 struct cpa {
 	char	**a;

Modified: head/sbin/mount/mount_fs.c
==============================================================================
--- head/sbin/mount/mount_fs.c	Fri Nov  4 13:32:13 2011	(r227080)
+++ head/sbin/mount/mount_fs.c	Fri Nov  4 13:36:02 2011	(r227081)
@@ -58,7 +58,7 @@ static const char rcsid[] =
 #include "extern.h"
 #include "mntopts.h"
 
-struct mntopt mopts[] = {
+static struct mntopt mopts[] = {
 	MOPT_STDOPTS,
 	MOPT_END
 };

Modified: head/sbin/mount_cd9660/mount_cd9660.c
==============================================================================
--- head/sbin/mount_cd9660/mount_cd9660.c	Fri Nov  4 13:32:13 2011	(r227080)
+++ head/sbin/mount_cd9660/mount_cd9660.c	Fri Nov  4 13:36:02 2011	(r227081)
@@ -68,7 +68,7 @@ static const char rcsid[] =
 
 #include "mntopts.h"
 
-struct mntopt mopts[] = {
+static struct mntopt mopts[] = {
 	MOPT_STDOPTS,
 	MOPT_UPDATE,
 	MOPT_END

Modified: head/sbin/mount_nullfs/mount_nullfs.c
==============================================================================
--- head/sbin/mount_nullfs/mount_nullfs.c	Fri Nov  4 13:32:13 2011	(r227080)
+++ head/sbin/mount_nullfs/mount_nullfs.c	Fri Nov  4 13:36:02 2011	(r227081)
@@ -57,7 +57,7 @@ static const char rcsid[] =
 
 #include "mntopts.h"
 
-struct mntopt mopts[] = {
+static struct mntopt mopts[] = {
 	MOPT_STDOPTS,
 	MOPT_END
 };

Modified: head/sbin/mount_udf/mount_udf.c
==============================================================================
--- head/sbin/mount_udf/mount_udf.c	Fri Nov  4 13:32:13 2011	(r227080)
+++ head/sbin/mount_udf/mount_udf.c	Fri Nov  4 13:36:02 2011	(r227081)
@@ -61,7 +61,7 @@
 
 #include "mntopts.h"
 
-struct mntopt mopts[] = {
+static struct mntopt mopts[] = {
 	MOPT_STDOPTS,
 	MOPT_UPDATE,
 	MOPT_END

Modified: head/sbin/natd/natd.c
==============================================================================
--- head/sbin/natd/natd.c	Fri Nov  4 13:32:13 2011	(r227080)
+++ head/sbin/natd/natd.c	Fri Nov  4 13:36:02 2011	(r227081)
@@ -71,8 +71,8 @@ struct instance {
 static LIST_HEAD(, instance) root = LIST_HEAD_INITIALIZER(root);
 
 struct libalias *mla;
-struct instance *mip;
-int ninstance = 1;
+static struct instance *mip;
+static int ninstance = 1;
 
 /* 
  * Default values for input and output

Modified: head/sbin/newfs/mkfs.c
==============================================================================
--- head/sbin/newfs/mkfs.c	Fri Nov  4 13:32:13 2011	(r227080)
+++ head/sbin/newfs/mkfs.c	Fri Nov  4 13:36:02 2011	(r227081)
@@ -804,7 +804,7 @@ initcg(int cylno, time_t utime)
  */
 #define ROOTLINKCNT 3
 
-struct direct root_dir[] = {
+static struct direct root_dir[] = {
 	{ ROOTINO, sizeof(struct direct), DT_DIR, 1, "." },
 	{ ROOTINO, sizeof(struct direct), DT_DIR, 2, ".." },
 	{ ROOTINO + 1, sizeof(struct direct), DT_DIR, 5, ".snap" },
@@ -812,7 +812,7 @@ struct direct root_dir[] = {
 
 #define SNAPLINKCNT 2
 
-struct direct snap_dir[] = {
+static struct direct snap_dir[] = {
 	{ ROOTINO + 1, sizeof(struct direct), DT_DIR, 1, "." },
 	{ ROOTINO, sizeof(struct direct), DT_DIR, 2, ".." },
 };

Modified: head/sbin/newfs/newfs.h
==============================================================================
--- head/sbin/newfs/newfs.h	Fri Nov  4 13:32:13 2011	(r227080)
+++ head/sbin/newfs/newfs.h	Fri Nov  4 13:36:02 2011	(r227081)
@@ -81,6 +81,7 @@ extern int	Nflag;		/* run mkfs without w
 extern int	Oflag;		/* build UFS1 format file system */
 extern int	Rflag;		/* regression test */
 extern int	Uflag;		/* enable soft updates for file system */
+extern int	jflag;		/* enable soft updates journaling for filesys */
 extern int	Xflag;		/* exit in middle of newfs for testing */
 extern int	Jflag;		/* enable gjournal for file system */
 extern int	lflag;		/* enable multilabel MAC for file system */

Modified: head/sbin/rcorder/rcorder.c
==============================================================================
--- head/sbin/rcorder/rcorder.c	Fri Nov  4 13:32:13 2011	(r227080)
+++ head/sbin/rcorder/rcorder.c	Fri Nov  4 13:36:02 2011	(r227081)
@@ -73,9 +73,9 @@ int debug = 0;
 #define KEYWORDS_STR	"# KEYWORDS:"
 #define KEYWORDS_LEN	(sizeof(KEYWORDS_STR) - 1)
 
-int exit_code;
-int file_count;
-char **file_list;
+static int exit_code;
+static int file_count;
+static char **file_list;
 
 typedef int bool;
 #define TRUE 1

Modified: head/sbin/recoverdisk/recoverdisk.c
==============================================================================
--- head/sbin/recoverdisk/recoverdisk.c	Fri Nov  4 13:32:13 2011	(r227080)
+++ head/sbin/recoverdisk/recoverdisk.c	Fri Nov  4 13:36:02 2011	(r227081)
@@ -24,7 +24,7 @@
 #include 
 #include 
 
-volatile sig_atomic_t aborting = 0;
+static volatile sig_atomic_t aborting = 0;
 static size_t bigsize = 1024 * 1024;
 static size_t medsize;
 static size_t minsize = 512;

Modified: head/sbin/shutdown/shutdown.c
==============================================================================
--- head/sbin/shutdown/shutdown.c	Fri Nov  4 13:32:13 2011	(r227080)
+++ head/sbin/shutdown/shutdown.c	Fri Nov  4 13:36:02 2011	(r227081)
@@ -67,7 +67,7 @@ __FBSDID("$FreeBSD$");
 #define	M		*60
 #define	S		*1
 #define	NOLOG_TIME	5*60
-struct interval {
+static struct interval {
 	int timeleft, timetowait;
 } tlist[] = {
 	{ 10 H,  5 H },

Modified: head/sbin/swapon/swapon.c
==============================================================================
--- head/sbin/swapon/swapon.c	Fri Nov  4 13:32:13 2011	(r227080)
+++ head/sbin/swapon/swapon.c	Fri Nov  4 13:36:02 2011	(r227081)
@@ -60,7 +60,7 @@ static void usage(void);
 static int swap_on_off(char *name, int ignoreebusy);
 static void swaplist(int, int, int);
 
-enum { SWAPON, SWAPOFF, SWAPCTL } orig_prog, which_prog = SWAPCTL;
+static enum { SWAPON, SWAPOFF, SWAPCTL } orig_prog, which_prog = SWAPCTL;
 
 int
 main(int argc, char **argv)

Modified: head/sbin/tunefs/tunefs.c
==============================================================================
--- head/sbin/tunefs/tunefs.c	Fri Nov  4 13:32:13 2011	(r227080)
+++ head/sbin/tunefs/tunefs.c	Fri Nov  4 13:36:02 2011	(r227081)
@@ -70,7 +70,7 @@ __FBSDID("$FreeBSD$");
 /* the optimization warning string template */
 #define	OPTWARN	"should optimize for %s with minfree %s %d%%"
 
-struct uufsd disk;
+static struct uufsd disk;
 #define	sblock disk.d_fs
 
 void usage(void);
@@ -553,7 +553,7 @@ sbdirty(void)
 	disk.d_fs.fs_clean = 0;
 }
 
-int blocks;
+static int blocks;
 static char clrbuf[MAXBSIZE];
 
 static ufs2_daddr_t

Modified: head/sbin/umount/umount.c
==============================================================================
--- head/sbin/umount/umount.c	Fri Nov  4 13:32:13 2011	(r227080)
+++ head/sbin/umount/umount.c	Fri Nov  4 13:36:02 2011	(r227081)
@@ -63,9 +63,9 @@ static const char rcsid[] =
 
 typedef enum { FIND, REMOVE, CHECKUNIQUE } dowhat;
 
-struct  addrinfo *nfshost_ai = NULL;
-int	fflag, vflag;
-char   *nfshost;
+static struct addrinfo *nfshost_ai = NULL;
+static int	fflag, vflag;
+static char	*nfshost;
 
 struct statfs *checkmntlist(char *);
 int	 checkvfsname (const char *, char **);

From owner-svn-src-head@FreeBSD.ORG  Fri Nov  4 13:54:22 2011
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: by hub.freebsd.org (Postfix, from userid 1033)
	id 9C6291065674; Fri,  4 Nov 2011 13:54:22 +0000 (UTC)
Date: Fri, 4 Nov 2011 13:54:22 +0000
From: Alexey Dokuchaev 
To: Ed Schouten 
Message-ID: <20111104135422.GA26521@FreeBSD.org>
References: <201111041336.pA4Da2M8020263@svn.freebsd.org>
Mime-Version: 1.0
Content-Type: text/plain; charset=koi8-r
Content-Disposition: inline
In-Reply-To: <201111041336.pA4Da2M8020263@svn.freebsd.org>
User-Agent: Mutt/1.4.2.1i
Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org,
	src-committers@freebsd.org
Subject: Re: svn commit: r227081 - in head/sbin: atm/atmconfig badsect
	camcontrol ccdconfig devfs dmesg dumpfs fdisk ffsinfo fsck
	fsck_msdosfs fsirand growfs init mount mount_cd9660
	mount_nullfs mount_udf natd ...
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: 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, 04 Nov 2011 13:54:22 -0000

On Fri, Nov 04, 2011 at 01:36:02PM +0000, Ed Schouten wrote:
> Author: ed
> Date: Fri Nov  4 13:36:02 2011
> New Revision: 227081
> URL: http://svn.freebsd.org/changeset/base/227081
> 
> Log:
>   Add missing static keywords for global variables to tools in sbin/.
>   
>   These tools declare global variables without using the static keyword,
>   even though their use is limited to a single C-file, or without placing
>   an extern declaration of them in the proper header file.

Thanks for doing this Ed, much appreciated!

./danfe

From owner-svn-src-head@FreeBSD.ORG  Fri Nov  4 15:34:31 2011
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id EE508106564A;
	Fri,  4 Nov 2011 15:34:31 +0000 (UTC) (envelope-from rmh@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id DF1C08FC08;
	Fri,  4 Nov 2011 15:34:31 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pA4FYVYo023954;
	Fri, 4 Nov 2011 15:34:31 GMT (envelope-from rmh@svn.freebsd.org)
Received: (from rmh@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id pA4FYVXB023952;
	Fri, 4 Nov 2011 15:34:31 GMT (envelope-from rmh@svn.freebsd.org)
Message-Id: <201111041534.pA4FYVXB023952@svn.freebsd.org>
From: Robert Millan 
Date: Fri, 4 Nov 2011 15:34: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: r227082 - 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: Fri, 04 Nov 2011 15:34:32 -0000

Author: rmh
Date: Fri Nov  4 15:34:31 2011
New Revision: 227082
URL: http://svn.freebsd.org/changeset/base/227082

Log:
  Silence an (otherwise harmless) very recurrent warning when building the
  kernel of FreeBSD with a non-FreeBSD compiler.
  
  Approved by:	kib (mentor)

Modified:
  head/sys/sys/cdefs.h

Modified: head/sys/sys/cdefs.h
==============================================================================
--- head/sys/sys/cdefs.h	Fri Nov  4 13:36:02 2011	(r227081)
+++ head/sys/sys/cdefs.h	Fri Nov  4 15:34:31 2011	(r227082)
@@ -349,7 +349,8 @@
 #endif
 
 /* Compiler-dependent macros that rely on FreeBSD-specific extensions. */
-#if __FreeBSD_cc_version >= 300001 && defined(__GNUC__) && !defined(__INTEL_COMPILER)
+#if defined(__FreeBSD_cc_version) && __FreeBSD_cc_version >= 300001 && \
+    defined(__GNUC__) && !defined(__INTEL_COMPILER)
 #define	__printf0like(fmtarg, firstvararg) \
 	    __attribute__((__format__ (__printf0__, fmtarg, firstvararg)))
 #else

From owner-svn-src-head@FreeBSD.ORG  Fri Nov  4 16:24:20 2011
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 010C1106564A;
	Fri,  4 Nov 2011 16:24:20 +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 E4B778FC18;
	Fri,  4 Nov 2011 16:24:19 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pA4GOJOX025650;
	Fri, 4 Nov 2011 16:24:19 GMT (envelope-from bz@svn.freebsd.org)
Received: (from bz@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id pA4GOJas025641;
	Fri, 4 Nov 2011 16:24:19 GMT (envelope-from bz@svn.freebsd.org)
Message-Id: <201111041624.pA4GOJas025641@svn.freebsd.org>
From: "Bjoern A. Zeeb" 
Date: Fri, 4 Nov 2011 16:24: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: r227085 - in head/sys: modules modules/ipfw netinet/ipfw
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 04 Nov 2011 16:24:20 -0000

Author: bz
Date: Fri Nov  4 16:24:19 2011
New Revision: 227085
URL: http://svn.freebsd.org/changeset/base/227085

Log:
  Always use the opt_*.h options for ipfw.ko, not just when
  compiled into the kernel.
  Do not try to build the module in case of no INET support but
  keep #error calls for now in case we would compile it into the
  kernel.
  
  This should fix an issue where the module would fail to enable
  IPv6 support from the rc framework, but also other INET and INET6
  parts being silently compiled out without giving a warning in the
  module case.
  
  While here garbage collect unneeded opt_*.h includes.
  opt_ipdn.h is not used anywhere but we need to leave the DUMMYNET
  entry in options for conditional inclusion in kernel so keep the
  file with the same name.
  
  Reported by:	pluknet
  Reviewed by:	plunket, jhb
  MFC After:	3 days

Modified:
  head/sys/modules/Makefile
  head/sys/modules/ipfw/Makefile
  head/sys/netinet/ipfw/ip_fw2.c
  head/sys/netinet/ipfw/ip_fw_dynamic.c
  head/sys/netinet/ipfw/ip_fw_log.c
  head/sys/netinet/ipfw/ip_fw_pfil.c
  head/sys/netinet/ipfw/ip_fw_sockopt.c
  head/sys/netinet/ipfw/ip_fw_table.c

Modified: head/sys/modules/Makefile
==============================================================================
--- head/sys/modules/Makefile	Fri Nov  4 16:10:26 2011	(r227084)
+++ head/sys/modules/Makefile	Fri Nov  4 16:24:19 2011	(r227085)
@@ -137,7 +137,7 @@ SUBDIR=	${_3dfx} \
 	${_io} \
 	ipdivert \
 	${_ipfilter} \
-	ipfw \
+	${_ipfw} \
 	ipfw_nat \
 	${_ipmi} \
 	ip_mroute_mod \
@@ -379,6 +379,10 @@ _if_carp=	if_carp
 _ipfilter=	ipfilter
 .endif
 
+.if ${MK_INET_SUPPORT} != "no" || defined(ALL_MODULES)
+_ipfw=		ipfw
+.endif
+
 .if ${MK_NETGRAPH} != "no" || defined(ALL_MODULES)
 _netgraph=	netgraph
 .endif

Modified: head/sys/modules/ipfw/Makefile
==============================================================================
--- head/sys/modules/ipfw/Makefile	Fri Nov  4 16:10:26 2011	(r227084)
+++ head/sys/modules/ipfw/Makefile	Fri Nov  4 16:24:19 2011	(r227085)
@@ -8,7 +8,7 @@ KMOD=	ipfw
 SRCS=	ip_fw2.c ip_fw_pfil.c
 SRCS+=	ip_fw_dynamic.c ip_fw_log.c
 SRCS+=	ip_fw_sockopt.c ip_fw_table.c
-SRCS+=	opt_inet.h opt_inet6.h opt_ipfw.h opt_ipsec.h
+SRCS+=	opt_inet.h opt_inet6.h opt_ipdivert.h opt_ipfw.h opt_ipsec.h
 
 CFLAGS+= -DIPFIREWALL
 CFLAGS+= -I${.CURDIR}/../../contrib/pf

Modified: head/sys/netinet/ipfw/ip_fw2.c
==============================================================================
--- head/sys/netinet/ipfw/ip_fw2.c	Fri Nov  4 16:10:26 2011	(r227084)
+++ head/sys/netinet/ipfw/ip_fw2.c	Fri Nov  4 16:24:19 2011	(r227085)
@@ -31,14 +31,11 @@ __FBSDID("$FreeBSD$");
  */
 
 #include "opt_ipfw.h"
-#if !defined(KLD_MODULE)
 #include "opt_ipdivert.h"
-#include "opt_ipdn.h"
 #include "opt_inet.h"
 #ifndef INET
 #error IPFIREWALL requires INET.
 #endif /* INET */
-#endif
 #include "opt_inet6.h"
 #include "opt_ipsec.h"
 

Modified: head/sys/netinet/ipfw/ip_fw_dynamic.c
==============================================================================
--- head/sys/netinet/ipfw/ip_fw_dynamic.c	Fri Nov  4 16:10:26 2011	(r227084)
+++ head/sys/netinet/ipfw/ip_fw_dynamic.c	Fri Nov  4 16:24:19 2011	(r227085)
@@ -34,16 +34,11 @@ __FBSDID("$FreeBSD$");
  */
 
 #include "opt_ipfw.h"
-#if !defined(KLD_MODULE)
-#include "opt_ipdivert.h"
-#include "opt_ipdn.h"
 #include "opt_inet.h"
 #ifndef INET
 #error IPFIREWALL requires INET.
 #endif /* INET */
-#endif
 #include "opt_inet6.h"
-#include "opt_ipsec.h"
 
 #include 
 #include 

Modified: head/sys/netinet/ipfw/ip_fw_log.c
==============================================================================
--- head/sys/netinet/ipfw/ip_fw_log.c	Fri Nov  4 16:10:26 2011	(r227084)
+++ head/sys/netinet/ipfw/ip_fw_log.c	Fri Nov  4 16:24:19 2011	(r227085)
@@ -31,16 +31,11 @@ __FBSDID("$FreeBSD$");
  */
 
 #include "opt_ipfw.h"
-#if !defined(KLD_MODULE)
-#include "opt_ipdivert.h"
-#include "opt_ipdn.h"
 #include "opt_inet.h"
 #ifndef INET
 #error IPFIREWALL requires INET.
 #endif /* INET */
-#endif
 #include "opt_inet6.h"
-#include "opt_ipsec.h"
 
 #include 
 #include 

Modified: head/sys/netinet/ipfw/ip_fw_pfil.c
==============================================================================
--- head/sys/netinet/ipfw/ip_fw_pfil.c	Fri Nov  4 16:10:26 2011	(r227084)
+++ head/sys/netinet/ipfw/ip_fw_pfil.c	Fri Nov  4 16:24:19 2011	(r227085)
@@ -28,14 +28,11 @@
 __FBSDID("$FreeBSD$");
 
 #include "opt_ipfw.h"
-#if !defined(KLD_MODULE)
-#include "opt_ipdn.h"
 #include "opt_inet.h"
 #include "opt_inet6.h"
 #ifndef INET
 #error IPFIREWALL requires INET.
 #endif /* INET */
-#endif /* KLD_MODULE */
 
 #include 
 #include 

Modified: head/sys/netinet/ipfw/ip_fw_sockopt.c
==============================================================================
--- head/sys/netinet/ipfw/ip_fw_sockopt.c	Fri Nov  4 16:10:26 2011	(r227084)
+++ head/sys/netinet/ipfw/ip_fw_sockopt.c	Fri Nov  4 16:24:19 2011	(r227085)
@@ -34,16 +34,11 @@ __FBSDID("$FreeBSD$");
  */
 
 #include "opt_ipfw.h"
-#if !defined(KLD_MODULE)
-#include "opt_ipdivert.h"
-#include "opt_ipdn.h"
 #include "opt_inet.h"
 #ifndef INET
 #error IPFIREWALL requires INET.
 #endif /* INET */
-#endif
 #include "opt_inet6.h"
-#include "opt_ipsec.h"
 
 #include 
 #include 

Modified: head/sys/netinet/ipfw/ip_fw_table.c
==============================================================================
--- head/sys/netinet/ipfw/ip_fw_table.c	Fri Nov  4 16:10:26 2011	(r227084)
+++ head/sys/netinet/ipfw/ip_fw_table.c	Fri Nov  4 16:24:19 2011	(r227085)
@@ -40,16 +40,11 @@ __FBSDID("$FreeBSD$");
  */
 
 #include "opt_ipfw.h"
-#if !defined(KLD_MODULE)
-#include "opt_ipdivert.h"
-#include "opt_ipdn.h"
 #include "opt_inet.h"
 #ifndef INET
 #error IPFIREWALL requires INET.
 #endif /* INET */
-#endif
 #include "opt_inet6.h"
-#include "opt_ipsec.h"
 
 #include 
 #include 

From owner-svn-src-head@FreeBSD.ORG  Fri Nov  4 17:07:53 2011
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id BEB4E106564A;
	Fri,  4 Nov 2011 17:07:53 +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 A45CD8FC0C;
	Fri,  4 Nov 2011 17:07:53 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pA4H7rBo027032;
	Fri, 4 Nov 2011 17:07:53 GMT (envelope-from yongari@svn.freebsd.org)
Received: (from yongari@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id pA4H7rRt027030;
	Fri, 4 Nov 2011 17:07:53 GMT (envelope-from yongari@svn.freebsd.org)
Message-Id: <201111041707.pA4H7rRt027030@svn.freebsd.org>
From: Pyun YongHyeon 
Date: Fri, 4 Nov 2011 17:07: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: r227086 - head/sys/dev/ti
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: 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, 04 Nov 2011 17:07:53 -0000

Author: yongari
Date: Fri Nov  4 17:07:53 2011
New Revision: 227086
URL: http://svn.freebsd.org/changeset/base/227086

Log:
  Use ANSI function definations.

Modified:
  head/sys/dev/ti/if_ti.c

Modified: head/sys/dev/ti/if_ti.c
==============================================================================
--- head/sys/dev/ti/if_ti.c	Fri Nov  4 16:24:19 2011	(r227085)
+++ head/sys/dev/ti/if_ti.c	Fri Nov  4 17:07:53 2011	(r227086)
@@ -270,9 +270,7 @@ MODULE_DEPEND(ti, ether, 1, 1, 1);
 /*
  * Send an instruction or address to the EEPROM, check for ACK.
  */
-static u_int32_t ti_eeprom_putbyte(sc, byte)
-	struct ti_softc		*sc;
-	int			byte;
+static u_int32_t ti_eeprom_putbyte(struct ti_softc *sc, int byte)
 {
 	int			i, ack = 0;
 
@@ -316,10 +314,7 @@ static u_int32_t ti_eeprom_putbyte(sc, b
  * We have to send two address bytes since the EEPROM can hold
  * more than 256 bytes of data.
  */
-static u_int8_t ti_eeprom_getbyte(sc, addr, dest)
-	struct ti_softc		*sc;
-	int			addr;
-	u_int8_t		*dest;
+static u_int8_t ti_eeprom_getbyte(struct ti_softc *sc, int addr, u_int8_t *dest)
 {
 	int			i;
 	u_int8_t		byte = 0;
@@ -393,11 +388,7 @@ static u_int8_t ti_eeprom_getbyte(sc, ad
  * Read a sequence of bytes from the EEPROM.
  */
 static int
-ti_read_eeprom(sc, dest, off, cnt)
-	struct ti_softc		*sc;
-	caddr_t			dest;
-	int			off;
-	int			cnt;
+ti_read_eeprom(struct ti_softc *sc, caddr_t dest, int off, int cnt)
 {
 	int			err = 0, i;
 	u_int8_t		byte = 0;
@@ -417,10 +408,7 @@ ti_read_eeprom(sc, dest, off, cnt)
  * Can be used to copy data from NIC local memory.
  */
 static void
-ti_mem_read(sc, addr, len, buf)
-	struct ti_softc		*sc;
-	u_int32_t		addr, len;
-	void			*buf;
+ti_mem_read(struct ti_softc *sc, u_int32_t addr, u_int32_t len, void *buf)
 {
 	int			segptr, segsize, cnt;
 	char			*ptr;
@@ -450,10 +438,7 @@ ti_mem_read(sc, addr, len, buf)
  * Can be used to copy data into NIC local memory.
  */
 static void
-ti_mem_write(sc, addr, len, buf)
-	struct ti_softc		*sc;
-	u_int32_t		addr, len;
-	void			*buf;
+ti_mem_write(struct ti_softc *sc, u_int32_t addr, u_int32_t len, void *buf)
 {
 	int			segptr, segsize, cnt;
 	char			*ptr;
@@ -482,9 +467,7 @@ ti_mem_write(sc, addr, len, buf)
  * Can be used to clear a section of NIC local memory.
  */
 static void
-ti_mem_zero(sc, addr, len)
-	struct ti_softc		*sc;
-	u_int32_t		addr, len;
+ti_mem_zero(struct ti_softc *sc, u_int32_t addr, u_int32_t len)
 {
 	int			segptr, segsize, cnt;
 
@@ -505,11 +488,8 @@ ti_mem_zero(sc, addr, len)
 }
 
 static int
-ti_copy_mem(sc, tigon_addr, len, buf, useraddr, readdata)
-	struct ti_softc		*sc;
-	u_int32_t		tigon_addr, len;
-	caddr_t			buf;
-	int			useraddr, readdata;
+ti_copy_mem(struct ti_softc *sc, u_int32_t tigon_addr, u_int32_t len,
+    caddr_t buf, int useraddr, int readdata)
 {
 	int		segptr, segsize, cnt;
 	caddr_t		ptr;
@@ -704,12 +684,8 @@ ti_copy_mem(sc, tigon_addr, len, buf, us
 }
 
 static int
-ti_copy_scratch(sc, tigon_addr, len, buf, useraddr, readdata, cpu)
-	struct ti_softc		*sc;
-	u_int32_t		tigon_addr, len;
-	caddr_t			buf;
-	int			useraddr, readdata;
-	int			cpu;
+ti_copy_scratch(struct ti_softc *sc, u_int32_t tigon_addr, u_int32_t len,
+    caddr_t buf, int useraddr, int readdata, int cpu)
 {
 	u_int32_t	segptr;
 	int		cnt;
@@ -802,11 +778,7 @@ ti_copy_scratch(sc, tigon_addr, len, buf
 }
 
 static int
-ti_bcopy_swap(src, dst, len, swap_type)
-	const void	*src;
-	void		*dst;
-	size_t		len;
-	ti_swap_type	swap_type;
+ti_bcopy_swap(const void *src, void *dst, size_t len, ti_swap_type swap_type)
 {
 	const u_int8_t *tmpsrc;
 	u_int8_t *tmpdst;
@@ -844,8 +816,7 @@ ti_bcopy_swap(src, dst, len, swap_type)
  * Tigon 2.
  */
 static void
-ti_loadfw(sc)
-	struct ti_softc		*sc;
+ti_loadfw(struct ti_softc *sc)
 {
 
 	TI_LOCK_ASSERT(sc);
@@ -902,9 +873,7 @@ ti_loadfw(sc)
  * Send the NIC a command via the command ring.
  */
 static void
-ti_cmd(sc, cmd)
-	struct ti_softc		*sc;
-	struct ti_cmd_desc	*cmd;
+ti_cmd(struct ti_softc *sc, struct ti_cmd_desc *cmd)
 {
 	int			index;
 
@@ -920,11 +889,7 @@ ti_cmd(sc, cmd)
  * number of command slots to include after the initial command.
  */
 static void
-ti_cmd_ext(sc, cmd, arg, len)
-	struct ti_softc		*sc;
-	struct ti_cmd_desc	*cmd;
-	caddr_t			arg;
-	int			len;
+ti_cmd_ext(struct ti_softc *sc, struct ti_cmd_desc *cmd, caddr_t arg, int len)
 {
 	int			index;
 	int			i;
@@ -945,8 +910,7 @@ ti_cmd_ext(sc, cmd, arg, len)
  * Handle events that have triggered interrupts.
  */
 static void
-ti_handle_events(sc)
-	struct ti_softc		*sc;
+ti_handle_events(struct ti_softc *sc)
 {
 	struct ti_event_desc	*e;
 
@@ -1089,8 +1053,7 @@ ti_free_dmamaps(struct ti_softc *sc)
  */
 
 static int
-ti_alloc_jumbo_mem(sc)
-	struct ti_softc		*sc;
+ti_alloc_jumbo_mem(struct ti_softc *sc)
 {
 	caddr_t			ptr;
 	int			i;
@@ -1152,8 +1115,7 @@ ti_alloc_jumbo_mem(sc)
 /*
  * Allocate a jumbo buffer.
  */
-static void *ti_jalloc(sc)
-	struct ti_softc		*sc;
+static void *ti_jalloc(struct ti_softc *sc)
 {
 	struct ti_jpool_entry	*entry;
 
@@ -1173,9 +1135,7 @@ static void *ti_jalloc(sc)
  * Release a jumbo buffer.
  */
 static void
-ti_jfree(buf, args)
-	void			*buf;
-	void			*args;
+ti_jfree(void *buf, void *args)
 {
 	struct ti_softc		*sc;
 	int			i;
@@ -1205,8 +1165,7 @@ ti_jfree(buf, args)
 #else
 
 static int
-ti_alloc_jumbo_mem(sc)
-	struct ti_softc		*sc;
+ti_alloc_jumbo_mem(struct ti_softc *sc)
 {
 
 	/*
@@ -1237,10 +1196,7 @@ ti_alloc_jumbo_mem(sc)
  * Intialize a standard receive ring descriptor.
  */
 static int
-ti_newbuf_std(sc, i, m)
-	struct ti_softc		*sc;
-	int			i;
-	struct mbuf		*m;
+ti_newbuf_std(struct ti_softc *sc, int i, struct mbuf *m)
 {
 	bus_dmamap_t		map;
 	bus_dma_segment_t	segs;
@@ -1292,10 +1248,7 @@ ti_newbuf_std(sc, i, m)
  * the Tigon 2.
  */
 static int
-ti_newbuf_mini(sc, i, m)
-	struct ti_softc		*sc;
-	int			i;
-	struct mbuf		*m;
+ti_newbuf_mini(struct ti_softc *sc, int i, struct mbuf *m)
 {
 	bus_dma_segment_t	segs;
 	bus_dmamap_t		map;
@@ -1344,10 +1297,7 @@ ti_newbuf_mini(sc, i, m)
  * a jumbo buffer from the pool managed internally by the driver.
  */
 static int
-ti_newbuf_jumbo(sc, i, m)
-	struct ti_softc		*sc;
-	int			i;
-	struct mbuf		*m;
+ti_newbuf_jumbo(struct ti_softc *sc, int i, struct mbuf *m)
 {
 	bus_dmamap_t		map;
 	struct mbuf		*m_new = NULL;
@@ -1425,10 +1375,7 @@ static int HDR_LEN =  TCP_HDR_LEN;
  * a jumbo buffer from the pool managed internally by the driver.
  */
 static int
-ti_newbuf_jumbo(sc, idx, m_old)
-	struct ti_softc		*sc;
-	int			idx;
-	struct mbuf		*m_old;
+ti_newbuf_jumbo(struct ti_softc *sc, int idx, struct mbuf *m_old)
 {
 	bus_dmamap_t		map;
 	struct mbuf		*cur, *m_new = NULL;
@@ -1582,8 +1529,7 @@ nobufs:
  * the NIC.
  */
 static int
-ti_init_rx_ring_std(sc)
-	struct ti_softc		*sc;
+ti_init_rx_ring_std(struct ti_softc *sc)
 {
 	int			i;
 	struct ti_cmd_desc	cmd;
@@ -1600,8 +1546,7 @@ ti_init_rx_ring_std(sc)
 }
 
 static void
-ti_free_rx_ring_std(sc)
-	struct ti_softc		*sc;
+ti_free_rx_ring_std(struct ti_softc *sc)
 {
 	bus_dmamap_t		map;
 	int			i;
@@ -1621,8 +1566,7 @@ ti_free_rx_ring_std(sc)
 }
 
 static int
-ti_init_rx_ring_jumbo(sc)
-	struct ti_softc		*sc;
+ti_init_rx_ring_jumbo(struct ti_softc *sc)
 {
 	int			i;
 	struct ti_cmd_desc	cmd;
@@ -1639,8 +1583,7 @@ ti_init_rx_ring_jumbo(sc)
 }
 
 static void
-ti_free_rx_ring_jumbo(sc)
-	struct ti_softc		*sc;
+ti_free_rx_ring_jumbo(struct ti_softc *sc)
 {
 	bus_dmamap_t		map;
 	int			i;
@@ -1660,8 +1603,7 @@ ti_free_rx_ring_jumbo(sc)
 }
 
 static int
-ti_init_rx_ring_mini(sc)
-	struct ti_softc		*sc;
+ti_init_rx_ring_mini(struct ti_softc *sc)
 {
 	int			i;
 
@@ -1677,8 +1619,7 @@ ti_init_rx_ring_mini(sc)
 }
 
 static void
-ti_free_rx_ring_mini(sc)
-	struct ti_softc		*sc;
+ti_free_rx_ring_mini(struct ti_softc *sc)
 {
 	bus_dmamap_t		map;
 	int			i;
@@ -1698,8 +1639,7 @@ ti_free_rx_ring_mini(sc)
 }
 
 static void
-ti_free_tx_ring(sc)
-	struct ti_softc		*sc;
+ti_free_tx_ring(struct ti_softc *sc)
 {
 	struct ti_txdesc	*txd;
 	int			i;
@@ -1722,8 +1662,7 @@ ti_free_tx_ring(sc)
 }
 
 static int
-ti_init_tx_ring(sc)
-	struct ti_softc		*sc;
+ti_init_tx_ring(struct ti_softc *sc)
 {
 	struct ti_txdesc	*txd;
 	int			i;
@@ -1747,9 +1686,7 @@ ti_init_tx_ring(sc)
  * work.
  */
 static void
-ti_add_mcast(sc, addr)
-	struct ti_softc		*sc;
-	struct ether_addr	*addr;
+ti_add_mcast(struct ti_softc *sc, struct ether_addr *addr)
 {
 	struct ti_cmd_desc	cmd;
 	u_int16_t		*m;
@@ -1775,9 +1712,7 @@ ti_add_mcast(sc, addr)
 }
 
 static void
-ti_del_mcast(sc, addr)
-	struct ti_softc		*sc;
-	struct ether_addr	*addr;
+ti_del_mcast(struct ti_softc *sc, struct ether_addr *addr)
 {
 	struct ti_cmd_desc	cmd;
 	u_int16_t		*m;
@@ -1817,8 +1752,7 @@ ti_del_mcast(sc, addr)
  * any given time.
  */
 static void
-ti_setmulti(sc)
-	struct ti_softc		*sc;
+ti_setmulti(struct ti_softc *sc)
 {
 	struct ifnet		*ifp;
 	struct ifmultiaddr	*ifma;
@@ -1877,8 +1811,7 @@ ti_setmulti(sc)
  * around it on the Tigon 2 by setting a bit in the PCI state register,
  * but for the Tigon 1 we must give up and abort the interface attach.
  */
-static int ti_64bitslot_war(sc)
-	struct ti_softc		*sc;
+static int ti_64bitslot_war(struct ti_softc *sc)
 {
 	if (!(CSR_READ_4(sc, TI_PCI_STATE) & TI_PCISTATE_32BIT_BUS)) {
 		CSR_WRITE_4(sc, 0x600, 0);
@@ -1903,8 +1836,7 @@ static int ti_64bitslot_war(sc)
  * self-test results.
  */
 static int
-ti_chipinit(sc)
-	struct ti_softc		*sc;
+ti_chipinit(struct ti_softc *sc)
 {
 	u_int32_t		cacheline;
 	u_int32_t		pci_writemax = 0;
@@ -2057,8 +1989,7 @@ ti_chipinit(sc)
  * start the CPU(s) running.
  */
 static int
-ti_gibinit(sc)
-	struct ti_softc		*sc;
+ti_gibinit(struct ti_softc *sc)
 {
 	struct ti_rcb		*rcb;
 	int			i;
@@ -2250,8 +2181,7 @@ ti_rdata_cb(void *arg, bus_dma_segment_t
  * against our list and return its name if we find a match.
  */
 static int
-ti_probe(dev)
-	device_t		dev;
+ti_probe(device_t dev)
 {
 	const struct ti_type	*t;
 
@@ -2270,8 +2200,7 @@ ti_probe(dev)
 }
 
 static int
-ti_attach(dev)
-	device_t		dev;
+ti_attach(device_t dev)
 {
 	struct ifnet		*ifp;
 	struct ti_softc		*sc;
@@ -2559,8 +2488,7 @@ fail:
  * allocated.
  */
 static int
-ti_detach(dev)
-	device_t		dev;
+ti_detach(device_t dev)
 {
 	struct ti_softc		*sc;
 	struct ifnet		*ifp;
@@ -2686,8 +2614,7 @@ ti_hdr_split(struct mbuf *top, int hdr_l
  */
 
 static void
-ti_rxeof(sc)
-	struct ti_softc		*sc;
+ti_rxeof(struct ti_softc *sc)
 {
 	bus_dmamap_t		map;
 	struct ifnet		*ifp;
@@ -2820,8 +2747,7 @@ ti_rxeof(sc)
 }
 
 static void
-ti_txeof(sc)
-	struct ti_softc		*sc;
+ti_txeof(struct ti_softc *sc)
 {
 	struct ti_txdesc	*txd;
 	struct ti_tx_desc	txdesc;
@@ -2867,8 +2793,7 @@ ti_txeof(sc)
 }
 
 static void
-ti_intr(xsc)
-	void			*xsc;
+ti_intr(void *xsc)
 {
 	struct ti_softc		*sc;
 	struct ifnet		*ifp;
@@ -2910,8 +2835,7 @@ ti_intr(xsc)
 }
 
 static void
-ti_stats_update(sc)
-	struct ti_softc		*sc;
+ti_stats_update(struct ti_softc *sc)
 {
 	struct ifnet		*ifp;
 
@@ -2936,9 +2860,7 @@ ti_stats_update(sc)
  * pointers to descriptors.
  */
 static int
-ti_encap(sc, m_head)
-	struct ti_softc		*sc;
-	struct mbuf		**m_head;
+ti_encap(struct ti_softc *sc, struct mbuf **m_head)
 {
 	struct ti_txdesc	*txd;
 	struct ti_tx_desc	*f;
@@ -3041,8 +2963,7 @@ ti_encap(sc, m_head)
 }
 
 static void
-ti_start(ifp)
-	struct ifnet		*ifp;
+ti_start(struct ifnet *ifp)
 {
 	struct ti_softc		*sc;
 
@@ -3057,8 +2978,7 @@ ti_start(ifp)
  * to the mbuf data regions directly in the transmit descriptors.
  */
 static void
-ti_start_locked(ifp)
-	struct ifnet		*ifp;
+ti_start_locked(struct ifnet *ifp)
 {
 	struct ti_softc		*sc;
 	struct mbuf		*m_head = NULL;
@@ -3123,8 +3043,7 @@ ti_start_locked(ifp)
 }
 
 static void
-ti_init(xsc)
-	void			*xsc;
+ti_init(void *xsc)
 {
 	struct ti_softc		*sc;
 
@@ -3135,8 +3054,7 @@ ti_init(xsc)
 }
 
 static void
-ti_init_locked(xsc)
-	void			*xsc;
+ti_init_locked(void *xsc)
 {
 	struct ti_softc		*sc = xsc;
 
@@ -3150,8 +3068,7 @@ ti_init_locked(xsc)
 	}
 }
 
-static void ti_init2(sc)
-	struct ti_softc		*sc;
+static void ti_init2(struct ti_softc *sc)
 {
 	struct ti_cmd_desc	cmd;
 	struct ifnet		*ifp;
@@ -3241,8 +3158,7 @@ static void ti_init2(sc)
  * Set media options.
  */
 static int
-ti_ifmedia_upd(ifp)
-	struct ifnet		*ifp;
+ti_ifmedia_upd(struct ifnet *ifp)
 {
 	struct ti_softc		*sc;
 	struct ifmedia		*ifm;
@@ -3343,9 +3259,7 @@ ti_ifmedia_upd(ifp)
  * Report current media status.
  */
 static void
-ti_ifmedia_sts(ifp, ifmr)
-	struct ifnet		*ifp;
-	struct ifmediareq	*ifmr;
+ti_ifmedia_sts(struct ifnet *ifp, struct ifmediareq *ifmr)
 {
 	struct ti_softc		*sc;
 	u_int32_t		media = 0;
@@ -3391,10 +3305,7 @@ ti_ifmedia_sts(ifp, ifmr)
 }
 
 static int
-ti_ioctl(ifp, command, data)
-	struct ifnet		*ifp;
-	u_long			command;
-	caddr_t			data;
+ti_ioctl(struct ifnet *ifp, u_long command, caddr_t data)
 {
 	struct ti_softc		*sc = ifp->if_softc;
 	struct ifreq		*ifr = (struct ifreq *) data;
@@ -3816,8 +3727,7 @@ ti_watchdog(void *arg)
  * RX and TX lists.
  */
 static void
-ti_stop(sc)
-	struct ti_softc		*sc;
+ti_stop(struct ti_softc *sc)
 {
 	struct ifnet		*ifp;
 	struct ti_cmd_desc	cmd;
@@ -3866,8 +3776,7 @@ ti_stop(sc)
  * get confused by errant DMAs when rebooting.
  */
 static int
-ti_shutdown(dev)
-	device_t		dev;
+ti_shutdown(device_t dev)
 {
 	struct ti_softc		*sc;
 

From owner-svn-src-head@FreeBSD.ORG  Fri Nov  4 18:28:11 2011
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 320DA106566B;
	Fri,  4 Nov 2011 18:28:11 +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 210DA8FC12;
	Fri,  4 Nov 2011 18:28:11 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pA4ISBEL029455;
	Fri, 4 Nov 2011 18:28:11 GMT (envelope-from yongari@svn.freebsd.org)
Received: (from yongari@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id pA4ISBYn029453;
	Fri, 4 Nov 2011 18:28:11 GMT (envelope-from yongari@svn.freebsd.org)
Message-Id: <201111041828.pA4ISBYn029453@svn.freebsd.org>
From: Pyun YongHyeon 
Date: Fri, 4 Nov 2011 18:28: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: r227087 - head/sys/dev/ti
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: 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, 04 Nov 2011 18:28:11 -0000

Author: yongari
Date: Fri Nov  4 18:28:10 2011
New Revision: 227087
URL: http://svn.freebsd.org/changeset/base/227087

Log:
  style.
  No functional changes.

Modified:
  head/sys/dev/ti/if_ti.c

Modified: head/sys/dev/ti/if_ti.c
==============================================================================
--- head/sys/dev/ti/if_ti.c	Fri Nov  4 17:07:53 2011	(r227086)
+++ head/sys/dev/ti/if_ti.c	Fri Nov  4 18:28:10 2011	(r227087)
@@ -140,7 +140,6 @@ typedef enum {
 	TI_SWAP_NTOH
 } ti_swap_type;
 
-
 /*
  * Various supported device vendors/types and their names.
  */
@@ -210,9 +209,10 @@ static void ti_setmulti(struct ti_softc 
 static void ti_mem_read(struct ti_softc *, u_int32_t, u_int32_t, void *);
 static void ti_mem_write(struct ti_softc *, u_int32_t, u_int32_t, void *);
 static void ti_mem_zero(struct ti_softc *, u_int32_t, u_int32_t);
-static int ti_copy_mem(struct ti_softc *, u_int32_t, u_int32_t, caddr_t, int, int);
+static int ti_copy_mem(struct ti_softc *, u_int32_t, u_int32_t, caddr_t, int,
+    int);
 static int ti_copy_scratch(struct ti_softc *, u_int32_t, u_int32_t, caddr_t,
-		int, int, int);
+    int, int, int);
 static int ti_bcopy_swap(const void *, void *, size_t, ti_swap_type);
 static void ti_loadfw(struct ti_softc *);
 static void ti_cmd(struct ti_softc *, struct ti_cmd_desc *);
@@ -242,8 +242,8 @@ static int ti_chipinit(struct ti_softc *
 static int ti_gibinit(struct ti_softc *);
 
 #ifdef TI_JUMBO_HDRSPLIT
-static __inline void ti_hdr_split	(struct mbuf *top, int hdr_len,
-					     int pkt_len, int idx);
+static __inline void ti_hdr_split(struct mbuf *top, int hdr_len, int pkt_len,
+    int idx);
 #endif /* TI_JUMBO_HDRSPLIT */
 
 static device_method_t ti_methods[] = {
@@ -270,9 +270,10 @@ MODULE_DEPEND(ti, ether, 1, 1, 1);
 /*
  * Send an instruction or address to the EEPROM, check for ACK.
  */
-static u_int32_t ti_eeprom_putbyte(struct ti_softc *sc, int byte)
+static u_int32_t
+ti_eeprom_putbyte(struct ti_softc *sc, int byte)
 {
-	int			i, ack = 0;
+	int i, ack = 0;
 
 	/*
 	 * Make sure we're in TX mode.
@@ -314,10 +315,11 @@ static u_int32_t ti_eeprom_putbyte(struc
  * We have to send two address bytes since the EEPROM can hold
  * more than 256 bytes of data.
  */
-static u_int8_t ti_eeprom_getbyte(struct ti_softc *sc, int addr, u_int8_t *dest)
+static u_int8_t
+ti_eeprom_getbyte(struct ti_softc *sc, int addr, u_int8_t *dest)
 {
-	int			i;
-	u_int8_t		byte = 0;
+	int i;
+	u_int8_t byte = 0;
 
 	EEPROM_START;
 
@@ -390,8 +392,8 @@ static u_int8_t ti_eeprom_getbyte(struct
 static int
 ti_read_eeprom(struct ti_softc *sc, caddr_t dest, int off, int cnt)
 {
-	int			err = 0, i;
-	u_int8_t		byte = 0;
+	int err = 0, i;
+	u_int8_t byte = 0;
 
 	for (i = 0; i < cnt; i++) {
 		err = ti_eeprom_getbyte(sc, off + i, &byte);
@@ -410,8 +412,8 @@ ti_read_eeprom(struct ti_softc *sc, cadd
 static void
 ti_mem_read(struct ti_softc *sc, u_int32_t addr, u_int32_t len, void *buf)
 {
-	int			segptr, segsize, cnt;
-	char			*ptr;
+	int segptr, segsize, cnt;
+	char *ptr;
 
 	segptr = addr;
 	cnt = len;
@@ -440,8 +442,8 @@ ti_mem_read(struct ti_softc *sc, u_int32
 static void
 ti_mem_write(struct ti_softc *sc, u_int32_t addr, u_int32_t len, void *buf)
 {
-	int			segptr, segsize, cnt;
-	char			*ptr;
+	int segptr, segsize, cnt;
+	char *ptr;
 
 	segptr = addr;
 	cnt = len;
@@ -469,7 +471,7 @@ ti_mem_write(struct ti_softc *sc, u_int3
 static void
 ti_mem_zero(struct ti_softc *sc, u_int32_t addr, u_int32_t len)
 {
-	int			segptr, segsize, cnt;
+	int segptr, segsize, cnt;
 
 	segptr = addr;
 	cnt = len;
@@ -491,12 +493,12 @@ static int
 ti_copy_mem(struct ti_softc *sc, u_int32_t tigon_addr, u_int32_t len,
     caddr_t buf, int useraddr, int readdata)
 {
-	int		segptr, segsize, cnt;
-	caddr_t		ptr;
-	u_int32_t	origwin;
-	u_int8_t	tmparray[TI_WINLEN], tmparray2[TI_WINLEN];
-	int		resid, segresid;
-	int		first_pass;
+	int segptr, segsize, cnt;
+	caddr_t ptr;
+	u_int32_t origwin;
+	u_int8_t tmparray[TI_WINLEN], tmparray2[TI_WINLEN];
+	int resid, segresid;
+	int first_pass;
 
 	TI_LOCK_ASSERT(sc);
 
@@ -687,10 +689,10 @@ static int
 ti_copy_scratch(struct ti_softc *sc, u_int32_t tigon_addr, u_int32_t len,
     caddr_t buf, int useraddr, int readdata, int cpu)
 {
-	u_int32_t	segptr;
-	int		cnt;
-	u_int32_t	tmpval, tmpval2;
-	caddr_t		ptr;
+	u_int32_t segptr;
+	int cnt;
+	u_int32_t tmpval, tmpval2;
+	caddr_t ptr;
 
 	TI_LOCK_ASSERT(sc);
 
@@ -875,7 +877,7 @@ ti_loadfw(struct ti_softc *sc)
 static void
 ti_cmd(struct ti_softc *sc, struct ti_cmd_desc *cmd)
 {
-	int			index;
+	int index;
 
 	index = sc->ti_cmd_saved_prodidx;
 	CSR_WRITE_4(sc, TI_GCR_CMDRING + (index * 4), *(u_int32_t *)(cmd));
@@ -891,8 +893,8 @@ ti_cmd(struct ti_softc *sc, struct ti_cm
 static void
 ti_cmd_ext(struct ti_softc *sc, struct ti_cmd_desc *cmd, caddr_t arg, int len)
 {
-	int			index;
-	int			i;
+	int index;
+	int i;
 
 	index = sc->ti_cmd_saved_prodidx;
 	CSR_WRITE_4(sc, TI_GCR_CMDRING + (index * 4), *(u_int32_t *)(cmd));
@@ -912,7 +914,7 @@ ti_cmd_ext(struct ti_softc *sc, struct t
 static void
 ti_handle_events(struct ti_softc *sc)
 {
-	struct ti_event_desc	*e;
+	struct ti_event_desc *e;
 
 	if (sc->ti_rdata->ti_event_ring == NULL)
 		return;
@@ -1055,9 +1057,9 @@ ti_free_dmamaps(struct ti_softc *sc)
 static int
 ti_alloc_jumbo_mem(struct ti_softc *sc)
 {
-	caddr_t			ptr;
-	int			i;
-	struct ti_jpool_entry   *entry;
+	struct ti_jpool_entry *entry;
+	caddr_t ptr;
+	int i;
 
 	/*
 	 * Grab a big chunk o' storage.  Since we are chopping this pool up
@@ -1117,7 +1119,7 @@ ti_alloc_jumbo_mem(struct ti_softc *sc)
  */
 static void *ti_jalloc(struct ti_softc *sc)
 {
-	struct ti_jpool_entry	*entry;
+	struct ti_jpool_entry *entry;
 
 	entry = SLIST_FIRST(&sc->ti_jfree_listhead);
 
@@ -1137,9 +1139,9 @@ static void *ti_jalloc(struct ti_softc *
 static void
 ti_jfree(void *buf, void *args)
 {
-	struct ti_softc		*sc;
-	int			i;
-	struct ti_jpool_entry	*entry;
+	struct ti_softc *sc;
+	int i;
+	struct ti_jpool_entry *entry;
 
 	/* Extract the softc struct pointer. */
 	sc = (struct ti_softc *)args;
@@ -1198,11 +1200,11 @@ ti_alloc_jumbo_mem(struct ti_softc *sc)
 static int
 ti_newbuf_std(struct ti_softc *sc, int i, struct mbuf *m)
 {
-	bus_dmamap_t		map;
-	bus_dma_segment_t	segs;
-	struct mbuf		*m_new = NULL;
-	struct ti_rx_desc	*r;
-	int			nsegs;
+	bus_dmamap_t map;
+	bus_dma_segment_t segs;
+	struct mbuf *m_new = NULL;
+	struct ti_rx_desc *r;
+	int nsegs;
 
 	nsegs = 0;
 	if (m == NULL) {
@@ -1250,11 +1252,11 @@ ti_newbuf_std(struct ti_softc *sc, int i
 static int
 ti_newbuf_mini(struct ti_softc *sc, int i, struct mbuf *m)
 {
-	bus_dma_segment_t	segs;
-	bus_dmamap_t		map;
-	struct mbuf		*m_new = NULL;
-	struct ti_rx_desc	*r;
-	int			nsegs;
+	bus_dma_segment_t segs;
+	bus_dmamap_t map;
+	struct mbuf *m_new = NULL;
+	struct ti_rx_desc *r;
+	int nsegs;
 
 	nsegs = 0;
 	if (m == NULL) {
@@ -1299,14 +1301,14 @@ ti_newbuf_mini(struct ti_softc *sc, int 
 static int
 ti_newbuf_jumbo(struct ti_softc *sc, int i, struct mbuf *m)
 {
-	bus_dmamap_t		map;
-	struct mbuf		*m_new = NULL;
-	struct ti_rx_desc	*r;
-	int			nsegs;
-	bus_dma_segment_t	segs;
+	bus_dmamap_t map;
+	struct mbuf *m_new = NULL;
+	struct ti_rx_desc *r;
+	int nsegs;
+	bus_dma_segment_t segs;
 
 	if (m == NULL) {
-		caddr_t			*buf = NULL;
+		caddr_t *buf = NULL;
 
 		/* Allocate the mbuf. */
 		MGETHDR(m_new, M_DONTWAIT, MT_DATA);
@@ -1367,8 +1369,7 @@ ti_newbuf_jumbo(struct ti_softc *sc, int
 #define TCP_HDR_LEN (52 + sizeof(struct ether_header))
 #define UDP_HDR_LEN (28 + sizeof(struct ether_header))
 #define NFS_HDR_LEN (UDP_HDR_LEN)
-static int HDR_LEN =  TCP_HDR_LEN;
-
+static int HDR_LEN = TCP_HDR_LEN;
 
 /*
  * Initialize a jumbo receive ring descriptor. This allocates
@@ -1377,17 +1378,17 @@ static int HDR_LEN =  TCP_HDR_LEN;
 static int
 ti_newbuf_jumbo(struct ti_softc *sc, int idx, struct mbuf *m_old)
 {
-	bus_dmamap_t		map;
-	struct mbuf		*cur, *m_new = NULL;
-	struct mbuf		*m[3] = {NULL, NULL, NULL};
-	struct ti_rx_desc_ext	*r;
-	vm_page_t		frame;
-	static int		color;
-				/* 1 extra buf to make nobufs easy*/
-	struct sf_buf		*sf[3] = {NULL, NULL, NULL};
-	int			i;
-	bus_dma_segment_t	segs[4];
-	int			nsegs;
+	bus_dmamap_t map;
+	struct mbuf *cur, *m_new = NULL;
+	struct mbuf *m[3] = {NULL, NULL, NULL};
+	struct ti_rx_desc_ext *r;
+	vm_page_t frame;
+	static int color;
+	/* 1 extra buf to make nobufs easy*/
+	struct sf_buf *sf[3] = {NULL, NULL, NULL};
+	int i;
+	bus_dma_segment_t segs[4];
+	int nsegs;
 
 	if (m_old != NULL) {
 		m_new = m_old;
@@ -1520,8 +1521,6 @@ nobufs:
 }
 #endif
 
-
-
 /*
  * The standard receive ring has 512 entries in it. At 2K per mbuf cluster,
  * that's 1MB or memory, which is a lot. For now, we fill only the first
@@ -1531,8 +1530,8 @@ nobufs:
 static int
 ti_init_rx_ring_std(struct ti_softc *sc)
 {
-	int			i;
-	struct ti_cmd_desc	cmd;
+	int i;
+	struct ti_cmd_desc cmd;
 
 	for (i = 0; i < TI_SSLOTS; i++) {
 		if (ti_newbuf_std(sc, i, NULL) == ENOBUFS)
@@ -1548,8 +1547,8 @@ ti_init_rx_ring_std(struct ti_softc *sc)
 static void
 ti_free_rx_ring_std(struct ti_softc *sc)
 {
-	bus_dmamap_t		map;
-	int			i;
+	bus_dmamap_t map;
+	int i;
 
 	for (i = 0; i < TI_STD_RX_RING_CNT; i++) {
 		if (sc->ti_cdata.ti_rx_std_chain[i] != NULL) {
@@ -1568,8 +1567,8 @@ ti_free_rx_ring_std(struct ti_softc *sc)
 static int
 ti_init_rx_ring_jumbo(struct ti_softc *sc)
 {
-	int			i;
-	struct ti_cmd_desc	cmd;
+	struct ti_cmd_desc cmd;
+	int i;
 
 	for (i = 0; i < TI_JUMBO_RX_RING_CNT; i++) {
 		if (ti_newbuf_jumbo(sc, i, NULL) == ENOBUFS)
@@ -1585,8 +1584,8 @@ ti_init_rx_ring_jumbo(struct ti_softc *s
 static void
 ti_free_rx_ring_jumbo(struct ti_softc *sc)
 {
-	bus_dmamap_t		map;
-	int			i;
+	bus_dmamap_t map;
+	int i;
 
 	for (i = 0; i < TI_JUMBO_RX_RING_CNT; i++) {
 		if (sc->ti_cdata.ti_rx_jumbo_chain[i] != NULL) {
@@ -1605,7 +1604,7 @@ ti_free_rx_ring_jumbo(struct ti_softc *s
 static int
 ti_init_rx_ring_mini(struct ti_softc *sc)
 {
-	int			i;
+	int i;
 
 	for (i = 0; i < TI_MSLOTS; i++) {
 		if (ti_newbuf_mini(sc, i, NULL) == ENOBUFS)
@@ -1621,8 +1620,8 @@ ti_init_rx_ring_mini(struct ti_softc *sc
 static void
 ti_free_rx_ring_mini(struct ti_softc *sc)
 {
-	bus_dmamap_t		map;
-	int			i;
+	bus_dmamap_t map;
+	int i;
 
 	for (i = 0; i < TI_MINI_RX_RING_CNT; i++) {
 		if (sc->ti_cdata.ti_rx_mini_chain[i] != NULL) {
@@ -1641,8 +1640,8 @@ ti_free_rx_ring_mini(struct ti_softc *sc
 static void
 ti_free_tx_ring(struct ti_softc *sc)
 {
-	struct ti_txdesc	*txd;
-	int			i;
+	struct ti_txdesc *txd;
+	int i;
 
 	if (sc->ti_rdata->ti_tx_ring == NULL)
 		return;
@@ -1664,8 +1663,8 @@ ti_free_tx_ring(struct ti_softc *sc)
 static int
 ti_init_tx_ring(struct ti_softc *sc)
 {
-	struct ti_txdesc	*txd;
-	int			i;
+	struct ti_txdesc *txd;
+	int i;
 
 	STAILQ_INIT(&sc->ti_cdata.ti_txfreeq);
 	STAILQ_INIT(&sc->ti_cdata.ti_txbusyq);
@@ -1688,9 +1687,9 @@ ti_init_tx_ring(struct ti_softc *sc)
 static void
 ti_add_mcast(struct ti_softc *sc, struct ether_addr *addr)
 {
-	struct ti_cmd_desc	cmd;
-	u_int16_t		*m;
-	u_int32_t		ext[2] = {0, 0};
+	struct ti_cmd_desc cmd;
+	u_int16_t *m;
+	u_int32_t ext[2] = {0, 0};
 
 	m = (u_int16_t *)&addr->octet[0];
 
@@ -1714,9 +1713,9 @@ ti_add_mcast(struct ti_softc *sc, struct
 static void
 ti_del_mcast(struct ti_softc *sc, struct ether_addr *addr)
 {
-	struct ti_cmd_desc	cmd;
-	u_int16_t		*m;
-	u_int32_t		ext[2] = {0, 0};
+	struct ti_cmd_desc cmd;
+	u_int16_t *m;
+	u_int32_t ext[2] = {0, 0};
 
 	m = (u_int16_t *)&addr->octet[0];
 
@@ -1754,11 +1753,11 @@ ti_del_mcast(struct ti_softc *sc, struct
 static void
 ti_setmulti(struct ti_softc *sc)
 {
-	struct ifnet		*ifp;
-	struct ifmultiaddr	*ifma;
-	struct ti_cmd_desc	cmd;
-	struct ti_mc_entry	*mc;
-	u_int32_t		intrs;
+	struct ifnet *ifp;
+	struct ifmultiaddr *ifma;
+	struct ti_cmd_desc cmd;
+	struct ti_mc_entry *mc;
+	u_int32_t intrs;
 
 	TI_LOCK_ASSERT(sc);
 
@@ -1813,6 +1812,7 @@ ti_setmulti(struct ti_softc *sc)
  */
 static int ti_64bitslot_war(struct ti_softc *sc)
 {
+
 	if (!(CSR_READ_4(sc, TI_PCI_STATE) & TI_PCISTATE_32BIT_BUS)) {
 		CSR_WRITE_4(sc, 0x600, 0);
 		CSR_WRITE_4(sc, 0x604, 0);
@@ -1838,9 +1838,9 @@ static int ti_64bitslot_war(struct ti_so
 static int
 ti_chipinit(struct ti_softc *sc)
 {
-	u_int32_t		cacheline;
-	u_int32_t		pci_writemax = 0;
-	u_int32_t		hdrsplit;
+	u_int32_t cacheline;
+	u_int32_t pci_writemax = 0;
+	u_int32_t hdrsplit;
 
 	/* Initialize link to down state. */
 	sc->ti_linkstat = TI_EV_CODE_LINK_DOWN;
@@ -1991,10 +1991,10 @@ ti_chipinit(struct ti_softc *sc)
 static int
 ti_gibinit(struct ti_softc *sc)
 {
-	struct ti_rcb		*rcb;
-	int			i;
-	struct ifnet		*ifp;
-	uint32_t		rdphys;
+	struct ifnet *ifp;
+	struct ti_rcb *rcb;
+	uint32_t rdphys;
+	int i;
 
 	TI_LOCK_ASSERT(sc);
 
@@ -2175,7 +2175,7 @@ ti_rdata_cb(void *arg, bus_dma_segment_t
 	sc->ti_rdata_phys = segs[0].ds_addr;
 	return;
 }
-	
+
 /*
  * Probe for a Tigon chip. Check the PCI vendor and device IDs
  * against our list and return its name if we find a match.
@@ -2183,7 +2183,7 @@ ti_rdata_cb(void *arg, bus_dma_segment_t
 static int
 ti_probe(device_t dev)
 {
-	const struct ti_type	*t;
+	const struct ti_type *t;
 
 	t = ti_devs;
 
@@ -2202,10 +2202,10 @@ ti_probe(device_t dev)
 static int
 ti_attach(device_t dev)
 {
-	struct ifnet		*ifp;
-	struct ti_softc		*sc;
-	int			error = 0, rid;
-	u_char			eaddr[6];
+	struct ifnet *ifp;
+	struct ti_softc *sc;
+	int error = 0, rid;
+	u_char eaddr[6];
 
 	sc = device_get_softc(dev);
 	sc->ti_unit = device_get_unit(dev);
@@ -2490,8 +2490,8 @@ fail:
 static int
 ti_detach(device_t dev)
 {
-	struct ti_softc		*sc;
-	struct ifnet		*ifp;
+	struct ti_softc *sc;
+	struct ifnet *ifp;
 
 	sc = device_get_softc(dev);
 	if (sc->dev)
@@ -2616,20 +2616,20 @@ ti_hdr_split(struct mbuf *top, int hdr_l
 static void
 ti_rxeof(struct ti_softc *sc)
 {
-	bus_dmamap_t		map;
-	struct ifnet		*ifp;
-	struct ti_cmd_desc	cmd;
+	struct ifnet *ifp;
+	bus_dmamap_t map;
+	struct ti_cmd_desc cmd;
 
 	TI_LOCK_ASSERT(sc);
 
 	ifp = sc->ti_ifp;
 
 	while (sc->ti_rx_saved_considx != sc->ti_return_prodidx.ti_idx) {
-		struct ti_rx_desc	*cur_rx;
-		u_int32_t		rxidx;
-		struct mbuf		*m = NULL;
-		u_int16_t		vlan_tag = 0;
-		int			have_tag = 0;
+		struct ti_rx_desc *cur_rx;
+		struct mbuf *m = NULL;
+		u_int32_t rxidx;
+		u_int16_t vlan_tag = 0;
+		int have_tag = 0;
 
 		cur_rx =
 		    &sc->ti_rdata->ti_rx_return_ring[sc->ti_rx_saved_considx];
@@ -2749,11 +2749,11 @@ ti_rxeof(struct ti_softc *sc)
 static void
 ti_txeof(struct ti_softc *sc)
 {
-	struct ti_txdesc	*txd;
-	struct ti_tx_desc	txdesc;
-	struct ti_tx_desc	*cur_tx = NULL;
-	struct ifnet		*ifp;
-	int			idx;
+	struct ti_txdesc *txd;
+	struct ti_tx_desc txdesc;
+	struct ti_tx_desc *cur_tx = NULL;
+	struct ifnet *ifp;
+	int idx;
 
 	ifp = sc->ti_ifp;
 
@@ -2795,8 +2795,8 @@ ti_txeof(struct ti_softc *sc)
 static void
 ti_intr(void *xsc)
 {
-	struct ti_softc		*sc;
-	struct ifnet		*ifp;
+	struct ti_softc *sc;
+	struct ifnet *ifp;
 
 	sc = xsc;
 	TI_LOCK(sc);
@@ -2837,7 +2837,7 @@ ti_intr(void *xsc)
 static void
 ti_stats_update(struct ti_softc *sc)
 {
-	struct ifnet		*ifp;
+	struct ifnet *ifp;
 
 	ifp = sc->ti_ifp;
 
@@ -2862,13 +2862,13 @@ ti_stats_update(struct ti_softc *sc)
 static int
 ti_encap(struct ti_softc *sc, struct mbuf **m_head)
 {
-	struct ti_txdesc	*txd;
-	struct ti_tx_desc	*f;
-	struct ti_tx_desc	txdesc;
-	struct mbuf		*m;
-	bus_dma_segment_t	txsegs[TI_MAXTXSEGS];
-	u_int16_t		csum_flags;
-	int			error, frag, i, nseg;
+	struct ti_txdesc *txd;
+	struct ti_tx_desc *f;
+	struct ti_tx_desc txdesc;
+	struct mbuf *m;
+	bus_dma_segment_t txsegs[TI_MAXTXSEGS];
+	u_int16_t csum_flags;
+	int error, frag, i, nseg;
 
 	if ((txd = STAILQ_FIRST(&sc->ti_cdata.ti_txfreeq)) == NULL)
 		return (ENOBUFS);
@@ -2965,7 +2965,7 @@ ti_encap(struct ti_softc *sc, struct mbu
 static void
 ti_start(struct ifnet *ifp)
 {
-	struct ti_softc		*sc;
+	struct ti_softc *sc;
 
 	sc = ifp->if_softc;
 	TI_LOCK(sc);
@@ -2980,9 +2980,9 @@ ti_start(struct ifnet *ifp)
 static void
 ti_start_locked(struct ifnet *ifp)
 {
-	struct ti_softc		*sc;
-	struct mbuf		*m_head = NULL;
-	int			enq = 0;
+	struct ti_softc *sc;
+	struct mbuf *m_head = NULL;
+	int enq = 0;
 
 	sc = ifp->if_softc;
 
@@ -3045,7 +3045,7 @@ ti_start_locked(struct ifnet *ifp)
 static void
 ti_init(void *xsc)
 {
-	struct ti_softc		*sc;
+	struct ti_softc *sc;
 
 	sc = xsc;
 	TI_LOCK(sc);
@@ -3056,7 +3056,7 @@ ti_init(void *xsc)
 static void
 ti_init_locked(void *xsc)
 {
-	struct ti_softc		*sc = xsc;
+	struct ti_softc *sc = xsc;
 
 	/* Cancel pending I/O and flush buffers. */
 	ti_stop(sc);
@@ -3070,11 +3070,11 @@ ti_init_locked(void *xsc)
 
 static void ti_init2(struct ti_softc *sc)
 {
-	struct ti_cmd_desc	cmd;
-	struct ifnet		*ifp;
-	u_int8_t		*ea;
-	struct ifmedia		*ifm;
-	int			tmp;
+	struct ti_cmd_desc cmd;
+	struct ifnet *ifp;
+	u_int8_t *ea;
+	struct ifmedia *ifm;
+	int tmp;
 
 	TI_LOCK_ASSERT(sc);
 
@@ -3160,10 +3160,10 @@ static void ti_init2(struct ti_softc *sc
 static int
 ti_ifmedia_upd(struct ifnet *ifp)
 {
-	struct ti_softc		*sc;
-	struct ifmedia		*ifm;
-	struct ti_cmd_desc	cmd;
-	u_int32_t		flowctl;
+	struct ti_softc *sc;
+	struct ifmedia *ifm;
+	struct ti_cmd_desc cmd;
+	u_int32_t flowctl;
 
 	sc = ifp->if_softc;
 	ifm = &sc->ifmedia;
@@ -3261,8 +3261,8 @@ ti_ifmedia_upd(struct ifnet *ifp)
 static void
 ti_ifmedia_sts(struct ifnet *ifp, struct ifmediareq *ifmr)
 {
-	struct ti_softc		*sc;
-	u_int32_t		media = 0;
+	struct ti_softc *sc;
+	u_int32_t media = 0;
 
 	sc = ifp->if_softc;
 
@@ -3307,10 +3307,10 @@ ti_ifmedia_sts(struct ifnet *ifp, struct
 static int
 ti_ioctl(struct ifnet *ifp, u_long command, caddr_t data)
 {
-	struct ti_softc		*sc = ifp->if_softc;
-	struct ifreq		*ifr = (struct ifreq *) data;
-	int			mask, error = 0;
-	struct ti_cmd_desc	cmd;
+	struct ti_softc *sc = ifp->if_softc;
+	struct ifreq *ifr = (struct ifreq *) data;
+	struct ti_cmd_desc cmd;
+	int mask, error = 0;
 
 	switch (command) {
 	case SIOCSIFMTU:
@@ -3425,8 +3425,8 @@ static int
 ti_ioctl2(struct cdev *dev, u_long cmd, caddr_t addr, int flag,
     struct thread *td)
 {
-	int error;
 	struct ti_softc *sc;
+	int error;
 
 	sc = dev->si_drv1;
 	if (sc == NULL)
@@ -3449,7 +3449,7 @@ ti_ioctl2(struct cdev *dev, u_long cmd, 
 	}
 	case TIIOCGETPARAMS:
 	{
-		struct ti_params	*params;
+		struct ti_params *params;
 
 		params = (struct ti_params *)addr;
 
@@ -3531,8 +3531,8 @@ ti_ioctl2(struct cdev *dev, u_long cmd, 
 		break;
 	}
 	case TIIOCGETTRACE: {
-		struct ti_trace_buf	*trace_buf;
-		u_int32_t		trace_start, cur_trace_ptr, trace_len;
+		struct ti_trace_buf *trace_buf;
+		u_int32_t trace_start, cur_trace_ptr, trace_len;
 
 		trace_buf = (struct ti_trace_buf *)addr;
 
@@ -3697,8 +3697,8 @@ ti_ioctl2(struct cdev *dev, u_long cmd, 
 static void
 ti_watchdog(void *arg)
 {
-	struct ti_softc		*sc;
-	struct ifnet		*ifp;
+	struct ti_softc *sc;
+	struct ifnet *ifp;
 
 	sc = arg;
 	TI_LOCK_ASSERT(sc);
@@ -3729,8 +3729,8 @@ ti_watchdog(void *arg)
 static void
 ti_stop(struct ti_softc *sc)
 {
-	struct ifnet		*ifp;
-	struct ti_cmd_desc	cmd;
+	struct ifnet *ifp;
+	struct ti_cmd_desc cmd;
 
 	TI_LOCK_ASSERT(sc);
 
@@ -3778,7 +3778,7 @@ ti_stop(struct ti_softc *sc)
 static int
 ti_shutdown(device_t dev)
 {
-	struct ti_softc		*sc;
+	struct ti_softc *sc;
 
 	sc = device_get_softc(dev);
 	TI_LOCK(sc);

From owner-svn-src-head@FreeBSD.ORG  Fri Nov  4 18:39:39 2011
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id B4F50106566C;
	Fri,  4 Nov 2011 18:39:39 +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 A53A38FC0A;
	Fri,  4 Nov 2011 18:39:39 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pA4IddZ0029894;
	Fri, 4 Nov 2011 18:39:39 GMT (envelope-from yongari@svn.freebsd.org)
Received: (from yongari@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id pA4IddCg029892;
	Fri, 4 Nov 2011 18:39:39 GMT (envelope-from yongari@svn.freebsd.org)
Message-Id: <201111041839.pA4IddCg029892@svn.freebsd.org>
From: Pyun YongHyeon 
Date: Fri, 4 Nov 2011 18:39: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: r227088 - head/sys/dev/ti
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: 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, 04 Nov 2011 18:39:39 -0000

Author: yongari
Date: Fri Nov  4 18:39:39 2011
New Revision: 227088
URL: http://svn.freebsd.org/changeset/base/227088

Log:
  Make ti(4) build with 'options TI_PRIVATE_JUMBOS'.
  This was broken in r175872.
  
  We have a UMA backed jumbo allocator and that is much better
  implementation than having a local jumbo buffer allocator in
  driver. This local allocator would be removed in near future but
  fixing build before removal wouldn't be a bad idea.

Modified:
  head/sys/dev/ti/if_ti.c

Modified: head/sys/dev/ti/if_ti.c
==============================================================================
--- head/sys/dev/ti/if_ti.c	Fri Nov  4 18:28:10 2011	(r227087)
+++ head/sys/dev/ti/if_ti.c	Fri Nov  4 18:39:39 2011	(r227088)
@@ -1328,7 +1328,7 @@ ti_newbuf_jumbo(struct ti_softc *sc, int
 		/* Attach the buffer to the mbuf. */
 		m_new->m_data = (void *) buf;
 		m_new->m_len = m_new->m_pkthdr.len = TI_JUMBO_FRAMELEN;
-		MEXTADD(m_new, buf, TI_JUMBO_FRAMELEN, ti_jfree,
+		MEXTADD(m_new, buf, TI_JUMBO_FRAMELEN, ti_jfree, buf,
 		    (struct ti_softc *)sc, 0, EXT_NET_DRV);
 	} else {
 		m_new = m;

From owner-svn-src-head@FreeBSD.ORG  Fri Nov  4 19:12:07 2011
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id DA5AB106566B;
	Fri,  4 Nov 2011 19:12:07 +0000 (UTC)
	(envelope-from yongari@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id C92C98FC13;
	Fri,  4 Nov 2011 19:12:07 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pA4JC7bJ030908;
	Fri, 4 Nov 2011 19:12:07 GMT (envelope-from yongari@svn.freebsd.org)
Received: (from yongari@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id pA4JC7Tu030905;
	Fri, 4 Nov 2011 19:12:07 GMT (envelope-from yongari@svn.freebsd.org)
Message-Id: <201111041912.pA4JC7Tu030905@svn.freebsd.org>
From: Pyun YongHyeon 
Date: Fri, 4 Nov 2011 19:12: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: r227089 - head/sys/dev/ti
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: 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, 04 Nov 2011 19:12:08 -0000

Author: yongari
Date: Fri Nov  4 19:12:07 2011
New Revision: 227089
URL: http://svn.freebsd.org/changeset/base/227089

Log:
  s/u_intXX_t/uintXX_t/g

Modified:
  head/sys/dev/ti/if_ti.c
  head/sys/dev/ti/if_tireg.h

Modified: head/sys/dev/ti/if_ti.c
==============================================================================
--- head/sys/dev/ti/if_ti.c	Fri Nov  4 18:39:39 2011	(r227088)
+++ head/sys/dev/ti/if_ti.c	Fri Nov  4 19:12:07 2011	(r227089)
@@ -198,20 +198,20 @@ static int ti_shutdown(device_t);
 static int ti_ifmedia_upd(struct ifnet *);
 static void ti_ifmedia_sts(struct ifnet *, struct ifmediareq *);
 
-static u_int32_t ti_eeprom_putbyte(struct ti_softc *, int);
-static u_int8_t	ti_eeprom_getbyte(struct ti_softc *, int, u_int8_t *);
+static uint32_t ti_eeprom_putbyte(struct ti_softc *, int);
+static uint8_t	ti_eeprom_getbyte(struct ti_softc *, int, uint8_t *);
 static int ti_read_eeprom(struct ti_softc *, caddr_t, int, int);
 
 static void ti_add_mcast(struct ti_softc *, struct ether_addr *);
 static void ti_del_mcast(struct ti_softc *, struct ether_addr *);
 static void ti_setmulti(struct ti_softc *);
 
-static void ti_mem_read(struct ti_softc *, u_int32_t, u_int32_t, void *);
-static void ti_mem_write(struct ti_softc *, u_int32_t, u_int32_t, void *);
-static void ti_mem_zero(struct ti_softc *, u_int32_t, u_int32_t);
-static int ti_copy_mem(struct ti_softc *, u_int32_t, u_int32_t, caddr_t, int,
+static void ti_mem_read(struct ti_softc *, uint32_t, uint32_t, void *);
+static void ti_mem_write(struct ti_softc *, uint32_t, uint32_t, void *);
+static void ti_mem_zero(struct ti_softc *, uint32_t, uint32_t);
+static int ti_copy_mem(struct ti_softc *, uint32_t, uint32_t, caddr_t, int,
     int);
-static int ti_copy_scratch(struct ti_softc *, u_int32_t, u_int32_t, caddr_t,
+static int ti_copy_scratch(struct ti_softc *, uint32_t, uint32_t, caddr_t,
     int, int, int);
 static int ti_bcopy_swap(const void *, void *, size_t, ti_swap_type);
 static void ti_loadfw(struct ti_softc *);
@@ -270,7 +270,7 @@ MODULE_DEPEND(ti, ether, 1, 1, 1);
 /*
  * Send an instruction or address to the EEPROM, check for ACK.
  */
-static u_int32_t
+static uint32_t
 ti_eeprom_putbyte(struct ti_softc *sc, int byte)
 {
 	int i, ack = 0;
@@ -315,11 +315,11 @@ ti_eeprom_putbyte(struct ti_softc *sc, i
  * We have to send two address bytes since the EEPROM can hold
  * more than 256 bytes of data.
  */
-static u_int8_t
-ti_eeprom_getbyte(struct ti_softc *sc, int addr, u_int8_t *dest)
+static uint8_t
+ti_eeprom_getbyte(struct ti_softc *sc, int addr, uint8_t *dest)
 {
 	int i;
-	u_int8_t byte = 0;
+	uint8_t byte = 0;
 
 	EEPROM_START;
 
@@ -393,7 +393,7 @@ static int
 ti_read_eeprom(struct ti_softc *sc, caddr_t dest, int off, int cnt)
 {
 	int err = 0, i;
-	u_int8_t byte = 0;
+	uint8_t byte = 0;
 
 	for (i = 0; i < cnt; i++) {
 		err = ti_eeprom_getbyte(sc, off + i, &byte);
@@ -410,7 +410,7 @@ ti_read_eeprom(struct ti_softc *sc, cadd
  * Can be used to copy data from NIC local memory.
  */
 static void
-ti_mem_read(struct ti_softc *sc, u_int32_t addr, u_int32_t len, void *buf)
+ti_mem_read(struct ti_softc *sc, uint32_t addr, uint32_t len, void *buf)
 {
 	int segptr, segsize, cnt;
 	char *ptr;
@@ -426,7 +426,7 @@ ti_mem_read(struct ti_softc *sc, u_int32
 			segsize = TI_WINLEN - (segptr % TI_WINLEN);
 		CSR_WRITE_4(sc, TI_WINBASE, (segptr & ~(TI_WINLEN - 1)));
 		bus_space_read_region_4(sc->ti_btag, sc->ti_bhandle,
-		    TI_WINDOW + (segptr & (TI_WINLEN - 1)), (u_int32_t *)ptr,
+		    TI_WINDOW + (segptr & (TI_WINLEN - 1)), (uint32_t *)ptr,
 		    segsize / 4);
 		ptr += segsize;
 		segptr += segsize;
@@ -440,7 +440,7 @@ ti_mem_read(struct ti_softc *sc, u_int32
  * Can be used to copy data into NIC local memory.
  */
 static void
-ti_mem_write(struct ti_softc *sc, u_int32_t addr, u_int32_t len, void *buf)
+ti_mem_write(struct ti_softc *sc, uint32_t addr, uint32_t len, void *buf)
 {
 	int segptr, segsize, cnt;
 	char *ptr;
@@ -456,7 +456,7 @@ ti_mem_write(struct ti_softc *sc, u_int3
 			segsize = TI_WINLEN - (segptr % TI_WINLEN);
 		CSR_WRITE_4(sc, TI_WINBASE, (segptr & ~(TI_WINLEN - 1)));
 		bus_space_write_region_4(sc->ti_btag, sc->ti_bhandle,
-		    TI_WINDOW + (segptr & (TI_WINLEN - 1)), (u_int32_t *)ptr,
+		    TI_WINDOW + (segptr & (TI_WINLEN - 1)), (uint32_t *)ptr,
 		    segsize / 4);
 		ptr += segsize;
 		segptr += segsize;
@@ -469,7 +469,7 @@ ti_mem_write(struct ti_softc *sc, u_int3
  * Can be used to clear a section of NIC local memory.
  */
 static void
-ti_mem_zero(struct ti_softc *sc, u_int32_t addr, u_int32_t len)
+ti_mem_zero(struct ti_softc *sc, uint32_t addr, uint32_t len)
 {
 	int segptr, segsize, cnt;
 
@@ -490,13 +490,13 @@ ti_mem_zero(struct ti_softc *sc, u_int32
 }
 
 static int
-ti_copy_mem(struct ti_softc *sc, u_int32_t tigon_addr, u_int32_t len,
+ti_copy_mem(struct ti_softc *sc, uint32_t tigon_addr, uint32_t len,
     caddr_t buf, int useraddr, int readdata)
 {
 	int segptr, segsize, cnt;
 	caddr_t ptr;
-	u_int32_t origwin;
-	u_int8_t tmparray[TI_WINLEN], tmparray2[TI_WINLEN];
+	uint32_t origwin;
+	uint8_t tmparray[TI_WINLEN], tmparray2[TI_WINLEN];
 	int resid, segresid;
 	int first_pass;
 
@@ -559,7 +559,7 @@ ti_copy_mem(struct ti_softc *sc, u_int32
 
 			bus_space_read_region_4(sc->ti_btag,
 						sc->ti_bhandle, ti_offset,
-						(u_int32_t *)tmparray,
+						(uint32_t *)tmparray,
 						segsize >> 2);
 			if (useraddr) {
 				/*
@@ -606,7 +606,7 @@ ti_copy_mem(struct ti_softc *sc, u_int32
 
 			bus_space_write_region_4(sc->ti_btag,
 						 sc->ti_bhandle, ti_offset,
-						 (u_int32_t *)tmparray,
+						 (uint32_t *)tmparray,
 						 segsize >> 2);
 		}
 		segptr += segsize;
@@ -618,7 +618,7 @@ ti_copy_mem(struct ti_softc *sc, u_int32
 	 * Handle leftover, non-word-aligned bytes.
 	 */
 	if (resid != 0) {
-		u_int32_t	tmpval, tmpval2;
+		uint32_t	tmpval, tmpval2;
 		bus_size_t	ti_offset;
 
 		/*
@@ -686,12 +686,12 @@ ti_copy_mem(struct ti_softc *sc, u_int32
 }
 
 static int
-ti_copy_scratch(struct ti_softc *sc, u_int32_t tigon_addr, u_int32_t len,
+ti_copy_scratch(struct ti_softc *sc, uint32_t tigon_addr, uint32_t len,
     caddr_t buf, int useraddr, int readdata, int cpu)
 {
-	u_int32_t segptr;
+	uint32_t segptr;
 	int cnt;
-	u_int32_t tmpval, tmpval2;
+	uint32_t tmpval, tmpval2;
 	caddr_t ptr;
 
 	TI_LOCK_ASSERT(sc);
@@ -782,8 +782,8 @@ ti_copy_scratch(struct ti_softc *sc, u_i
 static int
 ti_bcopy_swap(const void *src, void *dst, size_t len, ti_swap_type swap_type)
 {
-	const u_int8_t *tmpsrc;
-	u_int8_t *tmpdst;
+	const uint8_t *tmpsrc;
+	uint8_t *tmpdst;
 	size_t tmplen;
 
 	if (len & 0x3) {
@@ -798,11 +798,11 @@ ti_bcopy_swap(const void *src, void *dst
 
 	while (tmplen) {
 		if (swap_type == TI_SWAP_NTOH)
-			*(u_int32_t *)tmpdst =
-				ntohl(*(const u_int32_t *)tmpsrc);
+			*(uint32_t *)tmpdst =
+				ntohl(*(const uint32_t *)tmpsrc);
 		else
-			*(u_int32_t *)tmpdst =
-				htonl(*(const u_int32_t *)tmpsrc);
+			*(uint32_t *)tmpdst =
+				htonl(*(const uint32_t *)tmpsrc);
 
 		tmpsrc += 4;
 		tmpdst += 4;
@@ -880,7 +880,7 @@ ti_cmd(struct ti_softc *sc, struct ti_cm
 	int index;
 
 	index = sc->ti_cmd_saved_prodidx;
-	CSR_WRITE_4(sc, TI_GCR_CMDRING + (index * 4), *(u_int32_t *)(cmd));
+	CSR_WRITE_4(sc, TI_GCR_CMDRING + (index * 4), *(uint32_t *)(cmd));
 	TI_INC(index, TI_CMD_RING_CNT);
 	CSR_WRITE_4(sc, TI_MB_CMDPROD_IDX, index);
 	sc->ti_cmd_saved_prodidx = index;
@@ -897,11 +897,11 @@ ti_cmd_ext(struct ti_softc *sc, struct t
 	int i;
 
 	index = sc->ti_cmd_saved_prodidx;
-	CSR_WRITE_4(sc, TI_GCR_CMDRING + (index * 4), *(u_int32_t *)(cmd));
+	CSR_WRITE_4(sc, TI_GCR_CMDRING + (index * 4), *(uint32_t *)(cmd));
 	TI_INC(index, TI_CMD_RING_CNT);
 	for (i = 0; i < len; i++) {
 		CSR_WRITE_4(sc, TI_GCR_CMDRING + (index * 4),
-		    *(u_int32_t *)(&arg[i * 4]));
+		    *(uint32_t *)(&arg[i * 4]));
 		TI_INC(index, TI_CMD_RING_CNT);
 	}
 	CSR_WRITE_4(sc, TI_MB_CMDPROD_IDX, index);
@@ -1688,10 +1688,10 @@ static void
 ti_add_mcast(struct ti_softc *sc, struct ether_addr *addr)
 {
 	struct ti_cmd_desc cmd;
-	u_int16_t *m;
-	u_int32_t ext[2] = {0, 0};
+	uint16_t *m;
+	uint32_t ext[2] = {0, 0};
 
-	m = (u_int16_t *)&addr->octet[0];
+	m = (uint16_t *)&addr->octet[0];
 
 	switch (sc->ti_hwrev) {
 	case TI_HWREV_TIGON:
@@ -1714,10 +1714,10 @@ static void
 ti_del_mcast(struct ti_softc *sc, struct ether_addr *addr)
 {
 	struct ti_cmd_desc cmd;
-	u_int16_t *m;
-	u_int32_t ext[2] = {0, 0};
+	uint16_t *m;
+	uint32_t ext[2] = {0, 0};
 
-	m = (u_int16_t *)&addr->octet[0];
+	m = (uint16_t *)&addr->octet[0];
 
 	switch (sc->ti_hwrev) {
 	case TI_HWREV_TIGON:
@@ -1757,7 +1757,7 @@ ti_setmulti(struct ti_softc *sc)
 	struct ifmultiaddr *ifma;
 	struct ti_cmd_desc cmd;
 	struct ti_mc_entry *mc;
-	u_int32_t intrs;
+	uint32_t intrs;
 
 	TI_LOCK_ASSERT(sc);
 
@@ -1838,9 +1838,9 @@ static int ti_64bitslot_war(struct ti_so
 static int
 ti_chipinit(struct ti_softc *sc)
 {
-	u_int32_t cacheline;
-	u_int32_t pci_writemax = 0;
-	u_int32_t hdrsplit;
+	uint32_t cacheline;
+	uint32_t pci_writemax = 0;
+	uint32_t hdrsplit;
 
 	/* Initialize link to down state. */
 	sc->ti_linkstat = TI_EV_CODE_LINK_DOWN;
@@ -2627,8 +2627,8 @@ ti_rxeof(struct ti_softc *sc)
 	while (sc->ti_rx_saved_considx != sc->ti_return_prodidx.ti_idx) {
 		struct ti_rx_desc *cur_rx;
 		struct mbuf *m = NULL;
-		u_int32_t rxidx;
-		u_int16_t vlan_tag = 0;
+		uint32_t rxidx;
+		uint16_t vlan_tag = 0;
 		int have_tag = 0;
 
 		cur_rx =
@@ -2867,7 +2867,7 @@ ti_encap(struct ti_softc *sc, struct mbu
 	struct ti_tx_desc txdesc;
 	struct mbuf *m;
 	bus_dma_segment_t txsegs[TI_MAXTXSEGS];
-	u_int16_t csum_flags;
+	uint16_t csum_flags;
 	int error, frag, i, nseg;
 
 	if ((txd = STAILQ_FIRST(&sc->ti_cdata.ti_txfreeq)) == NULL)
@@ -3072,7 +3072,7 @@ static void ti_init2(struct ti_softc *sc
 {
 	struct ti_cmd_desc cmd;
 	struct ifnet *ifp;
-	u_int8_t *ea;
+	uint8_t *ea;
 	struct ifmedia *ifm;
 	int tmp;
 
@@ -3163,7 +3163,7 @@ ti_ifmedia_upd(struct ifnet *ifp)
 	struct ti_softc *sc;
 	struct ifmedia *ifm;
 	struct ti_cmd_desc cmd;
-	u_int32_t flowctl;
+	uint32_t flowctl;
 
 	sc = ifp->if_softc;
 	ifm = &sc->ifmedia;
@@ -3262,7 +3262,7 @@ static void
 ti_ifmedia_sts(struct ifnet *ifp, struct ifmediareq *ifmr)
 {
 	struct ti_softc *sc;
-	u_int32_t media = 0;
+	uint32_t media = 0;
 
 	sc = ifp->if_softc;
 
@@ -3532,7 +3532,7 @@ ti_ioctl2(struct cdev *dev, u_long cmd, 
 	}
 	case TIIOCGETTRACE: {
 		struct ti_trace_buf *trace_buf;
-		u_int32_t trace_start, cur_trace_ptr, trace_len;
+		uint32_t trace_start, cur_trace_ptr, trace_len;
 
 		trace_buf = (struct ti_trace_buf *)addr;
 
@@ -3593,7 +3593,7 @@ ti_ioctl2(struct cdev *dev, u_long cmd, 
 	case ALT_WRITE_TG_MEM:
 	{
 		struct tg_mem *mem_param;
-		u_int32_t sram_end, scratch_end;
+		uint32_t sram_end, scratch_end;
 
 		mem_param = (struct tg_mem *)addr;
 
@@ -3655,7 +3655,7 @@ ti_ioctl2(struct cdev *dev, u_long cmd, 
 	case ALT_WRITE_TG_REG:
 	{
 		struct tg_reg	*regs;
-		u_int32_t	tmpval;
+		uint32_t	tmpval;
 
 		regs = (struct tg_reg *)addr;
 

Modified: head/sys/dev/ti/if_tireg.h
==============================================================================
--- head/sys/dev/ti/if_tireg.h	Fri Nov  4 18:39:39 2011	(r227088)
+++ head/sys/dev/ti/if_tireg.h	Fri Nov  4 19:12:07 2011	(r227089)
@@ -477,8 +477,8 @@
  */
 
 typedef struct {
-	u_int32_t	ti_addr_hi;
-	u_int32_t	ti_addr_lo;
+	uint32_t	ti_addr_hi;
+	uint32_t	ti_addr_lo;
 } ti_hostaddr;
 
 #define TI_HOSTADDR(x)		x.ti_addr_lo
@@ -516,13 +516,13 @@ ti_hostaddr64(ti_hostaddr *x, bus_addr_t
 struct ti_rcb {
 	ti_hostaddr		ti_hostaddr;
 #if BYTE_ORDER == BIG_ENDIAN
-	u_int16_t		ti_max_len;
-	u_int16_t		ti_flags;
+	uint16_t		ti_max_len;
+	uint16_t		ti_flags;
 #else
-	u_int16_t		ti_flags;
-	u_int16_t		ti_max_len;
+	uint16_t		ti_flags;
+	uint16_t		ti_max_len;
 #endif
-	u_int32_t		ti_unused;
+	uint32_t		ti_unused;
 };
 
 #define TI_RCB_FLAG_TCP_UDP_CKSUM	0x00000001
@@ -536,8 +536,8 @@ struct ti_rcb {
 #define TI_RCB_FLAG_RING_DISABLED	0x00000200
 
 struct ti_producer {
-	u_int32_t		ti_idx;
-	u_int32_t		ti_unused;
+	uint32_t		ti_idx;
+	uint32_t		ti_unused;
 };
 
 /*
@@ -571,35 +571,35 @@ struct ti_gib {
 struct ti_rx_desc {
 	ti_hostaddr		ti_addr;
 #if BYTE_ORDER == BIG_ENDIAN
-	u_int16_t		ti_idx;
-	u_int16_t		ti_len;
+	uint16_t		ti_idx;
+	uint16_t		ti_len;
 #else
-	u_int16_t		ti_len;
-	u_int16_t		ti_idx;
+	uint16_t		ti_len;
+	uint16_t		ti_idx;
 #endif
 #if BYTE_ORDER == BIG_ENDIAN
-	u_int16_t		ti_type;
-	u_int16_t		ti_flags;
+	uint16_t		ti_type;
+	uint16_t		ti_flags;
 #else
-	u_int16_t		ti_flags;
-	u_int16_t		ti_type;
+	uint16_t		ti_flags;
+	uint16_t		ti_type;
 #endif
 #if BYTE_ORDER == BIG_ENDIAN
-	u_int16_t		ti_ip_cksum;
-	u_int16_t		ti_tcp_udp_cksum;
+	uint16_t		ti_ip_cksum;
+	uint16_t		ti_tcp_udp_cksum;
 #else
-	u_int16_t		ti_tcp_udp_cksum;
-	u_int16_t		ti_ip_cksum;
+	uint16_t		ti_tcp_udp_cksum;
+	uint16_t		ti_ip_cksum;
 #endif
 #if BYTE_ORDER == BIG_ENDIAN
-	u_int16_t		ti_error_flags;
-	u_int16_t		ti_vlan_tag;
+	uint16_t		ti_error_flags;
+	uint16_t		ti_vlan_tag;
 #else
-	u_int16_t		ti_vlan_tag;
-	u_int16_t		ti_error_flags;
+	uint16_t		ti_vlan_tag;
+	uint16_t		ti_error_flags;
 #endif
-	u_int32_t		ti_rsvd;
-	u_int32_t		ti_opaque;
+	uint32_t		ti_rsvd;
+	uint32_t		ti_opaque;
 };
 
 struct ti_rx_desc_ext {
@@ -607,50 +607,50 @@ struct ti_rx_desc_ext {
 	ti_hostaddr		ti_addr2;
 	ti_hostaddr		ti_addr3;
 #if BYTE_ORDER == BIG_ENDIAN
-	u_int16_t		ti_len1;
-	u_int16_t		ti_len2;
+	uint16_t		ti_len1;
+	uint16_t		ti_len2;
 #else
-	u_int16_t		ti_len2;
-	u_int16_t		ti_len1;
+	uint16_t		ti_len2;
+	uint16_t		ti_len1;
 #endif
 #if BYTE_ORDER == BIG_ENDIAN
-	u_int16_t		ti_len3;
-	u_int16_t		ti_rsvd0;
+	uint16_t		ti_len3;
+	uint16_t		ti_rsvd0;
 #else
-	u_int16_t		ti_rsvd0;
-	u_int16_t		ti_len3;
+	uint16_t		ti_rsvd0;
+	uint16_t		ti_len3;
 #endif
 	ti_hostaddr		ti_addr0;
 #if BYTE_ORDER == BIG_ENDIAN
-	u_int16_t		ti_idx;
-	u_int16_t		ti_len0;
+	uint16_t		ti_idx;
+	uint16_t		ti_len0;
 #else
-	u_int16_t		ti_len0;
-	u_int16_t		ti_idx;
+	uint16_t		ti_len0;
+	uint16_t		ti_idx;
 #endif
 #if BYTE_ORDER == BIG_ENDIAN
-	u_int16_t		ti_type;
-	u_int16_t		ti_flags;
+	uint16_t		ti_type;
+	uint16_t		ti_flags;
 #else
-	u_int16_t		ti_flags;
-	u_int16_t		ti_type;
+	uint16_t		ti_flags;
+	uint16_t		ti_type;
 #endif
 #if BYTE_ORDER == BIG_ENDIAN
-	u_int16_t		ti_ip_cksum;
-	u_int16_t		ti_tcp_udp_cksum;
+	uint16_t		ti_ip_cksum;
+	uint16_t		ti_tcp_udp_cksum;
 #else
-	u_int16_t		ti_tcp_udp_cksum;
-	u_int16_t		ti_ip_cksum;
+	uint16_t		ti_tcp_udp_cksum;
+	uint16_t		ti_ip_cksum;
 #endif
 #if BYTE_ORDER == BIG_ENDIAN
-	u_int16_t		ti_error_flags;
-	u_int16_t		ti_vlan_tag;
+	uint16_t		ti_error_flags;
+	uint16_t		ti_vlan_tag;
 #else
-	u_int16_t		ti_vlan_tag;
-	u_int16_t		ti_error_flags;
+	uint16_t		ti_vlan_tag;
+	uint16_t		ti_error_flags;
 #endif
-	u_int32_t		ti_rsvd1;
-	u_int32_t		ti_opaque;
+	uint32_t		ti_rsvd1;
+	uint32_t		ti_opaque;
 };
 
 /*
@@ -659,18 +659,18 @@ struct ti_rx_desc_ext {
 struct ti_tx_desc {
 	ti_hostaddr		ti_addr;
 #if BYTE_ORDER == BIG_ENDIAN
-	u_int16_t		ti_len;
-	u_int16_t		ti_flags;
+	uint16_t		ti_len;
+	uint16_t		ti_flags;
 #else
-	u_int16_t		ti_flags;
-	u_int16_t		ti_len;
+	uint16_t		ti_flags;
+	uint16_t		ti_len;
 #endif
 #if BYTE_ORDER == BIG_ENDIAN
-	u_int16_t		ti_rsvd;
-	u_int16_t		ti_vlan_tag;
+	uint16_t		ti_rsvd;
+	uint16_t		ti_vlan_tag;
 #else
-	u_int16_t		ti_vlan_tag;
-	u_int16_t		ti_rsvd;
+	uint16_t		ti_vlan_tag;
+	uint16_t		ti_rsvd;
 #endif
 };
 
@@ -753,7 +753,7 @@ struct ti_tx_desc {
  * Tigon command structure.
  */
 struct ti_cmd_desc {
-	u_int32_t		ti_cmdx;
+	uint32_t		ti_cmdx;
 };
 
 #define TI_CMD_CMD(cmd)		(((((cmd)->ti_cmdx)) >> 24) & 0xff)
@@ -842,8 +842,8 @@ struct ti_cmd_desc {
  * Tigon event structure.
  */
 struct ti_event_desc {
-	u_int32_t		ti_eventx;
-	u_int32_t		ti_rsvd;
+	uint32_t		ti_eventx;
+	uint32_t		ti_rsvd;
 };
 
 #define TI_EVENT_EVENT(e)	(((((e)->ti_eventx)) >> 24) & 0xff)
@@ -898,8 +898,8 @@ struct ti_event_desc {
 #define TI_JSLOTS	256
 
 #define TI_JRAWLEN (TI_JUMBO_FRAMELEN + ETHER_ALIGN)
-#define TI_JLEN (TI_JRAWLEN + (sizeof(u_int64_t) - \
-	(TI_JRAWLEN % sizeof(u_int64_t))))
+#define TI_JLEN (TI_JRAWLEN + (sizeof(uint64_t) - \
+	(TI_JRAWLEN % sizeof(uint64_t))))
 #define TI_JPAGESZ PAGE_SIZE
 #define TI_RESID (TI_JPAGESZ - (TI_JLEN * TI_JSLOTS) % TI_JPAGESZ)
 #define TI_JMEM ((TI_JLEN * TI_JSLOTS) + TI_RESID)
@@ -934,11 +934,11 @@ struct ti_ring_data {
 	 * line boundaries.
 	 */
 	struct ti_producer	ti_ev_prodidx_r;
-	u_int32_t		ti_pad0[6];
+	uint32_t		ti_pad0[6];
 	struct ti_producer	ti_return_prodidx_r;
-	u_int32_t		ti_pad1[6];
+	uint32_t		ti_pad1[6];
 	struct ti_producer	ti_tx_considx_r;
-	u_int32_t		ti_pad2[6];
+	uint32_t		ti_pad2[6];
 	struct ti_gib		ti_info;
 };
 
@@ -965,8 +965,8 @@ struct ti_chain_data {
 };
 
 struct ti_type {
-	u_int16_t		ti_vid;
-	u_int16_t		ti_did;
+	uint16_t		ti_vid;
+	uint16_t		ti_did;
 	const char		*ti_name;
 };
 
@@ -1000,10 +1000,10 @@ struct ti_softc {
 	struct resource		*ti_irq;
 	struct resource		*ti_res;
 	struct ifmedia		ifmedia;	/* media info */
-	u_int8_t		ti_unit;	/* interface number */
-	u_int8_t		ti_hwrev;	/* Tigon rev (1 or 2) */
-	u_int8_t		ti_copper;	/* 1000baseTX card */
-	u_int8_t		ti_linkstat;	/* Link state */
+	uint8_t			ti_unit;	/* interface number */
+	uint8_t			ti_hwrev;	/* Tigon rev (1 or 2) */
+	uint8_t			ti_copper;	/* 1000baseTX card */
+	uint8_t			ti_linkstat;	/* Link state */
 	int			ti_hdrsplit;	/* enable header splitting */
 	bus_dma_tag_t		ti_parent_dmat;
 	bus_dma_tag_t		ti_jumbo_dmat;
@@ -1029,12 +1029,12 @@ struct ti_softc {
 	SLIST_HEAD(__ti_mchead, ti_mc_entry)	ti_mc_listhead;
 	SLIST_HEAD(__ti_jfreehead, ti_jpool_entry)	ti_jfree_listhead;
 	SLIST_HEAD(__ti_jinusehead, ti_jpool_entry)	ti_jinuse_listhead;
-	u_int32_t		ti_stat_ticks;
-	u_int32_t		ti_rx_coal_ticks;
-	u_int32_t		ti_tx_coal_ticks;
-	u_int32_t		ti_rx_max_coal_bds;
-	u_int32_t		ti_tx_max_coal_bds;
-	u_int32_t		ti_tx_buf_ratio;
+	uint32_t		ti_stat_ticks;
+	uint32_t		ti_rx_coal_ticks;
+	uint32_t		ti_tx_coal_ticks;
+	uint32_t		ti_rx_max_coal_bds;
+	uint32_t		ti_tx_max_coal_bds;
+	uint32_t		ti_tx_buf_ratio;
 	int			ti_if_flags;
 	int			ti_txcnt;
 	struct mtx		ti_mtx;

From owner-svn-src-head@FreeBSD.ORG  Fri Nov  4 19:56:34 2011
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 98BF8106567F;
	Fri,  4 Nov 2011 19:56:34 +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 86E968FC08;
	Fri,  4 Nov 2011 19:56:34 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pA4JuYaN032221;
	Fri, 4 Nov 2011 19:56:34 GMT (envelope-from ed@svn.freebsd.org)
Received: (from ed@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id pA4JuYB1032219;
	Fri, 4 Nov 2011 19:56:34 GMT (envelope-from ed@svn.freebsd.org)
Message-Id: <201111041956.pA4JuYB1032219@svn.freebsd.org>
From: Ed Schouten 
Date: Fri, 4 Nov 2011 19:56: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: r227090 - 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: Fri, 04 Nov 2011 19:56:34 -0000

Author: ed
Date: Fri Nov  4 19:56:34 2011
New Revision: 227090
URL: http://svn.freebsd.org/changeset/base/227090

Log:
  Fix a warning emitted by Clang.
  
  The size passed to strlcat() must depend on the input length, not the
  output length. Because the input and output buffers are equal in size,
  the resulting binary does not change at all.

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

Modified: head/lib/libc/stdlib/realpath.c
==============================================================================
--- head/lib/libc/stdlib/realpath.c	Fri Nov  4 19:12:07 2011	(r227089)
+++ head/lib/libc/stdlib/realpath.c	Fri Nov  4 19:56:34 2011	(r227090)
@@ -212,7 +212,8 @@ realpath(const char * __restrict path, c
 					symlink[slen] = '/';
 					symlink[slen + 1] = 0;
 				}
-				left_len = strlcat(symlink, left, sizeof(left));
+				left_len = strlcat(symlink, left,
+				    sizeof(symlink));
 				if (left_len >= sizeof(left)) {
 					if (m)
 						free(resolved);

From owner-svn-src-head@FreeBSD.ORG  Fri Nov  4 20:25:30 2011
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id D87D7106564A;
	Fri,  4 Nov 2011 20:25:30 +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 C8B048FC0A;
	Fri,  4 Nov 2011 20:25:30 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pA4KPU8X033166;
	Fri, 4 Nov 2011 20:25:30 GMT (envelope-from yongari@svn.freebsd.org)
Received: (from yongari@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id pA4KPUnb033164;
	Fri, 4 Nov 2011 20:25:30 GMT (envelope-from yongari@svn.freebsd.org)
Message-Id: <201111042025.pA4KPUnb033164@svn.freebsd.org>
From: Pyun YongHyeon 
Date: Fri, 4 Nov 2011 20:25: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: r227091 - head/sys/dev/ti
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: 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, 04 Nov 2011 20:25:30 -0000

Author: yongari
Date: Fri Nov  4 20:25:30 2011
New Revision: 227091
URL: http://svn.freebsd.org/changeset/base/227091

Log:
  Make sure to unload loaded DMA area(descriptor, command, event ring).

Modified:
  head/sys/dev/ti/if_ti.c

Modified: head/sys/dev/ti/if_ti.c
==============================================================================
--- head/sys/dev/ti/if_ti.c	Fri Nov  4 19:56:34 2011	(r227090)
+++ head/sys/dev/ti/if_ti.c	Fri Nov  4 20:25:30 2011	(r227091)
@@ -2522,6 +2522,8 @@ ti_detach(device_t dev)
 		bus_dma_tag_destroy(sc->ti_mbuftx_dmat);
 	if (sc->ti_mbufrx_dmat)
 		bus_dma_tag_destroy(sc->ti_mbufrx_dmat);
+	if (sc->ti_rdata && sc->ti_rdata_dmamap)
+		bus_dmamap_unload(sc->ti_rdata_dmat, sc->ti_rdata_dmamap);
 	if (sc->ti_rdata)
 		bus_dmamem_free(sc->ti_rdata_dmat, sc->ti_rdata,
 				sc->ti_rdata_dmamap);

From owner-svn-src-head@FreeBSD.ORG  Fri Nov  4 20:43:38 2011
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 3C321106566B;
	Fri,  4 Nov 2011 20:43:38 +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 12D978FC1A;
	Fri,  4 Nov 2011 20:43:38 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pA4Khb0q033798;
	Fri, 4 Nov 2011 20:43:37 GMT (envelope-from yongari@svn.freebsd.org)
Received: (from yongari@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id pA4Khb6Z033796;
	Fri, 4 Nov 2011 20:43:37 GMT (envelope-from yongari@svn.freebsd.org)
Message-Id: <201111042043.pA4Khb6Z033796@svn.freebsd.org>
From: Pyun YongHyeon 
Date: Fri, 4 Nov 2011 20:43: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: r227092 - head/sys/dev/ti
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: 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, 04 Nov 2011 20:43:38 -0000

Author: yongari
Date: Fri Nov  4 20:43:37 2011
New Revision: 227092
URL: http://svn.freebsd.org/changeset/base/227092

Log:
  Announce IFCAP_LINKSTATE capability and let network stack know link
  state changes.  Hide superfluous link up/down message under
  bootverbose since if_link_state_change(9) shows that information.
  While I'm here, change baudrate with the resolved speed of the
  established link instead of blindly setting it 1G. Unfortunately,
  it seems there is no way to differentiate 10/100Mbps from
  non-gigabit link so just assume we established a 100Mbps link if
  current link is not a gigabit link.

Modified:
  head/sys/dev/ti/if_ti.c

Modified: head/sys/dev/ti/if_ti.c
==============================================================================
--- head/sys/dev/ti/if_ti.c	Fri Nov  4 20:25:30 2011	(r227091)
+++ head/sys/dev/ti/if_ti.c	Fri Nov  4 20:43:37 2011	(r227092)
@@ -924,12 +924,26 @@ ti_handle_events(struct ti_softc *sc)
 		switch (TI_EVENT_EVENT(e)) {
 		case TI_EV_LINKSTAT_CHANGED:
 			sc->ti_linkstat = TI_EVENT_CODE(e);
-			if (sc->ti_linkstat == TI_EV_CODE_LINK_UP)
-				device_printf(sc->ti_dev, "10/100 link up\n");
-			else if (sc->ti_linkstat == TI_EV_CODE_GIG_LINK_UP)
-				device_printf(sc->ti_dev, "gigabit link up\n");
-			else if (sc->ti_linkstat == TI_EV_CODE_LINK_DOWN)
-				device_printf(sc->ti_dev, "link down\n");
+			if (sc->ti_linkstat == TI_EV_CODE_LINK_UP) {
+				if_link_state_change(sc->ti_ifp, LINK_STATE_UP);
+				sc->ti_ifp->if_baudrate = IF_Mbps(100);
+				if (bootverbose)
+					device_printf(sc->ti_dev,
+					    "10/100 link up\n");
+			} else if (sc->ti_linkstat == TI_EV_CODE_GIG_LINK_UP) {
+				if_link_state_change(sc->ti_ifp, LINK_STATE_UP);
+				sc->ti_ifp->if_baudrate = IF_Gbps(1UL);
+				if (bootverbose)
+					device_printf(sc->ti_dev,
+					    "gigabit link up\n");
+			} else if (sc->ti_linkstat == TI_EV_CODE_LINK_DOWN) {
+				if_link_state_change(sc->ti_ifp,
+				    LINK_STATE_DOWN);
+				sc->ti_ifp->if_baudrate = 0;
+				if (bootverbose)
+					device_printf(sc->ti_dev,
+					    "link down\n");
+			}
 			break;
 		case TI_EV_ERROR:
 			if (TI_EVENT_CODE(e) == TI_EV_CODE_ERR_INVAL_CMD)
@@ -2417,7 +2431,7 @@ ti_attach(device_t dev)
 	ifp->if_ioctl = ti_ioctl;
 	ifp->if_start = ti_start;
 	ifp->if_init = ti_init;
-	ifp->if_baudrate = 1000000000;
+	ifp->if_baudrate = IF_Gbps(1UL);
 	ifp->if_snd.ifq_maxlen = TI_TX_RING_CNT - 1;
 
 	/* Set up ifmedia support. */
@@ -2464,6 +2478,10 @@ ti_attach(device_t dev)
 	 */
 	ether_ifattach(ifp, eaddr);
 
+	/* Driver supports link state tracking. */
+	ifp->if_capabilities |= IFCAP_LINKSTATE;
+	ifp->if_capenable |= IFCAP_LINKSTATE;
+
 	/* Hook interrupt last to avoid having to lock softc */
 	error = bus_setup_intr(dev, sc->ti_irq, INTR_TYPE_NET|INTR_MPSAFE,
 	   NULL, ti_intr, sc, &sc->ti_intrhand);

From owner-svn-src-head@FreeBSD.ORG  Fri Nov  4 21:30:46 2011
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id D745B1065675;
	Fri,  4 Nov 2011 21:30:46 +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 AE0568FC0A;
	Fri,  4 Nov 2011 21:30:46 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pA4LUkRE035309;
	Fri, 4 Nov 2011 21:30:46 GMT (envelope-from yongari@svn.freebsd.org)
Received: (from yongari@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id pA4LUkO6035307;
	Fri, 4 Nov 2011 21:30:46 GMT (envelope-from yongari@svn.freebsd.org)
Message-Id: <201111042130.pA4LUkO6035307@svn.freebsd.org>
From: Pyun YongHyeon 
Date: Fri, 4 Nov 2011 21:30: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: r227093 - head/sys/dev/ti
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: 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, 04 Nov 2011 21:30:46 -0000

Author: yongari
Date: Fri Nov  4 21:30:46 2011
New Revision: 227093
URL: http://svn.freebsd.org/changeset/base/227093

Log:
  Introduce ti_ifmedia_upd_locked() to use in driver initialization
  and add missing driver lock for both ti_ifmedia_upd() and
  ti_ifmedia_sts().

Modified:
  head/sys/dev/ti/if_ti.c

Modified: head/sys/dev/ti/if_ti.c
==============================================================================
--- head/sys/dev/ti/if_ti.c	Fri Nov  4 20:43:37 2011	(r227092)
+++ head/sys/dev/ti/if_ti.c	Fri Nov  4 21:30:46 2011	(r227093)
@@ -196,6 +196,7 @@ static void ti_stop(struct ti_softc *);
 static void ti_watchdog(void *);
 static int ti_shutdown(device_t);
 static int ti_ifmedia_upd(struct ifnet *);
+static int ti_ifmedia_upd_locked(struct ti_softc *);
 static void ti_ifmedia_sts(struct ifnet *, struct ifmediareq *);
 
 static uint32_t ti_eeprom_putbyte(struct ti_softc *, int);
@@ -3170,7 +3171,7 @@ static void ti_init2(struct ti_softc *sc
 	ifm = &sc->ifmedia;
 	tmp = ifm->ifm_media;
 	ifm->ifm_media = ifm->ifm_cur->ifm_media;
-	ti_ifmedia_upd(ifp);
+	ti_ifmedia_upd_locked(sc);
 	ifm->ifm_media = tmp;
 }
 
@@ -3181,11 +3182,23 @@ static int
 ti_ifmedia_upd(struct ifnet *ifp)
 {
 	struct ti_softc *sc;
+	int error;
+
+	sc = ifp->if_softc;
+	TI_LOCK(sc);
+	error = ti_ifmedia_upd(ifp);
+	TI_UNLOCK(sc);
+
+	return (error);
+}
+
+static int
+ti_ifmedia_upd_locked(struct ti_softc *sc)
+{
 	struct ifmedia *ifm;
 	struct ti_cmd_desc cmd;
 	uint32_t flowctl;
 
-	sc = ifp->if_softc;
 	ifm = &sc->ifmedia;
 
 	if (IFM_TYPE(ifm->ifm_media) != IFM_ETHER)
@@ -3286,11 +3299,15 @@ ti_ifmedia_sts(struct ifnet *ifp, struct
 
 	sc = ifp->if_softc;
 
+	TI_LOCK(sc);
+
 	ifmr->ifm_status = IFM_AVALID;
 	ifmr->ifm_active = IFM_ETHER;
 
-	if (sc->ti_linkstat == TI_EV_CODE_LINK_DOWN)
+	if (sc->ti_linkstat == TI_EV_CODE_LINK_DOWN) {
+		TI_UNLOCK(sc);
 		return;
+	}
 
 	ifmr->ifm_status |= IFM_ACTIVE;
 
@@ -3322,6 +3339,7 @@ ti_ifmedia_sts(struct ifnet *ifp, struct
 		if (media & TI_LNK_HALF_DUPLEX)
 			ifmr->ifm_active |= IFM_HDX;
 	}
+	TI_UNLOCK(sc);
 }
 
 static int

From owner-svn-src-head@FreeBSD.ORG  Fri Nov  4 21:42:14 2011
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 5B34C106566B;
	Fri,  4 Nov 2011 21:42:14 +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 4B3038FC15;
	Fri,  4 Nov 2011 21:42:14 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pA4LgE91035665;
	Fri, 4 Nov 2011 21:42:14 GMT (envelope-from yongari@svn.freebsd.org)
Received: (from yongari@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id pA4LgE89035663;
	Fri, 4 Nov 2011 21:42:14 GMT (envelope-from yongari@svn.freebsd.org)
Message-Id: <201111042142.pA4LgE89035663@svn.freebsd.org>
From: Pyun YongHyeon 
Date: Fri, 4 Nov 2011 21:42: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: r227094 - head/sys/dev/ti
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: 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, 04 Nov 2011 21:42:14 -0000

Author: yongari
Date: Fri Nov  4 21:42:13 2011
New Revision: 227094
URL: http://svn.freebsd.org/changeset/base/227094

Log:
  Don't clear upper 4bits from VLAN tag information.  It's
  responsibility of vlan(4) to extract VLAN id from the tag
  information and vlan(4) correctly handles it.

Modified:
  head/sys/dev/ti/if_ti.c

Modified: head/sys/dev/ti/if_ti.c
==============================================================================
--- head/sys/dev/ti/if_ti.c	Fri Nov  4 21:30:46 2011	(r227093)
+++ head/sys/dev/ti/if_ti.c	Fri Nov  4 21:42:13 2011	(r227094)
@@ -2659,7 +2659,7 @@ ti_rxeof(struct ti_softc *sc)
 
 		if (cur_rx->ti_flags & TI_BDFLAG_VLAN_TAG) {
 			have_tag = 1;
-			vlan_tag = cur_rx->ti_vlan_tag & 0xfff;
+			vlan_tag = cur_rx->ti_vlan_tag;
 		}
 
 		if (cur_rx->ti_flags & TI_BDFLAG_JUMBO_RING) {
@@ -2954,7 +2954,7 @@ ti_encap(struct ti_softc *sc, struct mbu
 		f->ti_flags = csum_flags;
 		if (m->m_flags & M_VLANTAG) {
 			f->ti_flags |= TI_BDFLAG_VLAN_TAG;
-			f->ti_vlan_tag = m->m_pkthdr.ether_vtag & 0xfff;
+			f->ti_vlan_tag = m->m_pkthdr.ether_vtag;
 		} else {
 			f->ti_vlan_tag = 0;
 		}

From owner-svn-src-head@FreeBSD.ORG  Fri Nov  4 22:53:53 2011
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 2D5A01065676;
	Fri,  4 Nov 2011 22:53:53 +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 12F9B8FC0C;
	Fri,  4 Nov 2011 22:53:53 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pA4Mrqan037884;
	Fri, 4 Nov 2011 22:53:52 GMT (envelope-from yongari@svn.freebsd.org)
Received: (from yongari@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id pA4Mrqkm037882;
	Fri, 4 Nov 2011 22:53:52 GMT (envelope-from yongari@svn.freebsd.org)
Message-Id: <201111042253.pA4Mrqkm037882@svn.freebsd.org>
From: Pyun YongHyeon 
Date: Fri, 4 Nov 2011 22:53: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: r227095 - head/sys/dev/ti
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: 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, 04 Nov 2011 22:53:53 -0000

Author: yongari
Date: Fri Nov  4 22:53:52 2011
New Revision: 227095
URL: http://svn.freebsd.org/changeset/base/227095

Log:
  Don't abuse if_hwassist and make sure enabling corresponding TX/RX
  checksum offloading and VLAN hardware tag insertion/stripping from
  the currently enabled hardware offloading capabilities.
  Previously if_hwassist, which was initialized to TX/RX checksum
  offloading, was blindly used to enable both TX and RX checksum
  offloading such that disabling either TX or RX checksum offloading
  was not possible.
  
  ti(4) controllers support TX/RX checksum offloading with VLAN
  tagging so announce TX/RX checksum offloading capability over VLAN
  to vlan(4).
  
  Make VLAN hardware tag insertion/stripping honors currently enabled
  interface capability instead of blindly enabling VLAN hardware
  tagging. This change allows disabling hardware support of VLAN tag.
  
  Because ti(4) supports VLAN oversized frames, make network stack
  know the capability by setting if_hdrlen.
  
  While I'm here, rewrite SIOCSIFCAP handler and make sure to
  reinitialize controller whenever TX/RX checksum offloading and VLAN
  hardware tagging option is changed.  The requirement of controller
  reinitialization comes from the limitation of Tigon I/II firmware.
  Tigon I/II firmware requires all related RCBs should be
  reinitialized whenever any of its hardware offloading capabilities
  change.
  
  vlan(4) is also notified whenever the parent interface's capability
  changes such that it can correctly handle TX/RX checksum offloading
  based on parent interface's enabled offloading capabilities.
  
  RX checksum offloading handler was changed to make upper stack use
  controller computed partial checksum value.  Previously, ti(4) just
  set the computed value for any frames(IPv4, IPv6) and the value was
  not used in upper stack because driver didn't set CSUM_DATA_VALID
  such that upper network stack had to recompute checksum of TCP/UDP
  packets. I have no idea how this was not noticed for a long time.
  With this change, upper network stack does not have to fully
  recompute the checksum such that calculating pseudo checksum based
  on partial checksum is sufficient to know whether received packet's
  checksum is correct or not. However, I don't know why ti(4) does
  not have controller compute pseudo checksum as controller has
  ability to do it. I'm just guessing enabling that feature could
  trigger a firmware bug or could be slower than computing it on host
  side so just leave it as it was.
  
  In order not to produce false positives, ti(4) now checks whether
  controller actually computed IP or TCP/UDP checksum by checking
  ti_flags field.

Modified:
  head/sys/dev/ti/if_ti.c

Modified: head/sys/dev/ti/if_ti.c
==============================================================================
--- head/sys/dev/ti/if_ti.c	Fri Nov  4 21:42:13 2011	(r227094)
+++ head/sys/dev/ti/if_ti.c	Fri Nov  4 22:53:52 2011	(r227095)
@@ -1252,7 +1252,7 @@ ti_newbuf_std(struct ti_softc *sc, int i
 	r->ti_len = segs.ds_len;
 	r->ti_type = TI_BDTYPE_RECV_BD;
 	r->ti_flags = 0;
-	if (sc->ti_ifp->if_hwassist)
+	if (sc->ti_ifp->if_capenable & IFCAP_RXCSUM)
 		r->ti_flags |= TI_BDFLAG_TCP_UDP_CKSUM | TI_BDFLAG_IP_CKSUM;
 	r->ti_idx = i;
 
@@ -1299,7 +1299,7 @@ ti_newbuf_mini(struct ti_softc *sc, int 
 	r->ti_len = segs.ds_len;
 	r->ti_type = TI_BDTYPE_RECV_BD;
 	r->ti_flags = TI_BDFLAG_MINI_RING;
-	if (sc->ti_ifp->if_hwassist)
+	if (sc->ti_ifp->if_capenable & IFCAP_RXCSUM)
 		r->ti_flags |= TI_BDFLAG_TCP_UDP_CKSUM | TI_BDFLAG_IP_CKSUM;
 	r->ti_idx = i;
 
@@ -1365,7 +1365,7 @@ ti_newbuf_jumbo(struct ti_softc *sc, int
 	r->ti_len = segs.ds_len;
 	r->ti_type = TI_BDTYPE_RECV_JUMBO_BD;
 	r->ti_flags = TI_BDFLAG_JUMBO_RING;
-	if (sc->ti_ifp->if_hwassist)
+	if (sc->ti_ifp->if_capenable & IFCAP_RXCSUM)
 		r->ti_flags |= TI_BDFLAG_TCP_UDP_CKSUM | TI_BDFLAG_IP_CKSUM;
 	r->ti_idx = i;
 
@@ -1507,7 +1507,7 @@ ti_newbuf_jumbo(struct ti_softc *sc, int
 
 	r->ti_flags = TI_BDFLAG_JUMBO_RING|TI_RCB_FLAG_USE_EXT_RX_BD;
 
-	if (sc->ti_ifp->if_hwassist)
+	if (sc->ti_ifp->if_capenable & IFCAP_RXCSUM)
 		r->ti_flags |= TI_BDFLAG_TCP_UDP_CKSUM|TI_BDFLAG_IP_CKSUM;
 
 	r->ti_idx = idx;
@@ -1860,11 +1860,6 @@ ti_chipinit(struct ti_softc *sc)
 	/* Initialize link to down state. */
 	sc->ti_linkstat = TI_EV_CODE_LINK_DOWN;
 
-	if (sc->ti_ifp->if_capenable & IFCAP_HWCSUM)
-		sc->ti_ifp->if_hwassist = TI_CSUM_FEATURES;
-	else
-		sc->ti_ifp->if_hwassist = 0;
-
 	/* Set endianness before we access any non-PCI registers. */
 #if 0 && BYTE_ORDER == BIG_ENDIAN
 	CSR_WRITE_4(sc, TI_MISC_HOST_CTL,
@@ -1983,7 +1978,7 @@ ti_chipinit(struct ti_softc *sc)
 	 * the firmware racks up lots of nicDmaReadRingFull
 	 * errors.  This is not compatible with hardware checksums.
 	 */
-	if (sc->ti_ifp->if_hwassist == 0)
+	if ((sc->ti_ifp->if_capenable & (IFCAP_TXCSUM | IFCAP_RXCSUM)) == 0)
 		TI_SETBIT(sc, TI_GCR_OPMODE, TI_OPMODE_1_DMA_ACTIVE);
 
 	/* Recommended settings from Tigon manual. */
@@ -2070,10 +2065,11 @@ ti_gibinit(struct ti_softc *sc)
 	TI_HOSTADDR(rcb->ti_hostaddr) = rdphys + TI_RD_OFF(ti_rx_std_ring);
 	rcb->ti_max_len = TI_FRAMELEN;
 	rcb->ti_flags = 0;
-	if (sc->ti_ifp->if_hwassist)
+	if (sc->ti_ifp->if_capenable & IFCAP_RXCSUM)
 		rcb->ti_flags |= TI_RCB_FLAG_TCP_UDP_CKSUM |
 		     TI_RCB_FLAG_IP_CKSUM | TI_RCB_FLAG_NO_PHDR_CKSUM;
-	rcb->ti_flags |= TI_RCB_FLAG_VLAN_ASSIST;
+	if (sc->ti_ifp->if_capenable & IFCAP_VLAN_HWTAGGING)
+		rcb->ti_flags |= TI_RCB_FLAG_VLAN_ASSIST;
 
 	/* Set up the jumbo receive ring. */
 	rcb = &sc->ti_rdata->ti_info.ti_jumbo_rx_rcb;
@@ -2086,10 +2082,11 @@ ti_gibinit(struct ti_softc *sc)
 	rcb->ti_max_len = PAGE_SIZE;
 	rcb->ti_flags = TI_RCB_FLAG_USE_EXT_RX_BD;
 #endif
-	if (sc->ti_ifp->if_hwassist)
+	if (sc->ti_ifp->if_capenable & IFCAP_RXCSUM)
 		rcb->ti_flags |= TI_RCB_FLAG_TCP_UDP_CKSUM |
 		     TI_RCB_FLAG_IP_CKSUM | TI_RCB_FLAG_NO_PHDR_CKSUM;
-	rcb->ti_flags |= TI_RCB_FLAG_VLAN_ASSIST;
+	if (sc->ti_ifp->if_capenable & IFCAP_VLAN_HWTAGGING)
+		rcb->ti_flags |= TI_RCB_FLAG_VLAN_ASSIST;
 
 	/*
 	 * Set up the mini ring. Only activated on the
@@ -2103,10 +2100,11 @@ ti_gibinit(struct ti_softc *sc)
 		rcb->ti_flags = TI_RCB_FLAG_RING_DISABLED;
 	else
 		rcb->ti_flags = 0;
-	if (sc->ti_ifp->if_hwassist)
+	if (sc->ti_ifp->if_capenable & IFCAP_RXCSUM)
 		rcb->ti_flags |= TI_RCB_FLAG_TCP_UDP_CKSUM |
 		     TI_RCB_FLAG_IP_CKSUM | TI_RCB_FLAG_NO_PHDR_CKSUM;
-	rcb->ti_flags |= TI_RCB_FLAG_VLAN_ASSIST;
+	if (sc->ti_ifp->if_capenable & IFCAP_VLAN_HWTAGGING)
+		rcb->ti_flags |= TI_RCB_FLAG_VLAN_ASSIST;
 
 	/*
 	 * Set up the receive return ring.
@@ -2135,8 +2133,9 @@ ti_gibinit(struct ti_softc *sc)
 		rcb->ti_flags = 0;
 	else
 		rcb->ti_flags = TI_RCB_FLAG_HOST_RING;
-	rcb->ti_flags |= TI_RCB_FLAG_VLAN_ASSIST;
-	if (sc->ti_ifp->if_hwassist)
+	if (sc->ti_ifp->if_capenable & IFCAP_VLAN_HWTAGGING)
+		rcb->ti_flags |= TI_RCB_FLAG_VLAN_ASSIST;
+	if (sc->ti_ifp->if_capenable & IFCAP_TXCSUM)
 		rcb->ti_flags |= TI_RCB_FLAG_TCP_UDP_CKSUM |
 		     TI_RCB_FLAG_IP_CKSUM | TI_RCB_FLAG_NO_PHDR_CKSUM;
 	rcb->ti_max_len = TI_TX_RING_CNT;
@@ -2236,8 +2235,8 @@ ti_attach(device_t dev)
 		error = ENOSPC;
 		goto fail;
 	}
-	sc->ti_ifp->if_capabilities = IFCAP_HWCSUM |
-	    IFCAP_VLAN_HWTAGGING | IFCAP_VLAN_MTU;
+	sc->ti_ifp->if_hwassist = TI_CSUM_FEATURES;
+	sc->ti_ifp->if_capabilities = IFCAP_TXCSUM | IFCAP_RXCSUM;
 	sc->ti_ifp->if_capenable = sc->ti_ifp->if_capabilities;
 
 	/*
@@ -2479,6 +2478,13 @@ ti_attach(device_t dev)
 	 */
 	ether_ifattach(ifp, eaddr);
 
+	/* VLAN capability setup. */
+	ifp->if_capabilities |= IFCAP_VLAN_MTU | IFCAP_VLAN_HWCSUM |
+	    IFCAP_VLAN_HWTAGGING;
+	ifp->if_capenable = ifp->if_capabilities;
+	/* Tell the upper layer we support VLAN over-sized frames. */
+	ifp->if_hdrlen = sizeof(struct ether_vlan_header);
+
 	/* Driver supports link state tracking. */
 	ifp->if_capabilities |= IFCAP_LINKSTATE;
 	ifp->if_capenable |= IFCAP_LINKSTATE;
@@ -2736,12 +2742,17 @@ ti_rxeof(struct ti_softc *sc)
 		ifp->if_ipackets++;
 		m->m_pkthdr.rcvif = ifp;
 
-		if (ifp->if_hwassist) {
-			m->m_pkthdr.csum_flags |= CSUM_IP_CHECKED |
-			    CSUM_DATA_VALID;
-			if ((cur_rx->ti_ip_cksum ^ 0xffff) == 0)
-				m->m_pkthdr.csum_flags |= CSUM_IP_VALID;
-			m->m_pkthdr.csum_data = cur_rx->ti_tcp_udp_cksum;
+		if (ifp->if_capenable & IFCAP_RXCSUM) {
+			if (cur_rx->ti_flags & TI_BDFLAG_IP_CKSUM) {
+				m->m_pkthdr.csum_flags |= CSUM_IP_CHECKED;
+				if ((cur_rx->ti_ip_cksum ^ 0xffff) == 0)
+					m->m_pkthdr.csum_flags |= CSUM_IP_VALID;
+			}
+			if (cur_rx->ti_flags & TI_BDFLAG_TCP_UDP_CKSUM) {
+				m->m_pkthdr.csum_data =
+				    cur_rx->ti_tcp_udp_cksum;
+				m->m_pkthdr.csum_flags |= CSUM_DATA_VALID;
+			}
 		}
 
 		/*
@@ -3406,15 +3417,32 @@ ti_ioctl(struct ifnet *ifp, u_long comma
 	case SIOCSIFCAP:
 		TI_LOCK(sc);
 		mask = ifr->ifr_reqcap ^ ifp->if_capenable;
-		if (mask & IFCAP_HWCSUM) {
-			if (IFCAP_HWCSUM & ifp->if_capenable)
-				ifp->if_capenable &= ~IFCAP_HWCSUM;
-			else
-				ifp->if_capenable |= IFCAP_HWCSUM;
-			if (ifp->if_drv_flags & IFF_DRV_RUNNING)
+		if ((mask & IFCAP_TXCSUM) != 0 &&
+		    (ifp->if_capabilities & IFCAP_TXCSUM) != 0) {
+			ifp->if_capenable ^= IFCAP_TXCSUM;
+			if ((ifp->if_capenable & IFCAP_TXCSUM) != 0)
+				ifp->if_hwassist |= TI_CSUM_FEATURES;
+                        else
+				ifp->if_hwassist &= ~TI_CSUM_FEATURES;
+                }
+		if ((mask & IFCAP_RXCSUM) != 0 &&
+		    (ifp->if_capabilities & IFCAP_RXCSUM) != 0)
+			ifp->if_capenable ^= IFCAP_RXCSUM;
+		if ((mask & IFCAP_VLAN_HWTAGGING) != 0 &&
+		    (ifp->if_capabilities & IFCAP_VLAN_HWTAGGING) != 0)
+                        ifp->if_capenable ^= IFCAP_VLAN_HWTAGGING;
+		if ((mask & IFCAP_VLAN_HWCSUM) != 0 &&
+		    (ifp->if_capabilities & IFCAP_VLAN_HWCSUM) != 0)
+			ifp->if_capenable ^= IFCAP_VLAN_HWCSUM;
+		if ((mask & (IFCAP_TXCSUM | IFCAP_RXCSUM |
+		    IFCAP_VLAN_HWTAGGING)) != 0) {
+			if (ifp->if_drv_flags & IFF_DRV_RUNNING) {
+				ifp->if_drv_flags &= ~IFF_DRV_RUNNING;
 				ti_init_locked(sc);
+			}
 		}
 		TI_UNLOCK(sc);
+		VLAN_CAPABILITIES(ifp);
 		break;
 	default:
 		error = ether_ioctl(ifp, command, data);

From owner-svn-src-head@FreeBSD.ORG  Fri Nov  4 23:09:57 2011
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 6A5B4106566C;
	Fri,  4 Nov 2011 23:09:57 +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 5A3768FC19;
	Fri,  4 Nov 2011 23:09:57 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pA4N9vFu038467;
	Fri, 4 Nov 2011 23:09:57 GMT (envelope-from yongari@svn.freebsd.org)
Received: (from yongari@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id pA4N9v0R038465;
	Fri, 4 Nov 2011 23:09:57 GMT (envelope-from yongari@svn.freebsd.org)
Message-Id: <201111042309.pA4N9v0R038465@svn.freebsd.org>
From: Pyun YongHyeon 
Date: Fri, 4 Nov 2011 23:09: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: r227098 - head/sys/dev/ti
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: 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, 04 Nov 2011 23:09:57 -0000

Author: yongari
Date: Fri Nov  4 23:09:57 2011
New Revision: 227098
URL: http://svn.freebsd.org/changeset/base/227098

Log:
  Because ti(4) drops a driver lock in RX handler, check whether
  driver is still running before re-enabling interrupts.

Modified:
  head/sys/dev/ti/if_ti.c

Modified: head/sys/dev/ti/if_ti.c
==============================================================================
--- head/sys/dev/ti/if_ti.c	Fri Nov  4 22:58:34 2011	(r227097)
+++ head/sys/dev/ti/if_ti.c	Fri Nov  4 23:09:57 2011	(r227098)
@@ -2856,12 +2856,12 @@ ti_intr(void *xsc)
 
 	ti_handle_events(sc);
 
-	/* Re-enable interrupts. */
-	CSR_WRITE_4(sc, TI_MB_HOSTINTR, 0);
-
 	if (ifp->if_drv_flags & IFF_DRV_RUNNING &&
-	    ifp->if_snd.ifq_head != NULL)
+	    ifp->if_snd.ifq_head != NULL) {
+		/* Re-enable interrupts. */
+		CSR_WRITE_4(sc, TI_MB_HOSTINTR, 0);
 		ti_start_locked(ifp);
+	}
 
 	TI_UNLOCK(sc);
 }

From owner-svn-src-head@FreeBSD.ORG  Fri Nov  4 23:34:54 2011
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id D3FEB106564A;
	Fri,  4 Nov 2011 23:34:54 +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 A6AF08FC0C;
	Fri,  4 Nov 2011 23:34:54 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pA4NYsQ2039267;
	Fri, 4 Nov 2011 23:34:54 GMT (envelope-from yongari@svn.freebsd.org)
Received: (from yongari@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id pA4NYswA039265;
	Fri, 4 Nov 2011 23:34:54 GMT (envelope-from yongari@svn.freebsd.org)
Message-Id: <201111042334.pA4NYswA039265@svn.freebsd.org>
From: Pyun YongHyeon 
Date: Fri, 4 Nov 2011 23:34: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: r227099 - head/sys/dev/ti
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: 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, 04 Nov 2011 23:34:54 -0000

Author: yongari
Date: Fri Nov  4 23:34:54 2011
New Revision: 227099
URL: http://svn.freebsd.org/changeset/base/227099

Log:
  Implement altq(4) support.
  While I'm here fix a logic error in r227098 where it didn't
  re-enable interrupts when TX queue is empty.

Modified:
  head/sys/dev/ti/if_ti.c

Modified: head/sys/dev/ti/if_ti.c
==============================================================================
--- head/sys/dev/ti/if_ti.c	Fri Nov  4 23:09:57 2011	(r227098)
+++ head/sys/dev/ti/if_ti.c	Fri Nov  4 23:34:54 2011	(r227099)
@@ -2432,7 +2432,9 @@ ti_attach(device_t dev)
 	ifp->if_start = ti_start;
 	ifp->if_init = ti_init;
 	ifp->if_baudrate = IF_Gbps(1UL);
-	ifp->if_snd.ifq_maxlen = TI_TX_RING_CNT - 1;
+	ifp->if_snd.ifq_drv_maxlen = TI_TX_RING_CNT - 1;
+	IFQ_SET_MAXLEN(&ifp->if_snd, ifp->if_snd.ifq_drv_maxlen);
+	IFQ_SET_READY(&ifp->if_snd);
 
 	/* Set up ifmedia support. */
 	if (sc->ti_copper) {
@@ -2856,11 +2858,11 @@ ti_intr(void *xsc)
 
 	ti_handle_events(sc);
 
-	if (ifp->if_drv_flags & IFF_DRV_RUNNING &&
-	    ifp->if_snd.ifq_head != NULL) {
+	if (ifp->if_drv_flags & IFF_DRV_RUNNING) {
 		/* Re-enable interrupts. */
 		CSR_WRITE_4(sc, TI_MB_HOSTINTR, 0);
-		ti_start_locked(ifp);
+		if (!IFQ_DRV_IS_EMPTY(&ifp->if_snd))
+			ti_start_locked(ifp);
 	}
 
 	TI_UNLOCK(sc);
@@ -3018,9 +3020,9 @@ ti_start_locked(struct ifnet *ifp)
 
 	sc = ifp->if_softc;
 
-	for (; ifp->if_snd.ifq_head != NULL &&
+	for (; !IFQ_DRV_IS_EMPTY(&ifp->if_snd) &&
 	    sc->ti_txcnt < (TI_TX_RING_CNT - 16);) {
-		IF_DEQUEUE(&ifp->if_snd, m_head);
+		IFQ_DRV_DEQUEUE(&ifp->if_snd, m_head);
 		if (m_head == NULL)
 			break;
 
@@ -3036,7 +3038,7 @@ ti_start_locked(struct ifnet *ifp)
 		    m_head->m_pkthdr.csum_flags & (CSUM_DELAY_DATA)) {
 			if ((TI_TX_RING_CNT - sc->ti_txcnt) <
 			    m_head->m_pkthdr.csum_data + 16) {
-				IF_PREPEND(&ifp->if_snd, m_head);
+				IFQ_DRV_PREPEND(&ifp->if_snd, m_head);
 				ifp->if_drv_flags |= IFF_DRV_OACTIVE;
 				break;
 			}
@@ -3050,7 +3052,7 @@ ti_start_locked(struct ifnet *ifp)
 		if (ti_encap(sc, &m_head)) {
 			if (m_head == NULL)
 				break;
-			IF_PREPEND(&ifp->if_snd, m_head);
+			IFQ_DRV_PREPEND(&ifp->if_snd, m_head);
 			ifp->if_drv_flags |= IFF_DRV_OACTIVE;
 			break;
 		}

From owner-svn-src-head@FreeBSD.ORG  Sat Nov  5 07:18:53 2011
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id B5573106564A;
	Sat,  5 Nov 2011 07:18:53 +0000 (UTC) (envelope-from ed@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id A38868FC14;
	Sat,  5 Nov 2011 07:18:53 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pA57Irq1053811;
	Sat, 5 Nov 2011 07:18:53 GMT (envelope-from ed@svn.freebsd.org)
Received: (from ed@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id pA57Ir75053803;
	Sat, 5 Nov 2011 07:18:53 GMT (envelope-from ed@svn.freebsd.org)
Message-Id: <201111050718.pA57Ir75053803@svn.freebsd.org>
From: Ed Schouten 
Date: Sat, 5 Nov 2011 07:18: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: r227101 - in head/games: bcd caesar fortune/fortune
	fortune/unstr grdc morse number
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: 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, 05 Nov 2011 07:18:53 -0000

Author: ed
Date: Sat Nov  5 07:18:53 2011
New Revision: 227101
URL: http://svn.freebsd.org/changeset/base/227101

Log:
  Add static keywords to variables and functions where possible in games/.
  
  This allows us to detect unused functions and variables and allows the
  compiler to do a better job at optimisation.

Modified:
  head/games/bcd/bcd.c
  head/games/caesar/caesar.c
  head/games/fortune/fortune/fortune.c
  head/games/fortune/unstr/unstr.c
  head/games/grdc/grdc.c
  head/games/morse/morse.c
  head/games/number/number.c

Modified: head/games/bcd/bcd.c
==============================================================================
--- head/games/bcd/bcd.c	Sat Nov  5 01:42:54 2011	(r227100)
+++ head/games/bcd/bcd.c	Sat Nov  5 07:18:53 2011	(r227101)
@@ -82,7 +82,7 @@ static const char rcsid[] =
 #include 
 #include 
 
-u_short holes[256] = {
+static u_short holes[256] = {
     0x0,	 0x0,	  0x0,	   0x0,	    0x0,     0x0,     0x0,     0x0,
     0x0,	 0x0,	  0x0,	   0x0,	    0x0,     0x0,     0x0,     0x0,
     0x0,	 0x0,	  0x0,	   0x0,	    0x0,     0x0,     0x0,     0x0,
@@ -117,7 +117,7 @@ u_short holes[256] = {
     0x202,	 0x201,	  0x082,   0x806,   0x822,   0x600,   0x282,   0x0
 };
 
-void printcard(char *);
+static void printcard(char *);
 
 /*
  * i'th bit of w.
@@ -148,7 +148,7 @@ main(int argc, char **argv)
 
 #define	COLUMNS	48
 
-void
+static void
 printcard(char *str)
 {
 	static char rowchars[] = "   123456789";

Modified: head/games/caesar/caesar.c
==============================================================================
--- head/games/caesar/caesar.c	Sat Nov  5 01:42:54 2011	(r227100)
+++ head/games/caesar/caesar.c	Sat Nov  5 07:18:53 2011	(r227101)
@@ -67,13 +67,13 @@ __FBSDID("$FreeBSD$");
  * letter frequencies (taken from some unix(tm) documentation)
  * (unix is a trademark of Bell Laboratories)
  */
-double stdf[26] = {
+static double stdf[26] = {
 	7.97, 1.35, 3.61, 4.78, 12.37, 2.01, 1.46, 4.49, 6.39, 0.04,
 	0.42, 3.81, 2.69, 5.92,  6.96, 2.91, 0.08, 6.63, 8.77, 9.68,
 	2.62, 0.81, 1.88, 0.23,  2.07, 0.06,
 };
 
-void printit(char *);
+static void printit(char *);
 
 int
 main(int argc, char **argv)
@@ -147,7 +147,7 @@ main(int argc, char **argv)
 	exit(0);
 }
 
-void
+static void
 printit(char *arg)
 {
 	int ch, rot;

Modified: head/games/fortune/fortune/fortune.c
==============================================================================
--- head/games/fortune/fortune/fortune.c	Sat Nov  5 01:42:54 2011	(r227100)
+++ head/games/fortune/fortune/fortune.c	Sat Nov  5 07:18:53 2011	(r227101)
@@ -97,73 +97,71 @@ typedef struct fd {
 	struct fd	*next, *prev;
 } FILEDESC;
 
-bool	Found_one;			/* did we find a match? */
-bool	Find_files	= FALSE;	/* just find a list of proper fortune files */
-bool	Fortunes_only   = FALSE;	/* check only "fortunes" files */
-bool	Wait		= FALSE;	/* wait desired after fortune */
-bool	Short_only	= FALSE;	/* short fortune desired */
-bool	Long_only	= FALSE;	/* long fortune desired */
-bool	Offend		= FALSE;	/* offensive fortunes only */
-bool	All_forts	= FALSE;	/* any fortune allowed */
-bool	Equal_probs	= FALSE;	/* scatter un-allocted prob equally */
-bool	Match		= FALSE;	/* dump fortunes matching a pattern */
+static bool	Found_one;		/* did we find a match? */
+static bool	Find_files = FALSE;	/* just find a list of proper fortune files */
+static bool	Fortunes_only = FALSE;	/* check only "fortunes" files */
+static bool	Wait = FALSE;		/* wait desired after fortune */
+static bool	Short_only = FALSE;	/* short fortune desired */
+static bool	Long_only = FALSE;	/* long fortune desired */
+static bool	Offend = FALSE;		/* offensive fortunes only */
+static bool	All_forts = FALSE;	/* any fortune allowed */
+static bool	Equal_probs = FALSE;	/* scatter un-allocted prob equally */
+static bool	Match = FALSE;		/* dump fortunes matching a pattern */
 #ifdef DEBUG
-bool	Debug = FALSE;			/* print debug messages */
+static bool	Debug = FALSE;		/* print debug messages */
 #endif
 
-char	*Fortbuf = NULL;			/* fortune buffer for -m */
+static char	*Fortbuf = NULL;	/* fortune buffer for -m */
 
-int	Fort_len = 0;
+static int	Fort_len = 0;
 
-off_t	Seekpts[2];                     /* seek pointers to fortunes */
+static off_t	Seekpts[2];		/* seek pointers to fortunes */
 
-FILEDESC	*File_list = NULL,	/* Head of file list */
+static FILEDESC	*File_list = NULL,	/* Head of file list */
 		*File_tail = NULL;	/* Tail of file list */
-FILEDESC	*Fortfile;		/* Fortune file to use */
+static FILEDESC	*Fortfile;		/* Fortune file to use */
 
-STRFILE		Noprob_tbl;		/* sum of data for all no prob files */
+static STRFILE	Noprob_tbl;		/* sum of data for all no prob files */
 
-const char	*Fortune_path;
-char	**Fortune_path_arr;
+static const char *Fortune_path;
+static char	**Fortune_path_arr;
 
-int	 add_dir(FILEDESC *);
-int	 add_file(int, const char *, const char *, FILEDESC **, FILEDESC **,
-	    FILEDESC *);
-void	 all_forts(FILEDESC *, char *);
-char	*copy(const char *, u_int);
-void	 display(FILEDESC *);
-void	 do_free(void *);
-void	*do_malloc(u_int);
-int	 form_file_list(char **, int);
-int	 fortlen(void);
-void	 get_fort(void);
-void	 get_pos(FILEDESC *);
-void	 get_tbl(FILEDESC *);
-void	 getargs(int, char *[]);
-void	 getpath(void);
-void	 init_prob(void);
-int	 is_dir(const char *);
-int	 is_fortfile(const char *, char **, char **, int);
-int	 is_off_name(const char *);
-int	 max(int, int);
-FILEDESC *
-	 new_fp(void);
-char	*off_name(const char *);
-void	 open_dat(FILEDESC *);
-void	 open_fp(FILEDESC *);
-FILEDESC *
-	 pick_child(FILEDESC *);
-void	 print_file_list(void);
-void	 print_list(FILEDESC *, int);
-void	 sum_noprobs(FILEDESC *);
-void	 sum_tbl(STRFILE *, STRFILE *);
-void	 usage(void);
-void	 zero_tbl(STRFILE *);
-
-char	*conv_pat(char *);
-int	 find_matches(void);
-void	 matches_in_list(FILEDESC *);
-int	 maxlen_in_list(FILEDESC *);
+static int	 add_dir(FILEDESC *);
+static int	 add_file(int, const char *, const char *, FILEDESC **,
+		     FILEDESC **, FILEDESC *);
+static void	 all_forts(FILEDESC *, char *);
+static char	*copy(const char *, u_int);
+static void	 display(FILEDESC *);
+static void	 do_free(void *);
+static void	*do_malloc(u_int);
+static int	 form_file_list(char **, int);
+static int	 fortlen(void);
+static void	 get_fort(void);
+static void	 get_pos(FILEDESC *);
+static void	 get_tbl(FILEDESC *);
+static void	 getargs(int, char *[]);
+static void	 getpath(void);
+static void	 init_prob(void);
+static int	 is_dir(const char *);
+static int	 is_fortfile(const char *, char **, char **, int);
+static int	 is_off_name(const char *);
+static int	 max(int, int);
+static FILEDESC *new_fp(void);
+static char	*off_name(const char *);
+static void	 open_dat(FILEDESC *);
+static void	 open_fp(FILEDESC *);
+static FILEDESC *pick_child(FILEDESC *);
+static void	 print_file_list(void);
+static void	 print_list(FILEDESC *, int);
+static void	 sum_noprobs(FILEDESC *);
+static void	 sum_tbl(STRFILE *, STRFILE *);
+static void	 usage(void);
+static void	 zero_tbl(STRFILE *);
+
+static char	*conv_pat(char *);
+static int	 find_matches(void);
+static void	 matches_in_list(FILEDESC *);
+static int	 maxlen_in_list(FILEDESC *);
 
 static regex_t Re_pat;
 
@@ -219,7 +217,7 @@ main(int argc, char *argv[])
 	exit(0);
 }
 
-void
+static void
 display(FILEDESC *fp)
 {
 	char   *p;
@@ -252,7 +250,7 @@ display(FILEDESC *fp)
  * fortlen:
  *	Return the length of the fortune.
  */
-int
+static int
 fortlen(void)
 {
 	int	nchar;
@@ -276,7 +274,7 @@ fortlen(void)
 /*
  *	This routine evaluates the arguments on the command line
  */
-void
+static void
 getargs(int argc, char *argv[])
 {
 	int	ignore_case;
@@ -362,7 +360,7 @@ getargs(int argc, char *argv[])
  * form_file_list:
  *	Form the file list from the file specifications.
  */
-int
+static int
 form_file_list(char **files, int file_cnt)
 {
 	int	i, percent;
@@ -456,7 +454,7 @@ form_file_list(char **files, int file_cn
  * add_file:
  *	Add a file to the file list.
  */
-int
+static int
 add_file(int percent, const char *file, const char *dir, FILEDESC **head,
     FILEDESC **tail, FILEDESC *parent)
 {
@@ -598,7 +596,7 @@ over:
  * new_fp:
  *	Return a pointer to an initialized new FILEDESC.
  */
-FILEDESC *
+static FILEDESC *
 new_fp(void)
 {
 	FILEDESC	*fp;
@@ -624,7 +622,7 @@ new_fp(void)
  * off_name:
  *	Return a pointer to the offensive version of a file of this name.
  */
-char *
+static char *
 off_name(const char *file)
 {
 	char	*new;
@@ -638,7 +636,7 @@ off_name(const char *file)
  * is_off_name:
  *	Is the file an offensive-style name?
  */
-int
+static int
 is_off_name(const char *file)
 {
 	int	len;
@@ -653,7 +651,7 @@ is_off_name(const char *file)
  *	Modify a FILEDESC element to be the parent of two children if
  *	there are two children to be a parent of.
  */
-void
+static void
 all_forts(FILEDESC *fp, char *offensive)
 {
 	char		*sp;
@@ -701,7 +699,7 @@ all_forts(FILEDESC *fp, char *offensive)
  * add_dir:
  *	Add the contents of an entire directory.
  */
-int
+static int
 add_dir(FILEDESC *fp)
 {
 	DIR		*dir;
@@ -740,7 +738,7 @@ add_dir(FILEDESC *fp)
  * is_dir:
  *	Return TRUE if the file is a directory, FALSE otherwise.
  */
-int
+static int
 is_dir(const char *file)
 {
 	struct stat	sbuf;
@@ -759,7 +757,7 @@ is_dir(const char *file)
  *	suffixes, as contained in suflist[], are ruled out.
  */
 /* ARGSUSED */
-int
+static int
 is_fortfile(const char *file, char **datp, char **posp, int check_for_offend)
 {
 	int	i;
@@ -840,7 +838,7 @@ is_fortfile(const char *file, char **dat
  * copy:
  *	Return a malloc()'ed copy of the string
  */
-char *
+static char *
 copy(const char *str, unsigned int len)
 {
 	char *new, *sp;
@@ -858,7 +856,7 @@ copy(const char *str, unsigned int len)
  * do_malloc:
  *	Do a malloc, checking for NULL return.
  */
-void *
+static void *
 do_malloc(unsigned int size)
 {
 	void *new;
@@ -875,7 +873,7 @@ do_malloc(unsigned int size)
  * do_free:
  *	Free malloc'ed space, if any.
  */
-void
+static void
 do_free(void *ptr)
 {
 	if (ptr != NULL)
@@ -886,7 +884,7 @@ do_free(void *ptr)
  * init_prob:
  *	Initialize the fortune probabilities.
  */
-void
+static void
 init_prob(void)
 {
 	FILEDESC       *fp, *last = NULL;
@@ -955,7 +953,7 @@ init_prob(void)
  * get_fort:
  *	Get the fortune data file's seek pointer for the next fortune.
  */
-void
+static void
 get_fort(void)
 {
 	FILEDESC	*fp;
@@ -1018,7 +1016,7 @@ get_fort(void)
  * pick_child
  *	Pick a child from a chosen parent.
  */
-FILEDESC *
+static FILEDESC *
 pick_child(FILEDESC *parent)
 {
 	FILEDESC	*fp;
@@ -1054,7 +1052,7 @@ pick_child(FILEDESC *parent)
  * sum_noprobs:
  *	Sum up all the noprob probabilities, starting with fp.
  */
-void
+static void
 sum_noprobs(FILEDESC *fp)
 {
 	static bool	did_noprobs = FALSE;
@@ -1070,7 +1068,7 @@ sum_noprobs(FILEDESC *fp)
 	did_noprobs = TRUE;
 }
 
-int
+static int
 max(int i, int j)
 {
 	return (i >= j ? i : j);
@@ -1080,7 +1078,7 @@ max(int i, int j)
  * open_fp:
  *	Assocatiate a FILE * with the given FILEDESC.
  */
-void
+static void
 open_fp(FILEDESC *fp)
 {
 	if (fp->inf == NULL && (fp->inf = fdopen(fp->fd, "r")) == NULL) {
@@ -1093,7 +1091,7 @@ open_fp(FILEDESC *fp)
  * open_dat:
  *	Open up the dat file if we need to.
  */
-void
+static void
 open_dat(FILEDESC *fp)
 {
 	if (fp->datfd < 0 && (fp->datfd = open(fp->datfile, O_RDONLY)) < 0) {
@@ -1107,7 +1105,7 @@ open_dat(FILEDESC *fp)
  *	Get the position from the pos file, if there is one.  If not,
  *	return a random number.
  */
-void
+static void
 get_pos(FILEDESC *fp)
 {
 #ifdef OK_TO_WRITE_DISK
@@ -1137,7 +1135,7 @@ get_pos(FILEDESC *fp)
  * get_tbl:
  *	Get the tbl data file the datfile.
  */
-void
+static void
 get_tbl(FILEDESC *fp)
 {
 	int		fd;
@@ -1176,7 +1174,7 @@ get_tbl(FILEDESC *fp)
  * zero_tbl:
  *	Zero out the fields we care about in a tbl structure.
  */
-void
+static void
 zero_tbl(STRFILE *tp)
 {
 	tp->str_numstr = 0;
@@ -1188,7 +1186,7 @@ zero_tbl(STRFILE *tp)
  * sum_tbl:
  *	Merge the tbl data of t2 into t1.
  */
-void
+static void
 sum_tbl(STRFILE *t1, STRFILE *t2)
 {
 	t1->str_numstr += t2->str_numstr;
@@ -1204,7 +1202,7 @@ sum_tbl(STRFILE *t1, STRFILE *t2)
  * print_file_list:
  *	Print out the file list
  */
-void
+static void
 print_file_list(void)
 {
 	print_list(File_list, 0);
@@ -1214,7 +1212,7 @@ print_file_list(void)
  * print_list:
  *	Print out the actual list, recursively.
  */
-void
+static void
 print_list(FILEDESC *list, int lev)
 {
 	while (list != NULL) {
@@ -1237,7 +1235,7 @@ print_list(FILEDESC *list, int lev)
  * conv_pat:
  *	Convert the pattern to an ignore-case equivalent.
  */
-char *
+static char *
 conv_pat(char *orig)
 {
 	char		*sp;
@@ -1280,7 +1278,7 @@ conv_pat(char *orig)
  * find_matches:
  *	Find all the fortunes which match the pattern we've been given.
  */
-int
+static int
 find_matches(void)
 {
 	Fort_len = maxlen_in_list(File_list);
@@ -1298,7 +1296,7 @@ find_matches(void)
  * maxlen_in_list
  *	Return the maximum fortune len in the file list.
  */
-int
+static int
 maxlen_in_list(FILEDESC *list)
 {
 	FILEDESC	*fp;
@@ -1324,7 +1322,7 @@ maxlen_in_list(FILEDESC *list)
  * matches_in_list
  *	Print out the matches from the files in the list.
  */
-void
+static void
 matches_in_list(FILEDESC *list)
 {
 	char           *sp, *p;
@@ -1375,7 +1373,7 @@ matches_in_list(FILEDESC *list)
 	}
 }
 
-void
+static void
 usage(void)
 {
 	(void) fprintf(stderr, "fortune [-a");
@@ -1394,7 +1392,7 @@ usage(void)
  *	if not set, use the compiled in FORTDIR.
  */
 
-void
+static void
 getpath(void)
 {
 	int	nstr, foundenv;

Modified: head/games/fortune/unstr/unstr.c
==============================================================================
--- head/games/fortune/unstr/unstr.c	Sat Nov  5 01:42:54 2011	(r227100)
+++ head/games/fortune/unstr/unstr.c	Sat Nov  5 07:18:53 2011	(r227101)
@@ -67,13 +67,13 @@ __FBSDID("$FreeBSD$");
 
 #include "strfile.h"
 
-char	*Infile,			/* name of input file */
-	Datafile[MAXPATHLEN],		/* name of data file */
-	Delimch;			/* delimiter character */
+static char	*Infile,		/* name of input file */
+		Datafile[MAXPATHLEN],	/* name of data file */
+		Delimch;		/* delimiter character */
 
-FILE	*Inf, *Dataf;
+static FILE	*Inf, *Dataf;
 
-void order_unstr(STRFILE *);
+static void order_unstr(STRFILE *);
 
 /* ARGSUSED */
 int
@@ -107,7 +107,7 @@ main(int argc, char *argv[])
 	exit(0);
 }
 
-void
+static void
 order_unstr(STRFILE *tbl)
 {
 	uint32_t i;

Modified: head/games/grdc/grdc.c
==============================================================================
--- head/games/grdc/grdc.c	Sat Nov  5 01:42:54 2011	(r227100)
+++ head/games/grdc/grdc.c	Sat Nov  5 07:18:53 2011	(r227101)
@@ -26,29 +26,30 @@
 #define XLENGTH 58
 #define YDEPTH  7
 
-struct timespec now;
-struct tm *tm;
+static struct timespec now;
+static struct tm *tm;
 
-short disp[11] = {
+static short disp[11] = {
 	075557, 011111, 071747, 071717, 055711,
 	074717, 074757, 071111, 075757, 075717, 002020
 };
-long old[6], next[6], new[6], mask;
+static long old[6], next[6], new[6], mask;
 
-volatile sig_atomic_t sigtermed;
+static volatile sig_atomic_t sigtermed;
 
-int hascolor = 0;
+static int hascolor = 0;
 
-void set(int, int);
-void standt(int);
-void movto(int, int);
-void sighndl(int);
-void usage(void);
+static void set(int, int);
+static void standt(int);
+static void movto(int, int);
+static void sighndl(int);
+static void usage(void);
 
-void
+static void
 sighndl(int signo)
 {
-	sigtermed=signo;
+
+	sigtermed = signo;
 }
 
 int
@@ -225,7 +226,7 @@ main(int argc, char *argv[])
 	return(0);
 }
 
-void
+static void
 set(int t, int n)
 {
 	int i, m;
@@ -239,7 +240,7 @@ set(int t, int n)
 		mask |= m;
 }
 
-void
+static void
 standt(int on)
 {
 	if (on) {
@@ -257,13 +258,13 @@ standt(int on)
 	}
 }
 
-void
+static void
 movto(int line, int col)
 {
 	move(line, col);
 }
 
-void
+static void
 usage(void)
 {
 

Modified: head/games/morse/morse.c
==============================================================================
--- head/games/morse/morse.c	Sat Nov  5 01:42:54 2011	(r227100)
+++ head/games/morse/morse.c	Sat Nov  5 07:18:53 2011	(r227101)
@@ -261,33 +261,33 @@ static const struct morsetab koi8rtab[] 
 	{'\0', ""}
 };
 
-void            show(const char *), play(const char *), morse(char);
-void		ttyout(const char *);
-void		sighandler(int);
+static void	show(const char *), play(const char *), morse(char);
+static void	ttyout(const char *);
+static void	sighandler(int);
 
 #define GETOPTOPTS "c:d:ef:lsw:"
 #define USAGE \
 "usage: morse [-els] [-d device] [-w speed] [-c speed] [-f frequency] [string ...]\n"
 
-static int      pflag, lflag, sflag, eflag;
-static int      wpm = 20;	/* effective words per minute */
-static int      cpm;		/* effective words per minute between
+static int	pflag, lflag, sflag, eflag;
+static int	wpm = 20;	/* effective words per minute */
+static int	cpm;		/* effective words per minute between
 				 * characters */
 #define FREQUENCY 600
-static int      freq = FREQUENCY;
+static int	freq = FREQUENCY;
 static char	*device;	/* for tty-controlled generator */
 
 #define DASH_LEN 3
 #define CHAR_SPACE 3
 #define WORD_SPACE (7 - CHAR_SPACE - 1)
-static float    dot_clock;
-static float    cdot_clock;
-int             spkr, line;
-struct termios	otty, ntty;
-int		olflags;
+static float	dot_clock;
+static float	cdot_clock;
+static int	spkr, line;
+static struct termios otty, ntty;
+static int	olflags;
 
 #ifdef SPEAKER
-tone_t          sound;
+static tone_t	sound;
 #undef GETOPTOPTS
 #define GETOPTOPTS "c:d:ef:lpsw:"
 #undef USAGE
@@ -439,7 +439,7 @@ main(int argc, char **argv)
 	exit(0);
 }
 
-void
+static void
 morse(char c)
 {
 	const struct morsetab *m;
@@ -473,7 +473,7 @@ morse(char c)
 	}
 }
 
-void
+static void
 show(const char *s)
 {
 	if (lflag) {
@@ -488,7 +488,7 @@ show(const char *s)
 	}
 }
 
-void
+static void
 play(const char *s)
 {
 #ifdef SPEAKER
@@ -530,7 +530,7 @@ play(const char *s)
 #endif
 }
 
-void
+static void
 ttyout(const char *s)
 {
 	const char *c;
@@ -572,7 +572,7 @@ ttyout(const char *s)
 	usleep(duration);
 }
 
-void
+static void
 sighandler(int signo)
 {
 

Modified: head/games/number/number.c
==============================================================================
--- head/games/number/number.c	Sat Nov  5 01:42:54 2011	(r227100)
+++ head/games/number/number.c	Sat Nov  5 07:18:53 2011	(r227101)
@@ -74,14 +74,13 @@ static const char	*name1[] = {
 	"novemdecillion",		"vigintillion",
 };
 
-void	convert(char *);
-int	number(char *, int);
-void	pfract(int);
-void	toobig(void);
-int	unit(int, char *);
-void	usage(void);
+static void	convert(char *);
+static int	number(char *, int);
+static void	pfract(int);
+static int	unit(int, char *);
+static void	usage(void);
 
-int lflag;
+static int lflag;
 
 int
 main(int argc, char *argv[])
@@ -120,7 +119,7 @@ main(int argc, char *argv[])
 	exit(0);
 }
 
-void
+static void
 convert(char *line)
 {
 	int flen, len, rval;
@@ -188,7 +187,7 @@ badnum:			errx(1, "illegal number: %s", 
 		(void)printf("\n");
 }
 
-int
+static int
 unit(int len, char *p)
 {
 	int off, rval;
@@ -222,7 +221,7 @@ unit(int len, char *p)
 	return (rval);
 }
 
-int
+static int
 number(char *p, int len)
 {
 	int val, rval;
@@ -260,7 +259,7 @@ number(char *p, int len)
 	return (rval);
 }
 
-void
+static void
 pfract(int len)
 {
 	static char const * const pref[] = { "", "ten-", "hundred-" };
@@ -278,7 +277,7 @@ pfract(int len)
 	}
 }
 
-void
+static void
 usage(void)
 {
 	(void)fprintf(stderr, "usage: number [-l] [# ...]\n");

From owner-svn-src-head@FreeBSD.ORG  Sat Nov  5 08:20:32 2011
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 97A3B106564A;
	Sat,  5 Nov 2011 08:20: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 873308FC08;
	Sat,  5 Nov 2011 08:20:32 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pA58KWJB055721;
	Sat, 5 Nov 2011 08:20:32 GMT (envelope-from kib@svn.freebsd.org)
Received: (from kib@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id pA58KWDT055717;
	Sat, 5 Nov 2011 08:20:32 GMT (envelope-from kib@svn.freebsd.org)
Message-Id: <201111050820.pA58KWDT055717@svn.freebsd.org>
From: Konstantin Belousov 
Date: Sat, 5 Nov 2011 08:20: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: r227102 - head/sys/vm
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Sat, 05 Nov 2011 08:20:32 -0000

Author: kib
Date: Sat Nov  5 08:20:32 2011
New Revision: 227102
URL: http://svn.freebsd.org/changeset/base/227102

Log:
  Provide typedefs for the type of bit mask for the page bits.
  Use the defined types instead of int when manipulating masks.
  Supposedly, it could fix support for 32KB page size in the
  machine-independend VM layer.
  
  Reviewed by:	alc
  MFC after:	2 weeks

Modified:
  head/sys/vm/vm_page.c
  head/sys/vm/vm_page.h
  head/sys/vm/vnode_pager.c

Modified: head/sys/vm/vm_page.c
==============================================================================
--- head/sys/vm/vm_page.c	Sat Nov  5 07:18:53 2011	(r227101)
+++ head/sys/vm/vm_page.c	Sat Nov  5 08:20:32 2011	(r227102)
@@ -137,7 +137,7 @@ SYSCTL_INT(_vm, OID_AUTO, tryrelock_rest
 
 static uma_zone_t fakepg_zone;
 
-static void vm_page_clear_dirty_mask(vm_page_t m, int pagebits);
+static void vm_page_clear_dirty_mask(vm_page_t m, vm_page_bits_t pagebits);
 static void vm_page_queue_remove(int queue, vm_page_t m);
 static void vm_page_enqueue(int queue, vm_page_t m);
 static void vm_page_init_fakepg(void *dummy);
@@ -2350,7 +2350,7 @@ retrylookup:
  *
  * Inputs are required to range within a page.
  */
-int
+vm_page_bits_t
 vm_page_bits(int base, int size)
 {
 	int first_bit;
@@ -2367,7 +2367,8 @@ vm_page_bits(int base, int size)
 	first_bit = base >> DEV_BSHIFT;
 	last_bit = (base + size - 1) >> DEV_BSHIFT;
 
-	return ((2 << last_bit) - (1 << first_bit));
+	return (((vm_page_bits_t)2 << last_bit) -
+	    ((vm_page_bits_t)1 << first_bit));
 }
 
 /*
@@ -2426,7 +2427,7 @@ vm_page_set_valid(vm_page_t m, int base,
  * Clear the given bits from the specified page's dirty field.
  */
 static __inline void
-vm_page_clear_dirty_mask(vm_page_t m, int pagebits)
+vm_page_clear_dirty_mask(vm_page_t m, vm_page_bits_t pagebits)
 {
 	uintptr_t addr;
 #if PAGE_SIZE < 16384
@@ -2455,7 +2456,6 @@ vm_page_clear_dirty_mask(vm_page_t m, in
 		 */
 		addr = (uintptr_t)&m->dirty;
 #if PAGE_SIZE == 32768
-#error pagebits too short
 		atomic_clear_64((uint64_t *)addr, pagebits);
 #elif PAGE_SIZE == 16384
 		atomic_clear_32((uint32_t *)addr, pagebits);
@@ -2492,8 +2492,8 @@ vm_page_clear_dirty_mask(vm_page_t m, in
 void
 vm_page_set_validclean(vm_page_t m, int base, int size)
 {
-	u_long oldvalid;
-	int endoff, frag, pagebits;
+	vm_page_bits_t oldvalid, pagebits;
+	int endoff, frag;
 
 	VM_OBJECT_LOCK_ASSERT(m->object, MA_OWNED);
 	if (size == 0)	/* handle degenerate case */
@@ -2505,7 +2505,7 @@ vm_page_set_validclean(vm_page_t m, int 
 	 * first block.
 	 */
 	if ((frag = base & ~(DEV_BSIZE - 1)) != base &&
-	    (m->valid & (1 << (base >> DEV_BSHIFT))) == 0)
+	    (m->valid & ((vm_page_bits_t)1 << (base >> DEV_BSHIFT))) == 0)
 		pmap_zero_page_area(m, frag, base - frag);
 
 	/*
@@ -2515,7 +2515,7 @@ vm_page_set_validclean(vm_page_t m, int 
 	 */
 	endoff = base + size;
 	if ((frag = endoff & ~(DEV_BSIZE - 1)) != endoff &&
-	    (m->valid & (1 << (endoff >> DEV_BSHIFT))) == 0)
+	    (m->valid & ((vm_page_bits_t)1 << (endoff >> DEV_BSHIFT))) == 0)
 		pmap_zero_page_area(m, endoff,
 		    DEV_BSIZE - (endoff & (DEV_BSIZE - 1)));
 
@@ -2585,7 +2585,7 @@ vm_page_clear_dirty(vm_page_t m, int bas
 void
 vm_page_set_invalid(vm_page_t m, int base, int size)
 {
-	int bits;
+	vm_page_bits_t bits;
 
 	VM_OBJECT_LOCK_ASSERT(m->object, MA_OWNED);
 	KASSERT((m->oflags & VPO_BUSY) == 0,
@@ -2625,8 +2625,7 @@ vm_page_zero_invalid(vm_page_t m, boolea
 	 */
 	for (b = i = 0; i <= PAGE_SIZE / DEV_BSIZE; ++i) {
 		if (i == (PAGE_SIZE / DEV_BSIZE) || 
-		    (m->valid & (1 << i))
-		) {
+		    (m->valid & ((vm_page_bits_t)1 << i))) {
 			if (i > b) {
 				pmap_zero_page_area(m, 
 				    b << DEV_BSHIFT, (i - b) << DEV_BSHIFT);
@@ -2656,9 +2655,10 @@ vm_page_zero_invalid(vm_page_t m, boolea
 int
 vm_page_is_valid(vm_page_t m, int base, int size)
 {
-	int bits = vm_page_bits(base, size);
+	vm_page_bits_t bits;
 
 	VM_OBJECT_LOCK_ASSERT(m->object, MA_OWNED);
+	bits = vm_page_bits(base, size);
 	if (m->valid && ((m->valid & bits) == bits))
 		return 1;
 	else

Modified: head/sys/vm/vm_page.h
==============================================================================
--- head/sys/vm/vm_page.h	Sat Nov  5 07:18:53 2011	(r227101)
+++ head/sys/vm/vm_page.h	Sat Nov  5 08:20:32 2011	(r227102)
@@ -113,6 +113,20 @@
 
 TAILQ_HEAD(pglist, vm_page);
 
+#if PAGE_SIZE == 4096
+#define VM_PAGE_BITS_ALL 0xffu
+typedef uint8_t vm_page_bits_t;
+#elif PAGE_SIZE == 8192
+#define VM_PAGE_BITS_ALL 0xffffu
+typedef uint16_t vm_page_bits_t;
+#elif PAGE_SIZE == 16384
+#define VM_PAGE_BITS_ALL 0xffffffffu
+typedef uint32_t vm_page_bits_t;
+#elif PAGE_SIZE == 32768
+#define VM_PAGE_BITS_ALL 0xfffffffffffffffflu
+typedef uint64_t vm_page_bits_t;
+#endif
+
 struct vm_page {
 	TAILQ_ENTRY(vm_page) pageq;	/* queue info for FIFO queue or free list (Q) */
 	TAILQ_ENTRY(vm_page) listq;	/* pages in same object (O) 	*/
@@ -137,20 +151,8 @@ struct vm_page {
 	u_char	busy;			/* page busy count (O) */
 	/* NOTE that these must support one bit per DEV_BSIZE in a page!!! */
 	/* so, on normal X86 kernels, they must be at least 8 bits wide */
-	/* In reality, support for 32KB pages is not fully implemented. */
-#if PAGE_SIZE == 4096
-	uint8_t	valid;			/* map of valid DEV_BSIZE chunks (O) */
-	uint8_t	dirty;			/* map of dirty DEV_BSIZE chunks (M) */
-#elif PAGE_SIZE == 8192
-	uint16_t valid;			/* map of valid DEV_BSIZE chunks (O) */
-	uint16_t dirty;			/* map of dirty DEV_BSIZE chunks (M) */
-#elif PAGE_SIZE == 16384
-	uint32_t valid;			/* map of valid DEV_BSIZE chunks (O) */
-	uint32_t dirty;			/* map of dirty DEV_BSIZE chunks (M) */
-#elif PAGE_SIZE == 32768
-	uint64_t valid;			/* map of valid DEV_BSIZE chunks (O) */
-	uint64_t dirty;			/* map of dirty DEV_BSIZE chunks (M) */
-#endif
+	vm_page_bits_t valid;		/* map of valid DEV_BSIZE chunks (O) */
+	vm_page_bits_t dirty;		/* map of dirty DEV_BSIZE chunks (M) */
 };
 
 /*
@@ -403,7 +405,7 @@ void vm_page_clear_dirty (vm_page_t, int
 void vm_page_set_invalid (vm_page_t, int, int);
 int vm_page_is_valid (vm_page_t, int, int);
 void vm_page_test_dirty (vm_page_t);
-int vm_page_bits (int, int);
+vm_page_bits_t vm_page_bits(int base, int size);
 void vm_page_zero_invalid(vm_page_t m, boolean_t setvalid);
 void vm_page_free_toq(vm_page_t m);
 void vm_page_zero_idle_wakeup(void);

Modified: head/sys/vm/vnode_pager.c
==============================================================================
--- head/sys/vm/vnode_pager.c	Sat Nov  5 07:18:53 2011	(r227101)
+++ head/sys/vm/vnode_pager.c	Sat Nov  5 08:20:32 2011	(r227102)
@@ -486,15 +486,16 @@ vnode_pager_input_smlfs(object, m)
 	vm_object_t object;
 	vm_page_t m;
 {
-	int bits, i;
 	struct vnode *vp;
 	struct bufobj *bo;
 	struct buf *bp;
 	struct sf_buf *sf;
 	daddr_t fileaddr;
 	vm_offset_t bsize;
-	int error = 0;
+	vm_page_bits_t bits;
+	int error, i;
 
+	error = 0;
 	vp = object->handle;
 	if (vp->v_iflag & VI_DOOMED)
 		return VM_PAGER_BAD;

From owner-svn-src-head@FreeBSD.ORG  Sat Nov  5 09:03:18 2011
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id BB90B1065673;
	Sat,  5 Nov 2011 09:03:18 +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 ABB448FC0C;
	Sat,  5 Nov 2011 09:03:18 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pA593IjK057119;
	Sat, 5 Nov 2011 09:03:18 GMT (envelope-from kib@svn.freebsd.org)
Received: (from kib@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id pA593Ics057117;
	Sat, 5 Nov 2011 09:03:18 GMT (envelope-from kib@svn.freebsd.org)
Message-Id: <201111050903.pA593Ics057117@svn.freebsd.org>
From: Konstantin Belousov 
Date: Sat, 5 Nov 2011 09:03: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: r227103 - head/sys/vm
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Sat, 05 Nov 2011 09:03:18 -0000

Author: kib
Date: Sat Nov  5 09:03:18 2011
New Revision: 227103
URL: http://svn.freebsd.org/changeset/base/227103

Log:
  Remove redundand definitions. The chunk was missed from r227102.
  
  MFC after:	2 weeks

Modified:
  head/sys/vm/vm_page.h

Modified: head/sys/vm/vm_page.h
==============================================================================
--- head/sys/vm/vm_page.h	Sat Nov  5 08:20:32 2011	(r227102)
+++ head/sys/vm/vm_page.h	Sat Nov  5 09:03:18 2011	(r227103)
@@ -324,16 +324,6 @@ extern struct vpglocks vm_page_queue_loc
 #define vm_page_lock_queues()   mtx_lock(&vm_page_queue_mtx)
 #define vm_page_unlock_queues() mtx_unlock(&vm_page_queue_mtx)
 
-#if PAGE_SIZE == 4096
-#define VM_PAGE_BITS_ALL 0xffu
-#elif PAGE_SIZE == 8192
-#define VM_PAGE_BITS_ALL 0xffffu
-#elif PAGE_SIZE == 16384
-#define VM_PAGE_BITS_ALL 0xffffffffu
-#elif PAGE_SIZE == 32768
-#define VM_PAGE_BITS_ALL 0xfffffffffffffffflu
-#endif
-
 /* page allocation classes: */
 #define VM_ALLOC_NORMAL		0
 #define VM_ALLOC_INTERRUPT	1

From owner-svn-src-head@FreeBSD.ORG  Sat Nov  5 09:04:13 2011
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 5E4651065673;
	Sat,  5 Nov 2011 09:04:13 +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 4EA868FC18;
	Sat,  5 Nov 2011 09:04:13 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pA594DGo057177;
	Sat, 5 Nov 2011 09:04:13 GMT (envelope-from kib@svn.freebsd.org)
Received: (from kib@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id pA594D7O057175;
	Sat, 5 Nov 2011 09:04:13 GMT (envelope-from kib@svn.freebsd.org)
Message-Id: <201111050904.pA594D7O057175@svn.freebsd.org>
From: Konstantin Belousov 
Date: Sat, 5 Nov 2011 09:04: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: r227104 - head/sys/fs/procfs
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: 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, 05 Nov 2011 09:04:13 -0000

Author: kib
Date: Sat Nov  5 09:04:13 2011
New Revision: 227104
URL: http://svn.freebsd.org/changeset/base/227104

Log:
  Fix typo.
  
  MFC after:	3 days

Modified:
  head/sys/fs/procfs/procfs_status.c

Modified: head/sys/fs/procfs/procfs_status.c
==============================================================================
--- head/sys/fs/procfs/procfs_status.c	Sat Nov  5 09:03:18 2011	(r227103)
+++ head/sys/fs/procfs/procfs_status.c	Sat Nov  5 09:04:13 2011	(r227104)
@@ -175,7 +175,7 @@ procfs_doproccmdline(PFS_FILL_ARGS)
 	/*
 	 * If we are using the ps/cmdline caching, use that.  Otherwise
 	 * revert back to the old way which only implements full cmdline
-	 * for the currept process and just p->p_comm for all other
+	 * for the current process and just p->p_comm for all other
 	 * processes.
 	 * Note that if the argv is no longer available, we deliberately
 	 * don't fall back on p->p_comm or return an error: the authentic

From owner-svn-src-head@FreeBSD.ORG  Sat Nov  5 10:00:30 2011
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 3CB5C106566C;
	Sat,  5 Nov 2011 10:00:30 +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 2C7CC8FC13;
	Sat,  5 Nov 2011 10:00:30 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pA5A0UcX058897;
	Sat, 5 Nov 2011 10:00:30 GMT (envelope-from ed@svn.freebsd.org)
Received: (from ed@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id pA5A0URU058895;
	Sat, 5 Nov 2011 10:00:30 GMT (envelope-from ed@svn.freebsd.org)
Message-Id: <201111051000.pA5A0URU058895@svn.freebsd.org>
From: Ed Schouten 
Date: Sat, 5 Nov 2011 10:00:30 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r227105 - head/lib/libpam/modules/pam_unix
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: 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, 05 Nov 2011 10:00:30 -0000

Author: ed
Date: Sat Nov  5 10:00:29 2011
New Revision: 227105
URL: http://svn.freebsd.org/changeset/base/227105

Log:
  Remove an unused variable from pam_unix.
  
  This variable was added in r82352 back in 2001, but even then it didn't
  have any use. Because it's not marked static, the C compiler won't
  complain about it.
  
  Discussed with:	des

Modified:
  head/lib/libpam/modules/pam_unix/pam_unix.c

Modified: head/lib/libpam/modules/pam_unix/pam_unix.c
==============================================================================
--- head/lib/libpam/modules/pam_unix/pam_unix.c	Sat Nov  5 09:04:13 2011	(r227104)
+++ head/lib/libpam/modules/pam_unix/pam_unix.c	Sat Nov  5 10:00:29 2011	(r227105)
@@ -81,8 +81,6 @@ static char password_hash[] =		PASSWORD_
 #define PAM_OPT_LOCAL_PASS	"local_pass"
 #define PAM_OPT_NIS_PASS	"nis_pass"
 
-char *tempname = NULL;
-
 /*
  * authentication management
  */

From owner-svn-src-head@FreeBSD.ORG  Sat Nov  5 12:01:52 2011
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 48DB71065691;
	Sat,  5 Nov 2011 12:01:52 +0000 (UTC)
	(envelope-from hselasky@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 37A218FC38;
	Sat,  5 Nov 2011 12:01:52 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pA5C1pR8064654;
	Sat, 5 Nov 2011 12:01:51 GMT (envelope-from hselasky@svn.freebsd.org)
Received: (from hselasky@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id pA5C1pGU064652;
	Sat, 5 Nov 2011 12:01:51 GMT (envelope-from hselasky@svn.freebsd.org)
Message-Id: <201111051201.pA5C1pGU064652@svn.freebsd.org>
From: Hans Petter Selasky 
Date: Sat, 5 Nov 2011 12:01: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: r227108 - head/sys/dev/usb/serial
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Sat, 05 Nov 2011 12:01:52 -0000

Author: hselasky
Date: Sat Nov  5 12:01:51 2011
New Revision: 227108
URL: http://svn.freebsd.org/changeset/base/227108

Log:
  Implement support for modem control lines.
  Don't short terminate transmitted BULK data.
  Assume that the chip reads one USB packet at a time.
  
  PR:		usb/162307
  MFC after:	3 days

Modified:
  head/sys/dev/usb/serial/uslcom.c

Modified: head/sys/dev/usb/serial/uslcom.c
==============================================================================
--- head/sys/dev/usb/serial/uslcom.c	Sat Nov  5 11:18:46 2011	(r227107)
+++ head/sys/dev/usb/serial/uslcom.c	Sat Nov  5 12:01:51 2011	(r227108)
@@ -63,43 +63,61 @@ SYSCTL_INT(_hw_usb_uslcom, OID_AUTO, deb
 
 #define	USLCOM_SET_DATA_BITS(x)	((x) << 8)
 
+/* Request types */
 #define	USLCOM_WRITE		0x41
 #define	USLCOM_READ		0xc1
 
+/* Request codes */
 #define	USLCOM_UART		0x00
 #define	USLCOM_BAUD_RATE	0x01	
 #define	USLCOM_DATA		0x03
 #define	USLCOM_BREAK		0x05
 #define	USLCOM_CTRL		0x07
+#define	USLCOM_RCTRL            0x08
+#define	USLCOM_SET_FLOWCTRL     0x13
 
+/* USLCOM_UART values */
 #define	USLCOM_UART_DISABLE	0x00
 #define	USLCOM_UART_ENABLE	0x01
 
+/* USLCOM_CTRL/USLCOM_RCTRL values */
 #define	USLCOM_CTRL_DTR_ON	0x0001	
 #define	USLCOM_CTRL_DTR_SET	0x0100
 #define	USLCOM_CTRL_RTS_ON	0x0002
 #define	USLCOM_CTRL_RTS_SET	0x0200
 #define	USLCOM_CTRL_CTS		0x0010
 #define	USLCOM_CTRL_DSR		0x0020
+#define	USLCOM_CTRL_RI          0x0040
 #define	USLCOM_CTRL_DCD		0x0080
 
+/* USLCOM_BAUD_RATE values */
 #define	USLCOM_BAUD_REF		0x384000
 
+/* USLCOM_DATA values */
 #define	USLCOM_STOP_BITS_1	0x00
 #define	USLCOM_STOP_BITS_2	0x02
-
 #define	USLCOM_PARITY_NONE	0x00
 #define	USLCOM_PARITY_ODD	0x10
 #define	USLCOM_PARITY_EVEN	0x20
 
 #define	USLCOM_PORT_NO		0xFFFF /* XXX think this should be 0 --hps */
 
+/* USLCOM_BREAK values */
 #define	USLCOM_BREAK_OFF	0x00
 #define	USLCOM_BREAK_ON		0x01
 
+/* USLCOM_SET_FLOWCTRL values - 1st word */
+#define	USLCOM_FLOW_DTR_ON      0x00000001
+#define	USLCOM_FLOW_CTS_HS      0x00000008 /* CTS handshake */
+#define	USLCOM_FLOW_RESERVED    0xFFFFFF80
+/* USLCOM_SET_FLOWCTRL values - 2nd word */
+#define	USLCOM_FLOW_RTS_ON      0x00000040
+#define	USLCOM_FLOW_RTS_HS      0x00000080 /* RTS handshake */
+
 enum {
 	USLCOM_BULK_DT_WR,
 	USLCOM_BULK_DT_RD,
+	USLCOM_CTRL_DT_RD,
 	USLCOM_N_TRANSFER,
 };
 
@@ -121,6 +139,7 @@ static device_detach_t uslcom_detach;
 
 static usb_callback_t uslcom_write_callback;
 static usb_callback_t uslcom_read_callback;
+static usb_callback_t uslcom_control_callback;
 
 static void uslcom_open(struct ucom_softc *);
 static void uslcom_close(struct ucom_softc *);
@@ -143,7 +162,7 @@ static const struct usb_config uslcom_co
 		.endpoint = UE_ADDR_ANY,
 		.direction = UE_DIR_OUT,
 		.bufsize = USLCOM_BULK_BUF_SIZE,
-		.flags = {.pipe_bof = 1,.force_short_xfer = 1,},
+               .flags = {.pipe_bof = 1,},
 		.callback = &uslcom_write_callback,
 	},
 
@@ -155,6 +174,16 @@ static const struct usb_config uslcom_co
 		.flags = {.pipe_bof = 1,.short_xfer_ok = 1,},
 		.callback = &uslcom_read_callback,
 	},
+	[USLCOM_CTRL_DT_RD] = {
+		.type = UE_CONTROL,
+		.endpoint = 0x00,
+		.direction = UE_DIR_ANY,
+		.interval = 150,	/* poll status every 150 ms */
+		.bufsize = sizeof(struct usb_device_request) + 8,
+		.flags = {.pipe_bof = 1,},
+		.callback = &uslcom_control_callback,
+		.timeout = 1000,	/* 1 second timeout */
+	},
 };
 
 static struct ucom_callback uslcom_callback = {
@@ -371,6 +400,8 @@ uslcom_open(struct ucom_softc *ucom)
 	    &req, NULL, 0, 1000)) {
 		DPRINTF("UART enable failed (ignored)\n");
 	}
+	/* Start polling status */
+	usbd_transfer_start(sc->sc_xfer[USLCOM_CTRL_DT_RD]);
 }
 
 static void
@@ -379,13 +410,16 @@ uslcom_close(struct ucom_softc *ucom)
 	struct uslcom_softc *sc = ucom->sc_parent;
 	struct usb_device_request req;
 
+	/* Stop polling status */
+	usbd_transfer_stop(sc->sc_xfer[USLCOM_CTRL_DT_RD]);
+
 	req.bmRequestType = USLCOM_WRITE;
 	req.bRequest = USLCOM_UART;
 	USETW(req.wValue, USLCOM_UART_DISABLE);
 	USETW(req.wIndex, USLCOM_PORT_NO);
 	USETW(req.wLength, 0);
 
-        if (ucom_cfg_do_request(sc->sc_udev, &sc->sc_ucom, 
+	if (ucom_cfg_do_request(sc->sc_udev, &sc->sc_ucom, 
 	    &req, NULL, 0, 1000)) {
 		DPRINTF("UART disable failed (ignored)\n");
 	}
@@ -452,6 +486,7 @@ uslcom_param(struct ucom_softc *ucom, st
 {
 	struct uslcom_softc *sc = ucom->sc_parent;
 	struct usb_device_request req;
+	uint32_t flowctrl[4];
 	uint16_t data;
 
 	DPRINTF("\n");
@@ -503,7 +538,30 @@ uslcom_param(struct ucom_softc *ucom, st
 	    &req, NULL, 0, 1000)) {
 		DPRINTF("Set format failed (ignored)\n");
 	}
-	return;
+       
+	if (t->c_cflag & CRTSCTS) {
+		flowctrl[0] = htole32(USLCOM_FLOW_RESERVED |
+		    USLCOM_FLOW_DTR_ON | USLCOM_FLOW_CTS_HS);
+		flowctrl[1] = htole32(USLCOM_FLOW_RTS_HS);
+		flowctrl[2] = 0;
+		flowctrl[3] = 0;
+	} else {
+		flowctrl[0] = htole32(USLCOM_FLOW_RESERVED |
+		    USLCOM_FLOW_DTR_ON);
+		flowctrl[1] = htole32(USLCOM_FLOW_RTS_ON);
+		flowctrl[2] = 0;
+		flowctrl[3] = 0;
+	}
+	req.bmRequestType = USLCOM_WRITE;
+	req.bRequest = USLCOM_SET_FLOWCTRL;
+	USETW(req.wValue, 0);
+	USETW(req.wIndex, USLCOM_PORT_NO);
+	USETW(req.wLength, sizeof(flowctrl));
+
+	if (ucom_cfg_do_request(sc->sc_udev, &sc->sc_ucom, 
+	    &req, flowctrl, 0, 1000)) {
+		DPRINTF("Set flowcontrol failed (ignored)\n");
+	}
 }
 
 static void
@@ -599,6 +657,63 @@ tr_setup:
 }
 
 static void
+uslcom_control_callback(struct usb_xfer *xfer, usb_error_t error)
+{
+	struct uslcom_softc *sc = usbd_xfer_softc(xfer);
+	struct usb_page_cache *pc;
+	struct usb_device_request req;
+	uint8_t msr = 0;
+	uint8_t buf;
+
+	switch (USB_GET_STATE(xfer)) {
+	case USB_ST_TRANSFERRED:
+		pc = usbd_xfer_get_frame(xfer, 1);
+		usbd_copy_out(pc, 0, &buf, sizeof(buf));
+		if (buf & USLCOM_CTRL_CTS)
+			msr |= SER_CTS;
+		if (buf & USLCOM_CTRL_DSR)
+			msr |= SER_DSR;
+		if (buf & USLCOM_CTRL_RI)
+			msr |= SER_RI;
+		if (buf & USLCOM_CTRL_DCD)
+			msr |= SER_DCD;
+
+		if (msr != sc->sc_msr) {
+			DPRINTF("status change msr=0x%02x "
+			    "(was 0x%02x)\n", msr, sc->sc_msr);
+			sc->sc_msr = msr;
+			ucom_status_change(&sc->sc_ucom);
+		}
+
+		/* FALLTHROUGH */
+
+	case USB_ST_SETUP:
+tr_setup:              
+		req.bmRequestType = USLCOM_READ;
+		req.bRequest = USLCOM_RCTRL;
+		USETW(req.wValue, 0);
+		USETW(req.wIndex, 0);
+		USETW(req.wLength, sizeof(buf));
+               
+		usbd_xfer_set_frames(xfer, 2);
+		usbd_xfer_set_frame_len(xfer, 0, sizeof(req));
+		usbd_xfer_set_frame_len(xfer, 1, sizeof(buf));
+
+		pc = usbd_xfer_get_frame(xfer, 0);
+		usbd_copy_in(pc, 0, &req, sizeof(req));
+		usbd_transfer_submit(xfer);
+		break;
+
+	default:		/* error */
+		if (error != USB_ERR_CANCELLED) {
+			DPRINTF("error=%s\n", usbd_errstr(error));
+			goto tr_setup;
+		}
+		break;
+	}
+}
+
+static void
 uslcom_start_read(struct ucom_softc *ucom)
 {
 	struct uslcom_softc *sc = ucom->sc_parent;

From owner-svn-src-head@FreeBSD.ORG  Sat Nov  5 15:52:00 2011
Return-Path: 
Delivered-To: svn-src-head@FreeBSD.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 949E61065670;
	Sat,  5 Nov 2011 15:52:00 +0000 (UTC) (envelope-from avg@FreeBSD.org)
Received: from citadel.icyb.net.ua (citadel.icyb.net.ua [212.40.38.140])
	by mx1.freebsd.org (Postfix) with ESMTP id 38B328FC08;
	Sat,  5 Nov 2011 15:51:58 +0000 (UTC)
Received: from porto.starpoint.kiev.ua (porto-e.starpoint.kiev.ua
	[212.40.38.100])
	by citadel.icyb.net.ua (8.8.8p3/ICyb-2.3exp) with ESMTP id RAA00509;
	Sat, 05 Nov 2011 17:51:57 +0200 (EET) (envelope-from avg@FreeBSD.org)
Received: from localhost ([127.0.0.1])
	by porto.starpoint.kiev.ua with esmtp (Exim 4.34 (FreeBSD))
	id 1RMiXE-000Ntq-Iq; Sat, 05 Nov 2011 17:51:56 +0200
Message-ID: <4EB55B99.2000308@FreeBSD.org>
Date: Sat, 05 Nov 2011 17:51:53 +0200
From: Andriy Gapon 
User-Agent: Mozilla/5.0 (X11; FreeBSD amd64;
	rv:7.0.1) Gecko/20111002 Thunderbird/7.0.1
MIME-Version: 1.0
To: svn-src-stable-9@FreeBSD.org, src-committers@FreeBSD.org,
	Dimitry Andric , svn-src-head@FreeBSD.org
X-Enigmail-Version: undefined
Content-Type: text/plain; charset=x-viet-vps
Content-Transfer-Encoding: 7bit
Cc: 
Subject: mergeinfo under sys/boot?
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: 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, 05 Nov 2011 15:52:00 -0000


Looks like we have mergeinfo property on a bunch of files under sys/boot in head
and stable/9.
At least the following are affected:
sys/boot/powerpc/boot1.chrp
sys/boot/powerpc/ofw
sys/boot/i386/efi
...

Not sure if that mergeinfo is useful for anything.
It seems that it was added to head in r218822 ("Merge binutils 2.17.50 to head").

-- 
Andriy Gapon

From owner-svn-src-head@FreeBSD.ORG  Sat Nov  5 16:29:03 2011
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 814D3106566B;
	Sat,  5 Nov 2011 16:29:03 +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 70D548FC08;
	Sat,  5 Nov 2011 16:29:03 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pA5GT3j5075555;
	Sat, 5 Nov 2011 16:29:03 GMT (envelope-from pjd@svn.freebsd.org)
Received: (from pjd@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id pA5GT3tE075553;
	Sat, 5 Nov 2011 16:29:03 GMT (envelope-from pjd@svn.freebsd.org)
Message-Id: <201111051629.pA5GT3tE075553@svn.freebsd.org>
From: Pawel Jakub Dawidek 
Date: Sat, 5 Nov 2011 16:29: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: r227110 -
	head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Sat, 05 Nov 2011 16:29:03 -0000

Author: pjd
Date: Sat Nov  5 16:29:03 2011
New Revision: 227110
URL: http://svn.freebsd.org/changeset/base/227110

Log:
  In zvol_open() if the spa_namespace_lock is already held, it means that
  ZFS is trying to open and taste ZVOL as its VDEV. This is not supported,
  so return an error instead of panicing on spa_namespace_lock recursion.
  
  Reported by:	Robert Millan 
  PR:		kern/162008
  MFC after:	3 days

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

Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c
==============================================================================
--- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c	Sat Nov  5 16:04:57 2011	(r227109)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c	Sat Nov  5 16:29:03 2011	(r227110)
@@ -875,6 +875,14 @@ zvol_open(struct g_provider *pp, int fla
 	zvol_state_t *zv;
 	int err = 0;
 
+	if (MUTEX_HELD(&spa_namespace_lock)) {
+		/*
+		 * If the spa_namespace_lock is being held, it means that ZFS
+		 * is trying to open ZVOL as its VDEV. This i not supported.
+		 */
+		return (EOPNOTSUPP);
+	}
+
 	mutex_enter(&spa_namespace_lock);
 
 	zv = pp->private;

From owner-svn-src-head@FreeBSD.ORG  Sat Nov  5 16:44:25 2011
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 8B6FF106566C;
	Sat,  5 Nov 2011 16:44:25 +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 7B2278FC12;
	Sat,  5 Nov 2011 16:44:25 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pA5GiPCP076072;
	Sat, 5 Nov 2011 16:44:25 GMT (envelope-from pjd@svn.freebsd.org)
Received: (from pjd@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id pA5GiPIj076070;
	Sat, 5 Nov 2011 16:44:25 GMT (envelope-from pjd@svn.freebsd.org)
Message-Id: <201111051644.pA5GiPIj076070@svn.freebsd.org>
From: Pawel Jakub Dawidek 
Date: Sat, 5 Nov 2011 16:44: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: r227111 -
	head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Sat, 05 Nov 2011 16:44:25 -0000

Author: pjd
Date: Sat Nov  5 16:44:25 2011
New Revision: 227111
URL: http://svn.freebsd.org/changeset/base/227111

Log:
  Correct typo in comment.
  
  Reported by:	Fabian Keil 
  MFC after:	3 days

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

Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c
==============================================================================
--- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c	Sat Nov  5 16:29:03 2011	(r227110)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c	Sat Nov  5 16:44:25 2011	(r227111)
@@ -878,7 +878,7 @@ zvol_open(struct g_provider *pp, int fla
 	if (MUTEX_HELD(&spa_namespace_lock)) {
 		/*
 		 * If the spa_namespace_lock is being held, it means that ZFS
-		 * is trying to open ZVOL as its VDEV. This i not supported.
+		 * is trying to open ZVOL as its VDEV. This is not supported.
 		 */
 		return (EOPNOTSUPP);
 	}

From owner-svn-src-head@FreeBSD.ORG  Sat Nov  5 16:47:47 2011
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 974C51065670;
	Sat,  5 Nov 2011 16:47:47 +0000 (UTC) (envelope-from dim@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 8781B8FC1B;
	Sat,  5 Nov 2011 16:47:47 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pA5Gllut076228;
	Sat, 5 Nov 2011 16:47:47 GMT (envelope-from dim@svn.freebsd.org)
Received: (from dim@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id pA5Gllmx076226;
	Sat, 5 Nov 2011 16:47:47 GMT (envelope-from dim@svn.freebsd.org)
Message-Id: <201111051647.pA5Gllmx076226@svn.freebsd.org>
From: Dimitry Andric 
Date: Sat, 5 Nov 2011 16:47: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: r227112 - head/etc/rc.d
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: 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, 05 Nov 2011 16:47:47 -0000

Author: dim
Date: Sat Nov  5 16:47:47 2011
New Revision: 227112
URL: http://svn.freebsd.org/changeset/base/227112

Log:
  Whenever you boot with nfsv4_server_enable=NO (the default) in rc.conf,
  the /etc/rc.d/nfsd script sets vfs.nfsd.server_max_nfsvers to 3.
  
  Then, when you set nfsv4_server_enable=YES in rc.conf, and restart nfsd
  via the rc.d script, without rebooting, the sysctl does *not* get reset
  to max version 4, so NFSv4 still doesn't work.
  
  Fix this by explicitly setting vfs.nfsd.server_max_nfsvers to 4 when
  NFSv4 is requested.
  
  I also added resetting of the nfs_privport sysctls, since this has the
  same issue: nfs_reserved_port_only=YES in rc.conf sets the nfs_privport
  sysctl to 1, but in the other case, the sysctl doesn't get reset to 0.
  
  Reviewed by:	rmacklem
  Silence from:	rc@
  MFC after:	3 days

Modified:
  head/etc/rc.d/nfsd

Modified: head/etc/rc.d/nfsd
==============================================================================
--- head/etc/rc.d/nfsd	Sat Nov  5 16:44:25 2011	(r227111)
+++ head/etc/rc.d/nfsd	Sat Nov  5 16:47:47 2011	(r227112)
@@ -29,6 +29,8 @@ nfsd_precmd()
 		if checkyesno nfs_reserved_port_only; then
 			echo 'NFS on reserved port only=YES'
 			sysctl vfs.nfsrv.nfs_privport=1 > /dev/null
+		else
+			sysctl vfs.nfsrv.nfs_privport=0 > /dev/null
 		fi
 	else
 		rc_flags="${nfs_server_flags}"
@@ -40,9 +42,12 @@ nfsd_precmd()
 		if checkyesno nfs_reserved_port_only; then
 			echo 'NFS on reserved port only=YES'
 			sysctl vfs.nfsd.nfs_privport=1 > /dev/null
+		else
+			sysctl vfs.nfsd.nfs_privport=0 > /dev/null
 		fi
 
 		if checkyesno nfsv4_server_enable; then
+			sysctl vfs.nfsd.server_max_nfsvers=4 > /dev/null
 			if ! checkyesno nfsuserd_enable  && \
 			    ! /etc/rc.d/nfsuserd forcestatus 1>/dev/null 2>&1
 			then

From owner-svn-src-head@FreeBSD.ORG  Sat Nov  5 17:55:49 2011
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 991D3106566C;
	Sat,  5 Nov 2011 17:55:49 +0000 (UTC) (envelope-from jmg@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 8839B8FC1B;
	Sat,  5 Nov 2011 17:55:49 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pA5HtnY9078537;
	Sat, 5 Nov 2011 17:55:49 GMT (envelope-from jmg@svn.freebsd.org)
Received: (from jmg@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id pA5HtnTF078535;
	Sat, 5 Nov 2011 17:55:49 GMT (envelope-from jmg@svn.freebsd.org)
Message-Id: <201111051755.pA5HtnTF078535@svn.freebsd.org>
From: John-Mark Gurney 
Date: Sat, 5 Nov 2011 17:55:49 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r227116 - 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: Sat, 05 Nov 2011 17:55:49 -0000

Author: jmg
Date: Sat Nov  5 17:55:49 2011
New Revision: 227116
URL: http://svn.freebsd.org/changeset/base/227116

Log:
  group functions together by function...
  
  document knlist_delete, and better document what knlist_clear does...  Note
  that both of these functions may sleep, and also unlock/relock the list
  lock...
  
  document knlist_init_mtx (forgotten by kib)...
  
  other minor improvements
  
  Reviewed by:	ru (previous rev)
  MFC after:	1 week

Modified:
  head/share/man/man9/kqueue.9

Modified: head/share/man/man9/kqueue.9
==============================================================================
--- head/share/man/man9/kqueue.9	Sat Nov  5 17:43:28 2011	(r227115)
+++ head/share/man/man9/kqueue.9	Sat Nov  5 17:55:49 2011	(r227116)
@@ -1,4 +1,4 @@
-.\" Copyright 2006 John-Mark Gurney
+.\" Copyright 2006,2011 John-Mark Gurney
 .\" All rights reserved.
 .\"
 .\" Redistribution and use in source and binary forms, with or without
@@ -24,15 +24,16 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd December 28, 2006
+.Dd November 5, 2011
 .Dt KQUEUE 9
 .Os
 .Sh NAME
 .Nm kqueue_add_filteropts , kqueue_del_filteropts ,
 .Nm kqfd_register ,
 .Nm knote_fdclose ,
+.Nm knlist_init , knlist_init_mtx ,
 .Nm knlist_add , knlist_remove , knlist_remove_inevent , knlist_empty ,
-.Nm knlist_init , knlist_destroy , knlist_clear , knlist_delete ,
+.Nm knlist_clear , knlist_delete , knlist_destroy ,
 .Nm KNOTE_LOCKED , KNOTE_UNLOCKED
 .Nd "event delivery subsystem"
 .Sh SYNOPSIS
@@ -46,14 +47,6 @@
 .Ft void
 .Fn knote_fdclose "struct thread *td" "int fd"
 .Ft void
-.Fn knlist_add "struct knlist *knl" "struct knote *kn" "int islocked"
-.Ft void
-.Fn knlist_remove "struct knlist *knl" "struct knote *kn" "int islocked"
-.Ft void
-.Fn knlist_remove_inevent "struct knlist *knl" "struct knote *kn"
-.Ft int
-.Fn knlist_empty "struct knlist *knl"
-.Ft void
 .Fo knlist_init
 .Fa "struct knlist *knl"
 .Fa "void *lock"
@@ -62,12 +55,22 @@
 .Fa "int \*[lp]*kl_locked\*[rp]\*[lp]void *\*[rp]"
 .Fc
 .Ft void
-.Fn knlist_destroy "struct knlist *knl"
+.Fn knlist_init_mtx "struct knlist *knl" "struct mtx *lock"
+.Ft void
+.Fn knlist_add "struct knlist *knl" "struct knote *kn" "int islocked"
+.Ft void
+.Fn knlist_remove "struct knlist *knl" "struct knote *kn" "int islocked"
+.Ft void
+.Fn knlist_remove_inevent "struct knlist *knl" "struct knote *kn"
+.Ft int
+.Fn knlist_empty "struct knlist *knl"
 .Ft void
 .Fn knlist_clear "struct knlist *knl" "int islocked"
 .Ft void
 .Fn knlist_delete "struct knlist *knl" "struct thread *td" "int islocked"
 .Ft void
+.Fn knlist_destroy "struct knlist *knl"
+.Ft void
 .Fn KNOTE_LOCKED "struct knlist *knl" "long hint"
 .Ft void
 .Fn KNOTE_UNLOCKED "struct knlist *knl" "long hint"
@@ -135,7 +138,8 @@ bit of
 .Va kn_status
 in the
 .Vt knote .
-The function shall return 0 on success, or appropriate error for the failure.
+The function shall return 0 on success, or appropriate error for the failure,
+such as when the object is being destroyed, or does not exist.
 During
 .Va f_attach ,
 it is valid to change the
@@ -155,7 +159,13 @@ function will be called to detach the
 if the
 .Vt knote
 has not already been detached by a call to
-.Fn knlist_remove .
+.Fn knlist_remove ,
+.Fn knlist_remove_inevent
+or
+.Fn knlist_delete .
+The list
+.Fa lock
+will not be held when this function is called.
 .It Va f_event
 The
 .Va f_event
@@ -247,57 +257,120 @@ A
 is not required, but is commonly used.
 If used, the
 .Vt knlist
-must be initialized with the
+must be initialized with either
 .Fn knlist_init
-function.
-If
+or
+.Fn knlist_init_mtx .
+The
+.Vt knlist
+structure may be embedded into the object structure.
+The
+.Fa lock
+will be held over
+.Va f_event
+calls.
+.Pp
+For the
+.Fn knlist_init
+function, if
 .Fa lock
 is
 .Dv NULL ,
-an internal lock will be used and the remaining arguments will be ignored.
-The
+a shared global lock will be used and the remaining arguments must be
+.Dv NULL .
+The function pointers
 .Fa kl_lock , kl_unlock
 and
 .Fa kl_locked
-functions will be used to manipulate a
+will be used to manipulate the argument
 .Fa lock .
-If the argument is
+If any of the function pointers are
 .Dv NULL ,
-default routines operating on
-.Vt "struct mtx *"
-will be used.
-The
+a function operating on
+.Dv MTX_DEF
+style
+.Xr mutex 9
+locks will be used instead.
+.Pp
+The function
+.Fn knlist_init_mtx
+may be used to initalize a
 .Vt knlist
-structure may be embedded into the object structure.
-The
+when
 .Fa lock
-will be held over calls to
-.Va f_event .
-If
-.Dv NULL
-is passed for the mutex, a private mutex will be used.
+is a
+.Dv MTX_DEF
+style
+.Xr mutex 9
+lock.
+.Pp
 The function
 .Fn knlist_empty
-requires that a
+returns true when there are no
+.Vt knotes
+on the list.
+The function requires that the
 .Fa lock
-be held.
+be held when called.
+.Pp
 The function
 .Fn knlist_clear
-is used to remove all
+removes all
 .Vt knotes
-associated with the list.
+from the list.
 The
 .Fa islocked
-argument declares if
+argument declares if the
 .Fa lock
 has been acquired.
 All
 .Vt knotes
-will be marked as detached, and
+will have
 .Dv EV_ONESHOT
-will be set so that the
+set so that the
 .Vt knote
-will be deleted after the next scan.
+will be returned and removed durning the next scan.
+The
+.Va f_detach
+function will be called when the
+.Vt knote
+is deleted durning the next scan.
+This function must not be used when
+.Va f_isfd
+is set in
+.Vt "struct filterops" ,
+as the
+.Fa td
+argument of
+.Fn fdrop
+will be
+.Dv NULL .
+.Pp
+The function
+.Fn knlist_delete
+removes and deletes all
+.Vt knotes
+on the list.
+The function
+.Va f_detach
+will not be called, and the
+.Vt knote
+will not be returned on the next scan.
+Using this function could leak user land resources if a process uses the
+.Vt knote
+to track resources.
+.Pp
+Both the
+.Fn knlist_clear
+and
+.Fn knlist_delete
+functions may sleep.
+They also may release the
+.Fa lock
+to wait for other
+.Vt knotes
+to drain.
+.Pp
 The
 .Fn knlist_destroy
 function is used to destroy a
@@ -314,7 +387,9 @@ may be attached to the object.
 A
 .Vt knlist
 may be emptied by calling
-.Fn knlist_clear .
+.Fn knlist_clear
+or
+.Fn knlist_delete .
 .Pp
 The macros
 .Fn KNOTE_LOCKED
@@ -333,7 +408,7 @@ The macro
 .Fn KNOTE_LOCKED
 must be used if the lock associated with the
 .Fa knl
-passed in is held.
+is held.
 The function
 .Fn KNOTE_UNLOCKED
 will acquire the lock before iterating over the list of

From owner-svn-src-head@FreeBSD.ORG  Sat Nov  5 19:25:21 2011
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 93EDF106566B;
	Sat,  5 Nov 2011 19:25:21 +0000 (UTC)
	(envelope-from jpaetzel@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 796188FC19;
	Sat,  5 Nov 2011 19:25:21 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pA5JPLKw081338;
	Sat, 5 Nov 2011 19:25:21 GMT (envelope-from jpaetzel@svn.freebsd.org)
Received: (from jpaetzel@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id pA5JPLPL081333;
	Sat, 5 Nov 2011 19:25:21 GMT (envelope-from jpaetzel@svn.freebsd.org)
Message-Id: <201111051925.pA5JPLPL081333@svn.freebsd.org>
From: Josh Paetzel 
Date: Sat, 5 Nov 2011 19:25: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: r227118 - head/usr.sbin/pc-sysinstall/backend
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: 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, 05 Nov 2011 19:25:21 -0000

Author: jpaetzel
Date: Sat Nov  5 19:25:21 2011
New Revision: 227118
URL: http://svn.freebsd.org/changeset/base/227118

Log:
  Roll up several patches used by PC-BSD.
  
  - Fix an issue with gmirror.
  - Allow IPv4 DHCP and IPv6 SLAAC concurrently.
  - Fix zpool options using the wrong device name.
  
  Approved by:	kib (mentor)
  Obtained from:	kris@pcbsd.org
  MFC after:	3 days

Modified:
  head/usr.sbin/pc-sysinstall/backend/functions-bsdlabel.sh
  head/usr.sbin/pc-sysinstall/backend/functions-disk.sh
  head/usr.sbin/pc-sysinstall/backend/functions-networking.sh
  head/usr.sbin/pc-sysinstall/backend/functions-unmount.sh

Modified: head/usr.sbin/pc-sysinstall/backend/functions-bsdlabel.sh
==============================================================================
--- head/usr.sbin/pc-sysinstall/backend/functions-bsdlabel.sh	Sat Nov  5 18:27:47 2011	(r227117)
+++ head/usr.sbin/pc-sysinstall/backend/functions-bsdlabel.sh	Sat Nov  5 19:25:21 2011	(r227118)
@@ -280,7 +280,7 @@ setup_gpart_partitions()
       if [ "${_pType}" = "gpt" ] ; then
         get_fs_line_xvars "${_pDisk}p${CURPART}" "${STRING}"
       else
-        get_fs_line_xvars "${_wSlice}" "${STRING}"
+        get_fs_line_xvars "${_wSlice}${PARTLETTER}" "${STRING}"
       fi
       XTRAOPTS="${VAR}"
 

Modified: head/usr.sbin/pc-sysinstall/backend/functions-disk.sh
==============================================================================
--- head/usr.sbin/pc-sysinstall/backend/functions-disk.sh	Sat Nov  5 18:27:47 2011	(r227117)
+++ head/usr.sbin/pc-sysinstall/backend/functions-disk.sh	Sat Nov  5 19:25:21 2011	(r227118)
@@ -470,7 +470,8 @@ setup_disk_slice()
               # Default to round-robin if the user didn't specify
               if [ -z "$MIRRORBAL" ]; then MIRRORBAL="round-robin" ; fi
 
-              echo "$MIRRORDISK:$MIRRORBAL:gm${gmnum}" >${MIRRORCFGDIR}/$DISK
+	      _mFile=`echo $DISK | sed 's|/|%|g'`
+              echo "$MIRRORDISK:$MIRRORBAL:gm${gmnum}" >${MIRRORCFGDIR}/$_mFile
 	      init_gmirror "$gmnum" "$MIRRORBAL" "$DISK" "$MIRRORDISK"
 
 	      # Reset DISK to the gmirror device

Modified: head/usr.sbin/pc-sysinstall/backend/functions-networking.sh
==============================================================================
--- head/usr.sbin/pc-sysinstall/backend/functions-networking.sh	Sat Nov  5 18:27:47 2011	(r227117)
+++ head/usr.sbin/pc-sysinstall/backend/functions-networking.sh	Sat Nov  5 19:25:21 2011	(r227118)
@@ -431,6 +431,10 @@ start_networking()
   elif [ "$NETDEV" = "IPv6-SLAAC" ]
   then
     enable_auto_slaac
+  elif [ "$NETDEV" = "AUTO-DHCP-SLAAC" ]
+  then
+    enable_auto_dhcp
+    enable_auto_slaac
   else
     enable_manual_nic ${NETDEV}
   fi
@@ -457,6 +461,10 @@ save_networking_install()
   elif [ "$NETDEV" = "IPv6-SLAAC" ]
   then
     save_auto_slaac
+  elif [ "$NETDEV" = "AUTO-DHCP-SLAAC" ]
+  then
+    save_auto_dhcp
+    save_auto_slaac
   else
     save_manual_nic ${NETDEV}
   fi

Modified: head/usr.sbin/pc-sysinstall/backend/functions-unmount.sh
==============================================================================
--- head/usr.sbin/pc-sysinstall/backend/functions-unmount.sh	Sat Nov  5 18:27:47 2011	(r227117)
+++ head/usr.sbin/pc-sysinstall/backend/functions-unmount.sh	Sat Nov  5 19:25:21 2011	(r227118)
@@ -43,7 +43,7 @@ start_gmirror_sync()
 {
 
   cd ${MIRRORCFGDIR}
-  for DISK in `ls *`
+  for DISK in `ls ${MIRRORCFGDIR}`
   do
     MIRRORDISK="`cat ${DISK} | cut -d ':' -f 1`"
     MIRRORBAL="`cat ${DISK} | cut -d ':' -f 2`"
@@ -51,7 +51,7 @@ start_gmirror_sync()
    
     # Start the mirroring service
     rc_nohalt "gmirror forget ${MIRRORNAME}"
-    rc_halt "gmirror insert ${MIRRORNAME} /dev/${MIRRORDISK}"
+    rc_halt "gmirror insert ${MIRRORNAME} ${MIRRORDISK}"
 
   done
 

From owner-svn-src-head@FreeBSD.ORG  Sat Nov  5 19:47:02 2011
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 737001065672;
	Sat,  5 Nov 2011 19:47:02 +0000 (UTC)
	(envelope-from crodr001@gmail.com)
Received: from mail-bw0-f54.google.com (mail-bw0-f54.google.com
	[209.85.214.54])
	by mx1.freebsd.org (Postfix) with ESMTP id 8FB108FC23;
	Sat,  5 Nov 2011 19:47:00 +0000 (UTC)
Received: by bkbzs8 with SMTP id zs8so266831bkb.13
	for ; Sat, 05 Nov 2011 12:46:59 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma;
	h=mime-version:sender:in-reply-to:references:date
	:x-google-sender-auth:message-id:subject:from:to:cc:content-type;
	bh=5jKI65h8jAXgBVV00nv5/bOow3kebirBS2sfped+Eeg=;
	b=vw/qBAzUpPWLv6yHskFdMwVQ9fHDbXlG824clojehXWP+GG7Oa9Q8DzCCD6FpZvtfH
	BaBgpXsQght+3VSJWU7QnvNcItnU62+6wLMM3zQJwx3yeqvCGneyldlLxIG6S/lGqwPn
	myPMkKtxQsGwiyX0tqPEBzjtMRe3UVE9hPK38=
MIME-Version: 1.0
Received: by 10.204.16.67 with SMTP id n3mr15195485bka.6.1320522419863; Sat,
	05 Nov 2011 12:46:59 -0700 (PDT)
Sender: crodr001@gmail.com
Received: by 10.204.39.12 with HTTP; Sat, 5 Nov 2011 12:46:59 -0700 (PDT)
In-Reply-To: <4EB55B99.2000308@FreeBSD.org>
References: <4EB55B99.2000308@FreeBSD.org>
Date: Sat, 5 Nov 2011 12:46:59 -0700
X-Google-Sender-Auth: eNgAvLMN5tvtW6Nmw2ZLXSsd3-8
Message-ID: 
From: Craig Rodrigues 
To: Andriy Gapon 
Content-Type: text/plain; charset=ISO-8859-1
Cc: svn-src-head@freebsd.org, src-committers@freebsd.org,
	Dimitry Andric , svn-src-stable-9@freebsd.org
Subject: Re: mergeinfo under sys/boot?
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: 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, 05 Nov 2011 19:47:02 -0000

On Sat, Nov 5, 2011 at 8:51 AM, Andriy Gapon  wrote:
>
> Looks like we have mergeinfo property on a bunch of files under sys/boot in head
> and stable/9.
> At least the following are affected:
> sys/boot/powerpc/boot1.chrp
> sys/boot/powerpc/ofw
> sys/boot/i386/efi
> ...
>
> Not sure if that mergeinfo is useful for anything.
> It seems that it was added to head in r218822 ("Merge binutils 2.17.50 to head").

Hi,

I don't know the solution to this particular mergeinfo problem.
However, I advise anyone
committing to the FreeBSD repository and doing "svn merge" should
definitely update
to the latest svn 1.7.1 port.

According to the subversion 1.7 release notes:
http://subversion.apache.org/docs/release-notes/1.7.html

  "Reduced subtree mergeinfo changes

    Merges no longer record mergeinfo (describing the merge) on
subtrees (that have their own explicit mergeinfo), if the
    subtree was unaffected by the merge. This should greatly reduce
the number of spurious svn:mergeinfo property changes
    for users who have large numbers of subtrees with explicit mergeinfo."


I have tried subversion 1.7.1, and followed the FreeBSD merging guidelines at:
http://wiki.freebsd.org/SubversionPrimer/Merging,  and verified that
it is true, which is very nice for doing "svn merge".

-- 
Craig Rodrigues
rodrigc@crodrigues.org

From owner-svn-src-head@FreeBSD.ORG  Sat Nov  5 21:16:40 2011
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 60E4C106566C;
	Sat,  5 Nov 2011 21:16:40 +0000 (UTC) (envelope-from dim@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 375A58FC16;
	Sat,  5 Nov 2011 21:16:40 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pA5LGeoq085058;
	Sat, 5 Nov 2011 21:16:40 GMT (envelope-from dim@svn.freebsd.org)
Received: (from dim@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id pA5LGeFx085056;
	Sat, 5 Nov 2011 21:16:40 GMT (envelope-from dim@svn.freebsd.org)
Message-Id: <201111052116.pA5LGeFx085056@svn.freebsd.org>
From: Dimitry Andric 
Date: Sat, 5 Nov 2011 21:16: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: r227120 - 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: Sat, 05 Nov 2011 21:16:40 -0000

Author: dim
Date: Sat Nov  5 21:16:39 2011
New Revision: 227120
URL: http://svn.freebsd.org/changeset/base/227120

Log:
  Make it possible to set CC and CXX (and optionally, AS and LD) in
  make.conf(5), while allowing the build32 stage on 64-bit architectures
  to still override them, so that stage can successfully build 32-bit
  compatibility libraries.
  
  Explanation:
  1) The build32 stage sets environment variables CC, CXX, AS and LD for
     its sub-make, to add 32-bit specific flags (-m32 and such).
  2) The sub-make reads sys.mk, encounters CC?= and CXX?= assignments, so
     does not alter them.
  3) After some other stuff, sys.mk reads /etc/make.conf.  When you have
     "CC=xxx" and "CXX=yyy" statements in there, they will *override* the
     build32-supplied CC/CXX values, nullifying the 32-bit specific flags.
  4) Thus all objects get built as 64-bit anyway, and since LD is usually
     not set in make.conf, it still has the 32-bit flags!
  5) Now, whenever something is linked, you will get a "ld: Relocatable
     linking with relocations from format elf64-x86-64-freebsd (foo.o) to
     format elf32-i386-freebsd (bar.o) is not supported" error.
  
  Fix this by adding "-ECC -ECXX -EAS -ELD" to the build32 sub-make
  invocation, which forces those environment variables to always override
  any assignment in makefiles.  Thus making it possible to simply set:
  
  CC=my-cc
  CXX=my-c++
  
  in your make.conf, or specify a path, even:
  
  CC=/usr/local/bin/other-cc
  CXX=/usr/local/bin/other-c++
  
  Note this was never a problem on i386, since it has no build32 stage.
  
  Silence from:	current@
  MFC after:	1 week

Modified:
  head/Makefile.inc1

Modified: head/Makefile.inc1
==============================================================================
--- head/Makefile.inc1	Sat Nov  5 19:58:05 2011	(r227119)
+++ head/Makefile.inc1	Sat Nov  5 21:16:39 2011	(r227120)
@@ -313,7 +313,8 @@ LIB32WMAKEENV+=	MAKEOBJDIRPREFIX=${OBJTR
 
 LIB32WMAKE=	${LIB32WMAKEENV} ${MAKE} -DNO_CPU_CFLAGS -DCOMPAT_32BIT \
 		-DWITHOUT_BIND -DWITHOUT_MAN -DWITHOUT_INFO \
-		-DWITHOUT_HTML -DNO_CTF -DNO_LINT DESTDIR=${LIB32TMP}
+		-DWITHOUT_HTML -DNO_CTF -DNO_LINT -ECC -ECXX -EAS -ELD \
+		DESTDIR=${LIB32TMP}
 LIB32IMAKE=	${LIB32WMAKE:NINSTALL=*:NDESTDIR=*} -DNO_INCS
 .endif
 

From owner-svn-src-head@FreeBSD.ORG  Sat Nov  5 21:32:17 2011
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 8BAFE106566B;
	Sat,  5 Nov 2011 21:32:17 +0000 (UTC)
	(envelope-from jilles@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 7B8CA8FC18;
	Sat,  5 Nov 2011 21:32:17 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pA5LWHhe085550;
	Sat, 5 Nov 2011 21:32:17 GMT (envelope-from jilles@svn.freebsd.org)
Received: (from jilles@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id pA5LWHNv085548;
	Sat, 5 Nov 2011 21:32:17 GMT (envelope-from jilles@svn.freebsd.org)
Message-Id: <201111052132.pA5LWHNv085548@svn.freebsd.org>
From: Jilles Tjoelker 
Date: Sat, 5 Nov 2011 21:32: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: r227121 - head/usr.bin/make
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: 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, 05 Nov 2011 21:32:17 -0000

Author: jilles
Date: Sat Nov  5 21:32:17 2011
New Revision: 227121
URL: http://svn.freebsd.org/changeset/base/227121

Log:
  make(1): obj dirs are physical paths so write `pwd -P` rather than `pwd`.
  
  Regular pwd may return a pathname containing symlinks, but make does not use
  such pathnames.

Modified:
  head/usr.bin/make/make.1

Modified: head/usr.bin/make/make.1
==============================================================================
--- head/usr.bin/make/make.1	Sat Nov  5 21:16:39 2011	(r227120)
+++ head/usr.bin/make/make.1	Sat Nov  5 21:32:17 2011	(r227121)
@@ -32,7 +32,7 @@
 .\"	@(#)make.1	8.8 (Berkeley) 6/13/95
 .\" $FreeBSD$
 .\"
-.Dd December 29, 2008
+.Dd November 5, 2011
 .Dt MAKE 1
 .Os
 .Sh NAME
@@ -631,7 +631,7 @@ The following directories are tried in o
 .Pp
 .Bl -enum -compact
 .It
-${MAKEOBJDIRPREFIX}/`pwd`
+${MAKEOBJDIRPREFIX}/`pwd -P`
 .It
 ${MAKEOBJDIR}
 .It
@@ -639,7 +639,7 @@ obj.${MACHINE}
 .It
 obj
 .It
-/usr/obj/`pwd`
+/usr/obj/`pwd -P`
 .El
 .Pp
 The first directory that

From owner-svn-src-head@FreeBSD.ORG  Sat Nov  5 21:56:46 2011
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 3B4BE106566C;
	Sat,  5 Nov 2011 21:56:46 +0000 (UTC)
	(envelope-from jilles@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 2AB288FC12;
	Sat,  5 Nov 2011 21:56:46 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pA5LukAX086297;
	Sat, 5 Nov 2011 21:56:46 GMT (envelope-from jilles@svn.freebsd.org)
Received: (from jilles@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id pA5LukQh086295;
	Sat, 5 Nov 2011 21:56:46 GMT (envelope-from jilles@svn.freebsd.org)
Message-Id: <201111052156.pA5LukQh086295@svn.freebsd.org>
From: Jilles Tjoelker 
Date: Sat, 5 Nov 2011 21:56: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: r227122 - head/bin/sh
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: 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, 05 Nov 2011 21:56:46 -0000

Author: jilles
Date: Sat Nov  5 21:56:45 2011
New Revision: 227122
URL: http://svn.freebsd.org/changeset/base/227122

Log:
  sh(1): Improve documentation of field splitting.

Modified:
  head/bin/sh/sh.1

Modified: head/bin/sh/sh.1
==============================================================================
--- head/bin/sh/sh.1	Sat Nov  5 21:32:17 2011	(r227121)
+++ head/bin/sh/sh.1	Sat Nov  5 21:56:45 2011	(r227122)
@@ -32,7 +32,7 @@
 .\"	from: @(#)sh.1	8.6 (Berkeley) 5/4/95
 .\" $FreeBSD$
 .\"
-.Dd July 10, 2011
+.Dd November 5, 2011
 .Dt SH 1
 .Os
 .Sh NAME
@@ -1160,6 +1160,11 @@ of alphabetics, numerics, and underscore
 The first letter of a variable name must not be numeric.
 A parameter can also be denoted by a number
 or a special character as explained below.
+.Pp
+Assignments are expanded differently from other words:
+tilde expansion is also performed after the equals sign and after any colon
+and usernames are also terminated by colons,
+and field splitting and pathname expansion are not performed.
 .Ss Positional Parameters
 A positional parameter is a parameter denoted by a number greater than zero.
 The shell sets these initially to the values of its command line
@@ -1273,11 +1278,15 @@ used in tilde expansion and as a default
 built-in.
 .It Va IFS
 Input Field Separators.
-This is normally set to
+The default value is
 .Aq space ,
 .Aq tab ,
 and
-.Aq newline .
+.Aq newline
+in that order.
+This default also applies if
+.Va IFS
+is unset, but not if it is set to the empty string.
 See the
 .Sx White Space Splitting
 section for more details.
@@ -1423,12 +1432,12 @@ part of the name.
 If a parameter expansion occurs inside double-quotes:
 .Bl -enum
 .It
-Pathname expansion is not performed on the results of the
-expansion.
-.It
 Field splitting is not performed on the results of the
 expansion, with the exception of the special parameter
 .Va @ .
+.It
+Pathname expansion is not performed on the results of the
+expansion.
 .El
 .Pp
 In addition, a parameter expansion can be modified by using one of the
@@ -1641,16 +1650,51 @@ and contain integer constants.
 .Pp
 The result of the expression is substituted in decimal.
 .Ss White Space Splitting (Field Splitting)
-After parameter expansion, command substitution, and
+In certain contexts,
+after parameter expansion, command substitution, and
 arithmetic expansion the shell scans the results of
 expansions and substitutions that did not occur in double-quotes for
 field splitting and multiple fields can result.
 .Pp
-The shell treats each character of the
+Characters in
+.Va IFS
+that are whitespace
+.Po
+.Aq space ,
+.Aq tab ,
+and
+.Aq newline
+.Pc
+are treated differently from other characters in
+.Va IFS .
+.Pp
+Whitespace in
+.Va IFS
+at the beginning or end of a word is discarded.
+.Pp
+Subsequently, a field is delimited by either
+.Bl -enum
+.It
+a non-whitespace character in
+.Va IFS
+with any whitespace in
+.Va IFS
+surrounding it, or
+.It
+one or more whitespace characters in
+.Va IFS .
+.El
+.Pp
+If a word ends with a non-whitespace character in
+.Va IFS ,
+there is no empty field after this character.
+.Pp
+If no field is delimited, the word is discarded.
+In particular, if a word consists solely of an unquoted substitution
+and the result of the substitution is null,
+it is removed by field splitting even if
 .Va IFS
-variable as a delimiter and uses
-the delimiters to split the results of parameter expansion and command
-substitution into fields.
+is null.
 .Ss Pathname Expansion (File Name Generation)
 Unless the
 .Fl f

From owner-svn-src-head@FreeBSD.ORG  Sat Nov  5 22:23:51 2011
Return-Path: 
Delivered-To: svn-src-head@FreeBSD.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 82FF3106564A;
	Sat,  5 Nov 2011 22:23:51 +0000 (UTC) (envelope-from dim@FreeBSD.org)
Received: from tensor.andric.com (cl-327.ede-01.nl.sixxs.net
	[IPv6:2001:7b8:2ff:146::2])
	by mx1.freebsd.org (Postfix) with ESMTP id 45FE38FC18;
	Sat,  5 Nov 2011 22:23:51 +0000 (UTC)
Received: from [IPv6:2001:7b8:3a7:0:5502:9023:fa7c:ca0f] (unknown
	[IPv6:2001:7b8:3a7:0:5502:9023:fa7c:ca0f])
	(using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits))
	(No client certificate requested)
	by tensor.andric.com (Postfix) with ESMTPSA id 62A4A5C59;
	Sat,  5 Nov 2011 23:23:50 +0100 (CET)
Message-ID: <4EB5B776.7090205@FreeBSD.org>
Date: Sat, 05 Nov 2011 23:23:50 +0100
From: Dimitry Andric 
Organization: The FreeBSD Project
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64;
	rv:8.0) Gecko/20111031 Thunderbird/8.0
MIME-Version: 1.0
To: Andriy Gapon 
References: <4EB55B99.2000308@FreeBSD.org>
In-Reply-To: <4EB55B99.2000308@FreeBSD.org>
Content-Type: text/plain; charset=x-viet-vps
Content-Transfer-Encoding: 7bit
Cc: svn-src-head@FreeBSD.org, src-committers@FreeBSD.org,
	svn-src-stable-9@FreeBSD.org
Subject: Re: mergeinfo under sys/boot?
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: 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, 05 Nov 2011 22:23:51 -0000

On 2011-11-05 16:51, Andriy Gapon wrote:
> Looks like we have mergeinfo property on a bunch of files under sys/boot in head
> and stable/9.
> At least the following are affected:
> sys/boot/powerpc/boot1.chrp
> sys/boot/powerpc/ofw
> sys/boot/i386/efi
> ...
> 
> Not sure if that mergeinfo is useful for anything.
> It seems that it was added to head in r218822 ("Merge binutils 2.17.50 to head").

I think I had to add that mergeinfo there, because I made some changes
in those directories to accomodate the new binutils version.  As far as
I remember, merging to sys/ itself caused some problems, so that is why
I merged to the individual subdirectories instead.

I guess this mergeinfo isn't really useful anymore, but I'd like to hear
the opinion of the Subversion gurus first. :)

From owner-svn-src-head@FreeBSD.ORG  Sat Nov  5 22:25:15 2011
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id C7523106566C;
	Sat,  5 Nov 2011 22:25:15 +0000 (UTC)
	(envelope-from jilles@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id B6ED18FC13;
	Sat,  5 Nov 2011 22:25:15 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pA5MPFpQ087304;
	Sat, 5 Nov 2011 22:25:15 GMT (envelope-from jilles@svn.freebsd.org)
Received: (from jilles@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id pA5MPFuR087302;
	Sat, 5 Nov 2011 22:25:15 GMT (envelope-from jilles@svn.freebsd.org)
Message-Id: <201111052225.pA5MPFuR087302@svn.freebsd.org>
From: Jilles Tjoelker 
Date: Sat, 5 Nov 2011 22:25: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: r227123 - head/usr.bin/xlint/xlint
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: 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, 05 Nov 2011 22:25:15 -0000

Author: jilles
Date: Sat Nov  5 22:25:15 2011
New Revision: 227123
URL: http://svn.freebsd.org/changeset/base/227123

Log:
  lint: Fix lseek() argument order.
  
  Because SEEK_SET is 0, this seems to have no effect on the generated code.
  
  PR:		bin/160806
  Submitted by:	Henning Petersen 
  Obtained from:	NetBSD

Modified:
  head/usr.bin/xlint/xlint/xlint.c

Modified: head/usr.bin/xlint/xlint/xlint.c
==============================================================================
--- head/usr.bin/xlint/xlint/xlint.c	Sat Nov  5 21:56:45 2011	(r227122)
+++ head/usr.bin/xlint/xlint/xlint.c	Sat Nov  5 22:25:15 2011	(r227123)
@@ -656,7 +656,7 @@ fname(const char *name)
 	appcstrg(&args, name);
 
 	/* we reuse the same tmp file for cpp output, so rewind and truncate */
-	if (lseek(cppoutfd, SEEK_SET, (off_t)0) != 0) {
+	if (lseek(cppoutfd, (off_t)0, SEEK_SET) != 0) {
 		warn("lseek");
 		terminate(-1);
 	}

From owner-svn-src-head@FreeBSD.ORG  Sat Nov  5 22:33:19 2011
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id CA2E4106564A;
	Sat,  5 Nov 2011 22:33:19 +0000 (UTC)
	(envelope-from jilles@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id B9BCE8FC0C;
	Sat,  5 Nov 2011 22:33:19 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pA5MXJxa087583;
	Sat, 5 Nov 2011 22:33:19 GMT (envelope-from jilles@svn.freebsd.org)
Received: (from jilles@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id pA5MXJMd087581;
	Sat, 5 Nov 2011 22:33:19 GMT (envelope-from jilles@svn.freebsd.org)
Message-Id: <201111052233.pA5MXJMd087581@svn.freebsd.org>
From: Jilles Tjoelker 
Date: Sat, 5 Nov 2011 22:33: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: r227124 - head/tools/regression/fifo/fifo_misc
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Sat, 05 Nov 2011 22:33:19 -0000

Author: jilles
Date: Sat Nov  5 22:33:19 2011
New Revision: 227124
URL: http://svn.freebsd.org/changeset/base/227124

Log:
  fifo_misc test: Fix swapped lseek arguments.
  
  It worked regardless because SEEK_CUR happens to be 1.

Modified:
  head/tools/regression/fifo/fifo_misc/fifo_misc.c

Modified: head/tools/regression/fifo/fifo_misc/fifo_misc.c
==============================================================================
--- head/tools/regression/fifo/fifo_misc/fifo_misc.c	Sat Nov  5 22:25:15 2011	(r227123)
+++ head/tools/regression/fifo/fifo_misc/fifo_misc.c	Sat Nov  5 22:33:19 2011	(r227124)
@@ -115,7 +115,7 @@ test_lseek(void)
 		exit(-1);
 	}
 
-	if (lseek(reader_fd, SEEK_CUR, 1) >= 0) {
+	if (lseek(reader_fd, 1, SEEK_CUR) >= 0) {
 		warnx("%s: lseek succeeded instead of returning ESPIPE",
 		    __func__);
 		cleanfifo("testfifo", reader_fd, writer_fd);