From owner-svn-src-all@FreeBSD.ORG Sun Jan 22 01:11:07 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 80D4A106566B; Sun, 22 Jan 2012 01:11:07 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 60EE38FC08; Sun, 22 Jan 2012 01:11:07 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q0M1B7vx017335; Sun, 22 Jan 2012 01:11:07 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0M1B7rt017333; Sun, 22 Jan 2012 01:11:07 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201201220111.q0M1B7rt017333@svn.freebsd.org> From: Konstantin Belousov Date: Sun, 22 Jan 2012 01:11:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r230441 - head/sys/kern X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 22 Jan 2012 01:11:07 -0000 Author: kib Date: Sun Jan 22 01:11:06 2012 New Revision: 230441 URL: http://svn.freebsd.org/changeset/base/230441 Log: Remove the nc_time and nc_ticks elements from struct namecache, and provide struct namecache_ts which is the old struct namecache. Only allocate struct namecache_ts if non-null struct timespec *tsp was passed to cache_enter_time, otherwise use struct namecache. Change struct namecache allocation and deallocation macros into static functions, since logic becomes somewhat twisty. Provide accessor for the nc_name member of struct namecache to hide difference between struct namecache and namecache_ts. The aim of the change is to not waste 20 bytes per small namecache entry. Reviewed by: jhb MFC after: 2 weeks X-MFC-note: after r230394 Modified: head/sys/kern/vfs_cache.c Modified: head/sys/kern/vfs_cache.c ============================================================================== --- head/sys/kern/vfs_cache.c Sat Jan 21 22:18:33 2012 (r230440) +++ head/sys/kern/vfs_cache.c Sun Jan 22 01:11:06 2012 (r230441) @@ -97,14 +97,36 @@ struct namecache { TAILQ_ENTRY(namecache) nc_dst; /* destination vnode list */ struct vnode *nc_dvp; /* vnode of parent of name */ struct vnode *nc_vp; /* vnode the name refers to */ - struct timespec nc_time; /* timespec provided by fs */ - int nc_ticks; /* ticks value when entry was added */ u_char nc_flag; /* flag bits */ u_char nc_nlen; /* length of name */ char nc_name[0]; /* segment name + nul */ }; /* + * struct namecache_ts repeats struct namecache layout up to the + * nc_nlen member. + */ +struct namecache_ts { + LIST_ENTRY(namecache) nc_hash; /* hash chain */ + LIST_ENTRY(namecache) nc_src; /* source vnode list */ + TAILQ_ENTRY(namecache) nc_dst; /* destination vnode list */ + struct vnode *nc_dvp; /* vnode of parent of name */ + struct vnode *nc_vp; /* vnode the name refers to */ + u_char nc_flag; /* flag bits */ + u_char nc_nlen; /* length of name */ + struct timespec nc_time; /* timespec provided by fs */ + int nc_ticks; /* ticks value when entry was added */ + char nc_name[0]; /* segment name + nul */ +}; + +/* + * Flags in namecache.nc_flag + */ +#define NCF_WHITE 0x01 +#define NCF_ISDOTDOT 0x02 +#define NCF_TS 0x04 + +/* * Name caching works as follows: * * Names found by directory scans are retained in a cache @@ -166,20 +188,50 @@ RW_SYSINIT(vfscache, &cache_lock, "Name * fit in the small cache. */ static uma_zone_t cache_zone_small; +static uma_zone_t cache_zone_small_ts; static uma_zone_t cache_zone_large; #define CACHE_PATH_CUTOFF 35 -#define CACHE_ZONE_SMALL (sizeof(struct namecache) + CACHE_PATH_CUTOFF \ - + 1) -#define CACHE_ZONE_LARGE (sizeof(struct namecache) + NAME_MAX + 1) - -#define cache_alloc(len) uma_zalloc(((len) <= CACHE_PATH_CUTOFF) ? \ - cache_zone_small : cache_zone_large, M_WAITOK) -#define cache_free(ncp) do { \ - if (ncp != NULL) \ - uma_zfree(((ncp)->nc_nlen <= CACHE_PATH_CUTOFF) ? \ - cache_zone_small : cache_zone_large, (ncp)); \ -} while (0) + +static struct namecache * +cache_alloc(int len, int ts) +{ + + if (len > CACHE_PATH_CUTOFF) + return (uma_zalloc(cache_zone_large, M_WAITOK)); + if (ts) + return (uma_zalloc(cache_zone_small_ts, M_WAITOK)); + else + return (uma_zalloc(cache_zone_small, M_WAITOK)); +} + +static void +cache_free(struct namecache *ncp) +{ + int ts; + + if (ncp == NULL) + return; + ts = ncp->nc_flag & NCF_TS; + if (ncp->nc_nlen <= CACHE_PATH_CUTOFF) { + if (ts) + uma_zfree(cache_zone_small_ts, ncp); + else + uma_zfree(cache_zone_small, ncp); + } else + uma_zfree(cache_zone_large, ncp); +} + +static char * +nc_get_name(struct namecache *ncp) +{ + struct namecache_ts *ncp_ts; + + if ((ncp->nc_flag & NCF_TS) == 0) + return (ncp->nc_name); + ncp_ts = (struct namecache_ts *)ncp; + return (ncp_ts->nc_name); +} static int doingcache = 1; /* 1 => enable the cache */ SYSCTL_INT(_debug, OID_AUTO, vfscache, CTLFLAG_RW, &doingcache, 0, @@ -235,12 +287,6 @@ static int vn_fullpath1(struct thread *t static MALLOC_DEFINE(M_VFSCACHE, "vfscache", "VFS name cache entries"); -/* - * Flags in namecache.nc_flag - */ -#define NCF_WHITE 0x01 -#define NCF_ISDOTDOT 0x02 - #ifdef DIAGNOSTIC /* * Grab an atomic snapshot of the name cache hash chain lengths @@ -346,10 +392,10 @@ cache_zap(ncp) #ifdef KDTRACE_HOOKS if (ncp->nc_vp != NULL) { SDT_PROBE(vfs, namecache, zap, done, ncp->nc_dvp, - ncp->nc_name, ncp->nc_vp, 0, 0); + nc_get_name(ncp), ncp->nc_vp, 0, 0); } else { SDT_PROBE(vfs, namecache, zap_negative, done, ncp->nc_dvp, - ncp->nc_name, 0, 0, 0); + nc_get_name(ncp), 0, 0, 0); } #endif vp = NULL; @@ -460,10 +506,17 @@ retry_wlocked: dvp, cnp->cn_nameptr, *vpp); SDT_PROBE(vfs, namecache, lookup, hit, dvp, "..", *vpp, 0, 0); - if (tsp != NULL) - *tsp = ncp->nc_time; - if (ticksp != NULL) - *ticksp = ncp->nc_ticks; + if (tsp != NULL) { + KASSERT((ncp->nc_flag & NCF_TS) != 0, + ("No NCF_TS")); + *tsp = ((struct namecache_ts *)ncp)->nc_time; + } + if (ticksp != NULL) { + KASSERT((ncp->nc_flag & NCF_TS) != 0, + ("No NCF_TS")); + *ticksp = ((struct namecache_ts *)ncp)-> + nc_ticks; + } goto success; } } @@ -473,7 +526,7 @@ retry_wlocked: LIST_FOREACH(ncp, (NCHHASH(hash)), nc_hash) { numchecks++; if (ncp->nc_dvp == dvp && ncp->nc_nlen == cnp->cn_namelen && - !bcmp(ncp->nc_name, cnp->cn_nameptr, ncp->nc_nlen)) + !bcmp(nc_get_name(ncp), cnp->cn_nameptr, ncp->nc_nlen)) break; } @@ -508,12 +561,16 @@ retry_wlocked: *vpp = ncp->nc_vp; CTR4(KTR_VFS, "cache_lookup(%p, %s) found %p via ncp %p", dvp, cnp->cn_nameptr, *vpp, ncp); - SDT_PROBE(vfs, namecache, lookup, hit, dvp, ncp->nc_name, + SDT_PROBE(vfs, namecache, lookup, hit, dvp, nc_get_name(ncp), *vpp, 0, 0); - if (tsp != NULL) - *tsp = ncp->nc_time; - if (ticksp != NULL) - *ticksp = ncp->nc_ticks; + if (tsp != NULL) { + KASSERT((ncp->nc_flag & NCF_TS) != 0, ("No NCF_TS")); + *tsp = ((struct namecache_ts *)ncp)->nc_time; + } + if (ticksp != NULL) { + KASSERT((ncp->nc_flag & NCF_TS) != 0, ("No NCF_TS")); + *ticksp = ((struct namecache_ts *)ncp)->nc_ticks; + } goto success; } @@ -543,12 +600,16 @@ negative_success: nchstats.ncs_neghits++; if (ncp->nc_flag & NCF_WHITE) cnp->cn_flags |= ISWHITEOUT; - SDT_PROBE(vfs, namecache, lookup, hit_negative, dvp, ncp->nc_name, + SDT_PROBE(vfs, namecache, lookup, hit_negative, dvp, nc_get_name(ncp), 0, 0, 0); - if (tsp != NULL) - *tsp = ncp->nc_time; - if (ticksp != NULL) - *ticksp = ncp->nc_ticks; + if (tsp != NULL) { + KASSERT((ncp->nc_flag & NCF_TS) != 0, ("No NCF_TS")); + *tsp = ((struct namecache_ts *)ncp)->nc_time; + } + if (ticksp != NULL) { + KASSERT((ncp->nc_flag & NCF_TS) != 0, ("No NCF_TS")); + *ticksp = ((struct namecache_ts *)ncp)->nc_ticks; + } CACHE_WUNLOCK(); return (ENOENT); @@ -642,6 +703,7 @@ cache_enter_time(dvp, vp, cnp, tsp) struct timespec *tsp; { struct namecache *ncp, *n2; + struct namecache_ts *n3; struct nchashhead *ncpp; uint32_t hash; int flag; @@ -708,18 +770,19 @@ cache_enter_time(dvp, vp, cnp, tsp) * Calculate the hash key and setup as much of the new * namecache entry as possible before acquiring the lock. */ - ncp = cache_alloc(cnp->cn_namelen); + ncp = cache_alloc(cnp->cn_namelen, tsp != NULL); ncp->nc_vp = vp; ncp->nc_dvp = dvp; ncp->nc_flag = flag; - if (tsp != NULL) - ncp->nc_time = *tsp; - else - timespecclear(&ncp->nc_time); - ncp->nc_ticks = ticks; + if (tsp != NULL) { + n3 = (struct namecache_ts *)ncp; + n3->nc_time = *tsp; + n3->nc_ticks = ticks; + n3->nc_flag |= NCF_TS; + } len = ncp->nc_nlen = cnp->cn_namelen; hash = fnv_32_buf(cnp->cn_nameptr, len, FNV1_32_INIT); - strlcpy(ncp->nc_name, cnp->cn_nameptr, len + 1); + strlcpy(nc_get_name(ncp), cnp->cn_nameptr, len + 1); hash = fnv_32_buf(&dvp, sizeof(dvp), hash); CACHE_WLOCK(); @@ -732,9 +795,16 @@ cache_enter_time(dvp, vp, cnp, tsp) LIST_FOREACH(n2, ncpp, nc_hash) { if (n2->nc_dvp == dvp && n2->nc_nlen == cnp->cn_namelen && - !bcmp(n2->nc_name, cnp->cn_nameptr, n2->nc_nlen)) { - n2->nc_time = ncp->nc_time; - n2->nc_ticks = ncp->nc_ticks; + !bcmp(nc_get_name(n2), cnp->cn_nameptr, n2->nc_nlen)) { + if (tsp != NULL) { + KASSERT((n2->nc_flag & NCF_TS) != 0, + ("no NCF_TS")); + n3 = (struct namecache_ts *)n2; + n3->nc_time = + ((struct namecache_ts *)ncp)->nc_time; + n3->nc_ticks = + ((struct namecache_ts *)ncp)->nc_ticks; + } CACHE_WUNLOCK(); cache_free(ncp); return; @@ -792,12 +862,12 @@ cache_enter_time(dvp, vp, cnp, tsp) */ if (vp) { TAILQ_INSERT_HEAD(&vp->v_cache_dst, ncp, nc_dst); - SDT_PROBE(vfs, namecache, enter, done, dvp, ncp->nc_name, vp, - 0, 0); + SDT_PROBE(vfs, namecache, enter, done, dvp, nc_get_name(ncp), + vp, 0, 0); } else { TAILQ_INSERT_TAIL(&ncneg, ncp, nc_dst); SDT_PROBE(vfs, namecache, enter_negative, done, dvp, - ncp->nc_name, 0, 0, 0); + nc_get_name(ncp), 0, 0, 0); } if (numneg * ncnegfactor > numcache) { ncp = TAILQ_FIRST(&ncneg); @@ -819,10 +889,15 @@ nchinit(void *dummy __unused) TAILQ_INIT(&ncneg); - cache_zone_small = uma_zcreate("S VFS Cache", CACHE_ZONE_SMALL, NULL, - NULL, NULL, NULL, UMA_ALIGN_PTR, UMA_ZONE_ZINIT); - cache_zone_large = uma_zcreate("L VFS Cache", CACHE_ZONE_LARGE, NULL, - NULL, NULL, NULL, UMA_ALIGN_PTR, UMA_ZONE_ZINIT); + cache_zone_small = uma_zcreate("S VFS Cache", + sizeof(struct namecache) + CACHE_PATH_CUTOFF + 1, + NULL, NULL, NULL, NULL, UMA_ALIGN_PTR, UMA_ZONE_ZINIT); + cache_zone_small_ts = uma_zcreate("STS VFS Cache", + sizeof(struct namecache_ts) + CACHE_PATH_CUTOFF + 1, + NULL, NULL, NULL, NULL, UMA_ALIGN_PTR, UMA_ZONE_ZINIT); + cache_zone_large = uma_zcreate("L VFS Cache", + sizeof(struct namecache_ts) + NAME_MAX + 1, + NULL, NULL, NULL, NULL, UMA_ALIGN_PTR, UMA_ZONE_ZINIT); nchashtbl = hashinit(desiredvnodes * 2, M_VFSCACHE, &nchash); } @@ -1126,9 +1201,9 @@ vn_vptocnp_locked(struct vnode **vp, str return (error); } *buflen -= ncp->nc_nlen; - memcpy(buf + *buflen, ncp->nc_name, ncp->nc_nlen); + memcpy(buf + *buflen, nc_get_name(ncp), ncp->nc_nlen); SDT_PROBE(vfs, namecache, fullpath, hit, ncp->nc_dvp, - ncp->nc_name, vp, 0, 0); + nc_get_name(ncp), vp, 0, 0); dvp = *vp; *vp = ncp->nc_dvp; vref(*vp); @@ -1301,7 +1376,7 @@ vn_commname(struct vnode *vp, char *buf, return (ENOENT); } l = min(ncp->nc_nlen, buflen - 1); - memcpy(buf, ncp->nc_name, l); + memcpy(buf, nc_get_name(ncp), l); CACHE_RUNLOCK(); buf[l] = '\0'; return (0); From owner-svn-src-all@FreeBSD.ORG Sun Jan 22 02:13:20 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 569B5106564A; Sun, 22 Jan 2012 02:13:20 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 39D4E8FC1F; Sun, 22 Jan 2012 02:13:20 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q0M2DKCV019212; Sun, 22 Jan 2012 02:13:20 GMT (envelope-from bz@svn.freebsd.org) Received: (from bz@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0M2DJgA019206; Sun, 22 Jan 2012 02:13:19 GMT (envelope-from bz@svn.freebsd.org) Message-Id: <201201220213.q0M2DJgA019206@svn.freebsd.org> From: "Bjoern A. Zeeb" Date: Sun, 22 Jan 2012 02:13:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r230442 - in head/sys: netinet netinet6 netipsec X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 22 Jan 2012 02:13:20 -0000 Author: bz Date: Sun Jan 22 02:13:19 2012 New Revision: 230442 URL: http://svn.freebsd.org/changeset/base/230442 Log: Clean up some #endif comments removing from short sections. Add #endif comments to longer, also refining strange ones. Properly use #ifdef rather than #if defined() where possible. Four #if defined(PCBGROUP) occurances (netinet and netinet6) were ignored to avoid conflicts with eventually upcoming changes for RSS. Reported by: bde (most) Reviewed by: bde MFC after: 3 days Modified: head/sys/netinet/if_ether.c head/sys/netinet/in_pcb.c head/sys/netinet/ip_ipsec.c head/sys/netinet6/ip6_ipsec.c head/sys/netipsec/xform_ipip.c Modified: head/sys/netinet/if_ether.c ============================================================================== --- head/sys/netinet/if_ether.c Sun Jan 22 01:11:06 2012 (r230441) +++ head/sys/netinet/if_ether.c Sun Jan 22 02:13:19 2012 (r230442) @@ -64,7 +64,7 @@ __FBSDID("$FreeBSD$"); #include #include #include -#if defined(INET) +#ifdef INET #include #endif Modified: head/sys/netinet/in_pcb.c ============================================================================== --- head/sys/netinet/in_pcb.c Sun Jan 22 01:11:06 2012 (r230441) +++ head/sys/netinet/in_pcb.c Sun Jan 22 02:13:19 2012 (r230442) @@ -196,7 +196,7 @@ SYSCTL_VNET_INT(_net_inet_ip_portrange, &VNET_NAME(ipport_randomtime), 0, "Minimum time to keep sequental port " "allocation before switching to a random one"); -#endif +#endif /* INET */ /* * in_pcb.c: manage the Protocol Control Blocks. @@ -1038,7 +1038,7 @@ in_pcbdisconnect(struct inpcb *inp) inp->inp_fport = 0; in_pcbrehash(inp); } -#endif +#endif /* INET */ /* * in_pcbdetach() is responsibe for disassociating a socket from an inpcb. @@ -1169,7 +1169,7 @@ in_pcbfree(struct inpcb *inp) #ifdef IPSEC if (inp->inp_sp != NULL) ipsec_delete_pcbpolicy(inp); -#endif /* IPSEC */ +#endif inp->inp_gencnt = ++pcbinfo->ipi_gencnt; in_pcbremlists(inp); #ifdef INET6 @@ -1586,7 +1586,7 @@ in_pcblookup_group(struct inpcbinfo *pcb if (inp->inp_vflag & INP_IPV6PROTO) local_wild_mapped = inp; else -#endif /* INET6 */ +#endif if (injail) jail_wild = inp; else @@ -1601,7 +1601,7 @@ in_pcblookup_group(struct inpcbinfo *pcb #ifdef INET6 if (inp == NULL) inp = local_wild_mapped; -#endif /* defined(INET6) */ +#endif if (inp != NULL) goto found; } /* if (lookupflags & INPLOOKUP_WILDCARD) */ @@ -1731,7 +1731,7 @@ in_pcblookup_hash_locked(struct inpcbinf if (inp->inp_vflag & INP_IPV6PROTO) local_wild_mapped = inp; else -#endif /* INET6 */ +#endif if (injail) jail_wild = inp; else @@ -1747,7 +1747,7 @@ in_pcblookup_hash_locked(struct inpcbinf #ifdef INET6 if (local_wild_mapped != NULL) return (local_wild_mapped); -#endif /* defined(INET6) */ +#endif } /* if ((lookupflags & INPLOOKUP_WILDCARD) != 0) */ return (NULL); @@ -1871,7 +1871,7 @@ in_pcbinshash_internal(struct inpcb *inp if (inp->inp_vflag & INP_IPV6) hashkey_faddr = inp->in6p_faddr.s6_addr32[3] /* XXX */; else -#endif /* INET6 */ +#endif hashkey_faddr = inp->inp_faddr.s_addr; pcbhash = &pcbinfo->ipi_hashbase[INP_PCBHASH(hashkey_faddr, @@ -1958,7 +1958,7 @@ in_pcbrehash_mbuf(struct inpcb *inp, str if (inp->inp_vflag & INP_IPV6) hashkey_faddr = inp->in6p_faddr.s6_addr32[3] /* XXX */; else -#endif /* INET6 */ +#endif hashkey_faddr = inp->inp_faddr.s_addr; head = &pcbinfo->ipi_hashbase[INP_PCBHASH(hashkey_faddr, @@ -2226,14 +2226,13 @@ db_print_inconninfo(struct in_conninfo * /* IPv6. */ ip6_sprintf(laddr_str, &inc->inc6_laddr); ip6_sprintf(faddr_str, &inc->inc6_faddr); - } else { + } else #endif + { /* IPv4. */ inet_ntoa_r(inc->inc_laddr, laddr_str); inet_ntoa_r(inc->inc_faddr, faddr_str); -#ifdef INET6 } -#endif db_print_indent(indent); db_printf("inc_laddr %s inc_lport %u\n", laddr_str, ntohs(inc->inc_lport)); @@ -2446,4 +2445,4 @@ DB_SHOW_COMMAND(inpcb, db_show_inpcb) db_print_inpcb(inp, "inpcb", 0); } -#endif +#endif /* DDB */ Modified: head/sys/netinet/ip_ipsec.c ============================================================================== --- head/sys/netinet/ip_ipsec.c Sun Jan 22 01:11:06 2012 (r230441) +++ head/sys/netinet/ip_ipsec.c Sun Jan 22 02:13:19 2012 (r230442) @@ -92,7 +92,7 @@ SYSCTL_VNET_INT(_net_inet_ipsec, OID_AUT int ip_ipsec_filtertunnel(struct mbuf *m) { -#if defined(IPSEC) +#ifdef IPSEC /* * Bypass packet filtering for packets previously handled by IPsec. Modified: head/sys/netinet6/ip6_ipsec.c ============================================================================== --- head/sys/netinet6/ip6_ipsec.c Sun Jan 22 01:11:06 2012 (r230441) +++ head/sys/netinet6/ip6_ipsec.c Sun Jan 22 02:13:19 2012 (r230442) @@ -103,7 +103,7 @@ SYSCTL_VNET_INT(_net_inet6_ipsec6, OID_A int ip6_ipsec_filtertunnel(struct mbuf *m) { -#if defined(IPSEC) +#ifdef IPSEC /* * Bypass packet filtering for packets previously handled by IPsec. Modified: head/sys/netipsec/xform_ipip.c ============================================================================== --- head/sys/netipsec/xform_ipip.c Sun Jan 22 01:11:06 2012 (r230441) +++ head/sys/netipsec/xform_ipip.c Sun Jan 22 02:13:19 2012 (r230442) @@ -687,7 +687,7 @@ static struct ip6protosw ipe6_protosw = }; #endif /* INET6 && INET */ -#if defined(INET) +#ifdef INET /* * Check the encapsulated packet to see if we want it */ From owner-svn-src-all@FreeBSD.ORG Sun Jan 22 02:16:32 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3DEAC106566C; Sun, 22 Jan 2012 02:16:32 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 084B68FC12; Sun, 22 Jan 2012 02:16:32 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q0M2GVL7019412; Sun, 22 Jan 2012 02:16:31 GMT (envelope-from bz@svn.freebsd.org) Received: (from bz@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0M2GVwT019408; Sun, 22 Jan 2012 02:16:31 GMT (envelope-from bz@svn.freebsd.org) Message-Id: <201201220216.q0M2GVwT019408@svn.freebsd.org> From: "Bjoern A. Zeeb" Date: Sun, 22 Jan 2012 02:16:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r230443 - in head/sys: modules modules/ipdivert netinet X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 22 Jan 2012 02:16:32 -0000 Author: bz Date: Sun Jan 22 02:16:31 2012 New Revision: 230443 URL: http://svn.freebsd.org/changeset/base/230443 Log: Fix ip_divert handling of inet and inet6 and module building some more. Properly sort the "carp" case in modules/Makefile after it was renamed. Reported by: bde (most) Reviewed by: bde MFC after: 3 days Modified: head/sys/modules/Makefile head/sys/modules/ipdivert/Makefile head/sys/netinet/ip_divert.c Modified: head/sys/modules/Makefile ============================================================================== --- head/sys/modules/Makefile Sun Jan 22 02:13:19 2012 (r230442) +++ head/sys/modules/Makefile Sun Jan 22 02:16:31 2012 (r230443) @@ -136,7 +136,7 @@ SUBDIR= ${_3dfx} \ ${_igb} \ ${_iir} \ ${_io} \ - ipdivert \ + ${_ipdivert} \ ${_ipfilter} \ ${_ipfw} \ ipfw_nat \ @@ -370,20 +370,21 @@ _random= random .endif .endif -.if ${MK_INET_SUPPORT} != "no" || defined(ALL_MODULES) -_if_gre= if_gre -.endif - .if (${MK_INET_SUPPORT} != "no" || ${MK_INET6_SUPPORT} != "no") || \ defined(ALL_MODULES) _carp= carp .endif +.if ${MK_INET_SUPPORT} != "no" || defined(ALL_MODULES) +_if_gre= if_gre +.endif + .if ${MK_IPFILTER} != "no" || defined(ALL_MODULES) _ipfilter= ipfilter .endif .if ${MK_INET_SUPPORT} != "no" || defined(ALL_MODULES) +_ipdivert= ipdivert _ipfw= ipfw .endif Modified: head/sys/modules/ipdivert/Makefile ============================================================================== --- head/sys/modules/ipdivert/Makefile Sun Jan 22 02:13:19 2012 (r230442) +++ head/sys/modules/ipdivert/Makefile Sun Jan 22 02:16:31 2012 (r230443) @@ -1,13 +1,21 @@ # $FreeBSD$ +.include + .PATH: ${.CURDIR}/../../netinet KMOD= ipdivert -SRCS= ip_divert.c opt_inet6.h +SRCS= ip_divert.c opt_inet.h opt_inet6.h .if !defined(KERNBUILDDIR) +.if ${MK_INET_SUPPORT} != "no" +opt_inet.h: + echo "#define INET 1" > ${.TARGET} +.endif +.if ${MK_INET6_SUPPORT} != "no" opt_inet6.h: echo "#define INET6 1" > ${.TARGET} .endif +.endif .include Modified: head/sys/netinet/ip_divert.c ============================================================================== --- head/sys/netinet/ip_divert.c Sun Jan 22 02:13:19 2012 (r230442) +++ head/sys/netinet/ip_divert.c Sun Jan 22 02:16:31 2012 (r230443) @@ -30,14 +30,12 @@ #include __FBSDID("$FreeBSD$"); -#if !defined(KLD_MODULE) #include "opt_inet.h" +#include "opt_inet6.h" #include "opt_sctp.h" #ifndef INET #error "IPDIVERT requires INET." #endif -#endif -#include "opt_inet6.h" #include #include From owner-svn-src-all@FreeBSD.ORG Sun Jan 22 03:41:04 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 27C06106566B; Sun, 22 Jan 2012 03:41:04 +0000 (UTC) (envelope-from adrian.chadd@gmail.com) Received: from mail-vx0-f182.google.com (mail-vx0-f182.google.com [209.85.220.182]) by mx1.freebsd.org (Postfix) with ESMTP id 4B9088FC13; Sun, 22 Jan 2012 03:41:03 +0000 (UTC) Received: by vcbfl17 with SMTP id fl17so1891268vcb.13 for ; Sat, 21 Jan 2012 19:41:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type; bh=Cxk9tVnkhjl/ZNDvNFri+8tvpxlqdo+xTMFLGMXLRm4=; b=FdaMV8jdX4MtF+rYm5m/UPteVhjQHTU0z7nSPBehZfEJPy8FThAAxUXEbCgppd/k04 tJsqFIJhypERKHhYVH0P6xP3JY27EzzHggVShyopMZIh9dYdLdmZm55k2VwQFNzZ4cx7 oAyKhuIdDMuwpJdvu55XL+DICah2G6lWzY6Pc= MIME-Version: 1.0 Received: by 10.220.154.2 with SMTP id m2mr1917327vcw.27.1327203662773; Sat, 21 Jan 2012 19:41:02 -0800 (PST) Sender: adrian.chadd@gmail.com Received: by 10.52.36.5 with HTTP; Sat, 21 Jan 2012 19:41:02 -0800 (PST) In-Reply-To: <20120121200533.GD1723@garage.freebsd.pl> References: <201201080055.q080tMlJ063808@svn.freebsd.org> <20120108104330.GC1674@garage.freebsd.pl> <20120121200533.GD1723@garage.freebsd.pl> Date: Sat, 21 Jan 2012 19:41:02 -0800 X-Google-Sender-Auth: zRVj6U7Qd4SOYeZRhkRDV5Wjnu8 Message-ID: From: Adrian Chadd To: Pawel Jakub Dawidek Content-Type: text/plain; charset=ISO-8859-1 X-Content-Filtered-By: Mailman/MimeDel 2.1.5 Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r229800 - head/sys/conf X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 22 Jan 2012 03:41:04 -0000 Hi, I'm sorry I got distracted by other things. I'll see about creating a kld with all of this code in it and set the depedencies appropriately. adrian From owner-svn-src-all@FreeBSD.ORG Sun Jan 22 03:43:39 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 694A6106566C; Sun, 22 Jan 2012 03:43:39 +0000 (UTC) (envelope-from adrian.chadd@gmail.com) Received: from mail-vw0-f54.google.com (mail-vw0-f54.google.com [209.85.212.54]) by mx1.freebsd.org (Postfix) with ESMTP id DF4948FC15; Sun, 22 Jan 2012 03:43:38 +0000 (UTC) Received: by vbbey12 with SMTP id ey12so1882394vbb.13 for ; Sat, 21 Jan 2012 19:43:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type; bh=X/KwV8Gyc+oK4exm3IoY0WLOKf/UAWc8Me6qkmFS4pw=; b=GBhUGNoTfJZXh5xEvn9mTvAtXeQ7OcIosuDcFJI16lGf7b0O9LuQ8drVW9PSxbZ7R3 9TeCRZ34vMOvSbJ4XlM+idE6aL6PkcSFMB7fznF7xQ0Twrbba3d/C8mp3agBbCpInlRG K3xEqe+S6F4yqI3Dp5nFu74zss2OoDPJku934= MIME-Version: 1.0 Received: by 10.52.94.33 with SMTP id cz1mr1554153vdb.132.1327203818151; Sat, 21 Jan 2012 19:43:38 -0800 (PST) Sender: adrian.chadd@gmail.com Received: by 10.52.36.5 with HTTP; Sat, 21 Jan 2012 19:43:38 -0800 (PST) In-Reply-To: References: <201201210038.q0L0cJac066145@svn.freebsd.org> Date: Sat, 21 Jan 2012 19:43:38 -0800 X-Google-Sender-Auth: jdlM9U85oK5qcQ6GWFh19fhwMzE Message-ID: From: Adrian Chadd To: Rui Paulo Content-Type: text/plain; charset=ISO-8859-1 X-Content-Filtered-By: Mailman/MimeDel 2.1.5 Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r230408 - head/sys/net80211 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 22 Jan 2012 03:43:39 -0000 On 20 January 2012 18:41, Rui Paulo wrote: > This commit doesn't help much and keeps us more toolchain dependent like > Alexander pointed out in IRC. Since ether_sprintf() wasn't causing any > trouble, please consider backing this out. > > This commit also introduces unnecessary changes which make reviewing > harder. > Hi, I'd like to eventually move away from doing it this way. The trouble is using ether_sprintf() multiple times (and even from multiple threads?) in the same debug statement results in non-useful behaviour. What I'm likely going to do is introduce an ether_ssprintf() which takes a char/len buffer to write into. That way the debug statements can just use that (with appropriate wrappers around them to only call ether_ssprintf() if the debug condition is met, otherwise unused sprintf()s will occur. I'm open to other suggestions though! Adrian From owner-svn-src-all@FreeBSD.ORG Sun Jan 22 03:46:58 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D095D106566B; Sun, 22 Jan 2012 03:46:58 +0000 (UTC) (envelope-from adrian.chadd@gmail.com) Received: from mail-vw0-f54.google.com (mail-vw0-f54.google.com [209.85.212.54]) by mx1.freebsd.org (Postfix) with ESMTP id 647D38FC0C; Sun, 22 Jan 2012 03:46:58 +0000 (UTC) Received: by vbbey12 with SMTP id ey12so1883263vbb.13 for ; Sat, 21 Jan 2012 19:46:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type; bh=vF8sdXTqFfAChWrhQSQgtB99PllA29xJWkjtwzrRbPQ=; b=aqSlNgJJ2ttbzdcflnSz483lBdkaWnnodRSWGc56xyzrwV5dvgwSeykKLo02xibthp 1FLb68D8E+TPKaUk0G7J9hEHnlEavRrtuqD7azgTnb2kH+ty724I1awDBNKzUtV/CdzH 0ZgKGOFD2DOBT8p4AWds9VWOoOZ/1GwlF9oU0= MIME-Version: 1.0 Received: by 10.52.24.35 with SMTP id r3mr1597433vdf.81.1327204017810; Sat, 21 Jan 2012 19:46:57 -0800 (PST) Sender: adrian.chadd@gmail.com Received: by 10.52.36.5 with HTTP; Sat, 21 Jan 2012 19:46:57 -0800 (PST) In-Reply-To: <92FCD394-73E5-42A4-BA56-5E39EA36EF75@FreeBSD.org> References: <201201210042.q0L0gTwK066301@svn.freebsd.org> <92FCD394-73E5-42A4-BA56-5E39EA36EF75@FreeBSD.org> Date: Sat, 21 Jan 2012 19:46:57 -0800 X-Google-Sender-Auth: 5xSWVT-UnbHEXXiHQzloVRsWOyo Message-ID: From: Adrian Chadd To: Rui Paulo Content-Type: text/plain; charset=ISO-8859-1 X-Content-Filtered-By: Mailman/MimeDel 2.1.5 Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r230409 - head/sys/net80211 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 22 Jan 2012 03:46:58 -0000 On 20 January 2012 18:42, Rui Paulo wrote: > I tested this exact topology when I implemented HWMP, so I don't know what > went wrong. The commit log doesn't say much about what was wrong and the > code changes are, again, mixed with style changes so I haven't had time to > fully appreciate these changes. > Right. I'm not sure about that either and I'm not yet on top of the mesh/hwmp code. I plan on getting more familiar with it now that the simulator is in the tree. I'm trusting monthadar here. Adrian From owner-svn-src-all@FreeBSD.ORG Sun Jan 22 04:19:04 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9EDD41065672; Sun, 22 Jan 2012 04:19:04 +0000 (UTC) (envelope-from nyan@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 8C2CD8FC14; Sun, 22 Jan 2012 04:19:04 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q0M4J44T023416; Sun, 22 Jan 2012 04:19:04 GMT (envelope-from nyan@svn.freebsd.org) Received: (from nyan@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0M4J4pu023414; Sun, 22 Jan 2012 04:19:04 GMT (envelope-from nyan@svn.freebsd.org) Message-Id: <201201220419.q0M4J4pu023414@svn.freebsd.org> From: Takahashi Yoshihiro Date: Sun, 22 Jan 2012 04:19:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r230444 - stable/9/sys/boot/pc98/libpc98 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 22 Jan 2012 04:19:04 -0000 Author: nyan Date: Sun Jan 22 04:19:03 2012 New Revision: 230444 URL: http://svn.freebsd.org/changeset/base/230444 Log: MFC: revision 229463 MFi386: revision 229435 Add special loader environment variables 'comconsole_port' and 'comconsole_pcidev'. Modified: stable/9/sys/boot/pc98/libpc98/comconsole.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/boot/ (props changed) Modified: stable/9/sys/boot/pc98/libpc98/comconsole.c ============================================================================== --- stable/9/sys/boot/pc98/libpc98/comconsole.c Sun Jan 22 02:16:31 2012 (r230443) +++ stable/9/sys/boot/pc98/libpc98/comconsole.c Sun Jan 22 04:19:03 2012 (r230444) @@ -30,6 +30,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include "libi386.h" #define COMC_FMT 0x3 /* 8N1 */ @@ -49,14 +50,23 @@ 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_parsespeed(const char *string); -static void comc_setup(int speed); +static int comc_parseint(const char *string); +static uint32_t comc_parse_pcidev(const char *string); +static int comc_pcidev_set(struct env_var *ev, int flags, + const void *value); +static int comc_pcidev_handle(uint32_t locator); +static int comc_port_set(struct env_var *ev, int flags, + const void *value); +static void comc_setup(int speed, int port); static int comc_speed_set(struct env_var *ev, int flags, const void *value); static int comc_started; static int comc_curspeed; +static int comc_port = COMPORT; +static uint32_t comc_locator; struct console comconsole = { "comconsole", @@ -72,9 +82,10 @@ struct console comconsole = { static void comc_probe(struct console *cp) { - char speedbuf[16]; - char *cons, *speedenv; - int speed; + char intbuf[16]; + char *cons, *env; + int speed, port; + uint32_t locator; /* XXX check the BIOS equipment list? */ cp->c_flags |= (C_PRESENTIN | C_PRESENTOUT); @@ -90,16 +101,40 @@ comc_probe(struct console *cp) getenv("boot_multicons") != NULL) { comc_curspeed = comc_getspeed(); } - speedenv = getenv("comconsole_speed"); - if (speedenv != NULL) { - speed = comc_parsespeed(speedenv); + + env = getenv("comconsole_speed"); + if (env != NULL) { + speed = comc_parseint(env); if (speed > 0) comc_curspeed = speed; } - sprintf(speedbuf, "%d", comc_curspeed); + sprintf(intbuf, "%d", comc_curspeed); unsetenv("comconsole_speed"); - env_setenv("comconsole_speed", EV_VOLATILE, speedbuf, comc_speed_set, + env_setenv("comconsole_speed", EV_VOLATILE, intbuf, comc_speed_set, + env_nounset); + + env = getenv("comconsole_port"); + if (env != NULL) { + port = comc_parseint(env); + if (port > 0) + comc_port = port; + } + + sprintf(intbuf, "%d", comc_port); + unsetenv("comconsole_port"); + env_setenv("comconsole_port", EV_VOLATILE, intbuf, comc_port_set, + env_nounset); + + env = getenv("comconsole_pcidev"); + if (env != NULL) { + locator = comc_parse_pcidev(env); + if (locator != 0) + comc_pcidev_handle(locator); + } + + unsetenv("comconsole_pcidev"); + env_setenv("comconsole_pcidev", EV_VOLATILE, env, comc_pcidev_set, env_nounset); } } @@ -111,7 +146,7 @@ comc_init(int arg) return 0; comc_started = 1; - comc_setup(comc_curspeed); + comc_setup(comc_curspeed, comc_port); return(0); } @@ -122,8 +157,8 @@ comc_putchar(int c) int wait; for (wait = COMC_TXWAIT; wait > 0; wait--) - if (inb(COMPORT + com_lsr) & LSR_TXRDY) { - outb(COMPORT + com_data, (u_char)c); + if (inb(comc_port + com_lsr) & LSR_TXRDY) { + outb(comc_port + com_data, (u_char)c); break; } } @@ -131,13 +166,13 @@ comc_putchar(int c) static int comc_getchar(void) { - return(comc_ischar() ? inb(COMPORT + com_data) : -1); + return(comc_ischar() ? inb(comc_port + com_data) : -1); } static int comc_ischar(void) { - return(inb(COMPORT + com_lsr) & LSR_RXRDY); + return(inb(comc_port + com_lsr) & LSR_RXRDY); } static int @@ -145,13 +180,33 @@ comc_speed_set(struct env_var *ev, int f { int speed; - if (value == NULL || (speed = comc_parsespeed(value)) <= 0) { + if (value == NULL || (speed = comc_parseint(value)) <= 0) { printf("Invalid speed\n"); return (CMD_ERROR); } if (comc_started && comc_curspeed != speed) - comc_setup(speed); + comc_setup(speed, comc_port); + + env_setenv(ev->ev_name, flags | EV_NOHOOK, value, NULL, NULL); + + return (CMD_OK); +} + +static int +comc_port_set(struct env_var *ev, int flags, const void *value) +{ + int port; + + if (value == NULL || (port = comc_parseint(value)) <= 0) { + printf("Invalid port\n"); + return (CMD_ERROR); + } + + if (comc_started && comc_port != port) { + comc_setup(comc_curspeed, port); + set_hw_console_hint(); + } env_setenv(ev->ev_name, flags | EV_NOHOOK, value, NULL, NULL); @@ -159,24 +214,126 @@ comc_speed_set(struct env_var *ev, int f } static void -comc_setup(int speed) +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] + */ +static uint32_t +comc_parse_pcidev(const char *string) +{ + char *p, *p1; + uint8_t bus, dev, func, bar; + uint32_t locator; + int pres; + + pres = strtol(string, &p, 0); + if (p == string || *p != ':' || pres < 0 ) + return (0); + bus = pres; + p1 = ++p; + + pres = strtol(p1, &p, 0); + if (p == string || *p != ':' || pres < 0 ) + return (0); + dev = pres; + p1 = ++p; + + pres = strtol(p1, &p, 0); + if (p == string || (*p != ':' && *p != '\0') || pres < 0 ) + return (0); + func = pres; + + if (*p == ':') { + p1 = ++p; + pres = strtol(p1, &p, 0); + if (p == string || *p != '\0' || pres <= 0 ) + return (0); + bar = pres; + } else + bar = 0x10; + + locator = (bar << 16) | biospci_locator(bus, dev, func); + return (locator); +} + +static int +comc_pcidev_handle(uint32_t locator) +{ + char intbuf[64]; + uint32_t port; + + if (biospci_read_config(locator & 0xffff, + (locator & 0xff0000) >> 16, 2, &port) == -1) { + printf("Cannot read bar at 0x%x\n", locator); + return (CMD_ERROR); + } + if (!PCI_BAR_IO(port)) { + printf("Memory bar at 0x%x\n", locator); + return (CMD_ERROR); + } + port &= PCIM_BAR_IO_BASE; + + sprintf(intbuf, "%d", port); + unsetenv("comconsole_port"); + env_setenv("comconsole_port", EV_VOLATILE, intbuf, + comc_port_set, env_nounset); + + comc_setup(comc_curspeed, port); + set_hw_console_hint(); + comc_locator = locator; + + return (CMD_OK); +} + +static int +comc_pcidev_set(struct env_var *ev, int flags, const void *value) +{ + uint32_t locator; + int error; + + if (value == NULL || (locator = comc_parse_pcidev(value)) <= 0) { + printf("Invalid pcidev\n"); + return (CMD_ERROR); + } + if (comc_started && comc_locator != locator) { + error = comc_pcidev_handle(locator); + if (error != CMD_OK) + return (error); + } + env_setenv(ev->ev_name, flags | EV_NOHOOK, value, NULL, NULL); + return (CMD_OK); +} + +static void +comc_setup(int speed, int port) { comc_curspeed = speed; + comc_port = port; - outb(COMPORT + com_cfcr, CFCR_DLAB | COMC_FMT); - outb(COMPORT + com_dlbl, COMC_BPS(speed) & 0xff); - outb(COMPORT + com_dlbh, COMC_BPS(speed) >> 8); - outb(COMPORT + com_cfcr, COMC_FMT); - outb(COMPORT + com_mcr, MCR_RTS | MCR_DTR); + outb(comc_port + com_cfcr, CFCR_DLAB | COMC_FMT); + outb(comc_port + com_dlbl, COMC_BPS(speed) & 0xff); + outb(comc_port + com_dlbh, COMC_BPS(speed) >> 8); + outb(comc_port + com_cfcr, COMC_FMT); + outb(comc_port + com_mcr, MCR_RTS | MCR_DTR); do - inb(COMPORT + com_data); - while (inb(COMPORT + com_lsr) & LSR_RXRDY); + inb(comc_port + com_data); + while (inb(comc_port + com_lsr) & LSR_RXRDY); } static int -comc_parsespeed(const char *speedstr) +comc_parseint(const char *speedstr) { char *p; int speed; @@ -196,13 +353,13 @@ comc_getspeed(void) u_char dlbl; u_char cfcr; - cfcr = inb(COMPORT + com_cfcr); - outb(COMPORT + com_cfcr, CFCR_DLAB | cfcr); + cfcr = inb(comc_port + com_cfcr); + outb(comc_port + com_cfcr, CFCR_DLAB | cfcr); - dlbl = inb(COMPORT + com_dlbl); - dlbh = inb(COMPORT + com_dlbh); + dlbl = inb(comc_port + com_dlbl); + dlbh = inb(comc_port + com_dlbh); - outb(COMPORT + com_cfcr, cfcr); + outb(comc_port + com_cfcr, cfcr); divisor = dlbh << 8 | dlbl; From owner-svn-src-all@FreeBSD.ORG Sun Jan 22 04:51:01 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A18C3106566B; Sun, 22 Jan 2012 04:51:01 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 8FF528FC0A; Sun, 22 Jan 2012 04:51:01 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q0M4p1hX024526; Sun, 22 Jan 2012 04:51:01 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0M4p1s1024523; Sun, 22 Jan 2012 04:51:01 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201201220451.q0M4p1s1024523@svn.freebsd.org> From: Adrian Chadd Date: Sun, 22 Jan 2012 04:51:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r230445 - in head/tools/tools/wtap: . vis_map X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 22 Jan 2012 04:51:01 -0000 Author: adrian Date: Sun Jan 22 04:51:00 2012 New Revision: 230445 URL: http://svn.freebsd.org/changeset/base/230445 Log: Bring over the visibility control tool for Monthadar's wtap project. This allows basic control over which wtap nodes can see which other wtap nodes. Added: head/tools/tools/wtap/Makefile (contents, props changed) head/tools/tools/wtap/vis_map/ head/tools/tools/wtap/vis_map/Makefile (contents, props changed) head/tools/tools/wtap/vis_map/vis_map.c (contents, props changed) Added: head/tools/tools/wtap/Makefile ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tools/tools/wtap/Makefile Sun Jan 22 04:51:00 2012 (r230445) @@ -0,0 +1,5 @@ +# $FreeBSD$ + +SUBDIR= wtap vis_map + +.include Added: head/tools/tools/wtap/vis_map/Makefile ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tools/tools/wtap/vis_map/Makefile Sun Jan 22 04:51:00 2012 (r230445) @@ -0,0 +1,9 @@ +# $FreeBSD$ + +PROG= vis_map +SRC= vis_map.c +NO_MAN= 1 + +CFLAGS+= -I${.CURDIR}/../../../../sys/dev/wtap/ + +.include Added: head/tools/tools/wtap/vis_map/vis_map.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tools/tools/wtap/vis_map/vis_map.c Sun Jan 22 04:51:00 2012 (r230445) @@ -0,0 +1,117 @@ +/*- + * Copyright (c) 2010-2011 Monthadar Al Jaberi, TerraNet AB + * 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, + * without modification. + * 2. Redistributions in binary form must reproduce at minimum a disclaimer + * similar to the "NO WARRANTY" disclaimer below ("Disclaimer") and any + * redistribution must be conditioned upon including a substantially + * similar Disclaimer requirement for further binary redistribution. + * + * NO WARRANTY + * 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 NONINFRINGEMENT, MERCHANTIBILITY + * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL + * THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR 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 DAMAGES. + * + * $FreeBSD$ + */ +#include +#include +#include +#include + +/* + * From the driver itself + */ +#include + +static int dev = -1; + +static void +toggle_medium(int op) +{ + if (ioctl(dev, VISIOCTLOPEN, &op) < 0) { + printf("error opening/closing medium\n"); + } +} + +static void +link_op(struct link *l) +{ + if (ioctl(dev, VISIOCTLLINK, l) < 0) { + printf("error making a link operation\n"); + } +} + +static void +usage(const char *argv[]) +{ + printf("usage: %s [o | c | [ [a|d] wtap_id1 wtap_id2]]\n", + argv[0]); +} + +int +main(int argc, const char* argv[]) +{ + struct link l; + char cmd; + + if (argc < 2) { + usage(argv); + exit(1); + } + + dev = open("/dev/visctl", O_RDONLY); + if (dev < 0) { + printf("error opening visctl cdev\n"); + exit(1); + } + + cmd = (char)*argv[1]; + + switch (cmd) { + case 'o': + toggle_medium(1); + break; + case 'c': + toggle_medium(0); + break; + case 'a': + if (argc < 4) { + usage(argv); + exit(1); + } + l.op = 1; + l.id1 = atoi(argv[2]); + l.id2 = atoi(argv[3]); + link_op(&l); + break; + case 'd': + if (argc < 4) { + usage(argv); + exit(1); + } + l.op = 0; + l.id1 = atoi(argv[2]); + l.id2 = atoi(argv[3]); + link_op(&l); + break; + default: + printf("wtap ioctl: unkown command '%c'\n", *argv[1]); + exit(1); + } + exit(0); +} From owner-svn-src-all@FreeBSD.ORG Sun Jan 22 05:16:31 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C246C1065670; Sun, 22 Jan 2012 05:16:31 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B02358FC08; Sun, 22 Jan 2012 05:16:31 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q0M5GVxc025353; Sun, 22 Jan 2012 05:16:31 GMT (envelope-from rmacklem@svn.freebsd.org) Received: (from rmacklem@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0M5GVXo025347; Sun, 22 Jan 2012 05:16:31 GMT (envelope-from rmacklem@svn.freebsd.org) Message-Id: <201201220516.q0M5GVXo025347@svn.freebsd.org> From: Rick Macklem Date: Sun, 22 Jan 2012 05:16:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r230446 - in stable/9/sys/fs: nfs nfsclient X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 22 Jan 2012 05:16:32 -0000 Author: rmacklem Date: Sun Jan 22 05:16:31 2012 New Revision: 230446 URL: http://svn.freebsd.org/changeset/base/230446 Log: MFC: r229802 opt_inet6.h was missing from some files in the new NFS subsystem. The effect of this was, for clients mounted via inet6 addresses, that the DRC cache would never have a hit in the server. It also broke NFSv4 callbacks when an inet6 address was the only one available in the client. This patch fixes the above, plus deletes opt_inet6.h from a couple of files it is not needed for. Modified: stable/9/sys/fs/nfs/nfs_commonkrpc.c stable/9/sys/fs/nfs/nfs_commonsubs.c stable/9/sys/fs/nfsclient/nfs_clkrpc.c stable/9/sys/fs/nfsclient/nfs_clport.c stable/9/sys/fs/nfsclient/nfs_clrpcops.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/amd64/include/xen/ (props changed) stable/9/sys/boot/ (props changed) stable/9/sys/boot/i386/efi/ (props changed) stable/9/sys/boot/ia64/efi/ (props changed) stable/9/sys/boot/ia64/ski/ (props changed) stable/9/sys/boot/powerpc/boot1.chrp/ (props changed) stable/9/sys/boot/powerpc/ofw/ (props changed) stable/9/sys/cddl/contrib/opensolaris/ (props changed) stable/9/sys/conf/ (props changed) stable/9/sys/contrib/dev/acpica/ (props changed) stable/9/sys/contrib/octeon-sdk/ (props changed) stable/9/sys/contrib/pf/ (props changed) stable/9/sys/contrib/x86emu/ (props changed) Modified: stable/9/sys/fs/nfs/nfs_commonkrpc.c ============================================================================== --- stable/9/sys/fs/nfs/nfs_commonkrpc.c Sun Jan 22 04:51:00 2012 (r230445) +++ stable/9/sys/fs/nfs/nfs_commonkrpc.c Sun Jan 22 05:16:31 2012 (r230446) @@ -38,7 +38,6 @@ __FBSDID("$FreeBSD$"); * Socket operations for use by nfs */ -#include "opt_inet6.h" #include "opt_kdtrace.h" #include "opt_kgssapi.h" #include "opt_nfs.h" Modified: stable/9/sys/fs/nfs/nfs_commonsubs.c ============================================================================== --- stable/9/sys/fs/nfs/nfs_commonsubs.c Sun Jan 22 04:51:00 2012 (r230445) +++ stable/9/sys/fs/nfs/nfs_commonsubs.c Sun Jan 22 05:16:31 2012 (r230446) @@ -40,6 +40,8 @@ __FBSDID("$FreeBSD$"); * copy data between mbuf chains and uio lists. */ #ifndef APPLEKEXT +#include "opt_inet6.h" + #include /* Modified: stable/9/sys/fs/nfsclient/nfs_clkrpc.c ============================================================================== --- stable/9/sys/fs/nfsclient/nfs_clkrpc.c Sun Jan 22 04:51:00 2012 (r230445) +++ stable/9/sys/fs/nfsclient/nfs_clkrpc.c Sun Jan 22 05:16:31 2012 (r230446) @@ -34,7 +34,6 @@ #include __FBSDID("$FreeBSD$"); -#include "opt_inet6.h" #include "opt_kgssapi.h" #include Modified: stable/9/sys/fs/nfsclient/nfs_clport.c ============================================================================== --- stable/9/sys/fs/nfsclient/nfs_clport.c Sun Jan 22 04:51:00 2012 (r230445) +++ stable/9/sys/fs/nfsclient/nfs_clport.c Sun Jan 22 05:16:31 2012 (r230446) @@ -34,6 +34,7 @@ #include __FBSDID("$FreeBSD$"); +#include "opt_inet6.h" #include "opt_kdtrace.h" #include Modified: stable/9/sys/fs/nfsclient/nfs_clrpcops.c ============================================================================== --- stable/9/sys/fs/nfsclient/nfs_clrpcops.c Sun Jan 22 04:51:00 2012 (r230445) +++ stable/9/sys/fs/nfsclient/nfs_clrpcops.c Sun Jan 22 05:16:31 2012 (r230446) @@ -43,6 +43,8 @@ __FBSDID("$FreeBSD$"); */ #ifndef APPLEKEXT +#include "opt_inet6.h" + #include /* From owner-svn-src-all@FreeBSD.ORG Sun Jan 22 05:30:30 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6DFA7106566C; Sun, 22 Jan 2012 05:30:30 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 5D3698FC1B; Sun, 22 Jan 2012 05:30:30 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q0M5UU0S025802; Sun, 22 Jan 2012 05:30:30 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0M5UUR7025800; Sun, 22 Jan 2012 05:30:30 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201201220530.q0M5UUR7025800@svn.freebsd.org> From: Adrian Chadd Date: Sun, 22 Jan 2012 05:30:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r230447 - head/sys/net80211 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 22 Jan 2012 05:30:30 -0000 Author: adrian Date: Sun Jan 22 05:30:29 2012 New Revision: 230447 URL: http://svn.freebsd.org/changeset/base/230447 Log: Mark the taskqueue as the _net80211_ taskqueue. This makes it much easier to determine whether an event occurs in the net80211 taskqueue (which was called "ath0 taskq") or the ath driver taskqueue (which is also called "ath0 taskq".) Modified: head/sys/net80211/ieee80211.c Modified: head/sys/net80211/ieee80211.c ============================================================================== --- head/sys/net80211/ieee80211.c Sun Jan 22 05:16:31 2012 (r230446) +++ head/sys/net80211/ieee80211.c Sun Jan 22 05:30:29 2012 (r230447) @@ -276,7 +276,7 @@ ieee80211_ifattach(struct ieee80211com * /* Create a taskqueue for all state changes */ ic->ic_tq = taskqueue_create("ic_taskq", M_WAITOK | M_ZERO, taskqueue_thread_enqueue, &ic->ic_tq); - taskqueue_start_threads(&ic->ic_tq, 1, PI_NET, "%s taskq", + taskqueue_start_threads(&ic->ic_tq, 1, PI_NET, "%s net80211 taskq", ifp->if_xname); /* * Fill in 802.11 available channel set, mark all From owner-svn-src-all@FreeBSD.ORG Sun Jan 22 06:00:51 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1CCEA106564A; Sun, 22 Jan 2012 06:00:51 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 01B4B8FC08; Sun, 22 Jan 2012 06:00:51 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q0M60oZN026777; Sun, 22 Jan 2012 06:00:50 GMT (envelope-from rmacklem@svn.freebsd.org) Received: (from rmacklem@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0M60opj026771; Sun, 22 Jan 2012 06:00:50 GMT (envelope-from rmacklem@svn.freebsd.org) Message-Id: <201201220600.q0M60opj026771@svn.freebsd.org> From: Rick Macklem Date: Sun, 22 Jan 2012 06:00:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r230448 - in stable/8/sys/fs: nfs nfsclient X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 22 Jan 2012 06:00:51 -0000 Author: rmacklem Date: Sun Jan 22 06:00:50 2012 New Revision: 230448 URL: http://svn.freebsd.org/changeset/base/230448 Log: MFC: r229802 opt_inet6.h was missing from some files in the new NFS subsystem. The effect of this was, for clients mounted via inet6 addresses, that the DRC cache would never have a hit in the server. It also broke NFSv4 callbacks when an inet6 address was the only one available in the client. This patch fixes the above, plus deletes opt_inet6.h from a couple of files it is not needed for. Modified: stable/8/sys/fs/nfs/nfs_commonkrpc.c stable/8/sys/fs/nfs/nfs_commonsubs.c stable/8/sys/fs/nfsclient/nfs_clkrpc.c stable/8/sys/fs/nfsclient/nfs_clport.c stable/8/sys/fs/nfsclient/nfs_clrpcops.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) Modified: stable/8/sys/fs/nfs/nfs_commonkrpc.c ============================================================================== --- stable/8/sys/fs/nfs/nfs_commonkrpc.c Sun Jan 22 05:30:29 2012 (r230447) +++ stable/8/sys/fs/nfs/nfs_commonkrpc.c Sun Jan 22 06:00:50 2012 (r230448) @@ -38,7 +38,6 @@ __FBSDID("$FreeBSD$"); * Socket operations for use by nfs */ -#include "opt_inet6.h" #include "opt_kgssapi.h" #include "opt_nfs.h" Modified: stable/8/sys/fs/nfs/nfs_commonsubs.c ============================================================================== --- stable/8/sys/fs/nfs/nfs_commonsubs.c Sun Jan 22 05:30:29 2012 (r230447) +++ stable/8/sys/fs/nfs/nfs_commonsubs.c Sun Jan 22 06:00:50 2012 (r230448) @@ -40,6 +40,8 @@ __FBSDID("$FreeBSD$"); * copy data between mbuf chains and uio lists. */ #ifndef APPLEKEXT +#include "opt_inet6.h" + #include /* Modified: stable/8/sys/fs/nfsclient/nfs_clkrpc.c ============================================================================== --- stable/8/sys/fs/nfsclient/nfs_clkrpc.c Sun Jan 22 05:30:29 2012 (r230447) +++ stable/8/sys/fs/nfsclient/nfs_clkrpc.c Sun Jan 22 06:00:50 2012 (r230448) @@ -34,7 +34,6 @@ #include __FBSDID("$FreeBSD$"); -#include "opt_inet6.h" #include "opt_kgssapi.h" #include Modified: stable/8/sys/fs/nfsclient/nfs_clport.c ============================================================================== --- stable/8/sys/fs/nfsclient/nfs_clport.c Sun Jan 22 05:30:29 2012 (r230447) +++ stable/8/sys/fs/nfsclient/nfs_clport.c Sun Jan 22 06:00:50 2012 (r230448) @@ -34,6 +34,8 @@ #include __FBSDID("$FreeBSD$"); +#include "opt_inet6.h" + /* * generally, I don't like #includes inside .h files, but it seems to * be the easiest way to handle the port. Modified: stable/8/sys/fs/nfsclient/nfs_clrpcops.c ============================================================================== --- stable/8/sys/fs/nfsclient/nfs_clrpcops.c Sun Jan 22 05:30:29 2012 (r230447) +++ stable/8/sys/fs/nfsclient/nfs_clrpcops.c Sun Jan 22 06:00:50 2012 (r230448) @@ -43,6 +43,8 @@ __FBSDID("$FreeBSD$"); */ #ifndef APPLEKEXT +#include "opt_inet6.h" + #include /* From owner-svn-src-all@FreeBSD.ORG Sun Jan 22 08:06:37 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B5FB7106566B; Sun, 22 Jan 2012 08:06:37 +0000 (UTC) (envelope-from mm@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 5004F8FC15; Sun, 22 Jan 2012 08:06:37 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q0M86btc030669; Sun, 22 Jan 2012 08:06:37 GMT (envelope-from mm@svn.freebsd.org) Received: (from mm@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0M86bMs030667; Sun, 22 Jan 2012 08:06:37 GMT (envelope-from mm@svn.freebsd.org) Message-Id: <201201220806.q0M86bMs030667@svn.freebsd.org> From: Martin Matuska Date: Sun, 22 Jan 2012 08:06:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r230449 - head/cddl/contrib/opensolaris/cmd/zfs X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 22 Jan 2012 08:06:37 -0000 Author: mm Date: Sun Jan 22 08:06:36 2012 New Revision: 230449 URL: http://svn.freebsd.org/changeset/base/230449 Log: Merge illumos revisions 13540, 13562: illumos rev 13540 [1]: Removal of pyzfs broke delegation for volumes illumos rev 13562 [2]: zfs allow arguments not parsed correctly after pyzfs removal References: https://www.illumos.org/issues/1726 [1] https://www.illumos.org/issues/1977 [2] Obtained from: illumos (issues #1726, #1977) MFC after: 1 week Modified: head/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c Modified: head/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c ============================================================================== --- head/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c Sun Jan 22 06:00:50 2012 (r230448) +++ head/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c Sun Jan 22 08:06:36 2012 (r230449) @@ -21,7 +21,7 @@ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. - * Copyright 2011 Nexenta Systems, Inc. All rights reserved. + * Copyright 2012 Nexenta Systems, Inc. All rights reserved. * Copyright (c) 2011 by Delphix. All rights reserved. * Copyright (c) 2011-2012 Pawel Jakub Dawidek . * All rights reserved. @@ -4501,7 +4501,7 @@ parse_allow_args(int argc, char **argv, argc--; argv++; opts->dataset = munge_args(argc, argv, un, 2, &opts->perms); - } else if (argc == 1) { + } else if (argc == 1 && !un) { opts->prt_perms = B_TRUE; opts->dataset = argv[argc-1]; } else { @@ -4988,9 +4988,9 @@ zfs_do_allow_unallow_impl(int argc, char parse_allow_args(argc, argv, un, &opts); /* try to open the dataset */ - if ((zhp = zfs_open(g_zfs, opts.dataset, ZFS_TYPE_FILESYSTEM)) - == NULL) { - (void) fprintf(stderr, "Failed to open Dataset *%s*\n", + if ((zhp = zfs_open(g_zfs, opts.dataset, ZFS_TYPE_FILESYSTEM | + ZFS_TYPE_VOLUME)) == NULL) { + (void) fprintf(stderr, "Failed to open dataset: %s\n", opts.dataset); return (-1); } @@ -5000,7 +5000,7 @@ zfs_do_allow_unallow_impl(int argc, char fs_perm_set_init(&fs_perm_set); if (parse_fs_perm_set(&fs_perm_set, perm_nvl) != 0) { - (void) fprintf(stderr, "Failed to parse fsacl permissionsn"); + (void) fprintf(stderr, "Failed to parse fsacl permissions\n"); goto cleanup1; } From owner-svn-src-all@FreeBSD.ORG Sun Jan 22 10:16:25 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C277F1065706; Sun, 22 Jan 2012 10:16:25 +0000 (UTC) (envelope-from brueffer@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B07C88FC19; Sun, 22 Jan 2012 10:16:25 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q0MAGPwd034809; Sun, 22 Jan 2012 10:16:25 GMT (envelope-from brueffer@svn.freebsd.org) Received: (from brueffer@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0MAGPem034803; Sun, 22 Jan 2012 10:16:25 GMT (envelope-from brueffer@svn.freebsd.org) Message-Id: <201201221016.q0MAGPem034803@svn.freebsd.org> From: Christian Brueffer Date: Sun, 22 Jan 2012 10:16:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r230450 - head/share/man/man4 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 22 Jan 2012 10:16:25 -0000 Author: brueffer Date: Sun Jan 22 10:16:24 2012 New Revision: 230450 URL: http://svn.freebsd.org/changeset/base/230450 Log: General cleanup. Prodded by: grehan Modified: head/share/man/man4/virtio.4 head/share/man/man4/virtio_balloon.4 head/share/man/man4/virtio_blk.4 head/share/man/man4/vtnet.4 Modified: head/share/man/man4/virtio.4 ============================================================================== --- head/share/man/man4/virtio.4 Sun Jan 22 08:06:36 2012 (r230449) +++ head/share/man/man4/virtio.4 Sun Jan 22 10:16:24 2012 (r230450) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd July 4, 2011 +.Dd January 22, 2012 .Dt VIRTIO 4 .Os .Sh NAME @@ -48,24 +48,25 @@ virtio_pci_load="YES" .Sh DESCRIPTION VirtIO is a specification for para-virtualized I/O in a virtual machine (VM). Traditionally, the hypervisor emulated real devices such as an Ethernet -interface or disk controller to provide the VM with I/O. This emulation is -often inefficient. +interface or disk controller to provide the VM with I/O. +This emulation is often inefficient. .Pp VirtIO defines an interface for efficient I/O between the hypervisor and VM. -The -.Xr virtio 4 +The +.Xr virtio 4 module provides a shared memory transport called a virtqueue. The .Xr virtio_pci 4 device driver represents an emulated PCI device that the hypervisor makes -available to the VM. This device provides the probing, configuration, and -interrupt notifications need to interact with the hypervisor. +available to the VM. +This device provides the probing, configuration, and +interrupt notifications needed to interact with the hypervisor. .Fx supports the following VirtIO devices: .Bl -hang -offset indent -width xxxxxxxx .It Nm Ethernet An emulated Ethernet device is provided by the -.Xr if_vtnet 4 +.Xr vtnet 4 device driver. .It Nm Block An emulated disk controller is provided by the @@ -78,9 +79,9 @@ provided by the device driver. .El .Sh SEE ALSO -.Xr if_vtnet 4 , +.Xr virtio_balloon 4 , .Xr virtio_blk 4 , -.Xr virtio_balloon 4 +.Xr vtnet 4 .Sh HISTORY Support for VirtIO first appeared in .Fx 9.0 . Modified: head/share/man/man4/virtio_balloon.4 ============================================================================== --- head/share/man/man4/virtio_balloon.4 Sun Jan 22 08:06:36 2012 (r230449) +++ head/share/man/man4/virtio_balloon.4 Sun Jan 22 10:16:24 2012 (r230450) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd July 4, 2011 +.Dd January 22, 2012 .Dt VIRTIO_BALLOON 4 .Os .Sh NAME @@ -51,8 +51,8 @@ device driver provides support for VirtI .Pp The memory balloon allows the guest to, at the request of the hypervisor, return memory allocated to the hypervisor so it can -be made available to other guests. The hypervisor can later -signal the balloon to return the memory. +be made available to other guests. +The hypervisor can later signal the balloon to return the memory. .Sh SEE ALSO .Xr virtio 4 .Sh HISTORY Modified: head/share/man/man4/virtio_blk.4 ============================================================================== --- head/share/man/man4/virtio_blk.4 Sun Jan 22 08:06:36 2012 (r230449) +++ head/share/man/man4/virtio_blk.4 Sun Jan 22 10:16:24 2012 (r230450) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd July 4, 2011 +.Dd January 22, 2012 .Dt VIRTIO_BLK 4 .Os .Sh NAME @@ -48,7 +48,6 @@ virtio_blk_load="YES" The .Nm device driver provides support for VirtIO block devices. -.Pp .Sh LOADER TUNABLES Tunables can be set at the .Xr loader 8 @@ -57,7 +56,8 @@ prompt before booting the kernel or stor .Bl -tag -width "xxxxxx" .It Va hw.vtblk.no_ident This tunable disables retrieving the device identification string -from the hypervisor. The default value is 0. +from the hypervisor. +The default value is 0. .El .Sh SEE ALSO .Xr virtio 4 Modified: head/share/man/man4/vtnet.4 ============================================================================== --- head/share/man/man4/vtnet.4 Sun Jan 22 08:06:36 2012 (r230449) +++ head/share/man/man4/vtnet.4 Sun Jan 22 10:16:24 2012 (r230450) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd July 4, 2011 +.Dd January 22, 2012 .Dt VTNET 4 .Os .Sh NAME @@ -62,7 +62,6 @@ utility configures the adapter to receiv .Pp For more information on configuring this device, see .Xr ifconfig 8 . -.El .Sh LOADER TUNABLES Tunables can be set at the .Xr loader 8 @@ -70,19 +69,21 @@ prompt before booting the kernel or stor .Xr loader.conf 5 . .Bl -tag -width "xxxxxx" .It Va hw.vtnet.csum_disable -This tunable disables receive and send checksum offload. The default -value is 0. +This tunable disables receive and send checksum offload. +The default value is 0. .It Va hw.vtnet.tso_disable -This tunable disables TSO. The default value is 0. +This tunable disables TSO. +The default value is 0. .It Va hw.vtnet.lro_disable -This tunable disables LRO. The default value is 0. +This tunable disables LRO. +The default value is 0. .El .Sh SEE ALSO .Xr arp 4 , .Xr netintro 4 , .Xr ng_ether 4 , -.Xr vlan 4 , .Xr virtio 4 , +.Xr vlan 4 , .Xr ifconfig 8 .Sh HISTORY The From owner-svn-src-all@FreeBSD.ORG Sun Jan 22 10:24:13 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4C0D81065691; Sun, 22 Jan 2012 10:24:13 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 399D88FC12; Sun, 22 Jan 2012 10:24:13 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q0MAODHw071727; Sun, 22 Jan 2012 10:24:13 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0MAODT5071724; Sun, 22 Jan 2012 10:24:13 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201201221024.q0MAODT5071724@svn.freebsd.org> From: Alexander Motin Date: Sun, 22 Jan 2012 10:24:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r230451 - head/sys/dev/sound/pci/hda X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 22 Jan 2012 10:24:13 -0000 Author: mav Date: Sun Jan 22 10:24:12 2012 New Revision: 230451 URL: http://svn.freebsd.org/changeset/base/230451 Log: Complete rewrite of the snd_hda(4) volume control. Previous code was relatively dumb. During CODEC probe it was tracing signals and statically binding amplifier controls to the OSS mixer controls. To set volume it just set all bound amplifier controls proportionally to mixer level, not looking on their hierarchy and amplification levels/offsets. New code is much smarter. It also traces signals during probe, but mostly to find out possible amplification control rages in dB for each specific signal. To set volume it retraces each affected signal again and sets amplifiers controls recursively to reach desired amplification level in dB. It would be nice to export values in dB to user, but unluckily our OSS mixer API is too simple for that. As result of this change: - cascaded amplifiers will work together to reach maximal precision. If some input has 0/+40dB preamplifier with 10dB step and -10/+10dB mixer with 1dB step after it, new code will use both to provide 0/+40dB control with 1dB step! We could even get -10/+50dB range there, but that is intentionally blocked for now. - different channels of multichannel associations on non-uniform CODECs such as VIA VT1708S will have the same volume, not looking that control ranges are different. It was not good when fronts were 12dB louder. - for multiplexed recording, when we can record from only one source at a time, we can now use recording amplifier controls to set different volume levels for different inputs if they have no own controls of they are less precise. If recording source change, amplifiers will be reconfigured. To improve out-of-the-box behavior, ignore default volume levels set by sound(4) and use own, more reasonable: +20dB for mics, -10dB for analog output volume and 0dB for the rest of controls. sound(4) defaults of 75% mean absolutely random things for different controls of different CODECs because of very different control ranges. Together with further planned automatic recording source selection this should allow users to get fine playback and recording without touching mixer first. Note that existing users should delete /var/db/mixer*-state and reboot or trigger CODEC reconfiguration to get new default values. MFC after: 2 months Sponsored by: iXsystems, Inc. Modified: head/sys/dev/sound/pci/hda/hdaa.c head/sys/dev/sound/pci/hda/hdaa.h Modified: head/sys/dev/sound/pci/hda/hdaa.c ============================================================================== --- head/sys/dev/sound/pci/hda/hdaa.c Sun Jan 22 10:16:24 2012 (r230450) +++ head/sys/dev/sound/pci/hda/hdaa.c Sun Jan 22 10:24:12 2012 (r230451) @@ -175,6 +175,8 @@ static const struct { }; #define HDA_RATE_TAB_LEN (sizeof(hda_rate_tab) / sizeof(hda_rate_tab[0])) +const static char *ossnames[] = SOUND_DEVICE_NAMES; + /**************************************************************************** * Function prototypes ****************************************************************************/ @@ -193,7 +195,6 @@ static void hdaa_dump_pin_config(struct static char * hdaa_audio_ctl_ossmixer_mask2allname(uint32_t mask, char *buf, size_t len) { - static char *ossname[] = SOUND_DEVICE_NAMES; int i, first = 1; bzero(buf, len); @@ -201,7 +202,7 @@ hdaa_audio_ctl_ossmixer_mask2allname(uin if (mask & (1 << i)) { if (first == 0) strlcat(buf, ", ", len); - strlcat(buf, ossname[i], len); + strlcat(buf, ossnames[i], len); first = 0; } } @@ -1774,11 +1775,11 @@ hdaa_audio_ctl_ossmixer_init(struct snd_ struct hdaa_pcm_devinfo *pdevinfo = mix_getdevinfo(m); struct hdaa_devinfo *devinfo = pdevinfo->devinfo; struct hdaa_widget *w, *cw; - struct hdaa_audio_ctl *ctl; uint32_t mask, recmask; - int i, j, softpcmvol; + int i, j; hdaa_lock(devinfo); + pdevinfo->mixer = m; /* Make sure that in case of soft volume it won't stay muted. */ for (i = 0; i < SOUND_MIXER_NRDEVICES; i++) { @@ -1786,11 +1787,10 @@ hdaa_audio_ctl_ossmixer_init(struct snd_ pdevinfo->right[i] = 100; } - mask = 0; - recmask = 0; - - /* Declate EAPD as ogain control. */ + /* Declare volume controls assigned to this association. */ + mask = pdevinfo->ossmask; if (pdevinfo->playas >= 0) { + /* Declate EAPD as ogain control. */ for (i = devinfo->startnode; i < devinfo->endnode; i++) { w = hdaa_widget_get(devinfo, i); if (w == NULL || w->enable == 0) @@ -1802,23 +1802,36 @@ hdaa_audio_ctl_ossmixer_init(struct snd_ mask |= SOUND_MASK_OGAIN; break; } - } - /* Declare volume controls assigned to this association. */ - i = 0; - ctl = NULL; - while ((ctl = hdaa_audio_ctl_each(devinfo, &i)) != NULL) { - if (ctl->enable == 0) - continue; - if ((pdevinfo->playas >= 0 && - ctl->widget->bindas == pdevinfo->playas) || - (pdevinfo->recas >= 0 && - ctl->widget->bindas == pdevinfo->recas) || - (ctl->widget->bindas == -2 && pdevinfo->index == 0)) - mask |= ctl->ossmask; + /* Declare soft PCM volume if needed. */ + if ((mask & SOUND_MASK_PCM) == 0 || + (devinfo->quirks & HDAA_QUIRK_SOFTPCMVOL) || + pdevinfo->minamp[SOUND_MIXER_PCM] == + pdevinfo->maxamp[SOUND_MIXER_PCM]) { + mask |= SOUND_MASK_PCM; + pcm_setflags(pdevinfo->dev, pcm_getflags(pdevinfo->dev) | SD_F_SOFTPCMVOL); + HDA_BOOTHVERBOSE( + device_printf(pdevinfo->dev, + "Forcing Soft PCM volume\n"); + ); + } + + /* Declare master volume if needed. */ + if ((mask & SOUND_MASK_VOLUME) == 0) { + mask |= SOUND_MASK_VOLUME; + mix_setparentchild(m, SOUND_MIXER_VOLUME, + SOUND_MASK_PCM); + mix_setrealdev(m, SOUND_MIXER_VOLUME, + SOUND_MIXER_NONE); + HDA_BOOTHVERBOSE( + device_printf(pdevinfo->dev, + "Forcing master volume with PCM\n"); + ); + } } /* Declare record sources available to this association. */ + recmask = 0; if (pdevinfo->recas >= 0) { for (i = 0; i < 16; i++) { if (devinfo->as[pdevinfo->recas].dacs[0][i] < 0) @@ -1841,66 +1854,273 @@ hdaa_audio_ctl_ossmixer_init(struct snd_ } } - /* Declare soft PCM volume if needed. */ - if (pdevinfo->playas >= 0) { - ctl = NULL; - if ((mask & SOUND_MASK_PCM) == 0 || - (devinfo->quirks & HDAA_QUIRK_SOFTPCMVOL)) { - softpcmvol = 1; - mask |= SOUND_MASK_PCM; - } else { - softpcmvol = 0; - i = 0; - while ((ctl = hdaa_audio_ctl_each(devinfo, &i)) != NULL) { - if (ctl->enable == 0) - continue; - if (ctl->widget->bindas != pdevinfo->playas && - (ctl->widget->bindas != -2 || pdevinfo->index != 0)) - continue; - if (!(ctl->ossmask & SOUND_MASK_PCM)) - continue; - if (ctl->step > 0) - break; - } + recmask &= (1 << SOUND_MIXER_NRDEVICES) - 1; + mask &= (1 << SOUND_MIXER_NRDEVICES) - 1; + pdevinfo->ossmask = mask; + + mix_setrecdevs(m, recmask); + mix_setdevs(m, mask); + + hdaa_unlock(devinfo); + + return (0); +} + +/* + * Update amplification per pdevinfo per ossdev, calculate summary coefficient + * and write it to codec, update *left and *right to reflect remaining error. + */ +static void +hdaa_audio_ctl_dev_set(struct hdaa_audio_ctl *ctl, int ossdev, + int mute, int *left, int *right) +{ + int i, zleft, zright, sleft, sright, smute, lval, rval; + + ctl->devleft[ossdev] = *left; + ctl->devright[ossdev] = *right; + ctl->devmute[ossdev] = mute; + smute = sleft = sright = zleft = zright = 0; + for (i = 0; i < SOUND_MIXER_NRDEVICES; i++) { + sleft += ctl->devleft[i]; + sright += ctl->devright[i]; + smute |= ctl->devmute[i]; + if (i == ossdev) + continue; + zleft += ctl->devleft[i]; + zright += ctl->devright[i]; + } + lval = QDB2VAL(ctl, sleft); + rval = QDB2VAL(ctl, sright); + hdaa_audio_ctl_amp_set(ctl, smute, lval, rval); + *left -= VAL2QDB(ctl, lval) - VAL2QDB(ctl, QDB2VAL(ctl, zleft)); + *right -= VAL2QDB(ctl, rval) - VAL2QDB(ctl, QDB2VAL(ctl, zright)); +} + +/* + * Trace signal from source, setting volumes on the way. + */ +static void +hdaa_audio_ctl_source_volume(struct hdaa_pcm_devinfo *pdevinfo, + int ossdev, nid_t nid, int index, int mute, int left, int right, int depth) +{ + struct hdaa_devinfo *devinfo = pdevinfo->devinfo; + struct hdaa_widget *w, *wc; + struct hdaa_audio_ctl *ctl; + int i, j, conns = 0; + + if (depth > HDA_PARSE_MAXDEPTH) + return; + + w = hdaa_widget_get(devinfo, nid); + if (w == NULL || w->enable == 0) + return; + + /* Count number of active inputs. */ + if (depth > 0) { + for (j = 0; j < w->nconns; j++) { + if (!w->connsenable[j]) + continue; + conns++; } + } - if (softpcmvol == 1 || ctl == NULL) { - pcm_setflags(pdevinfo->dev, pcm_getflags(pdevinfo->dev) | SD_F_SOFTPCMVOL); - HDA_BOOTVERBOSE( - device_printf(pdevinfo->dev, - "%s Soft PCM volume\n", - (softpcmvol == 1) ? "Forcing" : "Enabling"); - ); + /* If this is not a first step - use input mixer. + Pins have common input ctl so care must be taken. */ + if (depth > 0 && (conns == 1 || + w->type != HDA_PARAM_AUDIO_WIDGET_CAP_TYPE_PIN_COMPLEX)) { + ctl = hdaa_audio_ctl_amp_get(devinfo, w->nid, HDAA_CTL_IN, + index, 1); + if (ctl) + hdaa_audio_ctl_dev_set(ctl, ossdev, mute, &left, &right); + } + + /* If widget has own ossdev - not traverse it. + It will be traversed on it's own. */ + if (w->ossdev >= 0 && depth > 0) + return; + + /* We must not traverse pin */ + if ((w->type == HDA_PARAM_AUDIO_WIDGET_CAP_TYPE_AUDIO_INPUT || + w->type == HDA_PARAM_AUDIO_WIDGET_CAP_TYPE_PIN_COMPLEX) && + depth > 0) + return; + + /* + * If signals mixed, we can't assign controls farther. + * Ignore this on depth zero. Caller must knows why. + */ + if (conns > 1 && + (w->type == HDA_PARAM_AUDIO_WIDGET_CAP_TYPE_AUDIO_MIXER || + w->selconn != index)) + return; + + ctl = hdaa_audio_ctl_amp_get(devinfo, w->nid, HDAA_CTL_OUT, -1, 1); + if (ctl) + hdaa_audio_ctl_dev_set(ctl, ossdev, mute, &left, &right); + + for (i = devinfo->startnode; i < devinfo->endnode; i++) { + wc = hdaa_widget_get(devinfo, i); + if (wc == NULL || wc->enable == 0) + continue; + for (j = 0; j < wc->nconns; j++) { + if (wc->connsenable[j] && wc->conns[j] == nid) { + hdaa_audio_ctl_source_volume(pdevinfo, ossdev, + wc->nid, j, mute, left, right, depth + 1); + } } } + return; +} - /* Declare master volume if needed. */ - if (pdevinfo->playas >= 0) { - if ((mask & (SOUND_MASK_VOLUME | SOUND_MASK_PCM)) == - SOUND_MASK_PCM) { - mask |= SOUND_MASK_VOLUME; - mix_setparentchild(m, SOUND_MIXER_VOLUME, - SOUND_MASK_PCM); - mix_setrealdev(m, SOUND_MIXER_VOLUME, - SOUND_MIXER_NONE); - HDA_BOOTVERBOSE( - device_printf(pdevinfo->dev, - "Forcing master volume with PCM\n"); - ); +/* + * Trace signal from destination, setting volumes on the way. + */ +static void +hdaa_audio_ctl_dest_volume(struct hdaa_pcm_devinfo *pdevinfo, + int ossdev, nid_t nid, int index, int mute, int left, int right, int depth) +{ + struct hdaa_devinfo *devinfo = pdevinfo->devinfo; + struct hdaa_audio_as *as = devinfo->as; + struct hdaa_widget *w, *wc; + struct hdaa_audio_ctl *ctl; + int i, j, consumers, cleft, cright; + + if (depth > HDA_PARSE_MAXDEPTH) + return; + + w = hdaa_widget_get(devinfo, nid); + if (w == NULL || w->enable == 0) + return; + + if (depth > 0) { + /* If this node produce output for several consumers, + we can't touch it. */ + consumers = 0; + for (i = devinfo->startnode; i < devinfo->endnode; i++) { + wc = hdaa_widget_get(devinfo, i); + if (wc == NULL || wc->enable == 0) + continue; + for (j = 0; j < wc->nconns; j++) { + if (wc->connsenable[j] && wc->conns[j] == nid) + consumers++; + } } + /* The only exception is if real HP redirection is configured + and this is a duplication point. + XXX: Actually exception is not completely correct. + XXX: Duplication point check is not perfect. */ + if ((consumers == 2 && (w->bindas < 0 || + as[w->bindas].hpredir < 0 || as[w->bindas].fakeredir || + (w->bindseqmask & (1 << 15)) == 0)) || + consumers > 2) + return; + + /* Else use it's output mixer. */ + ctl = hdaa_audio_ctl_amp_get(devinfo, w->nid, + HDAA_CTL_OUT, -1, 1); + if (ctl) + hdaa_audio_ctl_dev_set(ctl, ossdev, mute, &left, &right); } - recmask &= (1 << SOUND_MIXER_NRDEVICES) - 1; - mask &= (1 << SOUND_MIXER_NRDEVICES) - 1; + /* We must not traverse pin */ + if (w->type == HDA_PARAM_AUDIO_WIDGET_CAP_TYPE_PIN_COMPLEX && + depth > 0) + return; - mix_setrecdevs(m, recmask); - mix_setdevs(m, mask); + for (i = 0; i < w->nconns; i++) { + if (w->connsenable[i] == 0) + continue; + if (index >= 0 && i != index) + continue; + cleft = left; + cright = right; + ctl = hdaa_audio_ctl_amp_get(devinfo, w->nid, + HDAA_CTL_IN, i, 1); + if (ctl) + hdaa_audio_ctl_dev_set(ctl, ossdev, mute, &cleft, &cright); + hdaa_audio_ctl_dest_volume(pdevinfo, ossdev, w->conns[i], -1, + mute, cleft, cright, depth + 1); + } +} - hdaa_unlock(devinfo); +/* + * Set volumes for the specified pdevinfo and ossdev. + */ +static void +hdaa_audio_ctl_dev_volume(struct hdaa_pcm_devinfo *pdevinfo, unsigned dev) +{ + struct hdaa_devinfo *devinfo = pdevinfo->devinfo; + struct hdaa_widget *w, *cw; + uint32_t mute; + int lvol, rvol; + int i, j; - return (0); + mute = 0; + if (pdevinfo->left[dev] == 0) { + mute |= HDAA_AMP_MUTE_LEFT; + lvol = -4000; + } else + lvol = ((pdevinfo->maxamp[dev] - pdevinfo->minamp[dev]) * + pdevinfo->left[dev] + 50) / 100 + pdevinfo->minamp[dev]; + if (pdevinfo->right[dev] == 0) { + mute |= HDAA_AMP_MUTE_RIGHT; + rvol = -4000; + } else + rvol = ((pdevinfo->maxamp[dev] - pdevinfo->minamp[dev]) * + pdevinfo->right[dev] + 50) / 100 + pdevinfo->minamp[dev]; + for (i = devinfo->startnode; i < devinfo->endnode; i++) { + w = hdaa_widget_get(devinfo, i); + if (w == NULL || w->enable == 0) + continue; + if (w->bindas < 0 && pdevinfo->index != 0) + continue; + if (w->bindas != pdevinfo->playas && + w->bindas != pdevinfo->recas) + continue; + if (dev == SOUND_MIXER_RECLEV && + w->type == HDA_PARAM_AUDIO_WIDGET_CAP_TYPE_AUDIO_INPUT) { + hdaa_audio_ctl_dest_volume(pdevinfo, dev, + w->nid, -1, mute, lvol, rvol, 0); + continue; + } + if (dev == SOUND_MIXER_VOLUME && + w->type == HDA_PARAM_AUDIO_WIDGET_CAP_TYPE_PIN_COMPLEX && + devinfo->as[w->bindas].dir == HDAA_CTL_OUT) { + hdaa_audio_ctl_dest_volume(pdevinfo, dev, + w->nid, -1, mute, lvol, rvol, 0); + continue; + } + if (dev == SOUND_MIXER_IGAIN && + w->pflags & HDAA_ADC_MONITOR) { + for (j = 0; j < w->nconns; j++) { + if (!w->connsenable[j]) + continue; + cw = hdaa_widget_get(devinfo, w->conns[j]); + if (cw == NULL || cw->enable == 0) + continue; + if (cw->bindas == -1) + continue; + if (cw->bindas >= 0 && + devinfo->as[cw->bindas].dir != HDAA_CTL_IN) + continue; + hdaa_audio_ctl_dest_volume(pdevinfo, dev, + w->nid, j, mute, lvol, rvol, 0); + } + continue; + } + if (w->ossdev != dev) + continue; + hdaa_audio_ctl_source_volume(pdevinfo, dev, + w->nid, -1, mute, lvol, rvol, 0); + if (dev == SOUND_MIXER_IMIX && (w->pflags & HDAA_IMIX_AS_DST)) + hdaa_audio_ctl_dest_volume(pdevinfo, dev, + w->nid, -1, mute, lvol, rvol, 0); + } } +/* + * OSS Mixer set method. + */ static int hdaa_audio_ctl_ossmixer_set(struct snd_mixer *m, unsigned dev, unsigned left, unsigned right) @@ -1908,12 +2128,10 @@ hdaa_audio_ctl_ossmixer_set(struct snd_m struct hdaa_pcm_devinfo *pdevinfo = mix_getdevinfo(m); struct hdaa_devinfo *devinfo = pdevinfo->devinfo; struct hdaa_widget *w; - struct hdaa_audio_ctl *ctl; - uint32_t mute; - int lvol, rvol; - int i, j; + int i; hdaa_lock(devinfo); + /* Save new values. */ pdevinfo->left[dev] = left; pdevinfo->right[dev] = right; @@ -1954,39 +2172,57 @@ hdaa_audio_ctl_ossmixer_set(struct snd_m } /* Recalculate all controls related to this OSS device. */ - i = 0; - while ((ctl = hdaa_audio_ctl_each(devinfo, &i)) != NULL) { - if (ctl->enable == 0 || - !(ctl->ossmask & (1 << dev))) + hdaa_audio_ctl_dev_volume(pdevinfo, dev); + + hdaa_unlock(devinfo); + return (left | (right << 8)); +} + +/* + * Set mixer settings to our own default values: + * +20dB for mics, -10dB for analog vol, mute for igain, 0dB for others. + */ +static void +hdaa_audio_ctl_set_defaults(struct hdaa_pcm_devinfo *pdevinfo) +{ + int amp, vol, dev; + + for (dev = 0; dev < SOUND_MIXER_NRDEVICES; dev++) { + if ((pdevinfo->ossmask & (1 << dev)) == 0) continue; - if (!((pdevinfo->playas >= 0 && - ctl->widget->bindas == pdevinfo->playas) || - (pdevinfo->recas >= 0 && - ctl->widget->bindas == pdevinfo->recas) || - ctl->widget->bindas == -2)) + + /* If the value was overriden, leave it as is. */ + if (resource_int_value(device_get_name(pdevinfo->dev), + device_get_unit(pdevinfo->dev), ossnames[dev], &vol) == 0) continue; - lvol = 100; - rvol = 100; - for (j = 0; j < SOUND_MIXER_NRDEVICES; j++) { - if (ctl->ossmask & (1 << j)) { - lvol = lvol * pdevinfo->left[j] / 100; - rvol = rvol * pdevinfo->right[j] / 100; - } + vol = -1; + if (dev == SOUND_MIXER_OGAIN) + vol = 100; + else if (dev == SOUND_MIXER_IGAIN) + vol = 0; + else if (dev == SOUND_MIXER_MIC || + dev == SOUND_MIXER_MONITOR) + amp = 20 * 4; /* +20dB */ + else if (dev == SOUND_MIXER_VOLUME && !pdevinfo->digital) + amp = -10 * 4; /* -10dB */ + else + amp = 0; + if (vol < 0 && + (pdevinfo->maxamp[dev] - pdevinfo->minamp[dev]) <= 0) { + vol = 100; + } else if (vol < 0) { + vol = ((amp - pdevinfo->minamp[dev]) * 100 + + (pdevinfo->maxamp[dev] - pdevinfo->minamp[dev]) / 2) / + (pdevinfo->maxamp[dev] - pdevinfo->minamp[dev]); + vol = imin(imax(vol, 1), 100); } - mute = (lvol == 0) ? HDAA_AMP_MUTE_LEFT : 0; - mute |= (rvol == 0) ? HDAA_AMP_MUTE_RIGHT : 0; - lvol = (lvol * ctl->step + 50) / 100; - rvol = (rvol * ctl->step + 50) / 100; - hdaa_audio_ctl_amp_set(ctl, mute, lvol, rvol); + mix_set(pdevinfo->mixer, dev, vol, vol); } - hdaa_unlock(devinfo); - - return (left | (right << 8)); } /* - * Commutate specified record source. + * Recursively commutate specified record source. */ static uint32_t hdaa_audio_ctl_recsel_comm(struct hdaa_pcm_devinfo *pdevinfo, uint32_t src, nid_t nid, int depth) @@ -2069,6 +2305,7 @@ hdaa_audio_ctl_ossmixer_setrecsrc(struct struct hdaa_devinfo *devinfo = pdevinfo->devinfo; struct hdaa_widget *w; struct hdaa_audio_as *as; + struct hdaa_audio_ctl *ctl; struct hdaa_chan *ch; int i, j; uint32_t ret = 0xffffffff; @@ -2097,9 +2334,47 @@ hdaa_audio_ctl_ossmixer_setrecsrc(struct ch->io[i], 0); } } + if (ret == 0xffffffff) + ret = 0; + + /* + * Some controls could be shared. Reset volumes for controls + * related to previously chosen devices, as they may no longer + * affect the signal. + */ + i = 0; + while ((ctl = hdaa_audio_ctl_each(devinfo, &i)) != NULL) { + if (ctl->enable == 0 || + !(ctl->ossmask & pdevinfo->recsrc)) + continue; + if (!((pdevinfo->playas >= 0 && + ctl->widget->bindas == pdevinfo->playas) || + (pdevinfo->recas >= 0 && + ctl->widget->bindas == pdevinfo->recas) || + (pdevinfo->index == 0 && + ctl->widget->bindas == -2))) + continue; + for (j = 0; j < SOUND_MIXER_NRDEVICES; j++) { + if (pdevinfo->recsrc & (1 << j)) { + ctl->devleft[j] = 0; + ctl->devright[j] = 0; + ctl->devmute[j] = 0; + } + } + } + /* + * Some controls could be shared. Set volumes for controls + * related to devices selected both previously and now. + */ + for (j = 0; j < SOUND_MIXER_NRDEVICES; j++) { + if ((ret | pdevinfo->recsrc) & (1 << j)) + hdaa_audio_ctl_dev_volume(pdevinfo, j); + } + + pdevinfo->recsrc = ret; hdaa_unlock(devinfo); - return ((ret == 0xffffffff)? 0 : ret); + return (ret); } static kobj_method_t hdaa_audio_ctl_ossmixer_methods[] = { @@ -3782,31 +4057,31 @@ hdaa_audio_disable_crossas(struct hdaa_d } -#define HDA_CTL_GIVE(ctl) ((ctl)->step?1:0) - /* - * Find controls to control amplification for source. + * Find controls to control amplification for source and calculate possible + * amplification range. */ static int hdaa_audio_ctl_source_amp(struct hdaa_devinfo *devinfo, nid_t nid, int index, - int ossdev, int ctlable, int depth, int need) + int ossdev, int ctlable, int depth, int *minamp, int *maxamp) { struct hdaa_widget *w, *wc; struct hdaa_audio_ctl *ctl; - int i, j, conns = 0, rneed; + int i, j, conns = 0, tminamp, tmaxamp, cminamp, cmaxamp, found = 0; if (depth > HDA_PARSE_MAXDEPTH) - return (need); + return (found); w = hdaa_widget_get(devinfo, nid); if (w == NULL || w->enable == 0) - return (need); + return (found); /* Count number of active inputs. */ if (depth > 0) { for (j = 0; j < w->nconns; j++) { - if (w->connsenable[j]) - conns++; + if (!w->connsenable[j]) + continue; + conns++; } } @@ -3817,81 +4092,96 @@ hdaa_audio_ctl_source_amp(struct hdaa_de ctl = hdaa_audio_ctl_amp_get(devinfo, w->nid, HDAA_CTL_IN, index, 1); if (ctl) { - if (HDA_CTL_GIVE(ctl) & need) - ctl->ossmask |= (1 << ossdev); - else - ctl->possmask |= (1 << ossdev); - need &= ~HDA_CTL_GIVE(ctl); + ctl->ossmask |= (1 << ossdev); + found++; + if (*minamp == *maxamp) { + *minamp += MINQDB(ctl); + *maxamp += MAXQDB(ctl); + } } } /* If widget has own ossdev - not traverse it. It will be traversed on it's own. */ if (w->ossdev >= 0 && depth > 0) - return (need); + return (found); /* We must not traverse pin */ if ((w->type == HDA_PARAM_AUDIO_WIDGET_CAP_TYPE_AUDIO_INPUT || w->type == HDA_PARAM_AUDIO_WIDGET_CAP_TYPE_PIN_COMPLEX) && depth > 0) - return (need); + return (found); /* record that this widget exports such signal, */ w->ossmask |= (1 << ossdev); - /* If signals mixed, we can't assign controls farther. + /* + * If signals mixed, we can't assign controls farther. * Ignore this on depth zero. Caller must knows why. - * Ignore this for static selectors if this input selected. */ - if (conns > 1) + if (conns > 1 && + w->type == HDA_PARAM_AUDIO_WIDGET_CAP_TYPE_AUDIO_MIXER) ctlable = 0; if (ctlable) { ctl = hdaa_audio_ctl_amp_get(devinfo, w->nid, HDAA_CTL_OUT, -1, 1); if (ctl) { - if (HDA_CTL_GIVE(ctl) & need) - ctl->ossmask |= (1 << ossdev); - else - ctl->possmask |= (1 << ossdev); - need &= ~HDA_CTL_GIVE(ctl); + ctl->ossmask |= (1 << ossdev); + found++; + if (*minamp == *maxamp) { + *minamp += MINQDB(ctl); + *maxamp += MAXQDB(ctl); + } } } - rneed = 0; + cminamp = cmaxamp = 0; for (i = devinfo->startnode; i < devinfo->endnode; i++) { wc = hdaa_widget_get(devinfo, i); if (wc == NULL || wc->enable == 0) continue; for (j = 0; j < wc->nconns; j++) { if (wc->connsenable[j] && wc->conns[j] == nid) { - rneed |= hdaa_audio_ctl_source_amp(devinfo, - wc->nid, j, ossdev, ctlable, depth + 1, need); + tminamp = tmaxamp = 0; + found += hdaa_audio_ctl_source_amp(devinfo, + wc->nid, j, ossdev, ctlable, depth + 1, + &tminamp, &tmaxamp); + if (cminamp == 0 && cmaxamp == 0) { + cminamp = tminamp; + cmaxamp = tmaxamp; + } else if (tminamp != tmaxamp) { + cminamp = imax(cminamp, tminamp); + cmaxamp = imin(cmaxamp, tmaxamp); + } } } } - rneed &= need; - - return (rneed); + if (*minamp == *maxamp && cminamp < cmaxamp) { + *minamp += cminamp; + *maxamp += cmaxamp; + } + return (found); } /* - * Find controls to control amplification for destination. + * Find controls to control amplification for destination and calculate + * possible amplification range. */ -static void +static int hdaa_audio_ctl_dest_amp(struct hdaa_devinfo *devinfo, nid_t nid, int index, - int ossdev, int depth, int need) + int ossdev, int depth, int *minamp, int *maxamp) { struct hdaa_audio_as *as = devinfo->as; struct hdaa_widget *w, *wc; struct hdaa_audio_ctl *ctl; - int i, j, consumers; + int i, j, consumers, tminamp, tmaxamp, cminamp, cmaxamp, found = 0; if (depth > HDA_PARSE_MAXDEPTH) - return; + return (found); w = hdaa_widget_get(devinfo, nid); if (w == NULL || w->enable == 0) - return; + return (found); if (depth > 0) { /* If this node produce output for several consumers, @@ -3914,43 +4204,58 @@ hdaa_audio_ctl_dest_amp(struct hdaa_devi as[w->bindas].hpredir < 0 || as[w->bindas].fakeredir || (w->bindseqmask & (1 << 15)) == 0)) || consumers > 2) - return; + return (found); /* Else use it's output mixer. */ ctl = hdaa_audio_ctl_amp_get(devinfo, w->nid, HDAA_CTL_OUT, -1, 1); if (ctl) { - if (HDA_CTL_GIVE(ctl) & need) - ctl->ossmask |= (1 << ossdev); - else - ctl->possmask |= (1 << ossdev); - need &= ~HDA_CTL_GIVE(ctl); + ctl->ossmask |= (1 << ossdev); + found++; + if (*minamp == *maxamp) { + *minamp += MINQDB(ctl); + *maxamp += MAXQDB(ctl); + } } } /* We must not traverse pin */ if (w->type == HDA_PARAM_AUDIO_WIDGET_CAP_TYPE_PIN_COMPLEX && depth > 0) - return; + return (found); + cminamp = cmaxamp = 0; for (i = 0; i < w->nconns; i++) { - int tneed = need; if (w->connsenable[i] == 0) continue; if (index >= 0 && i != index) continue; + tminamp = tmaxamp = 0; ctl = hdaa_audio_ctl_amp_get(devinfo, w->nid, HDAA_CTL_IN, i, 1); if (ctl) { - if (HDA_CTL_GIVE(ctl) & tneed) - ctl->ossmask |= (1 << ossdev); - else - ctl->possmask |= (1 << ossdev); - tneed &= ~HDA_CTL_GIVE(ctl); - } - hdaa_audio_ctl_dest_amp(devinfo, w->conns[i], -1, ossdev, - depth + 1, tneed); + ctl->ossmask |= (1 << ossdev); + found++; + if (*minamp == *maxamp) { + tminamp += MINQDB(ctl); + tmaxamp += MAXQDB(ctl); + } + } + found += hdaa_audio_ctl_dest_amp(devinfo, w->conns[i], -1, ossdev, + depth + 1, &tminamp, &tmaxamp); + if (cminamp == 0 && cmaxamp == 0) { + cminamp = tminamp; + cmaxamp = tmaxamp; + } else if (tminamp != tmaxamp) { + cminamp = imax(cminamp, tminamp); + cmaxamp = imin(cmaxamp, tmaxamp); + } + } + if (*minamp == *maxamp && cminamp < cmaxamp) { + *minamp += cminamp; + *maxamp += cmaxamp; } + return (found); } /* @@ -4158,43 +4463,82 @@ retry: hdaa_audio_trace_as_extra(devinfo); } +/* + * Store in pdevinfo new data about whether and how we can control signal + * for OSS device to/from specified widget. + */ +static void +hdaa_adjust_amp(struct hdaa_widget *w, int ossdev, + int found, int minamp, int maxamp) +{ + struct hdaa_devinfo *devinfo = w->devinfo; + struct hdaa_pcm_devinfo *pdevinfo; + + if (w->bindas >= 0) + pdevinfo = devinfo->as[w->bindas].pdevinfo; + else + pdevinfo = &devinfo->devs[0]; + if (found) + pdevinfo->ossmask |= (1 << ossdev); + if (minamp == 0 && maxamp == 0) + return; + if (pdevinfo->minamp[ossdev] == 0 && pdevinfo->maxamp[ossdev] == 0) { + pdevinfo->minamp[ossdev] = minamp; + pdevinfo->maxamp[ossdev] = maxamp; + } else { + pdevinfo->minamp[ossdev] = imax(pdevinfo->minamp[ossdev], minamp); + pdevinfo->maxamp[ossdev] = imin(pdevinfo->maxamp[ossdev], maxamp); + } +} + +/* + * Trace signals from/to all possible sources/destionstions to find possible + * recording sources, OSS device control ranges and to assign controls. + */ static void hdaa_audio_assign_mixers(struct hdaa_devinfo *devinfo) { struct hdaa_audio_as *as = devinfo->as; - struct hdaa_audio_ctl *ctl; struct hdaa_widget *w, *cw; - int i, j; + int i, j, minamp, maxamp, found; /* Assign mixers to the tree. */ for (i = devinfo->startnode; i < devinfo->endnode; i++) { w = hdaa_widget_get(devinfo, i); if (w == NULL || w->enable == 0) continue; + minamp = maxamp = 0; if (w->type == HDA_PARAM_AUDIO_WIDGET_CAP_TYPE_AUDIO_OUTPUT || w->type == HDA_PARAM_AUDIO_WIDGET_CAP_TYPE_BEEP_WIDGET || (w->type == HDA_PARAM_AUDIO_WIDGET_CAP_TYPE_PIN_COMPLEX && as[w->bindas].dir == HDAA_CTL_IN)) { if (w->ossdev < 0) continue; - hdaa_audio_ctl_source_amp(devinfo, w->nid, -1, - w->ossdev, 1, 0, 1); + found = hdaa_audio_ctl_source_amp(devinfo, w->nid, -1, + w->ossdev, 1, 0, &minamp, &maxamp); + hdaa_adjust_amp(w, w->ossdev, found, minamp, maxamp); } else if (w->type == HDA_PARAM_AUDIO_WIDGET_CAP_TYPE_AUDIO_INPUT) { - hdaa_audio_ctl_dest_amp(devinfo, w->nid, -1, - SOUND_MIXER_RECLEV, 0, 1); + found = hdaa_audio_ctl_dest_amp(devinfo, w->nid, -1, + SOUND_MIXER_RECLEV, 0, &minamp, &maxamp); + hdaa_adjust_amp(w, SOUND_MIXER_RECLEV, found, minamp, maxamp); } else if (w->type == HDA_PARAM_AUDIO_WIDGET_CAP_TYPE_PIN_COMPLEX && as[w->bindas].dir == HDAA_CTL_OUT) { - hdaa_audio_ctl_dest_amp(devinfo, w->nid, -1, - SOUND_MIXER_VOLUME, 0, 1); + found = hdaa_audio_ctl_dest_amp(devinfo, w->nid, -1, + SOUND_MIXER_VOLUME, 0, &minamp, &maxamp); + hdaa_adjust_amp(w, SOUND_MIXER_VOLUME, found, minamp, maxamp); } if (w->ossdev == SOUND_MIXER_IMIX) { - if (hdaa_audio_ctl_source_amp(devinfo, w->nid, -1, - w->ossdev, 1, 0, 1)) { + minamp = maxamp = 0; + found = hdaa_audio_ctl_source_amp(devinfo, w->nid, -1, + w->ossdev, 1, 0, &minamp, &maxamp); + if (minamp == maxamp) { /* If we are unable to control input monitor as source - try to control it as destination. */ - hdaa_audio_ctl_dest_amp(devinfo, w->nid, -1, - w->ossdev, 0, 1); + found += hdaa_audio_ctl_dest_amp(devinfo, w->nid, -1, + w->ossdev, 0, &minamp, &maxamp); + w->pflags |= HDAA_IMIX_AS_DST; } + hdaa_adjust_amp(w, w->ossdev, found, minamp, maxamp); } if (w->pflags & HDAA_ADC_MONITOR) { for (j = 0; j < w->nconns; j++) { @@ -4208,17 +4552,15 @@ hdaa_audio_assign_mixers(struct hdaa_dev if (cw->bindas >= 0 && as[cw->bindas].dir != HDAA_CTL_IN) continue; - hdaa_audio_ctl_dest_amp(devinfo, - w->nid, j, SOUND_MIXER_IGAIN, 0, 1); + minamp = maxamp = 0; + found = hdaa_audio_ctl_dest_amp(devinfo, + w->nid, j, SOUND_MIXER_IGAIN, 0, + &minamp, &maxamp); + hdaa_adjust_amp(w, SOUND_MIXER_IGAIN, + found, minamp, maxamp); } } } - /* Treat unrequired as possible. */ - i = 0; - while ((ctl = hdaa_audio_ctl_each(devinfo, &i)) != NULL) { - if (ctl->ossmask == 0) - ctl->ossmask = ctl->possmask; - } } static void @@ -4671,7 +5013,7 @@ hdaa_pcmchannel_setup(struct hdaa_chan * } static void -hdaa_create_pcms(struct hdaa_devinfo *devinfo) +hdaa_prepare_pcms(struct hdaa_devinfo *devinfo) { struct hdaa_audio_as *as = devinfo->as; int i, j, k, apdev = 0, ardev = 0, dpdev = 0, drdev = 0; @@ -4726,6 +5068,7 @@ hdaa_create_pcms(struct hdaa_devinfo *de continue; devinfo->devs[j].playas = i; } + as[i].pdevinfo = &devinfo->devs[j]; for (k = 0; k < as[i].num_chans; k++) { devinfo->chans[as[i].chans[k]].pdevinfo = &devinfo->devs[j]; @@ -4734,6 +5077,13 @@ hdaa_create_pcms(struct hdaa_devinfo *de break; } } +} + +static void +hdaa_create_pcms(struct hdaa_devinfo *devinfo) +{ + int i; + for (i = 0; i < devinfo->num_devs; i++) { struct hdaa_pcm_devinfo *pdevinfo = &devinfo->devs[i]; @@ -4782,9 +5132,15 @@ hdaa_dump_ctls(struct hdaa_pcm_devinfo * } else { device_printf(pdevinfo->dev, "Unknown Ctl"); } - printf(" (OSS: %s)\n", + printf(" (OSS: %s)", hdaa_audio_ctl_ossmixer_mask2allname(1 << j, buf, sizeof(buf))); + if (pdevinfo->ossmask & (1 << j)) { + printf(": %+d/%+ddB\n", + pdevinfo->minamp[j] / 4, + pdevinfo->maxamp[j] / 4); + } else + printf("\n"); device_printf(pdevinfo->dev, " |\n"); printed = 1; } @@ -4797,8 +5153,8 @@ hdaa_dump_ctls(struct hdaa_pcm_devinfo * printf("): "); if (ctl->step > 0) { printf("%+d/%+ddB (%d steps)%s\n", - (0 - ctl->offset) * (ctl->size + 1) / 4, - (ctl->step - ctl->offset) * (ctl->size + 1) / 4, + MINQDB(ctl) / 4, + MAXQDB(ctl) / 4, ctl->step + 1, ctl->mute?" + mute":""); *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@FreeBSD.ORG Sun Jan 22 10:41:59 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6178F106566C; Sun, 22 Jan 2012 10:41:59 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 507A38FC12; Sun, 22 Jan 2012 10:41:59 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q0MAfxQ5072302; Sun, 22 Jan 2012 10:41:59 GMT (envelope-from bz@svn.freebsd.org) Received: (from bz@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0MAfxDU072298; Sun, 22 Jan 2012 10:41:59 GMT (envelope-from bz@svn.freebsd.org) Message-Id: <201201221041.q0MAfxDU072298@svn.freebsd.org> From: "Bjoern A. Zeeb" Date: Sun, 22 Jan 2012 10:41:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r230452 - in head/sys/netinet: . ipfw X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 22 Jan 2012 10:41:59 -0000 Author: bz Date: Sun Jan 22 10:41:58 2012 New Revision: 230452 URL: http://svn.freebsd.org/changeset/base/230452 Log: Make #error messages string-literals and remove punctuation. Reported by: bde (for ip_divert) Reviewed by: bde MFC after: 3 days Modified: head/sys/netinet/ip_divert.c head/sys/netinet/ip_gre.c head/sys/netinet/ipfw/ip_fw2.c Modified: head/sys/netinet/ip_divert.c ============================================================================== --- head/sys/netinet/ip_divert.c Sun Jan 22 10:24:12 2012 (r230451) +++ head/sys/netinet/ip_divert.c Sun Jan 22 10:41:58 2012 (r230452) @@ -34,7 +34,7 @@ __FBSDID("$FreeBSD$"); #include "opt_inet6.h" #include "opt_sctp.h" #ifndef INET -#error "IPDIVERT requires INET." +#error "IPDIVERT requires INET" #endif #include Modified: head/sys/netinet/ip_gre.c ============================================================================== --- head/sys/netinet/ip_gre.c Sun Jan 22 10:24:12 2012 (r230451) +++ head/sys/netinet/ip_gre.c Sun Jan 22 10:41:58 2012 (r230452) @@ -70,7 +70,7 @@ __FBSDID("$FreeBSD$"); #include #include #else -#error ip_gre input without IP? +#error "ip_gre requires INET" #endif #ifdef NETATALK Modified: head/sys/netinet/ipfw/ip_fw2.c ============================================================================== --- head/sys/netinet/ipfw/ip_fw2.c Sun Jan 22 10:24:12 2012 (r230451) +++ head/sys/netinet/ipfw/ip_fw2.c Sun Jan 22 10:41:58 2012 (r230452) @@ -34,7 +34,7 @@ __FBSDID("$FreeBSD$"); #include "opt_ipdivert.h" #include "opt_inet.h" #ifndef INET -#error IPFIREWALL requires INET. +#error "IPFIREWALL requires INET" #endif /* INET */ #include "opt_inet6.h" #include "opt_ipsec.h" From owner-svn-src-all@FreeBSD.ORG Sun Jan 22 10:57:32 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CAAB2106566B; Sun, 22 Jan 2012 10:57:32 +0000 (UTC) (envelope-from hrs@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 9F5A98FC0C; Sun, 22 Jan 2012 10:57:32 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q0MAvWjv072825; Sun, 22 Jan 2012 10:57:32 GMT (envelope-from hrs@svn.freebsd.org) Received: (from hrs@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0MAvW5n072822; Sun, 22 Jan 2012 10:57:32 GMT (envelope-from hrs@svn.freebsd.org) Message-Id: <201201221057.q0MAvW5n072822@svn.freebsd.org> From: Hiroki Sato Date: Sun, 22 Jan 2012 10:57:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r230453 - in head/etc: . rc.d X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 22 Jan 2012 10:57:32 -0000 Author: hrs Date: Sun Jan 22 10:57:32 2012 New Revision: 230453 URL: http://svn.freebsd.org/changeset/base/230453 Log: Fix several glitches in IPv6-related knobs: - ipv6_enable + ipv6_gateway_enable should unset ACCEPT_RTADV by default for backward compatibility. - Configurations in ipv6_prefix_IF should be recognized even if there is no ifconfig_IF_ipv6. - DAD wait should be performed at once, not on a per-interface basis, if possible. This fixes an issue that a system with a lot of IPv6-capable interfaces takes too long for booting. MFC after: 1 week Modified: head/etc/network.subr head/etc/rc.d/netif Modified: head/etc/network.subr ============================================================================== --- head/etc/network.subr Sun Jan 22 10:41:58 2012 (r230452) +++ head/etc/network.subr Sun Jan 22 10:57:32 2012 (r230453) @@ -109,8 +109,10 @@ ifconfig_up() # backward compatibility: $ipv6_enable case $ipv6_enable in [Yy][Ee][Ss]|[Tt][Rr][Uu][Ee]|[Oo][Nn]|1) - _ipv6_opts="${_ipv6_opts} accept_rtadv" - ;; + if ! checkyesno ipv6_gateway_enable; then + _ipv6_opts="${_ipv6_opts} accept_rtadv" + fi + ;; esac case $ipv6_cpe_wanif in @@ -139,6 +141,14 @@ ifconfig_up() _cfg=0 fi + # $ipv6_prefix_IF will be handled in + # ipv6_prefix_hostid_addr_common(). + ifconfig_args=`get_if_var $1 ipv6_prefix_IF` + if [ -n "${ifconfig_args}" ]; then + ifconfig $1 inet6 -ifdisabled + _cfg=0 + fi + # backward compatibility: $ipv6_ifconfig_IF ifconfig_args=`get_if_var $1 ipv6_ifconfig_IF` if [ -n "${ifconfig_args}" ]; then @@ -444,6 +454,12 @@ ipv6if() return 0 fi + # True if $ipv6_prefix_IF is defined. + _tmpargs=`get_if_var $_if ipv6_prefix_IF` + if [ -n "${_tmpargs}" ]; then + return 0 + fi + # backward compatibility: True if $ipv6_ifconfig_IF is defined. _tmpargs=`get_if_var $_if ipv6_ifconfig_IF` if [ -n "${_tmpargs}" ]; then @@ -559,10 +575,6 @@ ipv6_up() ipv6_prefix_hostid_addr_common ${_if} alias && _ret=0 ipv6_accept_rtadv_up ${_if} && _ret=0 - # wait for DAD - sleep `${SYSCTL_N} net.inet6.ip6.dad_count` - sleep 1 - return $_ret } Modified: head/etc/rc.d/netif ============================================================================== --- head/etc/rc.d/netif Sun Jan 22 10:41:58 2012 (r230452) +++ head/etc/rc.d/netif Sun Jan 22 10:57:32 2012 (r230453) @@ -123,16 +123,26 @@ network_common() _cooked_list="`list_net_interfaces`" fi + _dadwait= _fail= _ok= for ifn in ${_cooked_list}; do if ${_func} ${ifn} $2; then _ok="${_ok} ${ifn}" + if ipv6if ${ifn}; then + _dadwait=1 + fi else _fail="${_fail} ${ifn}" fi done + # inet6 address configuration needs sleep for DAD. + if [ -n "${_dadwait}" ]; then + sleep `${SYSCTL_N} net.inet6.ip6.dad_count` + sleep 1 + fi + _str= if [ -n "${_ok}" ]; then case ${_func} in From owner-svn-src-all@FreeBSD.ORG Sun Jan 22 10:58:18 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 10A34106564A; Sun, 22 Jan 2012 10:58:18 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id F3A5A8FC1A; Sun, 22 Jan 2012 10:58:17 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q0MAwHYJ072888; Sun, 22 Jan 2012 10:58:17 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0MAwHXx072886; Sun, 22 Jan 2012 10:58:17 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <201201221058.q0MAwHXx072886@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Sun, 22 Jan 2012 10:58:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r230454 - head/sys/cddl/compat/opensolaris/sys X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 22 Jan 2012 10:58:18 -0000 Author: pjd Date: Sun Jan 22 10:58:17 2012 New Revision: 230454 URL: http://svn.freebsd.org/changeset/base/230454 Log: Use provided name when allocating ksid domain. It isn't really used on FreeBSD, but should fix a panic when pool is imported from another OS that is using this. MFC after: 1 week Modified: head/sys/cddl/compat/opensolaris/sys/sid.h Modified: head/sys/cddl/compat/opensolaris/sys/sid.h ============================================================================== --- head/sys/cddl/compat/opensolaris/sys/sid.h Sun Jan 22 10:57:32 2012 (r230453) +++ head/sys/cddl/compat/opensolaris/sys/sid.h Sun Jan 22 10:58:17 2012 (r230454) @@ -30,7 +30,7 @@ #define _OPENSOLARIS_SYS_SID_H_ typedef struct ksiddomain { - char kd_name[16]; /* Domain part of SID */ + char kd_name[1]; /* Domain part of SID */ } ksiddomain_t; typedef void ksid_t; @@ -39,8 +39,8 @@ ksid_lookupdomain(const char *domain) { ksiddomain_t *kd; - kd = kmem_alloc(sizeof(*kd), KM_SLEEP); - strlcpy(kd->kd_name, "FreeBSD", sizeof(kd->kd_name)); + kd = kmem_alloc(sizeof(*kd) + strlen(domain), KM_SLEEP); + strcpy(kd->kd_name, domain); return (kd); } From owner-svn-src-all@FreeBSD.ORG Sun Jan 22 11:01:37 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 13346106566C; Sun, 22 Jan 2012 11:01:37 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 020B68FC15; Sun, 22 Jan 2012 11:01:37 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q0MB1aX0073049; Sun, 22 Jan 2012 11:01:36 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0MB1aHC073046; Sun, 22 Jan 2012 11:01:36 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <201201221101.q0MB1aHC073046@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Sun, 22 Jan 2012 11:01:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r230455 - in head/sys: arm/arm kern X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 22 Jan 2012 11:01:37 -0000 Author: pjd Date: Sun Jan 22 11:01:36 2012 New Revision: 230455 URL: http://svn.freebsd.org/changeset/base/230455 Log: TDF_* flags should be used with td_flags field and TDP_* flags should be used with td_pflags field. Correct two places where it was not the case. Discussed with: kib MFC after: 1 week Modified: head/sys/arm/arm/machdep.c head/sys/kern/init_main.c Modified: head/sys/arm/arm/machdep.c ============================================================================== --- head/sys/arm/arm/machdep.c Sun Jan 22 10:58:17 2012 (r230454) +++ head/sys/arm/arm/machdep.c Sun Jan 22 11:01:36 2012 (r230455) @@ -137,7 +137,7 @@ sendsig(catcher, ksi, mask) catcher, sig); /* Allocate and validate space for the signal handler context. */ - if ((td->td_flags & TDP_ALTSTACK) != 0 && !(onstack) && + if ((td->td_pflags & TDP_ALTSTACK) != 0 && !(onstack) && SIGISMEMBER(psp->ps_sigonstack, sig)) { fp = (struct sigframe *)(td->td_sigstk.ss_sp + td->td_sigstk.ss_size); Modified: head/sys/kern/init_main.c ============================================================================== --- head/sys/kern/init_main.c Sun Jan 22 10:58:17 2012 (r230454) +++ head/sys/kern/init_main.c Sun Jan 22 11:01:36 2012 (r230455) @@ -467,7 +467,8 @@ proc0_init(void *dummy __unused) td->td_priority = PVM; td->td_base_pri = PVM; td->td_oncpu = 0; - td->td_flags = TDF_INMEM|TDP_KTHREAD; + td->td_flags = TDF_INMEM; + td->td_pflags = TDP_KTHREAD; td->td_cpuset = cpuset_thread0(); prison0.pr_cpuset = cpuset_ref(td->td_cpuset); p->p_peers = 0; From owner-svn-src-all@FreeBSD.ORG Sun Jan 22 11:15:49 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3CDE5106564A; Sun, 22 Jan 2012 11:15:49 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 2BA048FC18; Sun, 22 Jan 2012 11:15:49 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q0MBFntH073519; Sun, 22 Jan 2012 11:15:49 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0MBFnF7073516; Sun, 22 Jan 2012 11:15:49 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <201201221115.q0MBFnF7073516@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Sun, 22 Jan 2012 11:15:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r230456 - head/lib/libc/sys X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 22 Jan 2012 11:15:49 -0000 Author: pjd Date: Sun Jan 22 11:15:48 2012 New Revision: 230456 URL: http://svn.freebsd.org/changeset/base/230456 Log: The sys/uio.h header is needed only for readv(2), preadv(2), writev(2) and pwritev(2). Document it more precisely. Reviewed by: jilles MFC after: 3 days Modified: head/lib/libc/sys/read.2 head/lib/libc/sys/write.2 Modified: head/lib/libc/sys/read.2 ============================================================================== --- head/lib/libc/sys/read.2 Sun Jan 22 11:01:36 2012 (r230455) +++ head/lib/libc/sys/read.2 Sun Jan 22 11:15:48 2012 (r230456) @@ -28,7 +28,7 @@ .\" @(#)read.2 8.4 (Berkeley) 2/26/94 .\" $FreeBSD$ .\" -.Dd October 11, 2006 +.Dd January 22, 2012 .Dt READ 2 .Os .Sh NAME @@ -41,12 +41,12 @@ .Lb libc .Sh SYNOPSIS .In sys/types.h -.In sys/uio.h .In unistd.h .Ft ssize_t .Fn read "int d" "void *buf" "size_t nbytes" .Ft ssize_t .Fn pread "int d" "void *buf" "size_t nbytes" "off_t offset" +.In sys/uio.h .Ft ssize_t .Fn readv "int d" "const struct iovec *iov" "int iovcnt" .Ft ssize_t Modified: head/lib/libc/sys/write.2 ============================================================================== --- head/lib/libc/sys/write.2 Sun Jan 22 11:01:36 2012 (r230455) +++ head/lib/libc/sys/write.2 Sun Jan 22 11:15:48 2012 (r230456) @@ -28,7 +28,7 @@ .\" @(#)write.2 8.5 (Berkeley) 4/2/94 .\" $FreeBSD$ .\" -.Dd July 7, 2005 +.Dd January 22, 2012 .Dt WRITE 2 .Os .Sh NAME @@ -41,12 +41,12 @@ .Lb libc .Sh SYNOPSIS .In sys/types.h -.In sys/uio.h .In unistd.h .Ft ssize_t .Fn write "int d" "const void *buf" "size_t nbytes" .Ft ssize_t .Fn pwrite "int d" "const void *buf" "size_t nbytes" "off_t offset" +.In sys/uio.h .Ft ssize_t .Fn writev "int d" "const struct iovec *iov" "int iovcnt" .Ft ssize_t From owner-svn-src-all@FreeBSD.ORG Sun Jan 22 11:20:43 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1D351106566B; Sun, 22 Jan 2012 11:20:43 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 0C59E8FC15; Sun, 22 Jan 2012 11:20:43 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q0MBKgSt073708; Sun, 22 Jan 2012 11:20:42 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0MBKgBl073706; Sun, 22 Jan 2012 11:20:42 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <201201221120.q0MBKgBl073706@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Sun, 22 Jan 2012 11:20:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r230457 - head/sbin/hastd X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 22 Jan 2012 11:20:43 -0000 Author: pjd Date: Sun Jan 22 11:20:42 2012 New Revision: 230457 URL: http://svn.freebsd.org/changeset/base/230457 Log: Free memory that won't be used in child. MFC after: 1 week Modified: head/sbin/hastd/hastd.c Modified: head/sbin/hastd/hastd.c ============================================================================== --- head/sbin/hastd/hastd.c Sun Jan 22 11:15:48 2012 (r230456) +++ head/sbin/hastd/hastd.c Sun Jan 22 11:20:42 2012 (r230457) @@ -99,10 +99,10 @@ g_gate_load(void) void descriptors_cleanup(struct hast_resource *res) { - struct hast_resource *tres; + struct hast_resource *tres, *tmres; struct hastd_listen *lst; - TAILQ_FOREACH(tres, &cfg->hc_resources, hr_next) { + TAILQ_FOREACH_SAFE(tres, &cfg->hc_resources, hr_next, tmres) { if (tres == res) { PJDLOG_VERIFY(res->hr_role == HAST_ROLE_SECONDARY || (res->hr_remotein == NULL && @@ -119,13 +119,17 @@ descriptors_cleanup(struct hast_resource proto_close(tres->hr_event); if (tres->hr_conn != NULL) proto_close(tres->hr_conn); + TAILQ_REMOVE(&cfg->hc_resources, tres, hr_next); + free(tres); } if (cfg->hc_controlin != NULL) proto_close(cfg->hc_controlin); proto_close(cfg->hc_controlconn); - TAILQ_FOREACH(lst, &cfg->hc_listen, hl_next) { + while ((lst = TAILQ_FIRST(&cfg->hc_listen)) != NULL) { + TAILQ_REMOVE(&cfg->hc_listen, lst, hl_next); if (lst->hl_conn != NULL) proto_close(lst->hl_conn); + free(lst); } (void)pidfile_close(pfh); hook_fini(); From owner-svn-src-all@FreeBSD.ORG Sun Jan 22 11:34:24 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8E1C3106566B; Sun, 22 Jan 2012 11:34:24 +0000 (UTC) (envelope-from hrs@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 632D98FC13; Sun, 22 Jan 2012 11:34:24 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q0MBYOow074169; Sun, 22 Jan 2012 11:34:24 GMT (envelope-from hrs@svn.freebsd.org) Received: (from hrs@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0MBYOho074166; Sun, 22 Jan 2012 11:34:24 GMT (envelope-from hrs@svn.freebsd.org) Message-Id: <201201221134.q0MBYOho074166@svn.freebsd.org> From: Hiroki Sato Date: Sun, 22 Jan 2012 11:34:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r230458 - head/usr.bin/last X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 22 Jan 2012 11:34:24 -0000 Author: hrs Date: Sun Jan 22 11:34:24 2012 New Revision: 230458 URL: http://svn.freebsd.org/changeset/base/230458 Log: - Replace "wtmp" with "utx.log" because last(1) no longer reads wtmp. - A real filename is now shown in an output report when "-f file" is specified. - Add Xr lastlogin into last(1) manual page. Reviewed by: ed MFC after: 1 week Modified: head/usr.bin/last/last.1 head/usr.bin/last/last.c Modified: head/usr.bin/last/last.1 ============================================================================== --- head/usr.bin/last/last.1 Sun Jan 22 11:20:42 2012 (r230457) +++ head/usr.bin/last/last.1 Sun Jan 22 11:34:24 2012 (r230458) @@ -198,6 +198,7 @@ login data base .El .Sh SEE ALSO .Xr lastcomm 1 , +.Xr lastlogin 8 , .Xr getutxent 3 , .Xr ac 8 .Sh HISTORY Modified: head/usr.bin/last/last.c ============================================================================== --- head/usr.bin/last/last.c Sun Jan 22 11:20:42 2012 (r230457) +++ head/usr.bin/last/last.c Sun Jan 22 11:34:24 2012 (r230458) @@ -83,7 +83,7 @@ struct idtab { static const char *crmsg; /* cause of last reboot */ static time_t currentout; /* current logout value */ static long maxrec; /* records to display */ -static const char *file = NULL; /* wtmp file */ +static const char *file = NULL; /* utx.log file */ static int sflag = 0; /* show delta in seconds */ static int width = 5; /* show seconds in delta */ static int yflag; /* show year */ @@ -194,7 +194,7 @@ main(int argc, char *argv[]) /* * wtmp -- - * read through the wtmp file + * read through the utx.log file */ static void wtmp(void) @@ -229,13 +229,13 @@ wtmp(void) doentry(&buf[--amount]); tm = localtime(&t); - (void) strftime(ct, sizeof(ct), "\nwtmp begins %+\n", tm); - printf("%s", ct); + (void) strftime(ct, sizeof(ct), "%+", tm); + printf("\n%s begins %s\n", ((file == NULL) ? "utx.log" : file), ct); } /* * doentry -- - * process a single wtmp entry + * process a single utx.log entry */ static void doentry(struct utmpx *bp) From owner-svn-src-all@FreeBSD.ORG Sun Jan 22 11:35:50 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 90156106566C; Sun, 22 Jan 2012 11:35:50 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 7F7508FC0C; Sun, 22 Jan 2012 11:35:50 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q0MBZotO074265; Sun, 22 Jan 2012 11:35:50 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0MBZo02074263; Sun, 22 Jan 2012 11:35:50 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201201221135.q0MBZo02074263@svn.freebsd.org> From: Konstantin Belousov Date: Sun, 22 Jan 2012 11:35:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r230459 - head/sys/sys X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 22 Jan 2012 11:35:50 -0000 Author: kib Date: Sun Jan 22 11:35:50 2012 New Revision: 230459 URL: http://svn.freebsd.org/changeset/base/230459 Log: Fix typo. Submitted by: John Marino MFC after: 3 days Modified: head/sys/sys/elf_common.h Modified: head/sys/sys/elf_common.h ============================================================================== --- head/sys/sys/elf_common.h Sun Jan 22 11:34:24 2012 (r230458) +++ head/sys/sys/elf_common.h Sun Jan 22 11:35:50 2012 (r230459) @@ -384,7 +384,7 @@ typedef struct { #define DT_INIT_ARRAYSZ 27 /* Size in bytes of the array of initialization functions. */ #define DT_FINI_ARRAYSZ 28 /* Size in bytes of the array of - terminationfunctions. */ + termination functions. */ #define DT_RUNPATH 29 /* String table offset of a null-terminated library search path string. */ #define DT_FLAGS 30 /* Object specific flag values. */ From owner-svn-src-all@FreeBSD.ORG Sun Jan 22 11:58:18 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 37F93106564A; Sun, 22 Jan 2012 11:58:18 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 275828FC13; Sun, 22 Jan 2012 11:58:18 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q0MBwI8R074957; Sun, 22 Jan 2012 11:58:18 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0MBwIvf074955; Sun, 22 Jan 2012 11:58:18 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201201221158.q0MBwIvf074955@svn.freebsd.org> From: Konstantin Belousov Date: Sun, 22 Jan 2012 11:58:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r230460 - head/lib/libc/sys X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 22 Jan 2012 11:58:18 -0000 Author: kib Date: Sun Jan 22 11:58:17 2012 New Revision: 230460 URL: http://svn.freebsd.org/changeset/base/230460 Log: Clarify the implementation-defined behaviour in case of close(2) returning error. MFC after: 1 week Modified: head/lib/libc/sys/close.2 Modified: head/lib/libc/sys/close.2 ============================================================================== --- head/lib/libc/sys/close.2 Sun Jan 22 11:35:50 2012 (r230459) +++ head/lib/libc/sys/close.2 Sun Jan 22 11:58:17 2012 (r230460) @@ -28,7 +28,7 @@ .\" @(#)close.2 8.2 (Berkeley) 4/19/94 .\" $FreeBSD$ .\" -.Dd December 4, 2006 +.Dd January 22, 2012 .Dt CLOSE 2 .Os .Sh NAME @@ -118,6 +118,10 @@ The underlying object did not fit, cache The underlying object was a stream socket that was shut down by the peer before all pending data was delivered. .El +.Pp +In case of any error except +.Er EBADF , +the supplied file descriptor is deallocated and therefore is no longer valid. .Sh SEE ALSO .Xr accept 2 , .Xr closefrom 2 , From owner-svn-src-all@FreeBSD.ORG Sun Jan 22 12:49:43 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 741DE106566B; Sun, 22 Jan 2012 12:49:43 +0000 (UTC) (envelope-from to.my.trociny@gmail.com) Received: from mail-bk0-f54.google.com (mail-bk0-f54.google.com [209.85.214.54]) by mx1.freebsd.org (Postfix) with ESMTP id F2EA88FC0A; Sun, 22 Jan 2012 12:49:41 +0000 (UTC) Received: by bkbc12 with SMTP id c12so2235021bkb.13 for ; Sun, 22 Jan 2012 04:49:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=from:to:cc:subject:references:x-comment-to:sender:date:in-reply-to :message-id:user-agent:mime-version:content-type; bh=0P77k/Zclchz1rZwRfXo4crCI5LFqvub1CeeF8WCRiU=; b=ju0G/fFQifYk6++6lpBhen23OkKu576seArDDzItbO0nhGWBWbVQyuV12RN/hOHn2X 6T7PubxbwRzAq1AKrmgiKpiV3QxSntKdaGrvv2rMI7W5dBroQylIWTfUQJI09q9gQ8qP PSJO4lTKqvEqG/4GsPNOxLuqtRoQHXGdEjSsk= Received: by 10.205.122.134 with SMTP id gg6mr1746211bkc.41.1327236581025; Sun, 22 Jan 2012 04:49:41 -0800 (PST) Received: from localhost ([95.69.173.122]) by mx.google.com with ESMTPS id fg16sm20597026bkb.16.2012.01.22.04.49.38 (version=TLSv1/SSLv3 cipher=OTHER); Sun, 22 Jan 2012 04:49:39 -0800 (PST) From: Mikolaj Golub To: Jaakko Heinonen References: <201201170125.q0H1PrlJ061058@svn.freebsd.org> <20120117171031.GA2316@a91-153-116-96.elisa-laajakaista.fi> X-Comment-To: Jaakko Heinonen Sender: Mikolaj Golub Date: Sun, 22 Jan 2012 14:49:36 +0200 In-Reply-To: <20120117171031.GA2316@a91-153-116-96.elisa-laajakaista.fi> (Jaakko Heinonen's message of "Tue, 17 Jan 2012 19:10:31 +0200") Message-ID: <86obtvvr4v.fsf@kopusha.home.net> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.3 (berkeley-unix) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: svn-src-head@freebsd.org, Kevin Lo , svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r230252 - head/sys/fs/tmpfs X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 22 Jan 2012 12:49:43 -0000 On Tue, 17 Jan 2012 19:10:31 +0200 Jaakko Heinonen wrote: JH> On 2012-01-17, Kevin Lo wrote: >> Return EOPNOTSUPP since we only support update mounts for NFS export. >> >> @@ -150,8 +150,12 @@ tmpfs_mount(struct mount *mp) >> return (EINVAL); >> >> if (mp->mnt_flag & MNT_UPDATE) { >> + /* >> + * Only support update mounts for NFS export. >> + */ >> if (vfs_flagopt(mp->mnt_optnew, "export", NULL, 0)) >> return (0); >> + return (EOPNOTSUPP); >> } JH> This doesn't look correct. As long as the option list includes the JH> "export" option, all options are accepted. An example: JH> # mount -u -o ro /mnt JH> mount: tmpfs : Operation not supported JH> # mount -u -o ro,export /mnt JH> # There is no error but ro is still ignored, so this is only the issue with reporting. Note, the code for nullfs (as an example) looks the same. It could be fixed with vfs_filteropt(9), not sure if this is worth doing here though. -- Mikolaj Golub From owner-svn-src-all@FreeBSD.ORG Sun Jan 22 13:42:28 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0D6E5106566C; Sun, 22 Jan 2012 13:42:28 +0000 (UTC) (envelope-from jh@FreeBSD.org) Received: from gw03.mail.saunalahti.fi (gw03.mail.saunalahti.fi [195.197.172.111]) by mx1.freebsd.org (Postfix) with ESMTP id B4CA18FC13; Sun, 22 Jan 2012 13:42:27 +0000 (UTC) Received: from a91-153-116-96.elisa-laajakaista.fi (a91-153-116-96.elisa-laajakaista.fi [91.153.116.96]) by gw03.mail.saunalahti.fi (Postfix) with SMTP id A5D02216A4C; Sun, 22 Jan 2012 15:42:20 +0200 (EET) Date: Sun, 22 Jan 2012 15:42:18 +0200 From: Jaakko Heinonen To: Mikolaj Golub Message-ID: <20120122134218.GA2247@a91-153-116-96.elisa-laajakaista.fi> References: <201201170125.q0H1PrlJ061058@svn.freebsd.org> <20120117171031.GA2316@a91-153-116-96.elisa-laajakaista.fi> <86obtvvr4v.fsf@kopusha.home.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <86obtvvr4v.fsf@kopusha.home.net> User-Agent: Mutt/1.5.21 (2010-09-15) Cc: svn-src-head@freebsd.org, Kevin Lo , svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r230252 - head/sys/fs/tmpfs X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 22 Jan 2012 13:42:28 -0000 Hi, On 2012-01-22, Mikolaj Golub wrote: > JH> # mount -u -o ro /mnt > JH> mount: tmpfs : Operation not supported > JH> # mount -u -o ro,export /mnt > JH> # > > There is no error but ro is still ignored, so this is only the issue with > reporting. Note, the code for nullfs (as an example) looks the same. This is not true. "ro" is not ignored: # mount -t tmpfs tmpfs on /mnt (tmpfs, local) # mount -u -o ro /mnt mount: tmpfs: Operation not supported # mount -t tmpfs tmpfs on /mnt (tmpfs, local) # mount -u -o ro,export /mnt # mount -t tmpfs tmpfs on /mnt (tmpfs, local, read-only) > It could be fixed with vfs_filteropt(9), not sure if this is worth doing here > though. The problem with vfs_filteropt(9) is that it will allow some additional options (global_opts list in vfs_mount.c). However those options might already work sufficiently with update mount. Here is a mostly untested patch: %%% Index: sys/fs/tmpfs/tmpfs_vfsops.c =================================================================== --- sys/fs/tmpfs/tmpfs_vfsops.c (revision 230328) +++ sys/fs/tmpfs/tmpfs_vfsops.c (working copy) @@ -82,6 +82,10 @@ static const char *tmpfs_opts[] = { NULL }; +static const char *tmpfs_updateopts[] = { + "from", "export", NULL +}; + /* --------------------------------------------------------------------- */ static int @@ -150,12 +154,10 @@ tmpfs_mount(struct mount *mp) return (EINVAL); if (mp->mnt_flag & MNT_UPDATE) { - /* - * Only support update mounts for NFS export. - */ - if (vfs_flagopt(mp->mnt_optnew, "export", NULL, 0)) - return (0); - return (EOPNOTSUPP); + /* Only support update mounts for certain options. */ + if (vfs_filteropt(mp->mnt_optnew, tmpfs_updateopts) != 0) + return (EOPNOTSUPP); + return (0); } vn_lock(mp->mnt_vnodecovered, LK_SHARED | LK_RETRY); %%% -- Jaakko From owner-svn-src-all@FreeBSD.ORG Sun Jan 22 13:51:21 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0FE0F106566B; Sun, 22 Jan 2012 13:51:21 +0000 (UTC) (envelope-from brueffer@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id F2F558FC17; Sun, 22 Jan 2012 13:51:20 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q0MDpKds078458; Sun, 22 Jan 2012 13:51:20 GMT (envelope-from brueffer@svn.freebsd.org) Received: (from brueffer@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0MDpKPJ078456; Sun, 22 Jan 2012 13:51:20 GMT (envelope-from brueffer@svn.freebsd.org) Message-Id: <201201221351.q0MDpKPJ078456@svn.freebsd.org> From: Christian Brueffer Date: Sun, 22 Jan 2012 13:51:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r230461 - head/share/man/man4 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 22 Jan 2012 13:51:21 -0000 Author: brueffer Date: Sun Jan 22 13:51:20 2012 New Revision: 230461 URL: http://svn.freebsd.org/changeset/base/230461 Log: Connect VirtIO-related manpages to the build. Modified: head/share/man/man4/Makefile Modified: head/share/man/man4/Makefile ============================================================================== --- head/share/man/man4/Makefile Sun Jan 22 11:58:17 2012 (r230460) +++ head/share/man/man4/Makefile Sun Jan 22 13:51:20 2012 (r230461) @@ -505,11 +505,15 @@ MAN= aac.4 \ viapm.4 \ ${_viawd.4} \ vinum.4 \ + ${_virtio.4} \ + ${_virtio_balloon.4} \ + ${_virtio_blk.4} \ vkbd.4 \ vlan.4 \ vpo.4 \ vr.4 \ vte.4 \ + ${_vtnet.4} \ ${_vxge.4} \ watchdog.4 \ wb.4 \ @@ -656,6 +660,7 @@ MLINKS+=vge.4 if_vge.4 MLINKS+=vlan.4 if_vlan.4 MLINKS+=vpo.4 imm.4 MLINKS+=vr.4 if_vr.4 +MLINKS+=${_vtnet.4} ${_if_vtnet.4} MLINKS+=${_vxge.4} ${_if_vxge.4} MLINKS+=watchdog.4 SW_WATCHDOG.4 MLINKS+=wb.4 if_wb.4 @@ -699,6 +704,7 @@ _if_nfe.4= if_nfe.4 _if_nve.4= if_nve.4 _if_nxge.4= if_nxge.4 _if_urtw.4= if_urtw.4 +_if_vtnet.4= if_vtnet.4 _if_vxge.4= if_vxge.4 _if_wpi.4= if_wpi.4 _ipmi.4= ipmi.4 @@ -711,6 +717,10 @@ _nfsmb.4= nfsmb.4 _nve.4= nve.4 _nvram.4= nvram.4 _nxge.4= nxge.4 +_virtio.4= virtio.4 +_virtio_balloon.4=virtio_balloon.4 +_virtio_blk.4= virtio_blk.4 +_vtnet.4= vtnet.4 _vxge.4= vxge.4 _padlock.4= padlock.4 _rr232x.4= rr232x.4 From owner-svn-src-all@FreeBSD.ORG Sun Jan 22 13:55:16 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 72D72106566C; Sun, 22 Jan 2012 13:55:16 +0000 (UTC) (envelope-from jh@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 619328FC1D; Sun, 22 Jan 2012 13:55:16 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q0MDtFNX078621; Sun, 22 Jan 2012 13:55:15 GMT (envelope-from jh@svn.freebsd.org) Received: (from jh@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0MDtFxU078619; Sun, 22 Jan 2012 13:55:15 GMT (envelope-from jh@svn.freebsd.org) Message-Id: <201201221355.q0MDtFxU078619@svn.freebsd.org> From: Jaakko Heinonen Date: Sun, 22 Jan 2012 13:55:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r230462 - stable/9/sys/fs/pseudofs X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 22 Jan 2012 13:55:16 -0000 Author: jh Date: Sun Jan 22 13:55:15 2012 New Revision: 230462 URL: http://svn.freebsd.org/changeset/base/230462 Log: MFC r229692: Check the return value of sbuf_finish() in pfs_readlink() and return ENAMETOOLONG if the buffer overflowed. Modified: stable/9/sys/fs/pseudofs/pseudofs_vnops.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/amd64/include/xen/ (props changed) stable/9/sys/boot/ (props changed) stable/9/sys/boot/i386/efi/ (props changed) stable/9/sys/boot/ia64/efi/ (props changed) stable/9/sys/boot/ia64/ski/ (props changed) stable/9/sys/boot/powerpc/boot1.chrp/ (props changed) stable/9/sys/boot/powerpc/ofw/ (props changed) stable/9/sys/cddl/contrib/opensolaris/ (props changed) stable/9/sys/conf/ (props changed) stable/9/sys/contrib/dev/acpica/ (props changed) stable/9/sys/contrib/octeon-sdk/ (props changed) stable/9/sys/contrib/pf/ (props changed) stable/9/sys/contrib/x86emu/ (props changed) Modified: stable/9/sys/fs/pseudofs/pseudofs_vnops.c ============================================================================== --- stable/9/sys/fs/pseudofs/pseudofs_vnops.c Sun Jan 22 13:51:20 2012 (r230461) +++ stable/9/sys/fs/pseudofs/pseudofs_vnops.c Sun Jan 22 13:55:15 2012 (r230462) @@ -891,7 +891,11 @@ pfs_readlink(struct vop_readlink_args *v PFS_RETURN (error); } - sbuf_finish(&sb); + if (sbuf_finish(&sb) != 0) { + sbuf_delete(&sb); + PFS_RETURN (ENAMETOOLONG); + } + error = uiomove_frombuf(sbuf_data(&sb), sbuf_len(&sb), uio); sbuf_delete(&sb); PFS_RETURN (error); From owner-svn-src-all@FreeBSD.ORG Sun Jan 22 14:00:33 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7F2F1106564A; Sun, 22 Jan 2012 14:00:33 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 53A208FC2A; Sun, 22 Jan 2012 14:00:33 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q0ME0Xut078850; Sun, 22 Jan 2012 14:00:33 GMT (envelope-from jilles@svn.freebsd.org) Received: (from jilles@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0ME0XK4078846; Sun, 22 Jan 2012 14:00:33 GMT (envelope-from jilles@svn.freebsd.org) Message-Id: <201201221400.q0ME0XK4078846@svn.freebsd.org> From: Jilles Tjoelker Date: Sun, 22 Jan 2012 14:00:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r230463 - in head: bin/sh tools/regression/bin/sh/builtins X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 22 Jan 2012 14:00:33 -0000 Author: jilles Date: Sun Jan 22 14:00:33 2012 New Revision: 230463 URL: http://svn.freebsd.org/changeset/base/230463 Log: sh: Fix $? in the first command of a 'for'. In the first command of a 'for', $? should be the exit status of the last pipeline (command substitution in the word list or command before 'for'), not always 0. Added: head/tools/regression/bin/sh/builtins/for2.0 (contents, props changed) head/tools/regression/bin/sh/builtins/for3.0 (contents, props changed) Modified: head/bin/sh/eval.c Modified: head/bin/sh/eval.c ============================================================================== --- head/bin/sh/eval.c Sun Jan 22 13:55:15 2012 (r230462) +++ head/bin/sh/eval.c Sun Jan 22 14:00:33 2012 (r230463) @@ -348,6 +348,7 @@ evalfor(union node *n, int flags) union node *argp; struct strlist *sp; struct stackmark smark; + int status; setstackmark(&smark); arglist.lastp = &arglist.list; @@ -357,11 +358,12 @@ evalfor(union node *n, int flags) } *arglist.lastp = NULL; - exitstatus = 0; loopnest++; + status = 0; for (sp = arglist.list ; sp ; sp = sp->next) { setvar(n->nfor.var, sp->text, 0); evaltree(n->nfor.body, flags); + status = exitstatus; if (evalskip) { if (evalskip == SKIPCONT && --skipcount <= 0) { evalskip = 0; @@ -374,6 +376,7 @@ evalfor(union node *n, int flags) } loopnest--; popstackmark(&smark); + exitstatus = status; } Added: head/tools/regression/bin/sh/builtins/for2.0 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tools/regression/bin/sh/builtins/for2.0 Sun Jan 22 14:00:33 2012 (r230463) @@ -0,0 +1,9 @@ +# $FreeBSD$ + +r=x +f() { return 42; } +f +for i in x; do + r=$? +done +[ "$r" = 42 ] Added: head/tools/regression/bin/sh/builtins/for3.0 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tools/regression/bin/sh/builtins/for3.0 Sun Jan 22 14:00:33 2012 (r230463) @@ -0,0 +1,8 @@ +# $FreeBSD$ + +r=x +f() { return 42; } +for i in x`f`; do + r=$? +done +[ "$r" = 42 ] From owner-svn-src-all@FreeBSD.ORG Sun Jan 22 14:04:43 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5BF55106566B; Sun, 22 Jan 2012 14:04:43 +0000 (UTC) (envelope-from stefanf@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 4B31C8FC15; Sun, 22 Jan 2012 14:04:43 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q0ME4hG2079010; Sun, 22 Jan 2012 14:04:43 GMT (envelope-from stefanf@svn.freebsd.org) Received: (from stefanf@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0ME4hbG079008; Sun, 22 Jan 2012 14:04:43 GMT (envelope-from stefanf@svn.freebsd.org) Message-Id: <201201221404.q0ME4hbG079008@svn.freebsd.org> From: Stefan Farfeleder Date: Sun, 22 Jan 2012 14:04:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r230464 - head/share/man/man4 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 22 Jan 2012 14:04:43 -0000 Author: stefanf Date: Sun Jan 22 14:04:42 2012 New Revision: 230464 URL: http://svn.freebsd.org/changeset/base/230464 Log: Document the values for hw.snd.default_auto. Modified: head/share/man/man4/pcm.4 Modified: head/share/man/man4/pcm.4 ============================================================================== --- head/share/man/man4/pcm.4 Sun Jan 22 14:00:33 2012 (r230463) +++ head/share/man/man4/pcm.4 Sun Jan 22 14:04:42 2012 (r230464) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd July 31, 2011 +.Dd January 22, 2012 .Dt SOUND 4 .Os .Sh NAME @@ -324,8 +324,17 @@ for Linux applications, and deny for eve Always allow PROT_EXEC page mappings. .El .It Va hw.snd.default_auto -Enable to automatically assign default sound unit to the most recent -attached device. +Automatically assign the default sound unit. +The following values are supported (default is 1): +.Bl -tag -width 2n +.It 0 +Do not assign the default sound unit automatically. +.It 1 +Use the best available sound device based on playing and recording +capabilities of the device. +.It 2 +Use the most recently attached device. +.El .It Va hw.snd.default_unit Default sound card for systems with multiple sound cards. When using From owner-svn-src-all@FreeBSD.ORG Sun Jan 22 15:44:21 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 47AE5106564A; Sun, 22 Jan 2012 15:44:21 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 1C87F8FC13; Sun, 22 Jan 2012 15:44:21 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q0MFiLAk082240; Sun, 22 Jan 2012 15:44:21 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0MFiKDS082236; Sun, 22 Jan 2012 15:44:20 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201201221544.q0MFiKDS082236@svn.freebsd.org> From: Alexander Motin Date: Sun, 22 Jan 2012 15:44:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r230465 - head/sys/dev/sound/pci/hda X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 22 Jan 2012 15:44:21 -0000 Author: mav Date: Sun Jan 22 15:44:20 2012 New Revision: 230465 URL: http://svn.freebsd.org/changeset/base/230465 Log: Increase snd_hda(4) default maximal buffer size from 16K to 64K and maximal from 64K to 256K. We usually don't need 750 sound interrupts per second (1.3ms latency) when playing 192K/24/8 stream. 187 should be better. On usual 48K/16/2 it is just enough for hw.snd.latency=9 at hw.snd.latency_profile=1 with 23 and 6 interrupts per second. MFC after: 2 weeks Sponsored by: iXsystems, Inc. Modified: head/sys/dev/sound/pci/hda/hdaa.c head/sys/dev/sound/pci/hda/hdac.c head/sys/dev/sound/pci/hda/hdac.h Modified: head/sys/dev/sound/pci/hda/hdaa.c ============================================================================== --- head/sys/dev/sound/pci/hda/hdaa.c Sun Jan 22 14:04:42 2012 (r230464) +++ head/sys/dev/sound/pci/hda/hdaa.c Sun Jan 22 15:44:20 2012 (r230465) @@ -74,17 +74,6 @@ static const struct { #define HDAA_QUIRKS_TAB_LEN \ (sizeof(hdaa_quirks_tab) / sizeof(hdaa_quirks_tab[0])) -#define HDA_BDL_MIN 2 -#define HDA_BDL_MAX 256 -#define HDA_BDL_DEFAULT HDA_BDL_MIN - -#define HDA_BLK_MIN HDA_DMA_ALIGNMENT -#define HDA_BLK_ALIGN (~(HDA_BLK_MIN - 1)) - -#define HDA_BUFSZ_MIN 4096 -#define HDA_BUFSZ_MAX 65536 -#define HDA_BUFSZ_DEFAULT 16384 - #define HDA_PARSE_MAXDEPTH 10 MALLOC_DEFINE(M_HDAA, "hdaa", "HDA Audio"); Modified: head/sys/dev/sound/pci/hda/hdac.c ============================================================================== --- head/sys/dev/sound/pci/hda/hdac.c Sun Jan 22 14:04:42 2012 (r230464) +++ head/sys/dev/sound/pci/hda/hdac.c Sun Jan 22 15:44:20 2012 (r230465) @@ -70,17 +70,6 @@ static const struct { #define HDAC_QUIRKS_TAB_LEN \ (sizeof(hdac_quirks_tab) / sizeof(hdac_quirks_tab[0])) -#define HDA_BDL_MIN 2 -#define HDA_BDL_MAX 256 -#define HDA_BDL_DEFAULT HDA_BDL_MIN - -#define HDA_BLK_MIN HDA_DMA_ALIGNMENT -#define HDA_BLK_ALIGN (~(HDA_BLK_MIN - 1)) - -#define HDA_BUFSZ_MIN 4096 -#define HDA_BUFSZ_MAX 65536 -#define HDA_BUFSZ_DEFAULT 16384 - MALLOC_DEFINE(M_HDAC, "hdac", "HDA Controller"); static const struct { Modified: head/sys/dev/sound/pci/hda/hdac.h ============================================================================== --- head/sys/dev/sound/pci/hda/hdac.h Sun Jan 22 14:04:42 2012 (r230464) +++ head/sys/dev/sound/pci/hda/hdac.h Sun Jan 22 15:44:20 2012 (r230465) @@ -521,6 +521,18 @@ ****************************************************************************/ #define HDA_DMA_ALIGNMENT 128 + +#define HDA_BDL_MIN 2 +#define HDA_BDL_MAX 256 +#define HDA_BDL_DEFAULT HDA_BDL_MIN + +#define HDA_BLK_MIN HDA_DMA_ALIGNMENT +#define HDA_BLK_ALIGN (~(HDA_BLK_MIN - 1)) + +#define HDA_BUFSZ_MIN (HDA_BDL_MIN * HDA_BLK_MIN) +#define HDA_BUFSZ_MAX 262144 +#define HDA_BUFSZ_DEFAULT 65536 + #define HDA_GPIO_MAX 8 #define HDA_DEV_MATCH(fl, v) ((fl) == (v) || \ From owner-svn-src-all@FreeBSD.ORG Sun Jan 22 16:18:37 2012 Return-Path: Delivered-To: svn-src-all@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0E260106573B; Sun, 22 Jan 2012 16:18:35 +0000 (UTC) (envelope-from kevlo@FreeBSD.org) Received: from ns.kevlo.org (kevlo.org [220.128.136.52]) by mx1.freebsd.org (Postfix) with ESMTP id E96568FC08; Sun, 22 Jan 2012 16:18:34 +0000 (UTC) Received: from [127.0.0.1] (kevlo@kevlo.org [220.128.136.52]) by ns.kevlo.org (8.14.3/8.14.3) with ESMTP id q0MGIX9J004905; Mon, 23 Jan 2012 00:18:33 +0800 (CST) Message-ID: <1327249113.2057.5.camel@nsl> From: Kevin Lo To: Jaakko Heinonen Date: Mon, 23 Jan 2012 00:18:33 +0800 In-Reply-To: <20120122134218.GA2247@a91-153-116-96.elisa-laajakaista.fi> References: <201201170125.q0H1PrlJ061058@svn.freebsd.org> <20120117171031.GA2316@a91-153-116-96.elisa-laajakaista.fi> <86obtvvr4v.fsf@kopusha.home.net> <20120122134218.GA2247@a91-153-116-96.elisa-laajakaista.fi> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.2.1- Content-Transfer-Encoding: 7bit Mime-Version: 1.0 Cc: Mikolaj Golub , svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org Subject: Re: svn commit: r230252 - head/sys/fs/tmpfs X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 22 Jan 2012 16:18:37 -0000 Jaakko Heinonen wrote: > Hi, Hi Jaakko, > On 2012-01-22, Mikolaj Golub wrote: > > JH> # mount -u -o ro /mnt > > JH> mount: tmpfs : Operation not supported > > JH> # mount -u -o ro,export /mnt > > JH> # > > > > There is no error but ro is still ignored, so this is only the issue with > > reporting. Note, the code for nullfs (as an example) looks the same. > > This is not true. "ro" is not ignored: > > # mount -t tmpfs > tmpfs on /mnt (tmpfs, local) > # mount -u -o ro /mnt > mount: tmpfs: Operation not supported > # mount -t tmpfs > tmpfs on /mnt (tmpfs, local) > # mount -u -o ro,export /mnt > # mount -t tmpfs > tmpfs on /mnt (tmpfs, local, read-only) > > > It could be fixed with vfs_filteropt(9), not sure if this is worth doing here > > though. > > The problem with vfs_filteropt(9) is that it will allow some additional > options (global_opts list in vfs_mount.c). However those options might > already work sufficiently with update mount. Here is a mostly untested > patch: > > %%% > Index: sys/fs/tmpfs/tmpfs_vfsops.c > =================================================================== > --- sys/fs/tmpfs/tmpfs_vfsops.c (revision 230328) > +++ sys/fs/tmpfs/tmpfs_vfsops.c (working copy) > @@ -82,6 +82,10 @@ static const char *tmpfs_opts[] = { > NULL > }; > > +static const char *tmpfs_updateopts[] = { > + "from", "export", NULL > +}; > + > /* --------------------------------------------------------------------- */ > > static int > @@ -150,12 +154,10 @@ tmpfs_mount(struct mount *mp) > return (EINVAL); > > if (mp->mnt_flag & MNT_UPDATE) { > - /* > - * Only support update mounts for NFS export. > - */ > - if (vfs_flagopt(mp->mnt_optnew, "export", NULL, 0)) > - return (0); > - return (EOPNOTSUPP); > + /* Only support update mounts for certain options. */ > + if (vfs_filteropt(mp->mnt_optnew, tmpfs_updateopts) != 0) > + return (EOPNOTSUPP); > + return (0); > } > > vn_lock(mp->mnt_vnodecovered, LK_SHARED | LK_RETRY); > %%% Sorry for the late reply since I'm still off work for holidays (Chinese New Year). I'll report back in a few weeks. If you have a patch, please commit it, thanks a lot! Kevin From owner-svn-src-all@FreeBSD.ORG Sun Jan 22 17:00:09 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 60BAE1065675 for ; Sun, 22 Jan 2012 17:00:09 +0000 (UTC) (envelope-from markm@FreeBSD.org) Received: from gromit.grondar.org (grandfather.grondar.org [IPv6:2a01:348:0:15:5d59:5c20:0:2]) by mx1.freebsd.org (Postfix) with ESMTP id 77BAA8FC18 for ; Sun, 22 Jan 2012 17:00:08 +0000 (UTC) Received: from uucp by gromit.grondar.org with local-rmail (Exim 4.76 (FreeBSD)) (envelope-from ) id 1Rp0lz-000Hxe-5k for svn-src-all@freebsd.org; Sun, 22 Jan 2012 17:00:07 +0000 Received: from localhost ([127.0.0.1] helo=groundzero.grondar.org) by groundzero.grondar.org with esmtp (Exim 4.77 (FreeBSD)) (envelope-from ) id 1Rp0lq-000Gly-FT; Sun, 22 Jan 2012 16:59:58 +0000 To: Andrey Chernov In-reply-to: <20120120215649.GA40016@vniz.net> References: <201201162018.q0GKIADK050161@svn.freebsd.org> <20120118061943.GA80874@vniz.net> <20120120055823.GA28177@vniz.net> <20120120215649.GA40016@vniz.net> From: Mark Murray Date: Sun, 22 Jan 2012 16:59:55 +0000 Message-Id: Cc: svn-src-head@FreeBSD.ORG, David Schultz , src-committers@FreeBSD.ORG, svn-src-all@FreeBSD.ORG Subject: Re: svn commit: r230230 - head/sys/dev/random X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 22 Jan 2012 17:00:09 -0000 Andrey Chernov writes: > > The usual way round this is with a flag. Set a static, volatile > > flag, defaulting "off", and set it to "on" when the seeding has > > happened. Then arc4random() can do the right thing, depending on > > this flag. > > Ok, what about this version, is it right? libkern/arc4rand.c is not a > module but always present in the kernel, so "arc4rand_iniseed_state" > will be always accessible. > > --- dev/random/randomdev_soft.c.old 2011-09-26 07:35:48.000000000 +0400 > +++ dev/random/randomdev_soft.c 2012-01-21 01:41:37.000000000 +0400 > @@ -55,6 +55,8 @@ __FBSDID("$FreeBSD: src/sys/dev/random/r > > #define RANDOM_FIFO_MAX 256 /* How many events to queue up */ > > +extern int arc4rand_iniseed_state; > + Should be in a header file, nad _possibly_ should be volatile. If it works without being volatile, then OK. The rest is OK. I've not tested it, so this is not a review, simply an "OK" :-) M -- Mark R V Murray Cert APS(Open) Dip Phys(Open) BSc Open(Open) BSc(Hons)(Open) Pi: 132511160 From owner-svn-src-all@FreeBSD.ORG Sun Jan 22 17:32:28 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B43A4106564A; Sun, 22 Jan 2012 17:32:28 +0000 (UTC) (envelope-from to.my.trociny@gmail.com) Received: from mail-bk0-f54.google.com (mail-bk0-f54.google.com [209.85.214.54]) by mx1.freebsd.org (Postfix) with ESMTP id 471A08FC13; Sun, 22 Jan 2012 17:32:27 +0000 (UTC) Received: by bkbc12 with SMTP id c12so2366809bkb.13 for ; Sun, 22 Jan 2012 09:32:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=from:to:cc:subject:references:x-comment-to:sender:date:in-reply-to :message-id:user-agent:mime-version:content-type; bh=JuSKv8RMa9ugnNiSW1NjUxBCF91ERJxw//RcFWHAf74=; b=VsLPpttUVsVwrvS1OK/09rpIyFB1H+njvtZHlhx9bLEDQyTJalQ4drW7qDZguxZpVt rTlTTPkjEmGnfQoHzkeVRpe3ian4g2gFRtOCQ57XnTxC8K6l8uYaLhpHVIdoWdVCjy5e 5DgoZyTBEqI4fdxNMNPTNi/5iarzskLYWCuYw= Received: by 10.205.128.4 with SMTP id hc4mr1957696bkc.13.1327253546362; Sun, 22 Jan 2012 09:32:26 -0800 (PST) Received: from localhost ([95.69.173.122]) by mx.google.com with ESMTPS id d2sm22101155bky.11.2012.01.22.09.32.24 (version=TLSv1/SSLv3 cipher=OTHER); Sun, 22 Jan 2012 09:32:25 -0800 (PST) From: Mikolaj Golub To: Jaakko Heinonen References: <201201170125.q0H1PrlJ061058@svn.freebsd.org> <20120117171031.GA2316@a91-153-116-96.elisa-laajakaista.fi> <86obtvvr4v.fsf@kopusha.home.net> <20120122134218.GA2247@a91-153-116-96.elisa-laajakaista.fi> X-Comment-To: Jaakko Heinonen Sender: Mikolaj Golub Date: Sun, 22 Jan 2012 19:32:22 +0200 In-Reply-To: <20120122134218.GA2247@a91-153-116-96.elisa-laajakaista.fi> (Jaakko Heinonen's message of "Sun, 22 Jan 2012 15:42:18 +0200") Message-ID: <86lioztzh5.fsf@kopusha.home.net> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.3 (berkeley-unix) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: svn-src-head@freebsd.org, Kevin Lo , svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r230252 - head/sys/fs/tmpfs X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 22 Jan 2012 17:32:28 -0000 On Sun, 22 Jan 2012 15:42:18 +0200 Jaakko Heinonen wrote: JH> Hi, JH> On 2012-01-22, Mikolaj Golub wrote: >> JH> # mount -u -o ro /mnt >> JH> mount: tmpfs : Operation not supported >> JH> # mount -u -o ro,export /mnt >> JH> # >> >> There is no error but ro is still ignored, so this is only the issue with >> reporting. Note, the code for nullfs (as an example) looks the same. JH> This is not true. "ro" is not ignored: JH> # mount -t tmpfs JH> tmpfs on /mnt (tmpfs, local) JH> # mount -u -o ro /mnt JH> mount: tmpfs: Operation not supported JH> # mount -t tmpfs JH> tmpfs on /mnt (tmpfs, local) JH> # mount -u -o ro,export /mnt JH> # mount -t tmpfs JH> tmpfs on /mnt (tmpfs, local, read-only) Sorry, yes I was wrong. vfs_domount_update() stores old MNT flags and applies new ones, then calls VFS_MOUNT(), and if it only fails it will restore the old flags. So nullfs has the same issue now although the bug is more difficult to expose as nullfs uses its own mount_nullfs, which currently does not support update option. Thus to trigger the bug someone has to use nmount(2). >> It could be fixed with vfs_filteropt(9), not sure if this is worth doing here >> though. JH> The problem with vfs_filteropt(9) is that it will allow some additional JH> options (global_opts list in vfs_mount.c). However those options might JH> already work sufficiently with update mount. Here is a mostly untested JH> patch: When I was looking at mount option interface it also looked for me a bit "complicated" :-), that is why I hoped we could just ignore the issue if it were just reporting an error... Also, may be we should allow remounting ro (and may be some othe options) for tmpfs? JH> %%% JH> Index: sys/fs/tmpfs/tmpfs_vfsops.c JH> =================================================================== JH> --- sys/fs/tmpfs/tmpfs_vfsops.c (revision 230328) JH> +++ sys/fs/tmpfs/tmpfs_vfsops.c (working copy) JH> @@ -82,6 +82,10 @@ static const char *tmpfs_opts[] = { JH> NULL JH> }; JH> JH> +static const char *tmpfs_updateopts[] = { JH> + "from", "export", NULL JH> +}; JH> + JH> /* --------------------------------------------------------------------- */ JH> JH> static int JH> @@ -150,12 +154,10 @@ tmpfs_mount(struct mount *mp) JH> return (EINVAL); JH> JH> if (mp->mnt_flag & MNT_UPDATE) { JH> - /* JH> - * Only support update mounts for NFS export. JH> - */ JH> - if (vfs_flagopt(mp->mnt_optnew, "export", NULL, 0)) JH> - return (0); JH> - return (EOPNOTSUPP); JH> + /* Only support update mounts for certain options. */ JH> + if (vfs_filteropt(mp->mnt_optnew, tmpfs_updateopts) != 0) JH> + return (EOPNOTSUPP); JH> + return (0); JH> } JH> JH> vn_lock(mp->mnt_vnodecovered, LK_SHARED | LK_RETRY); JH> %%% JH> -- JH> Jaakko -- Mikolaj Golub From owner-svn-src-all@FreeBSD.ORG Sun Jan 22 18:27:24 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B9B41106564A; Sun, 22 Jan 2012 18:27:24 +0000 (UTC) (envelope-from pho@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A3EB78FC13; Sun, 22 Jan 2012 18:27:24 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q0MIROJR087501; Sun, 22 Jan 2012 18:27:24 GMT (envelope-from pho@svn.freebsd.org) Received: (from pho@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0MIRO23087499; Sun, 22 Jan 2012 18:27:24 GMT (envelope-from pho@svn.freebsd.org) Message-Id: <201201221827.q0MIRO23087499@svn.freebsd.org> From: Peter Holm Date: Sun, 22 Jan 2012 18:27:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r230466 - stable/9/sys/kern X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 22 Jan 2012 18:27:24 -0000 Author: pho Date: Sun Jan 22 18:27:24 2012 New Revision: 230466 URL: http://svn.freebsd.org/changeset/base/230466 Log: MFC: r228360 Move cpu_set_upcall(newtd, td) up before the first call of thread_free(newtd). This to avoid a possible page fault in cpu_thread_clean() as seen on amd64 with syscall fuzzing. Modified: stable/9/sys/kern/kern_thr.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/kern/kern_thr.c ============================================================================== --- stable/9/sys/kern/kern_thr.c Sun Jan 22 15:44:20 2012 (r230465) +++ stable/9/sys/kern/kern_thr.c Sun Jan 22 18:27:24 2012 (r230466) @@ -200,6 +200,8 @@ create_thread(struct thread *td, mcontex goto fail; } + cpu_set_upcall(newtd, td); + /* * Try the copyout as soon as we allocate the td so we don't * have to tear things down in a failure case below. @@ -225,8 +227,6 @@ create_thread(struct thread *td, mcontex newtd->td_proc = td->td_proc; newtd->td_ucred = crhold(td->td_ucred); - cpu_set_upcall(newtd, td); - if (ctx != NULL) { /* old way to set user context */ error = set_mcontext(newtd, ctx); if (error != 0) { From owner-svn-src-all@FreeBSD.ORG Sun Jan 22 18:55:51 2012 Return-Path: Delivered-To: svn-src-all@FreeBSD.ORG Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 14A3C106566B; Sun, 22 Jan 2012 18:55:51 +0000 (UTC) (envelope-from ache@vniz.net) Received: from vniz.net (vniz.net [194.87.13.69]) by mx1.freebsd.org (Postfix) with ESMTP id 52AD38FC1A; Sun, 22 Jan 2012 18:55:49 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by vniz.net (8.14.5/8.14.5) with ESMTP id q0MItlUk012021; Sun, 22 Jan 2012 22:55:48 +0400 (MSK) (envelope-from ache@vniz.net) Received: (from ache@localhost) by localhost (8.14.5/8.14.5/Submit) id q0MItlnw012020; Sun, 22 Jan 2012 22:55:47 +0400 (MSK) (envelope-from ache) Date: Sun, 22 Jan 2012 22:55:46 +0400 From: Andrey Chernov To: Mark Murray Message-ID: <20120122185545.GA11874@vniz.net> Mail-Followup-To: Andrey Chernov , Mark Murray , David Schultz , src-committers@FreeBSD.ORG, svn-src-all@FreeBSD.ORG, svn-src-head@FreeBSD.ORG References: <201201162018.q0GKIADK050161@svn.freebsd.org> <20120118061943.GA80874@vniz.net> <20120120055823.GA28177@vniz.net> <20120120215649.GA40016@vniz.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) Cc: svn-src-head@FreeBSD.ORG, David Schultz , src-committers@FreeBSD.ORG, svn-src-all@FreeBSD.ORG Subject: Re: svn commit: r230230 - head/sys/dev/random X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 22 Jan 2012 18:55:51 -0000 On Sun, Jan 22, 2012 at 04:59:55PM +0000, Mark Murray wrote: > Andrey Chernov writes: > > > The usual way round this is with a flag. Set a static, volatile > > > flag, defaulting "off", and set it to "on" when the seeding has > > > happened. Then arc4random() can do the right thing, depending on > > > this flag. > > > > Ok, what about this version, is it right? libkern/arc4rand.c is not a > > module but always present in the kernel, so "arc4rand_iniseed_state" > > will be always accessible. > > > > --- dev/random/randomdev_soft.c.old 2011-09-26 07:35:48.000000000 +0400 > > +++ dev/random/randomdev_soft.c 2012-01-21 01:41:37.000000000 +0400 > > @@ -55,6 +55,8 @@ __FBSDID("$FreeBSD: src/sys/dev/random/r > > > > #define RANDOM_FIFO_MAX 256 /* How many events to queue up */ > > > > +extern int arc4rand_iniseed_state; > > + > > Should be in a header file, nad _possibly_ should be volatile. If it > works without being volatile, then OK. It was preliminary patch just to confirm/deny my understanding of your idea. I'll put it into header. In the final version I also plan to move that lines + if (arc4rand_iniseed_state == 1) + arc4rand_iniseed_state = -1; into arc4_randomstir() where they will be protected with mutex lock, so volatile will be not needed. It will be more logical, because other reseeding conditions are resetted there too. > The rest is OK. I've not tested it, so this is not a review, simply an > "OK" :-) Thanx for review! I'll send final version to this thread a bit later when I'll find more free time. -- http://ache.vniz.net/ From owner-svn-src-all@FreeBSD.ORG Sun Jan 22 20:25:00 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 83F26106566B; Sun, 22 Jan 2012 20:25:00 +0000 (UTC) (envelope-from trociny@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 6C96B8FC0C; Sun, 22 Jan 2012 20:25:00 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q0MKP0hQ091455; Sun, 22 Jan 2012 20:25:00 GMT (envelope-from trociny@svn.freebsd.org) Received: (from trociny@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0MKP0Ix091451; Sun, 22 Jan 2012 20:25:00 GMT (envelope-from trociny@svn.freebsd.org) Message-Id: <201201222025.q0MKP0Ix091451@svn.freebsd.org> From: Mikolaj Golub Date: Sun, 22 Jan 2012 20:25:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r230470 - in head/sys: kern sys X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 22 Jan 2012 20:25:00 -0000 Author: trociny Date: Sun Jan 22 20:25:00 2012 New Revision: 230470 URL: http://svn.freebsd.org/changeset/base/230470 Log: Change kern.proc.rlimit sysctl to: - retrive only one, specified limit for a process, not the whole array, as it was previously (the sysctl has been added recently and has not been backported to stable yet, so this change is ok); - allow to set a resource limit for another process. Submitted by: Andrey Zonov Discussed with: kib Reviewed by: kib MFC after: 2 weeks Modified: head/sys/kern/kern_proc.c head/sys/kern/kern_resource.c head/sys/sys/resourcevar.h Modified: head/sys/kern/kern_proc.c ============================================================================== --- head/sys/kern/kern_proc.c Sun Jan 22 19:49:43 2012 (r230469) +++ head/sys/kern/kern_proc.c Sun Jan 22 20:25:00 2012 (r230470) @@ -2372,7 +2372,7 @@ sysctl_kern_proc_groups(SYSCTL_HANDLER_A } /* - * This sysctl allows a process to retrieve the resource limits for + * This sysctl allows a process to retrieve or/and set the resource limit for * another process. */ static int @@ -2380,30 +2380,53 @@ sysctl_kern_proc_rlimit(SYSCTL_HANDLER_A { int *name = (int *)arg1; u_int namelen = arg2; - struct plimit *limp; + struct rlimit rlim; struct proc *p; - int error = 0; + u_int which; + int flags, error; - if (namelen != 1) + if (namelen != 2) + return (EINVAL); + + which = (u_int)name[1]; + if (which >= RLIM_NLIMITS) return (EINVAL); - error = pget((pid_t)name[0], PGET_CANSEE, &p); + if (req->newptr != NULL && req->newlen != sizeof(rlim)) + return (EINVAL); + + flags = PGET_HOLD | PGET_NOTWEXIT; + if (req->newptr != NULL) + flags |= PGET_CANDEBUG; + else + flags |= PGET_CANSEE; + error = pget((pid_t)name[0], flags, &p); if (error != 0) return (error); + /* - * Check the request size. We alow sizes smaller rlimit array for - * backward binary compatibility: the number of resource limits may - * grow. + * Retrieve limit. */ - if (sizeof(limp->pl_rlimit) < req->oldlen) { + if (req->oldptr != NULL) { + PROC_LOCK(p); + lim_rlimit(p, which, &rlim); PROC_UNLOCK(p); - return (EINVAL); } + error = SYSCTL_OUT(req, &rlim, sizeof(rlim)); + if (error != 0) + goto errout; - limp = lim_hold(p->p_limit); - PROC_UNLOCK(p); - error = SYSCTL_OUT(req, limp->pl_rlimit, req->oldlen); - lim_free(limp); + /* + * Set limit. + */ + if (req->newptr != NULL) { + error = SYSCTL_IN(req, &rlim, sizeof(rlim)); + if (error == 0) + error = kern_proc_setrlimit(curthread, p, which, &rlim); + } + +errout: + PRELE(p); return (error); } @@ -2544,8 +2567,9 @@ static SYSCTL_NODE(_kern_proc, KERN_PROC static SYSCTL_NODE(_kern_proc, KERN_PROC_GROUPS, groups, CTLFLAG_RD | CTLFLAG_MPSAFE, sysctl_kern_proc_groups, "Process groups"); -static SYSCTL_NODE(_kern_proc, KERN_PROC_RLIMIT, rlimit, CTLFLAG_RD | - CTLFLAG_MPSAFE, sysctl_kern_proc_rlimit, "Process resource limits"); +static SYSCTL_NODE(_kern_proc, KERN_PROC_RLIMIT, rlimit, CTLFLAG_RW | + CTLFLAG_ANYBODY | CTLFLAG_MPSAFE, sysctl_kern_proc_rlimit, + "Process resource limits"); static SYSCTL_NODE(_kern_proc, KERN_PROC_PS_STRINGS, ps_strings, CTLFLAG_RW | CTLFLAG_ANYBODY | CTLFLAG_MPSAFE, Modified: head/sys/kern/kern_resource.c ============================================================================== --- head/sys/kern/kern_resource.c Sun Jan 22 19:49:43 2012 (r230469) +++ head/sys/kern/kern_resource.c Sun Jan 22 20:25:00 2012 (r230470) @@ -649,13 +649,17 @@ lim_cb(void *arg) } int -kern_setrlimit(td, which, limp) - struct thread *td; - u_int which; - struct rlimit *limp; +kern_setrlimit(struct thread *td, u_int which, struct rlimit *limp) +{ + + return (kern_proc_setrlimit(td, td->td_proc, which, limp)); +} + +int +kern_proc_setrlimit(struct thread *td, struct proc *p, u_int which, + struct rlimit *limp) { struct plimit *newlim, *oldlim; - struct proc *p; register struct rlimit *alimp; struct rlimit oldssiz; int error; @@ -672,7 +676,6 @@ kern_setrlimit(td, which, limp) limp->rlim_max = RLIM_INFINITY; oldssiz.rlim_cur = 0; - p = td->td_proc; newlim = lim_alloc(); PROC_LOCK(p); oldlim = p->p_limit; Modified: head/sys/sys/resourcevar.h ============================================================================== --- head/sys/sys/resourcevar.h Sun Jan 22 19:49:43 2012 (r230469) +++ head/sys/sys/resourcevar.h Sun Jan 22 20:25:00 2012 (r230470) @@ -120,6 +120,8 @@ int chgsbsize(struct uidinfo *uip, u_in rlim_t maxval); int chgptscnt(struct uidinfo *uip, int diff, rlim_t maxval); int fuswintr(void *base); +int kern_proc_setrlimit(struct thread *td, struct proc *p, u_int which, + struct rlimit *limp); struct plimit *lim_alloc(void); void lim_copy(struct plimit *dst, struct plimit *src); From owner-svn-src-all@FreeBSD.ORG Sun Jan 22 20:26:46 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CFFAA1065676; Sun, 22 Jan 2012 20:26:46 +0000 (UTC) (envelope-from trociny@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id BB3A38FC0C; Sun, 22 Jan 2012 20:26:46 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q0MKQkew091548; Sun, 22 Jan 2012 20:26:46 GMT (envelope-from trociny@svn.freebsd.org) Received: (from trociny@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0MKQkqu091546; Sun, 22 Jan 2012 20:26:46 GMT (envelope-from trociny@svn.freebsd.org) Message-Id: <201201222026.q0MKQkqu091546@svn.freebsd.org> From: Mikolaj Golub Date: Sun, 22 Jan 2012 20:26:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r230471 - head/usr.bin/procstat X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 22 Jan 2012 20:26:46 -0000 Author: trociny Date: Sun Jan 22 20:26:46 2012 New Revision: 230471 URL: http://svn.freebsd.org/changeset/base/230471 Log: Make procstat -l to work with the new version of kern.proc.rlimit. Submitted by: Andrey Zonov MFC after: 2 weeks Modified: head/usr.bin/procstat/procstat_rlimit.c Modified: head/usr.bin/procstat/procstat_rlimit.c ============================================================================== --- head/usr.bin/procstat/procstat_rlimit.c Sun Jan 22 20:25:00 2012 (r230470) +++ head/usr.bin/procstat/procstat_rlimit.c Sun Jan 22 20:26:46 2012 (r230471) @@ -90,27 +90,28 @@ const char *humanize_rlimit(int indx, rl void procstat_rlimit(struct kinfo_proc *kipp) { - int error, i, name[4]; + int error, i, name[5]; size_t len; if (!hflag) { printf("%5s %-16s %-16s %16s %16s\n", "PID", "COMM", "RLIMIT", "SOFT ", "HARD "); } + len = sizeof(struct rlimit); name[0] = CTL_KERN; name[1] = KERN_PROC; name[2] = KERN_PROC_RLIMIT; name[3] = kipp->ki_pid; - len = sizeof(rlimit); - error = sysctl(name, 4, rlimit, &len, NULL, 0); - if (error < 0 && errno != ESRCH) { - warn("sysctl: kern.proc.rlimit: %d", kipp->ki_pid); - return; - } - if (error < 0 || len != sizeof(rlimit)) - return; - for (i = 0; i < RLIM_NLIMITS; i++) { + name[4] = i; + error = sysctl(name, 5, &rlimit[i], &len, NULL, 0); + if (error < 0 && errno != ESRCH) { + warn("sysctl: kern.proc.rlimit: %d", kipp->ki_pid); + return; + } + if (error < 0 || len != sizeof(struct rlimit)) + return; + printf("%5d %-16s %-16s ", kipp->ki_pid, kipp->ki_comm, rlimit_param[i].name); printf("%16s ", humanize_rlimit(i, rlimit[i].rlim_cur)); From owner-svn-src-all@FreeBSD.ORG Sun Jan 22 20:31:53 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8C02C1065674; Sun, 22 Jan 2012 20:31:53 +0000 (UTC) (envelope-from to.my.trociny@gmail.com) Received: from mail-bk0-f54.google.com (mail-bk0-f54.google.com [209.85.214.54]) by mx1.freebsd.org (Postfix) with ESMTP id 748018FC08; Sun, 22 Jan 2012 20:31:52 +0000 (UTC) Received: by bkbc12 with SMTP id c12so2462170bkb.13 for ; Sun, 22 Jan 2012 12:31:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=from:to:cc:subject:references:x-comment-to:sender:date:in-reply-to :message-id:user-agent:mime-version:content-type; bh=bSMuAPSOc40hG5o35WDRUJK5PZL1rgxHaxyrqkL4r9o=; b=cZmXN7CcFT08pQ866TxcTTIvPTsEKJ1CnXcOl1I4zSeThU2F6MuTXp9rOeKsigq52u e9R3rGfyrgQxGUmGCQ6o2FcOWsRzejIzuBDBKRlaVY5jzuGnBh7zjmE0SEd+kODojDgf tvvQh6R5Qmo8Snank0z59LIRdLtydM3S9QjD4= Received: by 10.204.129.18 with SMTP id m18mr2089013bks.115.1327264310256; Sun, 22 Jan 2012 12:31:50 -0800 (PST) Received: from localhost ([95.69.173.122]) by mx.google.com with ESMTPS id fg16sm22991338bkb.16.2012.01.22.12.31.47 (version=TLSv1/SSLv3 cipher=OTHER); Sun, 22 Jan 2012 12:31:49 -0800 (PST) From: Mikolaj Golub To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201201222025.q0MKP0Ix091451@svn.freebsd.org> X-Comment-To: Mikolaj Golub Sender: Mikolaj Golub Date: Sun, 22 Jan 2012 22:31:45 +0200 In-Reply-To: <201201222025.q0MKP0Ix091451@svn.freebsd.org> (Mikolaj Golub's message of "Sun, 22 Jan 2012 20:25:00 +0000 (UTC)") Message-ID: <86d3abtr66.fsf@kopusha.home.net> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.3 (berkeley-unix) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Cc: Andrey Zonov , Kostik Belousov Subject: Re: svn commit: r230470 - in head/sys: kern sys X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 22 Jan 2012 20:31:53 -0000 --=-=-= On Sun, 22 Jan 2012 20:25:00 +0000 (UTC) Mikolaj Golub wrote: MG> Author: trociny MG> Date: Sun Jan 22 20:25:00 2012 MG> New Revision: 230470 MG> URL: http://svn.freebsd.org/changeset/base/230470 MG> Log: MG> Change kern.proc.rlimit sysctl to: MG> MG> - retrive only one, specified limit for a process, not the whole MG> array, as it was previously (the sysctl has been added recently and MG> has not been backported to stable yet, so this change is ok); MG> MG> - allow to set a resource limit for another process. MG> MG> Submitted by: Andrey Zonov MG> Discussed with: kib MG> Reviewed by: kib MG> MFC after: 2 weeks Andrey has also been working on the patch for limits(1), which allows to view/set limits for another process: - If '-P ' without the list of limits is specified it returns the limits for this process. - If '-P ' with the list of limits is specified it changes these limits for the process. - If '-P ' with list of limits is specified but also -a option is present it outputs all limits for the process updated by the command line setting. So if one want, for example, to set for a current shell all limits as they are for a process , but core dump is disabled, it could run: eval `limits -P -aBec 0` The latest version of the patch is attached. I am going to commit it if there are no objections or suggestions. -- Mikolaj Golub --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=limits.patch Index: usr.bin/limits/limits.1 =================================================================== --- usr.bin/limits/limits.1 (revision 230394) +++ usr.bin/limits/limits.1 (working copy) @@ -19,7 +19,7 @@ .\" .\" $FreeBSD$ .\" -.Dd April 10, 2011 +.Dd January 18, 2011 .Dt LIMITS 1 .Os .Sh NAME @@ -28,11 +28,13 @@ .Sh SYNOPSIS .Nm .Op Fl C Ar class | Fl U Ar user +.Op Fl P Ar pid .Op Fl SHB .Op Fl ea .Op Fl bcdflmnstuvpw Op Ar val .Nm .Op Fl C Ar class | Fl U Ar user +.Op Fl P Ar pid .Op Fl SHB .Op Fl bcdflmnstuvpw Op Ar val .Op Fl E @@ -143,6 +145,9 @@ for the class are used, if it exists, or the .Dq Li root class if the user is a superuser account. +.It Fl P Ar pid +Select or set limits for the process identified by the +.Ar pid . .It Fl S Select display or setting of .Dq soft Index: usr.bin/limits/limits.c =================================================================== --- usr.bin/limits/limits.c (revision 230394) +++ usr.bin/limits/limits.c (working copy) @@ -29,6 +29,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -249,6 +250,8 @@ static void usage(void); static int getshelltype(void); static void print_limit(rlim_t limit, unsigned divisor, const char *inf, const char *pfx, const char *sfx, const char *which); +static void getrlimit_proc(pid_t pid, int resource, struct rlimit *rlp); +static void setrlimit_proc(pid_t pid, int resource, const struct rlimit *rlp); extern char **environ; static const char rcs_string[] = RCS_STRING; @@ -262,24 +265,24 @@ main(int argc, char *argv[]) int rcswhich, shelltype; int i, num_limits = 0; int ch, doeval = 0, doall = 0; - int rtrn; + int rtrn, setproc; login_cap_t * lc = NULL; enum { ANY=0, SOFT=1, HARD=2, BOTH=3, DISPLAYONLY=4 } type = ANY; enum { RCSUNKNOWN=0, RCSSET=1, RCSSEL=2 } todo = RCSUNKNOWN; int which_limits[RLIM_NLIMITS]; rlim_t set_limits[RLIM_NLIMITS]; struct rlimit limits[RLIM_NLIMITS]; + pid_t pid; /* init resource tables */ for (i = 0; i < RLIM_NLIMITS; i++) { which_limits[i] = 0; /* Don't set/display any */ set_limits[i] = RLIM_INFINITY; - /* Get current resource values */ - getrlimit(i, &limits[i]); } + pid = -1; optarg = NULL; - while ((ch = getopt(argc, argv, ":EeC:U:BSHab:c:d:f:l:m:n:s:t:u:v:p:w:")) != -1) { + while ((ch = getopt(argc, argv, ":EeC:U:BSHP:ab:c:d:f:l:m:n:s:t:u:v:p:w:")) != -1) { switch(ch) { case 'a': doall = 1; @@ -312,6 +315,12 @@ main(int argc, char *argv[]) case 'B': type = SOFT|HARD; break; + case 'P': + if (!isdigit(*optarg) || (pid = atoi(optarg)) < 0) { + warnx("invalid pid `%s'", optarg); + usage(); + } + break; default: case ':': /* Without arg */ if ((p = strchr(rcs_string, optopt)) != NULL) { @@ -335,6 +344,30 @@ main(int argc, char *argv[]) optarg = NULL; } + if (pid != -1) { + if (cls != NULL) { + warnx("-C cannot be used with -P option"); + usage(); + } + if (pwd != NULL) { + warnx("-U cannot be used with -P option"); + usage(); + } + } + + /* Get current resource values */ + setproc = 0; + for (i = 0; i < RLIM_NLIMITS; i++) { + if (pid == -1) { + getrlimit(i, &limits[i]); + } else if (doall || num_limits == 0) { + getrlimit_proc(pid, i, &limits[i]); + } else if (which_limits[i] != 0) { + getrlimit_proc(pid, i, &limits[i]); + setproc = 1; + } + } + /* If user was specified, get class from that */ if (pwd != NULL) lc = login_getpwclass(pwd); @@ -414,6 +447,10 @@ main(int argc, char *argv[]) warnx("-e cannot be used with `cmd' option"); usage(); } + if (pid != -1) { + warnx("-P cannot be used with `cmd' option"); + usage(); + } login_close(lc); @@ -440,6 +477,14 @@ main(int argc, char *argv[]) err(1, "%s", *argv); } + if (setproc) { + for (rcswhich = 0; rcswhich < RLIM_NLIMITS; rcswhich++) { + if (which_limits[rcswhich] != 0) + setrlimit_proc(pid, rcswhich, &limits[rcswhich]); + } + exit(EXIT_SUCCESS); + } + shelltype = doeval ? getshelltype() : SH_NONE; if (type == ANY) /* Default to soft limits */ @@ -493,7 +538,8 @@ static void usage(void) { (void)fprintf(stderr, -"usage: limits [-C class|-U user] [-eaSHBE] [-bcdflmnstuvpw [val]] [[name=val ...] cmd]\n"); + "usage: limits [-C class|-U user|-P pid] [-eaSHBE] " + "[-bcdflmnstuvpw [val]] [[name=val ...] cmd]\n"); exit(EXIT_FAILURE); } @@ -677,3 +723,38 @@ getshelltype(void) return SH_SH; } +static void +getrlimit_proc(pid_t pid, int resource, struct rlimit *rlp) +{ + int error; + int name[5]; + size_t len; + + name[0] = CTL_KERN; + name[1] = KERN_PROC; + name[2] = KERN_PROC_RLIMIT; + name[3] = pid; + name[4] = resource; + len = sizeof(*rlp); + error = sysctl(name, 5, rlp, &len, NULL, 0); + if (error == -1) + err(EXIT_FAILURE, "sysctl: kern.proc.rlimit: %d", pid); + if (len != sizeof(*rlp)) + errx(EXIT_FAILURE, "sysctl() returns wrong size"); +} + +static void +setrlimit_proc(pid_t pid, int resource, const struct rlimit *rlp) +{ + int error; + int name[5]; + + name[0] = CTL_KERN; + name[1] = KERN_PROC; + name[2] = KERN_PROC_RLIMIT; + name[3] = pid; + name[4] = resource; + error = sysctl(name, 5, NULL, 0, rlp, sizeof(*rlp)); + if (error == -1) + err(EXIT_FAILURE, "sysctl: kern.proc.rlimit: %d", pid); +} --=-=-=-- From owner-svn-src-all@FreeBSD.ORG Sun Jan 22 21:25:48 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id F0E77106564A; Sun, 22 Jan 2012 21:25:47 +0000 (UTC) (envelope-from gavin@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D14F98FC08; Sun, 22 Jan 2012 21:25:47 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q0MLPlYt093462; Sun, 22 Jan 2012 21:25:47 GMT (envelope-from gavin@svn.freebsd.org) Received: (from gavin@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0MLPlDg093459; Sun, 22 Jan 2012 21:25:47 GMT (envelope-from gavin@svn.freebsd.org) Message-Id: <201201222125.q0MLPlDg093459@svn.freebsd.org> From: Gavin Atkinson Date: Sun, 22 Jan 2012 21:25:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r230472 - in stable/8/sys: amd64/amd64 i386/i386 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 22 Jan 2012 21:25:48 -0000 Author: gavin Date: Sun Jan 22 21:25:47 2012 New Revision: 230472 URL: http://svn.freebsd.org/changeset/base/230472 Log: Merge r229085 from head: Default to not performing the early-boot memory tests when we detect we are booting inside a VM. There are three reasons to disable this: o It causes the VM host to believe that all the tested pages or RAM are in use. This in turn may force the host to page out pages of RAM belonging to other VMs, or otherwise cause problems with fair resource sharing on the VM cluster. o It adds significant time to the boot process (around 1 second/Gig in testing) o It is unnecessary - the host should have already verified that the memory is functional etc. Note that this simply changes the default when in a VM - it can still be overridden using the hw.memtest.tests tunable. Early MFC requested by: bz Modified: stable/8/sys/amd64/amd64/machdep.c stable/8/sys/i386/i386/machdep.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) Modified: stable/8/sys/amd64/amd64/machdep.c ============================================================================== --- stable/8/sys/amd64/amd64/machdep.c Sun Jan 22 20:26:46 2012 (r230471) +++ stable/8/sys/amd64/amd64/machdep.c Sun Jan 22 21:25:47 2012 (r230472) @@ -1351,10 +1351,13 @@ getmemsize(caddr_t kmdp, u_int64_t first Maxmem = atop(physmem_tunable); /* - * By default keep the memtest enabled. Use a general name so that + * By default enable the memory test on real hardware, and disable + * it if we appear to be running in a VM. This avoids touching all + * pages unnecessarily, which doesn't matter on real hardware but is + * bad for shared VM hosts. Use a general name so that * one could eventually do more with the code than just disable it. */ - memtest = 1; + memtest = (vm_guest > VM_GUEST_NO) ? 0 : 1; TUNABLE_ULONG_FETCH("hw.memtest.tests", &memtest); /* Modified: stable/8/sys/i386/i386/machdep.c ============================================================================== --- stable/8/sys/i386/i386/machdep.c Sun Jan 22 20:26:46 2012 (r230471) +++ stable/8/sys/i386/i386/machdep.c Sun Jan 22 21:25:47 2012 (r230472) @@ -2302,10 +2302,13 @@ physmap_done: Maxmem = atop(physmap[physmap_idx + 1]); /* - * By default keep the memtest enabled. Use a general name so that + * By default enable the memory test on real hardware, and disable + * it if we appear to be running in a VM. This avoids touching all + * pages unnecessarily, which doesn't matter on real hardware but is + * bad for shared VM hosts. Use a general name so that * one could eventually do more with the code than just disable it. */ - memtest = 1; + memtest = (vm_guest > VM_GUEST_NO) ? 0 : 1; TUNABLE_ULONG_FETCH("hw.memtest.tests", &memtest); if (atop(physmap[physmap_idx + 1]) != Maxmem && From owner-svn-src-all@FreeBSD.ORG Sun Jan 22 21:50:32 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 795E41065675 for ; Sun, 22 Jan 2012 21:50:32 +0000 (UTC) (envelope-from markm@FreeBSD.org) Received: from gromit.grondar.org (grandfather.grondar.org [93.89.92.32]) by mx1.freebsd.org (Postfix) with ESMTP id 360238FC1F for ; Sun, 22 Jan 2012 21:50:31 +0000 (UTC) Received: from uucp by gromit.grondar.org with local-rmail (Exim 4.76 (FreeBSD)) (envelope-from ) id 1Rp5Dm-000ILe-3d for svn-src-all@freebsd.org; Sun, 22 Jan 2012 21:45:06 +0000 Received: from localhost ([127.0.0.1] helo=groundzero.grondar.org) by groundzero.grondar.org with esmtp (Exim 4.77 (FreeBSD)) (envelope-from ) id 1Rp5Bn-000HBl-2P; Sun, 22 Jan 2012 21:43:03 +0000 To: Andrey Chernov In-reply-to: <20120122185545.GA11874@vniz.net> References: <201201162018.q0GKIADK050161@svn.freebsd.org> <20120118061943.GA80874@vniz.net> <20120120055823.GA28177@vniz.net> <20120120215649.GA40016@vniz.net> <20120122185545.GA11874@vniz.net> From: Mark Murray Date: Sun, 22 Jan 2012 21:43:02 +0000 Message-Id: Cc: svn-src-head@FreeBSD.ORG, svn-src-all@FreeBSD.ORG, src-committers@FreeBSD.ORG Subject: Re: svn commit: r230230 - head/sys/dev/random X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 22 Jan 2012 21:50:32 -0000 Andrey Chernov writes: > > Should be in a header file, nad _possibly_ should be volatile. If it > > works without being volatile, then OK. > > It was preliminary patch just to confirm/deny my understanding of your > idea. Ah, OK - in which case you got the idea correctly! > I'll put it into header. Cool. > In the final version I also plan to move that lines > + if (arc4rand_iniseed_state == 1) > + arc4rand_iniseed_state = -1; > into arc4_randomstir() where they will be protected with mutex lock, so > volatile will be not needed. It will be more logical, because other > reseeding conditions are resetted there too. Great. > > The rest is OK. I've not tested it, so this is not a review, simply an > > "OK" :-) > > Thanx for review! I'll send final version to this thread a bit > later when I'll find more free time. No problem. M -- Mark R V Murray Cert APS(Open) Dip Phys(Open) BSc Open(Open) BSc(Hons)(Open) Pi: 132511160 From owner-svn-src-all@FreeBSD.ORG Mon Jan 23 04:30:09 2012 Return-Path: Delivered-To: svn-src-all@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1A6B0106566C; Mon, 23 Jan 2012 04:30:09 +0000 (UTC) (envelope-from hrs@FreeBSD.org) Received: from mail.allbsd.org (gatekeeper-int.allbsd.org [IPv6:2001:2f0:104:e002::2]) by mx1.freebsd.org (Postfix) with ESMTP id F05038FC0C; Mon, 23 Jan 2012 04:30:07 +0000 (UTC) Received: from alph.allbsd.org ([IPv6:2001:2f0:104:e010:862b:2bff:febc:8956]) (authenticated bits=128) by mail.allbsd.org (8.14.4/8.14.4) with ESMTP id q0N4Ts50002922; Mon, 23 Jan 2012 13:30:04 +0900 (JST) (envelope-from hrs@FreeBSD.org) Received: from localhost (localhost [IPv6:::1]) (authenticated bits=0) by alph.allbsd.org (8.14.4/8.14.4) with ESMTP id q0N4Tm1X061049; Mon, 23 Jan 2012 13:29:50 +0900 (JST) (envelope-from hrs@FreeBSD.org) Date: Mon, 23 Jan 2012 13:28:40 +0900 (JST) Message-Id: <20120123.132840.618925004528110765.hrs@allbsd.org> To: eadler@FreeBSD.org From: Hiroki Sato In-Reply-To: References: <201201200138.q0K1cSou016739@svn.freebsd.org> <20120120.123256.1432718473132856309.hrs@allbsd.org> X-PGPkey-fingerprint: BDB3 443F A5DD B3D0 A530 FFD7 4F2C D3D8 2793 CF2D X-Mailer: Mew version 6.4 on Emacs 23.3 / Mule 6.0 (HANACHIRUSATO) Mime-Version: 1.0 Content-Type: Multipart/Signed; protocol="application/pgp-signature"; micalg=pgp-sha1; boundary="--Security_Multipart(Mon_Jan_23_13_28_40_2012_675)--" Content-Transfer-Encoding: 7bit X-Virus-Scanned: clamav-milter 0.97 at gatekeeper.allbsd.org X-Virus-Status: Clean X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.2.3 (mail.allbsd.org [IPv6:2001:2f0:104:e001::32]); Mon, 23 Jan 2012 13:30:05 +0900 (JST) X-Spam-Status: No, score=-104.6 required=13.0 tests=BAYES_00, CONTENT_TYPE_PRESENT, RDNS_NONE, SPF_SOFTFAIL, USER_IN_WHITELIST autolearn=no version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on gatekeeper.allbsd.org Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org Subject: Re: svn commit: r230354 - head/usr.sbin/makefs X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 23 Jan 2012 04:30:09 -0000 ----Security_Multipart(Mon_Jan_23_13_28_40_2012_675)-- Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit Eitan Adler wrote in : ea> I was was unaware this code was contributed. I just looked at the ea> NetBSD version and I don't think it suffers from the same problem - ea> the loop appears to be used later. If that is because of some other Just checking, but the variables dot and semi are not used even in the NetBSD version since the initial import (in the NetBSD tree). What is "the same problem" you mentioned here? The problem I pointed out is just "removing the useless loop would be good but leaving the related comments is bad"... ea> bug fix which could be upstreamed that would be great. On the other ea> hand I would like to continue with my goal of making the non-contrib ea> world compilable with CC=gcc46. ea> ea> Should I revert this commit? I don't think it is needed. The makefs utility is a special case because it will probably diverge from the upstream to support FreeBSD-specific feature in the future (this is one of the reasons why it is not in contrib/). It didn't happen so far, however. By the way, does gcc46 no longer allow unused code? Generally speaking, I think it is enough to clean up unused code only when we actually change the code. -- Hiroki ----Security_Multipart(Mon_Jan_23_13_28_40_2012_675)-- Content-Type: application/pgp-signature Content-Transfer-Encoding: 7bit -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (FreeBSD) iEYEABECAAYFAk8c4fgACgkQTyzT2CeTzy1+pwCfWJuGJplAJB335qdB4fMrYY1Q clcAoNVXKwsVsjnHVVk0uxVcLDXtJ6OV =Qzz4 -----END PGP SIGNATURE----- ----Security_Multipart(Mon_Jan_23_13_28_40_2012_675)---- From owner-svn-src-all@FreeBSD.ORG Mon Jan 23 06:36:42 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5BFCD106564A; Mon, 23 Jan 2012 06:36:42 +0000 (UTC) (envelope-from das@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 3F75C8FC14; Mon, 23 Jan 2012 06:36:42 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q0N6agVm011155; Mon, 23 Jan 2012 06:36:42 GMT (envelope-from das@svn.freebsd.org) Received: (from das@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0N6af1Z011147; Mon, 23 Jan 2012 06:36:41 GMT (envelope-from das@svn.freebsd.org) Message-Id: <201201230636.q0N6af1Z011147@svn.freebsd.org> From: David Schultz Date: Mon, 23 Jan 2012 06:36:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r230475 - in head/sys: amd64/include arm/include i386/include ia64/include mips/include powerpc/include sparc64/include X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 23 Jan 2012 06:36:42 -0000 Author: das Date: Mon Jan 23 06:36:41 2012 New Revision: 230475 URL: http://svn.freebsd.org/changeset/base/230475 Log: Add C11 macros describing subnormal numbers to float.h. Reviewed by: bde Modified: head/sys/amd64/include/float.h head/sys/arm/include/float.h head/sys/i386/inc