From owner-svn-src-head@FreeBSD.ORG Sun Feb 3 00:19:35 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 5B9BB153; Sun, 3 Feb 2013 00:19:35 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 3F68DCF4; Sun, 3 Feb 2013 00:19:35 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r130JZkn055486; Sun, 3 Feb 2013 00:19:35 GMT (envelope-from jhibbits@svn.freebsd.org) Received: (from jhibbits@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r130JYsQ055484; Sun, 3 Feb 2013 00:19:34 GMT (envelope-from jhibbits@svn.freebsd.org) Message-Id: <201302030019.r130JYsQ055484@svn.freebsd.org> From: Justin Hibbits Date: Sun, 3 Feb 2013 00:19:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r246275 - head/sys/cddl/dev/dtrace/powerpc X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 03 Feb 2013 00:19:35 -0000 Author: jhibbits Date: Sun Feb 3 00:19:34 2013 New Revision: 246275 URL: http://svnweb.freebsd.org/changeset/base/246275 Log: Fix the PowerPC DTrace copy functions. The kernel doesn't hold the same view to the user map, so use the md copy in/out functions provided by the kernel. MFC with: r242723 Modified: head/sys/cddl/dev/dtrace/powerpc/dtrace_asm.S head/sys/cddl/dev/dtrace/powerpc/dtrace_isa.c Modified: head/sys/cddl/dev/dtrace/powerpc/dtrace_asm.S ============================================================================== --- head/sys/cddl/dev/dtrace/powerpc/dtrace_asm.S Sun Feb 3 00:02:59 2013 (r246274) +++ head/sys/cddl/dev/dtrace/powerpc/dtrace_asm.S Sun Feb 3 00:19:34 2013 (r246275) @@ -19,6 +19,8 @@ * * CDDL HEADER END * + * Portions Copyright 2012,2013 Justin Hibbits + * * $FreeBSD$ */ /* @@ -114,48 +116,6 @@ ASENTRY_NOPROF(dtrace_fulword) END(dtrace_fulword) /* -uint8_t -dtrace_fuword8_nocheck(void *addr) -*/ -ASENTRY_NOPROF(dtrace_fuword8_nocheck) - lbz %r3,0(%r3) - blr -END(dtrace_fuword8_nocheck) - -/* -uint16_t -dtrace_fuword16_nocheck(void *addr) -*/ -ASENTRY_NOPROF(dtrace_fuword16_nocheck) - lhz %r3,0(%r3) - blr -END(dtrace_fuword16_nocheck) - -/* -uint32_t -dtrace_fuword32_nocheck(void *addr) -*/ -ASENTRY_NOPROF(dtrace_fuword32_nocheck) - lwz %r3,0(%r3) - blr -END(dtrace_fuword32_nocheck) - -/* -uint64_t -dtrace_fuword64_nocheck(void *addr) -*/ -ASENTRY_NOPROF(dtrace_fuword64_nocheck) -#if defined(__powerpc64__) - ld %r3,0(%r3) -#else - lwz %r5,0(%r3) - lwz %r4,4(%r3) - mr %r3,%r5 -#endif - blr -END(dtrace_fuword64_nocheck) - -/* XXX: unoptimized void dtrace_copy(uintptr_t src, uintptr_t dest, size_t size) Modified: head/sys/cddl/dev/dtrace/powerpc/dtrace_isa.c ============================================================================== --- head/sys/cddl/dev/dtrace/powerpc/dtrace_isa.c Sun Feb 3 00:02:59 2013 (r246274) +++ head/sys/cddl/dev/dtrace/powerpc/dtrace_isa.c Sun Feb 3 00:19:34 2013 (r246275) @@ -19,6 +19,8 @@ * * CDDL HEADER END * + * Portions Copyright 2012,2013 Justin Hibbits + * * $FreeBSD$ */ /* @@ -45,11 +47,6 @@ #include "regset.h" -uint8_t dtrace_fuword8_nocheck(void *); -uint16_t dtrace_fuword16_nocheck(void *); -uint32_t dtrace_fuword32_nocheck(void *); -uint64_t dtrace_fuword64_nocheck(void *); - /* Offset to the LR Save word (ppc32) */ #define RETURN_OFFSET 4 #define RETURN_OFFSET64 8 @@ -462,31 +459,63 @@ dtrace_copyin(uintptr_t uaddr, uintptr_t volatile uint16_t *flags) { if (dtrace_copycheck(uaddr, kaddr, size)) - dtrace_copy(uaddr, kaddr, size); + if (copyin((const void *)uaddr, (void *)kaddr, size)) { + DTRACE_CPUFLAG_SET(CPU_DTRACE_BADADDR); + cpu_core[curcpu].cpuc_dtrace_illval = (uintptr_t)uaddr; + } } void dtrace_copyout(uintptr_t kaddr, uintptr_t uaddr, size_t size, volatile uint16_t *flags) { - if (dtrace_copycheck(uaddr, kaddr, size)) - dtrace_copy(kaddr, uaddr, size); + if (dtrace_copycheck(uaddr, kaddr, size)) { + if (copyout((const void *)kaddr, (void *)uaddr, size)) { + DTRACE_CPUFLAG_SET(CPU_DTRACE_BADADDR); + cpu_core[curcpu].cpuc_dtrace_illval = (uintptr_t)uaddr; + } + } } void dtrace_copyinstr(uintptr_t uaddr, uintptr_t kaddr, size_t size, volatile uint16_t *flags) { - if (dtrace_copycheck(uaddr, kaddr, size)) - dtrace_copystr(uaddr, kaddr, size, flags); + size_t actual; + int error; + + if (dtrace_copycheck(uaddr, kaddr, size)) { + error = copyinstr((const void *)uaddr, (void *)kaddr, + size, &actual); + + /* ENAMETOOLONG is not a fault condition. */ + if (error && error != ENAMETOOLONG) { + DTRACE_CPUFLAG_SET(CPU_DTRACE_BADADDR); + cpu_core[curcpu].cpuc_dtrace_illval = (uintptr_t)uaddr; + } + } } +/* + * The bulk of this function could be replaced to match dtrace_copyinstr() + * if we ever implement a copyoutstr(). + */ void dtrace_copyoutstr(uintptr_t kaddr, uintptr_t uaddr, size_t size, volatile uint16_t *flags) { - if (dtrace_copycheck(uaddr, kaddr, size)) - dtrace_copystr(kaddr, uaddr, size, flags); + size_t len; + + if (dtrace_copycheck(uaddr, kaddr, size)) { + len = strlen((const char *)kaddr); + if (len > size) + len = size; + + if (copyout((const void *)kaddr, (void *)uaddr, len)) { + DTRACE_CPUFLAG_SET(CPU_DTRACE_BADADDR); + cpu_core[curcpu].cpuc_dtrace_illval = (uintptr_t)uaddr; + } + } } uint8_t @@ -497,18 +526,21 @@ dtrace_fuword8(void *uaddr) cpu_core[curcpu].cpuc_dtrace_illval = (uintptr_t)uaddr; return (0); } - return (dtrace_fuword8_nocheck(uaddr)); + return (fubyte(uaddr)); } uint16_t dtrace_fuword16(void *uaddr) { - if ((uintptr_t)uaddr > VM_MAXUSER_ADDRESS) { - DTRACE_CPUFLAG_SET(CPU_DTRACE_BADADDR); - cpu_core[curcpu].cpuc_dtrace_illval = (uintptr_t)uaddr; - return (0); + uint16_t ret = 0; + + if (dtrace_copycheck((uintptr_t)uaddr, (uintptr_t)&ret, sizeof(ret))) { + if (copyin((const void *)uaddr, (void *)&ret, sizeof(ret))) { + DTRACE_CPUFLAG_SET(CPU_DTRACE_BADADDR); + cpu_core[curcpu].cpuc_dtrace_illval = (uintptr_t)uaddr; + } } - return (dtrace_fuword16_nocheck(uaddr)); + return ret; } uint32_t @@ -519,16 +551,19 @@ dtrace_fuword32(void *uaddr) cpu_core[curcpu].cpuc_dtrace_illval = (uintptr_t)uaddr; return (0); } - return (dtrace_fuword32_nocheck(uaddr)); + return (fuword32(uaddr)); } uint64_t dtrace_fuword64(void *uaddr) { - if ((uintptr_t)uaddr > VM_MAXUSER_ADDRESS) { - DTRACE_CPUFLAG_SET(CPU_DTRACE_BADADDR); - cpu_core[curcpu].cpuc_dtrace_illval = (uintptr_t)uaddr; - return (0); + uint64_t ret = 0; + + if (dtrace_copycheck((uintptr_t)uaddr, (uintptr_t)&ret, sizeof(ret))) { + if (copyin((const void *)uaddr, (void *)&ret, sizeof(ret))) { + DTRACE_CPUFLAG_SET(CPU_DTRACE_BADADDR); + cpu_core[curcpu].cpuc_dtrace_illval = (uintptr_t)uaddr; + } } - return (dtrace_fuword64_nocheck(uaddr)); + return ret; } From owner-svn-src-head@FreeBSD.ORG Sun Feb 3 01:08:02 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 489BB646; Sun, 3 Feb 2013 01:08:02 +0000 (UTC) (envelope-from kientzle@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 22BC8DD7; Sun, 3 Feb 2013 01:08:02 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r13181IF070191; Sun, 3 Feb 2013 01:08:01 GMT (envelope-from kientzle@svn.freebsd.org) Received: (from kientzle@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r131818W070189; Sun, 3 Feb 2013 01:08:01 GMT (envelope-from kientzle@svn.freebsd.org) Message-Id: <201302030108.r131818W070189@svn.freebsd.org> From: Tim Kientzle Date: Sun, 3 Feb 2013 01:08:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r246276 - head/sys/arm/ti/cpsw X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 03 Feb 2013 01:08:02 -0000 Author: kientzle Date: Sun Feb 3 01:08:01 2013 New Revision: 246276 URL: http://svnweb.freebsd.org/changeset/base/246276 Log: Another overhaul of the CPSW driver for BeagleBone Major changes: * Finally tracked down the flow control setting that seems to have been causing TX stalls and watchdog timeouts * RX and TX paths now share a lot more code * TX interrupt is no longer used; we instead GC finished tx queue entries at the bottom of the start routine. * TX start now queues fragmented packets directly; it only invokes defrag() for occasional very fragmented packets. * "sysctl dev.cpsw" dumps controller statistics and queue counts * Host Error Interrupt will give extensive debugging information if the controller chokes on the queued data. Modified: head/sys/arm/ti/cpsw/if_cpsw.c head/sys/arm/ti/cpsw/if_cpswreg.h head/sys/arm/ti/cpsw/if_cpswvar.h Modified: head/sys/arm/ti/cpsw/if_cpsw.c ============================================================================== --- head/sys/arm/ti/cpsw/if_cpsw.c Sun Feb 3 00:19:34 2013 (r246275) +++ head/sys/arm/ti/cpsw/if_cpsw.c Sun Feb 3 01:08:01 2013 (r246276) @@ -25,8 +25,22 @@ */ /* - * TI 3 Port Switch Ethernet (CPSW) Driver - * Found in TI8148, AM335x SoCs + * TI Common Platform Ethernet Switch (CPSW) Driver + * Found in TI8148 "DaVinci" and AM335x "Sitara" SoCs. + * + * This controller is documented in the AM335x Technical Reference + * Manual, in the TMS320DM814x DaVinci Digital Video Processors TRM + * and in the TMS320C6452 3 Port Switch Ethernet Subsystem TRM. + * + * It is basically a single Ethernet port (port 0) wired internally to + * a 3-port store-and-forward switch connected to two independent + * "sliver" controllers (port 1 and port 2). You can operate the + * controller in a variety of different ways by suitably configuring + * the slivers and the Address Lookup Engine (ALE) that routes packets + * between the ports. + * + * This code was developed and tested on a BeagleBone with + * an AM335x SoC. */ #include @@ -76,44 +90,82 @@ __FBSDID("$FreeBSD$"); #include "miibus_if.h" -static int cpsw_probe(device_t dev); -static int cpsw_attach(device_t dev); -static int cpsw_detach(device_t dev); -static int cpsw_shutdown(device_t dev); -static int cpsw_suspend(device_t dev); -static int cpsw_resume(device_t dev); - -static int cpsw_miibus_readreg(device_t dev, int phy, int reg); -static int cpsw_miibus_writereg(device_t dev, int phy, int reg, int value); - -static int cpsw_ifmedia_upd(struct ifnet *ifp); -static void cpsw_ifmedia_sts(struct ifnet *ifp, struct ifmediareq *ifmr); - -static void cpsw_init(void *arg); -static void cpsw_init_locked(void *arg); -static void cpsw_start(struct ifnet *ifp); -static void cpsw_start_locked(struct ifnet *ifp); -static void cpsw_stop_locked(struct cpsw_softc *sc); -static int cpsw_ioctl(struct ifnet *ifp, u_long command, caddr_t data); -static int cpsw_init_slot_lists(struct cpsw_softc *sc); -static void cpsw_free_slot(struct cpsw_softc *sc, struct cpsw_slot *slot); -static void cpsw_fill_rx_queue_locked(struct cpsw_softc *sc); -static void cpsw_tx_watchdog(struct cpsw_softc *sc); +/* Device probe/attach/detach. */ +static int cpsw_probe(device_t); +static void cpsw_init_slots(struct cpsw_softc *); +static int cpsw_attach(device_t); +static void cpsw_free_slot(struct cpsw_softc *, struct cpsw_slot *); +static int cpsw_detach(device_t); + +/* Device Init/shutdown. */ +static void cpsw_init(void *); +static void cpsw_init_locked(void *); +static int cpsw_shutdown(device_t); +static void cpsw_shutdown_locked(struct cpsw_softc *); + +/* Device Suspend/Resume. */ +static int cpsw_suspend(device_t); +static int cpsw_resume(device_t); -static void cpsw_intr_rx_thresh(void *arg); +/* Ioctl. */ +static int cpsw_ioctl(struct ifnet *, u_long command, caddr_t data); + +static int cpsw_miibus_readreg(device_t, int phy, int reg); +static int cpsw_miibus_writereg(device_t, int phy, int reg, int value); + +/* Send/Receive packets. */ static void cpsw_intr_rx(void *arg); -static void cpsw_intr_rx_locked(void *arg); -static void cpsw_intr_tx(void *arg); -static void cpsw_intr_tx_locked(void *arg); -static void cpsw_intr_misc(void *arg); - -static void cpsw_ale_read_entry(struct cpsw_softc *sc, uint16_t idx, uint32_t *ale_entry); -static void cpsw_ale_write_entry(struct cpsw_softc *sc, uint16_t idx, uint32_t *ale_entry); -static int cpsw_ale_uc_entry_set(struct cpsw_softc *sc, uint8_t port, uint8_t *mac); -static int cpsw_ale_mc_entry_set(struct cpsw_softc *sc, uint8_t portmap, uint8_t *mac); -#ifdef CPSW_DEBUG -static void cpsw_ale_dump_table(struct cpsw_softc *sc); -#endif +static struct mbuf *cpsw_rx_dequeue(struct cpsw_softc *); +static void cpsw_rx_enqueue(struct cpsw_softc *); +static void cpsw_start(struct ifnet *); +static void cpsw_tx_enqueue(struct cpsw_softc *); +static int cpsw_tx_dequeue(struct cpsw_softc *); + +/* Misc interrupts and watchdog. */ +static void cpsw_intr_rx_thresh(void *); +static void cpsw_intr_misc(void *); +static void cpsw_tick(void *); +static void cpsw_ifmedia_sts(struct ifnet *, struct ifmediareq *); +static int cpsw_ifmedia_upd(struct ifnet *); +static void cpsw_tx_watchdog(struct cpsw_softc *); + +/* ALE support */ +static void cpsw_ale_read_entry(struct cpsw_softc *, uint16_t idx, uint32_t *ale_entry); +static void cpsw_ale_write_entry(struct cpsw_softc *, uint16_t idx, uint32_t *ale_entry); +static int cpsw_ale_mc_entry_set(struct cpsw_softc *, uint8_t portmap, uint8_t *mac); +static int cpsw_ale_update_addresses(struct cpsw_softc *, int purge); +static void cpsw_ale_dump_table(struct cpsw_softc *); + +/* Statistics and sysctls. */ +static void cpsw_add_sysctls(struct cpsw_softc *); +static void cpsw_stats_collect(struct cpsw_softc *); +static int cpsw_stats_sysctl(SYSCTL_HANDLER_ARGS); + +/* + * Arbitrary limit on number of segments in an mbuf to be transmitted. + * Packets with more segments than this will be defragmented before + * they are queued. + */ +#define CPSW_TXFRAGS 8 + + +/* + * TODO: The CPSW subsystem (CPSW_SS) can drive two independent PHYs + * as separate Ethernet ports. To properly support this, we should + * break this into two separate devices: a CPSW_SS device that owns + * the interrupts and actually talks to the CPSW hardware, and a + * separate CPSW Ethernet child device for each Ethernet port. The RX + * interrupt, for example, would be part of CPSW_SS; it would receive + * a packet, note the input port, and then dispatch it to the child + * device's interface queue. Similarly for transmit. + * + * It's not clear to me whether the device tree should be restructured + * with a cpsw_ss node and two child nodes. That would allow specifying + * MAC addresses for each port, for example, but might be overkill. + * + * Unfortunately, I don't have hardware right now that supports two + * Ethernet ports via CPSW. + */ static device_method_t cpsw_methods[] = { /* Device interface */ @@ -137,7 +189,6 @@ static driver_t cpsw_driver = { static devclass_t cpsw_devclass; - DRIVER_MODULE(cpsw, simplebus, cpsw_driver, cpsw_devclass, 0, 0); DRIVER_MODULE(miibus, cpsw, miibus_driver, miibus_devclass, 0, 0); MODULE_DEPEND(cpsw, ether, 1, 1, 1); @@ -152,40 +203,109 @@ static struct resource_spec res_spec[] = { -1, 0 } }; -static struct { - driver_intr_t *handler; - char * description; -} cpsw_intrs[CPSW_INTR_COUNT + 1] = { - { cpsw_intr_rx_thresh, "CPSW RX threshold interrupt" }, - { cpsw_intr_rx, "CPSW RX interrupt" }, - { cpsw_intr_tx, "CPSW TX interrupt" }, - { cpsw_intr_misc, "CPSW misc interrupt" }, +/* Number of entries here must match size of stats + * array in struct cpsw_softc. */ +static struct cpsw_stat { + int reg; + char *oid; +} cpsw_stat_sysctls[CPSW_SYSCTL_COUNT] = { + {0x00, "GoodRxFrames"}, + {0x04, "BroadcastRxFrames"}, + {0x08, "MulticastRxFrames"}, + {0x0C, "PauseRxFrames"}, + {0x10, "RxCrcErrors"}, + {0x14, "RxAlignErrors"}, + {0x18, "OversizeRxFrames"}, + {0x1c, "RxJabbers"}, + {0x20, "ShortRxFrames"}, + {0x24, "RxFragments"}, + {0x30, "RxOctets"}, + {0x34, "GoodTxFrames"}, + {0x38, "BroadcastTxFrames"}, + {0x3c, "MulticastTxFrames"}, + {0x40, "PauseTxFrames"}, + {0x44, "DeferredTxFrames"}, + {0x48, "CollisionsTxFrames"}, + {0x4c, "SingleCollisionTxFrames"}, + {0x50, "MultipleCollisionTxFrames"}, + {0x54, "ExcessiveCollisions"}, + {0x58, "LateCollisions"}, + {0x5c, "TxUnderrun"}, + {0x60, "CarrierSenseErrors"}, + {0x64, "TxOctets"}, + {0x68, "RxTx64OctetFrames"}, + {0x6c, "RxTx65to127OctetFrames"}, + {0x70, "RxTx128to255OctetFrames"}, + {0x74, "RxTx256to511OctetFrames"}, + {0x78, "RxTx512to1024OctetFrames"}, + {0x7c, "RxTx1024upOctetFrames"}, + {0x80, "NetOctets"}, + {0x84, "RxStartOfFrameOverruns"}, + {0x88, "RxMiddleOfFrameOverruns"}, + {0x8c, "RxDmaOverruns"} }; -/* Locking macros */ +/* + * Basic debug support. + */ + +#define IF_DEBUG(sc) if (sc->cpsw_if_flags & IFF_DEBUG) + +static void +cpsw_debugf_head(const char *funcname) +{ + int t = (int)(time_second % (24 * 60 * 60)); + + printf("%02d:%02d:%02d %s ", t / (60 * 60), (t / 60) % 60, t % 60, funcname); +} + +#include +static void +cpsw_debugf(const char *fmt, ...) +{ + va_list ap; + + va_start(ap, fmt); + vprintf(fmt, ap); + va_end(ap); + printf("\n"); + +} + +#define CPSW_DEBUGF(a) do { \ + IF_DEBUG(sc) { \ + cpsw_debugf_head(__func__); \ + cpsw_debugf a; \ + } \ +} while (0) + + +/* + * Locking macros + */ #define CPSW_TX_LOCK(sc) do { \ - mtx_assert(&(sc)->rx_lock, MA_NOTOWNED); \ - mtx_lock(&(sc)->tx_lock); \ + mtx_assert(&(sc)->rx.lock, MA_NOTOWNED); \ + mtx_lock(&(sc)->tx.lock); \ } while (0) -#define CPSW_TX_UNLOCK(sc) mtx_unlock(&(sc)->tx_lock) -#define CPSW_TX_LOCK_ASSERT(sc) mtx_assert(&(sc)->tx_lock, MA_OWNED) +#define CPSW_TX_UNLOCK(sc) mtx_unlock(&(sc)->tx.lock) +#define CPSW_TX_LOCK_ASSERT(sc) mtx_assert(&(sc)->tx.lock, MA_OWNED) #define CPSW_RX_LOCK(sc) do { \ - mtx_assert(&(sc)->tx_lock, MA_NOTOWNED); \ - mtx_lock(&(sc)->rx_lock); \ + mtx_assert(&(sc)->tx.lock, MA_NOTOWNED); \ + mtx_lock(&(sc)->rx.lock); \ } while (0) -#define CPSW_RX_UNLOCK(sc) mtx_unlock(&(sc)->rx_lock) -#define CPSW_RX_LOCK_ASSERT(sc) mtx_assert(&(sc)->rx_lock, MA_OWNED) +#define CPSW_RX_UNLOCK(sc) mtx_unlock(&(sc)->rx.lock) +#define CPSW_RX_LOCK_ASSERT(sc) mtx_assert(&(sc)->rx.lock, MA_OWNED) #define CPSW_GLOBAL_LOCK(sc) do { \ - if ((mtx_owned(&(sc)->tx_lock) ? 1 : 0) != \ - (mtx_owned(&(sc)->rx_lock) ? 1 : 0)) { \ + if ((mtx_owned(&(sc)->tx.lock) ? 1 : 0) != \ + (mtx_owned(&(sc)->rx.lock) ? 1 : 0)) { \ panic("cpsw deadlock possibility detection!"); \ } \ - mtx_lock(&(sc)->tx_lock); \ - mtx_lock(&(sc)->rx_lock); \ + mtx_lock(&(sc)->tx.lock); \ + mtx_lock(&(sc)->rx.lock); \ } while (0) #define CPSW_GLOBAL_UNLOCK(sc) do { \ @@ -198,35 +318,128 @@ static struct { CPSW_RX_LOCK_ASSERT(sc); \ } while (0) +/* + * Read/Write macros + */ +#define cpsw_read_4(sc, reg) bus_read_4(sc->res[0], reg) +#define cpsw_write_4(sc, reg, val) bus_write_4(sc->res[0], reg, val) -#include -static void -cpsw_debugf_head(const char *funcname) -{ - int t = (int)(time_second % (24 * 60 * 60)); +#define cpsw_cpdma_bd_offset(i) (CPSW_CPPI_RAM_OFFSET + ((i)*16)) - printf("%02d:%02d:%02d %s ", t / (60 * 60), (t / 60) % 60, t % 60, funcname); +#define cpsw_cpdma_bd_paddr(sc, slot) \ + (slot->bd_offset + vtophys(rman_get_start(sc->res[0]))) +#define cpsw_cpdma_read_bd(sc, slot, val) \ + bus_read_region_4(sc->res[0], slot->bd_offset, (uint32_t *) val, 4) +#define cpsw_cpdma_write_bd(sc, slot, val) \ + bus_write_region_4(sc->res[0], slot->bd_offset, (uint32_t *) val, 4) +#define cpsw_cpdma_write_bd_next(sc, slot, next_slot) \ + cpsw_write_4(sc, slot->bd_offset, cpsw_cpdma_bd_paddr(sc, next_slot)) +#define cpsw_cpdma_read_bd_flags(sc, slot) \ + bus_read_2(sc->res[0], slot->bd_offset + 14) +#define cpsw_write_hdp_slot(sc, queue, slot) \ + cpsw_write_4(sc, (queue)->hdp_offset, cpsw_cpdma_bd_paddr(sc, slot)) +#define CP_OFFSET (CPSW_CPDMA_TX_CP(0) - CPSW_CPDMA_TX_HDP(0)) +#define cpsw_read_cp(sc, queue) \ + cpsw_read_4(sc, (queue)->hdp_offset + CP_OFFSET) +#define cpsw_write_cp(sc, queue, val) \ + cpsw_write_4(sc, (queue)->hdp_offset + CP_OFFSET, (val)) +#define cpsw_write_cp_slot(sc, queue, slot) \ + cpsw_write_cp(sc, queue, cpsw_cpdma_bd_paddr(sc, slot)) + +#if 0 +/* XXX temporary function versions for debugging. */ +static void +cpsw_write_hdp_slotX(struct cpsw_softc *sc, struct cpsw_queue *queue, struct cpsw_slot *slot) +{ + uint32_t reg = queue->hdp_offset; + uint32_t v = cpsw_cpdma_bd_paddr(sc, slot); + CPSW_DEBUGF(("HDP <=== 0x%08x (was 0x%08x)", v, cpsw_read_4(sc, reg))); + cpsw_write_4(sc, reg, v); } static void -cpsw_debugf(const char *fmt, ...) +cpsw_write_cp_slotX(struct cpsw_softc *sc, struct cpsw_queue *queue, struct cpsw_slot *slot) +{ + uint32_t v = cpsw_cpdma_bd_paddr(sc, slot); + CPSW_DEBUGF(("CP <=== 0x%08x (expecting 0x%08x)", v, cpsw_read_cp(sc, queue))); + cpsw_write_cp(sc, queue, v); +} +#endif + +/* + * Expanded dump routines for verbose debugging. + */ +static void +cpsw_dump_slot(struct cpsw_softc *sc, struct cpsw_slot *slot) { - va_list ap; + static const char *flags[] = {"SOP", "EOP", "Owner", "EOQ", + "TDownCmplt", "PassCRC", "Long", "Short", "MacCtl", "Overrun", + "PktErr1", "PortEn/PktErr0", "RxVlanEncap", "Port2", "Port1", + "Port0"}; + struct cpsw_cpdma_bd bd; + const char *sep; + int i; - va_start(ap, fmt); - vprintf(fmt, ap); - va_end(ap); + cpsw_cpdma_read_bd(sc, slot, &bd); + printf("BD Addr: 0x%08x Next: 0x%08x\n", cpsw_cpdma_bd_paddr(sc, slot), bd.next); + printf(" BufPtr: 0x%08x BufLen: 0x%08x\n", bd.bufptr, bd.buflen); + printf(" BufOff: 0x%08x PktLen: 0x%08x\n", bd.bufoff, bd.pktlen); + printf(" Flags: "); + sep = ""; + for (i = 0; i < 16; ++i) { + if (bd.flags & (1 << (15 - i))) { + printf("%s%s", sep, flags[i]); + sep = ","; + } + } printf("\n"); + if (slot->mbuf) { + printf(" Ether: %14D\n", + (char *)(slot->mbuf->m_hdr.mh_data), " "); + printf(" Packet: %16D\n", + (char *)(slot->mbuf->m_hdr.mh_data) + 14, " "); + } +} + +#define CPSW_DUMP_SLOT(cs, slot) do { \ + IF_DEBUG(sc) { \ + cpsw_dump_slot(sc, slot); \ + } \ +} while (0) + +static void +cpsw_dump_queue(struct cpsw_softc *sc, struct cpsw_slots *q) +{ + struct cpsw_slot *slot; + int i = 0; + int others = 0; + + STAILQ_FOREACH(slot, q, next) { + if (i > 4) + ++others; + else + cpsw_dump_slot(sc, slot); + ++i; + } + if (others) + printf(" ... and %d more.\n", others); + printf("\n"); } -#define CPSW_DEBUGF(a) do { \ - if (sc->cpsw_if_flags & IFF_DEBUG) { \ - cpsw_debugf_head(__func__); \ - cpsw_debugf a; \ - } \ +#define CPSW_DUMP_QUEUE(sc, q) do { \ + IF_DEBUG(sc) { \ + cpsw_dump_queue(sc, q); \ + } \ } while (0) + +/* + * + * Device Probe, Attach, Detach. + * + */ + static int cpsw_probe(device_t dev) { @@ -238,18 +451,107 @@ cpsw_probe(device_t dev) return (BUS_PROBE_DEFAULT); } + +static void +cpsw_init_slots(struct cpsw_softc *sc) +{ + struct cpsw_slot *slot; + int i; + + STAILQ_INIT(&sc->avail); + + /* Put the slot descriptors onto the global avail list. */ + for (i = 0; i < sizeof(sc->_slots) / sizeof(sc->_slots[0]); i++) { + slot = &sc->_slots[i]; + slot->bd_offset = cpsw_cpdma_bd_offset(i); + STAILQ_INSERT_TAIL(&sc->avail, slot, next); + } +} + +/* + * bind an interrupt, add the relevant info to sc->interrupts + */ +static int +cpsw_attach_interrupt(struct cpsw_softc *sc, struct resource *res, driver_intr_t *handler, const char *description) +{ + void **pcookie; + int error; + + sc->interrupts[sc->interrupt_count].res = res; + sc->interrupts[sc->interrupt_count].description = description; + pcookie = &sc->interrupts[sc->interrupt_count].ih_cookie; + + error = bus_setup_intr(sc->dev, res, INTR_TYPE_NET | INTR_MPSAFE, + NULL, *handler, sc, pcookie); + if (error) + device_printf(sc->dev, + "could not setup %s\n", description); + else + ++sc->interrupt_count; + return (error); +} + +/* + * teardown everything in sc->interrupts. + */ +static void +cpsw_detach_interrupts(struct cpsw_softc *sc) +{ + int error; + int i; + + for (i = 0; i < sizeof(sc->interrupts) / sizeof(sc->interrupts[0]); ++i) { + if (!sc->interrupts[i].ih_cookie) + continue; + error = bus_teardown_intr(sc->dev, + sc->interrupts[i].res, sc->interrupts[i].ih_cookie); + if (error) + device_printf(sc->dev, "could not release %s\n", + sc->interrupts[i].description); + sc->interrupts[i].ih_cookie = NULL; + } +} + +static int +cpsw_add_slots(struct cpsw_softc *sc, struct cpsw_queue *queue, int requested) +{ + const int max_slots = sizeof(sc->_slots) / sizeof(sc->_slots[0]); + struct cpsw_slot *slot; + int i; + + if (requested < 0) + requested = max_slots; + + for (i = 0; i < requested; ++i) { + slot = STAILQ_FIRST(&sc->avail); + if (slot == NULL) + return (0); + if (bus_dmamap_create(sc->mbuf_dtag, 0, &slot->dmamap)) { + if_printf(sc->ifp, "failed to create dmamap\n"); + return (ENOMEM); + } + STAILQ_REMOVE_HEAD(&sc->avail, next); + STAILQ_INSERT_TAIL(&queue->avail, slot, next); + ++queue->avail_queue_len; + ++queue->queue_slots; + } + return (0); +} + static int cpsw_attach(device_t dev) { + bus_dma_segment_t segs[1]; struct cpsw_softc *sc = device_get_softc(dev); struct mii_softc *miisc; struct ifnet *ifp; void *phy_sc; - int i, error, phy; + int error, phy, nsegs; uint32_t reg; CPSW_DEBUGF(("")); + getbinuptime(&sc->attach_uptime); sc->dev = dev; sc->node = ofw_bus_get_node(dev); @@ -259,10 +561,10 @@ cpsw_attach(device_t dev) return (ENXIO); } /* Initialize mutexes */ - mtx_init(&sc->tx_lock, device_get_nameunit(dev), - "cpsw TX lock", MTX_DEF); - mtx_init(&sc->rx_lock, device_get_nameunit(dev), - "cpsw RX lock", MTX_DEF); + mtx_init(&sc->tx.lock, device_get_nameunit(dev), + "cpsw TX lock", MTX_DEF); + mtx_init(&sc->rx.lock, device_get_nameunit(dev), + "cpsw RX lock", MTX_DEF); /* Allocate IO and IRQ resources */ error = bus_alloc_resources(dev, res_spec, sc->res); @@ -272,11 +574,11 @@ cpsw_attach(device_t dev) return (ENXIO); } - reg = cpsw_read_4(CPSW_SS_IDVER); - device_printf(dev, "Version %d.%d (%d)\n", (reg >> 8 & 0x7), + reg = cpsw_read_4(sc, CPSW_SS_IDVER); + device_printf(dev, "CPSW SS Version %d.%d (%d)\n", (reg >> 8 & 0x7), reg & 0xFF, (reg >> 11) & 0x1F); - //cpsw_add_sysctls(sc); TODO + cpsw_add_sysctls(sc); /* Allocate a busdma tag and DMA safe memory for mbufs. */ error = bus_dma_tag_create( @@ -285,22 +587,14 @@ cpsw_attach(device_t dev) BUS_SPACE_MAXADDR_32BIT, /* lowaddr */ BUS_SPACE_MAXADDR, /* highaddr */ NULL, NULL, /* filtfunc, filtfuncarg */ - MCLBYTES, 1, /* maxsize, nsegments */ + MCLBYTES, CPSW_TXFRAGS, /* maxsize, nsegments */ MCLBYTES, 0, /* maxsegsz, flags */ NULL, NULL, /* lockfunc, lockfuncarg */ &sc->mbuf_dtag); /* dmatag */ if (error) { device_printf(dev, "bus_dma_tag_create failed\n"); cpsw_detach(dev); - return (ENOMEM); - } - - /* Initialize the tx_avail and rx_avail lists. */ - error = cpsw_init_slot_lists(sc); - if (error) { - device_printf(dev, "failed to allocate dmamaps\n"); - cpsw_detach(dev); - return (ENOMEM); + return (error); } /* Allocate network interface */ @@ -311,6 +605,16 @@ cpsw_attach(device_t dev) return (ENOMEM); } + /* Allocate the null mbuf and pre-sync it. */ + sc->null_mbuf = m_getcl(M_NOWAIT, MT_DATA, M_PKTHDR); + memset(sc->null_mbuf->m_hdr.mh_data, 0, sc->null_mbuf->m_ext.ext_size); + bus_dmamap_create(sc->mbuf_dtag, 0, &sc->null_mbuf_dmamap); + bus_dmamap_load_mbuf_sg(sc->mbuf_dtag, sc->null_mbuf_dmamap, + sc->null_mbuf, segs, &nsegs, BUS_DMA_NOWAIT); + bus_dmamap_sync(sc->mbuf_dtag, sc->null_mbuf_dmamap, + BUS_DMASYNC_PREWRITE); + sc->null_mbuf_paddr = segs[0].ds_addr; + if_initname(ifp, device_get_name(dev), device_get_unit(dev)); ifp->if_softc = sc; ifp->if_flags = IFF_SIMPLEX | IFF_MULTICAST | IFF_BROADCAST; @@ -321,11 +625,32 @@ cpsw_attach(device_t dev) ifp->if_start = cpsw_start; ifp->if_ioctl = cpsw_ioctl; - ifp->if_snd.ifq_drv_maxlen = CPSW_MAX_TX_BUFFERS - 1; + cpsw_init_slots(sc); + + /* Allocate slots to TX and RX queues. */ + STAILQ_INIT(&sc->rx.avail); + STAILQ_INIT(&sc->rx.active); + STAILQ_INIT(&sc->tx.avail); + STAILQ_INIT(&sc->tx.active); + // For now: 128 slots to TX, rest to RX. + // XXX TODO: start with 32/64 and grow dynamically based on demand. + if (cpsw_add_slots(sc, &sc->tx, 128) || cpsw_add_slots(sc, &sc->rx, -1)) { + device_printf(dev, "failed to allocate dmamaps\n"); + cpsw_detach(dev); + return (ENOMEM); + } + device_printf(dev, "Initial queue size TX=%d RX=%d\n", + sc->tx.queue_slots, sc->rx.queue_slots); + + ifp->if_snd.ifq_drv_maxlen = sc->tx.queue_slots; IFQ_SET_MAXLEN(&ifp->if_snd, ifp->if_snd.ifq_drv_maxlen); IFQ_SET_READY(&ifp->if_snd); + sc->tx.hdp_offset = CPSW_CPDMA_TX_HDP(0); + sc->rx.hdp_offset = CPSW_CPDMA_RX_HDP(0); + /* Get high part of MAC address from control module (mac_id0_hi) */ + /* TODO: Get MAC ID1 as well as MAC ID0. */ ti_scm_reg_read_4(0x634, ®); sc->mac_addr[0] = reg & 0xFF; sc->mac_addr[1] = (reg >> 8) & 0xFF; @@ -338,11 +663,14 @@ cpsw_attach(device_t dev) sc->mac_addr[5] = (reg >> 8) & 0xFF; ether_ifattach(ifp, sc->mac_addr); - callout_init(&sc->wd_callout, 0); + callout_init(&sc->watchdog.callout, 0); /* Initialze MDIO - ENABLE, PREAMBLE=0, FAULTENB, CLKDIV=0xFF */ /* TODO Calculate MDCLK=CLK/(CLKDIV+1) */ - cpsw_write_4(MDIOCONTROL, 1 << 30 | 1 << 18 | 0xFF); + cpsw_write_4(sc, MDIOCONTROL, 1 << 30 | 1 << 18 | 0xFF); + + /* Clear ALE */ + cpsw_write_4(sc, CPSW_ALE_CONTROL, 1 << 30); /* Attach PHY(s) */ error = mii_attach(dev, &sc->miibus, ifp, cpsw_ifmedia_upd, @@ -358,25 +686,38 @@ cpsw_attach(device_t dev) miisc = LIST_FIRST(&sc->mii->mii_phys); /* Select PHY and enable interrupts */ - cpsw_write_4(MDIOUSERPHYSEL0, 1 << 6 | (miisc->mii_phy & 0x1F)); - - /* Attach interrupt handlers */ - for (i = 1; i <= CPSW_INTR_COUNT; ++i) { - error = bus_setup_intr(dev, sc->res[i], - INTR_TYPE_NET | INTR_MPSAFE, - NULL, *cpsw_intrs[i - 1].handler, - sc, &sc->ih_cookie[i - 1]); - if (error) { - device_printf(dev, "could not setup %s\n", - cpsw_intrs[i].description); - cpsw_detach(dev); - return (error); - } + cpsw_write_4(sc, MDIOUSERPHYSEL0, 1 << 6 | (miisc->mii_phy & 0x1F)); + + /* Note: We don't use sc->res[3] (TX interrupt) */ + if (cpsw_attach_interrupt(sc, sc->res[1], + cpsw_intr_rx_thresh, "CPSW RX threshold interrupt") || + cpsw_attach_interrupt(sc, sc->res[2], + cpsw_intr_rx, "CPSW RX interrupt") || + cpsw_attach_interrupt(sc, sc->res[4], + cpsw_intr_misc, "CPSW misc interrupt")) { + cpsw_detach(dev); + return (ENXIO); } return (0); } +static void +cpsw_free_slot(struct cpsw_softc *sc, struct cpsw_slot *slot) +{ + int error; + + if (slot->dmamap) { + error = bus_dmamap_destroy(sc->mbuf_dtag, slot->dmamap); + KASSERT(error == 0, ("Mapping still active")); + slot->dmamap = NULL; + } + if (slot->mbuf) { + m_freem(slot->mbuf); + slot->mbuf = NULL; + } +} + static int cpsw_detach(device_t dev) { @@ -389,31 +730,20 @@ cpsw_detach(device_t dev) if (device_is_attached(dev)) { ether_ifdetach(sc->ifp); CPSW_GLOBAL_LOCK(sc); - cpsw_stop_locked(sc); + cpsw_shutdown_locked(sc); CPSW_GLOBAL_UNLOCK(sc); - callout_drain(&sc->wd_callout); + callout_drain(&sc->watchdog.callout); } bus_generic_detach(dev); device_delete_child(dev, sc->miibus); /* Stop and release all interrupts */ - for (i = 0; i < CPSW_INTR_COUNT; ++i) { - if (!sc->ih_cookie[i]) - continue; - - error = bus_teardown_intr(dev, sc->res[1 + i], sc->ih_cookie[i]); - if (error) - device_printf(dev, "could not release %s\n", - cpsw_intrs[i + 1].description); - } + cpsw_detach_interrupts(sc); /* Free dmamaps and mbufs */ - for (i = 0; i < CPSW_MAX_TX_BUFFERS; i++) { - cpsw_free_slot(sc, &sc->_tx_slots[i]); - } - for (i = 0; i < CPSW_MAX_RX_BUFFERS; i++) { - cpsw_free_slot(sc, &sc->_rx_slots[i]); + for (i = 0; i < sizeof(sc->_slots) / sizeof(sc->_slots[0]); ++i) { + cpsw_free_slot(sc, &sc->_slots[i]); } /* Free DMA tag */ @@ -424,30 +754,181 @@ cpsw_detach(device_t dev) bus_release_resources(dev, res_spec, sc->res); /* Destroy mutexes */ - mtx_destroy(&sc->rx_lock); - mtx_destroy(&sc->tx_lock); + mtx_destroy(&sc->rx.lock); + mtx_destroy(&sc->tx.lock); return (0); } -static int -cpsw_suspend(device_t dev) +/* + * + * Init/Shutdown. + * + */ + +static void +cpsw_reset(struct cpsw_softc *sc) { - struct cpsw_softc *sc = device_get_softc(dev); + int i; + + /* Reset RMII/RGMII wrapper. */ + cpsw_write_4(sc, CPSW_WR_SOFT_RESET, 1); + while (cpsw_read_4(sc, CPSW_WR_SOFT_RESET) & 1) + ; + + /* Disable TX and RX interrupts for all cores. */ + for (i = 0; i < 3; ++i) { + cpsw_write_4(sc, CPSW_WR_C_RX_THRESH_EN(i), 0x00); + cpsw_write_4(sc, CPSW_WR_C_TX_EN(i), 0x00); + cpsw_write_4(sc, CPSW_WR_C_RX_EN(i), 0x00); + cpsw_write_4(sc, CPSW_WR_C_MISC_EN(i), 0x00); + } + + /* Reset CPSW subsystem. */ + cpsw_write_4(sc, CPSW_SS_SOFT_RESET, 1); + while (cpsw_read_4(sc, CPSW_SS_SOFT_RESET) & 1) + ; + + /* Reset Sliver port 1 and 2 */ + for (i = 0; i < 2; i++) { + /* Reset */ + cpsw_write_4(sc, CPSW_SL_SOFT_RESET(i), 1); + while (cpsw_read_4(sc, CPSW_SL_SOFT_RESET(i)) & 1) + ; + } + + /* Reset DMA controller. */ + cpsw_write_4(sc, CPSW_CPDMA_SOFT_RESET, 1); + while (cpsw_read_4(sc, CPSW_CPDMA_SOFT_RESET) & 1) + ; + + /* Disable TX & RX DMA */ + cpsw_write_4(sc, CPSW_CPDMA_TX_CONTROL, 0); + cpsw_write_4(sc, CPSW_CPDMA_RX_CONTROL, 0); + + /* Clear all queues. */ + for (i = 0; i < 8; i++) { + cpsw_write_4(sc, CPSW_CPDMA_TX_HDP(i), 0); + cpsw_write_4(sc, CPSW_CPDMA_RX_HDP(i), 0); + cpsw_write_4(sc, CPSW_CPDMA_TX_CP(i), 0); + cpsw_write_4(sc, CPSW_CPDMA_RX_CP(i), 0); + } + + /* Clear all interrupt Masks */ + cpsw_write_4(sc, CPSW_CPDMA_RX_INTMASK_CLEAR, 0xFFFFFFFF); + cpsw_write_4(sc, CPSW_CPDMA_TX_INTMASK_CLEAR, 0xFFFFFFFF); +} + +static void +cpsw_init(void *arg) +{ + struct cpsw_softc *sc = arg; CPSW_DEBUGF(("")); CPSW_GLOBAL_LOCK(sc); - cpsw_stop_locked(sc); + cpsw_init_locked(arg); CPSW_GLOBAL_UNLOCK(sc); - return (0); } -static int -cpsw_resume(device_t dev) +static void +cpsw_init_locked(void *arg) { - /* XXX TODO XXX */ - device_printf(dev, "%s\n", __FUNCTION__); - return (0); + struct ifnet *ifp; + struct cpsw_softc *sc = arg; + struct cpsw_slot *slot; + uint32_t i; + + CPSW_DEBUGF(("")); + ifp = sc->ifp; + if ((ifp->if_drv_flags & IFF_DRV_RUNNING) != 0) + return; + + getbinuptime(&sc->init_uptime); + + /* Reset the controller. */ + cpsw_reset(sc); + + /* Enable ALE */ + cpsw_write_4(sc, CPSW_ALE_CONTROL, 1 << 31 | 1 << 4); + + /* Init Sliver port 1 and 2 */ + for (i = 0; i < 2; i++) { + /* Set Slave Mapping */ + cpsw_write_4(sc, CPSW_SL_RX_PRI_MAP(i), 0x76543210); + cpsw_write_4(sc, CPSW_PORT_P_TX_PRI_MAP(i + 1), 0x33221100); + cpsw_write_4(sc, CPSW_SL_RX_MAXLEN(i), 0x5f2); + /* Set MACCONTROL for ports 0,1: IFCTL_B(16), IFCTL_A(15), + GMII_EN(5), FULLDUPLEX(1) */ + /* TODO: Docs claim that IFCTL_B and IFCTL_A do the same thing? */ + /* Huh? Docs call bit 0 "Loopback" some places, "FullDuplex" others. */ + cpsw_write_4(sc, CPSW_SL_MACCONTROL(i), 1 << 15 | 1 << 5 | 1); + } + + /* Set Host Port Mapping */ + cpsw_write_4(sc, CPSW_PORT_P0_CPDMA_TX_PRI_MAP, 0x76543210); + cpsw_write_4(sc, CPSW_PORT_P0_CPDMA_RX_CH_MAP, 0); + + /* Initialize ALE: all ports set to forwarding(3), initialize addrs */ + for (i = 0; i < 3; i++) + cpsw_write_4(sc, CPSW_ALE_PORTCTL(i), 3); + cpsw_ale_update_addresses(sc, 1); + + cpsw_write_4(sc, CPSW_SS_PTYPE, 0); + + /* Enable statistics for ports 0, 1 and 2 */ + cpsw_write_4(sc, CPSW_SS_STAT_PORT_EN, 7); + + /* Experiment: Turn off flow control */ + /* This seems to fix the watchdog resets that have plagued + earlier versions of this driver; I'm not yet sure if there + are negative effects yet. */ + cpsw_write_4(sc, CPSW_SS_FLOW_CONTROL, 0); + + /* Make IP hdr aligned with 4 */ + cpsw_write_4(sc, CPSW_CPDMA_RX_BUFFER_OFFSET, 2); + + /* Initialize RX Buffer Descriptors */ + cpsw_write_4(sc, CPSW_CPDMA_RX_FREEBUFFER(0), 0); + + /* Enable TX & RX DMA */ + cpsw_write_4(sc, CPSW_CPDMA_TX_CONTROL, 1); + cpsw_write_4(sc, CPSW_CPDMA_RX_CONTROL, 1); + + /* Enable Interrupts for core 0 */ + cpsw_write_4(sc, CPSW_WR_C_RX_THRESH_EN(0), 0xFF); + cpsw_write_4(sc, CPSW_WR_C_RX_EN(0), 0xFF); + cpsw_write_4(sc, CPSW_WR_C_MISC_EN(0), 0x3F); + + /* Enable host Error Interrupt */ + cpsw_write_4(sc, CPSW_CPDMA_DMA_INTMASK_SET, 3); + + /* Enable interrupts for RX Channel 0 */ + cpsw_write_4(sc, CPSW_CPDMA_RX_INTMASK_SET, 1); + + /* Initialze MDIO - ENABLE, PREAMBLE=0, FAULTENB, CLKDIV=0xFF */ + /* TODO Calculate MDCLK=CLK/(CLKDIV+1) */ + cpsw_write_4(sc, MDIOCONTROL, 1 << 30 | 1 << 18 | 0xFF); + + /* Select MII in GMII_SEL, Internal Delay mode */ + //ti_scm_reg_write_4(0x650, 0); + + /* Initialize active queues. */ + slot = STAILQ_FIRST(&sc->tx.active); + if (slot != NULL) + cpsw_write_hdp_slot(sc, &sc->tx, slot); + slot = STAILQ_FIRST(&sc->rx.active); + if (slot != NULL) + cpsw_write_hdp_slot(sc, &sc->rx, slot); + cpsw_rx_enqueue(sc); + + /* Activate network interface */ + sc->rx.running = 1; + sc->tx.running = 1; + sc->watchdog.timer = 0; + callout_reset(&sc->watchdog.callout, hz, cpsw_tick, sc); + sc->ifp->if_drv_flags |= IFF_DRV_RUNNING; + sc->ifp->if_drv_flags &= ~IFF_DRV_OACTIVE; + } static int @@ -457,376 +938,139 @@ cpsw_shutdown(device_t dev) CPSW_DEBUGF(("")); CPSW_GLOBAL_LOCK(sc); - cpsw_stop_locked(sc); + cpsw_shutdown_locked(sc); CPSW_GLOBAL_UNLOCK(sc); return (0); } -static int -cpsw_miibus_ready(struct cpsw_softc *sc) +static void +cpsw_rx_teardown_locked(struct cpsw_softc *sc) { - uint32_t r, retries = CPSW_MIIBUS_RETRIES; - - while (--retries) { - r = cpsw_read_4(MDIOUSERACCESS0); - if ((r & 1 << 31) == 0) - return 1; - DELAY(CPSW_MIIBUS_DELAY); - } - return 0; -} + struct mbuf *received, *next; + int i = 0; -static int -cpsw_miibus_readreg(device_t dev, int phy, int reg) -{ - struct cpsw_softc *sc = device_get_softc(dev); - uint32_t cmd, r; - - if (!cpsw_miibus_ready(sc)) { - device_printf(dev, "MDIO not ready to read\n"); - return 0; - } - - /* Set GO, reg, phy */ - cmd = 1 << 31 | (reg & 0x1F) << 21 | (phy & 0x1F) << 16; - cpsw_write_4(MDIOUSERACCESS0, cmd); - - if (!cpsw_miibus_ready(sc)) { - device_printf(dev, "MDIO timed out during read\n"); - return 0; - } - - r = cpsw_read_4(MDIOUSERACCESS0); - if((r & 1 << 29) == 0) { - device_printf(dev, "Failed to read from PHY.\n"); - r = 0; - } - return (r & 0xFFFF); *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@FreeBSD.ORG Sun Feb 3 01:54:26 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 894D8C1F; Sun, 3 Feb 2013 01:54:26 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 700D0EF2; Sun, 3 Feb 2013 01:54:26 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r131sQfN084128; Sun, 3 Feb 2013 01:54:26 GMT (envelope-from pfg@svn.freebsd.org) Received: (from pfg@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r131sQZm084127; Sun, 3 Feb 2013 01:54:26 GMT (envelope-from pfg@svn.freebsd.org) Message-Id: <201302030154.r131sQZm084127@svn.freebsd.org> From: "Pedro F. Giffuni" Date: Sun, 3 Feb 2013 01:54:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r246278 - head/usr.sbin/crunch/crunchide X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 03 Feb 2013 01:54:26 -0000 Author: pfg Date: Sun Feb 3 01:54:25 2013 New Revision: 246278 URL: http://svnweb.freebsd.org/changeset/base/246278 Log: crunch: Sync some NetBSD changes Fix a couple of free's in previous commit. Obtained from: NetBSD MFC after: 1 week Modified: head/usr.sbin/crunch/crunchide/exec_elf32.c Modified: head/usr.sbin/crunch/crunchide/exec_elf32.c ============================================================================== --- head/usr.sbin/crunch/crunchide/exec_elf32.c Sun Feb 3 01:22:28 2013 (r246277) +++ head/usr.sbin/crunch/crunchide/exec_elf32.c Sun Feb 3 01:54:25 2013 (r246278) @@ -384,6 +384,8 @@ out: if (symtabp != NULL) free(symtabp); if (strtabp != NULL) + free(strtabp); + if (nstrtabp != NULL) free(nstrtabp); return (rv); From owner-svn-src-head@FreeBSD.ORG Sun Feb 3 03:29:36 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 18C0E825 for ; Sun, 3 Feb 2013 03:29:36 +0000 (UTC) (envelope-from lists@eitanadler.com) Received: from mail-lb0-f173.google.com (mail-lb0-f173.google.com [209.85.217.173]) by mx1.freebsd.org (Postfix) with ESMTP id 9991225A for ; Sun, 3 Feb 2013 03:29:34 +0000 (UTC) Received: by mail-lb0-f173.google.com with SMTP id gf7so5749628lbb.18 for ; Sat, 02 Feb 2013 19:29:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=eitanadler.com; s=0xdeadbeef; h=x-received:mime-version:sender:in-reply-to:references:from:date :x-google-sender-auth:message-id:subject:to:cc:content-type; bh=n9ocOUrA+EyX3p8Ze9ZaJwncO7T6XAICwitsgnCLpyg=; b=jkR0ubmP+EHI+GcCeRowvePWfOdgIs6jI5UQ19ZrfMFIqHL594DoemgS++k5YGB+HI Fhf9ODiIGod3r8+tqYbMS7kTqKRZtKmktG82DknQUPAnCFnlEShoHlHSR4QcPlnlLnL/ tyyW1fZX7VJ9xPc6uD7ylW8sMGde5jy6A0n6I= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:mime-version:sender:in-reply-to:references:from:date :x-google-sender-auth:message-id:subject:to:cc:content-type :x-gm-message-state; bh=n9ocOUrA+EyX3p8Ze9ZaJwncO7T6XAICwitsgnCLpyg=; b=IZ7pF/8SCTVnNxWCt5GDrkOgaPdKtlKSDsjE3nsBJFNDPQhdF2kf/a6F7ISx/eEKka ncfreHXMzqoTJDxhVujWYZgfao0aX6p6SdP41J/PlXbJutJiAeEvWeb3YD3J+Ix+cO0W AkIp/X7o01gslw2OJh0HEEqfPjyKy6YQsjylDcUU7TdUP+IpOeAzMHyG/hkUUEDjlo6h bsYg+T0AblhdND8UKg59TEyuBz+Qb/NPldU3+S/u2UkKjSgkwsLjP5nMF8/v8mr4vwni 8fzeFaH2tKjQw+hNrNGLVuvCQQkN4PmvaJGkco8hx6WwhA44Ae30LHXkV/UhKZBSHkb/ Cf/A== X-Received: by 10.152.106.5 with SMTP id gq5mr15502580lab.5.1359862173906; Sat, 02 Feb 2013 19:29:33 -0800 (PST) MIME-Version: 1.0 Sender: lists@eitanadler.com Received: by 10.112.91.164 with HTTP; Sat, 2 Feb 2013 19:29:03 -0800 (PST) In-Reply-To: <201302030154.r131sQZm084127@svn.freebsd.org> References: <201302030154.r131sQZm084127@svn.freebsd.org> From: Eitan Adler Date: Sat, 2 Feb 2013 22:29:03 -0500 X-Google-Sender-Auth: TzUTALMaWWhR5LWiBlfusywj0-A Message-ID: Subject: Re: svn commit: r246278 - head/usr.sbin/crunch/crunchide To: "Pedro F. Giffuni" Content-Type: text/plain; charset=UTF-8 X-Gm-Message-State: ALoCoQk8tsC2uW9v/wL6qUSYWQkPdSdtpuw8P5ML/CqYVIdDzDAB8aRTaNTN1uND1H00eyuruXfN Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 03 Feb 2013 03:29:36 -0000 On 2 February 2013 20:54, Pedro F. Giffuni wrote: > Author: pfg > Date: Sun Feb 3 01:54:25 2013 > New Revision: 246278 > URL: http://svnweb.freebsd.org/changeset/base/246278 > > Log: > crunch: Sync some NetBSD changes > > Fix a couple of free's in previous commit. > > Obtained from: NetBSD > MFC after: 1 week > > Modified: > head/usr.sbin/crunch/crunchide/exec_elf32.c > > Modified: head/usr.sbin/crunch/crunchide/exec_elf32.c > ============================================================================== > --- head/usr.sbin/crunch/crunchide/exec_elf32.c Sun Feb 3 01:22:28 2013 (r246277) > +++ head/usr.sbin/crunch/crunchide/exec_elf32.c Sun Feb 3 01:54:25 2013 (r246278) > @@ -384,6 +384,8 @@ out: > if (symtabp != NULL) > free(symtabp); > if (strtabp != NULL) > + free(strtabp); > + if (nstrtabp != NULL) > free(nstrtabp); Why bother checking for NULL here? 7.22.2.3.2 says that free(NULL) results in no action. -- Eitan Adler Source, Ports, Doc committer Bugmeister, Ports Security teams From owner-svn-src-head@FreeBSD.ORG Sun Feb 3 04:04:54 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 19A7C289 for ; Sun, 3 Feb 2013 04:04:54 +0000 (UTC) (envelope-from giffunip@yahoo.com) Received: from nm5-vm0.bullet.mail.bf1.yahoo.com (nm5-vm0.bullet.mail.bf1.yahoo.com [98.139.213.150]) by mx1.freebsd.org (Postfix) with SMTP id 9277D386 for ; Sun, 3 Feb 2013 04:04:53 +0000 (UTC) Received: from [98.139.212.144] by nm5.bullet.mail.bf1.yahoo.com with NNFMP; 03 Feb 2013 04:04:46 -0000 Received: from [98.139.212.204] by tm1.bullet.mail.bf1.yahoo.com with NNFMP; 03 Feb 2013 04:04:46 -0000 Received: from [127.0.0.1] by omp1013.mail.bf1.yahoo.com with NNFMP; 03 Feb 2013 04:04:46 -0000 X-Yahoo-Newman-Property: ymail-3 X-Yahoo-Newman-Id: 505808.36970.bm@omp1013.mail.bf1.yahoo.com Received: (qmail 801 invoked by uid 60001); 3 Feb 2013 04:04:46 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s1024; t=1359864286; bh=m+znPX9+Zkyx1bUwVH6nXg8mnKtRaLwqpZnWtIVZzpA=; h=X-YMail-OSG:Received:X-Rocket-MIMEInfo:X-RocketYMMF:X-Mailer:References:Message-ID:Date:From:Reply-To:Subject:To:Cc:In-Reply-To:MIME-Version:Content-Type:Content-Transfer-Encoding; b=VC5BuE3QbCWd+QNwSWUSPv6zlR1k2sSlFqJJM5a0eWbQ/7v9D4PGsUccfObb9yUMAxtgAXb178CFd9kyNATN9GFzll6GWxY7JZb+HY7vCmpfX6COmBMvCnkH/wjpJy6jgV0saK/eAqVS5yjHChe9bRKfarAwiZj37CdFdcy8xM0= DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com; h=X-YMail-OSG:Received:X-Rocket-MIMEInfo:X-RocketYMMF:X-Mailer:References:Message-ID:Date:From:Reply-To:Subject:To:Cc:In-Reply-To:MIME-Version:Content-Type:Content-Transfer-Encoding; b=jC0BdP6qjK16CGj3FE7A+ZRmnsK7iDVcXwqBqdRhPoz0d288JAO8Xwa4eY7enW9cBhTMHLXNYI657tlg6rOouiaA058UtD56WNngfHaKG+b3hbuLk0JZKwpXHq9oAKIAvGyFDEBYtg8fTHpB04CGLVpllYy1lKv8cb+dqHtkTsQ=; X-YMail-OSG: 4RUkJdkVM1mPRN5rVFeDa_GgTmWy2azgGuc7YTGs1i72K6. i2eR4VSeIFbo0ObpChx9vb.grVVNgGRYHNUt6Iuk_PPg_W3xbSD3Ie_9nX8E 9wax.1o3Zs4SWRopdmZQpAuMuKCadAReweOM_NK9lMG4QafUe3AwzqA3xlBp uHI8nJMvg7LowrevJc17My08ZyUpIrlS2aP4tElk3zUctGfotU5y3pizMiGF JfccPVH7LneEk9wR5jrG5tcTF7D.3bjLs3.ADznEC_ivQ3PGj3gRBy9Jr.fW 3UiWTJfH0iVOs3fbJan_jHY5SW6bI8obk.L0wN3HUUTId4twR_XGCXKy3RbQ 4db4VNHIDbWvLo1HuBnSo2G7vCpSGLag5eO5P7P36BL7FrXuFFlCPACRaPox wmDtyGDJ8vKRljQIwkfGR_oFwYwsUTyqwl0m0bMNLIgK5P1hEsa_5gqgZ5TF hemllGfWliwji8jWzcmngIa4ZZe9XI1v_3Oq5Bg0FDpK7OVT37S7c378hsm9 rC1zJ_Nmfj5v918mcyg-- Received: from [200.118.157.7] by web162102.mail.bf1.yahoo.com via HTTP; Sat, 02 Feb 2013 20:04:46 PST X-Rocket-MIMEInfo: 001.001, SGkgRWl0YW47CgoKLS0tLS0gTWVzc2FnZ2lvIG9yaWdpbmFsZSAtLS0tLQo.IERhOiBFaXRhbiBBZGxlcsKgCgo.IAo.IE9uIDIgRmVicnVhcnkgMjAxMyAyMDo1NCwgUGVkcm8gRi4gR2lmZnVuaSA8cGZnQGZyZWVic2Qub3JnPiB3cm90ZToKPj4gIEF1dGhvcjogcGZnCj4.ICBEYXRlOiBTdW4gRmViwqAgMyAwMTo1NDoyNSAyMDEzCj4.ICBOZXcgUmV2aXNpb246IDI0NjI3OAo.PiAgVVJMOiBodHRwOi8vc3Zud2ViLmZyZWVic2Qub3JnL2NoYW5nZXNldC9iYXNlLzI0NjI3OAo.PiAKPj4gIExvZzoKPj4gwqABMAEBAQE- X-RocketYMMF: giffunip X-Mailer: YahooMailWebService/0.8.131.499 References: <201302030154.r131sQZm084127@svn.freebsd.org> Message-ID: <1359864286.77306.YahooMailNeo@web162102.mail.bf1.yahoo.com> Date: Sat, 2 Feb 2013 20:04:46 -0800 (PST) From: Pedro Giffuni Subject: Re: svn commit: r246278 - head/usr.sbin/crunch/crunchide To: Eitan Adler In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable Cc: "svn-src-head@freebsd.org" , "svn-src-all@freebsd.org" , "src-committers@freebsd.org" X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list Reply-To: Pedro Giffuni List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 03 Feb 2013 04:04:54 -0000 Hi Eitan;=0A=0A=0A----- Messaggio originale -----=0A> Da: Eitan Adler=A0=0A= =0A> =0A> On 2 February 2013 20:54, Pedro F. Giffuni wrot= e:=0A>> Author: pfg=0A>> Date: Sun Feb=A0 3 01:54:25 2013=0A>> New Revis= ion: 246278=0A>> URL: http://svnweb.freebsd.org/changeset/base/246278=0A>>= =0A>> Log:=0A>> =A0 crunch: Sync some NetBSD changes=0A>> =0A>> =A0 Fix= a couple of free's in previous commit.=0A>> =0A>> =A0 Obtained from:=A0 = =A0 =A0 =A0 NetBSD=0A>> =A0 MFC after:=A0 =A0 1 week=0A>> =0A>> Modified:= =0A>> =A0 head/usr.sbin/crunch/crunchide/exec_elf32.c=0A>> =0A>> Modified= : head/usr.sbin/crunch/crunchide/exec_elf32.c=0A>> =0A> =3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=0A>> --= - head/usr.sbin/crunch/crunchide/exec_elf32.c Sun Feb=A0 3 01:22:28 2013=A0= =A0 =0A> =A0 =A0 (r246277)=0A>> +++ head/usr.sbin/crunch/crunchide/exec_e= lf32.c Sun Feb=A0 3 01:54:25 2013=A0 =A0 =0A> =A0 =A0 (r246278)=0A>> @@ -3= 84,6 +384,8 @@ out:=0A>> =A0 =A0 =A0 =A0 if (symtabp !=3D NULL)=0A>> =A0 = =A0 =A0 =A0 =A0 =A0 =A0 =A0 free(symtabp);=0A>> =A0 =A0 =A0 =A0 if (strta= bp !=3D NULL)=0A>> +=A0 =A0 =A0 =A0 =A0 =A0 =A0 free(strtabp);=0A>> +=A0= =A0 =A0 if (nstrtabp !=3D NULL)=0A>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 fre= e(nstrtabp);=0A> =0A> Why bother checking for NULL here?=A0 7.22.2.3.2 say= s that free(NULL)=0A> results in no action.=0A>=0A=0AYou are right. I was j= ust copying the NetBSD code blindly.=0A=0AI will clean that tomorrow when I= bring the mclinker fixes.=0A=0APedro.=A0=0A From owner-svn-src-head@FreeBSD.ORG Sun Feb 3 06:52:56 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 8CA4917A; Sun, 3 Feb 2013 06:52:56 +0000 (UTC) (envelope-from chagin.dmitry@gmail.com) Received: from mail-la0-x236.google.com (mail-la0-x236.google.com [IPv6:2a00:1450:4010:c03::236]) by mx1.freebsd.org (Postfix) with ESMTP id 745299A6; Sun, 3 Feb 2013 06:52:55 +0000 (UTC) Received: by mail-la0-f54.google.com with SMTP id gw10so3802103lab.27 for ; Sat, 02 Feb 2013 22:52:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:date:from:to:cc:subject:message-id:references :mime-version:content-type:content-disposition:in-reply-to :user-agent; bh=GvgPSKlDJib8ysXNi0iWbVjYdaaJcVU55Z/BQRYj9fI=; b=On7c/yZPlmcD4+HkhyqhUNLBYTDFOkXuZLuflMRWBjlne6dtmDjaBRp6jq652TTd7C T0UYEfds6/bNkvevbKuzV/c3c89Vi3pQOLCGnt5LQLTXgpteu5OoB9Jlj2ejVF/GkBLn g/ssBrfX4m2Iw1bkHU2ZBwo7BccPBDDD0OhUa1P4STwk22/MdqHcCPeQn4tgo0TQg07O lkJEEafad58D+rJxiqvX7oZ34soNzR+vebLAVZufuaY642MISgEpDFGyfEtJYpVIakLR BL+iOXXCOFsL/Xv9VhEtNXsDAyPLKqUyHZ3psTqyIbHZk+g0qCDbnCiH86RUa14W2Vx6 5Asg== X-Received: by 10.152.133.133 with SMTP id pc5mr15605726lab.32.1359874374446; Sat, 02 Feb 2013 22:52:54 -0800 (PST) Received: from dchagin.static.corbina.net (dchagin.static.corbina.ru. [78.107.232.239]) by mx.google.com with ESMTPS id t7sm4127419lbf.12.2013.02.02.22.52.52 (version=TLSv1.2 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sat, 02 Feb 2013 22:52:53 -0800 (PST) Received: from dchagin.static.corbina.net (localhost [127.0.0.1]) by dchagin.static.corbina.net (8.14.6/8.14.6) with ESMTP id r136qpb0001453; Sun, 3 Feb 2013 10:52:51 +0400 (MSK) (envelope-from dchagin@dchagin.static.corbina.net) Received: (from dchagin@localhost) by dchagin.static.corbina.net (8.14.6/8.14.6/Submit) id r136qoOO001452; Sun, 3 Feb 2013 10:52:50 +0400 (MSK) (envelope-from dchagin) Date: Sun, 3 Feb 2013 10:52:50 +0400 From: Chagin Dmitry To: Alexander Leidinger Subject: Re: svn commit: r235063 - in head/sys: amd64/linux32 compat/linux i386/linux Message-ID: <20130203065250.GA1369@dchagin.static.corbina.net> References: <201205051942.q45Jgd3P071990@svn.freebsd.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="C7zPtVaVf+AK4Oqc" Content-Disposition: inline In-Reply-To: <201205051942.q45Jgd3P071990@svn.freebsd.org> User-Agent: Mutt/1.5.21 (2010-09-15) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 03 Feb 2013 06:52:56 -0000 --C7zPtVaVf+AK4Oqc Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sat, May 05, 2012 at 07:42:39PM +0000, Alexander Leidinger wrote: > Author: netchild > Date: Sat May 5 19:42:38 2012 > New Revision: 235063 > URL: http://svn.freebsd.org/changeset/base/235063 >=20 > Log: > - >500 static DTrace probes for the linuxulator > - DTrace scripts to check for errors, performance, ... > they serve mostly as examples of what you can do with the static prob= e;s > with moderate load the scripts may be overwhelmed, excessive lock-tra= cing > may influence program behavior (see the last design decission) > =20 > Design decissions: > - use "linuxulator" as the provider for the native bitsize; add the > bitsize for the non-native emulation (e.g. "linuxuator32" on amd64) > - Add probes only for locks which are acquired in one function and rel= eased > in another function. Locks which are aquired and released in the same > function should be easy to pair in the code, inter-function > locking is more easy to verify in DTrace. > - Probes for locks should be fired after locking and before releasing = to > prevent races (to provide data/function stability in DTrace, see the > man-page of "dtrace -v ..." and the corresponding DTrace docs). Hi, what about to merge this to 9, 8?=20 >=20 --C7zPtVaVf+AK4Oqc Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.19 (FreeBSD) iEYEARECAAYFAlEOCUIACgkQ0t2Tb3OO/O28ogCgpKm1kkRTC87x27sbE15P7qnh ZAkAnjCLc6gDwJXN0lQ+mgK4o/8qA2Ec =VO0u -----END PGP SIGNATURE----- --C7zPtVaVf+AK4Oqc-- From owner-svn-src-head@FreeBSD.ORG Sun Feb 3 09:18:59 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 42278CEA; Sun, 3 Feb 2013 09:18:59 +0000 (UTC) (envelope-from alexander@leidinger.net) Received: from mail.ebusiness-leidinger.de (mail.ebusiness-leidinger.de [217.11.53.44]) by mx1.freebsd.org (Postfix) with ESMTP id 0231DE6C; Sun, 3 Feb 2013 09:18:58 +0000 (UTC) Received: from outgoing.leidinger.net (p57A39717.dip.t-dialin.net [87.163.151.23]) by mail.ebusiness-leidinger.de (Postfix) with ESMTPSA id AC2EF84406A; Sun, 3 Feb 2013 10:18:48 +0100 (CET) Received: from unknown (Titan.Leidinger.net [192.168.1.17]) by outgoing.leidinger.net (Postfix) with ESMTP id 1E72A537E; Sun, 3 Feb 2013 10:18:46 +0100 (CET) Date: Sun, 3 Feb 2013 10:18:44 +0100 From: Alexander Leidinger To: Chagin Dmitry Subject: Re: svn commit: r235063 - in head/sys: amd64/linux32 compat/linux i386/linux Message-ID: <20130203101844.00000ba1@unknown> In-Reply-To: <20130203065250.GA1369@dchagin.static.corbina.net> References: <201205051942.q45Jgd3P071990@svn.freebsd.org> <20130203065250.GA1369@dchagin.static.corbina.net> X-Mailer: Claws Mail 3.9.0cvs12 (GTK+ 2.16.6; i586-pc-mingw32msvc) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-EBL-MailScanner-Information: Please contact the ISP for more information X-EBL-MailScanner-ID: AC2EF84406A.A566C X-EBL-MailScanner: Found to be clean X-EBL-MailScanner-SpamCheck: not spam, spamhaus-ZEN, SpamAssassin (not cached, score=-1.12, required 6, autolearn=disabled, ALL_TRUSTED -1.00, AWL -0.19, TW_SV 0.08, T_RP_MATCHES_RCVD -0.01) X-EBL-MailScanner-From: alexander@leidinger.net X-EBL-MailScanner-Watermark: 1360487929.31937@HjfB2tR+U2EGg/3BbXhaKA X-EBL-Spam-Status: No Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Alexander Leidinger X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 03 Feb 2013 09:18:59 -0000 On Sun, 3 Feb 2013 10:52:50 +0400 Chagin Dmitry wrote: > On Sat, May 05, 2012 at 07:42:39PM +0000, Alexander Leidinger wrote: > > Author: netchild > > Date: Sat May 5 19:42:38 2012 > > New Revision: 235063 > > URL: http://svn.freebsd.org/changeset/base/235063 > > > > Log: > > - >500 static DTrace probes for the linuxulator > Hi, what about to merge this to 9, 8? Theoretically it should be easy to merge, but it depends upon some fixes to the dtrace code to DTRT (no crash) when the dtrace module is unloaded while other dtrace providers like the linuxulator-ones stay in the kernel. I don't know if those fixes are in 9 or 8. Apart from that I'm low on time, my time slots for FreeBSD are already reserved for some other things. I don't mind if someone else merges this (after verifying that the required dtrace fixes are merged). Bye, Alexander. -- http://www.Leidinger.net Alexander @ Leidinger.net: PGP ID = B0063FE7 http://www.FreeBSD.org netchild @ FreeBSD.org : PGP ID = 72077137 From owner-svn-src-head@FreeBSD.ORG Sun Feb 3 09:57:40 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 71C3B2D7; Sun, 3 Feb 2013 09:57:40 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 4BA63F67; Sun, 3 Feb 2013 09:57:40 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r139veMU027216; Sun, 3 Feb 2013 09:57:40 GMT (envelope-from avg@svn.freebsd.org) Received: (from avg@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r139vd8n027213; Sun, 3 Feb 2013 09:57:39 GMT (envelope-from avg@svn.freebsd.org) Message-Id: <201302030957.r139vd8n027213@svn.freebsd.org> From: Andriy Gapon Date: Sun, 3 Feb 2013 09:57:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r246282 - in head/sys: conf kern X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 03 Feb 2013 09:57:40 -0000 Author: avg Date: Sun Feb 3 09:57:39 2013 New Revision: 246282 URL: http://svnweb.freebsd.org/changeset/base/246282 Log: allow for large KTR_ENTRIES values by allocating ktr_buf using malloc(9) Only during very early boot, before malloc(9) is functional (SI_SUB_KMEM), the static ktr_buf_init is used. Size of the static buffer is determined by a new kernel option KTR_BOOT_ENTRIES. Its default value is 1024. This commit builds on top of r243046. Reviewed by: alc MFC after: 17 days Modified: head/sys/conf/NOTES head/sys/conf/options head/sys/kern/kern_ktr.c Modified: head/sys/conf/NOTES ============================================================================== --- head/sys/conf/NOTES Sun Feb 3 03:46:16 2013 (r246281) +++ head/sys/conf/NOTES Sun Feb 3 09:57:39 2013 (r246282) @@ -446,6 +446,8 @@ options KTRACE_REQUEST_POOL=101 # KTR is a kernel tracing facility imported from BSD/OS. It is # enabled with the KTR option. KTR_ENTRIES defines the number of # entries in the circular trace buffer; it may be an arbitrary number. +# KTR_BOOT_ENTRIES defines the number of entries during the early boot, +# before malloc(9) is functional. # KTR_COMPILE defines the mask of events to compile into the kernel as # defined by the KTR_* constants in . KTR_MASK defines the # initial value of the ktr_mask variable which determines at runtime @@ -459,7 +461,8 @@ options KTRACE_REQUEST_POOL=101 # if KTR_VERBOSE is not defined. See ktr(4) and ktrdump(8) for details. # options KTR -options KTR_ENTRIES=1024 +options KTR_BOOT_ENTRIES=1024 +options KTR_ENTRIES=(128 * 1024) options KTR_COMPILE=(KTR_INTR|KTR_PROC) options KTR_MASK=KTR_INTR options KTR_CPUMASK=0x3 Modified: head/sys/conf/options ============================================================================== --- head/sys/conf/options Sun Feb 3 03:46:16 2013 (r246281) +++ head/sys/conf/options Sun Feb 3 09:57:39 2013 (r246282) @@ -669,6 +669,7 @@ KTR_ALQ opt_ktr.h KTR_MASK opt_ktr.h KTR_CPUMASK opt_ktr.h KTR_COMPILE opt_global.h +KTR_BOOT_ENTRIES opt_global.h KTR_ENTRIES opt_global.h KTR_VERBOSE opt_ktr.h WITNESS opt_global.h Modified: head/sys/kern/kern_ktr.c ============================================================================== --- head/sys/kern/kern_ktr.c Sun Feb 3 03:46:16 2013 (r246281) +++ head/sys/kern/kern_ktr.c Sun Feb 3 09:57:39 2013 (r246282) @@ -66,6 +66,10 @@ __FBSDID("$FreeBSD$"); #include #endif +#ifndef KTR_BOOT_ENTRIES +#define KTR_BOOT_ENTRIES 1024 +#endif + #ifndef KTR_ENTRIES #define KTR_ENTRIES 1024 #endif @@ -96,9 +100,9 @@ FEATURE(ktr, "Kernel support for KTR ker volatile int ktr_idx = 0; int ktr_mask = KTR_MASK; int ktr_compile = KTR_COMPILE; -int ktr_entries = KTR_ENTRIES; +int ktr_entries = KTR_BOOT_ENTRIES; int ktr_version = KTR_VERSION; -struct ktr_entry ktr_buf_init[KTR_ENTRIES]; +struct ktr_entry ktr_buf_init[KTR_BOOT_ENTRIES]; struct ktr_entry *ktr_buf = ktr_buf_init; cpuset_t ktr_cpumask = CPUSET_T_INITIALIZER(KTR_CPUMASK); static char ktr_cpumask_str[CPUSETBUFSIZ]; @@ -194,6 +198,28 @@ SYSCTL_PROC(_debug_ktr, OID_AUTO, mask, sysctl_debug_ktr_mask, "IU", "Bitmask of KTR event classes for which logging is enabled"); +#if KTR_ENTRIES != KTR_BOOT_ENTRIES +/* + * A simplified version of sysctl_debug_ktr_entries. + * No need to care about SMP, scheduling, etc. + */ +static void +ktr_entries_initializer(void *dummy __unused) +{ + int mask; + + /* Temporarily disable ktr in case malloc() is being traced. */ + mask = ktr_mask; + ktr_mask = 0; + ktr_buf = malloc(sizeof(*ktr_buf) * KTR_ENTRIES, M_KTR, + M_WAITOK | M_ZERO); + ktr_entries = KTR_ENTRIES; + ktr_mask = mask; +} +SYSINIT(ktr_entries_initializer, SI_SUB_KMEM, SI_ORDER_ANY, + ktr_entries_initializer, NULL); +#endif + static int sysctl_debug_ktr_entries(SYSCTL_HANDLER_ARGS) { From owner-svn-src-head@FreeBSD.ORG Sun Feb 3 10:23:24 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id BAEA8935; Sun, 3 Feb 2013 10:23:24 +0000 (UTC) (envelope-from chagin.dmitry@gmail.com) Received: from mail-la0-x229.google.com (la-in-x0229.1e100.net [IPv6:2a00:1450:4010:c03::229]) by mx1.freebsd.org (Postfix) with ESMTP id A1FCDD1; Sun, 3 Feb 2013 10:23:23 +0000 (UTC) Received: by mail-la0-f41.google.com with SMTP id fo12so3851709lab.14 for ; Sun, 03 Feb 2013 02:23:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:date:from:to:cc:subject:message-id:references :mime-version:content-type:content-disposition:in-reply-to :user-agent; bh=CIzaeLPO5lAR1EdoXp9PkKfgj2oCMlJ1tJ037nwnjpw=; b=SXgzsleX6+hH3AeGuMIv9HeQLaReTv/DxQ0ABJmWLG8rv3wrA3tlYbwVQxSmGcaxt9 iP2u/UxPp7p63LbWbPbYivqb4/BCSiYG5CcgCsf8P9dUB4XOTXaQF3w8h3zNX3zqOKLu h5K/LgXV2MH5hZ5kCXXd4kkcE7DvdQe+mXe1U6eUY+idfCn2crkmJ2N5fo5VGjurLxRV wpg5PBSjKtnYLzWb3iY/XvXDj9TkfgDlm2kpPBbAtWTu2q7F1FOQ0mPYh1gtwq50+fVt 2Ij6O/P/KqX/HHCQA2EOzhlJcBqqcR2lRKFuxuW06uonW+kPsdaYK+oqEmPsw+2nzXsB iOkA== X-Received: by 10.112.25.198 with SMTP id e6mr6879571lbg.63.1359887001492; Sun, 03 Feb 2013 02:23:21 -0800 (PST) Received: from dchagin.static.corbina.net (dchagin.static.corbina.ru. [78.107.232.239]) by mx.google.com with ESMTPS id j9sm4273412lbd.13.2013.02.03.02.23.19 (version=TLSv1.2 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sun, 03 Feb 2013 02:23:20 -0800 (PST) Received: from dchagin.static.corbina.net (localhost [127.0.0.1]) by dchagin.static.corbina.net (8.14.6/8.14.6) with ESMTP id r13ANIv8002026; Sun, 3 Feb 2013 14:23:18 +0400 (MSK) (envelope-from dchagin@dchagin.static.corbina.net) Received: (from dchagin@localhost) by dchagin.static.corbina.net (8.14.6/8.14.6/Submit) id r13ANHvx002025; Sun, 3 Feb 2013 14:23:17 +0400 (MSK) (envelope-from dchagin) Date: Sun, 3 Feb 2013 14:23:17 +0400 From: Chagin Dmitry To: Alexander Leidinger Subject: Re: svn commit: r235063 - in head/sys: amd64/linux32 compat/linux i386/linux Message-ID: <20130203102316.GA1980@dchagin.static.corbina.net> References: <201205051942.q45Jgd3P071990@svn.freebsd.org> <20130203065250.GA1369@dchagin.static.corbina.net> <20130203101844.00000ba1@unknown> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="OgqxwSJOaUobr8KG" Content-Disposition: inline In-Reply-To: <20130203101844.00000ba1@unknown> User-Agent: Mutt/1.5.21 (2010-09-15) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Alexander Leidinger , Chagin Dmitry X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 03 Feb 2013 10:23:24 -0000 --OgqxwSJOaUobr8KG Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sun, Feb 03, 2013 at 10:18:44AM +0100, Alexander Leidinger wrote: > On Sun, 3 Feb 2013 10:52:50 +0400 > Chagin Dmitry wrote: >=20 > > On Sat, May 05, 2012 at 07:42:39PM +0000, Alexander Leidinger wrote: > > > Author: netchild > > > Date: Sat May 5 19:42:38 2012 > > > New Revision: 235063 > > > URL: http://svn.freebsd.org/changeset/base/235063 > > >=20 > > > Log: > > > - >500 static DTrace probes for the linuxulator >=20 > > Hi, what about to merge this to 9, 8?=20 >=20 > Theoretically it should be easy to merge, but it depends upon some > fixes to the dtrace code to DTRT (no crash) when the dtrace module is > unloaded while other dtrace providers like the linuxulator-ones stay in > the kernel. I don't know if those fixes are in 9 or 8. >=20 > Apart from that I'm low on time, my time slots for FreeBSD are already > reserved for some other things. >=20 > I don't mind if someone else merges this (after verifying that the > required dtrace fixes are merged). >=20 Thank you! --=20 Have fun! chd --OgqxwSJOaUobr8KG Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.19 (FreeBSD) iEYEARECAAYFAlEOOpQACgkQ0t2Tb3OO/O1QngCfTFC6ZiaBCfvJp2CQi9qevZmR zYQAoIpIn0av2jgSo8Jfk3s33aFqLibU =5S9Q -----END PGP SIGNATURE----- --OgqxwSJOaUobr8KG-- From owner-svn-src-head@FreeBSD.ORG Sun Feb 3 10:23:29 2013 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 0345E938; Sun, 3 Feb 2013 10:23:29 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from citadel.icyb.net.ua (citadel.icyb.net.ua [212.40.38.140]) by mx1.freebsd.org (Postfix) with ESMTP id AC75DD2; Sun, 3 Feb 2013 10:23:27 +0000 (UTC) Received: from porto.starpoint.kiev.ua (porto-e.starpoint.kiev.ua [212.40.38.100]) by citadel.icyb.net.ua (8.8.8p3/ICyb-2.3exp) with ESMTP id MAA07096; Sun, 03 Feb 2013 12:23:26 +0200 (EET) (envelope-from avg@FreeBSD.org) Received: from localhost ([127.0.0.1]) by porto.starpoint.kiev.ua with esmtp (Exim 4.34 (FreeBSD)) id 1U1wjN-0006CQ-Sm; Sun, 03 Feb 2013 12:23:25 +0200 Message-ID: <510E3A9D.7040005@FreeBSD.org> Date: Sun, 03 Feb 2013 12:23:25 +0200 From: Andriy Gapon User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:17.0) Gecko/20130121 Thunderbird/17.0.2 MIME-Version: 1.0 To: Alexey Dokuchaev Subject: Re: svn commit: r246251 - head/sys/dev/acpica References: <201302021244.r12CiKgj046079@svn.freebsd.org> <20130202125122.GA4975@FreeBSD.org> <20130202151137.GA28366@FreeBSD.org> In-Reply-To: <20130202151137.GA28366@FreeBSD.org> X-Enigmail-Version: 1.4.6 Content-Type: text/plain; charset=KOI8-R Content-Transfer-Encoding: 7bit Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 03 Feb 2013 10:23:29 -0000 on 02/02/2013 17:11 Alexey Dokuchaev said the following: > On Sat, Feb 02, 2013 at 12:51:22PM +0000, Alexey Dokuchaev wrote: >> On Sat, Feb 02, 2013 at 12:44:20PM +0000, Andriy Gapon wrote: >>> New Revision: 246251 >>> URL: http://svnweb.freebsd.org/changeset/base/246251 >>> >>> Log: >>> acpi: clear power button status bit after waking up... >>> so that it is not confused for a new power off request. >> >> Hmm, I was annoyed by this bug for a while. Will try to test it with >> 8-stable tonight, thanks! > > Andriy, it appears to me that ACPI code is substantially different between > 8-stable and head, so the patch cannot be applied as is. I'm not sure where > exactly inside acpi_EnterSleepState() does it belong. Could you provide me > with some guidance (or even patch for 8-stable)? Thanks. Yes, this is unfortunately so. It seems that some fellow developers who hack on ACPI-related code prefer to not MFC at all. I am not ready yet to provide a stable/8 patch and may give up on MFC to stable/8 altogether. P.S. logically the new block of code seems to belong to acpi_sleep_machdep() before intr_restore() call. -- Andriy Gapon From owner-svn-src-head@FreeBSD.ORG Sun Feb 3 10:26:27 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 4A3DEC35; Sun, 3 Feb 2013 10:26:27 +0000 (UTC) (envelope-from hrs@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 1F767F5; Sun, 3 Feb 2013 10:26:27 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r13AQR01036318; Sun, 3 Feb 2013 10:26:27 GMT (envelope-from hrs@svn.freebsd.org) Received: (from hrs@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r13AQPo7036308; Sun, 3 Feb 2013 10:26:25 GMT (envelope-from hrs@svn.freebsd.org) Message-Id: <201302031026.r13AQPo7036308@svn.freebsd.org> From: Hiroki Sato Date: Sun, 3 Feb 2013 10:26:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r246283 - in head: . release release/amd64 release/i386 release/ia64 release/pc98 release/powerpc release/sparc64 share/man/man7 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 03 Feb 2013 10:26:27 -0000 Author: hrs Date: Sun Feb 3 10:26:24 2013 New Revision: 246283 URL: http://svnweb.freebsd.org/changeset/base/246283 Log: - Add CHECKSUM.* support in Makefile[1]. - Use ln -fs to create a symlink. - Remove pkgadd for docports. - Use WITHOUT_JADETEX=yes instead of WITH_JADETEX=no. - Add {WORLD,KERNEL}_FLAGS to [BTWK]MAKE. - Use makefs(8) and gpart(8) for sparc64 ISO image[2]. - Add publisher option to makefs(8)[2]. Based on work by: gjb[1] Discussed with: marius, nwhitehorn[2] Modified: head/Makefile.inc1 head/release/Makefile head/release/amd64/mkisoimages.sh head/release/generate-release.sh head/release/i386/mkisoimages.sh head/release/ia64/mkisoimages.sh head/release/pc98/mkisoimages.sh head/release/powerpc/mkisoimages.sh head/release/sparc64/mkisoimages.sh head/share/man/man7/release.7 Modified: head/Makefile.inc1 ============================================================================== --- head/Makefile.inc1 Sun Feb 3 09:57:39 2013 (r246282) +++ head/Makefile.inc1 Sun Feb 3 10:26:24 2013 (r246283) @@ -27,6 +27,8 @@ # TARGET="machine" to crossbuild world for a different machine type # TARGET_ARCH= may be required when a TARGET supports multiple endians # BUILDENV_SHELL= shell to launch for the buildenv target (def:/bin/sh) +# WORLD_FLAGS= additional flags to pass to make(1) during buildworld +# KERNEL_FLAGS= additional flags to pass to make(1) during buildkernel # # The intended user-driven targets are: @@ -245,7 +247,7 @@ BMAKEENV= INSTALL="sh ${.CURDIR}/tools/i MAKEFLAGS="-m ${.CURDIR}/tools/build/mk ${.MAKEFLAGS}" \ COMPILER_TYPE=${COMPILER_TYPE} BMAKE= MAKEOBJDIRPREFIX=${WORLDTMP} \ - ${BMAKEENV} ${MAKE} -f Makefile.inc1 \ + ${BMAKEENV} ${MAKE} ${WORLD_FLAGS} -f Makefile.inc1 \ DESTDIR= \ BOOTSTRAPPING=${OSRELDATE} \ SSP_CFLAGS= \ @@ -255,7 +257,7 @@ BMAKE= MAKEOBJDIRPREFIX=${WORLDTMP} \ # build-tools stage TMAKE= MAKEOBJDIRPREFIX=${OBJTREE} \ - ${BMAKEENV} ${MAKE} -f Makefile.inc1 \ + ${BMAKEENV} ${MAKE} ${WORLD_FLAGS} -f Makefile.inc1 \ TARGET=${TARGET} TARGET_ARCH=${TARGET_ARCH} \ DESTDIR= \ BOOTSTRAPPING=${OSRELDATE} \ @@ -288,7 +290,7 @@ WMAKE_COMPILER_TYPE= gcc WMAKE_COMPILER_TYPE= clang .endif WMAKEENV+= COMPILER_TYPE=${WMAKE_COMPILER_TYPE} -WMAKE= ${WMAKEENV} ${MAKE} -f Makefile.inc1 DESTDIR=${WORLDTMP} +WMAKE= ${WMAKEENV} ${MAKE} ${WORLD_FLAGS} -f Makefile.inc1 DESTDIR=${WORLDTMP} .if ${TARGET_ARCH} == "amd64" || ${TARGET_ARCH} == "powerpc64" # 32 bit world @@ -378,7 +380,7 @@ IMAKE_MTREE= MTREE_CMD="nmtree ${MTREEFL # kernel stage KMAKEENV= ${WMAKEENV} -KMAKE= ${KMAKEENV} ${MAKE} KERNEL=${INSTKERNNAME} +KMAKE= ${KMAKEENV} ${MAKE} ${KERNEL_FLAGS} KERNEL=${INSTKERNNAME} # # buildworld Modified: head/release/Makefile ============================================================================== --- head/release/Makefile Sun Feb 3 09:57:39 2013 (r246282) +++ head/release/Makefile Sun Feb 3 10:26:24 2013 (r246283) @@ -34,6 +34,20 @@ TARGET_ARCH?= ${TARGET} IMAKE= ${MAKE} TARGET_ARCH=${TARGET_ARCH} TARGET=${TARGET} DISTDIR= dist +# Define OSRELEASE by using newvars.sh +.if !defined(OSRELEASE) || empty(OSRELEASE) +.for _V in TYPE BRANCH REVISION +${_V}!= eval $$(awk '/^${_V}=/{print}' ${.CURDIR}/../sys/conf/newvers.sh); echo $$${_V} +.endfor +.for _V in ${TARGET_ARCH} +.if !empty(TARGET:M${_V}) +OSRELEASE= ${TYPE}-${REVISION}-${BRANCH}-${TARGET} +.else +OSRELEASE= ${TYPE}-${REVISION}-${BRANCH}-${TARGET}-${TARGET_ARCH} +.endif +.endfor +.endif + .if !exists(${DOCDIR}) NODOC= true .endif @@ -117,7 +131,7 @@ system: packagesystem cp reldoc/* release .endif # Set up installation environment - ln -s /tmp/bsdinstall_etc/resolv.conf release/etc/resolv.conf + ln -fs /tmp/bsdinstall_etc/resolv.conf release/etc/resolv.conf echo sendmail_enable=\"NONE\" > release/etc/rc.conf echo hostid_enable=\"NO\" >> release/etc/rc.conf cp ${.CURDIR}/rc.local release/etc @@ -142,7 +156,7 @@ bootonly: packagesystem cp reldoc/* bootonly .endif # Set up installation environment - ln -s /tmp/bsdinstall_etc/resolv.conf bootonly/etc/resolv.conf + ln -fs /tmp/bsdinstall_etc/resolv.conf bootonly/etc/resolv.conf echo sendmail_enable=\"NONE\" > bootonly/etc/rc.conf echo hostid_enable=\"NO\" >> bootonly/etc/rc.conf cp ${.CURDIR}/rc.local bootonly/etc @@ -183,4 +197,9 @@ install: .if defined(DESTDIR) && !empty(DESTDIR) mkdir -p ${DESTDIR} .endif - cp -a ${IMAGES} ftp ${DESTDIR}/ + cp -a ftp ${DESTDIR}/ +.for I in ${IMAGES} + cp -p ${I} ${DESTDIR}/${OSRELEASE}-${I} +.endfor + cd ${DESTDIR} && sha256 ${OSRELEASE}* > ${DESTDIR}/CHECKSUM.SHA256 + cd ${DESTDIR} && md5 ${OSRELEASE}* > ${DESTDIR}/CHECKSUM.MD5 Modified: head/release/amd64/mkisoimages.sh ============================================================================== --- head/release/amd64/mkisoimages.sh Sun Feb 3 09:57:39 2013 (r246282) +++ head/release/amd64/mkisoimages.sh Sun Feb 3 10:26:24 2013 (r246283) @@ -39,6 +39,7 @@ fi LABEL=`echo $1 | tr '[:lower:]' '[:upper:]'`; shift NAME=$1; shift +publisher="The FreeBSD Project. http://www.FreeBSD.org/" echo "/dev/iso9660/$LABEL / cd9660 ro 0 0" > $1/etc/fstab -makefs -t cd9660 $bootable -o rockridge -o label=$LABEL $NAME $* +makefs -t cd9660 $bootable -o rockridge -o label=$LABEL -o publisher="$publisher" $NAME $* rm $1/etc/fstab Modified: head/release/generate-release.sh ============================================================================== --- head/release/generate-release.sh Sun Feb 3 09:57:39 2013 (r246282) +++ head/release/generate-release.sh Sun Feb 3 10:26:24 2013 (r246283) @@ -3,191 +3,98 @@ # generate-release.sh: check out source trees, and build release components with # totally clean, fresh trees. # -# Usage: generate-release.sh [-r revision] [-d docrevision] \ -# [-p portsrevision] svn-branch scratch-dir +# Usage: generate-release.sh svn-branch[@revision] scratch-dir # # Environment variables: -# SVNROOT: SVN URL to FreeBSD source repository (by default, -# svn://svn.freebsd.org/base) -# MAKE_FLAGS: optional flags to pass to make (e.g. -j) -# RELSTRING: optional base name for media images (e.g. FreeBSD-9.0-RC2-amd64) -# -# Note: Since this requires a chroot, release cross-builds will not work! +# SVNROOTBASE: SVN base URL to FreeBSD repository (svn://svn.freebsd.org) +# SVNROOTSRC: URL to FreeBSD src tree (${SVNROOTBASE}/base) +# SVNROOTDOC: URL to FreeBSD doc tree (${SVNROOTBASE}/doc) +# SVNROOTPORTS:URL to FreeBSD ports tree (${SVNROOTBASE}/ports) +# BRANCHSRC: branch name of src (svn-branch[@revision]) +# BRANCHDOC: branch name of doc (head) +# BRANCHPORTS: branch name of ports (head) +# WORLD_FLAGS: optional flags to pass to buildworld (e.g. -j) +# KERNEL_FLAGS: optional flags to pass to buildkernel (e.g. -j) # # $FreeBSD$ # -unset B_ARCH -unset ARCH -unset MACHINE_ARCH - -HOST_ARCH=`uname -p` - usage() { - echo "Usage: $0 [-a arch] [-r revision] [-d docrevision] [-p portsrevision] svn-branch scratch-dir" + echo "Usage: $0 svn-branch[@revision] scratch-dir" 2>&1 exit 1 } -arch_error () -{ - echo "Architecture ${OPTARG} cannot be built on host architecture ${HOST_ARCH}" - exit 1 -} - -REVISION= -DOCREVISION= -PORTSREVISION= -while getopts a:d:r:p: opt; do - case $opt in - a) - case "${OPTARG}" in - i386|amd64) - if [ "${HOST_ARCH}" != "amd64" ]; then - arch_error "${OPTARG}" - fi - ;; - powerpc|powerpc64) - if [ "${HOST_ARCH}" != "powerpc64" ]; then - arch_error "${OPTARG}" - fi - ;; - *) - arch_error "${OPTARG}" - ;; - esac - B_ARCH="$OPTARG" - ;; - d) - DOCREVISION="-r $OPTARG" - ;; - r) - REVISION="-r $OPTARG" - ;; - p) - PORTSREVISION="-r $OPTARG" - ;; - \?) - usage - ;; - esac -done -shift $(($OPTIND - 1)) - -# If target architecture is not specified, use hw.machine_arch -if [ "x${B_ARCH}" == "x" ]; then - B_ARCH="${HOST_ARCH}" -fi -ARCH_FLAGS="ARCH=${B_ARCH} TARGET_ARCH=${B_ARCH}" - if [ $# -lt 2 ]; then usage fi -if [ $(id -u) -ne 0 ]; then - echo "Needs to be run as root." +: ${SVNROOTBASE:=svn://svn.freebsd.org} +: ${SVNROOTSRC:=${SVNROOTBASE}/base} +: ${SVNROOTDOC:=${SVNROOTBASE}/doc} +: ${SVNROOTPORTS:=${SVNROOTBASE}/ports} +: ${SVNROOT:=${SVNROOTSRC}} # for backward compatibility +: ${SVN_CMD:=/usr/local/bin/svn} +BRANCHSRC=$1 +: ${BRANCHDOC:=head} +: ${BRANCHPORTS:=head} +: ${WORLD_FLAGS:=${MAKE_FLAGS}} +: ${KERNEL_FLAGS:=${MAKE_FLAGS}} +: ${CHROOTDIR:=$2} + +if [ ! -r "${CHROOTDIR}" ]; then + echo "${CHROOTDIR}: scratch dir not found." exit 1 fi -set -e # Everything must succeed - -case $MAKE_FLAGS in - *-j*) - ;; - *) - MAKE_FLAGS="$MAKE_FLAGS -j "$(sysctl -n hw.ncpu) - ;; +CHROOT_CMD="/usr/sbin/chroot ${CHROOTDIR}" +case ${TARGET} in +"") ;; +*) SETENV_TARGET="TARGET=$TARGET" ;; esac +case ${TARGET_ARCH} in +"") ;; +*) SETENV_TARGET_ARCH="TARGET_ARCH=$TARGET_ARCH" ;; +esac +SETENV="env -i PATH=/bin:/usr/bin:/sbin:/usr/sbin" +CROSSENV="${SETENV_TARGET} ${SETENV_TARGET_ARCH}" +WMAKE="make -C /usr/src ${WORLD_FLAGS}" +NWMAKE="${WMAKE} __MAKE_CONF=/dev/null SRCCONF=/dev/null" +KMAKE="make -C /usr/src ${KERNEL_FLAGS}" +RMAKE="make -C /usr/src/release" -mkdir -p $2/usr/src - -svn co ${SVNROOT:-svn://svn.freebsd.org/base}/$1 $2/usr/src $REVISION -svn co ${SVNROOT:-svn://svn.freebsd.org/doc}/head $2/usr/doc $DOCREVISION -svn co ${SVNROOT:-svn://svn.freebsd.org/ports}/head $2/usr/ports $PORTSREVISION - -cd $2/usr/src -make $MAKE_FLAGS ${ARCH_FLAGS} buildworld -make $ARCH_FLAGS installworld distribution DESTDIR=$2 -mount -t devfs devfs $2/dev -trap "umount $2/dev" EXIT # Clean up devfs mount on exit - -# Most commands below are run in chroot, so fake getosreldate(3) right now -OSVERSION=$(grep '#define __FreeBSD_version' $2/usr/include/sys/param.h | awk '{print $3}') -export OSVERSION -BRANCH=$(grep '^BRANCH=' $2/usr/src/sys/conf/newvers.sh | awk -F\= '{print $2}') -BRANCH=`echo ${BRANCH} | sed -e 's,",,g'` -REVISION=$(grep '^REVISION=' $2/usr/src/sys/conf/newvers.sh | awk -F\= '{print $2}') -REVISION=`echo ${REVISION} | sed -e 's,",,g'` -OSRELEASE="${REVISION}-${BRANCH}" - -pkgng_install_docports () -{ - # Attempt to install docproj port from pkgng package. - chroot ${CHROOTDIR} /bin/sh -c 'env ASSUME_ALWAYS_YES=1 /usr/sbin/pkg install -y docproj-nojadetex' - # Check if docproj was installed, since pkg(8) returns '0' if unable - # to install a package from the repository. If it is not installed, - # fallback to installing using pkg_add(1). - chroot ${CHROOTDIR} /bin/sh -c '/usr/sbin/pkg info -q docproj-nojadetex' || \ - pkgadd_install_docports -} - -build_compat9_port () -{ - chroot ${CHROOTDIR} /bin/sh -c 'make -C /usr/ports/misc/compat9x BATCH=yes install clean' -} +if [ $(id -u) -ne 0 ]; then + echo "Needs to be run as root." + exit 1 +fi -pkgadd_install_docports () -{ - # Attempt to install docproj package with pkg_add(1). - # If not successful, build the docproj port. - if [ "${REVISION}" == "10.0" ]; then - # Packages for 10-CURRENT are still located in the 9-CURRENT - # directory. Override environment to use correct package - # location if building for 10-CURRENT. - PACKAGESITE="ftp://ftp.freebsd.org/pub/FreeBSD/ports/${B_ARCH}/packages-9-current/Latest/" - export PACKAGESITE - PACKAGEROOT="ftp://ftp.freebsd.org/pub/FreeBSD/ports/${B_ARCH}/packages-9-current/" - export PACKAGEROOT - PKG_PATH="ftp://ftp.freebsd.org/pub/FreeBSD/ports/${B_ARCH}/packages-9-current/All/" - export PKG_PATH - build_compat9_port - fi - chroot ${CHROOTDIR} /bin/sh -c '/usr/sbin/pkg_add -r docproj-nojadetex' || \ - build_docports -} +set -e # Everything must succeed -build_docports() -{ - # Could not install textproc/docproj from pkg(8) or pkg_add(1). Build - # the port as final fallback. - chroot ${CHROOTDIR} /bin/sh -c 'make -C /usr/ports/textproc/docproj BATCH=yes WITHOUT_SVN=yes WITH_JADETEX=no WITHOUT_X11=yes WITHOUT_PYTHON=yes install clean' || \ - { echo "*** Could not build the textproj/docproj port. Exiting."; exit 2; } -} +mkdir -p ${CHROOTDIR}/usr/src +${SVN_CMD} co ${SVNROOT}/${BRANCHSRC} ${CHROOTDIR}/usr/src +${SVN_CMD} co ${SVNROOTDOC}/${BRANCHDOC} ${CHROOTDIR}/usr/doc +${SVN_CMD} co ${SVNROOTPORTS}/${BRANCHPORTS} ${CHROOTDIR}/usr/ports + +${SETENV} ${NWMAKE} -C ${CHROOTDIR}/usr/src ${WORLD_FLAGS} buildworld +${SETENV} ${NWMAKE} -C ${CHROOTDIR}/usr/src installworld distribution DESTDIR=${CHROOTDIR} +mount -t devfs devfs ${CHROOTDIR}/dev +trap "umount ${CHROOTDIR}/dev" EXIT # Clean up devfs mount on exit -if [ -d $2/usr/doc ]; then - cp /etc/resolv.conf $2/etc/resolv.conf +if [ -d ${CHROOTDIR}/usr/doc ]; then + cp /etc/resolv.conf ${CHROOTDIR}/etc/resolv.conf # Install docproj to build release documentation - CHROOTDIR="$2" - set +e - pkgng_install_docports "${CHROOTDIR}" - set -e -fi - -chroot $2 make -C /usr/src $MAKE_FLAGS ${ARCH_FLAGS} buildworld buildkernel -chroot $2 make -C /usr/src/release ${ARCH_FLAGS} release -chroot $2 make -C /usr/src/release install DESTDIR=/R - -if [ "x${OSVERSION}" == "x" ]; then - OSRELEASE=`chroot $2 uname -r` + ${CHROOT_CMD} /bin/sh -c \ + 'make -C /usr/ports/textproc/docproj \ + BATCH=yes \ + WITHOUT_SVN=yes \ + WITHOUT_JADETEX=yes \ + WITHOUT_X11=yes \ + WITHOUT_PYTHON=yes \ + install' fi -: ${RELSTRING=`chroot $2 uname -s`-${OSRELEASE}-${B_ARCH}} - -cd $2/R -for i in release.iso bootonly.iso memstick; do - mv $i $RELSTRING-$i -done -sha256 $RELSTRING-* > CHECKSUM.SHA256 -md5 $RELSTRING-* > CHECKSUM.MD5 - +${CHROOT_CMD} ${SETENV} ${CROSSENV} ${WMAKE} buildworld +${CHROOT_CMD} ${SETENV} ${CROSSENV} ${KMAKE} buildkernel +${CHROOT_CMD} ${SETENV} ${CROSSENV} ${RMAKE} release +${CHROOT_CMD} ${SETENV} ${CROSSENV} ${RMAKE} install DESTDIR=/R Modified: head/release/i386/mkisoimages.sh ============================================================================== --- head/release/i386/mkisoimages.sh Sun Feb 3 09:57:39 2013 (r246282) +++ head/release/i386/mkisoimages.sh Sun Feb 3 10:26:24 2013 (r246283) @@ -39,6 +39,7 @@ fi LABEL=`echo $1 | tr '[:lower:]' '[:upper:]'`; shift NAME=$1; shift +publisher="The FreeBSD Project. http://www.FreeBSD.org/" echo "/dev/iso9660/$LABEL / cd9660 ro 0 0" > $1/etc/fstab -makefs -t cd9660 $bootable -o rockridge -o label=$LABEL $NAME $* +makefs -t cd9660 $bootable -o rockridge -o label=$LABEL -o publisher="$publisher" $NAME $* rm $1/etc/fstab Modified: head/release/ia64/mkisoimages.sh ============================================================================== --- head/release/ia64/mkisoimages.sh Sun Feb 3 09:57:39 2013 (r246282) +++ head/release/ia64/mkisoimages.sh Sun Feb 3 10:26:24 2013 (r246283) @@ -75,8 +75,9 @@ else BOOTOPTS="" fi +publisher="The FreeBSD Project. http://www.FreeBSD.org/" echo "/dev/iso9660/$LABEL / cd9660 ro 0 0" > $BASE/etc/fstab -makefs -t cd9660 $BOOTOPTS -o rockridge -o label=$LABEL $NAME $BASE $* +makefs -t cd9660 $BOOTOPTS -o rockridge -o label=$LABEL -o publisher="$publisher" $NAME $BASE $* rm $BASE/etc/fstab rm -f $EFIPART exit 0 Modified: head/release/pc98/mkisoimages.sh ============================================================================== --- head/release/pc98/mkisoimages.sh Sun Feb 3 09:57:39 2013 (r246282) +++ head/release/pc98/mkisoimages.sh Sun Feb 3 10:26:24 2013 (r246283) @@ -39,6 +39,7 @@ fi LABEL=`echo $1 | tr '[:lower:]' '[:upper:]'`; shift NAME=$1; shift +publisher="The FreeBSD Project. http://www.FreeBSD.org/" echo "/dev/iso9660/$LABEL / cd9660 ro 0 0" > $1/etc/fstab -makefs -t cd9660 $bootable -o rockridge -o label=$LABEL $NAME $* +makefs -t cd9660 $bootable -o rockridge -o label=$LABEL -o publisher="$publisher" $NAME $* rm $1/etc/fstab Modified: head/release/powerpc/mkisoimages.sh ============================================================================== --- head/release/powerpc/mkisoimages.sh Sun Feb 3 09:57:39 2013 (r246282) +++ head/release/powerpc/mkisoimages.sh Sun Feb 3 10:26:24 2013 (r246283) @@ -61,9 +61,9 @@ fi LABEL=`echo $1 | tr '[:lower:]' '[:upper:]'`; shift NAME=$1; shift +publisher="The FreeBSD Project. http://www.FreeBSD.org/" echo "/dev/iso9660/$LABEL / cd9660 ro 0 0" > $1/etc/fstab -makefs -t cd9660 $bootable -o rockridge -o label=$LABEL $NAME $* +makefs -t cd9660 $bootable -o rockridge -o label=$LABEL -o publisher="$publisher" $NAME $* rm $1/etc/fstab rm /tmp/hfs-boot-block rm -rf $1/ppc - Modified: head/release/sparc64/mkisoimages.sh ============================================================================== --- head/release/sparc64/mkisoimages.sh Sun Feb 3 09:57:39 2013 (r246282) +++ head/release/sparc64/mkisoimages.sh Sun Feb 3 10:26:24 2013 (r246283) @@ -22,51 +22,61 @@ # resulting ISO image, base-bits-dir contains the image contents and # extra-bits-dir, if provided, contains additional files to be merged # into base-bits-dir as part of making the image. - -publisher="The FreeBSD Project. http://www.freebsd.org/" -IMG=/tmp/bootfs -MNT=/mnt - -if [ "x$1" = "x-b" ]; then - dd if=/dev/zero of=${IMG} bs=512 count=1024 - MD=`mdconfig -a -t vnode -f ${IMG}` - sunlabel -w -B -b $4/boot/boot1 ${MD} auto - newfs -O1 -o space -m 0 /dev/${MD} - mount /dev/${MD} ${MNT} - mkdir ${MNT}/boot - cp $4/boot/loader ${MNT}/boot - umount ${MNT} - mdconfig -d -u ${MD#md} - bootable="-B ,,,,${IMG}" - shift -else - bootable="" -fi - if [ $# -lt 3 ]; then - echo Usage: $0 '[-b] image-label image-name base-bits-dir [extra-bits-dir]' - rm -f ${IMG} + echo Usage: $0 '[-b] image-label image-name base-bits-dir [extra-bits-dir]' > /dev/stderr exit 1 fi -type mkisofs 2>&1 | grep " is " >/dev/null -if [ $? -ne 0 ]; then - echo The cdrtools port is not installed. Trying to get it now. - if [ -f /usr/ports/sysutils/cdrtools/Makefile ]; then - cd /usr/ports/sysutils/cdrtools && make install BATCH=yes && make clean - else - if ! pkg_add -r cdrtools; then - echo "Could not get it via pkg_add - please go install this" - echo "from the ports collection and run this script again." - exit 2 - fi - fi -fi - +case $1 in +-b) BOPT=$1; shift ;; +esac LABEL=`echo $1 | tr '[:lower:]' '[:upper:]'`; shift NAME=$1; shift +# Create an ISO image +publisher="The FreeBSD Project. http://www.FreeBSD.org/" echo "/dev/iso9660/$LABEL / cd9660 ro 0 0" > $1/etc/fstab -mkisofs $bootable -r -J -V $LABEL -publisher "$publisher" -o $NAME $* +makefs -t cd9660 -B be -o rockridge -o label="$LABEL" -o publisher="$publisher" ${NAME}.tmp $* rm $1/etc/fstab -rm -f ${IMG} + +if [ "x$BOPT" != "x-b" ]; then + mv ${NAME}.tmp ${NAME} + exit 0 +fi +TMPIMGDIR=`mktemp -d /tmp/bootfs.XXXXXXXX` || exit 1 +BOOTFSDIR="${TMPIMGDIR}/bootfs" +BOOTFSIMG="${TMPIMGDIR}/bootfs.img" + +# Create a boot filesystem +mkdir -p "${BOOTFSDIR}/boot" +cp $4/boot/loader "${BOOTFSDIR}/boot" +makefs -t ffs -B be -M 512k "${BOOTFSIMG}" "${BOOTFSDIR}" +dd if=$4/boot/boot1 of="${BOOTFSIMG}" bs=512 conv=notrunc,sync + +# Create a boot ISO image +: ${CYLSIZE:=640} +ISOSIZE=$(stat -f %z ${NAME}.tmp) +ISOBLKS=$(((${ISOSIZE} + 511) / 512)) +ISOCYLS=$(((${ISOBLKS} + (${CYLSIZE} - 1)) / ${CYLSIZE})) + +BOOTFSSIZE=$(stat -f %z "${BOOTFSIMG}") +BOOTFSBLKS=$(((${BOOTFSSIZE} + 511) / 512)) +BOOTFSCYLS=$(((${BOOTFSBLKS} + (${CYLSIZE} - 1)) / ${CYLSIZE})) + +ENDCYL=$((${ISOCYLS} + ${BOOTFSCYLS})) +NSECTS=$((${ENDCYL} * 1 * ${CYLSIZE})) + +dd if=${NAME}.tmp of=${NAME} bs=${CYLSIZE}b conv=notrunc,sync +dd if=${BOOTFSIMG} of=${NAME} bs=${CYLSIZE}b seek=${ISOCYLS} conv=notrunc,sync +# The number of alternative cylinders is always 2. +dd if=/dev/zero of=${NAME} bs=${CYLSIZE}b seek=${ENDCYL} count=2 conv=notrunc,sync +rm -rf ${NAME}.tmp ${TMPIMGDIR} + +# Write VTOC8 label to boot ISO image +MD=`mdconfig -a -t vnode -S 512 -y 1 -x ${CYLSIZE} -f ${NAME}` +gpart create -s VTOC8 ${MD} +# !4: usr, for ISO image part +gpart add -i 1 -s $((${ISOCYLS} * ${CYLSIZE} * 512))b -t \!4 ${MD} +# !2: root, for bootfs part. +gpart add -i 6 -s $((${BOOTFSCYLS} * ${CYLSIZE} * 512))b -t \!2 ${MD} +mdconfig -d -u ${MD#md} Modified: head/share/man/man7/release.7 ============================================================================== --- head/share/man/man7/release.7 Sun Feb 3 09:57:39 2013 (r246282) +++ head/share/man/man7/release.7 Sun Feb 3 10:26:24 2013 (r246283) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd January 31, 2013 +.Dd February 3, 2013 .Dt RELEASE 7 .Os .Sh NAME @@ -116,26 +116,40 @@ Note that because this uses a chroot, it .Fx release media. .Pp -Environment variables: -.Bl -tag -width ".Cm MAKE_FLAGS" -.It Ev MAKE_FLAGS +Optional environment variables: +.Bl -tag -width ".Cm WORLD_FLAGS" +.It Ev WORLD_FLAGS This environment variable can be set to pass flags (e.g. -j) to .Xr make 1 -when invoked by the script. -.It Ev SVNROOT -The location of the FreeBSD SVN source, doc, and ports repositories. +when invoked to build a world by the script. +.It Ev KERNEL_FLAGS +This environment variable can be set to pass flags (e.g. -j) to +.Xr make 1 +when invoked to build a kernel by the script. +.It Ev SVNROOTBASE +The base part of URL of the FreeBSD SVN repositories. Defaults to -.Pa svn://svn.freebsd.org/base -for the source tree, -.Pa svn://svn.freebsd.org/ports/head -for the Ports Collection, and -.Pa svn://svn.freebsd.org/doc/head -for the Documentation Project source. -.It Ev RELSTRING -Optional base name for generated media images (e.g. FreeBSD-9.0-RC2-amd64). -Defaults to the output of -.Ic `uname -s`-`uname -r`-`uname -p` -within the chroot. +.Pa svn://svn.freebsd.org . +.It Ev SVNROOTSRC +The URL of the FreeBSD SVN source repository. +Defaults to +.Pa ${SVNROOTBASE}/base . +.It Ev SVNROOTDOC +The URL of the FreeBSD SVN doc repository. +Defaults to +.Pa ${SVNROOTBASE}/doc . +.It Ev SVNROOTPORTS +The URL of the FreeBSD SVN ports repository. +Defaults to +.Pa ${SVNROOTBASE}/ports . +.It Ev BRANCHDOC +The branch name of the FreeBSD SVN doc repository. +Defaults to +.Pa head . +.It Ev BRANCHPORTS +The branch name of the FreeBSD SVN ports repository. +Defaults to +.Pa head . .El .Sh MAKEFILE TARGETS The release makefile @@ -155,15 +169,12 @@ platform. Copy all produced release media to .Pa ${DESTDIR} . .It Cm cdrom -Builds installation CD-ROM images. On some systems, this may require that -.Xr mkisofs 8 -be installed -.Pq Pa sysutils/cdrtools -and possibly that the +Builds installation CD-ROM images. +This may require the .Xr md 4 (memory disk) device driver be present in the kernel -(either by being compiled in or available as a module). This target -produces files called +(either by being compiled in or available as a module). +This target produces files called .Pa release.iso and .Pa bootonly.iso @@ -171,7 +182,8 @@ as its output. .It Cm memstick Builds an installation memory stick image named .Pa memstick . -Not applicable on all platforms. Requires that the +Not applicable on all platforms. +Requires that the .Xr md 4 (memory disk) device driver be present in the kernel (either by being compiled in or available as a module). @@ -207,27 +219,32 @@ target invoked by .El .Sh ENVIRONMENT Optional variables: -.Bl -tag -width ".Va TARGET_ARCH" -.It Va WORLDDIR +.Bl -tag -width ".Ev TARGET_ARCH" +.It Ev OSRELEASE +Optional base name for generated media images (e.g. FreeBSD-9.0-RC2-amd64). +Defaults to the output of +.Ic `uname -s`-`uname -r`-`uname -p` +within the chroot. +.It Ev WORLDDIR Location of a directory containing the src tree. By default, the directory above the one containing the makefile .Pq Pa src . -.It Va PORTSDIR +.It Ev PORTSDIR Location of a directory containing the ports tree. By default, .Pa /usr/ports . If it is unset or cannot be found, ports will not be included in the release. -.It Va DOCDIR +.It Ev DOCDIR Location of a directory containing the doc tree. By default, .Pa /usr/doc . If it is unset or cannot be found, most documentation will not be included in the release; see .Ev NODOC below. -.It Va NOPORTS +.It Ev NOPORTS If defined, the Ports Collection will be omitted from the release. -.It Va NOSRC +.It Ev NOSRC If set, do not include system source code in the release. -.It Va NODOC +.It Ev NODOC If defined, the XML-based documentation from the .Fx Documentation Project will not be built. @@ -236,33 +253,33 @@ However, the distribution will still be created with the minimal documentation set provided in .Pa src/share/doc . -.It Va TARGET +.It Ev TARGET The target hardware platform. This is analogous to the .Dq Nm uname Fl m output. This is necessary to cross-build some target architectures. For example, cross-building for PC98 machines requires -.Va TARGET_ARCH Ns = Ns Li i386 +.Ev TARGET_ARCH Ns = Ns Li i386 and -.Va TARGET Ns = Ns Li pc98 . +.Ev TARGET Ns = Ns Li pc98 . If not set, -.Va TARGET +.Ev TARGET defaults to the current hardware platform. -.It Va TARGET_ARCH +.It Ev TARGET_ARCH The target machine processor architecture. This is analogous to the .Dq Nm uname Fl p output. Set this to cross-build for a different architecture. If not set, -.Va TARGET_ARCH +.Ev TARGET_ARCH defaults to the current machine architecture, unless -.Va TARGET +.Ev TARGET is also set, in which case it defaults to the appropriate value for that platform. Typically, one only needs to set -.Va TARGET . +.Ev TARGET . .El .Sh FILES .Bl -tag -compact -width Pa @@ -299,7 +316,6 @@ The following sequence of commands can b in a clean environment, including ports and documentation: .Bd -literal -offset indent cd /usr/src/release -export SVNROOT=svn://svn.freebsd.org/base sh generate-release.sh head /local3/release .Ed .Pp From owner-svn-src-head@FreeBSD.ORG Sun Feb 3 15:54:59 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id ACD5B1D3; Sun, 3 Feb 2013 15:54:59 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 9F37DD84; Sun, 3 Feb 2013 15:54:59 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r13FsxQM034567; Sun, 3 Feb 2013 15:54:59 GMT (envelope-from jilles@svn.freebsd.org) Received: (from jilles@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r13FswN8034562; Sun, 3 Feb 2013 15:54:58 GMT (envelope-from jilles@svn.freebsd.org) Message-Id: <201302031554.r13FswN8034562@svn.freebsd.org> From: Jilles Tjoelker Date: Sun, 3 Feb 2013 15:54:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r246288 - head/bin/sh X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 03 Feb 2013 15:54:59 -0000 Author: jilles Date: Sun Feb 3 15:54:57 2013 New Revision: 246288 URL: http://svnweb.freebsd.org/changeset/base/246288 Log: sh: Expand here documents in the current process. Expand here documents at the same point other redirections are expanded but use a non-fork subshell environment (like simple command substitutions) for compatibility. Substitition errors result in an empty here document like before. As a result, a fork is avoided for short (<4K) expanded here documents. Unexpanded here documents (with quoted end marker after <<) are not affected by this change. They already only forked when >4K. Side effects: * Order of expansion is slightly different. * Slow expansions are not executed in parallel with the redirected command. * A non-fork subshell environment is subtly different from a forked process. Modified: head/bin/sh/eval.c head/bin/sh/expand.c head/bin/sh/expand.h head/bin/sh/nodetypes head/bin/sh/redir.c Modified: head/bin/sh/eval.c ============================================================================== --- head/bin/sh/eval.c Sun Feb 3 15:23:28 2013 (r246287) +++ head/bin/sh/eval.c Sun Feb 3 15:54:57 2013 (r246288) @@ -92,6 +92,7 @@ static void evalfor(union node *, int); static union node *evalcase(union node *); static void evalsubshell(union node *, int); static void evalredir(union node *, int); +static void exphere(union node *, struct arglist *); static void expredir(union node *); static void evalpipe(union node *); static int is_valid_fast_cmdsubst(union node *n); @@ -488,6 +489,37 @@ evalredir(union node *n, int flags) } +static void +exphere(union node *redir, struct arglist *fn) +{ + struct jmploc jmploc; + struct jmploc *savehandler; + struct localvar *savelocalvars; + int need_longjmp = 0; + + redir->nhere.expdoc = nullstr; + savelocalvars = localvars; + localvars = NULL; + forcelocal++; + savehandler = handler; + if (setjmp(jmploc.loc)) + need_longjmp = exception != EXERROR && exception != EXEXEC; + else { + handler = &jmploc; + expandarg(redir->nhere.doc, fn, 0); + redir->nhere.expdoc = fn->list->text; + INTOFF; + } + handler = savehandler; + forcelocal--; + poplocalvars(); + localvars = savelocalvars; + if (need_longjmp) + longjmp(handler->loc, 1); + INTON; +} + + /* * Compute the names of the files in a redirection list. */ @@ -516,6 +548,9 @@ expredir(union node *n) fixredir(redir, fn.list->text, 1); } break; + case NXHERE: + exphere(redir, &fn); + break; } } } Modified: head/bin/sh/expand.c ============================================================================== --- head/bin/sh/expand.c Sun Feb 3 15:23:28 2013 (r246287) +++ head/bin/sh/expand.c Sun Feb 3 15:54:57 2013 (r246288) @@ -127,19 +127,6 @@ collate_range_cmp(wchar_t c1, wchar_t c2 return (wcscoll(s1, s2)); } -/* - * Expand shell variables and backquotes inside a here document. - * union node *arg the document - * int fd; where to write the expanded version - */ - -void -expandhere(union node *arg, int fd) -{ - expandarg(arg, (struct arglist *)NULL, 0); - xwrite(fd, stackblock(), expdest - stackblock()); -} - static char * stputs_quotes(const char *data, const char *syntax, char *p) { Modified: head/bin/sh/expand.h ============================================================================== --- head/bin/sh/expand.h Sun Feb 3 15:23:28 2013 (r246287) +++ head/bin/sh/expand.h Sun Feb 3 15:54:57 2013 (r246288) @@ -57,7 +57,6 @@ struct arglist { union node; -void expandhere(union node *, int); void expandarg(union node *, struct arglist *, int); void expari(int); void rmescapes(char *); Modified: head/bin/sh/nodetypes ============================================================================== --- head/bin/sh/nodetypes Sun Feb 3 15:23:28 2013 (r246287) +++ head/bin/sh/nodetypes Sun Feb 3 15:54:57 2013 (r246288) @@ -138,6 +138,7 @@ NXHERE nhere # fd<type == NHERE) { - len = strlen(redir->nhere.doc->narg.text); - if (len <= PIPESIZE) { - xwrite(pip[1], redir->nhere.doc->narg.text, len); - goto out; - } + + if (redir->type == NXHERE) + p = redir->nhere.expdoc; + else + p = redir->nhere.doc->narg.text; + len = strlen(p); + if (len <= PIPESIZE) { + xwrite(pip[1], p, len); + goto out; } + if (forkshell((struct job *)NULL, (union node *)NULL, FORK_NOJOB) == 0) { close(pip[0]); signal(SIGINT, SIG_IGN); @@ -270,10 +275,7 @@ openhere(union node *redir) signal(SIGHUP, SIG_IGN); signal(SIGTSTP, SIG_IGN); signal(SIGPIPE, SIG_DFL); - if (redir->type == NHERE) - xwrite(pip[1], redir->nhere.doc->narg.text, len); - else - expandhere(redir->nhere.doc, pip[1]); + xwrite(pip[1], p, len); _exit(0); } out: From owner-svn-src-head@FreeBSD.ORG Sun Feb 3 17:16:34 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 0270387E; Sun, 3 Feb 2013 17:16:33 +0000 (UTC) (envelope-from mckusick@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id DD8D3198; Sun, 3 Feb 2013 17:16:33 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r13HGXH4060304; Sun, 3 Feb 2013 17:16:33 GMT (envelope-from mckusick@svn.freebsd.org) Received: (from mckusick@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r13HGXNP060303; Sun, 3 Feb 2013 17:16:33 GMT (envelope-from mckusick@svn.freebsd.org) Message-Id: <201302031716.r13HGXNP060303@svn.freebsd.org> From: Kirk McKusick Date: Sun, 3 Feb 2013 17:16:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r246289 - head/sys/ufs/ffs X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 03 Feb 2013 17:16:34 -0000 Author: mckusick Date: Sun Feb 3 17:16:32 2013 New Revision: 246289 URL: http://svnweb.freebsd.org/changeset/base/246289 Log: For UFS2 i_blocks is unsigned. The current "sanity" check that it has gone below zero after the blocks in its inode are freed is a no-op which the compiler fails to warn about because of the use of the DIP macro. Change the sanity check to compare the number of blocks being freed against the value i_blocks. If the number of blocks being freed exceeds i_blocks, just set i_blocks to zero. Reported by: Pedro Giffuni (pfg@) MFC after: 2 weeks Modified: head/sys/ufs/ffs/ffs_inode.c Modified: head/sys/ufs/ffs/ffs_inode.c ============================================================================== --- head/sys/ufs/ffs/ffs_inode.c Sun Feb 3 15:54:57 2013 (r246288) +++ head/sys/ufs/ffs/ffs_inode.c Sun Feb 3 17:16:32 2013 (r246289) @@ -546,9 +546,9 @@ done: */ ip->i_size = length; DIP_SET(ip, i_size, length); - DIP_SET(ip, i_blocks, DIP(ip, i_blocks) - blocksreleased); - - if (DIP(ip, i_blocks) < 0) /* sanity */ + if (DIP(ip, i_blocks) >= blocksreleased) + DIP_SET(ip, i_blocks, DIP(ip, i_blocks) - blocksreleased); + else /* sanity */ DIP_SET(ip, i_blocks, 0); ip->i_flag |= IN_CHANGE; #ifdef QUOTA From owner-svn-src-head@FreeBSD.ORG Sun Feb 3 17:24:27 2013 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 45B01DD6; Sun, 3 Feb 2013 17:24:27 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from citadel.icyb.net.ua (citadel.icyb.net.ua [212.40.38.140]) by mx1.freebsd.org (Postfix) with ESMTP id E85101F1; Sun, 3 Feb 2013 17:24:25 +0000 (UTC) Received: from porto.starpoint.kiev.ua (porto-e.starpoint.kiev.ua [212.40.38.100]) by citadel.icyb.net.ua (8.8.8p3/ICyb-2.3exp) with ESMTP id TAA09423; Sun, 03 Feb 2013 19:24:24 +0200 (EET) (envelope-from avg@FreeBSD.org) Received: from localhost ([127.0.0.1]) by porto.starpoint.kiev.ua with esmtp (Exim 4.34 (FreeBSD)) id 1U23Im-0006nL-86; Sun, 03 Feb 2013 19:24:24 +0200 Message-ID: <510E9D47.2030403@FreeBSD.org> Date: Sun, 03 Feb 2013 19:24:23 +0200 From: Andriy Gapon User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:17.0) Gecko/20130121 Thunderbird/17.0.2 MIME-Version: 1.0 To: Kirk McKusick Subject: Re: svn commit: r246289 - head/sys/ufs/ffs References: <201302031716.r13HGXNP060303@svn.freebsd.org> In-Reply-To: <201302031716.r13HGXNP060303@svn.freebsd.org> X-Enigmail-Version: 1.4.6 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 03 Feb 2013 17:24:27 -0000 on 03/02/2013 19:16 Kirk McKusick said the following: > Author: mckusick > Date: Sun Feb 3 17:16:32 2013 > New Revision: 246289 > URL: http://svnweb.freebsd.org/changeset/base/246289 > > Log: > For UFS2 i_blocks is unsigned. The current "sanity" check that it > has gone below zero after the blocks in its inode are freed is a > no-op which the compiler fails to warn about because of the use of > the DIP macro. Change the sanity check to compare the number of Just a note that clang actually warned about this one. It has a few more similar warnings for ufs/ffs code. > blocks being freed against the value i_blocks. If the number of > blocks being freed exceeds i_blocks, just set i_blocks to zero. > > Reported by: Pedro Giffuni (pfg@) > MFC after: 2 weeks > > Modified: > head/sys/ufs/ffs/ffs_inode.c > > Modified: head/sys/ufs/ffs/ffs_inode.c > ============================================================================== > --- head/sys/ufs/ffs/ffs_inode.c Sun Feb 3 15:54:57 2013 (r246288) > +++ head/sys/ufs/ffs/ffs_inode.c Sun Feb 3 17:16:32 2013 (r246289) > @@ -546,9 +546,9 @@ done: > */ > ip->i_size = length; > DIP_SET(ip, i_size, length); > - DIP_SET(ip, i_blocks, DIP(ip, i_blocks) - blocksreleased); > - > - if (DIP(ip, i_blocks) < 0) /* sanity */ > + if (DIP(ip, i_blocks) >= blocksreleased) > + DIP_SET(ip, i_blocks, DIP(ip, i_blocks) - blocksreleased); > + else /* sanity */ > DIP_SET(ip, i_blocks, 0); > ip->i_flag |= IN_CHANGE; > #ifdef QUOTA > -- Andriy Gapon From owner-svn-src-head@FreeBSD.ORG Sun Feb 3 18:42:21 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 16F6E67C; Sun, 3 Feb 2013 18:42:21 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id E3AB86AF; Sun, 3 Feb 2013 18:42:20 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r13IgKxW089610; Sun, 3 Feb 2013 18:42:20 GMT (envelope-from avg@svn.freebsd.org) Received: (from avg@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r13IgK7e089609; Sun, 3 Feb 2013 18:42:20 GMT (envelope-from avg@svn.freebsd.org) Message-Id: <201302031842.r13IgK7e089609@svn.freebsd.org> From: Andriy Gapon Date: Sun, 3 Feb 2013 18:42:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r246293 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 03 Feb 2013 18:42:21 -0000 Author: avg Date: Sun Feb 3 18:42:20 2013 New Revision: 246293 URL: http://svnweb.freebsd.org/changeset/base/246293 Log: zfs: fix, improve and re-organize page_lookup and page_unlock Now they are split into two pairs: page_hold/page_unhold for mappedread and page_busy/page_unbusy for update_pages. For mappedread we simply hold a page that is to be used as a source if it is resident and valid (and not busy). This is sufficient since we are only doing page -> user buffer copying. There is no page <-> backing storage I/O involved. update_pages is now better split to properly handle the putpages case (page -> arc) and the regular write case (arc -> page). For the latter we use complete protocol of marking an object with paging-in-progress and marking a page with io_start (busy count). Also, in this case we remove the write bit from all page mappings and clear dirty bits of the pages, the former is needed to ensure that the latter does the right thing. Additionally we update a page if it is cached instead of just freeing it as was done before. This needs to be verified. A minor detail: ZFS-backed pages should always be either fully valid or fully invalid. Assert this and use simpler API that does not deal with sub-page blocks. Reviewed by: kib MFC after: 26 days Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Sun Feb 3 18:37:08 2013 (r246292) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Sun Feb 3 18:42:20 2013 (r246293) @@ -323,7 +323,7 @@ zfs_ioctl(vnode_t *vp, u_long com, intpt } static vm_page_t -page_lookup(vnode_t *vp, int64_t start, int64_t off, int64_t nbytes) +page_busy(vnode_t *vp, int64_t start, int64_t off, int64_t nbytes) { vm_object_t obj; vm_page_t pp; @@ -333,7 +333,7 @@ page_lookup(vnode_t *vp, int64_t start, for (;;) { if ((pp = vm_page_lookup(obj, OFF_TO_IDX(start))) != NULL && - vm_page_is_valid(pp, (vm_offset_t)off, nbytes)) { + pp->valid) { if ((pp->oflags & VPO_BUSY) != 0) { /* * Reference the page before unlocking and @@ -344,24 +344,74 @@ page_lookup(vnode_t *vp, int64_t start, vm_page_sleep(pp, "zfsmwb"); continue; } - vm_page_busy(pp); - vm_page_undirty(pp); } else { - if (vm_page_is_cached(obj, OFF_TO_IDX(start))) - vm_page_cache_free(obj, OFF_TO_IDX(start), - OFF_TO_IDX(start) + 1); - pp = NULL; + pp = vm_page_alloc(obj, OFF_TO_IDX(start), + VM_ALLOC_SYSTEM | VM_ALLOC_IFCACHED | + VM_ALLOC_NOBUSY); } + + if (pp != NULL) { + ASSERT3U(pp->valid, ==, VM_PAGE_BITS_ALL); + vm_object_pip_add(obj, 1); + vm_page_io_start(pp); + pmap_remove_write(pp); + vm_page_clear_dirty(pp, off, nbytes); + } + break; + } + return (pp); +} + +static void +page_unbusy(vm_page_t pp) +{ + + vm_page_io_finish(pp); + vm_object_pip_subtract(pp->object, 1); +} + +static vm_page_t +page_hold(vnode_t *vp, int64_t start) +{ + vm_object_t obj; + vm_page_t pp; + + obj = vp->v_object; + VM_OBJECT_LOCK_ASSERT(obj, MA_OWNED); + + for (;;) { + if ((pp = vm_page_lookup(obj, OFF_TO_IDX(start))) != NULL && + pp->valid) { + if ((pp->oflags & VPO_BUSY) != 0) { + /* + * Reference the page before unlocking and + * sleeping so that the page daemon is less + * likely to reclaim it. + */ + vm_page_reference(pp); + vm_page_sleep(pp, "zfsmwb"); + continue; + } + + ASSERT3U(pp->valid, ==, VM_PAGE_BITS_ALL); + vm_page_lock(pp); + vm_page_hold(pp); + vm_page_unlock(pp); + + } else + pp = NULL; break; } return (pp); } static void -page_unlock(vm_page_t pp) +page_unhold(vm_page_t pp) { - vm_page_wakeup(pp); + vm_page_lock(pp); + vm_page_unhold(pp); + vm_page_unlock(pp); } static caddr_t @@ -392,6 +442,7 @@ update_pages(vnode_t *vp, int64_t start, { vm_object_t obj; struct sf_buf *sf; + caddr_t va; int off; ASSERT(vp->v_mount != NULL); @@ -402,27 +453,44 @@ update_pages(vnode_t *vp, int64_t start, VM_OBJECT_LOCK(obj); for (start &= PAGEMASK; len > 0; start += PAGESIZE) { vm_page_t pp; - int nbytes = MIN(PAGESIZE - off, len); + int nbytes = imin(PAGESIZE - off, len); - if ((pp = page_lookup(vp, start, off, nbytes)) != NULL) { - caddr_t va; + if (segflg == UIO_NOCOPY) { + pp = vm_page_lookup(obj, OFF_TO_IDX(start)); + KASSERT(pp != NULL, + ("zfs update_pages: NULL page in putpages case")); + KASSERT(off == 0, + ("zfs update_pages: unaligned data in putpages case")); + KASSERT(pp->valid == VM_PAGE_BITS_ALL, + ("zfs update_pages: invalid page in putpages case")); + KASSERT(pp->busy > 0, + ("zfs update_pages: unbusy page in putpages case")); + KASSERT(!pmap_page_is_write_mapped(pp), + ("zfs update_pages: writable page in putpages case")); + VM_OBJECT_UNLOCK(obj); + + va = zfs_map_page(pp, &sf); + (void) dmu_write(os, oid, start, nbytes, va, tx); + zfs_unmap_page(sf); + VM_OBJECT_LOCK(obj); + vm_page_undirty(pp); + } else if ((pp = page_busy(vp, start, off, nbytes)) != NULL) { VM_OBJECT_UNLOCK(obj); + va = zfs_map_page(pp, &sf); - if (segflg == UIO_NOCOPY) { - (void) dmu_write(os, oid, start+off, nbytes, - va+off, tx); - } else { - (void) dmu_read(os, oid, start+off, nbytes, - va+off, DMU_READ_PREFETCH); - } + (void) dmu_read(os, oid, start+off, nbytes, + va+off, DMU_READ_PREFETCH);; zfs_unmap_page(sf); + VM_OBJECT_LOCK(obj); - page_unlock(pp); + page_unbusy(pp); } len -= nbytes; off = 0; } + if (segflg != UIO_NOCOPY) + vm_object_pip_wakeupn(obj, 0); VM_OBJECT_UNLOCK(obj); } @@ -524,7 +592,7 @@ mappedread(vnode_t *vp, int nbytes, uio_ vm_page_t pp; uint64_t bytes = MIN(PAGESIZE - off, len); - if (pp = page_lookup(vp, start, off, bytes)) { + if (pp = page_hold(vp, start)) { struct sf_buf *sf; caddr_t va; @@ -533,7 +601,7 @@ mappedread(vnode_t *vp, int nbytes, uio_ error = uiomove(va + off, bytes, UIO_READ, uio); zfs_unmap_page(sf); VM_OBJECT_LOCK(obj); - page_unlock(pp); + page_unhold(pp); } else { VM_OBJECT_UNLOCK(obj); error = dmu_read_uio(os, zp->z_id, uio, bytes); From owner-svn-src-head@FreeBSD.ORG Sun Feb 3 19:23:22 2013 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 6AEBEF6; Sun, 3 Feb 2013 19:23:22 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from citadel.icyb.net.ua (citadel.icyb.net.ua [212.40.38.140]) by mx1.freebsd.org (Postfix) with ESMTP id 519F07A2; Sun, 3 Feb 2013 19:23:20 +0000 (UTC) Received: from porto.starpoint.kiev.ua (porto-e.starpoint.kiev.ua [212.40.38.100]) by citadel.icyb.net.ua (8.8.8p3/ICyb-2.3exp) with ESMTP id VAA10073; Sun, 03 Feb 2013 21:23:19 +0200 (EET) (envelope-from avg@FreeBSD.org) Received: from localhost ([127.0.0.1]) by porto.starpoint.kiev.ua with esmtp (Exim 4.34 (FreeBSD)) id 1U259q-0006yS-SJ; Sun, 03 Feb 2013 21:23:18 +0200 Message-ID: <510EB926.7030307@FreeBSD.org> Date: Sun, 03 Feb 2013 21:23:18 +0200 From: Andriy Gapon User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:17.0) Gecko/20130121 Thunderbird/17.0.2 MIME-Version: 1.0 To: src-committers@FreeBSD.org, svn-src-all@FreeBSD.org, svn-src-head@FreeBSD.org Subject: Re: svn commit: r246293 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs References: <201302031842.r13IgK7e089609@svn.freebsd.org> In-Reply-To: <201302031842.r13IgK7e089609@svn.freebsd.org> X-Enigmail-Version: 1.4.6 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 03 Feb 2013 19:23:22 -0000 on 03/02/2013 20:42 Andriy Gapon said the following: > - vm_page_busy(pp); > - vm_page_undirty(pp); ZFS lookup_page previously had two interesting bugs that almost canceled each other. The first bug was that vm_page_undirty was called even if we read from a ZFS-backed page into a user buffer. Obviously this action didn't actually magically make the page clean. The second bug was that vm_page_undirty was called without doing pmap_remove_write() first and so, if the page was actually modified, the modified bit leaked back from a pmap to the dirty bits. So no harm was done. On the other hand, if a ZFS-backed dirty page was over-written with a content from ARC (which was first put there from a userland buffer), then the page stayed marked dirty for all the same reason (lack of pmap_remove_write). And so exactly the same data would have to be re-written to ARC / disk again. -- Andriy Gapon From owner-svn-src-head@FreeBSD.ORG Sun Feb 3 19:28:23 2013 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 193EA29F; Sun, 3 Feb 2013 19:28:23 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from citadel.icyb.net.ua (citadel.icyb.net.ua [212.40.38.140]) by mx1.freebsd.org (Postfix) with ESMTP id F38EE7C8; Sun, 3 Feb 2013 19:28:21 +0000 (UTC) Received: from porto.starpoint.kiev.ua (porto-e.starpoint.kiev.ua [212.40.38.100]) by citadel.icyb.net.ua (8.8.8p3/ICyb-2.3exp) with ESMTP id VAA10107; Sun, 03 Feb 2013 21:28:20 +0200 (EET) (envelope-from avg@FreeBSD.org) Received: from localhost ([127.0.0.1]) by porto.starpoint.kiev.ua with esmtp (Exim 4.34 (FreeBSD)) id 1U25Ei-0006z3-3s; Sun, 03 Feb 2013 21:28:20 +0200 Message-ID: <510EBA53.5020003@FreeBSD.org> Date: Sun, 03 Feb 2013 21:28:19 +0200 From: Andriy Gapon User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:17.0) Gecko/20130121 Thunderbird/17.0.2 MIME-Version: 1.0 To: src-committers@FreeBSD.org, svn-src-all@FreeBSD.org, svn-src-head@FreeBSD.org Subject: Re: svn commit: r246293 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs References: <201302031842.r13IgK7e089609@svn.freebsd.org> <510EB926.7030307@FreeBSD.org> In-Reply-To: <510EB926.7030307@FreeBSD.org> X-Enigmail-Version: 1.4.6 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 03 Feb 2013 19:28:23 -0000 on 03/02/2013 21:23 Andriy Gapon said the following: > on 03/02/2013 20:42 Andriy Gapon said the following: >> - vm_page_busy(pp); >> - vm_page_undirty(pp); > > ZFS lookup_page previously had two interesting bugs that almost canceled each other. > > The first bug was that vm_page_undirty was called even if we read from a > ZFS-backed page into a user buffer. Obviously this action didn't actually > magically make the page clean. > The second bug was that vm_page_undirty was called without doing > pmap_remove_write() first and so, if the page was actually modified, the > modified bit leaked back from a pmap to the dirty bits. So no harm was done. > > On the other hand, if a ZFS-backed dirty page was over-written with a content > from ARC (which was first put there from a userland buffer), then the page > stayed marked dirty for all the same reason (lack of pmap_remove_write). And so > exactly the same data would have to be re-written to ARC / disk again. Eh, just realized that on the third hand, this cancelled yet another bug :-) vm_page_undirty was called on the whole page even when only a part of it overlapped with the buffer and thus was supposed to become clean. -- Andriy Gapon From owner-svn-src-head@FreeBSD.ORG Sun Feb 3 20:06:17 2013 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 1466E8F3; Sun, 3 Feb 2013 20:06:17 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from fallbackmx07.syd.optusnet.com.au (fallbackmx07.syd.optusnet.com.au [211.29.132.9]) by mx1.freebsd.org (Postfix) with ESMTP id 918B6872; Sun, 3 Feb 2013 20:06:15 +0000 (UTC) Received: from mail17.syd.optusnet.com.au (mail17.syd.optusnet.com.au [211.29.132.198]) by fallbackmx07.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id r13JxUPq008446; Mon, 4 Feb 2013 06:59:31 +1100 Received: from c211-30-173-106.carlnfd1.nsw.optusnet.com.au (c211-30-173-106.carlnfd1.nsw.optusnet.com.au [211.30.173.106]) by mail17.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id r13JxJ0e029749 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Mon, 4 Feb 2013 06:59:21 +1100 Date: Mon, 4 Feb 2013 06:59:19 +1100 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Andriy Gapon Subject: Re: svn commit: r246289 - head/sys/ufs/ffs In-Reply-To: <510E9D47.2030403@FreeBSD.org> Message-ID: <20130204062149.U2673@besplex.bde.org> References: <201302031716.r13HGXNP060303@svn.freebsd.org> <510E9D47.2030403@FreeBSD.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Optus-CM-Score: 0 X-Optus-CM-Analysis: v=2.0 cv=R7tbgqtX c=1 sm=1 a=3vEzreLPZ8cA:10 a=kj9zAlcOel0A:10 a=PO7r1zJSAAAA:8 a=JzwRw_2MAAAA:8 a=Nw6HGA-A-RMA:10 a=6I5d2MoRAAAA:8 a=Rmwyy1D4dMcYqB4_SWQA:9 a=CjuIK1q_8ugA:10 a=NUYoatYP61qPMpeu:21 a=N0skziyQfKIhW4rn:21 a=TEtd8y5WR3g2ypngnwZWYw==:117 Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org, Kirk McKusick X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 03 Feb 2013 20:06:17 -0000 On Sun, 3 Feb 2013, Andriy Gapon wrote: > on 03/02/2013 19:16 Kirk McKusick said the following: >> Author: mckusick >> Date: Sun Feb 3 17:16:32 2013 >> New Revision: 246289 >> URL: http://svnweb.freebsd.org/changeset/base/246289 >> >> Log: >> For UFS2 i_blocks is unsigned. The current "sanity" check that it >> has gone below zero after the blocks in its inode are freed is a >> no-op which the compiler fails to warn about because of the use of >> the DIP macro. Change the sanity check to compare the number of > > Just a note that clang actually warned about this one. > It has a few more similar warnings for ufs/ffs code. I wondered how the DIP macro hid the warning. >> blocks being freed against the value i_blocks. If the number of >> blocks being freed exceeds i_blocks, just set i_blocks to zero. >> >> Reported by: Pedro Giffuni (pfg@) >> MFC after: 2 weeks Perhaps the larger bugs pointed to this warning were lost in translation: - di_blocks overflows for ffs1. This is now physically possible. di_blocks has type int32_t, as required to match st_blocks in the old struct stat (both will overflow at the same point). Since di_blocks counts DEV_BSIZE-blocks, overflow occurs at file size about 1TB for files without many holes. - st_blocks overflows for the old stat() syscall. For the new stat() syscall, st_blocks has type blkcnt_t = int64_t, so overflow is not physically possible. But cvtstat() silently overflows when the 64-bit st_blocks doesn't fit in the 32-bit one. - di_blocks for ffs2 has type uint64_t. This has a sign mismatch with both the ffs1 di_blocks and blkcnt_t. blkcnt_t is specified to be signed. i_blocks for ffs has the same type as di_blocks for ffs2 (unsigned ...), so it is mismatched too. The sign mismatches should cause more compiler warnings. These would point to further overflow possibilities. However, overflow is physically impossible even for va_bytes = i_blocks * DEV_BSIZE. So there are no extra overflows from the sign mismatches. Using the unsigned types just asks for more sign extension bugs like the one fixed here. ext2fs has the same bug. It is unnecessary in ext2fs, since there are no fragments so i_blocks can just count in units of fs blocks and these are naturally limited by the fs block type. The fs block type is uint32_t in ext2fs and int32_t in ffs1. So ext2fs really needs an unsigned type for i_blocks to get an extra bit without going to 64 bits. shell-init: could not get current directory: No such file or directory. Avoiding overflow depends on st_blocks having more than 32+9 value bits, so 32-bit stat() could still overflow and needs a clamp. However, the disk format is to store i_count in DEV_BSIZE units, so this doesn't work -- it has the same overflow problem as cvtstat(), at 32 bits instead of 31. Limiting the file size to ~1TB is not a good fix for this, since 1TB non-sparse files are not very common or useful, and the limit would also apply to sparse files. So block allocators should check that i_blocks won't overflow before increasing it. Bruce From owner-svn-src-head@FreeBSD.ORG Sun Feb 3 20:35:38 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 4CF868A8; Sun, 3 Feb 2013 20:35:38 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 3D1D296C; Sun, 3 Feb 2013 20:35:38 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r13KZc0r031801; Sun, 3 Feb 2013 20:35:38 GMT (envelope-from pfg@svn.freebsd.org) Received: (from pfg@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r13KZc6o031800; Sun, 3 Feb 2013 20:35:38 GMT (envelope-from pfg@svn.freebsd.org) Message-Id: <201302032035.r13KZc6o031800@svn.freebsd.org> From: "Pedro F. Giffuni" Date: Sun, 3 Feb 2013 20:35:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r246296 - head/usr.sbin/crunch/crunchide X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 03 Feb 2013 20:35:38 -0000 Author: pfg Date: Sun Feb 3 20:35:37 2013 New Revision: 246296 URL: http://svnweb.freebsd.org/changeset/base/246296 Log: crunchide(1): support non-custom elf object layout The crunchide utility presumes the last 3 chunks of an ELF object layout are section headers, symbol table, and then string table. However, this is not specified in the ELF standards, and linkers may generate different layouts when doing partial linking (-r). This change is required to build FreeBSD with mclinker or the gold linker. PR: bin/174011 Submitted by: Pete Chou Reviewed by: Cristoph Mallon MFC after: 2 weeks Modified: head/usr.sbin/crunch/crunchide/exec_elf32.c Modified: head/usr.sbin/crunch/crunchide/exec_elf32.c ============================================================================== --- head/usr.sbin/crunch/crunchide/exec_elf32.c Sun Feb 3 20:13:33 2013 (r246295) +++ head/usr.sbin/crunch/crunchide/exec_elf32.c Sun Feb 3 20:35:37 2013 (r246296) @@ -45,6 +45,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include #include @@ -82,11 +83,9 @@ __FBSDID("$FreeBSD$"); #define xe32toh(x) ((data == ELFDATA2MSB) ? be32toh(x) : le32toh(x)) #define htoxe32(x) ((data == ELFDATA2MSB) ? htobe32(x) : htole32(x)) -struct listelem { - struct listelem *next; - void *mem; - off_t file; - size_t size; +struct shlayout { + Elf_Shdr *shdr; + void *bufp; }; static ssize_t @@ -235,17 +234,20 @@ int ELFNAMEEND(hide)(int fd, const char *fn) { Elf_Ehdr ehdr; - Elf_Shdr *shdrp = NULL, *symtabshdr, *strtabshdr; + struct shlayout *layoutp = NULL; + Elf_Shdr *shdrp = NULL, *symtabshdr, *strtabshdr, *shstrtabshdr; + Elf_Shdr shdrshdr; Elf_Sym *symtabp = NULL; - char *strtabp = NULL; - Elf_Size nsyms, ewi; + char *shstrtabp = NULL, *strtabp = NULL; + Elf_Size nsyms, ewi; + Elf_Off off; ssize_t shdrsize; - int rv, i, weird; - size_t nstrtab_size, nstrtab_nextoff, fn_size; + int rv, i, weird, l, m, r, strtabidx; + size_t nstrtab_size, nstrtab_nextoff, fn_size, size; char *nstrtabp = NULL; unsigned char data; - Elf_Off maxoff, stroff; const char *weirdreason = NULL; + void *buf; rv = 0; if (xreadatoff(fd, &ehdr, 0, sizeof ehdr, fn) != sizeof ehdr) @@ -260,62 +262,123 @@ ELFNAMEEND(hide)(int fd, const char *fn) shdrsize) goto bad; - symtabshdr = strtabshdr = NULL; + symtabshdr = strtabshdr = shstrtabshdr = NULL; weird = 0; - maxoff = stroff = 0; for (i = 0; i < xe16toh(ehdr.e_shnum); i++) { - if (xewtoh(shdrp[i].sh_offset) > maxoff) - maxoff = xewtoh(shdrp[i].sh_offset); switch (xe32toh(shdrp[i].sh_type)) { case SHT_SYMTAB: - if (symtabshdr != NULL) + if (symtabshdr != NULL) { weird = 1; + weirdreason = "multiple symbol tables"; + } symtabshdr = &shdrp[i]; strtabshdr = &shdrp[xe32toh(shdrp[i].sh_link)]; - - /* Check whether the string table is the last section */ - stroff = xewtoh(shdrp[xe32toh(shdrp[i].sh_link)].sh_offset); - if (!weird && xe32toh(shdrp[i].sh_link) != (xe16toh(ehdr.e_shnum) - 1)) { - weird = 1; - weirdreason = "string table not last section"; - } + break; + case SHT_STRTAB: + if (i == xe16toh(ehdr.e_shstrndx)) + shstrtabshdr = &shdrp[i]; break; } } - if (! weirdreason) - weirdreason = "unsupported"; if (symtabshdr == NULL) goto out; - if (strtabshdr == NULL) + if (strtabshdr == NULL) { weird = 1; - if (!weird && stroff != maxoff) { + weirdreason = "string table does not exist"; + } + if (shstrtabshdr == NULL) { weird = 1; - weirdreason = "string table section not last in file"; - } + weirdreason = "section header string table does not exist"; + } + if (weirdreason == NULL) + weirdreason = "unsupported"; if (weird) { fprintf(stderr, "%s: weird executable (%s)\n", fn, weirdreason); goto bad; } /* + * sort section layout table by offset + */ + layoutp = xmalloc(sizeof(struct shlayout) * (xe16toh(ehdr.e_shnum) + 1), + fn, "layout table"); + if (layoutp == NULL) + goto bad; + + /* add a pseudo entry to represent the section header table */ + shdrshdr.sh_offset = ehdr.e_shoff; + shdrshdr.sh_size = htoxew(shdrsize); + shdrshdr.sh_addralign = htoxew(ELFSIZE / 8); + layoutp[xe16toh(ehdr.e_shnum)].shdr = &shdrshdr; + + /* insert and sort normal section headers */ + for (i = xe16toh(ehdr.e_shnum) - 1; i >= 0; i--) { + l = i + 1; + r = xe16toh(ehdr.e_shnum); + while (l <= r) { + m = ( l + r) / 2; + if (xewtoh(shdrp[i].sh_offset) > + xewtoh(layoutp[m].shdr->sh_offset)) + l = m + 1; + else + r = m - 1; + } + + if (r != i) { + memmove(&layoutp[i], &layoutp[i + 1], + sizeof(struct shlayout) * (r - i)); + } + + layoutp[r].shdr = &shdrp[i]; + layoutp[r].bufp = NULL; + } + + /* * load up everything we need */ - /* symbol table */ - if ((symtabp = xmalloc(xewtoh(symtabshdr->sh_size), fn, "symbol table")) - == NULL) - goto bad; - if ((size_t)xreadatoff(fd, symtabp, xewtoh(symtabshdr->sh_offset), - xewtoh(symtabshdr->sh_size), fn) != xewtoh(symtabshdr->sh_size)) + /* load section string table for debug use */ + if ((shstrtabp = xmalloc(xewtoh(shstrtabshdr->sh_size), fn, + "section string table")) == NULL) + goto bad; + if ((size_t)xreadatoff(fd, shstrtabp, xewtoh(shstrtabshdr->sh_offset), + xewtoh(shstrtabshdr->sh_size), fn) != xewtoh(shstrtabshdr->sh_size)) goto bad; - /* string table */ - if ((strtabp = xmalloc(xewtoh(strtabshdr->sh_size), fn, "string table")) - == NULL) - goto bad; - if ((size_t)xreadatoff(fd, strtabp, xewtoh(strtabshdr->sh_offset), - xewtoh(strtabshdr->sh_size), fn) != xewtoh(strtabshdr->sh_size)) - goto bad; + /* we need symtab, strtab, and everything behind strtab */ + strtabidx = INT_MAX; + for (i = 0; i < xe16toh(ehdr.e_shnum) + 1; i++) { + if (layoutp[i].shdr == &shdrshdr) { + /* not load section header again */ + layoutp[i].bufp = shdrp; + continue; + } + if (layoutp[i].shdr == shstrtabshdr) { + /* not load section string table again */ + layoutp[i].bufp = shstrtabp; + continue; + } + + if (layoutp[i].shdr == strtabshdr) + strtabidx = i; + if (layoutp[i].shdr == symtabshdr || i >= strtabidx) { + off = xewtoh(layoutp[i].shdr->sh_offset); + size = xewtoh(layoutp[i].shdr->sh_size); + layoutp[i].bufp = xmalloc(size, fn, + shstrtabp + xewtoh(layoutp[i].shdr->sh_name)); + if (layoutp[i].bufp == NULL) + goto bad; + if ((size_t)xreadatoff(fd, layoutp[i].bufp, off, size, fn) != + size) + goto bad; + + /* set symbol table and string table */ + if (layoutp[i].shdr == symtabshdr) + symtabp = layoutp[i].bufp; + else if (layoutp[i].shdr == strtabshdr) + strtabp = layoutp[i].bufp; + } + } nstrtab_size = 256; nstrtabp = xmalloc(nstrtab_size, fn, "new string table"); @@ -365,28 +428,62 @@ ELFNAMEEND(hide)(int fd, const char *fn) strtabshdr->sh_size = htoxew(nstrtab_nextoff); /* - * write new tables to the file + * update section header table in ascending order of offset */ - if (xwriteatoff(fd, shdrp, xewtoh(ehdr.e_shoff), shdrsize, fn) != - shdrsize) - goto bad; - if ((size_t)xwriteatoff(fd, symtabp, xewtoh(symtabshdr->sh_offset), - xewtoh(symtabshdr->sh_size), fn) != xewtoh(symtabshdr->sh_size)) - goto bad; - /* write new symbol table strings */ - if ((size_t)xwriteatoff(fd, nstrtabp, xewtoh(strtabshdr->sh_offset), - xewtoh(strtabshdr->sh_size), fn) != xewtoh(strtabshdr->sh_size)) - goto bad; + for (i = strtabidx + 1; i < xe16toh(ehdr.e_shnum) + 1; i++) { + Elf_Off off, align; + off = xewtoh(layoutp[i - 1].shdr->sh_offset) + + xewtoh(layoutp[i - 1].shdr->sh_size); + align = xewtoh(layoutp[i].shdr->sh_addralign); + off = (off + (align - 1)) & ~(align - 1); + layoutp[i].shdr->sh_offset = htoxew(off); + } + + /* + * write data to the file in descending order of offset + */ + for (i = xe16toh(ehdr.e_shnum); i >= 0; i--) { + if (layoutp[i].shdr == strtabshdr) { + /* new string table */ + buf = nstrtabp; + } else + buf = layoutp[i].bufp; + + if (layoutp[i].shdr == &shdrshdr || + layoutp[i].shdr == symtabshdr || i >= strtabidx) { + if (buf == NULL) + goto bad; + + /* + * update the offset of section header table in elf + * header if needed. + */ + if (layoutp[i].shdr == &shdrshdr && + ehdr.e_shoff != shdrshdr.sh_offset) { + ehdr.e_shoff = shdrshdr.sh_offset; + off = (ELFSIZE == 32) ? 32 : 44; + size = sizeof(Elf_Off); + if ((size_t)xwriteatoff(fd, &ehdr.e_shoff, off, size, + fn) != size) + goto bad; + } + + off = xewtoh(layoutp[i].shdr->sh_offset); + size = xewtoh(layoutp[i].shdr->sh_size); + if ((size_t)xwriteatoff(fd, buf, off, size, fn) != size) + goto bad; + } + } out: - if (shdrp != NULL) - free(shdrp); - if (symtabp != NULL) - free(symtabp); - if (strtabp != NULL) - free(strtabp); - if (nstrtabp != NULL) - free(nstrtabp); + if (layoutp != NULL) { + for (i = 0; i < xe16toh(ehdr.e_shnum) + 1; i++) { + if (layoutp[i].bufp != NULL) + free(layoutp[i].bufp); + } + free(layoutp); + } + free(nstrtabp); return (rv); bad: From owner-svn-src-head@FreeBSD.ORG Sun Feb 3 20:40:42 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id ACBF0A39; Sun, 3 Feb 2013 20:40:42 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 70E60984; Sun, 3 Feb 2013 20:40:42 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r13Kegi5032649; Sun, 3 Feb 2013 20:40:42 GMT (envelope-from dim@svn.freebsd.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r13KegBV032648; Sun, 3 Feb 2013 20:40:42 GMT (envelope-from dim@svn.freebsd.org) Message-Id: <201302032040.r13KegBV032648@svn.freebsd.org> From: Dimitry Andric Date: Sun, 3 Feb 2013 20:40:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r246297 - head/lib/libcxxrt X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 03 Feb 2013 20:40:42 -0000 Author: dim Date: Sun Feb 3 20:40:41 2013 New Revision: 246297 URL: http://svnweb.freebsd.org/changeset/base/246297 Log: Add several missing symbols to libcxxrt's symbol version map, and remove a few duplicates. This should fix building world with -stdlib=libc++ after r246028. Submitted by: Yamaya Takashi MFC after: 1 week X-MFC-With: r246028 Modified: head/lib/libcxxrt/Version.map Modified: head/lib/libcxxrt/Version.map ============================================================================== --- head/lib/libcxxrt/Version.map Sun Feb 3 20:35:37 2013 (r246296) +++ head/lib/libcxxrt/Version.map Sun Feb 3 20:40:41 2013 (r246297) @@ -208,7 +208,6 @@ CXXABI_1.3 { "typeinfo name for __cxxabiv1::__vmi_class_type_info"; "std::type_info::type_info(std::type_info const&)"; - "std::type_info::type_info(std::type_info const&)"; "std::type_info::operator=(std::type_info const&)"; @@ -238,18 +237,16 @@ CXXRT_1.0 { "std::type_info::operator!=(std::type_info const&) const"; "std::bad_cast::bad_cast(std::bad_cast const&)"; "std::bad_cast::bad_cast()"; - "std::bad_cast::bad_cast(std::bad_cast const&)"; - "std::bad_cast::bad_cast()"; "std::bad_cast::operator=(std::bad_cast const&)"; - "std::exception::exception(std::exception const&)"; - "std::exception::exception()"; + "std::bad_typeid::bad_typeid(std::bad_typeid const&)"; + "std::bad_typeid::bad_typeid()"; + "std::bad_typeid::operator=(std::bad_typeid const&)"; "std::exception::exception(std::exception const&)"; "std::exception::exception()"; "std::exception::operator=(std::exception const&)"; - - - - + "std::bad_alloc::bad_alloc(std::bad_alloc const&)"; + "std::bad_alloc::bad_alloc()"; + "std::bad_alloc::operator=(std::bad_alloc const&)"; }; __cxa_allocate_dependent_exception; @@ -281,15 +278,16 @@ GLIBCXX_3.4 { "std::type_info::~type_info()"; "std::bad_cast::~bad_cast()"; + "std::bad_typeid::~bad_typeid()"; "std::exception::~exception()"; + "std::bad_alloc::~bad_alloc()"; + + "std::exception::what() const"; std::set_new_handler*; std::set_terminate*; std::set_unexpected*; - std::exception*; - std::bad_alloc; - std::bad_typeid; - std::type_info*; + std::type_info::__*; "vtable for std::bad_alloc"; "vtable for std::bad_cast"; @@ -299,10 +297,10 @@ GLIBCXX_3.4 { "typeinfo for std::bad_alloc"; "typeinfo for std::bad_typeid"; - "typeinfo for std::exception"; "typeinfo for std::bad_cast"; "typeinfo for std::exception"; "typeinfo for std::type_info"; + "typeinfo name for std::bad_alloc"; "typeinfo name for std::bad_typeid"; "typeinfo name for std::bad_cast"; "typeinfo name for std::exception"; From owner-svn-src-head@FreeBSD.ORG Sun Feb 3 21:16:35 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 37EFA71E; Sun, 3 Feb 2013 21:16:35 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 1A4E7AA5; Sun, 3 Feb 2013 21:16:35 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r13LGYOo044902; Sun, 3 Feb 2013 21:16:34 GMT (envelope-from pfg@svn.freebsd.org) Received: (from pfg@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r13LGYKQ044901; Sun, 3 Feb 2013 21:16:34 GMT (envelope-from pfg@svn.freebsd.org) Message-Id: <201302032116.r13LGYKQ044901@svn.freebsd.org> From: "Pedro F. Giffuni" Date: Sun, 3 Feb 2013 21:16:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r246298 - head/usr.sbin/crunch/crunchide X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 03 Feb 2013 21:16:35 -0000 Author: pfg Date: Sun Feb 3 21:16:33 2013 New Revision: 246298 URL: http://svnweb.freebsd.org/changeset/base/246298 Log: crunchide(1): Put e_shnum into a local variable. This simplifies the code a bit. Submitted by: Cristoph Mallon MFC after: 2 weeks Modified: head/usr.sbin/crunch/crunchide/exec_elf32.c Modified: head/usr.sbin/crunch/crunchide/exec_elf32.c ============================================================================== --- head/usr.sbin/crunch/crunchide/exec_elf32.c Sun Feb 3 20:40:41 2013 (r246297) +++ head/usr.sbin/crunch/crunchide/exec_elf32.c Sun Feb 3 21:16:33 2013 (r246298) @@ -248,14 +248,16 @@ ELFNAMEEND(hide)(int fd, const char *fn) unsigned char data; const char *weirdreason = NULL; void *buf; + Elf_Half shnum; rv = 0; if (xreadatoff(fd, &ehdr, 0, sizeof ehdr, fn) != sizeof ehdr) goto bad; data = ehdr.e_ident[EI_DATA]; + shnum = xe16toh(ehdr.e_shnum); - shdrsize = xe16toh(ehdr.e_shnum) * xe16toh(ehdr.e_shentsize); + shdrsize = shnum * xe16toh(ehdr.e_shentsize); if ((shdrp = xmalloc(shdrsize, fn, "section header table")) == NULL) goto bad; if (xreadatoff(fd, shdrp, xewtoh(ehdr.e_shoff), shdrsize, fn) != @@ -264,7 +266,7 @@ ELFNAMEEND(hide)(int fd, const char *fn) symtabshdr = strtabshdr = shstrtabshdr = NULL; weird = 0; - for (i = 0; i < xe16toh(ehdr.e_shnum); i++) { + for (i = 0; i < shnum; i++) { switch (xe32toh(shdrp[i].sh_type)) { case SHT_SYMTAB: if (symtabshdr != NULL) { @@ -300,7 +302,7 @@ ELFNAMEEND(hide)(int fd, const char *fn) /* * sort section layout table by offset */ - layoutp = xmalloc(sizeof(struct shlayout) * (xe16toh(ehdr.e_shnum) + 1), + layoutp = xmalloc((shnum + 1) * sizeof(struct shlayout), fn, "layout table"); if (layoutp == NULL) goto bad; @@ -309,12 +311,12 @@ ELFNAMEEND(hide)(int fd, const char *fn) shdrshdr.sh_offset = ehdr.e_shoff; shdrshdr.sh_size = htoxew(shdrsize); shdrshdr.sh_addralign = htoxew(ELFSIZE / 8); - layoutp[xe16toh(ehdr.e_shnum)].shdr = &shdrshdr; + layoutp[shnum].shdr = &shdrshdr; /* insert and sort normal section headers */ - for (i = xe16toh(ehdr.e_shnum) - 1; i >= 0; i--) { + for (i = shnum; i-- != 0;) { l = i + 1; - r = xe16toh(ehdr.e_shnum); + r = shnum; while (l <= r) { m = ( l + r) / 2; if (xewtoh(shdrp[i].sh_offset) > @@ -332,6 +334,7 @@ ELFNAMEEND(hide)(int fd, const char *fn) layoutp[r].shdr = &shdrp[i]; layoutp[r].bufp = NULL; } + ++shnum; /* * load up everything we need @@ -347,7 +350,7 @@ ELFNAMEEND(hide)(int fd, const char *fn) /* we need symtab, strtab, and everything behind strtab */ strtabidx = INT_MAX; - for (i = 0; i < xe16toh(ehdr.e_shnum) + 1; i++) { + for (i = 0; i < shnum; i++) { if (layoutp[i].shdr == &shdrshdr) { /* not load section header again */ layoutp[i].bufp = shdrp; @@ -430,7 +433,7 @@ ELFNAMEEND(hide)(int fd, const char *fn) /* * update section header table in ascending order of offset */ - for (i = strtabidx + 1; i < xe16toh(ehdr.e_shnum) + 1; i++) { + for (i = strtabidx + 1; i < shnum; i++) { Elf_Off off, align; off = xewtoh(layoutp[i - 1].shdr->sh_offset) + xewtoh(layoutp[i - 1].shdr->sh_size); @@ -442,7 +445,7 @@ ELFNAMEEND(hide)(int fd, const char *fn) /* * write data to the file in descending order of offset */ - for (i = xe16toh(ehdr.e_shnum); i >= 0; i--) { + for (i = shnum; i-- != 0;) { if (layoutp[i].shdr == strtabshdr) { /* new string table */ buf = nstrtabp; @@ -477,7 +480,7 @@ ELFNAMEEND(hide)(int fd, const char *fn) out: if (layoutp != NULL) { - for (i = 0; i < xe16toh(ehdr.e_shnum) + 1; i++) { + for (i = 0; i < shnum; i++) { if (layoutp[i].bufp != NULL) free(layoutp[i].bufp); } From owner-svn-src-head@FreeBSD.ORG Sun Feb 3 21:30:02 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id E02DFC7D; Sun, 3 Feb 2013 21:30:02 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id D370FB08; Sun, 3 Feb 2013 21:30:02 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r13LU2S3048632; Sun, 3 Feb 2013 21:30:02 GMT (envelope-from pfg@svn.freebsd.org) Received: (from pfg@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r13LU29q048631; Sun, 3 Feb 2013 21:30:02 GMT (envelope-from pfg@svn.freebsd.org) Message-Id: <201302032130.r13LU29q048631@svn.freebsd.org> From: "Pedro F. Giffuni" Date: Sun, 3 Feb 2013 21:30:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r246299 - head/sys/ufs/ufs X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 03 Feb 2013 21:30:03 -0000 Author: pfg Date: Sun Feb 3 21:30:02 2013 New Revision: 246299 URL: http://svnweb.freebsd.org/changeset/base/246299 Log: UFS: Remove dead assignment. Submitted by: Christoph Mallon MFC after: 3 days Modified: head/sys/ufs/ufs/ufs_lookup.c Modified: head/sys/ufs/ufs/ufs_lookup.c ============================================================================== --- head/sys/ufs/ufs/ufs_lookup.c Sun Feb 3 21:16:33 2013 (r246298) +++ head/sys/ufs/ufs/ufs_lookup.c Sun Feb 3 21:30:02 2013 (r246299) @@ -1434,7 +1434,6 @@ ufs_checkpath(ino_t source_ino, ino_t pa return (0); if (target->i_number == ROOTINO) return (0); - error = 0; for (;;) { error = ufs_dir_dd_ino(vp, cred, &dd_ino); if (error != 0) From owner-svn-src-head@FreeBSD.ORG Sun Feb 3 21:30:30 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 36A8EDEE; Sun, 3 Feb 2013 21:30:30 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 2827BB0F; Sun, 3 Feb 2013 21:30:30 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r13LUUqF050142; Sun, 3 Feb 2013 21:30:30 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r13LUUTj050140; Sun, 3 Feb 2013 21:30:30 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201302032130.r13LUUTj050140@svn.freebsd.org> From: Marius Strobl Date: Sun, 3 Feb 2013 21:30:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r246300 - head/sys/dev/uart X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 03 Feb 2013 21:30:30 -0000 Author: marius Date: Sun Feb 3 21:30:29 2013 New Revision: 246300 URL: http://svnweb.freebsd.org/changeset/base/246300 Log: - Make pci_ns8250_ids[] const. - Use DEVMETHOD_END. - Use NULL instead of 0 for pointers. MFC after: 1 week Modified: head/sys/dev/uart/uart_bus_pci.c Modified: head/sys/dev/uart/uart_bus_pci.c ============================================================================== --- head/sys/dev/uart/uart_bus_pci.c Sun Feb 3 21:30:02 2013 (r246299) +++ head/sys/dev/uart/uart_bus_pci.c Sun Feb 3 21:30:29 2013 (r246300) @@ -52,7 +52,7 @@ static device_method_t uart_pci_methods[ DEVMETHOD(device_attach, uart_bus_attach), DEVMETHOD(device_detach, uart_bus_detach), DEVMETHOD(device_resume, uart_bus_resume), - { 0, 0 } + DEVMETHOD_END }; static driver_t uart_pci_driver = { @@ -71,7 +71,7 @@ struct pci_id { int rclk; }; -static struct pci_id pci_ns8250_ids[] = { +static const struct pci_id pci_ns8250_ids[] = { { 0x1028, 0x0008, 0xffff, 0, "Dell Remote Access Card III", 0x14, 128 * DEFAULT_RCLK }, { 0x1028, 0x0012, 0xffff, 0, "Dell RAC 4 Daughter Card Virtual UART", 0x14, @@ -134,8 +134,8 @@ static struct pci_id pci_ns8250_ids[] = { 0xffff, 0, 0xffff, 0, NULL, 0, 0} }; -static struct pci_id * -uart_pci_match(device_t dev, struct pci_id *id) +const static struct pci_id * +uart_pci_match(device_t dev, const struct pci_id *id) { uint16_t device, subdev, subven, vendor; @@ -160,7 +160,7 @@ static int uart_pci_probe(device_t dev) { struct uart_softc *sc; - struct pci_id *id; + const struct pci_id *id; sc = device_get_softc(dev); @@ -178,4 +178,4 @@ uart_pci_probe(device_t dev) return (uart_bus_probe(dev, 0, id->rclk, id->rid, 0)); } -DRIVER_MODULE(uart, pci, uart_pci_driver, uart_devclass, 0, 0); +DRIVER_MODULE(uart, pci, uart_pci_driver, uart_devclass, NULL, NULL); From owner-svn-src-head@FreeBSD.ORG Sun Feb 3 21:43:56 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id A8EB5327; Sun, 3 Feb 2013 21:43:56 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 84A3FB79; Sun, 3 Feb 2013 21:43:56 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r13LhuWW053812; Sun, 3 Feb 2013 21:43:56 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r13LhuQ3053811; Sun, 3 Feb 2013 21:43:56 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201302032143.r13LhuQ3053811@svn.freebsd.org> From: Marius Strobl Date: Sun, 3 Feb 2013 21:43:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r246301 - head/sys/kern X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 03 Feb 2013 21:43:56 -0000 Author: marius Date: Sun Feb 3 21:43:55 2013 New Revision: 246301 URL: http://svnweb.freebsd.org/changeset/base/246301 Log: Further improve r242655 and supply VM_{MIN,MAX}_KERNEL_ADDRESS as constant values to SYSCTL_ULONG(9) where possible. Submitted by: bde Modified: head/sys/kern/kern_malloc.c Modified: head/sys/kern/kern_malloc.c ============================================================================== --- head/sys/kern/kern_malloc.c Sun Feb 3 21:30:29 2013 (r246300) +++ head/sys/kern/kern_malloc.c Sun Feb 3 21:43:55 2013 (r246301) @@ -186,15 +186,16 @@ struct { */ static uma_zone_t mt_zone; -static vm_offset_t vm_min_kernel_address = VM_MIN_KERNEL_ADDRESS; -SYSCTL_ULONG(_vm, OID_AUTO, min_kernel_address, CTLFLAG_RD, - &vm_min_kernel_address, 0, "Min kernel address"); +SYSCTL_ULONG(_vm, OID_AUTO, min_kernel_address, CTLFLAG_RD, NULL, + VM_MIN_KERNEL_ADDRESS, "Min kernel address"); +SYSCTL_ULONG(_vm, OID_AUTO, max_kernel_address, CTLFLAG_RD, #ifndef __sparc64__ -static vm_offset_t vm_max_kernel_address = VM_MAX_KERNEL_ADDRESS; + NULL, VM_MAX_KERNEL_ADDRESS, +#else + &vm_max_kernel_address, 0, #endif -SYSCTL_ULONG(_vm, OID_AUTO, max_kernel_address, CTLFLAG_RD, - &vm_max_kernel_address, 0, "Max kernel address"); + "Max kernel address"); u_long vm_kmem_size; SYSCTL_ULONG(_vm, OID_AUTO, kmem_size, CTLFLAG_RDTUN, &vm_kmem_size, 0, @@ -592,7 +593,6 @@ free(void *addr, struct malloc_type *mtp panic("free: address %p(%p) has not been allocated.\n", addr, (void *)((u_long)addr & (~UMA_SLAB_MASK))); - if (!(slab->us_flags & UMA_SLAB_MALLOC)) { #ifdef INVARIANTS struct malloc_type **mtpp = addr; From owner-svn-src-head@FreeBSD.ORG Mon Feb 4 01:23:24 2013 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id A9EF8861; Mon, 4 Feb 2013 01:23:24 +0000 (UTC) (envelope-from tim@kientzle.com) Received: from monday.kientzle.com (99-115-135-74.uvs.sntcca.sbcglobal.net [99.115.135.74]) by mx1.freebsd.org (Postfix) with ESMTP id 66F08334; Mon, 4 Feb 2013 01:23:24 +0000 (UTC) Received: (from root@localhost) by monday.kientzle.com (8.14.4/8.14.4) id r141NNs3076280; Mon, 4 Feb 2013 01:23:23 GMT (envelope-from tim@kientzle.com) Received: from [192.168.2.143] (CiscoE3000 [192.168.1.65]) by kientzle.com with SMTP id ygkna2h59626rx83acrxh68vww; Mon, 04 Feb 2013 01:23:23 +0000 (UTC) (envelope-from tim@kientzle.com) Subject: Re: svn commit: r245803 - in head: . gnu/usr.bin share/man/man5 share/mk usr.bin/dtc Mime-Version: 1.0 (Apple Message framework v1283) Content-Type: text/plain; charset=us-ascii From: Tim Kientzle In-Reply-To: <201301221749.r0MHnpbC053016@svn.freebsd.org> Date: Sun, 3 Feb 2013 17:23:23 -0800 Content-Transfer-Encoding: quoted-printable Message-Id: <10F3BA43-0299-4492-8064-EBFAD7AC5AC7@kientzle.com> References: <201301221749.r0MHnpbC053016@svn.freebsd.org> To: David Chisnall X-Mailer: Apple Mail (2.1283) Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 04 Feb 2013 01:23:24 -0000 I'm finding it rather annoying that dtc isn't installed on systems that use device trees. Would there be any negative fallout from installing /usr/bin/dtc as part of the regular world? Tim P.S. In particular, I'm moving away from compiled-in device trees (in favor of having the loader read it from a separate file) in part so that the device tree file can be adjusted without having to recompile the kernel. On Jan 22, 2013, at 9:49 AM, David Chisnall wrote: > Author: theraven > Date: Tue Jan 22 17:49:51 2013 > New Revision: 245803 > URL: http://svnweb.freebsd.org/changeset/base/245803 >=20 > Log: > Import new (BSDL) device tree compiler. Now built by default, so = that it can't > be used on the host system (and not installed on the device, if = required). The > GPL'd one is still available if there are any devices that need it = (make > universe passes with it, including kernels that use fdt, but there = may be some > out-of-tree ones). WITH_GPL_DTC can be used to select the old one, = for now. >=20 > Probably won't be MFC'd, but we'll remove the GPL'd version in head = after the > new one has had a lot more testing and ship it in 10.0. >=20 > Added: > head/usr.bin/dtc/ > head/usr.bin/dtc/HACKING (contents, props changed) > head/usr.bin/dtc/Makefile (contents, props changed) > head/usr.bin/dtc/checking.cc (contents, props changed) > head/usr.bin/dtc/checking.hh (contents, props changed) > head/usr.bin/dtc/dtb.cc (contents, props changed) > head/usr.bin/dtc/dtb.hh (contents, props changed) > head/usr.bin/dtc/dtc.1 (contents, props changed) > head/usr.bin/dtc/dtc.cc (contents, props changed) > head/usr.bin/dtc/fdt.cc (contents, props changed) > head/usr.bin/dtc/fdt.hh (contents, props changed) > head/usr.bin/dtc/input_buffer.cc (contents, props changed) > head/usr.bin/dtc/input_buffer.hh (contents, props changed) > head/usr.bin/dtc/string.cc (contents, props changed) > head/usr.bin/dtc/string.hh (contents, props changed) > head/usr.bin/dtc/util.hh (contents, props changed) > Modified: > head/Makefile.inc1 > head/gnu/usr.bin/Makefile > head/share/man/man5/src.conf.5 > head/share/mk/bsd.own.mk >=20 > Modified: head/Makefile.inc1 > = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D > --- head/Makefile.inc1 Tue Jan 22 17:21:08 2013 = (r245802) > +++ head/Makefile.inc1 Tue Jan 22 17:49:51 2013 = (r245803) > @@ -1112,7 +1112,10 @@ _dtrace_tools=3D cddl/usr.bin/sgsmsg cddl/ > lib/libdwarf cddl/usr.bin/ctfconvert cddl/usr.bin/ctfmerge > .endif >=20 > -.if ${MK_FDT} !=3D "no" > +# Default to building the BSDL DTC, but build the GPL one if users = explicitly > +# request it. > +_dtc=3D /usr.bin/dtc > +.if ${MK_GPL_DTC} !=3D "no" > _dtc=3D gnu/usr.bin/dtc > .endif >=20 >=20 > Modified: head/gnu/usr.bin/Makefile > = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D > --- head/gnu/usr.bin/Makefile Tue Jan 22 17:21:08 2013 = (r245802) > +++ head/gnu/usr.bin/Makefile Tue Jan 22 17:49:51 2013 = (r245803) > @@ -30,7 +30,7 @@ _groff=3D groff > _cvs=3D cvs > .endif >=20 > -.if ${MK_FDT} !=3D "no" > +.if ${MK_GPL_DTC} !=3D "no" > _dtc=3D dtc > .endif >=20 >=20 > Modified: head/share/man/man5/src.conf.5 > = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D > --- head/share/man/man5/src.conf.5 Tue Jan 22 17:21:08 2013 = (r245802) > +++ head/share/man/man5/src.conf.5 Tue Jan 22 17:49:51 2013 = (r245803) > @@ -476,6 +476,9 @@ Set to not build GPIB bus support. > Set to not build > .Xr gpioctl 8 > as part of the base system. > +.It Va WITH_GPL_DTC > +Set to build the GPL'd version of the device tree compiler from = elinux.org, > +instead of the BSD licensed one. > .It Va WITHOUT_GROFF > .\" from FreeBSD: head/tools/build/options/WITHOUT_GROFF 218941 = 2011-02-22 08:13:49Z uqs > Set to not build >=20 > Modified: head/share/mk/bsd.own.mk > = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D > --- head/share/mk/bsd.own.mk Tue Jan 22 17:21:08 2013 = (r245802) > +++ head/share/mk/bsd.own.mk Tue Jan 22 17:49:51 2013 = (r245803) > @@ -364,6 +364,7 @@ __DEFAULT_NO_OPTIONS =3D \ > BSD_GREP \ > CLANG_EXTRAS \ > CTF \ > + GPL_DTC \ > HESIOD \ > ICONV \ > IDEA \ >=20 > Added: head/usr.bin/dtc/HACKING > = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D > --- /dev/null 00:00:00 1970 (empty, because file is newly added) > +++ head/usr.bin/dtc/HACKING Tue Jan 22 17:49:51 2013 = (r245803) > @@ -0,0 +1,65 @@ > +$FreeBSD$ > + > +Notes for people hacking on dtc > +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D > + > +This file contains some notes for people wishing to hack on dtc. > + > +Upstreaming > +----------- > + > +This code is developed in the FreeBSD svn repository: > + > +https://svn.freebsd.org/base/head/usr.bin/dtc > + > +If you got the source from anywhere else and wish to make changes, = please > +ensure that you are working against the latest version, or you may = end up > +fixing bugs that are already fixed upstream. Although the license = makes no > +requirement that you share any improvements that you make, patches = are very > +welcome. > + > +C++11 > +----- > + > +This project currently aims to compile with g++ 4.2.1 and so doesn't = make any > +use of C++11 features. It would be a good idea to relax this = restriction once > +clang is the default compiler for ARM, MIPS and PowerPC. > + > +This code makes use of a lot of iterator loops, which would be = cleaner using > +the new syntax in C++11. It also explicitly deletes a lot of objects = held in > +collections in destructors that have these collections as their = members. This > +could be simplified by using `shared_ptr`. > + > +The code does make use of `static_assert()`, but uses a macro in = utility.hh to > +remove these if they are not supported. The FreeBSD standard headers = also > +define a compatibility macro the implements static asserts in terms = of an array > +with 1 element on success and -1 elements on failure. > + > +Adding New Checks > +----------------- > + > +Currently, the biggest weakness of this version of the tool is that = it lacks > +most of the semantic checkers that can be implemented by simply = reading the > +ePAPR spec. The `checker` class provides a simple superclass for = implementing > +these quite easily. There are also helper methods on `device_tree` = for finding > +specific nodes, for checks that require some understanding of the = structure of > +the tree. > + > +We should probably add a parent pointer to the `node` class for = easily walking > +up the tree. > + > +Adding Direct C Output > +---------------------- > + > +The FreeBSD build system currently uses dtc to generate a blob and = then > +converts this to C source code. A new `output_writer` subclass could = easily > +generate the C directly. > + > +Parser Improvements > +------------------- > + > +There are a few FIXME lines in the parser for some corner cases that = are not > +currently used by FreeBSD. These are mainly related to labels in the = middle of > +values. These can be fixed by creating a new `property_value` with = the > +specified label, starting at the location of the label. Don't forget = to remove > +the associated comments from the BUGS section of the man page if you = fix this. >=20 > Added: head/usr.bin/dtc/Makefile > = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D > --- /dev/null 00:00:00 1970 (empty, because file is newly added) > +++ head/usr.bin/dtc/Makefile Tue Jan 22 17:49:51 2013 = (r245803) > @@ -0,0 +1,11 @@ > +# $FreeBSD$ > + > +PROG_CXX=3Ddtc > +SRCS=3D dtc.cc input_buffer.cc string.cc dtb.cc fdt.cc = checking.cc > +MAN=3D dtc.1 > + > +WARNS?=3D 3 > + > +NO_SHARED?=3DNO > + > +.include >=20 > Added: head/usr.bin/dtc/checking.cc > = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D > --- /dev/null 00:00:00 1970 (empty, because file is newly added) > +++ head/usr.bin/dtc/checking.cc Tue Jan 22 17:49:51 2013 = (r245803) > @@ -0,0 +1,210 @@ > +/*- > + * Copyright (c) 2013 David Chisnall > + * All rights reserved. > + * > + * This software was developed by SRI International and the = University of > + * Cambridge Computer Laboratory under DARPA/AFRL contract = (FA8750-10-C-0237) > + * ("CTSRD"), as part of the DARPA CRASH research programme. > + * > + * Redistribution and use in source and binary forms, with or without > + * modification, are permitted provided that the following conditions > + * are met: > + * 1. Redistributions of source code must retain the above copyright > + * notice, this list of conditions and the following disclaimer. > + * 2. Redistributions in binary form must reproduce the above = copyright > + * notice, this list of conditions and the following disclaimer in = the > + * documentation and/or other materials provided with the = distribution. > + * > + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' = AND > + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, = THE > + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR = PURPOSE > + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE = LIABLE > + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR = CONSEQUENTIAL > + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE = GOODS > + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS = INTERRUPTION) > + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN = CONTRACT, STRICT > + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN = ANY WAY > + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE = POSSIBILITY OF > + * SUCH DAMAGE. > + * > + * $FreeBSD$ > + */ > + > +#include "checking.hh" > + > +namespace dtc > +{ > +namespace fdt > +{ > +namespace checking > +{ > + > +bool > +checker::visit_node(device_tree *tree, node *n) > +{ > + path.push_back(std::make_pair(n->name, n->unit_address)); > + // Check this node > + if (!check_node(tree, n)) > + { > + return false; > + } > + // Now check its properties > + for (node::property_iterator i=3Dn->property_begin(), = e=3Dn->property_end() > + ; i!=3De ; ++i) > + { > + if (!check_property(tree, n, *i)) > + { > + return false; > + } > + } > + // And then recursively check the children > + for (node::child_iterator i=3Dn->child_begin(), e=3Dn->child_end()= ; i!=3De ; > + ++i) > + { > + if (!visit_node(tree, *i)) > + { > + return false; > + } > + } > + path.pop_back(); > + return true; > +} > + > +void > +checker::report_error(const char *errmsg) > +{ > + fprintf(stderr, "Error: %s, while checking node: ", errmsg); > + for (device_tree::node_path::iterator p=3Dpath.begin()+1, = pe=3Dpath.end() ; > + p!=3Dpe ; ++p) > + { > + putc('/', stderr); > + p->first.dump(); > + if (!(p->second.empty())) > + { > + putc('@', stderr); > + p->second.dump(); > + } > + } > + fprintf(stderr, " [-W%s]\n", checker_name); > +} > + > +bool > +property_checker::check_property(device_tree *tree, node *n, property = *p) > +{ > + if (p->get_key() =3D=3D key) > + { > + if (!check(tree, n, p)) > + { > + report_error("property check failed"); > + return false; > + } > + } > + return true; > +} > + > +bool > +property_size_checker::check(device_tree *tree, node *n, property *p) > +{ > + uint32_t psize =3D 0; > + for (property::value_iterator i=3Dp->begin(),e=3Dp->end() ; i!=3De= ; ++i) > + { > + if (!i->is_binary()) > + { > + return false; > + } > + psize +=3D i->byte_data.size(); > + } > + return psize =3D=3D size; > +} > + > +template > +void > +check_manager::add_property_type_checker(const char *name, string = prop) > +{ > + checkers.insert(std::make_pair(string(name), > + new property_type_checker(name, prop))); > +} > + > +void > +check_manager::add_property_size_checker(const char *name, > + string prop, > + uint32_t size) > +{ > + checkers.insert(std::make_pair(string(name), > + new property_size_checker(name, prop, size))); > +} > + > +check_manager::~check_manager() > +{ > + while (checkers.begin() !=3D checkers.end()) > + { > + delete checkers.begin()->second; > + checkers.erase(checkers.begin()); > + } > + while (disabled_checkers.begin() !=3D disabled_checkers.end()) > + { > + delete disabled_checkers.begin()->second; > + } > +} > + > +check_manager::check_manager() > +{ > + // NOTE: All checks listed here MUST have a corresponding line > + // in the man page! > + add_property_type_checker( > + "type-compatible", string("compatible")); > + add_property_type_checker( > + "type-model", string("model")); > + add_property_size_checker("type-phandle", string("phandle"), 4); > +} > + > +bool > +check_manager::run_checks(device_tree *tree, bool keep_going) > +{ > + bool success =3D true; > + for (std::map::iterator i=3Dcheckers.begin(), > + e=3Dcheckers.end() ; i!=3De ; ++i) > + { > + success &=3D i->second->check_tree(tree); > + if (!(success || keep_going)) > + { > + break; > + } > + } > + return success; > +} > + > +bool > +check_manager::disable_checker(string name) > +{ > + std::map::iterator checker =3D = checkers.find(name); > + if (checker !=3D checkers.end()) > + { > + disabled_checkers.insert(std::make_pair(name, > + = checker->second)); > + checkers.erase(checker); > + return true; > + } > + return false; > +} > + > +bool > +check_manager::enable_checker(string name) > +{ > + std::map::iterator checker =3D > + disabled_checkers.find(name); > + if (checker !=3D disabled_checkers.end()) > + { > + checkers.insert(std::make_pair(name, checker->second)); > + disabled_checkers.erase(checker); > + return true; > + } > + return false; > +} > + > +} // namespace checking > + > +} // namespace fdt > + > +} // namespace dtc > + >=20 > Added: head/usr.bin/dtc/checking.hh > = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D > --- /dev/null 00:00:00 1970 (empty, because file is newly added) > +++ head/usr.bin/dtc/checking.hh Tue Jan 22 17:49:51 2013 = (r245803) > @@ -0,0 +1,308 @@ > +/*- > + * Copyright (c) 2013 David Chisnall > + * All rights reserved. > + * > + * This software was developed by SRI International and the = University of > + * Cambridge Computer Laboratory under DARPA/AFRL contract = (FA8750-10-C-0237) > + * ("CTSRD"), as part of the DARPA CRASH research programme. > + * > + * 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$ > + */ > + > +#ifndef _CHECKING_HH_ > +#define _CHECKING_HH_ > +#include "string.hh" > +#include "fdt.hh" > + > +namespace dtc > +{ > +namespace fdt > +{ > +namespace checking > +{ > +/** > + * Base class for all checkers. This will visit the entire tree and = perform > + * semantic checks defined in subclasses. Note that device trees are = generally > + * small (a few dozen nodes at most) and so we optimise for = flexibility and > + * extensibility here, not for performance. Each checker will visit = the entire > + * tree. > + */ > +class checker > +{ > + /** > + * The path to the current node being checked. This is used for > + * printing error messages. > + */ > + device_tree::node_path path; > + /** > + * The name of the checker. This is used for printing error = messages > + * and for enabling / disabling specific checkers from the = command > + * line.=20 > + */ > + const char *checker_name; > + /** > + * Visits each node, calling the checker functions on properties = and > + * nodes. > + */ > + bool visit_node(device_tree *tree, node *n); > + protected: > + /** > + * Prints the error message, along with the path to the node = that > + * caused the error and the name of the checker. > + */ > + void report_error(const char *errmsg); > + public: > + /** > + * Constructor. Takes the name of this checker, which is which = is used > + * when reporting errors. > + */ > + checker(const char *name) : checker_name(name) {} > + /** > + * Virtual destructor in case any subclasses need to do cleanup. > + */ > + virtual ~checker() {} > + /** > + * Method for checking that a node is valid. The root class = version > + * does nothing, subclasses should override this. > + */ > + virtual bool check_node(device_tree *tree, node *n) > + { > + return true; > + } > + /** > + * Method for checking that a property is valid. The root class > + * version does nothing, subclasses should override this. > + */ > + virtual bool check_property(device_tree *tree, node *n, property = *p) > + { > + return true; > + } > + /** > + * Runs the checker on the specified device tree. > + */ > + bool check_tree(fdt::device_tree *tree) > + { > + return visit_node(tree, tree->get_root()); > + } > +}; > + > +/** > + * Abstract base class for simple property checks. This class = defines a check > + * method for subclasses, which is invoked only when it finds a = property with > + * the matching name. To define simple property checkers, just = subclass this > + * and override the check() method. > + */ > +class property_checker : public checker > +{ > + /** > + * The name of the property that this checker is looking for. > + */ > + string key; > + public: > + /** > + * Implementation of the generic property-checking method that = checks > + * for a property with the name specified in the constructor=20 > + */ > + virtual bool check_property(device_tree *tree, node *n, property = *p); > + /** > + * Constructor. Takes the name of the checker and the name of = the > + * property to check. > + */ > + property_checker(const char* name, string property_name) > + : checker(name), key(property_name) {} > + /** > + * The check method, which subclasses should implement. > + */ > + virtual bool check(device_tree *tree, node *n, property *p) =3D = 0; > +}; > + > +/** > + * Property type checker. > + */ > +template > +struct property_type_checker : public property_checker > +{ > + /** > + * Constructor, takes the name of the checker and the name of = the > + * property to check as arguments. > + */ > + property_type_checker(const char* name, string property_name) :=20= > + property_checker(name, property_name) {} > + virtual bool check(device_tree *tree, node *n, property *p) =3D = 0; > +}; > + > +/** > + * Empty property checker. This checks that the property has no = value. > + */ > +template<> > +struct property_type_checker : public = property_checker > +{ > + property_type_checker(const char* name, string property_name) :=20= > + property_checker(name, property_name) {} > + virtual bool check(device_tree *tree, node *n, property *p) > + { > + return p->begin() =3D=3D p->end(); > + } > +}; > + > +/** > + * String property checker. This checks that the property has = exactly one > + * value, which is a string. > + */ > +template<> > +struct property_type_checker : public = property_checker > +{ > + property_type_checker(const char* name, string property_name) :=20= > + property_checker(name, property_name) {} > + virtual bool check(device_tree *tree, node *n, property *p) > + { > + return (p->begin() + 1 =3D=3D p->end()) && = p->begin()->is_string(); > + } > +}; > +/** > + * String list property checker. This checks that the property has = at least > + * one value, all of which are strings. > + */ > +template<> > +struct property_type_checker : > + public property_checker > +{ > + property_type_checker(const char* name, string property_name) :=20= > + property_checker(name, property_name) {} > + virtual bool check(device_tree *tree, node *n, property *p) > + { > + for (property::value_iterator i=3Dp->begin(),e=3Dp->end() = ; i!=3De ; > + ++i) > + { > + if (!(i->is_string() || i->is_string_list())) > + { > + return false; > + } > + } > + return p->begin() !=3D p->end(); > + } > +}; > + > +/** > + * Phandle property checker. This checks that the property has = exactly one > + * value, which is a valid phandle. > + */ > +template<> > +struct property_type_checker : public = property_checker > +{ > + property_type_checker(const char* name, string property_name) :=20= > + property_checker(name, property_name) {} > + virtual bool check(device_tree *tree, node *n, property *p) > + { > + return (p->begin() + 1 =3D=3D p->end()) &&=20 > + (tree->referenced_node(*p->begin()) !=3D 0); > + } > +}; > + > +/** > + * Check that a property has the correct size. > + */ > +struct property_size_checker : public property_checker > +{ > + /** > + * The expected size of the property. > + */ > + uint32_t size; > + public: > + /** > + * Constructor, takes the name of the checker, the name of the = property > + * to check, and its expected size as arguments. > + */ > + property_size_checker(const char* name, string property_name, = uint32_t bytes) > + : property_checker(name, property_name), size(bytes) {} > + /** > + * Check, validates that the property has the correct size. > + */ > + virtual bool check(device_tree *tree, node *n, property *p); > +}; > + > + > +/** > + * The check manager is the interface to running the checks. This = allows > + * default checks to be enabled, non-default checks to be enabled, = and so on. > + */ > +class check_manager > +{ > + /** > + * The enabled checkers, indexed by their names. The name is = used when > + * disabling checkers from the command line. When this manager = runs, > + * it will only run the checkers from this map. > + */ > + std::map checkers; > + /** > + * The disabled checkers. Moving checkers to this list disables = them, > + * but allows them to be easily moved back. > + */ > + std::map disabled_checkers; > + /** > + * Helper function for adding a property value checker. > + */ > + template > + void add_property_type_checker(const char *name, string prop); > + /** > + * Helper function for adding a simple type checker. > + */ > + void add_property_type_checker(const char *name, string prop); > + /** > + * Helper function for adding a property value checker. > + */ > + void add_property_size_checker(const char *name, > + string prop, > + uint32_t size); > + public: > + /** > + * Delete all of the checkers that are part of this checker = manager. > + */ > + ~check_manager(); > + /** > + * Default constructor, creates check manager containing all of = the > + * default checks. > + */ > + check_manager(); > + /** > + * Run all of the checks on the specified tree. > + */ > + bool run_checks(device_tree *tree, bool keep_going); > + /** > + * Disables the named checker. > + */ > + bool disable_checker(string name); > + /** > + * Enables the named checker. =20 > + */ > + bool enable_checker(string name); > +}; > + > +} // namespace checking > + > +} // namespace fdt > + > +} // namespace dtc > + > +#endif // !_CHECKING_HH_ >=20 > Added: head/usr.bin/dtc/dtb.cc > = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D > --- /dev/null 00:00:00 1970 (empty, because file is newly added) > +++ head/usr.bin/dtc/dtb.cc Tue Jan 22 17:49:51 2013 = (r245803) > @@ -0,0 +1,308 @@ > +/*- > + * Copyright (c) 2013 David Chisnall > + * All rights reserved. > + * > + * This software was developed by SRI International and the = University of > + * Cambridge Computer Laboratory under DARPA/AFRL contract = (FA8750-10-C-0237) > + * ("CTSRD"), as part of the DARPA CRASH research programme. > + * > + * Redistribution and use in source and binary forms, with or without > + * modification, are permitted provided that the following conditions > + * are met: > + * 1. Redistributions of source code must retain the above copyright > + * notice, this list of conditions and the following disclaimer. > + * 2. Redistributions in binary form must reproduce the above = copyright > + * notice, this list of conditions and the following disclaimer in = the > + * documentation and/or other materials provided with the = distribution. > + * > + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' = AND > + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, = THE > + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR = PURPOSE > + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE = LIABLE > + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR = CONSEQUENTIAL > + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE = GOODS > + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS = INTERRUPTION) > + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN = CONTRACT, STRICT > + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN = ANY WAY > + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE = POSSIBILITY OF > + * SUCH DAMAGE. > + * > + * $FreeBSD$ > + */ > + > +#include "dtb.hh" > +#include > + > +namespace dtc > +{ > +namespace dtb > +{ > + > +void output_writer::write_data(byte_buffer b) > +{ > + for (byte_buffer::iterator i=3Db.begin(), e=3Db.end(); i!=3De ; = i++) > + { > + write_data(*i); > + } > +} > + > +void > +binary_writer::write_string(string name) > +{ > + name.push_to_buffer(buffer); > + // Trailing nul > + buffer.push_back(0); > +} > + > +void > +binary_writer::write_data(uint8_t v) > +{ > + buffer.push_back(v); > +} > + > +void > +binary_writer::write_data(uint32_t v) > +{ > + while (buffer.size() % 4 !=3D 0) > + { > + buffer.push_back(0); > + } > + push_big_endian(buffer, v); > +} > + > +void > +binary_writer::write_data(uint64_t v) > +{ > + while (buffer.size() % 8 !=3D 0) > + { > + buffer.push_back(0); > + } > + push_big_endian(buffer, v); > +} > + > +void > +binary_writer::write_to_file(int fd) > +{ > + // FIXME: Check return > + write(fd, buffer.data(), buffer.size()); > +} > + > +uint32_t > +binary_writer::size() > +{ > + return buffer.size(); > +} > + > +void > +asm_writer::write_string(const char *c) > +{ > + while (*c) > + { > + buffer.push_back((uint8_t)*(c++)); > + } > +} > + > +void > +asm_writer::write_line(const char *c) > +{ > + if (byte_count !=3D 0) > + { > + byte_count =3D 0; > + buffer.push_back('\n'); > + } > + write_string(c); > +} > + > +void > +asm_writer::write_byte(uint8_t b) > +{ > + char out[3] =3D {0}; > + if (byte_count++ =3D=3D 0) > + { > + buffer.push_back('\t'); > + } > + write_string(".byte 0x"); > + snprintf(out, 3, "%.2hhx", b); > + buffer.push_back(out[0]); > + buffer.push_back(out[1]); > + if (byte_count =3D=3D 4) > + { > + buffer.push_back('\n'); > + byte_count =3D 0; > + } > + else > + { > + buffer.push_back(';'); > + buffer.push_back(' '); > + } > +} > + > +void > +asm_writer::write_label(string name) > +{ > + write_line("\t.globl "); > + name.push_to_buffer(buffer); > + buffer.push_back('\n'); > + name.push_to_buffer(buffer); > + buffer.push_back(':'); > + buffer.push_back('\n'); > + buffer.push_back('_'); > + name.push_to_buffer(buffer); > + buffer.push_back(':'); > + buffer.push_back('\n'); > +=09 > +} > + > +void > +asm_writer::write_comment(string name) > +{ > + write_line("\t/* "); > + name.push_to_buffer(buffer); > + write_string(" */\n"); > +} > + > +void > +asm_writer::write_string(string name) > +{ > + write_line("\t.string \""); > + name.push_to_buffer(buffer); > + write_line("\"\n"); > + bytes_written +=3D name.size() + 1; > +} > + > +void > +asm_writer::write_data(uint8_t v) > +{ > + write_byte(v); > + bytes_written++; > +} > + > +void > +asm_writer::write_data(uint32_t v) > +{ > + if (bytes_written % 4 !=3D 0) > + { > + write_line("\t.balign 4\n"); > + bytes_written +=3D (4 - (bytes_written % 4)); > + } > + write_byte((v >> 24) & 0xff); > + write_byte((v >> 16) & 0xff); > + write_byte((v >> 8) & 0xff); > + write_byte((v >> 0) & 0xff); > + bytes_written +=3D 4; > +} > + > +void > +asm_writer::write_data(uint64_t v) > +{ > + if (bytes_written % 8 !=3D 0) > + { > + write_line("\t.balign 8\n"); > + bytes_written +=3D (8 - (bytes_written % 8)); > + } > + write_byte((v >> 56) & 0xff); > + write_byte((v >> 48) & 0xff); > + write_byte((v >> 40) & 0xff); > + write_byte((v >> 32) & 0xff); > + write_byte((v >> 24) & 0xff); > + write_byte((v >> 16) & 0xff); > + write_byte((v >> 8) & 0xff); > + write_byte((v >> 0) & 0xff); > + bytes_written +=3D 8; > +} > + > +void > +asm_writer::write_to_file(int fd) > +{ > + // FIXME: Check return > + write(fd, buffer.data(), buffer.size()); > +} > + > +uint32_t > +asm_writer::size() > +{ > + return bytes_written; > +} > + > +void > +header::write(output_writer &out) > +{ > + out.write_label(string("dt_blob_start")); > + out.write_label(string("dt_header")); > + out.write_comment("magic"); > + out.write_data(magic); > + out.write_comment("totalsize"); > + out.write_data(totalsize); > + out.write_comment("off_dt_struct"); > + out.write_data(off_dt_struct); > + out.write_comment("off_dt_strings"); > + out.write_data(off_dt_strings); > + out.write_comment("off_mem_rsvmap"); > + out.write_data(off_mem_rsvmap); > + out.write_comment("version"); > + out.write_data(version); > + out.write_comment("last_comp_version"); > + out.write_data(last_comp_version); > + out.write_comment("boot_cpuid_phys"); > + out.write_data(boot_cpuid_phys); > + out.write_comment("size_dt_strings"); > + out.write_data(size_dt_strings); > + out.write_comment("size_dt_struct"); > + out.write_data(size_dt_struct); > +} > + > +bool > +header::read_dtb(input_buffer &input) > +{ > + if (!(input.consume_binary(magic) && magic =3D=3D 0xd00dfeed)) > + { > + fprintf(stderr, "Missing magic token in header. Got %" = PRIx32 > + " expected 0xd00dfeed\n", magic); > + return false; > + } > + return input.consume_binary(totalsize) && > + input.consume_binary(off_dt_struct) && > + input.consume_binary(off_dt_strings) && > + input.consume_binary(off_mem_rsvmap) && > + input.consume_binary(version) && > + input.consume_binary(last_comp_version) && > + input.consume_binary(boot_cpuid_phys) && > + input.consume_binary(size_dt_strings) && > + input.consume_binary(size_dt_struct); > +} > +uint32_t > +string_table::add_string(string str) > +{ > + std::map::iterator old =3D = string_offsets.find(str); > + if (old =3D=3D string_offsets.end()) > + { > + uint32_t start =3D size; > + // Don't forget the trailing nul > + size +=3D str.size() + 1; > + string_offsets.insert(std::make_pair(str, start)); > + strings.push_back(str); > + return start; > + } > + else > + { > + return old->second; > + } > +} > + > +void > +string_table::write(dtb::output_writer &writer) > +{ > + writer.write_comment(string("Strings table.")); > + writer.write_label(string("dt_strings_start")); > + for (std::vector::iterator i=3Dstrings.begin(), = e=3Dstrings.end() ; > + i!=3De ; ++i) > + { > + writer.write_string(*i); > + } > + writer.write_label(string("dt_strings_end")); > +} > + > +} // namespace dtb > + > +} // namespace dtc > + >=20 > Added: head/usr.bin/dtc/dtb.hh > = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D > --- /dev/null 00:00:00 1970 (empty, because file is newly added) > +++ head/usr.bin/dtc/dtb.hh Tue Jan 22 17:49:51 2013 = (r245803) > @@ -0,0 +1,365 @@ > +/*- > + * Copyright (c) 2013 David Chisnall > + * All rights reserved. > + * > + * This software was developed by SRI International and the = University of > + * Cambridge Computer Laboratory under DARPA/AFRL contract = (FA8750-10-C-0237) > + * ("CTSRD"), as part of the DARPA CRASH research programme. > + * > + * 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$ > + */ > + > +#ifndef _DTB_HH_ >=20 > *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@FreeBSD.ORG Mon Feb 4 02:37:41 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 093B3CCE; Mon, 4 Feb 2013 02:37:41 +0000 (UTC) (envelope-from markjdb@gmail.com) Received: from mail-ie0-x22d.google.com (mail-ie0-x22d.google.com [IPv6:2607:f8b0:4001:c03::22d]) by mx1.freebsd.org (Postfix) with ESMTP id 8734C847; Mon, 4 Feb 2013 02:37:40 +0000 (UTC) Received: by mail-ie0-f173.google.com with SMTP id 9so5167144iec.4 for ; Sun, 03 Feb 2013 18:37:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:sender:date:from:to:cc:subject:message-id:references :mime-version:content-type:content-disposition:in-reply-to :user-agent; bh=Hp81WM8D/DTTKap51RuDCh2U5lIE78tvSjyP13e4obY=; b=sTOj1K9I1KctMVz//xmPtzjnQ6jzhnpuhFw6S5RyhBVXmHSSARY6QFfZtCVAP+iz+f /dvurCq0wlYe43vQTVk0bf2fAaSF4XREq/EUBCZvyFXCFOK56aDeQ419zipHQBE8tCCT mpQJoqWpiUrTArgyasGxAJXpJd/i1QeIRDcoP+wELjnS2m6UColZSULi9HUGDKtpWkHK Y3+doZQCw2BDw8DF5FXcKZLzZfboSou8uvs8DgJ8/wyRYtD0J069nUz8tIr1HyltKW6w OcGDycx2u9Lf0P9ykijbcmMGWpY8wx4vLJgax+AGOhbHi9f1lntQuMjmKpaailw6w4se hviA== X-Received: by 10.50.202.3 with SMTP id ke3mr4038866igc.49.1359945459475; Sun, 03 Feb 2013 18:37:39 -0800 (PST) Received: from oddish ([66.11.160.25]) by mx.google.com with ESMTPS id u4sm13712600igw.6.2013.02.03.18.37.34 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sun, 03 Feb 2013 18:37:38 -0800 (PST) Sender: Mark Johnston Date: Sun, 3 Feb 2013 19:37:30 -0500 From: Mark Johnston To: Andriy Gapon Subject: Re: svn commit: r246245 - head/sys/netgraph Message-ID: <20130204003701.GA1700@oddish> References: <201302021154.r12Bs0tp030831@svn.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201302021154.r12Bs0tp030831@svn.freebsd.org> User-Agent: Mutt/1.5.21 (2010-09-15) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 04 Feb 2013 02:37:41 -0000 On Sat, Feb 02, 2013 at 11:54:00AM +0000, Andriy Gapon wrote: > Author: avg > Date: Sat Feb 2 11:54:00 2013 > New Revision: 246245 > URL: http://svnweb.freebsd.org/changeset/base/246245 > > Log: > ng_ether: track interface renaming > > Also sanitize interface names that can potentially contain characters > that are prohibited in netgraph names. > > PR: kern/154850 (sanitizing of names) > Discussed with: eri, melifaro > Submitted by: Nikolay Denev (sanitizing code) > Reviewed by: eri, glebius > MFC after: 17 days > > Modified: > head/sys/netgraph/ng_ether.c > Hi Andriy, This commit seems to cause a panic during boot when creating the loopback interface. I couldn't get a core dump but the problem seems to happen when dereferencing ifp->if_l2com in the IFP2NG macro in ng_ether_ifnet_arrival_event(). In the case of lo(4) this pointer seems to be NULL (I suppose because lo(4) doesn't register itself in the if_com_alloc/free tables). The patch below fixes the panic for me. Thanks, -Mark diff --git a/sys/netgraph/ng_ether.c b/sys/netgraph/ng_ether.c index 6266f40..f566346 100644 --- a/sys/netgraph/ng_ether.c +++ b/sys/netgraph/ng_ether.c @@ -410,7 +410,12 @@ static void ng_ether_ifnet_arrival_event(void *arg __unused, struct ifnet *ifp) { char name[IFNAMSIZ]; - node_p node = IFP2NG(ifp); + node_p node; + + if (ifp->if_l2com == NULL) + return; + + node = IFP2NG(ifp); /* * Just return if it's a new interface without an ng_ether companion. From owner-svn-src-head@FreeBSD.ORG Mon Feb 4 05:16:41 2013 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id D6F8255E; Mon, 4 Feb 2013 05:16:41 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail12.syd.optusnet.com.au (mail12.syd.optusnet.com.au [211.29.132.193]) by mx1.freebsd.org (Postfix) with ESMTP id 770B0DA6; Mon, 4 Feb 2013 05:16:41 +0000 (UTC) Received: from c211-30-173-106.carlnfd1.nsw.optusnet.com.au (c211-30-173-106.carlnfd1.nsw.optusnet.com.au [211.30.173.106]) by mail12.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id r145GTjS030618 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Mon, 4 Feb 2013 16:16:31 +1100 Date: Mon, 4 Feb 2013 16:16:29 +1100 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Marius Strobl Subject: Re: svn commit: r246301 - head/sys/kern In-Reply-To: <201302032143.r13LhuQ3053811@svn.freebsd.org> Message-ID: <20130204160720.F1009@besplex.bde.org> References: <201302032143.r13LhuQ3053811@svn.freebsd.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Optus-CM-Score: 0 X-Optus-CM-Analysis: v=2.0 cv=Zty1sKHG c=1 sm=1 a=9tJy_2lEROAA:10 a=kj9zAlcOel0A:10 a=PO7r1zJSAAAA:8 a=JzwRw_2MAAAA:8 a=M4roAWbnUW4A:10 a=oJKyWqhHDGzF01hoqg8A:9 a=CjuIK1q_8ugA:10 a=mXeW1zBZkXM7NW3O:21 a=MaVhI5ispiHdj2y6:21 a=TEtd8y5WR3g2ypngnwZWYw==:117 Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 04 Feb 2013 05:16:41 -0000 On Sun, 3 Feb 2013, Marius Strobl wrote: > Log: > Further improve r242655 and supply VM_{MIN,MAX}_KERNEL_ADDRESS as constant > values to SYSCTL_ULONG(9) where possible. > > Submitted by: bde > Modified: head/sys/kern/kern_malloc.c > ============================================================================== > --- head/sys/kern/kern_malloc.c Sun Feb 3 21:30:29 2013 (r246300) > +++ head/sys/kern/kern_malloc.c Sun Feb 3 21:43:55 2013 (r246301) > @@ -186,15 +186,16 @@ struct { > */ > static uma_zone_t mt_zone; > > -static vm_offset_t vm_min_kernel_address = VM_MIN_KERNEL_ADDRESS; > -SYSCTL_ULONG(_vm, OID_AUTO, min_kernel_address, CTLFLAG_RD, > - &vm_min_kernel_address, 0, "Min kernel address"); > +SYSCTL_ULONG(_vm, OID_AUTO, min_kernel_address, CTLFLAG_RD, NULL, > + VM_MIN_KERNEL_ADDRESS, "Min kernel address"); SYSCTL_*() (except SYSCTL_PROC()) is conventionally split after CTLFLAG* (to highlight the usual value pointer). This does a different splitting, presumably to highlight the value non-pointer. I'm not sure that that is maintainable. The convention for the usual case is often not followed. > > +SYSCTL_ULONG(_vm, OID_AUTO, max_kernel_address, CTLFLAG_RD, > #ifndef __sparc64__ > -static vm_offset_t vm_max_kernel_address = VM_MAX_KERNEL_ADDRESS; > + NULL, VM_MAX_KERNEL_ADDRESS, > +#else > + &vm_max_kernel_address, 0, > #endif > -SYSCTL_ULONG(_vm, OID_AUTO, max_kernel_address, CTLFLAG_RD, > - &vm_max_kernel_address, 0, "Max kernel address"); > + "Max kernel address"); I barely remember mentioning that. MD macros in general could in theory be any expression (say a function call), but if these ones were non-constant expressions then they wouldn't have worked in the old code either. Bruce From owner-svn-src-head@FreeBSD.ORG Mon Feb 4 06:59:34 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id BB44CF97; Mon, 4 Feb 2013 06:59:34 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 9426BFB9; Mon, 4 Feb 2013 06:59:34 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r146xYic024172; Mon, 4 Feb 2013 06:59:34 GMT (envelope-from andrew@svn.freebsd.org) Received: (from andrew@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r146xXw4024168; Mon, 4 Feb 2013 06:59:33 GMT (envelope-from andrew@svn.freebsd.org) Message-Id: <201302040659.r146xXw4024168@svn.freebsd.org> From: Andrew Turner Date: Mon, 4 Feb 2013 06:59:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r246312 - in head/contrib: binutils/include/elf gdb/gdb X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 04 Feb 2013 06:59:34 -0000 Author: andrew Date: Mon Feb 4 06:59:33 2013 New Revision: 246312 URL: http://svnweb.freebsd.org/changeset/base/246312 Log: Extend GDB to check the value in the .note.tag section along with the .note.ABI-tag section. This helps on ARM EABI where the OS/ABI field is zero. It would be better to use the NOTES program header however this would require a more invasive change. Modified: head/contrib/binutils/include/elf/common.h head/contrib/gdb/gdb/osabi.c Modified: head/contrib/binutils/include/elf/common.h ============================================================================== --- head/contrib/binutils/include/elf/common.h Mon Feb 4 00:34:35 2013 (r246311) +++ head/contrib/binutils/include/elf/common.h Mon Feb 4 06:59:33 2013 (r246312) @@ -435,6 +435,10 @@ #define NT_FREEBSD_ABI_TAG 1 +/* Values for FreeBSD .note.tag notes. Note name is "FreeBSD". */ + +#define NT_FREEBSD_TAG 2 + /* These three macros disassemble and assemble a symbol table st_info field, which contains the symbol binding and symbol type. The STB_ and STT_ defines identify the binding and type. */ Modified: head/contrib/gdb/gdb/osabi.c ============================================================================== --- head/contrib/gdb/gdb/osabi.c Mon Feb 4 00:34:35 2013 (r246311) +++ head/contrib/gdb/gdb/osabi.c Mon Feb 4 06:59:33 2013 (r246312) @@ -463,6 +463,20 @@ generic_elf_osabi_sniff_abi_tag_sections return; } + + /* .note.tag notes, used by FreeBSD. */ + if (strcmp (name, ".note.tag") == 0) + { + /* FreeBSD. */ + if (check_note (abfd, sect, note, "FreeBSD", 4, NT_FREEBSD_TAG)) + { + /* There is no need to check the version yet. */ + *osabi = GDB_OSABI_FREEBSD_ELF; + return; + } + + return; + } /* .note.netbsd.ident notes, used by NetBSD. */ if (strcmp (name, ".note.netbsd.ident") == 0 From owner-svn-src-head@FreeBSD.ORG Mon Feb 4 07:41:37 2013 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id DCA263BA; Mon, 4 Feb 2013 07:41:37 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from citadel.icyb.net.ua (citadel.icyb.net.ua [212.40.38.140]) by mx1.freebsd.org (Postfix) with ESMTP id 71D99133; Mon, 4 Feb 2013 07:41:36 +0000 (UTC) Received: from porto.starpoint.kiev.ua (porto-e.starpoint.kiev.ua [212.40.38.100]) by citadel.icyb.net.ua (8.8.8p3/ICyb-2.3exp) with ESMTP id JAA16707; Mon, 04 Feb 2013 09:41:34 +0200 (EET) (envelope-from avg@FreeBSD.org) Received: from localhost ([127.0.0.1]) by porto.starpoint.kiev.ua with esmtp (Exim 4.34 (FreeBSD)) id 1U2GgI-0008MB-9F; Mon, 04 Feb 2013 09:41:34 +0200 Message-ID: <510F662C.1080007@FreeBSD.org> Date: Mon, 04 Feb 2013 09:41:32 +0200 From: Andriy Gapon User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:17.0) Gecko/20130121 Thunderbird/17.0.2 MIME-Version: 1.0 To: Mark Johnston Subject: Re: svn commit: r246245 - head/sys/netgraph References: <201302021154.r12Bs0tp030831@svn.freebsd.org> <20130204003701.GA1700@oddish> In-Reply-To: <20130204003701.GA1700@oddish> X-Enigmail-Version: 1.4.6 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 04 Feb 2013 07:41:37 -0000 on 04/02/2013 02:37 Mark Johnston said the following: > On Sat, Feb 02, 2013 at 11:54:00AM +0000, Andriy Gapon wrote: >> Author: avg >> Date: Sat Feb 2 11:54:00 2013 >> New Revision: 246245 >> URL: http://svnweb.freebsd.org/changeset/base/246245 >> >> Log: >> ng_ether: track interface renaming >> >> Also sanitize interface names that can potentially contain characters >> that are prohibited in netgraph names. >> >> PR: kern/154850 (sanitizing of names) >> Discussed with: eri, melifaro >> Submitted by: Nikolay Denev (sanitizing code) >> Reviewed by: eri, glebius >> MFC after: 17 days >> >> Modified: >> head/sys/netgraph/ng_ether.c >> > > Hi Andriy, > > This commit seems to cause a panic during boot when creating the > loopback interface. I couldn't get a core dump but the problem seems to > happen when dereferencing ifp->if_l2com in the IFP2NG macro in > ng_ether_ifnet_arrival_event(). In the case of lo(4) this pointer seems > to be NULL (I suppose because lo(4) doesn't register itself in the > if_com_alloc/free tables). > > The patch below fixes the panic for me. Mark, thank you for the report and sorry for the breakage. Could you please try the following patch (slightly different from your patch)? diff --git a/sys/netgraph/ng_ether.c b/sys/netgraph/ng_ether.c index 6266f40..05ea402 100644 --- a/sys/netgraph/ng_ether.c +++ b/sys/netgraph/ng_ether.c @@ -410,11 +410,16 @@ static void ng_ether_ifnet_arrival_event(void *arg __unused, struct ifnet *ifp) { char name[IFNAMSIZ]; - node_p node = IFP2NG(ifp); + node_p node; + + /* Only ethernet interfaces are of interest. */ + if (ifp->if_type != IFT_ETHER) + return; /* * Just return if it's a new interface without an ng_ether companion. */ + node = IFP2NG(ifp); if (node == NULL) return; > diff --git a/sys/netgraph/ng_ether.c b/sys/netgraph/ng_ether.c > index 6266f40..f566346 100644 > --- a/sys/netgraph/ng_ether.c > +++ b/sys/netgraph/ng_ether.c > @@ -410,7 +410,12 @@ static void > ng_ether_ifnet_arrival_event(void *arg __unused, struct ifnet *ifp) > { > char name[IFNAMSIZ]; > - node_p node = IFP2NG(ifp); > + node_p node; > + > + if (ifp->if_l2com == NULL) > + return; > + > + node = IFP2NG(ifp); > > /* > * Just return if it's a new interface without an ng_ether companion. > -- Andriy Gapon From owner-svn-src-head@FreeBSD.ORG Mon Feb 4 08:29:02 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id EB99DA9E; Mon, 4 Feb 2013 08:29:02 +0000 (UTC) (envelope-from zec@fer.hr) Received: from mail.fer.hr (mail.fer.hr [161.53.72.233]) by mx1.freebsd.org (Postfix) with ESMTP id 32F6D25F; Mon, 4 Feb 2013 08:29:01 +0000 (UTC) Received: from sluga.fer.hr (161.53.72.14) by MAIL.fer.hr (161.53.72.233) with Microsoft SMTP Server id 14.1.438.0; Mon, 4 Feb 2013 09:27:47 +0100 Received: from localhost ([161.53.19.63]) by sluga.fer.hr over TLS secured channel with Microsoft SMTPSVC(6.0.3790.4675); Mon, 4 Feb 2013 09:27:47 +0100 From: Marko Zec To: Andriy Gapon Subject: Re: svn commit: r246245 - head/sys/netgraph Date: Mon, 4 Feb 2013 09:27:43 +0100 User-Agent: KMail/1.9.10 References: <201302021154.r12Bs0tp030831@svn.freebsd.org> <20130204003701.GA1700@oddish> <510F662C.1080007@FreeBSD.org> In-Reply-To: <510F662C.1080007@FreeBSD.org> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-ID: <201302040927.43559.zec@fer.hr> X-OriginalArrivalTime: 04 Feb 2013 08:27:47.0835 (UTC) FILETIME=[83762CB0:01CE02B1] Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, Mark Johnston , src-committers@freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 04 Feb 2013 08:29:03 -0000 On Monday 04 February 2013 08:41:32 Andriy Gapon wrote: > on 04/02/2013 02:37 Mark Johnston said the following: > > On Sat, Feb 02, 2013 at 11:54:00AM +0000, Andriy Gapon wrote: > >> Author: avg > >> Date: Sat Feb 2 11:54:00 2013 > >> New Revision: 246245 > >> URL: http://svnweb.freebsd.org/changeset/base/246245 > >> > >> Log: > >> ng_ether: track interface renaming > >> > >> Also sanitize interface names that can potentially contain > >> characters that are prohibited in netgraph names. > >> > >> PR: kern/154850 (sanitizing of names) > >> Discussed with: eri, melifaro > >> Submitted by: Nikolay Denev (sanitizing code) > >> Reviewed by: eri, glebius > >> MFC after: 17 days > >> > >> Modified: > >> head/sys/netgraph/ng_ether.c > > > > Hi Andriy, > > > > This commit seems to cause a panic during boot when creating the > > loopback interface. I couldn't get a core dump but the problem seems to > > happen when dereferencing ifp->if_l2com in the IFP2NG macro in > > ng_ether_ifnet_arrival_event(). In the case of lo(4) this pointer seems > > to be NULL (I suppose because lo(4) doesn't register itself in the > > if_com_alloc/free tables). > > > > The patch below fixes the panic for me. > > Mark, > > thank you for the report and sorry for the breakage. > Could you please try the following patch (slightly different from your > patch)? > > diff --git a/sys/netgraph/ng_ether.c b/sys/netgraph/ng_ether.c > index 6266f40..05ea402 100644 > --- a/sys/netgraph/ng_ether.c > +++ b/sys/netgraph/ng_ether.c > @@ -410,11 +410,16 @@ static void > ng_ether_ifnet_arrival_event(void *arg __unused, struct ifnet *ifp) > { > char name[IFNAMSIZ]; > - node_p node = IFP2NG(ifp); > + node_p node; > + > + /* Only ethernet interfaces are of interest. */ > + if (ifp->if_type != IFT_ETHER) > + return; And what about IFT_FDDI, IFT_XETHER, IFT_ISO88025, IFT_L2VLAN, IFT_BRIDGE, IFT_ARCNET, IFT_IEEE8023ADLAG, IFT_IEEE80211? Marko > /* > * Just return if it's a new interface without an ng_ether companion. > */ > + node = IFP2NG(ifp); > if (node == NULL) > return; > > > diff --git a/sys/netgraph/ng_ether.c b/sys/netgraph/ng_ether.c > > index 6266f40..f566346 100644 > > --- a/sys/netgraph/ng_ether.c > > +++ b/sys/netgraph/ng_ether.c > > @@ -410,7 +410,12 @@ static void > > ng_ether_ifnet_arrival_event(void *arg __unused, struct ifnet *ifp) > > { > > char name[IFNAMSIZ]; > > - node_p node = IFP2NG(ifp); > > + node_p node; > > + > > + if (ifp->if_l2com == NULL) > > + return; > > + > > + node = IFP2NG(ifp); > > > > /* > > * Just return if it's a new interface without an ng_ether companion. From owner-svn-src-head@FreeBSD.ORG Mon Feb 4 09:28:37 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 96532E6A; Mon, 4 Feb 2013 09:28:37 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 6F555725; Mon, 4 Feb 2013 09:28:37 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r149SbTB071088; Mon, 4 Feb 2013 09:28:37 GMT (envelope-from andrew@svn.freebsd.org) Received: (from andrew@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r149SbZa071086; Mon, 4 Feb 2013 09:28:37 GMT (envelope-from andrew@svn.freebsd.org) Message-Id: <201302040928.r149SbZa071086@svn.freebsd.org> From: Andrew Turner Date: Mon, 4 Feb 2013 09:28:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r246314 - in head/contrib: gcc/config/arm libstdc++/libsupc++ X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 04 Feb 2013 09:28:37 -0000 Author: andrew Date: Mon Feb 4 09:28:36 2013 New Revision: 246314 URL: http://svnweb.freebsd.org/changeset/base/246314 Log: Allow the unwind functions int libgcc_s to interact correctly with libthr. _Unwind_ForcedUnwind in libgcc_s takes as one of it's parameters a stop function to tell it when to stop unwinding. One of the stop function's parameters is a _Unwind_Exception_Class. On most architectures this is an int64_t, however on ARM EABI the gcc developers have made this a char array with 8 items. While both of these take the same space they are passed into the stop function differently, an int64_t is passed in in registers r2 and r3, while the char[8] is passed in as a pointer to the first item in register r2. Because libthr expects the value to be an int64_t we would get incorrect results when it passes a function that take an int64_t but libgcc passes in a pointer to a char array including crashing. The fix is to update libgcc_s to make it pass an int64_t to the stop function and to libstdc++ as it expects _Unwind_Exception_Class to be an array. Modified: head/contrib/gcc/config/arm/unwind-arm.h head/contrib/libstdc++/libsupc++/unwind-cxx.h Modified: head/contrib/gcc/config/arm/unwind-arm.h ============================================================================== --- head/contrib/gcc/config/arm/unwind-arm.h Mon Feb 4 08:53:51 2013 (r246313) +++ head/contrib/gcc/config/arm/unwind-arm.h Mon Feb 4 09:28:36 2013 (r246314) @@ -87,7 +87,7 @@ extern "C" { struct _Unwind_Control_Block { - char exception_class[8]; + unsigned exception_class __attribute__((__mode__(__DI__))); void (*exception_cleanup)(_Unwind_Reason_Code, _Unwind_Control_Block *); /* Unwinder cache, private fields for the unwinder's use */ struct @@ -186,7 +186,7 @@ extern "C" { /* Support functions for the PR. */ #define _Unwind_Exception _Unwind_Control_Block - typedef char _Unwind_Exception_Class[8]; + typedef unsigned _Unwind_Exception_Class __attribute__((__mode__(__DI__))); void * _Unwind_GetLanguageSpecificData (_Unwind_Context *); _Unwind_Ptr _Unwind_GetRegionStart (_Unwind_Context *); Modified: head/contrib/libstdc++/libsupc++/unwind-cxx.h ============================================================================== --- head/contrib/libstdc++/libsupc++/unwind-cxx.h Mon Feb 4 08:53:51 2013 (r246313) +++ head/contrib/libstdc++/libsupc++/unwind-cxx.h Mon Feb 4 09:28:36 2013 (r246314) @@ -173,7 +173,7 @@ __get_exception_header_from_ue (_Unwind_ return reinterpret_cast<__cxa_exception *>(exc + 1) - 1; } -#ifdef __ARM_EABI_UNWINDER__ +#if defined(__ARM_EABI_UNWINDER__) && !defined(__FreeBSD__) static inline bool __is_gxx_exception_class(_Unwind_Exception_Class c) { @@ -200,13 +200,7 @@ __GXX_INIT_EXCEPTION_CLASS(_Unwind_Excep c[6] = '+'; c[7] = '\0'; } - -static inline void* -__gxx_caught_object(_Unwind_Exception* eo) -{ - return (void*)eo->barrier_cache.bitpattern[0]; -} -#else // !__ARM_EABI_UNWINDER__ +#else // !__ARM_EABI_UNWINDER__ || __FreeBSD__ // This is the exception class we report -- "GNUCC++\0". const _Unwind_Exception_Class __gxx_exception_class = ((((((((_Unwind_Exception_Class) 'G' @@ -223,8 +217,16 @@ __is_gxx_exception_class(_Unwind_Excepti { return c == __gxx_exception_class; } - #define __GXX_INIT_EXCEPTION_CLASS(c) c = __gxx_exception_class +#endif + +#ifdef __ARM_EABI_UNWINDER__ +static inline void* +__gxx_caught_object(_Unwind_Exception* eo) +{ + return (void*)eo->barrier_cache.bitpattern[0]; +} +#else // !__ARM_EABI_UNWINDER__ // GNU C++ personality routine, Version 0. extern "C" _Unwind_Reason_Code __gxx_personality_v0 From owner-svn-src-head@FreeBSD.ORG Mon Feb 4 09:34:26 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 6D6E9224; Mon, 4 Feb 2013 09:34:26 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 5ED2376C; Mon, 4 Feb 2013 09:34:26 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r149YQeE073599; Mon, 4 Feb 2013 09:34:26 GMT (envelope-from andrew@svn.freebsd.org) Received: (from andrew@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r149YQ49073598; Mon, 4 Feb 2013 09:34:26 GMT (envelope-from andrew@svn.freebsd.org) Message-Id: <201302040934.r149YQ49073598@svn.freebsd.org> From: Andrew Turner Date: Mon, 4 Feb 2013 09:34:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r246315 - head X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 04 Feb 2013 09:34:26 -0000 Author: andrew Date: Mon Feb 4 09:34:25 2013 New Revision: 246315 URL: http://svnweb.freebsd.org/changeset/base/246315 Log: Fix xdev by using the install shell script as it knows about the -l argument thile the local version install may not. Modified: head/Makefile.inc1 Modified: head/Makefile.inc1 ============================================================================== --- head/Makefile.inc1 Mon Feb 4 09:28:36 2013 (r246314) +++ head/Makefile.inc1 Mon Feb 4 09:34:25 2013 (r246315) @@ -1733,7 +1733,8 @@ NOFUN=-DNO_FSCHG -DWITHOUT_HTML -DWITHOU XDDIR=${XDEV_ARCH}-freebsd XDTP=/usr/${XDDIR} -CDBENV=MAKEOBJDIRPREFIX=${MAKEOBJDIRPREFIX}/${XDDIR} +CDBENV=MAKEOBJDIRPREFIX=${MAKEOBJDIRPREFIX}/${XDDIR} \ + INSTALL="sh ${.CURDIR}/tools/install.sh" CDENV= ${CDBENV} \ _SHLIBDIRPREFIX=${XDTP} \ TOOLS_PREFIX=${XDTP} From owner-svn-src-head@FreeBSD.ORG Mon Feb 4 09:35:49 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 110453EB; Mon, 4 Feb 2013 09:35:49 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id EE2A8788; Mon, 4 Feb 2013 09:35:48 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r149ZmIF073817; Mon, 4 Feb 2013 09:35:48 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r149ZmQa073815; Mon, 4 Feb 2013 09:35:48 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201302040935.r149ZmQa073815@svn.freebsd.org> From: Marius Strobl Date: Mon, 4 Feb 2013 09:35:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r246316 - in head/sys: kern vm X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 04 Feb 2013 09:35:49 -0000 Author: marius Date: Mon Feb 4 09:35:48 2013 New Revision: 246316 URL: http://svnweb.freebsd.org/changeset/base/246316 Log: Try to improve r242655 take III: move these SYSCTLs describing the kernel map, which is defined and initialized in vm/vm_kern.c, to the latter. Submitted by: alc Modified: head/sys/kern/kern_malloc.c head/sys/vm/vm_kern.c Modified: head/sys/kern/kern_malloc.c ============================================================================== --- head/sys/kern/kern_malloc.c Mon Feb 4 09:34:25 2013 (r246315) +++ head/sys/kern/kern_malloc.c Mon Feb 4 09:35:48 2013 (r246316) @@ -186,17 +186,6 @@ struct { */ static uma_zone_t mt_zone; -SYSCTL_ULONG(_vm, OID_AUTO, min_kernel_address, CTLFLAG_RD, NULL, - VM_MIN_KERNEL_ADDRESS, "Min kernel address"); - -SYSCTL_ULONG(_vm, OID_AUTO, max_kernel_address, CTLFLAG_RD, -#ifndef __sparc64__ - NULL, VM_MAX_KERNEL_ADDRESS, -#else - &vm_max_kernel_address, 0, -#endif - "Max kernel address"); - u_long vm_kmem_size; SYSCTL_ULONG(_vm, OID_AUTO, kmem_size, CTLFLAG_RDTUN, &vm_kmem_size, 0, "Size of kernel memory"); Modified: head/sys/vm/vm_kern.c ============================================================================== --- head/sys/vm/vm_kern.c Mon Feb 4 09:34:25 2013 (r246315) +++ head/sys/vm/vm_kern.c Mon Feb 4 09:35:48 2013 (r246316) @@ -94,6 +94,17 @@ vm_map_t buffer_map=0; const void *zero_region; CTASSERT((ZERO_REGION_SIZE & PAGE_MASK) == 0); +SYSCTL_ULONG(_vm, OID_AUTO, min_kernel_address, CTLFLAG_RD, + NULL, VM_MIN_KERNEL_ADDRESS, "Min kernel address"); + +SYSCTL_ULONG(_vm, OID_AUTO, max_kernel_address, CTLFLAG_RD, +#ifdef __sparc64__ + &vm_max_kernel_address, 0, +#else + NULL, VM_MAX_KERNEL_ADDRESS, +#endif + "Max kernel address"); + /* * kmem_alloc_nofault: * From owner-svn-src-head@FreeBSD.ORG Mon Feb 4 09:42:12 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id BD8AC91C; Mon, 4 Feb 2013 09:42:12 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id B0C357ED; Mon, 4 Feb 2013 09:42:12 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r149gCXA076709; Mon, 4 Feb 2013 09:42:12 GMT (envelope-from andrew@svn.freebsd.org) Received: (from andrew@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r149gCTo076708; Mon, 4 Feb 2013 09:42:12 GMT (envelope-from andrew@svn.freebsd.org) Message-Id: <201302040942.r149gCTo076708@svn.freebsd.org> From: Andrew Turner Date: Mon, 4 Feb 2013 09:42:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r246317 - head/contrib/gcc/config/arm X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 04 Feb 2013 09:42:12 -0000 Author: andrew Date: Mon Feb 4 09:42:12 2013 New Revision: 246317 URL: http://svnweb.freebsd.org/changeset/base/246317 Log: Add #undef TARGET_DEFAULT back as it shouldn't have been removed in r245539 Modified: head/contrib/gcc/config/arm/freebsd.h Modified: head/contrib/gcc/config/arm/freebsd.h ============================================================================== --- head/contrib/gcc/config/arm/freebsd.h Mon Feb 4 09:35:48 2013 (r246316) +++ head/contrib/gcc/config/arm/freebsd.h Mon Feb 4 09:42:12 2013 (r246317) @@ -85,6 +85,7 @@ while (false) #else /* Default it to use ATPCS with soft-VFP. */ +#undef TARGET_DEFAULT #define TARGET_DEFAULT \ (MASK_APCS_FRAME \ | TARGET_ENDIAN_DEFAULT) From owner-svn-src-head@FreeBSD.ORG Mon Feb 4 09:42:38 2013 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id DF8C6B69; Mon, 4 Feb 2013 09:42:38 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from citadel.icyb.net.ua (citadel.icyb.net.ua [212.40.38.140]) by mx1.freebsd.org (Postfix) with ESMTP id 928237F9; Mon, 4 Feb 2013 09:42:37 +0000 (UTC) Received: from porto.starpoint.kiev.ua (porto-e.starpoint.kiev.ua [212.40.38.100]) by citadel.icyb.net.ua (8.8.8p3/ICyb-2.3exp) with ESMTP id LAA18041; Mon, 04 Feb 2013 11:42:33 +0200 (EET) (envelope-from avg@FreeBSD.org) Received: from localhost ([127.0.0.1]) by porto.starpoint.kiev.ua with esmtp (Exim 4.34 (FreeBSD)) id 1U2IZN-0008Xk-Bf; Mon, 04 Feb 2013 11:42:33 +0200 Message-ID: <510F8287.7030708@FreeBSD.org> Date: Mon, 04 Feb 2013 11:42:31 +0200 From: Andriy Gapon User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:17.0) Gecko/20130121 Thunderbird/17.0.2 MIME-Version: 1.0 To: Marko Zec Subject: Re: svn commit: r246245 - head/sys/netgraph References: <201302021154.r12Bs0tp030831@svn.freebsd.org> <20130204003701.GA1700@oddish> <510F662C.1080007@FreeBSD.org> <201302040927.43559.zec@fer.hr> In-Reply-To: <201302040927.43559.zec@fer.hr> X-Enigmail-Version: 1.4.6 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, Mark Johnston , src-committers@FreeBSD.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 04 Feb 2013 09:42:39 -0000 on 04/02/2013 10:27 Marko Zec said the following: > On Monday 04 February 2013 08:41:32 Andriy Gapon wrote: >> + /* Only ethernet interfaces are of interest. */ >> + if (ifp->if_type != IFT_ETHER) >> + return; > > > And what about IFT_FDDI, IFT_XETHER, IFT_ISO88025, IFT_L2VLAN, IFT_BRIDGE, > IFT_ARCNET, IFT_IEEE8023ADLAG, IFT_IEEE80211? Oh, I didn't realize that many drivers changed if_type after if_alloc. Honestly, the networking code is not my strong skill, I ventured here only because nobody else did... So what do you suggest? if_alloctype or a different approach? I'd like to prevent if_l2com being mis-interpreted as struct arpcom. -- Andriy Gapon From owner-svn-src-head@FreeBSD.ORG Mon Feb 4 09:43:44 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 372C7D17; Mon, 4 Feb 2013 09:43:44 +0000 (UTC) (envelope-from pluknet@gmail.com) Received: from mail-qc0-f172.google.com (mail-qc0-f172.google.com [209.85.216.172]) by mx1.freebsd.org (Postfix) with ESMTP id 93B55810; Mon, 4 Feb 2013 09:43:43 +0000 (UTC) Received: by mail-qc0-f172.google.com with SMTP id b25so2575811qca.17 for ; Mon, 04 Feb 2013 01:43:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:x-received:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type; bh=S94FPYgOd9WzTsAQUHiVxjZK2S0WB3ISKEsSB9xnzdo=; b=wT88VWwl7pROJD0U4y1KnSE/rVSH05E+/AZ01l0ciOuhzC/BJPWWVjmLGoJe4a0OIx 4ukbk8iBZaLsrFb5VjaI9iJaUJ3DC1jtbK1a3vI7zHABlUbXS+ljz46p9CqQlP57aF67 N425lld/MhBeRzMgYDdwcn58uUtnoSZ3/kHbdi3KgMzyRAyVta2mQKcbIW+THwKRNCSI b0y6nDQfAZWyiTWq+CmFZVpoR2Xk4pEOoicl2qOper28ykJTJfEbyr/5Arca8+0VTeeh V2wFov6ea0BXNkrAGBiSuYyr6gARt6sNAdTSkp6ops4dQLDEYCPy8Zw7/NwbCLO7xFx5 gBQA== MIME-Version: 1.0 X-Received: by 10.229.180.41 with SMTP id bs41mr4121510qcb.38.1359971016967; Mon, 04 Feb 2013 01:43:36 -0800 (PST) Sender: pluknet@gmail.com Received: by 10.229.105.201 with HTTP; Mon, 4 Feb 2013 01:43:36 -0800 (PST) In-Reply-To: <201301231834.r0NIYLnp006407@svn.freebsd.org> References: <201301231834.r0NIYLnp006407@svn.freebsd.org> Date: Mon, 4 Feb 2013 12:43:36 +0300 X-Google-Sender-Auth: Cl1el2EvG_flZlKGTm2BMgVMux0 Message-ID: Subject: Re: svn commit: r245848 - head/sys/boot/i386/libi386 From: Sergey Kandaurov To: John Baldwin Content-Type: text/plain; charset=ISO-8859-1 Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 04 Feb 2013 09:43:44 -0000 On 23 January 2013 22:34, John Baldwin wrote: > Author: jhb > Date: Wed Jan 23 18:34:21 2013 > New Revision: 245848 > URL: http://svnweb.freebsd.org/changeset/base/245848 > > Log: > Always update the hw.uart.console hint anytime a change is made to the > comconsole setup. Previously the hint would be set when if you set a > custom port, but it would not be updated if you later set a custom speed. > > Also, leave the hw.uart.console hint mutable so it can be overridden or > unset by the user if needed. > > Reviewed by: kib (earlier version) > MFC after: 1 week Looks like this results in something wrong. I have a serial console at COM2 (uart1), but it chooses uart0 (1016 == 0x3F8), compare .flags and the final hw.uart.console value. hint.uart.0.at="isa" hint.uart.0.irq="4" hint.uart.0.port="0x3F8" hint.uart.1.at="isa" hint.uart.1.flags="0x10" hint.uart.1.irq="3" hint.uart.1.port="0x2F8" hw.uart.console="io:1016,br:9600" Or even: hint.uart.0.at="isa" hint.uart.0.disabled="1" hint.uart.0.irq="4" hint.uart.0.port="0x3F8" hint.uart.1.at="isa" hint.uart.1.flags="0x10" hint.uart.1.irq="3" hint.uart.1.port="0x2F8" hw.uart.console="io:1016,br:9600" > > Modified: > head/sys/boot/i386/libi386/comconsole.c > > Modified: head/sys/boot/i386/libi386/comconsole.c > ============================================================================== > --- head/sys/boot/i386/libi386/comconsole.c Wed Jan 23 18:19:50 2013 (r245847) > +++ head/sys/boot/i386/libi386/comconsole.c Wed Jan 23 18:34:21 2013 (r245848) > @@ -50,7 +50,6 @@ static int comc_init(int arg); > static void comc_putchar(int c); > static int comc_getchar(void); > static int comc_getspeed(void); > -static void set_hw_console_hint(void); > static int comc_ischar(void); > static int comc_parseint(const char *string); > static uint32_t comc_parse_pcidev(const char *string); > @@ -202,27 +201,14 @@ comc_port_set(struct env_var *ev, int fl > } > > if ((comconsole.c_flags & (C_ACTIVEIN | C_ACTIVEOUT)) != 0 && > - comc_port != port) { > + comc_port != port) > comc_setup(comc_curspeed, port); > - set_hw_console_hint(); > - } > > env_setenv(ev->ev_name, flags | EV_NOHOOK, value, NULL, NULL); > > return (CMD_OK); > } > > -static void > -set_hw_console_hint(void) > -{ > - char intbuf[64]; > - > - unsetenv("hw.uart.console"); > - sprintf(intbuf, "io:%d,br:%d", comc_port, comc_curspeed); > - env_setenv("hw.uart.console", EV_VOLATILE, intbuf, > - env_noset, env_nounset); > -} > - > /* > * Input: bus:dev:func[:bar]. If bar is not specified, it is 0x10. > * Output: bar[24:16] bus[15:8] dev[7:3] func[2:0] > @@ -288,7 +274,6 @@ comc_pcidev_handle(uint32_t locator) > comc_port_set, env_nounset); > > comc_setup(comc_curspeed, port); > - set_hw_console_hint(); > comc_locator = locator; > > return (CMD_OK); > @@ -318,8 +303,10 @@ static void > comc_setup(int speed, int port) > { > static int TRY_COUNT = 1000000; > + char intbuf[64]; > int tries; > > + unsetenv("hw.uart.console"); > comc_curspeed = speed; > comc_port = port; > > @@ -334,9 +321,11 @@ comc_setup(int speed, int port) > inb(comc_port + com_data); > while (inb(comc_port + com_lsr) & LSR_RXRDY && ++tries < TRY_COUNT); > > - if (tries < TRY_COUNT) > + if (tries < TRY_COUNT) { > comconsole.c_flags |= (C_PRESENTIN | C_PRESENTOUT); > - else > + sprintf(intbuf, "io:%d,br:%d", comc_port, comc_curspeed); > + env_setenv("hw.uart.console", EV_VOLATILE, intbuf, NULL, NULL); > + } else > comconsole.c_flags &= ~(C_PRESENTIN | C_PRESENTOUT); > } > -- wbr, pluknet From owner-svn-src-head@FreeBSD.ORG Mon Feb 4 09:48:50 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id E5FEBEF8; Mon, 4 Feb 2013 09:48:50 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id CEB2A849; Mon, 4 Feb 2013 09:48:50 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r149moNp077725; Mon, 4 Feb 2013 09:48:50 GMT (envelope-from andrew@svn.freebsd.org) Received: (from andrew@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r149moiI077724; Mon, 4 Feb 2013 09:48:50 GMT (envelope-from andrew@svn.freebsd.org) Message-Id: <201302040948.r149moiI077724@svn.freebsd.org> From: Andrew Turner Date: Mon, 4 Feb 2013 09:48:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r246318 - head/sys/arm/arm X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 04 Feb 2013 09:48:51 -0000 Author: andrew Date: Mon Feb 4 09:48:50 2013 New Revision: 246318 URL: http://svnweb.freebsd.org/changeset/base/246318 Log: Use the STACKALIGN macro to alight the stack rather than with a magic mask. Submitted by: Christoph Mallon Modified: head/sys/arm/arm/vm_machdep.c Modified: head/sys/arm/arm/vm_machdep.c ============================================================================== --- head/sys/arm/arm/vm_machdep.c Mon Feb 4 09:42:12 2013 (r246317) +++ head/sys/arm/arm/vm_machdep.c Mon Feb 4 09:48:50 2013 (r246318) @@ -362,8 +362,8 @@ cpu_set_upcall_kse(struct thread *td, vo { struct trapframe *tf = td->td_frame; - tf->tf_usr_sp = ((int)stack->ss_sp + stack->ss_size - - sizeof(struct trapframe)) & ~7; + tf->tf_usr_sp = STACKALIGN((int)stack->ss_sp + stack->ss_size + - sizeof(struct trapframe)); tf->tf_pc = (int)entry; tf->tf_r0 = (int)arg; tf->tf_spsr = PSR_USR32_MODE; @@ -396,14 +396,13 @@ cpu_thread_alloc(struct thread *td) { td->td_pcb = (struct pcb *)(td->td_kstack + td->td_kstack_pages * PAGE_SIZE) - 1; - td->td_frame = (struct trapframe *) - ((u_int)td->td_kstack + USPACE_SVC_STACK_TOP - sizeof(struct pcb)) - 1; /* * Ensure td_frame is aligned to an 8 byte boundary as it will be * placed into the stack pointer which must be 8 byte aligned in * the ARM EABI. */ - td->td_frame = (struct trapframe *)((u_int)td->td_frame & ~7); + td->td_frame = (struct trapframe *)STACKALIGN((u_int)td->td_kstack + + USPACE_SVC_STACK_TOP - sizeof(struct pcb) - 1); #ifdef __XSCALE__ #ifndef CPU_XSCALE_CORE3 pmap_use_minicache(td->td_kstack, td->td_kstack_pages * PAGE_SIZE); From owner-svn-src-head@FreeBSD.ORG Mon Feb 4 09:58:54 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 37F6E290; Mon, 4 Feb 2013 09:58:54 +0000 (UTC) (envelope-from zec@fer.hr) Received: from mail.fer.hr (mail.fer.hr [161.53.72.233]) by mx1.freebsd.org (Postfix) with ESMTP id BF72D8A0; Mon, 4 Feb 2013 09:58:53 +0000 (UTC) Received: from sluga.fer.hr (161.53.72.14) by MAIL.fer.hr (161.53.72.233) with Microsoft SMTP Server id 14.1.438.0; Mon, 4 Feb 2013 10:58:49 +0100 Received: from localhost ([161.53.19.63]) by sluga.fer.hr over TLS secured channel with Microsoft SMTPSVC(6.0.3790.4675); Mon, 4 Feb 2013 10:58:49 +0100 From: Marko Zec To: Andriy Gapon Subject: Re: svn commit: r246245 - head/sys/netgraph Date: Mon, 4 Feb 2013 10:58:45 +0100 User-Agent: KMail/1.9.10 References: <201302021154.r12Bs0tp030831@svn.freebsd.org> <201302040927.43559.zec@fer.hr> <510F8287.7030708@FreeBSD.org> In-Reply-To: <510F8287.7030708@FreeBSD.org> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-ID: <201302041058.45725.zec@fer.hr> X-OriginalArrivalTime: 04 Feb 2013 09:58:49.0441 (UTC) FILETIME=[3AD51D10:01CE02BE] Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, Mark Johnston , src-committers@freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 04 Feb 2013 09:58:54 -0000 On Monday 04 February 2013 10:42:31 Andriy Gapon wrote: > on 04/02/2013 10:27 Marko Zec said the following: > > On Monday 04 February 2013 08:41:32 Andriy Gapon wrote: > >> + /* Only ethernet interfaces are of interest. */ > >> + if (ifp->if_type != IFT_ETHER) > >> + return; > > > > And what about IFT_FDDI, IFT_XETHER, IFT_ISO88025, IFT_L2VLAN, > > IFT_BRIDGE, IFT_ARCNET, IFT_IEEE8023ADLAG, IFT_IEEE80211? > > Oh, I didn't realize that many drivers changed if_type after if_alloc. > Honestly, the networking code is not my strong skill, I ventured here > only because nobody else did... > > So what do you suggest? if_alloctype or a different approach? > I'd like to prevent if_l2com being mis-interpreted as struct arpcom. We already have this in vnet_ng_ether_init(): 865 TAILQ_FOREACH(ifp, &V_ifnet, if_link) { 866 if (ifp->if_type == IFT_ETHER 867 || ifp->if_type == IFT_L2VLAN) 868 ng_ether_attach(ifp); 869 } So at least in ng_ether_ifnet_arrival_event() we should do a check consistent to the above code. OTOH we don't check for interface types on entry into ng_ether_attach(), and perhaps a better strategy would be to move your ifp->if_type check there. Perhaps the check could be #defined as a macro to ensure consistency between vnet_ng_ether_init() and ng_ether_attach()? Marko From owner-svn-src-head@FreeBSD.ORG Mon Feb 4 10:05:56 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 9B9318AA; Mon, 4 Feb 2013 10:05:56 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 846A8916; Mon, 4 Feb 2013 10:05:56 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r14A5uUd083865; Mon, 4 Feb 2013 10:05:56 GMT (envelope-from andrew@svn.freebsd.org) Received: (from andrew@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r14A5uKN083864; Mon, 4 Feb 2013 10:05:56 GMT (envelope-from andrew@svn.freebsd.org) Message-Id: <201302041005.r14A5uKN083864@svn.freebsd.org> From: Andrew Turner Date: Mon, 4 Feb 2013 10:05:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r246319 - head/usr.bin/join X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 04 Feb 2013 10:05:56 -0000 Author: andrew Date: Mon Feb 4 10:05:55 2013 New Revision: 246319 URL: http://svnweb.freebsd.org/changeset/base/246319 Log: Cast *tabchar, a wchar_t, to a wint_t as it is the type the %lc printf format string expects. This is only an issue on ARM EABI where wint_t is different to wchar_t. Modified: head/usr.bin/join/join.c Modified: head/usr.bin/join/join.c ============================================================================== --- head/usr.bin/join/join.c Mon Feb 4 09:48:50 2013 (r246318) +++ head/usr.bin/join/join.c Mon Feb 4 10:05:55 2013 (r246319) @@ -516,7 +516,7 @@ static void outfield(LINE *lp, u_long fieldno, int out_empty) { if (needsep++) - (void)printf("%lc", *tabchar); + (void)printf("%lc", (wint_t)*tabchar); if (!ferror(stdout)) { if (lp->fieldcnt <= fieldno || out_empty) { if (empty != NULL) From owner-svn-src-head@FreeBSD.ORG Mon Feb 4 11:06:11 2013 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 64C30700; Mon, 4 Feb 2013 11:06:11 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from citadel.icyb.net.ua (citadel.icyb.net.ua [212.40.38.140]) by mx1.freebsd.org (Postfix) with ESMTP id 1820BC3B; Mon, 4 Feb 2013 11:06:09 +0000 (UTC) Received: from odyssey.starpoint.kiev.ua (alpha-e.starpoint.kiev.ua [212.40.38.101]) by citadel.icyb.net.ua (8.8.8p3/ICyb-2.3exp) with ESMTP id NAA18861; Mon, 04 Feb 2013 13:06:07 +0200 (EET) (envelope-from avg@FreeBSD.org) Message-ID: <510F961F.1070104@FreeBSD.org> Date: Mon, 04 Feb 2013 13:06:07 +0200 From: Andriy Gapon User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:17.0) Gecko/20130113 Thunderbird/17.0.2 MIME-Version: 1.0 To: Marko Zec Subject: Re: svn commit: r246245 - head/sys/netgraph References: <201302021154.r12Bs0tp030831@svn.freebsd.org> <201302040927.43559.zec@fer.hr> <510F8287.7030708@FreeBSD.org> <201302041058.45725.zec@fer.hr> In-Reply-To: <201302041058.45725.zec@fer.hr> X-Enigmail-Version: 1.4.6 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, Mark Johnston , src-committers@FreeBSD.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 04 Feb 2013 11:06:11 -0000 on 04/02/2013 11:58 Marko Zec said the following: > On Monday 04 February 2013 10:42:31 Andriy Gapon wrote: >> on 04/02/2013 10:27 Marko Zec said the following: >>> On Monday 04 February 2013 08:41:32 Andriy Gapon wrote: >>>> + /* Only ethernet interfaces are of interest. */ >>>> + if (ifp->if_type != IFT_ETHER) >>>> + return; >>> >>> And what about IFT_FDDI, IFT_XETHER, IFT_ISO88025, IFT_L2VLAN, >>> IFT_BRIDGE, IFT_ARCNET, IFT_IEEE8023ADLAG, IFT_IEEE80211? >> >> Oh, I didn't realize that many drivers changed if_type after if_alloc. >> Honestly, the networking code is not my strong skill, I ventured here >> only because nobody else did... >> >> So what do you suggest? if_alloctype or a different approach? >> I'd like to prevent if_l2com being mis-interpreted as struct arpcom. > > We already have this in vnet_ng_ether_init(): > > 865 TAILQ_FOREACH(ifp, &V_ifnet, if_link) { > 866 if (ifp->if_type == IFT_ETHER > 867 || ifp->if_type == IFT_L2VLAN) > 868 ng_ether_attach(ifp); > 869 } > > So at least in ng_ether_ifnet_arrival_event() we should do a check > consistent to the above code. OK, that makes sense. Although I am not sure if perhaps that check should be extended too. But that's not something for me to worry about. > OTOH we don't check for interface types on > entry into ng_ether_attach(), and perhaps a better strategy would be to > move your ifp->if_type check there. Definitely not move, perhaps copy... OTOH, ng_ether_attach is invoked via a different mechanism (an explicit hook), directly from ether_ifattach. And so, as you note, there seems to be an inconsistency between ether_ifattach->ng_ether_attach and vnet_ng_ether_init. If a bridge is created after ng_ether is loaded, then there would be ng_ether node for the bridge. If ng_ether is loaded after a bridge is created, then there would be no ng_ether node for it. Unless I miss something. But I don't know if we actually want ng_ether for a bridge (or something else of the types you listed)... > Perhaps the check could be #defined as > a macro to ensure consistency between vnet_ng_ether_init() and > ng_ether_attach()? Perhaps... -- Andriy Gapon From owner-svn-src-head@FreeBSD.ORG Mon Feb 4 14:57:06 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 9257F1CC; Mon, 4 Feb 2013 14:57:06 +0000 (UTC) (envelope-from markjdb@gmail.com) Received: from mail-ie0-x234.google.com (mail-ie0-x234.google.com [IPv6:2607:f8b0:4001:c03::234]) by mx1.freebsd.org (Postfix) with ESMTP id 3EA7CA2; Mon, 4 Feb 2013 14:57:06 +0000 (UTC) Received: by mail-ie0-f180.google.com with SMTP id bn7so4739771ieb.39 for ; Mon, 04 Feb 2013 06:57:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:sender:date:from:to:cc:subject:message-id:references :mime-version:content-type:content-disposition:in-reply-to :user-agent; bh=QxWNfz9uf5GGvels76STA0WNZDu6g42RXNt9k4ghKCA=; b=YbPaF6baH9qFTbKU5c0gxjFZ+IAAiE5+AFoBXKThVKDMpnW8nC5iU+ujQYyr2xmP8x ORVIGcmatdNUAT7HbLBQEK7x0gK6BbJDxXmK1xWfse9Wt9o2OuFXvIIqpQcMb9jlKjHP wgS5uS5ZVlha841yk2EfKKdjy19M3NhNaXr88lu4Y/3wyUHr6Ru9ZxMfj022uwAbESeT NYArUPlIS4KlXeHgMB0GhT2zEZULiB8Lz58PEgYRo5Nz9YZObVlrQSqUVoDAw2dEwp/X pG18unsphiC0nD/P+5lngBi6ojmXokN3LMBZnazWtSyyi9QPcKaONfyej1fm41BtbgN/ erZA== X-Received: by 10.50.135.100 with SMTP id pr4mr2307363igb.37.1359989825933; Mon, 04 Feb 2013 06:57:05 -0800 (PST) Received: from oddish.sandvine.com ([64.7.137.182]) by mx.google.com with ESMTPS id uj6sm16645048igb.4.2013.02.04.06.57.03 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 04 Feb 2013 06:57:04 -0800 (PST) Sender: Mark Johnston Date: Mon, 4 Feb 2013 07:56:52 -0500 From: Mark Johnston To: Andriy Gapon Subject: Re: svn commit: r246245 - head/sys/netgraph Message-ID: <20130204125652.GA1543@oddish.sandvine.com> References: <201302021154.r12Bs0tp030831@svn.freebsd.org> <20130204003701.GA1700@oddish> <510F662C.1080007@FreeBSD.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <510F662C.1080007@FreeBSD.org> User-Agent: Mutt/1.5.21 (2010-09-15) Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, Mark Johnston , src-committers@FreeBSD.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 04 Feb 2013 14:57:06 -0000 On Mon, Feb 04, 2013 at 09:41:32AM +0200, Andriy Gapon wrote: > on 04/02/2013 02:37 Mark Johnston said the following: > > On Sat, Feb 02, 2013 at 11:54:00AM +0000, Andriy Gapon wrote: > >> Author: avg > >> Date: Sat Feb 2 11:54:00 2013 > >> New Revision: 246245 > >> URL: http://svnweb.freebsd.org/changeset/base/246245 > >> > >> Log: > >> ng_ether: track interface renaming > >> > >> Also sanitize interface names that can potentially contain characters > >> that are prohibited in netgraph names. > >> > >> PR: kern/154850 (sanitizing of names) > >> Discussed with: eri, melifaro > >> Submitted by: Nikolay Denev (sanitizing code) > >> Reviewed by: eri, glebius > >> MFC after: 17 days > >> > >> Modified: > >> head/sys/netgraph/ng_ether.c > >> > > > > Hi Andriy, > > > > This commit seems to cause a panic during boot when creating the > > loopback interface. I couldn't get a core dump but the problem seems to > > happen when dereferencing ifp->if_l2com in the IFP2NG macro in > > ng_ether_ifnet_arrival_event(). In the case of lo(4) this pointer seems > > to be NULL (I suppose because lo(4) doesn't register itself in the > > if_com_alloc/free tables). > > > > The patch below fixes the panic for me. > > Mark, > > thank you for the report and sorry for the breakage. > Could you please try the following patch (slightly different from your patch)? Thanks, I can confirm that this one works too. > > diff --git a/sys/netgraph/ng_ether.c b/sys/netgraph/ng_ether.c > index 6266f40..05ea402 100644 > --- a/sys/netgraph/ng_ether.c > +++ b/sys/netgraph/ng_ether.c > @@ -410,11 +410,16 @@ static void > ng_ether_ifnet_arrival_event(void *arg __unused, struct ifnet *ifp) > { > char name[IFNAMSIZ]; > - node_p node = IFP2NG(ifp); > + node_p node; > + > + /* Only ethernet interfaces are of interest. */ > + if (ifp->if_type != IFT_ETHER) > + return; > > /* > * Just return if it's a new interface without an ng_ether companion. > */ > + node = IFP2NG(ifp); > if (node == NULL) > return; > > From owner-svn-src-head@FreeBSD.ORG Mon Feb 4 17:29:13 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id AAF17E30; Mon, 4 Feb 2013 17:29:13 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 9973CD2E; Mon, 4 Feb 2013 17:29:13 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r14HTDjJ020954; Mon, 4 Feb 2013 17:29:13 GMT (envelope-from avg@svn.freebsd.org) Received: (from avg@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r14HTD0U020953; Mon, 4 Feb 2013 17:29:13 GMT (envelope-from avg@svn.freebsd.org) Message-Id: <201302041729.r14HTD0U020953@svn.freebsd.org> From: Andriy Gapon Date: Mon, 4 Feb 2013 17:29:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r246324 - head/sys/netgraph X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 04 Feb 2013 17:29:13 -0000 Author: avg Date: Mon Feb 4 17:29:13 2013 New Revision: 246324 URL: http://svnweb.freebsd.org/changeset/base/246324 Log: ng_ether_ifnet_arrival_event: check interface type before using IFP2NG The check is copied from vnet_ng_ether_init. Not sure if it covers all the types that we want to support with ng_ether. Reported by: markj Discussed with: zec MFC after: 10 days X-MFC with: r246245 Modified: head/sys/netgraph/ng_ether.c Modified: head/sys/netgraph/ng_ether.c ============================================================================== --- head/sys/netgraph/ng_ether.c Mon Feb 4 16:20:13 2013 (r246323) +++ head/sys/netgraph/ng_ether.c Mon Feb 4 17:29:13 2013 (r246324) @@ -410,11 +410,17 @@ static void ng_ether_ifnet_arrival_event(void *arg __unused, struct ifnet *ifp) { char name[IFNAMSIZ]; - node_p node = IFP2NG(ifp); + node_p node; + + /* Only ethernet interfaces are of interest. */ + if (ifp->if_type != IFT_ETHER + && ifp->if_type != IFT_L2VLAN) + return; /* * Just return if it's a new interface without an ng_ether companion. */ + node = IFP2NG(ifp); if (node == NULL) return; From owner-svn-src-head@FreeBSD.ORG Mon Feb 4 17:41:18 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 8228341A; Mon, 4 Feb 2013 17:41:18 +0000 (UTC) (envelope-from sjg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 7420DE33; Mon, 4 Feb 2013 17:41:18 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r14HfIRL025929; Mon, 4 Feb 2013 17:41:18 GMT (envelope-from sjg@svn.freebsd.org) Received: (from sjg@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r14HfI9p025924; Mon, 4 Feb 2013 17:41:18 GMT (envelope-from sjg@svn.freebsd.org) Message-Id: <201302041741.r14HfI9p025924@svn.freebsd.org> From: "Simon J. Gerraty" Date: Mon, 4 Feb 2013 17:41:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r246325 - in head/usr.bin/bmake: . unit-tests X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 04 Feb 2013 17:41:18 -0000 Author: sjg Date: Mon Feb 4 17:41:17 2013 New Revision: 246325 URL: http://svnweb.freebsd.org/changeset/base/246325 Log: Missed adding Makefile.config and unit-tests/Makefile should allow FreeBSD make to do 'obj'. Approved by: marcel (mentor) Added: head/usr.bin/bmake/Makefile.config (contents, props changed) Modified: head/usr.bin/bmake/unit-tests/Makefile Added: head/usr.bin/bmake/Makefile.config ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/usr.bin/bmake/Makefile.config Mon Feb 4 17:41:17 2013 (r246325) @@ -0,0 +1,21 @@ +# This is a generated file, do NOT edit! +# See contrib/bmake/bsd.after-import.mk +# +# $FreeBSD$ + +SRCTOP?= ${.CURDIR:H:H} + +# things set by configure + +prefix= /usr +srcdir= ${SRCTOP}/contrib/bmake +CC?= gcc +DEFAULT_SYS_PATH= .../share/mk:/usr/share/mk + +CPPFLAGS+= +CFLAGS+= ${CPPFLAGS} -DHAVE_CONFIG_H +LDFLAGS= +LIBOBJS= ${LIBOBJDIR}stresep$U.o +LDADD= +USE_META= yes +FILEMON_H= /usr/include/dev/filemon/filemon.h Modified: head/usr.bin/bmake/unit-tests/Makefile ============================================================================== --- head/usr.bin/bmake/unit-tests/Makefile Mon Feb 4 17:29:13 2013 (r246324) +++ head/usr.bin/bmake/unit-tests/Makefile Mon Feb 4 17:41:17 2013 (r246325) @@ -79,10 +79,12 @@ TOOL_TR?= tr TOOL_DIFF?= diff DIFF_FLAGS?= -u +.if defined(.PARSEDIR) # ensure consistent results from sort(1) LC_ALL= C LANG= C .export LANG LC_ALL +.endif # The driver. # We always pretend .MAKE was called 'make' From owner-svn-src-head@FreeBSD.ORG Mon Feb 4 19:05:54 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 62F4769B; Mon, 4 Feb 2013 19:05:54 +0000 (UTC) (envelope-from des@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 5565571A; Mon, 4 Feb 2013 19:05:54 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r14J5sKj051038; Mon, 4 Feb 2013 19:05:54 GMT (envelope-from des@svn.freebsd.org) Received: (from des@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r14J5sZ5051037; Mon, 4 Feb 2013 19:05:54 GMT (envelope-from des@svn.freebsd.org) Message-Id: <201302041905.r14J5sZ5051037@svn.freebsd.org> From: Dag-Erling Smørgrav Date: Mon, 4 Feb 2013 19:05:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r246328 - head/lib X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 04 Feb 2013 19:05:54 -0000 Author: des Date: Mon Feb 4 19:05:53 2013 New Revision: 246328 URL: http://svnweb.freebsd.org/changeset/base/246328 Log: Sort by MK_* knob like the comment says MFC after: 1 week Modified: head/lib/Makefile Modified: head/lib/Makefile ============================================================================== --- head/lib/Makefile Mon Feb 4 18:39:05 2013 (r246327) +++ head/lib/Makefile Mon Feb 4 19:05:53 2013 (r246328) @@ -177,6 +177,11 @@ _libiconv_modules= libiconv_modules _libipx= libipx .endif +.if ${MK_LIBCPLUSPLUS} != "no" +_libcxxrt= libcxxrt +_libcplusplus= libc++ +.endif + .if ${MK_LIBTHR} != "no" _libthr= libthr .endif @@ -221,11 +226,6 @@ _librtld_db= librtld_db _libmp= libmp .endif -.if ${MK_LIBCPLUSPLUS} != "no" -_libcxxrt= libcxxrt -_libcplusplus= libc++ -.endif - .if ${MK_PMC} != "no" _libpmc= libpmc .endif From owner-svn-src-head@FreeBSD.ORG Mon Feb 4 19:17:15 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id DF2A5BF7; Mon, 4 Feb 2013 19:17:15 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id D23137CB; Mon, 4 Feb 2013 19:17:15 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r14JHFTM054419; Mon, 4 Feb 2013 19:17:15 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r14JHFrV054418; Mon, 4 Feb 2013 19:17:15 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <201302041917.r14JHFrV054418@svn.freebsd.org> From: Xin LI Date: Mon, 4 Feb 2013 19:17:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r246329 - head/sbin/recoverdisk X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 04 Feb 2013 19:17:15 -0000 Author: delphij Date: Mon Feb 4 19:17:15 2013 New Revision: 246329 URL: http://svnweb.freebsd.org/changeset/base/246329 Log: Use stripesize as smallest block size if it's available. MFC after: 2 weeks Modified: head/sbin/recoverdisk/recoverdisk.c Modified: head/sbin/recoverdisk/recoverdisk.c ============================================================================== --- head/sbin/recoverdisk/recoverdisk.c Mon Feb 4 19:05:53 2013 (r246328) +++ head/sbin/recoverdisk/recoverdisk.c Mon Feb 4 19:17:15 2013 (r246329) @@ -156,6 +156,7 @@ main(int argc, char * const argv[]) int error, state; u_char *buf; u_int sectorsize; + u_int stripesize; time_t t1, t2; struct stat sb; u_int n, snapshot = 60; @@ -201,6 +202,10 @@ main(int argc, char * const argv[]) if (error < 0) err(1, "DIOCGSECTORSIZE failed"); + error = ioctl(fdr, DIOCGSTRIPESIZE, &stripesize); + if (error == 0 && stripesize > sectorsize) + sectorsize = stripesize; + minsize = sectorsize; bigsize = (bigsize / sectorsize) * sectorsize; From owner-svn-src-head@FreeBSD.ORG Mon Feb 4 20:46:14 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 347772DE; Mon, 4 Feb 2013 20:46:14 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from bigwig.baldwin.cx (bigknife-pt.tunnel.tserv9.chi1.ipv6.he.net [IPv6:2001:470:1f10:75::2]) by mx1.freebsd.org (Postfix) with ESMTP id 130B1D32; Mon, 4 Feb 2013 20:46:14 +0000 (UTC) Received: from pakbsde14.localnet (unknown [38.105.238.108]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id 60ED4B926; Mon, 4 Feb 2013 15:46:13 -0500 (EST) From: John Baldwin To: Andriy Gapon Subject: Re: svn commit: r246282 - in head/sys: conf kern Date: Mon, 4 Feb 2013 14:29:01 -0500 User-Agent: KMail/1.13.5 (FreeBSD/8.2-CBSD-20110714-p22; KDE/4.5.5; amd64; ; ) References: <201302030957.r139vd8n027213@svn.freebsd.org> In-Reply-To: <201302030957.r139vd8n027213@svn.freebsd.org> MIME-Version: 1.0 Content-Type: Text/Plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <201302041429.01477.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.7 (bigwig.baldwin.cx); Mon, 04 Feb 2013 15:46:13 -0500 (EST) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 04 Feb 2013 20:46:14 -0000 On Sunday, February 03, 2013 4:57:39 am Andriy Gapon wrote: > Author: avg > Date: Sun Feb 3 09:57:39 2013 > New Revision: 246282 > URL: http://svnweb.freebsd.org/changeset/base/246282 > > Log: > allow for large KTR_ENTRIES values by allocating ktr_buf using malloc(9) > > Only during very early boot, before malloc(9) is functional (SI_SUB_KMEM), > the static ktr_buf_init is used. Size of the static buffer is determined > by a new kernel option KTR_BOOT_ENTRIES. Its default value is 1024. > > This commit builds on top of r243046. Does this lose "early" entries once the SYSINIT runs? It doesn't seem to make any effort to copy the existing entries over to the new buffer? -- John Baldwin From owner-svn-src-head@FreeBSD.ORG Mon Feb 4 20:46:16 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id D2CD52E3; Mon, 4 Feb 2013 20:46:16 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from bigwig.baldwin.cx (bigknife-pt.tunnel.tserv9.chi1.ipv6.he.net [IPv6:2001:470:1f10:75::2]) by mx1.freebsd.org (Postfix) with ESMTP id AF9A6D34; Mon, 4 Feb 2013 20:46:16 +0000 (UTC) Received: from pakbsde14.localnet (unknown [38.105.238.108]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id 30BFAB9A0; Mon, 4 Feb 2013 15:46:16 -0500 (EST) From: John Baldwin To: Sergey Kandaurov Subject: Re: svn commit: r245848 - head/sys/boot/i386/libi386 Date: Mon, 4 Feb 2013 14:46:55 -0500 User-Agent: KMail/1.13.5 (FreeBSD/8.2-CBSD-20110714-p22; KDE/4.5.5; amd64; ; ) References: <201301231834.r0NIYLnp006407@svn.freebsd.org> In-Reply-To: MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Message-Id: <201302041446.55786.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.7 (bigwig.baldwin.cx); Mon, 04 Feb 2013 15:46:16 -0500 (EST) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 04 Feb 2013 20:46:16 -0000 On Monday, February 04, 2013 4:43:36 am Sergey Kandaurov wrote: > On 23 January 2013 22:34, John Baldwin wrote: > > Author: jhb > > Date: Wed Jan 23 18:34:21 2013 > > New Revision: 245848 > > URL: http://svnweb.freebsd.org/changeset/base/245848 > > > > Log: > > Always update the hw.uart.console hint anytime a change is made to the > > comconsole setup. Previously the hint would be set when if you set a > > custom port, but it would not be updated if you later set a custom speed. > > > > Also, leave the hw.uart.console hint mutable so it can be overridden or > > unset by the user if needed. > > > > Reviewed by: kib (earlier version) > > MFC after: 1 week > > Looks like this results in something wrong. > I have a serial console at COM2 (uart1), but it chooses uart0 > (1016 == 0x3F8), compare .flags and the final hw.uart.console value. Do you have a working console in the loader? It is setting the hint based on what the loader uses. I use this to use COM2 for both loader and kernel: console="comconsole vidconsole" comconsole_port=0x2f8 Note that when hw.uart.console is set, any flags set in hint.uart.X.flags to set the console are ignored. If you are not using -h in /boot.config or setting 'console' for the loader to enable a serial console then the loader should not be setting hw.uart.console (if it is, that is a bug to be fixed). However, configuring the kernel to use a different serial console from the loader seems very odd. You should be able to manually set hw.uart.console in loader.conf if you are doing that. -- John Baldwin From owner-svn-src-head@FreeBSD.ORG Mon Feb 4 20:56:35 2013 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 221ECBD2; Mon, 4 Feb 2013 20:56:35 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from citadel.icyb.net.ua (citadel.icyb.net.ua [212.40.38.140]) by mx1.freebsd.org (Postfix) with ESMTP id CB09EE1D; Mon, 4 Feb 2013 20:56:33 +0000 (UTC) Received: from porto.starpoint.kiev.ua (porto-e.starpoint.kiev.ua [212.40.38.100]) by citadel.icyb.net.ua (8.8.8p3/ICyb-2.3exp) with ESMTP id WAA24625; Mon, 04 Feb 2013 22:56:26 +0200 (EET) (envelope-from avg@FreeBSD.org) Received: from localhost ([127.0.0.1]) by porto.starpoint.kiev.ua with esmtp (Exim 4.34 (FreeBSD)) id 1U2T5V-0009cw-TY; Mon, 04 Feb 2013 22:56:25 +0200 Message-ID: <51102076.8030302@FreeBSD.org> Date: Mon, 04 Feb 2013 22:56:22 +0200 From: Andriy Gapon User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:17.0) Gecko/20130121 Thunderbird/17.0.2 MIME-Version: 1.0 To: John Baldwin Subject: Re: svn commit: r246282 - in head/sys: conf kern References: <201302030957.r139vd8n027213@svn.freebsd.org> <201302041429.01477.jhb@freebsd.org> In-Reply-To: <201302041429.01477.jhb@freebsd.org> X-Enigmail-Version: 1.4.6 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 04 Feb 2013 20:56:35 -0000 on 04/02/2013 21:29 John Baldwin said the following: > On Sunday, February 03, 2013 4:57:39 am Andriy Gapon wrote: >> Author: avg >> Date: Sun Feb 3 09:57:39 2013 >> New Revision: 246282 >> URL: http://svnweb.freebsd.org/changeset/base/246282 >> >> Log: >> allow for large KTR_ENTRIES values by allocating ktr_buf using malloc(9) >> >> Only during very early boot, before malloc(9) is functional (SI_SUB_KMEM), >> the static ktr_buf_init is used. Size of the static buffer is determined >> by a new kernel option KTR_BOOT_ENTRIES. Its default value is 1024. >> >> This commit builds on top of r243046. > > Does this lose "early" entries once the SYSINIT runs? It doesn't seem to make > any effort to copy the existing entries over to the new buffer? Yes, this is true and glebius has also noticed that... I think that a simple bcopy should be fine here? -- Andriy Gapon From owner-svn-src-head@FreeBSD.ORG Mon Feb 4 21:50:56 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 262C1B9C; Mon, 4 Feb 2013 21:50:56 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 14AE5250; Mon, 4 Feb 2013 21:50:56 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r14LotLN003094; Mon, 4 Feb 2013 21:50:55 GMT (envelope-from avg@svn.freebsd.org) Received: (from avg@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r14Lot9x003093; Mon, 4 Feb 2013 21:50:55 GMT (envelope-from avg@svn.freebsd.org) Message-Id: <201302042150.r14Lot9x003093@svn.freebsd.org> From: Andriy Gapon Date: Mon, 4 Feb 2013 21:50:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r246330 - head/sys/kern X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 04 Feb 2013 21:50:56 -0000 Author: avg Date: Mon Feb 4 21:50:55 2013 New Revision: 246330 URL: http://svnweb.freebsd.org/changeset/base/246330 Log: ktr: copy content from the early static buffer if KTR_ENTRIES != KTR_BOOT_ENTRIES Reported by: glebius, jhb Pointyhat to: avg MFC after: 14 days X-MFC with: r246282 Modified: head/sys/kern/kern_ktr.c Modified: head/sys/kern/kern_ktr.c ============================================================================== --- head/sys/kern/kern_ktr.c Mon Feb 4 19:17:15 2013 (r246329) +++ head/sys/kern/kern_ktr.c Mon Feb 4 21:50:55 2013 (r246330) @@ -213,6 +213,7 @@ ktr_entries_initializer(void *dummy __un ktr_mask = 0; ktr_buf = malloc(sizeof(*ktr_buf) * KTR_ENTRIES, M_KTR, M_WAITOK | M_ZERO); + memcpy(ktr_buf, ktr_buf_init, sizeof(ktr_buf_init)); ktr_entries = KTR_ENTRIES; ktr_mask = mask; } From owner-svn-src-head@FreeBSD.ORG Mon Feb 4 21:58:58 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 7AF8AF32; Mon, 4 Feb 2013 21:58:58 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 564E9294; Mon, 4 Feb 2013 21:58:58 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r14LwwVm004308; Mon, 4 Feb 2013 21:58:58 GMT (envelope-from avg@svn.freebsd.org) Received: (from avg@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r14LwwwQ004307; Mon, 4 Feb 2013 21:58:58 GMT (envelope-from avg@svn.freebsd.org) Message-Id: <201302042158.r14LwwwQ004307@svn.freebsd.org> From: Andriy Gapon Date: Mon, 4 Feb 2013 21:58:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r246331 - head/sys/kern X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 04 Feb 2013 21:58:58 -0000 Author: avg Date: Mon Feb 4 21:58:57 2013 New Revision: 246331 URL: http://svnweb.freebsd.org/changeset/base/246331 Log: ktr: prevent possible footshooting with KTR_ENTRIES and KTR_BOOT_ENTRIES Suggested by: adrian MFC after: 14 days X-MFC with: r246282 Modified: head/sys/kern/kern_ktr.c Modified: head/sys/kern/kern_ktr.c ============================================================================== --- head/sys/kern/kern_ktr.c Mon Feb 4 21:50:55 2013 (r246330) +++ head/sys/kern/kern_ktr.c Mon Feb 4 21:58:57 2013 (r246331) @@ -198,7 +198,7 @@ SYSCTL_PROC(_debug_ktr, OID_AUTO, mask, sysctl_debug_ktr_mask, "IU", "Bitmask of KTR event classes for which logging is enabled"); -#if KTR_ENTRIES != KTR_BOOT_ENTRIES +#if KTR_ENTRIES > KTR_BOOT_ENTRIES /* * A simplified version of sysctl_debug_ktr_entries. * No need to care about SMP, scheduling, etc. From owner-svn-src-head@FreeBSD.ORG Tue Feb 5 00:37:46 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 93B5F1CB; Tue, 5 Feb 2013 00:37:46 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 84565B29; Tue, 5 Feb 2013 00:37:46 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r150bktZ053090; Tue, 5 Feb 2013 00:37:46 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r150bkP1053085; Tue, 5 Feb 2013 00:37:46 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201302050037.r150bkP1053085@svn.freebsd.org> From: Pyun YongHyeon Date: Tue, 5 Feb 2013 00:37:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r246341 - head/sys/dev/age X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 05 Feb 2013 00:37:46 -0000 Author: yongari Date: Tue Feb 5 00:37:45 2013 New Revision: 246341 URL: http://svnweb.freebsd.org/changeset/base/246341 Log: Rework jumbo frame handling. QAC confirmed that the controller requires 8 bytes alignment on RX buffer. Given that non-jumbo frame works on any alignments I guess this DMA limitation for RX buffer could be jumbo frame specific one. Also I'm not sure whether this DMA limitation is related with 64bit DMA. Previously age(4) disabled 64bit DMA addressing due to silent data corruption. So we may need more testing on re-enabling 64bit DMA in future. While I'm here, change mbuf chaining algorithm to use fixed sized buffer and force software checksum if controller reports length error. According to QAC, RFD is not updated at all for jumbo frame so it works just like alc(4) controllers. This change also added alignment fixup for strict alignment architectures. Because I'm not aware of any non-x86 machines that use age(4) controllers it's just for completeness at this moment. Wit this change, jumbo frame should work with age(4). Tested by: Christian Gusenbauer < c47g <> gmx dot at > MFC after: 1 week Modified: head/sys/dev/age/if_age.c head/sys/dev/age/if_agevar.h Modified: head/sys/dev/age/if_age.c ============================================================================== --- head/sys/dev/age/if_age.c Tue Feb 5 00:33:32 2013 (r246340) +++ head/sys/dev/age/if_age.c Tue Feb 5 00:37:45 2013 (r246341) @@ -142,6 +142,9 @@ static int age_init_rx_ring(struct age_s static void age_init_rr_ring(struct age_softc *); static void age_init_cmb_block(struct age_softc *); static void age_init_smb_block(struct age_softc *); +#ifndef __NO_STRICT_ALIGNMENT +static struct mbuf *age_fixup_rx(struct ifnet *, struct mbuf *); +#endif static int age_newbuf(struct age_softc *, struct age_rxdesc *); static void age_rxvlan(struct age_softc *); static void age_rxfilter(struct age_softc *); @@ -1133,7 +1136,7 @@ again: /* Create tag for Rx buffers. */ error = bus_dma_tag_create( sc->age_cdata.age_buffer_tag, /* parent */ - 1, 0, /* alignment, boundary */ + AGE_RX_BUF_ALIGN, 0, /* alignment, boundary */ BUS_SPACE_MAXADDR, /* lowaddr */ BUS_SPACE_MAXADDR, /* highaddr */ NULL, NULL, /* filter, filterarg */ @@ -2268,16 +2271,53 @@ age_txintr(struct age_softc *sc, int tpd } } +#ifndef __NO_STRICT_ALIGNMENT +static struct mbuf * +age_fixup_rx(struct ifnet *ifp, struct mbuf *m) +{ + struct mbuf *n; + int i; + uint16_t *src, *dst; + + src = mtod(m, uint16_t *); + dst = src - 3; + + if (m->m_next == NULL) { + for (i = 0; i < (m->m_len / sizeof(uint16_t) + 1); i++) + *dst++ = *src++; + m->m_data -= 6; + return (m); + } + /* + * Append a new mbuf to received mbuf chain and copy ethernet + * header from the mbuf chain. This can save lots of CPU + * cycles for jumbo frame. + */ + MGETHDR(n, M_NOWAIT, MT_DATA); + if (n == NULL) { + ifp->if_iqdrops++; + m_freem(m); + return (NULL); + } + bcopy(m->m_data, n->m_data, ETHER_HDR_LEN); + m->m_data += ETHER_HDR_LEN; + m->m_len -= ETHER_HDR_LEN; + n->m_len = ETHER_HDR_LEN; + M_MOVE_PKTHDR(n, m); + n->m_next = m; + return (n); +} +#endif + /* Receive a frame. */ static void age_rxeof(struct age_softc *sc, struct rx_rdesc *rxrd) { struct age_rxdesc *rxd; - struct rx_desc *desc; struct ifnet *ifp; struct mbuf *mp, *m; uint32_t status, index, vtag; - int count, nsegs, pktlen; + int count, nsegs; int rx_cons; AGE_LOCK_ASSERT(sc); @@ -2289,9 +2329,7 @@ age_rxeof(struct age_softc *sc, struct r nsegs = AGE_RX_NSEGS(index); sc->age_cdata.age_rxlen = AGE_RX_BYTES(le32toh(rxrd->len)); - if ((status & AGE_RRD_ERROR) != 0 && - (status & (AGE_RRD_CRC | AGE_RRD_CODE | AGE_RRD_DRIBBLE | - AGE_RRD_RUNT | AGE_RRD_OFLOW | AGE_RRD_TRUNC)) != 0) { + if ((status & (AGE_RRD_ERROR | AGE_RRD_LENGTH_NOK)) != 0) { /* * We want to pass the following frames to upper * layer regardless of error status of Rx return @@ -2301,33 +2339,31 @@ age_rxeof(struct age_softc *sc, struct r * o frame length and protocol specific length * does not match. */ - sc->age_cdata.age_rx_cons += nsegs; - sc->age_cdata.age_rx_cons %= AGE_RX_RING_CNT; - return; + status |= AGE_RRD_IPCSUM_NOK | AGE_RRD_TCP_UDPCSUM_NOK; + if ((status & (AGE_RRD_CRC | AGE_RRD_CODE | AGE_RRD_DRIBBLE | + AGE_RRD_RUNT | AGE_RRD_OFLOW | AGE_RRD_TRUNC)) != 0) + return; } - pktlen = 0; for (count = 0; count < nsegs; count++, AGE_DESC_INC(rx_cons, AGE_RX_RING_CNT)) { rxd = &sc->age_cdata.age_rxdesc[rx_cons]; mp = rxd->rx_m; - desc = rxd->rx_desc; /* Add a new receive buffer to the ring. */ if (age_newbuf(sc, rxd) != 0) { ifp->if_iqdrops++; /* Reuse Rx buffers. */ - if (sc->age_cdata.age_rxhead != NULL) { + if (sc->age_cdata.age_rxhead != NULL) m_freem(sc->age_cdata.age_rxhead); - AGE_RXCHAIN_RESET(sc); - } break; } - /* The length of the first mbuf is computed last. */ - if (count != 0) { - mp->m_len = AGE_RX_BYTES(le32toh(desc->len)); - pktlen += mp->m_len; - } + /* + * Assume we've received a full sized frame. + * Actual size is fixed when we encounter the end of + * multi-segmented frame. + */ + mp->m_len = AGE_RX_BUF_SIZE; /* Chain received mbufs. */ if (sc->age_cdata.age_rxhead == NULL) { @@ -2342,14 +2378,20 @@ age_rxeof(struct age_softc *sc, struct r } if (count == nsegs - 1) { + /* Last desc. for this frame. */ + m = sc->age_cdata.age_rxhead; + m->m_flags |= M_PKTHDR; /* * It seems that L1 controller has no way * to tell hardware to strip CRC bytes. */ - sc->age_cdata.age_rxlen -= ETHER_CRC_LEN; + m->m_pkthdr.len = sc->age_cdata.age_rxlen - + ETHER_CRC_LEN; if (nsegs > 1) { + /* Set last mbuf size. */ + mp->m_len = sc->age_cdata.age_rxlen - + ((nsegs - 1) * AGE_RX_BUF_SIZE); /* Remove the CRC bytes in chained mbufs. */ - pktlen -= ETHER_CRC_LEN; if (mp->m_len <= ETHER_CRC_LEN) { sc->age_cdata.age_rxtail = sc->age_cdata.age_rxprev_tail; @@ -2360,15 +2402,9 @@ age_rxeof(struct age_softc *sc, struct r } else { mp->m_len -= ETHER_CRC_LEN; } - } - - m = sc->age_cdata.age_rxhead; - m->m_flags |= M_PKTHDR; + } else + m->m_len = m->m_pkthdr.len; m->m_pkthdr.rcvif = ifp; - m->m_pkthdr.len = sc->age_cdata.age_rxlen; - /* Set the first mbuf length. */ - m->m_len = sc->age_cdata.age_rxlen - pktlen; - /* * Set checksum information. * It seems that L1 controller can compute partial @@ -2383,9 +2419,9 @@ age_rxeof(struct age_softc *sc, struct r */ if ((ifp->if_capenable & IFCAP_RXCSUM) != 0 && (status & AGE_RRD_IPV4) != 0) { - m->m_pkthdr.csum_flags |= CSUM_IP_CHECKED; if ((status & AGE_RRD_IPCSUM_NOK) == 0) - m->m_pkthdr.csum_flags |= CSUM_IP_VALID; + m->m_pkthdr.csum_flags |= + CSUM_IP_CHECKED | CSUM_IP_VALID; if ((status & (AGE_RRD_TCP | AGE_RRD_UDP)) && (status & AGE_RRD_TCP_UDPCSUM_NOK) == 0) { m->m_pkthdr.csum_flags |= @@ -2406,22 +2442,21 @@ age_rxeof(struct age_softc *sc, struct r m->m_pkthdr.ether_vtag = AGE_RX_VLAN_TAG(vtag); m->m_flags |= M_VLANTAG; } - +#ifndef __NO_STRICT_ALIGNMENT + m = age_fixup_rx(ifp, m); + if (m != NULL) +#endif + { /* Pass it on. */ AGE_UNLOCK(sc); (*ifp->if_input)(ifp, m); AGE_LOCK(sc); - - /* Reset mbuf chains. */ - AGE_RXCHAIN_RESET(sc); + } } } - if (count != nsegs) { - sc->age_cdata.age_rx_cons += nsegs; - sc->age_cdata.age_rx_cons %= AGE_RX_RING_CNT; - } else - sc->age_cdata.age_rx_cons = rx_cons; + /* Reset mbuf chains. */ + AGE_RXCHAIN_RESET(sc); } static int @@ -2456,16 +2491,16 @@ age_rxintr(struct age_softc *sc, int rr_ * I'm not sure whether this check is really needed. */ pktlen = AGE_RX_BYTES(le32toh(rxrd->len)); - if (nsegs != ((pktlen + (MCLBYTES - ETHER_ALIGN - 1)) / - (MCLBYTES - ETHER_ALIGN))) + if (nsegs != (pktlen + (AGE_RX_BUF_SIZE - 1)) / AGE_RX_BUF_SIZE) break; - prog++; /* Received a frame. */ age_rxeof(sc, rxrd); /* Clear return ring. */ rxrd->index = 0; AGE_DESC_INC(rr_cons, AGE_RR_RING_CNT); + sc->age_cdata.age_rx_cons += nsegs; + sc->age_cdata.age_rx_cons %= AGE_RX_RING_CNT; } if (prog > 0) { @@ -3065,7 +3100,9 @@ age_newbuf(struct age_softc *sc, struct if (m == NULL) return (ENOBUFS); m->m_len = m->m_pkthdr.len = MCLBYTES; - m_adj(m, ETHER_ALIGN); +#ifndef __NO_STRICT_ALIGNMENT + m_adj(m, AGE_RX_BUF_ALIGN); +#endif if (bus_dmamap_load_mbuf_sg(sc->age_cdata.age_rx_tag, sc->age_cdata.age_rx_sparemap, m, segs, &nsegs, 0) != 0) { Modified: head/sys/dev/age/if_agevar.h ============================================================================== --- head/sys/dev/age/if_agevar.h Tue Feb 5 00:33:32 2013 (r246340) +++ head/sys/dev/age/if_agevar.h Tue Feb 5 00:37:45 2013 (r246341) @@ -43,6 +43,12 @@ #define AGE_TSO_MAXSEGSIZE 4096 #define AGE_TSO_MAXSIZE (65535 + sizeof(struct ether_vlan_header)) #define AGE_MAXTXSEGS 32 +#define AGE_RX_BUF_ALIGN 8 +#ifndef __NO_STRICT_ALIGNMENT +#define AGE_RX_BUF_SIZE (MCLBYTES - AGE_RX_BUF_ALIGN) +#else +#define AGE_RX_BUF_SIZE (MCLBYTES) +#endif #define AGE_ADDR_LO(x) ((uint64_t) (x) & 0xFFFFFFFF) #define AGE_ADDR_HI(x) ((uint64_t) (x) >> 32) From owner-svn-src-head@FreeBSD.ORG Tue Feb 5 02:25:14 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id A798FD7F; Tue, 5 Feb 2013 02:25:14 +0000 (UTC) (envelope-from ganbold@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 8B45CEF9; Tue, 5 Feb 2013 02:25:14 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r152PEtg085807; Tue, 5 Feb 2013 02:25:14 GMT (envelope-from ganbold@svn.freebsd.org) Received: (from ganbold@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r152PDa2085802; Tue, 5 Feb 2013 02:25:13 GMT (envelope-from ganbold@svn.freebsd.org) Message-Id: <201302050225.r152PDa2085802@svn.freebsd.org> From: Ganbold Tsagaankhuu Date: Tue, 5 Feb 2013 02:25:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r246342 - in head/sys: arm/allwinner arm/conf boot/fdt/dts X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 05 Feb 2013 02:25:14 -0000 Author: ganbold (doc committer) Date: Tue Feb 5 02:25:13 2013 New Revision: 246342 URL: http://svnweb.freebsd.org/changeset/base/246342 Log: Add gpio driver and update dts and kernel config accordingly. Approved by: gonzo@ Added: head/sys/arm/allwinner/a10_gpio.c (contents, props changed) Modified: head/sys/arm/allwinner/files.a10 head/sys/arm/conf/CUBIEBOARD head/sys/boot/fdt/dts/cubieboard.dts Added: head/sys/arm/allwinner/a10_gpio.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/arm/allwinner/a10_gpio.c Tue Feb 5 02:25:13 2013 (r246342) @@ -0,0 +1,521 @@ +/*- + * Copyright (c) 2013 Ganbold Tsagaankhuu + * Copyright (c) 2012 Oleksandr Tymoshenko + * Copyright (c) 2012 Luiz Otavio O Souza. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + */ +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include + +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +#include "gpio_if.h" + +/* + * A10 have 9 banks of gpio. + * 32 pins per bank: + * PA0 - PA17 | PB0 - PB23 | PC0 - PC24 + * PD0 - PD27 | PE0 - PE31 | PF0 - PF5 + * PG0 - PG9 | PH0 - PH27 | PI0 - PI12 + */ + +#define A10_GPIO_PINS 288 +#define A10_GPIO_DEFAULT_CAPS (GPIO_PIN_INPUT | GPIO_PIN_OUTPUT | \ + GPIO_PIN_PULLUP | GPIO_PIN_PULLDOWN) + +struct a10_gpio_softc { + device_t sc_dev; + struct mtx sc_mtx; + struct resource * sc_mem_res; + struct resource * sc_irq_res; + bus_space_tag_t sc_bst; + bus_space_handle_t sc_bsh; + void * sc_intrhand; + int sc_gpio_npins; + struct gpio_pin sc_gpio_pins[A10_GPIO_PINS]; +}; + +enum a10_gpio_fsel { + A10_GPIO_INPUT, + A10_GPIO_OUTPUT, +}; + +enum a10_gpio_pud { + A10_GPIO_NONE, + A10_GPIO_PULLDOWN, + A10_GPIO_PULLUP, +}; + +#define A10_GPIO_LOCK(_sc) mtx_lock(&_sc->sc_mtx) +#define A10_GPIO_UNLOCK(_sc) mtx_unlock(&_sc->sc_mtx) +#define A10_GPIO_LOCK_ASSERT(_sc) mtx_assert(&_sc->sc_mtx, MA_OWNED) + +#define A10_GPIO_GP_CFG(_bank, _pin) 0x00 + ((_bank) * 0x24) + ((_pin)<<2) +#define A10_GPIO_GP_DAT(_bank) 0x10 + ((_bank) * 0x24) +#define A10_GPIO_GP_DRV(_bank, _pin) 0x14 + ((_bank) * 0x24) + ((_pin)<<2) +#define A10_GPIO_GP_PUL(_bank, _pin) 0x1c + ((_bank) * 0x24) + ((_pin)<<2) + +#define A10_GPIO_GP_INT_CFG0 0x200 +#define A10_GPIO_GP_INT_CFG1 0x204 +#define A10_GPIO_GP_INT_CFG2 0x208 +#define A10_GPIO_GP_INT_CFG3 0x20c + +#define A10_GPIO_GP_INT_CTL 0x210 +#define A10_GPIO_GP_INT_STA 0x214 +#define A10_GPIO_GP_INT_DEB 0x218 + +#define A10_GPIO_WRITE(_sc, _off, _val) \ + bus_space_write_4(_sc->sc_bst, _sc->sc_bsh, _off, _val) +#define A10_GPIO_READ(_sc, _off) \ + bus_space_read_4(_sc->sc_bst, _sc->sc_bsh, _off) + +static uint32_t +a10_gpio_get_function(struct a10_gpio_softc *sc, uint32_t pin) +{ + uint32_t bank, func, offset; + + bank = pin / 32; + pin = pin - 32 * bank; + func = pin >> 3; + offset = ((pin & 0x07) << 2); + + A10_GPIO_LOCK(sc); + func = (A10_GPIO_READ(sc, A10_GPIO_GP_CFG(bank, func)) >> offset) & 7; + A10_GPIO_UNLOCK(sc); + + return (func); +} + +static uint32_t +a10_gpio_func_flag(uint32_t nfunc) +{ + + switch (nfunc) { + case A10_GPIO_INPUT: + return (GPIO_PIN_INPUT); + case A10_GPIO_OUTPUT: + return (GPIO_PIN_OUTPUT); + } + return (0); +} + +static void +a10_gpio_set_function(struct a10_gpio_softc *sc, uint32_t pin, uint32_t f) +{ + uint32_t bank, func, data, offset; + + /* Must be called with lock held. */ + A10_GPIO_LOCK_ASSERT(sc); + + bank = pin / 32; + pin = pin - 32 * bank; + func = pin >> 3; + offset = ((pin & 0x07) << 2); + + data = A10_GPIO_READ(sc, A10_GPIO_GP_CFG(bank, func)); + data &= ~(7 << offset); + data |= (f << offset); + A10_GPIO_WRITE(sc, A10_GPIO_GP_CFG(bank, func), data); +} + +static void +a10_gpio_set_pud(struct a10_gpio_softc *sc, uint32_t pin, uint32_t state) +{ + uint32_t bank, offset, pull, val; + + /* Must be called with lock held. */ + A10_GPIO_LOCK_ASSERT(sc); + + bank = pin / 32; + pin = pin - 32 * bank; + pull = pin >> 4; + offset = ((pin & 0x0f) << 1); + + val = A10_GPIO_READ(sc, A10_GPIO_GP_PUL(bank, pull)); + val &= ~(0x03 << offset); + val |= (state << offset); + A10_GPIO_WRITE(sc, A10_GPIO_GP_PUL(bank, pull), val); +} + +static void +a10_gpio_pin_configure(struct a10_gpio_softc *sc, struct gpio_pin *pin, + unsigned int flags) +{ + + A10_GPIO_LOCK(sc); + + /* + * Manage input/output. + */ + if (flags & (GPIO_PIN_INPUT|GPIO_PIN_OUTPUT)) { + pin->gp_flags &= ~(GPIO_PIN_INPUT|GPIO_PIN_OUTPUT); + if (flags & GPIO_PIN_OUTPUT) { + pin->gp_flags |= GPIO_PIN_OUTPUT; + a10_gpio_set_function(sc, pin->gp_pin, + A10_GPIO_OUTPUT); + } else { + pin->gp_flags |= GPIO_PIN_INPUT; + a10_gpio_set_function(sc, pin->gp_pin, + A10_GPIO_INPUT); + } + } + + /* Manage Pull-up/pull-down. */ + pin->gp_flags &= ~(GPIO_PIN_PULLUP|GPIO_PIN_PULLDOWN); + if (flags & (GPIO_PIN_PULLUP|GPIO_PIN_PULLDOWN)) { + if (flags & GPIO_PIN_PULLUP) { + pin->gp_flags |= GPIO_PIN_PULLUP; + a10_gpio_set_pud(sc, pin->gp_pin, A10_GPIO_PULLUP); + } else { + pin->gp_flags |= GPIO_PIN_PULLDOWN; + a10_gpio_set_pud(sc, pin->gp_pin, A10_GPIO_PULLDOWN); + } + } else + a10_gpio_set_pud(sc, pin->gp_pin, A10_GPIO_NONE); + + A10_GPIO_UNLOCK(sc); +} + +static int +a10_gpio_pin_max(device_t dev, int *maxpin) +{ + + *maxpin = A10_GPIO_PINS - 1; + return (0); +} + +static int +a10_gpio_pin_getcaps(device_t dev, uint32_t pin, uint32_t *caps) +{ + struct a10_gpio_softc *sc = device_get_softc(dev); + int i; + + for (i = 0; i < sc->sc_gpio_npins; i++) { + if (sc->sc_gpio_pins[i].gp_pin == pin) + break; + } + + if (i >= sc->sc_gpio_npins) + return (EINVAL); + + A10_GPIO_LOCK(sc); + *caps = sc->sc_gpio_pins[i].gp_caps; + A10_GPIO_UNLOCK(sc); + + return (0); +} + +static int +a10_gpio_pin_getflags(device_t dev, uint32_t pin, uint32_t *flags) +{ + struct a10_gpio_softc *sc = device_get_softc(dev); + int i; + + for (i = 0; i < sc->sc_gpio_npins; i++) { + if (sc->sc_gpio_pins[i].gp_pin == pin) + break; + } + + if (i >= sc->sc_gpio_npins) + return (EINVAL); + + A10_GPIO_LOCK(sc); + *flags = sc->sc_gpio_pins[i].gp_flags; + A10_GPIO_UNLOCK(sc); + + return (0); +} + +static int +a10_gpio_pin_getname(device_t dev, uint32_t pin, char *name) +{ + struct a10_gpio_softc *sc = device_get_softc(dev); + int i; + + for (i = 0; i < sc->sc_gpio_npins; i++) { + if (sc->sc_gpio_pins[i].gp_pin == pin) + break; + } + + if (i >= sc->sc_gpio_npins) + return (EINVAL); + + A10_GPIO_LOCK(sc); + memcpy(name, sc->sc_gpio_pins[i].gp_name, GPIOMAXNAME); + A10_GPIO_UNLOCK(sc); + + return (0); +} + +static int +a10_gpio_pin_setflags(device_t dev, uint32_t pin, uint32_t flags) +{ + struct a10_gpio_softc *sc = device_get_softc(dev); + int i; + + for (i = 0; i < sc->sc_gpio_npins; i++) { + if (sc->sc_gpio_pins[i].gp_pin == pin) + break; + } + + if (i >= sc->sc_gpio_npins) + return (EINVAL); + + /* Filter out unwanted flags. */ + if ((flags &= sc->sc_gpio_pins[i].gp_caps) != flags) + return (EINVAL); + + /* Can't mix input/output together. */ + if ((flags & (GPIO_PIN_INPUT|GPIO_PIN_OUTPUT)) == + (GPIO_PIN_INPUT|GPIO_PIN_OUTPUT)) + return (EINVAL); + + /* Can't mix pull-up/pull-down together. */ + if ((flags & (GPIO_PIN_PULLUP|GPIO_PIN_PULLDOWN)) == + (GPIO_PIN_PULLUP|GPIO_PIN_PULLDOWN)) + return (EINVAL); + + a10_gpio_pin_configure(sc, &sc->sc_gpio_pins[i], flags); + + return (0); +} + +static int +a10_gpio_pin_set(device_t dev, uint32_t pin, unsigned int value) +{ + struct a10_gpio_softc *sc = device_get_softc(dev); + uint32_t bank, offset, data; + int i; + + for (i = 0; i < sc->sc_gpio_npins; i++) { + if (sc->sc_gpio_pins[i].gp_pin == pin) + break; + } + + if (i >= sc->sc_gpio_npins) + return (EINVAL); + + bank = pin / 32; + pin = pin - 32 * bank; + offset = pin & 0x1f; + + A10_GPIO_LOCK(sc); + data = A10_GPIO_READ(sc, A10_GPIO_GP_DAT(bank)); + if (value) + data |= (1 << offset); + else + data &= ~(1 << offset); + A10_GPIO_WRITE(sc, A10_GPIO_GP_DAT(bank), data); + A10_GPIO_UNLOCK(sc); + + return (0); +} + +static int +a10_gpio_pin_get(device_t dev, uint32_t pin, unsigned int *val) +{ + struct a10_gpio_softc *sc = device_get_softc(dev); + uint32_t bank, offset, reg_data; + int i; + + for (i = 0; i < sc->sc_gpio_npins; i++) { + if (sc->sc_gpio_pins[i].gp_pin == pin) + break; + } + + if (i >= sc->sc_gpio_npins) + return (EINVAL); + + bank = pin / 32; + pin = pin - 32 * bank; + offset = pin & 0x1f; + + A10_GPIO_LOCK(sc); + reg_data = A10_GPIO_READ(sc, A10_GPIO_GP_DAT(bank)); + A10_GPIO_UNLOCK(sc); + *val = (reg_data & (1 << offset)) ? 1 : 0; + + return (0); +} + +static int +a10_gpio_pin_toggle(device_t dev, uint32_t pin) +{ + struct a10_gpio_softc *sc = device_get_softc(dev); + uint32_t bank, data, offset; + int i; + + for (i = 0; i < sc->sc_gpio_npins; i++) { + if (sc->sc_gpio_pins[i].gp_pin == pin) + break; + } + + if (i >= sc->sc_gpio_npins) + return (EINVAL); + + bank = pin / 32; + pin = pin - 32 * bank; + offset = pin & 0x1f; + + A10_GPIO_LOCK(sc); + data = A10_GPIO_READ(sc, A10_GPIO_GP_DAT(bank)); + if (data & (1 << offset)) + data &= ~(1 << offset); + else + data |= (1 << offset); + A10_GPIO_WRITE(sc, A10_GPIO_GP_DAT(bank), data); + A10_GPIO_UNLOCK(sc); + + return (0); +} + +static int +a10_gpio_probe(device_t dev) +{ + if (!ofw_bus_is_compatible(dev, "allwinner,sun4i-gpio")) + return (ENXIO); + + device_set_desc(dev, "Allwinner GPIO controller"); + return (BUS_PROBE_DEFAULT); +} + +static int +a10_gpio_attach(device_t dev) +{ + struct a10_gpio_softc *sc = device_get_softc(dev); + uint32_t func; + int i, rid; + phandle_t gpio; + + sc->sc_dev = dev; + + mtx_init(&sc->sc_mtx, "a10 gpio", "gpio", MTX_DEF); + + rid = 0; + sc->sc_mem_res = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &rid, + RF_ACTIVE); + if (!sc->sc_mem_res) { + device_printf(dev, "cannot allocate memory window\n"); + return (ENXIO); + } + + sc->sc_bst = rman_get_bustag(sc->sc_mem_res); + sc->sc_bsh = rman_get_bushandle(sc->sc_mem_res); + + rid = 0; + sc->sc_irq_res = bus_alloc_resource_any(dev, SYS_RES_IRQ, &rid, + RF_ACTIVE); + if (!sc->sc_irq_res) { + bus_release_resource(dev, SYS_RES_MEMORY, 0, sc->sc_mem_res); + device_printf(dev, "cannot allocate interrupt\n"); + return (ENXIO); + } + + /* Find our node. */ + gpio = ofw_bus_get_node(sc->sc_dev); + + if (!OF_hasprop(gpio, "gpio-controller")) + /* Node is not a GPIO controller. */ + goto fail; + + /* Initialize the software controlled pins. */ + for (i = 0; i < A10_GPIO_PINS; i++) { + snprintf(sc->sc_gpio_pins[i].gp_name, GPIOMAXNAME, + "pin %d", i); + func = a10_gpio_get_function(sc, i); + sc->sc_gpio_pins[i].gp_pin = i; + sc->sc_gpio_pins[i].gp_caps = A10_GPIO_DEFAULT_CAPS; + sc->sc_gpio_pins[i].gp_flags = a10_gpio_func_flag(func); + } + sc->sc_gpio_npins = i; + + device_add_child(dev, "gpioc", device_get_unit(dev)); + device_add_child(dev, "gpiobus", device_get_unit(dev)); + return (bus_generic_attach(dev)); + +fail: + if (sc->sc_irq_res) + bus_release_resource(dev, SYS_RES_IRQ, 0, sc->sc_irq_res); + if (sc->sc_mem_res) + bus_release_resource(dev, SYS_RES_MEMORY, 0, sc->sc_mem_res); + return (ENXIO); +} + +static int +a10_gpio_detach(device_t dev) +{ + + return (EBUSY); +} + +static device_method_t a10_gpio_methods[] = { + /* Device interface */ + DEVMETHOD(device_probe, a10_gpio_probe), + DEVMETHOD(device_attach, a10_gpio_attach), + DEVMETHOD(device_detach, a10_gpio_detach), + + /* GPIO protocol */ + DEVMETHOD(gpio_pin_max, a10_gpio_pin_max), + DEVMETHOD(gpio_pin_getname, a10_gpio_pin_getname), + DEVMETHOD(gpio_pin_getflags, a10_gpio_pin_getflags), + DEVMETHOD(gpio_pin_getcaps, a10_gpio_pin_getcaps), + DEVMETHOD(gpio_pin_setflags, a10_gpio_pin_setflags), + DEVMETHOD(gpio_pin_get, a10_gpio_pin_get), + DEVMETHOD(gpio_pin_set, a10_gpio_pin_set), + DEVMETHOD(gpio_pin_toggle, a10_gpio_pin_toggle), + + DEVMETHOD_END +}; + +static devclass_t a10_gpio_devclass; + +static driver_t a10_gpio_driver = { + "gpio", + a10_gpio_methods, + sizeof(struct a10_gpio_softc), +}; + +DRIVER_MODULE(a10_gpio, simplebus, a10_gpio_driver, a10_gpio_devclass, 0, 0); Modified: head/sys/arm/allwinner/files.a10 ============================================================================== --- head/sys/arm/allwinner/files.a10 Tue Feb 5 00:37:45 2013 (r246341) +++ head/sys/arm/allwinner/files.a10 Tue Feb 5 02:25:13 2013 (r246342) @@ -10,6 +10,7 @@ arm/arm/cpufunc_asm_armv7.S standard arm/arm/irq_dispatch.S standard arm/allwinner/a10_clk.c standard +arm/allwinner/a10_gpio.c optional gpio arm/allwinner/a10_ehci.c optional ehci arm/allwinner/timer.c standard arm/allwinner/aintc.c standard Modified: head/sys/arm/conf/CUBIEBOARD ============================================================================== --- head/sys/arm/conf/CUBIEBOARD Tue Feb 5 00:37:45 2013 (r246341) +++ head/sys/arm/conf/CUBIEBOARD Tue Feb 5 02:25:13 2013 (r246342) @@ -99,7 +99,7 @@ device random # Entropy device #device iic # GPIO -#device gpio +device gpio device scbus # SCSI bus (required for SCSI) device da # Direct Access (disks) Modified: head/sys/boot/fdt/dts/cubieboard.dts ============================================================================== --- head/sys/boot/fdt/dts/cubieboard.dts Tue Feb 5 00:37:45 2013 (r246341) +++ head/sys/boot/fdt/dts/cubieboard.dts Tue Feb 5 02:25:13 2013 (r246342) @@ -76,6 +76,15 @@ clock-frequency = < 24000000 >; }; + GPIO: gpio@01c20800 { + #gpio-cells = <3>; + compatible = "allwinner,sun4i-gpio"; + gpio-controller; + reg =< 0x01c20800 0x400 >; + interrupts = < 28 >; + interrupt-parent = <&AINTC>; + }; + usb1: usb@01c1c000 { compatible = "allwinner,usb-ehci", "usb-ehci"; reg = <0x01c1c000 0x1000>; From owner-svn-src-head@FreeBSD.ORG Tue Feb 5 02:58:00 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 188809BD; Tue, 5 Feb 2013 02:58:00 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 00D0396; Tue, 5 Feb 2013 02:58:00 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r152vxXn095356; Tue, 5 Feb 2013 02:57:59 GMT (envelope-from pfg@svn.freebsd.org) Received: (from pfg@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r152vxlF095355; Tue, 5 Feb 2013 02:57:59 GMT (envelope-from pfg@svn.freebsd.org) Message-Id: <201302050257.r152vxlF095355@svn.freebsd.org> From: "Pedro F. Giffuni" Date: Tue, 5 Feb 2013 02:57:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r246346 - head/usr.sbin/crunch/crunchgen X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 05 Feb 2013 02:58:00 -0000 Author: pfg Date: Tue Feb 5 02:57:59 2013 New Revision: 246346 URL: http://svnweb.freebsd.org/changeset/base/246346 Log: crunchgen: Permit use of alternative linkers. Submitted by: Pete Chou MFC after: 1 week Modified: head/usr.sbin/crunch/crunchgen/crunchgen.c Modified: head/usr.sbin/crunch/crunchgen/crunchgen.c ============================================================================== --- head/usr.sbin/crunch/crunchgen/crunchgen.c Tue Feb 5 02:45:02 2013 (r246345) +++ head/usr.sbin/crunch/crunchgen/crunchgen.c Tue Feb 5 02:57:59 2013 (r246346) @@ -979,6 +979,7 @@ top_makefile_rules(FILE *outmk) { prog_t *p; + fprintf(outmk, "LD?= ld\n"); if ( subtract_strlst(&libs, &libs_so) ) fprintf(outmk, "# NOTE: Some LIBS declarations below overridden by LIBS_SO\n"); @@ -1108,7 +1109,7 @@ prog_makefile_rules(FILE *outmk, prog_t fprintf(outmk, " $(%s_LIBS)", p->ident); fprintf(outmk, "\n"); - fprintf(outmk, "\tld -dc -r -o %s.lo %s_stub.o $(%s_OBJPATHS)", + fprintf(outmk, "\t$(LD) -dc -r -o %s.lo %s_stub.o $(%s_OBJPATHS)", p->name, p->name, p->ident); if (p->libs) fprintf(outmk, " $(%s_LIBS)", p->ident); From owner-svn-src-head@FreeBSD.ORG Tue Feb 5 03:01:04 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id A893AB96; Tue, 5 Feb 2013 03:01:04 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 9BD0A101; Tue, 5 Feb 2013 03:01:04 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r15314Y6097936; Tue, 5 Feb 2013 03:01:04 GMT (envelope-from pfg@svn.freebsd.org) Received: (from pfg@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r15314AD097935; Tue, 5 Feb 2013 03:01:04 GMT (envelope-from pfg@svn.freebsd.org) Message-Id: <201302050301.r15314AD097935@svn.freebsd.org> From: "Pedro F. Giffuni" Date: Tue, 5 Feb 2013 03:01:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r246347 - head/sys/fs/ext2fs X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 05 Feb 2013 03:01:04 -0000 Author: pfg Date: Tue Feb 5 03:01:04 2013 New Revision: 246347 URL: http://svnweb.freebsd.org/changeset/base/246347 Log: ext2fs: Use EXT2_LINK_MAX instead of LINK_MAX Submitted by: Christoph Mallon MFC after: 2 weeks Modified: head/sys/fs/ext2fs/ext2_vnops.c Modified: head/sys/fs/ext2fs/ext2_vnops.c ============================================================================== --- head/sys/fs/ext2fs/ext2_vnops.c Tue Feb 5 02:57:59 2013 (r246346) +++ head/sys/fs/ext2fs/ext2_vnops.c Tue Feb 5 03:01:04 2013 (r246347) @@ -730,7 +730,7 @@ ext2_link(ap) goto out; } ip = VTOI(vp); - if ((nlink_t)ip->i_nlink >= LINK_MAX) { + if ((nlink_t)ip->i_nlink >= EXT2_LINK_MAX) { error = EMLINK; goto out; } @@ -841,7 +841,7 @@ abortit: goto abortit; dp = VTOI(fdvp); ip = VTOI(fvp); - if (ip->i_nlink >= LINK_MAX) { + if (ip->i_nlink >= EXT2_LINK_MAX) { VOP_UNLOCK(fvp, 0); error = EMLINK; goto abortit; @@ -939,7 +939,7 @@ abortit: * parent we don't fool with the link count. */ if (doingdirectory && newparent) { - if ((nlink_t)dp->i_nlink >= LINK_MAX) { + if ((nlink_t)dp->i_nlink >= EXT2_LINK_MAX) { error = EMLINK; goto bad; } @@ -1160,7 +1160,7 @@ ext2_mkdir(ap) panic("ext2_mkdir: no name"); #endif dp = VTOI(dvp); - if ((nlink_t)dp->i_nlink >= LINK_MAX) { + if ((nlink_t)dp->i_nlink >= EXT2_LINK_MAX) { error = EMLINK; goto out; } @@ -1524,7 +1524,7 @@ ext2_pathconf(ap) switch (ap->a_name) { case _PC_LINK_MAX: - *ap->a_retval = LINK_MAX; + *ap->a_retval = EXT2_LINK_MAX; return (0); case _PC_NAME_MAX: *ap->a_retval = NAME_MAX; From owner-svn-src-head@FreeBSD.ORG Tue Feb 5 03:08:57 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 52E0CF0A; Tue, 5 Feb 2013 03:08:57 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 461791A3; Tue, 5 Feb 2013 03:08:57 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r1538vDY099429; Tue, 5 Feb 2013 03:08:57 GMT (envelope-from pfg@svn.freebsd.org) Received: (from pfg@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r1538vXY099428; Tue, 5 Feb 2013 03:08:57 GMT (envelope-from pfg@svn.freebsd.org) Message-Id: <201302050308.r1538vXY099428@svn.freebsd.org> From: "Pedro F. Giffuni" Date: Tue, 5 Feb 2013 03:08:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r246348 - head/sys/fs/ext2fs X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 05 Feb 2013 03:08:57 -0000 Author: pfg Date: Tue Feb 5 03:08:56 2013 New Revision: 246348 URL: http://svnweb.freebsd.org/changeset/base/246348 Log: ext2fs: Use nitems(). Submitted by: Christoph Mallon MFC after: 2 weeks Modified: head/sys/fs/ext2fs/ext2_lookup.c Modified: head/sys/fs/ext2fs/ext2_lookup.c ============================================================================== --- head/sys/fs/ext2fs/ext2_lookup.c Tue Feb 5 03:01:04 2013 (r246347) +++ head/sys/fs/ext2fs/ext2_lookup.c Tue Feb 5 03:08:56 2013 (r246348) @@ -88,9 +88,8 @@ static u_char ext2_ft_to_dt[] = { DT_SOCK, /* EXT2_FT_SOCK */ DT_LNK, /* EXT2_FT_SYMLINK */ }; -#define FTTODT(ft) \ - ((ft) > sizeof(ext2_ft_to_dt) / sizeof(ext2_ft_to_dt[0]) ? \ - DT_UNKNOWN : ext2_ft_to_dt[(ft)]) +#define FTTODT(ft) \ + ((ft) > nitems(ext2_ft_to_dt) ? DT_UNKNOWN : ext2_ft_to_dt[(ft)]) static u_char dt_to_ext2_ft[] = { EXT2_FT_UNKNOWN, /* DT_UNKNOWN */ @@ -109,9 +108,8 @@ static u_char dt_to_ext2_ft[] = { EXT2_FT_UNKNOWN, /* unused */ EXT2_FT_UNKNOWN, /* DT_WHT */ }; -#define DTTOFT(dt) \ - ((dt) > sizeof(dt_to_ext2_ft) / sizeof(dt_to_ext2_ft[0]) ? \ - EXT2_FT_UNKNOWN : dt_to_ext2_ft[(dt)]) +#define DTTOFT(dt) \ + ((dt) > nitems(dt_to_ext2_ft) ? EXT2_FT_UNKNOWN : dt_to_ext2_ft[(dt)]) static int ext2_dirbadentry(struct vnode *dp, struct ext2fs_direct_2 *de, int entryoffsetinblock); From owner-svn-src-head@FreeBSD.ORG Tue Feb 5 03:13:06 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id A0F713F0; Tue, 5 Feb 2013 03:13:06 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 93D761F3; Tue, 5 Feb 2013 03:13:06 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r153D6oh001862; Tue, 5 Feb 2013 03:13:06 GMT (envelope-from pfg@svn.freebsd.org) Received: (from pfg@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r153D6nA001860; Tue, 5 Feb 2013 03:13:06 GMT (envelope-from pfg@svn.freebsd.org) Message-Id: <201302050313.r153D6nA001860@svn.freebsd.org> From: "Pedro F. Giffuni" Date: Tue, 5 Feb 2013 03:13:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r246349 - head/sys/fs/ext2fs X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 05 Feb 2013 03:13:06 -0000 Author: pfg Date: Tue Feb 5 03:13:05 2013 New Revision: 246349 URL: http://svnweb.freebsd.org/changeset/base/246349 Log: ext2fs: Correct off-by-one errors in FFTODT() and DDTOFT(). Submitted by: Christoph Mallon MFC after: 2 weeks Modified: head/sys/fs/ext2fs/ext2_lookup.c Modified: head/sys/fs/ext2fs/ext2_lookup.c ============================================================================== --- head/sys/fs/ext2fs/ext2_lookup.c Tue Feb 5 03:08:56 2013 (r246348) +++ head/sys/fs/ext2fs/ext2_lookup.c Tue Feb 5 03:13:05 2013 (r246349) @@ -89,7 +89,7 @@ static u_char ext2_ft_to_dt[] = { DT_LNK, /* EXT2_FT_SYMLINK */ }; #define FTTODT(ft) \ - ((ft) > nitems(ext2_ft_to_dt) ? DT_UNKNOWN : ext2_ft_to_dt[(ft)]) + ((ft) < nitems(ext2_ft_to_dt) ? ext2_ft_to_dt[(ft)] : DT_UNKNOWN) static u_char dt_to_ext2_ft[] = { EXT2_FT_UNKNOWN, /* DT_UNKNOWN */ @@ -109,7 +109,7 @@ static u_char dt_to_ext2_ft[] = { EXT2_FT_UNKNOWN, /* DT_WHT */ }; #define DTTOFT(dt) \ - ((dt) > nitems(dt_to_ext2_ft) ? EXT2_FT_UNKNOWN : dt_to_ext2_ft[(dt)]) + ((dt) < nitems(dt_to_ext2_ft) ? dt_to_ext2_ft[(dt)] : EXT2_FT_UNKNOWN) static int ext2_dirbadentry(struct vnode *dp, struct ext2fs_direct_2 *de, int entryoffsetinblock); From owner-svn-src-head@FreeBSD.ORG Tue Feb 5 03:17:42 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 9D2D25B3; Tue, 5 Feb 2013 03:17:42 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 79D2B228; Tue, 5 Feb 2013 03:17:42 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r153Hg44002515; Tue, 5 Feb 2013 03:17:42 GMT (envelope-from pfg@svn.freebsd.org) Received: (from pfg@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r153HgTw002514; Tue, 5 Feb 2013 03:17:42 GMT (envelope-from pfg@svn.freebsd.org) Message-Id: <201302050317.r153HgTw002514@svn.freebsd.org> From: "Pedro F. Giffuni" Date: Tue, 5 Feb 2013 03:17:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r246350 - head/sys/fs/ext2fs X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 05 Feb 2013 03:17:42 -0000 Author: pfg Date: Tue Feb 5 03:17:41 2013 New Revision: 246350 URL: http://svnweb.freebsd.org/changeset/base/246350 Log: ext2fs: Remove useless rootino local variable. Submitted by: Christoph Mallon MFC after: 2 weeks Modified: head/sys/fs/ext2fs/ext2_lookup.c Modified: head/sys/fs/ext2fs/ext2_lookup.c ============================================================================== --- head/sys/fs/ext2fs/ext2_lookup.c Tue Feb 5 03:13:05 2013 (r246349) +++ head/sys/fs/ext2fs/ext2_lookup.c Tue Feb 5 03:17:41 2013 (r246350) @@ -1086,7 +1086,7 @@ ext2_checkpath(source, target, cred) struct ucred *cred; { struct vnode *vp; - int error, rootino, namlen; + int error, namlen; struct dirtemplate dirbuf; vp = ITOV(target); @@ -1094,9 +1094,8 @@ ext2_checkpath(source, target, cred) error = EEXIST; goto out; } - rootino = EXT2_ROOTINO; error = 0; - if (target->i_number == rootino) + if (target->i_number == EXT2_ROOTINO) goto out; for (;;) { @@ -1121,7 +1120,7 @@ ext2_checkpath(source, target, cred) error = EINVAL; break; } - if (dirbuf.dotdot_ino == rootino) + if (dirbuf.dotdot_ino == EXT2_ROOTINO) break; vput(vp); if ((error = VFS_VGET(vp->v_mount, dirbuf.dotdot_ino, From owner-svn-src-head@FreeBSD.ORG Tue Feb 5 03:23:57 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 1BB0393E; Tue, 5 Feb 2013 03:23:57 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 0EB11276; Tue, 5 Feb 2013 03:23:57 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r153NuwM004929; Tue, 5 Feb 2013 03:23:56 GMT (envelope-from pfg@svn.freebsd.org) Received: (from pfg@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r153Nudo004928; Tue, 5 Feb 2013 03:23:56 GMT (envelope-from pfg@svn.freebsd.org) Message-Id: <201302050323.r153Nudo004928@svn.freebsd.org> From: "Pedro F. Giffuni" Date: Tue, 5 Feb 2013 03:23:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r246351 - head/sys/fs/ext2fs X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 05 Feb 2013 03:23:57 -0000 Author: pfg Date: Tue Feb 5 03:23:56 2013 New Revision: 246351 URL: http://svnweb.freebsd.org/changeset/base/246351 Log: ext2fs: Remove unused em_e2fsb definition.. Submitted by: Christoph Mallon MFC after: 2 weeks Modified: head/sys/fs/ext2fs/ext2_mount.h Modified: head/sys/fs/ext2fs/ext2_mount.h ============================================================================== --- head/sys/fs/ext2fs/ext2_mount.h Tue Feb 5 03:17:41 2013 (r246350) +++ head/sys/fs/ext2fs/ext2_mount.h Tue Feb 5 03:23:56 2013 (r246351) @@ -48,7 +48,6 @@ struct ext2mount { struct vnode *um_devvp; /* block device mounted vnode */ struct m_ext2fs *um_e2fs; /* EXT2FS */ -#define em_e2fsb um_e2fs->e2fs u_long um_nindir; /* indirect ptrs per block */ u_long um_bptrtodb; /* indir ptr to disk block */ From owner-svn-src-head@FreeBSD.ORG Tue Feb 5 03:26:35 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 79425AD8; Tue, 5 Feb 2013 03:26:35 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 5556B292; Tue, 5 Feb 2013 03:26:35 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r153QZjK005306; Tue, 5 Feb 2013 03:26:35 GMT (envelope-from pfg@svn.freebsd.org) Received: (from pfg@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r153QZJC005305; Tue, 5 Feb 2013 03:26:35 GMT (envelope-from pfg@svn.freebsd.org) Message-Id: <201302050326.r153QZJC005305@svn.freebsd.org> From: "Pedro F. Giffuni" Date: Tue, 5 Feb 2013 03:26:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r246352 - head/sys/fs/ext2fs X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 05 Feb 2013 03:26:35 -0000 Author: pfg Date: Tue Feb 5 03:26:34 2013 New Revision: 246352 URL: http://svnweb.freebsd.org/changeset/base/246352 Log: ext2fs: move assignment where it is not dead. Submitted by: Christoph Mallon MFC after: 2 weeks Modified: head/sys/fs/ext2fs/ext2_lookup.c Modified: head/sys/fs/ext2fs/ext2_lookup.c ============================================================================== --- head/sys/fs/ext2fs/ext2_lookup.c Tue Feb 5 03:23:56 2013 (r246351) +++ head/sys/fs/ext2fs/ext2_lookup.c Tue Feb 5 03:26:34 2013 (r246352) @@ -1094,9 +1094,10 @@ ext2_checkpath(source, target, cred) error = EEXIST; goto out; } - error = 0; - if (target->i_number == EXT2_ROOTINO) + if (target->i_number == EXT2_ROOTINO) { + error = 0; goto out; + } for (;;) { if (vp->v_type != VDIR) { From owner-svn-src-head@FreeBSD.ORG Tue Feb 5 04:13:35 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 2BFCA14A; Tue, 5 Feb 2013 04:13:35 +0000 (UTC) (envelope-from ganbold@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 061733D2; Tue, 5 Feb 2013 04:13:35 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r154DYFQ019823; Tue, 5 Feb 2013 04:13:34 GMT (envelope-from ganbold@svn.freebsd.org) Received: (from ganbold@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r154DYbQ019821; Tue, 5 Feb 2013 04:13:34 GMT (envelope-from ganbold@svn.freebsd.org) Message-Id: <201302050413.r154DYbQ019821@svn.freebsd.org> From: Ganbold Tsagaankhuu Date: Tue, 5 Feb 2013 04:13:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r246353 - head/sys/arm/allwinner X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 05 Feb 2013 04:13:35 -0000 Author: ganbold (doc committer) Date: Tue Feb 5 04:13:34 2013 New Revision: 246353 URL: http://svnweb.freebsd.org/changeset/base/246353 Log: Remove two dead assignments and make use of sc more explicit and clear Submitted by: Christoph Mallon Approved by: gonzo@ Modified: head/sys/arm/allwinner/a10_clk.c Modified: head/sys/arm/allwinner/a10_clk.c ============================================================================== --- head/sys/arm/allwinner/a10_clk.c Tue Feb 5 03:26:34 2013 (r246352) +++ head/sys/arm/allwinner/a10_clk.c Tue Feb 5 04:13:34 2013 (r246353) @@ -62,10 +62,10 @@ struct a10_ccm_softc { static struct a10_ccm_softc *a10_ccm_sc = NULL; -#define ccm_read_4(reg) \ - bus_space_read_4(a10_ccm_sc->bst, a10_ccm_sc->bsh, reg) -#define ccm_write_4(reg, val) \ - bus_space_write_4(a10_ccm_sc->bst, a10_ccm_sc->bsh, reg, val) +#define ccm_read_4(sc, reg) \ + bus_space_read_4((sc)->bst, (sc)->bsh, (reg)) +#define ccm_write_4(sc, reg, val) \ + bus_space_write_4((sc)->bst, (sc)->bsh, (reg), (val)) static int a10_ccm_probe(device_t dev) @@ -121,24 +121,24 @@ int a10_clk_usb_activate(void) { struct a10_ccm_softc *sc = a10_ccm_sc; - uint32_t reg_value = 0; + uint32_t reg_value; if (sc == NULL) return ENXIO; /* Gating AHB clock for USB */ - reg_value = ccm_read_4(CCM_AHB_GATING0); + reg_value = ccm_read_4(sc, CCM_AHB_GATING0); reg_value |= CCM_AHB_GATING_USB0; /* AHB clock gate usb0 */ reg_value |= CCM_AHB_GATING_EHCI1; /* AHB clock gate ehci1 */ - ccm_write_4(CCM_AHB_GATING0, reg_value); + ccm_write_4(sc, CCM_AHB_GATING0, reg_value); /* Enable clock for USB */ - reg_value = ccm_read_4(CCM_USB_CLK); + reg_value = ccm_read_4(sc, CCM_USB_CLK); reg_value |= CCM_USB_PHY; /* USBPHY */ reg_value |= CCM_USB0_RESET; /* disable reset for USB0 */ reg_value |= CCM_USB1_RESET; /* disable reset for USB1 */ reg_value |= CCM_USB2_RESET; /* disable reset for USB2 */ - ccm_write_4(CCM_USB_CLK, reg_value); + ccm_write_4(sc, CCM_USB_CLK, reg_value); return (0); } @@ -147,24 +147,24 @@ int a10_clk_usb_deactivate(void) { struct a10_ccm_softc *sc = a10_ccm_sc; - uint32_t reg_value = 0; + uint32_t reg_value; if (sc == NULL) return ENXIO; /* Disable clock for USB */ - reg_value = ccm_read_4(CCM_USB_CLK); + reg_value = ccm_read_4(sc, CCM_USB_CLK); reg_value &= ~CCM_USB_PHY; /* USBPHY */ reg_value &= ~CCM_USB0_RESET; /* reset for USB0 */ reg_value &= ~CCM_USB1_RESET; /* reset for USB1 */ reg_value &= ~CCM_USB2_RESET; /* reset for USB2 */ - ccm_write_4(CCM_USB_CLK, reg_value); + ccm_write_4(sc, CCM_USB_CLK, reg_value); /* Disable gating AHB clock for USB */ - reg_value = ccm_read_4(CCM_AHB_GATING0); + reg_value = ccm_read_4(sc, CCM_AHB_GATING0); reg_value &= ~CCM_AHB_GATING_USB0; /* disable AHB clock gate usb0 */ reg_value &= ~CCM_AHB_GATING_EHCI1; /* disable AHB clock gate ehci1 */ - ccm_write_4(CCM_AHB_GATING0, reg_value); + ccm_write_4(sc, CCM_AHB_GATING0, reg_value); return (0); } From owner-svn-src-head@FreeBSD.ORG Tue Feb 5 05:16:03 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 46EB0784; Tue, 5 Feb 2013 05:16:03 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 2158876F; Tue, 5 Feb 2013 05:16:03 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r155G2SO037800; Tue, 5 Feb 2013 05:16:03 GMT (envelope-from andrew@svn.freebsd.org) Received: (from andrew@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r155G2Vi037799; Tue, 5 Feb 2013 05:16:02 GMT (envelope-from andrew@svn.freebsd.org) Message-Id: <201302050516.r155G2Vi037799@svn.freebsd.org> From: Andrew Turner Date: Tue, 5 Feb 2013 05:16:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r246354 - head/share/mk X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 05 Feb 2013 05:16:03 -0000 Author: andrew Date: Tue Feb 5 05:16:02 2013 New Revision: 246354 URL: http://svnweb.freebsd.org/changeset/base/246354 Log: Build clang for little-endian arm by default. Due to size issues when built with gcc disable CLANG_FULL for now. Modified: head/share/mk/bsd.own.mk Modified: head/share/mk/bsd.own.mk ============================================================================== --- head/share/mk/bsd.own.mk Tue Feb 5 04:13:34 2013 (r246353) +++ head/share/mk/bsd.own.mk Tue Feb 5 05:16:02 2013 (r246354) @@ -389,9 +389,13 @@ __T=${TARGET_ARCH} .else __T=${MACHINE_ARCH} .endif -# Clang is only for x86 and powerpc right now, by default. +# Clang is only for x86, powerpc and little-endian arm right now, by default. .if ${__T} == "amd64" || ${__T} == "i386" || ${__T:Mpowerpc*} __DEFAULT_YES_OPTIONS+=CLANG CLANG_FULL +.elif ${__T} == "arm" || ${__T} == "armv6" +__DEFAULT_YES_OPTIONS+=CLANG +# GCC is unable to build the full clang on arm, disable it by default. +__DEFAULT_NO_OPTIONS+=CLANG_FULL .else __DEFAULT_NO_OPTIONS+=CLANG CLANG_FULL .endif From owner-svn-src-head@FreeBSD.ORG Tue Feb 5 07:21:24 2013 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: by hub.freebsd.org (Postfix, from userid 1033) id 4A559611; Tue, 5 Feb 2013 07:21:24 +0000 (UTC) Date: Tue, 5 Feb 2013 07:21:24 +0000 From: Alexey Dokuchaev To: Andriy Gapon Subject: Re: svn commit: r246251 - head/sys/dev/acpica Message-ID: <20130205072124.GA97885@FreeBSD.org> References: <201302021244.r12CiKgj046079@svn.freebsd.org> <20130202125122.GA4975@FreeBSD.org> <20130202151137.GA28366@FreeBSD.org> <510E3A9D.7040005@FreeBSD.org> MIME-Version: 1.0 Content-Type: text/plain; charset=koi8-r Content-Disposition: inline In-Reply-To: <510E3A9D.7040005@FreeBSD.org> User-Agent: Mutt/1.5.21 (2010-09-15) Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 05 Feb 2013 07:21:24 -0000 On Sun, Feb 03, 2013 at 12:23:25PM +0200, Andriy Gapon wrote: > on 02/02/2013 17:11 Alexey Dokuchaev said the following: > > On Sat, Feb 02, 2013 at 12:51:22PM +0000, Alexey Dokuchaev wrote: > >> On Sat, Feb 02, 2013 at 12:44:20PM +0000, Andriy Gapon wrote: > >>> New Revision: 246251 > >>> URL: http://svnweb.freebsd.org/changeset/base/246251 > >>> > >>> Log: > >>> acpi: clear power button status bit after waking up... > >>> so that it is not confused for a new power off request. > > > > Andriy, it appears to me that ACPI code is substantially different between > > 8-stable and head, so the patch cannot be applied as is. [...] > > P.S. logically the new block of code seems to belong to acpi_sleep_machdep() > before intr_restore() call. OK, thanks, I will try to cook something up and report how would it go. ./danfe From owner-svn-src-head@FreeBSD.ORG Tue Feb 5 07:46:17 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id E31A8BBD; Tue, 5 Feb 2013 07:46:17 +0000 (UTC) (envelope-from pluknet@gmail.com) Received: from mail-wi0-f171.google.com (mail-wi0-f171.google.com [209.85.212.171]) by mx1.freebsd.org (Postfix) with ESMTP id 0C67AC1B; Tue, 5 Feb 2013 07:46:16 +0000 (UTC) Received: by mail-wi0-f171.google.com with SMTP id hn17so2540206wib.10 for ; Mon, 04 Feb 2013 23:46:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:x-received:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type; bh=z6BNFIvAqcL5z2BIIFyQaZLmeA8CycbqmjmzBo+cgI4=; b=g7wVW0yecpU55gZfJVJLS9Kx08cAVmuDS3AcjnJcbGVYdXzk3w8wn5w/PquJQz1qgb Va4eRc/44oNp50uJrIv0j7PpgThV/rjaoxnAfbj0PDW9tDgf8NlQUSNbHr/MT6WpZxy4 /CyV+V1u0vu9s2UqhbrRSE862fYwg7+6p89ae3qukk2TilNX9rTF92Wh5ivHE91PeHKr awvCRAC3CQr1sc9h0grCccPB6oYZSur+X49cJzVgN9zIaLhLZzLJBbp7yU3YFT1vsW+Q e3KLacUmuXG3zHJNNRI7QV1cnrQMugfy5YtOI4wYwCxPmeNmUJsD958LJN7sec7fdD9O KSTA== MIME-Version: 1.0 X-Received: by 10.180.85.8 with SMTP id d8mr15075500wiz.4.1360050375905; Mon, 04 Feb 2013 23:46:15 -0800 (PST) Sender: pluknet@gmail.com Received: by 10.195.12.163 with HTTP; Mon, 4 Feb 2013 23:46:15 -0800 (PST) In-Reply-To: <201302041446.55786.jhb@freebsd.org> References: <201301231834.r0NIYLnp006407@svn.freebsd.org> <201302041446.55786.jhb@freebsd.org> Date: Tue, 5 Feb 2013 10:46:15 +0300 X-Google-Sender-Auth: rHSrf6qW7eqGcHsS8fZsT4d95rg Message-ID: Subject: Re: svn commit: r245848 - head/sys/boot/i386/libi386 From: Sergey Kandaurov To: John Baldwin Content-Type: text/plain; charset=ISO-8859-1 Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 05 Feb 2013 07:46:18 -0000 On 4 February 2013 23:46, John Baldwin wrote: > On Monday, February 04, 2013 4:43:36 am Sergey Kandaurov wrote: >> On 23 January 2013 22:34, John Baldwin wrote: >> > Author: jhb >> > Date: Wed Jan 23 18:34:21 2013 >> > New Revision: 245848 >> > URL: http://svnweb.freebsd.org/changeset/base/245848 >> > >> > Log: >> > Always update the hw.uart.console hint anytime a change is made to the >> > comconsole setup. Previously the hint would be set when if you set a >> > custom port, but it would not be updated if you later set a custom speed. >> > >> > Also, leave the hw.uart.console hint mutable so it can be overridden or >> > unset by the user if needed. >> > >> > Reviewed by: kib (earlier version) >> > MFC after: 1 week >> >> Looks like this results in something wrong. >> I have a serial console at COM2 (uart1), but it chooses uart0 >> (1016 == 0x3F8), compare .flags and the final hw.uart.console value. > > Do you have a working console in the loader? It is setting the hint based > on what the loader uses. I use this to use COM2 for both loader and > kernel: > > console="comconsole vidconsole" > comconsole_port=0x2f8 Yep, with new changes I still have a working console in the loader. I don't see output starting from kernel boot until login prompt. > Note that when hw.uart.console is set, any flags set in hint.uart.X.flags > to set the console are ignored. If you are not using -h in /boot.config or > setting 'console' for the loader to enable a serial console then the loader > should not be setting hw.uart.console (if it is, that is a bug to be fixed). > However, configuring the kernel to use a different serial console from the > loader seems very odd. You should be able to manually set hw.uart.console in > loader.conf if you are doing that. Err.. No, I haven't set hw.uart.console. Sorry for being misleading. The cited snippet from my previous mail was to demonstrate how the resulting hw.uart.console value depends (or rather not :)) on hints. All I have (changed) wrt console is: /boot/device.hints #hint.uart.0.flags="0x10" hint.uart.1.flags="0x10" /boot/loader.conf boot_multicons="YES" boot_serial="YES" boot_verbose="YES" console="comconsole,vidconsole" This setup worked for ages. To isolate this problem I took /boot/loader from my older current machine (also with COM2) to replace it here, and it started to work again. -- wbr, pluknet From owner-svn-src-head@FreeBSD.ORG Tue Feb 5 09:43:40 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 1DE58800; Tue, 5 Feb 2013 09:43:40 +0000 (UTC) (envelope-from rdivacky@vlakno.cz) Received: from vlakno.cz (mail.vlakno.cz [178.238.39.38]) by mx1.freebsd.org (Postfix) with ESMTP id D70468A7; Tue, 5 Feb 2013 09:43:39 +0000 (UTC) Received: by vlakno.cz (Postfix, from userid 1002) id 3E6E61CC55A2; Tue, 5 Feb 2013 10:36:32 +0100 (CET) Date: Tue, 5 Feb 2013 10:36:32 +0100 From: Roman Divacky To: Andrew Turner Subject: Re: svn commit: r246354 - head/share/mk Message-ID: <20130205093632.GA15394@freebsd.org> References: <201302050516.r155G2Vi037799@svn.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201302050516.r155G2Vi037799@svn.freebsd.org> User-Agent: Mutt/1.5.21 (2010-09-15) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 05 Feb 2013 09:43:40 -0000 Just for comparison whats the size difference between clang built clang and gcc built clang on arm? On Tue, Feb 05, 2013 at 05:16:02AM +0000, Andrew Turner wrote: > Author: andrew > Date: Tue Feb 5 05:16:02 2013 > New Revision: 246354 > URL: http://svnweb.freebsd.org/changeset/base/246354 > > Log: > Build clang for little-endian arm by default. Due to size issues when built > with gcc disable CLANG_FULL for now. > > Modified: > head/share/mk/bsd.own.mk > > Modified: head/share/mk/bsd.own.mk > ============================================================================== > --- head/share/mk/bsd.own.mk Tue Feb 5 04:13:34 2013 (r246353) > +++ head/share/mk/bsd.own.mk Tue Feb 5 05:16:02 2013 (r246354) > @@ -389,9 +389,13 @@ __T=${TARGET_ARCH} > .else > __T=${MACHINE_ARCH} > .endif > -# Clang is only for x86 and powerpc right now, by default. > +# Clang is only for x86, powerpc and little-endian arm right now, by default. > .if ${__T} == "amd64" || ${__T} == "i386" || ${__T:Mpowerpc*} > __DEFAULT_YES_OPTIONS+=CLANG CLANG_FULL > +.elif ${__T} == "arm" || ${__T} == "armv6" > +__DEFAULT_YES_OPTIONS+=CLANG > +# GCC is unable to build the full clang on arm, disable it by default. > +__DEFAULT_NO_OPTIONS+=CLANG_FULL > .else > __DEFAULT_NO_OPTIONS+=CLANG CLANG_FULL > .endif From owner-svn-src-head@FreeBSD.ORG Tue Feb 5 11:46:06 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id ACF9F8F7; Tue, 5 Feb 2013 11:46:06 +0000 (UTC) (envelope-from andrew@fubar.geek.nz) Received: from smtp5.clear.net.nz (smtp5.clear.net.nz [203.97.33.68]) by mx1.freebsd.org (Postfix) with ESMTP id 7CE1DDD; Tue, 5 Feb 2013 11:46:06 +0000 (UTC) Received: from mxin3-orange.clear.net.nz (lb2-srcnat.clear.net.nz [203.97.32.237]) by smtp5.clear.net.nz (CLEAR Net Mail) with ESMTP id <0MHQ005MLVZ8Y040@smtp5.clear.net.nz>; Wed, 06 Feb 2013 00:30:59 +1300 (NZDT) Received: from 202-0-48-19.paradise.net.nz (HELO bender) ([202.0.48.19]) by smtpin32.paradise.net.nz with ESMTP; Wed, 06 Feb 2013 00:30:58 +1300 Date: Wed, 06 Feb 2013 00:30:10 +1300 From: Andrew Turner Subject: Re: svn commit: r246354 - head/share/mk In-reply-to: <20130205093632.GA15394@freebsd.org> To: Roman Divacky Message-id: <20130206003010.3f9aaa37@bender> MIME-version: 1.0 Content-type: text/plain; charset=US-ASCII Content-transfer-encoding: 7bit References: <201302050516.r155G2Vi037799@svn.freebsd.org> <20130205093632.GA15394@freebsd.org> Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 05 Feb 2013 11:46:06 -0000 On Tue, 5 Feb 2013 10:36:32 +0100 Roman Divacky wrote: > Just for comparison whats the size difference between clang built > clang and gcc built clang on arm? When I use WITHOUT_CLANG_FULL: clang built with gcc is 43MB clang built with clang is 25MB When I use WITH_CLANG_FULL: clang built with gcc fails to link clang built with clang is 28MB Andrew From owner-svn-src-head@FreeBSD.ORG Tue Feb 5 12:18:39 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id E485A75; Tue, 5 Feb 2013 12:18:39 +0000 (UTC) (envelope-from des@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id CD47A335; Tue, 5 Feb 2013 12:18:39 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r15CIdkc068452; Tue, 5 Feb 2013 12:18:39 GMT (envelope-from des@svn.freebsd.org) Received: (from des@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r15CIdE2068451; Tue, 5 Feb 2013 12:18:39 GMT (envelope-from des@svn.freebsd.org) Message-Id: <201302051218.r15CIdE2068451@svn.freebsd.org> From: Dag-Erling Smørgrav Date: Tue, 5 Feb 2013 12:18:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r246358 - head/etc/rc.d X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 05 Feb 2013 12:18:40 -0000 Author: des Date: Tue Feb 5 12:18:39 2013 New Revision: 246358 URL: http://svnweb.freebsd.org/changeset/base/246358 Log: Load the pfsync module if necessary. Reviewed by: glebius@ MFC after: 1 week Modified: head/etc/rc.d/pfsync Modified: head/etc/rc.d/pfsync ============================================================================== --- head/etc/rc.d/pfsync Tue Feb 5 09:53:32 2013 (r246357) +++ head/etc/rc.d/pfsync Tue Feb 5 12:18:39 2013 (r246358) @@ -35,6 +35,7 @@ pfsync_start() if [ -n "${pfsync_syncpeer}" ]; then _syncpeer="syncpeer ${pfsync_syncpeer}" fi + load_kld pfsync ifconfig pfsync0 $_syncpeer syncdev $pfsync_syncdev $pfsync_ifconfig up } From owner-svn-src-head@FreeBSD.ORG Tue Feb 5 12:37:51 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 84EAD637; Tue, 5 Feb 2013 12:37:51 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 763AD678; Tue, 5 Feb 2013 12:37:51 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r15CbpE6074188; Tue, 5 Feb 2013 12:37:51 GMT (envelope-from hselasky@svn.freebsd.org) Received: (from hselasky@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r15CbpCe074187; Tue, 5 Feb 2013 12:37:51 GMT (envelope-from hselasky@svn.freebsd.org) Message-Id: <201302051237.r15CbpCe074187@svn.freebsd.org> From: Hans Petter Selasky Date: Tue, 5 Feb 2013 12:37:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r246359 - head/sys/boot/usb X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 05 Feb 2013 12:37:51 -0000 Author: hselasky Date: Tue Feb 5 12:37:50 2013 New Revision: 246359 URL: http://svnweb.freebsd.org/changeset/base/246359 Log: Fix depend target. Modified: head/sys/boot/usb/Makefile Modified: head/sys/boot/usb/Makefile ============================================================================== --- head/sys/boot/usb/Makefile Tue Feb 5 12:18:39 2013 (r246358) +++ head/sys/boot/usb/Makefile Tue Feb 5 12:37:50 2013 (r246359) @@ -42,13 +42,13 @@ OBJCOPY?= objcopy SYSCC?= cc CFLAGS+= -DBOOTPROG=\"usbloader\" -CFLAGS+= -DUSB_GLOBAL_INCLUDE_FILE="\"bsd_global.h\"" +CFLAGS+= -DUSB_GLOBAL_INCLUDE_FILE=\"bsd_global.h\" CFLAGS+= -ffunction-sections -fdata-sections CFLAGS+= -ffreestanding CFLAGS+= -Wformat -Wall -CFLAGS+= -I ${S} -CFLAGS+= -I ${T} -CFLAGS+= -I ${.CURDIR} +CFLAGS+= -I${S} +CFLAGS+= -I${T} +CFLAGS+= -I${.CURDIR} CFLAGS+= -g .if ${MACHINE_CPUARCH} == "i386" || ${MACHINE_CPUARCH} == "amd64" From owner-svn-src-head@FreeBSD.ORG Tue Feb 5 13:30:08 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id ECB16506; Tue, 5 Feb 2013 13:30:08 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id D0336921; Tue, 5 Feb 2013 13:30:08 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r15DU8YE090819; Tue, 5 Feb 2013 13:30:08 GMT (envelope-from hselasky@svn.freebsd.org) Received: (from hselasky@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r15DU7vn090633; Tue, 5 Feb 2013 13:30:07 GMT (envelope-from hselasky@svn.freebsd.org) Message-Id: <201302051330.r15DU7vn090633@svn.freebsd.org> From: Hans Petter Selasky Date: Tue, 5 Feb 2013 13:30:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r246360 - head/sys/dev/usb X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 05 Feb 2013 13:30:09 -0000 Author: hselasky Date: Tue Feb 5 13:30:07 2013 New Revision: 246360 URL: http://svnweb.freebsd.org/changeset/base/246360 Log: Fix some nits. Modified: head/sys/dev/usb/usb_bus.h head/sys/dev/usb/usb_dynamic.c head/sys/dev/usb/usb_msctest.c head/sys/dev/usb/usb_process.c head/sys/dev/usb/usb_request.c Modified: head/sys/dev/usb/usb_bus.h ============================================================================== --- head/sys/dev/usb/usb_bus.h Tue Feb 5 12:37:50 2013 (r246359) +++ head/sys/dev/usb/usb_bus.h Tue Feb 5 13:30:07 2013 (r246360) @@ -51,7 +51,9 @@ struct usb_bus_stat { struct usb_bus { struct usb_bus_stat stats_err; struct usb_bus_stat stats_ok; +#if USB_HAVE_ROOT_MOUNT_HOLD struct root_hold_token *bus_roothold; +#endif /* * There are two callback processes. One for Giant locked * callbacks. One for non-Giant locked callbacks. This should Modified: head/sys/dev/usb/usb_dynamic.c ============================================================================== --- head/sys/dev/usb/usb_dynamic.c Tue Feb 5 12:37:50 2013 (r246359) +++ head/sys/dev/usb/usb_dynamic.c Tue Feb 5 13:30:07 2013 (r246360) @@ -68,7 +68,7 @@ usb_temp_setup_by_index_t *usb_temp_setu usb_temp_unsetup_t *usb_temp_unsetup_p = &usb_temp_unsetup_w; usb_test_quirk_t *usb_test_quirk_p = &usb_test_quirk_w; usb_quirk_ioctl_t *usb_quirk_ioctl_p = &usb_quirk_ioctl_w; -devclass_t usb_devclass_ptr = NULL; +devclass_t usb_devclass_ptr; static usb_error_t usb_temp_setup_by_index_w(struct usb_device *udev, uint16_t index) Modified: head/sys/dev/usb/usb_msctest.c ============================================================================== --- head/sys/dev/usb/usb_msctest.c Tue Feb 5 12:37:50 2013 (r246359) +++ head/sys/dev/usb/usb_msctest.c Tue Feb 5 13:30:07 2013 (r246360) @@ -848,7 +848,7 @@ usb_msc_eject(struct usb_device *udev, u sizeof(scsi_tct_eject), USB_MS_HZ); break; default: - printf("usb_msc_eject: unknown eject method (%d)\n", method); + DPRINTF("Unknown eject method (%d)\n", method); break; } DPRINTF("Eject CD command status: %s\n", usbd_errstr(err)); Modified: head/sys/dev/usb/usb_process.c ============================================================================== --- head/sys/dev/usb/usb_process.c Tue Feb 5 12:37:50 2013 (r246359) +++ head/sys/dev/usb/usb_process.c Tue Feb 5 13:30:07 2013 (r246360) @@ -24,8 +24,6 @@ * SUCH DAMAGE. */ -#define USB_DEBUG_VAR usb_proc_debug - #ifdef USB_GLOBAL_INCLUDE_FILE #include USB_GLOBAL_INCLUDE_FILE #else @@ -52,6 +50,8 @@ #include #include #include + +#define USB_DEBUG_VAR usb_proc_debug #include #include Modified: head/sys/dev/usb/usb_request.c ============================================================================== --- head/sys/dev/usb/usb_request.c Tue Feb 5 12:37:50 2013 (r246359) +++ head/sys/dev/usb/usb_request.c Tue Feb 5 13:30:07 2013 (r246360) @@ -800,8 +800,6 @@ usbd_req_reset_port(struct usb_device *u /* check for errors */ if (err) goto done; -#ifdef USB_DEBUG -#endif n = 0; while (1) { /* wait for the device to recover from reset */ From owner-svn-src-head@FreeBSD.ORG Tue Feb 5 14:29:37 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id E83774BC; Tue, 5 Feb 2013 14:29:37 +0000 (UTC) (envelope-from zeising@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id C2E33CEC; Tue, 5 Feb 2013 14:29:37 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r15ETbW9008264; Tue, 5 Feb 2013 14:29:37 GMT (envelope-from zeising@svn.freebsd.org) Received: (from zeising@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r15ETb7n008263; Tue, 5 Feb 2013 14:29:37 GMT (envelope-from zeising@svn.freebsd.org) Message-Id: <201302051429.r15ETb7n008263@svn.freebsd.org> From: Niclas Zeising Date: Tue, 5 Feb 2013 14:29:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r246361 - head/sbin/devd X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 05 Feb 2013 14:29:38 -0000 Author: zeising (doc,ports committer) Date: Tue Feb 5 14:29:37 2013 New Revision: 246361 URL: http://svnweb.freebsd.org/changeset/base/246361 Log: Bump .Dd for the change in r246121. Approved by: joel (mentor) Modified: head/sbin/devd/devd.8 Modified: head/sbin/devd/devd.8 ============================================================================== --- head/sbin/devd/devd.8 Tue Feb 5 13:30:07 2013 (r246360) +++ head/sbin/devd/devd.8 Tue Feb 5 14:29:37 2013 (r246361) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd November 24, 2005 +.Dd January 30, 2013 .Dt DEVD 8 .Os .Sh NAME From owner-svn-src-head@FreeBSD.ORG Tue Feb 5 14:39:38 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 4F3A0754; Tue, 5 Feb 2013 14:39:38 +0000 (UTC) (envelope-from des@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 32B4FD74; Tue, 5 Feb 2013 14:39:38 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r15Edc8e011204; Tue, 5 Feb 2013 14:39:38 GMT (envelope-from des@svn.freebsd.org) Received: (from des@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r15EdcE7011203; Tue, 5 Feb 2013 14:39:38 GMT (envelope-from des@svn.freebsd.org) Message-Id: <201302051439.r15EdcE7011203@svn.freebsd.org> From: Dag-Erling Smørgrav Date: Tue, 5 Feb 2013 14:39:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r246362 - head/games/fortune/datfiles X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 05 Feb 2013 14:39:38 -0000 Author: des Date: Tue Feb 5 14:39:37 2013 New Revision: 246362 URL: http://svnweb.freebsd.org/changeset/base/246362 Log: Remove political propaganda Modified: head/games/fortune/datfiles/fortunes-o.real Modified: head/games/fortune/datfiles/fortunes-o.real ============================================================================== --- head/games/fortune/datfiles/fortunes-o.real Tue Feb 5 14:29:37 2013 (r246361) +++ head/games/fortune/datfiles/fortunes-o.real Tue Feb 5 14:39:37 2013 (r246362) @@ -11437,233 +11437,6 @@ two new uses for sheep. Meat and wool. % Runners do it alone. % -Rush Limbaugh's 35 Undeniable Truths of Life: - -(1) The greatest threat to the human spirit is liberalism. - - -- "The Limbaugh Letter," Copyright 1992, EFM Publishing, Inc. -% -Rush Limbaugh's 35 Undeniable Truths of Life: - -(10) Liberalism poisons the soul. - - -- "The Limbaugh Letter," Copyright 1992, EFM Publishing, Inc. -% -Rush Limbaugh's 35 Undeniable Truths of Life: - -(11) Neither the United States, nor anyone else, "imposes" freedom on - the people of other nations. Freedom is not an imposition. - - -- "The Limbaugh Letter," Copyright 1992, EFM Publishing, Inc. -% -Rush Limbaugh's 35 Undeniable Truths of Life: - -(12) Freedom is God-given. - - -- "The Limbaugh Letter," Copyright 1992, EFM Publishing, Inc. -% -Rush Limbaugh's 35 Undeniable Truths of Life: - -(13) To dictatorships, peace means the absence of opposition. - - -- "The Limbaugh Letter," Copyright 1992, EFM Publishing, Inc. -% -Rush Limbaugh's 35 Undeniable Truths of Life: - -(14) To free people, peace means the absence of threat. - - -- "The Limbaugh Letter," Copyright 1992, EFM Publishing, Inc. -% -Rush Limbaugh's 35 Undeniable Truths of Life: - -(15) The Peace Movement in the United States was, whether by accident or - design, pro-communist. - - -- "The Limbaugh Letter," Copyright 1992, EFM Publishing, Inc. -% -Rush Limbaugh's 35 Undeniable Truths of Life: - -(16) The collective knowledge and wisdom of seasoned citizens is the - most valuable, yet untapped, resource our young people have. - - -- "The Limbaugh Letter," Copyright 1992, EFM Publishing, Inc. -% -Rush Limbaugh's 35 Undeniable Truths of Life: - -(17) The greatest football team in the history of civilization was the - Pittsburgh Steelers of 1975 through 1980. - - -- "The Limbaugh Letter," Copyright 1992, EFM Publishing, Inc. -% -Rush Limbaugh's 35 Undeniable Truths of Life: - -(18) There is no such thing as "war atrocities." War is an atrocity. - - -- "The Limbaugh Letter," Copyright 1992, EFM Publishing, Inc. -% -Rush Limbaugh's 35 Undeniable Truths of Life: - -(19) Regardless of the pain in our memories, nostalgia only reminds us - of the good times in our past. - - -- "The Limbaugh Letter," Copyright 1992, EFM Publishing, Inc. -% -Rush Limbaugh's 35 Undeniable Truths of Life: - -(2) The single greatest threat to the free people of the world is posed - by the heinous idea of centralized government control. - - -- "The Limbaugh Letter," Copyright 1992, EFM Publishing, Inc. -% -Rush Limbaugh's 35 Undeniable Truths of Life: - -(20) There is a God. - - -- "The Limbaugh Letter," Copyright 1992, EFM Publishing, Inc. -% -Rush Limbaugh's 35 Undeniable Truths of Life: - -(21) Abortion is wrong. - - -- "The Limbaugh Letter," Copyright 1992, EFM Publishing, Inc. -% -Rush Limbaugh's 35 Undeniable Truths of Life: - -(22) Morality is not defined by individual choice. - - -- "The Limbaugh Letter," Copyright 1992, EFM Publishing, Inc. -% -Rush Limbaugh's 35 Undeniable Truths of Life: - -(23) Evolution cannot explain creation. - - -- "The Limbaugh Letter," Copyright 1992, EFM Publishing, Inc. -% -Rush Limbaugh's 35 Undeniable Truths of Life: - -(24) Feminism was established so that unattractive women could have - easier access to the mainstream of society. - - -- "The Limbaugh Letter," Copyright 1992, EFM Publishing, Inc. -% -Rush Limbaugh's 35 Undeniable Truths of Life: - -(25) Love is the only human emotion which cannot be controlled. You - either do or you don't. You can't fake it. (Except women, and - thank God they can.) - - -- "The Limbaugh Letter," Copyright 1992, EFM Publishing, Inc. -% -Rush Limbaugh's 35 Undeniable Truths of Life: - -(26) The only difference between Mikhail Gorbachev and previous Soviet - leaders is that he is alive. - - -- "The Limbaugh Letter," Copyright 1992, EFM Publishing, Inc. -% -Rush Limbaugh's 35 Undeniable Truths of Life: - -(27) Soviet leaders were actually left-wing dictators. - - -- "The Limbaugh Letter," Copyright 1992, EFM Publishing, Inc. -% -Rush Limbaugh's 35 Undeniable Truths of Life: - -(28) Abraham Lincoln saved this nation. - - -- "The Limbaugh Letter," Copyright 1992, EFM Publishing, Inc. -% -Rush Limbaugh's 35 Undeniable Truths of Life: - -(29) The Los Angeles Raiders will never be the team they were when they - called Oakland home. - - -- "The Limbaugh Letter," Copyright 1992, EFM Publishing, Inc. -% -Rush Limbaugh's 35 Undeniable Truths of Life: - -(3) Peace does not mean the elimination of nuclear weapons. - - -- "The Limbaugh Letter," Copyright 1992, EFM Publishing, Inc. -% -Rush Limbaugh's 35 Undeniable Truths of Life: - -(30) The United States will again go to war. - - -- "The Limbaugh Letter," Copyright 1992, EFM Publishing, Inc. -% -Rush Limbaugh's 35 Undeniable Truths of Life: - -(31) To more and more American intellectuals, a victorious United States - is a sinful United States. - - -- "The Limbaugh Letter," Copyright 1992, EFM Publishing, Inc. -% -Rush Limbaugh's 35 Undeniable Truths of Life: - -(32) The fact that American intellectuals rue a victorious United States - is frightening and ominous. - - -- "The Limbaugh Letter," Copyright 1992, EFM Publishing, Inc. -% -Rush Limbaugh's 35 Undeniable Truths of Life: - -(33) There will always be poor people. - - -- "The Limbaugh Letter," Copyright 1992, EFM Publishing, Inc. -% -Rush Limbaugh's 35 Undeniable Truths of Life: - -(34) The fact that there will always be poor people is not the fault of - the rich. - - -- "The Limbaugh Letter," Copyright 1992, EFM Publishing, Inc. -% -Rush Limbaugh's 35 Undeniable Truths of Life: - -(35) Rather than feel guilty as some do, you should thank God for making - you an American. - - -- "The Limbaugh Letter," Copyright 1992, EFM Publishing, Inc. -% -Rush Limbaugh's 35 Undeniable Truths of Life: - -(4) Peace does not mean the absence of war. - - -- "The Limbaugh Letter," Copyright 1992, EFM Publishing, Inc. -% -Rush Limbaugh's 35 Undeniable Truths of Life: - -(5) War is not obsolete. - - -- "The Limbaugh Letter," Copyright 1992, EFM Publishing, Inc. -% -Rush Limbaugh's 35 Undeniable Truths of Life: - -(6) Ours is a world governed by the aggressive use of force. - - -- "The Limbaugh Letter," Copyright 1992, EFM Publishing, Inc. -% -Rush Limbaugh's 35 Undeniable Truths of Life: - -(7) There is only one way to eliminate nuclear weapons. Use them. - - -- "The Limbaugh Letter," Copyright 1992, EFM Publishing, Inc. -% -Rush Limbaugh's 35 Undeniable Truths of Life: - -(8) Peace cannot be achieved merely by developing an "understanding" - among peoples. - - -- "The Limbaugh Letter," Copyright 1992, EFM Publishing, Inc. -% -Rush Limbaugh's 35 Undeniable Truths of Life: - -(9) Americans opposing America is not always sacred nor courageous ... - it is sometimes dangerous. - - -- "The Limbaugh Letter," Copyright 1992, EFM Publishing, Inc. -% Said a dainty young whore named Ms. Meggs, "The men like to spread my two legs, Then slip in between, From owner-svn-src-head@FreeBSD.ORG Tue Feb 5 14:44:28 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 19716941; Tue, 5 Feb 2013 14:44:28 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id E5B0FDC3; Tue, 5 Feb 2013 14:44:27 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r15EiRH2013520; Tue, 5 Feb 2013 14:44:27 GMT (envelope-from hselasky@svn.freebsd.org) Received: (from hselasky@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r15EiPKh013499; Tue, 5 Feb 2013 14:44:25 GMT (envelope-from hselasky@svn.freebsd.org) Message-Id: <201302051444.r15EiPKh013499@svn.freebsd.org> From: Hans Petter Selasky Date: Tue, 5 Feb 2013 14:44:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r246363 - in head/sys: boot/usb dev/usb dev/usb/controller X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 05 Feb 2013 14:44:28 -0000 Author: hselasky Date: Tue Feb 5 14:44:25 2013 New Revision: 246363 URL: http://svnweb.freebsd.org/changeset/base/246363 Log: Add defines to more easily allow a single threaded version of the FreeBSD USB stack. This is useful for non-kernel purposes, like the loader. Modified: head/sys/boot/usb/bsd_global.h head/sys/boot/usb/bsd_kernel.c head/sys/boot/usb/bsd_kernel.h head/sys/dev/usb/controller/usb_controller.c head/sys/dev/usb/controller/xhci.c head/sys/dev/usb/controller/xhci.h head/sys/dev/usb/usb_bus.h head/sys/dev/usb/usb_device.c head/sys/dev/usb/usb_freebsd.h head/sys/dev/usb/usb_freebsd_loader.h head/sys/dev/usb/usb_hub.c head/sys/dev/usb/usb_transfer.c Modified: head/sys/boot/usb/bsd_global.h ============================================================================== --- head/sys/boot/usb/bsd_global.h Tue Feb 5 14:39:37 2013 (r246362) +++ head/sys/boot/usb/bsd_global.h Tue Feb 5 14:44:25 2013 (r246363) @@ -60,4 +60,6 @@ #include #include +extern struct usb_process usb_process[USB_PROC_MAX]; + #endif /* _BSD_GLOBAL_H_ */ Modified: head/sys/boot/usb/bsd_kernel.c ============================================================================== --- head/sys/boot/usb/bsd_kernel.c Tue Feb 5 14:39:37 2013 (r246362) +++ head/sys/boot/usb/bsd_kernel.c Tue Feb 5 14:44:25 2013 (r246363) @@ -26,7 +26,8 @@ #include -static struct usb_process usb_process[USB_PROC_MAX]; +struct usb_process usb_process[USB_PROC_MAX]; + static device_t usb_pci_root; /*------------------------------------------------------------------------* @@ -977,41 +978,6 @@ repeat: return (worked); } -int -usb_proc_create(struct usb_process *up, struct mtx *p_mtx, - const char *pmesg, uint8_t prio) -{ -#define USB_PROC_OFFSET(a,b) \ - ((int)(((long)&((struct usb_bus *)0)->a) - \ - ((long)&((struct usb_bus *)0)->b))) - - /* figure out which process we are creating */ - switch ((int)((long)up - (long)p_mtx)) { - case USB_PROC_OFFSET(giant_callback_proc, bus_mtx): - up->up_ptr = (void *)(usb_process + 2); - break; - case USB_PROC_OFFSET(non_giant_callback_proc, bus_mtx): - up->up_ptr = (void *)(usb_process + 2); - break; - case USB_PROC_OFFSET(explore_proc, bus_mtx): - up->up_ptr = (void *)(usb_process + 0); - break; - case USB_PROC_OFFSET(control_xfer_proc, bus_mtx): - up->up_ptr = (void *)(usb_process + 1); - break; - default: - up->up_ptr = (void *)(usb_process + 1); - break; - } - return (0); /* success */ -} - -void -usb_proc_free(struct usb_process *up) -{ - /* NOP */ -} - void * usb_proc_msignal(struct usb_process *up, void *_pm0, void *_pm1) { @@ -1021,10 +987,6 @@ usb_proc_msignal(struct usb_process *up, usb_size_t d; uint8_t t; - /* find the correct parent */ - while (up->up_ptr != NULL) - up = (struct usb_process *)up->up_ptr; - t = 0; if (pm0->pm_qentry.tqe_prev) { @@ -1104,10 +1066,6 @@ usb_proc_mwait(struct usb_process *up, v struct usb_proc_msg *pm0 = _pm0; struct usb_proc_msg *pm1 = _pm1; - /* find the correct parent */ - while (up->up_ptr != NULL) - up = (struct usb_process *)up->up_ptr; - /* Just remove the messages from the queue. */ if (pm0->pm_qentry.tqe_prev) { TAILQ_REMOVE(&up->up_qhead, pm0, pm_qentry); Modified: head/sys/boot/usb/bsd_kernel.h ============================================================================== --- head/sys/boot/usb/bsd_kernel.h Tue Feb 5 14:39:37 2013 (r246362) +++ head/sys/boot/usb/bsd_kernel.h Tue Feb 5 14:44:25 2013 (r246363) @@ -40,6 +40,10 @@ #define M_USB 0 #define M_USBDEV 0 #define USB_PROC_MAX 3 +#define USB_BUS_GIANT_PROC(bus) (usb_process + 2) +#define USB_BUS_NON_GIANT_PROC(bus) (usb_process + 2) +#define USB_BUS_EXPLORE_PROC(bus) (usb_process + 0) +#define USB_BUS_CONTROL_XFER_PROC(bus) (usb_process + 1) #define SYSCTL_DECL(...) #define SYSCTL_NODE(name,...) struct { } name __used #define SYSCTL_INT(...) Modified: head/sys/dev/usb/controller/usb_controller.c ============================================================================== --- head/sys/dev/usb/controller/usb_controller.c Tue Feb 5 14:39:37 2013 (r246362) +++ head/sys/dev/usb/controller/usb_controller.c Tue Feb 5 14:44:25 2013 (r246363) @@ -214,27 +214,29 @@ usb_detach(device_t dev) USB_BUS_LOCK(bus); /* Queue detach job */ - usb_proc_msignal(&bus->explore_proc, + usb_proc_msignal(USB_BUS_EXPLORE_PROC(bus), &bus->detach_msg[0], &bus->detach_msg[1]); /* Wait for detach to complete */ - usb_proc_mwait(&bus->explore_proc, + usb_proc_mwait(USB_BUS_EXPLORE_PROC(bus), &bus->detach_msg[0], &bus->detach_msg[1]); USB_BUS_UNLOCK(bus); +#if USB_HAVE_PER_BUS_PROCESS /* Get rid of USB callback processes */ - usb_proc_free(&bus->giant_callback_proc); - usb_proc_free(&bus->non_giant_callback_proc); + usb_proc_free(USB_BUS_GIANT_PROC(bus)); + usb_proc_free(USB_BUS_NON_GIANT_PROC(bus)); /* Get rid of USB explore process */ - usb_proc_free(&bus->explore_proc); + usb_proc_free(USB_BUS_EXPLORE_PROC(bus)); /* Get rid of control transfer process */ - usb_proc_free(&bus->control_xfer_proc); + usb_proc_free(USB_BUS_CONTROL_XFER_PROC(bus)); +#endif #if USB_HAVE_PF usbpf_detach(bus); @@ -258,11 +260,11 @@ usb_suspend(device_t dev) } USB_BUS_LOCK(bus); - usb_proc_msignal(&bus->explore_proc, + usb_proc_msignal(USB_BUS_EXPLORE_PROC(bus), &bus->suspend_msg[0], &bus->suspend_msg[1]); if (usb_no_suspend_wait == 0) { /* wait for suspend callback to be executed */ - usb_proc_mwait(&bus->explore_proc, + usb_proc_mwait(USB_BUS_EXPLORE_PROC(bus), &bus->suspend_msg[0], &bus->suspend_msg[1]); } USB_BUS_UNLOCK(bus); @@ -286,7 +288,7 @@ usb_resume(device_t dev) } USB_BUS_LOCK(bus); - usb_proc_msignal(&bus->explore_proc, + usb_proc_msignal(USB_BUS_EXPLORE_PROC(bus), &bus->resume_msg[0], &bus->resume_msg[1]); USB_BUS_UNLOCK(bus); @@ -311,11 +313,11 @@ usb_shutdown(device_t dev) device_printf(bus->bdev, "Controller shutdown\n"); USB_BUS_LOCK(bus); - usb_proc_msignal(&bus->explore_proc, + usb_proc_msignal(USB_BUS_EXPLORE_PROC(bus), &bus->shutdown_msg[0], &bus->shutdown_msg[1]); if (usb_no_shutdown_wait == 0) { /* wait for shutdown callback to be executed */ - usb_proc_mwait(&bus->explore_proc, + usb_proc_mwait(USB_BUS_EXPLORE_PROC(bus), &bus->shutdown_msg[0], &bus->shutdown_msg[1]); } USB_BUS_UNLOCK(bus); @@ -358,9 +360,9 @@ usb_bus_explore(struct usb_proc_msg *pm) * The following three lines of code are only here to * recover from DDB: */ - usb_proc_rewakeup(&bus->control_xfer_proc); - usb_proc_rewakeup(&bus->giant_callback_proc); - usb_proc_rewakeup(&bus->non_giant_callback_proc); + usb_proc_rewakeup(USB_BUS_CONTROL_XFER_PROC(bus)); + usb_proc_rewakeup(USB_BUS_GIANT_PROC(bus)); + usb_proc_rewakeup(USB_BUS_NON_GIANT_PROC(bus)); #endif USB_BUS_UNLOCK(bus); @@ -585,7 +587,7 @@ usb_power_wdog(void *arg) * The following line of code is only here to recover from * DDB: */ - usb_proc_rewakeup(&bus->explore_proc); /* recover from DDB */ + usb_proc_rewakeup(USB_BUS_EXPLORE_PROC(bus)); /* recover from DDB */ #endif #if USB_HAVE_POWERD @@ -708,8 +710,6 @@ usb_bus_attach(struct usb_proc_msg *pm) static void usb_attach_sub(device_t dev, struct usb_bus *bus) { - const char *pname = device_get_nameunit(dev); - mtx_lock(&Giant); if (usb_devclass_ptr == NULL) usb_devclass_ptr = devclass_find("usbus"); @@ -749,28 +749,31 @@ usb_attach_sub(device_t dev, struct usb_ bus->shutdown_msg[1].hdr.pm_callback = &usb_bus_shutdown; bus->shutdown_msg[1].bus = bus; +#if USB_HAVE_PER_BUS_PROCESS /* Create USB explore and callback processes */ - if (usb_proc_create(&bus->giant_callback_proc, - &bus->bus_mtx, pname, USB_PRI_MED)) { + if (usb_proc_create(USB_BUS_GIANT_PROC(bus), + &bus->bus_mtx, device_get_nameunit(dev), USB_PRI_MED)) { device_printf(dev, "WARNING: Creation of USB Giant " "callback process failed.\n"); - } else if (usb_proc_create(&bus->non_giant_callback_proc, - &bus->bus_mtx, pname, USB_PRI_HIGH)) { + } else if (usb_proc_create(USB_BUS_NON_GIANT_PROC(bus), + &bus->bus_mtx, device_get_nameunit(dev), USB_PRI_HIGH)) { device_printf(dev, "WARNING: Creation of USB non-Giant " "callback process failed.\n"); - } else if (usb_proc_create(&bus->explore_proc, - &bus->bus_mtx, pname, USB_PRI_MED)) { + } else if (usb_proc_create(USB_BUS_EXPLORE_PROC(bus), + &bus->bus_mtx, device_get_nameunit(dev), USB_PRI_MED)) { device_printf(dev, "WARNING: Creation of USB explore " "process failed.\n"); - } else if (usb_proc_create(&bus->control_xfer_proc, - &bus->bus_mtx, pname, USB_PRI_MED)) { + } else if (usb_proc_create(USB_BUS_CONTROL_XFER_PROC(bus), + &bus->bus_mtx, device_get_nameunit(dev), USB_PRI_MED)) { device_printf(dev, "WARNING: Creation of USB control transfer " "process failed.\n"); - } else { + } else +#endif + { /* Get final attach going */ USB_BUS_LOCK(bus); - usb_proc_msignal(&bus->explore_proc, + usb_proc_msignal(USB_BUS_EXPLORE_PROC(bus), &bus->attach_msg[0], &bus->attach_msg[1]); USB_BUS_UNLOCK(bus); @@ -778,7 +781,6 @@ usb_attach_sub(device_t dev, struct usb_ usb_needs_explore(bus, 1); } } - SYSUNINIT(usb_bus_unload, SI_SUB_KLD, SI_ORDER_ANY, usb_bus_unload, NULL); /*------------------------------------------------------------------------* Modified: head/sys/dev/usb/controller/xhci.c ============================================================================== --- head/sys/dev/usb/controller/xhci.c Tue Feb 5 14:39:37 2013 (r246362) +++ head/sys/dev/usb/controller/xhci.c Tue Feb 5 14:44:25 2013 (r246363) @@ -547,19 +547,12 @@ xhci_init(struct xhci_softc *sc, device_ sc->sc_config_msg[1].hdr.pm_callback = &xhci_configure_msg; sc->sc_config_msg[1].bus = &sc->sc_bus; - if (usb_proc_create(&sc->sc_config_proc, - &sc->sc_bus.bus_mtx, device_get_nameunit(self), USB_PRI_MED)) { - printf("WARNING: Creation of XHCI configure " - "callback process failed.\n"); - } return (0); } void xhci_uninit(struct xhci_softc *sc) { - usb_proc_free(&sc->sc_config_proc); - usb_bus_mem_free_all(&sc->sc_bus, &xhci_iterate_hw_softc); cv_destroy(&sc->sc_cmd_cv); @@ -2684,7 +2677,7 @@ xhci_transfer_insert(struct usb_xfer *xf DPRINTFN(8, "Not running\n"); /* start configuration */ - (void)usb_proc_msignal(&sc->sc_config_proc, + (void)usb_proc_msignal(USB_BUS_CONTROL_XFER_PROC(&sc->sc_bus), &sc->sc_config_msg[0], &sc->sc_config_msg[1]); return (0); } @@ -3652,7 +3645,7 @@ xhci_start_dma_delay(struct usb_xfer *xf /* put transfer on interrupt queue (again) */ usbd_transfer_enqueue(&sc->sc_bus.intr_q, xfer); - (void)usb_proc_msignal(&sc->sc_config_proc, + (void)usb_proc_msignal(USB_BUS_CONTROL_XFER_PROC(&sc->sc_bus), &sc->sc_config_msg[0], &sc->sc_config_msg[1]); } Modified: head/sys/dev/usb/controller/xhci.h ============================================================================== --- head/sys/dev/usb/controller/xhci.h Tue Feb 5 14:39:37 2013 (r246362) +++ head/sys/dev/usb/controller/xhci.h Tue Feb 5 14:44:25 2013 (r246363) @@ -434,8 +434,7 @@ struct xhci_softc { struct xhci_hw_softc sc_hw; /* base device */ struct usb_bus sc_bus; - /* configure process */ - struct usb_process sc_config_proc; + /* configure message */ struct usb_bus_msg sc_config_msg[2]; union xhci_hub_desc sc_hub_desc; Modified: head/sys/dev/usb/usb_bus.h ============================================================================== --- head/sys/dev/usb/usb_bus.h Tue Feb 5 14:39:37 2013 (r246362) +++ head/sys/dev/usb/usb_bus.h Tue Feb 5 14:44:25 2013 (r246363) @@ -54,6 +54,13 @@ struct usb_bus { #if USB_HAVE_ROOT_MOUNT_HOLD struct root_hold_token *bus_roothold; #endif + +#if USB_HAVE_PER_BUS_PROCESS +#define USB_BUS_GIANT_PROC(bus) (&(bus)->giant_callback_proc) +#define USB_BUS_NON_GIANT_PROC(bus) (&(bus)->non_giant_callback_proc) +#define USB_BUS_EXPLORE_PROC(bus) (&(bus)->explore_proc) +#define USB_BUS_CONTROL_XFER_PROC(bus) (&(bus)->control_xfer_proc) + /* * There are two callback processes. One for Giant locked * callbacks. One for non-Giant locked callbacks. This should @@ -67,6 +74,7 @@ struct usb_bus { /* Control request process */ struct usb_process control_xfer_proc; +#endif struct usb_bus_msg explore_msg[2]; struct usb_bus_msg detach_msg[2]; Modified: head/sys/dev/usb/usb_device.c ============================================================================== --- head/sys/dev/usb/usb_device.c Tue Feb 5 14:39:37 2013 (r246362) +++ head/sys/dev/usb/usb_device.c Tue Feb 5 14:44:25 2013 (r246363) @@ -2128,7 +2128,7 @@ usb_free_device(struct usb_device *udev, * anywhere: */ USB_BUS_LOCK(udev->bus); - usb_proc_mwait(&udev->bus->non_giant_callback_proc, + usb_proc_mwait(USB_BUS_NON_GIANT_PROC(udev->bus), &udev->cs_msg[0], &udev->cs_msg[1]); USB_BUS_UNLOCK(udev->bus); Modified: head/sys/dev/usb/usb_freebsd.h ============================================================================== --- head/sys/dev/usb/usb_freebsd.h Tue Feb 5 14:39:37 2013 (r246362) +++ head/sys/dev/usb/usb_freebsd.h Tue Feb 5 14:44:25 2013 (r246363) @@ -44,6 +44,7 @@ #define USB_HAVE_PF 1 #define USB_HAVE_ROOT_MOUNT_HOLD 1 #define USB_HAVE_ID_SECTION 1 +#define USB_HAVE_PER_BUS_PROCESS 1 #define USB_TD_GET_PROC(td) (td)->td_proc #define USB_PROC_GET_GID(td) (td)->p_pgid Modified: head/sys/dev/usb/usb_freebsd_loader.h ============================================================================== --- head/sys/dev/usb/usb_freebsd_loader.h Tue Feb 5 14:39:37 2013 (r246362) +++ head/sys/dev/usb/usb_freebsd_loader.h Tue Feb 5 14:44:25 2013 (r246363) @@ -44,6 +44,7 @@ #define USB_HAVE_PF 0 #define USB_HAVE_ROOT_MOUNT_HOLD 0 #define USB_HAVE_ID_SECTION 0 +#define USB_HAVE_PER_BUS_PROCESS 0 #define USB_TD_GET_PROC(td) (td)->td_proc #define USB_PROC_GET_GID(td) (td)->p_pgid Modified: head/sys/dev/usb/usb_hub.c ============================================================================== --- head/sys/dev/usb/usb_hub.c Tue Feb 5 14:39:37 2013 (r246362) +++ head/sys/dev/usb/usb_hub.c Tue Feb 5 14:44:25 2013 (r246363) @@ -1917,7 +1917,7 @@ usb_needs_explore(struct usb_bus *bus, u if (do_probe) { bus->do_probe = 1; } - if (usb_proc_msignal(&bus->explore_proc, + if (usb_proc_msignal(USB_BUS_EXPLORE_PROC(bus), &bus->explore_msg[0], &bus->explore_msg[1])) { /* ignore */ } Modified: head/sys/dev/usb/usb_transfer.c ============================================================================== --- head/sys/dev/usb/usb_transfer.c Tue Feb 5 14:39:37 2013 (r246362) +++ head/sys/dev/usb/usb_transfer.c Tue Feb 5 14:44:25 2013 (r246363) @@ -965,14 +965,14 @@ usbd_transfer_setup(struct usb_device *u * deadlock! */ if (setup_start == usb_control_ep_cfg) - info->done_p = - &udev->bus->control_xfer_proc; + info->done_p = + USB_BUS_CONTROL_XFER_PROC(udev->bus); else if (xfer_mtx == &Giant) - info->done_p = - &udev->bus->giant_callback_proc; + info->done_p = + USB_BUS_GIANT_PROC(udev->bus); else - info->done_p = - &udev->bus->non_giant_callback_proc; + info->done_p = + USB_BUS_NON_GIANT_PROC(udev->bus); } /* reset sizes */ @@ -2614,7 +2614,7 @@ usbd_pipe_start(struct usb_xfer_queue *p } else if (udev->ctrl_xfer[1]) { info = udev->ctrl_xfer[1]->xroot; usb_proc_msignal( - &info->bus->non_giant_callback_proc, + USB_BUS_NON_GIANT_PROC(info->bus), &udev->cs_msg[0], &udev->cs_msg[1]); } else { /* should not happen */ @@ -3216,10 +3216,10 @@ usbd_transfer_poll(struct usb_xfer **ppx } /* Make sure cv_signal() and cv_broadcast() is not called */ - udev->bus->control_xfer_proc.up_msleep = 0; - udev->bus->explore_proc.up_msleep = 0; - udev->bus->giant_callback_proc.up_msleep = 0; - udev->bus->non_giant_callback_proc.up_msleep = 0; + USB_BUS_CONTROL_XFER_PROC(udev->bus)->up_msleep = 0; + USB_BUS_EXPLORE_PROC(udev->bus)->up_msleep = 0; + USB_BUS_GIANT_PROC(udev->bus)->up_msleep = 0; + USB_BUS_NON_GIANT_PROC(udev->bus)->up_msleep = 0; /* poll USB hardware */ (udev->bus->methods->xfer_poll) (udev->bus); From owner-svn-src-head@FreeBSD.ORG Tue Feb 5 15:45:55 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 444C17E; Tue, 5 Feb 2013 15:45:55 +0000 (UTC) (envelope-from lifanov@mail.lifanov.com) Received: from mail.lifanov.com (mail.lifanov.com [206.125.175.12]) by mx1.freebsd.org (Postfix) with ESMTP id 2FDE4214; Tue, 5 Feb 2013 15:45:55 +0000 (UTC) Received: from [10.1.3.40] (cnet520-windstream.mcclatchyinteractive.com [166.108.16.2]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by mail.lifanov.com (Postfix) with ESMTPSA id 1C21519FAB8; Tue, 5 Feb 2013 15:45:53 +0000 (UTC) Message-ID: <51112930.3040403@mail.lifanov.com> Date: Tue, 05 Feb 2013 10:45:52 -0500 From: Nikolai Lifanov User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130109 Thunderbird/17.0.2 MIME-Version: 1.0 To: =?ISO-8859-1?Q?Dag-Erling_Sm=F8rgrav?= Subject: Re: svn commit: r246362 - head/games/fortune/datfiles References: <201302051439.r15EdcE7011203@svn.freebsd.org> In-Reply-To: <201302051439.r15EdcE7011203@svn.freebsd.org> X-Enigmail-Version: 1.5 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 05 Feb 2013 15:45:55 -0000 On 02/05/2013 09:39 AM, Dag-Erling Smørgrav wrote: > Author: des Date: Tue Feb 5 14:39:37 2013 New Revision: 246362 > URL: http://svnweb.freebsd.org/changeset/base/246362 > > Log: Remove political propaganda > > Modified: head/games/fortune/datfiles/fortunes-o.real > > Modified: head/games/fortune/datfiles/fortunes-o.real > ============================================================================== > > --- head/games/fortune/datfiles/fortunes-o.real Tue Feb 5 14:29:37 2013 (r246361) > +++ head/games/fortune/datfiles/fortunes-o.real Tue Feb 5 14:39:37 > 2013 (r246362) @@ -11437,233 +11437,6 @@ two new uses for sheep. > Meat and wool. % Runners do it alone. % -Rush Limbaugh's 35 > Undeniable Truths of Life: - -(1) The greatest threat to the human > spirit is liberalism. - - -- "The Limbaugh Letter," Copyright 1992, > EFM Publishing, Inc. -% -Rush Limbaugh's 35 Undeniable Truths of > Life: - -(10) Liberalism poisons the soul. - - -- "The Limbaugh > Letter," Copyright 1992, EFM Publishing, Inc. -% -Rush Limbaugh's > 35 Undeniable Truths of Life: - -(11) Neither the United States, > nor anyone else, "imposes" freedom on - the people of other > nations. Freedom is not an imposition. - - -- "The Limbaugh > Letter," Copyright 1992, EFM Publishing, Inc. -% -Rush Limbaugh's > 35 Undeniable Truths of Life: - -(12) Freedom is God-given. - - -- > "The Limbaugh Letter," Copyright 1992, EFM Publishing, Inc. -% > -Rush Limbaugh's 35 Undeniable Truths of Life: - -(13) To > dictatorships, peace means the absence of opposition. - - -- "The > Limbaugh Letter," Copyright 1992, EFM Publishing, Inc. -% -Rush > Limbaugh's 35 Undeniable Truths of Life: - -(14) To free people, > peace means the absence of threat. - - -- "The Limbaugh Letter," > Copyright 1992, EFM Publishing, Inc. -% -Rush Limbaugh's 35 > Undeniable Truths of Life: - -(15) The Peace Movement in the United > States was, whether by accident or - design, pro-communist. - - > -- "The Limbaugh Letter," Copyright 1992, EFM Publishing, Inc. -% > -Rush Limbaugh's 35 Undeniable Truths of Life: - -(16) The > collective knowledge and wisdom of seasoned citizens is the - > most valuable, yet untapped, resource our young people have. - - -- > "The Limbaugh Letter," Copyright 1992, EFM Publishing, Inc. -% > -Rush Limbaugh's 35 Undeniable Truths of Life: - -(17) The greatest > football team in the history of civilization was the - > Pittsburgh Steelers of 1975 through 1980. - - -- "The Limbaugh > Letter," Copyright 1992, EFM Publishing, Inc. -% -Rush Limbaugh's > 35 Undeniable Truths of Life: - -(18) There is no such thing as > "war atrocities." War is an atrocity. - - -- "The Limbaugh Letter," > Copyright 1992, EFM Publishing, Inc. -% -Rush Limbaugh's 35 > Undeniable Truths of Life: - -(19) Regardless of the pain in our > memories, nostalgia only reminds us - of the good times in our > past. - - -- "The Limbaugh Letter," Copyright 1992, EFM Publishing, > Inc. -% -Rush Limbaugh's 35 Undeniable Truths of Life: - -(2) The > single greatest threat to the free people of the world is posed - > by the heinous idea of centralized government control. - - -- "The > Limbaugh Letter," Copyright 1992, EFM Publishing, Inc. -% -Rush > Limbaugh's 35 Undeniable Truths of Life: - -(20) There is a God. - > - -- "The Limbaugh Letter," Copyright 1992, EFM Publishing, Inc. > -% -Rush Limbaugh's 35 Undeniable Truths of Life: - -(21) Abortion > is wrong. - - -- "The Limbaugh Letter," Copyright 1992, EFM > Publishing, Inc. -% -Rush Limbaugh's 35 Undeniable Truths of Life: > - -(22) Morality is not defined by individual choice. - - -- "The > Limbaugh Letter," Copyright 1992, EFM Publishing, Inc. -% -Rush > Limbaugh's 35 Undeniable Truths of Life: - -(23) Evolution cannot > explain creation. - - -- "The Limbaugh Letter," Copyright 1992, EFM > Publishing, Inc. -% -Rush Limbaugh's 35 Undeniable Truths of Life: > - -(24) Feminism was established so that unattractive women could > have - easier access to the mainstream of society. - - -- "The > Limbaugh Letter," Copyright 1992, EFM Publishing, Inc. -% -Rush > Limbaugh's 35 Undeniable Truths of Life: - -(25) Love is the only > human emotion which cannot be controlled. You - either do or > you don't. You can't fake it. (Except women, and - thank God > they can.) - - -- "The Limbaugh Letter," Copyright 1992, EFM > Publishing, Inc. -% -Rush Limbaugh's 35 Undeniable Truths of Life: > - -(26) The only difference between Mikhail Gorbachev and previous > Soviet - leaders is that he is alive. - - -- "The Limbaugh > Letter," Copyright 1992, EFM Publishing, Inc. -% -Rush Limbaugh's > 35 Undeniable Truths of Life: - -(27) Soviet leaders were actually > left-wing dictators. - - -- "The Limbaugh Letter," Copyright 1992, > EFM Publishing, Inc. -% -Rush Limbaugh's 35 Undeniable Truths of > Life: - -(28) Abraham Lincoln saved this nation. - - -- "The > Limbaugh Letter," Copyright 1992, EFM Publishing, Inc. -% -Rush > Limbaugh's 35 Undeniable Truths of Life: - -(29) The Los Angeles > Raiders will never be the team they were when they - called > Oakland home. - - -- "The Limbaugh Letter," Copyright 1992, EFM > Publishing, Inc. -% -Rush Limbaugh's 35 Undeniable Truths of Life: > - -(3) Peace does not mean the elimination of nuclear weapons. - - > -- "The Limbaugh Letter," Copyright 1992, EFM Publishing, Inc. -% > -Rush Limbaugh's 35 Undeniable Truths of Life: - -(30) The United > States will again go to war. - - -- "The Limbaugh Letter," > Copyright 1992, EFM Publishing, Inc. -% -Rush Limbaugh's 35 > Undeniable Truths of Life: - -(31) To more and more American > intellectuals, a victorious United States - is a sinful United > States. - - -- "The Limbaugh Letter," Copyright 1992, EFM > Publishing, Inc. -% -Rush Limbaugh's 35 Undeniable Truths of Life: > - -(32) The fact that American intellectuals rue a victorious > United States - is frightening and ominous. - - -- "The > Limbaugh Letter," Copyright 1992, EFM Publishing, Inc. -% -Rush > Limbaugh's 35 Undeniable Truths of Life: - -(33) There will always > be poor people. - - -- "The Limbaugh Letter," Copyright 1992, EFM > Publishing, Inc. -% -Rush Limbaugh's 35 Undeniable Truths of Life: > - -(34) The fact that there will always be poor people is not the > fault of - the rich. - - -- "The Limbaugh Letter," Copyright > 1992, EFM Publishing, Inc. -% -Rush Limbaugh's 35 Undeniable Truths > of Life: - -(35) Rather than feel guilty as some do, you should > thank God for making - you an American. - - -- "The Limbaugh > Letter," Copyright 1992, EFM Publishing, Inc. -% -Rush Limbaugh's > 35 Undeniable Truths of Life: - -(4) Peace does not mean the > absence of war. - - -- "The Limbaugh Letter," Copyright 1992, EFM > Publishing, Inc. -% -Rush Limbaugh's 35 Undeniable Truths of Life: > - -(5) War is not obsolete. - - -- "The Limbaugh Letter," Copyright > 1992, EFM Publishing, Inc. -% -Rush Limbaugh's 35 Undeniable Truths > of Life: - -(6) Ours is a world governed by the aggressive use of > force. - - -- "The Limbaugh Letter," Copyright 1992, EFM > Publishing, Inc. -% -Rush Limbaugh's 35 Undeniable Truths of Life: > - -(7) There is only one way to eliminate nuclear weapons. Use > them. - - -- "The Limbaugh Letter," Copyright 1992, EFM Publishing, > Inc. -% -Rush Limbaugh's 35 Undeniable Truths of Life: - -(8) Peace > cannot be achieved merely by developing an "understanding" - > among peoples. - - -- "The Limbaugh Letter," Copyright 1992, EFM > Publishing, Inc. -% -Rush Limbaugh's 35 Undeniable Truths of Life: > - -(9) Americans opposing America is not always sacred nor > courageous ... - it is sometimes dangerous. - - -- "The Limbaugh > Letter," Copyright 1992, EFM Publishing, Inc. -% Said a dainty > young whore named Ms. Meggs, "The men like to spread my two legs, > Then slip in between, > _______________________________________________ > svn-src-head@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/svn-src-head To > unsubscribe, send any mail to > "svn-src-head-unsubscribe@freebsd.org" > Remove political propaganda -- Why? This is the "offensive" file. It's supposed to have potentially offensive political, sexist, religious, racist, and miscellaneously off content. The man page is clear about this and comes with a warning. - Nikolai Lifanov From owner-svn-src-head@FreeBSD.ORG Tue Feb 5 16:45:44 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 997DC8F8; Tue, 5 Feb 2013 16:45:44 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from bigwig.baldwin.cx (bigknife-pt.tunnel.tserv9.chi1.ipv6.he.net [IPv6:2001:470:1f10:75::2]) by mx1.freebsd.org (Postfix) with ESMTP id 6F7F2836; Tue, 5 Feb 2013 16:45:44 +0000 (UTC) Received: from pakbsde14.localnet (unknown [38.105.238.108]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id 5F123B911; Tue, 5 Feb 2013 11:45:43 -0500 (EST) From: John Baldwin To: Sergey Kandaurov Subject: Re: svn commit: r245848 - head/sys/boot/i386/libi386 Date: Tue, 5 Feb 2013 11:11:44 -0500 User-Agent: KMail/1.13.5 (FreeBSD/8.2-CBSD-20110714-p22; KDE/4.5.5; amd64; ; ) References: <201301231834.r0NIYLnp006407@svn.freebsd.org> <201302041446.55786.jhb@freebsd.org> In-Reply-To: MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Message-Id: <201302051111.44833.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.7 (bigwig.baldwin.cx); Tue, 05 Feb 2013 11:45:43 -0500 (EST) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 05 Feb 2013 16:45:44 -0000 On Tuesday, February 05, 2013 2:46:15 am Sergey Kandaurov wrote: > Err.. No, I haven't set hw.uart.console. Sorry for being misleading. > The cited snippet from my previous mail was to demonstrate how the > resulting hw.uart.console value depends (or rather not :)) on hints. > All I have (changed) wrt console is: > > /boot/device.hints > #hint.uart.0.flags="0x10" > hint.uart.1.flags="0x10" > > /boot/loader.conf > boot_multicons="YES" > boot_serial="YES" > boot_verbose="YES" > console="comconsole,vidconsole" > > This setup worked for ages. To isolate this problem I took /boot/loader > from my older current machine (also with COM2) to replace it here, > and it started to work again. Right, so with this setup, you are using a non-working serial console for the loader on COM1 and then wanting the kernel to use COM2? Why? If you want to do that, set hw.uart.console manually. I think that is a very rare case and that most folks want to use the same console in both the loader and kernel. -- John Baldwin From owner-svn-src-head@FreeBSD.ORG Tue Feb 5 16:45:47 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 2B3938FA; Tue, 5 Feb 2013 16:45:47 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from bigwig.baldwin.cx (bigknife-pt.tunnel.tserv9.chi1.ipv6.he.net [IPv6:2001:470:1f10:75::2]) by mx1.freebsd.org (Postfix) with ESMTP id 019B4837; Tue, 5 Feb 2013 16:45:47 +0000 (UTC) Received: from pakbsde14.localnet (unknown [38.105.238.108]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id 54C38B97C; Tue, 5 Feb 2013 11:45:46 -0500 (EST) From: John Baldwin To: Andriy Gapon Subject: Re: svn commit: r246282 - in head/sys: conf kern Date: Tue, 5 Feb 2013 11:15:02 -0500 User-Agent: KMail/1.13.5 (FreeBSD/8.2-CBSD-20110714-p22; KDE/4.5.5; amd64; ; ) References: <201302030957.r139vd8n027213@svn.freebsd.org> <201302041429.01477.jhb@freebsd.org> <51102076.8030302@FreeBSD.org> In-Reply-To: <51102076.8030302@FreeBSD.org> MIME-Version: 1.0 Content-Type: Text/Plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <201302051115.03275.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.7 (bigwig.baldwin.cx); Tue, 05 Feb 2013 11:45:46 -0500 (EST) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 05 Feb 2013 16:45:47 -0000 On Monday, February 04, 2013 3:56:22 pm Andriy Gapon wrote: > on 04/02/2013 21:29 John Baldwin said the following: > > On Sunday, February 03, 2013 4:57:39 am Andriy Gapon wrote: > >> Author: avg > >> Date: Sun Feb 3 09:57:39 2013 > >> New Revision: 246282 > >> URL: http://svnweb.freebsd.org/changeset/base/246282 > >> > >> Log: > >> allow for large KTR_ENTRIES values by allocating ktr_buf using malloc(9) > >> > >> Only during very early boot, before malloc(9) is functional (SI_SUB_KMEM), > >> the static ktr_buf_init is used. Size of the static buffer is determined > >> by a new kernel option KTR_BOOT_ENTRIES. Its default value is 1024. > >> > >> This commit builds on top of r243046. > > > > Does this lose "early" entries once the SYSINIT runs? It doesn't seem to make > > any effort to copy the existing entries over to the new buffer? > > Yes, this is true and glebius has also noticed that... > I think that a simple bcopy should be fine here? Almost. To handle the case where the boot buffer might have wrapped I think you should copy the entries at the "end" into the head of the KTR buffer first, then the entries from the front to the current index, and then update the index to point at the end (it should effectively be KTR_BOOT_ENTRIES I think). -- John Baldwin From owner-svn-src-head@FreeBSD.ORG Tue Feb 5 16:45:49 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 636838FC; Tue, 5 Feb 2013 16:45:49 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from bigwig.baldwin.cx (bigknife-pt.tunnel.tserv9.chi1.ipv6.he.net [IPv6:2001:470:1f10:75::2]) by mx1.freebsd.org (Postfix) with ESMTP id 40F1E839; Tue, 5 Feb 2013 16:45:49 +0000 (UTC) Received: from pakbsde14.localnet (unknown [38.105.238.108]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id 8CC16B9AC; Tue, 5 Feb 2013 11:45:48 -0500 (EST) From: John Baldwin To: "Dag-Erling SmXXrgrav" Subject: Re: svn commit: r246362 - head/games/fortune/datfiles Date: Tue, 5 Feb 2013 11:45:40 -0500 User-Agent: KMail/1.13.5 (FreeBSD/8.2-CBSD-20110714-p22; KDE/4.5.5; amd64; ; ) References: <201302051439.r15EdcE7011203@svn.freebsd.org> In-Reply-To: <201302051439.r15EdcE7011203@svn.freebsd.org> MIME-Version: 1.0 Message-Id: <201302051145.40104.jhb@freebsd.org> Content-Type: Text/Plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.7 (bigwig.baldwin.cx); Tue, 05 Feb 2013 11:45:48 -0500 (EST) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 05 Feb 2013 16:45:49 -0000 On Tuesday, February 05, 2013 9:39:38 am Dag-Erling SmXXrgrav wrote: > Author: des > Date: Tue Feb 5 14:39:37 2013 > New Revision: 246362 > URL: http://svnweb.freebsd.org/changeset/base/246362 > > Log: > Remove political propaganda > > Modified: > head/games/fortune/datfiles/fortunes-o.real *sigh* I'm sure there are other quotes that people who do not share your political persuasion might find propaganda or offensive, etc. Censorship and freedom of speech is quite a sticky widget, and I think the only truly sane policy is that fortune files are append-only (unless we outright remove them and that seems excessive). And new things should have a very high bar to be added to fortune. Perhaps we should move fortunes-o to ports entirely? -- John Baldwin From owner-svn-src-head@FreeBSD.ORG Tue Feb 5 16:48:00 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id F0A57D63; Tue, 5 Feb 2013 16:48:00 +0000 (UTC) (envelope-from des@des.no) Received: from smtp.des.no (smtp.des.no [194.63.250.102]) by mx1.freebsd.org (Postfix) with ESMTP id ABDD1862; Tue, 5 Feb 2013 16:48:00 +0000 (UTC) Received: from ds4.des.no (smtp.des.no [194.63.250.102]) by smtp-int.des.no (Postfix) with ESMTP id A07946CE4; Tue, 5 Feb 2013 16:47:59 +0000 (UTC) Received: by ds4.des.no (Postfix, from userid 1001) id 28200ADF1; Tue, 5 Feb 2013 17:47:58 +0100 (CET) From: =?utf-8?Q?Dag-Erling_Sm=C3=B8rgrav?= To: Nikolai Lifanov Subject: Re: svn commit: r246362 - head/games/fortune/datfiles References: <201302051439.r15EdcE7011203@svn.freebsd.org> <51112930.3040403@mail.lifanov.com> Date: Tue, 05 Feb 2013 17:47:58 +0100 In-Reply-To: <51112930.3040403@mail.lifanov.com> (Nikolai Lifanov's message of "Tue, 05 Feb 2013 10:45:52 -0500") Message-ID: <86ehgu4sht.fsf@ds4.des.no> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.4 (berkeley-unix) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 05 Feb 2013 16:48:01 -0000 Nikolai Lifanov writes: > Remove political propaganda -- Why? Because FreeBSD does not engage in politics. > This is the "offensive" file. Yes, and it is meant for dirty jokes and the like. These are not dirty jokes. Some of these quotes are harmless, but others verge on hate speech. We already had this discussion when they were added way back when, and the consensus was that we *shouldn't* have them. However, the person who added them was extremely vocal about them (and about what he perceived as political censorship etc.), so as a compromise, we moved them to -o. That person is no longer with the project, so there is no longer a need for such compromise. Besides, what I removed were not isolated quotes, but a complete copy of a copyrighted work, and therefore legally questionable. > It's supposed to have potentially offensive political, sexist, > religious, racist, and miscellaneously off content. If there is racist content in that file, it should be removed. The only people who think racist jokes are OK ("geez, they're just jokes, lighten up") are those who have never been at the receiving end of them and are incapable of empathizing with those who have. There is a word for people like that: they're called "racists". DES --=20 Dag-Erling Sm=C3=B8rgrav - des@des.no From owner-svn-src-head@FreeBSD.ORG Tue Feb 5 16:51:01 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id B9AB06D; Tue, 5 Feb 2013 16:51:01 +0000 (UTC) (envelope-from bjkfbsd@gmail.com) Received: from mail-ie0-x230.google.com (ie-in-x0230.1e100.net [IPv6:2607:f8b0:4001:c03::230]) by mx1.freebsd.org (Postfix) with ESMTP id 4E47C899; Tue, 5 Feb 2013 16:51:01 +0000 (UTC) Received: by mail-ie0-f176.google.com with SMTP id k13so494720iea.21 for ; Tue, 05 Feb 2013 08:51:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:x-received:in-reply-to:references:date:message-id :subject:from:to:cc:content-type; bh=E338upMqPOamVg9wBiGkEcci0mqX8UWMSYJDCinT6OA=; b=lTGjCNy12X5gDxDfch3afA016d3LRr+j95EVrMdngekoyWzi8wP5H9mTKufQBIg9Bo VVl+sKk1BPYZPmGPptF8Ijoze1mVCh5xxxU+rcHj+X4wsw+PidsaVMLUWNXlTRtN0YEd Emrb9ForMFLyQeWvQM+086JeqckuMafSgPyuHLXh2pYGy9xzwVcw1psl0uYWlXrBbM32 EvH21FF6tpVY26u/ANJYgc1O95YQo9Hq8tigePfKHD4oJ1gR0DeHuOfmrN6J48Aqkgdk K3g+0FvXzo0iouvcxdj4tGnzhqQNNoTyqojA4z6qTyyIINQnGRI8j2Klos7FejMzs7yj fglA== MIME-Version: 1.0 X-Received: by 10.50.242.73 with SMTP id wo9mr14302115igc.36.1360083060955; Tue, 05 Feb 2013 08:51:00 -0800 (PST) Received: by 10.42.79.17 with HTTP; Tue, 5 Feb 2013 08:51:00 -0800 (PST) In-Reply-To: <201302051145.40104.jhb@freebsd.org> References: <201302051439.r15EdcE7011203@svn.freebsd.org> <201302051145.40104.jhb@freebsd.org> Date: Tue, 5 Feb 2013 11:51:00 -0500 Message-ID: Subject: Re: svn commit: r246362 - head/games/fortune/datfiles From: Benjamin Kaduk To: John Baldwin Content-Type: text/plain; charset=ISO-8859-1 X-Content-Filtered-By: Mailman/MimeDel 2.1.14 Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Dag-Erling SmXXrgrav X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 05 Feb 2013 16:51:01 -0000 On Tue, Feb 5, 2013 at 11:45 AM, John Baldwin wrote: > On Tuesday, February 05, 2013 9:39:38 am Dag-Erling SmXXrgrav wrote: > > Author: des > > Date: Tue Feb 5 14:39:37 2013 > > New Revision: 246362 > > URL: http://svnweb.freebsd.org/changeset/base/246362 > > > > Log: > > Remove political propaganda > > > > Modified: > > head/games/fortune/datfiles/fortunes-o.real > > *sigh* > > I'm sure there are other quotes that people who do not share your political > persuasion might find propaganda or offensive, etc. Censorship and freedom > of speech is quite a sticky widget, and I think the only truly sane policy > is that fortune files are append-only (unless we outright remove them and > that seems excessive). And new things should have a very high bar to be > added to fortune. Perhaps we should move fortunes-o to ports entirely? > I am more concerned about the insta-MFC than the removal per se. Only security or legal issues are cause to go under 3 days, was my impression. -Ben From owner-svn-src-head@FreeBSD.ORG Tue Feb 5 16:55:25 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 62080261; Tue, 5 Feb 2013 16:55:25 +0000 (UTC) (envelope-from des@des.no) Received: from smtp.des.no (smtp.des.no [194.63.250.102]) by mx1.freebsd.org (Postfix) with ESMTP id 2369F8D1; Tue, 5 Feb 2013 16:55:25 +0000 (UTC) Received: from ds4.des.no (smtp.des.no [194.63.250.102]) by smtp-int.des.no (Postfix) with ESMTP id 6BEEA6CFC; Tue, 5 Feb 2013 16:55:24 +0000 (UTC) Received: by ds4.des.no (Postfix, from userid 1001) id 23459ADF4; Tue, 5 Feb 2013 17:55:24 +0100 (CET) From: =?utf-8?Q?Dag-Erling_Sm=C3=B8rgrav?= To: Benjamin Kaduk Subject: Re: svn commit: r246362 - head/games/fortune/datfiles References: <201302051439.r15EdcE7011203@svn.freebsd.org> <201302051145.40104.jhb@freebsd.org> Date: Tue, 05 Feb 2013 17:55:23 +0100 In-Reply-To: (Benjamin Kaduk's message of "Tue, 5 Feb 2013 11:51:00 -0500") Message-ID: <86a9ri4s5g.fsf@ds4.des.no> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.4 (berkeley-unix) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, John Baldwin X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 05 Feb 2013 16:55:25 -0000 Benjamin Kaduk writes: > I am more concerned about the insta-MFC than the removal per se. > Only security or legal issues are cause to go under 3 days, was my > impression. The text I removed was a full copy of the source document, rather than selected quotes from it, so yes, there is a legal issue as well. However, my primary motivation is that these are not jokes or "words of wisdom" but political statements, and FreeBSD does not engage in politics. DES --=20 Dag-Erling Sm=C3=B8rgrav - des@des.no From owner-svn-src-head@FreeBSD.ORG Tue Feb 5 16:57:44 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 13201438; Tue, 5 Feb 2013 16:57:44 +0000 (UTC) (envelope-from des@des.no) Received: from smtp.des.no (smtp.des.no [194.63.250.102]) by mx1.freebsd.org (Postfix) with ESMTP id CA130900; Tue, 5 Feb 2013 16:57:43 +0000 (UTC) Received: from ds4.des.no (smtp.des.no [194.63.250.102]) by smtp-int.des.no (Postfix) with ESMTP id 29EC06D05; Tue, 5 Feb 2013 16:57:42 +0000 (UTC) Received: by ds4.des.no (Postfix, from userid 1001) id D0027ADF7; Tue, 5 Feb 2013 17:57:41 +0100 (CET) From: =?utf-8?Q?Dag-Erling_Sm=C3=B8rgrav?= To: John Baldwin Subject: Re: svn commit: r246362 - head/games/fortune/datfiles References: <201302051439.r15EdcE7011203@svn.freebsd.org> <201302051145.40104.jhb@freebsd.org> Date: Tue, 05 Feb 2013 17:57:41 +0100 In-Reply-To: <201302051145.40104.jhb@freebsd.org> (John Baldwin's message of "Tue, 5 Feb 2013 11:45:40 -0500") Message-ID: <8662264s1m.fsf@ds4.des.no> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.4 (berkeley-unix) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 05 Feb 2013 16:57:44 -0000 John Baldwin writes: > I'm sure there are other quotes that people who do not share your > political persuasion might find propaganda or offensive, etc. If you think this is about my political persuasion, feel free to point out left-leaning material and I will remove it as well. > And new things should have a very high bar to be added to fortune. The bar, in this specific case, was set at "whatever will shut up the person who committed them" (resulting in a move to -o rather than an outright reversal). DES --=20 Dag-Erling Sm=C3=B8rgrav - des@des.no From owner-svn-src-head@FreeBSD.ORG Tue Feb 5 17:01:43 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 7597A780; Tue, 5 Feb 2013 17:01:43 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from bigwig.baldwin.cx (bigknife-pt.tunnel.tserv9.chi1.ipv6.he.net [IPv6:2001:470:1f10:75::2]) by mx1.freebsd.org (Postfix) with ESMTP id 53186947; Tue, 5 Feb 2013 17:01:43 +0000 (UTC) Received: from pakbsde14.localnet (unknown [38.105.238.108]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id BB081B9AC; Tue, 5 Feb 2013 12:01:42 -0500 (EST) From: John Baldwin To: Benjamin Kaduk Subject: Re: svn commit: r246362 - head/games/fortune/datfiles Date: Tue, 5 Feb 2013 11:58:54 -0500 User-Agent: KMail/1.13.5 (FreeBSD/8.2-CBSD-20110714-p22; KDE/4.5.5; amd64; ; ) References: <201302051439.r15EdcE7011203@svn.freebsd.org> <201302051145.40104.jhb@freebsd.org> In-Reply-To: MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-15" Content-Transfer-Encoding: 7bit Message-Id: <201302051158.55117.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.7 (bigwig.baldwin.cx); Tue, 05 Feb 2013 12:01:42 -0500 (EST) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Dag-Erling SmXXrgrav X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 05 Feb 2013 17:01:43 -0000 On Tuesday, February 05, 2013 11:51:00 am Benjamin Kaduk wrote: > On Tue, Feb 5, 2013 at 11:45 AM, John Baldwin wrote: > > > On Tuesday, February 05, 2013 9:39:38 am Dag-Erling SmXXrgrav wrote: > > > Author: des > > > Date: Tue Feb 5 14:39:37 2013 > > > New Revision: 246362 > > > URL: http://svnweb.freebsd.org/changeset/base/246362 > > > > > > Log: > > > Remove political propaganda > > > > > > Modified: > > > head/games/fortune/datfiles/fortunes-o.real > > > > *sigh* > > > > I'm sure there are other quotes that people who do not share your political > > persuasion might find propaganda or offensive, etc. Censorship and freedom > > of speech is quite a sticky widget, and I think the only truly sane policy > > is that fortune files are append-only (unless we outright remove them and > > that seems excessive). And new things should have a very high bar to be > > added to fortune. Perhaps we should move fortunes-o to ports entirely? > > > > I am more concerned about the insta-MFC than the removal per se. > Only security or legal issues are cause to go under 3 days, was my > impression. Yes, the insta-MFC is also not appropriate, esp. for something that you know is going to raise eyebrows when it is committed. Having to debate this sort of thing in public on mailing lists is also distinctly unhelpful and very distracting from productive work. Also, I'd like to preemptively ask developers to refrain from any further commits to the fortunes datfiles for the time being as the last thing we need is a commit war over this sort of thing. -- John Baldwin From owner-svn-src-head@FreeBSD.ORG Tue Feb 5 17:14:12 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id B9895C91; Tue, 5 Feb 2013 17:14:12 +0000 (UTC) (envelope-from utisoft@gmail.com) Received: from mail-ie0-x22f.google.com (mail-ie0-x22f.google.com [IPv6:2607:f8b0:4001:c03::22f]) by mx1.freebsd.org (Postfix) with ESMTP id 676DE9F2; Tue, 5 Feb 2013 17:14:12 +0000 (UTC) Received: by mail-ie0-f175.google.com with SMTP id c12so539653ieb.34 for ; Tue, 05 Feb 2013 09:14:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:x-received:in-reply-to:references:date:message-id :subject:from:to:cc:content-type; bh=jfd3iPHkxta5RlwCOHNANIY1KdUu54M7dkl8ptfxI4g=; b=LlDh0wNudhSI8nC8zZ/r3gksvB2scLB1YRlTJabmOf5AdS8HDn6u409DPfwclggbXH RHJbYJ81tgDpemX+ViFqIaLSV4DDRSCNSp0Py3Pq3YDsVj9vX67YqDe8UiVG620xuoGS LBPZiqn3WP0QU/aIM65RcVhvTBGRkrUKrIv4Z6V/AYyUJSeF+NDDkEkiUyZ9h1C7B0Sg Fy+1HFr0z8beSkUKF7MBJ0DPk1fKdmqNtDxF6OIy/YmngSIerTZTczNh2etu1bC/t02e 4fEXkxP/HDzTE7qZsxK19FwABjbTznsD0cYHvoVnfuhQCcip+CL1Wt8EyH1eXw0Kb6PS SZYA== MIME-Version: 1.0 X-Received: by 10.50.178.10 with SMTP id cu10mr14827029igc.75.1360084451456; Tue, 05 Feb 2013 09:14:11 -0800 (PST) Received: by 10.64.16.73 with HTTP; Tue, 5 Feb 2013 09:14:11 -0800 (PST) Received: by 10.64.16.73 with HTTP; Tue, 5 Feb 2013 09:14:11 -0800 (PST) In-Reply-To: <201302051158.55117.jhb@freebsd.org> References: <201302051439.r15EdcE7011203@svn.freebsd.org> <201302051145.40104.jhb@freebsd.org> <201302051158.55117.jhb@freebsd.org> Date: Tue, 5 Feb 2013 17:14:11 +0000 Message-ID: Subject: Re: svn commit: r246362 - head/games/fortune/datfiles From: Chris Rees To: John Baldwin Content-Type: text/plain; charset=ISO-8859-1 X-Content-Filtered-By: Mailman/MimeDel 2.1.14 Cc: svn-src-head@freebsd.org, Benjamin Kaduk , svn-src-all@freebsd.org, src-committers@freebsd.org, Dag-Erling SmXXrgrav X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 05 Feb 2013 17:14:12 -0000 On 5 Feb 2013 17:01, "John Baldwin" wrote: > > On Tuesday, February 05, 2013 11:51:00 am Benjamin Kaduk wrote: > > On Tue, Feb 5, 2013 at 11:45 AM, John Baldwin wrote: > > > > > On Tuesday, February 05, 2013 9:39:38 am Dag-Erling SmXXrgrav wrote: > > > > Author: des > > > > Date: Tue Feb 5 14:39:37 2013 > > > > New Revision: 246362 > > > > URL: http://svnweb.freebsd.org/changeset/base/246362 > > > > > > > > Log: > > > > Remove political propaganda > > > > > > > > Modified: > > > > head/games/fortune/datfiles/fortunes-o.real > > > > > > *sigh* > > > > > > I'm sure there are other quotes that people who do not share your political > > > persuasion might find propaganda or offensive, etc. Censorship and freedom > > > of speech is quite a sticky widget, and I think the only truly sane policy > > > is that fortune files are append-only (unless we outright remove them and > > > that seems excessive). And new things should have a very high bar to be > > > added to fortune. Perhaps we should move fortunes-o to ports entirely? > > > > > > > I am more concerned about the insta-MFC than the removal per se. > > Only security or legal issues are cause to go under 3 days, was my > > impression. > > Yes, the insta-MFC is also not appropriate, esp. for something that you know > is going to raise eyebrows when it is committed. Having to debate this sort > of thing in public on mailing lists is also distinctly unhelpful and very > distracting from productive work. Also, I'd like to preemptively ask > developers to refrain from any further commits to the fortunes datfiles for > the time being as the last thing we need is a commit war over this sort of > thing. Moving the -o file to ports as you suggested is probably the best idea. Or simply allowing people to fetch their own.... I don't see why we should have trash installed by default on a professional operating system; we have higher standards in other areas. Chris From owner-svn-src-head@FreeBSD.ORG Tue Feb 5 18:40:21 2013 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 7159781E; Tue, 5 Feb 2013 18:40:21 +0000 (UTC) (envelope-from jmg@h2.funkthat.com) Received: from h2.funkthat.com (gate2.funkthat.com [208.87.223.18]) by mx1.freebsd.org (Postfix) with ESMTP id 4DF09F3A; Tue, 5 Feb 2013 18:40:21 +0000 (UTC) Received: from h2.funkthat.com (localhost [127.0.0.1]) by h2.funkthat.com (8.14.3/8.14.3) with ESMTP id r15IFjEc055730 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Tue, 5 Feb 2013 10:15:45 -0800 (PST) (envelope-from jmg@h2.funkthat.com) Received: (from jmg@localhost) by h2.funkthat.com (8.14.3/8.14.3/Submit) id r15IFiGA055729; Tue, 5 Feb 2013 10:15:44 -0800 (PST) (envelope-from jmg) Date: Tue, 5 Feb 2013 10:15:44 -0800 From: John-Mark Gurney To: Dag-Erling =?iso-8859-1?Q?Sm=F8rgrav?= Subject: Re: svn commit: r246362 - head/games/fortune/datfiles Message-ID: <20130205181544.GV1410@funkthat.com> References: <201302051439.r15EdcE7011203@svn.freebsd.org> <51112930.3040403@mail.lifanov.com> <86ehgu4sht.fsf@ds4.des.no> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <86ehgu4sht.fsf@ds4.des.no> User-Agent: Mutt/1.4.2.3i X-Operating-System: FreeBSD 7.2-RELEASE i386 X-PGP-Fingerprint: 54BA 873B 6515 3F10 9E88 9322 9CB1 8F74 6D3F A396 X-Files: The truth is out there X-URL: http://resnet.uoregon.edu/~gurney_j/ X-Resume: http://resnet.uoregon.edu/~gurney_j/resume.html X-to-the-FBI-CIA-and-NSA: HI! HOW YA DOIN? can i haz chizburger? X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.2.2 (h2.funkthat.com [127.0.0.1]); Tue, 05 Feb 2013 10:15:45 -0800 (PST) Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 05 Feb 2013 18:40:21 -0000 Dag-Erling Smrgrav wrote this message on Tue, Feb 05, 2013 at 17:47 +0100: > > It's supposed to have potentially offensive political, sexist, > > religious, racist, and miscellaneously off content. > > If there is racist content in that file, it should be removed. The only > people who think racist jokes are OK ("geez, they're just jokes, lighten > up") are those who have never been at the receiving end of them and are > incapable of empathizing with those who have. There is a word for > people like that: they're called "racists". Clearly you don't run fortune -o very often, or you'd be removing a lot more from the file... -- John-Mark Gurney Voice: +1 415 225 5579 "All that I will do, has been done, All that I have, has not." From owner-svn-src-head@FreeBSD.ORG Tue Feb 5 18:55:12 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 3BA16C75; Tue, 5 Feb 2013 18:55:12 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 2476DFDC; Tue, 5 Feb 2013 18:55:11 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r15ItBHb091485; Tue, 5 Feb 2013 18:55:11 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r15ItAI4091481; Tue, 5 Feb 2013 18:55:10 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201302051855.r15ItAI4091481@svn.freebsd.org> From: John Baldwin Date: Tue, 5 Feb 2013 18:55:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r246367 - in head: etc/mtree include usr.sbin/bhyve usr.sbin/pciconf X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 05 Feb 2013 18:55:12 -0000 Author: jhb Date: Tue Feb 5 18:55:09 2013 New Revision: 246367 URL: http://svnweb.freebsd.org/changeset/base/246367 Log: Install and as userland headers in /usr/include. MFC after: 2 weeks Modified: head/etc/mtree/BSD.include.dist head/include/Makefile head/usr.sbin/bhyve/Makefile head/usr.sbin/pciconf/Makefile Modified: head/etc/mtree/BSD.include.dist ============================================================================== --- head/etc/mtree/BSD.include.dist Tue Feb 5 14:55:33 2013 (r246366) +++ head/etc/mtree/BSD.include.dist Tue Feb 5 18:55:09 2013 (r246367) @@ -100,6 +100,8 @@ dev acpica .. + agp + .. an .. bktr @@ -136,6 +138,8 @@ .. pbio .. + pci + .. powermac_nvram .. ppbus Modified: head/include/Makefile ============================================================================== --- head/include/Makefile Tue Feb 5 14:55:33 2013 (r246366) +++ head/include/Makefile Tue Feb 5 18:55:09 2013 (r246367) @@ -42,9 +42,10 @@ LDIRS= bsm cam geom net net80211 netatal sys vm LSUBDIRS= cam/ata cam/scsi \ - dev/acpica dev/an dev/bktr dev/ciss dev/filemon dev/firewire dev/hwpmc \ + dev/acpica dev/agp dev/an dev/bktr dev/ciss dev/filemon dev/firewire \ + dev/hwpmc \ dev/ic dev/iicbus ${_dev_ieee488} dev/io dev/lmc dev/mfi dev/nvme \ - dev/ofw dev/pbio ${_dev_powermac_nvram} dev/ppbus dev/smbus \ + dev/ofw dev/pbio dev/pci ${_dev_powermac_nvram} dev/ppbus dev/smbus \ dev/speaker dev/usb dev/utopia dev/vkbd dev/wi \ fs/devfs fs/fdescfs fs/msdosfs fs/nandfs fs/nfs fs/nullfs \ fs/procfs fs/udf fs/unionfs \ @@ -154,7 +155,7 @@ copies: done .endif .endfor -.for i in ${LDIRS} ${LSUBDIRS:Ndev/acpica:Ndev/bktr:Ndev/nand} ${LSUBSUBDIRS} +.for i in ${LDIRS} ${LSUBDIRS:Ndev/agp:Ndev/acpica:Ndev/bktr:Ndev/nand:Ndev/pci} ${LSUBSUBDIRS} cd ${.CURDIR}/../sys; \ ${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 $i/*.h \ ${DESTDIR}${INCLUDEDIR}/$i @@ -162,6 +163,9 @@ copies: cd ${.CURDIR}/../sys/dev/acpica; \ ${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 acpiio.h \ ${DESTDIR}${INCLUDEDIR}/dev/acpica + cd ${.CURDIR}/../sys/dev/agp; \ + ${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 agpreg.h \ + ${DESTDIR}${INCLUDEDIR}/dev/agp cd ${.CURDIR}/../sys/dev/bktr; \ ${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 ioctl_*.h \ ${DESTDIR}${INCLUDEDIR}/dev/bktr @@ -172,6 +176,9 @@ copies: ${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 nand_dev.h \ ${DESTDIR}${INCLUDEDIR}/dev/nand .endif + cd ${.CURDIR}/../sys/dev/pci; \ + ${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 pcireg.h \ + ${DESTDIR}${INCLUDEDIR}/dev/pci cd ${.CURDIR}/../sys/contrib/altq/altq; \ ${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \ ${DESTDIR}${INCLUDEDIR}/altq @@ -225,7 +232,7 @@ symlinks: ln -fs ../../../sys/$i/$$h ${DESTDIR}${INCLUDEDIR}/$i; \ done .endfor -.for i in ${LSUBDIRS:Ndev/acpica:Ndev/bktr:Ndev/nand} +.for i in ${LSUBDIRS:Ndev/agp:Ndev/acpica:Ndev/bktr:Ndev/nand:Ndev/pci} cd ${.CURDIR}/../sys/$i; \ for h in *.h; do \ ln -fs ../../../../sys/$i/$$h ${DESTDIR}${INCLUDEDIR}/$i; \ @@ -236,6 +243,11 @@ symlinks: ln -fs ../../../../sys/dev/acpica/$$h \ ${DESTDIR}${INCLUDEDIR}/dev/acpica; \ done + cd ${.CURDIR}/../sys/dev/agp; \ + for h in agpreg.h; do \ + ln -fs ../../../../sys/dev/agp/$$h \ + ${DESTDIR}${INCLUDEDIR}/dev/agp; \ + done cd ${.CURDIR}/../sys/dev/bktr; \ for h in ioctl_*.h; do \ ln -fs ../../../../sys/dev/bktr/$$h \ @@ -248,6 +260,11 @@ symlinks: ${DESTDIR}${INCLUDEDIR}/dev/nand; \ done .endif + cd ${.CURDIR}/../sys/dev/pci; \ + for h in pcireg.h; do \ + ln -fs ../../../../sys/dev/pci/$$h \ + ${DESTDIR}${INCLUDEDIR}/dev/pci; \ + done .for i in ${LSUBSUBDIRS} cd ${.CURDIR}/../sys/$i; \ for h in *.h; do \ Modified: head/usr.sbin/bhyve/Makefile ============================================================================== --- head/usr.sbin/bhyve/Makefile Tue Feb 5 14:55:33 2013 (r246366) +++ head/usr.sbin/bhyve/Makefile Tue Feb 5 18:55:09 2013 (r246367) @@ -22,6 +22,4 @@ LDADD= -lvmmapi -lmd -lpthread WARNS?= 2 -CFLAGS+= -I${.CURDIR}/../../sys - .include Modified: head/usr.sbin/pciconf/Makefile ============================================================================== --- head/usr.sbin/pciconf/Makefile Tue Feb 5 14:55:33 2013 (r246366) +++ head/usr.sbin/pciconf/Makefile Tue Feb 5 18:55:09 2013 (r246367) @@ -5,8 +5,6 @@ PROG= pciconf SRCS= pciconf.c cap.c err.c MAN= pciconf.8 -CFLAGS+= -I${.CURDIR}/../../sys - WARNS?= 3 .include From owner-svn-src-head@FreeBSD.ORG Tue Feb 5 20:03:59 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 0202AB23; Tue, 5 Feb 2013 20:03:59 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id CB33E378; Tue, 5 Feb 2013 20:03:58 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r15K3w9C012728; Tue, 5 Feb 2013 20:03:58 GMT (envelope-from andrew@svn.freebsd.org) Received: (from andrew@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r15K3wQu012726; Tue, 5 Feb 2013 20:03:58 GMT (envelope-from andrew@svn.freebsd.org) Message-Id: <201302052003.r15K3wQu012726@svn.freebsd.org> From: Andrew Turner Date: Tue, 5 Feb 2013 20:03:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r246369 - in head: lib/libstand sys/boot/arm/uboot X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 05 Feb 2013 20:03:59 -0000 Author: andrew Date: Tue Feb 5 20:03:58 2013 New Revision: 246369 URL: http://svnweb.freebsd.org/changeset/base/246369 Log: * Add the integer div & mod functions and ARM EABI support functions to libstand. * Stop linking the ARM U-Boot loader against libgcc now libstand has the required symbols. Modified: head/lib/libstand/Makefile head/sys/boot/arm/uboot/Makefile Modified: head/lib/libstand/Makefile ============================================================================== --- head/lib/libstand/Makefile Tue Feb 5 19:10:50 2013 (r246368) +++ head/lib/libstand/Makefile Tue Feb 5 20:03:58 2013 (r246369) @@ -61,7 +61,20 @@ SRCS+= bcmp.c bcopy.c bzero.c ffs.c memc .endif .if ${MACHINE_CPUARCH} == "arm" .PATH: ${.CURDIR}/../libc/arm/gen + +.if ${MK_ARM_EABI} == "no" SRCS+= divsi3.S +.else +# Compiler support functions +.PATH: ${.CURDIR}/../../contrib/compiler-rt/lib/ +SRCS+= divmoddi4.c divmodsi4.c divdi3.c divsi3.c moddi3.c modsi3.c +SRCS+= udivmoddi4.c udivmodsi4.c udivdi3.c udivsi3.c umoddi3.c umodsi3.c + +.PATH: ${.CURDIR}/../../contrib/compiler-rt/lib/arm/ +SRCS+= aeabi_idivmod.S aeabi_ldivmod.S aeabi_uidivmod.S aeabi_uldivmod.S +SRCS+= aeabi_memcmp.S aeabi_memcpy.S aeabi_memmove.S aeabi_memset.S +.endif + .endif .if ${MACHINE_CPUARCH} == "ia64" .PATH: ${.CURDIR}/../libc/ia64/string Modified: head/sys/boot/arm/uboot/Makefile ============================================================================== --- head/sys/boot/arm/uboot/Makefile Tue Feb 5 19:10:50 2013 (r246368) +++ head/sys/boot/arm/uboot/Makefile Tue Feb 5 20:03:58 2013 (r246369) @@ -112,8 +112,8 @@ CFLAGS+= -I${.CURDIR}/../../../../lib/li # clang doesn't understand %D as a specifier to printf NO_WERROR.clang= -DPADD= ${LIBFICL} ${LIBUBOOT} ${LIBFDT} ${LIBSTAND} ${LIBGCC} -LDADD= ${LIBFICL} ${LIBUBOOT} ${LIBFDT} -lstand -lgcc +DPADD= ${LIBFICL} ${LIBUBOOT} ${LIBFDT} ${LIBSTAND} +LDADD= ${LIBFICL} ${LIBUBOOT} ${LIBFDT} -lstand vers.c: ${.CURDIR}/../../common/newvers.sh ${.CURDIR}/version sh ${.CURDIR}/../../common/newvers.sh ${.CURDIR}/version ${NEWVERSWHAT} From owner-svn-src-head@FreeBSD.ORG Tue Feb 5 20:08:34 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 52A08CC8; Tue, 5 Feb 2013 20:08:34 +0000 (UTC) (envelope-from pluknet@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 45228395; Tue, 5 Feb 2013 20:08:34 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r15K8YYM013602; Tue, 5 Feb 2013 20:08:34 GMT (envelope-from pluknet@svn.freebsd.org) Received: (from pluknet@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r15K8YtG013601; Tue, 5 Feb 2013 20:08:34 GMT (envelope-from pluknet@svn.freebsd.org) Message-Id: <201302052008.r15K8YtG013601@svn.freebsd.org> From: Sergey Kandaurov Date: Tue, 5 Feb 2013 20:08:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r246370 - head/sys/kern X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 05 Feb 2013 20:08:34 -0000 Author: pluknet Date: Tue Feb 5 20:08:33 2013 New Revision: 246370 URL: http://svnweb.freebsd.org/changeset/base/246370 Log: Remove reference to the rlist code from comments, and fix a typo visible in the resulted change. Reviewed by: kib MFC after: 1 week Modified: head/sys/kern/subr_blist.c Modified: head/sys/kern/subr_blist.c ============================================================================== --- head/sys/kern/subr_blist.c Tue Feb 5 20:03:58 2013 (r246369) +++ head/sys/kern/subr_blist.c Tue Feb 5 20:08:33 2013 (r246370) @@ -52,14 +52,10 @@ * radix tree should be able to operate well no matter how much * fragmentation there is and no matter how large a bitmap is used. * - * Unlike the rlist code, the blist code wires all necessary memory at - * creation time. Neither allocations nor frees require interaction with - * the memory subsystem. In contrast, the rlist code may allocate memory - * on an rlist_free() call. The non-blocking features of the blist code - * are used to great advantage in the swap code (vm/nswap_pager.c). The - * rlist code uses a little less overall memory than the blist code (but - * due to swap interleaving not all that much less), but the blist code - * scales much, much better. + * The blist code wires all necessary memory at creation time. Neither + * allocations nor frees require interaction with the memory subsystem. + * The non-blocking features of the blist code are used in the swap code + * (vm/swap_pager.c). * * LAYOUT: The radix tree is layed out recursively using a * linear array. Each meta node is immediately followed (layed out From owner-svn-src-head@FreeBSD.ORG Tue Feb 5 20:26:30 2013 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 638C56C; Tue, 5 Feb 2013 20:26:30 +0000 (UTC) (envelope-from des@des.no) Received: from smtp.des.no (smtp.des.no [194.63.250.102]) by mx1.freebsd.org (Postfix) with ESMTP id 269A4695; Tue, 5 Feb 2013 20:26:29 +0000 (UTC) Received: from ds4.des.no (smtp.des.no [194.63.250.102]) by smtp-int.des.no (Postfix) with ESMTP id 569976FBF; Tue, 5 Feb 2013 20:26:28 +0000 (UTC) Received: by ds4.des.no (Postfix, from userid 1001) id 218F3AE10; Tue, 5 Feb 2013 21:26:26 +0100 (CET) From: =?utf-8?Q?Dag-Erling_Sm=C3=B8rgrav?= To: John-Mark Gurney Subject: Re: svn commit: r246362 - head/games/fortune/datfiles References: <201302051439.r15EdcE7011203@svn.freebsd.org> <51112930.3040403@mail.lifanov.com> <86ehgu4sht.fsf@ds4.des.no> <20130205181544.GV1410@funkthat.com> Date: Tue, 05 Feb 2013 21:26:25 +0100 In-Reply-To: <20130205181544.GV1410@funkthat.com> (John-Mark Gurney's message of "Tue, 5 Feb 2013 10:15:44 -0800") Message-ID: <86zjzi33ta.fsf@ds4.des.no> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.4 (berkeley-unix) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 05 Feb 2013 20:26:30 -0000 John-Mark Gurney writes: > Clearly you don't run fortune -o very often, or you'd be removing a lot > more from the file... Actually, I spent about fifteen minutes this afternoon running fortune -o repeatedly and didn't come across much, except one joke which could be considered antisemitic. There was nothing that came anywhere close to Limbaugh's "the purpose of feminism is to give ugly women a place in society". If you think that's just a tasteless joke (disregarding for a moment the fact that he actually means it), try replacing "feminism" and "ugly women" with categories you fit in and epithets that might apply to you, and you'll understand why it is not acceptable. DES --=20 Dag-Erling Sm=C3=B8rgrav - des@des.no From owner-svn-src-head@FreeBSD.ORG Tue Feb 5 20:55:56 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 48050894; Tue, 5 Feb 2013 20:55:56 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from cell.glebius.int.ru (glebius.int.ru [81.19.69.10]) by mx1.freebsd.org (Postfix) with ESMTP id AC6057F8; Tue, 5 Feb 2013 20:55:55 +0000 (UTC) Received: from cell.glebius.int.ru (localhost [127.0.0.1]) by cell.glebius.int.ru (8.14.6/8.14.6) with ESMTP id r15Ktm84029653; Wed, 6 Feb 2013 00:55:48 +0400 (MSK) (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by cell.glebius.int.ru (8.14.6/8.14.6/Submit) id r15Ktlex029652; Wed, 6 Feb 2013 00:55:47 +0400 (MSK) (envelope-from glebius@FreeBSD.org) X-Authentication-Warning: cell.glebius.int.ru: glebius set sender to glebius@FreeBSD.org using -f Date: Wed, 6 Feb 2013 00:55:47 +0400 From: Gleb Smirnoff To: John Baldwin Subject: Re: svn commit: r246362 - head/games/fortune/datfiles Message-ID: <20130205205547.GI26896@FreeBSD.org> References: <201302051439.r15EdcE7011203@svn.freebsd.org> <201302051145.40104.jhb@freebsd.org> <201302051158.55117.jhb@freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=koi8-r Content-Disposition: inline In-Reply-To: <201302051158.55117.jhb@freebsd.org> User-Agent: Mutt/1.5.21 (2010-09-15) Cc: Benjamin Kaduk , svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Dag-Erling SmXXrgrav X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 05 Feb 2013 20:55:56 -0000 On Tue, Feb 05, 2013 at 11:58:54AM -0500, John Baldwin wrote: J> > > On Tuesday, February 05, 2013 9:39:38 am Dag-Erling SmXXrgrav wrote: J> > > > Author: des J> > > > Date: Tue Feb 5 14:39:37 2013 J> > > > New Revision: 246362 J> > > > URL: http://svnweb.freebsd.org/changeset/base/246362 J> > > > J> > > > Log: J> > > > Remove political propaganda J> > > > J> > > > Modified: J> > > > head/games/fortune/datfiles/fortunes-o.real J> > > J> > > *sigh* J> > > J> > > I'm sure there are other quotes that people who do not share your political J> > > persuasion might find propaganda or offensive, etc. Censorship and freedom J> > > of speech is quite a sticky widget, and I think the only truly sane policy J> > > is that fortune files are append-only (unless we outright remove them and J> > > that seems excessive). And new things should have a very high bar to be J> > > added to fortune. Perhaps we should move fortunes-o to ports entirely? J> > > J> > J> > I am more concerned about the insta-MFC than the removal per se. J> > Only security or legal issues are cause to go under 3 days, was my J> > impression. J> J> Yes, the insta-MFC is also not appropriate, esp. for something that you know J> is going to raise eyebrows when it is committed. Having to debate this sort J> of thing in public on mailing lists is also distinctly unhelpful and very J> distracting from productive work. Also, I'd like to preemptively ask J> developers to refrain from any further commits to the fortunes datfiles for J> the time being as the last thing we need is a commit war over this sort of J> thing. What about just moving the entire games subdirectory to ports repo? -- Totus tuus, Glebius. From owner-svn-src-head@FreeBSD.ORG Tue Feb 5 21:17:45 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 1D75AC34; Tue, 5 Feb 2013 21:17:45 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from bigwig.baldwin.cx (bigknife-pt.tunnel.tserv9.chi1.ipv6.he.net [IPv6:2001:470:1f10:75::2]) by mx1.freebsd.org (Postfix) with ESMTP id CD11E8AF; Tue, 5 Feb 2013 21:17:44 +0000 (UTC) Received: from pakbsde14.localnet (unknown [38.105.238.108]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id 44915B91E; Tue, 5 Feb 2013 16:17:44 -0500 (EST) From: John Baldwin To: Gleb Smirnoff Subject: Re: svn commit: r246362 - head/games/fortune/datfiles Date: Tue, 5 Feb 2013 16:17:25 -0500 User-Agent: KMail/1.13.5 (FreeBSD/8.2-CBSD-20110714-p22; KDE/4.5.5; amd64; ; ) References: <201302051439.r15EdcE7011203@svn.freebsd.org> <201302051158.55117.jhb@freebsd.org> <20130205205547.GI26896@FreeBSD.org> In-Reply-To: <20130205205547.GI26896@FreeBSD.org> MIME-Version: 1.0 Content-Type: Text/Plain; charset="koi8-r" Content-Transfer-Encoding: 7bit Message-Id: <201302051617.25454.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.7 (bigwig.baldwin.cx); Tue, 05 Feb 2013 16:17:44 -0500 (EST) Cc: Benjamin Kaduk , svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Dag-Erling SmXXrgrav X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 05 Feb 2013 21:17:45 -0000 On Tuesday, February 05, 2013 3:55:47 pm Gleb Smirnoff wrote: > On Tue, Feb 05, 2013 at 11:58:54AM -0500, John Baldwin wrote: > J> > > On Tuesday, February 05, 2013 9:39:38 am Dag-Erling SmXXrgrav wrote: > J> > > > Author: des > J> > > > Date: Tue Feb 5 14:39:37 2013 > J> > > > New Revision: 246362 > J> > > > URL: http://svnweb.freebsd.org/changeset/base/246362 > J> > > > > J> > > > Log: > J> > > > Remove political propaganda > J> > > > > J> > > > Modified: > J> > > > head/games/fortune/datfiles/fortunes-o.real > J> > > > J> > > *sigh* > J> > > > J> > > I'm sure there are other quotes that people who do not share your political > J> > > persuasion might find propaganda or offensive, etc. Censorship and freedom > J> > > of speech is quite a sticky widget, and I think the only truly sane policy > J> > > is that fortune files are append-only (unless we outright remove them and > J> > > that seems excessive). And new things should have a very high bar to be > J> > > added to fortune. Perhaps we should move fortunes-o to ports entirely? > J> > > > J> > > J> > I am more concerned about the insta-MFC than the removal per se. > J> > Only security or legal issues are cause to go under 3 days, was my > J> > impression. > J> > J> Yes, the insta-MFC is also not appropriate, esp. for something that you know > J> is going to raise eyebrows when it is committed. Having to debate this sort > J> of thing in public on mailing lists is also distinctly unhelpful and very > J> distracting from productive work. Also, I'd like to preemptively ask > J> developers to refrain from any further commits to the fortunes datfiles for > J> the time being as the last thing we need is a commit war over this sort of > J> thing. > > What about just moving the entire games subdirectory to ports repo? We've already moved most of it many years ago. -- John Baldwin From owner-svn-src-head@FreeBSD.ORG Tue Feb 5 22:54:10 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 8D4004E1; Tue, 5 Feb 2013 22:54:10 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 75949DB2; Tue, 5 Feb 2013 22:54:10 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r15MsAgP070334; Tue, 5 Feb 2013 22:54:10 GMT (envelope-from jilles@svn.freebsd.org) Received: (from jilles@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r15MsACE070333; Tue, 5 Feb 2013 22:54:10 GMT (envelope-from jilles@svn.freebsd.org) Message-Id: <201302052254.r15MsACE070333@svn.freebsd.org> From: Jilles Tjoelker Date: Tue, 5 Feb 2013 22:54:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r246371 - head/bin/sh X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 05 Feb 2013 22:54:10 -0000 Author: jilles Date: Tue Feb 5 22:54:09 2013 New Revision: 246371 URL: http://svnweb.freebsd.org/changeset/base/246371 Log: sh: Do not test for digit_contig in mksyntax. ISO/IEC 9899:1999 (E) 5.2.1p3 guarantees that the values of the characters 0123456789 are contiguous. The generated syntax.c and syntax.h remain the same. Submitted by: Christoph Mallon Modified: head/bin/sh/mksyntax.c Modified: head/bin/sh/mksyntax.c ============================================================================== --- head/bin/sh/mksyntax.c Tue Feb 5 20:08:33 2013 (r246370) +++ head/bin/sh/mksyntax.c Tue Feb 5 22:54:09 2013 (r246371) @@ -107,14 +107,12 @@ static const char *syntax[513]; static int base; static int size; /* number of values which a char variable can have */ static int nbits; /* number of bits in a character */ -static int digit_contig;/* true if digits are contiguous */ static void filltable(const char *); static void init(void); static void add(const char *, const char *); static void print(const char *); static void output_type_macros(void); -static void digit_convert(void); int main(int argc __unused, char **argv __unused) @@ -125,7 +123,6 @@ main(int argc __unused, char **argv __un int i; char buf[80]; int pos; - static char digit[] = "0123456789"; /* Create output files */ if ((cfile = fopen("syntax.c", "w")) == NULL) { @@ -158,11 +155,6 @@ main(int argc __unused, char **argv __un base = 1; if (sign) base += 1 << (nbits - 1); - digit_contig = 1; - for (i = 0 ; i < 10 ; i++) { - if (digit[i] != '0' + i) - digit_contig = 0; - } fputs("#include \n", hfile); @@ -248,8 +240,6 @@ main(int argc __unused, char **argv __un add("_", "ISUNDER"); add("#?$!-*@", "ISSPECL"); print("is_type"); - if (! digit_contig) - digit_convert(); exit(0); } @@ -341,12 +331,13 @@ print(const char *name) */ static const char *macro[] = { - "#define is_digit(c)\t((is_type+SYNBASE)[(int)c] & ISDIGIT)", + "#define is_digit(c)\t((unsigned int)((c) - '0') <= 9)", "#define is_eof(c)\t((c) == PEOF)", "#define is_alpha(c)\t((is_type+SYNBASE)[(int)c] & (ISUPPER|ISLOWER))", "#define is_name(c)\t((is_type+SYNBASE)[(int)c] & (ISUPPER|ISLOWER|ISUNDER))", "#define is_in_name(c)\t((is_type+SYNBASE)[(int)c] & (ISUPPER|ISLOWER|ISUNDER|ISDIGIT))", "#define is_special(c)\t((is_type+SYNBASE)[(int)c] & (ISSPECL|ISDIGIT))", + "#define digit_val(c)\t((c) - '0')", NULL }; @@ -355,41 +346,6 @@ output_type_macros(void) { const char **pp; - if (digit_contig) - macro[0] = "#define is_digit(c)\t((unsigned int)((c) - '0') <= 9)"; for (pp = macro ; *pp ; pp++) fprintf(hfile, "%s\n", *pp); - if (digit_contig) - fputs("#define digit_val(c)\t((c) - '0')\n", hfile); - else - fputs("#define digit_val(c)\t(digit_value[c])\n", hfile); -} - - - -/* - * Output digit conversion table (if digits are not contiguous). - */ - -static void -digit_convert(void) -{ - int maxdigit; - static char digit[] = "0123456789"; - char *p; - int i; - - maxdigit = 0; - for (p = digit ; *p ; p++) - if (*p > maxdigit) - maxdigit = *p; - fputs("extern const char digit_value[];\n", hfile); - fputs("\n\nconst char digit_value[] = {\n", cfile); - for (i = 0 ; i <= maxdigit ; i++) { - for (p = digit ; *p && *p != i ; p++); - if (*p == '\0') - p = digit; - fprintf(cfile, " %d,\n", (int)(p - digit)); - } - fputs("};\n", cfile); } From owner-svn-src-head@FreeBSD.ORG Wed Feb 6 00:01:29 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 788E0F75; Wed, 6 Feb 2013 00:01:29 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 6678FFD6; Wed, 6 Feb 2013 00:01:29 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r1601SjV090852; Wed, 6 Feb 2013 00:01:28 GMT (envelope-from andrew@svn.freebsd.org) Received: (from andrew@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r1601Sfx090851; Wed, 6 Feb 2013 00:01:28 GMT (envelope-from andrew@svn.freebsd.org) Message-Id: <201302060001.r1601Sfx090851@svn.freebsd.org> From: Andrew Turner Date: Wed, 6 Feb 2013 00:01:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r246372 - head/lib/libcompiler_rt X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Feb 2013 00:01:29 -0000 Author: andrew Date: Wed Feb 6 00:01:28 2013 New Revision: 246372 URL: http://svnweb.freebsd.org/changeset/base/246372 Log: Add the __aeabi_mem* functions to compiler-rt as clang uses them. Modified: head/lib/libcompiler_rt/Makefile Modified: head/lib/libcompiler_rt/Makefile ============================================================================== --- head/lib/libcompiler_rt/Makefile Tue Feb 5 22:54:09 2013 (r246371) +++ head/lib/libcompiler_rt/Makefile Wed Feb 6 00:01:28 2013 (r246372) @@ -188,6 +188,10 @@ SRCS+= ${file}.c .if ${MACHINE_CPUARCH} == "arm" && ${MK_ARM_EABI} != "no" SRCS+= aeabi_idivmod.S \ aeabi_ldivmod.S \ + aeabi_memcmp.S \ + aeabi_memcpy.S \ + aeabi_memmove.S \ + aeabi_memset.S \ aeabi_uidivmod.S \ aeabi_uldivmod.S .endif From owner-svn-src-head@FreeBSD.ORG Wed Feb 6 01:03:14 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 2B932A02; Wed, 6 Feb 2013 01:03:14 +0000 (UTC) (envelope-from ganbold@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 014EF227; Wed, 6 Feb 2013 01:03:14 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r1613Dmt009458; Wed, 6 Feb 2013 01:03:13 GMT (envelope-from ganbold@svn.freebsd.org) Received: (from ganbold@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r1613DRB009456; Wed, 6 Feb 2013 01:03:13 GMT (envelope-from ganbold@svn.freebsd.org) Message-Id: <201302060103.r1613DRB009456@svn.freebsd.org> From: Ganbold Tsagaankhuu Date: Wed, 6 Feb 2013 01:03:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r246375 - head/sys/arm/allwinner X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Feb 2013 01:03:14 -0000 Author: ganbold (doc committer) Date: Wed Feb 6 01:03:13 2013 New Revision: 246375 URL: http://svnweb.freebsd.org/changeset/base/246375 Log: Use and set gpio pin to high to power up usb. Approved by: gonzo@ Modified: head/sys/arm/allwinner/a10_ehci.c Modified: head/sys/arm/allwinner/a10_ehci.c ============================================================================== --- head/sys/arm/allwinner/a10_ehci.c Wed Feb 6 00:43:10 2013 (r246374) +++ head/sys/arm/allwinner/a10_ehci.c Wed Feb 6 01:03:13 2013 (r246375) @@ -40,6 +40,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include @@ -58,6 +59,8 @@ __FBSDID("$FreeBSD$"); #include #include +#include "gpio_if.h" + #include "a10_clk.h" #define EHCI_HC_DEVSTR "Allwinner Integrated USB 2.0 controller" @@ -70,8 +73,9 @@ __FBSDID("$FreeBSD$"); #define SW_ULPI_BYPASS (1 << 0) #define SW_AHB_INCRX_ALIGN (1 << 8) -#define SW_AHB_INCR4 (1 << 9) +#define SW_AHB_INCR4 (1 << 9) #define SW_AHB_INCR8 (1 << 10) +#define GPIO_USB2_PWR 227 #define A10_READ_4(sc, reg) \ bus_space_read_4((sc)->sc_io_tag, (sc)->sc_io_hdl, reg) @@ -101,6 +105,7 @@ a10_ehci_attach(device_t self) { ehci_softc_t *sc = device_get_softc(self); bus_space_handle_t bsh; + device_t sc_gpio_dev; int err; int rid; uint32_t reg_value = 0; @@ -153,6 +158,13 @@ a10_ehci_attach(device_t self) sprintf(sc->sc_vendor, "Allwinner"); + /* Get the GPIO device, we need this to give power to USB */ + sc_gpio_dev = devclass_get_device(devclass_find("gpio"), 0); + if (sc_gpio_dev == NULL) { + device_printf(self, "Error: failed to get the GPIO device\n"); + goto error; + } + err = bus_setup_intr(self, sc->sc_irq_res, INTR_TYPE_BIO | INTR_MPSAFE, NULL, (driver_intr_t *)ehci_interrupt, sc, &sc->sc_intr_hdl); if (err) { @@ -166,6 +178,10 @@ a10_ehci_attach(device_t self) /* Enable clock for USB */ a10_clk_usb_activate(); + /* Give power to USB */ + GPIO_PIN_SETFLAGS(sc_gpio_dev, GPIO_USB2_PWR, GPIO_PIN_OUTPUT); + GPIO_PIN_SET(sc_gpio_dev, GPIO_USB2_PWR, GPIO_PIN_HIGH); + /* Enable passby */ reg_value = A10_READ_4(sc, SW_USB_PMU_IRQ_ENABLE); reg_value |= SW_AHB_INCR8; /* AHB INCR8 enable */ From owner-svn-src-head@FreeBSD.ORG Wed Feb 6 02:18:30 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 6F4EEA4E; Wed, 6 Feb 2013 02:18:30 +0000 (UTC) (envelope-from grog@lemis.com) Received: from w3.lemis.com (w3.lemis.com [208.86.224.149]) by mx1.freebsd.org (Postfix) with ESMTP id 47B27714; Wed, 6 Feb 2013 02:18:29 +0000 (UTC) Received: from eureka.lemis.com (1032.x.rootbsd.net [208.86.224.149]) by w3.lemis.com (Postfix) with ESMTP id 4A0253B74B; Wed, 6 Feb 2013 02:18:22 +0000 (UTC) Received: by eureka.lemis.com (Postfix, from userid 1004) id 810D7F74FA; Wed, 6 Feb 2013 13:18:18 +1100 (EST) Date: Wed, 6 Feb 2013 13:18:18 +1100 From: Greg 'groggy' Lehey To: John Baldwin Subject: Re: svn commit: r246362 - head/games/fortune/datfiles Message-ID: <20130206021818.GB2899@eureka.lemis.com> References: <201302051439.r15EdcE7011203@svn.freebsd.org> <201302051145.40104.jhb@freebsd.org> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="A6N2fC+uXW/VQSAv" Content-Disposition: inline In-Reply-To: <201302051145.40104.jhb@freebsd.org> User-Agent: Mutt/1.4.2.3i Organization: The FreeBSD Project Phone: +61-3-5346-1370 Mobile: +61-418-838-708 WWW-Home-Page: http://www.FreeBSD.org/ X-PGP-Fingerprint: 9A1B 8202 BCCE B846 F92F 09AC 22E6 F290 507A 4223 Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Dag-Erling SmXXrgrav X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Feb 2013 02:18:30 -0000 --A6N2fC+uXW/VQSAv Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Tuesday, 5 February 2013 at 11:45:40 -0500, John Baldwin wrote: > On Tuesday, February 05, 2013 9:39:38 am Dag-Erling SmXXrgrav wrote: >> Author: des >> Date: Tue Feb 5 14:39:37 2013 >> New Revision: 246362 >> URL: http://svnweb.freebsd.org/changeset/base/246362 >> >> Log: >> Remove political propaganda >> >> Modified: >> head/games/fortune/datfiles/fortunes-o.real > > *sigh* > > I'm sure there are other quotes that people who do not share your > political persuasion might find propaganda or offensive, etc. > Censorship and freedom of speech is quite a sticky widget, and I > think the only truly sane policy is that fortune files are > append-only (unless we outright remove them and that seems > excessive). And new things should have a very high bar to be added > to fortune. Perhaps we should move fortunes-o to ports entirely? Agreed, it shouldn't be up to individuals to decide which fortunes are *too* offensive. In this case, I suspect that there's a distinct difference between the perceptions of people inside and outside the USA. I also find Limbaugh particularly hard to stomach, but I don't think it should have been removed. The real issue I see is that, for whatever reason, the Limbaugh fortunes pop up far too frequently. It's as if the random number generation is failing. Comments? Greg -- Sent from my desktop computer. Finger grog@FreeBSD.org for PGP public key. See complete headers for address and phone numbers. This message is digitally signed. If your Microsoft MUA reports problems, please read http://tinyurl.com/broken-mua --A6N2fC+uXW/VQSAv Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.19 (FreeBSD) iEYEARECAAYFAlERvWkACgkQIubykFB6QiOi/gCgnFml35BZJoETJAQgHtOAc0Pm py8An2ZjouDNjsWwkf4DoJR8Pu9Czky9 =3RaQ -----END PGP SIGNATURE----- --A6N2fC+uXW/VQSAv-- From owner-svn-src-head@FreeBSD.ORG Wed Feb 6 04:53:01 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id BFB489E4; Wed, 6 Feb 2013 04:53:01 +0000 (UTC) (envelope-from neel@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id B0C39CE6; Wed, 6 Feb 2013 04:53:01 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r164r1dT078564; Wed, 6 Feb 2013 04:53:01 GMT (envelope-from neel@svn.freebsd.org) Received: (from neel@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r164r1kX078552; Wed, 6 Feb 2013 04:53:01 GMT (envelope-from neel@svn.freebsd.org) Message-Id: <201302060453.r164r1kX078552@svn.freebsd.org> From: Neel Natu Date: Wed, 6 Feb 2013 04:53:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r246384 - in head/sys/amd64: amd64 include X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Feb 2013 04:53:01 -0000 Author: neel Date: Wed Feb 6 04:53:00 2013 New Revision: 246384 URL: http://svnweb.freebsd.org/changeset/base/246384 Log: Compute the number of initial kernel page table pages (NKPT) dynamically. This eliminates the need to recompile the kernel when the default value of NKPT is not big enough - for e.g. when loading large kernel modules or memory disk images from the loader. If NKPT is defined in the kernel configuration file then it overrides the dynamic calculation. Reviewed by: alc, kib Modified: head/sys/amd64/amd64/minidump_machdep.c head/sys/amd64/amd64/pmap.c head/sys/amd64/include/pmap.h Modified: head/sys/amd64/amd64/minidump_machdep.c ============================================================================== --- head/sys/amd64/amd64/minidump_machdep.c Wed Feb 6 04:40:02 2013 (r246383) +++ head/sys/amd64/amd64/minidump_machdep.c Wed Feb 6 04:53:00 2013 (r246384) @@ -232,7 +232,7 @@ minidumpsys(struct dumperinfo *di) /* Walk page table pages, set bits in vm_page_dump */ pmapsize = 0; pdp = (uint64_t *)PHYS_TO_DMAP(KPDPphys); - for (va = VM_MIN_KERNEL_ADDRESS; va < MAX(KERNBASE + NKPT * NBPDR, + for (va = VM_MIN_KERNEL_ADDRESS; va < MAX(KERNBASE + nkpt * NBPDR, kernel_vm_end); ) { /* * We always write a page, even if it is zero. Each @@ -364,7 +364,7 @@ minidumpsys(struct dumperinfo *di) /* Dump kernel page directory pages */ bzero(fakepd, sizeof(fakepd)); pdp = (uint64_t *)PHYS_TO_DMAP(KPDPphys); - for (va = VM_MIN_KERNEL_ADDRESS; va < MAX(KERNBASE + NKPT * NBPDR, + for (va = VM_MIN_KERNEL_ADDRESS; va < MAX(KERNBASE + nkpt * NBPDR, kernel_vm_end); va += NBPDP) { i = (va >> PDPSHIFT) & ((1ul << NPDPEPGSHIFT) - 1); Modified: head/sys/amd64/amd64/pmap.c ============================================================================== --- head/sys/amd64/amd64/pmap.c Wed Feb 6 04:40:02 2013 (r246383) +++ head/sys/amd64/amd64/pmap.c Wed Feb 6 04:53:00 2013 (r246384) @@ -202,6 +202,10 @@ struct pmap kernel_pmap_store; vm_offset_t virtual_avail; /* VA of first avail page (after kernel bss) */ vm_offset_t virtual_end; /* VA of last avail page (end of kernel AS) */ +int nkpt; +SYSCTL_INT(_machdep, OID_AUTO, nkpt, CTLFLAG_RD, &nkpt, 0, + "Number of kernel page table pages allocated on bootup"); + static int ndmpdp; static vm_paddr_t dmaplimit; vm_offset_t kernel_vm_end = VM_MIN_KERNEL_ADDRESS; @@ -495,17 +499,42 @@ allocpages(vm_paddr_t *firstaddr, int n) CTASSERT(powerof2(NDMPML4E)); +/* number of kernel PDP slots */ +#define NKPDPE(ptpgs) howmany((ptpgs), NPDEPG) + static void -create_pagetables(vm_paddr_t *firstaddr) +nkpt_init(vm_paddr_t addr) { - int i, j, ndm1g; + int pt_pages; + +#ifdef NKPT + pt_pages = NKPT; +#else + pt_pages = howmany(addr, 1 << PDRSHIFT); + pt_pages += NKPDPE(pt_pages); - /* Allocate pages */ - KPTphys = allocpages(firstaddr, NKPT); - KPML4phys = allocpages(firstaddr, 1); - KPDPphys = allocpages(firstaddr, NKPML4E); - KPDphys = allocpages(firstaddr, NKPDPE); + /* + * Add some slop beyond the bare minimum required for bootstrapping + * the kernel. + * + * This is quite important when allocating KVA for kernel modules. + * The modules are required to be linked in the negative 2GB of + * the address space. If we run out of KVA in this region then + * pmap_growkernel() will need to allocate page table pages to map + * the entire 512GB of KVA space which is an unnecessary tax on + * physical memory. + */ + pt_pages += 8; /* 16MB additional slop for kernel modules */ +#endif + nkpt = pt_pages; +} +static void +create_pagetables(vm_paddr_t *firstaddr) +{ + int i, j, ndm1g, nkpdpe; + + /* Allocate page table pages for the direct map */ ndmpdp = (ptoa(Maxmem) + NBPDP - 1) >> PDPSHIFT; if (ndmpdp < 4) /* Minimum 4GB of dirmap */ ndmpdp = 4; @@ -517,6 +546,22 @@ create_pagetables(vm_paddr_t *firstaddr) DMPDphys = allocpages(firstaddr, ndmpdp - ndm1g); dmaplimit = (vm_paddr_t)ndmpdp << PDPSHIFT; + /* Allocate pages */ + KPML4phys = allocpages(firstaddr, 1); + KPDPphys = allocpages(firstaddr, NKPML4E); + + /* + * Allocate the initial number of kernel page table pages required to + * bootstrap. We defer this until after all memory-size dependent + * allocations are done (e.g. direct map), so that we don't have to + * build in too much slop in our estimate. + */ + nkpt_init(*firstaddr); + nkpdpe = NKPDPE(nkpt); + + KPTphys = allocpages(firstaddr, nkpt); + KPDphys = allocpages(firstaddr, nkpdpe); + /* Fill in the underlying page table pages */ /* Read-only from zero to physfree */ /* XXX not fully used, underneath 2M pages */ @@ -526,7 +571,7 @@ create_pagetables(vm_paddr_t *firstaddr) } /* Now map the page tables at their location within PTmap */ - for (i = 0; i < NKPT; i++) { + for (i = 0; i < nkpt; i++) { ((pd_entry_t *)KPDphys)[i] = KPTphys + (i << PAGE_SHIFT); ((pd_entry_t *)KPDphys)[i] |= PG_RW | PG_V; } @@ -539,7 +584,7 @@ create_pagetables(vm_paddr_t *firstaddr) } /* And connect up the PD to the PDP */ - for (i = 0; i < NKPDPE; i++) { + for (i = 0; i < nkpdpe; i++) { ((pdp_entry_t *)KPDPphys)[i + KPDPI] = KPDphys + (i << PAGE_SHIFT); ((pdp_entry_t *)KPDPphys)[i + KPDPI] |= PG_RW | PG_V | PG_U; @@ -768,7 +813,7 @@ pmap_init(void) * Initialize the vm page array entries for the kernel pmap's * page table pages. */ - for (i = 0; i < NKPT; i++) { + for (i = 0; i < nkpt; i++) { mpte = PHYS_TO_VM_PAGE(KPTphys + (i << PAGE_SHIFT)); KASSERT(mpte >= vm_page_array && mpte < &vm_page_array[vm_page_array_size], @@ -1995,7 +2040,7 @@ pmap_growkernel(vm_offset_t addr) * any new kernel page table pages between "kernel_vm_end" and * "KERNBASE". */ - if (KERNBASE < addr && addr <= KERNBASE + NKPT * NBPDR) + if (KERNBASE < addr && addr <= KERNBASE + nkpt * NBPDR) return; addr = roundup2(addr, NBPDR); Modified: head/sys/amd64/include/pmap.h ============================================================================== --- head/sys/amd64/include/pmap.h Wed Feb 6 04:40:02 2013 (r246383) +++ head/sys/amd64/include/pmap.h Wed Feb 6 04:53:00 2013 (r246384) @@ -113,13 +113,7 @@ ((unsigned long)(l2) << PDRSHIFT) | \ ((unsigned long)(l1) << PAGE_SHIFT)) -/* Initial number of kernel page tables. */ -#ifndef NKPT -#define NKPT 32 -#endif - #define NKPML4E 1 /* number of kernel PML4 slots */ -#define NKPDPE howmany(NKPT, NPDEPG)/* number of kernel PDP slots */ #define NUPML4E (NPML4EPG/2) /* number of userland PML4 pages */ #define NUPDPE (NUPML4E*NPDPEPG)/* number of userland PDP pages */ @@ -181,6 +175,7 @@ typedef u_int64_t pml4_entry_t; #define PML4map ((pd_entry_t *)(addr_PML4map)) #define PML4pml4e ((pd_entry_t *)(addr_PML4pml4e)) +extern int nkpt; /* Initial number of kernel page tables */ extern u_int64_t KPDPphys; /* physical address of kernel level 3 */ extern u_int64_t KPML4phys; /* physical address of kernel level 4 */ From owner-svn-src-head@FreeBSD.ORG Wed Feb 6 06:44:43 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 2AF68CF9; Wed, 6 Feb 2013 06:44:43 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 1E177EA; Wed, 6 Feb 2013 06:44:43 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r166igLo011340; Wed, 6 Feb 2013 06:44:42 GMT (envelope-from np@svn.freebsd.org) Received: (from np@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r166igaM011339; Wed, 6 Feb 2013 06:44:42 GMT (envelope-from np@svn.freebsd.org) Message-Id: <201302060644.r166igaM011339@svn.freebsd.org> From: Navdeep Parhar Date: Wed, 6 Feb 2013 06:44:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r246385 - head/sys/dev/cxgbe/common X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Feb 2013 06:44:43 -0000 Author: np Date: Wed Feb 6 06:44:42 2013 New Revision: 246385 URL: http://svnweb.freebsd.org/changeset/base/246385 Log: Busy-wait when cold. Reported by: gnn, jhb MFC after: 3 days Modified: head/sys/dev/cxgbe/common/t4_hw.c Modified: head/sys/dev/cxgbe/common/t4_hw.c ============================================================================== --- head/sys/dev/cxgbe/common/t4_hw.c Wed Feb 6 04:53:00 2013 (r246384) +++ head/sys/dev/cxgbe/common/t4_hw.c Wed Feb 6 06:44:42 2013 (r246385) @@ -35,7 +35,12 @@ __FBSDID("$FreeBSD$"); #include "firmware/t4fw_interface.h" #undef msleep -#define msleep(x) pause("t4hw", (x) * hz / 1000) +#define msleep(x) do { \ + if (cold) \ + DELAY((x) * 1000); \ + else \ + pause("t4hw", (x) * hz / 1000); \ +} while (0) /** * t4_wait_op_done_val - wait until an operation is completed From owner-svn-src-head@FreeBSD.ORG Wed Feb 6 07:18:10 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 1897765B; Wed, 6 Feb 2013 07:18:10 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from cell.glebius.int.ru (glebius.int.ru [81.19.69.10]) by mx1.freebsd.org (Postfix) with ESMTP id 7092422D; Wed, 6 Feb 2013 07:18:08 +0000 (UTC) Received: from cell.glebius.int.ru (localhost [127.0.0.1]) by cell.glebius.int.ru (8.14.6/8.14.6) with ESMTP id r167I7s0032141; Wed, 6 Feb 2013 11:18:07 +0400 (MSK) (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by cell.glebius.int.ru (8.14.6/8.14.6/Submit) id r167I7DQ032140; Wed, 6 Feb 2013 11:18:07 +0400 (MSK) (envelope-from glebius@FreeBSD.org) X-Authentication-Warning: cell.glebius.int.ru: glebius set sender to glebius@FreeBSD.org using -f Date: Wed, 6 Feb 2013 11:18:07 +0400 From: Gleb Smirnoff To: John Baldwin Subject: Re: svn commit: r246362 - head/games/fortune/datfiles Message-ID: <20130206071807.GN26896@FreeBSD.org> References: <201302051439.r15EdcE7011203@svn.freebsd.org> <201302051158.55117.jhb@freebsd.org> <20130205205547.GI26896@FreeBSD.org> <201302051617.25454.jhb@freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=koi8-r Content-Disposition: inline In-Reply-To: <201302051617.25454.jhb@freebsd.org> User-Agent: Mutt/1.5.21 (2010-09-15) Cc: Benjamin Kaduk , svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Dag-Erling SmXXrgrav X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Feb 2013 07:18:10 -0000 On Tue, Feb 05, 2013 at 04:17:25PM -0500, John Baldwin wrote: J> On Tuesday, February 05, 2013 3:55:47 pm Gleb Smirnoff wrote: J> > On Tue, Feb 05, 2013 at 11:58:54AM -0500, John Baldwin wrote: J> > J> > > On Tuesday, February 05, 2013 9:39:38 am Dag-Erling SmXXrgrav wrote: J> > J> > > > Author: des J> > J> > > > Date: Tue Feb 5 14:39:37 2013 J> > J> > > > New Revision: 246362 J> > J> > > > URL: http://svnweb.freebsd.org/changeset/base/246362 J> > J> > > > J> > J> > > > Log: J> > J> > > > Remove political propaganda J> > J> > > > J> > J> > > > Modified: J> > J> > > > head/games/fortune/datfiles/fortunes-o.real J> > J> > > J> > J> > > *sigh* J> > J> > > J> > J> > > I'm sure there are other quotes that people who do not share your political J> > J> > > persuasion might find propaganda or offensive, etc. Censorship and freedom J> > J> > > of speech is quite a sticky widget, and I think the only truly sane policy J> > J> > > is that fortune files are append-only (unless we outright remove them and J> > J> > > that seems excessive). And new things should have a very high bar to be J> > J> > > added to fortune. Perhaps we should move fortunes-o to ports entirely? J> > J> > > J> > J> > J> > J> > I am more concerned about the insta-MFC than the removal per se. J> > J> > Only security or legal issues are cause to go under 3 days, was my J> > J> > impression. J> > J> J> > J> Yes, the insta-MFC is also not appropriate, esp. for something that you know J> > J> is going to raise eyebrows when it is committed. Having to debate this sort J> > J> of thing in public on mailing lists is also distinctly unhelpful and very J> > J> distracting from productive work. Also, I'd like to preemptively ask J> > J> developers to refrain from any further commits to the fortunes datfiles for J> > J> the time being as the last thing we need is a commit war over this sort of J> > J> thing. J> > J> > What about just moving the entire games subdirectory to ports repo? J> J> We've already moved most of it many years ago. The yesterday bikeshed proves that "most" isn't enough. :( The entire games subdir needs to be moved. -- Totus tuus, Glebius. From owner-svn-src-head@FreeBSD.ORG Wed Feb 6 07:27:26 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 66B16AEF; Wed, 6 Feb 2013 07:27:26 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 414D1293; Wed, 6 Feb 2013 07:27:26 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r167RQp9023873; Wed, 6 Feb 2013 07:27:26 GMT (envelope-from glebius@svn.freebsd.org) Received: (from glebius@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r167RQqS023872; Wed, 6 Feb 2013 07:27:26 GMT (envelope-from glebius@svn.freebsd.org) Message-Id: <201302060727.r167RQqS023872@svn.freebsd.org> From: Gleb Smirnoff Date: Wed, 6 Feb 2013 07:27:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r246387 - head/sys/sys X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Feb 2013 07:27:26 -0000 Author: glebius Date: Wed Feb 6 07:27:25 2013 New Revision: 246387 URL: http://svnweb.freebsd.org/changeset/base/246387 Log: Fixes to QUEUE_MACRO_DEBUG support: - Add const quilifiers to fields that store value of __FILE__. - Use long type for fields that store value of __LINE__. - Sort and style(9) debugging fields. - Add initializer for debugging fields into TAILQ_INITIALIZER macro. PR: 175759 Submitted by: Andrey Simonenko Reviewed by: bde Modified: head/sys/sys/queue.h Modified: head/sys/sys/queue.h ============================================================================== --- head/sys/sys/queue.h Wed Feb 6 07:20:09 2013 (r246386) +++ head/sys/sys/queue.h Wed Feb 6 07:27:25 2013 (r246387) @@ -105,13 +105,14 @@ #ifdef QUEUE_MACRO_DEBUG /* Store the last 2 places the queue element or head was altered */ struct qm_trace { - char * lastfile; - int lastline; - char * prevfile; - int prevline; + unsigned long lastline; + unsigned long prevline; + const char *lastfile; + const char *prevfile; }; #define TRACEBUF struct qm_trace trace; +#define TRACEBUF_INITIALIZER { __FILE__, __LINE__, NULL, 0 } , #define TRASHIT(x) do {(x) = (void *)-1;} while (0) #define QMD_SAVELINK(name, link) void **name = (void *)&(link) @@ -134,6 +135,7 @@ struct qm_trace { #define QMD_TRACE_HEAD(head) #define QMD_SAVELINK(name, link) #define TRACEBUF +#define TRACEBUF_INITIALIZER #define TRASHIT(x) #endif /* QUEUE_MACRO_DEBUG */ @@ -461,7 +463,7 @@ struct name { \ } #define TAILQ_HEAD_INITIALIZER(head) \ - { NULL, &(head).tqh_first } + { NULL, &(head).tqh_first, TRACEBUF_INITIALIZER } #define TAILQ_ENTRY(type) \ struct { \ From owner-svn-src-head@FreeBSD.ORG Wed Feb 6 07:42:08 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 1CDF4FE1; Wed, 6 Feb 2013 07:42:08 +0000 (UTC) (envelope-from joel@vnode.se) Received: from mail.vnode.se (mail.vnode.se [62.119.52.80]) by mx1.freebsd.org (Postfix) with ESMTP id A150F33B; Wed, 6 Feb 2013 07:42:07 +0000 (UTC) Received: from mail.vnode.se (localhost [127.0.0.1]) by mail.vnode.se (Postfix) with ESMTP id 1F373E3F07B; Wed, 6 Feb 2013 08:42:06 +0100 (CET) X-Virus-Scanned: amavisd-new at vnode.se Received: from mail.vnode.se ([127.0.0.1]) by mail.vnode.se (mail.vnode.se [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 0husBVdGyKDF; Wed, 6 Feb 2013 08:42:03 +0100 (CET) Received: from jd.benders.se (jd.benders.se [212.247.52.12]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.vnode.se (Postfix) with ESMTPSA id 75A3BE3F079; Wed, 6 Feb 2013 08:42:03 +0100 (CET) Date: Wed, 6 Feb 2013 08:42:01 +0100 From: Joel Dahl To: Gleb Smirnoff Subject: Re: svn commit: r246362 - head/games/fortune/datfiles Message-ID: <20130206074201.GG21730@jd.benders.se> References: <201302051439.r15EdcE7011203@svn.freebsd.org> <201302051158.55117.jhb@freebsd.org> <20130205205547.GI26896@FreeBSD.org> <201302051617.25454.jhb@freebsd.org> <20130206071807.GN26896@FreeBSD.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20130206071807.GN26896@FreeBSD.org> User-Agent: Mutt/1.5.21 (2010-09-15) Cc: Benjamin Kaduk , src-committers@freebsd.org, John Baldwin , svn-src-all@freebsd.org, svn-src-head@freebsd.org, Dag-Erling SmXXrgrav X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Feb 2013 07:42:08 -0000 On 06-02-2013 11:18, Gleb Smirnoff wrote: > On Tue, Feb 05, 2013 at 04:17:25PM -0500, John Baldwin wrote: > J> On Tuesday, February 05, 2013 3:55:47 pm Gleb Smirnoff wrote: > J> > On Tue, Feb 05, 2013 at 11:58:54AM -0500, John Baldwin wrote: > J> > J> > > On Tuesday, February 05, 2013 9:39:38 am Dag-Erling SmXXrgrav wrote: > J> > J> > > > Author: des > J> > J> > > > Date: Tue Feb 5 14:39:37 2013 > J> > J> > > > New Revision: 246362 > J> > J> > > > URL: http://svnweb.freebsd.org/changeset/base/246362 > J> > J> > > > > J> > J> > > > Log: > J> > J> > > > Remove political propaganda > J> > J> > > > > J> > J> > > > Modified: > J> > J> > > > head/games/fortune/datfiles/fortunes-o.real > J> > J> > > > J> > J> > > *sigh* > J> > J> > > > J> > J> > > I'm sure there are other quotes that people who do not share your political > J> > J> > > persuasion might find propaganda or offensive, etc. Censorship and freedom > J> > J> > > of speech is quite a sticky widget, and I think the only truly sane policy > J> > J> > > is that fortune files are append-only (unless we outright remove them and > J> > J> > > that seems excessive). And new things should have a very high bar to be > J> > J> > > added to fortune. Perhaps we should move fortunes-o to ports entirely? > J> > J> > > > J> > J> > > J> > J> > I am more concerned about the insta-MFC than the removal per se. > J> > J> > Only security or legal issues are cause to go under 3 days, was my > J> > J> > impression. > J> > J> > J> > J> Yes, the insta-MFC is also not appropriate, esp. for something that you know > J> > J> is going to raise eyebrows when it is committed. Having to debate this sort > J> > J> of thing in public on mailing lists is also distinctly unhelpful and very > J> > J> distracting from productive work. Also, I'd like to preemptively ask > J> > J> developers to refrain from any further commits to the fortunes datfiles for > J> > J> the time being as the last thing we need is a commit war over this sort of > J> > J> thing. > J> > > J> > What about just moving the entire games subdirectory to ports repo? > J> > J> We've already moved most of it many years ago. > > The yesterday bikeshed proves that "most" isn't enough. :( The entire games subdir > needs to be moved. +1 This is a worthless discussion that seems to pop up from time to time. Move it to ports. -- Joel From owner-svn-src-head@FreeBSD.ORG Wed Feb 6 11:16:19 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 5FB31232; Wed, 6 Feb 2013 11:16:19 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 52597166; Wed, 6 Feb 2013 11:16:19 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r16BGJtE091367; Wed, 6 Feb 2013 11:16:19 GMT (envelope-from hselasky@svn.freebsd.org) Received: (from hselasky@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r16BGJMJ091366; Wed, 6 Feb 2013 11:16:19 GMT (envelope-from hselasky@svn.freebsd.org) Message-Id: <201302061116.r16BGJMJ091366@svn.freebsd.org> From: Hans Petter Selasky Date: Wed, 6 Feb 2013 11:16:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r246397 - head/sys/dev/syscons X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Feb 2013 11:16:19 -0000 Author: hselasky Date: Wed Feb 6 11:16:18 2013 New Revision: 246397 URL: http://svnweb.freebsd.org/changeset/base/246397 Log: Make sure that all mouse buttons are released when clients using /dev/consolectl close. This fixes a problem where if a USB mouse is detached while a button is pressed, that button is never released. MFC after: 1 week Modified: head/sys/dev/syscons/syscons.c Modified: head/sys/dev/syscons/syscons.c ============================================================================== --- head/sys/dev/syscons/syscons.c Wed Feb 6 11:10:41 2013 (r246396) +++ head/sys/dev/syscons/syscons.c Wed Feb 6 11:16:18 2013 (r246397) @@ -253,11 +253,13 @@ static struct ttydevsw sc_ttydevsw = { }; static d_ioctl_t consolectl_ioctl; +static d_close_t consolectl_close; static struct cdevsw consolectl_devsw = { .d_version = D_VERSION, - .d_flags = D_NEEDGIANT, + .d_flags = D_NEEDGIANT | D_TRACKCLOSE, .d_ioctl = consolectl_ioctl, + .d_close = consolectl_close, .d_name = "consolectl", }; @@ -1561,6 +1563,23 @@ consolectl_ioctl(struct cdev *dev, u_lon return sctty_ioctl(dev->si_drv1, cmd, data, td); } +static int +consolectl_close(struct cdev *dev, int flags, int mode, struct thread *td) +{ +#ifndef SC_NO_SYSMOUSE + mouse_info_t info; + memset(&info, 0, sizeof(info)); + info.operation = MOUSE_ACTION; + + /* + * Make sure all buttons are released when moused and other + * console daemons exit, so that no buttons are left pressed. + */ + (void) sctty_ioctl(dev->si_drv1, CONS_MOUSECTL, (caddr_t)&info, td); +#endif + return (0); +} + static void sc_cnprobe(struct consdev *cp) { From owner-svn-src-head@FreeBSD.ORG Wed Feb 6 13:12:43 2013 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 46AAB53E; Wed, 6 Feb 2013 13:12:43 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from citadel.icyb.net.ua (citadel.icyb.net.ua [212.40.38.140]) by mx1.freebsd.org (Postfix) with ESMTP id CF3608F2; Wed, 6 Feb 2013 13:12:41 +0000 (UTC) Received: from odyssey.starpoint.kiev.ua (alpha-e.starpoint.kiev.ua [212.40.38.101]) by citadel.icyb.net.ua (8.8.8p3/ICyb-2.3exp) with ESMTP id PAA16332; Wed, 06 Feb 2013 15:12:40 +0200 (EET) (envelope-from avg@FreeBSD.org) Message-ID: <511256C7.6080406@FreeBSD.org> Date: Wed, 06 Feb 2013 15:12:39 +0200 From: Andriy Gapon User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:17.0) Gecko/20130206 Thunderbird/17.0.2 MIME-Version: 1.0 To: John Baldwin Subject: Re: svn commit: r246282 - in head/sys: conf kern References: <201302030957.r139vd8n027213@svn.freebsd.org> <201302041429.01477.jhb@freebsd.org> <51102076.8030302@FreeBSD.org> <201302051115.03275.jhb@freebsd.org> In-Reply-To: <201302051115.03275.jhb@freebsd.org> X-Enigmail-Version: 1.4.6 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Feb 2013 13:12:43 -0000 on 05/02/2013 18:15 John Baldwin said the following: > Almost. To handle the case where the boot buffer might have wrapped I think > you should copy the entries at the "end" into the head of the KTR buffer > first, then the entries from the front to the current index, and then update > the index to point at the end (it should effectively be KTR_BOOT_ENTRIES > I think). I decided to just copy the whole buffer. That should cover all the possible cases and should not be too expensive. -- Andriy Gapon From owner-svn-src-head@FreeBSD.ORG Wed Feb 6 14:22:07 2013 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 263F7C8A; Wed, 6 Feb 2013 14:22:07 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from citadel.icyb.net.ua (citadel.icyb.net.ua [212.40.38.140]) by mx1.freebsd.org (Postfix) with ESMTP id CDB13DF3; Wed, 6 Feb 2013 14:22:05 +0000 (UTC) Received: from odyssey.starpoint.kiev.ua (alpha-e.starpoint.kiev.ua [212.40.38.101]) by citadel.icyb.net.ua (8.8.8p3/ICyb-2.3exp) with ESMTP id QAA17072; Wed, 06 Feb 2013 16:22:04 +0200 (EET) (envelope-from avg@FreeBSD.org) Message-ID: <5112670B.5030003@FreeBSD.org> Date: Wed, 06 Feb 2013 16:22:03 +0200 From: Andriy Gapon User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:17.0) Gecko/20130206 Thunderbird/17.0.2 MIME-Version: 1.0 To: John Baldwin Subject: Re: svn commit: r246282 - in head/sys: conf kern References: <201302030957.r139vd8n027213@svn.freebsd.org> <201302041429.01477.jhb@freebsd.org> <51102076.8030302@FreeBSD.org> <201302051115.03275.jhb@freebsd.org> <511256C7.6080406@FreeBSD.org> In-Reply-To: <511256C7.6080406@FreeBSD.org> X-Enigmail-Version: 1.4.6 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Feb 2013 14:22:07 -0000 on 06/02/2013 15:12 Andriy Gapon said the following: > on 05/02/2013 18:15 John Baldwin said the following: >> Almost. To handle the case where the boot buffer might have wrapped I think >> you should copy the entries at the "end" into the head of the KTR buffer >> first, then the entries from the front to the current index, and then update >> the index to point at the end (it should effectively be KTR_BOOT_ENTRIES >> I think). > > I decided to just copy the whole buffer. That should cover all the possible cases > and should not be too expensive. > Hmm, or not. Let me think again about the wrap-around case and a larger buffer. -- Andriy Gapon From owner-svn-src-head@FreeBSD.ORG Wed Feb 6 14:34:44 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 20720518; Wed, 6 Feb 2013 14:34:44 +0000 (UTC) (envelope-from des@des.no) Received: from smtp.des.no (smtp.des.no [194.63.250.102]) by mx1.freebsd.org (Postfix) with ESMTP id CF44CEAE; Wed, 6 Feb 2013 14:34:43 +0000 (UTC) Received: from ds4.des.no (smtp.des.no [194.63.250.102]) by smtp-int.des.no (Postfix) with ESMTP id 0EBC16D1A; Wed, 6 Feb 2013 14:34:43 +0000 (UTC) Received: by ds4.des.no (Postfix, from userid 1001) id D28C9AEAE; Wed, 6 Feb 2013 15:34:42 +0100 (CET) From: =?utf-8?Q?Dag-Erling_Sm=C3=B8rgrav?= To: Gleb Smirnoff Subject: Re: svn commit: r246362 - head/games/fortune/datfiles References: <201302051439.r15EdcE7011203@svn.freebsd.org> <201302051158.55117.jhb@freebsd.org> <20130205205547.GI26896@FreeBSD.org> <201302051617.25454.jhb@freebsd.org> <20130206071807.GN26896@FreeBSD.org> Date: Wed, 06 Feb 2013 15:34:42 +0100 In-Reply-To: <20130206071807.GN26896@FreeBSD.org> (Gleb Smirnoff's message of "Wed, 6 Feb 2013 11:18:07 +0400") Message-ID: <86d2wdh5od.fsf@ds4.des.no> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.4 (berkeley-unix) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Cc: Benjamin Kaduk , svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, John Baldwin X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Feb 2013 14:34:44 -0000 Gleb Smirnoff writes: > The yesterday bikeshed proves that "most" isn't enough. :( The entire > games subdir needs to be moved. fortune(6) in itself is quite useful (try it with -e freebsd-tips). Some of the content is objectionable, but that does not justify removing the tool itself, although I wish we'd sort out the build process so strfile(8) didn't have to be a build tool. DES --=20 Dag-Erling Sm=C3=B8rgrav - des@des.no From owner-svn-src-head@FreeBSD.ORG Wed Feb 6 14:37:01 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 601296A0; Wed, 6 Feb 2013 14:37:01 +0000 (UTC) (envelope-from des@des.no) Received: from smtp.des.no (smtp.des.no [194.63.250.102]) by mx1.freebsd.org (Postfix) with ESMTP id 14175ED0; Wed, 6 Feb 2013 14:37:00 +0000 (UTC) Received: from ds4.des.no (smtp.des.no [194.63.250.102]) by smtp-int.des.no (Postfix) with ESMTP id 51AE36D22; Wed, 6 Feb 2013 14:37:00 +0000 (UTC) Received: by ds4.des.no (Postfix, from userid 1001) id 0B267AEB0; Wed, 6 Feb 2013 15:37:00 +0100 (CET) From: =?utf-8?Q?Dag-Erling_Sm=C3=B8rgrav?= To: Greg 'groggy' Lehey Subject: Re: svn commit: r246362 - head/games/fortune/datfiles References: <201302051439.r15EdcE7011203@svn.freebsd.org> <201302051145.40104.jhb@freebsd.org> <20130206021818.GB2899@eureka.lemis.com> Date: Wed, 06 Feb 2013 15:36:59 +0100 In-Reply-To: <20130206021818.GB2899@eureka.lemis.com> (Greg Lehey's message of "Wed, 6 Feb 2013 13:18:18 +1100") Message-ID: <868v71h5kk.fsf@ds4.des.no> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.4 (berkeley-unix) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, John Baldwin X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Feb 2013 14:37:01 -0000 Greg 'groggy' Lehey writes: > The real issue I see is that, for whatever reason, the Limbaugh > fortunes pop up far too frequently. It's as if the random number > generation is failing. Comments? Not sure how often is too often, but there were 35 of them, which is approximately 1.5% of fortunes-o, so even with a fair random generator, they'd show up quite often. DES --=20 Dag-Erling Sm=C3=B8rgrav - des@des.no From owner-svn-src-head@FreeBSD.ORG Wed Feb 6 14:41:52 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id F171AA86; Wed, 6 Feb 2013 14:41:51 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from bigwig.baldwin.cx (bigknife-pt.tunnel.tserv9.chi1.ipv6.he.net [IPv6:2001:470:1f10:75::2]) by mx1.freebsd.org (Postfix) with ESMTP id B7859F24; Wed, 6 Feb 2013 14:41:51 +0000 (UTC) Received: from pakbsde14.localnet (unknown [38.105.238.108]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id A4CD9B915; Wed, 6 Feb 2013 09:41:49 -0500 (EST) From: John Baldwin To: Andriy Gapon Subject: Re: svn commit: r246282 - in head/sys: conf kern Date: Wed, 6 Feb 2013 08:22:10 -0500 User-Agent: KMail/1.13.5 (FreeBSD/8.2-CBSD-20110714-p22; KDE/4.5.5; amd64; ; ) References: <201302030957.r139vd8n027213@svn.freebsd.org> <201302051115.03275.jhb@freebsd.org> <511256C7.6080406@FreeBSD.org> In-Reply-To: <511256C7.6080406@FreeBSD.org> X-KMail-Markup: true MIME-Version: 1.0 Message-Id: <201302060822.10573.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.7 (bigwig.baldwin.cx); Wed, 06 Feb 2013 09:41:49 -0500 (EST) Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Content-Filtered-By: Mailman/MimeDel 2.1.14 Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Feb 2013 14:41:52 -0000 On Wednesday, February 06, 2013 8:12:39 am Andriy Gapon wrote: > on 05/02/2013 18:15 John Baldwin said the following: > > Almost. To handle the case where the boot buffer might have wrapped I think > > you should copy the entries at the "end" into the head of the KTR buffer > > first, then the entries from the front to the current index, and then update > > the index to point at the end (it should effectively be KTR_BOOT_ENTRIES > > I think). > > I decided to just copy the whole buffer. That should cover all the possible cases > and should not be too expensive. Hmm, I think this doesn't quite work. Suppose the buffer has wrapped but only a few new entries are logged (so that there are zero'd entries at the end of the larger buffer). In this case that things like 'ktrdump' and 'show ktr' will only show events from the start of the buffer up to the index and will miss the old events after the current index. (They walk the buffer backwards and stop at the first "empty" entry.) -- John Baldwin From owner-svn-src-head@FreeBSD.ORG Wed Feb 6 15:18:47 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 315D6D80; Wed, 6 Feb 2013 15:18:47 +0000 (UTC) (envelope-from pluknet@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 23D5B1D4; Wed, 6 Feb 2013 15:18:47 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r16FIknr057712; Wed, 6 Feb 2013 15:18:46 GMT (envelope-from pluknet@svn.freebsd.org) Received: (from pluknet@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r16FIkeC057711; Wed, 6 Feb 2013 15:18:46 GMT (envelope-from pluknet@svn.freebsd.org) Message-Id: <201302061518.r16FIkeC057711@svn.freebsd.org> From: Sergey Kandaurov Date: Wed, 6 Feb 2013 15:18:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r246412 - head/sys/kern X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Feb 2013 15:18:47 -0000 Author: pluknet Date: Wed Feb 6 15:18:46 2013 New Revision: 246412 URL: http://svnweb.freebsd.org/changeset/base/246412 Log: Prezero the acl structure which is to be copied to usermode, to avoid leakage of the previous content of padding and unitialized fields. Reported by: Ilia Noskov Reviewed by: kib MFC after: 1 week Modified: head/sys/kern/vfs_acl.c Modified: head/sys/kern/vfs_acl.c ============================================================================== --- head/sys/kern/vfs_acl.c Wed Feb 6 15:08:41 2013 (r246411) +++ head/sys/kern/vfs_acl.c Wed Feb 6 15:18:46 2013 (r246412) @@ -247,7 +247,7 @@ vacl_get_acl(struct thread *td, struct v struct acl *inkernelacl; int error; - inkernelacl = acl_alloc(M_WAITOK); + inkernelacl = acl_alloc(M_WAITOK | M_ZERO); vn_lock(vp, LK_EXCLUSIVE | LK_RETRY); #ifdef MAC error = mac_vnode_check_getacl(td->td_ucred, vp, type); From owner-svn-src-head@FreeBSD.ORG Wed Feb 6 15:36:16 2013 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id A1FCD90D; Wed, 6 Feb 2013 15:36:16 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from duck.symmetricom.us (duck.symmetricom.us [206.168.13.214]) by mx1.freebsd.org (Postfix) with ESMTP id 688A8308; Wed, 6 Feb 2013 15:36:16 +0000 (UTC) Received: from damnhippie.dyndns.org (daffy.symmetricom.us [206.168.13.218]) by duck.symmetricom.us (8.14.6/8.14.6) with ESMTP id r16FaFSa011707; Wed, 6 Feb 2013 08:36:15 -0700 (MST) (envelope-from ian@FreeBSD.org) Received: from [172.22.42.240] (revolution.hippie.lan [172.22.42.240]) by damnhippie.dyndns.org (8.14.3/8.14.3) with ESMTP id r16FaCeI033362; Wed, 6 Feb 2013 08:36:12 -0700 (MST) (envelope-from ian@FreeBSD.org) Subject: Re: svn commit: r246397 - head/sys/dev/syscons From: Ian Lepore To: Hans Petter Selasky In-Reply-To: <201302061116.r16BGJMJ091366@svn.freebsd.org> References: <201302061116.r16BGJMJ091366@svn.freebsd.org> Content-Type: text/plain; charset="us-ascii" Date: Wed, 06 Feb 2013 08:36:12 -0700 Message-ID: <1360164972.93359.606.camel@revolution.hippie.lan> Mime-Version: 1.0 X-Mailer: Evolution 2.32.1 FreeBSD GNOME Team Port Content-Transfer-Encoding: 7bit Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Feb 2013 15:36:16 -0000 On Wed, 2013-02-06 at 11:16 +0000, Hans Petter Selasky wrote: > Author: hselasky > Date: Wed Feb 6 11:16:18 2013 > New Revision: 246397 > URL: http://svnweb.freebsd.org/changeset/base/246397 > > Log: > Make sure that all mouse buttons are released when clients > using /dev/consolectl close. This fixes a problem where if > a USB mouse is detached while a button is pressed, that > button is never released. > > MFC after: 1 week > > Modified: > head/sys/dev/syscons/syscons.c > > Modified: head/sys/dev/syscons/syscons.c > ============================================================================== > --- head/sys/dev/syscons/syscons.c Wed Feb 6 11:10:41 2013 (r246396) > +++ head/sys/dev/syscons/syscons.c Wed Feb 6 11:16:18 2013 (r246397) > @@ -253,11 +253,13 @@ static struct ttydevsw sc_ttydevsw = { > }; > > static d_ioctl_t consolectl_ioctl; > +static d_close_t consolectl_close; > > static struct cdevsw consolectl_devsw = { > .d_version = D_VERSION, > - .d_flags = D_NEEDGIANT, > + .d_flags = D_NEEDGIANT | D_TRACKCLOSE, > .d_ioctl = consolectl_ioctl, > + .d_close = consolectl_close, > .d_name = "consolectl", > }; > > @@ -1561,6 +1563,23 @@ consolectl_ioctl(struct cdev *dev, u_lon > return sctty_ioctl(dev->si_drv1, cmd, data, td); > } > > +static int > +consolectl_close(struct cdev *dev, int flags, int mode, struct thread *td) > +{ > +#ifndef SC_NO_SYSMOUSE > + mouse_info_t info; > + memset(&info, 0, sizeof(info)); > + info.operation = MOUSE_ACTION; > + > + /* > + * Make sure all buttons are released when moused and other > + * console daemons exit, so that no buttons are left pressed. > + */ > + (void) sctty_ioctl(dev->si_drv1, CONS_MOUSECTL, (caddr_t)&info, td); > +#endif > + return (0); > +} > + > static void > sc_cnprobe(struct consdev *cp) > { I think the D_TRACKCLOSE flag is not what you want here. Based on my (admittedly still vague) understanding of it, that flag is almost never the right thing for a driver to use. If you need that action to be taken when the last open instance of the driver is closed, that's what you get without D_TRACKCLOSE. If you need it to be called as many times as the open routine was called... well, that's the the confusing thing. It's not clear to me that there's any way to get that effect, but the cdevpriv destructor may be the closest thing available. I think the essential problem is that open and close are not strictly paired. For example, a forked child inherits open descriptors without open() calls happening, and revoke() is a way to destroy references without a close() call. But the details of all this are murky to me, and the most-enlightening mailing list posts you can find on it are full of phrases like "vref counters for devfs nodes" and "vnode is reclaimed" that make the discussion difficult to follow if you're not intimate with the internals of the vm system. -- Ian From owner-svn-src-head@FreeBSD.ORG Wed Feb 6 16:20:18 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 83851AA0; Wed, 6 Feb 2013 16:20:18 +0000 (UTC) (envelope-from hselasky@c2i.net) Received: from swip.net (mailfe02.c2i.net [212.247.154.34]) by mx1.freebsd.org (Postfix) with ESMTP id 4B1BF71B; Wed, 6 Feb 2013 16:20:16 +0000 (UTC) X-T2-Spam-Status: No, hits=-0.2 required=5.0 tests=ALL_TRUSTED, BAYES_50 Received: from [176.74.213.204] (account mc467741@c2i.net HELO laptop015.hselasky.homeunix.org) by mailfe02.swip.net (CommuniGate Pro SMTP 5.4.4) with ESMTPA id 376074392; Wed, 06 Feb 2013 17:20:14 +0100 From: Hans Petter Selasky To: Ian Lepore Subject: Re: svn commit: r246397 - head/sys/dev/syscons Date: Wed, 6 Feb 2013 17:21:24 +0100 User-Agent: KMail/1.13.7 (FreeBSD/9.1-STABLE; KDE/4.8.4; amd64; ; ) References: <201302061116.r16BGJMJ091366@svn.freebsd.org> <1360164972.93359.606.camel@revolution.hippie.lan> In-Reply-To: <1360164972.93359.606.camel@revolution.hippie.lan> X-Face: ?p&W)c(+80hU; '{.$5K+zq{oC6y| /D'an*6mw>j'f:eBsex\Gi, Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Feb 2013 16:20:18 -0000 On Wednesday 06 February 2013 16:36:12 Ian Lepore wrote: > On Wed, 2013-02-06 at 11:16 +0000, Hans Petter Selasky wrote: > > Author: hselasky > > Date: Wed Feb 6 11:16:18 2013 > > New Revision: 246397 > > URL: http://svnweb.freebsd.org/changeset/base/246397 > > > > Log: > > Make sure that all mouse buttons are released when clients > > using /dev/consolectl close. This fixes a problem where if > > a USB mouse is detached while a button is pressed, that > > button is never released. > > > > MFC after: 1 week > > > > Modified: > > head/sys/dev/syscons/syscons.c > > > > Modified: head/sys/dev/syscons/syscons.c > > ========================================================================= > > ===== --- head/sys/dev/syscons/syscons.c Wed Feb 6 11:10:41 > > 2013 (r246396) +++ head/sys/dev/syscons/syscons.c Wed Feb 6 11:16:18 > > 2013 (r246397) @@ -253,11 +253,13 @@ static struct ttydevsw sc_ttydevsw > > = { > > > > }; > > > > static d_ioctl_t consolectl_ioctl; > > > > +static d_close_t consolectl_close; > > > > static struct cdevsw consolectl_devsw = { > > > > .d_version = D_VERSION, > > > > - .d_flags = D_NEEDGIANT, > > + .d_flags = D_NEEDGIANT | D_TRACKCLOSE, > > > > .d_ioctl = consolectl_ioctl, > > > > + .d_close = consolectl_close, > > > > .d_name = "consolectl", > > > > }; > > > > @@ -1561,6 +1563,23 @@ consolectl_ioctl(struct cdev *dev, u_lon > > > > return sctty_ioctl(dev->si_drv1, cmd, data, td); > > > > } > > > > +static int > > +consolectl_close(struct cdev *dev, int flags, int mode, struct thread > > *td) +{ > > +#ifndef SC_NO_SYSMOUSE > > + mouse_info_t info; > > + memset(&info, 0, sizeof(info)); > > + info.operation = MOUSE_ACTION; > > + > > + /* > > + * Make sure all buttons are released when moused and other > > + * console daemons exit, so that no buttons are left pressed. > > + */ > > + (void) sctty_ioctl(dev->si_drv1, CONS_MOUSECTL, (caddr_t)&info, td); > > +#endif > > + return (0); > > +} > > + > > > > static void > > sc_cnprobe(struct consdev *cp) > > { > Hi Ian, > I think the D_TRACKCLOSE flag is not what you want here. Based on my > (admittedly still vague) understanding of it, that flag is almost never > the right thing for a driver to use. > > If you need that action to be taken when the last open instance of the > driver is closed, I don't want to wait until the last instance is closed. There are multiple instances of moused, for example. Each instance has a handle on /dev/consolectl . When one moused instance exits it closes this handle and I want to flush the mouse buttons. I tought about adding a cdevpriv structure to keep track of the mouse buttons on this file handle, though that seems to be overkill. > that's what you get without D_TRACKCLOSE. If you need > it to be called as many times as the open routine was called... well, > that's the the confusing thing. It's not clear to me that there's any > way to get that effect, but the cdevpriv destructor may be the closest > thing available. D_TRACKCLOSE was added to get the close call through each time. > > I think the essential problem is that open and close are not strictly > paired. That only happens when you destroy the device and the consolectl device is not destroyed. Else they will be paired. > For example, a forked child inherits open descriptors without > open() calls happening, and revoke() is a way to destroy references > without a close() call. But the details of all this are murky to me, > and the most-enlightening mailing list posts you can find on it are full > of phrases like "vref counters for devfs nodes" and "vnode is reclaimed" > that make the discussion difficult to follow if you're not intimate with > the internals of the vm system. Right, what other clients of /dev/consolectl do we have? And do some of them pass on the FD like you describe? --HPS From owner-svn-src-head@FreeBSD.ORG Wed Feb 6 17:06:53 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 4870A7DB; Wed, 6 Feb 2013 17:06:53 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 2C28AAEA; Wed, 6 Feb 2013 17:06:53 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r16H6row088895; Wed, 6 Feb 2013 17:06:53 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r16H6qMo088889; Wed, 6 Feb 2013 17:06:52 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201302061706.r16H6qMo088889@svn.freebsd.org> From: John Baldwin Date: Wed, 6 Feb 2013 17:06:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r246417 - in head/sys: fs/nfs kern nfsclient sys X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Feb 2013 17:06:53 -0000 Author: jhb Date: Wed Feb 6 17:06:51 2013 New Revision: 246417 URL: http://svnweb.freebsd.org/changeset/base/246417 Log: Rework the handling of stop signals in the NFS client. The changes in 195702, 195703, and 195821 prevented a thread from suspending while holding locks inside of NFS by forcing the thread to fail sleeps with EINTR or ERESTART but defer the thread suspension to the user boundary. However, this had the effect that stopping a process during an NFS request could abort the request and trigger EINTR errors that were visible to userland processes (previously the thread would have suspended and completed the request once it was resumed). This change instead effectively masks stop signals while in the NFS client. It uses the existing TDF_SBDRY flag to effect this since SIGSTOP cannot be masked directly. Also, instead of setting PBDRY on individual sleeps, the NFS client now sets the TDF_SBDRY flag around each NFS request and stop signals are masked for all sleeps during that region (the previous change missed sleeps in lockmgr locks). The end result is that stop signals sent to threads performing an NFS request are completely ignored until after the NFS request has finished processing and the thread prepares to return to userland. This restores the behavior of stop signals being transparent to userland processes while still preventing threads from suspending while holding NFS locks. Reviewed by: kib MFC after: 1 month Modified: head/sys/fs/nfs/nfs_commonkrpc.c head/sys/kern/kern_sig.c head/sys/kern/subr_sleepqueue.c head/sys/nfsclient/nfs_krpc.c head/sys/sys/signalvar.h Modified: head/sys/fs/nfs/nfs_commonkrpc.c ============================================================================== --- head/sys/fs/nfs/nfs_commonkrpc.c Wed Feb 6 16:43:35 2013 (r246416) +++ head/sys/fs/nfs/nfs_commonkrpc.c Wed Feb 6 17:06:51 2013 (r246417) @@ -1031,7 +1031,6 @@ int newnfs_sig_set[] = { SIGTERM, SIGHUP, SIGKILL, - SIGSTOP, SIGQUIT }; @@ -1052,7 +1051,7 @@ nfs_sig_pending(sigset_t set) /* * The set/restore sigmask functions are used to (temporarily) overwrite - * the process p_sigmask during an RPC call (for example). These are also + * the thread td_sigmask during an RPC call (for example). These are also * used in other places in the NFS client that might tsleep(). */ void @@ -1081,8 +1080,10 @@ newnfs_set_sigmask(struct thread *td, si SIGDELSET(newset, newnfs_sig_set[i]); } mtx_unlock(&p->p_sigacts->ps_mtx); + sigdeferstop(td); + kern_sigprocmask(td, SIG_SETMASK, &newset, oldset, + SIGPROCMASK_PROC_LOCKED); PROC_UNLOCK(p); - kern_sigprocmask(td, SIG_SETMASK, &newset, oldset, 0); } void @@ -1091,6 +1092,7 @@ newnfs_restore_sigmask(struct thread *td if (td == NULL) td = curthread; /* XXX */ kern_sigprocmask(td, SIG_SETMASK, set, NULL, 0); + sigallowstop(td); } /* Modified: head/sys/kern/kern_sig.c ============================================================================== --- head/sys/kern/kern_sig.c Wed Feb 6 16:43:35 2013 (r246416) +++ head/sys/kern/kern_sig.c Wed Feb 6 17:06:51 2013 (r246417) @@ -2364,6 +2364,13 @@ tdsigwakeup(struct thread *td, int sig, } /* + * Don't awaken a sleeping thread for SIGSTOP if the + * STOP signal is deferred. + */ + if ((prop & SA_STOP) && (td->td_flags & TDF_SBDRY)) + goto out; + + /* * Give low priority threads a better chance to run. */ if (td->td_priority > PUSER) @@ -2404,12 +2411,13 @@ sig_suspend_threads(struct thread *td, s if ((TD_IS_SLEEPING(td2) || TD_IS_SWAPPED(td2)) && (td2->td_flags & TDF_SINTR)) { if (td2->td_flags & TDF_SBDRY) { - if (TD_IS_SUSPENDED(td2)) - wakeup_swapper |= - thread_unsuspend_one(td2); - if (TD_ON_SLEEPQ(td2)) - wakeup_swapper |= - sleepq_abort(td2, ERESTART); + /* + * Once a thread is asleep with + * TDF_SBDRY set, it should never + * become suspended due to this check. + */ + KASSERT(!TD_IS_SUSPENDED(td2), + ("thread with deferred stops suspended")); } else if (!TD_IS_SUSPENDED(td2)) { thread_suspend_one(td2); } @@ -2529,6 +2537,34 @@ tdsigcleanup(struct thread *td) } +/* Defer the delivery of SIGSTOP for the current thread. */ +void +sigdeferstop(struct thread *td) +{ + + KASSERT(!(td->td_flags & TDF_SBDRY), + ("attempt to set TDF_SBDRY recursively")); + thread_lock(td); + td->td_flags |= TDF_SBDRY; + thread_unlock(td); +} + +/* + * Permit the delivery of SIGSTOP for the current thread. This does + * not immediately suspend if a stop was posted. Instead, the thread + * will suspend either via ast() or a subsequent interruptible sleep. + */ +void +sigallowstop(struct thread *td) +{ + + KASSERT(td->td_flags & TDF_SBDRY, + ("attempt to clear already-cleared TDF_SBDRY")); + thread_lock(td); + td->td_flags &= ~TDF_SBDRY; + thread_unlock(td); +} + /* * If the current process has received a signal (should be caught or cause * termination, should interrupt current syscall), return the signal number. @@ -2561,7 +2597,7 @@ issignal(struct thread *td, int stop_all SIGSETOR(sigpending, p->p_sigqueue.sq_signals); SIGSETNAND(sigpending, td->td_sigmask); - if (p->p_flag & P_PPWAIT) + if (p->p_flag & P_PPWAIT || td->td_flags & TDF_SBDRY) SIG_STOPSIGMASK(sigpending); if (SIGISEMPTY(sigpending)) /* no signal to send */ return (0); @@ -2677,10 +2713,6 @@ issignal(struct thread *td, int stop_all (p->p_pgrp->pg_jobc == 0 && prop & SA_TTYSTOP)) break; /* == ignore */ - - /* Ignore, but do not drop the stop signal. */ - if (stop_allowed != SIG_STOP_ALLOWED) - return (sig); mtx_unlock(&ps->ps_mtx); WITNESS_WARN(WARN_GIANTOK | WARN_SLEEPOK, &p->p_mtx.lock_object, "Catching SIGSTOP"); Modified: head/sys/kern/subr_sleepqueue.c ============================================================================== --- head/sys/kern/subr_sleepqueue.c Wed Feb 6 16:43:35 2013 (r246416) +++ head/sys/kern/subr_sleepqueue.c Wed Feb 6 17:06:51 2013 (r246417) @@ -352,8 +352,6 @@ sleepq_add(void *wchan, struct lock_obje if (flags & SLEEPQ_INTERRUPTIBLE) { td->td_flags |= TDF_SINTR; td->td_flags &= ~TDF_SLEEPABORT; - if (flags & SLEEPQ_STOP_ON_BDRY) - td->td_flags |= TDF_SBDRY; } thread_unlock(td); } @@ -600,7 +598,7 @@ sleepq_check_signals(void) /* We are no longer in an interruptible sleep. */ if (td->td_flags & TDF_SINTR) - td->td_flags &= ~(TDF_SINTR | TDF_SBDRY); + td->td_flags &= ~TDF_SINTR; if (td->td_flags & TDF_SLEEPABORT) { td->td_flags &= ~TDF_SLEEPABORT; @@ -747,7 +745,7 @@ sleepq_resume_thread(struct sleepqueue * td->td_wmesg = NULL; td->td_wchan = NULL; - td->td_flags &= ~(TDF_SINTR | TDF_SBDRY); + td->td_flags &= ~TDF_SINTR; CTR3(KTR_PROC, "sleepq_wakeup: thread %p (pid %ld, %s)", (void *)td, (long)td->td_proc->p_pid, td->td_name); Modified: head/sys/nfsclient/nfs_krpc.c ============================================================================== --- head/sys/nfsclient/nfs_krpc.c Wed Feb 6 16:43:35 2013 (r246416) +++ head/sys/nfsclient/nfs_krpc.c Wed Feb 6 17:06:51 2013 (r246417) @@ -699,7 +699,6 @@ int nfs_sig_set[] = { SIGTERM, SIGHUP, SIGKILL, - SIGSTOP, SIGQUIT }; @@ -720,7 +719,7 @@ nfs_sig_pending(sigset_t set) /* * The set/restore sigmask functions are used to (temporarily) overwrite - * the process p_sigmask during an RPC call (for example). These are also + * the thread td_sigmask during an RPC call (for example). These are also * used in other places in the NFS client that might tsleep(). */ void @@ -749,8 +748,10 @@ nfs_set_sigmask(struct thread *td, sigse SIGDELSET(newset, nfs_sig_set[i]); } mtx_unlock(&p->p_sigacts->ps_mtx); + sigdeferstop(td); + kern_sigprocmask(td, SIG_SETMASK, &newset, oldset, + SIGPROCMASK_PROC_LOCKED); PROC_UNLOCK(p); - kern_sigprocmask(td, SIG_SETMASK, &newset, oldset, 0); } void @@ -759,6 +760,7 @@ nfs_restore_sigmask(struct thread *td, s if (td == NULL) td = curthread; /* XXX */ kern_sigprocmask(td, SIG_SETMASK, set, NULL, 0); + sigallowstop(td); } /* Modified: head/sys/sys/signalvar.h ============================================================================== --- head/sys/sys/signalvar.h Wed Feb 6 16:43:35 2013 (r246416) +++ head/sys/sys/signalvar.h Wed Feb 6 17:06:51 2013 (r246417) @@ -328,6 +328,8 @@ extern struct mtx sigio_lock; #define SIGPROCMASK_PS_LOCKED 0x0004 int cursig(struct thread *td, int stop_allowed); +void sigdeferstop(struct thread *td); +void sigallowstop(struct thread *td); void execsigs(struct proc *p); void gsignal(int pgid, int sig, ksiginfo_t *ksi); void killproc(struct proc *p, char *why); From owner-svn-src-head@FreeBSD.ORG Wed Feb 6 17:32:24 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id B715D41A; Wed, 6 Feb 2013 17:32:24 +0000 (UTC) (envelope-from bright@mu.org) Received: from elvis.mu.org (elvis.mu.org [192.203.228.196]) by mx1.freebsd.org (Postfix) with ESMTP id A292BCE9; Wed, 6 Feb 2013 17:32:24 +0000 (UTC) Received: from Alfreds-MacBook-Pro-9.local (c-67-180-208-218.hsd1.ca.comcast.net [67.180.208.218]) by elvis.mu.org (Postfix) with ESMTPSA id 3F6FC1A3C1F; Wed, 6 Feb 2013 09:32:24 -0800 (PST) Message-ID: <511293A7.1050701@mu.org> Date: Wed, 06 Feb 2013 09:32:23 -0800 From: Alfred Perlstein User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7; rv:17.0) Gecko/20130107 Thunderbird/17.0.2 MIME-Version: 1.0 To: =?UTF-8?B?RGFnLUVybGluZyBTbcO4cmdyYXY=?= Subject: Re: svn commit: r246362 - head/games/fortune/datfiles References: <201302051439.r15EdcE7011203@svn.freebsd.org> <201302051145.40104.jhb@freebsd.org> <20130206021818.GB2899@eureka.lemis.com> <868v71h5kk.fsf@ds4.des.no> In-Reply-To: <868v71h5kk.fsf@ds4.des.no> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Cc: Greg 'groggy' Lehey , svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, John Baldwin X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Feb 2013 17:32:24 -0000 On 2/6/13 6:36 AM, Dag-Erling Smørgrav wrote: > Greg 'groggy' Lehey writes: >> The real issue I see is that, for whatever reason, the Limbaugh >> fortunes pop up far too frequently. It's as if the random number >> generation is failing. Comments? > Not sure how often is too often, but there were 35 of them, which is > approximately 1.5% of fortunes-o, so even with a fair random generator, > they'd show up quite often. > > DES As an aside, I'm not sure if the presence of them is meant to offend liberals or conservatives because regardless of your affiliation they are pretty hilarious. -Alfred From owner-svn-src-head@FreeBSD.ORG Wed Feb 6 17:43:06 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id C93E564E; Wed, 6 Feb 2013 17:43:06 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id AC28AD54; Wed, 6 Feb 2013 17:43:06 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r16Hh6GT001216; Wed, 6 Feb 2013 17:43:06 GMT (envelope-from hselasky@svn.freebsd.org) Received: (from hselasky@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r16Hh6nA001213; Wed, 6 Feb 2013 17:43:06 GMT (envelope-from hselasky@svn.freebsd.org) Message-Id: <201302061743.r16Hh6nA001213@svn.freebsd.org> From: Hans Petter Selasky Date: Wed, 6 Feb 2013 17:43:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r246421 - in head/sys/dev/sound: pcm usb X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Feb 2013 17:43:06 -0000 Author: hselasky Date: Wed Feb 6 17:43:05 2013 New Revision: 246421 URL: http://svnweb.freebsd.org/changeset/base/246421 Log: Add support for buttons on USB audio devices, like Volume Up and Volume Down. Reviewed by: mav @ MFC after: 1 week Modified: head/sys/dev/sound/pcm/mixer.c head/sys/dev/sound/pcm/mixer.h head/sys/dev/sound/usb/uaudio.c Modified: head/sys/dev/sound/pcm/mixer.c ============================================================================== --- head/sys/dev/sound/pcm/mixer.c Wed Feb 6 17:27:41 2013 (r246420) +++ head/sys/dev/sound/pcm/mixer.c Wed Feb 6 17:43:05 2013 (r246421) @@ -1492,3 +1492,30 @@ mixer_get_lock(struct snd_mixer *m) } return (m->lock); } + +int +mix_get_locked(struct snd_mixer *m, u_int dev, int *pleft, int *pright) +{ + int level; + + level = mixer_get(m, dev); + if (level < 0) { + *pright = *pleft = -1; + return (-1); + } + + *pleft = level & 0xFF; + *pright = (level >> 8) & 0xFF; + + return (0); +} + +int +mix_set_locked(struct snd_mixer *m, u_int dev, int left, int right) +{ + int level; + + level = (left & 0xFF) | ((right & 0xFF) << 8); + + return (mixer_set(m, dev, level)); +} Modified: head/sys/dev/sound/pcm/mixer.h ============================================================================== --- head/sys/dev/sound/pcm/mixer.h Wed Feb 6 17:27:41 2013 (r246420) +++ head/sys/dev/sound/pcm/mixer.h Wed Feb 6 17:43:05 2013 (r246421) @@ -45,6 +45,8 @@ void mixer_hwvol_step(device_t dev, int int mixer_busy(struct snd_mixer *m); +int mix_get_locked(struct snd_mixer *m, u_int dev, int *pleft, int *pright); +int mix_set_locked(struct snd_mixer *m, u_int dev, int left, int right); int mix_set(struct snd_mixer *m, u_int dev, u_int left, u_int right); int mix_get(struct snd_mixer *m, u_int dev); int mix_setrecsrc(struct snd_mixer *m, u_int32_t src); Modified: head/sys/dev/sound/usb/uaudio.c ============================================================================== --- head/sys/dev/sound/usb/uaudio.c Wed Feb 6 17:27:41 2013 (r246420) +++ head/sys/dev/sound/usb/uaudio.c Wed Feb 6 17:43:05 2013 (r246421) @@ -71,6 +71,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #define USB_DEBUG_VAR uaudio_debug @@ -277,16 +278,37 @@ struct uaudio_search_result { uint8_t is_input; }; +enum { + UAUDIO_HID_RX_TRANSFER, + UAUDIO_HID_N_TRANSFER, +}; + +struct uaudio_hid { + struct usb_xfer *xfer[UAUDIO_HID_N_TRANSFER]; + struct hid_location volume_up_loc; + struct hid_location volume_down_loc; + uint32_t flags; +#define UAUDIO_HID_VALID 0x0001 +#define UAUDIO_HID_HAS_ID 0x0002 +#define UAUDIO_HID_HAS_VOLUME_UP 0x0004 +#define UAUDIO_HID_HAS_VOLUME_DOWN 0x0008 + uint8_t iface_index; + uint8_t volume_up_id; + uint8_t volume_down_id; +}; + struct uaudio_softc { struct sbuf sc_sndstat; struct sndcard_func sc_sndcard_func; struct uaudio_chan sc_rec_chan; struct uaudio_chan sc_play_chan; struct umidi_chan sc_midi_chan; + struct uaudio_hid sc_hid; struct uaudio_search_result sc_mixer_clocks; struct uaudio_mixer_node sc_mixer_node; struct mtx *sc_mixer_lock; + struct snd_mixer *sc_mixer_dev; struct usb_device *sc_udev; struct usb_xfer *sc_mixer_xfer[1]; struct uaudio_mixer_node *sc_mixer_root; @@ -407,6 +429,7 @@ static usb_callback_t uaudio_chan_record static usb_callback_t uaudio_mixer_write_cfg_callback; static usb_callback_t umidi_bulk_read_callback; static usb_callback_t umidi_bulk_write_callback; +static usb_callback_t uaudio_hid_rx_callback; /* ==== USB mixer ==== */ @@ -500,6 +523,9 @@ static void umidi_close(struct usb_fifo static void umidi_init(device_t dev); static int umidi_probe(device_t dev); static int umidi_detach(device_t dev); +static int uaudio_hid_probe(struct uaudio_softc *sc, + struct usb_attach_arg *uaa); +static void uaudio_hid_detach(struct uaudio_softc *sc); #ifdef USB_DEBUG static void uaudio_chan_dump_ep_desc( @@ -624,6 +650,18 @@ static const struct usb_config }, }; +static const struct usb_config + uaudio_hid_config[UAUDIO_HID_N_TRANSFER] = { + [UAUDIO_HID_RX_TRANSFER] = { + .type = UE_INTERRUPT, + .endpoint = UE_ADDR_ANY, + .direction = UE_DIR_IN, + .bufsize = 0, /* use wMaxPacketSize */ + .flags = {.short_xfer_ok = 1,}, + .callback = &uaudio_hid_rx_callback, + }, +}; + static devclass_t uaudio_devclass; static device_method_t uaudio_methods[] = { @@ -896,7 +934,7 @@ uaudio_attach(device_t dev) } device_printf(dev, "MIDI sequencer.\n"); } else { - device_printf(dev, "No midi sequencer.\n"); + device_printf(dev, "No MIDI sequencer.\n"); } DPRINTF("doing child attach\n"); @@ -926,6 +964,12 @@ uaudio_attach(device_t dev) goto detach; } + if (uaudio_hid_probe(sc, uaa) == 0) { + device_printf(dev, "HID volume keys found.\n"); + } else { + device_printf(dev, "No HID volume keys found.\n"); + } + /* reload all mixer settings */ uaudio_mixer_reload_all(sc); @@ -1034,6 +1078,8 @@ uaudio_detach(device_t dev) if (sc->sc_rec_chan.valid) usbd_transfer_unsetup(sc->sc_rec_chan.xfer, UAUDIO_NCHANBUFS + 1); + uaudio_hid_detach(sc); + if (bus_generic_detach(dev) != 0) { DPRINTF("detach failed!\n"); } @@ -1213,6 +1259,18 @@ uaudio_chan_fill_info_sub(struct uaudio_ alt_index++; } + if ((!(sc->sc_hid.flags & UAUDIO_HID_VALID)) && + (id->bInterfaceClass == UICLASS_HID) && + (id->bInterfaceSubClass == 0) && + (id->bInterfaceProtocol == 0) && + (alt_index == 0) && + usbd_get_iface(udev, curidx) != NULL) { + DPRINTF("Found HID interface at %d\n", + curidx); + sc->sc_hid.flags |= UAUDIO_HID_VALID; + sc->sc_hid.iface_index = curidx; + } + uma_if_class = ((id->bInterfaceClass == UICLASS_AUDIO) || ((id->bInterfaceClass == UICLASS_VENDOR) && @@ -2490,6 +2548,9 @@ uaudio_mixer_reload_all(struct uaudio_so pmc->update[chan / 8] |= (1 << (chan % 8)); } usbd_transfer_start(sc->sc_mixer_xfer[0]); + + /* start HID volume keys, if any */ + usbd_transfer_start(sc->sc_hid.xfer[0]); mtx_unlock(sc->sc_mixer_lock); } @@ -4818,6 +4879,7 @@ uaudio_mixer_init_sub(struct uaudio_soft DPRINTF("\n"); sc->sc_mixer_lock = mixer_get_lock(m); + sc->sc_mixer_dev = m; if (usbd_transfer_setup(sc->sc_udev, &sc->sc_mixer_iface_index, sc->sc_mixer_xfer, uaudio_mixer_config, 1, sc, @@ -5452,6 +5514,162 @@ umidi_detach(device_t dev) return (0); } +static void +uaudio_hid_rx_callback(struct usb_xfer *xfer, usb_error_t error) +{ + struct uaudio_softc *sc = usbd_xfer_softc(xfer); + const uint8_t *buffer = usbd_xfer_get_frame_buffer(xfer, 0); + struct snd_mixer *m; + int v; + int v_l; + int v_r; + uint8_t id; + int actlen; + + usbd_xfer_status(xfer, &actlen, NULL, NULL, NULL); + + switch (USB_GET_STATE(xfer)) { + case USB_ST_TRANSFERRED: + DPRINTF("actlen=%d\n", actlen); + + if (actlen != 0 && + (sc->sc_hid.flags & UAUDIO_HID_HAS_ID)) { + id = *buffer; + buffer++; + actlen--; + } else { + id = 0; + } + + m = sc->sc_mixer_dev; + + if ((sc->sc_hid.flags & UAUDIO_HID_HAS_VOLUME_UP) && + (sc->sc_hid.volume_up_id == id) && + hid_get_data(buffer, actlen, + &sc->sc_hid.volume_up_loc)) { + + DPRINTF("Volume Up\n"); + + v = mix_get_locked(m, SOUND_MIXER_PCM, &v_l, &v_r); + if (v == 0) { + v = ((v_l + v_r) / 2) + 5; + if (v > 100) + v = 100; + mix_set_locked(m, SOUND_MIXER_PCM, v, v); + } + } + + if ((sc->sc_hid.flags & UAUDIO_HID_HAS_VOLUME_DOWN) && + (sc->sc_hid.volume_down_id == id) && + hid_get_data(buffer, actlen, + &sc->sc_hid.volume_down_loc)) { + + DPRINTF("Volume Down\n"); + + v = mix_get_locked(m, SOUND_MIXER_PCM, &v_l, &v_r); + if (v == 0) { + v = ((v_l + v_r) / 2) - 5; + if (v < 0) + v = 0; + mix_set_locked(m, SOUND_MIXER_PCM, v, v); + } + } + + case USB_ST_SETUP: +tr_setup: + /* check if we can put more data into the FIFO */ + usbd_xfer_set_frame_len(xfer, 0, usbd_xfer_max_len(xfer)); + usbd_transfer_submit(xfer); + break; + + default: /* Error */ + if (error != USB_ERR_CANCELLED) { + /* try clear stall first */ + usbd_xfer_set_stall(xfer); + goto tr_setup; + } + break; + } +} + +static int +uaudio_hid_probe(struct uaudio_softc *sc, + struct usb_attach_arg *uaa) +{ + void *d_ptr; + uint32_t flags; + uint16_t d_len; + uint8_t id; + int error; + + if (!(sc->sc_hid.flags & UAUDIO_HID_VALID)) + return (-1); + + if (sc->sc_mixer_lock == NULL) + return (-1); + + /* Get HID descriptor */ + error = usbd_req_get_hid_desc(uaa->device, NULL, &d_ptr, + &d_len, M_TEMP, sc->sc_hid.iface_index); + + if (error) { + DPRINTF("error reading report description\n"); + return (-1); + } + + /* check if there is an ID byte */ + hid_report_size(d_ptr, d_len, hid_input, &id); + + if (id != 0) + sc->sc_hid.flags |= UAUDIO_HID_HAS_ID; + + if (hid_locate(d_ptr, d_len, + HID_USAGE2(HUP_CONSUMER, 0xE9 /* Volume Increment */), + hid_input, 0, &sc->sc_hid.volume_up_loc, &flags, + &sc->sc_hid.volume_up_id)) { + if (flags & HIO_VARIABLE) + sc->sc_hid.flags |= UAUDIO_HID_HAS_VOLUME_UP; + DPRINTFN(1, "Found Volume Up key\n"); + } + + if (hid_locate(d_ptr, d_len, + HID_USAGE2(HUP_CONSUMER, 0xEA /* Volume Decrement */), + hid_input, 0, &sc->sc_hid.volume_down_loc, &flags, + &sc->sc_hid.volume_down_id)) { + if (flags & HIO_VARIABLE) + sc->sc_hid.flags |= UAUDIO_HID_HAS_VOLUME_DOWN; + DPRINTFN(1, "Found Volume Down key\n"); + } + + free(d_ptr, M_TEMP); + + if (!(sc->sc_hid.flags & (UAUDIO_HID_HAS_VOLUME_UP | + UAUDIO_HID_HAS_VOLUME_DOWN))) { + DPRINTFN(1, "Did not find any volume related keys\n"); + return (-1); + } + + /* prevent the uhid driver from attaching */ + usbd_set_parent_iface(uaa->device, sc->sc_hid.iface_index, + sc->sc_mixer_iface_index); + + /* allocate USB transfers */ + error = usbd_transfer_setup(uaa->device, &sc->sc_hid.iface_index, + sc->sc_hid.xfer, uaudio_hid_config, UAUDIO_HID_N_TRANSFER, + sc, sc->sc_mixer_lock); + if (error) { + DPRINTF("error=%s\n", usbd_errstr(error)); + return (-1); + } + return (0); +} + +static void +uaudio_hid_detach(struct uaudio_softc *sc) +{ + usbd_transfer_unsetup(sc->sc_hid.xfer, UAUDIO_HID_N_TRANSFER); +} + DRIVER_MODULE(uaudio, uhub, uaudio_driver, uaudio_devclass, NULL, 0); MODULE_DEPEND(uaudio, usb, 1, 1, 1); MODULE_DEPEND(uaudio, sound, SOUND_MINVER, SOUND_PREFVER, SOUND_MAXVER); From owner-svn-src-head@FreeBSD.ORG Wed Feb 6 21:05:03 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 6AA6FD52; Wed, 6 Feb 2013 21:05:03 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from bigwig.baldwin.cx (bigknife-pt.tunnel.tserv9.chi1.ipv6.he.net [IPv6:2001:470:1f10:75::2]) by mx1.freebsd.org (Postfix) with ESMTP id 415F8A11; Wed, 6 Feb 2013 21:05:03 +0000 (UTC) Received: from pakbsde14.localnet (unknown [38.105.238.108]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id 03C01B915; Wed, 6 Feb 2013 16:05:02 -0500 (EST) From: John Baldwin To: src-committers@freebsd.org Subject: Re: svn commit: r246417 - in head/sys: fs/nfs kern nfsclient sys Date: Wed, 6 Feb 2013 12:11:13 -0500 User-Agent: KMail/1.13.5 (FreeBSD/8.2-CBSD-20110714-p22; KDE/4.5.5; amd64; ; ) References: <201302061706.r16H6qMo088889@svn.freebsd.org> In-Reply-To: <201302061706.r16H6qMo088889@svn.freebsd.org> MIME-Version: 1.0 Content-Type: Text/Plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <201302061211.14184.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.7 (bigwig.baldwin.cx); Wed, 06 Feb 2013 16:05:02 -0500 (EST) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Feb 2013 21:05:03 -0000 On Wednesday, February 06, 2013 12:06:52 pm John Baldwin wrote: > Author: jhb > Date: Wed Feb 6 17:06:51 2013 > New Revision: 246417 > URL: http://svnweb.freebsd.org/changeset/base/246417 > > Log: > Rework the handling of stop signals in the NFS client. The changes in > 195702, 195703, and 195821 prevented a thread from suspending while holding > locks inside of NFS by forcing the thread to fail sleeps with EINTR or > ERESTART but defer the thread suspension to the user boundary. However, > this had the effect that stopping a process during an NFS request could > abort the request and trigger EINTR errors that were visible to userland > processes (previously the thread would have suspended and completed the > request once it was resumed). > > This change instead effectively masks stop signals while in the NFS client. > It uses the existing TDF_SBDRY flag to effect this since SIGSTOP cannot > be masked directly. Also, instead of setting PBDRY on individual sleeps, > the NFS client now sets the TDF_SBDRY flag around each NFS request and > stop signals are masked for all sleeps during that region (the previous > change missed sleeps in lockmgr locks). The end result is that stop > signals sent to threads performing an NFS request are completely > ignored until after the NFS request has finished processing and the > thread prepares to return to userland. This restores the behavior of > stop signals being transparent to userland processes while still > preventing threads from suspending while holding NFS locks. > > Reviewed by: kib > MFC after: 1 month I have a test case (included below). You give it a path to a file on an interruptible NFS mount as the sole argument. In the broken case you will see lots of reads fail with EINTR. #include #include #include #include #include #include #include #include #include static void usage(void) { fprintf(stderr, "Usage: nfsintr \n"); exit(1); } static volatile sig_atomic_t info; static void child_info_handler(int sig) { info = 1; } /* * Check to see if STOP/CONT signals affect I/O. One process * continually opens a file with O_DIRECT and reads it while another * process keeps pausing the first with SIGSTOP. */ static void child(const char *path) { char buf[128 * 1024]; struct stat sb; ssize_t nread; off_t off; int fd, shorts; if (signal(SIGINFO, child_info_handler) == SIG_ERR) err(1, "signal(SIGINFO) (child)"); shorts = 0; while (getppid() != 1) { fd = open(path, O_RDONLY | O_DIRECT); while (fd < 0) { if (errno == EINTR) warn("open(%s)", path); else err(1, "open(%s)", path); } while (fstat(fd, &sb) < 0) { if (errno == EINTR) warn("fstat"); else err(1, "fstat"); } for (;;) { if (info) { if (shorts > 0) printf("nfsintr: %d short reads\n", shorts); shorts = 0; info = 0; } nread = read(fd, buf, sizeof(buf)); if (nread < 0) { if (errno == EINTR) warn("read"); else err(1, "read"); continue; } if (nread == 0) break; if (nread == sizeof(buf)) continue; if (nread < (ssize_t)sizeof(buf)) { off = lseek(fd, SEEK_CUR, 0); if (off < 0) err(1, "lseek"); if (off == sb.st_size) break; /* * These happen a lot. warnx("short read: %zd", nread); */ shorts++; continue; } } close(fd); } } static void parent(pid_t pid) { for (;;) { if (kill(pid, SIGSTOP) < 0) { if (errno == ESRCH) return; err(1, "kill(SIGSTOP)"); } usleep(500); if (kill(pid, SIGCONT) < 0) { if (errno == ESRCH) return; err(1, "kill(SIGCONT)"); } usleep(500); } } int main(int ac, char **av) { pid_t pid; if (ac != 2) usage(); if (access(av[1], R_OK) < 0) err(1, "Unable to access file %s", av[1]); if (signal(SIGCHLD, SIG_IGN) == SIG_ERR) err(1, "signal(SIGCHLD)"); pid = fork(); if (pid < 0) err(1, "fork"); if (pid == 0) child(av[1]); else parent(pid); return (0); } -- John Baldwin From owner-svn-src-head@FreeBSD.ORG Thu Feb 7 00:24:24 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 22E65C20; Thu, 7 Feb 2013 00:24:24 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 0000B760; Thu, 7 Feb 2013 00:24:23 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r170ONOA025909; Thu, 7 Feb 2013 00:24:23 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r170ONES025908; Thu, 7 Feb 2013 00:24:23 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <201302070024.r170ONES025908@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Thu, 7 Feb 2013 00:24:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r246446 - head/sys/security/audit X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Feb 2013 00:24:24 -0000 Author: pjd Date: Thu Feb 7 00:24:23 2013 New Revision: 246446 URL: http://svnweb.freebsd.org/changeset/base/246446 Log: Add AUDIT_ARG_SOCKADDR() macro so we can start using the audit_arg_sockaddr() function, which is currently unused. Sponsored by: The FreeBSD Foundation Modified: head/sys/security/audit/audit.h Modified: head/sys/security/audit/audit.h ============================================================================== --- head/sys/security/audit/audit.h Wed Feb 6 23:48:04 2013 (r246445) +++ head/sys/security/audit/audit.h Thu Feb 7 00:24:23 2013 (r246446) @@ -261,6 +261,11 @@ void audit_thread_free(struct thread *t audit_arg_socket((sodomain), (sotype), (soprotocol)); \ } while (0) +#define AUDIT_ARG_SOCKADDR(td, sa) do { \ + if (AUDITING_TD(curthread)) \ + audit_arg_sockaddr((td), (sa)); \ +} while (0) + #define AUDIT_ARG_SUID(suid) do { \ if (AUDITING_TD(curthread)) \ audit_arg_suid((suid)); \ @@ -353,6 +358,7 @@ void audit_thread_free(struct thread *t #define AUDIT_ARG_SIGNUM(signum) #define AUDIT_ARG_SGID(sgid) #define AUDIT_ARG_SOCKET(sodomain, sotype, soprotocol) +#define AUDIT_ARG_SOCKADDR(td, sa) #define AUDIT_ARG_SUID(suid) #define AUDIT_ARG_TEXT(text) #define AUDIT_ARG_UID(uid) From owner-svn-src-head@FreeBSD.ORG Thu Feb 7 00:27:12 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 2A03BDBD; Thu, 7 Feb 2013 00:27:12 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 1C6C7786; Thu, 7 Feb 2013 00:27:12 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r170RBAJ026363; Thu, 7 Feb 2013 00:27:12 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r170RBOS026362; Thu, 7 Feb 2013 00:27:11 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <201302070027.r170RBOS026362@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Thu, 7 Feb 2013 00:27:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r246447 - head/sys/kern X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Feb 2013 00:27:12 -0000 Author: pjd Date: Thu Feb 7 00:27:11 2013 New Revision: 246447 URL: http://svnweb.freebsd.org/changeset/base/246447 Log: Minor style tweaks. Modified: head/sys/kern/uipc_syscalls.c Modified: head/sys/kern/uipc_syscalls.c ============================================================================== --- head/sys/kern/uipc_syscalls.c Thu Feb 7 00:24:23 2013 (r246446) +++ head/sys/kern/uipc_syscalls.c Thu Feb 7 00:27:11 2013 (r246447) @@ -956,11 +956,11 @@ kern_recvit(td, s, mp, fromseg, controlp int i; ssize_t len; int error; - struct mbuf *m, *control = 0; + struct mbuf *m, *control = NULL; caddr_t ctlbuf; struct file *fp; struct socket *so; - struct sockaddr *fromsa = 0; + struct sockaddr *fromsa = NULL; #ifdef KTRACE struct uio *ktruio = NULL; #endif @@ -1001,8 +1001,8 @@ kern_recvit(td, s, mp, fromseg, controlp ktruio = cloneuio(&auio); #endif len = auio.uio_resid; - error = soreceive(so, &fromsa, &auio, (struct mbuf **)0, - (mp->msg_control || controlp) ? &control : (struct mbuf **)0, + error = soreceive(so, &fromsa, &auio, NULL, + (mp->msg_control || controlp) ? &control : NULL, &mp->msg_flags); if (error) { if (auio.uio_resid != len && (error == ERESTART || @@ -1020,7 +1020,7 @@ kern_recvit(td, s, mp, fromseg, controlp td->td_retval[0] = len - auio.uio_resid; if (mp->msg_name) { len = mp->msg_namelen; - if (len <= 0 || fromsa == 0) + if (len <= 0 || fromsa == NULL) len = 0; else { /* save sa_len before it is destroyed by MSG_COMPAT */ @@ -1095,7 +1095,7 @@ out: if (fromsa) free(fromsa, M_SONAME); - if (error == 0 && controlp != NULL) + if (error == 0 && controlp != NULL) *controlp = control; else if (control) m_freem(control); @@ -1716,7 +1716,7 @@ getsockaddr(namp, uaddr, len) struct sendfile_sync { struct mtx mtx; struct cv cv; - unsigned count; + unsigned count; }; /* @@ -2233,7 +2233,7 @@ retry_space: } /* Quit outer loop on error or when we're done. */ - if (done) + if (done) break; if (error) goto done; @@ -2333,7 +2333,7 @@ sys_sctp_peeloff(td, uap) CURVNET_SET(head->so_vnet); so = sonewconn(head, SS_ISCONNECTED); - if (so == NULL) + if (so == NULL) goto noconnection; /* * Before changing the flags on the socket, we have to bump the @@ -2387,12 +2387,12 @@ int sys_sctp_generic_sendmsg (td, uap) struct thread *td; struct sctp_generic_sendmsg_args /* { - int sd, - caddr_t msg, - int mlen, - caddr_t to, - __socklen_t tolen, - struct sctp_sndrcvinfo *sinfo, + int sd, + caddr_t msg, + int mlen, + caddr_t to, + __socklen_t tolen, + struct sctp_sndrcvinfo *sinfo, int flags } */ *uap; { @@ -2498,12 +2498,12 @@ int sys_sctp_generic_sendmsg_iov(td, uap) struct thread *td; struct sctp_generic_sendmsg_iov_args /* { - int sd, - struct iovec *iov, - int iovlen, - caddr_t to, - __socklen_t tolen, - struct sctp_sndrcvinfo *sinfo, + int sd, + struct iovec *iov, + int iovlen, + caddr_t to, + __socklen_t tolen, + struct sctp_sndrcvinfo *sinfo, int flags } */ *uap; { @@ -2625,12 +2625,12 @@ int sys_sctp_generic_recvmsg(td, uap) struct thread *td; struct sctp_generic_recvmsg_args /* { - int sd, - struct iovec *iov, + int sd, + struct iovec *iov, int iovlen, - struct sockaddr *from, + struct sockaddr *from, __socklen_t *fromlenaddr, - struct sctp_sndrcvinfo *sinfo, + struct sctp_sndrcvinfo *sinfo, int *msg_flags } */ *uap; { @@ -2696,7 +2696,7 @@ sys_sctp_generic_recvmsg(td, uap) } auio.uio_iov = iov; auio.uio_iovcnt = uap->iovlen; - auio.uio_segflg = UIO_USERSPACE; + auio.uio_segflg = UIO_USERSPACE; auio.uio_rw = UIO_READ; auio.uio_td = td; auio.uio_offset = 0; /* XXX */ @@ -2767,7 +2767,7 @@ sys_sctp_generic_recvmsg(td, uap) out: free(iov, M_IOV); out1: - if (fp) + if (fp) fdrop(fp, td); return (error); From owner-svn-src-head@FreeBSD.ORG Thu Feb 7 00:36:01 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 7466A74; Thu, 7 Feb 2013 00:36:01 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 62F997D1; Thu, 7 Feb 2013 00:36:01 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r170a14W029159; Thu, 7 Feb 2013 00:36:01 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r170a1dY029157; Thu, 7 Feb 2013 00:36:01 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <201302070036.r170a1dY029157@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Thu, 7 Feb 2013 00:36:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r246448 - head/sys/kern X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Feb 2013 00:36:01 -0000 Author: pjd Date: Thu Feb 7 00:36:00 2013 New Revision: 246448 URL: http://svnweb.freebsd.org/changeset/base/246448 Log: Audit sockaddr argument for bind(2), connect(2), accept(2), sendto(2) and recvfrom(2) syscalls. Sponsored by: The FreeBSD Foundation Modified: head/sys/kern/uipc_syscalls.c Modified: head/sys/kern/uipc_syscalls.c ============================================================================== --- head/sys/kern/uipc_syscalls.c Thu Feb 7 00:27:11 2013 (r246447) +++ head/sys/kern/uipc_syscalls.c Thu Feb 7 00:36:00 2013 (r246448) @@ -238,6 +238,7 @@ kern_bind(td, fd, sa) int error; AUDIT_ARG_FD(fd); + AUDIT_ARG_SOCKADDR(td, sa); error = getsock_cap(td->td_proc->p_fd, fd, CAP_BIND, &fp, NULL); if (error) return (error); @@ -452,6 +453,7 @@ kern_accept(struct thread *td, int s, st *namelen = 0; goto done; } + AUDIT_ARG_SOCKADDR(td, sa); if (name) { /* check sa_len before it is destroyed */ if (*namelen > sa->sa_len) @@ -547,6 +549,7 @@ kern_connect(td, fd, sa) int interrupted = 0; AUDIT_ARG_FD(fd); + AUDIT_ARG_SOCKADDR(td, sa); error = getsock_cap(td->td_proc->p_fd, fd, CAP_CONNECT, &fp, NULL); if (error) return (error); @@ -763,8 +766,10 @@ kern_sendit(td, s, mp, flags, control, s AUDIT_ARG_FD(s); rights = CAP_WRITE; - if (mp->msg_name != NULL) + if (mp->msg_name != NULL) { + AUDIT_ARG_SOCKADDR(td, mp->msg_name); rights |= CAP_CONNECT; + } error = getsock_cap(td->td_proc->p_fd, s, rights, &fp, NULL); if (error) return (error); @@ -1009,6 +1014,8 @@ kern_recvit(td, s, mp, fromseg, controlp error == EINTR || error == EWOULDBLOCK)) error = 0; } + if (fromsa != NULL) + AUDIT_ARG_SOCKADDR(td, fromsa); #ifdef KTRACE if (ktruio != NULL) { ktruio->uio_resid = len - auio.uio_resid; From owner-svn-src-head@FreeBSD.ORG Thu Feb 7 02:15:26 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id B72CD16D; Thu, 7 Feb 2013 02:15:26 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 91A31AEC; Thu, 7 Feb 2013 02:15:26 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r172FQoD059173; Thu, 7 Feb 2013 02:15:26 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r172FPcw059169; Thu, 7 Feb 2013 02:15:25 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201302070215.r172FPcw059169@svn.freebsd.org> From: Adrian Chadd Date: Thu, 7 Feb 2013 02:15:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r246450 - head/sys/dev/ath X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Feb 2013 02:15:26 -0000 Author: adrian Date: Thu Feb 7 02:15:25 2013 New Revision: 246450 URL: http://svnweb.freebsd.org/changeset/base/246450 Log: Methodize the process of adding the software TX queue to the taskqueue. Move it (for now) to the TX taskqueue. Modified: head/sys/dev/ath/if_ath.c head/sys/dev/ath/if_ath_misc.h head/sys/dev/ath/if_ath_tx.c head/sys/dev/ath/if_ath_tx_edma.c Modified: head/sys/dev/ath/if_ath.c ============================================================================== --- head/sys/dev/ath/if_ath.c Thu Feb 7 00:48:42 2013 (r246449) +++ head/sys/dev/ath/if_ath.c Thu Feb 7 02:15:25 2013 (r246450) @@ -4230,9 +4230,9 @@ ath_tx_processq(struct ath_softc *sc, st ieee80211_ff_flush(ic, txq->axq_ac); #endif - /* Kick the TXQ scheduler */ + /* Kick the software TXQ scheduler */ if (dosched) { - taskqueue_enqueue(sc->sc_tx_tq, &sc->sc_txqtask); + ath_tx_swq_kick(sc); } ATH_KTR(sc, ATH_KTR_TXCOMP, 1, Modified: head/sys/dev/ath/if_ath_misc.h ============================================================================== --- head/sys/dev/ath/if_ath_misc.h Thu Feb 7 00:48:42 2013 (r246449) +++ head/sys/dev/ath/if_ath_misc.h Thu Feb 7 02:15:25 2013 (r246450) @@ -120,12 +120,24 @@ extern void ath_tx_update_tim(struct ath extern void ath_start(struct ifnet *ifp); extern void ath_start_task(void *arg, int npending); +/* + * Kick the frame TX task. + */ static inline void ath_tx_kick(struct ath_softc *sc) { - /* XXX eventually try sc_tx_tq? */ taskqueue_enqueue(sc->sc_tx_tq, &sc->sc_txpkttask); } +/* + * Kick the software TX queue task. + */ +static inline void +ath_tx_swq_kick(struct ath_softc *sc) +{ + + taskqueue_enqueue(sc->sc_tx_tq, &sc->sc_txqtask); +} + #endif Modified: head/sys/dev/ath/if_ath_tx.c ============================================================================== --- head/sys/dev/ath/if_ath_tx.c Thu Feb 7 00:48:42 2013 (r246449) +++ head/sys/dev/ath/if_ath_tx.c Thu Feb 7 02:15:25 2013 (r246450) @@ -2999,9 +2999,11 @@ ath_tx_tid_resume(struct ath_softc *sc, } ath_tx_tid_sched(sc, tid); - /* Punt some frames to the hardware if needed */ - //ath_txq_sched(sc, sc->sc_ac2q[tid->ac]); - taskqueue_enqueue(sc->sc_tx_tq, &sc->sc_txqtask); + + /* + * Queue the software TX scheduler. + */ + ath_tx_swq_kick(sc); } /* Modified: head/sys/dev/ath/if_ath_tx_edma.c ============================================================================== --- head/sys/dev/ath/if_ath_tx_edma.c Thu Feb 7 00:48:42 2013 (r246449) +++ head/sys/dev/ath/if_ath_tx_edma.c Thu Feb 7 02:15:25 2013 (r246450) @@ -655,7 +655,7 @@ ath_edma_tx_processq(struct ath_softc *s * the txq task for _one_ TXQ. This should be fixed. */ if (dosched) - taskqueue_enqueue(sc->sc_tx_tq, &sc->sc_txqtask); + ath_tx_swq_kick(sc); } static void From owner-svn-src-head@FreeBSD.ORG Thu Feb 7 06:48:48 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 49A38DAB; Thu, 7 Feb 2013 06:48:48 +0000 (UTC) (envelope-from neel@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 24C3936C; Thu, 7 Feb 2013 06:48:48 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r176mm93040111; Thu, 7 Feb 2013 06:48:48 GMT (envelope-from neel@svn.freebsd.org) Received: (from neel@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r176mmKS040110; Thu, 7 Feb 2013 06:48:48 GMT (envelope-from neel@svn.freebsd.org) Message-Id: <201302070648.r176mmKS040110@svn.freebsd.org> From: Neel Natu Date: Thu, 7 Feb 2013 06:48:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r246452 - head/sys/kern X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Feb 2013 06:48:48 -0000 Author: neel Date: Thu Feb 7 06:48:47 2013 New Revision: 246452 URL: http://svnweb.freebsd.org/changeset/base/246452 Log: If an interrupt event's assign_cpu method fails, then restore the original cpuset mask for the associated interrupt thread. The text used above is verbatim from r195249 and the code should now be in line with the intent of that commit. Modified: head/sys/kern/kern_intr.c Modified: head/sys/kern/kern_intr.c ============================================================================== --- head/sys/kern/kern_intr.c Thu Feb 7 04:49:28 2013 (r246451) +++ head/sys/kern/kern_intr.c Thu Feb 7 06:48:47 2013 (r246452) @@ -336,7 +336,7 @@ intr_event_bind(struct intr_event *ie, u if (ie->ie_cpu == NOCPU) CPU_COPY(cpuset_root, &mask); else - CPU_SET(cpu, &mask); + CPU_SET(ie->ie_cpu, &mask); id = ie->ie_thread->it_thread->td_tid; mtx_unlock(&ie->ie_lock); (void)cpuset_setthread(id, &mask); From owner-svn-src-head@FreeBSD.ORG Thu Feb 7 07:50:18 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 17EE35AB; Thu, 7 Feb 2013 07:50:18 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 0A577723; Thu, 7 Feb 2013 07:50:18 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r177oH1l058538; Thu, 7 Feb 2013 07:50:17 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r177oHiC058531; Thu, 7 Feb 2013 07:50:17 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201302070750.r177oHiC058531@svn.freebsd.org> From: Adrian Chadd Date: Thu, 7 Feb 2013 07:50:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r246453 - head/sys/dev/ath X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Feb 2013 07:50:18 -0000 Author: adrian Date: Thu Feb 7 07:50:16 2013 New Revision: 246453 URL: http://svnweb.freebsd.org/changeset/base/246453 Log: Create a new TX lock specifically for queuing frames. This now separates out the act of queuing frames from the act of running TX and TX completion. Modified: head/sys/dev/ath/if_ath.c head/sys/dev/ath/if_ath_ahb.c head/sys/dev/ath/if_ath_pci.c head/sys/dev/ath/if_athvar.h Modified: head/sys/dev/ath/if_ath.c ============================================================================== --- head/sys/dev/ath/if_ath.c Thu Feb 7 06:48:47 2013 (r246452) +++ head/sys/dev/ath/if_ath.c Thu Feb 7 07:50:16 2013 (r246453) @@ -2687,7 +2687,7 @@ ath_txq_qadd(struct ifnet *ifp, struct m struct mbuf *m; /* XXX recursive TX completion -> TX? */ - ATH_TX_UNLOCK_ASSERT(sc); + ATH_TX_IC_UNLOCK_ASSERT(sc); /* * We grab the node pointer, but we don't deref @@ -2749,7 +2749,7 @@ ath_txq_qadd(struct ifnet *ifp, struct m * into the driver. */ - ATH_TX_LOCK(sc); + ATH_TX_IC_LOCK(sc); /* * Throw the single frame onto the queue. @@ -2797,7 +2797,7 @@ ath_txq_qadd(struct ifnet *ifp, struct m m = m->m_nextpkt; } - ATH_TX_UNLOCK(sc); + ATH_TX_IC_UNLOCK(sc); return (0); bad: @@ -2825,13 +2825,13 @@ ath_txq_qflush(struct ifnet *ifp) TAILQ_INIT(&txlist); /* Grab lock */ - ATH_TX_LOCK(sc); + ATH_TX_IC_LOCK(sc); /* Copy everything out of sc_txbuf_list into txlist */ TAILQ_CONCAT(&txlist, &sc->sc_txbuf_list, bf_list); /* Unlock */ - ATH_TX_UNLOCK(sc); + ATH_TX_IC_UNLOCK(sc); /* Now, walk the list, freeing things */ while ((bf = TAILQ_FIRST(&txlist)) != NULL) { @@ -2879,16 +2879,9 @@ ath_txq_qrun(struct ifnet *ifp) */ /* Copy everything out of sc_txbuf_list into txlist */ - ATH_TX_LOCK(sc); + ATH_TX_IC_LOCK(sc); TAILQ_CONCAT(&txlist, &sc->sc_txbuf_list, bf_list); - ATH_TX_UNLOCK(sc); - - /* - * For now, the ath_tx_start() code sits behind the same lock; - * worry about serialising this in a taskqueue later. - */ - - ATH_TX_LOCK(sc); + ATH_TX_IC_UNLOCK(sc); /* * Attempt to transmit each frame. @@ -2899,6 +2892,7 @@ ath_txq_qrun(struct ifnet *ifp) * It would be nice to chain together TX fragments in this * way so they can be aborted together. */ + ATH_TX_LOCK(sc); TAILQ_FOREACH_SAFE(bf, &txlist, bf_list, bf_next) { /* * Clear, because we're going to reuse this Modified: head/sys/dev/ath/if_ath_ahb.c ============================================================================== --- head/sys/dev/ath/if_ath_ahb.c Thu Feb 7 06:48:47 2013 (r246452) +++ head/sys/dev/ath/if_ath_ahb.c Thu Feb 7 07:50:16 2013 (r246453) @@ -195,6 +195,7 @@ ath_ahb_attach(device_t dev) ATH_PCU_LOCK_INIT(sc); ATH_RX_LOCK_INIT(sc); ATH_TX_LOCK_INIT(sc); + ATH_TX_IC_LOCK_INIT(sc); ATH_TXSTATUS_LOCK_INIT(sc); error = ath_attach(AR9130_DEVID, sc); @@ -204,6 +205,7 @@ ath_ahb_attach(device_t dev) ATH_TXSTATUS_LOCK_DESTROY(sc); ATH_RX_LOCK_DESTROY(sc); ATH_TX_LOCK_DESTROY(sc); + ATH_TX_IC_LOCK_DESTROY(sc); ATH_PCU_LOCK_DESTROY(sc); ATH_LOCK_DESTROY(sc); bus_dma_tag_destroy(sc->sc_dmat); @@ -247,6 +249,7 @@ ath_ahb_detach(device_t dev) ATH_TXSTATUS_LOCK_DESTROY(sc); ATH_RX_LOCK_DESTROY(sc); ATH_TX_LOCK_DESTROY(sc); + ATH_TX_IC_LOCK_DESTROY(sc); ATH_PCU_LOCK_DESTROY(sc); ATH_LOCK_DESTROY(sc); Modified: head/sys/dev/ath/if_ath_pci.c ============================================================================== --- head/sys/dev/ath/if_ath_pci.c Thu Feb 7 06:48:47 2013 (r246452) +++ head/sys/dev/ath/if_ath_pci.c Thu Feb 7 07:50:16 2013 (r246453) @@ -251,6 +251,7 @@ ath_pci_attach(device_t dev) ATH_PCU_LOCK_INIT(sc); ATH_RX_LOCK_INIT(sc); ATH_TX_LOCK_INIT(sc); + ATH_TX_IC_LOCK_INIT(sc); ATH_TXSTATUS_LOCK_INIT(sc); error = ath_attach(pci_get_device(dev), sc); @@ -260,6 +261,7 @@ ath_pci_attach(device_t dev) ATH_TXSTATUS_LOCK_DESTROY(sc); ATH_PCU_LOCK_DESTROY(sc); ATH_RX_LOCK_DESTROY(sc); + ATH_TX_IC_LOCK_DESTROY(sc); ATH_TX_LOCK_DESTROY(sc); ATH_LOCK_DESTROY(sc); bus_dma_tag_destroy(sc->sc_dmat); @@ -302,6 +304,7 @@ ath_pci_detach(device_t dev) ATH_TXSTATUS_LOCK_DESTROY(sc); ATH_PCU_LOCK_DESTROY(sc); ATH_RX_LOCK_DESTROY(sc); + ATH_TX_IC_LOCK_DESTROY(sc); ATH_TX_LOCK_DESTROY(sc); ATH_LOCK_DESTROY(sc); Modified: head/sys/dev/ath/if_athvar.h ============================================================================== --- head/sys/dev/ath/if_athvar.h Thu Feb 7 06:48:47 2013 (r246452) +++ head/sys/dev/ath/if_athvar.h Thu Feb 7 07:50:16 2013 (r246453) @@ -520,8 +520,10 @@ struct ath_softc { char sc_pcu_mtx_name[32]; struct mtx sc_rx_mtx; /* RX access mutex */ char sc_rx_mtx_name[32]; - struct mtx sc_tx_mtx; /* TX access mutex */ + struct mtx sc_tx_mtx; /* TX handling/comp mutex */ char sc_tx_mtx_name[32]; + struct mtx sc_tx_ic_mtx; /* TX queue mutex */ + char sc_tx_ic_mtx_name[32]; struct taskqueue *sc_tq; /* private task queue */ struct taskqueue *sc_tx_tq; /* private TX task queue */ struct ath_hal *sc_ah; /* Atheros HAL */ @@ -795,10 +797,8 @@ struct ath_softc { #define ATH_UNLOCK_ASSERT(_sc) mtx_assert(&(_sc)->sc_mtx, MA_NOTOWNED) /* - * The TX lock is non-reentrant and serialises the TX send operations. - * (ath_start(), ath_raw_xmit().) It doesn't yet serialise the TX - * completion operations; thus it can't be used (yet!) to protect - * hardware / software TXQ operations. + * The TX lock is non-reentrant and serialises the TX frame send + * and completion operations. */ #define ATH_TX_LOCK_INIT(_sc) do {\ snprintf((_sc)->sc_tx_mtx_name, \ @@ -817,6 +817,26 @@ struct ath_softc { MA_NOTOWNED) /* + * The IC TX lock is non-reentrant and serialises packet queuing from + * the upper layers. + */ +#define ATH_TX_IC_LOCK_INIT(_sc) do {\ + snprintf((_sc)->sc_tx_ic_mtx_name, \ + sizeof((_sc)->sc_tx_ic_mtx_name), \ + "%s IC TX lock", \ + device_get_nameunit((_sc)->sc_dev)); \ + mtx_init(&(_sc)->sc_tx_ic_mtx, (_sc)->sc_tx_ic_mtx_name, \ + NULL, MTX_DEF); \ + } while (0) +#define ATH_TX_IC_LOCK_DESTROY(_sc) mtx_destroy(&(_sc)->sc_tx_ic_mtx) +#define ATH_TX_IC_LOCK(_sc) mtx_lock(&(_sc)->sc_tx_ic_mtx) +#define ATH_TX_IC_UNLOCK(_sc) mtx_unlock(&(_sc)->sc_tx_ic_mtx) +#define ATH_TX_IC_LOCK_ASSERT(_sc) mtx_assert(&(_sc)->sc_tx_ic_mtx, \ + MA_OWNED) +#define ATH_TX_IC_UNLOCK_ASSERT(_sc) mtx_assert(&(_sc)->sc_tx_ic_mtx, \ + MA_NOTOWNED) + +/* * The PCU lock is non-recursive and should be treated as a spinlock. * Although currently the interrupt code is run in netisr context and * doesn't require this, this may change in the future. From owner-svn-src-head@FreeBSD.ORG Thu Feb 7 08:20:04 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id C5F95C88; Thu, 7 Feb 2013 08:20:04 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id B7789840; Thu, 7 Feb 2013 08:20:04 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r178K4Fw067709; Thu, 7 Feb 2013 08:20:04 GMT (envelope-from hselasky@svn.freebsd.org) Received: (from hselasky@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r178K4P0067706; Thu, 7 Feb 2013 08:20:04 GMT (envelope-from hselasky@svn.freebsd.org) Message-Id: <201302070820.r178K4P0067706@svn.freebsd.org> From: Hans Petter Selasky Date: Thu, 7 Feb 2013 08:20:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r246454 - in head/sys/dev/sound: pcm usb X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Feb 2013 08:20:04 -0000 Author: hselasky Date: Thu Feb 7 08:20:03 2013 New Revision: 246454 URL: http://svnweb.freebsd.org/changeset/base/246454 Log: Add support for mute buttons on USB audio devices and use the hwvol interface to adjust the mixer settings. MFC after: 1 week Modified: head/sys/dev/sound/pcm/mixer.c head/sys/dev/sound/pcm/mixer.h head/sys/dev/sound/usb/uaudio.c Modified: head/sys/dev/sound/pcm/mixer.c ============================================================================== --- head/sys/dev/sound/pcm/mixer.c Thu Feb 7 07:50:16 2013 (r246453) +++ head/sys/dev/sound/pcm/mixer.c Thu Feb 7 08:20:03 2013 (r246454) @@ -893,14 +893,8 @@ mixer_hwvol_init(device_t dev) } void -mixer_hwvol_mute(device_t dev) +mixer_hwvol_mute_locked(struct snd_mixer *m) { - struct snd_mixer *m; - struct cdev *pdev; - - pdev = mixer_get_devt(dev); - m = pdev->si_drv1; - snd_mtxlock(m->lock); if (m->hwvol_muted) { m->hwvol_muted = 0; mixer_set(m, m->hwvol_mixer, m->hwvol_mute_level); @@ -909,19 +903,26 @@ mixer_hwvol_mute(device_t dev) m->hwvol_mute_level = mixer_get(m, m->hwvol_mixer); mixer_set(m, m->hwvol_mixer, 0); } - snd_mtxunlock(m->lock); } void -mixer_hwvol_step(device_t dev, int left_step, int right_step) +mixer_hwvol_mute(device_t dev) { struct snd_mixer *m; - int level, left, right; struct cdev *pdev; pdev = mixer_get_devt(dev); m = pdev->si_drv1; snd_mtxlock(m->lock); + mixer_hwvol_mute_locked(m); + snd_mtxunlock(m->lock); +} + +void +mixer_hwvol_step_locked(struct snd_mixer *m, int left_step, int right_step) +{ + int level, left, right; + if (m->hwvol_muted) { m->hwvol_muted = 0; level = m->hwvol_mute_level; @@ -929,15 +930,31 @@ mixer_hwvol_step(device_t dev, int left_ level = mixer_get(m, m->hwvol_mixer); if (level != -1) { left = level & 0xff; - right = level >> 8; + right = (level >> 8) & 0xff; left += left_step * m->hwvol_step; if (left < 0) left = 0; + else if (left > 100) + left = 100; right += right_step * m->hwvol_step; if (right < 0) right = 0; + else if (right > 100) + right = 100; mixer_set(m, m->hwvol_mixer, left | right << 8); } +} + +void +mixer_hwvol_step(device_t dev, int left_step, int right_step) +{ + struct snd_mixer *m; + struct cdev *pdev; + + pdev = mixer_get_devt(dev); + m = pdev->si_drv1; + snd_mtxlock(m->lock); + mixer_hwvol_step_locked(m, left_step, right_step); snd_mtxunlock(m->lock); } Modified: head/sys/dev/sound/pcm/mixer.h ============================================================================== --- head/sys/dev/sound/pcm/mixer.h Thu Feb 7 07:50:16 2013 (r246453) +++ head/sys/dev/sound/pcm/mixer.h Thu Feb 7 08:20:03 2013 (r246454) @@ -40,7 +40,9 @@ int mixer_ioctl_cmd(struct cdev *i_dev, int mixer_oss_mixerinfo(struct cdev *i_dev, oss_mixerinfo *mi); int mixer_hwvol_init(device_t dev); +void mixer_hwvol_mute_locked(struct snd_mixer *m); void mixer_hwvol_mute(device_t dev); +void mixer_hwvol_step_locked(struct snd_mixer *m, int l_step, int r_step); void mixer_hwvol_step(device_t dev, int left_step, int right_step); int mixer_busy(struct snd_mixer *m); Modified: head/sys/dev/sound/usb/uaudio.c ============================================================================== --- head/sys/dev/sound/usb/uaudio.c Thu Feb 7 07:50:16 2013 (r246453) +++ head/sys/dev/sound/usb/uaudio.c Thu Feb 7 08:20:03 2013 (r246454) @@ -287,14 +287,17 @@ struct uaudio_hid { struct usb_xfer *xfer[UAUDIO_HID_N_TRANSFER]; struct hid_location volume_up_loc; struct hid_location volume_down_loc; + struct hid_location mute_loc; uint32_t flags; #define UAUDIO_HID_VALID 0x0001 #define UAUDIO_HID_HAS_ID 0x0002 #define UAUDIO_HID_HAS_VOLUME_UP 0x0004 #define UAUDIO_HID_HAS_VOLUME_DOWN 0x0008 +#define UAUDIO_HID_HAS_MUTE 0x0010 uint8_t iface_index; uint8_t volume_up_id; uint8_t volume_down_id; + uint8_t mute_id; }; struct uaudio_softc { @@ -1012,6 +1015,8 @@ uaudio_attach_sub(device_t dev, kobj_cla goto detach; sc->sc_mixer_init = 1; + mixer_hwvol_init(dev); + snprintf(status, sizeof(status), "at ? %s", PCM_KLDSTRING(snd_uaudio)); if (pcm_register(dev, sc, @@ -5520,9 +5525,6 @@ uaudio_hid_rx_callback(struct usb_xfer * struct uaudio_softc *sc = usbd_xfer_softc(xfer); const uint8_t *buffer = usbd_xfer_get_frame_buffer(xfer, 0); struct snd_mixer *m; - int v; - int v_l; - int v_r; uint8_t id; int actlen; @@ -5543,6 +5545,16 @@ uaudio_hid_rx_callback(struct usb_xfer * m = sc->sc_mixer_dev; + if ((sc->sc_hid.flags & UAUDIO_HID_HAS_MUTE) && + (sc->sc_hid.mute_id == id) && + hid_get_data(buffer, actlen, + &sc->sc_hid.mute_loc)) { + + DPRINTF("Mute toggle\n"); + + mixer_hwvol_mute_locked(m); + } + if ((sc->sc_hid.flags & UAUDIO_HID_HAS_VOLUME_UP) && (sc->sc_hid.volume_up_id == id) && hid_get_data(buffer, actlen, @@ -5550,13 +5562,7 @@ uaudio_hid_rx_callback(struct usb_xfer * DPRINTF("Volume Up\n"); - v = mix_get_locked(m, SOUND_MIXER_PCM, &v_l, &v_r); - if (v == 0) { - v = ((v_l + v_r) / 2) + 5; - if (v > 100) - v = 100; - mix_set_locked(m, SOUND_MIXER_PCM, v, v); - } + mixer_hwvol_step_locked(m, 1, 1); } if ((sc->sc_hid.flags & UAUDIO_HID_HAS_VOLUME_DOWN) && @@ -5566,13 +5572,7 @@ uaudio_hid_rx_callback(struct usb_xfer * DPRINTF("Volume Down\n"); - v = mix_get_locked(m, SOUND_MIXER_PCM, &v_l, &v_r); - if (v == 0) { - v = ((v_l + v_r) / 2) - 5; - if (v < 0) - v = 0; - mix_set_locked(m, SOUND_MIXER_PCM, v, v); - } + mixer_hwvol_step_locked(m, -1, -1); } case USB_ST_SETUP: @@ -5641,10 +5641,20 @@ uaudio_hid_probe(struct uaudio_softc *sc DPRINTFN(1, "Found Volume Down key\n"); } + if (hid_locate(d_ptr, d_len, + HID_USAGE2(HUP_CONSUMER, 0xE2 /* Mute */), + hid_input, 0, &sc->sc_hid.mute_loc, &flags, + &sc->sc_hid.mute_id)) { + if (flags & HIO_VARIABLE) + sc->sc_hid.flags |= UAUDIO_HID_HAS_MUTE; + DPRINTFN(1, "Found Mute key\n"); + } + free(d_ptr, M_TEMP); if (!(sc->sc_hid.flags & (UAUDIO_HID_HAS_VOLUME_UP | - UAUDIO_HID_HAS_VOLUME_DOWN))) { + UAUDIO_HID_HAS_VOLUME_DOWN | + UAUDIO_HID_HAS_MUTE))) { DPRINTFN(1, "Did not find any volume related keys\n"); return (-1); } From owner-svn-src-head@FreeBSD.ORG Thu Feb 7 08:59:46 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 8ACD2475; Thu, 7 Feb 2013 08:59:46 +0000 (UTC) (envelope-from slw@zxy.spb.ru) Received: from zxy.spb.ru (zxy.spb.ru [195.70.199.98]) by mx1.freebsd.org (Postfix) with ESMTP id 4718AE7D; Thu, 7 Feb 2013 08:59:46 +0000 (UTC) Received: from slw by zxy.spb.ru with local (Exim 4.69 (FreeBSD)) (envelope-from ) id 1U3NKZ-0009jw-Oz; Thu, 07 Feb 2013 12:59:43 +0400 Date: Thu, 7 Feb 2013 12:59:43 +0400 From: Slawa Olhovchenkov To: Gleb Smirnoff Subject: Re: svn commit: r246362 - head/games/fortune/datfiles Message-ID: <20130207085943.GA67709@zxy.spb.ru> References: <201302051439.r15EdcE7011203@svn.freebsd.org> <201302051145.40104.jhb@freebsd.org> <201302051158.55117.jhb@freebsd.org> <20130205205547.GI26896@FreeBSD.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20130205205547.GI26896@FreeBSD.org> User-Agent: Mutt/1.5.21 (2010-09-15) X-SA-Exim-Connect-IP: X-SA-Exim-Mail-From: slw@zxy.spb.ru X-SA-Exim-Scanned: No (on zxy.spb.ru); SAEximRunCond expanded to false Cc: Benjamin Kaduk , src-committers@freebsd.org, John Baldwin , svn-src-all@freebsd.org, svn-src-head@freebsd.org, Dag-Erling SmXXrgrav X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Feb 2013 08:59:46 -0000 On Wed, Feb 06, 2013 at 12:55:47AM +0400, Gleb Smirnoff wrote: > J> Yes, the insta-MFC is also not appropriate, esp. for something that you know > J> is going to raise eyebrows when it is committed. Having to debate this sort > J> of thing in public on mailing lists is also distinctly unhelpful and very > J> distracting from productive work. Also, I'd like to preemptively ask > J> developers to refrain from any further commits to the fortunes datfiles for > J> the time being as the last thing we need is a commit war over this sort of > J> thing. > > What about just moving the entire games subdirectory to ports repo? Not fortune! Some nice hints for beginners placed in fortune file From owner-svn-src-head@FreeBSD.ORG Thu Feb 7 11:08:03 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id CCEFFD99; Thu, 7 Feb 2013 11:08:03 +0000 (UTC) (envelope-from theraven@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id B5993721; Thu, 7 Feb 2013 11:08:03 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r17B83uG018916; Thu, 7 Feb 2013 11:08:03 GMT (envelope-from theraven@svn.freebsd.org) Received: (from theraven@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r17B83Qi018915; Thu, 7 Feb 2013 11:08:03 GMT (envelope-from theraven@svn.freebsd.org) Message-Id: <201302071108.r17B83Qi018915@svn.freebsd.org> From: David Chisnall Date: Thu, 7 Feb 2013 11:08:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r246462 - head/contrib/libcxxrt X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Feb 2013 11:08:03 -0000 Author: theraven Date: Thu Feb 7 11:08:03 2013 New Revision: 246462 URL: http://svnweb.freebsd.org/changeset/base/246462 Log: Fix a copy-and-paste error in libcxxrt. Modified: head/contrib/libcxxrt/exception.cc Modified: head/contrib/libcxxrt/exception.cc ============================================================================== --- head/contrib/libcxxrt/exception.cc Thu Feb 7 11:01:56 2013 (r246461) +++ head/contrib/libcxxrt/exception.cc Thu Feb 7 11:08:03 2013 (r246462) @@ -1387,7 +1387,7 @@ namespace std { if (thread_local_handlers) { return pathscale::set_unexpected(f); } - return ATOMIC_SWAP(&terminateHandler, f); + return ATOMIC_SWAP(&unexpectedHandler, f); } /** * Sets the function that is called to terminate the program. From owner-svn-src-head@FreeBSD.ORG Thu Feb 7 14:49:56 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 3FD55796; Thu, 7 Feb 2013 14:49:56 +0000 (UTC) (envelope-from achim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 2DD70355; Thu, 7 Feb 2013 14:49:56 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r17Enu6i088252; Thu, 7 Feb 2013 14:49:56 GMT (envelope-from achim@svn.freebsd.org) Received: (from achim@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r17Enugl088251; Thu, 7 Feb 2013 14:49:56 GMT (envelope-from achim@svn.freebsd.org) Message-Id: <201302071449.r17Enugl088251@svn.freebsd.org> From: Achim Leubner Date: Thu, 7 Feb 2013 14:49:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r246471 - head/share/misc X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Feb 2013 14:49:56 -0000 Author: achim Date: Thu Feb 7 14:49:55 2013 New Revision: 246471 URL: http://svnweb.freebsd.org/changeset/base/246471 Log: Add myself as a src committer and my mentor relationship. Approved by: emaste (co-mentor) Modified: head/share/misc/committers-src.dot Modified: head/share/misc/committers-src.dot ============================================================================== --- head/share/misc/committers-src.dot Thu Feb 7 14:45:56 2013 (r246470) +++ head/share/misc/committers-src.dot Thu Feb 7 14:49:55 2013 (r246471) @@ -93,6 +93,7 @@ node [color=lightblue2, style=filled, bg # Current src committers go here. Try to keep things sorted. ache [label="Andrey Chernov\nache@FreeBSD.org\n1993/10/31"] +achim [label="Achim Leubner\nachim@FreeBSD.org\n2013/01/23"] adrian [label="Adrian Chadd\nadrian@FreeBSD.org\n2000/07/03"] ae [label="Andrey V. Elsukov\nae@FreeBSD.org\n2010/06/03"] akiyama [label="Shunsuke Akiyama\nakiyama@FreeBSD.org\n2000/06/19"] @@ -380,6 +381,7 @@ ed -> uqs eivind -> des eivind -> rwatson +emaste -> achim emaste -> rstone emaste -> dteske emaste -> markj @@ -616,6 +618,7 @@ sbruno -> jimharris schweikh -> dds +scottl -> achim scottl -> jimharris scottl -> pjd scottl -> sah From owner-svn-src-head@FreeBSD.ORG Thu Feb 7 14:53:34 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id DB8B9BFB; Thu, 7 Feb 2013 14:53:34 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id CDEA038D; Thu, 7 Feb 2013 14:53:34 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r17ErYEP090421; Thu, 7 Feb 2013 14:53:34 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r17ErYK4090418; Thu, 7 Feb 2013 14:53:34 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201302071453.r17ErYK4090418@svn.freebsd.org> From: Konstantin Belousov Date: Thu, 7 Feb 2013 14:53:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r246472 - in head/sys: fs/devfs kern X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Feb 2013 14:53:34 -0000 Author: kib Date: Thu Feb 7 14:53:33 2013 New Revision: 246472 URL: http://svnweb.freebsd.org/changeset/base/246472 Log: Stop translating the ERESTART error from the open(2) into EINTR. Posix requires that open(2) is restartable for SA_RESTART. For non-posix objects, in particular, devfs nodes, still disable automatic restart of the opens. The open call to a driver could have significant side effects for the hardware. Noted and reviewed by: jilles Discussed with: bde MFC after: 2 weeks Modified: head/sys/fs/devfs/devfs_vnops.c head/sys/kern/vfs_syscalls.c Modified: head/sys/fs/devfs/devfs_vnops.c ============================================================================== --- head/sys/fs/devfs/devfs_vnops.c Thu Feb 7 14:49:55 2013 (r246471) +++ head/sys/fs/devfs/devfs_vnops.c Thu Feb 7 14:53:33 2013 (r246472) @@ -1089,8 +1089,11 @@ devfs_open(struct vop_open_args *ap) vn_lock(vp, vlocked | LK_RETRY); dev_relthread(dev, ref); - if (error) + if (error != 0) { + if (error == ERESTART) + error = EINTR; return (error); + } #if 0 /* /dev/console */ KASSERT(fp != NULL, ("Could not vnode bypass device on NULL fp")); Modified: head/sys/kern/vfs_syscalls.c ============================================================================== --- head/sys/kern/vfs_syscalls.c Thu Feb 7 14:49:55 2013 (r246471) +++ head/sys/kern/vfs_syscalls.c Thu Feb 7 14:53:33 2013 (r246472) @@ -1106,8 +1106,6 @@ kern_openat(struct thread *td, int fd, c goto success; } - if (error == ERESTART) - error = EINTR; goto bad; } td->td_dupfd = 0; From owner-svn-src-head@FreeBSD.ORG Thu Feb 7 15:11:45 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 6C897C3B; Thu, 7 Feb 2013 15:11:44 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 74CB6707; Thu, 7 Feb 2013 15:11:44 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r17FBijA097259; Thu, 7 Feb 2013 15:11:44 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r17FBi2P097258; Thu, 7 Feb 2013 15:11:44 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201302071511.r17FBi2P097258@svn.freebsd.org> From: Konstantin Belousov Date: Thu, 7 Feb 2013 15:11:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r246476 - head/lib/libc/sys X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Feb 2013 15:11:45 -0000 Author: kib Date: Thu Feb 7 15:11:43 2013 New Revision: 246476 URL: http://svnweb.freebsd.org/changeset/base/246476 Log: Document the ERESTART translation to EINTR for devfs nodes. Based on the submission by: jilles MFC after: 2 weeks Modified: head/lib/libc/sys/open.2 Modified: head/lib/libc/sys/open.2 ============================================================================== --- head/lib/libc/sys/open.2 Thu Feb 7 15:08:35 2013 (r246475) +++ head/lib/libc/sys/open.2 Thu Feb 7 15:11:43 2013 (r246476) @@ -28,7 +28,7 @@ .\" @(#)open.2 8.2 (Berkeley) 11/16/93 .\" $FreeBSD$ .\" -.Dd March 25, 2011 +.Dd February 7, 2013 .Dt OPEN 2 .Os .Sh NAME @@ -244,6 +244,17 @@ It returns \-1 on failure. The file pointer used to mark the current position within the file is set to the beginning of the file. .Pp +If a sleeping open of a device node from +.Xr devfs 5 +is interrupted by a signal, the call always fails with +.Er EINTR , +even if the +.Dv SA_RESTART +flag is set for the signal. +A sleeping open of a fifo (see +.Xr mkfifo 2 ) +is restarted as normal. +.Pp When a new file is created it is given the group of the directory which contains it. .Pp From owner-svn-src-head@FreeBSD.ORG Thu Feb 7 15:20:57 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 3811478A; Thu, 7 Feb 2013 15:20:57 +0000 (UTC) (envelope-from rrs@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 29BA07D5; Thu, 7 Feb 2013 15:20:57 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r17FKvkh000660; Thu, 7 Feb 2013 15:20:57 GMT (envelope-from rrs@svn.freebsd.org) Received: (from rrs@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r17FKt5n000647; Thu, 7 Feb 2013 15:20:55 GMT (envelope-from rrs@svn.freebsd.org) Message-Id: <201302071520.r17FKt5n000647@svn.freebsd.org> From: Randall Stewart Date: Thu, 7 Feb 2013 15:20:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r246482 - in head/sys: dev/bxe dev/e1000 dev/ixgbe dev/oce net ofed/drivers/net/mlx4 sys X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Feb 2013 15:20:57 -0000 Author: rrs Date: Thu Feb 7 15:20:54 2013 New Revision: 246482 URL: http://svnweb.freebsd.org/changeset/base/246482 Log: This fixes a out-of-order problem with several of the newer drivers. The basic problem was that the driver was pulling the mbuf off the drbr ring and then when sending with xmit(), encounting a full transmit ring. Thus the lower layer xmit() function would return an error, and the drivers would then append the data back on to the ring. For TCP this is a horrible scenario sure to bring on a fast-retransmit. The fix is to use drbr_peek() to pull the data pointer but not remove it from the ring. If it fails then we either call the new drbr_putback or drbr_advance method. Advance moves it forward (we do this sometimes when the xmit() function frees the mbuf). When we succeed we always call advance. The putback will always copy the mbuf back to the top of the ring. Note that the putback *cannot* be used with a drbr_dequeue() only with drbr_peek(). We most of the time, in putback, would not need to copy it back since most likey the mbuf is still the same, but sometimes xmit() functions will change the mbuf via a pullup or other call. So the optimial case for the single consumer is to always copy it back. If we ever do a multiple_consumer (for lagg?) we will need a test and atomic in the put back possibly a seperate putback_mc() in the ring buf. Reviewed by: jhb@freebsd.org, jlv@freebsd.org Modified: head/sys/dev/bxe/if_bxe.c head/sys/dev/e1000/if_em.c head/sys/dev/e1000/if_igb.c head/sys/dev/ixgbe/ixgbe.c head/sys/dev/ixgbe/ixv.c head/sys/dev/oce/oce_if.c head/sys/net/if_var.h head/sys/ofed/drivers/net/mlx4/en_tx.c head/sys/sys/buf_ring.h Modified: head/sys/dev/bxe/if_bxe.c ============================================================================== --- head/sys/dev/bxe/if_bxe.c Thu Feb 7 15:19:12 2013 (r246481) +++ head/sys/dev/bxe/if_bxe.c Thu Feb 7 15:20:54 2013 (r246482) @@ -9506,24 +9506,15 @@ bxe_tx_mq_start_locked(struct ifnet *ifp BXE_FP_LOCK_ASSERT(fp); - if (m == NULL) { - /* No new work, check for pending frames. */ - next = drbr_dequeue(ifp, fp->br); - } else if (drbr_needs_enqueue(ifp, fp->br)) { - /* Both new and pending work, maintain packet order. */ + if (m != NULL) { rc = drbr_enqueue(ifp, fp->br, m); if (rc != 0) { fp->tx_soft_errors++; goto bxe_tx_mq_start_locked_exit; } - next = drbr_dequeue(ifp, fp->br); - } else - /* New work only, nothing pending. */ - next = m; - + } /* Keep adding entries while there are frames to send. */ - while (next != NULL) { - + while ((next = drbr_peek(ifp, fp->br)) != NULL) { /* The transmit mbuf now belongs to us, keep track of it. */ fp->tx_mbuf_alloc++; @@ -9537,23 +9528,22 @@ bxe_tx_mq_start_locked(struct ifnet *ifp if (__predict_false(rc != 0)) { fp->tx_encap_failures++; /* Very Bad Frames(tm) may have been dropped. */ - if (next != NULL) { + if (next == NULL) { + drbr_advance(ifp, fp->br); + } else { + drbr_putback(ifp, fp->br, next); /* * Mark the TX queue as full and save * the frame. */ ifp->if_drv_flags |= IFF_DRV_OACTIVE; fp->tx_frame_deferred++; - - /* This may reorder frame. */ - rc = drbr_enqueue(ifp, fp->br, next); fp->tx_mbuf_alloc--; } - /* Stop looking for more work. */ break; } - + drbr_advance(ifp, fp->br); /* The transmit frame was enqueued successfully. */ tx_count++; @@ -9574,8 +9564,6 @@ bxe_tx_mq_start_locked(struct ifnet *ifp ifp->if_drv_flags &= ~IFF_DRV_OACTIVE; break; } - - next = drbr_dequeue(ifp, fp->br); } /* No TX packets were dequeued. */ Modified: head/sys/dev/e1000/if_em.c ============================================================================== --- head/sys/dev/e1000/if_em.c Thu Feb 7 15:19:12 2013 (r246481) +++ head/sys/dev/e1000/if_em.c Thu Feb 7 15:20:54 2013 (r246482) @@ -905,22 +905,24 @@ em_mq_start_locked(struct ifnet *ifp, st } enq = 0; - if (m == NULL) { - next = drbr_dequeue(ifp, txr->br); - } else if (drbr_needs_enqueue(ifp, txr->br)) { - if ((err = drbr_enqueue(ifp, txr->br, m)) != 0) + if (m != NULL) { + err = drbr_enqueue(ifp, txr->br, m); + if (err) { return (err); - next = drbr_dequeue(ifp, txr->br); - } else - next = m; + } + } /* Process the queue */ - while (next != NULL) { + while ((next = drbr_peek(ifp, txr->br)) != NULL) { if ((err = em_xmit(txr, &next)) != 0) { - if (next != NULL) - err = drbr_enqueue(ifp, txr->br, next); - break; + if (next == NULL) { + drbr_advance(ifp, txr->br); + } else { + drbr_putback(ifp, txr->br, next); + } + break; } + drbr_advance(ifp, txr->br); enq++; ifp->if_obytes += next->m_pkthdr.len; if (next->m_flags & M_MCAST) @@ -928,7 +930,6 @@ em_mq_start_locked(struct ifnet *ifp, st ETHER_BPF_MTAP(ifp, next); if ((ifp->if_drv_flags & IFF_DRV_RUNNING) == 0) break; - next = drbr_dequeue(ifp, txr->br); } if (enq > 0) { Modified: head/sys/dev/e1000/if_igb.c ============================================================================== --- head/sys/dev/e1000/if_igb.c Thu Feb 7 15:19:12 2013 (r246481) +++ head/sys/dev/e1000/if_igb.c Thu Feb 7 15:20:54 2013 (r246482) @@ -350,6 +350,16 @@ TUNABLE_INT("hw.igb.max_interrupt_rate", SYSCTL_INT(_hw_igb, OID_AUTO, max_interrupt_rate, CTLFLAG_RDTUN, &igb_max_interrupt_rate, 0, "Maximum interrupts per second"); +#if __FreeBSD_version >= 800000 +/* +** Tuneable number of buffers in the buf-ring (drbr_xxx) +*/ +static int igb_buf_ring_size = IGB_BR_SIZE; +TUNABLE_INT("hw.igb.buf_ring_size", &igb_buf_ring_size); +SYSCTL_INT(_hw_igb, OID_AUTO, buf_ring_size, CTLFLAG_RDTUN, + &igb_buf_ring_size, 0, "Size of the bufring"); +#endif + /* ** Header split causes the packet header to ** be dma'd to a seperate mbuf from the payload. @@ -965,12 +975,13 @@ igb_mq_start(struct ifnet *ifp, struct m ** out-of-order delivery, but ** settle for it if that fails */ - if (m) + if (m != NULL) drbr_enqueue(ifp, txr->br, m); err = igb_mq_start_locked(ifp, txr); IGB_TX_UNLOCK(txr); } else { - err = drbr_enqueue(ifp, txr->br, m); + if (m != NULL) + err = drbr_enqueue(ifp, txr->br, m); taskqueue_enqueue(que->tq, &txr->txq_task); } @@ -994,12 +1005,22 @@ igb_mq_start_locked(struct ifnet *ifp, s enq = 0; /* Process the queue */ - while ((next = drbr_dequeue(ifp, txr->br)) != NULL) { + while ((next = drbr_peek(ifp, txr->br)) != NULL) { if ((err = igb_xmit(txr, &next)) != 0) { - if (next != NULL) - err = drbr_enqueue(ifp, txr->br, next); + if (next == NULL) { + /* It was freed, move forward */ + drbr_advance(ifp, txr->br); + } else { + /* + * Still have one left, it may not be + * the same since the transmit function + * may have changed it. + */ + drbr_putback(ifp, txr->br, next); + } break; } + drbr_advance(ifp, txr->br); enq++; ifp->if_obytes += next->m_pkthdr.len; if (next->m_flags & M_MCAST) @@ -3301,7 +3322,7 @@ igb_allocate_queues(struct adapter *adap } #if __FreeBSD_version >= 800000 /* Allocate a buf ring */ - txr->br = buf_ring_alloc(IGB_BR_SIZE, M_DEVBUF, + txr->br = buf_ring_alloc(igb_buf_ring_size, M_DEVBUF, M_WAITOK, &txr->tx_mtx); #endif } Modified: head/sys/dev/ixgbe/ixgbe.c ============================================================================== --- head/sys/dev/ixgbe/ixgbe.c Thu Feb 7 15:19:12 2013 (r246481) +++ head/sys/dev/ixgbe/ixgbe.c Thu Feb 7 15:20:54 2013 (r246482) @@ -832,22 +832,24 @@ ixgbe_mq_start_locked(struct ifnet *ifp, } enqueued = 0; - if (m == NULL) { - next = drbr_dequeue(ifp, txr->br); - } else if (drbr_needs_enqueue(ifp, txr->br)) { - if ((err = drbr_enqueue(ifp, txr->br, m)) != 0) + if (m != NULL) { + err = drbr_enqueue(ifp, txr->br, m); + if (err) { return (err); - next = drbr_dequeue(ifp, txr->br); - } else - next = m; + } + } /* Process the queue */ - while (next != NULL) { + while ((next = drbr_peek(ifp, txr->br)) != NULL) { if ((err = ixgbe_xmit(txr, &next)) != 0) { - if (next != NULL) - err = drbr_enqueue(ifp, txr->br, next); + if (next == NULL) { + drbr_advance(ifp, txr->br); + } else { + drbr_putback(ifp, txr->br, next); + } break; } + drbr_advance(ifp, txr->br); enqueued++; /* Send a copy of the frame to the BPF listener */ ETHER_BPF_MTAP(ifp, next); @@ -855,7 +857,6 @@ ixgbe_mq_start_locked(struct ifnet *ifp, break; if (txr->tx_avail < IXGBE_TX_OP_THRESHOLD) ixgbe_txeof(txr); - next = drbr_dequeue(ifp, txr->br); } if (enqueued > 0) { Modified: head/sys/dev/ixgbe/ixv.c ============================================================================== --- head/sys/dev/ixgbe/ixv.c Thu Feb 7 15:19:12 2013 (r246481) +++ head/sys/dev/ixgbe/ixv.c Thu Feb 7 15:20:54 2013 (r246482) @@ -620,22 +620,23 @@ ixv_mq_start_locked(struct ifnet *ifp, s ixv_txeof(txr); enqueued = 0; - if (m == NULL) { - next = drbr_dequeue(ifp, txr->br); - } else if (drbr_needs_enqueue(ifp, txr->br)) { - if ((err = drbr_enqueue(ifp, txr->br, m)) != 0) + if (m != NULL) { + err = drbr_enqueue(ifp, txr->br, m); + if (err) { return (err); - next = drbr_dequeue(ifp, txr->br); - } else - next = m; - + } + } /* Process the queue */ - while (next != NULL) { + while ((next = drbr_peek(ifp, txr->br)) != NULL) { if ((err = ixv_xmit(txr, &next)) != 0) { - if (next != NULL) - err = drbr_enqueue(ifp, txr->br, next); + if (next == NULL) { + drbr_advance(ifp, txr->br); + } else { + drbr_putback(ifp, txr->br, next); + } break; } + drbr_advance(ifp, txr->br); enqueued++; ifp->if_obytes += next->m_pkthdr.len; if (next->m_flags & M_MCAST) @@ -648,7 +649,6 @@ ixv_mq_start_locked(struct ifnet *ifp, s ifp->if_drv_flags |= IFF_DRV_OACTIVE; break; } - next = drbr_dequeue(ifp, txr->br); } if (enqueued > 0) { Modified: head/sys/dev/oce/oce_if.c ============================================================================== --- head/sys/dev/oce/oce_if.c Thu Feb 7 15:19:12 2013 (r246481) +++ head/sys/dev/oce/oce_if.c Thu Feb 7 15:20:54 2013 (r246482) @@ -1166,29 +1166,27 @@ oce_multiq_transmit(struct ifnet *ifp, s return status; } - if (m == NULL) - next = drbr_dequeue(ifp, br); - else if (drbr_needs_enqueue(ifp, br)) { + if (m != NULL) { if ((status = drbr_enqueue(ifp, br, m)) != 0) return status; - next = drbr_dequeue(ifp, br); - } else - next = m; - - while (next != NULL) { + } + while ((next = drbr_peek(ifp, br)) != NULL) { if (oce_tx(sc, &next, queue_index)) { - if (next != NULL) { + if (next == NULL) { + drbr_advance(ifp, br); + } else { + drbr_putback(ifp, br, next); wq->tx_stats.tx_stops ++; ifp->if_drv_flags |= IFF_DRV_OACTIVE; status = drbr_enqueue(ifp, br, next); } break; } + drbr_advance(ifp, br); ifp->if_obytes += next->m_pkthdr.len; if (next->m_flags & M_MCAST) ifp->if_omcasts++; ETHER_BPF_MTAP(ifp, next); - next = drbr_dequeue(ifp, br); } return status; Modified: head/sys/net/if_var.h ============================================================================== --- head/sys/net/if_var.h Thu Feb 7 15:19:12 2013 (r246481) +++ head/sys/net/if_var.h Thu Feb 7 15:20:54 2013 (r246482) @@ -622,6 +622,45 @@ drbr_enqueue(struct ifnet *ifp, struct b } static __inline void +drbr_putback(struct ifnet *ifp, struct buf_ring *br, struct mbuf *new) +{ + /* + * The top of the list needs to be swapped + * for this one. + */ +#ifdef ALTQ + if (ifp != NULL && ALTQ_IS_ENABLED(&ifp->if_snd)) { + /* + * Peek in altq case dequeued it + * so put it back. + */ + IFQ_DRV_PREPEND(&ifp->if_snd, new); + return; + } +#endif + buf_ring_putback_sc(br, new); +} + +static __inline struct mbuf * +drbr_peek(struct ifnet *ifp, struct buf_ring *br) +{ +#ifdef ALTQ + struct mbuf *m; + if (ifp != NULL && ALTQ_IS_ENABLED(&ifp->if_snd)) { + /* + * Pull it off like a dequeue + * since drbr_advance() does nothing + * for altq and drbr_putback() will + * use the old prepend function. + */ + IFQ_DEQUEUE(&ifp->if_snd, m); + return (m); + } +#endif + return(buf_ring_peek(br)); +} + +static __inline void drbr_flush(struct ifnet *ifp, struct buf_ring *br) { struct mbuf *m; @@ -648,7 +687,7 @@ drbr_dequeue(struct ifnet *ifp, struct b #ifdef ALTQ struct mbuf *m; - if (ALTQ_IS_ENABLED(&ifp->if_snd)) { + if (ifp != NULL && ALTQ_IS_ENABLED(&ifp->if_snd)) { IFQ_DEQUEUE(&ifp->if_snd, m); return (m); } @@ -656,6 +695,18 @@ drbr_dequeue(struct ifnet *ifp, struct b return (buf_ring_dequeue_sc(br)); } +static __inline void +drbr_advance(struct ifnet *ifp, struct buf_ring *br) +{ +#ifdef ALTQ + /* Nothing to do here since peek dequeues in altq case */ + if (ifp != NULL && ALTQ_IS_ENABLED(&ifp->if_snd)) + return; +#endif + return (buf_ring_advance_sc(br)); +} + + static __inline struct mbuf * drbr_dequeue_cond(struct ifnet *ifp, struct buf_ring *br, int (*func) (struct mbuf *, void *), void *arg) Modified: head/sys/ofed/drivers/net/mlx4/en_tx.c ============================================================================== --- head/sys/ofed/drivers/net/mlx4/en_tx.c Thu Feb 7 15:19:12 2013 (r246481) +++ head/sys/ofed/drivers/net/mlx4/en_tx.c Thu Feb 7 15:20:54 2013 (r246482) @@ -931,22 +931,21 @@ mlx4_en_transmit_locked(struct ifnet *de } enqueued = 0; - if (m == NULL) { - next = drbr_dequeue(dev, ring->br); - } else if (drbr_needs_enqueue(dev, ring->br)) { + if (m != NULL) { if ((err = drbr_enqueue(dev, ring->br, m)) != 0) return (err); - next = drbr_dequeue(dev, ring->br); - } else - next = m; - + } /* Process the queue */ - while (next != NULL) { + while ((next = drbr_peek(ifp, ring->br)) != NULL) { if ((err = mlx4_en_xmit(dev, tx_ind, &next)) != 0) { - if (next != NULL) - err = drbr_enqueue(dev, ring->br, next); + if (next == NULL) { + drbr_advance(ifp, ring->br); + } else { + drbr_putback(ifp, ring->br, next); + } break; } + drbr_advance(ifp, ring->br); enqueued++; dev->if_obytes += next->m_pkthdr.len; if (next->m_flags & M_MCAST) @@ -955,7 +954,6 @@ mlx4_en_transmit_locked(struct ifnet *de ETHER_BPF_MTAP(dev, next); if ((dev->if_drv_flags & IFF_DRV_RUNNING) == 0) break; - next = drbr_dequeue(dev, ring->br); } if (enqueued > 0) Modified: head/sys/sys/buf_ring.h ============================================================================== --- head/sys/sys/buf_ring.h Thu Feb 7 15:19:12 2013 (r246481) +++ head/sys/sys/buf_ring.h Thu Feb 7 15:20:54 2013 (r246482) @@ -208,6 +208,54 @@ buf_ring_dequeue_sc(struct buf_ring *br) } /* + * single-consumer advance after a peek + * use where it is protected by a lock + * e.g. a network driver's tx queue lock + */ +static __inline void +buf_ring_advance_sc(struct buf_ring *br) +{ + uint32_t cons_head, cons_next; + uint32_t prod_tail; + + cons_head = br->br_cons_head; + prod_tail = br->br_prod_tail; + + cons_next = (cons_head + 1) & br->br_cons_mask; + if (cons_head == prod_tail) + return; + br->br_cons_head = cons_next; +#ifdef DEBUG_BUFRING + br->br_ring[cons_head] = NULL; +#endif + br->br_cons_tail = cons_next; +} + +/* + * Used to return a buffer (most likely already there) + * to the top od the ring. The caller should *not* + * have used any dequeue to pull it out of the ring + * but instead should have used the peek() function. + * This is normally used where the transmit queue + * of a driver is full, and an mubf must be returned. + * Most likely whats in the ring-buffer is what + * is being put back (since it was not removed), but + * sometimes the lower transmit function may have + * done a pullup or other function that will have + * changed it. As an optimzation we always put it + * back (since jhb says the store is probably cheaper), + * if we have to do a multi-queue version we will need + * the compare and an atomic. + */ +static __inline void +buf_ring_putback_sc(struct buf_ring *br, void *new) +{ + KASSERT(br->br_cons_head != br->br_prod_tail, + ("Buf-Ring has none in putback")) ; + br->br_ring[br->br_cons_head] = new; +} + +/* * return a pointer to the first entry in the ring * without modifying it, or NULL if the ring is empty * race-prone if not protected by a lock From owner-svn-src-head@FreeBSD.ORG Thu Feb 7 15:34:23 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 860CCEF2; Thu, 7 Feb 2013 15:34:23 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 6D25488C; Thu, 7 Feb 2013 15:34:23 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r17FYN4N004237; Thu, 7 Feb 2013 15:34:23 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r17FYMew004229; Thu, 7 Feb 2013 15:34:22 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201302071534.r17FYMew004229@svn.freebsd.org> From: Konstantin Belousov Date: Thu, 7 Feb 2013 15:34:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r246484 - in head/sys: kern sys X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Feb 2013 15:34:23 -0000 Author: kib Date: Thu Feb 7 15:34:22 2013 New Revision: 246484 URL: http://svnweb.freebsd.org/changeset/base/246484 Log: When vforked child is traced, the debugging events are not generated until child performs exec(). The behaviour is reasonable when a debugger is the real parent, because the parent is stopped until exec(), and sending a debugging event to the debugger would deadlock both parent and child. On the other hand, when debugger is not the parent of the vforked child, not sending debugging signals makes it impossible to debug across vfork. Fix the issue by declining generating debug signals only when vfork() was done and child called ptrace(PT_TRACEME). Set a new process flag P_PPTRACE from the attach code for PT_TRACEME, if P_PPWAIT flag is set, which indicates that the process was created with vfork() and still did not execed. Check P_PPTRACE from issignal(), instead of refusing the trace outright for the P_PPWAIT case. The scope of P_PPTRACE is exactly contained in the scope of P_PPWAIT. Found and tested by: zont Reviewed by: pluknet MFC after: 2 weeks Modified: head/sys/kern/kern_exec.c head/sys/kern/kern_exit.c head/sys/kern/kern_sig.c head/sys/kern/sys_process.c head/sys/sys/proc.h Modified: head/sys/kern/kern_exec.c ============================================================================== --- head/sys/kern/kern_exec.c Thu Feb 7 15:22:50 2013 (r246483) +++ head/sys/kern/kern_exec.c Thu Feb 7 15:34:22 2013 (r246484) @@ -640,7 +640,7 @@ interpret: */ p->p_flag |= P_EXEC; if (p->p_pptr && (p->p_flag & P_PPWAIT)) { - p->p_flag &= ~P_PPWAIT; + p->p_flag &= ~(P_PPWAIT | P_PPTRACE); cv_broadcast(&p->p_pwait); } Modified: head/sys/kern/kern_exit.c ============================================================================== --- head/sys/kern/kern_exit.c Thu Feb 7 15:22:50 2013 (r246483) +++ head/sys/kern/kern_exit.c Thu Feb 7 15:34:22 2013 (r246484) @@ -266,7 +266,7 @@ exit1(struct thread *td, int rv) PROC_LOCK(p); rv = p->p_xstat; /* Event handler could change exit status */ stopprofclock(p); - p->p_flag &= ~(P_TRACED | P_PPWAIT); + p->p_flag &= ~(P_TRACED | P_PPWAIT | P_PPTRACE); /* * Stop the real interval timer. If the handler is currently Modified: head/sys/kern/kern_sig.c ============================================================================== --- head/sys/kern/kern_sig.c Thu Feb 7 15:22:50 2013 (r246483) +++ head/sys/kern/kern_sig.c Thu Feb 7 15:34:22 2013 (r246484) @@ -2618,7 +2618,7 @@ issignal(struct thread *td, int stop_all sigqueue_delete(&p->p_sigqueue, sig); continue; } - if (p->p_flag & P_TRACED && (p->p_flag & P_PPWAIT) == 0) { + if (p->p_flag & P_TRACED && (p->p_flag & P_PPTRACE) == 0) { /* * If traced, always stop. * Remove old signal from queue before the stop. Modified: head/sys/kern/sys_process.c ============================================================================== --- head/sys/kern/sys_process.c Thu Feb 7 15:22:50 2013 (r246483) +++ head/sys/kern/sys_process.c Thu Feb 7 15:34:22 2013 (r246484) @@ -822,6 +822,8 @@ kern_ptrace(struct thread *td, int req, case PT_TRACE_ME: /* set my trace flag and "owner" so it can read/write me */ p->p_flag |= P_TRACED; + if (p->p_flag & P_PPWAIT) + p->p_flag |= P_PPTRACE; p->p_oppid = p->p_pptr->p_pid; break; Modified: head/sys/sys/proc.h ============================================================================== --- head/sys/sys/proc.h Thu Feb 7 15:22:50 2013 (r246483) +++ head/sys/sys/proc.h Thu Feb 7 15:34:22 2013 (r246484) @@ -636,6 +636,7 @@ struct proc { #define P_INMEM 0x10000000 /* Loaded into memory. */ #define P_SWAPPINGOUT 0x20000000 /* Process is being swapped out. */ #define P_SWAPPINGIN 0x40000000 /* Process is being swapped in. */ +#define P_PPTRACE 0x80000000 /* PT_TRACEME by vforked child. */ #define P_STOPPED (P_STOPPED_SIG|P_STOPPED_SINGLE|P_STOPPED_TRACE) #define P_SHOULDSTOP(p) ((p)->p_flag & P_STOPPED) From owner-svn-src-head@FreeBSD.ORG Thu Feb 7 15:36:25 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 7AE55119; Thu, 7 Feb 2013 15:36:25 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 6D9C58A9; Thu, 7 Feb 2013 15:36:25 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r17FaP44004558; Thu, 7 Feb 2013 15:36:25 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r17FaPuC004557; Thu, 7 Feb 2013 15:36:25 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201302071536.r17FaPuC004557@svn.freebsd.org> From: Konstantin Belousov Date: Thu, 7 Feb 2013 15:36:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r246485 - head/lib/libc/sys X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Feb 2013 15:36:25 -0000 Author: kib Date: Thu Feb 7 15:36:24 2013 New Revision: 246485 URL: http://svnweb.freebsd.org/changeset/base/246485 Log: Document the detail of interaction between vfork and PT_TRACEME. MFC after: 2 weeks Modified: head/lib/libc/sys/ptrace.2 Modified: head/lib/libc/sys/ptrace.2 ============================================================================== --- head/lib/libc/sys/ptrace.2 Thu Feb 7 15:34:22 2013 (r246484) +++ head/lib/libc/sys/ptrace.2 Thu Feb 7 15:36:24 2013 (r246485) @@ -2,7 +2,7 @@ .\" $NetBSD: ptrace.2,v 1.2 1995/02/27 12:35:37 cgd Exp $ .\" .\" This file is in the public domain. -.Dd February 19, 2012 +.Dd February 7, 2013 .Dt PTRACE 2 .Os .Sh NAME @@ -100,6 +100,16 @@ or any of the routines built on it it will stop before executing the first instruction of the new image. Also, any setuid or setgid bits on the executable being executed will be ignored. +If the child was created by +.Xr vfork 2 +system call or +.Xr rfork(2) +call with the +.Dv RFMEM +flag specified, the debugging events are reported to the parent +only after the +.Xr execve 2 +is executed. .It Dv PT_READ_I , Dv PT_READ_D These requests read a single .Vt int From owner-svn-src-head@FreeBSD.ORG Thu Feb 7 15:37:52 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 8928B491; Thu, 7 Feb 2013 15:37:52 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 7AB198DB; Thu, 7 Feb 2013 15:37:52 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r17FbqCW004905; Thu, 7 Feb 2013 15:37:52 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r17FbqmM004904; Thu, 7 Feb 2013 15:37:52 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201302071537.r17FbqmM004904@svn.freebsd.org> From: Konstantin Belousov Date: Thu, 7 Feb 2013 15:37:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r246486 - head/bin/ps X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Feb 2013 15:37:52 -0000 Author: kib Date: Thu Feb 7 15:37:51 2013 New Revision: 246486 URL: http://svnweb.freebsd.org/changeset/base/246486 Log: Document P_PPTRACE. MFC after: 2 weeks Modified: head/bin/ps/ps.1 Modified: head/bin/ps/ps.1 ============================================================================== --- head/bin/ps/ps.1 Thu Feb 7 15:36:24 2013 (r246485) +++ head/bin/ps/ps.1 Thu Feb 7 15:37:51 2013 (r246486) @@ -29,7 +29,7 @@ .\" @(#)ps.1 8.3 (Berkeley) 4/18/94 .\" $FreeBSD$ .\" -.Dd September 18, 2012 +.Dd February 7, 2013 .Dt PS 1 .Os .Sh NAME @@ -323,6 +323,7 @@ the include file .It Dv "P_INMEM" Ta No "0x10000000" Ta "Loaded into memory" .It Dv "P_SWAPPINGOUT" Ta No "0x20000000" Ta "Process is being swapped out" .It Dv "P_SWAPPINGIN" Ta No "0x40000000" Ta "Process is being swapped in" +.It Dv "P_PPTRACE" Ta No "0x80000000" Ta "Vforked child issued ptrace(PT_TRACEME)" .El .It Cm label The MAC label of the process. From owner-svn-src-head@FreeBSD.ORG Thu Feb 7 15:45:32 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id A32DA881; Thu, 7 Feb 2013 15:45:32 +0000 (UTC) (envelope-from theraven@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 7D60393A; Thu, 7 Feb 2013 15:45:32 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r17FjWFV007688; Thu, 7 Feb 2013 15:45:32 GMT (envelope-from theraven@svn.freebsd.org) Received: (from theraven@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r17FjSK9007660; Thu, 7 Feb 2013 15:45:28 GMT (envelope-from theraven@svn.freebsd.org) Message-Id: <201302071545.r17FjSK9007660@svn.freebsd.org> From: David Chisnall Date: Thu, 7 Feb 2013 15:45:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r246487 - in head/contrib/libc++: include src X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Feb 2013 15:45:32 -0000 Author: theraven Date: Thu Feb 7 15:45:28 2013 New Revision: 246487 URL: http://svnweb.freebsd.org/changeset/base/246487 Log: Import new libc++ to head. Various small fixes and cleanups. MFC after: 2 weeks Modified: head/contrib/libc++/include/__config head/contrib/libc++/include/algorithm head/contrib/libc++/include/array head/contrib/libc++/include/atomic head/contrib/libc++/include/cmath head/contrib/libc++/include/functional head/contrib/libc++/include/future head/contrib/libc++/include/istream head/contrib/libc++/include/iterator head/contrib/libc++/include/limits head/contrib/libc++/include/locale head/contrib/libc++/include/memory head/contrib/libc++/include/ostream head/contrib/libc++/include/random head/contrib/libc++/include/regex head/contrib/libc++/include/string head/contrib/libc++/include/type_traits head/contrib/libc++/include/vector head/contrib/libc++/src/chrono.cpp head/contrib/libc++/src/debug.cpp head/contrib/libc++/src/exception.cpp head/contrib/libc++/src/future.cpp head/contrib/libc++/src/hash.cpp head/contrib/libc++/src/locale.cpp head/contrib/libc++/src/string.cpp head/contrib/libc++/src/thread.cpp Directory Properties: head/contrib/libc++/ (props changed) Modified: head/contrib/libc++/include/__config ============================================================================== --- head/contrib/libc++/include/__config Thu Feb 7 15:37:51 2013 (r246486) +++ head/contrib/libc++/include/__config Thu Feb 7 15:45:28 2013 (r246487) @@ -66,6 +66,12 @@ # endif #endif // _WIN32 +#ifdef __linux__ +# if defined(__GNUC__) && _GNUC_VER >= 403 +# define _LIBCP_HAS_IS_BASE_OF +# endif +#endif + #ifdef __sun__ # include # ifdef _LITTLE_ENDIAN Modified: head/contrib/libc++/include/algorithm ============================================================================== --- head/contrib/libc++/include/algorithm Thu Feb 7 15:37:51 2013 (r246486) +++ head/contrib/libc++/include/algorithm Thu Feb 7 15:45:28 2013 (r246487) @@ -1528,10 +1528,10 @@ copy(_InputIterator __first, _InputItera // copy_backward -template +template inline _LIBCPP_INLINE_VISIBILITY _OutputIterator -__copy_backward(_InputIterator __first, _InputIterator __last, _OutputIterator __result) +__copy_backward(_BidirectionalIterator __first, _BidirectionalIterator __last, _OutputIterator __result) { while (__first != __last) *--__result = *--__last; Modified: head/contrib/libc++/include/array ============================================================================== --- head/contrib/libc++/include/array Thu Feb 7 15:37:51 2013 (r246486) +++ head/contrib/libc++/include/array Thu Feb 7 15:45:28 2013 (r246487) @@ -310,6 +310,7 @@ _LIBCPP_INLINE_VISIBILITY inline _Tp& get(array<_Tp, _Size>& __a) _NOEXCEPT { + static_assert(_Ip < _Size, "Index out of bounds in std::get<> (std::array)"); return __a[_Ip]; } @@ -318,6 +319,7 @@ _LIBCPP_INLINE_VISIBILITY inline const _Tp& get(const array<_Tp, _Size>& __a) _NOEXCEPT { + static_assert(_Ip < _Size, "Index out of bounds in std::get<> (const std::array)"); return __a[_Ip]; } @@ -328,6 +330,7 @@ _LIBCPP_INLINE_VISIBILITY inline _Tp&& get(array<_Tp, _Size>&& __a) _NOEXCEPT { + static_assert(_Ip < _Size, "Index out of bounds in std::get<> (std::array &&)"); return _VSTD::move(__a[_Ip]); } Modified: head/contrib/libc++/include/atomic ============================================================================== --- head/contrib/libc++/include/atomic Thu Feb 7 15:37:51 2013 (r246486) +++ head/contrib/libc++/include/atomic Thu Feb 7 15:45:28 2013 (r246487) @@ -33,6 +33,7 @@ template T kill_dependency(T y // lock-free property +#define ATOMIC_BOOL_LOCK_FREE unspecified #define ATOMIC_CHAR_LOCK_FREE unspecified #define ATOMIC_CHAR16_T_LOCK_FREE unspecified #define ATOMIC_CHAR32_T_LOCK_FREE unspecified @@ -41,6 +42,7 @@ template T kill_dependency(T y #define ATOMIC_INT_LOCK_FREE unspecified #define ATOMIC_LONG_LOCK_FREE unspecified #define ATOMIC_LLONG_LOCK_FREE unspecified +#define ATOMIC_POINTER_LOCK_FREE unspecified // flag type and operations @@ -472,6 +474,7 @@ template // Atomics for standard typedef types +typedef atomic atomic_bool; typedef atomic atomic_char; typedef atomic atomic_schar; typedef atomic atomic_uchar; @@ -1454,6 +1457,7 @@ atomic_signal_fence(memory_order __m) _N // Atomics for standard typedef types +typedef atomic atomic_bool; typedef atomic atomic_char; typedef atomic atomic_schar; typedef atomic atomic_uchar; @@ -1499,14 +1503,16 @@ typedef atomic atomic_uintmax // lock-free property -#define ATOMIC_CHAR_LOCK_FREE 0 -#define ATOMIC_CHAR16_T_LOCK_FREE 0 -#define ATOMIC_CHAR32_T_LOCK_FREE 0 -#define ATOMIC_WCHAR_T_LOCK_FREE 0 -#define ATOMIC_SHORT_LOCK_FREE 0 -#define ATOMIC_INT_LOCK_FREE 0 -#define ATOMIC_LONG_LOCK_FREE 0 -#define ATOMIC_LLONG_LOCK_FREE 0 +#define ATOMIC_BOOL_LOCK_FREE __GCC_ATOMIC_BOOL_LOCK_FREE +#define ATOMIC_CHAR_LOCK_FREE __GCC_ATOMIC_CHAR_LOCK_FREE +#define ATOMIC_CHAR16_T_LOCK_FREE __GCC_ATOMIC_CHAR16_T_LOCK_FREE +#define ATOMIC_CHAR32_T_LOCK_FREE __GCC_ATOMIC_CHAR32_T_LOCK_FREE +#define ATOMIC_WCHAR_T_LOCK_FREE __GCC_ATOMIC_WCHAR_T_LOCK_FREE +#define ATOMIC_SHORT_LOCK_FREE __GCC_ATOMIC_SHORT_LOCK_FREE +#define ATOMIC_INT_LOCK_FREE __GCC_ATOMIC_INT_LOCK_FREE +#define ATOMIC_LONG_LOCK_FREE __GCC_ATOMIC_LONG_LOCK_FREE +#define ATOMIC_LLONG_LOCK_FREE __GCC_ATOMIC_LLONG_LOCK_FREE +#define ATOMIC_POINTER_LOCK_FREE __GCC_ATOMIC_POINTER_LOCK_FREE #endif // !__has_feature(cxx_atomic) Modified: head/contrib/libc++/include/cmath ============================================================================== --- head/contrib/libc++/include/cmath Thu Feb 7 15:37:51 2013 (r246486) +++ head/contrib/libc++/include/cmath Thu Feb 7 15:45:28 2013 (r246487) @@ -137,21 +137,21 @@ long double tanhl(long double x); // C99 -bool signbit(floating_point x); +bool signbit(arithmetic x); -int fpclassify(floating_point x); +int fpclassify(arithmetic x); -bool isfinite(floating_point x); -bool isinf(floating_point x); -bool isnan(floating_point x); -bool isnormal(floating_point x); - -bool isgreater(floating_point x, floating_point y); -bool isgreaterequal(floating_point x, floating_point y); -bool isless(floating_point x, floating_point y); -bool islessequal(floating_point x, floating_point y); -bool islessgreater(floating_point x, floating_point y); -bool isunordered(floating_point x, floating_point y); +bool isfinite(arithmetic x); +bool isinf(arithmetic x); +bool isnan(arithmetic x); +bool isnormal(arithmetic x); + +bool isgreater(arithmetic x, arithmetic y); +bool isgreaterequal(arithmetic x, arithmetic y); +bool isless(arithmetic x, arithmetic y); +bool islessequal(arithmetic x, arithmetic y); +bool islessgreater(arithmetic x, arithmetic y); +bool isunordered(arithmetic x, arithmetic y); floating_point acosh (arithmetic x); float acoshf(float x); @@ -325,10 +325,10 @@ __libcpp_signbit(_A1 __x) _NOEXCEPT template inline _LIBCPP_INLINE_VISIBILITY -typename std::enable_if::value, bool>::type +typename std::enable_if::value, bool>::type signbit(_A1 __x) _NOEXCEPT { - return __libcpp_signbit(__x); + return __libcpp_signbit((typename std::__promote<_A1>::type)__x); } #endif // signbit @@ -349,10 +349,10 @@ __libcpp_fpclassify(_A1 __x) _NOEXCEPT template inline _LIBCPP_INLINE_VISIBILITY -typename std::enable_if::value, int>::type +typename std::enable_if::value, int>::type fpclassify(_A1 __x) _NOEXCEPT { - return __libcpp_fpclassify(__x); + return __libcpp_fpclassify((typename std::__promote<_A1>::type)__x); } #endif // fpclassify @@ -373,10 +373,10 @@ __libcpp_isfinite(_A1 __x) _NOEXCEPT template inline _LIBCPP_INLINE_VISIBILITY -typename std::enable_if::value, bool>::type +typename std::enable_if::value, bool>::type isfinite(_A1 __x) _NOEXCEPT { - return __libcpp_isfinite(__x); + return __libcpp_isfinite((typename std::__promote<_A1>::type)__x); } #endif // isfinite @@ -397,10 +397,10 @@ __libcpp_isinf(_A1 __x) _NOEXCEPT template inline _LIBCPP_INLINE_VISIBILITY -typename std::enable_if::value, bool>::type +typename std::enable_if::value, bool>::type isinf(_A1 __x) _NOEXCEPT { - return __libcpp_isinf(__x); + return __libcpp_isinf((typename std::__promote<_A1>::type)__x); } #endif // isinf @@ -421,10 +421,10 @@ __libcpp_isnan(_A1 __x) _NOEXCEPT template inline _LIBCPP_INLINE_VISIBILITY -typename std::enable_if::value, bool>::type +typename std::enable_if::value, bool>::type isnan(_A1 __x) _NOEXCEPT { - return __libcpp_isnan(__x); + return __libcpp_isnan((typename std::__promote<_A1>::type)__x); } #endif // isnan @@ -445,10 +445,10 @@ __libcpp_isnormal(_A1 __x) _NOEXCEPT template inline _LIBCPP_INLINE_VISIBILITY -typename std::enable_if::value, bool>::type +typename std::enable_if::value, bool>::type isnormal(_A1 __x) _NOEXCEPT { - return __libcpp_isnormal(__x); + return __libcpp_isnormal((typename std::__promote<_A1>::type)__x); } #endif // isnormal @@ -471,13 +471,14 @@ template inline _LIBCPP_INLINE_VISIBILITY typename std::enable_if < - std::is_floating_point<_A1>::value && - std::is_floating_point<_A2>::value, + std::is_arithmetic<_A1>::value && + std::is_arithmetic<_A2>::value, bool >::type isgreater(_A1 __x, _A2 __y) _NOEXCEPT { - return __libcpp_isgreater(__x, __y); + typedef typename std::__promote<_A1, _A2>::type type; + return __libcpp_isgreater((type)__x, (type)__y); } #endif // isgreater @@ -500,13 +501,14 @@ template inline _LIBCPP_INLINE_VISIBILITY typename std::enable_if < - std::is_floating_point<_A1>::value && - std::is_floating_point<_A2>::value, + std::is_arithmetic<_A1>::value && + std::is_arithmetic<_A2>::value, bool >::type isgreaterequal(_A1 __x, _A2 __y) _NOEXCEPT { - return __libcpp_isgreaterequal(__x, __y); + typedef typename std::__promote<_A1, _A2>::type type; + return __libcpp_isgreaterequal((type)__x, (type)__y); } #endif // isgreaterequal @@ -529,13 +531,14 @@ template inline _LIBCPP_INLINE_VISIBILITY typename std::enable_if < - std::is_floating_point<_A1>::value && - std::is_floating_point<_A2>::value, + std::is_arithmetic<_A1>::value && + std::is_arithmetic<_A2>::value, bool >::type isless(_A1 __x, _A2 __y) _NOEXCEPT { - return __libcpp_isless(__x, __y); + typedef typename std::__promote<_A1, _A2>::type type; + return __libcpp_isless((type)__x, (type)__y); } #endif // isless @@ -558,13 +561,14 @@ template inline _LIBCPP_INLINE_VISIBILITY typename std::enable_if < - std::is_floating_point<_A1>::value && - std::is_floating_point<_A2>::value, + std::is_arithmetic<_A1>::value && + std::is_arithmetic<_A2>::value, bool >::type islessequal(_A1 __x, _A2 __y) _NOEXCEPT { - return __libcpp_islessequal(__x, __y); + typedef typename std::__promote<_A1, _A2>::type type; + return __libcpp_islessequal((type)__x, (type)__y); } #endif // islessequal @@ -587,13 +591,14 @@ template inline _LIBCPP_INLINE_VISIBILITY typename std::enable_if < - std::is_floating_point<_A1>::value && - std::is_floating_point<_A2>::value, + std::is_arithmetic<_A1>::value && + std::is_arithmetic<_A2>::value, bool >::type islessgreater(_A1 __x, _A2 __y) _NOEXCEPT { - return __libcpp_islessgreater(__x, __y); + typedef typename std::__promote<_A1, _A2>::type type; + return __libcpp_islessgreater((type)__x, (type)__y); } #endif // islessgreater @@ -616,13 +621,14 @@ template inline _LIBCPP_INLINE_VISIBILITY typename std::enable_if < - std::is_floating_point<_A1>::value && - std::is_floating_point<_A2>::value, + std::is_arithmetic<_A1>::value && + std::is_arithmetic<_A2>::value, bool >::type isunordered(_A1 __x, _A2 __y) _NOEXCEPT { - return __libcpp_isunordered(__x, __y); + typedef typename std::__promote<_A1, _A2>::type type; + return __libcpp_isunordered((type)__x, (type)__y); } #endif // isunordered Modified: head/contrib/libc++/include/functional ============================================================================== --- head/contrib/libc++/include/functional Thu Feb 7 15:37:51 2013 (r246486) +++ head/contrib/libc++/include/functional Thu Feb 7 15:45:28 2013 (r246487) @@ -1088,7 +1088,7 @@ class _LIBCPP_VISIBLE function<_Rp(_ArgT public __function::__maybe_derive_from_binary_function<_Rp(_ArgTypes...)> { typedef __function::__base<_Rp(_ArgTypes...)> __base; - aligned_storage<3*sizeof(void*)>::type __buf_; + typename aligned_storage<3*sizeof(void*)>::type __buf_; __base* __f_; template Modified: head/contrib/libc++/include/future ============================================================================== --- head/contrib/libc++/include/future Thu Feb 7 15:37:51 2013 (r246486) +++ head/contrib/libc++/include/future Thu Feb 7 15:45:28 2013 (r246487) @@ -470,7 +470,11 @@ public: {return (__state_ & __constructed) || (__exception_ != nullptr);} _LIBCPP_INLINE_VISIBILITY - void __set_future_attached() {__state_ |= __future_attached;} + void __set_future_attached() + { + lock_guard __lk(__mut_); + __state_ |= __future_attached; + } _LIBCPP_INLINE_VISIBILITY bool __has_future_attached() const {return __state_ & __future_attached;} @@ -1753,7 +1757,7 @@ template class __packaged_task_function<_Rp(_ArgTypes...)> { typedef __packaged_task_base<_Rp(_ArgTypes...)> __base; - aligned_storage<3*sizeof(void*)>::type __buf_; + typename aligned_storage<3*sizeof(void*)>::type __buf_; __base* __f_; public: Modified: head/contrib/libc++/include/istream ============================================================================== --- head/contrib/libc++/include/istream Thu Feb 7 15:37:51 2013 (r246486) +++ head/contrib/libc++/include/istream Thu Feb 7 15:45:28 2013 (r246487) @@ -1243,6 +1243,7 @@ template streamsize basic_istream<_CharT, _Traits>::readsome(char_type* __s, streamsize __n) { + __gc_ = 0; streamsize __c = this->rdbuf()->in_avail(); switch (__c) { Modified: head/contrib/libc++/include/iterator ============================================================================== --- head/contrib/libc++/include/iterator Thu Feb 7 15:37:51 2013 (r246486) +++ head/contrib/libc++/include/iterator Thu Feb 7 15:45:28 2013 (r246487) @@ -822,9 +822,9 @@ private: public: _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR istreambuf_iterator() _NOEXCEPT : __sbuf_(0) {} _LIBCPP_INLINE_VISIBILITY istreambuf_iterator(istream_type& __s) _NOEXCEPT - : __sbuf_(__s.rdbuf()) {__test_for_eof();} + : __sbuf_(__s.rdbuf()) {} _LIBCPP_INLINE_VISIBILITY istreambuf_iterator(streambuf_type* __s) _NOEXCEPT - : __sbuf_(__s) {__test_for_eof();} + : __sbuf_(__s) {} _LIBCPP_INLINE_VISIBILITY istreambuf_iterator(const __proxy& __p) _NOEXCEPT : __sbuf_(__p.__sbuf_) {} Modified: head/contrib/libc++/include/limits ============================================================================== --- head/contrib/libc++/include/limits Thu Feb 7 15:37:51 2013 (r246486) +++ head/contrib/libc++/include/limits Thu Feb 7 15:45:28 2013 (r246487) @@ -479,6 +479,53 @@ public: }; template + _LIBCPP_CONSTEXPR const bool numeric_limits<_Tp>::is_specialized; +template + _LIBCPP_CONSTEXPR const int numeric_limits<_Tp>::digits; +template + _LIBCPP_CONSTEXPR const int numeric_limits<_Tp>::digits10; +template + _LIBCPP_CONSTEXPR const int numeric_limits<_Tp>::max_digits10; +template + _LIBCPP_CONSTEXPR const bool numeric_limits<_Tp>::is_signed; +template + _LIBCPP_CONSTEXPR const bool numeric_limits<_Tp>::is_integer; +template + _LIBCPP_CONSTEXPR const bool numeric_limits<_Tp>::is_exact; +template + _LIBCPP_CONSTEXPR const int numeric_limits<_Tp>::radix; +template + _LIBCPP_CONSTEXPR const int numeric_limits<_Tp>::min_exponent; +template + _LIBCPP_CONSTEXPR const int numeric_limits<_Tp>::min_exponent10; +template + _LIBCPP_CONSTEXPR const int numeric_limits<_Tp>::max_exponent; +template + _LIBCPP_CONSTEXPR const int numeric_limits<_Tp>::max_exponent10; +template + _LIBCPP_CONSTEXPR const bool numeric_limits<_Tp>::has_infinity; +template + _LIBCPP_CONSTEXPR const bool numeric_limits<_Tp>::has_quiet_NaN; +template + _LIBCPP_CONSTEXPR const bool numeric_limits<_Tp>::has_signaling_NaN; +template + _LIBCPP_CONSTEXPR const float_denorm_style numeric_limits<_Tp>::has_denorm; +template + _LIBCPP_CONSTEXPR const bool numeric_limits<_Tp>::has_denorm_loss; +template + _LIBCPP_CONSTEXPR const bool numeric_limits<_Tp>::is_iec559; +template + _LIBCPP_CONSTEXPR const bool numeric_limits<_Tp>::is_bounded; +template + _LIBCPP_CONSTEXPR const bool numeric_limits<_Tp>::is_modulo; +template + _LIBCPP_CONSTEXPR const bool numeric_limits<_Tp>::traps; +template + _LIBCPP_CONSTEXPR const bool numeric_limits<_Tp>::tinyness_before; +template + _LIBCPP_CONSTEXPR const float_round_style numeric_limits<_Tp>::round_style; + +template class _LIBCPP_VISIBLE numeric_limits : private numeric_limits<_Tp> { @@ -525,6 +572,53 @@ public: }; template + _LIBCPP_CONSTEXPR const bool numeric_limits::is_specialized; +template + _LIBCPP_CONSTEXPR const int numeric_limits::digits; +template + _LIBCPP_CONSTEXPR const int numeric_limits::digits10; +template + _LIBCPP_CONSTEXPR const int numeric_limits::max_digits10; +template + _LIBCPP_CONSTEXPR const bool numeric_limits::is_signed; +template + _LIBCPP_CONSTEXPR const bool numeric_limits::is_integer; +template + _LIBCPP_CONSTEXPR const bool numeric_limits::is_exact; +template + _LIBCPP_CONSTEXPR const int numeric_limits::radix; +template + _LIBCPP_CONSTEXPR const int numeric_limits::min_exponent; +template + _LIBCPP_CONSTEXPR const int numeric_limits::min_exponent10; +template + _LIBCPP_CONSTEXPR const int numeric_limits::max_exponent; +template + _LIBCPP_CONSTEXPR const int numeric_limits::max_exponent10; +template + _LIBCPP_CONSTEXPR const bool numeric_limits::has_infinity; +template + _LIBCPP_CONSTEXPR const bool numeric_limits::has_quiet_NaN; +template + _LIBCPP_CONSTEXPR const bool numeric_limits::has_signaling_NaN; +template + _LIBCPP_CONSTEXPR const float_denorm_style numeric_limits::has_denorm; +template + _LIBCPP_CONSTEXPR const bool numeric_limits::has_denorm_loss; +template + _LIBCPP_CONSTEXPR const bool numeric_limits::is_iec559; +template + _LIBCPP_CONSTEXPR const bool numeric_limits::is_bounded; +template + _LIBCPP_CONSTEXPR const bool numeric_limits::is_modulo; +template + _LIBCPP_CONSTEXPR const bool numeric_limits::traps; +template + _LIBCPP_CONSTEXPR const bool numeric_limits::tinyness_before; +template + _LIBCPP_CONSTEXPR const float_round_style numeric_limits::round_style; + +template class _LIBCPP_VISIBLE numeric_limits : private numeric_limits<_Tp> { @@ -571,6 +665,53 @@ public: }; template + _LIBCPP_CONSTEXPR const bool numeric_limits::is_specialized; +template + _LIBCPP_CONSTEXPR const int numeric_limits::digits; +template + _LIBCPP_CONSTEXPR const int numeric_limits::digits10; +template + _LIBCPP_CONSTEXPR const int numeric_limits::max_digits10; +template + _LIBCPP_CONSTEXPR const bool numeric_limits::is_signed; +template + _LIBCPP_CONSTEXPR const bool numeric_limits::is_integer; +template + _LIBCPP_CONSTEXPR const bool numeric_limits::is_exact; +template + _LIBCPP_CONSTEXPR const int numeric_limits::radix; +template + _LIBCPP_CONSTEXPR const int numeric_limits::min_exponent; +template + _LIBCPP_CONSTEXPR const int numeric_limits::min_exponent10; +template + _LIBCPP_CONSTEXPR const int numeric_limits::max_exponent; +template + _LIBCPP_CONSTEXPR const int numeric_limits::max_exponent10; +template + _LIBCPP_CONSTEXPR const bool numeric_limits::has_infinity; +template + _LIBCPP_CONSTEXPR const bool numeric_limits::has_quiet_NaN; +template + _LIBCPP_CONSTEXPR const bool numeric_limits::has_signaling_NaN; +template + _LIBCPP_CONSTEXPR const float_denorm_style numeric_limits::has_denorm; +template + _LIBCPP_CONSTEXPR const bool numeric_limits::has_denorm_loss; +template + _LIBCPP_CONSTEXPR const bool numeric_limits::is_iec559; +template + _LIBCPP_CONSTEXPR const bool numeric_limits::is_bounded; +template + _LIBCPP_CONSTEXPR const bool numeric_limits::is_modulo; +template + _LIBCPP_CONSTEXPR const bool numeric_limits::traps; +template + _LIBCPP_CONSTEXPR const bool numeric_limits::tinyness_before; +template + _LIBCPP_CONSTEXPR const float_round_style numeric_limits::round_style; + +template class _LIBCPP_VISIBLE numeric_limits : private numeric_limits<_Tp> { @@ -616,6 +757,53 @@ public: static _LIBCPP_CONSTEXPR const float_round_style round_style = __base::round_style; }; +template + _LIBCPP_CONSTEXPR const bool numeric_limits::is_specialized; +template + _LIBCPP_CONSTEXPR const int numeric_limits::digits; +template + _LIBCPP_CONSTEXPR const int numeric_limits::digits10; +template + const int numeric_limits::max_digits10; +template + _LIBCPP_CONSTEXPR const bool numeric_limits::is_signed; +template + _LIBCPP_CONSTEXPR const bool numeric_limits::is_integer; +template + _LIBCPP_CONSTEXPR const bool numeric_limits::is_exact; +template + _LIBCPP_CONSTEXPR const int numeric_limits::radix; +template + _LIBCPP_CONSTEXPR const int numeric_limits::min_exponent; +template + _LIBCPP_CONSTEXPR const int numeric_limits::min_exponent10; +template + _LIBCPP_CONSTEXPR const int numeric_limits::max_exponent; +template + _LIBCPP_CONSTEXPR const int numeric_limits::max_exponent10; +template + _LIBCPP_CONSTEXPR const bool numeric_limits::has_infinity; +template + _LIBCPP_CONSTEXPR const bool numeric_limits::has_quiet_NaN; +template + _LIBCPP_CONSTEXPR const bool numeric_limits::has_signaling_NaN; +template + _LIBCPP_CONSTEXPR const float_denorm_style numeric_limits::has_denorm; +template + _LIBCPP_CONSTEXPR const bool numeric_limits::has_denorm_loss; +template + _LIBCPP_CONSTEXPR const bool numeric_limits::is_iec559; +template + _LIBCPP_CONSTEXPR const bool numeric_limits::is_bounded; +template + _LIBCPP_CONSTEXPR const bool numeric_limits::is_modulo; +template + _LIBCPP_CONSTEXPR const bool numeric_limits::traps; +template + _LIBCPP_CONSTEXPR const bool numeric_limits::tinyness_before; +template + _LIBCPP_CONSTEXPR const float_round_style numeric_limits::round_style; + _LIBCPP_END_NAMESPACE_STD #endif // _LIBCPP_LIMITS Modified: head/contrib/libc++/include/locale ============================================================================== --- head/contrib/libc++/include/locale Thu Feb 7 15:37:51 2013 (r246486) +++ head/contrib/libc++/include/locale Thu Feb 7 15:45:28 2013 (r246487) @@ -354,7 +354,7 @@ size_t __mbsrtowcs_l(wchar_t *__dest, co #endif } -_LIBCPP_ALWAYS_INLINE inline +inline int __sprintf_l(char *__s, locale_t __l, const char *__format, ...) { va_list __va; va_start(__va, __format); @@ -368,7 +368,7 @@ int __sprintf_l(char *__s, locale_t __l, return __res; } -_LIBCPP_ALWAYS_INLINE inline +inline int __snprintf_l(char *__s, size_t __n, locale_t __l, const char *__format, ...) { va_list __va; va_start(__va, __format); @@ -382,7 +382,7 @@ int __snprintf_l(char *__s, size_t __n, return __res; } -_LIBCPP_ALWAYS_INLINE inline +inline int __asprintf_l(char **__s, locale_t __l, const char *__format, ...) { va_list __va; va_start(__va, __format); @@ -396,7 +396,7 @@ int __asprintf_l(char **__s, locale_t __ return __res; } -_LIBCPP_ALWAYS_INLINE inline +inline int __sscanf_l(const char *__s, locale_t __l, const char *__format, ...) { va_list __va; va_start(__va, __format); @@ -830,11 +830,11 @@ __num_get_signed_integral(const char* __ { if (__a != __a_end) { - int __save_errno = errno; + typename remove_reference::type __save_errno = errno; errno = 0; char *__p2; long long __ll = strtoll_l(__a, &__p2, __base, _LIBCPP_GET_C_LOCALE); - int __current_errno = errno; + typename remove_reference::type __current_errno = errno; if (__current_errno == 0) errno = __save_errno; if (__p2 != __a_end) @@ -870,11 +870,11 @@ __num_get_unsigned_integral(const char* __err = ios_base::failbit; return 0; } - int __save_errno = errno; + typename remove_reference::type __save_errno = errno; errno = 0; char *__p2; unsigned long long __ll = strtoull_l(__a, &__p2, __base, _LIBCPP_GET_C_LOCALE); - int __current_errno = errno; + typename remove_reference::type __current_errno = errno; if (__current_errno == 0) errno = __save_errno; if (__p2 != __a_end) @@ -2895,6 +2895,10 @@ template ::id; +template +const bool +moneypunct<_CharT, _International>::intl; + _LIBCPP_EXTERN_TEMPLATE(class moneypunct) _LIBCPP_EXTERN_TEMPLATE(class moneypunct) _LIBCPP_EXTERN_TEMPLATE(class moneypunct) Modified: head/contrib/libc++/include/memory ============================================================================== --- head/contrib/libc++/include/memory Thu Feb 7 15:37:51 2013 (r246486) +++ head/contrib/libc++/include/memory Thu Feb 7 15:45:28 2013 (r246487) @@ -1571,7 +1571,10 @@ struct _LIBCPP_VISIBLE allocator_traits __construct_backward(allocator_type& __a, _Ptr __begin1, _Ptr __end1, _Ptr& __end2) { while (__end1 != __begin1) - construct(__a, _VSTD::__to_raw_pointer(--__end2), _VSTD::move_if_noexcept(*--__end1)); + { + construct(__a, _VSTD::__to_raw_pointer(__end2-1), _VSTD::move_if_noexcept(*--__end1)); + --__end2; + } } template Modified: head/contrib/libc++/include/ostream ============================================================================== --- head/contrib/libc++/include/ostream Thu Feb 7 15:37:51 2013 (r246486) +++ head/contrib/libc++/include/ostream Thu Feb 7 15:45:28 2013 (r246487) @@ -1100,17 +1100,8 @@ basic_ostream<_CharT, _Traits>::write(co sentry __sen(*this); if (__sen && __n) { - typedef ostreambuf_iterator<_CharT, _Traits> _Op; - _Op __o(*this); - for (; __n; --__n, ++__o, ++__s) - { - *__o = *__s; - if (__o.failed()) - { - this->setstate(ios_base::badbit); - break; - } - } + if (this->rdbuf()->sputn(__s, __n) != __n) + this->setstate(ios_base::badbit); } #ifndef _LIBCPP_NO_EXCEPTIONS } Modified: head/contrib/libc++/include/random ============================================================================== --- head/contrib/libc++/include/random Thu Feb 7 15:37:51 2013 (r246486) +++ head/contrib/libc++/include/random Thu Feb 7 15:45:28 2013 (r246487) @@ -1931,6 +1931,22 @@ private: }; template + _LIBCPP_CONSTEXPR const typename linear_congruential_engine<_UIntType, __a, __c, __m>::result_type + linear_congruential_engine<_UIntType, __a, __c, __m>::multiplier; + +template + _LIBCPP_CONSTEXPR const typename linear_congruential_engine<_UIntType, __a, __c, __m>::result_type + linear_congruential_engine<_UIntType, __a, __c, __m>::increment; + +template + _LIBCPP_CONSTEXPR const typename linear_congruential_engine<_UIntType, __a, __c, __m>::result_type + linear_congruential_engine<_UIntType, __a, __c, __m>::modulus; + +template + _LIBCPP_CONSTEXPR const typename linear_congruential_engine<_UIntType, __a, __c, __m>::result_type + linear_congruential_engine<_UIntType, __a, __c, __m>::default_seed; + +template template void linear_congruential_engine<_UIntType, __a, __c, __m>::__seed(_Sseq& __q, @@ -2230,6 +2246,90 @@ private: template + _LIBCPP_CONSTEXPR const size_t + mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d, __s, __b, __t, __c, __l, __f>::word_size; + +template + _LIBCPP_CONSTEXPR const size_t + mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d, __s, __b, __t, __c, __l, __f>::state_size; + +template + _LIBCPP_CONSTEXPR const size_t + mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d, __s, __b, __t, __c, __l, __f>::shift_size; + +template + _LIBCPP_CONSTEXPR const size_t + mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d, __s, __b, __t, __c, __l, __f>::mask_bits; + +template + _LIBCPP_CONSTEXPR const typename mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d, __s, __b, __t, __c, __l, __f>::result_type + mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d, __s, __b, __t, __c, __l, __f>::xor_mask; + +template + _LIBCPP_CONSTEXPR const size_t + mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d, __s, __b, __t, __c, __l, __f>::tempering_u; + +template + _LIBCPP_CONSTEXPR const typename mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d, __s, __b, __t, __c, __l, __f>::result_type + mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d, __s, __b, __t, __c, __l, __f>::tempering_d; + +template + _LIBCPP_CONSTEXPR const size_t + mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d, __s, __b, __t, __c, __l, __f>::tempering_s; + +template + _LIBCPP_CONSTEXPR const typename mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d, __s, __b, __t, __c, __l, __f>::result_type + mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d, __s, __b, __t, __c, __l, __f>::tempering_b; + +template + _LIBCPP_CONSTEXPR const size_t + mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d, __s, __b, __t, __c, __l, __f>::tempering_t; + +template + _LIBCPP_CONSTEXPR const typename mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d, __s, __b, __t, __c, __l, __f>::result_type + mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d, __s, __b, __t, __c, __l, __f>::tempering_c; + +template + _LIBCPP_CONSTEXPR const size_t + mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d, __s, __b, __t, __c, __l, __f>::tempering_l; + +template + _LIBCPP_CONSTEXPR const typename mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d, __s, __b, __t, __c, __l, __f>::result_type + mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d, __s, __b, __t, __c, __l, __f>::initialization_multiplier; + +template + _LIBCPP_CONSTEXPR const typename mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d, __s, __b, __t, __c, __l, __f>::result_type + mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d, __s, __b, __t, __c, __l, __f>::default_seed; + +template void mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d, __s, __b, __t, __c, __l, __f>::seed(result_type __sd) @@ -2552,6 +2652,19 @@ private: }; template + _LIBCPP_CONSTEXPR const size_t subtract_with_carry_engine<_UIntType, __w, __s, __r>::word_size; + +template + _LIBCPP_CONSTEXPR const size_t subtract_with_carry_engine<_UIntType, __w, __s, __r>::short_lag; + +template + _LIBCPP_CONSTEXPR const size_t subtract_with_carry_engine<_UIntType, __w, __s, __r>::long_lag; + +template + _LIBCPP_CONSTEXPR const typename subtract_with_carry_engine<_UIntType, __w, __s, __r>::result_type + subtract_with_carry_engine<_UIntType, __w, __s, __r>::default_seed; + +template void subtract_with_carry_engine<_UIntType, __w, __s, __r>::seed(result_type __sd, integral_constant) @@ -2823,6 +2936,12 @@ public: }; template + _LIBCPP_CONSTEXPR const size_t discard_block_engine<_Engine, __p, __r>::block_size; + +template + _LIBCPP_CONSTEXPR const size_t discard_block_engine<_Engine, __p, __r>::used_block; + +template typename discard_block_engine<_Engine, __p, __r>::result_type discard_block_engine<_Engine, __p, __r>::operator()() { @@ -3314,6 +3433,9 @@ private: } }; +template + _LIBCPP_CONSTEXPR const size_t shuffle_order_engine<_Engine, __k>::table_size; + template bool operator==( Modified: head/contrib/libc++/include/regex ============================================================================== --- head/contrib/libc++/include/regex Thu Feb 7 15:37:51 2013 (r246486) +++ head/contrib/libc++/include/regex Thu Feb 7 15:45:28 2013 (r246487) @@ -2843,6 +2843,27 @@ private: }; template + const regex_constants::syntax_option_type basic_regex<_CharT, _Traits>::icase; +template + const regex_constants::syntax_option_type basic_regex<_CharT, _Traits>::nosubs; +template + const regex_constants::syntax_option_type basic_regex<_CharT, _Traits>::optimize; +template + const regex_constants::syntax_option_type basic_regex<_CharT, _Traits>::collate; +template + const regex_constants::syntax_option_type basic_regex<_CharT, _Traits>::ECMAScript; +template + const regex_constants::syntax_option_type basic_regex<_CharT, _Traits>::basic; +template + const regex_constants::syntax_option_type basic_regex<_CharT, _Traits>::extended; +template + const regex_constants::syntax_option_type basic_regex<_CharT, _Traits>::awk; +template + const regex_constants::syntax_option_type basic_regex<_CharT, _Traits>::grep; +template + const regex_constants::syntax_option_type basic_regex<_CharT, _Traits>::egrep; + +template void basic_regex<_CharT, _Traits>::swap(basic_regex& __r) { Modified: head/contrib/libc++/include/string ============================================================================== --- head/contrib/libc++/include/string Thu Feb 7 15:37:51 2013 (r246486) +++ head/contrib/libc++/include/string Thu Feb 7 15:45:28 2013 (r246487) @@ -3374,7 +3374,7 @@ basic_string<_CharT, _Traits, _Allocator { const_pointer __p = data(); const_pointer __pe = __p + __sz; - for (const_pointer __ps = __p + __pos; __p != __pe; ++__ps) + for (const_pointer __ps = __p + __pos; __ps != __pe; ++__ps) if (!traits_type::eq(*__ps, __c)) return static_cast(__ps - __p); } Modified: head/contrib/libc++/include/type_traits ============================================================================== --- head/contrib/libc++/include/type_traits Thu Feb 7 15:37:51 2013 (r246486) +++ head/contrib/libc++/include/type_traits Thu Feb 7 15:45:28 2013 (r246487) @@ -617,7 +617,28 @@ struct _LIBCPP_VISIBLE is_base_of #else // __has_feature(is_base_of) -#error is_base_of not implemented. +namespace __is_base_of_imp +{ +template +struct _Dst +{ + _Dst(const volatile _Tp &); +}; +template +struct _Src +{ + operator const volatile _Tp &(); + template operator const _Dst<_Up> &(); +}; +template struct __one { typedef char type; }; +template typename __one(declval<_Src<_Dp> >()))>::type __test(int); +template __two __test(...); +} + +template +struct _LIBCPP_VISIBLE is_base_of + : public integral_constant::value && + sizeof(__is_base_of_imp::__test<_Bp, _Dp>(0)) == 2> {}; #endif // __has_feature(is_base_of) Modified: head/contrib/libc++/include/vector ============================================================================== --- head/contrib/libc++/include/vector Thu Feb 7 15:37:51 2013 (r246486) +++ head/contrib/libc++/include/vector Thu Feb 7 15:45:28 2013 (r246487) @@ -1458,7 +1458,8 @@ vector<_Tp, _Allocator>::__push_back_slo allocator_type& __a = this->__alloc(); __split_buffer __v(__recommend(size() + 1), size(), __a); // __v.push_back(_VSTD::forward<_Up>(__x)); - __alloc_traits::construct(__a, _VSTD::__to_raw_pointer(__v.__end_++), _VSTD::forward<_Up>(__x)); + __alloc_traits::construct(__a, _VSTD::__to_raw_pointer(__v.__end_), _VSTD::forward<_Up>(__x)); + __v.__end_++; __swap_out_circular_buffer(__v); } @@ -1505,7 +1506,8 @@ vector<_Tp, _Allocator>::__emplace_back_ allocator_type& __a = this->__alloc(); __split_buffer __v(__recommend(size() + 1), size(), __a); // __v.emplace_back(_VSTD::forward<_Args>(__args)...); - __alloc_traits::construct(__a, _VSTD::__to_raw_pointer(__v.__end_++), _VSTD::forward<_Args>(__args)...); + __alloc_traits::construct(__a, _VSTD::__to_raw_pointer(__v.__end_), _VSTD::forward<_Args>(__args)...); + __v.__end_++; __swap_out_circular_buffer(__v); } Modified: head/contrib/libc++/src/chrono.cpp ============================================================================== --- head/contrib/libc++/src/chrono.cpp Thu Feb 7 15:37:51 2013 (r246486) +++ head/contrib/libc++/src/chrono.cpp Thu Feb 7 15:45:28 2013 (r246487) @@ -24,6 +24,8 @@ namespace chrono // system_clock +const bool system_clock::is_steady; + system_clock::time_point system_clock::now() _NOEXCEPT { @@ -46,6 +48,8 @@ system_clock::from_time_t(time_t t) _NOE // steady_clock +const bool steady_clock::is_steady; + #if __APPLE__ *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@FreeBSD.ORG Thu Feb 7 19:00:55 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 0BBE5368; Thu, 7 Feb 2013 19:00:55 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id F1D1673C; Thu, 7 Feb 2013 19:00:54 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r17J0sgM067525; Thu, 7 Feb 2013 19:00:54 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r17J0sau067524; Thu, 7 Feb 2013 19:00:54 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <201302071900.r17J0sau067524@svn.freebsd.org> From: Xin LI Date: Thu, 7 Feb 2013 19:00:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r246495 - head/bin/sh X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Feb 2013 19:00:55 -0000 Author: delphij Date: Thu Feb 7 19:00:54 2013 New Revision: 246495 URL: http://svnweb.freebsd.org/changeset/base/246495 Log: Catch TRACE parameters up with r238888. This change is only needed when debugging is enabled. Modified: head/bin/sh/jobs.c Modified: head/bin/sh/jobs.c ============================================================================== --- head/bin/sh/jobs.c Thu Feb 7 18:47:25 2013 (r246494) +++ head/bin/sh/jobs.c Thu Feb 7 19:00:54 2013 (r246495) @@ -1030,7 +1030,7 @@ dowait(int mode, struct job *job) int wflags; int restore_sigchld; - TRACE(("dowait(%d) called\n", block)); + TRACE(("dowait(%d, %p) called\n", mode, job)); restore_sigchld = 0; if ((mode & DOWAIT_SIG) != 0) { sigfillset(&mask); From owner-svn-src-head@FreeBSD.ORG Thu Feb 7 19:43:35 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id CE1C437B; Thu, 7 Feb 2013 19:43:35 +0000 (UTC) (envelope-from chagin.dmitry@gmail.com) Received: from mail-lb0-f170.google.com (mail-lb0-f170.google.com [209.85.217.170]) by mx1.freebsd.org (Postfix) with ESMTP id B68F395C; Thu, 7 Feb 2013 19:43:34 +0000 (UTC) Received: by mail-lb0-f170.google.com with SMTP id ge1so2421134lbb.15 for ; Thu, 07 Feb 2013 11:43:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:date:from:to:cc:subject:message-id:references :mime-version:content-type:content-disposition:in-reply-to :user-agent; bh=/zeVNa5K/ciMT0EnHadbeqB6epYfvBZqCp1C95Lcvw4=; b=kPWG5KxHYtML8tTKBcNKDbfQX1QbP/V4HpqW6STx2iwyAqAcTcfuLSjVpd7gxVQ1kW cO5+I+xRKGS5V9iXrTRVhSZJP2eomry5oypK7Rr53bLlvnGFpmaKynaDwVwspPc0gCm0 5ehp4dh/fVqQDFnPlgYfb0zLHq53klD3Co7mGQTVwd1lyTOv1+5ICQ48TMweXmVJZw1S l1gBVSyJ57oylJXsrKVfP5ZRUNwB9mNS+W470JE4nntXsvFs5jTHkzKaUNgRUboL+mgg 0IPkpaCKa4Sz/vjxhNvXvcesepMOXG+05J3EYxAEeH6Fdx/jOwLEzFMXvbYNwyoJ1t+E 0wHw== X-Received: by 10.112.17.166 with SMTP id p6mr1259444lbd.41.1360266213066; Thu, 07 Feb 2013 11:43:33 -0800 (PST) Received: from dchagin.static.corbina.net (dchagin.static.corbina.ru. [78.107.232.239]) by mx.google.com with ESMTPS id b3sm9293101lbl.0.2013.02.07.11.43.30 (version=TLSv1.2 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 07 Feb 2013 11:43:31 -0800 (PST) Received: from dchagin.static.corbina.net (localhost [127.0.0.1]) by dchagin.static.corbina.net (8.14.6/8.14.6) with ESMTP id r17JhTue031386; Thu, 7 Feb 2013 23:43:29 +0400 (MSK) (envelope-from dchagin@dchagin.static.corbina.net) Received: (from dchagin@localhost) by dchagin.static.corbina.net (8.14.6/8.14.6/Submit) id r17JhTl7031385; Thu, 7 Feb 2013 23:43:29 +0400 (MSK) (envelope-from dchagin) Date: Thu, 7 Feb 2013 23:43:28 +0400 From: Chagin Dmitry To: John Baldwin Subject: Re: svn commit: r246085 - in head/sys: amd64/linux32 compat/linprocfs compat/linux i386/linux Message-ID: <20130207194328.GA31364@dchagin.static.corbina.net> References: <201301291841.r0TIfUxs008927@svn.freebsd.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="X1bOJ3K7DJ5YkBrT" Content-Disposition: inline In-Reply-To: <201301291841.r0TIfUxs008927@svn.freebsd.org> User-Agent: Mutt/1.5.21 (2010-09-15) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Feb 2013 19:43:35 -0000 --X1bOJ3K7DJ5YkBrT Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Jan 29, 2013 at 06:41:30PM +0000, John Baldwin wrote: > Author: jhb > Date: Tue Jan 29 18:41:30 2013 > New Revision: 246085 > URL: http://svnweb.freebsd.org/changeset/base/246085 >=20 > Log: > Reduce duplication between i386/linux/linux.h and amd64/linux32/linux.h > by moving bits that are MI out into headers in compat/linux. > =20 > Reviewed by: Chagin Dmitry dmitry | gmail > MFC after: 2 weeks >=20 > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- head/sys/amd64/linux32/linux.h Tue Jan 29 18:22:38 2013 (r246084) > +++ head/sys/amd64/linux32/linux.h Tue Jan 29 18:41:30 2013 (r246085) > @@ -107,11 +107,6 @@ typedef struct { > /* > * Miscellaneous > */ > -#define LINUX_NAME_MAX 255 > -#define LINUX_MAX_UTSNAME 65 > - > -#define LINUX_CTL_MAXNAME 10 > - > #define LINUX_AT_COUNT 16 /* Count of used aux entry types. > * Keep this synchronized with > * elf_linux_fixup() code. > @@ -127,11 +122,6 @@ struct l___sysctl_args > l_ulong __spare[4]; > } __packed; > =20 > -/* Scheduling policies */ > -#define LINUX_SCHED_OTHER 0 > -#define LINUX_SCHED_FIFO 1 > -#define LINUX_SCHED_RR 2 > - > /* Resource limits */ > #define LINUX_RLIMIT_CPU 0 > #define LINUX_RLIMIT_FSIZE 1 > @@ -265,15 +255,6 @@ struct l_statfs64 {=20 > l_int f_spare[6]; > } __packed; > =20 > -struct l_new_utsname { > - char sysname[LINUX_MAX_UTSNAME]; > - char nodename[LINUX_MAX_UTSNAME]; > - char release[LINUX_MAX_UTSNAME]; > - char version[LINUX_MAX_UTSNAME]; > - char machine[LINUX_MAX_UTSNAME]; > - char domainname[LINUX_MAX_UTSNAME]; > -} __packed; > - > /* > * Signalling > */ > @@ -535,27 +516,9 @@ struct l_rt_sigframe { > l_handler_t sf_handler; > } __packed; > =20 > -extern int bsd_to_linux_signal[]; > -extern int linux_to_bsd_signal[]; > extern struct sysentvec elf_linux_sysvec; > =20 > /* > - * Pluggable ioctl handlers > - */ > -struct linux_ioctl_args; > -struct thread; > - > -typedef int linux_ioctl_function_t(struct thread *, struct linux_ioctl_a= rgs *); > - > -struct linux_ioctl_handler { > - linux_ioctl_function_t *func; > - int low, high; > -}; > - > -int linux_ioctl_register_handler(struct linux_ioctl_handler *h); > -int linux_ioctl_unregister_handler(struct linux_ioctl_handler *h); > - > -/* > * open/fcntl flags > */ > #define LINUX_O_RDONLY 00000000 > @@ -597,65 +560,6 @@ int linux_ioctl_unregister_handler(struc > #define LINUX_F_WRLCK 1 > #define LINUX_F_UNLCK 2 > =20 > -/* > - * posix_fadvise advice > - */ > -#define LINUX_POSIX_FADV_NORMAL 0 > -#define LINUX_POSIX_FADV_RANDOM 1 > -#define LINUX_POSIX_FADV_SEQUENTIAL 2 > -#define LINUX_POSIX_FADV_WILLNEED 3 > -#define LINUX_POSIX_FADV_DONTNEED 4 > -#define LINUX_POSIX_FADV_NOREUSE 5 > - > -/* > - * mount flags > - */ > -#define LINUX_MS_RDONLY 0x0001 > -#define LINUX_MS_NOSUID 0x0002 > -#define LINUX_MS_NODEV 0x0004 > -#define LINUX_MS_NOEXEC 0x0008 > -#define LINUX_MS_REMOUNT 0x0020 > - > -/* > - * SystemV IPC defines > - */ > -#define LINUX_SEMOP 1 > -#define LINUX_SEMGET 2 > -#define LINUX_SEMCTL 3 > -#define LINUX_MSGSND 11 > -#define LINUX_MSGRCV 12 > -#define LINUX_MSGGET 13 > -#define LINUX_MSGCTL 14 > -#define LINUX_SHMAT 21 > -#define LINUX_SHMDT 22 > -#define LINUX_SHMGET 23 > -#define LINUX_SHMCTL 24 > - > -#define LINUX_IPC_RMID 0 > -#define LINUX_IPC_SET 1 > -#define LINUX_IPC_STAT 2 > -#define LINUX_IPC_INFO 3 > - > -#define LINUX_SHM_LOCK 11 > -#define LINUX_SHM_UNLOCK 12 > -#define LINUX_SHM_STAT 13 > -#define LINUX_SHM_INFO 14 > - > -#define LINUX_SHM_RDONLY 0x1000 > -#define LINUX_SHM_RND 0x2000 > -#define LINUX_SHM_REMAP 0x4000 > - > -/* semctl commands */ > -#define LINUX_GETPID 11 > -#define LINUX_GETVAL 12 > -#define LINUX_GETALL 13 > -#define LINUX_GETNCNT 14 > -#define LINUX_GETZCNT 15 > -#define LINUX_SETVAL 16 > -#define LINUX_SETALL 17 > -#define LINUX_SEM_STAT 18 > -#define LINUX_SEM_INFO 19 > - > union l_semun { > l_int val; > l_uintptr_t buf; > @@ -667,25 +571,6 @@ union l_semun { > /* > * Socket defines > */ > -#define LINUX_SOCKET 1 > -#define LINUX_BIND 2 > -#define LINUX_CONNECT 3 > -#define LINUX_LISTEN 4 > -#define LINUX_ACCEPT 5 > -#define LINUX_GETSOCKNAME 6 > -#define LINUX_GETPEERNAME 7 > -#define LINUX_SOCKETPAIR 8 > -#define LINUX_SEND 9 > -#define LINUX_RECV 10 > -#define LINUX_SENDTO 11 > -#define LINUX_RECVFROM 12 > -#define LINUX_SHUTDOWN 13 > -#define LINUX_SETSOCKOPT 14 > -#define LINUX_GETSOCKOPT 15 > -#define LINUX_SENDMSG 16 > -#define LINUX_RECVMSG 17 > -#define LINUX_ACCEPT4 18 > - > #define LINUX_SOL_SOCKET 1 > #define LINUX_SOL_IP 0 > #define LINUX_SOL_IPX 256 > @@ -714,24 +599,6 @@ union l_semun { > #define LINUX_SO_TIMESTAMP 29 > #define LINUX_SO_ACCEPTCONN 30 > =20 > -#define LINUX_IP_TOS 1 > -#define LINUX_IP_TTL 2 > -#define LINUX_IP_HDRINCL 3 > -#define LINUX_IP_OPTIONS 4 > - > -#define LINUX_IP_MULTICAST_IF 32 > -#define LINUX_IP_MULTICAST_TTL 33 > -#define LINUX_IP_MULTICAST_LOOP 34 > -#define LINUX_IP_ADD_MEMBERSHIP 35 > -#define LINUX_IP_DROP_MEMBERSHIP 36 > - > -#define LINUX_TCP_NODELAY 1 > -#define LINUX_TCP_MAXSEG 2 > -#define LINUX_TCP_KEEPIDLE 4 > -#define LINUX_TCP_KEEPINTVL 5 > -#define LINUX_TCP_KEEPCNT 6 > -#define LINUX_TCP_MD5SIG 14 > - > struct l_sockaddr { > l_ushort sa_family; > char sa_data[14]; > @@ -897,30 +764,6 @@ struct l_user_desc { > #define LINUX_GET_USEABLE(desc) \ > (((desc)->b >> LINUX_ENTRY_B_USEABLE) & 1) > =20 > -#define LINUX_CLOCK_REALTIME 0 > -#define LINUX_CLOCK_MONOTONIC 1 > -#define LINUX_CLOCK_PROCESS_CPUTIME_ID 2 > -#define LINUX_CLOCK_THREAD_CPUTIME_ID 3 > -#define LINUX_CLOCK_REALTIME_HR 4 > -#define LINUX_CLOCK_MONOTONIC_HR 5 > - > -#define LINUX_CLONE_VM 0x00000100 > -#define LINUX_CLONE_FS 0x00000200 > -#define LINUX_CLONE_FILES 0x00000400 > -#define LINUX_CLONE_SIGHAND 0x00000800 > -#define LINUX_CLONE_PID 0x00001000 /* No longer exist in Linux */ > -#define LINUX_CLONE_VFORK 0x00004000 > -#define LINUX_CLONE_PARENT 0x00008000 > -#define LINUX_CLONE_THREAD 0x00010000 > -#define LINUX_CLONE_SETTLS 0x00080000 > -#define LINUX_CLONE_PARENT_SETTID 0x00100000 > -#define LINUX_CLONE_CHILD_CLEARTID 0x00200000 > -#define LINUX_CLONE_CHILD_SETTID 0x01000000 > - > -#define LINUX_THREADING_FLAGS \ > - (LINUX_CLONE_VM | LINUX_CLONE_FS | LINUX_CLONE_FILES | \ > - LINUX_CLONE_SIGHAND | LINUX_CLONE_THREAD) > - > struct iovec; > =20 > struct l_iovec32 { > @@ -942,7 +785,4 @@ struct linux_robust_list_head { > l_uintptr_t pending_list; > }; > =20 > -int linux_set_upcall_kse(struct thread *td, register_t stack); > -int linux_set_cloned_tls(struct thread *td, void *desc); > - > #endif /* !_AMD64_LINUX_H_ */ >=20 > Modified: head/sys/amd64/linux32/linux32_sysvec.c > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- head/sys/amd64/linux32/linux32_sysvec.c Tue Jan 29 18:22:38 2013 (r24= 6084) > +++ head/sys/amd64/linux32/linux32_sysvec.c Tue Jan 29 18:41:30 2013 (r24= 6085) > @@ -78,6 +78,7 @@ __FBSDID("$FreeBSD$"); > #include > #include > #include > +#include > #include > #include ugh.., moving linux_ioctl_register_handler definition under compat/linux/linux_ioctl.h breaks x11/nvidia-driver build. so, don't merge while port not patched. chd, Have fun! --X1bOJ3K7DJ5YkBrT Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.19 (FreeBSD) iEYEARECAAYFAlEUA+AACgkQ0t2Tb3OO/O0oaACgxURH/0j7u4ZWESQqYjRV3HFX ezkAnjcW+r3SxNrESLbt05UDiTBjtQDb =xPja -----END PGP SIGNATURE----- --X1bOJ3K7DJ5YkBrT-- From owner-svn-src-head@FreeBSD.ORG Thu Feb 7 21:12:56 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id D8B39919; Thu, 7 Feb 2013 21:12:56 +0000 (UTC) (envelope-from monthadar@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id BAA4BE16; Thu, 7 Feb 2013 21:12:56 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r17LCuqL007623; Thu, 7 Feb 2013 21:12:56 GMT (envelope-from monthadar@svn.freebsd.org) Received: (from monthadar@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r17LCuaY007621; Thu, 7 Feb 2013 21:12:56 GMT (envelope-from monthadar@svn.freebsd.org) Message-Id: <201302072112.r17LCuaY007621@svn.freebsd.org> From: Monthadar Al Jaberi Date: Thu, 7 Feb 2013 21:12:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r246497 - head/sys/net80211 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Feb 2013 21:12:56 -0000 Author: monthadar Date: Thu Feb 7 21:12:55 2013 New Revision: 246497 URL: http://svnweb.freebsd.org/changeset/base/246497 Log: Stop a mesh STA from flooding with peer frames. This problem happens when using ACL policy to filter mesh STA but two nodes have different policy. Then one of them will try to peer all the time. This can also help if for any reason one of the peering mesh STA have problems sending/receiving peer frames. * Modified struct ieee80211_node to include two new fields: + struct callout ni_mlhtimer /* link mesh backoff timer */ + uint8_t ni_mlhcnt /* link mesh holding counter */ * Added two new sysctl (check sysctl -d for more info): + net.wlan.mesh.backofftimeout=5000 + net.wlan.mesh.maxholding=2; * When receiving a beacon and we are in IEEE80211_NODE_MESH_IDLE check if ni_mlhcnt >= ieee80211_mesh_maxholding, if so do not do anything; * In mesh_peer_timeout_cb when transitioning from IEEE80211_NODE_MESH_HOLDING to IEEE80211_NODE_MESH_IDLE increment ni_mlhcnt, and eventually start ieee80211_mesh_backofftimeout; Approved by: adrian (mentor) Modified: head/sys/net80211/ieee80211_mesh.c head/sys/net80211/ieee80211_node.h Modified: head/sys/net80211/ieee80211_mesh.c ============================================================================== --- head/sys/net80211/ieee80211_mesh.c Thu Feb 7 19:09:10 2013 (r246496) +++ head/sys/net80211/ieee80211_mesh.c Thu Feb 7 21:12:55 2013 (r246497) @@ -111,10 +111,20 @@ static int ieee80211_mesh_confirmtimeout SYSCTL_PROC(_net_wlan_mesh, OID_AUTO, confirmtimeout, CTLTYPE_INT | CTLFLAG_RW, &ieee80211_mesh_confirmtimeout, 0, ieee80211_sysctl_msecs_ticks, "I", "Confirm state timeout (msec)"); +static int ieee80211_mesh_backofftimeout = -1; +SYSCTL_PROC(_net_wlan_mesh, OID_AUTO, backofftimeout, CTLTYPE_INT | CTLFLAG_RW, + &ieee80211_mesh_backofftimeout, 0, ieee80211_sysctl_msecs_ticks, "I", + "Backoff timeout (msec). This is to throutles peering forever when " + "not receving answer or is rejected by a neighbor"); static int ieee80211_mesh_maxretries = 2; SYSCTL_INT(_net_wlan_mesh, OID_AUTO, maxretries, CTLTYPE_INT | CTLFLAG_RW, &ieee80211_mesh_maxretries, 0, "Maximum retries during peer link establishment"); +static int ieee80211_mesh_maxholding = 2; +SYSCTL_INT(_net_wlan_mesh, OID_AUTO, maxholding, CTLTYPE_INT | CTLFLAG_RW, + &ieee80211_mesh_maxholding, 0, + "Maximum times we are allowed to transition to HOLDING state before " + "backinoff during peer link establishment"); static const uint8_t broadcastaddr[IEEE80211_ADDR_LEN] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }; @@ -500,6 +510,7 @@ ieee80211_mesh_init(void) ieee80211_mesh_retrytimeout = msecs_to_ticks(40); ieee80211_mesh_holdingtimeout = msecs_to_ticks(40); ieee80211_mesh_confirmtimeout = msecs_to_ticks(40); + ieee80211_mesh_backofftimeout = msecs_to_ticks(5000); /* * Register action frame handlers. @@ -1696,7 +1707,6 @@ mesh_recv_mgmt(struct ieee80211_node *ni } /* * Automatically peer with discovered nodes if possible. - * XXX backoff on repeated failure */ if (ni != vap->iv_bss && (ms->ms_flags & IEEE80211_MESHFLAGS_AP)) { @@ -1705,6 +1715,10 @@ mesh_recv_mgmt(struct ieee80211_node *ni { uint16_t args[1]; + /* Wait for backoff callout to reset counter */ + if (ni->ni_mlhcnt >= ieee80211_mesh_maxholding) + return; + ni->ni_mlpid = mesh_generateid(vap); if (ni->ni_mlpid == 0) return; @@ -2578,6 +2592,15 @@ mesh_peer_timeout_stop(struct ieee80211_ callout_drain(&ni->ni_mltimer); } +static void +mesh_peer_backoff_cb(void *arg) +{ + struct ieee80211_node *ni = (struct ieee80211_node *)arg; + + /* After backoff timeout, try to peer automatically again. */ + ni->ni_mlhcnt = 0; +} + /* * Mesh Peer Link Management FSM timeout handling. */ @@ -2625,6 +2648,11 @@ mesh_peer_timeout_cb(void *arg) mesh_peer_timeout_setup(ni); break; case IEEE80211_NODE_MESH_HOLDING: + ni->ni_mlhcnt++; + if (ni->ni_mlhcnt >= ieee80211_mesh_maxholding) + callout_reset(&ni->ni_mlhtimer, + ieee80211_mesh_backofftimeout, + mesh_peer_backoff_cb, ni); mesh_linkchange(ni, IEEE80211_NODE_MESH_IDLE); break; } @@ -2889,6 +2917,7 @@ ieee80211_mesh_node_init(struct ieee8021 { ni->ni_flags |= IEEE80211_NODE_QOS; callout_init(&ni->ni_mltimer, CALLOUT_MPSAFE); + callout_init(&ni->ni_mlhtimer, CALLOUT_MPSAFE); } /* @@ -2901,6 +2930,7 @@ ieee80211_mesh_node_cleanup(struct ieee8 struct ieee80211_mesh_state *ms = vap->iv_mesh; callout_drain(&ni->ni_mltimer); + callout_drain(&ni->ni_mlhtimer); /* NB: short-circuit callbacks after mesh_vdetach */ if (vap->iv_mesh != NULL) ms->ms_ppath->mpp_peerdown(ni); Modified: head/sys/net80211/ieee80211_node.h ============================================================================== --- head/sys/net80211/ieee80211_node.h Thu Feb 7 19:09:10 2013 (r246496) +++ head/sys/net80211/ieee80211_node.h Thu Feb 7 21:12:55 2013 (r246497) @@ -204,6 +204,8 @@ struct ieee80211_node { struct callout ni_mltimer; /* link mesh timer */ uint8_t ni_mlrcnt; /* link mesh retry counter */ uint8_t ni_mltval; /* link mesh timer value */ + struct callout ni_mlhtimer; /* link mesh backoff timer */ + uint8_t ni_mlhcnt; /* link mesh holding counter */ /* 11n state */ uint16_t ni_htcap; /* HT capabilities */ From owner-svn-src-head@FreeBSD.ORG Thu Feb 7 21:17:35 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id B1864C92; Thu, 7 Feb 2013 21:17:35 +0000 (UTC) (envelope-from monthadar@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id A1D01E63; Thu, 7 Feb 2013 21:17:35 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r17LHZfj008389; Thu, 7 Feb 2013 21:17:35 GMT (envelope-from monthadar@svn.freebsd.org) Received: (from monthadar@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r17LHZ7Z008388; Thu, 7 Feb 2013 21:17:35 GMT (envelope-from monthadar@svn.freebsd.org) Message-Id: <201302072117.r17LHZ7Z008388@svn.freebsd.org> From: Monthadar Al Jaberi Date: Thu, 7 Feb 2013 21:17:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r246498 - head/sys/net80211 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Feb 2013 21:17:35 -0000 Author: monthadar Date: Thu Feb 7 21:17:35 2013 New Revision: 246498 URL: http://svnweb.freebsd.org/changeset/base/246498 Log: Fix mesh path flag. * A bug occurs while in discovery mode which leaves a path marked with both Discover and Valid flag. This happens when receiving/sending PREQ and PREP in a particular order. Solution is to assign the Valid bit instead of oring it; Approved by: adrian (mentor) Modified: head/sys/net80211/ieee80211_hwmp.c Modified: head/sys/net80211/ieee80211_hwmp.c ============================================================================== --- head/sys/net80211/ieee80211_hwmp.c Thu Feb 7 21:12:55 2013 (r246497) +++ head/sys/net80211/ieee80211_hwmp.c Thu Feb 7 21:17:35 2013 (r246498) @@ -995,8 +995,11 @@ hwmp_recv_preq(struct ieee80211vap *vap, rtorig->rt_metric = metric; rtorig->rt_nhops = preq->preq_hopcount + 1; ieee80211_mesh_rt_update(rtorig, preq->preq_lifetime); - /* path to orig is valid now */ - rtorig->rt_flags |= IEEE80211_MESHRT_FLAGS_VALID; + /* Path to orig is valid now. + * NB: we know it can't be Proxy, and if it is GATE + * it will be marked below. + */ + rtorig->rt_flags = IEEE80211_MESHRT_FLAGS_VALID; }else if ((hrtarg != NULL && HWMP_SEQ_EQ(hrtarg->hr_seq, PREQ_TSEQ(0)) && ((rtorig->rt_flags & IEEE80211_MESHRT_FLAGS_VALID) == 0)) || From owner-svn-src-head@FreeBSD.ORG Thu Feb 7 21:18:22 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id D4EB3E0C; Thu, 7 Feb 2013 21:18:22 +0000 (UTC) (envelope-from monthadar@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id C5414E6E; Thu, 7 Feb 2013 21:18:22 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r17LIMMI008538; Thu, 7 Feb 2013 21:18:22 GMT (envelope-from monthadar@svn.freebsd.org) Received: (from monthadar@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r17LIMjM008535; Thu, 7 Feb 2013 21:18:22 GMT (envelope-from monthadar@svn.freebsd.org) Message-Id: <201302072118.r17LIMjM008535@svn.freebsd.org> From: Monthadar Al Jaberi Date: Thu, 7 Feb 2013 21:18:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r246499 - head/sys/net80211 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Feb 2013 21:18:22 -0000 Author: monthadar Date: Thu Feb 7 21:18:22 2013 New Revision: 246499 URL: http://svnweb.freebsd.org/changeset/base/246499 Log: Add mesh debug for interarction between DS & MBSS. * Add mesh debug information when frames enter or leave the MBSS; * Set IEEE80211_MSG_OUTPUT bit to enable output; Approved by: adrian (mentor) Modified: head/sys/net80211/ieee80211_mesh.c head/sys/net80211/ieee80211_output.c Modified: head/sys/net80211/ieee80211_mesh.c ============================================================================== --- head/sys/net80211/ieee80211_mesh.c Thu Feb 7 21:17:35 2013 (r246498) +++ head/sys/net80211/ieee80211_mesh.c Thu Feb 7 21:18:22 2013 (r246499) @@ -1246,6 +1246,9 @@ mesh_recv_indiv_data_to_me(struct ieee80 * All other cases: forward of MSDUs from the MBSS to DS indiv. * addressed according to 13.11.3.2. */ + IEEE80211_NOTE_MAC(vap, IEEE80211_MSG_OUTPUT, qwh->i_addr2, + "forward frame to DS, SA(%6D) DA(%6D)", + mc10->mc_addr6, ":", mc10->mc_addr5, ":"); } return (0); /* process locally */ } Modified: head/sys/net80211/ieee80211_output.c ============================================================================== --- head/sys/net80211/ieee80211_output.c Thu Feb 7 21:17:35 2013 (r246498) +++ head/sys/net80211/ieee80211_output.c Thu Feb 7 21:18:22 2013 (r246499) @@ -262,6 +262,10 @@ ieee80211_start(struct ifnet *ifp) m_freem(m); continue; } + IEEE80211_DPRINTF(vap, IEEE80211_MSG_OUTPUT, + "forward frame from DS SA(%6D), DA(%6D)\n", + eh->ether_dhost, ":", + eh->ether_shost, ":"); ieee80211_mesh_proxy_check(vap, eh->ether_shost); } ni = ieee80211_mesh_discover(vap, eh->ether_dhost, m); From owner-svn-src-head@FreeBSD.ORG Thu Feb 7 21:19:45 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 4A120FB9; Thu, 7 Feb 2013 21:19:45 +0000 (UTC) (envelope-from monthadar@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 3A350E89; Thu, 7 Feb 2013 21:19:45 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r17LJjZi008749; Thu, 7 Feb 2013 21:19:45 GMT (envelope-from monthadar@svn.freebsd.org) Received: (from monthadar@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r17LJj4n008748; Thu, 7 Feb 2013 21:19:45 GMT (envelope-from monthadar@svn.freebsd.org) Message-Id: <201302072119.r17LJj4n008748@svn.freebsd.org> From: Monthadar Al Jaberi Date: Thu, 7 Feb 2013 21:19:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r246500 - head/sys/net80211 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Feb 2013 21:19:45 -0000 Author: monthadar Date: Thu Feb 7 21:19:44 2013 New Revision: 246500 URL: http://svnweb.freebsd.org/changeset/base/246500 Log: HWMP: Accept a PERR even if path is valid. * An HWMP PERR should be accepted even if path is valid. Because we check if we recevied it from a neighbour that we use as a next hop; Approved by: adrian (mentor) Modified: head/sys/net80211/ieee80211_hwmp.c Modified: head/sys/net80211/ieee80211_hwmp.c ============================================================================== --- head/sys/net80211/ieee80211_hwmp.c Thu Feb 7 21:18:22 2013 (r246499) +++ head/sys/net80211/ieee80211_hwmp.c Thu Feb 7 21:19:44 2013 (r246500) @@ -1528,7 +1528,7 @@ hwmp_recv_perr(struct ieee80211vap *vap, */ for (i = 0; i < perr->perr_ndests; i++) { rt = ieee80211_mesh_rt_find(vap, PERR_DADDR(i)); - if (rt == NULL || rt->rt_flags & IEEE80211_MESHRT_FLAGS_VALID) + if (rt == NULL) continue; if (!IEEE80211_ADDR_EQ(rt->rt_nexthop, wh->i_addr2)) continue; From owner-svn-src-head@FreeBSD.ORG Thu Feb 7 21:20:29 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id B5140231; Thu, 7 Feb 2013 21:20:29 +0000 (UTC) (envelope-from monthadar@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 8D2D2EA3; Thu, 7 Feb 2013 21:20:29 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r17LKT3t009058; Thu, 7 Feb 2013 21:20:29 GMT (envelope-from monthadar@svn.freebsd.org) Received: (from monthadar@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r17LKTL9009056; Thu, 7 Feb 2013 21:20:29 GMT (envelope-from monthadar@svn.freebsd.org) Message-Id: <201302072120.r17LKTL9009056@svn.freebsd.org> From: Monthadar Al Jaberi Date: Thu, 7 Feb 2013 21:20:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r246501 - head/sys/net80211 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Feb 2013 21:20:29 -0000 Author: monthadar Date: Thu Feb 7 21:20:28 2013 New Revision: 246501 URL: http://svnweb.freebsd.org/changeset/base/246501 Log: Update net80211 mesh struct ieee80211_meshgann_ie. * Change all field prefix from pann_ to gann_; * Added IEEE80211_MESHGANN_BASE_SZ macro to be used in the length field of a GANN frame according to 802.11 standard; * Changed gann_seq field type to uint32_t; * Added a Gate Announcement interval field according to IEEE802.11 2012 standard; * Added IEEE80211_MESHRT_FLAGS_GATE as flag bit to ieee80211_mesh_route; * Added IEEE80211_MESHRT_FLAGS_GATE as flag bit to ieee80211req_mesh_route; Approved by: adrian (mentor) Modified: head/sys/net80211/ieee80211_ioctl.h head/sys/net80211/ieee80211_mesh.h Modified: head/sys/net80211/ieee80211_ioctl.h ============================================================================== --- head/sys/net80211/ieee80211_ioctl.h Thu Feb 7 21:19:44 2013 (r246500) +++ head/sys/net80211/ieee80211_ioctl.h Thu Feb 7 21:20:28 2013 (r246501) @@ -342,6 +342,7 @@ struct ieee80211req_mesh_route { #define IEEE80211_MESHRT_FLAGS_DISCOVER 0x01 #define IEEE80211_MESHRT_FLAGS_VALID 0x02 #define IEEE80211_MESHRT_FLAGS_PROXY 0x04 +#define IEEE80211_MESHRT_FLAGS_GATE 0x08 uint8_t imr_dest[IEEE80211_ADDR_LEN]; uint8_t imr_nexthop[IEEE80211_ADDR_LEN]; uint16_t imr_nhops; Modified: head/sys/net80211/ieee80211_mesh.h ============================================================================== --- head/sys/net80211/ieee80211_mesh.h Thu Feb 7 21:19:44 2013 (r246500) +++ head/sys/net80211/ieee80211_mesh.h Thu Feb 7 21:20:28 2013 (r246501) @@ -194,14 +194,20 @@ struct ieee80211_meshbeacont_ie { #endif /* Gate (GANN) Annoucement */ +/* + * NB: these macros used for the length in the IEs does not include 2 bytes + * for _ie and _len fields as is defined by the standard. + */ +#define IEEE80211_MESHGANN_BASE_SZ (15) struct ieee80211_meshgann_ie { - uint8_t pann_ie; /* IEEE80211_ELEMID_MESHGANN */ - uint8_t pann_len; - uint8_t pann_flags; - uint8_t pann_hopcount; - uint8_t pann_ttl; - uint8_t pann_addr[IEEE80211_ADDR_LEN]; - uint8_t pann_seq; /* PANN Sequence Number */ + uint8_t gann_ie; /* IEEE80211_ELEMID_MESHGANN */ + uint8_t gann_len; + uint8_t gann_flags; + uint8_t gann_hopcount; + uint8_t gann_ttl; + uint8_t gann_addr[IEEE80211_ADDR_LEN]; + uint32_t gann_seq; /* GANN Sequence Number */ + uint16_t gann_interval; /* GANN Interval */ } __packed; /* Root (MP) Annoucement */ @@ -423,6 +429,7 @@ struct ieee80211_mesh_route { #define IEEE80211_MESHRT_FLAGS_DISCOVER 0x01 /* path discovery */ #define IEEE80211_MESHRT_FLAGS_VALID 0x02 /* path discovery complete */ #define IEEE80211_MESHRT_FLAGS_PROXY 0x04 /* proxy entry */ +#define IEEE80211_MESHRT_FLAGS_GATE 0x08 /* mesh gate entry */ uint32_t rt_lifetime; /* route timeout */ uint32_t rt_lastmseq; /* last seq# seen dest */ uint32_t rt_ext_seq; /* proxy seq number */ From owner-svn-src-head@FreeBSD.ORG Thu Feb 7 21:21:05 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id E80B33AD; Thu, 7 Feb 2013 21:21:05 +0000 (UTC) (envelope-from monthadar@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id CE917EAE; Thu, 7 Feb 2013 21:21:05 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r17LL5LK010595; Thu, 7 Feb 2013 21:21:05 GMT (envelope-from monthadar@svn.freebsd.org) Received: (from monthadar@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r17LL5Sk010594; Thu, 7 Feb 2013 21:21:05 GMT (envelope-from monthadar@svn.freebsd.org) Message-Id: <201302072121.r17LL5Sk010594@svn.freebsd.org> From: Monthadar Al Jaberi Date: Thu, 7 Feb 2013 21:21:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r246502 - head/sys/net80211 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Feb 2013 21:21:06 -0000 Author: monthadar Date: Thu Feb 7 21:21:05 2013 New Revision: 246502 URL: http://svnweb.freebsd.org/changeset/base/246502 Log: Update in ieee80211_action.c for mesh code handlers. * Removed meshlm_send_action and hwmp_send_action. Introduced one common for all Mesh Action frames meshaction_send_action. According to 802.11 standard Link Metric and HWMP are all under Mesh Action category; * Did similar changes to recv_action part; * The size of meshaction_*_action is set to 12. This is to make room for the rest of Mesh Action category subtypes; Approved by: adrian (mentor) Modified: head/sys/net80211/ieee80211_action.c Modified: head/sys/net80211/ieee80211_action.c ============================================================================== --- head/sys/net80211/ieee80211_action.c Thu Feb 7 21:20:28 2013 (r246501) +++ head/sys/net80211/ieee80211_action.c Thu Feb 7 21:21:05 2013 (r246502) @@ -67,10 +67,8 @@ static ieee80211_send_action_func *meshp send_inval, send_inval, send_inval, send_inval, send_inval, send_inval, send_inval, send_inval, }; -static ieee80211_send_action_func *meshlm_send_action[4] = { +static ieee80211_send_action_func *meshaction_send_action[12] = { send_inval, send_inval, send_inval, send_inval, -}; -static ieee80211_send_action_func *hwmp_send_action[8] = { send_inval, send_inval, send_inval, send_inval, send_inval, send_inval, send_inval, send_inval, }; @@ -100,18 +98,10 @@ ieee80211_send_action_register(int cat, meshpl_send_action[act] = f; return 0; case IEEE80211_ACTION_CAT_MESH: - switch (act) { - case IEEE80211_ACTION_MESH_LMETRIC: - if (act >= N(meshlm_send_action)) - break; - meshlm_send_action[act] = f; - return 0; - case IEEE80211_ACTION_MESH_HWMP: - if (act >= N(hwmp_send_action)) - break; - hwmp_send_action[act] = f; - return 0; - } + if (act >= N(meshaction_send_action)) + break; + meshaction_send_action[act] = f; + return 0; break; case IEEE80211_ACTION_CAT_VENDOR: if (act >= N(vendor_send_action)) @@ -149,16 +139,8 @@ ieee80211_send_action(struct ieee80211_n f = meshpl_send_action[act]; break; case IEEE80211_ACTION_CAT_MESH: - switch (act) { - case IEEE80211_ACTION_MESH_LMETRIC: - if (act < N(meshlm_send_action)) - f = meshlm_send_action[act]; - break; - case IEEE80211_ACTION_MESH_HWMP: - if (act < N(hwmp_send_action)) - f = hwmp_send_action[act]; - break; - } + if (act < N(meshaction_send_action)) + f = meshaction_send_action[act]; break; case IEEE80211_ACTION_CAT_VENDOR: if (act < N(vendor_send_action)) @@ -188,10 +170,8 @@ static ieee80211_recv_action_func *meshp recv_inval, recv_inval, recv_inval, recv_inval, recv_inval, recv_inval, recv_inval, recv_inval, }; -static ieee80211_recv_action_func *meshlm_recv_action[4] = { +static ieee80211_recv_action_func *meshaction_recv_action[12] = { recv_inval, recv_inval, recv_inval, recv_inval, -}; -static ieee80211_recv_action_func *hwmp_recv_action[8] = { recv_inval, recv_inval, recv_inval, recv_inval, recv_inval, recv_inval, recv_inval, recv_inval, }; @@ -221,19 +201,10 @@ ieee80211_recv_action_register(int cat, meshpl_recv_action[act] = f; return 0; case IEEE80211_ACTION_CAT_MESH: - switch (act) { - case IEEE80211_ACTION_MESH_LMETRIC: - if (act >= N(meshlm_recv_action)) - break; - meshlm_recv_action[act] = f; - return 0; - case IEEE80211_ACTION_MESH_HWMP: - if (act >= N(hwmp_recv_action)) - break; - hwmp_recv_action[act] = f; - return 0; - } - break; + if (act >= N(meshaction_recv_action)) + break; + meshaction_recv_action[act] = f; + return 0; case IEEE80211_ACTION_CAT_VENDOR: if (act >= N(vendor_recv_action)) break; @@ -274,16 +245,8 @@ ieee80211_recv_action(struct ieee80211_n f = meshpl_recv_action[ia->ia_action]; break; case IEEE80211_ACTION_CAT_MESH: - switch (ia->ia_action) { - case IEEE80211_ACTION_MESH_LMETRIC: - if (ia->ia_action < N(meshlm_recv_action)) - f = meshlm_recv_action[ia->ia_action]; - break; - case IEEE80211_ACTION_MESH_HWMP: - if (ia->ia_action < N(hwmp_recv_action)) - f = hwmp_recv_action[ia->ia_action]; - break; - } + if (ia->ia_action < N(meshaction_recv_action)) + f = meshaction_recv_action[ia->ia_action]; break; case IEEE80211_ACTION_CAT_VENDOR: if (ia->ia_action < N(vendor_recv_action)) From owner-svn-src-head@FreeBSD.ORG Thu Feb 7 21:21:41 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id B909B52E; Thu, 7 Feb 2013 21:21:41 +0000 (UTC) (envelope-from monthadar@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 920BEEBA; Thu, 7 Feb 2013 21:21:41 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r17LLfp7010705; Thu, 7 Feb 2013 21:21:41 GMT (envelope-from monthadar@svn.freebsd.org) Received: (from monthadar@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r17LLfOk010703; Thu, 7 Feb 2013 21:21:41 GMT (envelope-from monthadar@svn.freebsd.org) Message-Id: <201302072121.r17LLfOk010703@svn.freebsd.org> From: Monthadar Al Jaberi Date: Thu, 7 Feb 2013 21:21:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r246503 - head/sys/net80211 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Feb 2013 21:21:41 -0000 Author: monthadar Date: Thu Feb 7 21:21:40 2013 New Revision: 246503 URL: http://svnweb.freebsd.org/changeset/base/246503 Log: Mesh: management mesh action frames are to be discarded when not peered. * Modified ieee80211_recv_action to check if neighbour is peered for IEEE80211_ACTION_CAT_MESH frames, if not frame is discarded. This is according to IEEE802.11 2012 standard; * Removed duplicate checks in each hwmp_recv_* handlers because HWMP is a subtype of mesh action; Approved by: adrian (mentor) Modified: head/sys/net80211/ieee80211_action.c head/sys/net80211/ieee80211_hwmp.c Modified: head/sys/net80211/ieee80211_action.c ============================================================================== --- head/sys/net80211/ieee80211_action.c Thu Feb 7 21:21:05 2013 (r246502) +++ head/sys/net80211/ieee80211_action.c Thu Feb 7 21:21:40 2013 (r246503) @@ -228,6 +228,7 @@ ieee80211_recv_action(struct ieee80211_n { #define N(a) (sizeof(a) / sizeof(a[0])) ieee80211_recv_action_func *f = recv_inval; + struct ieee80211vap *vap = ni->ni_vap; const struct ieee80211_action *ia = (const struct ieee80211_action *) frm; @@ -245,6 +246,15 @@ ieee80211_recv_action(struct ieee80211_n f = meshpl_recv_action[ia->ia_action]; break; case IEEE80211_ACTION_CAT_MESH: + if (ni == vap->iv_bss || + ni->ni_mlstate != IEEE80211_NODE_MESH_ESTABLISHED) { + IEEE80211_DISCARD_MAC(vap, IEEE80211_MSG_MESH, + ni->ni_macaddr, NULL, + "peer link not yet established (%d), cat %s act %u", + ni->ni_mlstate, "mesh action", ia->ia_action); + vap->iv_stats.is_mesh_nolink++; + break; + } if (ia->ia_action < N(meshaction_recv_action)) f = meshaction_recv_action[ia->ia_action]; break; Modified: head/sys/net80211/ieee80211_hwmp.c ============================================================================== --- head/sys/net80211/ieee80211_hwmp.c Thu Feb 7 21:21:05 2013 (r246502) +++ head/sys/net80211/ieee80211_hwmp.c Thu Feb 7 21:21:40 2013 (r246503) @@ -914,9 +914,6 @@ hwmp_recv_preq(struct ieee80211vap *vap, ieee80211_hwmp_seq preqid; /* last seen preqid for orig */ uint32_t metric = 0; - if (ni == vap->iv_bss || - ni->ni_mlstate != IEEE80211_NODE_MESH_ESTABLISHED) - return; /* * Ignore PREQs from us. Could happen because someone forward it * back to us. @@ -1233,10 +1230,6 @@ hwmp_recv_prep(struct ieee80211vap *vap, int is_encap; struct ieee80211_node *ni_encap; - if (ni == vap->iv_bss || - ni->ni_mlstate != IEEE80211_NODE_MESH_ESTABLISHED) - return; - IEEE80211_NOTE(vap, IEEE80211_MSG_HWMP, ni, "received PREP, orig %6D, targ %6D", prep->prep_origaddr, ":", prep->prep_targetaddr, ":"); @@ -1505,10 +1498,6 @@ hwmp_recv_perr(struct ieee80211vap *vap, struct ieee80211_meshperr_ie *pperr = NULL; int i, j = 0, forward = 0; - if (ni == vap->iv_bss || - ni->ni_mlstate != IEEE80211_NODE_MESH_ESTABLISHED) - return; - IEEE80211_NOTE(vap, IEEE80211_MSG_HWMP, ni, "received PERR from %6D", wh->i_addr2, ":"); @@ -1712,9 +1701,7 @@ hwmp_recv_rann(struct ieee80211vap *vap, struct ieee80211_meshrann_ie prann; uint32_t metric = 0; - if (ni == vap->iv_bss || - ni->ni_mlstate != IEEE80211_NODE_MESH_ESTABLISHED || - IEEE80211_ADDR_EQ(rann->rann_addr, vap->iv_myaddr)) + if (IEEE80211_ADDR_EQ(rann->rann_addr, vap->iv_myaddr)) return; rt = ieee80211_mesh_rt_find(vap, rann->rann_addr); From owner-svn-src-head@FreeBSD.ORG Thu Feb 7 21:22:14 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id E9B146AA; Thu, 7 Feb 2013 21:22:14 +0000 (UTC) (envelope-from monthadar@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id D5F91EC7; Thu, 7 Feb 2013 21:22:14 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r17LMELq010854; Thu, 7 Feb 2013 21:22:14 GMT (envelope-from monthadar@svn.freebsd.org) Received: (from monthadar@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r17LMEkb010853; Thu, 7 Feb 2013 21:22:14 GMT (envelope-from monthadar@svn.freebsd.org) Message-Id: <201302072122.r17LMEkb010853@svn.freebsd.org> From: Monthadar Al Jaberi Date: Thu, 7 Feb 2013 21:22:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r246504 - head/sys/net80211 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Feb 2013 21:22:15 -0000 Author: monthadar Date: Thu Feb 7 21:22:14 2013 New Revision: 246504 URL: http://svnweb.freebsd.org/changeset/base/246504 Log: Start accepting IEEE80211_ACTION_MESH_GANN frames; * Add IEEE80211_ACTION_MESH_GANN Action frame verification in ieee80211_parse_action; Approved by: adrian (mentor) Modified: head/sys/net80211/ieee80211_input.c Modified: head/sys/net80211/ieee80211_input.c ============================================================================== --- head/sys/net80211/ieee80211_input.c Thu Feb 7 21:21:40 2013 (r246503) +++ head/sys/net80211/ieee80211_input.c Thu Feb 7 21:22:14 2013 (r246504) @@ -776,6 +776,10 @@ ieee80211_parse_action(struct ieee80211_ /* verify something */ break; case IEEE80211_ACTION_MESH_GANN: + IEEE80211_VERIFY_LENGTH(efrm - frm, + sizeof(struct ieee80211_meshgann_ie), + return EINVAL); + break; case IEEE80211_ACTION_MESH_CC: case IEEE80211_ACTION_MESH_MCCA_SREQ: case IEEE80211_ACTION_MESH_MCCA_SREP: From owner-svn-src-head@FreeBSD.ORG Thu Feb 7 21:23:03 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id DB62C83B; Thu, 7 Feb 2013 21:23:03 +0000 (UTC) (envelope-from monthadar@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id C6D21EDE; Thu, 7 Feb 2013 21:23:03 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r17LN3A8010992; Thu, 7 Feb 2013 21:23:03 GMT (envelope-from monthadar@svn.freebsd.org) Received: (from monthadar@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r17LN3Uu010991; Thu, 7 Feb 2013 21:23:03 GMT (envelope-from monthadar@svn.freebsd.org) Message-Id: <201302072123.r17LN3Uu010991@svn.freebsd.org> From: Monthadar Al Jaberi Date: Thu, 7 Feb 2013 21:23:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r246505 - head/sbin/ifconfig X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Feb 2013 21:23:03 -0000 Author: monthadar Date: Thu Feb 7 21:23:03 2013 New Revision: 246505 URL: http://svnweb.freebsd.org/changeset/base/246505 Log: Mark a mesh path to a mesh gate with a 'G'. Approved by: adrian (mentor) Modified: head/sbin/ifconfig/ifieee80211.c Modified: head/sbin/ifconfig/ifieee80211.c ============================================================================== --- head/sbin/ifconfig/ifieee80211.c Thu Feb 7 21:22:14 2013 (r246504) +++ head/sbin/ifconfig/ifieee80211.c Thu Feb 7 21:23:03 2013 (r246505) @@ -4025,7 +4025,9 @@ list_mesh(int s) (rt->imr_flags & IEEE80211_MESHRT_FLAGS_VALID) ? 'V' : '!', (rt->imr_flags & IEEE80211_MESHRT_FLAGS_PROXY) ? - 'P' : ' '); + 'P' : + (rt->imr_flags & IEEE80211_MESHRT_FLAGS_GATE) ? + 'G' :' '); } } From owner-svn-src-head@FreeBSD.ORG Thu Feb 7 21:23:44 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 8EFBA9C0; Thu, 7 Feb 2013 21:23:44 +0000 (UTC) (envelope-from monthadar@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 705CBEED; Thu, 7 Feb 2013 21:23:44 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r17LNiU5011121; Thu, 7 Feb 2013 21:23:44 GMT (envelope-from monthadar@svn.freebsd.org) Received: (from monthadar@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r17LNiJI011118; Thu, 7 Feb 2013 21:23:44 GMT (envelope-from monthadar@svn.freebsd.org) Message-Id: <201302072123.r17LNiJI011118@svn.freebsd.org> From: Monthadar Al Jaberi Date: Thu, 7 Feb 2013 21:23:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r246506 - head/sys/net80211 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Feb 2013 21:23:44 -0000 Author: monthadar Date: Thu Feb 7 21:23:43 2013 New Revision: 246506 URL: http://svnweb.freebsd.org/changeset/base/246506 Log: Mesh update: add base Mesh Gate functionality. A Mesh Gate should transmit a Mesh Action frame containing ieee80211_meshgann_ie as its only information element periodically every ieee80211_mesh_gateint ms. Unless the mesh gate is also configure as a ROOT, then these frames should not be send. This is according to 802.11 2012 standard; * Introduce new SYSCTL net.wlan.mesh.gateint, with 10s default; * Add two new functions mesh_gatemode_setup and mesh_gatemode_cb. This is similar to how HWMP setups up a callout; * Add two new action handlers mesh_recv_action_meshgate and mesh_send_action_meshgate; * Added ieee80211_add_meshgate to ieee80211_mesh.h; * Modified mesh_send_action to look similar to hwmp_send_action. This is because we need to send out broadcast management frames. * Introduced a new flag for mesh state IEEE80211_MESHFLAGS_ROOT. This flag is now set by HWMP code when a mesh STA is configured as a ROOT. This is then checked by mesh_gatemode_cb before scheduling a new callout; * Added to new field to ieee80211_mesh_state: + struct callout ms_gatetimer + ieee80211_mesh_seq ms_gateseq; Approved by: adrian (mentor) Modified: head/sys/net80211/ieee80211_hwmp.c head/sys/net80211/ieee80211_mesh.c head/sys/net80211/ieee80211_mesh.h Modified: head/sys/net80211/ieee80211_hwmp.c ============================================================================== --- head/sys/net80211/ieee80211_hwmp.c Thu Feb 7 21:23:03 2013 (r246505) +++ head/sys/net80211/ieee80211_hwmp.c Thu Feb 7 21:23:43 2013 (r246506) @@ -805,19 +805,23 @@ static void hwmp_rootmode_setup(struct ieee80211vap *vap) { struct ieee80211_hwmp_state *hs = vap->iv_hwmp; + struct ieee80211_mesh_state *ms = vap->iv_mesh; switch (hs->hs_rootmode) { case IEEE80211_HWMP_ROOTMODE_DISABLED: callout_drain(&hs->hs_roottimer); + ms->ms_flags &= ~IEEE80211_MESHFLAGS_ROOT; break; case IEEE80211_HWMP_ROOTMODE_NORMAL: case IEEE80211_HWMP_ROOTMODE_PROACTIVE: callout_reset(&hs->hs_roottimer, ieee80211_hwmp_rootint, hwmp_rootmode_cb, vap); + ms->ms_flags |= IEEE80211_MESHFLAGS_ROOT; break; case IEEE80211_HWMP_ROOTMODE_RANN: callout_reset(&hs->hs_roottimer, ieee80211_hwmp_rannint, hwmp_rootmode_rann_cb, vap); + ms->ms_flags |= IEEE80211_MESHFLAGS_ROOT; break; } } Modified: head/sys/net80211/ieee80211_mesh.c ============================================================================== --- head/sys/net80211/ieee80211_mesh.c Thu Feb 7 21:23:03 2013 (r246505) +++ head/sys/net80211/ieee80211_mesh.c Thu Feb 7 21:23:43 2013 (r246506) @@ -68,6 +68,8 @@ static int mesh_select_proto_metric(stru static void mesh_vattach(struct ieee80211vap *); static int mesh_newstate(struct ieee80211vap *, enum ieee80211_state, int); static void mesh_rt_cleanup_cb(void *); +static void mesh_gatemode_setup(struct ieee80211vap *); +static void mesh_gatemode_cb(void *); static void mesh_linkchange(struct ieee80211_node *, enum ieee80211_mesh_mlstate); static void mesh_checkid(void *, struct ieee80211_node *); @@ -99,6 +101,10 @@ uint32_t mesh_airtime_calc(struct ieee80 */ static SYSCTL_NODE(_net_wlan, OID_AUTO, mesh, CTLFLAG_RD, 0, "IEEE 802.11s parameters"); +static int ieee80211_mesh_gateint = -1; +SYSCTL_PROC(_net_wlan_mesh, OID_AUTO, gateint, CTLTYPE_INT | CTLFLAG_RW, + &ieee80211_mesh_gateint, 0, ieee80211_sysctl_msecs_ticks, "I", + "mesh gate interval (ms)"); static int ieee80211_mesh_retrytimeout = -1; SYSCTL_PROC(_net_wlan_mesh, OID_AUTO, retrytimeout, CTLTYPE_INT | CTLFLAG_RW, &ieee80211_mesh_retrytimeout, 0, ieee80211_sysctl_msecs_ticks, "I", @@ -133,11 +139,13 @@ static ieee80211_recv_action_func mesh_r static ieee80211_recv_action_func mesh_recv_action_meshpeering_confirm; static ieee80211_recv_action_func mesh_recv_action_meshpeering_close; static ieee80211_recv_action_func mesh_recv_action_meshlmetric; +static ieee80211_recv_action_func mesh_recv_action_meshgate; static ieee80211_send_action_func mesh_send_action_meshpeering_open; static ieee80211_send_action_func mesh_send_action_meshpeering_confirm; static ieee80211_send_action_func mesh_send_action_meshpeering_close; static ieee80211_send_action_func mesh_send_action_meshlmetric; +static ieee80211_send_action_func mesh_send_action_meshgate; static const struct ieee80211_mesh_proto_metric mesh_metric_airtime = { .mpm_descr = "AIRTIME", @@ -498,6 +506,48 @@ mesh_select_proto_metric(struct ieee8021 #undef N static void +mesh_gatemode_setup(struct ieee80211vap *vap) +{ + struct ieee80211_mesh_state *ms = vap->iv_mesh; + + /* + * NB: When a mesh gate is running as a ROOT it shall + * not send out periodic GANNs but instead mark the + * mesh gate flag for the corresponding proactive PREQ + * and RANN frames. + */ + if (ms->ms_flags & IEEE80211_MESHFLAGS_ROOT || + (ms->ms_flags & IEEE80211_MESHFLAGS_GATE) == 0) { + callout_drain(&ms->ms_gatetimer); + return ; + } + callout_reset(&ms->ms_gatetimer, ieee80211_mesh_gateint, + mesh_gatemode_cb, vap); +} + +static void +mesh_gatemode_cb(void *arg) +{ + struct ieee80211vap *vap = (struct ieee80211vap *)arg; + struct ieee80211_mesh_state *ms = vap->iv_mesh; + struct ieee80211_meshgann_ie gann; + + IEEE80211_NOTE(vap, IEEE80211_MSG_MESH, vap->iv_bss, + "%s", "send broadcast GANN"); + + gann.gann_flags = 0; /* Reserved */ + gann.gann_hopcount = 0; + gann.gann_ttl = ms->ms_ttl; + IEEE80211_ADDR_COPY(gann.gann_addr, vap->iv_myaddr); + gann.gann_seq = ms->ms_gateseq++; + gann.gann_interval = ieee80211_mesh_gateint; + + ieee80211_send_action(vap->iv_bss, IEEE80211_ACTION_CAT_MESH, + IEEE80211_ACTION_MESH_GANN, &gann); + mesh_gatemode_setup(vap); +} + +static void ieee80211_mesh_init(void) { @@ -507,6 +557,7 @@ ieee80211_mesh_init(void) /* * Setup mesh parameters that depends on the clock frequency. */ + ieee80211_mesh_gateint = msecs_to_ticks(10000); ieee80211_mesh_retrytimeout = msecs_to_ticks(40); ieee80211_mesh_holdingtimeout = msecs_to_ticks(40); ieee80211_mesh_confirmtimeout = msecs_to_ticks(40); @@ -526,6 +577,8 @@ ieee80211_mesh_init(void) mesh_recv_action_meshpeering_close); ieee80211_recv_action_register(IEEE80211_ACTION_CAT_MESH, IEEE80211_ACTION_MESH_LMETRIC, mesh_recv_action_meshlmetric); + ieee80211_recv_action_register(IEEE80211_ACTION_CAT_MESH, + IEEE80211_ACTION_MESH_GANN, mesh_recv_action_meshgate); ieee80211_send_action_register(IEEE80211_ACTION_CAT_SELF_PROT, IEEE80211_ACTION_MESHPEERING_OPEN, @@ -539,6 +592,9 @@ ieee80211_mesh_init(void) ieee80211_send_action_register(IEEE80211_ACTION_CAT_MESH, IEEE80211_ACTION_MESH_LMETRIC, mesh_send_action_meshlmetric); + ieee80211_send_action_register(IEEE80211_ACTION_CAT_MESH, + IEEE80211_ACTION_MESH_GANN, + mesh_send_action_meshgate); /* * Register Airtime Link Metric. @@ -617,6 +673,8 @@ mesh_vattach(struct ieee80211vap *vap) TAILQ_INIT(&ms->ms_routes); mtx_init(&ms->ms_rt_lock, "MBSS", "802.11s routing table", MTX_DEF); callout_init(&ms->ms_cleantimer, CALLOUT_MPSAFE); + callout_init(&ms->ms_gatetimer, CALLOUT_MPSAFE); + ms->ms_gateseq = 0; mesh_select_proto_metric(vap, "AIRTIME"); KASSERT(ms->ms_pmetric, ("ms_pmetric == NULL")); mesh_select_proto_path(vap, "HWMP"); @@ -645,8 +703,10 @@ mesh_newstate(struct ieee80211vap *vap, if (ostate != IEEE80211_S_SCAN) ieee80211_cancel_scan(vap); /* background scan */ ni = vap->iv_bss; /* NB: no reference held */ - if (nstate != IEEE80211_S_RUN && ostate == IEEE80211_S_RUN) + if (nstate != IEEE80211_S_RUN && ostate == IEEE80211_S_RUN) { callout_drain(&ms->ms_cleantimer); + callout_drain(&ms->ms_gatetimer); + } switch (nstate) { case IEEE80211_S_INIT: switch (ostate) { @@ -771,6 +831,7 @@ mesh_newstate(struct ieee80211vap *vap, ieee80211_node_authorize(vap->iv_bss); callout_reset(&ms->ms_cleantimer, ms->ms_ppath->mpp_inact, mesh_rt_cleanup_cb, vap); + mesh_gatemode_setup(vap); break; default: break; @@ -2300,19 +2361,77 @@ mesh_recv_action_meshlmetric(struct ieee return 0; } +/* + * Mesh Gate Announcement handling. + */ +static int +mesh_recv_action_meshgate(struct ieee80211_node *ni, + const struct ieee80211_frame *wh, + const uint8_t *frm, const uint8_t *efrm) +{ + struct ieee80211vap *vap = ni->ni_vap; + struct ieee80211_mesh_route *rt_gate; + const struct ieee80211_meshgann_ie *ie = + (const struct ieee80211_meshgann_ie *) + (frm+2); /* action + code */ + + IEEE80211_NOTE_MAC(vap, IEEE80211_MSG_MESH, ie->gann_addr, + "%s", "received GANN from meshgate"); + + rt_gate = ieee80211_mesh_rt_find(vap, ie->gann_addr); + if (rt_gate != NULL && + rt_gate->rt_flags & IEEE80211_MESHRT_FLAGS_VALID) + rt_gate->rt_flags |= IEEE80211_MESHRT_FLAGS_GATE; + + return 0; +} + static int -mesh_send_action(struct ieee80211_node *ni, struct mbuf *m) +mesh_send_action(struct ieee80211_node *ni, + const uint8_t sa[IEEE80211_ADDR_LEN], + const uint8_t da[IEEE80211_ADDR_LEN], + struct mbuf *m) { + struct ieee80211vap *vap = ni->ni_vap; + struct ieee80211com *ic = ni->ni_ic; struct ieee80211_bpf_params params; + struct ieee80211_frame *wh; + + KASSERT(ni != NULL, ("null node")); + + if (vap->iv_state == IEEE80211_S_CAC) { + IEEE80211_NOTE(vap, IEEE80211_MSG_OUTPUT, ni, + "block %s frame in CAC state", "Mesh action"); + vap->iv_stats.is_tx_badstate++; + ieee80211_free_node(ni); + m_freem(m); + return EIO; /* XXX */ + } + + M_PREPEND(m, sizeof(struct ieee80211_frame), M_DONTWAIT); + if (m == NULL) { + ieee80211_free_node(ni); + return ENOMEM; + } + + wh = mtod(m, struct ieee80211_frame *); + ieee80211_send_setup(ni, m, + IEEE80211_FC0_TYPE_MGT | IEEE80211_FC0_SUBTYPE_ACTION, + IEEE80211_NONQOS_TID, sa, da, sa); + m->m_flags |= M_ENCAP; /* mark encapsulated */ memset(¶ms, 0, sizeof(params)); params.ibp_pri = WME_AC_VO; params.ibp_rate0 = ni->ni_txparms->mgmtrate; - /* XXX ucast/mcast */ - params.ibp_try0 = ni->ni_txparms->maxretry; + if (IEEE80211_IS_MULTICAST(da)) + params.ibp_try0 = 1; + else + params.ibp_try0 = ni->ni_txparms->maxretry; params.ibp_power = ni->ni_txpower; - return ieee80211_mgmt_output(ni, m, IEEE80211_FC0_SUBTYPE_ACTION, - ¶ms); + + IEEE80211_NODE_STAT(ni, tx_mgmt); + + return ic->ic_raw_xmit(ni, m, ¶ms); } #define ADDSHORT(frm, v) do { \ @@ -2380,7 +2499,7 @@ mesh_send_action_meshpeering_open(struct frm = ieee80211_add_meshpeer(frm, IEEE80211_ACTION_MESHPEERING_OPEN, args[0], 0, 0); m->m_pkthdr.len = m->m_len = frm - mtod(m, uint8_t *); - return mesh_send_action(ni, m); + return mesh_send_action(ni, vap->iv_myaddr, ni->ni_macaddr, m); } else { vap->iv_stats.is_tx_nobuf++; ieee80211_free_node(ni); @@ -2448,7 +2567,7 @@ mesh_send_action_meshpeering_confirm(str IEEE80211_ACTION_MESHPEERING_CONFIRM, args[0], args[1], 0); m->m_pkthdr.len = m->m_len = frm - mtod(m, uint8_t *); - return mesh_send_action(ni, m); + return mesh_send_action(ni, vap->iv_myaddr, ni->ni_macaddr, m); } else { vap->iv_stats.is_tx_nobuf++; ieee80211_free_node(ni); @@ -2497,7 +2616,7 @@ mesh_send_action_meshpeering_close(struc IEEE80211_ACTION_MESHPEERING_CLOSE, args[0], args[1], args[2]); m->m_pkthdr.len = m->m_len = frm - mtod(m, uint8_t *); - return mesh_send_action(ni, m); + return mesh_send_action(ni, vap->iv_myaddr, ni->ni_macaddr, m); } else { vap->iv_stats.is_tx_nobuf++; ieee80211_free_node(ni); @@ -2545,7 +2664,46 @@ mesh_send_action_meshlmetric(struct ieee frm = ieee80211_add_meshlmetric(frm, ie->lm_flags, ie->lm_metric); m->m_pkthdr.len = m->m_len = frm - mtod(m, uint8_t *); - return mesh_send_action(ni, m); + return mesh_send_action(ni, vap->iv_myaddr, ni->ni_macaddr, m); + } else { + vap->iv_stats.is_tx_nobuf++; + ieee80211_free_node(ni); + return ENOMEM; + } +} + +static int +mesh_send_action_meshgate(struct ieee80211_node *ni, + int category, int action, void *arg0) +{ + struct ieee80211vap *vap = ni->ni_vap; + struct ieee80211com *ic = ni->ni_ic; + struct ieee80211_meshgann_ie *ie = arg0; + struct mbuf *m; + uint8_t *frm; + + IEEE80211_DPRINTF(vap, IEEE80211_MSG_NODE, + "ieee80211_ref_node (%s:%u) %p<%s> refcnt %d\n", __func__, __LINE__, + ni, ether_sprintf(ni->ni_macaddr), ieee80211_node_refcnt(ni)+1); + ieee80211_ref_node(ni); + + m = ieee80211_getmgtframe(&frm, + ic->ic_headroom + sizeof(struct ieee80211_frame), + sizeof(uint16_t) + /* action+category */ + IEEE80211_MESHGANN_BASE_SZ + ); + if (m != NULL) { + /* + * mesh link metric + * [1] category + * [1] action + * [tlv] mesh gate annoucement + */ + *frm++ = category; + *frm++ = action; + frm = ieee80211_add_meshgate(frm, ie); + m->m_pkthdr.len = m->m_len = frm - mtod(m, uint8_t *); + return mesh_send_action(ni, vap->iv_myaddr, broadcastaddr, m); } else { vap->iv_stats.is_tx_nobuf++; ieee80211_free_node(ni); @@ -2909,6 +3067,24 @@ ieee80211_add_meshlmetric(uint8_t *frm, ADDWORD(frm, metric); return frm; } + +/* + * Add a Mesh Gate Announcement IE to a frame. + */ +uint8_t * +ieee80211_add_meshgate(uint8_t *frm, struct ieee80211_meshgann_ie *ie) +{ + *frm++ = IEEE80211_ELEMID_MESHGANN; /* ie */ + *frm++ = IEEE80211_MESHGANN_BASE_SZ; /* len */ + *frm++ = ie->gann_flags; + *frm++ = ie->gann_hopcount; + *frm++ = ie->gann_ttl; + IEEE80211_ADDR_COPY(frm, ie->gann_addr); + frm += 6; + ADDWORD(frm, ie->gann_seq); + ADDSHORT(frm, ie->gann_interval); + return frm; +} #undef ADDSHORT #undef ADDWORD @@ -3113,6 +3289,7 @@ mesh_ioctl_set80211(struct ieee80211vap ms->ms_flags |= IEEE80211_MESHFLAGS_FWD; else ms->ms_flags &= ~IEEE80211_MESHFLAGS_FWD; + mesh_gatemode_setup(vap); break; case IEEE80211_IOC_MESH_GATE: if (ireq->i_val) Modified: head/sys/net80211/ieee80211_mesh.h ============================================================================== --- head/sys/net80211/ieee80211_mesh.h Thu Feb 7 21:23:03 2013 (r246505) +++ head/sys/net80211/ieee80211_mesh.h Thu Feb 7 21:23:43 2013 (r246506) @@ -502,9 +502,12 @@ struct ieee80211_mesh_state { #define IEEE80211_MESHFLAGS_AP 0x01 /* accept peers */ #define IEEE80211_MESHFLAGS_GATE 0x02 /* mesh gate role */ #define IEEE80211_MESHFLAGS_FWD 0x04 /* forward packets */ +#define IEEE80211_MESHFLAGS_ROOT 0x08 /* configured as root */ uint8_t ms_flags; struct mtx ms_rt_lock; struct callout ms_cleantimer; + struct callout ms_gatetimer; + ieee80211_mesh_seq ms_gateseq; TAILQ_HEAD(, ieee80211_mesh_route) ms_routes; struct ieee80211_mesh_proto_metric *ms_pmetric; struct ieee80211_mesh_proto_path *ms_ppath; @@ -537,6 +540,8 @@ uint8_t * ieee80211_add_meshconf(uint8_t uint8_t * ieee80211_add_meshpeer(uint8_t *, uint8_t, uint16_t, uint16_t, uint16_t); uint8_t * ieee80211_add_meshlmetric(uint8_t *, uint8_t, uint32_t); +uint8_t * ieee80211_add_meshgate(uint8_t *, + struct ieee80211_meshgann_ie *); void ieee80211_mesh_node_init(struct ieee80211vap *, struct ieee80211_node *); From owner-svn-src-head@FreeBSD.ORG Thu Feb 7 21:24:10 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id AD508B33; Thu, 7 Feb 2013 21:24:10 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 9CD7BEF5; Thu, 7 Feb 2013 21:24:10 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r17LOAvG011228; Thu, 7 Feb 2013 21:24:10 GMT (envelope-from jilles@svn.freebsd.org) Received: (from jilles@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r17LOAc3011227; Thu, 7 Feb 2013 21:24:10 GMT (envelope-from jilles@svn.freebsd.org) Message-Id: <201302072124.r17LOAc3011227@svn.freebsd.org> From: Jilles Tjoelker Date: Thu, 7 Feb 2013 21:24:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r246507 - head/bin/sh X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Feb 2013 21:24:10 -0000 Author: jilles Date: Thu Feb 7 21:24:10 2013 New Revision: 246507 URL: http://svnweb.freebsd.org/changeset/base/246507 Log: sh: Fix a comment. Modified: head/bin/sh/parser.h Modified: head/bin/sh/parser.h ============================================================================== --- head/bin/sh/parser.h Thu Feb 7 21:23:43 2013 (r246506) +++ head/bin/sh/parser.h Thu Feb 7 21:24:10 2013 (r246507) @@ -39,7 +39,7 @@ #define CTLENDVAR '\371' #define CTLBACKQ '\372' #define CTLQUOTE 01 /* ored with CTLBACKQ code if in quotes */ -/* CTLBACKQ | CTLQUOTE == '\205' */ +/* CTLBACKQ | CTLQUOTE == '\373' */ #define CTLARI '\374' #define CTLENDARI '\375' #define CTLQUOTEMARK '\376' From owner-svn-src-head@FreeBSD.ORG Thu Feb 7 21:24:20 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id E3FE8C8A; Thu, 7 Feb 2013 21:24:20 +0000 (UTC) (envelope-from monthadar@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id C639CEFB; Thu, 7 Feb 2013 21:24:20 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r17LOKPP011295; Thu, 7 Feb 2013 21:24:20 GMT (envelope-from monthadar@svn.freebsd.org) Received: (from monthadar@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r17LOKgb011293; Thu, 7 Feb 2013 21:24:20 GMT (envelope-from monthadar@svn.freebsd.org) Message-Id: <201302072124.r17LOKgb011293@svn.freebsd.org> From: Monthadar Al Jaberi Date: Thu, 7 Feb 2013 21:24:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r246508 - head/sys/net80211 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Feb 2013 21:24:21 -0000 Author: monthadar Date: Thu Feb 7 21:24:20 2013 New Revision: 246508 URL: http://svnweb.freebsd.org/changeset/base/246508 Log: Propagate GANN frames, and store know gate info. * Modified mesh_recv_action_meshgate to do following: + if mesh STA already knows the mesh gate of the recevied GANN frame + if mesh gate is know, check seq number according to 802.11 standard + if mesh gate is not know, add it to the list of known mesh gates + if forwarding is enabled and ttl >= 1 then propagate the GANN frame; * Declare a new malloc type M_80211_MESH_GT_RT; * Declare a struct to store GANN information, ieee80211_mesh_gate_route. And add it as a TAILQ list to ieee80211_mesh_state; Approved by: adrian (mentor) Modified: head/sys/net80211/ieee80211_mesh.c head/sys/net80211/ieee80211_mesh.h Modified: head/sys/net80211/ieee80211_mesh.c ============================================================================== --- head/sys/net80211/ieee80211_mesh.c Thu Feb 7 21:24:10 2013 (r246507) +++ head/sys/net80211/ieee80211_mesh.c Thu Feb 7 21:24:20 2013 (r246508) @@ -171,7 +171,8 @@ MALLOC_DEFINE(M_80211_MESH_PERR, "80211p /* The longer one of the lifetime should be stored as new lifetime */ #define MESH_ROUTE_LIFETIME_MAX(a, b) (a > b ? a : b) -MALLOC_DEFINE(M_80211_MESH_RT, "80211mesh", "802.11s routing table"); +MALLOC_DEFINE(M_80211_MESH_RT, "80211mesh_rt", "802.11s routing table"); +MALLOC_DEFINE(M_80211_MESH_GT_RT, "80211mesh_gt", "802.11s known gates table"); /* * Helper functions to manipulate the Mesh routing table. @@ -670,6 +671,7 @@ mesh_vattach(struct ieee80211vap *vap) ms->ms_seq = 0; ms->ms_flags = (IEEE80211_MESHFLAGS_AP | IEEE80211_MESHFLAGS_FWD); ms->ms_ttl = IEEE80211_MESH_DEFAULT_TTL; + TAILQ_INIT(&ms->ms_known_gates); TAILQ_INIT(&ms->ms_routes); mtx_init(&ms->ms_rt_lock, "MBSS", "802.11s routing table", MTX_DEF); callout_init(&ms->ms_cleantimer, CALLOUT_MPSAFE); @@ -2370,18 +2372,78 @@ mesh_recv_action_meshgate(struct ieee802 const uint8_t *frm, const uint8_t *efrm) { struct ieee80211vap *vap = ni->ni_vap; + struct ieee80211_mesh_state *ms = vap->iv_mesh; + struct ieee80211_mesh_gate_route *gr, *next; struct ieee80211_mesh_route *rt_gate; + struct ieee80211_meshgann_ie pgann; + int found = 0; const struct ieee80211_meshgann_ie *ie = (const struct ieee80211_meshgann_ie *) (frm+2); /* action + code */ - IEEE80211_NOTE_MAC(vap, IEEE80211_MSG_MESH, ie->gann_addr, - "%s", "received GANN from meshgate"); + if (IEEE80211_ADDR_EQ(vap->iv_myaddr, ie->gann_addr)) + return 0; + + IEEE80211_NOTE_MAC(vap, IEEE80211_MSG_MESH, ni->ni_macaddr, + "received GANN, meshgate: %6D (seq %u)", ie->gann_addr, ":", + ie->gann_seq); + + if (ms == NULL) + return (0); + MESH_RT_LOCK(ms); + TAILQ_FOREACH_SAFE(gr, &ms->ms_known_gates, gr_next, next) { + if (!IEEE80211_ADDR_EQ(gr->gr_addr, ie->gann_addr)) + continue; + if (ie->gann_seq <= gr->gr_lastseq) { + IEEE80211_DISCARD_MAC(vap, IEEE80211_MSG_MESH, + ni->ni_macaddr, NULL, + "GANN old seqno %u <= %u", + ie->gann_seq, gr->gr_lastseq); + MESH_RT_UNLOCK(ms); + return (0); + } + /* corresponding mesh gate found & GANN accepted */ + found = 1; + break; + + } + if (found == 0) { + /* this GANN is from a new mesh Gate add it to known table. */ + IEEE80211_NOTE_MAC(vap, IEEE80211_MSG_MESH, ie->gann_addr, + "stored new GANN information, seq %u.", ie->gann_seq); + gr = malloc(ALIGN(sizeof(struct ieee80211_mesh_gate_route)), + M_80211_MESH_GT_RT, M_NOWAIT | M_ZERO); + IEEE80211_ADDR_COPY(gr->gr_addr, ie->gann_addr); + TAILQ_INSERT_TAIL(&ms->ms_known_gates, gr, gr_next); + } + gr->gr_lastseq = ie->gann_seq; - rt_gate = ieee80211_mesh_rt_find(vap, ie->gann_addr); + /* check if we have a path to this gate */ + rt_gate = mesh_rt_find_locked(ms, gr->gr_addr); if (rt_gate != NULL && - rt_gate->rt_flags & IEEE80211_MESHRT_FLAGS_VALID) + rt_gate->rt_flags & IEEE80211_MESHRT_FLAGS_VALID) { + gr->gr_route = rt_gate; rt_gate->rt_flags |= IEEE80211_MESHRT_FLAGS_GATE; + } + + MESH_RT_UNLOCK(ms); + + /* popagate only if decremented ttl >= 1 && forwarding is enabled */ + if ((ie->gann_ttl - 1) < 1 && + !(ms->ms_flags & IEEE80211_MESHFLAGS_FWD)) + return 0; + pgann.gann_flags = ie->gann_flags; /* Reserved */ + pgann.gann_hopcount = ie->gann_hopcount + 1; + pgann.gann_ttl = ie->gann_ttl - 1; + IEEE80211_ADDR_COPY(pgann.gann_addr, ie->gann_addr); + pgann.gann_seq = ie->gann_seq; + pgann.gann_interval = ie->gann_interval; + + IEEE80211_NOTE_MAC(vap, IEEE80211_MSG_MESH, ie->gann_addr, + "%s", "propagate GANN"); + + ieee80211_send_action(vap->iv_bss, IEEE80211_ACTION_CAT_MESH, + IEEE80211_ACTION_MESH_GANN, &pgann); return 0; } Modified: head/sys/net80211/ieee80211_mesh.h ============================================================================== --- head/sys/net80211/ieee80211_mesh.h Thu Feb 7 21:24:10 2013 (r246507) +++ head/sys/net80211/ieee80211_mesh.h Thu Feb 7 21:24:20 2013 (r246508) @@ -405,6 +405,7 @@ MALLOC_DECLARE(M_80211_MESH_PREP); MALLOC_DECLARE(M_80211_MESH_PERR); MALLOC_DECLARE(M_80211_MESH_RT); +MALLOC_DECLARE(M_80211_MESH_GT_RT); /* * Basic forwarding information: * o Destination MAC @@ -437,6 +438,16 @@ struct ieee80211_mesh_route { }; #define IEEE80211_MESH_ROUTE_PRIV(rt, cast) ((cast *)rt->rt_priv) +/* + * Stored information about known mesh gates. + */ +struct ieee80211_mesh_gate_route { + TAILQ_ENTRY(ieee80211_mesh_gate_route) gr_next; + uint8_t gr_addr[IEEE80211_ADDR_LEN]; + uint32_t gr_lastseq; + struct ieee80211_mesh_route *gr_route; +}; + #define IEEE80211_MESH_PROTO_DSZ 12 /* description size */ /* * Mesh Path Selection Protocol. @@ -508,6 +519,7 @@ struct ieee80211_mesh_state { struct callout ms_cleantimer; struct callout ms_gatetimer; ieee80211_mesh_seq ms_gateseq; + TAILQ_HEAD(, ieee80211_mesh_gate_route) ms_known_gates; TAILQ_HEAD(, ieee80211_mesh_route) ms_routes; struct ieee80211_mesh_proto_metric *ms_pmetric; struct ieee80211_mesh_proto_path *ms_ppath; From owner-svn-src-head@FreeBSD.ORG Thu Feb 7 21:24:53 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 63705E24; Thu, 7 Feb 2013 21:24:53 +0000 (UTC) (envelope-from monthadar@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 538CBF09; Thu, 7 Feb 2013 21:24:53 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r17LOrS4011409; Thu, 7 Feb 2013 21:24:53 GMT (envelope-from monthadar@svn.freebsd.org) Received: (from monthadar@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r17LOqp1011406; Thu, 7 Feb 2013 21:24:52 GMT (envelope-from monthadar@svn.freebsd.org) Message-Id: <201302072124.r17LOqp1011406@svn.freebsd.org> From: Monthadar Al Jaberi Date: Thu, 7 Feb 2013 21:24:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r246509 - head/sys/net80211 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Feb 2013 21:24:53 -0000 Author: monthadar Date: Thu Feb 7 21:24:52 2013 New Revision: 246509 URL: http://svnweb.freebsd.org/changeset/base/246509 Log: Mark root mesh as gate when mesh gate flag set. * Add function ieee80211_mesh_mark_gate in ieee80211_mesh.h; * When received a proactive PREQ or RANN with corresponding mesh gate flag set, create a new entry in the known mesh gate list; Approved by: adrian (mentor) Modified: head/sys/net80211/ieee80211_hwmp.c head/sys/net80211/ieee80211_mesh.c head/sys/net80211/ieee80211_mesh.h Modified: head/sys/net80211/ieee80211_hwmp.c ============================================================================== --- head/sys/net80211/ieee80211_hwmp.c Thu Feb 7 21:24:20 2013 (r246508) +++ head/sys/net80211/ieee80211_hwmp.c Thu Feb 7 21:24:52 2013 (r246509) @@ -1092,6 +1092,16 @@ hwmp_recv_preq(struct ieee80211vap *vap, IEEE80211_NOTE(vap, IEEE80211_MSG_HWMP, ni, "root mesh station @ %6D", preq->preq_origaddr, ":"); + /* Check if root is a mesh gate, mark it */ + if (preq->preq_flags & IEEE80211_MESHPREQ_FLAGS_GATE) { + struct ieee80211_mesh_gate_route *gr; + + rtorig->rt_flags |= IEEE80211_MESHRT_FLAGS_GATE; + gr = ieee80211_mesh_mark_gate(vap, preq->preq_origaddr, + rtorig); + gr->gr_lastseq = 0; /* NOT GANN */ + } + /* * Reply with a PREP if we don't have a path to the root * or if the root sent us a proactive PREQ. @@ -1745,6 +1755,15 @@ hwmp_recv_rann(struct ieee80211vap *vap, } } hr = IEEE80211_MESH_ROUTE_PRIV(rt, struct ieee80211_hwmp_route); + /* Check if root is a mesh gate, mark it */ + if (rann->rann_flags & IEEE80211_MESHRANN_FLAGS_GATE) { + struct ieee80211_mesh_gate_route *gr; + + rt->rt_flags |= IEEE80211_MESHRT_FLAGS_GATE; + gr = ieee80211_mesh_mark_gate(vap, rann->rann_addr, + rt); + gr->gr_lastseq = 0; /* NOT GANN */ + } /* discovery timeout */ ieee80211_mesh_rt_update(rt, ticks_to_msecs(ieee80211_hwmp_roottimeout)); Modified: head/sys/net80211/ieee80211_mesh.c ============================================================================== --- head/sys/net80211/ieee80211_mesh.c Thu Feb 7 21:24:20 2013 (r246508) +++ head/sys/net80211/ieee80211_mesh.c Thu Feb 7 21:24:52 2013 (r246509) @@ -854,6 +854,43 @@ mesh_rt_cleanup_cb(void *arg) mesh_rt_cleanup_cb, vap); } +/* + * Mark a mesh STA as gate and return a pointer to it. + * If this is first time, we create a new gate route. + * Always update the path route to this mesh gate. + */ +struct ieee80211_mesh_gate_route * +ieee80211_mesh_mark_gate(struct ieee80211vap *vap, const uint8_t *addr, + struct ieee80211_mesh_route *rt) +{ + struct ieee80211_mesh_state *ms = vap->iv_mesh; + struct ieee80211_mesh_gate_route *gr = NULL, *next; + int found = 0; + + MESH_RT_LOCK(ms); + TAILQ_FOREACH_SAFE(gr, &ms->ms_known_gates, gr_next, next) { + if (IEEE80211_ADDR_EQ(gr->gr_addr, addr)) { + found = 1; + break; + } + } + + if (!found) { + /* New mesh gate add it to known table. */ + IEEE80211_NOTE_MAC(vap, IEEE80211_MSG_MESH, addr, + "%s", "stored new gate information from pro-PREQ."); + gr = malloc(ALIGN(sizeof(struct ieee80211_mesh_gate_route)), + M_80211_MESH_GT_RT, M_NOWAIT | M_ZERO); + IEEE80211_ADDR_COPY(gr->gr_addr, addr); + TAILQ_INSERT_TAIL(&ms->ms_known_gates, gr, gr_next); + } + gr->gr_route = rt; + /* TODO: link from path route to gate route */ + MESH_RT_UNLOCK(ms); + + return gr; +} + /* * Helper function to note the Mesh Peer Link FSM change. Modified: head/sys/net80211/ieee80211_mesh.h ============================================================================== --- head/sys/net80211/ieee80211_mesh.h Thu Feb 7 21:24:20 2013 (r246508) +++ head/sys/net80211/ieee80211_mesh.h Thu Feb 7 21:24:52 2013 (r246509) @@ -566,6 +566,9 @@ void ieee80211_mesh_init_neighbor(struc const struct ieee80211_scanparams *); void ieee80211_mesh_update_beacon(struct ieee80211vap *, struct ieee80211_beacon_offsets *); +struct ieee80211_mesh_gate_route * + ieee80211_mesh_mark_gate(struct ieee80211vap *, + const uint8_t *, struct ieee80211_mesh_route *); /* * Return non-zero if proxy operation is enabled. From owner-svn-src-head@FreeBSD.ORG Thu Feb 7 21:25:34 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 071A5FE0; Thu, 7 Feb 2013 21:25:34 +0000 (UTC) (envelope-from monthadar@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id DD3ECF24; Thu, 7 Feb 2013 21:25:33 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r17LPXHo011552; Thu, 7 Feb 2013 21:25:33 GMT (envelope-from monthadar@svn.freebsd.org) Received: (from monthadar@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r17LPXku011546; Thu, 7 Feb 2013 21:25:33 GMT (envelope-from monthadar@svn.freebsd.org) Message-Id: <201302072125.r17LPXku011546@svn.freebsd.org> From: Monthadar Al Jaberi Date: Thu, 7 Feb 2013 21:25:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r246510 - head/sys/net80211 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Feb 2013 21:25:34 -0000 Author: monthadar Date: Thu Feb 7 21:25:32 2013 New Revision: 246510 URL: http://svnweb.freebsd.org/changeset/base/246510 Log: Send frames to mesh gate if 11s discovery fails. * Send frames that have no path to a known valid Mesh Gate; * Added the function ieee80211_mesh_forward_to_gates that sends the frame to the first found Mesh Gate in the forwarding information; * If we try to discover again while we are discovering queue frame, the discovery callout will send the frames either to mesh gates or discards them silently; * Queue frame also if we try to discover to frequently; Approved by: adrian (mentor) Modified: head/sys/net80211/ieee80211_hwmp.c head/sys/net80211/ieee80211_mesh.c head/sys/net80211/ieee80211_mesh.h Modified: head/sys/net80211/ieee80211_hwmp.c ============================================================================== --- head/sys/net80211/ieee80211_hwmp.c Thu Feb 7 21:24:52 2013 (r246509) +++ head/sys/net80211/ieee80211_hwmp.c Thu Feb 7 21:25:32 2013 (r246510) @@ -1839,12 +1839,11 @@ hwmp_rediscover_cb(void *arg) hr = IEEE80211_MESH_ROUTE_PRIV(rt, struct ieee80211_hwmp_route); if (hr->hr_preqretries >= ieee80211_hwmp_maxpreq_retries) { - IEEE80211_DISCARD_MAC(vap, IEEE80211_MSG_ANY, - rt->rt_dest, NULL, "%s", - "no valid path , max number of discovery, send GATE"); - /* TODO: send to known gates */ + IEEE80211_NOTE_MAC(vap, IEEE80211_MSG_ANY, + rt->rt_dest, "%s", + "max number of discovery, send queued frames to GATE"); + ieee80211_mesh_forward_to_gates(vap, rt); vap->iv_stats.is_mesh_fwd_nopath++; - rt->rt_flags = 0; /* Mark invalid */ return ; /* XXX: flush queue? */ } @@ -1914,6 +1913,12 @@ hwmp_discover(struct ieee80211vap *vap, } hr = IEEE80211_MESH_ROUTE_PRIV(rt, struct ieee80211_hwmp_route); + if (rt->rt_flags & IEEE80211_MESHRT_FLAGS_DISCOVER) { + IEEE80211_NOTE_MAC(vap, IEEE80211_MSG_HWMP, dest, + "%s", "already discovering queue frame until path found"); + sendpreq = 1; + goto done; + } if ((rt->rt_flags & IEEE80211_MESHRT_FLAGS_VALID) == 0) { if (hr->hr_lastdiscovery != 0 && (ticks - hr->hr_lastdiscovery < @@ -1921,7 +1926,7 @@ hwmp_discover(struct ieee80211vap *vap, IEEE80211_DISCARD_MAC(vap, IEEE80211_MSG_ANY, dest, NULL, "%s", "too frequent discovery requeust"); - /* XXX: stats? */ + sendpreq = 1; goto done; } hr->hr_lastdiscovery = ticks; Modified: head/sys/net80211/ieee80211_mesh.c ============================================================================== --- head/sys/net80211/ieee80211_mesh.c Thu Feb 7 21:24:52 2013 (r246509) +++ head/sys/net80211/ieee80211_mesh.c Thu Feb 7 21:25:32 2013 (r246510) @@ -1022,6 +1022,71 @@ mesh_find_txnode(struct ieee80211vap *va } /* + * Forward the queued frames to known valid mesh gates. + * Assume destination to be outside the MBSS (i.e. proxy entry), + * If no valid mesh gates are known silently discard queued frames. + * If there is no 802.2 path route will be timedout. + */ +void +ieee80211_mesh_forward_to_gates(struct ieee80211vap *vap, + struct ieee80211_mesh_route *rt_dest) +{ + struct ieee80211com *ic = vap->iv_ic; + struct ieee80211_mesh_state *ms = vap->iv_mesh; + struct ifnet *ifp = vap->iv_ifp; + struct ieee80211_mesh_route *rt_gate; + struct ieee80211_mesh_gate_route *gr = NULL, *gr_next; + struct mbuf *m, *next; + int gates_found = 0; + + KASSERT( rt_dest->rt_flags == IEEE80211_MESHRT_FLAGS_DISCOVER, + ("Route is not marked with IEEE80211_MESHRT_FLAGS_DISCOVER")); + + /* XXX: send to more than one valid mash gate */ + MESH_RT_LOCK(ms); + TAILQ_FOREACH_SAFE(gr, &ms->ms_known_gates, gr_next, gr_next) { + rt_gate = gr->gr_route; + if (rt_gate == NULL) { + IEEE80211_NOTE_MAC(vap, IEEE80211_MSG_HWMP, + rt_dest->rt_dest, + "mesh gate with no path %6D", + gr->gr_addr, ":"); + continue; + } + gates_found = 1; + /* convert route to a proxy route */ + rt_dest->rt_flags = IEEE80211_MESHRT_FLAGS_PROXY | + IEEE80211_MESHRT_FLAGS_VALID; + rt_dest->rt_ext_seq = 1; /* random value */ + IEEE80211_ADDR_COPY(rt_dest->rt_mesh_gate, rt_gate->rt_dest); + IEEE80211_ADDR_COPY(rt_dest->rt_nexthop, rt_gate->rt_nexthop); + rt_dest->rt_metric = rt_gate->rt_metric; + rt_dest->rt_nhops = rt_gate->rt_nhops; + ieee80211_mesh_rt_update(rt_dest, ms->ms_ppath->mpp_inact); + MESH_RT_UNLOCK(ms); + m = ieee80211_ageq_remove(&ic->ic_stageq, + (struct ieee80211_node *)(uintptr_t) + ieee80211_mac_hash(ic, rt_dest->rt_dest)); + for (; m != NULL; m = next) { + next = m->m_nextpkt; + m->m_nextpkt = NULL; + IEEE80211_NOTE_MAC(vap, IEEE80211_MSG_HWMP, rt_dest->rt_dest, + "flush queued frame %p len %d", m, m->m_pkthdr.len); + ifp->if_transmit(ifp, m); + } + MESH_RT_LOCK(ms); + } + + if (gates_found == 0) { + rt_dest->rt_flags = 0; /* Mark invalid */ + IEEE80211_NOTE_MAC(vap, IEEE80211_MSG_HWMP, rt_dest->rt_dest, + "%s", "no mesh gate found, or no path setup for mesh gate yet"); + } + MESH_RT_UNLOCK(ms); + +} + +/* * Forward the specified frame. * Decrement the TTL and set TA to our MAC address. */ Modified: head/sys/net80211/ieee80211_mesh.h ============================================================================== --- head/sys/net80211/ieee80211_mesh.h Thu Feb 7 21:24:52 2013 (r246509) +++ head/sys/net80211/ieee80211_mesh.h Thu Feb 7 21:25:32 2013 (r246510) @@ -569,6 +569,8 @@ void ieee80211_mesh_update_beacon(struc struct ieee80211_mesh_gate_route * ieee80211_mesh_mark_gate(struct ieee80211vap *, const uint8_t *, struct ieee80211_mesh_route *); +void ieee80211_mesh_forward_to_gates(struct ieee80211vap *, + struct ieee80211_mesh_route *); /* * Return non-zero if proxy operation is enabled. From owner-svn-src-head@FreeBSD.ORG Thu Feb 7 21:26:06 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id CC5951F6; Thu, 7 Feb 2013 21:26:06 +0000 (UTC) (envelope-from monthadar@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id BC1A0F37; Thu, 7 Feb 2013 21:26:06 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r17LQ6fX011676; Thu, 7 Feb 2013 21:26:06 GMT (envelope-from monthadar@svn.freebsd.org) Received: (from monthadar@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r17LQ6Ri011675; Thu, 7 Feb 2013 21:26:06 GMT (envelope-from monthadar@svn.freebsd.org) Message-Id: <201302072126.r17LQ6Ri011675@svn.freebsd.org> From: Monthadar Al Jaberi Date: Thu, 7 Feb 2013 21:26:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r246511 - head/sys/net80211 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Feb 2013 21:26:06 -0000 Author: monthadar Date: Thu Feb 7 21:26:06 2013 New Revision: 246511 URL: http://svnweb.freebsd.org/changeset/base/246511 Log: Mesh gate code to transmit to all mesh gates. * Modified mesh_find_txnode to be able to handle proxy marked entries by recursively calling itself to find the txnode towards the active mesh gate; * Mesh Gate: Added a new function that transmits data frames similar to ieee80211_start; * Modified ieee80211_mesh_forward_to_gates so that: + Frames are duplicated and sent to each valid Mesh Gate; + Route is marked invalid before return of function, this is because we dont know yet which Mesh Gate is we will use; Approved by: adrian (mentor) Modified: head/sys/net80211/ieee80211_mesh.c Modified: head/sys/net80211/ieee80211_mesh.c ============================================================================== --- head/sys/net80211/ieee80211_mesh.c Thu Feb 7 21:25:32 2013 (r246510) +++ head/sys/net80211/ieee80211_mesh.c Thu Feb 7 21:26:06 2013 (r246511) @@ -52,6 +52,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include #include @@ -79,6 +80,8 @@ static int mesh_checkpseq(struct ieee802 static struct ieee80211_node * mesh_find_txnode(struct ieee80211vap *, const uint8_t [IEEE80211_ADDR_LEN]); +static void mesh_transmit_to_gate(struct ieee80211vap *, struct mbuf *, + struct ieee80211_mesh_route *); static void mesh_forward(struct ieee80211vap *, struct mbuf *, const struct ieee80211_meshcntl *); static int mesh_input(struct ieee80211_node *, struct mbuf *, int, int); @@ -1011,21 +1014,151 @@ mesh_find_txnode(struct ieee80211vap *va rt = ieee80211_mesh_rt_find(vap, dest); if (rt == NULL) return NULL; - if ((rt->rt_flags & IEEE80211_MESHRT_FLAGS_VALID) == 0 || - (rt->rt_flags & IEEE80211_MESHRT_FLAGS_PROXY)) { + if ((rt->rt_flags & IEEE80211_MESHRT_FLAGS_VALID) == 0) { IEEE80211_NOTE_MAC(vap, IEEE80211_MSG_MESH, dest, - "%s: !valid or proxy, flags 0x%x", __func__, rt->rt_flags); + "%s: !valid, flags 0x%x", __func__, rt->rt_flags); /* XXX stat */ return NULL; } + if (rt->rt_flags & IEEE80211_MESHRT_FLAGS_PROXY) { + rt = ieee80211_mesh_rt_find(vap, rt->rt_mesh_gate); + if (rt == NULL) return NULL; + if ((rt->rt_flags & IEEE80211_MESHRT_FLAGS_VALID) == 0) { + IEEE80211_NOTE_MAC(vap, IEEE80211_MSG_MESH, dest, + "%s: meshgate !valid, flags 0x%x", __func__, + rt->rt_flags); + /* XXX stat */ + return NULL; + } + } return ieee80211_find_txnode(vap, rt->rt_nexthop); } +static void +mesh_transmit_to_gate(struct ieee80211vap *vap, struct mbuf *m, + struct ieee80211_mesh_route *rt_gate) +{ + struct ifnet *ifp = vap->iv_ifp; + struct ieee80211com *ic = vap->iv_ic; + struct ifnet *parent = ic->ic_ifp; + struct ieee80211_node *ni; + struct ether_header *eh; + int error; + + eh = mtod(m, struct ether_header *); + ni = mesh_find_txnode(vap, rt_gate->rt_dest); + if (ni == NULL) { + ifp->if_oerrors++; + m_freem(m); + return; + } + + if ((ni->ni_flags & IEEE80211_NODE_PWR_MGT) && + (m->m_flags & M_PWR_SAV) == 0) { + /* + * Station in power save mode; pass the frame + * to the 802.11 layer and continue. We'll get + * the frame back when the time is right. + * XXX lose WDS vap linkage? + */ + (void) ieee80211_pwrsave(ni, m); + ieee80211_free_node(ni); + return; + } + + /* calculate priority so drivers can find the tx queue */ + if (ieee80211_classify(ni, m)) { + IEEE80211_DISCARD_MAC(vap, IEEE80211_MSG_OUTPUT, + eh->ether_dhost, NULL, + "%s", "classification failure"); + vap->iv_stats.is_tx_classify++; + ifp->if_oerrors++; + m_freem(m); + ieee80211_free_node(ni); + return; + } + /* + * Stash the node pointer. Note that we do this after + * any call to ieee80211_dwds_mcast because that code + * uses any existing value for rcvif to identify the + * interface it (might have been) received on. + */ + m->m_pkthdr.rcvif = (void *)ni; + + BPF_MTAP(ifp, m); /* 802.3 tx */ + + /* + * Check if A-MPDU tx aggregation is setup or if we + * should try to enable it. The sta must be associated + * with HT and A-MPDU enabled for use. When the policy + * routine decides we should enable A-MPDU we issue an + * ADDBA request and wait for a reply. The frame being + * encapsulated will go out w/o using A-MPDU, or possibly + * it might be collected by the driver and held/retransmit. + * The default ic_ampdu_enable routine handles staggering + * ADDBA requests in case the receiver NAK's us or we are + * otherwise unable to establish a BA stream. + */ + if ((ni->ni_flags & IEEE80211_NODE_AMPDU_TX) && + (vap->iv_flags_ht & IEEE80211_FHT_AMPDU_TX) && + (m->m_flags & M_EAPOL) == 0) { + int tid = WME_AC_TO_TID(M_WME_GETAC(m)); + struct ieee80211_tx_ampdu *tap = &ni->ni_tx_ampdu[tid]; + + ieee80211_txampdu_count_packet(tap); + if (IEEE80211_AMPDU_RUNNING(tap)) { + /* + * Operational, mark frame for aggregation. + * + * XXX do tx aggregation here + */ + m->m_flags |= M_AMPDU_MPDU; + } else if (!IEEE80211_AMPDU_REQUESTED(tap) && + ic->ic_ampdu_enable(ni, tap)) { + /* + * Not negotiated yet, request service. + */ + ieee80211_ampdu_request(ni, tap); + /* XXX hold frame for reply? */ + } + } +#ifdef IEEE80211_SUPPORT_SUPERG + else if (IEEE80211_ATH_CAP(vap, ni, IEEE80211_NODE_FF)) { + m = ieee80211_ff_check(ni, m); + if (m == NULL) { + /* NB: any ni ref held on stageq */ + return; + } + } +#endif /* IEEE80211_SUPPORT_SUPERG */ + if (__predict_true((vap->iv_caps & IEEE80211_C_8023ENCAP) == 0)) { + /* + * Encapsulate the packet in prep for transmission. + */ + m = ieee80211_encap(vap, ni, m); + if (m == NULL) { + /* NB: stat+msg handled in ieee80211_encap */ + ieee80211_free_node(ni); + return; + } + } + error = parent->if_transmit(parent, m); + if (error != 0) { + m_freem(m); + ieee80211_free_node(ni); + } else { + ifp->if_opackets++; + } + ic->ic_lastdata = ticks; +} + /* * Forward the queued frames to known valid mesh gates. * Assume destination to be outside the MBSS (i.e. proxy entry), * If no valid mesh gates are known silently discard queued frames. - * If there is no 802.2 path route will be timedout. + * After transmitting frames to all known valid mesh gates, this route + * will be marked invalid, and a new path discovery will happen in the hopes + * that (at least) one of the mesh gates have a new proxy entry for us to use. */ void ieee80211_mesh_forward_to_gates(struct ieee80211vap *vap, @@ -1033,17 +1166,20 @@ ieee80211_mesh_forward_to_gates(struct i { struct ieee80211com *ic = vap->iv_ic; struct ieee80211_mesh_state *ms = vap->iv_mesh; - struct ifnet *ifp = vap->iv_ifp; struct ieee80211_mesh_route *rt_gate; struct ieee80211_mesh_gate_route *gr = NULL, *gr_next; - struct mbuf *m, *next; - int gates_found = 0; + struct mbuf *m, *mcopy, *next; KASSERT( rt_dest->rt_flags == IEEE80211_MESHRT_FLAGS_DISCOVER, ("Route is not marked with IEEE80211_MESHRT_FLAGS_DISCOVER")); /* XXX: send to more than one valid mash gate */ MESH_RT_LOCK(ms); + + m = ieee80211_ageq_remove(&ic->ic_stageq, + (struct ieee80211_node *)(uintptr_t) + ieee80211_mac_hash(ic, rt_dest->rt_dest)); + TAILQ_FOREACH_SAFE(gr, &ms->ms_known_gates, gr_next, gr_next) { rt_gate = gr->gr_route; if (rt_gate == NULL) { @@ -1053,8 +1189,18 @@ ieee80211_mesh_forward_to_gates(struct i gr->gr_addr, ":"); continue; } - gates_found = 1; - /* convert route to a proxy route */ + if ((rt_gate->rt_flags & IEEE80211_MESHRT_FLAGS_VALID) == 0) + continue; + KASSERT(rt_gate->rt_flags & IEEE80211_MESHRT_FLAGS_GATE, + ("route not marked as a mesh gate")); + KASSERT((rt_gate->rt_flags & + IEEE80211_MESHRT_FLAGS_PROXY) == 0, + ("found mesh gate that is also marked porxy")); + /* + * convert route to a proxy route gated by the current + * mesh gate, this is needed so encap can built data + * frame with correct address. + */ rt_dest->rt_flags = IEEE80211_MESHRT_FLAGS_PROXY | IEEE80211_MESHRT_FLAGS_VALID; rt_dest->rt_ext_seq = 1; /* random value */ @@ -1064,26 +1210,22 @@ ieee80211_mesh_forward_to_gates(struct i rt_dest->rt_nhops = rt_gate->rt_nhops; ieee80211_mesh_rt_update(rt_dest, ms->ms_ppath->mpp_inact); MESH_RT_UNLOCK(ms); - m = ieee80211_ageq_remove(&ic->ic_stageq, - (struct ieee80211_node *)(uintptr_t) - ieee80211_mac_hash(ic, rt_dest->rt_dest)); - for (; m != NULL; m = next) { - next = m->m_nextpkt; - m->m_nextpkt = NULL; - IEEE80211_NOTE_MAC(vap, IEEE80211_MSG_HWMP, rt_dest->rt_dest, - "flush queued frame %p len %d", m, m->m_pkthdr.len); - ifp->if_transmit(ifp, m); + /* XXX: lock?? */ + mcopy = m_dup(m, M_NOWAIT); + for (; mcopy != NULL; mcopy = next) { + next = mcopy->m_nextpkt; + mcopy->m_nextpkt = NULL; + IEEE80211_NOTE_MAC(vap, IEEE80211_MSG_HWMP, + rt_dest->rt_dest, + "flush queued frame %p len %d", mcopy, + mcopy->m_pkthdr.len); + mesh_transmit_to_gate(vap, mcopy, rt_gate); } MESH_RT_LOCK(ms); } - - if (gates_found == 0) { - rt_dest->rt_flags = 0; /* Mark invalid */ - IEEE80211_NOTE_MAC(vap, IEEE80211_MSG_HWMP, rt_dest->rt_dest, - "%s", "no mesh gate found, or no path setup for mesh gate yet"); - } + rt_dest->rt_flags = 0; /* Mark invalid */ + m_freem(m); MESH_RT_UNLOCK(ms); - } /* From owner-svn-src-head@FreeBSD.ORG Thu Feb 7 21:26:41 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 35A6537C; Thu, 7 Feb 2013 21:26:41 +0000 (UTC) (envelope-from monthadar@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 1AE25F44; Thu, 7 Feb 2013 21:26:41 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r17LQfsd011791; Thu, 7 Feb 2013 21:26:41 GMT (envelope-from monthadar@svn.freebsd.org) Received: (from monthadar@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r17LQeQL011788; Thu, 7 Feb 2013 21:26:40 GMT (envelope-from monthadar@svn.freebsd.org) Message-Id: <201302072126.r17LQeQL011788@svn.freebsd.org> From: Monthadar Al Jaberi Date: Thu, 7 Feb 2013 21:26:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r246512 - head/sys/net80211 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Feb 2013 21:26:41 -0000 Author: monthadar Date: Thu Feb 7 21:26:40 2013 New Revision: 246512 URL: http://svnweb.freebsd.org/changeset/base/246512 Log: HWMP: ic->raw_xmit didn't always point to correct ni. This is a code re-write. ic->raw_xmit need a pointer to ieee80211_node for the destination node (da). I have reorganized the code so that a pointer to the da node is searched for in the end & in one place. * Make mesh_find_txnode public to be used by HWMP, renamed to ieee80211_mesh_finx_txnode; * changed the argument from ieee80211_node to ieee80211vap for all hwmp_send_* functions; * removed the 'sa' argument from hwmp_send_* functions as all HWMP frames have the source address equal to vap->iv_myaddr; * Modified hwmp_send_action so that if da is MULTCAST ni=vap->iv_bss otherwise we called ieee80211_mesh_find_txnode. Also no need to hold a reference in this functions if da is not MULTICAST as by finding the node it became referenced in ieee80211_find_txnode; Approved by: adrian (mentor) Modified: head/sys/net80211/ieee80211_hwmp.c head/sys/net80211/ieee80211_mesh.c head/sys/net80211/ieee80211_mesh.h Modified: head/sys/net80211/ieee80211_hwmp.c ============================================================================== --- head/sys/net80211/ieee80211_hwmp.c Thu Feb 7 21:26:06 2013 (r246511) +++ head/sys/net80211/ieee80211_hwmp.c Thu Feb 7 21:26:40 2013 (r246512) @@ -68,8 +68,7 @@ static void hwmp_vattach(struct ieee8021 static void hwmp_vdetach(struct ieee80211vap *); static int hwmp_newstate(struct ieee80211vap *, enum ieee80211_state, int); -static int hwmp_send_action(struct ieee80211_node *, - const uint8_t [IEEE80211_ADDR_LEN], +static int hwmp_send_action(struct ieee80211vap *, const uint8_t [IEEE80211_ADDR_LEN], uint8_t *, size_t); static uint8_t * hwmp_add_meshpreq(uint8_t *, @@ -86,23 +85,20 @@ static void hwmp_rootmode_rann_cb(void * static void hwmp_recv_preq(struct ieee80211vap *, struct ieee80211_node *, const struct ieee80211_frame *, const struct ieee80211_meshpreq_ie *); -static int hwmp_send_preq(struct ieee80211_node *, - const uint8_t [IEEE80211_ADDR_LEN], +static int hwmp_send_preq(struct ieee80211vap *, const uint8_t [IEEE80211_ADDR_LEN], struct ieee80211_meshpreq_ie *, struct timeval *, struct timeval *); static void hwmp_recv_prep(struct ieee80211vap *, struct ieee80211_node *, const struct ieee80211_frame *, const struct ieee80211_meshprep_ie *); -static int hwmp_send_prep(struct ieee80211_node *, - const uint8_t [IEEE80211_ADDR_LEN], +static int hwmp_send_prep(struct ieee80211vap *, const uint8_t [IEEE80211_ADDR_LEN], struct ieee80211_meshprep_ie *); static void hwmp_recv_perr(struct ieee80211vap *, struct ieee80211_node *, const struct ieee80211_frame *, const struct ieee80211_meshperr_ie *); -static int hwmp_send_perr(struct ieee80211_node *, - const uint8_t [IEEE80211_ADDR_LEN], +static int hwmp_send_perr(struct ieee80211vap *, const uint8_t [IEEE80211_ADDR_LEN], struct ieee80211_meshperr_ie *); static void hwmp_senderror(struct ieee80211vap *, @@ -111,8 +107,7 @@ static void hwmp_senderror(struct ieee80 static void hwmp_recv_rann(struct ieee80211vap *, struct ieee80211_node *, const struct ieee80211_frame *, const struct ieee80211_meshrann_ie *); -static int hwmp_send_rann(struct ieee80211_node *, - const uint8_t [IEEE80211_ADDR_LEN], +static int hwmp_send_rann(struct ieee80211vap *, const uint8_t [IEEE80211_ADDR_LEN], struct ieee80211_meshrann_ie *); static struct ieee80211_node * @@ -588,17 +583,30 @@ hwmp_recv_action_meshpath(struct ieee802 } static int -hwmp_send_action(struct ieee80211_node *ni, - const uint8_t sa[IEEE80211_ADDR_LEN], +hwmp_send_action(struct ieee80211vap *vap, const uint8_t da[IEEE80211_ADDR_LEN], uint8_t *ie, size_t len) { - struct ieee80211vap *vap = ni->ni_vap; - struct ieee80211com *ic = ni->ni_ic; + struct ieee80211_node *ni; + struct ieee80211com *ic; struct ieee80211_bpf_params params; struct mbuf *m; uint8_t *frm; + if (IEEE80211_IS_MULTICAST(da)) { + ni = ieee80211_ref_node(vap->iv_bss); +#ifdef IEEE80211_DEBUG_REFCNT + IEEE80211_DPRINTF(vap, IEEE80211_MSG_NODE, + "ieee80211_ref_node (%s:%u) %p<%s> refcnt %d\n", + __func__, __LINE__, + ni, ether_sprintf(ni->ni_macaddr), + ieee80211_node_refcnt(ni)+1); +#endif + ieee80211_ref_node(ni); + } + else + ni = ieee80211_mesh_find_txnode(vap, da); + if (vap->iv_state == IEEE80211_S_CAC) { IEEE80211_NOTE(vap, IEEE80211_MSG_OUTPUT, ni, "block %s frame in CAC state", "HWMP action"); @@ -607,19 +615,7 @@ hwmp_send_action(struct ieee80211_node * } KASSERT(ni != NULL, ("null node")); - /* - * Hold a reference on the node so it doesn't go away until after - * the xmit is complete all the way in the driver. On error we - * will remove our reference. - */ -#ifdef IEEE80211_DEBUG_REFCNT - IEEE80211_DPRINTF(vap, IEEE80211_MSG_NODE, - "ieee80211_ref_node (%s:%u) %p<%s> refcnt %d\n", - __func__, __LINE__, - ni, ether_sprintf(ni->ni_macaddr), - ieee80211_node_refcnt(ni)+1); -#endif - ieee80211_ref_node(ni); + ic = ni->ni_ic; m = ieee80211_getmgtframe(&frm, ic->ic_headroom + sizeof(struct ieee80211_frame), @@ -660,7 +656,7 @@ hwmp_send_action(struct ieee80211_node * } ieee80211_send_setup(ni, m, IEEE80211_FC0_TYPE_MGT | IEEE80211_FC0_SUBTYPE_ACTION, - IEEE80211_NONQOS_TID, sa, da, sa); + IEEE80211_NONQOS_TID, vap->iv_myaddr, da, vap->iv_myaddr); m->m_flags |= M_ENCAP; /* mark encapsulated */ IEEE80211_NODE_STAT(ni, tx_mgmt); @@ -862,8 +858,8 @@ hwmp_rootmode_cb(void *arg) IEEE80211_MESHPREQ_TFLAGS_USN; PREQ_TSEQ(0) = 0; vap->iv_stats.is_hwmp_rootreqs++; - hwmp_send_preq(vap->iv_bss, vap->iv_myaddr, broadcastaddr, &preq, - NULL, NULL); /* NB: we enforce rate check ourself */ + /* NB: we enforce rate check ourself */ + hwmp_send_preq(vap, broadcastaddr, &preq, NULL, NULL); hwmp_rootmode_setup(vap); } #undef PREQ_TFLAGS @@ -896,7 +892,7 @@ hwmp_rootmode_rann_cb(void *arg) rann.rann_metric = IEEE80211_MESHLMETRIC_INITIALVAL; vap->iv_stats.is_hwmp_rootrann++; - hwmp_send_rann(vap->iv_bss, vap->iv_myaddr, broadcastaddr, &rann); + hwmp_send_rann(vap, broadcastaddr, &rann); hwmp_rootmode_setup(vap); } @@ -1060,7 +1056,7 @@ hwmp_recv_preq(struct ieee80211vap *vap, IEEE80211_NOTE(vap, IEEE80211_MSG_HWMP, ni, "reply to %6D", preq->preq_origaddr, ":"); - hwmp_send_prep(ni, vap->iv_myaddr, wh->i_addr2, &prep); + hwmp_send_prep(vap, wh->i_addr2, &prep); return; } /* we may update our proxy information for the orig external */ @@ -1119,8 +1115,7 @@ hwmp_recv_preq(struct ieee80211vap *vap, IEEE80211_ADDR_COPY(prep.prep_targetaddr, vap->iv_myaddr); prep.prep_targetseq = ++hs->hs_seq; - hwmp_send_prep(vap->iv_bss, vap->iv_myaddr, - rtorig->rt_nexthop, &prep); + hwmp_send_prep(vap, rtorig->rt_nexthop, &prep); } } @@ -1161,8 +1156,7 @@ hwmp_recv_preq(struct ieee80211vap *vap, IEEE80211_ADDR_COPY(&prep.prep_origaddr, preq->preq_origaddr); prep.prep_origseq = hrorig->hr_seq; - hwmp_send_prep(ni, vap->iv_myaddr, - rtorig->rt_nexthop, &prep); + hwmp_send_prep(vap, rtorig->rt_nexthop, &prep); /* * Set TO and unset RF bits because we have @@ -1181,8 +1175,7 @@ hwmp_recv_preq(struct ieee80211vap *vap, ppreq.preq_metric += ms->ms_pmetric->mpm_metric(ni); /* don't do PREQ ratecheck when we propagate */ - hwmp_send_preq(ni, vap->iv_myaddr, broadcastaddr, - &ppreq, NULL, NULL); + hwmp_send_preq(vap, broadcastaddr, &ppreq, NULL, NULL); } } #undef PREQ_TFLAGS @@ -1190,8 +1183,7 @@ hwmp_recv_preq(struct ieee80211vap *vap, #undef PREQ_TSEQ static int -hwmp_send_preq(struct ieee80211_node *ni, - const uint8_t sa[IEEE80211_ADDR_LEN], +hwmp_send_preq(struct ieee80211vap *vap, const uint8_t da[IEEE80211_ADDR_LEN], struct ieee80211_meshpreq_ie *preq, struct timeval *last, struct timeval *minint) @@ -1220,7 +1212,7 @@ hwmp_send_preq(struct ieee80211_node *ni preq->preq_len = (preq->preq_flags & IEEE80211_MESHPREQ_FLAGS_AE ? IEEE80211_MESHPREQ_BASE_SZ_AE : IEEE80211_MESHPREQ_BASE_SZ) + preq->preq_tcount * IEEE80211_MESHPREQ_TRGT_SZ; - return hwmp_send_action(ni, sa, da, (uint8_t *)preq, preq->preq_len+2); + return hwmp_send_action(vap, da, (uint8_t *)preq, preq->preq_len+2); } static void @@ -1354,7 +1346,7 @@ hwmp_recv_prep(struct ieee80211vap *vap, pprep.prep_hopcount += 1; pprep.prep_ttl -= 1; pprep.prep_metric += ms->ms_pmetric->mpm_metric(ni); - hwmp_send_prep(ni, vap->iv_myaddr, rtorig->rt_nexthop, &pprep); + hwmp_send_prep(vap, rtorig->rt_nexthop, &pprep); /* precursor list for the Target Mesh STA Address is updated */ } @@ -1436,8 +1428,7 @@ hwmp_recv_prep(struct ieee80211vap *vap, } static int -hwmp_send_prep(struct ieee80211_node *ni, - const uint8_t sa[IEEE80211_ADDR_LEN], +hwmp_send_prep(struct ieee80211vap *vap, const uint8_t da[IEEE80211_ADDR_LEN], struct ieee80211_meshprep_ie *prep) { @@ -1455,8 +1446,7 @@ hwmp_send_prep(struct ieee80211_node *ni prep->prep_ie = IEEE80211_ELEMID_MESHPREP; prep->prep_len = prep->prep_flags & IEEE80211_MESHPREP_FLAGS_AE ? IEEE80211_MESHPREP_BASE_SZ_AE : IEEE80211_MESHPREP_BASE_SZ; - return hwmp_send_action(ni, sa, da, (uint8_t *)prep, - prep->prep_len + 2); + return hwmp_send_action(vap, da, (uint8_t *)prep, prep->prep_len + 2); } #define PERR_DFLAGS(n) perr.perr_dests[n].dest_flags @@ -1489,7 +1479,7 @@ hwmp_peerdown(struct ieee80211_node *ni) PERR_DRCODE(0) = IEEE80211_REASON_MESH_PERR_DEST_UNREACH; /* NB: flush everything passing through peer */ ieee80211_mesh_rt_flush_peer(vap, ni->ni_macaddr); - hwmp_send_perr(vap->iv_bss, vap->iv_myaddr, broadcastaddr, &perr); + hwmp_send_perr(vap, broadcastaddr, &perr); } #undef PERR_DFLAGS #undef PERR_DADDR @@ -1592,8 +1582,7 @@ hwmp_recv_perr(struct ieee80211vap *vap, "propagate PERR from %6D", wh->i_addr2, ":"); pperr->perr_ndests = j; pperr->perr_ttl--; - hwmp_send_perr(vap->iv_bss, vap->iv_myaddr, broadcastaddr, - pperr); + hwmp_send_perr(vap, broadcastaddr, pperr); } done: if (pperr != NULL) @@ -1606,12 +1595,11 @@ done: #undef PERR_DRCODE static int -hwmp_send_perr(struct ieee80211_node *ni, - const uint8_t sa[IEEE80211_ADDR_LEN], +hwmp_send_perr(struct ieee80211vap *vap, const uint8_t da[IEEE80211_ADDR_LEN], struct ieee80211_meshperr_ie *perr) { - struct ieee80211_hwmp_state *hs = ni->ni_vap->iv_hwmp; + struct ieee80211_hwmp_state *hs = vap->iv_hwmp; int i; uint8_t length = 0; @@ -1642,7 +1630,7 @@ hwmp_send_perr(struct ieee80211_node *ni length += IEEE80211_MESHPERR_DEST_SZ; } perr->perr_len =length; - return hwmp_send_action(ni, sa, da, (uint8_t *)perr, perr->perr_len+2); + return hwmp_send_action(vap, da, (uint8_t *)perr, perr->perr_len+2); } /* @@ -1695,7 +1683,7 @@ hwmp_senderror(struct ieee80211vap *vap, default: KASSERT(0, ("unknown reason code for HWMP PERR (%u)", rcode)); } - hwmp_send_perr(vap->iv_bss, vap->iv_myaddr, broadcastaddr, &perr); + hwmp_send_perr(vap, broadcastaddr, &perr); } #undef PERR_DFLAGS #undef PEER_DADDR @@ -1782,8 +1770,8 @@ hwmp_recv_rann(struct ieee80211vap *vap, IEEE80211_ADDR_COPY(preq.preq_targets[0].target_addr, rann->rann_addr); preq.preq_targets[0].target_seq = rann->rann_seq; /* XXX: if rootconfint have not passed, we built this preq in vain */ - hwmp_send_preq(vap->iv_bss, vap->iv_myaddr, wh->i_addr2, &preq, - &hr->hr_lastrootconf, &ieee80211_hwmp_rootconfint); + hwmp_send_preq(vap, wh->i_addr2, &preq, &hr->hr_lastrootconf, + &ieee80211_hwmp_rootconfint); /* propagate a RANN */ if (rt->rt_flags & IEEE80211_MESHRT_FLAGS_VALID && @@ -1794,14 +1782,12 @@ hwmp_recv_rann(struct ieee80211vap *vap, prann.rann_hopcount += 1; prann.rann_ttl -= 1; prann.rann_metric += ms->ms_pmetric->mpm_metric(ni); - hwmp_send_rann(vap->iv_bss, vap->iv_myaddr, - broadcastaddr, &prann); + hwmp_send_rann(vap, broadcastaddr, &prann); } } static int -hwmp_send_rann(struct ieee80211_node *ni, - const uint8_t sa[IEEE80211_ADDR_LEN], +hwmp_send_rann(struct ieee80211vap *vap, const uint8_t da[IEEE80211_ADDR_LEN], struct ieee80211_meshrann_ie *rann) { @@ -1816,8 +1802,7 @@ hwmp_send_rann(struct ieee80211_node *ni */ rann->rann_ie = IEEE80211_ELEMID_MESHRANN; rann->rann_len = IEEE80211_MESHRANN_BASE_SZ; - return hwmp_send_action(ni, sa, da, (uint8_t *)rann, - rann->rann_len + 2); + return hwmp_send_action(vap, da, (uint8_t *)rann, rann->rann_len + 2); } #define PREQ_TFLAGS(n) preq.preq_targets[n].target_flags @@ -1872,9 +1857,8 @@ hwmp_rediscover_cb(void *arg) PREQ_TFLAGS(0) |= IEEE80211_MESHPREQ_TFLAGS_USN; PREQ_TSEQ(0) = 0; /* RESERVED when USN flag is set */ /* XXX check return value */ - hwmp_send_preq(vap->iv_bss, vap->iv_myaddr, - broadcastaddr, &preq, &hr->hr_lastpreq, - &ieee80211_hwmp_preqminint); + hwmp_send_preq(vap, broadcastaddr, &preq, &hr->hr_lastpreq, + &ieee80211_hwmp_preqminint); callout_reset(&rt->rt_discovery, ieee80211_hwmp_net_diameter_traversaltime * 2, hwmp_rediscover_cb, rt); @@ -1970,9 +1954,8 @@ hwmp_discover(struct ieee80211vap *vap, PREQ_TFLAGS(0) |= IEEE80211_MESHPREQ_TFLAGS_USN; PREQ_TSEQ(0) = 0; /* RESERVED when USN flag is set */ /* XXX check return value */ - hwmp_send_preq(vap->iv_bss, vap->iv_myaddr, - broadcastaddr, &preq, &hr->hr_lastpreq, - &ieee80211_hwmp_preqminint); + hwmp_send_preq(vap, broadcastaddr, &preq, + &hr->hr_lastpreq, &ieee80211_hwmp_preqminint); callout_reset(&rt->rt_discovery, ieee80211_hwmp_net_diameter_traversaltime * 2, hwmp_rediscover_cb, rt); Modified: head/sys/net80211/ieee80211_mesh.c ============================================================================== --- head/sys/net80211/ieee80211_mesh.c Thu Feb 7 21:26:06 2013 (r246511) +++ head/sys/net80211/ieee80211_mesh.c Thu Feb 7 21:26:40 2013 (r246512) @@ -77,9 +77,6 @@ static void mesh_checkid(void *, struct static uint32_t mesh_generateid(struct ieee80211vap *); static int mesh_checkpseq(struct ieee80211vap *, const uint8_t [IEEE80211_ADDR_LEN], uint32_t); -static struct ieee80211_node * - mesh_find_txnode(struct ieee80211vap *, - const uint8_t [IEEE80211_ADDR_LEN]); static void mesh_transmit_to_gate(struct ieee80211vap *, struct mbuf *, struct ieee80211_mesh_route *); static void mesh_forward(struct ieee80211vap *, struct mbuf *, @@ -1005,8 +1002,8 @@ mesh_checkpseq(struct ieee80211vap *vap, /* * Iterate the routing table and locate the next hop. */ -static struct ieee80211_node * -mesh_find_txnode(struct ieee80211vap *vap, +struct ieee80211_node * +ieee80211_mesh_find_txnode(struct ieee80211vap *vap, const uint8_t dest[IEEE80211_ADDR_LEN]) { struct ieee80211_mesh_route *rt; @@ -1046,7 +1043,7 @@ mesh_transmit_to_gate(struct ieee80211va int error; eh = mtod(m, struct ether_header *); - ni = mesh_find_txnode(vap, rt_gate->rt_dest); + ni = ieee80211_mesh_find_txnode(vap, rt_gate->rt_dest); if (ni == NULL) { ifp->if_oerrors++; m_freem(m); @@ -1293,7 +1290,7 @@ mesh_forward(struct ieee80211vap *vap, s ni = ieee80211_ref_node(vap->iv_bss); mcopy->m_flags |= M_MCAST; } else { - ni = mesh_find_txnode(vap, whcopy->i_addr3); + ni = ieee80211_mesh_find_txnode(vap, whcopy->i_addr3); if (ni == NULL) { /* * [Optional] any of the following three actions: Modified: head/sys/net80211/ieee80211_mesh.h ============================================================================== --- head/sys/net80211/ieee80211_mesh.h Thu Feb 7 21:26:06 2013 (r246511) +++ head/sys/net80211/ieee80211_mesh.h Thu Feb 7 21:26:40 2013 (r246512) @@ -571,6 +571,9 @@ struct ieee80211_mesh_gate_route * const uint8_t *, struct ieee80211_mesh_route *); void ieee80211_mesh_forward_to_gates(struct ieee80211vap *, struct ieee80211_mesh_route *); +struct ieee80211_node * + ieee80211_mesh_find_txnode(struct ieee80211vap *, + const uint8_t [IEEE80211_ADDR_LEN]); /* * Return non-zero if proxy operation is enabled. From owner-svn-src-head@FreeBSD.ORG Thu Feb 7 21:27:41 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 9785151C; Thu, 7 Feb 2013 21:27:41 +0000 (UTC) (envelope-from monthadar@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 6F046F63; Thu, 7 Feb 2013 21:27:41 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r17LRfXP011964; Thu, 7 Feb 2013 21:27:41 GMT (envelope-from monthadar@svn.freebsd.org) Received: (from monthadar@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r17LRfVw011963; Thu, 7 Feb 2013 21:27:41 GMT (envelope-from monthadar@svn.freebsd.org) Message-Id: <201302072127.r17LRfVw011963@svn.freebsd.org> From: Monthadar Al Jaberi Date: Thu, 7 Feb 2013 21:27:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r246513 - head/sys/net80211 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Feb 2013 21:27:41 -0000 Author: monthadar Date: Thu Feb 7 21:27:40 2013 New Revision: 246513 URL: http://svnweb.freebsd.org/changeset/base/246513 Log: Mesh HWMP PREQ update: proxy reply only if mesh STA is a meshgate. * Original PREP frame is transmitted only by the target mesh STA or the mesh STA that is the proxy target; * Fixed so that metric value is not over written incorrectly in hwmp_recv_preq for when replying back with a PREP; Approved by: adrian (mentor) Modified: head/sys/net80211/ieee80211_hwmp.c Modified: head/sys/net80211/ieee80211_hwmp.c ============================================================================== --- head/sys/net80211/ieee80211_hwmp.c Thu Feb 7 21:26:40 2013 (r246512) +++ head/sys/net80211/ieee80211_hwmp.c Thu Feb 7 21:27:40 2013 (r246513) @@ -1017,10 +1017,12 @@ hwmp_recv_preq(struct ieee80211vap *vap, /* * Check if the PREQ is addressed to us. - * or a Proxy currently supplied by us. + * or a Proxy currently gated by us. */ if (IEEE80211_ADDR_EQ(vap->iv_myaddr, PREQ_TADDR(0)) || - (rttarg != NULL && + (ms->ms_flags & IEEE80211_MESHFLAGS_GATE && + rttarg != NULL && + IEEE80211_ADDR_EQ(vap->iv_myaddr, rttarg->rt_mesh_gate) && rttarg->rt_flags & IEEE80211_MESHRT_FLAGS_PROXY && rttarg->rt_flags & IEEE80211_MESHRT_FLAGS_VALID)) { /* @@ -1031,6 +1033,7 @@ hwmp_recv_preq(struct ieee80211vap *vap, prep.prep_flags = 0; prep.prep_hopcount = 0; + prep.prep_metric = IEEE80211_MESHLMETRIC_INITIALVAL; IEEE80211_ADDR_COPY(prep.prep_targetaddr, vap->iv_myaddr); if (rttarg != NULL && /* if NULL it means we are the target */ rttarg->rt_flags & IEEE80211_MESHRT_FLAGS_PROXY) { @@ -1042,6 +1045,7 @@ hwmp_recv_preq(struct ieee80211vap *vap, /* update proxy seqno to HWMP seqno */ rttarg->rt_ext_seq = hs->hs_seq; prep.prep_hopcount = rttarg->rt_nhops; + prep.prep_metric = rttarg->rt_metric; IEEE80211_ADDR_COPY(prep.prep_targetaddr, rttarg->rt_mesh_gate); } /* @@ -1050,7 +1054,6 @@ hwmp_recv_preq(struct ieee80211vap *vap, prep.prep_ttl = ms->ms_ttl; prep.prep_targetseq = hs->hs_seq; prep.prep_lifetime = preq->preq_lifetime; - prep.prep_metric = IEEE80211_MESHLMETRIC_INITIALVAL; IEEE80211_ADDR_COPY(prep.prep_origaddr, preq->preq_origaddr); prep.prep_origseq = preq->preq_origseq; From owner-svn-src-head@FreeBSD.ORG Thu Feb 7 21:28:26 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 78B3768F; Thu, 7 Feb 2013 21:28:26 +0000 (UTC) (envelope-from monthadar@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 68EC5F6C; Thu, 7 Feb 2013 21:28:26 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r17LSQ9l012105; Thu, 7 Feb 2013 21:28:26 GMT (envelope-from monthadar@svn.freebsd.org) Received: (from monthadar@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r17LSQY1012104; Thu, 7 Feb 2013 21:28:26 GMT (envelope-from monthadar@svn.freebsd.org) Message-Id: <201302072128.r17LSQY1012104@svn.freebsd.org> From: Monthadar Al Jaberi Date: Thu, 7 Feb 2013 21:28:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r246514 - head/sys/net80211 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Feb 2013 21:28:26 -0000 Author: monthadar Date: Thu Feb 7 21:28:25 2013 New Revision: 246514 URL: http://svnweb.freebsd.org/changeset/base/246514 Log: Mesh HWMP: don't send an intermediate PREP for proxy entries. * The standard is unclear about what should happen in case a mesh STA (not marked as a mesh gate) recevies a PREQ for a destination that is marked as proxy. Solution for now is not to do intermediate reply at all, and let the PREQ reach the mesh gate; Approved by: adrian (mentor) Modified: head/sys/net80211/ieee80211_hwmp.c Modified: head/sys/net80211/ieee80211_hwmp.c ============================================================================== --- head/sys/net80211/ieee80211_hwmp.c Thu Feb 7 21:27:40 2013 (r246513) +++ head/sys/net80211/ieee80211_hwmp.c Thu Feb 7 21:28:25 2013 (r246514) @@ -1133,9 +1133,11 @@ hwmp_recv_preq(struct ieee80211vap *vap, /* * We have a valid route to this node. + * NB: if target is proxy dont reply. */ if (rttarg != NULL && - (rttarg->rt_flags & IEEE80211_MESHRT_FLAGS_VALID)) { + rttarg->rt_flags & IEEE80211_MESHRT_FLAGS_VALID && + !(rttarg->rt_flags & IEEE80211_MESHRT_FLAGS_PROXY)) { /* * Check if we can send an intermediate Path Reply, * i.e., Target Only bit is not set and target is not From owner-svn-src-head@FreeBSD.ORG Thu Feb 7 21:29:15 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 1DE5D819; Thu, 7 Feb 2013 21:29:15 +0000 (UTC) (envelope-from monthadar@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 041E6F7C; Thu, 7 Feb 2013 21:29:15 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r17LTEjD012251; Thu, 7 Feb 2013 21:29:14 GMT (envelope-from monthadar@svn.freebsd.org) Received: (from monthadar@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r17LTEBk012250; Thu, 7 Feb 2013 21:29:14 GMT (envelope-from monthadar@svn.freebsd.org) Message-Id: <201302072129.r17LTEBk012250@svn.freebsd.org> From: Monthadar Al Jaberi Date: Thu, 7 Feb 2013 21:29:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r246515 - head/sys/net80211 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Feb 2013 21:29:15 -0000 Author: monthadar Date: Thu Feb 7 21:29:14 2013 New Revision: 246515 URL: http://svnweb.freebsd.org/changeset/base/246515 Log: Mesh HWMP PREQ: fixed conditions for discarding elements. Approved by: adrian (mentor) Modified: head/sys/net80211/ieee80211_hwmp.c Modified: head/sys/net80211/ieee80211_hwmp.c ============================================================================== --- head/sys/net80211/ieee80211_hwmp.c Thu Feb 7 21:28:25 2013 (r246514) +++ head/sys/net80211/ieee80211_hwmp.c Thu Feb 7 21:29:14 2013 (r246515) @@ -997,10 +997,10 @@ hwmp_recv_preq(struct ieee80211vap *vap, * it will be marked below. */ rtorig->rt_flags = IEEE80211_MESHRT_FLAGS_VALID; - }else if ((hrtarg != NULL && - HWMP_SEQ_EQ(hrtarg->hr_seq, PREQ_TSEQ(0)) && - ((rtorig->rt_flags & IEEE80211_MESHRT_FLAGS_VALID) == 0)) || - preqid >= preq->preq_id) { + } else if ((hrtarg != NULL && + !HWMP_SEQ_EQ(hrtarg->hr_seq, PREQ_TSEQ(0))) || + (rtorig->rt_flags & IEEE80211_MESHRT_FLAGS_VALID && + preqid >= preq->preq_id)) { IEEE80211_NOTE(vap, IEEE80211_MSG_HWMP, ni, "discard PREQ from %6D, old seqno %u <= %u," " or old preqid %u < %u", From owner-svn-src-head@FreeBSD.ORG Thu Feb 7 21:29:49 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 7E8D59A2; Thu, 7 Feb 2013 21:29:49 +0000 (UTC) (envelope-from monthadar@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 643F6F88; Thu, 7 Feb 2013 21:29:49 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r17LTnBd012354; Thu, 7 Feb 2013 21:29:49 GMT (envelope-from monthadar@svn.freebsd.org) Received: (from monthadar@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r17LTnFl012353; Thu, 7 Feb 2013 21:29:49 GMT (envelope-from monthadar@svn.freebsd.org) Message-Id: <201302072129.r17LTnFl012353@svn.freebsd.org> From: Monthadar Al Jaberi Date: Thu, 7 Feb 2013 21:29:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r246516 - head/sys/net80211 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Feb 2013 21:29:49 -0000 Author: monthadar Date: Thu Feb 7 21:29:48 2013 New Revision: 246516 URL: http://svnweb.freebsd.org/changeset/base/246516 Log: Update ddb to print mesh routing table. * Modified _db_show_vap and _db_show_com to print mesh routing table if the 'm' modifier is specified; Approved by: adrian (mentor) Modified: head/sys/net80211/ieee80211_ddb.c Modified: head/sys/net80211/ieee80211_ddb.c ============================================================================== --- head/sys/net80211/ieee80211_ddb.c Thu Feb 7 21:29:14 2013 (r246515) +++ head/sys/net80211/ieee80211_ddb.c Thu Feb 7 21:29:48 2013 (r246516) @@ -63,9 +63,9 @@ __FBSDID("$FreeBSD$"); } while (0) static void _db_show_sta(const struct ieee80211_node *); -static void _db_show_vap(const struct ieee80211vap *, int); +static void _db_show_vap(const struct ieee80211vap *, int, int); static void _db_show_com(const struct ieee80211com *, - int showvaps, int showsta, int showprocs); + int showvaps, int showsta, int showmesh, int showprocs); static void _db_show_node_table(const char *tag, const struct ieee80211_node_table *); @@ -103,7 +103,7 @@ DB_SHOW_COMMAND(statab, db_show_statab) DB_SHOW_COMMAND(vap, db_show_vap) { - int i, showprocs = 0; + int i, showmesh = 0, showprocs = 0; if (!have_addr) { db_printf("usage: show vap \n"); @@ -113,18 +113,22 @@ DB_SHOW_COMMAND(vap, db_show_vap) switch (modif[i]) { case 'a': showprocs = 1; + showmesh = 1; + break; + case 'm': + showmesh = 1; break; case 'p': showprocs = 1; break; } - _db_show_vap((const struct ieee80211vap *) addr, showprocs); + _db_show_vap((const struct ieee80211vap *) addr, showmesh, showprocs); } DB_SHOW_COMMAND(com, db_show_com) { const struct ieee80211com *ic; - int i, showprocs = 0, showvaps = 0, showsta = 0; + int i, showprocs = 0, showvaps = 0, showsta = 0, showmesh = 0; if (!have_addr) { db_printf("usage: show com \n"); @@ -133,11 +137,14 @@ DB_SHOW_COMMAND(com, db_show_com) for (i = 0; modif[i] != '\0'; i++) switch (modif[i]) { case 'a': - showsta = showvaps = showprocs = 1; + showsta = showmesh = showvaps = showprocs = 1; break; case 's': showsta = 1; break; + case 'm': + showmesh = 1; + break; case 'v': showvaps = 1; break; @@ -147,7 +154,7 @@ DB_SHOW_COMMAND(com, db_show_com) } ic = (const struct ieee80211com *) addr; - _db_show_com(ic, showvaps, showsta, showprocs); + _db_show_com(ic, showvaps, showsta, showmesh, showprocs); } DB_SHOW_ALL_COMMAND(vaps, db_show_all_vaps) @@ -178,7 +185,7 @@ DB_SHOW_ALL_COMMAND(vaps, db_show_all_va vap->iv_ifp->if_xname, vap); db_printf("\n"); } else - _db_show_com(ic, 1, 1, 1); + _db_show_com(ic, 1, 1, 1, 1); } } } @@ -330,7 +337,7 @@ _db_show_tdma(const char *sep, const str #endif /* IEEE80211_SUPPORT_TDMA */ static void -_db_show_vap(const struct ieee80211vap *vap, int showprocs) +_db_show_vap(const struct ieee80211vap *vap, int showmesh, int showprocs) { const struct ieee80211com *ic = vap->iv_ic; int i; @@ -341,6 +348,10 @@ _db_show_vap(const struct ieee80211vap * db_printf("\n"); db_printf("\topmode %s", ieee80211_opmode_name[vap->iv_opmode]); +#ifdef IEEE80211_SUPPORT_MESH + if (vap->iv_opmode == IEEE80211_M_MBSS) + db_printf("(%p)", vap->iv_mesh); +#endif db_printf(" state %s", ieee80211_state_name[vap->iv_state]); db_printf(" ifp %p(%s)", vap->iv_ifp, vap->iv_ifp->if_xname); db_printf("\n"); @@ -472,6 +483,10 @@ _db_show_vap(const struct ieee80211vap * db_printf(" acl %p", vap->iv_acl); db_printf(" as %p", vap->iv_as); db_printf("\n"); +#ifdef IEEE80211_SUPPORT_MESH + if (showmesh && vap->iv_mesh != NULL) + _db_show_mesh(vap->iv_mesh); +#endif #ifdef IEEE80211_SUPPORT_TDMA if (vap->iv_tdma != NULL) _db_show_tdma("\t", vap->iv_tdma, showprocs); @@ -495,7 +510,8 @@ _db_show_vap(const struct ieee80211vap * } static void -_db_show_com(const struct ieee80211com *ic, int showvaps, int showsta, int showprocs) +_db_show_com(const struct ieee80211com *ic, int showvaps, int showsta, + int showmesh, int showprocs) { struct ieee80211vap *vap; @@ -651,7 +667,7 @@ _db_show_com(const struct ieee80211com * if (showvaps && !TAILQ_EMPTY(&ic->ic_vaps)) { db_printf("\n"); TAILQ_FOREACH(vap, &ic->ic_vaps, iv_next) - _db_show_vap(vap, showprocs); + _db_show_vap(vap, showmesh, showprocs); } if (showsta && !TAILQ_EMPTY(&ic->ic_sta.nt_node)) { const struct ieee80211_node_table *nt = &ic->ic_sta; From owner-svn-src-head@FreeBSD.ORG Thu Feb 7 21:30:29 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id ECF9FB72; Thu, 7 Feb 2013 21:30:29 +0000 (UTC) (envelope-from monthadar@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id D8C74F99; Thu, 7 Feb 2013 21:30:29 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r17LUTOL012561; Thu, 7 Feb 2013 21:30:29 GMT (envelope-from monthadar@svn.freebsd.org) Received: (from monthadar@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r17LUTtN012560; Thu, 7 Feb 2013 21:30:29 GMT (envelope-from monthadar@svn.freebsd.org) Message-Id: <201302072130.r17LUTtN012560@svn.freebsd.org> From: Monthadar Al Jaberi Date: Thu, 7 Feb 2013 21:30:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r246517 - head/sys/net80211 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Feb 2013 21:30:30 -0000 Author: monthadar Date: Thu Feb 7 21:30:29 2013 New Revision: 246517 URL: http://svnweb.freebsd.org/changeset/base/246517 Log: Mesh bug: debug infomartion showing swapped SA and DA address. * Fix bug for "forward frame from SA(%6D), DA(%6D)" where addresses where swapped between SA and DA; Approved by: adrian (mentor) Modified: head/sys/net80211/ieee80211_output.c Modified: head/sys/net80211/ieee80211_output.c ============================================================================== --- head/sys/net80211/ieee80211_output.c Thu Feb 7 21:29:48 2013 (r246516) +++ head/sys/net80211/ieee80211_output.c Thu Feb 7 21:30:29 2013 (r246517) @@ -264,8 +264,8 @@ ieee80211_start(struct ifnet *ifp) } IEEE80211_DPRINTF(vap, IEEE80211_MSG_OUTPUT, "forward frame from DS SA(%6D), DA(%6D)\n", - eh->ether_dhost, ":", - eh->ether_shost, ":"); + eh->ether_shost, ":", + eh->ether_dhost, ":"); ieee80211_mesh_proxy_check(vap, eh->ether_shost); } ni = ieee80211_mesh_discover(vap, eh->ether_dhost, m); From owner-svn-src-head@FreeBSD.ORG Thu Feb 7 21:30:59 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 48069CF9; Thu, 7 Feb 2013 21:30:59 +0000 (UTC) (envelope-from monthadar@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 3859FFA8; Thu, 7 Feb 2013 21:30:59 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r17LUx8M014205; Thu, 7 Feb 2013 21:30:59 GMT (envelope-from monthadar@svn.freebsd.org) Received: (from monthadar@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r17LUxeR014204; Thu, 7 Feb 2013 21:30:59 GMT (envelope-from monthadar@svn.freebsd.org) Message-Id: <201302072130.r17LUxeR014204@svn.freebsd.org> From: Monthadar Al Jaberi Date: Thu, 7 Feb 2013 21:30:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r246518 - head/sys/net80211 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Feb 2013 21:30:59 -0000 Author: monthadar Date: Thu Feb 7 21:30:58 2013 New Revision: 246518 URL: http://svnweb.freebsd.org/changeset/base/246518 Log: Mesh HWMP PERR bug fixes. * When calling ieee80211_mesh_rt_flush_peer, the rt->rt_dest argument should not be passed because it can get freed before invalidating the other routes that depends on it to compare with next_hop. Use PERR_DADDR(i) instead; Approved by: adrian (mentor) Modified: head/sys/net80211/ieee80211_hwmp.c Modified: head/sys/net80211/ieee80211_hwmp.c ============================================================================== --- head/sys/net80211/ieee80211_hwmp.c Thu Feb 7 21:30:29 2013 (r246517) +++ head/sys/net80211/ieee80211_hwmp.c Thu Feb 7 21:30:58 2013 (r246518) @@ -1570,7 +1570,7 @@ hwmp_recv_perr(struct ieee80211vap *vap, "PERR, unknown reason code %u\n", PERR_DFLAGS(i)); goto done; /* XXX: stats?? */ } - ieee80211_mesh_rt_flush_peer(vap, rt->rt_dest); + ieee80211_mesh_rt_flush_peer(vap, PERR_DADDR(i)); KASSERT(j < 32, ("PERR, error ndest >= 32 (%u)", j)); } if (j == 0) { From owner-svn-src-head@FreeBSD.ORG Thu Feb 7 21:31:38 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 7C445E7C; Thu, 7 Feb 2013 21:31:38 +0000 (UTC) (envelope-from monthadar@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 6C401FB9; Thu, 7 Feb 2013 21:31:38 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r17LVcao014349; Thu, 7 Feb 2013 21:31:38 GMT (envelope-from monthadar@svn.freebsd.org) Received: (from monthadar@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r17LVcHu014348; Thu, 7 Feb 2013 21:31:38 GMT (envelope-from monthadar@svn.freebsd.org) Message-Id: <201302072131.r17LVcHu014348@svn.freebsd.org> From: Monthadar Al Jaberi Date: Thu, 7 Feb 2013 21:31:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r246519 - head/sys/net80211 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Feb 2013 21:31:38 -0000 Author: monthadar Date: Thu Feb 7 21:31:37 2013 New Revision: 246519 URL: http://svnweb.freebsd.org/changeset/base/246519 Log: Mesh HWMP forwarding information: updating FI for transmitter. * Added hwmp_update_transmitter function that checks if the metric to the transmitter have improved. If old FI is invalid or metric is larger the FI to the transmitter is updated occurdingly. This is a recommendation from the 802.11 2012 standard, table 13-9; Approved by: adrian (mentor) Modified: head/sys/net80211/ieee80211_hwmp.c Modified: head/sys/net80211/ieee80211_hwmp.c ============================================================================== --- head/sys/net80211/ieee80211_hwmp.c Thu Feb 7 21:30:58 2013 (r246518) +++ head/sys/net80211/ieee80211_hwmp.c Thu Feb 7 21:31:37 2013 (r246519) @@ -896,6 +896,45 @@ hwmp_rootmode_rann_cb(void *arg) hwmp_rootmode_setup(vap); } +/* + * Update forwarding information to TA if metric improves. + */ +static void +hwmp_update_transmitter(struct ieee80211vap *vap, struct ieee80211_node *ni, + const char *hwmp_frame) +{ + struct ieee80211_mesh_state *ms = vap->iv_mesh; + struct ieee80211_mesh_route *rttran = NULL; /* Transmitter */ + int metric = 0; + + rttran = ieee80211_mesh_rt_find(vap, ni->ni_macaddr); + if (rttran == NULL) { + rttran = ieee80211_mesh_rt_add(vap, ni->ni_macaddr); + if (rttran == NULL) { + IEEE80211_NOTE(vap, IEEE80211_MSG_HWMP, ni, + "unable to add path to transmitter %6D of %s", + ni->ni_macaddr, ":", hwmp_frame); + vap->iv_stats.is_mesh_rtaddfailed++; + return; + } + } + metric = ms->ms_pmetric->mpm_metric(ni); + if (!(rttran->rt_flags & IEEE80211_MESHRT_FLAGS_VALID) || + rttran->rt_metric > metric) + { + IEEE80211_NOTE(vap, IEEE80211_MSG_HWMP, ni, + "%s path to transmiter %6D of %s, metric %d:%d", + rttran->rt_flags & IEEE80211_MESHRT_FLAGS_VALID ? + "prefer" : "update", ni->ni_macaddr, ":", hwmp_frame, + rttran->rt_metric, metric); + IEEE80211_ADDR_COPY(rttran->rt_nexthop, ni->ni_macaddr); + rttran->rt_metric = metric; + rttran->rt_nhops = 1; + ieee80211_mesh_rt_update(rttran, ms->ms_ppath->mpp_inact); + rttran->rt_flags = IEEE80211_MESHRT_FLAGS_VALID; + } +} + #define PREQ_TFLAGS(n) preq->preq_targets[n].target_flags #define PREQ_TADDR(n) preq->preq_targets[n].target_addr #define PREQ_TSEQ(n) preq->preq_targets[n].target_seq @@ -1010,10 +1049,8 @@ hwmp_recv_preq(struct ieee80211vap *vap, return; } - /* - * Forwarding information for transmitter mesh STA - * [OPTIONAL: if metric improved] - */ + /* Update forwarding information to TA if metric improves. */ + hwmp_update_transmitter(vap, ni, "PREQ"); /* * Check if the PREQ is addressed to us. @@ -1268,7 +1305,6 @@ hwmp_recv_prep(struct ieee80211vap *vap, * rules defined in 13.10.8.4). If the conditions for creating or * updating the forwarding information have not been met in those * rules, no further steps are applied to the PREP. - * [OPTIONAL]: update forwarding information to TA if metric improves. */ rt = ieee80211_mesh_rt_find(vap, prep->prep_targetaddr); if (rt == NULL) { @@ -1323,6 +1359,9 @@ hwmp_recv_prep(struct ieee80211vap *vap, } rt->rt_flags |= IEEE80211_MESHRT_FLAGS_VALID; /* mark valid */ + /* Update forwarding information to TA if metric improves */ + hwmp_update_transmitter(vap, ni, "PREP"); + /* * If it's NOT for us, propagate the PREP */ From owner-svn-src-head@FreeBSD.ORG Thu Feb 7 21:32:10 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id F3F6EFEE; Thu, 7 Feb 2013 21:32:09 +0000 (UTC) (envelope-from monthadar@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id D4F4FFC5; Thu, 7 Feb 2013 21:32:09 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r17LW9OG014466; Thu, 7 Feb 2013 21:32:09 GMT (envelope-from monthadar@svn.freebsd.org) Received: (from monthadar@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r17LW9uQ014465; Thu, 7 Feb 2013 21:32:09 GMT (envelope-from monthadar@svn.freebsd.org) Message-Id: <201302072132.r17LW9uQ014465@svn.freebsd.org> From: Monthadar Al Jaberi Date: Thu, 7 Feb 2013 21:32:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r246520 - head/sys/net80211 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Feb 2013 21:32:10 -0000 Author: monthadar Date: Thu Feb 7 21:32:09 2013 New Revision: 246520 URL: http://svnweb.freebsd.org/changeset/base/246520 Log: Mesh: recevied GANN frames where not parsed correctly. * Added mesh_parse_meshgate_action that parse all values to host endian; * Add more detailed debug output; Approved by: adrian (mentor) Modified: head/sys/net80211/ieee80211_mesh.c Modified: head/sys/net80211/ieee80211_mesh.c ============================================================================== --- head/sys/net80211/ieee80211_mesh.c Thu Feb 7 21:31:37 2013 (r246519) +++ head/sys/net80211/ieee80211_mesh.c Thu Feb 7 21:32:09 2013 (r246520) @@ -533,9 +533,6 @@ mesh_gatemode_cb(void *arg) struct ieee80211_mesh_state *ms = vap->iv_mesh; struct ieee80211_meshgann_ie gann; - IEEE80211_NOTE(vap, IEEE80211_MSG_MESH, vap->iv_bss, - "%s", "send broadcast GANN"); - gann.gann_flags = 0; /* Reserved */ gann.gann_hopcount = 0; gann.gann_ttl = ms->ms_ttl; @@ -543,6 +540,9 @@ mesh_gatemode_cb(void *arg) gann.gann_seq = ms->ms_gateseq++; gann.gann_interval = ieee80211_mesh_gateint; + IEEE80211_NOTE(vap, IEEE80211_MSG_MESH, vap->iv_bss, + "send broadcast GANN (seq %u)", gann.gann_seq); + ieee80211_send_action(vap->iv_bss, IEEE80211_ACTION_CAT_MESH, IEEE80211_ACTION_MESH_GANN, &gann); mesh_gatemode_setup(vap); @@ -2605,6 +2605,40 @@ mesh_recv_action_meshlmetric(struct ieee } /* + * Parse meshgate action ie's for GANN frames. + * Returns -1 if parsing fails, otherwise 0. + */ +static int +mesh_parse_meshgate_action(struct ieee80211_node *ni, + const struct ieee80211_frame *wh, /* XXX for VERIFY_LENGTH */ + struct ieee80211_meshgann_ie *ie, const uint8_t *frm, const uint8_t *efrm) +{ + struct ieee80211vap *vap = ni->ni_vap; + const struct ieee80211_meshgann_ie *gannie; + + while (efrm - frm > 1) { + IEEE80211_VERIFY_LENGTH(efrm - frm, frm[1] + 2, return -1); + switch (*frm) { + case IEEE80211_ELEMID_MESHGANN: + gannie = (const struct ieee80211_meshgann_ie *) frm; + memset(ie, 0, sizeof(ie)); + ie->gann_ie = gannie->gann_ie; + ie->gann_len = gannie->gann_len; + ie->gann_flags = gannie->gann_flags; + ie->gann_hopcount = gannie->gann_hopcount; + ie->gann_ttl = gannie->gann_ttl; + IEEE80211_ADDR_COPY(ie->gann_addr, gannie->gann_addr); + ie->gann_seq = LE_READ_4(&gannie->gann_seq); + ie->gann_interval = LE_READ_2(&gannie->gann_interval); + break; + } + frm += frm[1] + 2; + } + + return 0; +} + +/* * Mesh Gate Announcement handling. */ static int @@ -2617,29 +2651,36 @@ mesh_recv_action_meshgate(struct ieee802 struct ieee80211_mesh_gate_route *gr, *next; struct ieee80211_mesh_route *rt_gate; struct ieee80211_meshgann_ie pgann; + struct ieee80211_meshgann_ie ie; int found = 0; - const struct ieee80211_meshgann_ie *ie = - (const struct ieee80211_meshgann_ie *) - (frm+2); /* action + code */ - if (IEEE80211_ADDR_EQ(vap->iv_myaddr, ie->gann_addr)) + /* +2 for action + code */ + if (mesh_parse_meshgate_action(ni, wh, &ie, frm+2, efrm) != 0) { + IEEE80211_DISCARD_MAC(vap, IEEE80211_MSG_MESH, + ni->ni_macaddr, NULL, "%s", + "GANN parsing failed"); + vap->iv_stats.is_rx_mgtdiscard++; + return (0); + } + + if (IEEE80211_ADDR_EQ(vap->iv_myaddr, ie.gann_addr)) return 0; IEEE80211_NOTE_MAC(vap, IEEE80211_MSG_MESH, ni->ni_macaddr, - "received GANN, meshgate: %6D (seq %u)", ie->gann_addr, ":", - ie->gann_seq); + "received GANN, meshgate: %6D (seq %u)", ie.gann_addr, ":", + ie.gann_seq); if (ms == NULL) return (0); MESH_RT_LOCK(ms); TAILQ_FOREACH_SAFE(gr, &ms->ms_known_gates, gr_next, next) { - if (!IEEE80211_ADDR_EQ(gr->gr_addr, ie->gann_addr)) + if (!IEEE80211_ADDR_EQ(gr->gr_addr, ie.gann_addr)) continue; - if (ie->gann_seq <= gr->gr_lastseq) { + if (ie.gann_seq <= gr->gr_lastseq) { IEEE80211_DISCARD_MAC(vap, IEEE80211_MSG_MESH, ni->ni_macaddr, NULL, "GANN old seqno %u <= %u", - ie->gann_seq, gr->gr_lastseq); + ie.gann_seq, gr->gr_lastseq); MESH_RT_UNLOCK(ms); return (0); } @@ -2650,14 +2691,14 @@ mesh_recv_action_meshgate(struct ieee802 } if (found == 0) { /* this GANN is from a new mesh Gate add it to known table. */ - IEEE80211_NOTE_MAC(vap, IEEE80211_MSG_MESH, ie->gann_addr, - "stored new GANN information, seq %u.", ie->gann_seq); + IEEE80211_NOTE_MAC(vap, IEEE80211_MSG_MESH, ie.gann_addr, + "stored new GANN information, seq %u.", ie.gann_seq); gr = malloc(ALIGN(sizeof(struct ieee80211_mesh_gate_route)), M_80211_MESH_GT_RT, M_NOWAIT | M_ZERO); - IEEE80211_ADDR_COPY(gr->gr_addr, ie->gann_addr); + IEEE80211_ADDR_COPY(gr->gr_addr, ie.gann_addr); TAILQ_INSERT_TAIL(&ms->ms_known_gates, gr, gr_next); } - gr->gr_lastseq = ie->gann_seq; + gr->gr_lastseq = ie.gann_seq; /* check if we have a path to this gate */ rt_gate = mesh_rt_find_locked(ms, gr->gr_addr); @@ -2670,17 +2711,16 @@ mesh_recv_action_meshgate(struct ieee802 MESH_RT_UNLOCK(ms); /* popagate only if decremented ttl >= 1 && forwarding is enabled */ - if ((ie->gann_ttl - 1) < 1 && - !(ms->ms_flags & IEEE80211_MESHFLAGS_FWD)) + if ((ie.gann_ttl - 1) < 1 && !(ms->ms_flags & IEEE80211_MESHFLAGS_FWD)) return 0; - pgann.gann_flags = ie->gann_flags; /* Reserved */ - pgann.gann_hopcount = ie->gann_hopcount + 1; - pgann.gann_ttl = ie->gann_ttl - 1; - IEEE80211_ADDR_COPY(pgann.gann_addr, ie->gann_addr); - pgann.gann_seq = ie->gann_seq; - pgann.gann_interval = ie->gann_interval; + pgann.gann_flags = ie.gann_flags; /* Reserved */ + pgann.gann_hopcount = ie.gann_hopcount + 1; + pgann.gann_ttl = ie.gann_ttl - 1; + IEEE80211_ADDR_COPY(pgann.gann_addr, ie.gann_addr); + pgann.gann_seq = ie.gann_seq; + pgann.gann_interval = ie.gann_interval; - IEEE80211_NOTE_MAC(vap, IEEE80211_MSG_MESH, ie->gann_addr, + IEEE80211_NOTE_MAC(vap, IEEE80211_MSG_MESH, ie.gann_addr, "%s", "propagate GANN"); ieee80211_send_action(vap->iv_bss, IEEE80211_ACTION_CAT_MESH, From owner-svn-src-head@FreeBSD.ORG Thu Feb 7 22:42:34 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id A898EEA; Thu, 7 Feb 2013 22:42:34 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 8BF402E7; Thu, 7 Feb 2013 22:42:34 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r17MgY6N035139; Thu, 7 Feb 2013 22:42:34 GMT (envelope-from jilles@svn.freebsd.org) Received: (from jilles@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r17MgYE1035138; Thu, 7 Feb 2013 22:42:34 GMT (envelope-from jilles@svn.freebsd.org) Message-Id: <201302072242.r17MgYE1035138@svn.freebsd.org> From: Jilles Tjoelker Date: Thu, 7 Feb 2013 22:42:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r246522 - head/bin/sh X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Feb 2013 22:42:34 -0000 Author: jilles Date: Thu Feb 7 22:42:33 2013 New Revision: 246522 URL: http://svnweb.freebsd.org/changeset/base/246522 Log: sh: Simplify mksyntax and make it fit for cross-compiling. Now it outputs fixed files, which use constants provided by the C standard library to determine appropriate values for the target machine. Before, mksyntax inspected the host machine which resulted in subtle breakage if e.g. char is signed on the host and unsigned on the target such as when cross-compiling on x86 for ARM. Tested using -funsigned-char on amd64. Compiling build-tools without it and sh itself with it causes various tests to fail without this change but not with this change. With consistent -funsigned-char, tests pass with or without this change. The mksyntax program could be removed and syntax.c and syntax.h committed to the repository. Submitted by: Christoph Mallon MFC after: 2 weeks Modified: head/bin/sh/mksyntax.c Modified: head/bin/sh/mksyntax.c ============================================================================== --- head/bin/sh/mksyntax.c Thu Feb 7 22:40:26 2013 (r246521) +++ head/bin/sh/mksyntax.c Thu Feb 7 22:42:33 2013 (r246522) @@ -103,23 +103,16 @@ static char writer[] = "\ static FILE *cfile; static FILE *hfile; -static const char *syntax[513]; -static int base; -static int size; /* number of values which a char variable can have */ -static int nbits; /* number of bits in a character */ -static void filltable(const char *); -static void init(void); +static void add_default(void); +static void finish(void); +static void init(const char *); static void add(const char *, const char *); -static void print(const char *); static void output_type_macros(void); int main(int argc __unused, char **argv __unused) { - char c; - char d; - int sign; int i; char buf[80]; int pos; @@ -136,27 +129,8 @@ main(int argc __unused, char **argv __un fputs(writer, hfile); fputs(writer, cfile); - /* Determine the characteristics of chars. */ - c = -1; - sign = (c > 0) ? 0 : 1; - for (nbits = 1 ; ; nbits++) { - d = (1 << nbits) - 1; - if (d == c) - break; - } -#if 0 - printf("%s %d bit chars\n", sign? "signed" : "unsigned", nbits); -#endif - if (nbits > 9) { - fputs("Characters can't have more than 9 bits\n", stderr); - exit(2); - } - size = (1 << nbits) + 1; - base = 1; - if (sign) - base += 1 << (nbits - 1); - fputs("#include \n", hfile); + fputs("#include \n\n", hfile); /* Generate the #define statements in the header file */ fputs("/* Syntax classes */\n", hfile); @@ -177,8 +151,8 @@ main(int argc __unused, char **argv __un fprintf(hfile, "/* %s */\n", is_entry[i].comment); } putc('\n', hfile); - fprintf(hfile, "#define SYNBASE %d\n", base); - fprintf(hfile, "#define PEOF %d\n\n", -base); + fputs("#define SYNBASE (1 - CHAR_MIN)\n", hfile); + fputs("#define PEOF -SYNBASE\n\n", hfile); putc('\n', hfile); fputs("#define BASESYNTAX (basesyntax + SYNBASE)\n", hfile); fputs("#define DQSYNTAX (dqsyntax + SYNBASE)\n", hfile); @@ -189,10 +163,13 @@ main(int argc __unused, char **argv __un putc('\n', hfile); /* Generate the syntax tables. */ + fputs("#include \"parser.h\"\n", cfile); fputs("#include \"shell.h\"\n", cfile); fputs("#include \"syntax.h\"\n\n", cfile); - init(); + fputs("/* syntax table used when not in quotes */\n", cfile); + init("basesyntax"); + add_default(); add("\n", "CNL"); add("\\", "CBACK"); add("'", "CSQUOTE"); @@ -201,9 +178,11 @@ main(int argc __unused, char **argv __un add("$", "CVAR"); add("}", "CENDVAR"); add("<>();&| \t", "CSPCL"); - print("basesyntax"); - init(); + finish(); + fputs("\n/* syntax table used when in double quotes */\n", cfile); + init("dqsyntax"); + add_default(); add("\n", "CNL"); add("\\", "CBACK"); add("\"", "CENDQUOTE"); @@ -212,17 +191,21 @@ main(int argc __unused, char **argv __un add("}", "CENDVAR"); /* ':/' for tilde expansion, '-^]' for [a\-x] pattern ranges */ add("!*?[]=~:/-^", "CCTL"); - print("dqsyntax"); - init(); + finish(); + fputs("\n/* syntax table used when in single quotes */\n", cfile); + init("sqsyntax"); + add_default(); add("\n", "CNL"); add("\\", "CSBACK"); add("'", "CENDQUOTE"); /* ':/' for tilde expansion, '-^]' for [a\-x] pattern ranges */ add("!*?[]=~:/-^", "CCTL"); - print("sqsyntax"); - init(); + finish(); + fputs("\n/* syntax table used when in arithmetic */\n", cfile); + init("arisyntax"); + add_default(); add("\n", "CNL"); add("\\", "CBACK"); add("`", "CBQUOTE"); @@ -231,100 +214,95 @@ main(int argc __unused, char **argv __un add("}", "CENDVAR"); add("(", "CLP"); add(")", "CRP"); - print("arisyntax"); - filltable("0"); + finish(); + fputs("\n/* character classification table */\n", cfile); + init("is_type"); add("0123456789", "ISDIGIT"); add("abcdefghijklmnopqrstuvwxyz", "ISLOWER"); add("ABCDEFGHIJKLMNOPQRSTUVWXYZ", "ISUPPER"); add("_", "ISUNDER"); add("#?$!-*@", "ISSPECL"); - print("is_type"); + finish(); + exit(0); } - /* - * Clear the syntax table. + * Output the header and declaration of a syntax table. */ static void -filltable(const char *dftval) +init(const char *name) { - int i; + fprintf(hfile, "extern const char %s[];\n", name); + fprintf(cfile, "const char %s[SYNBASE + CHAR_MAX + 1] = {\n", name); +} + - for (i = 0 ; i < size ; i++) - syntax[i] = dftval; +static void +add_one(const char *key, const char *type) +{ + fprintf(cfile, "\t[SYNBASE + %s] = %s,\n", key, type); } /* - * Initialize the syntax table with default values. + * Add default values to the syntax table. */ static void -init(void) +add_default(void) { - filltable("CWORD"); - syntax[0] = "CEOF"; - syntax[base + CTLESC] = "CCTL"; - syntax[base + CTLVAR] = "CCTL"; - syntax[base + CTLENDVAR] = "CCTL"; - syntax[base + CTLBACKQ] = "CCTL"; - syntax[base + CTLBACKQ + CTLQUOTE] = "CCTL"; - syntax[base + CTLARI] = "CCTL"; - syntax[base + CTLENDARI] = "CCTL"; - syntax[base + CTLQUOTEMARK] = "CCTL"; - syntax[base + CTLQUOTEEND] = "CCTL"; + add_one("PEOF", "CEOF"); + add_one("CTLESC", "CCTL"); + add_one("CTLVAR", "CCTL"); + add_one("CTLENDVAR", "CCTL"); + add_one("CTLBACKQ", "CCTL"); + add_one("CTLBACKQ + CTLQUOTE", "CCTL"); + add_one("CTLARI", "CCTL"); + add_one("CTLENDARI", "CCTL"); + add_one("CTLQUOTEMARK", "CCTL"); + add_one("CTLQUOTEEND", "CCTL"); } /* - * Add entries to the syntax table. + * Output the footer of a syntax table. */ static void -add(const char *p, const char *type) +finish(void) { - while (*p) - syntax[*p++ + base] = type; + fputs("};\n", cfile); } - /* - * Output the syntax table. + * Add entries to the syntax table. */ static void -print(const char *name) +add(const char *p, const char *type) { - int i; - int col; - - fprintf(hfile, "extern const char %s[];\n", name); - fprintf(cfile, "const char %s[%d] = {\n", name, size); - col = 0; - for (i = 0 ; i < size ; i++) { - if (i == 0) { - fputs(" ", cfile); - } else if ((i & 03) == 0) { - fputs(",\n ", cfile); - col = 0; - } else { - putc(',', cfile); - while (++col < 9 * (i & 03)) - putc(' ', cfile); + for (; *p; ++p) { + char c = *p; + switch (c) { + case '\t': c = 't'; break; + case '\n': c = 'n'; break; + case '\'': c = '\''; break; + case '\\': c = '\\'; break; + + default: + fprintf(cfile, "\t[SYNBASE + '%c'] = %s,\n", c, type); + continue; } - fputs(syntax[i], cfile); - col += strlen(syntax[i]); + fprintf(cfile, "\t[SYNBASE + '\\%c'] = %s,\n", c, type); } - fputs("\n};\n", cfile); } - /* * Output character classification macros (e.g. is_digit). If digits are * contiguous, we can test for them quickly. From owner-svn-src-head@FreeBSD.ORG Fri Feb 8 07:29:08 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 6EB6CE91; Fri, 8 Feb 2013 07:29:08 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 4DEA4920; Fri, 8 Feb 2013 07:29:08 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r187T8xk093150; Fri, 8 Feb 2013 07:29:08 GMT (envelope-from avg@svn.freebsd.org) Received: (from avg@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r187T82h093149; Fri, 8 Feb 2013 07:29:08 GMT (envelope-from avg@svn.freebsd.org) Message-Id: <201302080729.r187T82h093149@svn.freebsd.org> From: Andriy Gapon Date: Fri, 8 Feb 2013 07:29:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r246530 - head/sys/kern X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Feb 2013 07:29:08 -0000 Author: avg Date: Fri Feb 8 07:29:07 2013 New Revision: 246530 URL: http://svnweb.freebsd.org/changeset/base/246530 Log: ktr: correctly handle possible wrap-around in the boot buffer Older entries should be 'before' newer entries in the new buffer too and there should be no zero-filled gap between them. Pointed out by: jhb MFC after: 3 days X-MFC with: r246282 Modified: head/sys/kern/kern_ktr.c Modified: head/sys/kern/kern_ktr.c ============================================================================== --- head/sys/kern/kern_ktr.c Fri Feb 8 03:54:06 2013 (r246529) +++ head/sys/kern/kern_ktr.c Fri Feb 8 07:29:07 2013 (r246530) @@ -213,7 +213,11 @@ ktr_entries_initializer(void *dummy __un ktr_mask = 0; ktr_buf = malloc(sizeof(*ktr_buf) * KTR_ENTRIES, M_KTR, M_WAITOK | M_ZERO); - memcpy(ktr_buf, ktr_buf_init, sizeof(ktr_buf_init)); + memcpy(ktr_buf, ktr_buf_init + ktr_idx, + (KTR_BOOT_ENTRIES - ktr_idx) * sizeof(*ktr_buf)); + if (ktr_idx != 0) + memcpy(ktr_buf + KTR_BOOT_ENTRIES - ktr_idx, ktr_buf_init, + ktr_idx * sizeof(*ktr_buf)); ktr_entries = KTR_ENTRIES; ktr_mask = mask; } From owner-svn-src-head@FreeBSD.ORG Fri Feb 8 07:44:16 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 5705243A; Fri, 8 Feb 2013 07:44:16 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 475039C6; Fri, 8 Feb 2013 07:44:16 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r187iGSp098649; Fri, 8 Feb 2013 07:44:16 GMT (envelope-from avg@svn.freebsd.org) Received: (from avg@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r187iGlM098648; Fri, 8 Feb 2013 07:44:16 GMT (envelope-from avg@svn.freebsd.org) Message-Id: <201302080744.r187iGlM098648@svn.freebsd.org> From: Andriy Gapon Date: Fri, 8 Feb 2013 07:44:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r246531 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Feb 2013 07:44:16 -0000 Author: avg Date: Fri Feb 8 07:44:15 2013 New Revision: 246531 URL: http://svnweb.freebsd.org/changeset/base/246531 Log: zfs: update comments about zfid_long_t to match the FreeBSD definitions MFC after: 1 week Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_vfsops.h Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_vfsops.h ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_vfsops.h Fri Feb 8 07:29:07 2013 (r246530) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_vfsops.h Fri Feb 8 07:44:15 2013 (r246531) @@ -110,7 +110,7 @@ typedef struct zfid_short { } zfid_short_t; /* - * Filesystems under .zfs/snapshot have a total file ID size of 22 bytes + * Filesystems under .zfs/snapshot have a total file ID size of 22[*] bytes * (including the length field). This makes files under .zfs/snapshot * accessible by NFSv3 and NFSv4, but not NFSv2. * @@ -120,10 +120,13 @@ typedef struct zfid_short { * 6 bytes object number (48 bits) * 4 bytes generation number (32 bits) * 6 bytes objset id (48 bits) - * 4 bytes currently just zero (32 bits) + * 4 bytes[**] currently just zero (32 bits) * * We reserve only 48 bits for the object number and objset id, as these are * the limits currently defined and imposed by the DMU. + * + * [*] 20 bytes on FreeBSD to fit into the size of struct fid. + * [**] 2 bytes on FreeBSD for the above reason. */ typedef struct zfid_long { zfid_short_t z_fid; From owner-svn-src-head@FreeBSD.ORG Fri Feb 8 07:49:55 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id AD4D56AC; Fri, 8 Feb 2013 07:49:55 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 861CCA10; Fri, 8 Feb 2013 07:49:55 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r187ntht099403; Fri, 8 Feb 2013 07:49:55 GMT (envelope-from avg@svn.freebsd.org) Received: (from avg@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r187ntIK099402; Fri, 8 Feb 2013 07:49:55 GMT (envelope-from avg@svn.freebsd.org) Message-Id: <201302080749.r187ntIK099402@svn.freebsd.org> From: Andriy Gapon Date: Fri, 8 Feb 2013 07:49:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r246532 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Feb 2013 07:49:55 -0000 Author: avg Date: Fri Feb 8 07:49:54 2013 New Revision: 246532 URL: http://svnweb.freebsd.org/changeset/base/246532 Log: zfs_vget, zfs_fhtovp: properly handle the z_shares_dir object A special gfs vnode corresponds to that object. A regular zfs vnode must not be returned. This should be upstreamed. Reported by: pluknet Submitted by: rmacklem Tested by: pluknet MFC after: 10 days Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c Fri Feb 8 07:44:15 2013 (r246531) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c Fri Feb 8 07:49:54 2013 (r246532) @@ -2009,7 +2009,8 @@ zfs_vget(vfs_t *vfsp, ino_t ino, int fla * .zfs/snapshot/ directories, that's why we return EOPNOTSUPP. * This will make NFS to switch to LOOKUP instead of using VGET. */ - if (ino == ZFSCTL_INO_ROOT || ino == ZFSCTL_INO_SNAPDIR) + if (ino == ZFSCTL_INO_ROOT || ino == ZFSCTL_INO_SNAPDIR || + (zfsvfs->z_shares_dir != 0 && ino == zfsvfs->z_shares_dir)) return (EOPNOTSUPP); ZFS_ENTER(zfsvfs); @@ -2101,14 +2102,22 @@ zfs_fhtovp(vfs_t *vfsp, fid_t *fidp, int return (EINVAL); } - /* A zero fid_gen means we are in the .zfs control directories */ - if (fid_gen == 0 && - (object == ZFSCTL_INO_ROOT || object == ZFSCTL_INO_SNAPDIR)) { + /* + * A zero fid_gen means we are in .zfs or the .zfs/snapshot + * directory tree. If the object == zfsvfs->z_shares_dir, then + * we are in the .zfs/shares directory tree. + */ + if ((fid_gen == 0 && + (object == ZFSCTL_INO_ROOT || object == ZFSCTL_INO_SNAPDIR)) || + (zfsvfs->z_shares_dir != 0 && object == zfsvfs->z_shares_dir)) { *vpp = zfsvfs->z_ctldir; ASSERT(*vpp != NULL); if (object == ZFSCTL_INO_SNAPDIR) { VERIFY(zfsctl_root_lookup(*vpp, "snapshot", vpp, NULL, 0, NULL, NULL, NULL, NULL, NULL) == 0); + } else if (object == zfsvfs->z_shares_dir) { + VERIFY(zfsctl_root_lookup(*vpp, "shares", vpp, NULL, + 0, NULL, NULL, NULL, NULL, NULL) == 0); } else { VN_HOLD(*vpp); } From owner-svn-src-head@FreeBSD.ORG Fri Feb 8 09:07:04 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id C9815C8F; Fri, 8 Feb 2013 09:07:04 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 8C3E1688; Fri, 8 Feb 2013 09:07:04 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r18974gO024345; Fri, 8 Feb 2013 09:07:04 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r18974XN024343; Fri, 8 Feb 2013 09:07:04 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201302080907.r18974XN024343@svn.freebsd.org> From: Adrian Chadd Date: Fri, 8 Feb 2013 09:07:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r246536 - head/sys/dev/ath X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Feb 2013 09:07:04 -0000 Author: adrian Date: Fri Feb 8 09:07:03 2013 New Revision: 246536 URL: http://svnweb.freebsd.org/changeset/base/246536 Log: Fix a corner case that I noticed with the AR5416 (and it's currently crappy 802.11n performance, sigh.) With the AR5416, aggregates need to be limited to 8KiB if RTS/CTS is enabled. However, larger aggregates were going out with RTSCTS enabled. The following was going on: * The first buffer in the list would have RTS/CTS enabled in bf->bf_state.txflags; * The aggregate would be formed; * The "copy over the txflags from the first buffer" logic that I added blanked the RTS/CTS TX flags fields, and then copied the bf_first RTS/CTS flags over; * .. but that'd cause bf_first to be blanked out! And thus the flag was cleared; * So the rest of the aggregate formation would run with those flags cleared, and thus > 8KiB aggregates were formed. The driver is now (again) correctly limiting aggregate formation for the AR5416 but there are still other pending issues to resolve. Tested: * AR5416, STA mode Modified: head/sys/dev/ath/if_ath_tx_ht.c Modified: head/sys/dev/ath/if_ath_tx_ht.c ============================================================================== --- head/sys/dev/ath/if_ath_tx_ht.c Fri Feb 8 08:03:18 2013 (r246535) +++ head/sys/dev/ath/if_ath_tx_ht.c Fri Feb 8 09:07:03 2013 (r246536) @@ -688,11 +688,6 @@ ath_tx_form_aggr(struct ath_softc *sc, s bf->bf_next = NULL; /* - * Don't unlock the tid lock until we're sure we are going - * to queue this frame. - */ - - /* * If the frame doesn't have a sequence number that we're * tracking in the BAW (eg NULL QOS data frame), we can't * aggregate it. Stop the aggregation process; the sender @@ -749,11 +744,13 @@ ath_tx_form_aggr(struct ath_softc *sc, s * that differs from the first frame, override the * subsequent frame with this config. */ - bf->bf_state.bfs_txflags &= - ~ (HAL_TXDESC_RTSENA | HAL_TXDESC_CTSENA); - bf->bf_state.bfs_txflags |= - bf_first->bf_state.bfs_txflags & - (HAL_TXDESC_RTSENA | HAL_TXDESC_CTSENA); + if (bf != bf_first) { + bf->bf_state.bfs_txflags &= + ~ (HAL_TXDESC_RTSENA | HAL_TXDESC_CTSENA); + bf->bf_state.bfs_txflags |= + bf_first->bf_state.bfs_txflags & + (HAL_TXDESC_RTSENA | HAL_TXDESC_CTSENA); + } /* * If the packet has a sequence number, do not From owner-svn-src-head@FreeBSD.ORG Fri Feb 8 09:11:55 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id BCA962D7; Fri, 8 Feb 2013 09:11:55 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id A5C806D7; Fri, 8 Feb 2013 09:11:55 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r189BtBl027255; Fri, 8 Feb 2013 09:11:55 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r189Btpw027254; Fri, 8 Feb 2013 09:11:55 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201302080911.r189Btpw027254@svn.freebsd.org> From: Adrian Chadd Date: Fri, 8 Feb 2013 09:11:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r246537 - head/sys/net80211 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Feb 2013 09:11:55 -0000 Author: adrian Date: Fri Feb 8 09:11:55 2013 New Revision: 246537 URL: http://svnweb.freebsd.org/changeset/base/246537 Log: Fix ieee80211_mesh.c compilation. * Add the superg.h header to allow ieee80211_check_ff() to work * Since the assert stuff creates assertions based on line numbers and there was a conflict, just nudge things down a bit. Modified: head/sys/net80211/ieee80211_mesh.c Modified: head/sys/net80211/ieee80211_mesh.c ============================================================================== --- head/sys/net80211/ieee80211_mesh.c Fri Feb 8 09:07:03 2013 (r246536) +++ head/sys/net80211/ieee80211_mesh.c Fri Feb 8 09:11:55 2013 (r246537) @@ -60,6 +60,9 @@ __FBSDID("$FreeBSD$"); #include #include +#ifdef IEEE80211_SUPPORT_SUPERG +#include +#endif #include #include @@ -110,6 +113,7 @@ SYSCTL_PROC(_net_wlan_mesh, OID_AUTO, re &ieee80211_mesh_retrytimeout, 0, ieee80211_sysctl_msecs_ticks, "I", "Retry timeout (msec)"); static int ieee80211_mesh_holdingtimeout = -1; + SYSCTL_PROC(_net_wlan_mesh, OID_AUTO, holdingtimeout, CTLTYPE_INT | CTLFLAG_RW, &ieee80211_mesh_holdingtimeout, 0, ieee80211_sysctl_msecs_ticks, "I", "Holding state timeout (msec)"); From owner-svn-src-head@FreeBSD.ORG Fri Feb 8 09:54:53 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id BBBB77C5; Fri, 8 Feb 2013 09:54:53 +0000 (UTC) (envelope-from pluknet@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id AF3AC8EE; Fri, 8 Feb 2013 09:54:53 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r189srcC040637; Fri, 8 Feb 2013 09:54:53 GMT (envelope-from pluknet@svn.freebsd.org) Received: (from pluknet@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r189src4040636; Fri, 8 Feb 2013 09:54:53 GMT (envelope-from pluknet@svn.freebsd.org) Message-Id: <201302080954.r189src4040636@svn.freebsd.org> From: Sergey Kandaurov Date: Fri, 8 Feb 2013 09:54:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r246538 - head/sys/cddl/dev/dtrace X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Feb 2013 09:54:53 -0000 Author: pluknet Date: Fri Feb 8 09:54:53 2013 New Revision: 246538 URL: http://svnweb.freebsd.org/changeset/base/246538 Log: Fix warning: comparison of unsigned expression < 0 is always false. Reported by: clang Modified: head/sys/cddl/dev/dtrace/dtrace_ioctl.c Modified: head/sys/cddl/dev/dtrace/dtrace_ioctl.c ============================================================================== --- head/sys/cddl/dev/dtrace/dtrace_ioctl.c Fri Feb 8 09:11:55 2013 (r246537) +++ head/sys/cddl/dev/dtrace/dtrace_ioctl.c Fri Feb 8 09:54:53 2013 (r246538) @@ -215,7 +215,7 @@ dtrace_ioctl(struct cdev *dev, u_long cm "DTRACEIOC_AGGSNAP":"DTRACEIOC_BUFSNAP", curcpu, desc.dtbd_cpu); - if (desc.dtbd_cpu < 0 || desc.dtbd_cpu >= NCPU) + if (desc.dtbd_cpu >= NCPU) return (ENOENT); if (pcpu_find(desc.dtbd_cpu) == NULL) return (ENOENT); From owner-svn-src-head@FreeBSD.ORG Fri Feb 8 11:14:02 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 9E933B66; Fri, 8 Feb 2013 11:14:02 +0000 (UTC) (envelope-from dteske@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 7A2A7D46; Fri, 8 Feb 2013 11:14:02 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r18BE2LH065293; Fri, 8 Feb 2013 11:14:02 GMT (envelope-from dteske@svn.freebsd.org) Received: (from dteske@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r18BE2gg065291; Fri, 8 Feb 2013 11:14:02 GMT (envelope-from dteske@svn.freebsd.org) Message-Id: <201302081114.r18BE2gg065291@svn.freebsd.org> From: Devin Teske Date: Fri, 8 Feb 2013 11:14:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r246546 - in head/usr.sbin: bsdconfig sysrc X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Feb 2013 11:14:02 -0000 Author: dteske Date: Fri Feb 8 11:14:01 2013 New Revision: 246546 URL: http://svnweb.freebsd.org/changeset/base/246546 Log: Remove NO_OBJ from Makefiles that generate manuals because this causes the GZIP compressed manuals to appear in ./src instead of the appropriate obj dir. PR: conf/175844 Submitted by: Dominique Goncalves Modified: head/usr.sbin/bsdconfig/Makefile head/usr.sbin/sysrc/Makefile Modified: head/usr.sbin/bsdconfig/Makefile ============================================================================== --- head/usr.sbin/bsdconfig/Makefile Fri Feb 8 11:10:26 2013 (r246545) +++ head/usr.sbin/bsdconfig/Makefile Fri Feb 8 11:14:01 2013 (r246546) @@ -1,7 +1,5 @@ # $FreeBSD$ -NO_OBJ= - SUBDIR= console \ diskmgmt \ docsinstall \ Modified: head/usr.sbin/sysrc/Makefile ============================================================================== --- head/usr.sbin/sysrc/Makefile Fri Feb 8 11:10:26 2013 (r246545) +++ head/usr.sbin/sysrc/Makefile Fri Feb 8 11:14:01 2013 (r246546) @@ -1,7 +1,5 @@ # $FreeBSD$ -NO_OBJ= - SCRIPTS= sysrc MAN= sysrc.8 From owner-svn-src-head@FreeBSD.ORG Fri Feb 8 14:11:13 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id A51723C2; Fri, 8 Feb 2013 14:11:13 +0000 (UTC) (envelope-from des@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 97DD5854; Fri, 8 Feb 2013 14:11:13 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r18EBDHR018935; Fri, 8 Feb 2013 14:11:13 GMT (envelope-from des@svn.freebsd.org) Received: (from des@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r18EBD1v018933; Fri, 8 Feb 2013 14:11:13 GMT (envelope-from des@svn.freebsd.org) Message-Id: <201302081411.r18EBD1v018933@svn.freebsd.org> From: Dag-Erling Smørgrav Date: Fri, 8 Feb 2013 14:11:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r246552 - head/share/man/man5 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Feb 2013 14:11:13 -0000 Author: des Date: Fri Feb 8 14:11:12 2013 New Revision: 246552 URL: http://svnweb.freebsd.org/changeset/base/246552 Log: Cross-reference newgrp(1), and document the use of pw(8) to set the group password. PR: docs/167741 MFC after: 3 weeks Modified: head/share/man/man5/group.5 Modified: head/share/man/man5/group.5 ============================================================================== --- head/share/man/man5/group.5 Fri Feb 8 12:53:29 2013 (r246551) +++ head/share/man/man5/group.5 Fri Feb 8 14:11:12 2013 (r246552) @@ -32,7 +32,7 @@ .\" From: @(#)group.5 8.3 (Berkeley) 4/19/94 .\" $FreeBSD$ .\" -.Dd September 29, 1994 +.Dd February 8, 2013 .Dt GROUP 5 .Os .Sh NAME @@ -139,6 +139,7 @@ may still have this limit. .It Pa /etc/group .El .Sh SEE ALSO +.Xr newgrp 1 , .Xr passwd 1 , .Xr setgroups 2 , .Xr crypt 3 , @@ -156,9 +157,14 @@ file format appeared in .At v6 . Support for comments first appeared in .Fx 3.0 . -.Sh BUGS +.Sh IMPLEMENTATION NOTES The .Xr passwd 1 command does not change the .Nm passwords. +The +.Xr pw 8 +utility's +.Cm groupmod +command should be used instead. From owner-svn-src-head@FreeBSD.ORG Fri Feb 8 14:14:01 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 2ABA3566; Fri, 8 Feb 2013 14:14:01 +0000 (UTC) (envelope-from des@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 131DC88A; Fri, 8 Feb 2013 14:14:01 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r18EE0a6019344; Fri, 8 Feb 2013 14:14:00 GMT (envelope-from des@svn.freebsd.org) Received: (from des@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r18EE0ud019339; Fri, 8 Feb 2013 14:14:00 GMT (envelope-from des@svn.freebsd.org) Message-Id: <201302081414.r18EE0ud019339@svn.freebsd.org> From: Dag-Erling Smørgrav Date: Fri, 8 Feb 2013 14:14:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r246553 - head/usr.bin/newgrp X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Feb 2013 14:14:01 -0000 Author: des Date: Fri Feb 8 14:14:00 2013 New Revision: 246553 URL: http://svnweb.freebsd.org/changeset/base/246553 Log: Print a warning if not setuid root. Document the need for the setuid bit and how to set it. Explain why it isn't set by default, and suggest simply adding users to groups instead. PR: docs/167741 MFC after: 3 weeks Modified: head/usr.bin/newgrp/newgrp.1 head/usr.bin/newgrp/newgrp.c Modified: head/usr.bin/newgrp/newgrp.1 ============================================================================== --- head/usr.bin/newgrp/newgrp.1 Fri Feb 8 14:11:12 2013 (r246552) +++ head/usr.bin/newgrp/newgrp.1 Fri Feb 8 14:14:00 2013 (r246553) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd May 23, 2002 +.Dd February 8, 2013 .Dt NEWGRP 1 .Os .Sh NAME @@ -90,6 +90,15 @@ A utility appeared in .At v6 . .Sh BUGS +For security reasons, the +.Nm +utility is normally installed without the setuid bit. +To enable it, run the following command: +.Bd -literal -offset indent +chmod u+s /usr/bin/newgrp +.Ed +.Pp Group passwords are inherently insecure as there is no way to stop -users obtaining the crypted passwords from the group database. +users obtaining the password hash from the group database. Their use is discouraged. +Instead, users should simply be added to the necessary groups. Modified: head/usr.bin/newgrp/newgrp.c ============================================================================== --- head/usr.bin/newgrp/newgrp.c Fri Feb 8 14:11:12 2013 (r246552) +++ head/usr.bin/newgrp/newgrp.c Fri Feb 8 14:14:00 2013 (r246553) @@ -73,7 +73,8 @@ main(int argc, char *argv[]) { int ch, login; - euid = geteuid(); + if ((euid = geteuid()) != 0) + warnx("need root permissions to function properly, check setuid bit"); if (seteuid(getuid()) < 0) err(1, "seteuid"); From owner-svn-src-head@FreeBSD.ORG Fri Feb 8 15:52:21 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id BA1C62FC; Fri, 8 Feb 2013 15:52:21 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 105D0DCF; Fri, 8 Feb 2013 15:52:21 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r18FqKYb048697; Fri, 8 Feb 2013 15:52:20 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r18FqK7r048696; Fri, 8 Feb 2013 15:52:20 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201302081552.r18FqK7r048696@svn.freebsd.org> From: Konstantin Belousov Date: Fri, 8 Feb 2013 15:52:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r246554 - head/sys/sparc64/include X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Feb 2013 15:52:21 -0000 Author: kib Date: Fri Feb 8 15:52:20 2013 New Revision: 246554 URL: http://svnweb.freebsd.org/changeset/base/246554 Log: The 'end' word was missed in the comment. MFC after: 3 days Modified: head/sys/sparc64/include/vmparam.h Modified: head/sys/sparc64/include/vmparam.h ============================================================================== --- head/sys/sparc64/include/vmparam.h Fri Feb 8 14:14:00 2013 (r246553) +++ head/sys/sparc64/include/vmparam.h Fri Feb 8 15:52:20 2013 (r246554) @@ -149,8 +149,8 @@ * * We define some interesting address constants: * - * VM_MIN_ADDRESS and VM_MAX_ADDRESS define the start and of the entire 64 bit - * address space, mostly just for convenience. + * VM_MIN_ADDRESS and VM_MAX_ADDRESS define the start and end of the entire + * 64 bit address space, mostly just for convenience. * * VM_MIN_DIRECT_ADDRESS and VM_MAX_DIRECT_ADDRESS define the start and end * of the direct mapped region. This maps virtual addresses to physical From owner-svn-src-head@FreeBSD.ORG Fri Feb 8 17:44:45 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 4CAB3C9F; Fri, 8 Feb 2013 17:44:45 +0000 (UTC) (envelope-from nwhitehorn@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 39F43315; Fri, 8 Feb 2013 17:44:45 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r18Hijle081705; Fri, 8 Feb 2013 17:44:45 GMT (envelope-from nwhitehorn@svn.freebsd.org) Received: (from nwhitehorn@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r18HijkL081704; Fri, 8 Feb 2013 17:44:45 GMT (envelope-from nwhitehorn@svn.freebsd.org) Message-Id: <201302081744.r18HijkL081704@svn.freebsd.org> From: Nathan Whitehorn Date: Fri, 8 Feb 2013 17:44:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r246556 - head/libexec/rtld-elf/powerpc64 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Feb 2013 17:44:45 -0000 Author: nwhitehorn Date: Fri Feb 8 17:44:44 2013 New Revision: 246556 URL: http://svnweb.freebsd.org/changeset/base/246556 Log: Avoid use of register variables, which some compilers (e.g. clang) don't like. It makes the code a little clearer as well. MFC after: 1 week Modified: head/libexec/rtld-elf/powerpc64/reloc.c Modified: head/libexec/rtld-elf/powerpc64/reloc.c ============================================================================== --- head/libexec/rtld-elf/powerpc64/reloc.c Fri Feb 8 16:10:16 2013 (r246555) +++ head/libexec/rtld-elf/powerpc64/reloc.c Fri Feb 8 17:44:44 2013 (r246556) @@ -486,8 +486,7 @@ init_pltgot(Obj_Entry *obj) void allocate_initial_tls(Obj_Entry *list) { - register Elf_Addr **tp __asm__("r13"); - Elf_Addr **_tp; + Elf_Addr **tp; /* * Fix the size of the static TLS block by using the maximum @@ -497,22 +496,19 @@ allocate_initial_tls(Obj_Entry *list) tls_static_space = tls_last_offset + tls_last_size + RTLD_STATIC_TLS_EXTRA; - _tp = (Elf_Addr **) ((char *)allocate_tls(list, NULL, TLS_TCB_SIZE, 16) + tp = (Elf_Addr **) ((char *)allocate_tls(list, NULL, TLS_TCB_SIZE, 16) + TLS_TP_OFFSET + TLS_TCB_SIZE); - /* - * XXX gcc seems to ignore 'tp = _tp;' - */ - - __asm __volatile("mr %0,%1" : "=r"(tp) : "r"(_tp)); + __asm __volatile("mr 13,%0" :: "r"(tp)); } void* __tls_get_addr(tls_index* ti) { - register Elf_Addr **tp __asm__("r13"); + Elf_Addr **tp; char *p; + __asm __volatile("mr %0,13" : "=r"(tp)); p = tls_get_addr_common((Elf_Addr**)((Elf_Addr)tp - TLS_TP_OFFSET - TLS_TCB_SIZE), ti->ti_module, ti->ti_offset); From owner-svn-src-head@FreeBSD.ORG Fri Feb 8 18:02:29 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id E64BE34A; Fri, 8 Feb 2013 18:02:29 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id CD61561D; Fri, 8 Feb 2013 18:02:29 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r18I2TpG087336; Fri, 8 Feb 2013 18:02:29 GMT (envelope-from trasz@svn.freebsd.org) Received: (from trasz@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r18I2TQi087335; Fri, 8 Feb 2013 18:02:29 GMT (envelope-from trasz@svn.freebsd.org) Message-Id: <201302081802.r18I2TQi087335@svn.freebsd.org> From: Edward Tomasz Napierala Date: Fri, 8 Feb 2013 18:02:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r246557 - head/bin/setfacl X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Feb 2013 18:02:30 -0000 Author: trasz Date: Fri Feb 8 18:02:28 2013 New Revision: 246557 URL: http://svnweb.freebsd.org/changeset/base/246557 Log: In the setfacl(1) manual page, make it clear that for NFSv4 ACLs, one should really use -a and -x instead of -m. MFC after: 1 week Modified: head/bin/setfacl/setfacl.1 Modified: head/bin/setfacl/setfacl.1 ============================================================================== --- head/bin/setfacl/setfacl.1 Fri Feb 8 17:44:44 2013 (r246556) +++ head/bin/setfacl/setfacl.1 Fri Feb 8 18:02:28 2013 (r246557) @@ -26,7 +26,7 @@ .\" .\" $FreeBSD$ .\" -.Dd September 2, 2012 +.Dd February 8, 2013 .Dt SETFACL 1 .Os .Sh NAME @@ -95,6 +95,11 @@ Modify the ACL entries on the specified entries and modifying existing ACL entries with the ACL entries specified in .Ar entries . +For NFSv4 ACLs, it is recommended to use the +.Fl a +and +.Fl x +instead. .It Fl M Ar file Modify the ACL entries on the specified files by adding new ACL entries and modifying existing ACL entries with the ACL From owner-svn-src-head@FreeBSD.ORG Fri Feb 8 18:12:17 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 14665791; Fri, 8 Feb 2013 18:12:17 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id F0C2D6C0; Fri, 8 Feb 2013 18:12:16 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r18ICGCP090638; Fri, 8 Feb 2013 18:12:16 GMT (envelope-from trasz@svn.freebsd.org) Received: (from trasz@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r18ICGtc090637; Fri, 8 Feb 2013 18:12:16 GMT (envelope-from trasz@svn.freebsd.org) Message-Id: <201302081812.r18ICGtc090637@svn.freebsd.org> From: Edward Tomasz Napierala Date: Fri, 8 Feb 2013 18:12:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r246558 - head/bin/setfacl X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Feb 2013 18:12:17 -0000 Author: trasz Date: Fri Feb 8 18:12:16 2013 New Revision: 246558 URL: http://svnweb.freebsd.org/changeset/base/246558 Log: Improve description of the "-m" option to setfacl(1). Submitted by: scottl MFC after: 1 week Modified: head/bin/setfacl/setfacl.1 Modified: head/bin/setfacl/setfacl.1 ============================================================================== --- head/bin/setfacl/setfacl.1 Fri Feb 8 18:02:28 2013 (r246557) +++ head/bin/setfacl/setfacl.1 Fri Feb 8 18:12:16 2013 (r246558) @@ -91,15 +91,16 @@ An error will be reported if any of the specified files cannot have a default entry (i.e.\& non-directories). This option is not applicable to NFSv4 ACLs. .It Fl m Ar entries -Modify the ACL entries on the specified files by adding new -entries and modifying existing ACL entries with the ACL entries -specified in -.Ar entries . +Modify the ACL on the specified file. +New entries will be added, and existing entries will be modified +according to the +.Ar entries +argument. For NFSv4 ACLs, it is recommended to use the .Fl a and .Fl x -instead. +options instead. .It Fl M Ar file Modify the ACL entries on the specified files by adding new ACL entries and modifying existing ACL entries with the ACL From owner-svn-src-head@FreeBSD.ORG Fri Feb 8 18:43:47 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id DF2B4874; Fri, 8 Feb 2013 18:43:47 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id D136F883; Fri, 8 Feb 2013 18:43:47 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r18Ihl6Q099611; Fri, 8 Feb 2013 18:43:47 GMT (envelope-from trasz@svn.freebsd.org) Received: (from trasz@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r18Ihl0Y099609; Fri, 8 Feb 2013 18:43:47 GMT (envelope-from trasz@svn.freebsd.org) Message-Id: <201302081843.r18Ihl0Y099609@svn.freebsd.org> From: Edward Tomasz Napierala Date: Fri, 8 Feb 2013 18:43:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r246559 - head/bin/setfacl X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Feb 2013 18:43:47 -0000 Author: trasz Date: Fri Feb 8 18:43:47 2013 New Revision: 246559 URL: http://svnweb.freebsd.org/changeset/base/246559 Log: Fix NFSv4 permission description in setfacl(1) manual page: the 'D' means delete_child, not delete. MFC after: 1 week Modified: head/bin/setfacl/setfacl.1 Modified: head/bin/setfacl/setfacl.1 ============================================================================== --- head/bin/setfacl/setfacl.1 Fri Feb 8 18:12:16 2013 (r246558) +++ head/bin/setfacl/setfacl.1 Fri Feb 8 18:43:47 2013 (r246559) @@ -325,9 +325,9 @@ write_data execute .It p append_data -.It d -delete_child .It D +delete_child +.It d delete .It a read_attributes From owner-svn-src-head@FreeBSD.ORG Fri Feb 8 19:39:17 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 38D9882E; Fri, 8 Feb 2013 19:39:17 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 722F7AEB; Fri, 8 Feb 2013 19:39:16 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r18JdGgw015668; Fri, 8 Feb 2013 19:39:16 GMT (envelope-from pfg@svn.freebsd.org) Received: (from pfg@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r18JdGBC015666; Fri, 8 Feb 2013 19:39:16 GMT (envelope-from pfg@svn.freebsd.org) Message-Id: <201302081939.r18JdGBC015666@svn.freebsd.org> From: "Pedro F. Giffuni" Date: Fri, 8 Feb 2013 19:39:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r246560 - head/usr.bin/patch X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Feb 2013 19:39:17 -0000 Author: pfg Date: Fri Feb 8 19:39:15 2013 New Revision: 246560 URL: http://svnweb.freebsd.org/changeset/base/246560 Log: patch: Follow original versioning convention. According to the README file [1] the 12u variant, unlike the 12g variant, contains no copyleft code. It is therefore convenient to keep using the original versioning scheme to prevent confusions. [1] http://www.openbsd.org/cgi-bin/cvsweb/src/usr.bin/patch/README Modified: head/usr.bin/patch/util.c Modified: head/usr.bin/patch/util.c ============================================================================== --- head/usr.bin/patch/util.c Fri Feb 8 18:43:47 2013 (r246559) +++ head/usr.bin/patch/util.c Fri Feb 8 19:39:15 2013 (r246560) @@ -412,7 +412,7 @@ checked_in(char *file) void version(void) { - fprintf(stderr, "patch (BSD patch) 2.0-FreeBSD\n"); + fprintf(stderr, "patch 2.0-12u8 FreeBSD\n"); my_exit(EXIT_SUCCESS); } From owner-svn-src-head@FreeBSD.ORG Fri Feb 8 20:13:29 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 05A21F88; Fri, 8 Feb 2013 20:13:29 +0000 (UTC) (envelope-from alfred@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id E7508D10; Fri, 8 Feb 2013 20:13:28 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r18KDS4U026961; Fri, 8 Feb 2013 20:13:28 GMT (envelope-from alfred@svn.freebsd.org) Received: (from alfred@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r18KDS8c026960; Fri, 8 Feb 2013 20:13:28 GMT (envelope-from alfred@svn.freebsd.org) Message-Id: <201302082013.r18KDS8c026960@svn.freebsd.org> From: Alfred Perlstein Date: Fri, 8 Feb 2013 20:13:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r246561 - head/share/man/man9 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Feb 2013 20:13:29 -0000 Author: alfred Date: Fri Feb 8 20:13:28 2013 New Revision: 246561 URL: http://svnweb.freebsd.org/changeset/base/246561 Log: add semicolon to end of CALLOUT_HANDLE_INITIALIZER example. Modified: head/share/man/man9/timeout.9 Modified: head/share/man/man9/timeout.9 ============================================================================== --- head/share/man/man9/timeout.9 Fri Feb 8 19:39:15 2013 (r246560) +++ head/share/man/man9/timeout.9 Fri Feb 8 20:13:28 2013 (r246561) @@ -62,7 +62,7 @@ typedef void timeout_t (void *); .Ft void .Fn callout_handle_init "struct callout_handle *handle" .Bd -literal -struct callout_handle handle = CALLOUT_HANDLE_INITIALIZER(&handle) +struct callout_handle handle = CALLOUT_HANDLE_INITIALIZER(&handle); .Ed .Ft void .Fn untimeout "timeout_t *func" "void *arg" "struct callout_handle handle" From owner-svn-src-head@FreeBSD.ORG Fri Feb 8 20:30:20 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 6B1776E5; Fri, 8 Feb 2013 20:30:20 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 5E16DE1A; Fri, 8 Feb 2013 20:30:20 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r18KUKBh032104; Fri, 8 Feb 2013 20:30:20 GMT (envelope-from pfg@svn.freebsd.org) Received: (from pfg@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r18KUKG3032042; Fri, 8 Feb 2013 20:30:20 GMT (envelope-from pfg@svn.freebsd.org) Message-Id: <201302082030.r18KUKG3032042@svn.freebsd.org> From: "Pedro F. Giffuni" Date: Fri, 8 Feb 2013 20:30:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r246562 - in head/sys: fs/ext2fs ufs/ufs X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Feb 2013 20:30:20 -0000 Author: pfg Date: Fri Feb 8 20:30:19 2013 New Revision: 246562 URL: http://svnweb.freebsd.org/changeset/base/246562 Log: Remove unused MAXSYMLINKLEN macro. Reviewed by: mckusick PR: kern/175794 MFC after: 1 week Modified: head/sys/fs/ext2fs/inode.h head/sys/ufs/ufs/inode.h Modified: head/sys/fs/ext2fs/inode.h ============================================================================== --- head/sys/fs/ext2fs/inode.h Fri Feb 8 20:13:28 2013 (r246561) +++ head/sys/fs/ext2fs/inode.h Fri Feb 8 20:30:19 2013 (r246562) @@ -108,7 +108,6 @@ struct inode { */ #define i_shortlink i_db #define i_rdev i_db[0] -#define MAXSYMLINKLEN ((NDADDR + NIADDR) * sizeof(int32_t)) /* File permissions. */ #define IEXEC 0000100 /* Executable. */ Modified: head/sys/ufs/ufs/inode.h ============================================================================== --- head/sys/ufs/ufs/inode.h Fri Feb 8 20:13:28 2013 (r246561) +++ head/sys/ufs/ufs/inode.h Fri Feb 8 20:30:19 2013 (r246562) @@ -151,10 +151,6 @@ struct inode { (ip)->i_din2->d##field = (val); \ } while (0) -#define MAXSYMLINKLEN(ip) \ - ((ip)->i_ump->um_fstype == UFS1) ? \ - ((NDADDR + NIADDR) * sizeof(ufs1_daddr_t)) : \ - ((NDADDR + NIADDR) * sizeof(ufs2_daddr_t)) #define SHORTLINK(ip) \ (((ip)->i_ump->um_fstype == UFS1) ? \ (caddr_t)(ip)->i_din1->di_db : (caddr_t)(ip)->i_din2->di_db) From owner-svn-src-head@FreeBSD.ORG Fri Feb 8 20:58:01 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 404D993D; Fri, 8 Feb 2013 20:58:01 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 18BE9FAE; Fri, 8 Feb 2013 20:58:01 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r18Kw0hX039178; Fri, 8 Feb 2013 20:58:00 GMT (envelope-from pfg@svn.freebsd.org) Received: (from pfg@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r18Kw0C9039175; Fri, 8 Feb 2013 20:58:00 GMT (envelope-from pfg@svn.freebsd.org) Message-Id: <201302082058.r18Kw0C9039175@svn.freebsd.org> From: "Pedro F. Giffuni" Date: Fri, 8 Feb 2013 20:58:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r246563 - head/sys/fs/ext2fs X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Feb 2013 20:58:01 -0000 Author: pfg Date: Fri Feb 8 20:58:00 2013 New Revision: 246563 URL: http://svnweb.freebsd.org/changeset/base/246563 Log: ext2fs: make e2fs_maxcontig local and remove tautological check. e2fs_maxcontig was modelled after UFS when bringing the "Orlov allocator" to ext2. On UFS fs_maxcontig is kept in the superblock and is used by userland tools (fsck and growfs), In ext2 this information is volatile so it is not available for userland tools, so in this case it doesn't have sense to carry it in the in-memory superblock. Also remove a pointless check for MAX(1, x) > 0. Submitted by: Christoph Mallon MFC after: 2 weeks Modified: head/sys/fs/ext2fs/ext2_vfsops.c head/sys/fs/ext2fs/ext2fs.h Modified: head/sys/fs/ext2fs/ext2_vfsops.c ============================================================================== --- head/sys/fs/ext2fs/ext2_vfsops.c Fri Feb 8 20:30:19 2013 (r246562) +++ head/sys/fs/ext2fs/ext2_vfsops.c Fri Feb 8 20:58:00 2013 (r246563) @@ -527,6 +527,7 @@ ext2_mountfs(struct vnode *devvp, struct int ronly; int i, size; int32_t *lp; + int32_t e2fs_maxcontig; ronly = vfs_flagopt(mp->mnt_optnew, "ro", NULL, 0); /* XXX: use VOP_ACESS to check FS perms */ @@ -601,12 +602,8 @@ ext2_mountfs(struct vnode *devvp, struct * in ext2fs doesn't have these variables, so we can calculate * them here. */ - ump->um_e2fs->e2fs_maxcontig = MAX(1, MAXPHYS / ump->um_e2fs->e2fs_bsize); - if (ump->um_e2fs->e2fs_maxcontig > 0) - ump->um_e2fs->e2fs_contigsumsize = - MIN(ump->um_e2fs->e2fs_maxcontig, EXT2_MAXCONTIG); - else - ump->um_e2fs->e2fs_contigsumsize = 0; + e2fs_maxcontig = MAX(1, MAXPHYS / ump->um_e2fs->e2fs_bsize); + ump->um_e2fs->e2fs_contigsumsize = MIN(e2fs_maxcontig, EXT2_MAXCONTIG); if (ump->um_e2fs->e2fs_contigsumsize > 0) { size = ump->um_e2fs->e2fs_gcount * sizeof(int32_t); ump->um_e2fs->e2fs_maxcluster = malloc(size, M_EXT2MNT, M_WAITOK); Modified: head/sys/fs/ext2fs/ext2fs.h ============================================================================== --- head/sys/fs/ext2fs/ext2fs.h Fri Feb 8 20:30:19 2013 (r246562) +++ head/sys/fs/ext2fs/ext2fs.h Fri Feb 8 20:58:00 2013 (r246563) @@ -170,7 +170,6 @@ struct m_ext2fs { char e2fs_wasvalid; /* valid at mount time */ off_t e2fs_maxfilesize; struct ext2_gd *e2fs_gd; /* Group Descriptors */ - int32_t e2fs_maxcontig; /* max number of contiguous blks */ int32_t e2fs_contigsumsize; /* size of cluster summary array */ int32_t *e2fs_maxcluster; /* max cluster in each cyl group */ struct csum *e2fs_clustersum; /* cluster summary in each cyl group */ From owner-svn-src-head@FreeBSD.ORG Fri Feb 8 21:09:45 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id D0AB9254; Fri, 8 Feb 2013 21:09:45 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id ABE6BCE; Fri, 8 Feb 2013 21:09:45 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r18L9jv4042701; Fri, 8 Feb 2013 21:09:45 GMT (envelope-from pfg@svn.freebsd.org) Received: (from pfg@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r18L9jf8042699; Fri, 8 Feb 2013 21:09:45 GMT (envelope-from pfg@svn.freebsd.org) Message-Id: <201302082109.r18L9jf8042699@svn.freebsd.org> From: "Pedro F. Giffuni" Date: Fri, 8 Feb 2013 21:09:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r246564 - head/sys/fs/ext2fs X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Feb 2013 21:09:45 -0000 Author: pfg Date: Fri Feb 8 21:09:44 2013 New Revision: 246564 URL: http://svnweb.freebsd.org/changeset/base/246564 Log: ext2fs: Replace redundant EXT2_MIN_BLOCK with EXT2_MIN_BLOCK_SIZE. Submitted by: Christoph Mallon MFC after: 2 weeks Modified: head/sys/fs/ext2fs/ext2_vfsops.c head/sys/fs/ext2fs/ext2fs.h Modified: head/sys/fs/ext2fs/ext2_vfsops.c ============================================================================== --- head/sys/fs/ext2fs/ext2_vfsops.c Fri Feb 8 20:58:00 2013 (r246563) +++ head/sys/fs/ext2fs/ext2_vfsops.c Fri Feb 8 21:09:44 2013 (r246564) @@ -320,8 +320,8 @@ compute_sb_data(struct vnode *devvp, str struct buf *bp; uint32_t e2fs_descpb; - fs->e2fs_bsize = EXT2_MIN_BLOCK_SIZE << es->e2fs_log_bsize; fs->e2fs_bshift = EXT2_MIN_BLOCK_LOG_SIZE + es->e2fs_log_bsize; + fs->e2fs_bsize = 1U << fs->e2fs_bshift; fs->e2fs_fsbtodb = es->e2fs_log_bsize + 1; fs->e2fs_qbmask = fs->e2fs_bsize - 1; fs->e2fs_fsize = EXT2_MIN_FRAG_SIZE << es->e2fs_log_fsize; Modified: head/sys/fs/ext2fs/ext2fs.h ============================================================================== --- head/sys/fs/ext2fs/ext2fs.h Fri Feb 8 20:58:00 2013 (r246563) +++ head/sys/fs/ext2fs/ext2fs.h Fri Feb 8 21:09:44 2013 (r246564) @@ -303,7 +303,6 @@ struct csum { /* * Macro-instructions used to manage several block sizes */ -#define EXT2_MIN_BLOCK_SIZE 1024 #define EXT2_MAX_BLOCK_SIZE 4096 #define EXT2_MIN_BLOCK_LOG_SIZE 10 #define EXT2_BLOCK_SIZE(s) ((s)->e2fs_bsize) From owner-svn-src-head@FreeBSD.ORG Fri Feb 8 21:15:48 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 9CC0888F; Fri, 8 Feb 2013 21:15:48 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 847AF127; Fri, 8 Feb 2013 21:15:48 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r18LFmaU045312; Fri, 8 Feb 2013 21:15:48 GMT (envelope-from hselasky@svn.freebsd.org) Received: (from hselasky@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r18LFlFS045310; Fri, 8 Feb 2013 21:15:47 GMT (envelope-from hselasky@svn.freebsd.org) Message-Id: <201302082115.r18LFlFS045310@svn.freebsd.org> From: Hans Petter Selasky Date: Fri, 8 Feb 2013 21:15:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r246565 - head/sys/dev/usb/wlan X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Feb 2013 21:15:48 -0000 Author: hselasky Date: Fri Feb 8 21:15:47 2013 New Revision: 246565 URL: http://svnweb.freebsd.org/changeset/base/246565 Log: Fix regression issue after r244503: Correct init order to fix a NULL pointer access. MFC after: 1 week Reported by: Ian FREISLICH Modified: head/sys/dev/usb/wlan/if_uath.c head/sys/dev/usb/wlan/if_upgt.c Modified: head/sys/dev/usb/wlan/if_uath.c ============================================================================== --- head/sys/dev/usb/wlan/if_uath.c Fri Feb 8 21:09:44 2013 (r246564) +++ head/sys/dev/usb/wlan/if_uath.c Fri Feb 8 21:15:47 2013 (r246565) @@ -358,22 +358,12 @@ uath_attach(device_t dev) callout_init(&sc->stat_ch, 0); callout_init_mtx(&sc->watchdog_ch, &sc->sc_mtx, 0); - /* - * Allocate xfers for firmware commands. - */ - error = uath_alloc_cmd_list(sc, sc->sc_cmd); - if (error != 0) { - device_printf(sc->sc_dev, - "could not allocate Tx command list\n"); - goto fail; - } - error = usbd_transfer_setup(uaa->device, &iface_index, sc->sc_xfer, uath_usbconfig, UATH_N_XFERS, sc, &sc->sc_mtx); if (error) { device_printf(dev, "could not allocate USB transfers, " "err=%s\n", usbd_errstr(error)); - goto fail1; + goto fail; } sc->sc_cmd_dma_buf = @@ -382,6 +372,16 @@ uath_attach(device_t dev) usbd_xfer_get_frame_buffer(sc->sc_xfer[UATH_BULK_TX], 0); /* + * Setup buffers for firmware commands. + */ + error = uath_alloc_cmd_list(sc, sc->sc_cmd); + if (error != 0) { + device_printf(sc->sc_dev, + "could not allocate Tx command list\n"); + goto fail1; + } + + /* * We're now ready to send+receive firmware commands. */ UATH_LOCK(sc); @@ -492,8 +492,8 @@ uath_attach(device_t dev) fail4: if_free(ifp); fail3: UATH_UNLOCK(sc); -fail2: usbd_transfer_unsetup(sc->sc_xfer, UATH_N_XFERS); -fail1: uath_free_cmd_list(sc, sc->sc_cmd); +fail2: uath_free_cmd_list(sc, sc->sc_cmd); +fail1: usbd_transfer_unsetup(sc->sc_xfer, UATH_N_XFERS); fail: return (error); } Modified: head/sys/dev/usb/wlan/if_upgt.c ============================================================================== --- head/sys/dev/usb/wlan/if_upgt.c Fri Feb 8 21:09:44 2013 (r246564) +++ head/sys/dev/usb/wlan/if_upgt.c Fri Feb 8 21:15:47 2013 (r246565) @@ -259,20 +259,12 @@ upgt_attach(device_t dev) callout_init(&sc->sc_led_ch, 0); callout_init(&sc->sc_watchdog_ch, 0); - /* Allocate TX and RX xfers. */ - error = upgt_alloc_tx(sc); - if (error) - goto fail1; - error = upgt_alloc_rx(sc); - if (error) - goto fail2; - error = usbd_transfer_setup(uaa->device, &iface_index, sc->sc_xfer, upgt_config, UPGT_N_XFERS, sc, &sc->sc_mtx); if (error) { device_printf(dev, "could not allocate USB transfers, " "err=%s\n", usbd_errstr(error)); - goto fail3; + goto fail1; } sc->sc_rx_dma_buf = usbd_xfer_get_frame_buffer( @@ -280,6 +272,14 @@ upgt_attach(device_t dev) sc->sc_tx_dma_buf = usbd_xfer_get_frame_buffer( sc->sc_xfer[UPGT_BULK_TX], 0); + /* Setup TX and RX buffers */ + error = upgt_alloc_tx(sc); + if (error) + goto fail2; + error = upgt_alloc_rx(sc); + if (error) + goto fail3; + ifp = sc->sc_ifp = if_alloc(IFT_IEEE80211); if (ifp == NULL) { device_printf(dev, "can not if_alloc()\n"); @@ -382,9 +382,9 @@ upgt_attach(device_t dev) return (0); fail5: if_free(ifp); -fail4: usbd_transfer_unsetup(sc->sc_xfer, UPGT_N_XFERS); -fail3: upgt_free_rx(sc); -fail2: upgt_free_tx(sc); +fail4: upgt_free_rx(sc); +fail3: upgt_free_tx(sc); +fail2: usbd_transfer_unsetup(sc->sc_xfer, UPGT_N_XFERS); fail1: mtx_destroy(&sc->sc_mtx); return (error); From owner-svn-src-head@FreeBSD.ORG Fri Feb 8 22:41:49 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 96CD474E; Fri, 8 Feb 2013 22:41:49 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 74A9073C; Fri, 8 Feb 2013 22:41:49 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r18Mfn2w071436; Fri, 8 Feb 2013 22:41:49 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r18MfnWI071435; Fri, 8 Feb 2013 22:41:49 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <201302082241.r18MfnWI071435@svn.freebsd.org> From: Xin LI Date: Fri, 8 Feb 2013 22:41:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r246568 - head/sys/conf X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Feb 2013 22:41:49 -0000 Author: delphij Date: Fri Feb 8 22:41:48 2013 New Revision: 246568 URL: http://svnweb.freebsd.org/changeset/base/246568 Log: In r246282 the KTR_ENTRIES was specified with syntax error, fix it so 'make universe' would work. MFC after: 12 days X-MFC-with: r246282 Modified: head/sys/conf/NOTES Modified: head/sys/conf/NOTES ============================================================================== --- head/sys/conf/NOTES Fri Feb 8 22:23:22 2013 (r246567) +++ head/sys/conf/NOTES Fri Feb 8 22:41:48 2013 (r246568) @@ -462,7 +462,7 @@ options KTRACE_REQUEST_POOL=101 # options KTR options KTR_BOOT_ENTRIES=1024 -options KTR_ENTRIES=(128 * 1024) +options KTR_ENTRIES=(128*1024) options KTR_COMPILE=(KTR_INTR|KTR_PROC) options KTR_MASK=KTR_INTR options KTR_CPUMASK=0x3 From owner-svn-src-head@FreeBSD.ORG Fri Feb 8 22:51:10 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 6A7C9CB9; Fri, 8 Feb 2013 22:51:10 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 589757AC; Fri, 8 Feb 2013 22:51:10 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r18MpA9H074322; Fri, 8 Feb 2013 22:51:10 GMT (envelope-from hselasky@svn.freebsd.org) Received: (from hselasky@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r18MpA6v074321; Fri, 8 Feb 2013 22:51:10 GMT (envelope-from hselasky@svn.freebsd.org) Message-Id: <201302082251.r18MpA6v074321@svn.freebsd.org> From: Hans Petter Selasky Date: Fri, 8 Feb 2013 22:51:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r246570 - head/sys/dev/usb/wlan X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Feb 2013 22:51:10 -0000 Author: hselasky Date: Fri Feb 8 22:51:09 2013 New Revision: 246570 URL: http://svnweb.freebsd.org/changeset/base/246570 Log: Make sure we don't leak command buffers when a USB command transfer fails. MFC after: 1 week Reported by: Ian FREISLICH Modified: head/sys/dev/usb/wlan/if_uath.c Modified: head/sys/dev/usb/wlan/if_uath.c ============================================================================== --- head/sys/dev/usb/wlan/if_uath.c Fri Feb 8 22:45:47 2013 (r246569) +++ head/sys/dev/usb/wlan/if_uath.c Fri Feb 8 22:51:09 2013 (r246570) @@ -2436,11 +2436,8 @@ uath_intr_tx_callback(struct usb_xfer *x UATH_ASSERT_LOCKED(sc); - switch (USB_GET_STATE(xfer)) { - case USB_ST_TRANSFERRED: - cmd = STAILQ_FIRST(&sc->sc_cmd_active); - if (cmd == NULL) - goto setup; + cmd = STAILQ_FIRST(&sc->sc_cmd_active); + if (cmd != NULL && USB_GET_STATE(xfer) != USB_ST_SETUP) { STAILQ_REMOVE_HEAD(&sc->sc_cmd_active, next); UATH_STAT_DEC(sc, st_cmd_active); STAILQ_INSERT_TAIL((cmd->flags & UATH_CMD_FLAG_READ) ? @@ -2449,7 +2446,10 @@ uath_intr_tx_callback(struct usb_xfer *x UATH_STAT_INC(sc, st_cmd_waiting); else UATH_STAT_INC(sc, st_cmd_inactive); - /* FALLTHROUGH */ + } + + switch (USB_GET_STATE(xfer)) { + case USB_ST_TRANSFERRED: case USB_ST_SETUP: setup: cmd = STAILQ_FIRST(&sc->sc_cmd_pending); From owner-svn-src-head@FreeBSD.ORG Fri Feb 8 23:13:47 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 8A11B8B3; Fri, 8 Feb 2013 23:13:47 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 722D78C8; Fri, 8 Feb 2013 23:13:47 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r18NDl1e080982; Fri, 8 Feb 2013 23:13:47 GMT (envelope-from hselasky@svn.freebsd.org) Received: (from hselasky@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r18NDli1080979; Fri, 8 Feb 2013 23:13:47 GMT (envelope-from hselasky@svn.freebsd.org) Message-Id: <201302082313.r18NDli1080979@svn.freebsd.org> From: Hans Petter Selasky Date: Fri, 8 Feb 2013 23:13:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r246571 - head/sys/boot/usb X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Feb 2013 23:13:47 -0000 Author: hselasky Date: Fri Feb 8 23:13:46 2013 New Revision: 246571 URL: http://svnweb.freebsd.org/changeset/base/246571 Log: Correctly list the usbloader dependencies. Modified: head/sys/boot/usb/Makefile.test Modified: head/sys/boot/usb/Makefile.test ============================================================================== --- head/sys/boot/usb/Makefile.test Fri Feb 8 22:51:09 2013 (r246570) +++ head/sys/boot/usb/Makefile.test Fri Feb 8 23:13:46 2013 (r246571) @@ -53,9 +53,9 @@ SRCS+= bsd_usbloader_test.c LDADD+= libusbboot.a DPADD+= libusbboot.a -all: libusbboot.a - .include +${PROG}: libusbboot.a + libusbboot.a: make -f Makefile From owner-svn-src-head@FreeBSD.ORG Fri Feb 8 23:31:04 2013 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id AABB8C46; Fri, 8 Feb 2013 23:31:04 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from duck.symmetricom.us (duck.symmetricom.us [206.168.13.214]) by mx1.freebsd.org (Postfix) with ESMTP id 7EE0F960; Fri, 8 Feb 2013 23:31:04 +0000 (UTC) Received: from damnhippie.dyndns.org (daffy.symmetricom.us [206.168.13.218]) by duck.symmetricom.us (8.14.6/8.14.6) with ESMTP id r18NV3X1019579; Fri, 8 Feb 2013 16:31:04 -0700 (MST) (envelope-from ian@FreeBSD.org) Received: from [172.22.42.240] (revolution.hippie.lan [172.22.42.240]) by damnhippie.dyndns.org (8.14.3/8.14.3) with ESMTP id r18NV1GY036382; Fri, 8 Feb 2013 16:31:01 -0700 (MST) (envelope-from ian@FreeBSD.org) Subject: Re: svn commit: r246361 - head/sbin/devd From: Ian Lepore To: Niclas Zeising In-Reply-To: <201302051429.r15ETb7n008263@svn.freebsd.org> References: <201302051429.r15ETb7n008263@svn.freebsd.org> Content-Type: text/plain; charset="us-ascii" Date: Fri, 08 Feb 2013 16:31:01 -0700 Message-ID: <1360366261.4545.44.camel@revolution.hippie.lan> Mime-Version: 1.0 X-Mailer: Evolution 2.32.1 FreeBSD GNOME Team Port Content-Transfer-Encoding: 7bit Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Feb 2013 23:31:04 -0000 On Tue, 2013-02-05 at 14:29 +0000, Niclas Zeising wrote: > Author: zeising (doc,ports committer) > Date: Tue Feb 5 14:29:37 2013 > New Revision: 246361 > URL: http://svnweb.freebsd.org/changeset/base/246361 > > Log: > Bump .Dd for the change in r246121. > > Approved by: joel (mentor) > > Modified: > head/sbin/devd/devd.8 > > Modified: head/sbin/devd/devd.8 > ============================================================================== > --- head/sbin/devd/devd.8 Tue Feb 5 13:30:07 2013 (r246360) > +++ head/sbin/devd/devd.8 Tue Feb 5 14:29:37 2013 (r246361) > @@ -25,7 +25,7 @@ > .\" > .\" $FreeBSD$ > .\" > -.Dd November 24, 2005 > +.Dd January 30, 2013 > .Dt DEVD 8 > .Os > .Sh NAME Does this imply that I should update the .Dd line whenever I touch a manpage? -- Ian From owner-svn-src-head@FreeBSD.ORG Fri Feb 8 23:49:37 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 2DFCA13C for ; Fri, 8 Feb 2013 23:49:37 +0000 (UTC) (envelope-from lists@eitanadler.com) Received: from mail-da0-f53.google.com (mail-da0-f53.google.com [209.85.210.53]) by mx1.freebsd.org (Postfix) with ESMTP id EC528A0D for ; Fri, 8 Feb 2013 23:49:36 +0000 (UTC) Received: by mail-da0-f53.google.com with SMTP id r13so579512daj.26 for ; Fri, 08 Feb 2013 15:49:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=eitanadler.com; s=0xdeadbeef; h=x-received:mime-version:sender:in-reply-to:references:from:date :x-google-sender-auth:message-id:subject:to:cc:content-type; bh=S0xKHDlvMcpClQiG2Tkjb6b1PvAfngVp1naCjrtaRXg=; b=t3aCnkg1XLRySahGxmrq7+J5VqXKpLFJwUWUlVlGlky+EdVBHAHU3h4EdzMHyKAp1m LcSGArZyKgJgbwkUJjF1KLueOUTBvkXXAnyS7ePVQScWavVq74+fLRd68bMOftMXiAjq d3jzKM4csmhlhvLaPq8Z1IM+MiTupRh7xuw38= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:mime-version:sender:in-reply-to:references:from:date :x-google-sender-auth:message-id:subject:to:cc:content-type :x-gm-message-state; bh=S0xKHDlvMcpClQiG2Tkjb6b1PvAfngVp1naCjrtaRXg=; b=S/C7d+MPcmFOWo4SCDn06ojR4+u9rpKiPRX8vyChzzphle5w7LttjndKtWO/fauH1u 0LcGyyPc3/zwjF+1u6xdQ7S9hZqiV+X+kntXwjn1nKUe5e/neDEGBdsWqCmzIK1IW+2j rV8PlowcpdVHsR1sOJ6j2UHtCPMqU3dMXlEeE6Q0Om8KZa4UCqsEYsakaASoxj/xan4I xbIqscE+Rvpwyz4x5AhWmypXtp3FB8CBKzJK8+cgtZS+eaXrN0fZrhwukmIZYqehAQB8 T5NdmSY3o9rofAf1mIzCKwKXsgu8R3Uh0y7kRCv85tHFLC1VJDRb3G64htiOq9XzjMbq lDMA== X-Received: by 10.66.222.35 with SMTP id qj3mr2485989pac.69.1360367376296; Fri, 08 Feb 2013 15:49:36 -0800 (PST) MIME-Version: 1.0 Sender: lists@eitanadler.com Received: by 10.66.148.10 with HTTP; Fri, 8 Feb 2013 15:49:06 -0800 (PST) In-Reply-To: <1360366261.4545.44.camel@revolution.hippie.lan> References: <201302051429.r15ETb7n008263@svn.freebsd.org> <1360366261.4545.44.camel@revolution.hippie.lan> From: Eitan Adler Date: Fri, 8 Feb 2013 18:49:06 -0500 X-Google-Sender-Auth: 5iKoSj-R8wPlIwbJj-1TLgsamho Message-ID: Subject: Re: svn commit: r246361 - head/sbin/devd To: Ian Lepore Content-Type: text/plain; charset=UTF-8 X-Gm-Message-State: ALoCoQkBTcUVKelOX3Fo+wLbWTuJfOgMpXOrzn3fTQGkI51yzITOzoz7yj61zzJOTZ3GaZ/7LLxO Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Niclas Zeising X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Feb 2013 23:49:37 -0000 On 8 February 2013 18:31, Ian Lepore wrote: > Does this imply that I should update the .Dd line whenever I touch a > manpage? For content changes, yes. -- Eitan Adler Source, Ports, Doc committer Bugmeister, Ports Security teams From owner-svn-src-head@FreeBSD.ORG Sat Feb 9 00:35:29 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 304DADF0; Sat, 9 Feb 2013 00:35:29 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 224DBC41; Sat, 9 Feb 2013 00:35:29 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r190ZS1Q005014; Sat, 9 Feb 2013 00:35:28 GMT (envelope-from np@svn.freebsd.org) Received: (from np@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r190ZS1X005013; Sat, 9 Feb 2013 00:35:28 GMT (envelope-from np@svn.freebsd.org) Message-Id: <201302090035.r190ZS1X005013@svn.freebsd.org> From: Navdeep Parhar Date: Sat, 9 Feb 2013 00:35:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r246575 - head/sys/dev/cxgbe X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 09 Feb 2013 00:35:29 -0000 Author: np Date: Sat Feb 9 00:35:28 2013 New Revision: 246575 URL: http://svnweb.freebsd.org/changeset/base/246575 Log: Do not hold locks around hardware context reads. MFC after: 3 days Modified: head/sys/dev/cxgbe/t4_main.c Modified: head/sys/dev/cxgbe/t4_main.c ============================================================================== --- head/sys/dev/cxgbe/t4_main.c Sat Feb 9 00:29:36 2013 (r246574) +++ head/sys/dev/cxgbe/t4_main.c Sat Feb 9 00:35:28 2013 (r246575) @@ -5161,23 +5161,24 @@ get_sge_context(struct adapter *sc, stru cntxt->mem_id != CTXT_FLM && cntxt->mem_id != CTXT_CNM) return (EINVAL); + rc = begin_synchronized_op(sc, NULL, SLEEP_OK | INTR_OK, "t4ctxt"); + if (rc) + return (rc); + if (sc->flags & FW_OK) { - rc = begin_synchronized_op(sc, NULL, HOLD_LOCK, "t4ctxt"); - if (rc == 0) { - rc = -t4_sge_ctxt_rd(sc, sc->mbox, cntxt->cid, - cntxt->mem_id, &cntxt->data[0]); - end_synchronized_op(sc, LOCK_HELD); - if (rc == 0) - return (0); - } + rc = -t4_sge_ctxt_rd(sc, sc->mbox, cntxt->cid, cntxt->mem_id, + &cntxt->data[0]); + if (rc == 0) + goto done; } /* * Read via firmware failed or wasn't even attempted. Read directly via * the backdoor. */ - rc = -t4_sge_ctxt_rd_bd(sc, cntxt->cid, cntxt->mem_id, - &cntxt->data[0]); + rc = -t4_sge_ctxt_rd_bd(sc, cntxt->cid, cntxt->mem_id, &cntxt->data[0]); +done: + end_synchronized_op(sc, 0); return (rc); } From owner-svn-src-head@FreeBSD.ORG Sat Feb 9 02:42:02 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id A633467F; Sat, 9 Feb 2013 02:42:02 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 818AA185; Sat, 9 Feb 2013 02:42:02 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r192g2Nv043597; Sat, 9 Feb 2013 02:42:02 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r192g2aV043596; Sat, 9 Feb 2013 02:42:02 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201302090242.r192g2aV043596@svn.freebsd.org> From: Adrian Chadd Date: Sat, 9 Feb 2013 02:42:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r246579 - head/sys/dev/ath/ath_hal/ar5416 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 09 Feb 2013 02:42:02 -0000 Author: adrian Date: Sat Feb 9 02:42:01 2013 New Revision: 246579 URL: http://svnweb.freebsd.org/changeset/base/246579 Log: The encryption type field needs to be preserved for each descriptor making up a frame, in both a sub-frame and for all frames in an aggregate. Tested: * AR5416, STA mode Modified: head/sys/dev/ath/ath_hal/ar5416/ar5416_xmit.c Modified: head/sys/dev/ath/ath_hal/ar5416/ar5416_xmit.c ============================================================================== --- head/sys/dev/ath/ath_hal/ar5416/ar5416_xmit.c Sat Feb 9 01:41:21 2013 (r246578) +++ head/sys/dev/ath/ath_hal/ar5416/ar5416_xmit.c Sat Feb 9 02:42:01 2013 (r246579) @@ -306,10 +306,14 @@ ar5416FillTxDesc(struct ath_hal *ah, str & AR_TxIntrReq; ads->ds_ctl2 = __bswap32(AR5416DESC_CONST(ds0)->ds_ctl2); ads->ds_ctl3 = __bswap32(AR5416DESC_CONST(ds0)->ds_ctl3); + /* ctl6 - we only need encrtype; the rest are blank */ + ads->ds_ctl6 = __bswap32(AR5416DESC_CONST(ds0)->ds_ctl6 & AR_EncrType); #else ads->ds_ctl0 = AR5416DESC_CONST(ds0)->ds_ctl0 & AR_TxIntrReq; ads->ds_ctl2 = AR5416DESC_CONST(ds0)->ds_ctl2; ads->ds_ctl3 = AR5416DESC_CONST(ds0)->ds_ctl3; + /* ctl6 - we only need encrtype; the rest are blank */ + ads->ds_ctl6 = AR5416DESC_CONST(ds0)->ds_ctl6 & AR_EncrType; #endif } else { /* !firstSeg && !lastSeg */ /* @@ -318,8 +322,10 @@ ar5416FillTxDesc(struct ath_hal *ah, str #ifdef AH_NEED_DESC_SWAP ads->ds_ctl0 = __bswap32(AR5416DESC_CONST(ds0)->ds_ctl0) & AR_TxIntrReq; + ads->ds_ctl6 = __bswap32(AR5416DESC_CONST(ds0)->ds_ctl6 & AR_EncrType); #else ads->ds_ctl0 = AR5416DESC_CONST(ds0)->ds_ctl0 & AR_TxIntrReq; + ads->ds_ctl6 = AR5416DESC_CONST(ds0)->ds_ctl6 & AR_EncrType; #endif ads->ds_ctl1 = segLen | AR_TxMore; ads->ds_ctl2 = 0; From owner-svn-src-head@FreeBSD.ORG Sat Feb 9 04:13:46 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 4F8B315F; Sat, 9 Feb 2013 04:13:46 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 381C26C6; Sat, 9 Feb 2013 04:13:46 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r194DjLF071574; Sat, 9 Feb 2013 04:13:45 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r194DjI0071573; Sat, 9 Feb 2013 04:13:45 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <201302090413.r194DjI0071573@svn.freebsd.org> From: Xin LI Date: Sat, 9 Feb 2013 04:13:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r246581 - head/sys/ofed/drivers/net/mlx4 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 09 Feb 2013 04:13:46 -0000 Author: delphij Date: Sat Feb 9 04:13:45 2013 New Revision: 246581 URL: http://svnweb.freebsd.org/changeset/base/246581 Log: Fix LINT build on amd64. Modified: head/sys/ofed/drivers/net/mlx4/en_tx.c Modified: head/sys/ofed/drivers/net/mlx4/en_tx.c ============================================================================== --- head/sys/ofed/drivers/net/mlx4/en_tx.c Sat Feb 9 02:57:37 2013 (r246580) +++ head/sys/ofed/drivers/net/mlx4/en_tx.c Sat Feb 9 04:13:45 2013 (r246581) @@ -936,16 +936,16 @@ mlx4_en_transmit_locked(struct ifnet *de return (err); } /* Process the queue */ - while ((next = drbr_peek(ifp, ring->br)) != NULL) { + while ((next = drbr_peek(dev, ring->br)) != NULL) { if ((err = mlx4_en_xmit(dev, tx_ind, &next)) != 0) { if (next == NULL) { - drbr_advance(ifp, ring->br); + drbr_advance(dev, ring->br); } else { - drbr_putback(ifp, ring->br, next); + drbr_putback(dev, ring->br, next); } break; } - drbr_advance(ifp, ring->br); + drbr_advance(dev, ring->br); enqueued++; dev->if_obytes += next->m_pkthdr.len; if (next->m_flags & M_MCAST) From owner-svn-src-head@FreeBSD.ORG Sat Feb 9 06:31:22 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id D8273264; Sat, 9 Feb 2013 06:31:22 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id CB4F7A53; Sat, 9 Feb 2013 06:31:22 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r196VME2012764; Sat, 9 Feb 2013 06:31:22 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r196VMw0012763; Sat, 9 Feb 2013 06:31:22 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <201302090631.r196VMw0012763@svn.freebsd.org> From: Xin LI Date: Sat, 9 Feb 2013 06:31:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r246585 - head/sys/modules/usb/smsc X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 09 Feb 2013 06:31:22 -0000 Author: delphij Date: Sat Feb 9 06:31:22 2013 New Revision: 246585 URL: http://svnweb.freebsd.org/changeset/base/246585 Log: Fix LINT build for ARM. Modified: head/sys/modules/usb/smsc/Makefile Modified: head/sys/modules/usb/smsc/Makefile ============================================================================== --- head/sys/modules/usb/smsc/Makefile Sat Feb 9 06:31:13 2013 (r246584) +++ head/sys/modules/usb/smsc/Makefile Sat Feb 9 06:31:22 2013 (r246585) @@ -33,5 +33,6 @@ KMOD= if_smsc SRCS= opt_bus.h opt_usb.h device_if.h bus_if.h usb_if.h usbdevs.h \ miibus_if.h opt_inet.h opt_platform.h \ if_smsc.c +SRCS+= ofw_bus_if.h .include From owner-svn-src-head@FreeBSD.ORG Sat Feb 9 06:39:31 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id E5BDD4C7; Sat, 9 Feb 2013 06:39:31 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id CF7A5A99; Sat, 9 Feb 2013 06:39:31 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r196dVWY013864; Sat, 9 Feb 2013 06:39:31 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r196dSR0013840; Sat, 9 Feb 2013 06:39:28 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <201302090639.r196dSR0013840@svn.freebsd.org> From: Xin LI Date: Sat, 9 Feb 2013 06:39:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r246586 - in head: cddl/contrib/opensolaris/cmd/zfs cddl/contrib/opensolaris/cmd/zpool sys/cddl/boot/zfs sys/cddl/compat/opensolaris/sys sys/cddl/contrib/opensolaris/common/zfs sys/cddl... X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 09 Feb 2013 06:39:32 -0000 Author: delphij Date: Sat Feb 9 06:39:28 2013 New Revision: 246586 URL: http://svnweb.freebsd.org/changeset/base/246586 Log: MFV r245512: * Illumos zfs issue #3035 [1] LZ4 compression support in ZFS. LZ4 is a new high-speed BSD-licensed compression algorithm created by Yann Collet that delivers very high compression and decompression performance compared to lzjb (>50% faster on compression, >80% faster on decompression and around 3x faster on compression of incompressible data), while giving better compression ratio [1]. This version of LZ4 corresponds to upstream's [2] revision 85. Please note that for obvious reasons this is not backward read compatible. This means once a pool have LZ4 compressed data, these data can no longer be read by older ZFS implementations. Local changes: - On-stack hash table disabled and using kernel slab allocator instead, at this time. This requires larger kernel thread stack for zio workers. This may change in the future should we adjusted the zio workers' thread stack size. - likely and unlikely will be undefined if they are already defined, this is required for i386 XEN build. - Removed De Bruijn sequence based __builtin_ctz family of builtins in favor of the latter. Both GCC and clang supports these builtins. - Changed the way the LZ4 code detects endianness. - Manual pages modifications to mention the feature based on Illumos counterpart. - Boot loader changes to make it support LZ4 decompression. [1] https://www.illumos.org/issues/3035 [2] http://code.google.com/p/lz4/source/list Obtained from: Illumos (13921:9d721847e469) Tested on: FreeBSD/amd64 MFC after: 1 month Added: head/sys/cddl/boot/zfs/lz4.c (contents, props changed) head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/THIRDPARTYLICENSE.lz4 - copied unchanged from r245512, vendor-sys/illumos/dist/uts/common/fs/zfs/THIRDPARTYLICENSE.lz4 head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/THIRDPARTYLICENSE.lz4.descrip - copied unchanged from r245512, vendor-sys/illumos/dist/uts/common/fs/zfs/THIRDPARTYLICENSE.lz4.descrip head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/lz4.c - copied, changed from r245512, vendor-sys/illumos/dist/uts/common/fs/zfs/lz4.c Modified: head/cddl/contrib/opensolaris/cmd/zfs/zfs.8 head/cddl/contrib/opensolaris/cmd/zpool/zpool-features.7 head/sys/cddl/boot/zfs/README head/sys/cddl/boot/zfs/zfsimpl.h head/sys/cddl/boot/zfs/zfssubr.c head/sys/cddl/compat/opensolaris/sys/byteorder.h head/sys/cddl/contrib/opensolaris/common/zfs/zfeature_common.c head/sys/cddl/contrib/opensolaris/common/zfs/zfeature_common.h head/sys/cddl/contrib/opensolaris/common/zfs/zfs_prop.c head/sys/cddl/contrib/opensolaris/uts/common/Makefile.files head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zio.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zio_compress.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio_compress.c head/sys/conf/files Directory Properties: head/sys/cddl/contrib/opensolaris/ (props changed) Modified: head/cddl/contrib/opensolaris/cmd/zfs/zfs.8 ============================================================================== --- head/cddl/contrib/opensolaris/cmd/zfs/zfs.8 Sat Feb 9 06:31:22 2013 (r246585) +++ head/cddl/contrib/opensolaris/cmd/zfs/zfs.8 Sat Feb 9 06:39:28 2013 (r246586) @@ -24,10 +24,11 @@ .\" Copyright (c) 2011, Pawel Jakub Dawidek .\" Copyright (c) 2012, Glen Barber .\" Copyright (c) 2012, Bryan Drewery +.\" Copyright (c) 2013 by Saso Kiselkov. All rights reserved. .\" .\" $FreeBSD$ .\" -.Dd November 26, 2012 +.Dd February 8, 2012 .Dt ZFS 8 .Os .Sh NAME @@ -866,7 +867,7 @@ but this may change in future releases). disables integrity checking on user data. Disabling checksums is .Em NOT a recommended practice. -.It Sy compression Ns = Ns Cm on | off | lzjb | gzip | gzip- Ns Ar N | Cm zle +.It Sy compression Ns = Ns Cm on | off | lzjb | gzip | gzip- Ns Ar N | zle | Cm lz4 Controls the compression algorithm used for this dataset. The .Cm lzjb compression algorithm is optimized for performance while providing decent data @@ -894,6 +895,26 @@ The .Cm zle compression algorithm compresses runs of zeros. .Pp +The +.Sy lz4 +compression algorithm is a high-performance replacement +for the +.Sy lzjb +algorithm. It features significantly faster +compression and decompression, as well as a moderately higher +compression ratio than +.Sy lzjb , +but can only be used on pools with +the +.Sy lz4_compress +feature set to +.Sy enabled . +See +.Xr zpool-features 7 +for details on ZFS feature flags and the +.Sy lz4_compress +feature. +.Pp This property can also be referred to by its shortened column name .Cm compress . Changing this property affects only newly-written data. Modified: head/cddl/contrib/opensolaris/cmd/zpool/zpool-features.7 ============================================================================== --- head/cddl/contrib/opensolaris/cmd/zpool/zpool-features.7 Sat Feb 9 06:31:22 2013 (r246585) +++ head/cddl/contrib/opensolaris/cmd/zpool/zpool-features.7 Sat Feb 9 06:39:28 2013 (r246586) @@ -18,10 +18,11 @@ .\" information: Portions Copyright [yyyy] [name of copyright owner] .\" .\" Copyright (c) 2012 by Delphix. All rights reserved. +.\" Copyright (c) 2013 by Saso Kiselkov. All rights reserved. .\" .\" $FreeBSD$ .\" -.Dd Aug 28, 2012 +.Dd February 8, 2012 .Dt ZPOOL-FEATURES 7 .Os .Sh NAME @@ -185,6 +186,49 @@ This feature is .Sy active while there are any filesystems, volumes, or snapshots which were created after enabling this feature. +.It Sy lz4_compress +.Bl -column "READ\-ONLY COMPATIBLE" "org.illumos:lz4_compress" +.It GUID Ta org.illumos:lz4_compress +.It READ\-ONLY COMPATIBLE Ta no +.It DEPENDENCIES Ta none +.El +.Pp +.Sy lz4 +is a high-performance real-time compression algorithm that +features significantly faster compression and decompression as well as a +higher compression ratio than the older +.Sy lzjb +compression. +Typically, +.Sy lz4 +compression is approximately 50% faster on +compressible data and 200% faster on incompressible data than +.Sy lzjb . +It is also approximately 80% faster on decompression, while +giving approximately 10% better compression ratio. +.Pp +When the +.Sy lz4_compress +feature is set to +.Sy enabled , +the +administrator can turn on +.Sy lz4 +compression on any dataset on the +pool using the +.Xr zfs 8 +command. Please note that doing so will +immediately activate the +.Sy lz4_compress +feature on the underlying +pool (even before any data is written). Since this feature is not +read-only compatible, this operation will render the pool unimportable +on systems without support for the +.Sy lz4_compress +feature. At the +moment, this operation cannot be reversed. Booting off of +.Sy lz4 +-compressed root pools is supported. .El .Sh SEE ALSO .Xr zpool 8 Modified: head/sys/cddl/boot/zfs/README ============================================================================== --- head/sys/cddl/boot/zfs/README Sat Feb 9 06:31:22 2013 (r246585) +++ head/sys/cddl/boot/zfs/README Sat Feb 9 06:39:28 2013 (r246586) @@ -5,6 +5,7 @@ are used by the ZFS bootstrap: fletcher.c checksum support sha256.c checksum support + lz4.c compression support lzjb.c compression support zfssubr.c checksum, compression and raidz support zfsimpl.h mostly describing the physical layout Added: head/sys/cddl/boot/zfs/lz4.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/cddl/boot/zfs/lz4.c Sat Feb 9 06:39:28 2013 (r246586) @@ -0,0 +1,308 @@ +/* + * LZ4 - Fast LZ compression algorithm + * Header File + * Copyright (C) 2011-2013, Yann Collet. + * BSD 2-Clause License (http://www.opensource.org/licenses/bsd-license.php) + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * You can contact the author at : + * - LZ4 homepage : http://fastcompression.blogspot.com/p/lz4.html + * - LZ4 source repository : http://code.google.com/p/lz4/ + * + * $FreeBSD$ + */ + +static int LZ4_uncompress_unknownOutputSize(const char *source, char *dest, + int isize, int maxOutputSize); + +/* ARGSUSED */ +static int +lz4_decompress(void *s_start, void *d_start, size_t s_len, size_t d_len, int dummy __unused) +{ + const uint8_t *src = s_start; + uint32_t bufsiz = htonl(*(uint32_t *)src); + + /* invalid compressed buffer size encoded at start */ + if (bufsiz + 4 > s_len) + return (1); + + /* + * Returns 0 on success (decompression function returned non-negative) + * and non-zero on failure (decompression function returned negative). + */ + return (LZ4_uncompress_unknownOutputSize(s_start + 4, d_start, bufsiz, + d_len) < 0); +} + +/* + * CPU Feature Detection + */ + +/* 32 or 64 bits ? */ +#if (defined(__x86_64__) || defined(__x86_64) || defined(__amd64__) || \ + defined(__amd64) || defined(__ppc64__) || defined(_WIN64) || \ + defined(__LP64__) || defined(_LP64)) +#define LZ4_ARCH64 1 +#else +#define LZ4_ARCH64 0 +#endif + +/* + * Little Endian or Big Endian? + * Note: overwrite the below #define if you know your architecture endianess. + */ +#if BYTE_ORDER == BIG_ENDIAN +#define LZ4_BIG_ENDIAN 1 +#else + /* + * Little Endian assumed. PDP Endian and other very rare endian format + * are unsupported. + */ +#endif + +/* + * Compiler Options + */ +#if __STDC_VERSION__ >= 199901L /* C99 */ +/* "restrict" is a known keyword */ +#else +/* Disable restrict */ +#define restrict +#endif + +#define GCC_VERSION (__GNUC__ * 100 + __GNUC_MINOR__) + +#define lz4_bswap16(x) ((unsigned short int) ((((x) >> 8) & 0xffu) \ + | (((x) & 0xffu) << 8))) + +#if (GCC_VERSION >= 302) || (__INTEL_COMPILER >= 800) || defined(__clang__) +#define expect(expr, value) (__builtin_expect((expr), (value))) +#else +#define expect(expr, value) (expr) +#endif + +#define likely(expr) expect((expr) != 0, 1) +#define unlikely(expr) expect((expr) != 0, 0) + +/* Basic types */ +#define BYTE uint8_t +#define U16 uint16_t +#define U32 uint32_t +#define S32 int32_t +#define U64 uint64_t + +typedef struct _U16_S { + U16 v; +} U16_S; +typedef struct _U32_S { + U32 v; +} U32_S; +typedef struct _U64_S { + U64 v; +} U64_S; + +#define A64(x) (((U64_S *)(x))->v) +#define A32(x) (((U32_S *)(x))->v) +#define A16(x) (((U16_S *)(x))->v) + +/* + * Constants + */ +#define MINMATCH 4 + +#define COPYLENGTH 8 +#define LASTLITERALS 5 + +#define ML_BITS 4 +#define ML_MASK ((1U<> ML_BITS)) == RUN_MASK) { + int s = 255; + while ((ip < iend) && (s == 255)) { + s = *ip++; + length += s; + } + } + /* copy literals */ + cpy = op + length; + if ((cpy > oend - COPYLENGTH) || + (ip + length > iend - COPYLENGTH)) { + if (cpy > oend) + /* + * Error: request to write beyond destination + * buffer. + */ + goto _output_error; + if (ip + length > iend) + /* + * Error : request to read beyond source + * buffer. + */ + goto _output_error; + memcpy(op, ip, length); + op += length; + ip += length; + if (ip < iend) + /* Error : LZ4 format violation */ + goto _output_error; + /* Necessarily EOF, due to parsing restrictions. */ + break; + } + LZ4_WILDCOPY(ip, op, cpy); + ip -= (op - cpy); + op = cpy; + + /* get offset */ + LZ4_READ_LITTLEENDIAN_16(ref, cpy, ip); + ip += 2; + if (ref < (BYTE * const) dest) + /* + * Error: offset creates reference outside of + * destination buffer. + */ + goto _output_error; + + /* get matchlength */ + if ((length = (token & ML_MASK)) == ML_MASK) { + while (ip < iend) { + int s = *ip++; + length += s; + if (s == 255) + continue; + break; + } + } + /* copy repeated sequence */ + if unlikely(op - ref < STEPSIZE) { +#if LZ4_ARCH64 + size_t dec2table[] = { 0, 0, 0, -1, 0, 1, 2, 3 }; + size_t dec2 = dec2table[op - ref]; +#else + const int dec2 = 0; +#endif + *op++ = *ref++; + *op++ = *ref++; + *op++ = *ref++; + *op++ = *ref++; + ref -= dec[op - ref]; + A32(op) = A32(ref); + op += STEPSIZE - 4; + ref -= dec2; + } else { + LZ4_COPYSTEP(ref, op); + } + cpy = op + length - (STEPSIZE - 4); + if (cpy > oend - COPYLENGTH) { + if (cpy > oend) + /* + * Error: request to write outside of + * destination buffer. + */ + goto _output_error; + LZ4_SECURECOPY(ref, op, (oend - COPYLENGTH)); + while (op < cpy) + *op++ = *ref++; + op = cpy; + if (op == oend) + /* + * Check EOF (should never happen, since last + * 5 bytes are supposed to be literals). + */ + break; + continue; + } + LZ4_SECURECOPY(ref, op, cpy); + op = cpy; /* correction */ + } + + /* end of decoding */ + return (int)(((char *)op) - dest); + + /* write overflow error detected */ + _output_error: + return (int)(-(((char *)ip) - source)); +} Modified: head/sys/cddl/boot/zfs/zfsimpl.h ============================================================================== --- head/sys/cddl/boot/zfs/zfsimpl.h Sat Feb 9 06:31:22 2013 (r246585) +++ head/sys/cddl/boot/zfs/zfsimpl.h Sat Feb 9 06:39:28 2013 (r246586) @@ -52,6 +52,9 @@ * Copyright 2009 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ +/* + * Copyright 2013 by Saso Kiselkov. All rights reserved. + */ #define MAXNAMELEN 256 @@ -439,6 +442,7 @@ enum zio_compress { ZIO_COMPRESS_GZIP_8, ZIO_COMPRESS_GZIP_9, ZIO_COMPRESS_ZLE, + ZIO_COMPRESS_LZ4, ZIO_COMPRESS_FUNCTIONS }; Modified: head/sys/cddl/boot/zfs/zfssubr.c ============================================================================== --- head/sys/cddl/boot/zfs/zfssubr.c Sat Feb 9 06:31:22 2013 (r246585) +++ head/sys/cddl/boot/zfs/zfssubr.c Sat Feb 9 06:39:28 2013 (r246586) @@ -119,6 +119,7 @@ typedef struct zio_compress_info { #include "lzjb.c" #include "zle.c" +#include "lz4.c" /* * Compression vectors. @@ -139,6 +140,7 @@ static zio_compress_info_t zio_compress_ {NULL, NULL, 8, "gzip-8"}, {NULL, NULL, 9, "gzip-9"}, {NULL, zle_decompress, 64, "zle"}, + {NULL, lz4_decompress, 0, "lz4"}, }; static void Modified: head/sys/cddl/compat/opensolaris/sys/byteorder.h ============================================================================== --- head/sys/cddl/compat/opensolaris/sys/byteorder.h Sat Feb 9 06:31:22 2013 (r246585) +++ head/sys/cddl/compat/opensolaris/sys/byteorder.h Sat Feb 9 06:39:28 2013 (r246586) @@ -42,6 +42,11 @@ #ifndef _OPENSOLARIS_SYS_BYTEORDER_H_ #define _OPENSOLARIS_SYS_BYTEORDER_H_ +/* for htonl() */ +#ifndef _KERNEL +#include +#endif + /* * Macros to reverse byte order */ @@ -86,4 +91,6 @@ #define ntohll(x) BSWAP_64(x) #endif +#define BE_IN32(xa) htonl(*((uint32_t *)(void *)(xa))) + #endif /* _OPENSOLARIS_SYS_BYTEORDER_H_ */ Modified: head/sys/cddl/contrib/opensolaris/common/zfs/zfeature_common.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/common/zfs/zfeature_common.c Sat Feb 9 06:31:22 2013 (r246585) +++ head/sys/cddl/contrib/opensolaris/common/zfs/zfeature_common.c Sat Feb 9 06:39:28 2013 (r246586) @@ -21,6 +21,7 @@ /* * Copyright (c) 2012 by Delphix. All rights reserved. + * Copyright (c) 2013 by Saso Kiselkov. All rights reserved. */ #ifdef _KERNEL @@ -155,4 +156,7 @@ zpool_feature_init(void) zfeature_register(SPA_FEATURE_EMPTY_BPOBJ, "com.delphix:empty_bpobj", "empty_bpobj", "Snapshots use less space.", B_TRUE, B_FALSE, NULL); + zfeature_register(SPA_FEATURE_LZ4_COMPRESS, + "org.illumos:lz4_compress", "lz4_compress", + "LZ4 compression algorithm support.", B_FALSE, B_FALSE, NULL); } Modified: head/sys/cddl/contrib/opensolaris/common/zfs/zfeature_common.h ============================================================================== --- head/sys/cddl/contrib/opensolaris/common/zfs/zfeature_common.h Sat Feb 9 06:31:22 2013 (r246585) +++ head/sys/cddl/contrib/opensolaris/common/zfs/zfeature_common.h Sat Feb 9 06:39:28 2013 (r246586) @@ -21,6 +21,7 @@ /* * Copyright (c) 2012 by Delphix. All rights reserved. + * Copyright (c) 2013 by Saso Kiselkov. All rights reserved. */ #ifndef _ZFEATURE_COMMON_H @@ -51,6 +52,7 @@ typedef int (zfeature_func_t)(zfeature_i static enum spa_feature { SPA_FEATURE_ASYNC_DESTROY, SPA_FEATURE_EMPTY_BPOBJ, + SPA_FEATURE_LZ4_COMPRESS, SPA_FEATURES } spa_feature_t; Modified: head/sys/cddl/contrib/opensolaris/common/zfs/zfs_prop.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/common/zfs/zfs_prop.c Sat Feb 9 06:31:22 2013 (r246585) +++ head/sys/cddl/contrib/opensolaris/common/zfs/zfs_prop.c Sat Feb 9 06:39:28 2013 (r246586) @@ -21,6 +21,7 @@ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2011 by Delphix. All rights reserved. + * Copyright (c) 2013 by Saso Kiselkov. All rights reserved. */ /* Portions Copyright 2010 Robert Milkowski */ @@ -96,6 +97,7 @@ zfs_prop_init(void) { "gzip-8", ZIO_COMPRESS_GZIP_8 }, { "gzip-9", ZIO_COMPRESS_GZIP_9 }, { "zle", ZIO_COMPRESS_ZLE }, + { "lz4", ZIO_COMPRESS_LZ4 }, { NULL } }; @@ -211,8 +213,8 @@ zfs_prop_init(void) zprop_register_index(ZFS_PROP_COMPRESSION, "compression", ZIO_COMPRESS_DEFAULT, PROP_INHERIT, ZFS_TYPE_FILESYSTEM | ZFS_TYPE_VOLUME, - "on | off | lzjb | gzip | gzip-[1-9] | zle", "COMPRESS", - compress_table); + "on | off | lzjb | gzip | gzip-[1-9] | zle | lz4", + "COMPRESS", compress_table); zprop_register_index(ZFS_PROP_SNAPDIR, "snapdir", ZFS_SNAPDIR_HIDDEN, PROP_INHERIT, ZFS_TYPE_FILESYSTEM, "hidden | visible", "SNAPDIR", snapdir_table); Modified: head/sys/cddl/contrib/opensolaris/uts/common/Makefile.files ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/Makefile.files Sat Feb 9 06:31:22 2013 (r246585) +++ head/sys/cddl/contrib/opensolaris/uts/common/Makefile.files Sat Feb 9 06:39:28 2013 (r246586) @@ -22,6 +22,7 @@ # # Copyright (c) 1991, 2010, Oracle and/or its affiliates. All rights reserved. # Copyright (c) 2012 by Delphix. All rights reserved. +# Copyright (c) 2013 by Saso Kiselkov. All rights reserved. # # # This Makefile defines all file modules for the directory uts/common @@ -56,6 +57,7 @@ ZFS_COMMON_OBJS += \ dsl_scan.o \ zfeature.o \ gzip.o \ + lz4.o \ lzjb.o \ metaslab.o \ refcount.o \ Copied: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/THIRDPARTYLICENSE.lz4 (from r245512, vendor-sys/illumos/dist/uts/common/fs/zfs/THIRDPARTYLICENSE.lz4) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/THIRDPARTYLICENSE.lz4 Sat Feb 9 06:39:28 2013 (r246586, copy of r245512, vendor-sys/illumos/dist/uts/common/fs/zfs/THIRDPARTYLICENSE.lz4) @@ -0,0 +1,30 @@ +LZ4 - Fast LZ compression algorithm +Copyright (C) 2011-2013, Yann Collet. +BSD 2-Clause License (http://www.opensource.org/licenses/bsd-license.php) + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS +IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED +TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A +PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER +OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +You can contact the author at : +- LZ4 homepage : http://fastcompression.blogspot.com/p/lz4.html +- LZ4 source repository : http://code.google.com/p/lz4/ Copied: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/THIRDPARTYLICENSE.lz4.descrip (from r245512, vendor-sys/illumos/dist/uts/common/fs/zfs/THIRDPARTYLICENSE.lz4.descrip) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/THIRDPARTYLICENSE.lz4.descrip Sat Feb 9 06:39:28 2013 (r246586, copy of r245512, vendor-sys/illumos/dist/uts/common/fs/zfs/THIRDPARTYLICENSE.lz4.descrip) @@ -0,0 +1 @@ +LZ4 COMPRESSION FUNCTIONALITY IN ZFS Copied and modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/lz4.c (from r245512, vendor-sys/illumos/dist/uts/common/fs/zfs/lz4.c) ============================================================================== --- vendor-sys/illumos/dist/uts/common/fs/zfs/lz4.c Wed Jan 16 23:11:13 2013 (r245512, copy source) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/lz4.c Sat Feb 9 06:39:28 2013 (r246586) @@ -201,7 +201,8 @@ lz4_decompress(void *s_start, void *d_st * Illumos: On amd64 we have 20k of stack and 24k on sun4u and sun4v, so we * can spend 16k on the algorithm */ -#define STACKLIMIT 12 +/* FreeBSD: Use heap for all platforms for now */ +#define STACKLIMIT 0 #else #define LZ4_ARCH64 0 /* @@ -209,18 +210,14 @@ lz4_decompress(void *s_start, void *d_st * same COMPRESSIONLEVEL we have to use heap allocation. Performance will * suck, but alas, it's ZFS on 32-bit we're talking about, so... */ -#define STACKLIMIT 11 +#define STACKLIMIT 0 #endif /* * Little Endian or Big Endian? * Note: overwrite the below #define if you know your architecture endianess. */ -#if (defined(__BIG_ENDIAN__) || defined(__BIG_ENDIAN) || \ - defined(_BIG_ENDIAN) || defined(_ARCH_PPC) || defined(__PPC__) || \ - defined(__PPC) || defined(PPC) || defined(__powerpc__) || \ - defined(__powerpc) || defined(powerpc) || \ - ((defined(__BYTE_ORDER__)&&(__BYTE_ORDER__ == __ORDER_BIG_ENDIAN__)))) +#if BYTE_ORDER == BIG_ENDIAN #define LZ4_BIG_ENDIAN 1 #else /* @@ -241,12 +238,6 @@ lz4_decompress(void *s_start, void *d_st #endif /* - * Illumos: we can't use GCC's __builtin_ctz family of builtins in the - * kernel - */ -#define LZ4_FORCE_SW_BITCOUNT - -/* * Compiler Options */ #if __STDC_VERSION__ >= 199901L /* C99 */ @@ -256,54 +247,27 @@ lz4_decompress(void *s_start, void *d_st #define restrict #endif -#define GCC_VERSION (__GNUC__ * 100 + __GNUC_MINOR__) - -#ifdef _MSC_VER -/* Visual Studio */ -/* Visual is not C99, but supports some kind of inline */ -#define inline __forceinline -#if LZ4_ARCH64 -/* For Visual 2005 */ -#pragma intrinsic(_BitScanForward64) -#pragma intrinsic(_BitScanReverse64) -#else /* !LZ4_ARCH64 */ -/* For Visual 2005 */ -#pragma intrinsic(_BitScanForward) -#pragma intrinsic(_BitScanReverse) -#endif /* !LZ4_ARCH64 */ -#endif /* _MSC_VER */ - -#ifdef _MSC_VER -#define lz4_bswap16(x) _byteswap_ushort(x) -#else /* !_MSC_VER */ #define lz4_bswap16(x) ((unsigned short int) ((((x) >> 8) & 0xffu) | \ (((x) & 0xffu) << 8))) -#endif /* !_MSC_VER */ -#if (GCC_VERSION >= 302) || (__INTEL_COMPILER >= 800) || defined(__clang__) #define expect(expr, value) (__builtin_expect((expr), (value))) -#else -#define expect(expr, value) (expr) + +#if defined(likely) +#undef likely +#endif +#if defined(unlikely) +#undef unlikely #endif #define likely(expr) expect((expr) != 0, 1) #define unlikely(expr) expect((expr) != 0, 0) /* Basic types */ -#if defined(_MSC_VER) -/* Visual Studio does not support 'stdint' natively */ -#define BYTE unsigned __int8 -#define U16 unsigned __int16 -#define U32 unsigned __int32 -#define S32 __int32 -#define U64 unsigned __int64 -#else /* !defined(_MSC_VER) */ #define BYTE uint8_t #define U16 uint16_t #define U32 uint32_t #define S32 int32_t #define U64 uint64_t -#endif /* !defined(_MSC_VER) */ #ifndef LZ4_FORCE_UNALIGNED_ACCESS #pragma pack(1) @@ -414,48 +378,9 @@ static inline int LZ4_NbCommonBytes(register U64 val) { #if defined(LZ4_BIG_ENDIAN) -#if defined(_MSC_VER) && !defined(LZ4_FORCE_SW_BITCOUNT) - unsigned long r = 0; - _BitScanReverse64(&r, val); - return (int)(r >> 3); -#elif defined(__GNUC__) && (GCC_VERSION >= 304) && \ - !defined(LZ4_FORCE_SW_BITCOUNT) return (__builtin_clzll(val) >> 3); #else - int r; - if (!(val >> 32)) { - r = 4; - } else { - r = 0; - val >>= 32; - } - if (!(val >> 16)) { - r += 2; - val >>= 8; - } else { - val >>= 24; - } - r += (!val); - return (r); -#endif -#else -#if defined(_MSC_VER) && !defined(LZ4_FORCE_SW_BITCOUNT) - unsigned long r = 0; - _BitScanForward64(&r, val); - return (int)(r >> 3); -#elif defined(__GNUC__) && (GCC_VERSION >= 304) && \ - !defined(LZ4_FORCE_SW_BITCOUNT) return (__builtin_ctzll(val) >> 3); -#else - static const int DeBruijnBytePos[64] = - { 0, 0, 0, 0, 0, 1, 1, 2, 0, 3, 1, 3, 1, 4, 2, 7, 0, 2, 3, 6, 1, 5, - 3, 5, 1, 3, 4, 4, 2, 5, 6, 7, 7, 0, 1, 2, 3, 3, 4, 6, 2, 6, 5, - 5, 3, 4, 5, 6, 7, 1, 2, 4, 6, 4, - 4, 5, 7, 2, 6, 5, 7, 6, 7, 7 - }; - return DeBruijnBytePos[((U64) ((val & -val) * 0x0218A392CDABBD3F)) >> - 58]; -#endif #endif } @@ -465,43 +390,9 @@ static inline int LZ4_NbCommonBytes(register U32 val) { #if defined(LZ4_BIG_ENDIAN) -#if defined(_MSC_VER) && !defined(LZ4_FORCE_SW_BITCOUNT) - unsigned long r = 0; - _BitScanReverse(&r, val); - return (int)(r >> 3); -#elif defined(__GNUC__) && (GCC_VERSION >= 304) && \ - !defined(LZ4_FORCE_SW_BITCOUNT) return (__builtin_clz(val) >> 3); #else - int r; - if (!(val >> 16)) { - r = 2; - val >>= 8; - } else { - r = 0; - val >>= 24; - } - r += (!val); - return (r); -#endif -#else -#if defined(_MSC_VER) && !defined(LZ4_FORCE_SW_BITCOUNT) - unsigned long r = 0; - _BitScanForward(&r, val); - return (int)(r >> 3); -#elif defined(__GNUC__) && (GCC_VERSION >= 304) && \ - !defined(LZ4_FORCE_SW_BITCOUNT) return (__builtin_ctz(val) >> 3); -#else - static const int DeBruijnBytePos[32] = { - 0, 0, 3, 0, 3, 1, 3, 0, - 3, 2, 2, 1, 3, 2, 0, 1, - 3, 3, 1, 2, 2, 2, 2, 0, - 3, 1, 2, 0, 1, 0, 1, 1 - }; - return DeBruijnBytePos[((U32) ((val & -(S32) val) * 0x077CB531U)) >> - 27]; -#endif #endif } Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zio.h ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zio.h Sat Feb 9 06:31:22 2013 (r246585) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zio.h Sat Feb 9 06:39:28 2013 (r246586) @@ -22,6 +22,7 @@ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2012 by Delphix. All rights reserved. + * Copyright (c) 2013 by Saso Kiselkov. All rights reserved. */ #ifndef _ZIO_H @@ -106,14 +107,17 @@ enum zio_compress { ZIO_COMPRESS_GZIP_8, ZIO_COMPRESS_GZIP_9, ZIO_COMPRESS_ZLE, + ZIO_COMPRESS_LZ4, ZIO_COMPRESS_FUNCTIONS }; +/* N.B. when altering this value, also change BOOTFS_COMPRESS_VALID below */ #define ZIO_COMPRESS_ON_VALUE ZIO_COMPRESS_LZJB #define ZIO_COMPRESS_DEFAULT ZIO_COMPRESS_OFF #define BOOTFS_COMPRESS_VALID(compress) \ ((compress) == ZIO_COMPRESS_LZJB || \ + (compress) == ZIO_COMPRESS_LZ4 || \ ((compress) == ZIO_COMPRESS_ON && \ ZIO_COMPRESS_ON_VALUE == ZIO_COMPRESS_LZJB) || \ (compress) == ZIO_COMPRESS_OFF) Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zio_compress.h ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zio_compress.h Sat Feb 9 06:31:22 2013 (r246585) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zio_compress.h Sat Feb 9 06:39:28 2013 (r246586) @@ -23,6 +23,9 @@ * Copyright 2009 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ +/* + * Copyright (c) 2013 by Saso Kiselkov. All rights reserved. + */ #ifndef _SYS_ZIO_COMPRESS_H #define _SYS_ZIO_COMPRESS_H @@ -68,6 +71,10 @@ extern size_t zle_compress(void *src, vo int level); extern int zle_decompress(void *src, void *dst, size_t s_len, size_t d_len, int level); +extern size_t lz4_compress(void *src, void *dst, size_t s_len, size_t d_len, + int level); +extern int lz4_decompress(void *src, void *dst, size_t s_len, size_t d_len, + int level); /* * Compress and decompress data if necessary. Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c Sat Feb 9 06:31:22 2013 (r246585) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c Sat Feb 9 06:39:28 2013 (r246586) @@ -27,6 +27,7 @@ * Copyright 2011 Nexenta Systems, Inc. All rights reserved. * Copyright (c) 2012 by Delphix. All rights reserved. * Copyright (c) 2012, Joyent, Inc. All rights reserved. + * Copyright (c) 2013 by Saso Kiselkov. All rights reserved. */ #include @@ -75,6 +76,7 @@ #include #include #include +#include #include "zfs_namecheck.h" #include "zfs_prop.h" @@ -131,6 +133,12 @@ int zfs_set_prop_nvlist(const char *, zp static void zfsdev_close(void *data); +static int zfs_prop_activate_feature(dsl_pool_t *dp, zfeature_info_t *feature); +static int zfs_prop_activate_feature_check(void *arg1, void *arg2, + dmu_tx_t *tx); +static void zfs_prop_activate_feature_sync(void *arg1, void *arg2, + dmu_tx_t *tx); + /* _NOTE(PRINTFLIKE(4)) - this is printf-like, but lint is too whiney */ void __dprintf(const char *file, const char *func, int line, const char *fmt, ...) @@ -2264,6 +2272,40 @@ zfs_prop_set_special(const char *dsname, } break; } + case ZFS_PROP_COMPRESSION: + { + if (intval == ZIO_COMPRESS_LZ4) { + zfeature_info_t *feature = + &spa_feature_table[SPA_FEATURE_LZ4_COMPRESS]; + spa_t *spa; + dsl_pool_t *dp; + + if ((err = spa_open(dsname, &spa, FTAG)) != 0) + return (err); + + dp = spa->spa_dsl_pool; + + /* + * Setting the LZ4 compression algorithm activates + * the feature. + */ + if (!spa_feature_is_active(spa, feature)) { + if ((err = zfs_prop_activate_feature(dp, + feature)) != 0) { + spa_close(spa, FTAG); + return (err); + } + } + + spa_close(spa, FTAG); + } + /* + * We still want the default set action to be performed in the + * caller, we only performed zfeature settings here. + */ + err = -1; + break; + } default: err = -1; @@ -3481,6 +3523,22 @@ zfs_check_settable(const char *dsname, n SPA_VERSION_ZLE_COMPRESSION)) return (ENOTSUP); + if (intval == ZIO_COMPRESS_LZ4) { + zfeature_info_t *feature = + &spa_feature_table[ + SPA_FEATURE_LZ4_COMPRESS]; + spa_t *spa; + + if ((err = spa_open(dsname, &spa, FTAG)) != 0) + return (err); + + if (!spa_feature_is_enabled(spa, feature)) { + spa_close(spa, FTAG); + return (ENOTSUP); + } + spa_close(spa, FTAG); + } + /* * If this is a bootable dataset then * verify that the compression algorithm @@ -3525,6 +3583,56 @@ zfs_check_settable(const char *dsname, n } /* + * Activates a feature on a pool in response to a property setting. This + * creates a new sync task which modifies the pool to reflect the feature + * as being active. + */ +static int +zfs_prop_activate_feature(dsl_pool_t *dp, zfeature_info_t *feature) +{ + int err; + + /* EBUSY here indicates that the feature is already active */ + err = dsl_sync_task_do(dp, zfs_prop_activate_feature_check, + zfs_prop_activate_feature_sync, dp->dp_spa, feature, 2); + + if (err != 0 && err != EBUSY) + return (err); + else + return (0); +} + +/* + * Checks for a race condition to make sure we don't increment a feature flag + * multiple times. + */ +/*ARGSUSED*/ +static int +zfs_prop_activate_feature_check(void *arg1, void *arg2, dmu_tx_t *tx) +{ + spa_t *spa = arg1; + zfeature_info_t *feature = arg2; + + if (!spa_feature_is_active(spa, feature)) + return (0); + else + return (EBUSY); *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@FreeBSD.ORG Sat Feb 9 07:01:06 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 62826919; Sat, 9 Feb 2013 07:01:06 +0000 (UTC) (envelope-from joel@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 539B9B6C; Sat, 9 Feb 2013 07:01:06 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r197166a021683; Sat, 9 Feb 2013 07:01:06 GMT (envelope-from joel@svn.freebsd.org) Received: (from joel@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r19716dY021681; Sat, 9 Feb 2013 07:01:06 GMT (envelope-from joel@svn.freebsd.org) Message-Id: <201302090701.r19716dY021681@svn.freebsd.org> From: Joel Dahl Date: Sat, 9 Feb 2013 07:01:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r246587 - in head: cddl/contrib/opensolaris/cmd/zpool lib/libc/stdio X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 09 Feb 2013 07:01:06 -0000 Author: joel (doc committer) Date: Sat Feb 9 07:01:05 2013 New Revision: 246587 URL: http://svnweb.freebsd.org/changeset/base/246587 Log: mdoc: Remove EOL whitespace. Modified: head/cddl/contrib/opensolaris/cmd/zpool/zpool-features.7 head/lib/libc/stdio/fopen.3 Modified: head/cddl/contrib/opensolaris/cmd/zpool/zpool-features.7 ============================================================================== --- head/cddl/contrib/opensolaris/cmd/zpool/zpool-features.7 Sat Feb 9 06:39:28 2013 (r246586) +++ head/cddl/contrib/opensolaris/cmd/zpool/zpool-features.7 Sat Feb 9 07:01:05 2013 (r246587) @@ -199,7 +199,7 @@ features significantly faster compressio higher compression ratio than the older .Sy lzjb compression. -Typically, +Typically, .Sy lz4 compression is approximately 50% faster on compressible data and 200% faster on incompressible data than @@ -207,12 +207,12 @@ compressible data and 200% faster on inc It is also approximately 80% faster on decompression, while giving approximately 10% better compression ratio. .Pp -When the +When the .Sy lz4_compress feature is set to .Sy enabled , the -administrator can turn on +administrator can turn on .Sy lz4 compression on any dataset on the pool using the Modified: head/lib/libc/stdio/fopen.3 ============================================================================== --- head/lib/libc/stdio/fopen.3 Sat Feb 9 06:39:28 2013 (r246586) +++ head/lib/libc/stdio/fopen.3 Sat Feb 9 07:01:05 2013 (r246587) @@ -332,7 +332,7 @@ but is also supported by glibc. The .Fn fmemopen function -conforms to +conforms to .St -p1003.1-2008 . The ``b'' mode does not conform to any standard but is also supported by glibc. From owner-svn-src-head@FreeBSD.ORG Sat Feb 9 08:27:10 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 4C5FE575; Sat, 9 Feb 2013 08:27:10 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 269A1E37; Sat, 9 Feb 2013 08:27:10 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r198R9b3046186; Sat, 9 Feb 2013 08:27:09 GMT (envelope-from tuexen@svn.freebsd.org) Received: (from tuexen@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r198R8Xg046180; Sat, 9 Feb 2013 08:27:08 GMT (envelope-from tuexen@svn.freebsd.org) Message-Id: <201302090827.r198R8Xg046180@svn.freebsd.org> From: Michael Tuexen Date: Sat, 9 Feb 2013 08:27:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r246588 - head/sys/netinet X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 09 Feb 2013 08:27:10 -0000 Author: tuexen Date: Sat Feb 9 08:27:08 2013 New Revision: 246588 URL: http://svnweb.freebsd.org/changeset/base/246588 Log: Fix a bug where HEARTBEATs were still sent in SHUTDOWN_SENT or SHUTDOWN_ACK_SENT state. While there, make the corresponding code consistent. MFC after: 1 week Modified: head/sys/netinet/sctp_indata.c head/sys/netinet/sctp_input.c head/sys/netinet/sctp_output.c head/sys/netinet/sctp_pcb.c head/sys/netinet/sctp_timer.c head/sys/netinet/sctp_usrreq.c Modified: head/sys/netinet/sctp_indata.c ============================================================================== --- head/sys/netinet/sctp_indata.c Sat Feb 9 07:01:05 2013 (r246587) +++ head/sys/netinet/sctp_indata.c Sat Feb 9 08:27:08 2013 (r246588) @@ -4262,19 +4262,19 @@ again: (asoc->stream_queue_cnt == 0)) { struct sctp_nets *netp; - if (asoc->alternate) { - netp = asoc->alternate; - } else { - netp = asoc->primary_destination; - } if (asoc->state & SCTP_STATE_PARTIAL_MSG_LEFT) { goto abort_out_now; } SCTP_STAT_DECR_GAUGE32(sctps_currestab); SCTP_SET_STATE(asoc, SCTP_STATE_SHUTDOWN_ACK_SENT); SCTP_CLEAR_SUBSTATE(asoc, SCTP_STATE_SHUTDOWN_PENDING); - sctp_send_shutdown_ack(stcb, netp); sctp_stop_timers_for_shutdown(stcb); + if (asoc->alternate) { + netp = asoc->alternate; + } else { + netp = asoc->primary_destination; + } + sctp_send_shutdown_ack(stcb, netp); sctp_timer_start(SCTP_TIMER_TYPE_SHUTDOWNACK, stcb->sctp_ep, stcb, netp); } @@ -4973,11 +4973,6 @@ sctp_handle_sack(struct mbuf *m, int off } else { struct sctp_nets *netp; - if (asoc->alternate) { - netp = asoc->alternate; - } else { - netp = asoc->primary_destination; - } if ((SCTP_GET_STATE(asoc) == SCTP_STATE_OPEN) || (SCTP_GET_STATE(asoc) == SCTP_STATE_SHUTDOWN_RECEIVED)) { SCTP_STAT_DECR_GAUGE32(sctps_currestab); @@ -4985,6 +4980,11 @@ sctp_handle_sack(struct mbuf *m, int off SCTP_SET_STATE(asoc, SCTP_STATE_SHUTDOWN_SENT); SCTP_CLEAR_SUBSTATE(asoc, SCTP_STATE_SHUTDOWN_PENDING); sctp_stop_timers_for_shutdown(stcb); + if (asoc->alternate) { + netp = asoc->alternate; + } else { + netp = asoc->primary_destination; + } sctp_send_shutdown(stcb, netp); sctp_timer_start(SCTP_TIMER_TYPE_SHUTDOWN, stcb->sctp_ep, stcb, netp); @@ -4996,19 +4996,19 @@ sctp_handle_sack(struct mbuf *m, int off (asoc->stream_queue_cnt == 0)) { struct sctp_nets *netp; - if (asoc->alternate) { - netp = asoc->alternate; - } else { - netp = asoc->primary_destination; - } if (asoc->state & SCTP_STATE_PARTIAL_MSG_LEFT) { goto abort_out_now; } SCTP_STAT_DECR_GAUGE32(sctps_currestab); SCTP_SET_STATE(asoc, SCTP_STATE_SHUTDOWN_ACK_SENT); SCTP_CLEAR_SUBSTATE(asoc, SCTP_STATE_SHUTDOWN_PENDING); - sctp_send_shutdown_ack(stcb, netp); sctp_stop_timers_for_shutdown(stcb); + if (asoc->alternate) { + netp = asoc->alternate; + } else { + netp = asoc->primary_destination; + } + sctp_send_shutdown_ack(stcb, netp); sctp_timer_start(SCTP_TIMER_TYPE_SHUTDOWNACK, stcb->sctp_ep, stcb, netp); return; Modified: head/sys/netinet/sctp_input.c ============================================================================== --- head/sys/netinet/sctp_input.c Sat Feb 9 07:01:05 2013 (r246587) +++ head/sys/netinet/sctp_input.c Sat Feb 9 08:27:08 2013 (r246588) @@ -956,7 +956,6 @@ sctp_handle_shutdown(struct sctp_shutdow } else { /* no outstanding data to send, so move on... */ /* send SHUTDOWN-ACK */ - sctp_send_shutdown_ack(stcb, net); /* move to SHUTDOWN-ACK-SENT state */ if ((SCTP_GET_STATE(asoc) == SCTP_STATE_OPEN) || (SCTP_GET_STATE(asoc) == SCTP_STATE_SHUTDOWN_RECEIVED)) { @@ -965,6 +964,7 @@ sctp_handle_shutdown(struct sctp_shutdow SCTP_SET_STATE(asoc, SCTP_STATE_SHUTDOWN_ACK_SENT); SCTP_CLEAR_SUBSTATE(asoc, SCTP_STATE_SHUTDOWN_PENDING); sctp_stop_timers_for_shutdown(stcb); + sctp_send_shutdown_ack(stcb, net); sctp_timer_start(SCTP_TIMER_TYPE_SHUTDOWNACK, stcb->sctp_ep, stcb, net); } Modified: head/sys/netinet/sctp_output.c ============================================================================== --- head/sys/netinet/sctp_output.c Sat Feb 9 07:01:05 2013 (r246587) +++ head/sys/netinet/sctp_output.c Sat Feb 9 08:27:08 2013 (r246588) @@ -6574,12 +6574,13 @@ sctp_sendall_iterator(struct sctp_inpcb * only send SHUTDOWN the first time * through */ - sctp_send_shutdown(stcb, net); if (SCTP_GET_STATE(asoc) == SCTP_STATE_OPEN) { SCTP_STAT_DECR_GAUGE32(sctps_currestab); } SCTP_SET_STATE(asoc, SCTP_STATE_SHUTDOWN_SENT); SCTP_CLEAR_SUBSTATE(asoc, SCTP_STATE_SHUTDOWN_PENDING); + sctp_stop_timers_for_shutdown(stcb); + sctp_send_shutdown(stcb, net); sctp_timer_start(SCTP_TIMER_TYPE_SHUTDOWN, stcb->sctp_ep, stcb, net); sctp_timer_start(SCTP_TIMER_TYPE_SHUTDOWNGUARD, stcb->sctp_ep, stcb, @@ -13092,18 +13093,19 @@ dataless_eof: (SCTP_GET_STATE(asoc) != SCTP_STATE_SHUTDOWN_ACK_SENT)) { struct sctp_nets *netp; - if (stcb->asoc.alternate) { - netp = stcb->asoc.alternate; - } else { - netp = stcb->asoc.primary_destination; - } /* only send SHUTDOWN the first time through */ - sctp_send_shutdown(stcb, netp); if (SCTP_GET_STATE(asoc) == SCTP_STATE_OPEN) { SCTP_STAT_DECR_GAUGE32(sctps_currestab); } SCTP_SET_STATE(asoc, SCTP_STATE_SHUTDOWN_SENT); SCTP_CLEAR_SUBSTATE(asoc, SCTP_STATE_SHUTDOWN_PENDING); + sctp_stop_timers_for_shutdown(stcb); + if (stcb->asoc.alternate) { + netp = stcb->asoc.alternate; + } else { + netp = stcb->asoc.primary_destination; + } + sctp_send_shutdown(stcb, netp); sctp_timer_start(SCTP_TIMER_TYPE_SHUTDOWN, stcb->sctp_ep, stcb, netp); sctp_timer_start(SCTP_TIMER_TYPE_SHUTDOWNGUARD, stcb->sctp_ep, stcb, Modified: head/sys/netinet/sctp_pcb.c ============================================================================== --- head/sys/netinet/sctp_pcb.c Sat Feb 9 07:01:05 2013 (r246587) +++ head/sys/netinet/sctp_pcb.c Sat Feb 9 08:27:08 2013 (r246588) @@ -3332,22 +3332,23 @@ sctp_inpcb_free(struct sctp_inpcb *inp, (SCTP_GET_STATE(&asoc->asoc) != SCTP_STATE_SHUTDOWN_ACK_SENT)) { struct sctp_nets *netp; - if (asoc->asoc.alternate) { - netp = asoc->asoc.alternate; - } else { - netp = asoc->asoc.primary_destination; - } /* * there is nothing queued to send, * so I send shutdown */ - sctp_send_shutdown(asoc, netp); if ((SCTP_GET_STATE(&asoc->asoc) == SCTP_STATE_OPEN) || (SCTP_GET_STATE(&asoc->asoc) == SCTP_STATE_SHUTDOWN_RECEIVED)) { SCTP_STAT_DECR_GAUGE32(sctps_currestab); } SCTP_SET_STATE(&asoc->asoc, SCTP_STATE_SHUTDOWN_SENT); SCTP_CLEAR_SUBSTATE(&asoc->asoc, SCTP_STATE_SHUTDOWN_PENDING); + sctp_stop_timers_for_shutdown(asoc); + if (asoc->asoc.alternate) { + netp = asoc->asoc.alternate; + } else { + netp = asoc->asoc.primary_destination; + } + sctp_send_shutdown(asoc, netp); sctp_timer_start(SCTP_TIMER_TYPE_SHUTDOWN, asoc->sctp_ep, asoc, netp); sctp_timer_start(SCTP_TIMER_TYPE_SHUTDOWNGUARD, asoc->sctp_ep, asoc, Modified: head/sys/netinet/sctp_timer.c ============================================================================== --- head/sys/netinet/sctp_timer.c Sat Feb 9 07:01:05 2013 (r246587) +++ head/sys/netinet/sctp_timer.c Sat Feb 9 08:27:08 2013 (r246588) @@ -1560,18 +1560,19 @@ sctp_autoclose_timer(struct sctp_inpcb * /* only send SHUTDOWN 1st time thru */ struct sctp_nets *netp; - if (stcb->asoc.alternate) { - netp = stcb->asoc.alternate; - } else { - netp = stcb->asoc.primary_destination; - } - sctp_send_shutdown(stcb, netp); if ((SCTP_GET_STATE(asoc) == SCTP_STATE_OPEN) || (SCTP_GET_STATE(asoc) == SCTP_STATE_SHUTDOWN_RECEIVED)) { SCTP_STAT_DECR_GAUGE32(sctps_currestab); } SCTP_SET_STATE(asoc, SCTP_STATE_SHUTDOWN_SENT); SCTP_CLEAR_SUBSTATE(asoc, SCTP_STATE_SHUTDOWN_PENDING); + sctp_stop_timers_for_shutdown(stcb); + if (stcb->asoc.alternate) { + netp = stcb->asoc.alternate; + } else { + netp = stcb->asoc.primary_destination; + } + sctp_send_shutdown(stcb, netp); sctp_timer_start(SCTP_TIMER_TYPE_SHUTDOWN, stcb->sctp_ep, stcb, netp); Modified: head/sys/netinet/sctp_usrreq.c ============================================================================== --- head/sys/netinet/sctp_usrreq.c Sat Feb 9 07:01:05 2013 (r246587) +++ head/sys/netinet/sctp_usrreq.c Sat Feb 9 08:27:08 2013 (r246588) @@ -794,25 +794,24 @@ sctp_disconnect(struct socket *so) /* only send SHUTDOWN 1st time thru */ struct sctp_nets *netp; - if (stcb->asoc.alternate) { - netp = stcb->asoc.alternate; - } else { - netp = stcb->asoc.primary_destination; - } - sctp_stop_timers_for_shutdown(stcb); - sctp_send_shutdown(stcb, netp); - sctp_chunk_output(stcb->sctp_ep, stcb, SCTP_OUTPUT_FROM_T3, SCTP_SO_LOCKED); if ((SCTP_GET_STATE(asoc) == SCTP_STATE_OPEN) || (SCTP_GET_STATE(asoc) == SCTP_STATE_SHUTDOWN_RECEIVED)) { SCTP_STAT_DECR_GAUGE32(sctps_currestab); } SCTP_SET_STATE(asoc, SCTP_STATE_SHUTDOWN_SENT); SCTP_CLEAR_SUBSTATE(asoc, SCTP_STATE_SHUTDOWN_PENDING); + sctp_stop_timers_for_shutdown(stcb); + if (stcb->asoc.alternate) { + netp = stcb->asoc.alternate; + } else { + netp = stcb->asoc.primary_destination; + } + sctp_send_shutdown(stcb, netp); sctp_timer_start(SCTP_TIMER_TYPE_SHUTDOWN, stcb->sctp_ep, stcb, netp); sctp_timer_start(SCTP_TIMER_TYPE_SHUTDOWNGUARD, stcb->sctp_ep, stcb, netp); - + sctp_chunk_output(stcb->sctp_ep, stcb, SCTP_OUTPUT_FROM_T3, SCTP_SO_LOCKED); } } else { /* @@ -1014,24 +1013,24 @@ sctp_shutdown(struct socket *so) /* only send SHUTDOWN the first time through */ struct sctp_nets *netp; - if (stcb->asoc.alternate) { - netp = stcb->asoc.alternate; - } else { - netp = stcb->asoc.primary_destination; - } - sctp_stop_timers_for_shutdown(stcb); - sctp_send_shutdown(stcb, netp); - sctp_chunk_output(stcb->sctp_ep, stcb, SCTP_OUTPUT_FROM_T3, SCTP_SO_LOCKED); if ((SCTP_GET_STATE(asoc) == SCTP_STATE_OPEN) || (SCTP_GET_STATE(asoc) == SCTP_STATE_SHUTDOWN_RECEIVED)) { SCTP_STAT_DECR_GAUGE32(sctps_currestab); } SCTP_SET_STATE(asoc, SCTP_STATE_SHUTDOWN_SENT); SCTP_CLEAR_SUBSTATE(asoc, SCTP_STATE_SHUTDOWN_PENDING); + sctp_stop_timers_for_shutdown(stcb); + if (stcb->asoc.alternate) { + netp = stcb->asoc.alternate; + } else { + netp = stcb->asoc.primary_destination; + } + sctp_send_shutdown(stcb, netp); sctp_timer_start(SCTP_TIMER_TYPE_SHUTDOWN, stcb->sctp_ep, stcb, netp); sctp_timer_start(SCTP_TIMER_TYPE_SHUTDOWNGUARD, stcb->sctp_ep, stcb, netp); + sctp_chunk_output(stcb->sctp_ep, stcb, SCTP_OUTPUT_FROM_T3, SCTP_SO_LOCKED); } } else { /* From owner-svn-src-head@FreeBSD.ORG Sat Feb 9 13:28:50 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 7B428E16; Sat, 9 Feb 2013 13:28:50 +0000 (UTC) (envelope-from antoine@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 6E33CA40; Sat, 9 Feb 2013 13:28:50 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r19DSohW036211; Sat, 9 Feb 2013 13:28:50 GMT (envelope-from antoine@svn.freebsd.org) Received: (from antoine@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r19DSoR3036210; Sat, 9 Feb 2013 13:28:50 GMT (envelope-from antoine@svn.freebsd.org) Message-Id: <201302091328.r19DSoR3036210@svn.freebsd.org> From: Antoine Brodin Date: Sat, 9 Feb 2013 13:28:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r246591 - head X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 09 Feb 2013 13:28:50 -0000 Author: antoine Date: Sat Feb 9 13:28:49 2013 New Revision: 246591 URL: http://svnweb.freebsd.org/changeset/base/246591 Log: Add more obsolete files. Modified: head/ObsoleteFiles.inc Modified: head/ObsoleteFiles.inc ============================================================================== --- head/ObsoleteFiles.inc Sat Feb 9 10:49:31 2013 (r246590) +++ head/ObsoleteFiles.inc Sat Feb 9 13:28:49 2013 (r246591) @@ -45,6 +45,10 @@ OLD_DIRS+=usr/share/man/man1aout OLD_DIRS+=usr/share/man/cat1aout OLD_DIRS+=usr/share/man/en.ISO8859-1/cat1aout OLD_DIRS+=usr/share/man/en.UTF-8/cat1aout +# 20130110: bsd.compat.mk removed +OLD_FILES+=usr/share/mk/bsd.compat.mk +# 20130103: gnats-supfile removed +OLD_FILES+=usr/share/examples/cvsup/gnats-supfile # 20121230: libdisk removed OLD_FILES+=usr/share/man/man3/libdisk.3.gz usr/include/libdisk.h OLD_FILES+=usr/lib/libdisk.a usr/lib32/libdisk.a From owner-svn-src-head@FreeBSD.ORG Sat Feb 9 13:31:59 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id C9BD5FA7; Sat, 9 Feb 2013 13:31:59 +0000 (UTC) (envelope-from antoine@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id BC165A57; Sat, 9 Feb 2013 13:31:59 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r19DVxwM038261; Sat, 9 Feb 2013 13:31:59 GMT (envelope-from antoine@svn.freebsd.org) Received: (from antoine@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r19DVx8e038260; Sat, 9 Feb 2013 13:31:59 GMT (envelope-from antoine@svn.freebsd.org) Message-Id: <201302091331.r19DVx8e038260@svn.freebsd.org> From: Antoine Brodin Date: Sat, 9 Feb 2013 13:31:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r246592 - head/usr.bin/ee X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 09 Feb 2013 13:31:59 -0000 Author: antoine Date: Sat Feb 9 13:31:59 2013 New Revision: 246592 URL: http://svnweb.freebsd.org/changeset/base/246592 Log: Fix some NLS catalogs broken after r245888. Modified: head/usr.bin/ee/Makefile Modified: head/usr.bin/ee/Makefile ============================================================================== --- head/usr.bin/ee/Makefile Sat Feb 9 13:28:49 2013 (r246591) +++ head/usr.bin/ee/Makefile Sat Feb 9 13:31:59 2013 (r246592) @@ -16,7 +16,7 @@ WARNS?= 2 NLS= C fr_FR.ISO8859-1 de_DE.ISO8859-1 pl_PL.ISO8859-2 \ uk_UA.KOI8-U pt_BR.ISO8859-1 ru_RU.KOI8-R hu_HU.ISO8859-2 -NLSLINKS_en_US.US-ASCII= en_US.ISO8859-1 en_US.ISO8859-15 +NLSLINKS_C= en_US.ISO8859-1 en_US.ISO8859-15 NLSLINKS_fr_FR.ISO8859-1= fr_BE.ISO8859-1 fr_BE.ISO8859-15 \ fr_CA.ISO8859-1 fr_CA.ISO8859-15 fr_CH.ISO8859-1 fr_CH.ISO8859-15 \ fr_FR.ISO8859-15 From owner-svn-src-head@FreeBSD.ORG Sat Feb 9 17:13:52 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id A1862992; Sat, 9 Feb 2013 17:13:52 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 9405F378; Sat, 9 Feb 2013 17:13:52 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r19HDqiG006149; Sat, 9 Feb 2013 17:13:52 GMT (envelope-from eadler@svn.freebsd.org) Received: (from eadler@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r19HDqv6006148; Sat, 9 Feb 2013 17:13:52 GMT (envelope-from eadler@svn.freebsd.org) Message-Id: <201302091713.r19HDqv6006148@svn.freebsd.org> From: Eitan Adler Date: Sat, 9 Feb 2013 17:13:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r246593 - head/lib/libc/sys X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 09 Feb 2013 17:13:52 -0000 Author: eadler Date: Sat Feb 9 17:13:51 2013 New Revision: 246593 URL: http://svnweb.freebsd.org/changeset/base/246593 Log: Fix logic inversion. PR: docs/174966 Submitted by: Christian Ullrich Approved by: bcr (mentor) Modified: head/lib/libc/sys/chflags.2 Modified: head/lib/libc/sys/chflags.2 ============================================================================== --- head/lib/libc/sys/chflags.2 Sat Feb 9 13:31:59 2013 (r246592) +++ head/lib/libc/sys/chflags.2 Sat Feb 9 17:13:51 2013 (r246593) @@ -98,7 +98,7 @@ If one of or .Dv SF_NOUNLINK is set a non-super-user cannot change any flags and even the super-user -can change flags only if securelevel is greater than 0. +can change flags only if securelevel is 0. (See .Xr init 8 for details.) From owner-svn-src-head@FreeBSD.ORG Sat Feb 9 17:13:55 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 1770A993; Sat, 9 Feb 2013 17:13:55 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 0A105379; Sat, 9 Feb 2013 17:13:55 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r19HDsRN006187; Sat, 9 Feb 2013 17:13:54 GMT (envelope-from eadler@svn.freebsd.org) Received: (from eadler@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r19HDsMP006186; Sat, 9 Feb 2013 17:13:54 GMT (envelope-from eadler@svn.freebsd.org) Message-Id: <201302091713.r19HDsMP006186@svn.freebsd.org> From: Eitan Adler Date: Sat, 9 Feb 2013 17:13:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r246594 - head/usr.bin/csup X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 09 Feb 2013 17:13:55 -0000 Author: eadler Date: Sat Feb 9 17:13:54 2013 New Revision: 246594 URL: http://svnweb.freebsd.org/changeset/base/246594 Log: Reference something which exists instead of the non-existent runsocks program. PR: docs/173664 Submitted by: wkoszek Approved by: bcr (mentor) Modified: head/usr.bin/csup/csup.1 Modified: head/usr.bin/csup/csup.1 ============================================================================== --- head/usr.bin/csup/csup.1 Sat Feb 9 17:13:51 2013 (r246593) +++ head/usr.bin/csup/csup.1 Sat Feb 9 17:13:54 2013 (r246594) @@ -24,7 +24,7 @@ .\" $Id: cvsup.1,v 1.70 2003/03/04 18:23:46 jdp Exp $ .\" $FreeBSD$ .\" -.Dd February 1, 2006 +.Dd Feburary 8, 2013 .Dt CSUP 1 .Os FreeBSD .Sh NAME @@ -902,14 +902,14 @@ will work through any firewall which per port 5999 of the server host. .Sh USING csup WITH SOCKS .Nm -can be used through a SOCKS proxy server with the standard -.Nm runsocks +can be used through a SOCKS proxy server with the +.Nm tsocks command. -Your +The .Nm executable needs to be dynamically-linked with the system libraries for -.Nm runsocks +.Nm tsocks to work properly. .Sh USING ssh PORT FORWARDING As an alternative to SOCKS, a user behind a firewall can penetrate it From owner-svn-src-head@FreeBSD.ORG Sat Feb 9 17:20:37 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id C3AB5EA3 for ; Sat, 9 Feb 2013 17:20:37 +0000 (UTC) (envelope-from lists@eitanadler.com) Received: from mail-da0-f42.google.com (mail-da0-f42.google.com [209.85.210.42]) by mx1.freebsd.org (Postfix) with ESMTP id 46A5F3F2 for ; Sat, 9 Feb 2013 17:20:37 +0000 (UTC) Received: by mail-da0-f42.google.com with SMTP id z17so2235848dal.1 for ; Sat, 09 Feb 2013 09:20:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=eitanadler.com; s=0xdeadbeef; h=x-received:mime-version:sender:in-reply-to:references:from:date :x-google-sender-auth:message-id:subject:to:content-type; bh=4S6hkVpM9FXrVbNUoByJ79aWGusmA5JXAeEhRutfky8=; b=tN5AuiNRgl8cndOAUK+YeszLPGdVpyniYZ7w9bTP0ZBLzcK0iUGkPpzVqtxczGJFp8 DO8EUiT8a8SxMFdCV2kPv85jhj4tX5JYpE6OVR5cq1rHApFe+WifFxggp0j5eVVV9CwY AP8LGf41JOF5NM68CSjC7HrU9+63gcZt2jUnc= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:mime-version:sender:in-reply-to:references:from:date :x-google-sender-auth:message-id:subject:to:content-type :x-gm-message-state; bh=4S6hkVpM9FXrVbNUoByJ79aWGusmA5JXAeEhRutfky8=; b=iRbf6tVHeqYV4AKZbrR9gBTDG7KE0wkQIARsabrAgpzCeetgE89DauPMEPIyZLrK6R PGm588hm7eZjlCR1drtuaVVi+deLRG6QyA5NasObq/Z8PlATa0U+wnc9v8U1lRyQAlKI jBGMrOqHEGMwWUC5TzxTACwy1csA9v3S3/LEoVuO8xanLbhFpE2uIc8ld92ucdxbsIoY 2A8Gnx0eQwjjPsfvDIqxppKN1z+sYu87sD1Pr2dsXby5xLdcdOKGvCDAWNT27Nls+zLn NBQ2rrCB5h3W2jLG5e8H5fZAy5XAACmqfiG2akF+trArIT/dSM+SA0ntYMX5sQl5yNVF PjpA== X-Received: by 10.66.76.42 with SMTP id h10mr28254711paw.59.1360430431487; Sat, 09 Feb 2013 09:20:31 -0800 (PST) MIME-Version: 1.0 Sender: lists@eitanadler.com Received: by 10.66.148.10 with HTTP; Sat, 9 Feb 2013 09:20:00 -0800 (PST) In-Reply-To: <201302091713.r19HDqv6006148@svn.freebsd.org> References: <201302091713.r19HDqv6006148@svn.freebsd.org> From: Eitan Adler Date: Sat, 9 Feb 2013 12:20:00 -0500 X-Google-Sender-Auth: Noj758CFXtVzgdnSqwGFE0HIieM Message-ID: Subject: Re: svn commit: r246593 - head/lib/libc/sys To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset=UTF-8 X-Gm-Message-State: ALoCoQmfwnffyEf6FDVts/QchRuj+uk7pdGzHPaO1bOkJIONU5ILblwJGZefG3lTK/APfg3ailR1 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 09 Feb 2013 17:20:37 -0000 On 9 February 2013 12:13, Eitan Adler wrote: > Author: eadler > Date: Sat Feb 9 17:13:51 2013 > New Revision: 246593 > URL: http://svnweb.freebsd.org/changeset/base/246593 > > Log: > Fix logic inversion. > > PR: docs/174966 http://www.FreeBSD.org/cgi/query-pr.cgi?pr=174966 > Submitted by: Christian Ullrich > Approved by: bcr (mentor) > > Modified: > head/lib/libc/sys/chflags.2 > > Modified: head/lib/libc/sys/chflags.2 > ============================================================================== > --- head/lib/libc/sys/chflags.2 Sat Feb 9 13:31:59 2013 (r246592) > +++ head/lib/libc/sys/chflags.2 Sat Feb 9 17:13:51 2013 (r246593) > @@ -98,7 +98,7 @@ If one of > or > .Dv SF_NOUNLINK > is set a non-super-user cannot change any flags and even the super-user > -can change flags only if securelevel is greater than 0. > +can change flags only if securelevel is 0. I was reminded the default -1, not 0. I'll fix this shortly. -- Eitan Adler Source, Ports, Doc committer Bugmeister, Ports Security teams From owner-svn-src-head@FreeBSD.ORG Sat Feb 9 17:26:16 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id DD6E9ED; Sat, 9 Feb 2013 17:26:16 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id CF6E3636; Sat, 9 Feb 2013 17:26:16 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r19HQGrw009498; Sat, 9 Feb 2013 17:26:16 GMT (envelope-from tuexen@svn.freebsd.org) Received: (from tuexen@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r19HQEZZ009488; Sat, 9 Feb 2013 17:26:14 GMT (envelope-from tuexen@svn.freebsd.org) Message-Id: <201302091726.r19HQEZZ009488@svn.freebsd.org> From: Michael Tuexen Date: Sat, 9 Feb 2013 17:26:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r246595 - head/sys/netinet X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 09 Feb 2013 17:26:16 -0000 Author: tuexen Date: Sat Feb 9 17:26:14 2013 New Revision: 246595 URL: http://svnweb.freebsd.org/changeset/base/246595 Log: Cleanup the handling of address scopes. Announce in the INIT/INIT-ACK only the supported address types. While there, do some whitespace cleanups. MFC after: 1 week Modified: head/sys/netinet/sctp.h head/sys/netinet/sctp_asconf.c head/sys/netinet/sctp_input.c head/sys/netinet/sctp_output.c head/sys/netinet/sctp_output.h head/sys/netinet/sctp_pcb.c head/sys/netinet/sctp_structs.h head/sys/netinet/sctp_sysctl.c head/sys/netinet/sctp_usrreq.c head/sys/netinet/sctputil.c Modified: head/sys/netinet/sctp.h ============================================================================== --- head/sys/netinet/sctp.h Sat Feb 9 17:13:54 2013 (r246594) +++ head/sys/netinet/sctp.h Sat Feb 9 17:26:14 2013 (r246595) @@ -500,12 +500,12 @@ struct sctp_error_unrecognized_chunk { #define SCTP_PCB_FLAGS_SOCKET_GONE 0x10000000 #define SCTP_PCB_FLAGS_SOCKET_ALLGONE 0x20000000 #define SCTP_PCB_FLAGS_SOCKET_CANT_READ 0x40000000 + /* flags to copy to new PCB */ #define SCTP_PCB_COPY_FLAGS (SCTP_PCB_FLAGS_BOUNDALL|\ SCTP_PCB_FLAGS_WAKEINPUT|\ SCTP_PCB_FLAGS_BOUND_V6) - /* * PCB Features (in sctp_features bitmask) */ Modified: head/sys/netinet/sctp_asconf.c ============================================================================== --- head/sys/netinet/sctp_asconf.c Sat Feb 9 17:13:54 2013 (r246594) +++ head/sys/netinet/sctp_asconf.c Sat Feb 9 17:26:14 2013 (r246595) @@ -1916,7 +1916,7 @@ sctp_addr_mgmt_assoc(struct sctp_inpcb * return; } if (IN6_IS_ADDR_LINKLOCAL(&sin6->sin6_addr)) { - if (stcb->asoc.local_scope == 0) { + if (stcb->asoc.scope.local_scope == 0) { return; } /* is it the right link local scope? */ @@ -1924,7 +1924,7 @@ sctp_addr_mgmt_assoc(struct sctp_inpcb * return; } } - if (stcb->asoc.site_scope == 0 && + if (stcb->asoc.scope.site_scope == 0 && IN6_IS_ADDR_SITELOCAL(&sin6->sin6_addr)) { return; } @@ -1948,7 +1948,7 @@ sctp_addr_mgmt_assoc(struct sctp_inpcb * /* we skip unspecifed addresses */ return; } - if (stcb->asoc.ipv4_local_scope == 0 && + if (stcb->asoc.scope.ipv4_local_scope == 0 && IN4_ISPRIVATE_ADDRESS(&sin->sin_addr)) { return; } @@ -2106,7 +2106,7 @@ sctp_asconf_iterator_stcb(struct sctp_in continue; } if (IN6_IS_ADDR_LINKLOCAL(&sin6->sin6_addr)) { - if (stcb->asoc.local_scope == 0) { + if (stcb->asoc.scope.local_scope == 0) { continue; } /* is it the right link local scope? */ @@ -2135,7 +2135,7 @@ sctp_asconf_iterator_stcb(struct sctp_in /* we skip unspecifed addresses */ continue; } - if (stcb->asoc.ipv4_local_scope == 0 && + if (stcb->asoc.scope.ipv4_local_scope == 0 && IN4_ISPRIVATE_ADDRESS(&sin->sin_addr)) { continue; } @@ -2198,13 +2198,7 @@ sctp_asconf_iterator_stcb(struct sctp_in } } else { /* Need to check scopes for this guy */ - if (sctp_is_address_in_scope(ifa, - stcb->asoc.ipv4_addr_legal, - stcb->asoc.ipv6_addr_legal, - stcb->asoc.loopback_scope, - stcb->asoc.ipv4_local_scope, - stcb->asoc.local_scope, - stcb->asoc.site_scope, 0) == 0) { + if (sctp_is_address_in_scope(ifa, &stcb->asoc.scope, 0) == 0) { continue; } } @@ -2437,7 +2431,7 @@ sctp_find_valid_localaddr(struct sctp_tc return (NULL); } LIST_FOREACH(sctp_ifn, &vrf->ifnlist, next_ifn) { - if (stcb->asoc.loopback_scope == 0 && + if (stcb->asoc.scope.loopback_scope == 0 && SCTP_IFN_IS_IFT_LOOP(sctp_ifn)) { /* Skip if loopback_scope not set */ continue; @@ -2446,7 +2440,7 @@ sctp_find_valid_localaddr(struct sctp_tc switch (sctp_ifa->address.sa.sa_family) { #ifdef INET case AF_INET: - if (stcb->asoc.ipv4_addr_legal) { + if (stcb->asoc.scope.ipv4_addr_legal) { struct sockaddr_in *sin; sin = (struct sockaddr_in *)&sctp_ifa->address.sa; @@ -2454,7 +2448,7 @@ sctp_find_valid_localaddr(struct sctp_tc /* skip unspecifed addresses */ continue; } - if (stcb->asoc.ipv4_local_scope == 0 && + if (stcb->asoc.scope.ipv4_local_scope == 0 && IN4_ISPRIVATE_ADDRESS(&sin->sin_addr)) continue; @@ -2473,7 +2467,7 @@ sctp_find_valid_localaddr(struct sctp_tc #endif #ifdef INET6 case AF_INET6: - if (stcb->asoc.ipv6_addr_legal) { + if (stcb->asoc.scope.ipv6_addr_legal) { struct sockaddr_in6 *sin6; if (sctp_ifa->localifa_flags & SCTP_ADDR_IFA_UNUSEABLE) { @@ -2487,10 +2481,10 @@ sctp_find_valid_localaddr(struct sctp_tc */ continue; } - if (stcb->asoc.local_scope == 0 && + if (stcb->asoc.scope.local_scope == 0 && IN6_IS_ADDR_LINKLOCAL(&sin6->sin6_addr)) continue; - if (stcb->asoc.site_scope == 0 && + if (stcb->asoc.scope.site_scope == 0 && IN6_IS_ADDR_SITELOCAL(&sin6->sin6_addr)) continue; Modified: head/sys/netinet/sctp_input.c ============================================================================== --- head/sys/netinet/sctp_input.c Sat Feb 9 17:13:54 2013 (r246594) +++ head/sys/netinet/sctp_input.c Sat Feb 9 17:26:14 2013 (r246595) @@ -2130,13 +2130,13 @@ sctp_process_cookie_new(struct mbuf *m, asoc = &stcb->asoc; /* get scope variables out of cookie */ - asoc->ipv4_local_scope = cookie->ipv4_scope; - asoc->site_scope = cookie->site_scope; - asoc->local_scope = cookie->local_scope; - asoc->loopback_scope = cookie->loopback_scope; + asoc->scope.ipv4_local_scope = cookie->ipv4_scope; + asoc->scope.site_scope = cookie->site_scope; + asoc->scope.local_scope = cookie->local_scope; + asoc->scope.loopback_scope = cookie->loopback_scope; - if ((asoc->ipv4_addr_legal != cookie->ipv4_addr_legal) || - (asoc->ipv6_addr_legal != cookie->ipv6_addr_legal)) { + if ((asoc->scope.ipv4_addr_legal != cookie->ipv4_addr_legal) || + (asoc->scope.ipv6_addr_legal != cookie->ipv6_addr_legal)) { struct mbuf *op_err; /* Modified: head/sys/netinet/sctp_output.c ============================================================================== --- head/sys/netinet/sctp_output.c Sat Feb 9 17:13:54 2013 (r246594) +++ head/sys/netinet/sctp_output.c Sat Feb 9 17:26:14 2013 (r246595) @@ -1863,15 +1863,10 @@ struct sack_track sack_array[256] = { int sctp_is_address_in_scope(struct sctp_ifa *ifa, - int ipv4_addr_legal, - int ipv6_addr_legal, - int loopback_scope, - int ipv4_local_scope, - int local_scope SCTP_UNUSED,/* XXX */ - int site_scope, + struct sctp_scoping *scope, int do_update) { - if ((loopback_scope == 0) && + if ((scope->loopback_scope == 0) && (ifa->ifn_p) && SCTP_IFN_IS_IFT_LOOP(ifa->ifn_p)) { /* * skip loopback if not in scope * @@ -1881,7 +1876,7 @@ sctp_is_address_in_scope(struct sctp_ifa switch (ifa->address.sa.sa_family) { #ifdef INET case AF_INET: - if (ipv4_addr_legal) { + if (scope->ipv4_addr_legal) { struct sockaddr_in *sin; sin = (struct sockaddr_in *)&ifa->address.sin; @@ -1889,7 +1884,7 @@ sctp_is_address_in_scope(struct sctp_ifa /* not in scope , unspecified */ return (0); } - if ((ipv4_local_scope == 0) && + if ((scope->ipv4_local_scope == 0) && (IN4_ISPRIVATE_ADDRESS(&sin->sin_addr))) { /* private address not in scope */ return (0); @@ -1901,7 +1896,7 @@ sctp_is_address_in_scope(struct sctp_ifa #endif #ifdef INET6 case AF_INET6: - if (ipv6_addr_legal) { + if (scope->ipv6_addr_legal) { struct sockaddr_in6 *sin6; /* @@ -1924,7 +1919,7 @@ sctp_is_address_in_scope(struct sctp_ifa (IN6_IS_ADDR_LINKLOCAL(&sin6->sin6_addr))) { return (0); } - if ((site_scope == 0) && + if ((scope->site_scope == 0) && (IN6_IS_ADDR_SITELOCAL(&sin6->sin6_addr))) { return (0); } @@ -2063,13 +2058,7 @@ sctp_add_addresses_to_i_ia(struct sctp_i if (sctp_is_addr_restricted(stcb, sctp_ifap)) { continue; } - if (sctp_is_address_in_scope(sctp_ifap, - scope->ipv4_addr_legal, - scope->ipv6_addr_legal, - scope->loopback_scope, - scope->ipv4_local_scope, - scope->local_scope, - scope->site_scope, 1) == 0) { + if (sctp_is_address_in_scope(sctp_ifap, scope, 1) == 0) { continue; } cnt++; @@ -2099,12 +2088,7 @@ skip_count: continue; } if (sctp_is_address_in_scope(sctp_ifap, - scope->ipv4_addr_legal, - scope->ipv6_addr_legal, - scope->loopback_scope, - scope->ipv4_local_scope, - scope->local_scope, - scope->site_scope, 0) == 0) { + scope, 0) == 0) { continue; } if ((chunk_len != NULL) && @@ -2157,12 +2141,7 @@ skip_count: continue; } if (sctp_is_address_in_scope(laddr->ifa, - scope->ipv4_addr_legal, - scope->ipv6_addr_legal, - scope->loopback_scope, - scope->ipv4_local_scope, - scope->local_scope, - scope->site_scope, 1) == 0) { + scope, 1) == 0) { continue; } cnt++; @@ -2182,12 +2161,7 @@ skip_count: continue; } if (sctp_is_address_in_scope(laddr->ifa, - scope->ipv4_addr_legal, - scope->ipv6_addr_legal, - scope->loopback_scope, - scope->ipv4_local_scope, - scope->local_scope, - scope->site_scope, 0) == 0) { + scope, 0) == 0) { continue; } if ((chunk_len != NULL) && @@ -2801,13 +2775,7 @@ sctp_select_nth_preferred_addr_from_ifn_ } #endif if (stcb) { - if (sctp_is_address_in_scope(ifa, - stcb->asoc.ipv4_addr_legal, - stcb->asoc.ipv6_addr_legal, - stcb->asoc.loopback_scope, - stcb->asoc.ipv4_local_scope, - stcb->asoc.local_scope, - stcb->asoc.site_scope, 0) == 0) { + if (sctp_is_address_in_scope(ifa, &stcb->asoc.scope, 0) == 0) { continue; } if (((non_asoc_addr_ok == 0) && @@ -2853,13 +2821,7 @@ sctp_count_num_preferred_boundall(struct continue; } if (stcb) { - if (sctp_is_address_in_scope(ifa, - stcb->asoc.ipv4_addr_legal, - stcb->asoc.ipv6_addr_legal, - stcb->asoc.loopback_scope, - stcb->asoc.ipv4_local_scope, - stcb->asoc.local_scope, - stcb->asoc.site_scope, 0) == 0) { + if (sctp_is_address_in_scope(ifa, &stcb->asoc.scope, 0) == 0) { continue; } if (((non_asoc_addr_ok == 0) && @@ -3055,13 +3017,7 @@ again_with_private_addresses_allowed: continue; } if (stcb) { - if (sctp_is_address_in_scope(sifa, - stcb->asoc.ipv4_addr_legal, - stcb->asoc.ipv6_addr_legal, - stcb->asoc.loopback_scope, - stcb->asoc.ipv4_local_scope, - stcb->asoc.local_scope, - stcb->asoc.site_scope, 0) == 0) { + if (sctp_is_address_in_scope(sifa, &stcb->asoc.scope, 0) == 0) { SCTPDBG(SCTP_DEBUG_OUTPUT2, "NOT in scope\n"); sifa = NULL; continue; @@ -3108,13 +3064,7 @@ plan_d: if (sifa == NULL) continue; if (stcb) { - if (sctp_is_address_in_scope(sifa, - stcb->asoc.ipv4_addr_legal, - stcb->asoc.ipv6_addr_legal, - stcb->asoc.loopback_scope, - stcb->asoc.ipv4_local_scope, - stcb->asoc.local_scope, - stcb->asoc.site_scope, 0) == 0) { + if (sctp_is_address_in_scope(sifa, &stcb->asoc.scope, 0) == 0) { sifa = NULL; continue; } @@ -3135,12 +3085,12 @@ plan_d: } } #ifdef INET - if ((retried == 0) && (stcb->asoc.ipv4_local_scope == 0)) { - stcb->asoc.ipv4_local_scope = 1; + if ((retried == 0) && (stcb->asoc.scope.ipv4_local_scope == 0)) { + stcb->asoc.scope.ipv4_local_scope = 1; retried = 1; goto again_with_private_addresses_allowed; } else if (retried == 1) { - stcb->asoc.ipv4_local_scope = 0; + stcb->asoc.scope.ipv4_local_scope = 0; } #endif out: @@ -3169,12 +3119,7 @@ out: } if (stcb) { if (sctp_is_address_in_scope(tmp_sifa, - stcb->asoc.ipv4_addr_legal, - stcb->asoc.ipv6_addr_legal, - stcb->asoc.loopback_scope, - stcb->asoc.ipv4_local_scope, - stcb->asoc.local_scope, - stcb->asoc.site_scope, 0) == 0) { + &stcb->asoc.scope, 0) == 0) { continue; } if (((non_asoc_addr_ok == 0) && @@ -4595,7 +4540,6 @@ sctp_send_initiate(struct sctp_inpcb *in #endif ) { - struct sctp_scoping scp; struct mbuf *m; struct sctp_nets *net; struct sctp_init_chunk *init; @@ -4675,37 +4619,29 @@ sctp_send_initiate(struct sctp_inpcb *in init->init.num_inbound_streams = htons(stcb->asoc.max_inbound_streams); init->init.initial_tsn = htonl(stcb->asoc.init_seq_number); -#if defined(INET) || defined(INET6) - /* now the address restriction */ - /* XXX Should we take the address family of the socket into account? */ - sup_addr = (struct sctp_supported_addr_param *)(mtod(m, caddr_t)+chunk_len); - sup_addr->ph.param_type = htons(SCTP_SUPPORTED_ADDRTYPE); -#ifdef INET6 -#ifdef INET - /* we support 2 types: IPv4/IPv6 */ - parameter_len = (uint16_t) (sizeof(struct sctp_paramhdr) + 2 * sizeof(uint16_t)); - sup_addr->ph.param_length = htons(parameter_len); - sup_addr->addr_type[0] = htons(SCTP_IPV4_ADDRESS); - sup_addr->addr_type[1] = htons(SCTP_IPV6_ADDRESS); - padding_len = 0; -#else - /* we support 1 type: IPv6 */ - parameter_len = (uint16_t) (sizeof(struct sctp_paramhdr) + sizeof(uint16_t)); - sup_addr->ph.param_length = htons(parameter_len); - sup_addr->addr_type[0] = htons(SCTP_IPV6_ADDRESS); - sup_addr->addr_type[1] = htons(0); /* this is the padding */ - padding_len = (uint16_t) sizeof(uint16_t); -#endif -#else - /* we support 1 type: IPv4 */ - parameter_len = (uint16_t) (sizeof(struct sctp_paramhdr) + sizeof(uint16_t)); - sup_addr->ph.param_length = htons(parameter_len); - sup_addr->addr_type[0] = htons(SCTP_IPV4_ADDRESS); - sup_addr->addr_type[1] = htons(0); /* this is the padding */ - padding_len = (uint16_t) sizeof(uint16_t); -#endif - chunk_len += parameter_len; -#endif + if (stcb->asoc.scope.ipv4_addr_legal || stcb->asoc.scope.ipv6_addr_legal) { + uint8_t i; + + parameter_len = (uint16_t) sizeof(struct sctp_paramhdr); + if (stcb->asoc.scope.ipv4_addr_legal) { + parameter_len += (uint16_t) sizeof(uint16_t); + } + if (stcb->asoc.scope.ipv6_addr_legal) { + parameter_len += (uint16_t) sizeof(uint16_t); + } + sup_addr = (struct sctp_supported_addr_param *)(mtod(m, caddr_t)+chunk_len); + sup_addr->ph.param_type = htons(SCTP_SUPPORTED_ADDRTYPE); + sup_addr->ph.param_length = htons(parameter_len); + i = 0; + if (stcb->asoc.scope.ipv4_addr_legal) { + sup_addr->addr_type[i++] = htons(SCTP_IPV4_ADDRESS); + } + if (stcb->asoc.scope.ipv6_addr_legal) { + sup_addr->addr_type[i++] = htons(SCTP_IPV6_ADDRESS); + } + padding_len = 4 - 2 * i; + chunk_len += parameter_len; + } /* Adaptation layer indication parameter */ /* XXX: Should we include this always? */ if (padding_len > 0) { @@ -4860,13 +4796,7 @@ sctp_send_initiate(struct sctp_inpcb *in * we could just sifa in the address within the stcb. But for now * this is a quick hack to get the address stuff teased apart. */ - scp.ipv4_addr_legal = stcb->asoc.ipv4_addr_legal; - scp.ipv6_addr_legal = stcb->asoc.ipv6_addr_legal; - scp.loopback_scope = stcb->asoc.loopback_scope; - scp.ipv4_local_scope = stcb->asoc.ipv4_local_scope; - scp.local_scope = stcb->asoc.local_scope; - scp.site_scope = stcb->asoc.site_scope; - sctp_add_addresses_to_i_ia(inp, stcb, &scp, m, cnt_inits_to, &padding_len, &chunk_len); + sctp_add_addresses_to_i_ia(inp, stcb, &stcb->asoc.scope, m, cnt_inits_to, &padding_len, &chunk_len); init->ch.chunk_length = htons(chunk_len); if (padding_len > 0) { @@ -5507,24 +5437,16 @@ do_a_abort: */ stc.site_scope = stc.local_scope = stc.loopback_scope = 0; if (inp->sctp_flags & SCTP_PCB_FLAGS_BOUND_V6) { - struct inpcb *in_inp; - - /* Its a V6 socket */ - in_inp = (struct inpcb *)inp; stc.ipv6_addr_legal = 1; - /* Now look at the binding flag to see if V4 will be legal */ - if (SCTP_IPV6_V6ONLY(in_inp) == 0) { - stc.ipv4_addr_legal = 1; - } else { - /* V4 addresses are NOT legal on the association */ + if (SCTP_IPV6_V6ONLY(inp)) { stc.ipv4_addr_legal = 0; + } else { + stc.ipv4_addr_legal = 1; } } else { - /* Its a V4 socket, no - V6 */ - stc.ipv4_addr_legal = 1; stc.ipv6_addr_legal = 0; + stc.ipv4_addr_legal = 1; } - #ifdef SCTP_DONT_DO_PRIVADDR_SCOPE stc.ipv4_scope = 1; #else @@ -5629,10 +5551,10 @@ do_a_abort: #endif - stc.loopback_scope = asoc->loopback_scope; - stc.ipv4_scope = asoc->ipv4_local_scope; - stc.site_scope = asoc->site_scope; - stc.local_scope = asoc->local_scope; + stc.loopback_scope = asoc->scope.loopback_scope; + stc.ipv4_scope = asoc->scope.ipv4_local_scope; + stc.site_scope = asoc->scope.site_scope; + stc.local_scope = asoc->scope.local_scope; #ifdef INET6 /* Why do we not consider IPv4 LL addresses? */ TAILQ_FOREACH(lnet, &asoc->nets, sctp_next) { Modified: head/sys/netinet/sctp_output.h ============================================================================== --- head/sys/netinet/sctp_output.h Sat Feb 9 17:13:54 2013 (r246594) +++ head/sys/netinet/sctp_output.h Sat Feb 9 17:26:14 2013 (r246595) @@ -55,13 +55,9 @@ int sctp_is_addr_restricted(struct sctp_ int sctp_is_address_in_scope(struct sctp_ifa *ifa, - int ipv4_addr_legal, - int ipv6_addr_legal, - int loopback_scope, - int ipv4_local_scope, - int local_scope, - int site_scope, + struct sctp_scoping *scope, int do_update); + int sctp_is_addr_in_ep(struct sctp_inpcb *inp, struct sctp_ifa *ifa); Modified: head/sys/netinet/sctp_pcb.c ============================================================================== --- head/sys/netinet/sctp_pcb.c Sat Feb 9 17:13:54 2013 (r246594) +++ head/sys/netinet/sctp_pcb.c Sat Feb 9 17:26:14 2013 (r246595) @@ -94,11 +94,10 @@ sctp_fill_pcbinfo(struct sctp_pcbinfo *s spcb->readq_count = SCTP_BASE_INFO(ipi_count_readq); spcb->stream_oque = SCTP_BASE_INFO(ipi_count_strmoq); spcb->free_chunks = SCTP_BASE_INFO(ipi_free_chunks); - SCTP_INP_INFO_RUNLOCK(); } -/* +/*- * Addresses are added to VRF's (Virtual Router's). For BSD we * have only the default VRF 0. We maintain a hash list of * VRF's. Each VRF has its own list of sctp_ifn's. Each of @@ -214,7 +213,6 @@ sctp_find_ifn(void *ifn, uint32_t ifn_in } - struct sctp_vrf * sctp_find_vrf(uint32_t vrf_id) { @@ -230,6 +228,7 @@ sctp_find_vrf(uint32_t vrf_id) return (NULL); } + void sctp_free_vrf(struct sctp_vrf *vrf) { @@ -245,6 +244,7 @@ sctp_free_vrf(struct sctp_vrf *vrf) } } + void sctp_free_ifn(struct sctp_ifn *sctp_ifnp) { @@ -258,6 +258,7 @@ sctp_free_ifn(struct sctp_ifn *sctp_ifnp } } + void sctp_update_ifn_mtu(uint32_t ifn_index, uint32_t mtu) { @@ -283,6 +284,7 @@ sctp_free_ifa(struct sctp_ifa *sctp_ifap } } + static void sctp_delete_ifn(struct sctp_ifn *sctp_ifnp, int hold_addr_lock) { @@ -305,12 +307,13 @@ sctp_delete_ifn(struct sctp_ifn *sctp_if sctp_free_ifn(sctp_ifnp); } + void sctp_mark_ifa_addr_down(uint32_t vrf_id, struct sockaddr *addr, const char *if_name, uint32_t ifn_index) { struct sctp_vrf *vrf; - struct sctp_ifa *sctp_ifap = NULL; + struct sctp_ifa *sctp_ifap; SCTP_IPI_ADDR_RLOCK(); vrf = sctp_find_vrf(vrf_id); @@ -348,12 +351,13 @@ out: SCTP_IPI_ADDR_RUNLOCK(); } + void sctp_mark_ifa_addr_up(uint32_t vrf_id, struct sockaddr *addr, const char *if_name, uint32_t ifn_index) { struct sctp_vrf *vrf; - struct sctp_ifa *sctp_ifap = NULL; + struct sctp_ifa *sctp_ifap; SCTP_IPI_ADDR_RLOCK(); vrf = sctp_find_vrf(vrf_id); @@ -391,6 +395,7 @@ out: SCTP_IPI_ADDR_RUNLOCK(); } + /*- * Add an ifa to an ifn. * Register the interface as necessary. @@ -428,6 +433,7 @@ sctp_add_ifa_to_ifn(struct sctp_ifn *sct } } + /*- * Remove an ifa from its ifn. * If no more addresses exist, remove the ifn too. Otherwise, re-register @@ -479,6 +485,7 @@ sctp_remove_ifa_from_ifn(struct sctp_ifa } } + struct sctp_ifa * sctp_add_addr_to_vrf(uint32_t vrf_id, void *ifn, uint32_t ifn_index, uint32_t ifn_type, const char *if_name, void *ifa, @@ -1027,6 +1034,7 @@ sctp_tcb_special_locate(struct sctp_inpc return (NULL); } + static int sctp_does_stcb_own_this_addr(struct sctp_tcb *stcb, struct sockaddr *to) { @@ -1036,19 +1044,12 @@ sctp_does_stcb_own_this_addr(struct sctp struct sctp_ifn *sctp_ifn; struct sctp_ifa *sctp_ifa; - loopback_scope = stcb->asoc.loopback_scope; - ipv4_local_scope = stcb->asoc.ipv4_local_scope; - local_scope = stcb->asoc.local_scope; - site_scope = stcb->asoc.site_scope; - ipv4_addr_legal = ipv6_addr_legal = 0; - if (stcb->sctp_ep->sctp_flags & SCTP_PCB_FLAGS_BOUND_V6) { - ipv6_addr_legal = 1; - if (SCTP_IPV6_V6ONLY(stcb->sctp_ep) == 0) { - ipv4_addr_legal = 1; - } - } else { - ipv4_addr_legal = 1; - } + loopback_scope = stcb->asoc.scope.loopback_scope; + ipv4_local_scope = stcb->asoc.scope.ipv4_local_scope; + local_scope = stcb->asoc.scope.local_scope; + site_scope = stcb->asoc.scope.site_scope; + ipv4_addr_legal = stcb->asoc.scope.ipv4_addr_legal; + ipv6_addr_legal = stcb->asoc.scope.ipv6_addr_legal; SCTP_IPI_ADDR_RLOCK(); vrf = sctp_find_vrf(stcb->asoc.vrf_id); @@ -1183,6 +1184,7 @@ sctp_does_stcb_own_this_addr(struct sctp return (0); } + /* * rules for use * @@ -1471,11 +1473,11 @@ null_return: return (NULL); } + /* * Find an association for a specific endpoint using the association id given * out in the COMM_UP notification */ - struct sctp_tcb * sctp_findasoc_ep_asocid_locked(struct sctp_inpcb *inp, sctp_assoc_t asoc_id, int want_lock) { @@ -1536,6 +1538,9 @@ sctp_findassociation_ep_asocid(struct sc } +/* + * Endpoint probe expects that the INP_INFO is locked. + */ static struct sctp_inpcb * sctp_endpoint_probe(struct sockaddr *nam, struct sctppcbhead *head, uint16_t lport, uint32_t vrf_id) @@ -1552,12 +1557,8 @@ sctp_endpoint_probe(struct sockaddr *nam struct sockaddr_in6 *intf_addr6; #endif - int fnd; - /* - * Endpoint probe expects that the INP_INFO is locked. - */ #ifdef INET sin = NULL; #endif @@ -1893,6 +1894,7 @@ sctp_pcb_findep(struct sockaddr *nam, in return (inp); } + /* * Find an association for an endpoint with the pointer to whom you want to * send to and the endpoint pointer. The address can be IPv4 or IPv6. We may @@ -2144,6 +2146,7 @@ sctp_findassoc_by_vtag(struct sockaddr * return (NULL); } + /* * Find an association with the pointer to the inbound IP packet. This can be * a IPv4 or IPv6 packet. @@ -3743,13 +3746,13 @@ sctp_add_remote_addr(struct sctp_tcb *st stcb->ipv4_local_scope = 1; #else if (IN4_ISPRIVATE_ADDRESS(&sin->sin_addr)) { - stcb->asoc.ipv4_local_scope = 1; + stcb->asoc.scope.ipv4_local_scope = 1; } #endif /* SCTP_DONT_DO_PRIVADDR_SCOPE */ } else { /* Validate the address is in scope */ if ((IN4_ISPRIVATE_ADDRESS(&sin->sin_addr)) && - (stcb->asoc.ipv4_local_scope == 0)) { + (stcb->asoc.scope.ipv4_local_scope == 0)) { addr_inscope = 0; } } @@ -3770,10 +3773,10 @@ sctp_add_remote_addr(struct sctp_tcb *st sin6->sin6_len = sizeof(struct sockaddr_in6); if (set_scope) { if (sctp_is_address_on_local_host(newaddr, stcb->asoc.vrf_id)) { - stcb->asoc.loopback_scope = 1; - stcb->asoc.local_scope = 0; - stcb->asoc.ipv4_local_scope = 1; - stcb->asoc.site_scope = 1; + stcb->asoc.scope.loopback_scope = 1; + stcb->asoc.scope.local_scope = 0; + stcb->asoc.scope.ipv4_local_scope = 1; + stcb->asoc.scope.site_scope = 1; } else if (IN6_IS_ADDR_LINKLOCAL(&sin6->sin6_addr)) { /* * If the new destination is a @@ -3785,26 +3788,26 @@ sctp_add_remote_addr(struct sctp_tcb *st * also be on our private network * for v4 too. */ - stcb->asoc.ipv4_local_scope = 1; - stcb->asoc.site_scope = 1; + stcb->asoc.scope.ipv4_local_scope = 1; + stcb->asoc.scope.site_scope = 1; } else if (IN6_IS_ADDR_SITELOCAL(&sin6->sin6_addr)) { /* * If the new destination is * SITE_LOCAL then we must have site * scope in common. */ - stcb->asoc.site_scope = 1; + stcb->asoc.scope.site_scope = 1; } } else { /* Validate the address is in scope */ if (IN6_IS_ADDR_LOOPBACK(&sin6->sin6_addr) && - (stcb->asoc.loopback_scope == 0)) { + (stcb->asoc.scope.loopback_scope == 0)) { addr_inscope = 0; } else if (IN6_IS_ADDR_LINKLOCAL(&sin6->sin6_addr) && - (stcb->asoc.local_scope == 0)) { + (stcb->asoc.scope.local_scope == 0)) { addr_inscope = 0; } else if (IN6_IS_ADDR_SITELOCAL(&sin6->sin6_addr) && - (stcb->asoc.site_scope == 0)) { + (stcb->asoc.scope.site_scope == 0)) { addr_inscope = 0; } } @@ -3839,10 +3842,10 @@ sctp_add_remote_addr(struct sctp_tcb *st } net->addr_is_local = sctp_is_address_on_local_host(newaddr, stcb->asoc.vrf_id); if (net->addr_is_local && ((set_scope || (from == SCTP_ADDR_IS_CONFIRMED)))) { - stcb->asoc.loopback_scope = 1; - stcb->asoc.ipv4_local_scope = 1; - stcb->asoc.local_scope = 0; - stcb->asoc.site_scope = 1; + stcb->asoc.scope.loopback_scope = 1; + stcb->asoc.scope.ipv4_local_scope = 1; + stcb->asoc.scope.local_scope = 0; + stcb->asoc.scope.site_scope = 1; addr_inscope = 1; } net->failure_threshold = stcb->asoc.def_net_failure; @@ -6071,7 +6074,7 @@ sctp_load_addresses_from_init(struct sct switch (sa->sa_family) { #ifdef INET case AF_INET: - if (stcb->asoc.ipv4_addr_legal) { + if (stcb->asoc.scope.ipv4_addr_legal) { if (sctp_add_remote_addr(stcb, sa, NULL, SCTP_DONOT_SETSCOPE, SCTP_LOAD_ADDR_2)) { return (-1); } @@ -6080,7 +6083,7 @@ sctp_load_addresses_from_init(struct sct #endif #ifdef INET6 case AF_INET6: - if (stcb->asoc.ipv6_addr_legal) { + if (stcb->asoc.scope.ipv6_addr_legal) { if (sctp_add_remote_addr(stcb, sa, NULL, SCTP_DONOT_SETSCOPE, SCTP_LOAD_ADDR_3)) { return (-2); } @@ -6127,7 +6130,7 @@ sctp_load_addresses_from_init(struct sct } #ifdef INET if (ptype == SCTP_IPV4_ADDRESS) { - if (stcb->asoc.ipv4_addr_legal) { + if (stcb->asoc.scope.ipv4_addr_legal) { struct sctp_ipv4addr_param *p4, p4_buf; /* ok get the v4 address and check/add */ @@ -6213,7 +6216,7 @@ sctp_load_addresses_from_init(struct sct #endif #ifdef INET6 if (ptype == SCTP_IPV6_ADDRESS) { - if (stcb->asoc.ipv6_addr_legal) { + if (stcb->asoc.scope.ipv6_addr_legal) { /* ok get the v6 address and check/add */ struct sctp_ipv6addr_param *p6, p6_buf; Modified: head/sys/netinet/sctp_structs.h ============================================================================== --- head/sys/netinet/sctp_structs.h Sat Feb 9 17:13:54 2013 (r246594) +++ head/sys/netinet/sctp_structs.h Sat Feb 9 17:26:14 2013 (r246595) @@ -1177,17 +1177,7 @@ struct sctp_association { */ uint8_t peer_supports_pktdrop; - /* Do we allow V6/V4? */ - uint8_t ipv4_addr_legal; - uint8_t ipv6_addr_legal; - /* Address scoping flags */ - /* scope value for IPv4 */ - uint8_t ipv4_local_scope; - /* scope values for IPv6 */ - uint8_t local_scope; - uint8_t site_scope; - /* loopback scope */ - uint8_t loopback_scope; + struct sctp_scoping scope; /* flags to handle send alternate net tracking */ uint8_t used_alt_onsack; uint8_t used_alt_asconfack; Modified: head/sys/netinet/sctp_sysctl.c ============================================================================== --- head/sys/netinet/sctp_sysctl.c Sat Feb 9 17:13:54 2013 (r246594) +++ head/sys/netinet/sctp_sysctl.c Sat Feb 9 17:26:14 2013 (r246595) @@ -197,29 +197,29 @@ copy_out_local_addresses(struct sctp_inp /* Turn on all the appropriate scope */ if (stcb) { /* use association specific values */ - loopback_scope = stcb->asoc.loopback_scope; - ipv4_local_scope = stcb->asoc.ipv4_local_scope; - local_scope = stcb->asoc.local_scope; - site_scope = stcb->asoc.site_scope; + loopback_scope = stcb->asoc.scope.loopback_scope; + ipv4_local_scope = stcb->asoc.scope.ipv4_local_scope; + local_scope = stcb->asoc.scope.local_scope; + site_scope = stcb->asoc.scope.site_scope; + ipv4_addr_legal = stcb->asoc.scope.ipv4_addr_legal; + ipv6_addr_legal = stcb->asoc.scope.ipv6_addr_legal; } else { - /* use generic values for endpoints */ + /* Use generic values for endpoints. */ loopback_scope = 1; ipv4_local_scope = 1; local_scope = 1; site_scope = 1; - } - - /* use only address families of interest */ - if (inp->sctp_flags & SCTP_PCB_FLAGS_BOUND_V6) { - ipv6_addr_legal = 1; - if (SCTP_IPV6_V6ONLY(inp)) { - ipv4_addr_legal = 0; + if (inp->sctp_flags & SCTP_PCB_FLAGS_BOUND_V6) { + ipv6_addr_legal = 1; + if (SCTP_IPV6_V6ONLY(inp)) { + ipv4_addr_legal = 0; + } else { + ipv4_addr_legal = 1; + } } else { + ipv6_addr_legal = 0; ipv4_addr_legal = 1; } - } else { - ipv4_addr_legal = 1; - ipv6_addr_legal = 0; } /* neither Mac OS X nor FreeBSD support mulitple routing functions */ Modified: head/sys/netinet/sctp_usrreq.c ============================================================================== --- head/sys/netinet/sctp_usrreq.c Sat Feb 9 17:13:54 2013 (r246594) +++ head/sys/netinet/sctp_usrreq.c Sat Feb 9 17:26:14 2013 (r246595) @@ -1143,23 +1143,29 @@ sctp_fill_up_addresses_vrf(struct sctp_i if (stcb) { /* Turn on all the appropriate scope */ - loopback_scope = stcb->asoc.loopback_scope; - ipv4_local_scope = stcb->asoc.ipv4_local_scope; - local_scope = stcb->asoc.local_scope; - site_scope = stcb->asoc.site_scope; + loopback_scope = stcb->asoc.scope.loopback_scope; + ipv4_local_scope = stcb->asoc.scope.ipv4_local_scope; + local_scope = stcb->asoc.scope.local_scope; + site_scope = stcb->asoc.scope.site_scope; + ipv4_addr_legal = stcb->asoc.scope.ipv4_addr_legal; + ipv6_addr_legal = stcb->asoc.scope.ipv6_addr_legal; } else { - /* Turn on ALL scope, since we look at the EP */ - loopback_scope = ipv4_local_scope = local_scope = - site_scope = 1; - } - ipv4_addr_legal = ipv6_addr_legal = 0; - if (inp->sctp_flags & SCTP_PCB_FLAGS_BOUND_V6) { - ipv6_addr_legal = 1; - if (SCTP_IPV6_V6ONLY(inp) == 0) { + /* Use generic values for endpoints. */ + loopback_scope = 1; + ipv4_local_scope = 1; + local_scope = 1; + site_scope = 1; + if (inp->sctp_flags & SCTP_PCB_FLAGS_BOUND_V6) { + ipv6_addr_legal = 1; + if (SCTP_IPV6_V6ONLY(inp)) { + ipv4_addr_legal = 0; + } else { + ipv4_addr_legal = 1; + } + } else { + ipv6_addr_legal = 0; ipv4_addr_legal = 1; } - } else { - ipv4_addr_legal = 1; } vrf = sctp_find_vrf(vrf_id); if (vrf == NULL) { @@ -1298,8 +1304,21 @@ sctp_fill_up_addresses_vrf(struct sctp_i } if (sctp_fill_user_address(sas, &laddr->ifa->address.sa)) continue; - - ((struct sockaddr_in6 *)sas)->sin6_port = inp->sctp_lport; + switch (laddr->ifa->address.sa.sa_family) { +#ifdef INET + case AF_INET: + ((struct sockaddr_in *)sas)->sin_port = inp->sctp_lport; + break; +#endif +#ifdef INET6 + case AF_INET6: + ((struct sockaddr_in6 *)sas)->sin6_port = inp->sctp_lport; + break; +#endif + default: + /* TSNH */ + break; + } sas = (struct sockaddr_storage *)((caddr_t)sas + laddr->ifa->address.sa.sa_len); actual += laddr->ifa->address.sa.sa_len; @@ -5948,7 +5967,7 @@ sctp_connect(struct socket *so, struct s error = EINVAL; goto out_now; } -#endif /* INET6 */ +#endif if ((inp->sctp_flags & SCTP_PCB_FLAGS_UNBOUND) == SCTP_PCB_FLAGS_UNBOUND) { /* Bind a ephemeral port */ @@ -6242,8 +6261,8 @@ sctp_accept(struct socket *so, struct so return (ENOMEM); sin->sin_family = AF_INET; sin->sin_len = sizeof(*sin); - sin->sin_port = ((struct sockaddr_in *)&store)->sin_port; - sin->sin_addr = ((struct sockaddr_in *)&store)->sin_addr; + sin->sin_port = store.sin.sin_port; + sin->sin_addr = store.sin.sin_addr; *addr = (struct sockaddr *)sin; break; } @@ -6258,9 +6277,8 @@ sctp_accept(struct socket *so, struct so return (ENOMEM); sin6->sin6_family = AF_INET6; sin6->sin6_len = sizeof(*sin6); - sin6->sin6_port = ((struct sockaddr_in6 *)&store)->sin6_port; - - sin6->sin6_addr = ((struct sockaddr_in6 *)&store)->sin6_addr; + sin6->sin6_port = store.sin6.sin6_port; + sin6->sin6_addr = store.sin6.sin6_addr; if ((error = sa6_recoverscope(sin6)) != 0) { SCTP_FREE_SONAME(sin6); return (error); Modified: head/sys/netinet/sctputil.c ============================================================================== --- head/sys/netinet/sctputil.c Sat Feb 9 17:13:54 2013 (r246594) +++ head/sys/netinet/sctputil.c Sat Feb 9 17:26:14 2013 (r246595) @@ -878,7 +878,7 @@ sctp_select_a_tag(struct sctp_inpcb *inp } int -sctp_init_asoc(struct sctp_inpcb *m, struct sctp_tcb *stcb, +sctp_init_asoc(struct sctp_inpcb *inp, struct sctp_tcb *stcb, uint32_t override_tag, uint32_t vrf_id) { struct sctp_association *asoc; @@ -899,23 +899,23 @@ sctp_init_asoc(struct sctp_inpcb *m, str asoc = &stcb->asoc; /* init all variables to a known value. */ *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@FreeBSD.ORG Sat Feb 9 20:13:30 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 7B5E8AEC; Sat, 9 Feb 2013 20:13:30 +0000 (UTC) (envelope-from kientzle@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 5614E107; Sat, 9 Feb 2013 20:13:30 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r19IEQTe024759; Sat, 9 Feb 2013 18:14:26 GMT (envelope-from kientzle@svn.freebsd.org) Received: (from kientzle@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r19IEQEu024758; Sat, 9 Feb 2013 18:14:26 GMT (envelope-from kientzle@svn.freebsd.org) Message-Id: <201302091814.r19IEQEu024758@svn.freebsd.org> From: Tim Kientzle Date: Sat, 9 Feb 2013 18:14:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r246600 - head/usr.bin X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 09 Feb 2013 20:13:30 -0000 Author: kientzle Date: Sat Feb 9 18:14:26 2013 New Revision: 246600 URL: http://svnweb.freebsd.org/changeset/base/246600 Log: Add dtc to the build. Modified: head/usr.bin/Makefile Modified: head/usr.bin/Makefile ============================================================================== --- head/usr.bin/Makefile Sat Feb 9 18:00:29 2013 (r246599) +++ head/usr.bin/Makefile Sat Feb 9 18:14:26 2013 (r246600) @@ -37,6 +37,7 @@ SUBDIR= alias \ ctlstat \ cut \ dirname \ + dtc \ du \ ee \ elf2aout \ From owner-svn-src-head@FreeBSD.ORG Sat Feb 9 21:35:55 2013 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id D1BC81DD; Sat, 9 Feb 2013 21:35:55 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from fallbackmx08.syd.optusnet.com.au (fallbackmx08.syd.optusnet.com.au [211.29.132.10]) by mx1.freebsd.org (Postfix) with ESMTP id E7533942; Sat, 9 Feb 2013 21:35:54 +0000 (UTC) Received: from mail12.syd.optusnet.com.au (mail12.syd.optusnet.com.au [211.29.132.193]) by fallbackmx08.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id r19JZsRF020687; Sun, 10 Feb 2013 06:35:54 +1100 Received: from c211-30-173-106.carlnfd1.nsw.optusnet.com.au (c211-30-173-106.carlnfd1.nsw.optusnet.com.au [211.30.173.106]) by mail12.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id r19JZoi4025212 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Sun, 10 Feb 2013 06:35:51 +1100 Date: Sun, 10 Feb 2013 06:35:50 +1100 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Eitan Adler Subject: Re: svn commit: r246593 - head/lib/libc/sys In-Reply-To: Message-ID: <20130210051121.L3760@besplex.bde.org> References: <201302091713.r19HDqv6006148@svn.freebsd.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Optus-CM-Score: 0 X-Optus-CM-Analysis: v=2.0 cv=Uug7rJMB c=1 sm=1 a=cAXCqpZEShQA:10 a=kj9zAlcOel0A:10 a=PO7r1zJSAAAA:8 a=JzwRw_2MAAAA:8 a=uiiGxAOqq18A:10 a=6I5d2MoRAAAA:8 a=ZFVg263UAAAA:8 a=NV3LF1PM_9Jh4ooLTqgA:9 a=CjuIK1q_8ugA:10 a=SV7veod9ZcQA:10 a=o-NGsO4tlvUA:10 a=TEtd8y5WR3g2ypngnwZWYw==:117 Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 09 Feb 2013 21:35:55 -0000 On Sat, 9 Feb 2013, Eitan Adler wrote: > On 9 February 2013 12:13, Eitan Adler wrote: >> Author: eadler >> Date: Sat Feb 9 17:13:51 2013 >> New Revision: 246593 >> URL: http://svnweb.freebsd.org/changeset/base/246593 >> >> Log: >> Fix logic inversion. >> >> PR: docs/174966 http://www.FreeBSD.org/cgi/query-pr.cgi?pr=174966 >> Submitted by: Christian Ullrich >> Approved by: bcr (mentor) >> >> Modified: >> head/lib/libc/sys/chflags.2 >> >> Modified: head/lib/libc/sys/chflags.2 >> ============================================================================== >> --- head/lib/libc/sys/chflags.2 Sat Feb 9 13:31:59 2013 (r246592) >> +++ head/lib/libc/sys/chflags.2 Sat Feb 9 17:13:51 2013 (r246593) >> @@ -98,7 +98,7 @@ If one of >> or >> .Dv SF_NOUNLINK >> is set a non-super-user cannot change any flags and even the super-user >> -can change flags only if securelevel is greater than 0. >> +can change flags only if securelevel is 0. > > I was reminded the default -1, not 0. I'll fix this shortly. Also, this seems to be wrong about changing flags. Old versions say that only clearing flags is prevented by securelevel > 0, and the code still seems to do this: Old man page: @ The ``SF_IMMUTABLE'', ``SF_APPEND'', ``SF_NOUNLINK'', and ``SF_ARCHIVED'' @ flags may only be set or unset by the super-user. Attempts by the non- @ super-user to set the super-user only flags are silently ignored. These @ ^^^^^ @ flags may be set at any time, but normally may only be unset when the @ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @ system is in single-user mode. (See init(8) for details.) Current ffs code: @ /* @ * Unprivileged processes are not permitted to unset system @ * flags, or modify flags if any system flags are set. @ ^^^^^^^^^^^^^^^^ @ * Privileged non-jail processes may not modify system flags @ ^^^^^^^^^^^^^^^^^^^^^^^^^^^ @ * if securelevel > 0 and any existing system flags are set. @ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^. @ ||| ||| @ * Privileged jail processes behave like privileged non-jail @ * processes if the security.jail.chflags_allowed sysctl is @ * is non-zero; otherwise, they behave like unprivileged @ * processes. @ */ "any" is also wrong here. Only 3 flags system flags prevent unprivileged processes from modifying (user) flags. Only the same 3 system flags prevent privileged processes from modifying flags if securelevel > 0. These 3 flags are listed correctly in the man page, except they are listed 3 times (in the part that you changed, and in the [EPERM] description for each of chflags(2) and chflags(3)). Triplicating this is a good source of errors. There is no logic inversion or off-by-1 error in the [EPERM] parts. @ if (!priv_check_cred(cred, PRIV_VFS_SYSFLAGS, 0)) { The man page still uses the old term "super-user", while the code uses "privileged" (in comments too). We get here if we have privilege. The logic for the test is obfuscated uses boolean '!' for a non-boolean. @ if (ip->i_flags & @ (SF_NOUNLINK | SF_IMMUTABLE | SF_APPEND)) { @ error = securelevel_gt(cred, 0); @ if (error) @ return (error); @ } This checks for flags already set (in the inode). Not ones that we are trying to set. When none is set, we don't even look at securelevel. We get here even if securelevel > 0 if none of the 3 flags is already set. Same as in 4.4BSD-Lite1. The old man page is correct. @ /* The snapshot flag cannot be toggled. */ @ if ((vap->va_flags ^ ip->i_flags) & SF_SNAPSHOT) @ return (EPERM); After this, all changes to the flags are permitted. When securelevel > 0, the toggling that they do must actually be setting for the 3 special flags. A final toggling of the other flags is possible in the same step as setting one of the 3 special flags. @ } else { 3 special flags is 1 or 2 too many. In my version, SF_NOUNLINK doesn't give immutability for flags. It just prevents unlink(), rename() and rmdir(). In all versions, it doesn't prevent chown(), chmod(), utimes(), link() or truncating the file, so why should it prevent chflags()? If you want immutability then you should use SF_IMMUTABLE. Perhaps similarly for SF_APPEND, but since it is a positive logic flag its semantics can be read as append *only*, and that is in fact what it does. It prevents chown(), chmod(), utimes(), link() and truncating the file (at least for [f]truncate(2) on regular files). The man page doesn't give many details of what append and nounlink flags do. It says that *F_APPEND means that the file may only be appended to. This covers all of the above preventions, but also literally says that the file may not be read, or cntled, or even opened... It says that *F_NOUNLINK means that the file may not be renamed or deleted, then (mis)describes how it it also gives immutability of the flags. This seems to cover all the things that it prevents. Nearby I noticed bad wording for SF_ARCHIVED. It says "may". For all the other descriptions, "may" means permission. Here it means that no one knows what it means, but it might mean that an old version of the file might have been archived. msdosfs clears this flag when the file is changed (at least for write()), but ffs doesn't, so you can never trust it for ffs. Bruce From owner-svn-src-head@FreeBSD.ORG Sat Feb 9 21:36:15 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id D79E9350; Sat, 9 Feb 2013 21:36:15 +0000 (UTC) (envelope-from kientzle@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id CA64394B; Sat, 9 Feb 2013 21:36:15 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r19LaFS2084600; Sat, 9 Feb 2013 21:36:15 GMT (envelope-from kientzle@svn.freebsd.org) Received: (from kientzle@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r19LaFlv084599; Sat, 9 Feb 2013 21:36:15 GMT (envelope-from kientzle@svn.freebsd.org) Message-Id: <201302092136.r19LaFlv084599@svn.freebsd.org> From: Tim Kientzle Date: Sat, 9 Feb 2013 21:36:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r246601 - head/sys/arm/arm X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 09 Feb 2013 21:36:15 -0000 Author: kientzle Date: Sat Feb 9 21:36:14 2013 New Revision: 246601 URL: http://svnweb.freebsd.org/changeset/base/246601 Log: Fix breakage introduced in r246318. Modified: head/sys/arm/arm/vm_machdep.c Modified: head/sys/arm/arm/vm_machdep.c ============================================================================== --- head/sys/arm/arm/vm_machdep.c Sat Feb 9 18:14:26 2013 (r246600) +++ head/sys/arm/arm/vm_machdep.c Sat Feb 9 21:36:14 2013 (r246601) @@ -402,7 +402,8 @@ cpu_thread_alloc(struct thread *td) * the ARM EABI. */ td->td_frame = (struct trapframe *)STACKALIGN((u_int)td->td_kstack + - USPACE_SVC_STACK_TOP - sizeof(struct pcb) - 1); + USPACE_SVC_STACK_TOP - sizeof(struct pcb) - + sizeof(struct trapframe)); #ifdef __XSCALE__ #ifndef CPU_XSCALE_CORE3 pmap_use_minicache(td->td_kstack, td->td_kstack_pages * PAGE_SIZE); From owner-svn-src-head@FreeBSD.ORG Sat Feb 9 23:17:29 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 242765CA; Sat, 9 Feb 2013 23:17:29 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 004B2D2B; Sat, 9 Feb 2013 23:17:28 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r19NHSIf015040; Sat, 9 Feb 2013 23:17:28 GMT (envelope-from brooks@svn.freebsd.org) Received: (from brooks@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r19NHSPO015039; Sat, 9 Feb 2013 23:17:28 GMT (envelope-from brooks@svn.freebsd.org) Message-Id: <201302092317.r19NHSPO015039@svn.freebsd.org> From: Brooks Davis Date: Sat, 9 Feb 2013 23:17:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r246602 - head X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 09 Feb 2013 23:17:29 -0000 Author: brooks Date: Sat Feb 9 23:17:28 2013 New Revision: 246602 URL: http://svnweb.freebsd.org/changeset/base/246602 Log: Add nmtree to ITOOLS if it is installed on the host instead of keying off the BOOTSTRAPPING variable. The previous test was wrong because BOOTSTRAPPING is 0 in most cases. Tested by: db Modified: head/Makefile.inc1 Modified: head/Makefile.inc1 ============================================================================== --- head/Makefile.inc1 Sat Feb 9 21:36:14 2013 (r246601) +++ head/Makefile.inc1 Sat Feb 9 23:17:28 2013 (r246602) @@ -673,6 +673,10 @@ _install-info= install-info _zoneinfo= zic tzsetup .endif +.if exists(/usr/sbin/nmtree) +_nmtree_itools= nmtree +.endif + ITOOLS= [ awk cap_mkdb cat chflags chmod chown \ date echo egrep find grep id install ${_install-info} \ ln lockf make mkdir mtree ${_nmtree_itools} mv pwd_mkdb \ @@ -1134,8 +1138,6 @@ _yacc= usr.bin/yacc .if ${BOOTSTRAPPING} < 1000026 _nmtree= lib/libnetbsd \ usr.sbin/nmtree -.else -_nmtree_itools= nmtree .endif .if ${BOOTSTRAPPING} < 1000027