From owner-svn-src-stable-11@freebsd.org Sun Feb 5 00:39:45 2017 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id BF970CBBC86; Sun, 5 Feb 2017 00:39:45 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 8CF6E1F36; Sun, 5 Feb 2017 00:39:45 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v150di0u066074; Sun, 5 Feb 2017 00:39:44 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v150difE066072; Sun, 5 Feb 2017 00:39:44 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201702050039.v150difE066072@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Sun, 5 Feb 2017 00:39:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r313255 - in stable/11/sys: amd64/amd64 i386/i386 X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 05 Feb 2017 00:39:45 -0000 Author: kib Date: Sun Feb 5 00:39:44 2017 New Revision: 313255 URL: https://svnweb.freebsd.org/changeset/base/313255 Log: MFC r312954: Do not leave stale 4K TLB entries on pde (superpage) removal or protection change. Modified: stable/11/sys/amd64/amd64/pmap.c stable/11/sys/i386/i386/pmap.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/amd64/amd64/pmap.c ============================================================================== --- stable/11/sys/amd64/amd64/pmap.c Sun Feb 5 00:32:12 2017 (r313254) +++ stable/11/sys/amd64/amd64/pmap.c Sun Feb 5 00:39:44 2017 (r313255) @@ -1041,7 +1041,12 @@ pmap_bootstrap(vm_paddr_t *firstaddr) virtual_avail = va; - /* Initialize the PAT MSR. */ + /* + * Initialize the PAT MSR. + * pmap_init_pat() clears and sets CR4_PGE, which, as a + * side-effect, invalidates stale PG_G TLB entries that might + * have been created in our pre-boot environment. + */ pmap_init_pat(); /* Initialize TLB Context Id. */ @@ -3441,6 +3446,7 @@ pmap_demote_pde_locked(pmap_t pmap, pd_e vm_paddr_t mptepa; vm_page_t mpte; struct spglist free; + vm_offset_t sva; int PG_PTE_CACHE; PG_G = pmap_global_bit(pmap); @@ -3479,9 +3485,9 @@ pmap_demote_pde_locked(pmap_t pmap, pd_e DMAP_MAX_ADDRESS ? VM_ALLOC_INTERRUPT : VM_ALLOC_NORMAL) | VM_ALLOC_NOOBJ | VM_ALLOC_WIRED)) == NULL) { SLIST_INIT(&free); - pmap_remove_pde(pmap, pde, trunc_2mpage(va), &free, - lockp); - pmap_invalidate_page(pmap, trunc_2mpage(va)); + sva = trunc_2mpage(va); + pmap_remove_pde(pmap, pde, sva, &free, lockp); + pmap_invalidate_range(pmap, sva, sva + NBPDR - 1); pmap_free_zero_pages(&free); CTR2(KTR_PMAP, "pmap_demote_pde: failure for va %#lx" " in pmap %p", va, pmap); @@ -3624,11 +3630,23 @@ pmap_remove_pde(pmap_t pmap, pd_entry_t pmap->pm_stats.wired_count -= NBPDR / PAGE_SIZE; /* - * Machines that don't support invlpg, also don't support - * PG_G. - */ - if (oldpde & PG_G) - pmap_invalidate_page(kernel_pmap, sva); + * When workaround_erratum383 is false, a promotion to a 2M + * page mapping does not invalidate the 512 4K page mappings + * from the TLB. Consequently, at this point, the TLB may + * hold both 4K and 2M page mappings. Therefore, the entire + * range of addresses must be invalidated here. In contrast, + * when workaround_erratum383 is true, a promotion does + * invalidate the 512 4K page mappings, and so a single INVLPG + * suffices to invalidate the 2M page mapping. + */ + if ((oldpde & PG_G) != 0) { + if (workaround_erratum383) + pmap_invalidate_page(kernel_pmap, sva); + else + pmap_invalidate_range(kernel_pmap, sva, + sva + NBPDR - 1); + } + pmap_resident_count_dec(pmap, NBPDR / PAGE_SIZE); if (oldpde & PG_MANAGED) { CHANGE_PV_LIST_LOCK_TO_PHYS(lockp, oldpde & PG_PS_FRAME); @@ -4011,9 +4029,14 @@ retry: if (newpde != oldpde) { if (!atomic_cmpset_long(pde, oldpde, newpde)) goto retry; - if (oldpde & PG_G) - pmap_invalidate_page(pmap, sva); - else + if (oldpde & PG_G) { + /* See pmap_remove_pde() for explanation. */ + if (workaround_erratum383) + pmap_invalidate_page(kernel_pmap, sva); + else + pmap_invalidate_range(kernel_pmap, sva, + sva + NBPDR - 1); + } else anychanged = TRUE; } return (anychanged); Modified: stable/11/sys/i386/i386/pmap.c ============================================================================== --- stable/11/sys/i386/i386/pmap.c Sun Feb 5 00:32:12 2017 (r313254) +++ stable/11/sys/i386/i386/pmap.c Sun Feb 5 00:39:44 2017 (r313255) @@ -508,7 +508,14 @@ pmap_bootstrap(vm_paddr_t firstaddr) for (i = 1; i < NKPT; i++) PTD[i] = 0; - /* Initialize the PAT MSR if present. */ + /* + * Initialize the PAT MSR if present. + * pmap_init_pat() clears and sets CR4_PGE, which, as a + * side-effect, invalidates stale PG_G TLB entries that might + * have been created in our pre-boot environment. We assume + * that PAT support implies PGE and in reverse, PGE presence + * comes with PAT. Both features were added for Pentium Pro. + */ pmap_init_pat(); /* Turn on PG_G on kernel page(s) */ @@ -565,7 +572,10 @@ pmap_init_pat(void) pat_table[PAT_WRITE_PROTECTED] = 3; pat_table[PAT_UNCACHED] = 3; - /* Bail if this CPU doesn't implement PAT. */ + /* + * Bail if this CPU doesn't implement PAT. + * We assume that PAT support implies PGE. + */ if ((cpu_feature & CPUID_PAT) == 0) { for (i = 0; i < PAT_INDEX_SIZE; i++) pat_index[i] = pat_table[i]; @@ -2633,6 +2643,7 @@ pmap_demote_pde(pmap_t pmap, pd_entry_t vm_paddr_t mptepa; vm_page_t mpte; struct spglist free; + vm_offset_t sva; PMAP_LOCK_ASSERT(pmap, MA_OWNED); oldpde = *pde; @@ -2655,8 +2666,9 @@ pmap_demote_pde(pmap_t pmap, pd_entry_t va >> PDRSHIFT, VM_ALLOC_NOOBJ | VM_ALLOC_NORMAL | VM_ALLOC_WIRED)) == NULL) { SLIST_INIT(&free); - pmap_remove_pde(pmap, pde, trunc_4mpage(va), &free); - pmap_invalidate_page(pmap, trunc_4mpage(va)); + sva = trunc_4mpage(va); + pmap_remove_pde(pmap, pde, sva, &free); + pmap_invalidate_range(pmap, sva, sva + NBPDR - 1); pmap_free_zero_pages(&free); CTR2(KTR_PMAP, "pmap_demote_pde: failure for va %#x" " in pmap %p", va, pmap); @@ -2827,9 +2839,24 @@ pmap_remove_pde(pmap_t pmap, pd_entry_t /* * Machines that don't support invlpg, also don't support * PG_G. - */ - if (oldpde & PG_G) - pmap_invalidate_page(kernel_pmap, sva); + * + * When workaround_erratum383 is false, a promotion to a 2M/4M + * page mapping does not invalidate the 512/1024 4K page mappings + * from the TLB. Consequently, at this point, the TLB may + * hold both 4K and 2M/4M page mappings. Therefore, the entire + * range of addresses must be invalidated here. In contrast, + * when workaround_erratum383 is true, a promotion does + * invalidate the 512/1024 4K page mappings, and so a single INVLPG + * suffices to invalidate the 2M/4M page mapping. + */ + if ((oldpde & PG_G) != 0) { + if (workaround_erratum383) + pmap_invalidate_page(kernel_pmap, sva); + else + pmap_invalidate_range(kernel_pmap, sva, + sva + NBPDR - 1); + } + pmap->pm_stats.resident_count -= NBPDR / PAGE_SIZE; if (oldpde & PG_MANAGED) { pvh = pa_to_pvh(oldpde & PG_PS_FRAME); @@ -3139,9 +3166,14 @@ retry: if (newpde != oldpde) { if (!pde_cmpset(pde, oldpde, newpde)) goto retry; - if (oldpde & PG_G) - pmap_invalidate_page(pmap, sva); - else + if (oldpde & PG_G) { + /* See pmap_remove_pde() for explanation. */ + if (workaround_erratum383) + pmap_invalidate_page(kernel_pmap, sva); + else + pmap_invalidate_range(kernel_pmap, sva, + sva + NBPDR - 1); + } else anychanged = TRUE; } return (anychanged); From owner-svn-src-stable-11@freebsd.org Sun Feb 5 14:25:33 2017 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3CA27CD28BC; Sun, 5 Feb 2017 14:25:33 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 0BC091827; Sun, 5 Feb 2017 14:25:32 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v15EPWqx010121; Sun, 5 Feb 2017 14:25:32 GMT (envelope-from jilles@FreeBSD.org) Received: (from jilles@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v15EPWph010120; Sun, 5 Feb 2017 14:25:32 GMT (envelope-from jilles@FreeBSD.org) Message-Id: <201702051425.v15EPWph010120@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jilles set sender to jilles@FreeBSD.org using -f From: Jilles Tjoelker Date: Sun, 5 Feb 2017 14:25:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r313286 - stable/11/share/skel X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 05 Feb 2017 14:25:33 -0000 Author: jilles Date: Sun Feb 5 14:25:31 2017 New Revision: 313286 URL: https://svnweb.freebsd.org/changeset/base/313286 Log: MFC r312721: skel: Remove reference to deleted part in previous commit to this file. Modified: stable/11/share/skel/dot.shrc Directory Properties: stable/11/ (props changed) Modified: stable/11/share/skel/dot.shrc ============================================================================== --- stable/11/share/skel/dot.shrc Sun Feb 5 14:19:19 2017 (r313285) +++ stable/11/share/skel/dot.shrc Sun Feb 5 14:25:31 2017 (r313286) @@ -13,8 +13,8 @@ # # umask 022 -# Uncomment this and comment the above to enable the builtin vi(1) command -# line editor in sh(1), e.g. ESC to go into visual mode. +# Uncomment this to enable the builtin vi(1) command line editor in sh(1), +# e.g. ESC to go into visual mode. # set -o vi From owner-svn-src-stable-11@freebsd.org Sun Feb 5 20:55:03 2017 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 48E90CD1C55; Sun, 5 Feb 2017 20:55:03 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 20CEF10E9; Sun, 5 Feb 2017 20:55:03 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v15Kt2Hx071913; Sun, 5 Feb 2017 20:55:02 GMT (envelope-from jilles@FreeBSD.org) Received: (from jilles@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v15Kt2UM071911; Sun, 5 Feb 2017 20:55:02 GMT (envelope-from jilles@FreeBSD.org) Message-Id: <201702052055.v15Kt2UM071911@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jilles set sender to jilles@FreeBSD.org using -f From: Jilles Tjoelker Date: Sun, 5 Feb 2017 20:55:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r313302 - in stable/11: sys/kern tests/sys/kern X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 05 Feb 2017 20:55:03 -0000 Author: jilles Date: Sun Feb 5 20:55:01 2017 New Revision: 313302 URL: https://svnweb.freebsd.org/changeset/base/313302 Log: MFC r310096: reaper: Make REAPER_KILL_SUBTREE actually work. Modified: stable/11/sys/kern/kern_procctl.c stable/11/tests/sys/kern/reaper.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/kern/kern_procctl.c ============================================================================== --- stable/11/sys/kern/kern_procctl.c Sun Feb 5 20:03:05 2017 (r313301) +++ stable/11/sys/kern/kern_procctl.c Sun Feb 5 20:55:01 2017 (r313302) @@ -243,7 +243,7 @@ reap_kill(struct thread *td, struct proc return (ECAPMODE); if (rk->rk_sig <= 0 || rk->rk_sig > _SIG_MAXSIG) return (EINVAL); - if ((rk->rk_flags & ~REAPER_KILL_CHILDREN) != 0) + if ((rk->rk_flags & ~(REAPER_KILL_CHILDREN | REAPER_KILL_SUBTREE)) != 0) return (EINVAL); PROC_UNLOCK(p); reap = (p->p_treeflag & P_TREE_REAPER) == 0 ? p->p_reaper : p; Modified: stable/11/tests/sys/kern/reaper.c ============================================================================== --- stable/11/tests/sys/kern/reaper.c Sun Feb 5 20:03:05 2017 (r313301) +++ stable/11/tests/sys/kern/reaper.c Sun Feb 5 20:55:01 2017 (r313302) @@ -639,6 +639,107 @@ ATF_TC_BODY(reaper_kill_normal, tc) ATF_REQUIRE_EQ(0, r); } +ATF_TC_WITHOUT_HEAD(reaper_kill_subtree); +ATF_TC_BODY(reaper_kill_subtree, tc) +{ + struct procctl_reaper_kill params; + ssize_t sr; + pid_t parent, child1, child2, grandchild1, grandchild2, pid; + int r, status; + int pip[2]; + + parent = getpid(); + r = procctl(P_PID, parent, PROC_REAP_ACQUIRE, NULL); + ATF_REQUIRE_EQ(0, r); + + r = pipe(pip); + ATF_REQUIRE_EQ(0, r); + child1 = fork(); + ATF_REQUIRE(child1 != -1); + if (child1 == 0) { + if (close(pip[0]) != 0) + _exit(100); + grandchild1 = fork(); + if (grandchild1 == -1) + _exit(101); + if (grandchild1 == 0) { + if (write(pip[1], &(uint8_t){ 0 }, 1) != 1) + _exit(102); + for (;;) + pause(); + } + for (;;) + pause(); + } + child2 = fork(); + ATF_REQUIRE(child2 != -1); + if (child2 == 0) { + if (close(pip[0]) != 0) + _exit(100); + grandchild2 = fork(); + if (grandchild2 == -1) + _exit(101); + if (grandchild2 == 0) { + if (write(pip[1], &(uint8_t){ 0 }, 1) != 1) + _exit(102); + for (;;) + pause(); + } + for (;;) + pause(); + } + r = close(pip[1]); + ATF_REQUIRE_EQ(0, r); + + sr = read(pip[0], &(uint8_t){ 0 }, 1); + ATF_REQUIRE_EQ(1, sr); + sr = read(pip[0], &(uint8_t){ 0 }, 1); + ATF_REQUIRE_EQ(1, sr); + + params.rk_sig = SIGUSR1; + params.rk_flags = REAPER_KILL_SUBTREE; + params.rk_subtree = child1; + params.rk_killed = 77; + r = procctl(P_PID, parent, PROC_REAP_KILL, ¶ms); + ATF_REQUIRE_EQ(0, r); + ATF_REQUIRE_EQ(2, params.rk_killed); + ATF_CHECK_EQ(-1, params.rk_fpid); + + pid = waitpid(child1, &status, 0); + ATF_REQUIRE_EQ(child1, pid); + ATF_CHECK(WIFSIGNALED(status) && WTERMSIG(status) == SIGUSR1); + + pid = waitpid(-1, &status, 0); + ATF_REQUIRE(pid > 0); + ATF_CHECK(pid != parent); + ATF_CHECK(pid != child1); + ATF_CHECK(pid != child2); + ATF_CHECK(WIFSIGNALED(status) && WTERMSIG(status) == SIGUSR1); + + params.rk_sig = SIGUSR2; + params.rk_flags = REAPER_KILL_SUBTREE; + params.rk_subtree = child2; + params.rk_killed = 77; + r = procctl(P_PID, parent, PROC_REAP_KILL, ¶ms); + ATF_REQUIRE_EQ(0, r); + ATF_REQUIRE_EQ(2, params.rk_killed); + ATF_CHECK_EQ(-1, params.rk_fpid); + + pid = waitpid(child2, &status, 0); + ATF_REQUIRE_EQ(child2, pid); + ATF_CHECK(WIFSIGNALED(status) && WTERMSIG(status) == SIGUSR2); + + pid = waitpid(-1, &status, 0); + ATF_REQUIRE(pid > 0); + ATF_CHECK(pid != parent); + ATF_CHECK(pid != child1); + ATF_CHECK(pid != child2); + ATF_CHECK(WIFSIGNALED(status) && WTERMSIG(status) == SIGUSR2); + + r = close(pip[0]); + ATF_REQUIRE_EQ(0, r); +} + ATF_TP_ADD_TCS(tp) { @@ -652,5 +753,6 @@ ATF_TP_ADD_TCS(tp) ATF_TP_ADD_TC(tp, reaper_kill_sigzero); ATF_TP_ADD_TC(tp, reaper_kill_empty); ATF_TP_ADD_TC(tp, reaper_kill_normal); + ATF_TP_ADD_TC(tp, reaper_kill_subtree); return (atf_no_error()); } From owner-svn-src-stable-11@freebsd.org Sun Feb 5 21:56:37 2017 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8C405CD2759; Sun, 5 Feb 2017 21:56:37 +0000 (UTC) (envelope-from bcr@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 58CAA2D1; Sun, 5 Feb 2017 21:56:37 +0000 (UTC) (envelope-from bcr@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v15LuaHM097679; Sun, 5 Feb 2017 21:56:36 GMT (envelope-from bcr@FreeBSD.org) Received: (from bcr@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v15LuakM097678; Sun, 5 Feb 2017 21:56:36 GMT (envelope-from bcr@FreeBSD.org) Message-Id: <201702052156.v15LuakM097678@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bcr set sender to bcr@FreeBSD.org using -f From: Benedict Reuschling Date: Sun, 5 Feb 2017 21:56:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r313304 - stable/11/share/man/man4 X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 05 Feb 2017 21:56:37 -0000 Author: bcr (doc committer) Date: Sun Feb 5 21:56:36 2017 New Revision: 313304 URL: https://svnweb.freebsd.org/changeset/base/313304 Log: MFC r308583: Fix a broken link to the USB audio class specs. PR: 214240 Submitted by: Tobias Kortkamp t@tobik.me Modified: stable/11/share/man/man4/snd_uaudio.4 Directory Properties: stable/11/ (props changed) Modified: stable/11/share/man/man4/snd_uaudio.4 ============================================================================== --- stable/11/share/man/man4/snd_uaudio.4 Sun Feb 5 21:31:40 2017 (r313303) +++ stable/11/share/man/man4/snd_uaudio.4 Sun Feb 5 21:56:36 2017 (r313304) @@ -29,7 +29,7 @@ .\" .\" $FreeBSD$ .\" -.Dd March 19, 2015 +.Dd November 12, 2016 .Dt SND_UAUDIO 4 .Os .Sh NAME @@ -73,7 +73,7 @@ for more information. .Xr usb 4 .Rs .%T "USB Audio Class Specifications" -.%U http://www.usb.org/developers/devclass_docs/ +.%U http://www.usb.org/developers/docs/devclass_docs/ .Re .Sh HISTORY The From owner-svn-src-stable-11@freebsd.org Sun Feb 5 22:18:47 2017 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 49054CD2D5E; Sun, 5 Feb 2017 22:18:47 +0000 (UTC) (envelope-from bcr@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 015261048; Sun, 5 Feb 2017 22:18:46 +0000 (UTC) (envelope-from bcr@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v15MIkfv006237; Sun, 5 Feb 2017 22:18:46 GMT (envelope-from bcr@FreeBSD.org) Received: (from bcr@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v15MIkSL006236; Sun, 5 Feb 2017 22:18:46 GMT (envelope-from bcr@FreeBSD.org) Message-Id: <201702052218.v15MIkSL006236@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bcr set sender to bcr@FreeBSD.org using -f From: Benedict Reuschling Date: Sun, 5 Feb 2017 22:18:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r313305 - stable/11/share/misc X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 05 Feb 2017 22:18:47 -0000 Author: bcr (doc committer) Date: Sun Feb 5 22:18:45 2017 New Revision: 313305 URL: https://svnweb.freebsd.org/changeset/base/313305 Log: MFC r303802: Update with the members of the 9th core team. Modified: stable/11/share/misc/organization.dot Directory Properties: stable/11/ (props changed) Modified: stable/11/share/misc/organization.dot ============================================================================== --- stable/11/share/misc/organization.dot Sun Feb 5 21:56:36 2017 (r313304) +++ stable/11/share/misc/organization.dot Sun Feb 5 22:18:45 2017 (r313305) @@ -25,7 +25,7 @@ _misc [label="Miscellaneous Hats"] # Development teams go here alphabetically sorted -core [label="Core Team\ncore@FreeBSD.org\nbapt, emaste, gavin,\nglebius, gnn, hrs,\npeter, rwatson, theraven"] +core [label="Core Team\ncore@FreeBSD.org\nallanjude, bapt, bcr,\nbenno, emaste, gnn,\nhrs, jhb, kmoore"] coresecretary [label="Core Team Secretary\ncore-secretary@FreeBSD.org\nmatthew"] doccommitters [label="Doc/www Committers\ndoc-committers@FreeBSD.org"] doceng [label="Documentation Engineering Team\ndoceng@FreeBSD.org\ngjb, blackend,\ngabor, hrs"] From owner-svn-src-stable-11@freebsd.org Mon Feb 6 05:22:56 2017 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 99515CD2CB3; Mon, 6 Feb 2017 05:22:56 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 6865FBA5; Mon, 6 Feb 2017 05:22:56 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v165Mton082860; Mon, 6 Feb 2017 05:22:55 GMT (envelope-from delphij@FreeBSD.org) Received: (from delphij@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v165Mt5a082859; Mon, 6 Feb 2017 05:22:55 GMT (envelope-from delphij@FreeBSD.org) Message-Id: <201702060522.v165Mt5a082859@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: delphij set sender to delphij@FreeBSD.org using -f From: Xin LI Date: Mon, 6 Feb 2017 05:22:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r313319 - stable/11/usr.bin/mail X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 06 Feb 2017 05:22:56 -0000 Author: delphij Date: Mon Feb 6 05:22:55 2017 New Revision: 313319 URL: https://svnweb.freebsd.org/changeset/base/313319 Log: MFC r312664: Always initialize 'c'. Modified: stable/11/usr.bin/mail/send.c Directory Properties: stable/11/ (props changed) Modified: stable/11/usr.bin/mail/send.c ============================================================================== --- stable/11/usr.bin/mail/send.c Mon Feb 6 05:19:29 2017 (r313318) +++ stable/11/usr.bin/mail/send.c Mon Feb 6 05:22:55 2017 (r313319) @@ -59,7 +59,7 @@ sendmessage(struct message *mp, FILE *ob FILE *ibuf; char *cp, *cp2, line[LINESIZE]; int ishead, infld, ignoring, dostat, firstline; - int c, length, prefixlen; + int c = 0, length, prefixlen; /* * Compute the prefix string, without trailing whitespace From owner-svn-src-stable-11@freebsd.org Mon Feb 6 05:29:36 2017 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 92FD0CD2EDF; Mon, 6 Feb 2017 05:29:36 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 5F74310B0; Mon, 6 Feb 2017 05:29:36 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v165TZYM083327; Mon, 6 Feb 2017 05:29:35 GMT (envelope-from delphij@FreeBSD.org) Received: (from delphij@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v165TZIU083326; Mon, 6 Feb 2017 05:29:35 GMT (envelope-from delphij@FreeBSD.org) Message-Id: <201702060529.v165TZIU083326@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: delphij set sender to delphij@FreeBSD.org using -f From: Xin LI Date: Mon, 6 Feb 2017 05:29:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r313323 - stable/11/usr.bin/mail X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 06 Feb 2017 05:29:36 -0000 Author: delphij Date: Mon Feb 6 05:29:35 2017 New Revision: 313323 URL: https://svnweb.freebsd.org/changeset/base/313323 Log: MFC r312663: When creating record file, use umask 077 instead of the default. Modified: stable/11/usr.bin/mail/send.c Directory Properties: stable/11/ (props changed) Modified: stable/11/usr.bin/mail/send.c ============================================================================== --- stable/11/usr.bin/mail/send.c Mon Feb 6 05:27:07 2017 (r313322) +++ stable/11/usr.bin/mail/send.c Mon Feb 6 05:29:35 2017 (r313323) @@ -566,8 +566,13 @@ savemail(char name[], FILE *fi) char buf[BUFSIZ]; int i; time_t now; + mode_t saved_umask; - if ((fo = Fopen(name, "a")) == NULL) { + saved_umask = umask(077); + fo = Fopen(name, "a"); + umask(saved_umask); + + if (fo == NULL) { warn("%s", name); return (-1); } From owner-svn-src-stable-11@freebsd.org Mon Feb 6 13:32:23 2017 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E02DECD1A59; Mon, 6 Feb 2017 13:32:23 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id AC9591F26; Mon, 6 Feb 2017 13:32:23 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v16DWMqo083030; Mon, 6 Feb 2017 13:32:22 GMT (envelope-from cy@FreeBSD.org) Received: (from cy@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v16DWMEd083029; Mon, 6 Feb 2017 13:32:22 GMT (envelope-from cy@FreeBSD.org) Message-Id: <201702061332.v16DWMEd083029@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cy set sender to cy@FreeBSD.org using -f From: Cy Schubert Date: Mon, 6 Feb 2017 13:32:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r313340 - in stable: 10/sys/netinet 11/sys/netinet X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 06 Feb 2017 13:32:24 -0000 Author: cy Date: Mon Feb 6 13:32:22 2017 New Revision: 313340 URL: https://svnweb.freebsd.org/changeset/base/313340 Log: MFC r312982: Correct comment grammar and make it easier to understand. Modified: stable/11/sys/netinet/tcp_output.c Directory Properties: stable/11/ (props changed) Changes in other areas also in this revision: Modified: stable/10/sys/netinet/tcp_output.c Directory Properties: stable/10/ (props changed) Modified: stable/11/sys/netinet/tcp_output.c ============================================================================== --- stable/11/sys/netinet/tcp_output.c Mon Feb 6 13:08:48 2017 (r313339) +++ stable/11/sys/netinet/tcp_output.c Mon Feb 6 13:32:22 2017 (r313340) @@ -1262,8 +1262,8 @@ send: #ifdef INET6 if (isipv6) { /* - * ip6_plen is not need to be filled now, and will be filled - * in ip6_output. + * There is no need to fill in ip6_plen right now. + * It will be filled later by ip6_output. */ m->m_pkthdr.csum_flags = CSUM_TCP_IPV6; th->th_sum = in6_cksum_pseudo(ip6, sizeof(struct tcphdr) + From owner-svn-src-stable-11@freebsd.org Mon Feb 6 19:13:22 2017 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 162E4CD31A2; Mon, 6 Feb 2017 19:13:22 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from mail.baldwin.cx (bigwig.baldwin.cx [96.47.65.170]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E4FF7AE; Mon, 6 Feb 2017 19:13:21 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from ralph.baldwin.cx (c-73-231-226-104.hsd1.ca.comcast.net [73.231.226.104]) by mail.baldwin.cx (Postfix) with ESMTPSA id F1D4A10A7B9; Mon, 6 Feb 2017 14:13:13 -0500 (EST) From: John Baldwin To: Sevan Janiyan Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: Re: svn commit: r313197 - stable/11/share/misc Date: Mon, 06 Feb 2017 10:50:17 -0800 Message-ID: <1831555.5ZvQ71sPNs@ralph.baldwin.cx> User-Agent: KMail/4.14.10 (FreeBSD/11.0-STABLE; KDE/4.14.10; amd64; ; ) In-Reply-To: <201702041541.v14Ffx77047190@repo.freebsd.org> References: <201702041541.v14Ffx77047190@repo.freebsd.org> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.4.3 (mail.baldwin.cx); Mon, 06 Feb 2017 14:13:14 -0500 (EST) X-Virus-Scanned: clamav-milter 0.99.2 at mail.baldwin.cx X-Virus-Status: Clean X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 06 Feb 2017 19:13:22 -0000 On Saturday, February 04, 2017 03:41:59 PM Sevan Janiyan wrote: > Author: sevan (doc committer) > Date: Sat Feb 4 15:41:59 2017 > New Revision: 313197 > URL: https://svnweb.freebsd.org/changeset/base/313197 > > Log: > Belatedly add FreeBSD 11.0 and 12.0 to the family tree file. > > Submitted by: des (a while back) > Sponsored by: The FreeBSD Foundation Please include "MFC " at the start of the commit (where is the original revision) when doing merges from head. -- John Baldwin From owner-svn-src-stable-11@freebsd.org Mon Feb 6 19:20:51 2017 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2B24CCD3332; Mon, 6 Feb 2017 19:20:51 +0000 (UTC) (envelope-from sevan@FreeBSD.org) Received: from host2.hosts.geeklan.co.uk (host2.hosts.geeklan.co.uk [IPv6:2001:470:1f13:8c2::1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "host2.hosts.geeklan.co.uk", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 29D527B5; Mon, 6 Feb 2017 19:20:50 +0000 (UTC) (envelope-from sevan@FreeBSD.org) Received: from Sevans-11-MacBook-Air.local (cpc76904-dals22-2-0-cust978.20-2.cable.virginm.net [81.106.47.211]) by host2.hosts.geeklan.co.uk (OpenSMTPD) with ESMTPSA id a3874a8b TLS version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NO; Mon, 6 Feb 2017 19:20:42 +0000 (GMT) Subject: Re: svn commit: r313197 - stable/11/share/misc To: John Baldwin References: <201702041541.v14Ffx77047190@repo.freebsd.org> <1831555.5ZvQ71sPNs@ralph.baldwin.cx> Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org From: Sevan Janiyan Message-ID: <9cd6c2fa-6b13-b0fe-aae4-084558d6454e@FreeBSD.org> Date: Mon, 6 Feb 2017 19:20:31 +0000 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.11; rv:45.0) Gecko/20100101 Thunderbird/45.7.0 MIME-Version: 1.0 In-Reply-To: <1831555.5ZvQ71sPNs@ralph.baldwin.cx> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 06 Feb 2017 19:20:51 -0000 On 06/02/2017 18:50, John Baldwin wrote: > Please include "MFC " at the start of the commit (where is the > original revision) when doing merges from head. Sure thing. Thanks for the heads up. Sevan From owner-svn-src-stable-11@freebsd.org Mon Feb 6 20:57:19 2017 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 11E63CD31A6; Mon, 6 Feb 2017 20:57:19 +0000 (UTC) (envelope-from tsoome@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id BA1F0927; Mon, 6 Feb 2017 20:57:18 +0000 (UTC) (envelope-from tsoome@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v16KvHPw069719; Mon, 6 Feb 2017 20:57:17 GMT (envelope-from tsoome@FreeBSD.org) Received: (from tsoome@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v16KvHDN069718; Mon, 6 Feb 2017 20:57:17 GMT (envelope-from tsoome@FreeBSD.org) Message-Id: <201702062057.v16KvHDN069718@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tsoome set sender to tsoome@FreeBSD.org using -f From: Toomas Soome Date: Mon, 6 Feb 2017 20:57:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r313353 - stable/11/sys/boot/i386/common X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 06 Feb 2017 20:57:19 -0000 Author: tsoome Date: Mon Feb 6 20:57:17 2017 New Revision: 313353 URL: https://svnweb.freebsd.org/changeset/base/313353 Log: MFC r310845: boot2 will deadlock if extended keys are used on text input Approved by: imp (mentor) Differential Revision: https://reviews.freebsd.org/D8608 Modified: stable/11/sys/boot/i386/common/cons.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/boot/i386/common/cons.c ============================================================================== --- stable/11/sys/boot/i386/common/cons.c Mon Feb 6 20:57:12 2017 (r313352) +++ stable/11/sys/boot/i386/common/cons.c Mon Feb 6 20:57:17 2017 (r313353) @@ -65,18 +65,17 @@ int getc(int fn) { - /* - * The extra comparison against zero is an attempt to work around - * what appears to be a bug in QEMU and Bochs. Both emulators - * sometimes report a key-press with scancode one and ascii zero - * when no such key is pressed in reality. As far as I can tell, - * this only happens shortly after a reboot. - */ v86.ctl = V86_FLAGS; v86.addr = 0x16; v86.eax = fn << 8; v86int(); - return fn == 0 ? v86.eax & 0xff : (!V86_ZR(v86.efl) && (v86.eax & 0xff)); + + if (fn == 0) + return (v86.eax); + + if (V86_ZR(v86.efl)) + return (0); + return (v86.eax); } int @@ -106,14 +105,22 @@ getchar(void) int keyhit(unsigned int secs) { - uint32_t t0, t1; + uint32_t t0, t1, c; if (OPT_CHECK(RBX_NOINTR)) return (0); secs *= SECOND; t0 = 0; for (;;) { - if (xgetc(1)) + /* + * The extra comparison is an attempt to work around + * what appears to be a bug in QEMU and Bochs. Both emulators + * sometimes report a key-press with scancode one and ascii zero + * when no such key is pressed in reality. As far as I can tell, + * this only happens shortly after a reboot. + */ + c = xgetc(1); + if (c != 0 && c != 0x0100) return (1); if (secs > 0) { t1 = *(uint32_t *)PTOV(0x46c); @@ -134,9 +141,19 @@ getstr(char *cmdstr, size_t cmdstrsize) s = cmdstr; for (;;) { - switch (c = xgetc(0)) { - case 0: + c = xgetc(0); + + /* Translate some extended codes. */ + switch (c) { + case 0x5300: /* delete */ + c = '\177'; break; + default: + c &= 0xff; + break; + } + + switch (c) { case '\177': case '\b': if (s > cmdstr) { @@ -149,9 +166,11 @@ getstr(char *cmdstr, size_t cmdstrsize) *s = 0; return; default: - if (s - cmdstr < cmdstrsize - 1) - *s++ = c; - putchar(c); + if (c >= 0x20 && c <= 0x7e) { + if (s - cmdstr < cmdstrsize - 1) + *s++ = c; + putchar(c); + } break; } } From owner-svn-src-stable-11@freebsd.org Mon Feb 6 22:03:10 2017 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id EBF9FCD3A19; Mon, 6 Feb 2017 22:03:10 +0000 (UTC) (envelope-from tsoome@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 854F0183C; Mon, 6 Feb 2017 22:03:10 +0000 (UTC) (envelope-from tsoome@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v16M396l098582; Mon, 6 Feb 2017 22:03:09 GMT (envelope-from tsoome@FreeBSD.org) Received: (from tsoome@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v16M37hK098561; Mon, 6 Feb 2017 22:03:07 GMT (envelope-from tsoome@FreeBSD.org) Message-Id: <201702062203.v16M37hK098561@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tsoome set sender to tsoome@FreeBSD.org using -f From: Toomas Soome Date: Mon, 6 Feb 2017 22:03:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r313355 - in stable/11: lib/libstand sys/boot/common sys/boot/efi/libefi sys/boot/i386/libfirewire sys/boot/i386/libi386 sys/boot/mips/beri/loader sys/boot/ofw/libofw sys/boot/pc98/libp... X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 06 Feb 2017 22:03:11 -0000 Author: tsoome Date: Mon Feb 6 22:03:07 2017 New Revision: 313355 URL: https://svnweb.freebsd.org/changeset/base/313355 Log: MFC r309369,310850,310853: libstand: dosfs cstyle cleanup for return keyword. dosfs support in libstand is broken since r298230 PR: 214423 Submitted by: Mikhail Kupchik Reported by: Mikhail Kupchik Approved by: imp (mentor) Modified: stable/11/lib/libstand/cd9660.c stable/11/lib/libstand/dosfs.c stable/11/lib/libstand/ext2fs.c stable/11/lib/libstand/nandfs.c stable/11/lib/libstand/read.c stable/11/lib/libstand/stand.h stable/11/lib/libstand/ufs.c stable/11/lib/libstand/write.c stable/11/sys/boot/common/bcache.c stable/11/sys/boot/common/bootstrap.h stable/11/sys/boot/common/disk.c stable/11/sys/boot/common/md.c stable/11/sys/boot/efi/libefi/efipart.c stable/11/sys/boot/i386/libfirewire/firewire.c stable/11/sys/boot/i386/libi386/bioscd.c stable/11/sys/boot/i386/libi386/biosdisk.c stable/11/sys/boot/i386/libi386/pxe.c stable/11/sys/boot/mips/beri/loader/beri_disk_cfi.c stable/11/sys/boot/mips/beri/loader/beri_disk_sdcard.c stable/11/sys/boot/ofw/libofw/ofw_disk.c stable/11/sys/boot/pc98/libpc98/bioscd.c stable/11/sys/boot/pc98/libpc98/biosdisk.c stable/11/sys/boot/powerpc/kboot/hostdisk.c stable/11/sys/boot/powerpc/ps3/ps3cdrom.c stable/11/sys/boot/powerpc/ps3/ps3disk.c stable/11/sys/boot/uboot/lib/disk.c stable/11/sys/boot/usb/storage/umass_loader.c stable/11/sys/boot/userboot/userboot/host.c stable/11/sys/boot/userboot/userboot/userboot_disk.c stable/11/sys/boot/zfs/zfs.c Directory Properties: stable/11/ (props changed) Modified: stable/11/lib/libstand/cd9660.c ============================================================================== --- stable/11/lib/libstand/cd9660.c Mon Feb 6 21:02:26 2017 (r313354) +++ stable/11/lib/libstand/cd9660.c Mon Feb 6 22:03:07 2017 (r313355) @@ -143,7 +143,7 @@ susp_lookup_record(struct open_file *f, if (bcmp(sh->type, SUSP_CONTINUATION, 2) == 0) { shc = (ISO_RRIP_CONT *)sh; error = f->f_dev->dv_strategy(f->f_devdata, F_READ, - cdb2devb(isonum_733(shc->location)), 0, + cdb2devb(isonum_733(shc->location)), ISO_DEFAULT_BLOCK_SIZE, susp_buffer, &read); /* Bail if it fails. */ @@ -288,7 +288,7 @@ cd9660_open(const char *path, struct ope for (bno = 16;; bno++) { twiddle(1); rc = f->f_dev->dv_strategy(f->f_devdata, F_READ, cdb2devb(bno), - 0, ISO_DEFAULT_BLOCK_SIZE, buf, &read); + ISO_DEFAULT_BLOCK_SIZE, buf, &read); if (rc) goto out; if (read != ISO_DEFAULT_BLOCK_SIZE) { @@ -322,7 +322,7 @@ cd9660_open(const char *path, struct ope twiddle(1); rc = f->f_dev->dv_strategy (f->f_devdata, F_READ, - cdb2devb(bno + boff), 0, + cdb2devb(bno + boff), ISO_DEFAULT_BLOCK_SIZE, buf, &read); if (rc) @@ -381,7 +381,7 @@ cd9660_open(const char *path, struct ope bno = isonum_733(rec.extent) + isonum_711(rec.ext_attr_length); twiddle(1); rc = f->f_dev->dv_strategy(f->f_devdata, F_READ, cdb2devb(bno), - 0, ISO_DEFAULT_BLOCK_SIZE, buf, &read); + ISO_DEFAULT_BLOCK_SIZE, buf, &read); if (rc) goto out; if (read != ISO_DEFAULT_BLOCK_SIZE) { @@ -438,7 +438,7 @@ buf_read_file(struct open_file *f, char twiddle(16); rc = f->f_dev->dv_strategy(f->f_devdata, F_READ, - cdb2devb(blkno), 0, ISO_DEFAULT_BLOCK_SIZE, + cdb2devb(blkno), ISO_DEFAULT_BLOCK_SIZE, fp->f_buf, &read); if (rc) return (rc); Modified: stable/11/lib/libstand/dosfs.c ============================================================================== --- stable/11/lib/libstand/dosfs.c Mon Feb 6 21:02:26 2017 (r313354) +++ stable/11/lib/libstand/dosfs.c Mon Feb 6 22:03:07 2017 (r313355) @@ -154,7 +154,7 @@ static int fatcnt(DOS_FS *, u_int); static int fatget(DOS_FS *, u_int *); static int fatend(u_int, u_int); static int ioread(DOS_FS *, u_int, void *, u_int); -static int ioget(struct open_file *, daddr_t, size_t, void *, u_int); +static int ioget(struct open_file *, daddr_t, void *, u_int); static void dos_read_fat(DOS_FS *fs, struct open_file *fd) @@ -172,7 +172,7 @@ dos_read_fat(DOS_FS *fs, struct open_fil fat.buf = malloc(secbyt(fs->spf)); if (fat.buf != NULL) { - if (ioget(fd, fs->lsnfat, 0, fat.buf, secbyt(fs->spf)) == 0) { + if (ioget(fd, fs->lsnfat, fat.buf, secbyt(fs->spf)) == 0) { fat.size = fs->spf; fat.unit = dd->d_unit; return; @@ -199,12 +199,12 @@ dos_mount(DOS_FS *fs, struct open_file * fs->fd = fd; if ((err = !(buf = malloc(secbyt(1))) ? errno : 0) || - (err = ioget(fs->fd, 0, 0, buf, secbyt(1))) || + (err = ioget(fs->fd, 0, buf, secbyt(1))) || (err = parsebs(fs, (DOS_BS *)buf))) { if (buf != NULL) free(buf); (void)dosunmount(fs); - return(err); + return (err); } free(buf); @@ -219,7 +219,7 @@ dos_mount(DOS_FS *fs, struct open_file * fs->root.dex.h_clus[0] = (fs->rdcl >> 16) & 0xff; fs->root.dex.h_clus[1] = (fs->rdcl >> 24) & 0xff; } - return 0; + return (0); } /* @@ -231,10 +231,10 @@ dos_unmount(DOS_FS *fs) int err; if (fs->links) - return(EBUSY); + return (EBUSY); if ((err = dosunmount(fs))) - return(err); - return 0; + return (err); + return (0); } /* @@ -244,7 +244,7 @@ static int dosunmount(DOS_FS *fs) { free(fs); - return(0); + return (0); } /* @@ -285,7 +285,7 @@ dos_open(const char *path, struct open_f fd->f_fsdata = (void *)f; out: - return(err); + return (err); } /* @@ -307,7 +307,7 @@ dos_read(struct open_file *fd, void *buf twiddle(4); nb = (u_int)nbyte; if ((size = fsize(f->fs, &f->de)) == -1) - return EINVAL; + return (EINVAL); if (nb > (n = size - f->offset)) nb = n; off = f->offset; @@ -344,7 +344,7 @@ dos_read(struct open_file *fd, void *buf out: if (resid) *resid = nbyte - nb + cnt; - return(err); + return (err); } /* @@ -370,16 +370,16 @@ dos_seek(struct open_file *fd, off_t off break; default: errno = EINVAL; - return(-1); + return (-1); } off += offset; if (off < 0 || off > size) { errno = EINVAL; - return(-1); + return (-1); } f->offset = (u_int)off; f->c = 0; - return(off); + return (off); } /* @@ -394,7 +394,7 @@ dos_close(struct open_file *fd) f->fs->links--; free(f); dos_unmount(fs); - return 0; + return (0); } /* @@ -411,7 +411,7 @@ dos_stat(struct open_file *fd, struct st sb->st_uid = 0; sb->st_gid = 0; if ((sb->st_size = fsize(f->fs, &f->de)) == -1) - return EINVAL; + return (EINVAL); return (0); } @@ -501,7 +501,7 @@ dos_readdir(struct open_file *fd, struct d->d_reclen = sizeof(*d); d->d_type = (dd.de.attr & FA_DIR) ? DT_DIR : DT_REG; memcpy(d->d_name, fn, sizeof(d->d_name)); - return(0); + return (0); } /* @@ -516,41 +516,41 @@ parsebs(DOS_FS *fs, DOS_BS *bs) bs->jmp[0] != 0xe9 && (bs->jmp[0] != 0xeb || bs->jmp[2] != 0x90)) || bs->bpb.media < 0xf0) - return EINVAL; + return (EINVAL); if (cv2(bs->bpb.secsiz) != SECSIZ) - return EINVAL; + return (EINVAL); if (!(fs->spc = bs->bpb.spc) || fs->spc & (fs->spc - 1)) - return EINVAL; + return (EINVAL); fs->bsize = secbyt(fs->spc); fs->bshift = ffs(fs->bsize) - 1; if ((fs->spf = cv2(bs->bpb.spf))) { if (bs->bpb.fats != 2) - return EINVAL; + return (EINVAL); if (!(fs->dirents = cv2(bs->bpb.dirents))) - return EINVAL; + return (EINVAL); } else { if (!(fs->spf = cv4(bs->bpb.lspf))) - return EINVAL; + return (EINVAL); if (!bs->bpb.fats || bs->bpb.fats > 16) - return EINVAL; + return (EINVAL); if ((fs->rdcl = cv4(bs->bpb.rdcl)) < LOCLUS) - return EINVAL; + return (EINVAL); } if (!(fs->lsnfat = cv2(bs->bpb.ressec))) - return EINVAL; + return (EINVAL); fs->lsndir = fs->lsnfat + fs->spf * bs->bpb.fats; fs->lsndta = fs->lsndir + entsec(fs->dirents); if (!(sc = cv2(bs->bpb.secs)) && !(sc = cv4(bs->bpb.lsecs))) - return EINVAL; + return (EINVAL); if (fs->lsndta > sc) - return EINVAL; + return (EINVAL); if ((fs->xclus = secblk(fs, sc - fs->lsndta) + 1) < LOCLUS) - return EINVAL; + return (EINVAL); fs->fatsz = fs->dirents ? fs->xclus < 0xff6 ? 12 : 16 : 32; sc = (secbyt(fs->spf) << 1) / (fs->fatsz >> 2) - 1; if (fs->xclus > sc) fs->xclus = sc; - return 0; + return (0); } /* @@ -575,17 +575,17 @@ namede(DOS_FS *fs, const char *path, DOS if (!(s = strchr(path, '/'))) s = strchr(path, 0); if ((n = s - path) > 255) - return ENAMETOOLONG; + return (ENAMETOOLONG); memcpy(name, path, n); name[n] = 0; path = s; if (!(de->attr & FA_DIR)) - return ENOTDIR; + return (ENOTDIR); if ((err = lookup(fs, stclus(fs->fatsz, de), name, &de))) - return err; + return (err); } *dep = de; - return 0; + return (0); } /* @@ -604,7 +604,7 @@ lookup(DOS_FS *fs, u_int clus, const cha for (ent = 0; ent < 2; ent++) if (!strcasecmp(name, dotstr[ent])) { *dep = dot + ent; - return 0; + return (0); } if (!clus && fs->fatsz == 32) clus = fs->rdcl; @@ -617,13 +617,13 @@ lookup(DOS_FS *fs, u_int clus, const cha else if (okclus(fs, clus)) lsec = blklsn(fs, clus); else - return EINVAL; + return (EINVAL); for (sec = 0; sec < nsec; sec++) { - if ((err = ioget(fs->fd, lsec + sec, 0, dir, secbyt(1)))) - return err; + if ((err = ioget(fs->fd, lsec + sec, dir, secbyt(1)))) + return (err); for (ent = 0; ent < DEPSEC; ent++) { if (!*dir[ent].de.name) - return ENOENT; + return (ENOENT); if (*dir[ent].de.name != 0xe5) { if ((dir[ent].de.attr & FA_MASK) == FA_XDE) { x = dir[ent].xde.seq; @@ -651,7 +651,7 @@ lookup(DOS_FS *fs, u_int clus, const cha } if (ok) { *dep = &dir[ent].de; - return 0; + return (0); } } } @@ -661,11 +661,11 @@ lookup(DOS_FS *fs, u_int clus, const cha if (!clus) break; if ((err = fatget(fs, &clus))) - return err; + return (err); if (fatend(fs->fatsz, clus)) break; } - return ENOENT; + return (ENOENT); } /* @@ -739,11 +739,11 @@ fsize(DOS_FS *fs, DOS_DE *de) size = fs->dirents * sizeof(DOS_DE); else { if ((n = fatcnt(fs, c)) == -1) - return n; + return (n); size = blkbyt(fs, n); } } - return size; + return (size); } /* @@ -756,8 +756,8 @@ fatcnt(DOS_FS *fs, u_int c) for (n = 0; okclus(fs, c); n++) if (fatget(fs, &c)) - return -1; - return fatend(fs->fatsz, c) ? n : -1; + return (-1); + return (fatend(fs->fatsz, c) ? n : -1); } /* @@ -768,8 +768,7 @@ static int fatget(DOS_FS *fs, u_int *c) { u_char buf[4]; - u_char *s; - u_int x, offset, off, n, nbyte, lsec; + u_int x, offset, n, nbyte; struct devdesc *dd = fs->fd->f_devdata; int err = 0; @@ -783,25 +782,9 @@ fatget(DOS_FS *fs, u_int *c) offset = fatoff(fs->fatsz, *c); nbyte = fs->fatsz != 32 ? 2 : 4; - s = buf; - if ((off = offset & (SECSIZ - 1))) { - offset -= off; - lsec = bytsec(offset); - offset += SECSIZ; - if ((n = SECSIZ - off) > nbyte) - n = nbyte; - memcpy(s, fat.buf + secbyt(lsec) + off, n); - s += n; - nbyte -= n; - } - n = nbyte & (SECSIZ - 1); - if (nbyte -= n) { - memcpy(s, fat.buf + secbyt(bytsec(offset)), nbyte); - offset += nbyte; - s += nbyte; - } - if (n) - memcpy(s, fat.buf + secbyt(bytsec(offset)), n); + if (offset + nbyte > secbyt(fat.size)) + return (EINVAL); + memcpy(buf, fat.buf + offset, nbyte); } x = fs->fatsz != 32 ? cv2(buf) : cv4(buf); @@ -815,7 +798,7 @@ fatget(DOS_FS *fs, u_int *c) static int fatend(u_int sz, u_int c) { - return c > (sz == 12 ? 0xff7U : sz == 16 ? 0xfff7U : 0xffffff7); + return (c > (sz == 12 ? 0xff7U : sz == 16 ? 0xfff7U : 0xffffff7)); } /* @@ -827,38 +810,41 @@ ioread(DOS_FS *fs, u_int offset, void *b char *s; u_int off, n; int err; + u_char local_buf[SECSIZ]; s = buf; if ((off = offset & (SECSIZ - 1))) { offset -= off; if ((n = SECSIZ - off) > nbyte) n = nbyte; - if ((err = ioget(fs->fd, bytsec(offset), off, s, n))) - return err; + if ((err = ioget(fs->fd, bytsec(offset), local_buf, sizeof(local_buf)))) + return (err); + memcpy(s, local_buf + off, n); offset += SECSIZ; s += n; nbyte -= n; } n = nbyte & (SECSIZ - 1); if (nbyte -= n) { - if ((err = ioget(fs->fd, bytsec(offset), 0, s, nbyte))) - return err; + if ((err = ioget(fs->fd, bytsec(offset), s, nbyte))) + return (err); offset += nbyte; s += nbyte; } if (n) { - if ((err = ioget(fs->fd, bytsec(offset), 0, s, n))) - return err; + if ((err = ioget(fs->fd, bytsec(offset), local_buf, sizeof(local_buf)))) + return (err); + memcpy(s, local_buf, n); } - return 0; + return (0); } /* * Sector-based I/O primitive */ static int -ioget(struct open_file *fd, daddr_t lsec, size_t offset, void *buf, u_int size) +ioget(struct open_file *fd, daddr_t lsec, void *buf, u_int size) { - return ((fd->f_dev->dv_strategy)(fd->f_devdata, F_READ, lsec, offset, + return ((fd->f_dev->dv_strategy)(fd->f_devdata, F_READ, lsec, size, buf, NULL)); } Modified: stable/11/lib/libstand/ext2fs.c ============================================================================== --- stable/11/lib/libstand/ext2fs.c Mon Feb 6 21:02:26 2017 (r313354) +++ stable/11/lib/libstand/ext2fs.c Mon Feb 6 22:03:07 2017 (r313355) @@ -355,7 +355,7 @@ ext2fs_open(const char *upath, struct op fp->f_fs = fs; twiddle(1); error = (f->f_dev->dv_strategy)(f->f_devdata, F_READ, - EXT2_SBLOCK, 0, EXT2_SBSIZE, (char *)fs, &buf_size); + EXT2_SBLOCK, EXT2_SBSIZE, (char *)fs, &buf_size); if (error) goto out; @@ -397,7 +397,7 @@ ext2fs_open(const char *upath, struct op fp->f_bg = malloc(len); twiddle(1); error = (f->f_dev->dv_strategy)(f->f_devdata, F_READ, - EXT2_SBLOCK + EXT2_SBSIZE / DEV_BSIZE, 0, len, + EXT2_SBLOCK + EXT2_SBSIZE / DEV_BSIZE, len, (char *)fp->f_bg, &buf_size); if (error) goto out; @@ -509,7 +509,7 @@ ext2fs_open(const char *upath, struct op twiddle(1); error = (f->f_dev->dv_strategy)(f->f_devdata, - F_READ, fsb_to_db(fs, disk_block), 0, + F_READ, fsb_to_db(fs, disk_block), fs->fs_bsize, buf, &buf_size); if (error) goto out; @@ -570,7 +570,7 @@ read_inode(ino_t inumber, struct open_fi buf = malloc(fs->fs_bsize); twiddle(1); error = (f->f_dev->dv_strategy)(f->f_devdata, F_READ, - ino_to_db(fs, fp->f_bg, inumber), 0, fs->fs_bsize, buf, &rsize); + ino_to_db(fs, fp->f_bg, inumber), fs->fs_bsize, buf, &rsize); if (error) goto out; if (rsize != fs->fs_bsize) { @@ -667,7 +667,7 @@ block_map(struct open_file *f, daddr_t f malloc(fs->fs_bsize); twiddle(1); error = (f->f_dev->dv_strategy)(f->f_devdata, F_READ, - fsb_to_db(fp->f_fs, ind_block_num), 0, fs->fs_bsize, + fsb_to_db(fp->f_fs, ind_block_num), fs->fs_bsize, fp->f_blk[level], &fp->f_blksize[level]); if (error) return (error); @@ -725,7 +725,7 @@ buf_read_file(struct open_file *f, char } else { twiddle(4); error = (f->f_dev->dv_strategy)(f->f_devdata, F_READ, - fsb_to_db(fs, disk_block), 0, block_size, + fsb_to_db(fs, disk_block), block_size, fp->f_buf, &fp->f_buf_size); if (error) goto done; Modified: stable/11/lib/libstand/nandfs.c ============================================================================== --- stable/11/lib/libstand/nandfs.c Mon Feb 6 21:02:26 2017 (r313354) +++ stable/11/lib/libstand/nandfs.c Mon Feb 6 22:03:07 2017 (r313355) @@ -1024,7 +1024,7 @@ ioread(struct open_file *f, off_t pos, v buffer = malloc(nsec * bsize); - err = (f->f_dev->dv_strategy)(f->f_devdata, F_READ, pos, 0, + err = (f->f_dev->dv_strategy)(f->f_devdata, F_READ, pos, nsec * bsize, buffer, NULL); memcpy(buf, (void *)((uintptr_t)buffer + off), length); @@ -1045,7 +1045,7 @@ nandfs_probe_sectorsize(struct open_file for (i = 512; i < (16 * 1024); i <<= 1) { NANDFS_DEBUG("%d ", i); - err = (f->f_dev->dv_strategy)(f->f_devdata, F_READ, 0, 0, i, + err = (f->f_dev->dv_strategy)(f->f_devdata, F_READ, 0, i, buffer, NULL); if (err == 0) { Modified: stable/11/lib/libstand/read.c ============================================================================== --- stable/11/lib/libstand/read.c Mon Feb 6 21:02:26 2017 (r313354) +++ stable/11/lib/libstand/read.c Mon Feb 6 22:03:07 2017 (r313355) @@ -79,7 +79,7 @@ read(int fd, void *dest, size_t bcount) if (f->f_flags & F_RAW) { twiddle(4); errno = (f->f_dev->dv_strategy)(f->f_devdata, F_READ, - btodb(f->f_offset), 0, bcount, dest, &resid); + btodb(f->f_offset), bcount, dest, &resid); if (errno) return (-1); f->f_offset += resid; Modified: stable/11/lib/libstand/stand.h ============================================================================== --- stable/11/lib/libstand/stand.h Mon Feb 6 21:02:26 2017 (r313354) +++ stable/11/lib/libstand/stand.h Mon Feb 6 22:03:07 2017 (r313355) @@ -139,7 +139,7 @@ struct devsw { int dv_type; /* opaque type constant, arch-dependant */ int (*dv_init)(void); /* early probe call */ int (*dv_strategy)(void *devdata, int rw, daddr_t blk, - size_t offset, size_t size, char *buf, size_t *rsize); + size_t size, char *buf, size_t *rsize); int (*dv_open)(struct open_file *f, ...); int (*dv_close)(struct open_file *f); int (*dv_ioctl)(struct open_file *f, u_long cmd, void *data); Modified: stable/11/lib/libstand/ufs.c ============================================================================== --- stable/11/lib/libstand/ufs.c Mon Feb 6 21:02:26 2017 (r313354) +++ stable/11/lib/libstand/ufs.c Mon Feb 6 22:03:07 2017 (r313355) @@ -157,7 +157,7 @@ read_inode(inumber, f) buf = malloc(fs->fs_bsize); twiddle(1); rc = (f->f_dev->dv_strategy)(f->f_devdata, F_READ, - fsbtodb(fs, ino_to_fsba(fs, inumber)), 0, fs->fs_bsize, + fsbtodb(fs, ino_to_fsba(fs, inumber)), fs->fs_bsize, buf, &rsize); if (rc) goto out; @@ -267,7 +267,7 @@ block_map(f, file_block, disk_block_p) malloc(fs->fs_bsize); twiddle(1); rc = (f->f_dev->dv_strategy)(f->f_devdata, F_READ, - fsbtodb(fp->f_fs, ind_block_num), 0, + fsbtodb(fp->f_fs, ind_block_num), fs->fs_bsize, fp->f_blk[level], &fp->f_blksize[level]); @@ -348,7 +348,7 @@ buf_write_file(f, buf_p, size_p) twiddle(4); rc = (f->f_dev->dv_strategy)(f->f_devdata, F_READ, - fsbtodb(fs, disk_block), 0, + fsbtodb(fs, disk_block), block_size, fp->f_buf, &fp->f_buf_size); if (rc) return (rc); @@ -367,7 +367,7 @@ buf_write_file(f, buf_p, size_p) twiddle(4); rc = (f->f_dev->dv_strategy)(f->f_devdata, F_WRITE, - fsbtodb(fs, disk_block), 0, + fsbtodb(fs, disk_block), block_size, fp->f_buf, &fp->f_buf_size); return (rc); } @@ -408,7 +408,7 @@ buf_read_file(f, buf_p, size_p) } else { twiddle(4); rc = (f->f_dev->dv_strategy)(f->f_devdata, F_READ, - fsbtodb(fs, disk_block), 0, + fsbtodb(fs, disk_block), block_size, fp->f_buf, &fp->f_buf_size); if (rc) return (rc); @@ -521,7 +521,7 @@ ufs_open(upath, f) */ for (i = 0; sblock_try[i] != -1; i++) { rc = (f->f_dev->dv_strategy)(f->f_devdata, F_READ, - sblock_try[i] / DEV_BSIZE, 0, SBLOCKSIZE, + sblock_try[i] / DEV_BSIZE, SBLOCKSIZE, (char *)fs, &buf_size); if (rc) goto out; @@ -651,7 +651,7 @@ ufs_open(upath, f) twiddle(1); rc = (f->f_dev->dv_strategy)(f->f_devdata, - F_READ, fsbtodb(fs, disk_block), 0, + F_READ, fsbtodb(fs, disk_block), fs->fs_bsize, buf, &buf_size); if (rc) goto out; Modified: stable/11/lib/libstand/write.c ============================================================================== --- stable/11/lib/libstand/write.c Mon Feb 6 21:02:26 2017 (r313354) +++ stable/11/lib/libstand/write.c Mon Feb 6 22:03:07 2017 (r313355) @@ -82,7 +82,7 @@ write(fd, dest, bcount) if (f->f_flags & F_RAW) { twiddle(4); errno = (f->f_dev->dv_strategy)(f->f_devdata, F_WRITE, - btodb(f->f_offset), 0, bcount, dest, &resid); + btodb(f->f_offset), bcount, dest, &resid); if (errno) return (-1); f->f_offset += resid; Modified: stable/11/sys/boot/common/bcache.c ============================================================================== --- stable/11/sys/boot/common/bcache.c Mon Feb 6 21:02:26 2017 (r313354) +++ stable/11/sys/boot/common/bcache.c Mon Feb 6 22:03:07 2017 (r313355) @@ -182,8 +182,8 @@ bcache_free(void *cache) * cache with the new values. */ static int -write_strategy(void *devdata, int rw, daddr_t blk, size_t offset, - size_t size, char *buf, size_t *rsize) +write_strategy(void *devdata, int rw, daddr_t blk, size_t size, + char *buf, size_t *rsize) { struct bcache_devdata *dd = (struct bcache_devdata *)devdata; struct bcache *bc = dd->dv_cache; @@ -197,7 +197,7 @@ write_strategy(void *devdata, int rw, da } /* Write the blocks */ - return (dd->dv_strategy(dd->dv_devdata, rw, blk, offset, size, buf, rsize)); + return (dd->dv_strategy(dd->dv_devdata, rw, blk, size, buf, rsize)); } /* @@ -206,8 +206,8 @@ write_strategy(void *devdata, int rw, da * device I/O and then use the I/O results to populate the cache. */ static int -read_strategy(void *devdata, int rw, daddr_t blk, size_t offset, - size_t size, char *buf, size_t *rsize) +read_strategy(void *devdata, int rw, daddr_t blk, size_t size, + char *buf, size_t *rsize) { struct bcache_devdata *dd = (struct bcache_devdata *)devdata; struct bcache *bc = dd->dv_cache; @@ -225,7 +225,7 @@ read_strategy(void *devdata, int rw, dad *rsize = 0; nblk = size / bcache_blksize; - if ((nblk == 0 && size != 0) || offset != 0) + if (nblk == 0 && size != 0) nblk++; result = 0; complete = 1; @@ -246,8 +246,7 @@ read_strategy(void *devdata, int rw, dad if (complete) { /* whole set was in cache, return it */ if (bc->ra < BCACHE_READAHEAD) bc->ra <<= 1; /* increase read ahead */ - bcopy(bc->bcache_data + (bcache_blksize * BHASH(bc, blk)) + offset, - buf, size); + bcopy(bc->bcache_data + (bcache_blksize * BHASH(bc, blk)), buf, size); goto done; } @@ -282,7 +281,7 @@ read_strategy(void *devdata, int rw, dad * in either case we should return the data in bcache and only * return error if there is no data. */ - result = dd->dv_strategy(dd->dv_devdata, rw, p_blk, 0, + result = dd->dv_strategy(dd->dv_devdata, rw, p_blk, p_size * bcache_blksize, p_buf, &r_size); r_size /= bcache_blksize; @@ -305,8 +304,7 @@ read_strategy(void *devdata, int rw, dad size = i * bcache_blksize; if (size != 0) { - bcopy(bc->bcache_data + (bcache_blksize * BHASH(bc, blk)) + offset, - buf, size); + bcopy(bc->bcache_data + (bcache_blksize * BHASH(bc, blk)), buf, size); result = 0; } @@ -321,8 +319,8 @@ read_strategy(void *devdata, int rw, dad * directly to the disk. XXX tune this. */ int -bcache_strategy(void *devdata, int rw, daddr_t blk, size_t offset, - size_t size, char *buf, size_t *rsize) +bcache_strategy(void *devdata, int rw, daddr_t blk, size_t size, + char *buf, size_t *rsize) { struct bcache_devdata *dd = (struct bcache_devdata *)devdata; struct bcache *bc = dd->dv_cache; @@ -337,23 +335,16 @@ bcache_strategy(void *devdata, int rw, d /* bypass large requests, or when the cache is inactive */ if (bc == NULL || - (offset == 0 && ((size * 2 / bcache_blksize) > bcache_nblks))) { + ((size * 2 / bcache_blksize) > bcache_nblks)) { DEBUG("bypass %d from %d", size / bcache_blksize, blk); bcache_bypasses++; - return (dd->dv_strategy(dd->dv_devdata, rw, blk, offset, size, buf, - rsize)); - } - - /* normalize offset */ - while (offset >= bcache_blksize) { - blk++; - offset -= bcache_blksize; + return (dd->dv_strategy(dd->dv_devdata, rw, blk, size, buf, rsize)); } switch (rw) { case F_READ: nblk = size / bcache_blksize; - if (offset || (size != 0 && nblk == 0)) + if (size != 0 && nblk == 0) nblk++; /* read at least one block */ ret = 0; @@ -364,14 +355,10 @@ bcache_strategy(void *devdata, int rw, d if (size <= bcache_blksize) csize = size; - else { + else csize = cblk * bcache_blksize; - if (offset) - csize -= (bcache_blksize - offset); - } - ret = read_strategy(devdata, rw, blk, offset, - csize, buf+total, &isize); + ret = read_strategy(devdata, rw, blk, csize, buf+total, &isize); /* * we may have error from read ahead, if we have read some data @@ -382,8 +369,7 @@ bcache_strategy(void *devdata, int rw, d ret = 0; break; } - blk += (offset+isize) / bcache_blksize; - offset = 0; + blk += isize / bcache_blksize; total += isize; size -= isize; nblk = size / bcache_blksize; @@ -394,7 +380,7 @@ bcache_strategy(void *devdata, int rw, d return (ret); case F_WRITE: - return write_strategy(devdata, rw, blk, offset, size, buf, rsize); + return write_strategy(devdata, rw, blk, size, buf, rsize); } return -1; } Modified: stable/11/sys/boot/common/bootstrap.h ============================================================================== --- stable/11/sys/boot/common/bootstrap.h Mon Feb 6 21:02:26 2017 (r313354) +++ stable/11/sys/boot/common/bootstrap.h Mon Feb 6 22:03:07 2017 (r313355) @@ -76,8 +76,8 @@ void bcache_init(u_int nblks, size_t bsi void bcache_add_dev(int); void *bcache_allocate(void); void bcache_free(void *); -int bcache_strategy(void *devdata, int rw, daddr_t blk, size_t offset, - size_t size, char *buf, size_t *rsize); +int bcache_strategy(void *devdata, int rw, daddr_t blk, size_t size, + char *buf, size_t *rsize); /* * Disk block cache @@ -85,7 +85,7 @@ int bcache_strategy(void *devdata, int r struct bcache_devdata { int (*dv_strategy)(void *devdata, int rw, daddr_t blk, - size_t offset, size_t size, char *buf, size_t *rsize); + size_t size, char *buf, size_t *rsize); void *dv_devdata; void *dv_cache; }; Modified: stable/11/sys/boot/common/disk.c ============================================================================== --- stable/11/sys/boot/common/disk.c Mon Feb 6 21:02:26 2017 (r313354) +++ stable/11/sys/boot/common/disk.c Mon Feb 6 22:03:07 2017 (r313355) @@ -178,7 +178,7 @@ ptblread(void *d, void *buf, size_t bloc dev = (struct disk_devdesc *)d; od = (struct open_disk *)dev->d_opendata; - return (dev->d_dev->dv_strategy(dev, F_READ, offset, 0, + return (dev->d_dev->dv_strategy(dev, F_READ, offset, blocks * od->sectorsize, (char *)buf, NULL)); } @@ -244,7 +244,7 @@ disk_read(struct disk_devdesc *dev, void int ret; od = (struct open_disk *)dev->d_opendata; - ret = dev->d_dev->dv_strategy(dev, F_READ, dev->d_offset + offset, 0, + ret = dev->d_dev->dv_strategy(dev, F_READ, dev->d_offset + offset, blocks * od->sectorsize, buf, NULL); return (ret); @@ -257,7 +257,7 @@ disk_write(struct disk_devdesc *dev, voi int ret; od = (struct open_disk *)dev->d_opendata; - ret = dev->d_dev->dv_strategy(dev, F_WRITE, dev->d_offset + offset, 0, + ret = dev->d_dev->dv_strategy(dev, F_WRITE, dev->d_offset + offset, blocks * od->sectorsize, buf, NULL); return (ret); Modified: stable/11/sys/boot/common/md.c ============================================================================== --- stable/11/sys/boot/common/md.c Mon Feb 6 21:02:26 2017 (r313354) +++ stable/11/sys/boot/common/md.c Mon Feb 6 22:03:07 2017 (r313355) @@ -60,7 +60,7 @@ static struct { /* devsw I/F */ static int md_init(void); -static int md_strategy(void *, int, daddr_t, size_t, size_t, char *, size_t *); +static int md_strategy(void *, int, daddr_t, size_t, char *, size_t *); static int md_open(struct open_file *, ...); static int md_close(struct open_file *); static void md_print(int); @@ -84,7 +84,7 @@ md_init(void) } static int -md_strategy(void *devdata, int rw, daddr_t blk, size_t offset, size_t size, +md_strategy(void *devdata, int rw, daddr_t blk, size_t size, char *buf, size_t *rsize) { struct devdesc *dev = (struct devdesc *)devdata; Modified: stable/11/sys/boot/efi/libefi/efipart.c ============================================================================== --- stable/11/sys/boot/efi/libefi/efipart.c Mon Feb 6 21:02:26 2017 (r313354) +++ stable/11/sys/boot/efi/libefi/efipart.c Mon Feb 6 22:03:07 2017 (r313355) @@ -41,10 +41,8 @@ __FBSDID("$FreeBSD$"); static EFI_GUID blkio_guid = BLOCK_IO_PROTOCOL; static int efipart_init(void); -static int efipart_strategy(void *, int, daddr_t, size_t, size_t, char *, - size_t *); -static int efipart_realstrategy(void *, int, daddr_t, size_t, size_t, char *, - size_t *); +static int efipart_strategy(void *, int, daddr_t, size_t, char *, size_t *); +static int efipart_realstrategy(void *, int, daddr_t, size_t, char *, size_t *); static int efipart_open(struct open_file *, ...); static int efipart_close(struct open_file *); static void efipart_print(int); @@ -284,8 +282,8 @@ efipart_readwrite(EFI_BLOCK_IO *blkio, i } static int -efipart_strategy(void *devdata, int rw, daddr_t blk, size_t offset, - size_t size, char *buf, size_t *rsize) +efipart_strategy(void *devdata, int rw, daddr_t blk, size_t size, + char *buf, size_t *rsize) { struct bcache_devdata bcd; struct devdesc *dev; @@ -294,13 +292,12 @@ efipart_strategy(void *devdata, int rw, bcd.dv_strategy = efipart_realstrategy; bcd.dv_devdata = devdata; bcd.dv_cache = PD(dev).pd_bcache; - return (bcache_strategy(&bcd, rw, blk, offset, size, - buf, rsize)); + return (bcache_strategy(&bcd, rw, blk, size, buf, rsize)); } static int -efipart_realstrategy(void *devdata, int rw, daddr_t blk, size_t offset, - size_t size, char *buf, size_t *rsize) +efipart_realstrategy(void *devdata, int rw, daddr_t blk, size_t size, + char *buf, size_t *rsize) { struct devdesc *dev = (struct devdesc *)devdata; EFI_BLOCK_IO *blkio; Modified: stable/11/sys/boot/i386/libfirewire/firewire.c ============================================================================== --- stable/11/sys/boot/i386/libfirewire/firewire.c Mon Feb 6 21:02:26 2017 (r313354) +++ stable/11/sys/boot/i386/libfirewire/firewire.c Mon Feb 6 22:03:07 2017 (r313355) @@ -66,7 +66,7 @@ struct crom_src_buf { static int fw_init(void); static int fw_strategy(void *devdata, int flag, daddr_t dblk, - size_t offset, size_t size, char *buf, size_t *rsize); + size_t size, char *buf, size_t *rsize); static int fw_open(struct open_file *f, ...); static int fw_close(struct open_file *f); static void fw_print(int verbose); @@ -201,7 +201,7 @@ fw_cleanup() } static int -fw_strategy(void *devdata, int rw, daddr_t dblk, size_t offset, size_t size, +fw_strategy(void *devdata, int rw, daddr_t dblk, size_t size, char *buf, size_t *rsize) { return (EIO); Modified: stable/11/sys/boot/i386/libi386/bioscd.c ============================================================================== --- stable/11/sys/boot/i386/libi386/bioscd.c Mon Feb 6 21:02:26 2017 (r313354) +++ stable/11/sys/boot/i386/libi386/bioscd.c Mon Feb 6 22:03:07 2017 (r313355) @@ -95,9 +95,9 @@ static int nbcinfo = 0; static int bc_read(int unit, daddr_t dblk, int blks, caddr_t dest); static int bc_init(void); static int bc_strategy(void *devdata, int flag, daddr_t dblk, - size_t offset, size_t size, char *buf, size_t *rsize); + size_t size, char *buf, size_t *rsize); static int bc_realstrategy(void *devdata, int flag, daddr_t dblk, - size_t offset, size_t size, char *buf, size_t *rsize); + size_t size, char *buf, size_t *rsize); static int bc_open(struct open_file *f, ...); static int bc_close(struct open_file *f); static void bc_print(int verbose); @@ -231,7 +231,7 @@ bc_close(struct open_file *f) } static int -bc_strategy(void *devdata, int rw, daddr_t dblk, size_t offset, size_t size, +bc_strategy(void *devdata, int rw, daddr_t dblk, size_t size, char *buf, size_t *rsize) { struct bcache_devdata bcd; @@ -242,11 +242,11 @@ bc_strategy(void *devdata, int rw, daddr bcd.dv_devdata = devdata; bcd.dv_cache = BC(dev).bc_bcache; - return (bcache_strategy(&bcd, rw, dblk, offset, size, buf, rsize)); + return (bcache_strategy(&bcd, rw, dblk, size, buf, rsize)); } static int -bc_realstrategy(void *devdata, int rw, daddr_t dblk, size_t offset, size_t size, +bc_realstrategy(void *devdata, int rw, daddr_t dblk, size_t size, char *buf, size_t *rsize) { struct i386_devdesc *dev; Modified: stable/11/sys/boot/i386/libi386/biosdisk.c ============================================================================== --- stable/11/sys/boot/i386/libi386/biosdisk.c Mon Feb 6 21:02:26 2017 (r313354) +++ stable/11/sys/boot/i386/libi386/biosdisk.c Mon Feb 6 22:03:07 2017 (r313355) @@ -128,10 +128,10 @@ static int bd_write(struct disk_devdesc static int bd_int13probe(struct bdinfo *bd); static int bd_init(void); -static int bd_strategy(void *devdata, int flag, daddr_t dblk, size_t offset, - size_t size, char *buf, size_t *rsize); -static int bd_realstrategy(void *devdata, int flag, daddr_t dblk, size_t offset, - size_t size, char *buf, size_t *rsize); +static int bd_strategy(void *devdata, int flag, daddr_t dblk, size_t size, + char *buf, size_t *rsize); +static int bd_realstrategy(void *devdata, int flag, daddr_t dblk, size_t size, + char *buf, size_t *rsize); static int bd_open(struct open_file *f, ...); static int bd_close(struct open_file *f); static int bd_ioctl(struct open_file *f, u_long cmd, void *data); @@ -478,7 +478,7 @@ bd_ioctl(struct open_file *f, u_long cmd } static int -bd_strategy(void *devdata, int rw, daddr_t dblk, size_t offset, size_t size, +bd_strategy(void *devdata, int rw, daddr_t dblk, size_t size, char *buf, size_t *rsize) { struct bcache_devdata bcd; @@ -488,12 +488,12 @@ bd_strategy(void *devdata, int rw, daddr bcd.dv_strategy = bd_realstrategy; bcd.dv_devdata = devdata; bcd.dv_cache = BD(dev).bd_bcache; - return (bcache_strategy(&bcd, rw, dblk + dev->d_offset, offset, + return (bcache_strategy(&bcd, rw, dblk + dev->d_offset, size, buf, rsize)); } static int -bd_realstrategy(void *devdata, int rw, daddr_t dblk, size_t offset, size_t size, +bd_realstrategy(void *devdata, int rw, daddr_t dblk, size_t size, char *buf, size_t *rsize) { struct disk_devdesc *dev = (struct disk_devdesc *)devdata; Modified: stable/11/sys/boot/i386/libi386/pxe.c ============================================================================== --- stable/11/sys/boot/i386/libi386/pxe.c Mon Feb 6 21:02:26 2017 (r313354) +++ stable/11/sys/boot/i386/libi386/pxe.c Mon Feb 6 22:03:07 2017 (r313355) @@ -72,7 +72,7 @@ static void bangpxe_call(int func); static int pxe_init(void); static int pxe_strategy(void *devdata, int flag, daddr_t dblk, - size_t offset, size_t size, char *buf, size_t *rsize); + size_t size, char *buf, size_t *rsize); static int pxe_open(struct open_file *f, ...); static int pxe_close(struct open_file *f); static void pxe_print(int verbose); @@ -247,8 +247,8 @@ pxe_init(void) static int -pxe_strategy(void *devdata, int flag, daddr_t dblk, size_t offset, size_t size, - char *buf, size_t *rsize) +pxe_strategy(void *devdata, int flag, daddr_t dblk, size_t size, + char *buf, size_t *rsize) { return (EIO); } Modified: stable/11/sys/boot/mips/beri/loader/beri_disk_cfi.c ============================================================================== --- stable/11/sys/boot/mips/beri/loader/beri_disk_cfi.c Mon Feb 6 21:02:26 2017 (r313354) +++ stable/11/sys/boot/mips/beri/loader/beri_disk_cfi.c Mon Feb 6 22:03:07 2017 (r313355) @@ -45,7 +45,7 @@ static int beri_cfi_disk_init(void); static int beri_cfi_disk_open(struct open_file *, ...); static int beri_cfi_disk_close(struct open_file *); static void beri_cfi_disk_cleanup(void); -static int beri_cfi_disk_strategy(void *, int, daddr_t, size_t, size_t, +static int beri_cfi_disk_strategy(void *, int, daddr_t, size_t, *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-stable-11@freebsd.org Tue Feb 7 01:13:52 2017 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E36BCCD25EA for ; Tue, 7 Feb 2017 01:13:52 +0000 (UTC) (envelope-from steven.hartland@multiplay.co.uk) Received: from mail-wm0-x22a.google.com (mail-wm0-x22a.google.com [IPv6:2a00:1450:400c:c09::22a]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 43CA61C88 for ; Tue, 7 Feb 2017 01:13:52 +0000 (UTC) (envelope-from steven.hartland@multiplay.co.uk) Received: by mail-wm0-x22a.google.com with SMTP id v77so136781463wmv.0 for ; Mon, 06 Feb 2017 17:13:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=multiplay-co-uk.20150623.gappssmtp.com; s=20150623; h=subject:to:references:from:message-id:date:user-agent:mime-version :in-reply-to; bh=kfJfkANs5/W/18Fu/6ZX5/18d5Sjgee9Xm0E8N3MCyA=; b=V6Al7KOMYq0zWywyf4XuqmU6ZU7wjfVcMuLaJEOxHMwqy9KTXO5k7AlzMan1mbQIXK yAeOrKG7dkxLRp8xlVeWzUDLWuHsWXNnwPRb/oh9QdtZP+8KZXUMuDTv0ZlodMlZ0rpJ HN+3aFThm7Ak164eqEaV1Aem1jLrrQ5+GlVrO2O/uaK/v6P18eimbNxHprffmJYWJ4GO /rnNrQV0VJyKDcyAC+7DqjdU5hBviSstwodHQjwUAvpamhsVEhi9azNQuo0MPc3EKVm0 3xi5LT9lMeLFHm9OdIxEw8pUfOdKL21QbfoA9Lfj7XH+aIH7pu9mjf5f1ZqK6QZ0B3k0 dFIQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to; bh=kfJfkANs5/W/18Fu/6ZX5/18d5Sjgee9Xm0E8N3MCyA=; b=kUzPTAUWh99AT5s2W7zdW6/XVflIVdViqR06i60zUNW6PwFtMS36Z4ct1SBymLJF9B lhwbEyKbe7pSmx52JpOS+C6Um+H4E3T7vqQj/mrcskMONyrcBb/es+1lthdQ7uMWmsHh MKmZhGJuGnSJ2NLWbUb/B3o3y5ag4clfrn27qwjwT65k3edaBUWt/m35Mgn/bfYpZ5Rg 8ol510z4N2R/lRplRFo+XiO4vCNr24JGwFPUXl97Fmt0jOWzDvzsVZkh2mZjKSmyaXji smV4Hakycl9rxOskkiMhfrcO0rHJm7HtnO6CoGnf/tXvaBWRFLuyAQlCJwxAcjN/e6LR +SMA== X-Gm-Message-State: AMke39nMNN5/a9qMM6n2T68+2zUYFdpTIS7QhghDqnxGMuLGBhl4DDVWO6qdj8BmpNNhnfYn X-Received: by 10.28.178.16 with SMTP id b16mr11863522wmf.83.1486430030152; Mon, 06 Feb 2017 17:13:50 -0800 (PST) Received: from [10.10.1.58] ([185.97.61.26]) by smtp.gmail.com with ESMTPSA id b15sm4524173wra.4.2017.02.06.17.13.48 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 06 Feb 2017 17:13:49 -0800 (PST) Subject: Re: svn commit: r313355 - in stable/11: lib/libstand sys/boot/common sys/boot/efi/libefi sys/boot/i386/libfirewire sys/boot/i386/libi386 sys/boot/mips/beri/loader sys/boot/ofw/libofw sys/boot/pc98/libp... To: Toomas Soome , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org References: <201702062203.v16M37hK098561@repo.freebsd.org> From: Steven Hartland Message-ID: <7039cd35-17ea-e811-4eb4-cc51ca24e120@multiplay.co.uk> Date: Tue, 7 Feb 2017 01:13:50 +0000 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.7.0 MIME-Version: 1.0 In-Reply-To: <201702062203.v16M37hK098561@repo.freebsd.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-Content-Filtered-By: Mailman/MimeDel 2.1.23 X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Feb 2017 01:13:53 -0000 IMO combining fixes from different areas (yes mainly libstand but dosfs and nandfs) and with style cleanups is not ideal as it makes it much harder to find and identify problems. I appreciate these have been in head for a while but its not unheard of to only identify issues once they are MFC'ed, so keeping the separation is better. You also missed the description from the 3rd commit e.g. loader: nandfs calls strategy with one extra argument. Finally keep the "r" prefix when mentioning the revisions being MFC'ed as that ensure they linked in svnweb properly e.g. MFC r309369, r310850, r310853: On 06/02/2017 22:03, Toomas Soome wrote: > Author: tsoome > Date: Mon Feb 6 22:03:07 2017 > New Revision: 313355 > URL: https://svnweb.freebsd.org/changeset/base/313355 > > Log: > MFC r309369,310850,310853: > > libstand: dosfs cstyle cleanup for return keyword. > dosfs support in libstand is broken since r298230 > > PR: 214423 > Submitted by: Mikhail Kupchik > Reported by: Mikhail Kupchik > Approved by: imp (mentor) > > Modified: > stable/11/lib/libstand/cd9660.c > stable/11/lib/libstand/dosfs.c > stable/11/lib/libstand/ext2fs.c > stable/11/lib/libstand/nandfs.c > stable/11/lib/libstand/read.c > stable/11/lib/libstand/stand.h > stable/11/lib/libstand/ufs.c > stable/11/lib/libstand/write.c > stable/11/sys/boot/common/bcache.c > stable/11/sys/boot/common/bootstrap.h > stable/11/sys/boot/common/disk.c > stable/11/sys/boot/common/md.c > stable/11/sys/boot/efi/libefi/efipart.c > stable/11/sys/boot/i386/libfirewire/firewire.c > stable/11/sys/boot/i386/libi386/bioscd.c > stable/11/sys/boot/i386/libi386/biosdisk.c > stable/11/sys/boot/i386/libi386/pxe.c > stable/11/sys/boot/mips/beri/loader/beri_disk_cfi.c > stable/11/sys/boot/mips/beri/loader/beri_disk_sdcard.c > stable/11/sys/boot/ofw/libofw/ofw_disk.c > stable/11/sys/boot/pc98/libpc98/bioscd.c > stable/11/sys/boot/pc98/libpc98/biosdisk.c > stable/11/sys/boot/powerpc/kboot/hostdisk.c > stable/11/sys/boot/powerpc/ps3/ps3cdrom.c > stable/11/sys/boot/powerpc/ps3/ps3disk.c > stable/11/sys/boot/uboot/lib/disk.c > stable/11/sys/boot/usb/storage/umass_loader.c > stable/11/sys/boot/userboot/userboot/host.c > stable/11/sys/boot/userboot/userboot/userboot_disk.c > stable/11/sys/boot/zfs/zfs.c > Directory Properties: > stable/11/ (props changed) > > Modified: stable/11/lib/libstand/cd9660.c > ============================================================================== > --- stable/11/lib/libstand/cd9660.c Mon Feb 6 21:02:26 2017 (r313354) > +++ stable/11/lib/libstand/cd9660.c Mon Feb 6 22:03:07 2017 (r313355) > @@ -143,7 +143,7 @@ susp_lookup_record(struct open_file *f, > if (bcmp(sh->type, SUSP_CONTINUATION, 2) == 0) { > shc = (ISO_RRIP_CONT *)sh; > error = f->f_dev->dv_strategy(f->f_devdata, F_READ, > - cdb2devb(isonum_733(shc->location)), 0, > + cdb2devb(isonum_733(shc->location)), > ISO_DEFAULT_BLOCK_SIZE, susp_buffer, &read); > > /* Bail if it fails. */ > @@ -288,7 +288,7 @@ cd9660_open(const char *path, struct ope > for (bno = 16;; bno++) { > twiddle(1); > rc = f->f_dev->dv_strategy(f->f_devdata, F_READ, cdb2devb(bno), > - 0, ISO_DEFAULT_BLOCK_SIZE, buf, &read); > + ISO_DEFAULT_BLOCK_SIZE, buf, &read); > if (rc) > goto out; > if (read != ISO_DEFAULT_BLOCK_SIZE) { > @@ -322,7 +322,7 @@ cd9660_open(const char *path, struct ope > twiddle(1); > rc = f->f_dev->dv_strategy > (f->f_devdata, F_READ, > - cdb2devb(bno + boff), 0, > + cdb2devb(bno + boff), > ISO_DEFAULT_BLOCK_SIZE, > buf, &read); > if (rc) > @@ -381,7 +381,7 @@ cd9660_open(const char *path, struct ope > bno = isonum_733(rec.extent) + isonum_711(rec.ext_attr_length); > twiddle(1); > rc = f->f_dev->dv_strategy(f->f_devdata, F_READ, cdb2devb(bno), > - 0, ISO_DEFAULT_BLOCK_SIZE, buf, &read); > + ISO_DEFAULT_BLOCK_SIZE, buf, &read); > if (rc) > goto out; > if (read != ISO_DEFAULT_BLOCK_SIZE) { > @@ -438,7 +438,7 @@ buf_read_file(struct open_file *f, char > > twiddle(16); > rc = f->f_dev->dv_strategy(f->f_devdata, F_READ, > - cdb2devb(blkno), 0, ISO_DEFAULT_BLOCK_SIZE, > + cdb2devb(blkno), ISO_DEFAULT_BLOCK_SIZE, > fp->f_buf, &read); > if (rc) > return (rc); > > Modified: stable/11/lib/libstand/dosfs.c > ============================================================================== > --- stable/11/lib/libstand/dosfs.c Mon Feb 6 21:02:26 2017 (r313354) > +++ stable/11/lib/libstand/dosfs.c Mon Feb 6 22:03:07 2017 (r313355) > @@ -154,7 +154,7 @@ static int fatcnt(DOS_FS *, u_int); > static int fatget(DOS_FS *, u_int *); > static int fatend(u_int, u_int); > static int ioread(DOS_FS *, u_int, void *, u_int); > -static int ioget(struct open_file *, daddr_t, size_t, void *, u_int); > +static int ioget(struct open_file *, daddr_t, void *, u_int); > > static void > dos_read_fat(DOS_FS *fs, struct open_file *fd) > @@ -172,7 +172,7 @@ dos_read_fat(DOS_FS *fs, struct open_fil > fat.buf = malloc(secbyt(fs->spf)); > > if (fat.buf != NULL) { > - if (ioget(fd, fs->lsnfat, 0, fat.buf, secbyt(fs->spf)) == 0) { > + if (ioget(fd, fs->lsnfat, fat.buf, secbyt(fs->spf)) == 0) { > fat.size = fs->spf; > fat.unit = dd->d_unit; > return; > @@ -199,12 +199,12 @@ dos_mount(DOS_FS *fs, struct open_file * > fs->fd = fd; > > if ((err = !(buf = malloc(secbyt(1))) ? errno : 0) || > - (err = ioget(fs->fd, 0, 0, buf, secbyt(1))) || > + (err = ioget(fs->fd, 0, buf, secbyt(1))) || > (err = parsebs(fs, (DOS_BS *)buf))) { > if (buf != NULL) > free(buf); > (void)dosunmount(fs); > - return(err); > + return (err); > } > free(buf); > > @@ -219,7 +219,7 @@ dos_mount(DOS_FS *fs, struct open_file * > fs->root.dex.h_clus[0] = (fs->rdcl >> 16) & 0xff; > fs->root.dex.h_clus[1] = (fs->rdcl >> 24) & 0xff; > } > - return 0; > + return (0); > } > > /* > @@ -231,10 +231,10 @@ dos_unmount(DOS_FS *fs) > int err; > > if (fs->links) > - return(EBUSY); > + return (EBUSY); > if ((err = dosunmount(fs))) > - return(err); > - return 0; > + return (err); > + return (0); > } > > /* > @@ -244,7 +244,7 @@ static int > dosunmount(DOS_FS *fs) > { > free(fs); > - return(0); > + return (0); > } > > /* > @@ -285,7 +285,7 @@ dos_open(const char *path, struct open_f > fd->f_fsdata = (void *)f; > > out: > - return(err); > + return (err); > } > > /* > @@ -307,7 +307,7 @@ dos_read(struct open_file *fd, void *buf > twiddle(4); > nb = (u_int)nbyte; > if ((size = fsize(f->fs, &f->de)) == -1) > - return EINVAL; > + return (EINVAL); > if (nb > (n = size - f->offset)) > nb = n; > off = f->offset; > @@ -344,7 +344,7 @@ dos_read(struct open_file *fd, void *buf > out: > if (resid) > *resid = nbyte - nb + cnt; > - return(err); > + return (err); > } > > /* > @@ -370,16 +370,16 @@ dos_seek(struct open_file *fd, off_t off > break; > default: > errno = EINVAL; > - return(-1); > + return (-1); > } > off += offset; > if (off < 0 || off > size) { > errno = EINVAL; > - return(-1); > + return (-1); > } > f->offset = (u_int)off; > f->c = 0; > - return(off); > + return (off); > } > > /* > @@ -394,7 +394,7 @@ dos_close(struct open_file *fd) > f->fs->links--; > free(f); > dos_unmount(fs); > - return 0; > + return (0); > } > > /* > @@ -411,7 +411,7 @@ dos_stat(struct open_file *fd, struct st > sb->st_uid = 0; > sb->st_gid = 0; > if ((sb->st_size = fsize(f->fs, &f->de)) == -1) > - return EINVAL; > + return (EINVAL); > return (0); > } > > @@ -501,7 +501,7 @@ dos_readdir(struct open_file *fd, struct > d->d_reclen = sizeof(*d); > d->d_type = (dd.de.attr & FA_DIR) ? DT_DIR : DT_REG; > memcpy(d->d_name, fn, sizeof(d->d_name)); > - return(0); > + return (0); > } > > /* > @@ -516,41 +516,41 @@ parsebs(DOS_FS *fs, DOS_BS *bs) > bs->jmp[0] != 0xe9 && > (bs->jmp[0] != 0xeb || bs->jmp[2] != 0x90)) || > bs->bpb.media < 0xf0) > - return EINVAL; > + return (EINVAL); > if (cv2(bs->bpb.secsiz) != SECSIZ) > - return EINVAL; > + return (EINVAL); > if (!(fs->spc = bs->bpb.spc) || fs->spc & (fs->spc - 1)) > - return EINVAL; > + return (EINVAL); > fs->bsize = secbyt(fs->spc); > fs->bshift = ffs(fs->bsize) - 1; > if ((fs->spf = cv2(bs->bpb.spf))) { > if (bs->bpb.fats != 2) > - return EINVAL; > + return (EINVAL); > if (!(fs->dirents = cv2(bs->bpb.dirents))) > - return EINVAL; > + return (EINVAL); > } else { > if (!(fs->spf = cv4(bs->bpb.lspf))) > - return EINVAL; > + return (EINVAL); > if (!bs->bpb.fats || bs->bpb.fats > 16) > - return EINVAL; > + return (EINVAL); > if ((fs->rdcl = cv4(bs->bpb.rdcl)) < LOCLUS) > - return EINVAL; > + return (EINVAL); > } > if (!(fs->lsnfat = cv2(bs->bpb.ressec))) > - return EINVAL; > + return (EINVAL); > fs->lsndir = fs->lsnfat + fs->spf * bs->bpb.fats; > fs->lsndta = fs->lsndir + entsec(fs->dirents); > if (!(sc = cv2(bs->bpb.secs)) && !(sc = cv4(bs->bpb.lsecs))) > - return EINVAL; > + return (EINVAL); > if (fs->lsndta > sc) > - return EINVAL; > + return (EINVAL); > if ((fs->xclus = secblk(fs, sc - fs->lsndta) + 1) < LOCLUS) > - return EINVAL; > + return (EINVAL); > fs->fatsz = fs->dirents ? fs->xclus < 0xff6 ? 12 : 16 : 32; > sc = (secbyt(fs->spf) << 1) / (fs->fatsz >> 2) - 1; > if (fs->xclus > sc) > fs->xclus = sc; > - return 0; > + return (0); > } > > /* > @@ -575,17 +575,17 @@ namede(DOS_FS *fs, const char *path, DOS > if (!(s = strchr(path, '/'))) > s = strchr(path, 0); > if ((n = s - path) > 255) > - return ENAMETOOLONG; > + return (ENAMETOOLONG); > memcpy(name, path, n); > name[n] = 0; > path = s; > if (!(de->attr & FA_DIR)) > - return ENOTDIR; > + return (ENOTDIR); > if ((err = lookup(fs, stclus(fs->fatsz, de), name, &de))) > - return err; > + return (err); > } > *dep = de; > - return 0; > + return (0); > } > > /* > @@ -604,7 +604,7 @@ lookup(DOS_FS *fs, u_int clus, const cha > for (ent = 0; ent < 2; ent++) > if (!strcasecmp(name, dotstr[ent])) { > *dep = dot + ent; > - return 0; > + return (0); > } > if (!clus && fs->fatsz == 32) > clus = fs->rdcl; > @@ -617,13 +617,13 @@ lookup(DOS_FS *fs, u_int clus, const cha > else if (okclus(fs, clus)) > lsec = blklsn(fs, clus); > else > - return EINVAL; > + return (EINVAL); > for (sec = 0; sec < nsec; sec++) { > - if ((err = ioget(fs->fd, lsec + sec, 0, dir, secbyt(1)))) > - return err; > + if ((err = ioget(fs->fd, lsec + sec, dir, secbyt(1)))) > + return (err); > for (ent = 0; ent < DEPSEC; ent++) { > if (!*dir[ent].de.name) > - return ENOENT; > + return (ENOENT); > if (*dir[ent].de.name != 0xe5) { > if ((dir[ent].de.attr & FA_MASK) == FA_XDE) { > x = dir[ent].xde.seq; > @@ -651,7 +651,7 @@ lookup(DOS_FS *fs, u_int clus, const cha > } > if (ok) { > *dep = &dir[ent].de; > - return 0; > + return (0); > } > } > } > @@ -661,11 +661,11 @@ lookup(DOS_FS *fs, u_int clus, const cha > if (!clus) > break; > if ((err = fatget(fs, &clus))) > - return err; > + return (err); > if (fatend(fs->fatsz, clus)) > break; > } > - return ENOENT; > + return (ENOENT); > } > > /* > @@ -739,11 +739,11 @@ fsize(DOS_FS *fs, DOS_DE *de) > size = fs->dirents * sizeof(DOS_DE); > else { > if ((n = fatcnt(fs, c)) == -1) > - return n; > + return (n); > size = blkbyt(fs, n); > } > } > - return size; > + return (size); > } > > /* > @@ -756,8 +756,8 @@ fatcnt(DOS_FS *fs, u_int c) > > for (n = 0; okclus(fs, c); n++) > if (fatget(fs, &c)) > - return -1; > - return fatend(fs->fatsz, c) ? n : -1; > + return (-1); > + return (fatend(fs->fatsz, c) ? n : -1); > } > > /* > @@ -768,8 +768,7 @@ static int > fatget(DOS_FS *fs, u_int *c) > { > u_char buf[4]; > - u_char *s; > - u_int x, offset, off, n, nbyte, lsec; > + u_int x, offset, n, nbyte; > struct devdesc *dd = fs->fd->f_devdata; > int err = 0; > > @@ -783,25 +782,9 @@ fatget(DOS_FS *fs, u_int *c) > offset = fatoff(fs->fatsz, *c); > nbyte = fs->fatsz != 32 ? 2 : 4; > > - s = buf; > - if ((off = offset & (SECSIZ - 1))) { > - offset -= off; > - lsec = bytsec(offset); > - offset += SECSIZ; > - if ((n = SECSIZ - off) > nbyte) > - n = nbyte; > - memcpy(s, fat.buf + secbyt(lsec) + off, n); > - s += n; > - nbyte -= n; > - } > - n = nbyte & (SECSIZ - 1); > - if (nbyte -= n) { > - memcpy(s, fat.buf + secbyt(bytsec(offset)), nbyte); > - offset += nbyte; > - s += nbyte; > - } > - if (n) > - memcpy(s, fat.buf + secbyt(bytsec(offset)), n); > + if (offset + nbyte > secbyt(fat.size)) > + return (EINVAL); > + memcpy(buf, fat.buf + offset, nbyte); > } > > x = fs->fatsz != 32 ? cv2(buf) : cv4(buf); > @@ -815,7 +798,7 @@ fatget(DOS_FS *fs, u_int *c) > static int > fatend(u_int sz, u_int c) > { > - return c > (sz == 12 ? 0xff7U : sz == 16 ? 0xfff7U : 0xffffff7); > + return (c > (sz == 12 ? 0xff7U : sz == 16 ? 0xfff7U : 0xffffff7)); > } > > /* > @@ -827,38 +810,41 @@ ioread(DOS_FS *fs, u_int offset, void *b > char *s; > u_int off, n; > int err; > + u_char local_buf[SECSIZ]; > > s = buf; > if ((off = offset & (SECSIZ - 1))) { > offset -= off; > if ((n = SECSIZ - off) > nbyte) > n = nbyte; > - if ((err = ioget(fs->fd, bytsec(offset), off, s, n))) > - return err; > + if ((err = ioget(fs->fd, bytsec(offset), local_buf, sizeof(local_buf)))) > + return (err); > + memcpy(s, local_buf + off, n); > offset += SECSIZ; > s += n; > nbyte -= n; > } > n = nbyte & (SECSIZ - 1); > if (nbyte -= n) { > - if ((err = ioget(fs->fd, bytsec(offset), 0, s, nbyte))) > - return err; > + if ((err = ioget(fs->fd, bytsec(offset), s, nbyte))) > + return (err); > offset += nbyte; > s += nbyte; > } > if (n) { > - if ((err = ioget(fs->fd, bytsec(offset), 0, s, n))) > - return err; > + if ((err = ioget(fs->fd, bytsec(offset), local_buf, sizeof(local_buf)))) > + return (err); > + memcpy(s, local_buf, n); > } > - return 0; > + return (0); > } > > /* > * Sector-based I/O primitive > */ > static int > -ioget(struct open_file *fd, daddr_t lsec, size_t offset, void *buf, u_int size) > +ioget(struct open_file *fd, daddr_t lsec, void *buf, u_int size) > { > - return ((fd->f_dev->dv_strategy)(fd->f_devdata, F_READ, lsec, offset, > + return ((fd->f_dev->dv_strategy)(fd->f_devdata, F_READ, lsec, > size, buf, NULL)); > } > > Modified: stable/11/lib/libstand/ext2fs.c > ============================================================================== > --- stable/11/lib/libstand/ext2fs.c Mon Feb 6 21:02:26 2017 (r313354) > +++ stable/11/lib/libstand/ext2fs.c Mon Feb 6 22:03:07 2017 (r313355) > @@ -355,7 +355,7 @@ ext2fs_open(const char *upath, struct op > fp->f_fs = fs; > twiddle(1); > error = (f->f_dev->dv_strategy)(f->f_devdata, F_READ, > - EXT2_SBLOCK, 0, EXT2_SBSIZE, (char *)fs, &buf_size); > + EXT2_SBLOCK, EXT2_SBSIZE, (char *)fs, &buf_size); > if (error) > goto out; > > @@ -397,7 +397,7 @@ ext2fs_open(const char *upath, struct op > fp->f_bg = malloc(len); > twiddle(1); > error = (f->f_dev->dv_strategy)(f->f_devdata, F_READ, > - EXT2_SBLOCK + EXT2_SBSIZE / DEV_BSIZE, 0, len, > + EXT2_SBLOCK + EXT2_SBSIZE / DEV_BSIZE, len, > (char *)fp->f_bg, &buf_size); > if (error) > goto out; > @@ -509,7 +509,7 @@ ext2fs_open(const char *upath, struct op > > twiddle(1); > error = (f->f_dev->dv_strategy)(f->f_devdata, > - F_READ, fsb_to_db(fs, disk_block), 0, > + F_READ, fsb_to_db(fs, disk_block), > fs->fs_bsize, buf, &buf_size); > if (error) > goto out; > @@ -570,7 +570,7 @@ read_inode(ino_t inumber, struct open_fi > buf = malloc(fs->fs_bsize); > twiddle(1); > error = (f->f_dev->dv_strategy)(f->f_devdata, F_READ, > - ino_to_db(fs, fp->f_bg, inumber), 0, fs->fs_bsize, buf, &rsize); > + ino_to_db(fs, fp->f_bg, inumber), fs->fs_bsize, buf, &rsize); > if (error) > goto out; > if (rsize != fs->fs_bsize) { > @@ -667,7 +667,7 @@ block_map(struct open_file *f, daddr_t f > malloc(fs->fs_bsize); > twiddle(1); > error = (f->f_dev->dv_strategy)(f->f_devdata, F_READ, > - fsb_to_db(fp->f_fs, ind_block_num), 0, fs->fs_bsize, > + fsb_to_db(fp->f_fs, ind_block_num), fs->fs_bsize, > fp->f_blk[level], &fp->f_blksize[level]); > if (error) > return (error); > @@ -725,7 +725,7 @@ buf_read_file(struct open_file *f, char > } else { > twiddle(4); > error = (f->f_dev->dv_strategy)(f->f_devdata, F_READ, > - fsb_to_db(fs, disk_block), 0, block_size, > + fsb_to_db(fs, disk_block), block_size, > fp->f_buf, &fp->f_buf_size); > if (error) > goto done; > > Modified: stable/11/lib/libstand/nandfs.c > ============================================================================== > --- stable/11/lib/libstand/nandfs.c Mon Feb 6 21:02:26 2017 (r313354) > +++ stable/11/lib/libstand/nandfs.c Mon Feb 6 22:03:07 2017 (r313355) > @@ -1024,7 +1024,7 @@ ioread(struct open_file *f, off_t pos, v > > buffer = malloc(nsec * bsize); > > - err = (f->f_dev->dv_strategy)(f->f_devdata, F_READ, pos, 0, > + err = (f->f_dev->dv_strategy)(f->f_devdata, F_READ, pos, > nsec * bsize, buffer, NULL); > > memcpy(buf, (void *)((uintptr_t)buffer + off), length); > @@ -1045,7 +1045,7 @@ nandfs_probe_sectorsize(struct open_file > > for (i = 512; i < (16 * 1024); i <<= 1) { > NANDFS_DEBUG("%d ", i); > - err = (f->f_dev->dv_strategy)(f->f_devdata, F_READ, 0, 0, i, > + err = (f->f_dev->dv_strategy)(f->f_devdata, F_READ, 0, i, > buffer, NULL); > > if (err == 0) { > > Modified: stable/11/lib/libstand/read.c > ============================================================================== > --- stable/11/lib/libstand/read.c Mon Feb 6 21:02:26 2017 (r313354) > +++ stable/11/lib/libstand/read.c Mon Feb 6 22:03:07 2017 (r313355) > @@ -79,7 +79,7 @@ read(int fd, void *dest, size_t bcount) > if (f->f_flags & F_RAW) { > twiddle(4); > errno = (f->f_dev->dv_strategy)(f->f_devdata, F_READ, > - btodb(f->f_offset), 0, bcount, dest, &resid); > + btodb(f->f_offset), bcount, dest, &resid); > if (errno) > return (-1); > f->f_offset += resid; > > Modified: stable/11/lib/libstand/stand.h > ============================================================================== > --- stable/11/lib/libstand/stand.h Mon Feb 6 21:02:26 2017 (r313354) > +++ stable/11/lib/libstand/stand.h Mon Feb 6 22:03:07 2017 (r313355) > @@ -139,7 +139,7 @@ struct devsw { > int dv_type; /* opaque type constant, arch-dependant */ > int (*dv_init)(void); /* early probe call */ > int (*dv_strategy)(void *devdata, int rw, daddr_t blk, > - size_t offset, size_t size, char *buf, size_t *rsize); > + size_t size, char *buf, size_t *rsize); > int (*dv_open)(struct open_file *f, ...); > int (*dv_close)(struct open_file *f); > int (*dv_ioctl)(struct open_file *f, u_long cmd, void *data); > > Modified: stable/11/lib/libstand/ufs.c > ============================================================================== > --- stable/11/lib/libstand/ufs.c Mon Feb 6 21:02:26 2017 (r313354) > +++ stable/11/lib/libstand/ufs.c Mon Feb 6 22:03:07 2017 (r313355) > @@ -157,7 +157,7 @@ read_inode(inumber, f) > buf = malloc(fs->fs_bsize); > twiddle(1); > rc = (f->f_dev->dv_strategy)(f->f_devdata, F_READ, > - fsbtodb(fs, ino_to_fsba(fs, inumber)), 0, fs->fs_bsize, > + fsbtodb(fs, ino_to_fsba(fs, inumber)), fs->fs_bsize, > buf, &rsize); > if (rc) > goto out; > @@ -267,7 +267,7 @@ block_map(f, file_block, disk_block_p) > malloc(fs->fs_bsize); > twiddle(1); > rc = (f->f_dev->dv_strategy)(f->f_devdata, F_READ, > - fsbtodb(fp->f_fs, ind_block_num), 0, > + fsbtodb(fp->f_fs, ind_block_num), > fs->fs_bsize, > fp->f_blk[level], > &fp->f_blksize[level]); > @@ -348,7 +348,7 @@ buf_write_file(f, buf_p, size_p) > > twiddle(4); > rc = (f->f_dev->dv_strategy)(f->f_devdata, F_READ, > - fsbtodb(fs, disk_block), 0, > + fsbtodb(fs, disk_block), > block_size, fp->f_buf, &fp->f_buf_size); > if (rc) > return (rc); > @@ -367,7 +367,7 @@ buf_write_file(f, buf_p, size_p) > > twiddle(4); > rc = (f->f_dev->dv_strategy)(f->f_devdata, F_WRITE, > - fsbtodb(fs, disk_block), 0, > + fsbtodb(fs, disk_block), > block_size, fp->f_buf, &fp->f_buf_size); > return (rc); > } > @@ -408,7 +408,7 @@ buf_read_file(f, buf_p, size_p) > } else { > twiddle(4); > rc = (f->f_dev->dv_strategy)(f->f_devdata, F_READ, > - fsbtodb(fs, disk_block), 0, > + fsbtodb(fs, disk_block), > block_size, fp->f_buf, &fp->f_buf_size); > if (rc) > return (rc); > @@ -521,7 +521,7 @@ ufs_open(upath, f) > */ > for (i = 0; sblock_try[i] != -1; i++) { > rc = (f->f_dev->dv_strategy)(f->f_devdata, F_READ, > - sblock_try[i] / DEV_BSIZE, 0, SBLOCKSIZE, > + sblock_try[i] / DEV_BSIZE, SBLOCKSIZE, > (char *)fs, &buf_size); > if (rc) > goto out; > @@ -651,7 +651,7 @@ ufs_open(upath, f) > > twiddle(1); > rc = (f->f_dev->dv_strategy)(f->f_devdata, > - F_READ, fsbtodb(fs, disk_block), 0, > + F_READ, fsbtodb(fs, disk_block), > fs->fs_bsize, buf, &buf_size); > if (rc) > goto out; > > Modified: stable/11/lib/libstand/write.c > ============================================================================== > --- stable/11/lib/libstand/write.c Mon Feb 6 21:02:26 2017 (r313354) > +++ stable/11/lib/libstand/write.c Mon Feb 6 22:03:07 2017 (r313355) > @@ -82,7 +82,7 @@ write(fd, dest, bcount) > if (f->f_flags & F_RAW) { > twiddle(4); > errno = (f->f_dev->dv_strategy)(f->f_devdata, F_WRITE, > - btodb(f->f_offset), 0, bcount, dest, &resid); > + btodb(f->f_offset), bcount, dest, &resid); > if (errno) > return (-1); > f->f_offset += resid; > > Modified: stable/11/sys/boot/common/bcache.c > ============================================================================== > --- stable/11/sys/boot/common/bcache.c Mon Feb 6 21:02:26 2017 (r313354) > +++ stable/11/sys/boot/common/bcache.c Mon Feb 6 22:03:07 2017 (r313355) > @@ -182,8 +182,8 @@ bcache_free(void *cache) > * cache with the new values. > */ > static int > -write_strategy(void *devdata, int rw, daddr_t blk, size_t offset, > - size_t size, char *buf, size_t *rsize) > +write_strategy(void *devdata, int rw, daddr_t blk, size_t size, > + char *buf, size_t *rsize) > { > struct bcache_devdata *dd = (struct bcache_devdata *)devdata; > struct bcache *bc = dd->dv_cache; > @@ -197,7 +197,7 @@ write_strategy(void *devdata, int rw, da > } > > /* Write the blocks */ > - return (dd->dv_strategy(dd->dv_devdata, rw, blk, offset, size, buf, rsize)); > + return (dd->dv_strategy(dd->dv_devdata, rw, blk, size, buf, rsize)); > } > > /* > @@ -206,8 +206,8 @@ write_strategy(void *devdata, int rw, da > * device I/O and then use the I/O results to populate the cache. > */ > static int > -read_strategy(void *devdata, int rw, daddr_t blk, size_t offset, > - size_t size, char *buf, size_t *rsize) > +read_strategy(void *devdata, int rw, daddr_t blk, size_t size, > + char *buf, size_t *rsize) > { > struct bcache_devdata *dd = (struct bcache_devdata *)devdata; > struct bcache *bc = dd->dv_cache; > @@ -225,7 +225,7 @@ read_strategy(void *devdata, int rw, dad > *rsize = 0; > > nblk = size / bcache_blksize; > - if ((nblk == 0 && size != 0) || offset != 0) > + if (nblk == 0 && size != 0) > nblk++; > result = 0; > complete = 1; > @@ -246,8 +246,7 @@ read_strategy(void *devdata, int rw, dad > if (complete) { /* whole set was in cache, return it */ > if (bc->ra < BCACHE_READAHEAD) > bc->ra <<= 1; /* increase read ahead */ > - bcopy(bc->bcache_data + (bcache_blksize * BHASH(bc, blk)) + offset, > - buf, size); > + bcopy(bc->bcache_data + (bcache_blksize * BHASH(bc, blk)), buf, size); > goto done; > } > > @@ -282,7 +281,7 @@ read_strategy(void *devdata, int rw, dad > * in either case we should return the data in bcache and only > * return error if there is no data. > */ > - result = dd->dv_strategy(dd->dv_devdata, rw, p_blk, 0, > + result = dd->dv_strategy(dd->dv_devdata, rw, p_blk, > p_size * bcache_blksize, p_buf, &r_size); > > r_size /= bcache_blksize; > @@ -305,8 +304,7 @@ read_strategy(void *devdata, int rw, dad > > size = i * bcache_blksize; > if (size != 0) { > - bcopy(bc->bcache_data + (bcache_blksize * BHASH(bc, blk)) + offset, > - buf, size); > + bcopy(bc->bcache_data + (bcache_blksize * BHASH(bc, blk)), buf, size); > result = 0; > } > > @@ -321,8 +319,8 @@ read_strategy(void *devdata, int rw, dad > * directly to the disk. XXX tune this. > */ > int > -bcache_strategy(void *devdata, int rw, daddr_t blk, size_t offset, > - size_t size, char *buf, size_t *rsize) > +bcache_strategy(void *devdata, int rw, daddr_t blk, size_t size, > + char *buf, size_t *rsize) > { > struct bcache_devdata *dd = (struct bcache_devdata *)devdata; > struct bcache *bc = dd->dv_cache; > @@ -337,23 +335,16 @@ bcache_strategy(void *devdata, int rw, d > > /* bypass large requests, or when the cache is inactive */ > if (bc == NULL || > - (offset == 0 && ((size * 2 / bcache_blksize) > bcache_nblks))) { > + ((size * 2 / bcache_blksize) > bcache_nblks)) { > DEBUG("bypass %d from %d", size / bcache_blksize, blk); > bcache_bypasses++; > - return (dd->dv_strategy(dd->dv_devdata, rw, blk, offset, size, buf, > - rsize)); > - } > - > - /* normalize offset */ > - while (offset >= bcache_blksize) { > - blk++; > - offset -= bcache_blksize; > + return (dd->dv_strategy(dd->dv_devdata, rw, blk, size, buf, rsize)); > } > > switch (rw) { > case F_READ: > nblk = size / bcache_blksize; > - if (offset || (size != 0 && nblk == 0)) > + if (size != 0 && nblk == 0) > nblk++; /* read at least one block */ > > ret = 0; > @@ -364,14 +355,10 @@ bcache_strategy(void *devdata, int rw, d > > if (size <= bcache_blksize) > csize = size; > - else { > + else > csize = cblk * bcache_blksize; > - if (offset) > - csize -= (bcache_blksize - offset); > - } > > - ret = read_strategy(devdata, rw, blk, offset, > - csize, buf+total, &isize); > + ret = read_strategy(devdata, rw, blk, csize, buf+total, &isize); > > /* > * we may have error from read ahead, if we have read some data > @@ -382,8 +369,7 @@ bcache_strategy(void *devdata, int rw, d > ret = 0; > break; > } > - blk += (offset+isize) / bcache_blksize; > - offset = 0; > + blk += isize / bcache_blksize; > total += isize; > size -= isize; > nblk = size / bcache_blksize; > @@ -394,7 +380,7 @@ bcache_strategy(void *devdata, int rw, d > > return (ret); > case F_WRITE: > - return write_strategy(devdata, rw, blk, offset, size, buf, rsize); > + return write_strategy(devdata, rw, blk, size, buf, rsize); > } > return -1; > } > > Modified: stable/11/sys/boot/common/bootstrap.h > ============================================================================== > --- stable/11/sys/boot/common/bootstrap.h Mon Feb 6 21:02:26 2017 (r313354) > +++ stable/11/sys/boot/common/bootstrap.h Mon Feb 6 22:03:07 2017 (r313355) > @@ -76,8 +76,8 @@ void bcache_init(u_int nblks, size_t bsi > void bcache_add_dev(int); > void *bcache_allocate(void); > void bcache_free(void *); > -int bcache_strategy(void *devdata, int rw, daddr_t blk, size_t offset, > - size_t size, char *buf, size_t *rsize); > +int bcache_strategy(void *devdata, int rw, daddr_t blk, size_t size, > + char *buf, size_t *rsize); > > /* > * Disk block cache > @@ -85,7 +85,7 @@ int bcache_strategy(void *devdata, int r > struct bcache_devdata > { > int (*dv_strategy)(void *devdata, int rw, daddr_t blk, > - size_t offset, size_t size, char *buf, size_t *rsize); > + size_t size, char *buf, size_t *rsize); > void *dv_devdata; > void *dv_cache; > }; > > Modified: stable/11/sys/boot/common/disk.c > ============================================================================== > --- stable/11/sys/boot/common/disk.c Mon Feb 6 21:02:26 2017 (r313354) > +++ stable/11/sys/boot/common/disk.c Mon Feb 6 22:03:07 2017 (r313355) > @@ -178,7 +178,7 @@ ptblread(void *d, void *buf, size_t bloc > > dev = (struct disk_devdesc *)d; > od = (struct open_disk *)dev->d_opendata; > - return (dev->d_dev->dv_strategy(dev, F_READ, offset, 0, > + return (dev->d_dev->dv_strategy(dev, F_READ, offset, > blocks * od->sectorsize, (char *)buf, NULL)); > } > > @@ -244,7 +244,7 @@ disk_read(struct disk_devdesc *dev, void > int ret; > > od = (struct open_disk *)dev->d_opendata; > - ret = dev->d_dev->dv_strategy(dev, F_READ, dev->d_offset + offset, 0, > + ret = dev->d_dev->dv_strategy(dev, F_READ, dev->d_offset + offset, > blocks * od->sectorsize, buf, NULL); > > return (ret); > @@ -257,7 +257,7 @@ disk_write(struct disk_devdesc *dev, voi > int ret; > > od = (struct open_disk *)dev->d_opendata; > - ret = dev->d_dev->dv_strategy(dev, F_WRITE, dev->d_offset + offset, 0, > + ret = dev->d_dev->dv_strategy(dev, F_WRITE, dev->d_offset + offset, > blocks * od->sectorsize, buf, NULL); > > return (ret); > > Modified: stable/11/sys/boot/common/md.c > ============================================================================== > --- stable/11/sys/boot/common/md.c Mon Feb 6 21:02:26 2017 (r313354) > +++ stable/11/sys/boot/common/md.c Mon Feb 6 22:03:07 2017 (r313355) > @@ -60,7 +60,7 @@ static struct { > > /* devsw I/F */ > static int md_init(void); > -static int md_strategy(void *, int, daddr_t, size_t, size_t, char *, size_t *); > +static int md_strategy(void *, int, daddr_t, size_t, char *, size_t *); > static int md_open(struct open_file *, ...); > static int md_close(struct open_file *); > static void md_print(int); > @@ -84,7 +84,7 @@ md_init(void) > } > > static int > -md_strategy(void *devdata, int rw, daddr_t blk, size_t offset, size_t size, > +md_strategy(void *devdata, int rw, daddr_t blk, size_t size, > char *buf, size_t *rsize) > { > struct devdesc *dev = (struct devdesc *)devdata; > > Modified: stable/11/sys/boot/efi/libefi/efipart.c > ============================================================================== > --- stable/11/sys/boot/efi/libefi/efipart.c Mon Feb 6 21:02:26 2017 (r313354) > +++ stable/11/sys/boot/efi/libefi/efipart.c Mon Feb 6 22:03:07 2017 (r313355) > @@ -41,10 +41,8 @@ __FBSDID("$FreeBSD$"); > static EFI_GUID blkio_guid = BLOCK_IO_PROTOCOL; > > static int efipart_init(void); > -static int efipart_strategy(void *, int, daddr_t, size_t, size_t, char *, > - size_t *); > -static int efipart_realstrategy(void *, int, daddr_t, size_t, size_t, char *, > - size_t *); > +static int efipart_strategy(void *, int, daddr_t, size_t, char *, size_t *); > +static int efipart_realstrategy(void *, int, daddr_t, size_t, char *, size_t *); > static int efipart_open(struct open_file *, ...); > static int efipart_close(struct open_file *); > static void efipart_print(int); > @@ -284,8 +282,8 @@ efipart_readwrite(EFI_BLOCK_IO *blkio, i > } > > static int > -efipart_strategy(void *devdata, int rw, daddr_t blk, size_t offset, > - size_t size, char *buf, size_t *rsize) > +efipart_strategy(void *devdata, int rw, daddr_t blk, size_t size, > + char *buf, size_t *rsize) > { > struct bcache_devdata bcd; > struct devdesc *dev; > @@ -294,13 +292,12 @@ efipart_strategy(void *devdata, int rw, > bcd.dv_strategy = efipart_realstrategy; > bcd.dv_devdata = devdata; > bcd.dv_cache = PD(dev).pd_bcache; > - return (bcache_strategy(&bcd, rw, blk, offset, size, > - buf, rsize)); > + return (bcache_strategy(&bcd, rw, blk, size, buf, rsize)); > } > > static int > -efipart_realstrategy(void *devdata, int rw, daddr_t blk, size_t offset, > - size_t size, char *buf, size_t *rsize) > +efipart_realstrategy(void *devdata, int rw, daddr_t blk, size_t size, > + char *buf, size_t *rsize) > { > struct devdesc *dev = (struct devdesc *)devdata; > EFI_BLOCK_IO *blkio; > > Modified: stable/11/sys/boot/i386/libfirewire/firewire.c > ============================================================================== > --- stable/11/sys/boot/i386/libfirewire/firewire.c Mon Feb 6 21:02:26 2017 (r313354) > +++ stable/11/sys/boot/i386/libfirewire/firewire.c Mon Feb 6 22:03:07 2017 (r313355) > @@ -66,7 +66,7 @@ struct crom_src_buf { > > static int fw_init(void); > static int fw_strategy(void *devdata, int flag, daddr_t dblk, > - size_t offset, size_t size, char *buf, size_t *rsize); > + size_t size, char *buf, size_t *rsize); > static int fw_open(struct open_file *f, ...); > static int fw_close(struct open_file *f); > static void fw_print(int verbose); > @@ -201,7 +201,7 @@ fw_cleanup() > } > > static int > -fw_strategy(void *devdata, int rw, daddr_t dblk, size_t offset, size_t size, > +fw_strategy(void *devdata, int rw, daddr_t dblk, size_t size, > char *buf, size_t *rsize) > { > return (EIO); > > Modified: stable/11/sys/boot/i386/libi386/bioscd.c > ============================================================================== > --- stable/11/sys/boot/i386/libi386/bioscd.c Mon Feb 6 21:02:26 2017 (r313354) > +++ stable/11/sys/boot/i386/libi386/bioscd.c Mon Feb 6 22:03:07 2017 (r313355) > @@ -95,9 +95,9 @@ static int nbcinfo = 0; > static int bc_read(int unit, daddr_t dblk, int blks, caddr_t dest); > static int bc_init(void); > static int bc_strategy(void *devdata, int flag, daddr_t dblk, > - size_t offset, size_t size, char *buf, size_t *rsize); > + size_t size, char *buf, size_t *rsize); > static int bc_realstrategy(void *devdata, int flag, daddr_t dblk, > - size_t offset, size_t size, char *buf, size_t *rsize); > + size_t size, char *buf, size_t *rsize); > static int bc_open(struct open_file *f, ...); > static int bc_close(struct open_file *f); > static void bc_print(int verbose); > @@ -231,7 +231,7 @@ bc_close(struct open_file *f) > } > > static int > -bc_strategy(void *devdata, int rw, daddr_t dblk, size_t offset, size_t size, > +bc_strategy(void *devdata, int rw, daddr_t dblk, size_t size, > char *buf, size_t *rsize) > { > struct bcache_devdata bcd; > @@ -242,11 +242,11 @@ bc_strategy(void *devdata, int rw, daddr > bcd.dv_devdata = devdata; > bcd.dv_cache = BC(dev).bc_bcache; > > - return (bcache_strategy(&bcd, rw, dblk, offset, size, buf, rsize)); > + return (bcache_strategy(&bcd, rw, dblk, size, buf, rsize)); > } > > static int > -bc_realstrategy(void *devdata, int rw, daddr_t dblk, size_t offset, size_t size, > +bc_realstrategy(void *devdata, int rw, daddr_t dblk, size_t size, > char *buf, size_t *rsize) > { > struct i386_devdesc *dev; > > Modified: stable/11/sys/boot/i386/libi386/biosdisk.c > ============================================================================== > --- stable/11/sys/boot/i386/libi386/biosdisk.c Mon Feb 6 21:02:26 2017 (r313354) > +++ stable/11/sys/boot/i386/libi386/biosdisk.c Mon Feb 6 22:03:07 2017 (r313355) > @@ -128,10 +128,10 @@ static int bd_write(struct disk_devdesc > static int bd_int13probe(struct bdinfo *bd); > > static int bd_init(void); > -static int bd_strategy(void *devdata, int flag, daddr_t dblk, size_t offset, > - size_t size, char *buf, size_t *rsize); > -static int bd_realstrategy(void *devdata, int flag, daddr_t dblk, size_t offset, > - size_t size, char *buf, size_t *rsize); > +static int bd_strategy(void *devdata, int flag, daddr_t dblk, size_t size, > + char *buf, size_t *rsize); > +static int bd_realstrategy(void *devdata, int flag, daddr_t dblk, size_t size, > + char *buf, size_t *rsize); > static int bd_open(struct open_file *f, ...); > static int bd_close(struct open_file *f); > static int bd_ioctl(struct open_file *f, u_long cmd, void *data); > @@ -478,7 +478,7 @@ bd_ioctl(struct open_file *f, u_long cmd > } > > static int > -bd_strategy(void *devdata, int rw, daddr_t dblk, size_t offset, size_t size, > +bd_strategy(void *devdata, int rw, daddr_t dblk, size_t size, > char *buf, size_t *rsize) > { > struct bcache_devdata bcd; > @@ -488,12 +488,12 @@ bd_strategy(void *devdata, int rw, daddr > bcd.dv_strategy = bd_realstrategy; > bcd.dv_devdata = devdata; > bcd.dv_cache = BD(dev).bd_bcache; > - return (bcache_strategy(&bcd, rw, dblk + dev->d_offset, offset, > + return (bcache_strategy(&bcd, rw, dblk + dev->d_offset, > size, buf, rsize)); > } > > static int > -bd_realstrategy(void *devdata, int rw, daddr_t dblk, size_t offset, size_t size, > +bd_realstrategy(void *devdata, int rw, daddr_t dblk, size_t size, > char *buf, size_t *rsize) > { > struct disk_devdesc *dev = (struct disk_devdesc *)devdata; > > Modified: stable/11/sys/boot/i386/libi386/pxe.c > ============================================================================== > --- stable/11/sys/boot/i386/libi386/pxe.c Mon Feb 6 21:02:26 2017 (r313354) > +++ stable/11/sys/boot/i386/libi386/pxe.c Mon Feb 6 22:03:07 2017 (r313355) > @@ -72,7 +72,7 @@ static void bangpxe_call(int func); > > static int pxe_init(void); > static int pxe_strategy(void *devdata, int flag, daddr_t dblk, > - size_t offset, size_t size, char *buf, size_t *rsize); > + size_t size, char *buf, size_t *rsize); > static int pxe_open(struct open_file *f, ...); > static int pxe_close(struct open_file *f); > static void pxe_print(int verbose); > @@ -247,8 +247,8 @@ pxe_init(void) > > > static int > -pxe_strategy(void *devdata, int flag, daddr_t dblk, size_t offset, size_t size, > - char *buf, size_t *rsize) > +pxe_strategy(void *devdata, int flag, daddr_t dblk, size_t size, > + char *buf, size_t *rsize) > { > return (EIO); > } > > Modified: stable/11/sys/boot/mips/beri/loader/beri_disk_cfi.c > ============================================================================== > --- stable/11/sys/boot/mips/beri/loader/beri_disk_cfi.c Mon Feb 6 21:02:26 2017 (r313354) > +++ stable/11/sys/boot/mips/beri/loader/beri_disk_cfi.c Mon Feb 6 22:03:07 2017 (r313355) > @@ -45,7 +45,7 @@ static int beri_cfi_disk_init(void); > static int beri_cfi_disk_open(struct open_file *, ...); > static int beri_cfi_disk_close(struct open_file *); > static void beri_cfi_disk_cleanup(void); > -static int beri_cfi_disk_strategy(void *, int, daddr_t, size_t, size_t, > +static int beri_cfi_disk_strategy(void *, int, daddr_t, size_t, > > *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** > From owner-svn-src-stable-11@freebsd.org Tue Feb 7 01:38:49 2017 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id AB6CFCD39BC; Tue, 7 Feb 2017 01:38:49 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 7835311E3; Tue, 7 Feb 2017 01:38:49 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v171cm7r091399; Tue, 7 Feb 2017 01:38:48 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v171cmj7091398; Tue, 7 Feb 2017 01:38:48 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201702070138.v171cmj7091398@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Tue, 7 Feb 2017 01:38:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r313362 - stable/11/sys/cam/ctl X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Feb 2017 01:38:49 -0000 Author: mav Date: Tue Feb 7 01:38:48 2017 New Revision: 313362 URL: https://svnweb.freebsd.org/changeset/base/313362 Log: MFC r312343: Improve error message on duplicate iSCSI port. Modified: stable/11/sys/cam/ctl/ctl_frontend_iscsi.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/cam/ctl/ctl_frontend_iscsi.c ============================================================================== --- stable/11/sys/cam/ctl/ctl_frontend_iscsi.c Tue Feb 7 01:33:39 2017 (r313361) +++ stable/11/sys/cam/ctl/ctl_frontend_iscsi.c Tue Feb 7 01:38:48 2017 (r313362) @@ -2073,7 +2073,8 @@ cfiscsi_ioctl_port_create(struct ctl_req if (ct->ct_state == CFISCSI_TARGET_STATE_ACTIVE) { req->status = CTL_LUN_ERROR; snprintf(req->error_str, sizeof(req->error_str), - "target \"%s\" already exists", target); + "target \"%s\" for portal group tag %u already exists", + target, tag); cfiscsi_target_release(ct); ctl_free_opts(&opts); return; From owner-svn-src-stable-11@freebsd.org Tue Feb 7 01:42:16 2017 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 49FDBCD3D49; Tue, 7 Feb 2017 01:42:16 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 122F1179F; Tue, 7 Feb 2017 01:42:15 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v171gFpZ095136; Tue, 7 Feb 2017 01:42:15 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v171gEOK095123; Tue, 7 Feb 2017 01:42:14 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201702070142.v171gEOK095123@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Tue, 7 Feb 2017 01:42:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r313364 - in stable/11/sys/cam: ctl scsi X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Feb 2017 01:42:16 -0000 Author: mav Date: Tue Feb 7 01:42:13 2017 New Revision: 313364 URL: https://svnweb.freebsd.org/changeset/base/313364 Log: MFC r312291, r312669: Make CTL frontends report kern_data_resid for under-/overruns. It seems like kern_data_resid was never really implemented. This change finally does it. Now frontends update this field while transferring data, while CTL/backends getting it can more flexibly handle the result. At this point behavior should not change significantly, still reporting errors on write overrun, but that may be changed later, if we decide so. CAM target frontend still does not properly handle overruns due to CAM API limitations. We may need to add some fields to struct ccb_accept_tio to pass information about initiator requested transfer size(s). Modified: stable/11/sys/cam/ctl/ctl.c stable/11/sys/cam/ctl/ctl_backend_block.c stable/11/sys/cam/ctl/ctl_backend_ramdisk.c stable/11/sys/cam/ctl/ctl_error.c stable/11/sys/cam/ctl/ctl_error.h stable/11/sys/cam/ctl/ctl_frontend_cam_sim.c stable/11/sys/cam/ctl/ctl_frontend_ioctl.c stable/11/sys/cam/ctl/ctl_frontend_iscsi.c stable/11/sys/cam/ctl/ctl_tpc.c stable/11/sys/cam/ctl/ctl_tpc_local.c stable/11/sys/cam/ctl/scsi_ctl.c stable/11/sys/cam/scsi/scsi_all.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/cam/ctl/ctl.c ============================================================================== --- stable/11/sys/cam/ctl/ctl.c Tue Feb 7 01:39:25 2017 (r313363) +++ stable/11/sys/cam/ctl/ctl.c Tue Feb 7 01:42:13 2017 (r313364) @@ -5053,18 +5053,13 @@ ctl_config_move_done(union ctl_io *io) if ((io->io_hdr.port_status != 0) && ((io->io_hdr.status & CTL_STATUS_MASK) == CTL_STATUS_NONE || (io->io_hdr.status & CTL_STATUS_MASK) == CTL_SUCCESS)) { - /* - * For hardware error sense keys, the sense key - * specific value is defined to be a retry count, - * but we use it to pass back an internal FETD - * error code. XXX KDM Hopefully the FETD is only - * using 16 bits for an error code, since that's - * all the space we have in the sks field. - */ - ctl_set_internal_failure(&io->scsiio, - /*sks_valid*/ 1, - /*retry_count*/ - io->io_hdr.port_status); + ctl_set_internal_failure(&io->scsiio, /*sks_valid*/ 1, + /*retry_count*/ io->io_hdr.port_status); + } else if (io->scsiio.kern_data_resid != 0 && + (io->io_hdr.flags & CTL_FLAG_DATA_MASK) == CTL_FLAG_DATA_OUT && + ((io->io_hdr.status & CTL_STATUS_MASK) == CTL_STATUS_NONE || + (io->io_hdr.status & CTL_STATUS_MASK) == CTL_SUCCESS)) { + ctl_set_invalid_field_ciu(&io->scsiio); } if (ctl_debug & CTL_DEBUG_CDB_DATA) @@ -5462,7 +5457,6 @@ ctl_format(struct ctl_scsiio *ctsio) ctsio->kern_data_ptr = malloc(length, M_CTL, M_WAITOK); ctsio->kern_data_len = length; ctsio->kern_total_len = length; - ctsio->kern_data_resid = 0; ctsio->kern_rel_offset = 0; ctsio->kern_sg_entries = 0; ctsio->io_hdr.flags |= CTL_FLAG_ALLOCATED; @@ -5588,7 +5582,6 @@ ctl_read_buffer(struct ctl_scsiio *ctsio } ctsio->kern_data_len = len; ctsio->kern_total_len = len; - ctsio->kern_data_resid = 0; ctsio->kern_rel_offset = 0; ctsio->kern_sg_entries = 0; ctl_set_success(ctsio); @@ -5634,7 +5627,6 @@ ctl_write_buffer(struct ctl_scsiio *ctsi ctsio->kern_data_ptr = lun->write_buffer + buffer_offset; ctsio->kern_data_len = len; ctsio->kern_total_len = len; - ctsio->kern_data_resid = 0; ctsio->kern_rel_offset = 0; ctsio->kern_sg_entries = 0; ctsio->io_hdr.flags |= CTL_FLAG_ALLOCATED; @@ -5742,7 +5734,6 @@ ctl_write_same(struct ctl_scsiio *ctsio) ctsio->kern_data_ptr = malloc(len, M_CTL, M_WAITOK); ctsio->kern_data_len = len; ctsio->kern_total_len = len; - ctsio->kern_data_resid = 0; ctsio->kern_rel_offset = 0; ctsio->kern_sg_entries = 0; ctsio->io_hdr.flags |= CTL_FLAG_ALLOCATED; @@ -5788,7 +5779,6 @@ ctl_unmap(struct ctl_scsiio *ctsio) ctsio->kern_data_ptr = malloc(len, M_CTL, M_WAITOK); ctsio->kern_data_len = len; ctsio->kern_total_len = len; - ctsio->kern_data_resid = 0; ctsio->kern_rel_offset = 0; ctsio->kern_sg_entries = 0; ctsio->io_hdr.flags |= CTL_FLAG_ALLOCATED; @@ -6278,7 +6268,6 @@ ctl_mode_select(struct ctl_scsiio *ctsio ctsio->kern_data_ptr = malloc(param_len, M_CTL, M_WAITOK); ctsio->kern_data_len = param_len; ctsio->kern_total_len = param_len; - ctsio->kern_data_resid = 0; ctsio->kern_rel_offset = 0; ctsio->kern_sg_entries = 0; ctsio->io_hdr.flags |= CTL_FLAG_ALLOCATED; @@ -6508,7 +6497,6 @@ ctl_mode_sense(struct ctl_scsiio *ctsio) ctsio->kern_data_ptr = malloc(total_len, M_CTL, M_WAITOK | M_ZERO); ctsio->kern_sg_entries = 0; - ctsio->kern_data_resid = 0; ctsio->kern_rel_offset = 0; if (total_len < alloc_len) { ctsio->residual = alloc_len - total_len; @@ -6861,7 +6849,6 @@ ctl_log_sense(struct ctl_scsiio *ctsio) ctsio->kern_data_ptr = malloc(total_len, M_CTL, M_WAITOK | M_ZERO); ctsio->kern_sg_entries = 0; - ctsio->kern_data_resid = 0; ctsio->kern_rel_offset = 0; if (total_len < alloc_len) { ctsio->residual = alloc_len - total_len; @@ -6929,7 +6916,6 @@ ctl_read_capacity(struct ctl_scsiio *cts ctsio->residual = 0; ctsio->kern_data_len = sizeof(*data); ctsio->kern_total_len = sizeof(*data); - ctsio->kern_data_resid = 0; ctsio->kern_rel_offset = 0; ctsio->kern_sg_entries = 0; @@ -6995,7 +6981,6 @@ ctl_read_capacity_16(struct ctl_scsiio * ctsio->kern_data_len = alloc_len; ctsio->kern_total_len = alloc_len; } - ctsio->kern_data_resid = 0; ctsio->kern_rel_offset = 0; ctsio->kern_sg_entries = 0; @@ -7050,7 +7035,6 @@ ctl_get_lba_status(struct ctl_scsiio *ct ctsio->kern_data_len = alloc_len; ctsio->kern_total_len = alloc_len; } - ctsio->kern_data_resid = 0; ctsio->kern_rel_offset = 0; ctsio->kern_sg_entries = 0; @@ -7112,7 +7096,6 @@ ctl_read_defect(struct ctl_scsiio *ctsio ctsio->kern_data_len = alloc_len; ctsio->kern_total_len = alloc_len; } - ctsio->kern_data_resid = 0; ctsio->kern_rel_offset = 0; ctsio->kern_sg_entries = 0; @@ -7211,7 +7194,6 @@ ctl_report_tagret_port_groups(struct ctl ctsio->kern_data_len = alloc_len; ctsio->kern_total_len = alloc_len; } - ctsio->kern_data_resid = 0; ctsio->kern_rel_offset = 0; if (ext) { @@ -7412,7 +7394,6 @@ ctl_report_supported_opcodes(struct ctl_ ctsio->kern_data_len = alloc_len; ctsio->kern_total_len = alloc_len; } - ctsio->kern_data_resid = 0; ctsio->kern_rel_offset = 0; switch (cdb->options & RSO_OPTIONS_MASK) { @@ -7526,7 +7507,6 @@ ctl_report_supported_tmf(struct ctl_scsi ctsio->kern_data_len = alloc_len; ctsio->kern_total_len = alloc_len; } - ctsio->kern_data_resid = 0; ctsio->kern_rel_offset = 0; data = (struct scsi_report_supported_tmf_ext_data *)ctsio->kern_data_ptr; @@ -7574,7 +7554,6 @@ ctl_report_timestamp(struct ctl_scsiio * ctsio->kern_data_len = alloc_len; ctsio->kern_total_len = alloc_len; } - ctsio->kern_data_resid = 0; ctsio->kern_rel_offset = 0; data = (struct scsi_report_timestamp_data *)ctsio->kern_data_ptr; @@ -7647,7 +7626,6 @@ retry: ctsio->kern_total_len = alloc_len; } - ctsio->kern_data_resid = 0; ctsio->kern_rel_offset = 0; ctsio->kern_sg_entries = 0; @@ -8225,7 +8203,6 @@ ctl_persistent_reserve_out(struct ctl_sc ctsio->kern_data_ptr = malloc(param_len, M_CTL, M_WAITOK); ctsio->kern_data_len = param_len; ctsio->kern_total_len = param_len; - ctsio->kern_data_resid = 0; ctsio->kern_rel_offset = 0; ctsio->kern_sg_entries = 0; ctsio->io_hdr.flags |= CTL_FLAG_ALLOCATED; @@ -9207,7 +9184,6 @@ ctl_report_luns(struct ctl_scsiio *ctsio ctsio->kern_data_len = alloc_len; ctsio->kern_total_len = alloc_len; } - ctsio->kern_data_resid = 0; ctsio->kern_rel_offset = 0; ctsio->kern_sg_entries = 0; @@ -9270,7 +9246,6 @@ ctl_request_sense(struct ctl_scsiio *cts ctsio->kern_data_len = cdb->length; ctsio->kern_total_len = cdb->length; - ctsio->kern_data_resid = 0; ctsio->kern_rel_offset = 0; ctsio->kern_sg_entries = 0; @@ -9409,7 +9384,6 @@ ctl_inquiry_evpd_supported(struct ctl_sc ctsio->kern_data_len = alloc_len; ctsio->kern_total_len = alloc_len; } - ctsio->kern_data_resid = 0; ctsio->kern_rel_offset = 0; ctsio->kern_sg_entries = 0; @@ -9478,7 +9452,6 @@ ctl_inquiry_evpd_serial(struct ctl_scsii ctsio->kern_data_len = alloc_len; ctsio->kern_total_len = alloc_len; } - ctsio->kern_data_resid = 0; ctsio->kern_rel_offset = 0; ctsio->kern_sg_entries = 0; @@ -9537,7 +9510,6 @@ ctl_inquiry_evpd_eid(struct ctl_scsiio * ctsio->kern_data_len = alloc_len; ctsio->kern_total_len = alloc_len; } - ctsio->kern_data_resid = 0; ctsio->kern_rel_offset = 0; ctsio->kern_sg_entries = 0; @@ -9613,7 +9585,6 @@ ctl_inquiry_evpd_mpp(struct ctl_scsiio * ctsio->kern_data_len = alloc_len; ctsio->kern_total_len = alloc_len; } - ctsio->kern_data_resid = 0; ctsio->kern_rel_offset = 0; ctsio->kern_sg_entries = 0; @@ -9678,7 +9649,6 @@ ctl_inquiry_evpd_devid(struct ctl_scsiio ctsio->kern_data_len = alloc_len; ctsio->kern_total_len = alloc_len; } - ctsio->kern_data_resid = 0; ctsio->kern_rel_offset = 0; ctsio->kern_sg_entries = 0; @@ -9807,7 +9777,6 @@ ctl_inquiry_evpd_scsi_ports(struct ctl_s ctsio->kern_data_len = alloc_len; ctsio->kern_total_len = alloc_len; } - ctsio->kern_data_resid = 0; ctsio->kern_rel_offset = 0; ctsio->kern_sg_entries = 0; @@ -9883,7 +9852,6 @@ ctl_inquiry_evpd_block_limits(struct ctl ctsio->kern_data_len = alloc_len; ctsio->kern_total_len = alloc_len; } - ctsio->kern_data_resid = 0; ctsio->kern_rel_offset = 0; ctsio->kern_sg_entries = 0; @@ -9959,7 +9927,6 @@ ctl_inquiry_evpd_bdc(struct ctl_scsiio * ctsio->kern_data_len = alloc_len; ctsio->kern_total_len = alloc_len; } - ctsio->kern_data_resid = 0; ctsio->kern_rel_offset = 0; ctsio->kern_sg_entries = 0; @@ -10016,7 +9983,6 @@ ctl_inquiry_evpd_lbp(struct ctl_scsiio * ctsio->kern_data_len = alloc_len; ctsio->kern_total_len = alloc_len; } - ctsio->kern_data_resid = 0; ctsio->kern_rel_offset = 0; ctsio->kern_sg_entries = 0; @@ -10151,7 +10117,6 @@ ctl_inquiry_std(struct ctl_scsiio *ctsio ctsio->kern_data_ptr = malloc(data_len, M_CTL, M_WAITOK | M_ZERO); inq_ptr = (struct scsi_inquiry_data *)ctsio->kern_data_ptr; ctsio->kern_sg_entries = 0; - ctsio->kern_data_resid = 0; ctsio->kern_rel_offset = 0; if (data_len < alloc_len) { @@ -10379,7 +10344,6 @@ ctl_get_config(struct ctl_scsiio *ctsio) sizeof(struct scsi_get_config_feature) + 4; ctsio->kern_data_ptr = malloc(data_len, M_CTL, M_WAITOK | M_ZERO); ctsio->kern_sg_entries = 0; - ctsio->kern_data_resid = 0; ctsio->kern_rel_offset = 0; hdr = (struct scsi_get_config_header *)ctsio->kern_data_ptr; @@ -10585,7 +10549,6 @@ ctl_get_event_status(struct ctl_scsiio * data_len = sizeof(struct scsi_get_event_status_header); ctsio->kern_data_ptr = malloc(data_len, M_CTL, M_WAITOK | M_ZERO); ctsio->kern_sg_entries = 0; - ctsio->kern_data_resid = 0; ctsio->kern_rel_offset = 0; if (data_len < alloc_len) { @@ -10623,7 +10586,6 @@ ctl_mechanism_status(struct ctl_scsiio * data_len = sizeof(struct scsi_mechanism_status_header); ctsio->kern_data_ptr = malloc(data_len, M_CTL, M_WAITOK | M_ZERO); ctsio->kern_sg_entries = 0; - ctsio->kern_data_resid = 0; ctsio->kern_rel_offset = 0; if (data_len < alloc_len) { @@ -10683,7 +10645,6 @@ ctl_read_toc(struct ctl_scsiio *ctsio) data_len += sizeof(struct scsi_read_toc_type01_descr); ctsio->kern_data_ptr = malloc(data_len, M_CTL, M_WAITOK | M_ZERO); ctsio->kern_sg_entries = 0; - ctsio->kern_data_resid = 0; ctsio->kern_rel_offset = 0; if (data_len < alloc_len) { @@ -12585,6 +12546,9 @@ ctl_datamove(union ctl_io *io) CTL_DEBUG_PRINT(("ctl_datamove\n")); + /* No data transferred yet. Frontend must update this when done. */ + io->scsiio.kern_data_resid = io->scsiio.kern_data_len; + #ifdef CTL_TIME_IO if ((time_uptime - io->io_hdr.start_time) > ctl_time_io_secs) { char str[256]; Modified: stable/11/sys/cam/ctl/ctl_backend_block.c ============================================================================== --- stable/11/sys/cam/ctl/ctl_backend_block.c Tue Feb 7 01:39:25 2017 (r313363) +++ stable/11/sys/cam/ctl/ctl_backend_block.c Tue Feb 7 01:42:13 2017 (r313364) @@ -419,6 +419,16 @@ ctl_be_block_move_done(union ctl_io *io) */ if (io->io_hdr.flags & CTL_FLAG_ABORT) { ; + } else if ((io->io_hdr.port_status != 0) && + ((io->io_hdr.status & CTL_STATUS_MASK) == CTL_STATUS_NONE || + (io->io_hdr.status & CTL_STATUS_MASK) == CTL_SUCCESS)) { + ctl_set_internal_failure(&io->scsiio, /*sks_valid*/ 1, + /*retry_count*/ io->io_hdr.port_status); + } else if (io->scsiio.kern_data_resid != 0 && + (io->io_hdr.flags & CTL_FLAG_DATA_MASK) == CTL_FLAG_DATA_OUT && + ((io->io_hdr.status & CTL_STATUS_MASK) == CTL_STATUS_NONE || + (io->io_hdr.status & CTL_STATUS_MASK) == CTL_SUCCESS)) { + ctl_set_invalid_field_ciu(&io->scsiio); } else if ((io->io_hdr.port_status == 0) && ((io->io_hdr.status & CTL_STATUS_MASK) == CTL_STATUS_NONE)) { lbalen = ARGS(beio->io); @@ -428,21 +438,6 @@ ctl_be_block_move_done(union ctl_io *io) /* We have two data blocks ready for comparison. */ ctl_be_block_compare(io); } - } else if ((io->io_hdr.port_status != 0) && - ((io->io_hdr.status & CTL_STATUS_MASK) == CTL_STATUS_NONE || - (io->io_hdr.status & CTL_STATUS_MASK) == CTL_SUCCESS)) { - /* - * For hardware error sense keys, the sense key - * specific value is defined to be a retry count, - * but we use it to pass back an internal FETD - * error code. XXX KDM Hopefully the FETD is only - * using 16 bits for an error code, since that's - * all the space we have in the sks field. - */ - ctl_set_internal_failure(&io->scsiio, - /*sks_valid*/ 1, - /*retry_count*/ - io->io_hdr.port_status); } /* @@ -1634,7 +1629,6 @@ ctl_be_block_dispatch(struct ctl_be_bloc else io->scsiio.kern_data_ptr = (uint8_t *)beio->sg_segs; io->scsiio.kern_data_len = beio->io_len; - io->scsiio.kern_data_resid = 0; io->scsiio.kern_sg_entries = beio->num_segs; io->io_hdr.flags |= CTL_FLAG_ALLOCATED; Modified: stable/11/sys/cam/ctl/ctl_backend_ramdisk.c ============================================================================== --- stable/11/sys/cam/ctl/ctl_backend_ramdisk.c Tue Feb 7 01:39:25 2017 (r313363) +++ stable/11/sys/cam/ctl/ctl_backend_ramdisk.c Tue Feb 7 01:42:13 2017 (r313364) @@ -231,6 +231,16 @@ ctl_backend_ramdisk_move_done(union ctl_ io->scsiio.kern_rel_offset += io->scsiio.kern_data_len; if (io->io_hdr.flags & CTL_FLAG_ABORT) { ; + } else if (io->io_hdr.port_status != 0 && + ((io->io_hdr.status & CTL_STATUS_MASK) == CTL_STATUS_NONE || + (io->io_hdr.status & CTL_STATUS_MASK) == CTL_SUCCESS)) { + ctl_set_internal_failure(&io->scsiio, /*sks_valid*/ 1, + /*retry_count*/ io->io_hdr.port_status); + } else if (io->scsiio.kern_data_resid != 0 && + (io->io_hdr.flags & CTL_FLAG_DATA_MASK) == CTL_FLAG_DATA_OUT && + ((io->io_hdr.status & CTL_STATUS_MASK) == CTL_STATUS_NONE || + (io->io_hdr.status & CTL_STATUS_MASK) == CTL_SUCCESS)) { + ctl_set_invalid_field_ciu(&io->scsiio); } else if ((io->io_hdr.port_status == 0) && ((io->io_hdr.status & CTL_STATUS_MASK) == CTL_STATUS_NONE)) { if (io->io_hdr.ctl_private[CTL_PRIV_BACKEND].integer > 0) { @@ -243,21 +253,6 @@ ctl_backend_ramdisk_move_done(union ctl_ return (0); } ctl_set_success(&io->scsiio); - } else if ((io->io_hdr.port_status != 0) && - ((io->io_hdr.status & CTL_STATUS_MASK) == CTL_STATUS_NONE || - (io->io_hdr.status & CTL_STATUS_MASK) == CTL_SUCCESS)) { - /* - * For hardware error sense keys, the sense key - * specific value is defined to be a retry count, - * but we use it to pass back an internal FETD - * error code. XXX KDM Hopefully the FETD is only - * using 16 bits for an error code, since that's - * all the space we have in the sks field. - */ - ctl_set_internal_failure(&io->scsiio, - /*sks_valid*/ 1, - /*retry_count*/ - io->io_hdr.port_status); } ctl_data_submit_done(io); return(0); @@ -318,7 +313,6 @@ ctl_backend_ramdisk_continue(union ctl_i #endif /* CTL_RAMDISK_PAGES */ io->scsiio.be_move_done = ctl_backend_ramdisk_move_done; - io->scsiio.kern_data_resid = 0; io->scsiio.kern_data_len = len_filled; io->scsiio.kern_sg_entries = sg_filled; io->io_hdr.flags |= CTL_FLAG_ALLOCATED; Modified: stable/11/sys/cam/ctl/ctl_error.c ============================================================================== --- stable/11/sys/cam/ctl/ctl_error.c Tue Feb 7 01:39:25 2017 (r313363) +++ stable/11/sys/cam/ctl/ctl_error.c Tue Feb 7 01:42:13 2017 (r313364) @@ -641,6 +641,18 @@ ctl_set_invalid_field(struct ctl_scsiio /*data*/ sks, SSD_ELEM_NONE); } +void +ctl_set_invalid_field_ciu(struct ctl_scsiio *ctsio) +{ + + /* "Invalid field in command information unit" */ + ctl_set_sense(ctsio, + /*current_error*/ 1, + /*sense_key*/ SSD_KEY_ABORTED_COMMAND, + /*ascq*/ 0x0E, + /*ascq*/ 0x03, + SSD_ELEM_NONE); +} void ctl_set_invalid_opcode(struct ctl_scsiio *ctsio) Modified: stable/11/sys/cam/ctl/ctl_error.h ============================================================================== --- stable/11/sys/cam/ctl/ctl_error.h Tue Feb 7 01:39:25 2017 (r313363) +++ stable/11/sys/cam/ctl/ctl_error.h Tue Feb 7 01:42:13 2017 (r313364) @@ -66,6 +66,7 @@ void ctl_set_overlapped_cmd(struct ctl_s void ctl_set_overlapped_tag(struct ctl_scsiio *ctsio, uint8_t tag); void ctl_set_invalid_field(struct ctl_scsiio *ctsio, int sks_valid, int command, int field, int bit_valid, int bit); +void ctl_set_invalid_field_ciu(struct ctl_scsiio *ctsio); void ctl_set_invalid_opcode(struct ctl_scsiio *ctsio); void ctl_set_param_len_error(struct ctl_scsiio *ctsio); void ctl_set_already_locked(struct ctl_scsiio *ctsio); Modified: stable/11/sys/cam/ctl/ctl_frontend_cam_sim.c ============================================================================== --- stable/11/sys/cam/ctl/ctl_frontend_cam_sim.c Tue Feb 7 01:39:25 2017 (r313363) +++ stable/11/sys/cam/ctl/ctl_frontend_cam_sim.c Tue Feb 7 01:42:13 2017 (r313364) @@ -300,7 +300,7 @@ cfcs_datamove(union ctl_io *io) struct ctl_sg_entry ctl_sg_entry, *ctl_sglist; int cam_sg_count, ctl_sg_count, cam_sg_start; int cam_sg_offset; - int len_to_copy, len_copied; + int len_to_copy; int ctl_watermark, cam_watermark; int i, j; @@ -365,7 +365,6 @@ cfcs_datamove(union ctl_io *io) ctl_watermark = 0; cam_watermark = cam_sg_offset; - len_copied = 0; for (i = cam_sg_start, j = 0; i < cam_sg_count && j < ctl_sg_count;) { uint8_t *cam_ptr, *ctl_ptr; @@ -387,9 +386,6 @@ cfcs_datamove(union ctl_io *io) ctl_ptr = (uint8_t *)ctl_sglist[j].addr; ctl_ptr = ctl_ptr + ctl_watermark; - ctl_watermark += len_to_copy; - cam_watermark += len_to_copy; - if ((io->io_hdr.flags & CTL_FLAG_DATA_MASK) == CTL_FLAG_DATA_IN) { CTL_DEBUG_PRINT(("%s: copying %d bytes to CAM\n", @@ -405,30 +401,22 @@ cfcs_datamove(union ctl_io *io) bcopy(cam_ptr, ctl_ptr, len_to_copy); } - len_copied += len_to_copy; + io->scsiio.ext_data_filled += len_to_copy; + io->scsiio.kern_data_resid -= len_to_copy; + cam_watermark += len_to_copy; if (cam_sglist[i].ds_len == cam_watermark) { i++; cam_watermark = 0; } + ctl_watermark += len_to_copy; if (ctl_sglist[j].len == ctl_watermark) { j++; ctl_watermark = 0; } } - io->scsiio.ext_data_filled += len_copied; - - /* - * Report write underflow as error, since CTL and backends don't - * really support it. - */ - if ((io->io_hdr.flags & CTL_FLAG_DATA_MASK) == CTL_FLAG_DATA_OUT && - j < ctl_sg_count) { - io->io_hdr.port_status = 43; - } else - if ((io->io_hdr.status & CTL_STATUS_MASK) == CTL_SUCCESS) { io->io_hdr.ctl_private[CTL_PRIV_FRONTEND].ptr = NULL; io->io_hdr.flags |= CTL_FLAG_STATUS_SENT; Modified: stable/11/sys/cam/ctl/ctl_frontend_ioctl.c ============================================================================== --- stable/11/sys/cam/ctl/ctl_frontend_ioctl.c Tue Feb 7 01:39:25 2017 (r313363) +++ stable/11/sys/cam/ctl/ctl_frontend_ioctl.c Tue Feb 7 01:42:13 2017 (r313364) @@ -138,7 +138,7 @@ ctl_ioctl_do_datamove(struct ctl_scsiio struct ctl_sg_entry ext_entry, kern_entry; int ext_sglen, ext_sg_entries, kern_sg_entries; int ext_sg_start, ext_offset; - int len_to_copy, len_copied; + int len_to_copy; int kern_watermark, ext_watermark; int ext_sglist_malloced; int i, j; @@ -150,7 +150,8 @@ ctl_ioctl_do_datamove(struct ctl_scsiio */ if (ctsio->io_hdr.flags & CTL_FLAG_NO_DATAMOVE) { ext_sglist_malloced = 0; - ctsio->ext_data_filled = ctsio->ext_data_len; + ctsio->ext_data_filled += ctsio->kern_data_len; + ctsio->kern_data_resid = 0; goto bailout; } @@ -204,7 +205,6 @@ ctl_ioctl_do_datamove(struct ctl_scsiio kern_watermark = 0; ext_watermark = ext_offset; - len_copied = 0; for (i = ext_sg_start, j = 0; i < ext_sg_entries && j < kern_sg_entries;) { uint8_t *ext_ptr, *kern_ptr; @@ -226,9 +226,6 @@ ctl_ioctl_do_datamove(struct ctl_scsiio kern_ptr = (uint8_t *)kern_sglist[j].addr; kern_ptr = kern_ptr + kern_watermark; - kern_watermark += len_to_copy; - ext_watermark += len_to_copy; - if ((ctsio->io_hdr.flags & CTL_FLAG_DATA_MASK) == CTL_FLAG_DATA_IN) { CTL_DEBUG_PRINT(("ctl_ioctl_do_datamove: copying %d " @@ -250,21 +247,22 @@ ctl_ioctl_do_datamove(struct ctl_scsiio } } - len_copied += len_to_copy; + ctsio->ext_data_filled += len_to_copy; + ctsio->kern_data_resid -= len_to_copy; + ext_watermark += len_to_copy; if (ext_sglist[i].len == ext_watermark) { i++; ext_watermark = 0; } + kern_watermark += len_to_copy; if (kern_sglist[j].len == kern_watermark) { j++; kern_watermark = 0; } } - ctsio->ext_data_filled += len_copied; - CTL_DEBUG_PRINT(("ctl_ioctl_do_datamove: ext_sg_entries: %d, " "kern_sg_entries: %d\n", ext_sg_entries, kern_sg_entries)); @@ -272,15 +270,6 @@ ctl_ioctl_do_datamove(struct ctl_scsiio "kern_data_len = %d\n", ctsio->ext_data_len, ctsio->kern_data_len)); - /* - * Report write underflow as error, since CTL and backends don't - * really support it. - */ - if ((ctsio->io_hdr.flags & CTL_FLAG_DATA_MASK) == CTL_FLAG_DATA_OUT && - j < kern_sg_entries) { - ctsio->io_hdr.port_status = 43; - } - bailout: if (ext_sglist_malloced != 0) free(ext_sglist, M_CTL); Modified: stable/11/sys/cam/ctl/ctl_frontend_iscsi.c ============================================================================== --- stable/11/sys/cam/ctl/ctl_frontend_iscsi.c Tue Feb 7 01:39:25 2017 (r313363) +++ stable/11/sys/cam/ctl/ctl_frontend_iscsi.c Tue Feb 7 01:42:13 2017 (r313364) @@ -769,6 +769,7 @@ cfiscsi_handle_data_segment(struct icl_p cdw->cdw_sg_len -= copy_len; off += copy_len; io->scsiio.ext_data_filled += copy_len; + io->scsiio.kern_data_resid -= copy_len; if (cdw->cdw_sg_len == 0) { /* @@ -2505,6 +2506,7 @@ cfiscsi_datamove_in(union ctl_io *io) } sg_addr += len; sg_len -= len; + io->scsiio.kern_data_resid -= len; KASSERT(buffer_offset + response->ip_data_len <= expected_len, ("buffer_offset %zd + ip_data_len %zd > expected_len %zd", @@ -2590,7 +2592,7 @@ cfiscsi_datamove_out(union ctl_io *io) struct iscsi_bhs_r2t *bhsr2t; struct cfiscsi_data_wait *cdw; struct ctl_sg_entry ctl_sg_entry, *ctl_sglist; - uint32_t expected_len, r2t_off, r2t_len; + uint32_t expected_len, datamove_len, r2t_off, r2t_len; uint32_t target_transfer_tag; bool done; @@ -2609,16 +2611,15 @@ cfiscsi_datamove_out(union ctl_io *io) PDU_TOTAL_TRANSFER_LEN(request) = io->scsiio.kern_total_len; /* - * Report write underflow as error since CTL and backends don't - * really support it, and SCSI does not tell how to do it right. + * Complete write underflow. Not a single byte to read. Return. */ expected_len = ntohl(bhssc->bhssc_expected_data_transfer_length); - if (io->scsiio.kern_rel_offset + io->scsiio.kern_data_len > - expected_len) { - io->scsiio.io_hdr.port_status = 43; + if (io->scsiio.kern_rel_offset >= expected_len) { io->scsiio.be_move_done(io); return; } + datamove_len = MIN(io->scsiio.kern_data_len, + expected_len - io->scsiio.kern_rel_offset); target_transfer_tag = atomic_fetchadd_32(&cs->cs_target_transfer_tag, 1); @@ -2641,7 +2642,7 @@ cfiscsi_datamove_out(union ctl_io *io) cdw->cdw_ctl_io = io; cdw->cdw_target_transfer_tag = target_transfer_tag; cdw->cdw_initiator_task_tag = bhssc->bhssc_initiator_task_tag; - cdw->cdw_r2t_end = io->scsiio.kern_data_len; + cdw->cdw_r2t_end = datamove_len; cdw->cdw_datasn = 0; /* Set initial data pointer for the CDW respecting ext_data_filled. */ @@ -2650,7 +2651,7 @@ cfiscsi_datamove_out(union ctl_io *io) } else { ctl_sglist = &ctl_sg_entry; ctl_sglist->addr = io->scsiio.kern_data_ptr; - ctl_sglist->len = io->scsiio.kern_data_len; + ctl_sglist->len = datamove_len; } cdw->cdw_sg_index = 0; cdw->cdw_sg_addr = ctl_sglist[cdw->cdw_sg_index].addr; @@ -2681,7 +2682,7 @@ cfiscsi_datamove_out(union ctl_io *io) } r2t_off = io->scsiio.kern_rel_offset + io->scsiio.ext_data_filled; - r2t_len = MIN(io->scsiio.kern_data_len - io->scsiio.ext_data_filled, + r2t_len = MIN(datamove_len - io->scsiio.ext_data_filled, cs->cs_max_burst_length); cdw->cdw_r2t_end = io->scsiio.ext_data_filled + r2t_len; Modified: stable/11/sys/cam/ctl/ctl_tpc.c ============================================================================== --- stable/11/sys/cam/ctl/ctl_tpc.c Tue Feb 7 01:39:25 2017 (r313363) +++ stable/11/sys/cam/ctl/ctl_tpc.c Tue Feb 7 01:42:13 2017 (r313364) @@ -293,7 +293,6 @@ ctl_inquiry_evpd_tpc(struct ctl_scsiio * ctsio->kern_data_len = alloc_len; ctsio->kern_total_len = alloc_len; } - ctsio->kern_data_resid = 0; ctsio->kern_rel_offset = 0; ctsio->kern_sg_entries = 0; @@ -470,7 +469,6 @@ ctl_receive_copy_operating_parameters(st ctsio->kern_data_len = alloc_len; ctsio->kern_total_len = alloc_len; } - ctsio->kern_data_resid = 0; ctsio->kern_rel_offset = 0; data = (struct scsi_receive_copy_operating_parameters_data *)ctsio->kern_data_ptr; @@ -568,7 +566,6 @@ ctl_receive_copy_status_lid1(struct ctl_ ctsio->kern_data_len = alloc_len; ctsio->kern_total_len = alloc_len; } - ctsio->kern_data_resid = 0; ctsio->kern_rel_offset = 0; data = (struct scsi_receive_copy_status_lid1_data *)ctsio->kern_data_ptr; @@ -646,7 +643,6 @@ ctl_receive_copy_failure_details(struct ctsio->kern_data_len = alloc_len; ctsio->kern_total_len = alloc_len; } - ctsio->kern_data_resid = 0; ctsio->kern_rel_offset = 0; data = (struct scsi_receive_copy_failure_details_data *)ctsio->kern_data_ptr; @@ -718,7 +714,6 @@ ctl_receive_copy_status_lid4(struct ctl_ ctsio->kern_data_len = alloc_len; ctsio->kern_total_len = alloc_len; } - ctsio->kern_data_resid = 0; ctsio->kern_rel_offset = 0; data = (struct scsi_receive_copy_status_lid4_data *)ctsio->kern_data_ptr; @@ -1730,7 +1725,6 @@ ctl_extended_copy_lid1(struct ctl_scsiio ctsio->kern_data_ptr = malloc(len, M_CTL, M_WAITOK); ctsio->kern_data_len = len; ctsio->kern_total_len = len; - ctsio->kern_data_resid = 0; ctsio->kern_rel_offset = 0; ctsio->kern_sg_entries = 0; ctsio->io_hdr.flags |= CTL_FLAG_ALLOCATED; @@ -1885,7 +1879,6 @@ ctl_extended_copy_lid4(struct ctl_scsiio ctsio->kern_data_ptr = malloc(len, M_CTL, M_WAITOK); ctsio->kern_data_len = len; ctsio->kern_total_len = len; - ctsio->kern_data_resid = 0; ctsio->kern_rel_offset = 0; ctsio->kern_sg_entries = 0; ctsio->io_hdr.flags |= CTL_FLAG_ALLOCATED; @@ -2083,7 +2076,6 @@ ctl_populate_token(struct ctl_scsiio *ct ctsio->kern_data_ptr = malloc(len, M_CTL, M_WAITOK); ctsio->kern_data_len = len; ctsio->kern_total_len = len; - ctsio->kern_data_resid = 0; ctsio->kern_rel_offset = 0; ctsio->kern_sg_entries = 0; ctsio->io_hdr.flags |= CTL_FLAG_ALLOCATED; @@ -2247,7 +2239,6 @@ ctl_write_using_token(struct ctl_scsiio ctsio->kern_data_ptr = malloc(len, M_CTL, M_WAITOK); ctsio->kern_data_len = len; ctsio->kern_total_len = len; - ctsio->kern_data_resid = 0; ctsio->kern_rel_offset = 0; ctsio->kern_sg_entries = 0; ctsio->io_hdr.flags |= CTL_FLAG_ALLOCATED; @@ -2423,7 +2414,6 @@ ctl_receive_rod_token_information(struct ctsio->kern_data_len = alloc_len; ctsio->kern_total_len = alloc_len; } - ctsio->kern_data_resid = 0; ctsio->kern_rel_offset = 0; data = (struct scsi_receive_copy_status_lid4_data *)ctsio->kern_data_ptr; @@ -2504,7 +2494,6 @@ ctl_report_all_rod_tokens(struct ctl_scs ctsio->kern_data_len = alloc_len; ctsio->kern_total_len = alloc_len; } - ctsio->kern_data_resid = 0; ctsio->kern_rel_offset = 0; data = (struct scsi_report_all_rod_tokens_data *)ctsio->kern_data_ptr; Modified: stable/11/sys/cam/ctl/ctl_tpc_local.c ============================================================================== --- stable/11/sys/cam/ctl/ctl_tpc_local.c Tue Feb 7 01:39:25 2017 (r313363) +++ stable/11/sys/cam/ctl/ctl_tpc_local.c Tue Feb 7 01:42:13 2017 (r313364) @@ -137,7 +137,7 @@ tpcl_datamove(union ctl_io *io) struct ctl_sg_entry ext_entry, kern_entry; int ext_sg_entries, kern_sg_entries; int ext_sg_start, ext_offset; - int len_to_copy, len_copied; + int len_to_copy; int kern_watermark, ext_watermark; struct ctl_scsiio *ctsio; int i, j; @@ -196,7 +196,6 @@ tpcl_datamove(union ctl_io *io) kern_watermark = 0; ext_watermark = ext_offset; - len_copied = 0; for (i = ext_sg_start, j = 0; i < ext_sg_entries && j < kern_sg_entries;) { uint8_t *ext_ptr, *kern_ptr; @@ -218,9 +217,6 @@ tpcl_datamove(union ctl_io *io) kern_ptr = (uint8_t *)kern_sglist[j].addr; kern_ptr = kern_ptr + kern_watermark; - kern_watermark += len_to_copy; - ext_watermark += len_to_copy; - if ((ctsio->io_hdr.flags & CTL_FLAG_DATA_MASK) == CTL_FLAG_DATA_IN) { CTL_DEBUG_PRINT(("%s: copying %d bytes to user\n", @@ -236,27 +232,27 @@ tpcl_datamove(union ctl_io *io) memcpy(kern_ptr, ext_ptr, len_to_copy); } - len_copied += len_to_copy; + ctsio->ext_data_filled += len_to_copy; + ctsio->kern_data_resid -= len_to_copy; + ext_watermark += len_to_copy; if (ext_sglist[i].len == ext_watermark) { i++; ext_watermark = 0; } + kern_watermark += len_to_copy; if (kern_sglist[j].len == kern_watermark) { j++; kern_watermark = 0; } } - ctsio->ext_data_filled += len_copied; - CTL_DEBUG_PRINT(("%s: ext_sg_entries: %d, kern_sg_entries: %d\n", __func__, ext_sg_entries, kern_sg_entries)); CTL_DEBUG_PRINT(("%s: ext_data_len = %d, kern_data_len = %d\n", __func__, ctsio->ext_data_len, ctsio->kern_data_len)); - /* XXX KDM set residual?? */ bailout: io->scsiio.be_move_done(io); } Modified: stable/11/sys/cam/ctl/scsi_ctl.c ============================================================================== --- stable/11/sys/cam/ctl/scsi_ctl.c Tue Feb 7 01:39:25 2017 (r313363) +++ stable/11/sys/cam/ctl/scsi_ctl.c Tue Feb 7 01:42:13 2017 (r313364) @@ -721,15 +721,18 @@ ctlfedata(struct ctlfe_lun_softc *softc, idx = cmd_info->cur_transfer_index; off = cmd_info->cur_transfer_off; cmd_info->flags &= ~CTLFE_CMD_PIECEWISE; - if (io->scsiio.kern_sg_entries == 0) { - /* No S/G list. */ + if (io->scsiio.kern_sg_entries == 0) { /* No S/G list. */ + + /* One time shift for SRR offset. */ + off += io->scsiio.ext_data_filled; + io->scsiio.ext_data_filled = 0; + *data_ptr = io->scsiio.kern_data_ptr + off; if (io->scsiio.kern_data_len - off <= bus_softc->maxio) { *dxfer_len = io->scsiio.kern_data_len - off; } else { *dxfer_len = bus_softc->maxio; - cmd_info->cur_transfer_index = -1; - cmd_info->cur_transfer_off = bus_softc->maxio; + cmd_info->cur_transfer_off += bus_softc->maxio; cmd_info->flags |= CTLFE_CMD_PIECEWISE; } *sglist_cnt = 0; @@ -738,9 +741,18 @@ ctlfedata(struct ctlfe_lun_softc *softc, *flags |= CAM_DATA_PADDR; else *flags |= CAM_DATA_VADDR; - } else { - /* S/G list with physical or virtual pointers. */ + } else { /* S/G list with physical or virtual pointers. */ ctl_sglist = (struct ctl_sg_entry *)io->scsiio.kern_data_ptr; + + /* One time shift for SRR offset. */ + while (io->scsiio.ext_data_filled >= ctl_sglist[idx].len - off) { + io->scsiio.ext_data_filled -= ctl_sglist[idx].len - off; + idx++; + off = 0; + } + off += io->scsiio.ext_data_filled; + io->scsiio.ext_data_filled = 0; + cam_sglist = cmd_info->cam_sglist; *dxfer_len = 0; for (i = 0; i < io->scsiio.kern_sg_entries - idx; i++) { @@ -818,18 +830,8 @@ ctlfestart(struct cam_periph *periph, un /* * Datamove call, we need to setup the S/G list. */ - scsi_status = 0; - csio->cdb_len = atio->cdb_len; ctlfedata(softc, io, &flags, &data_ptr, &dxfer_len, &csio->sglist_cnt); - io->scsiio.ext_data_filled += dxfer_len; - if (io->scsiio.ext_data_filled > io->scsiio.kern_total_len) { - xpt_print(periph->path, "%s: tag 0x%04x " - "fill len %u > total %u\n", - __func__, io->scsiio.tag_num, - io->scsiio.ext_data_filled, - io->scsiio.kern_total_len); - } } else { /* * We're done, send status back. @@ -891,8 +893,8 @@ ctlfestart(struct cam_periph *periph, un data_ptr = NULL; dxfer_len = 0; csio->sglist_cnt = 0; - scsi_status = 0; } + scsi_status = 0; if ((io->io_hdr.flags & CTL_FLAG_STATUS_QUEUED) && (cmd_info->flags & CTLFE_CMD_PIECEWISE) == 0 && ((io->io_hdr.flags & CTL_FLAG_DMA_QUEUED) == 0 || @@ -1246,13 +1248,36 @@ ctlfedone(struct cam_periph *periph, uni | (done_ccb->csio.msg_ptr[6]); } + /* + * If we have an SRR and we're still sending data, we + * should be able to adjust offsets and cycle again. + * It is possible only if offset is from this datamove. + */ + if (srr && (io->io_hdr.flags & CTL_FLAG_DMA_INPROG) && + srr_off >= io->scsiio.kern_rel_offset && + srr_off < io->scsiio.kern_rel_offset + + io->scsiio.kern_data_len) { + io->scsiio.kern_data_resid = + io->scsiio.kern_rel_offset + + io->scsiio.kern_data_len - srr_off; + io->scsiio.ext_data_filled = srr_off; + io->scsiio.io_hdr.status = CTL_STATUS_NONE; + io->io_hdr.flags |= CTL_FLAG_DMA_QUEUED; + softc->ccbs_freed++; + xpt_release_ccb(done_ccb); + TAILQ_INSERT_HEAD(&softc->work_queue, &atio->ccb_h, + periph_links.tqe); + xpt_schedule(periph, /*priority*/ 1); + break; + } + + /* + * If status was being sent, the back end data is now history. + * Hack it up and resubmit a new command with the CDB adjusted. + * If the SIM does the right thing, all of the resid math + * should work. + */ if (srr && (io->io_hdr.flags & CTL_FLAG_DMA_INPROG) == 0) { - /* - * If status was being sent, the back end data is now - * history. Hack it up and resubmit a new command with - * the CDB adjusted. If the SIM does the right thing, - * all of the resid math should work. - */ softc->ccbs_freed++; xpt_release_ccb(done_ccb); if (ctlfe_adjust_cdb(atio, srr_off) == 0) { @@ -1262,22 +1287,6 @@ ctlfedone(struct cam_periph *periph, uni /* * Fall through to doom.... */ - } else if (srr) { - /* - * If we have an srr and we're still sending data, we - * should be able to adjust offsets and cycle again. - */ - io->scsiio.kern_rel_offset = - io->scsiio.ext_data_filled = srr_off; - io->scsiio.ext_data_len = io->scsiio.kern_total_len - - io->scsiio.kern_rel_offset; - softc->ccbs_freed++; - io->scsiio.io_hdr.status = CTL_STATUS_NONE; - xpt_release_ccb(done_ccb); - TAILQ_INSERT_HEAD(&softc->work_queue, &atio->ccb_h, - periph_links.tqe); - xpt_schedule(periph, /*priority*/ 1); - break; } if ((done_ccb->ccb_h.flags & CAM_SEND_STATUS) && @@ -1320,16 +1329,6 @@ ctlfedone(struct cam_periph *periph, uni io->io_hdr.flags &= ~CTL_FLAG_DMA_INPROG; - io->scsiio.ext_data_len += csio->dxfer_len; - if (io->scsiio.ext_data_len > - io->scsiio.kern_total_len) { - xpt_print(periph->path, "%s: tag 0x%04x " - "done len %u > total %u sent %u\n", - __func__, io->scsiio.tag_num, - io->scsiio.ext_data_len, - io->scsiio.kern_total_len, - io->scsiio.ext_data_filled); - } /* * Translate CAM status to CTL status. Success * does not change the overall, ctl_io status. In @@ -1339,6 +1338,7 @@ ctlfedone(struct cam_periph *periph, uni */ switch (done_ccb->ccb_h.status & CAM_STATUS_MASK) { case CAM_REQ_CMP: + io->scsiio.kern_data_resid -= csio->dxfer_len; io->io_hdr.port_status = 0; break; default: @@ -1368,7 +1368,6 @@ ctlfedone(struct cam_periph *periph, uni if ((cmd_info->flags & CTLFE_CMD_PIECEWISE) && (io->io_hdr.port_status == 0)) { ccb_flags flags; - uint8_t scsi_status; uint8_t *data_ptr; uint32_t dxfer_len; @@ -1379,8 +1378,6 @@ ctlfedone(struct cam_periph *periph, uni ctlfedata(softc, io, &flags, &data_ptr, &dxfer_len, &csio->sglist_cnt); - scsi_status = 0; - if (((flags & CAM_SEND_STATUS) == 0) && (dxfer_len == 0)) { printf("%s: tag %04x no status or " @@ -1400,7 +1397,7 @@ ctlfedone(struct cam_periph *periph, uni MSG_SIMPLE_Q_TAG : 0, atio->tag_id, atio->init_id, - scsi_status, + 0, /*data_ptr*/ data_ptr, *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-stable-11@freebsd.org Tue Feb 7 01:43:46 2017 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C0882CD3EEF; Tue, 7 Feb 2017 01:43:46 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 6EF451AB5; Tue, 7 Feb 2017 01:43:46 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v171hj5T095315; Tue, 7 Feb 2017 01:43:45 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v171hjRd095312; Tue, 7 Feb 2017 01:43:45 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201702070143.v171hjRd095312@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Tue, 7 Feb 2017 01:43:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r313366 - stable/11/sys/cam/ctl X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Feb 2017 01:43:46 -0000 Author: mav Date: Tue Feb 7 01:43:45 2017 New Revision: 313366 URL: https://svnweb.freebsd.org/changeset/base/313366 Log: MFC r312348: Remove writing 'residual' field of struct ctl_scsiio. This field has no practical use and never readed. Initiators already receive respective residual size from frontends. Removed field had different semantics, which looks useless, and was never passed through by any frontend. While there, fix kern_data_resid field support in case of HA, missed in r312291. Modified: stable/11/sys/cam/ctl/ctl.c stable/11/sys/cam/ctl/ctl_io.h stable/11/sys/cam/ctl/ctl_tpc.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/cam/ctl/ctl.c ============================================================================== --- stable/11/sys/cam/ctl/ctl.c Tue Feb 7 01:42:53 2017 (r313365) +++ stable/11/sys/cam/ctl/ctl.c Tue Feb 7 01:43:45 2017 (r313366) @@ -696,8 +696,6 @@ ctl_ha_done(union ctl_io *io) msg.scsi.tag_num = io->scsiio.tag_num; msg.scsi.tag_type = io->scsiio.tag_type; msg.scsi.sense_len = io->scsiio.sense_len; - msg.scsi.sense_residual = io->scsiio.sense_residual; - msg.scsi.residual = io->scsiio.residual; memcpy(&msg.scsi.sense_data, &io->scsiio.sense_data, io->scsiio.sense_len); ctl_ha_msg_send(CTL_HA_CHAN_CTL, &msg, @@ -725,8 +723,6 @@ ctl_isc_handler_finish_xfer(struct ctl_s ctsio->io_hdr.status = msg_info->hdr.status; ctsio->scsi_status = msg_info->scsi.scsi_status; ctsio->sense_len = msg_info->scsi.sense_len; - ctsio->sense_residual = msg_info->scsi.sense_residual; - ctsio->residual = msg_info->scsi.residual; memcpy(&ctsio->sense_data, &msg_info->scsi.sense_data, msg_info->scsi.sense_len); ctl_enqueue_isc((union ctl_io *)ctsio); @@ -1495,13 +1491,12 @@ ctl_isc_event_handler(ctl_ha_channel cha io->io_hdr.msg_type = CTL_MSG_DATAMOVE_DONE; io->io_hdr.flags &= ~CTL_FLAG_DMA_INPROG; io->io_hdr.flags |= CTL_FLAG_IO_ACTIVE; - io->io_hdr.port_status = msg->scsi.fetd_status; - io->scsiio.residual = msg->scsi.residual; + io->io_hdr.port_status = msg->scsi.port_status; + io->scsiio.kern_data_resid = msg->scsi.kern_data_resid; if (msg->hdr.status != CTL_STATUS_NONE) { io->io_hdr.status = msg->hdr.status; io->scsiio.scsi_status = msg->scsi.scsi_status; io->scsiio.sense_len = msg->scsi.sense_len; - io->scsiio.sense_residual =msg->scsi.sense_residual; memcpy(&io->scsiio.sense_data, &msg->scsi.sense_data, msg->scsi.sense_len); @@ -6498,15 +6493,8 @@ ctl_mode_sense(struct ctl_scsiio *ctsio) ctsio->kern_data_ptr = malloc(total_len, M_CTL, M_WAITOK | M_ZERO); ctsio->kern_sg_entries = 0; ctsio->kern_rel_offset = 0; - if (total_len < alloc_len) { - ctsio->residual = alloc_len - total_len; - ctsio->kern_data_len = total_len; - ctsio->kern_total_len = total_len; - } else { - ctsio->residual = 0; - ctsio->kern_data_len = alloc_len; - ctsio->kern_total_len = alloc_len; - } + ctsio->kern_data_len = min(total_len, alloc_len); + ctsio->kern_total_len = ctsio->kern_data_len; switch (ctsio->cdb[0]) { case MODE_SENSE_6: { @@ -6850,15 +6838,8 @@ ctl_log_sense(struct ctl_scsiio *ctsio) ctsio->kern_data_ptr = malloc(total_len, M_CTL, M_WAITOK | M_ZERO); ctsio->kern_sg_entries = 0; ctsio->kern_rel_offset = 0; - if (total_len < alloc_len) { - ctsio->residual = alloc_len - total_len; - ctsio->kern_data_len = total_len; - ctsio->kern_total_len = total_len; - } else { - ctsio->residual = 0; - ctsio->kern_data_len = alloc_len; - ctsio->kern_total_len = alloc_len; - } + ctsio->kern_data_len = min(total_len, alloc_len); + ctsio->kern_total_len = ctsio->kern_data_len; header = (struct scsi_log_header *)ctsio->kern_data_ptr; header->page = page_index->page_code; @@ -6913,7 +6894,6 @@ ctl_read_capacity(struct ctl_scsiio *cts ctsio->kern_data_ptr = malloc(sizeof(*data), M_CTL, M_WAITOK | M_ZERO); data = (struct scsi_read_capacity_data *)ctsio->kern_data_ptr; - ctsio->residual = 0; ctsio->kern_data_len = sizeof(*data); ctsio->kern_total_len = sizeof(*data); ctsio->kern_rel_offset = 0; @@ -6971,18 +6951,10 @@ ctl_read_capacity_16(struct ctl_scsiio * ctsio->kern_data_ptr = malloc(sizeof(*data), M_CTL, M_WAITOK | M_ZERO); data = (struct scsi_read_capacity_data_long *)ctsio->kern_data_ptr; - - if (sizeof(*data) < alloc_len) { - ctsio->residual = alloc_len - sizeof(*data); - ctsio->kern_data_len = sizeof(*data); - ctsio->kern_total_len = sizeof(*data); - } else { - ctsio->residual = 0; - ctsio->kern_data_len = alloc_len; - ctsio->kern_total_len = alloc_len; - } ctsio->kern_rel_offset = 0; ctsio->kern_sg_entries = 0; + ctsio->kern_data_len = min(sizeof(*data), alloc_len); + ctsio->kern_total_len = ctsio->kern_data_len; scsi_u64to8b(lun->be_lun->maxlba, data->addr); /* XXX KDM this may not be 512 bytes... */ @@ -7025,18 +6997,10 @@ ctl_get_lba_status(struct ctl_scsiio *ct total_len = sizeof(*data) + sizeof(data->descr[0]); ctsio->kern_data_ptr = malloc(total_len, M_CTL, M_WAITOK | M_ZERO); data = (struct scsi_get_lba_status_data *)ctsio->kern_data_ptr; - - if (total_len < alloc_len) { - ctsio->residual = alloc_len - total_len; - ctsio->kern_data_len = total_len; - ctsio->kern_total_len = total_len; - } else { - ctsio->residual = 0; - ctsio->kern_data_len = alloc_len; - ctsio->kern_total_len = alloc_len; - } ctsio->kern_rel_offset = 0; ctsio->kern_sg_entries = 0; + ctsio->kern_data_len = min(total_len, alloc_len); + ctsio->kern_total_len = ctsio->kern_data_len; /* Fill dummy data in case backend can't tell anything. */ scsi_ulto4b(4 + sizeof(data->descr[0]), data->length); @@ -7087,17 +7051,10 @@ ctl_read_defect(struct ctl_scsiio *ctsio } ctsio->kern_data_ptr = malloc(data_len, M_CTL, M_WAITOK | M_ZERO); - if (data_len < alloc_len) { - ctsio->residual = alloc_len - data_len; - ctsio->kern_data_len = data_len; - ctsio->kern_total_len = data_len; - } else { - ctsio->residual = 0; - ctsio->kern_data_len = alloc_len; - ctsio->kern_total_len = alloc_len; - } ctsio->kern_rel_offset = 0; ctsio->kern_sg_entries = 0; + ctsio->kern_data_len = min(data_len, alloc_len); + ctsio->kern_total_len = ctsio->kern_data_len; if (ctsio->cdb[0] == READ_DEFECT_DATA_10) { data10 = (struct scsi_read_defect_data_hdr_10 *) @@ -7182,19 +7139,10 @@ ctl_report_tagret_port_groups(struct ctl alloc_len = scsi_4btoul(cdb->length); ctsio->kern_data_ptr = malloc(total_len, M_CTL, M_WAITOK | M_ZERO); - ctsio->kern_sg_entries = 0; - - if (total_len < alloc_len) { - ctsio->residual = alloc_len - total_len; - ctsio->kern_data_len = total_len; - ctsio->kern_total_len = total_len; - } else { - ctsio->residual = 0; - ctsio->kern_data_len = alloc_len; - ctsio->kern_total_len = alloc_len; - } ctsio->kern_rel_offset = 0; + ctsio->kern_data_len = min(total_len, alloc_len); + ctsio->kern_total_len = ctsio->kern_data_len; if (ext) { rtg_ext_ptr = (struct scsi_target_group_data_extended *) @@ -7382,19 +7330,10 @@ ctl_report_supported_opcodes(struct ctl_ alloc_len = scsi_4btoul(cdb->length); ctsio->kern_data_ptr = malloc(total_len, M_CTL, M_WAITOK | M_ZERO); - ctsio->kern_sg_entries = 0; - - if (total_len < alloc_len) { - ctsio->residual = alloc_len - total_len; - ctsio->kern_data_len = total_len; - ctsio->kern_total_len = total_len; - } else { - ctsio->residual = 0; - ctsio->kern_data_len = alloc_len; - ctsio->kern_total_len = alloc_len; - } ctsio->kern_rel_offset = 0; + ctsio->kern_data_len = min(total_len, alloc_len); + ctsio->kern_total_len = ctsio->kern_data_len; switch (cdb->options & RSO_OPTIONS_MASK) { case RSO_OPTIONS_ALL: @@ -7495,19 +7434,10 @@ ctl_report_supported_tmf(struct ctl_scsi alloc_len = scsi_4btoul(cdb->length); ctsio->kern_data_ptr = malloc(total_len, M_CTL, M_WAITOK | M_ZERO); - ctsio->kern_sg_entries = 0; - - if (total_len < alloc_len) { - ctsio->residual = alloc_len - total_len; - ctsio->kern_data_len = total_len; - ctsio->kern_total_len = total_len; - } else { - ctsio->residual = 0; - ctsio->kern_data_len = alloc_len; - ctsio->kern_total_len = alloc_len; - } ctsio->kern_rel_offset = 0; + ctsio->kern_data_len = min(total_len, alloc_len); + ctsio->kern_total_len = ctsio->kern_data_len; data = (struct scsi_report_supported_tmf_ext_data *)ctsio->kern_data_ptr; data->byte1 |= RST_ATS | RST_ATSS | RST_CTSS | RST_LURS | RST_QTS | @@ -7542,19 +7472,10 @@ ctl_report_timestamp(struct ctl_scsiio * alloc_len = scsi_4btoul(cdb->length); ctsio->kern_data_ptr = malloc(total_len, M_CTL, M_WAITOK | M_ZERO); - ctsio->kern_sg_entries = 0; - - if (total_len < alloc_len) { - ctsio->residual = alloc_len - total_len; - ctsio->kern_data_len = total_len; - ctsio->kern_total_len = total_len; - } else { - ctsio->residual = 0; - ctsio->kern_data_len = alloc_len; - ctsio->kern_total_len = alloc_len; - } ctsio->kern_rel_offset = 0; + ctsio->kern_data_len = min(total_len, alloc_len); + ctsio->kern_total_len = ctsio->kern_data_len; data = (struct scsi_report_timestamp_data *)ctsio->kern_data_ptr; scsi_ulto2b(sizeof(*data) - 2, data->length); @@ -7615,19 +7536,10 @@ retry: mtx_unlock(&lun->lun_lock); ctsio->kern_data_ptr = malloc(total_len, M_CTL, M_WAITOK | M_ZERO); - - if (total_len < alloc_len) { - ctsio->residual = alloc_len - total_len; - ctsio->kern_data_len = total_len; - ctsio->kern_total_len = total_len; - } else { - ctsio->residual = 0; - ctsio->kern_data_len = alloc_len; - ctsio->kern_total_len = alloc_len; - } - ctsio->kern_rel_offset = 0; ctsio->kern_sg_entries = 0; + ctsio->kern_data_len = min(total_len, alloc_len); + ctsio->kern_total_len = ctsio->kern_data_len; mtx_lock(&lun->lun_lock); switch (cdb->action) { @@ -9174,18 +9086,10 @@ ctl_report_luns(struct ctl_scsiio *ctsio */ lun_datalen = sizeof(*lun_data) + (num_filled * sizeof(struct scsi_report_luns_lundata)); - - if (lun_datalen < alloc_len) { - ctsio->residual = alloc_len - lun_datalen; - ctsio->kern_data_len = lun_datalen; - ctsio->kern_total_len = lun_datalen; - } else { - ctsio->residual = 0; - ctsio->kern_data_len = alloc_len; - ctsio->kern_total_len = alloc_len; - } ctsio->kern_rel_offset = 0; ctsio->kern_sg_entries = 0; + ctsio->kern_data_len = min(lun_datalen, alloc_len); + ctsio->kern_total_len = ctsio->kern_data_len; /* * We set this to the actual data length, regardless of how much @@ -9236,19 +9140,16 @@ ctl_request_sense(struct ctl_scsiio *cts ctsio->kern_data_ptr = malloc(sizeof(*sense_ptr), M_CTL, M_WAITOK); sense_ptr = (struct scsi_sense_data *)ctsio->kern_data_ptr; ctsio->kern_sg_entries = 0; + ctsio->kern_rel_offset = 0; /* * struct scsi_sense_data, which is currently set to 256 bytes, is * larger than the largest allowed value for the length field in the * REQUEST SENSE CDB, which is 252 bytes as of SPC-4. */ - ctsio->residual = 0; ctsio->kern_data_len = cdb->length; ctsio->kern_total_len = cdb->length; - ctsio->kern_rel_offset = 0; - ctsio->kern_sg_entries = 0; - /* * If we don't have a LUN, we don't have any pending sense. */ @@ -9373,19 +9274,10 @@ ctl_inquiry_evpd_supported(struct ctl_sc SCSI_EVPD_NUM_SUPPORTED_PAGES; ctsio->kern_data_ptr = malloc(sup_page_size, M_CTL, M_WAITOK | M_ZERO); pages = (struct scsi_vpd_supported_pages *)ctsio->kern_data_ptr; - ctsio->kern_sg_entries = 0; - - if (sup_page_size < alloc_len) { - ctsio->residual = alloc_len - sup_page_size; - ctsio->kern_data_len = sup_page_size; - ctsio->kern_total_len = sup_page_size; - } else { - ctsio->residual = 0; - ctsio->kern_data_len = alloc_len; - ctsio->kern_total_len = alloc_len; - } ctsio->kern_rel_offset = 0; ctsio->kern_sg_entries = 0; + ctsio->kern_data_len = min(sup_page_size, alloc_len); + ctsio->kern_total_len = ctsio->kern_data_len; /* * The control device is always connected. The disk device, on the @@ -9443,17 +9335,10 @@ ctl_inquiry_evpd_serial(struct ctl_scsii data_len = 4 + CTL_SN_LEN; ctsio->kern_data_ptr = malloc(data_len, M_CTL, M_WAITOK | M_ZERO); sn_ptr = (struct scsi_vpd_unit_serial_number *)ctsio->kern_data_ptr; - if (data_len < alloc_len) { - ctsio->residual = alloc_len - data_len; - ctsio->kern_data_len = data_len; - ctsio->kern_total_len = data_len; - } else { - ctsio->residual = 0; - ctsio->kern_data_len = alloc_len; - ctsio->kern_total_len = alloc_len; - } ctsio->kern_rel_offset = 0; ctsio->kern_sg_entries = 0; + ctsio->kern_data_len = min(data_len, alloc_len); + ctsio->kern_total_len = ctsio->kern_data_len; /* * The control device is always connected. The disk device, on the @@ -9500,18 +9385,9 @@ ctl_inquiry_evpd_eid(struct ctl_scsiio * ctsio->kern_data_ptr = malloc(data_len, M_CTL, M_WAITOK | M_ZERO); eid_ptr = (struct scsi_vpd_extended_inquiry_data *)ctsio->kern_data_ptr; ctsio->kern_sg_entries = 0; - - if (data_len < alloc_len) { - ctsio->residual = alloc_len - data_len; - ctsio->kern_data_len = data_len; - ctsio->kern_total_len = data_len; - } else { - ctsio->residual = 0; - ctsio->kern_data_len = alloc_len; - ctsio->kern_total_len = alloc_len; - } ctsio->kern_rel_offset = 0; - ctsio->kern_sg_entries = 0; + ctsio->kern_data_len = min(data_len, alloc_len); + ctsio->kern_total_len = ctsio->kern_data_len; /* * The control device is always connected. The disk device, on the @@ -9574,19 +9450,10 @@ ctl_inquiry_evpd_mpp(struct ctl_scsiio * ctsio->kern_data_ptr = malloc(data_len, M_CTL, M_WAITOK | M_ZERO); mpp_ptr = (struct scsi_vpd_mode_page_policy *)ctsio->kern_data_ptr; - ctsio->kern_sg_entries = 0; - - if (data_len < alloc_len) { - ctsio->residual = alloc_len - data_len; - ctsio->kern_data_len = data_len; - ctsio->kern_total_len = data_len; - } else { - ctsio->residual = 0; - ctsio->kern_data_len = alloc_len; - ctsio->kern_total_len = alloc_len; - } ctsio->kern_rel_offset = 0; ctsio->kern_sg_entries = 0; + ctsio->kern_data_len = min(data_len, alloc_len); + ctsio->kern_total_len = ctsio->kern_data_len; /* * The control device is always connected. The disk device, on the @@ -9639,18 +9506,10 @@ ctl_inquiry_evpd_devid(struct ctl_scsiio ctsio->kern_data_ptr = malloc(data_len, M_CTL, M_WAITOK | M_ZERO); devid_ptr = (struct scsi_vpd_device_id *)ctsio->kern_data_ptr; ctsio->kern_sg_entries = 0; - - if (data_len < alloc_len) { - ctsio->residual = alloc_len - data_len; - ctsio->kern_data_len = data_len; - ctsio->kern_total_len = data_len; - } else { - ctsio->residual = 0; - ctsio->kern_data_len = alloc_len; - ctsio->kern_total_len = alloc_len; - } ctsio->kern_rel_offset = 0; ctsio->kern_sg_entries = 0; + ctsio->kern_data_len = min(data_len, alloc_len); + ctsio->kern_total_len = ctsio->kern_data_len; /* * The control device is always connected. The disk device, on the @@ -9767,18 +9626,10 @@ ctl_inquiry_evpd_scsi_ports(struct ctl_s ctsio->kern_data_ptr = malloc(data_len, M_CTL, M_WAITOK | M_ZERO); sp = (struct scsi_vpd_scsi_ports *)ctsio->kern_data_ptr; ctsio->kern_sg_entries = 0; - - if (data_len < alloc_len) { - ctsio->residual = alloc_len - data_len; - ctsio->kern_data_len = data_len; - ctsio->kern_total_len = data_len; - } else { - ctsio->residual = 0; - ctsio->kern_data_len = alloc_len; - ctsio->kern_total_len = alloc_len; - } ctsio->kern_rel_offset = 0; ctsio->kern_sg_entries = 0; + ctsio->kern_data_len = min(data_len, alloc_len); + ctsio->kern_total_len = ctsio->kern_data_len; /* * The control device is always connected. The disk device, on the @@ -9842,18 +9693,10 @@ ctl_inquiry_evpd_block_limits(struct ctl ctsio->kern_data_ptr = malloc(sizeof(*bl_ptr), M_CTL, M_WAITOK | M_ZERO); bl_ptr = (struct scsi_vpd_block_limits *)ctsio->kern_data_ptr; ctsio->kern_sg_entries = 0; - - if (sizeof(*bl_ptr) < alloc_len) { - ctsio->residual = alloc_len - sizeof(*bl_ptr); - ctsio->kern_data_len = sizeof(*bl_ptr); - ctsio->kern_total_len = sizeof(*bl_ptr); - } else { - ctsio->residual = 0; - ctsio->kern_data_len = alloc_len; - ctsio->kern_total_len = alloc_len; - } ctsio->kern_rel_offset = 0; ctsio->kern_sg_entries = 0; + ctsio->kern_data_len = min(sizeof(*bl_ptr), alloc_len); + ctsio->kern_total_len = ctsio->kern_data_len; /* * The control device is always connected. The disk device, on the @@ -9917,18 +9760,9 @@ ctl_inquiry_evpd_bdc(struct ctl_scsiio * ctsio->kern_data_ptr = malloc(sizeof(*bdc_ptr), M_CTL, M_WAITOK | M_ZERO); bdc_ptr = (struct scsi_vpd_block_device_characteristics *)ctsio->kern_data_ptr; ctsio->kern_sg_entries = 0; - - if (sizeof(*bdc_ptr) < alloc_len) { - ctsio->residual = alloc_len - sizeof(*bdc_ptr); - ctsio->kern_data_len = sizeof(*bdc_ptr); - ctsio->kern_total_len = sizeof(*bdc_ptr); - } else { - ctsio->residual = 0; - ctsio->kern_data_len = alloc_len; - ctsio->kern_total_len = alloc_len; - } ctsio->kern_rel_offset = 0; - ctsio->kern_sg_entries = 0; + ctsio->kern_data_len = min(sizeof(*bdc_ptr), alloc_len); + ctsio->kern_total_len = ctsio->kern_data_len; /* * The control device is always connected. The disk device, on the @@ -9973,18 +9807,9 @@ ctl_inquiry_evpd_lbp(struct ctl_scsiio * ctsio->kern_data_ptr = malloc(sizeof(*lbp_ptr), M_CTL, M_WAITOK | M_ZERO); lbp_ptr = (struct scsi_vpd_logical_block_prov *)ctsio->kern_data_ptr; ctsio->kern_sg_entries = 0; - - if (sizeof(*lbp_ptr) < alloc_len) { - ctsio->residual = alloc_len - sizeof(*lbp_ptr); - ctsio->kern_data_len = sizeof(*lbp_ptr); - ctsio->kern_total_len = sizeof(*lbp_ptr); - } else { - ctsio->residual = 0; - ctsio->kern_data_len = alloc_len; - ctsio->kern_total_len = alloc_len; - } ctsio->kern_rel_offset = 0; - ctsio->kern_sg_entries = 0; + ctsio->kern_data_len = min(sizeof(*lbp_ptr), alloc_len); + ctsio->kern_total_len = ctsio->kern_data_len; /* * The control device is always connected. The disk device, on the @@ -10118,16 +9943,8 @@ ctl_inquiry_std(struct ctl_scsiio *ctsio inq_ptr = (struct scsi_inquiry_data *)ctsio->kern_data_ptr; ctsio->kern_sg_entries = 0; ctsio->kern_rel_offset = 0; - - if (data_len < alloc_len) { - ctsio->residual = alloc_len - data_len; - ctsio->kern_data_len = data_len; - ctsio->kern_total_len = data_len; - } else { - ctsio->residual = 0; - ctsio->kern_data_len = alloc_len; - ctsio->kern_total_len = alloc_len; - } + ctsio->kern_data_len = min(data_len, alloc_len); + ctsio->kern_total_len = ctsio->kern_data_len; if (lun != NULL) { if ((lun->flags & CTL_LUN_PRIMARY_SC) || @@ -10511,15 +10328,8 @@ done: data_len = (uint8_t *)feature - (uint8_t *)hdr; } scsi_ulto4b(data_len - 4, hdr->data_length); - if (data_len < alloc_len) { - ctsio->residual = alloc_len - data_len; - ctsio->kern_data_len = data_len; - ctsio->kern_total_len = data_len; - } else { - ctsio->residual = 0; - ctsio->kern_data_len = alloc_len; - ctsio->kern_total_len = alloc_len; - } + ctsio->kern_data_len = min(data_len, alloc_len); + ctsio->kern_total_len = ctsio->kern_data_len; ctl_set_success(ctsio); ctsio->io_hdr.flags |= CTL_FLAG_ALLOCATED; @@ -10550,16 +10360,8 @@ ctl_get_event_status(struct ctl_scsiio * ctsio->kern_data_ptr = malloc(data_len, M_CTL, M_WAITOK | M_ZERO); ctsio->kern_sg_entries = 0; ctsio->kern_rel_offset = 0; - - if (data_len < alloc_len) { - ctsio->residual = alloc_len - data_len; - ctsio->kern_data_len = data_len; - ctsio->kern_total_len = data_len; - } else { - ctsio->residual = 0; - ctsio->kern_data_len = alloc_len; - ctsio->kern_total_len = alloc_len; - } + ctsio->kern_data_len = min(data_len, alloc_len); + ctsio->kern_total_len = ctsio->kern_data_len; hdr = (struct scsi_get_event_status_header *)ctsio->kern_data_ptr; scsi_ulto2b(0, hdr->descr_length); @@ -10587,16 +10389,8 @@ ctl_mechanism_status(struct ctl_scsiio * ctsio->kern_data_ptr = malloc(data_len, M_CTL, M_WAITOK | M_ZERO); ctsio->kern_sg_entries = 0; ctsio->kern_rel_offset = 0; - - if (data_len < alloc_len) { - ctsio->residual = alloc_len - data_len; - ctsio->kern_data_len = data_len; - ctsio->kern_total_len = data_len; - } else { - ctsio->residual = 0; - ctsio->kern_data_len = alloc_len; - ctsio->kern_total_len = alloc_len; - } + ctsio->kern_data_len = min(data_len, alloc_len); + ctsio->kern_total_len = ctsio->kern_data_len; hdr = (struct scsi_mechanism_status_header *)ctsio->kern_data_ptr; hdr->state1 = 0x00; @@ -10646,16 +10440,8 @@ ctl_read_toc(struct ctl_scsiio *ctsio) ctsio->kern_data_ptr = malloc(data_len, M_CTL, M_WAITOK | M_ZERO); ctsio->kern_sg_entries = 0; ctsio->kern_rel_offset = 0; - - if (data_len < alloc_len) { - ctsio->residual = alloc_len - data_len; - ctsio->kern_data_len = data_len; - ctsio->kern_total_len = data_len; - } else { - ctsio->residual = 0; - ctsio->kern_data_len = alloc_len; - ctsio->kern_total_len = alloc_len; - } + ctsio->kern_data_len = min(data_len, alloc_len); + ctsio->kern_total_len = ctsio->kern_data_len; hdr = (struct scsi_read_toc_hdr *)ctsio->kern_data_ptr; if (format == 0) { @@ -12647,15 +12433,14 @@ ctl_send_datamove_done(union ctl_io *io, msg.hdr.serializing_sc = io->io_hdr.serializing_sc; msg.hdr.nexus = io->io_hdr.nexus; msg.hdr.status = io->io_hdr.status; + msg.scsi.kern_data_resid = io->scsiio.kern_data_resid; msg.scsi.tag_num = io->scsiio.tag_num; msg.scsi.tag_type = io->scsiio.tag_type; msg.scsi.scsi_status = io->scsiio.scsi_status; memcpy(&msg.scsi.sense_data, &io->scsiio.sense_data, io->scsiio.sense_len); msg.scsi.sense_len = io->scsiio.sense_len; - msg.scsi.sense_residual = io->scsiio.sense_residual; - msg.scsi.fetd_status = io->io_hdr.port_status; - msg.scsi.residual = io->scsiio.residual; + msg.scsi.port_status = io->io_hdr.port_status; io->io_hdr.flags &= ~CTL_FLAG_IO_ACTIVE; if (io->io_hdr.flags & CTL_FLAG_FAILOVER) { ctl_failover_io(io, /*have_lock*/ have_lock); Modified: stable/11/sys/cam/ctl/ctl_io.h ============================================================================== --- stable/11/sys/cam/ctl/ctl_io.h Tue Feb 7 01:42:53 2017 (r313365) +++ stable/11/sys/cam/ctl/ctl_io.h Tue Feb 7 01:43:45 2017 (r313366) @@ -320,7 +320,7 @@ struct ctl_scsiio { uint8_t sense_len; /* Returned sense length */ uint8_t scsi_status; /* SCSI status byte */ uint8_t sense_residual; /* Unused. */ - uint32_t residual; /* data residual length */ + uint32_t residual; /* Unused */ uint32_t tag_num; /* tag number */ ctl_tag_type tag_type; /* simple, ordered, head of queue,etc.*/ uint8_t cdb_len; /* CDB length */ @@ -373,7 +373,7 @@ struct ctl_taskio { /* * HA link messages. */ -#define CTL_HA_VERSION 2 +#define CTL_HA_VERSION 3 /* * Used for CTL_MSG_LOGIN. @@ -469,7 +469,8 @@ struct ctl_ha_msg_dt { }; /* - * Used for CTL_MSG_SERIALIZE, CTL_MSG_FINISH_IO, CTL_MSG_BAD_JUJU. + * Used for CTL_MSG_SERIALIZE, CTL_MSG_FINISH_IO, CTL_MSG_BAD_JUJU, + * and CTL_MSG_DATAMOVE_DONE. */ struct ctl_ha_msg_scsi { struct ctl_ha_msg_hdr hdr; @@ -479,10 +480,9 @@ struct ctl_ha_msg_scsi { uint8_t cdb_len; /* CDB length */ uint8_t scsi_status; /* SCSI status byte */ uint8_t sense_len; /* Returned sense length */ - uint8_t sense_residual; /* sense residual length */ - uint32_t residual; /* data residual length */ - uint32_t fetd_status; /* trans status, set by FETD, + uint32_t port_status; /* trans status, set by FETD, 0 = good*/ + uint32_t kern_data_resid; /* for DATAMOVE_DONE */ struct scsi_sense_data sense_data; /* sense data */ }; Modified: stable/11/sys/cam/ctl/ctl_tpc.c ============================================================================== --- stable/11/sys/cam/ctl/ctl_tpc.c Tue Feb 7 01:42:53 2017 (r313365) +++ stable/11/sys/cam/ctl/ctl_tpc.c Tue Feb 7 01:43:45 2017 (r313366) @@ -282,19 +282,10 @@ ctl_inquiry_evpd_tpc(struct ctl_scsiio * ctsio->kern_data_ptr = malloc(data_len, M_CTL, M_WAITOK | M_ZERO); tpc_ptr = (struct scsi_vpd_tpc *)ctsio->kern_data_ptr; - ctsio->kern_sg_entries = 0; - - if (data_len < alloc_len) { - ctsio->residual = alloc_len - data_len; - ctsio->kern_data_len = data_len; - ctsio->kern_total_len = data_len; - } else { - ctsio->residual = 0; - ctsio->kern_data_len = alloc_len; - ctsio->kern_total_len = alloc_len; - } ctsio->kern_rel_offset = 0; ctsio->kern_sg_entries = 0; + ctsio->kern_data_len = min(data_len, alloc_len); + ctsio->kern_total_len = ctsio->kern_data_len; /* * The control device is always connected. The disk device, on the @@ -457,19 +448,10 @@ ctl_receive_copy_operating_parameters(st alloc_len = scsi_4btoul(cdb->length); ctsio->kern_data_ptr = malloc(total_len, M_CTL, M_WAITOK | M_ZERO); - ctsio->kern_sg_entries = 0; - - if (total_len < alloc_len) { - ctsio->residual = alloc_len - total_len; - ctsio->kern_data_len = total_len; - ctsio->kern_total_len = total_len; - } else { - ctsio->residual = 0; - ctsio->kern_data_len = alloc_len; - ctsio->kern_total_len = alloc_len; - } ctsio->kern_rel_offset = 0; + ctsio->kern_data_len = min(total_len, alloc_len); + ctsio->kern_total_len = ctsio->kern_data_len; data = (struct scsi_receive_copy_operating_parameters_data *)ctsio->kern_data_ptr; scsi_ulto4b(sizeof(*data) - 4 + 4, data->length); @@ -554,19 +536,10 @@ ctl_receive_copy_status_lid1(struct ctl_ alloc_len = scsi_4btoul(cdb->length); ctsio->kern_data_ptr = malloc(total_len, M_CTL, M_WAITOK | M_ZERO); - ctsio->kern_sg_entries = 0; - - if (total_len < alloc_len) { - ctsio->residual = alloc_len - total_len; - ctsio->kern_data_len = total_len; - ctsio->kern_total_len = total_len; - } else { - ctsio->residual = 0; - ctsio->kern_data_len = alloc_len; - ctsio->kern_total_len = alloc_len; - } ctsio->kern_rel_offset = 0; + ctsio->kern_data_len = min(total_len, alloc_len); + ctsio->kern_total_len = ctsio->kern_data_len; data = (struct scsi_receive_copy_status_lid1_data *)ctsio->kern_data_ptr; scsi_ulto4b(sizeof(*data) - 4, data->available_data); @@ -631,19 +604,10 @@ ctl_receive_copy_failure_details(struct alloc_len = scsi_4btoul(cdb->length); ctsio->kern_data_ptr = malloc(total_len, M_CTL, M_WAITOK | M_ZERO); - ctsio->kern_sg_entries = 0; - - if (total_len < alloc_len) { - ctsio->residual = alloc_len - total_len; - ctsio->kern_data_len = total_len; - ctsio->kern_total_len = total_len; - } else { - ctsio->residual = 0; - ctsio->kern_data_len = alloc_len; - ctsio->kern_total_len = alloc_len; - } ctsio->kern_rel_offset = 0; + ctsio->kern_data_len = min(total_len, alloc_len); + ctsio->kern_total_len = ctsio->kern_data_len; data = (struct scsi_receive_copy_failure_details_data *)ctsio->kern_data_ptr; if (list_copy.completed && (list_copy.error || list_copy.abort)) { @@ -702,19 +666,10 @@ ctl_receive_copy_status_lid4(struct ctl_ alloc_len = scsi_4btoul(cdb->length); ctsio->kern_data_ptr = malloc(total_len, M_CTL, M_WAITOK | M_ZERO); - ctsio->kern_sg_entries = 0; - - if (total_len < alloc_len) { - ctsio->residual = alloc_len - total_len; - ctsio->kern_data_len = total_len; - ctsio->kern_total_len = total_len; - } else { - ctsio->residual = 0; - ctsio->kern_data_len = alloc_len; - ctsio->kern_total_len = alloc_len; - } ctsio->kern_rel_offset = 0; + ctsio->kern_data_len = min(total_len, alloc_len); + ctsio->kern_total_len = ctsio->kern_data_len; data = (struct scsi_receive_copy_status_lid4_data *)ctsio->kern_data_ptr; scsi_ulto4b(sizeof(*data) - 4 + list_copy.sense_len, @@ -2402,19 +2357,10 @@ ctl_receive_rod_token_information(struct alloc_len = scsi_4btoul(cdb->length); ctsio->kern_data_ptr = malloc(total_len, M_CTL, M_WAITOK | M_ZERO); - ctsio->kern_sg_entries = 0; - - if (total_len < alloc_len) { - ctsio->residual = alloc_len - total_len; - ctsio->kern_data_len = total_len; - ctsio->kern_total_len = total_len; - } else { - ctsio->residual = 0; - ctsio->kern_data_len = alloc_len; - ctsio->kern_total_len = alloc_len; - } ctsio->kern_rel_offset = 0; + ctsio->kern_data_len = min(total_len, alloc_len); + ctsio->kern_total_len = ctsio->kern_data_len; data = (struct scsi_receive_copy_status_lid4_data *)ctsio->kern_data_ptr; scsi_ulto4b(sizeof(*data) - 4 + list_copy.sense_len + @@ -2482,19 +2428,10 @@ ctl_report_all_rod_tokens(struct ctl_scs alloc_len = scsi_4btoul(cdb->length); ctsio->kern_data_ptr = malloc(total_len, M_CTL, M_WAITOK | M_ZERO); - ctsio->kern_sg_entries = 0; - - if (total_len < alloc_len) { - ctsio->residual = alloc_len - total_len; - ctsio->kern_data_len = total_len; - ctsio->kern_total_len = total_len; - } else { - ctsio->residual = 0; - ctsio->kern_data_len = alloc_len; - ctsio->kern_total_len = alloc_len; - } ctsio->kern_rel_offset = 0; + ctsio->kern_data_len = min(total_len, alloc_len); + ctsio->kern_total_len = ctsio->kern_data_len; data = (struct scsi_report_all_rod_tokens_data *)ctsio->kern_data_ptr; i = 0; From owner-svn-src-stable-11@freebsd.org Tue Feb 7 01:55:51 2017 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5B1CBCD37FA; Tue, 7 Feb 2017 01:55:51 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 1FC5B398; Tue, 7 Feb 2017 01:55:51 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v171toQF099611; Tue, 7 Feb 2017 01:55:50 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v171tmBM099598; Tue, 7 Feb 2017 01:55:48 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201702070155.v171tmBM099598@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Tue, 7 Feb 2017 01:55:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r313368 - stable/11/sys/cam/ctl X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Feb 2017 01:55:51 -0000 Author: mav Date: Tue Feb 7 01:55:48 2017 New Revision: 313368 URL: https://svnweb.freebsd.org/changeset/base/313368 Log: MFC r312603: Add initial support for CTL module unloading. It is only a first step and not perfect, but better then nothing. The main blocker is CAM target frontend, that can not be unloaded, since CAM does not have mechanism to unregister periph driver now. Modified: stable/11/sys/cam/ctl/ctl.c stable/11/sys/cam/ctl/ctl_backend.c stable/11/sys/cam/ctl/ctl_backend.h stable/11/sys/cam/ctl/ctl_backend_block.c stable/11/sys/cam/ctl/ctl_backend_ramdisk.c stable/11/sys/cam/ctl/ctl_frontend.c stable/11/sys/cam/ctl/ctl_frontend.h stable/11/sys/cam/ctl/ctl_frontend_cam_sim.c stable/11/sys/cam/ctl/ctl_frontend_ioctl.c stable/11/sys/cam/ctl/ctl_frontend_iscsi.c stable/11/sys/cam/ctl/ctl_private.h stable/11/sys/cam/ctl/ctl_tpc_local.c stable/11/sys/cam/ctl/scsi_ctl.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/cam/ctl/ctl.c ============================================================================== --- stable/11/sys/cam/ctl/ctl.c Tue Feb 7 01:44:18 2017 (r313367) +++ stable/11/sys/cam/ctl/ctl.c Tue Feb 7 01:55:48 2017 (r313368) @@ -424,7 +424,7 @@ static void ctl_isc_event_handler(ctl_ha static void ctl_copy_sense_data(union ctl_ha_msg *src, union ctl_io *dest); static void ctl_copy_sense_data_back(union ctl_io *src, union ctl_ha_msg *dest); static int ctl_init(void); -void ctl_shutdown(void); +static int ctl_shutdown(void); static int ctl_open(struct cdev *dev, int flags, int fmt, struct thread *td); static int ctl_close(struct cdev *dev, int flags, int fmt, struct thread *td); static void ctl_serialize_other_sc_cmd(struct ctl_scsiio *ctsio); @@ -520,6 +520,8 @@ static const struct ctl_cmd_entry * ctl_validate_command(struct ctl_scsiio *ctsio); static int ctl_cmd_applicable(uint8_t lun_type, const struct ctl_cmd_entry *entry); +static int ctl_ha_init(void); +static int ctl_ha_shutdown(void); static uint64_t ctl_get_prkey(struct ctl_lun *lun, uint32_t residx); static void ctl_clr_prkey(struct ctl_lun *lun, uint32_t residx); @@ -561,6 +563,49 @@ MODULE_VERSION(ctl, 1); static struct ctl_frontend ha_frontend = { .name = "ha", + .init = ctl_ha_init, + .shutdown = ctl_ha_shutdown, +}; + +static int +ctl_ha_init(void) +{ + struct ctl_softc *softc = control_softc; + + if (ctl_pool_create(softc, "othersc", CTL_POOL_ENTRIES_OTHER_SC, + &softc->othersc_pool) != 0) + return (ENOMEM); + if (ctl_ha_msg_init(softc) != CTL_HA_STATUS_SUCCESS) { + ctl_pool_free(softc->othersc_pool); + return (EIO); + } + if (ctl_ha_msg_register(CTL_HA_CHAN_CTL, ctl_isc_event_handler) + != CTL_HA_STATUS_SUCCESS) { + ctl_ha_msg_destroy(softc); + ctl_pool_free(softc->othersc_pool); + return (EIO); + } + return (0); +}; + +static int +ctl_ha_shutdown(void) +{ + struct ctl_softc *softc = control_softc; + struct ctl_port *port; + + ctl_ha_msg_shutdown(softc); + if (ctl_ha_msg_deregister(CTL_HA_CHAN_CTL) != CTL_HA_STATUS_SUCCESS) + return (EIO); + if (ctl_ha_msg_destroy(softc) != CTL_HA_STATUS_SUCCESS) + return (EIO); + ctl_pool_free(softc->othersc_pool); + while ((port = STAILQ_FIRST(&ha_frontend.port_list)) != NULL) { + ctl_port_deregister(port); + free(port->port_name, M_CTL); + free(port, M_CTL); + } + return (0); }; static void @@ -1782,7 +1827,6 @@ ctl_init(void) { struct make_dev_args args; struct ctl_softc *softc; - void *other_pool; int i, error; softc = control_softc = malloc(sizeof(*control_softc), M_DEVBUF, @@ -1855,15 +1899,6 @@ ctl_init(void) STAILQ_INIT(&softc->be_list); ctl_tpc_init(softc); - if (ctl_pool_create(softc, "othersc", CTL_POOL_ENTRIES_OTHER_SC, - &other_pool) != 0) - { - printf("ctl: can't allocate %d entry other SC pool, " - "exiting\n", CTL_POOL_ENTRIES_OTHER_SC); - return (ENOMEM); - } - softc->othersc_pool = other_pool; - if (worker_threads <= 0) worker_threads = max(1, mp_ncpus / 4); if (worker_threads > CTL_MAX_THREADS) @@ -1883,22 +1918,19 @@ ctl_init(void) &softc->ctl_proc, &thr->thread, 0, 0, "ctl", "work%d", i); if (error != 0) { printf("error creating CTL work thread!\n"); - ctl_pool_free(other_pool); return (error); } } error = kproc_kthread_add(ctl_lun_thread, softc, - &softc->ctl_proc, NULL, 0, 0, "ctl", "lun"); + &softc->ctl_proc, &softc->lun_thread, 0, 0, "ctl", "lun"); if (error != 0) { printf("error creating CTL lun thread!\n"); - ctl_pool_free(other_pool); return (error); } error = kproc_kthread_add(ctl_thresh_thread, softc, - &softc->ctl_proc, NULL, 0, 0, "ctl", "thresh"); + &softc->ctl_proc, &softc->thresh_thread, 0, 0, "ctl", "thresh"); if (error != 0) { printf("error creating CTL threshold thread!\n"); - ctl_pool_free(other_pool); return (error); } @@ -1907,58 +1939,54 @@ ctl_init(void) softc, 0, ctl_ha_role_sysctl, "I", "HA role for this head"); if (softc->is_single == 0) { - ctl_frontend_register(&ha_frontend); - if (ctl_ha_msg_init(softc) != CTL_HA_STATUS_SUCCESS) { - printf("ctl_init: ctl_ha_msg_init failed.\n"); + if (ctl_frontend_register(&ha_frontend) != 0) softc->is_single = 1; - } else - if (ctl_ha_msg_register(CTL_HA_CHAN_CTL, ctl_isc_event_handler) - != CTL_HA_STATUS_SUCCESS) { - printf("ctl_init: ctl_ha_msg_register failed.\n"); - softc->is_single = 1; - } } return (0); } -void +static int ctl_shutdown(void) { struct ctl_softc *softc = control_softc; - struct ctl_lun *lun, *next_lun; + int i; - if (softc->is_single == 0) { - ctl_ha_msg_shutdown(softc); - if (ctl_ha_msg_deregister(CTL_HA_CHAN_CTL) - != CTL_HA_STATUS_SUCCESS) - printf("%s: ctl_ha_msg_deregister failed.\n", __func__); - if (ctl_ha_msg_destroy(softc) != CTL_HA_STATUS_SUCCESS) - printf("%s: ctl_ha_msg_destroy failed.\n", __func__); + if (softc->is_single == 0) ctl_frontend_deregister(&ha_frontend); - } - - mtx_lock(&softc->ctl_lock); - - STAILQ_FOREACH_SAFE(lun, &softc->lun_list, links, next_lun) - ctl_free_lun(lun); - mtx_unlock(&softc->ctl_lock); + destroy_dev(softc->dev); -#if 0 - ctl_shutdown_thread(softc->work_thread); - mtx_destroy(&softc->queue_lock); -#endif + /* Shutdown CTL threads. */ + softc->shutdown = 1; + for (i = 0; i < worker_threads; i++) { + struct ctl_thread *thr = &softc->threads[i]; + while (thr->thread != NULL) { + wakeup(thr); + if (thr->thread != NULL) + pause("CTL thr shutdown", 1); + } + mtx_destroy(&thr->queue_lock); + } + while (softc->lun_thread != NULL) { + wakeup(&softc->pending_lun_queue); + if (softc->lun_thread != NULL) + pause("CTL thr shutdown", 1); + } + while (softc->thresh_thread != NULL) { + wakeup(softc->thresh_thread); + if (softc->thresh_thread != NULL) + pause("CTL thr shutdown", 1); + } ctl_tpc_shutdown(softc); uma_zdestroy(softc->io_zone); mtx_destroy(&softc->ctl_lock); - destroy_dev(softc->dev); - sysctl_ctx_free(&softc->sysctl_ctx); free(softc, M_DEVBUF); control_softc = NULL; + return (0); } static int @@ -1969,7 +1997,7 @@ ctl_module_event_handler(module_t mod, i case MOD_LOAD: return (ctl_init()); case MOD_UNLOAD: - return (EBUSY); + return (ctl_shutdown()); default: return (EOPNOTSUPP); } @@ -13268,7 +13296,7 @@ ctl_work_thread(void *arg) CTL_DEBUG_PRINT(("ctl_work_thread starting\n")); - for (;;) { + while (!softc->shutdown) { /* * We handle the queues in this order: * - ISC @@ -13318,6 +13346,8 @@ ctl_work_thread(void *arg) /* Sleep until we have something to do. */ mtx_sleep(thr, &thr->queue_lock, PDROP | PRIBIO, "-", 0); } + thr->thread = NULL; + kthread_exit(); } static void @@ -13328,7 +13358,7 @@ ctl_lun_thread(void *arg) CTL_DEBUG_PRINT(("ctl_lun_thread starting\n")); - for (;;) { + while (!softc->shutdown) { mtx_lock(&softc->ctl_lock); be_lun = STAILQ_FIRST(&softc->pending_lun_queue); if (be_lun != NULL) { @@ -13342,6 +13372,8 @@ ctl_lun_thread(void *arg) mtx_sleep(&softc->pending_lun_queue, &softc->ctl_lock, PDROP | PRIBIO, "-", 0); } + softc->lun_thread = NULL; + kthread_exit(); } static void @@ -13357,7 +13389,7 @@ ctl_thresh_thread(void *arg) CTL_DEBUG_PRINT(("ctl_thresh_thread starting\n")); - for (;;) { + while (!softc->shutdown) { mtx_lock(&softc->ctl_lock); STAILQ_FOREACH(lun, &softc->lun_list, links) { if ((lun->flags & CTL_LUN_DISABLED) || @@ -13442,9 +13474,11 @@ ctl_thresh_thread(void *arg) mtx_lock(&softc->ctl_lock); } } - mtx_unlock(&softc->ctl_lock); - pause("-", CTL_LBP_PERIOD * hz); + mtx_sleep(&softc->thresh_thread, &softc->ctl_lock, + PDROP | PRIBIO, "-", CTL_LBP_PERIOD * hz); } + softc->thresh_thread = NULL; + kthread_exit(); } static void Modified: stable/11/sys/cam/ctl/ctl_backend.c ============================================================================== --- stable/11/sys/cam/ctl/ctl_backend.c Tue Feb 7 01:44:18 2017 (r313367) +++ stable/11/sys/cam/ctl/ctl_backend.c Tue Feb 7 01:55:48 2017 (r313368) @@ -67,11 +67,10 @@ ctl_backend_register(struct ctl_backend_ { struct ctl_softc *softc = control_softc; struct ctl_backend_driver *be_tmp; + int error; + /* Sanity check, make sure this isn't a duplicate registration. */ mtx_lock(&softc->ctl_lock); - /* - * Sanity check, make sure this isn't a duplicate registration. - */ STAILQ_FOREACH(be_tmp, &softc->be_list, links) { if (strcmp(be_tmp->name, be->name) == 0) { mtx_unlock(&softc->ctl_lock); @@ -79,39 +78,24 @@ ctl_backend_register(struct ctl_backend_ } } mtx_unlock(&softc->ctl_lock); - - /* - * Call the backend's initialization routine. - */ - be->init(); - - mtx_lock(&softc->ctl_lock); - - STAILQ_INSERT_TAIL(&softc->be_list, be, links); - - softc->num_backends++; - - /* - * Don't want to increment the usage count for internal consumers, - * we won't be able to unload otherwise. - */ - /* XXX KDM find a substitute for this? */ -#if 0 - if ((be->flags & CTL_BE_FLAG_INTERNAL) == 0) - MOD_INC_USE_COUNT; -#endif - #ifdef CS_BE_CONFIG_MOVE_DONE_IS_NOT_USED be->config_move_done = ctl_config_move_done; #endif - /* XXX KDM fix this! */ be->num_luns = 0; -#if 0 - atomic_set(&be->num_luns, 0); -#endif - mtx_unlock(&softc->ctl_lock); + /* Call the backend's initialization routine. */ + if (be->init != NULL) { + if ((error = be->init()) != 0) { + printf("%s backend init error: %d\n", + be->name, error); + return (error); + } + } + mtx_lock(&softc->ctl_lock); + STAILQ_INSERT_TAIL(&softc->be_list, be, links); + softc->num_backends++; + mtx_unlock(&softc->ctl_lock); return (0); } @@ -119,30 +103,21 @@ int ctl_backend_deregister(struct ctl_backend_driver *be) { struct ctl_softc *softc = control_softc; + int error; - mtx_lock(&softc->ctl_lock); - -#if 0 - if (atomic_read(&be->num_luns) != 0) { -#endif - /* XXX KDM fix this! */ - if (be->num_luns != 0) { - mtx_unlock(&softc->ctl_lock); - return (-1); + /* Call the backend's shutdown routine. */ + if (be->shutdown != NULL) { + if ((error = be->shutdown()) != 0) { + printf("%s backend shutdown error: %d\n", + be->name, error); + return (error); + } } + mtx_lock(&softc->ctl_lock); STAILQ_REMOVE(&softc->be_list, be, ctl_backend_driver, links); - softc->num_backends--; - - /* XXX KDM find a substitute for this? */ -#if 0 - if ((be->flags & CTL_BE_FLAG_INTERNAL) == 0) - MOD_DEC_USE_COUNT; -#endif - mtx_unlock(&softc->ctl_lock); - return (0); } Modified: stable/11/sys/cam/ctl/ctl_backend.h ============================================================================== --- stable/11/sys/cam/ctl/ctl_backend.h Tue Feb 7 01:44:18 2017 (r313367) +++ stable/11/sys/cam/ctl/ctl_backend.h Tue Feb 7 01:55:48 2017 (r313368) @@ -55,12 +55,13 @@ typedef enum { { \ switch (type) { \ case MOD_LOAD: \ - ctl_backend_register( \ - (struct ctl_backend_driver *)data); \ + return (ctl_backend_register( \ + (struct ctl_backend_driver *)data)); \ break; \ case MOD_UNLOAD: \ - printf(#name " module unload - not possible for this module type\n"); \ - return EINVAL; \ + return (ctl_backend_deregister( \ + (struct ctl_backend_driver *)data)); \ + break; \ default: \ return EOPNOTSUPP; \ } \ @@ -179,10 +180,10 @@ struct ctl_be_lun { typedef enum { CTL_BE_FLAG_NONE = 0x00, /* no flags */ CTL_BE_FLAG_HAS_CONFIG = 0x01, /* can do config reads, writes */ - CTL_BE_FLAG_INTERNAL = 0x02 /* don't inc mod refcount */ } ctl_backend_flags; typedef int (*be_init_t)(void); +typedef int (*be_shutdown_t)(void); typedef int (*be_func_t)(union ctl_io *io); typedef void (*be_vfunc_t)(union ctl_io *io); typedef int (*be_ioctl_t)(struct cdev *dev, u_long cmd, caddr_t addr, int flag, @@ -194,6 +195,7 @@ struct ctl_backend_driver { char name[CTL_BE_NAME_LEN]; /* passed to CTL */ ctl_backend_flags flags; /* passed to CTL */ be_init_t init; /* passed to CTL */ + be_shutdown_t shutdown; /* passed to CTL */ be_func_t data_submit; /* passed to CTL */ be_func_t data_move_done; /* passed to CTL */ be_func_t config_read; /* passed to CTL */ Modified: stable/11/sys/cam/ctl/ctl_backend_block.c ============================================================================== --- stable/11/sys/cam/ctl/ctl_backend_block.c Tue Feb 7 01:44:18 2017 (r313367) +++ stable/11/sys/cam/ctl/ctl_backend_block.c Tue Feb 7 01:55:48 2017 (r313368) @@ -183,6 +183,7 @@ struct ctl_be_block_lun { */ struct ctl_be_block_softc { struct mtx lock; + uma_zone_t beio_zone; int num_luns; STAILQ_HEAD(, ctl_be_block_lun) lun_list; }; @@ -273,13 +274,15 @@ static int ctl_be_block_config_write(uni static int ctl_be_block_config_read(union ctl_io *io); static int ctl_be_block_lun_info(void *be_lun, struct sbuf *sb); static uint64_t ctl_be_block_lun_attr(void *be_lun, const char *attrname); -int ctl_be_block_init(void); +static int ctl_be_block_init(void); +static int ctl_be_block_shutdown(void); static struct ctl_backend_driver ctl_be_block_driver = { .name = "block", .flags = CTL_BE_FLAG_HAS_CONFIG, .init = ctl_be_block_init, + .shutdown = ctl_be_block_shutdown, .data_submit = ctl_be_block_submit, .data_move_done = ctl_be_block_move_done, .config_read = ctl_be_block_config_read, @@ -292,14 +295,12 @@ static struct ctl_backend_driver ctl_be_ MALLOC_DEFINE(M_CTLBLK, "ctlblk", "Memory used for CTL block backend"); CTL_BACKEND_DECLARE(cbb, ctl_be_block_driver); -static uma_zone_t beio_zone; - static struct ctl_be_block_io * ctl_alloc_beio(struct ctl_be_block_softc *softc) { struct ctl_be_block_io *beio; - beio = uma_zalloc(beio_zone, M_WAITOK | M_ZERO); + beio = uma_zalloc(softc->beio_zone, M_WAITOK | M_ZERO); beio->softc = softc; return (beio); } @@ -332,7 +333,7 @@ ctl_free_beio(struct ctl_be_block_io *be duplicate_free, beio->num_segs); } - uma_zfree(beio_zone, beio); + uma_zfree(beio->softc->beio_zone, beio); } static void @@ -2859,19 +2860,40 @@ ctl_be_block_lun_attr(void *be_lun, cons return (lun->getattr(lun, attrname)); } -int +static int ctl_be_block_init(void) { - struct ctl_be_block_softc *softc; - int retval; - - softc = &backend_block_softc; - retval = 0; + struct ctl_be_block_softc *softc = &backend_block_softc; mtx_init(&softc->lock, "ctlblock", NULL, MTX_DEF); - beio_zone = uma_zcreate("beio", sizeof(struct ctl_be_block_io), + softc->beio_zone = uma_zcreate("beio", sizeof(struct ctl_be_block_io), NULL, NULL, NULL, NULL, UMA_ALIGN_PTR, 0); STAILQ_INIT(&softc->lun_list); + return (0); +} - return (retval); + +static int +ctl_be_block_shutdown(void) +{ + struct ctl_be_block_softc *softc = &backend_block_softc; + struct ctl_be_block_lun *lun, *next_lun; + + mtx_lock(&softc->lock); + STAILQ_FOREACH_SAFE(lun, &softc->lun_list, links, next_lun) { + /* + * Drop our lock here. Since ctl_invalidate_lun() can call + * back into us, this could potentially lead to a recursive + * lock of the same mutex, which would cause a hang. + */ + mtx_unlock(&softc->lock); + ctl_disable_lun(&lun->cbe_lun); + ctl_invalidate_lun(&lun->cbe_lun); + mtx_lock(&softc->lock); + } + mtx_unlock(&softc->lock); + + uma_zdestroy(softc->beio_zone); + mtx_destroy(&softc->lock); + return (0); } Modified: stable/11/sys/cam/ctl/ctl_backend_ramdisk.c ============================================================================== --- stable/11/sys/cam/ctl/ctl_backend_ramdisk.c Tue Feb 7 01:44:18 2017 (r313367) +++ stable/11/sys/cam/ctl/ctl_backend_ramdisk.c Tue Feb 7 01:55:48 2017 (r313368) @@ -108,8 +108,8 @@ struct ctl_be_ramdisk_softc { static struct ctl_be_ramdisk_softc rd_softc; extern struct ctl_softc *control_softc; -int ctl_backend_ramdisk_init(void); -void ctl_backend_ramdisk_shutdown(void); +static int ctl_backend_ramdisk_init(void); +static int ctl_backend_ramdisk_shutdown(void); static int ctl_backend_ramdisk_move_done(union ctl_io *io); static int ctl_backend_ramdisk_submit(union ctl_io *io); static void ctl_backend_ramdisk_continue(union ctl_io *io); @@ -133,6 +133,7 @@ static struct ctl_backend_driver ctl_be_ .name = "ramdisk", .flags = CTL_BE_FLAG_HAS_CONFIG, .init = ctl_backend_ramdisk_init, + .shutdown = ctl_backend_ramdisk_shutdown, .data_submit = ctl_backend_ramdisk_submit, .data_move_done = ctl_backend_ramdisk_move_done, .config_read = ctl_backend_ramdisk_config_read, @@ -170,7 +171,7 @@ ctl_backend_ramdisk_init(void) return (0); } -void +static int ctl_backend_ramdisk_shutdown(void) { struct ctl_be_ramdisk_softc *softc = &rd_softc; @@ -192,20 +193,16 @@ ctl_backend_ramdisk_shutdown(void) mtx_lock(&softc->lock); } mtx_unlock(&softc->lock); - + #ifdef CTL_RAMDISK_PAGES for (i = 0; i < softc->num_pages; i++) free(softc->ramdisk_pages[i], M_RAMDISK); - free(softc->ramdisk_pages, M_RAMDISK); #else free(softc->ramdisk_buffer, M_RAMDISK); #endif - - if (ctl_backend_deregister(&ctl_be_ramdisk_driver) != 0) { - printf("ctl_backend_ramdisk_shutdown: " - "ctl_backend_deregister() failed!\n"); - } + mtx_destroy(&softc->lock); + return (0); } static int Modified: stable/11/sys/cam/ctl/ctl_frontend.c ============================================================================== --- stable/11/sys/cam/ctl/ctl_frontend.c Tue Feb 7 01:44:18 2017 (r313367) +++ stable/11/sys/cam/ctl/ctl_frontend.c Tue Feb 7 01:55:48 2017 (r313368) @@ -70,12 +70,11 @@ ctl_frontend_register(struct ctl_fronten { struct ctl_softc *softc = control_softc; struct ctl_frontend *fe_tmp; + int error; KASSERT(softc != NULL, ("CTL is not initialized")); - /* - * Sanity check, make sure this isn't a duplicate registration. - */ + /* Sanity check, make sure this isn't a duplicate registration. */ mtx_lock(&softc->ctl_lock); STAILQ_FOREACH(fe_tmp, &softc->fe_list, links) { if (strcmp(fe_tmp->name, fe->name) == 0) { @@ -86,11 +85,14 @@ ctl_frontend_register(struct ctl_fronten mtx_unlock(&softc->ctl_lock); STAILQ_INIT(&fe->port_list); - /* - * Call the frontend's initialization routine. - */ - if (fe->init != NULL) - fe->init(); + /* Call the frontend's initialization routine. */ + if (fe->init != NULL) { + if ((error = fe->init()) != 0) { + printf("%s frontend init error: %d\n", + fe->name, error); + return (error); + } + } mtx_lock(&softc->ctl_lock); softc->num_frontends++; @@ -103,20 +105,21 @@ int ctl_frontend_deregister(struct ctl_frontend *fe) { struct ctl_softc *softc = control_softc; + int error; - if (!STAILQ_EMPTY(&fe->port_list)) - return (-1); + /* Call the frontend's shutdown routine.*/ + if (fe->shutdown != NULL) { + if ((error = fe->shutdown()) != 0) { + printf("%s frontend shutdown error: %d\n", + fe->name, error); + return (error); + } + } mtx_lock(&softc->ctl_lock); STAILQ_REMOVE(&softc->fe_list, fe, ctl_frontend, links); softc->num_frontends--; mtx_unlock(&softc->ctl_lock); - - /* - * Call the frontend's shutdown routine. - */ - if (fe->shutdown != NULL) - fe->shutdown(); return (0); } Modified: stable/11/sys/cam/ctl/ctl_frontend.h ============================================================================== --- stable/11/sys/cam/ctl/ctl_frontend.h Tue Feb 7 01:44:18 2017 (r313367) +++ stable/11/sys/cam/ctl/ctl_frontend.h Tue Feb 7 01:55:48 2017 (r313368) @@ -49,7 +49,7 @@ typedef enum { } ctl_port_status; typedef int (*fe_init_t)(void); -typedef void (*fe_shutdown_t)(void); +typedef int (*fe_shutdown_t)(void); typedef void (*port_func_t)(void *onoff_arg); typedef int (*port_info_func_t)(void *onoff_arg, struct sbuf *sb); typedef int (*lun_func_t)(void *arg, int lun_id); @@ -61,12 +61,13 @@ typedef int (*fe_ioctl_t)(struct cdev *d { \ switch (type) { \ case MOD_LOAD: \ - ctl_frontend_register( \ - (struct ctl_frontend *)data); \ + return (ctl_frontend_register( \ + (struct ctl_frontend *)data)); \ break; \ case MOD_UNLOAD: \ - printf(#name " module unload - not possible for this module type\n"); \ - return EINVAL; \ + return (ctl_frontend_deregister( \ + (struct ctl_frontend *)data)); \ + break; \ default: \ return EOPNOTSUPP; \ } \ Modified: stable/11/sys/cam/ctl/ctl_frontend_cam_sim.c ============================================================================== --- stable/11/sys/cam/ctl/ctl_frontend_cam_sim.c Tue Feb 7 01:44:18 2017 (r313367) +++ stable/11/sys/cam/ctl/ctl_frontend_cam_sim.c Tue Feb 7 01:55:48 2017 (r313368) @@ -94,15 +94,14 @@ struct cfcs_softc { CAM_SNS_BUF_PHYS | CAM_CDB_PHYS | CAM_SENSE_PTR | \ CAM_SENSE_PHYS) -int cfcs_init(void); +static int cfcs_init(void); +static int cfcs_shutdown(void); static void cfcs_poll(struct cam_sim *sim); static void cfcs_online(void *arg); static void cfcs_offline(void *arg); static void cfcs_datamove(union ctl_io *io); static void cfcs_done(union ctl_io *io); void cfcs_action(struct cam_sim *sim, union ccb *ccb); -static void cfcs_async(void *callback_arg, uint32_t code, - struct cam_path *path, void *arg); struct cfcs_softc cfcs_softc; /* @@ -121,14 +120,14 @@ static struct ctl_frontend cfcs_frontend { .name = "camsim", .init = cfcs_init, + .shutdown = cfcs_shutdown, }; CTL_FRONTEND_DECLARE(ctlcfcs, cfcs_frontend); -int +static int cfcs_init(void) { struct cfcs_softc *softc; - struct ccb_setasync csa; struct ctl_port *port; int retval; @@ -214,13 +213,6 @@ cfcs_init(void) goto bailout; } - xpt_setup_ccb(&csa.ccb_h, softc->path, CAM_PRIORITY_NONE); - csa.ccb_h.func_code = XPT_SASYNC_CB; - csa.event_enable = AC_LOST_DEVICE; - csa.callback = cfcs_async; - csa.callback_arg = softc->sim; - xpt_action((union ccb *)&csa); - mtx_unlock(&softc->lock); return (retval); @@ -236,6 +228,27 @@ bailout: return (retval); } +static int +cfcs_shutdown(void) +{ + struct cfcs_softc *softc = &cfcs_softc; + struct ctl_port *port = &softc->port; + int error; + + ctl_port_offline(port); + + mtx_lock(&softc->lock); + xpt_free_path(softc->path); + xpt_bus_deregister(cam_sim_path(softc->sim)); + cam_sim_free(softc->sim, /*free_devq*/ TRUE); + mtx_unlock(&softc->lock); + mtx_destroy(&softc->lock); + + if ((error = ctl_port_deregister(port)) != 0) + printf("%s: cam_sim port deregistration failed\n", __func__); + return (error); +} + static void cfcs_poll(struct cam_sim *sim) { @@ -801,9 +814,3 @@ cfcs_action(struct cam_sim *sim, union c break; } } - -static void -cfcs_async(void *callback_arg, uint32_t code, struct cam_path *path, void *arg) -{ - -} Modified: stable/11/sys/cam/ctl/ctl_frontend_ioctl.c ============================================================================== --- stable/11/sys/cam/ctl/ctl_frontend_ioctl.c Tue Feb 7 01:44:18 2017 (r313367) +++ stable/11/sys/cam/ctl/ctl_frontend_ioctl.c Tue Feb 7 01:55:48 2017 (r313368) @@ -76,7 +76,7 @@ struct cfi_softc { static struct cfi_softc cfi_softc; static int cfi_init(void); -static void cfi_shutdown(void); +static int cfi_shutdown(void); static void cfi_datamove(union ctl_io *io); static void cfi_done(union ctl_io *io); @@ -93,6 +93,7 @@ cfi_init(void) { struct cfi_softc *isoftc = &cfi_softc; struct ctl_port *port; + int error = 0; memset(isoftc, 0, sizeof(*isoftc)); @@ -108,24 +109,25 @@ cfi_init(void) port->targ_port = -1; port->max_initiators = 1; - if (ctl_port_register(port) != 0) { + if ((error = ctl_port_register(port)) != 0) { printf("%s: ioctl port registration failed\n", __func__); - return (0); + return (error); } ctl_port_online(port); return (0); } -void +static int cfi_shutdown(void) { struct cfi_softc *isoftc = &cfi_softc; - struct ctl_port *port; + struct ctl_port *port = &isoftc->port; + int error = 0; - port = &isoftc->port; ctl_port_offline(port); - if (ctl_port_deregister(&isoftc->port) != 0) - printf("%s: ctl_frontend_deregister() failed\n", __func__); + if ((error = ctl_port_deregister(port)) != 0) + printf("%s: ioctl port deregistration failed\n", __func__); + return (error); } /* Modified: stable/11/sys/cam/ctl/ctl_frontend_iscsi.c ============================================================================== --- stable/11/sys/cam/ctl/ctl_frontend_iscsi.c Tue Feb 7 01:44:18 2017 (r313367) +++ stable/11/sys/cam/ctl/ctl_frontend_iscsi.c Tue Feb 7 01:55:48 2017 (r313368) @@ -144,7 +144,8 @@ SYSCTL_INT(_kern_cam_ctl_iscsi, OID_AUTO #define PDU_TOTAL_TRANSFER_LEN(X) (X)->ip_prv1 #define PDU_R2TSN(X) (X)->ip_prv2 -int cfiscsi_init(void); +static int cfiscsi_init(void); +static int cfiscsi_shutdown(void); static void cfiscsi_online(void *arg); static void cfiscsi_offline(void *arg); static int cfiscsi_info(void *arg, struct sbuf *sb); @@ -182,6 +183,7 @@ static struct ctl_frontend cfiscsi_front .name = "iscsi", .init = cfiscsi_init, .ioctl = cfiscsi_ioctl, + .shutdown = cfiscsi_shutdown, }; CTL_FRONTEND_DECLARE(ctlcfiscsi, cfiscsi_frontend); MODULE_DEPEND(ctlcfiscsi, icl, 1, 1, 1); @@ -1321,7 +1323,7 @@ cfiscsi_session_delete(struct cfiscsi_se free(cs, M_CFISCSI); } -int +static int cfiscsi_init(void) { struct cfiscsi_softc *softc; @@ -1344,6 +1346,23 @@ cfiscsi_init(void) return (0); } +static int +cfiscsi_shutdown(void) +{ + struct cfiscsi_softc *softc = &cfiscsi_softc; + + if (!TAILQ_EMPTY(&softc->sessions) || !TAILQ_EMPTY(&softc->targets)) + return (EBUSY); + + uma_zdestroy(cfiscsi_data_wait_zone); +#ifdef ICL_KERNEL_PROXY + cv_destroy(&softc->accept_cv); +#endif + cv_destroy(&softc->sessions_cv); + mtx_destroy(&softc->lock); + return (0); +} + #ifdef ICL_KERNEL_PROXY static void cfiscsi_accept(struct socket *so, struct sockaddr *sa, int portal_id) Modified: stable/11/sys/cam/ctl/ctl_private.h ============================================================================== --- stable/11/sys/cam/ctl/ctl_private.h Tue Feb 7 01:44:18 2017 (r313367) +++ stable/11/sys/cam/ctl/ctl_private.h Tue Feb 7 01:55:48 2017 (r313368) @@ -470,7 +470,10 @@ struct ctl_softc { STAILQ_HEAD(, ctl_backend_driver) be_list; struct uma_zone *io_zone; uint32_t cur_pool_id; + int shutdown; struct ctl_thread threads[CTL_MAX_THREADS]; + struct thread *lun_thread; + struct thread *thresh_thread; TAILQ_HEAD(tpc_tokens, tpc_token) tpc_tokens; struct callout tpc_timeout; struct mtx tpc_lock; Modified: stable/11/sys/cam/ctl/ctl_tpc_local.c ============================================================================== --- stable/11/sys/cam/ctl/ctl_tpc_local.c Tue Feb 7 01:44:18 2017 (r313367) +++ stable/11/sys/cam/ctl/ctl_tpc_local.c Tue Feb 7 01:55:48 2017 (r313368) @@ -65,7 +65,7 @@ struct tpcl_softc { static struct tpcl_softc tpcl_softc; static int tpcl_init(void); -static void tpcl_shutdown(void); +static int tpcl_shutdown(void); static void tpcl_datamove(union ctl_io *io); static void tpcl_done(union ctl_io *io); @@ -84,7 +84,7 @@ tpcl_init(void) struct tpcl_softc *tsoftc = &tpcl_softc; struct ctl_port *port; struct scsi_transportid_spi *tid; - int len; + int error, len; memset(tsoftc, 0, sizeof(*tsoftc)); @@ -100,9 +100,9 @@ tpcl_init(void) port->targ_port = -1; port->max_initiators = 1; - if (ctl_port_register(port) != 0) { - printf("%s: ctl_port_register() failed with error\n", __func__); - return (0); + if ((error = ctl_port_register(port)) != 0) { + printf("%s: tpc port registration failed\n", __func__); + return (error); } len = sizeof(struct scsi_transportid_spi); @@ -118,16 +118,17 @@ tpcl_init(void) return (0); } -void +static int tpcl_shutdown(void) { struct tpcl_softc *tsoftc = &tpcl_softc; - struct ctl_port *port; + struct ctl_port *port = &tsoftc->port; + int error; - port = &tsoftc->port; ctl_port_offline(port); - if (ctl_port_deregister(&tsoftc->port) != 0) - printf("%s: ctl_frontend_deregister() failed\n", __func__); + if ((error = ctl_port_deregister(port)) != 0) + printf("%s: tpc port deregistration failed\n", __func__); + return (error); } static void Modified: stable/11/sys/cam/ctl/scsi_ctl.c ============================================================================== --- stable/11/sys/cam/ctl/scsi_ctl.c Tue Feb 7 01:44:18 2017 (r313367) +++ stable/11/sys/cam/ctl/scsi_ctl.c Tue Feb 7 01:55:48 2017 (r313368) @@ -188,8 +188,8 @@ MALLOC_DEFINE(M_CTLFE, "CAM CTL FE", "CA #define PRIV_CCB(io) ((io)->io_hdr.ctl_private[CTL_PRIV_FRONTEND].ptrs[0]) #define PRIV_INFO(io) ((io)->io_hdr.ctl_private[CTL_PRIV_FRONTEND].ptrs[1]) -int ctlfeinitialize(void); -void ctlfeshutdown(void); +static int ctlfeinitialize(void); +static int ctlfeshutdown(void); static periph_init_t ctlfeperiphinit; static void ctlfeasync(void *callback_arg, uint32_t code, struct cam_path *path, void *arg); @@ -227,13 +227,15 @@ static struct ctl_frontend ctlfe_fronten }; CTL_FRONTEND_DECLARE(ctlfe, ctlfe_frontend); -void +static int ctlfeshutdown(void) { - return; + + /* CAM does not support periph driver unregister now. */ + return (EBUSY); } -int +static int ctlfeinitialize(void) { @@ -243,7 +245,7 @@ ctlfeinitialize(void) return (0); } -void +static void ctlfeperiphinit(void) { cam_status status; From owner-svn-src-stable-11@freebsd.org Tue Feb 7 01:57:30 2017 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 94386CD3A33; Tue, 7 Feb 2017 01:57:30 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 30CEC8DE; Tue, 7 Feb 2017 01:57:30 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v171vTkh099793; Tue, 7 Feb 2017 01:57:29 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v171vTtb099791; Tue, 7 Feb 2017 01:57:29 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201702070157.v171vTtb099791@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Tue, 7 Feb 2017 01:57:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r313370 - in stable/11: sys/cam/ctl usr.sbin/ctladm X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Feb 2017 01:57:30 -0000 Author: mav Date: Tue Feb 7 01:57:29 2017 New Revision: 313370 URL: https://svnweb.freebsd.org/changeset/base/313370 Log: MFC r312694: Make CTL ramdisk backend a real RAM disk. If "capacity" LU option is set, ramdisk backend now implements featured thin provisioned disk, storing data in malloc(9) allocated memory blocks of pblocksize bytes (default PAGE_SIZE or 4KB). Additionally ~0.2% of LU size is used for indirection tree (bigger pblocksize reduce the overhead). Backend supports all unmap and anchor operations. If configured capacity is overflowed, proper error conditions are reported. If "capacity" LU option is not set, the backend operates mostly the same as before without allocating real storage: writes go to nowhere, reads return zeroes, reporting that all LBAs are unmapped. This backend is still mostly oriented on testing and benchmarking (it is still a volatile RAM disk), but now it should allow to run real FS tests, not only simple dumb dd. Modified: stable/11/sys/cam/ctl/ctl_backend_ramdisk.c stable/11/usr.sbin/ctladm/ctladm.8 Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/cam/ctl/ctl_backend_ramdisk.c ============================================================================== --- stable/11/sys/cam/ctl/ctl_backend_ramdisk.c Tue Feb 7 01:56:26 2017 (r313369) +++ stable/11/sys/cam/ctl/ctl_backend_ramdisk.c Tue Feb 7 01:57:29 2017 (r313370) @@ -1,7 +1,7 @@ /*- * Copyright (c) 2003, 2008 Silicon Graphics International Corp. * Copyright (c) 2012 The FreeBSD Foundation - * Copyright (c) 2014-2015 Alexander Motin + * Copyright (c) 2014-2017 Alexander Motin * All rights reserved. * * Portions of this software were developed by Edward Tomasz Napierala @@ -35,7 +35,7 @@ * $Id: //depot/users/kenm/FreeBSD-test2/sys/cam/ctl/ctl_backend_ramdisk.c#3 $ */ /* - * CAM Target Layer backend for a "fake" ramdisk. + * CAM Target Layer black hole and RAM disk backend. * * Author: Ken Merry */ @@ -48,9 +48,11 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include +#include #include #include #include @@ -71,6 +73,29 @@ __FBSDID("$FreeBSD$"); #include #include +#define PRIV(io) \ + ((struct ctl_ptr_len_flags *)&(io)->io_hdr.ctl_private[CTL_PRIV_BACKEND]) +#define ARGS(io) \ + ((struct ctl_lba_len_flags *)&(io)->io_hdr.ctl_private[CTL_PRIV_LBA_LEN]) + +#define PPP (PAGE_SIZE / sizeof(uint8_t **)) +#ifdef __LP64__ +#define PPPS (PAGE_SHIFT - 3) +#else +#define PPPS (PAGE_SHIFT - 2) +#endif +#define SGPP (PAGE_SIZE / sizeof(struct ctl_sg_entry)) + +#define P_UNMAPPED NULL /* Page is unmapped. */ +#define P_ANCHORED ((void *)(uintptr_t)1) /* Page is anchored. */ + +typedef enum { + GP_READ, /* Return data page or zero page. */ + GP_WRITE, /* Return data page, try allocate if none. */ + GP_ANCHOR, /* Return data page, try anchor if none. */ + GP_OTHER, /* Return what present, do not allocate/anchor. */ +} getpage_op_t; + typedef enum { CTL_BE_RAMDISK_LUN_UNCONFIGURED = 0x01, CTL_BE_RAMDISK_LUN_CONFIG_ERR = 0x02, @@ -79,28 +104,29 @@ typedef enum { struct ctl_be_ramdisk_lun { struct ctl_lun_create_params params; - char lunname[32]; - uint64_t size_bytes; - uint64_t size_blocks; + char lunname[32]; + int indir; + uint8_t **pages; + uint8_t *zero_page; + struct sx page_lock; + u_int pblocksize; + u_int pblockmul; + uint64_t size_bytes; + uint64_t size_blocks; + uint64_t cap_bytes; + uint64_t cap_used; struct ctl_be_ramdisk_softc *softc; ctl_be_ramdisk_lun_flags flags; STAILQ_ENTRY(ctl_be_ramdisk_lun) links; - struct ctl_be_lun cbe_lun; - struct taskqueue *io_taskqueue; - struct task io_task; + struct ctl_be_lun cbe_lun; + struct taskqueue *io_taskqueue; + struct task io_task; STAILQ_HEAD(, ctl_io_hdr) cont_queue; - struct mtx_padalign queue_lock; + struct mtx_padalign queue_lock; }; struct ctl_be_ramdisk_softc { struct mtx lock; - int rd_size; -#ifdef CTL_RAMDISK_PAGES - uint8_t **ramdisk_pages; - int num_pages; -#else - uint8_t *ramdisk_buffer; -#endif int num_luns; STAILQ_HEAD(, ctl_be_ramdisk_lun) lun_list; }; @@ -111,8 +137,13 @@ extern struct ctl_softc *control_softc; static int ctl_backend_ramdisk_init(void); static int ctl_backend_ramdisk_shutdown(void); static int ctl_backend_ramdisk_move_done(union ctl_io *io); +static void ctl_backend_ramdisk_compare(union ctl_io *io); +static void ctl_backend_ramdisk_rw(union ctl_io *io); static int ctl_backend_ramdisk_submit(union ctl_io *io); -static void ctl_backend_ramdisk_continue(union ctl_io *io); +static void ctl_backend_ramdisk_worker(void *context, int pending); +static int ctl_backend_ramdisk_config_read(union ctl_io *io); +static int ctl_backend_ramdisk_config_write(union ctl_io *io); +static uint64_t ctl_backend_ramdisk_lun_attr(void *be_lun, const char *attrname); static int ctl_backend_ramdisk_ioctl(struct cdev *dev, u_long cmd, caddr_t addr, int flag, struct thread *td); static int ctl_backend_ramdisk_rm(struct ctl_be_ramdisk_softc *softc, @@ -121,12 +152,9 @@ static int ctl_backend_ramdisk_create(st struct ctl_lun_req *req); static int ctl_backend_ramdisk_modify(struct ctl_be_ramdisk_softc *softc, struct ctl_lun_req *req); -static void ctl_backend_ramdisk_worker(void *context, int pending); static void ctl_backend_ramdisk_lun_shutdown(void *be_lun); static void ctl_backend_ramdisk_lun_config_status(void *be_lun, ctl_lun_config_status status); -static int ctl_backend_ramdisk_config_write(union ctl_io *io); -static int ctl_backend_ramdisk_config_read(union ctl_io *io); static struct ctl_backend_driver ctl_be_ramdisk_driver = { @@ -138,36 +166,21 @@ static struct ctl_backend_driver ctl_be_ .data_move_done = ctl_backend_ramdisk_move_done, .config_read = ctl_backend_ramdisk_config_read, .config_write = ctl_backend_ramdisk_config_write, - .ioctl = ctl_backend_ramdisk_ioctl + .ioctl = ctl_backend_ramdisk_ioctl, + .lun_attr = ctl_backend_ramdisk_lun_attr, }; MALLOC_DEFINE(M_RAMDISK, "ramdisk", "Memory used for CTL RAMdisk"); CTL_BACKEND_DECLARE(cbr, ctl_be_ramdisk_driver); -int +static int ctl_backend_ramdisk_init(void) { struct ctl_be_ramdisk_softc *softc = &rd_softc; -#ifdef CTL_RAMDISK_PAGES - int i; -#endif memset(softc, 0, sizeof(*softc)); mtx_init(&softc->lock, "ctlramdisk", NULL, MTX_DEF); STAILQ_INIT(&softc->lun_list); - softc->rd_size = 1024 * 1024; -#ifdef CTL_RAMDISK_PAGES - softc->num_pages = softc->rd_size / PAGE_SIZE; - softc->ramdisk_pages = (uint8_t **)malloc(sizeof(uint8_t *) * - softc->num_pages, M_RAMDISK, - M_WAITOK); - for (i = 0; i < softc->num_pages; i++) - softc->ramdisk_pages[i] = malloc(PAGE_SIZE, M_RAMDISK,M_WAITOK); -#else - softc->ramdisk_buffer = (uint8_t *)malloc(softc->rd_size, M_RAMDISK, - M_WAITOK); -#endif - return (0); } @@ -176,9 +189,6 @@ ctl_backend_ramdisk_shutdown(void) { struct ctl_be_ramdisk_softc *softc = &rd_softc; struct ctl_be_ramdisk_lun *lun, *next_lun; -#ifdef CTL_RAMDISK_PAGES - int i; -#endif mtx_lock(&softc->lock); STAILQ_FOREACH_SAFE(lun, &softc->lun_list, links, next_lun) { @@ -193,30 +203,210 @@ ctl_backend_ramdisk_shutdown(void) mtx_lock(&softc->lock); } mtx_unlock(&softc->lock); - -#ifdef CTL_RAMDISK_PAGES - for (i = 0; i < softc->num_pages; i++) - free(softc->ramdisk_pages[i], M_RAMDISK); - free(softc->ramdisk_pages, M_RAMDISK); -#else - free(softc->ramdisk_buffer, M_RAMDISK); -#endif mtx_destroy(&softc->lock); return (0); } +static uint8_t * +ctl_backend_ramdisk_getpage(struct ctl_be_ramdisk_lun *be_lun, off_t pn, + getpage_op_t op) +{ + uint8_t **p, ***pp; + off_t i; + int s; + + if (be_lun->cap_bytes == 0) { + switch (op) { + case GP_READ: + return (be_lun->zero_page); + case GP_WRITE: + return ((uint8_t *)be_lun->pages); + case GP_ANCHOR: + return (P_ANCHORED); + default: + return (P_UNMAPPED); + } + } + if (op == GP_WRITE || op == GP_ANCHOR) { + sx_xlock(&be_lun->page_lock); + pp = &be_lun->pages; + for (s = (be_lun->indir - 1) * PPPS; s >= 0; s -= PPPS) { + if (*pp == NULL) { + *pp = malloc(PAGE_SIZE, M_RAMDISK, + M_WAITOK|M_ZERO); + } + i = pn >> s; + pp = (uint8_t ***)&(*pp)[i]; + pn -= i << s; + } + if (*pp == P_UNMAPPED && be_lun->cap_used < be_lun->cap_bytes) { + if (op == GP_WRITE) { + *pp = malloc(be_lun->pblocksize, M_RAMDISK, + M_WAITOK|M_ZERO); + } else + *pp = P_ANCHORED; + be_lun->cap_used += be_lun->pblocksize; + } else if (*pp == P_ANCHORED && op == GP_WRITE) { + *pp = malloc(be_lun->pblocksize, M_RAMDISK, + M_WAITOK|M_ZERO); + } + sx_xunlock(&be_lun->page_lock); + return ((uint8_t *)*pp); + } else { + sx_slock(&be_lun->page_lock); + p = be_lun->pages; + for (s = (be_lun->indir - 1) * PPPS; s >= 0; s -= PPPS) { + if (p == NULL) + break; + i = pn >> s; + p = (uint8_t **)p[i]; + pn -= i << s; + } + sx_sunlock(&be_lun->page_lock); + if ((p == P_UNMAPPED || p == P_ANCHORED) && op == GP_READ) + return (be_lun->zero_page); + return ((uint8_t *)p); + } +}; + +static void +ctl_backend_ramdisk_unmappage(struct ctl_be_ramdisk_lun *be_lun, off_t pn) +{ + uint8_t ***pp; + off_t i; + int s; + + if (be_lun->cap_bytes == 0) + return; + sx_xlock(&be_lun->page_lock); + pp = &be_lun->pages; + for (s = (be_lun->indir - 1) * PPPS; s >= 0; s -= PPPS) { + if (*pp == NULL) + goto noindir; + i = pn >> s; + pp = (uint8_t ***)&(*pp)[i]; + pn -= i << s; + } + if (*pp == P_ANCHORED) { + be_lun->cap_used -= be_lun->pblocksize; + *pp = P_UNMAPPED; + } else if (*pp != P_UNMAPPED) { + free(*pp, M_RAMDISK); + be_lun->cap_used -= be_lun->pblocksize; + *pp = P_UNMAPPED; + } +noindir: + sx_xunlock(&be_lun->page_lock); +}; + +static void +ctl_backend_ramdisk_anchorpage(struct ctl_be_ramdisk_lun *be_lun, off_t pn) +{ + uint8_t ***pp; + off_t i; + int s; + + if (be_lun->cap_bytes == 0) + return; + sx_xlock(&be_lun->page_lock); + pp = &be_lun->pages; + for (s = (be_lun->indir - 1) * PPPS; s >= 0; s -= PPPS) { + if (*pp == NULL) + goto noindir; + i = pn >> s; + pp = (uint8_t ***)&(*pp)[i]; + pn -= i << s; + } + if (*pp == P_UNMAPPED && be_lun->cap_used < be_lun->cap_bytes) { + be_lun->cap_used += be_lun->pblocksize; + *pp = P_ANCHORED; + } else if (*pp != P_ANCHORED) { + free(*pp, M_RAMDISK); + *pp = P_ANCHORED; + } +noindir: + sx_xunlock(&be_lun->page_lock); +}; + +static void +ctl_backend_ramdisk_freeallpages(uint8_t **p, int indir) +{ + int i; + + if (p == NULL) + return; + if (indir == 0) { + free(p, M_RAMDISK); + return; + } + for (i = 0; i < PPP; i++) { + if (p[i] == NULL) + continue; + ctl_backend_ramdisk_freeallpages((uint8_t **)p[i], indir - 1); + } + free(p, M_RAMDISK); +}; + +static size_t +cmp(uint8_t *a, uint8_t *b, size_t size) +{ + size_t i; + + for (i = 0; i < size; i++) { + if (a[i] != b[i]) + break; + } + return (i); +} + +static int +ctl_backend_ramdisk_cmp(union ctl_io *io) +{ + struct ctl_be_lun *cbe_lun = CTL_BACKEND_LUN(io); + struct ctl_be_ramdisk_lun *be_lun = cbe_lun->be_lun; + uint8_t *page; + uint8_t info[8]; + uint64_t lba; + u_int lbaoff, lbas, res, off; + + lbas = io->scsiio.kern_data_len / cbe_lun->blocksize; + lba = ARGS(io)->lba + PRIV(io)->len - lbas; + off = 0; + for (; lbas > 0; lbas--, lba++) { + page = ctl_backend_ramdisk_getpage(be_lun, + lba >> cbe_lun->pblockexp, GP_READ); + lbaoff = lba & ~(UINT_MAX << cbe_lun->pblockexp); + page += lbaoff * cbe_lun->blocksize; + res = cmp(io->scsiio.kern_data_ptr + off, page, + cbe_lun->blocksize); + off += res; + if (res < cbe_lun->blocksize) + break; + } + if (lbas > 0) { + off += io->scsiio.kern_rel_offset - io->scsiio.kern_data_len; + scsi_u64to8b(off, info); + ctl_set_sense(&io->scsiio, /*current_error*/ 1, + /*sense_key*/ SSD_KEY_MISCOMPARE, + /*asc*/ 0x1D, /*ascq*/ 0x00, + /*type*/ SSD_ELEM_INFO, + /*size*/ sizeof(info), /*data*/ &info, + /*type*/ SSD_ELEM_NONE); + return (1); + } + return (0); +} + static int ctl_backend_ramdisk_move_done(union ctl_io *io) { - struct ctl_be_lun *cbe_lun; - struct ctl_be_ramdisk_lun *be_lun; + struct ctl_be_lun *cbe_lun = CTL_BACKEND_LUN(io); + struct ctl_be_ramdisk_lun *be_lun = cbe_lun->be_lun; #ifdef CTL_TIME_IO struct bintime cur_bt; #endif CTL_DEBUG_PRINT(("ctl_backend_ramdisk_move_done\n")); - cbe_lun = CTL_BACKEND_LUN(io); - be_lun = (struct ctl_be_ramdisk_lun *)cbe_lun->be_lun; #ifdef CTL_TIME_IO getbinuptime(&cur_bt); bintime_sub(&cur_bt, &io->io_hdr.dma_start_bt); @@ -240,7 +430,12 @@ ctl_backend_ramdisk_move_done(union ctl_ ctl_set_invalid_field_ciu(&io->scsiio); } else if ((io->io_hdr.port_status == 0) && ((io->io_hdr.status & CTL_STATUS_MASK) == CTL_STATUS_NONE)) { - if (io->io_hdr.ctl_private[CTL_PRIV_BACKEND].integer > 0) { + if (ARGS(io)->flags & CTL_LLF_COMPARE) { + /* We have data block ready for comparison. */ + if (ctl_backend_ramdisk_cmp(io)) + goto done; + } + if (ARGS(io)->len > PRIV(io)->len) { mtx_lock(&be_lun->queue_lock); STAILQ_INSERT_TAIL(&be_lun->cont_queue, &io->io_hdr, links); @@ -251,75 +446,109 @@ ctl_backend_ramdisk_move_done(union ctl_ } ctl_set_success(&io->scsiio); } +done: ctl_data_submit_done(io); return(0); } -static int -ctl_backend_ramdisk_submit(union ctl_io *io) +static void +ctl_backend_ramdisk_compare(union ctl_io *io) { - struct ctl_be_lun *cbe_lun; - struct ctl_lba_len_flags *lbalen; + struct ctl_be_lun *cbe_lun = CTL_BACKEND_LUN(io); + u_int lbas, len; - cbe_lun = CTL_BACKEND_LUN(io); - lbalen = (struct ctl_lba_len_flags *)&io->io_hdr.ctl_private[CTL_PRIV_LBA_LEN]; - if (lbalen->flags & CTL_LLF_VERIFY) { - ctl_set_success(&io->scsiio); - ctl_data_submit_done(io); - return (CTL_RETVAL_COMPLETE); - } - io->io_hdr.ctl_private[CTL_PRIV_BACKEND].integer = - lbalen->len * cbe_lun->blocksize; - ctl_backend_ramdisk_continue(io); - return (CTL_RETVAL_COMPLETE); + lbas = ARGS(io)->len - PRIV(io)->len; + lbas = MIN(lbas, 131072 / cbe_lun->blocksize); + len = lbas * cbe_lun->blocksize; + + io->scsiio.be_move_done = ctl_backend_ramdisk_move_done; + io->scsiio.kern_data_ptr = malloc(len, M_RAMDISK, M_WAITOK); + io->scsiio.kern_data_len = len; + io->scsiio.kern_sg_entries = 0; + io->io_hdr.flags |= CTL_FLAG_ALLOCATED; + PRIV(io)->len += lbas; +#ifdef CTL_TIME_IO + getbinuptime(&io->io_hdr.dma_start_bt); +#endif + ctl_datamove(io); } static void -ctl_backend_ramdisk_continue(union ctl_io *io) +ctl_backend_ramdisk_rw(union ctl_io *io) { - struct ctl_be_ramdisk_softc *softc; - int len, len_filled, sg_filled; -#ifdef CTL_RAMDISK_PAGES + struct ctl_be_lun *cbe_lun = CTL_BACKEND_LUN(io); + struct ctl_be_ramdisk_lun *be_lun = cbe_lun->be_lun; struct ctl_sg_entry *sg_entries; - int i; -#endif - - softc = &rd_softc; - len = io->io_hdr.ctl_private[CTL_PRIV_BACKEND].integer; -#ifdef CTL_RAMDISK_PAGES - sg_filled = min(btoc(len), softc->num_pages); - if (sg_filled > 1) { + uint8_t *page; + uint64_t lba; + u_int i, len, lbaoff, lbas, sgs, off; + getpage_op_t op; + + lba = ARGS(io)->lba + PRIV(io)->len; + lbaoff = lba & ~(UINT_MAX << cbe_lun->pblockexp); + lbas = ARGS(io)->len - PRIV(io)->len; + lbas = MIN(lbas, (SGPP << cbe_lun->pblockexp) - lbaoff); + sgs = (lbas + lbaoff + be_lun->pblockmul - 1) >> cbe_lun->pblockexp; + off = lbaoff * cbe_lun->blocksize; + op = (ARGS(io)->flags & CTL_LLF_WRITE) ? GP_WRITE : GP_READ; + if (sgs > 1) { io->scsiio.kern_data_ptr = malloc(sizeof(struct ctl_sg_entry) * - sg_filled, M_RAMDISK, - M_WAITOK); + sgs, M_RAMDISK, M_WAITOK); sg_entries = (struct ctl_sg_entry *)io->scsiio.kern_data_ptr; - for (i = 0, len_filled = 0; i < sg_filled; i++) { - sg_entries[i].addr = softc->ramdisk_pages[i]; - sg_entries[i].len = MIN(PAGE_SIZE, len - len_filled); - len_filled += sg_entries[i].len; + len = lbas * cbe_lun->blocksize; + for (i = 0; i < sgs; i++) { + page = ctl_backend_ramdisk_getpage(be_lun, + (lba >> cbe_lun->pblockexp) + i, op); + if (page == P_UNMAPPED || page == P_ANCHORED) { + free(io->scsiio.kern_data_ptr, M_RAMDISK); +nospc: + ctl_set_space_alloc_fail(&io->scsiio); + ctl_data_submit_done(io); + return; + } + sg_entries[i].addr = page + off; + sg_entries[i].len = MIN(len, be_lun->pblocksize - off); + len -= sg_entries[i].len; + off = 0; } } else { - sg_filled = 0; - len_filled = len; - io->scsiio.kern_data_ptr = softc->ramdisk_pages[0]; + page = ctl_backend_ramdisk_getpage(be_lun, + lba >> cbe_lun->pblockexp, op); + if (page == P_UNMAPPED || page == P_ANCHORED) + goto nospc; + sgs = 0; + io->scsiio.kern_data_ptr = page + off; } -#else - sg_filled = 0; - len_filled = min(len, softc->rd_size); - io->scsiio.kern_data_ptr = softc->ramdisk_buffer; -#endif /* CTL_RAMDISK_PAGES */ io->scsiio.be_move_done = ctl_backend_ramdisk_move_done; - io->scsiio.kern_data_len = len_filled; - io->scsiio.kern_sg_entries = sg_filled; + io->scsiio.kern_data_len = lbas * cbe_lun->blocksize; + io->scsiio.kern_sg_entries = sgs; io->io_hdr.flags |= CTL_FLAG_ALLOCATED; - io->io_hdr.ctl_private[CTL_PRIV_BACKEND].integer -= len_filled; + PRIV(io)->len += lbas; #ifdef CTL_TIME_IO getbinuptime(&io->io_hdr.dma_start_bt); #endif ctl_datamove(io); } +static int +ctl_backend_ramdisk_submit(union ctl_io *io) +{ + struct ctl_lba_len_flags *lbalen = ARGS(io); + + if (lbalen->flags & CTL_LLF_VERIFY) { + ctl_set_success(&io->scsiio); + ctl_data_submit_done(io); + return (CTL_RETVAL_COMPLETE); + } + PRIV(io)->len = 0; + if (lbalen->flags & CTL_LLF_COMPARE) + ctl_backend_ramdisk_compare(io); + else + ctl_backend_ramdisk_rw(io); + return (CTL_RETVAL_COMPLETE); +} + static void ctl_backend_ramdisk_worker(void *context, int pending) { @@ -327,7 +556,6 @@ ctl_backend_ramdisk_worker(void *context union ctl_io *io; be_lun = (struct ctl_be_ramdisk_lun *)context; - mtx_lock(&be_lun->queue_lock); for (;;) { io = (union ctl_io *)STAILQ_FIRST(&be_lun->cont_queue); @@ -335,7 +563,10 @@ ctl_backend_ramdisk_worker(void *context STAILQ_REMOVE(&be_lun->cont_queue, &io->io_hdr, ctl_io_hdr, links); mtx_unlock(&be_lun->queue_lock); - ctl_backend_ramdisk_continue(io); + if (ARGS(io)->flags & CTL_LLF_COMPARE) + ctl_backend_ramdisk_compare(io); + else + ctl_backend_ramdisk_rw(io); mtx_lock(&be_lun->queue_lock); continue; } @@ -350,6 +581,259 @@ ctl_backend_ramdisk_worker(void *context } static int +ctl_backend_ramdisk_gls(union ctl_io *io) +{ + struct ctl_be_lun *cbe_lun = CTL_BACKEND_LUN(io); + struct ctl_be_ramdisk_lun *be_lun = cbe_lun->be_lun; + struct scsi_get_lba_status_data *data; + uint8_t *page; + u_int lbaoff; + + data = (struct scsi_get_lba_status_data *)io->scsiio.kern_data_ptr; + scsi_u64to8b(ARGS(io)->lba, data->descr[0].addr); + lbaoff = ARGS(io)->lba & ~(UINT_MAX << cbe_lun->pblockexp); + scsi_ulto4b(be_lun->pblockmul - lbaoff, data->descr[0].length); + page = ctl_backend_ramdisk_getpage(be_lun, + ARGS(io)->lba >> cbe_lun->pblockexp, GP_OTHER); + if (page == P_UNMAPPED) + data->descr[0].status = 1; + else if (page == P_ANCHORED) + data->descr[0].status = 2; + else + data->descr[0].status = 0; + ctl_config_read_done(io); + return (CTL_RETVAL_COMPLETE); +} + +static int +ctl_backend_ramdisk_config_read(union ctl_io *io) +{ + int retval = 0; + + switch (io->scsiio.cdb[0]) { + case SERVICE_ACTION_IN: + if (io->scsiio.cdb[1] == SGLS_SERVICE_ACTION) { + retval = ctl_backend_ramdisk_gls(io); + break; + } + ctl_set_invalid_field(&io->scsiio, + /*sks_valid*/ 1, + /*command*/ 1, + /*field*/ 1, + /*bit_valid*/ 1, + /*bit*/ 4); + ctl_config_read_done(io); + retval = CTL_RETVAL_COMPLETE; + break; + default: + ctl_set_invalid_opcode(&io->scsiio); + ctl_config_read_done(io); + retval = CTL_RETVAL_COMPLETE; + break; + } + return (retval); +} + +static void +ctl_backend_ramdisk_delete(struct ctl_be_lun *cbe_lun, off_t lba, off_t len, + int anchor) +{ + struct ctl_be_ramdisk_lun *be_lun = cbe_lun->be_lun; + uint8_t *page; + uint64_t p, lp; + u_int lbaoff; + getpage_op_t op = anchor ? GP_ANCHOR : GP_OTHER; + + /* Partially zero first partial page. */ + p = lba >> cbe_lun->pblockexp; + lbaoff = lba & ~(UINT_MAX << cbe_lun->pblockexp); + if (lbaoff != 0) { + page = ctl_backend_ramdisk_getpage(be_lun, p, op); + if (page != P_UNMAPPED && page != P_ANCHORED) { + memset(page + lbaoff * cbe_lun->blocksize, 0, + min(len, be_lun->pblockmul - lbaoff) * + cbe_lun->blocksize); + } + p++; + } + + /* Partially zero last partial page. */ + lp = (lba + len) >> cbe_lun->pblockexp; + lbaoff = (lba + len) & ~(UINT_MAX << cbe_lun->pblockexp); + if (p <= lp && lbaoff != 0) { + page = ctl_backend_ramdisk_getpage(be_lun, lp, op); + if (page != P_UNMAPPED && page != P_ANCHORED) + memset(page, 0, lbaoff * cbe_lun->blocksize); + } + + /* Delete remaining full pages. */ + if (anchor) { + for (; p < lp; p++) + ctl_backend_ramdisk_anchorpage(be_lun, p); + } else { + for (; p < lp; p++) + ctl_backend_ramdisk_unmappage(be_lun, p); + } +} + +static void +ctl_backend_ramdisk_ws(union ctl_io *io) +{ + struct ctl_be_lun *cbe_lun = CTL_BACKEND_LUN(io); + struct ctl_be_ramdisk_lun *be_lun = cbe_lun->be_lun; + struct ctl_lba_len_flags *lbalen = ARGS(io); + uint8_t *page; + uint64_t lba; + u_int lbaoff, lbas; + + if (lbalen->flags & ~(SWS_LBDATA | SWS_UNMAP | SWS_ANCHOR | SWS_NDOB)) { + ctl_set_invalid_field(&io->scsiio, + /*sks_valid*/ 1, + /*command*/ 1, + /*field*/ 1, + /*bit_valid*/ 0, + /*bit*/ 0); + ctl_config_write_done(io); + return; + } + if (lbalen->flags & SWS_UNMAP) { + ctl_backend_ramdisk_delete(cbe_lun, lbalen->lba, lbalen->len, + (lbalen->flags & SWS_ANCHOR) != 0); + ctl_set_success(&io->scsiio); + ctl_config_write_done(io); + return; + } + + for (lba = lbalen->lba, lbas = lbalen->len; lbas > 0; lba++, lbas--) { + page = ctl_backend_ramdisk_getpage(be_lun, + lba >> cbe_lun->pblockexp, GP_WRITE); + if (page == P_UNMAPPED || page == P_ANCHORED) { + ctl_set_space_alloc_fail(&io->scsiio); + ctl_data_submit_done(io); + return; + } + lbaoff = lba & ~(UINT_MAX << cbe_lun->pblockexp); + page += lbaoff * cbe_lun->blocksize; + if (lbalen->flags & SWS_NDOB) { + memset(page, 0, cbe_lun->blocksize); + } else { + memcpy(page, io->scsiio.kern_data_ptr, + cbe_lun->blocksize); + } + if (lbalen->flags & SWS_LBDATA) + scsi_ulto4b(lba, page); + } + ctl_set_success(&io->scsiio); + ctl_config_write_done(io); +} + +static void +ctl_backend_ramdisk_unmap(union ctl_io *io) +{ + struct ctl_be_lun *cbe_lun = CTL_BACKEND_LUN(io); + struct ctl_ptr_len_flags *ptrlen = (struct ctl_ptr_len_flags *)ARGS(io); + struct scsi_unmap_desc *buf, *end; + + if ((ptrlen->flags & ~SU_ANCHOR) != 0) { + ctl_set_invalid_field(&io->scsiio, + /*sks_valid*/ 0, + /*command*/ 0, + /*field*/ 0, + /*bit_valid*/ 0, + /*bit*/ 0); + ctl_config_write_done(io); + return; + } + + buf = (struct scsi_unmap_desc *)ptrlen->ptr; + end = buf + ptrlen->len / sizeof(*buf); + for (; buf < end; buf++) { + ctl_backend_ramdisk_delete(cbe_lun, + scsi_8btou64(buf->lba), scsi_4btoul(buf->length), + (ptrlen->flags & SU_ANCHOR) != 0); + } + + ctl_set_success(&io->scsiio); + ctl_config_write_done(io); +} + +static int +ctl_backend_ramdisk_config_write(union ctl_io *io) +{ + struct ctl_be_lun *cbe_lun = CTL_BACKEND_LUN(io); + int retval = 0; + + switch (io->scsiio.cdb[0]) { + case SYNCHRONIZE_CACHE: + case SYNCHRONIZE_CACHE_16: + /* We have no cache to flush. */ + ctl_set_success(&io->scsiio); + ctl_config_write_done(io); + break; + case START_STOP_UNIT: { + struct scsi_start_stop_unit *cdb; + + cdb = (struct scsi_start_stop_unit *)io->scsiio.cdb; + if ((cdb->how & SSS_PC_MASK) != 0) { + ctl_set_success(&io->scsiio); + ctl_config_write_done(io); + break; + } + if (cdb->how & SSS_START) { + if (cdb->how & SSS_LOEJ) + ctl_lun_has_media(cbe_lun); + ctl_start_lun(cbe_lun); + } else { + ctl_stop_lun(cbe_lun); + if (cdb->how & SSS_LOEJ) + ctl_lun_ejected(cbe_lun); + } + ctl_set_success(&io->scsiio); + ctl_config_write_done(io); + break; + } + case PREVENT_ALLOW: + ctl_set_success(&io->scsiio); + ctl_config_write_done(io); + break; + case WRITE_SAME_10: + case WRITE_SAME_16: + ctl_backend_ramdisk_ws(io); + break; + case UNMAP: + ctl_backend_ramdisk_unmap(io); + break; + default: + ctl_set_invalid_opcode(&io->scsiio); + ctl_config_write_done(io); + retval = CTL_RETVAL_COMPLETE; + break; + } + + return (retval); +} + +static uint64_t +ctl_backend_ramdisk_lun_attr(void *arg, const char *attrname) +{ + struct ctl_be_ramdisk_lun *be_lun = arg; + uint64_t val; + + val = UINT64_MAX; + if (be_lun->cap_bytes == 0) + return (val); + sx_slock(&be_lun->page_lock); + if (strcmp(attrname, "blocksused") == 0) { + val = be_lun->cap_used / be_lun->cbe_lun.blocksize; + } else if (strcmp(attrname, "blocksavail") == 0) { + val = (be_lun->cap_bytes - be_lun->cap_used) / + be_lun->cbe_lun.blocksize; + } + sx_sunlock(&be_lun->page_lock); + return (val); +} + +static int ctl_backend_ramdisk_ioctl(struct cdev *dev, u_long cmd, caddr_t addr, int flag, struct thread *td) { @@ -466,6 +950,9 @@ ctl_backend_ramdisk_rm(struct ctl_be_ram taskqueue_drain_all(be_lun->io_taskqueue); taskqueue_free(be_lun->io_taskqueue); ctl_free_opts(&be_lun->cbe_lun.options); + free(be_lun->zero_page, M_RAMDISK); + ctl_backend_ramdisk_freeallpages(be_lun->pages, be_lun->indir); + sx_destroy(&be_lun->page_lock); mtx_destroy(&be_lun->queue_lock); free(be_lun, M_RAMDISK); } @@ -487,6 +974,7 @@ ctl_backend_ramdisk_create(struct ctl_be struct ctl_lun_create_params *params; char *value; char tmpstr[32]; + uint64_t t; int retval; retval = 0; @@ -513,6 +1001,19 @@ ctl_backend_ramdisk_create(struct ctl_be } else if (control_softc->flags & CTL_FLAG_ACTIVE_SHELF) cbe_lun->flags |= CTL_LUN_FLAG_PRIMARY; + be_lun->pblocksize = PAGE_SIZE; + value = ctl_get_opt(&cbe_lun->options, "pblocksize"); + if (value != NULL) { + ctl_expand_number(value, &t); + be_lun->pblocksize = t; + } + if (be_lun->pblocksize < 512 || be_lun->pblocksize > 131072) { + snprintf(req->error_str, sizeof(req->error_str), + "%s: unsupported pblocksize %u", __func__, + be_lun->pblocksize); + goto bailout_error; + } + if (cbe_lun->lun_type == T_DIRECT || cbe_lun->lun_type == T_CDROM) { if (params->blocksize_bytes != 0) @@ -521,6 +1022,14 @@ ctl_backend_ramdisk_create(struct ctl_be cbe_lun->blocksize = 2048; else cbe_lun->blocksize = 512; + be_lun->pblockmul = be_lun->pblocksize / cbe_lun->blocksize; + if (be_lun->pblockmul < 1 || !powerof2(be_lun->pblockmul)) { + snprintf(req->error_str, sizeof(req->error_str), + "%s: pblocksize %u not exp2 of blocksize %u", + __func__, + be_lun->pblocksize, cbe_lun->blocksize); + goto bailout_error; + } if (params->lun_size_bytes < cbe_lun->blocksize) { snprintf(req->error_str, sizeof(req->error_str), "%s: LUN size %ju < blocksize %u", __func__, @@ -529,9 +1038,25 @@ ctl_backend_ramdisk_create(struct ctl_be } be_lun->size_blocks = params->lun_size_bytes / cbe_lun->blocksize; be_lun->size_bytes = be_lun->size_blocks * cbe_lun->blocksize; + be_lun->indir = 0; + t = be_lun->size_bytes / be_lun->pblocksize; + while (t > 1) { + t /= PPP; + be_lun->indir++; + } cbe_lun->maxlba = be_lun->size_blocks - 1; - cbe_lun->atomicblock = UINT32_MAX; - cbe_lun->opttxferlen = softc->rd_size / cbe_lun->blocksize; + cbe_lun->pblockexp = fls(be_lun->pblockmul) - 1; + cbe_lun->pblockoff = 0; + cbe_lun->ublockexp = cbe_lun->pblockexp; + cbe_lun->ublockoff = 0; + cbe_lun->atomicblock = be_lun->pblocksize; + cbe_lun->opttxferlen = SGPP * be_lun->pblocksize; + value = ctl_get_opt(&cbe_lun->options, "capacity"); + if (value != NULL) + ctl_expand_number(value, &be_lun->cap_bytes); + } else { + be_lun->pblockmul = 1; + cbe_lun->pblockexp = 0; } /* Tell the user the blocksize we ended up using */ @@ -539,7 +1064,7 @@ ctl_backend_ramdisk_create(struct ctl_be params->lun_size_bytes = be_lun->size_bytes; value = ctl_get_opt(&cbe_lun->options, "unmap"); - if (value != NULL && strcmp(value, "on") == 0) + if (value == NULL || strcmp(value, "off") != 0) cbe_lun->flags |= CTL_LUN_FLAG_UNMAP; value = ctl_get_opt(&cbe_lun->options, "readonly"); if (value != NULL) { @@ -594,6 +1119,11 @@ ctl_backend_ramdisk_create(struct ctl_be } STAILQ_INIT(&be_lun->cont_queue); + sx_init(&be_lun->page_lock, "cram page lock"); + if (be_lun->cap_bytes == 0) + be_lun->pages = malloc(be_lun->pblocksize, M_RAMDISK, M_WAITOK); + be_lun->zero_page = malloc(be_lun->pblocksize, M_RAMDISK, + M_WAITOK|M_ZERO); mtx_init(&be_lun->queue_lock, "cram queue lock", NULL, MTX_DEF); TASK_INIT(&be_lun->io_task, /*priority*/0, ctl_backend_ramdisk_worker, be_lun); @@ -668,10 +1198,12 @@ ctl_backend_ramdisk_create(struct ctl_be bailout_error: req->status = CTL_LUN_ERROR; if (be_lun != NULL) { - if (be_lun->io_taskqueue != NULL) { + if (be_lun->io_taskqueue != NULL) taskqueue_free(be_lun->io_taskqueue); - } ctl_free_opts(&cbe_lun->options); + free(be_lun->zero_page, M_RAMDISK); + ctl_backend_ramdisk_freeallpages(be_lun->pages, be_lun->indir); + sx_destroy(&be_lun->page_lock); mtx_destroy(&be_lun->queue_lock); free(be_lun, M_RAMDISK); } @@ -827,103 +1359,3 @@ ctl_backend_ramdisk_lun_config_status(vo } mtx_unlock(&softc->lock); } - -static int -ctl_backend_ramdisk_config_write(union ctl_io *io) -{ - struct ctl_be_lun *cbe_lun; - int retval; - - cbe_lun = CTL_BACKEND_LUN(io); - retval = 0; - switch (io->scsiio.cdb[0]) { - case SYNCHRONIZE_CACHE: - case SYNCHRONIZE_CACHE_16: - /* - * The upper level CTL code will filter out any CDBs with - * the immediate bit set and return the proper error. It - * will also not allow a sync cache command to go to a LUN - * that is powered down. - * - * We don't really need to worry about what LBA range the - * user asked to be synced out. When they issue a sync - * cache command, we'll sync out the whole thing. - * - * This is obviously just a stubbed out implementation. - * The real implementation will be in the RAIDCore/CTL *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-stable-11@freebsd.org Tue Feb 7 05:44:14 2017 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D3B82CD238B; Tue, 7 Feb 2017 05:44:14 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A09C3CA7; Tue, 7 Feb 2017 05:44:14 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v175iDb9092897; Tue, 7 Feb 2017 05:44:13 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v175iDuU092896; Tue, 7 Feb 2017 05:44:13 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201702070544.v175iDuU092896@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Ngie Cooper Date: Tue, 7 Feb 2017 05:44:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r313380 - stable/11 X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Feb 2017 05:44:14 -0000 Author: ngie Date: Tue Feb 7 05:44:13 2017 New Revision: 313380 URL: https://svnweb.freebsd.org/changeset/base/313380 Log: MFC r313182: Fix typo in variable name (_REDUNDENT_LIB_DIRS -> _REDUNDANT_LIB_DIRS) Modified: stable/11/Makefile.inc1 Directory Properties: stable/11/ (props changed) Modified: stable/11/Makefile.inc1 ============================================================================== --- stable/11/Makefile.inc1 Tue Feb 7 05:39:00 2017 (r313379) +++ stable/11/Makefile.inc1 Tue Feb 7 05:44:13 2017 (r313380) @@ -240,10 +240,10 @@ SUBDIR+= ${_DIR} # of a LOCAL_DIRS directory. This allows LOCAL_DIRS=foo and # LOCAL_LIB_DIRS=foo/lib to behave as expected. .for _DIR in ${LOCAL_DIRS:M*/} ${LOCAL_DIRS:N*/:S|$|/|} -_REDUNDENT_LIB_DIRS+= ${LOCAL_LIB_DIRS:M${_DIR}*} +_REDUNDANT_LIB_DIRS+= ${LOCAL_LIB_DIRS:M${_DIR}*} .endfor .for _DIR in ${LOCAL_LIB_DIRS} -.if empty(_REDUNDENT_LIB_DIRS:M${_DIR}) && exists(${.CURDIR}/${_DIR}/Makefile) +.if empty(_REDUNDANT_LIB_DIRS:M${_DIR}) && exists(${.CURDIR}/${_DIR}/Makefile) SUBDIR+= ${_DIR} .else .warning ${_DIR} not added to SUBDIR list. See UPDATING 20141121. From owner-svn-src-stable-11@freebsd.org Tue Feb 7 08:31:08 2017 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4D1EBCC679B; Tue, 7 Feb 2017 08:31:08 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 1C6EE1AC5; Tue, 7 Feb 2017 08:31:08 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v178V7eD057444; Tue, 7 Feb 2017 08:31:07 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v178V7BS057443; Tue, 7 Feb 2017 08:31:07 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201702070831.v178V7BS057443@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Tue, 7 Feb 2017 08:31:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r313383 - stable/11/sys/vm X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Feb 2017 08:31:08 -0000 Author: kib Date: Tue Feb 7 08:31:07 2017 New Revision: 313383 URL: https://svnweb.freebsd.org/changeset/base/313383 Log: MFC r313249: Style, use tab after #define. Modified: stable/11/sys/vm/vm_object.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/vm/vm_object.h ============================================================================== --- stable/11/sys/vm/vm_object.h Tue Feb 7 06:34:02 2017 (r313382) +++ stable/11/sys/vm/vm_object.h Tue Feb 7 08:31:07 2017 (r313383) @@ -195,8 +195,8 @@ struct vm_object { #define OBJ_DISCONNECTWNT 0x4000 /* disconnect from vnode wanted */ #define OBJ_TMPFS 0x8000 /* has tmpfs vnode allocated */ -#define IDX_TO_OFF(idx) (((vm_ooffset_t)(idx)) << PAGE_SHIFT) -#define OFF_TO_IDX(off) ((vm_pindex_t)(((vm_ooffset_t)(off)) >> PAGE_SHIFT)) +#define IDX_TO_OFF(idx) (((vm_ooffset_t)(idx)) << PAGE_SHIFT) +#define OFF_TO_IDX(off) ((vm_pindex_t)(((vm_ooffset_t)(off)) >> PAGE_SHIFT)) #ifdef _KERNEL From owner-svn-src-stable-11@freebsd.org Tue Feb 7 15:13:20 2017 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D7C47CD50B6; Tue, 7 Feb 2017 15:13:20 +0000 (UTC) (envelope-from rstone@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 8E131FE1; Tue, 7 Feb 2017 15:13:20 +0000 (UTC) (envelope-from rstone@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v17FDJFD026175; Tue, 7 Feb 2017 15:13:19 GMT (envelope-from rstone@FreeBSD.org) Received: (from rstone@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v17FDJA6026173; Tue, 7 Feb 2017 15:13:19 GMT (envelope-from rstone@FreeBSD.org) Message-Id: <201702071513.v17FDJA6026173@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rstone set sender to rstone@FreeBSD.org using -f From: Ryan Stone Date: Tue, 7 Feb 2017 15:13:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r313388 - in stable/11/sys: dev/ixgbe net X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Feb 2017 15:13:21 -0000 Author: rstone Date: Tue Feb 7 15:13:19 2017 New Revision: 313388 URL: https://svnweb.freebsd.org/changeset/base/313388 Log: MFC r312544 Fix reference to free memory in ixgbe/if_media.c When ixgbe receives an interrupt indicating that a new optical module may have been inserted, it discards all of its current media types by calling ifmedia_removeall() and then creates a new set of media types for the supported media on the new module. However, ifmedia_removeall() was maintaining a pointer to whatever the current media type was before the call to ifmedia_removealL(). The result of this was that any attempt to read the current media type of the interface (e.g. via ifconfig) would return potentially garbage data from free memory (or if one were particularly unlucky on an architecture that does not malloc() from a direct map, page fault the kernel). Fix this by NULL'ing out the current media field in if_media.c, and have ixgbe update the current media type after recreating them. Submitted by: Matt Joras Reviewed by: sbruno, erj MFC after: 1 week Sponsored by: Dell EMC Isilon Differential Revision: https://reviews.freebsd.org/D9164 Modified: stable/11/sys/dev/ixgbe/if_ix.c stable/11/sys/net/if_media.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/ixgbe/if_ix.c ============================================================================== --- stable/11/sys/dev/ixgbe/if_ix.c Tue Feb 7 15:12:27 2017 (r313387) +++ stable/11/sys/dev/ixgbe/if_ix.c Tue Feb 7 15:13:19 2017 (r313388) @@ -3878,6 +3878,7 @@ ixgbe_handle_msf(void *context, int pend /* Adjust media types shown in ifconfig */ ifmedia_removeall(&adapter->media); ixgbe_add_media_types(adapter); + ifmedia_set(&adapter->media, IFM_ETHER | IFM_AUTO); IXGBE_CORE_UNLOCK(adapter); return; } Modified: stable/11/sys/net/if_media.c ============================================================================== --- stable/11/sys/net/if_media.c Tue Feb 7 15:12:27 2017 (r313387) +++ stable/11/sys/net/if_media.c Tue Feb 7 15:13:19 2017 (r313388) @@ -107,6 +107,7 @@ ifmedia_removeall(ifm) LIST_REMOVE(entry, ifm_list); free(entry, M_IFADDR); } + ifm->ifm_cur = NULL; } /* From owner-svn-src-stable-11@freebsd.org Tue Feb 7 22:40:39 2017 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9C836CD5660; Tue, 7 Feb 2017 22:40:39 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 6BC9E120D; Tue, 7 Feb 2017 22:40:39 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v17Meci6012486; Tue, 7 Feb 2017 22:40:38 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v17Mec0L012485; Tue, 7 Feb 2017 22:40:38 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201702072240.v17Mec0L012485@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Tue, 7 Feb 2017 22:40:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r313408 - stable/11/sys/dev/pci X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Feb 2017 22:40:39 -0000 Author: jhb Date: Tue Feb 7 22:40:38 2017 New Revision: 313408 URL: https://svnweb.freebsd.org/changeset/base/313408 Log: MFC 313097: Require Data Layer Active reporting for native PCI-e HotPlug. Some PCI-e bridges report that they support HotPlug in the slot capabilities but do not report support for Data Layer Active events in the link capabilities register. These bridges do not work correctly when HotPlug is used. Further, while the description of HotPlug in the spec does not mention that DL active events are required, the description of the link capabilities register says that DL active is required for HotPlug. Thanks to Dave Baukus for finding that language in the spec. PR: 211699 Modified: stable/11/sys/dev/pci/pci_pci.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/pci/pci_pci.c ============================================================================== --- stable/11/sys/dev/pci/pci_pci.c Tue Feb 7 20:34:03 2017 (r313407) +++ stable/11/sys/dev/pci/pci_pci.c Tue Feb 7 22:40:38 2017 (r313408) @@ -935,6 +935,8 @@ pcib_probe_hotplug(struct pcib_softc *sc if ((sc->pcie_slot_cap & PCIEM_SLOT_CAP_HPC) == 0) return; + if ((sc->pcie_link_cap & PCIEM_LINK_CAP_DL_ACTIVE) == 0) + return; /* * Some devices report that they have an MRL when they actually From owner-svn-src-stable-11@freebsd.org Wed Feb 8 08:35:01 2017 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1ECEDCD4415; Wed, 8 Feb 2017 08:35:01 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E240D1BDB; Wed, 8 Feb 2017 08:35:00 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v188Z0hn055135; Wed, 8 Feb 2017 08:35:00 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v188Z0ed055131; Wed, 8 Feb 2017 08:35:00 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201702080835.v188Z0ed055131@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Ngie Cooper Date: Wed, 8 Feb 2017 08:35:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r313431 - stable/11/lib/libwrap X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 08 Feb 2017 08:35:01 -0000 Author: ngie Date: Wed Feb 8 08:34:59 2017 New Revision: 313431 URL: https://svnweb.freebsd.org/changeset/base/313431 Log: MFC r312392: Use SRCTOP instead of .CURDIR-relative path in .PATH directive Modified: stable/11/lib/libwrap/Makefile Directory Properties: stable/11/ (props changed) Modified: stable/11/lib/libwrap/Makefile ============================================================================== --- stable/11/lib/libwrap/Makefile Wed Feb 8 07:09:10 2017 (r313430) +++ stable/11/lib/libwrap/Makefile Wed Feb 8 08:34:59 2017 (r313431) @@ -15,7 +15,7 @@ MLINKS= hosts_access.3 hosts_ctl.3 \ hosts_access.3 request_set.3 \ hosts_options.5 hosts.allow.5 -.PATH: ${.CURDIR}/../../contrib/tcp_wrappers +.PATH: ${SRCTOP}/contrib/tcp_wrappers CFLAGS+=-DFACILITY=LOG_AUTH -DHOSTS_ACCESS -DNETGROUP -DDAEMON_UMASK=022 \ -DREAL_DAEMON_DIR=\"${LIBEXECDIR}\" -DPROCESS_OPTIONS \ From owner-svn-src-stable-11@freebsd.org Wed Feb 8 13:37:58 2017 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7FEBECD6D06; Wed, 8 Feb 2017 13:37:58 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4C58C1EA9; Wed, 8 Feb 2017 13:37:58 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v18Dbvsb078199; Wed, 8 Feb 2017 13:37:57 GMT (envelope-from cy@FreeBSD.org) Received: (from cy@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v18Dbvla078198; Wed, 8 Feb 2017 13:37:57 GMT (envelope-from cy@FreeBSD.org) Message-Id: <201702081337.v18Dbvla078198@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cy set sender to cy@FreeBSD.org using -f From: Cy Schubert Date: Wed, 8 Feb 2017 13:37:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r313441 - in stable: 10/contrib/ipfilter/tools 11/contrib/ipfilter/tools X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 08 Feb 2017 13:37:58 -0000 Author: cy Date: Wed Feb 8 13:37:57 2017 New Revision: 313441 URL: https://svnweb.freebsd.org/changeset/base/313441 Log: MFC r312777, r312780: Issue an error message when an incorrect flush argument is encountered (and style fixup). Modified: stable/11/contrib/ipfilter/tools/ipf.c Directory Properties: stable/11/ (props changed) Changes in other areas also in this revision: Modified: stable/10/contrib/ipfilter/tools/ipf.c Directory Properties: stable/10/ (props changed) Modified: stable/11/contrib/ipfilter/tools/ipf.c ============================================================================== --- stable/11/contrib/ipfilter/tools/ipf.c Wed Feb 8 09:47:38 2017 (r313440) +++ stable/11/contrib/ipfilter/tools/ipf.c Wed Feb 8 13:37:57 2017 (r313441) @@ -409,13 +409,16 @@ static void flushfilter(arg, filter) closedevice(); return; } - - if (strchr(arg, 'i') || strchr(arg, 'I')) + else if (strchr(arg, 'i') || strchr(arg, 'I')) fl = FR_INQUE; - if (strchr(arg, 'o') || strchr(arg, 'O')) + else if (strchr(arg, 'o') || strchr(arg, 'O')) fl = FR_OUTQUE; - if (strchr(arg, 'a') || strchr(arg, 'A')) + else if (strchr(arg, 'a') || strchr(arg, 'A')) fl = FR_OUTQUE|FR_INQUE; + else { + fprintf(stderr, "Incorrect flush argument: %s\n", arg); + usage(); + } if (opts & OPT_INACTIVE) fl |= FR_INACTIVE; rem = fl; From owner-svn-src-stable-11@freebsd.org Wed Feb 8 16:00:41 2017 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id AB5BDCD5AC7; Wed, 8 Feb 2017 16:00:41 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 68FEE190B; Wed, 8 Feb 2017 16:00:41 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v18G0e6u035713; Wed, 8 Feb 2017 16:00:40 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v18G0eTQ035712; Wed, 8 Feb 2017 16:00:40 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201702081600.v18G0eTQ035712@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Wed, 8 Feb 2017 16:00:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r313443 - stable/11/share/misc X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 08 Feb 2017 16:00:41 -0000 Author: mav Date: Wed Feb 8 16:00:40 2017 New Revision: 313443 URL: https://svnweb.freebsd.org/changeset/base/313443 Log: MFC r312750: Add Timeout and Protect mode page description from MMC-6. Modified: stable/11/share/misc/scsi_modes Directory Properties: stable/11/ (props changed) Modified: stable/11/share/misc/scsi_modes ============================================================================== --- stable/11/share/misc/scsi_modes Wed Feb 8 15:52:09 2017 (r313442) +++ stable/11/share/misc/scsi_modes Wed Feb 8 16:00:40 2017 (r313443) @@ -478,4 +478,17 @@ {Current Write Speed Supported (kBps)} i2 }; +0x1d "Timeout and Protect" { + {Reserved} *i2 + {Reserved} *t4 + {G3Enable} t1 + {TMOE} t1 + {DISP} t1 + {SWPP} t1 + {Reserved} *i1 + {Group 1 Minimum Timeout} i2 + {Group 2 Minimum Timeout} i2 + {Group 3 Timeout} i2 +}; + 0x00 "Vendor-Specific"; From owner-svn-src-stable-11@freebsd.org Wed Feb 8 16:06:21 2017 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0CECCCD5BE0; Wed, 8 Feb 2017 16:06:21 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id DB6FE1E88; Wed, 8 Feb 2017 16:06:20 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v18G6Jog039738; Wed, 8 Feb 2017 16:06:19 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v18G6JwI039735; Wed, 8 Feb 2017 16:06:19 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201702081606.v18G6JwI039735@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Wed, 8 Feb 2017 16:06:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r313445 - stable/11/sys/dev/ahci X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 08 Feb 2017 16:06:21 -0000 Author: mav Date: Wed Feb 8 16:06:19 2017 New Revision: 313445 URL: https://svnweb.freebsd.org/changeset/base/313445 Log: MFC r312767: Partially workaround ASMedia HBA error recovery. Taking closer look on my ASM1062 I found that it has bunch of issues around error recovery: reported wrong CCS, failed commands reported as completed, READ LOG EXT times out after NCQ error. This patch workarounds first two problems, that were making ATAPI devices close to unusable on these HBAs. Modified: stable/11/sys/dev/ahci/ahci.c stable/11/sys/dev/ahci/ahci.h stable/11/sys/dev/ahci/ahci_pci.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/ahci/ahci.c ============================================================================== --- stable/11/sys/dev/ahci/ahci.c Wed Feb 8 16:01:14 2017 (r313444) +++ stable/11/sys/dev/ahci/ahci.c Wed Feb 8 16:06:19 2017 (r313445) @@ -758,7 +758,7 @@ ahci_ch_attach(device_t dev) /* Construct SIM entry */ ch->sim = cam_sim_alloc(ahciaction, ahcipoll, "ahcich", ch, device_get_unit(dev), (struct mtx *)&ch->mtx, - min(2, ch->numslots), + (ch->quirks & AHCI_Q_NOCCS) ? 1 : min(2, ch->numslots), (ch->caps & AHCI_CAP_SNCQ) ? ch->numslots : 0, devq); if (ch->sim == NULL) { @@ -1271,8 +1271,19 @@ ahci_ch_intr_main(struct ahci_channel *c /* Process command errors */ if (istatus & (AHCI_P_IX_OF | AHCI_P_IX_IF | AHCI_P_IX_HBD | AHCI_P_IX_HBF | AHCI_P_IX_TFE)) { - ccs = (ATA_INL(ch->r_mem, AHCI_P_CMD) & AHCI_P_CMD_CCS_MASK) - >> AHCI_P_CMD_CCS_SHIFT; + if (ch->quirks & AHCI_Q_NOCCS) { + /* + * ASMedia chips sometimes report failed commands as + * completed. Count all running commands as failed. + */ + cstatus |= ch->rslots; + + /* They also report wrong CCS, so try to guess one. */ + ccs = powerof2(cstatus) ? ffs(cstatus) - 1 : -1; + } else { + ccs = (ATA_INL(ch->r_mem, AHCI_P_CMD) & + AHCI_P_CMD_CCS_MASK) >> AHCI_P_CMD_CCS_SHIFT; + } //device_printf(dev, "%s ERROR is %08x cs %08x ss %08x rs %08x tfd %02x serr %08x fbs %08x ccs %d\n", // __func__, istatus, cstatus, sstatus, ch->rslots, ATA_INL(ch->r_mem, AHCI_P_TFD), // serr, ATA_INL(ch->r_mem, AHCI_P_FBS), ccs); Modified: stable/11/sys/dev/ahci/ahci.h ============================================================================== --- stable/11/sys/dev/ahci/ahci.h Wed Feb 8 16:01:14 2017 (r313444) +++ stable/11/sys/dev/ahci/ahci.h Wed Feb 8 16:06:19 2017 (r313445) @@ -598,6 +598,7 @@ enum ahci_err_type { #define AHCI_Q_FORCE_PI 0x00040000 #define AHCI_Q_RESTORE_CAP 0x00080000 #define AHCI_Q_NOMSIX 0x00100000 +#define AHCI_Q_NOCCS 0x00400000 #define AHCI_Q_BIT_STRING \ "\020" \ @@ -621,7 +622,8 @@ enum ahci_err_type { "\0221MSI" \ "\023FORCE_PI" \ "\024RESTORE_CAP" \ - "\025NOMSIX" + "\025NOMSIX" \ + "\027NOCCS" int ahci_attach(device_t dev); int ahci_detach(device_t dev); Modified: stable/11/sys/dev/ahci/ahci_pci.c ============================================================================== --- stable/11/sys/dev/ahci/ahci_pci.c Wed Feb 8 16:01:14 2017 (r313444) +++ stable/11/sys/dev/ahci/ahci_pci.c Wed Feb 8 16:06:19 2017 (r313445) @@ -73,15 +73,15 @@ static const struct { {0x78021022, 0x00, "AMD Hudson-2", 0}, {0x78031022, 0x00, "AMD Hudson-2", 0}, {0x78041022, 0x00, "AMD Hudson-2", 0}, - {0x06011b21, 0x00, "ASMedia ASM1060", 0}, - {0x06021b21, 0x00, "ASMedia ASM1060", 0}, - {0x06111b21, 0x00, "ASMedia ASM1061", 0}, - {0x06121b21, 0x00, "ASMedia ASM1062", 0}, - {0x06201b21, 0x00, "ASMedia ASM106x", 0}, - {0x06211b21, 0x00, "ASMedia ASM106x", 0}, - {0x06221b21, 0x00, "ASMedia ASM106x", 0}, - {0x06241b21, 0x00, "ASMedia ASM106x", 0}, - {0x06251b21, 0x00, "ASMedia ASM106x", 0}, + {0x06011b21, 0x00, "ASMedia ASM1060", AHCI_Q_NOCCS}, + {0x06021b21, 0x00, "ASMedia ASM1060", AHCI_Q_NOCCS}, + {0x06111b21, 0x00, "ASMedia ASM1061", AHCI_Q_NOCCS}, + {0x06121b21, 0x00, "ASMedia ASM1062", AHCI_Q_NOCCS}, + {0x06201b21, 0x00, "ASMedia ASM106x", AHCI_Q_NOCCS}, + {0x06211b21, 0x00, "ASMedia ASM106x", AHCI_Q_NOCCS}, + {0x06221b21, 0x00, "ASMedia ASM106x", AHCI_Q_NOCCS}, + {0x06241b21, 0x00, "ASMedia ASM106x", AHCI_Q_NOCCS}, + {0x06251b21, 0x00, "ASMedia ASM106x", AHCI_Q_NOCCS}, {0x26528086, 0x00, "Intel ICH6", AHCI_Q_NOFORCE}, {0x26538086, 0x00, "Intel ICH6M", AHCI_Q_NOFORCE}, {0x26818086, 0x00, "Intel ESB2", 0}, From owner-svn-src-stable-11@freebsd.org Wed Feb 8 18:32:37 2017 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8AB3ACD6927; Wed, 8 Feb 2017 18:32:37 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4324AF22; Wed, 8 Feb 2017 18:32:37 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v18IWatx001836; Wed, 8 Feb 2017 18:32:36 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v18IWZlC001828; Wed, 8 Feb 2017 18:32:35 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201702081832.v18IWZlC001828@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Wed, 8 Feb 2017 18:32:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r313450 - in stable/11: lib/libc/gen lib/libc/sys sys/compat/freebsd32 sys/kern sys/sys X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 08 Feb 2017 18:32:37 -0000 Author: jhb Date: Wed Feb 8 18:32:35 2017 New Revision: 313450 URL: https://svnweb.freebsd.org/changeset/base/313450 Log: MFC 310638: Rename the 'flags' argument to getfsstat() to 'mode' and validate it. This argument is not a bitmask of flags, but only accepts a single value. Fail with EINVAL if an invalid value is passed to 'flag'. Rename the 'flags' argument to getmntinfo(3) to 'mode' as well to match. This is a followup to r308088. Modified: stable/11/lib/libc/gen/getmntinfo.3 stable/11/lib/libc/gen/getmntinfo.c stable/11/lib/libc/sys/getfsstat.2 stable/11/sys/compat/freebsd32/freebsd32_misc.c stable/11/sys/compat/freebsd32/syscalls.master stable/11/sys/kern/syscalls.master stable/11/sys/kern/vfs_syscalls.c stable/11/sys/sys/syscallsubr.h Directory Properties: stable/11/ (props changed) Modified: stable/11/lib/libc/gen/getmntinfo.3 ============================================================================== --- stable/11/lib/libc/gen/getmntinfo.3 Wed Feb 8 17:45:23 2017 (r313449) +++ stable/11/lib/libc/gen/getmntinfo.3 Wed Feb 8 18:32:35 2017 (r313450) @@ -28,7 +28,7 @@ .\" @(#)getmntinfo.3 8.1 (Berkeley) 6/9/93 .\" $FreeBSD$ .\" -.Dd June 9, 1993 +.Dd December 27, 2016 .Dt GETMNTINFO 3 .Os .Sh NAME @@ -41,7 +41,7 @@ .In sys/ucred.h .In sys/mount.h .Ft int -.Fn getmntinfo "struct statfs **mntbufp" "int flags" +.Fn getmntinfo "struct statfs **mntbufp" "int mode" .Sh DESCRIPTION The .Fn getmntinfo @@ -55,7 +55,7 @@ The .Fn getmntinfo function passes its -.Fa flags +.Fa mode argument transparently to .Xr getfsstat 2 . .Sh RETURN VALUES Modified: stable/11/lib/libc/gen/getmntinfo.c ============================================================================== --- stable/11/lib/libc/gen/getmntinfo.c Wed Feb 8 17:45:23 2017 (r313449) +++ stable/11/lib/libc/gen/getmntinfo.c Wed Feb 8 18:32:35 2017 (r313450) @@ -42,7 +42,7 @@ __FBSDID("$FreeBSD$"); * Return information about mounted filesystems. */ int -getmntinfo(struct statfs **mntbufp, int flags) +getmntinfo(struct statfs **mntbufp, int mode) { static struct statfs *mntbuf; static int mntsize; @@ -50,7 +50,7 @@ getmntinfo(struct statfs **mntbufp, int if (mntsize <= 0 && (mntsize = getfsstat(0, 0, MNT_NOWAIT)) < 0) return (0); - if (bufsize > 0 && (mntsize = getfsstat(mntbuf, bufsize, flags)) < 0) + if (bufsize > 0 && (mntsize = getfsstat(mntbuf, bufsize, mode)) < 0) return (0); while (bufsize <= mntsize * sizeof(struct statfs)) { if (mntbuf) @@ -58,7 +58,7 @@ getmntinfo(struct statfs **mntbufp, int bufsize = (mntsize + 1) * sizeof(struct statfs); if ((mntbuf = malloc(bufsize)) == NULL) return (0); - if ((mntsize = getfsstat(mntbuf, bufsize, flags)) < 0) + if ((mntsize = getfsstat(mntbuf, bufsize, mode)) < 0) return (0); } *mntbufp = mntbuf; Modified: stable/11/lib/libc/sys/getfsstat.2 ============================================================================== --- stable/11/lib/libc/sys/getfsstat.2 Wed Feb 8 17:45:23 2017 (r313449) +++ stable/11/lib/libc/sys/getfsstat.2 Wed Feb 8 18:32:35 2017 (r313450) @@ -28,7 +28,7 @@ .\" @(#)getfsstat.2 8.3 (Berkeley) 5/25/95 .\" $FreeBSD$ .\" -.Dd November 6, 2016 +.Dd December 27, 2016 .Dt GETFSSTAT 2 .Os .Sh NAME @@ -41,7 +41,7 @@ .In sys/ucred.h .In sys/mount.h .Ft int -.Fn getfsstat "struct statfs *buf" "long bufsize" "int flags" +.Fn getfsstat "struct statfs *buf" "long bufsize" "int mode" .Sh DESCRIPTION The .Fn getfsstat @@ -74,11 +74,11 @@ is given as NULL, returns just the number of mounted file systems. .Pp Normally -.Fa flags +.Fa mode should be specified as .Dv MNT_WAIT . If -.Fa flags +.Fa mode is set to .Dv MNT_NOWAIT , .Fn getfsstat @@ -108,6 +108,12 @@ The .Fa buf argument points to an invalid address. +.It Bq Er EINVAL +.Fa mode +is set to a value other than +.Dv MNT_WAIT +or +.Dv MNT_NOWAIT . .It Bq Er EIO An .Tn I/O Modified: stable/11/sys/compat/freebsd32/freebsd32_misc.c ============================================================================== --- stable/11/sys/compat/freebsd32/freebsd32_misc.c Wed Feb 8 17:45:23 2017 (r313449) +++ stable/11/sys/compat/freebsd32/freebsd32_misc.c Wed Feb 8 18:32:35 2017 (r313450) @@ -254,7 +254,7 @@ freebsd4_freebsd32_getfsstat(struct thre count = uap->bufsize / sizeof(struct statfs32); size = count * sizeof(struct statfs); - error = kern_getfsstat(td, &buf, size, &count, UIO_SYSSPACE, uap->flags); + error = kern_getfsstat(td, &buf, size, &count, UIO_SYSSPACE, uap->mode); if (size > 0) { sp = buf; copycount = count; Modified: stable/11/sys/compat/freebsd32/syscalls.master ============================================================================== --- stable/11/sys/compat/freebsd32/syscalls.master Wed Feb 8 17:45:23 2017 (r313449) +++ stable/11/sys/compat/freebsd32/syscalls.master Wed Feb 8 18:32:35 2017 (r313450) @@ -89,7 +89,7 @@ obreak_args int 18 AUE_GETFSSTAT COMPAT4 { int freebsd32_getfsstat( \ struct statfs32 *buf, long bufsize, \ - int flags); } + int mode); } 19 AUE_LSEEK COMPAT { int freebsd32_lseek(int fd, int offset, \ int whence); } 20 AUE_GETPID NOPROTO { pid_t getpid(void); } @@ -712,7 +712,7 @@ off_t *sbytes, int flags); } 394 AUE_NULL UNIMPL mac_syscall 395 AUE_GETFSSTAT NOPROTO { int getfsstat(struct statfs *buf, \ - long bufsize, int flags); } + long bufsize, int mode); } 396 AUE_STATFS NOPROTO { int statfs(char *path, \ struct statfs *buf); } 397 AUE_FSTATFS NOPROTO { int fstatfs(int fd, struct statfs *buf); } Modified: stable/11/sys/kern/syscalls.master ============================================================================== --- stable/11/sys/kern/syscalls.master Wed Feb 8 17:45:23 2017 (r313449) +++ stable/11/sys/kern/syscalls.master Wed Feb 8 18:32:35 2017 (r313450) @@ -85,7 +85,7 @@ 17 AUE_NULL STD { int obreak(char *nsize); } break \ obreak_args int 18 AUE_GETFSSTAT COMPAT4 { int getfsstat(struct ostatfs *buf, \ - long bufsize, int flags); } + long bufsize, int mode); } 19 AUE_LSEEK COMPAT { long lseek(int fd, long offset, \ int whence); } 20 AUE_GETPID STD { pid_t getpid(void); } @@ -707,7 +707,7 @@ 394 AUE_NULL STD { int mac_syscall(const char *policy, \ int call, void *arg); } 395 AUE_GETFSSTAT STD { int getfsstat(struct statfs *buf, \ - long bufsize, int flags); } + long bufsize, int mode); } 396 AUE_STATFS STD { int statfs(char *path, \ struct statfs *buf); } 397 AUE_FSTATFS STD { int fstatfs(int fd, struct statfs *buf); } Modified: stable/11/sys/kern/vfs_syscalls.c ============================================================================== --- stable/11/sys/kern/vfs_syscalls.c Wed Feb 8 17:45:23 2017 (r313449) +++ stable/11/sys/kern/vfs_syscalls.c Wed Feb 8 18:32:35 2017 (r313450) @@ -390,7 +390,7 @@ kern_fstatfs(struct thread *td, int fd, struct getfsstat_args { struct statfs *buf; long bufsize; - int flags; + int mode; }; #endif int @@ -399,7 +399,7 @@ sys_getfsstat(td, uap) register struct getfsstat_args /* { struct statfs *buf; long bufsize; - int flags; + int mode; } */ *uap; { size_t count; @@ -408,7 +408,7 @@ sys_getfsstat(td, uap) if (uap->bufsize < 0 || uap->bufsize > SIZE_MAX) return (EINVAL); error = kern_getfsstat(td, &uap->buf, uap->bufsize, &count, - UIO_USERSPACE, uap->flags); + UIO_USERSPACE, uap->mode); if (error == 0) td->td_retval[0] = count; return (error); @@ -421,13 +421,20 @@ sys_getfsstat(td, uap) */ int kern_getfsstat(struct thread *td, struct statfs **buf, size_t bufsize, - size_t *countp, enum uio_seg bufseg, int flags) + size_t *countp, enum uio_seg bufseg, int mode) { struct mount *mp, *nmp; struct statfs *sfsp, *sp, *sptmp, *tofree; size_t count, maxcount; int error; + switch (mode) { + case MNT_WAIT: + case MNT_NOWAIT: + break; + default: + return (EINVAL); + } restart: maxcount = bufsize / sizeof(struct statfs); if (bufsize == 0) { @@ -461,7 +468,7 @@ restart: continue; } #endif - if (flags == MNT_WAIT) { + if (mode == MNT_WAIT) { if (vfs_busy(mp, MBF_MNTLSTLOCK) != 0) { /* * If vfs_busy() failed, and MBF_NOWAIT @@ -490,10 +497,10 @@ restart: sp->f_namemax = NAME_MAX; sp->f_flags = mp->mnt_flag & MNT_VISFLAGMASK; /* - * If MNT_NOWAIT or MNT_LAZY is specified, do not - * refresh the fsstat cache. + * If MNT_NOWAIT is specified, do not refresh + * the fsstat cache. */ - if (flags != MNT_LAZY && flags != MNT_NOWAIT) { + if (mode != MNT_NOWAIT) { error = VFS_STATFS(mp, sp); if (error != 0) { mtx_lock(&mountlist_mtx); @@ -609,7 +616,7 @@ freebsd4_fstatfs(td, uap) struct freebsd4_getfsstat_args { struct ostatfs *buf; long bufsize; - int flags; + int mode; }; #endif int @@ -618,7 +625,7 @@ freebsd4_getfsstat(td, uap) register struct freebsd4_getfsstat_args /* { struct ostatfs *buf; long bufsize; - int flags; + int mode; } */ *uap; { struct statfs *buf, *sp; @@ -633,7 +640,7 @@ freebsd4_getfsstat(td, uap) return (EINVAL); size = count * sizeof(struct statfs); error = kern_getfsstat(td, &buf, size, &count, UIO_SYSSPACE, - uap->flags); + uap->mode); td->td_retval[0] = count; if (size != 0) { sp = buf; Modified: stable/11/sys/sys/syscallsubr.h ============================================================================== --- stable/11/sys/sys/syscallsubr.h Wed Feb 8 17:45:23 2017 (r313449) +++ stable/11/sys/sys/syscallsubr.h Wed Feb 8 18:32:35 2017 (r313450) @@ -109,7 +109,7 @@ int kern_futimens(struct thread *td, int int kern_getdirentries(struct thread *td, int fd, char *buf, u_int count, long *basep, ssize_t *residp, enum uio_seg bufseg); int kern_getfsstat(struct thread *td, struct statfs **buf, size_t bufsize, - size_t *countp, enum uio_seg bufseg, int flags); + size_t *countp, enum uio_seg bufseg, int mode); int kern_getitimer(struct thread *, u_int, struct itimerval *); int kern_getppid(struct thread *); int kern_getpeername(struct thread *td, int fd, struct sockaddr **sa, From owner-svn-src-stable-11@freebsd.org Wed Feb 8 18:33:02 2017 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A1EA0CD69DD; Wed, 8 Feb 2017 18:33:02 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 5A12710B6; Wed, 8 Feb 2017 18:33:02 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v18IX1b1001979; Wed, 8 Feb 2017 18:33:01 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v18IX0HZ001968; Wed, 8 Feb 2017 18:33:00 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201702081833.v18IX0HZ001968@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Wed, 8 Feb 2017 18:33:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r313452 - in stable/11/sys: compat/freebsd32 kern sys X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 08 Feb 2017 18:33:02 -0000 Author: jhb Date: Wed Feb 8 18:33:00 2017 New Revision: 313452 URL: https://svnweb.freebsd.org/changeset/base/313452 Log: Regen after r313450. Modified: stable/11/sys/compat/freebsd32/freebsd32_proto.h stable/11/sys/compat/freebsd32/freebsd32_syscall.h stable/11/sys/compat/freebsd32/freebsd32_syscalls.c stable/11/sys/compat/freebsd32/freebsd32_sysent.c stable/11/sys/compat/freebsd32/freebsd32_systrace_args.c stable/11/sys/kern/init_sysent.c stable/11/sys/kern/syscalls.c stable/11/sys/kern/systrace_args.c stable/11/sys/sys/syscall.h stable/11/sys/sys/syscall.mk stable/11/sys/sys/sysproto.h Modified: stable/11/sys/compat/freebsd32/freebsd32_proto.h ============================================================================== --- stable/11/sys/compat/freebsd32/freebsd32_proto.h Wed Feb 8 18:32:53 2017 (r313451) +++ stable/11/sys/compat/freebsd32/freebsd32_proto.h Wed Feb 8 18:33:00 2017 (r313452) @@ -3,7 +3,7 @@ * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD: stable/11/sys/compat/freebsd32/syscalls.master 306586 2016-10-02 16:13:18Z kib + * created from FreeBSD: stable/11/sys/compat/freebsd32/syscalls.master 313450 2017-02-08 18:32:35Z jhb */ #ifndef _FREEBSD32_SYSPROTO_H_ @@ -917,7 +917,7 @@ int ofreebsd32_getdirentries(struct thre struct freebsd4_freebsd32_getfsstat_args { char buf_l_[PADL_(struct statfs32 *)]; struct statfs32 * buf; char buf_r_[PADR_(struct statfs32 *)]; char bufsize_l_[PADL_(long)]; long bufsize; char bufsize_r_[PADR_(long)]; - char flags_l_[PADL_(int)]; int flags; char flags_r_[PADR_(int)]; + char mode_l_[PADL_(int)]; int mode; char mode_r_[PADR_(int)]; }; struct freebsd4_freebsd32_statfs_args { char path_l_[PADL_(char *)]; char * path; char path_r_[PADR_(char *)]; Modified: stable/11/sys/compat/freebsd32/freebsd32_syscall.h ============================================================================== --- stable/11/sys/compat/freebsd32/freebsd32_syscall.h Wed Feb 8 18:32:53 2017 (r313451) +++ stable/11/sys/compat/freebsd32/freebsd32_syscall.h Wed Feb 8 18:33:00 2017 (r313452) @@ -3,7 +3,7 @@ * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD: stable/11/sys/compat/freebsd32/syscalls.master 306586 2016-10-02 16:13:18Z kib + * created from FreeBSD: stable/11/sys/compat/freebsd32/syscalls.master 313450 2017-02-08 18:32:35Z jhb */ #define FREEBSD32_SYS_syscall 0 Modified: stable/11/sys/compat/freebsd32/freebsd32_syscalls.c ============================================================================== --- stable/11/sys/compat/freebsd32/freebsd32_syscalls.c Wed Feb 8 18:32:53 2017 (r313451) +++ stable/11/sys/compat/freebsd32/freebsd32_syscalls.c Wed Feb 8 18:33:00 2017 (r313452) @@ -3,7 +3,7 @@ * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD: stable/11/sys/compat/freebsd32/syscalls.master 306586 2016-10-02 16:13:18Z kib + * created from FreeBSD: stable/11/sys/compat/freebsd32/syscalls.master 313450 2017-02-08 18:32:35Z jhb */ const char *freebsd32_syscallnames[] = { Modified: stable/11/sys/compat/freebsd32/freebsd32_sysent.c ============================================================================== --- stable/11/sys/compat/freebsd32/freebsd32_sysent.c Wed Feb 8 18:32:53 2017 (r313451) +++ stable/11/sys/compat/freebsd32/freebsd32_sysent.c Wed Feb 8 18:33:00 2017 (r313452) @@ -3,7 +3,7 @@ * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD: stable/11/sys/compat/freebsd32/syscalls.master 306586 2016-10-02 16:13:18Z kib + * created from FreeBSD: stable/11/sys/compat/freebsd32/syscalls.master 313450 2017-02-08 18:32:35Z jhb */ #include "opt_compat.h" Modified: stable/11/sys/compat/freebsd32/freebsd32_systrace_args.c ============================================================================== --- stable/11/sys/compat/freebsd32/freebsd32_systrace_args.c Wed Feb 8 18:32:53 2017 (r313451) +++ stable/11/sys/compat/freebsd32/freebsd32_systrace_args.c Wed Feb 8 18:33:00 2017 (r313452) @@ -1969,7 +1969,7 @@ systrace_args(int sysnum, void *params, struct getfsstat_args *p = params; uarg[0] = (intptr_t) p->buf; /* struct statfs * */ iarg[1] = p->bufsize; /* long */ - iarg[2] = p->flags; /* int */ + iarg[2] = p->mode; /* int */ *n_args = 3; break; } Modified: stable/11/sys/kern/init_sysent.c ============================================================================== --- stable/11/sys/kern/init_sysent.c Wed Feb 8 18:32:53 2017 (r313451) +++ stable/11/sys/kern/init_sysent.c Wed Feb 8 18:33:00 2017 (r313452) @@ -3,7 +3,7 @@ * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD: stable/11/sys/kern/syscalls.master 304977 2016-08-29 05:15:43Z kib + * created from FreeBSD: stable/11/sys/kern/syscalls.master 313450 2017-02-08 18:32:35Z jhb */ #include "opt_compat.h" Modified: stable/11/sys/kern/syscalls.c ============================================================================== --- stable/11/sys/kern/syscalls.c Wed Feb 8 18:32:53 2017 (r313451) +++ stable/11/sys/kern/syscalls.c Wed Feb 8 18:33:00 2017 (r313452) @@ -3,7 +3,7 @@ * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD: stable/11/sys/kern/syscalls.master 304977 2016-08-29 05:15:43Z kib + * created from FreeBSD: stable/11/sys/kern/syscalls.master 313450 2017-02-08 18:32:35Z jhb */ const char *syscallnames[] = { Modified: stable/11/sys/kern/systrace_args.c ============================================================================== --- stable/11/sys/kern/systrace_args.c Wed Feb 8 18:32:53 2017 (r313451) +++ stable/11/sys/kern/systrace_args.c Wed Feb 8 18:33:00 2017 (r313452) @@ -2081,7 +2081,7 @@ systrace_args(int sysnum, void *params, struct getfsstat_args *p = params; uarg[0] = (intptr_t) p->buf; /* struct statfs * */ iarg[1] = p->bufsize; /* long */ - iarg[2] = p->flags; /* int */ + iarg[2] = p->mode; /* int */ *n_args = 3; break; } Modified: stable/11/sys/sys/syscall.h ============================================================================== --- stable/11/sys/sys/syscall.h Wed Feb 8 18:32:53 2017 (r313451) +++ stable/11/sys/sys/syscall.h Wed Feb 8 18:33:00 2017 (r313452) @@ -3,7 +3,7 @@ * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD: stable/11/sys/kern/syscalls.master 304977 2016-08-29 05:15:43Z kib + * created from FreeBSD: stable/11/sys/kern/syscalls.master 313450 2017-02-08 18:32:35Z jhb */ #define SYS_syscall 0 Modified: stable/11/sys/sys/syscall.mk ============================================================================== --- stable/11/sys/sys/syscall.mk Wed Feb 8 18:32:53 2017 (r313451) +++ stable/11/sys/sys/syscall.mk Wed Feb 8 18:33:00 2017 (r313452) @@ -1,7 +1,7 @@ # FreeBSD system call object files. # DO NOT EDIT-- this file is automatically generated. # $FreeBSD$ -# created from FreeBSD: stable/11/sys/kern/syscalls.master 304977 2016-08-29 05:15:43Z kib +# created from FreeBSD: stable/11/sys/kern/syscalls.master 313450 2017-02-08 18:32:35Z jhb MIASM = \ syscall.o \ exit.o \ Modified: stable/11/sys/sys/sysproto.h ============================================================================== --- stable/11/sys/sys/sysproto.h Wed Feb 8 18:32:53 2017 (r313451) +++ stable/11/sys/sys/sysproto.h Wed Feb 8 18:33:00 2017 (r313452) @@ -3,7 +3,7 @@ * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD: stable/11/sys/kern/syscalls.master 304977 2016-08-29 05:15:43Z kib + * created from FreeBSD: stable/11/sys/kern/syscalls.master 313450 2017-02-08 18:32:35Z jhb */ #ifndef _SYS_SYSPROTO_H_ @@ -1107,7 +1107,7 @@ struct mac_syscall_args { struct getfsstat_args { char buf_l_[PADL_(struct statfs *)]; struct statfs * buf; char buf_r_[PADR_(struct statfs *)]; char bufsize_l_[PADL_(long)]; long bufsize; char bufsize_r_[PADR_(long)]; - char flags_l_[PADL_(int)]; int flags; char flags_r_[PADR_(int)]; + char mode_l_[PADL_(int)]; int mode; char mode_r_[PADR_(int)]; }; struct statfs_args { char path_l_[PADL_(char *)]; char * path; char path_r_[PADR_(char *)]; @@ -2356,7 +2356,7 @@ int ogetdirentries(struct thread *, stru struct freebsd4_getfsstat_args { char buf_l_[PADL_(struct ostatfs *)]; struct ostatfs * buf; char buf_r_[PADR_(struct ostatfs *)]; char bufsize_l_[PADL_(long)]; long bufsize; char bufsize_r_[PADR_(long)]; - char flags_l_[PADL_(int)]; int flags; char flags_r_[PADR_(int)]; + char mode_l_[PADL_(int)]; int mode; char mode_r_[PADR_(int)]; }; struct freebsd4_statfs_args { char path_l_[PADL_(char *)]; char * path; char path_r_[PADR_(char *)]; From owner-svn-src-stable-11@freebsd.org Wed Feb 8 20:08:39 2017 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 76E52CD6C5B; Wed, 8 Feb 2017 20:08:39 +0000 (UTC) (envelope-from vangyzen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 3720C1BD0; Wed, 8 Feb 2017 20:08:39 +0000 (UTC) (envelope-from vangyzen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v18K8cwX040087; Wed, 8 Feb 2017 20:08:38 GMT (envelope-from vangyzen@FreeBSD.org) Received: (from vangyzen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v18K8cib040084; Wed, 8 Feb 2017 20:08:38 GMT (envelope-from vangyzen@FreeBSD.org) Message-Id: <201702082008.v18K8cib040084@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: vangyzen set sender to vangyzen@FreeBSD.org using -f From: Eric van Gyzen Date: Wed, 8 Feb 2017 20:08:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r313456 - stable/11/sys/dev/pci X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 08 Feb 2017 20:08:39 -0000 Author: vangyzen Date: Wed Feb 8 20:08:38 2017 New Revision: 313456 URL: https://svnweb.freebsd.org/changeset/base/313456 Log: MFC r313180 PCIe HotPlug: remove tests for DL active link capability As of r313097, the HotPlug code requires the link to support reporting of the data-link status. Remove tests for this capability from code that can now assume its presence. Sponsored by: Dell EMC Modified: stable/11/sys/dev/pci/pci_pci.c stable/11/sys/dev/pci/pcib_private.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/pci/pci_pci.c ============================================================================== --- stable/11/sys/dev/pci/pci_pci.c Wed Feb 8 19:29:34 2017 (r313455) +++ stable/11/sys/dev/pci/pci_pci.c Wed Feb 8 20:08:38 2017 (r313456) @@ -918,6 +918,7 @@ static void pcib_probe_hotplug(struct pcib_softc *sc) { device_t dev; + uint32_t link_cap; uint16_t link_sta, slot_sta; if (!pci_enable_pcie_hp) @@ -930,12 +931,12 @@ pcib_probe_hotplug(struct pcib_softc *sc if (!(pcie_read_config(dev, PCIER_FLAGS, 2) & PCIEM_FLAGS_SLOT)) return; - sc->pcie_link_cap = pcie_read_config(dev, PCIER_LINK_CAP, 4); sc->pcie_slot_cap = pcie_read_config(dev, PCIER_SLOT_CAP, 4); if ((sc->pcie_slot_cap & PCIEM_SLOT_CAP_HPC) == 0) return; - if ((sc->pcie_link_cap & PCIEM_LINK_CAP_DL_ACTIVE) == 0) + link_cap = pcie_read_config(dev, PCIER_LINK_CAP, 4); + if ((link_cap & PCIEM_LINK_CAP_DL_ACTIVE) == 0) return; /* @@ -947,8 +948,7 @@ pcib_probe_hotplug(struct pcib_softc *sc * If there is an open MRL but the Data Link Layer is active, * the MRL is not real. */ - if ((sc->pcie_slot_cap & PCIEM_SLOT_CAP_MRLSP) != 0 && - (sc->pcie_link_cap & PCIEM_LINK_CAP_DL_ACTIVE) != 0) { + if ((sc->pcie_slot_cap & PCIEM_SLOT_CAP_MRLSP) != 0) { link_sta = pcie_read_config(dev, PCIER_LINK_STA, 2); slot_sta = pcie_read_config(dev, PCIER_SLOT_STA, 2); if ((slot_sta & PCIEM_SLOT_STA_MRLSS) != 0 && @@ -1061,10 +1061,8 @@ pcib_hotplug_present(struct pcib_softc * return (0); /* Require the Data Link Layer to be active. */ - if (sc->pcie_link_cap & PCIEM_LINK_CAP_DL_ACTIVE) { - if (!(sc->pcie_link_sta & PCIEM_LINK_STA_DL_ACTIVE)) - return (0); - } + if (!(sc->pcie_link_sta & PCIEM_LINK_STA_DL_ACTIVE)) + return (0); return (-1); } @@ -1121,20 +1119,18 @@ pcib_pcie_hotplug_update(struct pcib_sof * changed on this interrupt. Stop any scheduled timer if * the Data Link Layer is active. */ - if (sc->pcie_link_cap & PCIEM_LINK_CAP_DL_ACTIVE) { - if (card_inserted && - !(sc->pcie_link_sta & PCIEM_LINK_STA_DL_ACTIVE) && - sc->pcie_slot_sta & - (PCIEM_SLOT_STA_MRLSC | PCIEM_SLOT_STA_PDC)) { - if (cold) - device_printf(sc->dev, - "Data Link Layer inactive\n"); - else - callout_reset(&sc->pcie_dll_timer, hz, - pcib_pcie_dll_timeout, sc); - } else if (sc->pcie_link_sta & PCIEM_LINK_STA_DL_ACTIVE) - callout_stop(&sc->pcie_dll_timer); - } + if (card_inserted && + !(sc->pcie_link_sta & PCIEM_LINK_STA_DL_ACTIVE) && + sc->pcie_slot_sta & + (PCIEM_SLOT_STA_MRLSC | PCIEM_SLOT_STA_PDC)) { + if (cold) + device_printf(sc->dev, + "Data Link Layer inactive\n"); + else + callout_reset(&sc->pcie_dll_timer, hz, + pcib_pcie_dll_timeout, sc); + } else if (sc->pcie_link_sta & PCIEM_LINK_STA_DL_ACTIVE) + callout_stop(&sc->pcie_dll_timer); pcib_pcie_hotplug_command(sc, val, mask); @@ -1384,7 +1380,7 @@ pcib_setup_hotplug(struct pcib_softc *sc mask = PCIEM_SLOT_CTL_DLLSCE | PCIEM_SLOT_CTL_HPIE | PCIEM_SLOT_CTL_CCIE | PCIEM_SLOT_CTL_PDCE | PCIEM_SLOT_CTL_MRLSCE | PCIEM_SLOT_CTL_PFDE | PCIEM_SLOT_CTL_ABPE; - val = PCIEM_SLOT_CTL_PDCE | PCIEM_SLOT_CTL_HPIE; + val = PCIEM_SLOT_CTL_DLLSCE | PCIEM_SLOT_CTL_HPIE | PCIEM_SLOT_CTL_PDCE; if (sc->pcie_slot_cap & PCIEM_SLOT_CAP_APB) val |= PCIEM_SLOT_CTL_ABPE; if (sc->pcie_slot_cap & PCIEM_SLOT_CAP_PCP) @@ -1393,8 +1389,6 @@ pcib_setup_hotplug(struct pcib_softc *sc val |= PCIEM_SLOT_CTL_MRLSCE; if (!(sc->pcie_slot_cap & PCIEM_SLOT_CAP_NCCS)) val |= PCIEM_SLOT_CTL_CCIE; - if (sc->pcie_link_cap & PCIEM_LINK_CAP_DL_ACTIVE) - val |= PCIEM_SLOT_CTL_DLLSCE; /* Turn the attention indicator off. */ if (sc->pcie_slot_cap & PCIEM_SLOT_CAP_AIP) { Modified: stable/11/sys/dev/pci/pcib_private.h ============================================================================== --- stable/11/sys/dev/pci/pcib_private.h Wed Feb 8 19:29:34 2017 (r313455) +++ stable/11/sys/dev/pci/pcib_private.h Wed Feb 8 20:08:38 2017 (r313456) @@ -132,7 +132,6 @@ struct pcib_softc uint16_t bridgectl; /* bridge control register */ uint16_t pcie_link_sta; uint16_t pcie_slot_sta; - uint32_t pcie_link_cap; uint32_t pcie_slot_cap; struct resource *pcie_irq; void *pcie_ihand; From owner-svn-src-stable-11@freebsd.org Thu Feb 9 00:28:04 2017 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5D4E9CD6ACA; Thu, 9 Feb 2017 00:28:04 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 1E8AC1DAC; Thu, 9 Feb 2017 00:28:04 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v190S3Bq049586; Thu, 9 Feb 2017 00:28:03 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v190S3NE049585; Thu, 9 Feb 2017 00:28:03 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201702090028.v190S3NE049585@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Thu, 9 Feb 2017 00:28:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r313460 - stable/11/sys/kern X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 09 Feb 2017 00:28:04 -0000 Author: markj Date: Thu Feb 9 00:28:03 2017 New Revision: 313460 URL: https://svnweb.freebsd.org/changeset/base/313460 Log: MFC r311901: Do not set BIO_DONE if the BIO specifies a completion handler. Modified: stable/11/sys/kern/vfs_bio.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/kern/vfs_bio.c ============================================================================== --- stable/11/sys/kern/vfs_bio.c Wed Feb 8 23:17:23 2017 (r313459) +++ stable/11/sys/kern/vfs_bio.c Thu Feb 9 00:28:03 2017 (r313460) @@ -3929,10 +3929,8 @@ biodone(struct bio *bp) bp->bio_flags |= BIO_DONE; wakeup(bp); mtx_unlock(mtxp); - } else { - bp->bio_flags |= BIO_DONE; + } else done(bp); - } } /* From owner-svn-src-stable-11@freebsd.org Thu Feb 9 02:08:43 2017 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id F27A6CD6B83; Thu, 9 Feb 2017 02:08:43 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C18E6185F; Thu, 9 Feb 2017 02:08:43 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v1928gx3090425; Thu, 9 Feb 2017 02:08:42 GMT (envelope-from cy@FreeBSD.org) Received: (from cy@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v1928gTJ090424; Thu, 9 Feb 2017 02:08:42 GMT (envelope-from cy@FreeBSD.org) Message-Id: <201702090208.v1928gTJ090424@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cy set sender to cy@FreeBSD.org using -f From: Cy Schubert Date: Thu, 9 Feb 2017 02:08:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r313461 - in stable: 10/contrib/ipfilter/tools 11/contrib/ipfilter/tools X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 09 Feb 2017 02:08:44 -0000 Author: cy Date: Thu Feb 9 02:08:42 2017 New Revision: 313461 URL: https://svnweb.freebsd.org/changeset/base/313461 Log: MFC r312791: Use normal KNF cuddling of elses. Reported by: bde Modified: stable/11/contrib/ipfilter/tools/ipf.c Directory Properties: stable/11/ (props changed) Changes in other areas also in this revision: Modified: stable/10/contrib/ipfilter/tools/ipf.c Directory Properties: stable/10/ (props changed) Modified: stable/11/contrib/ipfilter/tools/ipf.c ============================================================================== --- stable/11/contrib/ipfilter/tools/ipf.c Thu Feb 9 00:28:03 2017 (r313460) +++ stable/11/contrib/ipfilter/tools/ipf.c Thu Feb 9 02:08:42 2017 (r313461) @@ -408,8 +408,7 @@ static void flushfilter(arg, filter) } closedevice(); return; - } - else if (strchr(arg, 'i') || strchr(arg, 'I')) + } else if (strchr(arg, 'i') || strchr(arg, 'I')) fl = FR_INQUE; else if (strchr(arg, 'o') || strchr(arg, 'O')) fl = FR_OUTQUE; From owner-svn-src-stable-11@freebsd.org Thu Feb 9 04:42:22 2017 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id AAB7ACD7C03; Thu, 9 Feb 2017 04:42:22 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 603261257; Thu, 9 Feb 2017 04:42:22 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v194gLdT053876; Thu, 9 Feb 2017 04:42:21 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v194gL83053873; Thu, 9 Feb 2017 04:42:21 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201702090442.v194gL83053873@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Thu, 9 Feb 2017 04:42:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r313463 - in stable/11/sys/i386: i386 isa X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 09 Feb 2017 04:42:22 -0000 Author: kib Date: Thu Feb 9 04:42:21 2017 New Revision: 313463 URL: https://svnweb.freebsd.org/changeset/base/313463 Log: MFC r313109: Use ANSI definitions for some i386 functions. Modified: stable/11/sys/i386/i386/machdep.c stable/11/sys/i386/i386/vm_machdep.c stable/11/sys/i386/isa/npx.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/i386/i386/machdep.c ============================================================================== --- stable/11/sys/i386/i386/machdep.c Thu Feb 9 04:07:30 2017 (r313462) +++ stable/11/sys/i386/i386/machdep.c Thu Feb 9 04:42:21 2017 (r313463) @@ -2444,8 +2444,7 @@ i386_kdb_init(void) } register_t -init386(first) - int first; +init386(int first) { struct gate_descriptor *gdp; int gsel_tss, metadata_missing, x, pa; Modified: stable/11/sys/i386/i386/vm_machdep.c ============================================================================== --- stable/11/sys/i386/i386/vm_machdep.c Thu Feb 9 04:07:30 2017 (r313462) +++ stable/11/sys/i386/i386/vm_machdep.c Thu Feb 9 04:42:21 2017 (r313463) @@ -176,11 +176,7 @@ alloc_fpusave(int flags) * ready to run and return to user mode. */ void -cpu_fork(td1, p2, td2, flags) - register struct thread *td1; - register struct proc *p2; - struct thread *td2; - int flags; +cpu_fork(struct thread *td1, struct proc *p2, struct thread *td2, int flags) { register struct proc *p1; struct pcb *pcb2; Modified: stable/11/sys/i386/isa/npx.c ============================================================================== --- stable/11/sys/i386/isa/npx.c Thu Feb 9 04:07:30 2017 (r313462) +++ stable/11/sys/i386/isa/npx.c Thu Feb 9 04:42:21 2017 (r313463) @@ -550,8 +550,7 @@ SYSINIT(npxinitstate, SI_SUB_DRIVERS, SI * Free coprocessor (if we have it). */ void -npxexit(td) - struct thread *td; +npxexit(struct thread *td) { critical_enter(); @@ -581,7 +580,7 @@ npxexit(td) } int -npxformat() +npxformat(void) { if (!hw_float) @@ -961,7 +960,7 @@ npxresume(union savefpu *addr) } void -npxdrop() +npxdrop(void) { struct thread *td; @@ -1297,8 +1296,7 @@ fpu_clean_state(void) #endif /* CPU_ENABLE_SSE */ static void -fpurstor(addr) - union savefpu *addr; +fpurstor(union savefpu *addr) { #ifdef CPU_ENABLE_SSE From owner-svn-src-stable-11@freebsd.org Fri Feb 10 01:18:16 2017 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8E4CCCD8A54; Fri, 10 Feb 2017 01:18:16 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 436A01031; Fri, 10 Feb 2017 01:18:16 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v1A1IFc9068186; Fri, 10 Feb 2017 01:18:15 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v1A1IFOD068185; Fri, 10 Feb 2017 01:18:15 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201702100118.v1A1IFOD068185@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Fri, 10 Feb 2017 01:18:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r313499 - stable/11/contrib/elftoolchain/libelftc X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 10 Feb 2017 01:18:16 -0000 Author: emaste Date: Fri Feb 10 01:18:15 2017 New Revision: 313499 URL: https://svnweb.freebsd.org/changeset/base/313499 Log: MFC r311946: readelf: add S390 relocation types From https://refspecs.linuxfoundation.org/ELF/zSeries/lzsabi0_zSeries.html Modified: stable/11/contrib/elftoolchain/libelftc/elftc_reloc_type_str.c Directory Properties: stable/11/ (props changed) Modified: stable/11/contrib/elftoolchain/libelftc/elftc_reloc_type_str.c ============================================================================== --- stable/11/contrib/elftoolchain/libelftc/elftc_reloc_type_str.c Fri Feb 10 01:13:12 2017 (r313498) +++ stable/11/contrib/elftoolchain/libelftc/elftc_reloc_type_str.c Fri Feb 10 01:18:15 2017 (r313499) @@ -664,6 +664,37 @@ elftc_reloc_type_str(unsigned int mach, case 48: return "R_RISCV_GPREL_S"; } break; + case EM_S390: + switch (type) { + case 0: return "R_390_NONE"; + case 1: return "R_390_8"; + case 2: return "R_390_12"; + case 3: return "R_390_16"; + case 4: return "R_390_32"; + case 5: return "R_390_PC32"; + case 6: return "R_390_GOT12"; + case 7: return "R_390_GOT32"; + case 8: return "R_390_PLT32"; + case 9: return "R_390_COPY"; + case 10: return "R_390_GLOB_DAT"; + case 11: return "R_390_JMP_SLOT"; + case 12: return "R_390_RELATIVE"; + case 13: return "R_390_GOTOFF"; + case 14: return "R_390_GOTPC"; + case 15: return "R_390_GOT16"; + case 16: return "R_390_PC16"; + case 17: return "R_390_PC16DBL"; + case 18: return "R_390_PLT16DBL"; + case 19: return "R_390_PC32DBL"; + case 20: return "R_390_PLT32DBL"; + case 21: return "R_390_GOTPCDBL"; + case 22: return "R_390_64"; + case 23: return "R_390_PC64"; + case 24: return "R_390_GOT64"; + case 25: return "R_390_PLT64"; + case 26: return "R_390_GOTENT"; + } + break; case EM_SPARC: case EM_SPARCV9: switch(type) { From owner-svn-src-stable-11@freebsd.org Fri Feb 10 02:27:49 2017 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id DCAD7CD8283; Fri, 10 Feb 2017 02:27:49 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 929711C4A; Fri, 10 Feb 2017 02:27:49 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v1A2RmAF097067; Fri, 10 Feb 2017 02:27:48 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v1A2Rmee097065; Fri, 10 Feb 2017 02:27:48 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201702100227.v1A2Rmee097065@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Fri, 10 Feb 2017 02:27:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r313506 - stable/11/contrib/elftoolchain/libelftc X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 10 Feb 2017 02:27:50 -0000 Author: emaste Date: Fri Feb 10 02:27:48 2017 New Revision: 313506 URL: https://svnweb.freebsd.org/changeset/base/313506 Log: MFC r308430, r309782: libelftc: add elf{32,64}-trad{big,little}mips Modified: stable/11/contrib/elftoolchain/libelftc/elftc_bfd_find_target.3 stable/11/contrib/elftoolchain/libelftc/libelftc_bfdtarget.c Directory Properties: stable/11/ (props changed) Modified: stable/11/contrib/elftoolchain/libelftc/elftc_bfd_find_target.3 ============================================================================== --- stable/11/contrib/elftoolchain/libelftc/elftc_bfd_find_target.3 Fri Feb 10 02:21:57 2017 (r313505) +++ stable/11/contrib/elftoolchain/libelftc/elftc_bfd_find_target.3 Fri Feb 10 02:27:48 2017 (r313506) @@ -82,6 +82,8 @@ Known descriptor names and their propert .It Li elf32-shbig-linux Ta ELF Ta MSB Ta 32 .It Li elf32-shl-linux Ta ELF Ta LSB Ta 32 .It Li elf32-sparc Ta ELF Ta MSB Ta 32 +.It Li elf32-tradbigmips Ta ELF Ta MSB Ta 32 +.It Li elf32-tradlittlemips Ta ELF Ta LSB Ta 32 .It Li elf64-alpha Ta ELF Ta LSB Ta 64 .It Li elf64-alpha-freebsd Ta ELF Ta LSB Ta 64 .It Li elf64-big Ta ELF Ta MSB Ta 64 @@ -101,6 +103,8 @@ Known descriptor names and their propert .It Li elf64-sh64-linux Ta ELF Ta LSB Ta 64 .It Li elf64-sparc Ta ELF Ta MSB Ta 64 .It Li elf64-sparc-freebsd Ta ELF Ta MSB Ta 64 +.It Li elf64-tradbigmips Ta ELF Ta MSB Ta 64 +.It Li elf64-tradlittlemips Ta ELF Ta LSB Ta 64 .It Li elf64-x86-64 Ta ELF Ta LSB Ta 64 .It Li elf64-x86-64-freebsd Ta ELF Ta LSB Ta 64 .It Li ihex Ta IHEX Ta - Ta - Modified: stable/11/contrib/elftoolchain/libelftc/libelftc_bfdtarget.c ============================================================================== --- stable/11/contrib/elftoolchain/libelftc/libelftc_bfdtarget.c Fri Feb 10 02:21:57 2017 (r313505) +++ stable/11/contrib/elftoolchain/libelftc/libelftc_bfdtarget.c Fri Feb 10 02:27:48 2017 (r313506) @@ -195,6 +195,22 @@ struct _Elftc_Bfd_Target _libelftc_targe }, { + .bt_name = "elf32-tradbigmips", + .bt_type = ETF_ELF, + .bt_byteorder = ELFDATA2MSB, + .bt_elfclass = ELFCLASS32, + .bt_machine = EM_MIPS, + }, + + { + .bt_name = "elf32-tradlittlemips", + .bt_type = ETF_ELF, + .bt_byteorder = ELFDATA2LSB, + .bt_elfclass = ELFCLASS32, + .bt_machine = EM_MIPS, + }, + + { .bt_name = "elf64-alpha", .bt_type = ETF_ELF, .bt_byteorder = ELFDATA2LSB, @@ -351,6 +367,22 @@ struct _Elftc_Bfd_Target _libelftc_targe }, { + .bt_name = "elf64-tradbigmips", + .bt_type = ETF_ELF, + .bt_byteorder = ELFDATA2MSB, + .bt_elfclass = ELFCLASS64, + .bt_machine = EM_MIPS, + }, + + { + .bt_name = "elf64-tradlittlemips", + .bt_type = ETF_ELF, + .bt_byteorder = ELFDATA2LSB, + .bt_elfclass = ELFCLASS64, + .bt_machine = EM_MIPS, + }, + + { .bt_name = "elf64-x86-64", .bt_type = ETF_ELF, .bt_byteorder = ELFDATA2LSB, From owner-svn-src-stable-11@freebsd.org Fri Feb 10 05:14:21 2017 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 30B41CD6E1B; Fri, 10 Feb 2017 05:14:21 +0000 (UTC) (envelope-from vangyzen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id EDFFD1BCA; Fri, 10 Feb 2017 05:14:20 +0000 (UTC) (envelope-from vangyzen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v1A5EKnA068224; Fri, 10 Feb 2017 05:14:20 GMT (envelope-from vangyzen@FreeBSD.org) Received: (from vangyzen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v1A5EK91068223; Fri, 10 Feb 2017 05:14:20 GMT (envelope-from vangyzen@FreeBSD.org) Message-Id: <201702100514.v1A5EK91068223@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: vangyzen set sender to vangyzen@FreeBSD.org using -f From: Eric van Gyzen Date: Fri, 10 Feb 2017 05:14:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r313523 - stable/11/sys/netinet X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 10 Feb 2017 05:14:21 -0000 Author: vangyzen Date: Fri Feb 10 05:14:19 2017 New Revision: 313523 URL: https://svnweb.freebsd.org/changeset/base/313523 Log: MFC r313401 Fix garbage IP addresses in UDP log_in_vain messages If multiple threads emit a UDP log_in_vain message concurrently, or indeed call inet_ntoa() for any other reason, the IP addresses could be garbage due to concurrent usage of a single string buffer inside inet_ntoa(). Use inet_ntoa_r() with two stack buffers instead. Relnotes: yes Sponsored by: Dell EMC Modified: stable/11/sys/netinet/udp_usrreq.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/netinet/udp_usrreq.c ============================================================================== --- stable/11/sys/netinet/udp_usrreq.c Fri Feb 10 04:28:44 2017 (r313522) +++ stable/11/sys/netinet/udp_usrreq.c Fri Feb 10 05:14:19 2017 (r313523) @@ -674,13 +674,13 @@ udp_input(struct mbuf **mp, int *offp, i INPLOOKUP_RLOCKPCB, ifp, m); if (inp == NULL) { if (udp_log_in_vain) { - char buf[4*sizeof "123"]; + char src[INET_ADDRSTRLEN]; + char dst[INET_ADDRSTRLEN]; - strcpy(buf, inet_ntoa(ip->ip_dst)); log(LOG_INFO, "Connection attempt to UDP %s:%d from %s:%d\n", - buf, ntohs(uh->uh_dport), inet_ntoa(ip->ip_src), - ntohs(uh->uh_sport)); + inet_ntoa_r(ip->ip_dst, dst), ntohs(uh->uh_dport), + inet_ntoa_r(ip->ip_src, src), ntohs(uh->uh_sport)); } UDPSTAT_INC(udps_noport); if (m->m_flags & (M_BCAST | M_MCAST)) { From owner-svn-src-stable-11@freebsd.org Fri Feb 10 06:31:32 2017 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6A2E3CD8B8B; Fri, 10 Feb 2017 06:31:32 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 36E5F1253; Fri, 10 Feb 2017 06:31:32 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v1A6VV8r000930; Fri, 10 Feb 2017 06:31:31 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v1A6VVkX000929; Fri, 10 Feb 2017 06:31:31 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201702100631.v1A6VVkX000929@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Ngie Cooper Date: Fri, 10 Feb 2017 06:31:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r313531 - stable/11/lib/libc/db/hash X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 10 Feb 2017 06:31:32 -0000 Author: ngie Date: Fri Feb 10 06:31:31 2017 New Revision: 313531 URL: https://svnweb.freebsd.org/changeset/base/313531 Log: MFC r306349: r306349 (by pfg): hash(3): protect in-memory page when using cross-endianness. When writing out pages in the "other endian" format, make a copy instead of trashing the in-memory one. Obtained from: NetBSD (CVS rev. 1.29) Modified: stable/11/lib/libc/db/hash/hash_page.c Directory Properties: stable/11/ (props changed) Modified: stable/11/lib/libc/db/hash/hash_page.c ============================================================================== --- stable/11/lib/libc/db/hash/hash_page.c Fri Feb 10 06:20:27 2017 (r313530) +++ stable/11/lib/libc/db/hash/hash_page.c Fri Feb 10 06:31:31 2017 (r313531) @@ -572,7 +572,9 @@ __get_page(HTAB *hashp, char *p, u_int32 int __put_page(HTAB *hashp, char *p, u_int32_t bucket, int is_bucket, int is_bitmap) { - int fd, page, size, wsize; + int fd, page, size; + ssize_t wsize; + char pbuf[MAX_BSIZE]; size = hashp->BSIZE; if ((hashp->fp == -1) && open_temp(hashp)) @@ -582,15 +584,18 @@ __put_page(HTAB *hashp, char *p, u_int32 if (hashp->LORDER != BYTE_ORDER) { int i, max; + memcpy(pbuf, p, size); if (is_bitmap) { max = hashp->BSIZE >> 2; /* divide by 4 */ for (i = 0; i < max; i++) - M_32_SWAP(((int *)p)[i]); + M_32_SWAP(((int *)pbuf)[i]); } else { - max = ((u_int16_t *)p)[0] + 2; + uint16_t *bp = (uint16_t *)(void *)pbuf; + max = bp[0] + 2; for (i = 0; i <= max; i++) - M_16_SWAP(((u_int16_t *)p)[i]); + M_16_SWAP(bp[i]); } + p = pbuf; } if (is_bucket) page = BUCKET_TO_PAGE(bucket); From owner-svn-src-stable-11@freebsd.org Fri Feb 10 07:22:14 2017 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B2DD4CD1AE8; Fri, 10 Feb 2017 07:22:14 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 505DAFB7; Fri, 10 Feb 2017 07:22:14 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v1A7MDne022244; Fri, 10 Feb 2017 07:22:13 GMT (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v1A7MCKf022234; Fri, 10 Feb 2017 07:22:12 GMT (envelope-from glebius@FreeBSD.org) Message-Id: <201702100722.v1A7MCKf022234@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: glebius set sender to glebius@FreeBSD.org using -f From: Gleb Smirnoff Date: Fri, 10 Feb 2017 07:22:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r313537 - in stable/11: contrib/tcpdump contrib/tcpdump/lbl contrib/tcpdump/missing usr.sbin/tcpdump/tcpdump X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 10 Feb 2017 07:22:14 -0000 Author: glebius Date: Fri Feb 10 07:22:12 2017 New Revision: 313537 URL: https://svnweb.freebsd.org/changeset/base/313537 Log: Merge r309649, r313048, r313083, r313104: tcpdump 4.9.0 Added: stable/11/contrib/tcpdump/CONTRIBUTING - copied unchanged from r313048, head/contrib/tcpdump/CONTRIBUTING stable/11/contrib/tcpdump/PLATFORMS - copied unchanged from r313048, head/contrib/tcpdump/PLATFORMS stable/11/contrib/tcpdump/README - copied unchanged from r313048, head/contrib/tcpdump/README stable/11/contrib/tcpdump/addrtostr.c - copied unchanged from r313048, head/contrib/tcpdump/addrtostr.c stable/11/contrib/tcpdump/addrtostr.h - copied unchanged from r313048, head/contrib/tcpdump/addrtostr.h stable/11/contrib/tcpdump/ascii_strcasecmp.c - copied unchanged from r313048, head/contrib/tcpdump/ascii_strcasecmp.c stable/11/contrib/tcpdump/ascii_strcasecmp.h - copied unchanged from r313048, head/contrib/tcpdump/ascii_strcasecmp.h stable/11/contrib/tcpdump/netdissect-stdinc.h - copied unchanged from r313048, head/contrib/tcpdump/netdissect-stdinc.h stable/11/contrib/tcpdump/netdissect.c - copied unchanged from r313048, head/contrib/tcpdump/netdissect.c stable/11/contrib/tcpdump/print-hncp.c - copied unchanged from r313048, head/contrib/tcpdump/print-hncp.c stable/11/contrib/tcpdump/print-lisp.c - copied unchanged from r313048, head/contrib/tcpdump/print-lisp.c stable/11/contrib/tcpdump/print-medsa.c - copied unchanged from r313048, head/contrib/tcpdump/print-medsa.c stable/11/contrib/tcpdump/print-nsh.c - copied unchanged from r313048, head/contrib/tcpdump/print-nsh.c stable/11/contrib/tcpdump/print-resp.c - copied unchanged from r313048, head/contrib/tcpdump/print-resp.c stable/11/contrib/tcpdump/print-vxlan-gpe.c - copied unchanged from r313048, head/contrib/tcpdump/print-vxlan-gpe.c stable/11/contrib/tcpdump/print.c - copied unchanged from r313048, head/contrib/tcpdump/print.c stable/11/contrib/tcpdump/print.h - copied unchanged from r313048, head/contrib/tcpdump/print.h stable/11/contrib/tcpdump/strtoaddr.c - copied unchanged from r313048, head/contrib/tcpdump/strtoaddr.c stable/11/contrib/tcpdump/strtoaddr.h - copied unchanged from r313048, head/contrib/tcpdump/strtoaddr.h stable/11/contrib/tcpdump/timeval-operations.h - copied unchanged from r313048, head/contrib/tcpdump/timeval-operations.h stable/11/contrib/tcpdump/util-print.c - copied unchanged from r313048, head/contrib/tcpdump/util-print.c Deleted: stable/11/contrib/tcpdump/.cvsignore stable/11/contrib/tcpdump/atmuni31.h stable/11/contrib/tcpdump/missing/addrinfo.h stable/11/contrib/tcpdump/missing/getnameinfo.c stable/11/contrib/tcpdump/missing/inet_aton.c stable/11/contrib/tcpdump/missing/inet_ntop.c stable/11/contrib/tcpdump/missing/inet_pton.c stable/11/contrib/tcpdump/strcasecmp.c stable/11/contrib/tcpdump/tcpdump-stdinc.h stable/11/contrib/tcpdump/util.c Modified: stable/11/contrib/tcpdump/CHANGES (contents, props changed) stable/11/contrib/tcpdump/CREDITS (contents, props changed) stable/11/contrib/tcpdump/INSTALL.txt (contents, props changed) stable/11/contrib/tcpdump/Makefile.in (contents, props changed) stable/11/contrib/tcpdump/VERSION (contents, props changed) stable/11/contrib/tcpdump/addrtoname.c (contents, props changed) stable/11/contrib/tcpdump/addrtoname.h (contents, props changed) stable/11/contrib/tcpdump/af.c (contents, props changed) stable/11/contrib/tcpdump/af.h (contents, props changed) stable/11/contrib/tcpdump/bpf_dump.c (contents, props changed) stable/11/contrib/tcpdump/checksum.c (contents, props changed) stable/11/contrib/tcpdump/config.h.in (contents, props changed) stable/11/contrib/tcpdump/configure (contents, props changed) stable/11/contrib/tcpdump/configure.in (contents, props changed) stable/11/contrib/tcpdump/cpack.c (contents, props changed) stable/11/contrib/tcpdump/cpack.h (contents, props changed) stable/11/contrib/tcpdump/ether.h (contents, props changed) stable/11/contrib/tcpdump/ethertype.h (contents, props changed) stable/11/contrib/tcpdump/extract.h (contents, props changed) stable/11/contrib/tcpdump/getopt_long.h (contents, props changed) stable/11/contrib/tcpdump/gmpls.c (contents, props changed) stable/11/contrib/tcpdump/gmt2local.c (contents, props changed) stable/11/contrib/tcpdump/in_cksum.c (contents, props changed) stable/11/contrib/tcpdump/interface.h (contents, props changed) stable/11/contrib/tcpdump/ip.h (contents, props changed) stable/11/contrib/tcpdump/ip6.h (contents, props changed) stable/11/contrib/tcpdump/ipproto.c (contents, props changed) stable/11/contrib/tcpdump/ipproto.h (contents, props changed) stable/11/contrib/tcpdump/l2vpn.c (contents, props changed) stable/11/contrib/tcpdump/l2vpn.h (contents, props changed) stable/11/contrib/tcpdump/lbl/os-solaris2.h (contents, props changed) stable/11/contrib/tcpdump/lbl/os-sunos4.h (contents, props changed) stable/11/contrib/tcpdump/lbl/os-ultrix4.h (contents, props changed) stable/11/contrib/tcpdump/machdep.c (contents, props changed) stable/11/contrib/tcpdump/machdep.h (contents, props changed) stable/11/contrib/tcpdump/mib.h (contents, props changed) stable/11/contrib/tcpdump/missing/datalinks.c (contents, props changed) stable/11/contrib/tcpdump/missing/dlnames.c (contents, props changed) stable/11/contrib/tcpdump/missing/snprintf.c (contents, props changed) stable/11/contrib/tcpdump/missing/strdup.c (contents, props changed) stable/11/contrib/tcpdump/missing/strlcat.c (contents, props changed) stable/11/contrib/tcpdump/missing/strlcpy.c (contents, props changed) stable/11/contrib/tcpdump/missing/strsep.c (contents, props changed) stable/11/contrib/tcpdump/nameser.h (contents, props changed) stable/11/contrib/tcpdump/netdissect.h (contents, props changed) stable/11/contrib/tcpdump/nfs.h (contents, props changed) stable/11/contrib/tcpdump/nfsfh.h (contents, props changed) stable/11/contrib/tcpdump/nlpid.c (contents, props changed) stable/11/contrib/tcpdump/oui.c (contents, props changed) stable/11/contrib/tcpdump/oui.h (contents, props changed) stable/11/contrib/tcpdump/parsenfsfh.c (contents, props changed) stable/11/contrib/tcpdump/pcap-missing.h (contents, props changed) stable/11/contrib/tcpdump/ppp.h (contents, props changed) stable/11/contrib/tcpdump/print-802_11.c (contents, props changed) stable/11/contrib/tcpdump/print-802_15_4.c (contents, props changed) stable/11/contrib/tcpdump/print-ah.c (contents, props changed) stable/11/contrib/tcpdump/print-ahcp.c (contents, props changed) stable/11/contrib/tcpdump/print-aodv.c (contents, props changed) stable/11/contrib/tcpdump/print-aoe.c (contents, props changed) stable/11/contrib/tcpdump/print-ap1394.c (contents, props changed) stable/11/contrib/tcpdump/print-arcnet.c (contents, props changed) stable/11/contrib/tcpdump/print-arp.c (contents, props changed) stable/11/contrib/tcpdump/print-ascii.c (contents, props changed) stable/11/contrib/tcpdump/print-atalk.c (contents, props changed) stable/11/contrib/tcpdump/print-atm.c (contents, props changed) stable/11/contrib/tcpdump/print-babel.c (contents, props changed) stable/11/contrib/tcpdump/print-beep.c (contents, props changed) stable/11/contrib/tcpdump/print-bfd.c (contents, props changed) stable/11/contrib/tcpdump/print-bgp.c (contents, props changed) stable/11/contrib/tcpdump/print-bootp.c (contents, props changed) stable/11/contrib/tcpdump/print-bt.c (contents, props changed) stable/11/contrib/tcpdump/print-calm-fast.c (contents, props changed) stable/11/contrib/tcpdump/print-carp.c (contents, props changed) stable/11/contrib/tcpdump/print-cdp.c (contents, props changed) stable/11/contrib/tcpdump/print-cfm.c (contents, props changed) stable/11/contrib/tcpdump/print-chdlc.c (contents, props changed) stable/11/contrib/tcpdump/print-cip.c (contents, props changed) stable/11/contrib/tcpdump/print-cnfp.c (contents, props changed) stable/11/contrib/tcpdump/print-dccp.c (contents, props changed) stable/11/contrib/tcpdump/print-decnet.c (contents, props changed) stable/11/contrib/tcpdump/print-dhcp6.c (contents, props changed) stable/11/contrib/tcpdump/print-domain.c (contents, props changed) stable/11/contrib/tcpdump/print-dtp.c (contents, props changed) stable/11/contrib/tcpdump/print-dvmrp.c (contents, props changed) stable/11/contrib/tcpdump/print-eap.c (contents, props changed) stable/11/contrib/tcpdump/print-egp.c (contents, props changed) stable/11/contrib/tcpdump/print-eigrp.c (contents, props changed) stable/11/contrib/tcpdump/print-enc.c (contents, props changed) stable/11/contrib/tcpdump/print-esp.c (contents, props changed) stable/11/contrib/tcpdump/print-ether.c (contents, props changed) stable/11/contrib/tcpdump/print-fddi.c (contents, props changed) stable/11/contrib/tcpdump/print-forces.c (contents, props changed) stable/11/contrib/tcpdump/print-fr.c (contents, props changed) stable/11/contrib/tcpdump/print-frag6.c (contents, props changed) stable/11/contrib/tcpdump/print-ftp.c (contents, props changed) stable/11/contrib/tcpdump/print-geneve.c (contents, props changed) stable/11/contrib/tcpdump/print-geonet.c (contents, props changed) stable/11/contrib/tcpdump/print-gre.c (contents, props changed) stable/11/contrib/tcpdump/print-hsrp.c (contents, props changed) stable/11/contrib/tcpdump/print-http.c (contents, props changed) stable/11/contrib/tcpdump/print-icmp.c (contents, props changed) stable/11/contrib/tcpdump/print-icmp6.c (contents, props changed) stable/11/contrib/tcpdump/print-igmp.c (contents, props changed) stable/11/contrib/tcpdump/print-igrp.c (contents, props changed) stable/11/contrib/tcpdump/print-ip.c (contents, props changed) stable/11/contrib/tcpdump/print-ip6.c (contents, props changed) stable/11/contrib/tcpdump/print-ip6opts.c (contents, props changed) stable/11/contrib/tcpdump/print-ipcomp.c (contents, props changed) stable/11/contrib/tcpdump/print-ipfc.c (contents, props changed) stable/11/contrib/tcpdump/print-ipnet.c (contents, props changed) stable/11/contrib/tcpdump/print-ipx.c (contents, props changed) stable/11/contrib/tcpdump/print-isakmp.c (contents, props changed) stable/11/contrib/tcpdump/print-isoclns.c (contents, props changed) stable/11/contrib/tcpdump/print-juniper.c (contents, props changed) stable/11/contrib/tcpdump/print-krb.c (contents, props changed) stable/11/contrib/tcpdump/print-l2tp.c (contents, props changed) stable/11/contrib/tcpdump/print-lane.c (contents, props changed) stable/11/contrib/tcpdump/print-ldp.c (contents, props changed) stable/11/contrib/tcpdump/print-llc.c (contents, props changed) stable/11/contrib/tcpdump/print-lldp.c (contents, props changed) stable/11/contrib/tcpdump/print-lmp.c (contents, props changed) stable/11/contrib/tcpdump/print-loopback.c (contents, props changed) stable/11/contrib/tcpdump/print-lspping.c (contents, props changed) stable/11/contrib/tcpdump/print-lwapp.c (contents, props changed) stable/11/contrib/tcpdump/print-lwres.c (contents, props changed) stable/11/contrib/tcpdump/print-m3ua.c (contents, props changed) stable/11/contrib/tcpdump/print-mobile.c (contents, props changed) stable/11/contrib/tcpdump/print-mobility.c (contents, props changed) stable/11/contrib/tcpdump/print-mpcp.c (contents, props changed) stable/11/contrib/tcpdump/print-mpls.c (contents, props changed) stable/11/contrib/tcpdump/print-mptcp.c (contents, props changed) stable/11/contrib/tcpdump/print-msdp.c (contents, props changed) stable/11/contrib/tcpdump/print-msnlb.c stable/11/contrib/tcpdump/print-nflog.c (contents, props changed) stable/11/contrib/tcpdump/print-nfs.c (contents, props changed) stable/11/contrib/tcpdump/print-ntp.c (contents, props changed) stable/11/contrib/tcpdump/print-null.c (contents, props changed) stable/11/contrib/tcpdump/print-olsr.c (contents, props changed) stable/11/contrib/tcpdump/print-openflow-1.0.c (contents, props changed) stable/11/contrib/tcpdump/print-openflow.c (contents, props changed) stable/11/contrib/tcpdump/print-ospf.c (contents, props changed) stable/11/contrib/tcpdump/print-ospf6.c (contents, props changed) stable/11/contrib/tcpdump/print-otv.c stable/11/contrib/tcpdump/print-pflog.c (contents, props changed) stable/11/contrib/tcpdump/print-pfsync.c (contents, props changed) stable/11/contrib/tcpdump/print-pgm.c (contents, props changed) stable/11/contrib/tcpdump/print-pim.c (contents, props changed) stable/11/contrib/tcpdump/print-pktap.c (contents, props changed) stable/11/contrib/tcpdump/print-ppi.c (contents, props changed) stable/11/contrib/tcpdump/print-ppp.c (contents, props changed) stable/11/contrib/tcpdump/print-pppoe.c (contents, props changed) stable/11/contrib/tcpdump/print-pptp.c (contents, props changed) stable/11/contrib/tcpdump/print-radius.c (contents, props changed) stable/11/contrib/tcpdump/print-raw.c (contents, props changed) stable/11/contrib/tcpdump/print-rip.c (contents, props changed) stable/11/contrib/tcpdump/print-ripng.c (contents, props changed) stable/11/contrib/tcpdump/print-rpki-rtr.c (contents, props changed) stable/11/contrib/tcpdump/print-rrcp.c (contents, props changed) stable/11/contrib/tcpdump/print-rsvp.c (contents, props changed) stable/11/contrib/tcpdump/print-rt6.c (contents, props changed) stable/11/contrib/tcpdump/print-rtsp.c (contents, props changed) stable/11/contrib/tcpdump/print-rx.c (contents, props changed) stable/11/contrib/tcpdump/print-sctp.c (contents, props changed) stable/11/contrib/tcpdump/print-sflow.c (contents, props changed) stable/11/contrib/tcpdump/print-sip.c (contents, props changed) stable/11/contrib/tcpdump/print-sl.c (contents, props changed) stable/11/contrib/tcpdump/print-sll.c (contents, props changed) stable/11/contrib/tcpdump/print-slow.c (contents, props changed) stable/11/contrib/tcpdump/print-smb.c (contents, props changed) stable/11/contrib/tcpdump/print-smtp.c (contents, props changed) stable/11/contrib/tcpdump/print-snmp.c (contents, props changed) stable/11/contrib/tcpdump/print-stp.c (contents, props changed) stable/11/contrib/tcpdump/print-sunatm.c (contents, props changed) stable/11/contrib/tcpdump/print-sunrpc.c (contents, props changed) stable/11/contrib/tcpdump/print-symantec.c (contents, props changed) stable/11/contrib/tcpdump/print-syslog.c (contents, props changed) stable/11/contrib/tcpdump/print-tcp.c (contents, props changed) stable/11/contrib/tcpdump/print-telnet.c (contents, props changed) stable/11/contrib/tcpdump/print-tftp.c (contents, props changed) stable/11/contrib/tcpdump/print-timed.c (contents, props changed) stable/11/contrib/tcpdump/print-tipc.c stable/11/contrib/tcpdump/print-token.c (contents, props changed) stable/11/contrib/tcpdump/print-udld.c (contents, props changed) stable/11/contrib/tcpdump/print-udp.c (contents, props changed) stable/11/contrib/tcpdump/print-usb.c (contents, props changed) stable/11/contrib/tcpdump/print-vjc.c (contents, props changed) stable/11/contrib/tcpdump/print-vqp.c (contents, props changed) stable/11/contrib/tcpdump/print-vrrp.c (contents, props changed) stable/11/contrib/tcpdump/print-vtp.c (contents, props changed) stable/11/contrib/tcpdump/print-vxlan.c stable/11/contrib/tcpdump/print-wb.c (contents, props changed) stable/11/contrib/tcpdump/print-zephyr.c (contents, props changed) stable/11/contrib/tcpdump/print-zeromq.c stable/11/contrib/tcpdump/rpc_auth.h (contents, props changed) stable/11/contrib/tcpdump/rpc_msg.h (contents, props changed) stable/11/contrib/tcpdump/rpl.h (contents, props changed) stable/11/contrib/tcpdump/setsignal.c (contents, props changed) stable/11/contrib/tcpdump/signature.c (contents, props changed) stable/11/contrib/tcpdump/signature.h (contents, props changed) stable/11/contrib/tcpdump/smb.h (contents, props changed) stable/11/contrib/tcpdump/smbutil.c (contents, props changed) stable/11/contrib/tcpdump/tcp.h (contents, props changed) stable/11/contrib/tcpdump/tcpdump.1.in (contents, props changed) stable/11/contrib/tcpdump/tcpdump.c (contents, props changed) stable/11/contrib/tcpdump/udp.h (contents, props changed) stable/11/contrib/tcpdump/vfprintf.c (contents, props changed) stable/11/usr.sbin/tcpdump/tcpdump/Makefile stable/11/usr.sbin/tcpdump/tcpdump/config.h Directory Properties: stable/11/ (props changed) stable/11/contrib/tcpdump/LICENSE (props changed) stable/11/contrib/tcpdump/Makefile-devel-adds (props changed) stable/11/contrib/tcpdump/ah.h (props changed) stable/11/contrib/tcpdump/appletalk.h (props changed) stable/11/contrib/tcpdump/atime.awk (props changed) stable/11/contrib/tcpdump/atm.h (props changed) stable/11/contrib/tcpdump/chdlc.h (props changed) stable/11/contrib/tcpdump/config.guess (props changed) stable/11/contrib/tcpdump/config.sub (props changed) stable/11/contrib/tcpdump/gmpls.h (props changed) stable/11/contrib/tcpdump/gmt2local.h (props changed) stable/11/contrib/tcpdump/install-sh (props changed) stable/11/contrib/tcpdump/lbl/os-osf4.h (props changed) stable/11/contrib/tcpdump/llc.h (props changed) stable/11/contrib/tcpdump/makemib (props changed) stable/11/contrib/tcpdump/missing/getopt_long.c (props changed) stable/11/contrib/tcpdump/mkdep (props changed) stable/11/contrib/tcpdump/mpls.h (props changed) stable/11/contrib/tcpdump/nlpid.h (props changed) stable/11/contrib/tcpdump/openflow.h (props changed) stable/11/contrib/tcpdump/ospf.h (props changed) stable/11/contrib/tcpdump/packetdat.awk (props changed) stable/11/contrib/tcpdump/pcap_dump_ftell.c (props changed) stable/11/contrib/tcpdump/send-ack.awk (props changed) stable/11/contrib/tcpdump/setsignal.h (props changed) stable/11/contrib/tcpdump/slcompress.h (props changed) stable/11/contrib/tcpdump/stime.awk (props changed) Modified: stable/11/contrib/tcpdump/CHANGES ============================================================================== --- stable/11/contrib/tcpdump/CHANGES Fri Feb 10 07:16:56 2017 (r313536) +++ stable/11/contrib/tcpdump/CHANGES Fri Feb 10 07:22:12 2017 (r313537) @@ -1,3 +1,187 @@ +Wednesday January 18, 2017 devel.fx.lebail@orange.fr + Summary for 4.9.0 tcpdump release + General updates: + Improve separation frontend/backend (tcpdump/libnetdissect) + Don't require IPv6 library support in order to support IPv6 addresses + Introduce data types to use for integral values in packet structures + Fix display of timestamps with -tt, -ttt and -ttttt options + Fix some heap overflows found with American Fuzzy Lop by Hanno Boeck and others + (More information in the log with CVE-2016-* and CVE-2017-*) + Change the way protocols print link-layer addresses (Fix heap overflows + in CALM-FAST and GeoNetworking printers) + Pass correct caplen value to ether_print() and some other functions + Fix lookup_nsap() to match what isonsap_string() expects + Clean up relative time stamp printing (Fix an array overflow) + Fix some alignment issues with GCC on Solaris 10 SPARC + Add some ND_TTEST_/ND_TCHECK_ macros to simplify writing bounds checks + Add a fn_printztn() which returns the number of bytes processed + Add nd_init() and nd_cleanup() functions. Improve libsmi support + Add CONTRIBUTING file + Add a summary comment in all printers + Compile with more warning options in devel mode if supported (-Wcast-qual, ...) + Fix some leaks found by Valgrind/Memcheck + Fix a bunch of de-constifications + Squelch some Coverity warnings and some compiler warnings + Update Coverity and Travis-CI setup + Update Visual Studio files + + Frontend: + Fix capsicum support to work with zerocopy buffers in bpf + Try opening interfaces by name first, then by name-as-index + Work around pcap_create() failures fetching time stamp type lists + Fix a segmentation fault with 'tcpdump -J' + Improve addrtostr6() bounds checking + Add exit_tcpdump() function + Don't drop CAP_SYS_CHROOT before chrooting + Fixes issue where statistics not reported when -G and -W options used + + New printers supporting: + Generic Protocol Extension for VXLAN (VXLAN-GPE) + Home Networking Control Protocol (HNCP), RFCs 7787 and 7788 + Locator/Identifier Separation Protocol (LISP), type 3 and type 4 packets + Marvell Extended Distributed Switch Architecture header (MEDSA) + Network Service Header (NSH) + REdis Serialization Protocol (RESP) + + Updated printers: + 802.11: Beginnings of 11ac radiotap support + 802.11: Check the Protected bit for management frames + 802.11: Do bounds checking on last_presentp before dereferencing it (Fix a heap overflow) + 802.11: Fix the radiotap printer to handle the special bits correctly + 802.11: If we have the MCS field, it's 11n + 802.11: Only print unknown frame type or subtype messages once + 802.11: Radiotap dBm values get printed as dB; Update a test output accordingly + 802.11: Source and destination addresses were backwards + AH: Add a bounds check + AH: Report to our caller that dissection failed if a bounds check fails + AP1394: Print src > dst, not dst > src + ARP: Don't assume the target hardware address is <= 6 octets long (Fix a heap overflow) + ATALK: Add bounds and length checks (Fix heap overflows) + ATM: Add some bounds checks (Fix a heap overflow) + ATM: Fix an incorrect bounds check + BFD: Update specification from draft to RFC 5880 + BFD: Update to print optional authentication field + BGP: Add decoding of ADD-PATH capability + BGP: Add support for the AIGP attribute (RFC7311) + BGP: Print LARGE_COMMUNITY Path Attribute + BGP: Update BGP numbers from IANA; Print minor values for FSM notification + BOOTP: Add a bounds check + Babel: Add decoder for source-specific extension + CDP: Filter out non-printable characters + CFM: Fixes to match the IEEE standard, additional bounds and length checks + CSLIP: Add more bounds checks (Fix a heap overflow) + ClassicalIPoATM: Add a bounds check on LLC+SNAP header (Fix a heap overflow) + DHCP: Fix MUDURL and TZ options + DHCPv6: Process MUDURL and TZ options + DHCPv6: Update Status Codes with RFCs/IANA names + DNS: Represent the "DNSSEC OK" bit as "DO" instead of "OK". Add a test case + DTP: Improve packet integrity checks + EGP: Fix bounds checks + ESP: Don't use OpenSSL_add_all_algorithms() in OpenSSL 1.1.0 or later + ESP: Handle OpenSSL 1.1.x + Ethernet: Add some bounds checking before calling isoclns_print (Fix a heap overflow) + Ethernet: Print the Length/Type field as length when needed + FDDI: Fix -e output for FDDI + FR: Add some packet-length checks and improve Q.933 printing (Fix heap overflows) + GRE: Add some bounds checks (Fix heap overflows) + Geneve: Fix error message with invalid option length; Update list option classes + HNCP: Fix incorrect time interval format. Fix handling of IPv4 prefixes + ICMP6: Fetch a 32-bit big-endian quantity with EXTRACT_32BITS() + ICMP6: dagid is always an IPv6 address, not an opaque 128-bit string + IGMP: Add a length check + IP: Add a bounds check (Fix a heap overflow) + IP: Check before fetching the protocol version (Fix a heap overflow) + IP: Don't try to dissect if IP version != 4 (Fix a heap overflow) + IP: Stop processing IPPROTO_ values once we hit IPPROTO_IPCOMP + IPComp: Check whether we have the CPI before we fetch it (Fix a heap overflow) + IPoFC: Fix -e output (IP-over-Fibre Channel) + IPv6: Don't overwrite the destination IPv6 address for routing headers + IPv6: Fix header printing + IPv6: Stop processing IPPROTO_ values once we hit IPPROTO_IPCOMP + ISAKMP: Clean up parsing of IKEv2 Security Associations + ISOCLNS/IS-IS: Add support for Purge Originator Identifier (RFC6232) and test cases + ISOCLNS/IS-IS: Don't overwrite packet data when checking the signature + ISOCLNS/IS-IS: Filter out non-printable characters + ISOCLNS/IS-IS: Fix segmentation faults + ISOCLNS/IS-IS: Have signature_verify() do the copying and clearing + ISOCLNS: Add some bounds checks + Juniper: Make sure a Juniper header TLV isn't bigger than what's left in the packet (Fix a heap overflow) + LLC/SNAP: With -e, print the LLC header before the SNAP header; without it, cut the SNAP header + LLC: Add a bounds check (Fix a heap overflow) + LLC: Clean up printing of LLC packets + LLC: Fix the printing of RFC 948-style IP packets + LLC: Skip the LLC and SNAP headers with -x for 802.11 and some other protocols + LLDP: Implement IANA OUI and LLDP MUD option + MPLS LSP ping: Update printing for RFC 4379, bug fixes, more bounds checks + MPLS: "length" is now the *remaining* packet length + MPLS: Add bounds and length checks (Fix a heap overflow) + NFS: Add a test that makes unaligned accesses + NFS: Don't assume the ONC RPC header is nicely aligned + NFS: Don't overflow the Opaque_Handle buffer (Fix a segmentation fault) + NFS: Don't run past the end of an NFSv3 file handle + OLSR: Add a test to cover a HNA sgw case + OLSR: Fix 'Advertised networks' count + OLSR: Fix printing of smart-gateway HNAs in IPv4 + OSPF: Add a bounds check for the Hello packet options + OSPF: Do more bounds checking + OSPF: Fix a segmentation fault + OSPF: Fix printing 'ospf_topology_values' default + OTV: Add missing bounds checks + PGM: Print the formatted IP address, not the raw binary address, as a string + PIM: Add some bounds checking (Fix a heap overflow) + PIMv2: Fix checksumming of Register messages + PPI: Pass an adjusted struct pcap_pkthdr to the sub-printer + PPP: Add some bounds checks (Fix a heap overflow) + PPP: Report invalid PAP AACK/ANAK packets + Q.933: Add a missing bounds check + RADIUS: Add Value 13 "VLAN" to Tunnel-Type attribute + RADIUS: Filter out non-printable characters + RADIUS: Translate UDP/1700 as RADIUS + RESP: Do better checking of RESP packets + RPKI-RTR: Add a return value check for "fn_printn" call + RPKI-RTR: Remove printing when truncated condition already detected + RPL: Fix 'Consistency Check' control code + RPL: Fix suboption print + RSVP: An INTEGRITY object in a submessage covers only the submessage + RSVP: Fix an infinite loop; Add bounds and length checks + RSVP: Fix some if statements missing brackets + RSVP: Have signature_verify() do the copying and clearing + RTCP: Add some bounds checks + RTP: Add some bounds checks, fix two segmentation faults + SCTP: Do more bounds checking + SFLOW: Fix bounds checking + SLOW: Fix bugs, add checks + SMB: Before fetching the flags2 field, make sure we have it + SMB: Do bounds checks on NBNS resource types and resource data lengths + SNMP: Clean up the "have libsmi but no modules loaded" case + SNMP: Clean up the object abbreviation list and fix the code to match them + SNMP: Do bounds checks when printing character and octet strings + SNMP: Improve ASN.1 bounds checks + SNMP: More bounds and length checks + STP: Add a bunch of bounds checks, and fix some printing (Fix heap overflows) + STP: Filter out non-printable characters + TCP: Add bounds and length checks for packets with TCP option 20 + TCP: Correct TCP option Kind value for TCP Auth and add SCPS-TP + TCP: Fix two bounds checks (Fix heap overflows) + TCP: Make sure we have the data offset field before fetching it (Fix a heap overflow) + TCP: Put TCP-AO option decoding right + TFTP: Don't use strchr() to scan packet data (Fix a heap overflow) + Telnet: Add some bounds checks + TokenRing: Fix -e output + UDLD: Fix an infinite loop + UDP: Add a bounds check (Fix a heap overflow) + UDP: Check against the packet length first + UDP: Don't do the DDP-over-UDP heuristic check up front + VAT: Add some bounds checks + VTP: Add a test on Mgmt Domain Name length + VTP: Add bounds checks and filter out non-printable characters + VXLAN: Add a bound check and a test case + ZeroMQ: Fix an infinite loop + +Tuesday April 14, 2015 guy@alum.mit.edu + Summary for 4.8.0 tcpdump release + Fix "-x" for Apple PKTAP and PPI packets + Friday April 10, 2015 guy@alum.mit.edu Summary for 4.7.4 tcpdump release RPKI to Router Protocol: Fix Segmentation Faults and other problems @@ -464,10 +648,10 @@ Wed. November 12, 2003. mcr@sandelman. Tuesday, February 25, 2003. fenner@research.att.com. 3.7.2 release - Fixed infinite loop when parsing malformed isakmp packets. + Fixed infinite loop when parsing invalid isakmp packets. (reported by iDefense; already fixed in CVS) - Fixed infinite loop when parsing malformed BGP packets. - Fixed buffer overflow with certain malformed NFS packets. + Fixed infinite loop when parsing invalid BGP packets. + Fixed buffer overflow with certain invalid NFS packets. Pretty-print unprintable network names in 802.11 printer. Handle truncated nbp (appletalk) packets. Updated DHCPv6 printer to match draft-ietf-dhc-dhcpv6-22.txt Copied: stable/11/contrib/tcpdump/CONTRIBUTING (from r313048, head/contrib/tcpdump/CONTRIBUTING) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/11/contrib/tcpdump/CONTRIBUTING Fri Feb 10 07:22:12 2017 (r313537, copy of r313048, head/contrib/tcpdump/CONTRIBUTING) @@ -0,0 +1,103 @@ +Some Information for Contributors +--------------------------------- +You want to contribute to Tcpdump, Thanks! +Please, read these lines. + +1) Fork the Tcpdump repository on GitHub from + https://github.com/the-tcpdump-group/tcpdump + (See https://help.github.com/articles/fork-a-repo/) + +2) Setup an optional Travis-CI build + You can setup a travis build for your fork. So, you can test your changes + on Linux and OSX before sending pull requests. + (See http://docs.travis-ci.com/user/getting-started/) + +3) Clone your repository + git clone https://github.com//tcpdump.git + +4) Do a 'touch .devel' in your working directory. + Currently, the effect is + a) add (via configure, in Makefile) some warnings options ( -Wall + -Wmissing-prototypes -Wstrict-prototypes, ...) to the compiler if it + supports these options, + b) have the Makefile support "make depend" and the configure script run it. + +5) Configure and build + ./configure && make -s && make check + +6) Add/update sample.pcap files + We use tests directory to do regression tests on the dissection of captured + packets, by running tcpdump against a savefile sample.pcap, created with -w + option and comparing the results with a text file sample.out giving the + expected results. + + Any new/updated fields in a dissector must be present in a sample.pcap file + and the corresponding output file. + + Configuration is set in tests/TESTLIST. + Each line in this file has the following format: + test-name sample.pcap sample.out tcpdump-options + + the sample.out file can be build by: + (cd tests && ../tcpdump -n -r sample.pcap tcpdump-options > sample.out) + + It is often useful to have test outputs with different verbosity levels + (none, -v, -vv, -vvv, etc.) depending on the code. + +7) Test with 'make check' + Don't send a pull request if 'make check' gives failed tests. + +8) Rebase your commits against upstream/master + (To keep linearity) + +9) Initiate and send a pull request + (See https://help.github.com/articles/using-pull-requests/) + +Some remarks +------------ +a) A thorough reading of some other printers code is useful. + +b) Put the normative reference if any as comments (RFC, etc.). + +c) Put the format of packets/headers/options as comments. + +d) The printer may receive incomplete packet in the buffer, truncated at any + random position, for example by capturing with '-s size' option. + Thus use ND_TTEST, ND_TTEST2, ND_TCHECK or ND_TCHECK2 for bound checking. + For ND_TCHECK2: + Define : static const char tstr[] = " [|protocol]"; + Define a label: trunc + Print with: ND_PRINT((ndo, "%s", tstr)); + You can test the code via: + sudo ./tcpdump -s snaplen [-v][v][...] -i lo # in a terminal + sudo tcpreplay -i lo sample.pcap # in another terminal + You should try several values for snaplen to do various truncation. + +e) Do invalid packet checks in code: Think that your code can receive in input + not only a valid packet but any arbitrary random sequence of octets (packet + - built malformed originally by the sender or by a fuzz tester, + - became corrupted in transit). + Print with: ND_PRINT((ndo, "%s", istr)); /* to print " (invalid)" */ + +f) Use 'struct tok' for indexed strings and print them with + tok2str() or bittok2str() (for flags). + +g) Avoid empty lines in output of printers. + +h) A commit message must have: + First line: Capitalized short summary in the imperative (70 chars or less) + + Body: Detailed explanatory text, if necessary. Fold it to approximately + 72 characters. There must be an empty line separating the summary from + the body. + +i) Avoid non-ASCII characters in code and commit messages. + +j) Use the style of the modified sources. + +k) Don't mix declarations and code + +l) Don't use // for comments + Not all C compilers accept C++/C99 comments by default. + +m) Avoid trailing tabs/spaces Modified: stable/11/contrib/tcpdump/CREDITS ============================================================================== --- stable/11/contrib/tcpdump/CREDITS Fri Feb 10 07:16:56 2017 (r313536) +++ stable/11/contrib/tcpdump/CREDITS Fri Feb 10 07:22:12 2017 (r313537) @@ -20,11 +20,13 @@ Additional people who have contributed p Andrea Bittau Andrew Brown Andrew Church + Andrew Darqui Andrew Hintz Andrew Nording Andrew Tridgell Andy Heffernan Anton Bernal + Antonin Décimo Arkadiusz Miskiewicz Armando L. Caro Jr. Arnaldo Carvalho de Melo @@ -33,6 +35,7 @@ Additional people who have contributed p Ben Byer Ben Smithurst Bert Vermeulen + Bill Parker Bjoern A. Zeeb Bram Brent L. Bates @@ -95,6 +98,7 @@ Additional people who have contributed p Jason R. Thorpe Jefferson Ogata Jeffrey Hutzelman + Jean-Raphaël Gaglione Jesper Peterson Jesse Gross Jim Hutchins @@ -119,7 +123,7 @@ Additional people who have contributed p Larry Lile Lennert Buytenhek Loganaden Velvindron - Longinus00 + Daniel Lee Loris Degioanni Love Hörnquist-Ã…strand Lucas C. Villa Real @@ -134,6 +138,7 @@ Additional people who have contributed p Markus Schöpflin Marshall Rose Martin Husemann + Matthieu Boutier Max Laier Michael A. Meffie III Michael Madore Modified: stable/11/contrib/tcpdump/INSTALL.txt ============================================================================== --- stable/11/contrib/tcpdump/INSTALL.txt Fri Feb 10 07:16:56 2017 (r313536) +++ stable/11/contrib/tcpdump/INSTALL.txt Fri Feb 10 07:22:12 2017 (r313537) @@ -49,9 +49,10 @@ addrtoname.c - address to hostname routi addrtoname.h - address to hostname definitions ah.h - IPSEC Authentication Header definitions appletalk.h - AppleTalk definitions +ascii_strcasecmp.c - locale-independent case-independent string comparison + routines atime.awk - TCP ack awk script atm.h - ATM traffic type definitions -atmuni31.h - ATM Q.2931 definitions bpf_dump.c - BPF program printing routines, in case libpcap doesn't have them chdlc.h - Cisco HDLC definitions @@ -100,100 +101,8 @@ pcap_dump_ftell.c - pcap_dump_ftell() im doesn't have it pcap-missing.h - declarations of functions possibly missing from libpcap ppp.h - Point to Point Protocol definitions -print-802_11.c - IEEE 802.11 printer routines -print-ap1394.c - Apple IP-over-IEEE 1394 printer routines -print-ah.c - IPSEC Authentication Header printer routines -print-aodv.c - AODV printer routines -print-arcnet.c - ARCNET printer routines -print-arp.c - Address Resolution Protocol printer routines -print-ascii.c - ASCII packet dump routines -print-atalk.c - AppleTalk printer routines -print-atm.c - ATM printer routines -print-beep.c - BEEP printer routines -print-bgp.c - Border Gateway Protocol printer routines -print-bootp.c - BOOTP and IPv4 DHCP printer routines -print-bt.c - Bluetooth printer routines -print-cdp.c - Cisco Discovery Protocol printer routines -print-chdlc.c - Cisco HDLC printer routines -print-cip.c - Classical-IP over ATM routines -print-cnfp.c - Cisco NetFlow printer routines -print-dccp.c - DCCP printer routines -print-decnet.c - DECnet printer routines -print-dhcp6.c - IPv6 DHCP printer routines -print-domain.c - Domain Name System printer routines -print-dvmrp.c - Distance Vector Multicast Routing Protocol printer routines -print-eap.c - EAP printer routines -print-enc.c - OpenBSD IPsec encapsulation BPF layer printer routines -print-egp.c - External Gateway Protocol printer routines -print-esp.c - IPSEC Encapsulating Security Payload printer routines -print-ether.c - Ethernet printer routines -print-fddi.c - Fiber Distributed Data Interface printer routines -print-fr.c - Frame Relay printer routines -print-frag6.c - IPv6 fragmentation header printer routines -print-gre.c - Generic Routing Encapsulation printer routines -print-hsrp.c - Cisco Hot Standby Router Protocol printer routines -print-icmp.c - Internet Control Message Protocol printer routines -print-icmp6.c - IPv6 Internet Control Message Protocol printer routines -print-igmp.c - Internet Group Management Protocol printer routines -print-igrp.c - Interior Gateway Routing Protocol printer routines -print-ip.c - IP printer routines -print-ip6.c - IPv6 printer routines -print-ip6opts.c - IPv6 header option printer routines -print-ipcomp.c - IP Payload Compression Protocol printer routines -print-ipx.c - IPX printer routines -print-isakmp.c - Internet Security Association and Key Management Protocol -print-isoclns.c - ISO CLNS, ESIS, and ISIS printer routines -print-krb.c - Kerberos printer routines -print-l2tp.c - Layer Two Tunneling Protocol printer routines -print-lane.c - ATM LANE printer routines -print-llc.c - IEEE 802.2 LLC printer routines -print-lspping.c - LSPPING printer routines -print-lwres.c - Lightweight Resolver protocol printer routines -print-mobile.c - IPv4 mobility printer routines -print-mobility.c - IPv6 mobility printer routines -print-mpls.c - Multi-Protocol Label Switching printer routines -print-msdp.c - Multicast Source Discovery Protocol printer routines -print-nfs.c - Network File System printer routines -print-ntp.c - Network Time Protocol printer routines -print-null.c - BSD loopback device printer routines -print-ospf.c - Open Shortest Path First printer routines -print-ospf6.c - IPv6 Open Shortest Path First printer routines -print-pflog.c - OpenBSD packet filter log file printer routines -print-pgm.c - Pragmatic General Multicast printer routines -print-pim.c - Protocol Independent Multicast printer routines -print-ppp.c - Point to Point Protocol printer routines -print-pppoe.c - PPP-over-Ethernet printer routines -print-pptp.c - Point-to-Point Tunnelling Protocol printer routines -print-radius.c - Radius protocol printer routines -print-raw.c - Raw IP printer routines -print-rip.c - Routing Information Protocol printer routines -print-ripng.c - IPv6 Routing Information Protocol printer routines -print-rrcp.c - Realtek Remote Control Protocol routines -print-rsvp.c - Resource reSerVation Protocol (RSVP) printer routines -print-rt6.c - IPv6 routing header printer routines -print-rx.c - AFS RX printer routines -print-sctp.c - Stream Control Transmission Protocol printer routines -print-sip.c - SIP printer routines -print-sl.c - Compressed Serial Line Internet Protocol printer routines -print-sll.c - Linux "cooked" capture printer routines -print-slow.c - IEEE "slow protocol" (802.3ad) printer routines -print-smb.c - SMB/CIFS printer routines -print-snmp.c - Simple Network Management Protocol printer routines -print-stp.c - IEEE 802.1d spanning tree protocol printer routines -print-sunatm.c - SunATM DLPI capture printer routines -print-sunrpc.c - Sun Remote Procedure Call printer routines -print-symantec.c - Symantec Enterprise Firewall printer routines -print-tcp.c - TCP printer routines -print-telnet.c - Telnet option printer routines -print-tftp.c - Trivial File Transfer Protocol printer routines -print-timed.c - BSD time daemon protocol printer routines -print-token.c - Token Ring printer routines -print-udp.c - UDP printer routines -print-usb.c - USB printer routines -print-vjc.c - PPP Van Jacobson compression (RFC1144) printer routines -print-vrrp.c - Virtual Router Redundancy Protocol -print-wb.c - White Board printer routines -print-zephyr.c - Zephyr printer routines +print.c - Top-level routines for protocol printing +print-*.c - The netdissect printers rpc_auth.h - definitions for ONC RPC authentication rpc_msg.h - definitions for ONC RPC messages send-ack.awk - unidirectional tcp send/ack awk script @@ -203,11 +112,11 @@ slcompress.h - SLIP/PPP Van Jacobson com smb.h - SMB/CIFS definitions smbutil.c - SMB/CIFS utility routines stime.awk - TCP send awk script -strcasecmp.c - missing routine tcp.h - TCP definitions tcpdump.1 - manual entry tcpdump.c - main program +timeval-operations.h - timeval operations macros udp.h - UDP definitions -util.c - utility routines +util-print.c - utility routines for protocol printers vfprintf.c - emulation routine win32 - headers and routines for building on Win32 systems Modified: stable/11/contrib/tcpdump/Makefile.in ============================================================================== --- stable/11/contrib/tcpdump/Makefile.in Fri Feb 10 07:16:56 2017 (r313536) +++ stable/11/contrib/tcpdump/Makefile.in Fri Feb 10 07:22:12 2017 (r313537) @@ -74,7 +74,9 @@ CSRC = setsignal.c tcpdump.c LIBNETDISSECT_SRC=\ addrtoname.c \ + addrtostr.c \ af.c \ + ascii_strcasecmp.c \ checksum.c \ cpack.c \ gmpls.c \ @@ -86,6 +88,7 @@ LIBNETDISSECT_SRC=\ nlpid.c \ oui.c \ parsenfsfh.c \ + print.c \ print-802_11.c \ print-802_15_4.c \ print-ah.c \ @@ -98,6 +101,7 @@ LIBNETDISSECT_SRC=\ print-ascii.c \ print-atalk.c \ print-atm.c \ + print-babel.c \ print-beep.c \ print-bfd.c \ print-bgp.c \ @@ -112,6 +116,7 @@ LIBNETDISSECT_SRC=\ print-cnfp.c \ print-dccp.c \ print-decnet.c \ + print-dhcp6.c \ print-domain.c \ print-dtp.c \ print-dvmrp.c \ @@ -124,17 +129,21 @@ LIBNETDISSECT_SRC=\ print-fddi.c \ print-forces.c \ print-fr.c \ + print-frag6.c \ print-ftp.c \ print-geneve.c \ print-geonet.c \ print-gre.c \ + print-hncp.c \ print-hsrp.c \ print-http.c \ print-icmp.c \ + print-icmp6.c \ print-igmp.c \ print-igrp.c \ print-ip.c \ print-ip6.c \ + print-ip6opts.c \ print-ipcomp.c \ print-ipfc.c \ print-ipnet.c \ @@ -146,6 +155,7 @@ LIBNETDISSECT_SRC=\ print-l2tp.c \ print-lane.c \ print-ldp.c \ + print-lisp.c \ print-llc.c \ print-lldp.c \ print-lmp.c \ @@ -154,7 +164,9 @@ LIBNETDISSECT_SRC=\ print-lwapp.c \ print-lwres.c \ print-m3ua.c \ + print-medsa.c \ print-mobile.c \ + print-mobility.c \ print-mpcp.c \ print-mpls.c \ print-mptcp.c \ @@ -162,12 +174,14 @@ LIBNETDISSECT_SRC=\ print-msnlb.c \ print-nflog.c \ print-nfs.c \ + print-nsh.c \ print-ntp.c \ print-null.c \ print-olsr.c \ print-openflow-1.0.c \ print-openflow.c \ print-ospf.c \ + print-ospf6.c \ print-otv.c \ print-pgm.c \ print-pim.c \ @@ -178,10 +192,13 @@ LIBNETDISSECT_SRC=\ print-pptp.c \ print-radius.c \ print-raw.c \ + print-resp.c \ print-rip.c \ + print-ripng.c \ print-rpki-rtr.c \ print-rrcp.c \ print-rsvp.c \ + print-rt6.c \ print-rtsp.c \ print-rx.c \ print-sctp.c \ @@ -211,11 +228,14 @@ LIBNETDISSECT_SRC=\ print-vrrp.c \ print-vtp.c \ print-vxlan.c \ + print-vxlan-gpe.c \ print-wb.c \ print-zephyr.c \ print-zeromq.c \ + netdissect.c \ signature.c \ - util.c + strtoaddr.c \ + util-print.c LOCALSRC = @LOCALSRC@ GENSRC = version.c @@ -232,11 +252,12 @@ SRC = $(CSRC) $(GENSRC) $(LOCALSRC) $(LI OBJ = $(CSRC:.c=.o) $(GENSRC:.c=.o) $(LIBNETDISSECT_OBJ) HDR = \ addrtoname.h \ + addrtostr.h \ af.h \ ah.h \ appletalk.h \ + ascii_strcasecmp.h \ atm.h \ - atmuni31.h \ chdlc.h \ cpack.h \ ether.h \ @@ -264,6 +285,7 @@ HDR = \ oui.h \ pcap-missing.h \ ppp.h \ + print.h \ rpc_auth.h \ rpc_msg.h \ rpl.h \ @@ -271,14 +293,15 @@ HDR = \ signature.h \ slcompress.h \ smb.h \ + strtoaddr.h \ tcp.h \ - tcpdump-stdinc.h \ + netdissect-stdinc.h \ + timeval-operations.h \ udp.h TAGHDR = \ /usr/include/arpa/tftp.h \ /usr/include/net/if_arp.h \ - /usr/include/net/slip.h \ /usr/include/netinet/if_ether.h \ /usr/include/netinet/in.h \ /usr/include/netinet/ip_icmp.h \ @@ -292,11 +315,14 @@ CLEANFILES = $(PROG) $(OBJ) $(GENSRC) EXTRA_DIST = \ CHANGES \ + CONTRIBUTING \ CREDITS \ INSTALL.txt \ LICENSE \ Makefile.in \ Makefile-devel-adds \ + PLATFORMS \ + README \ README.md \ Readme.Win32 \ VERSION \ @@ -314,14 +340,9 @@ EXTRA_DIST = \ lbl/os-sunos4.h \ lbl/os-ultrix4.h \ makemib \ - missing/addrinfo.h \ missing/dlnames.c \ missing/datalinks.c \ - missing/getnameinfo.c \ missing/getopt_long.c \ - missing/inet_aton.c \ - missing/inet_ntop.c \ - missing/inet_pton.c \ missing/snprintf.c \ missing/strdup.c \ missing/strlcat.c \ @@ -330,27 +351,19 @@ EXTRA_DIST = \ mkdep \ packetdat.awk \ pcap_dump_ftell.c \ - print-babel.c \ - print-dhcp6.c \ - print-frag6.c \ - print-icmp6.c \ - print-ip6opts.c \ - print-mobility.c \ - print-ospf6.c \ print-pflog.c \ - print-ripng.c \ - print-rt6.c \ print-smb.c \ send-ack.awk \ smbutil.c \ stime.awk \ - strcasecmp.c \ tcpdump.1.in \ vfprintf.c \ - win32/Include/w32_fzs.h \ win32/prj/GNUmakefile \ win32/prj/WinDump.dsp \ - win32/prj/WinDump.dsw + win32/prj/WinDump.dsw \ + win32/prj/WinDump.sln \ + win32/prj/WinDump.vcproj \ + win32/src/ether_ntohost.c TEST_DIST= `find tests \( -name 'DIFF' -prune \) -o \( -name NEW -prune \) -o -type f \! -name '.*' \! -name '*~' -print` @@ -362,23 +375,15 @@ $(PROG): $(OBJ) @V_PCAPDEP@ $(LIBNETDISSECT): $(LIBNETDISSECT_OBJ) @rm -f $@ - $(AR) $(ARFLAGS) $@ $(LIBNETDISSECT_OBJ) + $(AR) cr $@ $(LIBNETDISSECT_OBJ) $(RANLIB) $@ datalinks.o: $(srcdir)/missing/datalinks.c $(CC) $(FULL_CFLAGS) -o $@ -c $(srcdir)/missing/datalinks.c dlnames.o: $(srcdir)/missing/dlnames.c $(CC) $(FULL_CFLAGS) -o $@ -c $(srcdir)/missing/dlnames.c -getnameinfo.o: $(srcdir)/missing/getnameinfo.c - $(CC) $(FULL_CFLAGS) -o $@ -c $(srcdir)/missing/getnameinfo.c getopt_long.o: $(srcdir)/missing/getopt_long.c $(CC) $(FULL_CFLAGS) -o $@ -c $(srcdir)/missing/getopt_long.c -inet_pton.o: $(srcdir)/missing/inet_pton.c - $(CC) $(FULL_CFLAGS) -o $@ -c $(srcdir)/missing/inet_pton.c -inet_ntop.o: $(srcdir)/missing/inet_ntop.c - $(CC) $(FULL_CFLAGS) -o $@ -c $(srcdir)/missing/inet_ntop.c -inet_aton.o: $(srcdir)/missing/inet_aton.c - $(CC) $(FULL_CFLAGS) -o $@ -c $(srcdir)/missing/inet_aton.c snprintf.o: $(srcdir)/missing/snprintf.c $(CC) $(FULL_CFLAGS) -o $@ -c $(srcdir)/missing/snprintf.c strdup.o: $(srcdir)/missing/strdup.c @@ -434,6 +439,9 @@ distclean: check: tcpdump (cd tests && ./TESTrun.sh) +extags: $(TAGFILES) + ctags $(TAGFILES) + tags: $(TAGFILES) ctags -wtd $(TAGFILES) Copied: stable/11/contrib/tcpdump/PLATFORMS (from r313048, head/contrib/tcpdump/PLATFORMS) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/11/contrib/tcpdump/PLATFORMS Fri Feb 10 07:22:12 2017 (r313537, copy of r313048, head/contrib/tcpdump/PLATFORMS) @@ -0,0 +1,9 @@ +== Tested platforms == +NetBSD 5.1/i386 (mcr - 2012/4/1) +Debian Linux (squeeze/i386) (mcr - 2012/4/1) + +--- +RedHat Linux 6.1/i386 (assar) +FreeBSD 2.2.8/i386 (itojun) + + Copied: stable/11/contrib/tcpdump/README (from r313048, head/contrib/tcpdump/README) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/11/contrib/tcpdump/README Fri Feb 10 07:22:12 2017 (r313537, copy of r313048, head/contrib/tcpdump/README) @@ -0,0 +1 @@ +link README.md \ No newline at end of file Modified: stable/11/contrib/tcpdump/VERSION ============================================================================== --- stable/11/contrib/tcpdump/VERSION Fri Feb 10 07:16:56 2017 (r313536) +++ stable/11/contrib/tcpdump/VERSION Fri Feb 10 07:22:12 2017 (r313537) @@ -1 +1 @@ -4.7.4 +4.9.0 Modified: stable/11/contrib/tcpdump/addrtoname.c ============================================================================== --- stable/11/contrib/tcpdump/addrtoname.c Fri Feb 10 07:16:56 2017 (r313536) +++ stable/11/contrib/tcpdump/addrtoname.c Fri Feb 10 07:22:12 2017 (r313537) @@ -20,11 +20,8 @@ * * Internet, ethernet, port, and protocol string to address * and address to string conversion routines - * - * $FreeBSD$ */ -#define NETDISSECT_REWORKED #ifdef HAVE_CONFIG_H #include "config.h" #endif @@ -33,7 +30,8 @@ #include #include #endif /* HAVE_CASPER */ -#include + +#include #ifdef USE_ETHER_NTOHOST #ifdef HAVE_NETINET_IF_ETHER_H @@ -64,8 +62,10 @@ extern int ether_ntohost(char *, const s #include #include -#include "interface.h" +#include "netdissect.h" #include "addrtoname.h" +#include "addrtostr.h" +#include "ethertype.h" #include "llc.h" #include "setsignal.h" #include "extract.h" @@ -78,7 +78,7 @@ extern int ether_ntohost(char *, const s /* * hash tables for whatever-to-name translations * - * XXX there has to be error checks against strdup(3) failure + * ndo_error() called on strdup(3) failure */ #define HASHNAMESIZE 4096 @@ -96,7 +96,7 @@ static struct hnamemem eprototable[HASHN static struct hnamemem dnaddrtable[HASHNAMESIZE]; static struct hnamemem ipxsaptable[HASHNAMESIZE]; -#if defined(INET6) && defined(WIN32) +#ifdef _WIN32 /* * fake gethostbyaddr for Win2k/XP * gethostbyaddr() returns incorrect value when AF_INET6 is passed @@ -134,9 +134,8 @@ win32_gethostbyaddr(const char *addr, in } } #define gethostbyaddr win32_gethostbyaddr -#endif /* INET6 & WIN32 */ +#endif /* _WIN32 */ -#ifdef INET6 struct h6namemem { struct in6_addr addr; char *name; @@ -144,7 +143,6 @@ struct h6namemem { }; static struct h6namemem h6nametable[HASHNAMESIZE]; -#endif /* INET6 */ struct enamemem { u_short e_addr0; @@ -214,7 +212,7 @@ extern cap_channel_t *capdns; * * NOTE: ap is *NOT* necessarily part of the packet data (not even if * this is being called with the "ipaddr_string()" macro), so you - * *CANNOT* use the TCHECK{2}/TTEST{2} macros on it. Furthermore, + * *CANNOT* use the ND_TCHECK{2}/ND_TTEST{2} macros on it. Furthermore, * even in cases where it *is* part of the packet data, the caller * would still have to check for a null return value, even if it's * just printing the return value with "%s" - not all versions of @@ -232,7 +230,7 @@ getname(netdissect_options *ndo, const u { register struct hostent *hp; uint32_t addr; - static struct hnamemem *p; /* static for longjmp() */ + struct hnamemem *p; memcpy(&addr, ap, sizeof(addr)); p = &hnametable[addr & (HASHNAMESIZE-1)]; @@ -241,7 +239,7 @@ getname(netdissect_options *ndo, const u return (p->name); } p->addr = addr; - p->nxt = newhnamemem(); + p->nxt = newhnamemem(ndo); /* * Print names unless: @@ -263,6 +261,9 @@ getname(netdissect_options *ndo, const u char *dotp; p->name = strdup(hp->h_name); + if (p->name == NULL) + (*ndo->ndo_error)(ndo, + "getname: strdup(hp->h_name)"); if (ndo->ndo_Nflag) { /* Remove domain qualifications */ dotp = strchr(p->name, '.'); @@ -273,10 +274,11 @@ getname(netdissect_options *ndo, const u } } p->name = strdup(intoa(addr)); + if (p->name == NULL) + (*ndo->ndo_error)(ndo, "getname: strdup(intoa(addr))"); return (p->name); } -#ifdef INET6 /* * Return a name for the IP6 address pointed to by ap. This address * is assumed to be in network byte order. @@ -292,7 +294,7 @@ getname6(netdissect_options *ndo, const uint16_t d; } addra; } addr; - static struct h6namemem *p; /* static for longjmp() */ + struct h6namemem *p; register const char *cp; char ntop_buf[INET6_ADDRSTRLEN]; @@ -303,7 +305,7 @@ getname6(netdissect_options *ndo, const return (p->name); } p->addr = addr.addr; - p->nxt = newh6namemem(); + p->nxt = newh6namemem(ndo); /* * Do not print names if -n was given. @@ -315,11 +317,15 @@ getname6(netdissect_options *ndo, const sizeof(addr), AF_INET6); } else #endif - hp = gethostbyaddr((char *)&addr, sizeof(addr), AF_INET6); + hp = gethostbyaddr((char *)&addr, sizeof(addr), + AF_INET6); if (hp) { char *dotp; p->name = strdup(hp->h_name); + if (p->name == NULL) + (*ndo->ndo_error)(ndo, + "getname6: strdup(hp->h_name)"); if (ndo->ndo_Nflag) { /* Remove domain qualifications */ dotp = strchr(p->name, '.'); @@ -329,11 +335,12 @@ getname6(netdissect_options *ndo, const return (p->name); } } - cp = inet_ntop(AF_INET6, &addr, ntop_buf, sizeof(ntop_buf)); + cp = addrtostr6(ap, ntop_buf, sizeof(ntop_buf)); p->name = strdup(cp); + if (p->name == NULL) + (*ndo->ndo_error)(ndo, "getname6: strdup(cp)"); return (p->name); } -#endif /* INET6 */ static const char hex[] = "0123456789abcdef"; @@ -341,7 +348,7 @@ static const char hex[] = "0123456789abc /* Find the hash node that corresponds the ether address 'ep' */ static inline struct enamemem * -lookup_emem(const u_char *ep) +lookup_emem(netdissect_options *ndo, const u_char *ep) { register u_int i, j, k; struct enamemem *tp; @@ -363,7 +370,7 @@ lookup_emem(const u_char *ep) tp->e_addr2 = k; tp->e_nxt = (struct enamemem *)calloc(1, sizeof(*tp)); if (tp->e_nxt == NULL) - error("lookup_emem: calloc"); + (*ndo->ndo_error)(ndo, "lookup_emem: calloc"); return tp; } @@ -374,7 +381,8 @@ lookup_emem(const u_char *ep) */ static inline struct enamemem * -lookup_bytestring(register const u_char *bs, const unsigned int nlen) +lookup_bytestring(netdissect_options *ndo, register const u_char *bs, + const unsigned int nlen) { struct enamemem *tp; register u_int i, j, k; @@ -406,12 +414,12 @@ lookup_bytestring(register const u_char tp->e_bs = (u_char *) calloc(1, nlen + 1); if (tp->e_bs == NULL) - error("lookup_bytestring: calloc"); + (*ndo->ndo_error)(ndo, "lookup_bytestring: calloc"); memcpy(tp->e_bs, bs, nlen); tp->e_nxt = (struct enamemem *)calloc(1, sizeof(*tp)); if (tp->e_nxt == NULL) - error("lookup_bytestring: calloc"); + (*ndo->ndo_error)(ndo, "lookup_bytestring: calloc"); return tp; } @@ -419,14 +427,15 @@ lookup_bytestring(register const u_char /* Find the hash node that corresponds the NSAP 'nsap' */ static inline struct enamemem * -lookup_nsap(register const u_char *nsap) +lookup_nsap(netdissect_options *ndo, register const u_char *nsap, + register u_int nsap_length) { register u_int i, j, k; - unsigned int nlen = *nsap; struct enamemem *tp; - const u_char *ensap = nsap + nlen - 6; + const u_char *ensap; *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-stable-11@freebsd.org Fri Feb 10 07:32:49 2017 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5AE56CD1D6D; Fri, 10 Feb 2017 07:32:49 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 0C150155E; Fri, 10 Feb 2017 07:32:48 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v1A7WmX2026521; Fri, 10 Feb 2017 07:32:48 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v1A7Wej8026447; Fri, 10 Feb 2017 07:32:40 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201702100732.v1A7Wej8026447@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Ngie Cooper Date: Fri, 10 Feb 2017 07:32:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r313538 - in stable/11/lib: csu/aarch64 csu/amd64 csu/arm csu/i386 csu/mips csu/powerpc csu/powerpc64 csu/riscv csu/sparc64 libalias/libalias libalias/modules libarchive libauditd libbe... X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 10 Feb 2017 07:32:49 -0000 Author: ngie Date: Fri Feb 10 07:32:40 2017 New Revision: 313538 URL: https://svnweb.freebsd.org/changeset/base/313538 Log: MFC r312452-r312512: r312452-r312512: - Use SRCTOP-relative paths to other directories instead of .CURDIR-relative ones This simplifies pathing in make/displayed output - Use .CURDIR:H instead of .CURDIR to simplify pathing in output, etc Modified: stable/11/lib/csu/aarch64/Makefile stable/11/lib/csu/amd64/Makefile stable/11/lib/csu/arm/Makefile stable/11/lib/csu/i386/Makefile stable/11/lib/csu/mips/Makefile stable/11/lib/csu/powerpc/Makefile stable/11/lib/csu/powerpc64/Makefile stable/11/lib/csu/riscv/Makefile stable/11/lib/csu/sparc64/Makefile stable/11/lib/libalias/libalias/Makefile stable/11/lib/libalias/modules/Makefile stable/11/lib/libalias/modules/Makefile.inc stable/11/lib/libarchive/Makefile stable/11/lib/libauditd/Makefile stable/11/lib/libbegemot/Makefile stable/11/lib/libblocksruntime/Makefile stable/11/lib/libbluetooth/Makefile stable/11/lib/libbsm/Makefile stable/11/lib/libbsnmp/libbsnmp/Makefile stable/11/lib/libbz2/Makefile stable/11/lib/libc++/Makefile stable/11/lib/libc_nonshared/Makefile stable/11/lib/libcam/Makefile stable/11/lib/libcom_err/Makefile stable/11/lib/libcompat/Makefile stable/11/lib/libcrypt/Makefile stable/11/lib/libcxxrt/Makefile stable/11/lib/libdevdctl/tests/Makefile stable/11/lib/libdwarf/Makefile stable/11/lib/libelf/Makefile stable/11/lib/libevent/Makefile stable/11/lib/libexecinfo/Makefile stable/11/lib/libexpat/Makefile stable/11/lib/libgssapi/Makefile stable/11/lib/libiconv_modules/Makefile.inc stable/11/lib/libiconv_modules/mapper_parallel/Makefile stable/11/lib/libkiconv/Makefile stable/11/lib/libldns/Makefile stable/11/lib/liblzma/Makefile stable/11/lib/libmagic/Makefile stable/11/lib/libmd/Makefile stable/11/lib/libmilter/Makefile stable/11/lib/libmp/Makefile stable/11/lib/libngatm/Makefile stable/11/lib/libnv/Makefile stable/11/lib/libopie/Makefile stable/11/lib/libpam/libpam/Makefile stable/11/lib/libpam/modules/Makefile.inc stable/11/lib/libpam/modules/pam_passwdqc/Makefile stable/11/lib/libpam/modules/pam_ssh/Makefile stable/11/lib/libpam/static_libpam/Makefile stable/11/lib/libpcap/Makefile stable/11/lib/libpe/Makefile stable/11/lib/libproc/Makefile stable/11/lib/libprocstat/zfs/Makefile stable/11/lib/librpcsec_gss/Makefile stable/11/lib/librpcsvc/Makefile stable/11/lib/librt/Makefile stable/11/lib/libsbuf/Makefile stable/11/lib/libsm/Makefile stable/11/lib/libsmb/Makefile stable/11/lib/libsmdb/Makefile stable/11/lib/libsmutil/Makefile stable/11/lib/libsqlite3/Makefile stable/11/lib/libstdthreads/Makefile stable/11/lib/libsysdecode/Makefile stable/11/lib/libtelnet/Makefile stable/11/lib/libthr/Makefile stable/11/lib/libthr/support/Makefile.inc stable/11/lib/libthread_db/Makefile stable/11/lib/libufs/Makefile stable/11/lib/libulog/Makefile stable/11/lib/libunbound/Makefile stable/11/lib/libutil/Makefile stable/11/lib/libypclnt/Makefile stable/11/lib/ncurses/config.mk stable/11/lib/ncurses/form/Makefile stable/11/lib/ncurses/formw/Makefile stable/11/lib/ncurses/menu/Makefile stable/11/lib/ncurses/menuw/Makefile stable/11/lib/ncurses/ncurses/Makefile stable/11/lib/ncurses/ncursesw/Makefile stable/11/lib/ncurses/panel/Makefile stable/11/lib/ncurses/panelw/Makefile Directory Properties: stable/11/ (props changed) Modified: stable/11/lib/csu/aarch64/Makefile ============================================================================== --- stable/11/lib/csu/aarch64/Makefile Fri Feb 10 07:22:12 2017 (r313537) +++ stable/11/lib/csu/aarch64/Makefile Fri Feb 10 07:32:40 2017 (r313538) @@ -1,12 +1,12 @@ # $FreeBSD$ -.PATH: ${.CURDIR}/../common +.PATH: ${.CURDIR:H}/common SRCS= crt1.c crti.S crtn.S OBJS= ${SRCS:N*.h:R:S/$/.o/g} OBJS+= Scrt1.o gcrt1.o -CFLAGS+= -I${.CURDIR}/../common \ - -I${.CURDIR}/../../libc/include +CFLAGS+= -I${.CURDIR:H}/common \ + -I${SRCTOP}/lib/libc/include FILES= ${OBJS} FILESMODE= ${LIBMODE} Modified: stable/11/lib/csu/amd64/Makefile ============================================================================== --- stable/11/lib/csu/amd64/Makefile Fri Feb 10 07:22:12 2017 (r313537) +++ stable/11/lib/csu/amd64/Makefile Fri Feb 10 07:32:40 2017 (r313538) @@ -1,12 +1,12 @@ # $FreeBSD$ -.PATH: ${.CURDIR}/../common +.PATH: ${.CURDIR:H}/common SRCS= crt1.c crti.S crtn.S OBJS= ${SRCS:N*.h:R:S/$/.o/g} OBJS+= Scrt1.o gcrt1.o -CFLAGS+= -I${.CURDIR}/../common \ - -I${.CURDIR}/../../libc/include +CFLAGS+= -I${.CURDIR:H}/common \ + -I${SRCTOP}/lib/libc/include CFLAGS+= -fno-omit-frame-pointer FILES= ${OBJS} Modified: stable/11/lib/csu/arm/Makefile ============================================================================== --- stable/11/lib/csu/arm/Makefile Fri Feb 10 07:22:12 2017 (r313537) +++ stable/11/lib/csu/arm/Makefile Fri Feb 10 07:32:40 2017 (r313538) @@ -1,12 +1,12 @@ # $FreeBSD$ -.PATH: ${.CURDIR}/../common +.PATH: ${.CURDIR:H}/common SRCS= crt1.c crti.S crtn.S OBJS= ${SRCS:N*.h:R:S/$/.o/g} OBJS+= Scrt1.o gcrt1.o -CFLAGS+= -I${.CURDIR}/../common \ - -I${.CURDIR}/../../libc/include +CFLAGS+= -I${.CURDIR:H}/common \ + -I${SRCTOP}/lib/libc/include STATIC_CFLAGS+= -mlong-calls FILES= ${OBJS} Modified: stable/11/lib/csu/i386/Makefile ============================================================================== --- stable/11/lib/csu/i386/Makefile Fri Feb 10 07:22:12 2017 (r313537) +++ stable/11/lib/csu/i386/Makefile Fri Feb 10 07:32:40 2017 (r313538) @@ -1,12 +1,12 @@ # $FreeBSD$ -.PATH: ${.CURDIR}/../common +.PATH: ${.CURDIR:H}/common SRCS= crti.S crtn.S OBJS= ${SRCS:N*.h:R:S/$/.o/g} OBJS+= gcrt1.o crt1.o Scrt1.o -CFLAGS+= -I${.CURDIR}/../common \ - -I${.CURDIR}/../../libc/include +CFLAGS+= -I${.CURDIR:H}/common \ + -I${SRCTOP}/lib/libc/include FILES= ${OBJS} FILESMODE= ${LIBMODE} Modified: stable/11/lib/csu/mips/Makefile ============================================================================== --- stable/11/lib/csu/mips/Makefile Fri Feb 10 07:22:12 2017 (r313537) +++ stable/11/lib/csu/mips/Makefile Fri Feb 10 07:32:40 2017 (r313538) @@ -1,12 +1,12 @@ # $FreeBSD$ -.PATH: ${.CURDIR}/../common +.PATH: ${.CURDIR:H}/common SRCS= crt1.c crti.S crtn.S OBJS= ${SRCS:N*.h:R:S/$/.o/g} OBJS+= Scrt1.o gcrt1.o -CFLAGS+= -I${.CURDIR}/../common \ - -I${.CURDIR}/../../libc/include +CFLAGS+= -I${.CURDIR:H}/common \ + -I${SRCTOP}/lib/libc/include FILES= ${OBJS} FILESMODE= ${LIBMODE} Modified: stable/11/lib/csu/powerpc/Makefile ============================================================================== --- stable/11/lib/csu/powerpc/Makefile Fri Feb 10 07:22:12 2017 (r313537) +++ stable/11/lib/csu/powerpc/Makefile Fri Feb 10 07:32:40 2017 (r313538) @@ -1,12 +1,12 @@ # $FreeBSD$ -.PATH: ${.CURDIR}/../common +.PATH: ${.CURDIR:H}/common SRCS= crt1.c crti.S crtn.S OBJS= ${SRCS:N*.h:R:S/$/.o/g} OBJS+= Scrt1.o gcrt1.o -CFLAGS+= -I${.CURDIR}/../common \ - -I${.CURDIR}/../../libc/include +CFLAGS+= -I${.CURDIR:H}/common \ + -I${SRCTOP}/lib/libc/include FILES= ${OBJS} FILESMODE= ${LIBMODE} Modified: stable/11/lib/csu/powerpc64/Makefile ============================================================================== --- stable/11/lib/csu/powerpc64/Makefile Fri Feb 10 07:22:12 2017 (r313537) +++ stable/11/lib/csu/powerpc64/Makefile Fri Feb 10 07:32:40 2017 (r313538) @@ -1,12 +1,12 @@ # $FreeBSD$ -.PATH: ${.CURDIR}/../common +.PATH: ${.CURDIR:H}/common SRCS= crt1.c crti.S crtn.S OBJS= ${SRCS:N*.h:R:S/$/.o/g} OBJS+= Scrt1.o gcrt1.o -CFLAGS+= -I${.CURDIR}/../common \ - -I${.CURDIR}/../../libc/include \ +CFLAGS+= -I${.CURDIR:H}/common \ + -I${SRCTOP}/lib/libc/include \ -mlongcall # XXX: See the log for r232932 as to why the above -mlongcall is needed. Since Modified: stable/11/lib/csu/riscv/Makefile ============================================================================== --- stable/11/lib/csu/riscv/Makefile Fri Feb 10 07:22:12 2017 (r313537) +++ stable/11/lib/csu/riscv/Makefile Fri Feb 10 07:32:40 2017 (r313538) @@ -1,12 +1,12 @@ # $FreeBSD$ -.PATH: ${.CURDIR}/../common +.PATH: ${.CURDIR:H}/common SRCS= crt1.c crti.S crtn.S OBJS= ${SRCS:N*.h:R:S/$/.o/g} OBJS+= Scrt1.o gcrt1.o -CFLAGS+= -I${.CURDIR}/../common \ - -I${.CURDIR}/../../libc/include +CFLAGS+= -I${.CURDIR:H}/common \ + -I${SRCTOP}/lib/libc/include FILES= ${OBJS} FILESMODE= ${LIBMODE} Modified: stable/11/lib/csu/sparc64/Makefile ============================================================================== --- stable/11/lib/csu/sparc64/Makefile Fri Feb 10 07:22:12 2017 (r313537) +++ stable/11/lib/csu/sparc64/Makefile Fri Feb 10 07:32:40 2017 (r313538) @@ -1,11 +1,12 @@ # $FreeBSD$ -.PATH: ${.CURDIR}/../common +.PATH: ${.CURDIR:H}/common SRCS= crt1.c crti.S crtn.S OBJS= ${SRCS:N*.h:R:S/$/.o/g} OBJS+= Scrt1.o gcrt1.o -CFLAGS+= -I${.CURDIR}/../common -I${.CURDIR}/../../libc/include +CFLAGS+= -I${.CURDIR:H}/common \ + -I${SRCTOP}/lib/libc/include FILES= ${OBJS} FILESMODE= ${LIBMODE} Modified: stable/11/lib/libalias/libalias/Makefile ============================================================================== --- stable/11/lib/libalias/libalias/Makefile Fri Feb 10 07:22:12 2017 (r313537) +++ stable/11/lib/libalias/libalias/Makefile Fri Feb 10 07:32:40 2017 (r313538) @@ -1,6 +1,6 @@ # $FreeBSD$ -.PATH: ${.CURDIR}/../../../sys/netinet/libalias +.PATH: ${SRCTOP}/sys/netinet/libalias PACKAGE=lib${LIB} LIB= alias Modified: stable/11/lib/libalias/modules/Makefile ============================================================================== --- stable/11/lib/libalias/modules/Makefile Fri Feb 10 07:22:12 2017 (r313537) +++ stable/11/lib/libalias/modules/Makefile Fri Feb 10 07:32:40 2017 (r313538) @@ -1,6 +1,6 @@ # $FreeBSD$ -.include "${.CURDIR}/../../../sys/modules/libalias/modules/modules.inc" +.include "${SRCTOP}/sys/modules/libalias/modules/modules.inc" SUBDIR= ${MODULES} Modified: stable/11/lib/libalias/modules/Makefile.inc ============================================================================== --- stable/11/lib/libalias/modules/Makefile.inc Fri Feb 10 07:22:12 2017 (r313537) +++ stable/11/lib/libalias/modules/Makefile.inc Fri Feb 10 07:32:40 2017 (r313538) @@ -1,6 +1,6 @@ # $FreeBSD$ -.PATH: ${.CURDIR}/../../../../sys/netinet/libalias +.PATH: ${SRCTOP}/sys/netinet/libalias SHLIBDIR?= /lib LIB?= alias_${NAME} Modified: stable/11/lib/libarchive/Makefile ============================================================================== --- stable/11/lib/libarchive/Makefile Fri Feb 10 07:22:12 2017 (r313537) +++ stable/11/lib/libarchive/Makefile Fri Feb 10 07:32:40 2017 (r313538) @@ -2,7 +2,7 @@ .include PACKAGE=lib${LIB} -_LIBARCHIVEDIR= ${.CURDIR}/../../contrib/libarchive +_LIBARCHIVEDIR= ${SRCTOP}/contrib/libarchive LIB= archive Modified: stable/11/lib/libauditd/Makefile ============================================================================== --- stable/11/lib/libauditd/Makefile Fri Feb 10 07:22:12 2017 (r313537) +++ stable/11/lib/libauditd/Makefile Fri Feb 10 07:32:40 2017 (r313538) @@ -3,7 +3,7 @@ # PACKAGE=lib${LIB} -OPENBSMDIR= ${.CURDIR}/../../contrib/openbsm +OPENBSMDIR= ${SRCTOP}/contrib/openbsm _LIBAUDITDDIR= ${OPENBSMDIR}/libauditd _LIBBSMDIR= ${OPENBSMDIR}/libbsm Modified: stable/11/lib/libbegemot/Makefile ============================================================================== --- stable/11/lib/libbegemot/Makefile Fri Feb 10 07:22:12 2017 (r313537) +++ stable/11/lib/libbegemot/Makefile Fri Feb 10 07:32:40 2017 (r313538) @@ -1,6 +1,6 @@ # $FreeBSD$ -LIBBEGEMOT_DIR=${.CURDIR}/../../contrib/libbegemot +LIBBEGEMOT_DIR=${SRCTOP}/contrib/libbegemot PACKAGE=lib${LIB} .PATH: ${LIBBEGEMOT_DIR} Modified: stable/11/lib/libblocksruntime/Makefile ============================================================================== --- stable/11/lib/libblocksruntime/Makefile Fri Feb 10 07:22:12 2017 (r313537) +++ stable/11/lib/libblocksruntime/Makefile Fri Feb 10 07:32:40 2017 (r313538) @@ -6,7 +6,7 @@ SHLIB_MAJOR=0 CFLAGS+=-I${.CURDIR} WARNS?= 2 -.PATH: ${.CURDIR}/../../contrib/compiler-rt/lib/BlocksRuntime +.PATH: ${SRCTOP}/contrib/compiler-rt/lib/BlocksRuntime INCS= Block.h Block_private.h SRCS= data.c runtime.c Modified: stable/11/lib/libbluetooth/Makefile ============================================================================== --- stable/11/lib/libbluetooth/Makefile Fri Feb 10 07:22:12 2017 (r313537) +++ stable/11/lib/libbluetooth/Makefile Fri Feb 10 07:32:40 2017 (r313538) @@ -6,7 +6,7 @@ LIB= bluetooth MAN= bluetooth.3 WARNS?= 2 -CFLAGS+= -I${.CURDIR} -I${.CURDIR}/../../sys +CFLAGS+= -I${.CURDIR} -I${SRCTOP}/sys SHLIB_MAJOR= 4 Modified: stable/11/lib/libbsm/Makefile ============================================================================== --- stable/11/lib/libbsm/Makefile Fri Feb 10 07:22:12 2017 (r313537) +++ stable/11/lib/libbsm/Makefile Fri Feb 10 07:32:40 2017 (r313538) @@ -3,7 +3,7 @@ # PACKAGE= lib${LIB} -OPENBSMDIR= ${.CURDIR}/../../contrib/openbsm +OPENBSMDIR= ${SRCTOP}/contrib/openbsm _LIBBSMDIR= ${OPENBSMDIR}/libbsm LIB= bsm Modified: stable/11/lib/libbsnmp/libbsnmp/Makefile ============================================================================== --- stable/11/lib/libbsnmp/libbsnmp/Makefile Fri Feb 10 07:22:12 2017 (r313537) +++ stable/11/lib/libbsnmp/libbsnmp/Makefile Fri Feb 10 07:32:40 2017 (r313538) @@ -4,7 +4,7 @@ .include -CONTRIB= ${.CURDIR}/../../../contrib/bsnmp/lib +CONTRIB= ${SRCTOP}/contrib/bsnmp/lib .PATH: ${CONTRIB} LIB= bsnmp Modified: stable/11/lib/libbz2/Makefile ============================================================================== --- stable/11/lib/libbz2/Makefile Fri Feb 10 07:22:12 2017 (r313537) +++ stable/11/lib/libbz2/Makefile Fri Feb 10 07:32:40 2017 (r313538) @@ -1,7 +1,7 @@ # $FreeBSD$ PACKAGE= lib${LIB} -BZ2DIR= ${.CURDIR}/../../contrib/bzip2 +BZ2DIR= ${SRCTOP}/contrib/bzip2 .PATH: ${BZ2DIR} LIB= bz2 Modified: stable/11/lib/libc++/Makefile ============================================================================== --- stable/11/lib/libc++/Makefile Fri Feb 10 07:22:12 2017 (r313537) +++ stable/11/lib/libc++/Makefile Fri Feb 10 07:32:40 2017 (r313538) @@ -3,9 +3,9 @@ .include PACKAGE= clibs -_LIBCXXRTDIR= ${.CURDIR}/../../contrib/libcxxrt -HDRDIR= ${.CURDIR}/../../contrib/libc++/include -SRCDIR= ${.CURDIR}/../../contrib/libc++/src +_LIBCXXRTDIR= ${SRCTOP}/contrib/libcxxrt +HDRDIR= ${SRCTOP}/contrib/libc++/include +SRCDIR= ${SRCTOP}/contrib/libc++/src CXXINCLUDEDIR= ${INCLUDEDIR}/c++/v${SHLIB_MAJOR} .if ${MACHINE_CPUARCH} == "arm" STATIC_CXXFLAGS+= -mlong-calls Modified: stable/11/lib/libc_nonshared/Makefile ============================================================================== --- stable/11/lib/libc_nonshared/Makefile Fri Feb 10 07:22:12 2017 (r313537) +++ stable/11/lib/libc_nonshared/Makefile Fri Feb 10 07:32:40 2017 (r313538) @@ -6,7 +6,7 @@ # bsd.lib.mk doesn't have an easy way to express that. MK_PROFILE?=no .include -NO_PIC= +NO_PIC= # -fpic on some platforms, -fPIC on others. CFLAGS+=${PICFLAG} -DPIC -fvisibility=hidden @@ -18,9 +18,9 @@ LIBC_NONSHARED_SRCS= SRCS= __stub.c .if ${MK_ICONV} == "yes" -.PATH: ${.CURDIR}/../libc/iconv +.PATH: ${SRCTOP}/lib/libc/iconv .include "Makefile.iconv" -CFLAGS+=-I${.CURDIR}/../libc/iconv +CFLAGS+=-I${SRCTOP}/lib/libc/iconv .endif SRCS+= ${LIBC_NONSHARED_SRCS} Modified: stable/11/lib/libcam/Makefile ============================================================================== --- stable/11/lib/libcam/Makefile Fri Feb 10 07:22:12 2017 (r313537) +++ stable/11/lib/libcam/Makefile Fri Feb 10 07:32:40 2017 (r313538) @@ -36,11 +36,10 @@ MLINKS+= cam.3 cam_open_device.3 \ cam_cdbparse.3 csio_encode_visit.3 \ cam_cdbparse.3 buff_encode_visit.3 -.PATH: ${.CURDIR}/../../sys/cam/scsi ${.CURDIR}/../../sys/cam/ata \ - ${.CURDIR}/../../sys/cam +.PATH: ${SRCTOP}/sys/cam/scsi ${SRCTOP}/sys/cam/ata \ + ${SRCTOP}/sys/cam -SDIR= ${.CURDIR}/../../sys -CFLAGS+= -I${.CURDIR} -I${SDIR} +CFLAGS+= -I${.CURDIR} -I${SRCTOP}/sys SHLIB_MAJOR= 7 Modified: stable/11/lib/libcom_err/Makefile ============================================================================== --- stable/11/lib/libcom_err/Makefile Fri Feb 10 07:22:12 2017 (r313537) +++ stable/11/lib/libcom_err/Makefile Fri Feb 10 07:32:40 2017 (r313538) @@ -5,7 +5,7 @@ LIB= com_err SRCS= com_err.c error.c INCS= ${COM_ERRDIR}/com_err.h ${COM_ERRDIR}/com_right.h MAN= com_err.3 -COM_ERRDIR= ${.CURDIR}/../../contrib/com_err +COM_ERRDIR= ${SRCTOP}/contrib/com_err CFLAGS+= -I${COM_ERRDIR} LDFLAGS= -Wl,--no-undefined Modified: stable/11/lib/libcompat/Makefile ============================================================================== --- stable/11/lib/libcompat/Makefile Fri Feb 10 07:22:12 2017 (r313537) +++ stable/11/lib/libcompat/Makefile Fri Feb 10 07:32:40 2017 (r313538) @@ -3,7 +3,7 @@ PACKAGE=lib${LIB} LIB= compat -CFLAGS+=-DLIBC_SCCS -DSYSLIBC_SCCS -I${.CURDIR}/../libc/locale +CFLAGS+=-DLIBC_SCCS -DSYSLIBC_SCCS -I${SRCTOP}/lib/libc/locale NO_PIC= WARNS?= 0 Modified: stable/11/lib/libcrypt/Makefile ============================================================================== --- stable/11/lib/libcrypt/Makefile Fri Feb 10 07:22:12 2017 (r313537) +++ stable/11/lib/libcrypt/Makefile Fri Feb 10 07:32:40 2017 (r313538) @@ -10,7 +10,7 @@ SHLIBDIR?= /lib SHLIB_MAJOR= 5 LIB= crypt -.PATH: ${.CURDIR}/../libmd ${.CURDIR}/../../sys/crypto/sha2 +.PATH: ${SRCTOP}/lib/libmd ${SRCTOP}/sys/crypto/sha2 SRCS= crypt.c misc.c \ crypt-md5.c md5c.c \ crypt-nthash.c md4c.c \ @@ -18,12 +18,12 @@ SRCS= crypt.c misc.c \ crypt-sha512.c sha512c.c MAN= crypt.3 MLINKS= crypt.3 crypt_get_format.3 crypt.3 crypt_set_format.3 -CFLAGS+= -I${.CURDIR}/../libmd -I${.CURDIR}/../libutil \ - -I${.CURDIR}/../../sys/crypto/sha2 +CFLAGS+= -I${SRCTOP}/lib/libmd -I${SRCTOP}/lib/libutil \ + -I${SRCTOP}/sys/crypto/sha2 # Pull in the strong crypto, if it is present. -.if exists(${.CURDIR}/../../secure/lib/libcrypt) && ${MK_CRYPT} != "no" -.PATH: ${.CURDIR}/../../secure/lib/libcrypt +.if exists(${SRCTOP}/secure/lib/libcrypt) && ${MK_CRYPT} != "no" +.PATH: ${SRCTOP}/secure/lib/libcrypt SRCS+= crypt-des.c crypt-blowfish.c blowfish.c CFLAGS+= -I${.CURDIR} -DHAS_DES -DHAS_BLOWFISH .endif Modified: stable/11/lib/libcxxrt/Makefile ============================================================================== --- stable/11/lib/libcxxrt/Makefile Fri Feb 10 07:22:12 2017 (r313537) +++ stable/11/lib/libcxxrt/Makefile Fri Feb 10 07:32:40 2017 (r313538) @@ -1,7 +1,7 @@ # $FreeBSD$ PACKAGE= clibs -SRCDIR= ${.CURDIR}/../../contrib/libcxxrt +SRCDIR= ${SRCTOP}/contrib/libcxxrt SHLIB_MAJOR= 1 SHLIBDIR?= /lib Modified: stable/11/lib/libdevdctl/tests/Makefile ============================================================================== --- stable/11/lib/libdevdctl/tests/Makefile Fri Feb 10 07:22:12 2017 (r313537) +++ stable/11/lib/libdevdctl/tests/Makefile Fri Feb 10 07:32:40 2017 (r313538) @@ -2,7 +2,7 @@ TESTSDIR= ${TESTSBASE}/lib/libdevdctl -.PATH: ${.CURDIR}/.. +.PATH: ${.CURDIR:H} PLAIN_TESTS_CXX= libdevdctl_unittest Modified: stable/11/lib/libdwarf/Makefile ============================================================================== --- stable/11/lib/libdwarf/Makefile Fri Feb 10 07:22:12 2017 (r313537) +++ stable/11/lib/libdwarf/Makefile Fri Feb 10 07:32:40 2017 (r313538) @@ -94,7 +94,7 @@ CLEANFILES= ${GENSRCS} CLEANDIRS= sys CFLAGS+= -I. -I${SRCDIR} -I${ELFTCDIR}/common -I${ELFTCDIR}/libelf -sys/elf32.h sys/elf64.h sys/elf_common.h: ${.CURDIR}/../../sys/${.TARGET} .NOMETA +sys/elf32.h sys/elf64.h sys/elf_common.h: ${SRCTOP}/sys/${.TARGET} .NOMETA mkdir -p ${.OBJDIR}/sys ln -sf ${.ALLSRC} ${.TARGET} Modified: stable/11/lib/libelf/Makefile ============================================================================== --- stable/11/lib/libelf/Makefile Fri Feb 10 07:22:12 2017 (r313537) +++ stable/11/lib/libelf/Makefile Fri Feb 10 07:32:40 2017 (r313538) @@ -82,7 +82,7 @@ CLEANFILES= ${GENSRCS} CLEANDIRS= sys CFLAGS+= -I. -I${SRCDIR} -I${ELFTCDIR}/common -sys/elf32.h sys/elf64.h sys/elf_common.h: ${.CURDIR}/../../sys/${.TARGET} .NOMETA +sys/elf32.h sys/elf64.h sys/elf_common.h: ${SRCTOP}/sys/${.TARGET} .NOMETA mkdir -p ${.OBJDIR}/sys ln -sf ${.ALLSRC} ${.TARGET} Modified: stable/11/lib/libevent/Makefile ============================================================================== --- stable/11/lib/libevent/Makefile Fri Feb 10 07:22:12 2017 (r313537) +++ stable/11/lib/libevent/Makefile Fri Feb 10 07:32:40 2017 (r313538) @@ -1,7 +1,7 @@ # $FreeBSD$ PACKAGE=lib${LIB} -.PATH: ${.CURDIR}/../../contrib/pf/libevent +.PATH: ${SRCTOP}/contrib/pf/libevent .include Modified: stable/11/lib/libexecinfo/Makefile ============================================================================== --- stable/11/lib/libexecinfo/Makefile Fri Feb 10 07:22:12 2017 (r313537) +++ stable/11/lib/libexecinfo/Makefile Fri Feb 10 07:32:40 2017 (r313538) @@ -1,7 +1,7 @@ # $FreeBSD$ PACKAGE=lib${LIB} -LIBEXECINFO= ${.CURDIR}/../../contrib/libexecinfo +LIBEXECINFO= ${SRCTOP}/contrib/libexecinfo LIB= execinfo SHLIB_MAJOR= 1 Modified: stable/11/lib/libexpat/Makefile ============================================================================== --- stable/11/lib/libexpat/Makefile Fri Feb 10 07:22:12 2017 (r313537) +++ stable/11/lib/libexpat/Makefile Fri Feb 10 07:32:40 2017 (r313538) @@ -1,7 +1,7 @@ # $FreeBSD$ PACKAGE=lib${LIB} -EXPAT= ${.CURDIR}/../../contrib/expat +EXPAT= ${SRCTOP}/contrib/expat LIB= bsdxml SHLIBDIR?= /lib Modified: stable/11/lib/libgssapi/Makefile ============================================================================== --- stable/11/lib/libgssapi/Makefile Fri Feb 10 07:22:12 2017 (r313537) +++ stable/11/lib/libgssapi/Makefile Fri Feb 10 07:32:40 2017 (r313538) @@ -3,7 +3,7 @@ PACKAGE=lib${LIB} LIB= gssapi SHLIB_MAJOR= 10 -VERSION_DEF= ${.CURDIR}/../libc/Versions.def +VERSION_DEF= ${SRCTOP}/lib/libc/Versions.def SYMBOL_MAPS= ${.CURDIR}/Symbol.map SRCS= Modified: stable/11/lib/libiconv_modules/Makefile.inc ============================================================================== --- stable/11/lib/libiconv_modules/Makefile.inc Fri Feb 10 07:22:12 2017 (r313537) +++ stable/11/lib/libiconv_modules/Makefile.inc Fri Feb 10 07:32:40 2017 (r313538) @@ -1,10 +1,10 @@ # $FreeBSD$ -.PATH: ${.CURDIR}/../../libc/iconv +.PATH: ${SRCTOP}/lib/libc/iconv SHLIB_MAJOR= 4 WARNS?= 6 -CFLAGS+= -I${.CURDIR}/../../libc/iconv +CFLAGS+= -I${SRCTOP}/lib/libc/iconv CFLAGS+= -Dbool=_Bool Modified: stable/11/lib/libiconv_modules/mapper_parallel/Makefile ============================================================================== --- stable/11/lib/libiconv_modules/mapper_parallel/Makefile Fri Feb 10 07:22:12 2017 (r313537) +++ stable/11/lib/libiconv_modules/mapper_parallel/Makefile Fri Feb 10 07:32:40 2017 (r313538) @@ -1,6 +1,6 @@ # $FreeBSD$ -.PATH: ${.CURDIR}/../mapper_serial +.PATH: ${.CURDIR:H}/mapper_serial SHLIB= mapper_parallel SRCS+= citrus_mapper_serial.c Modified: stable/11/lib/libkiconv/Makefile ============================================================================== --- stable/11/lib/libkiconv/Makefile Fri Feb 10 07:22:12 2017 (r313537) +++ stable/11/lib/libkiconv/Makefile Fri Feb 10 07:32:40 2017 (r313538) @@ -17,7 +17,7 @@ MLINKS+= kiconv.3 kiconv_add_xlat16_cspa kiconv.3 kiconv_add_xlat16_cspairs.3 \ kiconv.3 kiconv_add_xlat16_table.3 -CFLAGS+= -I${.CURDIR}/../../sys +CFLAGS+= -I${SRCTOP}/sys WARNS?= 1 Modified: stable/11/lib/libldns/Makefile ============================================================================== --- stable/11/lib/libldns/Makefile Fri Feb 10 07:22:12 2017 (r313537) +++ stable/11/lib/libldns/Makefile Fri Feb 10 07:32:40 2017 (r313538) @@ -1,7 +1,7 @@ # $FreeBSD$ # Vendor sources and generated files -LDNSDIR = ${.CURDIR}/../../contrib/ldns +LDNSDIR = ${SRCTOP}/contrib/ldns PACKAGE=lib${LIB} .PATH: ${LDNSDIR} ${LDNSDIR}/compat Modified: stable/11/lib/liblzma/Makefile ============================================================================== --- stable/11/lib/liblzma/Makefile Fri Feb 10 07:22:12 2017 (r313537) +++ stable/11/lib/liblzma/Makefile Fri Feb 10 07:32:40 2017 (r313538) @@ -2,9 +2,9 @@ PACKAGE=lib${LIB} LIB= lzma -LZMADIR= ${.CURDIR}/../../contrib/xz/src/liblzma +LZMADIR= ${SRCTOP}/contrib/xz/src/liblzma -.PATH: ${LZMADIR}/../common +.PATH: ${LZMADIR:H}/common SRCS+= tuklib_physmem.c tuklib_cpucores.c .PATH: ${LZMADIR}/api/lzma @@ -145,7 +145,7 @@ CFLAGS+= -DHAVE_CONFIG_H \ -I${LZMADIR}/lzma \ -I${LZMADIR}/delta \ -I${LZMADIR}/simple \ - -I${LZMADIR}/../common + -I${LZMADIR:H}/common LIBADD+= pthread Modified: stable/11/lib/libmagic/Makefile ============================================================================== --- stable/11/lib/libmagic/Makefile Fri Feb 10 07:22:12 2017 (r313537) +++ stable/11/lib/libmagic/Makefile Fri Feb 10 07:32:40 2017 (r313538) @@ -2,7 +2,7 @@ # Copyright (c) David E. O'Brien, 2000-2004, 2006, 2009 PACKAGE=lib${LIB} -CONTRDIR= ${.CURDIR}/../../contrib/file +CONTRDIR= ${SRCTOP}/contrib/file .PATH: ${CONTRDIR}/src .PATH: ${CONTRDIR}/doc Modified: stable/11/lib/libmd/Makefile ============================================================================== --- stable/11/lib/libmd/Makefile Fri Feb 10 07:22:12 2017 (r313537) +++ stable/11/lib/libmd/Makefile Fri Feb 10 07:32:40 2017 (r313538) @@ -78,11 +78,11 @@ CLEANFILES+= md[245]hl.c md[245].ref md[ # in which case: # * macros are used to rename symbols to libcrypt internal names # * no weak aliases are generated -CFLAGS+= -I${.CURDIR} -I${.CURDIR}/../../sys/crypto/sha2 -CFLAGS+= -I${.CURDIR}/../../sys/crypto/skein +CFLAGS+= -I${.CURDIR} -I${SRCTOP}/sys/crypto/sha2 +CFLAGS+= -I${SRCTOP}/sys/crypto/skein CFLAGS+= -DWEAK_REFS -.PATH: ${.CURDIR}/${MACHINE_ARCH} ${.CURDIR}/../../sys/crypto/sha2 -.PATH: ${.CURDIR}/../../sys/crypto/skein ${.CURDIR}/../../sys/crypto/skein/${MACHINE_ARCH} +.PATH: ${.CURDIR}/${MACHINE_ARCH} ${SRCTOP}/sys/crypto/sha2 +.PATH: ${SRCTOP}/sys/crypto/skein ${SRCTOP}/sys/crypto/skein/${MACHINE_ARCH} .if exists(${MACHINE_ARCH}/sha.S) SRCS+= sha.S Modified: stable/11/lib/libmilter/Makefile ============================================================================== --- stable/11/lib/libmilter/Makefile Fri Feb 10 07:22:12 2017 (r313537) +++ stable/11/lib/libmilter/Makefile Fri Feb 10 07:32:40 2017 (r313538) @@ -3,7 +3,7 @@ .include PACKAGE=sendmail -SENDMAIL_DIR=${.CURDIR}/../../contrib/sendmail +SENDMAIL_DIR=${SRCTOP}/contrib/sendmail .PATH: ${SENDMAIL_DIR}/libmilter ${SENDMAIL_DIR}/libsm CFLAGS+=-I${SENDMAIL_DIR}/src -I${SENDMAIL_DIR}/include -I. Modified: stable/11/lib/libmp/Makefile ============================================================================== --- stable/11/lib/libmp/Makefile Fri Feb 10 07:22:12 2017 (r313537) +++ stable/11/lib/libmp/Makefile Fri Feb 10 07:32:40 2017 (r313538) @@ -10,9 +10,9 @@ MAN= libmp.3 INCS= mp.h SRCS= mpasbn.c -CFLAGS+= -I${.CURDIR}/../../crypto +CFLAGS+= -I${SRCTOP}/crypto -VERSION_DEF= ${.CURDIR}/../libc/Versions.def +VERSION_DEF= ${SRCTOP}/lib/libc/Versions.def SYMBOL_MAPS= ${.CURDIR}/Symbol.map .if ${MK_TESTS} != "no" Modified: stable/11/lib/libngatm/Makefile ============================================================================== --- stable/11/lib/libngatm/Makefile Fri Feb 10 07:22:12 2017 (r313537) +++ stable/11/lib/libngatm/Makefile Fri Feb 10 07:32:40 2017 (r313538) @@ -8,8 +8,8 @@ SHLIB_MAJOR= 4 MAN= libngatm.3 uniaddr.3 unifunc.3 unimsg.3 unisap.3 unistruct.3 # source of the library lives in contrib -SDIR= ${.CURDIR}/../../sys -CTRB= ${.CURDIR}/../../contrib/ngatm +SDIR= ${SRCTOP}/sys +CTRB= ${SRCTOP}/contrib/ngatm LIBBASE= ${SDIR}/contrib/ngatm CFLAGS+= -I${LIBBASE} -I${.OBJDIR} -I${CTRB}/libngatm Modified: stable/11/lib/libnv/Makefile ============================================================================== --- stable/11/lib/libnv/Makefile Fri Feb 10 07:22:12 2017 (r313537) +++ stable/11/lib/libnv/Makefile Fri Feb 10 07:32:40 2017 (r313538) @@ -8,8 +8,8 @@ SHLIBDIR?= /lib LIB= nv SHLIB_MAJOR= 0 -.PATH: ${.CURDIR}/../../sys/contrib/libnv ${.CURDIR}/../../sys/sys -CFLAGS+=-I${.CURDIR}/../../sys -I${.CURDIR} +.PATH: ${SRCTOP}/sys/contrib/libnv ${SRCTOP}/sys/sys +CFLAGS+=-I${SRCTOP}/sys -I${.CURDIR} SRCS= dnvlist.c SRCS+= msgio.c Modified: stable/11/lib/libopie/Makefile ============================================================================== --- stable/11/lib/libopie/Makefile Fri Feb 10 07:22:12 2017 (r313537) +++ stable/11/lib/libopie/Makefile Fri Feb 10 07:32:40 2017 (r313538) @@ -3,7 +3,7 @@ # $FreeBSD$ # PACKAGE=lib${LIB} -OPIE_DIST?= ${.CURDIR}/../../contrib/opie +OPIE_DIST?= ${SRCTOP}/contrib/opie DIST_DIR= ${OPIE_DIST}/${.CURDIR:T} SHLIB_MAJOR= 8 Modified: stable/11/lib/libpam/libpam/Makefile ============================================================================== --- stable/11/lib/libpam/libpam/Makefile Fri Feb 10 07:22:12 2017 (r313537) +++ stable/11/lib/libpam/libpam/Makefile Fri Feb 10 07:32:40 2017 (r313538) @@ -36,7 +36,7 @@ # $FreeBSD$ PACKAGE=lib${LIB} -OPENPAM= ${.CURDIR}/../../../contrib/openpam +OPENPAM= ${SRCTOP}/contrib/openpam .PATH: ${OPENPAM}/include ${OPENPAM}/lib/libpam ${OPENPAM}/doc/man # static_libpam will build libpam.a Modified: stable/11/lib/libpam/modules/Makefile.inc ============================================================================== --- stable/11/lib/libpam/modules/Makefile.inc Fri Feb 10 07:22:12 2017 (r313537) +++ stable/11/lib/libpam/modules/Makefile.inc Fri Feb 10 07:32:40 2017 (r313538) @@ -1,11 +1,11 @@ # $FreeBSD$ -PAMDIR= ${.CURDIR}/../../../../contrib/openpam +PAMDIR= ${SRCTOP}/contrib/openpam MK_INSTALLLIB= no MK_PROFILE= no -CFLAGS+= -I${PAMDIR}/include -I${.CURDIR}/../../libpam +CFLAGS+= -I${PAMDIR}/include -I${SRCTOP}/lib/libpam SHLIB_NAME?= ${LIB}.so.${SHLIB_MAJOR} LIBADD+= pam Modified: stable/11/lib/libpam/modules/pam_passwdqc/Makefile ============================================================================== --- stable/11/lib/libpam/modules/pam_passwdqc/Makefile Fri Feb 10 07:22:12 2017 (r313537) +++ stable/11/lib/libpam/modules/pam_passwdqc/Makefile Fri Feb 10 07:32:40 2017 (r313538) @@ -1,6 +1,6 @@ # $FreeBSD$ -SRCDIR= ${.CURDIR}/../../../../contrib/pam_modules/pam_passwdqc +SRCDIR= ${SRCTOP}/contrib/pam_modules/pam_passwdqc .PATH: ${SRCDIR} LIB= pam_passwdqc Modified: stable/11/lib/libpam/modules/pam_ssh/Makefile ============================================================================== --- stable/11/lib/libpam/modules/pam_ssh/Makefile Fri Feb 10 07:22:12 2017 (r313537) +++ stable/11/lib/libpam/modules/pam_ssh/Makefile Fri Feb 10 07:32:40 2017 (r313538) @@ -1,7 +1,7 @@ # PAM module for SSH # $FreeBSD$ -SSHDIR= ${.CURDIR}/../../../../crypto/openssh +SSHDIR= ${SRCTOP}/crypto/openssh LIB= pam_ssh MAN= pam_ssh.8 Modified: stable/11/lib/libpam/static_libpam/Makefile ============================================================================== --- stable/11/lib/libpam/static_libpam/Makefile Fri Feb 10 07:22:12 2017 (r313537) +++ stable/11/lib/libpam/static_libpam/Makefile Fri Feb 10 07:32:40 2017 (r313538) @@ -35,7 +35,7 @@ # # $FreeBSD$ -.PATH: ${.CURDIR}/../libpam +.PATH: ${SRCTOP}/lib/libpam # Only build the static library. LIB= pam @@ -66,4 +66,4 @@ CLEANFILES+= openpam_static.o \ openpam_static_modules.o: openpam_static.o ${STATIC_MODULES} ${LD} -o ${.TARGET} -r --whole-archive ${.ALLSRC} -.include "${.CURDIR}/../libpam/Makefile" +.include "${.CURDIR:H}/libpam/Makefile" Modified: stable/11/lib/libpcap/Makefile ============================================================================== --- stable/11/lib/libpcap/Makefile Fri Feb 10 07:22:12 2017 (r313537) +++ stable/11/lib/libpcap/Makefile Fri Feb 10 07:32:40 2017 (r313538) @@ -114,7 +114,7 @@ SHLIB_MAJOR= 8 # # Magic to grab sources out of src/contrib # -PCAP_DISTDIR?=${.CURDIR}/../../contrib/libpcap +PCAP_DISTDIR?=${SRCTOP}/contrib/libpcap CFLAGS+=-I${PCAP_DISTDIR} .PATH: ${PCAP_DISTDIR} .PATH: ${PCAP_DISTDIR}/bpf/net Modified: stable/11/lib/libpe/Makefile ============================================================================== --- stable/11/lib/libpe/Makefile Fri Feb 10 07:22:12 2017 (r313537) +++ stable/11/lib/libpe/Makefile Fri Feb 10 07:32:40 2017 (r313538) @@ -3,7 +3,7 @@ INTERNALLIB= -ELFTCDIR= ${.CURDIR}/../../contrib/elftoolchain +ELFTCDIR= ${SRCTOP}/contrib/elftoolchain .PATH: ${ELFTCDIR}/libpe Modified: stable/11/lib/libproc/Makefile ============================================================================== --- stable/11/lib/libproc/Makefile Fri Feb 10 07:22:12 2017 (r313537) +++ stable/11/lib/libproc/Makefile Fri Feb 10 07:32:40 2017 (r313538) @@ -29,9 +29,9 @@ LIBADD+= elf rtld_db util .if ${MK_CDDL} != "no" LIBADD+= ctf IGNORE_PRAGMA= YES -CFLAGS+= -I${.CURDIR}/../../cddl/contrib/opensolaris/lib/libctf/common \ - -I${.CURDIR}/../../sys/cddl/contrib/opensolaris/uts/common \ - -I${.CURDIR}/../../sys/cddl/compat/opensolaris +CFLAGS+= -I${SRCTOP}/cddl/contrib/opensolaris/lib/libctf/common \ + -I${SRCTOP}/sys/cddl/contrib/opensolaris/uts/common \ + -I${SRCTOP}/sys/cddl/compat/opensolaris .else CFLAGS+= -DNO_CTF .endif Modified: stable/11/lib/libprocstat/zfs/Makefile ============================================================================== --- stable/11/lib/libprocstat/zfs/Makefile Fri Feb 10 07:22:12 2017 (r313537) +++ stable/11/lib/libprocstat/zfs/Makefile Fri Feb 10 07:32:40 2017 (r313538) @@ -1,21 +1,21 @@ # $FreeBSD$ -.PATH: ${.CURDIR}/.. +.PATH: ${.CURDIR:H} SRCS= zfs.c OBJS= zfs.o WARNS?= 1 -CFLAGS+= -I${.CURDIR}/../../../sys/cddl/compat/opensolaris -CFLAGS+= -I${.CURDIR}/../../../cddl/compat/opensolaris/include -CFLAGS+= -I${.CURDIR}/../../../cddl/compat/opensolaris/lib/libumem -CFLAGS+= -I${.CURDIR}/../../../cddl/contrib/opensolaris/lib/libzpool/common -CFLAGS+= -I${.CURDIR}/../../../sys/cddl/contrib/opensolaris/common/zfs -CFLAGS+= -I${.CURDIR}/../../../sys/cddl/contrib/opensolaris/uts/common/fs/zfs -CFLAGS+= -I${.CURDIR}/../../../sys/cddl/contrib/opensolaris/uts/common -CFLAGS+= -I${.CURDIR}/../../../sys/cddl/contrib/opensolaris/uts/common/sys -CFLAGS+= -I${.CURDIR}/../../../cddl/contrib/opensolaris/head -CFLAGS+= -I${.CURDIR}/.. +CFLAGS+= -I${SRCTOP}/sys/cddl/compat/opensolaris +CFLAGS+= -I${SRCTOP}/cddl/compat/opensolaris/include +CFLAGS+= -I${SRCTOP}/cddl/compat/opensolaris/lib/libumem +CFLAGS+= -I${SRCTOP}/cddl/contrib/opensolaris/lib/libzpool/common +CFLAGS+= -I${SRCTOP}/sys/cddl/contrib/opensolaris/common/zfs +CFLAGS+= -I${SRCTOP}/sys/cddl/contrib/opensolaris/uts/common/fs/zfs +CFLAGS+= -I${SRCTOP}/sys/cddl/contrib/opensolaris/uts/common +CFLAGS+= -I${SRCTOP}/sys/cddl/contrib/opensolaris/uts/common/sys +CFLAGS+= -I${SRCTOP}/cddl/contrib/opensolaris/head +CFLAGS+= -I${.CURDIR:H} CFLAGS+= -DNEED_SOLARIS_BOOLEAN all: ${OBJS} Modified: stable/11/lib/librpcsec_gss/Makefile ============================================================================== --- stable/11/lib/librpcsec_gss/Makefile Fri Feb 10 07:22:12 2017 (r313537) +++ stable/11/lib/librpcsec_gss/Makefile Fri Feb 10 07:32:40 2017 (r313538) @@ -8,11 +8,11 @@ SRCS+= rpcsec_gss.c rpcsec_gss_prot.c rp LIBADD= gssapi -VERSION_DEF= ${.CURDIR}/../libc/Versions.def +VERSION_DEF= ${SRCTOP}/lib/libc/Versions.def SYMBOL_MAPS= ${.CURDIR}/Symbol.map -CFLAGS+= -I${.CURDIR}/../../include -CFLAGS+= -I${.CURDIR}/../../libc_rpc +CFLAGS+= -I${SRCTOP}/include +CFLAGS+= -I${SRCTOP}/lib/libc_rpc MK_PROFILE= no MAN= rpcsec_gss.3 Modified: stable/11/lib/librpcsvc/Makefile ============================================================================== --- stable/11/lib/librpcsvc/Makefile Fri Feb 10 07:22:12 2017 (r313537) +++ stable/11/lib/librpcsvc/Makefile Fri Feb 10 07:32:40 2017 (r313538) @@ -3,7 +3,7 @@ .include -.PATH: ${.CURDIR}/../../include/rpcsvc +.PATH: ${SRCTOP}/include/rpcsvc PACKAGE=lib${LIB} LIB= rpcsvc Modified: stable/11/lib/librt/Makefile ============================================================================== --- stable/11/lib/librt/Makefile Fri Feb 10 07:22:12 2017 (r313537) +++ stable/11/lib/librt/Makefile Fri Feb 10 07:32:40 2017 (r313538) @@ -5,7 +5,7 @@ PACKAGE=lib${LIB} LIB=rt SHLIB_MAJOR= 1 -CFLAGS+=-I${.CURDIR}/../libc/include -I${.CURDIR} +CFLAGS+=-I${SRCTOP}/lib/libc/include -I${.CURDIR} .ifndef NO_THREAD_STACK_UNWIND CFLAGS+=-fexceptions .endif @@ -18,7 +18,7 @@ SRCS+= aio.c mq.c sigev_thread.c timer.c PRECIOUSLIB= -VERSION_DEF=${.CURDIR}/../libc/Versions.def +VERSION_DEF=${SRCTOP}/lib/libc/Versions.def SYMBOL_MAPS=${.CURDIR}/Symbol.map .if ${MK_TESTS} != "no" Modified: stable/11/lib/libsbuf/Makefile ============================================================================== --- stable/11/lib/libsbuf/Makefile Fri Feb 10 07:22:12 2017 (r313537) +++ stable/11/lib/libsbuf/Makefile Fri Feb 10 07:32:40 2017 (r313538) @@ -10,6 +10,6 @@ SHLIB_MAJOR = 6 SYMBOL_MAPS= ${.CURDIR}/Symbol.map VERSION_DEF= ${.CURDIR}/Version.def -.PATH: ${.CURDIR}/../../sys/kern +.PATH: ${SRCTOP}/sys/kern .include Modified: stable/11/lib/libsm/Makefile ============================================================================== --- stable/11/lib/libsm/Makefile Fri Feb 10 07:22:12 2017 (r313537) +++ stable/11/lib/libsm/Makefile Fri Feb 10 07:32:40 2017 (r313538) @@ -3,7 +3,7 @@ .include PACKAGE=sendmail -SENDMAIL_DIR=${.CURDIR}/../../contrib/sendmail +SENDMAIL_DIR=${SRCTOP}/contrib/sendmail .PATH: ${SENDMAIL_DIR}/libsm CFLAGS+=-I${SENDMAIL_DIR}/src -I${SENDMAIL_DIR}/include -I. Modified: stable/11/lib/libsmb/Makefile ============================================================================== --- stable/11/lib/libsmb/Makefile Fri Feb 10 07:22:12 2017 (r313537) +++ stable/11/lib/libsmb/Makefile Fri Feb 10 07:32:40 2017 (r313538) @@ -3,7 +3,7 @@ .include PACKAGE=lib${LIB} -CONTRIBDIR= ${.CURDIR}/../../contrib/smbfs +CONTRIBDIR= ${SRCTOP}/contrib/smbfs .PATH: ${CONTRIBDIR}/lib/smb LIB= smb Modified: stable/11/lib/libsmdb/Makefile ============================================================================== --- stable/11/lib/libsmdb/Makefile Fri Feb 10 07:22:12 2017 (r313537) +++ stable/11/lib/libsmdb/Makefile Fri Feb 10 07:32:40 2017 (r313538) @@ -1,7 +1,7 @@ # $FreeBSD$ PACKAGE=lib${LIB} -SENDMAIL_DIR=${.CURDIR}/../../contrib/sendmail +SENDMAIL_DIR=${SRCTOP}/contrib/sendmail .PATH: ${SENDMAIL_DIR}/libsmdb CFLAGS+=-I${SENDMAIL_DIR}/src -I${SENDMAIL_DIR}/include -I. Modified: stable/11/lib/libsmutil/Makefile ============================================================================== --- stable/11/lib/libsmutil/Makefile Fri Feb 10 07:22:12 2017 (r313537) +++ stable/11/lib/libsmutil/Makefile Fri Feb 10 07:32:40 2017 (r313538) @@ -1,7 +1,7 @@ # $FreeBSD$ PACKAGE=lib${LIB} -SENDMAIL_DIR=${.CURDIR}/../../contrib/sendmail +SENDMAIL_DIR=${SRCTOP}/contrib/sendmail .PATH: ${SENDMAIL_DIR}/libsmutil CFLAGS+=-I${SENDMAIL_DIR}/src -I${SENDMAIL_DIR}/include -I. Modified: stable/11/lib/libsqlite3/Makefile ============================================================================== --- stable/11/lib/libsqlite3/Makefile Fri Feb 10 07:22:12 2017 (r313537) +++ stable/11/lib/libsqlite3/Makefile Fri Feb 10 07:32:40 2017 (r313538) @@ -8,7 +8,7 @@ LIBADD+= pthread SRCS= sqlite3.c -SQLITE= ${.CURDIR}/../../contrib/sqlite3 +SQLITE= ${SRCTOP}/contrib/sqlite3 .PATH: ${SQLITE} WARNS= 3 Modified: stable/11/lib/libstdthreads/Makefile ============================================================================== --- stable/11/lib/libstdthreads/Makefile Fri Feb 10 07:22:12 2017 (r313537) +++ stable/11/lib/libstdthreads/Makefile Fri Feb 10 07:32:40 2017 (r313538) @@ -35,7 +35,7 @@ MLINKS= thrd_create.3 call_once.3 \ LIBADD= pthread -VERSION_DEF= ${.CURDIR}/../libc/Versions.def +VERSION_DEF= ${SRCTOP}/lib/libc/Versions.def SYMBOL_MAPS= ${.CURDIR}/Symbol.map .include Modified: stable/11/lib/libsysdecode/Makefile ============================================================================== --- stable/11/lib/libsysdecode/Makefile Fri Feb 10 07:22:12 2017 (r313537) +++ stable/11/lib/libsysdecode/Makefile Fri Feb 10 07:32:40 2017 (r313538) @@ -9,8 +9,8 @@ SRCS= errno.c flags.c ioctl.c signal.c s INCS= sysdecode.h CFLAGS+= -I${.OBJDIR} -CFLAGS+= -I${.CURDIR}/../../sys -CFLAGS+= -I${.CURDIR}/../../libexec/rtld-elf +CFLAGS+= -I${SRCTOP}/sys +CFLAGS+= -I${SRCTOP}/libexec/rtld-elf MAN= sysdecode.3 \ sysdecode_abi_to_freebsd_errno.3 \ Modified: stable/11/lib/libtelnet/Makefile ============================================================================== --- stable/11/lib/libtelnet/Makefile Fri Feb 10 07:22:12 2017 (r313537) +++ stable/11/lib/libtelnet/Makefile Fri Feb 10 07:32:40 2017 (r313538) @@ -4,7 +4,7 @@ .include PACKAGE=lib${LIB} -TELNETDIR= ${.CURDIR}/../../contrib/telnet +TELNETDIR= ${SRCTOP}/contrib/telnet .PATH: ${TELNETDIR}/libtelnet LIB= telnet Modified: stable/11/lib/libthr/Makefile ============================================================================== --- stable/11/lib/libthr/Makefile Fri Feb 10 07:22:12 2017 (r313537) +++ stable/11/lib/libthr/Makefile Fri Feb 10 07:32:40 2017 (r313538) @@ -18,13 +18,13 @@ LIB=thr SHLIB_MAJOR= 3 WARNS?= 3 CFLAGS+=-DPTHREAD_KERNEL -CFLAGS+=-I${.CURDIR}/../libc/include -I${.CURDIR}/thread \ - -I${.CURDIR}/../../include +CFLAGS+=-I${SRCTOP}/lib/libc/include -I${.CURDIR}/thread \ + -I${SRCTOP}/include CFLAGS+=-I${.CURDIR}/arch/${MACHINE_CPUARCH}/include CFLAGS+=-I${.CURDIR}/sys -CFLAGS+=-I${.CURDIR}/../../libexec/rtld-elf -CFLAGS+=-I${.CURDIR}/../../libexec/rtld-elf/${MACHINE_CPUARCH} -CFLAGS+=-I${.CURDIR}/../libthread_db +CFLAGS+=-I${SRCTOP}/libexec/rtld-elf +CFLAGS+=-I${SRCTOP}/libexec/rtld-elf/${MACHINE_CPUARCH} +CFLAGS+=-I${SRCTOP}/lib/libthread_db CFLAGS+=-Winline .ifndef NO_THREAD_UNWIND_STACK @@ -34,7 +34,7 @@ CFLAGS+=-D_PTHREAD_FORCED_UNWIND LDFLAGS+=-Wl,-znodelete -VERSION_DEF=${.CURDIR}/../libc/Versions.def +VERSION_DEF=${SRCTOP}/lib/libc/Versions.def SYMBOL_MAPS=${.CURDIR}/pthread.map MAN= libthr.3 Modified: stable/11/lib/libthr/support/Makefile.inc ============================================================================== --- stable/11/lib/libthr/support/Makefile.inc Fri Feb 10 07:22:12 2017 (r313537) +++ stable/11/lib/libthr/support/Makefile.inc Fri Feb 10 07:32:40 2017 (r313538) @@ -1,15 +1,15 @@ # $FreeBSD$ -.PATH: ${.CURDIR}/support ${.CURDIR}/../libc/gen ${.CURDIR}/../libc/string +.PATH: ${.CURDIR}/support ${SRCTOP}/lib/libc/gen ${SRCTOP}/lib/libc/string # libc must search machine_arch, then machine_cpuarch, but libthr has all its # code implemented in machine_cpuarch. Cope. -.if exists(${.CURDIR}/../libc/${MACHINE_ARCH}/sys) -.PATH: ${.CURDIR}/../libc/${MACHINE_ARCH}/sys -CFLAGS+= -I${.CURDIR}/../libc/${MACHINE_ARCH} +.if exists(${SRCTOP}/lib/libc/${MACHINE_ARCH}/sys) +.PATH: ${SRCTOP}/lib/libc/${MACHINE_ARCH}/sys +CFLAGS+= -I${SRCTOP}/lib/libc/${MACHINE_ARCH} .else -.PATH: ${.CURDIR}/../libc/${MACHINE_CPUARCH}/sys -CFLAGS+= -I${.CURDIR}/../libc/${MACHINE_CPUARCH} +.PATH: ${SRCTOP}/lib/libc/${MACHINE_CPUARCH}/sys +CFLAGS+= -I${SRCTOP}/lib/libc/${MACHINE_CPUARCH} .endif SYSCALLS= thr_new Modified: stable/11/lib/libthread_db/Makefile ============================================================================== --- stable/11/lib/libthread_db/Makefile Fri Feb 10 07:22:12 2017 (r313537) +++ stable/11/lib/libthread_db/Makefile Fri Feb 10 07:32:40 2017 (r313538) @@ -15,7 +15,7 @@ CFLAGS+=-I. -I${.CURDIR} SYM_MAPS+=${.CURDIR}/Symbol.map SYMBOL_MAPS=${SYM_MAPS} -VERSION_DEF=${.CURDIR}/../libc/Versions.def +VERSION_DEF=${SRCTOP}/lib/libc/Versions.def # Unfortunately, clang gives an incorrect warning about alignment in # arch/i386/libpthread_md.c, so turn that off for now. Modified: stable/11/lib/libufs/Makefile ============================================================================== --- stable/11/lib/libufs/Makefile Fri Feb 10 07:22:12 2017 (r313537) +++ stable/11/lib/libufs/Makefile Fri Feb 10 07:32:40 2017 (r313538) @@ -18,7 +18,7 @@ MLINKS+= ufs_disk_close.3 ufs_disk_fillo MLINKS+= ufs_disk_close.3 ufs_disk_fillout_blank.3 MLINKS+= ufs_disk_close.3 ufs_disk_write.3 -.PATH: ${.CURDIR}/../../sys/ufs/ffs +.PATH: ${SRCTOP}/sys/ufs/ffs WARNS?= 2 Modified: stable/11/lib/libulog/Makefile ============================================================================== --- stable/11/lib/libulog/Makefile Fri Feb 10 07:22:12 2017 (r313537) +++ stable/11/lib/libulog/Makefile Fri Feb 10 07:32:40 2017 (r313538) @@ -22,7 +22,7 @@ MLINKS+=ulog_login.3 ulog_login_pseudo.3 LIBADD= md -VERSION_DEF= ${.CURDIR}/../libc/Versions.def *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-stable-11@freebsd.org Fri Feb 10 07:38:40 2017 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9BCDBCD1E7E; Fri, 10 Feb 2017 07:38:40 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 478901778; Fri, 10 Feb 2017 07:38:40 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v1A7cdiH026915; Fri, 10 Feb 2017 07:38:39 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v1A7cdjJ026914; Fri, 10 Feb 2017 07:38:39 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201702100738.v1A7cdjJ026914@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Ngie Cooper Date: Fri, 10 Feb 2017 07:38:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r313539 - stable/11/lib/libc/x86/sys X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 10 Feb 2017 07:38:40 -0000 Author: ngie Date: Fri Feb 10 07:38:39 2017 New Revision: 313539 URL: https://svnweb.freebsd.org/changeset/base/313539 Log: MFC r312418,r312422: r312418: Conditionalize hyperv support in gettimeofday(2) based on MK_HYPERV The effect at runtime is negligible as the hyperv timer isn't available except when hyperv is loaded. This is a prerequisite for conditionalizing the header build/install out of the build r312422: Only conditionally add in hyperv support if we're building amd64 This unbreaks the build because the assembly is written for x64. Pointyhat to: ngie Modified: stable/11/lib/libc/x86/sys/Makefile.inc stable/11/lib/libc/x86/sys/__vdso_gettc.c Directory Properties: stable/11/ (props changed) Modified: stable/11/lib/libc/x86/sys/Makefile.inc ============================================================================== --- stable/11/lib/libc/x86/sys/Makefile.inc Fri Feb 10 07:32:40 2017 (r313538) +++ stable/11/lib/libc/x86/sys/Makefile.inc Fri Feb 10 07:38:39 2017 (r313539) @@ -4,3 +4,7 @@ SRCS+= \ __vdso_gettc.c + +.if ${MACHINE_CPUARCH} == "amd64" && ${MK_HYPERV} != "no" +CFLAGS+= -DWANT_HYPERV +.endif Modified: stable/11/lib/libc/x86/sys/__vdso_gettc.c ============================================================================== --- stable/11/lib/libc/x86/sys/__vdso_gettc.c Fri Feb 10 07:32:40 2017 (r313538) +++ stable/11/lib/libc/x86/sys/__vdso_gettc.c Fri Feb 10 07:38:39 2017 (r313539) @@ -46,7 +46,7 @@ __FBSDID("$FreeBSD$"); #include #include #include -#ifdef __amd64__ +#ifdef WANT_HYPERV #include #endif #include "libc_private.h" @@ -158,7 +158,7 @@ __vdso_init_hpet(uint32_t u) munmap((void *)new_map, PAGE_SIZE); } -#ifdef __amd64__ +#ifdef WANT_HYPERV #define HYPERV_REFTSC_DEVPATH "/dev/" HYPERV_REFTSC_DEVNAME @@ -217,7 +217,7 @@ __vdso_hyperv_tsc(struct hyperv_reftsc * return (ENOSYS); } -#endif /* __amd64__ */ +#endif /* WANT_HYPERV */ #pragma weak __vdso_gettc int @@ -246,7 +246,7 @@ __vdso_gettc(const struct vdso_timehands return (ENOSYS); *tc = *(volatile uint32_t *)(map + HPET_MAIN_COUNTER); return (0); -#ifdef __amd64__ +#ifdef WANT_HYPERV case VDSO_TH_ALGO_X86_HVTSC: if (hyperv_ref_tsc == NULL) __vdso_init_hyperv_tsc(); From owner-svn-src-stable-11@freebsd.org Fri Feb 10 07:55:41 2017 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6944BCD84FA; Fri, 10 Feb 2017 07:55:41 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 27BC612D; Fri, 10 Feb 2017 07:55:41 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v1A7teAL035354; Fri, 10 Feb 2017 07:55:40 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v1A7teb0035352; Fri, 10 Feb 2017 07:55:40 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201702100755.v1A7teb0035352@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Ngie Cooper Date: Fri, 10 Feb 2017 07:55:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r313540 - stable/11/usr.bin/cut/tests X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 10 Feb 2017 07:55:41 -0000 Author: ngie Date: Fri Feb 10 07:55:39 2017 New Revision: 313540 URL: https://svnweb.freebsd.org/changeset/base/313540 Log: MFC r312523: Add some basic -s flag testcases for cut(1) The remaining functionality seems to be covered in one form or another via the NetBSD ATF testcase. Added: stable/11/usr.bin/cut/tests/cut2_test.sh - copied unchanged from r312523, head/usr.bin/cut/tests/cut2_test.sh Modified: stable/11/usr.bin/cut/tests/Makefile Directory Properties: stable/11/ (props changed) Modified: stable/11/usr.bin/cut/tests/Makefile ============================================================================== --- stable/11/usr.bin/cut/tests/Makefile Fri Feb 10 07:38:39 2017 (r313539) +++ stable/11/usr.bin/cut/tests/Makefile Fri Feb 10 07:55:39 2017 (r313540) @@ -2,6 +2,7 @@ PACKAGE= tests +ATF_TESTS_SH+= cut2_test NETBSD_ATF_TESTS_SH= cut_test ${PACKAGE}FILES= d_basic.out Copied: stable/11/usr.bin/cut/tests/cut2_test.sh (from r312523, head/usr.bin/cut/tests/cut2_test.sh) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/11/usr.bin/cut/tests/cut2_test.sh Fri Feb 10 07:55:39 2017 (r313540, copy of r312523, head/usr.bin/cut/tests/cut2_test.sh) @@ -0,0 +1,51 @@ +# +# Copyright (c) 2017 Dell EMC +# 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$ + +atf_test_case s_flag +s_flag_head() +{ + atf_set "descr" "Check -s flag" +} + +s_flag_body() +{ + cat >input< Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id EF7E1CD85D0; Fri, 10 Feb 2017 07:57:15 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B01042D5; Fri, 10 Feb 2017 07:57:15 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v1A7vEjA035576; Fri, 10 Feb 2017 07:57:14 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v1A7vESI035575; Fri, 10 Feb 2017 07:57:14 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201702100757.v1A7vESI035575@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Ngie Cooper Date: Fri, 10 Feb 2017 07:57:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r313541 - stable/11/sys/modules/ath X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 10 Feb 2017 07:57:16 -0000 Author: ngie Date: Fri Feb 10 07:57:14 2017 New Revision: 313541 URL: https://svnweb.freebsd.org/changeset/base/313541 Log: MFC r312513: Use SRCTOP-relative paths to other directories instead of .CURDIR-relative ones This simplifies pathing in make/displayed output Modified: stable/11/sys/modules/ath/Makefile Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/modules/ath/Makefile ============================================================================== --- stable/11/sys/modules/ath/Makefile Fri Feb 10 07:55:39 2017 (r313540) +++ stable/11/sys/modules/ath/Makefile Fri Feb 10 07:57:14 2017 (r313541) @@ -31,8 +31,8 @@ ATH_RATE?= sample # tx rate control algorithm -.PATH: ${.CURDIR}/../../dev/ath -.PATH: ${.CURDIR}/../../dev/ath/ath_hal +.PATH: ${SRCTOP}/sys/dev/ath +.PATH: ${SRCTOP}/sys/dev/ath/ath_hal KMOD= if_ath SRCS= if_ath.c if_ath_alq.c if_ath_debug.c if_ath_keycache.c if_ath_sysctl.c @@ -46,7 +46,7 @@ SRCS+= device_if.h bus_if.h pci_if.h opt # # AR5210 support; these are first generation 11a-only devices. # -.PATH: ${.CURDIR}/../../dev/ath/ath_hal/ar5210 +.PATH: ${SRCTOP}/sys/dev/ath/ath_hal/ar5210 SRCS+= ah_eeprom_v1.c \ ar5210_attach.c ar5210_beacon.c ar5210_interrupts.c \ ar5210_keycache.c ar5210_misc.c ar5210_phy.c ar5210_power.c \ @@ -56,7 +56,7 @@ SRCS+= ah_eeprom_v1.c \ # AR5211 support; these are second generation 11b/g/a devices # (but 11g was OFDM only and is not supported). # -.PATH: ${.CURDIR}/../../dev/ath/ath_hal/ar5211 +.PATH: ${SRCTOP}/sys/dev/ath/ath_hal/ar5211 SRCS+= ar5211_attach.c ar5211_beacon.c ar5211_interrupts.c \ ar5211_keycache.c ar5211_misc.c ar5211_phy.c ar5211_power.c \ ar5211_recv.c ar5211_reset.c ar5211_xmit.c @@ -64,7 +64,7 @@ SRCS+= ar5211_attach.c ar5211_beacon.c a # # AR5212 support; this covers all other pci/cardbus legacy parts. # -.PATH: ${.CURDIR}/../../dev/ath/ath_hal/ar5212 +.PATH: ${SRCTOP}/sys/dev/ath/ath_hal/ar5212 SRCS+= ar5212_ani.c ar5212_attach.c ar5212_beacon.c ar5212_eeprom.c \ ar5212_gpio.c ar5212_interrupts.c ar5212_keycache.c ar5212_misc.c \ ar5212_phy.c ar5212_power.c ar5212_recv.c ar5212_reset.c \ @@ -85,7 +85,7 @@ SRCS+= ar5413.c # NB: 9160 depends on 5416 but 5416 does not require 9160 # # + 5416 (Owl) -.PATH: ${.CURDIR}/../../dev/ath/ath_hal/ar5416 +.PATH: ${SRCTOP}/sys/dev/ath/ath_hal/ar5416 SRCS+= ah_eeprom_v14.c ah_eeprom_v4k.c \ ar5416_ani.c ar5416_attach.c ar5416_beacon.c ar5416_btcoex.c \ ar5416_cal.c ar5416_cal_iq.c ar5416_cal_adcgain.c ar5416_cal_adcdc.c \ @@ -97,7 +97,7 @@ SRCS+= ah_eeprom_v14.c ah_eeprom_v4k.c \ SRCS+= ar2133.c # + AR9160 (Sowl) -.PATH: ${.CURDIR}/../../dev/ath/ath_hal/ar9001 +.PATH: ${SRCTOP}/sys/dev/ath/ath_hal/ar9001 SRCS+= ar9160_attach.c # + AR9130 - (Sowl) - Embedded (AR913x SoC) @@ -111,7 +111,7 @@ SRCS+= ar9130_attach.c ar9130_eeprom.c a # AR9002 series chips # + AR9220/AR9280 - Merlin -.PATH: ${.CURDIR}/../../dev/ath/ath_hal/ar9002 +.PATH: ${SRCTOP}/sys/dev/ath/ath_hal/ar9002 SRCS+= ar9280.c ar9280_attach.c ar9280_olc.c # + AR9285 - Kite @@ -119,13 +119,13 @@ SRCS+= ar9285.c ar9285_reset.c ar9285_at SRCS+= ar9285_diversity.c ar9285_btcoex.c # + AR9287 - Kiwi -.PATH: ${.CURDIR}/../../dev/ath/ath_hal +.PATH: ${SRCTOP}/sys/dev/ath/ath_hal SRCS+= ah_eeprom_9287.c -.PATH: ${.CURDIR}/../../dev/ath/ath_hal/ar9002 +.PATH: ${SRCTOP}/sys/dev/ath/ath_hal/ar9002 SRCS+= ar9287.c ar9287_reset.c ar9287_attach.c ar9287_cal.c ar9287_olc.c # + AR9300 HAL -.PATH: ${.CURDIR}/../../contrib/dev/ath/ath_hal/ar9300 +.PATH: ${SRCTOP}/sys/contrib/dev/ath/ath_hal/ar9300 SRCS+= ar9300_interrupts.c ar9300_radar.c ar9300_ani.c ar9300_keycache.c SRCS+= ar9300_radio.c ar9300_xmit.c ar9300_attach.c ar9300_mci.c ar9300_stub.c SRCS+= ar9300_xmit_ds.c ar9300_beacon.c ar9300_misc.c ar9300_recv.c @@ -135,22 +135,22 @@ SRCS+= ar9300_power.c ar9300_timer.c ar9 # NB: rate control is bound to the driver by symbol names so only pick one .if ${ATH_RATE} == "sample" -.PATH: ${.CURDIR}/../../dev/ath/ath_rate/sample +.PATH: ${SRCTOP}/sys/dev/ath/ath_rate/sample SRCS+= sample.c .elif ${ATH_RATE} == "onoe" -.PATH: ${.CURDIR}/../../dev/ath/ath_rate/onoe +.PATH: ${SRCTOP}/sys/dev/ath/ath_rate/onoe SRCS+= onoe.c .elif ${ATH_RATE} == "amrr" -.PATH: ${.CURDIR}/../../dev/ath/ath_rate/amrr +.PATH: ${SRCTOP}/sys/dev/ath/ath_rate/amrr SRCS+= amrr.c .endif # DFS -.PATH: ${.CURDIR}/../../dev/ath/ath_dfs/null +.PATH: ${SRCTOP}/sys/dev/ath/ath_dfs/null SRCS+= dfs_null.c -CFLAGS+= -I. -I${.CURDIR}/../../dev/ath -I${.CURDIR}/../../dev/ath/ath_hal -CFLAGS+= -I. -I${.CURDIR}/../../contrib/dev/ath/ath_hal/ +CFLAGS+= -I. -I${SRCTOP}/sys/dev/ath -I${SRCTOP}/sys/dev/ath/ath_hal +CFLAGS+= -I. -I${SRCTOP}/sys/contrib/dev/ath/ath_hal/ .if !defined(KERNBUILDDIR) opt_ah.h: From owner-svn-src-stable-11@freebsd.org Fri Feb 10 07:58:46 2017 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5C7B5CD86DB; Fri, 10 Feb 2017 07:58:46 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 2BA9B6BF; Fri, 10 Feb 2017 07:58:46 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v1A7wjL8035777; Fri, 10 Feb 2017 07:58:45 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v1A7wjxl035776; Fri, 10 Feb 2017 07:58:45 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201702100758.v1A7wjxl035776@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Ngie Cooper Date: Fri, 10 Feb 2017 07:58:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r313542 - stable/11/gnu/usr.bin/gdb/gdbserver X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 10 Feb 2017 07:58:46 -0000 Author: ngie Date: Fri Feb 10 07:58:45 2017 New Revision: 313542 URL: https://svnweb.freebsd.org/changeset/base/313542 Log: MFC r312514: Use SRCTOP-relative paths to other directories instead of .CURDIR-relative ones This simplifies pathing in make/displayed output Modified: stable/11/gnu/usr.bin/gdb/gdbserver/Makefile Directory Properties: stable/11/ (props changed) Modified: stable/11/gnu/usr.bin/gdb/gdbserver/Makefile ============================================================================== --- stable/11/gnu/usr.bin/gdb/gdbserver/Makefile Fri Feb 10 07:57:14 2017 (r313541) +++ stable/11/gnu/usr.bin/gdb/gdbserver/Makefile Fri Feb 10 07:58:45 2017 (r313542) @@ -3,7 +3,7 @@ # Not elf specific so don't install in /usr/libexec/elf BINDIR=/usr/bin -GDBDIR= ${.CURDIR}/../../../../contrib/gdb +GDBDIR= ${SRCTOP}/contrib/gdb .PATH: ${GDBDIR}/gdb/signals .PATH: ${GDBDIR}/gdb/gdbserver .PATH: ${GDBDIR}/gdb From owner-svn-src-stable-11@freebsd.org Fri Feb 10 07:59:42 2017 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B5D03CD87CA; Fri, 10 Feb 2017 07:59:42 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 82743862; Fri, 10 Feb 2017 07:59:42 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v1A7xfJG035873; Fri, 10 Feb 2017 07:59:41 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v1A7xf94035872; Fri, 10 Feb 2017 07:59:41 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201702100759.v1A7xf94035872@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Ngie Cooper Date: Fri, 10 Feb 2017 07:59:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r313543 - stable/11/usr.bin/sed/tests X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 10 Feb 2017 07:59:42 -0000 Author: ngie Date: Fri Feb 10 07:59:41 2017 New Revision: 313543 URL: https://svnweb.freebsd.org/changeset/base/313543 Log: MFC r312520: Integrate contrib/netbsd-tests/usr.bin/sed/t_sed.sh into the FreeBSD test suite as usr.bin/sed/sed_test Don't expect :emptybackref to fail -- it succeeds on FreeBSD Modified: stable/11/usr.bin/sed/tests/Makefile Directory Properties: stable/11/ (props changed) Modified: stable/11/usr.bin/sed/tests/Makefile ============================================================================== --- stable/11/usr.bin/sed/tests/Makefile Fri Feb 10 07:58:45 2017 (r313542) +++ stable/11/usr.bin/sed/tests/Makefile Fri Feb 10 07:59:41 2017 (r313543) @@ -2,11 +2,15 @@ PACKAGE= tests +NETBSD_ATF_TESTS_SH+= sed_test TAP_TESTS_SH= legacy_test TAP_TESTS_SH+= multi_test TEST_METADATA.multi_test+= required_files="/usr/share/dict/words" TAP_TESTS_SH+= inplace_race_test +ATF_TESTS_SH_SED_sed_test+= -e 's,atf_expect_fail "PR bin/28126",,g' +${PACKAGE}FILES+= d_c2048.in + ${PACKAGE}FILES+= hanoi.sed ${PACKAGE}FILES+= math.sed ${PACKAGE}FILES+= regress.G.out @@ -35,4 +39,5 @@ ${PACKAGE}FILES+= regress.y.out SUBDIR= regress.multitest.out +.include .include From owner-svn-src-stable-11@freebsd.org Fri Feb 10 14:54:22 2017 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3055DCD8516; Fri, 10 Feb 2017 14:54:22 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id F38DEB50; Fri, 10 Feb 2017 14:54:21 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v1AEsL32008705; Fri, 10 Feb 2017 14:54:21 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v1AEsLRR008704; Fri, 10 Feb 2017 14:54:21 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201702101454.v1AEsLRR008704@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Fri, 10 Feb 2017 14:54:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r313550 - stable/11/sys/dev/vt X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 10 Feb 2017 14:54:22 -0000 Author: emaste Date: Fri Feb 10 14:54:20 2017 New Revision: 313550 URL: https://svnweb.freebsd.org/changeset/base/313550 Log: MFC r304430: vt: fix old keyboard release in CONS_SETKBD On the first switch we previously released the newly allocated keyboard instead of the old one. Keyboard state was very confused afterwards for further keyboard switches. Submitted by: bde Modified: stable/11/sys/dev/vt/vt_core.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/vt/vt_core.c ============================================================================== --- stable/11/sys/dev/vt/vt_core.c Fri Feb 10 14:49:04 2017 (r313549) +++ stable/11/sys/dev/vt/vt_core.c Fri Feb 10 14:54:20 2017 (r313550) @@ -2359,6 +2359,7 @@ skip_thunk: (void *)vd, vt_kbdevent, vd); if (i >= 0) { if (vd->vd_keyboard != -1) { + kbd = kbd_get_keyboard(vd->vd_keyboard); vt_save_kbd_state(vd->vd_curwindow, kbd); kbd_release(kbd, (void *)vd); } From owner-svn-src-stable-11@freebsd.org Fri Feb 10 14:58:26 2017 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 055B5CD8660; Fri, 10 Feb 2017 14:58:26 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id AF06AE05; Fri, 10 Feb 2017 14:58:25 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v1AEwONw009055; Fri, 10 Feb 2017 14:58:24 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v1AEwOn9009054; Fri, 10 Feb 2017 14:58:24 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201702101458.v1AEwOn9009054@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Fri, 10 Feb 2017 14:58:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r313551 - stable/11/usr.sbin/vidcontrol X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 10 Feb 2017 14:58:26 -0000 Author: emaste Date: Fri Feb 10 14:58:24 2017 New Revision: 313551 URL: https://svnweb.freebsd.org/changeset/base/313551 Log: MFC r308312: vidcontrol: improve error handling in vt(4) font loading PR: 209078 Modified: stable/11/usr.sbin/vidcontrol/vidcontrol.c Directory Properties: stable/11/ (props changed) Modified: stable/11/usr.sbin/vidcontrol/vidcontrol.c ============================================================================== --- stable/11/usr.sbin/vidcontrol/vidcontrol.c Fri Feb 10 14:54:20 2017 (r313550) +++ stable/11/usr.sbin/vidcontrol/vidcontrol.c Fri Feb 10 14:58:24 2017 (r313551) @@ -393,11 +393,15 @@ load_vt4mappingtable(unsigned int nmappi if (nmappings == 0) return (NULL); - t = malloc(sizeof *t * nmappings); + if ((t = malloc(sizeof *t * nmappings)) == NULL) { + warn("malloc"); + return (NULL); + } if (fread(t, sizeof *t * nmappings, 1, f) != 1) { - perror("mappings"); - exit(1); + warn("read mappings"); + free(t); + return (NULL); } for (i = 0; i < nmappings; i++) { @@ -422,7 +426,7 @@ load_default_vt4font(void) } } -static int +static void load_vt4font(FILE *f) { struct vt4font_header fh; @@ -431,13 +435,13 @@ load_vt4font(FILE *f) unsigned int i; if (fread(&fh, sizeof fh, 1, f) != 1) { - perror("file_header"); - return (1); + warn("read file_header"); + return; } if (memcmp(fh.magic, "VFNT0002", 8) != 0) { - fprintf(stderr, "Bad magic\n"); - return (1); + warnx("bad magic in font file\n"); + return; } for (i = 0; i < VFNT_MAPS; i++) @@ -447,21 +451,26 @@ load_vt4font(FILE *f) vfnt.height = fh.height; glyphsize = howmany(vfnt.width, 8) * vfnt.height * vfnt.glyph_count; - vfnt.glyphs = malloc(glyphsize); + if ((vfnt.glyphs = malloc(glyphsize)) == NULL) { + warn("malloc"); + return; + } if (fread(vfnt.glyphs, glyphsize, 1, f) != 1) { - perror("glyphs"); - return (1); + warn("read glyphs"); + free(vfnt.glyphs); + return; } for (i = 0; i < VFNT_MAPS; i++) vfnt.map[i] = load_vt4mappingtable(vfnt.map_count[i], f); - if (ioctl(STDIN_FILENO, PIO_VFONT, &vfnt) == -1) { - perror("PIO_VFONT"); - return (1); - } - return (0); + if (ioctl(STDIN_FILENO, PIO_VFONT, &vfnt) == -1) + warn("PIO_VFONT"); + + for (i = 0; i < VFNT_MAPS; i++) + free(vfnt.map[i]); + free(vfnt.glyphs); } /* @@ -511,8 +520,7 @@ load_font(const char *type, const char * } if (vt4_mode) { - if(load_vt4font(fd)) - warn("failed to load font \"%s\"", filename); + load_vt4font(fd); fclose(fd); return; } From owner-svn-src-stable-11@freebsd.org Fri Feb 10 15:03:55 2017 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A5856CD8A4B; Fri, 10 Feb 2017 15:03:55 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 7D7E81669; Fri, 10 Feb 2017 15:03:55 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v1AF3s9T012928; Fri, 10 Feb 2017 15:03:54 GMT (envelope-from jilles@FreeBSD.org) Received: (from jilles@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v1AF3s7W012926; Fri, 10 Feb 2017 15:03:54 GMT (envelope-from jilles@FreeBSD.org) Message-Id: <201702101503.v1AF3s7W012926@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jilles set sender to jilles@FreeBSD.org using -f From: Jilles Tjoelker Date: Fri, 10 Feb 2017 15:03:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r313553 - in stable/11: lib/libc/sys share/man/man4 X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 10 Feb 2017 15:03:55 -0000 Author: jilles Date: Fri Feb 10 15:03:54 2017 New Revision: 313553 URL: https://svnweb.freebsd.org/changeset/base/313553 Log: MFC r313174: Clean up documentation of AF_UNIX control messages. Document AF_UNIX control messages in unix(4) only, not split between unix(4) and recv(2). Also, warn about LOCAL_CREDS effective uid/gid fields, since the write could be from a setuid or setgid program (with the explicit SCM_CREDS and LOCAL_PEERCRED, the credentials are read at such a time that it can be assumed that the process intends for them to be used in this context). Modified: stable/11/lib/libc/sys/recv.2 stable/11/share/man/man4/unix.4 Directory Properties: stable/11/ (props changed) Modified: stable/11/lib/libc/sys/recv.2 ============================================================================== --- stable/11/lib/libc/sys/recv.2 Fri Feb 10 15:02:56 2017 (r313552) +++ stable/11/lib/libc/sys/recv.2 Fri Feb 10 15:03:54 2017 (r313553) @@ -28,7 +28,7 @@ .\" @(#)recv.2 8.3 (Berkeley) 2/21/94 .\" $FreeBSD$ .\" -.Dd January 29, 2016 +.Dd February 3, 2017 .Dt RECV 2 .Os .Sh NAME @@ -267,57 +267,10 @@ with no data buffer provided immediately .Fn accept system call. .Pp -Open file descriptors are now passed as ancillary data for +With .Dv AF_UNIX -domain sockets, with -.Fa cmsg_level -set to -.Dv SOL_SOCKET -and -.Fa cmsg_type -set to -.Dv SCM_RIGHTS . -The close-on-exec flag on received descriptors is set according to the -.Dv MSG_CMSG_CLOEXEC -flag passed to -.Fn recvmsg . -.Pp -Process credentials can also be passed as ancillary data for -.Dv AF_UNIX -domain sockets using a -.Fa cmsg_type -of -.Dv SCM_CREDS . -In this case, -.Fa cmsg_data -should be a structure of type -.Fa cmsgcred , -which is defined in -.In sys/socket.h -as follows: -.Bd -literal -struct cmsgcred { - pid_t cmcred_pid; /* PID of sending process */ - uid_t cmcred_uid; /* real UID of sending process */ - uid_t cmcred_euid; /* effective UID of sending process */ - gid_t cmcred_gid; /* real GID of sending process */ - short cmcred_ngroups; /* number or groups */ - gid_t cmcred_groups[CMGROUP_MAX]; /* groups */ -}; -.Ed -.Pp -If a sender supplies ancillary data with enough space for the above struct -tagged as -.Dv SCM_CREDS -control message type to the -.Fn sendmsg -system call, then kernel will fill in the credential information of the -sending process and deliver it to the receiver. -Since receiver usually has no control over a sender, this method of retrieving -credential information isn't reliable. -For reliable retrieval of remote side credentials it is advised to use the -.Dv LOCAL_CREDS -socket option on the receiving socket. +domain sockets, ancillary data can be used to pass file descriptors and +process credentials. See .Xr unix 4 for details. Modified: stable/11/share/man/man4/unix.4 ============================================================================== --- stable/11/share/man/man4/unix.4 Fri Feb 10 15:02:56 2017 (r313552) +++ stable/11/share/man/man4/unix.4 Fri Feb 10 15:03:54 2017 (r313553) @@ -28,7 +28,7 @@ .\" @(#)unix.4 8.1 (Berkeley) 6/9/93 .\" $FreeBSD$ .\" -.Dd March 19, 2013 +.Dd February 3, 2017 .Dt UNIX 4 .Os .Sh NAME @@ -119,12 +119,12 @@ of a or .Xr sendto 2 must be writable. -.Sh PASSING FILE DESCRIPTORS +.Sh CONTROL MESSAGES The .Ux Ns -domain sockets support the communication of .Ux -file descriptors through the use of the +file descriptors and process credentials through the use of the .Va msg_control field in the .Fa msg @@ -132,13 +132,12 @@ argument to .Xr sendmsg 2 and .Xr recvmsg 2 . -.Pp -Any valid descriptor may be sent in a message. -The file descriptor(s) to be passed are described using a +The items to be passed are described using a .Vt "struct cmsghdr" that is defined in the include file .In sys/socket.h . -The type of the message is +.Pp +To send file descriptors, the type of the message is .Dv SCM_RIGHTS , and the data portion of the messages is an array of integers representing the file descriptors to be passed. @@ -161,6 +160,39 @@ call. Descriptors that are awaiting delivery, or that are purposely not received, are automatically closed by the system when the destination socket is closed. +.Pp +Credentials of the sending process can be transmitted explicitly using a +control message of type +.Dv SCM_CREDS +with a data portion of type +.Vt "struct cmsgcred" , +defined in +.In sys/socket.h +as follows: +.Bd -literal +struct cmsgcred { + pid_t cmcred_pid; /* PID of sending process */ + uid_t cmcred_uid; /* real UID of sending process */ + uid_t cmcred_euid; /* effective UID of sending process */ + gid_t cmcred_gid; /* real GID of sending process */ + short cmcred_ngroups; /* number of groups */ + gid_t cmcred_groups[CMGROUP_MAX]; /* groups */ +}; +.Ed +.Pp +The sender should pass a zeroed buffer which will be filled in by the system. +.Pp +The group list is truncated to at most +.Dv CMGROUP_MAX +GIDs. +.Pp +The process ID +.Fa cmcred_pid +should not be looked up (such as via the +.Dv KERN_PROC_PID +sysctl) for making security decisions. +The sending process could have exited and its process ID already been +reused for a new process. .Sh SOCKET OPTIONS .Tn UNIX domain sockets support a number of socket options which can be set with @@ -176,7 +208,13 @@ or a .Dv SOCK_STREAM socket. This option provides a mechanism for the receiver to -receive the credentials of the process as a +receive the credentials of the process calling +.Xr write 2 , +.Xr send 2 , +.Xr sendto 2 +or +.Xr sendmsg 2 +as a .Xr recvmsg 2 control message. The @@ -201,6 +239,10 @@ struct sockcred { }; .Ed .Pp +The current implementation truncates the group list to at most +.Dv CMGROUP_MAX +groups. +.Pp The .Fn SOCKCREDSIZE macro computes the size of the @@ -221,7 +263,28 @@ On and .Dv SOCK_SEQPACKET sockets credentials are passed only on the first read from a socket, -then system clears the option on socket. +then the system clears the option on the socket. +.Pp +This option and the above explicit +.Vt "struct cmsgcred" +both use the same value +.Dv SCM_CREDS +but incompatible control messages. +If this option is enabled and the sender attached a +.Dv SCM_CREDS +control message with a +.Vt "struct cmsgcred" , +it will be discarded and a +.Vt "struct sockcred" +will be included. +.Pp +Many setuid programs will +.Xr write 2 +data at least partially controlled by the invoker, +such as error messages. +Therefore, a message accompanied by a particular +.Fa sc_euid +value should not be trusted as being from that user. .It Dv LOCAL_CONNWAIT Used with .Dv SOCK_STREAM From owner-svn-src-stable-11@freebsd.org Fri Feb 10 19:49:44 2017 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7AE1CCD9F29; Fri, 10 Feb 2017 19:49:44 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 556D21B2; Fri, 10 Feb 2017 19:49:44 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v1AJnhoo031691; Fri, 10 Feb 2017 19:49:43 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v1AJnhHG031687; Fri, 10 Feb 2017 19:49:43 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201702101949.v1AJnhHG031687@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Fri, 10 Feb 2017 19:49:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r313567 - in stable/11: lib/libsysdecode sys/kern sys/sys X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 10 Feb 2017 19:49:44 -0000 Author: jhb Date: Fri Feb 10 19:49:42 2017 New Revision: 313567 URL: https://svnweb.freebsd.org/changeset/base/313567 Log: MFC 311568,311584,312387: Set MORETOCOME for AIO write requests on a socket. 311568: Set MORETOCOME for AIO write requests on a socket. Add a MSG_MOREOTOCOME message flag. When this flag is set, sosend* set PRUS_MOREOTOCOME when invoking the protocol send method. The aio worker tasks for sending on a socket set this flag when there are additional write jobs waiting on the socket buffer. 311584: Unbreak lib/libsysdecode after r311568 by decoding MSG_MORETOCOME flag in msgflags (Actually, this change excludes MSG_MORETOCOME from being decoded) 312387: Fix regression from r311568: collision of MSG_NOSIGNAL with MSG_MORETOCOME lead to delayed send of data sent with sendto(MSG_NOSIGNAL). Sponsored by: Chelsio Communications Modified: stable/11/lib/libsysdecode/mktables stable/11/sys/kern/sys_socket.c stable/11/sys/kern/uipc_socket.c stable/11/sys/sys/socket.h Directory Properties: stable/11/ (props changed) Modified: stable/11/lib/libsysdecode/mktables ============================================================================== --- stable/11/lib/libsysdecode/mktables Fri Feb 10 19:45:02 2017 (r313566) +++ stable/11/lib/libsysdecode/mktables Fri Feb 10 19:49:42 2017 (r313567) @@ -142,7 +142,7 @@ gen_table "seekwhence" "SEEK_[A-Z]+ gen_table "fcntlcmd" "F_[A-Z0-9_]+[[:space:]]+[0-9]+[[:space:]]+" "sys/fcntl.h" "F_CANCEL|F_..LCK" gen_table "mmapflags" "MAP_[A-Z_]+[[:space:]]+0x[0-9A-Fa-f]+" "sys/mman.h" gen_table "rtpriofuncs" "RTP_[A-Z]+[[:space:]]+[0-9]+" "sys/rtprio.h" -gen_table "msgflags" "MSG_[A-Z]+[[:space:]]+0x[0-9]+" "sys/socket.h" "MSG_SOCALLBCK" +gen_table "msgflags" "MSG_[A-Z]+[[:space:]]+0x[0-9]+" "sys/socket.h" "MSG_SOCALLBCK|MSG_MORETOCOME" gen_table "sigcode" "SI_[A-Z]+[[:space:]]+0(x[0-9abcdef]+)?" "sys/signal.h" gen_table "umtxcvwaitflags" "CVWAIT_[A-Z_]+[[:space:]]+0x[0-9]+" "sys/umtx.h" gen_table "umtxrwlockflags" "URWLOCK_PREFER_READER[[:space:]]+0x[0-9]+" "sys/umtx.h" Modified: stable/11/sys/kern/sys_socket.c ============================================================================== --- stable/11/sys/kern/sys_socket.c Fri Feb 10 19:45:02 2017 (r313566) +++ stable/11/sys/kern/sys_socket.c Fri Feb 10 19:49:42 2017 (r313567) @@ -604,6 +604,8 @@ retry: if (td->td_ru.ru_msgrcv != ru_before) job->msgrcv = 1; } else { + if (!TAILQ_EMPTY(&sb->sb_aiojobq)) + flags |= MSG_MORETOCOME; uio.uio_rw = UIO_WRITE; ru_before = td->td_ru.ru_msgsnd; #ifdef MAC Modified: stable/11/sys/kern/uipc_socket.c ============================================================================== --- stable/11/sys/kern/uipc_socket.c Fri Feb 10 19:45:02 2017 (r313566) +++ stable/11/sys/kern/uipc_socket.c Fri Feb 10 19:49:42 2017 (r313567) @@ -1182,6 +1182,7 @@ sosend_dgram(struct socket *so, struct s (resid <= 0)) ? PRUS_EOF : /* If there is more to send set PRUS_MORETOCOME */ + (flags & MSG_MORETOCOME) || (resid > 0 && space > 0) ? PRUS_MORETOCOME : 0, top, addr, control, td); if (dontroute) { @@ -1368,6 +1369,7 @@ restart: (resid <= 0)) ? PRUS_EOF : /* If there is more to send set PRUS_MORETOCOME. */ + (flags & MSG_MORETOCOME) || (resid > 0 && space > 0) ? PRUS_MORETOCOME : 0, top, addr, control, td); if (dontroute) { Modified: stable/11/sys/sys/socket.h ============================================================================== --- stable/11/sys/sys/socket.h Fri Feb 10 19:45:02 2017 (r313566) +++ stable/11/sys/sys/socket.h Fri Feb 10 19:49:42 2017 (r313567) @@ -435,6 +435,7 @@ struct msghdr { #endif #ifdef _KERNEL #define MSG_SOCALLBCK 0x10000 /* for use by socket callbacks - soreceive (TCP) */ +#define MSG_MORETOCOME 0x100000 /* additional data pending */ #endif /* From owner-svn-src-stable-11@freebsd.org Sat Feb 11 00:54:18 2017 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id AE5AFCD8167; Sat, 11 Feb 2017 00:54:18 +0000 (UTC) (envelope-from mm@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 383971E2C; Sat, 11 Feb 2017 00:54:18 +0000 (UTC) (envelope-from mm@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v1B0sH0Z058220; Sat, 11 Feb 2017 00:54:17 GMT (envelope-from mm@FreeBSD.org) Received: (from mm@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v1B0sHXS058214; Sat, 11 Feb 2017 00:54:17 GMT (envelope-from mm@FreeBSD.org) Message-Id: <201702110054.v1B0sHXS058214@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mm set sender to mm@FreeBSD.org using -f From: Martin Matuska Date: Sat, 11 Feb 2017 00:54:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r313570 - in stable/11: . contrib/libarchive contrib/libarchive/cpio contrib/libarchive/libarchive contrib/libarchive/libarchive/test contrib/libarchive/tar contrib/libarchive/tar/test ... X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 11 Feb 2017 00:54:18 -0000 Author: mm Date: Sat Feb 11 00:54:16 2017 New Revision: 313570 URL: https://svnweb.freebsd.org/changeset/base/313570 Log: MFC r310866,310868,310870,311903,313074: Sync libarchive with vendor. MFC r310866: PR #771: Add NFSv4 ACL support to pax and restricted pax NFSv4 ACL information may now be stored to and restored from tar archives. ACL must be non-trivial and supported by the underlying filesystem, e.g. natively by ZFS or by UFS with the NFSv4 ACL enable flag set. MFC r310868: PR #843: Fix memory leak of struct archive_entry in cpio/cpio.c PR #851: Spelling fixes Fix two protoypes in manual page archive_read_disk.3 MFC r310870: Use __LA_DEPRECATED macro with functions deprecated in 379867e MFC r311903: #691: Support for SCHILY.xattr extended attributes #854: Spelling fixes Multiple fixes in ACL code: - prefer acl_set_fd_np() to acl_set_fd() - if acl_set_fd_np() fails, do no fallback to acl_set_file() - do not warn if trying to write ACLs to a filesystem without ACL support - fix id handling in archive_acl_(from_to)_text*() for NFSv4 ACLs MFC r313074: - support extracting NFSv4 ACLs from Solaris tar archives - bugfixes and optimizations in the ACL code - multiple fixes in the test suite - typo and other small bugfixes Security fixes: - cab reader: endless loop when parsing MSZIP signature (OSS-Fuzz 335) - LHA reader: heap-buffer-overflow in lha_read_file_header_1() (CVE-2017-5601) - LZ4 reader: null-pointer dereference in lz4_filter_read_legacy_stream() (OSS-Fuzz 453) - mtree reader: heap-buffer-overflow in detect_form() (OSS-Fuzz 421, 443) - WARC reader: heap-buffer-overflow in xstrpisotime() (OSS-Fuzz 382, 458) Memory leak fixes: - ACL support: free memory allocated by acl_get_qualifier() - disk writer: missing free in create_filesystem_object() - file reader: fd leak (Coverity 1016755) - gnutar writer: fix free in archive_write_gnutar_header() (Coverity 101675) - iso 9660 reader: missing free in parse_file_info() (partial Coverity 1016754) - program reader: missing free in __archive_read_program() - program writer: missing free in __archive_write_program_free() - xar reader: missing free in xar_cleanup() - xar reader: missing frees in expat_xmlattr_setup() (Coverity 1229979-1229981) - xar writer: missing free in file_free() - zip reader: missing free in zip_read_local_file_header() List of all libarchive issues at OSS-Fuzz: https://bugs.chromium.org/p/oss-fuzz/issues/list?can=1&q=libarchive Security: CVE-2017-5601 Added: stable/11/contrib/libarchive/libarchive/test/test_acl_pax_nfs4.tar.uu - copied unchanged from r310866, head/contrib/libarchive/libarchive/test/test_acl_pax_nfs4.tar.uu stable/11/contrib/libarchive/libarchive/test/test_acl_pax_posix1e.tar.uu - copied unchanged from r310866, head/contrib/libarchive/libarchive/test/test_acl_pax_posix1e.tar.uu stable/11/contrib/libarchive/libarchive/test/test_acl_platform_nfs4.c - copied unchanged from r313074, head/contrib/libarchive/libarchive/test/test_acl_platform_nfs4.c stable/11/contrib/libarchive/libarchive/test/test_acl_platform_posix1e.c - copied unchanged from r313074, head/contrib/libarchive/libarchive/test/test_acl_platform_posix1e.c stable/11/contrib/libarchive/libarchive/test/test_acl_text.c - copied, changed from r310866, head/contrib/libarchive/libarchive/test/test_acl_text.c stable/11/contrib/libarchive/libarchive/test/test_compat_star_acl.c - copied unchanged from r310866, head/contrib/libarchive/libarchive/test/test_compat_star_acl.c stable/11/contrib/libarchive/libarchive/test/test_compat_star_acl_nfs4.tar.uu - copied unchanged from r310866, head/contrib/libarchive/libarchive/test/test_compat_star_acl_nfs4.tar.uu stable/11/contrib/libarchive/libarchive/test/test_read_pax_schily_xattr.c - copied unchanged from r311903, head/contrib/libarchive/libarchive/test/test_read_pax_schily_xattr.c stable/11/contrib/libarchive/libarchive/test/test_read_pax_schily_xattr.tar.uu - copied unchanged from r311903, head/contrib/libarchive/libarchive/test/test_read_pax_schily_xattr.tar.uu Deleted: stable/11/contrib/libarchive/libarchive/test/test_acl_freebsd_nfs4.c stable/11/contrib/libarchive/libarchive/test/test_acl_freebsd_posix1e.c stable/11/contrib/libarchive/libarchive/test/test_acl_pax.tar.uu stable/11/contrib/libarchive/libarchive/test/test_compat_star_acl_posix1e.c Modified: stable/11/ObsoleteFiles.inc stable/11/contrib/libarchive/NEWS stable/11/contrib/libarchive/cpio/cpio.c stable/11/contrib/libarchive/libarchive/archive_acl.c stable/11/contrib/libarchive/libarchive/archive_acl_private.h stable/11/contrib/libarchive/libarchive/archive_entry.c stable/11/contrib/libarchive/libarchive/archive_entry.h stable/11/contrib/libarchive/libarchive/archive_entry_acl.3 stable/11/contrib/libarchive/libarchive/archive_entry_locale.h stable/11/contrib/libarchive/libarchive/archive_entry_strmode.c stable/11/contrib/libarchive/libarchive/archive_match.c stable/11/contrib/libarchive/libarchive/archive_platform.h stable/11/contrib/libarchive/libarchive/archive_random.c stable/11/contrib/libarchive/libarchive/archive_rb.c stable/11/contrib/libarchive/libarchive/archive_read_disk.3 stable/11/contrib/libarchive/libarchive/archive_read_disk_entry_from_file.c stable/11/contrib/libarchive/libarchive/archive_read_disk_posix.c stable/11/contrib/libarchive/libarchive/archive_read_open_filename.c stable/11/contrib/libarchive/libarchive/archive_read_support_filter_lz4.c stable/11/contrib/libarchive/libarchive/archive_read_support_filter_lzop.c stable/11/contrib/libarchive/libarchive/archive_read_support_filter_program.c stable/11/contrib/libarchive/libarchive/archive_read_support_format_7zip.c stable/11/contrib/libarchive/libarchive/archive_read_support_format_cab.c stable/11/contrib/libarchive/libarchive/archive_read_support_format_cpio.c stable/11/contrib/libarchive/libarchive/archive_read_support_format_iso9660.c stable/11/contrib/libarchive/libarchive/archive_read_support_format_lha.c stable/11/contrib/libarchive/libarchive/archive_read_support_format_mtree.c stable/11/contrib/libarchive/libarchive/archive_read_support_format_rar.c stable/11/contrib/libarchive/libarchive/archive_read_support_format_tar.c stable/11/contrib/libarchive/libarchive/archive_read_support_format_warc.c stable/11/contrib/libarchive/libarchive/archive_read_support_format_xar.c stable/11/contrib/libarchive/libarchive/archive_read_support_format_zip.c stable/11/contrib/libarchive/libarchive/archive_string.c stable/11/contrib/libarchive/libarchive/archive_string.h stable/11/contrib/libarchive/libarchive/archive_string_composition.h stable/11/contrib/libarchive/libarchive/archive_write.c stable/11/contrib/libarchive/libarchive/archive_write_add_filter_program.c stable/11/contrib/libarchive/libarchive/archive_write_add_filter_xz.c stable/11/contrib/libarchive/libarchive/archive_write_disk_acl.c stable/11/contrib/libarchive/libarchive/archive_write_disk_posix.c stable/11/contrib/libarchive/libarchive/archive_write_open.3 stable/11/contrib/libarchive/libarchive/archive_write_set_format_7zip.c stable/11/contrib/libarchive/libarchive/archive_write_set_format_gnutar.c stable/11/contrib/libarchive/libarchive/archive_write_set_format_iso9660.c stable/11/contrib/libarchive/libarchive/archive_write_set_format_pax.c stable/11/contrib/libarchive/libarchive/archive_write_set_format_warc.c stable/11/contrib/libarchive/libarchive/archive_write_set_format_xar.c stable/11/contrib/libarchive/libarchive/archive_write_set_format_zip.c stable/11/contrib/libarchive/libarchive/libarchive-formats.5 stable/11/contrib/libarchive/libarchive/tar.5 stable/11/contrib/libarchive/libarchive/test/main.c stable/11/contrib/libarchive/libarchive/test/test.h stable/11/contrib/libarchive/libarchive/test/test_acl_nfs4.c stable/11/contrib/libarchive/libarchive/test/test_acl_pax.c stable/11/contrib/libarchive/libarchive/test/test_acl_posix1e.c stable/11/contrib/libarchive/libarchive/test/test_archive_read_add_passphrase.c stable/11/contrib/libarchive/libarchive/test/test_archive_string.c stable/11/contrib/libarchive/libarchive/test/test_compat_gtar.c stable/11/contrib/libarchive/libarchive/test/test_compat_solaris_tar_acl.c stable/11/contrib/libarchive/libarchive/test/test_compat_solaris_tar_acl.tar.uu stable/11/contrib/libarchive/libarchive/test/test_compat_uudecode.c stable/11/contrib/libarchive/libarchive/test/test_fuzz.c stable/11/contrib/libarchive/libarchive/test/test_read_disk_directory_traversals.c stable/11/contrib/libarchive/libarchive/test/test_read_filter_lzop.c stable/11/contrib/libarchive/libarchive/test/test_read_filter_lzop_multiple_parts.c stable/11/contrib/libarchive/libarchive/test/test_read_format_7zip.c stable/11/contrib/libarchive/libarchive/test/test_read_format_cpio_afio.c stable/11/contrib/libarchive/libarchive/test/test_read_format_isorr_bz2.c stable/11/contrib/libarchive/libarchive/test/test_read_format_zip.c stable/11/contrib/libarchive/libarchive/test/test_read_format_zip_comment_stored.c stable/11/contrib/libarchive/libarchive/test/test_read_format_zip_filename.c stable/11/contrib/libarchive/libarchive/test/test_read_format_zip_mac_metadata.c stable/11/contrib/libarchive/libarchive/test/test_read_format_zip_malformed.c stable/11/contrib/libarchive/libarchive/test/test_read_format_zip_nested.c stable/11/contrib/libarchive/libarchive/test/test_read_format_zip_padded.c stable/11/contrib/libarchive/libarchive/test/test_read_format_zip_sfx.c stable/11/contrib/libarchive/libarchive/test/test_read_format_zip_traditional_encryption_data.c stable/11/contrib/libarchive/libarchive/test/test_read_format_zip_winzip_aes.c stable/11/contrib/libarchive/libarchive/test/test_read_format_zip_winzip_aes_large.c stable/11/contrib/libarchive/libarchive/test/test_sparse_basic.c stable/11/contrib/libarchive/libarchive/test/test_write_disk_secure746.c stable/11/contrib/libarchive/libarchive/test/test_write_filter_lz4.c stable/11/contrib/libarchive/libarchive/test/test_write_filter_lzop.c stable/11/contrib/libarchive/libarchive/test/test_write_format_iso9660.c stable/11/contrib/libarchive/libarchive/test/test_write_format_iso9660_zisofs.c stable/11/contrib/libarchive/libarchive/test/test_write_format_zip_large.c stable/11/contrib/libarchive/libarchive/test/test_write_format_zip_zip64.c stable/11/contrib/libarchive/libarchive/xxhash.c stable/11/contrib/libarchive/tar/test/test_option_uid_uname.c stable/11/contrib/libarchive/tar/util.c stable/11/lib/libarchive/config_freebsd.h stable/11/lib/libarchive/tests/Makefile Directory Properties: stable/11/ (props changed) Modified: stable/11/ObsoleteFiles.inc ============================================================================== --- stable/11/ObsoleteFiles.inc Fri Feb 10 23:12:38 2017 (r313569) +++ stable/11/ObsoleteFiles.inc Sat Feb 11 00:54:16 2017 (r313570) @@ -38,6 +38,8 @@ # xargs -n1 | sort | uniq -d; # done +# 20170211: libarchive ACL pax test renamed to test_acl_pax_posix1e.tar.uu +OLD_FILES+=usr/tests/lib/libarchive/test_acl_pax.tar.uu # 20170103: libbsnmptools.so made into an INTERNALLIB OLD_FILES+=usr/lib/libbsnmptools.a OLD_FILES+=usr/lib/libbsnmptools_p.a Modified: stable/11/contrib/libarchive/NEWS ============================================================================== --- stable/11/contrib/libarchive/NEWS Fri Feb 10 23:12:38 2017 (r313569) +++ stable/11/contrib/libarchive/NEWS Sat Feb 11 00:54:16 2017 (r313570) @@ -1,3 +1,10 @@ +Jan 29, 2017: Limited NFSv4 ACL support for Mac OS (Darwin) + +Jan 10, 2017: POSIX.1e and NFSv4 ACL support for Solaris and derivates + +Dec 27, 2016: NFSv4 ACL read and write support for pax + Deprecated functions: archive_entry_acl_text(), archive_entry_acl_text_w() + Oct 26, 2016: Remove liblzmadec support Oct 23, 2016: libarchive 3.2.2 released Modified: stable/11/contrib/libarchive/cpio/cpio.c ============================================================================== --- stable/11/contrib/libarchive/cpio/cpio.c Fri Feb 10 23:12:38 2017 (r313569) +++ stable/11/contrib/libarchive/cpio/cpio.c Sat Feb 11 00:54:16 2017 (r313570) @@ -703,6 +703,7 @@ file_to_archive(struct cpio *cpio, const lafe_warnc(0, "%s", archive_error_string(cpio->archive_read_disk)); if (r <= ARCHIVE_FAILED) { + archive_entry_free(entry); cpio->return_value = 1; return (r); } Modified: stable/11/contrib/libarchive/libarchive/archive_acl.c ============================================================================== --- stable/11/contrib/libarchive/libarchive/archive_acl.c Fri Feb 10 23:12:38 2017 (r313569) +++ stable/11/contrib/libarchive/libarchive/archive_acl.c Sat Feb 11 00:54:16 2017 (r313570) @@ -1,5 +1,6 @@ /*- * Copyright (c) 2003-2010 Tim Kientzle + * Copyright (c) 2016 Martin Matuska * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -55,23 +56,31 @@ static struct archive_acl_entry *acl_new static int archive_acl_add_entry_len_l(struct archive_acl *acl, int type, int permset, int tag, int id, const char *name, size_t len, struct archive_string_conv *sc); +static int archive_acl_text_want_type(struct archive_acl *acl, int flags); +static ssize_t archive_acl_text_len(struct archive_acl *acl, int want_type, + int flags, int wide, struct archive *a, + struct archive_string_conv *sc); static int isint_w(const wchar_t *start, const wchar_t *end, int *result); static int ismode_w(const wchar_t *start, const wchar_t *end, int *result); +static int is_nfs4_flags_w(const wchar_t *start, const wchar_t *end, + int *result); +static int is_nfs4_perms_w(const wchar_t *start, const wchar_t *end, + int *result); static void next_field_w(const wchar_t **wp, const wchar_t **start, const wchar_t **end, wchar_t *sep); -static int prefix_w(const wchar_t *start, const wchar_t *end, - const wchar_t *test); -static void append_entry_w(wchar_t **wp, const wchar_t *prefix, int tag, - const wchar_t *wname, int perm, int id); +static void append_entry_w(wchar_t **wp, const wchar_t *prefix, int type, + int tag, int flags, const wchar_t *wname, int perm, int id); static void append_id_w(wchar_t **wp, int id); static int isint(const char *start, const char *end, int *result); static int ismode(const char *start, const char *end, int *result); +static int is_nfs4_flags(const char *start, const char *end, + int *result); +static int is_nfs4_perms(const char *start, const char *end, + int *result); static void next_field(const char **p, const char **start, const char **end, char *sep); -static int prefix_c(const char *start, const char *end, - const char *test); -static void append_entry(char **p, const char *prefix, int tag, - const char *name, int perm, int id); +static void append_entry(char **p, const char *prefix, int type, + int tag, int flags, const char *name, int perm, int id); static void append_id(char **p, int id); void @@ -340,6 +349,15 @@ archive_acl_count(struct archive_acl *ac } /* + * Return a bitmask of stored ACL types in an ACL list + */ +int +archive_acl_types(struct archive_acl *acl) +{ + return (acl->acl_types); +} + +/* * Prepare for reading entries from the ACL data. Returns a count * of entries matching "want_type", or zero if there are no * non-extended ACL entries of that type. @@ -375,8 +393,8 @@ archive_acl_reset(struct archive_acl *ac * standard permissions and include them in the returned list. */ int -archive_acl_next(struct archive *a, struct archive_acl *acl, int want_type, int *type, - int *permset, int *tag, int *id, const char **name) +archive_acl_next(struct archive *a, struct archive_acl *acl, int want_type, + int *type, int *permset, int *tag, int *id, const char **name) { *name = NULL; *id = -1; @@ -441,130 +459,273 @@ archive_acl_next(struct archive *a, stru } /* - * Generate a text version of the ACL. The flags parameter controls - * the style of the generated ACL. + * Determine what type of ACL do we want */ -const wchar_t * -archive_acl_text_w(struct archive *a, struct archive_acl *acl, int flags) +static int +archive_acl_text_want_type(struct archive_acl *acl, int flags) { - int count; - size_t length; - const wchar_t *wname; - const wchar_t *prefix; - wchar_t separator; - struct archive_acl_entry *ap; - int id, r; - wchar_t *wp; + int want_type; - if (acl->acl_text_w != NULL) { - free (acl->acl_text_w); - acl->acl_text_w = NULL; + /* Check if ACL is NFSv4 */ + if ((acl->acl_types & ARCHIVE_ENTRY_ACL_TYPE_NFS4) != 0) { + /* NFSv4 should never mix with POSIX.1e */ + if ((acl->acl_types & ARCHIVE_ENTRY_ACL_TYPE_POSIX1E) != 0) + return (0); + else + return (ARCHIVE_ENTRY_ACL_TYPE_NFS4); } - separator = L','; + /* Now deal with POSIX.1e ACLs */ + + want_type = 0; + if ((flags & ARCHIVE_ENTRY_ACL_TYPE_ACCESS) != 0) + want_type |= ARCHIVE_ENTRY_ACL_TYPE_ACCESS; + if ((flags & ARCHIVE_ENTRY_ACL_TYPE_DEFAULT) != 0) + want_type |= ARCHIVE_ENTRY_ACL_TYPE_DEFAULT; + + /* By default we want both access and default ACLs */ + if (want_type == 0) + return (ARCHIVE_ENTRY_ACL_TYPE_POSIX1E); + + return (want_type); +} + +/* + * Calculate ACL text string length + */ +static ssize_t +archive_acl_text_len(struct archive_acl *acl, int want_type, int flags, + int wide, struct archive *a, struct archive_string_conv *sc) { + struct archive_acl_entry *ap; + const char *name; + const wchar_t *wname; + int count, idlen, tmp, r; + ssize_t length; + size_t len; + count = 0; length = 0; - ap = acl->acl_head; - while (ap != NULL) { - if ((ap->type & flags) != 0) { - count++; - if ((flags & ARCHIVE_ENTRY_ACL_STYLE_MARK_DEFAULT) && - (ap->type & ARCHIVE_ENTRY_ACL_TYPE_DEFAULT)) - length += 8; /* "default:" */ - length += 5; /* tag name */ - length += 1; /* colon */ - r = archive_mstring_get_wcs(a, &ap->name, &wname); - if (r == 0 && wname != NULL) - length += wcslen(wname); - else if (r < 0 && errno == ENOMEM) - return (NULL); - else - length += sizeof(uid_t) * 3 + 1; - length ++; /* colon */ + for (ap = acl->acl_head; ap != NULL; ap = ap->next) { + if ((ap->type & want_type) == 0) + continue; + /* + * Filemode-mapping ACL entries are stored exclusively in + * ap->mode so they should not be in the list + */ + if ((ap->type == ARCHIVE_ENTRY_ACL_TYPE_ACCESS) + && (ap->tag == ARCHIVE_ENTRY_ACL_USER_OBJ + || ap->tag == ARCHIVE_ENTRY_ACL_GROUP_OBJ + || ap->tag == ARCHIVE_ENTRY_ACL_OTHER)) + continue; + count++; + if ((want_type & ARCHIVE_ENTRY_ACL_TYPE_DEFAULT) != 0 + && (ap->type & ARCHIVE_ENTRY_ACL_TYPE_DEFAULT) != 0) + length += 8; /* "default:" */ + switch (ap->tag) { + case ARCHIVE_ENTRY_ACL_USER_OBJ: + if (want_type == ARCHIVE_ENTRY_ACL_TYPE_NFS4) { + length += 6; /* "owner@" */ + break; + } + /* FALLTHROUGH */ + case ARCHIVE_ENTRY_ACL_USER: + case ARCHIVE_ENTRY_ACL_MASK: + length += 4; /* "user", "mask" */ + break; + case ARCHIVE_ENTRY_ACL_GROUP_OBJ: + if (want_type == ARCHIVE_ENTRY_ACL_TYPE_NFS4) { + length += 6; /* "group@" */ + break; + } + /* FALLTHROUGH */ + case ARCHIVE_ENTRY_ACL_GROUP: + case ARCHIVE_ENTRY_ACL_OTHER: + length += 5; /* "group", "other" */ + break; + case ARCHIVE_ENTRY_ACL_EVERYONE: + length += 9; /* "everyone@" */ + break; + } + length += 1; /* colon after tag */ + if (ap->tag == ARCHIVE_ENTRY_ACL_USER || + ap->tag == ARCHIVE_ENTRY_ACL_GROUP) { + if (wide) { + r = archive_mstring_get_wcs(a, &ap->name, + &wname); + if (r == 0 && wname != NULL) + length += wcslen(wname); + else if (r < 0 && errno == ENOMEM) + return (0); + else + length += sizeof(uid_t) * 3 + 1; + } else { + r = archive_mstring_get_mbs_l(&ap->name, &name, + &len, sc); + if (r != 0) + return (0); + if (len > 0 && name != NULL) + length += len; + else + length += sizeof(uid_t) * 3 + 1; + } + length += 1; /* colon after user or group name */ + } else if (want_type != ARCHIVE_ENTRY_ACL_TYPE_NFS4) + length += 1; /* 2nd colon empty user,group or other */ + + if (((flags & ARCHIVE_ENTRY_ACL_STYLE_SOLARIS) != 0) + && ((want_type & ARCHIVE_ENTRY_ACL_TYPE_POSIX1E) != 0) + && (ap->tag == ARCHIVE_ENTRY_ACL_OTHER + || ap->tag == ARCHIVE_ENTRY_ACL_MASK)) { + /* Solaris has no colon after other: and mask: */ + length = length - 1; + } + + if (want_type == ARCHIVE_ENTRY_ACL_TYPE_NFS4) { + /* rwxpdDaARWcCos:fdinSFI:deny */ + length += 27; + if ((ap->type & ARCHIVE_ENTRY_ACL_TYPE_DENY) == 0) + length += 1; /* allow, alarm, audit */ + } else length += 3; /* rwx */ + + if ((ap->tag == ARCHIVE_ENTRY_ACL_USER || + ap->tag == ARCHIVE_ENTRY_ACL_GROUP) && + (flags & ARCHIVE_ENTRY_ACL_STYLE_EXTRA_ID) != 0) { length += 1; /* colon */ - length += max(sizeof(uid_t), sizeof(gid_t)) * 3 + 1; - length ++; /* newline */ + /* ID digit count */ + idlen = 1; + tmp = ap->id; + while (tmp > 9) { + tmp = tmp / 10; + idlen++; + } + length += idlen; } - ap = ap->next; + length ++; /* entry separator */ } - if (count > 0 && ((flags & ARCHIVE_ENTRY_ACL_TYPE_ACCESS) != 0)) { - length += 10; /* "user::rwx\n" */ - length += 11; /* "group::rwx\n" */ - length += 11; /* "other::rwx\n" */ - } + /* Add filemode-mapping access entries to the length */ + if ((want_type & ARCHIVE_ENTRY_ACL_TYPE_ACCESS) != 0) { + if ((flags & ARCHIVE_ENTRY_ACL_STYLE_SOLARIS) != 0) { + /* "user::rwx\ngroup::rwx\nother:rwx\n" */ + length += 31; + } else { + /* "user::rwx\ngroup::rwx\nother::rwx\n" */ + length += 32; + } + } else if (count == 0) + return (0); - if (count == 0) + /* The terminating character is included in count */ + return (length); +} + +/* + * Generate a wide text version of the ACL. The flags parameter controls + * the type and style of the generated ACL. + */ +wchar_t * +archive_acl_to_text_w(struct archive_acl *acl, ssize_t *text_len, int flags, + struct archive *a) +{ + int count; + ssize_t length; + size_t len; + const wchar_t *wname; + const wchar_t *prefix; + wchar_t separator; + struct archive_acl_entry *ap; + int id, r, want_type; + wchar_t *wp, *ws; + + want_type = archive_acl_text_want_type(acl, flags); + + /* Both NFSv4 and POSIX.1 types found */ + if (want_type == 0) + return (NULL); + + if (want_type == ARCHIVE_ENTRY_ACL_TYPE_POSIX1E) + flags |= ARCHIVE_ENTRY_ACL_STYLE_MARK_DEFAULT; + + length = archive_acl_text_len(acl, want_type, flags, 1, a, NULL); + + if (length == 0) return (NULL); + if (flags & ARCHIVE_ENTRY_ACL_STYLE_SEPARATOR_COMMA) + separator = L','; + else + separator = L'\n'; + /* Now, allocate the string and actually populate it. */ - wp = acl->acl_text_w = (wchar_t *)malloc(length * sizeof(wchar_t)); - if (wp == NULL) + wp = ws = (wchar_t *)malloc(length * sizeof(wchar_t)); + if (wp == NULL) { + if (errno == ENOMEM) + __archive_errx(1, "No memory"); return (NULL); + } count = 0; - if ((flags & ARCHIVE_ENTRY_ACL_TYPE_ACCESS) != 0) { - append_entry_w(&wp, NULL, ARCHIVE_ENTRY_ACL_USER_OBJ, NULL, + + if ((want_type & ARCHIVE_ENTRY_ACL_TYPE_ACCESS) != 0) { + append_entry_w(&wp, NULL, ARCHIVE_ENTRY_ACL_TYPE_ACCESS, + ARCHIVE_ENTRY_ACL_USER_OBJ, flags, NULL, acl->mode & 0700, -1); - *wp++ = ','; - append_entry_w(&wp, NULL, ARCHIVE_ENTRY_ACL_GROUP_OBJ, NULL, + *wp++ = separator; + append_entry_w(&wp, NULL, ARCHIVE_ENTRY_ACL_TYPE_ACCESS, + ARCHIVE_ENTRY_ACL_GROUP_OBJ, flags, NULL, acl->mode & 0070, -1); - *wp++ = ','; - append_entry_w(&wp, NULL, ARCHIVE_ENTRY_ACL_OTHER, NULL, + *wp++ = separator; + append_entry_w(&wp, NULL, ARCHIVE_ENTRY_ACL_TYPE_ACCESS, + ARCHIVE_ENTRY_ACL_OTHER, flags, NULL, acl->mode & 0007, -1); count += 3; - - ap = acl->acl_head; - while (ap != NULL) { - if ((ap->type & ARCHIVE_ENTRY_ACL_TYPE_ACCESS) != 0) { - r = archive_mstring_get_wcs(a, &ap->name, &wname); - if (r == 0) { - *wp++ = separator; - if (flags & ARCHIVE_ENTRY_ACL_STYLE_EXTRA_ID) - id = ap->id; - else - id = -1; - append_entry_w(&wp, NULL, ap->tag, wname, - ap->permset, id); - count++; - } else if (r < 0 && errno == ENOMEM) - return (NULL); - } - ap = ap->next; - } } - - if ((flags & ARCHIVE_ENTRY_ACL_TYPE_DEFAULT) != 0) { - if (flags & ARCHIVE_ENTRY_ACL_STYLE_MARK_DEFAULT) + for (ap = acl->acl_head; ap != NULL; ap = ap->next) { + if ((ap->type & want_type) == 0) + continue; + /* + * Filemode-mapping ACL entries are stored exclusively in + * ap->mode so they should not be in the list + */ + if ((ap->type == ARCHIVE_ENTRY_ACL_TYPE_ACCESS) + && (ap->tag == ARCHIVE_ENTRY_ACL_USER_OBJ + || ap->tag == ARCHIVE_ENTRY_ACL_GROUP_OBJ + || ap->tag == ARCHIVE_ENTRY_ACL_OTHER)) + continue; + if (ap->type == ARCHIVE_ENTRY_ACL_TYPE_DEFAULT && + (flags & ARCHIVE_ENTRY_ACL_STYLE_MARK_DEFAULT) != 0) prefix = L"default:"; else prefix = NULL; - ap = acl->acl_head; - count = 0; - while (ap != NULL) { - if ((ap->type & ARCHIVE_ENTRY_ACL_TYPE_DEFAULT) != 0) { - r = archive_mstring_get_wcs(a, &ap->name, &wname); - if (r == 0) { - if (count > 0) - *wp++ = separator; - if (flags & ARCHIVE_ENTRY_ACL_STYLE_EXTRA_ID) - id = ap->id; - else - id = -1; - append_entry_w(&wp, prefix, ap->tag, - wname, ap->permset, id); - count ++; - } else if (r < 0 && errno == ENOMEM) - return (NULL); - } - ap = ap->next; - } + r = archive_mstring_get_wcs(a, &ap->name, &wname); + if (r == 0) { + if (count > 0) + *wp++ = separator; + if (flags & ARCHIVE_ENTRY_ACL_STYLE_EXTRA_ID) + id = ap->id; + else + id = -1; + append_entry_w(&wp, prefix, ap->type, ap->tag, flags, + wname, ap->permset, id); + count++; + } else if (r < 0 && errno == ENOMEM) + return (NULL); } - return (acl->acl_text_w); -} + /* Add terminating character */ + *wp++ = L'\0'; + + len = wcslen(ws); + if ((ssize_t)len > (length - 1)) + __archive_errx(1, "Buffer overrun"); + + if (text_len != NULL) + *text_len = len; + + return (ws); +} static void append_id_w(wchar_t **wp, int id) @@ -577,8 +738,8 @@ append_id_w(wchar_t **wp, int id) } static void -append_entry_w(wchar_t **wp, const wchar_t *prefix, int tag, - const wchar_t *wname, int perm, int id) +append_entry_w(wchar_t **wp, const wchar_t *prefix, int type, + int tag, int flags, const wchar_t *wname, int perm, int id) { if (prefix != NULL) { wcscpy(*wp, prefix); @@ -588,6 +749,10 @@ append_entry_w(wchar_t **wp, const wchar case ARCHIVE_ENTRY_ACL_USER_OBJ: wname = NULL; id = -1; + if ((type & ARCHIVE_ENTRY_ACL_TYPE_NFS4) != 0) { + wcscpy(*wp, L"owner@"); + break; + } /* FALLTHROUGH */ case ARCHIVE_ENTRY_ACL_USER: wcscpy(*wp, L"user"); @@ -595,6 +760,10 @@ append_entry_w(wchar_t **wp, const wchar case ARCHIVE_ENTRY_ACL_GROUP_OBJ: wname = NULL; id = -1; + if ((type & ARCHIVE_ENTRY_ACL_TYPE_NFS4) != 0) { + wcscpy(*wp, L"group@"); + break; + } /* FALLTHROUGH */ case ARCHIVE_ENTRY_ACL_GROUP: wcscpy(*wp, L"group"); @@ -609,154 +778,210 @@ append_entry_w(wchar_t **wp, const wchar wname = NULL; id = -1; break; + case ARCHIVE_ENTRY_ACL_EVERYONE: + wcscpy(*wp, L"everyone@"); + wname = NULL; + id = -1; + break; } *wp += wcslen(*wp); *(*wp)++ = L':'; - if (wname != NULL) { - wcscpy(*wp, wname); + if (((type & ARCHIVE_ENTRY_ACL_TYPE_POSIX1E) != 0) || + tag == ARCHIVE_ENTRY_ACL_USER || + tag == ARCHIVE_ENTRY_ACL_GROUP) { + if (wname != NULL) { + wcscpy(*wp, wname); + *wp += wcslen(*wp); + } else if (tag == ARCHIVE_ENTRY_ACL_USER + || tag == ARCHIVE_ENTRY_ACL_GROUP) { + append_id_w(wp, id); + if ((type & ARCHIVE_ENTRY_ACL_TYPE_NFS4) == 0) + id = -1; + } + /* Solaris style has no second colon after other and mask */ + if (((flags & ARCHIVE_ENTRY_ACL_STYLE_SOLARIS) == 0) + || (tag != ARCHIVE_ENTRY_ACL_OTHER + && tag != ARCHIVE_ENTRY_ACL_MASK)) + *(*wp)++ = L':'; + } + if ((type & ARCHIVE_ENTRY_ACL_TYPE_POSIX1E) != 0) { + /* POSIX.1e ACL perms */ + *(*wp)++ = (perm & 0444) ? L'r' : L'-'; + *(*wp)++ = (perm & 0222) ? L'w' : L'-'; + *(*wp)++ = (perm & 0111) ? L'x' : L'-'; + } else { + /* NFS4 ACL perms */ + *(*wp)++ = (perm & (ARCHIVE_ENTRY_ACL_READ_DATA | + ARCHIVE_ENTRY_ACL_LIST_DIRECTORY)) ? L'r' : L'-'; + *(*wp)++ = (perm & (ARCHIVE_ENTRY_ACL_WRITE_DATA | + ARCHIVE_ENTRY_ACL_ADD_FILE)) ? L'w' : L'-'; + *(*wp)++ = (perm & ARCHIVE_ENTRY_ACL_EXECUTE) ? L'x' : L'-'; + *(*wp)++ = (perm & (ARCHIVE_ENTRY_ACL_APPEND_DATA | + ARCHIVE_ENTRY_ACL_ADD_SUBDIRECTORY)) ? L'p' : L'-'; + *(*wp)++ = (perm & ARCHIVE_ENTRY_ACL_DELETE) ? L'd' : L'-'; + *(*wp)++ = (perm & + ARCHIVE_ENTRY_ACL_DELETE_CHILD) ? L'D' : L'-'; + *(*wp)++ = (perm & + ARCHIVE_ENTRY_ACL_READ_ATTRIBUTES) ? L'a' : L'-'; + *(*wp)++ = (perm & + ARCHIVE_ENTRY_ACL_WRITE_ATTRIBUTES) ? L'A' : L'-'; + *(*wp)++ = (perm & + ARCHIVE_ENTRY_ACL_READ_NAMED_ATTRS) ? L'R' : L'-'; + *(*wp)++ = (perm & + ARCHIVE_ENTRY_ACL_WRITE_NAMED_ATTRS) ? L'W' : L'-'; + *(*wp)++ = (perm & ARCHIVE_ENTRY_ACL_READ_ACL) ? L'c' : L'-'; + *(*wp)++ = (perm & ARCHIVE_ENTRY_ACL_WRITE_ACL) ? L'C' : L'-'; + *(*wp)++ = (perm & + ARCHIVE_ENTRY_ACL_WRITE_OWNER) ? L'o' : L'-'; + *(*wp)++ = (perm & + ARCHIVE_ENTRY_ACL_SYNCHRONIZE) ? L's' : L'-'; + *(*wp)++ = L':'; + *(*wp)++ = (perm & + ARCHIVE_ENTRY_ACL_ENTRY_FILE_INHERIT) ? L'f' : L'-'; + *(*wp)++ = (perm & + ARCHIVE_ENTRY_ACL_ENTRY_DIRECTORY_INHERIT) ? L'd' : L'-'; + *(*wp)++ = (perm & + ARCHIVE_ENTRY_ACL_ENTRY_INHERIT_ONLY) ? L'i' : L'-'; + *(*wp)++ = (perm & + ARCHIVE_ENTRY_ACL_ENTRY_NO_PROPAGATE_INHERIT) ? L'n' : L'-'; + *(*wp)++ = (perm & + ARCHIVE_ENTRY_ACL_ENTRY_SUCCESSFUL_ACCESS) ? L'S' : L'-'; + *(*wp)++ = (perm & + ARCHIVE_ENTRY_ACL_ENTRY_FAILED_ACCESS) ? L'F' : L'-'; + *(*wp)++ = (perm & + ARCHIVE_ENTRY_ACL_ENTRY_INHERITED) ? L'I' : L'-'; + *(*wp)++ = L':'; + switch (type) { + case ARCHIVE_ENTRY_ACL_TYPE_ALLOW: + wcscpy(*wp, L"allow"); + break; + case ARCHIVE_ENTRY_ACL_TYPE_DENY: + wcscpy(*wp, L"deny"); + break; + case ARCHIVE_ENTRY_ACL_TYPE_AUDIT: + wcscpy(*wp, L"audit"); + break; + case ARCHIVE_ENTRY_ACL_TYPE_ALARM: + wcscpy(*wp, L"alarm"); + break; + default: + break; + } *wp += wcslen(*wp); - } else if (tag == ARCHIVE_ENTRY_ACL_USER - || tag == ARCHIVE_ENTRY_ACL_GROUP) { - append_id_w(wp, id); - id = -1; } - *(*wp)++ = L':'; - *(*wp)++ = (perm & 0444) ? L'r' : L'-'; - *(*wp)++ = (perm & 0222) ? L'w' : L'-'; - *(*wp)++ = (perm & 0111) ? L'x' : L'-'; if (id != -1) { *(*wp)++ = L':'; append_id_w(wp, id); } - **wp = L'\0'; } -int -archive_acl_text_l(struct archive_acl *acl, int flags, - const char **acl_text, size_t *acl_text_len, +/* + * Generate a text version of the ACL. The flags parameter controls + * the type and style of the generated ACL. + */ +char * +archive_acl_to_text_l(struct archive_acl *acl, ssize_t *text_len, int flags, struct archive_string_conv *sc) { int count; - size_t length; + ssize_t length; + size_t len; const char *name; const char *prefix; char separator; struct archive_acl_entry *ap; - size_t len; - int id, r; - char *p; + int id, r, want_type; + char *p, *s; - if (acl->acl_text != NULL) { - free (acl->acl_text); - acl->acl_text = NULL; - } + want_type = archive_acl_text_want_type(acl, flags); - *acl_text = NULL; - if (acl_text_len != NULL) - *acl_text_len = 0; - separator = ','; - count = 0; - length = 0; - ap = acl->acl_head; - while (ap != NULL) { - if ((ap->type & flags) != 0) { - count++; - if ((flags & ARCHIVE_ENTRY_ACL_STYLE_MARK_DEFAULT) && - (ap->type & ARCHIVE_ENTRY_ACL_TYPE_DEFAULT)) - length += 8; /* "default:" */ - length += 5; /* tag name */ - length += 1; /* colon */ - r = archive_mstring_get_mbs_l( - &ap->name, &name, &len, sc); - if (r != 0) - return (-1); - if (len > 0 && name != NULL) - length += len; - else - length += sizeof(uid_t) * 3 + 1; - length ++; /* colon */ - length += 3; /* rwx */ - length += 1; /* colon */ - length += max(sizeof(uid_t), sizeof(gid_t)) * 3 + 1; - length ++; /* newline */ - } - ap = ap->next; - } + /* Both NFSv4 and POSIX.1 types found */ + if (want_type == 0) + return (NULL); - if (count > 0 && ((flags & ARCHIVE_ENTRY_ACL_TYPE_ACCESS) != 0)) { - length += 10; /* "user::rwx\n" */ - length += 11; /* "group::rwx\n" */ - length += 11; /* "other::rwx\n" */ - } + if (want_type == ARCHIVE_ENTRY_ACL_TYPE_POSIX1E) + flags |= ARCHIVE_ENTRY_ACL_STYLE_MARK_DEFAULT; - if (count == 0) - return (0); + length = archive_acl_text_len(acl, want_type, flags, 0, NULL, sc); + + if (length == 0) + return (NULL); + + if (flags & ARCHIVE_ENTRY_ACL_STYLE_SEPARATOR_COMMA) + separator = ','; + else + separator = '\n'; /* Now, allocate the string and actually populate it. */ - p = acl->acl_text = (char *)malloc(length); - if (p == NULL) - return (-1); + p = s = (char *)malloc(length * sizeof(char)); + if (p == NULL) { + if (errno == ENOMEM) + __archive_errx(1, "No memory"); + return (NULL); + } count = 0; - if ((flags & ARCHIVE_ENTRY_ACL_TYPE_ACCESS) != 0) { - append_entry(&p, NULL, ARCHIVE_ENTRY_ACL_USER_OBJ, NULL, + + if ((want_type & ARCHIVE_ENTRY_ACL_TYPE_ACCESS) != 0) { + append_entry(&p, NULL, ARCHIVE_ENTRY_ACL_TYPE_ACCESS, + ARCHIVE_ENTRY_ACL_USER_OBJ, flags, NULL, acl->mode & 0700, -1); - *p++ = ','; - append_entry(&p, NULL, ARCHIVE_ENTRY_ACL_GROUP_OBJ, NULL, + *p++ = separator; + append_entry(&p, NULL, ARCHIVE_ENTRY_ACL_TYPE_ACCESS, + ARCHIVE_ENTRY_ACL_GROUP_OBJ, flags, NULL, acl->mode & 0070, -1); - *p++ = ','; - append_entry(&p, NULL, ARCHIVE_ENTRY_ACL_OTHER, NULL, + *p++ = separator; + append_entry(&p, NULL, ARCHIVE_ENTRY_ACL_TYPE_ACCESS, + ARCHIVE_ENTRY_ACL_OTHER, flags, NULL, acl->mode & 0007, -1); count += 3; - - for (ap = acl->acl_head; ap != NULL; ap = ap->next) { - if ((ap->type & ARCHIVE_ENTRY_ACL_TYPE_ACCESS) == 0) - continue; - r = archive_mstring_get_mbs_l( - &ap->name, &name, &len, sc); - if (r != 0) - return (-1); - *p++ = separator; - if (name == NULL || (flags & ARCHIVE_ENTRY_ACL_STYLE_EXTRA_ID)) { - id = ap->id; - } else { - id = -1; - } - append_entry(&p, NULL, ap->tag, name, - ap->permset, id); - count++; - } } - - if ((flags & ARCHIVE_ENTRY_ACL_TYPE_DEFAULT) != 0) { - if (flags & ARCHIVE_ENTRY_ACL_STYLE_MARK_DEFAULT) + for (ap = acl->acl_head; ap != NULL; ap = ap->next) { + if ((ap->type & want_type) == 0) + continue; + /* + * Filemode-mapping ACL entries are stored exclusively in + * ap->mode so they should not be in the list + */ + if ((ap->type == ARCHIVE_ENTRY_ACL_TYPE_ACCESS) + && (ap->tag == ARCHIVE_ENTRY_ACL_USER_OBJ + || ap->tag == ARCHIVE_ENTRY_ACL_GROUP_OBJ + || ap->tag == ARCHIVE_ENTRY_ACL_OTHER)) + continue; + if (ap->type == ARCHIVE_ENTRY_ACL_TYPE_DEFAULT && + (flags & ARCHIVE_ENTRY_ACL_STYLE_MARK_DEFAULT) != 0) prefix = "default:"; else prefix = NULL; - count = 0; - for (ap = acl->acl_head; ap != NULL; ap = ap->next) { - if ((ap->type & ARCHIVE_ENTRY_ACL_TYPE_DEFAULT) == 0) - continue; - r = archive_mstring_get_mbs_l( - &ap->name, &name, &len, sc); - if (r != 0) - return (-1); - if (count > 0) - *p++ = separator; - if (flags & ARCHIVE_ENTRY_ACL_STYLE_EXTRA_ID) - id = ap->id; - else - id = -1; - append_entry(&p, prefix, ap->tag, - name, ap->permset, id); - count ++; + r = archive_mstring_get_mbs_l( + &ap->name, &name, &len, sc); + if (r != 0) + return (NULL); + if (count > 0) + *p++ = separator; + if (name == NULL || + (flags & ARCHIVE_ENTRY_ACL_STYLE_EXTRA_ID)) { + id = ap->id; + } else { + id = -1; } + append_entry(&p, prefix, ap->type, ap->tag, flags, name, + ap->permset, id); + count++; } - *acl_text = acl->acl_text; - if (acl_text_len != NULL) - *acl_text_len = strlen(acl->acl_text); - return (0); + /* Add terminating character */ + *p++ = '\0'; + + len = strlen(s); + + if ((ssize_t)len > (length - 1)) + __archive_errx(1, "Buffer overrun"); + + if (text_len != NULL) + *text_len = len; + + return (s); } static void @@ -770,8 +995,8 @@ append_id(char **p, int id) } static void -append_entry(char **p, const char *prefix, int tag, - const char *name, int perm, int id) +append_entry(char **p, const char *prefix, int type, + int tag, int flags, const char *name, int perm, int id) { if (prefix != NULL) { strcpy(*p, prefix); @@ -781,6 +1006,10 @@ append_entry(char **p, const char *prefi case ARCHIVE_ENTRY_ACL_USER_OBJ: name = NULL; id = -1; + if ((type & ARCHIVE_ENTRY_ACL_TYPE_NFS4) != 0) { + strcpy(*p, "owner@"); + break; + } /* FALLTHROUGH */ case ARCHIVE_ENTRY_ACL_USER: strcpy(*p, "user"); @@ -788,6 +1017,10 @@ append_entry(char **p, const char *prefi case ARCHIVE_ENTRY_ACL_GROUP_OBJ: name = NULL; id = -1; + if ((type & ARCHIVE_ENTRY_ACL_TYPE_NFS4) != 0) { + strcpy(*p, "group@"); + break; + } /* FALLTHROUGH */ case ARCHIVE_ENTRY_ACL_GROUP: strcpy(*p, "group"); @@ -802,48 +1035,147 @@ append_entry(char **p, const char *prefi name = NULL; id = -1; break; + case ARCHIVE_ENTRY_ACL_EVERYONE: + strcpy(*p, "everyone@"); + name = NULL; + id = -1; + break; } *p += strlen(*p); *(*p)++ = ':'; - if (name != NULL) { - strcpy(*p, name); + if (((type & ARCHIVE_ENTRY_ACL_TYPE_POSIX1E) != 0) || + tag == ARCHIVE_ENTRY_ACL_USER || + tag == ARCHIVE_ENTRY_ACL_GROUP) { + if (name != NULL) { + strcpy(*p, name); + *p += strlen(*p); + } else if (tag == ARCHIVE_ENTRY_ACL_USER + || tag == ARCHIVE_ENTRY_ACL_GROUP) { + append_id(p, id); + if ((type & ARCHIVE_ENTRY_ACL_TYPE_NFS4) == 0) + id = -1; + } + /* Solaris style has no second colon after other and mask */ + if (((flags & ARCHIVE_ENTRY_ACL_STYLE_SOLARIS) == 0) + || (tag != ARCHIVE_ENTRY_ACL_OTHER + && tag != ARCHIVE_ENTRY_ACL_MASK)) + *(*p)++ = ':'; + } + if ((type & ARCHIVE_ENTRY_ACL_TYPE_POSIX1E) != 0) { + /* POSIX.1e ACL perms */ + *(*p)++ = (perm & 0444) ? 'r' : '-'; + *(*p)++ = (perm & 0222) ? 'w' : '-'; + *(*p)++ = (perm & 0111) ? 'x' : '-'; + } else { + /* NFS4 ACL perms */ + *(*p)++ = (perm & (ARCHIVE_ENTRY_ACL_READ_DATA | + ARCHIVE_ENTRY_ACL_LIST_DIRECTORY)) ? 'r' : '-'; + *(*p)++ = (perm & (ARCHIVE_ENTRY_ACL_WRITE_DATA | + ARCHIVE_ENTRY_ACL_ADD_FILE)) ? 'w' : '-'; + *(*p)++ = (perm & (ARCHIVE_ENTRY_ACL_EXECUTE)) ? 'x' : '-'; + *(*p)++ = (perm & (ARCHIVE_ENTRY_ACL_APPEND_DATA | + ARCHIVE_ENTRY_ACL_ADD_SUBDIRECTORY)) ? 'p' : '-'; + *(*p)++ = (perm & ARCHIVE_ENTRY_ACL_DELETE) ? 'd' : '-'; + *(*p)++ = (perm & ARCHIVE_ENTRY_ACL_DELETE_CHILD) ? 'D' : '-'; + *(*p)++ = (perm & + ARCHIVE_ENTRY_ACL_READ_ATTRIBUTES) ? 'a' : '-'; + *(*p)++ = (perm & + ARCHIVE_ENTRY_ACL_WRITE_ATTRIBUTES) ? 'A' : '-'; + *(*p)++ = (perm & + ARCHIVE_ENTRY_ACL_READ_NAMED_ATTRS) ? 'R' : '-'; + *(*p)++ = (perm & + ARCHIVE_ENTRY_ACL_WRITE_NAMED_ATTRS) ? 'W' : '-'; + *(*p)++ = (perm & + ARCHIVE_ENTRY_ACL_READ_ACL) ? 'c' : '-'; + *(*p)++ = (perm & + ARCHIVE_ENTRY_ACL_WRITE_ACL) ? 'C' : '-'; + *(*p)++ = (perm & + ARCHIVE_ENTRY_ACL_WRITE_OWNER) ? 'o' : '-'; + *(*p)++ = (perm & + ARCHIVE_ENTRY_ACL_SYNCHRONIZE) ? 's' : '-'; + *(*p)++ = ':'; + *(*p)++ = (perm & + ARCHIVE_ENTRY_ACL_ENTRY_FILE_INHERIT) ? 'f' : '-'; + *(*p)++ = (perm & + ARCHIVE_ENTRY_ACL_ENTRY_DIRECTORY_INHERIT) ? 'd' : '-'; + *(*p)++ = (perm & + ARCHIVE_ENTRY_ACL_ENTRY_INHERIT_ONLY) ? 'i' : '-'; + *(*p)++ = (perm & + ARCHIVE_ENTRY_ACL_ENTRY_NO_PROPAGATE_INHERIT) ? 'n' : '-'; + *(*p)++ = (perm & + ARCHIVE_ENTRY_ACL_ENTRY_SUCCESSFUL_ACCESS) ? 'S' : '-'; + *(*p)++ = (perm & + ARCHIVE_ENTRY_ACL_ENTRY_FAILED_ACCESS) ? 'F' : '-'; + *(*p)++ = (perm & + ARCHIVE_ENTRY_ACL_ENTRY_INHERITED) ? 'I' : '-'; + *(*p)++ = ':'; + switch (type) { + case ARCHIVE_ENTRY_ACL_TYPE_ALLOW: + strcpy(*p, "allow"); + break; + case ARCHIVE_ENTRY_ACL_TYPE_DENY: + strcpy(*p, "deny"); + break; + case ARCHIVE_ENTRY_ACL_TYPE_AUDIT: + strcpy(*p, "audit"); + break; + case ARCHIVE_ENTRY_ACL_TYPE_ALARM: + strcpy(*p, "alarm"); + break; + } *p += strlen(*p); - } else if (tag == ARCHIVE_ENTRY_ACL_USER - || tag == ARCHIVE_ENTRY_ACL_GROUP) { - append_id(p, id); - id = -1; } - *(*p)++ = ':'; - *(*p)++ = (perm & 0444) ? 'r' : '-'; - *(*p)++ = (perm & 0222) ? 'w' : '-'; - *(*p)++ = (perm & 0111) ? 'x' : '-'; if (id != -1) { *(*p)++ = ':'; append_id(p, id); } - **p = '\0'; } /* - * Parse a textual ACL. This automatically recognizes and supports - * extensions described above. The 'type' argument is used to - * indicate the type that should be used for any entries not - * explicitly marked as "default:". + * Parse a wide ACL text string. + * + * The want_type argument may be one of the following: + * ARCHIVE_ENTRY_ACL_TYPE_ACCESS - text is a POSIX.1e ACL of type ACCESS + * ARCHIVE_ENTRY_ACL_TYPE_DEFAULT - text is a POSIX.1e ACL of type DEFAULT + * ARCHIVE_ENTRY_ACL_TYPE_NFS4 - text is as a NFSv4 ACL + * + * POSIX.1e ACL entries prefixed with "default:" are treated as + * ARCHIVE_ENTRY_ACL_TYPE_DEFAULT unless type is ARCHIVE_ENTRY_ACL_TYPE_NFS4 */ int -archive_acl_parse_w(struct archive_acl *acl, - const wchar_t *text, int default_type) +archive_acl_from_text_w(struct archive_acl *acl, const wchar_t *text, + int want_type) { struct { const wchar_t *start; *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-stable-11@freebsd.org Sat Feb 11 02:00:59 2017 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 213FDCD9F97; Sat, 11 Feb 2017 02:00:59 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D394BE0C; Sat, 11 Feb 2017 02:00:58 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v1B20vsP087017; Sat, 11 Feb 2017 02:00:57 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v1B20vwK087009; Sat, 11 Feb 2017 02:00:57 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201702110200.v1B20vwK087009@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Sat, 11 Feb 2017 02:00:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r313574 - in stable/11/sys: arm/include arm64/include mips/include powerpc/include riscv/include sparc64/include sys x86/include X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 11 Feb 2017 02:00:59 -0000 Author: kib Date: Sat Feb 11 02:00:56 2017 New Revision: 313574 URL: https://svnweb.freebsd.org/changeset/base/313574 Log: MFC r313194: Define the vm_ooffset_t and vm_pindex_t types as machine-independend. Modified: stable/11/sys/arm/include/_types.h stable/11/sys/arm64/include/_types.h stable/11/sys/mips/include/_types.h stable/11/sys/powerpc/include/_types.h stable/11/sys/riscv/include/_types.h stable/11/sys/sparc64/include/_types.h stable/11/sys/sys/types.h stable/11/sys/x86/include/_types.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/arm/include/_types.h ============================================================================== --- stable/11/sys/arm/include/_types.h Sat Feb 11 01:07:46 2017 (r313573) +++ stable/11/sys/arm/include/_types.h Sat Feb 11 02:00:56 2017 (r313574) @@ -100,9 +100,7 @@ typedef __uint32_t __uint_least32_t; typedef __uint64_t __uint_least64_t; typedef __uint32_t __u_register_t; typedef __uint32_t __vm_offset_t; -typedef __int64_t __vm_ooffset_t; typedef __uint32_t __vm_paddr_t; -typedef __uint64_t __vm_pindex_t; typedef __uint32_t __vm_size_t; typedef unsigned int ___wchar_t; Modified: stable/11/sys/arm64/include/_types.h ============================================================================== --- stable/11/sys/arm64/include/_types.h Sat Feb 11 01:07:46 2017 (r313573) +++ stable/11/sys/arm64/include/_types.h Sat Feb 11 02:00:56 2017 (r313574) @@ -88,9 +88,7 @@ typedef __uint32_t __uint_least32_t; typedef __uint64_t __uint_least64_t; typedef __uint64_t __u_register_t; typedef __uint64_t __vm_offset_t; -typedef __int64_t __vm_ooffset_t; typedef __uint64_t __vm_paddr_t; -typedef __uint64_t __vm_pindex_t; typedef __uint64_t __vm_size_t; typedef unsigned int ___wchar_t; Modified: stable/11/sys/mips/include/_types.h ============================================================================== --- stable/11/sys/mips/include/_types.h Sat Feb 11 01:07:46 2017 (r313573) +++ stable/11/sys/mips/include/_types.h Sat Feb 11 02:00:56 2017 (r313574) @@ -143,8 +143,6 @@ typedef __uint64_t __vm_paddr_t; typedef __uint32_t __vm_paddr_t; #endif -typedef __int64_t __vm_ooffset_t; -typedef __uint64_t __vm_pindex_t; typedef int ___wchar_t; #define __WCHAR_MIN __INT_MIN /* min value for a wchar_t */ Modified: stable/11/sys/powerpc/include/_types.h ============================================================================== --- stable/11/sys/powerpc/include/_types.h Sat Feb 11 01:07:46 2017 (r313573) +++ stable/11/sys/powerpc/include/_types.h Sat Feb 11 02:00:56 2017 (r313574) @@ -135,8 +135,6 @@ typedef __uint32_t __vm_paddr_t; #endif typedef __uint32_t __vm_size_t; #endif -typedef __int64_t __vm_ooffset_t; -typedef __uint64_t __vm_pindex_t; typedef int ___wchar_t; #define __WCHAR_MIN __INT_MIN /* min value for a wchar_t */ Modified: stable/11/sys/riscv/include/_types.h ============================================================================== --- stable/11/sys/riscv/include/_types.h Sat Feb 11 01:07:46 2017 (r313573) +++ stable/11/sys/riscv/include/_types.h Sat Feb 11 02:00:56 2017 (r313574) @@ -88,9 +88,7 @@ typedef __uint32_t __uint_least32_t; typedef __uint64_t __uint_least64_t; typedef __uint64_t __u_register_t; typedef __uint64_t __vm_offset_t; -typedef __int64_t __vm_ooffset_t; typedef __uint64_t __vm_paddr_t; -typedef __uint64_t __vm_pindex_t; typedef __uint64_t __vm_size_t; typedef int ___wchar_t; Modified: stable/11/sys/sparc64/include/_types.h ============================================================================== --- stable/11/sys/sparc64/include/_types.h Sat Feb 11 01:07:46 2017 (r313573) +++ stable/11/sys/sparc64/include/_types.h Sat Feb 11 02:00:56 2017 (r313574) @@ -88,9 +88,7 @@ typedef __uint32_t __uint_least32_t; typedef __uint64_t __uint_least64_t; typedef __uint64_t __u_register_t; typedef __uint64_t __vm_offset_t; -typedef __int64_t __vm_ooffset_t; typedef __uint64_t __vm_paddr_t; -typedef __uint64_t __vm_pindex_t; typedef __uint64_t __vm_size_t; typedef int ___wchar_t; Modified: stable/11/sys/sys/types.h ============================================================================== --- stable/11/sys/sys/types.h Sat Feb 11 01:07:46 2017 (r313573) +++ stable/11/sys/sys/types.h Sat Feb 11 02:00:56 2017 (r313574) @@ -250,9 +250,9 @@ typedef struct cap_rights cap_rights_t; #endif typedef __vm_offset_t vm_offset_t; -typedef __vm_ooffset_t vm_ooffset_t; +typedef __int64_t vm_ooffset_t; typedef __vm_paddr_t vm_paddr_t; -typedef __vm_pindex_t vm_pindex_t; +typedef __uint64_t vm_pindex_t; typedef __vm_size_t vm_size_t; typedef __rman_res_t rman_res_t; Modified: stable/11/sys/x86/include/_types.h ============================================================================== --- stable/11/sys/x86/include/_types.h Sat Feb 11 01:07:46 2017 (r313573) +++ stable/11/sys/x86/include/_types.h Sat Feb 11 02:00:56 2017 (r313574) @@ -142,8 +142,6 @@ typedef __uint32_t __vm_paddr_t; #endif typedef __uint32_t __vm_size_t; #endif -typedef __int64_t __vm_ooffset_t; -typedef __uint64_t __vm_pindex_t; typedef int ___wchar_t; #define __WCHAR_MIN __INT_MIN /* min value for a wchar_t */ From owner-svn-src-stable-11@freebsd.org Sat Feb 11 20:02:41 2017 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 52DF5CDB987; Sat, 11 Feb 2017 20:02:41 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 1CA1F7F8; Sat, 11 Feb 2017 20:02:41 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v1BK2exB045936; Sat, 11 Feb 2017 20:02:40 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v1BK2eAs045935; Sat, 11 Feb 2017 20:02:40 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201702112002.v1BK2eAs045935@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Sat, 11 Feb 2017 20:02:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r313649 - stable/11/sys/dev/usb/controller X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 11 Feb 2017 20:02:41 -0000 Author: ian Date: Sat Feb 11 20:02:39 2017 New Revision: 313649 URL: https://svnweb.freebsd.org/changeset/base/313649 Log: MFC r311850: Use the post-reset hook to force the controller to host mode. This will make both usb ports work on imx6 systems (the OTG port of course will only work in host mode). Modified: stable/11/sys/dev/usb/controller/ehci_imx.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/usb/controller/ehci_imx.c ============================================================================== --- stable/11/sys/dev/usb/controller/ehci_imx.c Sat Feb 11 18:10:55 2017 (r313648) +++ stable/11/sys/dev/usb/controller/ehci_imx.c Sat Feb 11 20:02:39 2017 (r313649) @@ -157,6 +157,18 @@ struct imx_ehci_softc { struct resource *ehci_irq_res; /* EHCI core IRQ. */ }; +static void +imx_ehci_post_reset(struct ehci_softc *ehci_softc) +{ + uint32_t usbmode; + + /* Force HOST mode */ + usbmode = EOREAD4(ehci_softc, EHCI_USBMODE_NOLPM); + usbmode &= ~EHCI_UM_CM; + usbmode |= EHCI_UM_CM_HOST; + EOWRITE4(ehci_softc, EHCI_USBMODE_NOLPM, usbmode); +} + static int imx_ehci_probe(device_t dev) { @@ -282,8 +294,13 @@ imx_ehci_attach(device_t dev) esc->sc_id_vendor = USB_VENDOR_FREESCALE; strlcpy(esc->sc_vendor, "Freescale", sizeof(esc->sc_vendor)); - /* Set flags that affect ehci_init() behavior. */ - esc->sc_flags |= EHCI_SCFLG_DONTRESET | EHCI_SCFLG_NORESTERM; + /* + * Set flags that affect ehci_init() behavior, and hook our post-reset + * code into the standard controller code. + */ + esc->sc_flags |= EHCI_SCFLG_NORESTERM; + esc->sc_vendor_post_reset = imx_ehci_post_reset; + err = ehci_init(esc); if (err != 0) { device_printf(dev, "USB init failed, usb_err_t=%d\n",